| 474 | } |
| 475 | |
| 476 | void 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 | |
| 502 | void HObjectIncreaseBank() { RotateObject(Cur_object_index, 0, 0, Object_move_rotation); } |
| 503 | |