Author Topic: Understanding the graphic code: mix images  (Read 1124 times)

0 Members and 1 Guest are viewing this topic.

Offline An_dz

  • Web Admin
  • Administrator
  • *
  • Posts: 2594
  • Total likes: 290
  • Helpful: 89
  • D'oh
    • by An_dz
  • Languages: PT, EN, (it, de)
Understanding the graphic code: mix images
« on: July 07, 2017, 02:23:26 AM »
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.

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4251
  • Total likes: 177
  • Helpful: 149
  • Languages: EN, DE, AT
Re: Understanding the graphic code: mix images
« Reply #1 on: July 07, 2017, 07:32:44 PM »
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.

Offline An_dz

  • Web Admin
  • Administrator
  • *
  • Posts: 2594
  • Total likes: 290
  • Helpful: 89
  • D'oh
    • by An_dz
  • Languages: PT, EN, (it, de)
Re: Understanding the graphic code: mix images
« Reply #2 on: July 07, 2017, 07:46:43 PM »
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.

Offline Ters

  • Coder/patcher
  • Devotee
  • *
  • Posts: 4870
  • Total likes: 202
  • Helpful: 108
  • Languages: EN, NO
Re: Understanding the graphic code: mix images
« Reply #3 on: July 07, 2017, 08:46:31 PM »
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.

Offline An_dz

  • Web Admin
  • Administrator
  • *
  • Posts: 2594
  • Total likes: 290
  • Helpful: 89
  • D'oh
    • by An_dz
  • Languages: PT, EN, (it, de)
Re: Understanding the graphic code: mix images
« Reply #4 on: July 07, 2017, 10:09:25 PM »
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.

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4251
  • Total likes: 177
  • Helpful: 149
  • Languages: EN, DE, AT
Re: Understanding the graphic code: mix images
« Reply #5 on: July 08, 2017, 08:36:24 AM »
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.

Offline An_dz

  • Web Admin
  • Administrator
  • *
  • Posts: 2594
  • Total likes: 290
  • Helpful: 89
  • D'oh
    • by An_dz
  • Languages: PT, EN, (it, de)
Re: Understanding the graphic code: mix images
« Reply #6 on: July 08, 2017, 01:50:41 PM »
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.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 8823
  • Total likes: 323
  • Helpful: 229
  • Languages: De,EN,JP
Re: Understanding the graphic code: mix images
« Reply #7 on: July 10, 2017, 06:46:07 AM »
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).

Offline An_dz

  • Web Admin
  • Administrator
  • *
  • Posts: 2594
  • Total likes: 290
  • Helpful: 89
  • D'oh
    • by An_dz
  • Languages: PT, EN, (it, de)
Re: Understanding the graphic code: mix images
« Reply #8 on: July 10, 2017, 12:26:01 PM »
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.

Offline An_dz

  • Web Admin
  • Administrator
  • *
  • Posts: 2594
  • Total likes: 290
  • Helpful: 89
  • D'oh
    • by An_dz
  • Languages: PT, EN, (it, de)
Re: Understanding the graphic code: mix images
« Reply #9 on: July 12, 2017, 04:14:44 AM »
Thanks Dwachs, it's working. Still have to make a global overlay, but per way is already working.

Offline Leartin

  • Devotee
  • *
  • Posts: 848
  • Total likes: 301
  • Helpful: 44
  • !!!!!This user was banned for double posting!!!!!
  • Languages: DE, EN
Re: Understanding the graphic code: mix images
« Reply #10 on: July 12, 2017, 10:11:12 AM »
Is this intended to be a permanent overlay, or can you turn it on and off, like station coverage?

Offline An_dz

  • Web Admin
  • Administrator
  • *
  • Posts: 2594
  • Total likes: 290
  • Helpful: 89
  • D'oh
    • by An_dz
  • Languages: PT, EN, (it, de)
Re: Understanding the graphic code: mix images
« Reply #11 on: July 12, 2017, 12:52:36 PM »
It's intended to be permanent.

Offline Leartin

  • Devotee
  • *
  • Posts: 848
  • Total likes: 301
  • Helpful: 44
  • !!!!!This user was banned for double posting!!!!!
  • Languages: DE, EN
Re: Understanding the graphic code: mix images
« Reply #12 on: July 12, 2017, 02:01:28 PM »
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.

Offline An_dz

  • Web Admin
  • Administrator
  • *
  • Posts: 2594
  • Total likes: 290
  • Helpful: 89
  • D'oh
    • by An_dz
  • Languages: PT, EN, (it, de)
Re: Understanding the graphic code: mix images
« Reply #13 on: July 12, 2017, 02:18:14 PM »
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.

Offline Ters

  • Coder/patcher
  • Devotee
  • *
  • Posts: 4870
  • Total likes: 202
  • Helpful: 108
  • Languages: EN, NO
Re: Understanding the graphic code: mix images
« Reply #14 on: July 12, 2017, 06:16:29 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.

Offline An_dz

  • Web Admin
  • Administrator
  • *
  • Posts: 2594
  • Total likes: 290
  • Helpful: 89
  • D'oh
    • by An_dz
  • Languages: PT, EN, (it, de)
Re: Understanding the graphic code: mix images
« Reply #15 on: July 13, 2017, 12:27:43 AM »
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.

Offline Leartin

  • Devotee
  • *
  • Posts: 848
  • Total likes: 301
  • Helpful: 44
  • !!!!!This user was banned for double posting!!!!!
  • Languages: DE, EN
Re: Understanding the graphic code: mix images
« Reply #16 on: July 13, 2017, 04:50:09 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.

Offline An_dz

  • Web Admin
  • Administrator
  • *
  • Posts: 2594
  • Total likes: 290
  • Helpful: 89
  • D'oh
    • by An_dz
  • Languages: PT, EN, (it, de)
Re: Understanding the graphic code: mix images
« Reply #17 on: July 13, 2017, 01:58:46 PM »
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.

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.