Page 1 of 1

Override dsb_write across the entire codebase?

Posted: Fri Mar 06, 2020 4:33 pm
by Gambit37
I'd really like to be able to override/wrap dsb_write across the entire codebase.

There are a lot of ALL CAPS strings scattered throughout, and if I want to render them in sentence case, I have to override all the functions that render the text which is... :cry: . I'd also like my wrapper function to automatically work out if the text is too long for the console area, and needs to be wrapped (I already have a function to split a string and create multiple lines of text from it).

Is there a way to do this?

If this is tricky, an alternate solution would be to store all messages in a global table that can be easily overridden, and then modify dsb_write so that it will wrap the text at a specified pixel length/character count or delimiter (as the / character works with scrolls) ...?

Re: Override dsb_write across the entire codebase?

Posted: Fri Mar 06, 2020 8:43 pm
by Sophia
It seems like the easiest solution (and one that would also support localization, if that ever happened) would be to just move all of the strings from being embedded in the code to some kind of global string table. I'll look into this.

If you're using a font that has both capital and lower case, how are you handling spell runes?

Re: Override dsb_write across the entire codebase?

Posted: Fri Mar 06, 2020 10:57 pm
by Gambit37
Spell runes are only required in the magic spellcasting interface, so I just leave a rune enabled font there, and replace other fonts elsewhere. Of course, if a designer wants to mix and match a font with and without runes, then this approach doesn't work but there's nowhere in the CSB or DM dungeons that requires that capability as far as I recall?

Re: Override dsb_write across the entire codebase?

Posted: Fri Mar 06, 2020 11:45 pm
by Sophia
Not in the game's static text, but skill levels above expert (Lo Master, etc.) and the power levels of potions by default both use the spell runes mixed in with normal text.

Re: Override dsb_write across the entire codebase?

Posted: Sat Mar 07, 2020 12:06 am
by Gambit37
Ah. Bugger.

Not sure I can be arsed to find a way around that, so looks like it's staying as all caps. :lol:

Re: Override dsb_write across the entire codebase?

Posted: Tue Mar 10, 2020 1:15 am
by Sophia
Since I've been hacking around in the text rendering routines anyway, I revisited this and it's not actually so bad. DSB 0.76 will include a duplicate set of runes in its default font at ASCII value 129 (0x81) and up, and I'm modifying the base code to be able to render them. If you modify your custom font accordingly we can make it "just work."

Re: Override dsb_write across the entire codebase?

Posted: Tue Mar 10, 2020 10:45 am
by Gambit37
Interesting, sounds great, thank you :-)