ESB Stair Icon / ESB icons

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
Ser Xav
Lo Master
Posts: 449
Joined: Mon Jan 21, 2013 10:58 pm
Location: I see walls stretching off into the darkness...

ESB Stair Icon / ESB icons

Post by Ser Xav »

Hi, I've created a custom stairs object and associated custom bitmap set. When I place the stairs in ESB editor, ESB does not use the stair icon from the editor cell.pcx file, it just displays the standard floor upright icon. I can't see how to point the custom stair object to te stair icon. Is there a way to do this? Or to point at a standalone icon for use in ESB?

In fact, can I create new icons? Can I expand the cells.pcx? How does one point a gfx reference to it?

Many thanks indeed :)
User avatar
Sophia
Concise and Honest
Posts: 4306
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Re: ESB Stair Icon / ESB icons

Post by Sophia »

There are a few ways to do it. Admittedly none of this is particularly well documented though you can see the code in editor/editor.lua which has plenty of examples.

The simplest way is to set esb_name equal to one of the standard archetypes (e.g. "stairsdown") which will tell ESB to use the icon for that archetype. Another approach is to define esb_drawinfo, which is a table that specifies the icon number in cells.pcx and the priority to draw that icon: { 2, 0 } for stairs down, for example.

You can expand cells.pcx by adding new rows below the existing ones. Do not change the width or you will throw off all of the existing icon offsets and make a huge mess.

Making the process of adding new editor graphics easier is something that I've wanted to do for a while but it's a big enough job I've never really found the time or motivation, so whether it's ever actually going to happen is pretty unclear at this point.
User avatar
Ser Xav
Lo Master
Posts: 449
Joined: Mon Jan 21, 2013 10:58 pm
Location: I see walls stretching off into the darkness...

Re: ESB Stair Icon / ESB icons

Post by Ser Xav »

Ok thanks. I had seen the code but didn’t fully understand it, the explanation above makes sense, will play with this later when I get a chance.

Thanks for clarifying also how to add cells, sounds straightforward. I’ll probably add cells to try to better differentiate the custom assets in my custom dungeon. I had already made some mods to change appearance etc.

In relation to my using ESB for more the custom dungeon approach, a few thoughts emerged that would be really beneficial in ESB: 1) the ability to zoom the dungeon map more that 2x view (particularly with the high resolution display/desktop I use), 2) keyboard controls for zooming (say, + and - ), 3) an .ini setting with a default view zoom when ESB loads, and 4) if the cells could be higher resolution/pixel dimension, say 2x what they are currently.

Fully appreciating of course that this may all be lots of work and not ‘worth it’! But just putting it out there

Thanks as always.
kaypy
Artisan
Posts: 187
Joined: Sun Jan 19, 2014 7:11 am

Re: ESB Stair Icon / ESB icons

Post by kaypy »

As an example, I have an extra row at the bottom of the cells.pcx like
Image

and modify the wallitem section of editor.lua

Code: Select all

	elseif (arch.type == "WALLITEM") then
		if (arch.class ~= "DECO") then
			if (arch.class == "ALCOVE") then
				return (52+dir), 5
			else
				return (32+dir), 3
			end
		else
			return (48+dir), 4
		end
to

Code: Select all

	elseif (arch.type == "WALLITEM") then
		if (arch.class ~= "DECO") then
			if (arch.class == "KEYHOLE") then
				return (84+dir), 5
			elseif (arch.class == "BUTTON") then
				return (80+dir), 5
			elseif (arch.class == "ALCOVE") then
				return (52+dir), 5
			else
				return (32+dir), 3
			end
		else
			return (48+dir), 4
		end
and it means all the normally manipulable wall items are specifically shown.
Friends don't let friends eat worm round
User avatar
Ser Xav
Lo Master
Posts: 449
Joined: Mon Jan 21, 2013 10:58 pm
Location: I see walls stretching off into the darkness...

Re: ESB Stair Icon / ESB icons

Post by Ser Xav »

Hi Kaypay, thank you! Just tried that in my ESB, very useful improvement, looks good.

Trying to figure out the coordinate system on the cells.pcx. Seems like the top row is exclude, and the two red boxes on the second line are 0 and 1. Stairs down is 2, doors start at 18, etc. Your new switches and keys icons start at 80 and 84 respectively (presumably adding a 'dir' value it seems for 0=south facing, 2/3/4 for west/north/east respectively?)

Code: Select all

elseif (arch.class == "BUTTON") then
				return (80+dir), 5
				
What does the ,5 denote?
User avatar
Sophia
Concise and Honest
Posts: 4306
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Re: ESB Stair Icon / ESB icons

Post by Sophia »

The second number is the draw priority. Higher numbers are drawn later, so they are shown on top of lower numbers. This makes sure that objects in ESB are shown in a coherent fashion regardless of their actual order on the tile; e.g., doorbuttons always drawn on top of doors.

So, an interesting thing about ESB that I had forgotten: 8 icons per row is hardcoded. This, combined with the fact that the icons are all square, mean that cells.pcx can be any size (or is a multiple of 8, anyway) you want. If you want bigger cells, you can double the size of cells.pcx, save the new image, and everything will just work.
User avatar
Ser Xav
Lo Master
Posts: 449
Joined: Mon Jan 21, 2013 10:58 pm
Location: I see walls stretching off into the darkness...

Re: ESB Stair Icon / ESB icons

Post by Ser Xav »

Sophia wrote: Sun Feb 16, 2025 6:45 pm So, an interesting thing about ESB that I had forgotten: 8 icons per row is hardcoded. This, combined with the fact that the icons are all square, mean that cells.pcx can be any size (or is a multiple of 8, anyway) you want. If you want bigger cells, you can double the size of cells.pcx, save the new image, and everything will just work.
WOW! That works brilliantly. Thank you so much! I just doubled the cells.pcx to two times the size..... result is automatic 2x zoom in ESB AND extra detail / resolution per icon tile. Brilliant stuff, Sophia. 8)
User avatar
Gambit37
Should eat more pies
Posts: 13766
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Re: ESB Stair Icon / ESB icons

Post by Gambit37 »

I knew we could add extra icons, but I didn't know we could increase the resolution this way... very cool!
User avatar
Sophia
Concise and Honest
Posts: 4306
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Re: ESB Stair Icon / ESB icons

Post by Sophia »

Weirdly enough I had actually mentioned this many years ago and you were both in that thread! But I can't really blame you guys for forgetting since I didn't remember at first either. :mrgreen:
User avatar
Ser Xav
Lo Master
Posts: 449
Joined: Mon Jan 21, 2013 10:58 pm
Location: I see walls stretching off into the darkness...

Re: ESB Stair Icon / ESB icons

Post by Ser Xav »

Wow.... I'm speechless, that's hilarious.... Have already been there in another life! Lol.
User avatar
Ser Xav
Lo Master
Posts: 449
Joined: Mon Jan 21, 2013 10:58 pm
Location: I see walls stretching off into the darkness...

Re: ESB Stair Icon / ESB icons

Post by Ser Xav »

Very minor point, but I noticed that once the cells.pcx is 2x size, and if you then go to double size view mode, when you place an object or wall item, the item is placed off centre to the tile, until you scroll the ESB viewport, which seems to redraw the view and the newly placed object position is then corrected and appears on the grid properly.
User avatar
Sophia
Concise and Honest
Posts: 4306
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Re: ESB Stair Icon / ESB icons

Post by Sophia »

It seems like certain cell sizes are finicky. This has been fixed for 0.85.
Post Reply