mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-12-11 04:51:13 +00:00
Merge commit '7a96f91591b3f1ca76a5986cf46f5446caee2d38'
This commit is contained in:
commit
452479e5aa
3 changed files with 37 additions and 14 deletions
|
@ -1264,7 +1264,7 @@ static int UseInventory (AActor *activator, const char *type)
|
||||||
//
|
//
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
static int CheckInventory (AActor *activator, const char *type)
|
static int CheckInventory (AActor *activator, const char *type, bool max)
|
||||||
{
|
{
|
||||||
if (activator == NULL || type == NULL)
|
if (activator == NULL || type == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1275,11 +1275,26 @@ static int CheckInventory (AActor *activator, const char *type)
|
||||||
}
|
}
|
||||||
else if (stricmp (type, "Health") == 0)
|
else if (stricmp (type, "Health") == 0)
|
||||||
{
|
{
|
||||||
|
if (max)
|
||||||
|
{
|
||||||
|
if (activator->IsKindOf (RUNTIME_CLASS (APlayerPawn)))
|
||||||
|
return static_cast<APlayerPawn *>(activator)->MaxHealth;
|
||||||
|
else
|
||||||
|
return activator->SpawnHealth();
|
||||||
|
}
|
||||||
return activator->health;
|
return activator->health;
|
||||||
}
|
}
|
||||||
|
|
||||||
const PClass *info = PClass::FindClass (type);
|
const PClass *info = PClass::FindClass (type);
|
||||||
AInventory *item = activator->FindInventory (info);
|
AInventory *item = activator->FindInventory (info);
|
||||||
|
|
||||||
|
if (max)
|
||||||
|
{
|
||||||
|
if (item)
|
||||||
|
return item->MaxAmount;
|
||||||
|
else
|
||||||
|
return ((AInventory *)GetDefaultByType (info))->MaxAmount;
|
||||||
|
}
|
||||||
return item ? item->Amount : 0;
|
return item ? item->Amount : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4442,6 +4457,7 @@ enum EACSFunctions
|
||||||
ACSF_GetActorRoll,
|
ACSF_GetActorRoll,
|
||||||
ACSF_QuakeEx,
|
ACSF_QuakeEx,
|
||||||
ACSF_Warp, // 92
|
ACSF_Warp, // 92
|
||||||
|
ACSF_GetMaxInventory,
|
||||||
|
|
||||||
/* Zandronum's - these must be skipped when we reach 99!
|
/* Zandronum's - these must be skipped when we reach 99!
|
||||||
-100:ResetMap(0),
|
-100:ResetMap(0),
|
||||||
|
@ -5915,6 +5931,13 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound)
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
case ACSF_GetMaxInventory:
|
||||||
|
actor = SingleActorFromTID(args[0], activator);
|
||||||
|
if (actor != NULL)
|
||||||
|
{
|
||||||
|
return CheckInventory(actor, FBehavior::StaticLookupString(args[1]), true);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -8339,17 +8362,17 @@ scriptwait:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PCD_CHECKINVENTORY:
|
case PCD_CHECKINVENTORY:
|
||||||
STACK(1) = CheckInventory (activator, FBehavior::StaticLookupString (STACK(1)));
|
STACK(1) = CheckInventory (activator, FBehavior::StaticLookupString (STACK(1)), false);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PCD_CHECKACTORINVENTORY:
|
case PCD_CHECKACTORINVENTORY:
|
||||||
STACK(2) = CheckInventory (SingleActorFromTID(STACK(2), NULL),
|
STACK(2) = CheckInventory (SingleActorFromTID(STACK(2), NULL),
|
||||||
FBehavior::StaticLookupString (STACK(1)));
|
FBehavior::StaticLookupString (STACK(1)), false);
|
||||||
sp--;
|
sp--;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PCD_CHECKINVENTORYDIRECT:
|
case PCD_CHECKINVENTORYDIRECT:
|
||||||
PushToStack (CheckInventory (activator, FBehavior::StaticLookupString (TAGSTR(uallong(pc[0])))));
|
PushToStack (CheckInventory (activator, FBehavior::StaticLookupString (TAGSTR(uallong(pc[0]))), false));
|
||||||
pc += 1;
|
pc += 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -288,8 +288,6 @@ bool P_TestActivateLine (line_t *line, AActor *mo, int side, int activationType)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((lineActivation & activationType) == 0)
|
|
||||||
{
|
|
||||||
if (activationType == SPAC_Use && (lineActivation & SPAC_MUse) && !mo->player && mo->flags4 & MF4_CANUSEWALLS)
|
if (activationType == SPAC_Use && (lineActivation & SPAC_MUse) && !mo->player && mo->flags4 & MF4_CANUSEWALLS)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
@ -298,6 +296,8 @@ bool P_TestActivateLine (line_t *line, AActor *mo, int side, int activationType)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
if ((lineActivation & activationType) == 0)
|
||||||
|
{
|
||||||
if (activationType != SPAC_MCross || lineActivation != SPAC_Cross)
|
if (activationType != SPAC_MCross || lineActivation != SPAC_Cross)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -785,7 +785,7 @@ public:
|
||||||
bool strifetrans = false;
|
bool strifetrans = false;
|
||||||
bool strifetrans2 = false;
|
bool strifetrans2 = false;
|
||||||
FString arg0str, arg1str;
|
FString arg0str, arg1str;
|
||||||
int lineid; // forZDoomTranslated namespace
|
int lineid = -1; // forZDoomTranslated namespace
|
||||||
FString tagstring;
|
FString tagstring;
|
||||||
|
|
||||||
memset(ld, 0, sizeof(*ld));
|
memset(ld, 0, sizeof(*ld));
|
||||||
|
@ -1082,7 +1082,7 @@ public:
|
||||||
maplinedef_t mld;
|
maplinedef_t mld;
|
||||||
memset(&mld, 0, sizeof(mld));
|
memset(&mld, 0, sizeof(mld));
|
||||||
mld.special = ld->special;
|
mld.special = ld->special;
|
||||||
mld.tag = lineid;
|
mld.tag = ld->args[0];
|
||||||
P_TranslateLineDef(ld, &mld);
|
P_TranslateLineDef(ld, &mld);
|
||||||
ld->flags = saved | (ld->flags&(ML_MONSTERSCANACTIVATE|ML_REPEAT_SPECIAL|ML_FIRSTSIDEONLY));
|
ld->flags = saved | (ld->flags&(ML_MONSTERSCANACTIVATE|ML_REPEAT_SPECIAL|ML_FIRSTSIDEONLY));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue