[sw] Ensure the view model has a visibility component

The rest of the system won't add one automatically (since entity
creation no longer does), but the alias and iqm rendering code expect
there to be one. Fixes a segfault when starting a scene (demo etc).
This commit is contained in:
Bill Currie 2022-11-19 14:06:24 +09:00
parent b59505b7c1
commit 2a8c12426d

View file

@ -386,6 +386,13 @@ R_DrawViewModel (void)
if (!renderer->model) if (!renderer->model)
return; return;
if (!Ent_HasComponent (viewent.id, scene_visibility, viewent.reg)) {
// ensure the view model has a visibility component because one won't
// be added automatically, and the model rendering code expects there
// to be one
Ent_SetComponent (viewent.id, scene_visibility, viewent.reg, 0);
}
transform_t transform = Entity_Transform (viewent); transform_t transform = Entity_Transform (viewent);
VectorCopy (Transform_GetWorldPosition (transform), r_entorigin); VectorCopy (Transform_GetWorldPosition (transform), r_entorigin);