]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - fs.c
Change tabs into spaces for a console print so it does not show weird glyphs ingame
[xonotic/darkplaces.git] / fs.c
diff --git a/fs.c b/fs.c
index 1612f19a53e66a3977fce10f306a352f8ed8db03..f4f1e55fdf752a5dd6e6c304b270d430a026a508 100644 (file)
--- a/fs.c
+++ b/fs.c
@@ -382,9 +382,9 @@ char fs_gamedirs[MAX_GAMEDIRS][MAX_QPATH];
 gamedir_t *fs_all_gamedirs = NULL;
 int fs_all_gamedirs_count = 0;
 
-cvar_t scr_screenshot_name = {CVAR_NORESETTODEFAULTS, "scr_screenshot_name","dp", "prefix name for saved screenshots (changes based on -game commandline, as well as which game mode is running; the date is encoded using strftime escapes)"};
-cvar_t fs_empty_files_in_pack_mark_deletions = {0, "fs_empty_files_in_pack_mark_deletions", "0", "if enabled, empty files in a pak/pk3 count as not existing but cancel the search in further packs, effectively allowing patch pak/pk3 files to 'delete' files"};
-cvar_t cvar_fs_gamedir = {CVAR_READONLY | CVAR_NORESETTODEFAULTS, "fs_gamedir", "", "the list of currently selected gamedirs (use the 'gamedir' command to change this)"};
+cvar_t scr_screenshot_name = {CVAR_CLIENT | CVAR_NORESETTODEFAULTS, "scr_screenshot_name","dp", "prefix name for saved screenshots (changes based on -game commandline, as well as which game mode is running; the date is encoded using strftime escapes)"};
+cvar_t fs_empty_files_in_pack_mark_deletions = {CVAR_CLIENT | CVAR_SERVER, "fs_empty_files_in_pack_mark_deletions", "0", "if enabled, empty files in a pak/pk3 count as not existing but cancel the search in further packs, effectively allowing patch pak/pk3 files to 'delete' files"};
+cvar_t cvar_fs_gamedir = {CVAR_CLIENT | CVAR_SERVER | CVAR_READONLY | CVAR_NORESETTODEFAULTS, "fs_gamedir", "", "the list of currently selected gamedirs (use the 'gamedir' command to change this)"};
 
 
 /*
@@ -1212,7 +1212,7 @@ static qboolean FS_AddPack_Fullpath(const char *pakfile, const char *shortname,
        }
        else
        {
-               Con_Printf("unable to load pak \"%s\"\n", pakfile);
+               Con_Errorf("unable to load pak \"%s\"\n", pakfile);
                return false;
        }
 }
@@ -1483,7 +1483,7 @@ void FS_Rescan (void)
 
        // look for the pop.lmp file and set registered to true if it is found
        if (FS_FileExists("gfx/pop.lmp"))
-               Cvar_Set ("registered", "1");
+               Cvar_SetValueQuick(&registered, 1);
        switch(gamemode)
        {
        case GAME_NORMAL:
@@ -1581,10 +1581,6 @@ qboolean FS_ChangeGameDirs(int numgamedirs, char gamedirs[][MAX_QPATH], qboolean
        // unload all sounds so they will be reloaded from the new files as needed
        S_UnloadAllSounds_f(&cmd_client);
 
-       // close down the video subsystem, it will start up again when the config finishes...
-       VID_Stop();
-       vid_opened = false;
-
        // restart the video subsystem after the config is executed
        Cbuf_InsertText(&cmd_client, "\nloadconfig\nvid_restart\n\n");
 
@@ -2138,13 +2134,13 @@ void FS_Init (void)
 
        p = FS_CheckGameDir(gamedirname1);
        if(!p || p == fs_checkgamedir_missing)
-               Con_Printf("WARNING: base gamedir %s%s/ not found!\n", fs_basedir, gamedirname1);
+               Con_Warnf("WARNING: base gamedir %s%s/ not found!\n", fs_basedir, gamedirname1);
 
        if(gamedirname2)
        {
                p = FS_CheckGameDir(gamedirname2);
                if(!p || p == fs_checkgamedir_missing)
-                       Con_Printf("WARNING: base gamedir %s%s/ not found!\n", fs_basedir, gamedirname2);
+                       Con_Warnf("WARNING: base gamedir %s%s/ not found!\n", fs_basedir, gamedirname2);
        }
 
        // -game <gamedir>
@@ -2161,7 +2157,7 @@ void FS_Init (void)
                        if(!p)
                                Sys_Error("Nasty -game name rejected: %s", com_argv[i]);
                        if(p == fs_checkgamedir_missing)
-                               Con_Printf("WARNING: -game %s%s/ not found!\n", fs_basedir, com_argv[i]);
+                               Con_Warnf("WARNING: -game %s%s/ not found!\n", fs_basedir, com_argv[i]);
                        // add the gamedir to the list of active gamedirs
                        strlcpy (fs_gamedirs[fs_numgamedirs], com_argv[i], sizeof(fs_gamedirs[fs_numgamedirs]));
                        fs_numgamedirs++;
@@ -2243,7 +2239,7 @@ static filedesc_t FS_SysOpenFiledesc(const char *filepath, const char *mode, qbo
                        opt = O_CREAT | O_APPEND;
                        break;
                default:
-                       Con_Printf ("FS_SysOpen(%s, %s): invalid mode\n", filepath, mode);
+                       Con_Errorf ("FS_SysOpen(%s, %s): invalid mode\n", filepath, mode);
                        return FILEDESC_INVALID;
        }
        for (ind = 1; mode[ind] != '\0'; ind++)
@@ -2260,7 +2256,7 @@ static filedesc_t FS_SysOpenFiledesc(const char *filepath, const char *mode, qbo
                                dolock = true;
                                break;
                        default:
-                               Con_Printf ("FS_SysOpen(%s, %s): unknown character in mode (%c)\n",
+                               Con_Errorf ("FS_SysOpen(%s, %s): unknown character in mode (%c)\n",
                                                        filepath, mode, mode[ind]);
                }
        }
@@ -2370,7 +2366,7 @@ static qfile_t *FS_OpenPackedFile (pack_t* pack, int pack_ind)
        // No Zlib DLL = no compressed files
        if (!zlib_dll && (pfile->flags & PACKFILE_FLAG_DEFLATED))
        {
-               Con_Printf("WARNING: can't open the compressed file %s\n"
+               Con_Warnf("WARNING: can't open the compressed file %s\n"
                                        "You need the Zlib DLL to use compressed files\n",
                                        pfile->name);
                return NULL;
@@ -2842,7 +2838,7 @@ fs_offset_t FS_Write (qfile_t* file, const void* data, size_t datasize)
        {
                if (FILEDESC_SEEK (file->handle, file->buff_ind - file->buff_len, SEEK_CUR) == -1)
                {
-                       Con_Printf("WARNING: could not seek in %s.\n", file->filename);
+                       Con_Warnf("WARNING: could not seek in %s.\n", file->filename);
                }
        }
 
@@ -3249,9 +3245,9 @@ int FS_Seek (qfile_t* file, fs_offset_t offset, int whence)
        buffer = (unsigned char *)Mem_Alloc (tempmempool, buffersize);
 
        // Skip all data until we reach the requested offset
-       while (offset > file->position)
+       while (offset > (file->position - file->buff_len + file->buff_ind))
        {
-               fs_offset_t diff = offset - file->position;
+               fs_offset_t diff = offset - (file->position - file->buff_len + file->buff_ind);
                fs_offset_t count, len;
 
                count = (diff > buffersize) ? buffersize : diff;