2008-01-27 11:25:03 +00:00
|
|
|
/*
|
|
|
|
** configfile.h
|
|
|
|
**
|
|
|
|
**---------------------------------------------------------------------------
|
2008-12-07 16:38:02 +00:00
|
|
|
** Copyright 1998-2008 Randy Heit
|
2008-01-27 11:25:03 +00:00
|
|
|
** All rights reserved.
|
|
|
|
**
|
|
|
|
** Redistribution and use in source and binary forms, with or without
|
|
|
|
** modification, are permitted provided that the following conditions
|
|
|
|
** are met:
|
|
|
|
**
|
|
|
|
** 1. Redistributions of source code must retain the above copyright
|
|
|
|
** notice, this list of conditions and the following disclaimer.
|
|
|
|
** 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
** notice, this list of conditions and the following disclaimer in the
|
|
|
|
** documentation and/or other materials provided with the distribution.
|
|
|
|
** 3. The name of the author may not be used to endorse or promote products
|
|
|
|
** derived from this software without specific prior written permission.
|
|
|
|
**
|
|
|
|
** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
|
|
** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
|
|
** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
|
|
** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
|
|
** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
|
|
** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
**---------------------------------------------------------------------------
|
|
|
|
**
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __CONFIGFILE_H__
|
|
|
|
#define __CONFIGFILE_H__
|
|
|
|
|
Update to ZDoom r1017:
- Fixed: MAPINFO's 'lookup' option should only work for actual strings but
not for lump and file names.
- Added a few 'activator == NULL' checks to some ACS functions.
- Added line and vertex lists to polyobjects so that I can do some
changes that won't work with only a seg list being maintained.
(SBarInfo update #23)
- Fixed: Drawing the amount of an inventory item in the player's inventory did
not work
- Added: PowerupTime to drawnumber and drawbar. You must specify a
powerupgiver. Although drawnumber goes in seconds the powerup has left
drawbar will use ticks for extra accuracy.
- I have increased cross-port compatibility with Skulltag. If an unknown
game mode is provided for sbarinfo's gamemode command it will ignore it and
continue.
- Added an option to consider intermission screens gameplay for purposes of
capturing the mouse.
- Changed: Telefragging should not thrust the victim if it isn't in precisely the
same position as the killer.
- fixed: A_SpawnItemEx must call P_TeleportMove before checking the spawned
object's position.
- Fixed: Ouch state was far to easy to achieve.
- Made all the basic texture classes local to their implementation.
They are not needed anywhere else.
- Changed the HackHack hack for corrupt 256 pixel high textures that
FMultiPatchTexture only calls a virtual function instead of doing any
type checks of the patch itself.
- Cleaned up the constant definitions in doomdata.h.
- Moved the TEXTUREx structures from doomdata.h to multipatchtexture.cpp
because they are used only in this one file.
- Removed some more typedefs from r_defs.h and doomdata.h
- Moved local polyobject data definitions from p_local.h to po_man.cpp.
- Renamed player_s to player_t globally to get rid of the duplicate names
for this class.
- Added coordinate range checking to DCanvas::ParseDrawTextureTags() to avoid
potential crashes in the situation that con_scaletext is 2 and somebody
uses a hud message as if a hud size was specified, but forgot to actually
set the hud size.
- Consolidated the mug shot code shared by DSBarInfo and DDoomStatusBar
into a single place.
- Fixed: Setting an invalid mug shot state crashed the game.
- Fixed my attempts to be clever with strings yesterday.
- If an actor's current target temporarily goes unshootable, its threshold
is now reset to 0, so it will more readily switch back to it.
- Fixed: Deactivating the game no longer allows reverb effects to continue
playing while the sound is paused.
- Fixed: S_StartNamedSound() looked for SECF_SILENT in MoreFlags instead of
Flags.
- Fixed: DSBarInfo::updateState() and DDoomStatusBar::UpdateState() sprung
leaks and didn't allocate enough space for the fullStateName string.
- Disabled DUMB's mono destination mixers. It's not like I'm ever going to
target an original SoundBlaster, so they're a waste of space to have around.
This trims resample.obj down to ~60k now.
- Fixed: PrtScn/SysRq key did not work on Linux.
- Added an alternate module replay engine that uses foo_dumb's replayer, a
heavily customized version of DUMB (Dynamic Universal Music Bibliotheque).
It has been slightly modified by me:
* Added support for Ogg Vorbis-compressed samples in XM files ala FMOD.
* Removed excessive mallocs from the replay core.
* Rerolled the loops in resample.c. Unrolling them made the object file
~250k large while providing little benefit. Even at ~100k, I think it's
still larger than it ought to be, but I'll live with it for now.
Other than that, it's essentially the same thing you'd hear in foobar2000,
minus some subsong detection features. Release builds of the library look
like they might even be slightly faster than FMOD, which is a plus.
- Fixed: Timidity::font_add() did not release the file reader it created.
- Fixed: The SF2 loader did not free the sample headers in its destructor.
git-svn-id: http://mancubus.net/svn/hosted/gzdoom/trunk@113 b0f79afe-0144-0410-b225-9a4edf0717df
2008-06-03 21:48:49 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include "zstring.h"
|
|
|
|
|
2008-01-27 11:25:03 +00:00
|
|
|
class FConfigFile
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
FConfigFile ();
|
|
|
|
FConfigFile (const char *pathname,
|
|
|
|
void (*nosechandler)(const char *pathname, FConfigFile *config, void *userdata)=0, void *userdata=NULL);
|
|
|
|
FConfigFile (const FConfigFile &other);
|
|
|
|
virtual ~FConfigFile ();
|
|
|
|
|
|
|
|
void ClearConfig ();
|
|
|
|
FConfigFile &operator= (const FConfigFile &other);
|
|
|
|
|
|
|
|
bool HaveSections () { return Sections != NULL; }
|
2008-12-07 16:38:02 +00:00
|
|
|
void CreateSectionAtStart (const char *name);
|
|
|
|
void MoveSectionToStart (const char *name);
|
|
|
|
void SetSectionNote (const char *section, const char *note);
|
|
|
|
void SetSectionNote (const char *note);
|
2008-01-27 11:25:03 +00:00
|
|
|
bool SetSection (const char *section, bool allowCreate=false);
|
|
|
|
bool SetFirstSection ();
|
|
|
|
bool SetNextSection ();
|
|
|
|
const char *GetCurrentSection () const;
|
|
|
|
void ClearCurrentSection ();
|
2009-02-21 17:07:32 +00:00
|
|
|
bool DeleteCurrentSection ();
|
2009-02-08 23:01:13 +00:00
|
|
|
void ClearKey (const char *key);
|
2008-01-27 11:25:03 +00:00
|
|
|
|
2008-12-07 16:38:02 +00:00
|
|
|
bool SectionIsEmpty ();
|
2008-01-27 11:25:03 +00:00
|
|
|
bool NextInSection (const char *&key, const char *&value);
|
|
|
|
const char *GetValueForKey (const char *key) const;
|
|
|
|
void SetValueForKey (const char *key, const char *value, bool duplicates=false);
|
|
|
|
|
|
|
|
const char *GetPathName () const { return PathName.GetChars(); }
|
|
|
|
void ChangePathName (const char *path);
|
|
|
|
|
|
|
|
void LoadConfigFile (void (*nosechandler)(const char *pathname, FConfigFile *config, void *userdata), void *userdata);
|
|
|
|
bool WriteConfigFile () const;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual void WriteCommentHeader (FILE *file) const;
|
|
|
|
|
|
|
|
virtual char *ReadLine (char *string, int n, void *file) const;
|
|
|
|
bool ReadConfig (void *file);
|
|
|
|
|
2012-05-29 14:47:06 +00:00
|
|
|
bool OkayToWrite;
|
- Update to ZDoom r3751:
Added the item flag IF_RESTRICTABSOLUTELY. When this is set, players of the wrong class cannot pickup an item at all. (For instance, normally players in Hexen can still pick up other players' weapons for ammo. With this flag set, they cannot do that either.)
The complete FMapThing is overkill for storing player starts, so use a new minimal structure for them.
Added MAPINFO flag RandomPlayerStarts. In this mode, no voodoo dolls are spawned. Instead, all player starts are added to a pool, and players spawn at a random spot.
Pass playernum as a parameter to P_SpawnPlayer(). Now P_SpawnMapThing() is the only thing that uses the MapThing's type to determine the which player is spawning.
Fix some GCC 4.7.1 warnings.
Added UsePlayerStartZ MAPINFO option to cause P_SpawnPlayer() to offset the spawned player's Z position by the MapThing's Z, just like for any other MapThing.
P_SpawnPlayer() now respects a player's SPAWNCEILING and SPAWNFLOAT flags.
Fixed: MF6_BUMPSPECIAL only worked when bumped from X/Y movement but not Z movement.
Make floatbobbing a purely cosmetic effect that does not alter an actor's real position in the world.
We don't need to keep the FloatBobOffsets[] verison of DoWaggle around.
What I didn't have this saved? ugh
Fixed: The action function version of ACS_NamedExecuteWithResult only accepted three script parameters.
Fixed: Editing the player (thing #1) with DeHacked would remove its MF2_PUSHWALL flag.
This was not supposed to be committed as part of r3737.
Don't use abbreviations in exception descriptions.
Do do not disable config writing before DoGameSetup() (introduced in r3653) if the config file does not already exist. This way, we can create a default config file without removing anything from an existing config file if things go wrong early during setup.
Added Hacx 2.0 detection.
Let's go ahead and bump the version in trunk.
Do not set the mouse pointer if the display is 8 bit, since such displays don't support color cursors.
Fixed: DDrawFB should not recreate all its resources when the palette changes if we were the one responsible for the palette change.
Fixed: DDrawFB::CreateSurfacesComplex() starting tries at 2 instead of 0 is not "debugging cruft" since it counts down, not up. (Partially reverts r3195)
Fixed: ACS function pointer instructions need to call GetFunction on the tagged module instead of the active behavior.
Added support for Eternity Engine's function pointer ACS instructions. (Note that an alternative ACS compiler is necessary to use these instructions properly.)
git-svn-id: http://mancubus.net/svn/hosted/gzdoom/trunk@1420 b0f79afe-0144-0410-b225-9a4edf0717df
2012-07-08 08:24:45 +00:00
|
|
|
bool FileExisted;
|
2012-05-29 14:47:06 +00:00
|
|
|
|
2008-01-27 11:25:03 +00:00
|
|
|
private:
|
|
|
|
struct FConfigEntry
|
|
|
|
{
|
|
|
|
char *Value;
|
|
|
|
FConfigEntry *Next;
|
|
|
|
char Key[1]; // + length of key
|
|
|
|
|
|
|
|
void SetValue (const char *val);
|
|
|
|
};
|
|
|
|
struct FConfigSection
|
|
|
|
{
|
|
|
|
FConfigEntry *RootEntry;
|
|
|
|
FConfigEntry **LastEntryPtr;
|
|
|
|
FConfigSection *Next;
|
2008-12-07 16:38:02 +00:00
|
|
|
FString Note;
|
2008-01-27 11:25:03 +00:00
|
|
|
char Name[1]; // + length of name
|
|
|
|
};
|
|
|
|
|
|
|
|
FConfigSection *Sections;
|
|
|
|
FConfigSection **LastSectionPtr;
|
|
|
|
FConfigSection *CurrentSection;
|
|
|
|
FConfigEntry *CurrentEntry;
|
|
|
|
FString PathName;
|
|
|
|
|
|
|
|
FConfigSection *FindSection (const char *name) const;
|
|
|
|
FConfigEntry *FindEntry (FConfigSection *section, const char *key) const;
|
|
|
|
FConfigSection *NewConfigSection (const char *name);
|
|
|
|
FConfigEntry *NewConfigEntry (FConfigSection *section, const char *key, const char *value);
|
2008-12-07 16:38:02 +00:00
|
|
|
void SetSectionNote (FConfigSection *section, const char *note);
|
2008-01-27 11:25:03 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
class Position
|
|
|
|
{
|
|
|
|
friend class FConfigFile;
|
|
|
|
|
|
|
|
FConfigSection *Section;
|
|
|
|
FConfigEntry *Entry;
|
|
|
|
};
|
|
|
|
|
|
|
|
void GetPosition (Position &pos) const;
|
|
|
|
void SetPosition (const Position &pos);
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif //__CONFIGFILE_H__
|