Update to ZDoom r910:

- Fixed a few bugs in the parser for composite textures.
- Changed: When loading Zips all patches in the patches/ directory should
  be loaded, not only those used by a texture in TEXTUREx. 
- Changed FMOD_INIT_ENABLE_DSPNET use to its replacement from 4.14.00,
  FMOD_INIT_ENABLE_PROFILE. Renamed the corresponding cvar to snd_profile.
- Removed the normalize parameter from SoundStream::Play().
- Disabled the chorus and reverb effects added to SDL_mixer's Timidity,
  because they were probably never tested well, either. Thanks to the bug
  in vc_alloc(), they were never even activated.
- Restored the exact frequency range search that was missing from SDL_mixer's
  verion of select_sample().
- Fixed: vc_alloc(), kill_others(), and note_on() treated Voice::status as a
  bit mask, when it's not. These were changes made to SDL_mixer's Timidity.
- Restored the original Timidity volume equation. The other louder one was
  put in when I didn't realize all channels were mono and many notes sounded
  too quiet because they never completed their attack phase.
- Fixed: FileReader::Gets() acted as if fgets() always read the maximum
  number of characters.
- Fixed: FileReader::Open() did not set FilePos and StartPos to 0.
- Replaced use of stdio in Timidity with FileReader and added the option to read
  from the lump directory. If the main config file is inside the lump directory
  it will assume that everything else is as well. If it is a real file it will be
  assumed that the rest is real files as well.
- Fixed: None of the error returns in read_config_file closed the file being read. 


git-svn-id: http://mancubus.net/svn/hosted/gzdoom/trunk@91 b0f79afe-0144-0410-b225-9a4edf0717df
This commit is contained in:
Christoph Oelckers 2008-04-13 14:34:31 +00:00
parent f5930d3fb5
commit 40f1ceddf7
18 changed files with 171 additions and 102 deletions

View file

@ -46,7 +46,7 @@
//==========================================================================
FileReader::FileReader ()
: File(NULL), Length(0), CloseOnDestruct(false)
: File(NULL), Length(0), StartPos(0), CloseOnDestruct(false)
{
}
@ -59,13 +59,10 @@ FileReader::FileReader (const FileReader &other, long length)
FileReader::FileReader (const char *filename)
: File(NULL), Length(0), StartPos(0), FilePos(0), CloseOnDestruct(false)
{
File = fopen (filename, "rb");
if (File == NULL)
if (!Open(filename))
{
I_Error ("Could not open %s", filename);
}
CloseOnDestruct = true;
Length = CalcFileLen();
}
FileReader::FileReader (FILE *file)
@ -89,6 +86,18 @@ FileReader::~FileReader ()
}
}
bool FileReader::Open (const char *filename)
{
File = fopen (filename, "rb");
if (File == NULL) return false;
FilePos = 0;
StartPos = 0;
CloseOnDestruct = true;
Length = CalcFileLen();
return true;
}
void FileReader::ResetFilePtr ()
{
FilePos = ftell (File);
@ -134,13 +143,12 @@ long FileReader::Read (void *buffer, long len)
char *FileReader::Gets(char *strbuf, int len)
{
if (FilePos + len > StartPos + Length)
{
len = Length - FilePos + StartPos;
}
if (len <= 0) return 0;
char *p = fgets(strbuf, len, File);
FilePos += len;
if (p != NULL)
{
FilePos = ftell(File) - StartPos;
}
return p;
}
@ -150,16 +158,26 @@ char *FileReader::GetsFromBuffer(const char * bufptr, char *strbuf, int len)
if (len <= 0) return NULL;
char *p = strbuf;
while (len > 1 && bufptr[FilePos] != 0)
while (len > 1)
{
if (bufptr[FilePos] == 0)
{
FilePos++;
break;
}
if (bufptr[FilePos] != '\r')
{
*p++ = bufptr[FilePos];
len--;
if (bufptr[FilePos] == '\n') break;
if (bufptr[FilePos] == '\n')
{
FilePos++;
break;
}
}
FilePos++;
}
if (p==strbuf) return NULL;
*p++=0;
return strbuf;
}