NFO proposal: Road vehicle property 21, visual effects

Discussions about the technical aspects of graphics development, including NewGRF tools and utilities.

Moderator: Graphics Moderators

Post Reply
peter1138
OpenTTD Developer
OpenTTD Developer
Posts: 1646
Joined: 30 Mar 2005 09:43

NFO proposal: Road vehicle property 21, visual effects

Post by peter1138 » 27 Jan 2009 13:54

This is similar to visual effects for trains.

The value is a bitstuffed word, containing:

Bits 0-3: effect offset: a 4 bit signed value with 0 being the center of the vehicle.
Bits 4-5: effect type: same as for trains, 0 = default, 1 = steam, 2 = diesel, 3 = spark. As there is no default for road vehicles, 0 actually means no effect.
Bit 6: unused, as effect type of 0 is disable.
Bit 7: unused, there is no powered wagons concept for road vehicles.
Bits 8-11: 4 bit unsigned height offset for effect, 0 is at road level, 10 is where the effect is placed for trains.

The value can be set using callback 36, however it is only set once on build. This could be changed if desired.
Unlike effects for trains, effect offset applies to all effect types. None of the changes here affect effects for trains.
He's like, some kind of OpenTTD developer.

frosch
OpenTTD Developer
OpenTTD Developer
Posts: 979
Joined: 20 Dec 2006 13:31
Location: Aschaffenburg

Re: NFO proprosal: Road vehicle property 21, visual effects

Post by frosch » 27 Jan 2009 16:06

Ships! Ships! Ships!
(Though they are longer, the position offset should be enough, as effects far from center would look weird anyway when turning)

Wrt. the callback: It might be more useful when it is called on leaving the depot. So it can change after refitting.
⢇⡸⢸⠢⡇⡇⢎⡁⢎⡱⢸⡱⢸⣭⠀⢸⢜⢸⢸⣀⢸⣀⢸⣭⢸⡱⠀⢰⠭⡆⣫⠰⣉⢸⢸⠀⢰⠭⡆⡯⡆⢹⠁⠀⢐⠰⡁

peter1138
OpenTTD Developer
OpenTTD Developer
Posts: 1646
Joined: 30 Mar 2005 09:43

Re: NFO proprosal: Road vehicle property 21, visual effects

Post by peter1138 » 27 Jan 2009 16:14

Could be done for ships too, yes. The 4 bit height offset might need to be increased in that case...
He's like, some kind of OpenTTD developer.


User avatar
Thief^
Route Supervisor
Route Supervisor
Posts: 468
Joined: 10 Oct 2004 00:11

Re: NFO proprosal: Road vehicle property 21, visual effects

Post by Thief^ » 27 Jan 2009 17:53

peter1138 wrote:Could be done for ships too, yes. The 4 bit height offset might need to be increased in that case...
Well you could use the bit for powered wagons, as there aren't even wagons for ships, let alone powered wagons. That would extend it to 5 bits.

EDIT: or you could extend off the other end. I think you have 4 spare bits that way. I missed that first time.
Melt with the Shadows,
Embrace your destiny...

michael blunck
Tycoon
Tycoon
Posts: 5271
Joined: 27 Apr 2005 07:09
Contact:

Re: NFO proprosal: Road vehicle property 21, visual effects

Post by michael blunck » 27 Jan 2009 19:35

frosch wrote:Ships! Ships! Ships!
(Though they are longer, the position offset should be enough, as effects far from center would look weird anyway when turning) [...]
Unfortunately, a lot of modern vessels have their smoke stacks at the very end ... :|

regards
Michael
Image


peter1138
OpenTTD Developer
OpenTTD Developer
Posts: 1646
Joined: 30 Mar 2005 09:43

Re: NFO proprosal: Road vehicle property 21, visual effects

Post by peter1138 » 27 Jan 2009 21:35

Hmm, ships, would 5 bit signed be enough or 6 bit to be safe? That's -16 to 15 or -32 to 31 respectively.

To do this we should probably drop the train effect layout, like so:

Bits 0-1: effect type, same as above
Bits 2-7: unsigned 6 bit offset (0 to 63 game units, 32 is central)
Bits 8-12: unsigned 5 bit height offset (0 to 31 pixels)

EDIT: Effect offset for trains is not signed, it is 0 to 15 with 8 being the centre. I have modified the list to match.
He's like, some kind of OpenTTD developer.

DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Re: NFO proprosal: Road vehicle property 21, visual effects

Post by DaleStan » 27 Jan 2009 22:50

"Unused" is generally a bad plan. "Must be zero"/"must be clear" is much better. That way no one can complain when setting the bit starts doing something.
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

peter1138
OpenTTD Developer
OpenTTD Developer
Posts: 1646
Joined: 30 Mar 2005 09:43

Re: NFO proprosal: Road vehicle property 21, visual effects

Post by peter1138 » 29 Jan 2009 10:24

I think that's avoided with the new proposed layout, although we could say bits 13-14 must be clear...
He's like, some kind of OpenTTD developer.

Post Reply

Return to “NewGRF Technical Discussions”

Who is online

Users browsing this forum: No registered users and 1 guest