2006-02-24 04:48:15 +00:00
|
|
|
#include "info.h"
|
|
|
|
#include "a_pickups.h"
|
|
|
|
#include "a_artifacts.h"
|
|
|
|
#include "gstrings.h"
|
|
|
|
#include "p_local.h"
|
|
|
|
#include "s_sound.h"
|
|
|
|
#include "c_console.h"
|
2008-09-14 23:54:38 +00:00
|
|
|
#include "doomstat.h"
|
2008-11-27 17:43:36 +00:00
|
|
|
#include "v_font.h"
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2008-08-09 11:35:42 +00:00
|
|
|
IMPLEMENT_CLASS (APuzzleItem)
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
void APuzzleItem::Serialize (FArchive &arc)
|
|
|
|
{
|
|
|
|
Super::Serialize (arc);
|
|
|
|
arc << PuzzleItemNumber;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool APuzzleItem::HandlePickup (AInventory *item)
|
|
|
|
{
|
|
|
|
// Can't carry more than 1 of each puzzle item in coop netplay
|
|
|
|
if (multiplayer && !deathmatch && item->GetClass() == GetClass())
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return Super::HandlePickup (item);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool APuzzleItem::Use (bool pickup)
|
|
|
|
{
|
|
|
|
if (P_UsePuzzleItem (Owner, PuzzleItemNumber))
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
// [RH] Always play the sound if the use fails.
|
|
|
|
S_Sound (Owner, CHAN_VOICE, "*puzzfail", 1, ATTN_IDLE);
|
2008-05-08 08:06:26 +00:00
|
|
|
if (Owner != NULL && Owner->CheckLocalView (consoleplayer))
|
|
|
|
{
|
|
|
|
const char *message = GetClass()->Meta.GetMetaString (AIMETA_PuzzFailMessage);
|
|
|
|
if (message != NULL && *message=='$') message = GStrings[message + 1];
|
|
|
|
if (message == NULL) message = GStrings("TXT_USEPUZZLEFAILED");
|
2008-11-27 17:43:36 +00:00
|
|
|
C_MidPrintBold (SmallFont, message);
|
2008-05-08 08:06:26 +00:00
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool APuzzleItem::ShouldStay ()
|
|
|
|
{
|
|
|
|
return !!multiplayer;
|
|
|
|
}
|
|
|
|
|