mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-11 07:12:16 +00:00
- fully scriptified HealthPickup.
This commit is contained in:
parent
156f9c488e
commit
03c7b10fd6
11 changed files with 12 additions and 100 deletions
|
@ -22,7 +22,6 @@
|
|||
#include "d_player.h"
|
||||
#include "vectors.h"
|
||||
#include "a_ammo.h"
|
||||
#include "a_health.h"
|
||||
|
||||
static FRandom pr_botmove ("BotMove");
|
||||
|
||||
|
|
|
@ -76,7 +76,6 @@
|
|||
#include "vmbuilder.h"
|
||||
#include "a_armor.h"
|
||||
#include "a_ammo.h"
|
||||
#include "a_health.h"
|
||||
|
||||
// [SO] Just the way Randy said to do it :)
|
||||
// [RH] Made this CVAR_SERVERINFO
|
||||
|
|
|
@ -51,7 +51,6 @@
|
|||
#include "doomerrors.h"
|
||||
#include "fragglescript/t_fs.h"
|
||||
#include "a_keys.h"
|
||||
#include "a_health.h"
|
||||
|
||||
// MACROS ------------------------------------------------------------------
|
||||
|
||||
|
|
|
@ -1,63 +0,0 @@
|
|||
/*
|
||||
** a_health.cpp
|
||||
** All health items
|
||||
**
|
||||
**---------------------------------------------------------------------------
|
||||
** Copyright 2000-2016 Randy Heit
|
||||
** Copyright 2006-2016 Cheistoph Oelckers
|
||||
** All rights reserved.
|
||||
**
|
||||
** Redistribution and use in source and binary forms, with or without
|
||||
** modification, are permitted provided that the following conditions
|
||||
** are met:
|
||||
**
|
||||
** 1. Redistributions of source code must retain the above copyright
|
||||
** notice, this list of conditions and the following disclaimer.
|
||||
** 2. Redistributions in binary form must reproduce the above copyright
|
||||
** notice, this list of conditions and the following disclaimer in the
|
||||
** documentation and/or other materials provided with the distribution.
|
||||
** 3. The name of the author may not be used to endorse or promote products
|
||||
** derived from this software without specific prior written permission.
|
||||
**
|
||||
** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
**---------------------------------------------------------------------------
|
||||
**
|
||||
*/
|
||||
|
||||
#include "d_player.h"
|
||||
#include "a_morph.h"
|
||||
#include "a_health.h"
|
||||
#include "serializer.h"
|
||||
#include "p_local.h"
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// Classes
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
IMPLEMENT_CLASS(AHealthPickup, false, false)
|
||||
DEFINE_FIELD(AHealthPickup, autousemode)
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// AHealthPickup :: Serialize
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
void AHealthPickup::Serialize(FSerializer &arc)
|
||||
{
|
||||
Super::Serialize(arc);
|
||||
auto def = (AHealthPickup*)GetDefault();
|
||||
arc("autousemode", autousemode, def->autousemode);
|
||||
}
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
#pragma once
|
||||
|
||||
#include "a_pickups.h"
|
||||
|
||||
// HealthPickup is some item that gives the player health when used.
|
||||
class AHealthPickup : public AInventory
|
||||
{
|
||||
DECLARE_CLASS (AHealthPickup, AInventory)
|
||||
public:
|
||||
int autousemode;
|
||||
|
||||
virtual void Serialize(FSerializer &arc) override;
|
||||
};
|
||||
|
|
@ -168,6 +168,8 @@ xx(Mauler)
|
|||
xx(BackpackItem)
|
||||
xx(PuzzleItem)
|
||||
xx(PuzzleItemNumber)
|
||||
xx(HealthPickup)
|
||||
xx(autousemode)
|
||||
|
||||
xx(AcolyteBlue)
|
||||
xx(SpectralLightningV1)
|
||||
|
|
|
@ -79,7 +79,6 @@
|
|||
#include "thingdef.h"
|
||||
#include "math/cmath.h"
|
||||
#include "a_armor.h"
|
||||
#include "a_health.h"
|
||||
#include "g_levellocals.h"
|
||||
|
||||
AActor *SingleActorFromTID(int tid, AActor *defactor);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -71,7 +71,6 @@
|
|||
#include "virtual.h"
|
||||
#include "a_armor.h"
|
||||
#include "a_ammo.h"
|
||||
#include "a_health.h"
|
||||
#include "g_levellocals.h"
|
||||
#include "a_morph.h"
|
||||
|
||||
|
|
|
@ -71,7 +71,6 @@
|
|||
#include "a_weaponpiece.h"
|
||||
#include "vmbuilder.h"
|
||||
#include "a_ammo.h"
|
||||
#include "a_health.h"
|
||||
#include "a_keys.h"
|
||||
#include "g_levellocals.h"
|
||||
|
||||
|
@ -1969,15 +1968,6 @@ DEFINE_CLASS_PROPERTY(givequest, I, Inventory)
|
|||
static_cast<PClassInventory *>(info)->GiveQuest = i;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
//==========================================================================
|
||||
DEFINE_CLASS_PROPERTY(autouse, I, HealthPickup)
|
||||
{
|
||||
PROP_INT_PARM(i, 0);
|
||||
defaults->autousemode = i;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
//==========================================================================
|
||||
|
|
|
@ -89,9 +89,11 @@ class Health : Inventory
|
|||
|
||||
}
|
||||
|
||||
class HealthPickup : Inventory native
|
||||
class HealthPickup : Inventory
|
||||
{
|
||||
native int autousemode;
|
||||
int autousemode;
|
||||
|
||||
property AutoUse: autousemode;
|
||||
|
||||
Default
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue