May 18, 2008 (SBarInfo Update #20)

- Added: hasweaponpiece command to check for custom weapon pieces.
- Added: usessecondaryammo command to check if the current weapon has a second
  ammo type.
- Most of SBarInfo's mugshot scripting can be used with the default Doom status
  bar.
- Fixed: By default drawmugshot would never come out of normal god mode state.
  In addition the state change to and from god mode was not quite as responsive
  as the original code.

SVN r980 (trunk)
This commit is contained in:
Christoph Oelckers 2008-05-18 15:48:03 +00:00
commit 35ea94c014
10 changed files with 338 additions and 329 deletions

View file

@ -81,7 +81,7 @@ FRandom pr_acs ("ACS");
#define CLAMPCOLOR(c) (EColorRange)((unsigned)(c) >= NUM_TEXT_COLORS ? CR_UNTRANSLATED : (c))
#define HUDMSG_LOG (0x80000000)
#define HUDMSG_COLORSTRING (0x40000000)
#define LANGREGIONMASK MAKE_ID(0,0,0xff,0xff)
#define LANGREGIONMASK MAKE_ID(0,0,0xff,0xff)
// Flags for ReplaceTextures
#define NOT_BOTTOM 1
@ -143,7 +143,7 @@ static void DoClearInv (AActor *actor)
AAmmo *ammo = static_cast<AAmmo*>(inv);
ammo->Amount = 0;
}
else
else
inv->Destroy ();
}
else if (inv->GetClass() == RUNTIME_CLASS(AHexenArmor))
@ -203,7 +203,7 @@ static void DoGiveInv (AActor *actor, const PClass *info, int amount)
AInventory *item = static_cast<AInventory *>(Spawn (info, 0,0,0, NO_REPLACE));
// This shouldn't count for the item statistics!
if (item->flags & MF_COUNTITEM)
if (item->flags & MF_COUNTITEM)
{
level.total_items--;
item->flags &= ~MF_COUNTITEM;
@ -298,9 +298,9 @@ static void DoTakeInv (AActor *actor, const PClass *info, int amount)
item->Amount -= amount;
if (item->Amount <= 0)
{
// If it's not ammo or an internal armor, destroy it.
// Ammo needs to stick around, even when it's zero for the benefit
// of the weapons that use it and to maintain the maximum ammo
// If it's not ammo or an internal armor, destroy it.
// Ammo needs to stick around, even when it's zero for the benefit
// of the weapons that use it and to maintain the maximum ammo
// amounts a backpack might have given.
// Armor shouldn't be removed because they only work properly when
// they are the last items in the inventory.
@ -520,7 +520,7 @@ void DPlaneWatcher::Tick ()
}
fixed_t newd;
if (bCeiling)
{
newd = Sector->ceilingplane.d;
@ -825,7 +825,7 @@ FBehavior::FBehavior (int lumpnum, FileReader * fr, int len)
Data = object;
DataSize = len;
if (Format == ACS_Old)
{
DWORD dirofs = LittleLong(((DWORD *)object)[1]);
@ -1227,7 +1227,7 @@ void FBehavior::LoadScriptsDirectory ()
}
}
break;
default:
break;
}
@ -1818,11 +1818,11 @@ int DLevelScript::ThingCount (int type, int stringid, int tid, int tag)
const char *type_name = FBehavior::StaticLookupString (stringid);
if (type_name == NULL)
return 0;
kind = PClass::FindClass (type_name);
if (kind == NULL || kind->ActorInfo == NULL)
return 0;
}
else
{
@ -1918,7 +1918,7 @@ int DLevelScript::CountPlayers ()
for (i = 0; i < MAXPLAYERS; i++)
if (playeringame[i])
count++;
return count;
}
@ -2248,7 +2248,7 @@ void DLevelScript::DoSetActorProperty (AActor *actor, int property, int value)
case APROP_RenderStyle:
for(int i=0; LegacyRenderStyleIndices[i] >= 0; i++)
{
if (LegacyRenderStyleIndices[i] == value)
if (LegacyRenderStyleIndices[i] == value)
{
actor->RenderStyle = ERenderStyle(i);
break;
@ -2282,14 +2282,14 @@ void DLevelScript::DoSetActorProperty (AActor *actor, int property, int value)
else
actor->flags4 &= ~MF4_FRIGHTENED;
break;
case APROP_Friendly:
if (value)
actor->flags |= MF_FRIENDLY;
else
actor->flags &= ~MF_FRIENDLY;
break;
case APROP_SpawnHealth:
if (actor->IsKindOf (RUNTIME_CLASS (APlayerPawn)))
@ -2297,7 +2297,7 @@ void DLevelScript::DoSetActorProperty (AActor *actor, int property, int value)
static_cast<APlayerPawn *>(actor)->MaxHealth = value;
}
break;
case APROP_Gravity:
actor->gravity = value;
break;
@ -2311,7 +2311,7 @@ void DLevelScript::DoSetActorProperty (AActor *actor, int property, int value)
break;
case APROP_PainSound:
actor->PainSound = S_FindSound (FBehavior::StaticLookupString (value));
actor->PainSound = S_FindSound (FBehavior::StaticLookupString (value));
break;
case APROP_DeathSound:
@ -2374,7 +2374,7 @@ int DLevelScript::GetActorProperty (int tid, int property)
{
return actor->GetDefault()->health;
}
case APROP_JumpZ: if (actor->IsKindOf (RUNTIME_CLASS (APlayerPawn)))
{
return static_cast<APlayerPawn *>(actor)->JumpZ; // [GRB]
@ -2425,7 +2425,7 @@ int DLevelScript::RunScript ()
while ((secnum = P_FindSectorFromTag (statedata, secnum)) >= 0)
if (sectors[secnum].floordata || sectors[secnum].ceilingdata)
return resultValue;
// If we got here, none of the tagged sectors were busy
state = SCRIPT_Running;
}
@ -3571,7 +3571,7 @@ int DLevelScript::RunScript ()
STACK(2) = Random (STACK(2), STACK(1));
sp--;
break;
case PCD_RANDOMDIRECT:
PushToStack (Random (pc[0], pc[1]));
pc += 2;
@ -4273,7 +4273,7 @@ int DLevelScript::RunScript ()
{
FActorIterator iterator (STACK(7));
AActor *actor;
while ( (actor = iterator.Next ()) )
{
actor->special = STACK(6);
@ -4457,7 +4457,7 @@ int DLevelScript::RunScript ()
break;
case PCD_CHECKACTORINVENTORY:
STACK(2) = CheckInventory (SingleActorFromTID(STACK(2), NULL),
STACK(2) = CheckInventory (SingleActorFromTID(STACK(2), NULL),
FBehavior::StaticLookupString (STACK(1)));
sp--;
break;
@ -4877,7 +4877,7 @@ int DLevelScript::RunScript ()
}
}
break;
case PCD_SETMARINEWEAPON:
if (STACK(2) != 0)
{
@ -5150,7 +5150,7 @@ int DLevelScript::RunScript ()
FState *state;
MakeStateNameList(statename, &statelist);
if (STACK(3) == 0)
{
state = activator->GetClass()->ActorInfo->FindState (statelist.Size(), &statelist[0], !!STACK(1));
@ -5223,7 +5223,7 @@ int DLevelScript::RunScript ()
case PCD_CHANGELEVEL:
{
int flags = STACK(2);
G_ChangeLevel(FBehavior::StaticLookupString(STACK(4)), STACK(3),
G_ChangeLevel(FBehavior::StaticLookupString(STACK(4)), STACK(3),
!!(flags & CHANGELEVEL_KEEPFACING), STACK(1),
!!(flags & CHANGELEVEL_NOINTERMISSION),
!!(flags & CHANGELEVEL_RESETINVENTORY),
@ -5243,7 +5243,7 @@ int DLevelScript::RunScript ()
sp -= 5;
int secnum = -1;
while ((secnum = P_FindSectorFromTag (tag, secnum)) >= 0)
{
AActor *actor, *next;
@ -5334,25 +5334,22 @@ int DLevelScript::RunScript ()
}
case PCD_SETMUGSHOTSTATE:
if(StatusBar != NULL && StatusBar->IsKindOf(RUNTIME_CLASS(DSBarInfo)))
{
static_cast<DSBarInfo*>(StatusBar)->SetMugShotState(FBehavior::StaticLookupString(STACK(1)));
}
StatusBar->SetMugShotState(FBehavior::StaticLookupString(STACK(1)));
break;
case PCD_CHECKPLAYERCAMERA:
{
int playernum = STACK(1);
if (playernum < 0 || playernum >= MAXPLAYERS || !playeringame[playernum] || players[playernum].camera == NULL)
{
STACK(1) = -1;
}
else
else
{
STACK(1) = players[playernum].camera->tid;
}
}
}
break;
}
}