Replacing river graphics

Discussions about the technical aspects of graphics development, including NewGRF tools and utilities.

Moderator: Graphics Moderators

User avatar
Quast65
Tycoon
Tycoon
Posts: 2642
Joined: 09 Oct 2011 13:51
Location: The Netherlands

Replacing river graphics

Post by Quast65 »

Hi all,

Is it possible to use Action-5 to replace the river graphics from OpenGFX-extra?
If so, what is the type number?
Projects: http://www.tt-forums.net/viewtopic.php?f=26&t=57266
Screenshots: http://www.tt-forums.net/viewtopic.php?f=47&t=56959
Scenario of The Netherlands: viewtopic.php?f=60&t=87604

Winner of the following screenshot competitions:
sep 2012, jan 2013, apr 2013, aug 2013, mar 2014, mar 2016, oct 2020
All my work is released under GPL-license (either V2 or V3), if not clearly stated otherwise.
User avatar
acs121
Tycoon
Tycoon
Posts: 1956
Joined: 03 Nov 2017 18:57
Location: Courbevoie, near Paris, France

Re: Replacing river graphics

Post by acs121 »

As far as i know, since you can replace tram tracks from opengfx-extra, you may use the same action than for tram track replacement.
User avatar
Quast65
Tycoon
Tycoon
Posts: 2642
Joined: 09 Oct 2011 13:51
Location: The Netherlands

Re: Replacing river graphics

Post by Quast65 »

acs121 wrote:As far as i know, since you can replace tram tracks from opengfx-extra, you may use the same action than for tram track replacement.
Do you even know how Action-5 works?
You need to specify a type to replace, the tramtracks indeed have their own type-number (0B,8B), so can be replaced using Action-5, but the rivers have no type-number of their own (at least none I could find in the Wiki).
Are they part of the Canal type number (08,88)?
Projects: http://www.tt-forums.net/viewtopic.php?f=26&t=57266
Screenshots: http://www.tt-forums.net/viewtopic.php?f=47&t=56959
Scenario of The Netherlands: viewtopic.php?f=60&t=87604

Winner of the following screenshot competitions:
sep 2012, jan 2013, apr 2013, aug 2013, mar 2014, mar 2016, oct 2020
All my work is released under GPL-license (either V2 or V3), if not clearly stated otherwise.
User avatar
wallyweb
Tycoon
Tycoon
Posts: 6102
Joined: 27 Nov 2004 15:05
Location: Canada

Re: Replacing river graphics

Post by wallyweb »

Quast65 wrote: ... the rivers have no type-number of their own (at least none I could find in the Wiki).
Are they part of the Canal type number (08,88)?
Rivers should indeed be a part of canals type 08/88. I believe they might not be. The specifications say that Type 08 has 65 real sprites and looking at the OpenGFX_extras sprite sheet we can count the 65 sprites from sprite number 276 to number 341. That range does not include the river sprites. Those are further down on the sheet starting at number 3011 to 3981 (4007 with buoys?). Note that there are more canal sprites from number 2785 to 3001.

Perhaps the question should be whether those extra canal sprites (2785 to 3001) and the river sprites (3011 to 3981) are supported in nforenum and GrfCodec and if so, beginning with which versions?

Note that OpenGFX+Landscape (which is not a base set) has even more canal/river sprites.

Note that Canals (and rivers) are supported by the Action1-2-3 triplet.
michael blunck
Tycoon
Tycoon
Posts: 5948
Joined: 27 Apr 2005 07:09
Contact:

Re: Replacing river graphics

Post by michael blunck »

Quast65 wrote: Is it possible to use Action-5 to replace the river graphics from OpenGFX-extra?
I don´t know about OpenGFX-extra, but o/c it is possible to replace the canal/river graphics from any base set. My River graphics does that since 2007.
Quast65 wrote: Do you even know how Action-5 works?
You need to specify a type to replace, the tramtracks indeed have their own type-number (0B,8B), so can be replaced using Action-5, but the rivers have no type-number of their own (at least none I could find in the Wiki).
Are they part of the Canal type number (08,88)?
Rivers and canals are the same. They only differ by their c-IDs in action3 (like railtypes do).

As Wally said, rivers/canals are using the standard 0-1-2-3 scheme, but they have only a very small number of properties, flags, callbacks and varAction2s.

BTW, there´s even a module for coding rivers/canals in m4nfo. :cool:

regards
Michael
Image
User avatar
wallyweb
Tycoon
Tycoon
Posts: 6102
Joined: 27 Nov 2004 15:05
Location: Canada

