JGR's Patch Pack

Forum for technical discussions regarding development. If you have a general suggestion, problem or comment, please use one of the other forums.

Moderator: OpenTTD Developers

User avatar
wallyweb
Tycoon
Tycoon
Posts: 6102
Joined: 27 Nov 2004 15:05
Location: Canada

Re: Non Road station tiles

Post by wallyweb »

JGR wrote: 28 Aug 2022 23:02 I've add a flag to the roadstop_general_flags property (12) to do this.
https://jgrennison.github.io/OpenTTD-pa ... eral_flags
I just installed 48.2 and set prop 12 for non road tile bus terminal to 0x0A (value 10).

Code: Select all

// 12 D	General flags
		// This property sets general flags for this road stop type.
		// The property length is 4 bytes. The format is:
		// Bit	Value	Meaning
		// 0		1		Callback 141 needs random bits in variable 10
		// 1		2		Do not show one way road overlay sprites,
						// this should only be set if different graphics are provided for the different one-way states using bits 0..1 of variable 50.
		// 2		4		Do not show catenary graphics. This requires road_stops, version 2.
		// 3		8		Only allow drive-through stops (not bay stops). This requires road_stops, version 2.
		// 4		10		Do not automatically build connecting road pieces. This requires road_stops, version 3.
		// The default value is 0 (no flags enabled). 
	12 00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  0A 00 00 00   00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00
The 4 bays show the default sprites instead of mine and are grayed out (screenshot).
The two available sprites still get the road connection (savegame)
Prop 12 Test, Mar 28th, 1940.png
Prop 12 Test, Mar 28th, 1940.png (10.88 KiB) Viewed 2191 times
Here is a saved game:
Prop 12 Test, Mar 28th, 1940.sav
(9.25 KiB) Downloaded 41 times
User avatar
JGR
Tycoon
Tycoon
Posts: 2557
Joined: 08 Aug 2005 13:46
Location: Ipswich

Re: Non Road station tiles

Post by JGR »

wallyweb wrote: 10 Sep 2022 17:49
JGR wrote: 28 Aug 2022 23:02 I've add a flag to the roadstop_general_flags property (12) to do this.
https://jgrennison.github.io/OpenTTD-pa ... eral_flags
I just installed 48.2 and set prop 12 for non road tile bus terminal to 0x0A (value 10).

Code: Select all

// 12 D	General flags
		// This property sets general flags for this road stop type.
		// The property length is 4 bytes. The format is:
		// Bit	Value	Meaning
		// 0		1		Callback 141 needs random bits in variable 10
		// 1		2		Do not show one way road overlay sprites,
						// this should only be set if different graphics are provided for the different one-way states using bits 0..1 of variable 50.
		// 2		4		Do not show catenary graphics. This requires road_stops, version 2.
		// 3		8		Only allow drive-through stops (not bay stops). This requires road_stops, version 2.
		// 4		10		Do not automatically build connecting road pieces. This requires road_stops, version 3.
		// The default value is 0 (no flags enabled). 
	12 00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  0A 00 00 00   00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00
The 4 bays show the default sprites instead of mine and are grayed out (screenshot).
The two available sprites still get the road connection (savegame)

Prop 12 Test, Mar 28th, 1940.png
Here is a saved game:
Prop 12 Test, Mar 28th, 1940.sav
The value to use is 0x10 (i.e. decimal 16), this sets bit 4 (i.e. a value of 00010000 in binary notation).
A decimal value of 10 has two bits set.

In NFO documentation (newgrf-specs.tt-wiki.net and so on), a bit field table like this has the bit number (0 indexed in decimal) in the first column, the corresponding hexadecimal value as entered in the NFO file in the second column and the bit meaning in the third column.
Ex TTDPatch Coder
Patch Pack, Github
User avatar
wallyweb
Tycoon
Tycoon
Posts: 6102
Joined: 27 Nov 2004 15:05
Location: Canada

Re: Non Road station tiles

Post by wallyweb »

JGR wrote: 10 Sep 2022 18:56 The value to use is 0x10 (i.e. decimal 16), this sets bit 4 (i.e. a value of 00010000 in binary notation).
A decimal value of 10 has two bits set.

In NFO documentation (newgrf-specs.tt-wiki.net and so on), a bit field table like this has the bit number (0 indexed in decimal) in the first column, the corresponding hexadecimal value as entered in the NFO file in the second column and the bit meaning in the third column.
A glance at the progression of the values would have told me that 10 had to be hex. :oops:
Everything now works like a charm.
Thanks for your help.
User avatar
wallyweb
Tycoon
Tycoon
Posts: 6102
Joined: 27 Nov 2004 15:05
Location: Canada

