OpenTTD Source 20241224-master-gee860a5c8e
texteff.hpp File Reference

Functions related to text effects. More...

#include "economy_type.h"
#include "gfx_type.h"
#include "strings_type.h"

Go to the source code of this file.

Typedefs

using TextEffectID = uint16_t
 

Enumerations

enum  TextEffectMode : uint8_t { TE_RISING , TE_STATIC }
 Text effect modes. More...
 

Functions

TextEffectID AddTextEffect (StringID msg, int x, int y, uint8_t duration, TextEffectMode mode)
 
void InitTextEffects ()
 
void DrawTextEffects (DrawPixelInfo *dpi)
 
void UpdateTextEffect (TextEffectID effect_id, StringID msg)
 
void RemoveTextEffect (TextEffectID effect_id)
 
void UpdateAllTextEffectVirtCoords ()
 
TextEffectID ShowFillingPercent (int x, int y, int z, uint8_t percent, StringID colour)
 Display vehicle loading indicators.
 
void UpdateFillingPercent (TextEffectID te_id, uint8_t percent, StringID colour)
 Update vehicle loading indicators.
 
void HideFillingPercent (TextEffectID *te_id)
 Hide vehicle loading indicators.
 
void ShowCostOrIncomeAnimation (int x, int y, int z, Money cost)
 Display animated income or costs on the map.
 
void ShowFeederIncomeAnimation (int x, int y, int z, Money transfer, Money income)
 Display animated feeder income.
 

Variables

static const TextEffectID INVALID_TE_ID = UINT16_MAX
 

Detailed Description

Functions related to text effects.

Definition in file texteff.hpp.

Typedef Documentation

◆ TextEffectID

using TextEffectID = uint16_t

Definition at line 25 of file texteff.hpp.

Enumeration Type Documentation

◆ TextEffectMode

enum TextEffectMode : uint8_t

Text effect modes.

Enumerator
TE_RISING 

Make the text effect slowly go upwards.

TE_STATIC 

Keep the text effect static.

Definition at line 20 of file texteff.hpp.

Function Documentation

◆ AddTextEffect()

TextEffectID AddTextEffect ( StringID  msg,
int  x,
int  y,
uint8_t  duration,
TextEffectMode  mode 
)

Definition at line 41 of file texteff.cpp.

◆ DrawTextEffects()

void DrawTextEffects ( DrawPixelInfo dpi)

Definition at line 118 of file texteff.cpp.

◆ HideFillingPercent()

void HideFillingPercent ( TextEffectID *  te_id)

Hide vehicle loading indicators.

Parameters
*te_idTextEffectID which is supposed to be hidden.

Definition at line 628 of file misc_gui.cpp.

Referenced by CmdReverseTrainDirection(), Train::Crash(), Vehicle::LeaveStation(), and Vehicle::PreDestructor().

◆ InitTextEffects()

void InitTextEffects ( )

Definition at line 112 of file texteff.cpp.

◆ RemoveTextEffect()

void RemoveTextEffect ( TextEffectID  effect_id)

Definition at line 87 of file texteff.cpp.

◆ ShowCostOrIncomeAnimation()

void ShowCostOrIncomeAnimation ( int  x,
int  y,
int  z,
Money  cost 
)

Display animated income or costs on the map.

Does nothing if cost is zero.

Parameters
xWorld X position of the animation location.
yWorld Y position of the animation location.
zWorld Z position of the animation location.
costEstimated cost (or income if negative).

Definition at line 550 of file misc_gui.cpp.

References Ticks::DAY_TICKS, RemapCoords(), SetDParam(), and TE_RISING.

Referenced by CmdChangeBankBalance(), CommandHelperBase::InternalPostResult(), and VehicleEnterDepot().

◆ ShowFeederIncomeAnimation()

void ShowFeederIncomeAnimation ( int  x,
int  y,
int  z,
Money  transfer,
Money  income 
)

Display animated feeder income.

Parameters
xWorld X position of the animation location.
yWorld Y position of the animation location.
zWorld Z position of the animation location.
transferEstimated feeder income.
incomeReal income from goods being delivered to their final destination.

Definition at line 574 of file misc_gui.cpp.

References Ticks::DAY_TICKS, RemapCoords(), SetDParam(), and TE_RISING.

◆ ShowFillingPercent()

TextEffectID ShowFillingPercent ( int  x,
int  y,
int  z,
uint8_t  percent,
StringID  string 
)

Display vehicle loading indicators.

Parameters
xWorld X position of the animation location.
yWorld Y position of the animation location.
zWorld Z position of the animation location.
percentEstimated feeder income.
stringString which is drawn on the map.
Returns
TextEffectID to be used for future updates of the loading indicators.

Definition at line 601 of file misc_gui.cpp.

References RemapCoords(), SetDParam(), and TE_STATIC.

Referenced by LoadUnloadVehicle().

◆ UpdateAllTextEffectVirtCoords()

void UpdateAllTextEffectVirtCoords ( )

Definition at line 78 of file texteff.cpp.

◆ UpdateFillingPercent()

void UpdateFillingPercent ( TextEffectID  te_id,
uint8_t  percent,
StringID  string 
)

Update vehicle loading indicators.

Parameters
te_idTextEffectID to be updated.
stringString which is printed.

Definition at line 616 of file misc_gui.cpp.

References SetDParam().

Referenced by LoadUnloadVehicle().

◆ UpdateTextEffect()

void UpdateTextEffect ( TextEffectID  effect_id,
StringID  msg 
)

Definition at line 67 of file texteff.cpp.

Variable Documentation

◆ INVALID_TE_ID

const TextEffectID INVALID_TE_ID = UINT16_MAX
static

Definition at line 27 of file texteff.hpp.