Commit graph

109 commits

Author SHA1 Message Date
Thierry Crozat
55fc09571f SUPERNOVA: Fix handling of room brightness
There were several issues with the brighness due to the different
implementation between the original and the code in scummvm. The
code has now been modified to be much closer to the original, which
fixed those issues and allowed to remove workarounds that had been
added in various places to deal with those issues (but those
workarounds had their own issues such as fade in happening too
soon before switching to the new room).
2018-01-23 02:15:41 +00:00
Thierry Crozat
177539ba2e SUPERNOVA: Load images on demand 2018-01-23 02:15:41 +00:00
Thierry Crozat
87ab33a8aa SUPERNOVA: Fix several issues with savegames 2018-01-23 02:15:41 +00:00
Strangerke
7d72ae0d0d SUPERNOVA: Implement errorTempSave() 2018-01-23 02:15:40 +00:00
Thierry Crozat
1759d1ffdd SUPERNOVA: Implement autosave used for dream sequence 2018-01-23 02:15:40 +00:00
Thierry Crozat
888930660a SUPERNOVA: Use setCurrentImage instead of passing the image to renderImage
This is more similar to what the original code does and allows to retire
the renderImage variant that takes an image.
2018-01-23 02:15:40 +00:00
Thierry Crozat
624425077b SUPERNOVA: Add warning when trying to use out of bound file number
This is likely happening, and a comment has also been added to
indicate this. The warning was added to help detect those issue
and so that we don't forgert about it.
2018-01-23 02:15:40 +00:00
Thierry Crozat
b11772d904 SUPERNOVA: Fix logic in rendering code
There were several issues fixed by this commit. The main ones are:
 - It was in many places only drawing the first section even for
   images that have multiple sections.
 - It was in some places using the wrong image.

The first issue has been fixed by removing the GameManager::drawImage
function, and moving its logic to SupernovaEngine::renderImage which
was initially only drawing one section, but was nevertheless called
directly from many place.

The second image required more changes to the rendering code to allow
setting the current image file when it is different from the room file.
This fixes some memory issues and random crashes in places where it was
for example trying to use the image -1. This also fixes the rendering
of the flying cutscene.
2018-01-23 02:15:40 +00:00
Thierry Crozat
58cfbb532b SUPERNOVA: Fix room rendering
It could initially access the wrong image to check the number
of section. The code was working fine as long as it had one
section, so there was probably no bad side effect to using
the wrong image (except if it was NULL).
2018-01-23 02:15:40 +00:00
Thierry Crozat
7eb5924f65 SUPERNOVA: Implement text speed dialog
The text speed is also saved in the scummvm.ini file so that
it persists between runs.
2018-01-23 02:15:39 +00:00
Thierry Crozat
529a9c9811 SUPERNOVA: Properly handle timer stop/start 2018-01-23 02:15:39 +00:00
Thierry Crozat
b527b54c6f SUPERNOVA: Disable loading and saving during execution of event callbacks 2018-01-23 02:15:39 +00:00
Thierry Crozat
575aef711b SUPERNOVA: Fix updating the palette brightness when the current image has no palette 2018-01-23 02:15:38 +00:00
Thierry Crozat
af226daf81 SUPERNOVA: Fix incorrect delay for message display
The delay was not set, meaning the messages were immediately
removed in some cutscenes.
2018-01-23 02:15:38 +00:00
Thierry Crozat
8a8a0b9d38 SUPERNOVA: Implement event callback mechanism and Supernova event 2018-01-23 02:15:38 +00:00
Thierry Crozat
54201327f7 SUPERNOVA: Fix image rendering when removing image
This is mostly used in talk animations and result in bad artefacts.
The issue was a regression introduced in commit e0f6da0.
2018-01-23 02:15:38 +00:00
Thierry Crozat
3f2c0673e4 SUPERNOVA: Do not run animations while a text box is displayed
That is also what the original is doing, and this avoid having
graphical glitches.
2018-01-23 02:15:38 +00:00
Thierry Crozat
8f7dcbe4ac SUPERNOVA: Fix crash when displaying strings larger than the screen 2018-01-23 02:15:37 +00:00
Thierry Crozat
841e7182f2 SUPERNOVA: Reduce memory usage to store sections and simplify code
Each section was store dusing the full image size. Now it only uses the
section size, which should reduce considerably the amout of memory used
for each image.

Also when a section has one or more next section, they were all drawn on
the surface for this section, but then they were drawn again on their own
surface. And while this should not cause any issue, this was really
unnecessary (and prevented optimizing the surface size for each section).
So now this is no longer the case and the surface for a section only
contains this section.
2018-01-23 02:15:37 +00:00
Thierry Crozat
73278c3f9f SUPERNOVA: Replace a class variable used in a single function by a local variable 2018-01-23 02:15:37 +00:00
Thierry Crozat
7bf803f6e6 SUPERNOVA: Cleanup dialog code
The main change consists in using a separate byte array for the sentence
removal flags, move some functions from the GameManager to the Room class,
and add a few additional functions to manipulate this new array. This
allows to clarify some code related to dialogs.

