diff --git a/.github/workflows/.github.yml b/.github/workflows/.github.yml index af198d7f..26151361 100644 --- a/.github/workflows/.github.yml +++ b/.github/workflows/.github.yml @@ -14,6 +14,9 @@ jobs: - os: ubuntu-latest cc: clang cxx: clang++ + - os: windows-2016 + cc: cl + cxx: cl env: CC: ${{ matrix.cc }} CXX: ${{ matrix.cxx }} @@ -21,27 +24,39 @@ jobs: - name: Checkout uses: actions/checkout@v2 - - name: Get SDL2 headers + - name: Checkout steam-runtime + if: startsWith(matrix.os, 'ubuntu') uses: actions/checkout@v2 with: - repository: libsdl-org/SDL - ref: release-2.0.9 - path: SDL2 - - name: Link SDL2 headers into system path - run: | - sudo ln -s "$GITHUB_WORKSPACE/SDL2/include" /usr/local/include/SDL2 - - - name: Install dependencies + repository: ValveSoftware/steam-runtime + path: steam-runtime + - name: Cache steam-runtime + if: startsWith(matrix.os, 'ubuntu') + id: cache-steam-runtime + uses: actions/cache@v2 + with: + path: com.valvesoftware.SteamRuntime.Sdk-i386-scout-sysroot.tar.gz + key: ${{ runner.os }}-steam-runtime + - name: Download steam-runtime + if: startsWith(matrix.os, 'ubuntu') && steps.cache-steam-runtime.outputs.cache-hit != 'true' + run: wget --no-verbose https://repo.steampowered.com/steamrt-images-scout/snapshots/0.20210610.0/com.valvesoftware.SteamRuntime.Sdk-i386-scout-sysroot.tar.gz + - name: Install steam runtime if: startsWith(matrix.os, 'ubuntu') run: | - sudo apt-get -y install gcc-multilib g++-multilib + ./steam-runtime/setup_chroot.sh --i386 --tarball ./com.valvesoftware.SteamRuntime.Sdk-i386-scout-sysroot.tar.gz + sudo sed -i 's/groups=sudo/groups=adm/g' /etc/schroot/chroot.d/steamrt_scout_i386.conf - name: Build with xash3d-fwgs input + if: startsWith(matrix.os, 'ubuntu') run: | - cmake -B build -S . -DCMAKE_EXE_LINKER_FLAGS="-Wl,--no-undefined" && cmake --build build --target all + schroot --chroot steamrt_scout_i386 -- cmake -B build-fwgs -S . -DCMAKE_EXE_LINKER_FLAGS="-Wl,--no-undefined" + schroot --chroot steamrt_scout_i386 -- cmake --build build-fwgs --target all - name: Build with goldsource input + if: startsWith(matrix.os, 'ubuntu') run: | - cmake -B build-gs -S . -DCMAKE_EXE_LINKER_FLAGS="-Wl,--no-undefined" -DGOLDSOURCE_SUPPORT=ON && cmake --build build-gs --target all + schroot --chroot steamrt_scout_i386 -- cmake -B build -S . -DCMAKE_EXE_LINKER_FLAGS="-Wl,--no-undefined" -DGOLDSOURCE_SUPPORT=ON -DCMAKE_INSTALL_PREFIX="$PWD/dist" + schroot --chroot steamrt_scout_i386 -- cmake --build build --target all + schroot --chroot steamrt_scout_i386 -- cmake --build build --target install - name: Build with mingw if: startsWith(matrix.os, 'ubuntu') && startsWith(matrix.cc, 'gcc') @@ -50,3 +65,33 @@ jobs: cmake -B build-mingw -S . -DCMAKE_SYSTEM_NAME=Windows -DCMAKE_C_COMPILER=i686-w64-mingw32-gcc -DCMAKE_CXX_COMPILER=i686-w64-mingw32-g++ cmake --build build-mingw --target all + - name: Add msbuild to PATH + if: startsWith(matrix.os, 'windows') + uses: microsoft/setup-msbuild@v1.0.2 + - name: Build with msvc + if: startsWith(matrix.os, 'windows') + run: | + cmake -G "Visual Studio 15 2017" -B build -DGOLDSOURCE_SUPPORT=ON -DCMAKE_INSTALL_PREFIX="dist" + msbuild build/INSTALL.vcxproj + + - name: Extract branch name + shell: bash + run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/} | tr '/' '_')" + id: extract_branch + - name: Extract gamedir + shell: bash + run: echo "##[set-output name=gamedir;]$(grep build/CMakeCache.txt -Ee 'GAMEDIR:STRING=[a-z]+' | cut -d '=' -f 2)" + id: extract_gamedir + - name: Upload linux artifact + if: startsWith(matrix.os, 'ubuntu') && matrix.cc == 'gcc' + uses: actions/upload-artifact@v2 + with: + name: hlsdk-${{ steps.extract_branch.outputs.branch }}-linux + path: dist/${{ steps.extract_gamedir.outputs.gamedir }} + - name: Upload windows artifact + if: startsWith(matrix.os, 'windows') + uses: actions/upload-artifact@v2 + with: + name: hlsdk-${{ steps.extract_branch.outputs.branch }}-windows + path: dist/${{ steps.extract_gamedir.outputs.gamedir }} + diff --git a/.gitignore b/.gitignore index 3d6ad540..3e46defd 100644 --- a/.gitignore +++ b/.gitignore @@ -23,4 +23,6 @@ waf-* waf3-* .lock* *.pyc -.vscode/ \ No newline at end of file +.vscode/ +.vs/ +CMakeSettings.json \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 03d3a004..868c5e7f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,7 +20,7 @@ # SOFTWARE. # -cmake_minimum_required(VERSION 2.6.0) +cmake_minimum_required(VERSION 2.8.12) # Install custom module path set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/") @@ -93,6 +93,8 @@ endif() if(NOT MSVC) #add_compile_options(-Wempty-body) # GCC/Clang flag add_compile_options(-Wreturn-type) # GCC/Clang flag +else() + add_definitions(-D_CRT_SILENCE_NONCONFORMING_TGMATH_H) endif() diff --git a/appveyor.yml b/appveyor.yml index eb39ee2d..bb4ba61d 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,13 +1,7 @@ version: 1.0.{build} -branches: - only: - - master - environment: matrix: - - os: Visual Studio 2013 - GENERATOR_NAME: "Visual Studio 12 2013" - os: Visual Studio 2015 GENERATOR_NAME: "Visual Studio 14 2015" # TODO: Uncomment when AppVeyor will provide XP toolchain for VS2017 @@ -17,7 +11,7 @@ environment: clone_folder: c:\projects\xash\hlsdk-xash3d build: - project: INSTALL.vcxproj + project: build/INSTALL.vcxproj verbosity: normal configuration: @@ -25,4 +19,9 @@ configuration: before_build: - git submodule update --init --recursive - - cmake -G "%GENERATOR_NAME%" + - cmake -G "%GENERATOR_NAME%" -B build -DGOLDSOURCE_SUPPORT=ON -DCMAKE_INSTALL_PREFIX="dist" + +artifacts: + - path: dist + name: hlsdk-msvc + type: zip diff --git a/cl_dll/CMakeLists.txt b/cl_dll/CMakeLists.txt index 6da417cb..007f66ec 100644 --- a/cl_dll/CMakeLists.txt +++ b/cl_dll/CMakeLists.txt @@ -20,7 +20,7 @@ # SOFTWARE. # -cmake_minimum_required(VERSION 2.6.0) +cmake_minimum_required(VERSION 2.8.12) project (CLDLL) set (CLDLL_LIBRARY client) diff --git a/cl_dll/MOTD.cpp b/cl_dll/MOTD.cpp index 7947a15f..e186134f 100644 --- a/cl_dll/MOTD.cpp +++ b/cl_dll/MOTD.cpp @@ -66,7 +66,7 @@ int CHudMOTD::Draw( float fTime ) if( !m_bShow ) return 1; gHUD.m_iNoConsolePrint |= 1 << 1; - bool bScroll; + //bool bScroll; // find the top of where the MOTD should be drawn, so the whole thing is centered in the screen int ypos = ( ScreenHeight - LINE_HEIGHT * m_iLines ) / 2; // shift it up slightly char *ch = m_szMOTD; diff --git a/cl_dll/ammo.h b/cl_dll/ammo.h index 57c08805..bb2a7325 100644 --- a/cl_dll/ammo.h +++ b/cl_dll/ammo.h @@ -13,7 +13,7 @@ * ****/ #pragma once -#ifndef __AMMO_H__ +#if !defined(__AMMO_H__) #define __AMMO_H__ #define MAX_WEAPON_NAME 128 diff --git a/cl_dll/ammohistory.h b/cl_dll/ammohistory.h index 44edc916..c896941a 100644 --- a/cl_dll/ammohistory.h +++ b/cl_dll/ammohistory.h @@ -16,7 +16,7 @@ // ammohistory.h // #pragma once -#ifndef AMMOHISTORY_H +#if !defined(AMMOHISTORY_H) #define AMMOHISTORY_H // this is the max number of items in each bucket diff --git a/cl_dll/camera.h b/cl_dll/camera.h index 1ecb9563..1c196c51 100644 --- a/cl_dll/camera.h +++ b/cl_dll/camera.h @@ -8,7 +8,7 @@ // Camera.h -- defines and such for a 3rd person camera // NOTE: must include quakedef.h first #pragma once -#ifndef _CAMERA_H_ +#if !defined(_CAMERA_H_) #define _CAMERA_H_ // pitch, yaw, dist diff --git a/cl_dll/cdll_int.cpp b/cl_dll/cdll_int.cpp index a0540e48..de7d2d83 100644 --- a/cl_dll/cdll_int.cpp +++ b/cl_dll/cdll_int.cpp @@ -23,8 +23,8 @@ #include "netadr.h" #include "parsemsg.h" -#if defined(GOLDSOURCE_SUPPORT) && (defined(_WIN32) || defined(__linux__) || defined(__APPLE__)) && (defined(__i386) || defined(_M_IX86)) -#define USE_VGUI_FOR_GOLDSOURCE_SUPPORT +#if GOLDSOURCE_SUPPORT && (_WIN32 || __linux__ || __APPLE__) && (__i386 || _M_IX86) +#define USE_VGUI_FOR_GOLDSOURCE_SUPPORT 1 #include "VGUI_Panel.h" #include "VGUI_App.h" #endif @@ -192,7 +192,7 @@ int *HUD_GetRect( void ) return extent; } -#ifdef USE_VGUI_FOR_GOLDSOURCE_SUPPORT +#if USE_VGUI_FOR_GOLDSOURCE_SUPPORT class TeamFortressViewport : public vgui::Panel { public: @@ -247,7 +247,7 @@ so the HUD can reinitialize itself. int DLLEXPORT HUD_VidInit( void ) { gHUD.VidInit(); -#ifdef USE_VGUI_FOR_GOLDSOURCE_SUPPORT +#if USE_VGUI_FOR_GOLDSOURCE_SUPPORT vgui::Panel* root=(vgui::Panel*)gEngfuncs.VGui_GetPanel(); if (root) { gEngfuncs.Con_Printf( "Root VGUI panel exists\n" ); @@ -346,7 +346,7 @@ Called by engine every frame that client .dll is loaded void DLLEXPORT HUD_Frame( double time ) { -#ifdef USE_VGUI_FOR_GOLDSOURCE_SUPPORT +#if USE_VGUI_FOR_GOLDSOURCE_SUPPORT if (!gViewPort) gEngfuncs.VGui_ViewportPaintBackground(HUD_GetRect()); #else diff --git a/cl_dll/cl_dll.h b/cl_dll/cl_dll.h index e65a3d94..faf6d22d 100644 --- a/cl_dll/cl_dll.h +++ b/cl_dll/cl_dll.h @@ -26,7 +26,7 @@ // - Handling the custum HUD-update packets // #pragma once -#ifndef CL_DLL_H +#if !defined(CL_DLL_H) #define CL_DLL_H typedef unsigned char byte; typedef unsigned short word; @@ -39,7 +39,7 @@ typedef float vec_t; #include "../engine/cdll_int.h" #include "../dlls/cdll_dll.h" -#if !defined(_WIN32) +#if !_WIN32 #define _cdecl #endif #include "exportdef.h" @@ -49,8 +49,8 @@ typedef float vec_t; #else #include #endif -#if defined(__LP64__) || defined(__LLP64__) || defined(_WIN64) || (defined(__x86_64__) && !defined(__ILP32__) ) || defined(_M_X64) || defined(__ia64) || defined (_M_IA64) || defined(__aarch64__) || defined(__powerpc64__) - #define XASH_64BIT +#if __LP64__ || __LLP64__ || _WIN64 || (__x86_64__ && !__ILP32__) || _M_X64 || __ia64 || _M_IA64 || __aarch64__ || __powerpc64__ + #define XASH_64BIT 1 #endif extern cl_enginefunc_t gEngfuncs; diff --git a/cl_dll/cl_util.h b/cl_dll/cl_util.h index 7ba3bc7e..91615660 100644 --- a/cl_dll/cl_util.h +++ b/cl_dll/cl_util.h @@ -15,12 +15,12 @@ // // cl_util.h // -#ifndef CL_UTIL_H +#if !defined(CL_UTIL_H) #define CL_UTIL_H #include "exportdef.h" #include "cvardef.h" -#ifndef TRUE +#if !defined(TRUE) #define TRUE 1 #define FALSE 0 #endif @@ -108,7 +108,8 @@ inline int TextMessageDrawChar( int x, int y, int number, int r, int g, int b ) inline int DrawConsoleString( int x, int y, const char *string ) { if( hud_textmode->value == 1 ) - return gHUD.DrawHudString( x, y, 9999, (char*)string, 255 * g_hud_text_color[0], 255 * g_hud_text_color[1], 255 * g_hud_text_color[2] ); + return gHUD.DrawHudString( x, y, 9999, (char*)string, (int)( (float)g_hud_text_color[0] * 255.0f ), + (int)( (float)g_hud_text_color[1] * 255.0f ), (int)( (float)g_hud_text_color[2] * 255.0f ) ); return gEngfuncs.pfnDrawConsoleString( x, y, (char*) string ); } diff --git a/cl_dll/entity.cpp b/cl_dll/entity.cpp index 287894b8..e9b3d0f4 100644 --- a/cl_dll/entity.cpp +++ b/cl_dll/entity.cpp @@ -224,8 +224,8 @@ void DLLEXPORT HUD_TxferPredictionData( struct entity_state_s *ps, const struct } /* -//#define TEST_IT -#if defined( TEST_IT ) +//#define TEST_IT 1 +#if TEST_IT cl_entity_t mymodel[9]; @@ -267,8 +267,8 @@ void MoveModel( void ) } #endif -//#define TRACE_TEST -#if defined( TRACE_TEST ) +//#define TRACE_TEST 1 +#if TRACE_TEST extern int hitent; @@ -424,7 +424,7 @@ void TempEnts( void ) } */ -#if defined( BEAM_TEST ) +#if BEAM_TEST // Note can't index beam[0] in Beam callback, so don't use that index // Room for 1 beam ( 0 can't be used ) static cl_entity_t beams[2]; @@ -508,10 +508,10 @@ void DLLEXPORT HUD_CreateEntities( void ) // Load an appropriate model into it ( gEngfuncs.CL_LoadModel ) // Call gEngfuncs.CL_CreateVisibleEntity to add it to the visedicts list /* -#if defined( TEST_IT ) +#if TEST_IT MoveModel(); #endif -#if defined( TRACE_TEST ) +#if TRACE_TEST TraceModel(); #endif */ @@ -521,7 +521,7 @@ void DLLEXPORT HUD_CreateEntities( void ) /* TempEnts(); */ -#if defined( BEAM_TEST ) +#if BEAM_TEST Beams(); #endif // Add in any game specific objects @@ -940,7 +940,7 @@ Indices must start at 1, not zero. */ cl_entity_t DLLEXPORT *HUD_GetUserEntity( int index ) { -#if defined( BEAM_TEST ) +#if BEAM_TEST // None by default, you would return a valic pointer if you create a client side // beam and attach it to a client side entity. if( index > 0 && index <= 1 ) diff --git a/cl_dll/health.h b/cl_dll/health.h index 62d7e0bc..41375a69 100644 --- a/cl_dll/health.h +++ b/cl_dll/health.h @@ -13,7 +13,7 @@ * ****/ #pragma once -#ifndef HEALTH_H +#if !defined(HEALTH_H) #define HEALTH_H #define DMG_IMAGE_LIFE 2 // seconds that image is up diff --git a/cl_dll/hl/hl_weapons.cpp b/cl_dll/hl/hl_weapons.cpp index 5698ad2c..ca2c55b9 100644 --- a/cl_dll/hl/hl_weapons.cpp +++ b/cl_dll/hl/hl_weapons.cpp @@ -1062,7 +1062,7 @@ void _DLLEXPORT HUD_PostRunCmd( struct local_state_s *from, struct local_state_s { g_runfuncs = runfuncs; -#if defined( CLIENT_WEAPONS ) +#if CLIENT_WEAPONS if( cl_lw && cl_lw->value ) { HUD_WeaponsPostThink( from, to, cmd, time, random_seed ); diff --git a/cl_dll/hud.h b/cl_dll/hud.h index ba43138c..2ec3ff9e 100644 --- a/cl_dll/hud.h +++ b/cl_dll/hud.h @@ -20,7 +20,7 @@ // CHud handles the message, calculation, and drawing the HUD // #pragma once -#ifndef HUD_H +#if !defined(HUD_H) #define HUD_H #define FOG_LIMIT 30000 #define RGB_YELLOWISH 0x00FFA000 //255,160,0 diff --git a/cl_dll/hud_spectator.h b/cl_dll/hud_spectator.h index 9b3391e2..d7187d49 100644 --- a/cl_dll/hud_spectator.h +++ b/cl_dll/hud_spectator.h @@ -6,7 +6,7 @@ //============================================================================= #pragma once -#ifndef HUD_SPECTATOR_H +#if !defined(HUD_SPECTATOR_H) #define HUD_SPECTATOR_H #include "cl_entity.h" diff --git a/cl_dll/in_camera.cpp b/cl_dll/in_camera.cpp index ad5ec8bf..5e499ef4 100644 --- a/cl_dll/in_camera.cpp +++ b/cl_dll/in_camera.cpp @@ -459,7 +459,7 @@ void CAM_OutUp( void ) void CAM_ToThirdPerson( void ) { vec3_t viewangles; -#if !defined( _DEBUG ) +#if !_DEBUG if( gEngfuncs.GetMaxClients() > 1 ) { // no thirdperson in multiplayer. diff --git a/cl_dll/input_goldsource.cpp b/cl_dll/input_goldsource.cpp index 8698a5d3..bf029639 100644 --- a/cl_dll/input_goldsource.cpp +++ b/cl_dll/input_goldsource.cpp @@ -10,7 +10,7 @@ #include "input_mouse.h" -#ifdef SUPPORT_GOLDSOURCE_INPUT +#if SUPPORT_GOLDSOURCE_INPUT #include "hud.h" #include "cl_util.h" @@ -24,10 +24,10 @@ #include "view.h" #if !_WIN32 -#define USE_SDL2 +#define USE_SDL2 1 #endif -#ifdef USE_SDL2 +#if USE_SDL2 #define ARRAYSIZE(p) ( sizeof(p) /sizeof(p[0]) ) #include #include @@ -218,7 +218,7 @@ enum _ControlList AxisTurn }; -#if !defined(USE_SDL2) && defined(_WIN32) +#if !USE_SDL2 && _WIN32 DWORD dwAxisFlags[JOY_MAX_AXES] = { JOY_RETURNX, @@ -232,9 +232,9 @@ DWORD dwAxisFlags[JOY_MAX_AXES] = DWORD dwAxisMap[ JOY_MAX_AXES ]; DWORD dwControlMap[ JOY_MAX_AXES ]; -#if defined(USE_SDL2) +#if USE_SDL2 int pdwRawValue[ JOY_MAX_AXES ]; -#elif defined(_WIN32) +#elif _WIN32 PDWORD pdwRawValue[ JOY_MAX_AXES ]; #endif DWORD joy_oldbuttonstate, joy_oldpovstate; @@ -242,9 +242,9 @@ DWORD joy_oldbuttonstate, joy_oldpovstate; int joy_id; DWORD joy_numbuttons; -#ifdef USE_SDL2 +#if USE_SDL2 SDL_GameController *s_pJoystick = NULL; -#elif defined(_WIN32) +#elif _WIN32 DWORD joy_flags; static JOYINFOEX ji; #endif @@ -566,7 +566,7 @@ void GoldSourceInput::IN_Shutdown (void) } #endif -#ifdef USE_SDL2 +#if USE_SDL2 for (int j=0; j 0 ) { @@ -1029,7 +1029,7 @@ void IN_StartupJoystick (void) { gEngfuncs.Con_DPrintf ("joystick not found -- driver not present\n\n"); } -#elif defined(_WIN32) +#elif _WIN32 int numdevs; JOYCAPS jc; MMRESULT mmr; @@ -1084,7 +1084,7 @@ void IN_StartupJoystick (void) #endif } -#ifdef USE_SDL2 +#if USE_SDL2 int RawValuePointer (int axis) { switch (axis) @@ -1101,7 +1101,7 @@ int RawValuePointer (int axis) } } -#elif defined(_WIN32) +#elif _WIN32 PDWORD RawValuePointer (int axis) { switch (axis) @@ -1184,7 +1184,7 @@ void Joy_AdvancedUpdate_f (void) dwControlMap[JOY_AXIS_V] = dwTemp & JOY_RELATIVE_AXIS; } -#if !defined(USE_SDL2) && defined(_WIN32) +#if !USE_SDL2 && _WIN32 // compute the axes to collect from DirectInput joy_flags = JOY_RETURNCENTERED | JOY_RETURNBUTTONS | JOY_RETURNPOV; for (i = 0; i < JOY_MAX_AXES; i++) @@ -1216,7 +1216,7 @@ void GoldSourceInput::IN_Commands (void) // loop through the joystick buttons // key a joystick event or auxillary event for higher number buttons for each state change -#ifdef USE_SDL2 +#if USE_SDL2 buttonstate = 0; for ( i = 0; i < SDL_CONTROLLER_BUTTON_MAX; i++ ) { @@ -1230,7 +1230,7 @@ void GoldSourceInput::IN_Commands (void) { pdwRawValue[i] = RawValuePointer(i); } -#elif defined(_WIN32) +#elif _WIN32 buttonstate = ji.dwButtons; #endif @@ -1256,7 +1256,7 @@ void GoldSourceInput::IN_Commands (void) // this avoids any potential problems related to moving from one // direction to another without going through the center position povstate = 0; -#if !defined(USE_SDL2) && defined(_WIN32) +#if !USE_SDL2 && _WIN32 if(ji.dwPOV != JOY_POVCENTERED) { if (ji.dwPOV == JOY_POVFORWARD) @@ -1294,10 +1294,10 @@ IN_ReadJoystick */ int IN_ReadJoystick (void) { -#ifdef USE_SDL2 +#if USE_SDL2 safe_pfnSDL_JoystickUpdate(); return 1; -#elif defined(_WIN32) +#elif _WIN32 memset (&ji, 0, sizeof(ji)); ji.dwSize = sizeof(ji); ji.dwFlags = joy_flags; @@ -1374,9 +1374,9 @@ void IN_JoyMove ( float frametime, usercmd_t *cmd ) for (i = 0; i < JOY_MAX_AXES; i++) { // get the floating point zero-centered, potentially-inverted data for the current axis -#ifdef USE_SDL2 +#if USE_SDL2 fAxisValue = (float)pdwRawValue[i]; -#elif defined(_WIN32) +#elif _WIN32 fAxisValue = (float) *pdwRawValue[i]; fAxisValue -= 32768.0; #endif @@ -1600,7 +1600,7 @@ void GoldSourceInput::IN_Init (void) } #endif -#ifdef USE_SDL2 +#if USE_SDL2 #if __APPLE__ #define SDL2_FULL_LIBNAME "libsdl2-2.0.0.dylib" #else diff --git a/cl_dll/input_mouse.cpp b/cl_dll/input_mouse.cpp index 3233d797..c5b1df6b 100644 --- a/cl_dll/input_mouse.cpp +++ b/cl_dll/input_mouse.cpp @@ -10,7 +10,7 @@ cvar_t *in_joystick; FWGSInput fwgsInput; -#ifdef SUPPORT_GOLDSOURCE_INPUT +#if SUPPORT_GOLDSOURCE_INPUT GoldSourceInput goldSourceInput; AbstractInput* currentInput = &goldSourceInput; #else @@ -68,7 +68,7 @@ void IN_Shutdown( void ) void IN_Init( void ) { -#ifdef SUPPORT_GOLDSOURCE_INPUT +#if SUPPORT_GOLDSOURCE_INPUT if (IsXashFWGS()) { gEngfuncs.Con_Printf( "FWGS Xash3D input is in use\n" ); currentInput = &fwgsInput; diff --git a/cl_dll/input_mouse.h b/cl_dll/input_mouse.h index c13b7fa2..f8e2c631 100644 --- a/cl_dll/input_mouse.h +++ b/cl_dll/input_mouse.h @@ -1,5 +1,5 @@ #pragma once -#ifndef INPUT_MOUSE_H +#if !defined(INPUT_MOUSE_H) #define INPUT_MOUSE_H #include "cl_dll.h" #include "usercmd.h" @@ -45,8 +45,8 @@ protected: }; // No need for goldsource input support on the platforms that are not supported by GoldSource. -#if defined(GOLDSOURCE_SUPPORT) && (defined(_WIN32) || defined(__linux__) || defined(__APPLE__)) && (defined(__i386) || defined(_M_IX86)) -#define SUPPORT_GOLDSOURCE_INPUT +#if GOLDSOURCE_SUPPORT && (_WIN32 || __linux__ || __APPLE__) && (__i386 || _M_IX86) +#define SUPPORT_GOLDSOURCE_INPUT 1 class GoldSourceInput : public AbstractInput { public: diff --git a/cl_dll/overview.h b/cl_dll/overview.h index c1675e98..4c1dc4d8 100644 --- a/cl_dll/overview.h +++ b/cl_dll/overview.h @@ -4,9 +4,8 @@ // // $NoKeywords: $ //============================================================================= - #pragma once -#ifndef OVERVIEW_H +#if !defined(OVERVIEW_H) #define OVERVIEW_H //----------------------------------------------------------------------------- diff --git a/cl_dll/parsemsg.h b/cl_dll/parsemsg.h index 05efefc3..a37a100a 100644 --- a/cl_dll/parsemsg.h +++ b/cl_dll/parsemsg.h @@ -16,7 +16,7 @@ // parsemsg.h // #pragma once -#ifndef PARSEMSG_H +#if !defined(PARSEMSG_H) #define PARSEMSG_H #define ASSERT( x ) diff --git a/cl_dll/studio_util.h b/cl_dll/studio_util.h index 12d165c5..de54d440 100644 --- a/cl_dll/studio_util.h +++ b/cl_dll/studio_util.h @@ -4,20 +4,19 @@ // // $NoKeywords: $ //============================================================================= - #pragma once -#if !defined( STUDIO_UTIL_H ) +#if !defined(STUDIO_UTIL_H) #define STUDIO_UTIL_H -#ifndef M_PI +#if !defined(M_PI) #define M_PI 3.14159265358979323846 // matches value in gcc v2 math.h #endif -#ifndef M_PI_F +#if !defined(M_PI_F) #define M_PI_F (float)M_PI #endif -#ifndef PITCH +#if !defined(PITCH) // MOVEMENT INFO // up / down #define PITCH 0 diff --git a/cl_dll/tf_defs.h b/cl_dll/tf_defs.h index ba7ae0f9..e445f2fc 100644 --- a/cl_dll/tf_defs.h +++ b/cl_dll/tf_defs.h @@ -7,8 +7,7 @@ * All Rights Reserved. * ****/ - -#ifndef __TF_DEFS_H +#if !defined(__TF_DEFS_H) #define __TF_DEFS_H //=========================================================================== @@ -1155,7 +1154,7 @@ float already_chosen_map; #define TS_PRINT_LONG 2 #define TS_PRINT_LONG_TO_ALL 3 -#ifndef TF_DEFS_ONLY +#if !defined(TF_DEFS_ONLY) typedef struct { diff --git a/cl_dll/tri.cpp b/cl_dll/tri.cpp index 12cb93b0..2c646109 100644 --- a/cl_dll/tri.cpp +++ b/cl_dll/tri.cpp @@ -121,8 +121,8 @@ void CShinySurface::Draw(const vec3_t &org) //LRCT -//#define TEST_IT -#if defined( TEST_IT ) +//#define TEST_IT 1 +#if TEST_IT /* ================= @@ -218,7 +218,7 @@ Non-transparent triangles-- add them here void DLLEXPORT HUD_DrawNormalTriangles( void ) { gHUD.m_Spectator.DrawOverview(); -#if defined( TEST_IT ) +#if TEST_IT // Draw_Triangles(); #endif } @@ -234,6 +234,7 @@ extern ParticleSystemManager* g_pParticleSystems; // LRC void DLLEXPORT HUD_DrawTransparentTriangles( void ) { +<<<<<<< HEAD BlackFog(); //22/03/03 LRC: shiny surfaces @@ -249,6 +250,9 @@ void DLLEXPORT HUD_DrawTransparentTriangles( void ) g_pParticleSystems->UpdateSystems(fTime - fOldTime); #if defined( TEST_IT ) +======= +#if TEST_IT +>>>>>>> master // Draw_Triangles(); #endif } diff --git a/cl_dll/util.cpp b/cl_dll/util.cpp index 33e68070..7d6b6669 100644 --- a/cl_dll/util.cpp +++ b/cl_dll/util.cpp @@ -26,17 +26,17 @@ #include "cl_util.h" #include -#ifndef M_PI +#if !defined(M_PI) #define M_PI 3.14159265358979323846 // matches value in gcc v2 math.h #endif -#ifndef M_PI_F +#if !defined(M_PI_F) #define M_PI_F (float)M_PI #endif extern vec3_t vec3_origin; // if C++ mangling differs from C symbol name -#if defined _MSC_VER || defined __WATCOMC__ +#if _MSC_VER || __WATCOMC__ vec3_t vec3_origin; #endif diff --git a/cl_dll/util_vector.h b/cl_dll/util_vector.h index c83d347f..6d900446 100644 --- a/cl_dll/util_vector.h +++ b/cl_dll/util_vector.h @@ -16,7 +16,7 @@ // A subset of the extdll.h in the project HL Entity DLL // #pragma once -#ifndef UTIL_VECTOR_H +#if !defined(UTIL_VECTOR_H) #define UTIL_VECTOR_H // Misc C-runtime library headers diff --git a/cl_dll/view.cpp b/cl_dll/view.cpp index 62476b3d..bcc70932 100644 --- a/cl_dll/view.cpp +++ b/cl_dll/view.cpp @@ -36,11 +36,11 @@ extern "C" int iIsSpectator; } -#ifndef M_PI +#if !defined(M_PI) #define M_PI 3.14159265358979323846 // matches value in gcc v2 math.h #endif -#ifndef M_PI_F +#if !defined(M_PI_F) #define M_PI_F (float)M_PI #endif @@ -1584,8 +1584,8 @@ void DLLEXPORT V_CalcRefdef( struct ref_params_s *pparams ) } /* // Example of how to overlay the whole screen with red at 50 % alpha -#define SF_TEST -#if defined SF_TEST +#define SF_TEST 1 +#if SF_TEST { screenfade_t sf; gEngfuncs.pfnGetScreenFade( &sf ); @@ -1651,8 +1651,8 @@ void V_Init( void ) cl_chasedist = gEngfuncs.pfnRegisterVariable( "cl_chasedist","112", 0 ); } -//#define TRACE_TEST -#if defined( TRACE_TEST ) +//#define TRACE_TEST 1 +#if TRACE_TEST extern float in_fov; /* diff --git a/common/beamdef.h b/common/beamdef.h index f254428c..c578dded 100644 --- a/common/beamdef.h +++ b/common/beamdef.h @@ -13,7 +13,7 @@ * ****/ #pragma once -#ifndef BEAMDEF_H +#if !defined(BEAMDEF_H) #define BEAMDEF_H #define FBEAM_STARTENTITY 0x00000001 diff --git a/common/cl_entity.h b/common/cl_entity.h index c003ce30..d5323aa1 100644 --- a/common/cl_entity.h +++ b/common/cl_entity.h @@ -13,7 +13,7 @@ * ****/ #pragma once -#ifndef CL_ENTITY_H +#if !defined(CL_ENTITY_H) #define CL_ENTITY_H typedef struct efrag_s diff --git a/common/com_model.h b/common/com_model.h index 7cee652c..6c8da0c4 100644 --- a/common/com_model.h +++ b/common/com_model.h @@ -4,7 +4,6 @@ // // $NoKeywords: $ //============================================================================= - // com_model.h #pragma once #if !defined( COM_MODEL_H ) @@ -46,7 +45,7 @@ typedef enum } modtype_t; // must match definition in modelgen.h -#ifndef SYNCTYPE_T +#if !defined(SYNCTYPE_T) #define SYNCTYPE_T typedef enum diff --git a/common/con_nprint.h b/common/con_nprint.h index ebc583b5..b652758c 100644 --- a/common/con_nprint.h +++ b/common/con_nprint.h @@ -13,7 +13,7 @@ * ****/ #pragma once -#ifndef CON_NPRINT_H +#if !defined(CON_NPRINT_H) #define CON_NPRINT_H typedef struct con_nprint_s diff --git a/common/const.h b/common/const.h index 9be44f10..587484c2 100644 --- a/common/const.h +++ b/common/const.h @@ -13,7 +13,7 @@ * ****/ #pragma once -#ifndef CONST_H +#if !defined(CONST_H) #define CONST_H // // Constants shared by the engine and dlls @@ -749,7 +749,7 @@ typedef unsigned short word; #undef true #undef false -#ifndef __cplusplus +#if !__cplusplus typedef enum { false, true } qboolean; #else typedef int qboolean; diff --git a/common/cvardef.h b/common/cvardef.h index f461c329..1d55f7ca 100644 --- a/common/cvardef.h +++ b/common/cvardef.h @@ -13,7 +13,7 @@ * ****/ #pragma once -#ifndef CVARDEF_H +#if !defined(CVARDEF_H) #define CVARDEF_H #define FCVAR_ARCHIVE (1<<0) // set to cause it to be saved to vars.rc diff --git a/common/demo_api.h b/common/demo_api.h index 53373e11..6e73adb2 100644 --- a/common/demo_api.h +++ b/common/demo_api.h @@ -13,7 +13,7 @@ * ****/ #pragma once -#ifndef DEMO_API_H +#if !defined(DEMO_API_H) #define DEMO_API_H typedef struct demo_api_s diff --git a/common/dlight.h b/common/dlight.h index ecb01445..6cfab021 100644 --- a/common/dlight.h +++ b/common/dlight.h @@ -13,7 +13,7 @@ * ****/ #pragma once -#ifndef DLIGHT_H +#if !defined(DLIGHT_H) #define DLIGHT_H typedef struct dlight_s diff --git a/common/entity_state.h b/common/entity_state.h index 2ffd70dc..51a807e9 100644 --- a/common/entity_state.h +++ b/common/entity_state.h @@ -13,7 +13,7 @@ * ****/ #pragma once -#ifndef ENTITY_STATE_H +#if !defined(ENTITY_STATE_H) #define ENTITY_STATE_H // For entityType below diff --git a/common/entity_types.h b/common/entity_types.h index f5754fea..ec54ba26 100644 --- a/common/entity_types.h +++ b/common/entity_types.h @@ -13,7 +13,7 @@ * ****/ #pragma once -#ifndef ENTITY_TYPES_H +#if !defined(ENTITY_TYPES_H) #define ENTITY_TYPES_H #define ET_NORMAL 0 diff --git a/common/event_api.h b/common/event_api.h index 86c5fbe9..43cb3b62 100644 --- a/common/event_api.h +++ b/common/event_api.h @@ -13,7 +13,7 @@ * ****/ #pragma once -#ifndef EVENT_API_H +#if !defined(EVENT_API_H) #define EVENT_API_H #define EVENT_API_VERSION 1 diff --git a/common/event_args.h b/common/event_args.h index 4cf63741..07cd39cd 100644 --- a/common/event_args.h +++ b/common/event_args.h @@ -13,7 +13,7 @@ * ****/ #pragma once -#ifndef EVENT_ARGS_H +#if !defined(EVENT_ARGS_H) #define EVENT_ARGS_H // Event was invoked with stated origin diff --git a/common/event_flags.h b/common/event_flags.h index a2d5f3b7..c3f1789f 100644 --- a/common/event_flags.h +++ b/common/event_flags.h @@ -13,7 +13,7 @@ * ****/ #pragma once -#ifndef EVENT_FLAGS_H +#if !defined(EVENT_FLAGS_H) #define EVENT_FLAGS_H // Skip local host for event send. diff --git a/common/hltv.h b/common/hltv.h index e64dd30b..970c4861 100644 --- a/common/hltv.h +++ b/common/hltv.h @@ -13,7 +13,7 @@ * ****/ #pragma once -#ifndef HLTV_H +#if !defined(HLTV_H) #define HLTV_H #define TYPE_CLIENT 0 // client is a normal HL client (default) diff --git a/common/ivoicetweak.h b/common/ivoicetweak.h index 96879beb..d3fd7ed4 100644 --- a/common/ivoicetweak.h +++ b/common/ivoicetweak.h @@ -13,7 +13,7 @@ * ****/ #pragma once -#ifndef IVOICETWEAK_H +#if !defined(IVOICETWEAK_H) #define IVOICETWEAK_H // These provide access to the voice controls. diff --git a/common/mathlib.h b/common/mathlib.h index 9756f0ad..452e11e6 100644 --- a/common/mathlib.h +++ b/common/mathlib.h @@ -14,11 +14,11 @@ ****/ // mathlib.h #pragma once -#ifndef MATHLIB_H +#if !defined(MATHLIB_H) #define MATHLIB_H -#ifndef __cplusplus +#if !__cplusplus #include -#ifdef HAVE_TGMATH_H +#if HAVE_TGMATH_H #include #endif // HAVE_TGMATH_H #else // __cplusplus @@ -42,17 +42,17 @@ typedef int fixed8_t; typedef int fixed16_t; typedef vec_t vec2_t[2]; -#if !defined DID_VEC3_T_DEFINE +#if !defined(DID_VEC3_T_DEFINE) #define DID_VEC3_T_DEFINE typedef vec_t vec3_t[3]; #endif -#ifndef M_PI +#if !defined(M_PI) #define M_PI 3.14159265358979323846 // matches value in gcc v2 math.h #endif -#ifndef M_PI_F +#if !defined(M_PI_F) #define M_PI_F (float)M_PI #endif @@ -63,7 +63,7 @@ extern int nanmask; #define IS_NAN(x) (((*(int *)&x)&nanmask)==nanmask) -#ifndef VECTOR_H +#if !defined(VECTOR_H) #define DotProduct(x,y) ((x)[0]*(y)[0]+(x)[1]*(y)[1]+(x)[2]*(y)[2]) #endif diff --git a/common/net_api.h b/common/net_api.h index da18fc30..eccfc86b 100644 --- a/common/net_api.h +++ b/common/net_api.h @@ -13,7 +13,7 @@ * ****/ #pragma once -#ifndef NET_API_H +#if !defined(NET_API_H) #define NET_API_H #include "netadr.h" diff --git a/common/netadr.h b/common/netadr.h index 0d70a22b..9f72921d 100644 --- a/common/netadr.h +++ b/common/netadr.h @@ -13,7 +13,7 @@ * ****/ #pragma once -#ifndef NETADR_H +#if !defined(NETADR_H) #define NETADR_H typedef enum diff --git a/common/particledef.h b/common/particledef.h index 15c95feb..c8b972e7 100644 --- a/common/particledef.h +++ b/common/particledef.h @@ -13,7 +13,7 @@ * ****/ #pragma once -#ifndef PARTICLEDEF_H +#if !defined(PARTICLEDEF_H) #define PARTICLEDEF_H typedef enum diff --git a/common/pmtrace.h b/common/pmtrace.h index d5dd1453..dbf59026 100644 --- a/common/pmtrace.h +++ b/common/pmtrace.h @@ -13,7 +13,7 @@ * ****/ #pragma once -#ifndef PM_TRACE_H +#if !defined(PM_TRACE_H) #define PM_TRACE_H typedef struct diff --git a/common/qfont.h b/common/qfont.h index beb36ff9..589a9398 100644 --- a/common/qfont.h +++ b/common/qfont.h @@ -13,7 +13,7 @@ * ****/ #pragma once -#ifndef QFONT_H +#if !defined(QFONT_H) #define QFONT_H // Font stuff diff --git a/common/r_efx.h b/common/r_efx.h index 1a55aa0b..0ed52ad3 100644 --- a/common/r_efx.h +++ b/common/r_efx.h @@ -13,7 +13,7 @@ * ****/ #pragma once -#ifndef R_EFX_H +#if !defined(R_EFX_H) #define R_EFX_H // particle_t diff --git a/common/r_studioint.h b/common/r_studioint.h index b17e826f..d3cb82f5 100644 --- a/common/r_studioint.h +++ b/common/r_studioint.h @@ -13,7 +13,7 @@ * ****/ #pragma once -#ifndef R_STUDIOINT_H +#if !defined(R_STUDIOINT_H) #define R_STUDIOINT_H #define STUDIO_INTERFACE_VERSION 1 diff --git a/common/ref_params.h b/common/ref_params.h index 61527eca..d804f8b8 100644 --- a/common/ref_params.h +++ b/common/ref_params.h @@ -13,7 +13,7 @@ * ****/ #pragma once -#ifndef REF_PARAMS_H +#if !defined(REF_PARAMS_H) #define REF_PARAMS_H typedef struct ref_params_s diff --git a/common/screenfade.h b/common/screenfade.h index 1611f914..8555e812 100644 --- a/common/screenfade.h +++ b/common/screenfade.h @@ -13,7 +13,7 @@ * ****/ #pragma once -#ifndef SCREENFADE_H +#if !defined(SCREENFADE_H) #define SCREENFADE_H typedef struct screenfade_s diff --git a/common/studio_event.h b/common/studio_event.h index cf21e82a..33878a69 100644 --- a/common/studio_event.h +++ b/common/studio_event.h @@ -13,7 +13,7 @@ * ****/ #pragma once -#ifndef STUDIO_EVENT_H +#if !defined(STUDIO_EVENT_H) #define STUDIO_EVENT_H typedef struct mstudioevent_s diff --git a/common/triangleapi.h b/common/triangleapi.h index 49dc919f..801154e3 100644 --- a/common/triangleapi.h +++ b/common/triangleapi.h @@ -13,7 +13,7 @@ * ****/ #pragma once -#ifndef TRIANGLEAPI_H +#if !defined(TRIANGLEAPI_H) #define TRIANGLEAPI_H typedef enum diff --git a/common/usercmd.h b/common/usercmd.h index 538c60a6..581662b7 100644 --- a/common/usercmd.h +++ b/common/usercmd.h @@ -13,7 +13,7 @@ * ****/ #pragma once -#ifndef USERCMD_H +#if !defined(USERCMD_H) #define USERCMD_H typedef struct usercmd_s diff --git a/common/wadfile.h b/common/wadfile.h index 84ffbb2d..a3b8efeb 100644 --- a/common/wadfile.h +++ b/common/wadfile.h @@ -13,7 +13,7 @@ * ****/ #pragma once -#ifndef WADFILE_H +#if !defined(WADFILE_H) #define WADFILE_H /* diff --git a/common/weaponinfo.h b/common/weaponinfo.h index b94857b6..8625103a 100644 --- a/common/weaponinfo.h +++ b/common/weaponinfo.h @@ -13,7 +13,7 @@ * ****/ #pragma once -#ifndef WEAPONINFO_H +#if !defined(WEAPONINFO_H) #define WEAPONINFO_H // Info about weapons player might have in his/her possession diff --git a/dlls/CMakeLists.txt b/dlls/CMakeLists.txt index b9353829..cf9525db 100644 --- a/dlls/CMakeLists.txt +++ b/dlls/CMakeLists.txt @@ -20,7 +20,7 @@ # SOFTWARE. # -cmake_minimum_required(VERSION 2.6.0) +cmake_minimum_required(VERSION 2.8.12) project (SVDLL) set (SVDLL_LIBRARY server) @@ -153,6 +153,12 @@ set (SVDLL_SOURCES ) include_directories (. wpn_shared ../common ../engine ../pm_shared ../game_shared ../public shall) +if(MSVC) + set(SVDLL_SOURCES + ${SVDLL_SOURCES} + hl.def) +endif() + if(USE_VOICEMGR) set(SVDLL_SOURCES ${SVDLL_SOURCES} diff --git a/dlls/activity.h b/dlls/activity.h index 90d85a08..b13cf522 100644 --- a/dlls/activity.h +++ b/dlls/activity.h @@ -13,7 +13,7 @@ * ****/ #pragma once -#ifndef ACTIVITY_H +#if !defined(ACTIVITY_H) #define ACTIVITY_H typedef enum { diff --git a/dlls/activitymap.h b/dlls/activitymap.h index b5f789f9..8255edf0 100644 --- a/dlls/activitymap.h +++ b/dlls/activitymap.h @@ -13,7 +13,7 @@ * ****/ #pragma once -#ifndef ACTIVITYMAP_H +#if !defined(ACTIVITYMAP_H) #define ACTIVITYMAP_H #define _A( a ) { a, #a } diff --git a/dlls/animation.cpp b/dlls/animation.cpp index 604ae4d8..13d3edaa 100644 --- a/dlls/animation.cpp +++ b/dlls/animation.cpp @@ -36,21 +36,21 @@ typedef unsigned char byte; #include "studio.h" -#ifndef ACTIVITY_H +#if !defined(ACTIVITY_H) #include "activity.h" #endif #include "activitymap.h" -#ifndef ANIMATION_H +#if !defined(ANIMATION_H) #include "animation.h" #endif -#ifndef SCRIPTEVENT_H +#if !defined(SCRIPTEVENT_H) #include "scriptevent.h" #endif -#ifndef ENGINECALLBACK_H +#if !defined(ENGINECALLBACK_H) #include "enginecallback.h" #endif diff --git a/dlls/animation.h b/dlls/animation.h index 03dab86b..e8a333d3 100644 --- a/dlls/animation.h +++ b/dlls/animation.h @@ -13,12 +13,12 @@ * ****/ #pragma once -#ifndef ANIMATION_H +#if !defined(ANIMATION_H) #define ANIMATION_H #define ACTIVITY_NOT_AVAILABLE -1 -#ifndef MONSTEREVENT_H +#if !defined(MONSTEREVENT_H) #include "monsterevent.h" #endif diff --git a/dlls/basemonster.h b/dlls/basemonster.h index 3ccde338..6c217fd6 100644 --- a/dlls/basemonster.h +++ b/dlls/basemonster.h @@ -13,7 +13,7 @@ * ****/ #pragma once -#ifndef BASEMONSTER_H +#if !defined(BASEMONSTER_H) #define BASEMONSTER_H // diff --git a/dlls/cbase.h b/dlls/cbase.h index 0b264a2b..2d09b116 100644 --- a/dlls/cbase.h +++ b/dlls/cbase.h @@ -13,7 +13,7 @@ * ****/ #pragma once -#ifndef CBASE_H +#if !defined(CBASE_H) #define CBASE_H /* @@ -58,7 +58,7 @@ CBaseEntity #include "saverestore.h" #include "schedule.h" -#ifndef MONSTEREVENT_H +#if !defined(MONSTEREVENT_H) #include "monsterevent.h" #endif diff --git a/dlls/cdll_dll.h b/dlls/cdll_dll.h index 228ed94d..65e34c81 100644 --- a/dlls/cdll_dll.h +++ b/dlls/cdll_dll.h @@ -17,7 +17,7 @@ // this file is included by both the game-dll and the client-dll, #pragma once -#ifndef CDLL_DLL_H +#if !defined(CDLL_DLL_H) #define CDLL_DLL_H #define MAX_WEAPONS 32 // ??? diff --git a/dlls/client.cpp b/dlls/client.cpp index 4878693c..4ac7732d 100644 --- a/dlls/client.cpp +++ b/dlls/client.cpp @@ -273,7 +273,7 @@ decodeError: uValueOut = '?'; bErrorOut = true; return nBytes; - +#if 0 decodeFinishedMaybeCESU8: // Do we have a full UTF-16 surrogate pair that's been UTF-8 encoded afterwards? // That is, do we have 0xD800-0xDBFF followed by 0xDC00-0xDFFF? If so, decode it all. @@ -284,6 +284,7 @@ decodeFinishedMaybeCESU8: uMinValue = 0x10000; } goto decodeFinished; +#endif } //----------------------------------------------------------------------------- @@ -320,7 +321,7 @@ void Host_Say( edict_t *pEntity, int teamonly ) { CBasePlayer *client; int j; - char *p, *pc; + char *p; //, *pc; char text[128]; char szTemp[256]; const char *cpSay = "say"; diff --git a/dlls/client.h b/dlls/client.h index 6feaac1a..73bc0dc5 100644 --- a/dlls/client.h +++ b/dlls/client.h @@ -13,7 +13,7 @@ * ****/ #pragma once -#ifndef CLIENT_H +#if !defined(CLIENT_H) #define CLIENT_H extern void respawn( entvars_t *pev, BOOL fCopyCorpse ); diff --git a/dlls/combat.cpp b/dlls/combat.cpp index f4ef3276..92c05653 100644 --- a/dlls/combat.cpp +++ b/dlls/combat.cpp @@ -1583,7 +1583,7 @@ Vector CBaseEntity::FireBulletsPlayer( ULONG cShots, Vector vecSrc, Vector vecDi Vector vecRight = gpGlobals->v_right; Vector vecUp = gpGlobals->v_up; float x = 0.0f, y = 0.0f; - float z; + //float z; if( pevAttacker == NULL ) pevAttacker = pev; // the default attacker is ourselves diff --git a/dlls/compile.bat b/dlls/compile.bat index 0106f56d..f97806a5 100644 --- a/dlls/compile.bat +++ b/dlls/compile.bat @@ -113,7 +113,7 @@ set LIBS=user32.lib set OUTNAME=hl.dll set DEBUG=/debug -cl %DEFINES% %LIBS% %SOURCES% %INCLUDES% -o %OUTNAME% /link /dll /out:%OUTNAME% %DEBUG% +cl %DEFINES% %LIBS% %SOURCES% %INCLUDES% -o %OUTNAME% /link /dll /out:%OUTNAME% %DEBUG% /def:".\hl.def" echo -- Compile done. Cleaning... diff --git a/dlls/decals.h b/dlls/decals.h index 5de54421..c5e67356 100644 --- a/dlls/decals.h +++ b/dlls/decals.h @@ -13,7 +13,7 @@ * ****/ #pragma once -#ifndef DECALS_H +#if !defined(DECALS_H) #define DECALS_H // diff --git a/dlls/defaultai.h b/dlls/defaultai.h index 652d1085..9696169b 100644 --- a/dlls/defaultai.h +++ b/dlls/defaultai.h @@ -12,7 +12,7 @@ * use or distribution of this code by or to any unlicensed person is illegal. * ****/ -#ifndef DEFAULTAI_H +#if !defined(DEFAULTAI_H) #define DEFAULTAI_H //========================================================= diff --git a/dlls/doors.h b/dlls/doors.h index 93775bcf..9e26a383 100644 --- a/dlls/doors.h +++ b/dlls/doors.h @@ -13,7 +13,7 @@ * ****/ #pragma once -#ifndef DOORS_H +#if !defined(DOORS_H) #define DOORS_H // doors diff --git a/dlls/effects.h b/dlls/effects.h index 4b179463..2a9cbfa9 100644 --- a/dlls/effects.h +++ b/dlls/effects.h @@ -13,7 +13,7 @@ * ****/ #pragma once -#ifndef EFFECTS_H +#if !defined(EFFECTS_H) #define EFFECTS_H #define SF_BEAM_STARTON 0x0001 diff --git a/dlls/enginecallback.h b/dlls/enginecallback.h index a9e37c26..d9d709d7 100644 --- a/dlls/enginecallback.h +++ b/dlls/enginecallback.h @@ -12,10 +12,9 @@ * without written permission from Valve LLC. * ****/ -#ifndef ENGINECALLBACK_H -#define ENGINECALLBACK_H - #pragma once +#if !defined(ENGINECALLBACK_H) +#define ENGINECALLBACK_H #include "event_flags.h" diff --git a/dlls/explode.h b/dlls/explode.h index 001d93ca..60638e63 100644 --- a/dlls/explode.h +++ b/dlls/explode.h @@ -13,7 +13,7 @@ * ****/ #pragma once -#ifndef EXPLODE_H +#if !defined(EXPLODE_H) #define EXPLODE_H #define SF_ENVEXPLOSION_NODAMAGE ( 1 << 0 ) // when set, ENV_EXPLOSION will not actually inflict damage diff --git a/dlls/exportdef.h b/dlls/exportdef.h index bc3c6371..6de40543 100644 --- a/dlls/exportdef.h +++ b/dlls/exportdef.h @@ -1,7 +1,7 @@ #pragma once -#ifndef EXPORTDEF_H +#if !defined(EXPORTDEF_H) #define EXPORTDEF_H -#if defined _WIN32 || defined __CYGWIN__ +#if _WIN32 || __CYGWIN__ #if __GNUC__ #define EXPORT __attribute__ ((dllexport)) #else diff --git a/dlls/extdll.h b/dlls/extdll.h index 0c35fe3a..2b592763 100644 --- a/dlls/extdll.h +++ b/dlls/extdll.h @@ -13,7 +13,7 @@ * ****/ #pragma once -#ifndef EXTDLL_H +#if !defined(EXTDLL_H) #define EXTDLL_H // @@ -45,10 +45,10 @@ #include #undef HSPRITE #else // _WIN32 -#ifndef FALSE +#if !defined(FALSE) #define FALSE 0 #endif -#ifndef TRUE +#if !defined(TRUE) #define TRUE (!FALSE) #endif #include @@ -57,7 +57,7 @@ typedef unsigned int ULONG; typedef unsigned char BYTE; typedef int BOOL; #define MAX_PATH PATH_MAX -#ifndef PATH_MAX +#if !defined(PATH_MAX) #define PATH_MAX 4096 #endif #endif //_WIN32 @@ -72,12 +72,12 @@ typedef int BOOL; #include #endif -#ifndef M_PI_F +#if !defined(M_PI_F) #define M_PI_F (float)M_PI #endif -#if defined(__LP64__) || defined(__LLP64__) || defined(_WIN64) || (defined(__x86_64__) && !defined(__ILP32__) ) || defined(_M_X64) || defined(__ia64) || defined (_M_IA64) || defined(__aarch64__) || defined(__powerpc64__) - #define XASH_64BIT +#if __LP64__ || __LLP64__ || _WIN64 || (__x86_64__ && !__ILP32__) || _M_X64 || __ia64 || _M_IA64 || __aarch64__ || __powerpc64__ + #define XASH_64BIT 1 #endif // Header file containing definition of globalvars_t and entvars_t @@ -101,10 +101,10 @@ typedef float vec_t; // needed before including progdefs.h // Shared header between the client DLL and the game DLLs #include "cdll_dll.h" -#ifndef Q_min +#if !defined(Q_min) #define Q_min(a,b) (((a) < (b)) ? (a) : (b)) #endif -#ifndef Q_max +#if !defined(Q_max) #define Q_max(a,b) (((a) > (b)) ? (a) : (b)) #endif diff --git a/dlls/flyingmonster.h b/dlls/flyingmonster.h index 31ff4e33..d043fa22 100644 --- a/dlls/flyingmonster.h +++ b/dlls/flyingmonster.h @@ -14,7 +14,7 @@ ****/ // Base class for flying monsters. This overrides the movement test & execution code from CBaseMonster #pragma once -#ifndef FLYINGMONSTER_H +#if !defined(FLYINGMONSTER_H) #define FLYINGMONSTER_H class CFlyingMonster : public CBaseMonster diff --git a/dlls/func_break.h b/dlls/func_break.h index cc0fd2d7..3abc6402 100644 --- a/dlls/func_break.h +++ b/dlls/func_break.h @@ -13,7 +13,7 @@ * ****/ #pragma once -#ifndef FUNC_BREAK_H +#if !defined(FUNC_BREAK_H) #define FUNC_BREAK_H typedef enum diff --git a/dlls/game.h b/dlls/game.h index e60cb4da..77502e76 100644 --- a/dlls/game.h +++ b/dlls/game.h @@ -13,7 +13,7 @@ * ****/ #pragma once -#ifndef GAME_H +#if !defined(GAME_H) #define GAME_H extern void GameDLLInit( void ); diff --git a/dlls/gamerules.h b/dlls/gamerules.h index cd8e1ec4..0253d4dc 100644 --- a/dlls/gamerules.h +++ b/dlls/gamerules.h @@ -16,7 +16,7 @@ // GameRules //========================================================= #pragma once -#ifndef GAMERULES_H +#if !defined(GAMERULES_H) #define GAMERULES_H //LRC #define GAME_NAME "Spirit of Half-Life" diff --git a/dlls/h_cycler.cpp b/dlls/h_cycler.cpp index a06f27b4..436e89da 100644 --- a/dlls/h_cycler.cpp +++ b/dlls/h_cycler.cpp @@ -28,8 +28,8 @@ #include "weapons.h" #include "player.h" -#define TEMP_FOR_SCREEN_SHOTS -#if defined(TEMP_FOR_SCREEN_SHOTS) //=================================================== +#define TEMP_FOR_SCREEN_SHOTS 1 +#if TEMP_FOR_SCREEN_SHOTS //=================================================== class CCycler : public CBaseMonster { diff --git a/dlls/h_export.cpp b/dlls/h_export.cpp index 88353c7c..11884f9c 100644 --- a/dlls/h_export.cpp +++ b/dlls/h_export.cpp @@ -43,8 +43,8 @@ BOOL WINAPI DllMain( HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved ) return TRUE; } -// cdecl for win32 -#define EXPORT2 WINAPIV +// stdcall for win32 +#define EXPORT2 WINAPI #else #define EXPORT2 #endif diff --git a/dlls/hl.def b/dlls/hl.def new file mode 100644 index 00000000..c009191a --- /dev/null +++ b/dlls/hl.def @@ -0,0 +1,5 @@ +LIBRARY hl +EXPORTS + GiveFnptrsToDll @1 +SECTIONS + .data READ WRITE diff --git a/dlls/hornet.h b/dlls/hornet.h index f0f0d366..b7be52c5 100644 --- a/dlls/hornet.h +++ b/dlls/hornet.h @@ -16,7 +16,7 @@ // Hornets //========================================================= #pragma once -#ifndef HORNET_H +#if !defined(HORNET_H) #define HORNET_H //========================================================= // Hornet Defines diff --git a/dlls/items.h b/dlls/items.h index 060678c8..3c5ba6eb 100644 --- a/dlls/items.h +++ b/dlls/items.h @@ -13,7 +13,7 @@ * ****/ #pragma once -#ifndef ITEMS_H +#if !defined(ITEMS_H) #define ITEMS_H class CItem : public CBaseEntity diff --git a/dlls/maprules.h b/dlls/maprules.h index 70a88fb5..4990b0cf 100644 --- a/dlls/maprules.h +++ b/dlls/maprules.h @@ -12,8 +12,8 @@ * without written permission from Valve LLC. * ****/ - -#ifndef MAPRULES_H +#pragma once +#if !defined(MAPRULES_H) #define MAPRULES_H #endif //MAPRULES_H diff --git a/dlls/monsterevent.h b/dlls/monsterevent.h index ab54b687..b3ca4e87 100644 --- a/dlls/monsterevent.h +++ b/dlls/monsterevent.h @@ -12,8 +12,8 @@ * without written permission from Valve LLC. * ****/ - -#ifndef MONSTEREVENT_H +#pragma once +#if !defined(MONSTEREVENT_H) #define MONSTEREVENT_H typedef struct diff --git a/dlls/monsters.h b/dlls/monsters.h index cabdce6d..3d90cfd2 100644 --- a/dlls/monsters.h +++ b/dlls/monsters.h @@ -13,7 +13,7 @@ * ****/ #pragma once -#ifndef MONSTERS_H +#if !defined(MONSTERS_H) #include "skill.h" #define MONSTERS_H diff --git a/dlls/nodes.cpp b/dlls/nodes.cpp index e396d41d..0ed11dfc 100644 --- a/dlls/nodes.cpp +++ b/dlls/nodes.cpp @@ -48,7 +48,7 @@ LINK_ENTITY_TO_CLASS( info_node_air, CNodeEnt ) #if __DOS__ #include #define CreateDirectoryA(p, n) mkdir(p) -#elif !defined _WIN32 +#elif !_WIN32 #include #include #define CreateDirectoryA(p, n) mkdir(p,777) diff --git a/dlls/nodes.h b/dlls/nodes.h index d6b36928..cb19aeb8 100644 --- a/dlls/nodes.h +++ b/dlls/nodes.h @@ -16,8 +16,8 @@ // nodes.h //========================================================= #pragma once -#ifndef NODES_H -#define NODES_H +#if !defined(NODES_H) +#define NODES_H //========================================================= // DEFINE //========================================================= @@ -106,7 +106,7 @@ typedef struct // CGraph //========================================================= #define _GRAPH_VERSION_RETAIL 16 // Retail Half-Life graph version. Don't increment this -#if defined(XASH_64BIT) +#if XASH_64BIT #define _GRAPH_VERSION (16 * 10) #else #define _GRAPH_VERSION (16) // !!!increment this whenever graph/node/link classes change, to obsolesce older disk files. diff --git a/dlls/nodes_compat.h b/dlls/nodes_compat.h index d73567e9..c190f11f 100644 --- a/dlls/nodes_compat.h +++ b/dlls/nodes_compat.h @@ -1,6 +1,6 @@ #pragma once -#ifndef NODES_32BIT_COMPAT +#if !defined(NODES_32BIT_COMPAT) #define NODES_32BIT_COMPAT //#include "nodes.h" diff --git a/dlls/plane.h b/dlls/plane.h index 912062f6..25d35d44 100644 --- a/dlls/plane.h +++ b/dlls/plane.h @@ -15,7 +15,7 @@ //========================================================= // Plane //========================================================= -#ifndef PLANE_H +#if !defined(PLANE_H) #define PLANE_H class CPlane diff --git a/dlls/player.h b/dlls/player.h index 1abe1e40..921a5004 100644 --- a/dlls/player.h +++ b/dlls/player.h @@ -13,7 +13,7 @@ * ****/ #pragma once -#ifndef PLAYER_H +#if !defined(PLAYER_H) #define PLAYER_H #include "pm_materials.h" diff --git a/dlls/saverestore.h b/dlls/saverestore.h index bb2c6181..b4040819 100644 --- a/dlls/saverestore.h +++ b/dlls/saverestore.h @@ -14,7 +14,7 @@ ****/ // Implementation in UTIL.CPP #pragma once -#ifndef SAVERESTORE_H +#if !defined(SAVERESTORE_H) #define SAVERESTORE_H class CBaseEntity; diff --git a/dlls/schedule.h b/dlls/schedule.h index a1b8f3f9..58f455ef 100644 --- a/dlls/schedule.h +++ b/dlls/schedule.h @@ -16,7 +16,7 @@ // Scheduling //========================================================= #pragma once -#ifndef SCHEDULE_H +#if !defined(SCHEDULE_H) #define SCHEDULE_H #define TASKSTATUS_NEW 0 // Just started diff --git a/dlls/scripted.cpp b/dlls/scripted.cpp index b353c3c6..234b4996 100644 --- a/dlls/scripted.cpp +++ b/dlls/scripted.cpp @@ -25,11 +25,11 @@ #include "monsters.h" #include "player.h" -#ifndef ANIMATION_H +#if !defined(ANIMATION_H) #include "animation.h" #endif -#ifndef SAVERESTORE_H +#if !defined(SAVERESTORE_H) #include "saverestore.h" #endif diff --git a/dlls/scripted.h b/dlls/scripted.h index 4937dd0d..19bf9c9d 100644 --- a/dlls/scripted.h +++ b/dlls/scripted.h @@ -13,10 +13,10 @@ * ****/ #pragma once -#ifndef SCRIPTED_H +#if !defined(SCRIPTED_H) #define SCRIPTED_H -#ifndef SCRIPTEVENT_H +#if !defined(SCRIPTEVENT_H) #include "scriptevent.h" #endif diff --git a/dlls/scriptevent.h b/dlls/scriptevent.h index 18436a26..179503d7 100644 --- a/dlls/scriptevent.h +++ b/dlls/scriptevent.h @@ -13,7 +13,7 @@ * ****/ #pragma once -#ifndef SCRIPTEVENT_H +#if !defined(SCRIPTEVENT_H) #define SCRIPTEVENT_H #define SCRIPT_EVENT_DEAD 1000 // character is now dead diff --git a/dlls/skill.h b/dlls/skill.h index 5244c923..1cb5b0c1 100644 --- a/dlls/skill.h +++ b/dlls/skill.h @@ -16,7 +16,7 @@ // skill.h - skill level concerns //========================================================= #pragma once -#ifndef SKILL_H +#if !defined(SKILL_H) #define SKILL_H struct skilldata_t diff --git a/dlls/soundent.h b/dlls/soundent.h index 88def506..9053e1fb 100644 --- a/dlls/soundent.h +++ b/dlls/soundent.h @@ -18,7 +18,7 @@ // lists. //========================================================= #pragma once -#ifndef SOUNDENT_H +#if !defined(SOUNDENT_H) #define SOUNDENT_H #define MAX_WORLD_SOUNDS 64 // maximum number of sounds handled by the world at one time. diff --git a/dlls/spectator.h b/dlls/spectator.h index c4e895c0..cf48c703 100644 --- a/dlls/spectator.h +++ b/dlls/spectator.h @@ -14,7 +14,7 @@ ****/ // Spectator.h #pragma once -#ifndef SPECTATOR_H +#if !defined(SPECTATOR_H) #define SPECTATOR_H class CBaseSpectator : public CBaseEntity diff --git a/dlls/squad.h b/dlls/squad.h index 2c79ee90..b6418cc1 100644 --- a/dlls/squad.h +++ b/dlls/squad.h @@ -8,7 +8,7 @@ // squad.h //========================================================= #pragma once -#ifndef SQUAD_H +#if !defined(SQUAD_H) #define SQUAD_H // these are special group roles that are assigned to members when the group is formed. diff --git a/dlls/squadmonster.h b/dlls/squadmonster.h index e2b9587d..84ff1dc4 100644 --- a/dlls/squadmonster.h +++ b/dlls/squadmonster.h @@ -17,7 +17,7 @@ // form squads. //========================================================= #pragma once -#ifndef SQUADMONSTER_H +#if !defined(SQUADMONSTER_H) #define SQUADMONSTER_H #define SF_SQUADMONSTER_LEADER 32 diff --git a/dlls/talkmonster.h b/dlls/talkmonster.h index 630abf42..fe5da344 100644 --- a/dlls/talkmonster.h +++ b/dlls/talkmonster.h @@ -12,10 +12,11 @@ * use or distribution of this code by or to any unlicensed person is illegal. * ****/ -#ifndef TALKMONSTER_H +#pragma once +#if !defined(TALKMONSTER_H) #define TALKMONSTER_H -#ifndef MONSTERS_H +#if !defined(MONSTERS_H) #include "monsters.h" #endif diff --git a/dlls/teamplay_gamerules.h b/dlls/teamplay_gamerules.h index 12ed038f..f7c91de8 100644 --- a/dlls/teamplay_gamerules.h +++ b/dlls/teamplay_gamerules.h @@ -16,7 +16,7 @@ // teamplay_gamerules.h // #pragma once -#ifndef TEAMPLAY_GAMERULES_H +#if !defined(TEAMPLAY_GAMERULES_H) #define TEAMPLAY_GAMERULES_H #define MAX_TEAMNAME_LENGTH 16 diff --git a/dlls/trains.h b/dlls/trains.h index b69619f8..e3b88a32 100644 --- a/dlls/trains.h +++ b/dlls/trains.h @@ -13,7 +13,7 @@ * ****/ #pragma once -#ifndef TRAINS_H +#if !defined(TRAINS_H) #define TRAINS_H // Tracktrain spawn flags diff --git a/dlls/util.cpp b/dlls/util.cpp index 859ebf64..59fb7668 100644 --- a/dlls/util.cpp +++ b/dlls/util.cpp @@ -2212,7 +2212,7 @@ void CSaveRestoreBuffer::BufferRewind( int size ) m_pdata->size -= size; } -#if !defined _WIN32 && !defined __WATCOMC__ +#if !_WIN32 && !__WATCOMC__ extern "C" { unsigned _rotr( unsigned val, int shift ) { diff --git a/dlls/util.h b/dlls/util.h index 7c5e3b46..81890bc9 100644 --- a/dlls/util.h +++ b/dlls/util.h @@ -13,18 +13,18 @@ * ****/ #pragma once -#ifndef UTIL_H +#if !defined(UTIL_H) #define UTIL_H // // Misc utility code // #include -#ifndef ACTIVITY_H +#if !defined(ACTIVITY_H) #include "activity.h" #endif -#ifndef ENGINECALLBACK_H +#if !defined(ENGINECALLBACK_H) #include "enginecallback.h" #endif @@ -37,7 +37,7 @@ extern globalvars_t *gpGlobals; // Use this instead of ALLOC_STRING on constant strings #define STRING(offset) (const char *)(gpGlobals->pStringBase + (int)offset) -#if !defined(XASH_64BIT) || CLIENT_DLL +#if !XASH_64BIT || CLIENT_DLL #define MAKE_STRING(str) ((int)(long int)str - (int)(long int)STRING(0)) #else static inline int MAKE_STRING(const char *szValue) @@ -95,7 +95,7 @@ typedef int EOFFSET; typedef int BOOL; // In case this ever changes -#ifndef M_PI +#if !defined(M_PI) #define M_PI 3.14159265358979323846 #endif // Keeps clutter down a bit, when declaring external entity/global method prototypes diff --git a/dlls/vector.h b/dlls/vector.h index 48c707b4..524cdfcf 100644 --- a/dlls/vector.h +++ b/dlls/vector.h @@ -13,7 +13,7 @@ * ****/ #pragma once -#ifndef VECTOR_H +#if !defined(VECTOR_H) #define VECTOR_H //========================================================= diff --git a/dlls/weapons.h b/dlls/weapons.h index 027779fe..72485c1a 100644 --- a/dlls/weapons.h +++ b/dlls/weapons.h @@ -13,7 +13,7 @@ * ****/ #pragma once -#ifndef WEAPONS_H +#if !defined(WEAPONS_H) #define WEAPONS_H #include "effects.h" diff --git a/dlls/wscript b/dlls/wscript index 4c56c7bc..cb394c69 100644 --- a/dlls/wscript +++ b/dlls/wscript @@ -10,8 +10,15 @@ def options(opt): return def configure(conf): - # stub - return + if conf.env.COMPILER_CC == 'msvc': + # hl.def removes MSVC function name decoration from GiveFnptrsToDll on Windows. + # Without this, the lookup for this function fails. + hlDefNode = conf.path.find_resource("./hl.def") + + if hlDefNode is not None: + conf.env.append_unique('LINKFLAGS', '/def:%s' % hlDefNode.abspath()) + else: + conf.fatal("Could not find hl.def") def build(bld): source = bld.path.parent.ant_glob([ diff --git a/engine/cdll_int.h b/engine/cdll_int.h index 8ab903b0..02d277dd 100644 --- a/engine/cdll_int.h +++ b/engine/cdll_int.h @@ -19,10 +19,10 @@ // JOHN: client dll interface declarations // #pragma once -#ifndef CDLL_INT_H +#if !defined(CDLL_INT_H) #define CDLL_INT_H -#ifdef __cplusplus +#if __cplusplus extern "C" { #endif @@ -307,7 +307,7 @@ typedef struct cl_enginefuncs_s #define CLDLL_INTERFACE_VERSION 7 -#ifdef __cplusplus +#if __cplusplus } #endif diff --git a/engine/custom.h b/engine/custom.h index 4bff2632..6bfd27c7 100644 --- a/engine/custom.h +++ b/engine/custom.h @@ -13,7 +13,7 @@ * ****/ #pragma once -#ifndef CUSTOM_H +#if !defined(CUSTOM_H) #define CUSTOM_H #include "const.h" diff --git a/engine/customentity.h b/engine/customentity.h index f524ae79..fb4c1055 100644 --- a/engine/customentity.h +++ b/engine/customentity.h @@ -13,7 +13,7 @@ * ****/ #pragma once -#ifndef CUSTOMENTITY_H +#if !defined(CUSTOMENTITY_H) #define CUSTOMENTITY_H // Custom Entities diff --git a/engine/edict.h b/engine/edict.h index 8584a0d9..beae7d7b 100644 --- a/engine/edict.h +++ b/engine/edict.h @@ -13,7 +13,7 @@ * ****/ #pragma once -#ifndef EDICT_H +#if !defined(EDICT_H) #define EDICT_H #define MAX_ENT_LEAFS 48 diff --git a/engine/eiface.h b/engine/eiface.h index 6a5f86fc..f7cdb095 100644 --- a/engine/eiface.h +++ b/engine/eiface.h @@ -13,10 +13,10 @@ * ****/ #pragma once -#ifndef EIFACE_H +#if !defined(EIFACE_H) #define EIFACE_H -#ifdef HLDEMO_BUILD +#if HLDEMO_BUILD #define INTERFACE_VERSION 001 #else // !HLDEMO_BUILD, i.e., regular version of HL #define INTERFACE_VERSION 140 @@ -355,7 +355,7 @@ typedef enum _fieldtypes FIELD_TYPECOUNT // MUST BE LAST } FIELDTYPE; -#if !defined(offsetof) && !defined(__GNUC__) +#if !defined(offsetof) && !__GNUC__ #define offsetof(s,m) (size_t)&(((s *)0)->m) #endif @@ -380,7 +380,7 @@ typedef struct short flags; } TYPEDESCRIPTION; -#ifndef ARRAYSIZE +#if !defined(ARRAYSIZE) #define ARRAYSIZE(p) (sizeof(p)/sizeof(p[0])) #endif diff --git a/engine/keydefs.h b/engine/keydefs.h index 5593d75a..82b799a8 100644 --- a/engine/keydefs.h +++ b/engine/keydefs.h @@ -13,7 +13,7 @@ * ****/ #pragma once -#ifndef KEYDEFS_H +#if !defined(KEYDEFS_H) #define KEYDEFS_H // diff --git a/engine/mobility_int.h b/engine/mobility_int.h index d8b6120a..ef94f769 100644 --- a/engine/mobility_int.h +++ b/engine/mobility_int.h @@ -12,11 +12,10 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. */ - #pragma once -#ifndef MOBILITY_INT_H +#if !defined(MOBILITY_INT_H) #define MOBILITY_INT_H -#ifdef __cplusplus +#if __cplusplus extern "C" { #endif @@ -84,7 +83,7 @@ typedef struct mobile_engfuncs_s // returns 0 on no error otherwise error typedef int (*pfnMobilityInterface)( mobile_engfuncs_t *gMobileEngfuncs ); -#ifdef __cplusplus +#if __cplusplus } #endif #endif diff --git a/engine/progdefs.h b/engine/progdefs.h index 31cfb3cb..d8dd62e6 100644 --- a/engine/progdefs.h +++ b/engine/progdefs.h @@ -13,7 +13,7 @@ * ****/ #pragma once -#ifndef PROGDEFS_H +#if !defined(PROGDEFS_H) #define PROGDEFS_H typedef struct diff --git a/engine/shake.h b/engine/shake.h index a3e49324..8d4bbde5 100644 --- a/engine/shake.h +++ b/engine/shake.h @@ -13,7 +13,7 @@ * ****/ #pragma once -#ifndef SHAKE_H +#if !defined(SHAKE_H) #define SHAKE_H // Screen / View effects diff --git a/engine/sprite.h b/engine/sprite.h index 4368c1ac..ee0c317b 100644 --- a/engine/sprite.h +++ b/engine/sprite.h @@ -13,7 +13,7 @@ * ****/ #pragma once -#ifndef SPRITE_H +#if !defined(SPRITE_H) #define SPRITE_H /* diff --git a/engine/studio.h b/engine/studio.h index 88254c96..48be9d0a 100644 --- a/engine/studio.h +++ b/engine/studio.h @@ -13,7 +13,7 @@ * ****/ #pragma once -#ifndef STUDIO_H +#if !defined(STUDIO_H) #define STUDIO_H /* @@ -201,7 +201,7 @@ typedef struct vec3_t bbmax; } mstudiobbox_t; -#ifndef CACHE_USER +#if !defined(CACHE_USER) #define CACHE_USER typedef struct cache_user_s { diff --git a/game_shared/bitvec.h b/game_shared/bitvec.h index b7f5343a..bb6d8fb7 100644 --- a/game_shared/bitvec.h +++ b/game_shared/bitvec.h @@ -4,12 +4,9 @@ // // $NoKeywords: $ //============================================================================= - -#ifndef BITVEC_H -#define BITVEC_H -#ifdef _WIN32 #pragma once -#endif +#if !defined(BITVEC_H) +#define BITVEC_H #include #include diff --git a/game_shared/vgui_checkbutton2.h b/game_shared/vgui_checkbutton2.h index ef8f82ae..7267abe2 100644 --- a/game_shared/vgui_checkbutton2.h +++ b/game_shared/vgui_checkbutton2.h @@ -4,13 +4,9 @@ // // $NoKeywords: $ //============================================================================= - -#ifndef VGUI_CHECKBUTTON2_H -#define VGUI_CHECKBUTTON2_H -#ifdef _WIN32 #pragma once -#endif - +#if !defined(VGUI_CHECKBUTTON2_H) +#define VGUI_CHECKBUTTON2_H #include "vgui_label.h" #include "vgui_imagepanel.h" diff --git a/game_shared/vgui_defaultinputsignal.h b/game_shared/vgui_defaultinputsignal.h index 835d92b0..25d89d70 100644 --- a/game_shared/vgui_defaultinputsignal.h +++ b/game_shared/vgui_defaultinputsignal.h @@ -4,17 +4,12 @@ // // $NoKeywords: $ //============================================================================= - -#ifndef VGUI_DEFAULTINPUTSIGNAL_H -#define VGUI_DEFAULTINPUTSIGNAL_H -#ifdef _WIN32 #pragma once -#endif - +#if !defined(VGUI_DEFAULTINPUTSIGNAL_H) +#define VGUI_DEFAULTINPUTSIGNAL_H #include "vgui_inputsignal.h" - namespace vgui { // This class derives from vgui::InputSignal and implements empty defaults for all of its functions. @@ -34,6 +29,4 @@ namespace vgui virtual void keyFocusTicked(Panel* panel) {} }; } - - #endif // VGUI_DEFAULTINPUTSIGNAL_H diff --git a/game_shared/vgui_grid.h b/game_shared/vgui_grid.h index eaf8e1d7..739834e5 100644 --- a/game_shared/vgui_grid.h +++ b/game_shared/vgui_grid.h @@ -4,13 +4,9 @@ // // $NoKeywords: $ //============================================================================= - -#ifndef VGUI_GRID_H -#define VGUI_GRID_H -#ifdef _WIN32 #pragma once -#endif - +#if !defined(VGUI_GRID_H) +#define VGUI_GRID_H #include "vgui_panel.h" @@ -117,6 +113,4 @@ protected: }; }; - - #endif // VGUI_GRID_H diff --git a/game_shared/vgui_helpers.h b/game_shared/vgui_helpers.h index 09e82667..fb150eb5 100644 --- a/game_shared/vgui_helpers.h +++ b/game_shared/vgui_helpers.h @@ -4,12 +4,9 @@ // // $NoKeywords: $ //============================================================================= - -#ifndef VGUI_HELPERS_H -#define VGUI_HELPERS_H -#ifdef _WIN32 #pragma once -#endif +#if !defined(VGUI_HELPERS_H) +#define VGUI_HELPERS_H #include "vgui_panel.h" @@ -25,7 +22,5 @@ inline int PanelHeight(vgui::Panel *pPanel) {int x,y,w,h; pPanel->getBounds(x,y, // Places child at the requested position inside pParent. iAlignment is from Label::Alignment. void AlignPanel(vgui::Panel *pChild, vgui::Panel *pParent, int alignment); - - #endif // VGUI_HELPERS_H diff --git a/game_shared/vgui_listbox.h b/game_shared/vgui_listbox.h index 7191f827..9b245b4c 100644 --- a/game_shared/vgui_listbox.h +++ b/game_shared/vgui_listbox.h @@ -4,13 +4,9 @@ // // $NoKeywords: $ //============================================================================= - -#ifndef VOICE_LISTBOX_H -#define VOICE_LISTBOX_H -#ifdef _WIN32 #pragma once -#endif - +#if !defined(VOICE_LISTBOX_H) +#define VOICE_LISTBOX_H #include "VGUI_Panel.h" #include "VGUI_IntChangeSignal.h" @@ -110,6 +106,4 @@ protected: }; } - - #endif // VOICE_LISTBOX_H diff --git a/game_shared/vgui_loadtga.h b/game_shared/vgui_loadtga.h index 053d23ff..ea0ecac2 100644 --- a/game_shared/vgui_loadtga.h +++ b/game_shared/vgui_loadtga.h @@ -4,19 +4,13 @@ // // $NoKeywords: $ //============================================================================= - -#ifndef VGUI_LOADTGA_H -#define VGUI_LOADTGA_H -#ifdef _WIN32 #pragma once -#endif - +#if !defined(VGUI_LOADTGA_H) +#define VGUI_LOADTGA_H #include "vgui_bitmaptga.h" vgui::BitmapTGA* vgui_LoadTGA(char const *pFilename); vgui::BitmapTGA* vgui_LoadTGANoInvertAlpha(char const *pFilename); - - #endif // VGUI_LOADTGA_H diff --git a/game_shared/vgui_scrollbar2.h b/game_shared/vgui_scrollbar2.h index ad2d2d05..16fe8a46 100644 --- a/game_shared/vgui_scrollbar2.h +++ b/game_shared/vgui_scrollbar2.h @@ -4,12 +4,9 @@ // // $NoKeywords: $ //============================================================================= - -#ifndef VGUI_SCROLLBAR2_H -#define VGUI_SCROLLBAR2_H -#ifdef _WIN32 #pragma once -#endif +#if !defined(VGUI_SCROLLBAR2_H) +#define VGUI_SCROLLBAR2_H #include #include @@ -58,5 +55,4 @@ protected: }; } - #endif // VGUI_SCROLLBAR2_H diff --git a/game_shared/vgui_slider2.h b/game_shared/vgui_slider2.h index 4edb87f2..e421bba5 100644 --- a/game_shared/vgui_slider2.h +++ b/game_shared/vgui_slider2.h @@ -4,12 +4,9 @@ // // $NoKeywords: $ //============================================================================= - -#ifndef VGUI_SLIDER2_H -#define VGUI_SLIDER2_H -#ifdef _WIN32 #pragma once -#endif +#if !defined(VGUI_SLIDER2_H) +#define VGUI_SLIDER2_H #include #include @@ -63,5 +60,4 @@ protected: }; } - #endif // VGUI_SLIDER2_H diff --git a/game_shared/voice_banmgr.h b/game_shared/voice_banmgr.h index 610ad6cf..4c4f7b63 100644 --- a/game_shared/voice_banmgr.h +++ b/game_shared/voice_banmgr.h @@ -4,13 +4,9 @@ // // $NoKeywords: $ //============================================================================= - -#ifndef VOICE_BANMGR_H -#define VOICE_BANMGR_H -#ifdef _WIN32 #pragma once -#endif - +#if !defined(VOICE_BANMGR_H) +#define VOICE_BANMGR_H // This class manages the (persistent) list of squelched players. class CVoiceBanMgr @@ -52,6 +48,4 @@ protected: BannedPlayer m_PlayerHash[256]; }; - - #endif // VOICE_BANMGR_H diff --git a/game_shared/voice_common.h b/game_shared/voice_common.h index 5517d8ee..58225955 100644 --- a/game_shared/voice_common.h +++ b/game_shared/voice_common.h @@ -4,13 +4,9 @@ // // $NoKeywords: $ //============================================================================= - -#ifndef VOICE_COMMON_H -#define VOICE_COMMON_H -#ifdef _WIN32 #pragma once -#endif - +#if !defined(VOICE_COMMON_H) +#define VOICE_COMMON_H #include "bitvec.h" @@ -19,6 +15,4 @@ #define VOICE_MAX_PLAYERS_DW ((VOICE_MAX_PLAYERS / 32) + !!(VOICE_MAX_PLAYERS & 31)) typedef CBitVec CPlayerBitVec; - - #endif // VOICE_COMMON_H diff --git a/game_shared/voice_gamemgr.h b/game_shared/voice_gamemgr.h index bc2d26a8..f6e9d92c 100644 --- a/game_shared/voice_gamemgr.h +++ b/game_shared/voice_gamemgr.h @@ -4,10 +4,9 @@ // // $NoKeywords: $ //============================================================================= - -#ifndef VOICE_GAMEMGR_H -#define VOICE_GAMEMGR_H #pragma once +#if !defined(VOICE_GAMEMGR_H) +#define VOICE_GAMEMGR_H #include "voice_common.h" diff --git a/game_shared/voice_status.h b/game_shared/voice_status.h index 509902e5..efc5e5c5 100644 --- a/game_shared/voice_status.h +++ b/game_shared/voice_status.h @@ -4,11 +4,9 @@ // // $NoKeywords: $ //============================================================================= - -#ifndef VOICE_STATUS_H -#define VOICE_STATUS_H #pragma once - +#if !defined(VOICE_STATUS_H) +#define VOICE_STATUS_H #include "VGUI_Label.h" #include "VGUI_LineBorder.h" @@ -223,6 +221,4 @@ public: // Get the (global) voice manager. CVoiceStatus* GetClientVoiceMgr(); - - #endif // VOICE_STATUS_H diff --git a/game_shared/voice_vgui_tweakdlg.h b/game_shared/voice_vgui_tweakdlg.h index deb83dc2..960a8d85 100644 --- a/game_shared/voice_vgui_tweakdlg.h +++ b/game_shared/voice_vgui_tweakdlg.h @@ -4,13 +4,9 @@ // // $NoKeywords: $ //============================================================================= - -#ifndef VOICE_VGUI_TWEAKDLG_H -#define VOICE_VGUI_TWEAKDLG_H -#ifdef _WIN32 #pragma once -#endif - +#if !defined(VOICE_VGUI_TWEAKDLG_H) +#define VOICE_VGUI_TWEAKDLG_H class CMenuPanel; diff --git a/pm_shared/pm_debug.c b/pm_shared/pm_debug.c index ce904760..d726e19a 100644 --- a/pm_shared/pm_debug.c +++ b/pm_shared/pm_debug.c @@ -49,7 +49,7 @@ static int PM_boxpnt[6][4] = void PM_ShowClipBox( void ) { -#if defined( _DEBUG ) +#if _DEBUG vec3_t org; vec3_t offset = { 0, 0, 0 }; diff --git a/pm_shared/pm_debug.h b/pm_shared/pm_debug.h index 6c91d62e..2d7ba059 100644 --- a/pm_shared/pm_debug.h +++ b/pm_shared/pm_debug.h @@ -13,7 +13,7 @@ * ****/ #pragma once -#ifndef PM_DEBUG_H +#if !defined(PM_DEBUG_H) #define PM_DEBUG_H void PM_ViewEntity( void ); diff --git a/pm_shared/pm_defs.h b/pm_shared/pm_defs.h index 7da29755..5ef8c356 100644 --- a/pm_shared/pm_defs.h +++ b/pm_shared/pm_defs.h @@ -13,7 +13,7 @@ * ****/ #pragma once -#ifndef PM_DEFS_H +#if !defined(PM_DEFS_H) #define PM_DEFS_H #define MAX_PHYSENTS 600 // Must have room for all entities in the world. diff --git a/pm_shared/pm_info.h b/pm_shared/pm_info.h index 9a971d53..2a13c14c 100644 --- a/pm_shared/pm_info.h +++ b/pm_shared/pm_info.h @@ -13,7 +13,7 @@ * ****/ #pragma once -#ifndef PM_INFO_H +#if !defined(PM_INFO_H) #define PM_INFO_H #define MAX_PHYSINFO_STRING 256 diff --git a/pm_shared/pm_materials.h b/pm_shared/pm_materials.h index 9bc71b72..ad61e946 100644 --- a/pm_shared/pm_materials.h +++ b/pm_shared/pm_materials.h @@ -13,7 +13,7 @@ * ****/ #pragma once -#ifndef PM_MATERIALS_H +#if !defined(PM_MATERIALS_H) #define PM_MATERIALS_H #define CBTEXTURENAMEMAX 13 // only load first n chars of name diff --git a/pm_shared/pm_shared.h b/pm_shared/pm_shared.h index c315353b..7e64421f 100644 --- a/pm_shared/pm_shared.h +++ b/pm_shared/pm_shared.h @@ -13,7 +13,7 @@ * ****/ #pragma once -#ifndef PM_SHARED_H +#if !defined(PM_SHARED_H) #define PM_SHARED_H void PM_Init( struct playermove_s *ppmove ); diff --git a/public/build.h b/public/build.h index e23265ce..abfe1902 100644 --- a/public/build.h +++ b/public/build.h @@ -27,7 +27,7 @@ OTHER DEALINGS IN THE SOFTWARE. For more information, please refer to */ #pragma once -#ifndef BUILD_H +#if !defined(BUILD_H) #define BUILD_H // All XASH_* macros set by this header are guaranteed to have positive value otherwise not defined