- Remove extra *usefail definition for the pig player.

- Locks can now define more than one LockedSound by separating them with commas. The default setting
  for this property is now "*keytry", "misc/keytry". The first sound that is defined is the one that will
  be played for the lock. Thus, for standard locks, if the player class defines *keytry, that will be
  played. Otherwise, misc/keytry will be played as before.



SVN r2827 (trunk)
This commit is contained in:
Randy Heit 2010-09-19 03:30:31 +00:00
parent df138fe4f9
commit 94ce4d5d69
2 changed files with 45 additions and 18 deletions

View file

@ -45,9 +45,9 @@ struct Keygroup
struct Lock
{
TArray<Keygroup *> keylist;
TArray<FSoundID> locksound;
FString Message;
FString RemoteMsg;
FSoundID locksound;
int rgb;
Lock()
@ -230,7 +230,8 @@ static void ParseLock(FScanner &sc)
delete locks[keynum];
}
locks[keynum] = lock;
locks[keynum]->locksound = "misc/keytry";
locks[keynum]->locksound.Push("*keytry");
locks[keynum]->locksound.Push("misc/keytry");
ignorekey=false;
}
else if (keynum != -1)
@ -273,8 +274,21 @@ static void ParseLock(FScanner &sc)
break;
case 4: // locksound
sc.MustGetString();
lock->locksound = sc.String;
lock->locksound.Clear();
for (;;)
{
sc.MustGetString();
lock->locksound.Push(sc.String);
if (!sc.GetString())
{
break;
}
if (!sc.Compare(","))
{
sc.UnGet();
break;
}
}
break;
default:
@ -398,27 +412,32 @@ void P_DeinitKeyMessages()
bool P_CheckKeys (AActor *owner, int keynum, bool remote)
{
const char *failtext = NULL;
FSoundID failsound;
FSoundID *failsound;
int numfailsounds;
if (owner == NULL) return false;
if (keynum<=0 || keynum>255) return true;
// Just a safety precaution. The messages should have been initialized upon game start.
if (!keysdone) P_InitKeyMessages();
FSoundID failage[2] = { "*keytry", "misc/keytry" };
if (!locks[keynum])
{
if (keynum==103 && gameinfo.gametype == GAME_Strife)
if (keynum == 103 && gameinfo.gametype == GAME_Strife)
failtext = "THIS AREA IS ONLY AVAILABLE IN THE RETAIL VERSION OF STRIFE";
else
failtext = "That doesn't seem to work";
failsound = "misc/keytry";
failsound = failage;
numfailsounds = countof(failage);
}
else
{
if (locks[keynum]->check(owner)) return true;
failtext = remote? locks[keynum]->RemoteMsg : locks[keynum]->Message;
failsound = locks[keynum]->locksound;
failsound = &locks[keynum]->locksound[0];
numfailsounds = locks[keynum]->locksound.Size();
}
// If we get here, that means the actor isn't holding an appropriate key.
@ -426,7 +445,16 @@ bool P_CheckKeys (AActor *owner, int keynum, bool remote)
if (owner == players[consoleplayer].camera)
{
PrintMessage(failtext);
S_Sound (owner, CHAN_VOICE, failsound, 1, ATTN_NORM);
// Play the first defined key sound.
for (int i = 0; i < numfailsounds; ++i)
{
if (failsound[i] != 0)
{
S_Sound (owner, CHAN_VOICE, failsound[i], 1, ATTN_NORM);
break;
}
}
}
return false;

View file

@ -890,15 +890,14 @@ $playeralias mage male *usefail PlayerMageFailedUse
$playeralias mage male *puzzfail PuzzleFailMage
$playersound mage male *jump mgjump
$playeralias pig male *usefail PigActive1
$PlayerAlias Pig Male *UseFail PigActive1
$playeralias Pig Male *PuzzFail PigActive2
$PlayerAlias Pig Male *Grunt PigActive1
$PlayerAlias Pig Male *Land PigActive2
$PlayerAlias Pig Male *Jump PigActive1
$PlayerAlias Pig Male *Poison PigActive2
$PlayerAlias Pig Male *Falling PigPain
$PlayerAlias Pig Male *Splat PigDeath
$playeralias pig male *usefail PigActive1
$playeralias pig male *puzzfail PigActive2
$playeralias pig male *grunt PigActive1
$playeralias pig male *land PigActive2
$playeralias pig male *jump PigActive1
$playeralias pig male *poison PigActive2
$playeralias pig male *falling PigPain
$playeralias pig male *splat PigDeath
$alias world/drip Ambient10
$alias world/watersplash WaterSplash