mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-22 20:41:20 +00:00
finalize the move of the menu code
This commit is contained in:
parent
c1c6c05cf5
commit
300f638647
39 changed files with 2 additions and 2583 deletions
|
@ -1,7 +1,7 @@
|
|||
## Process this file with automake to produce Makefile.in
|
||||
AUTOMAKE_OPTIONS= foreign
|
||||
|
||||
SUBDIRS= RPM debian doc include libs qw nq tools cs-code ruamoko
|
||||
SUBDIRS= RPM debian doc include libs qw nq tools ruamoko
|
||||
|
||||
## configure.ac needs to be listed here for older autoconfs
|
||||
EXTRA_DIST= ChangeLog configure.ac \
|
||||
|
|
|
@ -1996,8 +1996,6 @@ AC_OUTPUT(
|
|||
tools/qwaq/progs.src
|
||||
tools/wav/Makefile
|
||||
|
||||
cs-code/Makefile
|
||||
|
||||
ruamoko/Makefile
|
||||
ruamoko/include/Makefile
|
||||
ruamoko/lib/Makefile
|
||||
|
|
8
cs-code/.gitignore
vendored
8
cs-code/.gitignore
vendored
|
@ -1,8 +0,0 @@
|
|||
*.dat
|
||||
*.gz
|
||||
*.qfo
|
||||
*.src
|
||||
*.sym
|
||||
.vimrc
|
||||
Makefile.in
|
||||
Makefile
|
|
@ -1,42 +0,0 @@
|
|||
## Process this file with automake to produce Makefile.in
|
||||
AUTOMAKE_OPTIONS= foreign
|
||||
|
||||
#FIXME should qf data be installed somewhere other than id1 that gets
|
||||
#searched after everything else?
|
||||
pkgdatadir=@sharepath@/id1
|
||||
|
||||
QFCC_DEP=$(top_builddir)/tools/qfcc/source/qfcc$(EXEEXT)
|
||||
QFCC=$(QFCC_DEP)
|
||||
QCFLAGS=-qq -g -Werror
|
||||
QCPPFLAGS=-I. -I$(srcdir) -I$(top_builddir)/include -I$(top_srcdir)/include
|
||||
GZIP=if echo $@ | grep -q .gz; then gzip -f `basename $@ .gz`; if test -f `basename $@ .dat.gz`.sym; then gzip -f `basename $@ .dat.gz`.sym; fi; fi
|
||||
if HAVE_ZLIB
|
||||
GZ=.gz
|
||||
else
|
||||
GZ=
|
||||
endif
|
||||
STRIP=$(shell echo `echo -n $(srcdir)/ | sed -e 's/[^/]//g' | wc -c`)
|
||||
|
||||
pkgdata_DATA= menu.dat$(GZ)
|
||||
|
||||
menu_src= \
|
||||
cbuf.r client_menu.qc cmd.r controls_o.qc cvar.r draw.r file.r \
|
||||
game.r inputline.r inputline_util.qc key.r menu.r options.qc \
|
||||
options_util.qc servlist.qc string.r stringh.r
|
||||
|
||||
%.qfo: %.r
|
||||
$(QFCC) $(QCFLAGS) $(QCPPFLAGS) -p $(STRIP) -c -o $@ $<
|
||||
|
||||
%.qfo: %.qc
|
||||
$(QFCC) $(QCFLAGS) $(QCPPFLAGS) -p $(STRIP) -c -o $@ $<
|
||||
|
||||
menu_obj=$(addsuffix .qfo,$(basename $(menu_src)))
|
||||
|
||||
menu.dat$(GZ): $(menu_obj) $(QFCC_DEP)
|
||||
$(QFCC) $(QCFLAGS) -p $(STRIP) -o menu.dat $(menu_obj)
|
||||
$(GZIP)
|
||||
|
||||
EXTRA_DIST= $(menu_src) cbuf.h client_menu.h cmd.h controls_o.h cvar.h \
|
||||
draw.h file.h game.h inputline.h key.h menu.h options.h \
|
||||
options_util.h servlist.h string.h stringh.h
|
||||
CLEANFILES= *.dat *.sym *.gz *.qfo
|
|
@ -1,9 +0,0 @@
|
|||
#ifndef __cbuf_h
|
||||
#define __cbuf_h
|
||||
|
||||
@extern void (string text) Cbuf_AddText;
|
||||
@extern void (string text) Cbuf_InsertText;
|
||||
@extern void () Cbuf_Execute;
|
||||
@extern void () Cbuf_Execute_Sets;
|
||||
|
||||
#endif//__cbuf_h
|
|
@ -1,6 +0,0 @@
|
|||
#include "cbuf.h"
|
||||
|
||||
void (string text) Cbuf_AddText = #0;
|
||||
void (string text) Cbuf_InsertText = #0;
|
||||
void () Cbuf_Execute = #0;
|
||||
void () Cbuf_Execute_Sets = #0;
|
|
@ -1,8 +0,0 @@
|
|||
#ifndef __client_menu_h
|
||||
#define __client_menu_h
|
||||
|
||||
#include "inputline.h"
|
||||
|
||||
@extern inputline_t input_active;
|
||||
|
||||
#endif
|
|
@ -1,491 +0,0 @@
|
|||
#include "menu.h"
|
||||
#include "file.h"
|
||||
#include "cmd.h"
|
||||
#include "draw.h"
|
||||
#include "key.h"
|
||||
#include "inputline.h"
|
||||
#include "string.h"
|
||||
#include "cbuf.h"
|
||||
#include "options.h"
|
||||
#include "servlist.h"
|
||||
#include "game.h"
|
||||
#include "client_menu.h"
|
||||
|
||||
string [6] dot_name = {
|
||||
"gfx/menudot1.lmp",
|
||||
"gfx/menudot2.lmp",
|
||||
"gfx/menudot3.lmp",
|
||||
"gfx/menudot4.lmp",
|
||||
"gfx/menudot5.lmp",
|
||||
"gfx/menudot6.lmp",
|
||||
};
|
||||
|
||||
void (integer x, integer y) spinner =
|
||||
{
|
||||
local integer i = integer(time * 10) % 6;
|
||||
local qpic_t p = Draw_CachePic (dot_name[i], 1);
|
||||
|
||||
Draw_Pic (x, y, p);
|
||||
};
|
||||
|
||||
integer do_single_player;
|
||||
|
||||
string [32] quitMessage = {
|
||||
/* .........1.........2.... */
|
||||
" Are you gonna quit ",
|
||||
" this game just like ",
|
||||
" everything else? ",
|
||||
" ",
|
||||
|
||||
" Milord, methinks that ",
|
||||
" thou art a lowly ",
|
||||
" quitter. Is this true? ",
|
||||
" ",
|
||||
|
||||
" Do I need to bust your ",
|
||||
" face open for trying ",
|
||||
" to quit? ",
|
||||
" ",
|
||||
|
||||
" Man, I oughta smack you",
|
||||
" for trying to quit! ",
|
||||
" Press Y to get ",
|
||||
" smacked out. ",
|
||||
|
||||
" Press Y to quit like a ",
|
||||
" big loser in life. ",
|
||||
" Press N to stay proud ",
|
||||
" and successful! ",
|
||||
|
||||
" If you press Y to ",
|
||||
" quit, I will summon ",
|
||||
" Satan all over your ",
|
||||
" hard drive! ",
|
||||
|
||||
" Um, Asmodeus dislikes ",
|
||||
" his children trying to ",
|
||||
" quit. Press Y to return",
|
||||
" to your Tinkertoys. ",
|
||||
|
||||
" If you quit now, I'll ",
|
||||
" throw a blanket-party ",
|
||||
" for you next time! ",
|
||||
" "
|
||||
};
|
||||
integer quit_index;
|
||||
|
||||
// ********* LOAD / SAVE
|
||||
|
||||
#define MAX_SAVEGAMES 12
|
||||
string [MAX_SAVEGAMES] filenames;
|
||||
integer [MAX_SAVEGAMES] loadable;
|
||||
integer load_cursor;
|
||||
integer save_cursor;
|
||||
|
||||
void () scan_saves =
|
||||
{
|
||||
local integer i;
|
||||
local file_t f;
|
||||
for (i = 0; i < MAX_SAVEGAMES; i++) {
|
||||
loadable[i] = 0;
|
||||
filenames[i] = "--- UNUSED SLOT ---";
|
||||
f = File_Open (sprintf ("s%i.sav", i), "rz");
|
||||
if (!f)
|
||||
continue;
|
||||
File_GetLine (f);
|
||||
filenames[i] = String_ReplaceChar ('_', ' ', File_GetLine (f));
|
||||
loadable[i] = 1;
|
||||
File_Close (f);
|
||||
}
|
||||
};
|
||||
|
||||
integer (string text, integer key) load_f =
|
||||
{
|
||||
scan_saves ();
|
||||
Menu_SelectMenu ("load");
|
||||
return 0;
|
||||
};
|
||||
|
||||
integer (string text, integer key) save_f =
|
||||
{
|
||||
scan_saves ();
|
||||
Menu_SelectMenu ("save");
|
||||
return 0;
|
||||
};
|
||||
|
||||
void () load_save_f =
|
||||
{
|
||||
scan_saves ();
|
||||
if (Cmd_Argv (0) == "menu_load")
|
||||
Menu_SelectMenu ("load");
|
||||
else
|
||||
Menu_SelectMenu ("save");
|
||||
};
|
||||
|
||||
integer () load_draw =
|
||||
{
|
||||
local integer i;
|
||||
|
||||
Draw_CenterPic (160, 4, Draw_CachePic ("gfx/p_load.lmp", 1));
|
||||
for (i=0 ; i< MAX_SAVEGAMES; i++)
|
||||
Draw_String (16, 32 + 8 * i, filenames[i]);
|
||||
Draw_Character (8, 32 + load_cursor * 8, 12 + (integer (time * 4) & 1));
|
||||
return 1;
|
||||
};
|
||||
|
||||
integer () save_draw =
|
||||
{
|
||||
local integer i;
|
||||
|
||||
Draw_CenterPic (160, 4, Draw_CachePic ("gfx/p_save.lmp", 1));
|
||||
for (i=0 ; i< MAX_SAVEGAMES; i++)
|
||||
Draw_String (16, 32 + 8 * i, filenames[i]);
|
||||
Draw_Character (8, 32 + save_cursor * 8, 12 + (integer (time * 4) & 1));
|
||||
return 1;
|
||||
};
|
||||
|
||||
integer (integer key, integer unicode, integer down) load_keyevent =
|
||||
{
|
||||
switch (key) {
|
||||
case QFK_DOWN:
|
||||
case QFM_WHEEL_DOWN:
|
||||
load_cursor++;
|
||||
load_cursor %= MAX_SAVEGAMES;
|
||||
return 1;
|
||||
case QFK_UP:
|
||||
case QFM_WHEEL_UP:
|
||||
load_cursor += MAX_SAVEGAMES - 1;
|
||||
load_cursor %= MAX_SAVEGAMES;
|
||||
return 1;
|
||||
case QFK_RETURN:
|
||||
case QFM_BUTTON1:
|
||||
if (loadable[load_cursor]) {
|
||||
Menu_SelectMenu (NIL);
|
||||
Cbuf_AddText (sprintf ("load s%i.sav\n", load_cursor));
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
};
|
||||
|
||||
integer (integer key, integer unicode, integer down) save_keyevent =
|
||||
{
|
||||
switch (key) {
|
||||
case QFK_DOWN:
|
||||
case QFM_WHEEL_DOWN:
|
||||
save_cursor++;
|
||||
save_cursor %= MAX_SAVEGAMES;
|
||||
return 1;
|
||||
case QFK_UP:
|
||||
case QFM_WHEEL_UP:
|
||||
save_cursor += MAX_SAVEGAMES - 1;
|
||||
save_cursor %= MAX_SAVEGAMES;
|
||||
return 1;
|
||||
case QFK_RETURN:
|
||||
case QFM_BUTTON1:
|
||||
Menu_SelectMenu (NIL);
|
||||
Cbuf_AddText (sprintf ("save s%i.sav\n", save_cursor));
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
};
|
||||
|
||||
void () load_menu =
|
||||
{
|
||||
Menu_Begin (0, 0, "load");
|
||||
Menu_FadeScreen (1);
|
||||
Menu_KeyEvent (load_keyevent);
|
||||
Menu_Draw (load_draw);
|
||||
Menu_End ();
|
||||
Cmd_AddCommand ("menu_load", load_save_f);
|
||||
};
|
||||
|
||||
void () save_menu =
|
||||
{
|
||||
Menu_Begin (0, 0, "save");
|
||||
Menu_FadeScreen (1);
|
||||
Menu_KeyEvent (save_keyevent);
|
||||
Menu_Draw (save_draw);
|
||||
Menu_End ();
|
||||
Cmd_AddCommand ("menu_save", load_save_f);
|
||||
};
|
||||
|
||||
// ********* QUIT
|
||||
|
||||
integer () quit =
|
||||
{
|
||||
Menu_SelectMenu ("quit");
|
||||
quit_index = integer (random () * 8);
|
||||
quit_index &= 7;
|
||||
return 0;
|
||||
};
|
||||
|
||||
integer (string text, integer key) quit_f =
|
||||
{
|
||||
quit ();
|
||||
return 0;
|
||||
};
|
||||
|
||||
integer (integer key, integer unicode, integer down) quit_keyevent =
|
||||
{
|
||||
if (key == 'y') {
|
||||
Menu_Quit ();
|
||||
return 1;
|
||||
}
|
||||
if (key == 'n') {
|
||||
Menu_SelectMenu (NIL);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
};
|
||||
|
||||
integer () quit_draw =
|
||||
{
|
||||
text_box (56, 76, 24, 4);
|
||||
Draw_String (64, 84, quitMessage[quit_index *4 + 0]);
|
||||
Draw_String (64, 92, quitMessage[quit_index *4 + 1]);
|
||||
Draw_String (64, 100, quitMessage[quit_index *4 + 2]);
|
||||
Draw_String (64, 108, quitMessage[quit_index *4 + 3]);
|
||||
return 1;
|
||||
};
|
||||
|
||||
void () quit_menu =
|
||||
{
|
||||
Menu_Begin (0, 0, "quit");
|
||||
Menu_FadeScreen (1);
|
||||
Menu_KeyEvent (quit_keyevent);
|
||||
Menu_Draw (quit_draw);
|
||||
Menu_End ();
|
||||
};
|
||||
|
||||
integer (string text, integer key) sp_start =
|
||||
{
|
||||
Menu_SelectMenu (NIL);
|
||||
Cbuf_AddText ("disconnect\n");
|
||||
Cbuf_AddText ("maxplayers 1\n");
|
||||
Cbuf_AddText ("coop 0\n");
|
||||
Cbuf_AddText ("deathmatch 0\n");
|
||||
Cbuf_AddText ("teamplay 0\n");
|
||||
Cbuf_AddText ("listen 0\n");
|
||||
Cbuf_AddText ("noexit 0\n");
|
||||
Cbuf_AddText ("samelevel 0\n");
|
||||
Cbuf_AddText ("map start\n");
|
||||
return 0;
|
||||
};
|
||||
|
||||
void () single_player_menu =
|
||||
{
|
||||
Menu_Begin (54, 32, "");
|
||||
Menu_FadeScreen (1);
|
||||
Menu_Pic (16, 4, "gfx/qplaque.lmp");
|
||||
Menu_CenterPic (160, 4, "gfx/ttl_sgl.lmp");
|
||||
Menu_Pic (72, 32, "gfx/sp_menu.lmp");
|
||||
Menu_Cursor (spinner);
|
||||
Menu_Item (54, 32, "", sp_start, 0);
|
||||
Menu_Item (54, 52, "", load_f, 0);
|
||||
Menu_Item (54, 72, "", save_f, 0);
|
||||
Menu_End ();
|
||||
};
|
||||
|
||||
// ********* MULTIPLAYER
|
||||
|
||||
integer JoiningGame;
|
||||
integer lanConfig_cursor;
|
||||
string my_tcpip_address;
|
||||
string lanConfig_portname;
|
||||
string lanConfig_joinname;
|
||||
#define NUM_LANCONFIG_CMDS 3
|
||||
integer [NUM_LANCONFIG_CMDS] lanConfig_cursor_table = { 72, 92, 124 };
|
||||
inputline_t lanConfig_port_il;
|
||||
inputline_t lanConfig_join_il;
|
||||
inputline_t input_active;
|
||||
|
||||
integer () join_draw =
|
||||
{
|
||||
local integer f = (320 - 26 * 8) / 2;
|
||||
text_box (f, 134, 24, 4);
|
||||
Draw_String (f, 142, " Commonly used to play ");
|
||||
Draw_String (f, 150, " over the Internet, but ");
|
||||
Draw_String (f, 158, " also used on a Local ");
|
||||
Draw_String (f, 166, " Area Network. ");
|
||||
return 0;
|
||||
};
|
||||
|
||||
integer () lanconfig_draw =
|
||||
{
|
||||
local integer basex = 54;
|
||||
local string startJoin = JoiningGame ? "Join Game" : "New Game";
|
||||
local string protocol = "UDP";
|
||||
|
||||
Draw_String (basex, 32, sprintf ("%s - %s", startJoin, protocol));
|
||||
basex += 8;
|
||||
Draw_String (basex, 52, "Address:");
|
||||
Draw_String (basex + 9 * 8, 52, "127.0.0.1");
|
||||
Draw_String (basex, lanConfig_cursor_table[0], "Port");
|
||||
text_box (basex + 8 * 8, lanConfig_cursor_table[0] - 8, 6, 1);
|
||||
InputLine_Draw (lanConfig_port_il, basex + 8 * 8, lanConfig_cursor_table[0], lanConfig_cursor == 0 && input_active);
|
||||
Draw_String (basex + 9 * 8, lanConfig_cursor_table[0], lanConfig_portname);
|
||||
|
||||
if (JoiningGame) {
|
||||
Draw_String (basex, lanConfig_cursor_table[1], "Search for local games...");
|
||||
Draw_String (basex, 108, "Join game at:");
|
||||
text_box (basex + 8, lanConfig_cursor_table[2] - 8, 22, 1);
|
||||
InputLine_Draw (lanConfig_join_il, basex + 8, lanConfig_cursor_table[2], lanConfig_cursor == 2 && input_active);
|
||||
Draw_String (basex + 16, lanConfig_cursor_table[2], lanConfig_joinname);
|
||||
} else {
|
||||
text_box (basex, lanConfig_cursor_table[1] - 8, 2, 1);
|
||||
Draw_String (basex + 8, lanConfig_cursor_table[1], "OK");
|
||||
}
|
||||
if (!input_active)
|
||||
Draw_Character (basex - 8, lanConfig_cursor_table[lanConfig_cursor],
|
||||
12 + (integer (time * 4) & 1));
|
||||
|
||||
return 0;
|
||||
};
|
||||
|
||||
integer (integer key, integer unicode, integer down) lanconfig_keyevent =
|
||||
{
|
||||
if (input_active)
|
||||
InputLine_Process (input_active, key >= 256 ? key : unicode);
|
||||
switch (key) {
|
||||
case QFK_DOWN:
|
||||
case QFM_WHEEL_DOWN:
|
||||
if (!input_active) {
|
||||
lanConfig_cursor ++;
|
||||
lanConfig_cursor %= NUM_LANCONFIG_CMDS;
|
||||
}
|
||||
break;
|
||||
case QFK_UP:
|
||||
case QFM_WHEEL_UP:
|
||||
if (!input_active) {
|
||||
lanConfig_cursor += NUM_LANCONFIG_CMDS - 1;
|
||||
lanConfig_cursor %= NUM_LANCONFIG_CMDS;
|
||||
}
|
||||
break;
|
||||
case QFK_RETURN:
|
||||
if (input_active) {
|
||||
input_active = NIL;
|
||||
} else {
|
||||
if (lanConfig_cursor == 0) {
|
||||
input_active = lanConfig_port_il;
|
||||
} else if (JoiningGame) {
|
||||
if (lanConfig_cursor == 2) {
|
||||
input_active = lanConfig_join_il;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
};
|
||||
|
||||
void () lanconfig_menu =
|
||||
{
|
||||
Menu_Begin (54, 92, "");
|
||||
Menu_FadeScreen (1);
|
||||
Menu_Pic (16, 4, "gfx/qplaque.lmp");
|
||||
Menu_CenterPic (160, 4, "gfx/p_multi.lmp");
|
||||
Menu_Draw (lanconfig_draw);
|
||||
Menu_KeyEvent (lanconfig_keyevent);
|
||||
Menu_End ();
|
||||
};
|
||||
|
||||
void () join_menu =
|
||||
{
|
||||
Menu_Begin (54, 32, "");
|
||||
Menu_FadeScreen (1);
|
||||
Menu_Pic (16, 4, "gfx/qplaque.lmp");
|
||||
Menu_CenterPic (160, 4, "gfx/p_multi.lmp");
|
||||
Menu_Pic (72, 32, "gfx/dim_modm.lmp");
|
||||
Menu_Pic (72, 51, "gfx/dim_drct.lmp");
|
||||
Menu_Pic (72, 70, "gfx/dim_ipx.lmp");
|
||||
Menu_Pic (72, 89, "gfx/netmen4.lmp");
|
||||
lanconfig_menu ();
|
||||
Menu_Draw (join_draw);
|
||||
Menu_Cursor (spinner);
|
||||
Menu_End ();
|
||||
};
|
||||
|
||||
integer (integer key, integer unicode, integer down) multi_player_keyevent =
|
||||
{
|
||||
if (key == QFK_RETURN) {
|
||||
JoiningGame = (Menu_GetIndex () == 0);
|
||||
}
|
||||
return 0;
|
||||
};
|
||||
|
||||
void () multi_player_menu =
|
||||
{
|
||||
Menu_Begin (54, 52, "");
|
||||
Menu_FadeScreen (1);
|
||||
Menu_Pic (16, 4, "gfx/qplaque.lmp");
|
||||
Menu_CenterPic (160, 4, "gfx/p_multi.lmp");
|
||||
Menu_Pic (72, 32, "gfx/mp_menu.lmp");
|
||||
Menu_KeyEvent (multi_player_keyevent);
|
||||
join_menu ();
|
||||
if (do_single_player)
|
||||
Menu_Item (54, 52, "", quit_f, 0);
|
||||
Menu_Item (54, 72, "", quit_f, 0);
|
||||
Menu_Cursor (spinner);
|
||||
Menu_End ();
|
||||
};
|
||||
|
||||
|
||||
|
||||
void () help_menu =
|
||||
{
|
||||
Menu_Item (54, 92, "", quit_f, 0);
|
||||
};
|
||||
|
||||
void () main_menu =
|
||||
{
|
||||
Menu_Begin (0, 0, "main");
|
||||
Menu_FadeScreen (1);
|
||||
Menu_Pic (16, 4, "gfx/qplaque.lmp");
|
||||
Menu_CenterPic (160, 4, "gfx/ttl_main.lmp");
|
||||
if (do_single_player)
|
||||
Menu_Pic (71,32, "gfx/mainmenu.lmp");
|
||||
else
|
||||
Menu_SubPic (71,52, "gfx/mainmenu.lmp", 0, 20, 240, 92);
|
||||
Menu_Cursor (spinner);
|
||||
if (do_single_player)
|
||||
single_player_menu ();
|
||||
switch (gametype ()) {
|
||||
case "netquake":
|
||||
multi_player_menu ();
|
||||
break;
|
||||
case "quakeworld":
|
||||
server_list_menu ();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
MENU_options ();
|
||||
help_menu ();
|
||||
Menu_Item (54, 112, "", quit_f, 0);
|
||||
Menu_End ();
|
||||
};
|
||||
|
||||
void () menu_init =
|
||||
{
|
||||
lanConfig_port_il = InputLine_Create (4, 8, ' ');
|
||||
InputLine_SetWidth (lanConfig_port_il, 10);
|
||||
lanConfig_join_il = InputLine_Create (4, 24, ' ');
|
||||
InputLine_SetWidth (lanConfig_join_il, 26);
|
||||
switch (gametype ()) {
|
||||
case "netquake":
|
||||
do_single_player = 1;
|
||||
break;
|
||||
case "quakeworld":
|
||||
do_single_player = 0;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
main_menu ();
|
||||
quit_menu ();
|
||||
load_menu ();
|
||||
save_menu ();
|
||||
Menu_TopMenu ("main");
|
||||
Menu_SetQuit (quit);
|
||||
};
|
|
@ -1,10 +0,0 @@
|
|||
#ifndef __cmd_h
|
||||
#define __cmd_h
|
||||
|
||||
@extern void (string name, void () func) Cmd_AddCommand;
|
||||
@extern integer () Cmd_Argc;
|
||||
@extern string (integer arg) Cmd_Argv;
|
||||
@extern string (integer arg) Cmd_Args;
|
||||
@extern void (string value) Cmd_Return;
|
||||
|
||||
#endif//__cmd_h
|
|
@ -1,7 +0,0 @@
|
|||
#include "cmd.h"
|
||||
|
||||
void (string name, void () func) Cmd_AddCommand = #0;
|
||||
integer () Cmd_Argc = #0;
|
||||
string (integer arg) Cmd_Argv = #0;
|
||||
string (integer arg) Cmd_Args = #0;
|
||||
void (string value) Cmd_Return = #0;
|
|
@ -1,90 +0,0 @@
|
|||
#define NUM_CON_TIMES 4
|
||||
float [NUM_CON_TIMES] con_times;
|
||||
|
||||
integer con_state;
|
||||
integer [5] key_focus;
|
||||
integer force_console;
|
||||
string status_bar;
|
||||
|
||||
void ()
|
||||
Con_ClearNotify =
|
||||
{
|
||||
local integer i;
|
||||
|
||||
for (i = 0; i < NUM_CON_TIMES; i++)
|
||||
con_times[i] = 0;
|
||||
};
|
||||
|
||||
void ()
|
||||
Con_ToggleConsole_f =
|
||||
{
|
||||
if (force_console)
|
||||
con_state = 1;
|
||||
else
|
||||
con_state ^= 1;
|
||||
Key_SetFocus (key_focus[con_state]);
|
||||
Con_ClearNotify ();
|
||||
};
|
||||
|
||||
void ()
|
||||
Con_ToggleChat_f =
|
||||
{
|
||||
if (force_console)
|
||||
con_state = 1;
|
||||
else
|
||||
con_state ^= 2;
|
||||
Key_SetFocus (key_focus[con_state]);
|
||||
Con_ClearNotify ();
|
||||
};
|
||||
|
||||
void ()
|
||||
Con_Clear_f =
|
||||
{
|
||||
};
|
||||
|
||||
void ()
|
||||
Con_MessageMode_f =
|
||||
{
|
||||
if (force_console)
|
||||
return;
|
||||
chat_team = false;
|
||||
Key_SetFocus (key_focus[4]);
|
||||
};
|
||||
|
||||
void ()
|
||||
Con_MessageMode2_f =
|
||||
{
|
||||
if (force_console)
|
||||
return;
|
||||
chat_team = true;
|
||||
Key_SetFocus (key_focus[4]);
|
||||
};
|
||||
|
||||
void ()
|
||||
Con_Resize =
|
||||
{
|
||||
};
|
||||
|
||||
void ()
|
||||
Con_DrawInput =
|
||||
{
|
||||
};
|
||||
|
||||
void ()
|
||||
Con_DrawNotify =
|
||||
{
|
||||
};
|
||||
|
||||
void (integer lines)
|
||||
Con_DrawConsole =
|
||||
{
|
||||
};
|
||||
|
||||
void (integer lines)
|
||||
Con_DrawDownload =
|
||||
{
|
||||
strset (bar, 0, '\x80');
|
||||
strfill (bar, 1, con_linewidth - 2, '\x81');
|
||||
strset (bar, 0, '\x80');
|
||||
strset (bar, con_linewidth - 1, '\x82');
|
||||
};
|
|
@ -1,7 +0,0 @@
|
|||
#ifndef __controls_o_h
|
||||
#define __controls_o_h
|
||||
|
||||
@extern void () MENU_control_binding;
|
||||
@extern void () load_keybindings;
|
||||
|
||||
#endif//__controls_o_h
|
|
@ -1,485 +0,0 @@
|
|||
/*
|
||||
controls_o.qc
|
||||
|
||||
Controls settings menu
|
||||
|
||||
Copyright (C) 2002 Robin Redeker <elmex@x-paste.de>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public
|
||||
License along with this program; if not, write to:
|
||||
|
||||
Free Software Foundation, Inc.
|
||||
59 Temple Place - Suite 330
|
||||
Boston, MA 02111-1307, USA
|
||||
*/
|
||||
|
||||
#include "menu.h"
|
||||
#include "stringh.h"
|
||||
#include "draw.h"
|
||||
#include "game.h"
|
||||
#include "key.h"
|
||||
#include "string.h"
|
||||
#include "options_util.h"
|
||||
|
||||
integer set_key_flag; // holds flag for the key-setting
|
||||
|
||||
// three global hashes for the main binding groups
|
||||
integer basic_binding_hash;
|
||||
integer misc_binding_hash;
|
||||
integer weapon_binding_hash;
|
||||
|
||||
/*
|
||||
init_binding_hash
|
||||
|
||||
this function initializes the hashes for the binding menus
|
||||
*/
|
||||
void ()
|
||||
init_binding_hash =
|
||||
{
|
||||
/*
|
||||
DESIGN NOTES for the Menu:
|
||||
|
||||
binding config is loaded into hashes.
|
||||
the key of the hash is the string, which will
|
||||
be displayed as binding description.
|
||||
The first value of the key is the command, which
|
||||
is bound.
|
||||
The second valu (loaded later) of the hash
|
||||
will be the keyname. (see get_hash_keys())
|
||||
*/
|
||||
|
||||
// Basic keys
|
||||
basic_binding_hash = StringHash_Create();
|
||||
StringHash_Set(basic_binding_hash, "Attack", "+attack", 0);
|
||||
StringHash_Set(basic_binding_hash, "Next weapon", "impulse 10", 0);
|
||||
StringHash_Set(basic_binding_hash, "Jump/Swin up", "+jump", 0);
|
||||
StringHash_Set(basic_binding_hash, "Walk forward", "+forward", 0);
|
||||
StringHash_Set(basic_binding_hash, "Backpedal", "+back", 0);
|
||||
StringHash_Set(basic_binding_hash, "Turn left", "+left", 0);
|
||||
StringHash_Set(basic_binding_hash, "Turn right", "+right", 0);
|
||||
StringHash_Set(basic_binding_hash, "Run", "+speed", 0);
|
||||
StringHash_Set(basic_binding_hash, "Step left", "+moveleft", 0);
|
||||
StringHash_Set(basic_binding_hash, "Step right", "+moveright", 0);
|
||||
StringHash_Set(basic_binding_hash, "Sidestep", "+strafe", 0);
|
||||
StringHash_Set(basic_binding_hash, "Look up", "+lookup", 0);
|
||||
StringHash_Set(basic_binding_hash, "Look down", "+lookdown", 0);
|
||||
StringHash_Set(basic_binding_hash, "Center view", "centerview", 0);
|
||||
StringHash_Set(basic_binding_hash, "Mouse look", "+mlook", 0);
|
||||
StringHash_Set(basic_binding_hash, "Keyboard look", "+klook", 0);
|
||||
StringHash_Set(basic_binding_hash, "Swim up", "+moveup", 0);
|
||||
StringHash_Set(basic_binding_hash, "Swim down", "+movedown", 0);
|
||||
|
||||
// Misc keys
|
||||
misc_binding_hash = StringHash_Create();
|
||||
StringHash_Set(misc_binding_hash, "Pause game", "pause", 0);
|
||||
StringHash_Set(misc_binding_hash, "Tog. m.-grab", "toggle in_grab", 0);
|
||||
StringHash_Set(misc_binding_hash, "Messagemode", "messagemode", 0);
|
||||
StringHash_Set(misc_binding_hash, "Screenshot", "screenshot", 0);
|
||||
|
||||
// Weapon keys
|
||||
weapon_binding_hash = StringHash_Create();
|
||||
StringHash_Set(weapon_binding_hash, "Axe", "impulse 1", 0);
|
||||
StringHash_Set(weapon_binding_hash, "Shotgun", "impulse 2", 0);
|
||||
StringHash_Set(weapon_binding_hash, "Super Shotgun", "impulse 3", 0);
|
||||
StringHash_Set(weapon_binding_hash, "Nailgun", "impulse 4", 0);
|
||||
StringHash_Set(weapon_binding_hash, "Super Nailgun", "impulse 5", 0);
|
||||
StringHash_Set(weapon_binding_hash, "Rocket L. ", "impulse 6", 0);
|
||||
StringHash_Set(weapon_binding_hash, "Grenade L. ", "impulse 7", 0);
|
||||
StringHash_Set(weapon_binding_hash, "Thunderbolt", "impulse 8", 0);
|
||||
|
||||
};
|
||||
|
||||
/*
|
||||
get_keyname
|
||||
|
||||
Gets the string of the key, which is bound
|
||||
to a special binding.
|
||||
bindnum is the number of the binding.
|
||||
As a command/binding can be bound to many keys,
|
||||
you can get the second, third, etc. key by giving
|
||||
the bindnum.
|
||||
*/
|
||||
string (string binding, integer bindnum)
|
||||
get_keyname =
|
||||
{
|
||||
local integer keynum;
|
||||
local string keyname;
|
||||
|
||||
keynum = Key_LookupBinding(IMT_0, bindnum, binding);
|
||||
if(keynum == -1) {
|
||||
keyname = "";
|
||||
} else {
|
||||
keyname = Key_KeynumToString(keynum);
|
||||
// cut away the "K_", thats maybe enough as description for now
|
||||
keyname = String_Cut(0, 2, keyname);
|
||||
}
|
||||
return keyname;
|
||||
};
|
||||
|
||||
/*
|
||||
get_hash_keys
|
||||
|
||||
gets the keys for a keybinding-hash
|
||||
*/
|
||||
void (integer hash_id)
|
||||
get_hash_keys =
|
||||
{
|
||||
local integer i,hlen;
|
||||
local string binding, desc1 = "", desc2 = "";
|
||||
|
||||
hlen = StringHash_Length(hash_id);
|
||||
for(i = 0;i < hlen; i++) {
|
||||
binding = StringHash_GetIdx(hash_id, i, 0);
|
||||
desc1 = get_keyname(binding, 1); // first key bound to
|
||||
desc2 = get_keyname(binding, 2); // second key bound to
|
||||
|
||||
if(desc2 != "") {
|
||||
desc1 += ", " + desc2;
|
||||
}
|
||||
StringHash_SetIdx(hash_id, i, desc1, 1);
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
load_keybindings
|
||||
|
||||
Loads the kername for into the hashes
|
||||
*/
|
||||
void ()
|
||||
load_keybindings =
|
||||
{
|
||||
get_hash_keys(basic_binding_hash);
|
||||
get_hash_keys(misc_binding_hash);
|
||||
get_hash_keys(weapon_binding_hash);
|
||||
};
|
||||
|
||||
|
||||
/*******************
|
||||
* BINDINGS OPTIONS
|
||||
* Binding settings
|
||||
*******************/
|
||||
|
||||
/*
|
||||
DESIGN NOTE (by elmex):
|
||||
|
||||
Every sub-menu for control bindings
|
||||
has its own hash for holding the keybindings.
|
||||
Thats why there are three different functions, which
|
||||
shadow the CB_MAIN_control_binding() function.
|
||||
They get the binding from the correct hash.
|
||||
*/
|
||||
|
||||
/*
|
||||
CB_MAIN_control_binding
|
||||
|
||||
The core function of all control_binding function.
|
||||
Its taking the binding as argument.
|
||||
This function is called by the real callbacks.
|
||||
*/
|
||||
integer (string binding, integer key)
|
||||
CB_MAIN_control_binding =
|
||||
{
|
||||
local integer retval = 0, bindcnt = 0;
|
||||
|
||||
if(set_key_flag) {
|
||||
bindcnt = Key_CountBinding(IMT_0, binding);
|
||||
/* we are not binding keys for more than one command
|
||||
by the menu (maybe extended later) */
|
||||
if(bindcnt < 2) {
|
||||
Key_SetBinding (IMT_0, key, binding);
|
||||
} else {
|
||||
// else, remove a binding and assign a new one
|
||||
dprint ("FOO\n");
|
||||
Key_SetBinding (IMT_0, Key_LookupBinding(IMT_0, 1, binding), "");
|
||||
Key_SetBinding (IMT_0, key, binding);
|
||||
}
|
||||
|
||||
set_key_flag = 0;
|
||||
retval = 1;
|
||||
} else {
|
||||
if(key == QFK_RETURN) {
|
||||
set_key_flag = 1;
|
||||
retval = 1;
|
||||
} else if(key == QFK_BACKSPACE || key == QFK_DELETE) {
|
||||
Key_SetBinding (IMT_0, Key_LookupBinding(IMT_0, 1, binding), "");
|
||||
|
||||
retval = 1;
|
||||
}
|
||||
}
|
||||
|
||||
return retval;
|
||||
};
|
||||
|
||||
/*
|
||||
CB_basic_control_binding
|
||||
|
||||
Callback for the basic control bindings menu
|
||||
*/
|
||||
integer (string text, integer key)
|
||||
CB_basic_control_binding =
|
||||
{
|
||||
local string binding = StringHash_GetIdx(basic_binding_hash, stoi(text), 0);
|
||||
local integer ret = CB_MAIN_control_binding(binding, key);
|
||||
|
||||
// fetch all keynames (possible to optimize.. but not very neccessary)
|
||||
get_hash_keys(basic_binding_hash);
|
||||
return ret;
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
CB_ME_basic_control_binding
|
||||
|
||||
Loading basic keynames when entering the
|
||||
menu
|
||||
*/
|
||||
integer ()
|
||||
CB_ME_basic_control_binding =
|
||||
{
|
||||
get_hash_keys(basic_binding_hash);
|
||||
};
|
||||
|
||||
/*
|
||||
DRAW_basic_control_binding
|
||||
|
||||
Draws the menu for the basic control bindins
|
||||
*/
|
||||
integer ()
|
||||
DRAW_basic_control_binding =
|
||||
{
|
||||
local integer cursor_pad = 40, bind_desc_pad;
|
||||
local integer i, hl;
|
||||
|
||||
bind_desc_pad = 120;
|
||||
|
||||
Draw_String (20, 10, "Backspace/Delete: Del binding");
|
||||
Draw_String (20, 20, "Enter: New binding");
|
||||
|
||||
|
||||
hl = StringHash_Length(basic_binding_hash);
|
||||
for(i=0;i < hl; i++) {
|
||||
draw_val_item (20, 40+(i*10), bind_desc_pad,
|
||||
StringHash_GetIdx(basic_binding_hash, i, -1),
|
||||
StringHash_GetIdx(basic_binding_hash, i, 1));
|
||||
}
|
||||
|
||||
opt_cursor (12, (Menu_GetIndex() * 10) + cursor_pad);
|
||||
|
||||
return 1;
|
||||
};
|
||||
|
||||
/*
|
||||
MENU_basic_control_binding
|
||||
|
||||
Menu making function for the control bindings
|
||||
*/
|
||||
void ()
|
||||
MENU_basic_control_binding =
|
||||
{
|
||||
local integer i,hl;
|
||||
|
||||
Menu_Begin (54, 40, "Basic bindings");
|
||||
Menu_FadeScreen (1);
|
||||
Menu_EnterHook(CB_ME_basic_control_binding);
|
||||
Menu_Draw (DRAW_basic_control_binding);
|
||||
|
||||
hl = StringHash_Length(basic_binding_hash);
|
||||
for (i = 0; i < hl; i++) {
|
||||
Menu_Item (20, 40 + i*10, itos(i), CB_basic_control_binding, 1);
|
||||
}
|
||||
Menu_End ();
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
CB_misc_control_binding
|
||||
|
||||
Callback for misc control bindings.
|
||||
*/
|
||||
integer (string text, integer key)
|
||||
CB_misc_control_binding =
|
||||
{
|
||||
local string binding = StringHash_GetIdx(misc_binding_hash, stoi(text), 0);
|
||||
local integer ret = CB_MAIN_control_binding(binding, key);
|
||||
|
||||
// fetch all keynames (possible to optimize.. but not very neccessary)
|
||||
get_hash_keys(misc_binding_hash);
|
||||
return ret;
|
||||
};
|
||||
|
||||
/*
|
||||
CB_ME_misc_control_binding
|
||||
|
||||
Loading misc keynames when entering the
|
||||
menu
|
||||
*/
|
||||
integer ()
|
||||
CB_ME_misc_control_binding =
|
||||
{
|
||||
get_hash_keys(misc_binding_hash);
|
||||
};
|
||||
|
||||
/*
|
||||
DRAW_misc_control_binding
|
||||
|
||||
Draw the bindings for the misc controls
|
||||
*/
|
||||
integer ()
|
||||
DRAW_misc_control_binding =
|
||||
{
|
||||
local integer cursor_pad = 40, bind_desc_pad;
|
||||
local integer i, hl;
|
||||
|
||||
bind_desc_pad = 120;
|
||||
|
||||
Draw_String (20, 10, "Backspace/Delete: Del binding");
|
||||
Draw_String (20, 20, "Enter: New binding");
|
||||
|
||||
hl = StringHash_Length(misc_binding_hash);
|
||||
for(i=0;i < hl; i++) {
|
||||
draw_val_item (20, 40+(i*10), bind_desc_pad,
|
||||
StringHash_GetIdx(misc_binding_hash, i, -1),
|
||||
StringHash_GetIdx(misc_binding_hash, i, 1));
|
||||
}
|
||||
|
||||
opt_cursor (12, (Menu_GetIndex() * 10) + cursor_pad);
|
||||
return 1;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*
|
||||
MENU_misc_control_binding
|
||||
|
||||
Menu maker function for the misc control binding
|
||||
*/
|
||||
void ()
|
||||
MENU_misc_control_binding =
|
||||
{
|
||||
local integer i,hl;
|
||||
|
||||
Menu_Begin (54, 50, "Misc bindings");
|
||||
Menu_FadeScreen (1);
|
||||
Menu_EnterHook(CB_ME_misc_control_binding);
|
||||
Menu_Draw (DRAW_misc_control_binding);
|
||||
|
||||
hl = StringHash_Length(basic_binding_hash);
|
||||
for (i = 0; i < hl; i++) {
|
||||
Menu_Item (20, 40 + i*10, itos(i), CB_misc_control_binding, 1);
|
||||
}
|
||||
Menu_End ();
|
||||
};
|
||||
|
||||
/*
|
||||
CB_weapon_control_binding
|
||||
|
||||
Callback function for the weapons control bindings
|
||||
*/
|
||||
integer (string text, integer key)
|
||||
CB_weapon_control_binding =
|
||||
{
|
||||
local string binding = StringHash_GetIdx(weapon_binding_hash, stoi(text),0);
|
||||
local integer ret = CB_MAIN_control_binding(binding, key);
|
||||
|
||||
// fetch all keynames (possible to optimize.. but not very neccessary)
|
||||
get_hash_keys(weapon_binding_hash);
|
||||
return ret;
|
||||
};
|
||||
|
||||
/*
|
||||
CB_ME_weapon_control_binding
|
||||
|
||||
Loading weapon keynames when entering the
|
||||
menu
|
||||
*/
|
||||
integer ()
|
||||
CB_ME_weapon_control_binding =
|
||||
{
|
||||
get_hash_keys(weapon_binding_hash);
|
||||
};
|
||||
|
||||
/*
|
||||
DRAW_weapon_control_binding
|
||||
|
||||
Draw the weapon binding menu
|
||||
*/
|
||||
integer ()
|
||||
DRAW_weapon_control_binding =
|
||||
{
|
||||
local integer cursor_pad = 40, bind_desc_pad;
|
||||
local integer i,hl;
|
||||
|
||||
bind_desc_pad = 120;
|
||||
|
||||
Draw_String (20, 10, "Backspace/Delete: Del binding");
|
||||
Draw_String (20, 20, "Enter: New binding");
|
||||
|
||||
hl = StringHash_Length(weapon_binding_hash);
|
||||
for(i=0;i < hl; i++) {
|
||||
draw_val_item (20, 40+(i*10), bind_desc_pad,
|
||||
StringHash_GetIdx(weapon_binding_hash, i, -1),
|
||||
StringHash_GetIdx(weapon_binding_hash, i, 1));
|
||||
}
|
||||
|
||||
opt_cursor (12, (Menu_GetIndex() * 10) + cursor_pad);
|
||||
|
||||
return 1;
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
MENU_weapon_control_binding
|
||||
|
||||
Menu maker for the weapons menu
|
||||
*/
|
||||
void ()
|
||||
MENU_weapon_control_binding =
|
||||
{
|
||||
local integer i,hl;
|
||||
|
||||
Menu_Begin (54, 60, "Weapon bindings");
|
||||
Menu_FadeScreen (1);
|
||||
Menu_EnterHook(CB_ME_weapon_control_binding);
|
||||
Menu_Draw (DRAW_weapon_control_binding);
|
||||
|
||||
hl = StringHash_Length(basic_binding_hash);
|
||||
for (i = 0; i < hl; i++) {
|
||||
Menu_Item (20, 40 + i*10, itos(i), CB_weapon_control_binding, 1);
|
||||
}
|
||||
Menu_End ();
|
||||
};
|
||||
|
||||
/*
|
||||
MENU_control_binding
|
||||
|
||||
Main controls menu, for selecting the sub control menus
|
||||
*/
|
||||
void ()
|
||||
MENU_control_binding =
|
||||
{
|
||||
init_binding_hash (); // init the keybinding hashes
|
||||
|
||||
Menu_Begin (54, 60, "Bindings");
|
||||
Menu_Pic (16, 4, "gfx/qplaque.lmp");
|
||||
Menu_CenterPic (160, 4, "gfx/p_option.lmp");
|
||||
|
||||
Menu_FadeScreen (1);
|
||||
|
||||
MENU_basic_control_binding ();
|
||||
MENU_misc_control_binding ();
|
||||
MENU_weapon_control_binding();
|
||||
|
||||
Menu_End ();
|
||||
};
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
#ifndef __cvar_h
|
||||
#define __cvar_h
|
||||
|
||||
@extern string (string varname) Cvar_GetCvarString;
|
||||
|
||||
#endif//__cvar_h
|
|
@ -1,3 +0,0 @@
|
|||
#include "cvar.h"
|
||||
|
||||
string (string varname) Cvar_GetCvarString = #0;
|
|
@ -1,23 +0,0 @@
|
|||
#ifndef __draw_h
|
||||
#define __draw_h
|
||||
|
||||
struct _qpic_t = {
|
||||
integer width;
|
||||
integer height;
|
||||
};
|
||||
typedef _qpic_t [] qpic_t;
|
||||
|
||||
@extern qpic_t (string name, integer alpha) Draw_CachePic;
|
||||
|
||||
@extern void (integer x, integer y, qpic_t pic) Draw_Pic;
|
||||
@extern void (integer x, integer y, qpic_t pic, integer srcx, integer srcy, integer width, integer height) Draw_SubPic;
|
||||
@extern void (integer x, integer y, qpic_t pic) Draw_CenterPic;
|
||||
|
||||
@extern void (integer x, integer y, integer chr) Draw_Character;
|
||||
@extern void (integer x, integer y, string text) Draw_String;
|
||||
@extern void (integer x, integer y, string text, integer n) Draw_nString;
|
||||
@extern void (integer x, integer y, string text) Draw_AltString;
|
||||
@extern void (integer x, integer y, integer w, integer h, integer c) Draw_Fill;
|
||||
@extern void (integer x, integer y, integer width, integer lines) text_box;
|
||||
|
||||
#endif//__draw_h
|
|
@ -1,60 +0,0 @@
|
|||
#include "draw.h"
|
||||
|
||||
qpic_t (string name, integer alpha) Draw_CachePic = #0;
|
||||
|
||||
void (integer x, integer y, qpic_t pic) Draw_Pic = #0;
|
||||
void (integer x, integer y, qpic_t pic, integer srcx, integer srcy, integer width, integer height) Draw_SubPic = #0;
|
||||
void (integer x, integer y, qpic_t pic) Draw_CenterPic = #0;
|
||||
|
||||
void (integer x, integer y, integer chr) Draw_Character = #0;
|
||||
void (integer x, integer y, string text) Draw_String = #0;
|
||||
void (integer x, integer y, string text, integer n) Draw_nString = #0;
|
||||
void (integer x, integer y, string text) Draw_AltString = #0;
|
||||
void (integer x, integer y, integer w, integer h, integer c) Draw_Fill = #0;
|
||||
|
||||
void (integer x, integer y, integer width, integer lines) text_box =
|
||||
{
|
||||
local integer cx, cy, n;
|
||||
local qpic_t p;
|
||||
|
||||
cx = x;
|
||||
cy = y;
|
||||
p = Draw_CachePic ("gfx/box_tl.lmp", 1);
|
||||
Draw_Pic (cx, cy, p);
|
||||
p = Draw_CachePic ("gfx/box_ml.lmp", 1);
|
||||
for (n = 0; n < lines; n++) {
|
||||
cy += 8;
|
||||
Draw_Pic (cx, cy, p);
|
||||
}
|
||||
p = Draw_CachePic ("gfx/box_bl.lmp", 1);
|
||||
Draw_Pic (cx, cy + 8, p);
|
||||
|
||||
cx += 8;
|
||||
while (width > 0) {
|
||||
cy = y;
|
||||
p = Draw_CachePic ("gfx/box_tm.lmp", 1);
|
||||
Draw_Pic (cx, cy, p);
|
||||
p = Draw_CachePic ("gfx/box_mm.lmp", 1);
|
||||
for (n = 0; n < lines; n++) {
|
||||
cy += 8;
|
||||
if (n == 1)
|
||||
p = Draw_CachePic ("gfx/box_mm2.lmp", 1);
|
||||
Draw_Pic (cx, cy, p);
|
||||
}
|
||||
p = Draw_CachePic ("gfx/box_bm.lmp", 1);
|
||||
Draw_Pic (cx, cy + 8, p);
|
||||
width -= 2;
|
||||
cx += 16;
|
||||
}
|
||||
|
||||
cy = y;
|
||||
p = Draw_CachePic ("gfx/box_tr.lmp", 1);
|
||||
Draw_Pic (cx, cy, p);
|
||||
p = Draw_CachePic ("gfx/box_mr.lmp", 1);
|
||||
for (n = 0; n < lines; n++) {
|
||||
cy += 8;
|
||||
Draw_Pic (cx, cy, p);
|
||||
}
|
||||
p = Draw_CachePic ("gfx/box_br.lmp", 1);
|
||||
Draw_Pic (cx, cy + 8, p);
|
||||
};
|
|
@ -1,11 +0,0 @@
|
|||
#ifndef __file_h
|
||||
#define __file_h
|
||||
|
||||
struct _file_t = {};
|
||||
typedef _file_t [] file_t;
|
||||
|
||||
@extern file_t (string path, string mode) File_Open;
|
||||
@extern void (file_t file) File_Close;
|
||||
@extern string (file_t file) File_GetLine;
|
||||
|
||||
#endif//__file_h
|
|
@ -1,5 +0,0 @@
|
|||
#include "file.h"
|
||||
|
||||
file_t (string path, string mode) File_Open = #0;
|
||||
void (file_t file) File_Close = #0;
|
||||
string (file_t file) File_GetLine = #0;
|
|
@ -1,20 +0,0 @@
|
|||
#ifndef __game_h
|
||||
#define __game_h
|
||||
|
||||
@extern float(string s) cvar; // return cvar.value
|
||||
@extern void(string var, string val) cvar_set; // sets cvar.value
|
||||
@extern string(float f) ftos; // converts float to string
|
||||
@extern integer(float f) ftoi; // converts float to integer
|
||||
@extern string(integer i) itos; // converts interger to string
|
||||
@extern float(integer i) itof; // converts interger to string
|
||||
@extern integer(string str) stoi; // converts string to integer
|
||||
@extern float(string str) stof; // converts string to float
|
||||
@extern void(string s) dprint;
|
||||
|
||||
@extern entity self;
|
||||
@extern .float nextthink;
|
||||
@extern .float frame;
|
||||
@extern .void () think;
|
||||
@extern float time;
|
||||
|
||||
#endif//__game_h
|
|
@ -1,17 +0,0 @@
|
|||
#include "game.h"
|
||||
|
||||
float(string s) cvar = #45; // return cvar.value
|
||||
void(string var, string val) cvar_set = #72; // sets cvar.value
|
||||
string(float f) ftos = #26; // converts float to string
|
||||
integer(float f) ftoi = #110; // converts float to integer
|
||||
string(integer i) itos = #112; // converts interger to string
|
||||
float(integer i) itof = #111; // converts interger to string
|
||||
integer(string str) stoi = #113; // converts string to integer
|
||||
float(string str) stof = #81; // converts string to float
|
||||
void(string s) dprint = #25;
|
||||
|
||||
entity self;
|
||||
.float nextthink;
|
||||
.float frame;
|
||||
.void () think;
|
||||
float time;
|
|
@ -1,16 +0,0 @@
|
|||
#ifndef __inputline_h
|
||||
#define __inputline_h
|
||||
|
||||
struct _inputline_t = {}; // opaque type :)
|
||||
typedef _inputline_t [] inputline_t;
|
||||
|
||||
@extern inputline_t (integer lines, integer size, integer prompt) InputLine_Create;
|
||||
@extern void (inputline_t il, integer width) InputLine_SetWidth;
|
||||
@extern void (inputline_t il) InputLine_Destroy;
|
||||
@extern void (inputline_t il) InputLine_Clear;
|
||||
@extern void (inputline_t il, integer ch) InputLine_Process;
|
||||
@extern void (inputline_t il, integer x, integer y, integer cursor) InputLine_Draw;
|
||||
@extern void (inputline_t il, string str) InputLine_SetText;
|
||||
@extern string (inputline_t il) InputLine_GetText;
|
||||
|
||||
#endif//__inputline-h
|
|
@ -1,10 +0,0 @@
|
|||
#include "inputline.h"
|
||||
|
||||
inputline_t (integer lines, integer size, integer prompt) InputLine_Create = #0;
|
||||
void (inputline_t il, integer width) InputLine_SetWidth = #0;
|
||||
void (inputline_t il) InputLine_Destroy = #0;
|
||||
void (inputline_t il) InputLine_Clear = #0;
|
||||
void (inputline_t il, integer ch) InputLine_Process = #0;
|
||||
void (inputline_t il, integer x, integer y, integer cursor) InputLine_Draw = #0;
|
||||
void (inputline_t il, string str) InputLine_SetText = #0;
|
||||
string (inputline_t il) InputLine_GetText = #0;
|
|
@ -1,27 +0,0 @@
|
|||
/*
|
||||
inputline_util.qc
|
||||
|
||||
Utilities for the inputline
|
||||
|
||||
Copyright (C) 2002 Robin Redeker <elmex@x-paste.de>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public
|
||||
License along with this program; if not, write to:
|
||||
|
||||
Free Software Foundation, Inc.
|
||||
59 Temple Place - Suite 330
|
||||
Boston, MA 02111-1307, USA
|
||||
*/
|
||||
|
||||
/* EMPTY YET - REMOVE FILE? */
|
|
@ -1,10 +0,0 @@
|
|||
#ifndef __key_h
|
||||
#define __key_h
|
||||
|
||||
#include "QF/keys.h"
|
||||
@extern string (integer target, integer keynum, string binding) Key_SetBinding;
|
||||
@extern integer (integer target, integer bindnum, string binding) Key_LookupBinding;
|
||||
@extern integer (integer target, string binding) Key_CountBinding;
|
||||
@extern string (integer keynum) Key_KeynumToString;
|
||||
|
||||
#endif//__key_h
|
|
@ -1,6 +0,0 @@
|
|||
#include "key.h"
|
||||
|
||||
string (integer target, integer keynum, string binding) Key_SetBinding = #0;
|
||||
integer (integer target, integer bindnum, string binding) Key_LookupBinding = #0;
|
||||
integer (integer target, string binding) Key_CountBinding = #0;
|
||||
string (integer keynum) Key_KeynumToString = #0;
|
|
@ -1,29 +0,0 @@
|
|||
#ifndef __menu_h
|
||||
#define __menu_h
|
||||
|
||||
@extern void (integer x, integer y, string text) Menu_Begin;
|
||||
@extern void (integer val) Menu_FadeScreen;
|
||||
@extern void (integer () func) Menu_Draw;
|
||||
@extern void (integer () func) Menu_EnterHook;
|
||||
@extern void (integer () func) Menu_LeaveHook;
|
||||
@extern void (integer x, integer y, string name) Menu_Pic;
|
||||
@extern void (integer x, integer y, string name, integer srcx, integer srcy, integer width, integer height) Menu_SubPic;
|
||||
@extern void (integer x, integer y, string name) Menu_CenterPic;
|
||||
@extern void (integer x, integer y, string name, integer srcx, integer srcy, integer width, integer height) Menu_CenterSubPic;
|
||||
@extern void (integer x, integer y, string text, integer (string text, integer key) func, integer allkeys) Menu_Item;
|
||||
@extern void (void (integer x, integer y) func) Menu_Cursor;
|
||||
@extern void (integer (integer key, integer unicode, integer down) func) Menu_KeyEvent;
|
||||
@extern void () Menu_End;
|
||||
@extern void (string name) Menu_TopMenu;
|
||||
@extern void (string name) Menu_SelectMenu;
|
||||
@extern void (integer () func) Menu_SetQuit;
|
||||
@extern void () Menu_Quit;
|
||||
@extern integer () Menu_GetIndex;
|
||||
|
||||
@extern float () random;
|
||||
@extern float () traceon;
|
||||
@extern float () traceoff;
|
||||
@extern string () gametype;
|
||||
@extern string (...) sprintf;
|
||||
|
||||
#endif//__menu_h;
|
|
@ -1,26 +0,0 @@
|
|||
#include "menu.h"
|
||||
|
||||
void (integer x, integer y, string text) Menu_Begin = #0;
|
||||
void (integer val) Menu_FadeScreen = #0;
|
||||
void (integer () func) Menu_Draw = #0;
|
||||
void (integer () func) Menu_EnterHook = #0;
|
||||
void (integer () func) Menu_LeaveHook = #0;
|
||||
void (integer x, integer y, string name) Menu_Pic = #0;
|
||||
void (integer x, integer y, string name, integer srcx, integer srcy, integer width, integer height) Menu_SubPic = #0;
|
||||
void (integer x, integer y, string name) Menu_CenterPic = #0;
|
||||
void (integer x, integer y, string name, integer srcx, integer srcy, integer width, integer height) Menu_CenterSubPic = #0;
|
||||
void (integer x, integer y, string text, integer (string text, integer key) func, integer allkeys) Menu_Item = #0;
|
||||
void (void (integer x, integer y) func) Menu_Cursor = #0;
|
||||
void (integer (integer key, integer unicode, integer down) func) Menu_KeyEvent = #0;
|
||||
void () Menu_End = #0;
|
||||
void (string name) Menu_TopMenu = #0;
|
||||
void (string name) Menu_SelectMenu = #0;
|
||||
void (integer () func) Menu_SetQuit = #0;
|
||||
void () Menu_Quit = #0;
|
||||
integer () Menu_GetIndex = #0;
|
||||
|
||||
float () random = #0;
|
||||
float () traceon = #0;
|
||||
float () traceoff = #0;
|
||||
string () gametype = #0;
|
||||
string (...) sprintf = #0;
|
|
@ -1,13 +0,0 @@
|
|||
#ifndef __options_h
|
||||
#define __options_h
|
||||
|
||||
@extern void () MENU_video_options;
|
||||
@extern void () MENU_audio_options;
|
||||
@extern void () MENU_control_options;
|
||||
@extern void () MENU_feature_options;
|
||||
@extern void () MENU_player_options;
|
||||
@extern void () MENU_network_options;
|
||||
@extern void () MENU_options;
|
||||
@extern void (integer x, integer y, integer spacing, string label, string valstr) draw_val_item;
|
||||
|
||||
#endif//__options_r
|
|
@ -1,809 +0,0 @@
|
|||
/*
|
||||
options.qc
|
||||
|
||||
Options menu
|
||||
|
||||
Copyright (C) 2002 Robin Redeker <elmex@x-paste.de>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public
|
||||
License along with this program; if not, write to:
|
||||
|
||||
Free Software Foundation, Inc.
|
||||
59 Temple Place - Suite 330
|
||||
Boston, MA 02111-1307, USA
|
||||
*/
|
||||
|
||||
#include "options.h"
|
||||
#include "cbuf.h"
|
||||
#include "menu.h"
|
||||
#include "game.h"
|
||||
#include "draw.h"
|
||||
#include "cvar.h"
|
||||
#include "key.h"
|
||||
#include "inputline.h"
|
||||
#include "controls_o.h"
|
||||
#include "options_util.h"
|
||||
|
||||
/*
|
||||
some definitions of border values for
|
||||
different things
|
||||
*/
|
||||
#define MIN_GAMMA 0.4
|
||||
#define MAX_GAMMA 3
|
||||
#define GAMMA_STEP 0.1
|
||||
|
||||
#define MIN_VIEWSIZE 30
|
||||
#define MAX_VIEWSIZE 120
|
||||
#define VIEWSIZE_STEP 10
|
||||
|
||||
#define MIN_MOUSE_AMP 0
|
||||
#define MAX_MOUSE_AMP 60
|
||||
#define MOUSE_AMP_STEP 2
|
||||
|
||||
#define MIN_VOLUME 0
|
||||
#define MAX_VOLUME 1.5
|
||||
#define VOLUME_STEP 0.1
|
||||
|
||||
#define MIN_COLOR 0
|
||||
#define MAX_COLOR 13
|
||||
#define COLOR_STEP 1
|
||||
|
||||
/****************************
|
||||
* VIDEO OPTIONS
|
||||
* Video settings menu code
|
||||
****************************/
|
||||
|
||||
|
||||
/*
|
||||
CB_video_options
|
||||
|
||||
Menu event callback for video options
|
||||
*/
|
||||
integer (string text, integer key)
|
||||
CB_video_options =
|
||||
{
|
||||
local integer selected_crosshair;
|
||||
local float val;
|
||||
|
||||
switch (text) {
|
||||
case "fullscreen":
|
||||
Cbuf_AddText ("toggle vid_fullscreen\n");
|
||||
break;
|
||||
case "crosshair":
|
||||
selected_crosshair = ftoi(cvar("crosshair"));
|
||||
selected_crosshair++;
|
||||
if(selected_crosshair >= 3) {
|
||||
selected_crosshair = 0;
|
||||
}
|
||||
cvar_set("crosshair", itos(selected_crosshair));
|
||||
break;
|
||||
case "fps":
|
||||
Cbuf_AddText ("toggle show_fps\n");
|
||||
break;
|
||||
case "time":
|
||||
Cbuf_AddText ("toggle show_time\n");
|
||||
break;
|
||||
}
|
||||
|
||||
if(!(key == QFK_RIGHT || key == QFK_LEFT )) {
|
||||
return 0;
|
||||
}
|
||||
switch (text) {
|
||||
case "gamma":
|
||||
val = cvar("vid_gamma");
|
||||
val = min_max_cnt(MIN_GAMMA, MAX_GAMMA, GAMMA_STEP, val,
|
||||
(key == QFK_RIGHT) && (key != QFK_LEFT));
|
||||
cvar_set("vid_gamma", ftos(val));
|
||||
break;
|
||||
case "viewsize":
|
||||
val = cvar("viewsize");
|
||||
val = min_max_cnt(MIN_VIEWSIZE, MAX_VIEWSIZE, VIEWSIZE_STEP, val,
|
||||
(key == QFK_RIGHT) && (key != QFK_LEFT));
|
||||
cvar_set("viewsize", ftos(val));
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
};
|
||||
|
||||
/*
|
||||
DRAW_video_options
|
||||
|
||||
Drawing function for the video options menu
|
||||
*/
|
||||
integer ()
|
||||
DRAW_video_options =
|
||||
{
|
||||
local integer spacing = 120;
|
||||
local integer bar_pad;
|
||||
|
||||
Draw_Pic (16, 4, Draw_CachePic ("gfx/qplaque.lmp", 1));
|
||||
Draw_CenterPic (160, 4, Draw_CachePic ("gfx/p_option.lmp", 1));
|
||||
Draw_String (54, 40, "Video");
|
||||
Draw_String (54, 50, "-----");
|
||||
draw_val_item (70, 60, spacing, "Fullscreen",
|
||||
cvar("vid_fullscreen") ? "On" : "Off");
|
||||
draw_val_item (70, 70, spacing, "Crosshair", ftos(cvar("crosshair")));
|
||||
draw_val_item (70, 80, spacing, "Show fps",
|
||||
cvar("show_fps") ? "On" : "Off");
|
||||
draw_val_item (70, 90, spacing, "Show time",
|
||||
cvar("show_time") ? "On" : "Off");
|
||||
bar_pad = 90;
|
||||
|
||||
Draw_String (70, bar_pad + 10, "Gamma:");
|
||||
draw_perc_bar (118, bar_pad + 10, 15,
|
||||
to_percentage (MIN_GAMMA, MAX_GAMMA, cvar("vid_gamma")));
|
||||
Draw_String (118 + (15 + 4)*8 , bar_pad + 10, ftos(cvar("vid_gamma")));
|
||||
|
||||
Draw_String (70, bar_pad + 20, "Viewsize:");
|
||||
draw_perc_bar (142, bar_pad + 20, 12,
|
||||
to_percentage (MIN_VIEWSIZE, MAX_VIEWSIZE, cvar("viewsize")));
|
||||
Draw_String (142 + (12 + 4)*8 , bar_pad + 20, ftos(cvar("viewsize")));
|
||||
|
||||
opt_cursor (62, (Menu_GetIndex() * 10) + 60);
|
||||
return 1;
|
||||
};
|
||||
|
||||
/*
|
||||
MENU_video_options
|
||||
|
||||
Menu function for the video options menu.
|
||||
*/
|
||||
void ()
|
||||
MENU_video_options =
|
||||
{
|
||||
local integer bar_pad;
|
||||
|
||||
Menu_Begin (54, 50, "Video");
|
||||
Menu_FadeScreen (1);
|
||||
Menu_Draw (DRAW_video_options);
|
||||
|
||||
Menu_Item (54, 60, "fullscreen", CB_video_options, 0);
|
||||
Menu_Item (54, 70, "crosshair", CB_video_options, 0);
|
||||
Menu_Item (54, 80, "fps", CB_video_options, 0);
|
||||
Menu_Item (54, 80, "time", CB_video_options, 0);
|
||||
bar_pad = 90;
|
||||
|
||||
Menu_Item (54, bar_pad + 10, "gamma", CB_video_options, 1);
|
||||
Menu_Item (54, bar_pad + 20, "viewsize", CB_video_options, 1);
|
||||
Menu_End ();
|
||||
};
|
||||
|
||||
/*************************************
|
||||
* AUDIO OPTIONS
|
||||
* Code for the audio settings menu
|
||||
*************************************/
|
||||
|
||||
/*
|
||||
CB_audio_options
|
||||
|
||||
Callback for the audio settings.
|
||||
*/
|
||||
integer (string text, integer key)
|
||||
CB_audio_options =
|
||||
{
|
||||
local float volume;
|
||||
|
||||
if(!(key == QFK_RIGHT || key == QFK_LEFT )) {
|
||||
return 0;
|
||||
}
|
||||
volume = cvar("volume");
|
||||
volume = min_max_cnt(MIN_VOLUME, MAX_VOLUME, VOLUME_STEP, volume,
|
||||
(key == QFK_RIGHT) && (key != QFK_LEFT));
|
||||
cvar_set("volume", ftos(volume));
|
||||
|
||||
return 0;
|
||||
};
|
||||
|
||||
/*
|
||||
DRAW_audio_options
|
||||
|
||||
Draws the audio options menu
|
||||
*/
|
||||
integer ()
|
||||
DRAW_audio_options =
|
||||
{
|
||||
local string tmp = ftos(cvar("crosshair"));
|
||||
local integer spacing = 120;
|
||||
local integer bar_pad;
|
||||
|
||||
Draw_Pic (16, 4, Draw_CachePic ("gfx/qplaque.lmp", 1));
|
||||
Draw_CenterPic (160, 4, Draw_CachePic ("gfx/p_option.lmp", 1));
|
||||
Draw_String (54, 40, "Audio");
|
||||
Draw_String (54, 50, "-----");
|
||||
bar_pad = 50;
|
||||
|
||||
Draw_String (70, bar_pad + 10, "Volume:");
|
||||
draw_perc_bar (126, bar_pad + 10, 15,
|
||||
to_percentage (MIN_VOLUME, MAX_VOLUME, cvar("volume")) );
|
||||
Draw_String (126 + (15 + 4)*8 , bar_pad + 10, ftos(cvar("volume")));
|
||||
|
||||
opt_cursor (62, (Menu_GetIndex() * 10) + 60);
|
||||
return 1;
|
||||
};
|
||||
|
||||
/*
|
||||
MENU_audio_options
|
||||
|
||||
Makes the audio menu
|
||||
*/
|
||||
void ()
|
||||
MENU_audio_options =
|
||||
{
|
||||
local integer bar_pad;
|
||||
|
||||
Menu_Begin (54, 60, "Audio");
|
||||
Menu_FadeScreen (1);
|
||||
Menu_Draw (DRAW_audio_options);
|
||||
|
||||
bar_pad = 0;
|
||||
Menu_Item (54, bar_pad + 10, "volume", CB_audio_options, 1);
|
||||
Menu_End ();
|
||||
};
|
||||
|
||||
/************************
|
||||
* CONTROL OPTIONS
|
||||
* Control setting code
|
||||
************************/
|
||||
|
||||
/*
|
||||
CB_control_options
|
||||
|
||||
Callback for control options
|
||||
*/
|
||||
integer (string text, integer key)
|
||||
CB_control_options =
|
||||
{
|
||||
local float val;
|
||||
|
||||
switch (text) {
|
||||
case "in_grab":
|
||||
Cbuf_AddText ("toggle in_grab\n");
|
||||
break;
|
||||
case "autorun":
|
||||
if(cvar("cl_forwardspeed") < 400) {
|
||||
Cbuf_AddText ("set cl_forwardspeed 400\n");
|
||||
Cbuf_AddText ("set cl_backspeed 400\n");
|
||||
} else {
|
||||
Cbuf_AddText ("set cl_forwardspeed 200\n");
|
||||
Cbuf_AddText ("set cl_backspeed 200\n");
|
||||
}
|
||||
break;
|
||||
case "freelook":
|
||||
Cbuf_AddText ("toggle freelook\n");
|
||||
break;
|
||||
case "lookspring":
|
||||
Cbuf_AddText ("toggle lookspring\n");
|
||||
break;
|
||||
case "lookstrafe":
|
||||
Cbuf_AddText ("toggle lookstrafe\n");
|
||||
break;
|
||||
case "m_pitch":
|
||||
if(cvar("m_pitch") < 0) {
|
||||
Cbuf_AddText ("set m_pitch 0.022\n");
|
||||
} else {
|
||||
Cbuf_AddText ("set m_pitch -0.022\n");
|
||||
}
|
||||
break;
|
||||
case "cl_autorecord":
|
||||
Cbuf_AddText ("toggle cl_autorecord\n");
|
||||
break;
|
||||
case "cl_fraglog":
|
||||
Cbuf_AddText ("toggle cl_fraglog\n");
|
||||
break;
|
||||
}
|
||||
if(!(key == QFK_RIGHT || key == QFK_LEFT)) {
|
||||
return 0;
|
||||
}
|
||||
switch (text) {
|
||||
case "mouseamp":
|
||||
val = cvar("in_mouse_amp");
|
||||
val = min_max_cnt(MIN_MOUSE_AMP, MAX_MOUSE_AMP, MOUSE_AMP_STEP, val,
|
||||
(key == QFK_RIGHT) && (key != QFK_LEFT));
|
||||
cvar_set("in_mouse_amp", ftos(val));
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
};
|
||||
|
||||
/*
|
||||
DRAW_control_options
|
||||
|
||||
Draws the control option menu
|
||||
*/
|
||||
integer ()
|
||||
DRAW_control_options =
|
||||
{
|
||||
local integer cursor_pad = 0, spacing = 120, bar_pad;
|
||||
|
||||
Draw_Pic (16, 4, Draw_CachePic ("gfx/qplaque.lmp", 1));
|
||||
Draw_CenterPic (160, 4, Draw_CachePic ("gfx/p_option.lmp", 1));
|
||||
Draw_String (54, 40, "Controls");
|
||||
Draw_String (54, 50, "--------");
|
||||
Draw_String (70, 60, "Bindings");
|
||||
|
||||
draw_val_item (70, 70, spacing, "Grab mouse", cvar("in_grab") ? "On" : "Off");
|
||||
draw_val_item (70, 80, spacing, "Auto run", cvar("cl_forwardspeed") < 400 ? "Off" : "On");
|
||||
draw_val_item (70, 90, spacing, "Mouse Invert", cvar("m_pitch") < 0 ? "On" : "Off");
|
||||
bar_pad = 90;
|
||||
|
||||
Draw_String (70, bar_pad + 10, "Mouse amp:");
|
||||
draw_perc_bar (150, bar_pad + 10, 12, to_percentage (MIN_MOUSE_AMP, MAX_MOUSE_AMP, cvar("in_mouse_amp")));
|
||||
Draw_String (150 + (12 + 4)*8 , bar_pad + 10, ftos(cvar("in_mouse_amp")));
|
||||
|
||||
draw_val_item (70, 110, spacing, "Freelook", cvar("freelook") ? "On" : "Off");
|
||||
draw_val_item (70, 120, spacing, "Lookspring", cvar("lookspring") ? "On" : "Off");
|
||||
draw_val_item (70, 130, spacing, "Lookstrafe", cvar("lookstrafe") ? "On" : "Off");
|
||||
|
||||
opt_cursor (62, (Menu_GetIndex() * 10) + 60 + cursor_pad);
|
||||
|
||||
return 1;
|
||||
};
|
||||
|
||||
/*
|
||||
MENU_control_options
|
||||
|
||||
Menu make function for control options
|
||||
*/
|
||||
void ()
|
||||
MENU_control_options =
|
||||
{
|
||||
Menu_Begin (54, 40, "Controls");
|
||||
Menu_FadeScreen (1);
|
||||
Menu_CenterPic (160, 4, "gfx/p_option.lmp");
|
||||
|
||||
Menu_Draw (DRAW_control_options);
|
||||
|
||||
MENU_control_binding ();
|
||||
|
||||
Menu_Item (54, 70, "in_grab", CB_control_options, 0);
|
||||
Menu_Item (54, 80, "autorun", CB_control_options, 0);
|
||||
Menu_Item (54, 90, "m_pitch", CB_control_options, 0);
|
||||
Menu_Item (54, 100, "mouseamp", CB_control_options, 1);
|
||||
Menu_Item (54, 110, "freelook", CB_control_options, 0);
|
||||
Menu_Item (54, 120, "lookspring", CB_control_options, 0);
|
||||
Menu_Item (54, 130, "lookstrafe", CB_control_options, 0);
|
||||
|
||||
Menu_End ();
|
||||
};
|
||||
|
||||
/***********************************************
|
||||
* FEATURES OPTIONS
|
||||
* Code of settings for special features of QF
|
||||
***********************************************/
|
||||
|
||||
/*
|
||||
CB_feature_options
|
||||
|
||||
Callback for feature settings
|
||||
*/
|
||||
integer (string text, integer key)
|
||||
CB_feature_options =
|
||||
{
|
||||
switch (text) {
|
||||
case "cl_autorecord":
|
||||
Cbuf_AddText ("toggle cl_autorecord\n");
|
||||
break;
|
||||
case "cl_fraglog":
|
||||
Cbuf_AddText ("toggle cl_fraglog\n");
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
};
|
||||
|
||||
/*
|
||||
DRAW_feature_options
|
||||
|
||||
Draws the feature option menu
|
||||
*/
|
||||
integer ()
|
||||
DRAW_feature_options =
|
||||
{
|
||||
local integer cursor_pad = 0, spacing = 120;
|
||||
|
||||
Draw_Pic (16, 4, Draw_CachePic ("gfx/qplaque.lmp", 1));
|
||||
Draw_CenterPic (160,4, Draw_CachePic ("gfx/p_option.lmp", 1));
|
||||
Draw_String (54, 40, "Features");
|
||||
Draw_String (54, 50, "--------");
|
||||
|
||||
draw_val_item (70, 60, spacing, "Auto Record",
|
||||
cvar("cl_autorecord") != 0 ? "On" : "Off");
|
||||
draw_val_item (70, 70, spacing, "Fraglogging",
|
||||
cvar("cl_fraglog") != 0 ? "On" : "Off");
|
||||
|
||||
opt_cursor (62, (Menu_GetIndex() * 10) + 60 + cursor_pad);
|
||||
return 1;
|
||||
};
|
||||
|
||||
/*
|
||||
MENU_feature_options
|
||||
|
||||
Makes the feature option menu
|
||||
*/
|
||||
void ()
|
||||
MENU_feature_options =
|
||||
{
|
||||
Menu_Begin (54, 70, "Features");
|
||||
Menu_FadeScreen (1);
|
||||
Menu_CenterPic (160, 4, "gfx/p_option.lmp");
|
||||
Menu_Draw (DRAW_feature_options);
|
||||
Menu_Item (54, 70, "cl_autorecord", CB_feature_options, 0);
|
||||
Menu_Item (54, 80, "cl_fraglog", CB_feature_options, 0);
|
||||
Menu_End ();
|
||||
};
|
||||
|
||||
|
||||
/***************************************************
|
||||
* PLAYER OPTIONS
|
||||
* Player settings, generally name, team, and color
|
||||
***************************************************/
|
||||
|
||||
string playername_cvar; // name of the cvar holding playername (gametype dependend)
|
||||
string teamname_cvar; // name of the cvar holding teamname (MAY ? gametype dependend)
|
||||
|
||||
// input for playername and teamname
|
||||
inputline_t player_config_plname_il;
|
||||
inputline_t player_config_tname_il;
|
||||
|
||||
// this holds active inputline pointer
|
||||
inputline_t player_config_iactive;
|
||||
|
||||
// Y padding for the player config
|
||||
#define PLAYER_CONF_Y_PAD 60
|
||||
|
||||
// table for cursor-positions
|
||||
#define NUM_PLAYERCONFIG_CMDS 4
|
||||
integer [NUM_PLAYERCONFIG_CMDS] player_config_cursor_tbl = {
|
||||
PLAYER_CONF_Y_PAD + 8,
|
||||
PLAYER_CONF_Y_PAD + 20 + 8,
|
||||
PLAYER_CONF_Y_PAD + 45,
|
||||
PLAYER_CONF_Y_PAD + 60
|
||||
};
|
||||
|
||||
integer player_config_cursor;
|
||||
|
||||
// array, which holds commands for this menu
|
||||
string [NUM_PLAYERCONFIG_CMDS] player_config_vals = {
|
||||
"",
|
||||
"",
|
||||
"topcolor",
|
||||
"bottomcolor"
|
||||
};
|
||||
|
||||
|
||||
integer (integer key, integer unicode, integer down)
|
||||
KEYEV_player_options =
|
||||
{
|
||||
local float colortmp;
|
||||
|
||||
switch (key) {
|
||||
case QFK_DOWN:
|
||||
case QFM_WHEEL_DOWN:
|
||||
if (!player_config_iactive) {
|
||||
player_config_cursor ++;
|
||||
player_config_cursor %= NUM_PLAYERCONFIG_CMDS;
|
||||
}
|
||||
break;
|
||||
case QFK_UP:
|
||||
case QFM_WHEEL_UP:
|
||||
if (!player_config_iactive) {
|
||||
player_config_cursor += NUM_PLAYERCONFIG_CMDS - 1;
|
||||
player_config_cursor %= NUM_PLAYERCONFIG_CMDS;
|
||||
}
|
||||
break;
|
||||
case QFK_RETURN:
|
||||
if (player_config_iactive) {
|
||||
if(player_config_iactive == player_config_plname_il) {
|
||||
cvar_set(playername_cvar,InputLine_GetText(player_config_plname_il));
|
||||
} else if(player_config_iactive == player_config_tname_il) {
|
||||
cvar_set(teamname_cvar,InputLine_GetText(player_config_tname_il));
|
||||
}
|
||||
player_config_iactive = NIL;
|
||||
} else {
|
||||
if (player_config_cursor == 0) {
|
||||
player_config_iactive = player_config_plname_il;
|
||||
} else if(player_config_cursor == 1) {
|
||||
player_config_iactive = player_config_tname_il;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
if(key != QFK_RETURN && player_config_iactive) {
|
||||
InputLine_Process (player_config_iactive, key >= 256 ? key : unicode);
|
||||
}
|
||||
|
||||
if(!(key == QFK_RIGHT || key == QFK_LEFT )) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
switch (player_config_vals[player_config_cursor]) {
|
||||
case "topcolor":
|
||||
colortmp = cvar("topcolor");
|
||||
colortmp = min_max_cnt(MIN_COLOR, MAX_COLOR, COLOR_STEP, colortmp,
|
||||
(key == QFK_RIGHT) && (key != QFK_LEFT));
|
||||
cvar_set("topcolor", ftos(colortmp));
|
||||
break;
|
||||
case "bottomcolor":
|
||||
colortmp = cvar("bottomcolor");
|
||||
colortmp = min_max_cnt(MIN_COLOR, MAX_COLOR, COLOR_STEP, colortmp,
|
||||
(key == QFK_RIGHT) && (key != QFK_LEFT));
|
||||
cvar_set("bottomcolor", ftos(colortmp));
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return 1;
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
DRAW_player_options
|
||||
|
||||
Draws the player option menu
|
||||
*/
|
||||
integer ()
|
||||
DRAW_player_options =
|
||||
{
|
||||
local integer cursor_pad = 0, spacing = 120;
|
||||
|
||||
Draw_Pic (16, 4, Draw_CachePic ("gfx/qplaque.lmp", 1));
|
||||
Draw_CenterPic (160,4, Draw_CachePic ("gfx/p_option.lmp", 1));
|
||||
Draw_String (54, 40, "Player");
|
||||
Draw_String (54, 50, "--------");
|
||||
|
||||
|
||||
Draw_String(70, PLAYER_CONF_Y_PAD + 8, "Name..:");
|
||||
text_box(120, PLAYER_CONF_Y_PAD, 17, 1);
|
||||
InputLine_Draw (player_config_plname_il, 120, PLAYER_CONF_Y_PAD + 8,
|
||||
player_config_iactive == player_config_plname_il);
|
||||
|
||||
Draw_String(70, PLAYER_CONF_Y_PAD + 20 + 8, "Team..:");
|
||||
text_box(120, PLAYER_CONF_Y_PAD + 20, 5, 1);
|
||||
InputLine_Draw (player_config_tname_il, 120, PLAYER_CONF_Y_PAD + 8 + 20,
|
||||
player_config_iactive == player_config_tname_il);
|
||||
|
||||
|
||||
draw_val_item (70, PLAYER_CONF_Y_PAD + 45, spacing, "Top color",
|
||||
" " + ftos(cvar("topcolor")));
|
||||
draw_val_item (70, PLAYER_CONF_Y_PAD + 60, spacing, "Bottom color",
|
||||
" " + ftos(cvar("bottomcolor")));
|
||||
|
||||
// Draw nice color boxes
|
||||
text_box(192, PLAYER_CONF_Y_PAD + 45 - 8, 1, 1);
|
||||
Draw_Fill (200, PLAYER_CONF_Y_PAD + 45, 16, 8,
|
||||
ftoi(cvar("topcolor"))*16+8);
|
||||
|
||||
text_box(192, PLAYER_CONF_Y_PAD + 60 - 8, 1, 1);
|
||||
Draw_Fill (200, PLAYER_CONF_Y_PAD + 60, 16, 8,
|
||||
ftoi(cvar("bottomcolor"))*16+8);
|
||||
|
||||
opt_cursor (62, player_config_cursor_tbl[player_config_cursor]);
|
||||
return 1;
|
||||
};
|
||||
|
||||
/*
|
||||
CB_ME_player_options
|
||||
|
||||
Entercallback for the playermenu.
|
||||
For initalising the playername and teamname.
|
||||
*/
|
||||
integer ()
|
||||
CB_ME_player_options =
|
||||
{
|
||||
if(gametype() == "quakeworld") {
|
||||
playername_cvar = "name";
|
||||
} else {
|
||||
playername_cvar = "_cl_name";
|
||||
}
|
||||
|
||||
teamname_cvar = "team"; // FIXME: is this maybe something other in netquake?
|
||||
|
||||
InputLine_SetText (player_config_plname_il, Cvar_GetCvarString(playername_cvar));
|
||||
InputLine_SetText (player_config_tname_il, Cvar_GetCvarString(teamname_cvar));
|
||||
};
|
||||
|
||||
/*
|
||||
MENU_player_options
|
||||
|
||||
Makes the player option menu
|
||||
*/
|
||||
void ()
|
||||
MENU_player_options =
|
||||
{
|
||||
player_config_plname_il = InputLine_Create (4, 18, ' ');
|
||||
InputLine_SetWidth (player_config_plname_il, 18);
|
||||
player_config_tname_il = InputLine_Create (4, 7, ' ');
|
||||
InputLine_SetWidth (player_config_tname_il, 7);
|
||||
player_config_iactive = NIL;
|
||||
|
||||
Menu_Begin (54, 80, "Player");
|
||||
Menu_FadeScreen (1);
|
||||
Menu_KeyEvent (KEYEV_player_options);
|
||||
Menu_EnterHook (CB_ME_player_options);
|
||||
Menu_Draw (DRAW_player_options);
|
||||
Menu_End ();
|
||||
};
|
||||
|
||||
/******************************************************************************
|
||||
* NETWORK OPTIONS
|
||||
* Options, which have to do with network stuff (rate, noskins, netgraph, ...)
|
||||
******************************************************************************/
|
||||
|
||||
// input for playername
|
||||
inputline_t network_config_rate_il;
|
||||
// this holds active inputline pointer
|
||||
inputline_t network_config_iactive;
|
||||
|
||||
|
||||
integer network_config_cursor;
|
||||
|
||||
// Y padding for the player config
|
||||
#define NETWORK_CONF_Y_PAD 60
|
||||
|
||||
// table for cursor-positions
|
||||
#define NUM_NETWORKCONFIG_CMDS 1
|
||||
integer [NUM_NETWORKCONFIG_CMDS] network_config_cursor_tbl = {
|
||||
PLAYER_CONF_Y_PAD + 8,
|
||||
};
|
||||
|
||||
integer network_config_cursor;
|
||||
|
||||
// array, which holds commands for this menu
|
||||
string [NUM_NETWORKCONFIG_CMDS] network_config_vals = {
|
||||
"",
|
||||
};
|
||||
|
||||
|
||||
integer (integer key, integer unicode, integer down)
|
||||
KEYEV_network_options =
|
||||
{
|
||||
switch (key) {
|
||||
case QFK_DOWN:
|
||||
case QFM_WHEEL_DOWN:
|
||||
if (!network_config_iactive) {
|
||||
network_config_cursor ++;
|
||||
network_config_cursor %= NUM_PLAYERCONFIG_CMDS;
|
||||
}
|
||||
break;
|
||||
case QFK_UP:
|
||||
case QFM_WHEEL_UP:
|
||||
if (!network_config_iactive) {
|
||||
network_config_cursor += NUM_PLAYERCONFIG_CMDS - 1;
|
||||
network_config_cursor %= NUM_PLAYERCONFIG_CMDS;
|
||||
}
|
||||
break;
|
||||
case QFK_RETURN:
|
||||
if (network_config_iactive) {
|
||||
if(network_config_iactive == network_config_rate_il) {
|
||||
cvar_set("rate",InputLine_GetText(network_config_rate_il));
|
||||
}
|
||||
network_config_iactive = NIL;
|
||||
} else {
|
||||
if (network_config_cursor == 0) {
|
||||
network_config_iactive = network_config_rate_il;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
if(key != QFK_RETURN && network_config_iactive) {
|
||||
InputLine_Process (network_config_iactive, key >= 256 ? key : unicode);
|
||||
}
|
||||
|
||||
if(!(key == QFK_RIGHT || key == QFK_LEFT )) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
// switch (network_config_vals[network_config_cursor]) {
|
||||
// } // none yet
|
||||
|
||||
|
||||
return 1;
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
DRAW_network_options
|
||||
|
||||
Draws the network option menu
|
||||
*/
|
||||
integer ()
|
||||
DRAW_network_options =
|
||||
{
|
||||
local integer cursor_pad = 0, spacing = 120;
|
||||
|
||||
Draw_Pic (16, 4, Draw_CachePic ("gfx/qplaque.lmp", 1));
|
||||
Draw_CenterPic (160,4, Draw_CachePic ("gfx/p_option.lmp", 1));
|
||||
Draw_String (54, 40, "Network");
|
||||
Draw_String (54, 50, "--------");
|
||||
|
||||
|
||||
Draw_String(70, NETWORK_CONF_Y_PAD + 8, "Rate..:");
|
||||
text_box(120, NETWORK_CONF_Y_PAD, 9, 1);
|
||||
InputLine_Draw (network_config_rate_il, 120, NETWORK_CONF_Y_PAD + 8,
|
||||
network_config_iactive == network_config_rate_il);
|
||||
|
||||
opt_cursor (62, player_config_cursor_tbl[player_config_cursor]);
|
||||
return 1;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*
|
||||
CB_ME_network_options
|
||||
|
||||
Entercallback for the networkmenu.
|
||||
*/
|
||||
integer ()
|
||||
CB_ME_network_options =
|
||||
{
|
||||
InputLine_SetText (network_config_rate_il, Cvar_GetCvarString("rate"));
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*
|
||||
MENU_network_options
|
||||
|
||||
Makes the network option menu
|
||||
*/
|
||||
void ()
|
||||
MENU_network_options =
|
||||
{
|
||||
network_config_rate_il = InputLine_Create (4, 9, ' ');
|
||||
InputLine_SetWidth (network_config_rate_il, 9);
|
||||
|
||||
Menu_Begin (54, 90, "Network");
|
||||
Menu_FadeScreen (1);
|
||||
Menu_KeyEvent (KEYEV_network_options);
|
||||
Menu_EnterHook (CB_ME_network_options);
|
||||
Menu_Draw (DRAW_network_options);
|
||||
Menu_End ();
|
||||
};
|
||||
|
||||
integer (string text, integer key)
|
||||
op_goto_console =
|
||||
{
|
||||
Cbuf_AddText ("toggleconsole\n");
|
||||
return 0;
|
||||
};
|
||||
|
||||
/*************************
|
||||
* MAIN OPTIONS
|
||||
* Main options menu code
|
||||
*************************/
|
||||
|
||||
/*
|
||||
MENU_options
|
||||
|
||||
Makes the main options menu
|
||||
*/
|
||||
void ()
|
||||
MENU_options =
|
||||
{
|
||||
local integer spacing = 120;
|
||||
|
||||
Menu_Begin (54, 72, "");
|
||||
Menu_FadeScreen (1);
|
||||
Menu_Pic (16, 4, "gfx/qplaque.lmp");
|
||||
Menu_CenterPic (160, 4, "gfx/p_option.lmp");
|
||||
|
||||
Menu_Item (54, 32, "Goto Console", op_goto_console, 0);
|
||||
MENU_control_options ();
|
||||
MENU_video_options ();
|
||||
MENU_audio_options ();
|
||||
MENU_feature_options ();
|
||||
MENU_player_options ();
|
||||
MENU_network_options ();
|
||||
|
||||
Menu_End ();
|
||||
};
|
|
@ -1,11 +0,0 @@
|
|||
#ifndef __options_util_h
|
||||
#define __options_util_h
|
||||
|
||||
@extern void (integer x, integer y) opt_cursor;
|
||||
@extern void (integer x, integer y, integer size, integer perc_val) draw_perc_bar;
|
||||
@extern void (integer x, integer y, integer spacing, string spacechar, string label, string valstr) draw_item;
|
||||
@extern void (integer x, integer y, integer spacing, string label, string valstr) draw_val_item;
|
||||
@extern integer (float min, float max, float val) to_percentage;
|
||||
@extern float (float min, float max, float step, float val, integer cntflag) min_max_cnt;
|
||||
|
||||
#endif//__options_util_h
|
|
@ -1,164 +0,0 @@
|
|||
/*
|
||||
options_util.qc
|
||||
|
||||
Utilities for the options menu
|
||||
|
||||
Copyright (C) 2002 Robin Redeker <elmex@x-paste.de>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public
|
||||
License along with this program; if not, write to:
|
||||
|
||||
Free Software Foundation, Inc.
|
||||
59 Temple Place - Suite 330
|
||||
Boston, MA 02111-1307, USA
|
||||
*/
|
||||
|
||||
#include "draw.h"
|
||||
#include "game.h"
|
||||
#include "string.h"
|
||||
|
||||
/*
|
||||
opt_cursor
|
||||
|
||||
function for drawing the cursor
|
||||
*/
|
||||
void (integer x, integer y)
|
||||
opt_cursor =
|
||||
{
|
||||
// use time becaus we want a nice rotaing cursor
|
||||
Draw_Character (x, y, 12 + (integer (time * 4) & 1));
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*
|
||||
draw_perc_bar
|
||||
|
||||
Draws a percentage bar by giving its size (in
|
||||
chars), x and y position and the percentage from 0 to 100
|
||||
*/
|
||||
void (integer x, integer y, integer size, integer perc_val)
|
||||
draw_perc_bar =
|
||||
{
|
||||
local float perc;
|
||||
local integer i;
|
||||
|
||||
if(perc_val > 100) {
|
||||
perc_val = 100;
|
||||
} else if(perc_val < 0) {
|
||||
perc_val = 0;
|
||||
}
|
||||
|
||||
perc = itof(perc_val) / ( 100 / itof(size) );
|
||||
|
||||
/* 128, 129, 130 and 131 are special characters for scrollbars */
|
||||
Draw_Character (x, y, 128); // draw beginning
|
||||
for (i = 0; i <= size; i++) {
|
||||
Draw_Character (x + ((i+1)*8), y, 129); // draw the borders
|
||||
}
|
||||
Draw_Character (x + ((i+1)*8), y, 130); // draw last char
|
||||
Draw_Character (x + ((ftoi(perc) + 1) * 8), y, 131); // draw slider
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*
|
||||
draw_item
|
||||
|
||||
Draws a item with a specific spacing between
|
||||
label and value to positions x, y.
|
||||
Used as helper function for draw_val_item.
|
||||
*/
|
||||
void (integer x, integer y, integer spacing, string spacechar,
|
||||
string label, string valstr)
|
||||
draw_item =
|
||||
{
|
||||
local integer i;
|
||||
Draw_String (x, y, label);
|
||||
for (i = x + String_Len(label)*8; i < (x+spacing); i+=8) {
|
||||
Draw_String (i, y, spacechar);
|
||||
}
|
||||
Draw_String (x + spacing, y, valstr);
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
draw_val_item
|
||||
|
||||
Draws a nice menu item.
|
||||
Use this function for a consistent look of menu items!
|
||||
Example:
|
||||
<Label>.....:<valstr>
|
||||
spacing are the number of the points to put
|
||||
*/
|
||||
void (integer x, integer y, integer spacing, string label, string valstr)
|
||||
draw_val_item =
|
||||
{
|
||||
draw_item (x, y, spacing, ".", label, ":" + valstr);
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*
|
||||
to_percentage
|
||||
|
||||
Calculates the percentage of a value relative
|
||||
to a min and max value.
|
||||
*/
|
||||
integer (float min, float max, float val)
|
||||
to_percentage =
|
||||
{
|
||||
local integer perc;
|
||||
local float max_v = (max-min);
|
||||
val -= min;
|
||||
|
||||
if(val > max_v) {
|
||||
val = max_v;
|
||||
}
|
||||
if(val < 0) {
|
||||
val = 0;
|
||||
}
|
||||
perc = ftoi((val/max_v) * 100);
|
||||
|
||||
return perc;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*
|
||||
min_max_cnt
|
||||
|
||||
Increases or decreases a value by take
|
||||
care of the bordervalues.
|
||||
min, max are the borders.
|
||||
step is the step by in-/de-creasing.
|
||||
cntflag should be true for increasing and
|
||||
false for decreasing
|
||||
*/
|
||||
float (float min, float max, float step, float val, integer cntflag)
|
||||
min_max_cnt =
|
||||
{
|
||||
if(cntflag) {
|
||||
val += step;
|
||||
} else {
|
||||
val -= step;
|
||||
}
|
||||
|
||||
if(val > max) {
|
||||
val = max;
|
||||
} else if(val < min) {
|
||||
val = min;
|
||||
}
|
||||
return val;
|
||||
};
|
|
@ -1,6 +0,0 @@
|
|||
#ifndef __servlist_h
|
||||
#define __servlist_h
|
||||
|
||||
@extern void () server_list_menu;
|
||||
|
||||
#endif//__servlist_h
|
|
@ -1,108 +0,0 @@
|
|||
#include "menu.h"
|
||||
#include "draw.h"
|
||||
#include "inputline.h"
|
||||
#include "options_util.h"
|
||||
#include "controls_o.h"
|
||||
#include "client_menu.h"
|
||||
|
||||
integer () servlist_favorates_draw =
|
||||
{
|
||||
Draw_Pic (16, 4, Draw_CachePic ("gfx/qplaque.lmp", 1));
|
||||
Draw_CenterPic (160, 4, Draw_CachePic ("gfx/p_multi.lmp", 1));
|
||||
Draw_String (54, 40, "Under Construction");
|
||||
return 1;
|
||||
};
|
||||
|
||||
integer () servlist_all_draw =
|
||||
{
|
||||
Draw_Pic (16, 4, Draw_CachePic ("gfx/qplaque.lmp", 1));
|
||||
Draw_CenterPic (160, 4, Draw_CachePic ("gfx/p_multi.lmp", 1));
|
||||
Draw_String (54, 40, "Under Construction");
|
||||
return 1;
|
||||
};
|
||||
|
||||
integer serv_nfull;
|
||||
integer serv_nempty;
|
||||
inputline_t serv_maxping;
|
||||
inputline_t serv_game;
|
||||
|
||||
integer () servlist_filter_draw =
|
||||
{
|
||||
Draw_Pic (16, 4, Draw_CachePic ("gfx/qplaque.lmp", 1));
|
||||
Draw_CenterPic (160, 4, Draw_CachePic ("gfx/p_multi.lmp", 1));
|
||||
Draw_String (62, 40, "Max Ping........:");
|
||||
text_box (206, 32, 4, 1);
|
||||
InputLine_Draw (serv_maxping, 206, 40, 1);
|
||||
Draw_String (62, 56, "Game Contains...:");
|
||||
text_box (206, 48, 8, 1);
|
||||
Draw_String (62, 72, "Server Not Full.:");
|
||||
Draw_String (206, 72, ((serv_nfull == 0)?"No":"Yes"));
|
||||
Draw_String (62, 88, "Server Not Empty:");
|
||||
Draw_String (206, 88, ((serv_nempty == 0)?"No":"Yes"));
|
||||
Draw_String (62, 96, "Under Construction");
|
||||
opt_cursor (54, (Menu_GetIndex() * 16) + 40);
|
||||
return 1;
|
||||
};
|
||||
|
||||
void () servlist_favorates_menu =
|
||||
{
|
||||
Menu_Begin (54, 40, "favorates");
|
||||
Menu_FadeScreen (1);
|
||||
Menu_CenterPic (160, 4, "gfx/p_multi.lmp");
|
||||
Menu_Draw (servlist_favorates_draw);
|
||||
Menu_End ();
|
||||
};
|
||||
|
||||
void () servlist_all_menu =
|
||||
{
|
||||
Menu_Begin (54, 48, "all");
|
||||
Menu_FadeScreen (1);
|
||||
Menu_CenterPic (160, 4, "gfx/p_multi.lmp");
|
||||
Menu_Draw (servlist_all_draw);
|
||||
Menu_End ();
|
||||
};
|
||||
|
||||
integer (string text, integer key) sl_filter_in =
|
||||
{
|
||||
load_keybindings();
|
||||
switch (text) {
|
||||
case "isnfull":
|
||||
serv_nfull ^= 1;
|
||||
break;
|
||||
case "isnempty":
|
||||
serv_nempty ^= 1;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
};
|
||||
|
||||
void () servlist_filter_menu =
|
||||
{
|
||||
Menu_Begin (54, 56, "filter");
|
||||
Menu_FadeScreen (1);
|
||||
Menu_CenterPic (160, 4, "gfx/p_multi.lmp");
|
||||
Menu_Item (62, 40, "ping", sl_filter_in, 0);
|
||||
Menu_Item (62, 48, "gametext", sl_filter_in, 0);
|
||||
Menu_Item (62, 56, "isnfull", sl_filter_in, 0);
|
||||
Menu_Item (62, 64, "isnempty", sl_filter_in, 0);
|
||||
Menu_Draw (servlist_filter_draw);
|
||||
Menu_End ();
|
||||
};
|
||||
|
||||
void () server_list_menu =
|
||||
{
|
||||
serv_maxping = InputLine_Create (4, 8, ' ');
|
||||
InputLine_SetWidth (serv_maxping, 5);
|
||||
|
||||
Menu_Begin (54, 52, "");
|
||||
Menu_FadeScreen (1);
|
||||
Menu_Pic (16, 4, "gfx/qplaque.lmp");
|
||||
Menu_CenterPic (160, 4, "gfx/p_multi.lmp");
|
||||
servlist_favorates_menu ();
|
||||
servlist_all_menu ();
|
||||
servlist_filter_menu ();
|
||||
Menu_End ();
|
||||
};
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
#ifndef __string_h
|
||||
#define __string_h
|
||||
|
||||
@extern string (integer old, integer new, string str) String_ReplaceChar;
|
||||
@extern string (integer pos, integer len, string str) String_Cut;
|
||||
@extern integer (string str) String_Len;
|
||||
@extern integer (string str, integer pos) String_GetChar;
|
||||
|
||||
#endif
|
|
@ -1,6 +0,0 @@
|
|||
#include "string.h"
|
||||
|
||||
string (integer old, integer new, string str) String_ReplaceChar = #0;
|
||||
string (integer pos, integer len, string str) String_Cut = #0;
|
||||
integer (string str) String_Len = #0;
|
||||
integer (string str, integer pos) String_GetChar = #0;
|
|
@ -1,12 +0,0 @@
|
|||
#ifndef __stringh_h
|
||||
#define __stringh_h
|
||||
|
||||
@extern integer () StringHash_Create;
|
||||
@extern integer (integer hashid) StringHash_Destroy;
|
||||
@extern integer (integer hashid, string key, string value, integer value_id) StringHash_Set;
|
||||
@extern string (integer hashid, string key, integer value_id) StringHash_Get;
|
||||
@extern integer (integer hashid) StringHash_Length;
|
||||
@extern string (integer hashid, integer idx, integer value_id) StringHash_GetIdx;
|
||||
@extern integer (integer hashid, integer idx, string value, integer value_id) StringHash_SetIdx;
|
||||
|
||||
#endif//__stringh_h
|
|
@ -1,9 +0,0 @@
|
|||
#include "stringh.h"
|
||||
|
||||
integer () StringHash_Create = #0;
|
||||
integer (integer hashid) StringHash_Destroy = #0;
|
||||
integer (integer hashid, string key, string value, integer value_id) StringHash_Set = #0;
|
||||
string (integer hashid, string key, integer value_id) StringHash_Get = #0;
|
||||
integer (integer hashid) StringHash_Length = #0;
|
||||
string (integer hashid, integer idx, integer value_id) StringHash_GetIdx = #0;
|
||||
integer (integer hashid, integer idx, string value, integer value_id) StringHash_SetIdx = #0;
|
|
@ -1 +1 @@
|
|||
SUBDIRS= include lib game
|
||||
SUBDIRS= include lib game cl_menu
|
||||
|
|
Loading…
Reference in a new issue