- added Grubber's submission for customizable gravity per actor.

- Fixed: A_Jump didn't work for weapons or CustomInventory items.



SVN r456 (trunk)
This commit is contained in:
Christoph Oelckers 2007-01-20 14:27:44 +00:00
parent 4f845508cc
commit d0c910fca6
23 changed files with 121 additions and 37 deletions

View file

@ -13,6 +13,12 @@ January 15, 2007
- Added a GTK+ version of the IWAD selection dialog box. That brings the - Added a GTK+ version of the IWAD selection dialog box. That brings the
Linux port one step closer to feature parity with the Windows version. Linux port one step closer to feature parity with the Windows version.
January 15, 2007 (Changes by Graf Zahl)
- added Grubber's submission for customizable gravity per actor.
January 14, 2007 (Changes by Graf Zahl)
- Fixed: A_Jump didn't work for weapons or CustomInventory items.
January 13, 2007 (Changes by Graf Zahl) January 13, 2007 (Changes by Graf Zahl)
- Adjusted AlterWeaponSprite so that it properly handles multiple - Adjusted AlterWeaponSprite so that it properly handles multiple
invisibility powerups at the same time. invisibility powerups at the same time.

View file

@ -154,7 +154,6 @@ enum
// --- mobj.flags2 --- // --- mobj.flags2 ---
MF2_LOGRAV = 0x00000001, // alternate gravity setting
MF2_WINDTHRUST = 0x00000002, // gets pushed around by the wind specials MF2_WINDTHRUST = 0x00000002, // gets pushed around by the wind specials
MF2_BOUNCE1 = 0x00000004, MF2_BOUNCE1 = 0x00000004,
MF2_BLASTED = 0x00000008, // actor will temporarily take damage from impact MF2_BLASTED = 0x00000008, // actor will temporarily take damage from impact
@ -683,6 +682,7 @@ public:
fixed_t meleerange; fixed_t meleerange;
fixed_t bouncefactor; // Strife's grenades use 50%, Hexen's Flechettes 70. fixed_t bouncefactor; // Strife's grenades use 50%, Hexen's Flechettes 70.
int bouncecount; // Strife's grenades only bounce twice before exploding int bouncecount; // Strife's grenades only bounce twice before exploding
fixed_t gravity; // [GRB] Gravity factor
// a linked list of sectors where this object appears // a linked list of sectors where this object appears
struct msecnode_s *touching_sectorlist; // phares 3/14/98 struct msecnode_s *touching_sectorlist; // phares 3/14/98

View file

@ -96,6 +96,7 @@ ACTOR(Respawn)
ACTOR(BarrelDestroy) ACTOR(BarrelDestroy)
ACTOR(PlayerSkinCheck) ACTOR(PlayerSkinCheck)
ACTOR(QueueCorpse) ACTOR(QueueCorpse)
ACTOR(SetGravity)
// Special code pointers for Strife's player - not to be used elsewhere! // Special code pointers for Strife's player - not to be used elsewhere!
ACTOR(ItBurnsItBurns) ACTOR(ItBurnsItBurns)

View file

