MM: MM1: Support alt map strings in enhanced mode

This commit is contained in:
Paul Gilbert 2023-02-24 21:36:57 -08:00
parent d895f5c509
commit 63625e14f0
3 changed files with 17 additions and 5 deletions

View File

@ -1292,7 +1292,7 @@ maps:
levitation1: "Luckily,your levitation spell saved you!"
levitation2: "Levitation saved you."
remains: "Smashed remains of stone statues\nseem suspiciously lifelike."
map13e:
emap13:
levitation1: "Luckily, your levitation spell saved you!"
map14:

View File

@ -22,6 +22,7 @@
#include "engines/engine.h"
#include "graphics/fonts/ttf.h"
#include "mm/mm1/globals.h"
#include "mm/mm1/mm1.h"
#include "mm/shared/utils/engine_data.h"
#include "graphics/fontman.h"
@ -95,6 +96,20 @@ bool Globals::load(bool isEnhanced) {
return true;
}
const Common::String &Globals::operator[](const Common::String &name) {
if (g_engine->isEnhanced() && name.hasPrefix("maps.map")) {
// Map strings support having alternate versions in Enhanced version
Common::String altName = Common::String::format("maps.emap%s",
name.c_str() + 8);
if (_strings.contains(altName))
return _strings[altName];
}
assert(_strings.contains(name));
return _strings[name];
}
void Globals::synchronize(Common::Serializer &s) {
s.syncAsByte(_startingTown);

View File

@ -85,10 +85,7 @@ public:
/**
* Returns a string
*/
const Common::String &operator[](const Common::String &name) {
assert(_strings.contains(name));
return _strings[name];
}
const Common::String &operator[](const Common::String &name);
/**
* Saves global data to/from savegames