mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-10 23:01:50 +00:00
- scriptified the no-spawn flag check for armor and health items.
This commit is contained in:
parent
319f8743db
commit
a5fc26b37c
3 changed files with 30 additions and 23 deletions
|
@ -5621,32 +5621,17 @@ AActor *P_SpawnMapThing (FMapThing *mthing, int position)
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
auto it = GetDefaultByType(i);
|
||||||
|
|
||||||
// [RH] Other things that shouldn't be spawned depending on dmflags
|
IFVIRTUALPTR(it, AActor, ShouldSpawn)
|
||||||
if (deathmatch || alwaysapplydmflags)
|
|
||||||
{
|
{
|
||||||
if (i->IsDescendantOf(RUNTIME_CLASS(AInventory)))
|
int ret;
|
||||||
{
|
VMValue param = it;
|
||||||
auto it = static_cast<AInventory*>(GetDefaultByType(i));
|
VMReturn rett(&ret);
|
||||||
|
VMCall(func, ¶m, 1, &rett, 1);
|
||||||
if (dmflags & DF_NO_HEALTH)
|
if (!ret) return nullptr;
|
||||||
{
|
|
||||||
if (it->ItemFlags & IF_ISHEALTH) return nullptr;
|
|
||||||
}
|
|
||||||
if (dmflags & DF_NO_ITEMS)
|
|
||||||
{
|
|
||||||
// if (i->IsDescendantOf (RUNTIME_CLASS(AArtifact)))
|
|
||||||
// return;
|
|
||||||
}
|
|
||||||
if (dmflags & DF_NO_ARMOR)
|
|
||||||
{
|
|
||||||
if (it->ItemFlags & IF_ISARMOR) return nullptr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// spawn it
|
// spawn it
|
||||||
double sz;
|
double sz;
|
||||||
|
|
||||||
|
|
|
@ -961,6 +961,11 @@ class Actor : Thinker native
|
||||||
Alpha = default.Alpha;
|
Alpha = default.Alpha;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual bool ShouldSpawn()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
native void A_Face(Actor faceto, double max_turn = 0, double max_pitch = 270, double ang_offset = 0, double pitch_offset = 0, int flags = 0, double z_ofs = 0);
|
native void A_Face(Actor faceto, double max_turn = 0, double max_pitch = 270, double ang_offset = 0, double pitch_offset = 0, int flags = 0, double z_ofs = 0);
|
||||||
|
|
||||||
void A_FaceTarget(double max_turn = 0, double max_pitch = 270, double ang_offset = 0, double pitch_offset = 0, int flags = 0, double z_ofs = 0)
|
void A_FaceTarget(double max_turn = 0, double max_pitch = 270, double ang_offset = 0, double pitch_offset = 0, int flags = 0, double z_ofs = 0)
|
||||||
|
|
|
@ -113,6 +113,23 @@ class Inventory : Actor native
|
||||||
Super.OnDestroy();
|
Super.OnDestroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//===========================================================================
|
||||||
|
//
|
||||||
|
// AInventory :: ShouldSpawn
|
||||||
|
//
|
||||||
|
//===========================================================================
|
||||||
|
|
||||||
|
override bool ShouldSpawn()
|
||||||
|
{
|
||||||
|
// [RH] Other things that shouldn't be spawned depending on dmflags
|
||||||
|
if (deathmatch || alwaysapplydmflags)
|
||||||
|
{
|
||||||
|
if (sv_nohealth && bIsHealth) return false;
|
||||||
|
if (sv_noarmor && bIsArmor) return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// PROC A_RestoreSpecialThing1
|
// PROC A_RestoreSpecialThing1
|
||||||
|
|
Loading…
Reference in a new issue