[Quest-ed-checkins] CVS: quest-3b/src/cmd snap.c,1.1.1.1,1.2
Brought to you by:
alexm
|
From: Alexander M. <al...@us...> - 2002-05-18 01:34:53
|
Update of /cvsroot/quest-ed/quest-3b/src/cmd
In directory usw-pr-cvs1:/tmp/cvs-serv11954/src/cmd
Modified Files:
snap.c
Log Message:
Add edit.snap back in again.
Index: snap.c
===================================================================
RCS file: /cvsroot/quest-ed/quest-3b/src/cmd/snap.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** snap.c 11 Aug 2001 16:08:30 -0000 1.1.1.1
--- snap.c 18 May 2002 01:34:48 -0000 1.2
***************
*** 7,11 ****
#include "types.h"
! #include "cmds.h"
#include "brush.h"
--- 7,11 ----
#include "types.h"
! #include "qfunc.h"
#include "brush.h"
***************
*** 14,19 ****
#include "map.h"
#include "quest.h"
- #include "s_message.h"
#include "undo.h"
--- 14,19 ----
#include "map.h"
#include "quest.h"
#include "undo.h"
+ #include "fe/message.h"
***************
*** 24,99 ****
static void C_snap(void)
{
! if (!M.sel.bsel && !M.sel.esel)
! {
! S_NewMessage("edit.snap: Nothing selected!");
! return;
! }
!
! if (M.sel.vsel)
! {
! vsel_t *vs;
!
! for (vs=M.sel.vsel;vs;vs=vs->Next)
! {
! U_BrushModify(vs->Brush);
! SnapVecToGrid(&vs->Brush->verts[vs->num]);
! }
! }
! else
! {
! vec3_t old,delta;
! bsel_t *bs;
! brush_t *b;
! int i;
!
! for (bs=M.sel.bsel;bs;bs=bs->Next)
! {
! b=bs->Brush;
! if (!b->num_verts) continue;
! U_BrushModify(b);
!
! old=b->verts[0];
! SnapVecToGrid(&b->verts[0]);
! VEC_Sub(delta,b->verts[0],old);
! for (i=1;i<b->num_verts;i++)
! {
! VEC_Add(b->verts[i],b->verts[i],delta);
! SnapVecToGrid(&b->verts[i]);
! }
! }
! }
!
! {
! esel_t *es;
! vec3_t origin;
! const char *c;
! char buf[128];
!
! for (es=M.sel.esel;es;es=es->Next)
! {
! if (!(c=GetKeyValue(es->Entity,"origin"))) continue;
! origin.x=origin.y=origin.z=0;
! sscanf(c,"%f %f %f",&origin.x,&origin.y,&origin.z);
! SnapVecToGrid(&origin);
! sprintf(buf,"%i %i %i",(int)origin.x,(int)origin.y,(int)origin.z);
! U_EntityModify(es->Entity);
! SetKeyValue(es->Entity,"origin",buf);
! }
! }
!
! Cmd_SetRedraw(2);
}
! static cmd_reg_t cmds[]={
! {"edit.snap",C_snap,{"Edit/Snap to grid","control+n"},{},"Snap the selected brushes and entities to the grid."}
};
#include "plugin.h"
PLUGIN_HEAD
static plugin_t plugin=
! {{Init},{"basic/edit/snap","Commands to snap objects to the grid."}};
! PLUGIN_FOOT_CMDS
--- 24,100 ----
static void C_snap(void)
{
! if (!M.sel.bsel && !M.sel.esel)
! {
! S_NewMessage("edit.snap: Nothing selected!");
! return;
! }
!
! if (M.sel.vsel)
! {
! vsel_t *vs;
!
! for (vs=M.sel.vsel;vs;vs=vs->Next)
! {
! U_BrushModify(vs->Brush);
! SnapVecToGrid(&vs->Brush->verts[vs->num]);
! }
! }
! else
! {
! vec3_t old,delta;
! bsel_t *bs;
! brush_t *b;
! int i;
!
! for (bs=M.sel.bsel;bs;bs=bs->Next)
! {
! b=bs->Brush;
! if (!b->num_verts) continue;
! U_BrushModify(b);
!
! old=b->verts[0];
! SnapVecToGrid(&b->verts[0]);
! VEC_Sub(delta,b->verts[0],old);
! for (i=1;i<b->num_verts;i++)
! {
! VEC_Add(b->verts[i],b->verts[i],delta);
! SnapVecToGrid(&b->verts[i]);
! }
! }
! }
!
! {
! esel_t *es;
! vec3_t origin;
! const char *c;
! char buf[128];
!
! for (es=M.sel.esel;es;es=es->Next)
! {
! if (!(c=GetKeyValue(es->Entity,"origin"))) continue;
! origin.x=origin.y=origin.z=0;
! sscanf(c,"%f %f %f",&origin.x,&origin.y,&origin.z);
! SnapVecToGrid(&origin);
! sprintf(buf,"%i %i %i",(int)origin.x,(int)origin.y,(int)origin.z);
! U_EntityModify(es->Entity);
! SetKeyValue(es->Entity,"origin",buf);
! }
! }
}
! static func_t F_edit_snap=
! {"edit.snap",FUNC_VOID,{fv:C_snap},NULL,NULL,0,
! {"Snap the selected brushes and entities to the grid."}
};
+ static func_t *funcs[]={&F_edit_snap};
+
#include "plugin.h"
PLUGIN_HEAD
static plugin_t plugin=
! {{Init},{"edit.snap","Commands to snap objects to the grid."}};
! PLUGIN_FOOT_FUNCS
|