2008-09-15 14:11:05 +00:00
|
|
|
/*
|
2006-02-24 04:48:15 +00:00
|
|
|
#include "info.h"
|
|
|
|
#include "a_pickups.h"
|
|
|
|
#include "d_player.h"
|
|
|
|
#include "gstrings.h"
|
|
|
|
#include "p_local.h"
|
|
|
|
#include "p_spec.h"
|
|
|
|
#include "a_strifeglobal.h"
|
|
|
|
#include "p_lnspec.h"
|
|
|
|
#include "p_enemy.h"
|
|
|
|
#include "s_sound.h"
|
|
|
|
#include "d_event.h"
|
2006-05-07 00:27:22 +00:00
|
|
|
#include "a_keys.h"
|
2006-06-17 20:29:41 +00:00
|
|
|
#include "c_console.h"
|
2007-11-02 22:03:03 +00:00
|
|
|
#include "templates.h"
|
2008-08-10 20:48:55 +00:00
|
|
|
#include "thingdef/thingdef.h"
|
2008-09-14 23:54:38 +00:00
|
|
|
#include "g_level.h"
|
|
|
|
#include "doomstat.h"
|
2008-09-15 14:11:05 +00:00
|
|
|
*/
|
2006-02-24 04:48:15 +00:00
|
|
|
// Degnin Ore ---------------------------------------------------------------
|
|
|
|
|
2008-08-08 19:47:18 +00:00
|
|
|
IMPLEMENT_CLASS(ADegninOre)
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_RemoveForceField)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
self->flags &= ~MF_SPECIAL;
|
|
|
|
|
|
|
|
for (int i = 0; i < self->Sector->linecount; ++i)
|
|
|
|
{
|
|
|
|
line_t *line = self->Sector->lines[i];
|
|
|
|
if (line->backsector != NULL && line->special == ForceField)
|
|
|
|
{
|
|
|
|
line->flags &= ~(ML_BLOCKING|ML_BLOCKEVERYTHING);
|
|
|
|
line->special = 0;
|
2008-06-15 18:36:26 +00:00
|
|
|
sides[line->sidenum[0]].SetTexture(side_t::mid, FNullTextureID());
|
|
|
|
sides[line->sidenum[1]].SetTexture(side_t::mid, FNullTextureID());
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool ADegninOre::Use (bool pickup)
|
|
|
|
{
|
|
|
|
if (pickup)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
AInventory *drop;
|
|
|
|
|
|
|
|
// Increase the amount by one so that when DropInventory decrements it,
|
|
|
|
// the actor will have the same number of beacons that he started with.
|
|
|
|
// When we return to UseInventory, it will take care of decrementing
|
|
|
|
// Amount again and disposing of this item if there are no more.
|
|
|
|
Amount++;
|
|
|
|
drop = Owner->DropInventory (this);
|
|
|
|
if (drop == NULL)
|
|
|
|
{
|
|
|
|
Amount--;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Health Training ----------------------------------------------------------
|
|
|
|
|
|
|
|
class AHealthTraining : public AInventory
|
|
|
|
{
|
2008-08-08 19:47:18 +00:00
|
|
|
DECLARE_CLASS (AHealthTraining, AInventory)
|
2006-02-24 04:48:15 +00:00
|
|
|
public:
|
2008-09-13 22:08:41 +00:00
|
|
|
bool TryPickup (AActor *&toucher);
|
2006-02-24 04:48:15 +00:00
|
|
|
};
|
|
|
|
|
2008-08-08 19:47:18 +00:00
|
|
|
IMPLEMENT_CLASS (AHealthTraining)
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2008-09-13 22:08:41 +00:00
|
|
|
bool AHealthTraining::TryPickup (AActor *&toucher)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
if (Super::TryPickup (toucher))
|
|
|
|
{
|
2008-08-08 19:47:18 +00:00
|
|
|
toucher->GiveInventoryType (PClass::FindClass("GunTraining"));
|
2006-07-16 09:10:45 +00:00
|
|
|
AInventory *coin = Spawn<ACoin> (0,0,0, NO_REPLACE);
|
2006-02-24 04:48:15 +00:00
|
|
|
if (coin != NULL)
|
|
|
|
{
|
|
|
|
coin->Amount = toucher->player->accuracy*5 + 300;
|
2008-09-13 22:08:41 +00:00
|
|
|
if (!coin->CallTryPickup (toucher))
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
coin->Destroy ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Scanner ------------------------------------------------------------------
|
|
|
|
|
|
|
|
class AScanner : public APowerupGiver
|
|
|
|
{
|
2008-08-08 19:47:18 +00:00
|
|
|
DECLARE_CLASS (AScanner, APowerupGiver)
|
2006-02-24 04:48:15 +00:00
|
|
|
public:
|
|
|
|
bool Use (bool pickup);
|
|
|
|
};
|
|
|
|
|
2008-08-08 19:47:18 +00:00
|
|
|
IMPLEMENT_CLASS (AScanner)
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
bool AScanner::Use (bool pickup)
|
|
|
|
{
|
|
|
|
if (!(level.flags & LEVEL_ALLMAP))
|
|
|
|
{
|
|
|
|
if (Owner->CheckLocalView (consoleplayer))
|
|
|
|
{
|
2006-06-17 20:29:41 +00:00
|
|
|
C_MidPrint(GStrings("TXT_NEEDMAP"));
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return Super::Use (pickup);
|
|
|
|
}
|
|
|
|
|
2006-05-07 00:27:22 +00:00
|
|
|
// Prison Pass --------------------------------------------------------------
|
|
|
|
|
|
|
|
class APrisonPass : public AKey
|
|
|
|
{
|
2008-08-08 19:47:18 +00:00
|
|
|
DECLARE_CLASS (APrisonPass, AKey)
|
2006-05-07 00:27:22 +00:00
|
|
|
public:
|
2008-09-13 22:08:41 +00:00
|
|
|
bool TryPickup (AActor *&toucher);
|
2006-05-07 00:27:22 +00:00
|
|
|
bool SpecialDropAction (AActor *dropper);
|
|
|
|
};
|
|
|
|
|
2008-08-08 19:47:18 +00:00
|
|
|
IMPLEMENT_CLASS (APrisonPass)
|
2006-05-07 00:27:22 +00:00
|
|
|
|
2008-09-13 22:08:41 +00:00
|
|
|
bool APrisonPass::TryPickup (AActor *&toucher)
|
2006-05-07 00:27:22 +00:00
|
|
|
{
|
|
|
|
Super::TryPickup (toucher);
|
|
|
|
EV_DoDoor (DDoor::doorOpen, NULL, toucher, 223, 2*FRACUNIT, 0, 0, 0);
|
|
|
|
toucher->GiveInventoryType (QuestItemClasses[9]);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
//
|
|
|
|
// APrisonPass :: SpecialDropAction
|
|
|
|
//
|
|
|
|
// Trying to make a monster that drops a prison pass turns it into an
|
|
|
|
// OpenDoor223 item instead. That means the only way to get it in Strife
|
|
|
|
// is through dialog, which is why it doesn't have its own sprite.
|
|
|
|
//
|
|
|
|
//============================================================================
|
|
|
|
|
|
|
|
bool APrisonPass::SpecialDropAction (AActor *dropper)
|
|
|
|
{
|
|
|
|
EV_DoDoor (DDoor::doorOpen, NULL, dropper, 223, 2*FRACUNIT, 0, 0, 0);
|
|
|
|
Destroy ();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
// Dummy items. They are just used by Strife to perform ---------------------
|
|
|
|
// actions and cannot be held. ----------------------------------------------
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2008-08-08 19:47:18 +00:00
|
|
|
IMPLEMENT_CLASS (ADummyStrifeItem)
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
// Sound the alarm! ---------------------------------------------------------
|
|
|
|
|
|
|
|
class ARaiseAlarm : public ADummyStrifeItem
|
|
|
|
{
|
2008-08-08 19:47:18 +00:00
|
|
|
DECLARE_CLASS (ARaiseAlarm, ADummyStrifeItem)
|
2006-02-24 04:48:15 +00:00
|
|
|
public:
|
2008-09-13 22:08:41 +00:00
|
|
|
bool TryPickup (AActor *&toucher);
|
2006-02-24 04:48:15 +00:00
|
|
|
bool SpecialDropAction (AActor *dropper);
|
|
|
|
};
|
|
|
|
|
2008-08-08 19:47:18 +00:00
|
|
|
IMPLEMENT_CLASS (ARaiseAlarm)
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2008-09-13 22:08:41 +00:00
|
|
|
bool ARaiseAlarm::TryPickup (AActor *&toucher)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
P_NoiseAlert (toucher, toucher);
|
|
|
|
// A_WakeOracleSpectre (dword312F4);
|
|
|
|
GoAwayAndDie ();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool ARaiseAlarm::SpecialDropAction (AActor *dropper)
|
|
|
|
{
|
|
|
|
P_NoiseAlert (dropper->target, dropper->target);
|
|
|
|
if (dropper->target->CheckLocalView (consoleplayer))
|
|
|
|
{
|
|
|
|
Printf ("You Fool! You've set off the alarm.\n");
|
|
|
|
}
|
|
|
|
Destroy ();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Open door tag 222 --------------------------------------------------------
|
|
|
|
|
|
|
|
class AOpenDoor222 : public ADummyStrifeItem
|
|
|
|
{
|
2008-08-08 19:47:18 +00:00
|
|
|
DECLARE_CLASS (AOpenDoor222, ADummyStrifeItem)
|
2006-02-24 04:48:15 +00:00
|
|
|
public:
|
2008-09-13 22:08:41 +00:00
|
|
|
bool TryPickup (AActor *&toucher);
|
2006-02-24 04:48:15 +00:00
|
|
|
};
|
|
|
|
|
2008-08-08 19:47:18 +00:00
|
|
|
IMPLEMENT_CLASS (AOpenDoor222)
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2008-09-13 22:08:41 +00:00
|
|
|
bool AOpenDoor222::TryPickup (AActor *&toucher)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
EV_DoDoor (DDoor::doorOpen, NULL, toucher, 222, 2*FRACUNIT, 0, 0, 0);
|
|
|
|
GoAwayAndDie ();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Close door tag 222 -------------------------------------------------------
|
|
|
|
|
|
|
|
class ACloseDoor222 : public ADummyStrifeItem
|
|
|
|
{
|
2008-08-08 19:47:18 +00:00
|
|
|
DECLARE_CLASS (ACloseDoor222, ADummyStrifeItem)
|
2006-02-24 04:48:15 +00:00
|
|
|
public:
|
2008-09-13 22:08:41 +00:00
|
|
|
bool TryPickup (AActor *&toucher);
|
2006-02-24 04:48:15 +00:00
|
|
|
bool SpecialDropAction (AActor *dropper);
|
|
|
|
};
|
|
|
|
|
2008-08-08 19:47:18 +00:00
|
|
|
IMPLEMENT_CLASS (ACloseDoor222)
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2008-09-13 22:08:41 +00:00
|
|
|
bool ACloseDoor222::TryPickup (AActor *&toucher)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
EV_DoDoor (DDoor::doorClose, NULL, toucher, 222, 2*FRACUNIT, 0, 0, 0);
|
|
|
|
GoAwayAndDie ();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool ACloseDoor222::SpecialDropAction (AActor *dropper)
|
|
|
|
{
|
|
|
|
EV_DoDoor (DDoor::doorClose, NULL, dropper, 222, 2*FRACUNIT, 0, 0, 0);
|
|
|
|
if (dropper->target->CheckLocalView (consoleplayer))
|
|
|
|
{
|
|
|
|
Printf ("You're dead! You set off the alarm.\n");
|
|
|
|
}
|
|
|
|
P_NoiseAlert (dropper->target, dropper->target);
|
|
|
|
Destroy ();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Open door tag 224 --------------------------------------------------------
|
|
|
|
|
|
|
|
class AOpenDoor224 : public ADummyStrifeItem
|
|
|
|
{
|
2008-08-08 19:47:18 +00:00
|
|
|
DECLARE_CLASS (AOpenDoor224, ADummyStrifeItem)
|
2006-02-24 04:48:15 +00:00
|
|
|
public:
|
2008-09-13 22:08:41 +00:00
|
|
|
bool TryPickup (AActor *&toucher);
|
2006-02-24 04:48:15 +00:00
|
|
|
bool SpecialDropAction (AActor *dropper);
|
|
|
|
};
|
|
|
|
|
2008-08-08 19:47:18 +00:00
|
|
|
IMPLEMENT_CLASS (AOpenDoor224)
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2008-09-13 22:08:41 +00:00
|
|
|
bool AOpenDoor224::TryPickup (AActor *&toucher)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
EV_DoDoor (DDoor::doorOpen, NULL, toucher, 224, 2*FRACUNIT, 0, 0, 0);
|
|
|
|
GoAwayAndDie ();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool AOpenDoor224::SpecialDropAction (AActor *dropper)
|
|
|
|
{
|
|
|
|
EV_DoDoor (DDoor::doorOpen, NULL, dropper, 224, 2*FRACUNIT, 0, 0, 0);
|
|
|
|
Destroy ();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Ammo ---------------------------------------------------------------------
|
|
|
|
|
|
|
|
class AAmmoFillup : public ADummyStrifeItem
|
|
|
|
{
|
2008-08-08 19:47:18 +00:00
|
|
|
DECLARE_CLASS (AAmmoFillup, ADummyStrifeItem)
|
2006-02-24 04:48:15 +00:00
|
|
|
public:
|
2008-09-13 22:08:41 +00:00
|
|
|
bool TryPickup (AActor *&toucher);
|
2006-02-24 04:48:15 +00:00
|
|
|
};
|
|
|
|
|
2008-08-08 19:47:18 +00:00
|
|
|
IMPLEMENT_CLASS (AAmmoFillup)
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2008-09-13 22:08:41 +00:00
|
|
|
bool AAmmoFillup::TryPickup (AActor *&toucher)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2006-06-17 20:29:41 +00:00
|
|
|
const PClass * clip = PClass::FindClass(NAME_ClipOfBullets);
|
|
|
|
if (clip != NULL)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2006-06-17 20:29:41 +00:00
|
|
|
AInventory *item = toucher->FindInventory(clip);
|
|
|
|
if (item == NULL)
|
|
|
|
{
|
|
|
|
item = toucher->GiveInventoryType (clip);
|
|
|
|
if (item != NULL)
|
|
|
|
{
|
|
|
|
item->Amount = 50;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (item->Amount < 50)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
item->Amount = 50;
|
|
|
|
}
|
2006-06-17 20:29:41 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
GoAwayAndDie ();
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Health -------------------------------------------------------------------
|
|
|
|
|
|
|
|
class AHealthFillup : public ADummyStrifeItem
|
|
|
|
{
|
2008-08-08 19:47:18 +00:00
|
|
|
DECLARE_CLASS (AHealthFillup, ADummyStrifeItem)
|
2006-02-24 04:48:15 +00:00
|
|
|
public:
|
2008-09-13 22:08:41 +00:00
|
|
|
bool TryPickup (AActor *&toucher);
|
2006-02-24 04:48:15 +00:00
|
|
|
};
|
|
|
|
|
2008-08-08 19:47:18 +00:00
|
|
|
IMPLEMENT_CLASS (AHealthFillup)
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2008-09-13 22:08:41 +00:00
|
|
|
bool AHealthFillup::TryPickup (AActor *&toucher)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
static const int skillhealths[5] = { -100, -75, -50, -50, -100 };
|
|
|
|
|
2007-11-02 22:03:03 +00:00
|
|
|
int index = clamp<int>(gameskill, 0,4);
|
|
|
|
if (!P_GiveBody (toucher, skillhealths[index]))
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
GoAwayAndDie ();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Upgrade Stamina ----------------------------------------------------------
|
|
|
|
|
2008-08-08 19:47:18 +00:00
|
|
|
IMPLEMENT_CLASS (AUpgradeStamina)
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2008-09-13 22:08:41 +00:00
|
|
|
bool AUpgradeStamina::TryPickup (AActor *&toucher)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2006-06-12 20:54:39 +00:00
|
|
|
if (toucher->player == NULL)
|
2006-02-24 04:48:15 +00:00
|
|
|
return false;
|
2006-06-12 20:54:39 +00:00
|
|
|
|
|
|
|
toucher->player->stamina += Amount;
|
|
|
|
if (toucher->player->stamina >= MaxAmount)
|
|
|
|
toucher->player->stamina = MaxAmount;
|
|
|
|
|
|
|
|
P_GiveBody (toucher, -100);
|
2006-02-24 04:48:15 +00:00
|
|
|
GoAwayAndDie ();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Upgrade Accuracy ---------------------------------------------------------
|
|
|
|
|
2008-08-08 19:47:18 +00:00
|
|
|
IMPLEMENT_CLASS (AUpgradeAccuracy)
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2008-09-13 22:08:41 +00:00
|
|
|
bool AUpgradeAccuracy::TryPickup (AActor *&toucher)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
if (toucher->player == NULL || toucher->player->accuracy >= 100)
|
|
|
|
return false;
|
|
|
|
toucher->player->accuracy += 10;
|
|
|
|
GoAwayAndDie ();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Start a slideshow --------------------------------------------------------
|
|
|
|
|
2008-08-08 19:47:18 +00:00
|
|
|
IMPLEMENT_CLASS (ASlideshowStarter)
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2008-09-13 22:08:41 +00:00
|
|
|
bool ASlideshowStarter::TryPickup (AActor *&toucher)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
gameaction = ga_slideshow;
|
|
|
|
if (level.levelnum == 10)
|
|
|
|
{
|
|
|
|
toucher->GiveInventoryType (QuestItemClasses[16]);
|
|
|
|
}
|
|
|
|
GoAwayAndDie ();
|
|
|
|
return true;
|
|
|
|
}
|