diff --git a/extras/conf/udb/Includes/SRB222_misc.cfg b/extras/conf/udb/Includes/SRB222_misc.cfg index bc284a3f9a7e05ceff4b554adffa7527bc7c5506..e8da74e996ba128d4bb5d07887702e735abd183c 100644 --- a/extras/conf/udb/Includes/SRB222_misc.cfg +++ b/extras/conf/udb/Includes/SRB222_misc.cfg @@ -250,8 +250,8 @@ universalfields friction { - type = 0; - default = 0; + type = 1; + default = 0.90625; } triggertag diff --git a/src/lua_maplib.c b/src/lua_maplib.c index 4bbd826ef6b2662716ba1cb5411a966237054a7b..41ed0bbdc9dd595e393157138bbf00386b1d356d 100644 --- a/src/lua_maplib.c +++ b/src/lua_maplib.c @@ -679,7 +679,7 @@ static int sector_get(lua_State *L) lua_pushinteger(L, (UINT8)sector->triggerer); return 1; case sector_friction: // friction - lua_pushinteger(L, sector->friction); + lua_pushfixed(L, sector->friction); return 1; case sector_gravity: // gravity lua_pushfixed(L, sector->gravity); diff --git a/src/p_setup.c b/src/p_setup.c index 5d8bc9cc02dfcdcc15f2593eee02a3515b1053aa..2e6b89ce1f8c1e795cc6d3b08069195330213c73 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -1054,6 +1054,8 @@ static void P_LoadSectors(UINT8 *data) ss->triggertag = 0; ss->triggerer = TO_PLAYER; + ss->friction = ORIG_FRICTION; + P_InitializeSector(ss); } } @@ -1720,7 +1722,7 @@ static void ParseTextmapSectorParameter(UINT32 i, char *param, char *val) else if (fastcmp(param, "ropehang") && fastcmp("true", val)) sectors[i].specialflags |= SSF_ROPEHANG; else if (fastcmp(param, "friction")) - sectors[i].friction = atol(val); + sectors[i].friction = FLOAT_TO_FIXED(atof(val)); else if (fastcmp(param, "gravity")) sectors[i].gravity = FLOAT_TO_FIXED(atof(val)); else if (fastcmp(param, "damagetype")) @@ -2034,6 +2036,8 @@ static void P_LoadTextmap(void) sc->triggertag = 0; sc->triggerer = TO_PLAYER; + sc->friction = ORIG_FRICTION; + textmap_colormap.used = false; textmap_colormap.lightcolor = 0; textmap_colormap.lightalpha = 25; @@ -4921,8 +4925,20 @@ static void P_ConvertBinaryMap(void) case 540: //Floor friction { INT32 s; + fixed_t strength; // friction value of sector + fixed_t friction; // friction value to be applied during movement + + strength = sides[lines[i].sidenum[0]].textureoffset >> FRACBITS; + if (strength > 0) // sludge + strength = strength*2; // otherwise, the maximum sludginess value is +967... + + // The following might seem odd. At the time of movement, + // the move distance is multiplied by 'friction/0x10000', so a + // higher friction value actually means 'less friction'. + friction = ORIG_FRICTION - (0x1EB8*strength)/0x80; // ORIG_FRICTION is 0xE800 + TAG_ITER_SECTORS(tag, s) - sectors[s].friction = sides[lines[i].sidenum[0]].textureoffset >> FRACBITS; + sectors[s].friction = friction; break; } case 541: //Wind diff --git a/src/p_spec.c b/src/p_spec.c index 73a095fde9b60cabfae8ecbc02a4feaea206ed9d..4d6b8341468585b96bed63f276eb44c619f89102 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -8337,23 +8337,15 @@ static void P_SpawnFriction(void) size_t i; sector_t *s = sectors; - fixed_t strength; // friction value of sector fixed_t friction; // friction value to be applied during movement INT32 movefactor; // applied to each player move to simulate inertia for (i = 0; i < numsectors; i++, s++) { - if (!s->friction) + if (s->friction == ORIG_FRICTION) continue; - strength = s->friction; - if (strength > 0) // sludge - strength = strength*2; // otherwise, the maximum sludginess value is +967... - - // The following might seem odd. At the time of movement, - // the move distance is multiplied by 'friction/0x10000', so a - // higher friction value actually means 'less friction'. - friction = ORIG_FRICTION - (0x1EB8*strength)/0x80; // ORIG_FRICTION is 0xE800 + friction = s->friction; if (friction > FRACUNIT) friction = FRACUNIT; diff --git a/src/r_defs.h b/src/r_defs.h index c56abdbfdf79d7a34e33708267b4adea36781d5b..ce3ffaad9da305fef935dbfe8d65db0d309324d6 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -428,7 +428,7 @@ typedef struct sector_s mtag_t triggertag; // tag to call upon triggering UINT8 triggerer; // who can trigger? - INT32 friction; + fixed_t friction; // Sprite culling feature struct line_s *cullheight;