mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-28 23:12:24 +00:00
Merge branch 'master' of https://github.com/rheit/zdoom
This commit is contained in:
commit
5a1ad75402
2 changed files with 73 additions and 62 deletions
|
@ -3383,43 +3383,16 @@ class CommandInInventory : public SBarInfoCommandFlowControl
|
|||
AInventory *invItem[2] = { statusBar->CPlayer->mo->FindInventory(item[0]), statusBar->CPlayer->mo->FindInventory(item[1]) };
|
||||
if (invItem[0] != NULL && amount[0] > 0 && invItem[0]->Amount < amount[0]) invItem[0] = NULL;
|
||||
if (invItem[1] != NULL && amount[1] > 0 && invItem[1]->Amount < amount[1]) invItem[1] = NULL;
|
||||
if(invItem[1] != NULL && conditionAnd)
|
||||
|
||||
if (item[1])
|
||||
{
|
||||
if((invItem[0] != NULL && invItem[1] != NULL) && !negate)
|
||||
{
|
||||
SetTruth(true, block, statusBar);
|
||||
return;
|
||||
if (conditionAnd)
|
||||
SetTruth((invItem[0] && invItem[1]) != negate, block, statusBar);
|
||||
else
|
||||
SetTruth((invItem[0] || invItem[1]) != negate, block, statusBar);
|
||||
}
|
||||
else if((invItem[0] == NULL || invItem[1] == NULL) && negate)
|
||||
{
|
||||
SetTruth(true, block, statusBar);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if(invItem[1] != NULL && !conditionAnd)
|
||||
{
|
||||
if((invItem[0] != NULL || invItem[1] != NULL) && !negate)
|
||||
{
|
||||
SetTruth(true, block, statusBar);
|
||||
return;
|
||||
}
|
||||
else if((invItem[0] == NULL && invItem[1] == NULL) && negate)
|
||||
{
|
||||
SetTruth(true, block, statusBar);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if((invItem[0] != NULL) && !negate)
|
||||
{
|
||||
SetTruth(true, block, statusBar);
|
||||
return;
|
||||
}
|
||||
else if((invItem[0] == NULL) && negate)
|
||||
{
|
||||
SetTruth(true, block, statusBar);
|
||||
return;
|
||||
}
|
||||
SetTruth(false, block, statusBar);
|
||||
else
|
||||
SetTruth((invItem[0] != NULL) != negate, block, statusBar);
|
||||
}
|
||||
protected:
|
||||
bool conditionAnd;
|
||||
|
@ -3458,6 +3431,46 @@ class CommandAlpha : public SBarInfoMainBlock
|
|||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class CommandIfHealth : public SBarInfoCommandFlowControl
|
||||
{
|
||||
public:
|
||||
CommandIfHealth(SBarInfo *script) : SBarInfoCommandFlowControl(script),
|
||||
negate(false), percentage(false)
|
||||
{
|
||||
}
|
||||
|
||||
void Parse(FScanner &sc, bool fullScreenOffsets)
|
||||
{
|
||||
if (sc.CheckToken(TK_Identifier))
|
||||
{
|
||||
if (sc.Compare("not"))
|
||||
negate = true;
|
||||
else
|
||||
sc.ScriptError("Expected 'not', but got '%s' instead.", sc.String);
|
||||
}
|
||||
|
||||
sc.MustGetToken(TK_IntConst);
|
||||
percentage = sc.CheckToken('%');
|
||||
hpamount = sc.Number;
|
||||
|
||||
SBarInfoCommandFlowControl::Parse(sc, fullScreenOffsets);
|
||||
}
|
||||
void Tick(const SBarInfoMainBlock *block, const DSBarInfo *statusBar, bool hudChanged)
|
||||
{
|
||||
SBarInfoCommandFlowControl::Tick(block, statusBar, hudChanged);
|
||||
|
||||
int phealth = percentage ? statusBar->CPlayer->mo->health * 100 / statusBar->CPlayer->mo->GetMaxHealth() : statusBar->CPlayer->mo->health;
|
||||
|
||||
SetTruth((phealth >= hpamount) ^ negate, block, statusBar);
|
||||
}
|
||||
protected:
|
||||
bool negate;
|
||||
bool percentage;
|
||||
int hpamount;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static const char *SBarInfoCommandNames[] =
|
||||
{
|
||||
"drawimage", "drawnumber", "drawswitchableimage",
|
||||
|
@ -3467,7 +3480,7 @@ static const char *SBarInfoCommandNames[] =
|
|||
"gamemode", "playerclass", "playertype", "aspectratio",
|
||||
"isselected", "usesammo", "usessecondaryammo",
|
||||
"hasweaponpiece", "inventorybarnotvisible",
|
||||
"weaponammo", "ininventory", "alpha",
|
||||
"weaponammo", "ininventory", "alpha", "ifhealth",
|
||||
NULL
|
||||
};
|
||||
|
||||
|
@ -3480,7 +3493,7 @@ enum SBarInfoCommands
|
|||
SBARINFO_GAMEMODE, SBARINFO_PLAYERCLASS, SBARINFO_PLAYERTYPE, SBARINFO_ASPECTRATIO,
|
||||
SBARINFO_ISSELECTED, SBARINFO_USESAMMO, SBARINFO_USESSECONDARYAMMO,
|
||||
SBARINFO_HASWEAPONPIECE, SBARINFO_INVENTORYBARNOTVISIBLE,
|
||||
SBARINFO_WEAPONAMMO, SBARINFO_ININVENTORY, SBARINFO_ALPHA,
|
||||
SBARINFO_WEAPONAMMO, SBARINFO_ININVENTORY, SBARINFO_ALPHA, SBARINFO_IFHEALTH,
|
||||
};
|
||||
|
||||
SBarInfoCommand *SBarInfoCommandFlowControl::NextCommand(FScanner &sc)
|
||||
|
@ -3513,6 +3526,7 @@ SBarInfoCommand *SBarInfoCommandFlowControl::NextCommand(FScanner &sc)
|
|||
case SBARINFO_WEAPONAMMO: return new CommandWeaponAmmo(script);
|
||||
case SBARINFO_ININVENTORY: return new CommandInInventory(script);
|
||||
case SBARINFO_ALPHA: return new CommandAlpha(script);
|
||||
case SBARINFO_IFHEALTH: return new CommandIfHealth(script);
|
||||
}
|
||||
|
||||
sc.ScriptError("Unknown command '%s'.\n", sc.String);
|
||||
|
|
|
@ -537,34 +537,31 @@ void MapData::GetChecksum(BYTE cksum[16])
|
|||
{
|
||||
MD5Context md5;
|
||||
|
||||
if (file != NULL)
|
||||
{
|
||||
if (isText)
|
||||
{
|
||||
Seek(ML_TEXTMAP);
|
||||
md5.Update(file, Size(ML_TEXTMAP));
|
||||
if (file != NULL) md5.Update(file, Size(ML_TEXTMAP));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Size(ML_LABEL) != 0)
|
||||
{
|
||||
Seek(ML_LABEL);
|
||||
md5.Update(file, Size(ML_LABEL));
|
||||
if (file != NULL) md5.Update(file, Size(ML_LABEL));
|
||||
}
|
||||
Seek(ML_THINGS);
|
||||
md5.Update(file, Size(ML_THINGS));
|
||||
if (file != NULL) md5.Update(file, Size(ML_THINGS));
|
||||
Seek(ML_LINEDEFS);
|
||||
md5.Update(file, Size(ML_LINEDEFS));
|
||||
if (file != NULL) md5.Update(file, Size(ML_LINEDEFS));
|
||||
Seek(ML_SIDEDEFS);
|
||||
md5.Update(file, Size(ML_SIDEDEFS));
|
||||
if (file != NULL) md5.Update(file, Size(ML_SIDEDEFS));
|
||||
Seek(ML_SECTORS);
|
||||
md5.Update(file, Size(ML_SECTORS));
|
||||
if (file != NULL) md5.Update(file, Size(ML_SECTORS));
|
||||
}
|
||||
if (HasBehavior)
|
||||
{
|
||||
Seek(ML_BEHAVIOR);
|
||||
md5.Update(file, Size(ML_BEHAVIOR));
|
||||
}
|
||||
if (file != NULL) md5.Update(file, Size(ML_BEHAVIOR));
|
||||
}
|
||||
md5.Final(cksum);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue