mirror of
https://github.com/ZDoom/gzdoom-last-svn.git
synced 2025-05-31 01:10:52 +00:00
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
128 lines
4.3 KiB
C++
128 lines
4.3 KiB
C++
/*
|
|
** configfile.h
|
|
**
|
|
**---------------------------------------------------------------------------
|
|
** 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__
|
|
|
|
#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; }
|
|
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 ();
|
|
bool DeleteCurrentSection ();
|
|
void ClearKey (const char *key);
|
|
|
|
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;
|
|
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;
|
|
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);
|
|
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__
|