Cargo ID for stations- tanslation for labels ?

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

Dante123
Chief Executive
Chief Executive
Posts: 671
Joined: 11 Aug 2009 16:10
Location: The Nederlands
Contact:

Cargo ID for stations- tanslation for labels ?

Post by Dante123 »

Currently in my Station tile GRF i am working with Cargo ID's like this to support certain cargo's:

Code: Select all

...
....

       // graphics : check var60 for amount of waiting cargo and choose graphics set
  683 * 44	 02 04 
				15										// Set-ID
					89									// get dword
					60									// get var60 (amount of cargo waiting)
						1B								// check cargo type 00 (passengers) ---  http://wiki.ttdpatch.net/tiki-index.php?page=CargoTypes
					00 \dxFFFFFFFF						// get whole value
					03									// numRanges
					00 00		\d000	\d20			// use <SetID1> if cargo between 0 and 100
					16 00		\d21	\d75			// use <SetID2> if cargo between 101 and 1000
					26 00		\d76	\d250			// use <SetID3> if cargo between 1001 and 2000
					36 00								// use <SetID0> if cargo > 1001

....
...
now in this example i have used Cargo ID 1B.
now from this page: http://wiki.ttdpatch.net/tiki-index.php?page=CargoTypes you can see that for FIRS this ID is for Bauxite, but for ECS this ID is used for Sulphur.
now, what i have understood form a conversation i had earlier, i should be able to use cargo labels too, but need to set up some translation table.

now as far as i have seen, this is pretty complex coding (for me) and im not good at coding yet :P
now is there some good example around somewhere so i can see what to do ? so i can have a way more flexible grf ?
or is there someone willing to help me out ?
btw i was already trying to understand this page but not 100% there yet: http://wiki.ttdpatch.net/tiki-index.php ... n_table_09_
thanx!
User avatar
andythenorth
Tycoon
Tycoon
Posts: 5658
Joined: 31 Mar 2007 14:23
Location: Lost in Music

Re: Cargo ID for stations- tanslation for labels ?

Post by andythenorth »

Here is the translation table from HEQS. Feel free to modify it. Goes after the action 8 in your grf.

Your action 3s (or varaction 2) then refer to the position(s) in this table. So "PASS" is 00, "FOOD" is 0C, "TWOD" is 1E etc.

Far as I know ctt can be extended to more than 32 entries to support more industry sets (if needed).

Code: Select all

1 * 134	 00 08 01 20 00 09 // Cargo translation table
  "PASS" "COAL" "MAIL" "OIL_"     // 00 - 03, 01 - 08
  "LVST" "GOOD" "GRAI" "WOOD"     // 04 - 07, 10 - 80
  "IORE" "STEL" "VALU" "PAPR"     // 08 - 0B, 01^ - 08^
  "FOOD" "FRUT" "CORE" "WATR"     // 0C - 0F, 10^ - 80^
  "RUBR" "MILK" "PETR" "RFPR"     // 10 - 13, 01^^ - 08^^
  "ALUM" "SCRP" "CLAY" "___G"     // 14 - 17, 10^^ - 80^^
  "AORE" "SAND" "GRVL" "WHEA"     // 18 - 1B, 01^^^ - 08^^^
  "GOLD" "MAIZ" "TWOD" "DIAM"     // 1C - 1F, 10^^^ - 80^^^

For example of how varaction 2 uses this, here's some HEQS vehicle code:

Code: Select all

