Flexible Tunnels

Discuss, get help with, or post new graphics for TTDPatch and OpenTTD, using the NewGRF system, here. Graphics for plain TTD also acceptable here.

Moderator: Graphics Moderators

Post Reply
User avatar
Froix
Engineer
Engineer
Posts: 65
Joined: 16 Jul 2010 13:09

Flexible Tunnels

Post by Froix »

Flexible Tunnels
Alpha 0.01

One more project to add in rotation to keep me from getting bored.

These are tunnels you have complete control over by way of parameters. One type of tunnel can be reused. All climates are supported.

That's the goal anyway. What is available so far are three types of tunnels for temperate climate OpenGFX base set only. Credits go to the OpenGFX team for the ground sprites I used of course.

Parameters:
  • 1st: Base Graphics Compatibility - 0-TTD, 1-OpenGFX
  • 2nd: Road - 0-Use None (Base Graphics Tunnel), 1 to 3 - Type of Tunnel to Use
  • 3rd: Rail - do -
  • 4th: Monorail - do -
  • 5th: Maglev - do -
Tunnels available: 1 - Light Concrete, 2 - Dark Concrete, 3 - Red Concrete

Reason for early release? I want to have my coding tested. I'm not too comfortable with using variables and parameters in NFO. I also got tired placing tunnels on ground sprites. More importantly, if anyone wants to help me with this, just let me know. I would really appreciate it.

Copyright © 2010 Froix
Attachments
flexscreeny.png
flexscreeny.png (17.29 KiB) Viewed 4319 times
flextunnels.tar
(117.5 KiB) Downloaded 315 times
User avatar
DJ Nekkid
Tycoon
Tycoon
Posts: 2141
Joined: 30 Nov 2006 20:33

Re: Flexible Tunnels

Post by DJ Nekkid »

try this piece of code:

Code: Select all

-1 * 0  09 <parameter number> 01 \7! <value to check for> <where to skip>
     <Things to do when this parameter is active>
     <Even more things to do>
     <Even even more things to do>
-1 * 2  10 <skip to here>
example from nutracks code:

Code: Select all

        // Enable ALL invisible engines (i.e. skip unless parameter 1 is 1)
        -1 * 0  09 \b1 01 \7! 01 11
                #include "support/all-invis.pnfo"
                #include "support/invisible.pnfo"
        -1 * 2  10 11
As a general tip I try to have the action10 (the "where to skip) named with the first digit is the parameter number, and the second digit is what "state" the parameter is (in this case, 11, because it skips to this when handling parameter1, and the state/value is 1

And other then this, i advise you to use Action14, altho this isnt supported in OpenTTD 1.0.x.

Code: Select all

-1 * 0 14   "C" "INFO"
                "B" "NPAR" \w1 \b03                 // Number of parameters
                "B" "PALS" \w1 "W"                  // Windows palette
                "B" "VRSN" \w4 \d{{REPO_REVISION}}  // GRF version (you should put something like "0.0.1" or similar here (withing quotation marks)
                00
            00
plus for the parameters itself:

Code: Select all

-1 * -1   14 "C" "INFO"
                  "C" "PARA"
                      "C" \d0                           // Parameter number
                          "B" "TYPE" \w1 0         // What type, if its "multiple choise" 0 is a good number
                          "B" "LIMI" \w8 \d0 \d3 // Limits of the parameter, from low to high, in this case 0 is low and 3 is high (i.e. anything from 0 to 3 can be used)
                          "B" "DFLT" \w4 \d0      // The default value of the parameter, in this case 0
                          "T" "NAME" LANG_ID "Parameter0 name" 00
                          "T" "DESC" LANG_ID "Parameter0 discription" 00
                          "C" "VALU" 
                              "T" \d0 LANG_ID "Value0 'name'" 00 
                              "T" \d1 LANG_ID "Value1 'name'" 00
                              "T" \d2 LANG_ID "Value2 'name'" 00
                              "T" \d3 LANG_ID "Value3 'name'" 00
                              00
                          00
                      00
                  00
              00
Note: The LANG_ID is what translation is used here. Usually if you dont provide any translations, its 7F

You might want to take a look at sprites/nfo/header.pnfo and sprites/nfo/action14/param.pnfo of nutracks... Note that we use a preprocessor to make templates and stuff, but the code is still valid, but everything written in UPPER CASE is changed into something different. Usually from ids.pnfo or a language files (in strings/7F_english.pnfo or similar)
Member of the
ImageImage
User avatar
Froix
Engineer
Engineer
Posts: 65
Joined: 16 Jul 2010 13:09

Re: Flexible Tunnels

Post by Froix »

My coding seems to be working ok so far. I already have action 14 in my code not as neatly coded as yours though and apparently I'm missing a few important stuff in my parameters. Thanks DJ!
Post Reply

Return to “Graphics Development”

Who is online

Users browsing this forum: Google Adsense [Bot] and 64 guests