Re: Replacing river graphics

Post by wallyweb »

michael blunck wrote:I don´t know about OpenGFX-extra, but o/c it is possible to replace the canal/river graphics from any base set. My River graphics does that since 2007.
I am assuming you are using the 0-1-2-3 scheme to completely replace all the river sprites which are defined in ttdbase or OpenGFX_extra but what if one only wishes to replace one or two sprites? For the regular base sets one can use ActionA, but for the extended base sets one must use Action5 which only accesses a limited number of sprites as set out in the type chart. Action5 only allows the 65 canal sprites. The river sprites are beyond that 65 limit. Can the 0-1-2-3 scheme be used to modify only one or two real sprites?

Regards,

Wally
michael blunck
Tycoon
Tycoon
Posts: 5948
Joined: 27 Apr 2005 07:09
Contact:

Re: Replacing river graphics

Post by michael blunck »

wallyweb wrote: I am assuming you are using the 0-1-2-3 scheme to completely replace all the river sprites which are defined in ttdbase or OpenGFX_extra but what if one only wishes to replace one or two sprites? For the regular base sets one can use ActionA, but for the extended base sets one must use Action5 which only accesses a limited number of sprites as set out in the type chart. Action5 only allows the 65 canal sprites. The river sprites are beyond that 65 limit. Can the 0-1-2-3 scheme be used to modify only one or two real sprites?
Yes, the above mentioned rivers&canals grf uses the 0-1-2-3 scheme, but not action5.

I´ve never tested replacement of only a smaller number of sprites by that scheme, but it could well be that only sprites defined in the action1 would be replaced, keeping the base set sprites from action5. Just try it!

regards
Michael
Image
User avatar
wallyweb
Tycoon
Tycoon
Posts: 6102
Joined: 27 Nov 2004 15:05
Location: Canada

Re: Replacing river graphics

Post by wallyweb »

michael blunck wrote:I´ve never tested replacement of only a smaller number of sprites by that scheme, but it could well be that only sprites defined in the action1 would be replaced, keeping the base set sprites from action5. Just try it!
Ok, but hopefully I won't see river water pouring out of the fan on my computer. Maybe I can get Quast65 to try it on his computer. Heh.
michael blunck
Tycoon
Tycoon
Posts: 5948
Joined: 27 Apr 2005 07:09
Contact:

Re: Replacing river graphics

Post by michael blunck »

wallyweb wrote: Ok, but hopefully I won't see river water pouring out of the fan on my computer. Maybe I can get Quast65 to try it on his computer. Heh.
Just tested it (removing one of the straight river borders, to be overwritten by action5/base set). Looks silly. Not recommended.
ugly-rivers.png
ugly-rivers.png (506.97 KiB) Viewed 3851 times
regards
Michael
Image
User avatar
wallyweb
Tycoon
Tycoon
Posts: 6102
Joined: 27 Nov 2004 15:05
Location: Canada

Re: Replacing river graphics

Post by wallyweb »

michael blunck wrote:
wallyweb wrote: Ok, but hopefully I won't see river water pouring out of the fan on my computer. Maybe I can get Quast65 to try it on his computer. Heh.
Just tested it (removing one of the straight river borders, to be overwritten by action5/base set). Looks silly. Not recommended.

ugly-rivers.png
regards
Michael
Seems that breaks the algorithm.
User avatar
Quast65
Tycoon
Tycoon
Posts: 2642
Joined: 09 Oct 2011 13:51
Location: The Netherlands

Re: Replacing river graphics

Post by Quast65 »

Thanks Wally and Michael for your input! :bow:
Action-1-2-3 is likely going to do the trick for me at the moment, so I can start testing out an idea I have.

Still, is it definitely not possible to use Action-5 (by defining the type and offset to the rivergraphics I want to change)?
Because Action-1-2-3 does mean you need to replace all of the rivergraphics (even those you want to keep the same), to avoid that strange thing that Michael had shown.
Not that big of a problem, as I can just refer to the Opengfx-extra graphics for the ones that I want to stay the same (or to Opengfx+landscape), but its a lot more code/graphics and having it done via Action-5 keeps the GRF a lot smaller ;-)