@ -1000,6 +1000,11 @@ static int PatchThing (int thingy)
info->DamageType = NAME_Fire; info->DamageType = NAME_Fire;
info->flags2 &= ~0x10000; info->flags2 &= ~0x10000;
} }
if (info->flags2 & 1)
{
info->gravity = FRACUNIT/4;
info->flags2 &= ~1;
}
} }
if (vchanged[2]) if (vchanged[2])
{ {

View file

@ -142,8 +142,9 @@ IMPLEMENT_ACTOR (AChickenPlayer, Heretic, -1, 0)
PROP_HeightFixed (24) PROP_HeightFixed (24)
PROP_PainChance (255) PROP_PainChance (255)
PROP_SpeedFixed (1) PROP_SpeedFixed (1)
PROP_Gravity (FRACUNIT/8)
PROP_Flags (MF_SOLID|MF_SHOOTABLE|MF_DROPOFF|MF_NOTDMATCH|MF_FRIENDLY) PROP_Flags (MF_SOLID|MF_SHOOTABLE|MF_DROPOFF|MF_NOTDMATCH|MF_FRIENDLY)
PROP_Flags2 (MF2_WINDTHRUST|MF2_SLIDE|MF2_PASSMOBJ|MF2_PUSHWALL|MF2_FLOORCLIP|MF2_LOGRAV|MF2_TELESTOMP) PROP_Flags2 (MF2_WINDTHRUST|MF2_SLIDE|MF2_PASSMOBJ|MF2_PUSHWALL|MF2_FLOORCLIP|MF2_TELESTOMP)
PROP_Flags3 (MF3_NOBLOCKMONST) PROP_Flags3 (MF3_NOBLOCKMONST)
PROP_Flags4 (MF4_NOSKIN) PROP_Flags4 (MF4_NOSKIN)
@ -281,8 +282,9 @@ FState AFeather::States[] =
IMPLEMENT_ACTOR (AFeather, Heretic, -1, 121) IMPLEMENT_ACTOR (AFeather, Heretic, -1, 121)
PROP_RadiusFixed (2) PROP_RadiusFixed (2)
PROP_HeightFixed (4) PROP_HeightFixed (4)
PROP_Gravity (FRACUNIT/8)
PROP_Flags (MF_MISSILE|MF_DROPOFF) PROP_Flags (MF_MISSILE|MF_DROPOFF)
PROP_Flags2 (MF2_NOTELEPORT|MF2_LOGRAV|MF2_CANNOTPUSH|MF2_WINDTHRUST) PROP_Flags2 (MF2_NOTELEPORT|MF2_CANNOTPUSH|MF2_WINDTHRUST)
PROP_Flags3 (MF3_DONTSPLASH) PROP_Flags3 (MF3_DONTSPLASH)
PROP_SpawnState (S_FEATHER) PROP_SpawnState (S_FEATHER)

View file

@ -115,8 +115,9 @@ FState APodGoo::States[] =
IMPLEMENT_ACTOR (APodGoo, Heretic, -1, 0) IMPLEMENT_ACTOR (APodGoo, Heretic, -1, 0)
PROP_RadiusFixed (2) PROP_RadiusFixed (2)
PROP_HeightFixed (4) PROP_HeightFixed (4)
PROP_Gravity (FRACUNIT/8)
PROP_Flags (MF_NOBLOCKMAP|MF_MISSILE|MF_DROPOFF) PROP_Flags (MF_NOBLOCKMAP|MF_MISSILE|MF_DROPOFF)
PROP_Flags2 (MF2_NOTELEPORT|MF2_LOGRAV|MF2_CANNOTPUSH) PROP_Flags2 (MF2_NOTELEPORT|MF2_CANNOTPUSH)
PROP_SpawnState (S_PODGOO) PROP_SpawnState (S_PODGOO)
END_DEFAULTS END_DEFAULTS
@ -421,8 +422,9 @@ IMPLEMENT_ACTOR (AVolcanoBlast, Heretic, -1, 123)
PROP_SpeedFixed (2) PROP_SpeedFixed (2)
PROP_Damage (2) PROP_Damage (2)
PROP_DamageType (NAME_Fire) PROP_DamageType (NAME_Fire)
PROP_Gravity (FRACUNIT/8)
PROP_Flags (MF_NOBLOCKMAP|MF_MISSILE|MF_DROPOFF) PROP_Flags (MF_NOBLOCKMAP|MF_MISSILE|MF_DROPOFF)
PROP_Flags2 (MF2_LOGRAV|MF2_NOTELEPORT) PROP_Flags2 (MF2_NOTELEPORT)
PROP_SpawnState (S_VOLCANOBALL) PROP_SpawnState (S_VOLCANOBALL)
PROP_DeathState (S_VOLCANOBALLX) PROP_DeathState (S_VOLCANOBALLX)
@ -459,8 +461,9 @@ IMPLEMENT_ACTOR (AVolcanoTBlast, Heretic, -1, 124)
PROP_SpeedFixed (2) PROP_SpeedFixed (2)
PROP_Damage (1) PROP_Damage (1)
PROP_DamageType (NAME_Fire) PROP_DamageType (NAME_Fire)
PROP_Gravity (FRACUNIT/8)
PROP_Flags (MF_NOBLOCKMAP|MF_MISSILE|MF_DROPOFF) PROP_Flags (MF_NOBLOCKMAP|MF_MISSILE|MF_DROPOFF)
PROP_Flags2 (MF2_LOGRAV|MF2_NOTELEPORT) PROP_Flags2 (MF2_NOTELEPORT)
PROP_SpawnState (S_VOLCANOTBALL) PROP_SpawnState (S_VOLCANOTBALL)
PROP_DeathState (S_VOLCANOTBALLX) PROP_DeathState (S_VOLCANOTBALLX)
@ -539,7 +542,7 @@ void A_VolcBallImpact (AActor *ball)
if (ball->z <= ball->floorz) if (ball->z <= ball->floorz)
{ {
ball->flags |= MF_NOGRAVITY; ball->flags |= MF_NOGRAVITY;
ball->flags2 &= ~MF2_LOGRAV; ball->gravity = FRACUNIT;
ball->z += 28*FRACUNIT; ball->z += 28*FRACUNIT;
//ball->momz = 3*FRACUNIT; //ball->momz = 3*FRACUNIT;
} }

View file

@ -698,7 +698,7 @@ FState ACrossbowFX4::States[] =
IMPLEMENT_ACTOR (ACrossbowFX4, Heretic, -1, 0) IMPLEMENT_ACTOR (ACrossbowFX4, Heretic, -1, 0)
PROP_Flags (MF_NOBLOCKMAP) PROP_Flags (MF_NOBLOCKMAP)
PROP_Flags2 (MF2_LOGRAV) PROP_Gravity (FRACUNIT/8)
PROP_RenderStyle (STYLE_Add) PROP_RenderStyle (STYLE_Add)
PROP_SpawnState (S_CRBOWFX4) PROP_SpawnState (S_CRBOWFX4)
END_DEFAULTS END_DEFAULTS
@ -944,8 +944,9 @@ IMPLEMENT_ACTOR (AMaceFX2, Heretic, -1, 156)
PROP_HeightFixed (6) PROP_HeightFixed (6)
PROP_SpeedFixed (10) PROP_SpeedFixed (10)
PROP_Damage (6) PROP_Damage (6)
PROP_Gravity (FRACUNIT/8)
PROP_Flags (MF_NOBLOCKMAP|MF_MISSILE|MF_DROPOFF) PROP_Flags (MF_NOBLOCKMAP|MF_MISSILE|MF_DROPOFF)
PROP_Flags2 (MF2_LOGRAV|MF2_HERETICBOUNCE|MF2_THRUGHOST|MF2_NOTELEPORT|MF2_PCROSS|MF2_IMPACT) PROP_Flags2 (MF2_HERETICBOUNCE|MF2_THRUGHOST|MF2_NOTELEPORT|MF2_PCROSS|MF2_IMPACT)
PROP_SpawnState (S_MACEFX2) PROP_SpawnState (S_MACEFX2)
PROP_DeathState (S_MACEFXI2) PROP_DeathState (S_MACEFXI2)
@ -968,8 +969,9 @@ FState AMaceFX3::States[] =
IMPLEMENT_ACTOR (AMaceFX3, Heretic, -1, 155) IMPLEMENT_ACTOR (AMaceFX3, Heretic, -1, 155)
PROP_SpeedFixed (7) PROP_SpeedFixed (7)
PROP_Damage (4) PROP_Damage (4)
PROP_Gravity (FRACUNIT/8)
PROP_Flags (MF_NOBLOCKMAP|MF_MISSILE|MF_DROPOFF) PROP_Flags (MF_NOBLOCKMAP|MF_MISSILE|MF_DROPOFF)
PROP_Flags2 (MF2_LOGRAV|MF2_HERETICBOUNCE|MF2_THRUGHOST|MF2_NOTELEPORT|MF2_PCROSS|MF2_IMPACT) PROP_Flags2 (MF2_HERETICBOUNCE|MF2_THRUGHOST|MF2_NOTELEPORT|MF2_PCROSS|MF2_IMPACT)
PROP_SpawnState (S_MACEFX3) PROP_SpawnState (S_MACEFX3)
END_DEFAULTS END_DEFAULTS
@ -997,8 +999,9 @@ IMPLEMENT_ACTOR (AMaceFX4, Heretic, -1, 153)
PROP_HeightFixed (6) PROP_HeightFixed (6)
PROP_SpeedFixed (7) PROP_SpeedFixed (7)
PROP_Damage (18) PROP_Damage (18)
PROP_Gravity (FRACUNIT/8)
PROP_Flags (MF_NOBLOCKMAP|MF_MISSILE|MF_DROPOFF) PROP_Flags (MF_NOBLOCKMAP|MF_MISSILE|MF_DROPOFF)
PROP_Flags2 (MF2_LOGRAV|MF2_HERETICBOUNCE|MF2_THRUGHOST|MF2_TELESTOMP|MF2_PCROSS|MF2_IMPACT) PROP_Flags2 (MF2_HERETICBOUNCE|MF2_THRUGHOST|MF2_TELESTOMP|MF2_PCROSS|MF2_IMPACT)
PROP_SpawnState (S_MACEFX4) PROP_SpawnState (S_MACEFX4)
PROP_DeathState (S_MACEFXI4) PROP_DeathState (S_MACEFXI4)
@ -1213,7 +1216,7 @@ void A_MacePL1Check (AActor *ball)
} }
ball->special1 = 0; ball->special1 = 0;
ball->flags &= ~MF_NOGRAVITY; ball->flags &= ~MF_NOGRAVITY;
ball->flags2 |= MF2_LOGRAV; ball->gravity = FRACUNIT/8;
// [RH] Avoid some precision loss by scaling the momentum directly // [RH] Avoid some precision loss by scaling the momentum directly
#if 0 #if 0
angle_t angle = ball->angle>>ANGLETOFINESHIFT; angle_t angle = ball->angle>>ANGLETOFINESHIFT;
@ -1249,7 +1252,7 @@ void A_MaceBallImpact (AActor *ball)
{ // Explode { // Explode
ball->momx = ball->momy = ball->momz = 0; ball->momx = ball->momy = ball->momz = 0;
ball->flags |= MF_NOGRAVITY; ball->flags |= MF_NOGRAVITY;
ball->flags2 &= ~MF2_LOGRAV; ball->gravity = FRACUNIT;
S_Sound (ball, CHAN_BODY, "weapons/macehit", 1, ATTN_NORM); S_Sound (ball, CHAN_BODY, "weapons/macehit", 1, ATTN_NORM);
} }
} }
@ -1317,7 +1320,8 @@ void A_MaceBallImpact2 (AActor *ball)
boom: boom:
ball->momx = ball->momy = ball->momz = 0; ball->momx = ball->momy = ball->momz = 0;
ball->flags |= MF_NOGRAVITY; ball->flags |= MF_NOGRAVITY;
ball->flags2 &= ~(MF2_LOGRAV|MF2_BOUNCETYPE); ball->flags2 &= ~MF2_BOUNCETYPE;
ball->gravity = FRACUNIT;
} }
} }
@ -1443,7 +1447,7 @@ void A_DeathBallImpact (AActor *ball)
boom: boom:
ball->momx = ball->momy = ball->momz = 0; ball->momx = ball->momy = ball->momz = 0;
ball->flags |= MF_NOGRAVITY; ball->flags |= MF_NOGRAVITY;
ball->flags2 &= ~MF2_LOGRAV; ball->gravity = FRACUNIT;
S_Sound (ball, CHAN_BODY, "weapons/maceexplode", 1, ATTN_NORM); S_Sound (ball, CHAN_BODY, "weapons/maceexplode", 1, ATTN_NORM);
} }
} }

