New Smoke

Contents

Effect spawning model

(implemented in r26747)

This controls when the vehicle emits a visual effect. The NewGRF can choose from a fixed set of models; more might be added in the future, but since this is performance critical NewGRFs cannot define their own models.

The spawning model is choosen via callback 10 resp. the properties mentioned there. Additional to the existing return values, these new values are available. The triggers for calling the callback and caching the result remain unchanged.

The spawning models match the classical visual effects:

Advanced effect creation

When 'advanced effects' are enabled, each time the vehicle wants to create visual effect, callback 160 called. The callback decides the position and look of the effect.

This callback is also called when a vehicle breaks down to decide the breakdown effect. This is enabled by setting the current "disable breakdown effect" flag (which will be renamed). Since callback failure means no effect the behaviour is compatible.

Input:

Result:

CB Failure: Draw no effect

Registers 100+x: Define x-th effect.

Note:

Custom effects

(not yet implemented)

When returning a custom effect from CB XXX, the effect is resolved similar to the rotor sprite of helicopters using an 'self' wagon-override.

TODO Is there some better variable other than second byte of var 10?

Animation:

TODO: Is using the number of 'moving' spritesets clever? Or should there be an explicit Action 0 property? And some other variable for the frame? The advantage of this is, that the effect vehicle can cache the Action2 and does not have to call the A123 chain for every frame.

Animation physics:

n B Number of effects (number of speed/offset pairs to follow)
speed B Number of ticks between animation frames
offset B Number of ticks between spawning of the effect (frame 0) and start of the animation (frame 1)
n B Number of effects (number of speed/offset pairs to follow)
speed B Number of ticks between changes to the Z position.
< 0: Decrement Z every -speed ticks
== 0: No movement
> 0: Increment Z every speed ticks
offset B Number of ticks between spawning of the effect and first Z change

Default effects

Effect Position Animation speed Z movement

L T X Y Z speed offset speed offset
Steam -8..7 0

10 16 8 8 4
Diesel 8 1 4 0
Electric 3 2 0 0
Air breakdown

6 (NW, NE, SE, SW)
5 (N, E, S, W)

0

2 16 8 4 0
Ground breakdown

4 4 5 8 0 0 0