From aaabca6bfdf080b0dedd34ea79fa660e9b7582e9 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 20 Apr 2024 15:38:47 -0700 Subject: [PATCH] BAGEL: Cleanup of baglib/ files --- engines/bagel/baglib/bagel.cpp | 10 ++---- engines/bagel/baglib/base_pda.cpp | 41 +++++++++++----------- engines/bagel/baglib/bmp_object.cpp | 11 +++--- engines/bagel/baglib/button_object.cpp | 27 +++++++------- engines/bagel/baglib/character_object.cpp | 23 ++---------- engines/bagel/baglib/character_object.h | 2 +- engines/bagel/baglib/command_object.cpp | 18 +++------- engines/bagel/baglib/cursor.cpp | 2 -- engines/bagel/baglib/dev_dlg.cpp | 6 ---- engines/bagel/baglib/dossier_object.cpp | 7 +--- engines/bagel/baglib/exam.cpp | 4 +-- engines/bagel/baglib/expression.cpp | 12 +++---- engines/bagel/baglib/expression_object.cpp | 12 ++----- engines/bagel/baglib/fmovie.cpp | 34 ++++-------------- engines/bagel/baglib/fmovie.h | 2 +- engines/bagel/baglib/help.cpp | 18 +--------- 16 files changed, 68 insertions(+), 161 deletions(-) diff --git a/engines/bagel/baglib/bagel.cpp b/engines/bagel/baglib/bagel.cpp index 25072bbe479..5c821bb7f5e 100644 --- a/engines/bagel/baglib/bagel.cpp +++ b/engines/bagel/baglib/bagel.cpp @@ -246,16 +246,10 @@ ErrorCode CBagel::InitLocalFilePaths() { // Set the cache file path from the install path. g_cCacheDir = m_szInstallPath; - // Get home directory for this game + // Get home directory for this game (not really needed in ScummVM) char szBuf[MAX_DIRPATH]; char szDefaultHome[MAX_DIRPATH]; - // The HOMEDIR_DFLT method works fine on the windows side - // as relative pathnames are a groovy thing... however, the MACROREPLACE - // macro needs g_cHomeDir to be non-nullptr, and HOMEDIR_DFLT is defined - // as the nullptr string... so when we first start the game (never played - // before) the HomeDir will come back undefined... we must remedy this - // situation. #if BOF_MAC || BOF_WINMAC GetCurrentDir(szDefaultHome); #else @@ -268,7 +262,7 @@ ErrorCode CBagel::InitLocalFilePaths() { SetCurrentDir(szBuf); #endif - // Build path to disk in CD_ROM drive (or current directory) + // Build path to disk in CD_ROM drive (also not needed) Common::strcpy_s(m_szCDPath, g_cHomeDir.GetBuffer()); return m_errCode; diff --git a/engines/bagel/baglib/base_pda.cpp b/engines/bagel/baglib/base_pda.cpp index 5f427c5a384..3cb7ef7cea2 100644 --- a/engines/bagel/baglib/base_pda.cpp +++ b/engines/bagel/baglib/base_pda.cpp @@ -75,7 +75,7 @@ bool SBBasePda::HideCurDisplay() { // If we have an inventory window m_xCurDisplay->SetVisible(false); - // hold this info. + // Hold this info. m_xHoldDisplay = m_xCurDisplay; m_eHoldMode = SBBasePda::m_ePdaMode; @@ -116,6 +116,7 @@ bool SBBasePda::HideMovie() { SetPDAState(); return true; } + return false; } @@ -181,17 +182,17 @@ bool SBBasePda::HideInventory() { bool SBBasePda::ShowInventory() { SynchronizePDAState(); - StopMovie(false); // if a movie is playing, then stop it. + StopMovie(false); // if a movie is playing, then stop it. // If we have an inventory window if (m_xInvWnd) { if (m_xCurDisplay) - m_xCurDisplay->SetVisible(false); // Turn off the current display + m_xCurDisplay->SetVisible(false); // Turn off the current display - m_xInvWnd->SetVisible(true); // Turn on the inventory + m_xInvWnd->SetVisible(true); // Turn on the inventory // set the current display object - m_xCurDisplay = m_xInvWnd; // Set the current display = Inventory + m_xCurDisplay = m_xInvWnd; // Set the current display = Inventory SBBasePda::m_ePdaMode = INVMODE; SetPDAState(); return true; @@ -202,17 +203,17 @@ bool SBBasePda::ShowInventory() { bool SBBasePda::ShowMap() { SynchronizePDAState(); - StopMovie(false); // if a movie is playing, then stop it. + StopMovie(false); // If a movie is playing, then stop it. // if we have a map window if (m_xMapWnd) { if (m_xCurDisplay) - m_xCurDisplay->SetVisible(false); // Turn off the current display + m_xCurDisplay->SetVisible(false); // Turn off the current display - m_xMapWnd->SetVisible(true); // Turn on the map + m_xMapWnd->SetVisible(true); // Turn on the map // set the current display object - m_xCurDisplay = m_xMapWnd; // Set the current display = Map + m_xCurDisplay = m_xMapWnd; // Set the current display = Map SBBasePda::m_ePdaMode = MAPMODE; m_xMapWnd->AttachActiveObjects(); SetPDAState(); @@ -230,6 +231,7 @@ bool SBBasePda::HideMap() { if (m_xMapWnd) { // Turn off the Map m_xMapWnd->SetVisible(false); + // set the current display to nullptr m_xCurDisplay = nullptr; SetPDAState(); @@ -246,17 +248,17 @@ bool SBBasePda::ShowLog() { } SynchronizePDAState(); - StopMovie(false); // if a movie is playing, then stop it. + StopMovie(false); // If a movie is playing, then stop it. // if we have a map window if (m_xLogWnd) { if (m_xCurDisplay) - m_xCurDisplay->SetVisible(false); // Turn off the current display + m_xCurDisplay->SetVisible(false); // Turn off the current display - m_xLogWnd->SetVisible(true); // Turn on the map + m_xLogWnd->SetVisible(true); // Turn on the map - // set the current display object - m_xCurDisplay = m_xLogWnd; // Set the current display = Map + // Set the current display object + m_xCurDisplay = m_xLogWnd; // Set the current display = Map SBBasePda::m_ePdaMode = LOGMODE; m_xLogWnd->AttachActiveObjects(); SetPDAState(); @@ -344,8 +346,8 @@ void SBBasePda::SetPDAState() { CBagVar *pVar = VARMNGR->GetVariable("INBAR"); if (pVar != nullptr) { - pPDAMode = "BARPDAMODE"; // defined as global - pPDAPos = "BARPDAPOSITION"; // defined as global + pPDAMode = "BARPDAMODE"; // Defined as global + pPDAPos = "BARPDAPOSITION"; // Defined as global } else { pPDAMode = "PDAMODE"; pPDAPos = "PDAPOSITION"; @@ -397,8 +399,8 @@ void SBBasePda::GetPDAState() { CBagVar *pVar = VARMNGR->GetVariable("INBAR"); if (pVar != nullptr) { - pPDAMode = "BARPDAMODE"; // defined as global - pPDAPos = "BARPDAPOSITION"; // defined as global + pPDAMode = "BARPDAMODE"; // Defined as global + pPDAPos = "BARPDAPOSITION"; // Defined as global } else { pPDAMode = "PDAMODE"; pPDAPos = "PDAPOSITION"; @@ -453,7 +455,7 @@ int SBBasePda::GetProperCursor(const CBofPoint &xPoint, CBofRect &pdaRect) { // Assume can't click int nCursorID = NULLCURSOR; - // if we're in the map, return the nullptr cursor, if on the pda but not in the + // If we're in the map, return the nullptr cursor, if on the pda but not in the // map window, return the hand. Same rules for nomode. switch (m_ePdaMode) { case MAPMODE: @@ -501,7 +503,6 @@ int SBBasePda::GetProperCursor(const CBofPoint &xPoint, CBofRect &pdaRect) { } } - // icky logic... if (m_ePdaMode == LOGMODE) { if (pOverObj) { return pOverObj->GetOverCursor(); diff --git a/engines/bagel/baglib/bmp_object.cpp b/engines/bagel/baglib/bmp_object.cpp index 83082e43c60..2bbe76e9ca7 100644 --- a/engines/bagel/baglib/bmp_object.cpp +++ b/engines/bagel/baglib/bmp_object.cpp @@ -50,8 +50,7 @@ ErrorCode CBagBmpObject::Detach() { return CBagObject::Detach(); } -CBofRect -CBagBmpObject::GetRect() { +CBofRect CBagBmpObject::GetRect() { CBofPoint p = GetPosition(); CBofSize s; if (m_xBmp) @@ -59,8 +58,7 @@ CBagBmpObject::GetRect() { return CBofRect(p, s); } -ErrorCode -CBagBmpObject::Update(CBofWindow *pWnd, CBofPoint pt, CBofRect *pSrcRect, int nMaskColor) { +ErrorCode CBagBmpObject::Update(CBofWindow *pWnd, CBofPoint pt, CBofRect *pSrcRect, int nMaskColor) { if (m_xBmp) { m_nTrans = nMaskColor; return m_xBmp->Paint(pWnd, pt.x, pt.y, pSrcRect, nMaskColor); @@ -68,9 +66,8 @@ CBagBmpObject::Update(CBofWindow *pWnd, CBofPoint pt, CBofRect *pSrcRect, int nM return ERR_NONE; } -ErrorCode -CBagBmpObject::Update(CBofBitmap *pBmp, CBofPoint pt, CBofRect *pSrcRect, int nMaskColor) { - if (pBmp) { // && IsAttached() && IsVisible() +ErrorCode CBagBmpObject::Update(CBofBitmap *pBmp, CBofPoint pt, CBofRect *pSrcRect, int nMaskColor) { + if (pBmp) { m_nTrans = nMaskColor; if (pSrcRect) { CBofSize s = pBmp->GetSize(); diff --git a/engines/bagel/baglib/button_object.cpp b/engines/bagel/baglib/button_object.cpp index 139cf94879b..ed7858df752 100644 --- a/engines/bagel/baglib/button_object.cpp +++ b/engines/bagel/baglib/button_object.cpp @@ -59,10 +59,12 @@ ErrorCode CBagButtonObject::Attach() { m_MidPoint.y = GetRect().TopLeft().y + (GetRect().Height() / 2); } - if (GetSprite()->GetCelCount() == 1 && m_xButtonType != SLIDER) { // Only given down state + if (GetSprite()->GetCelCount() == 1 && m_xButtonType != SLIDER) { + // Only given down state SetVisible(false); } - // if this is a slider button make sure it is in the correct position + + // If this is a slider button make sure it is in the correct position if (m_xButtonType == SLIDER) { CBofPoint NewPoint = GetPosition(); int xIncrement = m_SlideRect.Width() / (m_nNumPos - 1); @@ -158,7 +160,7 @@ void CBagButtonObject::OnLButtonUp(uint32 nFlags, CBofPoint *xPoint, void *info) for (i = 0; (i < m_nNumPos) && (slidePos < mLoc.x); i++) slidePos = m_SlideRect.left + (i * xIncrement); - // We Went to far + // We Went too far i--; // Find the previous position was closer to the mouse @@ -188,7 +190,8 @@ void CBagButtonObject::OnLButtonUp(uint32 nFlags, CBofPoint *xPoint, void *info) m_bActive = true; m_bActiveDown = !m_bActiveDown; - if (GetSprite() && (GetSprite()->GetCelCount() == 1)) { // Only given down state + if (GetSprite() && (GetSprite()->GetCelCount() == 1)) { + // Only given down state SetVisible(m_bActiveDown); m_bActive = false; } @@ -268,7 +271,7 @@ ErrorCode CBagButtonObject::Update(CBofBitmap *pBmp, CBofPoint pt, CBofRect *pSr if (m_bActive) { // If the button is doing something if (m_bActiveDown) { - GetSprite()->NextCel(); // increment frame + GetSprite()->NextCel(); // Increment frame // If this is animated, the bring it back up immediately if (GetSprite()->GetCelIndex() == GetSprite()->GetCelCount() - 1 || GetSprite()->GetAnimated()) { m_bActiveDown = false; @@ -287,18 +290,19 @@ ErrorCode CBagButtonObject::Update(CBofBitmap *pBmp, CBofPoint pt, CBofRect *pSr } else if (m_xButtonType == CHECKBOX) { if (GetSprite() && (GetSprite()->GetCelCount() > 1) && m_bActive) { if (m_bActiveDown) { - GetSprite()->NextCel(); // increment frame + GetSprite()->NextCel(); // Increment frame if (GetSprite()->GetCelIndex() == GetSprite()->GetCelCount() - 1) { m_bActive = false; } } else { // else (going back up) - GetSprite()->PrevCel(); // decrement frame + GetSprite()->PrevCel(); // decrement frame if (GetSprite()->GetCelIndex() == 0) { m_bActive = false; } } } - // for checkboxes, we have to make sure that they are always + + // For checkboxes, we have to make sure that they are always // redrawn as they will otherwise return to their state on the pan (in the // background of the closeup). bDirty = true; @@ -317,7 +321,6 @@ ErrorCode CBagButtonObject::Update(CBofBitmap *pBmp, CBofPoint pt, CBofRect *pSr } SetState(GetSprite()->GetCelIndex()); - // RunCallBack(); } } @@ -359,7 +362,7 @@ PARSE_CODES CBagButtonObject::SetInfo(bof_ifstream &istr) { break; } - // handle a maximum framerate... + // Handle a maximum framerate... case 'F': { char szLocalStr[256]; szLocalStr[0] = 0; @@ -371,7 +374,7 @@ PARSE_CODES CBagButtonObject::SetInfo(bof_ifstream &istr) { istr.EatWhite(); GetIntFromStream(istr, nFrameRate); - // the framerate is expressed in frames/second, so do some division + // The framerate is expressed in frames/second, so do some division // here to store the number of milliseconds. SetFrameRate(1000 / nFrameRate); @@ -424,7 +427,7 @@ PARSE_CODES CBagButtonObject::SetInfo(bof_ifstream &istr) { } // - // no match return from function + // No match return from function // default: { PARSE_CODES rc = CBagObject::SetInfo(istr); diff --git a/engines/bagel/baglib/character_object.cpp b/engines/bagel/baglib/character_object.cpp index 3ce1c01a589..72dbc9d113b 100644 --- a/engines/bagel/baglib/character_object.cpp +++ b/engines/bagel/baglib/character_object.cpp @@ -245,7 +245,7 @@ void CBagCharacterObject::UpdatePosition() { int ypos = READ_LE_INT32(&m_pBinBuf[lSeekPos]); lSeekPos += sizeof(int32); - // a valid number was read + // A valid number was read if ((xpos > -1) && (ypos > -1)) { CBofPoint cNewLoc(xpos, ypos); SetPosition(cNewLoc); @@ -269,9 +269,7 @@ bool CBagCharacterObject::DoAdvance() { // If we got a background bitmap if (m_pBmpBuf != nullptr) { - // If This Panimation is modal, or Panimations are ON, then get next - // frame. - // + // If This Panimation is modal, or Panimations are ON, then get next frame. if (IsModal() || !m_bPanim || CBagMasterWin::GetPanimations()) { if (_smacker->needsUpdate()) { bDoAdvance = true; @@ -387,7 +385,6 @@ PARSE_CODES CBagCharacterObject::SetInfo(bof_ifstream &istr) { char ch = (char)istr.peek(); switch (ch) { // SAVESTATE - Maintain the state of the character - // case 'K': { char szLocalStr[256]; szLocalStr[0] = 0; @@ -407,9 +404,7 @@ PARSE_CODES CBagCharacterObject::SetInfo(bof_ifstream &istr) { break; } - // // LOOP n - n number of times to loop (-1 infinate) - // case 'L': { char szLocalStr[256]; szLocalStr[0] = 0; @@ -427,9 +422,7 @@ PARSE_CODES CBagCharacterObject::SetInfo(bof_ifstream &istr) { break; } - // // SPEED n - n pace of playback (negative is backward), (0 to hold at current frame) - // case 'S': { char szLocalStr[256]; szLocalStr[0] = 0; @@ -447,9 +440,7 @@ PARSE_CODES CBagCharacterObject::SetInfo(bof_ifstream &istr) { break; } - // // EXITATEND - detach at end of looping (call run after objects) - // case 'E': { char szLocalStr[256]; szLocalStr[0] = 0; @@ -468,10 +459,8 @@ PARSE_CODES CBagCharacterObject::SetInfo(bof_ifstream &istr) { break; } - // // PANIM - Specifies if this object should be affected by the user // option Panimations On/Off - // case 'P': { CBofString sStr; @@ -490,9 +479,7 @@ PARSE_CODES CBagCharacterObject::SetInfo(bof_ifstream &istr) { break; } - // // FRAME [start, end]- start and end frames of the move - // case 'F': { char szLocalStr[256]; szLocalStr[0] = 0; @@ -520,16 +507,13 @@ PARSE_CODES CBagCharacterObject::SetInfo(bof_ifstream &istr) { break; } - // - // no match return from funtion - // + // No match return from funtion default: { PARSE_CODES rc = CBagObject::SetInfo(istr); if (rc == PARSING_DONE) { return PARSING_DONE; } - if (rc == UPDATED_OBJECT) { nObjectUpdated = true; } else { // rc==UNKNOWN_TOKEN @@ -580,7 +564,6 @@ void CBagCharacterObject::SetNumOfLoops(int n) { } } - void CBagCharacterObject::SetPlaybackSpeed(int n) { if (m_nPlaybackSpeed != n) { if (n < 0) { diff --git a/engines/bagel/baglib/character_object.h b/engines/bagel/baglib/character_object.h index dff5b62f4ef..ed3ab105acc 100644 --- a/engines/bagel/baglib/character_object.h +++ b/engines/bagel/baglib/character_object.h @@ -49,7 +49,7 @@ protected: bool m_bExitAtEnd : 1; bool m_bFirstFrame : 1; - bool m_bSaveState : 1; // flag to save the state/frame of the character + bool m_bSaveState : 1; // Flag to save the state/frame of the character bool m_bPanim : 1; // If affected by Panimations On/Off setting int m_nPrevFrame = 0; diff --git a/engines/bagel/baglib/command_object.cpp b/engines/bagel/baglib/command_object.cpp index 72eafb829da..b0c9480f2b3 100644 --- a/engines/bagel/baglib/command_object.cpp +++ b/engines/bagel/baglib/command_object.cpp @@ -48,7 +48,6 @@ bool CBagCommandObject::RunObject() { bool rc = false; // Don't allow more than 10 (recursively) - // if (nIteration < 10) { nIteration++; @@ -192,8 +191,8 @@ bool CBagCommandObject::RunObject() { // Get a pointer to the current game window CBagStorageDevWnd *pMainWin = (CBagel::GetBagApp()->GetMasterWnd()->GetCurrentStorageDev()); + // Pull down the PDA (if it exists) - // if (pMainWin->GetDeviceType() == SDEV_GAMEWIN) { ((CBagPanWindow *)pMainWin)->DeactivatePDA(); ((CBagPanWindow *)pMainWin)->WaitForPDA(); @@ -230,7 +229,6 @@ bool CBagCommandObject::RunObject() { } else if (GetFileName() == "TURN") { // Cause 1 turn to go by - // VARMNGR->IncrementTimers(); } else if (GetFileName() == "RP_UPDATE_QUEUE") { @@ -380,7 +378,6 @@ bool CBagCommandObject::RunObject() { MACROREPLACE(cString); // Play the movie only if it exists - // if (FileExists(cString.GetBuffer())) { BofPlayMovie(pMainWin, cString.GetBuffer()); cBmp.Paint(pMainWin, 0, 0); @@ -395,16 +392,9 @@ bool CBagCommandObject::RunObject() { g_engine->quitGame(); } else if (GetFileName() == "BREAK") { - -#ifdef _DEBUG - -#if BOF_MAC - Debugger(); -#else + // As far as I'm aware, this can't actually happen in the game, + // but what the heck, ScummVM has a console, let's hook it up g_engine->getDebugger()->attach(); -#endif - -#endif // !_DEBUG } else { ReportError(ERR_UNKNOWN, "Invalid RUN COMMAND = %s", (const char *)GetFileName()); @@ -482,7 +472,7 @@ PARSE_CODES CBagCommandObject::SetInfo(bof_ifstream &istr) { } // - // no match return from funtion + // No match return from funtion // default: { PARSE_CODES rc = CBagObject::SetInfo(istr); diff --git a/engines/bagel/baglib/cursor.cpp b/engines/bagel/baglib/cursor.cpp index 56d43008309..5ec258258c9 100644 --- a/engines/bagel/baglib/cursor.cpp +++ b/engines/bagel/baglib/cursor.cpp @@ -145,7 +145,6 @@ void CBagCursor::SetCurrent() { CursorMan.replaceCursor(m_pBmp->getSurface(), m_nX, m_nY, 1); } - void CSystemCursor::SetCurrent() { m_pCurrentCursor = this; @@ -154,5 +153,4 @@ void CSystemCursor::SetCurrent() { CursorMan.replaceCursor(ARROW_CURSOR, CURSOR_W, CURSOR_H, 0, 0, 0, true, &format); } - } // namespace Bagel diff --git a/engines/bagel/baglib/dev_dlg.cpp b/engines/bagel/baglib/dev_dlg.cpp index f010bdbade4..0d8c636c586 100644 --- a/engines/bagel/baglib/dev_dlg.cpp +++ b/engines/bagel/baglib/dev_dlg.cpp @@ -37,7 +37,6 @@ CDevDlg::CDevDlg(int nButtonX, int nButtonY) { m_bUseExtra = false; } - CDevDlg::~CDevDlg() { if (m_pTitleText != nullptr) { delete m_pTitleText; @@ -45,7 +44,6 @@ CDevDlg::~CDevDlg() { } } - ErrorCode CDevDlg::Create(const char *pszBmp, CBofWindow *pWnd, CBofPalette *pPal, CBofRect *pRect, bool bUseEx) { Assert(IsValidObject(this)); Assert(pszBmp != nullptr); @@ -111,15 +109,12 @@ ErrorCode CDevDlg::Create(const char *pszBmp, CBofWindow *pWnd, CBofPalette *pPa return m_errCode; } - void CDevDlg::OnLButtonUp(uint32 /*nFlags*/, CBofPoint * /*pPoint*/, void *) { } - void CDevDlg::OnMouseMove(uint32 /*nFlags*/, CBofPoint * /*pPoint*/, void *) { } - void CDevDlg::OnClose() { Assert(IsValidObject(this)); @@ -191,7 +186,6 @@ void CDevDlg::OnKeyHit(uint32 lKeyCode, uint32 nRepCount) { CBagStorageDevDlg::OnKeyHit(lKeyCode, nRepCount); } - void CDevDlg::PaintText() { Assert(IsValidObject(this)); diff --git a/engines/bagel/baglib/dossier_object.cpp b/engines/bagel/baglib/dossier_object.cpp index 64ab34d2b26..2037325621b 100644 --- a/engines/bagel/baglib/dossier_object.cpp +++ b/engines/bagel/baglib/dossier_object.cpp @@ -258,7 +258,6 @@ CBofPoint CBagDossierObject::ArrangeFloater(CBofPoint nPos, CBagObject * /*pObj* ErrorCode CBagDossierObject::Update(CBofBitmap *pBmp, CBofPoint pt, CBofRect *pSrcRect, int n) { if (m_bShowIndex) { if (m_bDossierSet == false) { - // Set the text to be the index line. SetPSText(&m_sIndexLine); m_bDossierSet = true; @@ -322,10 +321,6 @@ void CBagDossierObject::ActivateDosObject(CBagLog *pLogWld) { } void CBagDossierObject::DeactivateDosObject(CBagLog *pLogWld) { - if (pLogWld) { - // pLogWld->DeactivateLocalObject(this); - } - if (CBagRPObject::GetLogState() == RP_READ_DOSSIER) { SetFloating(false); // This is not floating } else { @@ -354,7 +349,7 @@ void CBagDossierObject::DeactivateCurDossier() { } m_pCurDossier->DeactivateDosObject(pLogWld); - // when we hit the update code, we're gonna need to reevaluate this + // When we hit the update code, we're gonna need to reevaluate this // guys current view status. m_pCurDossier->m_bShowIndex = true; m_pCurDossier->m_bDossierSet = false; diff --git a/engines/bagel/baglib/exam.cpp b/engines/bagel/baglib/exam.cpp index 70bf7a1d94f..b56a6ae0bd9 100644 --- a/engines/bagel/baglib/exam.cpp +++ b/engines/bagel/baglib/exam.cpp @@ -121,10 +121,10 @@ void CBagExam::OnMouseMove(uint32 /*nFlags*/, CBofPoint *pPoint, void *) { // No more cursor in Examine movies if (pPoint->x <= m_LeftRect.right) { - // left rect, play reverse + // Left rect, play reverse RotateLeft(); } else if (pPoint->x >= m_RightRect.left) { - //right rect, play forward + // Right rect, play forward RotateRight(); } else if (m_eMovStatus == FOREWARD || m_eMovStatus == REVERSE) { RotateStop(); diff --git a/engines/bagel/baglib/expression.cpp b/engines/bagel/baglib/expression.cpp index 97034dfec68..84f90ae2a75 100644 --- a/engines/bagel/baglib/expression.cpp +++ b/engines/bagel/baglib/expression.cpp @@ -133,8 +133,6 @@ bool CBagExpression::Evaluate(CBagVar *xLHOper, CBagVar *xRHOper, OPERATION xOpe CBagVar *CBagExpression::GetVariable(int nPos) { CBagVar *pVar = m_cVarList.GetNodeItem(nPos); - // Re-wrote because Left(), and Mid() were causing many allocations - // If the variable is a reference (OBJ.PROPERTY) if (pVar->IsReference()) { char *p, szFront[256]; @@ -579,14 +577,12 @@ PARSE_CODES CBagExpression::SetInfo(bof_ifstream &istr) { GetAlphaNumFromStream(istr, sStr); CBagVar *pVar = VARMNGR->GetVariable(sStr); - if (!pVar) { // this must be a reference, make a new variable + if (!pVar) { // This must be a reference, make a new variable if (sStr.Find("~~") > 0) { pVar = new CBagVar; pVar->SetName(sStr); pVar->SetReference(); - } else { // this is an error condition, constants can only be rhopers - //CBofString strName("Constant"); - //strName += sStr; + } else { // This is an error condition, constants can only be rhopers pVar = new CBagVar; pVar->SetName(sStr); pVar->SetValue(sStr); @@ -610,11 +606,11 @@ PARSE_CODES CBagExpression::SetInfo(bof_ifstream &istr) { GetAlphaNumFromStream(istr, sStr); pVar = VARMNGR->GetVariable(sStr); if (!pVar) { - if (sStr.Find("~~") > 0) { // this must be a reference, make a new variable + if (sStr.Find("~~") > 0) { // This must be a reference, make a new variable pVar = new CBagVar; pVar->SetName(sStr); pVar->SetReference(); - } else { // this must be a constant, make a new variable + } else { // This must be a constant, make a new variable pVar = new CBagVar; pVar->SetName(sStr); pVar->SetValue(sStr); diff --git a/engines/bagel/baglib/expression_object.cpp b/engines/bagel/baglib/expression_object.cpp index 3757d62aa7e..532b0f474da 100644 --- a/engines/bagel/baglib/expression_object.cpp +++ b/engines/bagel/baglib/expression_object.cpp @@ -41,14 +41,6 @@ CBagExpressionObject::~CBagExpressionObject() { Detach(); } -/*CRect CBagExpressionObject::GetRect() -{ - CPoint p = GetPosition(); - CSize s = GetSize(); - CRect r = CRect(p,s); - return(r); -}*/ - bool CBagExpressionObject::RunObject() { if (m_xExpression != nullptr) { CBagVar xVar; @@ -59,7 +51,7 @@ bool CBagExpressionObject::RunObject() { return false; int nIndex = GetFileName().Find("~~"); - if (nIndex > 0) { // this is a reference + if (nIndex > 0) { // This is a reference CBofString sObject = GetFileName().Left(nIndex); CBofString sProperty = GetFileName().Mid(nIndex + 2); @@ -95,7 +87,7 @@ PARSE_CODES CBagExpressionObject::SetInfo(bof_ifstream &istr) { } } break; // - // no match return from function + // No match return from function // default: { PARSE_CODES rc = CBagObject::SetInfo(istr); diff --git a/engines/bagel/baglib/fmovie.cpp b/engines/bagel/baglib/fmovie.cpp index f78f766342f..989e91a772e 100644 --- a/engines/bagel/baglib/fmovie.cpp +++ b/engines/bagel/baglib/fmovie.cpp @@ -104,21 +104,14 @@ bool CBagFMovie::OpenMovie(const char *sFilename) { m_pSmk = new Video::SmackerDecoder(); // Opened failed ? - // if (!m_pSmk->loadFile(sFilename)) { error("Movie not found=%s", sFilename); return false; } - // Create a Windows palette based on the smacker movie palette. - // This palette that will be used when the offscreen bitmap is - // created. - // - HPALETTE hPalette; - //hPalette = WinPalFromSmkPal(); // Allocate the bitmaps. - // + HPALETTE hPalette; m_pSmackerPal = new CBofPalette(hPalette); m_pBmpBuf = new CBofBitmap(m_pSmk->getWidth(), m_pSmk->getHeight(), m_pSmackerPal, false); @@ -148,16 +141,12 @@ bool CBagFMovie::OpenMovie(const char *sFilename) { ReSize(&m_xBounds, bRepaint); // Filter the bitmap. - // CBagMasterWin *pWnd; CBagStorageDevWnd *pSDevWnd; FilterFunction pFilterFunction; if ((pWnd = CBagel::GetBagApp()->GetMasterWnd()) != nullptr) { - if ((pSDevWnd = pWnd->GetCurrentStorageDev()) != nullptr) { - if (pSDevWnd->IsFiltered()) { - uint16 nFilterId = pSDevWnd->GetFilterId(); pFilterFunction = pSDevWnd->GetFilter(); m_pBmpBuf->Paint(m_pFilterBmp); @@ -285,7 +274,6 @@ void CBagFMovie::OnClose() { void CBagFMovie::OnMovieDone() { if (!m_bLoop) { - if (m_bCaptured) ReleaseCapture(); @@ -317,7 +305,6 @@ bool CBagFMovie::Play(bool bLoop, bool bEscCanStop) { bool CBagFMovie::Play() { - if (m_pSmk) { m_pSmk->pauseVideo(false); // m_pSmk->setReverse(false); // TODO: Not supported by SMK @@ -327,7 +314,6 @@ bool CBagFMovie::Play() { } return false; - } bool CBagFMovie::Reverse(bool bLoop, bool bEscCanStop) { @@ -343,11 +329,9 @@ bool CBagFMovie::Reverse(bool bLoop, bool bEscCanStop) { DoModal(); return bSuccess; - } bool CBagFMovie::Reverse() { - if (m_pSmk) { m_pSmk->pauseVideo(false); // m_pSmk->setReverse(true); // TODO: Not supported by SMK @@ -361,7 +345,6 @@ bool CBagFMovie::Reverse() { } bool CBagFMovie::Stop() { - if (m_pSmk) { m_pSmk->stop(); m_eMovStatus = STOPPED; @@ -372,7 +355,6 @@ bool CBagFMovie::Stop() { } bool CBagFMovie::Pause() { - if (m_pSmk) { m_pSmk->pauseVideo(true); m_eMovStatus = PAUSED; @@ -425,11 +407,11 @@ void CBagFMovie::OnReSize(CBofSize *) { } bool CBagFMovie::CenterRect() { - CBofRect cBofRect; - RECT rcParentRect, rcMovieBounds; - int ClientWidth, ClientHeight; - int MovieWidth = 0; - int MovieHeight = 0; + CBofRect cBofRect; + RECT rcParentRect, rcMovieBounds; + int ClientWidth, ClientHeight; + int MovieWidth = 0; + int MovieHeight = 0; cBofRect = GetParent()->GetClientRect(); rcParentRect = cBofRect.GetWinRect(); @@ -445,16 +427,14 @@ bool CBagFMovie::CenterRect() { rcMovieBounds.right = rcMovieBounds.left + MovieWidth; rcMovieBounds.bottom = rcMovieBounds.top + MovieHeight; - // reposition the playback window + // Reposition the playback window cBofRect = rcMovieBounds; ReSize(&cBofRect, true); return true; - } void CBagFMovie::OnButtonUp(uint32 /*nFlags*/, CBofPoint * /*pPoint*/) { - } } // namespace Bagel diff --git a/engines/bagel/baglib/fmovie.h b/engines/bagel/baglib/fmovie.h index 6f316937dfe..5cd234e7a28 100644 --- a/engines/bagel/baglib/fmovie.h +++ b/engines/bagel/baglib/fmovie.h @@ -133,7 +133,7 @@ public: virtual bool CenterRect(); - // need to access members from outside of class for + // Need to access members from outside of class for // performance optimization. Graphics::ManagedSurface *GetSmackBuffer() { return m_pSbuf; diff --git a/engines/bagel/baglib/help.cpp b/engines/bagel/baglib/help.cpp index ac349d5ed5f..019a1523410 100644 --- a/engines/bagel/baglib/help.cpp +++ b/engines/bagel/baglib/help.cpp @@ -145,7 +145,6 @@ ErrorCode CBagHelp::Attach() { lSize = cFile.GetLength(); if ((pszBuf = (char *)BofCAlloc(lSize + 1, 1)) != nullptr) { - cFile.Read(pszBuf, lSize); cRect.SetRect(120, 100, 550, 348); @@ -190,10 +189,6 @@ ErrorCode CBagHelp::Detach() { m_pOKButton = nullptr; } -#if !TEST - CBagStorageDevWnd::Detach(); -#endif - CBofApp::GetApp()->SetPalette(m_pSavePalette); return m_errCode; @@ -212,16 +207,12 @@ ErrorCode CBagHelp::SetHelpFile(const char *pszTextFile) { void CBagHelp::OnPaint(CBofRect *pRect) { Assert(IsValidObject(this)); -#if !TEST - CBagStorageDevWnd::OnPaint(pRect); -#else - //CBofDialog::OnPaint(pRect); PaintBackdrop(pRect); -#endif if (m_pTextBox != nullptr) { m_pTextBox->Display(); } + ValidateAnscestors(); } @@ -259,11 +250,7 @@ void CBagHelp::OnKeyHit(uint32 lKey, uint32 nRepCount) { Close(); default: -#if !TEST - CBagStorageDevWnd::OnKeyHit(lKey, nRepCount); -#else CBofDialog::OnKeyHit(lKey, nRepCount); -#endif break; } } @@ -315,8 +302,6 @@ const char *BuildHelpDir(const char *pszFile) { return &szBuf[0]; } - -#if TEST void CBagHelp::OnInitDialog() { Assert(IsValidObject(this)); @@ -324,6 +309,5 @@ void CBagHelp::OnInitDialog() { Attach(); } -#endif } // namespace Bagel