From 1d55bc7746a5f3bd16d9cb92496313ddd7059037 Mon Sep 17 00:00:00 2001 From: Arne de Bruijn Date: Sun, 29 Nov 2020 20:48:52 +0100 Subject: [PATCH] always init extra_bitmap_num in load_exit_models Commit cb2b844 and subsequent commits changed load_exit_models to only call bm_free_extra_objbitmaps if EMULATING_D1. The variable extra_bitmap_num is initialized as a side effect of bm_free_extra_objbitmaps, so it wasn't initialized anymore if not EMULATING_D1. This broke the exit sequence with the D2 Mac Demo data and add-on missions with custom exit sequences. This commit adds initialization of extra_bitmap_num if not EMULATING_D1 to fix the exit handling. --- similar/main/bm.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/similar/main/bm.cpp b/similar/main/bm.cpp index 8a69f21d0..6e8caf604 100644 --- a/similar/main/bm.cpp +++ b/similar/main/bm.cpp @@ -694,6 +694,10 @@ int load_exit_models() bm_free_extra_models(LevelSharedPolygonModelState); bm_free_extra_objbitmaps(); } + else if (!Exit_bitmaps_loaded) + { + extra_bitmap_num = Num_bitmap_files; + } // make sure there is enough space to load textures and models if (!Exit_bitmaps_loaded && N_ObjBitmaps > ObjBitmaps.size() - 6)