added friction and colormap related properties from DSDA.

This commit is contained in:
Christoph Oelckers 2023-10-29 16:50:20 +01:00
parent 4ddffd233a
commit 9a94472650
3 changed files with 31 additions and 1 deletions

View file

@ -361,6 +361,11 @@ Note: All <bool> fields default to false unless mentioned otherwise.
scroll_floor_x = <float>;
scroll_floor_y = <float>;
scroll_floor_type = <string>;
friction = <float>; // sets the sector's friction factor. Must be between 0 and 1.
movefactor = <float> // sets the sector's movement acceleration factor. Must be > 0.
colormap = <string>; // only provided for backwards compatibility. Do not use in GZDoom projects.
* Note about dropactors

View file

@ -197,6 +197,7 @@ private:
void CreateScroller(EScroll type, double dx, double dy, sector_t *sect, side_t* side, int accel, EScrollPos scrollpos = EScrollPos::scw_all, int scrollmode = 15/*SCROLL_All*/);
void SpawnScrollers();
void SpawnFriction();
void SpawnUDMFFriction(double friction_factor, double move_factor, sector_t* sec);
void SpawnPushers();
AActor *GetPushThing (int s);
void SpawnPortal(line_t *line, int sectortag, int plane, int bytealpha, int linked);

View file

@ -1637,6 +1637,8 @@ public:
double scroll_floor_y = 0;
int scroll_floor_type = 0;
double friction = -FLT_MAX, movefactor = -FLT_MAX;
const double scrollfactor = 1 / 3.2; // I hope this is correct, it's just a guess taken from Eternity's code.
memset(sec, 0, sizeof(*sec));
@ -2110,7 +2112,19 @@ public:
break;
}
// These two are used by Eternity for something I do not understand.
case NAME_colormap:
sec->selfmap = R_ColormapNumForName(CheckString(key));
break;
case NAME_frictionfactor:
friction = CheckFloat(key);
break;
case NAME_movefactor:
movefactor = CheckFloat(key);
break;
// These two are used by Eternity for something I do not understand.
//case NAME_portal_ceil_useglobaltex:
//case NAME_portal_floor_useglobaltex:
@ -2236,6 +2250,16 @@ public:
sec->Colormap.Desaturation = clamp(desaturation, 0, 255);
sec->Colormap.FogDensity = clamp(fogdensity, 0, 512) / 2;
}
if (friction > -FLT_MAX)
{
sec->friction = clamp(friction, 0., 1.);
sec->movefactor = FrictionToMoveFactor(sec->friction);
sec->Flags |= SECF_FRICTION;
}
if (movefactor > -FLT_MAX)
{
sec->movefactor = max(movefactor, 1 / 2048.);
}
}
//===========================================================================