1 ///////////////////////////////////////////////
2 // Custom Menu Source File
3 ///////////////////////
4 // This file belongs to dpmod/darkplaces
5 // AK contains menu specific stuff that is made especially for dpmod
6 // AK this file is used e.g. for defining some special event functions
7 ////////////////////////////////////////////////
13 void() nex_setposition =
16 self.pos_y = (self.font_size_y + 5) * self.orderpos;
19 self.origin = self.pos;
22 void(entity item) nex_makeonlyvisible =
26 if( item.flag & FLAG_HIDDEN )
27 item.flag = item.flag - FLAG_HIDDEN;
28 for( node = item._next ; node ; node = node._next )
29 node.flag = item.flag | FLAG_HIDDEN;
30 for( node = item._prev ; node ; node = node._prev )
31 node.flag = item.flag | FLAG_HIDDEN;
34 void(void) nex_linkrelhack =
36 self._child._parent = self;
39 void(void) nex_maketextzone =
41 self.text = strzone(self.text);
44 void(void) nex_slidertext =
49 print("No link specified\n");
51 self.init = null_function;
55 ent = menu_getitem(self.link);
56 if(ent == null_entity)
58 objerror("No link found for ", self.link,"\n");
63 self.flag = self.flag | FLAG_DRAWREFRESHONLY;
65 self.refresh = _nex_slidertext_refresh;
68 void(void) _nex_slidertext_refresh =
70 self.text = ftos(self._link.value);
72 self.text = substring(self.text,0, self.maxlen);
73 // reset the size, so its set
77 float(float keynr, float ascii) nex_redirect_key =
79 if((ascii>=20 && ascii <= 126) || keynr == K_BACKSPACE || keynr == K_ENTER || keynr == K_LEFTARROW || keynr == K_RIGHTARROW || (keynr >= K_MOUSE1 && keynr <= K_MOUSE10))
81 raise_key(self._child, keynr, ascii);
87 void(void) nex_cvar_slider =
89 self.value = cvar(self.cvarname);
90 self.slidermove = self.switchchange = _nex_cvar_slider;
91 self.refresh = _nex_cvar_slider_refresh;
94 void(void) _nex_cvar_slider_refresh =
96 if(self.cvartype == CVAR_INT || self.cvartype == CVAR_FLOAT || self.cvartype == CVAR_STEP)
97 self.value = cvar(self.cvarname);
100 void(void) _nex_cvar_slider =
102 if(self.cvarname == "")
104 if(self.cvartype == CVAR_INT) // || self.cvartype == CVAR_STRING)
105 self.value = rint(self.value);
106 if(self.cvartype == CVAR_STEP)
107 self.value = rint(self.value / self.step) * self.step;
108 if(self.cvartype == CVAR_INT || self.cvartype == CVAR_FLOAT || self.cvartype == CVAR_STEP)
109 cvar_set(self.cvarname, ftos(self.value));
110 /*if(cvartype == CVAR_STRING)
113 s = getaltstring(self.value, self.cvarvalues);
114 cvar_set(self.cvarname, s);
123 void(void) nex_makeselfonlyvisible =
125 nex_makeonlyvisible( self );
130 void(void) nex_quit_choose =
133 // because of the missing support for real array, we have to do it the stupid way
134 // (we also have to use strzone for the text, cause it the temporary strings wont work
136 if(nex_quitrequest == 0)
138 e = menu_getitem("quit_msg_0");
139 e.text = getaltstring(0,nex_quitmsg_0);
141 if(nex_quitrequest == 1)
143 e = menu_getitem("quit_msg_0");
144 e.text = getaltstring(0,nex_quitmsg_1);
146 if(nex_quitrequest == 2)
148 e = menu_getitem("quit_msg_0");
149 e.text = getaltstring(0,nex_quitmsg_2);
151 if(nex_quitrequest == 3)
153 e = menu_getitem("quit_msg_0");
154 e.text = getaltstring(0,nex_quitmsg_3);
156 e.text = strzone(e.text);
158 if(nex_quitrequest == 0)
160 e = menu_getitem("quit_msg_1");
161 e.text = getaltstring(1,nex_quitmsg_0);
163 if(nex_quitrequest == 1)
165 e = menu_getitem("quit_msg_1");
166 e.text = getaltstring(1,nex_quitmsg_1);
168 if(nex_quitrequest == 2)
170 e = menu_getitem("quit_msg_1");
171 e.text = getaltstring(1,nex_quitmsg_2);
173 if(nex_quitrequest == 3)
175 e = menu_getitem("quit_msg_1");
176 e.text = getaltstring(1,nex_quitmsg_3);
178 e.text = strzone(e.text);
180 nex_quitrequest = nex_quitrequest + 1;
181 if(nex_quitrequest == DPMOD_QUIT_MSG_COUNT)
185 void(void) nex_quit =
188 // choose a quit message
192 ent = menu_getitem("main");
193 ent.flag = ent.flag | FLAG_CHILDDRAWONLY;
194 ent = menu_getitem("quit");
195 ent.flag = FLAG_NOSELECT;
196 menu_jumptowindow(ent, false);*/
200 ent = menu_getitem("quitbox_ref");
201 ent._child = menu_activewindow;
202 ent = menu_getitem("quitbox");
203 menu_jumptowindow(ent, true);
206 void(void) nex_quit_yes =
211 void(void) nex_quit_no =
215 ent = menu_getitem("quit_msg_0");
218 ent = menu_getitem("quit_msg_1");
221 ent = menu_getitem("quit");
222 ent.flag = FLAG_HIDDEN;
223 ent = menu_getitem("main");
224 ent.flag = ent.flag - FLAG_CHILDDRAWONLY;
229 float(float keynr, float ascii) nex_quit_key =
231 if(keynr == K_LEFTARROW)
233 if(keynr == K_RIGHTARROW)
237 if(keynr == K_MOUSE1)
239 if(ascii == 'Y' || ascii == 'y')
241 if(ascii == 'N' || ascii == 'n' || keynr == K_ESCAPE)
248 void(void) nex_display_options =
252 ent = menu_getitem( "options" );
254 nex_makeonlyvisible( ent );
255 menu_jumptowindow( ent, false );
261 void(void) nex_display_video =
263 nex_makeonlyvisible( menu_getitem( "video" ) );
264 menu_jumptowindow( menu_getitem( "video" ), false );
267 void(void) nex_video_bpp_reinit =
269 if(cvar("vid_bitsperpixel") == 32)
275 void(void) nex_video_fullscreen_reinit =
277 self.value = cvar("vid_fullscreen");
280 string nex_video_resolutions;
282 void(void) nex_video_resolution_switch_reinit =
287 c = getaltstringcount(nex_video_resolutions);
288 for(i = 0; i < c; i=i+1)
292 s = getaltstring(i,nex_video_resolutions);
293 s = strcat("'",s,"'");
295 if(t_x == cvar("vid_width") && t_y == cvar("vid_height"))
307 void(void) nex_video_resolution_switch =
310 var float counter = 0;
313 nex_video_resolutions = "";
317 while((t = getresolution(counter)) != '0 0 0')
321 if(t_x == cvar("vid_width") && t_y == cvar("vid_height"))
323 self.value = counter;
325 counter = counter + 1;
326 self.text = strcat(self.text,"'",ftos(t_x),"x");
327 self.text = strcat(self.text,ftos(t_y),"'");
328 nex_video_resolutions = strcat(nex_video_resolutions,vtos(t));
334 self.text = strzone(self.text);
335 nex_video_resolutions = strzone(nex_video_resolutions);
337 self.reinit = nex_video_resolution_switch;
340 void(void) nex_video_apply =
349 res_x = cvar("vid_width");
350 res_y = cvar("vid_height");
353 tmp = menu_getitem("video_resolution_switch");
354 set = stov(getaltstring(tmp.value, nex_video_resolutions));
357 cvar_set("vid_width",ftos(set_x));
358 cvar_set("vid_height",ftos(set_y));
362 tmp = menu_getitem("video_bpp_switch");
363 if((tmp.value+1)*16 != cvar("vid_bitsperpixel"))
365 cvar_set("vid_bitsperpixel",ftos((tmp.value+1)*16));
368 // fullscreen changed
369 tmp = menu_getitem("video_fullscreen_switch");
370 if(tmp.value != cvar("vid_fullscreen"))
372 cvar_set("vid_fullscreen",ftos(tmp.value));
378 cmd("vid_restart\n");
399 // picture = picture filename
401 void(entity node) _nex_xp_remove =
403 strunzone( node.picture );
404 strunzone( node.text );
405 strunzone( node.name );
409 void(void) _nex_xp_update =
413 item = menu_getitem( "creategame_map_name" );
414 item.text = maps_current.name;
416 item = menu_getitem( "creategame_map_picture" );
417 item.picture = maps_current.picture;
419 item = menu_getitem( "creategame_map_info" );
420 item.text = maps_current.text;
423 void(void) nex_xp_enummaps =
429 // remove the old list
434 while( node._next ) {
436 _nex_xp_remove( node._prev );
438 _nex_xp_remove( node );
440 maps_list = maps_current = null_entity;
442 searchhandle = search_begin( "maps/*.bsp", true, true );
443 if( searchhandle == -1 ) {
444 print( "menu: No maps found!\n" );
446 } else if( searchhandle == -2)
449 maps_list = maps_current = spawn();
450 count = search_getsize( searchhandle );
451 for( counter = 0 ; counter < count ; counter = counter + 1 ) {
455 fname = search_getfilename( searchhandle, counter );
456 fname = substring( fname, 0, strlen( fname ) - 4 );
457 fname = strzone( fname );
459 //try to find the information text
460 file = fopen( strcat( fname, ".txt" ), FILE_READ );
462 maps_current.text = strzone( "--NO INFORMATION AVAILABLE--" );
465 maps_current.text = strzone( "" );
467 old = maps_current.text;
468 temp = fgets( file );
469 maps_current.text = strzone( strcat( old, temp, "\n" ) );
471 } while( validstring( temp ) );
475 //try to find the picture
476 file = search_begin( strcat( fname, ".jpg" ), true, true );
478 maps_current.picture = strzone( "gfx/m_nomap" );
480 maps_current.picture = strzone( strcat( fname, ".jpg" ) );
484 maps_current.name = strzone( substring( fname, 5, strlen( fname ) - 5 ) ); // remove the 'maps/'
487 // create next item and link it with the list
488 maps_current._next = spawn();
489 maps_current._next._prev = maps_current;
490 maps_current = maps_current._next;
492 // remove the last item
493 maps_current = maps_current._prev;
494 remove( maps_current._next );
495 maps_current._next = null_entity;
497 search_end( searchhandle );
499 maps_current = maps_list;
503 void(void) nex_xp_prev =
505 if( maps_current._prev )
506 maps_current = maps_current._prev;
510 void(void) nex_xp_next =
512 if( maps_current._next )
513 maps_current = maps_current._next;
518 void(void) nex_display_creategame =
520 nex_makeonlyvisible( menu_getitem( "creategame" ) );
521 menu_jumptowindow( menu_getitem( "creategame" ), false );
524 void(void) nex_xp_maxfrags =
530 strunzone(self.text);
532 self.text = strzone(self.text);
535 void(void) nex_xp_maxbots =
539 maxbots = min( fabs(rint(x)), maxclients - 1, 16 ); // 16 is currently max in frikbot - see below
541 strunzone(self.text);
543 self.text = strzone(self.text);
546 void(void) nex_xp_maxtime =
552 strunzone(self.text);
553 self.text = ftos(maxtime);
554 self.text = strzone(self.text);
557 void(void) nex_xp_hostname =
559 hostname = self.text;
562 void(void) nex_xp_maxclients =
566 maxclients = rint(i);
568 strunzone(self.text);
569 self.text = strzone(ftos(maxclients));
572 void(void) nex_xp_publicserv =
574 publicserver = self.value;
577 void(void) nex_xp_gamemode =
579 gamemode = self.value;
582 void(void) nex_xp_skilllevel =
584 skilllevel = self.value;
587 void(void) nex_xp_start =
589 cvar_set( "fraglimit", ftos( maxfrags ) );
590 cvar_set( "timelimit", ftos( maxtime ) );
591 cvar_set( "deathmatch", "1" );
593 cmd( "maxplayers " );
594 cmd( ftos( maxclients ) );
597 cvar_set( "sv_public", ftos( publicserver ) );
598 cvar_set( "hostname", hostname );
600 // see bot/bot.qc: BotInit
601 cvar_set( "saved1", "1" );
602 cvar_set( "scratch1", ftos( pow( 2, maxbots ) - 1 ) );
603 cvar_set( "scratch2", ftos( skilllevel * (pow(4, min(maxbots, 8)) - 1) / 3) );
604 cvar_set( "scratch3", ftos( skilllevel * (pow(4, min(maxbots - 8, 8)) - 1) / 3) );
607 cmd( maps_current.name );
609 cmd( "togglemenu\n" );
612 void(void) nex_goto_createserver =
614 menu_jumptowindow( menu_getitem( "multiplayer_frame"), false );
617 void(void) nex_draw_text =
619 local vector drawpos;
620 local float cpos, end;
624 drawpos_y = drawpos_y + self.font_size_y;
629 end = strlen( self.text );
632 l = substring( self.text, i, 1 );
642 l = substring( self.text, cpos, end - cpos );
644 menu_drawstring( drawpos, l, self.font_size, self.color, self.alpha, self.drawflag );
645 drawpos_y = drawpos_y + self.font_size_y;
648 } while( end != strlen( self.text ) );
652 var float slist_selected = 0;
653 var float slist_start = 0;
654 float slist_estimatedsize;
656 void(void) nex_display_serverlist =
658 if(menu_activewindow.name == "serverlist")
660 menu_jumptowindow(menu_getitem("serverlist"),true);
664 // use a ITEM_TEXT as base item for this
665 // we need another item to clip the slist
666 // (another reason for a new menu qc!)
667 void(void) slist_draw =
673 //print("slist drawing...", ftos(listsize), "\n");
675 pos = '0 0 0'; // the upper item sets the origin
676 listsize = gethostcachevalue(SLIST_HOSTCACHECOUNT);
679 menu_drawstring(pos, "No Servers", self.font_size, self.color, self.alpha, self.drawflag);
683 for(c = 0; c < slist_estimatedsize + 1; c = c + 1)
687 if(listsize <= slist_start + c)
690 //print("drawing ", ftos(c),"\n");
692 if(slist_selected - slist_start == c)
696 s_y = self.font_size_y * 2;
698 menu_fillarea(pos, s, self.color_selected, self.alpha_selected * (sin(time * 9) + 1) / 2, self.drawflag_selected);
701 line = gethostcachestring(SLIST_LINE1, slist_start + c);
703 if( !line || line == "" )
704 line = strzone( "Empty" );
706 line = strzone( strcat( chr(127), line ) );
708 menu_drawstring(pos, line, self.font_size, self.color, self.alpha, self.drawflag);
710 pos_y = pos_y + self.font_size_y;
713 line = gethostcachestring(SLIST_LINE2, slist_start + c);
715 if( !line || line == "" )
716 line = strzone( "Empty" );
718 line = strzone( strcat( chr(127), line ) );
720 menu_drawstring(pos, line, self.font_size, self.color, self.alpha, self.drawflag);
721 pos_y = pos_y + self.font_size_y;
727 void(void) slist_init =
729 self.size = self._parent.size;
730 slist_estimatedsize = self.size_y / self.font_size_y / 2;
733 void(void) slist_refresh =
737 hostcachesize = gethostcachevalue(SLIST_HOSTCACHECOUNT);
738 if(slist_start >= hostcachesize)
739 slist_start = ceil(hostcachesize - slist_estimatedsize);
742 if(slist_selected >= hostcachesize)
743 slist_selected = hostcachesize;
746 void(void) slist_join =
749 cname = gethostcachestring(SLIST_CNAME, slist_selected);
755 cmd(" ;togglemenu\n");
759 float(float keynr, float ascii ) slist_key =
763 if(keynr == K_UPARROW)
765 if(slist_selected > 0)
766 slist_selected = slist_selected - 1;
767 if(slist_start > slist_selected)
768 slist_start = slist_selected;
770 } else if(keynr == K_DOWNARROW)
772 listsize = gethostcachevalue(SLIST_HOSTCACHECOUNT);
773 if(slist_selected < listsize - 1)
774 slist_selected = slist_selected + 1;
775 if(slist_start + slist_estimatedsize - 0.5 < slist_selected)
776 slist_start = ceil(slist_selected - slist_estimatedsize + 0.5);
778 } else if(keynr == K_ENTER)
782 } else if(keynr == K_SPACE)
786 } else if(keynr == K_MOUSE1)
790 listsize = gethostcachevalue(SLIST_HOSTCACHECOUNT);
791 pos = floor(menu_cursor_y / self.font_size_y / 2);
793 if(pos + slist_start == slist_selected)
795 else if(pos + slist_start < listsize)
796 slist_selected = pos;
802 void(void) slist_info1 =
807 query = gethostcachevalue(SLIST_MASTERQUERYCOUNT);
808 reply = gethostcachevalue(SLIST_MASTERREPLYCOUNT);
811 strunzone(self.text);
813 temp = strcat(ftos(reply), "/");
814 temp = strcat(temp, ftos(query), " Master Servers");
816 self.text = strzone(temp);
819 void(void) slist_info2 =
824 query = gethostcachevalue(SLIST_SERVERQUERYCOUNT);
825 reply = gethostcachevalue(SLIST_SERVERREPLYCOUNT);
828 strunzone(self.text);
830 temp = strcat(ftos(reply), "/");
831 temp = strcat(temp, ftos(query), " Game Servers");
833 self.text = strzone(temp);
841 var entity mlist_list = null_entity;
842 entity mlist_current;
847 string player_model_cvar = "_cl_playermodel";
848 string player_name_cvar = "_cl_name";
849 string player_skin_cvar = "_cl_playerskin";
850 string player_fov_cvar = "player_fov";
852 void() nex_player_init =
854 local entity lEntity;
856 mlist_saved = strzone( str_cvar( player_model_cvar ) );
858 lEntity = menu_getitem( "options_player_opt_playername_switch" );
859 lEntity.text = strzone( str_cvar( player_name_cvar ) );
863 void(void) nex_player_reinit =
867 strunzone( mlist_saved );
868 mlist_saved = strzone( str_cvar( player_model_cvar ) );
870 ent = menu_getitem( "options_player_opt_playername_switch" );
871 strunzone( ent.text );
872 ent.text = strzone( str_cvar( player_name_cvar ) );
875 void(void) nex_player_name =
877 player_name = self.text;
880 void(void) nex_player_apply =
882 cmd( strcat( "playermodel \"", mlist_current.picture_selected, "\"\n" ) );
883 cmd( strcat( "playerskin \"", mlist_current.picture_pressed, "\"\n" ) );
884 cmd( strcat( "name ", player_name, "\n" ) );
888 // picture_selected = model name
889 // picture_pressed = skin name
892 void(entity e) _nex_player_remove =
895 strunzone( e.picture_selected );
896 strunzone( e.picture_pressed );
897 strunzone( e.picture );
903 void() _nex_player_model_update =
910 item = menu_getitem( "options_player_model_name" );
911 item.text = mlist_current.name;
913 item = menu_getitem( "options_player_model_picture" );
914 item.picture = mlist_current.picture;
916 item = menu_getitem( "options_player_model_info" );
917 item.text = mlist_current.text;
927 void(void) nex_player_buildlist =
935 // remove the old player list
939 // save the old selected model
940 mlist_saved = strzone( mlist_current.name );
943 while( node._next ) {
945 _nex_player_remove( node._prev );
947 _nex_player_remove( node );
949 mlist_list = mlist_current = null_entity;
952 shandle = search_begin( "models/player/*.txt", false, true );
956 count = search_getsize( shandle );
957 mlist_list = mlist_current = spawn();
960 for ( counter = 0 ; counter < count ; counter = counter + 1 ) {
962 local string dpicture;
969 handle = fopen( search_getfilename( handle, counter ), FILE_READ );
974 dname = strzone( fgets( handle ) );
975 dpicture = strzone( fgets( handle ) );
976 dskin = strzone( fgets( handle ) );
977 dmodel = strzone( fgets( handle ) );
979 local string ltemp, lold;
980 dtext = strzone( "" );
983 ltemp = fgets( handle );
984 dtext = strzone( strcat( lold, ltemp, "\n" ) );
986 } while( validstring( ltemp ) );
989 if( !dname || !dpicture || !dskin || !dmodel || !dtext ) {
990 print( "Bad model definition file '", search_getfilename( shandle, counter ), "'\n" );
993 strunzone( dpicture );
996 //strunzone( dtext );
1002 // is this the previous selected model?
1003 if( dname == mlist_saved )
1004 hit = mlist_current;
1006 mlist_current.name = dname;
1007 mlist_current.picture = dpicture;
1008 mlist_current.picture_pressed = dskin;
1009 mlist_current.picture_selected = dmodel;
1010 mlist_current.text = dtext;
1012 loaded = loaded + 1;
1014 mlist_current._next = spawn();
1015 mlist_current._next._prev = mlist_current;
1016 mlist_current = mlist_current._next;
1020 mlist_current._prev._next = null_entity;
1021 remove( mlist_current );
1023 search_end( shandle );
1026 print( "No model description files found in models/player\n" );
1027 mlist_list = mlist_current = null_entity;
1029 print( ftos( loaded ), " model description files loaded from models/player\n" );
1032 mlist_current = hit;
1034 mlist_current = mlist_list;
1036 _nex_player_model_update();
1039 void(void) nex_player_model_next =
1041 if( mlist_current._next )
1042 mlist_current = mlist_current._next;
1043 _nex_player_model_update();
1046 void(void) nex_player_model_prev =
1048 if( mlist_current._prev )
1049 mlist_current = mlist_current._prev;
1050 _nex_player_model_update();
1053 void(void) nex_player =
1056 ent = menu_getitem("options_player");
1057 nex_makeonlyvisible( ent );
1058 menu_jumptowindow(ent, false);
1061 // old/other options
1063 void(void) nex_options_alwaysrun_switchchange =
1067 cvar_set("cl_forwardspeed","400");
1068 cvar_set("cl_backspeed","400");
1072 cvar_set("cl_forwardspeed","200");
1073 cvar_set("cl_backspeed","200");
1077 void(void) nex_options_alwaysrun_refresh =
1079 if(cvar("cl_forwardspeed") > 200)
1085 void(void) nex_options_invmouse_switchchange =
1088 old = 0 - cvar("m_pitch");
1089 cvar_set("m_pitch",ftos(old));
1092 void(void) nex_options_invmouse_refresh =
1094 if(cvar("m_pitch") > 0)
1100 void(void) nex_snd =
1103 ent = menu_getitem("options_sound");
1104 nex_makeonlyvisible( ent );
1105 menu_jumptowindow(ent, false);
1108 void(void) nex_snd_cd_init =
1110 if(cvar("cdaudioinitialized"))
1112 self.flag = FLAG_AUTOSETCLICK;
1113 self.color = ITEM_TEXT_NORMAL_COLOR;
1117 self.flag = FLAG_NOSELECT | FLAG_DRAWONLY | FLAG_CHILDDRAWONLY;
1118 self.color = '0.5 0.5 0.5';
1122 void(void) nex_snd_snd_init =
1124 if(cvar("snd_initialized"))
1126 self.flag = FLAG_AUTOSETCLICK;
1127 self.color = ITEM_TEXT_NORMAL_COLOR;
1131 self.flag = FLAG_NOSELECT | FLAG_DRAWONLY | FLAG_CHILDDRAWONLY;
1132 self.color = '0.5 0.5 0.5';
1139 ent = menu_getitem("options_cc");
1140 nex_makeonlyvisible( ent );
1141 menu_jumptowindow(ent, false);
1144 void(void) nex_cc_reset =
1152 "v_color_black_r 0;"
1153 "v_color_black_g 0;"
1154 "v_color_black_b 0;"
1158 "v_color_white_r 1;"
1159 "v_color_white_g 1;"
1160 "v_color_white_b 1;"
1164 void(void) nex_cc_check_hwgamma =
1166 if(cvar("vid_hardwaregammasupported"))
1168 self.flag = FLAG_AUTOSETCLICK;
1169 self.color = ITEM_TEXT_NORMAL_COLOR;
1173 self.flag = FLAG_NOSELECT;
1174 self.color = '0.5 0.5 0.5';
1178 void(void) nex_cc_check_gamma = // used in key -- BADBAD HACKHACK
1180 if(cvar("v_hwgamma") && cvar("vid_hardwaregammasupported") && !cvar("v_color_enable"))
1182 self.flag = FLAG_AUTOSETCLICK;
1183 self.color = ITEM_TEXT_NORMAL_COLOR;
1187 self.flag = FLAG_NOSELECT;
1188 self.color = '0.5 0.5 0.5';
1192 void(void) nex_cc_check_grey = // used in key -- BADBAD HACKHACK
1194 if(cvar("v_hwgamma") && cvar("vid_hardwaregammasupported") && cvar("v_color_enable"))
1196 self.flag = FLAG_AUTOSETCLICK;
1197 self.color = ITEM_TEXT_NORMAL_COLOR;
1201 self.flag = FLAG_NOSELECT;
1202 self.color = '0.5 0.5 0.5';
1206 void(void) nex_cc_check_ncolor_enable =
1208 if(!cvar("v_color_enable"))
1210 self.flag = FLAG_AUTOSETCLICK;
1211 self.color = ITEM_TEXT_NORMAL_COLOR;
1215 self.flag = FLAG_NOSELECT;
1216 self.color = '0.5 0.5 0.5';
1220 void(void) nex_cc_check_color_enable =
1222 if(cvar("v_color_enable"))
1224 self.flag = FLAG_AUTOSETCLICK;
1225 self.color = ITEM_TEXT_NORMAL_COLOR;
1229 self.flag = FLAG_NOSELECT;
1230 self.color = '0.5 0.5 0.5';
1234 void(void) nex_cc_color_enable =
1236 cvar_set("v_color_enable","1");
1239 void(void) nex_cc_ncolor_enable =
1241 cvar_set("v_color_enable","0");
1244 void(void) nex_cc_grey_refresh =
1246 self.value = cvar(strcat(self.cvarname,"_r"));
1247 self.value = self.value + cvar(strcat(self.cvarname,"_g"));
1248 self.value = self.value + cvar(strcat(self.cvarname,"_b"));
1249 self.value = self.value / 3;
1253 void(void) nex_cc_grey_move =
1256 tmp = ftos(self.value);
1257 cvar_set(strcat(self.cvarname,"_r"), tmp);
1258 cvar_set(strcat(self.cvarname,"_g"), tmp);
1259 cvar_set(strcat(self.cvarname,"_b"), tmp);
1262 void(void) nex_cc_grey =
1264 self.refresh = nex_cc_grey_refresh;
1265 self.slidermove = nex_cc_grey_move;
1268 // key control stuff
1269 void(void) nex_cntrl =
1272 ent = menu_getitem("options_control");
1273 nex_makeonlyvisible( ent );
1274 menu_jumptowindow(ent, false);
1277 const float NUMKEYS = 2; // visible key count (first and secondary key)
1280 void(float keynr, float ascii) nex_con_keyhook =
1284 //dprint("nex_con_keyhook called !\n");
1286 if(keynr != K_ESCAPE)
1289 tmp = bind_getkeylist(bindcommand);
1290 // remove the binds if we need more space
1291 bind_limitbinds(NUMKEYS - 1, bindcommand);
1293 bind_bindkey(bind_getstringforkey(keynr), bindcommand);
1296 ent = menu_getitem("options_control_statemsg1");
1299 ent = menu_getitem("options_control_statemsg2");
1302 menu_keyhook = null_function;
1305 void(void) nex_con_action_key =
1309 bindcommand = self.link;
1311 //dprint("action called");
1313 menu_keyhook = nex_con_keyhook;
1315 ent = menu_getitem("options_control_statemsg1");
1318 ent = menu_getitem("options_control_statemsg2");
1322 float(float keynr, float ascii) nex_con_key =
1326 // the user wants to unbind this action
1327 //dprint("Removing binds for '", self.link,"'\n");
1328 bind_limitbinds(0, self.link);
1335 void(void) nex_con_update_keys =
1344 keystr = strzone(bind_getkeylist(self.link));
1348 for(ent = self._child; ent != null_entity; ent = ent._next)
1352 keynr = stof(getaltstring(num, keystr));
1354 strunzone(ent.text);
1357 ent.text = strzone("-");
1359 ent.text = strzone(bind_getstringforkey(keynr));
1367 var float numkey = 0;
1368 void(void) CONTROL_KEY =
1370 entity key1, key2, desc;
1371 entity temp_desc, temp_key;
1373 temp_desc = menu_getitem("control_desc_template");
1374 temp_key = menu_getitem("control_key_template");
1377 copyentity(temp_desc, desc);
1380 copyentity(temp_key, key1);
1383 copyentity(temp_key, key2);
1385 desc.name = self.text;
1386 key1.name = strzone(strcat(self.text, " key1"));
1387 key2.name = strzone(strcat(self.text, " key2"));
1389 desc.pos_y = key1.pos_y = key2.pos_y = temp_desc.pos_y * numkey;
1390 key2.pos_x = 2 * key2.pos_x;
1392 desc.text = self.text;
1393 desc.link = self.link;
1395 key1.text = strzone("-");
1396 key2.text = strzone("-");
1401 desc.parent = "options_control";
1402 desc._parent = menu_getitem("options_control");
1404 key1.parent = key2.parent = desc.name;
1405 key1._parent = key2._parent = desc;
1411 numkey = numkey + 1;
1414 ////////////////////////////////////////////////////
1417 void(void) initbrightness =
1419 self.value = cvar("scr_conbrightness");
1422 void(void) setbrightness =
1424 cvar_set("scr_conbrightness",ftos(self.value));
1427 void(void) nex_main_exit =
1430 e = menu_getitem("MAIN_MENU");
1431 e.flag = FLAG_NOSELECT + FLAG_CHILDDRAWONLY;
1432 e = menu_getitem("MAIN_EXIT_MENU");
1433 e.flag = FLAG_NOSELECT;
1434 menu_jumptowindow(e, false);
1437 void(void) nex_main_exit_no =
1440 e = menu_getitem("MAIN_EXIT_MENU");
1441 e.flag = FLAG_NOSELECT + FLAG_HIDDEN;
1442 e = menu_getitem("MAIN_MENU");
1443 e.flag = FLAG_NOSELECT;
1447 void(void) nex_main_exit_yes =
1452 float(float keynr, float ascii) nex_main_exit_key =
1454 if(keynr == K_ESCAPE)
1462 void(void) dorestart =
1464 cmd("menu_restart\n");
1467 void(void) nex_text_cur_x =
1469 self.text = ftos(rint(cursor_x));
1472 void(void) nex_text_cur_y =
1474 self.text = ftos(rint(cursor_y));