Skip to content

Commit 4aaf68a

Browse files
committed
some layouts
1 parent c5d3fa3 commit 4aaf68a

3 files changed

Lines changed: 42 additions & 17 deletions

File tree

src/game/client/swarm/c_asw_marine.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ extern float g_fMarinePoisonDuration;
110110
#ifdef CLIENT_DLL
111111
std::vector<bool> g_bShouldTracePlayer = std::vector<bool>(MAX_PLAYERS, false); // whether we have a trace position for this player
112112
const float TRACE_FADE_TIME = 60.0f; // how long to keep the trace positions for
113+
ConVar cl_trace_player_max_targets("cl_trace_player_max_targets", "3", FCVAR_ARCHIVE | FCVAR_CLIENTDLL, "Maximum number of players to trace positions for in the client.", true, 1.0f, true, 7.0f);
113114
#endif
114115

115116
#define FLASHLIGHT_DISTANCE 1000

src/game/client/swarm/vgui/nb_lobby_row.cpp

Lines changed: 39 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
extern ConVar rd_legacy_ui;
2929
#ifdef CLIENT_DLL
3030
extern std::vector<bool> g_bShouldTracePlayer;
31+
extern ConVar cl_trace_player_max_targets;
3132
#endif
3233

3334
using namespace BaseModUI;
@@ -102,15 +103,28 @@ CNB_Lobby_Row::CNB_Lobby_Row( vgui::Panel *parent, const char *name ) : BaseClas
102103
m_pXPBar->m_flBorder = 1.5f;
103104
m_nLobbySlot = 0;
104105

106+
color32 lightblue;
107+
lightblue.r = 66;
108+
lightblue.g = 142;
109+
lightblue.b = 192;
110+
lightblue.a = 255;
111+
105112
// Create the TraceMe button
106113
m_pTraceMeButton = new CBitmapButton( this, "TraceMeButton", "");
107-
m_pTraceMeButton->AddActionSignalTarget( this );
108-
m_pTraceMeButton->SetCommand( "TraceMePressed" );
114+
m_pTraceMeButton->AddActionSignalTarget(this);
115+
m_pTraceMeButton->SetCommand("TraceMePressed");
116+
m_pTraceMeButton->SetImage(CBitmapButton::BUTTON_ENABLED, "vgui/briefing/trace_me_icon_on", lightblue);
117+
m_pTraceMeButton->SetImage(CBitmapButton::BUTTON_PRESSED, "vgui/briefing/trace_me_icon_pressed", lightblue);
118+
m_pTraceMeButton->SetImage(CBitmapButton::BUTTON_ENABLED_MOUSE_OVER, "vgui/briefing/trace_me_icon_mouse_over", lightblue);
109119

110-
// Create and initialize TracePlayerButton
120+
// Create the TracePlayerButton
111121
m_pTracePlayerButton = new CBitmapButton( this, "TracePlayerButton", "" );
112122
m_pTracePlayerButton->AddActionSignalTarget( this );
113123
m_pTracePlayerButton->SetCommand( "TracePlayerPressed" );
124+
m_pTracePlayerButton->SetImage(CBitmapButton::BUTTON_ENABLED, "vgui/briefing/trace_player_icon_off", lightblue);
125+
m_pTracePlayerButton->SetImage(CBitmapButton::BUTTON_PRESSED, "vgui/briefing/trace_player_icon_pressed", lightblue);
126+
m_pTracePlayerButton->SetImage(CBitmapButton::BUTTON_ENABLED_MOUSE_OVER, "vgui/briefing/trace_player_icon_mouse_over", lightblue);
127+
114128

115129
GetControllerFocus()->AddToFocusList( m_pPortraitButton );
116130
GetControllerFocus()->AddToFocusList( m_pWeaponButton0 );
@@ -145,6 +159,15 @@ void CNB_Lobby_Row::ApplySchemeSettings( vgui::IScheme *pScheme )
145159
}
146160
m_szLastPortraitImage[ 0 ] = 0;
147161
m_lastSteamID.Set( 0, k_EUniverseInvalid, k_EAccountTypeInvalid );
162+
163+
// place the button
164+
m_pTraceMeButton->SetPos(XRES(4), YRES(35));
165+
m_pTracePlayerButton->SetPos(XRES(4), YRES(35));
166+
// set width and height
167+
m_pTraceMeButton->SetWide(XRES(12));
168+
m_pTraceMeButton->SetTall(YRES(12));
169+
m_pTracePlayerButton->SetWide(XRES(12));
170+
m_pTracePlayerButton->SetTall(YRES(12));
148171
}
149172

