Skip to content

Commit 6f99832

Browse files
committed
vfx tweeks
1 parent 4aaf68a commit 6f99832

3 files changed

Lines changed: 59 additions & 46 deletions

File tree

src/game/client/swarm/c_asw_marine.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,9 @@ extern float g_fMarinePoisonDuration;
109109

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
112-
const float TRACE_FADE_TIME = 60.0f; // how long to keep the trace positions for
112+
float TRACE_FADE_TIME = 60.0f; // how long to keep the trace positions for
113113
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);
114+
ConVar cl_trace_player_opacity("cl_trace_player_opacity", "0.5", FCVAR_ARCHIVE | FCVAR_CLIENTDLL, "Opacity of the player trace positions in the client. 0.0 means fully transparent, 1.0 means fully opaque.", true, 0.0f, true, 1.0f);
114115
#endif
115116

116117
#define FLASHLIGHT_DISTANCE 1000

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

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ extern ConVar asw_draw_hud;
4444

4545
#ifdef CLIENT_DLL
4646
extern std::vector<bool> g_bShouldTracePlayer;
47-
extern const float TRACE_FADE_TIME;
47+
extern float TRACE_FADE_TIME;
48+
extern ConVar cl_trace_player_opacity;
4849
#endif
4950

5051
//-----------------------------------------------------------------------------
@@ -312,20 +313,29 @@ void CASWHudEmotes::PaintTraces()
312313

