1 // ==========================
2 // Balance Config Generator
3 // ==========================
5 void W_Config_Queue_Swap(float root, float child, entity pass)
7 string oldroot = wep_config_queue[root];
8 wep_config_queue[root] = wep_config_queue[child];
9 wep_config_queue[child] = oldroot;
12 float W_Config_Queue_Compare(float root, float child, entity pass)
16 for(i = 1; i <= 100; ++i)
18 r = str2chr(wep_config_queue[root], i);
19 c = str2chr(wep_config_queue[child], i);
20 if(r == c) { continue; }
21 else if(c > r) { return -1; }
28 void Dump_Weapon_Settings(void)
31 for(i = WEP_FIRST; i <= WEP_LAST; ++i)
33 // step 1: clear the queue
35 for(x = 0; x <= MAX_WEP_CONFIG; ++x)
36 { wep_config_queue[x] = string_null; }
38 // step 2: build new queue
39 WEP_ACTION(i, WR_CONFIG);
42 heapsort(WEP_CONFIG_COUNT, W_Config_Queue_Swap, W_Config_Queue_Compare, world);
44 // step 4: write queue
45 WEP_CONFIG_WRITE(sprintf("// {{{ #%d: %s\n// %d settings\n", i, W_Name(i), WEP_CONFIG_COUNT))
46 for(x = 0; x <= WEP_CONFIG_COUNT; ++x)
47 { WEP_CONFIG_WRITE(wep_config_queue[x]) }
48 WEP_CONFIG_WRITE("// }}}\n")
52 * float WEP_CONFIG_COUNT;
53 string wep_config_queue[MAX_WEP_CONFIG];
54 #define WEP_BAL_WRITE(a) { \
56 if(alsoprint) { print(a); } }
57 #define WEP_BAL_WRITE_ENTITY(description) { \
60 "seta notification_%s \"%d\" \"%s\"\n", \
61 e.nent_name, e.nent_default, description \
63 WEP_BAL_WRITE(notif_msg) }
64 #define WEP_BAL_WRITE_HARDCODED(cvar,default,description) { \
67 "seta notification_%s \"%s\" \"%s\"\n", \
68 cvar, default, description \
70 WEP_BAL_WRITE(notif_msg) }
76 NOTIF_WRITE(sprintf("\n// MSG_ANNCE notifications (count = %d):\n", NOTIF_ANNCE_COUNT));
77 for(i = 1; i <= NOTIF_ANNCE_COUNT; ++i)
79 e = Get_Notif_Ent(MSG_ANNCE, i);
80 if not(e) { backtrace("Dump_Notifications(): Missing notification entity!\n"); return; }
83 "Notification control cvar: 0 = disabled, 1 = enabled if gentle mode is off, 2 = always enabled)"
87 NOTIF_WRITE(sprintf("\n// MSG_INFO notifications (count = %d):\n", NOTIF_INFO_COUNT));
88 for(i = 1; i <= NOTIF_INFO_COUNT; ++i)
90 e = Get_Notif_Ent(MSG_INFO, i);
91 if not(e) { backtrace("Dump_Notifications(): Missing notification entity!\n"); return; }
94 "Notification control cvar: 0 = off, 1 = print to console, "
95 "2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
99 NOTIF_WRITE(sprintf("\n// MSG_CENTER notifications (count = %d):\n", NOTIF_CENTER_COUNT));
100 for(i = 1; i <= NOTIF_CENTER_COUNT; ++i)
102 e = Get_Notif_Ent(MSG_CENTER, i);
103 if not(e) { backtrace("Dump_Notifications(): Missing notification entity!\n"); return; }
106 "Notification control cvar: 0 = off, 1 = centerprint"
110 NOTIF_WRITE(sprintf("\n// MSG_MULTI notifications (count = %d):\n", NOTIF_MULTI_COUNT));
111 for(i = 1; i <= NOTIF_MULTI_COUNT; ++i)
113 e = Get_Notif_Ent(MSG_MULTI, i);
114 if not(e) { backtrace("Dump_Notifications(): Missing notification entity!\n"); return; }
117 "Notification control cvar: 0 = off, 1 = trigger subcalls"
121 // edit these to match whichever cvars are used for specific notification options
122 NOTIF_WRITE("\n// HARD CODED notification variables:\n");
124 NOTIF_WRITE_HARDCODED(
125 "allow_chatboxprint", "1",
126 "Allow notifications to be printed to chat box by setting notification cvar to 2 "
127 "(You can also set this cvar to 2 to force ALL notifications to be printed to the chatbox)"
132 "\n// Notification counts (total = %d): ",
133 "MSG_ANNCE = %d, MSG_INFO = %d, MSG_CENTER = %d, MSG_MULTI = %d\n"
148 #undef NOTIF_WRITE_HARDCODED
149 #undef NOTIF_WRITE_ENTITY