本文整理汇总了C++中FTextureID::Exists方法的典型用法代码示例。如果您正苦于以下问题:C++ FTextureID::Exists方法的具体用法?C++ FTextureID::Exists怎么用?C++ FTextureID::Exists使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FTextureID
的用法示例。
在下文中一共展示了FTextureID::Exists方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
FSwitchDef *FTextureManager::ParseSwitchDef (FScanner &sc, bool ignoreBad)
{
const BITFIELD texflags = TEXMAN_Overridable | TEXMAN_TryAny;
FSwitchDef *def;
TArray<FSwitchDef::frame> frames;
FSwitchDef::frame thisframe;
FTextureID picnum;
bool bad;
FSoundID sound;
bad = false;
while (sc.GetString ())
{
if (sc.Compare ("sound"))
{
if (sound != 0)
{
sc.ScriptError ("Switch state already has a sound");
}
sc.MustGetString ();
sound = sc.String;
}
else if (sc.Compare ("pic"))
{
sc.MustGetString ();
picnum = CheckForTexture (sc.String, FTexture::TEX_Wall, texflags);
if (!picnum.Exists() && !ignoreBad)
{
//Printf ("Unknown switch texture %s\n", sc.String);
bad = true;
}
thisframe.Texture = picnum;
sc.MustGetString ();
if (sc.Compare ("tics"))
{
sc.MustGetNumber ();
thisframe.TimeMin = sc.Number & 65535;
thisframe.TimeRnd = 0;
}
else if (sc.Compare ("rand"))
{
int min, max;
sc.MustGetNumber ();
min = sc.Number & 65535;
sc.MustGetNumber ();
max = sc.Number & 65535;
if (min > max)
{
swapvalues (min, max);
}
thisframe.TimeMin = min;
thisframe.TimeRnd = (max - min + 1);
}
else
{
thisframe.TimeMin = 0; // Shush, GCC.
thisframe.TimeRnd = 0;
sc.ScriptError ("Must specify a duration for switch frame");
}
frames.Push(thisframe);
}
else
{
sc.UnGet ();
break;
}
}
if (frames.Size() == 0)
{
sc.ScriptError ("Switch state needs at least one frame");
}
if (bad)
{
return NULL;
}
def = (FSwitchDef *)M_Malloc (myoffsetof (FSwitchDef, frames[0]) + frames.Size()*sizeof(frames[0]));
def->Sound = sound;
def->NumFrames = frames.Size();
memcpy (&def->frames[0], &frames[0], frames.Size() * sizeof(frames[0]));
def->PairDef = NULL;
return def;
}
示例2: ProcessSwitchDef
void FTextureManager::ProcessSwitchDef (FScanner &sc)
{
const BITFIELD texflags = TEXMAN_Overridable | TEXMAN_TryAny;
FString picname;
FSwitchDef *def1, *def2;
FTextureID picnum;
int gametype;
bool quest = false;
def1 = def2 = NULL;
sc.MustGetString ();
if (sc.Compare ("doom"))
{
gametype = GAME_DoomChex;
sc.CheckNumber(); // skip the gamemission filter
}
else if (sc.Compare ("heretic"))
{
gametype = GAME_Heretic;
}
else if (sc.Compare ("hexen"))
{
gametype = GAME_Hexen;
}
else if (sc.Compare ("strife"))
{
gametype = GAME_Strife;
}
else if (sc.Compare ("any"))
{
gametype = GAME_Any;
}
else
{
// There is no game specified; just treat as any
//max = 240;
gametype = GAME_Any;
sc.UnGet ();
}
sc.MustGetString ();
picnum = CheckForTexture (sc.String, FTexture::TEX_Wall, texflags);
picname = sc.String;
while (sc.GetString ())
{
if (sc.Compare ("quest"))
{
quest = true;
}
else if (sc.Compare ("on"))
{
if (def1 != NULL)
{
sc.ScriptError ("Switch already has an on state");
}
def1 = ParseSwitchDef (sc, !picnum.Exists());
}
else if (sc.Compare ("off"))
{
if (def2 != NULL)
{
sc.ScriptError ("Switch already has an off state");
}
def2 = ParseSwitchDef (sc, !picnum.Exists());
}
else
{
sc.UnGet ();
break;
}
}
if (def1 == NULL || !picnum.Exists() ||
(gametype != GAME_Any && !(gametype & gameinfo.gametype)))
{
if (def2 != NULL)
{
M_Free (def2);
}
if (def1 != NULL)
{
M_Free (def1);
}
return;
}
// If the switch did not have an off state, create one that just returns
// it to the original texture without doing anything interesting
if (def2 == NULL)
{
def2 = (FSwitchDef *)M_Malloc (sizeof(FSwitchDef));
def2->Sound = def1->Sound;
def2->NumFrames = 1;
def2->frames[0].TimeMin = 0;
def2->frames[0].TimeRnd = 0;
def2->frames[0].Texture = picnum;
}
def1->PreTexture = picnum;
def2->PreTexture = def1->frames[def1->NumFrames-1].Texture;
//.........这里部分代码省略.........