[Scummvm-git-logs] scummvm master -> 6d4fda9c36c5ef1043a27047d074c52dd7cde533
lephilousophe
noreply at scummvm.org
Fri Jan 2 19:20:08 UTC 2026
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .
Summary:
6d4fda9c36 M4: Fix spanish text rendering
Commit: 6d4fda9c36c5ef1043a27047d074c52dd7cde533
https://github.com/scummvm/scummvm/commit/6d4fda9c36c5ef1043a27047d074c52dd7cde533
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2026-01-02T20:19:16+01:00
Commit Message:
M4: Fix spanish text rendering
An ASCII converter is put in place for this release.
Changed paths:
engines/m4/riddle/vars.cpp
engines/m4/riddle/vars.h
diff --git a/engines/m4/riddle/vars.cpp b/engines/m4/riddle/vars.cpp
index e011a5976d3..90bd2a34022 100644
--- a/engines/m4/riddle/vars.cpp
+++ b/engines/m4/riddle/vars.cpp
@@ -24,12 +24,55 @@
#include "m4/riddle/inventory.h"
#include "m4/gui/gui_sys.h"
#include "m4/platform/keys.h"
+#include "m4/m4.h"
namespace M4 {
namespace Riddle {
Vars *g_vars;
+/**
+ * Structure for accented character replacement
+ */
+struct ConverterEntry {
+ const char *_find;
+ byte _replace;
+};
+static const ConverterEntry SPANISH_ASCII_CONVERTERS[] = {
+ { "\xc7", 1 },
+ { "\xfc", 2 },
+ { "\xe9", 3 },
+ { "\xe2", 4 },
+ { "\xe4", 5 },
+ { "\xe0", 6 },
+ { "\xe7", 0x0C },
+ { "\xea", 0x0D },
+ { "\xeb", 0x0E },
+ { "\xe8", 0x0F },
+ { "\xef", 0x69 },
+ { "\xee", 0x25 },
+ { "\xec", 0x12 },
+ { "\xc1", 0x23 },
+ { "\xc9", 0x14 },
+ { "\xf4", 0x15 },
+ { "\xf6", 0x16 },
+ { "\xf2", 0x17 },
+ { "\xfb", 0x18 },
+ { "\xf9", 0x19 },
+ { "\xcd", 0x3C },
+ { "\xd3", 0x3E },
+ { "\xda", 0x1C },
+ { "\xe1", 0x1D },
+ { "\xed", 0x1E },
+ { "\xf3", 0x1F },
+ { "\xfa", 0x40 },
+ { "\xf1", 0x5F },
+ { "\xd1", 0x7E },
+ { "\xbf", 0x7C },
+ { "\xa1", 0x7F },
+ { nullptr, 0 }
+};
+
Vars::Vars() {
g_vars = this;
@@ -60,6 +103,10 @@ void Vars::main_cold_data_init() {
initMouseSeries("cursor", nullptr);
conv_set_default_text_colour(7, 8);
+
+ if (g_engine->getLanguage() == Common::ES_ESP) {
+ _custom_ascii_converter = spanish_ascii_converter_proc;
+ }
}
void Vars::global_menu_system_init() {
@@ -85,5 +132,14 @@ void Vars::initialize_game() {
_G(flags)[V292] = 1;
}
+void Vars::spanish_ascii_converter_proc(char *string) {
+ char *str;
+
+ for (const auto *entry = SPANISH_ASCII_CONVERTERS; entry->_find; entry++) {
+ while ((str = strstr(string, entry->_find)) != nullptr)
+ *str = entry->_replace;
+ }
+}
+
} // namespace Riddle
} // namespace M4
diff --git a/engines/m4/riddle/vars.h b/engines/m4/riddle/vars.h
index 8f0d0a1e5be..568e49dbda5 100644
--- a/engines/m4/riddle/vars.h
+++ b/engines/m4/riddle/vars.h
@@ -41,6 +41,9 @@ enum global_triggers {
};
class Vars : public M4::Vars {
+private:
+ static void spanish_ascii_converter_proc(char *string);
+
protected:
void main_cold_data_init() override;
More information about the Scummvm-git-logs
mailing list