| 120 | } |
| 121 | |
| 122 | void Entity_SetModel(struct Entity* e, const cc_string* model) { |
| 123 | cc_string name, scale; |
| 124 | Vec3_Set(e->ModelScale, 1,1,1); |
| 125 | String_UNSAFE_Separate(model, '|', &name, &scale); |
| 126 | |
| 127 | /* 'giant' model kept for backwards compatibility */ |
| 128 | if (String_CaselessEqualsConst(&name, "giant")) { |
| 129 | name = String_FromReadonly("humanoid"); |
| 130 | Vec3_Set(e->ModelScale, 2,2,2); |
| 131 | } |
| 132 | |
| 133 | e->ModelBlock = BLOCK_AIR; |
| 134 | e->Model = Model_Get(&name); |
| 135 | if (!e->Model) Entity_SetBlockModel(e, &name); |
| 136 | |
| 137 | Entity_ParseScale(e, &scale); |
| 138 | Entity_UpdateModelBounds(e); |
| 139 | |
| 140 | if (e->Flags & ENTITY_FLAG_HAS_MODELVB) |
| 141 | Gfx_DeleteDynamicVb(&e->ModelVB); |
| 142 | } |
| 143 | |
| 144 | void Entity_UpdateModelBounds(struct Entity* e) { |
| 145 | struct Model* model = e->Model; |
no test coverage detected