[Scummvm-git-logs] scummvm master -> d86ea21f777a7a5120ce496442d9d8b6f28664c5

bluegr noreply at scummvm.org
Fri Dec 31 17:12:51 UTC 2021


This automated email contains information about 4 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
73adf9548a BURIED: Show the agent evaluation (current points) with Control-D
bc9b2ddeda BURIED: Fix global flag corruption in death screens
728d76b089 BURIED: Adapt more callbacks with hardcoded global flags
d86ea21f77 NEWS: Add more changes for The Journeyman Project 2: Buried in Time


Commit: 73adf9548ade5f05bf1e7f893e3ee0851e0bd618
    https://github.com/scummvm/scummvm/commit/73adf9548ade5f05bf1e7f893e3ee0851e0bd618
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2021-12-31T19:12:30+02:00

Commit Message:
BURIED: Show the agent evaluation (current points) with Control-D

This is the text that is shown in the death screens - it's an
enhancement in ScummVM, which is also quite useful for debugging

Changed paths:
    engines/buried/buried.cpp
    engines/buried/buried.h
    engines/buried/death.cpp
    engines/buried/death.h
    engines/buried/scene_view.cpp


diff --git a/engines/buried/buried.cpp b/engines/buried/buried.cpp
index c7bfd749dc7..2c25af6d43b 100644
--- a/engines/buried/buried.cpp
+++ b/engines/buried/buried.cpp
@@ -40,6 +40,7 @@
 #include "buried/biochip_right.h"
 #include "buried/buried.h"
 #include "buried/console.h"
+#include "buried/death.h"
 #include "buried/frame_window.h"
 #include "buried/gameui.h"
 #include "buried/graphics.h"
@@ -593,6 +594,25 @@ void BuriedEngine::pauseGame() {
 	runDialog(dialog);
 }
 
