mirror of
https://github.com/ZDoom/qzdoom.git
synced 2025-02-20 19:02:43 +00:00
- removed the implicit conversion operators from FName.
These were creating dangerous interdependencies. It is better to do explicit conversions when needed. As an added plus, this means that zstring.h no longer depends on name.h which was very annoying.
This commit is contained in:
parent
6996d54a23
commit
ace3e29473
57 changed files with 184 additions and 200 deletions
|
@ -1993,7 +1993,7 @@ static void C_TabComplete (bool goForward)
|
|||
else
|
||||
{
|
||||
CmdLineText.Truncate(TabStart);
|
||||
CmdLineText << TabCommands[TabPos].TabName << ' ';
|
||||
CmdLineText << TabCommands[TabPos].TabName.GetChars() << ' ';
|
||||
}
|
||||
}
|
||||
CmdLine.SetString(CmdLineText);
|
||||
|
@ -2043,9 +2043,9 @@ static bool C_TabCompleteList ()
|
|||
// [Dusk] Print console commands blue, CVars green, aliases red.
|
||||
const char* colorcode = "";
|
||||
FConsoleCommand* ccmd;
|
||||
if (FindCVar (TabCommands[i].TabName, NULL))
|
||||
if (FindCVar (TabCommands[i].TabName.GetChars(), NULL))
|
||||
colorcode = TEXTCOLOR_GREEN;
|
||||
else if ((ccmd = FConsoleCommand::FindByName (TabCommands[i].TabName)) != NULL)
|
||||
else if ((ccmd = FConsoleCommand::FindByName (TabCommands[i].TabName.GetChars())) != NULL)
|
||||
{
|
||||
if (ccmd->IsAlias())
|
||||
colorcode = TEXTCOLOR_RED;
|
||||
|
|
|
@ -1436,7 +1436,7 @@ DEFINE_ACTION_FUNCTION(_CVar, FindCVar)
|
|||
{
|
||||
PARAM_PROLOGUE;
|
||||
PARAM_NAME(name);
|
||||
ACTION_RETURN_POINTER(FindCVar(name, nullptr));
|
||||
ACTION_RETURN_POINTER(FindCVar(name.GetChars(), nullptr));
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(_CVar, GetCVar)
|
||||
|
@ -1444,7 +1444,7 @@ DEFINE_ACTION_FUNCTION(_CVar, GetCVar)
|
|||
PARAM_PROLOGUE;
|
||||
PARAM_NAME(name);
|
||||
PARAM_POINTER(plyr, player_t);
|
||||
ACTION_RETURN_POINTER(GetCVar(plyr ? int(plyr - players) : -1, name));
|
||||
ACTION_RETURN_POINTER(GetCVar(plyr ? int(plyr - players) : -1, name.GetChars()));
|
||||
}
|
||||
|
||||
FBaseCVar *FindCVarSub (const char *var_name, int namelen)
|
||||
|
|
|
@ -426,7 +426,7 @@ static bool DoSubstitution (FString &out, const char *in)
|
|||
}
|
||||
else
|
||||
{
|
||||
out += weapon->GetClass()->TypeName;
|
||||
out += weapon->GetClass()->TypeName.GetChars();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1409,7 +1409,7 @@ void D_DoAdvanceDemo (void)
|
|||
gamestate = GS_DEMOSCREEN;
|
||||
if (gameinfo.creditPages.Size() > 0)
|
||||
{
|
||||
pagename = gameinfo.creditPages[pagecount];
|
||||
pagename = gameinfo.creditPages[pagecount].GetChars();
|
||||
pagecount = (pagecount+1) % gameinfo.creditPages.Size();
|
||||
}
|
||||
demosequence = 1;
|
||||
|
|
|
@ -2539,7 +2539,7 @@ void Net_DoCommand (int type, uint8_t **stream, int player)
|
|||
s = ReadString(stream);
|
||||
int argn = ReadByte(stream);
|
||||
|
||||
RunScript(stream, players[player].mo, -FName(s), argn & 127, (argn & 128) ? ACS_ALWAYS : 0);
|
||||
RunScript(stream, players[player].mo, -FName(s).GetIndex(), argn & 127, (argn & 128) ? ACS_ALWAYS : 0);
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
|
@ -820,7 +820,7 @@ void D_ReadUserInfoStrings (int pnum, uint8_t **stream, bool update)
|
|||
}
|
||||
|
||||
// A few of these need special handling.
|
||||
switch (keyname)
|
||||
switch (keyname.GetIndex())
|
||||
{
|
||||
case NAME_Gender:
|
||||
info->GenderChanged(value);
|
||||
|
@ -904,7 +904,7 @@ void WriteUserInfo(FSerializer &arc, userinfo_t &info)
|
|||
|
||||
while (it.NextPair(pair))
|
||||
{
|
||||
name = pair->Key;
|
||||
name = pair->Key.GetChars();
|
||||
name.ToLower();
|
||||
switch (pair->Key.GetIndex())
|
||||
{
|
||||
|
@ -945,7 +945,7 @@ void ReadUserInfo(FSerializer &arc, userinfo_t &info, FString &skin)
|
|||
FBaseCVar **cvar = info.CheckKey(name);
|
||||
if (cvar != NULL && *cvar != NULL)
|
||||
{
|
||||
switch (name)
|
||||
switch (name.GetIndex())
|
||||
{
|
||||
case NAME_Team: info.TeamChanged(atoi(str)); break;
|
||||
case NAME_Skin: skin = str; break; // Caller must call SkinChanged() once current calss is known
|
||||
|
|
|
@ -195,7 +195,7 @@ static int cregcmp (const void *a, const void *b) NO_SANITIZE
|
|||
{
|
||||
const PClass *class1 = *(const PClass **)a;
|
||||
const PClass *class2 = *(const PClass **)b;
|
||||
return strcmp(class1->TypeName, class2->TypeName);
|
||||
return strcmp(class1->TypeName.GetChars(), class2->TypeName.GetChars());
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
|
@ -605,7 +605,7 @@ void FLevelLocals::ChangeLevel(const char *levelname, int position, int inflags,
|
|||
}
|
||||
else
|
||||
{
|
||||
nextlevel.Format("enDSeQ%04x", int(gameinfo.DefaultEndSequence));
|
||||
nextlevel.Format("enDSeQ%04x", gameinfo.DefaultEndSequence.GetIndex());
|
||||
}
|
||||
}
|
||||
else if (strncmp(levelname, "enDSeQ", 6) != 0)
|
||||
|
|
|
@ -374,7 +374,7 @@ int FMugShot::UpdateState(player_t *player, StateFlags stateflags)
|
|||
{
|
||||
full_state_name = "pain.";
|
||||
}
|
||||
full_state_name += player->LastDamageType;
|
||||
full_state_name += player->LastDamageType.GetChars();
|
||||
if (SetState(full_state_name, false, true))
|
||||
{
|
||||
bDamageFaceActive = (CurrentState != NULL);
|
||||
|
@ -401,7 +401,7 @@ int FMugShot::UpdateState(player_t *player, StateFlags stateflags)
|
|||
{
|
||||
full_state_name = "pain.";
|
||||
}
|
||||
full_state_name += player->LastDamageType;
|
||||
full_state_name += player->LastDamageType.GetChars();
|
||||
if (SetState(full_state_name))
|
||||
{
|
||||
bOuchActive = use_ouch;
|
||||
|
@ -443,7 +443,7 @@ int FMugShot::UpdateState(player_t *player, StateFlags stateflags)
|
|||
{
|
||||
full_state_name = "xdeath.";
|
||||
}
|
||||
full_state_name += player->LastDamageType;
|
||||
full_state_name += player->LastDamageType.GetChars();
|
||||
SetState(full_state_name);
|
||||
bNormal = true; //Allow the face to return to alive states when the player respawns.
|
||||
}
|
||||
|
|
|
@ -496,7 +496,7 @@ void FWeaponSlots::SetFromPlayer(PClassActor *type)
|
|||
{
|
||||
if (Slot[i] != NAME_None)
|
||||
{
|
||||
Slots[i].AddWeaponList(Slot[i], false);
|
||||
Slots[i].AddWeaponList(Slot[i].GetChars(), false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2115,7 +2115,7 @@ static int PatchCodePtrs (int dummy)
|
|||
{
|
||||
if (!symname.CompareNoCase(MBFCodePointers[i].alias))
|
||||
{
|
||||
symname = MBFCodePointers[i].name;
|
||||
symname = MBFCodePointers[i].name.GetChars();
|
||||
DPrintf(DMSG_SPAMMY, "%s --> %s\n", MBFCodePointers[i].alias, MBFCodePointers[i].name.GetChars());
|
||||
ismbfcp = true;
|
||||
break;
|
||||
|
|
|
@ -283,7 +283,7 @@ void FDecalLib::ReadAllDecals ()
|
|||
FName v = ENamedName(intptr_t(def->DecalGenerator));
|
||||
if (v.IsValidName())
|
||||
{
|
||||
def->DecalGenerator = ScanTreeForName (v, Root);
|
||||
def->DecalGenerator = ScanTreeForName (v.GetChars(), Root);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -809,7 +809,7 @@ void FDecalLib::AddDecal (FDecalBase *decal)
|
|||
// Check if this decal already exists.
|
||||
while (node != NULL)
|
||||
{
|
||||
int lexx = stricmp (decal->Name, node->Name);
|
||||
int lexx = stricmp (decal->Name.GetChars(), node->Name.GetChars());
|
||||
if (lexx == 0)
|
||||
{
|
||||
break;
|
||||
|
@ -910,7 +910,7 @@ FDecalBase *FDecalLib::ScanTreeForName (const char *name, FDecalBase *root)
|
|||
{
|
||||
while (root != NULL)
|
||||
{
|
||||
int lexx = stricmp (name, root->Name);
|
||||
int lexx = stricmp (name, root->Name.GetChars());
|
||||
if (lexx == 0)
|
||||
{
|
||||
break;
|
||||
|
@ -1145,7 +1145,7 @@ FDecalAnimator *FDecalLib::FindAnimator (const char *name)
|
|||
|
||||
for (i = (int)Animators.Size ()-1; i >= 0; --i)
|
||||
{
|
||||
if (stricmp (name, Animators[i]->Name) == 0)
|
||||
if (stricmp (name, Animators[i]->Name.GetChars()) == 0)
|
||||
{
|
||||
return Animators[i];
|
||||
}
|
||||
|
|
|
@ -536,7 +536,7 @@ void V_InitFontColors ()
|
|||
|
||||
static int TranslationMapCompare (const void *a, const void *b)
|
||||
{
|
||||
return int(((const TranslationMap *)a)->Name) - int(((const TranslationMap *)b)->Name);
|
||||
return int(((const TranslationMap *)a)->Name.GetIndex()) - int(((const TranslationMap *)b)->Name.GetIndex());
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
|
@ -901,7 +901,7 @@ void FMapInfoParser::ParseNextMap(FString &mapname)
|
|||
FName seq = CheckEndSequence();
|
||||
if (seq != NAME_None)
|
||||
{
|
||||
mapname.Format("enDSeQ%04x", int(seq));
|
||||
mapname.Format("enDSeQ%04x", seq.GetIndex());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1925,7 +1925,7 @@ level_info_t *FMapInfoParser::ParseMapHeader(level_info_t &defaultinfo)
|
|||
sc.MustGetString();
|
||||
mapname = sc.String;
|
||||
}
|
||||
int levelindex = FindWadLevelInfo (mapname);
|
||||
int levelindex = FindWadLevelInfo (mapname.GetChars());
|
||||
if (levelindex == -1)
|
||||
{
|
||||
levelindex = wadlevelinfos.Reserve(1);
|
||||
|
@ -1951,7 +1951,7 @@ level_info_t *FMapInfoParser::ParseMapHeader(level_info_t &defaultinfo)
|
|||
|
||||
}
|
||||
|
||||
levelinfo->MapName = mapname;
|
||||
levelinfo->MapName = mapname.GetChars();
|
||||
levelinfo->MapName.ToUpper();
|
||||
sc.MustGetString ();
|
||||
if (sc.String[0] == '$')
|
||||
|
|
|
@ -456,6 +456,6 @@ void FMapInfoParser::ParseGameInfo()
|
|||
const char *gameinfo_t::GetFinalePage(unsigned int num) const
|
||||
{
|
||||
if (finalePages.Size() == 0) return "-NOFLAT-";
|
||||
else if (num < 1 || num > finalePages.Size()) return finalePages[0];
|
||||
else return finalePages[num-1];
|
||||
else if (num < 1 || num > finalePages.Size()) return finalePages[0].GetChars();
|
||||
else return finalePages[num-1].GetChars();
|
||||
}
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
|
||||
#include "basics.h"
|
||||
#include "zstring.h"
|
||||
#include "name.h"
|
||||
|
||||
// Flags are not user configurable and only depend on the standard IWADs
|
||||
enum
|
||||
|
|
|
@ -421,7 +421,7 @@ void CommitUMapinfo(level_info_t *defaultinfo)
|
|||
}
|
||||
if (name != NAME_None)
|
||||
{
|
||||
levelinfo->NextMap.Format("enDSeQ%04x", int(name));
|
||||
levelinfo->NextMap.Format("enDSeQ%04x", name.GetIndex());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -369,7 +369,7 @@ DEFINE_ACTION_FUNCTION(DLevelPostProcessor, GetThingStringArgument)
|
|||
|
||||
const FName argument = thing < self->loader->MapThingsConverted.Size()
|
||||
? self->loader->MapThingsConverted[thing].arg0str : NAME_None;
|
||||
ACTION_RETURN_INT(argument);
|
||||
ACTION_RETURN_INT(argument.GetIndex());
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(DLevelPostProcessor, SetThingArgument)
|
||||
|
|
|
@ -226,56 +226,56 @@ FName UDMFParserBase::ParseKey(bool checkblock, bool *isblock)
|
|||
//
|
||||
//===========================================================================
|
||||
|
||||
int UDMFParserBase::CheckInt(const char *key)
|
||||
int UDMFParserBase::CheckInt(FName key)
|
||||
{
|
||||
if (sc.TokenType != TK_IntConst)
|
||||
{
|
||||
sc.ScriptMessage("Integer value expected for key '%s'", key);
|
||||
sc.ScriptMessage("Integer value expected for key '%s'", key.GetChars());
|
||||
}
|
||||
return sc.Number;
|
||||
}
|
||||
|
||||
double UDMFParserBase::CheckFloat(const char *key)
|
||||
double UDMFParserBase::CheckFloat(FName key)
|
||||
{
|
||||
if (sc.TokenType != TK_IntConst && sc.TokenType != TK_FloatConst)
|
||||
{
|
||||
sc.ScriptMessage("Floating point value expected for key '%s'", key);
|
||||
sc.ScriptMessage("Floating point value expected for key '%s'", key.GetChars());
|
||||
}
|
||||
return sc.Float;
|
||||
}
|
||||
|
||||
double UDMFParserBase::CheckCoordinate(const char *key)
|
||||
double UDMFParserBase::CheckCoordinate(FName key)
|
||||
{
|
||||
if (sc.TokenType != TK_IntConst && sc.TokenType != TK_FloatConst)
|
||||
{
|
||||
sc.ScriptMessage("Floating point value expected for key '%s'", key);
|
||||
sc.ScriptMessage("Floating point value expected for key '%s'", key.GetChars());
|
||||
}
|
||||
if (sc.Float < -32768 || sc.Float > 32768)
|
||||
{
|
||||
sc.ScriptMessage("Value %f out of range for a coordinate '%s'. Valid range is [-32768 .. 32768]", sc.Float, key);
|
||||
sc.ScriptMessage("Value %f out of range for a coordinate '%s'. Valid range is [-32768 .. 32768]", sc.Float, key.GetChars());
|
||||
BadCoordinates = true; // If this happens the map must not allowed to be started.
|
||||
}
|
||||
return sc.Float;
|
||||
}
|
||||
|
||||
DAngle UDMFParserBase::CheckAngle(const char *key)
|
||||
DAngle UDMFParserBase::CheckAngle(FName key)
|
||||
{
|
||||
return DAngle(CheckFloat(key)).Normalized360();
|
||||
}
|
||||
|
||||
bool UDMFParserBase::CheckBool(const char *key)
|
||||
bool UDMFParserBase::CheckBool(FName key)
|
||||
{
|
||||
if (sc.TokenType == TK_True) return true;
|
||||
if (sc.TokenType == TK_False) return false;
|
||||
sc.ScriptMessage("Boolean value expected for key '%s'", key);
|
||||
sc.ScriptMessage("Boolean value expected for key '%s'", key.GetChars());
|
||||
return false;
|
||||
}
|
||||
|
||||
const char *UDMFParserBase::CheckString(const char *key)
|
||||
const char *UDMFParserBase::CheckString(FName key)
|
||||
{
|
||||
if (sc.TokenType != TK_StringConst)
|
||||
{
|
||||
sc.ScriptMessage("String value expected for key '%s'", key);
|
||||
sc.ScriptMessage("String value expected for key '%s'", key.GetChars());
|
||||
}
|
||||
return parsedString;
|
||||
}
|
||||
|
@ -291,7 +291,7 @@ static int udmfcmp(const void *a, const void *b)
|
|||
FUDMFKey *A = (FUDMFKey*)a;
|
||||
FUDMFKey *B = (FUDMFKey*)b;
|
||||
|
||||
return int(A->Key) - int(B->Key);
|
||||
return int(A->Key.GetIndex()) - int(B->Key.GetIndex());
|
||||
}
|
||||
|
||||
void FUDMFKeys::Sort()
|
||||
|
@ -482,7 +482,7 @@ public:
|
|||
while (!sc.CheckToken('}'))
|
||||
{
|
||||
FName key = ParseKey();
|
||||
switch(key)
|
||||
switch(key.GetIndex())
|
||||
{
|
||||
case NAME_Id:
|
||||
th->thingid = CheckInt(key);
|
||||
|
@ -530,7 +530,7 @@ public:
|
|||
case NAME_Arg3:
|
||||
case NAME_Arg4:
|
||||
CHECK_N(Hx | Zd | Zdt | Va)
|
||||
th->args[int(key)-int(NAME_Arg0)] = CheckInt(key);
|
||||
th->args[key.GetIndex() - int(NAME_Arg0)] = CheckInt(key);
|
||||
break;
|
||||
|
||||
case NAME_Arg0Str:
|
||||
|
@ -560,8 +560,8 @@ public:
|
|||
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));
|
||||
if (CheckBool(key)) th->SkillFilter |= (1<<(key.GetIndex()-NAME_Skill1));
|
||||
else th->SkillFilter &= ~(1<<(key.GetIndex()-NAME_Skill1));
|
||||
break;
|
||||
|
||||
case NAME_Class1:
|
||||
|
@ -581,8 +581,8 @@ public:
|
|||
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));
|
||||
if (CheckBool(key)) th->ClassFilter |= (1<<(key.GetIndex()-NAME_Class1));
|
||||
else th->ClassFilter &= ~(1<<(key.GetIndex()-NAME_Class1));
|
||||
break;
|
||||
|
||||
case NAME_Ambush:
|
||||
|
@ -644,7 +644,7 @@ public:
|
|||
case NAME_Renderstyle:
|
||||
{
|
||||
FName style = CheckString(key);
|
||||
switch (style)
|
||||
switch (style.GetIndex())
|
||||
{
|
||||
case NAME_None:
|
||||
th->RenderStyle = STYLE_None;
|
||||
|
@ -760,11 +760,11 @@ public:
|
|||
}
|
||||
if (arg0str.IsNotEmpty() && (P_IsACSSpecial(th->special) || th->special == 0))
|
||||
{
|
||||
th->args[0] = -FName(arg0str);
|
||||
th->args[0] = -FName(arg0str).GetIndex();
|
||||
}
|
||||
if (arg1str.IsNotEmpty() && (P_IsThingSpecial(th->special) || th->special == 0))
|
||||
{
|
||||
th->args[1] = -FName(arg1str);
|
||||
th->args[1] = -FName(arg1str).GetIndex();
|
||||
}
|
||||
// Thing specials are only valid in namespaces with Hexen-type specials
|
||||
// and in ZDoomTranslated - which will use the translator on them.
|
||||
|
@ -821,7 +821,7 @@ public:
|
|||
FName key = ParseKey();
|
||||
|
||||
// This switch contains all keys of the UDMF base spec
|
||||
switch(key)
|
||||
switch(key.GetIndex())
|
||||
{
|
||||
case NAME_V1:
|
||||
ld->v1 = (vertex_t*)(intptr_t)CheckInt(key); // must be relocated later
|
||||
|
@ -859,7 +859,7 @@ public:
|
|||
case NAME_Arg2:
|
||||
case NAME_Arg3:
|
||||
case NAME_Arg4:
|
||||
ld->args[int(key)-int(NAME_Arg0)] = CheckInt(key);
|
||||
ld->args[key.GetIndex()-int(NAME_Arg0)] = CheckInt(key);
|
||||
continue;
|
||||
|
||||
case NAME_Arg0Str:
|
||||
|
@ -938,7 +938,7 @@ public:
|
|||
}
|
||||
|
||||
// This switch contains all keys of the UDMF base spec which only apply to Hexen format specials
|
||||
if (!isTranslated) switch (key)
|
||||
if (!isTranslated) switch (key.GetIndex())
|
||||
{
|
||||
case NAME_Playercross:
|
||||
Flag(ld->activation, SPAC_Cross, key);
|
||||
|
@ -985,7 +985,7 @@ public:
|
|||
}
|
||||
|
||||
// This switch contains all keys which are ZDoom specific
|
||||
if (namespace_bits & (Zd|Zdt|Va)) switch(key)
|
||||
if (namespace_bits & (Zd|Zdt|Va)) switch(key.GetIndex())
|
||||
{
|
||||
case NAME_Alpha:
|
||||
ld->setAlpha(CheckFloat(key));
|
||||
|
@ -1156,11 +1156,11 @@ public:
|
|||
}
|
||||
if (arg0str.IsNotEmpty() && (P_IsACSSpecial(ld->special) || ld->special == 0))
|
||||
{
|
||||
ld->args[0] = -FName(arg0str);
|
||||
ld->args[0] = -FName(arg0str).GetIndex();
|
||||
}
|
||||
if (arg1str.IsNotEmpty() && (P_IsThingSpecial(ld->special) || ld->special == 0))
|
||||
{
|
||||
ld->args[1] = -FName(arg1str);
|
||||
ld->args[1] = -FName(arg1str).GetIndex();
|
||||
}
|
||||
if ((ld->flags & ML_3DMIDTEX_IMPASS) && !(ld->flags & ML_3DMIDTEX)) // [TP]
|
||||
{
|
||||
|
@ -1190,7 +1190,7 @@ public:
|
|||
while (!sc.CheckToken('}'))
|
||||
{
|
||||
FName key = ParseKey();
|
||||
switch(key)
|
||||
switch(key.GetIndex())
|
||||
|
||||
{
|
||||
case NAME_Offsetx:
|
||||
|
@ -1221,7 +1221,7 @@ public:
|
|||
break;
|
||||
}
|
||||
|
||||
if (namespace_bits & (Zd|Zdt|Va)) switch(key)
|
||||
if (namespace_bits & (Zd|Zdt|Va)) switch(key.GetIndex())
|
||||
{
|
||||
case NAME_offsetx_top:
|
||||
sd->SetTextureXOffset(side_t::top, CheckFloat(key));
|
||||
|
@ -1496,7 +1496,7 @@ public:
|
|||
while (!sc.CheckToken('}'))
|
||||
{
|
||||
FName key = ParseKey();
|
||||
switch(key)
|
||||
switch(key.GetIndex())
|
||||
{
|
||||
case NAME_Heightfloor:
|
||||
sec->SetPlaneTexZ(sector_t::floor, CheckCoordinate(key));
|
||||
|
@ -1536,7 +1536,7 @@ public:
|
|||
break;
|
||||
}
|
||||
|
||||
if (namespace_bits & (Zd|Zdt|Va)) switch(key)
|
||||
if (namespace_bits & (Zd|Zdt|Va)) switch(key.GetIndex())
|
||||
{
|
||||
case NAME_Xpanningfloor:
|
||||
sec->SetXOffset(sector_t::floor, CheckFloat(key));
|
||||
|
@ -2028,7 +2028,7 @@ public:
|
|||
while (!sc.CheckToken('}'))
|
||||
{
|
||||
FName key = ParseKey();
|
||||
switch (key)
|
||||
switch (key.GetIndex())
|
||||
{
|
||||
case NAME_X:
|
||||
x = CheckCoordinate(key);
|
||||
|
@ -2168,7 +2168,7 @@ public:
|
|||
sc.MustGetStringName("=");
|
||||
sc.MustGetString();
|
||||
namespc = sc.String;
|
||||
switch(namespc)
|
||||
switch(namespc.GetIndex())
|
||||
{
|
||||
case NAME_ZDoom:
|
||||
namespace_bits = Zd;
|
||||
|
|
|
@ -15,15 +15,15 @@ protected:
|
|||
|
||||
void Skip();
|
||||
FName ParseKey(bool checkblock = false, bool *isblock = NULL);
|
||||
int CheckInt(const char *key);
|
||||
double CheckFloat(const char *key);
|
||||
double CheckCoordinate(const char *key);
|
||||
DAngle CheckAngle(const char *key);
|
||||
bool CheckBool(const char *key);
|
||||
const char *CheckString(const char *key);
|
||||
int CheckInt(FName key);
|
||||
double CheckFloat(FName key);
|
||||
double CheckCoordinate(FName key);
|
||||
DAngle CheckAngle(FName key);
|
||||
bool CheckBool(FName key);
|
||||
const char *CheckString(FName key);
|
||||
|
||||
template<typename T>
|
||||
bool Flag(T &value, int mask, const char *key)
|
||||
bool Flag(T &value, int mask, FName key)
|
||||
{
|
||||
if (CheckBool(key))
|
||||
{
|
||||
|
|
|
@ -57,7 +57,7 @@ class USDFParser : public UDMFParserBase
|
|||
//
|
||||
//===========================================================================
|
||||
|
||||
PClassActor *CheckActorType(const char *key)
|
||||
PClassActor *CheckActorType(FName key)
|
||||
{
|
||||
PClassActor *type = nullptr;
|
||||
if (namespace_bits == St)
|
||||
|
@ -77,7 +77,7 @@ class USDFParser : public UDMFParserBase
|
|||
return type;
|
||||
}
|
||||
|
||||
PClassActor *CheckInventoryActorType(const char *key)
|
||||
PClassActor *CheckInventoryActorType(FName key)
|
||||
{
|
||||
PClassActor* const type = CheckActorType(key);
|
||||
return nullptr != type && type->IsDescendantOf(NAME_Inventory) ? type : nullptr;
|
||||
|
@ -98,7 +98,7 @@ class USDFParser : public UDMFParserBase
|
|||
while (!sc.CheckToken('}'))
|
||||
{
|
||||
FName key = ParseKey();
|
||||
switch(key)
|
||||
switch(key.GetIndex())
|
||||
{
|
||||
case NAME_Item:
|
||||
check.Item = CheckInventoryActorType(key);
|
||||
|
@ -110,7 +110,7 @@ class USDFParser : public UDMFParserBase
|
|||
}
|
||||
}
|
||||
|
||||
switch (type)
|
||||
switch (type.GetIndex())
|
||||
{
|
||||
case NAME_Cost: response->ItemCheck.Push(check); break;
|
||||
case NAME_Require: response->ItemCheckRequire.Push(check); break;
|
||||
|
@ -147,7 +147,7 @@ class USDFParser : public UDMFParserBase
|
|||
FName key = ParseKey(true, &block);
|
||||
if (!block)
|
||||
{
|
||||
switch(key)
|
||||
switch(key.GetIndex())
|
||||
{
|
||||
case NAME_Text:
|
||||
ReplyString = CheckString(key);
|
||||
|
@ -216,7 +216,7 @@ class USDFParser : public UDMFParserBase
|
|||
case NAME_Arg2:
|
||||
case NAME_Arg3:
|
||||
case NAME_Arg4:
|
||||
reply->Args[int(key)-int(NAME_Arg0)] = CheckInt(key);
|
||||
reply->Args[key.GetIndex()-int(NAME_Arg0)] = CheckInt(key);
|
||||
break;
|
||||
|
||||
|
||||
|
@ -224,7 +224,7 @@ class USDFParser : public UDMFParserBase
|
|||
}
|
||||
else
|
||||
{
|
||||
switch(key)
|
||||
switch(key.GetIndex())
|
||||
{
|
||||
case NAME_Cost:
|
||||
case NAME_Require:
|
||||
|
@ -288,7 +288,7 @@ class USDFParser : public UDMFParserBase
|
|||
while (!sc.CheckToken('}'))
|
||||
{
|
||||
FName key = ParseKey();
|
||||
switch(key)
|
||||
switch(key.GetIndex())
|
||||
{
|
||||
case NAME_Item:
|
||||
check.Item = CheckInventoryActorType(key);
|
||||
|
@ -329,7 +329,7 @@ class USDFParser : public UDMFParserBase
|
|||
FName key = ParseKey(true, &block);
|
||||
if (!block)
|
||||
{
|
||||
switch(key)
|
||||
switch(key.GetIndex())
|
||||
{
|
||||
case NAME_Pagename:
|
||||
if (namespace_bits != Gz)
|
||||
|
@ -395,7 +395,7 @@ class USDFParser : public UDMFParserBase
|
|||
}
|
||||
else
|
||||
{
|
||||
switch(key)
|
||||
switch(key.GetIndex())
|
||||
{
|
||||
case NAME_Ifitem:
|
||||
if (!ParseIfItem(node)) return false;
|
||||
|
@ -437,7 +437,7 @@ class USDFParser : public UDMFParserBase
|
|||
FName key = ParseKey(true, &block);
|
||||
if (!block)
|
||||
{
|
||||
switch(key)
|
||||
switch(key.GetIndex())
|
||||
{
|
||||
case NAME_Actor:
|
||||
type = CheckActorType(key);
|
||||
|
@ -464,7 +464,7 @@ class USDFParser : public UDMFParserBase
|
|||
}
|
||||
else
|
||||
{
|
||||
switch(key)
|
||||
switch(key.GetIndex())
|
||||
{
|
||||
case NAME_Page:
|
||||
if (!ParsePage()) return false;
|
||||
|
@ -571,7 +571,7 @@ public:
|
|||
sc.MustGetToken('=');
|
||||
sc.MustGetToken(TK_StringConst);
|
||||
namespc = sc.String;
|
||||
switch(namespc)
|
||||
switch(namespc.GetIndex())
|
||||
{
|
||||
case NAME_GZDoom:
|
||||
namespace_bits = Gz;
|
||||
|
|
|
@ -146,7 +146,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(DMenuDescriptor, GetDescriptor, GetMenuDescriptor)
|
|||
{
|
||||
PARAM_PROLOGUE;
|
||||
PARAM_NAME(name);
|
||||
ACTION_RETURN_OBJECT(GetMenuDescriptor(name));
|
||||
ACTION_RETURN_OBJECT(GetMenuDescriptor(name.GetIndex()));
|
||||
}
|
||||
|
||||
size_t DListMenuDescriptor::PropagateMark()
|
||||
|
@ -418,7 +418,7 @@ EXTERN_CVAR(Int, cl_gfxlocalization)
|
|||
void M_SetMenu(FName menu, int param)
|
||||
{
|
||||
// some menus need some special treatment
|
||||
switch (menu)
|
||||
switch (menu.GetIndex())
|
||||
{
|
||||
case NAME_Mainmenu:
|
||||
if (gameinfo.gametype & GAME_DoomStrifeChex) // Raven's games always used text based menus
|
||||
|
|
|
@ -202,7 +202,7 @@ TArray<FName> &MakeStateNameList(const char * fname)
|
|||
// Handle the old names for the existing death states
|
||||
char *name = copystring(fname);
|
||||
firstpart = strtok(name, ".");
|
||||
switch (firstpart)
|
||||
switch (firstpart.GetIndex())
|
||||
{
|
||||
case NAME_Burn:
|
||||
firstpart = NAME_Death;
|
||||
|
@ -520,7 +520,7 @@ static int labelcmp(const void *a, const void *b)
|
|||
{
|
||||
FStateLabel *A = (FStateLabel *)a;
|
||||
FStateLabel *B = (FStateLabel *)b;
|
||||
return ((int)A->Label - (int)B->Label);
|
||||
return ((int)A->Label.GetIndex() - (int)B->Label.GetIndex());
|
||||
}
|
||||
|
||||
FStateLabels *FStateDefinitions::CreateStateLabelList(TArray<FStateDefine> & statelist)
|
||||
|
|
|
@ -912,7 +912,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(AActor, A_AttachLight, AttachLightDirect)
|
|||
PARAM_FLOAT(spoti);
|
||||
PARAM_FLOAT(spoto);
|
||||
PARAM_FLOAT(spotp);
|
||||
ACTION_RETURN_BOOL(AttachLightDirect(self, lightid, type, color, radius1, radius2, flags, ofs_x, ofs_y, ofs_z, parami, spoti, spoto, spotp));
|
||||
ACTION_RETURN_BOOL(AttachLightDirect(self, lightid.GetIndex(), type, color, radius1, radius2, flags, ofs_x, ofs_y, ofs_z, parami, spoti, spoto, spotp));
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
@ -939,7 +939,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(AActor, A_RemoveLight, RemoveLight)
|
|||
{
|
||||
PARAM_SELF_PROLOGUE(AActor);
|
||||
PARAM_NAME(lightid);
|
||||
ACTION_RETURN_BOOL(RemoveLight(self, lightid));
|
||||
ACTION_RETURN_BOOL(RemoveLight(self, lightid.GetIndex()));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -605,6 +605,11 @@ inline AActor *GetDefaultByName (const char *name)
|
|||
return (AActor *)(PClass::FindClass(name)->Defaults);
|
||||
}
|
||||
|
||||
inline AActor* GetDefaultByName(FName name)
|
||||
{
|
||||
return (AActor*)(PClass::FindClass(name)->Defaults);
|
||||
}
|
||||
|
||||
inline AActor *GetDefaultByType (const PClass *type)
|
||||
{
|
||||
return (AActor *)(type->Defaults);
|
||||
|
|
|
@ -387,8 +387,8 @@ void DBot::WhatToGet (AActor *item)
|
|||
else if (item->GetClass()->TypeName == NAME_Megasphere || item->IsKindOf(NAME_Health))
|
||||
{
|
||||
// do the test with the health item that's actually given.
|
||||
AActor* const testItem = NAME_Megasphere == item->GetClass()->TypeName
|
||||
? GetDefaultByName("MegasphereHealth")
|
||||
AActor* const testItem = item->GetClass()->TypeName == NAME_Megasphere
|
||||
? GetDefaultByName(NAME_MegasphereHealth)
|
||||
: item;
|
||||
if (nullptr != testItem)
|
||||
{
|
||||
|
|
|
@ -2421,7 +2421,7 @@ void FParser::SF_PlayerKeys(void)
|
|||
if(t_argc == 2)
|
||||
{
|
||||
t_return.type = svt_int;
|
||||
t_return.value.i = CheckInventory(Level->Players[playernum]->mo, keyname);
|
||||
t_return.value.i = CheckInventory(Level->Players[playernum]->mo, keyname.GetChars());
|
||||
return;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -102,7 +102,7 @@ const char *stringvalue(const svalue_t & v)
|
|||
|
||||
case svt_mobj:
|
||||
// return the class name
|
||||
return (const char *)v.value.mobj->GetClass()->TypeName;
|
||||
return (const char *)v.value.mobj->GetClass()->TypeName.GetChars();
|
||||
|
||||
case svt_fixed:
|
||||
{
|
||||
|
|
|
@ -2909,7 +2909,7 @@ void FBehavior::LoadScriptsDirectory ()
|
|||
{
|
||||
const char *str = (const char *)(scripts.b + 8 + scripts.dw[3 + (-Scripts[i].Number - 1)]);
|
||||
FName name(str);
|
||||
Scripts[i].Number = -name;
|
||||
Scripts[i].Number = -name.GetIndex();
|
||||
}
|
||||
}
|
||||
// We need to resort scripts, because the new numbers for named scripts likely
|
||||
|
@ -4393,13 +4393,13 @@ int DLevelScript::GetActorProperty (int tid, int property)
|
|||
case APROP_PainSound: return GlobalACSStrings.AddString(S_GetSoundName(actor->PainSound));
|
||||
case APROP_DeathSound: return GlobalACSStrings.AddString(S_GetSoundName(actor->DeathSound));
|
||||
case APROP_ActiveSound: return GlobalACSStrings.AddString(S_GetSoundName(actor->ActiveSound));
|
||||
case APROP_Species: return GlobalACSStrings.AddString(actor->GetSpecies());
|
||||
case APROP_Species: return GlobalACSStrings.AddString(actor->GetSpecies().GetChars());
|
||||
case APROP_NameTag: return GlobalACSStrings.AddString(actor->GetTag());
|
||||
case APROP_StencilColor:return actor->fillcolor;
|
||||
case APROP_Friction: return DoubleToACS(actor->Friction);
|
||||
case APROP_MaxStepHeight: return DoubleToACS(actor->MaxStepHeight);
|
||||
case APROP_MaxDropOffHeight: return DoubleToACS(actor->MaxDropOffHeight);
|
||||
case APROP_DamageType: return GlobalACSStrings.AddString(actor->DamageType);
|
||||
case APROP_DamageType: return GlobalACSStrings.AddString(actor->DamageType.GetChars());
|
||||
|
||||
default: return 0;
|
||||
}
|
||||
|
@ -4470,9 +4470,9 @@ int DLevelScript::CheckActorProperty (int tid, int property, int value)
|
|||
case APROP_PainSound: string = S_GetSoundName(actor->PainSound); break;
|
||||
case APROP_DeathSound: string = S_GetSoundName(actor->DeathSound); break;
|
||||
case APROP_ActiveSound: string = S_GetSoundName(actor->ActiveSound); break;
|
||||
case APROP_Species: string = actor->GetSpecies(); break;
|
||||
case APROP_Species: string = actor->GetSpecies().GetChars(); break;
|
||||
case APROP_NameTag: string = actor->GetTag(); break;
|
||||
case APROP_DamageType: string = actor->DamageType; break;
|
||||
case APROP_DamageType: string = actor->DamageType.GetChars(); break;
|
||||
}
|
||||
if (string == NULL) string = "";
|
||||
return (!stricmp(string, Level->Behaviors.LookupString(value)));
|
||||
|
@ -5262,7 +5262,7 @@ int DLevelScript::SwapActorTeleFog(AActor *activator, int tid)
|
|||
VMCall(func, ¶ms[0], params.Size(), &ret, 1);
|
||||
if (rettype == TypeName)
|
||||
{
|
||||
retval = GlobalACSStrings.AddString(FName(ENamedName(retval)));
|
||||
retval = GlobalACSStrings.AddString(FName(ENamedName(retval)).GetChars());
|
||||
}
|
||||
else if (rettype == TypeSound)
|
||||
{
|
||||
|
@ -5744,7 +5744,7 @@ int DLevelScript::CallFunction(int argCount, int funcIndex, int32_t *args)
|
|||
case ACSF_ACS_NamedExecuteWithResult:
|
||||
case ACSF_ACS_NamedExecuteAlways:
|
||||
{
|
||||
int scriptnum = -FName(Level->Behaviors.LookupString(args[0]));
|
||||
int scriptnum = -FName(Level->Behaviors.LookupString(args[0])).GetIndex();
|
||||
int arg1 = argCount > 1 ? args[1] : 0;
|
||||
int arg2 = argCount > 2 ? args[2] : 0;
|
||||
int arg3 = argCount > 3 ? args[3] : 0;
|
||||
|
@ -6609,7 +6609,7 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound)
|
|||
auto a = Level->SingleActorFromTID(args[0], activator);
|
||||
if (a != nullptr)
|
||||
{
|
||||
return GlobalACSStrings.AddString(Terrains[a->floorterrain].Name);
|
||||
return GlobalACSStrings.AddString(Terrains[a->floorterrain].Name.GetChars());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -6619,7 +6619,7 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound)
|
|||
}
|
||||
|
||||
case ACSF_StrArg:
|
||||
return -FName(Level->Behaviors.LookupString(args[0]));
|
||||
return -FName(Level->Behaviors.LookupString(args[0])).GetIndex();
|
||||
|
||||
case ACSF_Floor:
|
||||
return args[0] & ~0xffff;
|
||||
|
@ -8322,7 +8322,7 @@ scriptwait:
|
|||
}
|
||||
|
||||
case PCD_SCRIPTWAITNAMED:
|
||||
statedata = -FName(Level->Behaviors.LookupString(STACK(1)));
|
||||
statedata = -FName(Level->Behaviors.LookupString(STACK(1))).GetIndex();
|
||||
sp--;
|
||||
goto scriptwait;
|
||||
|
||||
|
@ -8969,7 +8969,7 @@ scriptwait:
|
|||
if (specnum >= -ACSF_ACS_NamedExecuteAlways && specnum <= -ACSF_ACS_NamedExecute)
|
||||
{
|
||||
specnum = NamedACSToNormalACS[-specnum - ACSF_ACS_NamedExecute];
|
||||
arg0 = -FName(Level->Behaviors.LookupString(arg0));
|
||||
arg0 = -FName(Level->Behaviors.LookupString(arg0)).GetIndex();
|
||||
}
|
||||
|
||||
auto itr = Level->GetLineIdIterator(STACK(7));
|
||||
|
@ -8998,7 +8998,7 @@ scriptwait:
|
|||
if (specnum >= -ACSF_ACS_NamedExecuteAlways && specnum <= -ACSF_ACS_NamedExecute)
|
||||
{
|
||||
specnum = NamedACSToNormalACS[-specnum - ACSF_ACS_NamedExecute];
|
||||
arg0 = -FName(Level->Behaviors.LookupString(arg0));
|
||||
arg0 = -FName(Level->Behaviors.LookupString(arg0)).GetIndex();
|
||||
}
|
||||
|
||||
if (STACK(7) != 0)
|
||||
|
|
|
@ -715,13 +715,13 @@ DEFINE_ACTION_FUNCTION(AActor, A_PlaySoundEx)
|
|||
|
||||
if (!looping)
|
||||
{
|
||||
S_Sound (self, int(channel) - NAME_Auto, 0, soundid, 1, attenuation);
|
||||
S_Sound (self, channel.GetIndex() - NAME_Auto, 0, soundid, 1, attenuation);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!S_IsActorPlayingSomething (self, int(channel) - NAME_Auto, soundid))
|
||||
if (!S_IsActorPlayingSomething (self, channel.GetIndex() - NAME_Auto, soundid))
|
||||
{
|
||||
S_Sound (self, (int(channel) - NAME_Auto), CHANF_LOOP, soundid, 1, attenuation);
|
||||
S_Sound (self, (channel.GetIndex() - NAME_Auto), CHANF_LOOP, soundid, 1, attenuation);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
@ -734,7 +734,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_StopSoundEx)
|
|||
|
||||
if (channel > NAME_Auto && channel <= NAME_SoundSlot7)
|
||||
{
|
||||
S_StopSound (self, int(channel) - NAME_Auto);
|
||||
S_StopSound (self, channel.GetIndex() - NAME_Auto);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -1302,7 +1302,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_Print)
|
|||
|
||||
if (fontname != NAME_None)
|
||||
{
|
||||
font = V_GetFont(fontname);
|
||||
font = V_GetFont(fontname.GetChars());
|
||||
}
|
||||
if (time > 0)
|
||||
{
|
||||
|
@ -1334,7 +1334,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_PrintBold)
|
|||
if (text[0] == '$') text = GStrings(&text[1]);
|
||||
if (fontname != NAME_None)
|
||||
{
|
||||
font = V_GetFont(fontname);
|
||||
font = V_GetFont(fontname.GetChars());
|
||||
}
|
||||
if (time > 0)
|
||||
{
|
||||
|
|
|
@ -3010,13 +3010,13 @@ DEFINE_ACTION_FUNCTION(AActor, A_Pain)
|
|||
{
|
||||
FString pain_sound = pain_amount;
|
||||
pain_sound += '-';
|
||||
pain_sound += self->player->LastDamageType;
|
||||
pain_sound += self->player->LastDamageType.GetChars();
|
||||
sfx_id = pain_sound;
|
||||
if (sfx_id == 0)
|
||||
{
|
||||
// Try again without a specific pain amount.
|
||||
pain_sound = "*pain-";
|
||||
pain_sound += self->player->LastDamageType;
|
||||
pain_sound += self->player->LastDamageType.GetChars();
|
||||
sfx_id = pain_sound;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -220,7 +220,7 @@ void ClientObituary (AActor *self, AActor *inflictor, AActor *attacker, int dmgf
|
|||
if (attacker == nullptr && obit.IsNotEmpty()) messagename = obit;
|
||||
else
|
||||
{
|
||||
switch (mod)
|
||||
switch (mod.GetIndex())
|
||||
{
|
||||
case NAME_Suicide: messagename = "$OB_SUICIDE"; break;
|
||||
case NAME_Falling: messagename = "$OB_FALLING"; break;
|
||||
|
|
|
@ -4012,7 +4012,7 @@ void AActor::Tick ()
|
|||
// Check for poison damage, but only once per PoisonPeriod tics (or once per second if none).
|
||||
if (PoisonDurationReceived && (Level->time % (PoisonPeriodReceived ? PoisonPeriodReceived : TICRATE) == 0))
|
||||
{
|
||||
P_DamageMobj(this, NULL, Poisoner, PoisonDamageReceived, PoisonDamageTypeReceived ? PoisonDamageTypeReceived : (FName)NAME_Poison, 0);
|
||||
P_DamageMobj(this, NULL, Poisoner, PoisonDamageReceived, PoisonDamageTypeReceived != NAME_None ? PoisonDamageTypeReceived : (FName)NAME_Poison, 0);
|
||||
|
||||
--PoisonDurationReceived;
|
||||
|
||||
|
@ -5536,7 +5536,7 @@ AActor *FLevelLocals::SpawnMapThing (FMapThing *mthing, int position)
|
|||
{
|
||||
if (mthing->arg0str != NAME_None)
|
||||
{
|
||||
PalEntry color = V_GetColor(nullptr, mthing->arg0str);
|
||||
PalEntry color = V_GetColor(nullptr, mthing->arg0str.GetChars());
|
||||
mobj->args[0] = color.r;
|
||||
mobj->args[1] = color.g;
|
||||
mobj->args[2] = color.b;
|
||||
|
@ -7262,7 +7262,7 @@ int AActor::GetModifiedDamage(FName damagetype, int damage, bool passive, AActor
|
|||
{
|
||||
IFVIRTUALPTRNAME(inv, NAME_Inventory, ModifyDamage)
|
||||
{
|
||||
VMValue params[8] = { (DObject*)inv, damage, int(damagetype), &damage, passive, inflictor, source, flags };
|
||||
VMValue params[8] = { (DObject*)inv, damage, damagetype.GetIndex(), &damage, passive, inflictor, source, flags };
|
||||
VMCall(func, params, 8, nullptr, 0);
|
||||
}
|
||||
inv = inv->Inventory;
|
||||
|
|
|
@ -227,7 +227,7 @@ void SetupPlayerClasses ()
|
|||
for (unsigned i = 0; i < gameinfo.PlayerClasses.Size(); i++)
|
||||
{
|
||||
PClassActor *cls = PClass::FindActor(gameinfo.PlayerClasses[i]);
|
||||
if (ValidatePlayerClass(cls, gameinfo.PlayerClasses[i]))
|
||||
if (ValidatePlayerClass(cls, gameinfo.PlayerClasses[i].GetChars()))
|
||||
{
|
||||
newclass.Flags = 0;
|
||||
newclass.Type = cls;
|
||||
|
@ -912,27 +912,27 @@ DEFINE_ACTION_FUNCTION(AActor, A_PlayerScream)
|
|||
|
||||
if (!sound && self->special1<10)
|
||||
{ // Wimpy death sound
|
||||
sound = S_FindSkinnedSoundEx (self, "*wimpydeath", self->player->LastDamageType);
|
||||
sound = S_FindSkinnedSoundEx (self, "*wimpydeath", self->player->LastDamageType.GetChars());
|
||||
}
|
||||
if (!sound && self->health <= -50)
|
||||
{
|
||||
if (self->health > -100)
|
||||
{ // Crazy death sound
|
||||
sound = S_FindSkinnedSoundEx (self, "*crazydeath", self->player->LastDamageType);
|
||||
sound = S_FindSkinnedSoundEx (self, "*crazydeath", self->player->LastDamageType.GetChars());
|
||||
}
|
||||
if (!sound)
|
||||
{ // Extreme death sound
|
||||
sound = S_FindSkinnedSoundEx (self, "*xdeath", self->player->LastDamageType);
|
||||
sound = S_FindSkinnedSoundEx (self, "*xdeath", self->player->LastDamageType.GetChars());
|
||||
if (!sound)
|
||||
{
|
||||
sound = S_FindSkinnedSoundEx (self, "*gibbed", self->player->LastDamageType);
|
||||
sound = S_FindSkinnedSoundEx (self, "*gibbed", self->player->LastDamageType.GetChars());
|
||||
chan = CHAN_BODY;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!sound)
|
||||
{ // Normal death sound
|
||||
sound = S_FindSkinnedSoundEx (self, "*death", self->player->LastDamageType);
|
||||
sound = S_FindSkinnedSoundEx (self, "*death", self->player->LastDamageType.GetChars());
|
||||
}
|
||||
|
||||
if (chan != CHAN_VOICE)
|
||||
|
|
|
@ -708,7 +708,7 @@ static TMap<FName, int> customTranslationMap;
|
|||
|
||||
int R_FindCustomTranslation(FName name)
|
||||
{
|
||||
switch (name)
|
||||
switch (name.GetIndex())
|
||||
{
|
||||
case NAME_Ice:
|
||||
// Ice is a special case which will remain in its original slot.
|
||||
|
@ -738,7 +738,7 @@ int R_FindCustomTranslation(FName name)
|
|||
return TRANSLATION(TRANSLATION_Players, name.GetIndex() - NAME_Player1);
|
||||
|
||||
}
|
||||
int *t = customTranslationMap.CheckKey(FName(name, true));
|
||||
int *t = customTranslationMap.CheckKey(name);
|
||||
return (t != nullptr)? *t : -1;
|
||||
}
|
||||
|
||||
|
|
|
@ -1014,7 +1014,7 @@ void R_InitSprites ()
|
|||
|
||||
Skins[i].Name = "Base";
|
||||
auto face = basetype->NameVar(NAME_Face);
|
||||
Skins[i].Face = face == NAME_None? FName("STF") : face;
|
||||
Skins[i].Face = face == NAME_None? "STF" : face.GetChars();
|
||||
Skins[i].range0start = basetype->IntVar(NAME_ColorRangeStart);
|
||||
Skins[i].range0end = basetype->IntVar(NAME_ColorRangeEnd);
|
||||
Skins[i].Scale = basetype->Scale;
|
||||
|
|
|
@ -6164,7 +6164,7 @@ FxExpression *FxIdentifier::Resolve(FCompileContext& ctx)
|
|||
}
|
||||
|
||||
// and line specials
|
||||
if (newex == nullptr && (num = P_FindLineSpecial(Identifier, nullptr, nullptr)))
|
||||
if (newex == nullptr && (num = P_FindLineSpecial(Identifier.GetChars(), nullptr, nullptr)))
|
||||
{
|
||||
ScriptPosition.Message(MSG_DEBUGLOG, "Resolving name '%s' as line special %d\n", Identifier.GetChars(), num);
|
||||
newex = new FxConstant(num, ScriptPosition);
|
||||
|
@ -6371,7 +6371,7 @@ FxExpression *FxMemberIdentifier::Resolve(FCompileContext& ctx)
|
|||
// Thanks to the messed up search logic of the type system, which doesn't allow any search by type name for the basic types at all,
|
||||
// we have to do this manually, though and check for all types that may have values attached explicitly.
|
||||
// (What's the point of attached fields to types if you cannot even search for the types...???)
|
||||
switch (id)
|
||||
switch (id.GetIndex())
|
||||
{
|
||||
default:
|
||||
type = nullptr;
|
||||
|
@ -7674,7 +7674,7 @@ FxFunctionCall::FxFunctionCall(FName methodname, FName rngname, FArgumentList &a
|
|||
ArgList = std::move(args);
|
||||
if (rngname != NAME_None)
|
||||
{
|
||||
switch (MethodName)
|
||||
switch (MethodName.GetIndex())
|
||||
{
|
||||
case NAME_Random:
|
||||
case NAME_FRandom:
|
||||
|
@ -7870,7 +7870,7 @@ FxExpression *FxFunctionCall::Resolve(FCompileContext& ctx)
|
|||
// Note that for all builtins the used arguments have to be nulled in the ArgList so that they won't get deleted before they get used.
|
||||
FxExpression *func = nullptr;
|
||||
|
||||
switch (MethodName)
|
||||
switch (MethodName.GetIndex())
|
||||
{
|
||||
case NAME_Color:
|
||||
if (ArgList.Size() == 3 || ArgList.Size() == 4)
|
||||
|
@ -8215,7 +8215,7 @@ FxExpression *FxMemberFunctionCall::Resolve(FCompileContext& ctx)
|
|||
// No need to create a dedicated node here, all builtins map directly to trivial operations.
|
||||
Self->ValueType = TypeSInt32; // all builtins treat the texture index as integer.
|
||||
FxExpression *x;
|
||||
switch (MethodName)
|
||||
switch (MethodName.GetIndex())
|
||||
{
|
||||
case NAME_IsValid:
|
||||
x = new FxCompareRel('>', Self, new FxConstant(0, ScriptPosition));
|
||||
|
@ -8741,7 +8741,7 @@ ExpEmit FxActionSpecialCall::Emit(VMFunctionBuilder *build)
|
|||
{
|
||||
assert(argex->ValueType == TypeName);
|
||||
assert(argex->isConstant());
|
||||
emitters.AddParameterIntConst(-static_cast<FxConstant *>(argex)->GetValue().GetName());
|
||||
emitters.AddParameterIntConst(-static_cast<FxConstant *>(argex)->GetValue().GetName().GetIndex());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -10195,7 +10195,7 @@ FxExpression *FxCaseStatement::Resolve(FCompileContext &ctx)
|
|||
}
|
||||
else
|
||||
{
|
||||
CaseValue = static_cast<FxConstant *>(Condition)->GetValue().GetName();
|
||||
CaseValue = static_cast<FxConstant *>(Condition)->GetValue().GetName().GetIndex();
|
||||
}
|
||||
}
|
||||
return this;
|
||||
|
@ -10999,7 +10999,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(DObject, BuiltinNameToClass, NativeNameToClass)
|
|||
PARAM_NAME(clsname);
|
||||
PARAM_CLASS(desttype, DObject);
|
||||
|
||||
ACTION_RETURN_POINTER(NativeNameToClass(clsname, desttype));
|
||||
ACTION_RETURN_POINTER(NativeNameToClass(clsname.GetIndex(), desttype));
|
||||
}
|
||||
|
||||
ExpEmit FxClassTypeCast::Emit(VMFunctionBuilder *build)
|
||||
|
|
|
@ -463,7 +463,7 @@ public:
|
|||
FxConstant(FName val, const FScriptPosition &pos) : FxExpression(EFX_Constant, pos)
|
||||
{
|
||||
ValueType = value.Type = TypeName;
|
||||
value.Int = val;
|
||||
value.Int = val.GetIndex();
|
||||
isresolved = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -872,7 +872,7 @@ void FFunctionBuildList::Build()
|
|||
// Emit code
|
||||
try
|
||||
{
|
||||
sfunc->SourceFileName = item.Code->ScriptPosition.FileName; // remember the file name for printing error messages if something goes wrong in the VM.
|
||||
sfunc->SourceFileName = item.Code->ScriptPosition.FileName.GetChars(); // remember the file name for printing error messages if something goes wrong in the VM.
|
||||
buildit.BeginStatement(item.Code);
|
||||
item.Code->Emit(&buildit);
|
||||
buildit.EndStatement();
|
||||
|
|
|
@ -113,7 +113,7 @@ void ParseOldDecoration(FScanner &sc, EDefinitionType def, PNamespace *ns)
|
|||
bag.fromDecorate = true;
|
||||
bag.Version = { 2, 0, 0 };
|
||||
#ifdef _DEBUG
|
||||
bag.ClassName = type->TypeName;
|
||||
bag.ClassName = type->TypeName.GetChars();
|
||||
#endif
|
||||
|
||||
sc.MustGetStringName("{");
|
||||
|
|
|
@ -486,7 +486,7 @@ static FxExpression *ParseExpression0 (FScanner &sc, PClassActor *cls)
|
|||
FName identifier = FName(sc.String);
|
||||
PFunction *func;
|
||||
|
||||
switch (identifier)
|
||||
switch (identifier.GetIndex())
|
||||
{
|
||||
case NAME_Random:
|
||||
case NAME_FRandom:
|
||||
|
@ -519,7 +519,7 @@ static FxExpression *ParseExpression0 (FScanner &sc, PClassActor *cls)
|
|||
}
|
||||
if (sc.CheckToken('('))
|
||||
{
|
||||
switch (identifier)
|
||||
switch (identifier.GetIndex())
|
||||
{
|
||||
case NAME_Min:
|
||||
case NAME_Max:
|
||||
|
|
|
@ -1124,7 +1124,7 @@ static PClassActor *ParseActorHeader(FScanner &sc, Baggage *bag)
|
|||
bag->Info = info;
|
||||
bag->Lumpnum = sc.LumpNum;
|
||||
#ifdef _DEBUG
|
||||
bag->ClassName = typeName;
|
||||
bag->ClassName = typeName.GetChars();
|
||||
#endif
|
||||
return info;
|
||||
}
|
||||
|
|
|
@ -703,7 +703,7 @@ void ParseFunctionParameters(FScanner &sc, PClassActor *cls, TArray<FxExpression
|
|||
|
||||
FName CheckCastKludges(FName in)
|
||||
{
|
||||
switch (in)
|
||||
switch (in.GetIndex())
|
||||
{
|
||||
case NAME_Int:
|
||||
return NAME___decorate_internal_int__;
|
||||
|
|
|
@ -906,7 +906,7 @@ DEFINE_PROPERTY(damagefactor, ZF, Actor)
|
|||
DEFINE_PROPERTY(decal, S, Actor)
|
||||
{
|
||||
PROP_STRING_PARM(str, 0);
|
||||
defaults->DecalGenerator = (FDecalBase *)intptr_t(int(FName(str)));
|
||||
defaults->DecalGenerator = (FDecalBase *)(intptr_t)FName(str).GetIndex();
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
|
@ -422,7 +422,7 @@ bool PContainerType::IsMatch(intptr_t id1, intptr_t id2) const
|
|||
void PContainerType::GetTypeIDs(intptr_t &id1, intptr_t &id2) const
|
||||
{
|
||||
id1 = (intptr_t)Outer;
|
||||
id2 = TypeName;
|
||||
id2 = TypeName.GetIndex();
|
||||
}
|
||||
|
||||
/* PInt *******************************************************************/
|
||||
|
@ -1612,11 +1612,11 @@ PEnum *NewEnum(FName name, PTypeBase *outer)
|
|||
{
|
||||
size_t bucket;
|
||||
if (outer == nullptr) outer = Namespaces.GlobalNamespace;
|
||||
PType *etype = TypeTable.FindType(NAME_Enum, (intptr_t)outer, (intptr_t)name, &bucket);
|
||||
PType *etype = TypeTable.FindType(NAME_Enum, (intptr_t)outer, name.GetIndex(), &bucket);
|
||||
if (etype == nullptr)
|
||||
{
|
||||
etype = new PEnum(name, outer);
|
||||
TypeTable.AddType(etype, NAME_Enum, (intptr_t)outer, (intptr_t)name, bucket);
|
||||
TypeTable.AddType(etype, NAME_Enum, (intptr_t)outer, name.GetIndex(), bucket);
|
||||
}
|
||||
return static_cast<PEnum *>(etype);
|
||||
}
|
||||
|
@ -2298,11 +2298,11 @@ PStruct *NewStruct(FName name, PTypeBase *outer, bool native)
|
|||
{
|
||||
size_t bucket;
|
||||
if (outer == nullptr) outer = Namespaces.GlobalNamespace;
|
||||
PType *stype = TypeTable.FindType(NAME_Struct, (intptr_t)outer, (intptr_t)name, &bucket);
|
||||
PType *stype = TypeTable.FindType(NAME_Struct, (intptr_t)outer, name.GetIndex(), &bucket);
|
||||
if (stype == nullptr)
|
||||
{
|
||||
stype = new PStruct(name, outer, native);
|
||||
TypeTable.AddType(stype, NAME_Struct, (intptr_t)outer, (intptr_t)name, bucket);
|
||||
TypeTable.AddType(stype, NAME_Struct, (intptr_t)outer, name.GetIndex(), bucket);
|
||||
}
|
||||
return static_cast<PStruct *>(stype);
|
||||
}
|
||||
|
@ -2425,11 +2425,11 @@ PField *PClassType::AddNativeField(FName name, PType *type, size_t address, uint
|
|||
PClassType *NewClassType(PClass *cls)
|
||||
{
|
||||
size_t bucket;
|
||||
PType *ptype = TypeTable.FindType(NAME_Object, 0, (intptr_t)cls->TypeName, &bucket);
|
||||
PType *ptype = TypeTable.FindType(NAME_Object, 0, cls->TypeName.GetIndex(), &bucket);
|
||||
if (ptype == nullptr)
|
||||
{
|
||||
ptype = new PClassType(cls);
|
||||
TypeTable.AddType(ptype, NAME_Object, 0, (intptr_t)cls->TypeName, bucket);
|
||||
TypeTable.AddType(ptype, NAME_Object, 0, cls->TypeName.GetIndex(), bucket);
|
||||
}
|
||||
return static_cast<PClassType *>(ptype);
|
||||
}
|
||||
|
@ -2507,7 +2507,7 @@ void FTypeTable::AddType(PType *type, FName type_name)
|
|||
|
||||
size_t FTypeTable::Hash(FName p1, intptr_t p2, intptr_t p3)
|
||||
{
|
||||
size_t i1 = (size_t)p1;
|
||||
size_t i1 = (size_t)p1.GetIndex();
|
||||
|
||||
// Swap the high and low halves of i1. The compiler should be smart enough
|
||||
// to transform this into a ROR or ROL.
|
||||
|
|
|
@ -46,7 +46,7 @@ static void CastV32S(FString *a, double b, double b1, double b2) { a->Format("(%
|
|||
static void CastP2S(FString *a, void *b) { if (b == nullptr) *a = "null"; else a->Format("%p", b); }
|
||||
static int CastS2I(FString *b) { return (int)b->ToLong(); }
|
||||
static double CastS2F(FString *b) { return b->ToDouble(); }
|
||||
static int CastS2N(FString *b) { return b->Len() == 0 ? FName(NAME_None) : FName(*b); }
|
||||
static int CastS2N(FString *b) { return b->Len() == 0 ? NAME_None : FName(*b).GetIndex(); }
|
||||
static void CastN2S(FString *a, int b) { FName name = FName(ENamedName(b)); *a = name.IsValidName() ? name.GetChars() : ""; }
|
||||
static int CastS2Co(FString *b) { return V_GetColor(nullptr, *b); }
|
||||
static void CastCo2S(FString *a, int b) { PalEntry c(b); a->Format("%02x %02x %02x", c.r, c.g, c.b); }
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
#include "cmdlib.h"
|
||||
#include "engineerrors.h"
|
||||
#include "memarena.h"
|
||||
#include "name.h"
|
||||
#include "scripting/backend/scopebarrier.h"
|
||||
|
||||
class DObject;
|
||||
|
|
|
@ -1809,7 +1809,7 @@ static void DoCast(const VMRegisters ®, const VMFrame *f, int a, int b, int c
|
|||
|
||||
case CAST_S2N:
|
||||
ASSERTD(a); ASSERTS(b);
|
||||
reg.d[a] = reg.s[b].Len() == 0? FName(NAME_None) : FName(reg.s[b]);
|
||||
reg.d[a] = reg.s[b].Len() == 0? NAME_None : FName(reg.s[b]).GetIndex();
|
||||
break;
|
||||
|
||||
case CAST_N2S:
|
||||
|
|
|
@ -893,13 +893,13 @@ DEFINE_ACTION_FUNCTION_NATIVE(AActor, isTeammate, isTeammate)
|
|||
|
||||
static int GetSpecies(AActor *self)
|
||||
{
|
||||
return self->GetSpecies();
|
||||
return self->GetSpecies().GetIndex();
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(AActor, GetSpecies, GetSpecies)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(AActor);
|
||||
ACTION_RETURN_INT(self->GetSpecies());
|
||||
ACTION_RETURN_INT(GetSpecies(self));
|
||||
}
|
||||
|
||||
static int isFriend(AActor *self, AActor *other)
|
||||
|
|
|
@ -779,7 +779,7 @@ void ZCCCompiler::CreateClassTypes()
|
|||
do
|
||||
{
|
||||
if (build.IsNotEmpty()) build += '.';
|
||||
build += FName(p->Id);
|
||||
build += FName(p->Id).GetChars();
|
||||
p = static_cast<decltype(p)>(p->SiblingNext);
|
||||
} while (p != ParentName);
|
||||
Error(c->cls, "Qualified name '%s' for base class not supported in '%s'", build.GetChars(), FName(c->NodeName()).GetChars());
|
||||
|
@ -2391,13 +2391,13 @@ void ZCCCompiler::ProcessDefaultProperty(PClassActor *cls, ZCC_PropertyStmt *pro
|
|||
}
|
||||
|
||||
// a one-name property
|
||||
propname = FName(namenode->Id);
|
||||
propname = FName(namenode->Id).GetChars();
|
||||
|
||||
}
|
||||
else if (namenode->SiblingNext->SiblingNext == namenode)
|
||||
{
|
||||
// a two-name property
|
||||
propname << FName(namenode->Id) << "." << FName(static_cast<ZCC_Identifier *>(namenode->SiblingNext)->Id);
|
||||
propname << FName(namenode->Id).GetChars() << "." << FName(static_cast<ZCC_Identifier *>(namenode->SiblingNext)->Id).GetChars();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2541,7 +2541,7 @@ void ZCCCompiler::InitDefaults()
|
|||
|
||||
Baggage bag;
|
||||
#ifdef _DEBUG
|
||||
bag.ClassName = cls->TypeName;
|
||||
bag.ClassName = cls->TypeName.GetChars();
|
||||
#endif
|
||||
bag.Version = mVersion;
|
||||
bag.Namespace = OutNamespace;
|
||||
|
@ -3283,7 +3283,7 @@ void ZCCCompiler::CompileStates()
|
|||
case AST_StateLabel:
|
||||
{
|
||||
auto sl = static_cast<ZCC_StateLabel *>(st);
|
||||
statename = FName(sl->Label);
|
||||
statename = FName(sl->Label).GetChars();
|
||||
statedef.AddStateLabel(statename);
|
||||
break;
|
||||
}
|
||||
|
@ -3372,12 +3372,12 @@ void ZCCCompiler::CompileStates()
|
|||
statename = "";
|
||||
if (sg->Qualifier != nullptr)
|
||||
{
|
||||
statename << FName(sg->Qualifier->Id) << "::";
|
||||
statename << FName(sg->Qualifier->Id).GetChars() << "::";
|
||||
}
|
||||
auto part = sg->Label;
|
||||
do
|
||||
{
|
||||
statename << FName(part->Id) << '.';
|
||||
statename << FName(part->Id).GetChars() << '.';
|
||||
part = static_cast<decltype(part)>(part->SiblingNext);
|
||||
} while (part != sg->Label);
|
||||
statename.Truncate(statename.Len() - 1); // remove the last '.' in the label name
|
||||
|
|
|
@ -297,12 +297,12 @@ static void ParseSingleFile(FScanner *pSC, const char *filename, int lump, void
|
|||
|
||||
case TK_None: // 'NONE' is a token for SBARINFO but not here.
|
||||
case TK_Identifier:
|
||||
value.Int = FName(sc.String);
|
||||
value.Int = FName(sc.String).GetIndex();
|
||||
tokentype = ZCC_IDENTIFIER;
|
||||
break;
|
||||
|
||||
case TK_NonWhitespace:
|
||||
value.Int = FName(sc.String);
|
||||
value.Int = FName(sc.String).GetIndex();
|
||||
tokentype = ZCC_NWS;
|
||||
break;
|
||||
|
||||
|
|
|
@ -658,7 +658,7 @@ FSerializer &FSerializer::Args(const char *key, int *args, int *defargs, int spe
|
|||
}
|
||||
else if (i == 0 && aval.IsString())
|
||||
{
|
||||
args[i] = -FName(UnicodeToString(aval.GetString()));
|
||||
args[i] = -FName(UnicodeToString(aval.GetString())).GetIndex();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -710,7 +710,7 @@ FSerializer &FSerializer::ScriptNum(const char *key, int &num)
|
|||
}
|
||||
else if (val->IsString())
|
||||
{
|
||||
num = -FName(UnicodeToString(val->GetString()));
|
||||
num = -FName(UnicodeToString(val->GetString())).GetIndex();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2159,7 +2159,7 @@ template<> FSerializer &Serialize(FSerializer &arc, const char *key, FFont *&fon
|
|||
{
|
||||
FName n = NAME_None;
|
||||
arc(key, n);
|
||||
font = n == NAME_None? nullptr : V_GetFont(n);
|
||||
font = n == NAME_None? nullptr : V_GetFont(n.GetChars());
|
||||
return arc;
|
||||
}
|
||||
|
||||
|
|
|
@ -1605,11 +1605,11 @@ static void S_RestorePlayerSounds()
|
|||
FSavedPlayerSoundInfo * spi = &SavedPlayerSounds[i];
|
||||
if (spi->alias)
|
||||
{
|
||||
S_AddPlayerSoundExisting(spi->pclass, spi->gender, spi->refid, spi->lumpnum);
|
||||
S_AddPlayerSoundExisting(spi->pclass.GetChars(), spi->gender, spi->refid, spi->lumpnum);
|
||||
}
|
||||
else
|
||||
{
|
||||
S_AddPlayerSound(spi->pclass, spi->gender, spi->refid, spi->lumpnum);
|
||||
S_AddPlayerSound(spi->pclass.GetChars(), spi->gender, spi->refid, spi->lumpnum);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -429,7 +429,7 @@ void DSeqNode::AddChoice (int seqnum, seqtype_t type)
|
|||
DEFINE_ACTION_FUNCTION(DSeqNode, AddChoice)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(DSeqNode);
|
||||
PARAM_NAME(seq);
|
||||
PARAM_INT(seq);
|
||||
PARAM_INT(mode);
|
||||
self->AddChoice(seq, seqtype_t(mode));
|
||||
return 0;
|
||||
|
@ -510,7 +510,7 @@ static void AssignHexenTranslations (void)
|
|||
{
|
||||
for (seq = 0; seq < Sequences.Size(); seq++)
|
||||
{
|
||||
if (Sequences[seq] != NULL && HexenSequences[i].Name == Sequences[seq]->SeqName)
|
||||
if (Sequences[seq] != NULL && Sequences[seq]->SeqName == HexenSequences[i].Name)
|
||||
break;
|
||||
}
|
||||
if (seq == Sequences.Size())
|
||||
|
@ -642,7 +642,7 @@ void S_ParseSndSeq (int levellump)
|
|||
{
|
||||
ScriptTemp.Push (sc.Number);
|
||||
sc.MustGetString();
|
||||
ScriptTemp.Push (FName(sc.String));
|
||||
ScriptTemp.Push (FName(sc.String).GetIndex());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#define NAME_H
|
||||
|
||||
#include "tarray.h"
|
||||
#include "zstring.h"
|
||||
|
||||
enum ENamedName
|
||||
{
|
||||
|
@ -52,19 +53,17 @@ public:
|
|||
FName (const char *text) { Index = NameData.FindName (text, false); }
|
||||
FName (const char *text, bool noCreate) { Index = NameData.FindName (text, noCreate); }
|
||||
FName (const char *text, size_t textlen, bool noCreate) { Index = NameData.FindName (text, textlen, noCreate); }
|
||||
FName (const FString &text);
|
||||
FName (const FString &text, bool noCreate);
|
||||
FName(const FString& text) { Index = NameData.FindName(text.GetChars(), text.Len(), false); }
|
||||
FName(const FString& text, bool noCreate) { Index = NameData.FindName(text.GetChars(), text.Len(), noCreate); }
|
||||
FName (const FName &other) = default;
|
||||
FName (ENamedName index) { Index = index; }
|
||||
// ~FName () {} // Names can be added but never removed.
|
||||
|
||||
int GetIndex() const { return Index; }
|
||||
operator int() const { return Index; }
|
||||
const char *GetChars() const { return NameData.NameArray[Index].Text; }
|
||||
operator const char *() const { return NameData.NameArray[Index].Text; }
|
||||
|
||||
FName &operator = (const char *text) { Index = NameData.FindName (text, false); return *this; }
|
||||
FName &operator = (const FString &text);
|
||||
FName& operator = (const FString& text) { Index = NameData.FindName(text.GetChars(), text.Len(), false); return *this; }
|
||||
FName &operator = (const FName &other) = default;
|
||||
FName &operator = (ENamedName index) { Index = index; return *this; }
|
||||
|
||||
|
|
|
@ -122,6 +122,7 @@ xx(Sorcerer2)
|
|||
|
||||
// Bots check this
|
||||
xx(Megasphere)
|
||||
xx(MegasphereHealth)
|
||||
|
||||
// Standard player classes
|
||||
xx(DoomPlayer)
|
||||
|
|
|
@ -39,7 +39,6 @@
|
|||
#include <stddef.h>
|
||||
#include <string>
|
||||
#include "tarray.h"
|
||||
#include "name.h"
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define PRINTFISH(x) __attribute__((format(printf, 2, x)))
|
||||
|
@ -195,14 +194,12 @@ public:
|
|||
FString &operator += (const FString &tail);
|
||||
FString &operator += (const char *tail);
|
||||
FString &operator += (char tail);
|
||||
FString &operator += (const FName &name) { return *this += name.GetChars(); }
|
||||
FString &AppendCStrPart (const char *tail, size_t tailLen);
|
||||
FString &CopyCStrPart(const char *tail, size_t tailLen);
|
||||
|
||||
FString &operator << (const FString &tail) { return *this += tail; }
|
||||
FString &operator << (const char *tail) { return *this += tail; }
|
||||
FString &operator << (char tail) { return *this += tail; }
|
||||
FString &operator << (const FName &name) { return *this += name.GetChars(); }
|
||||
|
||||
const char &Front() const { assert(IsNotEmpty()); return Chars[0]; }
|
||||
const char &Back() const { assert(IsNotEmpty()); return Chars[Len() - 1]; }
|
||||
|
@ -412,13 +409,6 @@ public:
|
|||
bool operator <= (const char *) const = delete;
|
||||
bool operator >= (const char *) const = delete;
|
||||
|
||||
bool operator == (FName) const = delete;
|
||||
bool operator != (FName) const = delete;
|
||||
bool operator < (FName) const = delete;
|
||||
bool operator > (FName) const = delete;
|
||||
bool operator <= (FName) const = delete;
|
||||
bool operator >= (FName) const = delete;
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
|
@ -430,13 +420,6 @@ bool operator > (const char *, const FString &) = delete;
|
|||
bool operator <= (const char *, const FString &) = delete;
|
||||
bool operator >= (const char *, const FString &) = delete;
|
||||
|
||||
bool operator == (FName, const FString &) = delete;
|
||||
bool operator != (FName, const FString &) = delete;
|
||||
bool operator < (FName, const FString &) = delete;
|
||||
bool operator > (FName, const FString &) = delete;
|
||||
bool operator <= (FName, const FString &) = delete;
|
||||
bool operator >= (FName, const FString &) = delete;
|
||||
|
||||
class FStringf : public FString
|
||||
{
|
||||
public:
|
||||
|
@ -477,12 +460,6 @@ namespace StringFormat
|
|||
|
||||
#undef PRINTFISH
|
||||
|
||||
// FName inline implementations that take FString parameters
|
||||
|
||||
inline FName::FName(const FString &text) { Index = NameData.FindName (text.GetChars(), text.Len(), false); }
|
||||
inline FName::FName(const FString &text, bool noCreate) { Index = NameData.FindName (text.GetChars(), text.Len(), noCreate); }
|
||||
inline FName &FName::operator = (const FString &text) { Index = NameData.FindName (text.GetChars(), text.Len(), false); return *this; }
|
||||
|
||||
// Hash FStrings on their contents. (used by TMap)
|
||||
#include "superfasthash.h"
|
||||
|
||||
|
|
Loading…
Reference in a new issue