Added 2(3) builtin functions.
authorblack <black@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 30 Oct 2003 12:49:30 +0000 (12:49 +0000)
committerblack <black@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 30 Oct 2003 12:49:30 +0000 (12:49 +0000)
Changed the 2d mouse code, so that the relative coords are mapped into the console coord system (mouse speed is always the same in the menu qc).

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@3615 d7cf8633-e32d-0410-b094-e92efae38249

prvm_cmds.c
vid_shared.c

index a9ce8ac..cc3e46b 100644 (file)
@@ -86,6 +86,8 @@ float gettime()
                loadfromdata(string data)
                loadfromfile(string file)
 float  mod(float val, float m)
+const string   str_cvar (string)
+               crash()
                
 perhaps only : Menu : WriteMsg 
 ===============================
@@ -662,6 +664,35 @@ void VM_cvar (void)
 
 /*
 =================
+VM_str_cvar
+
+const string   str_cvar (string)
+=================
+*/
+void VM_str_cvar(void) 
+{
+       char *out, *name;
+       const char *cvar_string;
+       VM_SAFEPARMCOUNT(1,VM_str_cvar);
+
+       name = PRVM_G_STRING(OFS_PARM0);
+
+       if(!name)
+               PRVM_ERROR("VM_str_cvar: %s: null string\n", PRVM_NAME);
+
+       VM_CheckEmptyString(name);
+
+       out = VM_GetTempString(); 
+
+       cvar_string = Cvar_VariableString(name);
+       
+       strcpy(out, cvar_string);
+
+       PRVM_G_INT(OFS_PARM0) = PRVM_SetString(out);
+}
+
+/*
+=================
 VM_cvar_set
 
 void cvar_set (string,string)
@@ -1083,6 +1114,21 @@ void VM_coredump (void)
 
 /*
 =========
+VM_crash
+
+crash()
+=========
+*/
+
+void VM_crash(void) 
+{
+       VM_SAFEPARMCOUNT(0, VM_crash);
+
+       PRVM_ERROR("Crash called by %s\n",PRVM_NAME);
+}
+
+/*
+=========
 VM_traceon
 
 traceon()
@@ -2079,6 +2125,32 @@ void VM_clientstate(void)
 
 /*
 =========
+VM_getostype
+
+float  getostype(void)
+=========
+*/ // not used at the moment -> not included in the common list
+void VM_getostype(void)
+{
+       VM_SAFEPARMCOUNT(0,VM_getostype);
+
+       /*
+       OS_WINDOWS
+       OS_LINUX
+       OS_MAC - not supported
+       */
+
+#ifdef _WIN32
+       PRVM_G_FLOAT(OFS_RETURN) = 0;
+#elif defined _MAC
+       PRVM_G_FLOAT(OFS_RETURN) = 2;
+#else
+       PRVM_G_FLOAT(OFS_RETURN) = 1;
+#endif
+}
+
+/*
+=========
 VM_getmousepos
 
 vector getmousepos()
@@ -2788,7 +2860,9 @@ prvm_builtin_t vm_m_builtins[] = {
        VM_loadfromdata,
        VM_loadfromfile,
        VM_modulo,              // 70
-       e10,                    // 80
+       VM_str_cvar,    
+       VM_crash,               // 72
+       0,0,0,0,0,0,0,0,// 80
        e10,                    // 90
        e10,                    // 100
        e100,                   // 200
index b77fe6b..55c7562 100644 (file)
@@ -560,8 +560,8 @@ void IN_Mouse(usercmd_t *cmd, float mx, float my)
        old_mouse_x = mx;
        old_mouse_y = my;
 
-       in_mouse_x = mouse_x;
-       in_mouse_y = mouse_y;
+       in_mouse_x = (float) mouse_x * vid.conwidth / vid.realwidth;
+       in_mouse_y = (float) mouse_y * vid.conheight / vid.realheight;
 
        // AK: eveything else is client stuff 
        // BTW, this should be seperated somewhen