Add display setting for income/cost text effects
This commit is contained in:
@@ -868,7 +868,7 @@ bool DoCommandPEx(TileIndex tile, uint32 p1, uint32 p2, uint64 p3, uint32 cmd, C
|
||||
}
|
||||
} else if (estimate_only) {
|
||||
ShowEstimatedCostOrIncome(res.GetCost(), x, y);
|
||||
} else if (!only_sending && res.GetCost() != 0 && tile != 0 && IsLocalCompany() && _game_mode != GM_EDITOR) {
|
||||
} else if (!only_sending && res.GetCost() != 0 && tile != 0 && IsLocalCompany() && _game_mode != GM_EDITOR && HasBit(_extra_display_opt, XDO_SHOW_MONEY_TEXT_EFFECTS)) {
|
||||
/* Only show the cost animation when we did actually
|
||||
* execute the command, i.e. we're not sending it to
|
||||
* the server, when it has cost the local company
|
||||
|
@@ -1221,12 +1221,14 @@ CargoPayment::~CargoPayment()
|
||||
SndPlayVehicleFx(SND_14_CASHTILL, this->front);
|
||||
}
|
||||
|
||||
if (this->visual_transfer != 0) {
|
||||
ShowFeederIncomeAnimation(this->front->x_pos, this->front->y_pos,
|
||||
this->front->z_pos, this->visual_transfer, -this->visual_profit);
|
||||
} else if (this->visual_profit != 0) {
|
||||
ShowCostOrIncomeAnimation(this->front->x_pos, this->front->y_pos,
|
||||
this->front->z_pos, -this->visual_profit);
|
||||
if (HasBit(_extra_display_opt, XDO_SHOW_MONEY_TEXT_EFFECTS)) {
|
||||
if (this->visual_transfer != 0) {
|
||||
ShowFeederIncomeAnimation(this->front->x_pos, this->front->y_pos,
|
||||
this->front->z_pos, this->visual_transfer, -this->visual_profit);
|
||||
} else if (this->visual_profit != 0) {
|
||||
ShowCostOrIncomeAnimation(this->front->x_pos, this->front->y_pos,
|
||||
this->front->z_pos, -this->visual_profit);
|
||||
}
|
||||
}
|
||||
|
||||
cur_company.Restore();
|
||||
|
@@ -396,6 +396,7 @@ STR_SETTINGS_MENU_FULL_ANIMATION :Full animation
|
||||
STR_SETTINGS_MENU_FULL_DETAIL :Full detail
|
||||
STR_SETTINGS_MENU_TRANSPARENT_BUILDINGS :Transparent buildings
|
||||
STR_SETTINGS_MENU_TRANSPARENT_SIGNS :Transparent signs
|
||||
STR_SETTINGS_MENU_MONEY_TEXT_EFFECTS :Income/cost texts displayed
|
||||
############ range ends here
|
||||
|
||||
############ range for file menu starts
|
||||
|
@@ -621,6 +621,8 @@ void ShowEstimatedCostOrIncome(Money cost, int x, int y)
|
||||
*/
|
||||
void ShowCostOrIncomeAnimation(int x, int y, int z, Money cost)
|
||||
{
|
||||
if (!HasBit(_extra_display_opt, XDO_SHOW_MONEY_TEXT_EFFECTS)) return;
|
||||
|
||||
Point pt = RemapCoords(x, y, z);
|
||||
StringID msg = STR_INCOME_FLOAT_COST;
|
||||
|
||||
@@ -642,6 +644,8 @@ void ShowCostOrIncomeAnimation(int x, int y, int z, Money cost)
|
||||
*/
|
||||
void ShowFeederIncomeAnimation(int x, int y, int z, Money transfer, Money income)
|
||||
{
|
||||
if (!HasBit(_extra_display_opt, XDO_SHOW_MONEY_TEXT_EFFECTS)) return;
|
||||
|
||||
Point pt = RemapCoords(x, y, z);
|
||||
|
||||
SetDParam(0, transfer);
|
||||
|
@@ -48,6 +48,11 @@ enum DisplayOptions {
|
||||
DO_SHOW_COMPETITOR_SIGNS = 7, ///< Display signs, station names and waypoint names of opponent companies. Buoys and oilrig-stations are always shown, even if this option is turned off.
|
||||
};
|
||||
|
||||
/** Extra Display Options */
|
||||
enum ExtraDisplayOptions {
|
||||
XDO_SHOW_MONEY_TEXT_EFFECTS = 0, ///< Display money text effects.
|
||||
};
|
||||
|
||||
extern GameMode _game_mode;
|
||||
extern SwitchMode _switch_mode;
|
||||
extern bool _exit_game;
|
||||
|
@@ -46,6 +46,13 @@ var = _display_opt
|
||||
def = (1 << DO_SHOW_TOWN_NAMES | 1 << DO_SHOW_STATION_NAMES | 1 << DO_SHOW_SIGNS | 1 << DO_FULL_ANIMATION | 1 << DO_FULL_DETAIL | 1 << DO_SHOW_WAYPOINT_NAMES | 1 << DO_SHOW_COMPETITOR_SIGNS)
|
||||
full = ""SHOW_TOWN_NAMES|SHOW_STATION_NAMES|SHOW_SIGNS|FULL_ANIMATION||FULL_DETAIL|WAYPOINTS|SHOW_COMPETITOR_SIGNS""
|
||||
|
||||
[SDTG_MMANY]
|
||||
name = ""extra_display_opt""
|
||||
type = SLE_UINT8
|
||||
var = _extra_display_opt
|
||||
def = (1 << XDO_SHOW_MONEY_TEXT_EFFECTS)
|
||||
full = ""SHOW_MONEY_TEXT_EFFECTS""
|
||||
|
||||
[SDTG_BOOL]
|
||||
name = ""fullscreen""
|
||||
var = _fullscreen
|
||||
|
@@ -314,6 +314,7 @@ enum OptionMenuEntries {
|
||||
OME_FULL_DETAILS,
|
||||
OME_TRANSPARENTBUILDINGS,
|
||||
OME_SHOW_STATIONSIGNS,
|
||||
OME_SHOW_MONEYTEXT,
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -344,6 +345,7 @@ static CallBackFunction ToolbarOptionsClick(Window *w)
|
||||
list.emplace_back(new DropDownListCheckedItem(STR_SETTINGS_MENU_FULL_DETAIL, OME_FULL_DETAILS, false, HasBit(_display_opt, DO_FULL_DETAIL)));
|
||||
list.emplace_back(new DropDownListCheckedItem(STR_SETTINGS_MENU_TRANSPARENT_BUILDINGS, OME_TRANSPARENTBUILDINGS, false, IsTransparencySet(TO_HOUSES)));
|
||||
list.emplace_back(new DropDownListCheckedItem(STR_SETTINGS_MENU_TRANSPARENT_SIGNS, OME_SHOW_STATIONSIGNS, false, IsTransparencySet(TO_SIGNS)));
|
||||
list.emplace_back(new DropDownListCheckedItem(STR_SETTINGS_MENU_MONEY_TEXT_EFFECTS, OME_SHOW_MONEYTEXT, false, HasBit(_extra_display_opt, XDO_SHOW_MONEY_TEXT_EFFECTS)));
|
||||
|
||||
ShowDropDownList(w, std::move(list), 0, WID_TN_SETTINGS, 140, true, true);
|
||||
if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP);
|
||||
@@ -378,6 +380,7 @@ static CallBackFunction MenuClickSettings(int index)
|
||||
case OME_FULL_DETAILS: ToggleBit(_display_opt, DO_FULL_DETAIL); break;
|
||||
case OME_TRANSPARENTBUILDINGS: ToggleTransparency(TO_HOUSES); break;
|
||||
case OME_SHOW_STATIONSIGNS: ToggleTransparency(TO_SIGNS); break;
|
||||
case OME_SHOW_MONEYTEXT: ToggleBit(_extra_display_opt, XDO_SHOW_MONEY_TEXT_EFFECTS); break;
|
||||
}
|
||||
MarkWholeScreenDirty();
|
||||
return CBF_NONE;
|
||||
|
@@ -39,6 +39,7 @@ extern TransparencyOptionBits _transparency_opt;
|
||||
extern TransparencyOptionBits _transparency_lock;
|
||||
extern TransparencyOptionBits _invisibility_opt;
|
||||
extern byte _display_opt;
|
||||
extern byte _extra_display_opt;
|
||||
|
||||
/**
|
||||
* Check if the transparency option bit is set
|
||||
|
@@ -24,6 +24,7 @@ TransparencyOptionBits _transparency_opt; ///< The bits that should be transpar
|
||||
TransparencyOptionBits _transparency_lock; ///< Prevent these bits from flipping with X.
|
||||
TransparencyOptionBits _invisibility_opt; ///< The bits that should be invisible.
|
||||
byte _display_opt; ///< What do we want to draw/do?
|
||||
byte _extra_display_opt;
|
||||
|
||||
class TransparenciesWindow : public Window
|
||||
{
|
||||
|
Reference in New Issue
Block a user