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

Function HObjectMove

editor/HObject.cpp:476–500  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

474}
475
476void HObjectMove(int objnum, float dx, float dy, float dz) {
477 matrix *mat;
478 object *obj;
479 vector newpos;
480 object *ref_obj; // the object in whose frame of reference we're moving
481
482 if (objnum == -1) {
483 mprintf(0, "HObjectMove:No current object.\n");
484 return;
485 }
486
487 obj = &Objects[objnum];
488
489 // Chose the reference object
490 ref_obj = (D3EditState.object_move_mode == REL_VIEWER) ? Viewer_object : obj;
491 mat = &ref_obj->orient;
492
493 // Calculate the new object position
494 newpos = obj->pos + (mat->rvec * dx) + (mat->uvec * dy) + (mat->fvec * -dz);
495
496 // Move the object
497 MoveObject(obj, &newpos);
498
499 Object_moved = 1;
500}
501
502void HObjectIncreaseBank() { RotateObject(Cur_object_index, 0, 0, Object_move_rotation); }
503

Callers 1

DeferMethod · 0.85

Calls 1

MoveObjectFunction · 0.85

Tested by

no test coverage detected