From b587c85a819c93ffc7caf89d9d63329af005c720 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 7 May 2015 00:45:36 +0200 Subject: [PATCH 01/25] - fixed: On Windows the cache path could end up with double slashes when no AppData folder could be found. --- src/m_specialpaths.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/m_specialpaths.cpp b/src/m_specialpaths.cpp index 086f170f8f..3e12be17d1 100644 --- a/src/m_specialpaths.cpp +++ b/src/m_specialpaths.cpp @@ -146,6 +146,7 @@ FString M_GetCachePath(bool create) // Don't use GAME_DIR and such so that ZDoom and its child ports can // share the node cache. path += "/zdoom/cache"; + path.Substitute("//", "/"); // needed because progdir ends with a slash. return path; } From 87ff82dba68ca91364a1b963efd5e66a466d2d9b Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 6 May 2015 23:24:27 +0200 Subject: [PATCH 02/25] - fixed: Trying to remove sector tags for line-less sectors crashed when there were no sector tags at all in a map. --- src/p_tags.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/p_tags.cpp b/src/p_tags.cpp index 851c4ee94d..c08caec8fb 100644 --- a/src/p_tags.cpp +++ b/src/p_tags.cpp @@ -98,13 +98,16 @@ void FTagManager::AddSectorTag(int sector, int tag) void FTagManager::RemoveSectorTags(int sect) { - int start = startForSector[sect]; - if (start >= 0) + if (startForSector.Size() > 0) { - while (allTags[start].target == sect) + int start = startForSector[sect]; + if (start >= 0) { - allTags[start].tag = allTags[start].target = -1; - start++; + while (allTags[start].target == sect) + { + allTags[start].tag = allTags[start].target = -1; + start++; + } } } } From f10416af8a3faf223a3c49f3a08145554cc5c87f Mon Sep 17 00:00:00 2001 From: Braden Obrzut Date: Thu, 7 May 2015 23:52:58 -0400 Subject: [PATCH 03/25] - Fixed: Missing WINAPI macro in SHGetFolderPathA (MSDN documentation didn't include it so I didn't. Apparently Microsoft is just incosistent since it's documented in functions like GetLongPathName.) --- src/m_specialpaths.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/m_specialpaths.cpp b/src/m_specialpaths.cpp index 3e12be17d1..7a48a2b9cb 100644 --- a/src/m_specialpaths.cpp +++ b/src/m_specialpaths.cpp @@ -83,7 +83,7 @@ bool GetKnownFolder(int shell_folder, REFKNOWNFOLDERID known_folder, bool create // new to Vista, hence the reason we support both. if (SHGetKnownFolderPath == NULL) { - static TOptWin32Proc + static TOptWin32Proc SHGetFolderPathA("shell32.dll", "SHGetFolderPathA"); // NT4 doesn't even have this function. From 92989a8c77354455d68b8b679bc1154d6182e9f0 Mon Sep 17 00:00:00 2001 From: svdijk Date: Sat, 16 May 2015 12:10:08 +0200 Subject: [PATCH 04/25] CMake: Fix building on 32-bit Linux (Fedora 20). --- dumb/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dumb/CMakeLists.txt b/dumb/CMakeLists.txt index d13f232547..e95c691542 100644 --- a/dumb/CMakeLists.txt +++ b/dumb/CMakeLists.txt @@ -111,6 +111,6 @@ if( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE ) CHECK_CXX_COMPILER_FLAG( -msse DUMB_CAN_USE_SSE ) if( DUMB_CAN_USE_SSE ) - set_source_files_properties( src/it/filter.cpp PROPERTIES COMPILE_FLAGS -msse ) + set_source_files_properties( src/helpers/resampler.c PROPERTIES COMPILE_FLAGS -msse ) endif( DUMB_CAN_USE_SSE ) endif( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE ) From 1e3230486ec975dfcb823ba3b6c35cfa400dcdfd Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 17 May 2015 21:40:25 +0200 Subject: [PATCH 05/25] - Fixed: FTagManager::Clear did not clear the line ID hashing index. --- src/p_tags.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/p_tags.h b/src/p_tags.h index 75d397d8d3..c3162d9b56 100644 --- a/src/p_tags.h +++ b/src/p_tags.h @@ -49,6 +49,7 @@ public: startForSector.Clear(); startForLine.Clear(); memset(TagHashFirst, -1, sizeof(TagHashFirst)); + memset(IDHashFirst, -1, sizeof(IDHashFirst)); } bool SectorHasTags(const sector_t *sector) const; From 4d082d93cd561d588fa0e5376123c6e243e67842 Mon Sep 17 00:00:00 2001 From: Braden Obrzut Date: Tue, 19 May 2015 17:09:20 -0400 Subject: [PATCH 06/25] - Use SDL_RenderSetLogicalSize to handle animorphic ratios in fullscreen with SDL backend. - Reuse the old window in the SDL backend since in some instances switching windows causes issues (OS X fullscreen for instance (while using the SDL backend of course)). - Clear the SDL render before copying in the framebuffer to remove HOM-like effect. --- src/posix/sdl/sdlvideo.cpp | 77 +++++++++++++++++++++++--------------- 1 file changed, 47 insertions(+), 30 deletions(-) diff --git a/src/posix/sdl/sdlvideo.cpp b/src/posix/sdl/sdlvideo.cpp index c24fd797a7..dbaf182398 100644 --- a/src/posix/sdl/sdlvideo.cpp +++ b/src/posix/sdl/sdlvideo.cpp @@ -28,7 +28,7 @@ class SDLFB : public DFrameBuffer { DECLARE_CLASS(SDLFB, DFrameBuffer) public: - SDLFB (int width, int height, bool fullscreen); + SDLFB (int width, int height, bool fullscreen, SDL_Window *oldwin); ~SDLFB (); bool Lock (bool buffer); @@ -67,7 +67,6 @@ private: SDL_Texture *Texture; SDL_Surface *Surface; }; - SDL_Rect UpdateRect; bool UsingRenderer; bool NeedPalUpdate; @@ -261,6 +260,8 @@ DFrameBuffer *SDLVideo::CreateFrameBuffer (int width, int height, bool fullscree PalEntry flashColor; int flashAmount; + SDL_Window *oldwin = NULL; + if (old != NULL) { // Reuse the old framebuffer if its attributes are the same SDLFB *fb = static_cast (old); @@ -275,6 +276,10 @@ DFrameBuffer *SDLVideo::CreateFrameBuffer (int width, int height, bool fullscree } return old; } + + oldwin = fb->Screen; + fb->Screen = NULL; + old->GetFlash (flashColor, flashAmount); old->ObjectFlags |= OF_YesReallyDelete; if (screen == old) screen = NULL; @@ -286,7 +291,7 @@ DFrameBuffer *SDLVideo::CreateFrameBuffer (int width, int height, bool fullscree flashAmount = 0; } - SDLFB *fb = new SDLFB (width, height, fullscreen); + SDLFB *fb = new SDLFB (width, height, fullscreen, oldwin); // If we could not create the framebuffer, try again with slightly // different parameters in this order: @@ -340,7 +345,7 @@ void SDLVideo::SetWindowedScale (float scale) // FrameBuffer implementation ----------------------------------------------- -SDLFB::SDLFB (int width, int height, bool fullscreen) +SDLFB::SDLFB (int width, int height, bool fullscreen, SDL_Window *oldwin) : DFrameBuffer (width, height) { int i; @@ -351,15 +356,27 @@ SDLFB::SDLFB (int width, int height, bool fullscreen) NotPaletted = false; FlashAmount = 0; - FString caption; - caption.Format(GAMESIG " %s (%s)", GetVersionString(), GetGitTime()); + if (oldwin) + { + // In some cases (Mac OS X fullscreen) SDL2 doesn't like having multiple windows which + // appears to inevitably happen while compositor animations are running. So lets try + // to reuse the existing window. + Screen = oldwin; + SDL_SetWindowSize (Screen, width, height); + SetFullscreen (fullscreen); + } + else + { + FString caption; + caption.Format(GAMESIG " %s (%s)", GetVersionString(), GetGitTime()); - Screen = SDL_CreateWindow (caption, - SDL_WINDOWPOS_UNDEFINED_DISPLAY(vid_adapter), SDL_WINDOWPOS_UNDEFINED_DISPLAY(vid_adapter), - width, height, (fullscreen ? SDL_WINDOW_FULLSCREEN_DESKTOP : 0)); + Screen = SDL_CreateWindow (caption, + SDL_WINDOWPOS_UNDEFINED_DISPLAY(vid_adapter), SDL_WINDOWPOS_UNDEFINED_DISPLAY(vid_adapter), + width, height, (fullscreen ? SDL_WINDOW_FULLSCREEN_DESKTOP : 0)|SDL_WINDOW_RESIZABLE); - if (Screen == NULL) - return; + if (Screen == NULL) + return; + } Renderer = NULL; Texture = NULL; @@ -381,15 +398,15 @@ SDLFB::SDLFB (int width, int height, bool fullscreen) SDLFB::~SDLFB () { + if (Renderer) + { + if (Texture) + SDL_DestroyTexture (Texture); + SDL_DestroyRenderer (Renderer); + } + if(Screen) { - if (Renderer) - { - if (Texture) - SDL_DestroyTexture (Texture); - SDL_DestroyRenderer (Renderer); - } - SDL_DestroyWindow (Screen); } } @@ -498,7 +515,8 @@ void SDLFB::Update () SDL_UnlockTexture (Texture); SDLFlipCycles.Clock(); - SDL_RenderCopy(Renderer, Texture, NULL, &UpdateRect); + SDL_RenderClear(Renderer); + SDL_RenderCopy(Renderer, Texture, NULL, NULL); SDL_RenderPresent(Renderer); SDLFlipCycles.Unclock(); } @@ -613,6 +631,9 @@ void SDLFB::GetFlashedPalette (PalEntry pal[256]) void SDLFB::SetFullscreen (bool fullscreen) { + if (IsFullscreen() == fullscreen) + return; + SDL_SetWindowFullscreen (Screen, fullscreen ? SDL_WINDOW_FULLSCREEN_DESKTOP : 0); if (!fullscreen) { @@ -645,6 +666,8 @@ void SDLFB::ResetSDLRenderer () if (!Renderer) return; + SDL_SetRenderDrawColor(Renderer, 0, 0, 0, 255); + Uint32 fmt; switch(vid_displaybits) { @@ -681,24 +704,18 @@ void SDLFB::ResetSDLRenderer () NotPaletted = false; } - // Calculate update rectangle + // In fullscreen, set logical size according to animorphic ratio. + // Windowed modes are always rendered 1:1. if (IsFullscreen ()) { int w, h; SDL_GetWindowSize (Screen, &w, &h); - UpdateRect.w = w; - UpdateRect.h = h; - ScaleWithAspect (UpdateRect.w, UpdateRect.h, Width, Height); - UpdateRect.x = (w - UpdateRect.w)/2; - UpdateRect.y = (h - UpdateRect.h)/2; + ScaleWithAspect (w, h, Width, Height); + SDL_RenderSetLogicalSize (Renderer, w, h); } else { - // In windowed mode we just update the whole window. - UpdateRect.x = 0; - UpdateRect.y = 0; - UpdateRect.w = Width; - UpdateRect.h = Height; + SDL_RenderSetLogicalSize (Renderer, Width, Height); } } From 354ec022b313af7c6c5266e1d70eebabf7dcf4af Mon Sep 17 00:00:00 2001 From: Braden Obrzut Date: Wed, 20 May 2015 12:32:17 -0400 Subject: [PATCH 07/25] - On Windows resizing a window just renders the image to the size of the window, so lets do the same for SDL (makes mouse coordinate scaling easier). --- src/posix/sdl/sdlvideo.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/posix/sdl/sdlvideo.cpp b/src/posix/sdl/sdlvideo.cpp index dbaf182398..76191e1a92 100644 --- a/src/posix/sdl/sdlvideo.cpp +++ b/src/posix/sdl/sdlvideo.cpp @@ -705,7 +705,7 @@ void SDLFB::ResetSDLRenderer () } // In fullscreen, set logical size according to animorphic ratio. - // Windowed modes are always rendered 1:1. + // Windowed modes are rendered to fill the window (usually 1:1) if (IsFullscreen ()) { int w, h; @@ -713,10 +713,6 @@ void SDLFB::ResetSDLRenderer () ScaleWithAspect (w, h, Width, Height); SDL_RenderSetLogicalSize (Renderer, w, h); } - else - { - SDL_RenderSetLogicalSize (Renderer, Width, Height); - } } void SDLFB::SetVSync (bool vsync) @@ -743,13 +739,14 @@ void SDLFB::SetVSync (bool vsync) void SDLFB::ScaleCoordsFromWindow(SWORD &x, SWORD &y) { + int w, h; + SDL_GetWindowSize (Screen, &w, &h); + // Detect if we're doing scaling in the Window and adjust the mouse // coordinates accordingly. This could be more efficent, but I // don't think performance is an issue in the menus. if(IsFullscreen()) { - int w, h; - SDL_GetWindowSize (Screen, &w, &h); int realw = w, realh = h; ScaleWithAspect (realw, realh, SCREENWIDTH, SCREENHEIGHT); if (realw != SCREENWIDTH || realh != SCREENHEIGHT) @@ -768,6 +765,11 @@ void SDLFB::ScaleCoordsFromWindow(SWORD &x, SWORD &y) } } } + else + { + x = (SWORD)(x*Width/w); + y = (SWORD)(y*Height/h); + } } ADD_STAT (blit) From e46b25f6283a0da0fcfa02187f657bf4c89d8a93 Mon Sep 17 00:00:00 2001 From: Braden Obrzut Date: Wed, 20 May 2015 12:54:13 -0400 Subject: [PATCH 08/25] - Fixed: god2 didn't trigger invulnerability in SBarInfo. --- src/g_shared/sbarinfo_commands.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/g_shared/sbarinfo_commands.cpp b/src/g_shared/sbarinfo_commands.cpp index bb1b048502..db5d9fc05c 100644 --- a/src/g_shared/sbarinfo_commands.cpp +++ b/src/g_shared/sbarinfo_commands.cpp @@ -525,7 +525,7 @@ class CommandDrawSwitchableImage : public CommandDrawImage } else if(condition == INVULNERABILITY) { - if(statusBar->CPlayer->cheats&CF_GODMODE) + if(statusBar->CPlayer->cheats&(CF_GODMODE|CF_GODMODE2)) { drawAlt = 1; } From c9214c1ce98ac5082fc323658e35f265d503c95d Mon Sep 17 00:00:00 2001 From: Braden Obrzut Date: Wed, 20 May 2015 13:10:08 -0400 Subject: [PATCH 09/25] - Fixed: Hexen's status bar top graphic was drawn 1 pixel too low. - Fixed: Artiflash played on initial save loading. I seem to recall this looking like an intentional change, but perhaps I broke it since it's completely pointless to play the animation only on the first load of a save game if nothing has been loaded beforehand. --- src/g_shared/sbarinfo_commands.cpp | 2 +- wadsrc/static/sbarinfo/hexen.txt | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/g_shared/sbarinfo_commands.cpp b/src/g_shared/sbarinfo_commands.cpp index db5d9fc05c..2f7739a4fd 100644 --- a/src/g_shared/sbarinfo_commands.cpp +++ b/src/g_shared/sbarinfo_commands.cpp @@ -1730,7 +1730,7 @@ class CommandDrawSelectedInventory : public CommandDrawImage, private CommandDra static int artiflashTick; static fixed_t itemflashFade; }; -int CommandDrawSelectedInventory::artiflashTick = 4; +int CommandDrawSelectedInventory::artiflashTick = 0; int CommandDrawSelectedInventory::itemflashFade = FRACUNIT*3/4; void DSBarInfo::FlashItem(const PClass *itemtype) diff --git a/wadsrc/static/sbarinfo/hexen.txt b/wadsrc/static/sbarinfo/hexen.txt index 6450fac585..6e57550bce 100755 --- a/wadsrc/static/sbarinfo/hexen.txt +++ b/wadsrc/static/sbarinfo/hexen.txt @@ -51,7 +51,7 @@ statusbar fullscreen, fullscreenoffsets statusbar Normal { - drawimage "H2BAR", 0, 135; + drawimage "H2BAR", 0, 134; drawimage "STATBAR", 38, 162; drawselectedinventory artiflash, INDEXFONT_RAVEN, 143, 163, 174, 184, untranslated; @@ -204,7 +204,7 @@ statusbar Normal statusbar Automap { - drawimage "H2BAR", 0, 135; + drawimage "H2BAR", 0, 134; drawimage "KEYBAR", 38, 162; drawkeybar 5, horizontal, 20, 46, 164; drawimage hexenarmor(armor, "ARMSLOT1"), 150, 164; From 9f208409f2bb8a62a11ea0a1a515cbe433c7d17b Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 25 May 2015 19:57:36 +0200 Subject: [PATCH 10/25] - fixed: The tag check in Sector_CopyScroller was inverted (it should reject sectors with the given tag, but it rejected everything else.) --- src/p_spec.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_spec.cpp b/src/p_spec.cpp index 81f4a27e40..42a7b9ca46 100644 --- a/src/p_spec.cpp +++ b/src/p_spec.cpp @@ -1741,7 +1741,7 @@ static void P_SpawnScrollers(void) if (lines[i].special == Sector_CopyScroller) { // don't allow copying the scroller if the sector has the same tag as it would just duplicate it. - if (tagManager.SectorHasTag(lines[i].frontsector, lines[i].args[0])) + if (!tagManager.SectorHasTag(lines[i].frontsector, lines[i].args[0])) { copyscrollers.Push(i); } From 0b3a22d6d2e5b98394b94b6fdbb681b8ad6e8648 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 26 May 2015 09:03:53 +0200 Subject: [PATCH 11/25] - fixed: The ending flat for No Rest For The Living was wrong. --- wadsrc/static/mapinfo/doom2.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wadsrc/static/mapinfo/doom2.txt b/wadsrc/static/mapinfo/doom2.txt index 5d0d405179..4f010352cc 100644 --- a/wadsrc/static/mapinfo/doom2.txt +++ b/wadsrc/static/mapinfo/doom2.txt @@ -536,7 +536,7 @@ map LEVEL09 lookup "NHUSTR_9" cluster 11 { - flat = "RROCK19" + flat = "SLIME16" music = "$MUSIC_READ_M" exittext = lookup, "NERVETEXT" } From 4546df7dc32519520ff05d2be6b562b582a91658 Mon Sep 17 00:00:00 2001 From: Edoardo Prezioso Date: Thu, 28 May 2015 00:41:07 +0200 Subject: [PATCH 12/25] - Fixed SetActorPitch and ChangeActorPitch issue. The code did not take into account the player's limited pitch. --- src/actor.h | 2 +- src/p_mobj.cpp | 18 +++++++++++++++++- src/thingdef/thingdef_codeptr.cpp | 18 +----------------- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/actor.h b/src/actor.h index 81b0a8b7b4..b38d4b2e0c 100644 --- a/src/actor.h +++ b/src/actor.h @@ -823,7 +823,7 @@ public: } // These also set CF_INTERPVIEW for players. - void SetPitch(int p, bool interpolate); + void SetPitch(int p, bool interpolate, bool forceclamp = false); void SetAngle(angle_t ang, bool interpolate); void SetRoll(angle_t roll, bool interpolate); diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index 588bc2dccf..b0fc0d08ed 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -3115,8 +3115,24 @@ void AActor::SetShade (int r, int g, int b) fillcolor = MAKEARGB(ColorMatcher.Pick (r, g, b), r, g, b); } -void AActor::SetPitch(int p, bool interpolate) +void AActor::SetPitch(int p, bool interpolate, bool forceclamp) { + if (player != NULL || forceclamp) + { // clamp the pitch we set + int min, max; + + if (player != NULL) + { + min = player->MinPitch; + max = player->MaxPitch; + } + else + { + min = -ANGLE_90 + (1 << ANGLETOFINESHIFT); + max = ANGLE_90 - (1 << ANGLETOFINESHIFT); + } + p = clamp(p, min, max); + } if (p != pitch) { pitch = p; diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index 6ac0f115b1..15d8291fc8 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -3989,23 +3989,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetPitch) return; } - if (ref->player != NULL || (flags & SPF_FORCECLAMP)) - { // clamp the pitch we set - int min, max; - - if (ref->player != NULL) - { - min = ref->player->MinPitch; - max = ref->player->MaxPitch; - } - else - { - min = -ANGLE_90 + (1 << ANGLETOFINESHIFT); - max = ANGLE_90 - (1 << ANGLETOFINESHIFT); - } - pitch = clamp(pitch, min, max); - } - ref->SetPitch(pitch, !!(flags & SPF_INTERPOLATE)); + ref->SetPitch(pitch, !!(flags & SPF_INTERPOLATE), !!(flags & SPF_FORCECLAMP)); } //=========================================================================== From 65cc361e9b1dc720950bc5f2e87bb526674260f3 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 28 May 2015 09:22:48 +0200 Subject: [PATCH 13/25] - added Zandronum's text input menu items. --- src/menu/menu.h | 6 +- src/menu/menudef.cpp | 57 +++++++++++ src/menu/menuinput.cpp | 10 +- src/menu/optionmenuitems.h | 202 +++++++++++++++++++++++++++++++++++++ 4 files changed, 273 insertions(+), 2 deletions(-) diff --git a/src/menu/menu.h b/src/menu/menu.h index 3712c90658..561953d1c7 100644 --- a/src/menu/menu.h +++ b/src/menu/menu.h @@ -644,9 +644,13 @@ class DTextEnterMenu : public DMenu int InputGridX; int InputGridY; + // [TP] + bool AllowColors; + public: - DTextEnterMenu(DMenu *parent, char *textbuffer, int maxlen, int sizemode, bool showgrid); + // [TP] Added allowcolors + DTextEnterMenu(DMenu *parent, char *textbuffer, int maxlen, int sizemode, bool showgrid, bool allowcolors = false); void Drawer (); bool MenuEvent (int mkey, bool fromcontroller); diff --git a/src/menu/menudef.cpp b/src/menu/menudef.cpp index 819ba96ba7..73101a76e7 100644 --- a/src/menu/menudef.cpp +++ b/src/menu/menudef.cpp @@ -830,6 +830,63 @@ static void ParseOptionMenuBody(FScanner &sc, FOptionMenuDescriptor *desc) FOptionMenuItem *it = new FOptionMenuScreenResolutionLine(sc.String); desc->mItems.Push(it); } + // [TP] -- Text input widget + else if ( sc.Compare( "TextField" )) + { + sc.MustGetString(); + FString label = sc.String; + sc.MustGetStringName( "," ); + sc.MustGetString(); + FString cvar = sc.String; + FString check; + + if ( sc.CheckString( "," )) + { + sc.MustGetString(); + check = sc.String; + } + + FOptionMenuItem* it = new FOptionMenuTextField( label, cvar, check ); + desc->mItems.Push( it ); + } + // [TP] -- Number input widget + else if ( sc.Compare( "NumberField" )) + { + sc.MustGetString(); + FString label = sc.String; + sc.MustGetStringName( "," ); + sc.MustGetString(); + FString cvar = sc.String; + float minimum = 0.0f; + float maximum = 100.0f; + float step = 1.0f; + FString check; + + if ( sc.CheckString( "," )) + { + sc.MustGetFloat(); + minimum = (float) sc.Float; + sc.MustGetStringName( "," ); + sc.MustGetFloat(); + maximum = (float) sc.Float; + + if ( sc.CheckString( "," )) + { + sc.MustGetFloat(); + step = (float) sc.Float; + + if ( sc.CheckString( "," )) + { + sc.MustGetString(); + check = sc.String; + } + } + } + + FOptionMenuItem* it = new FOptionMenuNumberField( label, cvar, + minimum, maximum, step, check ); + desc->mItems.Push( it ); + } else { sc.ScriptError("Unknown keyword '%s'", sc.String); diff --git a/src/menu/menuinput.cpp b/src/menu/menuinput.cpp index 0f35b7e1f5..dc58b54ca9 100644 --- a/src/menu/menuinput.cpp +++ b/src/menu/menuinput.cpp @@ -40,6 +40,8 @@ #include "d_gui.h" #include "v_font.h" #include "v_palette.h" +// [TP] New #includes +#include "v_text.h" IMPLEMENT_ABSTRACT_CLASS(DTextEnterMenu) @@ -64,7 +66,8 @@ CVAR(Bool, m_showinputgrid, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) // //============================================================================= -DTextEnterMenu::DTextEnterMenu(DMenu *parent, char *textbuffer, int maxlen, int sizemode, bool showgrid) +// [TP] Added allowcolors +DTextEnterMenu::DTextEnterMenu(DMenu *parent, char *textbuffer, int maxlen, int sizemode, bool showgrid, bool allowcolors) : DMenu(parent) { mEnterString = textbuffer; @@ -83,6 +86,7 @@ DTextEnterMenu::DTextEnterMenu(DMenu *parent, char *textbuffer, int maxlen, int InputGridX = 0; InputGridY = 0; } + AllowColors = allowcolors; // [TP] } //============================================================================= @@ -140,6 +144,10 @@ bool DTextEnterMenu::Responder(event_t *ev) { if (mEnterString[0]) { + // [TP] If we allow color codes, colorize the string now. + if (AllowColors) + strbin(mEnterString); + DMenu *parent = mParentMenu; Close(); parent->MenuEvent(MKEY_Input, false); diff --git a/src/menu/optionmenuitems.h b/src/menu/optionmenuitems.h index 439ed7ffcf..5bc015369b 100644 --- a/src/menu/optionmenuitems.h +++ b/src/menu/optionmenuitems.h @@ -31,6 +31,7 @@ **--------------------------------------------------------------------------- ** */ +#include "v_text.h" void M_DrawConText (int color, int x, int y, const char *str); @@ -943,6 +944,207 @@ public: } }; + +//============================================================================= +// +// [TP] FOptionMenuFieldBase +// +// Base class for input fields +// +//============================================================================= + +class FOptionMenuFieldBase : public FOptionMenuItem +{ +public: + FOptionMenuFieldBase ( const char* label, const char* menu, const char* graycheck ) : + FOptionMenuItem ( label, menu ), + mCVar ( FindCVar( mAction, NULL )), + mGrayCheck (( graycheck && strlen( graycheck )) ? FindCVar( graycheck, NULL ) : NULL ) {} + + const char* GetCVarString() + { + if ( mCVar == NULL ) + return ""; + + return mCVar->GetGenericRep( CVAR_String ).String; + } + + virtual FString Represent() + { + return GetCVarString(); + } + + int Draw ( FOptionMenuDescriptor*, int y, int indent, bool selected ) + { + bool grayed = mGrayCheck != NULL && !( mGrayCheck->GetGenericRep( CVAR_Bool ).Bool ); + drawLabel( indent, y, selected ? OptionSettings.mFontColorSelection : OptionSettings.mFontColor, grayed ); + int overlay = grayed? MAKEARGB( 96, 48, 0, 0 ) : 0; + + screen->DrawText( SmallFont, OptionSettings.mFontColorValue, indent + CURSORSPACE, y, + Represent().GetChars(), DTA_CleanNoMove_1, true, DTA_ColorOverlay, overlay, TAG_DONE ); + return indent; + } + + bool GetString ( int i, char* s, int len ) + { + if ( i == 0 ) + { + strncpy( s, GetCVarString(), len ); + s[len - 1] = '\0'; + return true; + } + + return false; + } + + bool SetString ( int i, const char* s ) + { + if ( i == 0 ) + { + if ( mCVar ) + { + UCVarValue vval; + vval.String = s; + mCVar->SetGenericRep( vval, CVAR_String ); + } + + return true; + } + + return false; + } + +protected: + // Action is a CVar in this class and derivatives. + FBaseCVar* mCVar; + FBaseCVar* mGrayCheck; +}; + +//============================================================================= +// +// [TP] FOptionMenuTextField +// +// A text input field widget, for use with string CVars. +// +//============================================================================= + +class FOptionMenuTextField : public FOptionMenuFieldBase +{ +public: + FOptionMenuTextField ( const char *label, const char* menu, const char* graycheck ) : + FOptionMenuFieldBase ( label, menu, graycheck ), + mEntering ( false ) {} + + FString Represent() + { + FString text = mEntering ? mEditName : GetCVarString(); + + if ( mEntering ) + text += ( gameinfo.gametype & GAME_DoomStrifeChex ) ? '_' : '['; + + return text; + } + + bool MenuEvent ( int mkey, bool fromcontroller ) + { + if ( mkey == MKEY_Enter ) + { + S_Sound( CHAN_VOICE | CHAN_UI, "menu/choose", snd_menuvolume, ATTN_NONE ); + strcpy( mEditName, GetCVarString() ); + mEntering = true; + DMenu* input = new DTextEnterMenu ( DMenu::CurrentMenu, mEditName, sizeof mEditName, 2, fromcontroller ); + M_ActivateMenu( input ); + return true; + } + else if ( mkey == MKEY_Input ) + { + if ( mCVar ) + { + UCVarValue vval; + vval.String = mEditName; + mCVar->SetGenericRep( vval, CVAR_String ); + } + + mEntering = false; + return true; + } + else if ( mkey == MKEY_Abort ) + { + mEntering = false; + return true; + } + + return FOptionMenuItem::MenuEvent( mkey, fromcontroller ); + } + +private: + bool mEntering; + char mEditName[128]; +}; + +//============================================================================= +// +// [TP] FOptionMenuNumberField +// +// A numeric input field widget, for use with number CVars where sliders are inappropriate (i.e. +// where the user is interested in the exact value specifically) +// +//============================================================================= + +class FOptionMenuNumberField : public FOptionMenuFieldBase +{ +public: + FOptionMenuNumberField ( const char *label, const char* menu, float minimum, float maximum, + float step, const char* graycheck ) + : FOptionMenuFieldBase ( label, menu, graycheck ), + mMinimum ( minimum ), + mMaximum ( maximum ), + mStep ( step ) + { + if ( mMaximum <= mMinimum ) + swapvalues( mMinimum, mMaximum ); + + if ( mStep <= 0 ) + mStep = 1; + } + + bool MenuEvent ( int mkey, bool fromcontroller ) + { + if ( mCVar ) + { + float value = mCVar->GetGenericRep( CVAR_Float ).Float; + + if ( mkey == MKEY_Left ) + { + value -= mStep; + + if ( value < mMinimum ) + value = mMaximum; + } + else if ( mkey == MKEY_Right || mkey == MKEY_Enter ) + { + value += mStep; + + if ( value > mMaximum ) + value = mMinimum; + } + else + return FOptionMenuItem::MenuEvent( mkey, fromcontroller ); + + UCVarValue vval; + vval.Float = value; + mCVar->SetGenericRep( vval, CVAR_Float ); + S_Sound( CHAN_VOICE | CHAN_UI, "menu/change", snd_menuvolume, ATTN_NONE ); + } + + return true; + } + +private: + float mMinimum; + float mMaximum; + float mStep; +}; #ifndef NO_IMP CCMD(am_restorecolors) { From 22570e079e50eaf7c6e2c32f43dd4d8c3432bf8c Mon Sep 17 00:00:00 2001 From: MajorCooke Date: Tue, 2 Jun 2015 12:10:45 -0500 Subject: [PATCH 14/25] * Added LAXTELEFRAGDMG. This flag forces all damage to be factored, regardless being above or below the telefrag threshold. - This only affects damage calculations being received by the end result. If the original damage was not a million or more, from the start, it will not hurt invulnerable-flagged or kill buddha-flagged monsters. - Fixed: Damage was inconsistent by the time the function checked for player cheats/invulnerability and (monster and player) buddha, yet monster invulnerability checked the original damage prior to factor processing. This means a damage source that intended to damage another below the threshold could accidentally increase with a powerdamage multiplier or the recipient with a weakness for it, resulting in invulnerability/buddha foiling. Now, checks for telefrag damage using the raw original value on player godmode, player/monster invulnerability and buddha. --- src/actor.h | 1 + src/p_interaction.cpp | 21 +++++++++++++-------- src/thingdef/thingdef_data.cpp | 2 ++ 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/actor.h b/src/actor.h index b38d4b2e0c..52c88e9018 100644 --- a/src/actor.h +++ b/src/actor.h @@ -372,6 +372,7 @@ enum ActorFlag7 MF7_FLYCHEAT = 0x00020000, // must be part of the actor so that it can be tracked properly MF7_NODECAL = 0x00040000, // [ZK] Forces puff to have no impact decal MF7_FORCEDECAL = 0x00080000, // [ZK] Forces puff's decal to override the weapon's. + MF7_LAXTELEFRAGDMG = 0x00100000, // [MC] Telefrag damage can be reduced. }; // --- mobj.renderflags --- diff --git a/src/p_interaction.cpp b/src/p_interaction.cpp index e25dcf7aca..f7035d462d 100644 --- a/src/p_interaction.cpp +++ b/src/p_interaction.cpp @@ -946,6 +946,7 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage, bool forcedPain = false; int fakeDamage = 0; int holdDamage = 0; + int rawdamage = damage; if (damage < 0) damage = 0; @@ -980,7 +981,11 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage, } return -1; } - if ((target->flags2 & MF2_INVULNERABLE) && (damage < TELEFRAG_DAMAGE) && (!(flags & DMG_FORCED))) + // [MC] Changed it to check rawdamage here for consistency, even though that doesn't actually do anything + // different here. At any rate, invulnerable is being checked before type factoring, which is then being + // checked by player cheats/invul/buddha followed by monster buddha. This is inconsistent. Don't let the + // original telefrag damage CHECK (rawdamage) be influenced by outside factors when looking at cheats/invul. + if ((target->flags2 & MF2_INVULNERABLE) && (rawdamage < TELEFRAG_DAMAGE) && (!(flags & DMG_FORCED))) { // actor is invulnerable if (target->player == NULL) { @@ -1040,7 +1045,7 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage, return -1; } - if (damage < TELEFRAG_DAMAGE) // TELEFRAG_DAMAGE may not be reduced at all or it may not guarantee its effect. + if ((rawdamage < TELEFRAG_DAMAGE) || (target->flags7 & MF7_NOTELEFRAGPIERCE)) // TELEFRAG_DAMAGE may only be reduced with NOTELEFRAGPIERCE or it may not guarantee its effect. { if (player && damage > 1) { @@ -1218,7 +1223,7 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage, { if (player) FriendlyFire = true; - if (damage < TELEFRAG_DAMAGE) + if (rawdamage < TELEFRAG_DAMAGE) //Use the original damage to check for telefrag amount. Don't let the now-amplified damagetypes do it. { // Still allow telefragging :-( damage = (int)((float)damage * level.teamdamage); if (damage < 0) @@ -1261,7 +1266,7 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage, if (!(flags & DMG_FORCED)) { // check the real player, not a voodoo doll here for invulnerability effects - if ((damage < TELEFRAG_DAMAGE && ((player->mo->flags2 & MF2_INVULNERABLE) || + if ((rawdamage < TELEFRAG_DAMAGE && ((player->mo->flags2 & MF2_INVULNERABLE) || (player->cheats & CF_GODMODE))) || (player->cheats & CF_GODMODE2) || (player->mo->flags5 & MF5_NODAMAGE)) //Absolutely no hurting if NODAMAGE is involved. Same for GODMODE2. @@ -1286,7 +1291,7 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage, { player->mo->Inventory->AbsorbDamage(damage, mod, newdam); } - if (damage < TELEFRAG_DAMAGE) + if ((rawdamage < TELEFRAG_DAMAGE) || (player->mo->flags7 & MF7_NOTELEFRAGPIERCE)) //rawdamage is never modified. { // if we are telefragging don't let the damage value go below that magic value. Some further checks would fail otherwise. damage = newdam; @@ -1305,7 +1310,7 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage, } } - if (damage >= player->health && damage < TELEFRAG_DAMAGE + if (damage >= player->health && rawdamage < TELEFRAG_DAMAGE && (G_SkillProperty(SKILLP_AutoUseHealth) || deathmatch) && !player->morphTics) { // Try to use some inventory health @@ -1329,7 +1334,7 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage, // but telefragging should still do enough damage to kill the player) // Ignore players that are already dead. // [MC]Buddha2 absorbs telefrag damage, and anything else thrown their way. - if (!(flags & DMG_FORCED) && (((player->cheats & CF_BUDDHA2) || (((player->cheats & CF_BUDDHA) || (player->mo->flags7 & MF7_BUDDHA)) && (damage < TELEFRAG_DAMAGE))) && (player->playerstate != PST_DEAD))) + if (!(flags & DMG_FORCED) && (((player->cheats & CF_BUDDHA2) || (((player->cheats & CF_BUDDHA) || (player->mo->flags7 & MF7_BUDDHA)) && (rawdamage < TELEFRAG_DAMAGE))) && (player->playerstate != PST_DEAD))) { // If this is a voodoo doll we need to handle the real player as well. player->mo->health = target->health = player->health = 1; @@ -1394,7 +1399,7 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage, if (target->health <= 0) { //[MC]Buddha flag for monsters. - if (!(flags & DMG_FORCED) && ((target->flags7 & MF7_BUDDHA) && (damage < TELEFRAG_DAMAGE) && ((inflictor == NULL || !(inflictor->flags7 & MF7_FOILBUDDHA)) && !(flags & DMG_FOILBUDDHA)))) + if (!(flags & DMG_FORCED) && ((target->flags7 & MF7_BUDDHA) && (rawdamage < TELEFRAG_DAMAGE) && ((inflictor == NULL || !(inflictor->flags7 & MF7_FOILBUDDHA)) && !(flags & DMG_FOILBUDDHA)))) { //FOILBUDDHA or Telefrag damage must kill it. target->health = 1; } diff --git a/src/thingdef/thingdef_data.cpp b/src/thingdef/thingdef_data.cpp index a471e9985a..b1387ba524 100644 --- a/src/thingdef/thingdef_data.cpp +++ b/src/thingdef/thingdef_data.cpp @@ -258,6 +258,8 @@ static FFlagDef ActorFlagDefs[]= DEFINE_FLAG(MF7, NODECAL, AActor, flags7), DEFINE_FLAG(MF7, FORCEDECAL, AActor, flags7), + DEFINE_FLAG(MF7, LAXTELEFRAGDMG, AActor, flags7), + // Effect flags DEFINE_FLAG(FX, VISIBILITYPULSE, AActor, effects), DEFINE_FLAG2(FX_ROCKET, ROCKETTRAIL, AActor, effects), From 4c390d92a4008bd1a6607df9d00ca4ca8b8c8d6e Mon Sep 17 00:00:00 2001 From: MajorCooke Date: Tue, 2 Jun 2015 12:22:26 -0500 Subject: [PATCH 15/25] -...forgot this one. --- src/p_interaction.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/p_interaction.cpp b/src/p_interaction.cpp index f7035d462d..cbbd879781 100644 --- a/src/p_interaction.cpp +++ b/src/p_interaction.cpp @@ -1045,7 +1045,7 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage, return -1; } - if ((rawdamage < TELEFRAG_DAMAGE) || (target->flags7 & MF7_NOTELEFRAGPIERCE)) // TELEFRAG_DAMAGE may only be reduced with NOTELEFRAGPIERCE or it may not guarantee its effect. + if ((rawdamage < TELEFRAG_DAMAGE) || (target->flags7 & MF7_LAXTELEFRAGDMG)) // TELEFRAG_DAMAGE may only be reduced with NOTELEFRAGPIERCE or it may not guarantee its effect. { if (player && damage > 1) { @@ -1291,7 +1291,7 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage, { player->mo->Inventory->AbsorbDamage(damage, mod, newdam); } - if ((rawdamage < TELEFRAG_DAMAGE) || (player->mo->flags7 & MF7_NOTELEFRAGPIERCE)) //rawdamage is never modified. + if ((rawdamage < TELEFRAG_DAMAGE) || (player->mo->flags7 & MF7_LAXTELEFRAGDMG)) //rawdamage is never modified. { // if we are telefragging don't let the damage value go below that magic value. Some further checks would fail otherwise. damage = newdam; From ae3b52a68a6fbd92612545f3de5c61e60509c929 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 4 Jun 2015 09:20:55 +0200 Subject: [PATCH 16/25] - fixed: Software renderer's colormap variables should not be accessed from common renderer interface code. --- src/r_swrenderer.cpp | 7 +++++++ src/r_utility.cpp | 11 ----------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/src/r_swrenderer.cpp b/src/r_swrenderer.cpp index df928b25ec..051506e117 100644 --- a/src/r_swrenderer.cpp +++ b/src/r_swrenderer.cpp @@ -267,6 +267,11 @@ void FSoftwareRenderer::RenderTextureView (FCanvasTexture *tex, AActor *viewpoin BYTE *Pixels = const_cast(tex->GetPixels()); DSimpleCanvas *Canvas = tex->GetCanvas(); + // curse Doom's overuse of global variables in the renderer. + // These get clobbered by rendering to a camera texture but they need to be preserved so the final rendering can be done with the correct palette. + unsigned char *savecolormap = fixedcolormap; + FSpecialColormap *savecm = realfixedcolormap; + float savedfov = LastFOV; R_SetFOV ((float)fov); R_RenderViewToCanvas (viewpoint, Canvas, 0, 0, tex->GetWidth(), tex->GetHeight(), tex->bFirstUpdate); @@ -280,6 +285,8 @@ void FSoftwareRenderer::RenderTextureView (FCanvasTexture *tex, AActor *viewpoin FTexture::FlipNonSquareBlockRemap (Pixels, Canvas->GetBuffer(), tex->GetWidth(), tex->GetHeight(), Canvas->GetPitch(), GPalette.Remap); } tex->SetUpdated(); + fixedcolormap = savecolormap; + realfixedcolormap = savecm; } //========================================================================== diff --git a/src/r_utility.cpp b/src/r_utility.cpp index 60e2c1af15..cfe1767c77 100644 --- a/src/r_utility.cpp +++ b/src/r_utility.cpp @@ -62,9 +62,6 @@ extern bool DrawFSHUD; // [RH] Defined in d_main.cpp EXTERN_CVAR (Bool, cl_capfps) -extern lighttable_t* fixedcolormap; -extern FSpecialColormap*realfixedcolormap; - // TYPES ------------------------------------------------------------------- struct InterpolationViewer @@ -1101,11 +1098,6 @@ void FCanvasTextureInfo::UpdateAll () { FCanvasTextureInfo *probe; - // curse Doom's overuse of global variables in the renderer. - // These get clobbered by rendering to a camera texture but they need to be preserved so the final rendering can be done with the correct palette. - unsigned char *savecolormap = fixedcolormap; - FSpecialColormap *savecm = realfixedcolormap; - for (probe = List; probe != NULL; probe = probe->Next) { if (probe->Viewpoint != NULL && probe->Texture->bNeedsUpdate) @@ -1113,9 +1105,6 @@ void FCanvasTextureInfo::UpdateAll () Renderer->RenderTextureView(probe->Texture, probe->Viewpoint, probe->FOV); } } - - fixedcolormap = savecolormap; - realfixedcolormap = savecm; } //========================================================================== From 7497b329c296ee36e29c2315efef733e8ab3818f Mon Sep 17 00:00:00 2001 From: Braden Obrzut Date: Fri, 5 Jun 2015 21:57:42 -0400 Subject: [PATCH 17/25] - Fixed: zipdir wrote the central directory incorrectly on PowerPC. --- tools/zipdir/zipdir.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/zipdir/zipdir.c b/tools/zipdir/zipdir.c index db6a57e1ef..ae354af633 100644 --- a/tools/zipdir/zipdir.c +++ b/tools/zipdir/zipdir.c @@ -804,7 +804,7 @@ void write_zip(const char *zipname, dir_tree_t *trees, int update) if (i == num_files) { // Write central directory. - dirend.DirectoryOffset = ftell(zip); + dirend.DirectoryOffset = LittleLong(ftell(zip)); for (i = 0; i < num_files; ++i) { write_central_dir(zip, sorted + i); @@ -814,8 +814,8 @@ void write_zip(const char *zipname, dir_tree_t *trees, int update) dirend.DiskNumber = 0; dirend.FirstDisk = 0; dirend.NumEntriesOnAllDisks = dirend.NumEntries = LittleShort(i); - dirend.DirectorySize = LittleLong(ftell(zip) - dirend.DirectoryOffset); - dirend.DirectoryOffset = LittleLong(dirend.DirectoryOffset); + // In this case LittleLong(dirend.DirectoryOffset) is undoing the transformation done above. + dirend.DirectorySize = LittleLong(ftell(zip) - LittleLong(dirend.DirectoryOffset)); dirend.ZipCommentLength = 0; if (fwrite(&dirend, sizeof(dirend), 1, zip) != 1) { @@ -1405,7 +1405,7 @@ BYTE *find_central_dir(FILE *fin) if (pos_found == 0 || fseek(fin, pos_found, SEEK_SET) != 0 || fread(&eod, sizeof(eod), 1, fin) != 1 || - fseek(fin, LittleShort(eod.DirectoryOffset), SEEK_SET) != 0) + fseek(fin, LittleLong(eod.DirectoryOffset), SEEK_SET) != 0) { return NULL; } From 662345adb8f65506d341fc82f2c3c599ae9722b7 Mon Sep 17 00:00:00 2001 From: Braden Obrzut Date: Fri, 5 Jun 2015 22:22:54 -0400 Subject: [PATCH 18/25] - Fixed: More endian issues in the ACS VM. --- src/p_acs.cpp | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 5cd5774f49..2cc9f958f2 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -1959,13 +1959,12 @@ bool FBehavior::Init(int lumpnum, FileReader * fr, int len) chunk = (DWORD *)FindChunk (MAKE_ID('M','S','T','R')); if (chunk != NULL) { - for (DWORD i = 0; i < chunk[1]/4; ++i) + for (DWORD i = 0; i < LittleLong(chunk[1])/4; ++i) { -// MapVarStore[chunk[i+2]] |= LibraryID; - const char *str = LookupString(MapVarStore[chunk[i+2]]); + const char *str = LookupString(MapVarStore[LittleLong(chunk[i+2])]); if (str != NULL) { - MapVarStore[chunk[i+2]] = GlobalACSStrings.AddString(str, NULL, 0); + MapVarStore[LittleLong(chunk[i+2])] = GlobalACSStrings.AddString(str, NULL, 0); } } } @@ -1973,7 +1972,7 @@ bool FBehavior::Init(int lumpnum, FileReader * fr, int len) chunk = (DWORD *)FindChunk (MAKE_ID('A','S','T','R')); if (chunk != NULL) { - for (DWORD i = 0; i < chunk[1]/4; ++i) + for (DWORD i = 0; i < LittleLong(chunk[1])/4; ++i) { int arraynum = MapVarStore[LittleLong(chunk[i+2])]; if ((unsigned)arraynum < (unsigned)NumArrays) @@ -2000,13 +1999,13 @@ bool FBehavior::Init(int lumpnum, FileReader * fr, int len) // First byte is version, it should be 0 if(*chunkData++ == 0) { - int arraynum = MapVarStore[uallong(*(const int*)(chunkData))]; + int arraynum = MapVarStore[uallong(LittleLong(*(const int*)(chunkData)))]; chunkData += 4; if ((unsigned)arraynum < (unsigned)NumArrays) { SDWORD *elems = ArrayStore[arraynum].Elements; // Ending zeros may be left out. - for (int j = MIN(chunk[1]-5, ArrayStore[arraynum].ArraySize); j > 0; --j, ++elems, ++chunkData) + for (int j = MIN(LittleLong(chunk[1])-5, ArrayStore[arraynum].ArraySize); j > 0; --j, ++elems, ++chunkData) { // For ATAG, a value of 0 = Integer, 1 = String, 2 = FunctionPtr // Our implementation uses the same tags for both String and FunctionPtr @@ -2073,7 +2072,7 @@ bool FBehavior::Init(int lumpnum, FileReader * fr, int len) ScriptFunction *func = &((ScriptFunction *)Functions)[j]; if (func->Address == 0 && func->ImportNum == 0) { - int libfunc = lib->FindFunctionName ((char *)(chunk + 2) + chunk[3+j]); + int libfunc = lib->FindFunctionName ((char *)(chunk + 2) + LittleLong(chunk[3+j])); if (libfunc >= 0) { ScriptFunction *realfunc = &((ScriptFunction *)lib->Functions)[libfunc]; @@ -2086,14 +2085,14 @@ bool FBehavior::Init(int lumpnum, FileReader * fr, int len) if (realfunc->ArgCount != func->ArgCount) { Printf (TEXTCOLOR_ORANGE "Function %s in %s has %d arguments. %s expects it to have %d.\n", - (char *)(chunk + 2) + chunk[3+j], lib->ModuleName, realfunc->ArgCount, + (char *)(chunk + 2) + LittleLong(chunk[3+j]), lib->ModuleName, realfunc->ArgCount, ModuleName, func->ArgCount); Format = ACS_Unknown; } // The next two properties do not affect code compatibility, so it is // okay for them to be different in the imported module than they are // in this one, as long as we make sure to use the real values. - func->LocalCount = realfunc->LocalCount; + func->LocalCount = LittleLong(realfunc->LocalCount); func->HasReturnValue = realfunc->HasReturnValue; } } @@ -2105,7 +2104,7 @@ bool FBehavior::Init(int lumpnum, FileReader * fr, int len) if (chunk != NULL) { char *parse = (char *)&chunk[2]; - for (DWORD j = 0; j < chunk[1]; ) + for (DWORD j = 0; j < LittleLong(chunk[1]); ) { DWORD varNum = LittleLong(*(DWORD *)&parse[j]); j += 4; From a87a86198c8736d6334bd236f0dc6e8e7e6784eb Mon Sep 17 00:00:00 2001 From: "Eevee (Alex Munroe)" Date: Sat, 6 Jun 2015 15:27:03 -0700 Subject: [PATCH 19/25] Transfer friction to swimmable 3D floors. --- src/p_map.cpp | 39 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 36 insertions(+), 3 deletions(-) diff --git a/src/p_map.cpp b/src/p_map.cpp index b76919a7de..3676225b12 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -574,6 +574,27 @@ int P_GetFriction(const AActor *mo, int *frictionfactor) { friction = secfriction(mo->Sector); movefactor = secmovefac(mo->Sector) >> 1; + +#ifdef _3DFLOORS + // Check 3D floors -- might be the source of the waterlevel + for (unsigned i = 0; i < mo->Sector->e->XFloor.ffloors.Size(); i++) + { + F3DFloor *rover = mo->Sector->e->XFloor.ffloors[i]; + if (!(rover->flags & FF_EXISTS)) continue; + if (!(rover->flags & FF_SWIMMABLE)) continue; + + if (mo->z > rover->top.plane->ZatPoint(mo->x, mo->y) || + mo->z < rover->bottom.plane->ZatPoint(mo->x, mo->y)) + continue; + + newfriction = secfriction(rover->model); + if (newfriction < friction || friction == ORIG_FRICTION) + { + friction = newfriction; + movefactor = secmovefac(rover->model) >> 1; + } + } +#endif } else if (var_friction && !(mo->flags & (MF_NOCLIP | MF_NOGRAVITY))) { // When the object is straddling sectors with the same @@ -590,10 +611,22 @@ int P_GetFriction(const AActor *mo, int *frictionfactor) { F3DFloor *rover = sec->e->XFloor.ffloors[i]; if (!(rover->flags & FF_EXISTS)) continue; - if (!(rover->flags & FF_SOLID)) continue; - // Player must be on top of the floor to be affected... - if (mo->z != rover->top.plane->ZatPoint(mo->x, mo->y)) continue; + if (rover->flags & FF_SOLID) + { + // Must be standing on a solid floor + if (mo->z != rover->top.plane->ZatPoint(mo->x, mo->y)) continue; + } + else if (rover->flags & FF_SWIMMABLE) + { + // Or on or inside a swimmable floor (e.g. in shallow water) + if (mo->z > rover->top.plane->ZatPoint(mo->x, mo->y) || + (mo->z + mo->height) < rover->bottom.plane->ZatPoint(mo->x, mo->y)) + continue; + } + else + continue; + newfriction = secfriction(rover->model); if (newfriction < friction || friction == ORIG_FRICTION) { From 8a428e69b6bcd4ec18832f4706866da224babf65 Mon Sep 17 00:00:00 2001 From: "Eevee (Alex Munroe)" Date: Sat, 6 Jun 2015 15:31:12 -0700 Subject: [PATCH 20/25] Don't play a terrain splash if the player didn't take damage. --- src/p_spec.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/p_spec.cpp b/src/p_spec.cpp index 42a7b9ca46..5f29c3c53d 100644 --- a/src/p_spec.cpp +++ b/src/p_spec.cpp @@ -738,12 +738,13 @@ void P_PlayerOnSpecialFlat (player_t *player, int floorType) } } + int damage = 0; if (ironfeet == NULL) { - P_DamageMobj (player->mo, NULL, NULL, Terrains[floorType].DamageAmount, + damage = P_DamageMobj (player->mo, NULL, NULL, Terrains[floorType].DamageAmount, Terrains[floorType].DamageMOD); } - if (Terrains[floorType].Splash != -1) + if (damage > 0 && Terrains[floorType].Splash != -1) { S_Sound (player->mo, CHAN_AUTO, Splashes[Terrains[floorType].Splash].NormalSplashSound, 1, From 221c2d2d822bc44d1ccafa9f53fca3225aacd860 Mon Sep 17 00:00:00 2001 From: "Eevee (Alex Munroe)" Date: Sat, 6 Jun 2015 16:03:11 -0700 Subject: [PATCH 21/25] Transfer flat-based damage (P_PlayerOnSpecialFlat) to 3D floors. --- src/p_3dfloors.cpp | 12 ++++++++++-- src/p_spec.cpp | 6 ------ src/p_user.cpp | 8 +++++++- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/src/p_3dfloors.cpp b/src/p_3dfloors.cpp index cc76beaa31..2f81dd6a80 100644 --- a/src/p_3dfloors.cpp +++ b/src/p_3dfloors.cpp @@ -41,6 +41,7 @@ #include "w_wad.h" #include "sc_man.h" #include "g_level.h" +#include "p_terrain.h" #include "r_data/colormaps.h" #ifdef _3DFLOORS @@ -341,8 +342,15 @@ void P_PlayerOnSpecial3DFloor(player_t* player) (player->mo->z + player->mo->height) < rover->bottom.plane->ZatPoint(player->mo->x, player->mo->y)) continue; } - - if (rover->model->special || rover->model->damage) P_PlayerInSpecialSector(player, rover->model); + + // Apply sector specials + if (rover->model->special || rover->model->damage) + P_PlayerInSpecialSector(player, rover->model); + + // Apply flat specials (using the ceiling!) + P_PlayerOnSpecialFlat( + player, TerrainTypes[rover->model->GetTexture(sector_t::ceiling)]); + break; } } diff --git a/src/p_spec.cpp b/src/p_spec.cpp index 5f29c3c53d..9bc0d4a9bc 100644 --- a/src/p_spec.cpp +++ b/src/p_spec.cpp @@ -718,12 +718,6 @@ void P_GiveSecret(AActor *actor, bool printmessage, bool playsound, int sectornu void P_PlayerOnSpecialFlat (player_t *player, int floorType) { - if (player->mo->z > player->mo->Sector->floorplane.ZatPoint ( - player->mo->x, player->mo->y) && - !player->mo->waterlevel) - { // Player is not touching the floor - return; - } if (Terrains[floorType].DamageAmount && !(level.time & Terrains[floorType].DamageTimeMask)) { diff --git a/src/p_user.cpp b/src/p_user.cpp index 5f9a69c3a0..0617e5d6a1 100644 --- a/src/p_user.cpp +++ b/src/p_user.cpp @@ -2535,7 +2535,13 @@ void P_PlayerThink (player_t *player) { P_PlayerInSpecialSector (player); } - P_PlayerOnSpecialFlat (player, P_GetThingFloorType (player->mo)); + if (player->mo->z <= player->mo->Sector->floorplane.ZatPoint( + player->mo->x, player->mo->y) || + player->mo->waterlevel) + { + // Player must be touching the floor + P_PlayerOnSpecialFlat(player, P_GetThingFloorType(player->mo)); + } if (player->mo->velz <= -player->mo->FallingScreamMinSpeed && player->mo->velz >= -player->mo->FallingScreamMaxSpeed && !player->morphTics && player->mo->waterlevel == 0) From 8fa9aa26275e71b32cd92065c7ba6d80c7fd1b17 Mon Sep 17 00:00:00 2001 From: "Eevee (Alex Munroe)" Date: Sat, 6 Jun 2015 18:08:18 -0700 Subject: [PATCH 22/25] Use the correct sidedef's middle scaling when drawing 3D floors. This wants `curline->sidedef`, which is the 3D sidedef currently being drawn. `sidedef` appears to be the last regular sidedef that happened to be drawn? The perils of globals. --- src/r_segs.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/r_segs.cpp b/src/r_segs.cpp index cf00abc452..bfa4fdee4c 100644 --- a/src/r_segs.cpp +++ b/src/r_segs.cpp @@ -557,8 +557,8 @@ void R_RenderFakeWall(drawseg_t *ds, int x1, int x2, F3DFloor *rover) MaskedSWall = (fixed_t *)(openings + ds->swall) - ds->x1; // find positioning - xscale = FixedMul(rw_pic->xScale, sidedef->GetTextureXScale(side_t::mid)); - yscale = FixedMul(rw_pic->yScale, sidedef->GetTextureYScale(side_t::mid)); + xscale = FixedMul(rw_pic->xScale, curline->sidedef->GetTextureXScale(side_t::mid)); + yscale = FixedMul(rw_pic->yScale, curline->sidedef->GetTextureYScale(side_t::mid)); // encapsulate the lifetime of rowoffset fixed_t rowoffset = curline->sidedef->GetTextureYOffset(side_t::mid) + rover->master->sidedef[0]->GetTextureYOffset(side_t::mid); dc_texturemid = rover->model->GetPlaneTexZ(sector_t::ceiling); From 15b97c14093d80563f4773d17ea00e86b7b13ad0 Mon Sep 17 00:00:00 2001 From: "Eevee (Alex Munroe)" Date: Sat, 6 Jun 2015 18:26:13 -0700 Subject: [PATCH 23/25] Fix scaling of 3D floor wall textures. The scale factors are now taken from the same part of the sidedef that provides the texture. --- src/r_segs.cpp | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/r_segs.cpp b/src/r_segs.cpp index bfa4fdee4c..7bcfec13a2 100644 --- a/src/r_segs.cpp +++ b/src/r_segs.cpp @@ -557,8 +557,25 @@ void R_RenderFakeWall(drawseg_t *ds, int x1, int x2, F3DFloor *rover) MaskedSWall = (fixed_t *)(openings + ds->swall) - ds->x1; // find positioning - xscale = FixedMul(rw_pic->xScale, curline->sidedef->GetTextureXScale(side_t::mid)); - yscale = FixedMul(rw_pic->yScale, curline->sidedef->GetTextureYScale(side_t::mid)); + side_t *scaledside; + side_t::ETexpart scaledpart; + if (rover->flags & FF_UPPERTEXTURE) + { + scaledside = curline->sidedef; + scaledpart = side_t::top; + } + else if (rover->flags & FF_LOWERTEXTURE) + { + scaledside = curline->sidedef; + scaledpart = side_t::bottom; + } + else + { + scaledside = rover->master->sidedef[0]; + scaledpart = side_t::mid; + } + xscale = FixedMul(rw_pic->xScale, scaledside->GetTextureXScale(scaledpart)); + yscale = FixedMul(rw_pic->yScale, scaledside->GetTextureYScale(scaledpart)); // encapsulate the lifetime of rowoffset fixed_t rowoffset = curline->sidedef->GetTextureYOffset(side_t::mid) + rover->master->sidedef[0]->GetTextureYOffset(side_t::mid); dc_texturemid = rover->model->GetPlaneTexZ(sector_t::ceiling); From 3fea074d35d971cbfceef96c1b5dd57a468455fe Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 7 Jun 2015 09:33:15 +0200 Subject: [PATCH 24/25] - respect FF_INVERTSECTOR when checking a 3D floor's terrain. --- src/p_3dfloors.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_3dfloors.cpp b/src/p_3dfloors.cpp index 2f81dd6a80..8091ffb92c 100644 --- a/src/p_3dfloors.cpp +++ b/src/p_3dfloors.cpp @@ -349,7 +349,7 @@ void P_PlayerOnSpecial3DFloor(player_t* player) // Apply flat specials (using the ceiling!) P_PlayerOnSpecialFlat( - player, TerrainTypes[rover->model->GetTexture(sector_t::ceiling)]); + player, TerrainTypes[rover->model->GetTexture(rover->flags & FF_INVERTSECTOR? sector_t::floor : sector_t::ceiling)]); break; } From 4444d3c0c50c220978ec1c7a8d62eaa43a9d42ba Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 7 Jun 2015 09:41:44 +0200 Subject: [PATCH 25/25] - removed the _3DFLOOR #define because we really do not want to comment this out anymore, right? --- src/am_map.cpp | 8 ------- src/g_heretic/a_hereticweaps.cpp | 4 ---- src/g_shared/a_decals.cpp | 2 -- src/p_3dfloors.cpp | 4 ---- src/p_3dfloors.h | 38 -------------------------------- src/p_enemy.cpp | 2 -- src/p_map.cpp | 32 --------------------------- src/p_mobj.cpp | 16 -------------- src/p_setup.cpp | 2 -- src/p_sight.cpp | 6 ----- src/p_trace.cpp | 10 --------- 11 files changed, 124 deletions(-) diff --git a/src/am_map.cpp b/src/am_map.cpp index 0133a2493a..fdbacd34f9 100644 --- a/src/am_map.cpp +++ b/src/am_map.cpp @@ -1935,8 +1935,6 @@ void AM_drawSubsectors() scalex = sec->GetXScale(sector_t::floor); scaley = sec->GetYScale(sector_t::floor); -#ifdef _3DFLOORS - if (sec->e->XFloor.ffloors.Size()) { secplane_t *floorplane = &sec->floorplane; @@ -1997,7 +1995,6 @@ void AM_drawSubsectors() floorlight = *light->p_lightlevel; colormap = light->extra_colormap; } -#endif if (maptex == skyflatnum) { continue; @@ -2153,8 +2150,6 @@ void AM_showSS() } } -#ifdef _3DFLOORS - //============================================================================= // // Determines if a 3D floor boundary should be drawn @@ -2214,7 +2209,6 @@ bool AM_Check3DFloors(line_t *line) // All 3D floors could be matched so let's not draw a boundary. return false; } -#endif //============================================================================= // @@ -2345,12 +2339,10 @@ void AM_drawWalls (bool allmap) { AM_drawMline(&l, AMColors.CDWallColor); // ceiling level change } -#ifdef _3DFLOORS else if (AM_Check3DFloors(&lines[i])) { AM_drawMline(&l, AMColors.EFWallColor); // Extra floor border } -#endif else if (am_cheat > 0 && am_cheat < 4) { AM_drawMline(&l, AMColors.TSWallColor); diff --git a/src/g_heretic/a_hereticweaps.cpp b/src/g_heretic/a_hereticweaps.cpp index 17c9621d59..afc4f60079 100644 --- a/src/g_heretic/a_hereticweaps.cpp +++ b/src/g_heretic/a_hereticweaps.cpp @@ -1046,7 +1046,6 @@ DEFINE_ACTION_FUNCTION(AActor, A_SkullRodStorm) x = self->x + ((pr_storm()&127) - 64) * FRACUNIT; y = self->y + ((pr_storm()&127) - 64) * FRACUNIT; mo = Spawn (x, y, ONCEILINGZ, ALLOW_REPLACE); -#ifdef _3DFLOORS // We used bouncecount to store the 3D floor index in A_HideInCeiling if (!mo) return; fixed_t newz; @@ -1058,7 +1057,6 @@ DEFINE_ACTION_FUNCTION(AActor, A_SkullRodStorm) int moceiling = P_Find3DFloor(NULL, x, y, newz, false, false, newz); if (moceiling >= 0) mo->z = newz - mo->height; -#endif mo->Translation = multiplayer ? TRANSLATION(TRANSLATION_PlayersExtra,self->special2) : 0; mo->target = self->target; @@ -1098,7 +1096,6 @@ DEFINE_ACTION_FUNCTION(AActor, A_RainImpact) DEFINE_ACTION_FUNCTION(AActor, A_HideInCeiling) { -#ifdef _3DFLOORS // We use bouncecount to store the 3D floor index fixed_t foo; for (unsigned int i=0; i< self->Sector->e->XFloor.ffloors.Size(); i++) @@ -1114,7 +1111,6 @@ DEFINE_ACTION_FUNCTION(AActor, A_HideInCeiling) } } self->bouncecount = -1; -#endif self->z = self->ceilingz + 4*FRACUNIT; } diff --git a/src/g_shared/a_decals.cpp b/src/g_shared/a_decals.cpp index 576ff6a5cd..29fcbf8cbc 100644 --- a/src/g_shared/a_decals.cpp +++ b/src/g_shared/a_decals.cpp @@ -272,7 +272,6 @@ FTextureID DBaseDecal::StickToWall (side_t *wall, fixed_t x, fixed_t y, F3DFloor Z -= back->GetPlaneTexZ(sector_t::ceiling); tex = wall->GetTexture(side_t::top); } -#ifdef _3DFLOORS else if (ffloor) // this is a 3d-floor segment - do this only if we know which one! { Sector=ffloor->model; @@ -295,7 +294,6 @@ FTextureID DBaseDecal::StickToWall (side_t *wall, fixed_t x, fixed_t y, F3DFloor tex = ffloor->master->sidedef[0]->GetTexture(side_t::mid); } } -#endif else return FNullTextureID(); CalcFracPos (wall, x, y); diff --git a/src/p_3dfloors.cpp b/src/p_3dfloors.cpp index 8091ffb92c..5b29959cbe 100644 --- a/src/p_3dfloors.cpp +++ b/src/p_3dfloors.cpp @@ -44,8 +44,6 @@ #include "p_terrain.h" #include "r_data/colormaps.h" -#ifdef _3DFLOORS - //========================================================================== // // 3D Floors @@ -959,8 +957,6 @@ int P_Find3DFloor(sector_t * sec, fixed_t x, fixed_t y, fixed_t z, bool above, b return -1; } -#endif - #include "c_dispatch.h" diff --git a/src/p_3dfloors.h b/src/p_3dfloors.h index 8d42560af0..8abd23f032 100644 --- a/src/p_3dfloors.h +++ b/src/p_3dfloors.h @@ -4,8 +4,6 @@ #define CenterSpot(sec) (vertex_t*)&(sec)->soundorg[0] -#define _3DFLOORS - // 3D floor flags. Most are the same as in Legacy but I added some for EDGE's and Vavoom's features as well. typedef enum { @@ -60,8 +58,6 @@ enum VC_COLORMASK = 0x00FFFFFF, }; -#ifdef _3DFLOORS - struct secplane_t; struct FDynamicColormap; @@ -149,39 +145,5 @@ void P_LineOpening_XFloors (FLineOpening &open, AActor * thing, const line_t *li secplane_t P_FindFloorPlane(sector_t * sector, fixed_t x, fixed_t y, fixed_t z); int P_Find3DFloor(sector_t * sec, fixed_t x, fixed_t y, fixed_t z, bool above, bool floor, fixed_t &cmpz); -#else - -// Dummy definitions for disabled 3D floor code - -struct F3DFloor -{ - int dummy; -}; - -struct lightlist_t -{ - int dummy; -}; - -class player_s; -inline void P_PlayerOnSpecial3DFloor(player_t* player) {} - -inline void P_Get3DFloorAndCeiling(AActor * thing, sector_t * sector, fixed_t * floorz, fixed_t * ceilingz, int * floorpic) {} -inline bool P_CheckFor3DFloorHit(AActor * mo) { return false; } -inline bool P_CheckFor3DCeilingHit(AActor * mo) { return false; } -inline void P_Recalculate3DFloors(sector_t *) {} -inline void P_RecalculateAttached3DFloors(sector_t * sec) {} -inline lightlist_t * P_GetPlaneLight(sector_t * , secplane_t * plane, bool underside) { return NULL; } -inline void P_Spawn3DFloors( void ) {} - -struct FLineOpening; - -inline void P_LineOpening_XFloors (FLineOpening &open, AActor * thing, const line_t *linedef, - fixed_t x, fixed_t y, fixed_t refx, fixed_t refy, bool restrict) {} - -//secplane_t P_FindFloorPlane(sector_t * sector, fixed_t x, fixed_t y, fixed_t z){return sector->floorplane;} - -#endif - #endif \ No newline at end of file diff --git a/src/p_enemy.cpp b/src/p_enemy.cpp index 3e17a85f35..10c4704d44 100644 --- a/src/p_enemy.cpp +++ b/src/p_enemy.cpp @@ -2548,7 +2548,6 @@ static bool P_CheckForResurrection(AActor *self, bool usevilestates) if (abs(corpsehit->x - viletryx) > maxdist || abs(corpsehit->y - viletryy) > maxdist) continue; // not actually touching -#ifdef _3DFLOORS // Let's check if there are floors in between the archvile and its target sector_t *vilesec = self->Sector; sector_t *corpsec = corpsehit->Sector; @@ -2566,7 +2565,6 @@ static bool P_CheckForResurrection(AActor *self, bool usevilestates) continue; } } -#endif corpsehit->velx = corpsehit->vely = 0; // [RH] Check against real height and radius diff --git a/src/p_map.cpp b/src/p_map.cpp index 3676225b12..197525aa47 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -249,7 +249,6 @@ void P_GetFloorCeilingZ(FCheckPosition &tmf, int flags) sec = tmf.thing->Sector; } -#ifdef _3DFLOORS for (unsigned int i = 0; ie->XFloor.ffloors.Size(); i++) { F3DFloor* rover = sec->e->XFloor.ffloors[i]; @@ -273,7 +272,6 @@ void P_GetFloorCeilingZ(FCheckPosition &tmf, int flags) tmf.ceilingpic = *rover->bottom.texture; } } -#endif } //========================================================================== @@ -575,7 +573,6 @@ int P_GetFriction(const AActor *mo, int *frictionfactor) friction = secfriction(mo->Sector); movefactor = secmovefac(mo->Sector) >> 1; -#ifdef _3DFLOORS // Check 3D floors -- might be the source of the waterlevel for (unsigned i = 0; i < mo->Sector->e->XFloor.ffloors.Size(); i++) { @@ -594,7 +591,6 @@ int P_GetFriction(const AActor *mo, int *frictionfactor) movefactor = secmovefac(rover->model) >> 1; } } -#endif } else if (var_friction && !(mo->flags & (MF_NOCLIP | MF_NOGRAVITY))) { // When the object is straddling sectors with the same @@ -605,7 +601,6 @@ int P_GetFriction(const AActor *mo, int *frictionfactor) { sec = m->m_sector; -#ifdef _3DFLOORS // 3D floors must be checked, too for (unsigned i = 0; i < sec->e->XFloor.ffloors.Size(); i++) { @@ -634,7 +629,6 @@ int P_GetFriction(const AActor *mo, int *frictionfactor) movefactor = secmovefac(rover->model); } } -#endif if (!(sec->special & FRICTION_MASK) && Terrains[TerrainTypes[sec->GetTexture(sector_t::floor)]].Friction == 0) @@ -789,14 +783,9 @@ bool PIT_CheckLine(line_t *ld, const FBoundingBox &box, FCheckPosition &tm) !(tm.thing->flags & (MF_NOGRAVITY | MF_NOCLIP))) { secplane_t frontplane, backplane; -#ifdef _3DFLOORS // Check 3D floors as well frontplane = P_FindFloorPlane(ld->frontsector, tm.thing->x, tm.thing->y, tm.thing->floorz); backplane = P_FindFloorPlane(ld->backsector, tm.thing->x, tm.thing->y, tm.thing->floorz); -#else - frontplane = ld->frontsector->floorplane; - backplane = ld->backsector->floorplane; -#endif if (frontplane.c < STEEPSLOPE || backplane.c < STEEPSLOPE) { const msecnode_t *node = tm.thing->touching_sectorlist; @@ -1457,7 +1446,6 @@ bool P_CheckPosition(AActor *thing, fixed_t x, fixed_t y, FCheckPosition &tm, bo //Added by MC: Fill the tmsector. tm.sector = newsec; -#ifdef _3DFLOORS //Check 3D floors if (!thing->IsNoClip2() && newsec->e->XFloor.ffloors.Size()) { @@ -1489,7 +1477,6 @@ bool P_CheckPosition(AActor *thing, fixed_t x, fixed_t y, FCheckPosition &tm, bo } } } -#endif validcount++; spechit.Clear(); @@ -1806,7 +1793,6 @@ static void CheckForPushSpecial(line_t *line, int side, AActor *mobj, bool windo fzb <= mobj->z && bzb <= mobj->z) { // we must also check if some 3D floor in the backsector may be blocking -#ifdef _3DFLOORS for (unsigned int i = 0; ibacksector->e->XFloor.ffloors.Size(); i++) { F3DFloor* rover = line->backsector->e->XFloor.ffloors[i]; @@ -1821,7 +1807,6 @@ static void CheckForPushSpecial(line_t *line, int side, AActor *mobj, bool windo goto isblocking; } } -#endif return; } } @@ -2746,7 +2731,6 @@ const secplane_t * P_CheckSlopeWalk(AActor *actor, fixed_t &xmove, fixed_t &ymov const secplane_t *plane = &actor->floorsector->floorplane; fixed_t planezhere = plane->ZatPoint(actor->x, actor->y); -#ifdef _3DFLOORS for (unsigned int i = 0; ifloorsector->e->XFloor.ffloors.Size(); i++) { F3DFloor * rover = actor->floorsector->e->XFloor.ffloors[i]; @@ -2781,7 +2765,6 @@ const secplane_t * P_CheckSlopeWalk(AActor *actor, fixed_t &xmove, fixed_t &ymov } } } -#endif if (actor->floorsector != actor->Sector) { @@ -3159,7 +3142,6 @@ struct aim_t AActor * thing_friend, *thing_other; angle_t pitch_friend, pitch_other; int flags; -#ifdef _3DFLOORS sector_t * lastsector; secplane_t * lastfloorplane; secplane_t * lastceilingplane; @@ -3167,13 +3149,11 @@ struct aim_t bool crossedffloors; bool AimTraverse3DFloors(const divline_t &trace, intercept_t * in); -#endif void AimTraverse(fixed_t startx, fixed_t starty, fixed_t endx, fixed_t endy, AActor *target = NULL); }; -#ifdef _3DFLOORS //============================================================================ // // AimTraverse3DFloors @@ -3275,7 +3255,6 @@ bool aim_t::AimTraverse3DFloors(const divline_t &trace, intercept_t * in) lastfloorplane = nextbottomplane; return true; } -#endif //============================================================================ // @@ -3328,9 +3307,7 @@ void aim_t::AimTraverse(fixed_t startx, fixed_t starty, fixed_t endx, fixed_t en if (toppitch >= bottompitch) return; // stop -#ifdef _3DFLOORS if (!AimTraverse3DFloors(it.Trace(), in)) return; -#endif continue; // shot continues } @@ -3369,7 +3346,6 @@ void aim_t::AimTraverse(fixed_t startx, fixed_t starty, fixed_t endx, fixed_t en continue; } -#ifdef _3DFLOORS // we must do one last check whether the trace has crossed a 3D floor if (lastsector == th->Sector && th->Sector->e->XFloor.ffloors.Size()) { @@ -3394,7 +3370,6 @@ void aim_t::AimTraverse(fixed_t startx, fixed_t starty, fixed_t endx, fixed_t en } } } -#endif // check angles to see if the thing can be aimed at @@ -3408,7 +3383,6 @@ void aim_t::AimTraverse(fixed_t startx, fixed_t starty, fixed_t endx, fixed_t en if (thingbottompitch < toppitch) continue; // shot under the thing -#ifdef _3DFLOORS if (crossedffloors) { // if 3D floors were in the way do an extra visibility check for safety @@ -3427,7 +3401,6 @@ void aim_t::AimTraverse(fixed_t startx, fixed_t starty, fixed_t endx, fixed_t en else return; } } -#endif // this thing can be hit! if (thingtoppitch < toppitch) @@ -3564,7 +3537,6 @@ fixed_t P_AimLineAttack(AActor *t1, angle_t angle, fixed_t distance, AActor **pL // Information for tracking crossed 3D floors aim.aimpitch = t1->pitch; -#ifdef _3DFLOORS aim.crossedffloors = t1->Sector->e->XFloor.ffloors.Size() != 0; aim.lastsector = t1->Sector; aim.lastfloorplane = aim.lastceilingplane = NULL; @@ -3580,7 +3552,6 @@ fixed_t P_AimLineAttack(AActor *t1, angle_t angle, fixed_t distance, AActor **pL bottomz = rover->top.plane->ZatPoint(t1->x, t1->y); if (bottomz <= t1->z) aim.lastfloorplane = rover->top.plane; } -#endif aim.AimTraverse(t1->x, t1->y, x2, y2, target); @@ -5456,7 +5427,6 @@ bool P_ChangeSector(sector_t *sector, int crunch, int amt, int floorOrCeil, bool cpos.movemidtex = false; cpos.sector = sector; -#ifdef _3DFLOORS // Also process all sectors that have 3D floors transferred from the // changed sector. if (sector->e->XFloor.attached.Size()) @@ -5504,8 +5474,6 @@ bool P_ChangeSector(sector_t *sector, int crunch, int amt, int floorOrCeil, bool } } P_Recalculate3DFloors(sector); // Must recalculate the 3d floor and light lists -#endif - // [RH] Use different functions for the four different types of sector // movement. diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index b0fc0d08ed..267e71bb9a 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -1316,7 +1316,6 @@ void P_ExplodeMissile (AActor *mo, line_t *line, AActor *target) z = mo->z; F3DFloor * ffloor=NULL; -#ifdef _3DFLOORS if (line->sidedef[side^1] != NULL) { sector_t * backsector = line->sidedef[side^1]->sector; @@ -1336,7 +1335,6 @@ void P_ExplodeMissile (AActor *mo, line_t *line, AActor *target) } } } -#endif DImpactDecal::StaticCreate (base->GetDecal (), x, y, z, line->sidedef[side], ffloor); @@ -2164,7 +2162,6 @@ explode: { if (mo->dropoffz != mo->floorz) // 3DMidtex or other special cases that must be excluded { -#ifdef _3DFLOORS unsigned i; for(i=0;iSector->e->XFloor.ffloors.Size();i++) { @@ -2175,7 +2172,6 @@ explode: if (rover->flags&FF_SOLID && rover->top.plane->ZatPoint(mo->x,mo->y)==mo->floorz) break; } if (i==mo->Sector->e->XFloor.ffloors.Size()) -#endif return oldfloorz; } } @@ -3567,12 +3563,8 @@ void AActor::Tick () { secplane_t floorplane; -#ifdef _3DFLOORS // Check 3D floors as well floorplane = P_FindFloorPlane(floorsector, x, y, floorz); -#else - floorplane = floorsector->floorplane; -#endif if (floorplane.c < STEEPSLOPE && floorplane.ZatPoint (x, y) <= floorz) @@ -3889,7 +3881,6 @@ bool AActor::UpdateWaterLevel (fixed_t oldz, bool dosplash) reset = true; } } -#ifdef _3DFLOORS else { // Check 3D floors as well! @@ -3923,7 +3914,6 @@ bool AActor::UpdateWaterLevel (fixed_t oldz, bool dosplash) break; } } -#endif } // some additional checks to make deep sectors like Boom's splash without setting @@ -5371,7 +5361,6 @@ bool P_HitWater (AActor * thing, sector_t * sec, fixed_t x, fixed_t y, fixed_t z } #endif -#ifdef _3DFLOORS for(unsigned int i=0;ie->XFloor.ffloors.Size();i++) { F3DFloor * rover = sec->e->XFloor.ffloors[i]; @@ -5388,7 +5377,6 @@ bool P_HitWater (AActor * thing, sector_t * sec, fixed_t x, fixed_t y, fixed_t z planez = rover->bottom.plane->ZatPoint(x, y); if (planez < z && !(planez < thing->floorz)) return false; } -#endif hsec = sec->GetHeightSec(); if (hsec == NULL || !(hsec->MoreFlags & SECF_CLIPFAKEPLANES)) { @@ -5398,9 +5386,7 @@ bool P_HitWater (AActor * thing, sector_t * sec, fixed_t x, fixed_t y, fixed_t z { terrainnum = TerrainTypes[hsec->GetTexture(sector_t::floor)]; } -#ifdef _3DFLOORS foundone: -#endif int splashnum = Terrains[terrainnum].Splash; bool smallsplash = false; @@ -5503,7 +5489,6 @@ bool P_HitFloor (AActor *thing) break; } -#ifdef _3DFLOORS // Check 3D floors for(unsigned int i=0;im_sector->e->XFloor.ffloors.Size();i++) { @@ -5517,7 +5502,6 @@ bool P_HitFloor (AActor *thing) } } } -#endif } if (m == NULL || m->m_sector->GetHeightSec() != NULL) { diff --git a/src/p_setup.cpp b/src/p_setup.cpp index fb6b34b53d..14b19348e6 100644 --- a/src/p_setup.cpp +++ b/src/p_setup.cpp @@ -2519,7 +2519,6 @@ void P_ProcessSideTextures(bool checktranmap, side_t *sd, sector_t *sec, intmaps } break; -#ifdef _3DFLOORS case Sector_Set3DFloor: if (msd->toptexture[0]=='#') { @@ -2534,7 +2533,6 @@ void P_ProcessSideTextures(bool checktranmap, side_t *sd, sector_t *sec, intmaps SetTexture(sd, side_t::mid, msd->midtexture, missingtex); SetTexture(sd, side_t::bottom, msd->bottomtexture, missingtex); break; -#endif case TranslucentLine: // killough 4/11/98: apply translucency to 2s normal texture if (checktranmap) diff --git a/src/p_sight.cpp b/src/p_sight.cpp index ef4dfacd0e..135698b8bc 100644 --- a/src/p_sight.cpp +++ b/src/p_sight.cpp @@ -127,7 +127,6 @@ bool SightCheck::PTR_SightTraverse (intercept_t *in) if (topslope <= bottomslope) return false; // stop -#ifdef _3DFLOORS // now handle 3D-floors if(li->frontsector->e->XFloor.ffloors.Size() || li->backsector->e->XFloor.ffloors.Size()) { @@ -219,7 +218,6 @@ bool SightCheck::PTR_SightTraverse (intercept_t *in) lastztop= FixedMul (topslope, in->frac) + sightzstart; lastzbottom= FixedMul (bottomslope, in->frac) + sightzstart; -#endif return true; // keep going } @@ -401,7 +399,6 @@ bool SightCheck::P_SightTraverseIntercepts () } } -#ifdef _3DFLOORS if (lastsector==seeingthing->Sector && lastsector->e->XFloor.ffloors.Size()) { // we must do one last check whether the trace has crossed a 3D floor in the last sector @@ -424,7 +421,6 @@ bool SightCheck::P_SightTraverseIntercepts () } } -#endif return true; // everything was traversed } @@ -453,7 +449,6 @@ bool SightCheck::P_SightPathTraverse (fixed_t x1, fixed_t y1, fixed_t x2, fixed_ validcount++; intercepts.Clear (); -#ifdef _3DFLOORS // for FF_SEETHROUGH the following rule applies: // If the viewer is in an area without FF_SEETHROUGH he can only see into areas without this flag // If the viewer is in an area with FF_SEETHROUGH he can only see into areas with this flag @@ -472,7 +467,6 @@ bool SightCheck::P_SightPathTraverse (fixed_t x1, fixed_t y1, fixed_t x2, fixed_ break; } } -#endif if ( ((x1-bmaporgx)&(MAPBLOCKSIZE-1)) == 0) x1 += FRACUNIT; // don't side exactly on a line diff --git a/src/p_trace.cpp b/src/p_trace.cpp index 26852269ab..07d23294b8 100644 --- a/src/p_trace.cpp +++ b/src/p_trace.cpp @@ -104,7 +104,6 @@ bool Trace (fixed_t x, fixed_t y, fixed_t z, sector_t *sector, res.Crossed3DWater = NULL; */ -#ifdef _3DFLOORS // Do a 3D floor check in the starting sector TDeletingArray &ff = sector->e->XFloor.ffloors; @@ -174,7 +173,6 @@ bool Trace (fixed_t x, fixed_t y, fixed_t z, sector_t *sector, } } } -#endif // check for overflows and clip if necessary SQWORD xd = (SQWORD)x + ( ( SQWORD(vx) * SQWORD(maxDist) )>>16); @@ -257,7 +255,6 @@ bool FTraceInfo::TraceTraverse (int ptflags) fixed_t dist; // Deal with splashes in 3D floors -#ifdef _3DFLOORS if (CurSector->e->XFloor.ffloors.Size()) { for(unsigned int i=0;ie->XFloor.ffloors.Size();i++) @@ -274,7 +271,6 @@ bool FTraceInfo::TraceTraverse (int ptflags) } } } -#endif if (in->isaline) { @@ -381,7 +377,6 @@ bool FTraceInfo::TraceTraverse (int ptflags) } else { // made it past the wall -#ifdef _3DFLOORS // check for 3D floors first if (entersector->e->XFloor.ffloors.Size()) { @@ -435,9 +430,6 @@ bool FTraceInfo::TraceTraverse (int ptflags) } } } -#endif - - Results->HitType = TRACE_HitNone; if (TraceFlags & TRACE_PCross) @@ -450,9 +442,7 @@ bool FTraceInfo::TraceTraverse (int ptflags) P_ActivateLine (in->d.line, IgnoreThis, lineside, SPAC_Impact); } } -#ifdef _3DFLOORS cont: -#endif if (Results->HitType != TRACE_HitNone) {