Commit Graph
51 Commits
Author SHA1 Message Date
Thierry Crozat d953e95a68 AGS: Add sanity check in putpixel to avoid overflow
The alfont code seems to have some inconsistency between the real from
height and the maximum height used when drawing in alfont_textout_ex.
This can cause trying to write out of bounds, and then random crashes.

This fixes bug #13601
2022-06-20 23:52:25 +01:00
Eugene Sandulenko abea37c9bb ALL: Update ScummVM project license to GPLv3+ 2021-12-26 18:48:43 +01:00
Paul Gilbert aec0a06700 AGS: Enable setting paletted graphics mode 2021-06-20 19:15:56 -07:00
Thierry Crozat 0cf45fbc39 AGS: Fix some regressions with blender modes 2021-06-14 20:21:10 +01:00
Paul Gilbert 701396361c AGS: Import of fresh codebase 2021-06-13 21:08:44 -07:00
Thierry Crozat c54bd2faf2 AGS: Implement pivot_sprite and rotate_sprite 2021-05-31 23:44:39 +01:00
Thierry Crozat 0a4460ba34 AGS: Optimize non-stretched draw 2021-03-25 01:10:45 +00:00
Thierry Crozat 180d364ebe AGS: Fix allegro mask color
In allegro the mask color has alpha set to 0. We were setting it
to 0xff and that caused comparaison of colors with mask to fail
in some places in the engine, for example causing the check of
whether a given position is on a sprite to fail (it was returning
true for any position inside the sprite bitmap, even if on a
transparent pixel).

See my_getpixel(Bitmap *, int x, int y) in character.cpp that
strips the alpha from the color just for that purpose (it is
called from is_pos_in_sprite()) where the pixel is compared to
the mask color..
2021-03-15 21:03:12 +00:00
Thierry Crozat d0ce475e06 AGS: Fix antialiased stretch of sprite
This fixes missing actors in some games, such as Blackwell
Deception (on the boat deck where the actors are scaled to
90% or their original size).

The issue was that Allegro has defines to indicate which color
depth are available, and we removed those. But they are used
in the antialiasing code.
2021-03-10 00:28:29 +00:00
Thierry Crozat 93859f25c6 AGS: Ensure clip rect is within the bitmap
This is consistent with what Allegro does.
2021-03-07 19:30:34 +00:00
Paul Gilbert 3a3f31cd56 AGS: Move Allegro color.cpp globals to Globals 2021-03-07 08:52:15 -08:00
Thierry Crozat f09cca7ac9 AGS: Fix issues with BITMAP clipping rect
Allegro API to set or get the clipping rect include both the
top-left and bottom-right corners. But internally in the
BITMAP the bottom-right corner is excluded, and is thus one
more that the one in the API functions.

Also ensure that the clipping rect is used by setting the clip
flag to true. The Allegro documentation indicates that it can
be set to false to get better performances, but will result in
your program dying a horrible death if you try to draw beyond
the edges of the bitmap. And by default clip is on. AGS never
turns it off, so just ensure it is set to on in the constructor.
2021-03-07 01:08:21 +00:00
Thierry Crozat d6db4c27ad AGS: Fix off by one error in clipping rect and drawing rect
In allegro both the top-left and bottom-right corners are
included in the rect, but in Common::Rect the bottom-righ
corner is excluded. So we need to add one when creating the
Common::Rect.
2021-03-06 00:51:58 +00:00
Paul Gilbert b8a6375067 AGS: Implement draw clipping rect handling 2021-03-01 18:36:38 -08:00
Paul Gilbert 00472f09ad AGS: Remove deprecated assert 2021-03-01 18:36:38 -08:00
Thierry Crozat d2bb119824 AGS: Fix drawing tinted sprites 2021-02-23 17:13:26 +00:00
Paul Gilbert 5bc8d36cb2 AGS: Draw method specific for AGS 2021-02-22 19:19:34 -08:00
Thierry Crozat 9e748e82bb AGS: Fix draw_lit_sprite implementation
The allegro documentation indicates it is used to tint a sprite by
blending pixels from the given sprite with the color passed to the
last call to set_trans_blender.

