DakkJaniels / DevilutionX-MiddleEarthMod

Recreation of V&K's Middle Earth Mod for Diablo 1.07, utilizing Devilution X
The Unlicense
8 stars 3 forks source link

Attempting to Merge ME Mod with DevX 1.4 master (#5) #6

Closed DakkJaniels closed 2 years ago

DakkJaniels commented 2 years ago

Was this meant to reset the output? It should never be changed unless the user confirms input. In practice this was calling memcpy with the same src and dest pointers, which is undefined behaviour.

Now that platforms with C APIs have been updated to take string_views in the C++ wrappers

  1. Use ${{ }} consistently. It is technically not required in if conditions but GitHub CI docs use it and it avoid certain pitfalls, such as when the value starts with ! (making it a YAML type declaration).
  2. Fixes one of the ifs.

Reduces the size of a CelSprite by taking advantage of the fact that 16-bit pointers are aligned, so the last bit is always 0.

Conversion is already provided by the CelSprite(const OwnedCelSprite &) constructor.

Saves about 200 KiB RAM in dungeon at a large performance cost. Almost never a good idea, except for severely RAM-constrained devices (e.g. RG99).

General Punctuation Superscripts and Subscripts Currency Symbols Combining Diacritical Marks for Symbols

Hardware cursor should get initialized even for non mouse control types (e.g. ControlTypes::None), because by the time the control type gets initialized or changes the cursor is already set up and won't change.

Fixes #4233

Fixes #4206

We do not seem to render from multiple threads, so these calls are unnecessary.

swap mlSFX and miSFX to match structure definition.

This matches the behaviour of other targeted spells, however the mana is wasted because it is spent when readying the spell.

Fixes funky hardware cursor colors during fade transitions.

Refs #4206

Most of this was centred around stash pages being saved/loaded as unsigned values but stored as signed values. Consistently used unsigned since it matches the intended usage.

This triggers a bunch of warnings in MSVC because the conversion is potentially truncating, despite never being an issue in practice...

Mostly settings translation + a few changes

This constant is defined as 1 when building for iphone, 0 for MacOS, and undefined on other platforms. To get the expected behaviour we need to check it's defined and non-zero.

Update to latest master, for real this time...

Fixes #4319

Introduces a ControlDevice global which is distinct from ControlMode in that it is set to Gamepad even when simulating a mouse.

This allows us to avoid a number of edge cases related to mode changes.

Fixes #4242

Fixes #3523

Viewing a stash page results in an entry being created in the stashGrids map. If the player flicks through the entire stash without actually storing an item they end up with ~20kb of unnecessary data in the stash file when they next save.

Thank you.

Co-authored-by: Gleb Mazovetskiy glex.spb@gmail.com

14092d317b84a3037e71b870d2117dda126811a3

From https://github.com/leetal/ios-cmake/issues/139

Also fixes build with HAS_KBCTRL=1

Fixes #1977

Add text to specify to users that they must log in to be able to download the test builds.

Fixes a typo in "Journal: The tirade"

A tab instead of space meant that this was rendered as "arefull"

Simplifies the Amiga build

  1. Do not interrupt mouse mode on virtual clicks.
  2. Handle virtual clicks directly instead of sending an SDL event.
  3. Fix D-Pad mouse emulation state handling.
  4. Hides the modifier hints during D-Pad mouse emulation.

It spams the debug log but is not really an error from what I understand

This was necessary in the past due to stippled transparency but we use blended transparency now.

Fixes #4355

Includes updates of drwav and drmp3 to the latest versions

SDL2 2.0.22 has just been released

Similar to https://github.com/diasurgical/devilutionX/pull/4374

Fixes #4387

Fixes #4393

Fixes #4392

We were previously setting was_sound_init to true unconditionally after calling snd_init.

However, snd_init can fail. Use gbSndInited instead.

This OOB happened when rendering a sprite so that it is exactly off-screen (touching the border but not visible) on top/bottom while also being only partly off-screen on the left or right.

Lets give it a better one later

Follow-up to https://github.com/diasurgical/devilutionX/pull/4414, which removed the state field.

Fixes #4420

Fixes #4397

Set the palette at load time.

Since we only support hardware cursors in SDL2, we can take advantage of its reference-counted palettes.

Unifies audio handling between sound effects and music.

Index frames starting at 0 instead of 1.

This matches the behaviour of inventory cell hit logic. Previously it was possible to click exactly on a border and be unable to put an item in the stash.

fixes #4434

Also use mod for testing if item dimensions are even. Lets assume the release build can optimise this into a bitmask, probably wont need to do this anyway after a refactor.

Follow-up to https://github.com/diasurgical/devilutionX/pull/4221

Also introduced a few helper types and values to hopefully help document behaviour

correct spelling in comment

Co-authored-by: qndel stefan551@o2.pl

This version includes an option to use the SDL resampler.

I don't think this ever comes up because no spells have an sManaCost of 255, however _pMaxManaBase is stored as fixed point, so it should be shifted before use.

But to be honest, I'm not even sure what it is trying to do here. Was sManaCost == 255 supposed to indicate that it was going to use all the player's mana? Why was it cast to a BYTE before using it? Did they intend to limit the manage usage to 255 and just screwed up? I originally saw this logic in Devilution, and found it because the Middle Earth mod had a slight change here, where it used pMana (maybe because they thought it was intended to be a spell that used all the player's mana?) Also, I saw that in 1.07, Ghidra saw ma as a byte, not an int as written in Devilution - I wonder if that's where the cast came from? In the ME Mod version, it sees ma as an int.

Re-ordered the last couple of if conditions to make it clearer what the impact of the adjustments to mouse position are.

This makes the call sites use the same pattern as every other inventory movement. See the next commit for why :D

Refs #1390

explode() and implode() both have comments saying they expect the buffers to be zero-init, however new[] default initialises arrays which for char[] leaves them in an implementation defined state. On MSVC the memory is unitialised. To be safe use std::make_unique<T[]>(size_t) as this value-initialises each element of the array.

SDL_RWsize is documented as returning any negative value on error (even though in practice errors are always indicated by a value of -1) so allow for that instead of only checking for unknown size.

There were also a few unnecessary arithmetic operations being done to calculate the size to read, straightforward to simplify.

SDL_CreateRGBSurfaceWithFormat expects width and height to be positive values < 2^16. Could get away with using unsigned if the SDL API did but it doesn't so stick with signed types even when it doesn't really fit the use.

bufferPitch is an oddity, ultimately it's only used to determine a pointer offset so making the param ptrdiff_t as it's more appropriate than size_t.

C-Stick mapping is incorrect for the 3ds platform.

Currently left/right is not functional, up/down moves the cursor left/right.

This corrects the behavior.

Congrats on the new release!

Add ItemType::Shield to switch/case for clarity, so it is clear that this is what the default option was to show.

Refs #4469

This adds a bit of audible feedback to help the player know that the action had an impact (along with the cursor changing and the count increasing).

All gold related interactions a player can make with the stash now have audio feedback

This cleans up a bit of code and solves a few edge cases where an item could be lost, the game be unresponsive, or miss fire an event during lag cause of the cursor not reflecting the currently held item.

The case for empty items should never be hit in the current code, but I've got a related PR that'll make use of that so adding it now.

Makes use of that Item::isEmpty check in NewCursor to set the hand cursor when empty handed.

When auto-placing gold in the inventory there's no need to trample HoldItem.

Previously this also relied on NewCursor modifying MyPlayer->HoldItem when setting the cursor to a non-item cursor to avoid item duplication, seems more appropriate to make this explicit in the caller.

Makes clang (and GCC) consider item.Clear() a reinitialisation of a moved variable - see https://clang.llvm.org/extra/clang-tidy/checks/bugprone-use-after-move.html#reinitialization

Co-authored-by: Anders Jenbo anders@jenbo.dk Co-authored-by: ephphatha ephphatha@thelettereph.com Co-authored-by: egonzalez egonzalez@msi.notebook.hiperion.local Co-authored-by: obligaron obligaron@live.com Co-authored-by: staphen staphen@gmail.com Co-authored-by: Gleb Mazovetskiy glex.spb@gmail.com Co-authored-by: Oleksandr Kalko tsunamistate@gmail.com Co-authored-by: NikoVP 60973634+NikoVP@users.noreply.github.com Co-authored-by: Bubio bubio66@gmail.com Co-authored-by: Michael H xGnoSiSx@users.noreply.github.com Co-authored-by: Dominus Iniquitatis iniquitatis@users.noreply.github.com Co-authored-by: qndel stefan551@o2.pl Co-authored-by: Hiperión egonzalez.hiperion@gmail.com Co-authored-by: Axel Ribon axel@pinpinteam.com Co-authored-by: ChaosMarc chaosmarc@gmx.de Co-authored-by: Psojed realpsojed@gmail.com Co-authored-by: Bubio 78299054+bubio@users.noreply.github.com Co-authored-by: gogogogi trebelnik2@gmail.com Co-authored-by: Drakker dpelletier@gmail.com Co-authored-by: Felipe Wannmacher fwannmacher@gmail.com Co-authored-by: Yuri Pourre yuripourre@gmail.com Co-authored-by: SergBrNord 71232876+SergBrNord@users.noreply.github.com Co-authored-by: M0Rf30 morf3089@gmail.com Co-authored-by: KPhoenix 68359262+kphoenix137@users.noreply.github.com Co-authored-by: Tytannial Tytannial@users.noreply.github.com Co-authored-by: SimonCeder simon.ceder@gmail.com Co-authored-by: nsm53project 85224046+nsm53project@users.noreply.github.com Co-authored-by: Vladimir Olteanu vladimir.olteanu@cs.pub.ro Co-authored-by: MrHuu MrHuu@users.noreply.github.com Co-authored-by: Mathew kruhol@gmail.com Co-authored-by: Brandon Cullen brandoncullen2201@gmail.com Co-authored-by: John Törnblom john.tornblom@gmail.com