From 699f274b06dc44d5135c8bc6321f0e59997ef821 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Mon, 4 Jan 2016 10:51:54 +0200 Subject: [PATCH 1/3] Fixed mouse cursor centering in fullscreen mode Native OS X backed didn't center mouse cursor in fullscreen mode with Retina/HiDPI support enabled Incorrect size of content view led to placement of cursor in upper right corner of the screen upon releasing of mouse capture When some action is assigned to this corner using system Hot Corners feature, the given action was triggered on acquiring mouse capture --- src/posix/cocoa/i_video.mm | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/posix/cocoa/i_video.mm b/src/posix/cocoa/i_video.mm index 3fc2b2aed..e99443ee8 100644 --- a/src/posix/cocoa/i_video.mm +++ b/src/posix/cocoa/i_video.mm @@ -625,7 +625,7 @@ void CocoaVideo::SetFullscreenMode(const int width, const int height) [m_window setHidesOnDeactivate:YES]; } - [m_window setFrame:displayRect display:YES]; + [m_window setFrame:screenFrame display:YES]; [m_window setFrameOrigin:NSMakePoint(0.0f, 0.0f)]; } @@ -1231,10 +1231,7 @@ NSSize I_GetContentViewSize(const NSWindow* const window) const NSView* const view = [window contentView]; const NSSize frameSize = [view frame].size; - // TODO: figure out why [NSView frame] returns different values in "fullscreen" and in window - // In "fullscreen" the result is multiplied by [NSScreen backingScaleFactor], but not in window - - return (vid_hidpi && !fullscreen) + return (vid_hidpi) ? [view convertSizeToBacking:frameSize] : frameSize; } From 02ff3291bdfc8e7f3e75306204e18fe94aa39fa6 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Mon, 4 Jan 2016 12:15:14 +0200 Subject: [PATCH 2/3] Fixed division by zero in RNG Random number generator now returns zero for range [0, 0) --- src/m_random.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/m_random.h b/src/m_random.h index b5e21c63c..452ef41fc 100644 --- a/src/m_random.h +++ b/src/m_random.h @@ -57,7 +57,9 @@ public: // Returns a random number in the range [0,mod) int operator() (int mod) { - return GenRand32() % mod; + return (0 == mod) + ? 0 + : (GenRand32() % mod); } // Returns rand# - rand# From bd95c5eadf9c1ef79e9ca10de3844d73a1f7b0e5 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 4 Jan 2016 11:52:07 +0100 Subject: [PATCH 3/3] - fixed: the ambient sound things need both the args from the DoomEdNum mapping and the actual map. --- src/g_doomedmap.cpp | 13 +++- src/info.h | 2 +- src/p_mobj.cpp | 4 +- wadsrc/static/mapinfo/common.txt | 128 +++++++++++++++---------------- 4 files changed, 77 insertions(+), 70 deletions(-) diff --git a/src/g_doomedmap.cpp b/src/g_doomedmap.cpp index 08d5aa2e2..42157101d 100644 --- a/src/g_doomedmap.cpp +++ b/src/g_doomedmap.cpp @@ -81,7 +81,7 @@ struct MapinfoEdMapItem { FName classname; // DECORATE is read after MAPINFO so we do not have the actual classes available here yet. short special; - bool argsdefined; + signed char argsdefined; int args[5]; // These are for error reporting. We must store the file information because it's no longer available when these items get resolved. FString filename; @@ -181,14 +181,14 @@ void FMapInfoParser::ParseDoomEdNums() editem.special = -1; } memset(editem.args, 0, sizeof(editem.args)); - editem.argsdefined = false; + editem.argsdefined = 0; int minargs = 0; int maxargs = 5; FString specialname; if (sc.CheckString(",")) { - editem.argsdefined = true; // mark args as used - if this is done we need to prevent assignment of map args in P_SpawnMapThing. + editem.argsdefined = 5; // mark args as used - if this is done we need to prevent assignment of map args in P_SpawnMapThing. if (editem.special < 0) editem.special = 0; if (!sc.CheckNumber()) { @@ -221,7 +221,14 @@ void FMapInfoParser::ParseDoomEdNums() editem.args[i] = sc.Number; i++; if (!sc.CheckString(",")) break; + // special check for the ambient sounds which combine the arg being set here with the ones on the mapthing. + if (sc.CheckString("+")) + { + editem.argsdefined = i; + break; + } sc.MustGetNumber(); + } if (specialname.IsNotEmpty() && (i < minargs || i > maxargs)) { diff --git a/src/info.h b/src/info.h index bdbb69940..22e3b2f5c 100644 --- a/src/info.h +++ b/src/info.h @@ -283,7 +283,7 @@ struct FDoomEdEntry { const PClass *Type; short Special; - bool ArgsDefined; + signed char ArgsDefined; int Args[5]; }; diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index ab89ae04c..bc314dc0e 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -4674,10 +4674,10 @@ AActor *P_SpawnMapThing (FMapThing *mthing, int position) } // copy args to mapthing so that we have them in one place for the rest of this function - if (mentry->ArgsDefined) + if (mentry->ArgsDefined > 0) { if (mentry->Type!= NULL) mthing->special = mentry->Special; - memcpy(mthing->args, mentry->Args, sizeof(mthing->args)); + memcpy(mthing->args, mentry->Args, sizeof(mthing->args[0]) * mentry->ArgsDefined); } int pnum = -1; diff --git a/wadsrc/static/mapinfo/common.txt b/wadsrc/static/mapinfo/common.txt index f26ca6731..4b663047c 100644 --- a/wadsrc/static/mapinfo/common.txt +++ b/wadsrc/static/mapinfo/common.txt @@ -118,70 +118,70 @@ DoomEdNums 9997 = SecActExit 9998 = SecActEnter 9999 = SecActHitFloor - 14001 = AmbientSound, 1 - 14002 = AmbientSound, 2 - 14003 = AmbientSound, 3 - 14004 = AmbientSound, 4 - 14005 = AmbientSound, 5 - 14006 = AmbientSound, 6 - 14007 = AmbientSound, 7 - 14008 = AmbientSound, 8 - 14009 = AmbientSound, 9 - 14010 = AmbientSound, 10 - 14011 = AmbientSound, 11 - 14012 = AmbientSound, 12 - 14013 = AmbientSound, 13 - 14014 = AmbientSound, 14 - 14015 = AmbientSound, 15 - 14016 = AmbientSound, 16 - 14017 = AmbientSound, 17 - 14018 = AmbientSound, 18 - 14019 = AmbientSound, 19 - 14020 = AmbientSound, 20 - 14021 = AmbientSound, 21 - 14022 = AmbientSound, 22 - 14023 = AmbientSound, 23 - 14024 = AmbientSound, 24 - 14025 = AmbientSound, 25 - 14026 = AmbientSound, 26 - 14027 = AmbientSound, 27 - 14028 = AmbientSound, 28 - 14029 = AmbientSound, 29 - 14030 = AmbientSound, 30 - 14031 = AmbientSound, 31 - 14032 = AmbientSound, 32 - 14033 = AmbientSound, 33 - 14034 = AmbientSound, 34 - 14035 = AmbientSound, 35 - 14036 = AmbientSound, 36 - 14037 = AmbientSound, 37 - 14038 = AmbientSound, 38 - 14039 = AmbientSound, 39 - 14040 = AmbientSound, 40 - 14041 = AmbientSound, 41 - 14042 = AmbientSound, 42 - 14043 = AmbientSound, 43 - 14044 = AmbientSound, 44 - 14045 = AmbientSound, 45 - 14046 = AmbientSound, 46 - 14047 = AmbientSound, 47 - 14048 = AmbientSound, 48 - 14049 = AmbientSound, 49 - 14050 = AmbientSound, 50 - 14051 = AmbientSound, 51 - 14052 = AmbientSound, 52 - 14053 = AmbientSound, 53 - 14054 = AmbientSound, 54 - 14055 = AmbientSound, 55 - 14056 = AmbientSound, 56 - 14057 = AmbientSound, 57 - 14058 = AmbientSound, 58 - 14059 = AmbientSound, 59 - 14060 = AmbientSound, 60 - 14061 = AmbientSound, 61 - 14062 = AmbientSound, 62 - 14063 = AmbientSound, 63 - 14064 = AmbientSound, 64 + 14001 = AmbientSound, 1, + + 14002 = AmbientSound, 2, + + 14003 = AmbientSound, 3, + + 14004 = AmbientSound, 4, + + 14005 = AmbientSound, 5, + + 14006 = AmbientSound, 6, + + 14007 = AmbientSound, 7, + + 14008 = AmbientSound, 8, + + 14009 = AmbientSound, 9, + + 14010 = AmbientSound, 10, + + 14011 = AmbientSound, 11, + + 14012 = AmbientSound, 12, + + 14013 = AmbientSound, 13, + + 14014 = AmbientSound, 14, + + 14015 = AmbientSound, 15, + + 14016 = AmbientSound, 16, + + 14017 = AmbientSound, 17, + + 14018 = AmbientSound, 18, + + 14019 = AmbientSound, 19, + + 14020 = AmbientSound, 20, + + 14021 = AmbientSound, 21, + + 14022 = AmbientSound, 22, + + 14023 = AmbientSound, 23, + + 14024 = AmbientSound, 24, + + 14025 = AmbientSound, 25, + + 14026 = AmbientSound, 26, + + 14027 = AmbientSound, 27, + + 14028 = AmbientSound, 28, + + 14029 = AmbientSound, 29, + + 14030 = AmbientSound, 30, + + 14031 = AmbientSound, 31, + + 14032 = AmbientSound, 32, + + 14033 = AmbientSound, 33, + + 14034 = AmbientSound, 34, + + 14035 = AmbientSound, 35, + + 14036 = AmbientSound, 36, + + 14037 = AmbientSound, 37, + + 14038 = AmbientSound, 38, + + 14039 = AmbientSound, 39, + + 14040 = AmbientSound, 40, + + 14041 = AmbientSound, 41, + + 14042 = AmbientSound, 42, + + 14043 = AmbientSound, 43, + + 14044 = AmbientSound, 44, + + 14045 = AmbientSound, 45, + + 14046 = AmbientSound, 46, + + 14047 = AmbientSound, 47, + + 14048 = AmbientSound, 48, + + 14049 = AmbientSound, 49, + + 14050 = AmbientSound, 50, + + 14051 = AmbientSound, 51, + + 14052 = AmbientSound, 52, + + 14053 = AmbientSound, 53, + + 14054 = AmbientSound, 54, + + 14055 = AmbientSound, 55, + + 14056 = AmbientSound, 56, + + 14057 = AmbientSound, 57, + + 14058 = AmbientSound, 58, + + 14059 = AmbientSound, 59, + + 14060 = AmbientSound, 60, + + 14061 = AmbientSound, 61, + + 14062 = AmbientSound, 62, + + 14063 = AmbientSound, 63, + + 14064 = AmbientSound, 64, + 14065 = AmbientSound 14066 = SoundSequence 14067 = AmbientSoundNoGravity