Re: JGR's Patch Pack

Post by wallyweb »

A new roadstop animation question.
Saved game attached below.
Under Truck Station Orientation I have a Non Road Tiles class with a tower in the Drive Through Y-axis panel.
I have four frames for a looping animation of the tower.
It does not animate.
I have callback 140 to trigger the animation (Road stop is built).
I have callback 141 to decide the next animation frame.
I have callback 142 for animation speed.
What am I missing?
Attachments
55_RoadStop_Test.grf
(76.11 KiB) Downloaded 38 times
User avatar
JGR
Tycoon
Tycoon
Posts: 2557
Joined: 08 Aug 2005 13:46
Location: Ipswich

Re: JGR's Patch Pack

Post by JGR »

wallyweb wrote: 30 Sep 2022 10:53 A new roadstop animation question.
Saved game attached below.
Under Truck Station Orientation I have a Non Road Tiles class with a tower in the Drive Through Y-axis panel.
I have four frames for a looping animation of the tower.
It does not animate.
I have callback 140 to trigger the animation (Road stop is built).
I have callback 141 to decide the next animation frame.
I have callback 142 for animation speed.
What am I missing?
There are two truck stop classes labelled "Non Road Tiles" and neither of them appear to be animated in any way.

The "Highway" and "Road Stops" classes do appear to set some animation related things though.
The animation triggers value looks wrong, it's set to 0x100, probably you want a value of 1 instead?

There doesn't seem to be any sign of callbacks 141 or 142 anywhere? That said you shouldn't need these.

There doesn't seem to be any use of variable 0x49 (roadstop_animation_frame) so you wouldn't see anything different even if animation was working?

All of the stop types seem to have broken ground sprites.
Ex TTDPatch Coder
Patch Pack, Github
User avatar
wallyweb
Tycoon
Tycoon
Posts: 6102
Joined: 27 Nov 2004 15:05
Location: Canada

Re: JGR's Patch Pack

Post by wallyweb »

JGR wrote: 30 Sep 2022 16:46 There are two truck stop classes labelled "Non Road Tiles" and neither of them appear to be animated in any way.
Actually there are three. One has to scroll down to see the third, which is the one we want. The text description is "Service Facilities & Towers"
The "Highway" and "Road Stops" classes do appear to set some animation related things though.
Road Stops class contains "Mail Stops" and has randomization in each of X-Axis and Y-Axis drive through stops.
The first Non Road Tiles class contains "Postal Facility" and no randomization.
The second Non Road Tiles class contains "Stores & Warehouses" and no randomization.
Highway class contains "Truck Service" and has randomization in each of X-Axis and Y-Axis drive through stops.
The third Non Road Tiles class contains "Service Facility & Towers" and only the Y-axis is animated but not randomized.
The animation triggers value looks wrong, it's set to 0x100, probably you want a value of 1 instead?

Code: Select all

// 10 W	Animation triggers
		// This property sets the cargo types for random triggers.
		// This functions the same way as station (feature 4) property 18.
		// This is a bit mask of events that should trigger callback 140, allowing to change the animation state.
		// Bit	Value	Meaning										Happens on				Var 18
	// 0		1		Road stop is built								newly built tile	
		// 1		2		New cargo arrives at station						all tiles					Bits 8..15 contain the triggering cargo type
		// 2		4		Cargo removed from station						all tiles					Bits 8..15 contain the triggering cargo type
		// 3		8		Road vehicle enters stop (starts loading/unloading)	tile where the vehicle is	
		// 4		10		Road vehicle leaves stop (done loading/unloading)	tile where the vehicle is	
		// 5		20		Road vehicle loads/unloads cargo					tile where the vehicle is	
		// 6		40		Every 250 ticks								all tiles	
		// For bits 1 and 2: bits 8..15 of var 18 contain the triggering cargo type.
		// If your GRF has a cargo translation table, the cargo type will be an index in that table, or FFh if the cargo isn't in the table.
		// If you don't have a cargo translation table, the cargo type will simply be the climate-dependent cargo type number.
	10 00 00  00 00  00 00  00 01  00 01  00 01  00 00  00 00  00 00  00 00  00 00  00 00  00 01  00 01