// choose appropriate sprites
  // case show wagon sprite
  -1 * 70	 02 01 A3  // choose sprites according to cargo slot (in cargo translation tt)
                 81 47 00 FF // var 47 in format ccccwwtt where I want tt 
                 \b22 // range
                   06 00  01 01 // coal
                   03 00  03 03 // oil
                   05 00  04 04 // livestock                  
                   0B 00  06 06 // grain (reuses sand)
                   04 00  07 07 // wood  
                   07 00  08 08 // iron ore
                   02 00  09 09 // steel                  
                   02 00  0B 0B // paper
                   0A 00  0E 0E // copper ore
                   03 00  0F 0F // water
                   02 00  10 10 // rubber
                   03 00  11 11 // milk
                   03 00  12 12 // fuel oil (petrol)
                   03 00  13 13 // chemicals (refined products)
                   08 00  15 15 // scrap metal 
                   08 00  16 16 // clay 
                   0A 00  18 18 // bauxite (aluminium ore) 
                   0B 00  19 19 // sand (also used by grain, wheat etc)
                   09 00  1A 1A // gravel 
                   0B 00  1B 1B // wheat (reuses sand)
                   0B 00  1D 1D // maize (reuses sand)
                   04 00  1E 1E // tropical wood
                 02 00 // default 
michael blunck
Tycoon
Tycoon
Posts: 5948
Joined: 27 Apr 2005 07:09
Contact:

Re: Cargo ID for stations- tanslation for labels ?

Post by michael blunck »

andythenorth wrote: [on CTTs]

Far as I know ctt can be extended to more than 32 entries to support more industry sets (if needed).
Refittable cargoes should go into the first 32 entries. Non-refittables have no need for that.

regards
Michael
Image
Yexo
Tycoon
Tycoon
Posts: 3663
Joined: 20 Dec 2007 12:49

Re: Cargo ID for stations- tanslation for labels ?

Post by Yexo »

andythenorth wrote:
michael blunck wrote:Refittable cargoes should go into the first 32 entries. Non-refittables have no need for that.
How is that applied in the case of a station set (as Dante is doing)?
In case of a non-vehicle set it doesn't matter, you can use as many entries as you like.
michael blunck
Tycoon
Tycoon
Posts: 5948
Joined: 27 Apr 2005 07:09
Contact:

Re: Cargo ID for stations- tanslation for labels ?

Post by michael blunck »

@Andy

It´s all mentioned in the Wiki:
Wiki wrote: Each entry means that the corresponding cargo is meant when using this ID in an action 3 or for a bit in the vehicle's refit mask.
[...]
Because the refit mask contains only 32 bits, only the first 32 entries in the translation table can make use of the refit mask.

http://wiki.ttdpatch.net/tiki-index.php ... n_table_09_
regards
Michael
Image
Dante123
Chief Executive
Chief Executive
Posts: 671
Joined: 11 Aug 2009 16:10
Location: The Nederlands
Contact:

Re: Cargo ID for stations- tanslation for labels ?

Post by Dante123 »

ok so if i have understood correct:

this code

Code: Select all

1 * 134    00 08 01 20 00 09 // Cargo translation table
  "PASS" "COAL" "MAIL" "OIL_"     // 00 - 03, 01 - 08
  "LVST" "GOOD" "GRAI" "WOOD"     // 04 - 07, 10 - 80
  "IORE" "STEL" "VALU" "PAPR"     // 08 - 0B, 01^ - 08^
  "FOOD" "FRUT" "CORE" "WATR"     // 0C - 0F, 10^ - 80^
  "RUBR" "MILK" "PETR" "RFPR"     // 10 - 13, 01^^ - 08^^
  "ALUM" "SCRP" "CLAY" "___G"     // 14 - 17, 10^^ - 80^^
  "AORE" "SAND" "GRVL" "WHEA"     // 18 - 1B, 01^^^ - 08^^^
  "GOLD" "MAIZ" "TWOD" "DIAM"     // 1C - 1F, 10^^^ - 80^^^
i just this on sprite 2 or 3 and this will count for the whole grf ?
or does it work until it finds another table (for example at sprite 100)

more questions:
- what are those numbers 01-08 / 10-80 / ... ?
- can i refer to more than 1 label with 1 number ?

now i use this code

Code: Select all

  683 * 44	 02 04 
				15										// Set-ID
					89									// get dword
					60									// get var60 (amount of cargo waiting)
						1B								// check cargo type 00 (passengers) ---  http://wiki.ttdpatch.net/tiki-index.php?page=CargoTypes
					00 \dxFFFFFFFF						// get whole value
					03									// numRanges
					00 00		\d000	\d20			// use <SetID1> if cargo between 0 and 100
					16 00		\d21	\d75			// use <SetID2> if cargo between 101 and 1000
					26 00		\d76	\d250			// use <SetID3> if cargo between 1001 and 2000
					36 00								// use <SetID0> if cargo > 1001
