From 262c73ba7fe72ac5a34acea775dc8916c5a57f33 Mon Sep 17 00:00:00 2001 From: NepDisk <16447892+NepDisk@users.noreply.github.com> Date: Mon, 2 Sep 2024 18:01:03 -0400 Subject: [PATCH 1/4] fix cmake build --- src/sdl/i_system.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c index 691aaab28..cd71c7d4f 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -24,7 +24,7 @@ /// \brief SRB2 system stuff for SDL #ifdef CMAKECONFIG -#include "config.h" +#include "../config.h" #else #include "../config.h.in" #endif From 24e2e06b1fc528d26854f9970d62175463274ae2 Mon Sep 17 00:00:00 2001 From: NepDisk <16447892+NepDisk@users.noreply.github.com> Date: Mon, 2 Sep 2024 22:56:54 -0400 Subject: [PATCH 2/4] use og fraction value --- src/p_spec.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_spec.h b/src/p_spec.h index e62796bc8..72d43f8a8 100644 --- a/src/p_spec.h +++ b/src/p_spec.h @@ -524,7 +524,7 @@ typedef struct } friction_t; // Friction defines. -#define ORIG_FRICTION (0xF5 << (FRACBITS-8)) ///< Original value. +#define ORIG_FRICTION (62914) ///< Original value. void T_Friction(friction_t *f); From 84b7d363be41e9b6faa1e8c87378e5ba3ba18280 Mon Sep 17 00:00:00 2001 From: NepDisk <16447892+NepDisk@users.noreply.github.com> Date: Mon, 2 Sep 2024 23:25:05 -0400 Subject: [PATCH 3/4] Make low friciton how it is in kart --- src/k_terrain.c | 71 ------------------------------------------------- src/p_mobj.c | 15 ++++++----- src/p_spec.c | 31 ++++++++++++++++----- 3 files changed, 33 insertions(+), 84 deletions(-) diff --git a/src/k_terrain.c b/src/k_terrain.c index ce0baab36..1b202fa67 100644 --- a/src/k_terrain.c +++ b/src/k_terrain.c @@ -548,77 +548,6 @@ void K_ProcessTerrainEffect(mobj_t *mo) // (Offroad is handled elsewhere!) } -/*-------------------------------------------------- - void K_SetDefaultFriction(mobj_t *mo) - - See header file for description. ---------------------------------------------------*/ -void K_SetDefaultFriction(mobj_t *mo) -{ - boolean isPlayer = false; - - if (mo == NULL || P_MobjWasRemoved(mo) == true) - { - // Invalid object. - return; - } - - isPlayer = (mo->player != NULL); - - mo->friction = ORIG_FRICTION; - - if (isPlayer == true) - { - mo->movefactor = FRACUNIT; - } - - if (mo->terrain != NULL) - { - fixed_t strength = mo->terrain->friction; - - fixed_t newFriction = INT32_MAX; - fixed_t newMovefactor = INT32_MAX; - - 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'. - newFriction = ORIG_FRICTION - FixedMul(0x1EB8, strength) / 0x80; // ORIG_FRICTION is 0xE800 - - if (newFriction > FRACUNIT) - { - newFriction = FRACUNIT; - } - - if (newFriction < 0) - { - newFriction = 0; - } - - mo->friction = newFriction; - - if (isPlayer == true) - { - newMovefactor = FixedDiv(ORIG_FRICTION, newFriction); - - if (newMovefactor < FRACUNIT) - { - newMovefactor = 19*newMovefactor - 18*FRACUNIT; - } - else - { - newMovefactor = FRACUNIT; - } - - mo->movefactor = newMovefactor; - } - } -} - /*-------------------------------------------------- static void K_SpawnSplashParticles(mobj_t *mo, t_splash_t *s, fixed_t impact) diff --git a/src/p_mobj.c b/src/p_mobj.c index 1fced3907..ab9a24fbe 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -1341,6 +1341,7 @@ static void P_SceneryXYFriction(mobj_t *mo, fixed_t oldx, fixed_t oldy) { // Stolen from P_SpawnFriction mo->friction = FRACUNIT - 0x100; + //mo->movefactor = ((0x10092 - mo->friction)*(0x70))/0x158; } else mo->friction = ORIG_FRICTION; @@ -1362,21 +1363,23 @@ static void P_XYFriction(mobj_t *mo, fixed_t oldx, fixed_t oldy) player = mo->player; if (player) // valid only if player avatar { - if (FixedHypot(player->rmomx, player->rmomy) < FixedMul(STOPSPEED, mo->scale) && (K_GetForwardMove(player) == 0) - && !(player->mo->standingslope && (!(player->mo->standingslope->flags & SL_NOPHYSICS)) /*&& (abs(player->mo->standingslope->zdelta) >= FRACUNIT/2)*/)) + if (abs(player->rmomx) < FixedMul(STOPSPEED, mo->scale) + && abs(player->rmomy) < FixedMul(STOPSPEED, mo->scale) + && (!(player->cmd.forwardmove && !player->cmd.sidemove)) + && !(player->mo->standingslope && (!(player->mo->standingslope->flags & SL_NOPHYSICS)) && (abs(player->mo->standingslope->zdelta) >= FRACUNIT/2)) + ) { // if in a walking frame, stop moving if (player->panim == PA_SLOW) { P_SetPlayerMobjState(mo, S_KART_STILL); } - mo->momx = player->cmomx; mo->momy = player->cmomy; } else { - if (oldx == mo->x && oldy == mo->y) + if (oldx == mo->x && oldy == mo->y) // didn't go anywhere { mo->momx = FixedMul(mo->momx, ORIG_FRICTION); mo->momy = FixedMul(mo->momy, ORIG_FRICTION); @@ -1387,13 +1390,11 @@ static void P_XYFriction(mobj_t *mo, fixed_t oldx, fixed_t oldy) mo->momy = FixedMul(mo->momy, mo->friction); } - K_SetDefaultFriction(mo); + mo->friction = ORIG_FRICTION; } } else - { P_SceneryXYFriction(mo, oldx, oldy); - } } static void P_PushableCheckBustables(mobj_t *mo) diff --git a/src/p_spec.c b/src/p_spec.c index ef4383103..4a873a53b 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -8215,10 +8215,22 @@ void T_Friction(friction_t *f) sec = sectors + f->affectee; - // Get FOF control sector + // Get FOF control sector (was "Make sure the sector type hasn't changed") if (f->roverfriction) + //{ referrer = sectors + f->referrer; + /* if (!(GETSECSPECIAL(referrer->special, 3) == 1 + || GETSECSPECIAL(referrer->special, 3) == 3)) + return; + } + else + { + if (!(GETSECSPECIAL(sec->special, 3) == 1 + || GETSECSPECIAL(sec->special, 3) == 3)) + return; + }*/ + // Assign the friction value to players on the floor, non-floating, // and clipped. Normally the object's friction value is kept at // ORIG_FRICTION and this thinker changes it for icy or muddy floors. @@ -8234,8 +8246,7 @@ void T_Friction(friction_t *f) // apparently, all I had to do was comment out part of the next line and // friction works for all mobj's // (or at least MF_PUSHABLEs, which is all I care about anyway) - // Readded v1 kart condition - Nep - if (!(thing->flags & (MF_NOGRAVITY | MF_NOCLIP)) && thing->z == thing->floorz && (thing->player + if ((!(thing->flags & (MF_NOGRAVITY | MF_NOCLIP)) && thing->z == thing->floorz) && (thing->player && (thing->player->invincibilitytimer == 0 && thing->player->hyudorotimer == 0 && thing->player->sneakertimer == 0 && thing->player->growshrinktimer <= 0))) { @@ -8277,7 +8288,7 @@ static void P_SpawnFriction(void) line_t *l = lines; mtag_t tag; register INT32 s; - fixed_t strength; // frontside texture offset controls magnitude + fixed_t strength; // frontside texture offset controls magnitude //fixed_t length; // line length controls magnitude fixed_t friction; // friction value to be applied during movement INT32 movefactor; // applied to each player move to simulate inertia @@ -8285,11 +8296,13 @@ static void P_SpawnFriction(void) if (l->special == 540) { tag = Tag_FGet(&l->tags); + //length = P_AproxDistance(l->dx, l->dy)>>FRACBITS; + //friction = (0x1EB8*length)/0x80 + 0xD000; strength = sides[l->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 following check 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 @@ -8299,11 +8312,17 @@ static void P_SpawnFriction(void) if (friction < 0) friction = 0; + //if (friction > ORIG_FRICTION) // ice + // movefactor = ((0x10092 - friction)*(0x70))/0x158; movefactor = FixedDiv(ORIG_FRICTION, friction); if (movefactor < FRACUNIT) movefactor = 19*movefactor - 18*FRACUNIT; else - movefactor = FRACUNIT; + movefactor = FRACUNIT; //movefactor = ((friction - 0xDB34)*(0xA))/0x80; + + // killough 8/28/98: prevent odd situations + if (movefactor < 32) + movefactor = 32; TAG_ITER_SECTORS(tag, s) Add_Friction(friction, movefactor, s, -1); From 077835e4aecce5c1ba5c71bd91742445b5e90a19 Mon Sep 17 00:00:00 2001 From: NepDisk <16447892+NepDisk@users.noreply.github.com> Date: Tue, 3 Sep 2024 11:50:47 -0400 Subject: [PATCH 4/4] Update New springs doomed nums this is to prevent conflict with kart mods --- extras/conf/D3RBinary-Config.cfg | 10 +++++----- extras/conf/udb/Includes/Kart2_things.cfg | 10 +++++----- src/info.c | 10 +++++----- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/extras/conf/D3RBinary-Config.cfg b/extras/conf/D3RBinary-Config.cfg index 8070d67af..21ea69949 100644 --- a/extras/conf/D3RBinary-Config.cfg +++ b/extras/conf/D3RBinary-Config.cfg @@ -3445,35 +3445,35 @@ thingtypes sprite = "SPDBA2A8"; flags8text = "[8] Rotate 22.5° CCW"; } - 557 + 2171 { arrow = 1; title = "Diagonal Grey Spring"; sprite = "SPDGA2A8"; flags8text = "[8] Rotate 22.5° CCW"; } - 558 + 2172 { arrow = 1; title = "Horizontal Yellow Spring"; sprite = "SPHYA2A8"; flags8text = "[8] Rotate 22.5° CCW"; } - 559 + 2173 { arrow = 1; title = "Horizontal Red Spring"; sprite = "SPHRA2A8"; flags8text = "[8] Rotate 22.5° CCW"; } - 560 + 2174 { arrow = 1; title = "Horizontal Blue Spring"; sprite = "SPHBA2A8"; flags8text = "[8] Rotate 22.5° CCW"; } - 561 + 2175 { arrow = 1; title = "Horizontal Grey Spring"; diff --git a/extras/conf/udb/Includes/Kart2_things.cfg b/extras/conf/udb/Includes/Kart2_things.cfg index da7e976d3..0b755fea8 100644 --- a/extras/conf/udb/Includes/Kart2_things.cfg +++ b/extras/conf/udb/Includes/Kart2_things.cfg @@ -915,35 +915,35 @@ springs sprite = "SPDBA2A8"; flags8text = "[8] Rotate 22.5° CCW"; } - 557 + 2171 { arrow = 1; title = "Diagonal Grey Spring"; sprite = "SPDGA2A8"; flags8text = "[8] Rotate 22.5° CCW"; } - 558 + 2172 { arrow = 1; title = "Horizontal Yellow Spring"; sprite = "SPHYA2A8"; flags8text = "[8] Rotate 22.5° CCW"; } - 559 + 2173 { arrow = 1; title = "Horizontal Red Spring"; sprite = "SPHRA2A8"; flags8text = "[8] Rotate 22.5° CCW"; } - 560 + 2174 { arrow = 1; title = "Horizontal Blue Spring"; sprite = "SPHBA2A8"; flags8text = "[8] Rotate 22.5° CCW"; } - 561 + 2175 { arrow = 1; title = "Horizontal Grey Spring"; diff --git a/src/info.c b/src/info.c index 8dd30b0bb..6a5e7e068 100644 --- a/src/info.c +++ b/src/info.c @@ -8302,7 +8302,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = }, { // MT_GREYDIAG - 558, // doomednum + 2171, // doomednum S_GDIAG1, // spawnstate 1, // spawnhealth S_GDIAG2, // seestate @@ -8329,7 +8329,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = }, { // MT_YELLOWHORIZ - 559, // doomednum + 2172, // doomednum S_YHORIZ1, // spawnstate 1, // spawnhealth S_YHORIZ2, // seestate @@ -8356,7 +8356,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = }, { // MT_REDHORIZ - 560, // doomednum + 2173, // doomednum S_RHORIZ1, // spawnstate 1, // spawnhealth S_RHORIZ2, // seestate @@ -8383,7 +8383,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = }, { // MT_BLUEHORIZ - 561, // doomednum + 2174, // doomednum S_BHORIZ1, // spawnstate 1, // spawnhealth S_BHORIZ2, // seestate @@ -8410,7 +8410,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = }, { // MT_GREYHORIZ - 562, // doomednum + 2175, // doomednum S_GHORIZ1, // spawnstate 1, // spawnhealth S_GHORIZ2, // seestate