]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - prvm_cmds.c
don't print PRVM_NAME in each dprint call, it looks terrible (prints multiple times...
[xonotic/darkplaces.git] / prvm_cmds.c
index 7d8354a941cf8e15e207291d350ccc2d62000b05..388ea5b26a9f9a24cea44f9394b0288098571a19 100644 (file)
@@ -564,7 +564,11 @@ void VM_dprint (void)
        if (developer.integer)
        {
                VM_VarString(0, string, sizeof(string));
+#if 1
+               Con_Printf("%s", string);
+#else
                Con_Printf("%s: %s", PRVM_NAME, string);
+#endif
        }
 }
 
@@ -849,7 +853,7 @@ void VM_findchain (void)
        if(!prog->flag & PRVM_FE_CHAIN)
                PRVM_ERROR("VM_findchain: %s doesnt have a chain field !\n", PRVM_NAME);
 
-       chain_of = PRVM_ED_FindFieldOffset ("chain");
+       chain_of = PRVM_ED_FindField("chain")->ofs;
 
        chain = prog->edicts;
 
@@ -903,7 +907,7 @@ void VM_findchainfloat (void)
        if(!prog->flag & PRVM_FE_CHAIN)
                PRVM_ERROR("VM_findchainfloat: %s doesnt have a chain field !\n", PRVM_NAME);
 
-       chain_of = PRVM_ED_FindFieldOffset ("chain");
+       chain_of = PRVM_ED_FindField("chain")->ofs;
 
        chain = (prvm_edict_t *)prog->edicts;
 
@@ -1448,7 +1452,7 @@ void VM_fopen(void)
                modestring = "wb";
                break;
        default:
-               Con_Printf("VM_fopen: %s no such mode %i (valid: 0 = read, 1 = append, 2 = write)\n", PRVM_NAME, mode);
+               Con_Printf("VM_fopen: %s: no such mode %i (valid: 0 = read, 1 = append, 2 = write)\n", PRVM_NAME, mode);
                PRVM_G_FLOAT(OFS_RETURN) = -3;
                return;
        }
@@ -1459,9 +1463,17 @@ void VM_fopen(void)
                VM_FILES[filenum] = FS_Open(va("%s", filename), modestring, false, false);
 
        if (VM_FILES[filenum] == NULL)
+       {
+               if (developer.integer)
+                       Con_Printf("VM_fopen: %s: %s mode %s failed\n", PRVM_NAME, filename, modestring);
                PRVM_G_FLOAT(OFS_RETURN) = -1;
+       }
        else
+       {
+               if (developer.integer)
+                       Con_Printf("VM_fopen: %s: %s mode %s opened as #%i\n", PRVM_NAME, filename, modestring, filenum);
                PRVM_G_FLOAT(OFS_RETURN) = filenum;
+       }
 }
 
 /*
@@ -1489,6 +1501,8 @@ void VM_fclose(void)
                Con_Printf("VM_fclose: no such file handle %i (or file has been closed) in %s\n", filenum, PRVM_NAME);
                return;
        }
+       if (developer.integer)
+               Con_Printf("VM_fclose: %s: #%i closed\n", PRVM_NAME, filenum);
        FS_Close(VM_FILES[filenum]);
        VM_FILES[filenum] = NULL;
 }
@@ -1686,9 +1700,8 @@ void VM_strzone(void)
        VM_SAFEPARMCOUNT(1,VM_strzone);
 
        in = PRVM_G_STRING(OFS_PARM0);
-       out = PRVM_AllocString(strlen(in) + 1);
+       PRVM_G_INT(OFS_RETURN) = PRVM_AllocString(strlen(in) + 1, &out);
        strcpy(out, in);
-       PRVM_G_INT(OFS_RETURN) = PRVM_SetQCString(out);
 }
 
 /*
@@ -1702,7 +1715,7 @@ strunzone(string s)
 void VM_strunzone(void)
 {
        VM_SAFEPARMCOUNT(1,VM_strunzone);
-       PRVM_FreeString((char *)PRVM_G_STRING(OFS_PARM0));
+       PRVM_FreeString(PRVM_G_INT(OFS_PARM0));
 }
 
 /*
@@ -2651,7 +2664,7 @@ void VM_altstr_count( void )
        for( count = 0, pos = altstr ; *pos ; pos++ ) {
                if( *pos == '\\' ) {
                        if( !*++pos ) {
-                               break; 
+                               break;
                        }
                } else if( *pos == '\'' ) {
                        count++;