fixed ping color bug

This commit is contained in:
Eric 2023-06-14 12:59:08 -07:00
parent 969ebff191
commit 7b21a7fccc
No known key found for this signature in database
GPG Key ID: 89C93F0F8D6D5A98
9 changed files with 47 additions and 44 deletions

56
.efrocachemap generated
View File

@ -4072,26 +4072,26 @@
"build/assets/workspace/ninjafightplug.py": "https://files.ballistica.net/cache/ba1/18/4b/787a9267e17be3c49966072581a5",
"build/assets/workspace/onslaughtplug.py": "https://files.ballistica.net/cache/ba1/20/f6/4ce9bc3c1f3732f6adf8237fbe9b",
"build/assets/workspace/runaroundplug.py": "https://files.ballistica.net/cache/ba1/a5/30/9058181df0b1255bf6950cbc7813",
"build/prefab/full/linux_arm64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/ad/7e/83f18a72f8db11e080f0eca6775d",
"build/prefab/full/linux_arm64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/0c/cd/aa76966cd05b54aba4e417bbb94b",
"build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/e2/0f/adf0321b596aea04117647e37de8",
"build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/07/1a/51820fd5c8cdb9f3fc061d8c8a60",
"build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/6b/69/ce3bd7fa3924b12baa003d9a10af",
"build/prefab/full/linux_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/c2/9f/f2026401080cc1b6cc726d3fe7e7",
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/36/94/85c6acdc646a34981637db86bfca",
"build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/3a/e4/751410a3dcb6f6a5acb87fbd1114",
"build/prefab/full/mac_arm64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/10/3b/472d3ebb85cadda98a07d43722fa",
"build/prefab/full/mac_arm64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/b5/41/40580afdf9c45ecd4d151192c687",
"build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/74/d4/a190f068b5b770f031807d69cf89",
"build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/11/40/23786a5169b22cd4726c4bb05087",
"build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/20/3f/e0eeabf110e4be9d72f61c5686d0",
"build/prefab/full/mac_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/cc/d9/c5ed5d11dee05c527bf3bba20e92",
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/cf/a6/c371331130a76f5427df5b30cb52",
"build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/9c/5d/dcbdea22e8a328b0803de111d512",
"build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/18/3b/4ca835c1da7398a34cde8d4ea814",
"build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/52/17/1a6977062c2fbc7b175f9cb0d534",
"build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/e3/45/9c0be4afb42d196879b0297bf64e",
"build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/83/07/6b13c2a9ce41136b23f11c46c932",
"build/prefab/full/linux_arm64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/8c/ed/211ad9931645ec21344cc09943cf",
"build/prefab/full/linux_arm64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/71/df/89649ebeee912d3671994700ca98",
"build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/3a/55/2e767201ff0210baf2aab336b962",
"build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/96/b7/14b9ff3221e0643c5808408889a0",
"build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/96/a6/67826a50b92ef1b97c9350357bde",
"build/prefab/full/linux_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/1a/00/5f26c8e62d546190ef1a0e5d86c1",
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/e9/d9/c37edc30a6d87dc6a3fff69cd69d",
"build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/f0/96/eafa605033a621f0024ce23e8506",
"build/prefab/full/mac_arm64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/e7/0c/e5d1f7f76463dab3a593c7e39d28",
"build/prefab/full/mac_arm64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/23/98/40563ec129aeae3ae29fce9a4098",
"build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/19/db/025a2e4224285384ca5138b528b9",
"build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/3b/04/f7f76fbbb71c51d398999b91d962",
"build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/ce/65/019b91c6590778d7e2f32a6dc86d",
"build/prefab/full/mac_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/70/5d/74932199660c0faa295fc8b331e5",
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/e1/37/98c5e9424f0c180db6aa16a0a2e9",
"build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/c9/3f/3dc59e05f156376638a59e606954",
"build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/6b/2b/6a98ef5411ea98d0190aae33ca8a",
"build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/65/82/defe87b3e240bbabd8194beb71a2",
"build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/39/10/6e8db73db72f65b094401dc66972",
"build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/45/5d/a65990370464ca038cd0a1be680a",
"build/prefab/lib/linux_arm64_gui/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/3c/a8/5487ece199be8717cead6de157e3",
"build/prefab/lib/linux_arm64_gui/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/9d/71/77a0ae15f3216c51da44ccefeb87",
"build/prefab/lib/linux_arm64_server/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/8c/de/a04c75afaee10276fedbd6dc12dd",
@ -4108,14 +4108,14 @@
"build/prefab/lib/mac_x86_64_gui/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/e1/d8/0949e33c04570cae7dafaf906770",
"build/prefab/lib/mac_x86_64_server/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/91/c5/f1c4dcdd2233d6ffc280db77ec99",
"build/prefab/lib/mac_x86_64_server/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/20/e5/3b83e186b63a95d704c69a6b5b76",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "https://files.ballistica.net/cache/ba1/35/0a/00527a3cc06b70fb1079e67b79af",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "https://files.ballistica.net/cache/ba1/e0/49/9651d4a97b7728f68835c19d9dd4",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "https://files.ballistica.net/cache/ba1/4d/36/135d5ca8bff29c468e589171e86e",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "https://files.ballistica.net/cache/ba1/c6/2b/2eda939d90b755913b1ef8a19b16",
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "https://files.ballistica.net/cache/ba1/bb/87/761ca99f5686a464f3f0b3e0dbe1",
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "https://files.ballistica.net/cache/ba1/85/dc/f7f9ca5e1cff8bb5297263872f33",
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "https://files.ballistica.net/cache/ba1/04/6b/7da4c1d5b9ce4a6d999eddb280f9",
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "https://files.ballistica.net/cache/ba1/ac/86/eb1f0fd61d8182bb52ac37a83328",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "https://files.ballistica.net/cache/ba1/bf/fa/f79dc4a7ca33a8cca9df0547eef4",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "https://files.ballistica.net/cache/ba1/9e/3c/09855cda12586dbba55884a259b0",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "https://files.ballistica.net/cache/ba1/47/f1/3eadde3dcabd1b0b9be32a7f247f",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "https://files.ballistica.net/cache/ba1/f3/f6/51991b000385d553f35563df4190",
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "https://files.ballistica.net/cache/ba1/a3/7d/cae2bd2e4daf11f90e73937170fc",
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "https://files.ballistica.net/cache/ba1/1e/cc/ab11419f2d792b8738605a1f3a24",
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "https://files.ballistica.net/cache/ba1/11/eb/55affc8d77ccac52c0b8fd128ad7",
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "https://files.ballistica.net/cache/ba1/5a/57/2df7d185467abcca2287a4410ee8",
"src/assets/ba_data/python/babase/_mgen/__init__.py": "https://files.ballistica.net/cache/ba1/52/c6/c11130af7b10d6c0321add5518fa",
"src/assets/ba_data/python/babase/_mgen/enums.py": "https://files.ballistica.net/cache/ba1/38/c3/1dedd5e74f2508efc5974c8815a1",
"src/ballistica/base/mgen/pyembed/binding_base.inc": "https://files.ballistica.net/cache/ba1/ea/6a/6a4721b144e5e297b542d2a0eea2",

