Recycling VarAction2 blocks

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
XeryusTC
Tycoon
Tycoon
Posts: 15415
Joined: 02 May 2005 11:05
Skype: XeryusTC
Location: localhost

Recycling VarAction2 blocks

Post by XeryusTC »

I have a small problem with NFO atm. I define a number of stations each with their own Action1 block but they have a simular layout and could use the same VarAction2 and callback chain. However, when I try to use the same chain from different Action3s it always shows the same graphics of the station at which I defined the VarAction2 chain.
I managed to get the correct graphics too but it skipped the VarAction2 chain and just used the default TTD method of showing stations, something which will make it look very odd.
So I wonder, is there a method of using the same VarAction2 chain with different Action1 blocks?



PS: code can be found here: http://svn.openttdcoop.org/grfdev/dutch ... h_set.hnfo, it is mainly about the lights until the benches and the plant barges until the simple roofs.
Don't panic - My YouTube channel - Follow me on twitter (@XeryusTC) - Play Tribes: Ascend - Tired of Dropbox? Try SpiderOak (use this link and we both get 1GB extra space)
Image
OpenTTD: manual #openttdcoop: blog | wiki | public server | NewGRF pack | DevZone
Image Image Image Image Image Image Image
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Re: Recycling VarAction2 blocks

Post by DaleStan »

Yes. Copy and paste.
An action 2 always points to the same set(s) of graphics, regardless of the location of the action 2/3 which called it.
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
User avatar
mart3p
Tycoon
Tycoon
Posts: 1030
Joined: 31 Oct 2005 21:00
Location: UK

Re: Recycling VarAction2 blocks

Post by mart3p »

It is though, possible to reuse action 2 chains if they only return callback results.

So from the code you link to, this chain could be reused:

Code: Select all

   // Check if the bottom platform is in the middle
10 * 14	 02 04 01  81 41  08 0F  01  04 80  00 00  0C 80
10 * 14	 02 04 02  81 41  14 0F  01  01 00  02 0F  04 80
   // Check if the top platform is in the middle
10 * 14	 02 04 03  81  41 08 0F  01  00 80  00 00  0A 80
10 * 14	 02 04 04  81  41 14 0F  01  03 00  02 0F  02 80
   // General checks
10 * 10	 02 04 05  81 41  00 0F  01  06 80  01 0F  02 80  // Middle platforms
10 * 14	 02 04 06  81 41  04 0F  01  02 00  00 00  05 00  // Bottom platform
10 * 14	 02 04 07  81 41  00 0F  01  04 00  00 00  06 00  // Top platform
10 * 14	 02 04 08  81 41  08 0F  01  02 80  00 00  08 80  // Top platform with stairs
10 * 14	 02 04 09  81 41  10 0F  01  08 00  01 01  07 00  // Just one platform
But this has to be unique for each station, as it references real sprites:

Code: Select all

10 * 14	 02 04 0A  81 0C  00 FF  01  09 00  14 14  00 00  // The callback
Image
User avatar
XeryusTC
Tycoon
Tycoon
Posts: 15415
Joined: 02 May 2005 11:05
Skype: XeryusTC
Location: localhost

Re: Recycling VarAction2 blocks

Post by XeryusTC »

Hmm, that sounds like a proper solution, I will try it later today :).

EDIT: Seems like it works indeed, thank you Mart3p
Don't panic - My YouTube channel - Follow me on twitter (@XeryusTC) - Play Tribes: Ascend - Tired of Dropbox? Try SpiderOak (use this link and we both get 1GB extra space)
Image
OpenTTD: manual #openttdcoop: blog | wiki | public server | NewGRF pack | DevZone
Image Image Image Image Image Image Image
Post Reply

Return to “Graphics Development”

Who is online

Users browsing this forum: No registered users and 13 guests