]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - clvm_cmds.c
Merge branch 'master' into Mario/wrath-darkplaces_extra
[xonotic/darkplaces.git] / clvm_cmds.c
index 88771af26d236b53e737eaf6b1502a43dac5f449..4d412bd9e3581369d8420522e04df052c13736e1 100644 (file)
@@ -590,12 +590,13 @@ static void VM_CL_checkbottom (prvm_prog_t *prog)
        vec3_t                  mins, maxs, start, stop;
        trace_t                 trace;
        int                             x, y;
-       float                   mid, bottom;
+       float                   mid, bottom, stepheight;
 
        VM_SAFEPARMCOUNT(1, VM_CL_checkbottom);
        ent = PRVM_G_EDICT(OFS_PARM0);
        PRVM_G_FLOAT(OFS_RETURN) = 0;
 
+       stepheight = sv_stepheight.value + PRVM_clientedictfloat(ent, stepheight_delta);
        VectorAdd (PRVM_clientedictvector(ent, origin), PRVM_clientedictvector(ent, mins), mins);
        VectorAdd (PRVM_clientedictvector(ent, origin), PRVM_clientedictvector(ent, maxs), maxs);
 
@@ -626,7 +627,7 @@ realcheck:
 // the midpoint must be within 16 of the bottom
        start[0] = stop[0] = (mins[0] + maxs[0])*0.5;
        start[1] = stop[1] = (mins[1] + maxs[1])*0.5;
-       stop[2] = start[2] - 2*sv_stepheight.value;
+       stop[2] = start[2] - 2*stepheight;
        trace = CL_TraceLine(start, stop, MOVE_NORMAL, ent, CL_GenericHitSuperContentsMask(ent), 0, 0, collision_extendmovelength.value, true, true, NULL, true, false);
 
        if (trace.fraction == 1.0)
@@ -645,7 +646,7 @@ realcheck:
 
                        if (trace.fraction != 1.0 && trace.endpos[2] > bottom)
                                bottom = trace.endpos[2];
-                       if (trace.fraction == 1.0 || mid - trace.endpos[2] > sv_stepheight.value)
+                       if (trace.fraction == 1.0 || mid - trace.endpos[2] > stepheight)
                                return;
                }
 
@@ -2402,7 +2403,7 @@ static void VM_CL_setlistener (prvm_prog_t *prog)
 static void VM_CL_registercmd (prvm_prog_t *prog)
 {
        VM_SAFEPARMCOUNT(1, VM_CL_registercmd);
-       if(!Cmd_Exists(&cmd_local, PRVM_G_STRING(OFS_PARM0)))
+       if(!Cmd_Exists(cmd_local, PRVM_G_STRING(OFS_PARM0)))
                Cmd_AddCommand(CF_CLIENT, PRVM_G_STRING(OFS_PARM0), NULL, "console command created by QuakeC");
 }
 
@@ -3706,12 +3707,12 @@ static void VM_CL_SpawnParticle (prvm_prog_t *prog)
        if (vmpartspawner.verified == false)
        {
                VM_Warning(prog, "VM_CL_SpawnParticle: particle spawner not initialized\n");
-               PRVM_G_FLOAT(OFS_RETURN) = 0; 
+               PRVM_G_FLOAT(OFS_RETURN) = 0;
                return;
        }
        VectorCopy(PRVM_G_VECTOR(OFS_PARM0), org);
        VectorCopy(PRVM_G_VECTOR(OFS_PARM1), dir);
