Weather-related fixes (incl. bug #4783) #2562
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Simplify some calculations
Some calculations added by akortunov to conform to the vanilla research were extraneous.
In storm direction calculations, storm direction is a 1-unit length vector, so multiplied by wind speed its length would just be wind speed. I removed that part from wind speed calculations.
In rain angle calculation, both atan2 arguments are positive (mWindSpeed is non-negative), so it is possible to use atan and a single argument. This also allows to avoid a division by zero if the rain weather Morrowind.ini wind speed is somehow 0.
Fix Blizzard weather direction (bug 4783)
Blizzard is no longer considered a glorified ash storm and moves from south to north instead of Red Mountain to player. Blizzard model is now rotated by 90 degrees clockwise like in Morrowind to look correct. The clouds rotation still uses the normal rotation quaternion to look as intended. Practical storm direction for hand shielding purposes is still correct. I also moved the whole storm direction calculations into weather update because it actually only calculated ash storm direction and not storm direction.
Fix clouds direction
Now they should consistently move from south to north or follow the storm particle direction. Their direction could be reverse in some situations.
I decided to use model checks instead of weather ID checks to avoid confusion between different storm weathers during transitions and to make it easier to dehardcode clearly Morrowind-specific ash/blight weathers in the future.