1 /*- BSP.H ------------------------------------------------------------------*/ 2 3 #include <stdio.h> 4 #include <stdlib.h> 5 #include <string.h> 6 #include <stdarg.h> 7 #include <ctype.h> 8 #include <math.h> 9 #include <limits.h> 10 #include <assert.h> 11 12 #if defined(MSDOS) || defined(__MSDOS__) 13 #include <dos.h> 14 #endif 15 #ifdef __TURBOC__ 16 #include <alloc.h> 17 #endif 18 19 /* cph - from FreeBSD math.h: */ 20 #ifndef M_PI 21 #define M_PI 3.14159265358979323846 22 #endif 23 24 /*- boolean constants ------------------------------------------------------*/ 25 26 #define TRUE 1 27 #define FALSE 0 28 29 /*- The function prototypes ------------------------------------------------*/ 30 31 #undef max 32 #define max(a,b) (((a)>(b))?(a):(b)) 33 34 /*- print a resource name by printing first 8 characters --*/ 35 36 #define Printname(dir) printf("%-8.8s",(dir)->name) 37 38 /*- Global functions & variables ------------------------------------------*/ 39 40 /* blockmap.c */ 41 void CreateBlockmap_old(const bbox_t bbox); 42 void CreateBlockmap_compressed(const bbox_t bbox); 43 extern void (*CreateBlockmap)(const bbox_t bbox); 44 45 /* bsp.c */ 46 void progress(void); 47 void FindLimits(struct Seg *, bbox_t box); 48 int SplitDist(struct Seg *ts); 49 50 extern const char *unlinkwad; 51 52 struct lumplist *FindDir(const char *); 53 void* ReadLump(struct lumplist *l); 54 void add_lump(const char *name, void *data, size_t length); 55 56 /* endian.c */ 57 58 void ConvertAll(void); 59 void ConvertVertex(void); 60 void ConvertLinedef(void); 61 void ConvertSidedef(void); 62 void ConvertSector(void); 63 64 void swapshort(uint16_t *i); 65 void swaplong(uint32_t *l); 66 void swapint(unsigned int *l); 67 68 /* funcs.c */ 69 extern int verbosity; 70 void Verbose(const char*, ...) __attribute__((format(printf,1,2))); 71 void ProgError(const char *, ...) __attribute__((format(printf,1,2), noreturn)); 72 void* GetMemory(size_t) __attribute__((warn_unused_result, malloc)); 73 void* ResizeMemory(void *, size_t) __attribute__((warn_unused_result)); 74 75 /* level.c */ 76 77 void DoLevel(const char *current_level_name, struct lumplist * current_level); 78 79 extern struct Vertex *vertices; 80 extern long num_verts; 81 82 extern struct LineDef *linedefs; 83 extern long num_lines; 84 85 extern struct SideDef *sidedefs; 86 extern long num_sides; 87 88 extern struct Sector *sectors; 89 extern long num_sects; 90 91 extern struct SSector *ssectors; 92 extern long num_ssectors; 93 94 extern struct Pseg *psegs; 95 extern long num_psegs; 96 97 extern long num_nodes; 98 99 extern unsigned char *SectorHits; 100 101 extern long psx,psy,pex,pey,pdx,pdy; 102 extern long lsx,lsy,lex,ley; 103 104 /* makenode.c */ 105 struct Node *CreateNode(struct Seg *, const bbox_t bbox); 106 unsigned ComputeAngle(int,int); 107 108 /* picknode.c */ 109 extern int factor; 110 111 struct Seg *PickNode_traditional(struct Seg *, const bbox_t bbox); 112 struct Seg *PickNode_visplane(struct Seg *, const bbox_t bbox); 113 extern struct Seg *(*PickNode)(struct Seg *, const bbox_t bbox); 114 int DoLinesIntersect(void); 115 void ComputeIntersection(short int *outx,short int *outy); 116 117 /* malloc edbugging with dmalloc */ 118 #ifdef WITH_DMALLOC 119 #include <dmalloc.h> 120 121 #define GetMemory malloc 122 #define ResizeMemory realloc 123 124 #endif 125 126 /*------------------------------- end of file ------------------------------*/ 127