From 5e516eb98d5f1ddff1afcb2bb9247349d244d533 Mon Sep 17 00:00:00 2001 From: Jaime Passos Date: Sat, 8 Feb 2020 18:50:05 -0300 Subject: [PATCH 1/5] 1 left shifted by zero is still 1 --- src/dehacked.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index 45f00b8cf..5fd12b774 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -1293,10 +1293,7 @@ static void readgametype(MYFILE *f, char *gtname) UINT32 wordgt = 0; for (j = 0; GAMETYPERULE_LIST[j]; j++) if (fastcmp(word, GAMETYPERULE_LIST[j])) { - if (!j) // GTR_CAMPAIGN - wordgt |= 1; - else - wordgt |= (1< Date: Mon, 10 Feb 2020 00:06:16 -0600 Subject: [PATCH 2/5] Improvements to polyobjects carrying things: - Fixed loss of precision in rotate carry causing objects to slide off - Adjusted player carrying logic to make platforms less slippery - Finally obsoleted the player-specific rotate hack now that I found the actual problem :] --- src/p_polyobj.c | 52 ++++++++++++++++++++++++++++++------------------- src/p_user.c | 4 +++- 2 files changed, 35 insertions(+), 21 deletions(-) diff --git a/src/p_polyobj.c b/src/p_polyobj.c index cd0a44bb4..a206d0171 100644 --- a/src/p_polyobj.c +++ b/src/p_polyobj.c @@ -1001,15 +1001,35 @@ static void Polyobj_pushThing(polyobj_t *po, line_t *line, mobj_t *mo) // static void Polyobj_slideThing(mobj_t *mo, fixed_t dx, fixed_t dy) { - if (mo->player) { // Do something similar to conveyor movement. -Red - mo->player->cmomx += dx; - mo->player->cmomy += dy; + if (mo->player) { // Finally this doesn't suck eggs -fickle + fixed_t cdx, cdy; - dx = FixedMul(dx, CARRYFACTOR); - dy = FixedMul(dy, CARRYFACTOR); + cdx = FixedMul(dx, FRACUNIT-CARRYFACTOR); + cdy = FixedMul(dy, FRACUNIT-CARRYFACTOR); - mo->player->cmomx -= dx; - mo->player->cmomy -= dy; + if (mo->player->onconveyor == 1) + { + mo->momx += cdx; + mo->momy += cdy; + + // Multiple slides in the same tic, somehow + mo->player->cmomx += cdx; + mo->player->cmomy += cdy; + } + else + { + if (mo->player->onconveyor == 3) + { + mo->momx += cdx - mo->player->cmomx; + mo->momy += cdy - mo->player->cmomy; + } + + mo->player->cmomx = cdx; + mo->player->cmomy = cdy; + } + + dx = FixedMul(dx, FRACUNIT - mo->friction); + dy = FixedMul(dy, FRACUNIT - mo->friction); if (mo->player->pflags & PF_SPINNING && (mo->player->rmomx || mo->player->rmomy) && !(mo->player->pflags & PF_STARTDASH)) { #define SPINMULT 5184 // Consider this a substitute for properly calculating FRACUNIT-friction. I'm tired. -Red @@ -1282,7 +1302,8 @@ static void Polyobj_rotateThings(polyobj_t *po, vertex_t origin, angle_t delta, { static INT32 pomovecount = 10000; INT32 x, y; - angle_t deltafine = delta >> ANGLETOFINESHIFT; + angle_t deltafine = (((po->angle + delta) >> ANGLETOFINESHIFT) - (po->angle >> ANGLETOFINESHIFT)) & FINEMASK; + // This fineshift trickery replaces the old delta>>ANGLETOFINESHIFT; doing it this way avoids loss of precision causing objects to slide off -fickle pomovecount++; @@ -1334,19 +1355,10 @@ static void Polyobj_rotateThings(polyobj_t *po, vertex_t origin, angle_t delta, oldxoff = mo->x-origin.x; oldyoff = mo->y-origin.y; - if (mo->player) // Hack to fix players sliding off of spinning polys -Red - { - fixed_t temp; + newxoff = FixedMul(oldxoff, c)-FixedMul(oldyoff, s) - oldxoff; + newyoff = FixedMul(oldyoff, c)+FixedMul(oldxoff, s) - oldyoff; - temp = FixedMul(oldxoff, c)-FixedMul(oldyoff, s); - oldyoff = FixedMul(oldyoff, c)+FixedMul(oldxoff, s); - oldxoff = temp; - } - - newxoff = FixedMul(oldxoff, c)-FixedMul(oldyoff, s); - newyoff = FixedMul(oldyoff, c)+FixedMul(oldxoff, s); - - Polyobj_slideThing(mo, newxoff-oldxoff, newyoff-oldyoff); + Polyobj_slideThing(mo, newxoff, newyoff); if (turnthings == 2 || (turnthings == 1 && !mo->player)) { mo->angle += delta; diff --git a/src/p_user.c b/src/p_user.c index 176b07d0a..a63022986 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -12174,7 +12174,9 @@ void P_PlayerThink(player_t *player) #ifdef POLYOBJECTS if (player->onconveyor == 1) - player->cmomy = player->cmomx = 0; + player->onconveyor = 3; + else if (player->onconveyor == 3) + player->cmomy = player->cmomx = 0; #endif P_DoSuperStuff(player); From b7a6773ff5c7e22b5c4a0a7a86dfa6e0c6e84598 Mon Sep 17 00:00:00 2001 From: fickleheart Date: Tue, 11 Feb 2020 23:24:43 -0600 Subject: [PATCH 3/5] Don't error when checking patch.valid on invalid patches --- src/lua_hudlib.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/lua_hudlib.c b/src/lua_hudlib.c index f451944e3..b58a82299 100644 --- a/src/lua_hudlib.c +++ b/src/lua_hudlib.c @@ -270,8 +270,13 @@ static int patch_get(lua_State *L) // patches are CURRENTLY always valid, expected to be cached with PU_STATIC // this may change in the future, so patch.valid still exists - if (!patch) + if (!patch) { + if (field == patch_valid) { + lua_pushboolean(L, 0); + return 1; + } return LUA_ErrInvalid(L, "patch_t"); + } switch (field) { From d3e5cbffbad67766b0b559f631b68da22d80d44d Mon Sep 17 00:00:00 2001 From: colette Date: Wed, 12 Feb 2020 08:54:20 -0500 Subject: [PATCH 4/5] comment --- src/lua_hudlib.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/lua_hudlib.c b/src/lua_hudlib.c index b58a82299..6e3c1181d 100644 --- a/src/lua_hudlib.c +++ b/src/lua_hudlib.c @@ -268,8 +268,7 @@ static int patch_get(lua_State *L) #endif enum patch field = luaL_checkoption(L, 2, NULL, patch_opt); - // patches are CURRENTLY always valid, expected to be cached with PU_STATIC - // this may change in the future, so patch.valid still exists + // patches are invalidated when switching renderers if (!patch) { if (field == patch_valid) { lua_pushboolean(L, 0); From 841094976b8a84ed56942cea96515cb9b19245e5 Mon Sep 17 00:00:00 2001 From: James R Date: Wed, 12 Feb 2020 18:02:36 -0800 Subject: [PATCH 5/5] Add flag name variant of SF_NONIGHTSROTATION to S_SKIN --- src/r_things.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/r_things.c b/src/r_things.c index 7f0f43281..ca285644f 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -3463,6 +3463,7 @@ static boolean R_ProcessPatchableFields(skin_t *skin, char *stoken, char *value) GETFLAG(DASHMODE) GETFLAG(FASTEDGE) GETFLAG(MULTIABILITY) + GETFLAG(NONIGHTSROTATION) #undef GETFLAG else // let's check if it's a sound, otherwise error out