Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
LastDemon99 committed May 2, 2023
1 parent 9c7aa3d commit af3a451
Show file tree
Hide file tree
Showing 34 changed files with 7,985 additions and 2,014 deletions.
19 changes: 19 additions & 0 deletions EasyMenus/dynamicMenu.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import simpleMenu as menu

codPath = 'D:/Program Files/Steam/steamapps/common/Call of Duty Modern Warfare 3'

menuFiles = menu.fastLoad()
menuFiles.precache_gsc_path = f'{codPath}/zonetool/mod/maps/mp/gametypes/_menus.gsc'
menuFiles.mod_csv_path = f'{codPath}/zone_source/mod.csv'
menuFiles.scriptmenus_folder_path = f'{codPath}/zonetool/mod/ui_mp/scriptmenus'

menuName = 'custom_dynamic_menu'
newMenu = menu.defaultMultiplayerMenu(menuName)
newMenu.createOptions(
'dvarstring( "menu_title" )',
[f'dvarstring( "menu_option{i}" )' for i in range(20)],
[True for i in range(20)],
True)
menuFiles.loadMenuFiles(menuName, newMenu)

menuFiles.loadMod(codPath, 'zonetool.exe', 'lb_server')
78 changes: 78 additions & 0 deletions EasyMenus/maps/mp/dynamic_menu_utility.gsc
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
#include common_scripts\utility;
#include maps\mp\_utility;

_openMenu(menu)
{
self closeMenus();
if (menu != "") self openpopupMenu(menu);
}

menuInit()
{
self setClientDvar("ui_startIndex", -1);
self setClientDvar("menu_title", "");
self.pers["menu_pages"] = [];
}

getMenu(count)
{
count = isDefined(count) ? count + 1 : 1;
return self.pers["menu_pages"][self.pers["menu_pages"].size - count];
}

pushMenu(title, table, startIndex, range)
{
menu = [];
menu["title"] = title;
menu["table"] = table;
menu["startIndex"] = startIndex;
menu["range"] = range;

self.pers["menu_pages"][self.pers["menu_pages"].size] = menu;
self openDynamicMenu();
}

popMenu()
{
if (!isDefined(self.pers["menu_pages"]) || self.pers["menu_pages"].size < 1) return;

newMenuPages = [];
for (i = 0; i < self.pers["menu_pages"].size - 1; i++)
newMenuPages[i] = self.pers["menu_pages"][i];

self.pers["menu_pages"] = newMenuPages;
self openDynamicMenu();
}

openDynamicMenu()
{
menu = self getMenu();
self setClientDvar("menu_title", "@" + menu["title"]);

for(i = 0; i < 20; i++)
{
self setClientDvar("optionType" + i, 1);
if(i < menu["range"]) self setClientDvar("menu_option" + i, "@" + tableLookup("mp/" + menu["table"] + ".csv", 0, i + menu["startIndex"], 2));
else self setClientDvar("menu_option" + i, "");
}
self _openMenu("custom_dynamic_menu");
}

setOptionType(type, table, startIndex, range, target)
{
for(i = 0; i < range; i++)
if(target == tableLookup("mp/"+ table + ".csv", 0, i + startIndex, 1))
{
self setClientDvar("optionType" + i, type);
break;
}
}

setOptionsType(type, table, startIndex, range, targets)
{
for(i = 0; i < range; i++)
{
val = tableLookup("mp/"+ table + ".csv", 0, i + startIndex, 1);
if(maps\mp\_lb_utility::contains(targets, val)) self setClientDvar("optionType" + i, type);
}
}
Loading

0 comments on commit af3a451

Please sign in to comment.