View File

@ -1,4 +1,4 @@
### 1.7.20 (build 21105, api 8, 2023-06-14)
### 1.7.20 (build 21107, api 8, 2023-06-14)
- This seems like a good time for a `refactoring` release in anticipation of
changes coming in 1.8. Basically this means that a lot of things will be
@ -319,6 +319,8 @@
or disabled plugins (Thanks vishal332008!)
- (build 21095) Fixed an issue where certain buttons such as map selection buttons
would draw incorrectly.
- (build 21106) Fixed an issue where in-game ping would always display green no
matter how bad the ping was.
### 1.7.19 (build 20997, api 7, 2023-01-19)

View File

@ -28,7 +28,7 @@ if TYPE_CHECKING:
# Build number and version of the ballistica binary we expect to be
# using.
TARGET_BALLISTICA_BUILD = 21105
TARGET_BALLISTICA_BUILD = 21107
TARGET_BALLISTICA_VERSION = '1.7.20'
_g_env_config: EnvConfig | None = None

View File

@ -46,7 +46,7 @@ auto AppMode::GetPartySize() const -> int { return 0; }
auto AppMode::GetNetworkDebugString() -> std::string { return ""; }
auto AppMode::GetPingString() -> std::string { return ""; }
auto AppMode::GetDisplayPing() -> std::optional<float> { return {}; }
auto AppMode::HasConnectionToHost() const -> bool { return false; }

