Skip to content

Commit e2d9d3b

Browse files
committed
Merge branch 'master' into vscript
2 parents 815ff2d + 21a7b58 commit e2d9d3b

File tree

11 files changed

+188
-25
lines changed

11 files changed

+188
-25
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ jobs:
4343
wget https://github.com/srcwr/eventqueuefixfix/releases/download/v1.0.1/eventqueuefixfix-v1.0.1-def5b0e-windows-x32.zip
4444
unzip eventqueuefixfix-v1.0.1-def5b0e-windows-x32.zip "addons/sourcemod/extensions/*"
4545
rm "addons/sourcemod/extensions/eventqueuefixfix.pdb"
46-
wget https://github.com/srcwr/srcwrfloppy/releases/download/v2.0.3/srcwrfloppy-v2.0.3.zip
47-
unzip -qO UTF-8 srcwrfloppy-v2.0.3.zip "addons/sourcemod/extensions/*"
46+
wget https://github.com/srcwr/srcwrfloppy/releases/download/v2.0.4/srcwrfloppy-v2.0.4.zip
47+
unzip -qO UTF-8 srcwrfloppy-v2.0.4.zip "addons/sourcemod/extensions/*"
4848
rm "addons/sourcemod/extensions/srcwr💾.pdb"
4949
5050
- name: Run compiler

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@ Note: Dates are UTC+0.
33

44

55

6-
# v3.?.? - ? - 2025-0?-? - rtldg
6+
# v3.?.? - ? - 2025-??-? - rtldg
77
what will go here? hmm i wonder... maybe vscript pull request? maybe updating tf2 gamedata because i forgot? who knows...
88

9+
thank pixel for finding that the 0.5s on-ground start-timer thing wasn't working
10+
911

1012

1113
# v3.5.1 - small things - 2025-06-24 - rtldg

addons/sourcemod/scripting/include/shavit/hud.inc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
#define HUD_GLOCK (1 << 14) // makes you spawn with a Glock
4343
#define HUD_DEBUGTARGETNAME (1 << 15) // admin option to show current targetname & classname
4444
#define HUD_SPECTATORSDEAD (1 << 16) // for only showing spectators list when you're dead/spectating.
45+
#define HUD_PERFS_CENTER (1 << 17) // for the perf percentage in the center hud. e.g. "Jumps: 20 (66.6%)"
4546

4647
// HUD2 - these settings will *disable* elements for the main hud
4748
#define HUD2_TIME (1 << 0)

addons/sourcemod/scripting/shavit-core.sp

Lines changed: 43 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,8 @@ Handle gH_Forwards_OnProcessMovementPost = null;
9999
// player timer variables
100100
timer_snapshot_t gA_Timers[MAXPLAYERS+1];
101101
bool gB_Auto[MAXPLAYERS+1];
102-
int gI_FirstTouchedGround[MAXPLAYERS+1];
102+
// 0 is in air, 1 or greater is on ground, -1 means client was on ground with zero...ish... velocity
103+
int gI_FirstTouchedGroundForStartTimer[MAXPLAYERS+1];
103104
int gI_LastTickcount[MAXPLAYERS+1];
104105

105106
// these are here until the compiler bug is fixed
@@ -2334,7 +2335,7 @@ public int Native_SetPracticeMode(Handle handler, int numParams)
23342335
bool practice = view_as<bool>(GetNativeCell(2));
23352336
bool alert = view_as<bool>(GetNativeCell(3));
23362337

2337-
if(alert && practice && !gA_Timers[client].bPracticeMode && (!gB_HUD || (Shavit_GetHUDSettings(client) & HUD_NOPRACALERT) == 0))
2338+
if(alert && practice && !gA_Timers[client].bPracticeMode && (!gB_HUD || (Shavit_GetHUDSettings(client) & HUD_NOPRACALERT) == 0) && !Shavit_InsideZone(client, Zone_Start, -1))
23382339
{
23392340
Shavit_PrintToChat(client, "%T", "PracticeModeAlert", client, gS_ChatStrings.sWarning, gS_ChatStrings.sText);
23402341
}
@@ -2603,10 +2604,20 @@ bool CanStartTimer(int client, int track, bool skipGroundCheck)
26032604

