]> de.git.xonotic.org Git - voretournament/voretournament.git/commitdiff
Fix camera angles not getting stuck with the latest engine. With this occasion, also...
authorMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Wed, 1 Feb 2012 12:41:39 +0000 (14:41 +0200)
committerMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Wed, 1 Feb 2012 12:41:39 +0000 (14:41 +0200)
data/qcsrc/client/View.qc
data/qcsrc/client/csqc_builtins.qc
docs/TODO.txt

index 1a3cf5cafbda48362fac9c986139b6bceb5684b0..33a38f082ab1ae4af581f2da597405c785bb1a3e 100644 (file)
@@ -244,7 +244,6 @@ void PostInit(void);
 void CSQC_Demo_Camera();\r
 float Sbar_WouldDrawScoreboard ();\r
 float last_health, last_spectatee;\r
-float view_set;\r
 float camera_mode;\r
 float reticle_type;\r
 float chase_active_old;\r
@@ -257,6 +256,7 @@ float old_blurradius, old_bluralpha, old_cartoon_intensity;
 float stomachsplash_alpha;\r
 float eventchase_current_distance;\r
 float helper_pause, helper_health, helper_armor, helper_ammo, helper_speed, helper_stomachload;\r
+vector freeze_org, freeze_ang;\r
 vector myhealth_gentlergb;\r
 vector liquidcolor_prev;\r
 vector damage_blurpostprocess, content_blurpostprocess;\r
@@ -381,10 +381,13 @@ void CSQC_UpdateView(float w, float h)
        // event chase camera\r
        if(cvar("chase_active") <= 0) // greater than 0 means it's enabled manually, and this code is skipped\r
        {\r
-               if(!getstati(STAT_VORE_EATEN) && spectatee_status >= 0 && (cvar("cl_eventchase_death") && getstati(STAT_HEALTH) <= 0 && !intermission))\r
+               if(spectatee_status >= 0 && (cvar("cl_eventchase_death") && getstati(STAT_HEALTH) <= 0 && !intermission) || intermission)\r
                {\r
+                       // make special vector since we can't use view_origin (It is one frame old as of this code, it gets set later with the results this code makes.)\r
+                       vector current_view_origin = getpropertyvec(VF_ORIGIN);\r
+                       \r
                        // We must enable chase_active to get a third person view (weapon viewmodel hidden and own player model showing).\r
-                       // Ideally, there should be another way to enable third person cameras, such as through R_SetView()\r
+                       // Ideally, there should be another way to enable third person cameras, such as through setproperty()\r
                        if(!cvar("chase_active"))\r
                                cvar_set("chase_active", "-1"); // -1 enables chase_active while marking it as set by this code, and not by the user (which would be 1)\r
 \r
@@ -397,15 +400,15 @@ void CSQC_UpdateView(float w, float h)
                        vector eventchase_target_origin;\r
                        makevectors(view_angles);\r
                        // pass 1, used to check where the camera would go and obtain the trace_fraction\r
-                       eventchase_target_origin = pmove_org - v_forward * eventchase_current_distance;\r
-\r
-                       traceline(pmove_org, eventchase_target_origin, MOVE_WORLDONLY, self);\r
+                       eventchase_target_origin = current_view_origin - v_forward * eventchase_current_distance;\r
+                       WarpZone_TraceLine(current_view_origin, eventchase_target_origin, MOVE_WORLDONLY, self);\r
                        // pass 2, also multiplying view_forward with trace_fraction, to prevent the camera from going through walls\r
                        // The 0.1 subtraction is to not limit the camera precisely at the wall surface, as that allows the view to poke through\r
-                       eventchase_target_origin = pmove_org - v_forward * eventchase_current_distance * (trace_fraction - 0.1);\r
+                       eventchase_target_origin = current_view_origin - v_forward * eventchase_current_distance * (trace_fraction - 0.1);\r
+                       WarpZone_TraceLine(current_view_origin, eventchase_target_origin, MOVE_WORLDONLY, self);\r
 \r
-                       R_SetView(VF_ORIGIN, eventchase_target_origin);\r
-                       R_SetView(VF_ANGLES, view_angles);\r
+                       setproperty(VF_ORIGIN, trace_endpos);\r
+                       setproperty(VF_ANGLES, WarpZone_TransformVAngles(WarpZone_trace_transform, view_angles));\r
                }\r
                else if(cvar("chase_active") < 0) // time to disable chase_active if it was set by this code\r
                {\r
@@ -444,18 +447,26 @@ void CSQC_UpdateView(float w, float h)
                        cvar_set("v_idlescale", ftos(apply_idlescale));\r
        }\r
 \r
-       // Render the Scene\r
-       if(!intermission || !view_set)\r
+       // do lockview after event chase camera so that it still applies whenever necessary.\r
+       if(intermission > 1)\r
+       {\r
+               setproperty(VF_ORIGIN, freeze_org);\r
+               setproperty(VF_ANGLES, freeze_ang);\r
+       }\r
+       else\r
        {\r
-               view_origin = pmove_org + vo;\r
-               view_angles = input_angles;\r
-               makevectors(view_angles);\r
-               view_forward = v_forward;\r
-               view_right = v_right;\r
-               view_up = v_up;\r
-               view_set = 1;\r
+               freeze_org = getpropertyvec(VF_ORIGIN);\r
+               freeze_ang = getpropertyvec(VF_ANGLES);\r
        }\r
 \r
+       // Render the Scene\r
+       view_origin = getpropertyvec(VF_ORIGIN);\r
+       view_angles = getpropertyvec(VF_ANGLES);\r
+       makevectors(view_angles);\r
+       view_forward = v_forward;\r
+       view_right = v_right;\r
+       view_up = v_up;\r
+\r
        vid_width = w;\r
        vid_height = h;\r
 \r
@@ -544,6 +555,12 @@ void CSQC_UpdateView(float w, float h)
        // ALWAYS Clear Current Scene First\r
        R_ClearScene();\r
 \r
+       if(checkextension("DP_CSQC_ROTATEMOVES"))\r
+       {\r
+               setproperty(VF_ORIGIN, view_origin);\r
+               setproperty(VF_ANGLES, view_angles);\r
+       }\r
+\r
        // Assign Standard Viewflags\r
        // Draw the World (and sky)\r
        R_SetView(VF_DRAWWORLD, 1);\r
index a582a9d0202fdb909dbc227b88b61ccf1337b537..9933b3ff61bc475393a8731e83b314216c89e44e 100644 (file)
@@ -83,6 +83,10 @@ void ()                                                                      R_RenderScene = #304;
 void (vector org, float radius, vector rgb)                            R_AddDynamicLight = #305;\r
 void ()                                                                        R_CalcRefDef = #306;\r
 \r
+float (float property, ...)                            setproperty = #303;\r
+float (float property)                         getproperty = #309;\r
+vector (float property)                                getpropertyvec = #309;\r
+\r
 vector (vector v)                                                      cs_unproject = #310;\r
 vector (vector v)                                                      cs_project = #311;\r
 \r
index 70e3f88f245e1499e798cf77cb73640e2fd4e060..857a6966bff974566e9f8a4b83b7546115aef2d9 100644 (file)
 \r
 - 0.7 BUG: Default player model is broken?\r
 \r
-- 0.7 BUG: With the latest engine, the view is no longer locked after match end, and you can still look around. See what changed in Xonotic and how to fix this.\r
-\r
 - 0.7 | 0.8: Make the volume of footstep sounds depend on player size.\r
 \r
 - 0.7: Is the proper blue color used in team games, with the new colormap?
\ No newline at end of file