pick sprite dep. on adjecent one ? Help!
Moderator: Graphics Moderators
pick sprite dep. on adjecent one ? Help!
Pretty basic question:
For station tiles, how do i pick a sprite depending on a specific one that is adjacent to it ?
for example i have 4 ways of placing a Bufferstop tile (NE-SE-SW-NW)
now i know how i can code it as pairs, but in that case it will be 2 separate station ID numbers.
i know of some sets that already do that trick (Japanese set/ISR set/...) they have it auto picked once specific tiles are built next to it (so it does not count for any station tile that is next to it)
but i have no idea what action to use for this, (my guess would be action 9 ? ) and i have no idea how it should be looking like.
is there someone that can explain just a bit and maybe (please) add some example code ?
For station tiles, how do i pick a sprite depending on a specific one that is adjacent to it ?
for example i have 4 ways of placing a Bufferstop tile (NE-SE-SW-NW)
now i know how i can code it as pairs, but in that case it will be 2 separate station ID numbers.
i know of some sets that already do that trick (Japanese set/ISR set/...) they have it auto picked once specific tiles are built next to it (so it does not count for any station tile that is next to it)
but i have no idea what action to use for this, (my guess would be action 9 ? ) and i have no idea how it should be looking like.
is there someone that can explain just a bit and maybe (please) add some example code ?
- planetmaker
- OpenTTD Developer
- Posts: 9432
- Joined: 07 Nov 2007 22:44
- Location: Sol d
Re: pick sprite dep. on adjecent one ? Help!
You'll need to make use of an varaction2 sequence to decide upon the sprite to be used. Probably variables 45 and 68 and maybe 67 will help you. See http://wiki.ttdpatch.net/tiki-index.php ... y_tiles_68_
OpenTTD: manual | online content | translations | Wanted contributions and patches
#openttdcoop: blog | wiki | public server | DevZone | NewGRF web translator
DevZone - home of the free NewGRFs: OpenSFX | OpenMSX | OpenGFX | Swedish Rails | OpenGFX+ Trains|RV|Industries|Airports|Landscape | NML
Re: pick sprite dep. on adjecent one ? Help!
im really lacking coding skills to code something from scratch 
maybe anyone can help me with some code example i can look at to be able to understand how it works ?

