]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - vid_shared.c
console parsing now behaves like qwcl, thanks to Fuh for pointing out the problems...
[xonotic/darkplaces.git] / vid_shared.c
index 1a8d0f170cc714bf19f5402779d1b91da93b5177..7589a181153efabea9eea452d302d7070d716459 100644 (file)
@@ -50,7 +50,7 @@ int vid_activewindow = true;
 int vid_allowhwgamma = false;
 
 // we don't know until we try it!
-int vid_hardwaregammasupported = true;
+cvar_t vid_hardwaregammasupported = {CVAR_READONLY,"vid_hardwaregammasupported","1"};
 // whether hardware gamma ramps are currently in effect
 int vid_usinghwgamma = false;
 
@@ -519,6 +519,27 @@ void IN_PostMove(void)
        CL_AdjustAngles();
 }
 
+/*
+===========
+IN_DoMove
+===========
+*/
+void IN_ProcessMove(usercmd_t *cmd)
+{
+       // get basic movement from keyboard
+       CL_BaseMove(cmd);
+
+       // OS independent code
+       IN_PreMove();
+
+       // allow mice or other external controllers to add to the move
+       IN_Move(cmd);
+
+       // OS independent code
+       IN_PostMove();
+}
+
+
 void IN_Mouse(usercmd_t *cmd, float mx, float my)
 {
        int mouselook = (in_mlook.state & 1) || freelook.integer;
@@ -539,12 +560,12 @@ 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 
+       // AK: eveything else is client stuff
        // BTW, this should be seperated somewhen
-       if(!in_client_mouse) 
+       if(!in_client_mouse)
                return;
 
        // LordHavoc: viewzoom affects mouse sensitivity for sniping
@@ -605,7 +626,7 @@ void VID_UpdateGamma(qboolean force)
                if (!vid_usinghwgamma)
                {
                        vid_usinghwgamma = true;
-                       vid_hardwaregammasupported = VID_GetGamma(vid_systemgammaramps);
+                       Cvar_SetValueQuick(&vid_hardwaregammasupported, VID_GetGamma(vid_systemgammaramps));
                }
 
                BOUNDCVAR(v_gamma, 0.1, 5);cachegamma = v_gamma.value;
@@ -636,14 +657,14 @@ void VID_UpdateGamma(qboolean force)
                        BuildGammaTable16(1.0f, cachegamma, cachecontrast, cachebrightness, vid_gammaramps + 512);
                }
 
-               vid_hardwaregammasupported = VID_SetGamma(vid_gammaramps);
+               Cvar_SetValueQuick(&vid_hardwaregammasupported, VID_SetGamma(vid_gammaramps));
        }
        else
        {
                if (vid_usinghwgamma)
                {
                        vid_usinghwgamma = false;
-                       vid_hardwaregammasupported = VID_SetGamma(vid_systemgammaramps);
+                       Cvar_SetValueQuick(&vid_hardwaregammasupported, VID_SetGamma(vid_systemgammaramps));
                }
        }
 }
@@ -659,6 +680,7 @@ void VID_RestoreSystemGamma(void)
 
 void VID_Shared_Init(void)
 {
+       Cvar_RegisterVariable(&vid_hardwaregammasupported);
        Cvar_RegisterVariable(&v_gamma);
        Cvar_RegisterVariable(&v_brightness);
        Cvar_RegisterVariable(&v_contrast);
@@ -729,8 +751,14 @@ static void VID_CloseSystems(void)
        R_Modules_Shutdown();
 }
 
+int vid_commandlinecheck = true;
+
 void VID_Restart_f(void)
 {
+       // don't crash if video hasn't started yet
+       if (vid_commandlinecheck)
+               return;
+
        Con_Printf("VID_Restart: changing from %s %dx%dx%dbpp, to %s %dx%dx%dbpp.\n",
                current_vid_fullscreen ? "fullscreen" : "window", current_vid_width, current_vid_height, current_vid_bitsperpixel,
                vid_fullscreen.integer ? "fullscreen" : "window", vid_width.integer, vid_height.integer, vid_bitsperpixel.integer);
@@ -744,7 +772,6 @@ void VID_Restart_f(void)
        VID_OpenSystems();
 }
 
-int vid_commandlinecheck = true;
 void VID_Open(void)
 {
        int i, width, height;