fix: set sound_available early to match original constructor
Browse filesThe original sets sound_available = (headless_mode == 0) immediately
after storing params, NOT at the end. This enables:
- Loading progress bar visibility
- Message pump during construction (FUN_572E30)
- Sound playback during loading ticks
- Proper flag initialization in DDGameWrapper__LoadingProgressTick
Previously deferred to avoid message pump crashes, but all critical
DDGame fields are initialized before the first loading tick call.
This should fix the missing loading screen ticks and sounds, and may
fix the forced "teleport worms in" mode.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
crates/openwa-core/src/engine/ddgame.rs
CHANGED
|
@@ -1030,12 +1030,11 @@ pub unsafe fn create_ddgame(
|
|
| 1030 |
|
| 1031 |
// ββ 6. Sound available + always-1 flags ββ
|
| 1032 |
let is_headless = (*game_info).headless_mode != 0;
|
| 1033 |
-
//
|
| 1034 |
-
//
|
| 1035 |
-
//
|
| 1036 |
-
//
|
| 1037 |
-
|
| 1038 |
-
(*ddgame).sound_available = 0;
|
| 1039 |
(*ddgame)._field_7efc = 1;
|
| 1040 |
|
| 1041 |
// ββ 7. DDGameWrapper+0x48C init ββ
|
|
@@ -1062,9 +1061,6 @@ pub unsafe fn create_ddgame(
|
|
| 1062 |
// ββ 10. GfxHandler, landscape, sprites, audio, resources ββ
|
| 1063 |
init_graphics_and_resources(wrapper, game_info, net_game, display, is_headless);
|
| 1064 |
|
| 1065 |
-
// Construction complete β set final flag values.
|
| 1066 |
-
(*ddgame).sound_available = if is_headless { 0 } else { 1 };
|
| 1067 |
-
|
| 1068 |
let _ = crate::log::log_line("[DDGame] create_ddgame complete");
|
| 1069 |
ddgame
|
| 1070 |
}
|
|
|
|
| 1030 |
|
| 1031 |
// ββ 6. Sound available + always-1 flags ββ
|
| 1032 |
let is_headless = (*game_info).headless_mode != 0;
|
| 1033 |
+
// Original: sound_available = (headless_mode == 0) β set EARLY.
|
| 1034 |
+
// This enables the loading progress bar, message pump, and sound during
|
| 1035 |
+
// construction. Previously deferred to avoid message pump crashes, but all
|
| 1036 |
+
// critical DDGame fields (game_info, display, sound, etc.) are now set.
|
| 1037 |
+
(*ddgame).sound_available = if is_headless { 0 } else { 1 };
|
|
|
|
| 1038 |
(*ddgame)._field_7efc = 1;
|
| 1039 |
|
| 1040 |
// ββ 7. DDGameWrapper+0x48C init ββ
|
|
|
|
| 1061 |
// ββ 10. GfxHandler, landscape, sprites, audio, resources ββ
|
| 1062 |
init_graphics_and_resources(wrapper, game_info, net_game, display, is_headless);
|
| 1063 |
|
|
|
|
|
|
|
|
|
|
| 1064 |
let _ = crate::log::log_line("[DDGame] create_ddgame complete");
|
| 1065 |
ddgame
|
| 1066 |
}
|