View File

@ -94,7 +94,7 @@ class AppMode {
virtual auto GetNetworkDebugString() -> std::string;
/// Get a string for current ping display.
virtual auto GetPingString() -> std::string;
virtual auto GetDisplayPing() -> std::optional<float>;
};
} // namespace ballistica::base

View File

@ -413,9 +413,10 @@ void Graphics::DrawMiscOverlays(RenderPass* pass) {
}
if (show_ping_) {
std::string ping_str = g_base->app_mode()->GetPingString();
float ping{};
if (!ping_str.empty()) {
auto ping = g_base->app_mode()->GetDisplayPing();
if (ping.has_value()) {
char ping_str[32];
snprintf(ping_str, sizeof(ping_str), "%.0f ms", *ping);
if (ping_str != ping_string_) {
ping_string_ = ping_str;
if (!ping_text_group_.Exists()) {
@ -426,10 +427,10 @@ void Graphics::DrawMiscOverlays(RenderPass* pass) {
SimpleComponent c(pass);
c.SetTransparent(true);
c.SetColor(0.5f, 0.9f, 0.5f, 1.0f);
if (ping > 100.0f) {
if (*ping > 100.0f) {
c.SetColor(0.8f, 0.8f, 0.0f, 1.0f);
}
if (ping > 500.0f) {
if (*ping > 500.0f) {
c.SetColor(0.9f, 0.2f, 0.2f, 1.0f);
}

View File

@ -905,18 +905,18 @@ auto SceneV1AppMode::GetNetworkDebugString() -> std::string {
static_cast_check_fit<int>(resends));
return net_info_str;
}
std::string SceneV1AppMode::GetPingString() {
auto SceneV1AppMode::GetDisplayPing() -> std::optional<float> {
float ping{};
char ping_str[32];
if (ConnectionToHost* connection_to_host =
connections()->connection_to_host()) {
if (connection_to_host->can_communicate()) {
ping = connection_to_host->current_ping();
snprintf(ping_str, sizeof(ping_str), "%.0f ms", ping);
return ping_str;
return connection_to_host->current_ping();
// snprintf(ping_str, sizeof(ping_str), "%.0f ms", ping);
// return ping_str;
}
}
return "";
return {};
}
void SceneV1AppMode::CleanUpBeforeConnectingToHost() {

View File

@ -66,7 +66,7 @@ class SceneV1AppMode : public base::AppMode {
void LaunchClientSession();
auto GetNetworkDebugString() -> std::string override;
auto GetPingString() -> std::string override;
auto GetDisplayPing() -> std::optional<float> override;
auto HasConnectionToHost() const -> bool override;
auto HasConnectionToClients() const -> bool override;
auto connections() const -> ConnectionSet* {

View File

@ -39,7 +39,7 @@ auto main(int argc, char** argv) -> int {
namespace ballistica {
// These are set automatically via script; don't modify them here.
const int kEngineBuildNumber = 21105;
const int kEngineBuildNumber = 21107;
const char* kEngineVersion = "1.7.20";
auto MonolithicMain(const core::CoreConfig& core_config) -> int {