26042605
if (skipGroundTimer) return true;
26052606

2606-
int halfSecOfTicks = RoundFloat(0.5 / GetTickInterval());
2607-
int onGroundTicks = gI_LastTickcount[client] - gI_FirstTouchedGround[client];
2607+
if (gI_FirstTouchedGroundForStartTimer[client] < 0)
2608+
{
2609+
// was on ground with zero...ish... velocity...
2610+
return true;
2611+
}
2612+
else if (gI_FirstTouchedGroundForStartTimer[client] > 0)
2613+
{
2614+
int halfSecOfTicks = RoundFloat(0.5 / GetTickInterval());
2615+
int onGroundTicks = gI_LastTickcount[client] - gI_FirstTouchedGroundForStartTimer[client];
2616+
2617+
return onGroundTicks >= halfSecOfTicks;
2618+
}
26082619

2609-
return onGroundTicks >= halfSecOfTicks;
2620+
return false;
26102621
}
26112622

26122623
void StartTimer(int client, int track, bool skipGroundCheck)
@@ -2810,7 +2821,7 @@ public void OnClientPutInServer(int client)
28102821
gA_Timers[client].fNextFrameTime = 0.0;
28112822
gA_Timers[client].fplayer_speedmod = 1.0;
28122823
gS_DeleteMap[client][0] = 0;
2813-
gI_FirstTouchedGround[client] = 0;
2824+
gI_FirstTouchedGroundForStartTimer[client] = 0;
28142825
gI_LastTickcount[client] = 0;
28152826
gI_HijackFrames[client] = 0;
28162827
gI_LastPrintedSteamID[client] = 0;
@@ -3693,10 +3704,35 @@ public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3
36933704

36943705
gI_LastTickcount[client] = tickcount;
36953706

