From 7174b707a178e9ec1a2abc57ac686e34fcae96c4 Mon Sep 17 00:00:00 2001 From: Sally Cochenour Date: Sun, 8 Mar 2020 00:39:21 -0500 Subject: [PATCH 1/5] Draw distance uses object scale --- src/hardware/hw_main.c | 4 ++-- src/r_main.c | 2 +- src/r_things.c | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 6ccaf1bc5..73e65cceb 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -5357,7 +5357,7 @@ static void HWR_AddSprites(sector_t *sec) // Handle all things in sector. // If a limit exists, handle things a tiny bit different. - if ((limit_dist = (fixed_t)(/*(maptol & TOL_NIGHTS) ? cv_drawdist_nights.value : */cv_drawdist.value) << FRACBITS)) + if ((limit_dist = (fixed_t)(cv_drawdist.value) * mapobjectscale)) { for (thing = sec->thinglist; thing; thing = thing->snext) { @@ -5424,7 +5424,7 @@ static void HWR_AddSprites(sector_t *sec) #ifdef HWPRECIP // No to infinite precipitation draw distance. - if ((limit_dist = (fixed_t)cv_drawdist_precip.value << FRACBITS)) + if ((limit_dist = (fixed_t)(cv_drawdist_precip.value) * mapobjectscale)) { for (precipthing = sec->preciplist; precipthing; precipthing = precipthing->snext) { diff --git a/src/r_main.c b/src/r_main.c index a4fa9d463..13fce289e 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -176,7 +176,7 @@ consvar_t cv_showhud = {"showhud", "Yes", CV_CALL, CV_YesNo, R_SetViewSize, 0, consvar_t cv_translucenthud = {"translucenthud", "10", CV_SAVE, translucenthud_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_translucency = {"translucency", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_drawdist = {"drawdist", "Infinite", CV_SAVE, drawdist_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_drawdist = {"drawdist", "8192", CV_SAVE, drawdist_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; //consvar_t cv_drawdist_nights = {"drawdist_nights", "2048", CV_SAVE, drawdist_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_drawdist_precip = {"drawdist_precip", "1024", CV_SAVE, drawdist_precip_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; //consvar_t cv_precipdensity = {"precipdensity", "Moderate", CV_SAVE, precipdensity_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; diff --git a/src/r_things.c b/src/r_things.c index 9ea8bb77b..4b7339c4e 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -2102,7 +2102,7 @@ void R_AddSprites(sector_t *sec, INT32 lightlevel) // Handle all things in sector. // If a limit exists, handle things a tiny bit different. - if ((limit_dist = (fixed_t)(/*(maptol & TOL_NIGHTS) ? cv_drawdist_nights.value : */cv_drawdist.value) << FRACBITS)) + if ((limit_dist = (fixed_t)(cv_drawdist.value) * mapobjectscale)) { for (thing = sec->thinglist; thing; thing = thing->snext) { @@ -2168,7 +2168,7 @@ void R_AddSprites(sector_t *sec, INT32 lightlevel) } // no, no infinite draw distance for precipitation. this option at zero is supposed to turn it off - if ((limit_dist = (fixed_t)cv_drawdist_precip.value << FRACBITS)) + if ((limit_dist = (fixed_t)(cv_drawdist_precip.value) * mapobjectscale)) { for (precipthing = sec->preciplist; precipthing; precipthing = precipthing->snext) { From fecb2cdebdfae7c43df21208d794fa380ea7edb1 Mon Sep 17 00:00:00 2001 From: Sally Cochenour Date: Sun, 8 Mar 2020 00:48:56 -0500 Subject: [PATCH 2/5] Fix item lobbing in mobjscale maps This happened when I was trying to fix several mobjscale issues at once for v1 -- I either didn't notice the P_SetObjectMomZ, or didn't realize that this function already handles scale changes for you. --- src/k_kart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/k_kart.c b/src/k_kart.c index 64320fb68..b3f4a848e 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -3658,7 +3658,7 @@ static mobj_t *K_ThrowKartItem(player_t *player, boolean missile, mobjtype_t map if (mo) { angle_t fa = player->mo->angle>>ANGLETOFINESHIFT; - fixed_t HEIGHT = (20 + (dir*10))*mapobjectscale + (player->mo->momz*P_MobjFlip(player->mo)); + fixed_t HEIGHT = (20 + (dir*10))*FRACUNIT + (player->mo->momz*P_MobjFlip(player->mo)); P_SetObjectMomZ(mo, HEIGHT, false); mo->momx = player->mo->momx + FixedMul(FINECOSINE(fa), PROJSPEED*dir); From 8c1aec37137184074d753b5a570749d5b8830198 Mon Sep 17 00:00:00 2001 From: Sally Cochenour Date: Sun, 8 Mar 2020 01:12:53 -0500 Subject: [PATCH 3/5] Fix springs having weird launch speeds in mobjscale maps Same issue as lobbing -- scale being double-applied --- src/p_map.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index 9e34e04d9..5a9f4b8c3 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -118,8 +118,8 @@ boolean P_TeleportMove(mobj_t *thing, fixed_t x, fixed_t y, fixed_t z) boolean P_DoSpring(mobj_t *spring, mobj_t *object) { //INT32 pflags; - const fixed_t hscale = mapobjectscale + (mapobjectscale - object->scale); - const fixed_t vscale = mapobjectscale + (object->scale - mapobjectscale); + const fixed_t hscale = FRACUNIT + (FRACUNIT - object->scale); + const fixed_t vscale = FRACUNIT + (object->scale - FRACUNIT); fixed_t vertispeed = spring->info->mass; fixed_t horizspeed = spring->info->damage; UINT8 starcolor = (spring->info->painchance % MAXTRANSLATIONS); From b4933bacb3ae58b096dae11d4afdb09288f33637 Mon Sep 17 00:00:00 2001 From: Sally Cochenour Date: Sun, 8 Mar 2020 01:37:48 -0500 Subject: [PATCH 4/5] Didn't work, let's try this objectSpeed was getting scaled with the spring's size, when only the spring's base speed should be scaled --- src/p_map.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index 5a9f4b8c3..a732dc551 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -118,8 +118,8 @@ boolean P_TeleportMove(mobj_t *thing, fixed_t x, fixed_t y, fixed_t z) boolean P_DoSpring(mobj_t *spring, mobj_t *object) { //INT32 pflags; - const fixed_t hscale = FRACUNIT + (FRACUNIT - object->scale); - const fixed_t vscale = FRACUNIT + (object->scale - FRACUNIT); + const fixed_t hscale = mapobjectscale + (mapobjectscale - object->scale); + const fixed_t vscale = mapobjectscale + (object->scale - mapobjectscale); fixed_t vertispeed = spring->info->mass; fixed_t horizspeed = spring->info->damage; UINT8 starcolor = (spring->info->painchance % MAXTRANSLATIONS); @@ -195,7 +195,7 @@ boolean P_DoSpring(mobj_t *spring, mobj_t *object) if (horizspeed) { angle_t finalAngle = spring->angle; - fixed_t finalSpeed = horizspeed; + fixed_t finalSpeed = FixedMul(horizspeed, FixedSqrt(FixedMul(hscale, spring->scale))); fixed_t objectSpeed; if (object->player) @@ -273,7 +273,7 @@ boolean P_DoSpring(mobj_t *spring, mobj_t *object) // Horizontal speed is used as a minimum thrust, not a direct replacement finalSpeed = max(objectSpeed, finalSpeed); - P_InstaThrustEvenIn2D(object, finalAngle, FixedMul(finalSpeed, FixedSqrt(FixedMul(hscale, spring->scale)))); + P_InstaThrustEvenIn2D(object, finalAngle, finalSpeed); } // Re-solidify From 5d2f380a136ae6b979c229c7db623916b52bab0d Mon Sep 17 00:00:00 2001 From: Sally Cochenour Date: Sun, 8 Mar 2020 17:33:07 -0400 Subject: [PATCH 5/5] Lightsnake scales (The comment about scale not working was actually just paper sprite projection mucking it up) --- src/k_kart.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index b3f4a848e..6542d3a98 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -1937,8 +1937,8 @@ void K_RespawnChecker(player_t *player) fixed_t newx, newy, newz; newangle = FixedAngle(((360/8)*i)*FRACUNIT); - newx = player->mo->x + P_ReturnThrustX(player->mo, newangle, 31<mo->y + P_ReturnThrustY(player->mo, newangle, 31<mo->x + P_ReturnThrustX(player->mo, newangle, 31 * player->mo->scale); + newy = player->mo->y + P_ReturnThrustY(player->mo, newangle, 31 * player->mo->scale); if (player->mo->eflags & MFE_VERTICALFLIP) newz = player->mo->z + player->mo->height; else @@ -1951,8 +1951,8 @@ void K_RespawnChecker(player_t *player) mo->eflags |= MFE_VERTICALFLIP; P_SetTarget(&mo->target, player->mo); mo->angle = newangle+ANGLE_90; - mo->momz = (8<mo); - P_SetScale(mo, (mo->destscale = FRACUNIT)); + mo->momz = (8 * player->mo->scale) * P_MobjFlip(player->mo); + P_SetScale(mo, (mo->destscale = player->mo->scale)); } } }