From d8e4d18f7a2226aec3010683de8f40dee3b7e831 Mon Sep 17 00:00:00 2001 From: Borja Lorente Date: Wed, 17 Aug 2016 15:46:00 +0200 Subject: MACVENTURE: Remove leftover comments and document magic constants --- engines/macventure/gui.cpp | 33 ++++++--------------------------- engines/macventure/gui.h | 1 - engines/macventure/image.h | 1 - engines/macventure/macventure.cpp | 38 +++++++++++--------------------------- engines/macventure/script.cpp | 4 ++-- engines/macventure/text.cpp | 3 +-- engines/macventure/world.cpp | 2 ++ 7 files changed, 22 insertions(+), 60 deletions(-) diff --git a/engines/macventure/gui.cpp b/engines/macventure/gui.cpp index d0af4ed51f..27454054d5 100644 --- a/engines/macventure/gui.cpp +++ b/engines/macventure/gui.cpp @@ -187,6 +187,7 @@ void Gui::draw() { drawDraggedObject(); drawDialog(); + // TODO: When window titles with custom borders are in MacGui, this should be used. //drawWindowTitle(kMainGameWindow, _mainGameWindow->getSurface()); } @@ -408,7 +409,9 @@ bool Gui::loadMenus() { char *title; /* Skip menuID, width, height, resourceID, placeholder */ - for (int skip = 0; skip < 5; skip++) { res->readUint16BE(); } + for (int skip = 0; skip < 5; skip++) { + res->readUint16BE(); + } titleLength = res->readByte(); title = new char[titleLength + 1]; res->read(title, titleLength); @@ -518,7 +521,7 @@ bool Gui::loadControls() { data.scrollMax = res->readUint16BE(); data.scrollMin = res->readUint16BE(); data.cdef = res->readUint16BE(); - data.refcon = (ControlAction)res->readUint32BE();//(ControlType)id; id++; + data.refcon = (ControlAction)res->readUint32BE(); data.type = (ControlType)id; id++; data.titleLength = res->readByte(); if (data.titleLength) { @@ -660,10 +663,6 @@ void Gui::drawExitsWindow() { } findWindow(kExitsWindow)->setDirty(true); - - // To be deleted - //g_system->copyRectToScreen(srf->getPixels(), srf->pitch, 0, 0, srf->w, srf->h); - //g_system->updateScreen(); } void Gui::drawConsoleWindow() { @@ -722,21 +721,7 @@ void Gui::drawObjectsInWindow(const WindowData &targetData, Graphics::ManagedSur } void Gui::drawWindowTitle(WindowReference target, Graphics::ManagedSurface *surface) { - WindowData &data = findWindowData(target); - BorderBounds border = borderBounds(data.type); - - uint left = 10;//getCurrentFont().getStringWidth(data.title) - 10; - uint right = 30;//getCurrentFont().getStringWidth(data.title) + 10; - - surface->fillRect(Common::Rect(left, 0, right, border.topOffset - 1), kColorGray); - getCurrentFont().drawString( - surface, - data.title, - 0, - right, - right - left, - kColorBlack, - Graphics::kTextAlignCenter); + // TODO: Implement when MacGui supports titles in windows with custom borders. } void Gui::drawDraggedObject() { @@ -1290,12 +1275,6 @@ bool Gui::processEvent(Common::Event &event) { moveDraggedObject(event.mouse); } processed = true; - - // TEST - //Common::Rect mr = calculateClickRect(event.mouse, _screen.getBounds()); - //_screen.fillRect(mr, kColorGreen); - //g_system->copyRectToScreen(_screen.getPixels(), _screen.pitch, 0, 0, _screen.w, _screen.h); - //g_system->updateScreen(); } processed |= _wm.processEvent(event); diff --git a/engines/macventure/gui.h b/engines/macventure/gui.h index 960c2b8ba3..8ae4a1534d 100644 --- a/engines/macventure/gui.h +++ b/engines/macventure/gui.h @@ -71,7 +71,6 @@ enum MenuAction { kMenuActionCommand }; -//} using namespace MacVentureMenuActions; struct DraggedObj { ObjID id; diff --git a/engines/macventure/image.h b/engines/macventure/image.h index a026c3b8fa..6f6b9600ac 100644 --- a/engines/macventure/image.h +++ b/engines/macventure/image.h @@ -37,7 +37,6 @@ enum BlitMode { kBlitBIC = 1, kBlitOR = 2, kBlitXOR = 3 - //kBlitNONE = 4, }; enum GraphicsEncoding { diff --git a/engines/macventure/macventure.cpp b/engines/macventure/macventure.cpp index 999d41147b..e28bc4e9ba 100644 --- a/engines/macventure/macventure.cpp +++ b/engines/macventure/macventure.cpp @@ -384,7 +384,7 @@ void MacVentureEngine::handleObjectSelect(ObjID objID, WindowReference win, bool const WindowData &windata = _gui->getWindowData(win); if (shiftPressed) { - // Do shift ;) + // TODO: Implement shift functionality. } else { if (_selectedControl && _currentSelection.size() > 0 && getInvolvedObjects() > 1) { if (objID == 0) { @@ -450,14 +450,12 @@ bool MacVentureEngine::showTextEntry(ObjID text, ObjID srcObj, ObjID destObj) { debugC(3, kMVDebugMain, "Showing speech dialog, asset %d from %d to %d", text, srcObj, destObj); _gui->getTextFromUser(); - // HACK WITH FLAGS _prepared = false; warning("Show text entry: not fully tested"); return true; } void MacVentureEngine::setTextInput(Common::String content) { - // HACK WITH FLAGS _prepared = true; _userInput = content; _clickToContinue = false; @@ -646,7 +644,7 @@ void MacVentureEngine::playSounds(bool pause) { delay = _soundManager->playSound(item.reference); break; case kSoundWait: - //wait for sound to finish? + // Empty in the original. break; } } @@ -681,6 +679,7 @@ void MacVentureEngine::unselectAll() { void MacVentureEngine::selectObject(ObjID objID) { if (!_currentSelection.empty()) { if (findParentWindow(objID) != findParentWindow(_currentSelection[0])) { + // TODO: Needs further testing, but it doesn't seem necessary. //unselectAll(); } } @@ -731,11 +730,7 @@ uint MacVentureEngine::getPrefixNdx(ObjID obj) { Common::String MacVentureEngine::getPrefixString(uint flag, ObjID obj) { uint ndx = getPrefixNdx(obj); ndx = ((ndx) >> flag) & 3; - if (ndx) { - return _decodingNamingArticles->getString(ndx); - } else { - return Common::String("m1551gn0 "); - } + return _decodingNamingArticles->getString(ndx); } Common::String MacVentureEngine::getNoun(ObjID ndx) { @@ -743,20 +738,9 @@ Common::String MacVentureEngine::getNoun(ObjID ndx) { } void MacVentureEngine::highlightExit(ObjID objID) { - //ObjID ctl = _gui->getWinChild(obj); - /*if (ctl) { - if (findObjectInArray(obj, _selectedObjs) != -1) - _gui->selectExit(ctl); - else - _gui->unselectExit(ctl); - } - if (obj == _world->getObjAttr(1, kAttrParentObject)) { - if (findObjectInArray(obj, _selectedObjs) != -1) - _gui->selectExit(obj); - else - _gui->unselectExit(obj); - }*/ - //updateWindow(findParentWindow(obj)); + // TODO: It seems unnecessary since the GUI checks whether an object + // is selected, which includes exits. + warning("STUB: highlightExit"); } void MacVentureEngine::selectPrimaryObject(ObjID objID) { @@ -816,7 +800,6 @@ void MacVentureEngine::closeObject(ObjID objID) { } void MacVentureEngine::checkObject(QueuedObject old) { - //warning("checkObject: unimplemented"); bool hasChanged = false; debugC(3, kMVDebugMain, "Check Object[%d] parent[%d] x[%d] y[%d]", old.object, @@ -887,7 +870,6 @@ void MacVentureEngine::checkObject(QueuedObject old) { } void MacVentureEngine::reflectSwap(ObjID fromID, ObjID toID) { - //warning("reflectSwap: untested"); WindowReference from = getObjWindow(fromID); WindowReference to = getObjWindow(toID); WindowReference tmp = to; @@ -936,7 +918,7 @@ bool MacVentureEngine::isGameRunning() { ControlAction MacVenture::MacVentureEngine::referenceToAction(ControlType id) { switch (id) { case MacVenture::kControlExitBox: - return kActivateObject;//?? + return kActivateObject;//?? Like this in the original case MacVenture::kControlExamine: return kExamine; case MacVenture::kControlOpen: @@ -994,6 +976,8 @@ uint32 MacVentureEngine::randBetween(uint32 min, uint32 max) { } uint32 MacVentureEngine::getInvolvedObjects() { + // If there is no valid control selected, we return a number too big + // to be useful. There is no control that uses that many objects. return (_selectedControl ? getGlobalSettings()._cmdArgCnts[_selectedControl - 1] : 3000); } @@ -1048,7 +1032,7 @@ Common::Rect MacVentureEngine::getObjBounds(ObjID objID) { } uint MacVentureEngine::getOverlapPercent(ObjID one, ObjID other) { - //not the same parent? 0 overlap + // If it's not the same parent, there's 0 overlap if (_world->getObjAttr(one, kAttrParentObject) != _world->getObjAttr(other, kAttrParentObject)) return 0; diff --git a/engines/macventure/script.cpp b/engines/macventure/script.cpp index 5f5273c6d7..f0a3bac4c5 100644 --- a/engines/macventure/script.cpp +++ b/engines/macventure/script.cpp @@ -1065,11 +1065,11 @@ void ScriptEngine::opcdNCHLD(EngineState *state, EngineFrame *frame) { } void ScriptEngine::opceVERS(EngineState *state, EngineFrame *frame) { - state->push(86); + state->push(86); // Engine version is irrelevant. Like this in the original. } void ScriptEngine::opcfPSCE(EngineState *state, EngineFrame *frame) { - state->push(0); //Not release + state->push(0); // Any value greater than 0 indicates "Release". } void ScriptEngine::opd0P1(EngineState *state, EngineFrame *frame) { diff --git a/engines/macventure/text.cpp b/engines/macventure/text.cpp index a2777f8774..46a54bd4ab 100644 --- a/engines/macventure/text.cpp +++ b/engines/macventure/text.cpp @@ -113,12 +113,11 @@ void TextAsset::decodeHuffman() { } else { strLen = stream.getBits(7); } - // OK up to here uint32 mask = 0; uint32 symbol = 0; char c; for (uint16 i = 0; i < strLen; i++) { - mask = stream.peekBits(16); // The mask is OK + mask = stream.peekBits(16); uint32 entry; // Find the length index diff --git a/engines/macventure/world.cpp b/engines/macventure/world.cpp index 4847dcf0f1..7c14618f3e 100644 --- a/engines/macventure/world.cpp +++ b/engines/macventure/world.cpp @@ -317,6 +317,7 @@ void SaveGame::saveInto(Common::OutSaveFile *file) { file->writeUint16BE((*global)); } // Save text + // TODO: Insert text from GUI console _text = "Hello"; file->write(_text.c_str(), _text.size()); } @@ -341,6 +342,7 @@ void SaveGame::loadGlobals(MacVentureEngine *engine, Common::SeekableReadStream } void SaveGame::loadText(MacVentureEngine *engine, Common::SeekableReadStream *res) { + // TODO: Load console text. For now, the GUI doesn't even look at this. _text = "Placeholder Console Text"; } -- cgit v1.2.3