News:

Simutrans.com Portal
Our Simutrans site. You can find everything about Simutrans from here.

Understanding the graphic code: mix images

Started by An_dz, July 07, 2017, 02:23:26 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

An_dz

Let's steal James' post title as my question is also about graphics.

I would like to ask where I need to look to blend images and set that as the tile image. As you know I wrote a patch for setting the overtaking rule on the fly so now I want to make the road add some sort of overlay.

Dwachs

I do not understand what you are trying to achieve.

There is grund_t::display_boden(...), where images for different climates on one tile are displayed as mixed.
Parsley, sage, rosemary, and maggikraut.

An_dz

What I want is that when the way has the overtaking flag it draws an image over the way image. For example arrows for one-way roads. Like how tram tracks are drawn over roads, but in this case more complicated as rather than two objects (road & tram) it's only one (road).

I already found planquadrat_t::display_obj, I guess I'll learn what I can do starting here.

Ters

As far as I know, tram tracks are drawn over roads just like everything else on a tile. No mixing of images is involved. That only happens for the basic ground textures.

An_dz

Well, I expressed poorly then, my bad. I just want to draw another object over the road, except that it's not a "real"(?) object.

Dwachs

At the end of grund_t::display_boden the way graphics are displayed. Here, you could interfere and call a custom method to draw some way overlay graphics.

Another possibility would be to trick obj_t::display into drawing both the way image and an overlay: write a new method weg_T::get_image(int n),
for n=0 return way image, for n==1 return overlay image, and adjust overlay image offset to counter the offset increase in obj_t::display.
Parsley, sage, rosemary, and maggikraut.

An_dz

Thanks, I had found grund_t::display_boden, but the obj_t::display is a good idea too, I need to think what can be better.

prissi

Aren't wayobj already draw after way bu before cars? So this should achieve your arrows. (I think pak 128 even use some sings with arrows and planes, which work well until a wing overlaps too far into a neighboring tile (but that is something else).

An_dz

Yes, but I want it to be automatic and not require the user to use a decoration wayobj just to know the direction and/or the overtaking option.

An_dz

Thanks Dwachs, it's working. Still have to make a global overlay, but per way is already working.

Leartin

Is this intended to be a permanent overlay, or can you turn it on and off, like station coverage?

An_dz


Leartin

I'd argue it would be better if it could be turned off, but being turned on by default.  This would allow both for the overlay to be more bold and clear as well as more detailed, finer indications of what a road is based on manually placed signals and wayobjects.

An_dz

I'm coding for the purpose of having realistic on-road drawings, otherwise I would not be creating global AND per object overlay. Like continuous line where it's forbidden to overtake and dashed lines where it's allowed. A glaring overlay could be created later like track reservation, I think it would be great to easily notice the rules from any distance.

Ters

Quote from: An_dz on July 12, 2017, 02:18:14 PM
I'm coding for the purpose of having realistic on-road drawings

As far as marking one-way roads goes, there is the problem that I don't think there is a realistic marking that is universal. For me, the asphalt roads in pak64 already have the markings of a one-way road. Furthermore, there is usually no way of telling from the road markings alone which way a one-way road runs here. Not that I demand realism in this case. I see the graphics in pak64 as more symbolic.

An_dz

There's a graphic and you can draw whatever you wish. I don't care what you draw on it, I'm going to draw arrows for one-way.

Leartin

Quote from: An_dz on July 13, 2017, 12:27:43 AM
I'm coding for the purpose of having realistic on-road drawings, otherwise I would not be creating global AND per object overlay. Like continuous line where it's forbidden to overtake and dashed lines where it's allowed.
"Per Object Overlay" means you don't have ONE graphic, but a different one for each road? So technically, this allows as much freedom as having different graphics for onedirectional and bidirectional in the first place, given that essentially the full road graphic could be in the overlay, while the actual road would be barebone asphalt, or even empty?
...I guess it's like an automatically placed wayobj that uses the ribis of the way then? That's very different from what I originally thought of as an 'overlay'...

Sure, that would be awesome, and very, very versatile, while at the same time allowing to do it in a very simple fashion, so it can be implemented in any pakset with little work. Sorry, I  misread your intentions initially.

An_dz

Yes, think as a second backImage. There will have a global version so you can draw an option to affect all roads, AND you can also have road specific markings that will be saved inside the road pak.

The global version won't be drawn if the road has graphics for it. If the road only includes one-way graphics it will use the global version for the others.

You won't be able to have the road completely empty because the overlays don't have winter graphics, this would make the logic too complex. So yes, the road won't have the road markings and each "second backimage" will have them so you don't need to lose your time drawing the road five times.

It's also not a wayobj because it's part of the way and not a second object.

Quote from: Leartin on July 13, 2017, 04:50:09 AM
Sure, that would be awesome, and very, very versatile, while at the same time allowing to do it in a very simple fashion, so it can be implemented in any pakset with little work. Sorry, I  misread your intentions initially.

Exactly, even dead paksets will be able to enjoy this. It would only take a person to create the global pak.