qe3.h 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307
  1. /*
  2. ===========================================================================
  3. Copyright (C) 1997-2006 Id Software, Inc.
  4. This file is part of Quake 2 Tools source code.
  5. Quake 2 Tools source code is free software; you can redistribute it
  6. and/or modify it under the terms of the GNU General Public License as
  7. published by the Free Software Foundation; either version 2 of the License,
  8. or (at your option) any later version.
  9. Quake 2 Tools source code is distributed in the hope that it will be
  10. useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with Quake 2 Tools source code; if not, write to the Free Software
  15. Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  16. ===========================================================================
  17. */
  18. #ifndef __QE3_H__
  19. #define __QE3_H__
  20. // disable data conversion warnings for gl
  21. #pragma warning(disable : 4244) // MIPS
  22. #pragma warning(disable : 4136) // X86
  23. #pragma warning(disable : 4051) // ALPHA
  24. #include <windows.h>
  25. #include <gl/gl.h>
  26. #include <gl/glu.h>
  27. #include <gl/glaux.h>
  28. #include "glingr.h"
  29. #include <math.h>
  30. #include <stdlib.h>
  31. #include "cmdlib.h"
  32. #include "mathlib.h"
  33. #include "parse.h"
  34. #include "lbmlib.h"
  35. #include <commctrl.h>
  36. #include "afxres.h"
  37. #include "resource.h"
  38. #include "qedefs.h"
  39. typedef struct
  40. {
  41. vec3_t normal;
  42. double dist;
  43. int type;
  44. } plane_t;
  45. #include "qfiles.h"
  46. #include "textures.h"
  47. #include "brush.h"
  48. #include "entity.h"
  49. #include "map.h"
  50. #include "select.h"
  51. #include "camera.h"
  52. #include "xy.h"
  53. #include "z.h"
  54. #include "mru.h"
  55. typedef struct
  56. {
  57. int p1, p2;
  58. face_t *f1, *f2;
  59. } pedge_t;
  60. typedef struct
  61. {
  62. int iSize;
  63. int iTexMenu; // nearest, linear, etc
  64. float fGamma; // gamma for textures
  65. char szProject[256]; // last project loaded
  66. vec3_t colors[COLOR_LAST];
  67. qboolean show_names,
  68. show_coordinates;
  69. int exclude;
  70. } SavedInfo_t;
  71. //
  72. // system functions
  73. //
  74. void Sys_UpdateStatusBar( void );
  75. void Sys_UpdateWindows (int bits);
  76. void Sys_Beep (void);
  77. void Sys_ClearPrintf (void);
  78. void Sys_Printf (char *text, ...);
  79. double Sys_DoubleTime (void);
  80. void Sys_GetCursorPos (int *x, int *y);
  81. void Sys_SetCursorPos (int x, int y);
  82. void Sys_SetTitle (char *text);
  83. void Sys_BeginWait (void);
  84. void Sys_EndWait (void);
  85. void Sys_Status(const char *psz, int part);
  86. /*
  87. ** most of the QE globals are stored in this structure
  88. */
  89. typedef struct
  90. {
  91. qboolean d_showgrid;
  92. int d_gridsize;
  93. int d_num_entities;
  94. entity_t *d_project_entity;
  95. float d_new_brush_bottom_z,
  96. d_new_brush_top_z;
  97. HINSTANCE d_hInstance;
  98. HGLRC d_hglrcBase;
  99. HDC d_hdcBase;
  100. HWND d_hwndMain;
  101. HWND d_hwndCamera;
  102. HWND d_hwndEdit;
  103. HWND d_hwndEntity;
  104. HWND d_hwndTexture;
  105. HWND d_hwndXY;
  106. HWND d_hwndZ;
  107. HWND d_hwndStatus;
  108. vec3_t d_points[MAX_POINTS];
  109. int d_numpoints;
  110. pedge_t d_edges[MAX_EDGES];
  111. int d_numedges;
  112. int d_num_move_points;
  113. float *d_move_points[1024];
  114. qtexture_t *d_qtextures;
  115. texturewin_t d_texturewin;
  116. int d_pointfile_display_list;
  117. xy_t d_xy;
  118. LPMRUMENU d_lpMruMenu;
  119. SavedInfo_t d_savedinfo;
  120. int d_workcount;
  121. // connect entities uses the last two brushes selected
  122. int d_select_count;
  123. brush_t *d_select_order[2];
  124. vec3_t d_select_translate; // for dragging w/o making new display lists
  125. select_t d_select_mode;
  126. int d_font_list;
  127. int d_parsed_brushes;
  128. qboolean show_blocks;
  129. } QEGlobals_t;
  130. void *qmalloc (int size);
  131. char *copystring (char *s);
  132. char *ExpandReletivePath (char *p);
  133. void Pointfile_Delete (void);
  134. void Pointfile_Check (void);
  135. void Pointfile_Next (void);
  136. void Pointfile_Prev (void);
  137. void Pointfile_Clear (void);
  138. void Pointfile_Draw( void );
  139. void Pointfile_Load( void );
  140. //
  141. // drag.c
  142. //
  143. void Drag_Begin (int x, int y, int buttons,
  144. vec3_t xaxis, vec3_t yaxis,
  145. vec3_t origin, vec3_t dir);
  146. void Drag_MouseMoved (int x, int y, int buttons);
  147. void Drag_MouseUp (void);
  148. //
  149. // csg.c
  150. //
  151. void CSG_MakeHollow (void);
  152. void CSG_Subtract (void);
  153. //
  154. // vertsel.c
  155. //
  156. void SetupVertexSelection (void);
  157. void SelectEdgeByRay (vec3_t org, vec3_t dir);
  158. void SelectVertexByRay (vec3_t org, vec3_t dir);
  159. void ConnectEntities (void);
  160. extern int update_bits;
  161. extern int screen_width;
  162. extern int screen_height;
  163. extern HANDLE bsp_process;
  164. char *TranslateString (char *buf);
  165. void ProjectDialog (void);
  166. void FillTextureMenu (void);
  167. void FillBSPMenu (void);
  168. BOOL CALLBACK Win_Dialog (
  169. HWND hwndDlg, // handle to dialog box
  170. UINT uMsg, // message
  171. WPARAM wParam, // first message parameter
  172. LPARAM lParam // second message parameter
  173. );
  174. //
  175. // win_cam.c
  176. //
  177. void WCam_Create (HINSTANCE hInstance);
  178. //
  179. // win_xy.c
  180. //
  181. void WXY_Create (HINSTANCE hInstance);
  182. //
  183. // win_z.c
  184. //
  185. void WZ_Create (HINSTANCE hInstance);
  186. //
  187. // win_ent.c
  188. //
  189. //
  190. // win_main.c
  191. //
  192. void Main_Create (HINSTANCE hInstance);
  193. extern BOOL SaveWindowState(HWND hWnd, const char *pszName);
  194. extern BOOL LoadWindowState(HWND hWnd, const char *pszName);
  195. extern BOOL SaveRegistryInfo(const char *pszName, void *pvBuf, long lSize);
  196. extern BOOL loadRegistryInfo(const char *pszName, void *pvBuf, long *plSize);
  197. //
  198. // entityw.c
  199. //
  200. BOOL CreateEntityWindow(HINSTANCE hInstance);
  201. void FillClassList (void);
  202. BOOL UpdateEntitySel(eclass_t *pec);
  203. void SetInspectorMode(int iType);
  204. int DrawTexControls(HWND hWnd);
  205. void SetSpawnFlags(void);
  206. void GetSpawnFlags(void);
  207. void SetKeyValuePairs(void);
  208. extern void BuildGammaTable(float g);
  209. // win_dlg.c
  210. void DoGamma(void);
  211. void DoFind(void);
  212. void DoRotate(void);
  213. void DoSides(void);
  214. void DoAbout(void);
  215. void DoSurface(void);
  216. /*
  217. ** QE function declarations
  218. */
  219. void QE_CheckAutoSave( void );
  220. void QE_ConvertDOSToUnixName( char *dst, const char *src );
  221. void QE_CountBrushesAndUpdateStatusBar( void );
  222. void QE_CheckOpenGLForErrors(void);
  223. void QE_ExpandBspString (char *bspaction, char *out, char *mapname);
  224. void QE_Init (void);
  225. qboolean QE_KeyDown (int key);
  226. qboolean QE_LoadProject (char *projectfile);
  227. qboolean QE_SingleBrush (void);
  228. /*
  229. ** QE Win32 function declarations
  230. */
  231. int QEW_SetupPixelFormat(HDC hDC, qboolean zbuffer );
  232. void QEW_StopGL( HWND hWnd, HGLRC hGLRC, HDC hDC );
  233. /*
  234. ** extern declarations
  235. */
  236. extern QEGlobals_t g_qeglobals;
  237. #endif