Oops. My bad. Fixed to 01 00
There doesn't seem to be any sign of callbacks 141 or 142 anywhere? That said you shouldn't need these.
These only appear in "Service Facility & Towers". I'll remove them.
There doesn't seem to be any use of variable 0x49 (roadstop_animation_frame) so you wouldn't see anything different even if animation was working?
Wouldn't this be needed for the animation 4 frame sequence in "Service Facility & Towers"?
All of the stop types seem to have broken ground sprites.
You mentioned this in our previous discussion.
This is the code I'm using:

Code: Select all

  326 * 40	 02 F0 D6
	42 // 2 sprites following <groundsprite>
//---------------------------------------
	8D 0F 00 00 // <groundsprite> bare land
	03 00 // <flags> do not show bounding box
	00 00 // [<register/value>]
//---------------------------------------
	8D 0F 00 00 // <buildingsprite>
	10 00 // <flags>
	00 00 00  00 00 00 // <xoffset> <yoffset> <zoffset> <xextent> <yextent> <zextent>
	00 00 // [<register/value>]
//---------------------------------------
	91 80 00 80 // <buildingsprite>
	10 00 // <flags>
	00 00 00  10 10 57 // <xoffset> <yoffset> <zoffset> <xextent> <yextent> <zextent>
	00 00 // [<register/value>]
User avatar
JGR
Tycoon
Tycoon
Posts: 2557
Joined: 08 Aug 2005 13:46
Location: Ipswich

Re: JGR's Patch Pack

Post by JGR »

I've found the "Service Facilities & Towers" one.
Sorry I missed that, I wasn't sure what I was meant to be looking for before.

This does use variable 0x49 and it seems reasonable.

If you add callback 140, and correct the animation trigger value you ought to get somewhere.
wallyweb wrote: 30 Sep 2022 18:49

Code: Select all

  326 * 40	 02 F0 D6
	42 // 2 sprites following <groundsprite>
//---------------------------------------
	8D 0F 00 00 // <groundsprite> bare land
	03 00 // <flags> do not show bounding box
	00 00 // [<register/value>]
//---------------------------------------
	8D 0F 00 00 // <buildingsprite>
	10 00 // <flags>
	00 00 00  00 00 00 // <xoffset> <yoffset> <zoffset> <xextent> <yextent> <zextent>
	00 00 // [<register/value>]
//---------------------------------------
	91 80 00 80 // <buildingsprite>
	10 00 // <flags>
	00 00 00  10 10 57 // <xoffset> <yoffset> <zoffset> <xextent> <yextent> <zextent>
	00 00 // [<register/value>]
Why are you setting <flags> to these values?
03 00 // <flags> do not show bounding box
This comment is not correct.
The flags are for advanced functionality which you almost certainly won't need.
I suggest that you set the flag values to 0 and remove any remove any corresponding register IDs unless you've trying to do something specific, and you're setting the value of the corresponding registers.
Ex TTDPatch Coder
Patch Pack, Github
User avatar
OzTrans
Tycoon
Tycoon
Posts: 1674
Joined: 04 Mar 2005 01:07

Re: JGR's Patch Pack

Post by OzTrans »

wallyweb wrote: 30 Sep 2022 10:53 ...It does not animate.
I have callback 140 to trigger the animation (Road stop is built).
I have callback 141 to decide the next animation frame.
I have callback 142 for animation speed.
What am I missing?
You have missed nothing, the animation for road stops feature does not (yet) work.

@JGR : A few months ago, I tried all possible combinations of :

. Road stop animation info [property 0x0E] (looping/non-looping)
. Road stop callback flags [property 0x11 b1]
. Current animation frame [var 0x49]
. Animation frame of nearby tile [var 0x66]
. Callbacks 140/141 for road stops

... nothing worked. The best I came across was ...

. garbage in var 0x49
. game crashes galore (v0.48.0)

In the mean time I have found another solution for what I intended to do.

You need to go over your source code again.

My 5 cents ...
User avatar
JGR
Tycoon
Tycoon
Posts: 2557
Joined: 08 Aug 2005 13:46
Location: Ipswich

Re: JGR's Patch Pack

Post by JGR »

OzTrans wrote: 01 Oct 2022 04:29 You have missed nothing, the animation for road stops feature does not (yet) work.

@JGR : A few months ago, I tried all possible combinations of :
Why not say something about it a few months ago then.
OzTrans wrote: 01 Oct 2022 04:29 garbage in var 0x49
This information is actionable, and therefore it is now fixed.
OzTrans wrote: 01 Oct 2022 04:29 game crashes galore (v0.48.0)
If you've got some crash logs I can look at them, otherwise everything seems fine here.

