added saving native BDCFF file with cheat code ":save-native-level"
authorHolger Schemel <info@artsoft.org>
Tue, 27 Feb 2024 21:07:29 +0000 (22:07 +0100)
committerHolger Schemel <info@artsoft.org>
Tue, 27 Feb 2024 21:07:29 +0000 (22:07 +0100)
src/files.c
src/game_bd/export_bd.h
src/game_bd/main_bd.c

index 1cb235ced68f5daa059138da80c795251f411423..60d3ae0d23dc00f43aa474d72e796c93a210d438 100644 (file)
@@ -6491,7 +6491,17 @@ void CopyNativeLevel_Native_to_RND(struct LevelInfo *level)
 
 void SaveNativeLevel(struct LevelInfo *level)
 {
-  if (level->game_engine_type == GAME_ENGINE_TYPE_SP)
+  if (level->game_engine_type == GAME_ENGINE_TYPE_BD)
+  {
+    char *basename = getSingleLevelBasenameExt(level->file_info.nr, "bd");
+    char *filename = getLevelFilenameFromBasename(basename);
+
+    CopyNativeLevel_RND_to_BD(level);
+    // CopyNativeTape_RND_to_BD(level);
+
+    SaveNativeLevel_BD(filename);
+  }
+  else if (level->game_engine_type == GAME_ENGINE_TYPE_SP)
   {
     char *basename = getSingleLevelBasenameExt(level->file_info.nr, "sp");
     char *filename = getLevelFilenameFromBasename(basename);
index a56e948bf282dd3566bf2bfe8db0034a9118d347..1db82520b8642d769650307e42ed77adab5c3b1d 100644 (file)
@@ -98,6 +98,7 @@ void InitGfxBuffers_BD(void);
 void setLevelInfoToDefaults_BD_Ext(int, int);
 void setLevelInfoToDefaults_BD(void);
 boolean LoadNativeLevel_BD(char *, int, boolean);
+boolean SaveNativeLevel_BD(char *);
 
 unsigned int InitEngineRandom_BD(int);
 void InitGameEngine_BD(void);
index 0ffea6be348c4b3fecfb6e34d2b39ddcf79e7775..3cda1ac5cea5655f2ddcc84a4b95a2f83bbf04ec 100644 (file)
@@ -154,6 +154,11 @@ boolean LoadNativeLevel_BD(char *filename, int level_pos, boolean level_info_onl
   return TRUE;
 }
 
+boolean SaveNativeLevel_BD(char *filename)
+{
+  return gd_caveset_save_to_file(filename);
+}
+
 
 // ============================================================================
 // game engine functions