From bf0ee1342ce2d6342afcd5d8566ae7628083ab41 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 3 Aug 2008 12:00:36 +0000 Subject: [PATCH] - Cleaned up the new bridge code and exported all related actors to DECORATE so that the exported code pointers can be used. - Separated Heretic's and Hexen's invulnerability items for stability reasons. SVN r1105 (trunk) --- docs/rh-log.txt | 6 + src/g_shared/a_bridge.cpp | 162 ++---------------- src/g_shared/a_specialspot.h | 2 +- wadsrc/static/actors/raven/ravenartifacts.txt | 28 ++- wadsrc/static/actors/shared/bridge.txt | 109 ++++++++++++ wadsrc/static/decorate.txt | 1 + 6 files changed, 158 insertions(+), 150 deletions(-) create mode 100644 wadsrc/static/actors/shared/bridge.txt diff --git a/docs/rh-log.txt b/docs/rh-log.txt index c4bc33aa8..326535438 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,3 +1,9 @@ +August 3, 2008 (Changes by Graf Zahl) +- Cleaned up the new bridge code and exported all related actors to + DECORATE so that the exported code pointers can be used. +- Separated Heretic's and Hexen's invulnerability items for stability + reasons. + August 2, 2008 - Fixed spurious warnings on 32-bit VC++ debug builds. - Made the subsong (order) number a proper parameter to MusInfo::Play() diff --git a/src/g_shared/a_bridge.cpp b/src/g_shared/a_bridge.cpp index 02cb010e7..cad4262ba 100644 --- a/src/g_shared/a_bridge.cpp +++ b/src/g_shared/a_bridge.cpp @@ -6,81 +6,6 @@ static FRandom pr_orbit ("Orbit"); -void A_BridgeOrbit (AActor *); -void A_BridgeInit (AActor *); - -// The Hexen (and Heretic) version of the bridge spawns extra floating -// "balls" orbiting the bridge. The Doom version only shows the bridge -// itself. - -// Bridge ball ------------------------------------------------------------- - -class ABridgeBall : public AActor -{ - DECLARE_ACTOR (ABridgeBall, AActor) -}; - -FState ABridgeBall::States[] = -{ - S_NORMAL (TLGL, 'A', 2, NULL , &States[1]), - S_NORMAL (TLGL, 'A', 1, A_BridgeOrbit , &States[1]) -}; - -IMPLEMENT_ACTOR (ABridgeBall, Any, -1, 0) - PROP_Flags (MF_NOBLOCKMAP|MF_NOGRAVITY) - PROP_Flags2 (MF2_NOTELEPORT) - PROP_SpawnState (0) -END_DEFAULTS - -// The bridge itself ------------------------------------------------------- - -class ABridge : public AActor -{ - DECLARE_ACTOR (ABridge, AActor) -}; - -FState ABridge::States[] = -{ -#define S_DBRIDGE 0 - S_BRIGHT (TLGL, 'A', 4, NULL , &States[S_DBRIDGE+1]), - S_BRIGHT (TLGL, 'B', 4, NULL , &States[S_DBRIDGE+2]), - S_BRIGHT (TLGL, 'C', 4, NULL , &States[S_DBRIDGE+3]), - S_BRIGHT (TLGL, 'D', 4, NULL , &States[S_DBRIDGE+4]), - S_BRIGHT (TLGL, 'E', 4, NULL , &States[S_DBRIDGE+0]), - -#define S_BRIDGE (S_DBRIDGE+5) - S_NORMAL (TLGL, 'A', 2, NULL , &States[S_BRIDGE+1]), - S_NORMAL (TLGL, 'A', 2, A_BridgeInit , &States[S_BRIDGE+2]), - S_NORMAL (TLGL, 'A', -1, NULL , NULL), - -#define S_FREE_BRIDGE (S_BRIDGE+3) - S_NORMAL (TLGL, 'A', 2, NULL , &States[S_FREE_BRIDGE+1]), - S_NORMAL (TLGL, 'A', 300, NULL , NULL) -}; - -IMPLEMENT_ACTOR (ABridge, Any, 118, 21) - PROP_Flags (MF_SOLID|MF_NOGRAVITY|MF_NOLIFTDROP) -END_DEFAULTS - -AT_GAME_SET (Bridge) -{ - ABridge *def = GetDefault (); - - if (gameinfo.gametype == GAME_Doom) - { - def->SpawnState = &ABridge::States[S_DBRIDGE]; - def->radius = 36 * FRACUNIT; - def->height = 4 * FRACUNIT; - def->RenderStyle = STYLE_Normal; - } - else - { - def->SpawnState = &ABridge::States[S_BRIDGE]; - def->radius = 32 * FRACUNIT; - def->height = 2 * FRACUNIT; - def->RenderStyle = STYLE_None; - } -} // Custom bridge -------------------------------------------------------- /* @@ -108,26 +33,20 @@ AT_GAME_SET (Bridge) This value only matters if args[2] is not zero. */ -class ACustomBridge : public ABridge +class ACustomBridge : public AActor { - DECLARE_STATELESS_ACTOR (ACustomBridge, ABridge) + DECLARE_CLASS (ACustomBridge, AActor) public: void BeginPlay (); }; -IMPLEMENT_STATELESS_ACTOR (ACustomBridge, Any, 9991, 0) - PROP_SpawnState (S_DBRIDGE) - PROP_SeeState (S_BRIDGE) - PROP_DeathState (S_FREE_BRIDGE) - PROP_Flags4 (MF4_ACTLIKEBRIDGE) - PROP_RenderStyle (STYLE_None) -END_DEFAULTS +IMPLEMENT_CLASS(ACustomBridge) void ACustomBridge::BeginPlay () { if (args[2]) // Hexen bridge if there are balls { - SetState(FindState(FName("See"))); + SetState(SeeState); radius = args[0] ? args[0] << FRACBITS : 32 * FRACUNIT; height = args[1] ? args[1] << FRACBITS : 2 * FRACUNIT; } @@ -163,14 +82,13 @@ void A_BridgeOrbit (AActor *self) int rotationspeed = ANGLE_45/32*3/5; int rotationradius = ORBIT_RADIUS; // If the bridge is custom, set non-default values if any. - if (self->target->IsKindOf(PClass::FindClass("CustomBridge"))) - { - // Set angular speed; 1--128: counterclockwise rotation ~=1--180°; 129--255: clockwise rotation ~= 180--1° - if (self->target->args[3] > 128) rotationspeed = ANGLE_45/32 * (self->target->args[3]-256) / TICRATE; - else if (self->target->args[3] > 0) rotationspeed = ANGLE_45/32 * (self->target->args[3]) / TICRATE; - // Set rotation radius - if (self->target->args[4]) rotationradius = ((self->target->args[4] * self->target->radius) / (100 * FRACUNIT)); - } + + // Set angular speed; 1--128: counterclockwise rotation ~=1--180°; 129--255: clockwise rotation ~= 180--1° + if (self->target->args[3] > 128) rotationspeed = ANGLE_45/32 * (self->target->args[3]-256) / TICRATE; + else if (self->target->args[3] > 0) rotationspeed = ANGLE_45/32 * (self->target->args[3]) / TICRATE; + // Set rotation radius + if (self->target->args[4]) rotationradius = ((self->target->args[4] * self->target->radius) / (100 * FRACUNIT)); + if (self->target->special1) { self->SetState (NULL); @@ -209,7 +127,7 @@ void A_BridgeInit (AActor *self) self->special1 = 0; // Spawn triad into world -- may be more than a triad now. - int ballcount = ((self->GetClass()==PClass::FindClass("Bridge") || (self->args[2]==0)) ? 3 : self->args[2]); + int ballcount = self->args[2]==0 ? 3 : self->args[2]; const PClass *balltype = GetBallType(); for (int i = 0; i < ballcount; i++) { @@ -220,38 +138,25 @@ void A_BridgeInit (AActor *self) } } +/* never used void A_BridgeRemove (AActor *self) { self->special1 = true; // Removing the bridge self->flags &= ~MF_SOLID; self->SetState (&ABridge::States[S_FREE_BRIDGE]); } +*/ // Invisible bridge -------------------------------------------------------- -class AInvisibleBridge : public ABridge +class AInvisibleBridge : public AActor { - DECLARE_ACTOR (AInvisibleBridge, ABridge) + DECLARE_CLASS (AInvisibleBridge, AActor) public: void BeginPlay (); - void Tick () - { - Super::Tick (); - } }; -FState AInvisibleBridge::States[] = -{ - S_NORMAL (TNT1, 'A', -1, NULL, NULL) -}; - -IMPLEMENT_ACTOR (AInvisibleBridge, Any, 9990, 0) - PROP_RenderStyle (STYLE_None) - PROP_SpawnState (0) - PROP_RadiusFixed (32) - PROP_HeightFixed (4) - PROP_Flags4 (MF4_ACTLIKEBRIDGE) -END_DEFAULTS +IMPLEMENT_CLASS(AInvisibleBridge) void AInvisibleBridge::BeginPlay () { @@ -262,36 +167,3 @@ void AInvisibleBridge::BeginPlay () height = args[1] << FRACBITS; } -// And some invisible bridges from Skull Tag ------------------------------- - -class AInvisibleBridge32 : public AInvisibleBridge -{ - DECLARE_STATELESS_ACTOR (AInvisibleBridge32, AInvisibleBridge) -}; - -IMPLEMENT_STATELESS_ACTOR (AInvisibleBridge32, Any, 5061, 0) - PROP_RadiusFixed (32) - PROP_HeightFixed (8) -END_DEFAULTS - - -class AInvisibleBridge16 : public AInvisibleBridge -{ - DECLARE_STATELESS_ACTOR (AInvisibleBridge16, AInvisibleBridge) -}; - -IMPLEMENT_STATELESS_ACTOR (AInvisibleBridge16, Any, 5064, 0) - PROP_RadiusFixed (16) - PROP_HeightFixed (8) -END_DEFAULTS - - -class AInvisibleBridge8 : public AInvisibleBridge -{ - DECLARE_STATELESS_ACTOR (AInvisibleBridge8, AInvisibleBridge) -}; - -IMPLEMENT_STATELESS_ACTOR (AInvisibleBridge8, Any, 5065, 0) - PROP_RadiusFixed (8) - PROP_HeightFixed (8) -END_DEFAULTS diff --git a/src/g_shared/a_specialspot.h b/src/g_shared/a_specialspot.h index b2871c340..8efb35cfa 100644 --- a/src/g_shared/a_specialspot.h +++ b/src/g_shared/a_specialspot.h @@ -41,5 +41,5 @@ public: }; - #endif + diff --git a/wadsrc/static/actors/raven/ravenartifacts.txt b/wadsrc/static/actors/raven/ravenartifacts.txt index 6729869fb..77149f854 100644 --- a/wadsrc/static/actors/raven/ravenartifacts.txt +++ b/wadsrc/static/actors/raven/ravenartifacts.txt @@ -65,19 +65,39 @@ ACTOR ArtiFly : PowerupGiver 83 } } -// Invulnerability ---------------------------------------------------------- +// Invulnerability Heretic --------------------------------------------------- ACTOR ArtiInvulnerability : PowerupGiver 84 { - Game Raven + Game Heretic + SpawnID 133 + +COUNTITEM + +FLOATBOB + +INVENTORY.PICKUPFLASH + Inventory.RespawnTics 4230 + Inventory.PickupMessage "$TXT_ARTIINVULNERABILITY" + Powerup.Type Invulnerable + Powerup.Color GoldMap + States + { + Spawn: + INVU ABCD 3 + Loop + } +} + +// Invulnerability Hexen ---------------------------------------------------------- + +ACTOR ArtiInvulnerability2 : PowerupGiver 84 +{ + Game Hexen SpawnID 133 +COUNTITEM +FLOATBOB +INVENTORY.PICKUPFLASH Inventory.RespawnTics 4230 Inventory.Icon ARTIINVU - Inventory.PickupMessage "$TXT_ARTIINVULNERABILITY" - Inventory.PickupMessage Hexen, "$TXT_ARTIINVULNERABILITY2" + Inventory.PickupMessage "$TXT_ARTIINVULNERABILITY2" Powerup.Type Invulnerable States { diff --git a/wadsrc/static/actors/shared/bridge.txt b/wadsrc/static/actors/shared/bridge.txt new file mode 100644 index 000000000..9b76ece3d --- /dev/null +++ b/wadsrc/static/actors/shared/bridge.txt @@ -0,0 +1,109 @@ +// Bridge ball ------------------------------------------------------------- + +ACTOR BridgeBall +{ + +NOBLOCKMAP + +NOTELEPORT + +NOGRAVITY + + action native A_BridgeOrbit(); + + States + { + Spawn: + TLGL A 2 Bright + TLGL A 1 Bright A_BridgeOrbit + Wait + } + +} + +// The bridge itself ------------------------------------------------------- + +ACTOR CustomBridge 9991 native +{ + +SOLID + +NOGRAVITY + +NOLIFTDROP + +ACTLIKEBRIDGE + Radius 32 + Height 2 + RenderStyle None + + action native A_BridgeInit(optional class balltype); + + states + { + Spawn: + TLGL ABCDE 3 Bright + Loop + See: + TLGL A 2 + TLGL A 2 A_BridgeInit + TLGL A -1 + Stop + Death: + TLGL A 2 + TLGL A 300 + Stop + } +} + +// The Hexen bridge ------------------------------------------------------- + +ACTOR Bridge : CustomBridge 118 +{ + Game Raven + SpawnID 21 + RenderStyle None + Args 32, 2, 3, 0 +} + +// The ZDoom bridge ------------------------------------------------------- + +ACTOR ZBridge : CustomBridge 118 +{ + Game Doom + SpawnID 21 + Args 36, 4, 0, 0 +} + + +// Invisible bridge -------------------------------------------------------- + +ACTOR InvisibleBridge 9990 native +{ + RenderStyle None + Radius 32 + Height 4 + +SOLID + +NOGRAVITY + +NOLIFTDROP + +ACTLIKEBRIDGE + States + { + Spawn: + TNT1 A -1 + Stop + } +} + +// And some invisible bridges from Skull Tag ------------------------------- + +ACTOR InvisibleBridge32 : InvisibleBridge 5061 +{ + Radius 32 + Height 8 +} + +ACTOR InvisibleBridge16 : InvisibleBridge 5064 +{ + Radius 16 + Height 8 +} + +ACTOR InvisibleBridge8 : InvisibleBridge 5065 +{ + Radius 8 + Height 8 +} diff --git a/wadsrc/static/decorate.txt b/wadsrc/static/decorate.txt index e50dc6434..f5849761f 100644 --- a/wadsrc/static/decorate.txt +++ b/wadsrc/static/decorate.txt @@ -9,6 +9,7 @@ #include "actors/shared/pickups.txt" #include "actors/shared/fountain.txt" #include "actors/shared/soundsequence.txt" +#include "actors/shared/bridge.txt" #include "actors/doom/doomplayer.txt" #include "actors/doom/possessed.txt"