Replace manual world object creation with native CreateEntityInstance_WithAttachment API

Markers are now created via the game's high-level entity factory (0x6707c0)
which handles spatial registration, render setup, and lifecycle internally.
Removed ~300 lines of dead code: manual game object list insertion, A/B mode
switching, parity scanning, and model attachment wrappers.

Creation works (markers visible). Destruction still crashes — needs correct
destructor for entities created via CreateWorldUnit path (not DestroyWorldObjectAndRelease).
This commit is contained in:
MarcelineVQ
2026-02-27 11:18:48 -08:00
parent 37d42d09c2
commit ab6f5ea4b9
5 changed files with 112 additions and 269 deletions
+10
View File
@@ -537,6 +537,12 @@ fn engineInitDetour() callconv(sc) void {
var shutdown_hook: hook.Hook = .{};
fn shutdownDetour() callconv(sc) void {
// Clean up world objects BEFORE game shutdown — atexit handlers run before DllMain
// so we must destroy markers here, not in uninstall().
if (build_opts.markers) {
markers.removeHooks();
}
const orig = shutdown_hook.getTrampoline(*const fn () callconv(sc) void);
orig();
}
@@ -570,6 +576,10 @@ fn uninstall() void {
shutdown_hook.remove();
engine_init_hook.remove();
// Markers must be cleaned up first — destroys world objects while game systems are still alive
if (build_opts.markers) {
markers.removeHooks();
}
if (build_opts.outline) {
outline.cleanup();
}