Override dsb_write across the entire codebase?

This forum is for the Lua scriptable clone of DM/CSB called Dungeon Strikes Back by Sophia. Use DSB to build your own highly customised games.

Moderator: Sophia

Forum rules
Please read the Forum rules and policies before posting.
Post Reply
User avatar
Gambit37
Should eat more pies
Posts: 13715
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Override dsb_write across the entire codebase?

Post 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) ...?
User avatar
Sophia
Concise and Honest
Posts: 4240
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Re: Override dsb_write across the entire codebase?

Post 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?
User avatar
Gambit37
Should eat more pies
Posts: 13715
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Re: Override dsb_write across the entire codebase?

Post 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?
User avatar
Sophia
Concise and Honest
Posts: 4240
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Re: Override dsb_write across the entire codebase?

Post 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.
User avatar
Gambit37
Should eat more pies
Posts: 13715
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Re: Override dsb_write across the entire codebase?

Post 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:
User avatar
Sophia
Concise and Honest
Posts: 4240
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Re: Override dsb_write across the entire codebase?

Post 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."
User avatar
Gambit37
Should eat more pies
Posts: 13715
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Re: Override dsb_write across the entire codebase?

Post by Gambit37 »

Interesting, sounds great, thank you :-)
Post Reply