Commit Graph

202 Commits (8c7e06293fbe6d0ed1dd7dd0f424b9f1b6f92162)

Author SHA1 Message Date
David Cernat dcd4478028 [Client] Always stop sending weather updates when moving to an interior 6 years ago
David Cernat 892d71ce71 [General] Reimplement weather synchronization to allow soft transitions
Although weather sync was added by Koncord to the rewrite in fd721143e2 in a way that used surprisingly few lines of code, it relied on the server requesting weather states every second from authority players and sending them to non-authority players, while also allowing only very sudden weather transitions across regions, i.e. if there was one player in the Ascadian Isles who had stormy weather, and another player with clear weather in the Bitter Coast Region walked across to the Ascadian Isles, that player was instantly made to have stormy weather with no kind of transition at all.

My approach solves both of those problems. It solves the packet spam by only sending weather updates to the server when weather changes happen or when there are new arrivals to a weather authority's region, and it allows for both sudden weather transitions when players teleport to a region and for soft, gradual transitions when players walk across to a region. It is inspired by my previous actor sync, and uses a WorldRegionAuthority packet to set players as region authorities in a similar way to how ActorAuthority sets players as cell AI authorities. Weather changes are created only by the region authority for a given region, and weather packets are also only sent by that authority.

However, it should be noted that gradual weather transitions are used by default in this implementation. To use sudden weather transitions, the serverside Lua scripts need to forward WorldWeather packets with the forceWeather boolean set to true. That is, however, already handled by our default Lua scripts in situations where it makes sense.
7 years ago
Andrei Kortunov 4ba361fea6 Unhardcode sunset and sunrise settings (bug #1990) 7 years ago
tri4ng1e d4d1703bcf
Some PVS-Studio and cppcheck fixes
cppcheck:
[apps/esmtool/record.cpp:697]: (performance) Prefer prefix ++/-- operators for non-primitive types.
[apps/esmtool/record.cpp:1126]: (performance) Prefer prefix ++/-- operators for non-primitive types.
[apps/esmtool/record.cpp:1138]: (performance) Prefer prefix ++/-- operators for non-primitive types.
[apps/niftest/niftest.cpp:36]: (performance) Function parameter 'filename' should be passed by reference.
[apps/niftest/niftest.cpp:41]: (performance) Function parameter 'filename' should be passed by reference.
[apps/opencs/model/prefs/boolsetting.cpp:25]: (warning) Possible leak in public function. The pointer 'mWidget' is not deallocated before it is allocated.
[apps/opencs/model/prefs/shortcuteventhandler.cpp:52]: (warning) Return value of std::remove() ignored. Elements remain in container.
[apps/openmw/mwstate/quicksavemanager.cpp:5]: (performance) Variable 'mSaveName' is assigned in constructor body. Consider performing initialization in initialization list.

PVS-Studio:
apps/opencs/model/filter/parser.cpp  582  warn  V560 A part of conditional expression is always true: allowPredefined.
apps/opencs/view/world/referencecreator.cpp  67  warn  V547 Expression '!errors.empty()' is always false.
apps/opencs/view/world/referencecreator.cpp  74  warn  V547 Expression '!errors.empty()' is always false.
apps/opencs/view/doc/loader.cpp  170  warn  V560 A part of conditional expression is always true: !completed.
apps/opencs/view/doc/loader.cpp  170  warn  V560 A part of conditional expression is always true: !error.empty().
apps/opencs/model/tools/pathgridcheck.cpp  32  err  V517 The use of 'if (A) {...} else if (A) {...}' pattern was detected. There is a probability of logical error presence. Check lines: 32, 34.
apps/opencs/model/world/refidadapterimp.cpp  1376  err  V547 Expression 'subColIndex < 3' is always true.

apps/openmw/mwgui/widgets.hpp  318  warn  V703 It is odd that the 'mEnableRepeat' field in derived class 'MWScrollBar' overwrites field in base class 'ScrollBar'. Check lines: widgets.hpp:318, MyGUI_ScrollBar.h:179.
apps/openmw/mwgui/widgets.hpp  319  warn  V703 It is odd that the 'mRepeatTriggerTime' field in derived class 'MWScrollBar' overwrites field in base class 'ScrollBar'. Check lines: widgets.hpp:319, MyGUI_ScrollBar.h:180.
apps/openmw/mwgui/widgets.hpp  320  warn  V703 It is odd that the 'mRepeatStepTime' field in derived class 'MWScrollBar' overwrites field in base class 'ScrollBar'. Check lines: widgets.hpp:320, MyGUI_ScrollBar.h:181
apps/openmw/mwmechanics/actors.cpp  1425  warn  V547 Expression '!detected' is always true.
apps/openmw/mwmechanics/character.cpp  2155  err  V547 Expression 'mode == 0' is always true.
apps/openmw/mwmechanics/character.cpp  1192  warn  V592 The expression was enclosed by parentheses twice: ((expression)). One pair of parentheses is unnecessary or misprint is present.
apps/openmw/mwmechanics/character.cpp  521  warn  V560 A part of conditional expression is always true: (idle == mIdleState).
apps/openmw/mwmechanics/pathfinding.cpp  317  err  V547 Expression 'mPath.size() >= 2' is always true.
apps/openmw/mwscript/interpretercontext.cpp  409  warn  V560 A part of conditional expression is always false: rank > 9.
apps/openmw/mwgui/windowbase.cpp  28  warn  V560 A part of conditional expression is always true: !visible.
apps/openmw/mwgui/journalwindow.cpp  561  warn  V547 Expression '!mAllQuests' is always false.
apps/openmw/mwgui/referenceinterface.cpp  18  warn  V571 Recurring check. The '!mPtr.isEmpty()' condition was already verified in line 16.
apps/openmw/mwworld/scene.cpp  463  warn  V547 Expression 'adjustPlayerPos' is always true.
apps/openmw/mwworld/worldimp.cpp  409  err  V766 An item with the same key '"sCompanionShare"' has already been added.
apps/openmw/mwworld/cellstore.cpp  691  warn  V519 The 'state.mWaterLevel' variable is assigned values twice successively. Perhaps this is a mistake. Check lines: 689, 691.
apps/openmw/mwworld/weather.cpp  1125  warn  V519 The 'mResult.mParticleEffect' variable is assigned values twice successively. Perhaps this is a mistake. Check lines: 1123, 1125.
apps/openmw/mwworld/weather.cpp  1137  warn  V519 The 'mResult.mParticleEffect' variable is assigned values twice successively. Perhaps this is a mistake. Check lines: 1135, 1137.

apps/wizard/unshield/unshieldworker.cpp  475  warn  V728 An excessive check can be simplified. The '(A && B) || (!A && !B)' expression is equivalent to the 'bool(A) == bool(B)' expression.
apps/wizard/installationpage.cpp  163  warn  V735 Possibly an incorrect HTML. The "</p" closing tag was encountered, while the "</span" tag was expected.

components/fontloader/fontloader.cpp  427  err  V547 Expression 'i == 1' is always true.
components/nifosg/nifloader.cpp  282  warn  V519 The 'created' variable is assigned values twice successively. Perhaps this is a mistake. Check lines: 278, 282.
components/esm/loadregn.cpp  119  err  V586 The 'clear' function is called twice for deallocation of the same resource. Check lines: 112, 119.
components/esm/cellref.cpp  178  warn  V581 The conditional expressions of the 'if' statements situated alongside each other are identical. Check lines: 175, 178.
components/esmterrain/storage.cpp  235  warn  V560 A part of conditional expression is always true: colStart == 0.
components/esmterrain/storage.cpp  237  warn  V560 A part of conditional expression is always true: rowStart == 0.
7 years ago
scrawl 0982d2175a
Merge pull request #1473 7 years ago
Andrei Kortunov fed3e56fc1 Weather manager: get rid of World dependency 7 years ago
Andrei Kortunov a0a30cdbf5 AI: hide torches during bad weather (bug #4334) 7 years ago
Chris Robinson 4caa7c9674 Workaround older MSVC quirk 7 years ago
Chris Robinson 154cc8c659 Use alternate fog parameters when distant land is enabled
This allows the distant land to actually be seen when the user enables it. The
values used are replicated from MGE XE's default settings and should probably
be exposed somewhere.
7 years ago
Chris Robinson 780e82480d Make the PlayMode and PlayType enums scoped
Also shorten them by putting them in the MWSound namespace
7 years ago
Chris Robinson 1fe60dd8e2 Replace some shared_ptrs with pointers to deque entries 7 years ago
scrawl 342c25dffa Fix weather sounds playing at full volume before fading in 8 years ago
scrawl dc1f788cff Use osg::PI over M_PI 8 years ago
Leon Krieg c7b4b2cdd7 Fixed multiple spelling mistakes 8 years ago
MiroslavR 7b59eda13a Import base weather states before loading region modifiers (Fixes #3594) 8 years ago
Bret Curtis 0547d4b937 clang says that these must be in the MWWorld namespace 9 years ago
scrawl b0180cb6b4 Fix current region check (Bug #3391) 9 years ago
scrawl 59cfcb38e2 Scale the sunlight specular color by weather's GlareView value (Fixes #3375) 9 years ago
scrawl 41c571d4f4 Merge branch 'master' of https://github.com/OpenMW/openmw into lighting
Conflicts:
	apps/opencs/view/render/instancemode.cpp
9 years ago
scrawl 0b84b3c2cf Don't crash when region weather chances don't add to 100
The invalid weather ID was resulting in out-of-bounds vector access later in the code.
9 years ago
scrawl 6546c05428 Move Fallback map to components/ 9 years ago
scrawl 7a2ca5580a Accept a ConstPtr in RippleSimulation 9 years ago
Chris Robinson 816015d6e6 Avoid inheriting from Sound for sound types 9 years ago
scrawl c9bfe01120 Fix applying of weather changes after serving a jail sentence 9 years ago
scrawl d97dda05c9 Don't attempt to play unset weather sounds 9 years ago
Chris Robinson aac903484c Remove a really unnecessary method 9 years ago
scrawl 5f143dee2d Fix lighting incontinuity at nightfall and sunrise 9 years ago
scrawl 71d9e7dc52 Read Ambient Loop Sound ID and Rain Loop Sound ID from the INI file 9 years ago
scrawl 802620a86b Use TimeOfDayInterpolator for Land Fog Depth
Fixes the sudden fog jump at nightfall.
9 years ago
scrawl 45bf3e6788 Create TimeOfDayInterpolator class to refactor time handling in WeatherManager 9 years ago
scrawl 8da4530957 Use INI-imported underwater fog settings (Fixes #2907, Fixes #1511) 9 years ago
Alexander "Ace" Olofsson 7d4125d97f Fixes for building with unity build 9 years ago
scrawl 385f4f729c Implement SunDiscSunsetColor, fade the sun during sunrise & sunset 9 years ago
scrawl a2a4532e71 Add the full-screen sun glare effect 9 years ago
scrawl 8de3ce90a7 Add comments for weather IDs 9 years ago
slothlife 29d74f0249 Improve thunderstorm support.
Reversed settings for thunderstorms. Added thunder support to all
weather types. Implemented a simple lightning flash effect similar to
MW.
9 years ago
slothlife 2b48a20b76 Fix weather transition bugs 9 years ago
slothlife d9a7986b3a Remove redundant fast forward check 9 years ago
slothlife 4fd00a75d5 Merge advanceTime and advanceTimeByFrame 9 years ago
slothlife cd8ec5c11e Improve checking for older weather records 9 years ago
slothlife 7817c52cbb Discard old save game weather records 9 years ago
slothlife c907ed517d Remove C++11 explicit on conversion operator 9 years ago
slothlife 54fa5273dc Refactor weather transitions to act more like MW
Fixed several issues:
* Waiting/jail time/training all now properly skip remaining transitions
* ChangeWeather no longer permanently sets the region's weather
* ChangeWeather being called during a transition now correctly queues up
another transition
* Corrected transition delta and factor calculations
* ModRegion settings are now saved
9 years ago
dteviot 77a1d947cc extracted MWMechanics::getPlayer() 10 years ago
slothlife 3d419a612a Corrected some weather transition calculations
Reversed some formulas for Transition Delta and Clouds Maximum Percent
and implemented them. Refactored Weather some to encapsulate those
formulas (to more closely match MoonModel). Did some small cleanup of
WeatherManager.
10 years ago
scrawl 56b7196bea Remove incorrect implementation of "Clouds Maximum Percent" weather setting 10 years ago
slothlife 3235cecddf Use Glare View for visibility of celestial bodies
Fixed memory leak from Sun and Moon objects by pulling Updaters back out
into separate objects. Removed code related to
mCelestialBodyTransparency.
10 years ago
slothlife ea2f88a355 Fix several sky rendering bugs, maybe also #639
Added code to hide the moons, sun, and stars for certain weather
effects. Lightly refactored CelestialBody and derived classes. Fixed
moons switching phase at 24:00.
10 years ago
slothlife 67a63cc662 Add some const correctness to MoonModel 10 years ago
slothlife 24ba54f4fe Implement accurate moon settings (fixes #672) 10 years ago