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

Function MoveWorld

editor/moveworld.cpp:120–159  ·  view source on GitHub ↗

Read the mouse and move the wireframe view

Source from the content-addressed store, hash-verified

118
119// Read the mouse and move the wireframe view
120void MoveWorld() {
121 int x, y, dx, dy;
122 ddio_MouseGetState(&x, &y, &dx, &dy);
123
124 if ((dx != 0) || (dy != 0)) {
125
126 if (Editor_view_mode == VM_TERRAIN) {
127 return;
128 }
129
130 if ((KEY_STATE(KEY_LCTRL) || KEY_STATE(KEY_RCTRL)) && !(KEY_STATE(KEY_LSHIFT) || KEY_STATE(KEY_RSHIFT))) {
131 matrix rotmat, tempm;
132 GetMouseRotation(dx, dy, &rotmat);
133 tempm = Wireframe_view->orient * rotmat;
134 Wireframe_view->orient = tempm;
135 Edview_changed = 1;
136 }
137
138 if ((KEY_STATE(KEY_LCTRL) || KEY_STATE(KEY_RCTRL)) && (KEY_STATE(KEY_LSHIFT) || KEY_STATE(KEY_RSHIFT))) {
139 Wireframe_view->target += Wireframe_view->orient.rvec * -dx * MOVE_SCALE;
140 Wireframe_view->target += Wireframe_view->orient.uvec * dy * MOVE_SCALE;
141 Edview_changed = 1;
142 }
143
144 if (KEY_STATE(KEY_Z) && !(KEY_STATE(KEY_LSHIFT) || KEY_STATE(KEY_RSHIFT))) {
145 Wireframe_view->dist += dy * ZOOM_SCALE;
146 if (Wireframe_view->dist < 0)
147 Wireframe_view->dist = 0;
148 Edview_changed = 1;
149 }
150
151 if (KEY_STATE(KEY_Z) && (KEY_STATE(KEY_LSHIFT) || KEY_STATE(KEY_RSHIFT))) {
152 Wireframe_view->rad += dy * RAD_SCALE;
153 if (Wireframe_view->rad < 0)
154 Wireframe_view->rad = 0;
155 EditorStatus("View radius = %.0f", Wireframe_view->rad);
156 Edview_changed = 1;
157 }
158 }
159}
160
161extern vector Mine_origin;
162

Callers 1

OnIdleMethod · 0.85

Calls 3

ddio_MouseGetStateFunction · 0.85
GetMouseRotationFunction · 0.85
EditorStatusFunction · 0.85

Tested by

no test coverage detected