Commit Graph
151 Commits
Author SHA1 Message Date
Kaloyan Chehlarski 74307deca6 NANCY: Rewrite resource handling
CifFile/CifTree classes have been completely rewritten and
moved to their own header file. ResourceManager is now
exclusively responsible for loading IFF files, making sure
loose .iff/.cif files take precedence before ones embedded
in a ciftree.
Also, completed work on the cif/ciftree exporting functions.
2023-10-26 19:46:32 +03:00
Kaloyan Chehlarski 56b48f6186 NANCY: Add GetEngineData macro
Added a macro that hides away the ugly casts whenever
an EngineData object is requested.
2023-10-12 12:42:28 +03:00
Kaloyan Chehlarski 67d36e46b7 NANCY: Add support for nancy7 special effects
The SpecialEffect action record got some significant changes
in nancy7, including a new type of fade, and the removal
of the predefined number of frames to fade. Testing with the
original is tough, since it runs way too fast on modern PCs,
and the new fade type is never actually used properly, so
the current implementation is only an approximation. Also,
I've discovered that prior to these changes the entire screen
got crossfaded, so the screenshotViewport() function is now
entirely removed.
2023-10-07 14:45:22 +03:00
Kaloyan Chehlarski 7f16ac517d NANCY: Define kNoScene constant 2023-10-07 14:45:21 +03:00
Kaloyan Chehlarski 57c9f5f203 NANCY: Implement EnableDisableInventory
Implemented an action record type responsible for making
a specific item temporarily unusable.
2023-10-03 17:58:28 +03:00
Kaloyan Chehlarski b0bd3f1c3f NANCY: Implement viewable items in nancy7
Added support for the new type of item introduced in nancy7,
which, instead of getting picked up, transports the player to
a new scene with a close-up view of the item.
2023-10-03 17:58:28 +03:00
Kaloyan Chehlarski cb526a5eb3 NANCY: Fix kSceneCount dependency
It seems the kSceneCount dependency type has been
broken pretty much always, and the last attempt at fixing it
was a fluke. Also added checks for nancy7, since the devs
decided that, for whatever reason, the conditions need to
be flipped, and what was before a less-than check is now a
greater-than one, and vice versa.
2023-10-03 17:58:28 +03:00
Kaloyan Chehlarski dbdb30e5cc NANCY: Implement terse PlaySound variants
Added support for PlaySoundTerse and
PlayRandomSoundTerse, as introduced in nancy7. Also
implemented the new functionality for reading closed
captioning text from the Autotext chunk.
2023-10-03 17:58:28 +03:00
Kaloyan Chehlarski 7e6d37276b NANCY: Add support for nancy7's "More Nancy Drew!"
Made changes to BSUM reading, MainMenu and Scene states
needed to support the promo button in nancy7's main menu.
2023-10-02 12:19:31 +03:00
Kaloyan Chehlarski 5ecfef2a2e NANCY: Add support for TSUM chunks
Added support for the short variant of a scene summary,
as introduced in nancy7.
2023-10-02 12:19:31 +03:00
Kaloyan Chehlarski 7e4c4f3287 NANCY: Improve support for nancy6 TOD dependency
The time of day in nancy6 now depends on values for day
start and end found inside BSUM. We now correctly read
and use those.
2023-10-01 13:30:05 +03:00
Kaloyan Chehlarski f3fe8f251f NANCY: Increment scene counts on scene exit
The counters for how many times a scene has been
visited now get incremented only when we exit it. This
makes sure the counter is not incremented when loading a
save, and makes sure dependencies that require the
sceneCount to be equal to 0 can actually execute
(e.g. nancy6 scene 2319)
2023-09-30 17:56:27 +03:00
Kaloyan Chehlarski 4e20ddd030 NANCY: Do not add a single item multiple times
Fixed a silly bug in TVD where a cutscene can give the player
multiple copies of the same item.
2023-09-24 17:43:28 +03:00
Kaloyan Chehlarski c20f765032 NANCY: Add console command to display hotspots 2023-09-24 17:43:28 +03:00
Kaloyan Chehlarski 48de468c09 NANCY: Remove held item when entering puzzles
Pretty much all puzzles (except the telephone and alarm
clock, which aren't actually puzzles) force the currently
held item back into the inventory when they start, which is
now implemented.
2023-09-21 14:46:16 +03:00
Kaloyan Chehlarski 1d07ef258b NANCY: Remove items from inventory when held
Fixed an issue where RemoveInventoryNotHS would not
work correctly if the item was currently being held by the
player. This fixes the fire extinguisher in nancy3 remaining
in the inventory all the way until the end.
2023-09-20 16:16:21 +03:00
Kaloyan Chehlarski 78f82c9ab9 NANCY: Do not repeat "can't" sound caption
Clicking on a hotspot that triggers a "can't" sound will now
clear the textbox before pushing the caption. This makes
sure that the caption won't be displayed twice.
2023-09-19 17:38:25 +03:00
Kaloyan Chehlarski b0c84deb2b NANCY: Do not exit when reaching unknown AR type
Changed the ActionRecord loading code so that reaching
an unknown/changed record type just shows a warning
and continues, instead of throwing an error and quitting.
2023-09-19 17:38:25 +03:00
Kaloyan Chehlarski 73c6d2087d NANCY: Avoid immediate crash when an error is thrown
Fixed an edge case where an error being thrown during
the very first time a Scene is loaded would result in a
chain reaction that would crash ScummVM while trying to
draw invalid data on screen. Instead, the error is now
properly shown on screen before quitting.
Also made changes to the savegame screenshot code to make
sure this change does not impact second chance saves.
2023-09-19 17:38:24 +03:00
Kaloyan Chehlarski b3c81e7074 NANCY: Auto-clear inventory item captions
Item "can't" sounds' captions get automatically cleared after
a certain time delay, which is now implemented.
2023-09-16 17:04:37 +03:00
Kaloyan Chehlarski ba5696786f NANCY: Implement InventorySoundOverride
Implemented the action record type responsible for
overriding the default "I can't" sound for a specific item.
Also implemented closed captioning for the same use
case, since it had previously been overlooked.
2023-09-16 17:04:37 +03:00
Kaloyan Chehlarski abc4168433 NANCY: Properly pause all scene sounds
Fixed an issue where certain sound channels wouldn't get
paused when changing state. Collapsed the pause/unpause
functions inside Scene into a single function, and placed it
inside SoundManager.
2023-09-16 13:14:52 +03:00
Kaloyan Chehlarski 6f0e74c620 NANCY: Play correct sfx when getting/losing item 2023-09-12 19:43:30 +03:00
Kaloyan Chehlarski 7f8d6a47d3 NANCY: Avoid flashing cursor when changing scene
In cases where the mouse falls inside a hotspot with the
same cursor type in both the previous and next scenes,
we now avoid a single frame where the cursor flashes to
the default and then back.
2023-09-12 19:43:30 +03:00
Kaloyan Chehlarski 52b66621fa NANCY: Skip drawing first frame after loading save 2023-09-12 19:43:30 +03:00
Kaloyan Chehlarski 4cc3e98362 NANCY: Destroy Scene when winning/losing game
This makes sure the player can't press Continue game
after winning/losing the game.
2023-08-31 12:20:40 +03:00
Kaloyan Chehlarski 35e0946ff7 NANCY: Add support for nancy5's day counter
Added support for the nancy5 day counter/countdown
clock that replaces the normal clock in the bottom left of
the UI.
2023-08-31 12:20:39 +03:00
Kaloyan Chehlarski 03d4791ed2 NANCY: Implement standard way to access boot chunks
Previously, the NancyEngine class was responsible for
handling creation and destruction of many naked pointers
to engine data, which led to several instances of memory
leaks that needed to be fixed. These changes introduce a
standard way of handling that same data, similar to the
one already used by PuzzleData inside Scene. Unfortunately,
this does add the need for relevant data to be casted to
the proper type before it is handled.
2023-08-31 12:20:39 +03:00
Kaloyan Chehlarski 24670d9afd NANCY: Remove check for number of action records
There is at least one scene in nancy5 with more than 30
records. The check is pretty much useless anyway, since
we have a variable-size array of records while the original
engine didn't, so it has simply been removed.
2023-08-31 12:20:39 +03:00
Kaloyan Chehlarski efcd1757f5 NANCY: Add keymap for opening main menu
The original engine allowed players to go to the main menu
via the Esc button, but only when they were in the Scene state.
This is now implemented here as well.
2023-08-28 19:53:33 +03:00
Kaloyan Chehlarski 1bb5d42a2e NANCY: Implement save prompt on quit
Later games added a prompt to save before quitting, which is now implemented.
2023-08-28 19:53:33 +03:00
Kaloyan Chehlarski f25b6e42a7 NANCY: Implement original load/save menu 2023-08-28 19:53:33 +03:00
Kaloyan Chehlarski 00c7f4d128 NANCY: Implement setup menu
Implemented the Setup menu, which handles game settings.
Also made some fixes to MainMenu.
2023-08-28 19:53:32 +03:00
Kaloyan Chehlarski a006323d3d NANCY: Make scrollbars more usable
Fixed the way scrollbars are handled, at the cost of some
accuracy. As a result, moving the mouse outside of the
scrollbar's hotspot no longer stops it from moving.
2023-08-28 19:53:32 +03:00
Kaloyan Chehlarski f9413d1bda NANCY: Clear save_slot key after loading save
This fixes the main menu just reloading the selected save
even when the user has picked "new game" instead.
2023-08-28 19:53:31 +03:00
Kaloyan Chehlarski c9c784c2fa NANCY: Clear textbox on every scene change
The previous design, where the textbox kept its contents
unless it was explicitly cleared, was probably a leftover
from the early days of the engine, though I honestly can't
remember.
2023-08-25 20:32:06 +03:00
Kaloyan Chehlarski 4c5d0d2299 NANCY: Silence warnings
Fixed several small issues that caused compiler and/or
Coverity warnings.
2023-08-24 12:47:50 +03:00
Kaloyan Chehlarski 67188041d7 NANCY: Pause all sounds in GMM and console
Fixes an issue where some sounds would still play even
when the GMM or console were open.
2023-08-22 21:08:17 +03:00
Kaloyan Chehlarski 860f5cd090 NANCY: Add 3D sound support
Added support for 3D sound, as introduced in nancy3.
The original engine used DirectSound 3D, which enabled
for easy sound panning, attenuation based on distance,
and doppler effect simulation. The DS3D algorithm
has only been approximated; in particular, there are some
minor differences when it comes to sound panning.
2023-08-22 12:15:26 +03:00
Kaloyan Chehlarski e4f2cb4acd NANCY: Improve sound reading
Fixed several inaccuracies with reading sound data. Added
enumerations describing the sound playing commands
introduced in nancy3. Added a flag for sound debugging,
which will be used in implementing said play commands.
2023-08-10 14:28:49 +03:00
Kaloyan Chehlarski 811d3b820d NANCY: Only allow first call to changeScene()
changeScene() no longer takes the new scene data if Scene
is already in the kLoad state. This fixes an issue in nancy4's
suitcase, where two different SceneChange action records
have the exact same dependencies, and would both trigger
at the same frame. Thus, the second one would always
overwrite the first one, leaving the player stuck inside
the open suitcase.
2023-08-08 12:13:06 +03:00
Eugene Sandulenko f94464ecb1 NANCY: JANITORIAL: Remove trailing spaces 2023-08-07 10:47:50 +02:00
Kaloyan Chehlarski c74c52097f NANCY: Properly clear puzzle data
Fixed an issue where in-game loading would segfault
because the _puzzleData HashMap wasn't getting properly
cleared.
2023-05-11 14:28:56 +03:00
Kaloyan Chehlarski 4cddb2e61c NANCY: Handle consecutive SpecialEffects
Handled an edge case where two consecutive scenes have
SpecialEffect fades, but only the latter one would get played.
2023-05-11 14:28:56 +03:00
Kaloyan Chehlarski 899f435cfd NANCY: Allow first event flag to be set
Fixed an issue in nancy3 where the first event flag wouldn't
be set, blocking the player from choosing easy difficulty.
2023-05-11 14:28:55 +03:00
Kaloyan Chehlarski dff9cbe272 NANCY: Use correct values for nancy3's flags
Nancy3 did away with earlier versions of the engine's usage
of 1 and 2 as false/true values. This commit adds two
new values to NancyEngine: _true and _false, which hold
the correct values used by different versions of the engine.
2023-05-10 16:57:33 +03:00
Kaloyan Chehlarski 150d0d5c6b NANCY: Improve reading of nancy3 files
Improved the reading of SoundDescriptions, SceneSummaries,
and SceneChangeDescriptions so nancy3 no longer crashes
on the first scene.
2023-05-10 16:57:33 +03:00
Kaloyan Chehlarski 685eccf1c2 NANCY: Separate SoundDescription reading functions 2023-05-10 16:57:33 +03:00
Kaloyan Chehlarski 0919ee559f NANCY: Implement scene counts
The counters for how many times each scene has been hit
now actually work, instead of always being 0. The data type
storing them has been changed to a HashMap to save
on memory.
2023-05-10 16:57:31 +03:00
Kaloyan Chehlarski c6164fcf4a NANCY: Improve puzzle data storage and saving
Changed the way game-specific puzzle data is stored and
saved. Scene now holds a HashMap of lazily initialized
PuzzleData objects, each of which stores data for a specific
puzzle type. This helps avoid long switch statements in
the initialization and save/load code, and helps avoid
breaking savefiles every time a new puzzle type
is implemented.
2023-05-07 11:46:35 +03:00