2008-01-27 11:25:03 +00:00
|
|
|
// cmdlib.h
|
|
|
|
|
|
|
|
#ifndef __CMDLIB__
|
|
|
|
#define __CMDLIB__
|
|
|
|
|
|
|
|
|
|
|
|
#include "doomtype.h"
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <errno.h>
|
|
|
|
#include <ctype.h>
|
|
|
|
#include <stdarg.h>
|
|
|
|
|
|
|
|
// the dec offsetof macro doesnt work very well...
|
2008-03-12 15:21:17 +00:00
|
|
|
#define myoffsetof(type,identifier) ((size_t)&((type *)1)->identifier - 1)
|
2008-01-27 11:25:03 +00:00
|
|
|
|
|
|
|
int Q_filelength (FILE *f);
|
|
|
|
bool FileExists (const char *filename);
|
2009-09-02 06:19:49 +00:00
|
|
|
bool DirEntryExists (const char *pathname);
|
2008-01-27 11:25:03 +00:00
|
|
|
|
Update to ZDoom r905:
- Added Martin Howe's morph system update.
- Added support for defining composite textures in HIRESTEX. It is not fully tested
and right now can't do much more than the old TEXTUREx method.
- Added a few NULL pointer checks to the texture code.
- Made duplicate class names in DECORATE non-fatal. There is really no stability
concern here and the worst that can happen is that the wrong actor is spawned.
This was a constant hassle when testing with WADs that contain duplicate resources.
- Removed some GCC warnings.
- Fixed: MinGW doesn't have _get_pgmptr(), so it couldn't compile i_main.cpp.
- Fixed: MOD_WAVETABLE and MOD_SWSYNTH are not defined by w32api, so MinGW
failed compiling the new MIDI code.
- Fixed: LocalSndInfo and LocalSndSeq in S_Start() need to be const char
pointers, since "" is a constant.
- Fixed: parsecontext.h was missing a newline at the end of the file.
- Fixed: Timidity::Channel::mono, rpn, and nrpn were not initialized. In
particular, this meant that every channel was almost certainly in mono mode,
which can sound pretty bad if the song isn't meant to be played that way.
- Added bank numbers to the MIDI precaching for Timidity, since I guess I do
need to care about banks, if even the Duke MIDIs use various banks.
- Fixed: snd_midiprecache only exists in Win32 builds, so gameconfigfile.cpp
shouldn't unconditionally link against it.
- Fixed: pre_resample() was still disabled, and it left two samples at the end
of the new wave data uninitialized.
- Moved the xmap table from timidity/tables.cpp to playmidi.cpp. Now I can get
rid of timidity/tables.cpp, which conflicts in name with the main Doom
tables.cpp. (And interestingly, VC++ automatically renamed the object file,
so I wasn't aware of the problem with GCC.)
- Added a Gets function to the FileReader class which I planned to use
to enable Timidity to read its config and sound patches from Zips.
I put this on hold though after finding out that the sound quality
isn't even near that of Timidity++.
- GCC-Fixes (FString::GetChars() for Printf calls)
- Added a dummy Weapon.NOLMS flag so that Skulltag weapons using this flag
can be loaded
- Changed the MIDIStreamer to send the all notes off controller to each
channel when restarting the song, rather than emitting a single note off
event which only has 1 in 127 chance of being for a note that's playing
on that channel. Then I decided it would probably be a good idea to reset
all the controllers as well.
- Increasing the size of the internal Timidity stream buffer from 1/14 sec
(copied from the OPL player) improved its sound dramatically, so apparently
Timidity has issues with short stream buffers. It's now at 1/2 sec in
length. However, there seems to be something weird going on with
corazonazul_ff6boss.mid near the beginning where it stops and immediately
restarts a guitar on the exact same note.
- Added a new sound debugging cvar: snd_drawoutput, which can show various
oscilloscopes and spectrums.
- Eliminated some more global variables (onmobj, DoRipping, LastRipped,
MissileActor, bulletpitch and linetarget.)
- Internal TiMidity now plays music. Unfortunately, it doesn't sound right. :(
- Changed the progdir global variable into an FString.
git-svn-id: http://mancubus.net/svn/hosted/gzdoom/trunk@90 b0f79afe-0144-0410-b225-9a4edf0717df
2008-04-12 18:59:23 +00:00
|
|
|
extern FString progdir;
|
2008-01-27 11:25:03 +00:00
|
|
|
|
|
|
|
void FixPathSeperator (char *path);
|
|
|
|
static void inline FixPathSeperator (FString &path) { path.ReplaceChars('\\', '/'); }
|
|
|
|
|
|
|
|
void DefaultExtension (char *path, const char *extension);
|
|
|
|
void DefaultExtension (FString &path, const char *extension);
|
|
|
|
|
|
|
|
FString ExtractFilePath (const char *path);
|
|
|
|
FString ExtractFileBase (const char *path, bool keep_extension=false);
|
|
|
|
|
2008-08-22 07:36:50 +00:00
|
|
|
int ParseHex (const char *str);
|
|
|
|
int ParseNum (const char *str);
|
|
|
|
bool IsNum (const char *str); // [RH] added
|
2008-01-27 11:25:03 +00:00
|
|
|
|
|
|
|
char *copystring(const char *s);
|
2010-08-21 08:49:56 +00:00
|
|
|
char *ncopystring(const char *s);
|
2008-01-27 11:25:03 +00:00
|
|
|
void ReplaceString (char **ptr, const char *str);
|
|
|
|
|
|
|
|
bool CheckWildcards (const char *pattern, const char *text);
|
|
|
|
|
Update to ZDoom r1083. Not fully tested yet!
- Converted most sprintf (and all wsprintf) calls to either mysnprintf or
FStrings, depending on the situation.
- Changed the strings in the wbstartstruct to be FStrings.
- Changed myvsnprintf() to output nothing if count is greater than INT_MAX.
This is so that I can use a series of mysnprintf() calls and advance the
pointer for each one. Once the pointer goes beyond the end of the buffer,
the count will go negative, but since it's an unsigned type it will be
seen as excessively huge instead. This should not be a problem, as there's
no reason for ZDoom to be using text buffers larger than 2 GB anywhere.
- Ripped out the disabled bit from FGameConfigFile::MigrateOldConfig().
- Changed CalcMapName() to return an FString instead of a pointer to a static
buffer.
- Changed startmap in d_main.cpp into an FString.
- Changed CheckWarpTransMap() to take an FString& as the first argument.
- Changed d_mapname in g_level.cpp into an FString.
- Changed DoSubstitution() in ct_chat.cpp to place the substitutions in an
FString.
- Fixed: The MAPINFO parser wrote into the string buffer to construct a map
name when given a Hexen map number. This was fine with the old scanner
code, but only a happy coincidence prevents it from crashing with the new
code.
- Added the 'B' conversion specifier to StringFormat::VWorker() for printing
binary numbers.
- Added CMake support for building with MinGW, MSYS, and NMake. Linux support
is probably broken until I get around to booting into Linux again. Niceties
provided over the existing Makefiles they're replacing:
* All command-line builds can use the same build system, rather than having
a separate one for MinGW and another for Linux.
* Microsoft's NMake tool is supported as a target.
* Progress meters.
* Parallel makes work from a fresh checkout without needing to be primed
first with a single-threaded make.
* Porting to other architectures should be simplified, whenever that day
comes.
- Replaced the makewad tool with zipdir. This handles the dependency tracking
itself instead of generating an external makefile to do it, since I couldn't
figure out how to generate a makefile with an external tool and include it
with a CMake-generated makefile. Where makewad used a master list of files
to generate the package file, zipdir just zips the entire contents of one or
more directories.
git-svn-id: http://mancubus.net/svn/hosted/gzdoom/trunk@138 b0f79afe-0144-0410-b225-9a4edf0717df
2008-07-23 18:35:55 +00:00
|
|
|
void FormatGUID (char *buffer, size_t buffsize, const GUID &guid);
|
2008-01-27 11:25:03 +00:00
|
|
|
|
|
|
|
const char *myasctime ();
|
|
|
|
|
2008-01-27 15:34:47 +00:00
|
|
|
int strbin (char *str);
|
2008-12-07 17:48:36 +00:00
|
|
|
FString strbin1 (const char *start);
|
2009-02-21 17:07:32 +00:00
|
|
|
void CleanseString (char *str);
|
2008-01-27 11:25:03 +00:00
|
|
|
|
|
|
|
void CreatePath(const char * fn);
|
|
|
|
|
2008-12-07 16:38:02 +00:00
|
|
|
FString ExpandEnvVars(const char *searchpathstring);
|
2009-02-08 23:01:13 +00:00
|
|
|
FString NicePath(const char *path);
|
2008-12-07 16:38:02 +00:00
|
|
|
|
2010-08-27 17:42:01 +00:00
|
|
|
struct FFileList
|
|
|
|
{
|
|
|
|
FString Filename;
|
|
|
|
bool isDirectory;
|
|
|
|
};
|
|
|
|
|
|
|
|
void ScanDirectory(TArray<FFileList> &list, const char *dirpath);
|
|
|
|
|
2008-01-27 11:25:03 +00:00
|
|
|
#endif
|