mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-10 23:01:50 +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)
|
March 21, 2008 (Changes by Graf Zahl)
|
||||||
|
- Added Karate Chris's ThingCountSector submission.
|
||||||
- Made texture indices in FSwitchDef full integers. Since that required
|
- Made texture indices in FSwitchDef full integers. Since that required
|
||||||
some data restructuring I also eliminated the MAX_FRAMES limit of 128
|
some data restructuring I also eliminated the MAX_FRAMES limit of 128
|
||||||
per switch.
|
per switch.
|
||||||
|
|
|
@ -1796,7 +1796,7 @@ int DLevelScript::Random (int min, int max)
|
||||||
return min + pr_acs(max - min + 1);
|
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;
|
AActor *actor;
|
||||||
const PClass *kind;
|
const PClass *kind;
|
||||||
|
@ -1838,11 +1838,14 @@ do_count:
|
||||||
if (actor->health > 0 &&
|
if (actor->health > 0 &&
|
||||||
(kind == NULL || actor->IsA (kind)))
|
(kind == NULL || actor->IsA (kind)))
|
||||||
{
|
{
|
||||||
// Don't count items in somebody's inventory
|
if (actor->Sector->tag == tag || tag == -1)
|
||||||
if (!actor->IsKindOf (RUNTIME_CLASS(AInventory)) ||
|
|
||||||
static_cast<AInventory *>(actor)->Owner == NULL)
|
|
||||||
{
|
{
|
||||||
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 &&
|
if (actor->health > 0 &&
|
||||||
(kind == NULL || actor->IsA (kind)))
|
(kind == NULL || actor->IsA (kind)))
|
||||||
{
|
{
|
||||||
// Don't count items in somebody's inventory
|
if (actor->Sector->tag == tag || tag == -1)
|
||||||
if (!actor->IsKindOf (RUNTIME_CLASS(AInventory)) ||
|
|
||||||
static_cast<AInventory *>(actor)->Owner == NULL)
|
|
||||||
{
|
{
|
||||||
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;
|
break;
|
||||||
|
|
||||||
case PCD_THINGCOUNT:
|
case PCD_THINGCOUNT:
|
||||||
STACK(2) = ThingCount (STACK(2), -1, STACK(1));
|
STACK(2) = ThingCount (STACK(2), -1, STACK(1), -1);
|
||||||
sp--;
|
sp--;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PCD_THINGCOUNTDIRECT:
|
case PCD_THINGCOUNTDIRECT:
|
||||||
PushToStack (ThingCount (pc[0], -1, pc[1]));
|
PushToStack (ThingCount (pc[0], -1, pc[1], -1));
|
||||||
pc += 2;
|
pc += 2;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PCD_THINGCOUNTNAME:
|
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--;
|
sp--;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -548,6 +548,8 @@ public:
|
||||||
PCD_CHECKACTORFLOORTEXTURE,
|
PCD_CHECKACTORFLOORTEXTURE,
|
||||||
/*340*/ PCD_GETACTORLIGHTLEVEL,
|
/*340*/ PCD_GETACTORLIGHTLEVEL,
|
||||||
PCD_SETMUGSHOTSTATE,
|
PCD_SETMUGSHOTSTATE,
|
||||||
|
PCD_THINGCOUNTSECTOR,
|
||||||
|
PCD_THINGCOUNTNAMESECTOR,
|
||||||
|
|
||||||
PCODE_COMMAND_COUNT
|
PCODE_COMMAND_COUNT
|
||||||
};
|
};
|
||||||
|
@ -668,7 +670,7 @@ protected:
|
||||||
void PutLast ();
|
void PutLast ();
|
||||||
void PutFirst ();
|
void PutFirst ();
|
||||||
static int Random (int min, int max);
|
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 void ChangeFlat (int tag, int name, bool floorOrCeiling);
|
||||||
static int CountPlayers ();
|
static int CountPlayers ();
|
||||||
static void SetLineTexture (int lineid, int side, int position, int name);
|
static void SetLineTexture (int lineid, int side, int position, int name);
|
||||||
|
|
Loading…
Reference in a new issue