From 40e987c071adba4f9da6be4fe9644775b310b949 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Wed, 30 Jan 2002 21:25:00 +0000 Subject: [PATCH] provide InputLine_SetWidth so the drawn width can be set --- cs-code/inputline_def.qc | 3 ++- libs/gamecode/builtins/bi_inputline.c | 15 +++++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/cs-code/inputline_def.qc b/cs-code/inputline_def.qc index 6b484feca..eb69f6731 100644 --- a/cs-code/inputline_def.qc +++ b/cs-code/inputline_def.qc @@ -1,6 +1,7 @@ struct _inputline_t = {}; // opaque type :) typedef _inputline_t [] inputline_t; -inputline_t (integer lines, integer width, integer prompt) InputLine_Create = #0; +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; diff --git a/libs/gamecode/builtins/bi_inputline.c b/libs/gamecode/builtins/bi_inputline.c index beda39b58..6abad3a67 100644 --- a/libs/gamecode/builtins/bi_inputline.c +++ b/libs/gamecode/builtins/bi_inputline.c @@ -59,7 +59,7 @@ bi_InputLine_Create (progs_t *pr) inputline_t **line = 0; int i; int lines = G_INT (pr, OFS_PARM0); - int width = G_INT (pr, OFS_PARM1); + int size = G_INT (pr, OFS_PARM1); int prompt = G_INT (pr, OFS_PARM2); pr_type_t *handle; @@ -72,7 +72,7 @@ bi_InputLine_Create (progs_t *pr) G_INT (pr, OFS_RETURN) = 0; return; } - *line = Con_CreateInputLine (lines, width, prompt); + *line = Con_CreateInputLine (lines, size, prompt); if (!*line) { G_INT (pr, OFS_RETURN) = 0; return; @@ -82,6 +82,16 @@ bi_InputLine_Create (progs_t *pr) G_INT (pr, OFS_RETURN) = handle - pr->pr_globals; } +static void +bi_InputLine_SetWidth (progs_t *pr) +{ + pr_type_t *handle = pr->pr_globals + G_INT (pr, OFS_PARM0); + inputline_t *line = *(inputline_t **)handle; + int width = G_INT (pr, OFS_PARM1); + + line->width = width; +} + static void bi_InputLine_Destroy (progs_t *pr) { @@ -162,6 +172,7 @@ InputLine_Progs_Init (progs_t *pr) PR_Resources_Register (pr, "InputLine", res, bi_il_clear); PR_AddBuiltin (pr, "InputLine_Create", bi_InputLine_Create, -1); + PR_AddBuiltin (pr, "InputLine_SetWidth", bi_InputLine_SetWidth, -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);