mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 07:11:41 +00:00
start implementing the api for input lines and clean up a couple csqc
prototype issues.
This commit is contained in:
parent
68637eea9e
commit
85588c8fcb
12 changed files with 100 additions and 13 deletions
7
cs-code/inputline_def.qc
Normal file
7
cs-code/inputline_def.qc
Normal file
|
@ -0,0 +1,7 @@
|
|||
struct _inputline_t = {}; // opaque type :)
|
||||
typedef _inputline_t [] inputline_t;
|
||||
inputline_t (integer lines, integer width, integer prompt) InputLine_Create = #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;
|
|
@ -309,6 +309,8 @@ 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;
|
||||
|
||||
integer () join_draw =
|
||||
{
|
||||
|
@ -443,6 +445,8 @@ void () main_menu =
|
|||
|
||||
void () menu_init =
|
||||
{
|
||||
lanConfig_port_il = InputLine_Create (4, 8, ' ');
|
||||
lanConfig_join_il = InputLine_Create (4, 24, ' ');
|
||||
switch (gametype ()) {
|
||||
case "netquake":
|
||||
do_single_player = 1;
|
||||
|
|
|
@ -3,6 +3,7 @@ menu.dat
|
|||
@srcdir@/cbuf_def.qc
|
||||
@srcdir@/draw_def.qc
|
||||
@srcdir@/file_def.qc
|
||||
@srcdir@/inputline_def.qc
|
||||
@srcdir@/menu_def.qc
|
||||
@srcdir@/string_def.qc
|
||||
|
||||
|
|
|
@ -65,8 +65,6 @@ void Cbuf_Execute (void);
|
|||
// Normally called once per frame, but may be explicitly invoked.
|
||||
// Do not call inside a command function!
|
||||
|
||||
struct progs_s;
|
||||
void Cbuf_Progs_Init (struct progs_s *pr);
|
||||
|
||||
//===========================================================================
|
||||
|
||||
|
|
|
@ -36,7 +36,9 @@ void BI_Init ();
|
|||
|
||||
struct progs_s;
|
||||
|
||||
void Cbuf_Progs_Init (struct progs_s *pr);
|
||||
void File_Progs_Init (struct progs_s *pr);
|
||||
void InputLine_Progs_Init (struct progs_s *pr);
|
||||
void String_Progs_Init (struct progs_s *pr);
|
||||
|
||||
#endif//__QF_csqc_h
|
||||
|
|
|
@ -332,6 +332,7 @@ Menu_Init (void)
|
|||
|
||||
Cbuf_Progs_Init (&menu_pr_state);
|
||||
File_Progs_Init (&menu_pr_state);
|
||||
InputLine_Progs_Init (&menu_pr_state);
|
||||
String_Progs_Init (&menu_pr_state);
|
||||
PR_Cmds_Init (&menu_pr_state);
|
||||
R_Progs_Init (&menu_pr_state);
|
||||
|
|
|
@ -8,4 +8,4 @@ libQFgamecode_builtins_la_LDFLAGS= -version-info 1:0:0
|
|||
libQFgamecode_builtins_la_SOURCES= pr_cmds.c
|
||||
|
||||
libQFcsqc_la_LDFLAGS= -version-info 1:0:0
|
||||
libQFcsqc_la_SOURCES= bi_init.c bi_cbuf.c bi_file.c bi_string.c
|
||||
libQFcsqc_la_SOURCES= bi_init.c bi_cbuf.c bi_file.c bi_inputline.c bi_string.c
|
||||
|
|
|
@ -43,8 +43,6 @@ static const char rcsid[] =
|
|||
#include "QF/vfs.h"
|
||||
#include "QF/zone.h"
|
||||
|
||||
#define RETURN_STRING(p, s) ((p)->pr_globals[OFS_RETURN].integer_var = PR_SetString((p), s))
|
||||
|
||||
#define MAX_HANDLES 20
|
||||
static VFile *handles[MAX_HANDLES];
|
||||
|
||||
|
|
|
@ -30,10 +30,13 @@ static const char rcsid[] =
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
#include "QF/cmd.h"
|
||||
#include "QF/csqc.h"
|
||||
#include "QF/progs.h"
|
||||
|
||||
static void (*const cbuf_progs_init)(struct progs_s *) = Cbuf_Progs_Init;
|
||||
static void (*const file_progs_init)(struct progs_s *) = File_Progs_Init;
|
||||
static void (*const inputline_progs_init)(struct progs_s *) = InputLine_Progs_Init;
|
||||
static void (*const string_progs_init)(struct progs_s *) = String_Progs_Init;
|
||||
|
||||
void
|
||||
BI_Init ()
|
||||
|
|
78
libs/gamecode/builtins/bi_inputline.c
Normal file
78
libs/gamecode/builtins/bi_inputline.c
Normal file
|
@ -0,0 +1,78 @@
|
|||
/*
|
||||
bi_inputline.c
|
||||
|
||||
CSQC inputline builtins
|
||||
|
||||
Copyright (C) 1996-1997 Id Software, Inc.
|
||||
|
||||
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
|
||||
|
||||
*/
|
||||
static const char rcsid[] =
|
||||
"$Id$";
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STRING_H
|
||||
# include "string.h"
|
||||
#endif
|
||||
#ifdef HAVE_STRINGS_H
|
||||
# include "strings.h"
|
||||
#endif
|
||||
|
||||
#include "QF/console.h"
|
||||
#include "QF/progs.h"
|
||||
#include "QF/zone.h"
|
||||
|
||||
static void
|
||||
bi_InputLine_Create (progs_t *pr)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
bi_InputLine_Destroy (progs_t *pr)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
bi_InputLine_Clear (progs_t *pr)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
bi_InputLine_Process (progs_t *pr)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
bi_InputLine_Draw (progs_t *pr)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
InputLine_Progs_Init (progs_t *pr)
|
||||
{
|
||||
PR_AddBuiltin (pr, "InputLine_Create", bi_InputLine_Create, -1);
|
||||
PR_AddBuiltin (pr, "InputLine_Destroy", bi_InputLine_Destroy, -1);
|
||||
PR_AddBuiltin (pr, "InputLine_Clear", bi_InputLine_Clear, -1);
|
||||
PR_AddBuiltin (pr, "InputLine_Process", bi_InputLine_Process, -1);
|
||||
PR_AddBuiltin (pr, "InputLine_Draw", bi_InputLine_Draw, -1);
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
bi_cbuf.c
|
||||
bi_string.c
|
||||
|
||||
CSQC cbuf builtins
|
||||
CSQC string builtins
|
||||
|
||||
Copyright (C) 1996-1997 Id Software, Inc.
|
||||
|
||||
|
@ -41,8 +41,6 @@ static const char rcsid[] =
|
|||
#include "QF/progs.h"
|
||||
#include "QF/zone.h"
|
||||
|
||||
#define RETURN_STRING(p, s) ((p)->pr_globals[OFS_RETURN].integer_var = PR_SetString((p), s))
|
||||
|
||||
static void
|
||||
bi_String_ReplaceChar (progs_t *pr)
|
||||
{
|
||||
|
|
|
@ -40,9 +40,6 @@ static const char rcsid[] =
|
|||
#include <QF/progs.h>
|
||||
#include <QF/zone.h>
|
||||
|
||||
#define RETURN_EDICT(p, e) ((p)->pr_globals[OFS_RETURN].integer_var = EDICT_TO_PROG(p, e))
|
||||
#define RETURN_STRING(p, s) ((p)->pr_globals[OFS_RETURN].integer_var = PR_SetString((p), s))
|
||||
|
||||
int *read_result; //FIXME: eww
|
||||
|
||||
static void
|
||||
|
|
Loading…
Reference in a new issue