storm-engine icon indicating copy to clipboard operation
storm-engine copied to clipboard

Add new LegacyDialog entity

Open Hammie opened this issue 1 year ago • 3 comments

Adds a LegacyDialog entity that implements the old Seadogs 2 dialog system for use in New Horizons.

Does not yet include pagination or mood settings for the head animation.

Also includes https://github.com/storm-devs/storm-engine/pull/383

Hammie avatar Jul 21 '22 15:07 Hammie

@Hammie sorry, but clang is more strict. If you create td::vector<LinkEntry> formattedLinks_; then you need to emplace_back only LinkEntry. I fixed problem, builded on Linux and tested a bit. Works fine, thanks! https://github.com/storm-devs/storm-engine/pull/385/commits/2ff2085dfa50b6dbc245504482abb16bb938d3d1

             for (const auto &text : link_texts)
             {
-                formattedLinks_.emplace_back(text, static_cast<int32_t>(i));
+                formattedLinks_.emplace_back(LinkEntry{text, static_cast<int32_t>(i)});
             }

q4a avatar Jul 22 '22 06:07 q4a

@q4a Thank you very much!

Nothing quite like waking up to see problems already solved :+1:

Hammie avatar Jul 22 '22 07:07 Hammie

I see you removed some utf8-related code from the original Dialog though. Did you mean to drop its support or it's still supported somehow?

@espkk I assume you are talking about the modified AddToStringArrayLimitedByWidth? I'm confident the new code still works with utf-8, but I will try and find a more conclusive way to make sure.

Hammie avatar Jul 24 '22 08:07 Hammie

@espkk I've tried creating a unit test to make sure it still works with non-ascii characters, but the presence of the renderer makes that almost impossible.

The theory as to why it should still work is that neither ' ' or '\n' could ever by confused for other characters in utf-8 - as is the case for all ascii characters <= code point 127 - because multi-byte code points always have the highest bit active.

Also did a quick test with some Cyrillic text, no idea what it says but it looks like it is rendering correctly: Sea Dogs 28_08_2022 14_28_55

Hammie avatar Aug 28 '22 12:08 Hammie

@espkk I've tried creating a unit test to make sure it still works with non-ascii characters, but the presence of the renderer makes that almost impossible.

The theory as to why it should still work is that neither ' ' or '\n' could ever by confused for other characters in utf-8 - as is the case for all ascii characters <= code point 127 - because multi-byte code points always have the highest bit active.

Also did a quick test with some Cyrillic text, no idea what it says but it looks like it is rendering correctly

Sounds good! Thanks

But this needs a rebase now 😢

espkk avatar Aug 31 '22 18:08 espkk