now this dont need changing as far as i see it now (exept the ID should become the ID from the translation label)
but can i add more than 1 cargo here ?
michael blunck
Tycoon
Tycoon
Posts: 5948
Joined: 27 Apr 2005 07:09
Contact:

Re: Cargo ID for stations- tanslation for labels ?

Post by michael blunck »

Dante123 wrote: [Cargo Translation Table - CTT]

[...] this will count for the whole grf ?
or does it work until it finds another table (for example at sprite 100)
You´ll only need 1 CTT in a newgrf. A second CTT will overwrite the values of the first one.
Dante123 wrote: more questions:
- what are those numbers 01-08 / 10-80 / ... ?
Forget them. Better yet, remove them. These are old "documention" approaches. And remove the rubbish "documentation" in your second code block as well. Especially if/when you don´t understand it.
Dante123 wrote: - can i refer to more than 1 label with 1 number ?
By a var60? No.
Dante123 wrote: [some code]
but can i add more than 1 cargo here ?
Here? No. But o/c, you might use an advanced action2 and base your decision on more than one var60/cargo value, if needed. Or you could chain more than one varaction2. Or you could end up with the same result w/o using var60, just by setting up a proper action3. Check the manual.

regards
Michael
Image
User avatar
andythenorth
Tycoon
Tycoon
Posts: 5658
Joined: 31 Mar 2007 14:23
Location: Lost in Music

Re: Cargo ID for stations- tanslation for labels ?

Post by andythenorth »

Dante123 wrote:o
i just this on sprite 2 or 3 and this will count for the whole grf ?
or does it work until it finds another table (for example at sprite 100)
I don't know. I use only 1 table in my grfs. I think OzTrans includes multiple tables, probably using action 6(?) to switch to the correct one.
- what are those numbers 01-08 / 10-80 / ... ?
I don't know - this is a table I was given by Zephyris. I should probably be able to work it out, but haven't yet :o
can i refer to more than 1 label with 1 number ?
Not as far as I know.
now i use this code
[snip]
now this dont need changing as far as i see it now (exept the ID should become the ID from the translation label)
yes
but can i add more than 1 cargo here ?
Yes.
You are already checking for three cargos. You're using 3 ranges, each range appears to cover multiple cargos. Look at the HEQS example I posted to see how a varaction 2 can check each cargo explicitly. EDIT - I might be wrong about this, I may have misread your code / misunderstood how stations work.
Dante123
Chief Executive
Chief Executive
Posts: 671
Joined: 11 Aug 2009 16:10
Location: The Nederlands
Contact:

Re: Cargo ID for stations- tanslation for labels ?

Post by Dante123 »

andythenorth wrote: Yes.
You are already checking for three cargos. You're using 3 ranges, each range appears to cover multiple cargos. Look at the HEQS example I posted to see how a varaction 2 can check each cargo explicitly. EDIT - I might be wrong about this, I may have misread your code / misunderstood how stations work.
im only checking for 1 cargo, but it is checking the values to know for what value to display what sprite.
michael blunck wrote: Here? No. But o/c, you might use an advanced action2 and base your decision on more than one var60/cargo value, if needed. Or you could chain more than one varaction2. Or you could end up with the same result w/o using var60, just by setting up a proper action3. Check the manual.
looking at action 3 i get some messy code looking like this:

Code: Select all

-1 * 	00 			// bites
		03			// action 3
		04			// 04 statoins
		03			//?? example - assosiate with 3 station ID's ??
		00 1B 20	//?? assosiate with station ID's 00 1B and 20
		2			// assosiate with 2 cargo types ?
		02 1B		// assosiate with cargo 02 and 1B from table
		<cid>		// ???
		<def-cid>	// ???