3707+
if (bOnGround)
3708+
{
3709+
if (gI_FirstTouchedGroundForStartTimer[client] == 0)
3710+
{
3711+
// just landed (or teleported to the ground or whatever)
3712+
gI_FirstTouchedGroundForStartTimer[client] = tickcount;
3713+
}
3714+
3715+
if (gI_FirstTouchedGroundForStartTimer[client] > 0)
3716+
{
3717+
float fSpeed[3];
3718+
GetEntPropVector(client, Prop_Data, "m_vecAbsVelocity", fSpeed);
3719+
3720+
// zero...ish... velocity... (squared-ish (cubed?))
3721+
if (GetVectorLength(fSpeed, true) <= 1000.0)
3722+
{
3723+
gI_FirstTouchedGroundForStartTimer[client] = -1;
3724+
}
3725+
}
3726+
}
3727+
else
3728+
{
3729+
gI_FirstTouchedGroundForStartTimer[client] = 0;
3730+
}
3731+
36963732
if(bOnGround && !gA_Timers[client].bOnGround)
36973733
{
36983734
gA_Timers[client].iLandingTick = tickcount;
3699-
gI_FirstTouchedGround[client] = tickcount;
3735+
gI_FirstTouchedGroundForStartTimer[client] = tickcount;
37003736

37013737
if (gEV_Type != Engine_TF2 && GetStyleSettingBool(gA_Timers[client].bsStyle, "easybhop"))
37023738
{

addons/sourcemod/scripting/shavit-hud.sp

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@ public void OnPluginStart()
209209
..."HUD_USP 8192\n"
210210
..."HUD_GLOCK 16384\n"
211211
..."HUD_SPECTATORSDEAD 65536\n"
212+
..."HUD_PERFS_CENTER 131072\n"
212213
);
213214

214215
IntToString(HUD_DEFAULT2, defaultHUD, 8);
@@ -776,6 +777,10 @@ Action ShowHUDMenu(int client, int item)
776777
FormatEx(sHudItem, 64, "%T", "HudPerfs", client);
777778
menu.AddItem(sInfo, sHudItem);
778779

780+
FormatEx(sInfo, 16, "!%d", HUD_PERFS_CENTER);
781+
FormatEx(sHudItem, 64, "%T", "HudPerfsCenter", client);
782+
menu.AddItem(sInfo, sHudItem);
783+
779784
FormatEx(sInfo, 16, "@%d", HUD2_STYLE);
780785
FormatEx(sHudItem, 64, "%T", "HudStyleText", client);
781786
menu.AddItem(sInfo, sHudItem);
@@ -1369,7 +1374,15 @@ int AddHUDToBuffer_Source2013(int client, huddata_t data, char[] buffer, int max
13691374

13701375
if((gI_HUD2Settings[client] & HUD2_JUMPS) == 0)
13711376
{
1372-
FormatEx(sLine, 128, "%T: %d", "HudJumpsText", client, data.iJumps);
1377+
if (!Shavit_GetStyleSettingBool(data.iStyle, "autobhop") && (gI_HUDSettings[client] & HUD_PERFS_CENTER))
1378+
{
1379+
FormatEx(sLine, 128, "%T: %d (%.1f%)", "HudJumpsText", client, data.iJumps, Shavit_GetPerfectJumps(data.iTarget));
1380+
}
1381+
else
1382+
{
1383+
FormatEx(sLine, 128, "%T: %d", "HudJumpsText", client, data.iJumps);
1384+
}
1385+
13731386
AddHUDLine(buffer, maxlen, sLine, iLines);
13741387
}
13751388

addons/sourcemod/scripting/shavit-misc.sp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2454,7 +2454,7 @@ public void Shavit_OnRestart(int client, int track)
24542454
{
24552455
SetEntPropFloat(client, Prop_Send, "m_flStamina", 0.0);
24562456

2457-
if (gCV_RestartWithFullHP.BoolValue)
2457+
if (gCV_RestartWithFullHP.BoolValue && GetClientHealth(client) <= 100)
24582458
{
24592459
SetEntityHealth(client, 100);
24602460
SetEntProp(client, Prop_Send, "m_ArmorValue", 100);

addons/sourcemod/scripting/shavit-rankings.sp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -631,9 +631,11 @@ public Action Command_SetTier(int client, int args)
631631

632632
int tier = StringToInt(sArg);
633633

634-
if(args == 0 || tier < 1 || tier > 10)
634+
int maxtier = GetMaxTier();
635+
636+
if(args == 0 || tier < 1 || tier > maxtier)
635637
{
636-
ReplyToCommand(client, "%T", "ArgumentsMissing", client, "sm_settier <tier> (1-10) [map]");
638+
ReplyToCommand(client, "%T", "ArgumentsMissing", client, "sm_settier <tier> (1-%d) [map]", maxtier);
637639

638640
return Plugin_Handled;
639641
}
@@ -1722,3 +1724,10 @@ public void SQL_DeleteMap_Callback(Database db, DBResultSet results, const char[
17221724
UpdateAllPoints(true);
17231725
}
17241726
}
1727+
1728+
int GetMaxTier()
1729+
{
1730+
float val = 10.0;
1731+
gCV_DefaultTier.GetBounds(ConVarBound_Upper, val);
1732+
return RoundToFloor(val);
1733+
}

addons/sourcemod/scripting/shavit-stats.sp

Lines changed: 92 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ int gI_MapType[MAXPLAYERS+1];
5656
int gI_Style[MAXPLAYERS+1];
5757
int gI_MenuPos[MAXPLAYERS+1];
5858
int gI_Track[MAXPLAYERS+1];
59+
int gI_Tier[MAXPLAYERS+1];
5960
int gI_TargetSteamID[MAXPLAYERS+1];
6061
char gS_TargetName[MAXPLAYERS+1][MAX_NAME_LENGTH];
6162

@@ -753,10 +754,47 @@ public int MenuHandler_MapsDoneLeft_Track(Menu menu, MenuAction action, int para
753754
{
754755
if(action == MenuAction_Select)
755756
{
756-
char sInfo[8];
757+
char sInfo[8], sTier[16];
757758
menu.GetItem(param2, sInfo, 8);
758759
gI_Track[param1] = StringToInt(sInfo);
759760

761+
if(gB_Rankings)
762+
{
763+
Menu submenu = new Menu(MenuHandler_MapsDoneLeft_Tier);
764+
submenu.SetTitle("%T\n ", "SelectTier", param1);
765+
766+
submenu.AddItem("0", "All");
767+
768+
for(int i = 1; i <= 10; ++i)
769+
{
770+
IntToString(i, sInfo, 8);
771+
FormatEx(sTier, 16, "Tier %d", i);
772+
submenu.AddItem(sInfo, sTier);
773+
}
774+
775+
submenu.Display(param1, MENU_TIME_FOREVER);
776+
}
777+
else
778+
{
779+
ShowMaps(param1);
780+
}
781+
}
782+
else if(action == MenuAction_End)
783+
{
784+
delete menu;
785+
}
786+
787+
return 0;
788+
}
789+
790+
public int MenuHandler_MapsDoneLeft_Tier(Menu menu, MenuAction action, int param1, int param2)
791+
{
792+
if(action == MenuAction_Select)
793+
{
794+
char sInfo[8];
795+
menu.GetItem(param2, sInfo, 8);
796+
gI_Tier[param1] = StringToInt(sInfo);
797+
760798
ShowMaps(param1);
761799
}
762800
else if(action == MenuAction_End)
@@ -1180,7 +1218,7 @@ public int MenuHandler_TypeHandler(Menu menu, MenuAction action, int param1, int
11801218
{
11811219
if(action == MenuAction_Select)
11821220
{
1183-
char sInfo[32];
1221+
char sInfo[32], sTier[16];
11841222
menu.GetItem(param2, sInfo, 32);
11851223

11861224
char sExploded[2][4];
@@ -1189,7 +1227,26 @@ public int MenuHandler_TypeHandler(Menu menu, MenuAction action, int param1, int
11891227
gI_Track[param1] = StringToInt(sExploded[0]);
11901228
gI_MapType[param1] = StringToInt(sExploded[1]);
11911229

1192-
ShowMaps(param1);
1230+
if(gB_Rankings)
1231+
{
1232+
Menu submenu = new Menu(MenuHandler_MapsDoneLeft_Tier);
1233+
submenu.SetTitle("%T\n ", "SelectTier", param1);
1234+
1235+
submenu.AddItem("0", "All");
1236+
1237+
for(int i = 1; i <= 10; ++i)
1238+
{
1239+
IntToString(i, sInfo, 8);
1240+
FormatEx(sTier, 16, "Tier %d", i);
1241+
submenu.AddItem(sInfo, sTier);
1242+
}
1243+
1244+
submenu.Display(param1, MENU_TIME_FOREVER);
1245+
}
1246+
else
1247+
{
1248+
ShowMaps(param1);
1249+
}
11931250
}
11941251
else if(action == MenuAction_Cancel && param2 == MenuCancel_ExitBack)
11951252
{
@@ -1210,21 +1267,39 @@ void ShowMaps(int client)
12101267
return;
12111268
}
12121269

1213-
char sQuery[512];
1270+
char sQuery[512], tierStr[32];
1271+
1272+
if(gI_Tier[client] > 0)
1273+
{
1274+
FormatEx(tierStr, 32, " AND t.tier = %d", gI_Tier[client]);
1275+
}
1276+
else
1277+
{
1278+
gI_Tier[client] = 0;
1279+
}
12141280

12151281
if(gI_MapType[client] == MAPSDONE)
12161282
{
1217-
FormatEx(sQuery, 512,
1218-
"SELECT a.map, a.time, a.jumps, a.id, COUNT(b.map) + 1 as 'rank', a.points FROM %splayertimes a LEFT JOIN %splayertimes b ON a.time > b.time AND a.map = b.map AND a.style = b.style AND a.track = b.track WHERE a.auth = %d AND a.style = %d AND a.track = %d GROUP BY a.map, a.time, a.jumps, a.id, a.points ORDER BY a.%s;",
1219-
gS_MySQLPrefix, gS_MySQLPrefix, gI_TargetSteamID[client], gI_Style[client], gI_Track[client], (gB_Rankings)? "points DESC":"map");
1283+
if(gB_Rankings)
1284+
{
1285+
FormatEx(sQuery, 512,
1286+
"SELECT a.map, a.time, a.jumps, a.id, COUNT(b.map) + 1 as 'rank', a.points FROM %splayertimes a LEFT JOIN %splayertimes b ON a.time > b.time AND a.map = b.map AND a.style = b.style AND a.track = b.track LEFT JOIN %smaptiers t ON a.map = t.map WHERE a.auth = %d AND a.style = %d AND a.track = %d%s GROUP BY a.map, a.time, a.jumps, a.id, a.points ORDER BY a.points DESC;",
1287+
gS_MySQLPrefix, gS_MySQLPrefix, gS_MySQLPrefix, gI_TargetSteamID[client], gI_Style[client], gI_Track[client], tierStr);
1288+
}
1289+
else
1290+
{
1291+
FormatEx(sQuery, 512,
1292+
"SELECT a.map, a.time, a.jumps, a.id, COUNT(b.map) + 1 as 'rank', a.points FROM %splayertimes a LEFT JOIN %splayertimes b ON a.time > b.time AND a.map = b.map AND a.style = b.style AND a.track = b.track WHERE a.auth = %d AND a.style = %d AND a.track = %d GROUP BY a.map, a.time, a.jumps, a.id, a.points ORDER BY a.map;",
1293+
gS_MySQLPrefix, gS_MySQLPrefix, gI_TargetSteamID[client], gI_Style[client], gI_Track[client]);
1294+
}
12201295
}
12211296
else
12221297
{
12231298
if(gB_Rankings)
12241299
{
12251300
FormatEx(sQuery, 512,
1226-
"SELECT DISTINCT m.map, t.tier FROM %smapzones m LEFT JOIN %smaptiers t ON m.map = t.map WHERE m.type = 0 AND m.track = %d AND m.map NOT IN (SELECT DISTINCT map FROM %splayertimes WHERE auth = %d AND style = %d AND track = %d) ORDER BY m.map;",
1227-
gS_MySQLPrefix, gS_MySQLPrefix, gI_Track[client], gS_MySQLPrefix, gI_TargetSteamID[client], gI_Style[client], gI_Track[client]);
1301+
"SELECT DISTINCT m.map, t.tier FROM %smapzones m LEFT JOIN %smaptiers t ON m.map = t.map WHERE m.type = 0 AND m.track = %d%s AND m.map NOT IN (SELECT DISTINCT map FROM %splayertimes WHERE auth = %d AND style = %d AND track = %d) ORDER BY m.map;",
1302+
gS_MySQLPrefix, gS_MySQLPrefix, gI_Track[client], tierStr, gS_MySQLPrefix, gI_TargetSteamID[client], gI_Style[client], gI_Track[client]);
12281303
}
12291304
else
12301305
{
@@ -1328,13 +1403,19 @@ public void ShowMapsCallback(Database db, DBResultSet results, const char[] erro
13281403
menu.AddItem(sRecordID, sDisplay);
13291404
}
13301405

1406+
char sTier[8];
1407+
if(gI_Tier[client] > 0)
1408+
{
1409+
FormatEx(sTier, 8, "T%d ", gI_Tier[client]);
1410+
}
1411+
13311412
if(gI_MapType[client] == MAPSDONE)
13321413
{
1333-
menu.SetTitle("%T (%s)", "MapsDoneFor", client, gS_StyleStrings[gI_Style[client]].sShortName, gS_TargetName[client], rows, sTrack);
1414+
menu.SetTitle("%s%T (%s)", sTier, "MapsDoneFor", client, gS_StyleStrings[gI_Style[client]].sShortName, gS_TargetName[client], rows, sTrack);
13341415
}
13351416
else
13361417
{
1337-
menu.SetTitle("%T (%s)", "MapsLeftFor", client, gS_StyleStrings[gI_Style[client]].sShortName, gS_TargetName[client], rows, sTrack);
1418+
menu.SetTitle("%s%T (%s)", sTier, "MapsLeftFor", client, gS_StyleStrings[gI_Style[client]].sShortName, gS_TargetName[client], rows, sTrack);
13381419
}
13391420

13401421
if(menu.ItemCount == 0)

addons/sourcemod/scripting/shavit-wr.sp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,10 +187,15 @@ public void OnPluginStart()
187187
// player commands
188188
RegConsoleCmd("sm_wr", Command_WorldRecord, "View the leaderboard of a map. Usage: sm_wr [map]");
189189
RegConsoleCmd("sm_worldrecord", Command_WorldRecord, "View the leaderboard of a map. Usage: sm_worldrecord [map]");
190+
RegConsoleCmd("sm_sr", Command_WorldRecord, "View the leaderboard of a map. Usage: sm_sr [map]");
191+
RegConsoleCmd("sm_serverrecord", Command_WorldRecord, "View the leaderboard of a map. Usage: sm_serverrecord [map]");
190192

191193
RegConsoleCmd("sm_bwr", Command_WorldRecord, "View the leaderboard of a map. Usage: sm_bwr [map] [bonus number]");
192194
RegConsoleCmd("sm_bworldrecord", Command_WorldRecord, "View the leaderboard of a map. Usage: sm_bworldrecord [map] [bonus number]");
193195
RegConsoleCmd("sm_bonusworldrecord", Command_WorldRecord, "View the leaderboard of a map. Usage: sm_bonusworldrecord [map] [bonus number]");
196+
RegConsoleCmd("sm_bsr", Command_WorldRecord, "View the leaderboard of a map. Usage: sm_bsr [map] [bonus number]");
197+
RegConsoleCmd("sm_bserverrecord", Command_WorldRecord, "View the leaderboard of a map. Usage: sm_bserverrecord [map] [bonus number]");
198+
RegConsoleCmd("sm_bonusserverrecord", Command_WorldRecord, "View the leaderboard of a map. Usage: sm_bonusserverrecord [map] [bonus number]");
194199

195200
RegConsoleCmd("sm_recent", Command_RecentRecords, "View the recent #1 times set.");
196201
RegConsoleCmd("sm_recentrecords", Command_RecentRecords, "View the recent #1 times set.");
@@ -438,9 +443,17 @@ void RegisterWRCommands(int style)
438443
gSM_StyleCommands.SetValue(sCommand, style);
439444
RegConsoleCmd(sCommand, Command_WorldRecord_Style, sDescription);
440445

446+
FormatEx(sCommand, sizeof(sCommand), "sm_sr%s", sStyleCommands[x]);
447+
gSM_StyleCommands.SetValue(sCommand, style);
448+
RegConsoleCmd(sCommand, Command_WorldRecord_Style, sDescription);
449+
441450
FormatEx(sCommand, sizeof(sCommand), "sm_bwr%s", sStyleCommands[x]);
442451
gSM_StyleCommands.SetValue(sCommand, style);
443452
RegConsoleCmd(sCommand, Command_WorldRecord_Style, sDescription);
453+
454+
FormatEx(sCommand, sizeof(sCommand), "sm_bsr%s", sStyleCommands[x]);
455+
gSM_StyleCommands.SetValue(sCommand, style);
456+
RegConsoleCmd(sCommand, Command_WorldRecord_Style, sDescription);
444457
}
445458
}
446459

addons/sourcemod/translations/shavit-hud.phrases.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,10 @@
8585
{
8686
"en" "Perfect jumps"
8787
}
88+
"HudPerfsCenter"
89+
{
90+
"en" "Perfect jumps (center hud)"
91+
}
8892
"HudDefaultPistol"
8993
{
9094
"en" "Default Pistol: 1=USP 2=Glock"

0 commit comments

Comments
 (0)