-
Notifications
You must be signed in to change notification settings - Fork 140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improvements for replays #92
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* Added a way for the game to loop through and remember all of the files in the replays/ directory; added `struct replay_info_type` to keep track of all the files. * Added a procedure that reads the "header" of the replay file (version strings + levelset name) * Replays can be played back in reverse creation order. * Replays get saved to a `replays/` directory * Added a procedure `reload_non_music_sounds()` that frees and reloads all of the sounds that are not music sounds (i.e. everything that is not an OGG file) * The game can now switch between different mod folders on the fly (i.e. you can cycle through replays that were created with different mods), added a procedure `reload_resources()`; this calls `reload_non_music_sounds()` and also reloads the data from PRINCE.DAT and KID.DAT (chtabs 0-2). * Fixed opening replay files (directly, e.g. by double-clicking) from other working directories than the SDLPoP root directory. (The game would look for the data files in the folder of the replay file itself, but this is not necessarily the desired behavior... Added procedure `change_working_directory_to_sdlpop_root()` which makes sure that the SDLPoP root folder will be the working directory in this situation). * Refactor: Split the code from `load_options()` into multiple pieces: `load_global_options()`, `check_mod_param()` and `load_mod_options()` (which needs to be called AFTER checking whether a replay file is being opened as the first command line parameter, because a replay file from a specific mod may be loaded, so the initial levelset name is not definitive until then). Known issues: * CusPop options used by replays do not get cleared properly. Will have to find a way to set all of the CusPop modified variables back to their original state, when unloading a replay... The old `options_type` provides some 'encapsulation' for the replay config... in that line of thinking, should we simply store all of the (SDLPoP.ini / mod.ini) configuration state along with the replay file? I'm not sure... * Still using the old version strings `quick_version` and `replay_version`, I don't really know if this should be changed or not. * The replay format is still unwieldy... Should there be other changes? And should memory now stored in `moves[]` be dynamic instead of static, and/or encapsulated somehow in a 'memory buffer' type? * Should it be possible to change the location of the `replays/` folder? Or should there be some other solution? * Do we need a warning message if the replay's mod folder is not installed?
Plus small changes to SDLPoP.ini: * Added some spacing to make the different sections stand out more * `;start_in_blind_mode = false` was set to `true` accidentally (fixed)
(For instance, if there is no `mod.ini`, the default settings can just be used)
Now makes use of the SDL_RWops functions, for file-like memory streams. Instead of using the fixed `options_type` struct to read/write the options in bulk, now it uses a method similar to `quick_process()`. The `options_type` itself is phased out.
* The function use_default_options() is no longer necessary * Ignore some bytes in options_process(): enable_mixer, enable_fade, enable_flash, enable_text, enable_replay and use_correct_aspect_ratio should not be changeable by replays (although these options were included in the old replay files) * Refactored the procedures for saving/loading the options using SDL_RWops streams
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This adds some new functions for replays.
replays/
directory; addedstruct replay_info_type
to keep track of all the files. The replay files do not need to have a specific naming pattern anymore.replays/
directory with formatYYYY-mm-dd Mod Name L<level> - <incrementing number>
reload_non_music_sounds()
that frees and reloads all of the sounds that are not music sounds (i.e. everything that is not an OGG file). Added a procedurereload_resources()
; this callsreload_non_music_sounds()
and also reloads the data from PRINCE.DAT and KID.DAT (chtabs 0-2).change_working_directory_to_sdlpop_root()
to makes sure that the SDLPoP root folder will be the working directory in this situation).load_options()
into multiple pieces:load_global_options()
,check_mod_param()
andload_mod_options()
(which needs to be called AFTER checking whether a replay file is being opened as the first command line parameter, because a replay file from a specific mod may be loaded, so the initial levelset name is not definitive until then).Known issues / discussion points:
quick_version
andreplay_version
, I don't really know if this should be changed or not.moves[]
be dynamic instead of static, and/or encapsulated somehow in a 'memory buffer' type?EDIT 1 Oct 2016: The issue with Cuspop options has been fixed.
options_type
has been removed altogether now. I also added an option in SDLPoP.ini to change the folder where replays are saved / read from.