Page 3 of 16
Re: [OTTD](V0.2)Station/NewObject tiles - Fences
Posted: 08 Nov 2010 18:46
by Dante123
got it =)
and yet 1 more question for now: how i i set a year at when certain entries get available ?
Re: [OTTD](V0.2)Station/NewObject tiles - Fences
Posted: 08 Nov 2010 23:49
by Lakie
OK, you'll have to bare with me, as it been a long time since I looked at station specific things.
From what I gather you'll need to specify that you'll be handling cb13,
bit 0 of property 0B.
Next in your
Action2 chain, you'll need to insert a callback sorter and filter for cb13.
Using various information (I'm presuming either action2 var 00/01 or 23/24), return either zero (disallow), or non-szero (allow).
An example of how it could look...
Code: Select all
# Disclaimer, I usually don't comment my action2's very much...
#Normal action2 (sprites above, etc)
0 * 0 02 04 00
00
01
00 00
# Specific start stop dates (not used)
# - Available from 1/1/1950 to 31/12/2050
0 * 0 02 04 10
89 # dword sized variable
23 # Current date (dword)
00 FF FF FF FF # No bit shift or mask
01 # One result
\wx8001 \d1950-1-1 \d2050-12-31 # Year-Month-Day
\wx8000
# Just using years
# - Unavailable from 0AD to 1949.
0 * 0 02 04 11
89
24 # Current Year (dword?)
00 FF FF FF FF
01
\wx8000 \d0 \d1949
\wx8001
# Callback sorter
0 * 0 02 04 20
85 # Word value size
0C # Current Callback
00 FF FF
01
11 00 \wx13 \wx13 # cb13 filter (chains to the one above)
00 00 # Graphics to use
# Action3
0 * 0 03 04
01 00
00
20 00 # leads to the callback sorter above
I'm unsure if this will produce what you after, (as I've not dealt with it before or tested it), but hope it helps anyway,
~ Lakie
Re: [OTTD](V0.2)Station/NewObject tiles - Fences
Posted: 09 Nov 2010 07:58
by DJ Nekkid
@Lakie:
Would not variable 23 be better if he is gonna sort it by date? 24 is year since 0, and 23 is date/day from year 0.
Re: [OTTD](V0.2)Station/NewObject tiles - Fences
Posted: 09 Nov 2010 17:04
by Lakie
That's why I mentioned both, one for dates (A10) and one for (generic) years (A11).

It was meant more to show him how its structured and how to use them, than a copy 'n' paste example.
~ Lakio
Re: [OTTD](V0.2)Station/NewObject tiles - Fences
Posted: 09 Nov 2010 17:18
by Dante123
ok just checking:
in this example:
Code: Select all
215 * 18 00 04 07 01 30 08 "FENC" 11 00 14 FF 15 FF 0A 00
216 * 4 01 04 01 02
217 C:\TTD\sprites\Fences.pcx 525 240 09 33 64 -15 +6
218 C:\TTD\sprites\Fences.pcx 600 240 09 32 63 -47 +7
219 * 7 02 04 00 00 01 00 00
220 * 7 03 04 01 30 00 00 00
221 * 31 04 04 9F 01 30 "ÅFence SIDE-Wall Tracks 2" 00
i need to add this line (after 216) to make it available in year 1949:
Code: Select all
217 * 4 02 04 11 89 24 00 FF FF FF FF 01 \wx8000 \d0 \d1949 \wx8001
or am i just plain stupid now?