maybe anyone can help me with some code example i can look at to be able to understand how it works ?
- planetmaker
- OpenTTD Developer
- Posts: 9432
- Joined: 07 Nov 2007 22:44
- Location: Sol d
Re: pick sprite dep. on adjecent one ? Help!
Right... you basically link from the Action3 to the varaction2 which then checks the variable(s), can branch further to further variable check until you (finally) branch to a normal action2. Here an example from a train which I coded, where I check the year in order to decide the sprite being drawn:
Similar you can do that for a station, sprite with your variables, too.
Code: Select all
1260 * 6 01 00 \b2 FF \wx0004 // two sets à 4 sprites (loading and loaded)
1261 src/gfx/bulk/rail_bauxite_temperate.png 0 0 01 24 8 -3 -12
1262 src/gfx/bulk/rail_bauxite_temperate.png 16 0 01 17 22 -14 -9
1263 src/gfx/bulk/rail_bauxite_temperate.png 48 0 01 12 32 -16 -8
1264 src/gfx/bulk/rail_bauxite_temperate.png 96 0 01 17 22 -6 -9
1265 src/gfx/bulk/rail_bauxite_temperate.png 126 0 01 24 8 -3 -12
1266 src/gfx/bulk/rail_bauxite_temperate.png 142 0 01 17 22 -14 -9
1267 src/gfx/bulk/rail_bauxite_temperate.png 174 0 01 12 32 -16 -8
1268 src/gfx/bulk/rail_bauxite_temperate.png 222 0 01 17 22 -6 -9
// Name: bulk_wagon_bauxite_early_group
1269 * 13 02 00 FD \b2 \b2 // action2 linking early wagon sprites
\w0 \w1
\w0 \w1
1270 * 6 01 00 \b2 FF \wx0004 // two sets à 4 sprites (loading and loaded)
1271 src/gfx/bulk/rail_bauxite_temperate.png 0 32 01 24 8 -3 -12
1272 src/gfx/bulk/rail_bauxite_temperate.png 16 32 01 17 22 -14 -9
1273 src/gfx/bulk/rail_bauxite_temperate.png 48 32 01 12 32 -16 -8
1274 src/gfx/bulk/rail_bauxite_temperate.png 96 32 01 17 22 -6 -9
1275 src/gfx/bulk/rail_bauxite_temperate.png 126 32 01 24 8 -3 -12
1276 src/gfx/bulk/rail_bauxite_temperate.png 142 32 01 17 22 -14 -9
1277 src/gfx/bulk/rail_bauxite_temperate.png 174 32 01 12 32 -16 -8
1278 src/gfx/bulk/rail_bauxite_temperate.png 222 32 01 17 22 -6 -9
// Name: bulk_wagon_bauxite_modern_group
1279 * 13 02 00 FC \b2 \b2 // action2 linking modern wagon sprites
\w0 \w1
\w0 \w1
// Name: bulk_wagon_bauxite_year_switch
1280 * 44 02 00 F8 89 // varaction2 deciding upon sprites used as function of year: action2-ID: F8, type 89
49 00 \dxFFFFFFFF // check variable 49 (build year); this is a varaction2, no further modification, mask 0xFFFFFFFF (use all bits of var 49)
\b1 // one range check
\wx00FD \dx00000000 \dx000007B2 // 0 .. 1970: bulk_wagon_bauxite_early_group (ID 0xFD)
\wx00FC // default: otherwise modern group (ID 0xFC)
...
1547 * 9 03 00 01 FF \wx0074 \b0 \wx00F8 // action3, (vehicleID 0x74), use (var)action2 ID 0xF8)
OpenTTD: manual | online content | translations | Wanted contributions and patches
#openttdcoop: blog | wiki | public server | DevZone | NewGRF web translator
DevZone - home of the free NewGRFs: OpenSFX | OpenMSX | OpenGFX | Swedish Rails | OpenGFX+ Trains|RV|Industries|Airports|Landscape | NML
Re: pick sprite dep. on adjecent one ? Help!
i was also looking at the buffers now how industrial station renewal did it.
his code looks like this:
the part i should be looking at is the part between // - - - -
will try to make sense out of that with the wiki and you code
his code looks like this:
Code: Select all
-1 * 82 00 04 07 01 10 08 "ISRI" 09 04 F4 03 00 00 00 00 00 10 10 01 2D 04 00 00 80 F3 03 00 00 00
00 00 10 10 01 2E 04 00 00 80 0E 04 00 00 00 00 00 10 10 01 2D 04 00 00 80 0D 04 00 00 00 00 00
10 10 01 2E 04 00 00 80 0B 02 0D FE 11 00 14 FF 15 FF
-1 * 4 01 04 03 02
-1 sprites/bb.pcx 34 3752 01 31 64 -31 0
-1 sprites/bb.pcx 114 3752 01 31 64 -31 0
-1 sprites/bb.pcx 194 3752 01 31 64 -31 0
-1 sprites/bb.pcx 274 3752 01 31 64 -31 0
-1 sprites/bb.pcx 354 3752 01 31 64 -31 0
-1 sprites/bb.pcx 434 3752 01 31 64 -31 0
-1 * 7 02 04 00 00 01 00 00
-1 * 7 02 04 01 00 01 01 00
-1 * 7 02 04 02 00 01 02 00
//- - - - - - - - - - - - - - - - - - - - - - - -
-1 * 14 02 04 06
81
45 00 01 01 02 00 01 01 01 00
-1 * 14 02 04 07
81
45 01 01 01 06 00 01 01 00 00
-1 * 18 02 04 03
81
42 00 FF 02 02 80 01 01 02 80 04 04 00 80
-1 * 14 02 04 04
81
0C 00 FF 01 03 00 14 14 07 00
-1 * 14 02 04 05
81
0C 00 FF 01 00 80 14 14 00 00
//- - - - - - - - - - - - - - - - - - - - - - - -
-1 * 10 03 04 01 10 01 FF 05 00 04 00
will try to make sense out of that with the wiki and you code

Re: pick sprite dep. on adjecent one ? Help!
mm nope, im just not getting it for stations :/
help still needed
help still needed

-
- Tycoon
- Posts: 5954
- Joined: 27 Apr 2005 07:09
- Contact:
Re: pick sprite dep. on adjecent one ? Help!
Read http://wiki.ttdpatch.net/tiki-index.php ... on_info_45_ and be enlightened.Dante123 wrote: help still needed
regards
Michael
Re: pick sprite dep. on adjecent one ? Help!
michael blunck wrote:Read http://wiki.ttdpatch.net/tiki-index.php ... on_info_45_ and be enlightened.Dante123 wrote: help still needed
regards
Michael
well yea that part i have been reading over and over again already. but enlightenment seems to fail

-
- Tycoon
- Posts: 5954
- Joined: 27 Apr 2005 07:09
- Contact:
Re: pick sprite dep. on adjecent one ? Help!
How about the pictures then? Sometimes, enlightenment comes by sound or touch, it may also come by watching pictures.Dante123 wrote:well yea that part i have been reading over and over again already. but enlightenment seems to failmichael blunck wrote:Read http://wiki.ttdpatch.net/tiki-index.php ... on_info_45_ and be enlightened.Dante123 wrote: help still needed
regards
Michael
Re: pick sprite dep. on adjecent one ? Help!
got it working

Who is online
Users browsing this forum: Amazon [Bot] and 6 guests