]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - prvm_cmds.c
Fixed fgets (before it has been ignoring the line that contained the EOF char).
[xonotic/darkplaces.git] / prvm_cmds.c
index f19deb65613ffa2d1f1eea3d1603b09f076daa3d..4991e6ed75728b910f2f9e4daa177732724ca8b5 100644 (file)
@@ -629,14 +629,14 @@ void VM_localsound(void)
 
        s = PRVM_G_STRING(OFS_PARM0);
 
-       if(!S_GetCached(s))
+       if(!S_GetCached(s, true))
        {
                Con_Printf("VM_localsound: %s : %s not cached !\n", PRVM_NAME, s);
                PRVM_G_FLOAT(OFS_RETURN) = -4;
                return;
        }               
 
-       S_LocalSound(s);
+       S_LocalSound(s, true);
        PRVM_G_FLOAT(OFS_RETURN) = 1;
 }
 
@@ -860,7 +860,7 @@ void VM_spawn (void)
 =========
 VM_remove
 
-entity remove()
+remove(entity e)
 =========
 */
 
@@ -1109,14 +1109,14 @@ void VM_precache_sound (void)
        PRVM_G_INT(OFS_RETURN) = PRVM_G_INT(OFS_PARM0);
        VM_CheckEmptyString (s);
        
-       if(S_GetCached(s))
+       if(S_GetCached(s, true))
        {
                Con_Printf("VM_precache_sound: %s already cached (%s)\n", s, PRVM_NAME);
                return;
        }
        
-       if(!S_PrecacheSound(s,true))
-               Con_Printf("VM_prache_sound: Failed to load %s for %s\n", s, PRVM_NAME);
+       if(!S_PrecacheSound(s,true, true))
+               Con_Printf("VM_precache_sound: Failed to load %s for %s\n", s, PRVM_NAME);
 }
 
 /*
@@ -1746,6 +1746,9 @@ void VM_fopen(void)
                return;
        }
        VM_FILES[filenum] = FS_Open(va("data/%s", filename), modestring, false);
+       if (VM_FILES[filenum] == NULL && mode == 0)
+               VM_FILES[filenum] = FS_Open(va("%s", filename), modestring, false);
+
        if (VM_FILES[filenum] == NULL)
                PRVM_G_FLOAT(OFS_RETURN) = -1;
        else
@@ -1823,7 +1826,7 @@ void VM_fgets(void)
                c = FS_Getc(VM_FILES[filenum]);
        if (developer.integer)
                Con_Printf("fgets: %s: %s\n", PRVM_NAME, string);
-       if (c >= 0)
+       if (c >= 0 || end)
                PRVM_G_INT(OFS_RETURN) = PRVM_SetString(string);
        else
                PRVM_G_INT(OFS_RETURN) = 0;
@@ -2114,6 +2117,7 @@ void PF_setattachment (void)
                                for (i = 0;i < model->data_overridetagnamesforskin[(unsigned int)tagentity->v->skin].num_overridetagnames;i++)
                                        if (!strcmp(tagname, model->data_overridetagnamesforskin[(unsigned int)tagentity->v->skin].data_overridetagnames[i].name))
                                                v->_float = i + 1;
+                       // FIXME: use a model function to get tag info (need to handle skeletal)
                        if (v->_float == 0 && model->alias.aliasnum_tags)
                                for (i = 0;i < model->alias.aliasnum_tags;i++)
                                        if (!strcmp(tagname, model->alias.aliasdata_tags[i].name))
@@ -2778,7 +2782,7 @@ void VM_getimagesize(void)
 void VM_Cmd_Init(void)
 {
        // only init the stuff for the current prog
-       VM_STRINGS_MEMPOOL = Mem_AllocPool(va("vm_stringsmempool[%s]",PRVM_NAME));
+       VM_STRINGS_MEMPOOL = Mem_AllocPool(va("vm_stringsmempool[%s]",PRVM_NAME), 0, NULL);
        VM_Files_Init();
        VM_Search_Init();
 }