Skip to content
This repository was archived by the owner on Jan 5, 2024. It is now read-only.

Commit 23f8dab

Browse files
committed
Merge branch 'pre4-testing' into 4zk-content-source
# Conflicts: # Entities/HeldDevice.cpp - Used theirs (pre4-testing) since it's mine (4zk-content-source) cherry-picked and then updated
2 parents b2b74d9 + c93782d commit 23f8dab

File tree

6 files changed

+54
-30
lines changed

6 files changed

+54
-30
lines changed

Entities/HeldDevice.cpp

Lines changed: 29 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,7 @@ void HeldDevice::DrawHUD(BITMAP *pTargetBitmap, const Vector &targetPos, int whi
548548
// Only draw if the team viewing this has seen the space where this is located.
549549
int viewingPlayer = g_ActivityMan.GetActivity()->PlayerOfScreen(whichScreen);
550550
int viewingTeam = g_ActivityMan.GetActivity()->GetTeamOfPlayer(viewingPlayer);
551-
if (viewingTeam != Activity::NoTeam && g_SceneMan.IsUnseen(m_Pos.GetFloorIntX(), m_Pos.GetFloorIntY(), viewingTeam)) {
551+
if (viewingTeam == Activity::NoTeam || g_SceneMan.IsUnseen(m_Pos.GetFloorIntX(), m_Pos.GetFloorIntY(), viewingTeam)) {
552552
return;
553553
}
554554

@@ -573,43 +573,42 @@ void HeldDevice::DrawHUD(BITMAP *pTargetBitmap, const Vector &targetPos, int whi
573573
}
574574
}
575575

576-
char str[64];
577-
str[0] = 0;
578576
GUIFont *pSymbolFont = g_FrameMan.GetLargeFont();
579577
GUIFont *pTextFont = g_FrameMan.GetSmallFont();
580578
if (pSymbolFont && pTextFont) {
581-
if (m_BlinkTimer.GetElapsedSimTimeMS() > 750) {
582-
str[0] = -40;
583-
str[1] = 0;
584-
} else if (m_BlinkTimer.GetElapsedSimTimeMS() > 500) {
585-
str[0] = -41;
586-
str[1] = 0;
587-
} else if (m_BlinkTimer.GetElapsedSimTimeMS() > 250) {
588-
str[0] = -42;
589-
str[1] = 0;
590-
} else if (m_BlinkTimer.GetElapsedSimTimeMS() > 0) {
591-
str[0] = 0;
592-
} else {
593-
// Check for nearby cursors that will toggle this pickup HUD.
594-
float range = g_SettingsMan.GetUnheldItemsHUDDisplayRange();
595-
if (g_ActivityMan.GetActivity()->GetActivityState() != Activity::ActivityState::Running) {
596-
range = -1.0F;
597-
} else if (const GameActivity *gameActivity = dynamic_cast<const GameActivity *>(g_ActivityMan.GetActivity())) {
598-
if (gameActivity->GetViewState(viewingPlayer) == GameActivity::ViewState::ActorSelect) {
599-
range = -1.0F;
600-
}
601-
}
602-
m_SeenByPlayer.at(viewingPlayer) = range < 0 || (range > 0 && g_SceneMan.ShortestDistance(m_Pos, g_SceneMan.GetScrollTarget(whichScreen), g_SceneMan.SceneWrapsX()).GetMagnitude() < range);
579+
const Activity *activity = g_ActivityMan.GetActivity();
580+
float unheldItemDisplayRange = activity->GetActivityState() == Activity::ActivityState::Running ? g_SettingsMan.GetUnheldItemsHUDDisplayRange() : -1.0F;
581+
if (g_SettingsMan.AlwaysDisplayUnheldItemsInStrategicMode()) {
582+
const GameActivity *gameActivity = dynamic_cast<const GameActivity *>(activity);
583+
if (gameActivity && gameActivity->GetViewState(viewingPlayer) == GameActivity::ViewState::ActorSelect) { unheldItemDisplayRange = -1.0F; }
603584
}
585+
// Note - to avoid item HUDs flickering in and out, we need to add a little leeway when hiding them if they're already displayed.
586+
if (m_SeenByPlayer.at(viewingPlayer) && unheldItemDisplayRange > 0) { unheldItemDisplayRange += 3.0F; }
587+
m_SeenByPlayer.at(viewingPlayer) = unheldItemDisplayRange < 0 || (unheldItemDisplayRange > 0 && g_SceneMan.ShortestDistance(m_Pos, g_SceneMan.GetScrollTarget(whichScreen), g_SceneMan.SceneWrapsX()).GetMagnitude() < unheldItemDisplayRange);
588+
604589
if (m_SeenByPlayer.at(viewingPlayer)) {
605-
AllegroBitmap pBitmapInt(pTargetBitmap);
606-
pSymbolFont->DrawAligned(&pBitmapInt, drawPos.GetFloorIntX() - 1, drawPos.GetFloorIntY() - 20, str, GUIFont::Centre);
607-
std::snprintf(str, sizeof(str), "%s", m_PresetName.c_str());
608-
pTextFont->DrawAligned(&pBitmapInt, drawPos.GetFloorIntX(), drawPos.GetFloorIntY() - 29, str, GUIFont::Centre);
590+
char pickupArrowString[64];
591+
pickupArrowString[0] = 0;
592+
if (m_BlinkTimer.GetElapsedSimTimeMS() < 250) {
593+
pickupArrowString[0] = 0;
594+
} else if (m_BlinkTimer.GetElapsedSimTimeMS() < 500) {
595+
pickupArrowString[0] = -42;
596+
pickupArrowString[1] = 0;
597+
} else if (m_BlinkTimer.GetElapsedSimTimeMS() < 750) {
598+
pickupArrowString[0] = -41;
599+
pickupArrowString[1] = 0;
600+
} else if (m_BlinkTimer.GetElapsedSimTimeMS() < 1000) {
601+
pickupArrowString[0] = -40;
602+
pickupArrowString[1] = 0;
603+
}
604+
605+
AllegroBitmap targetAllegroBitmap(pTargetBitmap);
606+
pSymbolFont->DrawAligned(&targetAllegroBitmap, drawPos.GetFloorIntX() - 1, drawPos.GetFloorIntY() - 20, pickupArrowString, GUIFont::Centre);
607+
pTextFont->DrawAligned(&targetAllegroBitmap, drawPos.GetFloorIntX(), drawPos.GetFloorIntY() - 29, m_PresetName, GUIFont::Centre);
609608
}
610609
}
611610
}
612611
}
613612
}
614613