This change also allows to switch the _shown array back to a bool array.
2018-01-23 02:15:37 +00:00
Thierry Crozat
15b4e7a298 SUPERNOVA: Fix delay when loading a savedgame while a message is displayed
This required the user to click a mouse button to close the message and
get to the mew state. Now the message is automatically closed before
loading the new state.
2018-01-23 02:15:36 +00:00
Thierry Crozat
52952c48a7 SUPERNOVA: Fix displaying image missing last row and last column
This also fixes a crash for single row image sections
2018-01-23 02:15:35 +00:00
Strangerke
f0d139d519 SUPERNOVA: Fix some warnings 2018-01-23 02:15:34 +00:00
Thierry Crozat
69d7b91965 SUPERNOVA: Improve interactivity of title screen and intro cutscene
We can now press the mouse button to leave the title screen instead
of having to press a key. Since the mouse cursor was visible, not
being able to press the mouse button was strange. Especially as it
was possible to use the mouse button earlier in the title screen.

Also we can now use the mouse button or any key other than escape
during the cutscene to move to the next sentence. And the code is
more reactive to pressing the Escape key (we don't need to wait
for the current annimation to finish) to exit the cutscene.
2018-01-23 02:15:33 +00:00
Thierry Crozat
7722fe99cd SUPERNOVA: Move object name and description strings to engine data file 2018-01-23 02:15:33 +00:00
Thierry Crozat
184b3a1662 SUPERNOVA: Load strings from the supernova.dat file 2018-01-23 02:15:33 +00:00
Thierry Crozat
65d30cf720 SUPERNOVA: Plug memory leak in MOD music streams 2018-01-23 02:15:32 +00:00
Thierry Crozat
d1bdfd2bde SUPERNOVA: Clean indentations 2018-01-23 02:15:32 +00:00
D G Turner
ea955675db SUPERNOVA: Fix GCC Warning for Malformed Narrowing Conversions in C++11. 2018-01-23 02:15:32 +00:00
Thierry Crozat
86795f0fa2 SUPERNOVA: Fix clicks at start and end of audio samples
The sound samples start with a 6 bytes header (including the size of
the sample coded on a little endian 16 bits uint on bytes 2 and 3)
and end with 4 bytes set to null. Those were passed to the raw stream,
which resulted in the audible clicks.

Note that we could use the information from the header to load the
sound samples instead of keeping around an array of offset and size.
2018-01-23 02:15:32 +00:00
Thierry Crozat
696fcb6bb9 SUPERNOVA: Add saving/loading of playtime 2018-01-23 02:15:32 +00:00
Thierry Crozat
1cdede12ac SUPERNOVA: Properly handle loading saved game from launcher 2018-01-23 02:15:32 +00:00
Thierry Crozat
ed7fa6f7d7 SUPERNOVA: Improve save state handling
The saved game files now start with a header and version which allows
to do some sanity check and will allow to change the format in the
future if needed.

Also the MetaEngine can now be queried for the meta infos of a save
state.
2018-01-23 02:15:31 +00:00
Joseph-Eugene Winzer
02290c32b6 SUPERNOVA: Allows saving by default
When saving is not apropriate, for example during cutscenes, explicitly
disable it.
2018-01-23 02:15:30 +00:00
Joseph-Eugene Winzer
749fa6336e SUPERNOVA: Fixes save/load dialog 2018-01-23 02:14:56 +00:00
Joseph-Eugene Winzer
a334a4730d SUPERNOVA: Fixes returned constant on load fail 2018-01-23 02:01:00 +00:00
Joseph-Eugene Winzer
ea60d1513e SUPERNOVA: Raises save game limit to 99 2018-01-23 02:01:00 +00:00
Joseph-Eugene Winzer
6e33819217 SUPERNOVA: Changes increment size for fade in/out 2018-01-23 02:01:00 +00:00
Joseph-Eugene Winzer
b3e23fef13 SUPERNOVA: Fixes mouse events during intro 2018-01-23 02:00:59 +00:00
Joseph-Eugene Winzer
7b4e9a5424 SUPERNOVA: Adds text speed variable 2018-01-23 02:00:59 +00:00
Joseph-Eugene Winzer
de539134f9 SUPERNOVA: Removes comments 2018-01-23 02:00:59 +00:00
Joseph-Eugene Winzer
3f68cda2d7 SUPERNOVA: Implements de-/serialization
WIP. It is currently broken.
2018-01-23 01:53:31 +00:00
Joseph-Eugene Winzer
ef14dfb7c3 SUPERNOVA: Adds engine pause 2018-01-23 01:53:28 +00:00
Joseph-Eugene Winzer
edef2792da SUPERNOVA: Adds RoomID to Rooms
GameManager::airless() determined if the space suit could be taken off
by comparing the current room pointer to the allocated room objects.
This led to indeterministic behavior as sometimes airless() would
falsely return true as the dynamic allocation of the Room objects cannot
be expected to be in a certain order.
Implementing the corresponing RoomID to a Room objects solves this
problem.
2018-01-23 01:52:59 +00:00
Joseph-Eugene Winzer
bc43ff820e SUPERNOVA: Ignores mouse clicks while sound is playing 2018-01-23 01:52:59 +00:00
Joseph-Eugene Winzer
18abc4702a SUPERNOVA: Implements Return To Launcher 2018-01-23 01:52:50 +00:00
Joseph-Eugene Winzer
1e36c74e6b SUPERNOVA: Updates TODOs 2018-01-23 01:42:32 +00:00
Joseph-Eugene Winzer
b0b682ad09 SUPERNOVA: Removes getDOSTicks() 2018-01-23 01:42:32 +00:00
Joseph-Eugene Winzer
eabcca3e89 SUPERNOVA: Adds Alt-X as exit shortcut 2018-01-23 01:33:24 +00:00