Re: [OTTD](V0.2)Station/NewObject tiles - Fences
Posted: 09 Nov 2010 17:26
by Lakie
Not quite, you need a callback sorter which chains to that sprite. (Also it'd be available from 1950, not 1949).
The ranges of the Action2var are inclusive.
Code: Select all
# Need to indicate we'll be handling callback 13 (0B 01)
215 * 20 00 04 06 01 30 08 "FENC" 11 00 14 FF 15 FF 0A 00 0B 01
216 * 4 01 04 01 02
217 C:\TTD\sprites\Fences.pcx 525 240 09 33 64 -15 +6
218 C:\TTD\sprites\Fences.pcx 600 240 09 32 63 -47 +7
219 * 7 02 04 00 00 01 00 00
# this handles which value to return to OpenTTD / TTDPatch
220 * 23 02 04 10 89 24 00 FF FF FF FF 01 \wx8000 \d0 \d1949 \wx8001
# This filters off callback 13
221 * 17 02 04 20 85 0C 00 FF FF 01 10 00 \wx13 \wx13 00 00
# This points to the callback sorter
222 * 7 03 04 01 30 00 20 00
223 * 31 04 04 9F 01 30 "ÅFence SIDE-Wall Tracks 2" 00
[edit]
Are you decompiling the grf to regenerate the source?
As this looks quite a lot like decoded nfo, there is no need to do so.
Also using whitespace and comments (as I've shown above) can improve readability.
~ Lakie
Re: [OTTD](V0.2)Station/NewObject tiles - Fences
Posted: 09 Nov 2010 18:06
by Dante123
Lakie wrote:Not quite, you need a callback sorter which chains to that sprite. (Also it'd be available from 1950, not 1949).
The ranges of the Action2var are inclusive.
Code: Select all
# Need to indicate we'll be handling callback 13 (0B 01)
215 * 20 00 04 06 01 30 08 "FENC" 11 00 14 FF 15 FF 0A 00 0B 01
216 * 4 01 04 01 02
217 C:\TTD\sprites\Fences.pcx 525 240 09 33 64 -15 +6
218 C:\TTD\sprites\Fences.pcx 600 240 09 32 63 -47 +7
219 * 7 02 04 00 00 01 00 00
# this handles which value to return to OpenTTD / TTDPatch
220 * 23 02 04 10 89 24 00 FF FF FF FF 01 \wx8000 \d0 \d1949 \wx8001
# This filters off callback 13
221 * 17 02 04 20 85 0C 00 FF FF 01 10 00 \wx13 \wx13 00 00
# This points to the callback sorter
222 * 7 03 04 01 30 00 20 00
223 * 31 04 04 9F 01 30 "ÅFence SIDE-Wall Tracks 2" 00
[edit]
Are you decompiling the grf to regenerate the source?
As this looks quite a lot like decoded nfo, there is no need to do so.
Also using whitespace and comments (as I've shown above) can improve readability.
~ Lakie
ok i think i get it, i will give it a go.
as far as i know im not using a decoded version. Conroy made the first setup for me (approx the first 50 lines), and once i started to see some sense in it together with the wiki i started to add more and more and i still keep PMing conroy too

Re: [OTTD](V0.2)Station/NewObject tiles - Fences
Posted: 09 Nov 2010 20:08
by Dante123
the years work like a charm

thank lakie!

Re: [OTTD](V0.3)Station/NewObject tiles - Fences
Posted: 10 Nov 2010 19:18
by Dante123
check out the first post of this topic for the new 0.3 release!!
http://www.tt-forums.net/viewtopic.php?p=911187#p911187
Re: [OTTD](V1.0)Station/NewObject tiles - Fences
Posted: 11 Nov 2010 16:00
by Dante123
check out the first post of this topic for the new 1.0 release!!
http://www.tt-forums.net/viewtopic.php?p=911187#p911187
and also another question.
when i have a sprite drawn, how on earth do i get a tile with the rail on it where i put the sprite on ?
i just cant seem to find what bits to set for that

Re: [OTTD](V1.0)Station/NewObject tiles - Fences
Posted: 11 Nov 2010 16:04
by Dwight_K._Schrute
Very nice! I like them a lot

Re: [OTTD](V1.0)Station/NewObject tiles - Fences
Posted: 11 Nov 2010 16:18
by Dante123
Dwight_K._Schrute wrote:Very nice! I like them a lot

thanks

great to hear

thats where i do it for (this motivates me to start on a second grf

)
Re: [OTTD]DWE - Station/NewObject tiles Set
Posted: 11 Nov 2010 22:34
by Dante123
started work on the first station terrain tiles.
here the first experiment:

- 1.PNG (3.41 KiB) Viewed 5423 times
Question:
whatever i try, i cant get it working to have a rail in my tile getting displayed so i can put over my sprite as overlay.
anyone can help me out on that one ?
Re: [OTTD]DWE - Station/NewObject tiles Set
Posted: 12 Nov 2010 02:18
by oberhümer
Suggestion: make the posts of the fences less dark. Easy and would make them look a lot better.
Re: [OTTD]DWE - Station/NewObject tiles Set
Posted: 12 Nov 2010 08:39
by zero.eight
Dante123 wrote:Question:
whatever i try, i cant get it working to have a rail in my tile getting displayed so i can put over my sprite as overlay.
anyone can help me out on that one ?
What have you tried? You need to define at least two sprites in each layout to get this to work, one of which is the rail sprite.
Re: [OTTD]DWE - Station/NewObject tiles Set
Posted: 12 Nov 2010 15:39
by Dante123
zero.eight wrote:Dante123 wrote:Question:
whatever i try, i cant get it working to have a rail in my tile getting displayed so i can put over my sprite as overlay.
anyone can help me out on that one ?
What have you tried? You need to define at least two sprites in each layout to get this to work, one of which is the rail sprite.
i was using this wiki page:
http://wiki.ttdpatch.net/tiki-index.php ... n0Stations
but i just dont know what bits to set and how to put it
i already have this example code from some decompiled grf
Code: Select all
17 * 114 00 04 08 01 $$ 08 44 53 53 03 0B 02 0C FE 0D FD 11 00 14 FF 15 FF 09 06 F4 03 00 00 00 00 00 10
10 10 2D 04 00 00 80 F3 03 00 00 00 00 00 10 10 10 2F 04 00 00 80 F4 03 00 00 00 00 00 10 10 10
31 04 00 00 80 F3 03 00 00 00 00 00 10 10 10 32 04 00 00 80 F4 03 00 00 00 00 00 10 10 10 2E 04
00 00 80 F3 03 00 00 00 00 00 10 10 10 30 04 00 00 80
now i already know and understand that on the place of the $$ should be a sprite number

but all the rest....
Re: [OTTD]DWE - Station/NewObject tiles Set
Posted: 12 Nov 2010 17:34
by Lakie
Code: Select all
17 * 114 00 04 08 01 $$
...
09
06
F4 03 00 00 # <-- Ground sprite, usually tracks. (1012, should be adjusted by TTD automatically, iirc)
00 00 00 10 10 10 2D 04 00 00 # <-- Extra sprites to draw on top (this one has a bounding box)
80 # <-- Marks the end of extra sprite list
...
Actually the $$ is the station number (grf specific, iirc).
I suggest you break down the code into the various parts, it makes it a lot easier to read and understand.
~ Lakie
Re: [OTTD]DWE - Station/NewObject tiles Set
Posted: 12 Nov 2010 19:28
by Dante123
yea i was already trying to break it down, but because i only have decompiled examples, all is in huge spaghetti looking strings. at some points i just cant find at what point to break it down again, and some stuff i just cant find back on the wiki.
Re: [OTTD]DWE - Station/NewObject tiles Set
Posted: 12 Nov 2010 19:43
by Dante123
Code: Select all
00 00 00 10 10 10 2D 04 00 00 # <-- Extra sprites to draw on top (this one has a bounding box)
this i cant find back on the wiki =( but how/where does this define what sprite is getting drawn ?
edit:
seems to have something working..
only this part:
Code: Select all
F4 03 00 00 # <-- Ground sprite, usually tracks. (1012, should be adjusted by TTD automatically, iirc)
this seems to be de empty ground sprite. but how do i define the rail sprite in here ? (and does this also cover the monorail/normal/(newgrf metro rail))
again i just dont see a rail, only empty normal ground
Re: [OTTD]DWE - Station/NewObject tiles Set
Posted: 12 Nov 2010 22:15
by Lakie
I suggest you read all of the
property 09 information, including the sub heading "Number of tiles supported" stuff.
The second block is actually described 3rd and 4th tables, the literally 80 marks the end of the sprite list.
~ Lakie