SVN r241 (trunk)

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

View file

@ -1,3 +1,11 @@
July 9, 2006 (Changes by Graf Zahl)
- Fixed: The defaultbind command still treated the bindings as char pointers and
as a result didn't work.
- Added SpawnSpotFacing ACS function which is the same as SpawnSpot but it uses
the map spot's angle.
- Added ThingCountName ACS function which is the same as ThingCount but it takes
an actor's type name instead of a spawn ID.
July 9, 2006
- Fixed: If the sector behind a seg was closed, but it was closed between the
ceiling and floor of the front sector, the renderer did not add it to the

View file

@ -368,19 +368,19 @@ CCMD (defaultbind)
Printf ("Unknown key \"%s\"\n", argv[1]);
return;
}
if (Bindings[key] != NULL)
if (!Bindings[key].IsEmpty())
{ // This key is already bound.
return;
}
for (int i = 0; i < NUM_KEYS; ++i)
{
if (Bindings[i] != NULL && stricmp (Bindings[i], argv[2]) == 0)
if (!Bindings[i].IsEmpty() && stricmp (Bindings[i], argv[2]) == 0)
{ // This command is already bound to a key.
return;
}
}
// It is safe to do the bind, so do it.
Bindings[key] = copystring (argv[2]);
Bindings[key] = argv[2];
}
}

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;

View file

@ -491,6 +491,8 @@ public:
PCD_GIVEACTORINVENTORY,
PCD_TAKEACTORINVENTORY,
PCD_CHECKACTORINVENTORY,
PCD_THINGCOUNTNAME,
PCD_SPAWNSPOTFACING,
PCODE_COMMAND_COUNT
};
@ -590,12 +592,13 @@ protected:
void PutLast ();
void PutFirst ();
static int Random (int min, int max);
static int ThingCount (int type, int tid);
static int ThingCount (int type, int stringid, int tid);
static void ChangeFlat (int tag, int name, bool floorOrCeiling);
static int CountPlayers ();
static void SetLineTexture (int lineid, int side, int position, int name);
static int DoSpawn (int type, fixed_t x, fixed_t y, fixed_t z, int tid, int angle);
static int DoSpawnSpot (int type, int spot, int tid, int angle);
static int DoSpawnSpotFacing (int type, int spot, int tid);
void DoFadeTo (int r, int g, int b, int a, fixed_t time);
void DoFadeRange (int r1, int g1, int b1, int a1,

View file

@ -785,6 +785,8 @@ AInventory *AActor::FindInventory (const PClass *type) const
{
AInventory *item;
if (type == NULL) return NULL;
assert (type->ActorInfo != NULL);
for (item = Inventory; item != NULL; item = item->Inventory)
{