dsb_lores_scaling

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. You may Image to help finance the hosting costs of this forum.
Post Reply
User avatar
Sophia
Concise and Honest
Posts: 4306
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

dsb_lores_scaling

Post by Sophia »

DSB 0.80 will include dsb_lores_scaling, which takes a boolean parameter and, when enabled, tells DSB's scaling code to scale everything to 50% of the specified size and then scale it back up, so distant objects have a more authentic DM low resolution look.

Ideally it's something you'll set and forget in your own startup.lua like this:

Code: Select all

dsb_lores_scaling(true)
However you can also disable it as needed in case it does strange things to some of your other graphics.
User avatar
Gambit37
Should eat more pies
Posts: 13769
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Re: dsb_lores_scaling

Post by Gambit37 »

Wowsers, that's amazing, thank you! Does this apply to the entire screen, or just the dungeon view?
User avatar
Sophia
Concise and Honest
Posts: 4306
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Re: dsb_lores_scaling

Post by Sophia »

It modifies how DSB's image scaling code works so it applies to anything that gets scaled before it is drawn. This is most commonly objects in the dungeon view, but you can also scale bitmaps yourself via dsb_bitmap_blit. Bitmaps that are drawn at their normal size aren't affected at all.
User avatar
Gambit37
Should eat more pies
Posts: 13769
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Re: dsb_lores_scaling

Post by Gambit37 »

I finally tried this out in v0.84, it doesn't appear to work. I'm getting a black image where the viewport should be with a few visible pixels at the very top. I removed my hack that simulates this effect before trying it out, so I don't think it's a Lua code conflict, however my viewport has a different position from the deafult, might that affect it?

Image
User avatar
Gambit37
Should eat more pies
Posts: 13769
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Re: dsb_lores_scaling

Post by Gambit37 »

Hmm, it does seem to work if i put the command in my sys_render_other function, but not in my startup, eg this is working:

Code: Select all

	if (gui_name == "lores") then
		dsb_bitmap_clear(bmp, color.powerpink )
		dsb_lores_scaling(true)
	end
User avatar
Sophia
Concise and Honest
Posts: 4306
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Re: dsb_lores_scaling

Post by Sophia »

I can't reproduce this. Since you found a solution that works for you it's probably not worth delving into!
User avatar
Gambit37
Should eat more pies
Posts: 13769
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Re: dsb_lores_scaling

Post by Gambit37 »

I've just realised why I got that black screenshot: although I'd removed the rendering code of my old hack from sys_render_other, I had forgotten to remove the area definition from gui_info, eg this bit:

Code: Select all

	viewhack = {
		x = 0,
		y = 90,
		w = 448,
		h = 272
	},
So DSB was creating an uninitialised bitmap for the viewhack area which was obscuring the viewport. The reason my solution above worked is due to clearing the bitmap to powerpink first.

It's nice to see this working now. Even though the scaling is now super-chunky, it's exactly how it needs to look :-)
Post Reply