SVN r241 (trunk)

This commit is contained in:
Christoph Oelckers 2006-07-09 20:15:38 +00:00
commit dd3c0d82f7
5 changed files with 54 additions and 7 deletions

View file

@ -1675,7 +1675,7 @@ int DLevelScript::Random (int min, int max)
return min + pr_acs(max - min + 1);
}
int DLevelScript::ThingCount (int type, int tid)
int DLevelScript::ThingCount (int type, int stringid, int tid)
{
AActor *actor;
const PClass *kind;
@ -1691,6 +1691,17 @@ int DLevelScript::ThingCount (int type, int tid)
if (kind == NULL)
return 0;
}
else if (stringid >= 0)
{
const char *type_name = FBehavior::StaticLookupString (stringid);
if (type_name == NULL)
return 0;
kind = PClass::FindClass (type_name);
if (kind == NULL)
return 0;
}
else
{
kind = NULL;
@ -1861,6 +1872,19 @@ int DLevelScript::DoSpawnSpot (int type, int spot, int tid, int angle)
return spawned;
}
int DLevelScript::DoSpawnSpotFacing (int type, int spot, int tid)
{
FActorIterator iterator (spot);
AActor *aspot;
int spawned = 0;
while ( (aspot = iterator.Next ()) )
{
spawned = DoSpawn (type, aspot->x, aspot->y, aspot->z, tid, aspot->angle);
}
return spawned;
}
void DLevelScript::DoFadeTo (int r, int g, int b, int a, fixed_t time)
{
DoFadeRange (0, 0, 0, -1, r, g, b, a, time);
@ -3119,15 +3143,20 @@ int DLevelScript::RunScript ()
break;
case PCD_THINGCOUNT:
STACK(2) = ThingCount (STACK(2), STACK(1));
STACK(2) = ThingCount (STACK(2), -1, STACK(1));
sp--;
break;
case PCD_THINGCOUNTDIRECT:
PushToStack (ThingCount (pc[0], pc[1]));
PushToStack (ThingCount (pc[0], -1, pc[1]));
pc += 2;
break;
case PCD_THINGCOUNTNAME:
STACK(2) = ThingCount (-1, STACK(2), STACK(1));
sp--;
break;
case PCD_TAGWAIT:
state = SCRIPT_TagWait;
statedata = STACK(1);
@ -3834,6 +3863,11 @@ int DLevelScript::RunScript ()
pc += 4;
break;
case PCD_SPAWNSPOTFACING:
STACK(3) = DoSpawnSpotFacing (STACK(3), STACK(2), STACK(1));
sp -= 2;
break;
case PCD_CLEARINVENTORY:
ClearInventory (activator);
break;