Commit Graph

6689 Commits

Author SHA1 Message Date
Vincent Pelletier
d2defcd1cc TINYGL: Actually check if alpha test and blending are enabled. 2016-07-21 16:42:10 +02:00
Vincent Pelletier
a1418732ec TINYGL: Typo in disabled code. 2016-07-21 16:41:24 +02:00
Vincent Pelletier
8ec310468d TINYGL: Replace multiplications by iterative additions.
As an iteration is done already anyway.
2016-07-21 16:41:18 +02:00
Vincent Pelletier
a831238a96 TINYGL: Drop some unused locals. 2016-07-21 16:40:36 +02:00
Vincent Pelletier
4ff03d060e TINYGL: Call tglColor4f from tglColor4fv. 2016-07-21 16:40:07 +02:00
Vincent Pelletier
d437892538 TINYGL: Get rid of PSZB as it duplicates pixelbytes. 2016-07-21 16:39:40 +02:00
Paweł Kołodziejski
31517c227c Merge pull request #1271 from vpelletier/grim_showfps
GRIM, EMI: Expose show_fps in engine options tab.
2016-07-21 12:55:13 +02:00
Paweł Kołodziejski
d1be78ca49 Merge pull request #1269 from vpelletier/tinygl_optimise_light
Tinygl: optimise gl_shade_vertex
2016-07-20 14:39:05 +02:00
Paweł Kołodziejski
9acb1b9039 Merge pull request #1275 from vpelletier/valgrind
TINYGL, GRIM: Fix various errors (mostly memory leaks) found by valgrind
2016-07-20 14:09:52 +02:00
Paweł Kołodziejski
fa4fccda4e Merge pull request #1266 from vpelletier/tinygl_zline
TINYGL: Simplify zline.cpp .
2016-07-20 14:03:58 +02:00
Vincent Pelletier
72217813c6 GRIM: Do not crash on extreme FPS values.
Easily triggered with disabled FPS limit and staying for a few seconds in
the F1 menu.
2016-07-18 17:33:53 +02:00
Vincent Pelletier
0de75f613a GRIM, EMI: Disable FPS limit when engine_speed is 0.
Also, only set engine_speed to config file when forcing 60fps.
2016-07-18 16:32:03 +02:00
Vincent Pelletier
16379fcc55 GRIM, EMI: Expose show_fps in engine options tab. 2016-07-18 16:31:57 +02:00
Vincent Pelletier
7d2f4a3185 GRIM, EMI: Avoid repeating GUIO1(GAMEOPTION_LOAD_DATAUSR).
To ease addition of future engine-level, game-independent options.
2016-07-18 16:31:42 +02:00
Vincent Pelletier
638b841c74 TINYGL: Simplify zline.cpp .
drawLine was broken for dx = 0 lines.
Also, the split between fillLineGeneric and drawLine, along with the many
parameters exchanged (with obscure names with subtle differences), made
the code hard to understand.
This implementation should be easier to check.
There was no visible CPU usage change.
Fixes GRIM's ticket printer, which are composed of a lot of vertical
segments.
2016-07-18 15:55:08 +02:00
Paweł Kołodziejski
d467980499 Merge pull request #1262 from vpelletier/tinygl_dirty2d
GRIM: Fix drawLine/Rect/Polygon in TinyGL renderer
2016-07-18 05:17:35 +02:00
Vincent Pelletier
d844acb438 GRIM: Fix some "Mismatched free() / delete / delete []" errors (valgrind) 2016-07-18 04:36:37 +02:00
Vincent Pelletier
f12cb15801 GRIM: release movie frame in GfxTinyGL::~GfxTinyGL. 2016-07-18 04:36:37 +02:00
Vincent Pelletier
21c3d9234f GRIM: Delete emergency font before calling glClose.
So TinyGL knows it can free underlying structures.
2016-07-18 04:36:37 +02:00
Vincent Pelletier
db8cee2a69 TINYGL: Free BlitImage memory on close. 2016-07-18 04:36:37 +02:00
Vincent Pelletier
97dc3881e0 TINYGL: Add free_texture variant taking a GLTexture * argument.
To avoid looking texture up in the hash table when caller has a pointer to
it already. Aka, O(0) is better than O(1).
2016-07-18 04:34:09 +02:00
Bastien Bouclet
5cf904e8bc MYST3: Several fixes for the Amateria pinball puzzle
- The puzzle was running at double speed. Fixes #1277.
- The rotation sound effect was restarted on each frame.
- The puzzle was not showing the reset animation after the ball expiration.
2016-07-17 21:17:16 +02:00
Bastien Bouclet
db73881d4d MYST3: Fix the sound fade out opcode 2016-07-17 21:16:13 +02:00
Bastien Bouclet
18b0e3e38e MYST3: Only play looping sounds if they are not already playing 2016-07-17 21:15:48 +02:00
Bastien Bouclet
e3493f7467 MYST3: Prevent events consumed to enter a save name to be used a second time
Fixes #1274.
2016-07-17 17:30:47 +02:00
Bastien Bouclet
6a24f82812 MYST3: Fix spotitems with multiple images per face
Fixes #1273
2016-07-17 17:30:47 +02:00
Vincent Pelletier
306fdff963 TINYGL: Dispose of textures beyond the first hash table entry. 2016-07-17 15:06:30 +00:00
Vincent Pelletier
95cc5127e0 TINYGL: Consistently consider Texture::handle as unsigned.
Texture handles are unsigned integers everywhere else.
2016-07-17 15:06:30 +00:00
Paweł Kołodziejski
83f4434bff Merge pull request #1272 from vpelletier/tinygl_videoleak
GRIM: Reuse existing blit image.
2016-07-17 09:12:59 +02:00
Vincent Pelletier
c4d884967c GRIM: Reuse existing blit image.
Fixes a memory leak when playing videos: each frame would leak as the
previous one does not get reused or freed.
2016-07-17 06:38:35 +00:00
Vincent Pelletier
ed2fdb3aba TINYGL: Correct dot-product after its sign is known.
Normalising d when light is not in front of surface (nor behind when in
two-sides mode) is not needed as the value will not be used.
The same optimisation is already done when handling specular lights.
Also, remove "if (... > 1E-3)" conditions: as dot-product is not zero,
neither operand is zero, so this test (as a divide-by-zero protection) can
be removed.
2016-07-16 14:38:41 +00:00
Vincent Pelletier
f66026a8aa TINYGL: Only do spotlight & specular computations when actually needed.
Spotlight and specular requires normalized d.
Skip specular if the light source or the material have no specular
component.
2016-07-16 12:17:59 +00:00
Vincent Pelletier
411e16fba5 TINYGL: Fix default diffuse and specular values for lights > 0. 2016-07-16 12:17:59 +00:00
Bastien Bouclet
9f3a5258d5 VIDEO: Fix seeking Bink videos with audio data
Fixes #1038, #1248
2016-07-16 09:58:16 +02:00
Bastien Bouclet
34700ff531 Merge pull request #1268 from vpelletier/tinygl_simplify_updatetmp
TINYGL: Simplify a bit updateTmp .
2016-07-16 07:10:50 +02:00
Vincent Pelletier
342cf9a60d TINYGL: Simplify a bit updateTmp . 2016-07-15 22:20:41 +00:00
Paweł Kołodziejski
a772bd4667 Merge pull request #1239 from raziel-/patch-1
README: Add the easy to miss Local.m4b of EMI
2016-07-15 22:16:56 +02:00
Hubert Maier
51006ef808 Add missing periods 2016-07-15 21:10:17 +03:00
Paweł Kołodziejski
c48ae5a934 Merge pull request #1267 from vpelletier/grim_enable_more_alpha
GRIM: Enable TGL_ALPHA_TEST in GfxTinyGL::drawSprite.
2016-07-15 16:32:29 +02:00
Bastien Bouclet
9261840866 MYST3: Mark subclasses of Drawable as overriding its methods 2016-07-15 14:51:12 +02:00
Bastien Bouclet
00981d9ab0 MYST3: Remove useless drawBlackBorders method 2016-07-15 14:50:59 +02:00
Bastien Bouclet
7174ccc81d MYST3: Remove the Renderer interface 2016-07-15 14:50:41 +02:00
Vincent Pelletier
a0201afc37 GRIM: Enable TGL_ALPHA_TEST in GfxTinyGL::drawSprite. 2016-07-15 12:43:06 +00:00
Bastien Bouclet
c7811b2d25 MYST3: Use ticks to count time instead of frames
Ticks go by at 30 ticks per second, one tick every two frames.
This halves the speed of all game controlled animations.
2016-07-15 13:04:41 +02:00
Paweł Kołodziejski
fef52b35c0 Merge pull request #1265 from vpelletier/tinygl_alphatest
TinyGL: Fix TGL_ALPHA_TEST support with clipped triangles
2016-07-15 09:29:32 +02:00
Vincent Pelletier
03da50312b TINYGL: Move the task of writing to z-buffer to FrameBuffer::writePixel.
Because writePixel may decide to not write anything (alpha test), in which
case no z-buffer write should happen.
Factorises code.
Fixes apparent back-face culling in GRIM behind transparent textures, like
the tube (the 3d-shape Manny takes out, not the flat image in foreground)
in set mo.
2016-07-14 21:30:18 +00:00
Vincent Pelletier
9b7548ccf7 GRIM: Enable alpha test in GfxTinyGL::drawModelFace.
Fixes the appearance of textures using alpha (ex: game card).
2016-07-14 15:36:33 +00:00
Vincent Pelletier
a336422811 TINYGL: Fix clipped triangle vertices alpha channel.
In all 4 updateTmp call places, q is not initialised, so there is nothing
of value in the alpha channel (it's 0). So just apply the same rule as for
other color channels.
2016-07-14 15:36:28 +00:00
Bastien Bouclet
08fd76686d Merge pull request #1256 from bgK/sdl-split
SDL: Split the OpenGL code to a separate GraphicsManager
2016-07-14 12:06:30 +02:00
Bastien Bouclet
f8cce66926 SDL: Improve code organisation and documentation
No functional change
2016-07-14 12:04:06 +02:00