A_ChangeModel now has generatorIndex
- To really take advantage of this function, I thought it would be useful to be able to add additional models if the user wants to. Let's say you got a player model at index 0. Your gun model has the same frames, but you don't want to duplicate the modeldef data. With generator index, you don't need to duplicate the data, just tell generator index to clone frame data from index 0. - Implemented a little something to check if a negative skin or model index were passed, and prevent modders from pulling that off.
This commit is contained in:
parent
fa6dfdf64c
commit
9ab6557822
5 changed files with 53 additions and 11 deletions
|
|
@ -278,15 +278,35 @@ 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)
|
||||
{
|
||||
if (tempsmf->modelsAmount < actor->modelData->modelIDs.Size())
|
||||
{
|
||||
tempsmf->modelsAmount = actor->modelData->modelIDs.Size();
|
||||
while (tempsmf->modelframes.Size() < actor->modelData->modelIDs.Size()) tempsmf->modelframes.Push(-1);
|
||||
while (smfNext->modelframes.Size() < actor->modelData->modelIDs.Size()) smfNext->modelframes.Push(-1);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < tempsmf->modelsAmount; i++)
|
||||
{
|
||||
if (actor->modelData != nullptr)
|
||||
{
|
||||
if (i < (int)actor->modelData->modelIDs.Size())
|
||||
{
|
||||
if(actor->modelData->modelIDs[i] != -1)
|
||||
if (actor->modelData->modelIDs[i] != -1)
|
||||
tempsmf->modelIDs[i] = actor->modelData->modelIDs[i];
|
||||
}
|
||||
if (i < (int)actor->modelData->modelFrameGenerators.Size())
|
||||
{
|
||||
//[SM] - We will use this little snippet to allow a modder to specify a model index to clone. It's also pointless to clone something that clones something else in this case. And causes me headaches.
|
||||
if (actor->modelData->modelFrameGenerators[i] >= 0 && smf->modelframes[i] != -1)
|
||||
{
|
||||
tempsmf->modelframes[i] = tempsmf->modelframes[actor->modelData->modelFrameGenerators[i]];
|
||||
if (smfNext) smfNext->modelframes[i] = smfNext->modelframes[actor->modelData->modelFrameGenerators[i]];
|
||||
}
|
||||
}
|
||||
if (i < (int)actor->modelData->skinIDs.Size())
|
||||
{
|
||||
if (actor->modelData->skinIDs[i].isValid())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue