/* ============== CreateEntityWindow ============== */ BOOL CreateEntityWindow(HINSTANCE hInstance) { HWND hwndEntityPalette; inspector_mode = W_ENTITY; WEnt_Create (hInstance); hwndEntityPalette = CreateDialog(hInstance, (char *)IDD_ENTITY, g_qeglobals.d_hwndMain, (DLGPROC)NULL); if (!hwndEntityPalette) Error ("CreateDialog failed"); GetEntityControls (hwndEntityPalette); DestroyWindow (hwndEntityPalette); OldFieldWindowProc = (WNDPROC)GetWindowLong (hwndEnt[EntKeyField], GWL_WNDPROC); SetWindowLong (hwndEnt[EntKeyField], GWL_WNDPROC, (long)FieldWndProc); SetWindowLong (hwndEnt[EntValueField], GWL_WNDPROC, (long)FieldWndProc); OldEntityListWindowProc = (WNDPROC)GetWindowLong (hwndEnt[EntList], GWL_WNDPROC); SetWindowLong (hwndEnt[EntList], GWL_WNDPROC, (long)EntityListWndProc); FillClassList (); LoadWindowPlacement(g_qeglobals.d_hwndEntity, "EntityWindowPlace"); ShowWindow (g_qeglobals.d_hwndEntity, SW_HIDE); SetInspectorMode (W_CONSOLE); return TRUE; }
void QE_Init( void ){ /* ** initialize variables */ g_qeglobals.d_gridsize = 8; g_qeglobals.d_showgrid = true; QE_InitVFS(); Eclass_Init(); FillClassList(); // list in entity window Map_Init(); FillTextureMenu(); FillBSPMenu(); /* ** other stuff */ Z_Init(); }
/* =========== QE_LoadProject FIXME: the BuildShortPathName calls should be removed, it would get much more cleaner I don't have time to modify something so deep in the system, but this lead to a bug when loading .md3 see Win_ent.cpp AssignModel =========== */ qboolean QE_LoadProject (char *projectfile) { char *data; Sys_Printf ("QE_LoadProject (%s)\n", projectfile); if ( LoadFileNoCrash (projectfile, (void **)&data) == -1) return false; g_strProject = projectfile; CString strData = data; free(data); CString strQ2Path = g_PrefsDlg.m_strQuake2; CString strQ2File; ExtractPath_and_Filename(g_PrefsDlg.m_strQuake2, strQ2Path, strQ2File); AddSlash(strQ2Path); char* pBuff = new char[1024]; //BuildShortPathName(strQ2Path, pBuff, 1024); strcpy_s(pBuff, 1024,strQ2Path); // Jonathan: strcpy_s replaces BuildShortPathName FindReplace(strData, "__Q2PATH", pBuff); //BuildShortPathName(g_strAppPath, pBuff, 1024); strcpy_s(pBuff, 1024,g_strAppPath); // Jonathan: strcpy_s replaces BuildShortPathName FindReplace(strData, "__QERPATH", pBuff); char* pFile; if (GetFullPathName(projectfile, 1024, pBuff, &pFile)) { g_PrefsDlg.m_strLastProject = pBuff; //BuildShortPathName(g_PrefsDlg.m_strLastProject, pBuff, 1024); g_PrefsDlg.m_strLastProject = pBuff; g_PrefsDlg.SavePrefs(); ExtractPath_and_Filename(pBuff, strQ2Path, strQ2File); int nLen = strQ2Path.GetLength(); if (nLen > 0) { if (strQ2Path[nLen - 1] == '\\') strQ2Path.SetAt(nLen-1,'\0'); char* pBuffer = strQ2Path.GetBufferSetLength(_MAX_PATH + 1); int n = strQ2Path.ReverseFind('\\'); if (n >=0 ) pBuffer[n + 1] = '\0'; strQ2Path.ReleaseBuffer(); FindReplace(strData, "__QEPROJPATH", strQ2Path); } } StartTokenParsing (strData.GetBuffer(0)); g_qeglobals.d_project_entity = Entity_Parse (true); if (!g_qeglobals.d_project_entity) Error ("Couldn't parse project file: %s", projectfile); // add a version checking to avoid people loading later versions of the project file and bitching against me int ver = IntForKey( g_qeglobals.d_project_entity, "version" ); if (ver != 0) { char strMsg[1024]; sprintf( strMsg, "This is a version %d project file. This build only supports <=0 project files.\n" "Please choose another project file or upgrade your version of Radiant.", ver ); MessageBox( NULL, strMsg, "Can't load project file", MB_ICONERROR | MB_OK ); return false; } for (int i = 0; i < g_nPathFixupCount; i++) { char *pPath = ValueForKey (g_qeglobals.d_project_entity, g_pPathFixups[i]); if (pPath[0] != '\\' && pPath[0] != '/') { if (GetFullPathName(pPath, 1024, pBuff, &pFile)) { SetKeyValue(g_qeglobals.d_project_entity, g_pPathFixups[i], pBuff); } } } delete []pBuff; // set here some default project settings you need if ( strlen( ValueForKey( g_qeglobals.d_project_entity, "brush_primit" ) ) == 0 ) { SetKeyValue( g_qeglobals.d_project_entity, "brush_primit", "0" ); } g_qeglobals.m_bBrushPrimitMode = IntForKey( g_qeglobals.d_project_entity, "brush_primit" ); // usefull for the log file and debuggin f****d up configurations from users: // output the basic information of the .qe4 project file Sys_Printf("basepath : %s\n", ValueForKey( g_qeglobals.d_project_entity, "basepath") ); Sys_Printf("mapspath : %s\n", ValueForKey( g_qeglobals.d_project_entity, "mapspath") ); // the rsh command code is probably broken in these builds .. I would need ppl that actually use it .. // Sys_Printf("rshcmd : %s\n", ValueForKey( g_qeglobals.d_project_entity, "rshcmd" ) ); // Sys_Printf("remotebasepath : %s\n", ValueForKey( g_qeglobals.d_project_entity, "remotebasepath" ) ); Sys_Printf("entitypath : %s\n", ValueForKey( g_qeglobals.d_project_entity, "entitypath" ) ); Sys_Printf("texturepath : %s\n", ValueForKey( g_qeglobals.d_project_entity, "texturepath" ) ); Eclass_InitForSourceDirectory (ValueForKey (g_qeglobals.d_project_entity, "entitypath")); FillClassList(); // list in entity window Map_New(); FillTextureMenu(); FillBSPMenu(); return true; }