View file

@ -191,7 +191,7 @@ void A_DripBlood (AActor *actor)
mo = Spawn ("Blood", x, y, actor->z, ALLOW_REPLACE); mo = Spawn ("Blood", x, y, actor->z, ALLOW_REPLACE);
mo->momx = pr_dripblood.Random2 () << 10; mo->momx = pr_dripblood.Random2 () << 10;
mo->momy = pr_dripblood.Random2 () << 10; mo->momy = pr_dripblood.Random2 () << 10;
mo->flags2 |= MF2_LOGRAV; mo->gravity = FRACUNIT/8;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------

View file

@ -613,8 +613,9 @@ FState ASorcSpark1::States[] =
IMPLEMENT_ACTOR (ASorcSpark1, Hexen, -1, 0) IMPLEMENT_ACTOR (ASorcSpark1, Hexen, -1, 0)
PROP_RadiusFixed (5) PROP_RadiusFixed (5)
PROP_HeightFixed (5) PROP_HeightFixed (5)
PROP_Gravity (FRACUNIT/8)
PROP_Flags (MF_NOBLOCKMAP|MF_DROPOFF) PROP_Flags (MF_NOBLOCKMAP|MF_DROPOFF)
PROP_Flags2 (MF2_LOGRAV|MF2_NOTELEPORT) PROP_Flags2 (MF2_NOTELEPORT)
PROP_RenderStyle (STYLE_Add) PROP_RenderStyle (STYLE_Add)
PROP_SpawnState (S_SORCSPARK1) PROP_SpawnState (S_SORCSPARK1)
@ -1337,7 +1338,7 @@ void A_SorcBallPop(AActor *actor)
{ {
S_Sound (actor, CHAN_BODY, "SorcererBallPop", 1, ATTN_NONE); S_Sound (actor, CHAN_BODY, "SorcererBallPop", 1, ATTN_NONE);
actor->flags &= ~MF_NOGRAVITY; actor->flags &= ~MF_NOGRAVITY;
actor->flags2 |= MF2_LOGRAV; actor->gravity = FRACUNIT/8;
actor->momx = ((pr_heresiarch()%10)-5) << FRACBITS; actor->momx = ((pr_heresiarch()%10)-5) << FRACBITS;
actor->momy = ((pr_heresiarch()%10)-5) << FRACBITS; actor->momy = ((pr_heresiarch()%10)-5) << FRACBITS;
actor->momz = (2+(pr_heresiarch()%3)) << FRACBITS; actor->momz = (2+(pr_heresiarch()%3)) << FRACBITS;

View file

@ -313,8 +313,8 @@ FState ACorpseBloodDrip::States[] =
IMPLEMENT_ACTOR (ACorpseBloodDrip, Hexen, -1, 0) IMPLEMENT_ACTOR (ACorpseBloodDrip, Hexen, -1, 0)
PROP_RadiusFixed (1) PROP_RadiusFixed (1)
PROP_HeightFixed (4) PROP_HeightFixed (4)
PROP_Gravity (FRACUNIT/8)
PROP_Flags (MF_MISSILE) PROP_Flags (MF_MISSILE)
PROP_Flags2 (MF2_LOGRAV)
PROP_Flags4 (MF4_NOICEDEATH) PROP_Flags4 (MF4_NOICEDEATH)
PROP_SpawnState (S_CORPSEBLOODDRIP) PROP_SpawnState (S_CORPSEBLOODDRIP)
@ -480,8 +480,9 @@ FState ALeaf1::States[] =
IMPLEMENT_ACTOR (ALeaf1, Hexen, -1, 0) IMPLEMENT_ACTOR (ALeaf1, Hexen, -1, 0)
PROP_RadiusFixed (2) PROP_RadiusFixed (2)
PROP_HeightFixed (4) PROP_HeightFixed (4)
PROP_Gravity (FRACUNIT/8)
PROP_Flags (MF_NOBLOCKMAP|MF_MISSILE) PROP_Flags (MF_NOBLOCKMAP|MF_MISSILE)
PROP_Flags2 (MF2_NOTELEPORT|MF2_LOGRAV) PROP_Flags2 (MF2_NOTELEPORT)
PROP_Flags3 (MF3_DONTSPLASH) PROP_Flags3 (MF3_DONTSPLASH)
PROP_Flags4 (MF4_NOICEDEATH) PROP_Flags4 (MF4_NOICEDEATH)

View file

@ -170,8 +170,9 @@ IMPLEMENT_ACTOR (AIceGuyFX2, Hexen, -1, 0)
PROP_HeightFixed (4) PROP_HeightFixed (4)
PROP_Damage (1) PROP_Damage (1)
PROP_DamageType (NAME_Ice) PROP_DamageType (NAME_Ice)
PROP_Gravity (FRACUNIT/8)
PROP_Flags (MF_NOBLOCKMAP|MF_DROPOFF|MF_MISSILE) PROP_Flags (MF_NOBLOCKMAP|MF_DROPOFF|MF_MISSILE)
PROP_Flags2 (MF2_LOGRAV|MF2_NOTELEPORT) PROP_Flags2 (MF2_NOTELEPORT)
PROP_SpawnState (0) PROP_SpawnState (0)
END_DEFAULTS END_DEFAULTS
@ -198,8 +199,9 @@ FState AIceGuyBit::States[] =
IMPLEMENT_ACTOR (AIceGuyBit, Hexen, -1, 0) IMPLEMENT_ACTOR (AIceGuyBit, Hexen, -1, 0)
PROP_RadiusFixed (1) PROP_RadiusFixed (1)
PROP_HeightFixed (1) PROP_HeightFixed (1)
PROP_Gravity (FRACUNIT/8)
PROP_Flags (MF_NOBLOCKMAP|MF_DROPOFF) PROP_Flags (MF_NOBLOCKMAP|MF_DROPOFF)
PROP_Flags2 (MF2_LOGRAV|MF2_NOTELEPORT) PROP_Flags2 (MF2_NOTELEPORT)
PROP_SpawnState (0) PROP_SpawnState (0)
END_DEFAULTS END_DEFAULTS

View file

@ -268,8 +268,8 @@ FState ASerpentHead::States[] =
IMPLEMENT_ACTOR (ASerpentHead, Hexen, -1, 0) IMPLEMENT_ACTOR (ASerpentHead, Hexen, -1, 0)
PROP_RadiusFixed (5) PROP_RadiusFixed (5)
PROP_HeightFixed (10) PROP_HeightFixed (10)
PROP_Gravity (FRACUNIT/8)
PROP_Flags (MF_NOBLOCKMAP) PROP_Flags (MF_NOBLOCKMAP)
PROP_Flags2 (MF2_LOGRAV)
PROP_SpawnState (S_SERPENT_HEAD1) PROP_SpawnState (S_SERPENT_HEAD1)
PROP_DeathState (S_SERPENT_HEAD_X1) PROP_DeathState (S_SERPENT_HEAD_X1)

View file

@ -35,8 +35,9 @@ IMPLEMENT_ACTOR (AIceChunk, Any, -1, 0)
PROP_RadiusFixed (3) PROP_RadiusFixed (3)
PROP_HeightFixed (4) PROP_HeightFixed (4)
PROP_Mass(5) PROP_Mass(5)
PROP_Gravity (FRACUNIT/8)
PROP_Flags (MF_DROPOFF) PROP_Flags (MF_DROPOFF)
PROP_Flags2 (MF2_LOGRAV|MF2_CANNOTPUSH|MF2_FLOORCLIP|MF2_NOTELEPORT) PROP_Flags2 (MF2_CANNOTPUSH|MF2_FLOORCLIP|MF2_NOTELEPORT)
PROP_SpawnState (0) PROP_SpawnState (0)
END_DEFAULTS END_DEFAULTS
@ -61,8 +62,9 @@ IMPLEMENT_ACTOR (AIceChunkHead, Any, -1, 0)
PROP_HeightFixed (4) PROP_HeightFixed (4)
PROP_Mass(5) PROP_Mass(5)
PROP_DamageType (NAME_Ice) PROP_DamageType (NAME_Ice)
PROP_Gravity (FRACUNIT/8)
PROP_Flags (MF_DROPOFF) PROP_Flags (MF_DROPOFF)
PROP_Flags2 (MF2_LOGRAV|MF2_CANNOTPUSH) PROP_Flags2 (MF2_CANNOTPUSH)
PROP_SpawnState (0) PROP_SpawnState (0)
END_DEFAULTS END_DEFAULTS
@ -545,7 +547,7 @@ void A_NoGravity (AActor *actor)
void A_Gravity (AActor *actor) void A_Gravity (AActor *actor)
{ {
actor->flags &= ~MF_NOGRAVITY; actor->flags &= ~MF_NOGRAVITY;
actor->flags2 &= ~MF2_LOGRAV; actor->gravity = FRACUNIT;
} }
//=========================================================================== //===========================================================================
@ -557,7 +559,7 @@ void A_Gravity (AActor *actor)
void A_LowGravity (AActor *actor) void A_LowGravity (AActor *actor)
{ {
actor->flags &= ~MF_NOGRAVITY; actor->flags &= ~MF_NOGRAVITY;
actor->flags2 |= MF2_LOGRAV; actor->gravity = FRACUNIT/8;
} }
//=========================================================================== //===========================================================================

View file

@ -170,7 +170,7 @@ class ACustomInventory : public AInventory
public: public:
// This is used when an inventory item's use state sequence is executed. // This is used when an inventory item's use state sequence is executed.
static bool CallStateChain (AActor *actor, FState *state); bool CallStateChain (AActor *actor, FState *state);
bool TryPickup (AActor *toucher); bool TryPickup (AActor *toucher);
bool Use (bool pickup); bool Use (bool pickup);

View file

@ -290,6 +290,7 @@ enum
ADEF_FloatSpeed, ADEF_FloatSpeed,
ADEF_RDFactor, ADEF_RDFactor,
ADEF_FXFlags, ADEF_FXFlags,
ADEF_Gravity,
ADEF_SpawnState, ADEF_SpawnState,
ADEF_SeeState, ADEF_SeeState,

View file

@ -226,6 +226,7 @@ static void ApplyActorDefault (int defnum, const char *datastr, int dataint)
case ADEF_BounceCount: actor->bouncecount = dataint; break; case ADEF_BounceCount: actor->bouncecount = dataint; break;
case ADEF_RDFactor: sgClass->Meta.SetMetaFixed (AMETA_RDFactor, dataint); break; case ADEF_RDFactor: sgClass->Meta.SetMetaFixed (AMETA_RDFactor, dataint); break;
case ADEF_FXFlags: actor->effects = dataint; break; case ADEF_FXFlags: actor->effects = dataint; break;
case ADEF_Gravity: actor->gravity = dataint; break;
case ADEF_SpawnState: AddState("Spawn", datastate); break; case ADEF_SpawnState: AddState("Spawn", datastate); break;
case ADEF_SeeState: AddState("See", datastate); break; case ADEF_SeeState: AddState("See", datastate); break;

View file

@ -267,6 +267,7 @@ public:
#define PROP_BounceCount(x) ADD_LONG_PROP(ADEF_BounceCount,x) #define PROP_BounceCount(x) ADD_LONG_PROP(ADEF_BounceCount,x)
#define PROP_RadiusdamageFactor(x) ADD_LONG_PROP(ADEF_RDFactor,x) #define PROP_RadiusdamageFactor(x) ADD_LONG_PROP(ADEF_RDFactor,x)
#define PROP_FXFlags(x) ADD_LONG_PROP(ADEF_FXFlags,x) #define PROP_FXFlags(x) ADD_LONG_PROP(ADEF_FXFlags,x)
#define PROP_Gravity(x) ADD_LONG_PROP(ADEF_Gravity,x)
#define PROP_SpawnState(x) ADD_BYTE_PROP(ADEF_SpawnState,x) #define PROP_SpawnState(x) ADD_BYTE_PROP(ADEF_SpawnState,x)

View file

@ -2071,6 +2071,7 @@ void DLevelScript::DoSetFont (int fontnum)
#define APROP_JumpZ 12 // [GRB] #define APROP_JumpZ 12 // [GRB]
#define APROP_ChaseGoal 13 #define APROP_ChaseGoal 13
#define APROP_Frightened 14 #define APROP_Frightened 14
#define APROP_Gravity 15
#define APROP_SeeSound 5 // Sounds can only be set, not gotten #define APROP_SeeSound 5 // Sounds can only be set, not gotten
#define APROP_AttackSound 6 #define APROP_AttackSound 6
#define APROP_PainSound 7 #define APROP_PainSound 7
@ -2153,6 +2154,10 @@ void DLevelScript::DoSetActorProperty (AActor *actor, int property, int value)
else else
actor->flags4 &= ~MF4_FRIGHTENED; actor->flags4 &= ~MF4_FRIGHTENED;
break; break;
case APROP_Gravity:
actor->gravity = value;
break;
case APROP_SeeSound: case APROP_SeeSound:
actor->SeeSound = S_FindSound (FBehavior::StaticLookupString (value)); actor->SeeSound = S_FindSound (FBehavior::StaticLookupString (value));
@ -2204,6 +2209,7 @@ int DLevelScript::GetActorProperty (int tid, int property)
case APROP_Damage: return actor->Damage; // Should this call GetMissileDamage() instead? case APROP_Damage: return actor->Damage; // Should this call GetMissileDamage() instead?
case APROP_Alpha: return actor->alpha; case APROP_Alpha: return actor->alpha;
case APROP_RenderStyle: return actor->RenderStyle; case APROP_RenderStyle: return actor->RenderStyle;
case APROP_Gravity: return actor->gravity;
case APROP_Ambush: return !!(actor->flags & MF_AMBUSH); case APROP_Ambush: return !!(actor->flags & MF_AMBUSH);
case APROP_ChaseGoal: return !!(actor->flags5 & MF5_CHASEGOAL); case APROP_ChaseGoal: return !!(actor->flags5 & MF5_CHASEGOAL);
case APROP_Frightened: return !!(actor->flags4 & MF4_FRIGHTENED); case APROP_Frightened: return !!(actor->flags4 & MF4_FRIGHTENED);

View file

@ -312,7 +312,8 @@ void AActor::Serialize (FArchive &arc)
<< bouncefactor << bouncefactor
<< bouncecount << bouncecount
<< meleerange << meleerange
<< DamageType; << DamageType
<< gravity;
if (arc.IsStoring ()) if (arc.IsStoring ())
{ {
@ -1843,7 +1844,7 @@ void P_ZMovement (AActor *mo)
!(mo->player->cmd.ucmd.forwardmove | mo->player->cmd.ucmd.sidemove))) !(mo->player->cmd.ucmd.forwardmove | mo->player->cmd.ucmd.sidemove)))
{ {
mo->momz -= (fixed_t)(level.gravity * mo->Sector->gravity * mo->momz -= (fixed_t)(level.gravity * mo->Sector->gravity *
(mo->flags2 & MF2_LOGRAV ? 10.24 : 81.92)); FIXED2FLOAT(mo->gravity) * 81.92);
} }
if (mo->waterlevel > 1) if (mo->waterlevel > 1)
{ {
@ -3000,7 +3001,8 @@ void A_FreeTargMobj (AActor *mo)
mo->z = mo->ceilingz + 4*FRACUNIT; mo->z = mo->ceilingz + 4*FRACUNIT;
mo->flags &= ~(MF_SHOOTABLE|MF_FLOAT|MF_SKULLFLY|MF_SOLID); mo->flags &= ~(MF_SHOOTABLE|MF_FLOAT|MF_SKULLFLY|MF_SOLID);
mo->flags |= MF_CORPSE|MF_DROPOFF|MF_NOGRAVITY; mo->flags |= MF_CORPSE|MF_DROPOFF|MF_NOGRAVITY;
mo->flags2 &= ~(MF2_PASSMOBJ|MF2_LOGRAV); mo->flags2 &= ~MF2_PASSMOBJ;
mo->gravity = FRACUNIT;
mo->player = NULL; mo->player = NULL;
} }
@ -3051,6 +3053,7 @@ BEGIN_DEFAULTS (AActor, Any, -1, 0)
PROP_BounceFactor(FRACUNIT*7/10) PROP_BounceFactor(FRACUNIT*7/10)
PROP_BounceCount(-1) PROP_BounceCount(-1)
PROP_FloatSpeed(4) PROP_FloatSpeed(4)
PROP_Gravity(FRACUNIT)
END_DEFAULTS END_DEFAULTS
//========================================================================== //==========================================================================

