- 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:
Christoph Oelckers 2016-11-07 11:53:49 +01:00
parent 208fe28042
commit 5e8c819a33
7 changed files with 21 additions and 11 deletions

View file

@ -158,6 +158,7 @@ void ParseOldDecoration(FScanner &sc, EDefinitionType def)
type = DecoDerivedClass(FScriptPosition(sc), parent, typeName); type = DecoDerivedClass(FScriptPosition(sc), parent, typeName);
ResetBaggage(&bag, parent); ResetBaggage(&bag, parent);
bag.Info = type; bag.Info = type;
bag.fromDecorate = true;
#ifdef _DEBUG #ifdef _DEBUG
bag.ClassName = type->TypeName; bag.ClassName = type->TypeName;
#endif #endif

View file

@ -1064,6 +1064,7 @@ static void ParseActor(FScanner &sc)
PClassActor *info = NULL; PClassActor *info = NULL;
Baggage bag; Baggage bag;
bag.fromDecorate = true;
info = ParseActorHeader(sc, &bag); info = ParseActorHeader(sc, &bag);
sc.MustGetToken('{'); sc.MustGetToken('{');
while (sc.MustGetAnyToken(), sc.TokenType != '}') while (sc.MustGetAnyToken(), sc.TokenType != '}')

View file

@ -117,7 +117,7 @@ struct Baggage
PClassActor *Info; PClassActor *Info;
bool DropItemSet; bool DropItemSet;
bool StateSet; bool StateSet;
bool fromZScript; bool fromDecorate;
int CurrentState; int CurrentState;
int Lumpnum; int Lumpnum;
FStateDefinitions statedef; FStateDefinitions statedef;
@ -132,6 +132,7 @@ inline void ResetBaggage (Baggage *bag, PClassActor *stateclass)
bag->DropItemList = NULL; bag->DropItemList = NULL;
bag->DropItemSet = false; bag->DropItemSet = false;
bag->CurrentState = 0; bag->CurrentState = 0;
bag->fromDecorate = true;
bag->StateSet = false; bag->StateSet = false;
bag->statedef.MakeStateDefines(stateclass); bag->statedef.MakeStateDefines(stateclass);
} }

View file

@ -2422,12 +2422,19 @@ DEFINE_CLASS_PROPERTY_PREFIX(powerup, type, S, PowerupGiver)
// Yuck! What was I thinking when I decided to prepend "Power" to the name? // Yuck! What was I thinking when I decided to prepend "Power" to the name?
// Now it's too late to change it... // Now it's too late to change it...
PClassActor *cls = PClass::FindActor(str); PClassActor *cls = PClass::FindActor(str);
if (cls == NULL || (!cls->IsDescendantOf(RUNTIME_CLASS(APowerup)) && !bag.fromZScript)) if (cls == nullptr || !cls->IsDescendantOf(RUNTIME_CLASS(APowerup)))
{
if (bag.fromDecorate)
{ {
FString st; FString st;
st.Format("%s%s", strnicmp(str, "power", 5)? "Power" : "", str); st.Format("%s%s", strnicmp(str, "power", 5) ? "Power" : "", str);
cls = FindClassTentativePowerup(st); cls = FindClassTentativePowerup(st);
} }
else
{
I_Error("Unknown powerup type %s", str);
}
}
defaults->PowerupType = cls; defaults->PowerupType = cls;
} }

View file

@ -1897,7 +1897,7 @@ void ZCCCompiler::InitDefaults()
bag.Info = ti; bag.Info = ti;
bag.DropItemSet = false; bag.DropItemSet = false;
bag.StateSet = false; bag.StateSet = false;
bag.fromZScript = true; bag.fromDecorate = false;
bag.CurrentState = 0; bag.CurrentState = 0;
bag.Lumpnum = c->cls->SourceLump; bag.Lumpnum = c->cls->SourceLump;
bag.DropItemList = nullptr; bag.DropItemList = nullptr;

View file

@ -55,7 +55,7 @@ Class ArtiTomeOfPower : PowerupGiver native
+FLOATBOB +FLOATBOB
Inventory.PickupFlash "PickupFlash"; Inventory.PickupFlash "PickupFlash";
Inventory.Icon "ARTIPWBK"; Inventory.Icon "ARTIPWBK";
Powerup.Type "Weaponlevel2"; Powerup.Type "PowerWeaponlevel2";
Inventory.PickupMessage "$TXT_ARTITOMEOFPOWER"; Inventory.PickupMessage "$TXT_ARTITOMEOFPOWER";
Tag "$TAG_ARTITOMEOFPOWER"; Tag "$TAG_ARTITOMEOFPOWER";
} }

View file

@ -198,7 +198,7 @@ class ShadowArmor : PowerupGiver
RenderStyle "Translucent"; RenderStyle "Translucent";
Tag "$TAG_SHADOWARMOR"; Tag "$TAG_SHADOWARMOR";
Inventory.MaxAmount 2; Inventory.MaxAmount 2;
Powerup.Type "Shadow"; Powerup.Type "PowerShadow";
Inventory.Icon "I_SHD1"; Inventory.Icon "I_SHD1";
Inventory.PickupSound "misc/i_pkup"; Inventory.PickupSound "misc/i_pkup";
Inventory.PickupMessage "$TXT_SHADOWARMOR"; Inventory.PickupMessage "$TXT_SHADOWARMOR";
@ -222,7 +222,7 @@ class EnvironmentalSuit : PowerupGiver
+INVENTORY.INVBAR +INVENTORY.INVBAR
-INVENTORY.FANCYPICKUPSOUND -INVENTORY.FANCYPICKUPSOUND
Inventory.MaxAmount 5; Inventory.MaxAmount 5;
Powerup.Type "Mask"; Powerup.Type "PowerMask";
Tag "$TAG_ENVSUIT"; Tag "$TAG_ENVSUIT";
Inventory.Icon "I_MASK"; Inventory.Icon "I_MASK";
Inventory.PickupSound "misc/i_pkup"; Inventory.PickupSound "misc/i_pkup";
@ -353,7 +353,7 @@ class Targeter : PowerupGiver
+INVENTORY.INVBAR +INVENTORY.INVBAR
-INVENTORY.FANCYPICKUPSOUND -INVENTORY.FANCYPICKUPSOUND
Tag "$TAG_TARGETER"; Tag "$TAG_TARGETER";
Powerup.Type "Targeter"; Powerup.Type "PowerTargeter";
Inventory.MaxAmount 5; Inventory.MaxAmount 5;
Inventory.Icon "I_TARG"; Inventory.Icon "I_TARG";
Inventory.PickupSound "misc/i_pkup"; Inventory.PickupSound "misc/i_pkup";
@ -478,7 +478,7 @@ class Scanner : PowerupGiver native
Inventory.MaxAmount 1; Inventory.MaxAmount 1;
Tag "$TAG_SCANNER"; Tag "$TAG_SCANNER";
Inventory.Icon "I_PMUP"; Inventory.Icon "I_PMUP";
Powerup.Type "Scanner"; Powerup.Type "PowerScanner";
Inventory.PickupSound "misc/i_pkup"; Inventory.PickupSound "misc/i_pkup";
Inventory.PickupMessage "$TXT_SCANNER"; Inventory.PickupMessage "$TXT_SCANNER";
} }