Commit Graph
384 Commits
Author SHA1 Message Date
Anders Jenbo 7102724fda Clang-tidy: readability-named-parameter 2021-06-27 00:56:08 +02:00
Anders Jenbo de4ced7e4f Clang-tidy: readability-qualified-auto 2021-06-27 00:56:08 +02:00
Anders Jenbo 2bdb6caa07 Cleanup majority of remaning implicit bool conversions (#2234) 2021-06-26 21:05:45 +02:00
Anders Jenbo d8fa29c972 Clean up more implicit bool conversion 2021-06-26 10:07:02 -07:00
obligaron 0bf3943254 Use GetOffsetForWalking in DrawMonsterHelper 2021-06-26 06:10:33 -07:00
obligaron a4cacfbcbe Enable ADL for Monsters 2021-06-25 11:52:12 -07:00
obligaron b0ed920a25 Introduce AnimationInfo to MonsterStruct 2021-06-25 11:52:12 -07:00
Andrew James 60a47caf1b Refactor Draw* functions to use Rectangle and Point types
Added overload for DrawString taking a Point to avoid creating a rect for callers which only use position. This also documents the way DrawString operates when passed a clipping rectangle with a dimension of 0.
As part of this overload removed the logic for 0 width regions from DrawString. This does change the behaviour of the Rectangle version if called with a rect with width 0, all callers using that behaviour have been updated in this commit.

Using Rectangle/Size allowed simplifying the logic for certain calls where they could use DrawText alignment flags, previously this was manually aligning by calculating dimensions and offsetting the position. This also fixes #2169

Also includes a few instances where a temporary buffer was used to set the text to be drawn with unbounded sprintf calls, replaced those with snprintf as is recommended in modern C applications. Moving to C++ strings would be good in a future refactor.
2021-06-24 01:36:06 +02:00
Anders Jenbo ee7b32d8f6 Player by reference part 3 2021-06-24 00:53:09 +02:00
Gleb Mazovetskiy 4ea7ba0f5f 🚚 engine.h: Extract LoadLE32 and LoadBE32 2021-06-21 02:34:28 -07:00
Gleb Mazovetskiy 43bc08bd63 Hardware Cursor: Fall back to software on failure 2021-06-19 12:36:39 +01:00
Gleb MazovetskiyandVictor Luchits f9d20b44d6 🎉 Hardware cursor (SDL2-only)
Disabled by default because of these known issues:

1. When clicking on inventory item, it briefly appears a bit shifted (in the wrong coordinates).

   This issue can happen with software cursor as well, but is a lot more
   obvious with the hardware cursor.

2. Cursor is scaled with nearest-neighbour scaling, which may look a bit different from
   how the rest of the graphics are scaled.

See also previous attempt: https://github.com/diasurgical/devilutionX/pull/955 by @viciious

Co-authored-by: Victor Luchits <[email protected]>
2021-06-19 01:03:40 +02:00
obligaron b5ad92eb2c Convert _mAnimData to CelSprite 2021-06-18 21:47:19 +02:00
Gleb Mazovetskiy e9544c2fdc ♻️ Cleanup DrawCursor
1. Only copy the outline if the cursor is an item.
2. Deduplicate clipping math.
2021-06-18 11:54:59 +02:00
Gleb Mazovetskiy e7b105b6ed 🐞 Fix off-by-one in DrawCursor
The correct size is +2px for the outline, because the outline is on both
sides.

Fixes #2179
2021-06-16 03:53:00 +02:00
obligaron 6d5291b17d Enable ADL for Items 2021-06-08 10:12:09 +02:00
obligaron ccc1ccf9c3 Introduce ItemStruct.AnimInfo 2021-06-08 10:12:09 +02:00
qndel 15a4ac8e42 fix magic rock highlight 2021-06-05 14:51:35 +02:00
Kalebe Alves 118efe8e6d Use Point/SDL_Rect for control functions coordinate system 2021-05-28 19:57:16 +02:00
qndel b1d74d2791 alt highlighting (#2060) 2021-05-25 23:47:29 +02:00
Anders Jenbo 8a7ec56d3a Player by reference part 2
This mostly change player to be by reference instead of by index.
But additionally it does stript checks for gold in the belt, move some
value types to the initialization and short circute a few functiongs.
2021-05-24 21:00:32 +02:00
obligaron 61ba5009ac Convert to CelSprite 2021-05-24 20:12:43 +02:00
Juliano Leal Goncalves d55cd99dd5 🚚 Rename 'direction' enum to 'Direction' 2021-05-24 04:46:08 +02:00
qndel 69b903743a fix typos 2021-05-23 05:52:52 +02:00
Anders Jenbo 9e2206a673 Format code 2021-05-21 14:12:31 +02:00
obligaron 86e1d488e6 Draw Reflect Icon similiar to Manashield 2021-05-21 13:27:57 +02:00
Anders Jenbo 6acb49bea4 Render quest and menu text using common text rendering 2021-05-21 04:23:49 +02:00
obligaron 417a3f124a DrawPlayerHelper: Use correct player offset 2021-05-19 12:17:01 +02:00
obligaron 4d2ac0502a Add new GetOffsetForWalking helper and use it for player drawing and camera 2021-05-16 21:24:36 +02:00
Anders Jenbo 34744c068f ♻️Consitantly use %i and not %d 2021-05-15 14:17:52 +02:00
qndel 89c40eaa7b inventory items rendering cleanup (#1938) 2021-05-14 12:46:16 +02:00
Gleb Mazovetskiy cb9da2cadc 🎉 SDL1: An option to render directly to video mem
Now that we no longer have a buffer border, we can render directly to
the video memory if the output surface is 8-bit and double buffering is
enabled.

Also adds a flag to force this even when double buffering is disabled,
because some systems emulate 8-bit mode with something else, so the
output is always buffered.

This required a tweak to the cursor to make sure that we clear it after
`SDL_Flip`.
2021-05-13 03:17:45 +02:00
Anders Jenbo 8eb9c930fe 🚨 Fix remaning GCC warnings (#1929) 2021-05-11 09:34:45 +02:00
Gleb Mazovetskiy 1181cc68ac 🎉 Remove buffer padding
The padding is no longer needed
2021-05-11 07:57:08 +02:00
Gleb Mazovetskiy b3c921edac Fix clipping in scrollrt_draw_cursor_item 2021-05-09 05:31:41 +02:00
Anders Jenbo 72598865cc ♻️Replace PrintGameStr with DrawString 2021-05-08 18:48:19 +02:00
Gleb Mazovetskiy f025d5c910 Remove clipping from scrollrt_draw_cursor_item
There was no reason for this clipping from what I can tell

Now that we actually have working clipping, this just looks odd
2021-05-08 18:23:28 +02:00
Gleb Mazovetskiy 9a9941efdd 🚚 Move CL2 rendering to engine/render/cl2_render.cpp 2021-05-07 01:02:03 +02:00
Gleb Mazovetskiy 0edfa3de66 🚚 Move CEL rendering to engine/render/cel_render.cpp 2021-05-07 00:16:40 +02:00
Gleb Mazovetskiy 59dd42692f 🚚 Move render.cpp to engine/render/dun_render.cpp 2021-05-06 21:30:06 +02:00
Anders Jenbo f579b2f287 Handle cel/cl2 files as byte arrays 2021-05-06 13:17:54 +02:00
thebigMuh 8e19ef5460 - Fixed outline drawing for item on cursor to match rest of game
- Made GetOutlineColor const
- Made gold outline golden again... because the white outline made me sad
2021-05-04 06:09:05 +02:00
Anders Jenbo bfc510fb23 Clean up automap.cpp 2021-05-03 05:44:40 +02:00
Anders Jenbo 654a2b8834 ♻️Clean up automap code
Use Point for x,y pairs. Make helpers for drawing door and squares
2021-05-02 15:27:38 +02:00
Gleb Mazovetskiy 34b4ed759a 🐞 Clean up and fix inventory sprite handling 2021-05-02 04:01:03 +02:00
Gleb Mazovetskiy 1b8b62a8c2 ♻️ Store CEL width with the sprite itself
Instead of passing the CEL sprite width when drawing, store the CEL
width at load time in the new `CelSprite` struct.

Implemented for most sprites except towners, missiles, or monsters.
2021-05-01 20:51:55 +02:00
Anders Jenbo f884ba5340 🔥 Remove more miniwin dependencies 2021-04-29 23:04:56 +02:00
obligaron 3b87433fc2 Move GetFrameToUseForPlayerRendering to AnimationInfo 2021-04-29 04:33:51 +02:00
obligaron 1de46a8495 Rename member variables 2021-04-29 04:33:51 +02:00
obligaron 0b5183f63e Introduce AnimationInfo
Update AnimationInfo.DelayLen comment
2021-04-29 04:33:51 +02:00