From 2e7b16a8bdb6ad1cf51046d57eb0f5406ee2cc13 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 13 Jun 2012 11:28:25 +0200 Subject: HUGO: Apply coding convention (in progress) --- engines/hugo/parser.cpp | 74 ++++++++++++++++++++++++------------------------- 1 file changed, 37 insertions(+), 37 deletions(-) (limited to 'engines/hugo/parser.cpp') diff --git a/engines/hugo/parser.cpp b/engines/hugo/parser.cpp index 4eaed6fecf..b4255e607b 100644 --- a/engines/hugo/parser.cpp +++ b/engines/hugo/parser.cpp @@ -58,21 +58,21 @@ Parser::~Parser() { } uint16 Parser::getCmdDefaultVerbIdx(const uint16 index) const { - return _cmdList[index][0].verbIndex; + return _cmdList[index][0]._verbIndex; } /** * Read a cmd structure from Hugo.dat */ void Parser::readCmd(Common::ReadStream &in, cmd &curCmd) { - curCmd.verbIndex = in.readUint16BE(); - curCmd.reqIndex = in.readUint16BE(); - curCmd.textDataNoCarryIndex = in.readUint16BE(); - curCmd.reqState = in.readByte(); - curCmd.newState = in.readByte(); - curCmd.textDataWrongIndex = in.readUint16BE(); - curCmd.textDataDoneIndex = in.readUint16BE(); - curCmd.actIndex = in.readUint16BE(); + curCmd._verbIndex = in.readUint16BE(); + curCmd._reqIndex = in.readUint16BE(); + curCmd._textDataNoCarryIndex = in.readUint16BE(); + curCmd._reqState = in.readByte(); + curCmd._newState = in.readByte(); + curCmd._textDataWrongIndex = in.readUint16BE(); + curCmd._textDataDoneIndex = in.readUint16BE(); + curCmd._actIndex = in.readUint16BE(); } /** @@ -100,12 +100,12 @@ void Parser::loadCmdList(Common::ReadStream &in) { void Parser::readBG(Common::ReadStream &in, background_t &curBG) { - curBG.verbIndex = in.readUint16BE(); - curBG.nounIndex = in.readUint16BE(); - curBG.commentIndex = in.readSint16BE(); - curBG.matchFl = (in.readByte() != 0); - curBG.roomState = in.readByte(); - curBG.bonusIndex = in.readByte(); + curBG._verbIndex = in.readUint16BE(); + curBG._nounIndex = in.readUint16BE(); + curBG._commentIndex = in.readSint16BE(); + curBG._matchFl = (in.readByte() != 0); + curBG._roomState = in.readByte(); + curBG._bonusIndex = in.readByte(); } /** @@ -165,11 +165,11 @@ const char *Parser::useBG(const char *name) { debugC(1, kDebugEngine, "useBG(%s)", name); objectList_t p = _backgroundObjects[*_vm->_screen_p]; - for (int i = 0; p[i].verbIndex != 0; i++) { - if ((name == _vm->_text->getNoun(p[i].nounIndex, 0) && - p[i].verbIndex != _vm->_look) && - ((p[i].roomState == kStateDontCare) || (p[i].roomState == _vm->_screenStates[*_vm->_screen_p]))) - return _vm->_text->getVerb(p[i].verbIndex, 0); + for (int i = 0; p[i]._verbIndex != 0; i++) { + if ((name == _vm->_text->getNoun(p[i]._nounIndex, 0) && + p[i]._verbIndex != _vm->_look) && + ((p[i]._roomState == kStateDontCare) || (p[i]._roomState == _vm->_screenStates[*_vm->_screen_p]))) + return _vm->_text->getVerb(p[i]._verbIndex, 0); } return 0; @@ -222,7 +222,7 @@ void Parser::charHandler() { _cmdLine[--_cmdLineIndex] = '\0'; break; case Common::KEYCODE_RETURN: // EOL, pass line to line handler - if (_cmdLineIndex && (_vm->_hero->pathType != kPathQuiet)) { + if (_cmdLineIndex && (_vm->_hero->_pathType != kPathQuiet)) { // Remove inventory bar if active if (_vm->_inventory->getInventoryState() == kInventoryActive) _vm->_inventory->setInventoryState(kInventoryUp); @@ -248,9 +248,9 @@ void Parser::charHandler() { _cmdLineCursor = (_cmdLineCursor == '_') ? ' ' : '_'; // See if recall button pressed - if (gameStatus.recallFl) { + if (gameStatus._recallFl) { // Copy previous line to current cmdline - gameStatus.recallFl = false; + gameStatus._recallFl = false; strcpy(_cmdLine, _vm->_line); _cmdLineIndex = strlen(_cmdLine); } @@ -259,9 +259,9 @@ void Parser::charHandler() { sprintf(_vm->_scoreLine, "F1-Help %s Score: %d of %d Sound %s", (_vm->_config.turboFl) ? "T" : " ", _vm->getScore(), _vm->getMaxScore(), (_vm->_config.soundFl) ? "On" : "Off"); // See if "look" button pressed - if (gameStatus.lookFl) { + if (gameStatus._lookFl) { command("look around"); - gameStatus.lookFl = false; + gameStatus._lookFl = false; } } @@ -288,8 +288,8 @@ void Parser::keyHandler(Common::Event event) { _vm->_file->restoreGame(0); break; case Common::KEYCODE_s: - if (gameStatus.viewState == kViewPlay) { - if (gameStatus.gameOverFl) + if (gameStatus._viewState == kViewPlay) { + if (gameStatus._gameOverFl) _vm->gameOverMsg(); else _vm->_file->saveGame(-1, Common::String()); @@ -304,8 +304,8 @@ void Parser::keyHandler(Common::Event event) { // Process key down event - called from OnKeyDown() switch (nChar) { // Set various toggle states case Common::KEYCODE_ESCAPE: // Escape key, may want to QUIT - if (gameStatus.viewState == kViewIntro) - gameStatus.skipIntroFl = true; + if (gameStatus._viewState == kViewIntro) + gameStatus._skipIntroFl = true; else { if (_vm->_inventory->getInventoryState() == kInventoryActive) // Remove inventory, if displayed _vm->_inventory->setInventoryState(kInventoryUp); @@ -333,7 +333,7 @@ void Parser::keyHandler(Common::Event event) { break; case Common::KEYCODE_F1: // User Help (DOS) if (_checkDoubleF1Fl) - gameStatus.helpFl = true; + gameStatus._helpFl = true; else _vm->_screen->userHelp(); _checkDoubleF1Fl = !_checkDoubleF1Fl; @@ -343,11 +343,11 @@ void Parser::keyHandler(Common::Event event) { _vm->_sound->toggleMusic(); break; case Common::KEYCODE_F3: // Repeat last line - gameStatus.recallFl = true; + gameStatus._recallFl = true; break; case Common::KEYCODE_F4: // Save game - if (gameStatus.viewState == kViewPlay) { - if (gameStatus.gameOverFl) + if (gameStatus._viewState == kViewPlay) { + if (gameStatus._gameOverFl) _vm->gameOverMsg(); else _vm->_file->saveGame(-1, Common::String()); @@ -366,7 +366,7 @@ void Parser::keyHandler(Common::Event event) { warning("STUB: F9 (DOS) - BossKey"); break; default: // Any other key - if (!gameStatus.storyModeFl) { // Keyboard disabled + if (!gameStatus._storyModeFl) { // Keyboard disabled // Add printable keys to ring buffer uint16 bnext = _putIndex + 1; if (bnext >= sizeof(_ringBuffer)) @@ -452,7 +452,7 @@ void Parser::showDosInventory() const { for (int i = 0; i < _vm->_object->_numObj; i++) { // Find widths of 2 columns if (_vm->_object->isCarried(i)) { - uint16 len = strlen(_vm->_text->getNoun(_vm->_object->_objects[i].nounIndex, 2)); + uint16 len = strlen(_vm->_text->getNoun(_vm->_object->_objects[i]._nounIndex, 2)); if (index++ & 1) // Right hand column len2 = (len > len2) ? len : len2; else @@ -473,9 +473,9 @@ void Parser::showDosInventory() const { for (int i = 0; i < _vm->_object->_numObj; i++) { // Assign strings if (_vm->_object->isCarried(i)) { if (index++ & 1) - buffer += Common::String(_vm->_text->getNoun(_vm->_object->_objects[i].nounIndex, 2)) + "\n"; + buffer += Common::String(_vm->_text->getNoun(_vm->_object->_objects[i]._nounIndex, 2)) + "\n"; else - buffer += Common::String(_vm->_text->getNoun(_vm->_object->_objects[i].nounIndex, 2)) + Common::String(blanks, len1 - strlen(_vm->_text->getNoun(_vm->_object->_objects[i].nounIndex, 2))); + buffer += Common::String(_vm->_text->getNoun(_vm->_object->_objects[i]._nounIndex, 2)) + Common::String(blanks, len1 - strlen(_vm->_text->getNoun(_vm->_object->_objects[i]._nounIndex, 2))); } } if (index & 1) -- cgit v1.2.3 From fbc2c6d08ac96c92e2424118dc9b0548628287e5 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 13 Jun 2012 17:44:09 +0200 Subject: HUGO: More renaming --- engines/hugo/parser.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'engines/hugo/parser.cpp') diff --git a/engines/hugo/parser.cpp b/engines/hugo/parser.cpp index b4255e607b..3b0eb1d979 100644 --- a/engines/hugo/parser.cpp +++ b/engines/hugo/parser.cpp @@ -198,7 +198,7 @@ void Parser::freeParser() { } void Parser::switchTurbo() { - _vm->_config.turboFl = !_vm->_config.turboFl; + _vm->_config._turboFl = !_vm->_config._turboFl; } /** @@ -256,7 +256,7 @@ void Parser::charHandler() { } sprintf(_vm->_statusLine, ">%s%c", _cmdLine, _cmdLineCursor); - sprintf(_vm->_scoreLine, "F1-Help %s Score: %d of %d Sound %s", (_vm->_config.turboFl) ? "T" : " ", _vm->getScore(), _vm->getMaxScore(), (_vm->_config.soundFl) ? "On" : "Off"); + sprintf(_vm->_scoreLine, "F1-Help %s Score: %d of %d Sound %s", (_vm->_config._turboFl) ? "T" : " ", _vm->getScore(), _vm->getMaxScore(), (_vm->_config._soundFl) ? "On" : "Off"); // See if "look" button pressed if (gameStatus._lookFl) { -- cgit v1.2.3 From 999ae29de43444118b5990a272a98031c4707ee0 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 13 Jun 2012 20:58:01 +0200 Subject: HUGO: Rename structs and enums --- engines/hugo/parser.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'engines/hugo/parser.cpp') diff --git a/engines/hugo/parser.cpp b/engines/hugo/parser.cpp index 3b0eb1d979..68343a0374 100644 --- a/engines/hugo/parser.cpp +++ b/engines/hugo/parser.cpp @@ -99,7 +99,7 @@ void Parser::loadCmdList(Common::ReadStream &in) { } -void Parser::readBG(Common::ReadStream &in, background_t &curBG) { +void Parser::readBG(Common::ReadStream &in, Background &curBG) { curBG._verbIndex = in.readUint16BE(); curBG._nounIndex = in.readUint16BE(); curBG._commentIndex = in.readSint16BE(); @@ -112,7 +112,7 @@ void Parser::readBG(Common::ReadStream &in, background_t &curBG) { * Read _backgrounObjects from Hugo.dat */ void Parser::loadBackgroundObjects(Common::ReadStream &in) { - background_t tmpBG; + Background tmpBG; memset(&tmpBG, 0, sizeof(tmpBG)); for (int varnt = 0; varnt < _vm->_numVariant; varnt++) { @@ -120,13 +120,13 @@ void Parser::loadBackgroundObjects(Common::ReadStream &in) { if (varnt == _vm->_gameVariant) { _backgroundObjectsSize = numElem; - _backgroundObjects = (background_t **)malloc(sizeof(background_t *) * numElem); + _backgroundObjects = (Background **)malloc(sizeof(Background *) * numElem); } for (int i = 0; i < numElem; i++) { uint16 numSubElem = in.readUint16BE(); if (varnt == _vm->_gameVariant) - _backgroundObjects[i] = (background_t *)malloc(sizeof(background_t) * numSubElem); + _backgroundObjects[i] = (Background *)malloc(sizeof(Background) * numSubElem); for (int j = 0; j < numSubElem; j++) readBG(in, (varnt == _vm->_gameVariant) ? _backgroundObjects[i][j] : tmpBG); @@ -138,15 +138,15 @@ void Parser::loadBackgroundObjects(Common::ReadStream &in) { * Read _catchallList from Hugo.dat */ void Parser::loadCatchallList(Common::ReadStream &in) { - background_t *wrkCatchallList = 0; - background_t tmpBG; + Background *wrkCatchallList = 0; + Background tmpBG; memset(&tmpBG, 0, sizeof(tmpBG)); for (int varnt = 0; varnt < _vm->_numVariant; varnt++) { uint16 numElem = in.readUint16BE(); if (varnt == _vm->_gameVariant) - _catchallList = wrkCatchallList = (background_t *)malloc(sizeof(background_t) * numElem); + _catchallList = wrkCatchallList = (Background *)malloc(sizeof(Background) * numElem); for (int i = 0; i < numElem; i++) readBG(in, (varnt == _vm->_gameVariant) ? wrkCatchallList[i] : tmpBG); @@ -164,7 +164,7 @@ void Parser::loadArrayReqs(Common::SeekableReadStream &in) { const char *Parser::useBG(const char *name) { debugC(1, kDebugEngine, "useBG(%s)", name); - objectList_t p = _backgroundObjects[*_vm->_screen_p]; + ObjectList p = _backgroundObjects[*_vm->_screen_p]; for (int i = 0; p[i]._verbIndex != 0; i++) { if ((name == _vm->_text->getNoun(p[i]._nounIndex, 0) && p[i]._verbIndex != _vm->_look) && @@ -208,7 +208,7 @@ void Parser::switchTurbo() { void Parser::charHandler() { debugC(4, kDebugParser, "charHandler"); - status_t &gameStatus = _vm->getGameStatus(); + Status &gameStatus = _vm->getGameStatus(); // Check for one or more characters in ring buffer while (_getIndex != _putIndex) { @@ -268,7 +268,7 @@ void Parser::charHandler() { void Parser::keyHandler(Common::Event event) { debugC(1, kDebugParser, "keyHandler(%d)", event.kbd.keycode); - status_t &gameStatus = _vm->getGameStatus(); + Status &gameStatus = _vm->getGameStatus(); uint16 nChar = event.kbd.keycode; if (event.kbd.flags & (Common::KBD_ALT | Common::KBD_SCRL)) -- cgit v1.2.3 From 179427c78f2a634beb4485661bf2b1fc78ef559f Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 13 Jun 2012 21:18:37 +0200 Subject: HUGO: Rename pointers --- engines/hugo/parser.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'engines/hugo/parser.cpp') diff --git a/engines/hugo/parser.cpp b/engines/hugo/parser.cpp index 68343a0374..d18cc2181c 100644 --- a/engines/hugo/parser.cpp +++ b/engines/hugo/parser.cpp @@ -164,11 +164,11 @@ void Parser::loadArrayReqs(Common::SeekableReadStream &in) { const char *Parser::useBG(const char *name) { debugC(1, kDebugEngine, "useBG(%s)", name); - ObjectList p = _backgroundObjects[*_vm->_screen_p]; + ObjectList p = _backgroundObjects[*_vm->_screenPtr]; for (int i = 0; p[i]._verbIndex != 0; i++) { if ((name == _vm->_text->getNoun(p[i]._nounIndex, 0) && p[i]._verbIndex != _vm->_look) && - ((p[i]._roomState == kStateDontCare) || (p[i]._roomState == _vm->_screenStates[*_vm->_screen_p]))) + ((p[i]._roomState == kStateDontCare) || (p[i]._roomState == _vm->_screenStates[*_vm->_screenPtr]))) return _vm->_text->getVerb(p[i]._verbIndex, 0); } -- cgit v1.2.3