From e2037f149e61d37656d45cc6b3f1675c1d4180d6 Mon Sep 17 00:00:00 2001 From: NepDisk <16447892+NepDisk@users.noreply.github.com> Date: Mon, 29 Jul 2024 02:23:54 -0400 Subject: [PATCH] Fix skyboxes, and make butteredslopes nice --- src/deh_soc.c | 3 +++ src/info.c | 2 +- src/p_slopes.c | 42 +++++++++++++++++++----------------------- 3 files changed, 23 insertions(+), 24 deletions(-) diff --git a/src/deh_soc.c b/src/deh_soc.c index 8617ad3bb..c600d21f7 100644 --- a/src/deh_soc.c +++ b/src/deh_soc.c @@ -1551,6 +1551,9 @@ void readlevelheader(MYFILE *f, INT32 num) else if (fastcmp(word, "SKYTEXTURE")) deh_strlcpy(mapheaderinfo[num-1]->skytexture, word2, sizeof(mapheaderinfo[num-1]->skytexture), va("Level header %d: sky texture", num)); + else if (fastcmp(word, "SKYNUM")) + deh_strlcpy(mapheaderinfo[num-1]->skytexture, va("SKY%s", word2), + sizeof(mapheaderinfo[num-1]->skytexture), va("Level header %d: sky texture", num)); else if (fastcmp(word, "PRECUTSCENENUM")) mapheaderinfo[num-1]->precutscenenum = (UINT8)i; else if (fastcmp(word, "CUTSCENENUM")) diff --git a/src/info.c b/src/info.c index 794689a6f..f8d573ab4 100644 --- a/src/info.c +++ b/src/info.c @@ -3843,7 +3843,7 @@ state_t states[NUMSTATES] = {SPR_RNDM, 18|FF_FULLBRIGHT|FF_ANIMATE|FF_GLOBALANIM, 4, {NULL}, 1, 1, S_RANDOMITEM11}, // S_RANDOMITEM10 {SPR_RNDM, 20|FF_FULLBRIGHT|FF_ANIMATE|FF_GLOBALANIM, 4, {NULL}, 1, 1, S_RANDOMITEM12}, // S_RANDOMITEM11 {SPR_RNDM, 22|FF_FULLBRIGHT|FF_ANIMATE|FF_GLOBALANIM, 4, {NULL}, 1, 1, S_RANDOMITEM1}, // S_RANDOMITEM12 - {SPR_NULL, 0, 0, {A_ItemPop}, 0, 0, S_NULL}, // S_DEADRANDOMITEM + {SPR_NULL, 0, 0, {A_ItemPop}, 0, 0, S_RANDOMITEM1}, // S_DEADRANDOMITEM {SPR_SBOX, FF_FULLBRIGHT|FF_ANIMATE|FF_GLOBALANIM, 4, {NULL}, 1, 1, S_SPHEREBOX2}, // S_SPHEREBOX1 {SPR_SBOX, 2|FF_FULLBRIGHT|FF_ANIMATE|FF_GLOBALANIM, 4, {NULL}, 1, 1, S_SPHEREBOX3}, // S_SPHEREBOX2 diff --git a/src/p_slopes.c b/src/p_slopes.c index 6c749506b..871ef929b 100644 --- a/src/p_slopes.c +++ b/src/p_slopes.c @@ -1069,47 +1069,43 @@ void P_ButteredSlope(mobj_t *mo) { fixed_t thrust; + if (!mo->standingslope) + return; + + if (mo->standingslope->flags & SL_NOPHYSICS) + return; // No physics, no butter. + if (mo->flags & (MF_NOCLIPHEIGHT|MF_NOGRAVITY)) return; // don't slide down slopes if you can't touch them or you're not affected by gravity - if (P_CanApplySlopePhysics(mo, mo->standingslope) == false) - return; // No physics, no butter. + if (mo->player) { + if (abs(mo->standingslope->zdelta) < FRACUNIT/4) + return; // Don't slide on non-steep slopes unless spinning - if (mo->player != NULL) - { - if (abs(mo->standingslope->zdelta) < FRACUNIT/21) - { - // Don't slide on non-steep slopes. - // Changed in Ring Racers to only not apply physics on very slight slopes. - // (I think about 4 degree angles.) - return; - } - - if (abs(mo->standingslope->zdelta) < FRACUNIT/2 - && !(mo->player->rmomx || mo->player->rmomy)) - { - // Allow the player to stand still on slopes below a certain steepness. - // 45 degree angle steep, to be exact. - return; - } + if (abs(mo->standingslope->zdelta) < FRACUNIT/2 && !(mo->player->rmomx || mo->player->rmomy)) + return; // Allow the player to stand still on slopes below a certain steepness } - thrust = FINESINE(mo->standingslope->zangle>>ANGLETOFINESHIFT) * 5 / 4 * (mo->eflags & MFE_VERTICALFLIP ? 1 : -1); + thrust = FINESINE(mo->standingslope->zangle>>ANGLETOFINESHIFT) * 15 / 16 * (mo->eflags & MFE_VERTICALFLIP ? 1 : -1); if (mo->player) { - fixed_t mult = FRACUNIT; + fixed_t mult = 0; if (mo->momx || mo->momy) { angle_t angle = R_PointToAngle2(0, 0, mo->momx, mo->momy) - mo->standingslope->xydirection; if (P_MobjFlip(mo) * mo->standingslope->zdelta < 0) angle ^= ANGLE_180; - mult = FRACUNIT + (FRACUNIT + FINECOSINE(angle>>ANGLETOFINESHIFT))*4/3; + mult = FINECOSINE(angle >> ANGLETOFINESHIFT); } - thrust = FixedMul(thrust, mult); + thrust = FixedMul(thrust, FRACUNIT*2/3 + mult/8); } + if (mo->momx || mo->momy) // Slightly increase thrust based on the object's speed + thrust = FixedMul(thrust, FRACUNIT+P_AproxDistance(mo->momx, mo->momy)/16); + // This makes it harder to zigzag up steep slopes, as well as allows greater top speed when rolling down + // Let's get the gravity strength for the object... thrust = FixedMul(thrust, abs(P_GetMobjGravity(mo)));