From 83077b6f95cb56085eb73c927e100e1671b064e8 Mon Sep 17 00:00:00 2001 From: Shiny Metagross <30511800+ShinyMetagross@users.noreply.github.com> Date: Tue, 26 Jul 2022 17:19:35 -0700 Subject: [PATCH] Update models.cpp - Removed a useless bool - Fixed an issue with model containers having less models than their smf total models amount using the smaller amount --- src/r_data/models.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/r_data/models.cpp b/src/r_data/models.cpp index 444bb46a8..ae487687a 100644 --- a/src/r_data/models.cpp +++ b/src/r_data/models.cpp @@ -280,7 +280,8 @@ void RenderFrameModels(FModelRenderer *renderer, FLevelLocals *Level, const FSpr //[SM] - if we added any models for the frame to also render, then we also need to update modelsAmount for this smf if (actor->modelData != nullptr) { - modelsamount = actor->modelData->modelIDs.Size(); + if (actor->modelData->modelIDs.Size() > modelsamount) + modelsamount = actor->modelData->modelIDs.Size(); } TArray surfaceskinids; @@ -293,10 +294,10 @@ void RenderFrameModels(FModelRenderer *renderer, FLevelLocals *Level, const FSpr FTextureID skinid; skinid.SetInvalid(); surfaceskinids.Clear(); - bool surfaceskinsswapped = false; if (actor->modelData != nullptr) { - modelid = actor->modelData->modelIDs[i]; + if (i < (int)actor->modelData->modelIDs.Size()) + modelid = actor->modelData->modelIDs[i]; if (i < (int)actor->modelData->modelFrameGenerators.Size()) {