Permalink
Browse files

Removed all native components from AInventory.

  • Loading branch information...
coelckers committed Dec 4, 2018
1 parent d66516e commit 5e4b3667242a1780bd4e7f78200521090ac5c75e
@@ -54,50 +54,6 @@
EXTERN_CVAR(Bool, sv_unlimited_pickup)
IMPLEMENT_CLASS(AInventory, false, true)
IMPLEMENT_POINTERS_START(AInventory)
IMPLEMENT_POINTER(Owner)
IMPLEMENT_POINTERS_END
DEFINE_FIELD_BIT(AInventory, ItemFlags, bPickupGood, IF_PICKUPGOOD)
DEFINE_FIELD_BIT(AInventory, ItemFlags, bCreateCopyMoved, IF_CREATECOPYMOVED)
DEFINE_FIELD_BIT(AInventory, ItemFlags, bInitEffectFailed, IF_INITEFFECTFAILED)
DEFINE_FIELD(AInventory, Owner)
DEFINE_FIELD(AInventory, Amount)
DEFINE_FIELD(AInventory, MaxAmount)
DEFINE_FIELD(AInventory, InterHubAmount)
DEFINE_FIELD(AInventory, RespawnTics)
DEFINE_FIELD(AInventory, Icon)
DEFINE_FIELD(AInventory, AltHUDIcon)
DEFINE_FIELD(AInventory, DropTime)
DEFINE_FIELD(AInventory, SpawnPointClass)
DEFINE_FIELD(AInventory, PickupFlash)
DEFINE_FIELD(AInventory, PickupSound)
//===========================================================================
//
// AInventory :: Serialize
//
//===========================================================================
void AInventory::Serialize(FSerializer &arc)
{
Super::Serialize (arc);
auto def = (AInventory*)GetDefault();
arc("owner", Owner)
("amount", Amount, def->Amount)
("maxamount", MaxAmount, def->MaxAmount)
("interhubamount", InterHubAmount, def->InterHubAmount)
("respawntics", RespawnTics, def->RespawnTics)
("itemflags", ItemFlags, def->ItemFlags)
("icon", Icon, def->Icon)
("althudicon", AltHUDIcon, def->AltHUDIcon)
("pickupsound", PickupSound, def->PickupSound)
("spawnpointclass", SpawnPointClass, def->SpawnPointClass)
("droptime", DropTime, def->DropTime);
}
//===========================================================================
//
@@ -26,69 +26,6 @@ struct visstyle_t
// A pickup is anything the player can pickup (i.e. weapons, ammo, powerups, etc)
enum ItemFlag
{
IF_ACTIVATABLE = 1<<0, // can be activated
IF_ACTIVATED = 1<<1, // is currently activated
IF_PICKUPGOOD = 1<<2, // HandlePickup wants normal pickup FX to happen
IF_QUIET = 1<<3, // Don't give feedback when picking up
IF_AUTOACTIVATE = 1<<4, // Automatically activate item on pickup
IF_UNDROPPABLE = 1<<5, // Item cannot be removed unless done explicitly with RemoveInventory
IF_INVBAR = 1<<6, // Item appears in the inventory bar
IF_HUBPOWER = 1<<7, // Powerup is kept when moving in a hub
IF_UNTOSSABLE = 1<<8, // The player cannot manually drop the item
IF_ADDITIVETIME = 1<<9, // when picked up while another item is active, time is added instead of replaced.
IF_ALWAYSPICKUP = 1<<10, // For IF_AUTOACTIVATE, MaxAmount=0 items: Always "pick up", even if it doesn't do anything
IF_FANCYPICKUPSOUND = 1<<11, // Play pickup sound in "surround" mode
IF_BIGPOWERUP = 1<<12, // Affected by RESPAWN_SUPER dmflag
IF_KEEPDEPLETED = 1<<13, // Items with this flag are retained even when they run out.
IF_IGNORESKILL = 1<<14, // Ignores any skill related multiplicators when giving this item.
IF_CREATECOPYMOVED = 1<<15, // CreateCopy changed the owner (copy's Owner field holds new owner).
IF_INITEFFECTFAILED = 1<<16, // CreateCopy tried to activate a powerup and activation failed (can happen with PowerMorph)
IF_NOATTENPICKUPSOUND = 1<<17, // Play pickup sound with ATTN_NONE
IF_PERSISTENTPOWER = 1<<18, // Powerup is kept when travelling between levels
IF_RESTRICTABSOLUTELY = 1<<19, // RestrictedTo and ForbiddenTo do not allow pickup in any form by other classes
IF_NEVERRESPAWN = 1<<20, // Never, ever respawns
IF_NOSCREENFLASH = 1<<21, // No pickup flash on the player's screen
IF_TOSSED = 1<<22, // Was spawned by P_DropItem (i.e. as a monster drop)
IF_ALWAYSRESPAWN = 1<<23, // Always respawn, regardless of dmflag
IF_TRANSFER = 1<<24, // All inventory items that the inventory item contains is also transfered to the pickuper
IF_NOTELEPORTFREEZE = 1<<25, // does not 'freeze' the player right after teleporting.
IF_NOSCREENBLINK = 1<<26, // Does not blink the screen overlay when expiring.
IF_ISHEALTH = 1<<27, // for the DM flag so that it can recognize items that are not obviously health givers.
IF_ISARMOR = 1<<28, // for the DM flag so that it can recognize items that are not obviously armor givers.
};
typedef TFlags<ItemFlag> InvFlags;
//typedef TFlags<ItemFlag2> ItemFlags2;
DEFINE_TFLAGS_OPERATORS(InvFlags)
//DEFINE_TFLAGS_OPERATORS(ItemFlags2)
class AInventory : public AActor
{
DECLARE_CLASS(AInventory, AActor)
HAS_OBJECT_POINTERS
public:
virtual void Serialize(FSerializer &arc) override;
//virtual void Tick() override;
TObjPtr<AActor*> Owner; // Who owns this item? NULL if it's still a pickup.
int Amount; // Amount of item this instance has
int MaxAmount; // Max amount of item this instance can have
int InterHubAmount; // Amount of item that can be kept between hubs or levels
int RespawnTics; // Tics from pickup time to respawn time
FTextureID Icon; // Icon to show on status bar or HUD
int DropTime; // Countdown after dropping
PClassActor *SpawnPointClass; // For respawning like Heretic's mace
FTextureID AltHUDIcon;
InvFlags ItemFlags;
PClassActor *PickupFlash; // actor to spawn as pickup flash
FSoundIDNoInit PickupSound;
};
bool CallTryPickup(AActor *item, AActor *toucher, AActor **toucher_return = nullptr);
void DepleteOrDestroy(AActor *item); // virtual on the script side.
@@ -219,20 +219,19 @@ FxExpression *ParseParameter(FScanner &sc, PClassActor *cls, PType *type);
enum
{
DEPF_UNUSED,
DEPF_FIREDAMAGE,
DEPF_ICEDAMAGE,
DEPF_LOWGRAVITY,
DEPF_LONGMELEERANGE,
DEPF_SHORTMISSILERANGE,
DEPF_PICKUPFLASH,
DEPF_QUARTERGRAVITY,
DEPF_FIRERESIST,
DEPF_HERETICBOUNCE,
DEPF_HEXENBOUNCE,
DEPF_DOOMBOUNCE,
DEPF_INTERHUBSTRIP,
DEPF_NOTRAIL,
DEPF_UNUSED = 0,
DEPF_FIREDAMAGE = 1,
DEPF_ICEDAMAGE = 2,
DEPF_LOWGRAVITY = 3,
DEPF_LONGMELEERANGE = 4,
DEPF_SHORTMISSILERANGE = 5,
DEPF_PICKUPFLASH = 6,
DEPF_QUARTERGRAVITY = 7,
DEPF_FIRERESIST = 8,
DEPF_HERETICBOUNCE = 9,
DEPF_HEXENBOUNCE = 10,
DEPF_DOOMBOUNCE = 11,
DEPF_INTERHUBSTRIP = 12,
};
// Types of old style decorations
@@ -412,33 +412,6 @@ static FFlagDef MoreFlagDefs[] =
static FFlagDef InventoryFlagDefs[] =
{
// Inventory flags
DEFINE_FLAG(IF, QUIET, AInventory, ItemFlags),
DEFINE_FLAG(IF, AUTOACTIVATE, AInventory, ItemFlags),
DEFINE_FLAG(IF, UNDROPPABLE, AInventory, ItemFlags),
DEFINE_FLAG(IF, INVBAR, AInventory, ItemFlags),
DEFINE_FLAG(IF, HUBPOWER, AInventory, ItemFlags),
DEFINE_FLAG(IF, UNTOSSABLE, AInventory, ItemFlags),
DEFINE_FLAG(IF, ADDITIVETIME, AInventory, ItemFlags),
DEFINE_FLAG(IF, ALWAYSPICKUP, AInventory, ItemFlags),
DEFINE_FLAG(IF, FANCYPICKUPSOUND, AInventory, ItemFlags),
DEFINE_FLAG(IF, BIGPOWERUP, AInventory, ItemFlags),
DEFINE_FLAG(IF, KEEPDEPLETED, AInventory, ItemFlags),
DEFINE_FLAG(IF, IGNORESKILL, AInventory, ItemFlags),
DEFINE_FLAG(IF, NOATTENPICKUPSOUND, AInventory, ItemFlags),
DEFINE_FLAG(IF, PERSISTENTPOWER, AInventory, ItemFlags),
DEFINE_FLAG(IF, RESTRICTABSOLUTELY, AInventory, ItemFlags),
DEFINE_FLAG(IF, NEVERRESPAWN, AInventory, ItemFlags),
DEFINE_FLAG(IF, NOSCREENFLASH, AInventory, ItemFlags),
DEFINE_FLAG(IF, TOSSED, AInventory, ItemFlags),
DEFINE_FLAG(IF, ALWAYSRESPAWN, AInventory, ItemFlags),
DEFINE_FLAG(IF, TRANSFER, AInventory, ItemFlags),
DEFINE_FLAG(IF, NOTELEPORTFREEZE, AInventory, ItemFlags),
DEFINE_FLAG(IF, NOSCREENBLINK, AInventory, ItemFlags),
DEFINE_FLAG(IF, ISARMOR, AInventory, ItemFlags),
DEFINE_FLAG(IF, ISHEALTH, AInventory, ItemFlags),
DEFINE_DUMMY_FLAG(FORCERESPAWNINSURVIVAL, false),
DEFINE_DEPRECATED_FLAG(PICKUPFLASH),
DEFINE_DEPRECATED_FLAG(INTERHUBSTRIP),
};
@@ -463,18 +436,11 @@ static FFlagDef DynLightFlagDefs[] =
DEFINE_FLAG(LF, SPOT, ADynamicLight, lightflags),
};
static FFlagDef PowerSpeedFlagDefs[] =
{
// PowerSpeed flags
DEFINE_DEPRECATED_FLAG(NOTRAIL),
};
static const struct FFlagList { const PClass * const *Type; FFlagDef *Defs; int NumDefs; int Use; } FlagLists[] =
{
{ &RUNTIME_CLASS_CASTLESS(AActor), ActorFlagDefs, countof(ActorFlagDefs), 3 }, // -1 to account for the terminator
{ &RUNTIME_CLASS_CASTLESS(AActor), MoreFlagDefs, countof(MoreFlagDefs), 1 },
{ &RUNTIME_CLASS_CASTLESS(AActor), InternalActorFlagDefs, countof(InternalActorFlagDefs), 2 },
{ &RUNTIME_CLASS_CASTLESS(AInventory), InventoryFlagDefs, countof(InventoryFlagDefs), 3 },
{ &RUNTIME_CLASS_CASTLESS(APlayerPawn), PlayerPawnFlagDefs, countof(PlayerPawnFlagDefs), 3 },
{ &RUNTIME_CLASS_CASTLESS(ADynamicLight),DynLightFlagDefs, countof(DynLightFlagDefs), 3 },
};
@@ -531,9 +497,9 @@ FFlagDef *FindFlag (const PClass *type, const char *part1, const char *part2, bo
{
forInternalFlags.fieldsize = 4;
forInternalFlags.name = "";
forInternalFlags.flagbit = field->Offset? 1 << field->bitval : DEPF_UNUSED;
forInternalFlags.flagbit = field->Offset? 1 << field->bitval : field->bitval;
forInternalFlags.structoffset = field->Offset? (int)field->Offset->Offset : -1;
forInternalFlags.varflags = 0;
forInternalFlags.varflags = field->Offset == nullptr && field->bitval > 0? VARF_Deprecated : 0;
return &forInternalFlags;
}
}
@@ -549,9 +515,9 @@ FFlagDef *FindFlag (const PClass *type, const char *part1, const char *part2, bo
{
forInternalFlags.fieldsize = 4;
forInternalFlags.name = "";
forInternalFlags.flagbit = field->Offset ? 1 << field->bitval : DEPF_UNUSED;
forInternalFlags.flagbit = field->Offset ? 1 << field->bitval : field->bitval;
forInternalFlags.structoffset = field->Offset ? (int)field->Offset->Offset : -1;
forInternalFlags.varflags = 0;
forInternalFlags.varflags = field->Offset == nullptr && field->bitval > 0? VARF_Deprecated : 0;
return &forInternalFlags;
}
}
@@ -595,11 +561,6 @@ FFlagDef *FindFlag (const PClass *type, const char *part1, const char *part2, bo
}
}
// Handle that lone PowerSpeed flag - this should be more generalized but it's just this one flag and unlikely to become more so an explicit check will do.
if ((!stricmp(part1, "NOTRAIL") && !strict) || (!stricmp(part1, "POWERSPEED") && !stricmp(part2, "NOTRAIL")))
{
return &PowerSpeedFlagDefs[0];
}
return NULL;
}
@@ -320,21 +320,6 @@ void HandleDeprecatedFlags(AActor *defaults, PClassActor *info, bool set, int in
case DEPF_INTERHUBSTRIP: // Old system was 0 or 1, so if the flag is cleared, assume 1.
defaults->IntVar(NAME_InterHubAmount) = set ? 0 : 1;
break;
case DEPF_NOTRAIL:
{
FString propname = "@property@powerspeed.notrail";
FName name(propname, true);
if (name != NAME_None)
{
auto propp = dyn_cast<PProperty>(info->FindSymbol(name, true));
if (propp != nullptr)
{
*((char*)defaults + propp->Variables[0]->Offset) = set ? 1 : 0;
}
}
break;
}
default:
break; // silence GCC
@@ -1089,7 +1074,7 @@ DEFINE_PROPERTY(distancecheck, S, Actor)
//==========================================================================
//
//==========================================================================
DEFINE_CLASS_PROPERTY(restrictedto, Ssssssssssssssssssss, Inventory)
DEFINE_SCRIPTED_PROPERTY(restrictedto, Ssssssssssssssssssss, Inventory)
{
auto restrictarray = (TArray<PClassActor*>*)defaults->ScriptVar(NAME_RestrictedToPlayerClass, nullptr);
@@ -1105,7 +1090,7 @@ DEFINE_CLASS_PROPERTY(restrictedto, Ssssssssssssssssssss, Inventory)
//==========================================================================
//
//==========================================================================
DEFINE_CLASS_PROPERTY(forbiddento, Ssssssssssssssssssss, Inventory)
DEFINE_SCRIPTED_PROPERTY(forbiddento, Ssssssssssssssssssss, Inventory)
{
auto forbidarray = (TArray<PClassActor*>*)defaults->ScriptVar(NAME_ForbiddenToPlayerClass, nullptr);
@@ -1147,7 +1132,7 @@ static void SetIcon(FTextureID &icon, Baggage &bag, const char *i)
//==========================================================================
//
//==========================================================================
DEFINE_CLASS_PROPERTY(icon, S, Inventory)
DEFINE_SCRIPTED_PROPERTY(icon, S, Inventory)
{
PROP_STRING_PARM(i, 0);
SetIcon(defaults->TextureIDVar(NAME_Icon), bag, i);
@@ -1156,7 +1141,7 @@ DEFINE_CLASS_PROPERTY(icon, S, Inventory)
//==========================================================================
//
//==========================================================================
DEFINE_CLASS_PROPERTY(althudicon, S, Inventory)
DEFINE_SCRIPTED_PROPERTY(althudicon, S, Inventory)
{
PROP_STRING_PARM(i, 0);
SetIcon(defaults->TextureIDVar(NAME_AltHUDIcon), bag, i);
@@ -1165,15 +1150,15 @@ DEFINE_CLASS_PROPERTY(althudicon, S, Inventory)
//==========================================================================
//
//==========================================================================
DEFINE_CLASS_PROPERTY(defmaxamount, 0, Inventory)
DEFINE_SCRIPTED_PROPERTY(defmaxamount, 0, Inventory)
{
defaults->IntVar(NAME_MaxAmount) = gameinfo.definventorymaxamount;
}
//==========================================================================
// Dummy for Skulltag compatibility...
//==========================================================================
DEFINE_CLASS_PROPERTY(pickupannouncerentry, S, Inventory)
DEFINE_SCRIPTED_PROPERTY(pickupannouncerentry, S, Inventory)
{
}
@@ -1216,7 +1201,7 @@ DEFINE_SCRIPTED_PROPERTY(preferredskin, S, Weapon)
//==========================================================================
//
//==========================================================================
DEFINE_CLASS_PROPERTY_PREFIX(powerup, color, C_f, Inventory)
DEFINE_SCRIPTED_PROPERTY_PREFIX(powerup, color, C_f, Inventory)
{
static const char *specialcolormapnames[] = {
"INVERSEMAP", "GOLDMAP", "REDMAP", "GREENMAP", "BLUEMAP", NULL };
@@ -1271,7 +1256,7 @@ DEFINE_CLASS_PROPERTY_PREFIX(powerup, color, C_f, Inventory)
//==========================================================================
//
//==========================================================================
DEFINE_CLASS_PROPERTY_PREFIX(powerup, colormap, FFFfff, Inventory)
DEFINE_SCRIPTED_PROPERTY_PREFIX(powerup, colormap, FFFfff, Inventory)
{
PalEntry BlendColor;
@@ -1308,7 +1293,7 @@ DEFINE_CLASS_PROPERTY_PREFIX(powerup, colormap, FFFfff, Inventory)
//==========================================================================
//
//==========================================================================
DEFINE_CLASS_PROPERTY_PREFIX(powerup, duration, I, Inventory)
DEFINE_SCRIPTED_PROPERTY_PREFIX(powerup, duration, I, Inventory)
{
if (!info->IsDescendantOf(NAME_Powerup) && !info->IsDescendantOf(NAME_PowerupGiver))
{
@@ -87,11 +87,11 @@ const char *GetVersionString();
#define SAVEGAME_EXT "zds"
// MINSAVEVER is the minimum level snapshot version that can be loaded.
#define MINSAVEVER 4553
#define MINSAVEVER 4554
// Use 4500 as the base git save version, since it's higher than the
// SVN revision ever got.
#define SAVEVER 4553
#define SAVEVER 4554
// This is so that derivates can use the same savegame versions without worrying about engine compatibility
#define GAMESIG "GZDOOM"
Oops, something went wrong.

0 comments on commit 5e4b366

Please sign in to comment.