FS#4263 - Extended control over vehicle smoke

Attached to Project: OpenTTD
Opened by andythenorth (andythenorth) - Wednesday, 24 November 2010, 12:15 GMT
Last edited by andythenorth (andythenorth) - Monday, 13 March 2017, 21:23 GMT
Type Feature Request
Category NewGRF
Status Closed
Assigned To andythenorth (andythenorth)
Operating System All
Severity Medium
Priority Normal
Reported Version Version?
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 1
  • Kogut (Kogut) (2010-11-25)
Private No


r21240 added support for visual effects (smoke etc) for RVs and ships, which is awesome

For ships, the current method of specifying a z offset for one effect vehicle is insufficient. Ships may have:
- n funnels (n<6 in a sane world)
- funnels offset laterally (at sides of ships)
- end of funnel may be somewhat higher than default z index for smoke (currently 10)
- ships should be able to produce diesel smoke constantly, not just when accelerating

Having discussed with frosch, a solution might be...

frosch123: i mean, call the callback everytime a smoke cloud needs to be created, and the cb returns the amount of clouds and their positions. all at once in one cb


*newgrf spec*
modify CB10 to be called more often (for visual effects only)

return the number of effects in the higher bits of cb10 result

maybe return the positions in register 100, 101, ... (tempoary result registers, no persistent storage)

positions need to encode xyz positions

loop n times (number of vehicles to draw)
int x = _vehicle_smoke_pos[v->direction] * effect_offset_along + _vehicle_smoke_pos[(v->direction + 2) % 8] * effect_offset_lateral;
int y = _vehicle_smoke_pos[v->direction] * -effect_offset_lateral + _vehicle_smoke_pos[(v->direction + 2) % 8] * effect_offset_along;
^ I tested this in a hacky patch, appears to work for providing lateral offsets.

z position is allowed for already in code to add effect vehicle. It's hard-coded for 10 and would need to use a variable instead.

This task depends upon

Closed by  andythenorth (andythenorth)
Monday, 13 March 2017, 21:23 GMT
Reason for closing:  Implemented
Comment by andythenorth (andythenorth) - Tuesday, 03 April 2012, 16:04 GMT
Eddi|zuHause: or call the callback multiple times, var10 being the number of times it has already run. return coords, or "no further vehicle"
Comment by Michael Lutz (michi_cc) - Friday, 29 June 2012, 18:27 GMT
<andythenorth> I need:
<andythenorth> - n effect vehicles
<andythenorth> - arbitrary x / y / z positions
<andythenorth> - ideally I would have animation control to control smoke timing per vehicle, but not essential
<andythenorth> - ideally I would be able to use animation control to specify smoke generation, independent of current acceleration algorithm used
<andythenorth> I don't need:
<andythenorth> - the ability to create new effect vehicles
<andythenorth> - the ability to control what happens within the effect vehicle
<andythenorth> (i.e. they're fire and forget as far as I'm concerned)
<andythenorth> the two points above about animation control collapse to the same point I think
Comment by andythenorth (andythenorth) - Monday, 13 March 2017, 21:18 GMT
Supported in newgrf some while ago.