bsp
map.h
00001 #ifndef _MAP_H_
00002 #define _MAP_H_
00003 
00004 #define MODE_REGIONED 0
00005 #define MODE_SELECTED 1
00006 
00007 class Entity;
00008 class Group;
00009 class Clipper;
00010 class SetBrush;
00011 class texInfo_t;
00012 class texWad;
00013 class map;
00014 
00015 struct mouseobject_t
00016 {
00017     SetBrush *Brush;
00018     Entity   *Entity;
00019     bool CenterKnob;
00020     bool Vertex;
00021     //bool VertexSel;
00022     bool Selected;
00023     bool Nothing;
00024     bool Camera;
00025     bool Clipper;
00026 };
00027 
00028 // for SaveForUndo
00029 #define UNDO_BRUSHES 0
00030 #define UNDO_RENBRUSH 1
00031 #define UNDO_GROUPS 2
00032 #define UNDO_NOUNDO 3
00033 #define UNDO_FORCEWHOLE 4
00034 
00035 // For Undo structure...
00036 #define UNDO_WHOLEMAP 0
00037 #define UNDO_SINGLEBRUSH 1
00038 #define UNDO_GROUP 2
00039 #define UNDO_MULTIBRUSH 3
00040 
00041 //snapping modes
00042 #define SNAP_SELF   0   //snap axial planes only
00043 #define SNAP_PLANES 1   //snap each plane point to grid
00044 
00045 typedef struct undo_s
00046 {
00047     char description[64];
00048     int undoType;
00049     map *undoMap;
00050 
00051     Entity *singleBrush;  // copy the entity stuff, and then copy only the sole brush
00052     // on undo:
00053     // check to see if the entity is still there, if so
00054     // remove the "original" brush and replace the ptr with
00055     // this brush...
00056     // delete the original brush
00057     // if the entity was deleted, too, then add the entire
00058     // singlebrush into the map
00059 
00060     Entity **multiBrush;  // similar to single, but many copies
00061     int numMultiBrush;
00062     Group *undoGroup;
00063 
00064 } undo_t;
00065 
00066 typedef struct angles_s
00067 {
00068     float roll;
00069     float pitch;
00070     float yaw;
00071 } t_Angles;
00072 
00073 class Entity;
00074 
00075 class map
00076 {
00077 public:
00078     int count;
00079     int dirty;
00080     char filename[256];
00081     Entity *world; // save a pointer to the world entity...
00082     Entity *current;
00083     Entity *oldselection;
00084     vec3_t minz, maxz;
00085     Entity objects;
00086     Group *groups;
00087     vec3_t eye[MAX_CAMERAS];  // current position...
00088     int cureye;
00089     t_Angles angles[MAX_CAMERAS];
00090 
00091     bool regionSet;
00092     SetBrush *regionBrush;
00093 
00094     // texture stuff
00095     texInfo_t **bests;     // an array of the bests
00096     texInfo_t **favorites; // an array of favorites...
00097 
00098     char **favs;
00099     int numf;   // number in array
00100 
00101     texInfo_t **mapTextures;
00102     int numMapTextures;
00103     texWad **Wads;
00104     int numWads;
00105     char texName[64];
00106     char texPath[64];
00107 
00108     //
00109     Clipper *clipper_i;
00110     int curclippoint;
00111 
00112     unsigned char *dat;
00113 
00114     int mapType;
00115 
00116     undo_t *undo;
00117 
00118     map();
00119     ~map();
00120     void cleanUpInvalidObjects();
00121     void saveForUndo(char * /*saveStr*/, int);
00122     void Undo(map *old, map **newm);
00123     void undoGetRest(map *cm);
00124     map *undoCopy();
00125     void RemoveUndo();
00126 
00127     bool lookForObject(Entity *e);
00128     void MoveEyePosition(vec3_t newpos, int lockValue);
00129     void copySelection(map **, bool rebuild);
00130     void pasteSelection();
00131 
00132     void GatherTextureDirectories();
00133 
00134     void GlobalSetKey(char *, char *);
00135     SetBrush *selectedBrush();
00136     int numSelected();
00137     int numSelectedTotal();
00138     int numBrushes();
00139     void newMap();
00140     void snapSelected(int mode);
00141     void getCenter(vec3_t ctr);
00142     void getSelectedCenter();
00143     void makeSelectedPerform(int sel);
00144     void makeSelectedXYDraw(HDC hdc,int index,int stopAt, Group *g);
00145     void makeUnselectedPerform(int sel);
00146     void makeGlobalPerform(int sel);
00147     void makeAllPerform(int sel);
00148     void removeObject(Entity *);
00149     Entity *currentEntity();
00150     void setCurrentEntity(Entity *);
00151     void setCurrentMinZ(vec3_t);
00152     void setCurrentMaxZ(vec3_t);
00153     vec_t currentMinZ(int);
00154     vec_t currentMaxZ(int);
00155     bool readMapFile(char *fname);
00156     void mergeMapFile(char *fname);
00157     void writeMapFile(char *fname, int writeWorldKeys,int selOnly);
00158     void writeBox(FILE *f, char *walls, char *sky, char *floor);
00159     void writeSelected(FILE *f, Entity *e);
00160     Entity *findPlayerStart();
00161     Entity *findWorldSpawn();
00162     void DoExport(char *goodname, char *runname, char *title);
00163 
00164     int getVisibility(Entity *e, int inBox, int mode);
00165     void groupExportWrite(FILE *f, Entity *e, int func);
00166     void groupExport(int func);
00167 
00168     void groupSwap(int g1, int g2);
00169     void groupInsert(int pos);
00170 
00171     void selectedExport();
00172     void regionExport();
00173     void addObject(Entity *ent);
00174     void DrawOrientation(HDC hdc);
00175     bool entityConnect(vec3_t p1, vec3_t p2);
00176     void selectRay(vec3_t p1, vec3_t p2, bool ef);
00177     void selectKnob(vec3_t p1, vec3_t p2, int UAxis, int VAxis, bool ef);
00178     SetBrush *grabRay(vec3_t p1, vec3_t p2);
00179     SetBrush *getTextureRay(vec3_t p1, vec3_t p2);
00180     void setTextureRay(vec3_t p1, vec3_t p2, bool allsides);
00181     void sel_identity();
00182     void transformSelection();
00183     void swapvectors(vec3_t a, vec3_t b);
00184     void rotate_x();
00185     void rotate_y();
00186     void rotate_z();
00187     void flip_x();
00188     void flip_y();
00189     void flip_z();
00190     void cloneSelection();
00191     void selectCompleteEntity();
00192     void selectPartialEntity();
00193     void makeEntity();
00194     bool lookAtSelection(bool force = false);
00195 
00196     int countSelectedBrushesWithEdge(vec3_t p1, vec3_t p2);
00197 
00198     void selbox(int sel);
00199     void selectCompletelyInside();
00200     void selectPartiallyInside();
00201     void makeRegionBrush();
00202     void makeRegionBrushPartial();
00203     void tallBrush();
00204     void shortBrush();
00205     void sizeBrush(int);
00206     void makeRoom();
00207     void extrudeRoom();
00208     void extrudeFace();
00209     void rotateBrush(int r, int p, int y);
00210     void rotateBrushOrg(int r, int p, int y, vec3_t org);
00211     void makeLights(int x, int y, int z, int val, char *lightType);
00212     int makeArch(Entity *currentEntity, SetBrush *seedBrush, int removeSeed,
00213                  int numsteps, int xory, int width, int rect);
00214     int makeStairs(Entity *currentEntity, SetBrush *seedBrush, int removeSeed, int style,
00215                    int numsteps, int hgap, int vgap, int down, int xory, float turns, int distfc);
00216     void makeSphere(int type, int hstrips, int vstrips, int neardist, int fardist, int take, int percent);
00217     void makeCylinder(int sides, int strips, int neardist, int fardist, int take, int percent, int xalign);
00218     void makeNSided(int sides, int radius, int xalign, int take);
00219     void makePyramid(int sides, int radius, int height, int xalign, int take);
00220     int makeWedge(Entity *currentEntity, SetBrush *seedBrush, int removeSeed, int axis, bool flip);
00221     void scaleBrush(float sx, float sy, float sz);
00222     void subtractSelection();
00223     void replaceTexture(char *f, char *r);
00224     void selectByTexture(char *buffer);
00225     void selectByEntityKeyValue(bool useE, bool useK, bool useV,char *ent, char *key, char *val);
00226     void revolveObject(char *fname, int hstrips, int neardist, int fardist);
00227 
00228     void getMouseObject(mouseobject_t *obj, vec3_t p1, vec3_t p2, vec3_t dragpoint, int ViewType, int UAxis, int VAxis);
00229 
00230     void UnloadTextures();
00231 
00232     int MixFilter(texturedef_t *td);
00233     int MixedFaceSearch();
00234     int TextureSearch(char *name);
00235 
00236     void AddDetail();
00237     void RemoveDetail();
00238     void SetDetail(bool addDetail); // true for add, false for subtract
00239 
00240     void glDrawOrientation();
00241     void glBrightness();
00242 
00243     void UpdateGroupVisibility(int);
00244     void UpdateMapVisibility();
00245     void UpdateCurrent();
00246 };
00247 
00248 
00249 #endif  //_MAP_H_
 All Classes Functions