From ffd370d4cffd68bbfce0de8466eb84fd697f2395 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 4 Dec 2022 18:38:17 -0800 Subject: [PATCH] MM: MM1: More map fixes --- devtools/create_mm/files/mm1/strings_en.yml | 2 +- engines/mm/mm1/maps/map14.cpp | 10 +++--- engines/mm/mm1/maps/map15.cpp | 37 +++++++++++++++------ engines/mm/mm1/maps/map16.cpp | 16 +++++---- engines/mm/mm1/maps/map17.cpp | 37 ++++++++++++--------- 5 files changed, 64 insertions(+), 38 deletions(-) diff --git a/devtools/create_mm/files/mm1/strings_en.yml b/devtools/create_mm/files/mm1/strings_en.yml index 6ffcaf1b00c..60ce2fd8288 100644 --- a/devtools/create_mm/files/mm1/strings_en.yml +++ b/devtools/create_mm/files/mm1/strings_en.yml @@ -1193,7 +1193,7 @@ maps: map17: options: "1) RED THORAC 2) BLUE OGRAM\n3) GREEN BAGAR 4) YELLOW LIMRA\n5) PURPLE SAGRAN 6) ORANGE OOLAK\n7) BLACK DRESIDION 8) WHITE DILITHIUM" bridge: "A WOODEN BRIDGE EXTENDES ACROSS THE\nOCEAN INTO THE MIST. A HOODED FIGURE\nMATERIALIZES, ""TO CROSS YOU MUST EACH\nANSWER A QUESTION, ACCEPT (Y/N)?""" - color: "WHAT IS YOUR COLOR(1-8)?" + color: "WHAT IS YOUR COLOR (1-8)?" wrong: "WRONG!" correct: "CORRECT!" islands: "ATOP THIS PEAK 5 ISLANDS CAN BE SEEN\nTO THE SOUTHEAST" diff --git a/engines/mm/mm1/maps/map14.cpp b/engines/mm/mm1/maps/map14.cpp index 26ba95c944d..20da662eb56 100644 --- a/engines/mm/mm1/maps/map14.cpp +++ b/engines/mm/mm1/maps/map14.cpp @@ -88,7 +88,7 @@ void Map14::special00() { ks.keycode == Common::KEYCODE_n) { g_events->close(); - // TODO: The original seems to be backwards + // Note: The original seems to be backwards if (ks.keycode == Common::KEYCODE_n && getRandomNumber(3) == 3) { g_maps->_mapPos = Common::Point(15, 10); @@ -122,7 +122,7 @@ void Map14::special02() { } else if (_data[VAL3]) { _data[VAL3] = 0; } else { - g_events->findView("View")->redraw(); + send("View", DrawGraphicMessage(65 + 6)); send(SoundMessage( STRING["maps.map14.castle"], @@ -130,10 +130,12 @@ void Map14::special02() { Map14 &map = *static_cast(g_maps->_currentMap); if (ks.keycode == Common::KEYCODE_y) { g_events->close(); - map[VAL3]++; + map[VAL3] = 0xff; + map.updateGame(); } else if (ks.keycode == Common::KEYCODE_n) { g_events->close(); - map[VAL3] = 0xff; + map[VAL3]++; + map.updateGame(); } } )); diff --git a/engines/mm/mm1/maps/map15.cpp b/engines/mm/mm1/maps/map15.cpp index 8decba12a8c..6b9fe759305 100644 --- a/engines/mm/mm1/maps/map15.cpp +++ b/engines/mm/mm1/maps/map15.cpp @@ -31,7 +31,7 @@ namespace Maps { #define VAL1 350 #define VAL2 118 -#define VAL3 361 +#define ITEM_ID 361 #define GEMS 362 void Map15::special() { @@ -104,9 +104,15 @@ void Map15::special01() { Game::Encounter &enc = g_globals->_encounters; if (_data[VAL2]) { - send(SoundMessage(STRING["maps.map15.dragon"])); - g_globals->_treasure._items[2] = 244; - g_events->addAction(KEYBIND_SEARCH); + SoundMessage msg( + STRING["maps.map15.body"], + []() { + g_globals->_treasure._items[2] = DRAGONS_TOOTH_ID; + g_events->addAction(KEYBIND_SEARCH); + } + ); + msg._delaySeconds = 5; + send(msg); } else { _data[VAL2]++; @@ -148,13 +154,13 @@ void Map15::special03() { } void Map15::special04() { - _data[VAL3] = 250; + _data[ITEM_ID] = PIRATES_MAP_A_ID; _data[GEMS] = 100; cove(); } void Map15::special05() { - _data[VAL3] = 251; + _data[ITEM_ID] = PIRATES_MAP_B_ID; _data[GEMS] = 200; cove(); } @@ -165,12 +171,21 @@ void Map15::special06() { [](const Common::KeyState &ks) { if (ks.keycode == Common::KEYCODE_y) { g_events->close(); - g_globals->_treasure._items[2] = 233; + g_globals->_treasure._items[2] = KINGS_PASS_ID; g_events->addAction(KEYBIND_SEARCH); + } else if (ks.keycode == Common::KEYCODE_n) { - g_events->send(SoundMessage(STRING["maps.map15.percella1"])); - g_maps->_mapPos = Common::Point(14, 2); - updateGame(); + g_events->close(); + + SoundMessage msg( + STRING["maps.map15.percella2"], + []() { + g_maps->_mapPos = Common::Point(14, 2); + updateGame(); + } + ); + msg._delaySeconds = 5; + g_events->send(msg); } } )); @@ -189,7 +204,7 @@ void Map15::cove() { for (uint i = 0; i < g_globals->_party.size(); ++i) { Character &c = g_globals->_party[i]; - int idx = c._backpack.indexOf(map[VAL3]); + int idx = c._backpack.indexOf(map[ITEM_ID]); if (idx != -1) { c._backpack.removeAt(idx); g_globals->_treasure.setGold(2000); diff --git a/engines/mm/mm1/maps/map16.cpp b/engines/mm/mm1/maps/map16.cpp index 4affe5f80f5..46278d0c4c0 100644 --- a/engines/mm/mm1/maps/map16.cpp +++ b/engines/mm/mm1/maps/map16.cpp @@ -94,8 +94,8 @@ void Map16::special00() { } _data[VAL1]++; - send(SoundMessage(STRING["maps.map16.water"], - [](const Common::KeyState &ks) { + SoundMessage msg(STRING["maps.map16.water"], + []() { Game::Encounter &enc = g_globals->_encounters; enc.clearMonsters(); @@ -107,15 +107,17 @@ void Map16::special00() { enc._flag = true; enc.execute(); } - )); + ); + msg._delaySeconds = 5; + send(msg); } } void Map16::special01() { send(SoundMessage(STRING["maps.map16.wheel"], []() { - // Original called sound 1 20 times. This seems excessive - Sound::sound(SOUND_1); + for (int i = 0; i < 20; ++i) + Sound::sound(SOUND_1); static_cast(g_maps->_currentMap)->wheelSpin(); } @@ -124,7 +126,7 @@ void Map16::special01() { void Map16::special02() { _data[VAL1] = 0; - g_events->addAction(KEYBIND_SEARCH); + none160(); } void Map16::special03() { @@ -191,7 +193,7 @@ void Map16::wheelSpin() { } } - msg._lines.push_back(Line(0, i, line)); + msg._lines.push_back(Line(0, 1 + i, line)); } // Display the results diff --git a/engines/mm/mm1/maps/map17.cpp b/engines/mm/mm1/maps/map17.cpp index 1b698d9a0ba..8901c565836 100644 --- a/engines/mm/mm1/maps/map17.cpp +++ b/engines/mm/mm1/maps/map17.cpp @@ -30,8 +30,8 @@ namespace MM1 { namespace Maps { #define VAL1 509 -#define VAL2 510 -#define VAL3 511 +#define COLOR 510 +#define CORRECT_ANSWERS 511 void Map17::special() { Game::Encounter &enc = g_globals->_encounters; @@ -70,28 +70,31 @@ void Map17::special() { updateGame(); } else { - g_events->addAction(KEYBIND_SEARCH); + none160(); } } void Map17::special00() { - send(SoundMessage("maps.map17.islands")); + send(SoundMessage(STRING["maps.map17.islands"])); } void Map17::special01() { - send(SoundMessage(STRING["maps.map17.bridge"], + SoundMessage msg(STRING["maps.map17.bridge"], []() { static_cast(g_maps->_currentMap)->askQuestion(); } - )); + ); + + msg._largeMessage = true; + send(msg); } void Map17::special02() { - if (_data[VAL3]) { - g_globals->_treasure._items[2] = 236; + if (_data[CORRECT_ANSWERS]) { + g_globals->_treasure._items[2] = CORAL_KEY_ID; g_events->addAction(KEYBIND_SEARCH); } else { - g_events->addKeypress((Common::KeyCode)211); + none160(); } } @@ -102,7 +105,8 @@ void Map17::special03() { void Map17::askQuestion(uint partyIndex) { if (partyIndex >= g_globals->_party.size()) { - if (_data[VAL3]) { + // Entire party has answered the question + if (_data[CORRECT_ANSWERS]) { g_maps->_mapPos.y = 2; updateGame(); } else { @@ -122,16 +126,19 @@ void Map17::askQuestion(uint partyIndex) { Map17 &map = *static_cast(g_maps->_currentMap); if (ks.keycode >= Common::KEYCODE_1 && ks.keycode <= Common::KEYCODE_9) { - map[VAL2] = ks.ascii - '1'; + map[COLOR] = ks.ascii - '1'; Common::String line; Character &c = *g_globals->_currCharacter; - int val = c._flags[2] & 0xf; - if (!val || (val & 7) != map[VAL2]) { + int color = c._flags[2] & 0xf; + + // If a color hasn't been designated yet from talking to Gypsy, + // or it has but the wrong color is selected, eradicate them + if (!color || (color & 7) != map[COLOR]) { c._condition = ERADICATED; line = STRING["maps.map17.wrong"]; } else { - map[VAL3]++; + map[CORRECT_ANSWERS]++; c._flags[4] |= CHARFLAG4_80; line = STRING["maps.map17.correct"]; } @@ -142,7 +149,7 @@ void Map17::askQuestion(uint partyIndex) { msg2._delaySeconds = 1; msg2._lines.push_back(Line(0, 0, STRING["maps.map17.color"])); msg2._lines.push_back(Line(0, 2, STRING["maps.map17.options"])); - msg2._lines.push_back(Line(16, 5, line)); + msg2._lines.push_back(Line(16, 6, line)); msg2._timeoutCallback = []() { Map17 &map17 = *static_cast(g_maps->_currentMap); map17.askQuestion(map17[VAL1] + 1);