mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-11 15:21:51 +00:00
Merge branch 'master' of https://github.com/rheit/zdoom into z_osx_clean
This commit is contained in:
commit
1dab120e15
4 changed files with 92 additions and 51 deletions
|
@ -81,6 +81,7 @@ enum
|
||||||
CP_SECTORFLOOROFFSET,
|
CP_SECTORFLOOROFFSET,
|
||||||
CP_SETWALLYSCALE,
|
CP_SETWALLYSCALE,
|
||||||
CP_SETTHINGZ,
|
CP_SETTHINGZ,
|
||||||
|
CP_SETTAG,
|
||||||
};
|
};
|
||||||
|
|
||||||
// EXTERNAL FUNCTION PROTOTYPES --------------------------------------------
|
// EXTERNAL FUNCTION PROTOTYPES --------------------------------------------
|
||||||
|
@ -307,6 +308,15 @@ void ParseCompatibility()
|
||||||
sc.MustGetFloat();
|
sc.MustGetFloat();
|
||||||
CompatParams.Push(FLOAT2FIXED(sc.Float));
|
CompatParams.Push(FLOAT2FIXED(sc.Float));
|
||||||
}
|
}
|
||||||
|
else if (sc.Compare("setsectortag"))
|
||||||
|
{
|
||||||
|
if (flags.ExtCommandIndex == ~0u) flags.ExtCommandIndex = CompatParams.Size();
|
||||||
|
CompatParams.Push(CP_SETTAG);
|
||||||
|
sc.MustGetNumber();
|
||||||
|
CompatParams.Push(sc.Number);
|
||||||
|
sc.MustGetNumber();
|
||||||
|
CompatParams.Push(sc.Number);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sc.UnGet();
|
sc.UnGet();
|
||||||
|
@ -520,6 +530,15 @@ void SetCompatibilityParams()
|
||||||
i += 3;
|
i += 3;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case CP_SETTAG:
|
||||||
|
{
|
||||||
|
if ((unsigned)CompatParams[i + 1] < (unsigned)numsectors)
|
||||||
|
{
|
||||||
|
sectors[CompatParams[i + 1]].tag = CompatParams[i + 2];
|
||||||
|
}
|
||||||
|
i += 3;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,6 +107,8 @@ enum SAW_Flags
|
||||||
SF_RANDOMLIGHTHIT = 4,
|
SF_RANDOMLIGHTHIT = 4,
|
||||||
SF_NOUSEAMMOMISS = 8,
|
SF_NOUSEAMMOMISS = 8,
|
||||||
SF_NOUSEAMMO = 16,
|
SF_NOUSEAMMO = 16,
|
||||||
|
SF_NOPULLIN = 32,
|
||||||
|
SF_NOTURN = 64,
|
||||||
};
|
};
|
||||||
|
|
||||||
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Saw)
|
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Saw)
|
||||||
|
@ -187,22 +189,26 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Saw)
|
||||||
S_Sound (self, CHAN_WEAPON, hitsound, 1, ATTN_NORM);
|
S_Sound (self, CHAN_WEAPON, hitsound, 1, ATTN_NORM);
|
||||||
|
|
||||||
// turn to face target
|
// turn to face target
|
||||||
angle = R_PointToAngle2 (self->x, self->y,
|
if (!(Flags & SF_NOTURN))
|
||||||
|
{
|
||||||
|
angle = R_PointToAngle2(self->x, self->y,
|
||||||
linetarget->x, linetarget->y);
|
linetarget->x, linetarget->y);
|
||||||
if (angle - self->angle > ANG180)
|
if (angle - self->angle > ANG180)
|
||||||
{
|
{
|
||||||
if (angle - self->angle < (angle_t)(-ANG90/20))
|
if (angle - self->angle < (angle_t)(-ANG90 / 20))
|
||||||
self->angle = angle + ANG90/21;
|
self->angle = angle + ANG90 / 21;
|
||||||
else
|
else
|
||||||
self->angle -= ANG90/20;
|
self->angle -= ANG90 / 20;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (angle - self->angle > ANG90/20)
|
if (angle - self->angle > ANG90 / 20)
|
||||||
self->angle = angle - ANG90/21;
|
self->angle = angle - ANG90 / 21;
|
||||||
else
|
else
|
||||||
self->angle += ANG90/20;
|
self->angle += ANG90 / 20;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if (!(Flags & SF_NOPULLIN))
|
||||||
self->flags |= MF_JUSTATTACKED;
|
self->flags |= MF_JUSTATTACKED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3383,43 +3383,16 @@ class CommandInInventory : public SBarInfoCommandFlowControl
|
||||||
AInventory *invItem[2] = { statusBar->CPlayer->mo->FindInventory(item[0]), statusBar->CPlayer->mo->FindInventory(item[1]) };
|
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[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 && 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)
|
if (conditionAnd)
|
||||||
{
|
SetTruth((invItem[0] && invItem[1]) != negate, block, statusBar);
|
||||||
SetTruth(true, block, statusBar);
|
else
|
||||||
return;
|
SetTruth((invItem[0] || invItem[1]) != negate, block, statusBar);
|
||||||
}
|
}
|
||||||
else if((invItem[0] == NULL || invItem[1] == NULL) && negate)
|
else
|
||||||
{
|
SetTruth((invItem[0] != NULL) != negate, block, statusBar);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
protected:
|
protected:
|
||||||
bool conditionAnd;
|
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[] =
|
static const char *SBarInfoCommandNames[] =
|
||||||
{
|
{
|
||||||
"drawimage", "drawnumber", "drawswitchableimage",
|
"drawimage", "drawnumber", "drawswitchableimage",
|
||||||
|
@ -3467,7 +3480,7 @@ static const char *SBarInfoCommandNames[] =
|
||||||
"gamemode", "playerclass", "playertype", "aspectratio",
|
"gamemode", "playerclass", "playertype", "aspectratio",
|
||||||
"isselected", "usesammo", "usessecondaryammo",
|
"isselected", "usesammo", "usessecondaryammo",
|
||||||
"hasweaponpiece", "inventorybarnotvisible",
|
"hasweaponpiece", "inventorybarnotvisible",
|
||||||
"weaponammo", "ininventory", "alpha",
|
"weaponammo", "ininventory", "alpha", "ifhealth",
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -3480,7 +3493,7 @@ enum SBarInfoCommands
|
||||||
SBARINFO_GAMEMODE, SBARINFO_PLAYERCLASS, SBARINFO_PLAYERTYPE, SBARINFO_ASPECTRATIO,
|
SBARINFO_GAMEMODE, SBARINFO_PLAYERCLASS, SBARINFO_PLAYERTYPE, SBARINFO_ASPECTRATIO,
|
||||||
SBARINFO_ISSELECTED, SBARINFO_USESAMMO, SBARINFO_USESSECONDARYAMMO,
|
SBARINFO_ISSELECTED, SBARINFO_USESAMMO, SBARINFO_USESSECONDARYAMMO,
|
||||||
SBARINFO_HASWEAPONPIECE, SBARINFO_INVENTORYBARNOTVISIBLE,
|
SBARINFO_HASWEAPONPIECE, SBARINFO_INVENTORYBARNOTVISIBLE,
|
||||||
SBARINFO_WEAPONAMMO, SBARINFO_ININVENTORY, SBARINFO_ALPHA,
|
SBARINFO_WEAPONAMMO, SBARINFO_ININVENTORY, SBARINFO_ALPHA, SBARINFO_IFHEALTH,
|
||||||
};
|
};
|
||||||
|
|
||||||
SBarInfoCommand *SBarInfoCommandFlowControl::NextCommand(FScanner &sc)
|
SBarInfoCommand *SBarInfoCommandFlowControl::NextCommand(FScanner &sc)
|
||||||
|
@ -3513,6 +3526,7 @@ SBarInfoCommand *SBarInfoCommandFlowControl::NextCommand(FScanner &sc)
|
||||||
case SBARINFO_WEAPONAMMO: return new CommandWeaponAmmo(script);
|
case SBARINFO_WEAPONAMMO: return new CommandWeaponAmmo(script);
|
||||||
case SBARINFO_ININVENTORY: return new CommandInInventory(script);
|
case SBARINFO_ININVENTORY: return new CommandInInventory(script);
|
||||||
case SBARINFO_ALPHA: return new CommandAlpha(script);
|
case SBARINFO_ALPHA: return new CommandAlpha(script);
|
||||||
|
case SBARINFO_IFHEALTH: return new CommandIfHealth(script);
|
||||||
}
|
}
|
||||||
|
|
||||||
sc.ScriptError("Unknown command '%s'.\n", sc.String);
|
sc.ScriptError("Unknown command '%s'.\n", sc.String);
|
||||||
|
|
|
@ -14,6 +14,8 @@ const int SF_RANDOMLIGHTHIT = 4;
|
||||||
const int SF_RANDOMLIGHTBOTH = 6;
|
const int SF_RANDOMLIGHTBOTH = 6;
|
||||||
const int SF_NOUSEAMMOMISS = 8;
|
const int SF_NOUSEAMMOMISS = 8;
|
||||||
const int SF_NOUSEAMMO = 16;
|
const int SF_NOUSEAMMO = 16;
|
||||||
|
const int SF_NOPULLIN = 32;
|
||||||
|
const int SF_NOTURN = 64;
|
||||||
|
|
||||||
// Flags for A_CustomMissile
|
// Flags for A_CustomMissile
|
||||||
const int CMF_AIMOFFSET = 1;
|
const int CMF_AIMOFFSET = 1;
|
||||||
|
|
Loading…
Reference in a new issue