Transport Tycoon Forums

The place to talk about Transport Tycoon
It is currently Wed Oct 17, 2018 8:32 am

All times are UTC




Post new topic  Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Flexible Tunnels
PostPosted: Tue Sep 07, 2010 2:38 pm 
Offline
Engineer
Engineer
User avatar

Joined: Fri Jul 16, 2010 1:09 pm
Posts: 65
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 2876 times ]
flextunnels.tar [117.5 KiB]
Downloaded 207 times

_________________
Shanghai Maglev Inspired Track Set | OpenGFX+Trees | Flexible Tunnels | Monkey Bar Bridge | FS-Maglev Track
Top
   
 Post subject: Re: Flexible Tunnels
PostPosted: Tue Sep 07, 2010 4:43 pm 
Offline
Tycoon
Tycoon
User avatar

Joined: Thu Nov 30, 2006 8:33 pm
Posts: 2141
try this piece of code:
Code:
-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:
        // 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:
-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:
-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


Top
   
 Post subject: Re: Flexible Tunnels
PostPosted: Thu Sep 09, 2010 1:20 am 
Offline
Engineer
Engineer
User avatar

Joined: Fri Jul 16, 2010 1:09 pm
Posts: 65
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!

_________________
Shanghai Maglev Inspired Track Set | OpenGFX+Trees | Flexible Tunnels | Monkey Bar Bridge | FS-Maglev Track


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 9 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000-2018 phpBB Limited

Copyright © Owen Rudge/The Transport Tycoon Forums 2001-2018.
Hosted by Zernebok Hosting.