예제 #1
0
static void cheat_fa(const void *arg)
{
   int i;
   
   if(!E_PlayerHasBackpack(plyr))
      E_GiveBackpack(plyr);
   
   itemeffect_t *armor = E_ItemEffectForName(ITEMNAME_IDFAARMOR);
   if(armor)
   {
      plyr->armorpoints  = armor->getInt("saveamount",  0);
      plyr->armorfactor  = armor->getInt("savefactor",  1);
      plyr->armordivisor = armor->getInt("savedivisor", 3);
   }

   // WEAPON_FIXME: IDFA cheat
   
   // You can't own weapons that aren't in the game - phares 02/27/98
   for(i = 0; i < NUMWEAPONS; i++)
   {
      if(!(((i == wp_plasma || i == wp_bfg) && GameModeInfo->id == shareware) ||
         (i == wp_supershotgun && !enable_ssg)))
         plyr->weaponowned[i] = true;
   }

   // give full ammo
   E_GiveAllAmmo(plyr, GAA_MAXAMOUNT);

   doom_printf("%s", DEH_String("STSTR_FAADDED"));
}
예제 #2
0
static void cheat_keyxx(const void *arg)
{
   int key = *(const int *)arg;
   const char *msg = NULL;

   if(key >= GameModeInfo->numHUDKeys)
      return;

   itemeffect_t *fx;
   if(!(fx = E_ItemEffectForName(GameModeInfo->cardNames[key])))
      return;

   if(!E_GetItemOwnedAmount(plyr, fx))
   {
      E_GiveInventoryItem(plyr, fx);
      msg = "Key Added"; // Ty 03/27/98 - *not* externalized
   }
   else
   {
      E_RemoveInventoryItem(plyr, fx, -1);
      msg = "Key Removed";
   }

   doom_printf("%s", msg);
}
예제 #3
0
//
// EV_canUnlockGenDoor()
//
// Passed a generalized locked door linedef and a player, returns whether
// the player has the keys necessary to unlock that door.
//
// Note: The linedef passed MUST be a generalized locked door type
//       or results are undefined.
//
// jff 02/05/98 routine added to test for unlockability of
//  generalized locked doors
//
// killough 11/98: reformatted
//
// haleyjd 08/22/00: fixed bug found by fraggle
//
static bool EV_canUnlockGenDoor(line_t *line, player_t *player)
{
   int lockdefID = EV_lockdefIDForGenSpec(line->special);

   itemeffect_t *yskull = E_ItemEffectForName(ARTI_YELLOWSKULL);
   bool hasYellowSkull  = (E_GetItemOwnedAmount(player, yskull) > 0);

   // MBF compatibility hack - if lockdef ID is ALL3 and the player has the 
   // YellowSkull, we have to take it away; if he doesn't have it, we have to 
   // give it.
   if(demo_version == 203 && lockdefID == EV_LOCKDEF_ALL3)
   {
      if(hasYellowSkull)
         E_RemoveInventoryItem(player, yskull, -1);
      else
         E_GiveInventoryItem(player, yskull);
   }

   bool result = E_PlayerCanUnlock(player, lockdefID, false);

   // restore inventory state if lockdef was ALL3 and playing back an MBF demo
   if(demo_version == 203 && lockdefID == EV_LOCKDEF_ALL3)
   {
      if(hasYellowSkull)
         E_GiveInventoryItem(player, yskull);
      else
         E_RemoveInventoryItem(player, yskull, -1);
   }

   return result;
}
예제 #4
0
static void ST_updateWidgets()
{
   // update ready weapon ammo
   auto weapon   = plyr->readyweapon;
   auto ammoType = weapon->ammo;

   w_ready.num = ammoType ? E_GetItemOwnedAmount(plyr, ammoType) : 1994;
   w_ready.max = E_GetMaxAmountForArtifact(plyr, ammoType);

   // update armor
   w_armor.n.num = plyr->armorpoints;

   // update health
   w_health.n.num = plyr->health;

   // update ammo widgets
   for(int i = 0; i < NUMAMMO; i++)
   {
      ammoType = E_ItemEffectForName(st_AmmoForNum[i]);
      
      w_ammo[i].num    = E_GetItemOwnedAmount(plyr, ammoType);
      w_maxammo[i].num = E_GetMaxAmountForArtifact(plyr, ammoType);      
   }

   // update keycard multiple widgets
   for(int i = 0; i < 3; i++)
   {
      int amount  = E_GetItemOwnedAmountName(plyr, GameModeInfo->cardNames[i]);
      keyboxes[i] = (amount > 0 ? i : -1);
      
      //jff 2/24/98 select double key
      //killough 2/28/98: preserve traditional keys by config option
      
      amount = E_GetItemOwnedAmountName(plyr, GameModeInfo->cardNames[i + 3]);
      if(amount > 0)
         keyboxes[i] = ((keyboxes[i] == -1 || sts_traditional_keys) ? i + 3 : i + 6);
   }

   // used by the w_armsbg widget
   st_notdeathmatch = (GameType != gt_dm);

   // used by w_arms[] widgets
   st_armson = st_statusbaron && GameType != gt_dm;

   // used by w_frags widget
   st_fragson = st_statusbaron && GameType == gt_dm;

   st_fragscount = plyr->totalfrags;     // sf 15/10/99 use totalfrags
   w_frags.num   = st_fragscount;

   // used by w_invbarbg widget
   st_invbar = plyr->invbarstate.inventory;
}
예제 #5
0
static void cheat_ammox(const void *arg)
{
   const char *buf = (const char *)arg;
   int a = *buf - '1';

   if(*buf == 'b')
   {
      if(!E_PlayerHasBackpack(plyr))
      {
         doom_printf("Backpack Added");
         E_GiveBackpack(plyr);
      }
      else
      {
         doom_printf("Backpack Removed");
         E_RemoveBackpack(plyr);
      }
   }
   else if(a >= 0 && a < NUMAMMO)
   { 
      // haleyjd 10/24/09: altered behavior:
      // * Add ammo if ammo is not at maxammo.
      // * Remove ammo otherwise.
      auto item = E_ItemEffectForName(cheat_AmmoForNum[a]);
      if(!item)
         return;

      int amount    = E_GetItemOwnedAmount(plyr, item);
      int maxamount = E_GetMaxAmountForArtifact(plyr, item);

      if(amount != maxamount)
      {
         E_GiveInventoryItem(plyr, item, maxamount);
         doom_printf("Ammo Added");
      }
      else
      {
         E_RemoveInventoryItem(plyr, item, -1);
         doom_printf("Ammo Removed");
      }
   }
}