]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
Provide 'ascii' key input to CSQC.
authorres <res@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 3 Jan 2008 17:54:30 +0000 (17:54 +0000)
committerres <res@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 3 Jan 2008 17:54:30 +0000 (17:54 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@7896 d7cf8633-e32d-0410-b094-e92efae38249

csprogs.c
progsvm.h
prvm_edict.c

index 9211626edc0034239af29faf7d99090f79351cb4..2b7e10de88000798f0eb46c1d24f5ad8d749bbdf 100644 (file)
--- 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;
                }
index 6c78093642603a9b0211f567a620523d913cc91a..178f3d815722f98e1a12cc875357f58bb0268046 100644 (file)
--- 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
index f752f9e743f3d7116e1d022088719bca0569ccce..04a01790610f5a9ad2cf139b39aa2fc58364cd6b 100644 (file)
@@ -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");