I just made a simple animated road stop and it works.
Ex TTDPatch Coder
Patch Pack, Github
User avatar
wallyweb
Tycoon
Tycoon
Posts: 6102
Joined: 27 Nov 2004 15:05
Location: Canada

Re: JGR's Patch Pack

Post by wallyweb »

JGR wrote: 01 Oct 2022 11:32
OzTrans wrote: 01 Oct 2022 04:29 garbage in var 0x49
This information is actionable, and therefore it is now fixed.
Looking forward to it in the next release.
I just made a simple animated road stop and it works.
Do you have a GRF I can look at?
User avatar
JGR
Tycoon
Tycoon
Posts: 2557
Joined: 08 Aug 2005 13:46
Location: Ipswich

Re: JGR's Patch Pack

Post by JGR »

wallyweb wrote: 01 Oct 2022 12:02Do you have a GRF I can look at?
Here's a minimal test GRF
Attachments
roadstops_anim_nml.zip
(3.06 KiB) Downloaded 46 times
Ex TTDPatch Coder
Patch Pack, Github
User avatar
wallyweb
Tycoon
Tycoon
Posts: 6102
Joined: 27 Nov 2004 15:05
Location: Canada

Re: JGR's Patch Pack

Post by wallyweb »

JGR wrote: 01 Oct 2022 13:11 Here's a minimal test GRF
Thank you.
User avatar
OzTrans
Tycoon
Tycoon
Posts: 1674
Joined: 04 Mar 2005 01:07

Re: JGR's Patch Pack

Post by OzTrans »

JGR wrote: 01 Oct 2022 11:32Why not say something about it a few months ago then.
Before I lodge a bug-report, I must make sure it is actually a game issue and not something in my GRFs. I only wanted to misuse the animation frame, but found another solution, therefore this issue was not a priority for me.

No, I haven't got any crashlogs. Normally, I ignore them, because using the same save game over and over again (saving/reloading) may crash things.

Now, I have a far more pressing issue to be solved ...

The following works perfectly well in OpenTTD (v1.11.0) but it does not in JGR-PP (v0.48.0)

In Callback 1D (wagon attach), I want to compare the GRFID of the engine and the wagon to be attached, they must match.

8A 25 returns the GRFID of the engine, 89 25 returns the GRFID of the wagon and both are the same, and so far all is well,
but operator 13 returns 0x02, not 0x01 as expected.

Code: Select all

// CRTTRNCDE FEATURE(*VEH_TRAINS) TYPE(*VEH_DISPLAY) ACTION_2_ID(9D) FUNCTION(*WAGON_ATTACH) ;
//           ATT_RULE(*GRF_CHECK) MESSAGE("[GRF conflict : unable to attach vehicle.]")
 3237 * 30       02 00 00 89 1C 20 FF FF FF FF 13 25 00 FF FF FF FF 01 9D 00 01 00 00 00 01 00 00 00 02 80
 3238 * 23       02 00 9D 8A 25 00 FF FF FF FF 01 FF 00 01 00 00 00 00 00 00 00 00 00
User avatar
JGR
Tycoon
Tycoon
Posts: 2557
Joined: 08 Aug 2005 13:46
Location: Ipswich

Re: JGR's Patch Pack

Post by JGR »

OzTrans wrote: 03 Oct 2022 23:37
JGR wrote: 01 Oct 2022 11:32Why not say something about it a few months ago then.
Before I lodge a bug-report, I must make sure it is actually a game issue and not something in my GRFs. I only wanted to misuse the animation frame, but found another solution, therefore this issue was not a priority for me.

No, I haven't got any crashlogs. Normally, I ignore them, because using the same save game over and over again (saving/reloading) may crash things.

Now, I have a far more pressing issue to be solved ...

The following works perfectly well in OpenTTD (v1.11.0) but it does not in JGR-PP (v0.48.0)

In Callback 1D (wagon attach), I want to compare the GRFID of the engine and the wagon to be attached, they must match.

8A 25 returns the GRFID of the engine, 89 25 returns the GRFID of the wagon and both are the same, and so far all is well,
but operator 13 returns 0x02, not 0x01 as expected.

Code: Select all

