mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-10 14:51:46 +00:00
- moved the three remaining variables from PClassInventory to PClassActor so that PClassInventory can be removed.
This commit is contained in:
parent
eebe09fb59
commit
c77f6636f8
20 changed files with 89 additions and 109 deletions
|
@ -699,7 +699,7 @@ public:
|
||||||
|
|
||||||
// Give an item to the actor and pick it up.
|
// Give an item to the actor and pick it up.
|
||||||
// Returns true if the item pickup succeeded.
|
// Returns true if the item pickup succeeded.
|
||||||
bool GiveInventory (PClassInventory *type, int amount, bool givecheat = false);
|
bool GiveInventory (PClassActor *type, int amount, bool givecheat = false);
|
||||||
|
|
||||||
// Removes the item from the inventory list.
|
// Removes the item from the inventory list.
|
||||||
virtual void RemoveInventory (AInventory *item);
|
virtual void RemoveInventory (AInventory *item);
|
||||||
|
@ -736,7 +736,7 @@ public:
|
||||||
AInventory *FirstInv ();
|
AInventory *FirstInv ();
|
||||||
|
|
||||||
// Tries to give the actor some ammo.
|
// Tries to give the actor some ammo.
|
||||||
bool GiveAmmo (PClassInventory *type, int amount);
|
bool GiveAmmo (PClassActor *type, int amount);
|
||||||
|
|
||||||
// Destroys all the inventory the actor is holding.
|
// Destroys all the inventory the actor is holding.
|
||||||
void DestroyAllInventory ();
|
void DestroyAllInventory ();
|
||||||
|
|
|
@ -1658,7 +1658,7 @@ static int PatchWeapon (int weapNum)
|
||||||
{
|
{
|
||||||
val = 5;
|
val = 5;
|
||||||
}
|
}
|
||||||
info->AmmoType1 = (PClassInventory*)AmmoNames[val];
|
info->AmmoType1 = AmmoNames[val];
|
||||||
if (info->AmmoType1 != NULL)
|
if (info->AmmoType1 != NULL)
|
||||||
{
|
{
|
||||||
info->AmmoGive1 = ((AInventory*)GetDefaultByType (info->AmmoType1))->Amount * 2;
|
info->AmmoGive1 = ((AInventory*)GetDefaultByType (info->AmmoType1))->Amount * 2;
|
||||||
|
|
|
@ -110,9 +110,9 @@ public:
|
||||||
void TweakSpeeds (double &forwardmove, double &sidemove);
|
void TweakSpeeds (double &forwardmove, double &sidemove);
|
||||||
void MorphPlayerThink ();
|
void MorphPlayerThink ();
|
||||||
void ActivateMorphWeapon ();
|
void ActivateMorphWeapon ();
|
||||||
AWeapon *PickNewWeapon (PClassInventory *ammotype);
|
AWeapon *PickNewWeapon (PClassActor *ammotype);
|
||||||
AWeapon *BestWeapon (PClassInventory *ammotype);
|
AWeapon *BestWeapon (PClassActor *ammotype);
|
||||||
void CheckWeaponSwitch(PClassInventory *ammotype);
|
void CheckWeaponSwitch(PClassActor *ammotype);
|
||||||
void GiveDeathmatchInventory ();
|
void GiveDeathmatchInventory ();
|
||||||
void FilterCoopRespawnInventory (APlayerPawn *oldplayer);
|
void FilterCoopRespawnInventory (APlayerPawn *oldplayer);
|
||||||
|
|
||||||
|
|
|
@ -93,7 +93,6 @@ enum
|
||||||
{
|
{
|
||||||
CLASSREG_PClass,
|
CLASSREG_PClass,
|
||||||
CLASSREG_PClassActor,
|
CLASSREG_PClassActor,
|
||||||
CLASSREG_PClassInventory,
|
|
||||||
CLASSREG_PClassPlayerPawn,
|
CLASSREG_PClassPlayerPawn,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -2955,7 +2955,6 @@ PClass *ClassReg::RegisterClass()
|
||||||
{
|
{
|
||||||
&PClass::RegistrationInfo,
|
&PClass::RegistrationInfo,
|
||||||
&PClassActor::RegistrationInfo,
|
&PClassActor::RegistrationInfo,
|
||||||
&PClassInventory::RegistrationInfo,
|
|
||||||
&PClassPlayerPawn::RegistrationInfo,
|
&PClassPlayerPawn::RegistrationInfo,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -155,12 +155,9 @@ struct PalEntry
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
class PClassInventory;
|
|
||||||
|
|
||||||
class FTextureID
|
class FTextureID
|
||||||
{
|
{
|
||||||
friend class FTextureManager;
|
friend class FTextureManager;
|
||||||
friend FTextureID GetHUDIcon(PClassInventory *cls);
|
|
||||||
friend void R_InitSpriteDefs();
|
friend void R_InitSpriteDefs();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -340,7 +340,7 @@ inline int T_FindFirstSectorFromTag(int tagnum)
|
||||||
// Doom index is only supported for the 4 original ammo types
|
// Doom index is only supported for the 4 original ammo types
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
static PClassInventory * T_GetAmmo(const svalue_t &t)
|
static PClassActor * T_GetAmmo(const svalue_t &t)
|
||||||
{
|
{
|
||||||
const char * p;
|
const char * p;
|
||||||
|
|
||||||
|
@ -361,8 +361,8 @@ static PClassInventory * T_GetAmmo(const svalue_t &t)
|
||||||
}
|
}
|
||||||
p=DefAmmo[ammonum];
|
p=DefAmmo[ammonum];
|
||||||
}
|
}
|
||||||
PClassInventory * am=dyn_cast<PClassInventory>(PClass::FindActor(p));
|
auto am = PClass::FindActor(p);
|
||||||
if (am == NULL)
|
if (am == NULL || !am->IsKindOf(PClass::FindClass(NAME_Ammo)))
|
||||||
{
|
{
|
||||||
script_error("unknown ammo type : %s", p);
|
script_error("unknown ammo type : %s", p);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -2434,8 +2434,8 @@ static void FS_GiveInventory (AActor *actor, const char * type, int amount)
|
||||||
{
|
{
|
||||||
type = "BasicArmorPickup";
|
type = "BasicArmorPickup";
|
||||||
}
|
}
|
||||||
PClassInventory * info = dyn_cast<PClassInventory>(PClass::FindActor (type));
|
auto info = PClass::FindActor (type);
|
||||||
if (info == NULL)
|
if (info == NULL || !info->IsKindOf(RUNTIME_CLASS(AInventory)))
|
||||||
{
|
{
|
||||||
Printf ("Unknown inventory item: %s\n", type);
|
Printf ("Unknown inventory item: %s\n", type);
|
||||||
return;
|
return;
|
||||||
|
@ -2564,7 +2564,7 @@ void FParser::SF_PlayerKeys(void)
|
||||||
void FParser::SF_PlayerAmmo(void)
|
void FParser::SF_PlayerAmmo(void)
|
||||||
{
|
{
|
||||||
int playernum, amount;
|
int playernum, amount;
|
||||||
PClassInventory * ammotype;
|
PClassActor * ammotype;
|
||||||
|
|
||||||
if (CheckArgs(2))
|
if (CheckArgs(2))
|
||||||
{
|
{
|
||||||
|
@ -2600,7 +2600,7 @@ void FParser::SF_PlayerAmmo(void)
|
||||||
void FParser::SF_MaxPlayerAmmo()
|
void FParser::SF_MaxPlayerAmmo()
|
||||||
{
|
{
|
||||||
int playernum, amount;
|
int playernum, amount;
|
||||||
PClassInventory * ammotype;
|
PClassActor * ammotype;
|
||||||
|
|
||||||
if (CheckArgs(2))
|
if (CheckArgs(2))
|
||||||
{
|
{
|
||||||
|
|
|
@ -25,50 +25,6 @@
|
||||||
|
|
||||||
EXTERN_CVAR(Bool, sv_unlimited_pickup)
|
EXTERN_CVAR(Bool, sv_unlimited_pickup)
|
||||||
|
|
||||||
IMPLEMENT_CLASS(PClassInventory, false, false)
|
|
||||||
|
|
||||||
PClassInventory::PClassInventory()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void PClassInventory::DeriveData(PClass *newclass)
|
|
||||||
{
|
|
||||||
assert(newclass->IsKindOf(RUNTIME_CLASS(PClassInventory)));
|
|
||||||
Super::DeriveData(newclass);
|
|
||||||
PClassInventory *newc = static_cast<PClassInventory *>(newclass);
|
|
||||||
|
|
||||||
newc->PickupMsg = PickupMsg;
|
|
||||||
newc->ForbiddenToPlayerClass = ForbiddenToPlayerClass;
|
|
||||||
newc->RestrictedToPlayerClass = RestrictedToPlayerClass;
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t PClassInventory::PointerSubstitution(DObject *oldclass, DObject *newclass)
|
|
||||||
{
|
|
||||||
size_t changed = Super::PointerSubstitution(oldclass, newclass);
|
|
||||||
AInventory *def = (AInventory*)Defaults;
|
|
||||||
if (def != NULL)
|
|
||||||
{
|
|
||||||
if (def->PickupFlash == oldclass) def->PickupFlash = static_cast<PClassActor *>(newclass);
|
|
||||||
for (unsigned i = 0; i < ForbiddenToPlayerClass.Size(); i++)
|
|
||||||
{
|
|
||||||
if (ForbiddenToPlayerClass[i] == oldclass)
|
|
||||||
{
|
|
||||||
ForbiddenToPlayerClass[i] = static_cast<PClassPlayerPawn*>(newclass);
|
|
||||||
changed++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (unsigned i = 0; i < RestrictedToPlayerClass.Size(); i++)
|
|
||||||
{
|
|
||||||
if (RestrictedToPlayerClass[i] == oldclass)
|
|
||||||
{
|
|
||||||
RestrictedToPlayerClass[i] = static_cast<PClassPlayerPawn*>(newclass);
|
|
||||||
changed++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return changed;
|
|
||||||
}
|
|
||||||
|
|
||||||
void AInventory::Finalize(FStateDefinitions &statedef)
|
void AInventory::Finalize(FStateDefinitions &statedef)
|
||||||
{
|
{
|
||||||
Super::Finalize(statedef);
|
Super::Finalize(statedef);
|
||||||
|
@ -95,7 +51,7 @@ DEFINE_FIELD(AInventory, SpawnPointClass)
|
||||||
DEFINE_FIELD(AInventory, PickupFlash)
|
DEFINE_FIELD(AInventory, PickupFlash)
|
||||||
DEFINE_FIELD(AInventory, PickupSound)
|
DEFINE_FIELD(AInventory, PickupSound)
|
||||||
DEFINE_FIELD(AInventory, GiveQuest)
|
DEFINE_FIELD(AInventory, GiveQuest)
|
||||||
DEFINE_FIELD(PClassInventory, PickupMsg)
|
DEFINE_FIELD(PClassActor, PickupMsg)
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
//
|
//
|
||||||
|
@ -545,7 +501,7 @@ DEFINE_ACTION_FUNCTION(AInventory, CanPickup)
|
||||||
if (!toucher)
|
if (!toucher)
|
||||||
ACTION_RETURN_BOOL(false);
|
ACTION_RETURN_BOOL(false);
|
||||||
|
|
||||||
PClassInventory *ai = self->GetClass();
|
auto ai = self->GetClass();
|
||||||
// Is the item restricted to certain player classes?
|
// Is the item restricted to certain player classes?
|
||||||
if (ai->RestrictedToPlayerClass.Size() != 0)
|
if (ai->RestrictedToPlayerClass.Size() != 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -50,23 +50,9 @@ enum
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class PClassInventory : public PClassActor
|
|
||||||
{
|
|
||||||
DECLARE_CLASS(PClassInventory, PClassActor)
|
|
||||||
public:
|
|
||||||
PClassInventory();
|
|
||||||
virtual void DeriveData(PClass *newclass);
|
|
||||||
virtual size_t PointerSubstitution(DObject *oldclass, DObject *newclass);
|
|
||||||
void Finalize(FStateDefinitions &statedef);
|
|
||||||
|
|
||||||
FString PickupMsg;
|
|
||||||
TArray<PClassPlayerPawn *> RestrictedToPlayerClass;
|
|
||||||
TArray<PClassPlayerPawn *> ForbiddenToPlayerClass;
|
|
||||||
};
|
|
||||||
|
|
||||||
class AInventory : public AActor
|
class AInventory : public AActor
|
||||||
{
|
{
|
||||||
DECLARE_CLASS_WITH_META(AInventory, AActor, PClassInventory)
|
DECLARE_CLASS(AInventory, AActor)
|
||||||
HAS_OBJECT_POINTERS
|
HAS_OBJECT_POINTERS
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
|
@ -92,7 +92,7 @@ class AWeapon : public AStateProvider
|
||||||
HAS_OBJECT_POINTERS
|
HAS_OBJECT_POINTERS
|
||||||
public:
|
public:
|
||||||
DWORD WeaponFlags;
|
DWORD WeaponFlags;
|
||||||
PClassInventory *AmmoType1, *AmmoType2; // Types of ammo used by this weapon
|
PClassActor *AmmoType1, *AmmoType2; // Types of ammo used by this weapon
|
||||||
int AmmoGive1, AmmoGive2; // Amount of each ammo to get when picking up weapon
|
int AmmoGive1, AmmoGive2; // Amount of each ammo to get when picking up weapon
|
||||||
int MinAmmo1, MinAmmo2; // Minimum ammo needed to switch to this weapon
|
int MinAmmo1, MinAmmo2; // Minimum ammo needed to switch to this weapon
|
||||||
int AmmoUse1, AmmoUse2; // How much ammo to use with each shot
|
int AmmoUse1, AmmoUse2; // How much ammo to use with each shot
|
||||||
|
|
28
src/info.cpp
28
src/info.cpp
|
@ -349,6 +349,11 @@ void PClassActor::DeriveData(PClass *newclass)
|
||||||
*newa->PainChances = *PainChances;
|
*newa->PainChances = *PainChances;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Inventory stuff
|
||||||
|
newa->PickupMsg = PickupMsg;
|
||||||
|
newa->ForbiddenToPlayerClass = ForbiddenToPlayerClass;
|
||||||
|
newa->RestrictedToPlayerClass = RestrictedToPlayerClass;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
@ -637,6 +642,29 @@ size_t PClassActor::PointerSubstitution(DObject *oldclass, DObject *newclass)
|
||||||
changed++;
|
changed++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (unsigned i = 0; i < ForbiddenToPlayerClass.Size(); i++)
|
||||||
|
{
|
||||||
|
if (ForbiddenToPlayerClass[i] == oldclass)
|
||||||
|
{
|
||||||
|
ForbiddenToPlayerClass[i] = static_cast<PClassPlayerPawn*>(newclass);
|
||||||
|
changed++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (unsigned i = 0; i < RestrictedToPlayerClass.Size(); i++)
|
||||||
|
{
|
||||||
|
if (RestrictedToPlayerClass[i] == oldclass)
|
||||||
|
{
|
||||||
|
RestrictedToPlayerClass[i] = static_cast<PClassPlayerPawn*>(newclass);
|
||||||
|
changed++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
AInventory *def = dyn_cast<AInventory>((AActor*)Defaults);
|
||||||
|
if (def != NULL)
|
||||||
|
{
|
||||||
|
if (def->PickupFlash == oldclass) def->PickupFlash = static_cast<PClassActor *>(newclass);
|
||||||
|
}
|
||||||
|
|
||||||
return changed;
|
return changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -317,6 +317,11 @@ public:
|
||||||
FName MissileName;
|
FName MissileName;
|
||||||
double MissileHeight;
|
double MissileHeight;
|
||||||
|
|
||||||
|
// These are only valid for inventory items.
|
||||||
|
FString PickupMsg;
|
||||||
|
TArray<PClassPlayerPawn *> RestrictedToPlayerClass;
|
||||||
|
TArray<PClassPlayerPawn *> ForbiddenToPlayerClass;
|
||||||
|
|
||||||
// For those times when being able to scan every kind of actor is convenient
|
// For those times when being able to scan every kind of actor is convenient
|
||||||
static TArray<PClassActor *> AllActorClasses;
|
static TArray<PClassActor *> AllActorClasses;
|
||||||
};
|
};
|
||||||
|
|
|
@ -1193,12 +1193,12 @@ static void GiveInventory (AActor *activator, const char *type, int amount)
|
||||||
for (int i = 0; i < MAXPLAYERS; ++i)
|
for (int i = 0; i < MAXPLAYERS; ++i)
|
||||||
{
|
{
|
||||||
if (playeringame[i])
|
if (playeringame[i])
|
||||||
players[i].mo->GiveInventory(static_cast<PClassInventory *>(info), amount);
|
players[i].mo->GiveInventory(info, amount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
activator->GiveInventory(static_cast<PClassInventory *>(info), amount);
|
activator->GiveInventory(info, amount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -369,7 +369,9 @@ static FStrifeDialogueNode *ReadRetailNode (FileReader *lump, DWORD &prevSpeaker
|
||||||
node->ItemCheck.Resize(3);
|
node->ItemCheck.Resize(3);
|
||||||
for (j = 0; j < 3; ++j)
|
for (j = 0; j < 3; ++j)
|
||||||
{
|
{
|
||||||
node->ItemCheck[j].Item = dyn_cast<PClassInventory>(GetStrifeType(speech.ItemCheck[j]));
|
auto inv = GetStrifeType(speech.ItemCheck[j]);
|
||||||
|
if (!inv->IsDescendantOf(RUNTIME_CLASS(AInventory))) inv = nullptr;
|
||||||
|
node->ItemCheck[j].Item = inv;
|
||||||
node->ItemCheck[j].Amount = -1;
|
node->ItemCheck[j].Amount = -1;
|
||||||
}
|
}
|
||||||
node->ItemCheckNode = speech.Link;
|
node->ItemCheckNode = speech.Link;
|
||||||
|
@ -513,7 +515,9 @@ static void ParseReplies (FStrifeDialogueReply **replyptr, Response *responses)
|
||||||
reply->ItemCheck.Resize(3);
|
reply->ItemCheck.Resize(3);
|
||||||
for (k = 0; k < 3; ++k)
|
for (k = 0; k < 3; ++k)
|
||||||
{
|
{
|
||||||
reply->ItemCheck[k].Item = dyn_cast<PClassInventory>(GetStrifeType(rsp->Item[k]));
|
auto inv = GetStrifeType(rsp->Item[k]);
|
||||||
|
if (!inv->IsDescendantOf(RUNTIME_CLASS(AInventory))) inv = nullptr;
|
||||||
|
reply->ItemCheck[k].Item = inv;
|
||||||
reply->ItemCheck[k].Amount = rsp->Count[k];
|
reply->ItemCheck[k].Amount = rsp->Count[k];
|
||||||
}
|
}
|
||||||
reply->ItemCheckRequire.Clear();
|
reply->ItemCheckRequire.Clear();
|
||||||
|
|
|
@ -12,7 +12,7 @@ struct FBrokenLines;
|
||||||
|
|
||||||
struct FStrifeDialogueItemCheck
|
struct FStrifeDialogueItemCheck
|
||||||
{
|
{
|
||||||
PClassInventory *Item;
|
PClassActor *Item;
|
||||||
int Amount;
|
int Amount;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -767,10 +767,12 @@ DEFINE_ACTION_FUNCTION(AActor, AddInventory)
|
||||||
//
|
//
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
bool AActor::GiveInventory(PClassInventory *type, int amount, bool givecheat)
|
bool AActor::GiveInventory(PClassActor *type, int amount, bool givecheat)
|
||||||
{
|
{
|
||||||
bool result = true;
|
bool result = true;
|
||||||
|
|
||||||
|
if (type != nullptr || !type->IsDescendantOf(RUNTIME_CLASS(AInventory))) return false;
|
||||||
|
|
||||||
AWeapon *savedPendingWeap = player != NULL ? player->PendingWeapon : NULL;
|
AWeapon *savedPendingWeap = player != NULL ? player->PendingWeapon : NULL;
|
||||||
bool hadweap = player != NULL ? player->ReadyWeapon != NULL : true;
|
bool hadweap = player != NULL ? player->ReadyWeapon != NULL : true;
|
||||||
|
|
||||||
|
@ -789,7 +791,7 @@ bool AActor::GiveInventory(PClassInventory *type, int amount, bool givecheat)
|
||||||
item->ClearCounters();
|
item->ClearCounters();
|
||||||
if (!givecheat || amount > 0)
|
if (!givecheat || amount > 0)
|
||||||
{
|
{
|
||||||
if (type->IsDescendantOf (NAME_BasicArmorPickup) || type->IsDescendantOf(NAME_BasicArmorBonus))
|
if (type->IsDescendantOf (PClass::FindActor(NAME_BasicArmorPickup)) || type->IsDescendantOf(PClass::FindActor(NAME_BasicArmorBonus)))
|
||||||
{
|
{
|
||||||
item->IntVar(NAME_SaveAmount) *= amount;
|
item->IntVar(NAME_SaveAmount) *= amount;
|
||||||
}
|
}
|
||||||
|
@ -1146,10 +1148,12 @@ DEFINE_ACTION_FUNCTION(AActor, GiveInventoryType)
|
||||||
//
|
//
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
bool AActor::GiveAmmo (PClassInventory *type, int amount)
|
bool AActor::GiveAmmo (PClassActor *type, int amount)
|
||||||
{
|
{
|
||||||
if (type != NULL)
|
if (type != NULL)
|
||||||
{
|
{
|
||||||
|
if (!type->IsDescendantOf(RUNTIME_CLASS(AInventory))) return false;
|
||||||
|
|
||||||
AInventory *item = static_cast<AInventory *>(Spawn (type));
|
AInventory *item = static_cast<AInventory *>(Spawn (type));
|
||||||
if (item)
|
if (item)
|
||||||
{
|
{
|
||||||
|
@ -1542,7 +1546,7 @@ bool AActor::IsVisibleToPlayer() const
|
||||||
bool visible = false;
|
bool visible = false;
|
||||||
for(unsigned int i = 0;i < GetClass()->VisibleToPlayerClass.Size();++i)
|
for(unsigned int i = 0;i < GetClass()->VisibleToPlayerClass.Size();++i)
|
||||||
{
|
{
|
||||||
PClassPlayerPawn *cls = GetClass()->VisibleToPlayerClass[i];
|
auto cls = GetClass()->VisibleToPlayerClass[i];
|
||||||
if (cls && pPlayer->mo->GetClass()->IsDescendantOf(cls))
|
if (cls && pPlayer->mo->GetClass()->IsDescendantOf(cls))
|
||||||
{
|
{
|
||||||
visible = true;
|
visible = true;
|
||||||
|
|
|
@ -57,21 +57,23 @@ class USDFParser : public UDMFParserBase
|
||||||
|
|
||||||
PClassActor *CheckActorType(const char *key)
|
PClassActor *CheckActorType(const char *key)
|
||||||
{
|
{
|
||||||
|
PClassActor *type = nullptr;
|
||||||
if (namespace_bits == St)
|
if (namespace_bits == St)
|
||||||
{
|
{
|
||||||
return GetStrifeType(CheckInt(key));
|
type = GetStrifeType(CheckInt(key));
|
||||||
}
|
}
|
||||||
else if (namespace_bits == Zd)
|
else if (namespace_bits == Zd)
|
||||||
{
|
{
|
||||||
PClassActor *cls = PClass::FindActor(CheckString(key));
|
PClassActor *cls = PClass::FindActor(CheckString(key));
|
||||||
if (cls == NULL)
|
if (cls == nullptr)
|
||||||
{
|
{
|
||||||
sc.ScriptMessage("Unknown actor class '%s'", key);
|
sc.ScriptMessage("Unknown actor class '%s'", key);
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
return cls;
|
type = cls;
|
||||||
}
|
}
|
||||||
return NULL;
|
if (type && type->IsDescendantOf(RUNTIME_CLASS(AInventory))) return type;
|
||||||
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
@ -92,7 +94,7 @@ class USDFParser : public UDMFParserBase
|
||||||
switch(key)
|
switch(key)
|
||||||
{
|
{
|
||||||
case NAME_Item:
|
case NAME_Item:
|
||||||
check.Item = dyn_cast<PClassInventory>(CheckActorType(key));
|
check.Item = CheckActorType(key);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NAME_Amount:
|
case NAME_Amount:
|
||||||
|
@ -266,7 +268,7 @@ class USDFParser : public UDMFParserBase
|
||||||
switch(key)
|
switch(key)
|
||||||
{
|
{
|
||||||
case NAME_Item:
|
case NAME_Item:
|
||||||
check.Item = dyn_cast<PClassInventory>(CheckActorType(key));
|
check.Item = CheckActorType(key);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NAME_Count:
|
case NAME_Count:
|
||||||
|
|
|
@ -931,7 +931,7 @@ bool APlayerPawn::UseInventory (AInventory *item)
|
||||||
//
|
//
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
||||||
AWeapon *APlayerPawn::BestWeapon(PClassInventory *ammotype)
|
AWeapon *APlayerPawn::BestWeapon(PClassActor *ammotype)
|
||||||
{
|
{
|
||||||
AWeapon *bestMatch = NULL;
|
AWeapon *bestMatch = NULL;
|
||||||
int bestOrder = INT_MAX;
|
int bestOrder = INT_MAX;
|
||||||
|
@ -993,7 +993,7 @@ AWeapon *APlayerPawn::BestWeapon(PClassInventory *ammotype)
|
||||||
//
|
//
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
||||||
AWeapon *APlayerPawn::PickNewWeapon(PClassInventory *ammotype)
|
AWeapon *APlayerPawn::PickNewWeapon(PClassActor *ammotype)
|
||||||
{
|
{
|
||||||
AWeapon *best = BestWeapon (ammotype);
|
AWeapon *best = BestWeapon (ammotype);
|
||||||
|
|
||||||
|
@ -1021,7 +1021,7 @@ AWeapon *APlayerPawn::PickNewWeapon(PClassInventory *ammotype)
|
||||||
//
|
//
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
||||||
void APlayerPawn::CheckWeaponSwitch(PClassInventory *ammotype)
|
void APlayerPawn::CheckWeaponSwitch(PClassActor *ammotype)
|
||||||
{
|
{
|
||||||
if (!player->userinfo.GetNeverSwitch() &&
|
if (!player->userinfo.GetNeverSwitch() &&
|
||||||
player->PendingWeapon == WP_NOCHANGE &&
|
player->PendingWeapon == WP_NOCHANGE &&
|
||||||
|
@ -1040,7 +1040,7 @@ void APlayerPawn::CheckWeaponSwitch(PClassInventory *ammotype)
|
||||||
DEFINE_ACTION_FUNCTION(APlayerPawn, CheckWeaponSwitch)
|
DEFINE_ACTION_FUNCTION(APlayerPawn, CheckWeaponSwitch)
|
||||||
{
|
{
|
||||||
PARAM_SELF_PROLOGUE(APlayerPawn);
|
PARAM_SELF_PROLOGUE(APlayerPawn);
|
||||||
PARAM_OBJECT(ammotype, PClassInventory);
|
PARAM_OBJECT(ammotype, PClassActor);
|
||||||
self->CheckWeaponSwitch(ammotype);
|
self->CheckWeaponSwitch(ammotype);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1346,7 +1346,7 @@ void APlayerPawn::GiveDefaultInventory ()
|
||||||
// HexenArmor must always be the first item in the inventory because
|
// HexenArmor must always be the first item in the inventory because
|
||||||
// it provides player class based protection that should not affect
|
// it provides player class based protection that should not affect
|
||||||
// any other protection item.
|
// any other protection item.
|
||||||
PClassPlayerPawn *myclass = GetClass();
|
auto myclass = GetClass();
|
||||||
GiveInventoryType(PClass::FindActor(NAME_HexenArmor));
|
GiveInventoryType(PClass::FindActor(NAME_HexenArmor));
|
||||||
auto harmor = FindInventory(NAME_HexenArmor);
|
auto harmor = FindInventory(NAME_HexenArmor);
|
||||||
|
|
||||||
|
|
|
@ -541,7 +541,7 @@ static void ParseInsideDecoration (Baggage &bag, AActor *defaults,
|
||||||
else if (def == DEF_Pickup && sc.Compare ("PickupMessage"))
|
else if (def == DEF_Pickup && sc.Compare ("PickupMessage"))
|
||||||
{
|
{
|
||||||
sc.MustGetString ();
|
sc.MustGetString ();
|
||||||
static_cast<PClassInventory *>(bag.Info)->PickupMsg = sc.String;
|
bag.Info->PickupMsg = sc.String;
|
||||||
}
|
}
|
||||||
else if (def == DEF_Pickup && sc.Compare ("Respawns"))
|
else if (def == DEF_Pickup && sc.Compare ("Respawns"))
|
||||||
{
|
{
|
||||||
|
|
|
@ -97,7 +97,7 @@ static PClassActor *FindClassTentative(const char *name, PClass *ancestor, bool
|
||||||
}
|
}
|
||||||
static AInventory::MetaClass *FindClassTentativeAmmo(const char *name, bool optional = false)
|
static AInventory::MetaClass *FindClassTentativeAmmo(const char *name, bool optional = false)
|
||||||
{
|
{
|
||||||
return static_cast<PClassInventory *>(FindClassTentative(name, PClass::FindActor(NAME_Ammo), optional));
|
return static_cast<AInventory::MetaClass *>(FindClassTentative(name, PClass::FindActor(NAME_Ammo), optional));
|
||||||
}
|
}
|
||||||
static AWeapon::MetaClass *FindClassTentativeWeapon(const char *name, bool optional = false)
|
static AWeapon::MetaClass *FindClassTentativeWeapon(const char *name, bool optional = false)
|
||||||
{
|
{
|
||||||
|
@ -1699,12 +1699,12 @@ DEFINE_PROPERTY(distancecheck, S, Actor)
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
DEFINE_CLASS_PROPERTY(restrictedto, Ssssssssssssssssssss, Inventory)
|
DEFINE_CLASS_PROPERTY(restrictedto, Ssssssssssssssssssss, Inventory)
|
||||||
{
|
{
|
||||||
static_cast<PClassInventory*>(info)->RestrictedToPlayerClass.Clear();
|
static_cast<PClassActor*>(info)->RestrictedToPlayerClass.Clear();
|
||||||
for(int i = 0;i < PROP_PARM_COUNT;++i)
|
for(int i = 0;i < PROP_PARM_COUNT;++i)
|
||||||
{
|
{
|
||||||
PROP_STRING_PARM(n, i);
|
PROP_STRING_PARM(n, i);
|
||||||
if (*n != 0)
|
if (*n != 0)
|
||||||
static_cast<PClassInventory*>(info)->RestrictedToPlayerClass.Push(FindClassTentativePlayerPawn(n));
|
static_cast<PClassActor*>(info)->RestrictedToPlayerClass.Push(FindClassTentativePlayerPawn(n));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1713,12 +1713,12 @@ DEFINE_CLASS_PROPERTY(restrictedto, Ssssssssssssssssssss, Inventory)
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
DEFINE_CLASS_PROPERTY(forbiddento, Ssssssssssssssssssss, Inventory)
|
DEFINE_CLASS_PROPERTY(forbiddento, Ssssssssssssssssssss, Inventory)
|
||||||
{
|
{
|
||||||
static_cast<PClassInventory*>(info)->ForbiddenToPlayerClass.Clear();
|
static_cast<PClassActor*>(info)->ForbiddenToPlayerClass.Clear();
|
||||||
for(int i = 0;i < PROP_PARM_COUNT;++i)
|
for(int i = 0;i < PROP_PARM_COUNT;++i)
|
||||||
{
|
{
|
||||||
PROP_STRING_PARM(n, i);
|
PROP_STRING_PARM(n, i);
|
||||||
if (*n != 0)
|
if (*n != 0)
|
||||||
static_cast<PClassInventory*>(info)->ForbiddenToPlayerClass.Push(FindClassTentativePlayerPawn(n));
|
static_cast<PClassActor*>(info)->ForbiddenToPlayerClass.Push(FindClassTentativePlayerPawn(n));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1817,8 +1817,8 @@ DEFINE_CLASS_PROPERTY(pickupflash, S, Inventory)
|
||||||
DEFINE_CLASS_PROPERTY(pickupmessage, T, Inventory)
|
DEFINE_CLASS_PROPERTY(pickupmessage, T, Inventory)
|
||||||
{
|
{
|
||||||
PROP_STRING_PARM(str, 0);
|
PROP_STRING_PARM(str, 0);
|
||||||
assert(info->IsKindOf(RUNTIME_CLASS(PClassInventory)));
|
assert(info->IsKindOf(RUNTIME_CLASS(PClassActor)));
|
||||||
static_cast<PClassInventory *>(info)->PickupMsg = str;
|
static_cast<PClassActor *>(info)->PickupMsg = str;
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
Loading…
Reference in a new issue