Subversion Repositories Games.Descent

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. /*
  2.  * Portions of this file are copyright Rebirth contributors and licensed as
  3.  * described in COPYING.txt.
  4.  * Portions of this file are copyright Parallax Software and licensed
  5.  * according to the Parallax license below.
  6.  * See COPYING.txt for license details.
  7.  
  8. THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
  9. SOFTWARE CORPORATION ("PARALLAX").  PARALLAX, IN DISTRIBUTING THE CODE TO
  10. END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
  11. ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
  12. IN USING, DISPLAYING,  AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
  13. SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
  14. FREE PURPOSES.  IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
  15. CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES.  THE END-USER UNDERSTANDS
  16. AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.
  17. COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION.  ALL RIGHTS RESERVED.
  18. */
  19.  
  20. /*
  21.  *
  22.  * Prototypes for state saving functions.
  23.  *
  24.  */
  25.  
  26. #pragma once
  27.  
  28. #if defined(DXX_BUILD_DESCENT_I)
  29. #elif defined(DXX_BUILD_DESCENT_II)
  30. #define SECRETB_FILENAME        PLAYER_DIRECTORY_STRING("secret.sgb")
  31. #define SECRETC_FILENAME        PLAYER_DIRECTORY_STRING("secret.sgc")
  32. #endif
  33.  
  34. #include <cstddef>
  35. #include "dsx-ns.h"
  36. #include "fwd-window.h"
  37. #include "fwd-object.h"
  38. #include "game.h"
  39. #include "gameplayopt.h"
  40.  
  41. extern unsigned state_game_id;
  42.  
  43. #ifdef dsx
  44. #include "fwd-player.h"
  45. namespace dsx {
  46.  
  47. enum class secret_save
  48. {
  49.         none,
  50. #if defined(DXX_BUILD_DESCENT_II)
  51.         b,
  52.         c,
  53. #endif
  54. };
  55.  
  56. enum class secret_restore
  57. {
  58.         none,
  59. #if defined(DXX_BUILD_DESCENT_II)
  60.         survived,
  61.         died,
  62. #endif
  63. };
  64.  
  65. }
  66. #endif
  67.  
  68. namespace dcx {
  69.  
  70. enum class blind_save
  71. {
  72.         no,
  73.         yes,
  74. };
  75.  
  76. enum class deny_save_result
  77. {
  78.         allowed,
  79.         denied,
  80. };
  81.  
  82. int state_get_game_id(const d_game_unique_state::savegame_file_path &filename);
  83.  
  84. }
  85.  
  86. #ifdef dsx
  87. namespace dsx {
  88. deny_save_result deny_save_game(fvcobjptr &vcobjptr, const d_level_unique_control_center_state &LevelUniqueControlCenterState);
  89. deny_save_result deny_save_game(fvcobjptr &vcobjptr, const d_level_unique_control_center_state &LevelUniqueControlCenterState, const d_game_unique_state &GameUniqueState);
  90. void state_poll_autosave_game(d_game_unique_state &GameUniqueState, const d_level_unique_object_state &LevelUniqueObjectState);
  91. void state_set_immediate_autosave(d_game_unique_state &GameUniqueState);
  92. void state_set_next_autosave(d_game_unique_state &GameUniqueState, std::chrono::steady_clock::time_point now, autosave_interval_type interval);
  93. void state_set_next_autosave(d_game_unique_state &GameUniqueState, autosave_interval_type interval);
  94. int state_save_all_sub(const char *filename, const char *desc);
  95.  
  96. d_game_unique_state::save_slot state_get_save_file(d_game_unique_state::savegame_file_path &fname, d_game_unique_state::savegame_description *dsc, blind_save);
  97. d_game_unique_state::save_slot state_get_restore_file(d_game_unique_state::savegame_file_path &fname, blind_save);
  98.  
  99. #if defined(DXX_BUILD_DESCENT_I)
  100. int state_restore_all_sub(const char *filename);
  101. static inline void set_pos_from_return_segment(void)
  102. {
  103. }
  104. int state_save_all(blind_save b);
  105. static inline int state_save_all(secret_save, blind_save b)
  106. {
  107.         return state_save_all(b);
  108. }
  109. int state_restore_all(int in_game, std::nullptr_t, blind_save);
  110. static inline int state_restore_all(int in_game, secret_restore, std::nullptr_t, blind_save blind)
  111. {
  112.         return state_restore_all(in_game, nullptr, blind);
  113. }
  114. window_event_result StartNewLevelSub(int level_num, int page_in_textures);
  115. // Actually does the work to start new level
  116. static inline window_event_result StartNewLevelSub(int level_num, int page_in_textures, secret_restore)
  117. {
  118.         return StartNewLevelSub(level_num, page_in_textures);
  119. }
  120. #elif defined(DXX_BUILD_DESCENT_II)
  121. int state_restore_all_sub(const d_level_shared_destructible_light_state &LevelSharedDestructibleLightState, secret_restore, const char *filename);
  122. void set_pos_from_return_segment(void);
  123. int state_save_all(secret_save, blind_save);
  124. int state_restore_all(int in_game, secret_restore, const char *filename_override, blind_save);
  125. window_event_result StartNewLevelSub(int level_num, int page_in_textures, secret_restore);
  126. #endif
  127. }
  128. #endif
  129.