mirror of
https://github.com/shavitush/bhoptimer.git
synced 2025-12-07 10:28:26 +00:00
Show world record time in relevant menus. (#414)
This commit is contained in:
parent
088f82996e
commit
0b7b92f94d
@ -90,6 +90,7 @@ bool gB_Late = false;
|
||||
|
||||
// modules
|
||||
bool gB_Zones = false;
|
||||
bool gB_WR = false;
|
||||
|
||||
// cvars
|
||||
ConVar gCV_Autobhop = null;
|
||||
@ -315,6 +316,7 @@ public void OnPluginStart()
|
||||
}
|
||||
|
||||
gB_Zones = LibraryExists("shavit-zones");
|
||||
gB_WR = LibraryExists("shavit-wr");
|
||||
}
|
||||
|
||||
public void OnConVarChanged(ConVar convar, const char[] oldValue, const char[] newValue)
|
||||
@ -336,6 +338,11 @@ public void OnLibraryAdded(const char[] name)
|
||||
{
|
||||
gB_Zones = true;
|
||||
}
|
||||
|
||||
else if(StrEqual(name, "shavit-wr"))
|
||||
{
|
||||
gB_WR = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void OnLibraryRemoved(const char[] name)
|
||||
@ -344,6 +351,11 @@ public void OnLibraryRemoved(const char[] name)
|
||||
{
|
||||
gB_Zones = false;
|
||||
}
|
||||
|
||||
else if(StrEqual(name, "shavit-wr"))
|
||||
{
|
||||
gB_WR = false;
|
||||
}
|
||||
}
|
||||
|
||||
public void OnAdminMenuReady(Handle topmenu)
|
||||
@ -599,7 +611,22 @@ public Action Command_Style(int client, int args)
|
||||
|
||||
else
|
||||
{
|
||||
strcopy(sDisplay, 64, gS_StyleStrings[i][sStyleName]);
|
||||
float time = 0.0;
|
||||
|
||||
if(gB_WR)
|
||||
{
|
||||
Shavit_GetWRTime(i, time);
|
||||
}
|
||||
|
||||
if(time > 0.0)
|
||||
{
|
||||
FormatEx(sDisplay, 64, "%s - WR: %.01f", gS_StyleStrings[i][sStyleName], time);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
strcopy(sDisplay, 64, gS_StyleStrings[i][sStyleName]);
|
||||
}
|
||||
}
|
||||
|
||||
menu.AddItem(sInfo, sDisplay, (gBS_Style[client] == i)? ITEMDRAW_DISABLED:ITEMDRAW_DEFAULT);
|
||||
@ -622,12 +649,12 @@ public Action Command_Style(int client, int args)
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
public int StyleMenu_Handler(Menu m, MenuAction action, int param1, int param2)
|
||||
public int StyleMenu_Handler(Menu menu, MenuAction action, int param1, int param2)
|
||||
{
|
||||
if(action == MenuAction_Select)
|
||||
{
|
||||
char[] info = new char[16];
|
||||
m.GetItem(param2, info, 16);
|
||||
menu.GetItem(param2, info, 16);
|
||||
|
||||
int style = StringToInt(info);
|
||||
|
||||
@ -641,7 +668,7 @@ public int StyleMenu_Handler(Menu m, MenuAction action, int param1, int param2)
|
||||
|
||||
else if(action == MenuAction_End)
|
||||
{
|
||||
delete m;
|
||||
delete menu;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
@ -1201,8 +1201,8 @@ public Action Command_DeleteReplay(int client, int args)
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
Menu m = new Menu(DeleteReplay_Callback);
|
||||
m.SetTitle("%T", "DeleteReplayMenuTitle", client);
|
||||
Menu menu = new Menu(DeleteReplay_Callback);
|
||||
menu.SetTitle("%T", "DeleteReplayMenuTitle", client);
|
||||
|
||||
for(int i = 0; i < gI_Styles; i++)
|
||||
{
|
||||
@ -1214,18 +1214,33 @@ public Action Command_DeleteReplay(int client, int args)
|
||||
char[] sInfo = new char[4];
|
||||
IntToString(i, sInfo, 4);
|
||||
|
||||
m.AddItem(sInfo, gS_StyleStrings[i][sStyleName]);
|
||||
float time = 0.0;
|
||||
Shavit_GetWRTime(i, time);
|
||||
|
||||
char[] sDisplay = new char[64];
|
||||
|
||||
if(time > 0.0)
|
||||
{
|
||||
FormatEx(sDisplay, 64, "%s - WR: %.01f", gS_StyleStrings[i][sStyleName], time);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
strcopy(sDisplay, 64, gS_StyleStrings[i][sStyleName]);
|
||||
}
|
||||
|
||||
menu.AddItem(sInfo, sDisplay);
|
||||
}
|
||||
|
||||
if(m.ItemCount == 0)
|
||||
if(menu.ItemCount == 0)
|
||||
{
|
||||
char[] sMenuItem = new char[64];
|
||||
FormatEx(sMenuItem, 64, "%T", "ReplaysUnavailable", client);
|
||||
m.AddItem("-1", sMenuItem);
|
||||
menu.AddItem("-1", sMenuItem);
|
||||
}
|
||||
|
||||
m.ExitButton = true;
|
||||
m.Display(client, 20);
|
||||
menu.ExitButton = true;
|
||||
menu.Display(client, 20);
|
||||
|
||||
return Plugin_Handled;
|
||||
}
|
||||
@ -1356,7 +1371,22 @@ Action OpenReplayMenu(int client)
|
||||
char[] sInfo = new char[8];
|
||||
IntToString(i, sInfo, 8);
|
||||
|
||||
menu.AddItem(sInfo, gS_StyleStrings[i][sStyleName], (gI_FrameCount[i] > 0)? ITEMDRAW_DEFAULT:ITEMDRAW_DISABLED);
|
||||
float time = 0.0;
|
||||
Shavit_GetWRTime(i, time);
|
||||
|
||||
char[] sDisplay = new char[64];
|
||||
|
||||
if(time > 0.0)
|
||||
{
|
||||
FormatEx(sDisplay, 64, "%s - WR: %.01f", gS_StyleStrings[i][sStyleName], time);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
strcopy(sDisplay, 64, gS_StyleStrings[i][sStyleName]);
|
||||
}
|
||||
|
||||
menu.AddItem(sInfo, sDisplay, (gI_FrameCount[i] > 0)? ITEMDRAW_DEFAULT:ITEMDRAW_DISABLED);
|
||||
}
|
||||
|
||||
if(menu.ItemCount == 0)
|
||||
|
||||
@ -1103,7 +1103,19 @@ Action ShowWRStyleMenu(int client)
|
||||
char[] sInfo = new char[8];
|
||||
IntToString(i, sInfo, 8);
|
||||
|
||||
menu.AddItem(sInfo, gS_StyleStrings[i][sStyleName]);
|
||||
char[] sDisplay = new char[64];
|
||||
|
||||
if(gF_WRTime[i] > 0.0)
|
||||
{
|
||||
FormatEx(sDisplay, 64, "%s - WR: %.01f", gS_StyleStrings[i][sStyleName], gF_WRTime[i]);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
strcopy(sDisplay, 64, gS_StyleStrings[i][sStyleName]);
|
||||
}
|
||||
|
||||
menu.AddItem(sInfo, sDisplay, (gI_RecordAmount[i] > 0)? ITEMDRAW_DEFAULT:ITEMDRAW_DISABLED);
|
||||
}
|
||||
|
||||
// should NEVER happen
|
||||
|
||||
Loading…
Reference in New Issue
Block a user