-       
+
        if (prog->argc < 3) // global-set particle
        {
                part = CL_NewParticle(org,
@@ -3750,7 +3751,7 @@ static void VM_CL_SpawnParticle (prvm_prog_t *prog)
                        NULL);
                if (!part)
                {
-                       PRVM_G_FLOAT(OFS_RETURN) = 0; 
+                       PRVM_G_FLOAT(OFS_RETURN) = 0;
                        return;
                }
                if (PRVM_clientglobalfloat(particle_delayspawn))
@@ -3764,7 +3765,7 @@ static void VM_CL_SpawnParticle (prvm_prog_t *prog)
                if (themenum <= 0 || themenum >= vmpartspawner.max_themes)
                {
                        VM_Warning(prog, "VM_CL_SpawnParticle: bad theme number %i\n", themenum);
-                       PRVM_G_FLOAT(OFS_RETURN) = 0; 
+                       PRVM_G_FLOAT(OFS_RETURN) = 0;
                        return;
                }
                theme = &vmpartspawner.themes[themenum];
@@ -3804,7 +3805,7 @@ static void VM_CL_SpawnParticle (prvm_prog_t *prog)
                        NULL);
                if (!part)
                {
-                       PRVM_G_FLOAT(OFS_RETURN) = 0; 
+                       PRVM_G_FLOAT(OFS_RETURN) = 0;
                        return;
                }
                if (theme->delayspawn)
@@ -3812,7 +3813,7 @@ static void VM_CL_SpawnParticle (prvm_prog_t *prog)
                //if (theme->delaycollision)
                //      part->delayedcollisions = cl.time + theme->delaycollision;
        }
-       PRVM_G_FLOAT(OFS_RETURN) = 1; 
+       PRVM_G_FLOAT(OFS_RETURN) = 1;
 }
 
 // float(vector org, vector dir, float spawndelay, float collisiondelay, [float theme]) delayedparticle
@@ -3828,7 +3829,7 @@ static void VM_CL_SpawnParticleDelayed (prvm_prog_t *prog)
        if (vmpartspawner.verified == false)
        {
                VM_Warning(prog, "VM_CL_SpawnParticleDelayed: particle spawner not initialized\n");
-               PRVM_G_FLOAT(OFS_RETURN) = 0; 
+               PRVM_G_FLOAT(OFS_RETURN) = 0;
                return;
        }
        VectorCopy(PRVM_G_VECTOR(OFS_PARM0), org);
@@ -3874,7 +3875,7 @@ static void VM_CL_SpawnParticleDelayed (prvm_prog_t *prog)
                if (themenum <= 0 || themenum >= vmpartspawner.max_themes)
                {
                        VM_Warning(prog, "VM_CL_SpawnParticleDelayed: bad theme number %i\n", themenum);
-                       PRVM_G_FLOAT(OFS_RETURN) = 0;  
+                       PRVM_G_FLOAT(OFS_RETURN) = 0;
                        return;
                }
                theme = &vmpartspawner.themes[themenum];
@@ -3913,10 +3914,10 @@ static void VM_CL_SpawnParticleDelayed (prvm_prog_t *prog)
                        theme->spin,
                        NULL);
        }
