From d04ffd57f827cf33202911811009056c95f3e535 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 7 Jun 2009 16:38:19 +0000 Subject: [PATCH] - added Gez's infinite ammo powerup and random spawner fix patches. - reduced size of Hexen's flames to fix bug in Deathkings MAP01. - added checks for sidedef scaling values SVN r1648 (trunk) --- docs/rh-log.txt | 3 ++ src/d_player.h | 5 +-- src/g_doom/a_bossbrain.cpp | 2 +- src/g_shared/a_artifacts.cpp | 36 +++++++++++++++++++ src/g_shared/a_randomspawner.cpp | 19 ++++++++-- src/g_shared/a_weapons.cpp | 4 +-- src/r_defs.h | 8 ++--- wadsrc/static/actors/hexen/flame.txt | 2 ++ wadsrc/static/actors/shared/inventory.txt | 42 +++++++---------------- 9 files changed, 81 insertions(+), 40 deletions(-) diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 98706cc64a..42bcef4253 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,4 +1,7 @@ June 7, 2009 (Changes by Graf Zahl) +- added Gez's infinite ammo powerup and random spawner fix patches. +- reduced size of Hexen's flames to fix bug in Deathkings MAP01. +- added checks for sidedef scaling values - Added Karate Chris's poison cloud fix. June 6, 2009 diff --git a/src/d_player.h b/src/d_player.h index 8a63c5789e..8cd6686584 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -179,11 +179,12 @@ typedef enum CF_TIMEFREEZE = 1 << 15, // Player has an active time freezer CF_DRAIN = 1 << 16, // Player owns a drain powerup CF_REGENERATION = 1 << 17, // Player owns a regeneration artifact - CF_HIGHJUMP = 1 << 18, // more Skulltag flags. Implemetation not guaranteed though. ;) + CF_HIGHJUMP = 1 << 18, // more Skulltag flags. Implementation not guaranteed though. ;) CF_REFLECTION = 1 << 19, CF_PROSPERITY = 1 << 20, - CF_DOUBLEFIRINGSPEED= 1 << 21, + CF_DOUBLEFIRINGSPEED= 1 << 21, // Player owns a double firing speed artifact CF_EXTREMELYDEAD = 1 << 22, // [RH] Reliably let the status bar know about extreme deaths. + CF_INFINITEAMMO = 1 << 23, // Player owns an infinite ammo artifact } cheat_t; #define WPIECE1 1 diff --git a/src/g_doom/a_bossbrain.cpp b/src/g_doom/a_bossbrain.cpp index 2c7e3e862c..61c0eb9fc3 100644 --- a/src/g_doom/a_bossbrain.cpp +++ b/src/g_doom/a_bossbrain.cpp @@ -184,7 +184,7 @@ static void SpawnFly(AActor *self, const PClass *spawntype, FSoundID sound) if (di->Name != NAME_None) { n -= di->amount; // logically, none of the -1 values have survived by now. - if (n > -1) di = di->Next; // If we get into the negatives, we've reached the end of the list. + if ((di->Next != NULL) && (n > -1)) di = di->Next; else n = -1; } } diff --git a/src/g_shared/a_artifacts.cpp b/src/g_shared/a_artifacts.cpp index 5140d54aae..72985da1cb 100644 --- a/src/g_shared/a_artifacts.cpp +++ b/src/g_shared/a_artifacts.cpp @@ -1836,3 +1836,39 @@ void APowerMorph::EndEffect( ) // Unmorph suceeded Player = NULL; } + +// Infinite Ammo Powerup ----------------------------------------------------- + +IMPLEMENT_CLASS(APowerInfiniteAmmo) + +//=========================================================================== +// +// APowerInfiniteAmmo :: InitEffect +// +//=========================================================================== + +void APowerInfiniteAmmo::InitEffect( ) +{ + if (Owner== NULL || Owner->player == NULL) + return; + + // Give the player infinite ammo + Owner->player->cheats |= CF_INFINITEAMMO; +} + +//=========================================================================== +// +// APowerInfiniteAmmo :: EndEffect +// +//=========================================================================== + +void APowerInfiniteAmmo::EndEffect( ) +{ + // Nothing to do if there's no owner. + if (Owner != NULL && Owner->player != NULL) + { + // Take away the limitless ammo + Owner->player->cheats &= ~CF_INFINITEAMMO; + } +} + diff --git a/src/g_shared/a_randomspawner.cpp b/src/g_shared/a_randomspawner.cpp index 579ccb30d2..88e0e79c5a 100644 --- a/src/g_shared/a_randomspawner.cpp +++ b/src/g_shared/a_randomspawner.cpp @@ -29,7 +29,6 @@ class ARandomSpawner : public AActor int n=0; Super::PostBeginPlay(); - drop = di = GetDropItems(); if (di != NULL) { @@ -52,7 +51,7 @@ class ARandomSpawner : public AActor if (di->Name != NAME_None) { n -= di->amount; - if (di->Next != NULL) di = di->Next; else n=0; + if ((di->Next != NULL) && (n > -1)) di = di->Next; else n = -1; } } // So now we can spawn the dropped item. @@ -81,6 +80,22 @@ class ARandomSpawner : public AActor newmobj->tracer = tracer; newmobj->CopyFriendliness(this, false); if (!(flags & MF_DROPPED)) newmobj->flags &= ~MF_DROPPED; + + // Handle special altitude flags + if (newmobj->flags & MF_SPAWNCEILING) + { + newmobj->z = newmobj->ceilingz - newmobj->height; + } + else if (newmobj->flags2 & MF2_SPAWNFLOAT) + { + fixed_t space = newmobj->ceilingz - newmobj->height - newmobj->floorz; + if (space > 48*FRACUNIT) + { + space -= 40*FRACUNIT; + newmobj->z = MulScale8 (space, pr_randomspawn()) + newmobj->floorz + 40*FRACUNIT; + } + } + // Special1 is used to count how many recursions we're in. if (newmobj->IsKindOf(PClass::FindClass("RandomSpawner"))) newmobj->special1 = ++special1; diff --git a/src/g_shared/a_weapons.cpp b/src/g_shared/a_weapons.cpp index af650a0f28..e606d8cb58 100644 --- a/src/g_shared/a_weapons.cpp +++ b/src/g_shared/a_weapons.cpp @@ -404,7 +404,7 @@ bool AWeapon::CheckAmmo (int fireMode, bool autoSwitch, bool requireAmmo) int count1, count2; int enough, enoughmask; - if (dmflags & DF_INFINITE_AMMO) + if ((dmflags & DF_INFINITE_AMMO) || (Owner->player->cheats & CF_INFINITEAMMO)) { return true; } @@ -462,7 +462,7 @@ bool AWeapon::CheckAmmo (int fireMode, bool autoSwitch, bool requireAmmo) bool AWeapon::DepleteAmmo (bool altFire, bool checkEnough) { - if (!(dmflags & DF_INFINITE_AMMO)) + if (!((dmflags & DF_INFINITE_AMMO) || (Owner->player->cheats & CF_INFINITEAMMO))) { if (checkEnough && !CheckAmmo (altFire ? AltFire : PrimaryFire, false)) { diff --git a/src/r_defs.h b/src/r_defs.h index cdf06ba862..c1387a428e 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -794,11 +794,11 @@ struct side_t void SetTextureXScale(int which, fixed_t scale) { - textures[which].xscale = scale; + textures[which].xscale = scale <= 0? FRACUNIT : scale; } void SetTextureXScale(fixed_t scale) { - textures[top].xscale = textures[mid].xscale = textures[bottom].xscale = scale; + textures[top].xscale = textures[mid].xscale = textures[bottom].xscale = scale <= 0? FRACUNIT : scale; } fixed_t GetTextureXScale(int which) const { @@ -807,11 +807,11 @@ struct side_t void SetTextureYScale(int which, fixed_t scale) { - textures[which].yscale = scale; + textures[which].yscale = scale <= 0? FRACUNIT : scale; } void SetTextureYScale(fixed_t scale) { - textures[top].yscale = textures[mid].yscale = textures[bottom].yscale = scale; + textures[top].yscale = textures[mid].yscale = textures[bottom].yscale = scale <= 0? FRACUNIT : scale; } fixed_t GetTextureYScale(int which) const { diff --git a/wadsrc/static/actors/hexen/flame.txt b/wadsrc/static/actors/hexen/flame.txt index 17d283df0b..c3a222ea63 100644 --- a/wadsrc/static/actors/hexen/flame.txt +++ b/wadsrc/static/actors/hexen/flame.txt @@ -58,6 +58,7 @@ ACTOR FlameSmall : SwitchableDecoration 10501 SpawnID 97 +NOTELEPORT +INVISIBLE + Radius 15 RenderStyle Add States { @@ -90,6 +91,7 @@ ACTOR FlameLarge : SwitchableDecoration 10503 SpawnID 99 +NOTELEPORT +INVISIBLE + Radius 15 RenderStyle Add States { diff --git a/wadsrc/static/actors/shared/inventory.txt b/wadsrc/static/actors/shared/inventory.txt index 02fc661102..03285eea50 100644 --- a/wadsrc/static/actors/shared/inventory.txt +++ b/wadsrc/static/actors/shared/inventory.txt @@ -109,17 +109,11 @@ ACTOR HexenArmor : Armor native +Inventory.UNDROPPABLE } -ACTOR DehackedPickup : Inventory native -{ -} +ACTOR DehackedPickup : Inventory native {} -ACTOR FakeInventory : Inventory native -{ -} +ACTOR FakeInventory : Inventory native {} -ACTOR CustomInventory : Inventory native -{ -} +ACTOR CustomInventory : Inventory native {} Actor Health : Inventory native { @@ -148,9 +142,7 @@ ACTOR PowerupGiver : Inventory native Inventory.PickupSound "misc/p_pkup" } -ACTOR Powerup : Inventory native -{ -} +ACTOR Powerup : Inventory native {} ACTOR PowerInvulnerable : Powerup native { @@ -170,9 +162,7 @@ ACTOR PowerInvisibility : Powerup native Powerup.Duration -60 } -ACTOR PowerGhost : PowerInvisibility native -{ -} +ACTOR PowerGhost : PowerInvisibility native {} ACTOR PowerShadow : PowerInvisibility native { @@ -199,9 +189,7 @@ ACTOR PowerLightAmp : Powerup native Powerup.Duration -120 } -ACTOR PowerTorch : PowerLightAmp native -{ -} +ACTOR PowerTorch : PowerLightAmp native {} ACTOR PowerFlight : Powerup native { @@ -290,23 +278,22 @@ ACTOR PowerRegeneration : Powerup native Powerup.Duration -120 } -ACTOR PowerHighJump : Powerup native -{ -} +ACTOR PowerHighJump : Powerup native {} -ACTOR PowerDoubleFiringSpeed : Powerup native -{ -} +ACTOR PowerDoubleFiringSpeed : Powerup native {} ACTOR PowerMorph : Powerup native { Powerup.Duration -40 } -ACTOR MapRevealer : Inventory native +ACTOR PowerInfiniteAmmo : Powerup native { + Powerup.Duration -30 } +ACTOR MapRevealer : Inventory native {} + ACTOR PuzzleItem : Inventory native { +NOGRAVITY @@ -342,7 +329,4 @@ Actor WeaponHolder : Inventory native +INVENTORY.UNDROPPABLE } -Actor WeaponPiece : Inventory native -{ -} - +Actor WeaponPiece : Inventory native {}