By the way, if Action-5 is not possible, then a change to the Wiki would be handy, as the way its written now, I have the assumption that Action-5 can be used for Openttd…
Example474.png
Example474.png (69.79 KiB) Viewed 3811 times
Projects: http://www.tt-forums.net/viewtopic.php?f=26&t=57266
Screenshots: http://www.tt-forums.net/viewtopic.php?f=47&t=56959
Scenario of The Netherlands: viewtopic.php?f=60&t=87604

Winner of the following screenshot competitions:
sep 2012, jan 2013, apr 2013, aug 2013, mar 2014, mar 2016, oct 2020
All my work is released under GPL-license (either V2 or V3), if not clearly stated otherwise.
User avatar
wallyweb
Tycoon
Tycoon
Posts: 6102
Joined: 27 Nov 2004 15:05
Location: Canada

Re: Replacing river graphics

Post by wallyweb »

Quast65 wrote:By the way, if Action-5 is not possible, then a change to the Wiki would be handy, as the way its written now, I have the assumption that Action-5 can be used for Openttd…
Refer to the Version icons. OTTD 0.6 is not crossed out. :wink:
According to the wiki Action5 can be used for OTTD canals. Just not beyond to the first 65 sprites, and there are more than 65 OTTD canal sprites.
Last edited by wallyweb on 10 Jul 2018 16:09, edited 1 time in total.
User avatar
Quast65
Tycoon
Tycoon
Posts: 2642
Joined: 09 Oct 2011 13:51
Location: The Netherlands

Re: Replacing river graphics

Post by Quast65 »

Yes, meaning that it should be possible to use Action-5 with offsets, right?
But how? And what type and especially offsets to get to the rivers?
Projects: http://www.tt-forums.net/viewtopic.php?f=26&t=57266
Screenshots: http://www.tt-forums.net/viewtopic.php?f=47&t=56959
Scenario of The Netherlands: viewtopic.php?f=60&t=87604

Winner of the following screenshot competitions:
sep 2012, jan 2013, apr 2013, aug 2013, mar 2014, mar 2016, oct 2020
All my work is released under GPL-license (either V2 or V3), if not clearly stated otherwise.
User avatar
wallyweb
Tycoon
Tycoon
Posts: 6102
Joined: 27 Nov 2004 15:05
Location: Canada

Re: Replacing river graphics

Post by wallyweb »

Quast65 wrote:Yes, meaning that it should be possible to use Action-5 with offsets, right?
But how? And what type and especially offsets to get to the rivers?
Use type 88.
The first canal sprite (an icon) is offset 00, therefor the 65th sprite is offset \d 64.
Then go down the sprite sheet to the next canal/river sprite which will be offset \d 65 and continue counting until you arrive at the sprite you want to change.
michael blunck
Tycoon
Tycoon
Posts: 5948
Joined: 27 Apr 2005 07:09
Contact:

Re: Replacing river graphics

Post by michael blunck »

This is weird. I really forgot about action5 had been abandoned by TTDPatch, years ago!

I think the reason for the change to a 0-1-2-3 scheme is that you can´t use varAction2s for canals/rivers (terrain type, height) with only an action5 layout. I.e., you can´t mix both schemes. And o/c, you can´t skip some of the needed sprites when being in 0-1-2-3 since then the fixed rank of sprites gets corrupted. See screenshot above.

regards
Michael
Image
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: Replacing river graphics

Post by planetmaker »

Quast65 wrote:
acs121 wrote:As far as i know, since you can replace tram tracks from opengfx-extra, you may use the same action than for tram track replacement.
Do you even know how Action-5 works?
You need to specify a type to replace, the tramtracks indeed have their own type-number (0B,8B), so can be replaced using Action-5, but the rivers have no type-number of their own (at least none I could find in the Wiki).
Are they part of the Canal type number (08,88)?
Yes, rivers are canals in a NewGRF sense.
User avatar
Quast65
Tycoon
Tycoon
Posts: 2642
Joined: 09 Oct 2011 13:51
Location: The Netherlands

Re: Replacing river graphics

Post by Quast65 »

planetmaker wrote:Yes, rivers are canals in a NewGRF sense.
Ok, I did a test.
I used this Action-5 with 65 realsprites:

Code: Select all

    6 * 4	 05 88 41 00 
The result was that only the icon of the locks was changed, nothing else.
I did another test, with this code and just 1 realsprite:

Code: Select all

    6 * 4	 05 88 01 40 
And also with this one, only the icon of the locks was changed.

Meaning that the icon of the lock is at offset 64 (40 in Hexadecimal).
So this quote is incorrect:
wallyweb wrote:The first canal sprite (an icon) is offset 00
The Icon is the LAST of the 65 canal-sprites!!




