mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-11 07:12:02 +00:00
- fixed checks in Powerup.Type property to properly deal with the differences between DECORATE and ZScript.
- properly initialize Baggage everywhere it gets used. - fixed a few items with incorrect Powerup.Type settings that got flagged by the above changes.
This commit is contained in:
parent
208fe28042
commit
5e8c819a33
7 changed files with 21 additions and 11 deletions
|
@ -158,6 +158,7 @@ void ParseOldDecoration(FScanner &sc, EDefinitionType def)
|
|||
type = DecoDerivedClass(FScriptPosition(sc), parent, typeName);
|
||||
ResetBaggage(&bag, parent);
|
||||
bag.Info = type;
|
||||
bag.fromDecorate = true;
|
||||
#ifdef _DEBUG
|
||||
bag.ClassName = type->TypeName;
|
||||
#endif
|
||||
|
|
|
@ -1064,6 +1064,7 @@ static void ParseActor(FScanner &sc)
|
|||
PClassActor *info = NULL;
|
||||
Baggage bag;
|
||||
|
||||
bag.fromDecorate = true;
|
||||
info = ParseActorHeader(sc, &bag);
|
||||
sc.MustGetToken('{');
|
||||
while (sc.MustGetAnyToken(), sc.TokenType != '}')
|
||||
|
|
|
@ -117,7 +117,7 @@ struct Baggage
|
|||
PClassActor *Info;
|
||||
bool DropItemSet;
|
||||
bool StateSet;
|
||||
bool fromZScript;
|
||||
bool fromDecorate;
|
||||
int CurrentState;
|
||||
int Lumpnum;
|
||||
FStateDefinitions statedef;
|
||||
|
@ -132,6 +132,7 @@ inline void ResetBaggage (Baggage *bag, PClassActor *stateclass)
|
|||
bag->DropItemList = NULL;
|
||||
bag->DropItemSet = false;
|
||||
bag->CurrentState = 0;
|
||||
bag->fromDecorate = true;
|
||||
bag->StateSet = false;
|
||||
bag->statedef.MakeStateDefines(stateclass);
|
||||
}
|
||||
|
|
|
@ -2422,11 +2422,18 @@ DEFINE_CLASS_PROPERTY_PREFIX(powerup, type, S, PowerupGiver)
|
|||
// Yuck! What was I thinking when I decided to prepend "Power" to the name?
|
||||
// Now it's too late to change it...
|
||||
PClassActor *cls = PClass::FindActor(str);
|
||||
if (cls == NULL || (!cls->IsDescendantOf(RUNTIME_CLASS(APowerup)) && !bag.fromZScript))
|
||||
if (cls == nullptr || !cls->IsDescendantOf(RUNTIME_CLASS(APowerup)))
|
||||
{
|
||||
FString st;
|
||||
st.Format("%s%s", strnicmp(str, "power", 5)? "Power" : "", str);
|
||||
cls = FindClassTentativePowerup(st);
|
||||
if (bag.fromDecorate)
|
||||
{
|
||||
FString st;
|
||||
st.Format("%s%s", strnicmp(str, "power", 5) ? "Power" : "", str);
|
||||
cls = FindClassTentativePowerup(st);
|
||||
}
|
||||
else
|
||||
{
|
||||
I_Error("Unknown powerup type %s", str);
|
||||
}
|
||||
}
|
||||
|
||||
defaults->PowerupType = cls;
|
||||
|
|
|
@ -1897,7 +1897,7 @@ void ZCCCompiler::InitDefaults()
|
|||
bag.Info = ti;
|
||||
bag.DropItemSet = false;
|
||||
bag.StateSet = false;
|
||||
bag.fromZScript = true;
|
||||
bag.fromDecorate = false;
|
||||
bag.CurrentState = 0;
|
||||
bag.Lumpnum = c->cls->SourceLump;
|
||||
bag.DropItemList = nullptr;
|
||||
|
|
|
@ -55,7 +55,7 @@ Class ArtiTomeOfPower : PowerupGiver native
|
|||
+FLOATBOB
|
||||
Inventory.PickupFlash "PickupFlash";
|
||||
Inventory.Icon "ARTIPWBK";
|
||||
Powerup.Type "Weaponlevel2";
|
||||
Powerup.Type "PowerWeaponlevel2";
|
||||
Inventory.PickupMessage "$TXT_ARTITOMEOFPOWER";
|
||||
Tag "$TAG_ARTITOMEOFPOWER";
|
||||
}
|
||||
|
|
|
@ -198,7 +198,7 @@ class ShadowArmor : PowerupGiver
|
|||
RenderStyle "Translucent";
|
||||
Tag "$TAG_SHADOWARMOR";
|
||||
Inventory.MaxAmount 2;
|
||||
Powerup.Type "Shadow";
|
||||
Powerup.Type "PowerShadow";
|
||||
Inventory.Icon "I_SHD1";
|
||||
Inventory.PickupSound "misc/i_pkup";
|
||||
Inventory.PickupMessage "$TXT_SHADOWARMOR";
|
||||
|
@ -222,7 +222,7 @@ class EnvironmentalSuit : PowerupGiver
|
|||
+INVENTORY.INVBAR
|
||||
-INVENTORY.FANCYPICKUPSOUND
|
||||
Inventory.MaxAmount 5;
|
||||
Powerup.Type "Mask";
|
||||
Powerup.Type "PowerMask";
|
||||
Tag "$TAG_ENVSUIT";
|
||||
Inventory.Icon "I_MASK";
|
||||
Inventory.PickupSound "misc/i_pkup";
|
||||
|
@ -353,7 +353,7 @@ class Targeter : PowerupGiver
|
|||
+INVENTORY.INVBAR
|
||||
-INVENTORY.FANCYPICKUPSOUND
|
||||
Tag "$TAG_TARGETER";
|
||||
Powerup.Type "Targeter";
|
||||
Powerup.Type "PowerTargeter";
|
||||
Inventory.MaxAmount 5;
|
||||
Inventory.Icon "I_TARG";
|
||||
Inventory.PickupSound "misc/i_pkup";
|
||||
|
@ -478,7 +478,7 @@ class Scanner : PowerupGiver native
|
|||
Inventory.MaxAmount 1;
|
||||
Tag "$TAG_SCANNER";
|
||||
Inventory.Icon "I_PMUP";
|
||||
Powerup.Type "Scanner";
|
||||
Powerup.Type "PowerScanner";
|
||||
Inventory.PickupSound "misc/i_pkup";
|
||||
Inventory.PickupMessage "$TXT_SCANNER";
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue