gzdoom-last-svn/src/configfile.h

129 lines
4.3 KiB
C
Raw Normal View History

/*
** configfile.h
**
**---------------------------------------------------------------------------
Update to ZDoom r1312: - Fixed: The save percentage for Doom's green armor was slightly too low which caused roundoff errors that made it less than 1/3 effective. - Added support for "RRGGBB" strings to V_GetColor. - Fixed: Desaturation maps for the TEXTURES lump were calculated incorrectly. - Changed GetSpriteIndex to cache the last used sprite name so that the code using this function doesn't have to do it itself. - Moved some more code for the state parser into p_states.cpp. - Fixed: TDeletingArray should not try to delete NULL pointers. - Added binary (b) and hexadecimal (x) cast types for ACS's various print statements. - Added ClassifyActor(tid) ACS builtin function. This takes a TID and returns a set of bits describing the actor. If TID is 0, it returns information about the activator. If there is more than one actor with the given TID, only the first one is considered. Currently defined bits are: ACTOR_NONE No actors with this TID exist (only when TID is not 0). ACTOR_WORLD Activator is the world (only when TID is 0). ACTOR_PLAYER Actor is a player (includes bots and voodoo dolls). ACTOR_BOT Actor is a bot. ACTOR_VOODOODOLL Actor is a voodoo doll. ACTOR_MONSTER Actor is a monster. ACTOR_ALIVE Actor is alive (players/monsters only). ACTOR_DEAD Actor is dead (players/monsters only). ACTOR_MISSILE Actor is a missile. ACTOR_GENERIC Actor exists, but no further information is available. - Moved ExpandEnvVars() from d_main.cpp to cmdlib.cpp. - AutoExec paths now support the same variable expansion as the search paths. Additionally, on Windows, the default autoexec path is now relative to $PROGDIR, rather than using a fixed path to the executable's current directory. - All usable Autoload and AutoExec sections are now created at the top of the config file along with some brief explanatory notes so they are readily visible to anyone who wants to edit them. git-svn-id: http://mancubus.net/svn/hosted/gzdoom/trunk@254 b0f79afe-0144-0410-b225-9a4edf0717df
2008-12-07 16:38:02 +00:00
** Copyright 1998-2008 Randy Heit
** 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"
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; }
Update to ZDoom r1312: - Fixed: The save percentage for Doom's green armor was slightly too low which caused roundoff errors that made it less than 1/3 effective. - Added support for "RRGGBB" strings to V_GetColor. - Fixed: Desaturation maps for the TEXTURES lump were calculated incorrectly. - Changed GetSpriteIndex to cache the last used sprite name so that the code using this function doesn't have to do it itself. - Moved some more code for the state parser into p_states.cpp. - Fixed: TDeletingArray should not try to delete NULL pointers. - Added binary (b) and hexadecimal (x) cast types for ACS's various print statements. - Added ClassifyActor(tid) ACS builtin function. This takes a TID and returns a set of bits describing the actor. If TID is 0, it returns information about the activator. If there is more than one actor with the given TID, only the first one is considered. Currently defined bits are: ACTOR_NONE No actors with this TID exist (only when TID is not 0). ACTOR_WORLD Activator is the world (only when TID is 0). ACTOR_PLAYER Actor is a player (includes bots and voodoo dolls). ACTOR_BOT Actor is a bot. ACTOR_VOODOODOLL Actor is a voodoo doll. ACTOR_MONSTER Actor is a monster. ACTOR_ALIVE Actor is alive (players/monsters only). ACTOR_DEAD Actor is dead (players/monsters only). ACTOR_MISSILE Actor is a missile. ACTOR_GENERIC Actor exists, but no further information is available. - Moved ExpandEnvVars() from d_main.cpp to cmdlib.cpp. - AutoExec paths now support the same variable expansion as the search paths. Additionally, on Windows, the default autoexec path is now relative to $PROGDIR, rather than using a fixed path to the executable's current directory. - All usable Autoload and AutoExec sections are now created at the top of the config file along with some brief explanatory notes so they are readily visible to anyone who wants to edit them. git-svn-id: http://mancubus.net/svn/hosted/gzdoom/trunk@254 b0f79afe-0144-0410-b225-9a4edf0717df
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);
bool SetSection (const char *section, bool allowCreate=false);
bool SetFirstSection ();
bool SetNextSection ();
const char *GetCurrentSection () const;
void ClearCurrentSection ();
Update to ZDoom r1433: - Fixed: Untranslated colors in fonts had an alpha value of 0 but need 255. - Fixed: The Doom status bar's ammo display may not use the INDEXFONT for the alternative HUD. Instead it has to create a separate one out of the STYSNUM characters. - Fixed: skins can not be sorted for binary search because the player class code depends on the original indices. - Fixed: P_StartConversation set the global dialog node variable for all players, not just the consoleplayer. - Fixed: AWeapon::PickupForAmmo assumed that any weapon having a secondary ammo type also has a primary one. - Bumped netgame, demo and min demo version for the weapon slot changes. - changed weapon slots to be stored per player. Information is now transmitted across the network so that all machines know each player's current weapon configuration so that it can be used by cheats or HUD display routines. - fixed: level_info_t::mapbg was not initialized - Fixed: Player names and chat macros that end with incomplete \c escapes now have those escapes stripped before printing so that they do not merge with subsequent text. - Fixed: The CHARFORMAT structure that is used to set the color in a Windows Rich Edit control was not fully initialized resulting in incorrect colors being set. - Moved default weapon slot assignments into the player classes. Weapon.SlotNumber is now used solely for mods that want to add new weapons without completely redoing the player's arsenal. Restored some config-based weapon slot customization, though slots are no longer automatically saved to the config and section names have changed slightly. However, unlike before, config slots are now the definitive word on slot assignments and cannot be overridden by any other files loaded. git-svn-id: http://mancubus.net/svn/hosted/gzdoom/trunk@302 b0f79afe-0144-0410-b225-9a4edf0717df
2009-02-21 17:07:32 +00:00
bool DeleteCurrentSection ();
Update to ZDoom r1418: - Fixed parsing for MustConfirm key in skill parser. - Converted internal MAPINFOs to new syntax. - Added a range parameter to SNDINFO's $limit. - Restored Dehacked music name replacement. - Added GUICapture mouse events for Win32. - Changed I_GetFromClipboard() to return an FString. - Added GTK+-based clipboard support for Linux. - Fixed: Most Linux filesystems do not fill in d_type for scandir(), so we cannot rely on it to detect directories. - Added NicePath() function to perform shell-style ~ substitution on path names. - Changed the default screenshot directory on Unix to ~/.zdoom/screenshots/. - Added -shotdir command line option to temporarily override the screenshot_dir cvar. - Fixed: G_SerializeLevel must use the TEXMAN_ReturnFirst flag for getting the sky textures so that it still works when the first texture in a TEXTURE1 lump is used as sky. - Restored the old drawseg/sprite distance check from 2.0.63. The code that replaced it did the check at the center of the area intersected by the sprite and the drawseg, whereas 2.0.63 only did the check at the location of the sprite on the map. - Commented out the CALL_ACTION(A_Look, actor) for targetless friendly monsters in A_DoChase(). They can still find new targets without this, and with it, they got stuck on the first frame of their see state. - Fixed: Keys bound in a custom key section would unbind the key in the main game section. - Fixed scrolling of the automap background on a rotated automap. - Changed singleplayer allowrespawn to act like a co-op game when you change levels while dead by immediately respawning you before the switch so that you get to keep all your inventory. - Fixed: G_InitLevelLocals() did not set flags2. - fixed: The compatibility parser applied the last map's settings to all maps in the compatibility list. - Added compatibility settings for a few more levels in some classic WADs. - Added spechit overflow workaround for Strain MAP07. This is highly map specific because the original behavior cannot be restored. - Added a check for Doom's IWAD levels that forces COMPAT_SHORTTEX for them. MD5 cannot be used well here because there's many different IWADs with slightly different levels. This is only done for Doom format levels to ensure that custom IWADs for ZDoom are not affected. - fixed: level.flags2 was not reset at level start. - Fixed: Morph powerups can change the actor picking up the item so AInventory::CallTryPickup must be able to return the new actor. - Fixed: ACS's GiveInventory may not assume that a PlayerPawn is still attached to the player data after an item has been given. - Added a missing NULL pointer check to DBaseStatusBar::Blendview. - Added a compatibility lump because I think it's a shame that Void doesn't work properly on new ZDooms after all the collaboration I had with Cyb on that map. (Works with other maps, too.) git-svn-id: http://mancubus.net/svn/hosted/gzdoom/trunk@298 b0f79afe-0144-0410-b225-9a4edf0717df
2009-02-08 23:01:13 +00:00
void ClearKey (const char *key);
Update to ZDoom r1312: - Fixed: The save percentage for Doom's green armor was slightly too low which caused roundoff errors that made it less than 1/3 effective. - Added support for "RRGGBB" strings to V_GetColor. - Fixed: Desaturation maps for the TEXTURES lump were calculated incorrectly. - Changed GetSpriteIndex to cache the last used sprite name so that the code using this function doesn't have to do it itself. - Moved some more code for the state parser into p_states.cpp. - Fixed: TDeletingArray should not try to delete NULL pointers. - Added binary (b) and hexadecimal (x) cast types for ACS's various print statements. - Added ClassifyActor(tid) ACS builtin function. This takes a TID and returns a set of bits describing the actor. If TID is 0, it returns information about the activator. If there is more than one actor with the given TID, only the first one is considered. Currently defined bits are: ACTOR_NONE No actors with this TID exist (only when TID is not 0). ACTOR_WORLD Activator is the world (only when TID is 0). ACTOR_PLAYER Actor is a player (includes bots and voodoo dolls). ACTOR_BOT Actor is a bot. ACTOR_VOODOODOLL Actor is a voodoo doll. ACTOR_MONSTER Actor is a monster. ACTOR_ALIVE Actor is alive (players/monsters only). ACTOR_DEAD Actor is dead (players/monsters only). ACTOR_MISSILE Actor is a missile. ACTOR_GENERIC Actor exists, but no further information is available. - Moved ExpandEnvVars() from d_main.cpp to cmdlib.cpp. - AutoExec paths now support the same variable expansion as the search paths. Additionally, on Windows, the default autoexec path is now relative to $PROGDIR, rather than using a fixed path to the executable's current directory. - All usable Autoload and AutoExec sections are now created at the top of the config file along with some brief explanatory notes so they are readily visible to anyone who wants to edit them. git-svn-id: http://mancubus.net/svn/hosted/gzdoom/trunk@254 b0f79afe-0144-0410-b225-9a4edf0717df
2008-12-07 16:38:02 +00:00
bool SectionIsEmpty ();
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);
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;
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;
Update to ZDoom r1312: - Fixed: The save percentage for Doom's green armor was slightly too low which caused roundoff errors that made it less than 1/3 effective. - Added support for "RRGGBB" strings to V_GetColor. - Fixed: Desaturation maps for the TEXTURES lump were calculated incorrectly. - Changed GetSpriteIndex to cache the last used sprite name so that the code using this function doesn't have to do it itself. - Moved some more code for the state parser into p_states.cpp. - Fixed: TDeletingArray should not try to delete NULL pointers. - Added binary (b) and hexadecimal (x) cast types for ACS's various print statements. - Added ClassifyActor(tid) ACS builtin function. This takes a TID and returns a set of bits describing the actor. If TID is 0, it returns information about the activator. If there is more than one actor with the given TID, only the first one is considered. Currently defined bits are: ACTOR_NONE No actors with this TID exist (only when TID is not 0). ACTOR_WORLD Activator is the world (only when TID is 0). ACTOR_PLAYER Actor is a player (includes bots and voodoo dolls). ACTOR_BOT Actor is a bot. ACTOR_VOODOODOLL Actor is a voodoo doll. ACTOR_MONSTER Actor is a monster. ACTOR_ALIVE Actor is alive (players/monsters only). ACTOR_DEAD Actor is dead (players/monsters only). ACTOR_MISSILE Actor is a missile. ACTOR_GENERIC Actor exists, but no further information is available. - Moved ExpandEnvVars() from d_main.cpp to cmdlib.cpp. - AutoExec paths now support the same variable expansion as the search paths. Additionally, on Windows, the default autoexec path is now relative to $PROGDIR, rather than using a fixed path to the executable's current directory. - All usable Autoload and AutoExec sections are now created at the top of the config file along with some brief explanatory notes so they are readily visible to anyone who wants to edit them. git-svn-id: http://mancubus.net/svn/hosted/gzdoom/trunk@254 b0f79afe-0144-0410-b225-9a4edf0717df
2008-12-07 16:38:02 +00:00
FString Note;
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);
Update to ZDoom r1312: - Fixed: The save percentage for Doom's green armor was slightly too low which caused roundoff errors that made it less than 1/3 effective. - Added support for "RRGGBB" strings to V_GetColor. - Fixed: Desaturation maps for the TEXTURES lump were calculated incorrectly. - Changed GetSpriteIndex to cache the last used sprite name so that the code using this function doesn't have to do it itself. - Moved some more code for the state parser into p_states.cpp. - Fixed: TDeletingArray should not try to delete NULL pointers. - Added binary (b) and hexadecimal (x) cast types for ACS's various print statements. - Added ClassifyActor(tid) ACS builtin function. This takes a TID and returns a set of bits describing the actor. If TID is 0, it returns information about the activator. If there is more than one actor with the given TID, only the first one is considered. Currently defined bits are: ACTOR_NONE No actors with this TID exist (only when TID is not 0). ACTOR_WORLD Activator is the world (only when TID is 0). ACTOR_PLAYER Actor is a player (includes bots and voodoo dolls). ACTOR_BOT Actor is a bot. ACTOR_VOODOODOLL Actor is a voodoo doll. ACTOR_MONSTER Actor is a monster. ACTOR_ALIVE Actor is alive (players/monsters only). ACTOR_DEAD Actor is dead (players/monsters only). ACTOR_MISSILE Actor is a missile. ACTOR_GENERIC Actor exists, but no further information is available. - Moved ExpandEnvVars() from d_main.cpp to cmdlib.cpp. - AutoExec paths now support the same variable expansion as the search paths. Additionally, on Windows, the default autoexec path is now relative to $PROGDIR, rather than using a fixed path to the executable's current directory. - All usable Autoload and AutoExec sections are now created at the top of the config file along with some brief explanatory notes so they are readily visible to anyone who wants to edit them. git-svn-id: http://mancubus.net/svn/hosted/gzdoom/trunk@254 b0f79afe-0144-0410-b225-9a4edf0717df
2008-12-07 16:38:02 +00:00
void SetSectionNote (FConfigSection *section, const char *note);
public:
class Position
{
friend class FConfigFile;
FConfigSection *Section;
FConfigEntry *Entry;
};
void GetPosition (Position &pos) const;
void SetPosition (const Position &pos);
};
#endif //__CONFIGFILE_H__