diff options
author | Eugene Sandulenko | 2018-12-19 00:31:45 +0100 |
---|---|---|
committer | Eugene Sandulenko | 2018-12-19 00:31:45 +0100 |
commit | 291e4cebddd5d89c67e39abb2b645b1c2350c161 (patch) | |
tree | 505da69ba39591f2510dda06d1cca54981a1c6d7 /engines | |
parent | b22524ef575d54c1f5569891f6b148e5f51e8681 (diff) | |
download | scummvm-rg350-291e4cebddd5d89c67e39abb2b645b1c2350c161.tar.gz scummvm-rg350-291e4cebddd5d89c67e39abb2b645b1c2350c161.tar.bz2 scummvm-rg350-291e4cebddd5d89c67e39abb2b645b1c2350c161.zip |
BLADERUNNER: Implemented sanity checks in the 'scene' debugger command
Diffstat (limited to 'engines')
-rw-r--r-- | engines/bladerunner/debugger.cpp | 73 |
1 files changed, 49 insertions, 24 deletions
diff --git a/engines/bladerunner/debugger.cpp b/engines/bladerunner/debugger.cpp index 902c0d79f0..f1c76ebdeb 100644 --- a/engines/bladerunner/debugger.cpp +++ b/engines/bladerunner/debugger.cpp @@ -338,29 +338,29 @@ const struct SceneList { { 1, "PS11", 14, 74 }, { 1, "PS12", 14, 75 }, { 1, "PS13", 14, 76 }, { 1, "PS14", 68, 77 }, { 1, "PS15", 101, 119 }, { 1, "RC01", 69, 78 }, { 1, "RC02", 16, 79 }, { 1, "RC51", 16, 107 }, - { 3, "AR01", 0, 0 }, { 3, "AR02", 0, 1 }, { 3, "BB01", 20, 2 }, { 3, "BB02", 1, 3 }, - { 3, "BB03", 21, 4 }, { 3, "BB04", 1, 5 }, { 3, "BB05", 22, 6 }, { 3, "BB06", 1, 7 }, - { 3, "BB06", 2, 7 }, { 3, "BB07", 2, 8 }, { 3, "BB07", 3, 8 }, { 3, "BB08", 23, 9 }, - { 3, "BB10", 25, 11 }, { 3, "BB11", 26, 12 }, { 3, "BB12", 102, 120 }, { 3, "BB51", 1, 104 }, - { 3, "CT01", 4, 13 }, { 3, "CT02", 27, 14 }, { 3, "CT03", 5, 15 }, { 3, "CT04", 5, 16 }, - { 3, "CT05", 28, 17 }, { 3, "CT06", 29, 18 }, { 3, "CT08", 6, 20 }, { 3, "CT09", 31, 21 }, - { 3, "CT10", 32, 22 }, { 3, "CT11", 33, 23 }, { 3, "CT12", 4, 24 }, { 3, "CT51", 6, 105 }, - { 3, "DR01", 7, 25 }, { 3, "DR02", 7, 26 }, { 3, "DR03", 34, 27 }, { 3, "DR04", 7, 28 }, - { 3, "DR05", 35, 29 }, { 3, "DR06", 36, 30 }, { 3, "HC01", 8, 31 }, { 3, "HC02", 8, 32 }, - { 3, "HC03", 8, 33 }, { 3, "HC04", 8, 106 }, { 3, "HF01", 37, 34 }, { 3, "HF02", 38, 35 }, - { 3, "HF03", 39, 36 }, { 3, "HF04", 40, 37 }, { 3, "HF05", 41, 38 }, { 3, "HF06", 42, 39 }, - { 3, "MA01", 49, 48 }, { 3, "MA02", 10, 49 }, { 3, "MA04", 10, 50 }, { 3, "MA04", 50, 50 }, - { 3, "MA05", 51, 51 }, { 3, "MA06", 52, 52 }, { 3, "MA07", 53, 53 }, { 3, "NR01", 54, 54 }, - { 3, "NR02", 11, 55 }, { 3, "NR03", 55, 56 }, { 3, "NR04", 12, 57 }, { 3, "NR05", 13, 58 }, - { 3, "NR06", 56, 59 }, { 3, "NR07", 57, 60 }, { 3, "NR08", 13, 61 }, { 3, "NR09", 58, 62 }, - { 3, "NR10", 59, 63 }, { 3, "NR11", 60, 64 }, { 3, "PS01", 61, 65 }, { 3, "PS02", 62, 66 }, - { 3, "PS03", 63, 67 }, { 3, "PS04", 64, 68 }, { 3, "PS05", 15, 59 }, { 3, "PS06", 65, 70 }, - { 3, "PS07", 66, 71 }, { 3, "PS09", 67, 72 }, { 3, "PS10", 14, 73 }, { 3, "PS11", 14, 74 }, - { 3, "PS12", 14, 75 }, { 3, "PS13", 14, 76 }, { 3, "PS14", 68, 77 }, { 3, "PS15", 101, 119 }, - { 3, "RC01", 69, 78 }, { 3, "RC03", 70, 80 }, { 3, "RC04", 71, 81 }, { 3, "TB02", 17, 82 }, - { 3, "TB05", 72, 84 }, { 3, "TB06", 73, 85 }, { 3, "TB07", 18, 108 }, { 3, "UG01", 74, 86 }, - { 3, "UG02", 75, 87 }, { 3, "UG03", 76, 88 }, { 3, "UG04", 77, 89 }, { 3, "UG06", 79, 91 }, - { 3, "UG10", 83, 95 }, + { 2, "AR01", 0, 0 }, { 2, "AR02", 0, 1 }, { 2, "BB01", 20, 2 }, { 2, "BB02", 1, 3 }, + { 2, "BB03", 21, 4 }, { 2, "BB04", 1, 5 }, { 2, "BB05", 22, 6 }, { 2, "BB06", 1, 7 }, + { 2, "BB06", 2, 7 }, { 2, "BB07", 2, 8 }, { 2, "BB07", 3, 8 }, { 2, "BB08", 23, 9 }, + { 2, "BB10", 25, 11 }, { 2, "BB11", 26, 12 }, { 2, "BB12", 102, 120 }, { 2, "BB51", 1, 104 }, + { 2, "CT01", 4, 13 }, { 2, "CT02", 27, 14 }, { 2, "CT03", 5, 15 }, { 2, "CT04", 5, 16 }, + { 2, "CT05", 28, 17 }, { 2, "CT06", 29, 18 }, { 2, "CT08", 6, 20 }, { 2, "CT09", 31, 21 }, + { 2, "CT10", 32, 22 }, { 2, "CT11", 33, 23 }, { 2, "CT12", 4, 24 }, { 2, "CT51", 6, 105 }, + { 2, "DR01", 7, 25 }, { 2, "DR02", 7, 26 }, { 2, "DR03", 34, 27 }, { 2, "DR04", 7, 28 }, + { 2, "DR05", 35, 29 }, { 2, "DR06", 36, 30 }, { 2, "HC01", 8, 31 }, { 2, "HC02", 8, 32 }, + { 2, "HC03", 8, 33 }, { 2, "HC04", 8, 106 }, { 2, "HF01", 37, 34 }, { 2, "HF02", 38, 35 }, + { 2, "HF03", 39, 36 }, { 2, "HF04", 40, 37 }, { 2, "HF05", 41, 38 }, { 2, "HF06", 42, 39 }, + { 2, "MA01", 49, 48 }, { 2, "MA02", 10, 49 }, { 2, "MA04", 10, 50 }, { 2, "MA04", 50, 50 }, + { 2, "MA05", 51, 51 }, { 2, "MA06", 52, 52 }, { 2, "MA07", 53, 53 }, { 2, "NR01", 54, 54 }, + { 2, "NR02", 11, 55 }, { 2, "NR03", 55, 56 }, { 2, "NR04", 12, 57 }, { 2, "NR05", 13, 58 }, + { 2, "NR06", 56, 59 }, { 2, "NR07", 57, 60 }, { 2, "NR08", 13, 61 }, { 2, "NR09", 58, 62 }, + { 2, "NR10", 59, 63 }, { 2, "NR11", 60, 64 }, { 2, "PS01", 61, 65 }, { 2, "PS02", 62, 66 }, + { 2, "PS03", 63, 67 }, { 2, "PS04", 64, 68 }, { 2, "PS05", 15, 59 }, { 2, "PS06", 65, 70 }, + { 2, "PS07", 66, 71 }, { 2, "PS09", 67, 72 }, { 2, "PS10", 14, 73 }, { 2, "PS11", 14, 74 }, + { 2, "PS12", 14, 75 }, { 2, "PS13", 14, 76 }, { 2, "PS14", 68, 77 }, { 2, "PS15", 101, 119 }, + { 2, "RC01", 69, 78 }, { 2, "RC03", 70, 80 }, { 2, "RC04", 71, 81 }, { 2, "TB02", 17, 82 }, + { 2, "TB05", 72, 84 }, { 2, "TB06", 73, 85 }, { 2, "TB07", 18, 108 }, { 2, "UG01", 74, 86 }, + { 2, "UG02", 75, 87 }, { 2, "UG03", 76, 88 }, { 2, "UG04", 77, 89 }, { 2, "UG06", 79, 91 }, + { 2, "UG10", 83, 95 }, { 4, "AR01", 0, 0 }, { 4, "AR02", 0, 1 }, { 4, "BB01", 20, 2 }, { 4, "BB02", 1, 3 }, { 4, "BB03", 21, 4 }, { 4, "BB04", 1, 5 }, { 4, "BB51", 1, 104 }, { 4, "CT01", 4, 13 }, @@ -399,21 +399,46 @@ bool Debugger::cmdScene(int argc, const char **argv) { if (argc == 3 && Common::isDigit(*argv[1]) && Common::isDigit(*argv[2])) { int setId = atoi(argv[1]); int sceneId = atoi(argv[2]); + // Sanity check + uint i; + for (i = 0; sceneList[i].chapter != 0; i++) { + if (sceneList[i].chapter == _vm->_settings->getChapter() && sceneList[i].set == setId + && sceneList[i].scene == sceneId) + break; + } + + if (sceneList[i].chapter == 0) { // end of list + debugPrintf("Scene does not exist in this chapter.\n"); + return true; + } + _vm->_settings->setNewSetAndScene(setId, sceneId); return false; } else if (argc > 1) { - int chapterId; + int chapterId = 0; Common::String sceneName; // <chapterId> <sceneName> if (argc == 3) { chapterId = atoi(argv[1]); + + if (chapterId < 1 || chapterId > 5) { + debugPrintf("Chapter must be between 1 and 5\n"); + return true; + } + sceneName = argv[2]; } else if (argc == 2) { // <sceneName> chapterId = _vm->_settings->getChapter(); sceneName = argv[1]; } + int chapterIdNormalized = chapterId; + + if (chapterId == 3 || chapterId == 5) { + chapterIdNormalized = chapterId - 1; + } + uint i; for (i = 0; sceneList[i].chapter != 0; i++) { if (sceneList[i].chapter == chapterId && sceneName.equalsIgnoreCase(sceneList[i].name)) |