From 157fb76461d332a22233e6664cd294d7db5d3558 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Tue, 27 Feb 2024 22:07:29 +0100 Subject: [PATCH] added saving native BDCFF file with cheat code ":save-native-level" --- src/files.c | 12 +++++++++++- src/game_bd/export_bd.h | 1 + src/game_bd/main_bd.c | 5 +++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/files.c b/src/files.c index 1cb235ce..60d3ae0d 100644 --- a/src/files.c +++ b/src/files.c @@ -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); diff --git a/src/game_bd/export_bd.h b/src/game_bd/export_bd.h index a56e948b..1db82520 100644 --- a/src/game_bd/export_bd.h +++ b/src/game_bd/export_bd.h @@ -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); diff --git a/src/game_bd/main_bd.c b/src/game_bd/main_bd.c index 0ffea6be..3cda1ac5 100644 --- a/src/game_bd/main_bd.c +++ b/src/game_bd/main_bd.c @@ -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 -- 2.34.1