summaryrefslogtreecommitdiff
path: root/indra/newview/llappviewer.cpp
diff options
context:
space:
mode:
authorErik Kundiman <erik@megapahit.org>2025-08-07 11:13:05 +0800
committerErik Kundiman <erik@megapahit.org>2025-08-07 11:13:05 +0800
commit2516f0229c84795d8427a2c223ef4081e443c81b (patch)
treec93d4d7ed971e05b88c3d08e346f17a197fa7a75 /indra/newview/llappviewer.cpp
parentb031df0cd0813a5e2c2a8c1e5084420a9866461a (diff)
"Hidden Region" if Discord location sharing is off
instead of blank. The coords are hidden too, but the Party numbers are still shown, for consistency with TPVs' implementations.
Diffstat (limited to 'indra/newview/llappviewer.cpp')
-rw-r--r--indra/newview/llappviewer.cpp56
1 files changed, 29 insertions, 27 deletions
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index c9bdc29bea..3e1e07ceae 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -5975,37 +5975,39 @@ void LLAppViewer::updateDiscordActivity()
activity.SetDetails(gDiscordActivityDetails);
}
+ auto agent_pos_region = gAgent.getPositionAgent();
+ S32 pos_x = S32(agent_pos_region.mV[VX] + 0.5f);
+ S32 pos_y = S32(agent_pos_region.mV[VY] + 0.5f);
+ S32 pos_z = S32(agent_pos_region.mV[VZ] + 0.5f);
+ F32 velocity_mag_sq = gAgent.getVelocity().magVecSquared();
+ const F32 FLY_CUTOFF = 6.f;
+ const F32 FLY_CUTOFF_SQ = FLY_CUTOFF * FLY_CUTOFF;
+ const F32 WALK_CUTOFF = 1.5f;
+ const F32 WALK_CUTOFF_SQ = WALK_CUTOFF * WALK_CUTOFF;
+ if (velocity_mag_sq > FLY_CUTOFF_SQ)
+ {
+ pos_x -= pos_x % 4;
+ pos_y -= pos_y % 4;
+ }
+ else if (velocity_mag_sq > WALK_CUTOFF_SQ)
+ {
+ pos_x -= pos_x % 2;
+ pos_y -= pos_y % 2;
+ }
+
+ std::string location = "Hidden Region";
static LLCachedControl<bool> show_state(gSavedSettings, "ShowDiscordActivityState", false);
if (show_state)
{
- auto agent_pos_region = gAgent.getPositionAgent();
- S32 pos_x = S32(agent_pos_region.mV[VX] + 0.5f);
- S32 pos_y = S32(agent_pos_region.mV[VY] + 0.5f);
- S32 pos_z = S32(agent_pos_region.mV[VZ] + 0.5f);
- F32 velocity_mag_sq = gAgent.getVelocity().magVecSquared();
- const F32 FLY_CUTOFF = 6.f;
- const F32 FLY_CUTOFF_SQ = FLY_CUTOFF * FLY_CUTOFF;
- const F32 WALK_CUTOFF = 1.5f;
- const F32 WALK_CUTOFF_SQ = WALK_CUTOFF * WALK_CUTOFF;
- if (velocity_mag_sq > FLY_CUTOFF_SQ)
- {
- pos_x -= pos_x % 4;
- pos_y -= pos_y % 4;
- }
- else if (velocity_mag_sq > WALK_CUTOFF_SQ)
- {
- pos_x -= pos_x % 2;
- pos_y -= pos_y % 2;
- }
- auto location = llformat("%s (%d, %d, %d)", gAgent.getRegion()->getName().c_str(), pos_x, pos_y, pos_z);
- activity.SetState(location);
-
- discordpp::ActivityParty party;
- party.SetId(location);
- party.SetCurrentSize(gDiscordPartyCurrentSize);
- party.SetMaxSize(gDiscordPartyMaxSize);
- activity.SetParty(party);
+ location = llformat("%s (%d, %d, %d)", gAgent.getRegion()->getName().c_str(), pos_x, pos_y, pos_z);
}
+ activity.SetState(location);
+
+ discordpp::ActivityParty party;
+ party.SetId(location);
+ party.SetCurrentSize(gDiscordPartyCurrentSize);
+ party.SetMaxSize(gDiscordPartyMaxSize);
+ activity.SetParty(party);
gDiscordClient->UpdateRichPresence(activity, [](discordpp::ClientResult) {});
}