From 356e4a0fcc408ccbd3b4ab4d853c1ecc73a6e791 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 2 Aug 2009 15:54:34 +0000 Subject: [PATCH] - Added A_Mushroom compatibility option for Dehacked. - Added Gez's submission for interhubamount DECORATE property. SVN r1747 (trunk) --- docs/rh-log.txt | 2 ++ src/compatibility.cpp | 1 + src/d_main.cpp | 3 ++- src/doomdef.h | 1 + src/g_doom/a_fatso.cpp | 2 +- src/g_game.cpp | 11 +++++------ src/g_mapinfo.cpp | 1 + src/g_shared/a_pickups.h | 3 ++- src/m_options.cpp | 1 + src/thingdef/thingdef.h | 1 + src/thingdef/thingdef_data.cpp | 2 +- src/thingdef/thingdef_properties.cpp | 11 +++++++++++ wadsrc/static/actors/shared/inventory.txt | 1 + 13 files changed, 30 insertions(+), 10 deletions(-) diff --git a/docs/rh-log.txt b/docs/rh-log.txt index f44355a38b..a0c38f5c02 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,4 +1,6 @@ August 2, 2009 (Changes by Graf Zahl) +- Added A_Mushroom compatibility option for Dehacked. +- Added Gez's submission for interhubamount DECORATE property. - Fixed: The big endian version of PalEntry did not add the DWORD d field. - Fixed: TObjPtr did not use a union to map its 2 pointers together. - Added a compatibility mode for A_Mushroom. For DECORATE it is an additional diff --git a/src/compatibility.cpp b/src/compatibility.cpp index ba817aaa60..8d9726d489 100644 --- a/src/compatibility.cpp +++ b/src/compatibility.cpp @@ -100,6 +100,7 @@ static FCompatOption Options[] = { "crossdropoff", COMPATF_CROSSDROPOFF, 0 }, { "wallrun", COMPATF_WALLRUN, 0 }, // [GZ] Added for CC MAP29 { "anybossdeath", COMPATF_ANYBOSSDEATH, 0}, // [GZ] Added for UAC_DEAD + { "mushroom", COMPATF_MUSHROOM, 0}, { NULL, 0, 0 } }; diff --git a/src/d_main.cpp b/src/d_main.cpp index e4d6fb9a29..83141b0e06 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -466,7 +466,7 @@ CUSTOM_CVAR(Int, compatmode, 0, CVAR_ARCHIVE|CVAR_NOINITCALL) break; case 3: - v = COMPATF_TRACE|COMPATF_SOUNDTARGET|COMPATF_BOOMSCROLL; + v = COMPATF_TRACE|COMPATF_SOUNDTARGET|COMPATF_BOOMSCROLL|COMPATF_MUSHROOM; break; case 4: @@ -499,6 +499,7 @@ CVAR (Flag, compat_missileclip, compatflags, COMPATF_MISSILECLIP); CVAR (Flag, compat_crossdropoff,compatflags, COMPATF_CROSSDROPOFF); CVAR (Flag, compat_anybossdeath,compatflags, COMPATF_ANYBOSSDEATH); CVAR (Flag, compat_minotaur, compatflags, COMPATF_MINOTAUR); +CVAR (Flag, compat_mushroom, compatflags, COMPATF_MUSHROOM); //========================================================================== // diff --git a/src/doomdef.h b/src/doomdef.h index 03a4fffd62..44cfb7a2a8 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -317,6 +317,7 @@ enum COMPATF_CROSSDROPOFF = 1 << 20, // monsters can't be pushed over dropoffs COMPATF_ANYBOSSDEATH = 1 << 21, // [GZ] Any monster which calls BOSSDEATH counts for level specials COMPATF_MINOTAUR = 1 << 22, // Minotaur's floor flame is exploded immediately when feet are clipped + COMPATF_MUSHROOM = 1 << 23, // Force original velocity calculations for A_Mushroom in Dehacked oods. }; // Emulate old bugs for select maps. These are not exposed by a cvar diff --git a/src/g_doom/a_fatso.cpp b/src/g_doom/a_fatso.cpp index 66cd47aac0..feb476377b 100644 --- a/src/g_doom/a_fatso.cpp +++ b/src/g_doom/a_fatso.cpp @@ -149,7 +149,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Mushroom) target->x = self->x + (i << FRACBITS); // Aim in many directions from source target->y = self->y + (j << FRACBITS); target->z = self->z + (P_AproxDistance(i,j) << (FRACBITS+2)); // Aim up fairly high - if (flags == 0 && self->state->Misc1 == 0) + if (flags == 0 && (self->state->Misc1 == 0 || !(i_compatflags & COMPATF_MUSHROOM))) { mo = P_SpawnMissile (self, target, spawntype); // Launch fireball } diff --git a/src/g_game.cpp b/src/g_game.cpp index 5de961ae18..47a93df71e 100644 --- a/src/g_game.cpp +++ b/src/g_game.cpp @@ -1181,7 +1181,7 @@ void G_PlayerFinishLevel (int player, EFinishLevelType mode, bool resetinventory while (item != NULL) { next = item->Inventory; - if (item->ItemFlags & IF_INTERHUBSTRIP) + if (item->InterHubAmount < 1) { item->Destroy (); } @@ -1190,14 +1190,13 @@ void G_PlayerFinishLevel (int player, EFinishLevelType mode, bool resetinventory } if (mode == FINISH_NoHub && !(level.flags2 & LEVEL2_KEEPFULLINVENTORY)) - { // Reduce all owned (visible) inventory to 1 item each + { // Reduce all owned (visible) inventory to defined maximum interhub amount for (item = p->mo->Inventory; item != NULL; item = item->Inventory) { - // There may be depletable items with an amount of 0. - // Those need to stay at 0; the rest get dropped to 1. - if (item->ItemFlags & IF_INVBAR && item->Amount > 1) + // If the player is carrying more samples of an item than allowed, reduce amount accordingly + if (item->ItemFlags & IF_INVBAR && item->Amount > item->InterHubAmount) { - item->Amount = 1; + item->Amount = item->InterHubAmount; } } } diff --git a/src/g_mapinfo.cpp b/src/g_mapinfo.cpp index bb68e7d726..bd61d02ae0 100644 --- a/src/g_mapinfo.cpp +++ b/src/g_mapinfo.cpp @@ -1340,6 +1340,7 @@ MapFlagHandlers[] = { "compat_crossdropoff", MITYPE_COMPATFLAG, COMPATF_CROSSDROPOFF}, { "compat_anybossdeath", MITYPE_COMPATFLAG, COMPATF_ANYBOSSDEATH}, { "compat_minotaur", MITYPE_COMPATFLAG, COMPATF_MINOTAUR}, + { "compat_mushroom", MITYPE_COMPATFLAG, COMPATF_MUSHROOM}, { "cd_start_track", MITYPE_EATNEXT, 0, 0 }, { "cd_end1_track", MITYPE_EATNEXT, 0, 0 }, { "cd_end2_track", MITYPE_EATNEXT, 0, 0 }, diff --git a/src/g_shared/a_pickups.h b/src/g_shared/a_pickups.h index 78bb7ca594..f1a38afbbd 100644 --- a/src/g_shared/a_pickups.h +++ b/src/g_shared/a_pickups.h @@ -119,7 +119,7 @@ enum IF_UNDROPPABLE = 1<<5, // The player cannot manually drop the item IF_INVBAR = 1<<6, // Item appears in the inventory bar IF_HUBPOWER = 1<<7, // Powerup is kept when moving in a hub - IF_INTERHUBSTRIP = 1<<8, // Item is removed when travelling between hubs +// IF_INTERHUBSTRIP = 1<<8, // Item is removed when travelling between hubs 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 @@ -165,6 +165,7 @@ public: TObjPtr 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 diff --git a/src/m_options.cpp b/src/m_options.cpp index 543c10599e..0241074c8a 100644 --- a/src/m_options.cpp +++ b/src/m_options.cpp @@ -1104,6 +1104,7 @@ static menuitem_t CompatibilityItems[] = { { bitflag, "Use Doom heights for missile clipping", {&compatflags}, {0}, {0}, {0}, {(value_t *)COMPATF_MISSILECLIP} }, { bitflag, "Allow any bossdeath for level special", {&compatflags}, {0}, {0}, {0}, {(value_t *)COMPATF_ANYBOSSDEATH} }, { bitflag, "No Minotaur floor flames in water", {&compatflags}, {0}, {0}, {0}, {(value_t *)COMPATF_MINOTAUR} }, + { bitflag, "Original A_Mushroom speed in DEH mods", {&compatflags}, {0}, {0}, {0}, {(value_t *)COMPATF_MUSHROOM} }, { discrete, "Interpolate monster movement", {&nomonsterinterpolation}, {2.0}, {0.0}, {0.0}, {NoYes} }, }; diff --git a/src/thingdef/thingdef.h b/src/thingdef/thingdef.h index 1d95bc92d0..95ce022225 100644 --- a/src/thingdef/thingdef.h +++ b/src/thingdef/thingdef.h @@ -210,6 +210,7 @@ enum DEPF_HERETICBOUNCE, DEPF_HEXENBOUNCE, DEPF_DOOMBOUNCE, + DEPF_INTERHUBSTRIP, }; enum diff --git a/src/thingdef/thingdef_data.cpp b/src/thingdef/thingdef_data.cpp index a6f81923bd..7e3d25780e 100644 --- a/src/thingdef/thingdef_data.cpp +++ b/src/thingdef/thingdef_data.cpp @@ -253,7 +253,6 @@ static FFlagDef InventoryFlags[] = DEFINE_FLAG(IF, UNDROPPABLE, AInventory, ItemFlags), DEFINE_FLAG(IF, INVBAR, AInventory, ItemFlags), DEFINE_FLAG(IF, HUBPOWER, AInventory, ItemFlags), - DEFINE_FLAG(IF, INTERHUBSTRIP, AInventory, ItemFlags), DEFINE_FLAG(IF, ALWAYSPICKUP, AInventory, ItemFlags), DEFINE_FLAG(IF, FANCYPICKUPSOUND, AInventory, ItemFlags), DEFINE_FLAG(IF, BIGPOWERUP, AInventory, ItemFlags), @@ -264,6 +263,7 @@ static FFlagDef InventoryFlags[] = DEFINE_FLAG(IF, PERSISTENTPOWER, AInventory, ItemFlags), DEFINE_DEPRECATED_FLAG(PICKUPFLASH), + DEFINE_DEPRECATED_FLAG(INTERHUBSTRIP), }; static FFlagDef WeaponFlags[] = diff --git a/src/thingdef/thingdef_properties.cpp b/src/thingdef/thingdef_properties.cpp index a271e3890e..5c73bb5197 100644 --- a/src/thingdef/thingdef_properties.cpp +++ b/src/thingdef/thingdef_properties.cpp @@ -148,6 +148,8 @@ void HandleDeprecatedFlags(AActor *defaults, FActorInfo *info, bool set, int ind static_cast(defaults)->PickupFlash = NULL; } break; + case DEPF_INTERHUBSTRIP: // Old system was 0 or 1, so if the flag is cleared, assume 1. + static_cast(defaults)->InterHubAmount = set ? 0 : 1; default: break; // silence GCC } @@ -1220,6 +1222,15 @@ DEFINE_CLASS_PROPERTY(icon, S, Inventory) } } +//========================================================================== +// +//========================================================================== +DEFINE_CLASS_PROPERTY(interhubamount, I, Inventory) +{ + PROP_INT_PARM(i, 0); + defaults->InterHubAmount = i; +} + //========================================================================== // //========================================================================== diff --git a/wadsrc/static/actors/shared/inventory.txt b/wadsrc/static/actors/shared/inventory.txt index 8850932abc..acda21f8f5 100644 --- a/wadsrc/static/actors/shared/inventory.txt +++ b/wadsrc/static/actors/shared/inventory.txt @@ -2,6 +2,7 @@ ACTOR Inventory native { Inventory.Amount 1 Inventory.MaxAmount 1 + Inventory.InterHubAmount 1 Inventory.UseSound "misc/invuse" Inventory.PickupSound "misc/i_pkup"