How do you change the 'build bridge' dialogue?

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

Moderator: Graphics Moderators

Post Reply
AndyLandy
Engineer
Engineer
Posts: 30
Joined: 10 Sep 2008 20:09

How do you change the 'build bridge' dialogue?

Post by AndyLandy »

Hi all,

Thought I'd get back into a bit of NewGRF development, so thought I'd try my hand at bridges. The actual bridges are fine, I can change the graphics and the colours, I can change the various properties, no problems.

But... I have no idea how to change the purchase dialogue. Allegedly I should be able to change prop 10/11/12 to change the text strings, but that doesn't work. I'd have thought the following would do it, changing the wooden bridge to be described as a concrete suspension one, but no joy.

Code: Select all

    9 * 8    00 06 01 01 00 10 11 50    // Purchase string
   10 * 8    00 06 01 01 00 11 1E 50    // Rail desc string
   11 * 8    00 06 01 01 00 12 24 50    // Road desc string
Additionally, I have no idea how to change the images in the dialogue. If at all possible, I'd like to use the original sprites, but rearrange and recolour them, but I don't know how to do that. I'm not even sure how to find out which sprites to change.

As ever, any help or advice gratefully received. Thanks in advance!
User avatar
Leanden
Tycoon
Tycoon
Posts: 2613
Joined: 19 Mar 2009 19:25
Location: Kent

Re: How do you change the 'build bridge' dialogue?

Post by Leanden »

NML is your friend, check out the tutorials for a guide on the wiki.
Image
User avatar
wallyweb
Tycoon
Tycoon
Posts: 6102
Joined: 27 Nov 2004 15:05
Location: Canada

Re: How do you change the 'build bridge' dialogue?

Post by wallyweb »

Leanden wrote:NML is your friend, check out the tutorials for a guide on the wiki.
Does NML support bridges yet?
AndyLandy wrote:I have no idea how to change the purchase dialogue. Allegedly I should be able to change prop 10/11/12 to change the text strings, but that doesn't work. I'd have thought the following would do it, changing the wooden bridge to be described as a concrete suspension one, but no joy.!
If you are coding in NFO ...
Use an action4.
Place it either before your Action0 or at the end of your code.

Code: Select all

// Action 4 Define menu texts
// <Sprite-number> * <Length> 04 <feature> <language-id> <num-ent> <offset> <text>
    3 * 23	 04 48 FF 01 0B DC "Wooden Bridge" 00
    4 * 27	 04 48 FF 01 1B DC "Wooden Bridge - Rail" 00
    5 * 27	 04 48 FF 01 2B DC "Wooden Bridge - Road" 00
User avatar
Leanden
Tycoon
Tycoon
Posts: 2613
Joined: 19 Mar 2009 19:25
Location: Kent

Re: How do you change the 'build bridge' dialogue?

Post by Leanden »

Apparently not.

http://newgrf-specs.tt-wiki.net/wiki/NML:Bridges

Saw it listed there but never clicked into it, just assumed if its there then it works :D
Image
AndyLandy
Engineer
Engineer
Posts: 30
Joined: 10 Sep 2008 20:09

Re: How do you change the 'build bridge' dialogue?

Post by AndyLandy »

wallyweb wrote:If you are coding in NFO ...
Use an action4.
Place it either before your Action0 or at the end of your code.

Code: Select all

// Action 4 Define menu texts
// <Sprite-number> * <Length> 04 <feature> <language-id> <num-ent> <offset> <text>
    3 * 23	 04 48 FF 01 0B DC "Wooden Bridge" 00
    4 * 27	 04 48 FF 01 1B DC "Wooden Bridge - Rail" 00
    5 * 27	 04 48 FF 01 2B DC "Wooden Bridge - Road" 00
Hey.

You are absolutely correct that I can use action04s to create some custom text strings in the DC range. I've implemented that and it works, so I'm happy to stick with it. That said, it would have been nice to re-use some of the existing text strings wherever possible. I wonder why it didn't work.

Still not sure how I'd go about rearranging and recolouring the sprites in the buy window -- that'll be my next challenge. I've got some avenues left to explore though, so I'll look into those. Of course, if anyone has any advice or suggestions on that front, I'd be happy to hear them!
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: How do you change the 'build bridge' dialogue?

Post by planetmaker »

The sprites in the buy menu can be replaced by simple actionA or the appropriate action5. Look through OpenGFX code to find the sprite numbers.
User avatar
wallyweb
Tycoon
Tycoon
Posts: 6102
Joined: 27 Nov 2004 15:05
Location: Canada

Re: How do you change the 'build bridge' dialogue?

Post by wallyweb »

AndyLandy wrote:You are absolutely correct that I can use action04s to create some custom text strings in the DC range. I've implemented that and it works, so I'm happy to stick with it. That said, it would have been nice to re-use some of the existing text strings wherever possible. I wonder why it didn't work.
Just copy and paste the desired text strings into the Action4 for the bridge where you want them.
Still not sure how I'd go about rearranging and recolouring the sprites in the buy window -- that'll be my next challenge. I've got some avenues left to explore though, so I'll look into those. Of course, if anyone has any advice or suggestions on that front, I'd be happy to hear them!
planetmaker wrote:The sprites in the buy menu can be replaced by simple actionA or the appropriate action5. Look through OpenGFX code to find the sprite numbers.
Here ActionA is your friend ...

Code: Select all

// ---- Menu Icon ---------------------------------------------------------------------------
// <Sprite-number> * <Length> 0A <num-sets> <num-sprites> <first-sprite>...
  173 * 5	 0A 01 01 28 0A     //  2600 = 0x0A28 = 28 0A
// Format: spritenum pcxfile xpos ypos compression ysize xsize xrel yrel
  174 C:\mps\_tools\grfcodec7\sprites\CarbonNano.pcx 16 528 09 11 40 0 9
This is the most frustrating part of bridge coding for a couple of reasons ...
1. You have to find the sprite number of the default sprite you wish to replace.
2. The Suspension, Cantelever and Tubular bridges respectively use recolour sprites for two extra bridges each. The recoloured sprites each have the same sprite number as the parent bridge and any changes will affect all three bridges in each of the three bridge types.
AndyLandy
Engineer
Engineer
Posts: 30
Joined: 10 Sep 2008 20:09

Re: How do you change the 'build bridge' dialogue?

Post by AndyLandy »

wallyweb wrote:This is the most frustrating part of bridge coding for a couple of reasons ...
1. You have to find the sprite number of the default sprite you wish to replace.
2. The Suspension, Cantelever and Tubular bridges respectively use recolour sprites for two extra bridges each. The recoloured sprites each have the same sprite number as the parent bridge and any changes will affect all three bridges in each of the three bridge types.
So, I don't actually want to replace any sprites. I'd just like to rearrange them -- is that possible? Ideally, I'd like to be able to recolour some of them along the way, too. Imagine you want to make all the bridges tubular ones, but in a dozen different colours. I can do that with the actual bridges, but it would be nice if I could change the buy menu as well.

EDIT: Just found http://www.tt-forums.net/viewtopic.php?t=36158 -- I guess that means it's (currently) not supported to change these with NewGRFs. Never mind, I'll find a way to work with it.

Thanks to everyone for their advice and assistance so far. :D
Post Reply

Return to “NewGRF Technical Discussions”

Who is online

Users browsing this forum: No registered users and 22 guests