Quake-III-Arena

Quake III Arena GPL Source Release
Log | Files | Refs

RADBSP.CPP (2497B)


      1 /*
      2 ===========================================================================
      3 Copyright (C) 1999-2005 Id Software, Inc.
      4 
      5 This file is part of Quake III Arena source code.
      6 
      7 Quake III Arena source code is free software; you can redistribute it
      8 and/or modify it under the terms of the GNU General Public License as
      9 published by the Free Software Foundation; either version 2 of the License,
     10 or (at your option) any later version.
     11 
     12 Quake III Arena source code is distributed in the hope that it will be
     13 useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 GNU General Public License for more details.
     16 
     17 You should have received a copy of the GNU General Public License
     18 along with Foobar; if not, write to the Free Software
     19 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
     20 ===========================================================================
     21 */
     22 //-----------------------------------------------------------------------------
     23 // #includes follow...
     24 //-----------------------------------------------------------------------------
     25 //
     26 #include "StdAfx.h"                       // For: Precompiled Headers
     27 //
     28 //-----------------------------------------------------------------------------
     29 // #defines, consts, etc follow...
     30 //-----------------------------------------------------------------------------
     31 //
     32 #ifdef _DEBUG
     33 #define new DEBUG_NEW
     34 #undef THIS_FILE
     35 static char THIS_FILE[] = __FILE__;
     36 #endif
     37 //
     38 //-----------------------------------------------------------------------------
     39 // Implementation follows...
     40 //-----------------------------------------------------------------------------
     41 //
     42 
     43 // msvc 5.xx does not do well optimizing this code
     44 #pragma optimize("",off)
     45 
     46 HINSTANCE g_hQBSPDLL = NULL;
     47 
     48 typedef void (WINAPI* PFN_QBSP)(char*, HWND, const char*);
     49 
     50 void RunTools(char* pCommandLine, HWND hwnd, const char* pPAKFile)
     51 {
     52   static PFN_QBSP lpfnQBSP = NULL;
     53   if (g_hQBSPDLL == NULL)
     54     g_hQBSPDLL = ::LoadLibrary("qbspdll.dll");
     55   else
     56   {
     57     ::FreeLibrary(g_hQBSPDLL);
     58     g_hQBSPDLL = ::LoadLibrary("qbspdll.dll");
     59     lpfnQBSP = NULL;
     60   }
     61   if (g_hQBSPDLL != NULL)
     62   {
     63     if (lpfnQBSP == NULL && g_hQBSPDLL != NULL)
     64     {
     65       FARPROC pFunction = ::GetProcAddress(g_hQBSPDLL, "FullProcess");
     66       lpfnQBSP = reinterpret_cast<PFN_QBSP>(pFunction);
     67     }
     68     if (lpfnQBSP != NULL)
     69     {
     70       (*lpfnQBSP)(pCommandLine, hwnd, pPAKFile);
     71     }
     72   }
     73 }
     74 
     75 
     76 #pragma optimize("",on)
     77