| 146 | } |
| 147 | |
| 148 | void GetPointInObjectSpace(vector *dest, vector *pos, object *obj, int subnum, int world) { |
| 149 | poly_model *pm = &Poly_models[obj->rtype.pobj_info.model_num]; |
| 150 | bsp_info *sm = &pm->submodel[subnum]; |
| 151 | float normalized_time[MAX_SUBOBJECTS]; |
| 152 | int i; |
| 153 | int rotate_list[MAX_SUBOBJECTS]; |
| 154 | int num_to_rotate = 0; |
| 155 | |
| 156 | if (!pm->new_style) |
| 157 | return; |
| 158 | |
| 159 | for (i = 0; i < MAX_SUBOBJECTS; i++) |
| 160 | normalized_time[i] = 0.0; |
| 161 | |
| 162 | SetModelAnglesAndPos(pm, normalized_time); |
| 163 | |
| 164 | vector pnt = *pos; |
| 165 | int mn = subnum; |
| 166 | vector tpnt; |
| 167 | matrix m; |
| 168 | |
| 169 | while (mn != -1) { |
| 170 | rotate_list[num_to_rotate] = mn; |
| 171 | num_to_rotate++; |
| 172 | mn = pm->submodel[mn].parent; |
| 173 | } |
| 174 | |
| 175 | // Subtract and rotate position |
| 176 | if (world) |
| 177 | tpnt = pnt - obj->pos; |
| 178 | else |
| 179 | tpnt = pnt; |
| 180 | |
| 181 | pnt = tpnt * obj->orient; |
| 182 | |
| 183 | for (i = num_to_rotate - 1; i >= 0; i--) { |
| 184 | // Subtract and rotate position for this submodel |
| 185 | mn = rotate_list[i]; |
| 186 | |
| 187 | if (world) |
| 188 | tpnt = pnt - pm->submodel[mn].offset; |
| 189 | else |
| 190 | tpnt = pnt; |
| 191 | |
| 192 | vm_AnglesToMatrix(&m, pm->submodel[mn].angs.p, pm->submodel[mn].angs.h, pm->submodel[mn].angs.b); |
| 193 | |
| 194 | pnt = tpnt * m; |
| 195 | } |
| 196 | |
| 197 | *dest = pnt; |
| 198 | } |
| 199 | |
| 200 | // Goes through all objects and fills in the lightmap data for them |
| 201 | void AssignLightmapsToObjectSurfaces(int surface_index, int terrain) { |
no test coverage detected