313314
void CASWHudEmotes::PaintTracesFor(C_ASW_Marine* pMarine)
314315
{
316+
float fTimeRatio = 1.0 - gpGlobals->curtime/3.0 + (int)(gpGlobals->curtime / 3.0); // current time
317+
float fOpacity = cl_trace_player_opacity.GetFloat(); // default opacity for traces
315318
for (auto iter = pMarine->m_lstTracePlayerMovementList.begin(); iter != pMarine->m_lstTracePlayerMovementList.end(); ++iter)
316319
{
317-
float fTime = (*iter).m_flTraceTime;
320+
float fTraceRatio = (*iter).m_flTraceTime/TRACE_FADE_TIME;
318321
Vector vecPosition = (*iter).m_vecPosition;
319322

320-
if (fTime <= 0)
323+
if (fTraceRatio <= 0)
321324
{
322325
continue; // no trace to draw
323326
}
324327

325328
// draw a circle at the position of the trace in world space
326329
// and fade it out over time
327-
float fAlpha = pow(((fTime / 3.0) - (int)(fTime / 3.0)),4);
328-
fAlpha = clamp(fAlpha, 0.0f, 1.0f);
330+
float fAlpha = (fTraceRatio + fTimeRatio) - (int)(fTraceRatio + fTimeRatio);
331+
if (fAlpha > 1.0/3.0 || fAlpha <= 0.01)
332+
{
333+
continue;
334+
}
335+
else
336+
{
337+
fAlpha = pow(3.0 * fAlpha, 2.2);
338+
}
329339
int iTexture = m_nSmileTexture;
330340

331341
Vector screenPos;
@@ -338,15 +348,15 @@ void CASWHudEmotes::PaintTracesFor(C_ASW_Marine* pMarine)
338348
if (iTexture != -1)
339349
{
340350
// 计算大小,随时间略微变化
341-
float fSize = 0.9f + 0.1f * fAlpha;
351+
float fSize = 0.5f + 0.1f * fAlpha;
342352

343353
// 应用屏幕高度比例和自定义缩放
344354
float fScale = (ScreenHeight() / 768.0f);
345355
float HalfW = 16.0f * fScale * fSize;
346356
float HalfH = 16.0f * fScale * fSize;
347357

348358
// 设置颜色和纹理
349-
surface()->DrawSetColor(Color(255, 255, 255, fAlpha * 255.0f));
359+
surface()->DrawSetColor(Color(255, 255, 255, fAlpha * fOpacity * 255.0f));
350360
surface()->DrawSetTexture(iTexture);
351361

352362
// 绘制纹理多边形

src/game/shared/swarm/rd_lobby_utils.cpp

Lines changed: 40 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -583,44 +583,6 @@ CON_COMMAND( rd_lobby_debug_filter_distance, "1: close, 2: default, 3: far, 4: w
583583
}
584584
}
585585

586-
CON_COMMAND(rd_lobby_suggest_trace_player, "notify server to send a trace player suggestion to all clients.")
587-
{
588-
if (args.ArgC() < 2)
589-
{
590-
Msg("Usage: rd_lobby_suggest_trace_player <playerIndex>\n");
591-
return;
592-
}
593-
594-
int iPlayerIndex = atoi(args[1]);
595-
if (iPlayerIndex < 1 || iPlayerIndex > gpGlobals->maxClients)
596-
{
597-
Msg("Invalid playerIndex\n");
598-
return;
599-
}
600-
601-
CBasePlayer* pPlayer = UTIL_PlayerByIndex(iPlayerIndex);
602-
if (!pPlayer)
603-
{
604-
Msg("Can't find a player with index <%d>.\n", iPlayerIndex);
605-
return;
606-
}
607-
// Send the message to all players
608-
for (int i = 1; i <= gpGlobals->maxClients; i++)
609-
{
610-
CBasePlayer* pRecipient = UTIL_PlayerByIndex(i);
611-
if (!pRecipient)
612-
continue;
613-
if (pRecipient == pPlayer)
614-
{
615-
ClientPrint(pRecipient, HUD_PRINTTALK, "asw_trace_me_msg_to_self");
616-
}
617-
else
618-
{
619-
ClientPrint(pRecipient, HUD_PRINTTALK, "asw_trace_me_msg_to_others", pPlayer->GetPlayerName());
620-
}
621-
}
622-
}
623-
624586
CReactiveDropServerListHelper::CReactiveDropServerListHelper( const char *szDebugName )
625587
{
626588
m_pszDebugName = szDebugName;
@@ -832,3 +794,43 @@ bool CReactiveDropServerList::IsHoIAFServerIP( uint32_t ip )
832794
return HoIAF()->IsRankedServerIP( ip );
833795
}
834796
#endif
797+
798+
#ifndef CLIENT_DLL
799+
CON_COMMAND(rd_lobby_suggest_trace_player, "notify server to send a trace player suggestion to all clients.")
800+
{
801+
if (args.ArgC() < 2)
802+
{
803+
Msg("Usage: rd_lobby_suggest_trace_player <playerIndex>\n");
804+
return;
805+
}
806+
807+
int iPlayerIndex = atoi(args[1]);
808+
if (iPlayerIndex < 1 || iPlayerIndex > gpGlobals->maxClients)
809+
{
810+
Msg("Invalid playerIndex\n");
811+
return;
812+
}
813+
814+
CBasePlayer* pPlayer = UTIL_PlayerByIndex(iPlayerIndex);
815+
if (!pPlayer)
816+
{
817+
Msg("Can't find a player with index <%d>.\n", iPlayerIndex);
818+
return;
819+
}
820+
// Send the message to all players
821+
for (int i = 1; i <= gpGlobals->maxClients; i++)
822+
{
823+
CBasePlayer* pRecipient = UTIL_PlayerByIndex(i);
824+
if (!pRecipient)
825+
continue;
826+
if (pRecipient == pPlayer)
827+
{
828+
ClientPrint(pRecipient, HUD_PRINTTALK, "asw_trace_me_msg_to_self");
829+
}
830+
else
831+
{
832+
ClientPrint(pRecipient, HUD_PRINTTALK, "asw_trace_me_msg_to_others", pPlayer->GetPlayerName());
833+
}
834+
}
835+
}
836+
#endif

0 commit comments

Comments
 (0)