+void BuriedEngine::showPoints() {
+	if (isDemo())
+		return;
+
+	FrameWindow *frameWindow = (FrameWindow *)_mainWindow;
+	SceneViewWindow *sceneView = ((GameUIWindow *)frameWindow->getMainChildWindow())->_sceneViewWindow;
+	AgentEvaluation *agentEvaluation = new AgentEvaluation(this, sceneView->getGlobalFlags(), -1);
+
+	GUI::MessageDialog dialog(
+		agentEvaluation->_scoringTextDescriptionsWithScores,
+		"OK",
+		Common::U32String(),
+		Graphics::kTextAlignLeft
+	);
+	runDialog(dialog);
+
+	delete agentEvaluation;
+}
+
 void BuriedEngine::handleSaveDialog() {
 	FrameWindow *frameWindow = (FrameWindow *)_mainWindow;
 	BioChipRightWindow *bioChipWindow = ((GameUIWindow *)frameWindow->getMainChildWindow())->_bioChipRightWindow;
diff --git a/engines/buried/buried.h b/engines/buried/buried.h
index b02a98e631b..f05e4a9a921 100644
--- a/engines/buried/buried.h
+++ b/engines/buried/buried.h
@@ -139,6 +139,7 @@ public:
 	bool runQuitDialog();
 	bool isControlDown() const;
 	void pauseGame();
+	void showPoints();
 
 	// Save/Load
 	bool canLoadGameStateCurrently();
diff --git a/engines/buried/death.cpp b/engines/buried/death.cpp
index 75bf25ce4d6..a139ac2f89f 100644
--- a/engines/buried/death.cpp
+++ b/engines/buried/death.cpp
@@ -39,12 +39,6 @@
 
 namespace Buried {
 
-enum {
-	BUTTON_QUIT = 1,
-	BUTTON_RESTORE_GAME = 2,
-	BUTTON_MAIN_MENU = 3
-};
-
 #define CHECK_PUZZLE_FLAG(flag) \
 	if (_globalFlags.flag != 0) \
 		puzzlesSolved++
@@ -61,63 +55,8 @@ enum {
 	if (_globalFlags.evcapBaseID[i] == flag) \
 		supportingEvidence++
 
-DeathWindow::DeathWindow(BuriedEngine *vm, Window *parent, int deathSceneIndex, GlobalFlags &globalFlags, Common::Array<int> itemArray)
-		: Window(vm, parent), _deathSceneIndex(deathSceneIndex), _globalFlags(globalFlags), _itemArray(itemArray) {
-	_curButton = 0;
-	_deathFrameIndex = -1;
-	_lightOn = false;
-	_walkthroughMode = false;
-
-	_rect = Common::Rect(0, 0, 640, 480);
-	_quit = Common::Rect(27, 422, 100, 460);
-	_restoreGame = Common::Rect(112, 422, 185, 460);
-	_mainMenu = Common::Rect(198, 422, 271, 460);
-
-	_timer = setTimer(400);
-
-	if (deathSceneIndex < 10) {
-		_deathSceneFrames = new AVIFrames(_vm->getFilePath(IDS_DEATH_CASTLE_FILENAME));
-	} else if (deathSceneIndex < 20) {
-		_deathSceneFrames = new AVIFrames(_vm->getFilePath(IDS_DEATH_MAYAN_FILENAME));
-	} else if (deathSceneIndex < 30) {
-		_deathSceneFrames = new AVIFrames(_vm->getFilePath(IDS_DEATH_AGENTLAIR_FILENAME));
-	} else if (deathSceneIndex < 40) {
-		_deathSceneFrames = new AVIFrames(_vm->getFilePath(IDS_DEATH_DAVINCI_FILENAME));
-	} else if (deathSceneIndex < 50) {
-		_deathSceneFrames = new AVIFrames(_vm->getFilePath(IDS_DEATH_AILAB_FILENAME));
-	} else if (deathSceneIndex < 60) {
-		_deathSceneFrames = new AVIFrames(_vm->getFilePath(IDS_DEATH_ALIEN_FILENAME));
-	} else if (deathSceneIndex < 70) {
-		_deathSceneFrames = new AVIFrames(_vm->getFilePath(IDS_DEATH_FINALE_FILENAME));
-	} else {
-		error("Bad death scene index %d", deathSceneIndex);
-	}
-
-	// Set the frame index
-	switch (deathSceneIndex) {
-	case 15:
-		_deathFrameIndex = 4;
-		break;
-	case 52:
-	case 53:
-		_deathFrameIndex = 1;
-		break;
-	case 54:
-	case 55:
-		_deathFrameIndex = 0;
-		break;
-	default:
-		_deathFrameIndex = deathSceneIndex % 10;
-		break;
-	}
-
-	_fontHeightA = (_vm->getLanguage() == Common::JA_JPN) ? 12 : 14;
-	_textFontA = _vm->_gfx->createFont(_fontHeightA);
-
-	_fontHeightB = 20;
-	_textFontB = _vm->_gfx->createFont(_fontHeightB, true);
-
-	_walkthroughMode = _globalFlags.generalWalkthroughMode != 0;
+AgentEvaluation::AgentEvaluation(BuriedEngine *vm, GlobalFlags &globalFlags, int deathSceneIndex) :
+	_globalFlags(globalFlags) {
 
 	int puzzlesSolved = 0;
 	CHECK_PUZZLE_FLAG(scoreGotTranslateBioChip);
@@ -185,51 +124,61 @@ DeathWindow::DeathWindow(BuriedEngine *vm, Window *parent, int deathSceneIndex,
 	int totalScore = finalCriticalEvidenceScore + finalSupportingEvidenceScore + finalPuzzleScore + finalResearchScore + completionScore;
 
 	// Build the string buffers
-	if (_walkthroughMode) {
-		if (_vm->getVersion() >= MAKEVERSION(1, 0, 4, 0)) {
+	if (_globalFlags.generalWalkthroughMode != 0) {
+		if (vm->getVersion() >= MAKEVERSION(1, 0, 4, 0)) {
 			// HACK HACK HACK: More horridness.
-			Common::String stringResource = _vm->getString(IDS_DEATH_WALK_SCORE_DESC_TEMPL);
+			Common::String stringResource = vm->getString(IDS_DEATH_WALK_SCORE_DESC_TEMPL);
 			_scoringTextDescriptions = Common::String::format(stringResource.c_str(), criticalEvidence, supportingEvidence, puzzlesSolved, researchBonusRaw);
-			stringResource = _vm->getString(IDS_DEATH_WALK_SCORE_AMT_TEMPL);
+			stringResource = vm->getString(IDS_DEATH_WALK_SCORE_AMT_TEMPL);
 			_scoringTextScores = Common::String::format(stringResource.c_str(), finalCriticalEvidenceScore, finalSupportingEvidenceScore, finalPuzzleScore, finalResearchScore, completionScore);
 		} else {
 			if (deathSceneIndex == 60) {
 				_scoringTextDescriptions = Common::String::format("Critical Evidence: %d / 4 x 1000\nSupporting Evidence: %d / 7 x 500\nPuzzles Solved: %d / 19 x 200\nResearch Bonus: %d / 15 x 100\nCompletion Bonus:",
-						criticalEvidence, supportingEvidence, puzzlesSolved, researchBonusRaw);
+																  criticalEvidence, supportingEvidence, puzzlesSolved, researchBonusRaw);
 				_scoringTextScores = Common::String::format("%d\n%d\n%d\n%d\n%d", finalCriticalEvidenceScore, finalSupportingEvidenceScore, finalPuzzleScore, finalResearchScore, completionScore);
 			} else {
 				_scoringTextDescriptions = Common::String::format("Critical Evidence: %d / 4 x 1000\nSupporting Evidence: %d / 7 x 500\nPuzzles Solved: %d / 19 x 200\nResearch Bonus: %d / 15 x 100",
-						criticalEvidence, supportingEvidence, puzzlesSolved, researchBonusRaw);
+																  criticalEvidence, supportingEvidence, puzzlesSolved, researchBonusRaw);
 				_scoringTextScores = Common::String::format("%d\n%d\n%d\n%d", finalCriticalEvidenceScore, finalSupportingEvidenceScore, finalPuzzleScore, finalResearchScore);
 			}
 		}
+
+		_scoringTextDescriptionsWithScores = Common::String::format("Current Points:\n\nCritical Evidence: %d / 4 x 1000: %d\nSupporting Evidence: %d / 7 x 500: %d\nPuzzles Solved: %d / 19 x 200: %d\nResearch Bonus: %d / 15 x 100: %d\nCompletion Bonus: %d\n\nTotal Score: %d\n",
+																	criticalEvidence, finalCriticalEvidenceScore,
+																	supportingEvidence, finalSupportingEvidenceScore,
+																	puzzlesSolved, finalPuzzleScore,
+																	researchBonusRaw, finalResearchScore,
+																	completionScore, totalScore);
 	} else {
 		totalScore -= hintsScore;
 
-		if (_vm->getVersion() >= MAKEVERSION(1, 0, 4, 0)) {
+		if (vm->getVersion() >= MAKEVERSION(1, 0, 4, 0)) {
 			// HACK HACK HACK: Did I mention this was terrible?
-			Common::String stringResource = _vm->getString(IDS_DEATH_SCORE_DESC_TEMPL);
+			Common::String stringResource = vm->getString(IDS_DEATH_SCORE_DESC_TEMPL);
 			_scoringTextDescriptions = Common::String::format(stringResource.c_str(), criticalEvidence, supportingEvidence, puzzlesSolved, researchBonusRaw, hints);
-			stringResource = _vm->getString(IDS_DEATH_SCORE_AMT_TEMPL);
+			stringResource = vm->getString(IDS_DEATH_SCORE_AMT_TEMPL);
 			_scoringTextScores = Common::String::format(stringResource.c_str(), finalCriticalEvidenceScore, finalSupportingEvidenceScore, finalPuzzleScore, finalResearchScore, completionScore, -hintsScore);
 		} else {
 			if (deathSceneIndex == 60) {
 				_scoringTextDescriptions = Common::String::format("Critical Evidence: %d / 4 x 1000\nSupporting Evidence: %d / 7 x 500\nPuzzles Solved: %d / 20 x 200\nResearch Bonus: %d / 15 x 100\nCompletion Bonus:\n\nHints: %d @ -50 ea.",
-						criticalEvidence, supportingEvidence, puzzlesSolved, researchBonusRaw, hints);
+																  criticalEvidence, supportingEvidence, puzzlesSolved, researchBonusRaw, hints);
 				_scoringTextScores = Common::String::format("%d\n%d\n%d\n%d\n%d\n\n%d", finalCriticalEvidenceScore, finalSupportingEvidenceScore, finalPuzzleScore, finalResearchScore, completionScore, -hintsScore);
 			} else {
 				_scoringTextDescriptions = Common::String::format("Critical Evidence: %d / 4 x 1000\nSupporting Evidence: %d / 7 x 500\nPuzzles Solved: %d / 20 x 200\nResearch Bonus: %d / 15 x 100\n\n\nHints: %d @ -50 ea.",
-						criticalEvidence, supportingEvidence, puzzlesSolved, researchBonusRaw, hints);
+																  criticalEvidence, supportingEvidence, puzzlesSolved, researchBonusRaw, hints);
 				_scoringTextScores = Common::String::format("%d\n%d\n%d\n%d\n\n\n%d", finalCriticalEvidenceScore, finalSupportingEvidenceScore, finalPuzzleScore, finalResearchScore, -hintsScore);
 			}
 		}
+
+		_scoringTextDescriptionsWithScores = Common::String::format("Current Points:\n\nCritical Evidence: %d / 4 x 1000: %d\nSupporting Evidence: %d / 7 x 500: %d\nPuzzles Solved: %d / 20 x 200: %d\nResearch Bonus: %d / 15 x 100: %d\nCompletion Bonus: %d\n\nHints: %d @ -50 ea.\n\nTotal Score: %d\n",
+																	criticalEvidence, finalCriticalEvidenceScore,
+																	supportingEvidence, finalSupportingEvidenceScore,
+																	puzzlesSolved, finalPuzzleScore,
+																	researchBonusRaw, finalResearchScore,
+																	completionScore, -hintsScore, totalScore);
 	}
 
-	// This would be a hack, but since it's just printing one number, I'm not
-	// loading that damned string too.
 	_scoringTextFinalScore = Common::String::format("%d", totalScore);
-
-	_vm->_sound->setAmbientSound();
 }
 
 #undef CHECK_PUZZLE_FLAG
@@ -237,6 +186,73 @@ DeathWindow::DeathWindow(BuriedEngine *vm, Window *parent, int deathSceneIndex,
 #undef CHECK_CRITICAL_EVIDENCE
 #undef CHECK_SUPPORTING_EVIDENCE
 
+enum {
+	BUTTON_QUIT = 1,
+	BUTTON_RESTORE_GAME = 2,
+	BUTTON_MAIN_MENU = 3
+};
+
+DeathWindow::DeathWindow(BuriedEngine *vm, Window *parent, int deathSceneIndex, GlobalFlags &globalFlags, Common::Array<int> itemArray)
+		: Window(vm, parent), _deathSceneIndex(deathSceneIndex), _globalFlags(globalFlags), _itemArray(itemArray) {
+	_curButton = 0;
+	_deathFrameIndex = -1;
+	_lightOn = false;
+	_walkthroughMode = false;
+
+	_rect = Common::Rect(0, 0, 640, 480);
+	_quit = Common::Rect(27, 422, 100, 460);
+	_restoreGame = Common::Rect(112, 422, 185, 460);
+	_mainMenu = Common::Rect(198, 422, 271, 460);
+	_agentEvaluation = new AgentEvaluation(vm, globalFlags, deathSceneIndex);
+	_timer = setTimer(400);
+
+	if (deathSceneIndex < 10) {
+		_deathSceneFrames = new AVIFrames(_vm->getFilePath(IDS_DEATH_CASTLE_FILENAME));
+	} else if (deathSceneIndex < 20) {
+		_deathSceneFrames = new AVIFrames(_vm->getFilePath(IDS_DEATH_MAYAN_FILENAME));
+	} else if (deathSceneIndex < 30) {
+		_deathSceneFrames = new AVIFrames(_vm->getFilePath(IDS_DEATH_AGENTLAIR_FILENAME));
+	} else if (deathSceneIndex < 40) {
+		_deathSceneFrames = new AVIFrames(_vm->getFilePath(IDS_DEATH_DAVINCI_FILENAME));
+	} else if (deathSceneIndex < 50) {
+		_deathSceneFrames = new AVIFrames(_vm->getFilePath(IDS_DEATH_AILAB_FILENAME));
+	} else if (deathSceneIndex < 60) {
+		_deathSceneFrames = new AVIFrames(_vm->getFilePath(IDS_DEATH_ALIEN_FILENAME));
+	} else if (deathSceneIndex < 70) {
+		_deathSceneFrames = new AVIFrames(_vm->getFilePath(IDS_DEATH_FINALE_FILENAME));
+	} else {
+		error("Bad death scene index %d", deathSceneIndex);
+	}
+
+	// Set the frame index
+	switch (deathSceneIndex) {
+	case 15:
+		_deathFrameIndex = 4;
+		break;
+	case 52:
+	case 53:
+		_deathFrameIndex = 1;
+		break;
+	case 54:
+	case 55:
+		_deathFrameIndex = 0;
+		break;
+	default:
+		_deathFrameIndex = deathSceneIndex % 10;
+		break;
+	}
+
+	_fontHeightA = (_vm->getLanguage() == Common::JA_JPN) ? 12 : 14;
+	_textFontA = _vm->_gfx->createFont(_fontHeightA);
+
+	_fontHeightB = 20;
+	_textFontB = _vm->_gfx->createFont(_fontHeightB, true);
+
+	_walkthroughMode = _globalFlags.generalWalkthroughMode != 0;
+
+	_vm->_sound->setAmbientSound();
+}
+
 DeathWindow::~DeathWindow() {
 	killTimer(_timer);
 
@@ -244,6 +260,7 @@ DeathWindow::~DeathWindow() {
 
 	delete _textFontA;
 	delete _textFontB;
+	delete _agentEvaluation;
 }
 
 void DeathWindow::onPaint() {
@@ -287,14 +304,14 @@ void DeathWindow::onPaint() {
 	_vm->_gfx->renderText(_vm->_gfx->getScreen(), _textFontA, secondBlock, secondBlockRect.left, secondBlockRect.top, secondBlockRect.width(), secondBlockRect.height(), textColor, _fontHeightA);
 
 	Common::Rect scoringDescRect(10, 248, 283, 378);
-	_vm->_gfx->renderText(_vm->_gfx->getScreen(), _textFontA, _scoringTextDescriptions, scoringDescRect.left, scoringDescRect.top, scoringDescRect.width(), scoringDescRect.height(), textColor, _fontHeightA);
+	_vm->_gfx->renderText(_vm->_gfx->getScreen(), _textFontA, _agentEvaluation->_scoringTextDescriptions, scoringDescRect.left, scoringDescRect.top, scoringDescRect.width(), scoringDescRect.height(), textColor, _fontHeightA);
 
 	textColor = _vm->_gfx->getColor(212, 109, 0);
-	_vm->_gfx->renderText(_vm->_gfx->getScreen(), _textFontA, _scoringTextScores, scoringDescRect.left, scoringDescRect.top, scoringDescRect.width(), scoringDescRect.height(), textColor, _fontHeightA, kTextAlignRight);
+	_vm->_gfx->renderText(_vm->_gfx->getScreen(), _textFontA, _agentEvaluation->_scoringTextScores, scoringDescRect.left, scoringDescRect.top, scoringDescRect.width(), scoringDescRect.height(), textColor, _fontHeightA, kTextAlignRight);
 
 	// CHECKME: This does center vertical alignment, so check the y coordinates
 	Common::Rect finalTextScoreRect(122, 386, 283, 401);
-	_vm->_gfx->renderText(_vm->_gfx->getScreen(), _textFontB, _scoringTextFinalScore, finalTextScoreRect.left, finalTextScoreRect.top, finalTextScoreRect.width(), finalTextScoreRect.height(), textColor, _fontHeightB, kTextAlignRight);
+	_vm->_gfx->renderText(_vm->_gfx->getScreen(), _textFontB, _agentEvaluation->_scoringTextFinalScore, finalTextScoreRect.left, finalTextScoreRect.top, finalTextScoreRect.width(), finalTextScoreRect.height(), textColor, _fontHeightB, kTextAlignRight);
 }
 
 bool DeathWindow::onEraseBackground() {
diff --git a/engines/buried/death.h b/engines/buried/death.h
index 039bf9e9058..507f5672b90 100644
--- a/engines/buried/death.h
+++ b/engines/buried/death.h
@@ -37,6 +37,19 @@ namespace Buried {
 
 class AVIFrames;
 
+class AgentEvaluation {
+public:
+	AgentEvaluation(BuriedEngine *vm, GlobalFlags &globalFlags, int deathSceneIndex);
+
+	Common::String _scoringTextDescriptions;
+	Common::String _scoringTextScores;
+	Common::String _scoringTextFinalScore;
+	Common::String _scoringTextDescriptionsWithScores;
+
+private:
+	GlobalFlags _globalFlags;
+};
+
 class DeathWindow : public Window {
 public:
 	DeathWindow(BuriedEngine *vm, Window *parent, int deathSceneIndex, GlobalFlags &globalFlags, Common::Array<int> itemArray);
@@ -65,10 +78,7 @@ private:
 	Graphics::Font *_textFontB;
 	int _fontHeightA, _fontHeightB;
 	bool _walkthroughMode;
-
-	Common::String _scoringTextDescriptions;
-	Common::String _scoringTextScores;
-	Common::String _scoringTextFinalScore;
+	AgentEvaluation *_agentEvaluation;
 };
 
 } // End of namespace Buried
diff --git a/engines/buried/scene_view.cpp b/engines/buried/scene_view.cpp
index c88ac3c9cce..22bffc9edb9 100644
--- a/engines/buried/scene_view.cpp
+++ b/engines/buried/scene_view.cpp
@@ -2461,12 +2461,6 @@ void SceneViewWindow::onKeyUp(const Common::KeyState &key, uint flags) {
 			return;
 		}
 		break;
-	case Common::KEYCODE_p:
-		if (key.flags & Common::KBD_CTRL) {
-			// TODO: Pause game
-			return;
-		}
-		break;
 	case Common::KEYCODE_q:
 		if (key.flags & Common::KBD_CTRL) {
 			// Return to main menu
@@ -2475,6 +2469,14 @@ void SceneViewWindow::onKeyUp(const Common::KeyState &key, uint flags) {
 			return;
 		}
 		break;
+	case Common::KEYCODE_d:
+		if (key.flags & Common::KBD_CTRL) {
+			// Current points (ScummVM enhancement - Agent evaluation
+			// from death screens)
+			_vm->showPoints();
+			return;
+		}
+		break;
 	case Common::KEYCODE_SPACE:
 		if (((GameUIWindow *)_parent)->_inventoryWindow->isItemInInventory(kItemBioChipAI) && _globalFlags.bcCloakingEnabled != 1) {
 			if (!_lastAICommentFileName.empty()) {


Commit: bc9b2ddeda360fd13f45503657dfa207f229b7b9
    https://github.com/scummvm/scummvm/commit/bc9b2ddeda360fd13f45503657dfa207f229b7b9
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2021-12-31T19:12:30+02:00

Commit Message:
BURIED: Fix global flag corruption in death screens

A regression from b8da2eed66aeeeeee99e765ce08f0fb0a53460fa

Changed paths:
    engines/buried/death.cpp
    engines/buried/death.h
    engines/buried/frame_window.cpp


diff --git a/engines/buried/death.cpp b/engines/buried/death.cpp
index a139ac2f89f..34af37cf36f 100644
--- a/engines/buried/death.cpp
+++ b/engines/buried/death.cpp
@@ -192,7 +192,7 @@ enum {
 	BUTTON_MAIN_MENU = 3
 };
 
-DeathWindow::DeathWindow(BuriedEngine *vm, Window *parent, int deathSceneIndex, GlobalFlags &globalFlags, Common::Array<int> itemArray)
+DeathWindow::DeathWindow(BuriedEngine *vm, Window *parent, int deathSceneIndex, GlobalFlags globalFlags, Common::Array<int> itemArray)
 		: Window(vm, parent), _deathSceneIndex(deathSceneIndex), _globalFlags(globalFlags), _itemArray(itemArray) {
 	_curButton = 0;
 	_deathFrameIndex = -1;
diff --git a/engines/buried/death.h b/engines/buried/death.h
index 507f5672b90..6b8fd887d52 100644
--- a/engines/buried/death.h
+++ b/engines/buried/death.h
@@ -52,7 +52,7 @@ private:
 
 class DeathWindow : public Window {
 public:
-	DeathWindow(BuriedEngine *vm, Window *parent, int deathSceneIndex, GlobalFlags &globalFlags, Common::Array<int> itemArray);
+	DeathWindow(BuriedEngine *vm, Window *parent, int deathSceneIndex, GlobalFlags globalFlags, Common::Array<int> itemArray);
 	~DeathWindow();
 
 	void onPaint();
diff --git a/engines/buried/frame_window.cpp b/engines/buried/frame_window.cpp
index b7bbb63bc52..f3bd72a0ded 100644
--- a/engines/buried/frame_window.cpp
+++ b/engines/buried/frame_window.cpp
@@ -268,8 +268,13 @@ bool FrameWindow::showDeathScene(int deathSceneIndex, GlobalFlags &globalFlags,
 
 	_vm->removeMouseMessages(this);
 
+	// Pass globalFlags by value to DeathWindowhere, as they will be destroyed
+	// together with _mainChildWindow (a GameUIWindow, which contains the scene
+	// window, which holds the instance of the global flags)
+	DeathWindow *deathWindow = new DeathWindow(_vm, this, deathSceneIndex, globalFlags, itemArray);
+
 	delete _mainChildWindow;
-	_mainChildWindow = new DeathWindow(_vm, this, deathSceneIndex, globalFlags, itemArray);
+	_mainChildWindow = deathWindow;
 	_mainChildWindow->showWindow(kWindowShow);
 	_mainChildWindow->invalidateWindow(false);
 


Commit: 728d76b089c3af870600f69bc84eb4d2fe209db5
    https://github.com/scummvm/scummvm/commit/728d76b089c3af870600f69bc84eb4d2fe209db5
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2021-12-31T19:12:30+02:00

Commit Message:
BURIED: Adapt more callbacks with hardcoded global flags

Changed paths:
    engines/buried/environ/ai_lab.cpp
    engines/buried/environ/scene_common.cpp
    engines/buried/environ/scene_common.h


diff --git a/engines/buried/environ/ai_lab.cpp b/engines/buried/environ/ai_lab.cpp
index 14ede01d7ba..27f6e0be405 100644
--- a/engines/buried/environ/ai_lab.cpp
+++ b/engines/buried/environ/ai_lab.cpp
@@ -2280,31 +2280,30 @@ int CapacitancePanelInterface::gdiPaint(Window *viewWindow) {
 class PlayArthurOffsetCapacitance : public BaseOxygenTimerCapacitance {
 public:
 	PlayArthurOffsetCapacitance(BuriedEngine *vm, Window *viewWindow, const LocationStaticData &sceneStaticData, const Location &priorLocation,
-			int stingerVolume = 127, int lastStingerFlagOffset = -1, int effectIDFlagOffset = -1, int firstStingerFileID = -1,
-			int lastStingerFileID = -1, int stingerDelay = 1, int flagOffset = -1, int newStill = -1, int newNavStart = -1, int newNavLength = -1);
+			int stingerVolume = 127, int firstStingerFileID = -1, int lastStingerFileID = -1,
+			int stingerDelay = 1, int newStill = -1, int newNavStart = -1, int newNavLength = -1);
 	int postEnterRoom(Window *viewWindow, const Location &priorLocation) override;
 
 private:
 	int _stingerVolume;
-	int _lastStingerFlagOffset;
-	int _effectIDFlagOffset;
 	int _firstStingerFileID;
 	int _lastStingerFileID;
 	int _stingerDelay;
 };
 
 PlayArthurOffsetCapacitance::PlayArthurOffsetCapacitance(BuriedEngine *vm, Window *viewWindow, const LocationStaticData &sceneStaticData, const Location &priorLocation,
-		int stingerVolume, int lastStingerFlagOffset, int effectIDFlagOffset, int firstStingerFileID,
-		int lastStingerFileID, int stingerDelay, int flagOffset, int newStill, int newNavStart, int newNavLength) :
+		int stingerVolume, int firstStingerFileID, int lastStingerFileID, int stingerDelay,
+		int newStill, int newNavStart, int newNavLength) :
 		BaseOxygenTimerCapacitance(vm, viewWindow, sceneStaticData, priorLocation) {
+	SceneViewWindow *sceneView = ((SceneViewWindow *)viewWindow);
+	GlobalFlags &globalFlags = sceneView->getGlobalFlags();
+
 	_stingerVolume = stingerVolume;
-	_lastStingerFlagOffset = lastStingerFlagOffset;
-	_effectIDFlagOffset = effectIDFlagOffset;
 	_firstStingerFileID = firstStingerFileID;
 	_lastStingerFileID = lastStingerFileID;
 	_stingerDelay = stingerDelay;
 
-	if (flagOffset >= 0 && ((SceneViewWindow *)viewWindow)->getGlobalFlagByte(flagOffset) == 0) {
+	if (globalFlags.aiCRGrabbedMetalBar == 0) {
 		// This is completely wrong.
 		//if (newStill >= 0)
 		//	_staticData.navFrameIndex;
@@ -2316,48 +2315,49 @@ PlayArthurOffsetCapacitance::PlayArthurOffsetCapacitance(BuriedEngine *vm, Windo
 }
 
 int PlayArthurOffsetCapacitance::postEnterRoom(Window *viewWindow, const Location &priorLocation) {
+	SceneViewWindow *sceneView = ((SceneViewWindow *)viewWindow);
+	GlobalFlags &globalFlags = sceneView->getGlobalFlags();
+
 	BaseOxygenTimerCapacitance::postEnterRoom(viewWindow, priorLocation);
 
-	if (_effectIDFlagOffset >= 0) {
-		byte effectID = ((SceneViewWindow *)viewWindow)->getGlobalFlagByte(_effectIDFlagOffset);
+	byte effectID = globalFlags.aiCRStingerChannelID;
 
-		if (!_vm->_sound->isSoundEffectPlaying(effectID - 1)) {
-			byte lastStinger = ((SceneViewWindow *)viewWindow)->getGlobalFlagByte(_lastStingerFlagOffset) + 1;
+	if (!_vm->_sound->isSoundEffectPlaying(effectID - 1)) {
+		byte lastStinger = globalFlags.aiCRStingerID + 1;
 
-			if ((lastStinger % _stingerDelay) == 0) {
-				if (lastStinger < (_lastStingerFileID - _firstStingerFileID) * _stingerDelay) {
-					int fileNameIndex = _vm->computeFileNameResourceID(_staticData.location.timeZone, _staticData.location.environment, _firstStingerFileID + (lastStinger / _stingerDelay) - 1);
-
-					if (((GameUIWindow *)viewWindow->getParent())->_inventoryWindow->isItemInInventory(kItemBioChipAI) && (lastStinger / _stingerDelay) < 3) {
-						_vm->_sound->playSynchronousSoundEffect(_vm->getFilePath(fileNameIndex));
-
-						// Play an Arthur comment if we have the chip
-						switch (lastStinger / _stingerDelay) {
-						case 0:
-							_vm->_sound->playSynchronousSoundEffect("BITDATA/AILAB/AICR_C01.BTA", 127);
-							break;
-						case 1:
-							_vm->_sound->playSynchronousSoundEffect("BITDATA/AILAB/AICR_C02.BTA", 127);
-							break;
-						case 2:
-							_vm->_sound->playSynchronousSoundEffect("BITDATA/AILAB/AICR_C03.BTA", 127);
-							break;
-						}
+		if ((lastStinger % _stingerDelay) == 0) {
+			if (lastStinger < (_lastStingerFileID - _firstStingerFileID) * _stingerDelay) {
+				int fileNameIndex = _vm->computeFileNameResourceID(_staticData.location.timeZone, _staticData.location.environment, _firstStingerFileID + (lastStinger / _stingerDelay) - 1);
 
-						// Update the global flags
-						((SceneViewWindow *)viewWindow)->setGlobalFlagByte(_lastStingerFlagOffset, lastStinger);
-					} else {
-						byte newStingerID = _vm->_sound->playSoundEffect(_vm->getFilePath(fileNameIndex), _stingerVolume, false, true) + 1;
+				if (((GameUIWindow *)viewWindow->getParent())->_inventoryWindow->isItemInInventory(kItemBioChipAI) && (lastStinger / _stingerDelay) < 3) {
+					_vm->_sound->playSynchronousSoundEffect(_vm->getFilePath(fileNameIndex));
 
-						// Update the global flags
-						((SceneViewWindow *)viewWindow)->setGlobalFlagByte(_effectIDFlagOffset, newStingerID);
-						((SceneViewWindow *)viewWindow)->setGlobalFlagByte(_lastStingerFlagOffset, lastStinger);
+					// Play an Arthur comment if we have the chip
+					switch (lastStinger / _stingerDelay) {
+					case 0:
+						_vm->_sound->playSynchronousSoundEffect("BITDATA/AILAB/AICR_C01.BTA", 127);
+						break;
+					case 1:
+						_vm->_sound->playSynchronousSoundEffect("BITDATA/AILAB/AICR_C02.BTA", 127);
+						break;
+					case 2:
+						_vm->_sound->playSynchronousSoundEffect("BITDATA/AILAB/AICR_C03.BTA", 127);
+						break;
 					}
+
+					// Update the global flags
+					globalFlags.aiCRStingerID = lastStinger;
+				} else {
+					byte newStingerID = _vm->_sound->playSoundEffect(_vm->getFilePath(fileNameIndex), _stingerVolume, false, true) + 1;
+
+					// Update the global flags
+					globalFlags.aiCRStingerChannelID = newStingerID;
+					globalFlags.aiCRStingerID = lastStinger;
 				}
-			} else {
-				((SceneViewWindow *)viewWindow)->setGlobalFlagByte(_effectIDFlagOffset, 0xFF);
-				((SceneViewWindow *)viewWindow)->setGlobalFlagByte(_lastStingerFlagOffset, lastStinger);
 			}
+		} else {
+			globalFlags.aiCRStingerChannelID = 0xFF;
+			globalFlags.aiCRStingerID = lastStinger;
 		}
 	}
 
@@ -3764,7 +3764,7 @@ SceneBase *SceneViewWindow::constructAILabSceneObject(Window *viewWindow, const
 	case 12:
 		return new BaseOxygenTimerInSpace(_vm, viewWindow, sceneStaticData, priorLocation);
 	case 20:
-		return new PlayArthurOffsetCapacitance(_vm, viewWindow, sceneStaticData, priorLocation, 127, offsetof(GlobalFlags, aiCRStingerID), offsetof(GlobalFlags, aiCRStingerChannelID), 4, 11, 1);
+		return new PlayArthurOffsetCapacitance(_vm, viewWindow, sceneStaticData, priorLocation, 127, 4, 11, 1);
 	case 21:
 		return new CapacitanceToHabitatDoorClosed(_vm, viewWindow, sceneStaticData, priorLocation);
 	case 22:
@@ -3778,9 +3778,9 @@ SceneBase *SceneViewWindow::constructAILabSceneObject(Window *viewWindow, const
 	case 26:
 		return new PlaySoundExitingFromScene(_vm, viewWindow, sceneStaticData, priorLocation, 14);
 	case 27:
-		return new PlayArthurOffsetCapacitance(_vm, viewWindow, sceneStaticData, priorLocation, 127, offsetof(GlobalFlags, aiCRStingerID), offsetof(GlobalFlags, aiCRStingerChannelID), 4, 11, 1, offsetof(GlobalFlags, aiCRGrabbedMetalBar), 73, 320, 40);
+		return new PlayArthurOffsetCapacitance(_vm, viewWindow, sceneStaticData, priorLocation, 127, 4, 11, 1, 73, 320, 40);
 	case 28:
-		return new PlayArthurOffsetCapacitance(_vm, viewWindow, sceneStaticData, priorLocation, 127, offsetof(GlobalFlags, aiCRStingerID), offsetof(GlobalFlags, aiCRStingerChannelID), 4, 11, 1, offsetof(GlobalFlags, aiCRGrabbedMetalBar), 66, 241, 25);
+		return new PlayArthurOffsetCapacitance(_vm, viewWindow, sceneStaticData, priorLocation, 127, 4, 11, 1, 66, 241, 25);
 	case 30:
 		return new PlaySoundEnteringScene(_vm, viewWindow, sceneStaticData, priorLocation, 5, offsetof(GlobalFlags, aiDBPlayedFirstArthur));
 	case 31:
@@ -3798,7 +3798,7 @@ SceneBase *SceneViewWindow::constructAILabSceneObject(Window *viewWindow, const
 	case 38:
 		return new PlaySoundEnteringScene(_vm, viewWindow, sceneStaticData, priorLocation, 8, offsetof(GlobalFlags, aiDBPlayedFourthArthur));
 	case 39:
-		return new DisableForwardMovement(_vm, viewWindow, sceneStaticData, priorLocation, offsetof(GlobalFlags, generalWalkthroughMode), 1);
+		return new DisableForwardMovement(_vm, viewWindow, sceneStaticData, priorLocation, 1);
 	case 40:
 		return new ScanningRoomEntryScan(_vm, viewWindow, sceneStaticData, priorLocation);
 	case 41:
diff --git a/engines/buried/environ/scene_common.cpp b/engines/buried/environ/scene_common.cpp
index 5474091afe2..0a259355faa 100644
--- a/engines/buried/environ/scene_common.cpp
+++ b/engines/buried/environ/scene_common.cpp
@@ -826,9 +826,11 @@ int OneShotEntryVideoWarning::postEnterRoom(Window *viewWindow, const Location &
 }
 
 DisableForwardMovement::DisableForwardMovement(BuriedEngine *vm, Window *viewWindow, const LocationStaticData &sceneStaticData, const Location &priorLocation,
-		int flagOffset, int flagValue) :
+		int flagValue) :
 		SceneBase(vm, viewWindow, sceneStaticData, priorLocation) {
-	if (flagOffset >= 0 && ((SceneViewWindow *)viewWindow)->getGlobalFlagByte(flagOffset) == flagValue)
+	SceneViewWindow *sceneView = ((SceneViewWindow *)viewWindow);
+	GlobalFlags &globalFlags = sceneView->getGlobalFlags();
+	if (globalFlags.generalWalkthroughMode == flagValue)
 		_staticData.destForward.destinationScene = Location(-1, -1, -1, -1, -1, -1);
 }
 
diff --git a/engines/buried/environ/scene_common.h b/engines/buried/environ/scene_common.h
index d1a5fe304dd..c6bd7ce0e6c 100644
--- a/engines/buried/environ/scene_common.h
+++ b/engines/buried/environ/scene_common.h
@@ -277,7 +277,7 @@ private:
 class DisableForwardMovement : public SceneBase {
 public:
 	DisableForwardMovement(BuriedEngine *vm, Window *viewWindow, const LocationStaticData &sceneStaticData, const Location &priorLocation,
-			int flagOffset = -1, int flagValue = 1);
+			int flagValue = 1);
 };
 
 class CycleEntryVideoWarning : public SceneBase {


Commit: d86ea21f777a7a5120ce496442d9d8b6f28664c5
    https://github.com/scummvm/scummvm/commit/d86ea21f777a7a5120ce496442d9d8b6f28664c5
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2021-12-31T19:12:30+02:00

Commit Message:
NEWS: Add more changes for The Journeyman Project 2: Buried in Time

Changed paths:
    NEWS.md


diff --git a/NEWS.md b/NEWS.md
index 33aea166b20..b5cf8e6c6a1 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -29,6 +29,8 @@ For a more comprehensive changelog of the latest experimental code, see:
    - The currently selected item is now stored in saved games.
    - Comments from Arthur that play in the background can now be stopped with
      the space key (the same key that replays Arthur's last comment).
+   - The agent evaluation (current points) can now be shown with Control-D.
+   - Fixed global flag corruption in death screens.
 
  Dreamweb:
    - Added text to speech for dialogs and object descriptions.




More information about the Scummvm-git-logs mailing list