i still suck at coding, so this totally looks like its far, far from working.
it does not even refference to what sprite sheets it should use as my previous code does :/

but for example i want the "BDMT" (=Building Materials) from FIRS to work on the same station tile as the "BRCK" (=Bricks) from ECS.


so i guess with this code:

Code: Select all

       // graphics : check var60 for amount of waiting cargo and choose graphics set
  683 * 44	 02 04 
				15										// Set-ID
					89									// get dword
					60									// get var60 (amount of cargo waiting)
						1B								// check cargo type 00 (passengers) ---  http://wiki.ttdpatch.net/tiki-index.php?page=CargoTypes
					00 \dxFFFFFFFF						// get whole value
					03									// numRanges
					00 00		\d000	\d20			// use <SetID1> if cargo between 0 and 100
					16 00		\d21	\d75			// use <SetID2> if cargo between 101 and 1000
					26 00		\d76	\d250			// use <SetID3> if cargo between 1001 and 2000
					36 00								// use <SetID0> if cargo > 1001
i can only reffer to 1 cargo, but even with that cation 3, i dont have a clue what to write to get it to support both :/

@ michael: don't you have some example code where i can just change the values ?
michael blunck
Tycoon
Tycoon
Posts: 5948
Joined: 27 Apr 2005 07:09
Contact:

Re: Cargo ID for stations- tanslation for labels ?

Post by michael blunck »

Dante123 wrote: @ michael: don't you have some example code where i can just change the values ?
I´m not really sure what you´re going to achieve, but here´s a code snippet of a station´s action3:

Code: Select all

  217 * 25	 03 04 01 00 06
                        FF 25 00   // menu
                        05 21 00   // container
                        1A 24 00   // bricks
                        02 23 00   // crates
                        13 22 00   // plywood
                        FE 21 00   // single default: container
                        20 00      // default
And please read the spec about "FE" and "FF", before asking.

@moderators
Could this thread be moved into "graphics development"? All these recent "tutorials" have nothing to do with "NewGRF technical discussions". thanks.

regards
Michael
Image
User avatar
andythenorth
Tycoon
Tycoon
Posts: 5658
Joined: 31 Mar 2007 14:23
Location: Lost in Music

Re: Cargo ID for stations- tanslation for labels ?

Post by andythenorth »

michael blunck wrote:@moderators
Could this thread be moved into "graphics development"? All these recent "tutorials" have nothing to do with "NewGRF technical discussions". thanks.
Please in that case also change the topic for this forum from this:

Code: Select all

Discussions about the technical aspects of graphics development, including NewGRF tools and utilities.
- I think it's unclear where technical questions about nfo / nml should be asked.
Dante123
Chief Executive
Chief Executive
Posts: 671
Joined: 11 Aug 2009 16:10
Location: The Nederlands
Contact:

Re: Cargo ID for stations- tanslation for labels ?

Post by Dante123 »

FF and FE are clear after reading the wiki.
but for the other stuff, i just dont see it.
wiki only says to put the cargo id's in here.

but in your example i see 3 bits for each of the cargos'. wiki says nothing bout those other 2 bits...

somehow i feel more and more that the wiki is not really a wiki, its more a handout for people that alre into the world of coding already.. im not :/

also i see nowhere where i define what sprite to show when cargo is 0-20 21-50 .. and so on :/
User avatar
andythenorth
Tycoon
Tycoon
Posts: 5658
Joined: 31 Mar 2007 14:23
Location: Lost in Music

Re: Cargo ID for stations- tanslation for labels ?

Post by andythenorth »

Dante123 wrote:somehow i feel more and more that the wiki is not really a wiki, its more a handout for people that alre into the world of coding already.. im not :/
The wiki is a spec, not a tutorial. It's of almost no use for learning nfo / newgrf coding. It is of use once you've learnt what to do.

You could try for help in the irc channel #openttd. How much help you get depends on:
- who is there
- what mood they're in
- what else they're doing
- how good your questions are :)
Dante123
Chief Executive
Chief Executive
Posts: 671
Joined: 11 Aug 2009 16:10
Location: The Nederlands
Contact:

