2 // NOTE: This file contains lots of debugging stuff
3 // it is not really used... can be seen as another sample...
5 string STR_PLAYER = "player";
6 #define FOR_EACH_PLAYER(v) for(v = world; (v = find(v, classname, STR_PLAYER)) != world; )
14 menu_show = menu_show_error;
15 menu_action = menu_sub_null;
18 strunzone(ctf_temp_1);*/
20 localcmd("\nin_bindmap 0 0;");
23 void() order_menu_render =
27 local string frags, color;
31 color = getplayerkey(player_localentnum-1, "topcolor");
33 if(getstati(STAT_CTF_STATE) == CTF_STATE_COMMANDER) {
34 drawstring(ps, "\x1D\x1E\x1E\x1E\x1E Order Menu \x1E\x1E\x1E\x1E\x1F", '8 8 0', '1 1 0', 1, 0); ps += po;
35 drawstring(ps, strcat("Order: ", ctf_temp_1), '8 8 0', '1 1 0', 1, 0); ps += po;
36 drawcolorcodedstring(ps, "1) ^3previous page", '8 8 0', 1, 0); ps += po;
37 drawcolorcodedstring(ps, "2) ^3next page", '8 8 0', 1, 0); ps += po;
38 for((n = 2), (p = i = 0); i < maxclients && n > 0; ++i) {
39 frags = getplayerkey(i, "frags");
40 if(!frags || (i+1) == player_localentnum)
42 if(frags == "-666" || getplayerkey(i, "topcolor") != color) // FIXME use GetPlayerTeam
45 if(p > (8*order_page))
47 // only render current page
51 drawcolorcodedstring(ps, strcat(ftos(n), ") ", GetPlayerName(i), " : ", ftos(getstatf(STAT_CTF_STATE))), '8 8 0', 1, 0); ps += po;
54 drawstring(ps, "ESC) Exit Menu", '8 8 0', '1 1 0', 1, 0); ps += po;
60 float(float bInputType, float nPrimary, float nSecondary) order_menu_action =
63 local float p, i, n, chose;
64 local string frags, color;
65 if(bInputType != 0) // key down wanted
68 arg = chr2str(nSecondary);
69 chose = stof(chr2str(nPrimary));
72 color = getplayerkey(player_localentnum-1, "topcolor");
74 for(p = i = 0; i < maxclients; ++i) {
75 frags = getplayerkey(i, "frags");
76 if(!frags || (i+1) == player_localentnum)
78 if(frags == "-666" || getplayerkey(i, "topcolor") != color) // FIXME use GetPlayerTeam
82 if(p <= (8*order_page)) // no ppl on page
84 } else if(arg == "2") {
85 color = getplayerkey(player_localentnum-1, "topcolor");
88 for(p = i = 0; i < maxclients; ++i) {
89 frags = getplayerkey(i, "frags");
90 if(!frags || (i+1) == player_localentnum)
92 if(frags == "-666" || getplayerkey(i, "topcolor") != color) // FIXME use GetPlayerTeam
96 order_page = floor(p/8);
98 } else if(chose >= 3 && chose <= 9 || arg == "0") { // the 10 needs extra checking, assuming that stof(astring) returns 0
102 color = getplayerkey(player_localentnum-1, "topcolor");
103 for(p = i = 0; i < maxclients && n > 0; ++i) {
104 frags = getplayerkey(i, "frags");
105 if(!frags || (i+1) == player_localentnum)
107 if(frags == "-666" || getplayerkey(i, "topcolor") != color) // FIXME use GetPlayerTeam
110 if(p > (8*order_page))
112 // only render current page
121 //print(strcat("Issuing order to: ", ftos(i+1), "\n"));
122 //print(strcat("cmd order #", ftos(i+1), " ", ctf_temp_1, ";\n"));
123 localcmd(strcat("\ncmd order #", ftos(i+1), " ", ctf_temp_1, ";"));
125 print(strcat("Couldn't find player ", ftos(chose), "\n"));
128 } else if(nSecondary == K_ESCAPE) {
129 strunzone(ctf_temp_1);
132 //print(strcat("Menu action ", arg, " does not exist.\n"));
138 void() order_menu_show =
141 menu_show = order_menu_render;
142 menu_action = order_menu_action;
146 void() ctf_menu_render =
152 if(getstati(STAT_CTF_STATE) == CTF_STATE_COMMANDER) {
153 drawstring(ps, "\x1D\x1E\x1E\x1E\x1E Command Menu \x1E\x1E\x1E\x1E\x1F", '8 8 0', '1 1 0', 1, 0); ps += po;
154 drawstring(ps, "Issue orders:", '8 8 0', '1 1 0', 1, 0); ps += po;
155 drawstring(ps, " 1) Attack ", '8 8 0', '1 1 0', 1, 0);
156 drawstring(ps + '80 0 0', " \x0F", '8 8 0', '1 1 1', 1, 0); ps += po;
157 drawstring(ps, " 2) Defend \x0E", '8 8 0', '1 1 0', 1, 0); ps += po;
159 drawstring(ps, "3) Resign from command.", '8 8 0', '1 1 0', 1, 0); ps += po;
160 drawstring(ps, "ESC) Exit Menu", '8 8 0', '1 1 0', 1, 0); ps += po;
166 float(float bInputType, float nPrimary, float nSecondary) ctf_menu_action =
169 if(bInputType != 0) // key down wanted
172 arg = chr2str(nSecondary);
175 ctf_temp_1 = strzone("attack");
177 } else if(arg == "2") {
178 ctf_temp_1 = strzone("defend");
180 } else if(arg == "3") {
181 localcmd("\ncmd order resign;");
183 } else if(nSecondary == K_ESCAPE) {
186 //print(strcat("Menu action ", arg, " does not exist.\n"));
192 void() ctf_menu_show =
194 if(getstati(STAT_CTF_STATE) < 0)
196 menu_show = ctf_menu_render;
197 menu_action = ctf_menu_action;
199 //menu_default_binds();
205 stat = getstati(STAT_CTF_STATE);
206 if(stat == CTF_STATE_ATTACK) {
207 drawpic('0 0 0', "gfx/ctf_ic_atk.tga", '64 64 0', '1 1 1', 1, 0);
208 } else if(stat == CTF_STATE_DEFEND) {
209 drawpic('0 0 0', "gfx/ctf_ic_def.tga", '64 64 0', '1 1 1', 1, 0);
210 } else if(stat == CTF_STATE_COMMANDER) {
211 drawstring('0 0 0', "You're commander!", '8 8 0', '1 1 1', 1, 0);
212 } else if(stat < 0) {
214 drawstring('0 0 0', "Awaiting orders...", '8 8 0', '1 1 1', 0.5, 0);