615-
} // namespace RTE
614+
} // namespace RTE

Managers/NetworkServer.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -729,6 +729,8 @@ namespace RTE {
729729
m_DataUncompressedTotal[player] += payloadSize;
730730

731731
m_SendSceneSetupData[player] = false;
732+
m_SendSceneData[player] = false;
733+
m_SendFrameData[player] = false;
732734

733735
// While we're on the same thread with freshly connected player, send current music being played
734736
if (g_AudioMan.IsMusicPlaying()) {

Managers/SettingsMan.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ namespace RTE {
2222
m_FlashOnBrainDamage = true;
2323
m_BlipOnRevealUnseen = true;
2424
m_UnheldItemsHUDDisplayRange = 25;
25+
m_AlwaysDisplayUnheldItemsInStrategicMode = true;
2526
m_EndlessMetaGameMode = false;
2627
m_EnableCrabBombs = false;
2728
m_CrabBombThreshold = 42;
@@ -139,6 +140,8 @@ namespace RTE {
139140
reader >> g_MovableMan.m_MaxDroppedItems;
140141
} else if (propName == "UnheldItemsHUDDisplayRange") {
141142
SetUnheldItemsHUDDisplayRange(std::stof(reader.ReadPropValue()));
143+
} else if (propName == "AlwaysDisplayUnheldItemsInStrategicMode") {
144+
reader >> m_AlwaysDisplayUnheldItemsInStrategicMode;
142145
} else if (propName == "SloMoThreshold") {
143146
reader >> g_MovableMan.m_SloMoThreshold;
144147
} else if (propName == "SloMoDurationMS") {
@@ -314,6 +317,7 @@ namespace RTE {
314317
writer.NewPropertyWithValue("BlipOnRevealUnseen", m_BlipOnRevealUnseen);
315318
writer.NewPropertyWithValue("MaxUnheldItems", g_MovableMan.m_MaxDroppedItems);
316319
writer.NewPropertyWithValue("UnheldItemsHUDDisplayRange", m_UnheldItemsHUDDisplayRange);
320+
writer.NewPropertyWithValue("AlwaysDisplayUnheldItemsInStrategicMode", m_AlwaysDisplayUnheldItemsInStrategicMode);
317321
writer.NewPropertyWithValue("SloMoThreshold", g_MovableMan.m_SloMoThreshold);
318322
writer.NewPropertyWithValue("SloMoDurationMS", g_MovableMan.m_SloMoDuration);
319323
writer.NewPropertyWithValue("EndlessMetaGameMode", m_EndlessMetaGameMode);

Managers/SettingsMan.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,18 @@ namespace RTE {
107107
/// <param name="newRadius">The new range in which devices on Scene will show the pick-up HUD, in pixels. 0 means HUDs are hidden, -1 means unlimited range.</param>
108108
void SetUnheldItemsHUDDisplayRange(float newRadius) { m_UnheldItemsHUDDisplayRange = std::floor(newRadius); }
109109

110+
/// <summary>
111+
/// Gets whether or not devices on Scene should always show their pick-up HUD when the player is in strategic mode.
112+
/// </summary>
113+
/// <returns>Whether or not devices on Scene should always show their pick-up HUD when the player is in strategic mode.</returns>
114+
bool AlwaysDisplayUnheldItemsInStrategicMode() const { return m_AlwaysDisplayUnheldItemsInStrategicMode; }
115+
116+
/// <summary>
117+
/// Sets whether or not devices on Scene should always show their pick-up HUD when the player is in strategic mode.
118+
/// </summary>
119+
/// <param name="shouldShowUnheldItemsInStrategicMode">Whether or not devices on Scene should always show their pick-up HUD when the player is in strategic mode.</param>
120+
void SetAlwaysDisplayUnheldItemsInStrategicMode(bool shouldShowUnheldItemsInStrategicMode) { m_AlwaysDisplayUnheldItemsInStrategicMode = shouldShowUnheldItemsInStrategicMode; }
121+
110122
/// <summary>
111123
/// Whether red and white flashes appear when brain is damaged.
112124
/// </summary>
@@ -414,6 +426,7 @@ namespace RTE {
414426
bool m_FlashOnBrainDamage; //!< Whether red flashes on brain damage are on or off.
415427
bool m_BlipOnRevealUnseen; //!< Blip if unseen is revealed.
416428
float m_UnheldItemsHUDDisplayRange; //!< Range in which devices on Scene will show the pick-up HUD, in pixels. 0 means HUDs are hidden, -1 means unlimited range.
429+
bool m_AlwaysDisplayUnheldItemsInStrategicMode; //!< Whether or not devices on Scene should always show their pick-up HUD when when the player is in strategic mode.
417430
bool m_EndlessMetaGameMode; //!< Endless MetaGame mode.
418431
bool m_EnableCrabBombs; //!< Whether all actors (except Brains and Doors) should be annihilated if a number exceeding the crab bomb threshold is released at once.
419432
int m_CrabBombThreshold; //!< The number of crabs needed to be released at once to trigger the crab bomb effect.

Menus/SettingsGameplayGUI.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ namespace RTE {
5858
}
5959
m_UnheldItemsHUDDisplayRangeLabel = dynamic_cast<GUILabel *>(m_GUIControlManager->GetControl("LabelUnheldItemsHUDRangeValue"));
6060
UpdateUnheldItemsHUDDisplayRange();
61+
62+
m_AlwaysDisplayUnheldItemsInStrategicModeCheckbox = dynamic_cast<GUICheckbox *>(m_GUIControlManager->GetControl("CheckboxAlwaysShowUnheldItemsInStrategicMode"));
63+
m_AlwaysDisplayUnheldItemsInStrategicModeCheckbox->SetCheck(g_SettingsMan.AlwaysDisplayUnheldItemsInStrategicMode());
6164
}
6265

6366
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -129,6 +132,8 @@ namespace RTE {
129132
UpdateCrabBombThresholdTextbox();
130133
} else if (guiEvent.GetControl() == m_UnheldItemsHUDDisplayRangeSlider) {
131134
UpdateUnheldItemsHUDDisplayRange();
135+
} else if (guiEvent.GetControl() == m_AlwaysDisplayUnheldItemsInStrategicModeCheckbox) {
136+
g_SettingsMan.SetAlwaysDisplayUnheldItemsInStrategicMode(m_AlwaysDisplayUnheldItemsInStrategicModeCheckbox->GetCheck());
132137
// Update both textboxes when clicking the main CollectionBox, otherwise clicking off focused textboxes does not remove their focus or update the setting values and they will still capture keyboard input.
133138
} else if (guiEvent.GetControl() == m_GameplaySettingsBox && guiEvent.GetMsg() == GUICollectionBox::Clicked && !m_GameplaySettingsBox->HasFocus()) {
134139
UpdateMaxUnheldItemsTextbox();

Menus/SettingsGameplayGUI.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ namespace RTE {
5959
GUITextBox *m_CrabBombThresholdTextbox;
6060
GUISlider *m_UnheldItemsHUDDisplayRangeSlider;
6161
GUILabel *m_UnheldItemsHUDDisplayRangeLabel;
62+
GUICheckbox *m_AlwaysDisplayUnheldItemsInStrategicModeCheckbox;
6263

6364
#pragma region Gameplay Settings Handling
6465
/// <summary>

0 commit comments

Comments
 (0)