-       if (!part) 
-       { 
-               PRVM_G_FLOAT(OFS_RETURN) = 0; 
-               return; 
+       if (!part)
+       {
+               PRVM_G_FLOAT(OFS_RETURN) = 0;
+               return;
        }
        part->delayedspawn = cl.time + PRVM_G_FLOAT(OFS_PARM2);
        //part->delayedcollisions = cl.time + PRVM_G_FLOAT(OFS_PARM3);
@@ -3952,7 +3953,7 @@ static void VM_CL_GetEntity (prvm_prog_t *prog)
                case 1: // origin
                        Matrix4x4_OriginFromMatrix(&cl.entities[entnum].render.matrix, org);
                        VectorCopy(org, PRVM_G_VECTOR(OFS_RETURN));
-                       break; 
+                       break;
                case 2: // forward
                        Matrix4x4_ToVectors(&cl.entities[entnum].render.matrix, forward, left, up, org);
                        VectorCopy(forward, PRVM_G_VECTOR(OFS_RETURN));
@@ -3967,17 +3968,17 @@ static void VM_CL_GetEntity (prvm_prog_t *prog)
                        break;
                case 5: // scale
                        PRVM_G_FLOAT(OFS_RETURN) = Matrix4x4_ScaleFromMatrix(&cl.entities[entnum].render.matrix);
-                       break;  
+                       break;
                case 6: // origin + v_forward, v_right, v_up
                        Matrix4x4_ToVectors(&cl.entities[entnum].render.matrix, forward, left, up, org);
                        VectorCopy(forward, PRVM_clientglobalvector(v_forward));
                        VectorNegate(left, PRVM_clientglobalvector(v_right));
                        VectorCopy(up, PRVM_clientglobalvector(v_up));
                        VectorCopy(org, PRVM_G_VECTOR(OFS_RETURN));
-                       break;  
+                       break;
                case 7: // alpha
                        PRVM_G_FLOAT(OFS_RETURN) = cl.entities[entnum].render.alpha;
-                       break;  
+                       break;
                case 8: // colormor
                        VectorCopy(cl.entities[entnum].render.colormod, PRVM_G_VECTOR(OFS_RETURN));
                        break;
@@ -3989,24 +3990,24 @@ static void VM_CL_GetEntity (prvm_prog_t *prog)
                        break;
                case 11: // skinnum
                        PRVM_G_FLOAT(OFS_RETURN) = cl.entities[entnum].render.skinnum;
-                       break;  
+                       break;
                case 12: // mins
-                       VectorCopy(cl.entities[entnum].render.mins, PRVM_G_VECTOR(OFS_RETURN));         
-                       break;  
+                       VectorCopy(cl.entities[entnum].render.mins, PRVM_G_VECTOR(OFS_RETURN));
+                       break;
                case 13: // maxs
-                       VectorCopy(cl.entities[entnum].render.maxs, PRVM_G_VECTOR(OFS_RETURN));         
-                       break;  
+                       VectorCopy(cl.entities[entnum].render.maxs, PRVM_G_VECTOR(OFS_RETURN));
+                       break;
                case 14: // absmin
                        Matrix4x4_OriginFromMatrix(&cl.entities[entnum].render.matrix, org);
-                       VectorAdd(cl.entities[entnum].render.mins, org, PRVM_G_VECTOR(OFS_RETURN));             
-                       break;  
+                       VectorAdd(cl.entities[entnum].render.mins, org, PRVM_G_VECTOR(OFS_RETURN));
+                       break;
                case 15: // absmax
                        Matrix4x4_OriginFromMatrix(&cl.entities[entnum].render.matrix, org);
-                       VectorAdd(cl.entities[entnum].render.maxs, org, PRVM_G_VECTOR(OFS_RETURN));             
+                       VectorAdd(cl.entities[entnum].render.maxs, org, PRVM_G_VECTOR(OFS_RETURN));
                        break;
                case 16: // light
                        VectorMA(cl.entities[entnum].render.render_modellight_ambient, 0.5, cl.entities[entnum].render.render_modellight_diffuse, PRVM_G_VECTOR(OFS_RETURN));
-                       break;  
+                       break;
                default:
                        PRVM_G_FLOAT(OFS_RETURN) = 0;
                        break;
@@ -4210,8 +4211,9 @@ static qbool CL_CheckBottom (prvm_edict_t *ent)
        vec3_t  mins, maxs, start, stop;
        trace_t trace;
        int             x, y;
-       float   mid, bottom;
+       float   mid, bottom, stepheight;
 
+       stepheight = sv_stepheight.value + PRVM_clientedictfloat(ent, stepheight_delta);
        VectorAdd (PRVM_clientedictvector(ent, origin), PRVM_clientedictvector(ent, mins), mins);
        VectorAdd (PRVM_clientedictvector(ent, origin), PRVM_clientedictvector(ent, maxs), maxs);
 
@@ -4239,7 +4241,7 @@ realcheck:
 // the midpoint must be within 16 of the bottom
        start[0] = stop[0] = (mins[0] + maxs[0])*0.5;
        start[1] = stop[1] = (mins[1] + maxs[1])*0.5;
-       stop[2] = start[2] - 2*sv_stepheight.value;
+       stop[2] = start[2] - 2*stepheight;
        trace = CL_TraceLine(start, stop, MOVE_NOMONSTERS, ent, CL_GenericHitSuperContentsMask(ent), 0, 0, collision_extendmovelength.value, true, false, NULL, true, false);
 
        if (trace.fraction == 1.0)
@@ -4257,7 +4259,7 @@ realcheck:
 
                        if (trace.fraction != 1.0 && trace.endpos[2] > bottom)
                                bottom = trace.endpos[2];
-                       if (trace.fraction == 1.0 || mid - trace.endpos[2] > sv_stepheight.value)
+                       if (trace.fraction == 1.0 || mid - trace.endpos[2] > stepheight)
                                return false;
                }
 
