diff options
author | Strangerke | 2012-12-10 00:23:51 +0100 |
---|---|---|
committer | Strangerke | 2012-12-10 00:23:51 +0100 |
commit | 663bf3139f5091b61f2c9f43b90ffe31793dece1 (patch) | |
tree | a586d8921742bfef1e906c527cb4bc2d83817996 /engines | |
parent | 742b9e4750658615e57690aff228580edfd5c8b0 (diff) | |
download | scummvm-rg350-663bf3139f5091b61f2c9f43b90ffe31793dece1.tar.gz scummvm-rg350-663bf3139f5091b61f2c9f43b90ffe31793dece1.tar.bz2 scummvm-rg350-663bf3139f5091b61f2c9f43b90ffe31793dece1.zip |
HOPKINS: Rename (most of) ComputerManager functions
Diffstat (limited to 'engines')
-rw-r--r-- | engines/hopkins/anim.cpp | 4 | ||||
-rw-r--r-- | engines/hopkins/anim.h | 2 | ||||
-rw-r--r-- | engines/hopkins/computer.cpp | 705 | ||||
-rw-r--r-- | engines/hopkins/computer.h | 160 | ||||
-rw-r--r-- | engines/hopkins/hopkins.cpp | 38 | ||||
-rw-r--r-- | engines/hopkins/objects.cpp | 2 |
6 files changed, 455 insertions, 456 deletions
diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index 441721e141..984163005a 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -34,7 +34,7 @@ namespace Hopkins { AnimationManager::AnimationManager() { - clearAnimationFl = false; + _clearAnimationFl = false; NO_SEQ = false; NO_COUL = false; } @@ -72,7 +72,7 @@ LABEL_2: f.skip(14); f.read(v10, nbytes); - if (clearAnimationFl == true) { + if (_clearAnimationFl) { _vm->_graphicsManager.DD_Lock(); _vm->_graphicsManager.Cls_Video(); _vm->_graphicsManager.DD_Unlock(); diff --git a/engines/hopkins/anim.h b/engines/hopkins/anim.h index 8b7c9d7912..1c7c97b89f 100644 --- a/engines/hopkins/anim.h +++ b/engines/hopkins/anim.h @@ -37,7 +37,7 @@ private: int loadSpriteBank(int idx, const Common::String &filename); public: HopkinsEngine *_vm; - bool clearAnimationFl; + bool _clearAnimationFl; bool NO_SEQ; bool NO_COUL; public: diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp index bc90074d18..f5646d6168 100644 --- a/engines/hopkins/computer.cpp +++ b/engines/hopkins/computer.cpp @@ -34,38 +34,42 @@ namespace Hopkins { ComputerManager::ComputerManager() { for (int i = 0; i < 50; i++) { - MenuText[i]._actvFl = false; - MenuText[i]._lineSize = 0; - memset(MenuText[i]._line, 0, 90); + _menuText[i]._actvFl = false; + _menuText[i]._lineSize = 0; + memset(_menuText[i]._line, 0, 90); } - Common::fill(&Sup_string[0], &Sup_string[200], '\0'); - CASSESPR = NULL; - FMOUSE = false; - TEXT_COL = 0; - CASSETAB = 0; - NBBRIQUES = 0; - CASSESCORE = 0; - CASSEVIE = 0; - CASSESPEED = 0; - BALLEHORI = 0; - BALLEVERTI = 0; - NB_TABLE = 0; + Common::fill(&_inputBuf[0], &_inputBuf[200], '\0'); + _breakoutSpr = NULL; + _textColor = 0; + _breakoutLevel = NULL; + _breakoutBrickNbr = 0; + _breakoutScore = 0; + _breakoutLifes = 0; + _breakoutSpeed = 0; + _ballRightFl = false; + _ballUpFl = false; + _breakoutLevelNbr = 0; RAQX = 0; CASSEP1 = 0; CASSEP2 = 0; CASSDER = 0; - Menu_lignes = 0; } void ComputerManager::setParent(HopkinsEngine *vm) { _vm = vm; } -void ComputerManager::setvideomode() { - TEXT_MODE(); +/** + * Sets up textual entry mode. Used by the code for Hopkins computer. + */ +void ComputerManager::setVideoMode() { + setTextMode(); } -void ComputerManager::TEXT_MODE() { +/** + * Sets up Textual entry mode + */ +void ComputerManager::setTextMode() { _vm->_graphicsManager.Cls_Pal(); _vm->_graphicsManager.DD_Lock(); _vm->_graphicsManager.Cls_Video(); @@ -80,25 +84,41 @@ void ComputerManager::TEXT_MODE() { _vm->_globals.police_h = 8; _vm->_graphicsManager.LOAD_IMAGE("WINTEXT"); _vm->_graphicsManager.FADE_INW(); - Charge_Menu(); + loadMenu(); _vm->_eventsManager.souris_flag = false; } -void ComputerManager::clearscreen() { +/** + * Clear the screen + */ +void ComputerManager::clearScreen() { _vm->_graphicsManager.LOAD_IMAGE("WINTEXT"); _vm->_graphicsManager.FADE_INW(); } -void ComputerManager::settextcolor(int col) { - TEXT_COL = col; +/** + * Sets the text mode color + */ +void ComputerManager::setTextColor(int col) { + _textColor = col; } -void ComputerManager::settextposition(int yp, int xp) { +/** + * Sets the text position. + * @param yp Y position + * @param xp X position + * @remarks Yes, the reverse co-ordinate pair is really like that in the original game. + */ +void ComputerManager::setTextPosition(int yp, int xp) { _textPosition.x = xp << 3; _textPosition.y = yp << 4; } -void ComputerManager::COMPUT_HOPKINS(ComputerEnum mode) { +/** + * Show a computer in the FBI office + * @param mode Which computer to display + */ +void ComputerManager::showComputer(ComputerEnum mode) { bool passwordMatch; char *v3; char s[12]; @@ -107,30 +127,30 @@ void ComputerManager::COMPUT_HOPKINS(ComputerEnum mode) { _vm->_eventsManager.ESC_KEY = 0; passwordMatch = false; _vm->_graphicsManager.RESET_SEGMENT_VESA(); - setvideomode(); - settextcolor(4); + setVideoMode(); + setTextColor(4); _vm->_eventsManager.videkey(); - settextposition(2, 4); + setTextPosition(2, 4); if (mode == COMPUTER_HOPKINS) - outtext(Common::String(MenuText[0]._line)); - if (mode == COMPUTER_SAMANTHAS) - outtext(Common::String(MenuText[1]._line)); - if (mode == COMPUTER_PUBLIC) - outtext(Common::String(MenuText[2]._line)); + outText(Common::String(_menuText[0]._line)); + else if (mode == COMPUTER_SAMANTHAS) + outText(Common::String(_menuText[1]._line)); + else if (mode == COMPUTER_PUBLIC) + outText(Common::String(_menuText[2]._line)); - settextcolor(1); + setTextColor(1); if (mode == COMPUTER_PUBLIC) { - settextposition(10, 8); - outtext(Common::String(MenuText[3]._line)); + setTextPosition(10, 8); + outText(Common::String(_menuText[3]._line)); } - settextposition(12, 28); - outtext(Common::String(MenuText[4]._line)); - settextposition(14, 35); + setTextPosition(12, 28); + outText(Common::String(_menuText[4]._line)); + setTextPosition(14, 35); memset(s, 0, 12); TXT4(280, 224, 8); - strcpy(s, Sup_string); + strcpy(s, _inputBuf); v3 = &s[0]; if (mode == COMPUTER_HOPKINS) { @@ -145,8 +165,7 @@ void ComputerManager::COMPUT_HOPKINS(ComputerEnum mode) { } while (v5); if (v5) passwordMatch = true; - } - if (mode == COMPUTER_SAMANTHAS) { + } else if (mode == COMPUTER_SAMANTHAS) { char *v6 = &s[0]; s2 = "328MHZA"; int v7 = 8; @@ -159,8 +178,7 @@ void ComputerManager::COMPUT_HOPKINS(ComputerEnum mode) { } while (v8); if (v8) passwordMatch = true; - } - if (mode == COMPUTER_PUBLIC) { + } else if (mode == COMPUTER_PUBLIC) { char *v9 = &s[0]; s2 = "ALLFREE"; int v10 = 8; @@ -174,48 +192,48 @@ void ComputerManager::COMPUT_HOPKINS(ComputerEnum mode) { if (v11) passwordMatch = true; } + if (passwordMatch) { while (!_vm->shouldQuit()) { _vm->_eventsManager.ESC_KEY = false; _vm->_eventsManager.videkey(); - clearscreen(); - settextcolor(4); - settextposition(2, 4); + clearScreen(); + setTextColor(4); + setTextPosition(2, 4); if (mode == COMPUTER_HOPKINS) - outtext(Common::String(MenuText[0]._line)); - if (mode == COMPUTER_SAMANTHAS) - outtext(Common::String(MenuText[1]._line)); - if (mode == COMPUTER_PUBLIC) - outtext(Common::String(MenuText[2]._line)); - settextcolor(15); - settextposition(8, 25); - settextcolor(15); - outtext2(Common::String(MenuText[6]._line)); - settextposition(20, 25); - outtext2(Common::String(MenuText[7]._line)); + outText(Common::String(_menuText[0]._line)); + else if (mode == COMPUTER_SAMANTHAS) + outText(Common::String(_menuText[1]._line)); + else if (mode == COMPUTER_PUBLIC) + outText(Common::String(_menuText[2]._line)); + setTextColor(15); + setTextPosition(8, 25); + setTextColor(15); + outText2(Common::String(_menuText[6]._line)); + setTextPosition(20, 25); + outText2(Common::String(_menuText[7]._line)); if (mode == COMPUTER_HOPKINS) { - settextposition(10, 25); - outtext2(Common::String(MenuText[8]._line)); - settextposition(12, 25); - outtext2(Common::String(MenuText[9]._line)); - settextposition(14, 25); - outtext2(Common::String(MenuText[10]._line)); - settextposition(16, 25); - outtext2(Common::String(MenuText[11]._line)); - } - if (mode == COMPUTER_SAMANTHAS) { + setTextPosition(10, 25); + outText2(Common::String(_menuText[8]._line)); + setTextPosition(12, 25); + outText2(Common::String(_menuText[9]._line)); + setTextPosition(14, 25); + outText2(Common::String(_menuText[10]._line)); + setTextPosition(16, 25); + outText2(Common::String(_menuText[11]._line)); + } else if (mode == COMPUTER_SAMANTHAS) { _vm->_eventsManager.videkey(); - settextposition(10, 25); -// outtext2(Common::String(MenuText[0x95A])); <=== CHECKME: Unexpected value! replaced by the following line, for consistancy - outtext2(Common::String(MenuText[12]._line)); - settextposition(12, 25); - outtext2(Common::String(MenuText[13]._line)); - settextposition(14, 25); - outtext2(Common::String(MenuText[14]._line)); - settextposition(16, 25); - outtext2(Common::String(MenuText[15]._line)); - settextposition(18, 25); - outtext2(Common::String(MenuText[16]._line)); + setTextPosition(10, 25); +// outText2(Common::String(_menuText[0x95A])); <=== CHECKME: Unexpected value! replaced by the following line, for consistancy + outText2(Common::String(_menuText[12]._line)); + setTextPosition(12, 25); + outText2(Common::String(_menuText[13]._line)); + setTextPosition(14, 25); + outText2(Common::String(_menuText[14]._line)); + setTextPosition(16, 25); + outText2(Common::String(_menuText[15]._line)); + setTextPosition(18, 25); + outText2(Common::String(_menuText[16]._line)); } bool numericFlag = false; @@ -234,38 +252,38 @@ void ComputerManager::COMPUT_HOPKINS(ComputerEnum mode) { break; // 1 - Games if (v12 == '1') { - GAMES(); + displayGamesSubMenu(); } else if (mode == COMPUTER_HOPKINS) { _vm->_eventsManager.videkey(); - clearscreen(); - settextcolor(4); - settextposition(2, 4); - outtext(Common::String(MenuText[0]._line)); - settextcolor(15); + clearScreen(); + setTextColor(4); + setTextPosition(2, 4); + outText(Common::String(_menuText[0]._line)); + setTextColor(15); if (v12 == 50) - LIT_TEXTE(1); + readText(1); if (v12 == 51) - LIT_TEXTE(2); + readText(2); if (v12 == 52) - LIT_TEXTE(3); + readText(3); if (v12 == 53) - LIT_TEXTE(4); + readText(4); } else if (mode == COMPUTER_SAMANTHAS) { - clearscreen(); - settextcolor(4); - settextposition(2, 4); - outtext(Common::String(MenuText[1]._line)); - settextcolor(15); + clearScreen(); + setTextColor(4); + setTextPosition(2, 4); + outText(Common::String(_menuText[1]._line)); + setTextColor(15); if (v12 == 50) - LIT_TEXTE(6); + readText(6); if (v12 == 51) - LIT_TEXTE(7); + readText(7); if (v12 == 52) - LIT_TEXTE(8); + readText(8); if (v12 == 53) - LIT_TEXTE(9); + readText(9); if (v12 == 54) { - LIT_TEXTE(10); + readText(10); _vm->_globals.SAUVEGARDE->data[svField270] = 4; } } @@ -274,12 +292,12 @@ void ComputerManager::COMPUT_HOPKINS(ComputerEnum mode) { _vm->_graphicsManager.Cls_Video(); _vm->_graphicsManager.DD_Unlock(); _vm->_graphicsManager.DD_VBL(); - RESTORE_POLICE(); + restoreFBIRoom(); } else { // Access Denied - settextcolor(4); - settextposition(16, 25); - outtext(Common::String(MenuText[5]._line)); + setTextColor(4); + setTextPosition(16, 25); + outText(Common::String(_menuText[5]._line)); _vm->_eventsManager.VBL(); _vm->_eventsManager.delay(1000); @@ -288,7 +306,7 @@ void ComputerManager::COMPUT_HOPKINS(ComputerEnum mode) { _vm->_graphicsManager.Cls_Video(); _vm->_graphicsManager.DD_Unlock(); _vm->_graphicsManager.DD_VBL(); - RESTORE_POLICE(); + restoreFBIRoom(); _vm->_eventsManager.MOUSE_OFF(); } if (mode == 1) @@ -299,7 +317,10 @@ void ComputerManager::COMPUT_HOPKINS(ComputerEnum mode) { _vm->_graphicsManager.RESET_SEGMENT_VESA(); } -void ComputerManager::Charge_Menu() { +/** + * Load Menu data + */ +void ComputerManager::loadMenu() { _vm->_fileManager.constructFilename(_vm->_globals.HOPLINK, "COMPUTAN.TXT"); byte *ptr = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); byte *tmpPtr = ptr; @@ -313,22 +334,21 @@ void ComputerManager::Charge_Menu() { loopCond = true; goto LABEL_13; } - MenuText[lineNum]._actvFl = 1; + _menuText[lineNum]._actvFl = 1; strPos = 0; for (;;) { byte curChar = tmpPtr[strPos + 2]; if (curChar == '%' || curChar == 10) break; - MenuText[lineNum]._line[strPos++] = curChar; + _menuText[lineNum]._line[strPos++] = curChar; if (strPos > 89) goto LABEL_11; } - MenuText[lineNum]._line[strPos] = 0; - MenuText[lineNum]._lineSize = strPos - 1; + _menuText[lineNum]._line[strPos] = 0; + _menuText[lineNum]._lineSize = strPos - 1; LABEL_11: ++lineNum; } - Menu_lignes = lineNum; LABEL_13: tmpPtr = tmpPtr + 1; } while (!loopCond); @@ -433,7 +453,7 @@ void ComputerManager::TXT4(int xp, int yp, int textIdx) { // BackSpace if (curChar == 8 && textIndex > 0) { - Sup_string[textIndex--] = 0; + _inputBuf[textIndex--] = 0; x1 -= _vm->_globals.police_l; x2 = x1 + 2 * _vm->_globals.police_l; _vm->_graphicsManager.Copy_Mem(_vm->_graphicsManager.VESA_SCREEN, x1, yp, 3 * _vm->_globals.police_l, 12, _vm->_graphicsManager.VESA_BUFFER, x1, yp); @@ -444,7 +464,7 @@ void ComputerManager::TXT4(int xp, int yp, int textIdx) { newChar = mappedChar; _vm->_graphicsManager.Copy_Mem(_vm->_graphicsManager.VESA_SCREEN, x1, yp, _vm->_globals.police_l, 12, _vm->_graphicsManager.VESA_BUFFER, x1, yp); _vm->_graphicsManager.Ajoute_Segment_Vesa(x1, yp, _vm->_globals.police_l + x1, yp + 12); - Sup_string[textIndex] = newChar; + _inputBuf[textIndex] = newChar; charString = Common::String::format("%c_", newChar); _vm->_fontManager.TEXT_NOW(x1, yp, charString, -4); @@ -459,19 +479,28 @@ void ComputerManager::TXT4(int xp, int yp, int textIdx) { _vm->_graphicsManager.Ajoute_Segment_Vesa(x1, yp, _vm->_globals.police_l + x1, yp + 12); _vm->_eventsManager.VBL(); - Sup_string[textIndex] = 0; + _inputBuf[textIndex] = 0; _vm->_eventsManager.souris_flag = oldMouseFlag; } -void ComputerManager::outtext(const Common::String &msg) { - _vm->_fontManager.TEXT_COMPUT(_textPosition.x, _textPosition.y, msg, TEXT_COL); +/** + * Outputs a text string + */ +void ComputerManager::outText(const Common::String &msg) { + _vm->_fontManager.TEXT_COMPUT(_textPosition.x, _textPosition.y, msg, _textColor); } -void ComputerManager::outtext2(const Common::String &msg) { - _vm->_fontManager.TEXT_NOW(_textPosition.x, _textPosition.y, msg, TEXT_COL); +/** + * Outputs a text string + */ +void ComputerManager::outText2(const Common::String &msg) { + _vm->_fontManager.TEXT_NOW(_textPosition.x, _textPosition.y, msg, _textColor); } -void ComputerManager::RESTORE_POLICE() { +/** + * Restores the scene for the FBI headquarters room + */ +void ComputerManager::restoreFBIRoom() { _vm->_globals.police = _vm->_globals.dos_free2(_vm->_globals.police); _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "FONTE3.SPR"); _vm->_globals.police = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); @@ -481,7 +510,10 @@ void ComputerManager::RESTORE_POLICE() { _vm->_eventsManager.souris_flag = true; } -void ComputerManager::LIT_TEXTE(int a1) { +/** + * Display texts for the given menu entry + */ +void ComputerManager::readText(int idx) { uint16 v1; int v2; uint16 v3; @@ -515,7 +547,7 @@ void ComputerManager::LIT_TEXTE(int a1) { numStr = Common::String::format("%c%c", *(ptr + v3 + 1), *(ptr + v3 + 2)); num = atol(numStr.c_str()); - if (num == a1) + if (num == idx) v2 = 1; } if (v2 == 1) @@ -537,8 +569,8 @@ void ComputerManager::LIT_TEXTE(int a1) { // v12[v7] = 0; // v7 = 0; v8 = v4; - settextposition(v6, v5); - outtext(v12); + setTextPosition(v6, v5); + outText(v12); ++v6; v5 = 1; @@ -558,23 +590,26 @@ void ComputerManager::LIT_TEXTE(int a1) { _vm->_globals.dos_free2(ptr); } -void ComputerManager::GAMES() { +/** + * Display breakout when Games sub-menu is selected + */ +void ComputerManager::displayGamesSubMenu() { const byte *v1 = _vm->_objectsManager.Sprite[0].spriteData; uint oldSpeed = _vm->_globals.vitesse; _vm->_globals.vitesse = 1; _vm->_eventsManager.CHANGE_MOUSE(0); - CASSESPR = g_PTRNUL; + _breakoutSpr = g_PTRNUL; _vm->_eventsManager.CASSE = true; _vm->_eventsManager.CASSE_SOURIS_ON(); - CASSETAB = (int16 *)g_PTRNUL; - NBBRIQUES = 0; - CASSESCORE = 0; - CASSEVIE = 5; - CASSESPEED = 1; - BALLEHORI = 0; - BALLEVERTI = 0; - NB_TABLE = 0; + _breakoutLevel = (int16 *)g_PTRNUL; + _breakoutBrickNbr = 0; + _breakoutScore = 0; + _breakoutLifes = 5; + _breakoutSpeed = 1; + _ballRightFl = false; + _ballUpFl = false; + _breakoutLevelNbr = 0; _vm->_graphicsManager.min_y = 0; _vm->_graphicsManager.max_x = 320; _vm->_graphicsManager.max_y = 200; @@ -582,16 +617,16 @@ void ComputerManager::GAMES() { _vm->_soundManager.CHARGE_SAMPLE(2, "SOUND38.WAV"); _vm->_soundManager.CHARGE_SAMPLE(3, "SOUND39.WAV"); _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "CASSE.SPR"); - CASSESPR = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); - CHARGE_SCORE(); - MODE_VGA256(); - NEWTAB(); + _breakoutSpr = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); + loadHiscore(); + setModeVGA256(); + newLevel(); _vm->_graphicsManager.RESET_SEGMENT_VESA(); - PLAY_BRIQUE(); + playBreakout(); _vm->_graphicsManager.RESET_SEGMENT_VESA(); - CASSESPR = _vm->_globals.LIBERE_FICHIER(CASSESPR); - _vm->_globals.dos_free2((byte *)CASSETAB); - CASSETAB = (int16 *)g_PTRNUL; + _breakoutSpr = _vm->_globals.LIBERE_FICHIER(_breakoutSpr); + _vm->_globals.dos_free2((byte *)_breakoutLevel); + _breakoutLevel = (int16 *)g_PTRNUL; _vm->_objectsManager.Sprite[0].spriteData = v1; _vm->_soundManager.DEL_SAMPLE(1); @@ -600,15 +635,18 @@ void ComputerManager::GAMES() { _vm->_globals.vitesse = oldSpeed; _vm->_eventsManager.CASSE = false; _vm->_eventsManager.CASSE_SOURIS_OFF(); - setvideomode(); - settextcolor(15); - clearscreen(); + setVideoMode(); + setTextColor(15); + clearScreen(); _vm->_graphicsManager.max_x = 680; _vm->_graphicsManager.min_y = 0; _vm->_graphicsManager.max_y = 460; } -void ComputerManager::CHARGE_SCORE() { +/** + * Load Highscore from file + */ +void ComputerManager::loadHiscore() { char nextChar; byte *ptr; @@ -621,22 +659,25 @@ void ComputerManager::CHARGE_SCORE() { nextChar = *(ptr + i + (16 * scoreIndex)); if (!nextChar) nextChar = ' '; - Score[scoreIndex].name += nextChar; + _score[scoreIndex]._name += nextChar; } for (int i = 0; i < 9; ++i) { nextChar = *(ptr + i + scoreIndex * 16 + 6); if (!nextChar) nextChar = '0'; - Score[scoreIndex].score += nextChar; + _score[scoreIndex]._score += nextChar; } } _vm->_globals.dos_free2(ptr); - CASSE_HISCORE = atol(Score[5].score.c_str()); + _breakoutHiscore = atol(_score[5]._score.c_str()); } -void ComputerManager::MODE_VGA256() { +/** + * VGA 256 col + */ +void ComputerManager::setModeVGA256() { _vm->_graphicsManager.DD_Lock(); _vm->_graphicsManager.Cls_Video(); _vm->_graphicsManager.DD_Unlock(); @@ -644,57 +685,62 @@ void ComputerManager::MODE_VGA256() { _vm->_graphicsManager.SCANLINE(0x140u); } -void ComputerManager::NEWTAB() { +/** + * Load new level + */ +void ComputerManager::newLevel() { Common::String file; Common::File f; _vm->_objectsManager.SPRITE_OFF(0); _vm->_objectsManager.SPRITE_OFF(1); - ++CASSEVIE; - if (CASSEVIE > 11) - CASSEVIE = 11; + ++_breakoutLifes; + if (_breakoutLifes > 11) + _breakoutLifes = 11; _vm->_graphicsManager.LOAD_IMAGEVGA("CASSEF.PCX"); - AFF_VIE(); - if (CASSETAB != (int16 *)g_PTRNUL) { - _vm->_globals.dos_free2((byte *)CASSETAB); - CASSETAB = (int16 *)g_PTRNUL; + displayLifes(); + if (_breakoutLevel != (int16 *)g_PTRNUL) { + _vm->_globals.dos_free2((byte *)_breakoutLevel); + _breakoutLevel = (int16 *)g_PTRNUL; } - ++NB_TABLE; + ++_breakoutLevelNbr; while (!_vm->shouldQuit()) { - file = Common::String::format("TAB%d.TAB", NB_TABLE); + file = Common::String::format("TAB%d.TAB", _breakoutLevelNbr); _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, file); if (f.open(_vm->_globals.NFICHIER)) break; - NB_TABLE = 1; + _breakoutLevelNbr = 1; } f.close(); - CASSETAB = (int16 *)_vm->_fileManager.loadFile(_vm->_globals.NFICHIER); - AFF_BRIQUES(); - _vm->_objectsManager.SPRITE(CASSESPR, 150, 192, 0, 13, 0, 0, 0, 0); - _vm->_objectsManager.SPRITE(CASSESPR, 164, 187, 1, 14, 0, 0, 0, 0); - BALLE = Common::Point(164, 187); + _breakoutLevel = (int16 *)_vm->_fileManager.loadFile(_vm->_globals.NFICHIER); + displayBricks(); + _vm->_objectsManager.SPRITE(_breakoutSpr, 150, 192, 0, 13, 0, 0, 0, 0); + _vm->_objectsManager.SPRITE(_breakoutSpr, 164, 187, 1, 14, 0, 0, 0, 0); + _ballPosition = Common::Point(164, 187); RAQX = 150; _vm->_objectsManager.SPRITE_ON(0); _vm->_objectsManager.SPRITE_ON(1); _vm->_eventsManager.MOUSE_ON1(); - FMOUSE = true; _vm->_soundManager.PLAY_SAMPLE(3, 5); } -void ComputerManager::AFF_BRIQUES() { +/** + * Display bricks in breakout game + */ +void ComputerManager::displayBricks() { int xp; int yp; int v2; uint16 v3; int16 *v4; - NBBRIQUES = 0; - CASSESPEED = 1; - v4 = CASSETAB; + _breakoutBrickNbr = 0; + _breakoutSpeed = 1; + v4 = _breakoutLevel; v3 = 0; do { xp = v4[v3]; @@ -702,38 +748,41 @@ void ComputerManager::AFF_BRIQUES() { v2 = v4[v3 + 4]; if (xp != -1) { if (v2 <= 6) - ++NBBRIQUES; + ++_breakoutBrickNbr; if (v2 == 3) - _vm->_graphicsManager.AFFICHE_SPEEDVGA(CASSESPR, xp, yp, 17); + _vm->_graphicsManager.AFFICHE_SPEEDVGA(_breakoutSpr, xp, yp, 17); else if (v2 == 6) - _vm->_graphicsManager.AFFICHE_SPEEDVGA(CASSESPR, xp, yp, 18); + _vm->_graphicsManager.AFFICHE_SPEEDVGA(_breakoutSpr, xp, yp, 18); else if (v2 == 5) - _vm->_graphicsManager.AFFICHE_SPEEDVGA(CASSESPR, xp, yp, 19); + _vm->_graphicsManager.AFFICHE_SPEEDVGA(_breakoutSpr, xp, yp, 19); else if (v2 == 4) - _vm->_graphicsManager.AFFICHE_SPEEDVGA(CASSESPR, xp, yp, 20); + _vm->_graphicsManager.AFFICHE_SPEEDVGA(_breakoutSpr, xp, yp, 20); else if (v2 == 1) - _vm->_graphicsManager.AFFICHE_SPEEDVGA(CASSESPR, xp, yp, 21); + _vm->_graphicsManager.AFFICHE_SPEEDVGA(_breakoutSpr, xp, yp, 21); else if (v2 == 2) - _vm->_graphicsManager.AFFICHE_SPEEDVGA(CASSESPR, xp, yp, 22); + _vm->_graphicsManager.AFFICHE_SPEEDVGA(_breakoutSpr, xp, yp, 22); else if (v2 == 31) - _vm->_graphicsManager.AFFICHE_SPEEDVGA(CASSESPR, xp, yp, 23); + _vm->_graphicsManager.AFFICHE_SPEEDVGA(_breakoutSpr, xp, yp, 23); } v3 += 6; } while (xp != -1); - IMPRIMESCORE(); + displayScore(); } -void ComputerManager::AFF_VIE() { +/** + * Display Lifes in breakout game + */ +void ComputerManager::displayLifes() { int v3; int v4; - int v0 = CASSEVIE - 1; + int v0 = _breakoutLifes - 1; int v1 = 10; - for (int v2 = 0; v2 <= 11; v2++) { - _vm->_graphicsManager.AFFICHE_SPEEDVGA(CASSESPR, v1, 10, 15); + for (int i = 0; i <= 11; i++) { + _vm->_graphicsManager.AFFICHE_SPEEDVGA(_breakoutSpr, v1, 10, 15); v1 += 7; } @@ -742,7 +791,7 @@ void ComputerManager::AFF_VIE() { v4 = 0; if (v0 > 0) { do { - _vm->_graphicsManager.AFFICHE_SPEEDVGA(CASSESPR, v3, 10, 14); + _vm->_graphicsManager.AFFICHE_SPEEDVGA(_breakoutSpr, v3, 10, 14); v3 += 7; ++v4; } while (v4 < v0); @@ -750,7 +799,10 @@ void ComputerManager::AFF_VIE() { } } -void ComputerManager::PLAY_BRIQUE() { +/** + * Main function for breakout game + */ +void ComputerManager::playBreakout() { int v1 = 0; int v; @@ -758,9 +810,9 @@ void ComputerManager::PLAY_BRIQUE() { while (!_vm->shouldQuit()) { // Set up the racket and ball _vm->_eventsManager.MOUSE_OFF(); - BALLE = Common::Point(RAQX + 14, 187); + _ballPosition = Common::Point(RAQX + 14, 187); _vm->_objectsManager.SETYSPR(1, 187); - _vm->_objectsManager.SETXSPR(1, BALLE.x); + _vm->_objectsManager.SETXSPR(1, _ballPosition.x); _vm->_graphicsManager.RESET_SEGMENT_VESA(); _vm->_eventsManager.VBL(); _vm->_graphicsManager.FADE_IN_CASSE(); @@ -778,10 +830,10 @@ void ComputerManager::PLAY_BRIQUE() { _vm->_eventsManager.VBL(); } while (!_vm->shouldQuit() && _vm->_eventsManager.BMOUSE() != 1); - CASSESPEED = 1; - BALLE = Common::Point(RAQX + 14, 187); - BALLEHORI = RAQX > 135; - BALLEVERTI = 0; + _breakoutSpeed = 1; + _ballPosition = Common::Point(RAQX + 14, 187); + _ballRightFl = (RAQX > 135); + _ballUpFl = false; // Play loop do { @@ -793,53 +845,57 @@ void ComputerManager::PLAY_BRIQUE() { if (RAQX > 282) RAQX = 282; _vm->_objectsManager.SETXSPR(0, RAQX); - v1 = DEP_BALLE(); + v1 = moveBall(); _vm->_eventsManager.VBL(); } while (!_vm->shouldQuit() && !v1); if (v1 != 1) break; _vm->_graphicsManager.FADE_OUT_CASSE(); - --CASSEVIE; + --_breakoutLifes; - if (CASSEVIE) { - AFF_VIE(); - if (CASSEVIE) + if (_breakoutLifes) { + displayLifes(); + if (_breakoutLifes) continue; } _vm->_eventsManager.MOUSE_ON1(); _vm->_objectsManager.SPRITE_OFF(0); _vm->_objectsManager.SPRITE_OFF(1); - if (CASSESCORE > CASSE_HISCORE) - NAME_SCORE(); - v = HIGHT_SCORE(); + if (_breakoutScore > _breakoutHiscore) + getScoreName(); + v = displayHiscores(); if (v != 1) break; - NBBRIQUES = 0; - CASSESCORE = 0; - CASSEVIE = 4; - CASSESPEED = 1; - BALLEHORI = 0; - BALLEVERTI = 0; - NB_TABLE = 0; - CHARGE_SCORE(); - NEWTAB(); + _breakoutBrickNbr = 0; + _breakoutScore = 0; + _breakoutLifes = 4; + _breakoutSpeed = 1; + _ballRightFl = false; + _ballUpFl = false; + _breakoutLevelNbr = 0; + loadHiscore(); + newLevel(); } if (v1 != 2) return; _vm->_graphicsManager.FADE_OUT_CASSE(); - NEWTAB(); + newLevel(); } } -int ComputerManager::HIGHT_SCORE() { +/** + * Show the high scores for the Breakout game + * @return The selected button index: 1 = Game, 2 = Quit + */ +int ComputerManager::displayHiscores() { int yp; int buttonIndex; int xp; byte *ptr; _vm->_graphicsManager.RESET_SEGMENT_VESA(); - CHARGE_SCORE(); + loadHiscore(); _vm->_graphicsManager.LOAD_IMAGEVGA("HISCORE.PCX"); _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "ALPHA.SPR"); ptr = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); @@ -855,11 +911,11 @@ int ComputerManager::HIGHT_SCORE() { // Display the characters of the name for (int i = 0; i <= 5; i++) - PRINT_HSCORE(ptr, 9 * i + 69, yp, Score[scoreIndex].name[i]); + displayHiscoreLine(ptr, 9 * i + 69, yp, _score[scoreIndex]._name[i]); // Display the digits of the score for (int i = 0; i <= 8; i++) - PRINT_HSCORE(ptr, 9 * i + 199, yp, Score[scoreIndex].score[i]); + displayHiscoreLine(ptr, 9 * i + 199, yp, _score[scoreIndex]._score[i]); } _vm->_graphicsManager.FADE_IN_CASSE(); @@ -884,7 +940,10 @@ int ComputerManager::HIGHT_SCORE() { return buttonIndex; } -void ComputerManager::NAME_SCORE() { +/** + * Display a screen to enter player name in the case of a new hiscore + */ +void ComputerManager::getScoreName() { char curChar; byte *ptr; @@ -897,7 +956,7 @@ void ComputerManager::NAME_SCORE() { ptr = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); _vm->_graphicsManager.FADE_IN_CASSE(); for (int strPos = 0; strPos <= 4; strPos++) { - PRINT_HSCORE(ptr, 9 * strPos + 140, 78, 1); + displayHiscoreLine(ptr, 9 * strPos + 140, 78, 1); curChar = toupper(_vm->_eventsManager.keywin()); if ((curChar <= '/') || (curChar > 'Z')) @@ -905,38 +964,41 @@ void ComputerManager::NAME_SCORE() { if ((uint16)(curChar - ':') <= 6u) curChar = ' '; - Score[5].name.setChar(curChar, strPos); - PRINT_HSCORE(ptr, 9 * strPos + 140, 78, curChar); + _score[5]._name.setChar(curChar, strPos); + displayHiscoreLine(ptr, 9 * strPos + 140, 78, curChar); for (int idx = 0; idx < 12; ++idx) _vm->_eventsManager.VBL(); } - Score[5].score = " "; + _score[5]._score = " "; char score[16]; - sprintf(score, "%d", CASSESCORE); + sprintf(score, "%d", _breakoutScore); int scoreLen = 0; do ++scoreLen; while (score[scoreLen]); int scorePos = 8; - for (int i = scoreLen; ; Score[5].score.setChar(score[i], scorePos--)) { + for (int i = scoreLen; ; _score[5]._score.setChar(score[i], scorePos--)) { --i; if (i <= -1) break; } _vm->_graphicsManager.FADE_OUT_CASSE(); _vm->_globals.dos_free2(ptr); - SAUVE_SCORE(); + saveScore(); } -void ComputerManager::IMPRIMESCORE() { +/** + * Display current score + */ +void ComputerManager::displayScore() { int16 v0; int16 v1; int16 i; char s[40]; - sprintf(s, "%d", CASSESCORE); + sprintf(s, "%d", _breakoutScore); v0 = 0; do ++v0; @@ -950,11 +1012,9 @@ void ComputerManager::IMPRIMESCORE() { } void ComputerManager::IMPSCORE(int a1, int a2) { - int16 v2; - int16 v3; + int16 v2 = 203; + int16 v3 = 3; - v2 = 203; - v3 = 3; if (a1 == 1) v2 = 193; if (a1 == 2) @@ -985,10 +1045,13 @@ void ComputerManager::IMPSCORE(int a1, int a2) { v3 = 11; if (a2 == 57) v3 = 12; - _vm->_graphicsManager.AFFICHE_SPEEDVGA(CASSESPR, v2 - 3, 11, v3); + _vm->_graphicsManager.AFFICHE_SPEEDVGA(_breakoutSpr, v2 - 3, 11, v3); } -void ComputerManager::SAUVE_SCORE() { +/** + * Save Hiscore in file + */ +void ComputerManager::saveScore() { int v1; int v2; int v4; @@ -1002,7 +1065,7 @@ void ComputerManager::SAUVE_SCORE() { int v17[6]; for (int v0 = 0; v0 <= 5; v0++) { - v1 = atol(Score[v0].score.c_str()); + v1 = atol(_score[v0]._score.c_str()); v17[v0] = v1; if (!v1) v17[v0] = 5; @@ -1031,7 +1094,7 @@ void ComputerManager::SAUVE_SCORE() { v6 = 16 * v5; v14 = v16[v5]; for (int v7 = 0; v7 <= 4; v7++) { - v8 = Score[v14].name[v7]; + v8 = _score[v14]._name[v7]; if (!v8) v8 = 32; *(ptr + (16 * v5) + v7) = v8; @@ -1041,7 +1104,7 @@ void ComputerManager::SAUVE_SCORE() { v9 = v6 + 6; for (int v10 = 0; v10 <= 8; v10++) { - v11 = Score[v14].score[v10]; + v11 = _score[v14]._score[v10]; if (!v11) v11 = 48; *(ptr + v9 + v10) = v11; @@ -1054,7 +1117,10 @@ void ComputerManager::SAUVE_SCORE() { _vm->_globals.dos_free2(ptr); } -void ComputerManager::PRINT_HSCORE(byte *objectData, int a2, int a3, int a4) { +/** + * Display parts of the hiscore line + */ +void ComputerManager::displayHiscoreLine(byte *objectData, int x, int y, int a4) { char v4; int v5; @@ -1072,94 +1138,101 @@ void ComputerManager::PRINT_HSCORE(byte *objectData, int a2, int a3, int a4) { v5 = 36; if (v4 == 1) v5 = 37; - _vm->_graphicsManager.AFFICHE_SPEEDVGA(objectData, a2, a3, v5); + _vm->_graphicsManager.AFFICHE_SPEEDVGA(objectData, x, y, v5); } -int ComputerManager::DEP_BALLE() { +/** + * Handle ball moves + */ +int ComputerManager::moveBall() { int16 v1; int16 v4 = 0; //(signed int)(6.0 * (long double)_vm->getRandomNumber( rand() / 2147483648.0) + 1; // TODO: Figure out random number int v0 = _vm->getRandomNumber(6); - if (CASSESPEED == 1) { + if (_breakoutSpeed == 1) { CASSEP1 = 1; CASSEP2 = 1; } - if (CASSESPEED == 2) { + if (_breakoutSpeed == 2) { CASSEP1 = 1; CASSEP2 = 2; } - if (CASSESPEED == 3) { + if (_breakoutSpeed == 3) { CASSEP1 = 2; CASSEP2 = 2; } - if (CASSESPEED == 4) { + if (_breakoutSpeed == 4) { CASSEP1 = 3; CASSEP2 = 2; } v1 = CASSEP1; if (CASSDER == CASSEP1) v1 = CASSEP2; - if (BALLEVERTI == 1) - BALLE.y += v1; - if (!BALLEVERTI) - BALLE.y -= v1; - if (BALLEHORI == 1) - BALLE.x += v1; - if (!BALLEHORI) - BALLE.x -= v1; + + if (_ballUpFl) + _ballPosition.y += v1; + else + _ballPosition.y -= v1; + + if (_ballRightFl) + _ballPosition.x += v1; + else + _ballPosition.x -= v1; + CASSDER = v1; - if (BALLE.x <= 6) { + if (_ballPosition.x <= 6) { _vm->_soundManager.PLAY_SAMPLE(2, 6); - BALLE.x = v0 + 6; - BALLEHORI = BALLEHORI != 1; + _ballPosition.x = v0 + 6; + _ballRightFl = !_ballRightFl; } - if (BALLE.x > 307) { + if (_ballPosition.x > 307) { _vm->_soundManager.PLAY_SAMPLE(2, 6); - BALLE.x = 307 - v0; - BALLEHORI = BALLEHORI != 1; + _ballPosition.x = 307 - v0; + _ballRightFl = !_ballRightFl; } - if (BALLE.y <= 6) { + if (_ballPosition.y <= 6) { _vm->_soundManager.PLAY_SAMPLE(2, 6); - BALLE.y = v0 + 7; - BALLEVERTI = BALLEVERTI != 1; + _ballPosition.y = v0 + 7; + _ballUpFl = !_ballUpFl; } - if ((uint16)(BALLE.y - 186) <= 8u) { + if ((uint16)(_ballPosition.y - 186) <= 8u) { _vm->_soundManager.PLAY_SAMPLE(2, 6); - if (BALLE.x > RAQX - 2) { - int v2 = BALLE.x + 6; + if (_ballPosition.x > RAQX - 2) { + int v2 = _ballPosition.x + 6; if (v2 < RAQX + 36) { - BALLEVERTI = 0; + _ballUpFl = false; if (v2 <= RAQX + 15) { - BALLEHORI = 0; - if (BALLE.x >= RAQX && v2 <= RAQX + 5) - BALLE.x -= 4; - if (BALLE.x >= RAQX + 5 && BALLE.x + 6 <= RAQX + 10) - BALLE.x -= 2; + _ballRightFl = false; + if (_ballPosition.x >= RAQX && v2 <= RAQX + 5) + _ballPosition.x -= 4; + if (_ballPosition.x >= RAQX + 5 && _ballPosition.x + 6 <= RAQX + 10) + _ballPosition.x -= 2; } - if (BALLE.x >= RAQX + 19 && BALLE.x + 6 <= RAQX + 36) { - BALLEHORI = 1; - if (BALLE.x >= RAQX + 29) - BALLE.x += 4; - if (BALLE.x >= RAQX + 24 && BALLE.x + 6 <= RAQX + 29) - BALLE.x += 2; + if (_ballPosition.x >= RAQX + 19 && _ballPosition.x + 6 <= RAQX + 36) { + _ballRightFl = true; + if (_ballPosition.x >= RAQX + 29) + _ballPosition.x += 4; + if (_ballPosition.x >= RAQX + 24 && _ballPosition.x + 6 <= RAQX + 29) + _ballPosition.x += 2; } } } } - if (BALLE.y > 194) + if (_ballPosition.y > 194) v4 = 1; - VERIFBRIQUES(); - _vm->_objectsManager.SETXSPR(1, BALLE.x); - _vm->_objectsManager.SETYSPR(1, BALLE.y); - if (!NBBRIQUES) + checkBallCollisions(); + _vm->_objectsManager.SETXSPR(1, _ballPosition.x); + _vm->_objectsManager.SETYSPR(1, _ballPosition.y); + if (!_breakoutBrickNbr) v4 = 2; return v4; } - - -void ComputerManager::VERIFBRIQUES() { +/** + * Check ball collision with bricks + */ +void ComputerManager::checkBallCollisions() { int v1; int v2; int v3; @@ -1171,11 +1244,11 @@ void ComputerManager::VERIFBRIQUES() { //v6 = (signed int)(6.0 * (long double)rand() / 2147483648.0) + 1; // TODO: Check if correct int v6 = _vm->getRandomNumber(6) + 1; - int v0 = BALLE.x; - int v13 = BALLE.y; - int v5 = BALLE.x + 6; - int v12 = BALLE.y + 6; - int16 *v9 = CASSETAB; + int v0 = _ballPosition.x; + int v13 = _ballPosition.y; + int v5 = _ballPosition.x + 6; + int v12 = _ballPosition.y + 6; + int16 *v9 = _breakoutLevel; uint16 v8 = 0; do { v1 = v9[v8]; @@ -1189,24 +1262,24 @@ void ComputerManager::VERIFBRIQUES() { if (v13 <= v10 && v12 >= v10) { if (v0 >= v1 && v5 <= v2) { v4 = 1; - BALLEVERTI = 1; + _ballUpFl = true; } if (v5 >= v1) { if (v0 <= v1) { ++v4; - BALLEVERTI = 1; - BALLEHORI = 0; + _ballUpFl = true; + _ballRightFl = false; if (v3 == 31) - BALLE.x -= v6; + _ballPosition.x -= v6; } } if (v0 <= v2) { if (v5 >= v2) { ++v4; - BALLEVERTI = 1; - BALLEHORI = 1; + _ballUpFl = true; + _ballRightFl = true; if (v3 == 31) - BALLE.x += v6; + _ballPosition.x += v6; } } } @@ -1215,24 +1288,24 @@ void ComputerManager::VERIFBRIQUES() { goto LABEL_31; if (v0 >= v1 && v5 <= v2) { ++v4; - BALLEVERTI = 0; + _ballUpFl = false; } if (v5 >= v1) { if (v0 <= v1) { ++v4; - BALLEVERTI = 0; - BALLEHORI = 0; + _ballUpFl = false; + _ballRightFl = false; if (v3 == 31) - BALLE.x -= 2; + _ballPosition.x -= 2; } } if (v0 <= v2) { if (v5 >= v2) { ++v4; - BALLEVERTI = 0; - BALLEHORI = 1; + _ballUpFl = false; + _ballRightFl = true; if (v3 == 31) - BALLE.x += v6; + _ballPosition.x += v6; } } } @@ -1242,17 +1315,17 @@ LABEL_31: if (v5 >= v1) { if (v0 <= v1) { ++v4; - BALLEHORI = 0; + _ballRightFl = false; if (v3 == 31) - BALLE.x -= v6; + _ballPosition.x -= v6; } } if (v0 <= v2) { if (v5 >= v2) { ++v4; - BALLEHORI = 1; + _ballRightFl = true; if (v3 == 31) - BALLE.x += v6; + _ballPosition.x += v6; } } } @@ -1262,29 +1335,29 @@ LABEL_31: _vm->_soundManager.PLAY_SAMPLE(2, 6); } else { _vm->_soundManager.PLAY_SAMPLE(1, 5); - _vm->_graphicsManager.AFFICHE_SPEEDVGA(CASSESPR, v1, v11, 16); + _vm->_graphicsManager.AFFICHE_SPEEDVGA(_breakoutSpr, v1, v11, 16); if (v3 == 1) - CASSESCORE += 10; + _breakoutScore += 10; if (v3 == 2) - CASSESCORE += 5; + _breakoutScore += 5; if (v3 == 3) { - CASSESCORE += 50; - if (CASSESPEED <= 1) - CASSESPEED = 2; - if (NBBRIQUES <= 19) - CASSESPEED = 3; + _breakoutScore += 50; + if (_breakoutSpeed <= 1) + _breakoutSpeed = 2; + if (_breakoutBrickNbr <= 19) + _breakoutSpeed = 3; } if (v3 == 4) - CASSESCORE += 20; + _breakoutScore += 20; if (v3 == 5) { - CASSESCORE += 30; - if (CASSESPEED <= 1) - CASSESPEED = 2; + _breakoutScore += 30; + if (_breakoutSpeed <= 1) + _breakoutSpeed = 2; } if (v3 == 6) - CASSESCORE += 40; - IMPRIMESCORE(); - --NBBRIQUES; + _breakoutScore += 40; + displayScore(); + --_breakoutBrickNbr; *((uint16 *)v9 + v8 + 5) = 0; v7 = 1; } diff --git a/engines/hopkins/computer.h b/engines/hopkins/computer.h index 6632213bfe..e7cfc10bd7 100644 --- a/engines/hopkins/computer.h +++ b/engines/hopkins/computer.h @@ -38,8 +38,8 @@ struct MenuItem { }; struct ScoreItem { - Common::String name; - Common::String score; + Common::String _name; + Common::String _score; }; enum ComputerEnum { COMPUTER_HOPKINS = 1, COMPUTER_SAMANTHAS = 2, COMPUTER_PUBLIC = 3 }; @@ -47,134 +47,60 @@ enum ComputerEnum { COMPUTER_HOPKINS = 1, COMPUTER_SAMANTHAS = 2, COMPUTER_PUBLI class ComputerManager { private: HopkinsEngine *_vm; - MenuItem MenuText[50]; - char Sup_string[200]; - ScoreItem Score[6]; - int TEXT_COL; + MenuItem _menuText[50]; + char _inputBuf[200]; + ScoreItem _score[6]; + int _textColor; Common::Point _textPosition; - Common::Point BALLE; - byte *CASSESPR; - int16 *CASSETAB; - bool FMOUSE; - int NBBRIQUES; - - /** - * Breakout score - */ - int CASSESCORE; - - /** - * Number of Breakout lives remaining - */ - int CASSEVIE; - - /** - * Breakout game speed - */ - int CASSESPEED; - - /** - * Breakout ball horizontal position - */ - int BALLEHORI; - - /** - * Breakout ball vertical position - */ - int BALLEVERTI; - - int NB_TABLE; + Common::Point _ballPosition; + byte *_breakoutSpr; + int16 *_breakoutLevel; + int _breakoutBrickNbr; + int _breakoutScore; + int _breakoutLifes; + int _breakoutSpeed; + bool _ballRightFl; + bool _ballUpFl; + int _breakoutLevelNbr; int RAQX; - int CASSE_HISCORE; + int _breakoutHiscore; int CASSEP1; int CASSEP2; int CASSDER; - int Menu_lignes; // CHECKME: Useless variable - /** - * Load the menu text - */ - void Charge_Menu(); + void loadMenu(); + void restoreFBIRoom(); + void setVideoMode(); + void setTextMode(); + void clearScreen(); + void setTextColor(int col); + void setTextPosition(int yp, int xp); + void outText(const Common::String &msg); + void outText2(const Common::String &msg); + void readText(int idx); + void loadHiscore(); + void newLevel(); + void setModeVGA256(); + void displayLifes(); + void displayBricks(); + void displayGamesSubMenu(); + void displayScore(); + int displayHiscores(); + void displayHiscoreLine(byte *objectData, int x, int y, int a4); + void playBreakout(); + void saveScore(); + int moveBall(); + void checkBallCollisions(); + void getScoreName(); void TXT4(int xp, int yp, int textIdx); - /** - * Restores the scene for the FBI headquarters room - */ - void RESTORE_POLICE(); - - /** - * Sets up textual entry mode. Used by the code for Hopkins computer. - */ - void setvideomode(); - - /** - * Sets up textual entry mode. Used by the code for Hopkins computer. - */ - void TEXT_MODE(); - - /** - * Clear the screen - */ - void clearscreen(); - - /** - * Sets the text mode color - */ - void settextcolor(int col); - - /** - * Sets the text position. - * @param yp Y position - * @param xp X position - * @remarks Yes, the reverse co-ordinate pair is really like that in the original game. - */ - void settextposition(int yp, int xp); - - /** - * Outputs a text string - */ - void outtext(const Common::String &msg); - - /** - * Outputs a text string - */ - void outtext2(const Common::String &msg); - - void GAMES(); - void LIT_TEXTE(int a1); - void CHARGE_SCORE(); - void MODE_VGA256(); - void NEWTAB(); - void AFF_BRIQUES(); - void AFF_VIE(); - - /** - * Play the Breakout game - */ - void PLAY_BRIQUE(); - - /** - * Show the high scores for the Breakout game - * @return The selected button index: 1 = Game, 2 = Quit - */ - int HIGHT_SCORE(); - void NAME_SCORE(); void IMPSCORE(int a1, int a2); - void SAUVE_SCORE(); - void PRINT_HSCORE(byte *objectData, int a2, int a3, int a4); - void IMPRIMESCORE(); - int DEP_BALLE(); - void VERIFBRIQUES(); + public: ComputerManager(); void setParent(HopkinsEngine *vm); - - /** - * Show a computer in the FBI office - * @param mode Which computer to display - */ - void COMPUT_HOPKINS(ComputerEnum mode); + void showComputer(ComputerEnum mode); }; } // End of namespace Hopkins diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 6b5350aed7..42b0a1b522 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -384,7 +384,7 @@ bool HopkinsEngine::runWin95Demo() { _globals.SAUVEGARDE->data[svField6] = _globals.ECRAN; _globals.ECRAN = 113; _globals.SAUVEGARDE->data[svField5] = _globals.ECRAN; - _computerManager.COMPUT_HOPKINS(COMPUTER_HOPKINS); + _computerManager.showComputer(COMPUTER_HOPKINS); _graphicsManager.MODE_VESA(); break; @@ -394,7 +394,7 @@ bool HopkinsEngine::runWin95Demo() { _globals.ECRAN = 114; _globals.SAUVEGARDE->data[svField5] = _globals.ECRAN; _globals.SORTIE = 0; - _computerManager.COMPUT_HOPKINS(COMPUTER_SAMANTHAS); + _computerManager.showComputer(COMPUTER_SAMANTHAS); _graphicsManager.MODE_VESA(); break; @@ -404,7 +404,7 @@ bool HopkinsEngine::runWin95Demo() { _globals.SAUVEGARDE->data[svField6] = _globals.ECRAN; _globals.ECRAN = 115; _globals.SAUVEGARDE->data[svField5] = _globals.ECRAN; - _computerManager.COMPUT_HOPKINS(COMPUTER_PUBLIC); + _computerManager.showComputer(COMPUTER_PUBLIC); _graphicsManager.MODE_VESA(); break; @@ -739,7 +739,7 @@ bool HopkinsEngine::runLinuxDemo() { _globals.SAUVEGARDE->data[svField6] = _globals.ECRAN; _globals.ECRAN = 113; _globals.SAUVEGARDE->data[svField5] = 113; - _computerManager.COMPUT_HOPKINS(COMPUTER_HOPKINS); + _computerManager.showComputer(COMPUTER_HOPKINS); _graphicsManager.DD_Lock(); _graphicsManager.Cls_Video(); @@ -757,7 +757,7 @@ bool HopkinsEngine::runLinuxDemo() { _globals.SAUVEGARDE->data[svField6] = _globals.ECRAN; _globals.ECRAN = 114; _globals.SAUVEGARDE->data[svField5] = 114; - _computerManager.COMPUT_HOPKINS(COMPUTER_SAMANTHAS); + _computerManager.showComputer(COMPUTER_SAMANTHAS); _graphicsManager.DD_Lock(); _graphicsManager.Cls_Video(); _graphicsManager.DD_Unlock(); @@ -769,7 +769,7 @@ bool HopkinsEngine::runLinuxDemo() { _globals.SAUVEGARDE->data[svField6] = _globals.ECRAN; _globals.ECRAN = 115; _globals.SAUVEGARDE->data[svField5] = 115; - _computerManager.COMPUT_HOPKINS(COMPUTER_PUBLIC); + _computerManager.showComputer(COMPUTER_PUBLIC); _graphicsManager.DD_Lock(); _graphicsManager.Cls_Video(); _graphicsManager.DD_Unlock(); @@ -1612,7 +1612,7 @@ bool HopkinsEngine::runWin95full() { _globals.SAUVEGARDE->data[svField6] = _globals.OLD_ECRAN; _globals.SAUVEGARDE->data[svField5] = _globals.ECRAN; _globals.SORTIE = 0; - _computerManager.COMPUT_HOPKINS(COMPUTER_HOPKINS); + _computerManager.showComputer(COMPUTER_HOPKINS); _graphicsManager.MODE_VESA(); break; @@ -1622,7 +1622,7 @@ bool HopkinsEngine::runWin95full() { _globals.ECRAN = 114; _globals.SAUVEGARDE->data[svField6] = _globals.OLD_ECRAN; _globals.SAUVEGARDE->data[svField5] = _globals.ECRAN; - _computerManager.COMPUT_HOPKINS(COMPUTER_SAMANTHAS); + _computerManager.showComputer(COMPUTER_SAMANTHAS); _graphicsManager.MODE_VESA(); break; @@ -1632,7 +1632,7 @@ bool HopkinsEngine::runWin95full() { _globals.SAUVEGARDE->data[svField6] = _globals.OLD_ECRAN; _globals.SAUVEGARDE->data[svField5] = _globals.ECRAN; _globals.SORTIE = 0; - _computerManager.COMPUT_HOPKINS(COMPUTER_PUBLIC); + _computerManager.showComputer(COMPUTER_PUBLIC); _graphicsManager.MODE_VESA(); break; @@ -2491,7 +2491,7 @@ bool HopkinsEngine::runLinuxFull() { _globals.SAUVEGARDE->data[svField6] = _globals.ECRAN; _globals.ECRAN = 113; _globals.SAUVEGARDE->data[svField5] = 113; - _computerManager.COMPUT_HOPKINS(COMPUTER_HOPKINS); + _computerManager.showComputer(COMPUTER_HOPKINS); _graphicsManager.DD_Lock(); _graphicsManager.Cls_Video(); _graphicsManager.DD_Unlock(); @@ -2508,7 +2508,7 @@ bool HopkinsEngine::runLinuxFull() { _globals.SAUVEGARDE->data[svField6] = _globals.ECRAN; _globals.ECRAN = 114; _globals.SAUVEGARDE->data[svField5] = 114; - _computerManager.COMPUT_HOPKINS(COMPUTER_SAMANTHAS); + _computerManager.showComputer(COMPUTER_SAMANTHAS); _graphicsManager.DD_Lock(); _graphicsManager.Cls_Video(); _graphicsManager.DD_Unlock(); @@ -2520,7 +2520,7 @@ bool HopkinsEngine::runLinuxFull() { _globals.SAUVEGARDE->data[svField6] = _globals.ECRAN; _globals.ECRAN = 115; _globals.SAUVEGARDE->data[svField5] = 115; - _computerManager.COMPUT_HOPKINS(COMPUTER_PUBLIC); + _computerManager.showComputer(COMPUTER_PUBLIC); _graphicsManager.DD_Lock(); _graphicsManager.Cls_Video(); _graphicsManager.DD_Unlock(); @@ -2704,7 +2704,7 @@ void HopkinsEngine::INTRORUN() { _globals.iRegul = 1; _eventsManager.VBL(); _soundManager.WSOUND(16); - _animationManager.clearAnimationFl = true; + _animationManager._clearAnimationFl = true; _animationManager.playAnim("J1.anm", 12, 12, 50); if (!_eventsManager.ESC_KEY) { _soundManager.VOICE_MIX(1, 3); @@ -2896,7 +2896,7 @@ void HopkinsEngine::INTRORUN() { _graphicsManager.FADE_OUTW(); _graphicsManager.FIN_VISU(); - _animationManager.clearAnimationFl = true; + _animationManager._clearAnimationFl = true; _soundManager.WSOUND(3); _soundManager.SPECIAL_SOUND = 1; _animationManager.playAnim("INTRO1.anm", 10, 24, 18); @@ -2916,7 +2916,7 @@ void HopkinsEngine::INTRORUN() { return; if (!_eventsManager.ESC_KEY) { - _animationManager.clearAnimationFl = false; + _animationManager._clearAnimationFl = false; _graphicsManager.FADE_LINUX = 2; _animationManager.playAnim("J4.anm", 12, 12, 1000); } @@ -3107,7 +3107,7 @@ void HopkinsEngine::BASE() { _graphicsManager.Cls_Video(); _graphicsManager.DD_Unlock(); _graphicsManager.Cls_Pal(); - _animationManager.clearAnimationFl = true; + _animationManager._clearAnimationFl = true; _soundManager.WSOUND(25); if (_globals.SVGA == 1) { _animationManager.playAnim("base00.anm", 10, 18, 18); @@ -3165,7 +3165,7 @@ void HopkinsEngine::BASE() { } _eventsManager.ESC_KEY = false; - _animationManager.clearAnimationFl = false; + _animationManager._clearAnimationFl = false; _globals.SORTIE = 85; } @@ -3372,7 +3372,7 @@ void HopkinsEngine::AVION() { _graphicsManager.DD_Unlock(); _graphicsManager.Cls_Pal(); - _animationManager.clearAnimationFl = false; + _animationManager._clearAnimationFl = false; if (_globals.SVGA == 1) { _animationManager.playAnim("aerop00.anm", 10, 18, 18); if (!_eventsManager.ESC_KEY) @@ -3440,7 +3440,7 @@ void HopkinsEngine::AVION() { } _eventsManager.ESC_KEY = 0; - _animationManager.clearAnimationFl = false; + _animationManager._clearAnimationFl = false; } int HopkinsEngine::PWBASE() { diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index e7d4822098..7496f70625 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -4205,7 +4205,7 @@ void ObjectsManager::SPECIAL_JEU() { _vm->_soundManager.SPECIAL_SOUND = 198; PERSO_ON = true; _vm->_animationManager.NO_SEQ = true; - _vm->_animationManager.clearAnimationFl = false; + _vm->_animationManager._clearAnimationFl = false; _vm->_animationManager.playAnim("otage.ANM", 1, 24, 500); _vm->_animationManager.NO_SEQ = false; _vm->_soundManager.SPECIAL_SOUND = 0; |