]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - csprogs.c
fix bugs with CSQC clearscene function - it now restores the view to
[xonotic/darkplaces.git] / csprogs.c
index 69483ae1961afd78955f11da1874629639f82087..8181505b4f403a62e5daa6be6b73212830bd6a3f 100644 (file)
--- a/csprogs.c
+++ b/csprogs.c
@@ -464,6 +464,7 @@ qboolean CL_VM_InputEvent (int eventtype, int x, int y)
        return r;
 }
 
+extern r_refdef_view_t csqc_original_r_refdef_view;
 qboolean CL_VM_UpdateView (void)
 {
        vec3_t emptyvector;
@@ -475,6 +476,7 @@ qboolean CL_VM_UpdateView (void)
                return false;
        R_TimeReport("pre-UpdateView");
        CSQC_BEGIN
+               csqc_original_r_refdef_view = r_refdef.view;
                //VectorCopy(cl.viewangles, oldangles);
                PRVM_clientglobalfloat(time) = cl.time;
                PRVM_clientglobaledict(self) = cl.csqc_server2csqcentitynumber[cl.playerentity];
@@ -490,6 +492,7 @@ qboolean CL_VM_UpdateView (void)
                //VectorCopy(oldangles, cl.viewangles);
                // Dresk : Reset Dmg Globals Here
                CL_VM_UpdateDmgGlobals(0, 0, emptyvector);
+               r_refdef.view = csqc_original_r_refdef_view;
        CSQC_END
        R_TimeReport("UpdateView");
        return true;
@@ -706,7 +709,7 @@ void CL_VM_UpdateShowingScoresState (int showingscores)
                CSQC_END
        }
 }
-qboolean CL_VM_Event_Sound(int sound_num, float volume, int channel, float attenuation, int ent, vec3_t pos)
+qboolean CL_VM_Event_Sound(int sound_num, float volume, int channel, float attenuation, int ent, vec3_t pos, int flags, float speed)
 {
        qboolean r = false;
        if(cl.csqc_loaded)
@@ -722,8 +725,8 @@ qboolean CL_VM_Event_Sound(int sound_num, float volume, int channel, float atten
                        PRVM_G_FLOAT(OFS_PARM3) = volume;
                        PRVM_G_FLOAT(OFS_PARM4) = attenuation;
                        VectorCopy(pos, PRVM_G_VECTOR(OFS_PARM5) );
-                       PRVM_G_FLOAT(OFS_PARM6) = 0; // pitch shift not supported yet
-                       PRVM_G_FLOAT(OFS_PARM7) = 0; // flags - none can come in at this point yet
+                       PRVM_G_FLOAT(OFS_PARM6) = speed * 100.0f;
+                       PRVM_G_FLOAT(OFS_PARM7) = flags; // flags
                        PRVM_ExecuteProgram(PRVM_clientfunction(CSQC_Event_Sound), "QC function CSQC_Event_Sound is missing");
                        r = CSQC_RETURNVAL != 0;
                }