2 ===========================================================================
5 Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
7 This file is part of the Doom 3 GPL Source Code (?Doom 3 Source Code?).
9 Doom 3 Source Code is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
14 Doom 3 Source Code is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with Doom 3 Source Code. If not, see <http://www.gnu.org/licenses/>.
22 In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below.
24 If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
26 ===========================================================================
29 #include "../../idlib/precompiled.h"
34 BOOL CALLBACK EditCommandDlgProc (
35 HWND hwndDlg, // handle to dialog box
37 WPARAM wParam, // first message parameter
38 LPARAM lParam // second message parameter
47 hOwner = GetParent (hwndDlg);
52 index = SendDlgItemMessage (hOwner, IDC_CMD_LIST, LB_GETCURSEL, 0, 0);
55 SendDlgItemMessage(hOwner, IDC_CMD_LIST, LB_GETTEXT, index, (LPARAM) (LPCTSTR) key);
56 temp = ValueForKey (g_qeglobals.d_project_entity, key);
58 SetDlgItemText(hwndDlg, IDC_CMDMENUTEXT, key);
59 SetDlgItemText(hwndDlg, IDC_CMDCOMMAND, value);
65 switch (LOWORD(wParam))
68 if (!GetDlgItemText(hwndDlg, IDC_CMDMENUTEXT, key, 64))
70 common->Printf ("Command not added\n");
74 if (!GetDlgItemText(hwndDlg, IDC_CMDCOMMAND, value, 64))
76 common->Printf ("Command not added\n");
80 //if (key[0] == 'b' && key[1] == 's' && key[2] == 'p')
82 SetKeyValue (g_qeglobals.d_project_entity, key, value);
86 // common->Printf ("BSP commands must be preceded by \"bsp\"");
88 EndDialog(hwndDlg, 1);
92 EndDialog(hwndDlg, 0);
99 BOOL CALLBACK AddCommandDlgProc (
100 HWND hwndDlg, // handle to dialog box
101 UINT uMsg, // message
102 WPARAM wParam, // first message parameter
103 LPARAM lParam // second message parameter
112 switch (LOWORD(wParam))
115 if (!GetDlgItemText(hwndDlg, IDC_CMDMENUTEXT, key, 64))
117 common->Printf ("Command not added\n");
121 if (!GetDlgItemText(hwndDlg, IDC_CMDCOMMAND, value, 64))
123 common->Printf ("Command not added\n");
127 if (key[0] == 'b' && key[1] == 's' && key[2] == 'p')
129 SetKeyValue (g_qeglobals.d_project_entity, key, value);
133 common->Printf ("BSP commands must be preceded by \"bsp\"");
135 EndDialog(hwndDlg, 1);
139 EndDialog(hwndDlg, 0);
146 void UpdateBSPCommandList (HWND hwndDlg)
150 SendDlgItemMessage(hwndDlg, IDC_CMD_LIST, LB_RESETCONTENT, 0 , 0);
153 int count = g_qeglobals.d_project_entity->epairs.GetNumKeyVals();
154 for (int j = 0; j < count; j++) {
155 if (g_qeglobals.d_project_entity->epairs.GetKeyVal(j)->GetKey()[0] == 'b' && g_qeglobals.d_project_entity->epairs.GetKeyVal(j)->GetKey()[1] == 's' && g_qeglobals.d_project_entity->epairs.GetKeyVal(j)->GetKey()[2] == 'p') {
156 SendDlgItemMessage(hwndDlg, IDC_CMD_LIST, LB_ADDSTRING, i , (LPARAM) g_qeglobals.d_project_entity->epairs.GetKeyVal(j)->GetKey().c_str());
163 // FIXME: turn this into an MFC dialog
164 BOOL CALLBACK ProjectDlgProc (
165 HWND hwndDlg, // handle to dialog box
166 UINT uMsg, // message
167 WPARAM wParam, // first message parameter
168 LPARAM lParam // second message parameter
178 SetDlgItemText(hwndDlg, IDC_PRJBASEPATH, ValueForKey (g_qeglobals.d_project_entity, "basepath"));
179 SetDlgItemText(hwndDlg, IDC_PRJMAPSPATH, ValueForKey (g_qeglobals.d_project_entity, "mapspath"));
180 SetDlgItemText(hwndDlg, IDC_PRJRSHCMD, ValueForKey (g_qeglobals.d_project_entity, "rshcmd"));
181 SetDlgItemText(hwndDlg, IDC_PRJREMOTEBASE, ValueForKey (g_qeglobals.d_project_entity, "remotebasepath"));
182 SetDlgItemText(hwndDlg, IDC_PRJENTITYPATH, ValueForKey (g_qeglobals.d_project_entity, "entitypath"));
183 SetDlgItemText(hwndDlg, IDC_PRJTEXPATH, ValueForKey (g_qeglobals.d_project_entity, "texturepath"));
184 UpdateBSPCommandList (hwndDlg);
187 CheckDlgButton( hwndDlg, IDC_CHECK_BPRIMIT, (g_qeglobals.m_bBrushPrimitMode) ? BST_CHECKED : BST_UNCHECKED );
188 // SendMessage( ::GetDlgItem( hwndDlg, IDC_CHECK_BPRIMIT ), BM_SETCHECK, (WPARAM) g_qeglobals.m_bBrushPrimitMode, 0 );
192 switch (LOWORD(wParam))
195 // DialogBox(g_qeglobals.d_hInstance, (char *)IDD_ADDCMD, g_qeglobals.d_hwndMain, AddCommandDlgProc);
196 DialogBox(g_qeglobals.d_hInstance, (char *)IDD_ADDCMD, hwndDlg, AddCommandDlgProc);
197 UpdateBSPCommandList (hwndDlg);
201 // DialogBox(g_qeglobals.d_hInstance, (char *)IDD_ADDCMD, g_qeglobals.d_hwndMain, EditCommandDlgProc);
202 DialogBox(g_qeglobals.d_hInstance, (char *)IDD_ADDCMD, hwndDlg, EditCommandDlgProc);
203 UpdateBSPCommandList (hwndDlg);
207 index = SendDlgItemMessage (hwndDlg, IDC_CMD_LIST, LB_GETCURSEL, 0, 0);
208 SendDlgItemMessage(hwndDlg, IDC_CMD_LIST, LB_GETTEXT, index, (LPARAM) (LPCTSTR) key);
209 DeleteKey (g_qeglobals.d_project_entity, key);
210 common->Printf ("Selected %d\n", index);
211 UpdateBSPCommandList (hwndDlg);
215 GetDlgItemText(hwndDlg, IDC_PRJBASEPATH, value, 1024);
216 SetKeyValue (g_qeglobals.d_project_entity, "basepath", value);
217 GetDlgItemText(hwndDlg, IDC_PRJMAPSPATH, value, 1024);
218 SetKeyValue (g_qeglobals.d_project_entity, "mapspath", value);
219 GetDlgItemText(hwndDlg, IDC_PRJRSHCMD, value, 1024);
220 SetKeyValue (g_qeglobals.d_project_entity, "rshcmd", value);
221 GetDlgItemText(hwndDlg, IDC_PRJREMOTEBASE, value, 1024);
222 SetKeyValue (g_qeglobals.d_project_entity, "remotebasepath", value);
223 GetDlgItemText(hwndDlg, IDC_PRJENTITYPATH, value, 1024);
224 SetKeyValue (g_qeglobals.d_project_entity, "entitypath", value);
225 GetDlgItemText(hwndDlg, IDC_PRJTEXPATH, value, 1024);
226 SetKeyValue (g_qeglobals.d_project_entity, "texturepath", value);
228 // read additional fields
229 if ( IsDlgButtonChecked( hwndDlg, IDC_CHECK_BPRIMIT ) )
231 g_qeglobals.m_bBrushPrimitMode = TRUE;
235 g_qeglobals.m_bBrushPrimitMode = FALSE;
237 SetKeyValue ( g_qeglobals.d_project_entity, "brush_primit", ( g_qeglobals.m_bBrushPrimitMode ? "1" : "0" ) );
239 EndDialog(hwndDlg, 1);
240 QE_SaveProject(g_strProject);
244 EndDialog(hwndDlg, 0);
251 void DoProjectSettings()
253 DialogBox(g_qeglobals.d_hInstance, (char *)IDD_PROJECT, g_pParentWnd->GetSafeHwnd(), ProjectDlgProc);
258 BOOL CALLBACK GammaDlgProc (
259 HWND hwndDlg, // handle to dialog box
260 UINT uMsg, // message
261 WPARAM wParam, // first message parameter
262 LPARAM lParam // second message parameter
270 sprintf(sz, "%1.1f", g_qeglobals.d_savedinfo.fGamma);
271 SetWindowText(GetDlgItem(hwndDlg, IDC_G_EDIT), sz);
274 switch (LOWORD(wParam))
278 GetWindowText(GetDlgItem(hwndDlg, IDC_G_EDIT), sz, 255);
279 g_qeglobals.d_savedinfo.fGamma = atof(sz);
280 EndDialog(hwndDlg, 1);
284 EndDialog(hwndDlg, 0);
295 if ( DialogBox(g_qeglobals.d_hInstance, (char *)IDD_GAMMA, g_pParentWnd->GetSafeHwnd(), GammaDlgProc))
300 //================================================
303 void SelectBrush (int entitynum, int brushnum)
319 Sys_Status ("No such entity.", 0);
325 b = e->brushes.onext;
326 if (b == &e->brushes)
328 Sys_Status ("No such brush.", 0);
334 if (b == &e->brushes)
336 Sys_Status ("No such brush.", 0);
341 Brush_RemoveFromList (b);
342 Brush_AddToList (b, &selected_brushes);
345 Sys_UpdateWindows (W_ALL);
346 for (i=0 ; i<3 ; i++)
348 if (g_pParentWnd->GetXYWnd())
349 g_pParentWnd->GetXYWnd()->GetOrigin()[i] = (b->mins[i] + b->maxs[i])/2;
351 if (g_pParentWnd->GetXZWnd())
352 g_pParentWnd->GetXZWnd()->GetOrigin()[i] = (b->mins[i] + b->maxs[i])/2;
354 if (g_pParentWnd->GetYZWnd())
355 g_pParentWnd->GetYZWnd()->GetOrigin()[i] = (b->mins[i] + b->maxs[i])/2;
358 Sys_Status ("Selected.", 0);
366 void GetSelectionIndex (int *ent, int *brush)
373 b = selected_brushes.next;
374 if (b == &selected_brushes)
378 if (b->owner != world_entity)
381 for (entity = entities.next ; entity != &entities
382 ; entity=entity->next, (*ent)++)
387 for (b2=b->owner->brushes.onext
388 ; b2 != b && b2 != &b->owner->brushes
389 ; b2=b2->onext, (*brush)++)
393 BOOL CALLBACK FindBrushDlgProc (
394 HWND hwndDlg, // handle to dialog box
395 UINT uMsg, // message
396 WPARAM wParam, // first message parameter
397 LPARAM lParam // second message parameter
408 // set entity and brush number
409 GetSelectionIndex (&ent, &brush);
410 sprintf (entstr, "%i", ent);
411 sprintf (brushstr, "%i", brush);
412 SetWindowText(GetDlgItem(hwndDlg, IDC_FIND_ENTITY), entstr);
413 SetWindowText(GetDlgItem(hwndDlg, IDC_FIND_BRUSH), brushstr);
415 h = GetDlgItem(hwndDlg, IDC_FIND_ENTITY);
420 switch (LOWORD(wParam))
423 GetWindowText(GetDlgItem(hwndDlg, IDC_FIND_ENTITY), entstr, 255);
424 GetWindowText(GetDlgItem(hwndDlg, IDC_FIND_BRUSH), brushstr, 255);
425 SelectBrush (atoi(entstr), atoi(brushstr));
426 EndDialog(hwndDlg, 1);
430 EndDialog(hwndDlg, 0);
441 DialogBox(g_qeglobals.d_hInstance, (char *)IDD_FINDBRUSH, g_pParentWnd->GetSafeHwnd(), FindBrushDlgProc);
445 ===================================================
449 ===================================================
453 BOOL CALLBACK RotateDlgProc (
454 HWND hwndDlg, // handle to dialog box
455 UINT uMsg, // message
456 WPARAM wParam, // first message parameter
457 LPARAM lParam // second message parameter
467 h = GetDlgItem(hwndDlg, IDC_FIND_ENTITY);
472 switch (LOWORD(wParam))
476 GetWindowText(GetDlgItem(hwndDlg, IDC_ROTX), str, 255);
479 Select_RotateAxis (0, v);
481 GetWindowText(GetDlgItem(hwndDlg, IDC_ROTY), str, 255);
484 Select_RotateAxis (1, v);
486 GetWindowText(GetDlgItem(hwndDlg, IDC_ROTZ), str, 255);
489 Select_RotateAxis (2, v);
491 EndDialog(hwndDlg, 1);
495 EndDialog(hwndDlg, 0);
507 DialogBox(g_qeglobals.d_hInstance, (char *)IDD_ROTATE, g_pParentWnd->GetSafeHwnd(), RotateDlgProc);
511 ===================================================
515 ===================================================
518 bool g_bDoCone = false;
519 bool g_bDoSphere = false;
520 BOOL CALLBACK SidesDlgProc (
521 HWND hwndDlg, // handle to dialog box
522 UINT uMsg, // message
523 WPARAM wParam, // first message parameter
524 LPARAM lParam // second message parameter
533 h = GetDlgItem(hwndDlg, IDC_SIDES);
538 switch (LOWORD(wParam)) {
541 GetWindowText(GetDlgItem(hwndDlg, IDC_SIDES), str, 255);
543 Brush_MakeSidedCone(atoi(str));
544 else if (g_bDoSphere)
545 Brush_MakeSidedSphere(atoi(str));
547 Brush_MakeSided (atoi(str));
549 EndDialog(hwndDlg, 1);
553 EndDialog(hwndDlg, 0);
562 void DoSides(bool bCone, bool bSphere, bool bTorus)
565 g_bDoSphere = bSphere;
566 //g_bDoTorus = bTorus;
567 DialogBox(g_qeglobals.d_hInstance, (char *)IDD_SIDES, g_pParentWnd->GetSafeHwnd(), SidesDlgProc);
571 //======================================================================
578 BOOL CALLBACK AboutDlgProc( HWND hwndDlg,
588 idStr::snPrintf(buffer, 1024, "DOOM Radiant Build %d\nCopyright ©1999-2004 Id Software, Inc.\n", BUILD_NUMBER);
589 // SetDlgItemText( hwndDlg, IDC_ABOUT_INFO, buffer);
591 idStr::snPrintf( buffer, 1024, "Renderer:\t%s", qglGetString( GL_RENDERER ) );
592 SetDlgItemText( hwndDlg, IDC_ABOUT_GLRENDERER, buffer );
594 idStr::snPrintf( buffer, 1024, "Version:\t\t%s", qglGetString( GL_VERSION ) );
595 SetDlgItemText( hwndDlg, IDC_ABOUT_GLVERSION, buffer );
597 idStr::snPrintf( buffer, 1024, "Vendor:\t\t%s", qglGetString( GL_VENDOR ) );
598 SetDlgItemText( hwndDlg, IDC_ABOUT_GLVENDOR, buffer);
600 char extensions[4096];
601 idStr::snPrintf( extensions, 4096, "%s", qglGetString( GL_EXTENSIONS ) );
602 HWND hWndExtensions = GetDlgItem( hwndDlg, IDC_ABOUT_GLEXTENSIONS );
604 char *start = extensions;
607 end = strchr(start, ' ');
611 SendMessage( hWndExtensions, LB_ADDSTRING, 0, (LPARAM)start );
619 EndDialog( hwndDlg, 1 );
623 if ( LOWORD( wParam ) == IDOK )
624 EndDialog(hwndDlg, 1);
632 DialogBox( g_qeglobals.d_hInstance, ( char * ) IDD_ABOUT, g_pParentWnd->GetSafeHwnd(), AboutDlgProc );