Issues with dsb_get_font

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
Lord_BoNes
Jack of all trades
Posts: 1064
Joined: Mon Dec 01, 2008 12:36 pm
Location: Ararat, Australia.

Issues with dsb_get_font

Post by Lord_BoNes »

While trying to add the brown wall text from DM2, I've hit a roadblock... attempting to load a file with dsb_get_font crashes DSB, telling me it can't find the file :?
If I try to load a PNG file, it crashes DSB unable to find it.
If I try to load a BMP or PCX file, it seems to get a little further, but then bombs out with a seg fault.

The end result is that I can't seem to load a new font :(
 
Image

1 death is a tragedy,
10,000,000 deaths is a statistic.
- Joseph Stalin

Check out my Return to Chaos dungeon launcher
And my Dungeon Master Clone
User avatar
Gambit37
Should eat more pies
Posts: 13720
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Re: Issues with dsb_get_font

Post by Gambit37 »

Fonts must be in a very specific Allegro format. It requires a grid, separated by specific colours. Have you created one of those?

Also, this is one function that REQUIRES the font PCX to be in your dungeon folder (it doesn't work with PNGs for some reason and you can't have fonts in different folders).

I do think all the graphics handling functions should be made consistent so that any graphic can be put in any folder and PNGs are always supported. It's a bit odd to have weird exceptions like this.
User avatar
Lord_BoNes
Jack of all trades
Posts: 1064
Joined: Mon Dec 01, 2008 12:36 pm
Location: Ararat, Australia.

Re: Issues with dsb_get_font

Post by Lord_BoNes »

Yes, I have the text on a grid. All I did was take the original DSB wall_font.pcx, alter the palette (so the text was brown instead of grey) and then save it as a PNG, in a sub-folder.

I agree. All the graphics handling functions need to be made consistent. It was odd bumping into this alright :P
 
Image

1 death is a tragedy,
10,000,000 deaths is a statistic.
- Joseph Stalin

Check out my Return to Chaos dungeon launcher
And my Dungeon Master Clone
User avatar
Lord_BoNes
Jack of all trades
Posts: 1064
Joined: Mon Dec 01, 2008 12:36 pm
Location: Ararat, Australia.

Re: Issues with dsb_get_font

Post by Lord_BoNes »

I tried saving the file as a PCX file, and put it in my dungeon's root-folder... to no avail... segmentation fault :(
 
Image

1 death is a tragedy,
10,000,000 deaths is a statistic.
- Joseph Stalin

Check out my Return to Chaos dungeon launcher
And my Dungeon Master Clone
User avatar
Gambit37
Should eat more pies
Posts: 13720
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Re: Issues with dsb_get_font

Post by Gambit37 »

It's been a while since I've fiddled with fonts, but I do recall I had lots of problems initially too.
It maybe that you don't have the right 8bit or 24bit format.
I'll send you a PM with my email address in it and you can send me your file for me to look at.
By the way, if the font is a single colour, make it in white, then you can recolour it in code rather than having to mess about with colouring bitmaps externally.
User avatar
Lord_BoNes
Jack of all trades
Posts: 1064
Joined: Mon Dec 01, 2008 12:36 pm
Location: Ararat, Australia.

Re: Issues with dsb_get_font

Post by Lord_BoNes »

It seems that my issue was my graphics handling program (IrfanView) slightly altering the RGB of the image file... which DSB didn't like :P
 
Image

1 death is a tragedy,
10,000,000 deaths is a statistic.
- Joseph Stalin

Check out my Return to Chaos dungeon launcher
And my Dungeon Master Clone
User avatar
Lord_BoNes
Jack of all trades
Posts: 1064
Joined: Mon Dec 01, 2008 12:36 pm
Location: Ararat, Australia.

Re: Issues with dsb_get_font

Post by Lord_BoNes »

On a related note: Why my does walltext appear as very small text (instead of the usual size)? All I've done is clone the original walltext item, and altered the front/side/font values... everything else is left alone... and yet, my walltext is about 1/2 to 1/3 the size of normal walltext :?
 
Image

1 death is a tragedy,
10,000,000 deaths is a statistic.
- Joseph Stalin

Check out my Return to Chaos dungeon launcher
And my Dungeon Master Clone
User avatar
Gambit37
Should eat more pies
Posts: 13720
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Re: Issues with dsb_get_font

Post by Gambit37 »

Oh yeah, I forgot to mention, you need to pixel-double it, your bitmap was the original DM resolution. You need double for DSB.
User avatar
Lord_BoNes
Jack of all trades
Posts: 1064
Joined: Mon Dec 01, 2008 12:36 pm
Location: Ararat, Australia.

Re: Issues with dsb_get_font

Post by Lord_BoNes »

Ahh... makes sense. Thanx
 
Image

1 death is a tragedy,
10,000,000 deaths is a statistic.
- Joseph Stalin

Check out my Return to Chaos dungeon launcher
And my Dungeon Master Clone
User avatar
Sophia
Concise and Honest
Posts: 4240
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Re: Issues with dsb_get_font

Post by Sophia »

Gambit37 wrote:I do think all the graphics handling functions should be made consistent so that any graphic can be put in any folder and PNGs are always supported. It's a bit odd to have weird exceptions like this.
You develop with PHP, so you should be used to this kind of thing. ;)

Seriously, though, I think part of the issue may be some old documentation floating around-- for example, dsb_get_font already supports a long name different from the short name, like the other bitmap loading functions. This wasn't always the case, but it is now.

As for PNG support, there's really no reason to. DSB fonts can't have alpha channels and they can't and won't unless I make substantial rewrites to the Allegro font renderer... which is not something I have any intention of doing. So, sure, adding support for PNG images is easy, but then someone would inevitably complain about alpha channels not working and we'd just be back here...
User avatar
Lord_BoNes
Jack of all trades
Posts: 1064
Joined: Mon Dec 01, 2008 12:36 pm
Location: Ararat, Australia.

Re: Issues with dsb_get_font

Post by Lord_BoNes »

Image
Here's my finished DM2 wooden wallpanel, complete with some "brown text" :P
 
Image

1 death is a tragedy,
10,000,000 deaths is a statistic.
- Joseph Stalin

Check out my Return to Chaos dungeon launcher
And my Dungeon Master Clone
Post Reply