diff options
Diffstat (limited to 'editvar.c')
-rw-r--r-- | editvar.c | 396 |
1 files changed, 396 insertions, 0 deletions
diff --git a/editvar.c b/editvar.c new file mode 100644 index 0000000..2734f4d --- /dev/null +++ b/editvar.c @@ -0,0 +1,396 @@ +/* + + viDOOM - level editor for DOOM + + Copyright (C) 2000 Ian Cowburn (ianc@noddybox.demon.co.uk) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + ------------------------------------------------------------------------- + + Editor global varaiable definitions + + Note that the lindefs, vertices, etc here are copied from the WadMap + loaded prior to editting. They are then reconverted back to the WadMap + for saving. + + +*/ +static const char rcs_id[]="$Id$"; + +#include "config.h" +#include "globals.h" + +#include "editvar.h" + + +/* ---------------------------------------- EDIT TYPES +*/ + +char *edit_str[]={"Sector","Linedef","Vertex","Thing","Multimode"}; + + +/* ---------------------------------------- EDIT VARS +*/ + +void HandleMoveKey(GFXKey k,int check_mouse); + +int edit_mode=SECTOR_MODE; + +Map vertex=NULL; +Map linedef=NULL; +Map sidedef=NULL; +Map sector=NULL; +Map thing=NULL; +Map multimap=NULL; + +int SCRW; +int SCRH; +int FH; + +int scale=5; +int ox; +int oy; + +GFXMouse ms; + +int quit; + +int agrid; + +int current=-1; +List selected=NULL; + +/* This variable should be set to try by any actions in the generic object + routines that have generated a new selection list. +*/ +int new_selection=FALSE; + +Thing ed_thing={0,0,0,1,0x07}; + +/* This variable stops the DrawObjectInfo() routine being called on redraws +*/ +int draw_current_info=TRUE; + +/* ---------------------------------------- USED AS GENERIC FUNCTIONS AND VALUES +*/ + +/* Data in all these functions is the Object.data pointer +*/ +int (*PositionOnObject)(int x, int y, void *data); +void (*SelectBox)(int x1, int y1, int x2, int y2); +void (*SelectByType)(void); +void (*DrawObject)(void *data, int selmode); +void (*DrawObjectInfo)(void); +void (*DrawObjectHeader)(void); +void (*MoveObject)(void); +void (*RotateObject)(double angle); +void (*ScaleObject)(double scale); +void (*SetTagObject)(int tag); +void (*LocateObject)(void *obj); +void (*ObjectMenu)(void); +void (*ObjectInsert)(void); +void (*ObjectDelete)(void); +void (*ObjectKey)(GFXKey k); +int (*ObjectHasTag)(void *obj, int tag); +void (*SetSelect)(int i, int mode); +ObjDesc *(*ObjectOverlaid)(int x,int y,int *no); + +char *typename; +Map map; + + +/* ---------------------------------------- MENUS AND DIALOGS +*/ +PLAT_MENU thing_popup[]={ + {"Change type",TM_TYPE}, + {"Change angle",TM_ANGLE}, + {"Change flags",TM_FLAGS}, + {"Snap selected things",TM_SNAP}, + {"Move",TM_MOVE}, + {"Delete",TM_DELETE}, + {NULL,GUI_CANCEL} + }; + +PLAT_RADIO thing_angle[]={ + {"N",90}, + {"NE",45}, + {"E",0}, + {"SE",315}, + {"S",270}, + {"SW",225}, + {"W",180}, + {"NW",135}, + {NULL,GUI_CANCEL} + }; + +PLAT_MENU vertex_popup[]={ + {"Chain selected vertices",TM_CHAIN}, + {"Chain selected vertices " + "into a sector",TM_CHAIN_SECTOR}, + {"Merge selected vertices",TM_MERGE}, + {"Snap selected vertices",TM_SNAP}, + {"Move",TM_MOVE}, + {"Delete",TM_DELETE}, + {NULL,GUI_CANCEL} + }; + +PLAT_MENU right_popup[]= + { + {"Change upper texture",TM_UPPER_T_R}, + {"Change middle texture",TM_MIDDLE_T_R}, + {"Change lower texture",TM_LOWER_T_R}, + {"Change texture offset",TM_OFFSET_R}, + {"Adjust texture offset",TM_ADJUST_R}, + {"Change sector",TM_SECTOR_R}, + {"Align textures",TM_ALIGN_R}, + + {NULL,GUI_CANCEL} + }; + +PLAT_MENU left_popup[]= + { + {"Change upper texture",TM_UPPER_T_L}, + {"Change middle texture",TM_MIDDLE_T_L}, + {"Change lower texture",TM_LOWER_T_L}, + {"Change texture offset",TM_OFFSET_L}, + {"Adjust texture offset",TM_ADJUST_L}, + {"Change sector",TM_SECTOR_L}, + {"Align textures",TM_ALIGN_L}, + + {NULL,GUI_CANCEL} + }; + +PLAT_MENU linedef_popup[]= + { + {"Change linedef flags",TM_FLAGS}, + {"Change linedef type",TM_TYPE}, + {"Swap sides",TM_SWAP_SIDES}, + {"Split line",TM_SPLIT_LINE}, + {"Select trail from this linedef",TM_TRACK_LINE}, + {"Join linedefs with steps",TM_STEPS}, + + {"Right sidedef =>",TM_RIGHT_SIDE}, + {"Left sidedef =>",TM_LEFT_SIDE}, + + {"Change tag",TM_TAG}, + {"Move",TM_MOVE}, + {"Delete",TM_DELETE}, + {NULL,GUI_CANCEL} + }; + +PLAT_MENU sector_popup[]= + { + {"Change floor height",TM_FLOOR}, + {"Change ceiling height",TM_CEILING}, + {"Change light level",TM_LIGHT}, + {"Change tag",TM_TAG}, + {"Change floor",TM_FLOOR_T}, + {"Change ceiling",TM_CEILING_T}, + {"Change type",TM_TYPE}, + {"Paint sector in style",TM_STYLE}, + + {"Move",TM_MOVE}, + {"Delete",TM_DELETE}, + {NULL,GUI_CANCEL} + }; + +PLAT_MENU multi_popup[]= + { + {"Move",TM_MOVE}, + {"Rotate",TM_ROTATE}, + {"Scale",TM_SCALE}, + {NULL,GUI_CANCEL} + }; + + +PLAT_DIALOG offset_dialog[D_OFFSET_NO]= + { + {"X-offset",PLAT_DIAL_INTEGER,{0}}, + {"Y-offset",PLAT_DIAL_INTEGER,{0}} + }; + +PLAT_DIALOG sectorn_dialog[D_OFFSET_NO]= + { + {"Sector no",PLAT_DIAL_INTEGER,{0}}, + }; + +PLAT_DIALOG coord_dialog[D_COORD_NO]= + { + {"X",PLAT_DIAL_INTEGER,{0}}, + {"Y",PLAT_DIAL_INTEGER,{0}} + }; + +PLAT_DIALOG vertex_dialog[D_VERTEX_NO]= + { + {"Vertex from",PLAT_DIAL_INTEGER,{0}}, + {"Vertex to",PLAT_DIAL_INTEGER,{0}} + }; + +PLAT_DIALOG sector_fl_dialog[D_SECTOR_FL_NO]= + { + {"Floor height",PLAT_DIAL_INTEGER,{0}}, + }; + +PLAT_DIALOG sector_ce_dialog[D_SECTOR_CE_NO]= + { + {"Ceiling height",PLAT_DIAL_INTEGER,{0}}, + }; + +PLAT_DIALOG sector_li_dialog[D_SECTOR_LI_NO]= + { + {"Light level",PLAT_DIAL_INTEGER,{0}}, + }; + +PLAT_DIALOG sector_val_dialog[D_SECTOR_VAL_NO]= + { + {"Light level",PLAT_DIAL_INTEGER,{0}}, + {"Floor height",PLAT_DIAL_INTEGER,{0}}, + {"Ceiling height",PLAT_DIAL_INTEGER,{0}}, + }; + +PLAT_DIALOG tag_dialog[D_TAG_NO]= + { + {"Tag",PLAT_DIAL_INTEGER,{0}}, + }; + +PLAT_DIALOG scale_dialog[D_SCALE_NO]= + { + {"Scale",PLAT_DIAL_DOUBLE,{0}}, + }; + +PLAT_DIALOG rotate_dialog[D_ROTATE_NO]= + { + {"Angle",PLAT_DIAL_DOUBLE,{0}}, + }; + +PLAT_DIALOG objno_dialog[D_OBJNO_NO]= + { + {"Object number",PLAT_DIAL_INTEGER,{0}}, + }; + +PLAT_DIALOG nosides_dialog[D_NOSIDES_NO]= + { + {"Number of sides",PLAT_DIAL_INTEGER,{0}}, + }; + + +/* ---------------------------------------- DRAWING TABLES +*/ +Point t_arrow[8]={{1,0}, + {1,1}, + {0,1}, + {-1,1}, + {-1,0}, + {-1,-1}, + {0,-1}, + {1,-1}}; + +char *angle_str[8]={"E","NE","N","NW","W","SW","S","SE"}; + + +/* ---------------------------------------- HELP PAGES +*/ +char *general_help_keys[]= + { + "F1 - general help |" + "F2 - edit mode help |" + "Escape - finish editting |" + "Cursor keys - move |" + "Shift + Cursor keys - move quickly |" + "Ctrl + Cursor keys - move by one scale position |" + "Page down/up - zoom in/out |" + "Q/W - decrease/increase grid scale |" + "G - grid lines on/off |" + "X - grid snap on/off |" + "Tab/Shift + Tab - next/previous edit mode |" + "V - VERTEX edit mode |" + "L - LINEDEF edit mode |" + "S - SECTOR edit mode |" + "T - THING edit mode |" + "C - MULTI edit mode |" + "F9 - deselect all |" + "Shift + F9 - invert selection |" + "F10 - select all |" + "Shift + F10 - select by type (if applicable) |" + "Ctrl + F10 - select one from a number of |" + " overlaid objects |" + "Alt + F10 - additionally select one |" + " overlaid object |" + "F11/Shift + F11 - locate next/previous selection ", + + "DELETE - delete selected objects |" + "INSERT - insert new object |" + "F3 - merge a PWAD map |" + "F4 - move selected objects |" + "F5 - rotate selected objects |" + "[ - rotate 5 degrees left |" + "] - rotate 5 degrees right |" + "F6 - scale selected objects |" + "{ - scale by 90% |" + "} - scale by 110% |" + "F7 - set tag (if applicable) |" + "Shift + F7 - select objects with tag |" + "F8 - locate an object number |" + "Shift + F8 - locate and select object number|" + "R - redraw [useful if selected |" + " sectors look unselected] |" + " |" + "Note: Grid lock not honoured on rotate or scale ", + + NULL + }; + +char *general_help_mouse= + "Left button - select object |" + "Ctrl + Left button - additionally select object |" + "Shift + Left button - select objects in box |" + "Ctrl + Shift + Left button - additionally select objects in box|" + "Right button - pop-up object menu |" + "Middle button - move selected objects "; + +char *mode_help[]= + { + /* SECTOR + */ + "M - change sector move mode |" + "H - toggle SECTOR tag highligting|" + ", - decrease sector floor by 8 |" + ". - increase sector floor by 8 |" + "< - decrease sector ceiling by 8 |" + "> - increase sector ceiling by 8 |" + "- - decrease lighting level by 16|" + "+ - increase lighting level by 16", + + /* LINEDEF + */ + "H - toggle LINEDEF tag highligting |" + "F12 - perform checks for LINEDEF textures", + + /* VERTEX + */ + "F12 - remove vertices to bound to linedefs", + + /* THING + */ + "No additional key functions", + + /* MULTI + */ + "No additional key functions" + }; + + +/* END OF FILE */ |