]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - clvm_cmds.c
Comment out a line in setmodel again (needs fixing but wasn't in there before anyway)
[xonotic/darkplaces.git] / clvm_cmds.c
index cbc95c32c3a609211bb26d5b167bdab374ca8d42..1c6222a39f0f678bb51ded123124701e62101fdd 100644 (file)
@@ -83,39 +83,44 @@ void VM_CL_setmodel (void)
        VM_SAFEPARMCOUNT(2, VM_CL_setmodel);
 
        e = PRVM_G_EDICT(OFS_PARM0);
+       e->fields.client->modelindex = 0;
+       e->fields.client->model = 0;
+
        m = PRVM_G_STRING(OFS_PARM1);
+       mod = NULL;
        for (i = 0;i < MAX_MODELS && cl.csqc_model_precache[i];i++)
        {
                if (!strcmp(cl.csqc_model_precache[i]->name, m))
                {
-                       e->fields.client->model = PRVM_SetEngineString(cl.csqc_model_precache[i]->name);
+                       mod = cl.csqc_model_precache[i];
+                       e->fields.client->model = PRVM_SetEngineString(mod->name);
                        e->fields.client->modelindex = -(i+1);
-                       return;
+                       break;
                }
        }
 
-       for (i = 0;i < MAX_MODELS;i++)
-       {
-               mod = cl.model_precache[i];
-               if (mod && !strcmp(mod->name, m))
+       if( !mod ) {
+               for (i = 0;i < MAX_MODELS;i++)
                {
-                       e->fields.client->model = PRVM_SetEngineString(mod->name);
-                       e->fields.client->modelindex = i;
-                       return;
+                       mod = cl.model_precache[i];
+                       if (mod && !strcmp(mod->name, m))
+                       {
+                               e->fields.client->model = PRVM_SetEngineString(mod->name);
+                               e->fields.client->modelindex = i;
+                               break;
+                       }
                }
        }
 
-       e->fields.client->modelindex = 0;
-       e->fields.client->model = 0;
-       VM_Warning ("setmodel: model '%s' not precached\n", m);
-
-       // TODO: check if this breaks needed consistency and maybe add a cvar for it too?? [1/10/2008 Black]
-       if (mod)
-       {
-               SetMinMaxSize (e, mod->normalmins, mod->normalmaxs);
-       }
+       if( mod ) {
+               // TODO: check if this breaks needed consistency and maybe add a cvar for it too?? [1/10/2008 Black]
+               //SetMinMaxSize (e, mod->normalmins, mod->normalmaxs);
+       } 
        else
+       {
                SetMinMaxSize (e, vec3_origin, vec3_origin);
+               VM_Warning ("setmodel: model '%s' not precached\n", m);
+       }
 }
 
 // #4 void(entity e, vector min, vector max) setsize
@@ -683,6 +688,7 @@ void VM_CL_R_ClearScene (void)
        r_refdef.view.frustum_y *= r_refdef.frustumscale_y;
        r_refdef.view.ortho_x = scr_fov.value * (3.0 / 4.0) * (float)r_refdef.view.width / (float)r_refdef.view.height / vid_pixelheight.value;
        r_refdef.view.ortho_y = scr_fov.value * (3.0 / 4.0);
+       r_refdef.view.clear = true;
        // FIXME: restore cl.csqc_origin
        // FIXME: restore cl.csqc_angles
        cl.csqc_vidvars.drawworld = true;
@@ -836,6 +842,9 @@ void VM_CL_R_SetView (void)
        case VF_PERSPECTIVE:
                r_refdef.view.useperspective = k != 0;
                break;
+       case VF_CLEARSCREEN:
+               r_refdef.view.clear = k ? true : false;
+               break;
        default:
                PRVM_G_FLOAT(OFS_RETURN) = 0;
                VM_Warning("VM_CL_R_SetView : unknown parm %i\n", c);
@@ -1988,7 +1997,7 @@ static void VM_CL_getsurfaceclippedpoint(void)
 }
 
 // #443 void(entity e, entity tagentity, string tagname) setattachment
-static void VM_CL_setattachment (void)
+void VM_CL_setattachment (void)
 {
        prvm_edict_t *e;
        prvm_edict_t *tagentity;
@@ -2180,7 +2189,7 @@ int CL_GetTagMatrix (matrix4x4_t *out, prvm_edict_t *ent, int tagindex)
 }
 
 // #451 float(entity ent, string tagname) gettagindex (DP_QC_GETTAGINFO)
-static void VM_CL_gettagindex (void)
+void VM_CL_gettagindex (void)
 {
        prvm_edict_t *ent;
        const char *tag_name;
@@ -2215,7 +2224,7 @@ static void VM_CL_gettagindex (void)
 }
 
 // #452 vector(entity ent, float tagindex) gettaginfo (DP_QC_GETTAGINFO)
-static void VM_CL_gettaginfo (void)
+void VM_CL_gettaginfo (void)
 {
        prvm_edict_t *e;
        int tagindex;
@@ -2451,11 +2460,11 @@ void VM_CL_R_PolygonBegin (void)
                VM_InitPolygons(polys);
        if (polys->begin_active)
        {
-               VM_Warning("VM_CL_R_PolygonBegin: called twice without VM_CL_R_PolygonEnd after first\n");
+               VM_Warning("VM_CL_R_PolygonBegin: called twice without VM_CL_R_PolygonBegin after first\n");
                return;
        }
        picname = PRVM_G_STRING(OFS_PARM0);
-       polys->begin_texture = picname[0] ? Draw_CachePic(picname, true)->tex : r_texture_white;
+       polys->begin_texture = picname[0] ? Draw_CachePic (picname)->tex : r_texture_white;
        polys->begin_drawflag = (int)PRVM_G_FLOAT(OFS_PARM1);
        polys->begin_vertices = 0;
        polys->begin_active = true;
@@ -2521,7 +2530,7 @@ void Debug_PolygonBegin(const char *picname, int drawflag)
                Con_Printf("Debug_PolygonBegin: called twice without Debug_PolygonEnd after first\n");
                return;
        }
-       debugPolys.begin_texture = picname[0] ? Draw_CachePic(picname, true)->tex : r_texture_white;
+       debugPolys.begin_texture = picname[0] ? Draw_CachePic (picname)->tex : r_texture_white;
        debugPolys.begin_drawflag = drawflag;
        debugPolys.begin_vertices = 0;
        debugPolys.begin_active = true;