]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/weapons/config.qh
Merge branch 'samual/weapons' of http://nl.git.xonotic.org/xonotic/xonotic-data.pk3di...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / weapons / config.qh
1 // ==========================
2 //  Balance Config Generator
3 // ==========================
4
5 void Dump_Weapon_Settings(float fh, float alsoprint)
6 {
7         float i;
8         for(i = WEP_FIRST; i <= WEP_LAST; ++i)
9         {
10                 WEP_ACTION(i, WR_CONFIG)
11         }
12
13                         
14         #define WEP_BAL_WRITE(a) { \
15                 fputs(fh, a); \
16                 if(alsoprint) { print(a); } }
17         #define WEP_BAL_WRITE_ENTITY(description) { \
18                 notif_msg = \
19                         sprintf( \
20                                 "seta notification_%s \"%d\" \"%s\"\n", \
21                                 e.nent_name, e.nent_default, description \
22                         ); \
23                 WEP_BAL_WRITE(notif_msg) }
24         #define WEP_BAL_WRITE_HARDCODED(cvar,default,description) { \
25                 notif_msg = \
26                         sprintf( \
27                                 "seta notification_%s \"%s\" \"%s\"\n", \
28                                 cvar, default, description \
29                         ); \
30                 WEP_BAL_WRITE(notif_msg) }
31
32         string notif_msg;
33         float i;
34         entity e;
35
36         NOTIF_WRITE(sprintf("\n// MSG_ANNCE notifications (count = %d):\n", NOTIF_ANNCE_COUNT));
37         for(i = 1; i <= NOTIF_ANNCE_COUNT; ++i)
38         {
39                 e = Get_Notif_Ent(MSG_ANNCE, i);
40                 if not(e) { backtrace("Dump_Notifications(): Missing notification entity!\n"); return; }
41                 
42                 NOTIF_WRITE_ENTITY(
43                         "Notification control cvar: 0 = disabled, 1 = enabled if gentle mode is off, 2 = always enabled)"
44                 );
45         }
46
47         NOTIF_WRITE(sprintf("\n// MSG_INFO notifications (count = %d):\n", NOTIF_INFO_COUNT));
48         for(i = 1; i <= NOTIF_INFO_COUNT; ++i)
49         {
50                 e = Get_Notif_Ent(MSG_INFO, i);
51                 if not(e) { backtrace("Dump_Notifications(): Missing notification entity!\n"); return; }
52                 
53                 NOTIF_WRITE_ENTITY(
54                         "Notification control cvar: 0 = off, 1 = print to console, "
55                         "2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
56                 );
57         }
58
59         NOTIF_WRITE(sprintf("\n// MSG_CENTER notifications (count = %d):\n", NOTIF_CENTER_COUNT));
60         for(i = 1; i <= NOTIF_CENTER_COUNT; ++i)
61         {
62                 e = Get_Notif_Ent(MSG_CENTER, i);
63                 if not(e) { backtrace("Dump_Notifications(): Missing notification entity!\n"); return; }
64                 
65                 NOTIF_WRITE_ENTITY(
66                         "Notification control cvar: 0 = off, 1 = centerprint"
67                 );
68         }
69
70         NOTIF_WRITE(sprintf("\n// MSG_MULTI notifications (count = %d):\n", NOTIF_MULTI_COUNT));
71         for(i = 1; i <= NOTIF_MULTI_COUNT; ++i)
72         {
73                 e = Get_Notif_Ent(MSG_MULTI, i);
74                 if not(e) { backtrace("Dump_Notifications(): Missing notification entity!\n"); return; }
75                 
76                 NOTIF_WRITE_ENTITY(
77                         "Notification control cvar: 0 = off, 1 = trigger subcalls"
78                 );
79         }
80
81         // edit these to match whichever cvars are used for specific notification options
82         NOTIF_WRITE("\n// HARD CODED notification variables:\n");
83         
84         NOTIF_WRITE_HARDCODED(
85                 "allow_chatboxprint", "1",
86                 "Allow notifications to be printed to chat box by setting notification cvar to 2 "
87                 "(You can also set this cvar to 2 to force ALL notifications to be printed to the chatbox)"
88         );
89
90         NOTIF_WRITE(sprintf(
91                 strcat(
92                         "\n// Notification counts (total = %d): ",
93                         "MSG_ANNCE = %d, MSG_INFO = %d, MSG_CENTER = %d, MSG_MULTI = %d\n"
94                 ),
95                 (
96                         NOTIF_ANNCE_COUNT +
97                         NOTIF_INFO_COUNT +
98                         NOTIF_CENTER_COUNT +
99                         NOTIF_MULTI_COUNT
100                 ),
101                 NOTIF_ANNCE_COUNT,
102                 NOTIF_INFO_COUNT,
103                 NOTIF_CENTER_COUNT,
104                 NOTIF_MULTI_COUNT
105         ));
106         
107         return;
108         #undef NOTIF_WRITE_HARDCODED
109         #undef NOTIF_WRITE_ENTITY
110         #undef NOTIF_WRITE
111 }