From 120a2b4ca79d3b003db0f7930ba95c2f7e37bfc9 Mon Sep 17 00:00:00 2001 From: hendricks266 Date: Wed, 18 Dec 2019 09:30:53 +0000 Subject: [PATCH 1/7] Remove arbitrary check on numshades == 32 Backported from PCExhumed. git-svn-id: https://svn.eduke32.com/eduke32@8432 1a8010ca-5511-0410-912e-c29ae57300e0 --- source/build/src/palette.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/source/build/src/palette.cpp b/source/build/src/palette.cpp index cf4c07e0e..857e80ff1 100644 --- a/source/build/src/palette.cpp +++ b/source/build/src/palette.cpp @@ -600,9 +600,6 @@ void handle_blend(uint8_t enable, uint8_t blend, uint8_t def) int32_t paletteSetLookupTable(int32_t palnum, const uint8_t *shtab) { - if (numshades != 32) - return -1; - if (shtab != NULL) { maybe_alloc_palookup(palnum); From 6eec629cfd166061b2ac9205e7be7c2e36c5e329 Mon Sep 17 00:00:00 2001 From: hendricks266 Date: Wed, 18 Dec 2019 09:30:59 +0000 Subject: [PATCH 2/7] Expose blackcol variable, containing the palette index closest to #000000 Backported from PCExhumed. git-svn-id: https://svn.eduke32.com/eduke32@8433 1a8010ca-5511-0410-912e-c29ae57300e0 --- source/build/include/build.h | 2 +- source/build/src/palette.cpp | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/source/build/include/build.h b/source/build/include/build.h index 30acb47cc..28f1e5db1 100644 --- a/source/build/include/build.h +++ b/source/build/include/build.h @@ -510,7 +510,7 @@ EXTERN char *palookup[MAXPALOOKUPS]; extern uint8_t *basepaltable[MAXBASEPALS]; EXTERN uint8_t paletteloaded; EXTERN char *blendtable[MAXBLENDTABS]; -EXTERN uint8_t whitecol, redcol; +EXTERN uint8_t whitecol, redcol, blackcol; EXTERN int32_t maxspritesonscreen; diff --git a/source/build/src/palette.cpp b/source/build/src/palette.cpp index 857e80ff1..d91079a59 100644 --- a/source/build/src/palette.cpp +++ b/source/build/src/palette.cpp @@ -28,7 +28,6 @@ palette_t curpalette[256]; // the current palette, unadjusted for brightness o palette_t curpalettefaded[256]; // the current palette, adjusted for brightness and tint (ie. what gets sent to the card) palette_t palfadergb = { 0, 0, 0, 0 }; char palfadedelta = 0; -uint8_t blackcol; int32_t realmaxshade; float frealmaxshade; From efc7365df998344afeee56a370c8fdbf67cdb8a3 Mon Sep 17 00:00:00 2001 From: hendricks266 Date: Wed, 18 Dec 2019 09:31:10 +0000 Subject: [PATCH 3/7] Fix the interpretation of old-format PALETTE.DAT Backported from PCExhumed. git-svn-id: https://svn.eduke32.com/eduke32@8436 1a8010ca-5511-0410-912e-c29ae57300e0 # Conflicts: # source/build/src/palette.cpp --- source/build/src/palette.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/source/build/src/palette.cpp b/source/build/src/palette.cpp index d91079a59..0a38ad35b 100644 --- a/source/build/src/palette.cpp +++ b/source/build/src/palette.cpp @@ -265,13 +265,15 @@ void paletteLoadFromDisk(void) // Read the entries above and on the diagonal, if the table is // thought as being row-major. - if (read_and_test(fil, &transluc[256*i + i], 256-i-1)) + if (read_and_test(fil, &transluc[256*i + i + 1], 255-i)) return; // Duplicate the entries below the diagonal. - for (bssize_t j=0; j Date: Wed, 18 Dec 2019 09:31:21 +0000 Subject: [PATCH 4/7] Expose hitscangoal variable Backported from NBlood. git-svn-id: https://svn.eduke32.com/eduke32@8439 1a8010ca-5511-0410-912e-c29ae57300e0 --- source/build/include/build.h | 1 + 1 file changed, 1 insertion(+) diff --git a/source/build/include/build.h b/source/build/include/build.h index 28f1e5db1..ecb028128 100644 --- a/source/build/include/build.h +++ b/source/build/include/build.h @@ -866,6 +866,7 @@ static FORCE_INLINE void rotatesprite_win(int32_t sx, int32_t sy, int32_t z, int void getzrange(const vec3_t *pos, int16_t sectnum, int32_t *ceilz, int32_t *ceilhit, int32_t *florz, int32_t *florhit, int32_t walldist, uint32_t cliptype) ATTRIBUTE((nonnull(1,3,4,5,6))); +extern vec2_t hitscangoal; int32_t hitscan(const vec3_t *sv, int16_t sectnum, int32_t vx, int32_t vy, int32_t vz, hitdata_t *hitinfo, uint32_t cliptype) ATTRIBUTE((nonnull(1,6))); void neartag(int32_t xs, int32_t ys, int32_t zs, int16_t sectnum, int16_t ange, From 90412527e0502bf9d5cd1ffdb8544ccb8c214e03 Mon Sep 17 00:00:00 2001 From: hendricks266 Date: Wed, 18 Dec 2019 09:31:32 +0000 Subject: [PATCH 5/7] Improve accuracy of sepldist when one dimension is zero Backported from Rednukem. git-svn-id: https://svn.eduke32.com/eduke32@8442 1a8010ca-5511-0410-912e-c29ae57300e0 # Conflicts: # source/build/include/common.h --- source/build/include/common.h | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/source/build/include/common.h b/source/build/include/common.h index c91407641..ff3ac4de1 100644 --- a/source/build/include/common.h +++ b/source/build/include/common.h @@ -78,11 +78,8 @@ static inline int32_t sepldist(const int32_t dx, const int32_t dy) { vec2_t d = { klabs(dx), klabs(dy) }; - if (playing_rr) - { - if (!d.y) return d.x; - if (!d.x) return d.y; - } + if (!d.y) return d.x; + if (!d.x) return d.y; if (d.x < d.y) swaplong(&d.x, &d.y); From 1ccda16e8e07fefd8cb6c10267f1e7ba128ed522 Mon Sep 17 00:00:00 2001 From: hendricks266 Date: Wed, 18 Dec 2019 09:31:46 +0000 Subject: [PATCH 6/7] Avoid shadowed variable in dorotatesprite Backported from PCExhumed. git-svn-id: https://svn.eduke32.com/eduke32@8446 1a8010ca-5511-0410-912e-c29ae57300e0 --- source/build/src/engine.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/build/src/engine.cpp b/source/build/src/engine.cpp index 81cdea343..519504fb3 100644 --- a/source/build/src/engine.cpp +++ b/source/build/src/engine.cpp @@ -7140,7 +7140,7 @@ static void dorotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t if (d4 >= u4) vlineasm4(d4-u4+1, (char *)(ylookup[u4]+p)); - i = p+ylookup[d4+1]; + intptr_t i = p+ylookup[d4+1]; if (y2ve[0] > d4) prevlineasm1(vince[0],palookupoffse[0],y2ve[0]-d4-1,vplce[0],bufplce[0],i+0); if (y2ve[1] > d4) prevlineasm1(vince[1],palookupoffse[1],y2ve[1]-d4-1,vplce[1],bufplce[1],i+1); if (y2ve[2] > d4) prevlineasm1(vince[2],palookupoffse[2],y2ve[2]-d4-1,vplce[2],bufplce[2],i+2); @@ -7164,7 +7164,7 @@ static void dorotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t if (d4 >= u4) mvlineasm4(d4-u4+1, (char *)(ylookup[u4]+p)); - i = p+ylookup[d4+1]; + intptr_t i = p+ylookup[d4+1]; if (y2ve[0] > d4) mvlineasm1(vince[0],palookupoffse[0],y2ve[0]-d4-1,vplce[0],bufplce[0],i+0); if (y2ve[1] > d4) mvlineasm1(vince[1],palookupoffse[1],y2ve[1]-d4-1,vplce[1],bufplce[1],i+1); if (y2ve[2] > d4) mvlineasm1(vince[2],palookupoffse[2],y2ve[2]-d4-1,vplce[2],bufplce[2],i+2); From 434ed5733796ad20d6051003a37cdca0f2ba2d3b Mon Sep 17 00:00:00 2001 From: hendricks266 Date: Wed, 18 Dec 2019 09:32:16 +0000 Subject: [PATCH 7/7] Fix rotatesprite widescreen pinning in 5:4 git-svn-id: https://svn.eduke32.com/eduke32@8454 1a8010ca-5511-0410-912e-c29ae57300e0 --- source/build/src/engine.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/source/build/src/engine.cpp b/source/build/src/engine.cpp index 519504fb3..95ec6d85c 100644 --- a/source/build/src/engine.cpp +++ b/source/build/src/engine.cpp @@ -6786,16 +6786,13 @@ void dorotspr_handle_bit2(int32_t *sxptr, int32_t *syptr, int32_t *z, int32_t da int32_t zoomsc, sx=*sxptr, sy=*syptr; int32_t ouryxaspect = yxaspect, ourxyaspect = xyaspect; - if ((dastat & RS_ALIGN_MASK) && (dastat & RS_ALIGN_MASK) != RS_ALIGN_MASK) - sx += NEGATE_ON_CONDITION(scale(120<<16,xdim,ydim) - (160<<16), !(dastat & RS_ALIGN_R)); - sy += rotatesprite_y_offset; - // screen center to s[xy], 320<<16 coords. - const int32_t normxofs = sx-(320<<15), normyofs = sy-(200<<15); - if (!(dastat & RS_STRETCH) && 4*ydim <= 3*xdim) { + if ((dastat & RS_ALIGN_MASK) && (dastat & RS_ALIGN_MASK) != RS_ALIGN_MASK) + sx += NEGATE_ON_CONDITION(scale(120<<16,xdim,ydim) - (160<<16), !(dastat & RS_ALIGN_R)); + if ((dastat & RS_ALIGN_MASK) == RS_ALIGN_MASK) ydim = scale(xdim, 3, 4); else @@ -6808,6 +6805,9 @@ void dorotspr_handle_bit2(int32_t *sxptr, int32_t *syptr, int32_t *z, int32_t da ouryxaspect = mulscale16(ouryxaspect, rotatesprite_yxaspect); ourxyaspect = divscale16(ourxyaspect, rotatesprite_yxaspect); + // screen center to s[xy], 320<<16 coords. + const int32_t normxofs = sx-(320<<15), normyofs = sy-(200<<15); + // nasty hacks go here if (!(dastat & RS_NOCLIP)) {