Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion code/model/modelrender.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3195,8 +3195,12 @@ void model_render_set_wireframe_color(const color* clr)

void modelinstance_replace_active_texture(polymodel_instance* pmi, const char* old_name, const char* new_name)
{
Assert(pmi != nullptr);
if (pmi == nullptr)
return;

polymodel* pm = model_get(pmi->model_num);
if (pm == nullptr)
return;

int final_index = -1;

Expand Down
4 changes: 4 additions & 0 deletions code/ship/ship.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8986,6 +8986,7 @@ void ship_delete( object * obj )
ct_ship_delete(shipp);

model_delete_instance(shipp->model_instance_num);
shipp->model_instance_num = -1;

// free up any weapon model instances
for (int i = 0; i < shipp->weapons.num_primary_banks; ++i)
Expand Down Expand Up @@ -19697,6 +19698,9 @@ void ship_page_out_textures(int ship_index, bool release)

void ship_replace_active_texture(int ship_index, const char* old_name, const char* new_name)
{
if (Ships[ship_index].model_instance_num < 0)
return;

polymodel_instance* pmi = model_get_instance(Ships[ship_index].model_instance_num);
modelinstance_replace_active_texture(pmi, old_name, new_name);
}
Expand Down
Loading