]> 4ch.mooo.com Git - 16.git/blobdiff - src/lib/16_sd.c
added stuff like repo call of dro2imf and imfplay actually uses the memory manager...
[16.git] / src / lib / 16_sd.c
index 4445bc4722fe9c24c1663454f10668244afaaa5c..b3349bc25e7bb3e8415129327f0f4062ea168007 100755 (executable)
@@ -223,6 +223,12 @@ void SD_Initimf(global_game_variables_t *gvar)
        shutdown_adlib_opl3(); // NTS: Apparently the music won't play otherwise\r
 }\r
 \r
+void SD_imf_reset_music(global_game_variables_t *gvar)\r
+{\r
+       gvar->ca.sd.imf_music = gvar->ca.sd.imf_play_ptr = gvar->ca.sd.imf_music_end = NULL;\r
+       gvar->ca.sd.imf_delay_countdown = 0;\r
+}\r
+\r
 void SD_imf_free_music(global_game_variables_t *gvar)\r
 {\r
 #ifndef SD_USESCAMMPM\r
@@ -230,8 +236,7 @@ void SD_imf_free_music(global_game_variables_t *gvar)
 #else\r
        MM_FreePtr(MEMPTRCONV gvar->ca.audiosegs[0], gvar);     //TODO make behave like id engine\r
 #endif\r
-       gvar->ca.sd.imf_music = gvar->ca.sd.imf_play_ptr = gvar->ca.sd.imf_music_end = NULL;\r
-       gvar->ca.sd.imf_delay_countdown = 0;\r
+       SD_imf_reset_music(gvar);\r
 }\r
 \r
 int SD_imf_load_music(const char *path, global_game_variables_t *gvar)\r
@@ -240,7 +245,11 @@ int SD_imf_load_music(const char *path, global_game_variables_t *gvar)
        unsigned char buf[8];\r
        int fd;\r
 \r
+#ifndef SD_USESCAMMPM\r
        SD_imf_free_music(gvar);\r
+#else\r
+       SD_imf_reset_music(gvar);\r
+#endif\r
 \r
        fd = open(path,O_RDONLY|O_BINARY);\r
        if (fd < 0) return 0;\r