Make invalid model numbers use error model

This commit is contained in:
MysterD 2023-04-24 12:54:43 -07:00
parent 1f11cf00d2
commit c095dcadc4
1 changed files with 2 additions and 2 deletions

View File

@ -675,7 +675,7 @@ struct Object *spawn_object_at_origin(struct Object *parent, UNUSED s32 unusedAr
obj->header.gfx.activeAreaIndex = parent->header.gfx.areaIndex;
obj->globalPlayerIndex = 0;
if (model >= MAX_LOADED_GRAPH_NODES) { model = MODEL_NONE; }
if (model >= MAX_LOADED_GRAPH_NODES) { model = MODEL_ERROR_MODEL; }
geo_obj_init((struct GraphNodeObject *) &obj->header.gfx, gLoadedGraphNodes[model], gVec3fZero,
gVec3sZero);
smlua_call_event_hooks_object_model_param(HOOK_OBJECT_SET_MODEL, obj, model);
@ -1374,7 +1374,7 @@ void cur_obj_set_model(s32 modelID) {
}
void obj_set_model(struct Object* obj, s32 modelID) {
if (modelID >= MAX_LOADED_GRAPH_NODES) { modelID = MODEL_NONE; }
if (modelID >= MAX_LOADED_GRAPH_NODES) { modelID = MODEL_ERROR_MODEL; }
obj->header.gfx.sharedChild = gLoadedGraphNodes[modelID];
dynos_actor_override((void*)&obj->header.gfx.sharedChild);
smlua_call_event_hooks_object_model_param(HOOK_OBJECT_SET_MODEL, obj, modelID);