[Scummvm-git-logs] scummvm master -> b52f48623236abd23af711241454d99ba51109db
bluegr
noreply at scummvm.org
Sun Jan 2 14:52:43 UTC 2022
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
7fad23af52 BURIED: Move AI comment info
b52f486232 BURIED: Move agent evaluation (score) logic into a separate file
Commit: 7fad23af52985238db754086634772e1257c595f
https://github.com/scummvm/scummvm/commit/7fad23af52985238db754086634772e1257c595f
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2022-01-02T16:49:57+02:00
Commit Message:
BURIED: Move AI comment info
Changed paths:
engines/buried/aidata.h
engines/buried/scene_view.h
diff --git a/engines/buried/aidata.h b/engines/buried/aidata.h
index 64ed0289991..d51744be616 100644
--- a/engines/buried/aidata.h
+++ b/engines/buried/aidata.h
@@ -62,6 +62,35 @@ struct AIComment {
uint16 statusFlagOffset;
};
+
+struct AICommentInfo {
+ byte timeZone;
+ byte environment;
+ const char *filePath;
+};
+
+// timeZone, environment, filePath
+static const AICommentInfo s_aiCommentInfo[] {
+ // Castle
+ { 1, 1, "CASTLE/CGTT" }, { 1, 2, "CASTLE/CGTS" }, { 1, 3, "CASTLE/CGMW" },
+ { 1, 4, "CASTLE/CGMB" }, { 1, 5, "CASTLE/CGBS" }, { 1, 6, "CASTLE/CGKC" },
+ { 1, 7, "CASTLE/CGST" }, { 1, 8, "CASTLE/CGKS" }, { 1, 9, "CASTLE/CGSR" },
+ { 1, 10, "CASTLE/CGTR" },
+ // Mayan
+ { 2, 1, "MAYAN/MYTP" }, { 2, 2, "MAYAN/MYMC" }, { 2, 3, "MAYAN/MYWG" },
+ { 2, 4, "MAYAN/MYWT" }, { 2, 5, "MAYAN/MYAG" }, { 2, 6, "MAYAN/MYDG" },
+ // Future Apartment
+ { 4, 1, "FUTAPT/FAKI" }, { 4, 2, "FUTAPT/FAER" }, { 4, 3, "FUTAPT/FAMN" },
+ // Da Vinci
+ { 5, 1, "DAVINCI/DSPT" }, { 5, 2, "DAVINCI/DSCT" }, { 5, 3, "DAVINCI/DSGD" },
+ { 5, 4, "DAVINCI/DSWS" }, { 5, 5, "DAVINCI/DSCY" },
+ // Space Station
+ { 6, 1, "AILAB/AIHW" }, { 6, 2, "AILAB/AICR" }, { 6, 3, "AILAB/AIDB" },
+ { 6, 4, "AILAB/AISC" }, { 6, 5, "AILAB/AINX" }, { 6, 6, "AILAB/AIIC" },
+ { 6, 7, "AILAB/AISW" }, { 6, 8, "AILAB/AIMR" }, { 6, 10, "AILAB/AIHW" }, // there is no 9
+ { 0, 0, "" }
+};
+
} // End of namespace Buried
#endif
diff --git a/engines/buried/scene_view.h b/engines/buried/scene_view.h
index 353dc42d076..5a13d5fe5b0 100644
--- a/engines/buried/scene_view.h
+++ b/engines/buried/scene_view.h
@@ -251,34 +251,6 @@ private:
void setAIFlag(uint16 offset, byte value);
};
-struct AICommentInfo {
- byte timeZone;
- byte environment;
- const char *filePath;
-};
-
-// timeZone, environment, filePath
-static const AICommentInfo s_aiCommentInfo[] {
- // Castle
- { 1, 1, "CASTLE/CGTT" }, { 1, 2, "CASTLE/CGTS" }, { 1, 3, "CASTLE/CGMW" },
- { 1, 4, "CASTLE/CGMB" }, { 1, 5, "CASTLE/CGBS" }, { 1, 6, "CASTLE/CGKC" },
- { 1, 7, "CASTLE/CGST" }, { 1, 8, "CASTLE/CGKS" }, { 1, 9, "CASTLE/CGSR" },
- { 1, 10, "CASTLE/CGTR" },
- // Mayan
- { 2, 1, "MAYAN/MYTP" }, { 2, 2, "MAYAN/MYMC" }, { 2, 3, "MAYAN/MYWG" },
- { 2, 4, "MAYAN/MYWT" }, { 2, 5, "MAYAN/MYAG" }, { 2, 6, "MAYAN/MYDG" },
- // Future Apartment
- { 4, 1, "FUTAPT/FAKI" }, { 4, 2, "FUTAPT/FAER" }, { 4, 3, "FUTAPT/FAMN" },
- // Da Vinci
- { 5, 1, "DAVINCI/DSPT" }, { 5, 2, "DAVINCI/DSCT" }, { 5, 3, "DAVINCI/DSGD" },
- { 5, 4, "DAVINCI/DSWS" }, { 5, 5, "DAVINCI/DSCY" },
- // Space Station
- { 6, 1, "AILAB/AIHW" }, { 6, 2, "AILAB/AICR" }, { 6, 3, "AILAB/AIDB" },
- { 6, 4, "AILAB/AISC" }, { 6, 5, "AILAB/AINX" }, { 6, 6, "AILAB/AIIC" },
- { 6, 7, "AILAB/AISW" }, { 6, 8, "AILAB/AIMR" }, { 6, 10, "AILAB/AIHW" }, // there is no 9
- { 0, 0, "" }
-};
-
} // End of namespace Buried
#endif
Commit: b52f48623236abd23af711241454d99ba51109db
https://github.com/scummvm/scummvm/commit/b52f48623236abd23af711241454d99ba51109db
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2022-01-02T16:52:20+02:00
Commit Message:
BURIED: Move agent evaluation (score) logic into a separate file
This is used by the death screens, the completion screen, and our
in-game score screen, so move the duplicate code into a new file
Changed paths:
A engines/buried/agent_evaluation.cpp
A engines/buried/agent_evaluation.h
engines/buried/buried.cpp
engines/buried/complete.cpp
engines/buried/complete.h
engines/buried/death.cpp
engines/buried/death.h
engines/buried/module.mk
diff --git a/engines/buried/agent_evaluation.cpp b/engines/buried/agent_evaluation.cpp
new file mode 100644
index 00000000000..b68ae0b37c7
--- /dev/null
+++ b/engines/buried/agent_evaluation.cpp
@@ -0,0 +1,179 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995 Presto Studios, Inc.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "buried/agent_evaluation.h"
+#include "buried/biochip_right.h"
+#include "buried/buried.h"
+#include "buried/resources.h"
+
+namespace Buried {
+
+#define CHECK_PUZZLE_FLAG(flag) \
+ if (_globalFlags.flag != 0) \
+ puzzlesSolved++
+
+#define CHECK_RESEARCH_FLAG(flag) \
+ if (_globalFlags.flag != 0) \
+ researchBonusRaw++
+
+#define CHECK_CRITICAL_EVIDENCE(flag) \
+ if (_globalFlags.evcapBaseID[i] == flag) \
+ criticalEvidence++
+
+#define CHECK_SUPPORTING_EVIDENCE(flag) \
+ if (_globalFlags.evcapBaseID[i] == flag) \
+ supportingEvidence++
+
+AgentEvaluation::AgentEvaluation(BuriedEngine *vm, GlobalFlags &globalFlags, int deathSceneIndex) :
+ _globalFlags(globalFlags) {
+
+ int puzzlesSolved = 0;
+ CHECK_PUZZLE_FLAG(scoreGotTranslateBioChip);
+ CHECK_PUZZLE_FLAG(scoreEnteredSpaceStation);
+ CHECK_PUZZLE_FLAG(scoreDownloadedArthur);
+ CHECK_PUZZLE_FLAG(scoreFoundSculptureDiagram);
+ CHECK_PUZZLE_FLAG(scoreEnteredKeep);
+ CHECK_PUZZLE_FLAG(scoreGotKeyFromSmithy);
+ CHECK_PUZZLE_FLAG(scoreEnteredTreasureRoom);
+ CHECK_PUZZLE_FLAG(scoreFoundSwordDiamond);
+ CHECK_PUZZLE_FLAG(scoreMadeSiegeCycle);
+ CHECK_PUZZLE_FLAG(scoreEnteredCodexTower);
+ CHECK_PUZZLE_FLAG(scoreLoggedCodexEvidence);
+ CHECK_PUZZLE_FLAG(scoreEnteredMainCavern);
+ CHECK_PUZZLE_FLAG(scoreGotWealthGodPiece);
+ CHECK_PUZZLE_FLAG(scoreGotRainGodPiece);
+ CHECK_PUZZLE_FLAG(scoreGotWarGodPiece);
+ CHECK_PUZZLE_FLAG(scoreCompletedDeathGod);
+ CHECK_PUZZLE_FLAG(scoreEliminatedAgent3);
+ CHECK_PUZZLE_FLAG(scoreTransportToKrynn);
+ CHECK_PUZZLE_FLAG(scoreGotKrynnArtifacts);
+ CHECK_PUZZLE_FLAG(scoreDefeatedIcarus);
+
+ int researchBonusRaw = 0;
+ CHECK_RESEARCH_FLAG(scoreResearchINNLouvreReport); // > v1.01
+ CHECK_RESEARCH_FLAG(scoreResearchINNHighBidder);
+ CHECK_RESEARCH_FLAG(scoreResearchINNAppeal);
+ CHECK_RESEARCH_FLAG(scoreResearchINNUpdate);
+ CHECK_RESEARCH_FLAG(scoreResearchINNJumpsuit);
+ CHECK_RESEARCH_FLAG(scoreResearchBCJumpsuit);
+ CHECK_RESEARCH_FLAG(scoreResearchMichelle);
+ CHECK_RESEARCH_FLAG(scoreResearchMichelleBkg);
+ CHECK_RESEARCH_FLAG(scoreResearchLensFilter);
+ CHECK_RESEARCH_FLAG(scoreResearchCastleFootprint);
+ CHECK_RESEARCH_FLAG(scoreResearchDaVinciFootprint);
+ CHECK_RESEARCH_FLAG(scoreResearchMorphSculpture);
+ CHECK_RESEARCH_FLAG(scoreResearchEnvironCart);
+ CHECK_RESEARCH_FLAG(scoreResearchAgent3Note);
+ CHECK_RESEARCH_FLAG(scoreResearchAgent3DaVinci);
+
+ int criticalEvidence = 0;
+ int supportingEvidence = 0;
+ for (int i = 0; i < _globalFlags.evcapNumCaptured; i++) {
+ CHECK_CRITICAL_EVIDENCE(CASTLE_EVIDENCE_SWORD);
+ CHECK_CRITICAL_EVIDENCE(MAYAN_EVIDENCE_ENVIRON_CART);
+ CHECK_CRITICAL_EVIDENCE(DAVINCI_EVIDENCE_CODEX);
+ CHECK_CRITICAL_EVIDENCE(AI_EVIDENCE_SCULPTURE);
+
+ CHECK_SUPPORTING_EVIDENCE(CASTLE_EVIDENCE_FOOTPRINT);
+ CHECK_SUPPORTING_EVIDENCE(MAYAN_EVIDENCE_BROKEN_GLASS_PYRAMID);
+ CHECK_SUPPORTING_EVIDENCE(MAYAN_EVIDENCE_PHONY_BLOOD);
+ CHECK_SUPPORTING_EVIDENCE(CASTLE_EVIDENCE_AGENT3);
+ CHECK_SUPPORTING_EVIDENCE(DAVINCI_EVIDENCE_FOOTPRINT);
+ CHECK_SUPPORTING_EVIDENCE(DAVINCI_EVIDENCE_AGENT3);
+ CHECK_SUPPORTING_EVIDENCE(DAVINCI_EVIDENCE_LENS_FILTER);
+ }
+
+ int hints = _globalFlags.scoreHintsTotal;
+ int finalCriticalEvidenceScore = criticalEvidence * 1000;
+ int finalSupportingEvidenceScore = supportingEvidence * 500;
+ int finalPuzzleScore = puzzlesSolved * 200;
+ int finalResearchScore = researchBonusRaw * 100;
+ int hintsScore = hints * 50;
+ int completionScore = (deathSceneIndex == 60) ? 2000 : 0;
+ int totalScore = finalCriticalEvidenceScore + finalSupportingEvidenceScore + finalPuzzleScore + finalResearchScore + completionScore;
+
+ // Build the string buffers
+ // Newer versions include these strings as resources in the main executable.
+ // For earlier versions, we hardcode them here.
+ if (_globalFlags.generalWalkthroughMode != 0) {
+ if (vm->getVersion() >= MAKEVERSION(1, 0, 4, 0)) {
+ 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);
+ _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);
+ _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);
+ _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)) {
+ 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);
+ _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);
+ _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);
+ _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);
+ }
+
+ _scoringTextFinalScore = Common::String::format("%d", totalScore);
+}
+
+#undef CHECK_PUZZLE_FLAG
+#undef CHECK_RESEARCH_FLAG
+#undef CHECK_CRITICAL_EVIDENCE
+#undef CHECK_SUPPORTING_EVIDENCE
+
+} // End of namespace Buried
diff --git a/engines/buried/agent_evaluation.h b/engines/buried/agent_evaluation.h
new file mode 100644
index 00000000000..c5650343cd2
--- /dev/null
+++ b/engines/buried/agent_evaluation.h
@@ -0,0 +1,50 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995 Presto Studios, Inc.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef BURIED_AGENT_EVALUATION_H
+#define BURIED_AGENT_EVALUATION_H
+
+#include "buried/global_flags.h"
+#include "common/str.h"
+
+namespace Buried {
+
+class BuriedEngine;
+
+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;
+};
+
+} // End of namespace Buried
+
+#endif
diff --git a/engines/buried/buried.cpp b/engines/buried/buried.cpp
index 6b83fe126ca..b5143ca2fb8 100644
--- a/engines/buried/buried.cpp
+++ b/engines/buried/buried.cpp
@@ -37,10 +37,10 @@
#include "graphics/wincursor.h"
#include "gui/message.h"
+#include "buried/agent_evaluation.h"
#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"
diff --git a/engines/buried/complete.cpp b/engines/buried/complete.cpp
index e8f37b22760..221e645899e 100644
--- a/engines/buried/complete.cpp
+++ b/engines/buried/complete.cpp
@@ -22,6 +22,7 @@
*
*/
+#include "buried/agent_evaluation.h"
#include "buried/biochip_right.h"
#include "buried/buried.h"
#include "buried/complete.h"
@@ -36,23 +37,8 @@
namespace Buried {
-#define CHECK_PUZZLE_FLAG(flag) \
- if (_globalFlags.flag != 0) \
- puzzlesSolved++
-
-#define CHECK_RESEARCH_FLAG(flag) \
- if (_globalFlags.flag != 0) \
- researchBonusRaw++
-
-#define CHECK_CRITICAL_EVIDENCE(flag) \
- if (_globalFlags.evcapBaseID[i] == flag) \
- criticalEvidence++
-
-#define CHECK_SUPPORTING_EVIDENCE(flag) \
- if (_globalFlags.evcapBaseID[i] == flag) \
- supportingEvidence++
-
CompletionWindow::CompletionWindow(BuriedEngine *vm, Window *parent, GlobalFlags globalFlags) : Window(vm, parent), _globalFlags(globalFlags) {
+ _agentEvaluation = new AgentEvaluation(vm, globalFlags, 60);
_vm->_sound->setAmbientSound();
_status = 0;
@@ -72,102 +58,6 @@ CompletionWindow::CompletionWindow(BuriedEngine *vm, Window *parent, GlobalFlags
_walkthroughMode = _globalFlags.generalWalkthroughMode != 0;
- int puzzlesSolved = 0;
- CHECK_PUZZLE_FLAG(scoreGotTranslateBioChip);
- CHECK_PUZZLE_FLAG(scoreEnteredSpaceStation);
- CHECK_PUZZLE_FLAG(scoreDownloadedArthur);
- CHECK_PUZZLE_FLAG(scoreFoundSculptureDiagram);
- CHECK_PUZZLE_FLAG(scoreEnteredKeep);
- CHECK_PUZZLE_FLAG(scoreGotKeyFromSmithy);
- CHECK_PUZZLE_FLAG(scoreEnteredTreasureRoom);
- CHECK_PUZZLE_FLAG(scoreFoundSwordDiamond);
- CHECK_PUZZLE_FLAG(scoreMadeSiegeCycle);
- CHECK_PUZZLE_FLAG(scoreEnteredCodexTower);
- CHECK_PUZZLE_FLAG(scoreLoggedCodexEvidence);
- CHECK_PUZZLE_FLAG(scoreEnteredMainCavern);
- CHECK_PUZZLE_FLAG(scoreGotWealthGodPiece);
- CHECK_PUZZLE_FLAG(scoreGotRainGodPiece);
- CHECK_PUZZLE_FLAG(scoreGotWarGodPiece);
- CHECK_PUZZLE_FLAG(scoreCompletedDeathGod);
- CHECK_PUZZLE_FLAG(scoreEliminatedAgent3);
- CHECK_PUZZLE_FLAG(scoreTransportToKrynn);
- CHECK_PUZZLE_FLAG(scoreGotKrynnArtifacts);
- CHECK_PUZZLE_FLAG(scoreDefeatedIcarus);
-
- int researchBonusRaw = 0;
- CHECK_RESEARCH_FLAG(scoreResearchINNLouvreReport); // > v1.01
- CHECK_RESEARCH_FLAG(scoreResearchINNHighBidder);
- CHECK_RESEARCH_FLAG(scoreResearchINNAppeal);
- CHECK_RESEARCH_FLAG(scoreResearchINNUpdate);
- CHECK_RESEARCH_FLAG(scoreResearchINNJumpsuit);
- CHECK_RESEARCH_FLAG(scoreResearchBCJumpsuit);
- CHECK_RESEARCH_FLAG(scoreResearchMichelle);
- CHECK_RESEARCH_FLAG(scoreResearchMichelleBkg);
- CHECK_RESEARCH_FLAG(scoreResearchLensFilter);
- CHECK_RESEARCH_FLAG(scoreResearchCastleFootprint);
- CHECK_RESEARCH_FLAG(scoreResearchDaVinciFootprint);
- CHECK_RESEARCH_FLAG(scoreResearchMorphSculpture);
- CHECK_RESEARCH_FLAG(scoreResearchEnvironCart);
- CHECK_RESEARCH_FLAG(scoreResearchAgent3Note);
- CHECK_RESEARCH_FLAG(scoreResearchAgent3DaVinci);
-
- int criticalEvidence = 0;
- int supportingEvidence = 0;
- for (int i = 0; i < _globalFlags.evcapNumCaptured; i++) {
- CHECK_CRITICAL_EVIDENCE(CASTLE_EVIDENCE_SWORD);
- CHECK_CRITICAL_EVIDENCE(MAYAN_EVIDENCE_ENVIRON_CART);
- CHECK_CRITICAL_EVIDENCE(DAVINCI_EVIDENCE_CODEX);
- CHECK_CRITICAL_EVIDENCE(AI_EVIDENCE_SCULPTURE);
-
- CHECK_SUPPORTING_EVIDENCE(CASTLE_EVIDENCE_FOOTPRINT);
- CHECK_SUPPORTING_EVIDENCE(MAYAN_EVIDENCE_BROKEN_GLASS_PYRAMID);
- CHECK_SUPPORTING_EVIDENCE(MAYAN_EVIDENCE_PHONY_BLOOD);
- CHECK_SUPPORTING_EVIDENCE(CASTLE_EVIDENCE_AGENT3);
- CHECK_SUPPORTING_EVIDENCE(DAVINCI_EVIDENCE_FOOTPRINT);
- CHECK_SUPPORTING_EVIDENCE(DAVINCI_EVIDENCE_AGENT3);
- CHECK_SUPPORTING_EVIDENCE(DAVINCI_EVIDENCE_LENS_FILTER);
- }
-
- int hints = _globalFlags.scoreHintsTotal;
- int finalCriticalEvidenceScore = criticalEvidence * 1000;
- int finalSupportingEvidenceScore = supportingEvidence * 500;
- int finalPuzzleScore = puzzlesSolved * 200;
- int finalResearchScore = researchBonusRaw * 100;
- int hintsScore = hints * 50;
- int completionScore = 2000;
- int totalScore = finalCriticalEvidenceScore + finalSupportingEvidenceScore + finalPuzzleScore + finalResearchScore + completionScore;
-
- // Build the string buffers
- // Newer versions include these strings as resources in the main executable.
- // For earlier versions, we hardcode them here.
- if (_walkthroughMode) {
- if (_vm->getVersion() >= MAKEVERSION(1, 0, 4, 0)) {
- Common::String stringResource = _vm->getString(IDS_COMPL_WALK_SCORE_DESC_TEMPL);
- _scoringTextDescriptions = Common::String::format(stringResource.c_str(), criticalEvidence, supportingEvidence, puzzlesSolved, researchBonusRaw);
- stringResource = _vm->getString(IDS_COMPL_WALK_SCORE_AMT_TEMPL);
- _scoringTextScores = Common::String::format(stringResource.c_str(), 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\nCompletion Bonus:",
- criticalEvidence, supportingEvidence, puzzlesSolved, researchBonusRaw);
- _scoringTextScores = Common::String::format("%d\n%d\n%d\n%d\n%d", finalCriticalEvidenceScore, finalSupportingEvidenceScore, finalPuzzleScore, finalResearchScore, completionScore);
- }
- } else {
- totalScore -= hintsScore;
-
- if (_vm->getVersion() >= MAKEVERSION(1, 0, 4, 0)) {
- Common::String stringResource = _vm->getString(IDS_COMPL_SCORE_DESC_TEMPL);
- _scoringTextDescriptions = Common::String::format(stringResource.c_str(), criticalEvidence, supportingEvidence, puzzlesSolved, researchBonusRaw, hints);
- stringResource = _vm->getString(IDS_COMPL_SCORE_AMT_TEMPL);
- _scoringTextScores = Common::String::format(stringResource.c_str(), 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\nCompletion Bonus:\n\nHints: %d @ -50 ea.",
- 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);
- }
- }
-
- _scoringTextFinalScore = Common::String::format("%d", totalScore);
-
_vm->_sound->setAmbientSound();
}
@@ -180,6 +70,7 @@ CompletionWindow::~CompletionWindow() {
delete _gageVideo;
killTimer(_timer);
+ delete _agentEvaluation;
delete _textFontA;
delete _textFontB;
@@ -207,15 +98,15 @@ void CompletionWindow::onPaint() {
// Description text
Common::Rect scoringTextRect(10, 248, 283, 378);
- _vm->_gfx->renderText(_vm->_gfx->getScreen(), _textFontA, _scoringTextDescriptions, scoringTextRect.left, scoringTextRect.top, scoringTextRect.width(), scoringTextRect.height(), textColor, _fontHeightA);
+ _vm->_gfx->renderText(_vm->_gfx->getScreen(), _textFontA, _agentEvaluation->_scoringTextDescriptions, scoringTextRect.left, scoringTextRect.top, scoringTextRect.width(), scoringTextRect.height(), textColor, _fontHeightA);
// Scores
textColor = _vm->_gfx->getColor(255, 255, 51);
- _vm->_gfx->renderText(_vm->_gfx->getScreen(), _textFontA, _scoringTextScores, scoringTextRect.left, scoringTextRect.top, scoringTextRect.width(), scoringTextRect.height(), textColor, _fontHeightA, kTextAlignRight);
+ _vm->_gfx->renderText(_vm->_gfx->getScreen(), _textFontA, _agentEvaluation->_scoringTextScores, scoringTextRect.left, scoringTextRect.top, scoringTextRect.width(), scoringTextRect.height(), textColor, _fontHeightA, kTextAlignRight);
// Total score
Common::Rect finalScoreRect(122, 386, 283, 401);
- _vm->_gfx->renderText(_vm->_gfx->getScreen(), _textFontB, _scoringTextFinalScore, finalScoreRect.left, finalScoreRect.top, finalScoreRect.width(), finalScoreRect.height(), textColor, _fontHeightB, kTextAlignRight);
+ _vm->_gfx->renderText(_vm->_gfx->getScreen(), _textFontB, _agentEvaluation->_scoringTextFinalScore, finalScoreRect.left, finalScoreRect.top, finalScoreRect.width(), finalScoreRect.height(), textColor, _fontHeightB, kTextAlignRight);
}
}
diff --git a/engines/buried/complete.h b/engines/buried/complete.h
index ae49492d61f..1a770624495 100644
--- a/engines/buried/complete.h
+++ b/engines/buried/complete.h
@@ -36,6 +36,7 @@ struct Surface;
namespace Buried {
class VideoWindow;
+class AgentEvaluation;
class CompletionWindow : public Window {
public:
@@ -58,10 +59,7 @@ private:
Graphics::Font *_textFontB;
int _fontHeightA, _fontHeightB;
bool _walkthroughMode;
-
- Common::String _scoringTextDescriptions;
- Common::String _scoringTextScores;
- Common::String _scoringTextFinalScore;
+ AgentEvaluation *_agentEvaluation;
VideoWindow *_gageVideo;
};
diff --git a/engines/buried/death.cpp b/engines/buried/death.cpp
index e0c48fbc59d..ed616fe65ac 100644
--- a/engines/buried/death.cpp
+++ b/engines/buried/death.cpp
@@ -22,6 +22,7 @@
*
*/
+#include "buried/agent_evaluation.h"
#include "buried/avi_frames.h"
#include "buried/biochip_right.h"
#include "buried/buried.h"
@@ -39,153 +40,6 @@
namespace Buried {
-#define CHECK_PUZZLE_FLAG(flag) \
- if (_globalFlags.flag != 0) \
- puzzlesSolved++
-
-#define CHECK_RESEARCH_FLAG(flag) \
- if (_globalFlags.flag != 0) \
- researchBonusRaw++
-
-#define CHECK_CRITICAL_EVIDENCE(flag) \
- if (_globalFlags.evcapBaseID[i] == flag) \
- criticalEvidence++
-
-#define CHECK_SUPPORTING_EVIDENCE(flag) \
- if (_globalFlags.evcapBaseID[i] == flag) \
- supportingEvidence++
-
-AgentEvaluation::AgentEvaluation(BuriedEngine *vm, GlobalFlags &globalFlags, int deathSceneIndex) :
- _globalFlags(globalFlags) {
-
- int puzzlesSolved = 0;
- CHECK_PUZZLE_FLAG(scoreGotTranslateBioChip);
- CHECK_PUZZLE_FLAG(scoreEnteredSpaceStation);
- CHECK_PUZZLE_FLAG(scoreDownloadedArthur);
- CHECK_PUZZLE_FLAG(scoreFoundSculptureDiagram);
- CHECK_PUZZLE_FLAG(scoreEnteredKeep);
- CHECK_PUZZLE_FLAG(scoreGotKeyFromSmithy);
- CHECK_PUZZLE_FLAG(scoreEnteredTreasureRoom);
- CHECK_PUZZLE_FLAG(scoreFoundSwordDiamond);
- CHECK_PUZZLE_FLAG(scoreMadeSiegeCycle);
- CHECK_PUZZLE_FLAG(scoreEnteredCodexTower);
- CHECK_PUZZLE_FLAG(scoreLoggedCodexEvidence);
- CHECK_PUZZLE_FLAG(scoreEnteredMainCavern);
- CHECK_PUZZLE_FLAG(scoreGotWealthGodPiece);
- CHECK_PUZZLE_FLAG(scoreGotRainGodPiece);
- CHECK_PUZZLE_FLAG(scoreGotWarGodPiece);
- CHECK_PUZZLE_FLAG(scoreCompletedDeathGod);
- CHECK_PUZZLE_FLAG(scoreEliminatedAgent3);
- CHECK_PUZZLE_FLAG(scoreTransportToKrynn);
- CHECK_PUZZLE_FLAG(scoreGotKrynnArtifacts);
- CHECK_PUZZLE_FLAG(scoreDefeatedIcarus);
-
- int researchBonusRaw = 0;
- CHECK_RESEARCH_FLAG(scoreResearchINNLouvreReport); // > v1.01
- CHECK_RESEARCH_FLAG(scoreResearchINNHighBidder);
- CHECK_RESEARCH_FLAG(scoreResearchINNAppeal);
- CHECK_RESEARCH_FLAG(scoreResearchINNUpdate);
- CHECK_RESEARCH_FLAG(scoreResearchINNJumpsuit);
- CHECK_RESEARCH_FLAG(scoreResearchBCJumpsuit);
- CHECK_RESEARCH_FLAG(scoreResearchMichelle);
- CHECK_RESEARCH_FLAG(scoreResearchMichelleBkg);
- CHECK_RESEARCH_FLAG(scoreResearchLensFilter);
- CHECK_RESEARCH_FLAG(scoreResearchCastleFootprint);
- CHECK_RESEARCH_FLAG(scoreResearchDaVinciFootprint);
- CHECK_RESEARCH_FLAG(scoreResearchMorphSculpture);
- CHECK_RESEARCH_FLAG(scoreResearchEnvironCart);
- CHECK_RESEARCH_FLAG(scoreResearchAgent3Note);
- CHECK_RESEARCH_FLAG(scoreResearchAgent3DaVinci);
-
- int criticalEvidence = 0;
- int supportingEvidence = 0;
- for (int i = 0; i < _globalFlags.evcapNumCaptured; i++) {
- CHECK_CRITICAL_EVIDENCE(CASTLE_EVIDENCE_SWORD);
- CHECK_CRITICAL_EVIDENCE(MAYAN_EVIDENCE_ENVIRON_CART);
- CHECK_CRITICAL_EVIDENCE(DAVINCI_EVIDENCE_CODEX);
- CHECK_CRITICAL_EVIDENCE(AI_EVIDENCE_SCULPTURE);
-
- CHECK_SUPPORTING_EVIDENCE(CASTLE_EVIDENCE_FOOTPRINT);
- CHECK_SUPPORTING_EVIDENCE(MAYAN_EVIDENCE_BROKEN_GLASS_PYRAMID);
- CHECK_SUPPORTING_EVIDENCE(MAYAN_EVIDENCE_PHONY_BLOOD);
- CHECK_SUPPORTING_EVIDENCE(CASTLE_EVIDENCE_AGENT3);
- CHECK_SUPPORTING_EVIDENCE(DAVINCI_EVIDENCE_FOOTPRINT);
- CHECK_SUPPORTING_EVIDENCE(DAVINCI_EVIDENCE_AGENT3);
- CHECK_SUPPORTING_EVIDENCE(DAVINCI_EVIDENCE_LENS_FILTER);
- }
-
- int hints = _globalFlags.scoreHintsTotal;
- int finalCriticalEvidenceScore = criticalEvidence * 1000;
- int finalSupportingEvidenceScore = supportingEvidence * 500;
- int finalPuzzleScore = puzzlesSolved * 200;
- int finalResearchScore = researchBonusRaw * 100;
- int hintsScore = hints * 50;
- int completionScore = (deathSceneIndex == 60) ? 2000 : 0;
- int totalScore = finalCriticalEvidenceScore + finalSupportingEvidenceScore + finalPuzzleScore + finalResearchScore + completionScore;
-
- // Build the string buffers
- // Newer versions include these strings as resources in the main executable.
- // For earlier versions, we hardcode them here.
- if (_globalFlags.generalWalkthroughMode != 0) {
- if (vm->getVersion() >= MAKEVERSION(1, 0, 4, 0)) {
- 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);
- _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);
- _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);
- _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)) {
- 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);
- _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);
- _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);
- _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);
- }
-
- _scoringTextFinalScore = Common::String::format("%d", totalScore);
-}
-
-#undef CHECK_PUZZLE_FLAG
-#undef CHECK_RESEARCH_FLAG
-#undef CHECK_CRITICAL_EVIDENCE
-#undef CHECK_SUPPORTING_EVIDENCE
-
enum {
BUTTON_QUIT = 1,
BUTTON_RESTORE_GAME = 2,
diff --git a/engines/buried/death.h b/engines/buried/death.h
index 6b8fd887d52..87e86813581 100644
--- a/engines/buried/death.h
+++ b/engines/buried/death.h
@@ -36,19 +36,7 @@ struct Surface;
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 AgentEvaluation;
class DeathWindow : public Window {
public:
diff --git a/engines/buried/module.mk b/engines/buried/module.mk
index 5e004ab62b6..79d066dcc51 100644
--- a/engines/buried/module.mk
+++ b/engines/buried/module.mk
@@ -1,6 +1,7 @@
MODULE := engines/buried
MODULE_OBJS = \
+ agent_evaluation.o \
avi_frames.o \
biochip_right.o \
biochip_view.o \
More information about the Scummvm-git-logs
mailing list