Re: Cargo ID for stations- tanslation for labels ?

Post by Dante123 »

andythenorth wrote:
Dante123 wrote:somehow i feel more and more that the wiki is not really a wiki, its more a handout for people that alre into the world of coding already.. im not :/
The wiki is a spec, not a tutorial. It's of almost no use for learning nfo / newgrf coding. It is of use once you've learnt what to do.

You could try for help in the irc channel #openttd. How much help you get depends on:
- who is there
- what mood they're in
- what else they're doing
- how good your questions are :)
so if its only just some random database, where should i learn about the coding without asking daily new questions and irritation people with my daily questions :tongue:

... and still im not 1 step closer to my goal for my grf... :tongue:
michael blunck
Tycoon
Tycoon
Posts: 5948
Joined: 27 Apr 2005 07:09
Contact:

Re: Cargo ID for stations- tanslation for labels ?

Post by michael blunck »

Dante123 wrote:FF and FE are clear after reading the wiki.
but for the other stuff, i just dont see it.
wiki only says to put the cargo id's in here.

but in your example i see 3 bits for each of the cargos'. wiki says nothing bout those other 2 bits...
You did not read that action3 chapter. The preamble already reads:
Wiki, action3 wrote:Action 3 assigns graphics sets (referenced to by (chains of) action 2(s) to feature IDs (vehicles, stations, houses, industries, ...).
Apart from this, your questions are quite unclear.

E.g., what do mean with "those other 2 bits"? I don´t see and "bits" here.

If you´re refering to that action3 code, it assigns c-ids ("cargo IDs")[*] to "cargo types". The cargo type being the number you´ve set in your CTT, e.g. "1B".
Dante123 wrote: somehow i feel more and more that the wiki is not really a wiki, its more a handout for people that alre into the world of coding already.. im not :/
The Wiki isn´t really a Wiki?
Dante123 wrote: also i see nowhere where i define what sprite to show when cargo is 0-20 21-50 .. and so on :/
Take a look again on my example. There´s even some documentation there which sprites to show (containers, crates, bricks, ...). Those numbers are the c-IDs from action2 chains.


I´m under the impression that you don´t really try to understand the more general scheme, you seem to only take a look on a very special single problem and then you´re complaining that it´s totally unclear.

Station coding is (together with industry coding) one of the more ambitious undertakings. You cannot master it in one day. You´ll need discipline and endurance. Instead, you immediately give up after having read the next sentence you do not understand.

Acting in this way, you cannot even ask the right questions. Which makes the whole task very ineffective.


[*] I´ll take another look on that page and change "cargo IDs" to "set IDs" in even more places.

HTH
regards
Michael
Image
Dante123
Chief Executive
Chief Executive
Posts: 671
Joined: 11 Aug 2009 16:10
Location: The Nederlands
Contact:

Re: Cargo ID for stations- tanslation for labels ?

Post by Dante123 »

ok

as a test
i put in this code:

Code: Select all

    3 * 134	 00 08 01 20 00 09 // Cargo translation table
				"RSGR" "POTA" "MAIL" "OIL_"     // 00 - 03
				"LVST" "COAL" "GRAI" "WOOD"     // 04 - 07
				"IORE" "STEL" "VALU" "PAPR"     // 08 - 0B
				"FOOD" "FRUT" "CORE" "WATR"     // 0C - 0F
				"AORE" "BDMT" "PETR" "RFPR"     // 10 - 13
				"ALUM" "SCRP" "CLAY" "CERA"     // 14 - 17
				"BRCK" "SAND" "GRVL" "PASS"     // 18 - 1B
				"GOLD" "MAIZ" "TWOD" "DIAM"     // 1C - 1F
in one of the sations i have put in

Code: Select all

  688 * 19	 03 04 
				   01 00 04
                   FF 16 00   						// menu
                   1B 15 00   						// container
				   05 51 00   						// container
                   FE 16 00   						// single default: container
                   00 00      						// default
and for those sprite 2 actions

Code: Select all

      ////// Action 02 : define a Set
  678 * 7	 02 04 00 00 01 \w0
  679 * 7	 02 04 16 00 01 \w1
  680 * 7	 02 04 26 00 01 \w2
  681 * 7	 02 04 36 00 01 \w3

....
....
....

  684 * 44	 02 04 
				15										// Set-ID
					89									// get dword
					60									// get var60 (amount of cargo waiting)
						1B								// check cargo type 00 (passengers) ---  http://wiki.ttdpatch.net/tiki-index.php?page=CargoTypes
					00 \dxFFFFFFFF						// get whole value
					03									// numRanges
					00 00		\d000	\d20			// use <SetID1> if cargo between 0 and 100
					16 00		\d21	\d75			// use <SetID2> if cargo between 101 and 1000
					26 00		\d76	\d250			// use <SetID3> if cargo between 1001 and 2000
					36 00								// use <SetID0> if cargo > 1001

       // graphics : check var60 for amount of waiting cargo and choose graphics set
  685 * 44	 02 04 
				51										// Set-ID
					89									// get dword
					60									// get var60 (amount of cargo waiting)
						05								// check cargo type 00 (passengers) ---  http://wiki.ttdpatch.net/tiki-index.php?page=CargoTypes
					00 \dxFFFFFFFF						// get whole value
					03									// numRanges
					00 00		\d000	\d20			// use <SetID1> if cargo between 0 and 100
					16 00		\d21	\d75			// use <SetID2> if cargo between 101 and 1000
					26 00		\d76	\d250			// use <SetID3> if cargo between 1001 and 2000
					36 00								// use <SetID0> if cargo > 1001
seems not to work for the "coal" (05) but "pass"(1B) passengers seems to work

so i really dont understand what is wrong now :|


**EDIT**
posting the whole station part on request:

sorry, note that comments behind the values are far from updated..

Code: Select all

      // Station tile referencing flat plain grass for ground sprite
      // substitute "SetID" for "cargoID" if necessary
      // Action 00 : define a station tile
  668 * 142	 00                                          	// 00 <Feature> <Num-props> <Num-info> <Id> (<Property <New-info>)...
                    04 07 01                                // 04 = Stations ; numProperties ; change 1 station
                    8C                                      // STAT-ID
                    08 "DWSE"                             	// StationClass
                    15 FF    11 00    14 FF                	// non-track ; no catenary ; no wires
															// subtract appropriate number from sprite number for monorail and maglev
                    09 08                                 	// var 09 = sprite layout  -  Define (2 orientations * 3 tiles) = 6 layouts
															// plus two layouts for build menu 
                       8D 0F 00 00                          // ground sprite = flat plain grass
                       00 00 00        0F 0F 10             // offsets; sizes
                       2D 04 00 00                          // draw sprite 042D (first linked Action 01 sprite)
                       80                                	// next Layout

                       8D 0F 00 00                          // ground sprite = flat plain grass
                       00 00 00        0F 0F 10             // offsets; sizes
                       2E 04 00 00
                       80                                	// next Layout

                       3B 0F 00 00                          // ground sprite = flat plain grass - 82
                       00 00 00        0F 0F 10             // offsets; sizes
                       2D 04 00 00
                       80                               	// next Layout

                       3B 0F 00 00                          // ground sprite = flat plain grass - 82
                       00 00 00        0F 0F 10             // offsets; sizes
                       2E 04 00 00
                       80                                	// next Layout

                       E9 0E 00 00                          // ground sprite = flat plain grass - 164
                       00 00 00        0F 0F 10             // offsets; sizes
                       2D 04 00 00
                       80                                	// next Layout

                       E9 0E 00 00                          // ground sprite = flat plain grass - 164
                       00 00 00        0F 0F 10            	// offsets; sizes
                       2E 04 00 00
                       80                                	// next Layout

                  // build menu 
                  F4 03 00 00      							// draw rail sprite since it is always flat 
                  00 00 00   0F 0F 10
                  2D 04 00 00      							// then draw Action 1 sprite over it. Should look ok as long as the sprite covers the whole tile
                  80

                  F3 03 00 00
                  00 00 00   0F 0F 10
                  2E 04 00 00
                  80

                    0B 03                                 	// callbacks: custom sprite layout
					13 01

      // Action 01 : define a set of graphics
	//////** For sprites that fill a whole tile, use the following for rels: **
	////** xrel = -(xSize-33) **
	////** yrel = -(ySize-31) **

  669 * 4	 01 04 04 02
	//////** pcxfile				 xpos	 ypos		 cmprssn 	ysize		 xsize		 xrel	 yrel **
  670 sprites\DWE_stat_r.pcx		25	  	1150		  01		  31		  64		 -31	 	+0			//2D 04   
  671 sprites\DWE_stat_r.pcx		25  	1200		  01		  31		  64		 -31	 	+0          //2E 04   

  672 sprites\DWE_stat_r.pcx		100	  	1150		  01		  31		  64		 -31	 	+0			//31 04   
  673 sprites\DWE_stat_r.pcx		100 	1200 		  01		  31		  64		 -31	 	+0          //32 04   

  674 sprites\DWE_stat_r.pcx		175	  	1150		  01		  31		  64		 -31	 	+0			//35 04   
  675 sprites\DWE_stat_r.pcx		175 	1200 		  01		  31		  64		 -31	 	+0          //36 04   

  676 sprites\DWE_stat_r.pcx		250  	1150		  01		  31		  64		 -31	 	+0			//39 04   
  677 sprites\DWE_stat_r.pcx		250 	1200 		  01		  31		  64		 -31	 	+0          //3A 04   

      ////// Action 02 : define a Set
  678 * 7	 02 04 00 00 01 \w0
  679 * 7	 02 04 16 00 01 \w1
  680 * 7	 02 04 26 00 01 \w2
  681 * 7	 02 04 36 00 01 \w3

   ////// make available from 1950
  682 * 14	 02 04
			0A 						// setID
			81						// type
			01 00 FF
			01						// numRanges
          00 80 00 00				// XX - 1920. So for 1950 = 00 80 00 1E             
          01 80						// allow

       // callback : check var42 for the track type and return a sprite layout from Action 00 (layouts are zero-indexed)
  683 * 23	 02 04 
               01                                         // Set-ID A
                  85                                      // get word
                  42                                      // get var42 (track type)
                  00 \wxFF00                             // do not add ; mask lower byte
                  02                                      // numRanges
                  02 80    \wx0200        \wx0200       // use layout 02 if monorail
                  04 80    \wx0300        \wx0300       // use layout 04 if maglev
                  00 80                                   // else use layout 00

       // graphics : check var60 for amount of waiting cargo and choose graphics set
  684 * 44	 02 04 
				15										// Set-ID
					89									// get dword
					60									// get var60 (amount of cargo waiting)
						1B								// check cargo type 00 (passengers) ---  http://wiki.ttdpatch.net/tiki-index.php?page=CargoTypes
					00 \dxFFFFFFFF						// get whole value
					03									// numRanges
					00 00		\d000	\d20			// use <SetID1> if cargo between 0 and 100
					16 00		\d21	\d75			// use <SetID2> if cargo between 101 and 1000
					26 00		\d76	\d250			// use <SetID3> if cargo between 1001 and 2000
					36 00								// use <SetID0> if cargo > 1001

       // graphics : check var60 for amount of waiting cargo and choose graphics set
  685 * 44	 02 04 
				51										// Set-ID
					89									// get dword
					60									// get var60 (amount of cargo waiting)
						05								// check cargo type 00 (passengers) ---  http://wiki.ttdpatch.net/tiki-index.php?page=CargoTypes
					00 \dxFFFFFFFF						// get whole value
					03									// numRanges
					00 00		\d000	\d20			// use <SetID1> if cargo between 0 and 100
					16 00		\d21	\d75			// use <SetID2> if cargo between 101 and 1000
					26 00		\d76	\d250			// use <SetID3> if cargo between 1001 and 2000
					36 00								// use <SetID0> if cargo > 1001

      // callback handler for normal graphics (non-build menu)
      // switch between callback and graphics branches
  686 * 17	 02 04    
               02                                       // Set-ID B
                  85 0C 00 FF FF                          // get word, check if callback
                  01                                      // one range
                  01 00    14 00    14 00                 // Set to use during callback 14
                  15 00                                   //** else use randomizer **

      // callback handler for build menu 
      // switch between callback and graphics branches
  687 * 23	 02 04    
               03                                       // Set-ID 03
                  85 0C 00 FF FF                          // get word, check if callback
                  02                                      // one range
				  0A 00    13 00    13 00
                  06 80    14 00    14 00                 // use layouts 06/07 during callback 14
                  16 00									//** else use randomizer **

  688 * 19	 03 04 
				   01 00 04
                   FF 16 00   						// menu
                   1B 15 00   						// container
				   05 51 00   						// container
                   FE 16 00   						// single default: container
                   00 00      						// default

  689 * 10	 03   04
                           01                           // <n-id> : one ID
                           8C            // STAT-ID         // support station ID
                           01                           // <num-cid> : support 1 cids
                           FF \wx03      // FF STAT-ID 00   // ID FF = build menu ; use ID 03
                           02 00                        // <def-cid> : always use

  690 * 49	 04 04 FF 01 \wxC58C "Bauxite - Bauxite Depots (Cargo-Dependent)" 00      // Use langID FF for all languages. Use C5xx for station names 
Dante123
Chief Executive
Chief Executive
Posts: 671
Joined: 11 Aug 2009 16:10
Location: The Nederlands
Contact:

Re: Cargo ID for stations- tanslation for labels ?

Post by Dante123 »

ok got it working now.

merged the 2 action 3 lines into 1 new line.


so first it was:

Code: Select all

  688 * 19    03 04 
               01 00 04
                   FF 16 00                     // menu
                   1B 15 00                     // container
               05 51 00                     // container
                   FE 16 00                     // single default: container
                   00 00                        // default

  689 * 10    03   04
                           01                           // <n-id> : one ID
                           8C            // STAT-ID         // support station ID
                           01                           // <num-cid> : support 1 cids
                           FF \wx03      // FF STAT-ID 00   // ID FF = build menu ; use ID 03
                           02 00                        // <def-cid> : always use

made this into

Code: Select all

  688 * 16	 03   04
                           01                           // <n-id> : one ID
                           8C            // STAT-ID         // support station ID
                           03                           // <num-cid> : support 1 cids
                           FF \wx03      // FF STAT-ID 00   // ID FF = build menu ; use ID 03
						   1B 15 00
						   05 51 00
                           02 00                        // <def-cid> : always use

but now i see strange glitches as shown here:
2.PNG
2.PNG (12.04 KiB) Viewed 7074 times
1.PNG
1.PNG (6.64 KiB) Viewed 7074 times
User avatar
andythenorth
Tycoon
Tycoon
Posts: 5658
Joined: 31 Mar 2007 14:23
Location: Lost in Music

Re: Cargo ID for stations- tanslation for labels ?

Post by andythenorth »

Doesn't fix your glitch, but FWIW, my preferred comment style for action 3 would be this:

Code: Select all

  688 * 16    03   04   01    8C // Action 3
        03 // Number of different cargo types to support
          FF  03 00   // ID FF = build menu ; use ID 03
          1B  15 00   // Passengers
          05  51 00   // Coal
        02 00 // default
Dante123
Chief Executive
Chief Executive
Posts: 671
Joined: 11 Aug 2009 16:10
Location: The Nederlands
Contact:

Re: Cargo ID for stations- tanslation for labels ?

Post by Dante123 »

yea sorry for the bat comments. i forget to proper comment for the sake of quick testing... but still glitching =(
Post Reply

Return to “Graphics Development”

Who is online

Users browsing this forum: No registered users and 52 guests