2016-03-01 15:47:10 +00:00
|
|
|
/*
|
|
|
|
** p_udmf.cpp
|
|
|
|
**
|
|
|
|
** UDMF text map parser
|
|
|
|
**
|
|
|
|
**---------------------------------------------------------------------------
|
|
|
|
** Copyright 2008 Christoph Oelckers
|
|
|
|
** 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.
|
|
|
|
**---------------------------------------------------------------------------
|
|
|
|
**
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "doomstat.h"
|
|
|
|
#include "p_setup.h"
|
|
|
|
#include "p_lnspec.h"
|
|
|
|
#include "i_system.h"
|
|
|
|
#include "gi.h"
|
|
|
|
#include "r_sky.h"
|
|
|
|
#include "g_level.h"
|
|
|
|
#include "p_udmf.h"
|
|
|
|
#include "r_state.h"
|
|
|
|
#include "w_wad.h"
|
|
|
|
#include "p_tags.h"
|
|
|
|
#include "p_terrain.h"
|
2017-06-04 16:03:04 +00:00
|
|
|
#include "p_spec.h"
|
2017-01-08 17:45:30 +00:00
|
|
|
#include "g_levellocals.h"
|
2017-03-10 01:22:42 +00:00
|
|
|
#include "info.h"
|
2017-04-12 23:12:04 +00:00
|
|
|
#include "vm.h"
|
2016-03-01 15:47:10 +00:00
|
|
|
|
|
|
|
//===========================================================================
|
|
|
|
//
|
|
|
|
// Maps for Hexen namespace need to filter out all extended line and sector
|
|
|
|
// specials to comply with the spec.
|
|
|
|
//
|
|
|
|
//===========================================================================
|
|
|
|
|
|
|
|
static char HexenLineSpecialOk[]={
|
|
|
|
1,1,1,1,1,1,1,1,1,0, // 0-9
|
|
|
|
1,1,1,1,0,0,0,0,0,0, // 10-19
|
|
|
|
1,1,1,1,1,1,1,1,1,1, // 20-29
|
|
|
|
1,1,1,0,0,1,1,0,0,0, // 30-39
|
|
|
|
1,1,1,1,1,1,1,0,0,0, // 40-49
|
|
|
|
0,0,0,0,0,0,0,0,0,0, // 50-59
|
|
|
|
1,1,1,1,1,1,1,1,1,1, // 60-69
|
|
|
|
1,1,1,1,1,1,0,0,0,0, // 70-79
|
|
|
|
1,1,1,1,0,0,0,0,0,0, // 80-89
|
|
|
|
1,1,1,1,1,1,1,0,0,0, // 90-99
|
|
|
|
1,1,1,1,0,0,0,0,0,1, // 100-109
|
|
|
|
1,1,1,1,1,1,1,0,0,0, // 110-119
|
|
|
|
1,0,0,0,0,0,0,0,0,1, // 120-129
|
|
|
|
1,1,1,1,1,1,1,1,1,0, // 130-139
|
|
|
|
1
|
|
|
|
// 140 is the highest valid special in Hexen.
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
static char HexenSectorSpecialOk[256]={
|
|
|
|
1,1,1,1,1,0,0,0,0,0,
|
|
|
|
0,0,0,0,0,0,0,0,0,0,
|
|
|
|
0,0,0,0,0,0,1,1,0,0,
|
|
|
|
0,0,0,0,0,0,0,0,0,0,
|
|
|
|
1,1,1,1,1,1,1,1,1,1,
|
|
|
|
1,1,0,0,0,0,0,0,0,0,
|
|
|
|
0,0,0,0,0,0,0,0,0,0,
|
|
|
|
0,0,0,0,0,0,0,0,0,0,
|
|
|
|
0,0,0,0,0,0,0,0,0,0,
|
|
|
|
0,0,0,0,0,0,0,0,0,0,
|
|
|
|
0,0,0,0,0,0,0,0,0,0,
|
|
|
|
0,0,0,0,0,0,0,0,0,0,
|
|
|
|
0,0,0,0,0,0,0,0,0,0,
|
|
|
|
0,0,0,0,0,0,0,0,0,0,
|
|
|
|
0,0,0,0,0,0,0,0,0,0,
|
|
|
|
0,0,0,0,0,0,0,0,0,0,
|
|
|
|
0,0,0,0,0,0,0,0,0,0,
|
|
|
|
0,0,0,0,0,0,0,0,0,0,
|
|
|
|
0,0,0,0,0,0,0,0,1,1,
|
|
|
|
1,1,1,1,1,1,1,1,1,1,
|
|
|
|
1,1,1,1,1,
|
|
|
|
};
|
|
|
|
|
|
|
|
static inline bool P_IsThingSpecial(int specnum)
|
|
|
|
{
|
|
|
|
return (specnum >= Thing_Projectile && specnum <= Thing_SpawnNoFog) ||
|
2016-03-04 15:23:40 +00:00
|
|
|
specnum == Thing_SpawnFacing || specnum == Thing_ProjectileIntercept || specnum == Thing_ProjectileAimed;
|
2016-03-01 15:47:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
Dm=1,
|
|
|
|
Ht=2,
|
|
|
|
Hx=4,
|
|
|
|
St=8,
|
|
|
|
Zd=16,
|
|
|
|
Zdt=32,
|
|
|
|
Va=64,
|
|
|
|
|
|
|
|
// will be extended later. Unknown namespaces will always be treated like the base
|
|
|
|
// namespace for each game
|
|
|
|
};
|
|
|
|
|
|
|
|
void SetTexture (sector_t *sector, int index, int position, const char *name, FMissingTextureTracker &, bool truncate);
|
|
|
|
void P_ProcessSideTextures(bool checktranmap, side_t *sd, sector_t *sec, intmapsidedef_t *msd, int special, int tag, short *alpha, FMissingTextureTracker &);
|
|
|
|
void P_AdjustLine (line_t *ld);
|
|
|
|
void P_FinishLoadingLineDef(line_t *ld, int alpha);
|
|
|
|
void SpawnMapThing(int index, FMapThing *mt, int position);
|
|
|
|
extern bool ForceNodeBuild;
|
|
|
|
extern TArray<FMapThing> MapThingsConverted;
|
|
|
|
extern TArray<int> linemap;
|
|
|
|
|
|
|
|
|
|
|
|
#define CHECK_N(f) if (!(namespace_bits&(f))) break;
|
|
|
|
|
|
|
|
|
|
|
|
//===========================================================================
|
|
|
|
//
|
|
|
|
// Common parsing routines
|
|
|
|
//
|
|
|
|
//===========================================================================
|
|
|
|
|
|
|
|
//===========================================================================
|
|
|
|
//
|
|
|
|
// Skip a key or block
|
|
|
|
//
|
|
|
|
//===========================================================================
|
|
|
|
|
|
|
|
void UDMFParserBase::Skip()
|
|
|
|
{
|
2016-08-28 07:55:04 +00:00
|
|
|
if (developer >= DMSG_WARNING) sc.ScriptMessage("Ignoring unknown UDMF key \"%s\".", sc.String);
|
2016-03-01 15:47:10 +00:00
|
|
|
if(sc.CheckToken('{'))
|
|
|
|
{
|
|
|
|
int level = 1;
|
|
|
|
while(sc.GetToken())
|
|
|
|
{
|
|
|
|
if (sc.TokenType == '}')
|
|
|
|
{
|
|
|
|
level--;
|
|
|
|
if(level == 0)
|
|
|
|
{
|
|
|
|
sc.UnGet();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (sc.TokenType == '{')
|
|
|
|
{
|
|
|
|
level++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sc.MustGetToken('=');
|
|
|
|
do
|
|
|
|
{
|
|
|
|
sc.MustGetAnyToken();
|
|
|
|
}
|
|
|
|
while(sc.TokenType != ';');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//===========================================================================
|
|
|
|
//
|
|
|
|
// Parses a 'key = value' line of the map
|
|
|
|
//
|
|
|
|
//===========================================================================
|
|
|
|
|
|
|
|
FName UDMFParserBase::ParseKey(bool checkblock, bool *isblock)
|
|
|
|
{
|
|
|
|
sc.MustGetString();
|
|
|
|
FName key = sc.String;
|
|
|
|
if (checkblock)
|
|
|
|
{
|
|
|
|
if (sc.CheckToken('{'))
|
|
|
|
{
|
|
|
|
if (isblock) *isblock = true;
|
|
|
|
return key;
|
|
|
|
}
|
|
|
|
else if (isblock) *isblock = false;
|
|
|
|
}
|
|
|
|
sc.MustGetToken('=');
|
|
|
|
|
|
|
|
sc.Number = 0;
|
|
|
|
sc.Float = 0;
|
|
|
|
sc.MustGetAnyToken();
|
|
|
|
|
|
|
|
if (sc.TokenType == '+' || sc.TokenType == '-')
|
|
|
|
{
|
|
|
|
bool neg = (sc.TokenType == '-');
|
|
|
|
sc.MustGetAnyToken();
|
|
|
|
if (sc.TokenType != TK_IntConst && sc.TokenType != TK_FloatConst)
|
|
|
|
{
|
|
|
|
sc.ScriptMessage("Numeric constant expected");
|
|
|
|
}
|
|
|
|
if (neg)
|
|
|
|
{
|
|
|
|
sc.Number = -sc.Number;
|
|
|
|
sc.Float = -sc.Float;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (sc.TokenType == TK_StringConst)
|
|
|
|
{
|
|
|
|
parsedString = sc.String;
|
|
|
|
}
|
|
|
|
int savedtoken = sc.TokenType;
|
|
|
|
sc.MustGetToken(';');
|
|
|
|
sc.TokenType = savedtoken;
|
|
|
|
return key;
|
|
|
|
}
|
|
|
|
|
|
|
|
//===========================================================================
|
|
|
|
//
|
|
|
|
// Syntax checks
|
|
|
|
//
|
|
|
|
//===========================================================================
|
|
|
|
|
|
|
|
int UDMFParserBase::CheckInt(const char *key)
|
|
|
|
{
|
|
|
|
if (sc.TokenType != TK_IntConst)
|
|
|
|
{
|
|
|
|
sc.ScriptMessage("Integer value expected for key '%s'", key);
|
|
|
|
}
|
|
|
|
return sc.Number;
|
|
|
|
}
|
|
|
|
|
|
|
|
double UDMFParserBase::CheckFloat(const char *key)
|
|
|
|
{
|
|
|
|
if (sc.TokenType != TK_IntConst && sc.TokenType != TK_FloatConst)
|
|
|
|
{
|
|
|
|
sc.ScriptMessage("Floating point value expected for key '%s'", key);
|
|
|
|
}
|
|
|
|
return sc.Float;
|
|
|
|
}
|
|
|
|
|
2017-03-23 09:08:48 +00:00
|
|
|
double UDMFParserBase::CheckCoordinate(const char *key)
|
|
|
|
{
|
|
|
|
if (sc.TokenType != TK_IntConst && sc.TokenType != TK_FloatConst)
|
|
|
|
{
|
|
|
|
sc.ScriptMessage("Floating point value expected for key '%s'", key);
|
|
|
|
}
|
|
|
|
if (sc.Float < -32768 || sc.Float > 32768)
|
|
|
|
{
|
2017-03-23 09:19:07 +00:00
|
|
|
sc.ScriptMessage("Value %f out of range for a coordinate '%s'. Valid range is ]-32768 .. 32768]", sc.Float, key);
|
|
|
|
BadCoordinates = true; // If this happens the map must not allowed to be started.
|
2017-03-23 09:08:48 +00:00
|
|
|
}
|
|
|
|
return sc.Float;
|
|
|
|
}
|
|
|
|
|
2016-03-30 14:30:22 +00:00
|
|
|
DAngle UDMFParserBase::CheckAngle(const char *key)
|
2016-03-01 15:47:10 +00:00
|
|
|
{
|
2016-03-30 14:30:22 +00:00
|
|
|
return DAngle(CheckFloat(key)).Normalized360();
|
2016-03-01 15:47:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool UDMFParserBase::CheckBool(const char *key)
|
|
|
|
{
|
|
|
|
if (sc.TokenType == TK_True) return true;
|
|
|
|
if (sc.TokenType == TK_False) return false;
|
|
|
|
sc.ScriptMessage("Boolean value expected for key '%s'", key);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
const char *UDMFParserBase::CheckString(const char *key)
|
|
|
|
{
|
|
|
|
if (sc.TokenType != TK_StringConst)
|
|
|
|
{
|
|
|
|
sc.ScriptMessage("String value expected for key '%s'", key);
|
|
|
|
}
|
|
|
|
return parsedString;
|
|
|
|
}
|
|
|
|
|
|
|
|
//===========================================================================
|
|
|
|
//
|
|
|
|
// Storage of UDMF user properties
|
|
|
|
//
|
|
|
|
//===========================================================================
|
|
|
|
|
|
|
|
typedef TMap<int, FUDMFKeys> FUDMFKeyMap;
|
|
|
|
|
|
|
|
|
|
|
|
static FUDMFKeyMap UDMFKeys[4];
|
|
|
|
// Things must be handled differently
|
|
|
|
|
|
|
|
void P_ClearUDMFKeys()
|
|
|
|
{
|
|
|
|
for(int i=0;i<4;i++)
|
|
|
|
{
|
|
|
|
UDMFKeys[i].Clear();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-04-11 08:46:30 +00:00
|
|
|
static int udmfcmp(const void *a, const void *b)
|
2016-03-01 15:47:10 +00:00
|
|
|
{
|
|
|
|
FUDMFKey *A = (FUDMFKey*)a;
|
|
|
|
FUDMFKey *B = (FUDMFKey*)b;
|
|
|
|
|
|
|
|
return int(A->Key) - int(B->Key);
|
|
|
|
}
|
|
|
|
|
|
|
|
void FUDMFKeys::Sort()
|
|
|
|
{
|
|
|
|
qsort(&(*this)[0], Size(), sizeof(FUDMFKey), udmfcmp);
|
|
|
|
}
|
|
|
|
|
|
|
|
FUDMFKey *FUDMFKeys::Find(FName key)
|
|
|
|
{
|
2016-09-12 19:32:17 +00:00
|
|
|
if (!mSorted)
|
|
|
|
{
|
|
|
|
mSorted = true;
|
|
|
|
Sort();
|
|
|
|
}
|
2016-03-01 15:47:10 +00:00
|
|
|
int min = 0, max = Size()-1;
|
|
|
|
|
|
|
|
while (min <= max)
|
|
|
|
{
|
|
|
|
int mid = (min + max) / 2;
|
|
|
|
if ((*this)[mid].Key == key)
|
|
|
|
{
|
|
|
|
return &(*this)[mid];
|
|
|
|
}
|
|
|
|
else if ((*this)[mid].Key <= key)
|
|
|
|
{
|
|
|
|
min = mid + 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
max = mid - 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
//===========================================================================
|
|
|
|
//
|
|
|
|
// Retrieves UDMF user properties
|
|
|
|
//
|
|
|
|
//===========================================================================
|
|
|
|
|
2017-02-15 00:03:47 +00:00
|
|
|
int GetUDMFInt(int type, int index, FName key)
|
2016-03-01 15:47:10 +00:00
|
|
|
{
|
|
|
|
assert(type >=0 && type <=3);
|
|
|
|
|
|
|
|
FUDMFKeys *pKeys = UDMFKeys[type].CheckKey(index);
|
|
|
|
|
|
|
|
if (pKeys != NULL)
|
|
|
|
{
|
|
|
|
FUDMFKey *pKey = pKeys->Find(key);
|
|
|
|
if (pKey != NULL)
|
|
|
|
{
|
|
|
|
return pKey->IntVal;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2017-02-15 00:03:47 +00:00
|
|
|
double GetUDMFFloat(int type, int index, FName key)
|
2016-03-01 15:47:10 +00:00
|
|
|
{
|
|
|
|
assert(type >=0 && type <=3);
|
|
|
|
|
|
|
|
FUDMFKeys *pKeys = UDMFKeys[type].CheckKey(index);
|
|
|
|
|
|
|
|
if (pKeys != NULL)
|
|
|
|
{
|
|
|
|
FUDMFKey *pKey = pKeys->Find(key);
|
|
|
|
if (pKey != NULL)
|
|
|
|
{
|
2016-03-30 14:30:22 +00:00
|
|
|
return pKey->FloatVal;
|
2016-03-01 15:47:10 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2017-02-15 00:03:47 +00:00
|
|
|
FString GetUDMFString(int type, int index, FName key)
|
|
|
|
{
|
|
|
|
assert(type >= 0 && type <= 3);
|
|
|
|
|
|
|
|
FUDMFKeys *pKeys = UDMFKeys[type].CheckKey(index);
|
|
|
|
|
|
|
|
if (pKeys != NULL)
|
|
|
|
{
|
|
|
|
FUDMFKey *pKey = pKeys->Find(key);
|
|
|
|
if (pKey != NULL)
|
|
|
|
{
|
|
|
|
return pKey->StringVal;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
|
2016-03-01 15:47:10 +00:00
|
|
|
//===========================================================================
|
|
|
|
//
|
|
|
|
// UDMF parser
|
|
|
|
//
|
|
|
|
//===========================================================================
|
|
|
|
|
2017-06-04 16:03:04 +00:00
|
|
|
struct UDMFScroll
|
|
|
|
{
|
|
|
|
bool ceiling;
|
|
|
|
int index;
|
|
|
|
double x, y;
|
|
|
|
FName type;
|
|
|
|
};
|
|
|
|
|
2016-03-01 15:47:10 +00:00
|
|
|
class UDMFParser : public UDMFParserBase
|
|
|
|
{
|
|
|
|
bool isTranslated;
|
|
|
|
bool isExtended;
|
|
|
|
bool floordrop;
|
|
|
|
|
|
|
|
TArray<line_t> ParsedLines;
|
|
|
|
TArray<side_t> ParsedSides;
|
|
|
|
TArray<intmapsidedef_t> ParsedSideTextures;
|
|
|
|
TArray<sector_t> ParsedSectors;
|
|
|
|
TArray<vertex_t> ParsedVertices;
|
2017-06-04 16:03:04 +00:00
|
|
|
TArray<UDMFScroll> UDMFScrollers;
|
2016-03-01 15:47:10 +00:00
|
|
|
|
2018-08-18 23:14:15 +00:00
|
|
|
FDynamicColormap *fogMap = nullptr, *normMap = nullptr;
|
2016-03-01 15:47:10 +00:00
|
|
|
FMissingTextureTracker &missingTex;
|
|
|
|
|
|
|
|
public:
|
|
|
|
UDMFParser(FMissingTextureTracker &missing)
|
|
|
|
: missingTex(missing)
|
|
|
|
{
|
|
|
|
linemap.Clear();
|
|
|
|
}
|
|
|
|
|
2018-03-19 14:39:50 +00:00
|
|
|
void ReadUserKey(FUDMFKey &ukey) {
|
2016-03-01 15:47:10 +00:00
|
|
|
switch (sc.TokenType)
|
|
|
|
{
|
|
|
|
case TK_IntConst:
|
|
|
|
ukey = sc.Number;
|
|
|
|
break;
|
|
|
|
case TK_FloatConst:
|
|
|
|
ukey = sc.Float;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
case TK_StringConst:
|
|
|
|
ukey = parsedString;
|
|
|
|
break;
|
|
|
|
case TK_True:
|
|
|
|
ukey = 1;
|
|
|
|
break;
|
|
|
|
case TK_False:
|
|
|
|
ukey = 0;
|
|
|
|
break;
|
|
|
|
}
|
2018-03-19 14:39:50 +00:00
|
|
|
}
|
|
|
|
void AddUserKey(FName key, int kind, int index)
|
|
|
|
{
|
|
|
|
FUDMFKeys &keyarray = UDMFKeys[kind][index];
|
|
|
|
|
|
|
|
for(unsigned i=0; i < keyarray.Size(); i++)
|
|
|
|
{
|
|
|
|
if (keyarray[i].Key == key)
|
|
|
|
{
|
|
|
|
ReadUserKey(keyarray[i]);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
FUDMFKey ukey;
|
|
|
|
ukey.Key = key;
|
|
|
|
ReadUserKey(ukey);
|
2016-03-01 15:47:10 +00:00
|
|
|
keyarray.Push(ukey);
|
|
|
|
}
|
|
|
|
|
|
|
|
//===========================================================================
|
|
|
|
//
|
|
|
|
// Parse a thing block
|
|
|
|
//
|
|
|
|
//===========================================================================
|
|
|
|
|
|
|
|
void ParseThing(FMapThing *th)
|
|
|
|
{
|
|
|
|
FString arg0str, arg1str;
|
|
|
|
|
|
|
|
memset(th, 0, sizeof(*th));
|
2016-03-20 23:51:19 +00:00
|
|
|
th->Gravity = 1;
|
2016-03-01 15:47:10 +00:00
|
|
|
th->RenderStyle = STYLE_Count;
|
2016-03-21 11:18:46 +00:00
|
|
|
th->Alpha = -1;
|
2017-02-27 23:59:09 +00:00
|
|
|
th->Health = 1;
|
2016-03-01 15:47:10 +00:00
|
|
|
th->FloatbobPhase = -1;
|
|
|
|
sc.MustGetToken('{');
|
|
|
|
while (!sc.CheckToken('}'))
|
|
|
|
{
|
|
|
|
FName key = ParseKey();
|
|
|
|
switch(key)
|
|
|
|
{
|
|
|
|
case NAME_Id:
|
|
|
|
th->thingid = CheckInt(key);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_X:
|
2017-03-23 09:08:48 +00:00
|
|
|
th->pos.X = CheckCoordinate(key);
|
2016-03-01 15:47:10 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_Y:
|
2017-03-23 09:08:48 +00:00
|
|
|
th->pos.Y = CheckCoordinate(key);
|
2016-03-01 15:47:10 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_Height:
|
2017-03-23 09:08:48 +00:00
|
|
|
th->pos.Z = CheckCoordinate(key);
|
2016-03-01 15:47:10 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_Angle:
|
|
|
|
th->angle = (short)CheckInt(key);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_Type:
|
|
|
|
th->EdNum = (short)CheckInt(key);
|
|
|
|
th->info = DoomEdMap.CheckKey(th->EdNum);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_Conversation:
|
|
|
|
CHECK_N(Zd | Zdt)
|
|
|
|
th->Conversation = CheckInt(key);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_Special:
|
|
|
|
CHECK_N(Hx | Zd | Zdt | Va)
|
|
|
|
th->special = CheckInt(key);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_Gravity:
|
|
|
|
CHECK_N(Zd | Zdt)
|
2016-03-20 23:51:19 +00:00
|
|
|
th->Gravity = CheckFloat(key);
|
2016-03-01 15:47:10 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_Arg0:
|
|
|
|
case NAME_Arg1:
|
|
|
|
case NAME_Arg2:
|
|
|
|
case NAME_Arg3:
|
|
|
|
case NAME_Arg4:
|
|
|
|
CHECK_N(Hx | Zd | Zdt | Va)
|
|
|
|
th->args[int(key)-int(NAME_Arg0)] = CheckInt(key);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_Arg0Str:
|
|
|
|
CHECK_N(Zd);
|
|
|
|
arg0str = CheckString(key);
|
2018-01-20 21:41:28 +00:00
|
|
|
th->arg0str = arg0str;
|
2016-03-01 15:47:10 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_Arg1Str:
|
|
|
|
CHECK_N(Zd);
|
|
|
|
arg1str = CheckString(key);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_Skill1:
|
|
|
|
case NAME_Skill2:
|
|
|
|
case NAME_Skill3:
|
|
|
|
case NAME_Skill4:
|
|
|
|
case NAME_Skill5:
|
|
|
|
case NAME_Skill6:
|
|
|
|
case NAME_Skill7:
|
|
|
|
case NAME_Skill8:
|
|
|
|
case NAME_Skill9:
|
|
|
|
case NAME_Skill10:
|
|
|
|
case NAME_Skill11:
|
|
|
|
case NAME_Skill12:
|
|
|
|
case NAME_Skill13:
|
|
|
|
case NAME_Skill14:
|
|
|
|
case NAME_Skill15:
|
|
|
|
case NAME_Skill16:
|
|
|
|
if (CheckBool(key)) th->SkillFilter |= (1<<(int(key)-NAME_Skill1));
|
|
|
|
else th->SkillFilter &= ~(1<<(int(key)-NAME_Skill1));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_Class1:
|
|
|
|
case NAME_Class2:
|
|
|
|
case NAME_Class3:
|
|
|
|
case NAME_Class4:
|
|
|
|
case NAME_Class5:
|
|
|
|
case NAME_Class6:
|
|
|
|
case NAME_Class7:
|
|
|
|
case NAME_Class8:
|
|
|
|
case NAME_Class9:
|
|
|
|
case NAME_Class10:
|
|
|
|
case NAME_Class11:
|
|
|
|
case NAME_Class12:
|
|
|
|
case NAME_Class13:
|
|
|
|
case NAME_Class14:
|
|
|
|
case NAME_Class15:
|
|
|
|
case NAME_Class16:
|
|
|
|
CHECK_N(Hx | Zd | Zdt | Va)
|
|
|
|
if (CheckBool(key)) th->ClassFilter |= (1<<(int(key)-NAME_Class1));
|
|
|
|
else th->ClassFilter &= ~(1<<(int(key)-NAME_Class1));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_Ambush:
|
|
|
|
Flag(th->flags, MTF_AMBUSH, key);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_Dormant:
|
|
|
|
CHECK_N(Hx | Zd | Zdt | Va)
|
|
|
|
Flag(th->flags, MTF_DORMANT, key);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_Single:
|
|
|
|
Flag(th->flags, MTF_SINGLE, key);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_Coop:
|
|
|
|
Flag(th->flags, MTF_COOPERATIVE, key);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_Dm:
|
|
|
|
Flag(th->flags, MTF_DEATHMATCH, key);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_Translucent:
|
|
|
|
CHECK_N(St | Zd | Zdt | Va)
|
|
|
|
Flag(th->flags, MTF_SHADOW, key);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_Invisible:
|
|
|
|
CHECK_N(St | Zd | Zdt | Va)
|
|
|
|
Flag(th->flags, MTF_ALTSHADOW, key);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_Friend: // This maps to Strife's friendly flag
|
|
|
|
CHECK_N(Dm | Zd | Zdt | Va)
|
|
|
|
Flag(th->flags, MTF_FRIENDLY, key);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_Strifeally:
|
|
|
|
CHECK_N(St | Zd | Zdt | Va)
|
|
|
|
Flag(th->flags, MTF_FRIENDLY, key);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_Standing:
|
|
|
|
CHECK_N(St | Zd | Zdt | Va)
|
|
|
|
Flag(th->flags, MTF_STANDSTILL, key);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_Countsecret:
|
|
|
|
CHECK_N(Zd | Zdt | Va)
|
|
|
|
Flag(th->flags, MTF_SECRET, key);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_Floatbobphase:
|
|
|
|
CHECK_N(Zd | Zdt)
|
|
|
|
th->FloatbobPhase = CheckInt(key);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_Renderstyle:
|
|
|
|
{
|
|
|
|
FName style = CheckString(key);
|
|
|
|
switch (style)
|
|
|
|
{
|
|
|
|
case NAME_None:
|
|
|
|
th->RenderStyle = STYLE_None;
|
|
|
|
break;
|
|
|
|
case NAME_Normal:
|
|
|
|
th->RenderStyle = STYLE_Normal;
|
|
|
|
break;
|
|
|
|
case NAME_Fuzzy:
|
|
|
|
th->RenderStyle = STYLE_Fuzzy;
|
|
|
|
break;
|
|
|
|
case NAME_SoulTrans:
|
|
|
|
th->RenderStyle = STYLE_SoulTrans;
|
|
|
|
break;
|
|
|
|
case NAME_OptFuzzy:
|
|
|
|
th->RenderStyle = STYLE_OptFuzzy;
|
|
|
|
break;
|
|
|
|
case NAME_Stencil:
|
|
|
|
th->RenderStyle = STYLE_Stencil;
|
|
|
|
break;
|
|
|
|
case NAME_AddStencil:
|
|
|
|
th->RenderStyle = STYLE_AddStencil;
|
|
|
|
break;
|
|
|
|
case NAME_Translucent:
|
|
|
|
th->RenderStyle = STYLE_Translucent;
|
|
|
|
break;
|
|
|
|
case NAME_Add:
|
|
|
|
case NAME_Additive:
|
|
|
|
th->RenderStyle = STYLE_Add;
|
|
|
|
break;
|
|
|
|
case NAME_Shaded:
|
|
|
|
th->RenderStyle = STYLE_Shaded;
|
|
|
|
break;
|
|
|
|
case NAME_AddShaded:
|
|
|
|
th->RenderStyle = STYLE_AddShaded;
|
|
|
|
break;
|
|
|
|
case NAME_TranslucentStencil:
|
|
|
|
th->RenderStyle = STYLE_TranslucentStencil;
|
|
|
|
break;
|
|
|
|
case NAME_Shadow:
|
|
|
|
th->RenderStyle = STYLE_Shadow;
|
|
|
|
break;
|
|
|
|
case NAME_Subtract:
|
|
|
|
case NAME_Subtractive:
|
|
|
|
th->RenderStyle = STYLE_Subtract;
|
|
|
|
break;
|
2018-11-27 18:43:10 +00:00
|
|
|
case NAME_ColorBlend:
|
|
|
|
th->RenderStyle = STYLE_ColorBlend;
|
|
|
|
break;
|
|
|
|
case NAME_ColorAdd:
|
|
|
|
th->RenderStyle = STYLE_ColorAdd;
|
|
|
|
break;
|
|
|
|
case NAME_Multiply:
|
|
|
|
th->RenderStyle = STYLE_Multiply;
|
|
|
|
break;
|
2016-03-01 15:47:10 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_Alpha:
|
2016-03-21 11:18:46 +00:00
|
|
|
th->Alpha = CheckFloat(key);
|
2016-03-01 15:47:10 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_FillColor:
|
|
|
|
th->fillcolor = CheckInt(key);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_Health:
|
2017-02-27 23:59:09 +00:00
|
|
|
th->Health = CheckFloat(key);
|
2016-03-01 15:47:10 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_Score:
|
|
|
|
th->score = CheckInt(key);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_Pitch:
|
|
|
|
th->pitch = (short)CheckInt(key);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_Roll:
|
|
|
|
th->roll = (short)CheckInt(key);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_ScaleX:
|
2016-03-20 11:13:00 +00:00
|
|
|
th->Scale.X = CheckFloat(key);
|
2016-03-01 15:47:10 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_ScaleY:
|
2016-03-20 11:13:00 +00:00
|
|
|
th->Scale.Y = CheckFloat(key);
|
2016-03-01 15:47:10 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_Scale:
|
2016-03-20 11:13:00 +00:00
|
|
|
th->Scale.X = th->Scale.Y = CheckFloat(key);
|
2016-03-01 15:47:10 +00:00
|
|
|
break;
|
|
|
|
|
2018-01-09 20:30:45 +00:00
|
|
|
case NAME_FriendlySeeBlocks:
|
|
|
|
CHECK_N(Zd | Zdt)
|
|
|
|
th->friendlyseeblocks = CheckInt(key);
|
|
|
|
break;
|
|
|
|
|
2016-03-01 15:47:10 +00:00
|
|
|
default:
|
|
|
|
CHECK_N(Zd | Zdt)
|
|
|
|
if (0 == strnicmp("user_", key.GetChars(), 5))
|
|
|
|
{ // Custom user key - Sets an actor's user variable directly
|
2018-03-19 14:39:50 +00:00
|
|
|
FUDMFKey ukey;
|
|
|
|
ukey.Key = key;
|
|
|
|
ReadUserKey(ukey);
|
|
|
|
MapThingsUserData.Push(ukey);
|
2016-03-01 15:47:10 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (arg0str.IsNotEmpty() && (P_IsACSSpecial(th->special) || th->special == 0))
|
|
|
|
{
|
|
|
|
th->args[0] = -FName(arg0str);
|
|
|
|
}
|
|
|
|
if (arg1str.IsNotEmpty() && (P_IsThingSpecial(th->special) || th->special == 0))
|
|
|
|
{
|
|
|
|
th->args[1] = -FName(arg1str);
|
|
|
|
}
|
|
|
|
// Thing specials are only valid in namespaces with Hexen-type specials
|
|
|
|
// and in ZDoomTranslated - which will use the translator on them.
|
|
|
|
if (namespc == NAME_ZDoomTranslated)
|
|
|
|
{
|
|
|
|
maplinedef_t mld;
|
|
|
|
line_t ld;
|
|
|
|
|
|
|
|
if (th->special != 0) // if special is 0, keep the args (e.g. for bridge things)
|
|
|
|
{
|
|
|
|
// The trigger type is ignored here.
|
|
|
|
mld.flags = 0;
|
|
|
|
mld.special = th->special;
|
|
|
|
mld.tag = th->args[0];
|
|
|
|
P_TranslateLineDef(&ld, &mld);
|
|
|
|
th->special = ld.special;
|
|
|
|
memcpy(th->args, ld.args, sizeof (ld.args));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (isTranslated)
|
|
|
|
{
|
|
|
|
th->special = 0;
|
|
|
|
memset(th->args, 0, sizeof (th->args));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//===========================================================================
|
|
|
|
//
|
|
|
|
// Parse a linedef block
|
|
|
|
//
|
|
|
|
//===========================================================================
|
|
|
|
|
|
|
|
void ParseLinedef(line_t *ld, int index)
|
|
|
|
{
|
|
|
|
bool passuse = false;
|
|
|
|
bool strifetrans = false;
|
|
|
|
bool strifetrans2 = false;
|
|
|
|
FString arg0str, arg1str;
|
|
|
|
int lineid = -1; // forZDoomTranslated namespace
|
|
|
|
FString tagstring;
|
|
|
|
|
|
|
|
memset(ld, 0, sizeof(*ld));
|
2016-04-24 10:15:09 +00:00
|
|
|
ld->alpha = 1.;
|
2016-03-01 15:47:10 +00:00
|
|
|
ld->portalindex = UINT_MAX;
|
2017-01-08 15:09:21 +00:00
|
|
|
ld->portaltransferred = UINT_MAX;
|
2016-03-01 15:47:10 +00:00
|
|
|
ld->sidedef[0] = ld->sidedef[1] = NULL;
|
|
|
|
if (level.flags2 & LEVEL2_CLIPMIDTEX) ld->flags |= ML_CLIP_MIDTEX;
|
|
|
|
if (level.flags2 & LEVEL2_WRAPMIDTEX) ld->flags |= ML_WRAP_MIDTEX;
|
|
|
|
if (level.flags2 & LEVEL2_CHECKSWITCHRANGE) ld->flags |= ML_CHECKSWITCHRANGE;
|
|
|
|
|
|
|
|
sc.MustGetToken('{');
|
|
|
|
while (!sc.CheckToken('}'))
|
|
|
|
{
|
|
|
|
FName key = ParseKey();
|
|
|
|
|
|
|
|
// This switch contains all keys of the UDMF base spec
|
|
|
|
switch(key)
|
|
|
|
{
|
|
|
|
case NAME_V1:
|
|
|
|
ld->v1 = (vertex_t*)(intptr_t)CheckInt(key); // must be relocated later
|
|
|
|
continue;
|
|
|
|
|
|
|
|
case NAME_V2:
|
|
|
|
ld->v2 = (vertex_t*)(intptr_t)CheckInt(key); // must be relocated later
|
|
|
|
continue;
|
|
|
|
|
|
|
|
case NAME_Special:
|
|
|
|
ld->special = CheckInt(key);
|
|
|
|
if (namespc == NAME_Hexen)
|
|
|
|
{
|
|
|
|
if (ld->special < 0 || ld->special > 140 || !HexenLineSpecialOk[ld->special])
|
|
|
|
ld->special = 0; // NULL all specials which don't exist in Hexen
|
|
|
|
}
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
case NAME_Id:
|
|
|
|
lineid = CheckInt(key);
|
|
|
|
tagManager.AddLineID(index, lineid);
|
|
|
|
continue;
|
|
|
|
|
|
|
|
case NAME_Sidefront:
|
|
|
|
ld->sidedef[0] = (side_t*)(intptr_t)(1 + CheckInt(key));
|
|
|
|
continue;
|
|
|
|
|
|
|
|
case NAME_Sideback:
|
|
|
|
ld->sidedef[1] = (side_t*)(intptr_t)(1 + CheckInt(key));
|
|
|
|
continue;
|
|
|
|
|
|
|
|
case NAME_Arg0:
|
|
|
|
case NAME_Arg1:
|
|
|
|
case NAME_Arg2:
|
|
|
|
case NAME_Arg3:
|
|
|
|
case NAME_Arg4:
|
|
|
|
ld->args[int(key)-int(NAME_Arg0)] = CheckInt(key);
|
|
|
|
continue;
|
|
|
|
|
|
|
|
case NAME_Arg0Str:
|
|
|
|
CHECK_N(Zd);
|
|
|
|
arg0str = CheckString(key);
|
|
|
|
continue;
|
|
|
|
|
|
|
|
case NAME_Arg1Str:
|
|
|
|
CHECK_N(Zd);
|
|
|
|
arg1str = CheckString(key);
|
|
|
|
continue;
|
|
|
|
|
|
|
|
case NAME_Blocking:
|
|
|
|
Flag(ld->flags, ML_BLOCKING, key);
|
|
|
|
continue;
|
|
|
|
|
|
|
|
case NAME_Blockmonsters:
|
|
|
|
Flag(ld->flags, ML_BLOCKMONSTERS, key);
|
|
|
|
continue;
|
|
|
|
|
|
|
|
case NAME_Twosided:
|
|
|
|
Flag(ld->flags, ML_TWOSIDED, key);
|
|
|
|
continue;
|
|
|
|
|
|
|
|
case NAME_Dontpegtop:
|
|
|
|
Flag(ld->flags, ML_DONTPEGTOP, key);
|
|
|
|
continue;
|
|
|
|
|
|
|
|
case NAME_Dontpegbottom:
|
|
|
|
Flag(ld->flags, ML_DONTPEGBOTTOM, key);
|
|
|
|
continue;
|
|
|
|
|
|
|
|
case NAME_Secret:
|
|
|
|
Flag(ld->flags, ML_SECRET, key);
|
|
|
|
continue;
|
|
|
|
|
|
|
|
case NAME_Blocksound:
|
|
|
|
Flag(ld->flags, ML_SOUNDBLOCK, key);
|
|
|
|
continue;
|
|
|
|
|
|
|
|
case NAME_Dontdraw:
|
|
|
|
Flag(ld->flags, ML_DONTDRAW, key);
|
|
|
|
continue;
|
|
|
|
|
|
|
|
case NAME_Mapped:
|
|
|
|
Flag(ld->flags, ML_MAPPED, key);
|
|
|
|
continue;
|
|
|
|
|
|
|
|
case NAME_Jumpover:
|
|
|
|
CHECK_N(St | Zd | Zdt | Va)
|
|
|
|
Flag(ld->flags, ML_RAILING, key);
|
|
|
|
continue;
|
|
|
|
|
|
|
|
case NAME_Blockfloaters:
|
|
|
|
CHECK_N(St | Zd | Zdt | Va)
|
|
|
|
Flag(ld->flags, ML_BLOCK_FLOATERS, key);
|
|
|
|
continue;
|
|
|
|
|
|
|
|
case NAME_Translucent:
|
|
|
|
CHECK_N(St | Zd | Zdt | Va)
|
|
|
|
strifetrans = CheckBool(key);
|
|
|
|
continue;
|
|
|
|
|
|
|
|
case NAME_Transparent:
|
|
|
|
CHECK_N(St | Zd | Zdt | Va)
|
|
|
|
strifetrans2 = CheckBool(key);
|
|
|
|
continue;
|
|
|
|
|
|
|
|
case NAME_Passuse:
|
|
|
|
CHECK_N(Dm | Zd | Zdt | Va)
|
|
|
|
passuse = CheckBool(key);
|
|
|
|
continue;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
// This switch contains all keys of the UDMF base spec which only apply to Hexen format specials
|
|
|
|
if (!isTranslated) switch (key)
|
|
|
|
{
|
|
|
|
case NAME_Playercross:
|
|
|
|
Flag(ld->activation, SPAC_Cross, key);
|
|
|
|
continue;
|
|
|
|
|
|
|
|
case NAME_Playeruse:
|
|
|
|
Flag(ld->activation, SPAC_Use, key);
|
|
|
|
continue;
|
|
|
|
|
|
|
|
case NAME_Playeruseback:
|
|
|
|
Flag(ld->activation, SPAC_UseBack, key);
|
|
|
|
continue;
|
|
|
|
|
|
|
|
case NAME_Monstercross:
|
|
|
|
Flag(ld->activation, SPAC_MCross, key);
|
|
|
|
continue;
|
|
|
|
|
|
|
|
case NAME_Impact:
|
|
|
|
Flag(ld->activation, SPAC_Impact, key);
|
|
|
|
continue;
|
|
|
|
|
|
|
|
case NAME_Playerpush:
|
|
|
|
Flag(ld->activation, SPAC_Push, key);
|
|
|
|
continue;
|
|
|
|
|
|
|
|
case NAME_Missilecross:
|
|
|
|
Flag(ld->activation, SPAC_PCross, key);
|
|
|
|
continue;
|
|
|
|
|
|
|
|
case NAME_Monsteruse:
|
|
|
|
Flag(ld->activation, SPAC_MUse, key);
|
|
|
|
continue;
|
|
|
|
|
|
|
|
case NAME_Monsterpush:
|
|
|
|
Flag(ld->activation, SPAC_MPush, key);
|
|
|
|
continue;
|
|
|
|
|
|
|
|
case NAME_Repeatspecial:
|
|
|
|
Flag(ld->flags, ML_REPEAT_SPECIAL, key);
|
|
|
|
continue;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
// This switch contains all keys which are ZDoom specific
|
|
|
|
if (namespace_bits & (Zd|Zdt|Va)) switch(key)
|
|
|
|
{
|
|
|
|
case NAME_Alpha:
|
2016-03-30 14:30:22 +00:00
|
|
|
ld->setAlpha(CheckFloat(key));
|
2016-03-01 15:47:10 +00:00
|
|
|
continue;
|
|
|
|
|
|
|
|
case NAME_Renderstyle:
|
|
|
|
{
|
|
|
|
const char *str = CheckString(key);
|
|
|
|
if (!stricmp(str, "translucent")) ld->flags &= ~ML_ADDTRANS;
|
|
|
|
else if (!stricmp(str, "add")) ld->flags |= ML_ADDTRANS;
|
|
|
|
else sc.ScriptMessage("Unknown value \"%s\" for 'renderstyle'\n", str);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
case NAME_Anycross:
|
|
|
|
Flag(ld->activation, SPAC_AnyCross, key);
|
|
|
|
continue;
|
|
|
|
|
|
|
|
case NAME_Monsteractivate:
|
|
|
|
Flag(ld->flags, ML_MONSTERSCANACTIVATE, key);
|
|
|
|
continue;
|
|
|
|
|
|
|
|
case NAME_Blockplayers:
|
|
|
|
Flag(ld->flags, ML_BLOCK_PLAYERS, key);
|
|
|
|
continue;
|
|
|
|
|
|
|
|
case NAME_Blockeverything:
|
|
|
|
Flag(ld->flags, ML_BLOCKEVERYTHING, key);
|
|
|
|
continue;
|
|
|
|
|
|
|
|
case NAME_Zoneboundary:
|
|
|
|
Flag(ld->flags, ML_ZONEBOUNDARY, key);
|
|
|
|
continue;
|
|
|
|
|
|
|
|
case NAME_Clipmidtex:
|
|
|
|
Flag(ld->flags, ML_CLIP_MIDTEX, key);
|
|
|
|
continue;
|
|
|
|
|
|
|
|
case NAME_Wrapmidtex:
|
|
|
|
Flag(ld->flags, ML_WRAP_MIDTEX, key);
|
|
|
|
continue;
|
|
|
|
|
|
|
|
case NAME_Midtex3d:
|
|
|
|
Flag(ld->flags, ML_3DMIDTEX, key);
|
|
|
|
continue;
|
|
|
|
|
|
|
|
case NAME_Checkswitchrange:
|
|
|
|
Flag(ld->flags, ML_CHECKSWITCHRANGE, key);
|
|
|
|
continue;
|
|
|
|
|
|
|
|
case NAME_Firstsideonly:
|
|
|
|
Flag(ld->flags, ML_FIRSTSIDEONLY, key);
|
|
|
|
continue;
|
|
|
|
|
|
|
|
case NAME_blockprojectiles:
|
|
|
|
Flag(ld->flags, ML_BLOCKPROJECTILE, key);
|
|
|
|
continue;
|
|
|
|
|
|
|
|
case NAME_blockuse:
|
|
|
|
Flag(ld->flags, ML_BLOCKUSE, key);
|
|
|
|
continue;
|
|
|
|
|
|
|
|
case NAME_blocksight:
|
|
|
|
Flag(ld->flags, ML_BLOCKSIGHT, key);
|
|
|
|
continue;
|
|
|
|
|
|
|
|
case NAME_blockhitscan:
|
|
|
|
Flag(ld->flags, ML_BLOCKHITSCAN, key);
|
|
|
|
continue;
|
|
|
|
|
|
|
|
// [TP] Locks the special with a key
|
|
|
|
case NAME_Locknumber:
|
|
|
|
ld->locknumber = CheckInt(key);
|
|
|
|
continue;
|
|
|
|
|
|
|
|
// [TP] Causes a 3d midtex to behave like an impassible line
|
|
|
|
case NAME_Midtex3dimpassible:
|
|
|
|
Flag(ld->flags, ML_3DMIDTEX_IMPASS, key);
|
|
|
|
continue;
|
|
|
|
|
2018-05-19 06:31:22 +00:00
|
|
|
case NAME_Revealed:
|
|
|
|
Flag(ld->flags, ML_REVEALED, key);
|
|
|
|
continue;
|
|
|
|
|
2018-05-19 07:49:04 +00:00
|
|
|
case NAME_AutomapStyle:
|
|
|
|
ld->automapstyle = AutomapLineStyle(CheckInt(key));
|
|
|
|
continue;
|
|
|
|
|
2016-03-01 15:47:10 +00:00
|
|
|
case NAME_MoreIds:
|
|
|
|
// delay parsing of the tag string until parsing of the sector is complete
|
|
|
|
// This ensures that the ID is always the first tag in the list.
|
|
|
|
tagstring = CheckString(key);
|
|
|
|
break;
|
|
|
|
|
2018-10-28 22:08:38 +00:00
|
|
|
case NAME_Health:
|
|
|
|
ld->health = CheckInt(key);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_DamageSpecial:
|
|
|
|
Flag(ld->activation, SPAC_Damage, key);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_DeathSpecial:
|
|
|
|
Flag(ld->activation, SPAC_Death, key);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_HealthGroup:
|
|
|
|
ld->healthgroup = CheckInt(key);
|
|
|
|
break;
|
2016-03-01 15:47:10 +00:00
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if ((namespace_bits & (Zd | Zdt)) && !strnicmp("user_", key.GetChars(), 5))
|
|
|
|
{
|
|
|
|
AddUserKey(key, UDMF_Line, index);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (tagstring.IsNotEmpty())
|
|
|
|
{
|
|
|
|
FScanner sc;
|
|
|
|
sc.OpenString("tagstring", tagstring);
|
|
|
|
// scan the string as long as valid numbers can be found
|
|
|
|
while (sc.CheckNumber())
|
|
|
|
{
|
|
|
|
if (sc.Number != 0) tagManager.AddLineID(index, sc.Number);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isTranslated)
|
|
|
|
{
|
|
|
|
int saved = ld->flags;
|
|
|
|
|
|
|
|
maplinedef_t mld;
|
|
|
|
memset(&mld, 0, sizeof(mld));
|
|
|
|
mld.special = ld->special;
|
|
|
|
mld.tag = ld->args[0];
|
|
|
|
P_TranslateLineDef(ld, &mld);
|
|
|
|
ld->flags = saved | (ld->flags&(ML_MONSTERSCANACTIVATE|ML_REPEAT_SPECIAL|ML_FIRSTSIDEONLY));
|
|
|
|
}
|
|
|
|
if (passuse && (ld->activation & SPAC_Use))
|
|
|
|
{
|
|
|
|
ld->activation = (ld->activation & ~SPAC_Use) | SPAC_UseThrough;
|
|
|
|
}
|
2016-04-24 10:15:09 +00:00
|
|
|
if (strifetrans && ld->alpha == 1.)
|
2016-03-01 15:47:10 +00:00
|
|
|
{
|
2016-04-24 10:15:09 +00:00
|
|
|
ld->alpha = 0.75;
|
2016-03-01 15:47:10 +00:00
|
|
|
}
|
2017-02-06 23:24:04 +00:00
|
|
|
if (strifetrans2 && ld->alpha == 1.)
|
2016-03-01 15:47:10 +00:00
|
|
|
{
|
2016-04-24 10:15:09 +00:00
|
|
|
ld->alpha = 0.25;
|
2016-03-01 15:47:10 +00:00
|
|
|
}
|
|
|
|
if (ld->sidedef[0] == NULL)
|
|
|
|
{
|
|
|
|
ld->sidedef[0] = (side_t*)(intptr_t)(1);
|
|
|
|
Printf("Line %d has no first side.\n", index);
|
|
|
|
}
|
|
|
|
if (arg0str.IsNotEmpty() && (P_IsACSSpecial(ld->special) || ld->special == 0))
|
|
|
|
{
|
|
|
|
ld->args[0] = -FName(arg0str);
|
|
|
|
}
|
|
|
|
if (arg1str.IsNotEmpty() && (P_IsThingSpecial(ld->special) || ld->special == 0))
|
|
|
|
{
|
|
|
|
ld->args[1] = -FName(arg1str);
|
|
|
|
}
|
|
|
|
if ((ld->flags & ML_3DMIDTEX_IMPASS) && !(ld->flags & ML_3DMIDTEX)) // [TP]
|
|
|
|
{
|
|
|
|
Printf ("Line %d has midtex3dimpassible without midtex3d.\n", index);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//===========================================================================
|
|
|
|
//
|
|
|
|
// Parse a sidedef block
|
|
|
|
//
|
|
|
|
//===========================================================================
|
|
|
|
|
|
|
|
void ParseSidedef(side_t *sd, intmapsidedef_t *sdt, int index)
|
|
|
|
{
|
2016-03-30 14:30:22 +00:00
|
|
|
double texOfs[2]={0,0};
|
2016-03-01 15:47:10 +00:00
|
|
|
|
|
|
|
memset(sd, 0, sizeof(*sd));
|
|
|
|
sdt->bottomtexture = "-";
|
|
|
|
sdt->toptexture = "-";
|
|
|
|
sdt->midtexture = "-";
|
2016-03-30 14:30:22 +00:00
|
|
|
sd->SetTextureXScale(1.);
|
|
|
|
sd->SetTextureYScale(1.);
|
2017-01-08 17:45:30 +00:00
|
|
|
sd->UDMFIndex = index;
|
2016-03-01 15:47:10 +00:00
|
|
|
|
|
|
|
sc.MustGetToken('{');
|
|
|
|
while (!sc.CheckToken('}'))
|
|
|
|
{
|
|
|
|
FName key = ParseKey();
|
|
|
|
switch(key)
|
2018-11-11 15:04:05 +00:00
|
|
|
|
2016-03-01 15:47:10 +00:00
|
|
|
{
|
|
|
|
case NAME_Offsetx:
|
2016-03-30 14:30:22 +00:00
|
|
|
texOfs[0] = CheckInt(key);
|
2016-03-01 15:47:10 +00:00
|
|
|
continue;
|
|
|
|
|
|
|
|
case NAME_Offsety:
|
2016-03-30 14:30:22 +00:00
|
|
|
texOfs[1] = CheckInt(key);
|
2016-03-01 15:47:10 +00:00
|
|
|
continue;
|
|
|
|
|
|
|
|
case NAME_Texturetop:
|
|
|
|
sdt->toptexture = CheckString(key);
|
|
|
|
continue;
|
|
|
|
|
|
|
|
case NAME_Texturebottom:
|
|
|
|
sdt->bottomtexture = CheckString(key);
|
|
|
|
continue;
|
|
|
|
|
|
|
|
case NAME_Texturemiddle:
|
|
|
|
sdt->midtexture = CheckString(key);
|
|
|
|
continue;
|
|
|
|
|
|
|
|
case NAME_Sector:
|
|
|
|
sd->sector = (sector_t*)(intptr_t)CheckInt(key);
|
|
|
|
continue;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (namespace_bits & (Zd|Zdt|Va)) switch(key)
|
|
|
|
{
|
|
|
|
case NAME_offsetx_top:
|
2016-03-30 14:30:22 +00:00
|
|
|
sd->SetTextureXOffset(side_t::top, CheckFloat(key));
|
2016-03-01 15:47:10 +00:00
|
|
|
continue;
|
|
|
|
|
|
|
|
case NAME_offsety_top:
|
2016-03-30 14:30:22 +00:00
|
|
|
sd->SetTextureYOffset(side_t::top, CheckFloat(key));
|
2016-03-01 15:47:10 +00:00
|
|
|
continue;
|
|
|
|
|
|
|
|
case NAME_offsetx_mid:
|
2016-03-30 14:30:22 +00:00
|
|
|
sd->SetTextureXOffset(side_t::mid, CheckFloat(key));
|
2016-03-01 15:47:10 +00:00
|
|
|
continue;
|
|
|
|
|
|
|
|
case NAME_offsety_mid:
|
2016-03-30 14:30:22 +00:00
|
|
|
sd->SetTextureYOffset(side_t::mid, CheckFloat(key));
|
2016-03-01 15:47:10 +00:00
|
|
|
continue;
|
|
|
|
|
|
|
|
case NAME_offsetx_bottom:
|
2016-03-30 14:30:22 +00:00
|
|
|
sd->SetTextureXOffset(side_t::bottom, CheckFloat(key));
|
2016-03-01 15:47:10 +00:00
|
|
|
continue;
|
|
|
|
|
|
|
|
case NAME_offsety_bottom:
|
2016-03-30 14:30:22 +00:00
|
|
|
sd->SetTextureYOffset(side_t::bottom, CheckFloat(key));
|
2016-03-01 15:47:10 +00:00
|
|
|
continue;
|
|
|
|
|
|
|
|
case NAME_scalex_top:
|
2016-03-30 14:30:22 +00:00
|
|
|
sd->SetTextureXScale(side_t::top, CheckFloat(key));
|
2016-03-01 15:47:10 +00:00
|
|
|
continue;
|
|
|
|
|
|
|
|
case NAME_scaley_top:
|
2016-03-30 14:30:22 +00:00
|
|
|
sd->SetTextureYScale(side_t::top, CheckFloat(key));
|
2016-03-01 15:47:10 +00:00
|
|
|
continue;
|
|
|
|
|
|
|
|
case NAME_scalex_mid:
|
2016-03-30 14:30:22 +00:00
|
|
|
sd->SetTextureXScale(side_t::mid, CheckFloat(key));
|
2016-03-01 15:47:10 +00:00
|
|
|
continue;
|
|
|
|
|
|
|
|
case NAME_scaley_mid:
|
2016-03-30 14:30:22 +00:00
|
|
|
sd->SetTextureYScale(side_t::mid, CheckFloat(key));
|
2016-03-01 15:47:10 +00:00
|
|
|
continue;
|
|
|
|
|
|
|
|
case NAME_scalex_bottom:
|
2016-03-30 14:30:22 +00:00
|
|
|
sd->SetTextureXScale(side_t::bottom, CheckFloat(key));
|
2016-03-01 15:47:10 +00:00
|
|
|
continue;
|
|
|
|
|
|
|
|
case NAME_scaley_bottom:
|
2016-03-30 14:30:22 +00:00
|
|
|
sd->SetTextureYScale(side_t::bottom, CheckFloat(key));
|
2016-03-01 15:47:10 +00:00
|
|
|
continue;
|
|
|
|
|
|
|
|
case NAME_light:
|
|
|
|
sd->SetLight(CheckInt(key));
|
|
|
|
continue;
|
|
|
|
|
|
|
|
case NAME_lightabsolute:
|
|
|
|
Flag(sd->Flags, WALLF_ABSLIGHTING, key);
|
|
|
|
continue;
|
|
|
|
|
|
|
|
case NAME_lightfog:
|
|
|
|
Flag(sd->Flags, WALLF_LIGHT_FOG, key);
|
|
|
|
continue;
|
|
|
|
|
|
|
|
case NAME_nofakecontrast:
|
|
|
|
Flag(sd->Flags, WALLF_NOFAKECONTRAST, key);
|
|
|
|
continue;
|
|
|
|
|
|
|
|
case NAME_smoothlighting:
|
|
|
|
Flag(sd->Flags, WALLF_SMOOTHLIGHTING, key);
|
|
|
|
continue;
|
|
|
|
|
|
|
|
case NAME_Wrapmidtex:
|
|
|
|
Flag(sd->Flags, WALLF_WRAP_MIDTEX, key);
|
|
|
|
continue;
|
|
|
|
|
|
|
|
case NAME_Clipmidtex:
|
|
|
|
Flag(sd->Flags, WALLF_CLIP_MIDTEX, key);
|
|
|
|
continue;
|
|
|
|
|
|
|
|
case NAME_Nodecals:
|
|
|
|
Flag(sd->Flags, WALLF_NOAUTODECALS, key);
|
|
|
|
continue;
|
|
|
|
|
2018-11-11 15:04:05 +00:00
|
|
|
case NAME_nogradient_top:
|
|
|
|
Flag(sd->textures[side_t::top].flags, side_t::part::NoGradient, key);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_flipgradient_top:
|
|
|
|
Flag(sd->textures[side_t::top].flags, side_t::part::FlipGradient, key);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_clampgradient_top:
|
|
|
|
Flag(sd->textures[side_t::top].flags, side_t::part::ClampGradient, key);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_useowncolors_top:
|
|
|
|
Flag(sd->textures[side_t::top].flags, side_t::part::UseOwnColors, key);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_uppercolor_top:
|
|
|
|
sd->SetSpecialColor(side_t::top, 0, CheckInt(key));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_lowercolor_top:
|
|
|
|
sd->SetSpecialColor(side_t::top, 1, CheckInt(key));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_nogradient_mid:
|
|
|
|
Flag(sd->textures[side_t::mid].flags, side_t::part::NoGradient, key);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_flipgradient_mid:
|
|
|
|
Flag(sd->textures[side_t::mid].flags, side_t::part::FlipGradient, key);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_clampgradient_mid:
|
|
|
|
Flag(sd->textures[side_t::mid].flags, side_t::part::ClampGradient, key);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_useowncolors_mid:
|
|
|
|
Flag(sd->textures[side_t::mid].flags, side_t::part::UseOwnColors, key);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_uppercolor_mid:
|
|
|
|
sd->SetSpecialColor(side_t::mid, 0, CheckInt(key));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_lowercolor_mid:
|
|
|
|
sd->SetSpecialColor(side_t::mid, 1, CheckInt(key));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_nogradient_bottom:
|
|
|
|
Flag(sd->textures[side_t::bottom].flags, side_t::part::NoGradient, key);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_flipgradient_bottom:
|
|
|
|
Flag(sd->textures[side_t::bottom].flags, side_t::part::FlipGradient, key);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_clampgradient_bottom:
|
|
|
|
Flag(sd->textures[side_t::bottom].flags, side_t::part::ClampGradient, key);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_useowncolors_bottom:
|
|
|
|
Flag(sd->textures[side_t::bottom].flags, side_t::part::UseOwnColors, key);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_uppercolor_bottom:
|
|
|
|
sd->SetSpecialColor(side_t::bottom, 0, CheckInt(key));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_lowercolor_bottom:
|
|
|
|
sd->SetSpecialColor(side_t::bottom, 1, CheckInt(key));
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
2016-03-01 15:47:10 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
if ((namespace_bits & (Zd | Zdt)) && !strnicmp("user_", key.GetChars(), 5))
|
|
|
|
{
|
|
|
|
AddUserKey(key, UDMF_Side, index);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// initialization of these is delayed to allow separate offsets and add them with the global ones.
|
2016-03-30 14:30:22 +00:00
|
|
|
sd->AddTextureXOffset(side_t::top, texOfs[0]);
|
|
|
|
sd->AddTextureXOffset(side_t::mid, texOfs[0]);
|
|
|
|
sd->AddTextureXOffset(side_t::bottom, texOfs[0]);
|
|
|
|
sd->AddTextureYOffset(side_t::top, texOfs[1]);
|
|
|
|
sd->AddTextureYOffset(side_t::mid, texOfs[1]);
|
|
|
|
sd->AddTextureYOffset(side_t::bottom, texOfs[1]);
|
2016-03-01 15:47:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//===========================================================================
|
|
|
|
//
|
|
|
|
// parse a sector block
|
|
|
|
//
|
|
|
|
//===========================================================================
|
|
|
|
|
|
|
|
void ParseSector(sector_t *sec, int index)
|
|
|
|
{
|
2016-12-29 00:12:17 +00:00
|
|
|
PalEntry lightcolor = -1;
|
|
|
|
PalEntry fadecolor = -1;
|
|
|
|
int fogdensity = -1;
|
2016-03-01 15:47:10 +00:00
|
|
|
int desaturation = -1;
|
|
|
|
int fplaneflags = 0, cplaneflags = 0;
|
|
|
|
double fp[4] = { 0 }, cp[4] = { 0 };
|
|
|
|
FString tagstring;
|
|
|
|
|
2017-06-04 16:03:04 +00:00
|
|
|
// Brand new UDMF scroller properties
|
|
|
|
double scroll_ceil_x = 0;
|
|
|
|
double scroll_ceil_y = 0;
|
2018-08-18 23:14:15 +00:00
|
|
|
FName scroll_ceil_type = NAME_None;
|
2017-06-04 16:03:04 +00:00
|
|
|
|
|
|
|
double scroll_floor_x = 0;
|
|
|
|
double scroll_floor_y = 0;
|
2018-08-18 23:14:15 +00:00
|
|
|
FName scroll_floor_type = NAME_None;
|
2017-06-04 16:03:04 +00:00
|
|
|
|
2016-03-01 15:47:10 +00:00
|
|
|
memset(sec, 0, sizeof(*sec));
|
|
|
|
sec->lightlevel = 160;
|
2016-03-30 14:30:22 +00:00
|
|
|
sec->SetXScale(sector_t::floor, 1.); // [RH] floor and ceiling scaling
|
|
|
|
sec->SetYScale(sector_t::floor, 1.);
|
|
|
|
sec->SetXScale(sector_t::ceiling, 1.);
|
|
|
|
sec->SetYScale(sector_t::ceiling, 1.);
|
|
|
|
sec->SetAlpha(sector_t::floor, 1.);
|
|
|
|
sec->SetAlpha(sector_t::ceiling, 1.);
|
2016-12-26 10:58:08 +00:00
|
|
|
sec->thinglist = nullptr;
|
|
|
|
sec->touching_thinglist = nullptr; // phares 3/14/98
|
2017-01-06 10:56:17 +00:00
|
|
|
sec->sectorportal_thinglist = nullptr;
|
2016-12-26 10:58:08 +00:00
|
|
|
sec->touching_renderthings = nullptr;
|
2016-03-01 15:47:10 +00:00
|
|
|
sec->seqType = (level.flags & LEVEL_SNDSEQTOTALCTRL) ? 0 : -1;
|
|
|
|
sec->nextsec = -1; //jff 2/26/98 add fields to support locking out
|
|
|
|
sec->prevsec = -1; // stair retriggering until build completes
|
|
|
|
sec->heightsec = NULL; // sector used to get floor and ceiling height
|
|
|
|
sec->sectornum = index;
|
|
|
|
sec->damageinterval = 32;
|
|
|
|
sec->terrainnum[sector_t::ceiling] = sec->terrainnum[sector_t::floor] = -1;
|
2018-05-19 11:33:28 +00:00
|
|
|
sec->ibocount = -1;
|
2017-01-28 18:05:39 +00:00
|
|
|
memset(sec->SpecialColors, -1, sizeof(sec->SpecialColors));
|
2016-03-01 15:47:10 +00:00
|
|
|
if (floordrop) sec->Flags = SECF_FLOORDROP;
|
|
|
|
// killough 3/7/98: end changes
|
|
|
|
|
2016-03-19 23:54:18 +00:00
|
|
|
sec->gravity = 1.; // [RH] Default sector gravity of 1.0
|
2016-03-01 15:47:10 +00:00
|
|
|
sec->ZoneNumber = 0xFFFF;
|
|
|
|
|
|
|
|
// killough 8/28/98: initialize all sectors to normal friction
|
|
|
|
sec->friction = ORIG_FRICTION;
|
|
|
|
sec->movefactor = ORIG_FRICTION_FACTOR;
|
|
|
|
|
|
|
|
sc.MustGetToken('{');
|
|
|
|
while (!sc.CheckToken('}'))
|
|
|
|
{
|
|
|
|
FName key = ParseKey();
|
|
|
|
switch(key)
|
|
|
|
{
|
|
|
|
case NAME_Heightfloor:
|
2017-03-23 09:08:48 +00:00
|
|
|
sec->SetPlaneTexZ(sector_t::floor, CheckCoordinate(key));
|
2016-03-01 15:47:10 +00:00
|
|
|
continue;
|
|
|
|
|
|
|
|
case NAME_Heightceiling:
|
2017-03-23 09:08:48 +00:00
|
|
|
sec->SetPlaneTexZ(sector_t::ceiling, CheckCoordinate(key));
|
2016-03-01 15:47:10 +00:00
|
|
|
continue;
|
|
|
|
|
|
|
|
case NAME_Texturefloor:
|
|
|
|
SetTexture(sec, index, sector_t::floor, CheckString(key), missingTex, false);
|
|
|
|
continue;
|
|
|
|
|
|
|
|
case NAME_Textureceiling:
|
|
|
|
SetTexture(sec, index, sector_t::ceiling, CheckString(key), missingTex, false);
|
|
|
|
continue;
|
|
|
|
|
|
|
|
case NAME_Lightlevel:
|
|
|
|
sec->lightlevel = sector_t::ClampLight(CheckInt(key));
|
|
|
|
continue;
|
|
|
|
|
|
|
|
case NAME_Special:
|
|
|
|
sec->special = (short)CheckInt(key);
|
|
|
|
if (isTranslated) sec->special = P_TranslateSectorSpecial(sec->special);
|
|
|
|
else if (namespc == NAME_Hexen)
|
|
|
|
{
|
2017-02-26 15:54:09 +00:00
|
|
|
if (sec->special < 0 || sec->special > 140 || !HexenSectorSpecialOk[sec->special])
|
2016-03-01 15:47:10 +00:00
|
|
|
sec->special = 0; // NULL all unknown specials
|
|
|
|
}
|
|
|
|
continue;
|
|
|
|
|
|
|
|
case NAME_Id:
|
|
|
|
tagManager.AddSectorTag(index, CheckInt(key));
|
|
|
|
continue;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (namespace_bits & (Zd|Zdt|Va)) switch(key)
|
|
|
|
{
|
|
|
|
case NAME_Xpanningfloor:
|
2016-03-30 14:30:22 +00:00
|
|
|
sec->SetXOffset(sector_t::floor, CheckFloat(key));
|
2016-03-01 15:47:10 +00:00
|
|
|
continue;
|
|
|
|
|
|
|
|
case NAME_Ypanningfloor:
|
2016-03-30 14:30:22 +00:00
|
|
|
sec->SetYOffset(sector_t::floor, CheckFloat(key));
|
2016-03-01 15:47:10 +00:00
|
|
|
continue;
|
|
|
|
|
|
|
|
case NAME_Xpanningceiling:
|
2016-03-30 14:30:22 +00:00
|
|
|
sec->SetXOffset(sector_t::ceiling, CheckFloat(key));
|
2016-03-01 15:47:10 +00:00
|
|
|
continue;
|
|
|
|
|
|
|
|
case NAME_Ypanningceiling:
|
2016-03-30 14:30:22 +00:00
|
|
|
sec->SetYOffset(sector_t::ceiling, CheckFloat(key));
|
2016-03-01 15:47:10 +00:00
|
|
|
continue;
|
|
|
|
|
|
|
|
case NAME_Xscalefloor:
|
2016-03-30 14:30:22 +00:00
|
|
|
sec->SetXScale(sector_t::floor, CheckFloat(key));
|
2016-03-01 15:47:10 +00:00
|
|
|
continue;
|
|
|
|
|
|
|
|
case NAME_Yscalefloor:
|
2016-03-30 14:30:22 +00:00
|
|
|
sec->SetYScale(sector_t::floor, CheckFloat(key));
|
2016-03-01 15:47:10 +00:00
|
|
|
continue;
|
|
|
|
|
|
|
|
case NAME_Xscaleceiling:
|
2016-03-30 14:30:22 +00:00
|
|
|
sec->SetXScale(sector_t::ceiling, CheckFloat(key));
|
2016-03-01 15:47:10 +00:00
|
|
|
continue;
|
|
|
|
|
|
|
|
case NAME_Yscaleceiling:
|
2016-03-30 14:30:22 +00:00
|
|
|
sec->SetYScale(sector_t::ceiling, CheckFloat(key));
|
2016-03-01 15:47:10 +00:00
|
|
|
continue;
|
|
|
|
|
|
|
|
case NAME_Rotationfloor:
|
|
|
|
sec->SetAngle(sector_t::floor, CheckAngle(key));
|
|
|
|
continue;
|
|
|
|
|
|
|
|
case NAME_Rotationceiling:
|
|
|
|
sec->SetAngle(sector_t::ceiling, CheckAngle(key));
|
|
|
|
continue;
|
|
|
|
|
|
|
|
case NAME_Lightfloor:
|
|
|
|
sec->SetPlaneLight(sector_t::floor, CheckInt(key));
|
|
|
|
continue;
|
|
|
|
|
|
|
|
case NAME_Lightceiling:
|
|
|
|
sec->SetPlaneLight(sector_t::ceiling, CheckInt(key));
|
|
|
|
continue;
|
|
|
|
|
|
|
|
case NAME_Alphafloor:
|
2016-03-30 14:30:22 +00:00
|
|
|
sec->SetAlpha(sector_t::floor, CheckFloat(key));
|
2016-03-01 15:47:10 +00:00
|
|
|
continue;
|
|
|
|
|
|
|
|
case NAME_Alphaceiling:
|
2016-03-30 14:30:22 +00:00
|
|
|
sec->SetAlpha(sector_t::ceiling, CheckFloat(key));
|
2016-03-01 15:47:10 +00:00
|
|
|
continue;
|
|
|
|
|
|
|
|
case NAME_Renderstylefloor:
|
|
|
|
{
|
|
|
|
const char *str = CheckString(key);
|
|
|
|
if (!stricmp(str, "translucent")) sec->ChangeFlags(sector_t::floor, PLANEF_ADDITIVE, 0);
|
|
|
|
else if (!stricmp(str, "add")) sec->ChangeFlags(sector_t::floor, 0, PLANEF_ADDITIVE);
|
|
|
|
else sc.ScriptMessage("Unknown value \"%s\" for 'renderstylefloor'\n", str);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
case NAME_Renderstyleceiling:
|
|
|
|
{
|
|
|
|
const char *str = CheckString(key);
|
|
|
|
if (!stricmp(str, "translucent")) sec->ChangeFlags(sector_t::ceiling, PLANEF_ADDITIVE, 0);
|
|
|
|
else if (!stricmp(str, "add")) sec->ChangeFlags(sector_t::ceiling, 0, PLANEF_ADDITIVE);
|
|
|
|
else sc.ScriptMessage("Unknown value \"%s\" for 'renderstyleceiling'\n", str);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
case NAME_Lightfloorabsolute:
|
|
|
|
if (CheckBool(key)) sec->ChangeFlags(sector_t::floor, 0, PLANEF_ABSLIGHTING);
|
|
|
|
else sec->ChangeFlags(sector_t::floor, PLANEF_ABSLIGHTING, 0);
|
|
|
|
continue;
|
|
|
|
|
|
|
|
case NAME_Lightceilingabsolute:
|
|
|
|
if (CheckBool(key)) sec->ChangeFlags(sector_t::ceiling, 0, PLANEF_ABSLIGHTING);
|
|
|
|
else sec->ChangeFlags(sector_t::ceiling, PLANEF_ABSLIGHTING, 0);
|
|
|
|
continue;
|
|
|
|
|
|
|
|
case NAME_Gravity:
|
2016-03-19 23:54:18 +00:00
|
|
|
sec->gravity = CheckFloat(key);
|
2016-03-01 15:47:10 +00:00
|
|
|
continue;
|
|
|
|
|
|
|
|
case NAME_Lightcolor:
|
|
|
|
lightcolor = CheckInt(key);
|
|
|
|
continue;
|
|
|
|
|
|
|
|
case NAME_Fadecolor:
|
|
|
|
fadecolor = CheckInt(key);
|
|
|
|
continue;
|
|
|
|
|
2017-01-28 18:05:39 +00:00
|
|
|
case NAME_Color_Floor:
|
2017-01-29 08:57:55 +00:00
|
|
|
sec->SpecialColors[sector_t::floor] = CheckInt(key) | 0xff000000;
|
2017-01-28 18:05:39 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_Color_Ceiling:
|
2017-01-29 08:57:55 +00:00
|
|
|
sec->SpecialColors[sector_t::ceiling] = CheckInt(key) | 0xff000000;
|
2017-01-28 18:05:39 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_Color_Walltop:
|
2017-01-29 08:57:55 +00:00
|
|
|
sec->SpecialColors[sector_t::walltop] = CheckInt(key) | 0xff000000;
|
2017-01-28 18:05:39 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_Color_Wallbottom:
|
2017-01-29 08:57:55 +00:00
|
|
|
sec->SpecialColors[sector_t::wallbottom] = CheckInt(key) | 0xff000000;
|
2017-01-28 18:05:39 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_Color_Sprites:
|
2017-01-29 08:57:55 +00:00
|
|
|
sec->SpecialColors[sector_t::sprites] = CheckInt(key) | 0xff000000;
|
2017-01-28 18:05:39 +00:00
|
|
|
break;
|
|
|
|
|
2016-03-01 15:47:10 +00:00
|
|
|
case NAME_Desaturation:
|
2017-03-15 15:47:42 +00:00
|
|
|
desaturation = int(255*CheckFloat(key) + FLT_EPSILON); // FLT_EPSILON to avoid rounding errors with numbers slightly below a full integer.
|
2016-03-01 15:47:10 +00:00
|
|
|
continue;
|
|
|
|
|
2016-12-29 00:12:17 +00:00
|
|
|
case NAME_fogdensity:
|
2017-03-15 15:47:42 +00:00
|
|
|
fogdensity = CheckInt(key);
|
2016-12-29 00:12:17 +00:00
|
|
|
break;
|
|
|
|
|
2016-03-01 15:47:10 +00:00
|
|
|
case NAME_Silent:
|
|
|
|
Flag(sec->Flags, SECF_SILENT, key);
|
|
|
|
continue;
|
|
|
|
|
|
|
|
case NAME_NoRespawn:
|
|
|
|
Flag(sec->Flags, SECF_NORESPAWN, key);
|
|
|
|
continue;
|
|
|
|
|
|
|
|
case NAME_Nofallingdamage:
|
|
|
|
Flag(sec->Flags, SECF_NOFALLINGDAMAGE, key);
|
|
|
|
continue;
|
|
|
|
|
|
|
|
case NAME_Dropactors:
|
|
|
|
Flag(sec->Flags, SECF_FLOORDROP, key);
|
|
|
|
continue;
|
|
|
|
|
|
|
|
case NAME_SoundSequence:
|
|
|
|
sec->SeqName = CheckString(key);
|
|
|
|
sec->seqType = -1;
|
|
|
|
continue;
|
|
|
|
|
|
|
|
case NAME_hidden:
|
2018-05-01 09:29:29 +00:00
|
|
|
Flag(sec->MoreFlags, SECMF_HIDDEN, key);
|
2016-03-01 15:47:10 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_Waterzone:
|
2018-05-01 09:29:29 +00:00
|
|
|
Flag(sec->MoreFlags, SECMF_UNDERWATER, key);
|
2016-03-01 15:47:10 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_floorplane_a:
|
|
|
|
fplaneflags |= 1;
|
|
|
|
fp[0] = CheckFloat(key);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_floorplane_b:
|
|
|
|
fplaneflags |= 2;
|
|
|
|
fp[1] = CheckFloat(key);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_floorplane_c:
|
|
|
|
fplaneflags |= 4;
|
|
|
|
fp[2] = CheckFloat(key);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_floorplane_d:
|
|
|
|
fplaneflags |= 8;
|
|
|
|
fp[3] = CheckFloat(key);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_ceilingplane_a:
|
|
|
|
cplaneflags |= 1;
|
|
|
|
cp[0] = CheckFloat(key);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_ceilingplane_b:
|
|
|
|
cplaneflags |= 2;
|
|
|
|
cp[1] = CheckFloat(key);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_ceilingplane_c:
|
|
|
|
cplaneflags |= 4;
|
|
|
|
cp[2] = CheckFloat(key);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_ceilingplane_d:
|
|
|
|
cplaneflags |= 8;
|
|
|
|
cp[3] = CheckFloat(key);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_damageamount:
|
|
|
|
sec->damageamount = CheckInt(key);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_damagetype:
|
|
|
|
sec->damagetype = CheckString(key);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_damageinterval:
|
|
|
|
sec->damageinterval = CheckInt(key);
|
|
|
|
if (sec->damageinterval < 1) sec->damageinterval = 1;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_leakiness:
|
|
|
|
sec->leakydamage = CheckInt(key);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_damageterraineffect:
|
|
|
|
Flag(sec->Flags, SECF_DMGTERRAINFX, key);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_damagehazard:
|
|
|
|
Flag(sec->Flags, SECF_HAZARD, key);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_floorterrain:
|
|
|
|
sec->terrainnum[sector_t::floor] = P_FindTerrain(CheckString(key));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_ceilingterrain:
|
|
|
|
sec->terrainnum[sector_t::ceiling] = P_FindTerrain(CheckString(key));
|
|
|
|
break;
|
|
|
|
|
2016-12-28 00:09:42 +00:00
|
|
|
case NAME_floor_reflect:
|
|
|
|
sec->reflect[sector_t::floor] = (float)CheckFloat(key);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_ceiling_reflect:
|
|
|
|
sec->reflect[sector_t::ceiling] = (float)CheckFloat(key);
|
|
|
|
break;
|
2017-01-01 18:36:51 +00:00
|
|
|
|
|
|
|
case NAME_floorglowcolor:
|
2018-08-16 21:05:04 +00:00
|
|
|
sec->SetGlowColor(sector_t::floor, CheckInt(key));
|
2017-01-01 18:36:51 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_floorglowheight:
|
2018-08-16 21:05:04 +00:00
|
|
|
sec->SetGlowHeight(sector_t::floor, (float)CheckFloat(key));
|
2017-01-01 18:36:51 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_ceilingglowcolor:
|
2018-08-16 21:05:04 +00:00
|
|
|
sec->SetGlowColor(sector_t::ceiling, CheckInt(key));
|
2017-01-01 18:36:51 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_ceilingglowheight:
|
2018-08-16 21:05:04 +00:00
|
|
|
sec->SetGlowHeight(sector_t::ceiling, (float)CheckFloat(key));
|
2017-01-01 18:36:51 +00:00
|
|
|
break;
|
2016-12-28 00:09:42 +00:00
|
|
|
|
2017-02-26 19:27:02 +00:00
|
|
|
case NAME_Noattack:
|
|
|
|
Flag(sec->Flags, SECF_NOATTACK, key);
|
|
|
|
break;
|
|
|
|
|
2016-03-01 15:47:10 +00:00
|
|
|
case NAME_MoreIds:
|
|
|
|
// delay parsing of the tag string until parsing of the sector is complete
|
|
|
|
// This ensures that the ID is always the first tag in the list.
|
|
|
|
tagstring = CheckString(key);
|
|
|
|
break;
|
|
|
|
|
2016-10-01 22:31:25 +00:00
|
|
|
case NAME_portal_ceil_blocksound:
|
|
|
|
Flag(sec->planes[sector_t::ceiling].Flags, PLANEF_BLOCKSOUND, key);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_portal_ceil_disabled:
|
|
|
|
Flag(sec->planes[sector_t::ceiling].Flags, PLANEF_DISABLED, key);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_portal_ceil_nopass:
|
|
|
|
Flag(sec->planes[sector_t::ceiling].Flags, PLANEF_NOPASS, key);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_portal_ceil_norender:
|
|
|
|
Flag(sec->planes[sector_t::ceiling].Flags, PLANEF_NORENDER, key);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_portal_ceil_overlaytype:
|
|
|
|
if (!stricmp(CheckString(key), "translucent")) sec->planes[sector_t::ceiling].Flags &= ~PLANEF_ADDITIVE;
|
|
|
|
else if (!stricmp(CheckString(key), "additive")) sec->planes[sector_t::ceiling].Flags |= PLANEF_ADDITIVE;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_portal_floor_blocksound:
|
|
|
|
Flag(sec->planes[sector_t::floor].Flags, PLANEF_BLOCKSOUND, key);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_portal_floor_disabled:
|
|
|
|
Flag(sec->planes[sector_t::floor].Flags, PLANEF_DISABLED, key);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_portal_floor_nopass:
|
|
|
|
Flag(sec->planes[sector_t::floor].Flags, PLANEF_NOPASS, key);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_portal_floor_norender:
|
|
|
|
Flag(sec->planes[sector_t::floor].Flags, PLANEF_NORENDER, key);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_portal_floor_overlaytype:
|
|
|
|
if (!stricmp(CheckString(key), "translucent")) sec->planes[sector_t::floor].Flags &= ~PLANEF_ADDITIVE;
|
|
|
|
else if (!stricmp(CheckString(key), "additive")) sec->planes[sector_t::floor].Flags |= PLANEF_ADDITIVE;
|
|
|
|
break;
|
|
|
|
|
2017-06-04 16:03:04 +00:00
|
|
|
case NAME_scroll_ceil_x:
|
|
|
|
scroll_ceil_x = CheckFloat(key);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_scroll_ceil_y:
|
|
|
|
scroll_ceil_y = CheckFloat(key);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_scroll_ceil_type:
|
|
|
|
scroll_ceil_type = CheckString(key);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_scroll_floor_x:
|
|
|
|
scroll_floor_x = CheckFloat(key);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_scroll_floor_y:
|
|
|
|
scroll_floor_y = CheckFloat(key);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_scroll_floor_type:
|
|
|
|
scroll_floor_type = CheckString(key);
|
|
|
|
break;
|
|
|
|
|
2016-10-01 22:31:25 +00:00
|
|
|
// These two are used by Eternity for something I do not understand.
|
|
|
|
//case NAME_portal_ceil_useglobaltex:
|
|
|
|
//case NAME_portal_floor_useglobaltex:
|
2018-10-28 22:08:38 +00:00
|
|
|
|
|
|
|
case NAME_HealthFloor:
|
|
|
|
sec->healthfloor = CheckInt(key);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_HealthCeiling:
|
|
|
|
sec->healthceiling = CheckInt(key);
|
|
|
|
break;
|
|
|
|
|
2018-11-04 04:53:37 +00:00
|
|
|
case NAME_Health3D:
|
|
|
|
sec->health3d = CheckInt(key);
|
|
|
|
break;
|
|
|
|
|
2018-10-28 22:08:38 +00:00
|
|
|
case NAME_HealthFloorGroup:
|
|
|
|
sec->healthfloorgroup = CheckInt(key);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_HealthCeilingGroup:
|
|
|
|
sec->healthceilinggroup = CheckInt(key);
|
|
|
|
break;
|
2018-11-04 04:53:37 +00:00
|
|
|
|
|
|
|
case NAME_Health3DGroup:
|
|
|
|
sec->health3dgroup = CheckInt(key);
|
|
|
|
break;
|
2016-10-01 22:31:25 +00:00
|
|
|
|
2016-03-01 15:47:10 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if ((namespace_bits & (Zd | Zdt)) && !strnicmp("user_", key.GetChars(), 5))
|
|
|
|
{
|
|
|
|
AddUserKey(key, UDMF_Sector, index);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (tagstring.IsNotEmpty())
|
|
|
|
{
|
|
|
|
FScanner sc;
|
|
|
|
sc.OpenString("tagstring", tagstring);
|
|
|
|
// scan the string as long as valid numbers can be found
|
|
|
|
while (sc.CheckNumber())
|
|
|
|
{
|
|
|
|
if (sc.Number != 0) tagManager.AddSectorTag(index, sc.Number);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sec->damageamount == 0)
|
|
|
|
{
|
|
|
|
// If no damage is set, clear all other related properties so that they do not interfere
|
|
|
|
// with other means of setting them.
|
|
|
|
sec->damagetype = NAME_None;
|
|
|
|
sec->damageinterval = 0;
|
|
|
|
sec->leakydamage = 0;
|
|
|
|
sec->Flags &= ~SECF_DAMAGEFLAGS;
|
|
|
|
}
|
2017-06-04 16:03:04 +00:00
|
|
|
|
|
|
|
// Cannot be initialized yet because they need the final sector array.
|
|
|
|
if (scroll_ceil_type != NAME_None)
|
|
|
|
{
|
|
|
|
UDMFScrollers.Push({ true, index, scroll_ceil_x, scroll_ceil_y, scroll_ceil_type });
|
|
|
|
}
|
|
|
|
if (scroll_floor_type != NAME_None)
|
|
|
|
{
|
|
|
|
UDMFScrollers.Push({ false, index, scroll_floor_x, scroll_floor_y, scroll_floor_type });
|
|
|
|
}
|
|
|
|
|
2016-03-01 15:47:10 +00:00
|
|
|
|
|
|
|
// Reset the planes to their defaults if not all of the plane equation's parameters were found.
|
|
|
|
if (fplaneflags != 15)
|
|
|
|
{
|
2016-04-24 10:15:09 +00:00
|
|
|
sec->floorplane.SetAtHeight(sec->GetPlaneTexZ(sector_t::floor), sector_t::floor);
|
2016-03-01 15:47:10 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// normalize the vector, it must have a length of 1
|
2016-03-29 10:40:41 +00:00
|
|
|
DVector3 n = DVector3(fp[0], fp[1], fp[2]).Unit();
|
|
|
|
sec->floorplane.set(n.X, n.Y, n.Z, fp[3]);
|
2016-03-01 15:47:10 +00:00
|
|
|
}
|
|
|
|
if (cplaneflags != 15)
|
|
|
|
{
|
2016-04-24 10:15:09 +00:00
|
|
|
sec->ceilingplane.SetAtHeight(sec->GetPlaneTexZ(sector_t::ceiling), sector_t::ceiling);
|
2016-03-01 15:47:10 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2016-03-29 10:40:41 +00:00
|
|
|
DVector3 n = DVector3(cp[0], cp[1], cp[2]).Unit();
|
|
|
|
sec->ceilingplane.set(n.X, n.Y, n.Z, cp[3]);
|
2016-03-01 15:47:10 +00:00
|
|
|
}
|
|
|
|
|
2017-01-06 10:43:27 +00:00
|
|
|
if (lightcolor == ~0u && fadecolor == ~0u && desaturation == -1 && fogdensity == -1)
|
2016-03-01 15:47:10 +00:00
|
|
|
{
|
|
|
|
// [RH] Sectors default to white light with the default fade.
|
|
|
|
// If they are outside (have a sky ceiling), they use the outside fog.
|
2017-03-15 15:47:42 +00:00
|
|
|
sec->Colormap.LightColor = PalEntry(255, 255, 255);
|
2016-03-01 15:47:10 +00:00
|
|
|
if (level.outsidefog != 0xff000000 && (sec->GetTexture(sector_t::ceiling) == skyflatnum || (sec->special & 0xff) == Sector_Outside))
|
|
|
|
{
|
2017-03-15 15:47:42 +00:00
|
|
|
sec->Colormap.FadeColor.SetRGB(level.outsidefog);
|
2016-03-01 15:47:10 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2017-03-15 15:47:42 +00:00
|
|
|
sec->Colormap.FadeColor.SetRGB(level.fadeto);
|
2016-03-01 15:47:10 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2017-03-15 15:47:42 +00:00
|
|
|
sec->Colormap.LightColor.SetRGB(lightcolor);
|
2017-01-06 10:43:27 +00:00
|
|
|
if (fadecolor == ~0u)
|
2016-03-01 15:47:10 +00:00
|
|
|
{
|
|
|
|
if (level.outsidefog != 0xff000000 && (sec->GetTexture(sector_t::ceiling) == skyflatnum || (sec->special & 0xff) == Sector_Outside))
|
|
|
|
fadecolor = level.outsidefog;
|
|
|
|
else
|
|
|
|
fadecolor = level.fadeto;
|
|
|
|
}
|
2017-03-15 15:47:42 +00:00
|
|
|
sec->Colormap.FadeColor.SetRGB(fadecolor);
|
|
|
|
sec->Colormap.Desaturation = clamp(desaturation, 0, 255);
|
|
|
|
sec->Colormap.FogDensity = clamp(fogdensity, 0, 512) / 2;
|
2016-03-01 15:47:10 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//===========================================================================
|
|
|
|
//
|
|
|
|
// parse a vertex block
|
|
|
|
//
|
|
|
|
//===========================================================================
|
|
|
|
|
|
|
|
void ParseVertex(vertex_t *vt, vertexdata_t *vd)
|
|
|
|
{
|
2016-03-29 08:07:06 +00:00
|
|
|
vt->set(0, 0);
|
2016-03-01 15:47:10 +00:00
|
|
|
vd->zCeiling = vd->zFloor = vd->flags = 0;
|
2016-03-23 12:31:12 +00:00
|
|
|
|
|
|
|
sc.MustGetToken('{');
|
2017-03-11 18:02:00 +00:00
|
|
|
double x = 0, y = 0;
|
2016-03-23 12:31:12 +00:00
|
|
|
while (!sc.CheckToken('}'))
|
2016-03-01 15:47:10 +00:00
|
|
|
{
|
2016-03-23 12:31:12 +00:00
|
|
|
FName key = ParseKey();
|
|
|
|
switch (key)
|
2016-03-01 15:47:10 +00:00
|
|
|
{
|
|
|
|
case NAME_X:
|
2017-03-23 09:08:48 +00:00
|
|
|
x = CheckCoordinate(key);
|
2016-03-01 15:47:10 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_Y:
|
2017-03-23 09:08:48 +00:00
|
|
|
y = CheckCoordinate(key);
|
2016-03-01 15:47:10 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_ZCeiling:
|
2017-03-23 09:08:48 +00:00
|
|
|
vd->zCeiling = CheckCoordinate(key);
|
2016-03-01 15:47:10 +00:00
|
|
|
vd->flags |= VERTEXFLAG_ZCeilingEnabled;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_ZFloor:
|
2017-03-23 09:08:48 +00:00
|
|
|
vd->zFloor = CheckCoordinate(key);
|
2016-03-01 15:47:10 +00:00
|
|
|
vd->flags |= VERTEXFLAG_ZFloorEnabled;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2016-03-29 08:07:06 +00:00
|
|
|
vt->set(x, y);
|
2016-03-01 15:47:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//===========================================================================
|
|
|
|
//
|
|
|
|
// Processes the linedefs after the map has been loaded
|
|
|
|
//
|
|
|
|
//===========================================================================
|
|
|
|
|
|
|
|
void ProcessLineDefs()
|
|
|
|
{
|
|
|
|
int sidecount = 0;
|
|
|
|
for(unsigned i = 0, skipped = 0; i < ParsedLines.Size();)
|
|
|
|
{
|
|
|
|
// Relocate the vertices
|
|
|
|
intptr_t v1i = intptr_t(ParsedLines[i].v1);
|
|
|
|
intptr_t v2i = intptr_t(ParsedLines[i].v2);
|
|
|
|
|
2017-02-15 12:17:20 +00:00
|
|
|
if ((unsigned)v1i >= level.vertexes.Size() || (unsigned)v2i >= level.vertexes.Size())
|
2016-03-01 15:47:10 +00:00
|
|
|
{
|
2017-01-08 23:46:16 +00:00
|
|
|
I_Error ("Line %d has invalid vertices: %zd and/or %zd.\nThe map only contains %u vertices.", i+skipped, v1i, v2i, level.vertexes.Size());
|
2016-03-01 15:47:10 +00:00
|
|
|
}
|
|
|
|
else if (v1i == v2i ||
|
2017-01-08 23:46:16 +00:00
|
|
|
(level.vertexes[v1i].fX() == level.vertexes[v2i].fX() && level.vertexes[v1i].fY() == level.vertexes[v2i].fY()))
|
2016-03-01 15:47:10 +00:00
|
|
|
{
|
|
|
|
Printf ("Removing 0-length line %d\n", i+skipped);
|
|
|
|
ParsedLines.Delete(i);
|
|
|
|
ForceNodeBuild = true;
|
|
|
|
skipped++;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2017-01-08 23:46:16 +00:00
|
|
|
ParsedLines[i].v1 = &level.vertexes[v1i];
|
|
|
|
ParsedLines[i].v2 = &level.vertexes[v2i];
|
2016-03-01 15:47:10 +00:00
|
|
|
|
|
|
|
if (ParsedLines[i].sidedef[0] != NULL)
|
|
|
|
sidecount++;
|
|
|
|
if (ParsedLines[i].sidedef[1] != NULL)
|
|
|
|
sidecount++;
|
|
|
|
linemap.Push(i+skipped);
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
}
|
2017-01-08 13:39:16 +00:00
|
|
|
unsigned numlines = ParsedLines.Size();
|
2017-01-08 17:45:30 +00:00
|
|
|
level.sides.Alloc(sidecount);
|
2017-01-08 13:39:16 +00:00
|
|
|
level.lines.Alloc(numlines);
|
2016-03-01 15:47:10 +00:00
|
|
|
int line, side;
|
2017-01-08 13:39:16 +00:00
|
|
|
auto lines = &level.lines[0];
|
2017-01-08 17:45:30 +00:00
|
|
|
auto sides = &level.sides[0];
|
2016-03-01 15:47:10 +00:00
|
|
|
|
2017-01-08 13:39:16 +00:00
|
|
|
for(line = 0, side = 0; line < (int)numlines; line++)
|
2016-03-01 15:47:10 +00:00
|
|
|
{
|
|
|
|
short tempalpha[2] = { SHRT_MIN, SHRT_MIN };
|
|
|
|
|
|
|
|
lines[line] = ParsedLines[line];
|
|
|
|
|
|
|
|
for(int sd = 0; sd < 2; sd++)
|
|
|
|
{
|
|
|
|
if (lines[line].sidedef[sd] != NULL)
|
|
|
|
{
|
|
|
|
int mapside = int(intptr_t(lines[line].sidedef[sd]))-1;
|
|
|
|
if (mapside < sidecount)
|
|
|
|
{
|
|
|
|
sides[side] = ParsedSides[mapside];
|
|
|
|
sides[side].linedef = &lines[line];
|
2017-01-07 18:32:24 +00:00
|
|
|
sides[side].sector = &level.sectors[intptr_t(sides[side].sector)];
|
2016-03-01 15:47:10 +00:00
|
|
|
lines[line].sidedef[sd] = &sides[side];
|
|
|
|
|
|
|
|
P_ProcessSideTextures(!isExtended, &sides[side], sides[side].sector, &ParsedSideTextures[mapside],
|
|
|
|
lines[line].special, lines[line].args[0], &tempalpha[sd], missingTex);
|
|
|
|
|
|
|
|
side++;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
lines[line].sidedef[sd] = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
P_AdjustLine(&lines[line]);
|
|
|
|
P_FinishLoadingLineDef(&lines[line], tempalpha[0]);
|
|
|
|
}
|
2017-04-24 12:57:30 +00:00
|
|
|
|
|
|
|
const int sideDelta = level.sides.Size() - side;
|
|
|
|
assert(sideDelta >= 0);
|
|
|
|
|
|
|
|
if (sideDelta < 0)
|
|
|
|
{
|
|
|
|
Printf("Map had %d invalid side references\n", abs(sideDelta));
|
|
|
|
}
|
|
|
|
else if (sideDelta > 0)
|
2016-03-01 15:47:10 +00:00
|
|
|
{
|
2017-04-24 12:57:30 +00:00
|
|
|
level.sides.Resize(side);
|
2016-03-01 15:47:10 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//===========================================================================
|
|
|
|
//
|
|
|
|
// Main parsing function
|
|
|
|
//
|
|
|
|
//===========================================================================
|
|
|
|
|
|
|
|
void ParseTextMap(MapData *map)
|
|
|
|
{
|
|
|
|
isTranslated = true;
|
|
|
|
isExtended = false;
|
|
|
|
floordrop = false;
|
|
|
|
|
2018-11-10 10:56:18 +00:00
|
|
|
sc.OpenMem(Wads.GetLumpFullName(map->lumpnum), map->Read(ML_TEXTMAP));
|
2016-03-01 15:47:10 +00:00
|
|
|
sc.SetCMode(true);
|
|
|
|
if (sc.CheckString("namespace"))
|
|
|
|
{
|
|
|
|
sc.MustGetStringName("=");
|
|
|
|
sc.MustGetString();
|
|
|
|
namespc = sc.String;
|
|
|
|
switch(namespc)
|
|
|
|
{
|
|
|
|
case NAME_ZDoom:
|
|
|
|
namespace_bits = Zd;
|
|
|
|
isTranslated = false;
|
|
|
|
break;
|
|
|
|
case NAME_ZDoomTranslated:
|
|
|
|
level.flags2 |= LEVEL2_DUMMYSWITCHES;
|
|
|
|
namespace_bits = Zdt;
|
|
|
|
break;
|
|
|
|
case NAME_Vavoom:
|
|
|
|
namespace_bits = Va;
|
|
|
|
isTranslated = false;
|
|
|
|
break;
|
|
|
|
case NAME_Hexen:
|
|
|
|
namespace_bits = Hx;
|
|
|
|
isTranslated = false;
|
|
|
|
break;
|
|
|
|
case NAME_Doom:
|
|
|
|
namespace_bits = Dm;
|
|
|
|
P_LoadTranslator("xlat/doom_base.txt");
|
|
|
|
level.flags2 |= LEVEL2_DUMMYSWITCHES;
|
|
|
|
floordrop = true;
|
|
|
|
break;
|
|
|
|
case NAME_Heretic:
|
|
|
|
namespace_bits = Ht;
|
|
|
|
P_LoadTranslator("xlat/heretic_base.txt");
|
|
|
|
level.flags2 |= LEVEL2_DUMMYSWITCHES;
|
|
|
|
floordrop = true;
|
|
|
|
break;
|
|
|
|
case NAME_Strife:
|
|
|
|
namespace_bits = St;
|
|
|
|
P_LoadTranslator("xlat/strife_base.txt");
|
|
|
|
level.flags2 |= LEVEL2_DUMMYSWITCHES|LEVEL2_RAILINGHACK;
|
|
|
|
floordrop = true;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
Printf("Unknown namespace %s. Using defaults for %s\n", sc.String, GameTypeName());
|
|
|
|
switch (gameinfo.gametype)
|
|
|
|
{
|
|
|
|
default: // Shh, GCC
|
|
|
|
case GAME_Doom:
|
|
|
|
case GAME_Chex:
|
|
|
|
namespace_bits = Dm;
|
|
|
|
P_LoadTranslator("xlat/doom_base.txt");
|
|
|
|
break;
|
|
|
|
case GAME_Heretic:
|
|
|
|
namespace_bits = Ht;
|
|
|
|
P_LoadTranslator("xlat/heretic_base.txt");
|
|
|
|
break;
|
|
|
|
case GAME_Strife:
|
|
|
|
namespace_bits = St;
|
|
|
|
P_LoadTranslator("xlat/strife_base.txt");
|
|
|
|
break;
|
|
|
|
case GAME_Hexen:
|
|
|
|
namespace_bits = Hx;
|
|
|
|
isTranslated = false;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
sc.MustGetStringName(";");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Printf("Map does not define a namespace.\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
while (sc.GetString())
|
|
|
|
{
|
|
|
|
if (sc.Compare("thing"))
|
|
|
|
{
|
|
|
|
FMapThing th;
|
|
|
|
unsigned userdatastart = MapThingsUserData.Size();
|
|
|
|
ParseThing(&th);
|
|
|
|
MapThingsConverted.Push(th);
|
|
|
|
if (userdatastart < MapThingsUserData.Size())
|
|
|
|
{ // User data added
|
|
|
|
MapThingsUserDataIndex[MapThingsConverted.Size()-1] = userdatastart;
|
|
|
|
// Mark end of the user data for this map thing
|
2018-03-19 14:39:50 +00:00
|
|
|
FUDMFKey ukey;
|
|
|
|
ukey.Key = NAME_None;
|
|
|
|
ukey = 0;
|
|
|
|
MapThingsUserData.Push(ukey);
|
2016-03-01 15:47:10 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (sc.Compare("linedef"))
|
|
|
|
{
|
|
|
|
line_t li;
|
|
|
|
ParseLinedef(&li, ParsedLines.Size());
|
|
|
|
ParsedLines.Push(li);
|
|
|
|
}
|
|
|
|
else if (sc.Compare("sidedef"))
|
|
|
|
{
|
|
|
|
side_t si;
|
|
|
|
intmapsidedef_t st;
|
|
|
|
ParseSidedef(&si, &st, ParsedSides.Size());
|
|
|
|
ParsedSides.Push(si);
|
|
|
|
ParsedSideTextures.Push(st);
|
|
|
|
}
|
|
|
|
else if (sc.Compare("sector"))
|
|
|
|
{
|
|
|
|
sector_t sec;
|
2017-04-25 17:55:05 +00:00
|
|
|
memset(&sec, 0, sizeof(sector_t));
|
2016-03-01 15:47:10 +00:00
|
|
|
ParseSector(&sec, ParsedSectors.Size());
|
|
|
|
ParsedSectors.Push(sec);
|
|
|
|
}
|
|
|
|
else if (sc.Compare("vertex"))
|
|
|
|
{
|
|
|
|
vertex_t vt;
|
|
|
|
vertexdata_t vd;
|
|
|
|
ParseVertex(&vt, &vd);
|
|
|
|
ParsedVertices.Push(vt);
|
2017-01-09 00:40:14 +00:00
|
|
|
vertexdatas.Push(vd);
|
2016-03-01 15:47:10 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Skip();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Catch bogus maps here rather than during nodebuilding
|
2017-03-23 09:19:07 +00:00
|
|
|
if (ParsedVertices.Size() == 0) I_Error("Map has no vertices.");
|
|
|
|
if (ParsedSectors.Size() == 0) I_Error("Map has no sectors. ");
|
|
|
|
if (ParsedLines.Size() == 0) I_Error("Map has no linedefs.");
|
|
|
|
if (ParsedSides.Size() == 0) I_Error("Map has no sidedefs.");
|
|
|
|
if (BadCoordinates) I_Error("Map has out of range coordinates");
|
2016-03-01 15:47:10 +00:00
|
|
|
|
|
|
|
// Create the real vertices
|
2017-01-08 23:46:16 +00:00
|
|
|
level.vertexes.Alloc(ParsedVertices.Size());
|
|
|
|
memcpy(&level.vertexes[0], &ParsedVertices[0], level.vertexes.Size() * sizeof(vertex_t));
|
2016-03-01 15:47:10 +00:00
|
|
|
|
|
|
|
// Create the real sectors
|
2017-01-07 18:32:24 +00:00
|
|
|
level.sectors.Alloc(ParsedSectors.Size());
|
|
|
|
memcpy(&level.sectors[0], &ParsedSectors[0], level.sectors.Size() * sizeof(sector_t));
|
|
|
|
level.sectors[0].e = new extsector_t[level.sectors.Size()];
|
|
|
|
for(unsigned i = 0; i < level.sectors.Size(); i++)
|
2016-03-01 15:47:10 +00:00
|
|
|
{
|
2017-01-07 18:32:24 +00:00
|
|
|
level.sectors[i].e = &level.sectors[0].e[i];
|
2016-03-01 15:47:10 +00:00
|
|
|
}
|
2017-06-04 16:03:04 +00:00
|
|
|
// Now create the scrollers.
|
|
|
|
for (auto &scroll : UDMFScrollers)
|
|
|
|
{
|
|
|
|
const double scrollfactor = 1 / 3.2; // I hope this is correct, it's just a guess taken from Eternity's code.
|
|
|
|
if (scroll.type == NAME_Both || scroll.type == NAME_Visual)
|
|
|
|
{
|
|
|
|
P_CreateScroller(scroll.ceiling ? EScroll::sc_ceiling : EScroll::sc_floor, scroll.x * scrollfactor, scroll.y * scrollfactor, -1, scroll.index, 0);
|
|
|
|
}
|
|
|
|
if (scroll.type == NAME_Both || scroll.type == NAME_Physical)
|
|
|
|
{
|
|
|
|
// sc_carry_ceiling doesn't do anything yet.
|
|
|
|
P_CreateScroller(scroll.ceiling ? EScroll::sc_carry_ceiling : EScroll::sc_carry, scroll.x * scrollfactor, scroll.y * scrollfactor, -1, scroll.index, 0);
|
|
|
|
}
|
|
|
|
}
|
2016-03-01 15:47:10 +00:00
|
|
|
|
|
|
|
// Create the real linedefs and decompress the sidedefs
|
|
|
|
ProcessLineDefs();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
void P_ParseTextMap(MapData *map, FMissingTextureTracker &missingtex)
|
|
|
|
{
|
|
|
|
UDMFParser parse(missingtex);
|
|
|
|
|
|
|
|
parse.ParseTextMap(map);
|
|
|
|
}
|