@@ -4276,13 +4278,15 @@ possible, no move is done and false is returned
 static qbool CL_movestep (prvm_edict_t *ent, vec3_t move, qbool relink, qbool noenemy, qbool settrace)
 {
        prvm_prog_t *prog = CLVM_prog;
-       float           dz;
+       float           dz, stepheight;
        vec3_t          oldorg, neworg, end, traceendpos;
        vec3_t          mins, maxs, start;
        trace_t         trace;
        int                     i, svent;
        prvm_edict_t            *enemy;
 
+       stepheight = sv_stepheight.value + PRVM_clientedictfloat(ent, stepheight_delta);
+
 // try the move
        VectorCopy(PRVM_clientedictvector(ent, mins), mins);
        VectorCopy(PRVM_clientedictvector(ent, maxs), maxs);
@@ -4330,9 +4334,9 @@ static qbool CL_movestep (prvm_edict_t *ent, vec3_t move, qbool relink, qbool no
        }
 
 // push down from a step height above the wished position
-       neworg[2] += sv_stepheight.value;
+       neworg[2] += stepheight;
        VectorCopy (neworg, end);
-       end[2] -= sv_stepheight.value*2;
+       end[2] -= stepheight*2;
 
        trace = CL_TraceBox(neworg, mins, maxs, end, MOVE_NORMAL, ent, CL_GenericHitSuperContentsMask(ent), 0, 0, collision_extendmovelength.value, true, true, &svent, true);
        if (settrace)
@@ -4340,7 +4344,7 @@ static qbool CL_movestep (prvm_edict_t *ent, vec3_t move, qbool relink, qbool no
 
        if (trace.startsolid)
        {
-               neworg[2] -= sv_stepheight.value;
+               neworg[2] -= stepheight;
                trace = CL_TraceBox(neworg, mins, maxs, end, MOVE_NORMAL, ent, CL_GenericHitSuperContentsMask(ent), 0, 0, collision_extendmovelength.value, true, true, &svent, true);
                if (settrace)
                        CL_VM_SetTraceGlobals(prog, &trace, svent);
@@ -4982,7 +4986,7 @@ NULL,                                                     // #42 (QUAKE)
 VM_fabs,                                               // #43 float(float f) fabs (QUAKE)
 NULL,                                                  // #44 vector(entity e, float speed) aim (QUAKE)
 VM_cvar,                                               // #45 float(string s) cvar (QUAKE)
-VM_localcmd_client,                            // #46 void(string s) localcmd (QUAKE)
+VM_localcmd_local,                             // #46 void(string s) localcmd (QUAKE)
 VM_nextent,                                            // #47 entity(entity e) nextent (QUAKE)
 VM_CL_particle,                                        // #48 void(vector o, vector d, float color, float count) particle (QUAKE)
 VM_changeyaw,                                  // #49 void() ChangeYaw (QUAKE)
@@ -5266,7 +5270,7 @@ VM_drawfill,                                      // #323 float(vector position, vector size, vector rgb, float a
 VM_drawsetcliparea,                            // #324 void(float x, float y, float width, float height) drawsetcliparea
 VM_drawresetcliparea,                  // #325 void(void) drawresetcliparea
 VM_drawcolorcodedstring,               // #326 float drawcolorcodedstring(vector position, string text, vector scale, vector rgb, float alpha, float flag) (EXT_CSQC)
-VM_stringwidth,                 // #327 // FIXME is this okay?
+VM_stringwidth,                                        // #327 // FIXME is this okay?
 VM_drawsubpic,                                 // #328 // FIXME is this okay?
 VM_drawrotpic,                                 // #329 // FIXME is this okay?
 VM_CL_getstatf,                                        // #330 float(float stnum) getstatf (EXT_CSQC)
@@ -5583,6 +5587,114 @@ VM_digest_hex,                                          // #639
 VM_CL_V_CalcRefdef,                                    // #640 void(entity e) V_CalcRefdef (DP_CSQC_V_CALCREFDEF)
 NULL,                                                  // #641
 VM_coverage,                                           // #642
+NULL,                                          // #643
+NULL,                                          // #644
+NULL,                                          // #645
+NULL,                                          // #646
+NULL,                                          // #647
+NULL,                                          // #648
+NULL,                                          // #649
+// WRATH range (#650-#???)
+VM_fcopy,                                      // #650 float(string fnfrom, string fnto) fcopy (EXT_WRATH)
+VM_frename,                                    // #651 float (string fnold, string fnnew) frename (EXT_WRATH)
+VM_fremove,                                    // #652 float (string fname) fremove (EXT_WRATH)
+VM_fexists,                                    // #653 float (string fname) fexists (EXT_WRATH)
+VM_rmtree,                                     // #654 float (string path) rmtree (EXT_WRATH)
+NULL,                                          // #655
+NULL,                                          // #656
+NULL,                                          // #657
+NULL,                                          // #658
+NULL,                                          // #659
+NULL,                                          // #660
+NULL,                                          // #661
+NULL,                                          // #662
+NULL,                                          // #663
+NULL,                                          // #664
+NULL,                                          // #665
+NULL,                                          // #666
+NULL,                                          // #667
+NULL,                                          // #668
+NULL,                                          // #669
+NULL,                                          // #670
+NULL,                                          // #671
+NULL,                                          // #672
+NULL,                                          // #673
+NULL,                                          // #674
+NULL,                                          // #675
+NULL,                                          // #676
+NULL,                                          // #677
+NULL,                                          // #678
+NULL,                                          // #679
+NULL,                                          // #680
+NULL,                                          // #681
+NULL,                                          // #682
+NULL,                                          // #683
+NULL,                                          // #684
+NULL,                                          // #685
+NULL,                                          // #686
+NULL,                                          // #687
+NULL,                                          // #688
+NULL,                                          // #689
+NULL,                                          // #690
+NULL,                                          // #691
+NULL,                                          // #692
+NULL,                                          // #693
+NULL,                                          // #694
+NULL,                                          // #695
+NULL,                                          // #696
+NULL,                                          // #697
+NULL,                                          // #698
+NULL,                                          // #699
+NULL,                                          // #700
+NULL,                                          // #701
+NULL,                                          // #702
+NULL,                                          // #703
+NULL,                                          // #704
+NULL,                                          // #705
+NULL,                                          // #706
+NULL,                                          // #707
+NULL,                                          // #708
+NULL,                                          // #709
+NULL,                                          // #710
+NULL,                                          // #711
+NULL,                                          // #712
+NULL,                                          // #713
+NULL,                                          // #714
+NULL,                                          // #715
+NULL,                                          // #716
+NULL,                                          // #717
+NULL,                                          // #718
+NULL,                                          // #719
+NULL,                                          // #720
+NULL,                                          // #721
+NULL,                                          // #722
+NULL,                                          // #723
+NULL,                                          // #724
+NULL,                                          // #725
+NULL,                                          // #726
+NULL,                                          // #727
+NULL,                                          // #728
+NULL,                                          // #729
+NULL,                                          // #730
+NULL,                                          // #731
+NULL,                                          // #732
+NULL,                                          // #733
+NULL,                                          // #734
+NULL,                                          // #735
+NULL,                                          // #736
+NULL,                                          // #737
+NULL,                                          // #738
+NULL,                                          // #739
+NULL,                                          // #740
+NULL,                                          // #741
+NULL,                                          // #742
+NULL,                                          // #743
+NULL,                                          // #744
+NULL,                                          // #745
+NULL,                                          // #746
+NULL,                                          // #747
+NULL,                                          // #748
+NULL,                                          // #749
 NULL
 };