Only the true color version is implemented. For 256 color sprites
it should use the global color_map table created using either
create_trans_table or create_light_table.
2021-02-21 00:05:27 +00:00
Paul Gilbert 675d851476 AGS: Shift BITMAP & Surface into it's own file 2021-02-20 14:37:29 -08:00
Paul Gilbert 3ad8c5cb03 AGS: Drawing fixes for blitting and sprites 2021-02-20 14:37:29 -08:00
Paul Gilbert d0b644f19f AGS: Implement vertically flipped sprite drawing 2021-02-16 18:56:36 -08:00
Paul Gilbert 5daedb9a8f AGS: Fix draw_trans_sprite to use transBlitFrom 2021-02-15 10:39:49 -08:00
Paul Gilbert 68adead085 AGS: Implement fade in/out alpha blending 2021-02-14 18:08:23 -08:00
Paul Gilbert a28dbd147f AGS: Fix 32-bit pixel format to match AGS 2021-02-13 11:38:55 -08:00
SupSuper 553f9b56ae AGS: Fix assert when drawing rectangles with swapped coordinates
Allegro automatically swaps the coordinates when drawing,
so ScummVM needs to do the same.
2021-02-12 00:33:10 +00:00
Thierry Crozat f1d753c1c4 AGS: Fix out of bound memory access with getpixel
The allegro implementation returns -1 when called with a pixel
that lies outside the bitmap. Doing the same in the implementation
in ScummVM fixes a crash in some games.
2021-02-11 23:40:01 +00:00
Paul Gilbert 6a5bb2c48f AGS: Fix starting up early 2.5 paletted games 2021-02-06 16:37:31 -08:00
Paul Gilbert 8e192f5ce9 AGS: Fix rendering of player in KQ2+ 2021-02-06 16:37:31 -08:00
Paul Gilbert 3813c6db5e AGS: Cleanup of transparency color in Allegro stubs 2021-02-06 16:37:31 -08:00
Paul Gilbert 440a14e565 AGS: Tentative draw_lit_sprite implementation 2021-02-06 16:37:31 -08:00
Paul Gilbert 03c7491e18 AGS: Fix compilation of VS 64-bit builds 2021-02-06 16:37:31 -08:00
Paul Gilbert 911c54c7e2 AGS: Match the 32-bit PixelFormat to decoded bitmaps
The 32-bit bitmap resources encoded by AGS had ARGB rather
than RGBA (or is it the other way around?). Anyway, this
was what was causing the KQ2 title screen to be all red.
2021-02-06 16:37:31 -08:00
Paul Gilbert 9d2c67f738 AGS: Fix black box & gfx issues in ATOTK 2021-02-06 16:37:31 -08:00
Paul Gilbert 35497da624 AGS: Fix unreachable code warnings 2021-02-06 16:37:31 -08:00
Paul Gilbert e0d73e9dc8 AGS: Implement horizontally flipped sprite draw 2021-02-06 16:37:31 -08:00
Paul Gilbert 5aa27892c6 AGS: Implementing drawing code used by pathfinder 2021-02-06 16:37:31 -08:00
Paul Gilbert 527d73e0e6 AGS: Handle sprite transparency for cursors 2021-02-06 16:37:31 -08:00
Paul Gilbert 4e675ea29e AGS: Implement clipping methods, fixing rendering of text dialogs 2021-02-06 16:37:31 -08:00
Paul Gilbert d2abe022bb AGS: Set palette if needed for other blitting methods 2021-02-06 16:37:31 -08:00
Paul Gilbert 5a8c96982a AGS: Set ManagedSurface palette when blitting to screen 2021-02-06 16:37:31 -08:00
Paul Gilbert ab7146ed2e AGS: Fix shutdown crash in set_gfx_mode 2021-02-06 16:37:31 -08:00
Paul Gilbert 2014c3db16 AGS: Another fix for getting bitmap color depths 2021-02-06 16:37:31 -08:00
Paul Gilbert da6096e169 AGS: Implement draw_trans_sprite method 2021-02-06 16:37:31 -08:00
Paul Gilbert 8924e8819a AGS: Adding ScummVM graphics init code 2021-02-06 16:37:31 -08:00
Paul Gilbert cf969752fe AGS: Allow paletted bitmaps in create_bitmap_ex method 2021-02-06 16:37:31 -08:00
Paul Gilbert 9701be90f2 AGS: Implement load_pcx method 2021-02-06 16:37:31 -08:00
Paul Gilbert 00e29a1382 AGS: Fix creating and clearing bitmaps 2021-02-06 16:37:31 -08:00
Paul Gilbert 536bb13032 AGS: Add further missing lib/ code 2021-02-06 16:37:31 -08:00
Paul Gilbert fe46be9223 AGS: Added engine/ac/ folder 2021-02-06 16:37:31 -08:00
Paul Gilbert 65a2cf6687 AGS: Added engine/plugin/ folder 2021-02-06 16:37:31 -08:00