150173
void CNB_Lobby_Row::PerformLayout()
@@ -446,16 +469,6 @@ void CNB_Lobby_Row::UpdateDetails()
446469
pSilhouette->SetVisible( false );
447470
}
448471
}
449-
450-
// Set the images for the TraceMe button
451-
const char* szTraceMeButtonEnabled = "vgui/swarm/Emotes/EmoteSmile";
452-
const char* szTraceMeButtonDisabled = "vgui/swarm/Emotes/EmoteStop";
453-
const char* szTraceMeButtonPressed = "vgui/swarm/Emotes/EmoteAmmo";
454-
const char* szTraceMeButtonMouseOver = "vgui/swarm/Emotes/EmoteMedic";
455-
m_pTraceMeButton->SetImage(CBitmapButton::BUTTON_ENABLED, szTraceMeButtonEnabled, lightblue);
456-
m_pTraceMeButton->SetImage(CBitmapButton::BUTTON_DISABLED, szTraceMeButtonDisabled, lightblue);
457-
m_pTraceMeButton->SetImage(CBitmapButton::BUTTON_PRESSED, szTraceMeButtonPressed, white);
458-
m_pTraceMeButton->SetImage(CBitmapButton::BUTTON_ENABLED_MOUSE_OVER, szTraceMeButtonMouseOver, white);
459472
}
460473

461474
void CNB_Lobby_Row::CheckTooltip( CNB_Lobby_Tooltip *pTooltip )
@@ -649,10 +662,18 @@ void CNB_Lobby_Row::TraceMePressed()
649662
return; // Invalid player index
650663
}
651664

652-
char cmd[128];
653-
Q_snprintf(cmd, sizeof(cmd), "rd_lobby_suggest_trace_player %d", localPlayerIndex);
654-
// Send a message in chat to all other players to suggest them to trace this player
655-
engine->ClientCmd_Unrestricted(cmd);
665+
if (lastTraceMePressedTime < 0 || (lastTraceMePressedTime + 30.0) <= gpGlobals->curtime)
666+
{
667+
lastTraceMePressedTime = gpGlobals->curtime; // Prevent spamming the command
668+
char cmd[128];
669+
Q_snprintf(cmd, sizeof(cmd), "rd_lobby_suggest_trace_player %d", localPlayerIndex);
670+
// Send a message in chat to all other players to suggest them to trace this player
671+
engine->ClientCmd_Unrestricted(cmd);
672+
}
673+
else
674+
{
675+
ClientPrint(CBasePlayer::GetLocalPlayer(), HUD_PRINTTALK, "asw_trace_me_cooling_down");
676+
}
656677
}
657678
}
658679

@@ -685,5 +706,6 @@ void CNB_Lobby_Row::TracePlayerPressed()
685706
}
686707
// flip the trace state for this player
687708
g_bShouldTracePlayer[playerIndex] = !g_bShouldTracePlayer[playerIndex];
709+
m_pTracePlayerButton->SetImage(CBitmapButton::BUTTON_ENABLED, g_bShouldTracePlayer[playerIndex] ? "vgui/briefing/trace_player_icon_on" : "vgui/briefing/trace_player_icon_off", color32{ 66, 142, 192, 255 });
688710
Msg("Trace player %d : %s\n", playerIndex, g_bShouldTracePlayer[playerIndex] ? "true" : "false");
689711
}

src/game/client/swarm/vgui/nb_lobby_row.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ class CNB_Lobby_Row : public vgui::EditablePanel
8484
SteamItemDef_t m_lastMedal[RD_STEAM_INVENTORY_NUM_MEDAL_SLOTS];
8585

8686
int m_nLobbySlot;
87+
88+
float lastTraceMePressedTime = -1.0f;
8789
CBitmapButton *m_pTraceMeButton;
8890
CBitmapButton* m_pTracePlayerButton;
8991
};

0 commit comments

Comments
 (0)