]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - clvm_cmds.c
Added the map name (ie. "The Grisly Grotto") to the world.message field string in...
[xonotic/darkplaces.git] / clvm_cmds.c
index f84932a61b5ded0b9f2464fe7c659b31ccebbcb8..57868da535595da5c03e7d787b4c2846b2ecc6e4 100644 (file)
@@ -404,7 +404,7 @@ static void VM_CL_findradius (void)
                        eorg[2] -= bound(ent->fields.client->mins[2], eorg[2], ent->fields.client->maxs[2]);
                }
                else
-                       VectorMAMAM(1, eorg, 0.5f, ent->fields.client->mins, 0.5f, ent->fields.client->maxs, eorg);
+                       VectorMAMAM(1, eorg, -0.5f, ent->fields.client->mins, -0.5f, ent->fields.client->maxs, eorg);
                if (DotProduct(eorg, eorg) < radius2)
                {
                        ent->fields.client->chain = PRVM_EDICT_TO_PROG(chain);
@@ -631,11 +631,13 @@ static void VM_CL_R_ClearScene (void)
        r_view.frustum_x = r_view.frustum_y * (float)r_view.width / (float)r_view.height / vid_pixelheight.value;
        r_view.frustum_x *= r_refdef.frustumscale_x;
        r_view.frustum_y *= r_refdef.frustumscale_y;
+       r_view.ortho_x = scr_fov.value * (3.0 / 4.0) * (float)r_view.width / (float)r_view.height / vid_pixelheight.value;
+       r_view.ortho_y = scr_fov.value * (3.0 / 4.0);
        // FIXME: restore cl.csqc_origin
        // FIXME: restore cl.csqc_angles
        cl.csqc_vidvars.drawworld = true;
-       cl.csqc_vidvars.drawenginesbar = true;
-       cl.csqc_vidvars.drawcrosshair = true;
+       cl.csqc_vidvars.drawenginesbar = false;
+       cl.csqc_vidvars.drawcrosshair = false;
 }
 
 //#301 void(float mask) addentities (EXT_CSQC)
@@ -711,12 +713,12 @@ static void VM_CL_R_SetView (void)
                                                        r_view.width = (int)(f[0] * vid.width / vid_conwidth.value);
                                                        r_view.height = (int)(f[1] * vid.height / vid_conheight.value);
                                                        break;
-       case VF_FOV:                    r_view.frustum_x = tan(f[0] * M_PI / 360.0);
-                                                       r_view.frustum_y = tan(f[1] * M_PI / 360.0);
+       case VF_FOV:                    r_view.frustum_x = tan(f[0] * M_PI / 360.0);r_view.ortho_x = f[0];
+                                                       r_view.frustum_y = tan(f[1] * M_PI / 360.0);r_view.ortho_y = f[1];
                                                        break;
-       case VF_FOVX:                   r_view.frustum_x = tan(k * M_PI / 360.0);
+       case VF_FOVX:                   r_view.frustum_x = tan(k * M_PI / 360.0);r_view.ortho_x = k;
                                                        break;
-       case VF_FOVY:                   r_view.frustum_y = tan(k * M_PI / 360.0);
+       case VF_FOVY:                   r_view.frustum_y = tan(k * M_PI / 360.0);r_view.ortho_y = k;
                                                        break;
        case VF_ORIGIN:                 VectorCopy(f, cl.csqc_origin);
                                                        CSQC_R_RecalcView();
@@ -848,8 +850,24 @@ static void VM_CL_getstatf (void)
 static void VM_CL_getstati (void)
 {
        int i, index;
-       VM_SAFEPARMCOUNT(1, VM_CL_getstati);
+       int firstbit, bitcount;
+
+       VM_SAFEPARMCOUNTRANGE(1, 3, VM_CL_getstati);
+
        index = (int)PRVM_G_FLOAT(OFS_PARM0);
+       if (prog->argc > 1)
+       {
+               firstbit = (int)PRVM_G_FLOAT(OFS_PARM1);
+               if (prog->argc > 2)
+                       bitcount = (int)PRVM_G_FLOAT(OFS_PARM2);
+               else
+                       bitcount = 1;
+       }
+       else
+       {
+               firstbit = 0;
+               bitcount = 32;
+       }
 
        if(index < 0 || index >= MAX_CL_STATS)
        {
@@ -857,6 +875,8 @@ static void VM_CL_getstati (void)
                return;
        }
        i = cl.stats[index];
+       if (bitcount != 32)     //32 causes the mask to overflow, so there's nothing to subtract from.
+               i = (((unsigned int)i)&(((1<<bitcount)-1)<<firstbit))>>firstbit;
        PRVM_G_FLOAT(OFS_RETURN) = i;
 }
 
@@ -1177,7 +1197,7 @@ static void VM_CL_makestatic (void)
 
                // copy it to the current state
                staticent->render.model = CL_GetModelByIndex((int)ent->fields.client->modelindex);
-               staticent->render.frame = staticent->render.frame1 = staticent->render.frame2 = (int)ent->fields.client->frame;
+               staticent->render.frame1 = staticent->render.frame2 = (int)ent->fields.client->frame;
                staticent->render.framelerp = 0;
                // make torchs play out of sync
                staticent->render.frame1time = staticent->render.frame2time = lhrandom(-10, -1);
@@ -3140,10 +3160,10 @@ NULL,                                                   // #440 void(entity e, string s) clientcommand (KRIMZON_SV_PARSECLIE
 VM_tokenize,                                   // #441 float(string s) tokenize (KRIMZON_SV_PARSECLIENTCOMMAND)
 VM_argv,                                               // #442 string(float n) argv (KRIMZON_SV_PARSECLIENTCOMMAND)
 VM_CL_setattachment,                   // #443 void(entity e, entity tagentity, string tagname) setattachment (DP_GFX_QUAKE3MODELTAGS)
-VM_search_begin,                               // #444 float(string pattern, float caseinsensitive, float quiet) search_begin (DP_FS_SEARCH)
-VM_search_end,                                 // #445 void(float handle) search_end (DP_FS_SEARCH)
-VM_search_getsize,                             // #446 float(float handle) search_getsize (DP_FS_SEARCH)
-VM_search_getfilename,                 // #447 string(float handle, float num) search_getfilename (DP_FS_SEARCH)
+VM_search_begin,                               // #444 float(string pattern, float caseinsensitive, float quiet) search_begin (DP_QC_FS_SEARCH)
+VM_search_end,                                 // #445 void(float handle) search_end (DP_QC_FS_SEARCH)
+VM_search_getsize,                             // #446 float(float handle) search_getsize (DP_QC_FS_SEARCH)
+VM_search_getfilename,                 // #447 string(float handle, float num) search_getfilename (DP_QC_FS_SEARCH)
 VM_cvar_string,                                        // #448 string(string s) cvar_string (DP_QC_CVAR_STRING)
 VM_findflags,                                  // #449 entity(entity start, .float fld, float match) findflags (DP_QC_FINDFLAGS)
 VM_findchainflags,                             // #450 entity(.float fld, float match) findchainflags (DP_QC_FINDCHAINFLAGS)