From 8ceba95bfaa973b3026111ff95d59334ad6d0b7d Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Wed, 25 May 2016 21:10:46 +0100 Subject: [PATCH 1/9] Fix slope collision detection for the camera See http://mb.srb2.org/showthread.php?t=41494 --- src/p_user.c | 46 ++++++++++++++++++++++++++++------------------ 1 file changed, 28 insertions(+), 18 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index 0ee5a36b4..4117cfc4c 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -8123,6 +8123,8 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall { fixed_t myfloorz, myceilingz; fixed_t midz = thiscam->z + (thiscam->z - mo->z)/2; + fixed_t midx = ((mo->x>>FRACBITS) + (thiscam->x>>FRACBITS))<<(FRACBITS-1); + fixed_t midy = ((mo->y>>FRACBITS) + (thiscam->y>>FRACBITS))<<(FRACBITS-1); // Cameras use the heightsec's heights rather then the actual sector heights. // If you can see through it, why not move the camera through it too? @@ -8138,8 +8140,8 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall } else { - myfloorz = newsubsec->sector->floorheight; - myceilingz = newsubsec->sector->ceilingheight; + myfloorz = P_CameraGetFloorZ(thiscam, newsubsec->sector, midx, midy, NULL); + myceilingz = P_CameraGetCeilingZ(thiscam, newsubsec->sector, midx, midy, NULL); } // Check list of fake floors and see if floorz/ceilingz need to be altered. @@ -8151,17 +8153,21 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall for (rover = newsubsec->sector->ffloors; rover; rover = rover->next) { + fixed_t topheight, bottomheight; if (!(rover->flags & FF_BLOCKOTHERS) || !(rover->flags & FF_EXISTS) || !(rover->flags & FF_RENDERALL) || GETSECSPECIAL(rover->master->frontsector->special, 4) == 12) continue; - delta1 = midz - (*rover->bottomheight - + ((*rover->topheight - *rover->bottomheight)/2)); - delta2 = thingtop - (*rover->bottomheight - + ((*rover->topheight - *rover->bottomheight)/2)); - if (*rover->topheight > myfloorz && abs(delta1) < abs(delta2)) - myfloorz = *rover->topheight; - if (*rover->bottomheight < myceilingz && abs(delta1) >= abs(delta2)) - myceilingz = *rover->bottomheight; + topheight = P_CameraGetFOFTopZ(thiscam, newsubsec->sector, rover, midx, midy, NULL); + bottomheight = P_CameraGetFOFBottomZ(thiscam, newsubsec->sector, rover, midx, midy, NULL); + + delta1 = midz - (bottomheight + + ((topheight - bottomheight)/2)); + delta2 = thingtop - (bottomheight + + ((topheight - bottomheight)/2)); + if (topheight > myfloorz && abs(delta1) < abs(delta2)) + myfloorz = topheight; + if (bottomheight < myceilingz && abs(delta1) >= abs(delta2)) + myceilingz = bottomheight; } } @@ -8275,18 +8281,22 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall for (rover = newsubsec->sector->ffloors; rover; rover = rover->next) { + fixed_t topheight, bottomheight; if ((rover->flags & FF_BLOCKOTHERS) && (rover->flags & FF_RENDERALL) && (rover->flags & FF_EXISTS) && GETSECSPECIAL(rover->master->frontsector->special, 4) != 12) { - if (*rover->bottomheight - thiscam->height < z - && midz < *rover->bottomheight) - z = *rover->bottomheight - thiscam->height-FixedMul(11*FRACUNIT, mo->scale); + topheight = P_CameraGetFOFTopZ(thiscam, newsubsec->sector, rover, midx, midy, NULL); + bottomheight = P_CameraGetFOFBottomZ(thiscam, newsubsec->sector, rover, midx, midy, NULL); - else if (*rover->topheight + thiscam->height > z - && midz > *rover->topheight) - z = *rover->topheight; + if (bottomheight - thiscam->height < z + && midz < bottomheight) + z = bottomheight - thiscam->height-FixedMul(11*FRACUNIT, mo->scale); - if ((mo->z >= *rover->topheight && midz < *rover->bottomheight) - || ((mo->z < *rover->bottomheight && mo->z+mo->height < *rover->topheight) && midz >= *rover->topheight)) + else if (topheight + thiscam->height > z + && midz > topheight) + z = topheight; + + if ((mo->z >= topheight && midz < bottomheight) + || ((mo->z < bottomheight && mo->z+mo->height < topheight) && midz >= topheight)) { // Can't see if (!resetcalled) From 0079b4df64b102d0762214ebc4a3b9bd459b7d7e Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Thu, 26 May 2016 20:39:15 -0400 Subject: [PATCH 2/9] Make: compile Release build will all the speed --- src/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Makefile b/src/Makefile index 463afccc8..f43e3c24d 100644 --- a/src/Makefile +++ b/src/Makefile @@ -372,7 +372,7 @@ else # build a normal optimised version WINDRESFLAGS = -DNDEBUG - #CFLAGS+=-O2 + CFLAGS+=-O3 endif CFLAGS+=-g $(OPTS) $(M5) $(WINDRESFLAGS) From 3297fe11ed20f5c008316c6cb9fd096d5d6b2dcc Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Thu, 26 May 2016 23:39:08 -0400 Subject: [PATCH 3/9] P_NetArchivePlayers() is too bad for inline --- src/p_saveg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_saveg.c b/src/p_saveg.c index 975232ba3..232351c38 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -108,7 +108,7 @@ static inline void P_UnArchivePlayer(void) // // P_NetArchivePlayers // -static inline void P_NetArchivePlayers(void) +static void P_NetArchivePlayers(void) { INT32 i, j; UINT16 flags; From 4c6a807283f81d993741a357e5979956a3b561de Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Fri, 27 May 2016 00:57:44 -0400 Subject: [PATCH 4/9] buildbot: let see all the errors --- .travis.yml | 2 +- appveyor.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 016602483..f1996215b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -42,4 +42,4 @@ before_install: - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then curl -O -L https://www.libsdl.org/projects/SDL_mixer/release/SDL2_mixer-2.0.1.dmg; hdiutil attach SDL2_mixer-2.0.1.dmg; sudo cp -a /Volumes/SDL2_mixer/SDL2_mixer.framework /Library/Frameworks/; fi - mkdir -p $HOME/srb2_cache -script: make +script: make -k diff --git a/appveyor.yml b/appveyor.yml index f9e7b3ba0..fd949dbb3 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -51,7 +51,7 @@ before_build: build_script: - cmd: mingw32-make.exe %SRB2_MFLAGS% %CONFIGURATION%=1 clean -- cmd: mingw32-make.exe %SRB2_MFLAGS% %CONFIGURATION%=1 ERRORMODE=1 +- cmd: mingw32-make.exe %SRB2_MFLAGS% %CONFIGURATION%=1 ERRORMODE=1 -k after_build: - ccache -s From 008be7c90dcdee4fea60794fd728018492dacb70 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Fri, 27 May 2016 01:19:16 -0400 Subject: [PATCH 5/9] hardware: start the surf as clean --- src/hardware/hw_main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 5fb6a93fe..224f76e8a 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -3280,6 +3280,7 @@ static void HWR_AddPolyObjectPlanes(void) if (po_ptrs[i]->translucency > 0) { FSurfaceInfo Surf; + memset(&Surf, 0x00, sizeof(Surf)); FBITFIELD blendmode = HWR_TranstableToAlpha(po_ptrs[i]->translucency, &Surf); HWR_AddTransparentPolyobjectFloor(levelflats[polyobjsector->ceilingpic].lumpnum, po_ptrs[i], polyobjsector->ceilingheight, polyobjsector->lightlevel, Surf.FlatColor.s.alpha, polyobjsector, blendmode, NULL); From 20dcf138e2ba581b76381cf333958ec1cf4812b0 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Fri, 27 May 2016 01:28:21 -0400 Subject: [PATCH 6/9] hardware: let not break MSVC support --- src/hardware/hw_main.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 224f76e8a..bec9cdb1b 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -3280,17 +3280,18 @@ static void HWR_AddPolyObjectPlanes(void) if (po_ptrs[i]->translucency > 0) { FSurfaceInfo Surf; + FBITFIELD blendmode; memset(&Surf, 0x00, sizeof(Surf)); - FBITFIELD blendmode = HWR_TranstableToAlpha(po_ptrs[i]->translucency, &Surf); + blendmode = HWR_TranstableToAlpha(po_ptrs[i]->translucency, &Surf); HWR_AddTransparentPolyobjectFloor(levelflats[polyobjsector->ceilingpic].lumpnum, po_ptrs[i], polyobjsector->ceilingheight, - polyobjsector->lightlevel, Surf.FlatColor.s.alpha, polyobjsector, blendmode, NULL); + polyobjsector->lightlevel, Surf.FlatColor.s.alpha, polyobjsector, blendmode, NULL); } else { HWR_GetFlat(levelflats[polyobjsector->ceilingpic].lumpnum); HWR_RenderPolyObjectPlane(po_ptrs[i], polyobjsector->ceilingheight, PF_Occlude, - polyobjsector->lightlevel, levelflats[polyobjsector->floorpic].lumpnum, - polyobjsector, 255, NULL); + polyobjsector->lightlevel, levelflats[polyobjsector->floorpic].lumpnum, + polyobjsector, 255, NULL); } } } From 869d582cc44d19867214d5dbc0a33dd70d0a9c7e Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Fri, 27 May 2016 01:55:52 -0400 Subject: [PATCH 7/9] Makefile: ignore suggest=attribute for GCC 4.6 and up --- src/Makefile.cfg | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Makefile.cfg b/src/Makefile.cfg index fa8896a7c..347efa5e4 100644 --- a/src/Makefile.cfg +++ b/src/Makefile.cfg @@ -173,6 +173,9 @@ endif ifdef GCC43 #WFLAGS+=-Wno-error=clobbered endif +ifdef GCC46 + WFLAGS+=-Wno-error=suggest-attribute=noreturn +endif WFLAGS+=$(OLDWFLAGS) From 65d9c9e1671e0a5c5080f71cef0cdda305a99382 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Fri, 27 May 2016 14:49:11 +0100 Subject: [PATCH 8/9] P_NetUnArchivePlayers doesn't like having "inline" either --- src/p_saveg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_saveg.c b/src/p_saveg.c index 232351c38..5e457ca3a 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -280,7 +280,7 @@ static void P_NetArchivePlayers(void) // // P_NetUnArchivePlayers // -static inline void P_NetUnArchivePlayers(void) +static void P_NetUnArchivePlayers(void) { INT32 i, j; UINT16 flags; From 0081397920220d3b961ed21a790207b5e6275900 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Fri, 27 May 2016 14:53:36 +0100 Subject: [PATCH 9/9] OpenGL: Fix MD2s on player 2's screen breaking when reverse gravity is involved --- src/hardware/hw_md2.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/hardware/hw_md2.c b/src/hardware/hw_md2.c index 31a510d8a..8e48ec110 100644 --- a/src/hardware/hw_md2.c +++ b/src/hardware/hw_md2.c @@ -1387,10 +1387,7 @@ void HWR_DrawMD2(gr_vissprite_t *spr) // SRB2CBTODO: MD2 scaling support finalscale *= FIXED_TO_FLOAT(spr->mobj->scale); - if (postimgtype == postimg_flip) - p.flip = true; - else - p.flip = false; + p.flip = atransform.flip; HWD.pfnDrawMD2i(buff, curr, durs, tics, next, &p, finalscale, flip, color); }