- fully scriptified HealthPickup.

This commit is contained in:
Christoph Oelckers 2017-01-15 18:46:40 +01:00
commit 03c7b10fd6
11 changed files with 12 additions and 100 deletions

View file

@ -59,7 +59,6 @@
#include "d_netinf.h"
#include "a_morph.h"
#include "virtual.h"
#include "a_health.h"
#include "g_levellocals.h"
static FRandom pr_obituary ("Obituary");
@ -840,11 +839,12 @@ void P_AutoUseHealth(player_t *player, int saveHealth)
TArray<AInventory *> NormalHealthItems;
TArray<AInventory *> LargeHealthItems;
auto hptype = PClass::FindActor(NAME_HealthPickup);
for(AInventory *inv = player->mo->Inventory; inv != NULL; inv = inv->Inventory)
{
if (inv->Amount > 0 && inv->IsKindOf(RUNTIME_CLASS(AHealthPickup)))
if (inv->Amount > 0 && inv->IsKindOf(hptype))
{
int mode = static_cast<AHealthPickup*>(inv)->autousemode;
int mode = inv->IntVar(NAME_autousemode);
if (mode == 1) NormalHealthItems.Push(inv);
else if (mode == 2) LargeHealthItems.Push(inv);
@ -884,12 +884,12 @@ void P_AutoUseStrifeHealth (player_t *player)
{
TArray<AInventory *> Items;
auto hptype = PClass::FindActor(NAME_HealthPickup);
for(AInventory *inv = player->mo->Inventory; inv != NULL; inv = inv->Inventory)
{
if (inv->Amount > 0 && inv->IsKindOf(RUNTIME_CLASS(AHealthPickup)))
if (inv->Amount > 0 && inv->IsKindOf(hptype))
{
int mode = static_cast<AHealthPickup*>(inv)->autousemode;
int mode = inv->IntVar(NAME_autousemode);
if (mode == 3) Items.Push(inv);
}
}