From cc357e5178031846ffd44c37f9977f2b1004a827 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 4 Jun 2009 22:05:12 +0000 Subject: [PATCH] - re-fix of Gez's MAX_MANA patch SVN r1633 (trunk) --- src/d_iwad.cpp | 3 +++ src/g_hexen/hexen_sbar.cpp | 12 +++++++++--- src/thingdef/thingdef_properties.cpp | 2 +- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/d_iwad.cpp b/src/d_iwad.cpp index 1dcde8ccc..c20ce0618 100644 --- a/src/d_iwad.cpp +++ b/src/d_iwad.cpp @@ -50,6 +50,8 @@ CVAR (Bool, queryiwad, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG); CVAR (String, defaultiwad, "", CVAR_ARCHIVE|CVAR_GLOBALCONFIG); +EIWADType gameiwad; + // If autoname is NULL, that's either because that game doesn't allow // loading of external wads or because it's already caught by the // general game-specific wads section. @@ -633,6 +635,7 @@ static EIWADType IdentifyVersion (const char *zdoom_wad) const IWADInfo *D_FindIWAD(const char *basewad) { EIWADType iwadType = IdentifyVersion(basewad); + gameiwad = iwadType; const IWADInfo *iwad_info = &IWADInfos[iwadType]; I_SetIWADInfo(iwad_info); return iwad_info; diff --git a/src/g_hexen/hexen_sbar.cpp b/src/g_hexen/hexen_sbar.cpp index 2ec3d5e65..787b8f8d9 100644 --- a/src/g_hexen/hexen_sbar.cpp +++ b/src/g_hexen/hexen_sbar.cpp @@ -95,12 +95,18 @@ const BYTE *FManaBar::GetPixels () void FManaBar::SetVial (FTexture *pic, AActor *actor, const PClass *manaType) { - int level; + int level, max; AInventory *ammo; ammo = actor->FindInventory (manaType); - level = ammo != NULL ? ammo->Amount : 0; - level = MIN (22*level/ammo->MaxAmount, 22); + level = 0; max = 200; + if (ammo != NULL) + { + level = ammo->Amount; + max = ammo->MaxAmount; + if (!max) max = 1; + } + level = MIN (22*level/max, 22); if (VialPic != pic || VialLevel != level) { VialPic = pic; diff --git a/src/thingdef/thingdef_properties.cpp b/src/thingdef/thingdef_properties.cpp index 921ec099c..e2af1f05f 100644 --- a/src/thingdef/thingdef_properties.cpp +++ b/src/thingdef/thingdef_properties.cpp @@ -1581,7 +1581,7 @@ DEFINE_CLASS_PROPERTY_PREFIX(powerup, duration, I, Inventory) } else { - I_Error("\"powerup.color\" requires an actor of type \"Powerup\"\n"); + I_Error("\"powerup.duration\" requires an actor of type \"Powerup\"\n"); return; }