Now, please take a look at this graphicsfile (decoded from OpenGFX-Extra):
ogfxe_extra.png
(561.95 KiB) Not downloaded yet
So, the canal-sprites are Spritenr 287 (a sloped watertile) to 351 (the lock icon) = 65 realsprites.
But much further down the graphicsfile you can see many more canal and rivergraphics, starting from Spritenr 2948 (a canal-side with snow on the grass at the outer end) to Spritenr 4052 (a corner with snow)

My assumption is that these override 64 of the 65 "original" canal-sprites (as there are no icons for the locks being changed) and also add the graphics for rivers/various-snow-stages/various-climates).
The action-5s I used are therefor useless (except if I wanted to change the lock-icon).

My question then again is, can Action-5 be used to change those "new" canal/river-graphics? If so, how? :?: :? ?(
Projects: http://www.tt-forums.net/viewtopic.php?f=26&t=57266
Screenshots: http://www.tt-forums.net/viewtopic.php?f=47&t=56959
Scenario of The Netherlands: viewtopic.php?f=60&t=87604

Winner of the following screenshot competitions:
sep 2012, jan 2013, apr 2013, aug 2013, mar 2014, mar 2016, oct 2020
All my work is released under GPL-license (either V2 or V3), if not clearly stated otherwise.
michael blunck
Tycoon
Tycoon
Posts: 5948
Joined: 27 Apr 2005 07:09
Contact:

Re: Replacing river graphics

Post by michael blunck »

Quast65 wrote: My question then again is, can Action-5 be used to change those "new" canal/river-graphics? If so, how?
Why don´t you take a look into that OGFX code? And check if it is using action5? And how? And if it is not using action5, but actions 0-1-2-3, there might be a reason for it?

regards
Michael
Image
User avatar
wallyweb
Tycoon
Tycoon
Posts: 6102
Joined: 27 Nov 2004 15:05
Location: Canada

Re: Replacing river graphics

Post by wallyweb »

Quast65 wrote:
wallyweb wrote:The first canal sprite (an icon) is offset 00
The Icon is the LAST of the 65 canal-sprites!!
:oops: I don't know what the heck I was looking at. Lesson: Don't work on this stuff at 3:00 AM.
User avatar
Quast65
Tycoon
Tycoon
Posts: 2642
Joined: 09 Oct 2011 13:51
Location: The Netherlands

Re: Replacing river graphics

Post by Quast65 »

michael blunck wrote:Why don´t you take a look into that OGFX code? And check if it is using action5? And how? And if it is not using action5, but actions 0-1-2-3, there might be a reason for it?
I already did that and it does indeed use Action-1-2-3. This I also already tested to change those graphics, that works.
But I want to be absolutely sure that action-5 cant be used for those sprites.
Because if that is the case then this thread can also be usefull for future GRF-developers who want to change canal- and/or river- and/or lock-graphics and run into the same issue I have.
Also a small change/update of the Wiki might be handy (via an extra footnote), something like:

Code: Select all

When using OpenGFX-extra version XX.XX and newer, Action-1-2-3 is needed to change Canal-graphics and not Action-5.
Except for the Lock-Icon, for that you still need to use Action-5 (type 88, offset 40).
But again, if that is definitely the case! Because, to me, Planetmakers remark means that it should/might be possible to alter rivers by using Action-5 and he is, if I am correct, one of the devs of OpenGFX.
I hope you understand that at the moment this all is a bit confusing to me. There is still no clear Yes or No to my question (or even: Partly, some things Yes, some things No).
I just dont want to waste my time using the Action-1-2-3 option, if Action-5 is also possible, as that means a much smaller code and graphicsfile (so less work/time and also means less chance for mistakes, or mistakes being spotted easier).


wallyweb wrote:I don't know what the heck I was looking at.
No worries, just wanted to avoid any extra/future confusion ;-)
Projects: http://www.tt-forums.net/viewtopic.php?f=26&t=57266
Screenshots: http://www.tt-forums.net/viewtopic.php?f=47&t=56959
Scenario of The Netherlands: viewtopic.php?f=60&t=87604

Winner of the following screenshot competitions:
sep 2012, jan 2013, apr 2013, aug 2013, mar 2014, mar 2016, oct 2020
All my work is released under GPL-license (either V2 or V3), if not clearly stated otherwise.
Post Reply

Return to “NewGRF Technical Discussions”

Who is online

Users browsing this forum: No registered users and 5 guests