mirror of
https://github.com/ZDoom/qzdoom.git
synced 2025-01-18 15:11:46 +00:00
- Added Karate Chris's ThingCountSector submission.
SVN r830 (trunk)
This commit is contained in:
parent
064f64e3a7
commit
82a6d0b44c
3 changed files with 32 additions and 13 deletions
|
@ -1,4 +1,5 @@
|
|||
March 21, 2008 (Changes by Graf Zahl)
|
||||
- Added Karate Chris's ThingCountSector submission.
|
||||
- Made texture indices in FSwitchDef full integers. Since that required
|
||||
some data restructuring I also eliminated the MAX_FRAMES limit of 128
|
||||
per switch.
|
||||
|
|
|
@ -1796,7 +1796,7 @@ int DLevelScript::Random (int min, int max)
|
|||
return min + pr_acs(max - min + 1);
|
||||
}
|
||||
|
||||
int DLevelScript::ThingCount (int type, int stringid, int tid)
|
||||
int DLevelScript::ThingCount (int type, int stringid, int tid, int tag)
|
||||
{
|
||||
AActor *actor;
|
||||
const PClass *kind;
|
||||
|
@ -1838,11 +1838,14 @@ do_count:
|
|||
if (actor->health > 0 &&
|
||||
(kind == NULL || actor->IsA (kind)))
|
||||
{
|
||||
// Don't count items in somebody's inventory
|
||||
if (!actor->IsKindOf (RUNTIME_CLASS(AInventory)) ||
|
||||
static_cast<AInventory *>(actor)->Owner == NULL)
|
||||
if (actor->Sector->tag == tag || tag == -1)
|
||||
{
|
||||
count++;
|
||||
// Don't count items in somebody's inventory
|
||||
if (!actor->IsKindOf (RUNTIME_CLASS(AInventory)) ||
|
||||
static_cast<AInventory *>(actor)->Owner == NULL)
|
||||
{
|
||||
count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1855,11 +1858,14 @@ do_count:
|
|||
if (actor->health > 0 &&
|
||||
(kind == NULL || actor->IsA (kind)))
|
||||
{
|
||||
// Don't count items in somebody's inventory
|
||||
if (!actor->IsKindOf (RUNTIME_CLASS(AInventory)) ||
|
||||
static_cast<AInventory *>(actor)->Owner == NULL)
|
||||
if (actor->Sector->tag == tag || tag == -1)
|
||||
{
|
||||
count++;
|
||||
// Don't count items in somebody's inventory
|
||||
if (!actor->IsKindOf (RUNTIME_CLASS(AInventory)) ||
|
||||
static_cast<AInventory *>(actor)->Owner == NULL)
|
||||
{
|
||||
count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3572,17 +3578,27 @@ int DLevelScript::RunScript ()
|
|||
break;
|
||||
|
||||
case PCD_THINGCOUNT:
|
||||
STACK(2) = ThingCount (STACK(2), -1, STACK(1));
|
||||
STACK(2) = ThingCount (STACK(2), -1, STACK(1), -1);
|
||||
sp--;
|
||||
break;
|
||||
|
||||
case PCD_THINGCOUNTDIRECT:
|
||||
PushToStack (ThingCount (pc[0], -1, pc[1]));
|
||||
PushToStack (ThingCount (pc[0], -1, pc[1], -1));
|
||||
pc += 2;
|
||||
break;
|
||||
|
||||
case PCD_THINGCOUNTNAME:
|
||||
STACK(2) = ThingCount (-1, STACK(2), STACK(1));
|
||||
STACK(2) = ThingCount (-1, STACK(2), STACK(1), -1);
|
||||
sp--;
|
||||
break;
|
||||
|
||||
case PCD_THINGCOUNTNAMESECTOR:
|
||||
STACK(2) = ThingCount (-1, STACK(3), STACK(2), STACK(1));
|
||||
sp--;
|
||||
break;
|
||||
|
||||
case PCD_THINGCOUNTSECTOR:
|
||||
STACK(2) = ThingCount (STACK(3), -1, STACK(2), STACK(1));
|
||||
sp--;
|
||||
break;
|
||||
|
||||
|
|
|
@ -548,6 +548,8 @@ public:
|
|||
PCD_CHECKACTORFLOORTEXTURE,
|
||||
/*340*/ PCD_GETACTORLIGHTLEVEL,
|
||||
PCD_SETMUGSHOTSTATE,
|
||||
PCD_THINGCOUNTSECTOR,
|
||||
PCD_THINGCOUNTNAMESECTOR,
|
||||
|
||||
PCODE_COMMAND_COUNT
|
||||
};
|
||||
|
@ -668,7 +670,7 @@ protected:
|
|||
void PutLast ();
|
||||
void PutFirst ();
|
||||
static int Random (int min, int max);
|
||||
static int ThingCount (int type, int stringid, int tid);
|
||||
static int ThingCount (int type, int stringid, int tid, int tag);
|
||||
static void ChangeFlat (int tag, int name, bool floorOrCeiling);
|
||||
static int CountPlayers ();
|
||||
static void SetLineTexture (int lineid, int side, int position, int name);
|
||||
|
|
Loading…
Reference in a new issue