/* =========== Map_RegionTallBrush =========== */ void Map_RegionTallBrush( void ){ brush_t *b; if ( !QE_SingleBrush() ) { return; } b = selected_brushes.next; Map_RegionOff(); VectorCopy( b->mins, region_mins ); VectorCopy( b->maxs, region_maxs ); region_mins[2] = g_MinWorldCoord + 64; region_maxs[2] = g_MaxWorldCoord - 64; Undo_Start( "delete" ); Undo_AddBrushList( &selected_brushes ); Undo_AddEntity( b->owner ); Select_Delete(); Undo_EndBrushList( &selected_brushes ); Undo_End(); Map_ApplyRegion(); }
/* ================ Draw_Setup ================ */ static void Drag_Setup( int x, int y, int buttons, const idVec3 &xaxis, const idVec3 &yaxis, const idVec3 &origin, const idVec3 &dir ) { qertrace_t t; face_t *f; drag_first = true; VectorCopy(vec3_origin, pressdelta); pressx = x; pressy = y; VectorCopy(xaxis, drag_xvec); AxializeVector(drag_xvec); VectorCopy(yaxis, drag_yvec); AxializeVector(drag_yvec); if (g_qeglobals.d_select_mode == sel_addpoint) { if (g_qeglobals.selectObject) { g_qeglobals.selectObject->addPoint(origin); } else { g_qeglobals.d_select_mode = sel_brush; } return; } if (g_qeglobals.d_select_mode == sel_editpoint) { g_Inspectors->entityDlg.SelectCurvePointByRay( origin, dir, buttons ); if ( g_qeglobals.d_num_move_points ) { drag_ok = true; } Sys_UpdateWindows(W_ALL); return; } if (g_qeglobals.d_select_mode == sel_curvepoint) { SelectCurvePointByRay(origin, dir, buttons); if (g_qeglobals.d_num_move_points || g_qeglobals.d_select_mode == sel_area) { drag_ok = true; } Sys_UpdateWindows(W_ALL); Undo_Start("drag curve point"); Undo_AddBrushList(&selected_brushes); return; } else { g_qeglobals.d_num_move_points = 0; } if (selected_brushes.next == &selected_brushes) { // // in this case a new brush is created when the dragging takes place in the XYWnd, // An useless undo is created when the dragging takes place in the CamWnd // Undo_Start("create brush"); Sys_Status("No selection to drag\n", 0); return; } if (g_qeglobals.d_select_mode == sel_vertex) { if ( radiant_entityMode.GetBool() ) { return; } SelectVertexByRay(origin, dir); if (g_qeglobals.d_num_move_points) { drag_ok = true; Undo_Start("drag vertex"); Undo_AddBrushList(&selected_brushes); return; } } if (g_qeglobals.d_select_mode == sel_edge) { if ( radiant_entityMode.GetBool() ) { return; } SelectEdgeByRay(origin, dir); if (g_qeglobals.d_num_move_points) { drag_ok = true; Undo_Start("drag edge"); Undo_AddBrushList(&selected_brushes); return; } } // check for direct hit first t = Test_Ray(origin, dir, true); SetActiveDrag(t.point); if (t.point) { drag_ok = true; // point was hit return; } if (t.selected) { drag_ok = true; Undo_Start("drag selection"); Undo_AddBrushList(&selected_brushes); if (buttons == (MK_LBUTTON | MK_CONTROL)) { Sys_Status("Shear dragging face\n"); Brush_SelectFaceForDragging(t.brush, t.face, true); } else if (buttons == (MK_LBUTTON | MK_CONTROL | MK_SHIFT)) { Sys_Status("Sticky dragging brush\n"); for (f = t.brush->brush_faces; f; f = f->next) { Brush_SelectFaceForDragging(t.brush, f, false); } } else { Sys_Status("Dragging entire selection\n"); } return; } if (g_qeglobals.d_select_mode == sel_vertex || g_qeglobals.d_select_mode == sel_edge) { return; } if ( radiant_entityMode.GetBool() ) { return; } // check for side hit multiple brushes selected? if (selected_brushes.next->next != &selected_brushes) { // yes, special handling bool bOK = ( g_PrefsDlg.m_bALTEdge ) ? ( ::GetAsyncKeyState( VK_MENU ) != 0 ) : true; if (bOK) { for (brush_t * pBrush = selected_brushes.next; pBrush != &selected_brushes; pBrush = pBrush->next) { if (buttons & MK_CONTROL) { Brush_SideSelect(pBrush, origin, dir, true); } else { Brush_SideSelect(pBrush, origin, dir, false); } } } else { Sys_Status("press ALT to drag multiple edges\n"); return; } } else { // single select.. trying to drag fixed entities handle themselves and just move if (buttons & MK_CONTROL) { Brush_SideSelect(selected_brushes.next, origin, dir, true); } else { Brush_SideSelect(selected_brushes.next, origin, dir, false); } } Sys_Status("Side stretch\n"); drag_ok = true; Undo_Start("side stretch"); Undo_AddBrushList(&selected_brushes); }
void SI_SetTexdef_FaceList(texdef_to_face_t* texdef_face_list, bool b_SetUndoPoint, bool bFit_to_Scale) { texdef_to_face_t* texdef_to_face; bool b_isQuake2; if (g_pGameDescription->quake2) b_isQuake2 = true; else b_isQuake2 = false; if (!texdef_face_list) return; if (b_SetUndoPoint) { if(g_ptrSelectedFaces.GetSize() > 1) Sys_FPrintf(SYS_WRN, "WARNING: Undo NOT supported for multiple face selections\n"); else if( (selected_brushes.next != &selected_brushes) || (g_ptrSelectedFaces.GetSize() == 1)) { // Give something to undo to for(texdef_to_face = texdef_face_list; texdef_to_face; texdef_to_face = texdef_to_face->next) if (b_isQuake2) SetFaceTexdef_Q2(texdef_to_face->face, &texdef_to_face->orig_texdef, bFit_to_Scale); else SetFaceTexdef(texdef_to_face->face, &texdef_to_face->orig_texdef, &texdef_to_face->orig_bp_texdef, bFit_to_Scale); Undo_Start("set facelist texdefs"); if( selected_brushes.next != &selected_brushes ) Undo_AddBrushList(&selected_brushes); else Undo_AddBrush(texdef_face_list->brush); } } for(texdef_to_face = texdef_face_list; texdef_to_face; texdef_to_face = texdef_to_face->next) { if (b_isQuake2) SetFaceTexdef_Q2(texdef_to_face->face, &texdef_to_face->texdef, bFit_to_Scale); else { brushprimit_texdef_t brushprimit_texdef; FakeTexCoordsToTexMat(texdef_to_face->texdef.shift, texdef_to_face->texdef.rotate, texdef_to_face->texdef.scale, brushprimit_texdef.coords); SetFaceTexdef(texdef_to_face->face, &texdef_to_face->texdef, &brushprimit_texdef , bFit_to_Scale); } Brush_Build(texdef_to_face->brush); if(bFit_to_Scale) texdef_to_face->texdef = texdef_to_face->face->texdef; } if ( b_SetUndoPoint ) { if( (selected_brushes.next != &selected_brushes) || (g_ptrSelectedFaces.GetSize() == 1) ) { if(selected_brushes.next != &selected_brushes) Undo_EndBrushList(&selected_brushes); else Undo_EndBrush(texdef_face_list->brush); Undo_End(); // Over-write the orig_texdef list, cementing the change. for(texdef_to_face = texdef_face_list; texdef_to_face; texdef_to_face = texdef_to_face->next) { texdef_to_face->orig_texdef = texdef_to_face->texdef; texdef_to_face->orig_bp_texdef = texdef_to_face->face->brushprimit_texdef; } } } Sys_UpdateWindows (W_ALL); }
// if (GetKeyState(VK_MENU) & 0x8000) // ALT void Drag_Setup (int x, int y, int buttons, vec3_t xaxis, vec3_t yaxis, vec3_t origin, vec3_t dir) { trace_t t; face_t *f; drag_first = true; VectorCopy (vec3_origin, pressdelta); pressx = x; pressy = y; VectorCopy (xaxis, drag_xvec); AxializeVector (drag_xvec); VectorCopy (yaxis, drag_yvec); AxializeVector (drag_yvec); //Sys_Printf ("Enter Drag_Setup()\n"); extern void SelectCurvePointByRay (vec3_t org, vec3_t dir, int buttons); if (g_qeglobals.d_select_mode == sel_curvepoint) { //if ((buttons == MK_LBUTTON)) // g_qeglobals.d_num_move_points = 0; SelectCurvePointByRay (origin, dir, buttons); if (g_qeglobals.d_num_move_points || g_qeglobals.d_select_mode == sel_area) { drag_ok = true; } Sys_UpdateWindows(W_ALL); Undo_Start("drag curve point"); Undo_AddBrushList(&selected_brushes); return; } else { g_qeglobals.d_num_move_points = 0; } if (selected_brushes.next == &selected_brushes) { //in this case a new brush is created when the dragging //takes place in the XYWnd, An useless undo is created //when the dragging takes place in the CamWnd Undo_Start("create brush"); Sys_Status("No selection to drag\n", 0); return; } if (g_qeglobals.d_select_mode == sel_vertex) { SelectVertexByRay (origin, dir); if (g_qeglobals.d_num_move_points) { drag_ok = true; Undo_Start("drag vertex"); Undo_AddBrushList(&selected_brushes); return; } } if (g_qeglobals.d_select_mode == sel_edge) { SelectEdgeByRay (origin, dir); if (g_qeglobals.d_num_move_points) { drag_ok = true; Undo_Start("drag edge"); Undo_AddBrushList(&selected_brushes); return; } } //Sys_Printf ("Beyond Component modifying\n"); // // check for direct hit first // t = Test_Ray (origin, dir, true); if (t.selected) { drag_ok = true; Undo_Start("drag selection"); Undo_AddBrushList(&selected_brushes); if (buttons == (MK_LBUTTON|MK_CONTROL) ) { Sys_Printf ("Shear dragging face\n"); Brush_SelectFaceForDragging (t.brush, t.face, true); } else if (buttons == (MK_LBUTTON|MK_CONTROL|MK_SHIFT) ) { Sys_Printf ("Sticky dragging brush\n"); for (f=t.brush->brush_faces ; f ; f=f->next) Brush_SelectFaceForDragging (t.brush, f, false); } else Sys_Printf ("Dragging entire selection\n"); return; } if (g_qeglobals.d_select_mode == sel_vertex || g_qeglobals.d_select_mode == sel_edge) return; // // check for side hit // // multiple brushes selected? if (selected_brushes.next->next != &selected_brushes) { // yes, special handling bool bOK = (g_PrefsDlg.m_bALTEdge) ? (static_cast<bool>(::GetAsyncKeyState(VK_MENU))) : true; if (bOK) { //Sys_Printf ("ALT Down\n"); for (brush_t* pBrush = selected_brushes.next ; pBrush != &selected_brushes ; pBrush = pBrush->next) { //Sys_Printf ("ALT Down 2\n"); if (buttons & MK_CONTROL) Brush_SideSelect (pBrush, origin, dir, true); else Brush_SideSelect (pBrush, origin, dir, false); } } else { Sys_Printf ("press ALT to drag multiple edges\n"); return; } } else { //Sys_Printf ("Unknown\n"); // single select.. trying to drag fixed entities handle themselves and just move if (buttons & MK_CONTROL) Brush_SideSelect (selected_brushes.next, origin, dir, true); else Brush_SideSelect (selected_brushes.next, origin, dir, false); } Sys_Printf ("Side stretch\n"); drag_ok = true; Undo_Start("side stretch"); Undo_AddBrushList(&selected_brushes); }