diff -rup ../Q3Radiant201/PrefsDlg.cpp Q3Radiant/PrefsDlg.cpp --- ../Q3Radiant201/PrefsDlg.cpp Mon Jun 26 12:31:00 2000 +++ Q3Radiant/PrefsDlg.cpp Thu Aug 3 17:19:16 2000 @@ -224,6 +232,8 @@ void CPrefsDlg::DoDataExchange(CDataExch DDX_Text(pDX, IDC_EDIT_UNDOLEVELS, m_nUndoLevels); DDV_MinMaxInt(pDX, m_nUndoLevels, 1, 64); DDX_Check(pDX, IDC_CHECK_VERTEXMODE, m_bVertexSplit); + DDX_Check(pDX, IDC_CHECK_LOG, m_bLogConsole); + DDX_Check(pDX, IDC_NOALPHA, m_bDisableAlphaChannel); //}}AFX_DATA_MAP } @@ -236,6 +246,7 @@ BEGIN_MESSAGE_MAP(CPrefsDlg, CDialog) ON_BN_CLICKED(IDC_BTN_BROWSEUSERINI, OnBtnBrowseuserini) ON_CBN_SELCHANGE(IDC_COMBO_WHATGAME, OnSelchangeComboWhatgame) ON_BN_CLICKED(IDC_BUTTON_CLEAN, OnButtonClean) + ON_BN_CLICKED(IDC_NOALPHA, OnNoalpha) //}}AFX_MSG_MAP END_MESSAGE_MAP() @@ -332,7 +344,7 @@ bool SetQdirFromPath( const char *path ) len = strlen(BASEDIRNAME); for (c=path+strlen(path)-1 ; c != path ; c--) { - int i; + unsigned int i; if (strnicmp (c, BASEDIRNAME, len) == 0) { @@ -448,7 +460,12 @@ void CPrefsDlg::LoadPrefs() m_strQuake2 = AfxGetApp()->GetProfileString(PREF_SECTION, Q2_KEY); // if the path to the engine is empty, we set this flag to call InitEnginePath later - if (m_strQuake2.GetLength() == 0) + // if the path to the engine is empty or points to a file that doesn't exist we call InitEnginePath + struct _finddata_t fileinfo; + int handle; + handle = _findfirst (m_strQuake2.GetBuffer(0), &fileinfo); + _findclose( handle ); + if (handle == -1 || m_strQuake2.GetLength() == 0) InitEnginePath(); m_iLastLightIntensity = AfxGetApp()->GetProfileInt(PREF_SECTION, "LastLightIntensity", 300); @@ -697,4 +731,10 @@ void CPrefsDlg::OnButtonClean() theApp.ResetRegistry(); g_pParentWnd->OnFileExit(); } +} + +void CPrefsDlg::OnNoalpha() +{ + if (static_cast(GetDlgItem(IDC_NOALPHA))->GetState() & 0x0003) + MessageBox( "If alpha channel support is disabled, Curry plugin might not work as expected.", "Alpha channel support", MB_OK ); } diff -rup ../Q3Radiant201/Radiant.rc Q3Radiant/Radiant.rc --- ../Q3Radiant201/Radiant.rc Mon Jun 26 12:31:00 2000 +++ Q3Radiant/Radiant.rc Thu Aug 3 17:19:22 2000 @@ -1518,7 +1520,7 @@ BEGIN LTEXT "Height",IDC_STATIC,131,136,22,8 END -IDD_DLG_PREFS DIALOG DISCARDABLE 0, 0, 386, 351 +IDD_DLG_PREFS DIALOG DISCARDABLE 0, 0, 386, 380 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Q3Radiant Preferences" FONT 8, "MS Sans Serif" @@ -1561,103 +1563,108 @@ BEGIN CONTROL "Texture subset",IDC_CHECK_TEXTUREWINDOW,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,308,94,63,10 CONTROL "Right click to drop entities",IDC_CHECK_RIGHTCLICK, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,137,95,10 + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,150,95,10 CONTROL "Face selection",IDC_CHECK_FACE,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,13,149,62,10 - EDITTEXT IDC_EDIT_ROTATION,58,161,24,12,ES_AUTOHSCROLL + WS_TABSTOP,13,162,62,10 + EDITTEXT IDC_EDIT_ROTATION,58,174,24,12,ES_AUTOHSCROLL CONTROL "ALT + multi-drag",IDC_CHECK_ALTDRAG,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,114,137,68,10 + BS_AUTOCHECKBOX | WS_TABSTOP,114,150,68,10 CONTROL "Snap T to Grid",IDC_CHECK_SNAPT,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,114,149,62,10 + BS_AUTOCHECKBOX | WS_TABSTOP,114,162,62,10 CONTROL "Mouse chaser",IDC_CHECK_MOUSECHASE,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,114,160,68,10 + BS_AUTOCHECKBOX | WS_TABSTOP,114,173,68,10 CONTROL "Patch Toolbar",IDC_CHECK_WIDETOOLBAR,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,193,137,61,10 + BS_AUTOCHECKBOX | WS_TABSTOP,193,150,61,10 CONTROL "Light drawing",IDC_CHECK_LIGHTDRAW,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,193,149,58,10 + BS_AUTOCHECKBOX | WS_TABSTOP,193,162,58,10 CONTROL "Paint sizing info",IDC_CHECK_SIZEPAINT,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,193,160,65,10 + BS_AUTOCHECKBOX | WS_TABSTOP,193,173,65,10 CONTROL "Hi Color Textures",IDC_CHECK_HICOLOR,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,281,137,70,10 - LTEXT "Startup Shaders:",IDC_STATIC,281,150,54,8 - COMBOBOX IDC_COMBO_SHADERS,281,160,82,54,CBS_DROPDOWNLIST | + BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_DISABLED | + WS_TABSTOP,281,150,70,10 + LTEXT "Startup Shaders:",IDC_STATIC,281,163,54,8 + COMBOBOX IDC_COMBO_SHADERS,281,173,82,54,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - EDITTEXT IDC_EDIT_QUAKE2,13,215,229,12,ES_AUTOHSCROLL - PUSHBUTTON "...",IDC_BTN_BROWSE,248,216,16,11 + EDITTEXT IDC_EDIT_QUAKE2,13,228,229,12,ES_AUTOHSCROLL + PUSHBUTTON "...",IDC_BTN_BROWSE,248,230,16,11 CONTROL "Use internal (DLL) QBSP....",IDC_CHECK_INTERNALBSP, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,234,102,10 + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,247,102,10 CONTROL "Don't clamp plane points",IDC_CHECK_NOCLAMP,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,13,246,93,10 + BS_AUTOCHECKBOX | WS_TABSTOP,13,260,93,10 CONTROL "Snapshots",IDC_CHECK_SNAPSHOTS,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,13,258,49,10 + WS_TABSTOP,13,271,49,10 CONTROL "Use +setgame for run",IDC_CHECK_SETGAME,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,13,270,83,10 + BS_AUTOCHECKBOX | WS_TABSTOP,13,284,83,10 CONTROL "Run game after QBSP3...",IDC_CHECK_RUNQUAKE,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,121,234,96,10 + BS_AUTOCHECKBOX | WS_TABSTOP,121,247,96,10 CONTROL "Load last project on open",IDC_CHECK_LOADLAST,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,121,246,96,10 + BS_AUTOCHECKBOX | WS_TABSTOP,121,260,96,10 CONTROL "Load last map on open",IDC_CHECK_LOADLASTMAP,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,121,258,88,10 + BS_AUTOCHECKBOX | WS_TABSTOP,121,271,88,10 CONTROL "Auto save every ",IDC_CHECK_AUTOSAVE,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,121,270,66,10 - EDITTEXT IDC_EDIT_AUTOSAVE,188,270,27,12,ES_AUTOHSCROLL | + BS_AUTOCHECKBOX | WS_TABSTOP,121,284,66,10 + EDITTEXT IDC_EDIT_AUTOSAVE,188,284,27,12,ES_AUTOHSCROLL | ES_NUMBER CONTROL "Spin1",IDC_SPIN_AUTOSAVE,"msctls_updown32",UDS_WRAP | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | - UDS_ARROWKEYS,212,268,11,14 - LTEXT "Status point size:",IDC_STATIC,258,235,54,8 - EDITTEXT IDC_EDIT_STATUSPOINTSIZE,315,233,29,12,ES_AUTOHSCROLL + UDS_ARROWKEYS,212,282,11,14 + LTEXT "Status point size:",IDC_STATIC,258,249,54,8 + EDITTEXT IDC_EDIT_STATUSPOINTSIZE,315,247,29,12,ES_AUTOHSCROLL CONTROL "Spin1",IDC_SPIN_POINTSIZE,"msctls_updown32",UDS_WRAP | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | - UDS_ARROWKEYS,344,232,11,14 - LTEXT "Undo Levels:",IDC_STATIC,258,248,43,8 - EDITTEXT IDC_EDIT_UNDOLEVELS,315,246,29,12,ES_AUTOHSCROLL + UDS_ARROWKEYS,344,246,11,14 + LTEXT "Undo Levels:",IDC_STATIC,258,262,43,8 + EDITTEXT IDC_EDIT_UNDOLEVELS,315,260,29,12,ES_AUTOHSCROLL CONTROL "Spin1",IDC_SPIN_UNDO,"msctls_updown32",UDS_WRAP | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | - UDS_ARROWKEYS,344,246,11,14 + UDS_ARROWKEYS,344,260,11,14 CONTROL "Use PAK/PK3 file(s):",IDC_CHECK_PAK,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,13,289,81,10 - EDITTEXT IDC_EDIT_PAKFILE,95,288,227,12,ES_AUTOHSCROLL - PUSHBUTTON "...",IDC_BTN_BROWSEPAK,328,289,16,11 - EDITTEXT IDC_EDIT_PREFABPATH,95,305,227,12,ES_AUTOHSCROLL - PUSHBUTTON "...",IDC_BTN_BROWSEPREFAB,328,306,16,11 - EDITTEXT IDC_EDIT_USERPATH,95,322,227,12,ES_AUTOHSCROLL - PUSHBUTTON "...",IDC_BTN_BROWSEUSERINI,328,323,16,11 + BS_AUTOCHECKBOX | WS_TABSTOP,13,303,81,10 + EDITTEXT IDC_EDIT_PAKFILE,95,302,227,12,ES_AUTOHSCROLL + PUSHBUTTON "...",IDC_BTN_BROWSEPAK,328,303,16,11 + EDITTEXT IDC_EDIT_PREFABPATH,95,319,227,12,ES_AUTOHSCROLL + PUSHBUTTON "...",IDC_BTN_BROWSEPREFAB,328,319,16,11 + EDITTEXT IDC_EDIT_USERPATH,95,335,227,12,ES_AUTOHSCROLL + PUSHBUTTON "...",IDC_BTN_BROWSEUSERINI,328,337,16,11 DEFPUSHBUTTON "OK",IDOK,341,7,38,14 PUSHBUTTON "Cancel",IDCANCEL,341,24,38,14 CONTROL "Entities are DLL based",IDC_CHECK_DLLENTITIES,"Button", BS_AUTOCHECKBOX | BS_TOP | BS_MULTILINE | NOT WS_VISIBLE | - WS_DISABLED | WS_TABSTOP,273,178,88,12 + WS_DISABLED | WS_TABSTOP,273,191,88,12 CONTROL "Write face color info",IDC_CHECK_FACECOLOR,"Button", BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_DISABLED | - WS_TABSTOP,189,178,79,10 - LTEXT "minutes",IDC_STATIC,216,271,25,8 + WS_TABSTOP,189,191,79,10 + LTEXT "minutes",IDC_STATIC,216,284,25,8 GROUPBOX "Mouse",IDC_STATIC,179,7,103,28 - GROUPBOX "Views / Rendering",IDC_STATIC,7,38,372,86 + GROUPBOX "Views / Rendering",IDC_STATIC,7,38,372,98 GROUPBOX "Game path / Tool settings / Stuff that wouldn't fit anywhere else", - IDC_STATIC,7,205,372,139 + IDC_STATIC,7,216,372,157 CONTROL 147,IDB_VIEWDEFAULT,"Static",SS_BITMAP,13,48,21,19 CONTROL 148,IDB_VIEWDEFAULT2,"Static",SS_BITMAP,40,48,21,19 CONTROL 149,IDB_VIEWDEFAULT3,"Static",SS_BITMAP,67,48,21,19 - GROUPBOX "New functionality:",IDC_STATIC,7,126,372,74 + GROUPBOX "New functionality:",IDC_STATIC,7,139,372,74 CONTROL 150,IDB_VIEWDEFAULT_Z,"Static",SS_BITMAP,93,48,21,19 LTEXT "slow",IDC_STATIC,131,69,15,8 LTEXT "fast",IDC_STATIC,204,69,12,8 - GROUPBOX "Camera ",IDC_STATIC,126,47,100,72 - LTEXT "Prefab path:",IDC_STATIC,54,306,40,8 + GROUPBOX "Camera ",IDC_STATIC,126,47,100,84 + LTEXT "Prefab path:",IDC_STATIC,54,319,40,8 GROUPBOX "Optimize interface for",IDC_STATIC,7,7,170,28 - LTEXT "User INI path:",IDC_STATIC,49,324,45,8 - LTEXT "Rotation inc:",IDC_STATIC,15,163,41,8 + LTEXT "User INI path:",IDC_STATIC,49,338,45,8 + LTEXT "Rotation inc:",IDC_STATIC,15,176,41,8 CONTROL "Use Shaders",IDC_CHECK_USESHADERS,"Button", BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_DISABLED | - WS_TABSTOP,129,178,57,10 - GROUPBOX "Texturing",IDC_STATIC,231,47,141,72 + WS_TABSTOP,129,191,57,10 + GROUPBOX "Texturing",IDC_STATIC,231,47,141,84 LTEXT "Quality",IDC_STATIC,237,57,22,8 LTEXT "Low",IDC_STATIC,239,81,14,8 LTEXT "High",IDC_STATIC,347,82,16,8 CONTROL "Vertex editing splits faces",IDC_CHECK_VERTEXMODE, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,179,94,10 + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,192,94,10 PUSHBUTTON "Reset Registry",IDC_BUTTON_CLEAN,287,24,50,14 + CONTROL "Log console to Radiant.log",IDC_CHECK_LOG,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,13,356,97,11 + CONTROL "Ignore alpha channel",IDC_NOALPHA,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,236,117,127,10 END IDD_DLG_MAPINFO DIALOG DISCARDABLE 0, 0, 181, 183 diff -rup ../Q3Radiant201/TexWnd.cpp Q3Radiant/TexWnd.cpp --- ../Q3Radiant201/TexWnd.cpp Mon Jun 26 12:31:00 2000 +++ Q3Radiant/TexWnd.cpp Thu Aug 3 17:19:23 2000 @@ -1439,31 +1550,46 @@ void Delay(float fSeconds) void ViewShader(const char *pFile, const char *pName) { // we load the .shader file to find where it actually is - CString str; + CString fullName = ValueForKey( g_qeglobals.d_project_entity, "basepath" ); + fullName += '/'; + fullName += pFile; char* pBuff = NULL; - int nSize = LoadFile(pFile, reinterpret_cast(&pBuff)); + int nSize = LoadFile(fullName.GetBuffer(0), reinterpret_cast(&pBuff)); if (nSize == -1) { - nSize = PakLoadAnyFile(pFile, reinterpret_cast(&pBuff)); - } - - if (nSize > 0) - { - str = pBuff; + Sys_Printf("Failed to load shader file %s ... check your project settings!\n", pFile ); + return; } - int nStart = 0; - if (str.GetLength() > 0) + // look for the shader declaration + int nStart; + CString strFind = pName; + CString strLook = pBuff; + strLook.MakeLower(); + strFind.MakeLower(); + // offset used when jumping over commented out definitions + int nOffset = 0; + while (true) { - CString strFind = pName; - CString strLook = str; - strLook.MakeLower(); - strFind.MakeLower(); - int n = strLook.Find(strFind); - if (n >= 0) - { - nStart = n; + nStart = strLook.Find(strFind, nOffset); + if (nStart == -1) + break; + // we have found something, maybe it's a commented out shader name? + char *strCheck = new char[strLook.GetLength()+1]; + strcpy( strCheck, strLook.GetBuffer(0) ); + strCheck[nStart] = 0; + char *pCheck = strrchr( strCheck, '\n' ); + // if there's a commentary sign in-between we'll continue + if (pCheck && strstr( pCheck, "//" )) + { + delete[] strCheck; + nOffset = nStart + 1; + continue; } + delete[] strCheck; + break; } + // now close the file + free(pBuff); CString s= "editpad "; // build the full shader name @@ -1472,7 +1598,9 @@ void ViewShader(const char *pFile, const s += pFile; WinExec(s, SW_SHOWNORMAL); - Delay(1.5); + // TTimo: we used to call Delay here, to continue processing messages. But it seems to induce a lot of instabilities. + // so now the user will simply have to wait. + Sleep( 1500 ); // now grab the edit window and scroll to the shader we want to edit HWND hwndEdit = FindEditWindow(); @@ -1485,8 +1613,6 @@ void ViewShader(const char *pFile, const { Sys_Printf("Unable to load shader editor.\n"); } - - } /* @@ -2319,10 +2459,21 @@ void CTexWnd::OnVScroll(UINT nSBCode, UI void LoadShaders() { + CStringList lst; + BuildShaderList( lst ); + if (lst.GetCount() == 0) + return; + POSITION pos = lst.GetHeadPosition(); + while (pos != NULL) + { + QERApp_LoadShaderFile( lst.GetAt(pos).GetBuffer(0) ); + lst.GetNext(pos); + } + + //++timo clean +#if 0 char dirstring[1024]; char *path; - //struct _finddata_t fileinfo; - //int handle; path = ValueForKey (g_qeglobals.d_project_entity, "basepath"); sprintf (dirstring, "%s/scripts/shaderlist.txt", path); char *pBuff = NULL; @@ -2354,9 +2505,9 @@ void LoadShaders() } else { - Sys_Printf("Unable to load shaderlist.txt, shaders not loaded!"); + Sys_Printf("Unable to load %s, shaders not loaded!\n", dirstring); } - +#endif } // TTimo: modified to expect the reletive path to the skin as input diff -rup ../Q3Radiant201/WIN_QE3.CPP Q3Radiant/WIN_QE3.CPP --- ../Q3Radiant201/WIN_QE3.CPP Mon Jun 26 12:31:00 2000 +++ Q3Radiant/WIN_QE3.CPP Thu Aug 3 17:19:24 2000 @@ -3,6 +3,11 @@ #include "mru.h" #include "PrefsDlg.h" +// for the logging part +#include +#include +#include + //////////////////////////////////////////////////////////////////////////// // BSP frontend plugin // global flag for BSP frontend plugin is g_qeglobals.bBSPFrontendPlugin @@ -42,10 +47,18 @@ void Sys_SetTitle (char *text) } HCURSOR waitcursor; +#define TIMING_STATS +#ifdef TIMING_STATS +double start,end; +#endif void Sys_BeginWait (void) { waitcursor = SetCursor (LoadCursor (NULL, IDC_WAIT)); +#ifdef TIMING_STATS + Sys_Printf("Sys_BeginWait\n"); + start = Sys_DoubleTime(); +#endif } void Sys_EndWait (void) @@ -55,9 +68,12 @@ void Sys_EndWait (void) SetCursor (waitcursor); waitcursor = NULL; } +#ifdef TIMING_STATS + end = Sys_DoubleTime(); + Sys_Printf ("Sys_EndWait: %i ms\n", (int)(1000*(end-start))); +#endif } - void Sys_GetCursorPos (int *x, int *y) { POINT lpPoint; diff -rup ../Q3Radiant201/Win_main.cpp Q3Radiant/Win_main.cpp --- ../Q3Radiant201/Win_main.cpp Mon Jun 26 12:31:01 2000 +++ Q3Radiant/Win_main.cpp Thu Aug 3 17:19:24 2000 @@ -341,54 +341,6 @@ void RunBsp (char *command) Sleep (100); // give the new process a chance to open it's window BringWindowToTop( g_qeglobals.d_hwndMain ); // pop us back on top -#if 0 - // - // write qe3bsp.bat - // - sprintf (batpath, "%sqe3bsp.bat", temppath); - hFile = fopen(batpath, "w"); - if (!hFile) - Error ("Can't write to %s", batpath); - fprintf (hFile, sys); - fclose (hFile); - - // - // write qe3bsp2.bat - // - sprintf (batpath, "%sqe3bsp2.bat", temppath); - hFile = fopen(batpath, "w"); - if (!hFile) - Error ("Can't write to %s", batpath); - fprintf (hFile, "%sqe3bsp.bat > %s", temppath, outputpath); - fclose (hFile); - - Pointfile_Delete (); - - GetStartupInfo (&startupinfo); - - ret = CreateProcess( - batpath, // pointer to name of executable module - NULL, // pointer to command line string - NULL, // pointer to process security attributes - NULL, // pointer to thread security attributes - FALSE, // handle inheritance flag - 0 /*DETACHED_PROCESS*/, // creation flags - NULL, // pointer to new environment block - NULL, // pointer to current directory name - &startupinfo, // pointer to STARTUPINFO - &ProcessInformation // pointer to PROCESS_INFORMATION - ); - - if (!ret) - Error ("CreateProcess failed"); - - bsp_process = ProcessInformation.hProcess; - - Sleep (100); // give the new process a chance to open it's window - - //BringWindowToTop( g_qeglobals.d_hwndMain ); // pop us back on top - //SetFocus (g_qeglobals.d_hwndCamera); -#endif } }