Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Server/Components/LegacyConfig/config_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ const FlatHashMap<StringView, ParamType> types = {
{ "stream_distance", ParamType::Float },
{ "stream_rate", ParamType::Int },
{ "maxnpc", ParamType::Int },
{ "max_global_textdraws", ParamType::Int },
{ "max_player_textdraws", ParamType::Int },
{ "lagcompmode", ParamType::Int },
{ "useartwork", ParamType::Bool },
{ "artpath", ParamType::String },
Expand Down Expand Up @@ -122,6 +124,8 @@ const FlatHashMap<StringView, StringView> dictionary = {
{ "stream_distance", "network.stream_radius" },
{ "stream_rate", "network.stream_rate" },
{ "maxnpc", "max_bots" },
{ "max_global_textdraws", "textdraw.global_limit" },
{ "max_player_textdraws", "textdraw.player_limit" },
{ "lagcompmode", "game.lag_compensation_mode" },
{ "useartwork", "artwork.enable" },
{ "artpath", "artwork.models_path" }
Expand Down
18 changes: 13 additions & 5 deletions Server/Components/TextDraws/textdraw.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,15 @@ class TextDrawBase : public T, public PoolIDProvider, public NoCopy
Vector3 previewRotation = Vector3(0.f);
Pair<int, int> previewVehicleColours = std::make_pair(-1, -1);
float previewZoom = 1.f;
int globalTextDrawPoolSize;

public:
TextDrawBase(Vector2 pos, StringView text, TextDrawStyle style = TextDrawStyle_FontAharoniBold, int previewModel = 0)
TextDrawBase(int globalTextDrawPoolSize, Vector2 pos, StringView text, TextDrawStyle style = TextDrawStyle_FontAharoniBold, int previewModel = 0)
: pos(pos)
, text(text)
, style(style)
, previewModel(previewModel)
, globalTextDrawPoolSize(globalTextDrawPoolSize)
{
trimText();
}
Expand Down Expand Up @@ -260,6 +262,7 @@ class TextDrawBase : public T, public PoolIDProvider, public NoCopy
{
NetCode::RPC::PlayerShowTextDraw playerShowTextDrawRPC;
playerShowTextDrawRPC.PlayerTextDraw = isPlayerTextDraw;
playerShowTextDrawRPC.GlobalTextDrawPoolSize = globalTextDrawPoolSize;
playerShowTextDrawRPC.UseBox = box;
switch (alignment)
{
Expand Down Expand Up @@ -301,6 +304,7 @@ class TextDrawBase : public T, public PoolIDProvider, public NoCopy
{
NetCode::RPC::PlayerHideTextDraw playerHideTextDrawRPC;
playerHideTextDrawRPC.PlayerTextDraw = isPlayerTextDraw;
playerHideTextDrawRPC.GlobalTextDrawPoolSize = globalTextDrawPoolSize;
playerHideTextDrawRPC.TextDrawID = poolID;
PacketHelper::send(playerHideTextDrawRPC, player);
}
Expand All @@ -309,6 +313,7 @@ class TextDrawBase : public T, public PoolIDProvider, public NoCopy
{
NetCode::RPC::PlayerTextDrawSetString playerTextDrawSetStringRPC;
playerTextDrawSetStringRPC.PlayerTextDraw = isPlayerTextDraw;
playerTextDrawSetStringRPC.GlobalTextDrawPoolSize = globalTextDrawPoolSize;
playerTextDrawSetStringRPC.TextDrawID = poolID;
playerTextDrawSetStringRPC.Text = txt;
PacketHelper::send(playerTextDrawSetStringRPC, player);
Expand Down Expand Up @@ -338,9 +343,12 @@ class TextDraw final : public TextDrawBase<ITextDraw>
private:
UniqueIDArray<IPlayer, PLAYER_POOL_SIZE> shownFor_;

using TextDrawBase<ITextDraw>::TextDrawBase;

public:
TextDraw(int globalTextDrawPoolSize, Vector2 pos, StringView text, TextDrawStyle style = TextDrawStyle_FontAharoniBold, int previewModel = 0)
: TextDrawBase<ITextDraw>(globalTextDrawPoolSize, pos, text, style, previewModel)
{
}

void removeFor(int pid, IPlayer& player)
{
if (shownFor_.valid(pid))
Expand Down Expand Up @@ -408,8 +416,8 @@ class PlayerTextDraw final : public TextDrawBase<IPlayerTextDraw>
bool shown = false;

public:
PlayerTextDraw(IPlayer& player, Vector2 pos, StringView text, TextDrawStyle style = TextDrawStyle_FontAharoniBold, int previewModel = 0)
: TextDrawBase(pos, text, style, previewModel)
PlayerTextDraw(int globalTextDrawPoolSize, IPlayer& player, Vector2 pos, StringView text, TextDrawStyle style = TextDrawStyle_FontAharoniBold, int previewModel = 0)
: TextDrawBase<IPlayerTextDraw>(globalTextDrawPoolSize, pos, text, style, previewModel)
, player(player)
{
}
Expand Down
Loading
Loading