MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / AttachDoPosOrient

Function AttachDoPosOrient

Descent3/attach.cpp:285–399  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

283}
284
285bool AttachDoPosOrient(object *parent, char parent_ap, object *child, char child_ap, bool f_parent, bool f_move_obj,
286 vector *pos, matrix *orient, bool f_dropping_off) {
287 vector goal_fvec;
288 vector goal_uvec;
289 vector goal_pos;
290
291 bool f_use_uvec = true;
292
293 vector start_fvec;
294 vector start_uvec;
295 vector start_pos;
296
297 object *goal_obj;
298 object *start_obj;
299
300 matrix rot_mat;
301
302 char goal_ap;
303 char start_ap;
304
305 if (f_parent) {
306 goal_obj = child;
307 goal_ap = child_ap;
308
309 start_obj = parent;
310 start_ap = parent_ap;
311 } else {
312 goal_obj = parent;
313 goal_ap = parent_ap;
314
315 start_obj = child;
316 start_ap = child_ap;
317 }
318
319 vector saved_pos = start_obj->pos;
320 matrix saved_orient = start_obj->orient;
321
322 f_use_uvec = true;
323 AttachPointPos(goal_obj, goal_ap, true, &goal_pos, true, &goal_fvec, &f_use_uvec, &goal_uvec);
324 goal_fvec *= -1.0f;
325
326 f_use_uvec = true;
327 if (f_dropping_off) {
328 object *attached_obj = ObjGet(start_obj->attach_children[0]);
329 ASSERT(attached_obj);
330 AttachPointPos(attached_obj, start_ap, true, &start_pos, true, &start_fvec, &f_use_uvec, &start_uvec);
331 } else {
332 AttachPointPos(start_obj, start_ap, true, &start_pos, true, &start_fvec, &f_use_uvec, &start_uvec);
333 }
334
335 vm_NormalizeVector(&start_fvec);
336 vm_NormalizeVector(&start_uvec);
337 vm_NormalizeVector(&goal_fvec);
338 vm_NormalizeVector(&goal_uvec);
339
340 matrix start_m;
341 matrix goal_m;
342

Callers 3

ai_moveFunction · 0.85
AttachObjectFunction · 0.85
AttachUpdateSubObjectsFunction · 0.85

Calls 9

AttachPointPosFunction · 0.85
ObjGetFunction · 0.85
vm_NormalizeVectorFunction · 0.85
GetTerrainRoomFromPosFunction · 0.85
SetObjectDeadFlagFunction · 0.85
ObjSetPosFunction · 0.85
vm_VectorToMatrixFunction · 0.50
vm_TransposeMatrixFunction · 0.50
vm_OrthogonalizeFunction · 0.50

Tested by

no test coverage detected