/* ============== CZWnd::Z_MouseMoved ============== */ void CZWnd::Z_MouseMoved( int x, int y, int buttons ) { if ( !buttons ) { return; } if ( buttons == MK_LBUTTON ) { Drag_MouseMoved( x, y, buttons ); Sys_UpdateWindows( W_Z | W_CAMERA_ICON | W_XY ); return; } // rbutton = drag z origin if ( buttons == MK_RBUTTON ) { if ( !( GetAsyncKeyState( VK_MENU ) & 0x8000 ) ) { Sys_GetCursorPos( &x, &y ); if ( y != cursory ) { z.origin[2] += ( y - cursory ) / z.scale; // sikk - Added "/ z.scale" ::ShowCursor( FALSE ); Sys_SetCursorPos( cursorx, cursory ); Sys_UpdateWindows( W_Z ); } return; } } // ---> sikk - Mouse Zoom // rbutton + lbutton = zoom z view if ( buttons == ( MK_RBUTTON | MK_LBUTTON ) || ( buttons == MK_RBUTTON && ( GetAsyncKeyState( VK_MENU ) & 0x8000 ) ) ) { Sys_GetCursorPos( &x, &y ); if ( y != cursory ) { z.scale += ( y - cursory ) * z.scale * 0.00390625f; if ( z.scale > 64.0f ) { z.scale = 64.0f; } if ( z.scale < 0.003125f ) { z.scale = 0.003125f; } ::ShowCursor( FALSE ); Sys_SetCursorPos( cursorx, cursory ); Sys_UpdateWindows( W_Z ); } return; } // <--- sikk - Mouse Zoom // control mbutton = move camera int nMouseButton = g_PrefsDlg.m_nMouseButtons == 2 ? MK_RBUTTON : MK_MBUTTON; if ( ( buttons == ( MK_CONTROL | nMouseButton ) ) || ( buttons == ( MK_CONTROL | MK_LBUTTON ) ) ) { g_pParentWnd->GetCamera()->Camera().origin[2] = z.origin[2] + ( y - ( z.height / 2 ) ) / z.scale; Sys_UpdateWindows( W_CAMERA | W_XY_OVERLAY | W_Z ); } }
/* ============== Z_MouseMoved ============== */ void Z_MouseMoved( int x, int y, int buttons ){ if ( !buttons ) { return; } if ( buttons == MK_LBUTTON ) { Drag_MouseMoved( x, y, buttons ); Sys_UpdateWindows( W_Z | W_CAMERA_IFON | W_XY ); return; } // rbutton = drag z origin if ( buttons == MK_RBUTTON ) { Sys_GetCursorPos( &x, &y ); if ( y != cursory ) { z.origin[2] += y - cursory; Sys_SetCursorPos( cursorx, cursory ); Sys_UpdateWindows( W_Z ); } return; } // control mbutton = move camera int nMouseButton = g_PrefsDlg.m_nMouseButtons == 2 ? MK_RBUTTON : MK_MBUTTON; if ( ( buttons == ( MK_CONTROL | nMouseButton ) ) || ( buttons == ( MK_CONTROL | MK_LBUTTON ) ) ) { g_pParentWnd->GetCamWnd()->Camera()->origin[2] = ( y - ( z.height / 2 ) ) / z.scale; Sys_UpdateWindows( W_CAMERA | W_XY_OVERLAY | W_Z ); } }
/* ============== Z_MouseDown ============== */ void Z_MouseDown (int x, int y, int buttons) { vec3_t org, dir, vup, vright; brush_t *b; Sys_GetCursorPos (&cursorx, &cursory); vup[0] = 0; vup[1] = 0; vup[2] = 1/z.scale; VectorCopy (z.origin, org); org[2] += (y - (z.height/2))/z.scale; org[1] = g_MinWorldCoord; b = selected_brushes.next; if (b != &selected_brushes) { org[0] = (b->mins[0] + b->maxs[0])/2; } dir[0] = 0; dir[1] = 1; dir[2] = 0; vright[0] = 0; vright[1] = 0; vright[2] = 0; // LBUTTON = manipulate selection // shift-LBUTTON = select // middle button = grab texture // ctrl-middle button = set entire brush to texture // ctrl-shift-middle button = set single face to texture int nMouseButton = g_PrefsDlg.m_nMouseButtons == 2 ? MK_RBUTTON : MK_MBUTTON; if ( (buttons == MK_LBUTTON) || (buttons == (MK_LBUTTON | MK_SHIFT)) || (buttons == MK_MBUTTON) // || (buttons == (MK_MBUTTON|MK_CONTROL)) || (buttons == (nMouseButton|MK_SHIFT|MK_CONTROL)) ) { Drag_Begin (x, y, buttons, vright, vup, org, dir); return; } // control mbutton = move camera if ((buttons == (MK_CONTROL|nMouseButton) ) || (buttons == (MK_CONTROL|MK_LBUTTON))) { g_pParentWnd->GetCamWnd()->Camera()->origin[2] = org[2] ; Sys_UpdateWindows (W_CAMERA|W_XY_OVERLAY|W_Z); } }
void CCamWnd::Cam_PositionDrag() { int x, y; Sys_GetCursorPos (&x, &y); if (x != m_ptCursor.x || y != m_ptCursor.y) { x -= m_ptCursor.x; VectorMA (m_Camera.origin, x, m_Camera.vright, m_Camera.origin); y -= m_ptCursor.y; m_Camera.origin[2] -= y; SetCursorPos(m_ptCursor.x, m_ptCursor.y); Sys_UpdateWindows (W_CAMERA | W_XY_OVERLAY); } }
/* ============== Z_MouseDown ============== */ void Z_MouseDown (int x, int y, int buttons) { vec3_t org, dir, vup, vright; brush_t *b; Sys_GetCursorPos (&cursorx, &cursory); vup[0] = 0; vup[1] = 0; vup[2] = 1/z.scale; VectorCopy (z.origin, org); org[2] += (y - (z.height/2))/z.scale; org[1] = MIN_WORLD_COORD; b = selected_brushes.next; if (b != &selected_brushes) { org[0] = (b->mins[0] + b->maxs[0])/2; } dir[0] = 0; dir[1] = 1; dir[2] = 0; vright[0] = 0; vright[1] = 0; vright[2] = 0; // new mouse code for ZClip, I'll do this stuff before falling through into the standard ZWindow mouse code... // if (g_pParentWnd->GetZWnd()->m_pZClip) // should always be the case I think, but this is safer { bool bToggle = false; bool bSetTop = false; bool bSetBot = false; bool bReset = false; if (g_PrefsDlg.m_nMouseButtons == 2) { // 2 button mice... // bToggle = (GetKeyState(VK_F1) & 0x8000); bSetTop = (GetKeyState(VK_F2) & 0x8000); bSetBot = (GetKeyState(VK_F3) & 0x8000); bReset = (GetKeyState(VK_F4) & 0x8000); } else { // 3 button mice... // bToggle = (buttons == (MK_RBUTTON|MK_SHIFT|MK_CONTROL)); bSetTop = (buttons == (MK_RBUTTON|MK_SHIFT)); bSetBot = (buttons == (MK_RBUTTON|MK_CONTROL)); bReset = (GetKeyState(VK_F4) & 0x8000); } if (bToggle) { g_pParentWnd->GetZWnd()->m_pZClip->Enable(!(g_pParentWnd->GetZWnd()->m_pZClip->IsEnabled())); Sys_UpdateWindows (W_ALL); return; } if (bSetTop) { g_pParentWnd->GetZWnd()->m_pZClip->SetTop(org[2]); Sys_UpdateWindows (W_ALL); return; } if (bSetBot) { g_pParentWnd->GetZWnd()->m_pZClip->SetBottom(org[2]); Sys_UpdateWindows (W_ALL); return; } if (bReset) { g_pParentWnd->GetZWnd()->m_pZClip->Reset(); Sys_UpdateWindows (W_ALL); return; } } // LBUTTON = manipulate selection // shift-LBUTTON = select // middle button = grab texture // ctrl-middle button = set entire brush to texture // ctrl-shift-middle button = set single face to texture // // see code above for these next 3, I just commented them here as well for clarity... // // ctrl-shift-RIGHT button = toggle ZClip on/off // shift-RIGHT button = set ZClip top marker // ctrl-RIGHT button = set ZClip bottom marker int nMouseButton = g_PrefsDlg.m_nMouseButtons == 2 ? MK_RBUTTON : MK_MBUTTON; if ( (buttons == MK_LBUTTON) || (buttons == (MK_LBUTTON | MK_SHIFT)) || (buttons == MK_MBUTTON) // || (buttons == (MK_MBUTTON|MK_CONTROL)) || (buttons == (nMouseButton|MK_SHIFT|MK_CONTROL)) ) { Drag_Begin (x, y, buttons, vright, vup, org, dir); return; } // control mbutton = move camera if ((buttons == (MK_CONTROL|nMouseButton) ) || (buttons == (MK_CONTROL|MK_LBUTTON))) { g_pParentWnd->GetCamera()->Camera().origin[2] = org[2] ; Sys_UpdateWindows (W_CAMERA|W_XY_OVERLAY|W_Z); } }
/* ============== XY_MouseDown ============== */ void XY_MouseDown (int x, int y, int buttons) { vec3_t point; vec3_t origin, dir, right, up; buttonstate = buttons; pressx = x; pressy = y; VectorCopy (vec3_origin, pressdelta); XY_ToPoint (x, y, point); VectorCopy (point, origin); origin[2] = 8192; dir[0] = 0; dir[1] = 0; dir[2] = -1; right[0] = 1/g_qeglobals.d_xy.scale; right[1] = 0; right[2] = 0; up[0] = 0; up[1] = 1/g_qeglobals.d_xy.scale; up[2] = 0; press_selection = (selected_brushes.next != &selected_brushes); Sys_GetCursorPos (&cursorx, &cursory); // lbutton = manipulate selection // shift-LBUTTON = select if ( (buttons == MK_LBUTTON) || (buttons == (MK_LBUTTON | MK_SHIFT)) || (buttons == (MK_LBUTTON | MK_CONTROL)) || (buttons == (MK_LBUTTON | MK_CONTROL | MK_SHIFT)) ) { Drag_Begin (x, y, buttons, right, up, origin, dir); return; } // control mbutton = move camera if (buttonstate == (MK_CONTROL|MK_MBUTTON) ) { camera.origin[0] = point[0]; camera.origin[1] = point[1]; Sys_UpdateWindows (W_CAMERA|W_XY_OVERLAY); } // mbutton = angle camera if (buttonstate == MK_MBUTTON) { VectorSubtract (point, camera.origin, point); if (point[1] || point[0]) { camera.angles[YAW] = 180/Q_PI*atan2 (point[1], point[0]); Sys_UpdateWindows (W_CAMERA|W_XY_OVERLAY); } } // shift mbutton = move z checker if (buttonstate == (MK_SHIFT|MK_MBUTTON) ) { XY_ToPoint (x, y, point); z.origin[0] = point[0]; z.origin[1] = point[1]; Sys_UpdateWindows (W_XY_OVERLAY|W_Z); return; } }
/* ============== XY_MouseMoved ============== */ void XY_MouseMoved (int x, int y, int buttons) { vec3_t point; if (!buttonstate) return; // lbutton without selection = drag new brush if (buttonstate == MK_LBUTTON && !press_selection) { NewBrushDrag (x, y); return; } // lbutton (possibly with control and or shift) // with selection = drag selection if (buttonstate & MK_LBUTTON) { Drag_MouseMoved (x, y, buttons); Sys_UpdateWindows (W_XY_OVERLAY | W_CAMERA); return; } // control mbutton = move camera if (buttonstate == (MK_CONTROL|MK_MBUTTON) ) { XY_ToPoint (x, y, point); camera.origin[0] = point[0]; camera.origin[1] = point[1]; Sys_UpdateWindows (W_XY_OVERLAY | W_CAMERA); return; } // shift mbutton = move z checker if (buttonstate == (MK_SHIFT|MK_MBUTTON) ) { XY_ToPoint (x, y, point); z.origin[0] = point[0]; z.origin[1] = point[1]; Sys_UpdateWindows (W_XY_OVERLAY|W_Z); return; } // mbutton = angle camera if (buttonstate == MK_MBUTTON ) { XY_ToPoint (x, y, point); VectorSubtract (point, camera.origin, point); if (point[1] || point[0]) { camera.angles[YAW] = 180/Q_PI*atan2 (point[1], point[0]); Sys_UpdateWindows (W_XY_OVERLAY | W_CAMERA); } return; } // rbutton = drag xy origin if (buttonstate == MK_RBUTTON) { Sys_GetCursorPos (&x, &y); if (x != cursorx || y != cursory) { g_qeglobals.d_xy.origin[0] -= (x-cursorx)/g_qeglobals.d_xy.scale; g_qeglobals.d_xy.origin[1] += (y-cursory)/g_qeglobals.d_xy.scale; Sys_SetCursorPos (cursorx, cursory); Sys_UpdateWindows (W_XY | W_XY_OVERLAY); } return; } }