View file

@ -247,7 +247,7 @@ bool P_Thing_Projectile (int tid, AActor *source, int type, const char * type_na
mobj->flags &= ~MF_NOGRAVITY; mobj->flags &= ~MF_NOGRAVITY;
if (!(mobj->flags3 & MF3_ISMONSTER) && gravity == 1) if (!(mobj->flags3 & MF3_ISMONSTER) && gravity == 1)
{ {
mobj->flags2 |= MF2_LOGRAV; mobj->gravity = FRACUNIT/8;
} }
} }
else else

View file

@ -129,7 +129,6 @@ static flagdef ActorFlags[]=
DEFINE_FLAG(MF, NOLIFTDROP, AActor, flags), DEFINE_FLAG(MF, NOLIFTDROP, AActor, flags),
DEFINE_FLAG(MF, STEALTH, AActor, flags), DEFINE_FLAG(MF, STEALTH, AActor, flags),
DEFINE_FLAG(MF, ICECORPSE, AActor, flags), DEFINE_FLAG(MF, ICECORPSE, AActor, flags),
DEFINE_FLAG2(MF2_LOGRAV, LOWGRAVITY, AActor, flags2),
DEFINE_FLAG(MF2, WINDTHRUST, AActor, flags2), DEFINE_FLAG(MF2, WINDTHRUST, AActor, flags2),
DEFINE_FLAG(MF2, HERETICBOUNCE , AActor, flags2), DEFINE_FLAG(MF2, HERETICBOUNCE , AActor, flags2),
DEFINE_FLAG(MF2, BLASTED, AActor, flags2), DEFINE_FLAG(MF2, BLASTED, AActor, flags2),
@ -3224,6 +3223,22 @@ static void ActorVSpeed (AActor *defaults, Baggage &bag)
defaults->momz = fixed_t(sc_Float*FRACUNIT); defaults->momz = fixed_t(sc_Float*FRACUNIT);
} }
//==========================================================================
//
//==========================================================================
static void ActorGravity (AActor *defaults, Baggage &bag)
{
SC_MustGetFloat ();
if (sc_Float < 0.f || sc_Float > 1.f)
SC_ScriptError ("Gravity must be in the range [0,1]");
defaults->gravity = FLOAT2FIXED (sc_Float);
if (sc_Float == 0.f)
defaults->flags |= MF_NOGRAVITY;
}
//========================================================================== //==========================================================================
// //
//========================================================================== //==========================================================================
@ -3276,6 +3291,11 @@ static void ActorFlagSetOrReset (AActor *defaults, Baggage &bag)
if (mod == '+') defaults->DamageType = NAME_Ice; if (mod == '+') defaults->DamageType = NAME_Ice;
else defaults->DamageType = NAME_None; else defaults->DamageType = NAME_None;
} }
else if (SC_Compare ("LOWGRAVITY"))
{
if (mod == '+') defaults->gravity = FRACUNIT/8;
else defaults->gravity = FRACUNIT;
}
else else
{ {
FString part1 = sc_String; FString part1 = sc_String;
@ -4099,6 +4119,7 @@ static const ActorProps props[] =
{ "floatspeed", ActorFloatSpeed, RUNTIME_CLASS(AActor) }, { "floatspeed", ActorFloatSpeed, RUNTIME_CLASS(AActor) },
{ "game", ActorGame, RUNTIME_CLASS(AActor) }, { "game", ActorGame, RUNTIME_CLASS(AActor) },
{ "gibhealth", ActorGibHealth, RUNTIME_CLASS(AActor) }, { "gibhealth", ActorGibHealth, RUNTIME_CLASS(AActor) },
{ "gravity", ActorGravity, RUNTIME_CLASS(AActor) },
{ "heal", ActorHealState, RUNTIME_CLASS(AActor) }, { "heal", ActorHealState, RUNTIME_CLASS(AActor) },
{ "health", ActorHealth, RUNTIME_CLASS(AActor) }, { "health", ActorHealth, RUNTIME_CLASS(AActor) },
{ "health.lowmessage", (apf)HealthLowMessage, RUNTIME_CLASS(AHealth) }, { "health.lowmessage", (apf)HealthLowMessage, RUNTIME_CLASS(AHealth) },

View file

@ -88,6 +88,7 @@ FState * CallingState;
struct StateCallData struct StateCallData
{ {
FState * State; FState * State;
AActor * Item;
bool Result; bool Result;
}; };
@ -110,6 +111,7 @@ bool ACustomInventory::CallStateChain (AActor *actor, FState * State)
int counter = 0; int counter = 0;
pStateCall = &StateCall; pStateCall = &StateCall;
StateCall.Item = this;
while (State != NULL) while (State != NULL)
{ {
// Assume success. The code pointer will set this to false if necessary // Assume success. The code pointer will set this to false if necessary
@ -387,7 +389,7 @@ FState *P_GetState(AActor *self, FState *CallingState, int offset)
{ {
return CallingState + offset; return CallingState + offset;
} }
else else if (self != NULL)
{ {
offset = -offset; offset = -offset;
@ -412,6 +414,7 @@ FState *P_GetState(AActor *self, FState *CallingState, int offset)
} }
return jumpto; return jumpto;
} }
else return NULL;
} }
//========================================================================== //==========================================================================
@ -421,24 +424,29 @@ FState *P_GetState(AActor *self, FState *CallingState, int offset)
//========================================================================== //==========================================================================
static void DoJump(AActor * self, FState * CallingState, int offset) static void DoJump(AActor * self, FState * CallingState, int offset)
{ {
FState *jumpto = P_GetState(self, CallingState, offset);
if (jumpto == NULL) return;
if (pStateCall != NULL && CallingState == pStateCall->State) if (pStateCall != NULL && CallingState == pStateCall->State)
{ {
FState *jumpto = P_GetState(pStateCall->Item, CallingState, offset);
if (jumpto == NULL) return;
pStateCall->State = jumpto; pStateCall->State = jumpto;
} }
else if (self->player != NULL && CallingState == self->player->psprites[ps_weapon].state) else if (self->player != NULL && CallingState == self->player->psprites[ps_weapon].state)
{ {
FState *jumpto = P_GetState(self->player->ReadyWeapon, CallingState, offset);
if (jumpto == NULL) return;
P_SetPsprite(self->player, ps_weapon, jumpto); P_SetPsprite(self->player, ps_weapon, jumpto);
} }
else if (self->player != NULL && CallingState == self->player->psprites[ps_flash].state) else if (self->player != NULL && CallingState == self->player->psprites[ps_flash].state)
{ {
FState *jumpto = P_GetState(self->player->ReadyWeapon, CallingState, offset);
if (jumpto == NULL) return;
P_SetPsprite(self->player, ps_flash, jumpto); P_SetPsprite(self->player, ps_flash, jumpto);
} }
else else
{ {
FState *jumpto = P_GetState(self, CallingState, offset);
if (jumpto == NULL) return;
self->SetState (jumpto); self->SetState (jumpto);
} }
} }
@ -2045,3 +2053,18 @@ void A_PlayerSkinCheck (AActor *actor)
} }
} }
} }
//===========================================================================
//
// A_SetGravity
//
//===========================================================================
void A_SetGravity(AActor * self)
{
int index=CheckIndex(1);
if (index<0) return;
self->gravity = clamp<fixed_t> (EvalExpressionF (StateParameters[index], self), 0, FRACUNIT);
}

View file

@ -73,6 +73,7 @@ class Actor extends Thinker
action native A_NoGravity(); action native A_NoGravity();
action native A_Gravity(); action native A_Gravity();
action native A_LowGravity(); action native A_LowGravity();
action native A_SetGravity(eval float gravity);
action native A_Fall(); action native A_Fall();
action native A_SetSolid(); action native A_SetSolid();
action native A_UnsetSolid(); action native A_UnsetSolid();