Add message preview functionality and refactor MessageEditor

- Introduced MessagePreview class to handle message rendering and preview logic.
- Updated MessageEditor to utilize MessagePreview for drawing messages and managing font graphics.
- Refactored drawing methods to improve organization and clarity, including the addition of DrawFontAtlas and DrawExpandedMessageSettings.
- Enhanced message handling by integrating new dictionary entry lookup and improved bitmap updates for message previews.
- Cleaned up unused functions and variables to streamline the codebase.
This commit is contained in:
scawful
2025-05-10 10:59:55 -04:00
parent 4b7bbfaf1c
commit b872fd9672
7 changed files with 258 additions and 230 deletions

View File

@@ -16,6 +16,7 @@ const uint8_t kMessageTerminator = 0x7F;
const std::string kBankToken = "BANK";
const std::string DICTIONARYTOKEN = "D";
constexpr uint8_t DICTOFF = 0x88;
constexpr uint8_t kWidthArraySize = 100;
static const std::unordered_map<uint8_t, wchar_t> CharEncoder = {
{0x00, 'A'}, {0x01, 'B'}, {0x02, 'C'}, {0x03, 'D'}, {0x04, 'E'},
@@ -82,6 +83,8 @@ constexpr uint8_t kLine3 = 0x76;
std::vector<DictionaryEntry> BuildDictionaryEntries(Rom *rom);
std::string ReplaceAllDictionaryWords(std::string str,
std::vector<DictionaryEntry> dictionary);
DictionaryEntry FindRealDictionaryEntry(uint8_t value,
std::vector<DictionaryEntry> dictionary);
// Inserted into commands to protect them from dictionary replacements.
const std::string CHEESE = "\uBEBE";