// CRTTRNCDE FEATURE(*VEH_TRAINS) TYPE(*VEH_DISPLAY) ACTION_2_ID(9D) FUNCTION(*WAGON_ATTACH) ;
//           ATT_RULE(*GRF_CHECK) MESSAGE("[GRF conflict : unable to attach vehicle.]")
 3237 * 30       02 00 00 89 1C 20 FF FF FF FF 13 25 00 FF FF FF FF 01 9D 00 01 00 00 00 01 00 00 00 02 80
 3238 * 23       02 00 9D 8A 25 00 FF FF FF FF 01 FF 00 01 00 00 00 00 00 00 00 00 00
Could I suggest re-testing this in jgrpp v0.48.1 or later.
Ex TTDPatch Coder
Patch Pack, Github
User avatar
wallyweb
Tycoon
Tycoon
Posts: 6102
Joined: 27 Nov 2004 15:05
Location: Canada

Re: JGR's Patch Pack

Post by wallyweb »

JGR wrote: 01 Oct 2022 11:32
OzTrans wrote: 01 Oct 2022 04:29 garbage in var 0x49
This information is actionable, and therefore it is now fixed.
I found the source for this on GitHub, but now I can't remember where I found it.
User avatar
JGR
Tycoon
Tycoon
Posts: 2557
Joined: 08 Aug 2005 13:46
Location: Ipswich

Re: JGR's Patch Pack

Post by JGR »

wallyweb wrote: 04 Oct 2022 09:56
JGR wrote: 01 Oct 2022 11:32
OzTrans wrote: 01 Oct 2022 04:29 garbage in var 0x49
This information is actionable, and therefore it is now fixed.
I found the source for this on GitHub, but now I can't remember where I found it.
https://github.com/JGRennison/OpenTTD-p ... 695f625e0c
Ex TTDPatch Coder
Patch Pack, Github
User avatar
wallyweb
Tycoon
Tycoon
Posts: 6102
Joined: 27 Nov 2004 15:05
Location: Canada

Re: JGR's Patch Pack

Post by wallyweb »

JGR wrote: 04 Oct 2022 10:23 ...
Thank you.
User avatar
OzTrans
Tycoon
Tycoon
Posts: 1674
Joined: 04 Mar 2005 01:07

Re: JGR's Patch Pack

Post by OzTrans »

JGR wrote: 04 Oct 2022 08:32Could I suggest re-testing this in jgrpp v0.48.1 or later.
That worked in v0.48.4. Thank you.

However, now I have another big problem. In v0.48.4 one of my older rail station GRFs locks up the game immediately when starting a new game or loading one, with that GRF to be activated/present. This has not been the case in v0.48.0 (or even OpenTTD 12.1). What has changed ?
User avatar
JGR
Tycoon
Tycoon
Posts: 2557
Joined: 08 Aug 2005 13:46
Location: Ipswich

Re: JGR's Patch Pack

Post by JGR »

OzTrans wrote: 04 Oct 2022 23:30
JGR wrote: 04 Oct 2022 08:32Could I suggest re-testing this in jgrpp v0.48.1 or later.
That worked in v0.48.4. Thank you.

However, now I have another big problem. In v0.48.4 one of my older rail station GRFs locks up the game immediately when starting a new game or loading one, with that GRF to be activated/present. This has not been the case in v0.48.0 (or even OpenTTD 12.1). What has changed ?
Can you be specific about which one, I'll take a look later on.
Ex TTDPatch Coder
Patch Pack, Github
User avatar
OzTrans
Tycoon
Tycoon
Posts: 1674
Joined: 04 Mar 2005 01:07

Re: JGR's Patch Pack

Post by OzTrans »

JGR wrote: 04 Oct 2022 23:35Can you be specific about which one, I'll take a look later on.
I had a quick look at that old GRF and recompiled it. It is in the process for a complete rewrite. So far I have moved the rail waypoints to a new GRF and simply changed the now obsolete Action-3s in the old GRF to Action-Cs. NfoRenum has reported some issues with that, which I missed in the past, but OpenTTD and JGR-PP (up to 0.48.0) had no problems with that. So the initial examination of GRFs must have been tightened, thus the game gets into an indefinite loop now with this one (when pressing the 'Generate' or 'Load' button).

Not to worry, there is a lot of complexity in that GRF, like TTDPatch's legacy of limited availability of real sprites. Use of GRM and plenty of Action-7-9s as well as Action-6s. Also, generic callback for stations (CB 18) may now suddenly have something to say.

I'll start the game in debug mode (-d) to see whether I can get more info, although I cannot find the parameters to set; what is the best parameter setting of -d to use in case of problematic GRFs ?
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 2 guests