mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-13 07:57:52 +00:00
Merge branch 'master' into reverbedit
This commit is contained in:
commit
4c799af293
11 changed files with 106 additions and 68 deletions
|
@ -534,7 +534,7 @@ bool FCajunMaster::LoadBots ()
|
||||||
}
|
}
|
||||||
if (!sc.OpenFile(tmp))
|
if (!sc.OpenFile(tmp))
|
||||||
{
|
{
|
||||||
Printf("Unable to open %s. So no bots\n");
|
Printf("Unable to open %s. So no bots\n", tmp.GetChars());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -544,18 +544,13 @@ void CreatePath(const char *fn)
|
||||||
{
|
{
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
}
|
}
|
||||||
struct stat info;
|
if (!DirEntryExists(copy) && mkdir(copy, 0755) == -1)
|
||||||
if (DirEntryExists(copy))
|
|
||||||
{
|
{
|
||||||
if (info.st_mode & S_IFDIR)
|
// failed
|
||||||
goto exists;
|
|
||||||
}
|
|
||||||
if (mkdir(copy, 0755) == -1)
|
|
||||||
{ // failed
|
|
||||||
free(copy);
|
free(copy);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
exists: if (p != NULL)
|
if (p != NULL)
|
||||||
{
|
{
|
||||||
*p = '/';
|
*p = '/';
|
||||||
}
|
}
|
||||||
|
|
|
@ -2978,7 +2978,7 @@ bool G_CheckDemoStatus (void)
|
||||||
bool saved = false;
|
bool saved = false;
|
||||||
if (fw != nullptr)
|
if (fw != nullptr)
|
||||||
{
|
{
|
||||||
auto size = long(demo_p - demobuffer);
|
const size_t size = demo_p - demobuffer;
|
||||||
saved = fw->Write(demobuffer, size) == size;
|
saved = fw->Write(demobuffer, size) == size;
|
||||||
delete fw;
|
delete fw;
|
||||||
if (!saved) remove(demoname);
|
if (!saved) remove(demoname);
|
||||||
|
|
|
@ -800,8 +800,8 @@ sector_t * GLSceneDrawer::RenderViewpoint (AActor * camera, GL_IRECT * bounds, f
|
||||||
GLRenderer->mAngles.Roll.Degrees = r_viewpoint.Angles.Roll.Degrees;
|
GLRenderer->mAngles.Roll.Degrees = r_viewpoint.Angles.Roll.Degrees;
|
||||||
|
|
||||||
// Scroll the sky
|
// Scroll the sky
|
||||||
GLRenderer->mSky1Pos = (double)fmod(screen->FrameTime * level.skyspeed1, 1024.f) * 90./256.;
|
GLRenderer->mSky1Pos = (double)fmod((double)screen->FrameTime * (double)level.skyspeed1, 1024.f) * 90./256.;
|
||||||
GLRenderer->mSky2Pos = (double)fmod(screen->FrameTime * level.skyspeed2, 1024.f) * 90./256.;
|
GLRenderer->mSky2Pos = (double)fmod((double)screen->FrameTime * (double)level.skyspeed2, 1024.f) * 90./256.;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -60,5 +60,6 @@ FString M_GetCajunPath(const char *filename);
|
||||||
FString M_GetConfigPath(bool for_reading);
|
FString M_GetConfigPath(bool for_reading);
|
||||||
FString M_GetScreenshotsPath();
|
FString M_GetScreenshotsPath();
|
||||||
FString M_GetSavegamesPath();
|
FString M_GetSavegamesPath();
|
||||||
|
FString M_GetDocumentsPath();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -215,3 +215,24 @@ FString M_GetSavegamesPath()
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//===========================================================================
|
||||||
|
//
|
||||||
|
// M_GetDocumentsPath Unix
|
||||||
|
//
|
||||||
|
// Returns the path to the default documents directory.
|
||||||
|
//
|
||||||
|
//===========================================================================
|
||||||
|
|
||||||
|
FString M_GetDocumentsPath()
|
||||||
|
{
|
||||||
|
FString path;
|
||||||
|
char cpath[PATH_MAX];
|
||||||
|
FSRef folder;
|
||||||
|
|
||||||
|
if (noErr == FSFindFolder(kUserDomain, kDocumentsFolderType, kCreateFolder, &folder) &&
|
||||||
|
noErr == FSRefMakePath(&folder, (UInt8*)cpath, PATH_MAX))
|
||||||
|
{
|
||||||
|
path << cpath << "/" GAME_DIR "/";
|
||||||
|
}
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
|
@ -218,3 +218,16 @@ FString M_GetSavegamesPath()
|
||||||
{
|
{
|
||||||
return NicePath("~/" GAME_DIR);
|
return NicePath("~/" GAME_DIR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//===========================================================================
|
||||||
|
//
|
||||||
|
// M_GetDocumentsPath Unix
|
||||||
|
//
|
||||||
|
// Returns the path to the default documents directory.
|
||||||
|
//
|
||||||
|
//===========================================================================
|
||||||
|
|
||||||
|
FString M_GetDocumentsPath()
|
||||||
|
{
|
||||||
|
return NicePath("~/" GAME_DIR);
|
||||||
|
}
|
|
@ -166,6 +166,8 @@ bool FMD3Model::Load(const char * path, int lumpnum, const char * buffer, int le
|
||||||
for (int i = 0; i < s->numSkins; i++)
|
for (int i = 0; i < s->numSkins; i++)
|
||||||
{
|
{
|
||||||
// [BB] According to the MD3 spec, Name is supposed to include the full path.
|
// [BB] According to the MD3 spec, Name is supposed to include the full path.
|
||||||
|
// ... and since some tools seem to output backslashes, these need to be replaced with forward slashes to work.
|
||||||
|
FixPathSeperator(shader[i].Name);
|
||||||
s->skins[i] = LoadSkin("", shader[i].Name);
|
s->skins[i] = LoadSkin("", shader[i].Name);
|
||||||
// [BB] Fall back and check if Name is relative.
|
// [BB] Fall back and check if Name is relative.
|
||||||
if (!s->skins[i].isValid())
|
if (!s->skins[i].isValid())
|
||||||
|
|
|
@ -35,27 +35,13 @@
|
||||||
|
|
||||||
|
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/types.h>
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
#define stat _stat
|
|
||||||
#else
|
#else
|
||||||
#include <dirent.h>
|
|
||||||
#ifndef __sun
|
|
||||||
#include <fts.h>
|
#include <fts.h>
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <ctype.h>
|
|
||||||
#include <errno.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <time.h>
|
|
||||||
|
|
||||||
#include "doomtype.h"
|
|
||||||
#include "tarray.h"
|
|
||||||
#include "resourcefile.h"
|
#include "resourcefile.h"
|
||||||
#include "zstring.h"
|
|
||||||
#include "cmdlib.h"
|
#include "cmdlib.h"
|
||||||
#include "doomerrors.h"
|
#include "doomerrors.h"
|
||||||
|
|
||||||
|
@ -185,43 +171,6 @@ int FDirectory::AddDirectory(const char *dirpath)
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif defined(__sun) || defined(__APPLE__)
|
|
||||||
|
|
||||||
int FDirectory::AddDirectory(const char *dirpath)
|
|
||||||
{
|
|
||||||
int count = 0;
|
|
||||||
TArray<FString> scanDirectories;
|
|
||||||
scanDirectories.Push(dirpath);
|
|
||||||
for(unsigned int i = 0;i < scanDirectories.Size();i++)
|
|
||||||
{
|
|
||||||
DIR* directory = opendir(scanDirectories[i].GetChars());
|
|
||||||
if (directory == NULL)
|
|
||||||
{
|
|
||||||
Printf("Could not read directory: %s\n", strerror(errno));
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct dirent *file;
|
|
||||||
while((file = readdir(directory)) != NULL)
|
|
||||||
{
|
|
||||||
if(file->d_name[0] == '.') //File is hidden or ./.. directory so ignore it.
|
|
||||||
continue;
|
|
||||||
|
|
||||||
FString fullFileName = scanDirectories[i] + file->d_name;
|
|
||||||
|
|
||||||
if(DirExists(fullFileName.GetChars()))
|
|
||||||
{
|
|
||||||
scanDirectories.Push(scanDirectories[i] + file->d_name + "/");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
AddEntry(scanDirectories[i] + file->d_name, fileStat.st_size);
|
|
||||||
count++;
|
|
||||||
}
|
|
||||||
closedir(directory);
|
|
||||||
}
|
|
||||||
return count;
|
|
||||||
}
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
@ -246,6 +195,10 @@ int FDirectory::AddDirectory(const char *dirpath)
|
||||||
Printf("Failed to start directory traversal: %s\n", strerror(errno));
|
Printf("Failed to start directory traversal: %s\n", strerror(errno));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const size_t namepos = strlen(Filename);
|
||||||
|
FString pathfix;
|
||||||
|
|
||||||
while ((ent = fts_read(fts)) != NULL)
|
while ((ent = fts_read(fts)) != NULL)
|
||||||
{
|
{
|
||||||
if (ent->fts_info == FTS_D && ent->fts_name[0] == '.')
|
if (ent->fts_info == FTS_D && ent->fts_name[0] == '.')
|
||||||
|
@ -263,7 +216,22 @@ int FDirectory::AddDirectory(const char *dirpath)
|
||||||
// We're only interested in remembering files.
|
// We're only interested in remembering files.
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
AddEntry(ent->fts_path, ent->fts_statp->st_size);
|
|
||||||
|
// Some implementations add an extra separator between
|
||||||
|
// root of the hierarchy and entity's path.
|
||||||
|
// It needs to be removed in order to resolve
|
||||||
|
// lumps' relative paths properly.
|
||||||
|
const char* path = ent->fts_path;
|
||||||
|
|
||||||
|
if ('/' == path[namepos])
|
||||||
|
{
|
||||||
|
pathfix = FString(path, namepos);
|
||||||
|
pathfix.AppendCStrPart(&path[namepos + 1], ent->fts_pathlen - namepos - 1);
|
||||||
|
|
||||||
|
path = pathfix.GetChars();
|
||||||
|
}
|
||||||
|
|
||||||
|
AddEntry(path, ent->fts_statp->st_size);
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
fts_close(fts);
|
fts_close(fts);
|
||||||
|
|
|
@ -139,8 +139,8 @@ static FILE *mktempfile_internal(const char *tmpdir, const char *pfx, FString *t
|
||||||
int oflag, pmode;
|
int oflag, pmode;
|
||||||
|
|
||||||
/* In Windows, we use the _O_TEMPORARY flag with `open` to ensure the file is deleted when closed.
|
/* In Windows, we use the _O_TEMPORARY flag with `open` to ensure the file is deleted when closed.
|
||||||
* In Unix, we use the unlink function after opening the file. (This does not work in Windows,
|
* In Unix, we use the remove function after opening the file. (This does not work in Windows,
|
||||||
* which does not allow an open file to be unlinked.)
|
* which does not allow an open file to be deleted.)
|
||||||
*/
|
*/
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
/* MSVC flags */
|
/* MSVC flags */
|
||||||
|
@ -175,7 +175,7 @@ static FILE *mktempfile_internal(const char *tmpdir, const char *pfx, FString *t
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
/* [Unix only] And make sure the file will be deleted once closed */
|
/* [Unix only] And make sure the file will be deleted once closed */
|
||||||
if (!keep) remove(tmpname);
|
if (!keep) remove(tempname);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -380,3 +380,41 @@ FString M_GetSavegamesPath()
|
||||||
}
|
}
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//===========================================================================
|
||||||
|
//
|
||||||
|
// M_GetDocumentsPath Windows
|
||||||
|
//
|
||||||
|
// Returns the path to the default documents directory.
|
||||||
|
//
|
||||||
|
//===========================================================================
|
||||||
|
|
||||||
|
FString M_GetDocumentsPath()
|
||||||
|
{
|
||||||
|
FString path;
|
||||||
|
|
||||||
|
// A portable INI means that this storage location should also be portable.
|
||||||
|
path.Format("%s" GAMENAME "_portable.ini", progdir.GetChars());
|
||||||
|
if (FileExists(path))
|
||||||
|
{
|
||||||
|
return progdir;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!UseKnownFolders())
|
||||||
|
{
|
||||||
|
return progdir;
|
||||||
|
}
|
||||||
|
// Try defacto My Documents/My Games folder
|
||||||
|
else if (GetKnownFolder(CSIDL_PERSONAL, FOLDERID_Documents, true, path))
|
||||||
|
{
|
||||||
|
// I assume since this isn't a standard folder, it doesn't have
|
||||||
|
// a localized name either.
|
||||||
|
path << "/My Games/" GAMENAME;
|
||||||
|
CreatePath(path);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
path = progdir;
|
||||||
|
}
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue