OpenTTD Source
20240917-master-g9ab0a47812
|
Go to the documentation of this file.
41 uint32_t r = Random();
110 }
else if ((v->
progress & 7) == 1) {
276 static const struct {
294 v->
x_pos += _inc_by_dir[b->direction].x;
295 v->
y_pos += _inc_by_dir[b->direction].y;
326 #define MK(x, y, z, i) { x, y, z, i }
327 #define ME(i) { i, 4, 0, 0 }
474 if ((v->
progress & 3) != 0)
return true;
494 if (b->y == 4 && b->x == 0) {
499 if (b->y == 4 && b->x == 1) {
507 if (b->y == 4 && b->x == 2) {
518 b = &_bubble_movement[v->
spritenum - 1][anim_state];
545 { SteamSmokeInit, SteamSmokeTick,
TO_INVALID },
546 { DieselSmokeInit, DieselSmokeTick,
TO_INVALID },
547 { ElectricSparkInit, ElectricSparkTick,
TO_INVALID },
549 { ExplosionLargeInit, ExplosionLargeTick,
TO_INVALID },
550 { BreakdownSmokeInit, BreakdownSmokeTick,
TO_INVALID },
551 { ExplosionSmallInit, ExplosionSmallTick,
TO_INVALID },
uint16_t animation_state
State primarily used to change the graphics/behaviour.
bool Chance16I(const uint32_t a, const uint32_t b, const uint32_t r)
Checks if a given randomize-number is below a given probability.
VehicleSpriteSeq sprite_seq
Vehicle appearance.
static debug_inline uint MaxX()
Gets the maximum X coordinate within the map, including MP_VOID.
void Set(SpriteID sprite)
Assign a single sprite to the sequence.
uint8_t spritenum
currently displayed sprite index 0xfd == custom sprite, 0xfe == custom second head sprite 0xff == res...
uint8_t y_extent
y-extent of vehicle bounding box
constexpr static debug_inline uint GB(const T x, const uint8_t s, const uint8_t n)
Fetch n bits from x, started at bit s.
SpriteID sprite
The 'real' sprite.
IndustryGfx GetIndustryGfx(Tile t)
Get the industry graphics ID for the given industry tile.
InitProc * init_proc
Function to initialise an effect vehicle after construction.
static const uint TILE_SIZE
Tile size in world coordinates.
ClientSettings _settings_client
The current settings for this game.
void AddAnimatedTile(TileIndex tile, bool mark_dirty)
Add the given tile to the animated tile table (if it does not exist yet).
@ MP_INDUSTRY
Part of an industry.
int GetSlopePixelZ(int x, int y, bool ground_vehicle)
Return world Z coordinate of a given point of a tile.
int32_t x_pos
x coordinate.
bool ambient
Play ambient, industry and town sounds.
static std::array< EffectProcs, EV_END > _effect_procs
Per-EffectVehicleType handling.
static bool IncrementSprite(EffectVehicle *v, SpriteID last)
Increment the sprite unless it has reached the end of the animation.
@ TO_INVALID
Invalid transparency option.
SoundSettings sound
sound effect settings
TileIndex tile
Current tile index.
#define lengthof(array)
Return the length of an fixed size array.
EffectVehicle * CreateEffectVehicleRel(const Vehicle *v, int x, int y, int z, EffectVehicleType type)
Create an effect vehicle above a particular vehicle.
bool Tick() override
Calls the tick handler of the vehicle.
MutableSpriteCache sprite_cache
Cache of sprites and values related to recalculating them, see MutableSpriteCache.
uint32_t SpriteID
The number of a sprite, without mapping bits and colourtables.
uint8_t progress
The percentage (if divided by 256) this vehicle already crossed the tile unit.
@ TO_INDUSTRIES
industries
int32_t z_pos
z coordinate.
EffectVehicle * CreateEffectVehicle(int x, int y, int z, EffectVehicleType type)
Create an effect vehicle at a particular location.
uint8_t subtype
subtype (Filled with values from AircraftSubType/DisasterSubType/EffectVehicleType/GroundVehicleSubty...
@ SND_2F_BUBBLE_GENERATOR_FAIL
47 == 0x2F Industry animation: bubble generator (2a): bubble pop
TransparencyOption
Transparency option bits: which position in _transparency_opt stands for which transparency.
static uint MaxY()
Gets the maximum Y coordinate within the map, including MP_VOID.
uint8_t animation_substate
Sub state to time the change of the graphics/behaviour.
int8_t x_offs
x offset for vehicle sprite
TickProc * tick_proc
Functions for controlling effect vehicles at each tick.
EffectVehicleType
Effect vehicle types.
static bool CanAllocateItem(size_t n=1)
Helper functions so we can use PoolItem::Function() instead of _poolitem_pool.Function()
A special vehicle is one of the following:
EffectVehicle * CreateEffectVehicleAbove(int x, int y, int z, EffectVehicleType type)
Create an effect vehicle above a particular location.
int32_t y_pos
y coordinate.
@ VS_UNCLICKABLE
Vehicle is not clickable by the user (shadow vehicles).
TransparencyOption transparency
Transparency option affecting the effect.
@ SND_31_BUBBLE_GENERATOR_SUCCESS
49 == 0x31 Industry animation: bubble generator (2b): bubble slurped
uint8_t x_extent
x-extent of vehicle bounding box
static debug_inline TileIndex TileVirtXY(uint x, uint y)
Get a tile from the virtual XY-coordinate.
static debug_inline bool IsTileType(Tile tile, TileType type)
Checks if a tile is a given tiletype.
constexpr T Clamp(const T a, const T min, const T max)
Clamp a value between an interval.
void UpdatePositionAndViewport()
Update the position of the vehicle, and update the viewport.
TransparencyOption GetTransparencyOption() const
Determines the transparency option affecting the effect.
int8_t y_offs
y offset for vehicle sprite
uint8_t z_extent
z-extent of vehicle bounding box
void UpdateDeltaXY() override
Updates the x and y offsets and the size of the sprite used for this vehicle.