| 1 | /* |
| 2 | * Descent 3 |
| 3 | * Copyright (C) 2024 Parallax Software |
| 4 | * |
| 5 | * This program is free software: you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation, either version 3 of the License, or |
| 8 | * (at your option) any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 | |
| 18 | --- HISTORICAL COMMENTS FOLLOW --- |
| 19 | |
| 20 | * $Logfile: /DescentIII/Main/editor/ObjMoveManager.h $ |
| 21 | * $Revision: 1.1.1.1 $ |
| 22 | * $Date: 2003-08-26 03:57:38 $ |
| 23 | * $Author: kevinb $ |
| 24 | * |
| 25 | * Object Move Manager |
| 26 | * |
| 27 | * $Log: not supported by cvs2svn $ |
| 28 | * |
| 29 | * 3 2/06/98 3:08p Samir |
| 30 | * Simplified object movement code. |
| 31 | * |
| 32 | * 2 9/03/97 8:00p Samir |
| 33 | * Implemented most of the fixes for the object moving system. |
| 34 | * |
| 35 | * 1 8/29/97 1:45p Samir |
| 36 | * Basic object movement working. |
| 37 | * |
| 38 | * $NoKeywords: $ |
| 39 | */ |
| 40 | |
| 41 | #ifndef _OBJ_MOVE_MANAGER_H |
| 42 | #define _OBJ_MOVE_MANAGER_H |
| 43 | |
| 44 | #include "vecmat.h" |
| 45 | |
| 46 | struct object; |
| 47 | |
| 48 | const int OBJMOVEAXIS_X = 1, OBJMOVEAXIS_Y = 2, OBJMOVEAXIS_Z = 3, OBJMOVEAXIS_XY = 4, OBJMOVEAXIS_P = 5, |
| 49 | OBJMOVEAXIS_H = 6, OBJMOVEAXIS_B = 7, OBJMOVEAXIS_PH = 8; |
| 50 | |
| 51 | class ObjectMoveManager { |
| 52 | int m_DragState; // 0 if not dragging, 1 if dragging. 2 if no drag. |
| 53 | int m_MoveAxis; // defined to a value from above. |
| 54 | int m_ObjNum; // object index to be moved. |
| 55 | float m_WindowW2, m_WindowH2; // window x and y centers, from which we translate mouse coords to 3d coords |
| 56 | |
| 57 | CWnd *m_DragWnd; // window where we can drag the mouse |
| 58 | RECT m_DragRect; |
| 59 | |
| 60 | matrix m_ViewMat; |
| 61 | vector m_ViewPos; |
| 62 | |
| 63 | // dx and dy are the return values projected from dsx and dsy, given the object's position |
| 64 | void GetObjectDeltas(float *dx, float *dy, object *obj, int dsx, int dsy); |
| 65 | |
| 66 | public: |
| 67 | ObjectMoveManager(); |
| 68 | |
| 69 | // starts motion |
| 70 | void Start(CWnd *wnd, int view_width, int view_height, vector *view_pos, matrix *view_mat, int x, int y); |
| 71 | |
| 72 | // ends current object movement |
| 73 | void End(); |
| 74 | |
| 75 | // defers control to the move manager |
| 76 | void Defer(); |
| 77 | |
| 78 | // tell whether we are drawing a selection box (if drag state == 1) |
| 79 | bool IsMoving() const { return (m_DragState == 1); }; |
| 80 | |
| 81 | // sets the moving axis |
| 82 | void SetMoveAxis(int axis) { m_MoveAxis = axis; }; |
| 83 | }; |
| 84 | |
| 85 | extern ObjectMoveManager ObjMoveManager; |
| 86 | |
| 87 | #endif |