Skip to content

Commit

Permalink
- turned adjustfall into a 'gravityfactor' property.
Browse files Browse the repository at this point in the history
  • Loading branch information
coelckers committed Mar 27, 2023
1 parent cf0598e commit 756be28
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
1 change: 1 addition & 0 deletions source/core/namedef_custom.h
Expand Up @@ -31,3 +31,4 @@ xx(floating_floordist)
xx(floating_ceilingdist)
xx(landmovefactor)
xx(watermovefactor)
xx(gravityfactor)
14 changes: 3 additions & 11 deletions source/games/duke/src/actors.cpp
Expand Up @@ -49,9 +49,6 @@ This file is a combination of code from the following sources:

BEGIN_DUKE_NS

double adjustfall(DDukeActor* actor, double c);


//---------------------------------------------------------------------------
//
// this is the implementation of DDukeActor::Tick. It is native so that
Expand Down Expand Up @@ -3775,14 +3772,9 @@ void makeitfall(DDukeActor* actor)
grav = 0;
else
{
if( ceilingspace(actor->sector()) || actor->sector()->lotag == ST_2_UNDERWATER)
grav = gs.gravity/6;
else grav = gs.gravity;
}

if (isRRRA())
{
grav = adjustfall(actor, grav); // this accesses sprite indices and cannot be in shared code. Should be done better. (todo: turn into actor flags)
if (ceilingspace(actor->sector()) || actor->sector()->lotag == ST_2_UNDERWATER)
grav = gs.gravity / 6;
else grav = gs.gravity * actor->FloatVar(NAME_gravityfactor);
}

if ((actor->spr.statnum == STAT_ACTOR || actor->spr.statnum == STAT_PLAYER || actor->spr.statnum == STAT_ZOMBIEACTOR || actor->spr.statnum == STAT_STANDABLE))
Expand Down
4 changes: 2 additions & 2 deletions source/games/duke/src/actors_r.cpp
Expand Up @@ -546,7 +546,7 @@ void handle_se06_r(DDukeActor *actor)
}
if (!hulkspawn)
{
ns = CreateActor(actor->sector(), DVector3(actor->spr.pos.XY(), actor->sector()->ceilingz + 466.5), RTILE_UFOLIGHT, -8, DVector2(0.25, 0.25), nullAngle, 0., 0., actor, 5);
ns = CreateActor(actor->sector(), DVector3(actor->spr.pos.XY(), actor->sector()->ceilingz + 466.5), RedneckUfoLightClass, -8, DVector2(0.25, 0.25), nullAngle, 0., 0., actor, 5);
if (ns)
{
ns->spr.cstat = CSTAT_SPRITE_TRANS_FLIP | CSTAT_SPRITE_TRANSLUCENT;
Expand All @@ -572,7 +572,7 @@ void handle_se06_r(DDukeActor *actor)
DukeSectIterator it(actor->sector());
while (auto a2 = it.Next())
{
if (a2->spr.picnum == RTILE_UFOBEAM && ufospawn && ++ufocnt == 64)
if (a2->GetClass() == RedneckUfoBeamClass && ufospawn && ++ufocnt == 64)
{
ufocnt = 0;
ufospawn--;
Expand Down
2 changes: 2 additions & 0 deletions source/games/duke/src/classnames.h
Expand Up @@ -81,6 +81,8 @@ xx(RedneckUfo2)
xx(RedneckUfo3)
xx(RedneckUfo4)
xx(RedneckUfoRRRA)
xx(RedneckUfoBeam)
xx(RedneckUfoLight)
xx(DukeShotgunShot)
xx(DukeChaingunShot)
xx(DukeGrowSpark)
Expand Down
3 changes: 3 additions & 0 deletions wadsrc/static/zscript/games/duke/actors/redneckenemies.zs
Expand Up @@ -8,6 +8,7 @@ class RedneckBikerBV2 : DukeActor
+KILLCOUNT;
+LOOKALLAROUND;
watermovefactor 0.5;
gravityfactor 0.125;
}
override void Initialize()
{
Expand All @@ -25,6 +26,7 @@ class RedneckBikerB : DukeActor
+KILLCOUNT;
+LOOKALLAROUND;
watermovefactor 0.5;
gravityfactor 0.25;
}
override void Initialize()
{
Expand Down Expand Up @@ -74,6 +76,7 @@ class RedneckCheerleaderB : DukeActor
+KILLCOUNT;
+LOOKALLAROUND;
watermovefactor 0.5;
gravityfactor 0.25;
}
override void Initialize()
{
Expand Down
2 changes: 2 additions & 0 deletions wadsrc/static/zscript/games/duke/dukeactor.zs
Expand Up @@ -124,6 +124,7 @@ class DukeActor : CoreActor native
floating_ceilingdist 66;
landmovefactor 1;
watermovefactor 1;
gravityfactor 1;
}
enum EStatnums
{
Expand Down Expand Up @@ -258,6 +259,7 @@ class DukeActor : CoreActor native
meta double floating_ceilingdist;
meta double landmovefactor;
meta double watermovefactor;
meta double gravityfactor;

property prefix: none;
property gutsoffset: gutsoffset;
Expand Down

0 comments on commit 756be28

Please sign in to comment.