From: res Date: Thu, 3 Jan 2008 17:54:30 +0000 (+0000) Subject: Provide 'ascii' key input to CSQC. X-Git-Tag: xonotic-v0.1.0preview~2599 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=324c5b1caa9722e7da51a097880d7c1417a74361;p=xonotic%2Fdarkplaces.git Provide 'ascii' key input to CSQC. git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@7896 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/csprogs.c b/csprogs.c index 9211626e..2b7e10de 100644 --- a/csprogs.c +++ b/csprogs.c @@ -230,9 +230,10 @@ qboolean CSQC_AddRenderEdict(prvm_edict_t *ed) return true; } -qboolean CL_VM_InputEvent (qboolean down, int key) +qboolean CL_VM_InputEvent (qboolean down, int key, int ascii) { qboolean r; + prvm_eval_t* val; if(!cl.csqc_loaded) return false; CSQC_BEGIN @@ -243,6 +244,8 @@ qboolean CL_VM_InputEvent (qboolean down, int key) prog->globals.client->time = cl.time; PRVM_G_FLOAT(OFS_PARM0) = !down; // 0 is down, 1 is up PRVM_G_FLOAT(OFS_PARM1) = key; + if ((val = PRVM_GLOBALFIELDVALUE(prog->globaloffsets.input_ascii))) + val->_float = ascii; PRVM_ExecuteProgram(prog->funcoffsets.CSQC_InputEvent, "QC function CSQC_InputEvent is missing"); r = CSQC_RETURNVAL; } diff --git a/progsvm.h b/progsvm.h index 6c780936..178f3d81 100644 --- a/progsvm.h +++ b/progsvm.h @@ -35,7 +35,7 @@ The code uses void pointers instead. #ifdef SUPPORT_GECKO // forward declaration of clgecko_t -typedef struct clgecko_s clgecko_t; +struct clgecko_s; #endif typedef struct prvm_stack_s @@ -252,6 +252,7 @@ typedef struct prvm_prog_globaloffsets_s int dmg_origin; // csqc int sb_showscores; // csqc int drawfont; // csqc / menu + int input_ascii; // csqc } prvm_prog_globaloffsets_t; @@ -354,7 +355,7 @@ typedef struct prvm_prog_s qfile_t *openfiles[PRVM_MAX_OPENFILES]; fssearch_t *opensearches[PRVM_MAX_OPENSEARCHES]; #ifdef SUPPORT_GECKO - clgecko_t *opengeckoinstances[PRVM_MAX_GECKOINSTANCES]; + struct clgecko_s *opengeckoinstances[PRVM_MAX_GECKOINSTANCES]; #endif // copies of some vars that were former read from sv diff --git a/prvm_edict.c b/prvm_edict.c index f752f9e7..04a01790 100644 --- a/prvm_edict.c +++ b/prvm_edict.c @@ -1463,6 +1463,7 @@ void PRVM_FindOffsets(void) prog->globaloffsets.dmg_origin = PRVM_ED_FindGlobalOffset("dmg_origin"); prog->globaloffsets.sb_showscores = PRVM_ED_FindGlobalOffset("sb_showscores"); prog->globaloffsets.drawfont = PRVM_ED_FindGlobalOffset("drawfont"); + prog->globaloffsets.input_ascii = PRVM_ED_FindGlobalOffset("input_ascii"); // menu qc only uses some functions, nothing else prog->funcoffsets.m_draw = PRVM_ED_FindFunctionOffset("m_draw");