From 9c8bb236ecbf6e725a5b392ad919a9785d858b9f Mon Sep 17 00:00:00 2001 From: Braden Obrzut Date: Tue, 27 Sep 2011 01:14:31 +0000 Subject: [PATCH] - Backport r1253 through r1256 and r1259 of GZDoom. * By pressing request, allow Linux users to build ZDoom with an FMOD version that doesn't give them 3D sound positioning. :p * Fixed severe copy-pasta portal copy bug. * 3D floors hidden by being moved above the ceiling or below the floor will no longer show in the automap. * Reject TEXTURES scale of 0. They'd do nothing but provoke a division by zero error. * Maybe fixed Linux compilation? SVN r3297 (trunk) --- src/CMakeLists.txt | 2 +- src/am_map.cpp | 11 ++++++++++- src/p_spec.cpp | 14 +++++++------- src/sdl/i_system.cpp | 10 +++++----- src/textures/multipatchtexture.cpp | 2 ++ 5 files changed, 25 insertions(+), 14 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index da0653527..98860716b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -44,7 +44,7 @@ set( MINOR_VERSIONS "50" "49" "48" "47" "46" "45" "44" "43" "42" "41" "27" "26" "25" "24" "23" "22" "21" "20" "21" "19" "18" "17" "16" "15" "14" "13" "12" "11" "10" "09" "08" "07" "06" "05" "04" "03" "02" "01" "00" ) -set( MAJOR_VERSIONS "30" "28" "26" "24" "22" "20" ) +set( MAJOR_VERSIONS "34" "28" "26" "24" "22" "20" ) set( FMOD_DIR_VERSIONS ${FMOD_DIR_VERSIONS} "../fmod" ) foreach( majver ${MAJOR_VERSIONS} ) foreach( minver ${MINOR_VERSIONS} ) diff --git a/src/am_map.cpp b/src/am_map.cpp index a6b03446f..ec7e99859 100644 --- a/src/am_map.cpp +++ b/src/am_map.cpp @@ -1670,6 +1670,7 @@ void AM_drawSubsectors() // (Make the comparison in floating point to avoid overflows and improve performance.) double secx; double secy; + double seczb, seczt; double cmpz = FIXED2DBL(viewz); if (players[consoleplayer].camera && sec == players[consoleplayer].camera->Sector) @@ -1683,6 +1684,8 @@ void AM_drawSubsectors() secx = FIXED2DBL(sec->soundorg[0]); secy = FIXED2DBL(sec->soundorg[1]); } + seczb = floorplane->ZatPoint(secx, secy); + seczt = sec->ceilingplane.ZatPoint(secx, secy); for (unsigned int i = 0; i < sec->e->XFloor.ffloors.Size(); ++i) { @@ -1690,7 +1693,13 @@ void AM_drawSubsectors() if (!(rover->flags & FF_EXISTS)) continue; if (rover->flags & FF_FOG) continue; if (rover->alpha == 0) continue; - if (rover->top.plane->ZatPoint(secx, secy) < cmpz) + double roverz = rover->top.plane->ZatPoint(secx, secy); + // Ignore 3D floors that are above or below the sector itself: + // they are hidden. Since 3D floors are sorted top to bottom, + // if we get below the sector floor, we can stop. + if (roverz > seczt) continue; + if (roverz < seczb) break; + if (roverz < cmpz) { maptex = *(rover->top.texture); floorplane = rover->top.plane; diff --git a/src/p_spec.cpp b/src/p_spec.cpp index d73575bea..a60751aa2 100644 --- a/src/p_spec.cpp +++ b/src/p_spec.cpp @@ -1046,18 +1046,18 @@ void P_SpawnPortal(line_t *line, int sectortag, int plane, int alpha) { // Check if this portal needs to be copied to other sectors // This must be done here to ensure that it gets done only after the portal is set up - if (lines[i].special == Sector_SetPortal && - lines[i].args[1] == 1 && - lines[i].args[2] == plane && - lines[i].args[3] == sectortag) + if (lines[j].special == Sector_SetPortal && + lines[j].args[1] == 1 && + lines[j].args[2] == plane && + lines[j].args[3] == sectortag) { - if (lines[i].args[0] == 0) + if (lines[j].args[0] == 0) { - SetPortal(lines[i].frontsector, plane, reference, alpha); + SetPortal(lines[j].frontsector, plane, reference, alpha); } else { - for (int s=-1; (s = P_FindSectorFromTag(lines[i].args[0],s)) >= 0;) + for (int s=-1; (s = P_FindSectorFromTag(lines[j].args[0],s)) >= 0;) { SetPortal(§ors[s], plane, reference, alpha); } diff --git a/src/sdl/i_system.cpp b/src/sdl/i_system.cpp index 55ba296b6..bee304f4c 100644 --- a/src/sdl/i_system.cpp +++ b/src/sdl/i_system.cpp @@ -855,15 +855,15 @@ struct SDL_PrivateVideoData struct SDL_VideoDevice { const char *name; - int (*functions)()[9]; + int (*functions[9])(); SDL_VideoInfo info; SDL_PixelFormat *displayformatalphapixel; - int (*morefuncs)()[9]; + int (*morefuncs[9])(); Uint16 *gamma; - int (*somefuncs)()[9]; + int (*somefuncs[9])(); unsigned int texture; // Only here if SDL was compiled with OpenGL support. Ack! int is_32bit; - int (*itsafuncs)()[13]; + int (*itsafuncs[13])(); SDL_Surface *surfaces[3]; SDL_Palette *physpal; SDL_Color *gammacols; @@ -874,7 +874,7 @@ struct SDL_VideoDevice SDL_PrivateVideoData *hidden; // Why did they have to bury this so far in? }; -extern SDL_VideDevice *current_video; +extern SDL_VideoDevice *current_video; #define SDL_Display (current_video->hidden->X11_Display) SDL_Cursor *CreateColorCursor(FTexture *cursorpic) diff --git a/src/textures/multipatchtexture.cpp b/src/textures/multipatchtexture.cpp index 0bfb979a6..2013294a8 100644 --- a/src/textures/multipatchtexture.cpp +++ b/src/textures/multipatchtexture.cpp @@ -1254,11 +1254,13 @@ FMultiPatchTexture::FMultiPatchTexture (FScanner &sc, int usetype) { sc.MustGetFloat(); xScale = FLOAT2FIXED(sc.Float); + if (xScale == 0) sc.ScriptError("Texture %s is defined with null x-scale\n", Name); } else if (sc.Compare("YScale")) { sc.MustGetFloat(); yScale = FLOAT2FIXED(sc.Float); + if (yScale == 0) sc.ScriptError("Texture %s is defined with null y-scale\n", Name); } else if (sc.Compare("WorldPanning")) {