defers control to the move manager
| 149 | |
| 150 | // defers control to the move manager |
| 151 | void ObjectMoveManager::Defer() { |
| 152 | // this code will call the object movement routines based off of the current mouse state and |
| 153 | // the current movement axis. |
| 154 | static POINT cur_pt; |
| 155 | |
| 156 | if (m_DragState == 1) { |
| 157 | int x, y, dsx, dsy; |
| 158 | float dx, dy; |
| 159 | |
| 160 | Object_moved = 0; |
| 161 | |
| 162 | if (ddio_MouseGetState(&x, &y, &dsx, &dsy) & MOUSE_LB) { |
| 163 | object *obj = &Objects[m_ObjNum]; |
| 164 | |
| 165 | if (!dsx && !dsy) |
| 166 | return; |
| 167 | |
| 168 | GetObjectDeltas(&dx, &dy, obj, dsx, dsy); |
| 169 | |
| 170 | switch (m_MoveAxis) { |
| 171 | case OBJMOVEAXIS_X: |
| 172 | HObjectMove(Cur_object_index, dx, 0, 0); |
| 173 | break; |
| 174 | |
| 175 | case OBJMOVEAXIS_Y: |
| 176 | HObjectMove(Cur_object_index, 0, -dy, 0); |
| 177 | break; |
| 178 | |
| 179 | case OBJMOVEAXIS_Z: |
| 180 | HObjectMove(Cur_object_index, 0, 0, dy); |
| 181 | break; |
| 182 | |
| 183 | case OBJMOVEAXIS_XY: |
| 184 | HObjectMove(Cur_object_index, dx, -dy, 0); |
| 185 | break; |
| 186 | |
| 187 | case OBJMOVEAXIS_P: |
| 188 | Object_move_rotation = fabs(-dy) * ROTATE_SCALE; |
| 189 | if (dy > 0) |
| 190 | HObjectIncreasePitch(); |
| 191 | else if (dy < 0) |
| 192 | HObjectDecreasePitch(); |
| 193 | break; |
| 194 | |
| 195 | case OBJMOVEAXIS_H: |
| 196 | Object_move_rotation = fabs(dx) * ROTATE_SCALE; |
| 197 | if (dx > 0) |
| 198 | HObjectIncreaseHeading(); |
| 199 | else if (dx < 0) |
| 200 | HObjectDecreaseheading(); |
| 201 | break; |
| 202 | |
| 203 | case OBJMOVEAXIS_B: |
| 204 | Object_move_rotation = fabs(dx) * ROTATE_SCALE; |
| 205 | if (dx > 0) |
| 206 | HObjectIncreaseBank(); |
| 207 | else if (dx < 0) |
| 208 | HObjectDecreaseBank(); |
no test coverage detected