From cf5f50918b744e1f99f36241ca1df889ce0514b6 Mon Sep 17 00:00:00 2001 From: tayst Date: Sat, 3 Feb 2024 17:48:59 +0800 Subject: [PATCH] Small fixes (#125) * Fixup clang warnings * [CI/CD] Apple Mac Silicon (arm64) builds * Disable Raw Input for MacOSX as it makes input not work at all and is the default setting. * Set CMAKE_C_FLAG -fcommon for BSD compile * Remove va() call that had too few arguments * Bump cmake_minimum_required to version 3.10 --- .github/workflows/build.yml | 95 ++++++++++++++++++++++--- CMakeLists.txt | 7 +- codemp/botlib/l_script.cpp | 6 +- codemp/cgame/cg_players.c | 6 +- codemp/client/cl_cgame.cpp | 10 +-- codemp/client/cl_console.cpp | 4 +- codemp/client/cl_discordrpc.cpp | 8 +-- codemp/client/cl_keys.cpp | 2 +- codemp/client/cl_main.cpp | 4 +- codemp/client/cl_tc_vis.cpp | 2 +- codemp/game/NPC_utils.c | 4 +- codemp/game/ai_main.c | 42 ++++++----- codemp/game/bg_pmove.c | 15 ++-- codemp/game/g_account.c | 36 +++++----- codemp/game/g_active.c | 6 +- codemp/game/g_client.c | 14 ++-- codemp/game/g_cmds.c | 4 +- codemp/game/g_items.c | 6 +- codemp/game/g_main.c | 12 ++-- codemp/game/g_mover.c | 2 +- codemp/game/g_svcmds.c | 4 +- codemp/game/g_syscalls.c | 36 ++++++---- codemp/game/g_team.c | 6 +- codemp/game/g_trigger.c | 6 +- codemp/game/g_weapon.c | 2 +- codemp/game/sqlite3.c | 6 +- codemp/icarus/BlockStream.cpp | 7 +- codemp/mp3code/towave.c | 8 +-- codemp/qcommon/files.cpp | 10 +-- codemp/rd-common/tr_image_tga.cpp | 20 +++--- codemp/rd-dedicated/G2_bones.cpp | 12 ++-- codemp/rd-dedicated/tr_ghoul2.cpp | 4 +- codemp/rd-dedicated/tr_model.cpp | 15 +--- codemp/rd-rend2/G2_bones.cpp | 12 ++-- codemp/rd-rend2/MikkTSpace/mikktspace.c | 12 ++-- codemp/rd-rend2/stb_image.h | 17 +++-- codemp/rd-rend2/tr_backend.cpp | 14 ++-- codemp/rd-rend2/tr_bsp.cpp | 20 +++--- codemp/rd-rend2/tr_curve.cpp | 6 +- codemp/rd-rend2/tr_ghoul2.cpp | 6 +- codemp/rd-rend2/tr_glsl.cpp | 2 + codemp/rd-rend2/tr_image_stb.cpp | 4 +- codemp/rd-rend2/tr_init.cpp | 2 +- codemp/rd-rend2/tr_main.cpp | 18 ++--- codemp/rd-rend2/tr_model.cpp | 4 +- codemp/rd-rend2/tr_shade.cpp | 15 ++-- codemp/rd-rend2/tr_shade_calc.cpp | 4 +- codemp/rd-rend2/tr_shader.cpp | 4 +- codemp/rd-rend2/tr_weather.cpp | 2 +- codemp/rd-vanilla/G2_bones.cpp | 12 ++-- codemp/rd-vanilla/tr_backend.cpp | 4 +- codemp/rd-vanilla/tr_bsp.cpp | 7 +- codemp/rd-vanilla/tr_ghoul2.cpp | 4 +- codemp/rd-vanilla/tr_main.cpp | 4 +- codemp/rd-vanilla/tr_model.cpp | 4 +- codemp/rd-vulkan/G2_bones.cpp | 12 ++-- codemp/rd-vulkan/tr_bsp.cpp | 11 +-- codemp/rd-vulkan/tr_ghoul2.cpp | 6 +- codemp/rd-vulkan/tr_main.cpp | 3 +- codemp/rd-vulkan/tr_model.cpp | 4 +- codemp/rd-vulkan/tr_quicksprite.cpp | 2 +- codemp/rd-vulkan/tr_shader.cpp | 7 +- codemp/rd-vulkan/utils/stb_dxt.h | 4 +- codemp/rd-vulkan/vk_attachments.cpp | 2 +- codemp/rd-vulkan/vk_debug.cpp | 2 +- codemp/rd-vulkan/vk_frame.cpp | 22 +++--- codemp/rd-vulkan/vk_image.cpp | 10 +-- codemp/rd-vulkan/vk_instance.cpp | 8 ++- codemp/rd-vulkan/vk_shade_geometry.cpp | 2 +- codemp/rd-vulkan/vk_swapchain.cpp | 2 +- codemp/ui/ui_main.c | 24 +++---- lib/libpng/pngread.c | 5 +- shared/sdl/sdl_input.cpp | 3 + 73 files changed, 409 insertions(+), 318 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6c43bc12d0..24ed727bab 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -172,7 +172,7 @@ jobs: macos: name: macOS ${{ matrix.arch }} ${{ matrix.build_type }} (${{ matrix.portable}}) - runs-on: macos-12 + runs-on: macos-13 strategy: fail-fast: false matrix: @@ -237,9 +237,76 @@ jobs: path: ${{ github.workspace }}/install/JediAcademy/TaystJK-macos-${{ matrix.arch }}-${{ matrix.build_type }}-${{ matrix.portable }}.tar.gz if-no-files-found: error + macos-m1: + name: macOS ${{ matrix.arch }} ${{ matrix.build_type }} (${{ matrix.portable}}) + runs-on: macos-14 + strategy: + fail-fast: false + matrix: + arch: [arm64] + build_type: [Debug, Release] + portable: [Non-Portable] + + steps: + - uses: actions/checkout@v4 + if: github.event_name == 'pull_request' + with: + fetch-depth: 0 + fetch-tags: true + ref: ${{ github.event.pull_request.head.sha }} + + - uses: actions/checkout@v4 + if: github.event_name != 'pull_request' + with: + fetch-depth: 0 + fetch-tags: true + + - name: Create Build Environment + run: | + brew install zlib libjpeg libpng sdl2 + cmake -E make_directory ${{ github.workspace }}/build + + - name: Configure CMake + shell: bash + working-directory: ${{ github.workspace }}/build + run: | + OPTIONS="-DCMAKE_OSX_ARCHITECTURES=arm64 -DCMAKE_SYSTEM_PROCESSOR=arm64 -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/install" + if [ "${{ matrix.portable }}" == "Portable" ]; then + OPTIONS+=" -DUseInternalLibs=ON -DBuildPortableVersion=ON" + else + OPTIONS+=" -DUseInternalLibs=OFF -DBuildPortableVersion=OFF" + fi + cmake $GITHUB_WORKSPACE $OPTIONS + + - name: Build + working-directory: ${{ github.workspace }}/build + shell: bash + run: cmake --build . -j $(getconf _NPROCESSORS_ONLN) + + - name: Install + if: ${{ matrix.build_type == 'Release' }} + working-directory: ${{ github.workspace }}/build + shell: bash + run: cmake --install . + + - name: Create TaystJK binary archive + if: ${{ matrix.build_type == 'Release' }} + working-directory: ${{ github.workspace }}/install/JediAcademy + shell: bash + run: | + chmod +x eternaljk.arm64.app/Contents/MacOS/eternaljk.arm64 + tar -czvf TaystJK-macos-${{ matrix.arch }}-${{ matrix.build_type }}-${{ matrix.portable }}.tar.gz * + + - uses: actions/upload-artifact@v4 + if: ${{ matrix.build_type == 'Release' }} + with: + name: TaystJK-macos-${{ matrix.arch }}-${{ matrix.build_type }}-${{ matrix.portable }} + path: ${{ github.workspace }}/install/JediAcademy/TaystJK-macos-${{ matrix.arch }}-${{ matrix.build_type }}-${{ matrix.portable }}.tar.gz + if-no-files-found: error + create-latest: if: github.event_name == 'push' && github.ref == 'refs/heads/master' - needs: [msvc, ubuntu, macos] + needs: [msvc, ubuntu, macos, macos-m1] runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 @@ -251,11 +318,12 @@ jobs: - name: Create binary archives run: | - 7z a -r TaystJK-windows-x86.zip ./TaystJK-windows-x86-Release-Non-Portable/* '-x!msvcp*.*' '-x!vcruntime*.*' '-x!concrt*.*' - 7z a -r TaystJK-windows-x86_64.zip ./TaystJK-windows-x86_64-Release-Non-Portable/* '-x!msvcp*.*' '-x!vcruntime*.*' '-x!concrt*.*' - mv ./TaystJK-linux-x86-Release-Non-Portable/* TaystJK-linux-x86.tar.gz - mv ./TaystJK-linux-x86_64-Release-Non-Portable/* TaystJK-linux-x86_64.tar.gz - mv ./TaystJK-macos-x86_64-Release-Non-Portable/* TaystJK-macos-x86_64.tar.gz + 7z a -r TaystJK-windows-x86.zip ./TaystJK-windows-x86-Release-Non-Portable/* + 7z a -r TaystJK-windows-x86_64.zip ./TaystJK-windows-x86_64-Release-Non-Portable/* + mv ./TaystJK-linux-x86-Release-Non-Portable/* ./TaystJK-linux-x86.tar.gz + mv ./TaystJK-linux-x86_64-Release-Non-Portable/* ./TaystJK-linux-x86_64.tar.gz + mv ./TaystJK-macos-x86_64-Release-Non-Portable/* ./TaystJK-macos-x86_64.tar.gz + mv ./TaystJK-macos-arm64-Release-Non-Portable/* ./TaystJK-macos-arm64.tar.gz - name: Create latest build uses: softprops/action-gh-release@v1 @@ -271,7 +339,7 @@ jobs: create-prerelease: if: github.event_name == 'push' && github.ref == 'refs/heads/beta' - needs: [msvc, ubuntu, macos] + needs: [msvc, ubuntu, macos, macos-m1] runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 @@ -283,11 +351,12 @@ jobs: - name: Create binary archives run: | - 7z a -r TaystJK-windows-x86.zip ./TaystJK-windows-x86-Release-Non-Portable/* '-x!msvcp*.*' '-x!vcruntime*.*' '-x!concrt*.*' - 7z a -r TaystJK-windows-x86_64.zip ./TaystJK-windows-x86_64-Release-Non-Portable/* '-x!msvcp*.*' '-x!vcruntime*.*' '-x!concrt*.*' + 7z a -r TaystJK-windows-x86.zip ./TaystJK-windows-x86-Release-Non-Portable/* + 7z a -r TaystJK-windows-x86_64.zip ./TaystJK-windows-x86_64-Release-Non-Portable/* mv ./TaystJK-linux-x86-Release-Non-Portable/* ./TaystJK-linux-x86.tar.gz mv ./TaystJK-linux-x86_64-Release-Non-Portable/* ./TaystJK-linux-x86_64.tar.gz mv ./TaystJK-macos-x86_64-Release-Non-Portable/* ./TaystJK-macos-x86_64.tar.gz + mv ./TaystJK-macos-arm64-Release-Non-Portable/* ./TaystJK-macos-arm64.tar.gz - name: Create latest beta build uses: softprops/action-gh-release@v1 @@ -329,6 +398,10 @@ jobs: artifact_name: TaystJK-macos-x86_64.tar.gz zip: false + - artifact_dir: TaystJK-macos-arm64-Release-Non-Portable + artifact_name: TaystJK-macos-arm64.tar.gz + zip: false + steps: - uses: actions/checkout@v4 with: @@ -340,7 +413,7 @@ jobs: - name: Create archive run: | if [ "${{ matrix.zip }}" == "true" ]; then - 7z a -r ${{ matrix.artifact_name }} ./${{ matrix.artifact_dir }}/* '-x!msvcp*.*' '-x!vcruntime*.*' '-x!concrt*.*' + 7z a -r ${{ matrix.artifact_name }} ./${{ matrix.artifact_dir }}/* else mv ./${{ matrix.artifact_dir }}/* ${{ matrix.artifact_name }} fi diff --git a/CMakeLists.txt b/CMakeLists.txt index f677af442f..df304ff572 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,7 +16,7 @@ # along with this program; if not, see . #============================================================================ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.10) set(CMAKE_OSX_DEPLOYMENT_TARGET "10.9" CACHE STRING "Minimum OS X deployment version") set(InOpenJK ON) @@ -112,6 +112,7 @@ else() if(CMAKE_SYSTEM_PROCESSOR MATCHES "^(arm64|aarch64)$") set(Architecture "arm64") add_definitions(-DPNG_ARM_NEON_OPT=0) + set(CMAKE_OSX_DEPLOYMENT_TARGET "11.0" CACHE STRING "Minimum OS X deployment version") elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm") set(Architecture "arm") elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^i.86$") @@ -257,6 +258,10 @@ elseif (("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU") OR ("${CMAKE_C_COMPILER_ID}" M # enable support for multithreading set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread") + if(CMAKE_SYSTEM_NAME MATCHES "BSD") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fcommon") + endif() + if("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-comment") diff --git a/codemp/botlib/l_script.cpp b/codemp/botlib/l_script.cpp index ab49c8c62b..e6f0352641 100644 --- a/codemp/botlib/l_script.cpp +++ b/codemp/botlib/l_script.cpp @@ -365,7 +365,7 @@ int PS_ReadWhiteSpace(script_t *script) //============================================================================ int PS_ReadEscapeCharacter(script_t *script, char *ch) { - int c, val, i; + int c, val; //, i; //step over the leading '\\' script->script_p++; @@ -386,7 +386,7 @@ int PS_ReadEscapeCharacter(script_t *script, char *ch) case 'x': { script->script_p++; - for (i = 0, val = 0; ; i++, script->script_p++) + for (val = 0; ; script->script_p++) { c = *script->script_p; if (c >= '0' && c <= '9') c = c - '0'; @@ -407,7 +407,7 @@ int PS_ReadEscapeCharacter(script_t *script, char *ch) default: //NOTE: decimal ASCII code, NOT octal { if (*script->script_p < '0' || *script->script_p > '9') ScriptError(script, "unknown escape char"); - for (i = 0, val = 0; ; i++, script->script_p++) + for (val = 0; ; script->script_p++) { c = *script->script_p; if (c >= '0' && c <= '9') c = c - '0'; diff --git a/codemp/cgame/cg_players.c b/codemp/cgame/cg_players.c index df7b340b7c..eb3eca45a4 100644 --- a/codemp/cgame/cg_players.c +++ b/codemp/cgame/cg_players.c @@ -7979,7 +7979,7 @@ void CG_AddSaberBlade( centity_t *cent, centity_t *scent, refEntity_t *saber, in // SFX Saber trail saberTrail->duration = 0; - if (!saberTrail->base || !saberTrail->tip || !saberTrail->dualbase || !saberTrail->dualtip || !saberTrail->lastTime || !saberTrail->inAction) { + if (!saberTrail->lastTime || !saberTrail->inAction) { VectorCopy(org_, saberTrail->base); VectorMA(end, -1.5f, axis_[0], saberTrail->tip); VectorCopy(saberTrail->base, saberTrail->dualbase); @@ -10100,7 +10100,7 @@ void CG_CheckThirdPersonAlpha( centity_t *cent, refEntity_t *legs ) //[Kameleon] - Nerevar's Santa Hat feature. call somewhere in cg_players@void CG_Player void CG_DrawCosmeticOnPlayer(centity_t* cent, int time, qhandle_t* gameModels, qhandle_t hatModel, refEntity_t parent, int position) { - int newBolt; + int newBolt = 0; mdxaBone_t matrix; vec3_t boltOrg, bAngles; refEntity_t re; @@ -10186,7 +10186,7 @@ void CG_DrawCosmeticOnPlayer(centity_t* cent, int time, qhandle_t* gameModels, q static void CG_DrawCosmeticOnPlayer2(centity_t* cent, int time, qhandle_t* gameModels, cosmeticItem_t *cosmetic, refEntity_t parent, int position) { - int newBolt; + int newBolt = 0; mdxaBone_t matrix; vec3_t boltOrg, bAngles; refEntity_t re; diff --git a/codemp/client/cl_cgame.cpp b/codemp/client/cl_cgame.cpp index f495491654..6965d27eaf 100644 --- a/codemp/client/cl_cgame.cpp +++ b/codemp/client/cl_cgame.cpp @@ -228,7 +228,8 @@ static void CL_UpdateDiscordServerInfo(const char *info) static void CL_ParsePlayerInfo(int start, int end) { - int clientCount = 0, botCount = 0, redTeam = 0, blueTeam = 0, specTeam = 0; +#if defined(DISCORD) && !defined(_DEBUG) + int clientCount = 0, botCount = 0, redTeam = 0, blueTeam = 0, specTeam = 0; int i = start; while (i < end) @@ -266,13 +267,6 @@ static void CL_ParsePlayerInfo(int start, int end) i++; } - gCLTotalClientNum = clientCount; - -#ifdef _DEBUG - Com_DPrintf("%i clients\n", gCLTotalClientNum); -#endif - -#if defined(DISCORD) && !defined(_DEBUG) cl.discord.playerCount = clientCount; cl.discord.redTeam = redTeam; cl.discord.blueTeam = blueTeam; diff --git a/codemp/client/cl_console.cpp b/codemp/client/cl_console.cpp index 62b6124d27..4284b0bdd7 100644 --- a/codemp/client/cl_console.cpp +++ b/codemp/client/cl_console.cpp @@ -524,7 +524,7 @@ void Cmd_CompleteTxtName( char *args, int argNum ) { Con_Init ================ */ -static char version[MAX_STRING_CHARS] = { 0 }; + void Con_Init (void) { int i; @@ -908,7 +908,7 @@ void Con_DrawSolidConsole( float frac ) { time_t rawtime; qboolean AM = qtrue; char ts[24]; - const int padding = (int) (0.5f + (con_scale && con_scale->value > 0.0f) ? 2*con_scale->value : 2.0f); + const int padding = (int)(0.5f + ((con_scale->value > 0.0f) ? (2.0f * con_scale->value) : 2.0f)); lines = (int) (cls.glconfig.vidHeight * frac); if (lines <= 0) diff --git a/codemp/client/cl_discordrpc.cpp b/codemp/client/cl_discordrpc.cpp index 574c9f7937..58447eac1a 100644 --- a/codemp/client/cl_discordrpc.cpp +++ b/codemp/client/cl_discordrpc.cpp @@ -483,12 +483,12 @@ void CL_DiscordUpdatePresence(void) { //send join information blank since it won't do anything in this case discordPresence.partyId = PartyID(); // Server-IP zum abgleichen discordchat - send join request in discord chat if (cl_discordRichPresence->integer > 1) { - discordPresence.partySize = cls.state == CA_ACTIVE ? 1 : NULL; - discordPresence.partyMax = cls.state == CA_ACTIVE ? ((cl.discord.maxPlayers - cl.discord.playerCount) + discordPresence.partySize) : NULL; + discordPresence.partySize = cls.state == CA_ACTIVE ? 1 : 0; + discordPresence.partyMax = cls.state == CA_ACTIVE ? ((cl.discord.maxPlayers - cl.discord.playerCount) + discordPresence.partySize) : 0; } else { - discordPresence.partySize = cls.state >= CA_LOADING ? cl.discord.playerCount : NULL; - discordPresence.partyMax = cls.state >= CA_LOADING ? cl.discord.maxPlayers : NULL; + discordPresence.partySize = cls.state >= CA_LOADING ? cl.discord.playerCount : 0; + discordPresence.partyMax = cls.state >= CA_LOADING ? cl.discord.maxPlayers : 0; } discordPresence.joinSecret = joinSecret(); // Server-IP zum discordJoin ausf�hren - serverip for discordjoin to execute } diff --git a/codemp/client/cl_keys.cpp b/codemp/client/cl_keys.cpp index 9bb8a884ad..8519c0dbcd 100644 --- a/codemp/client/cl_keys.cpp +++ b/codemp/client/cl_keys.cpp @@ -1647,7 +1647,7 @@ void CL_ParseBinding( int key, qboolean down, unsigned time ) // filter semicolons that aren't in quotes into magic chars, preserving semicolons that are in quotes const char nonQuotedSemicolonMagicChar = '\x01'; - bool inQuote = false; + // bool inQuote = false; int quotes = 0; while (*p) { if (*p == '"') { diff --git a/codemp/client/cl_main.cpp b/codemp/client/cl_main.cpp index 7dc314b377..cdeda3c429 100644 --- a/codemp/client/cl_main.cpp +++ b/codemp/client/cl_main.cpp @@ -166,10 +166,10 @@ typedef struct serverStatus_s qboolean retrieved; } serverStatus_t; -serverStatus_t cl_serverStatusList[MAX_SERVERSTATUSREQUESTS] = { 0 }; +serverStatus_t cl_serverStatusList[MAX_SERVERSTATUSREQUESTS] = {{{0}}}; int serverStatusCount = 0; -IHeapAllocator *G2VertSpaceClient = 0; +IHeapAllocator *G2VertSpaceClient = nullptr; extern void SV_BotFrame( int time ); void CL_CheckForResend( void ); diff --git a/codemp/client/cl_tc_vis.cpp b/codemp/client/cl_tc_vis.cpp index 11552e991a..c4c9d79ed4 100644 --- a/codemp/client/cl_tc_vis.cpp +++ b/codemp/client/cl_tc_vis.cpp @@ -125,7 +125,7 @@ static qboolean InPVS(const vec3_t p) int cluster = CM_LeafCluster(leafnum); int area = CM_LeafArea(leafnum); - if (g_pvsMask && (!g_pvsMask[cluster >> 3] & (1 << (cluster & 7)))) + if (g_pvsMask && (!(g_pvsMask[cluster >> 3] & (1 << (cluster & 7))))) return qfalse; if (!CM_AreasConnected(g_pvsArea, area)) return qfalse; diff --git a/codemp/game/NPC_utils.c b/codemp/game/NPC_utils.c index f811e75894..dd51864001 100644 --- a/codemp/game/NPC_utils.c +++ b/codemp/game/NPC_utils.c @@ -1274,7 +1274,7 @@ int NPC_FindNearestEnemy( gentity_t *ent ) int nearestEntID = -1; float nearestDist = (float)WORLD_SIZE*(float)WORLD_SIZE; float distance; - int numEnts, numChecks = 0; + int numEnts; //, numChecks = 0; int i; //Setup the bbox to search in @@ -1298,7 +1298,7 @@ int NPC_FindNearestEnemy( gentity_t *ent ) if ( NPC_ValidEnemy( radEnt ) == qfalse ) continue; - numChecks++; + //numChecks++; //Must be visible if ( NPC_TargetVisible( radEnt ) == qfalse ) continue; diff --git a/codemp/game/ai_main.c b/codemp/game/ai_main.c index d117b6bc96..07cbe51ca6 100644 --- a/codemp/game/ai_main.c +++ b/codemp/game/ai_main.c @@ -2849,9 +2849,9 @@ int CTFTakesPriority(bot_state_t *bs) int enemyHasOurFlag = 0; //int weHaveEnemyFlag = 0; int numOnMyTeam = 0; - int numOnEnemyTeam = 0; + //int numOnEnemyTeam = 0; int numAttackers = 0; - int numDefenders = 0; + //int numDefenders = 0; int i = 0; int idleWP; int dosw = 0; @@ -2970,7 +2970,7 @@ int CTFTakesPriority(bot_state_t *bs) } else { - numOnEnemyTeam++; + //numOnEnemyTeam++; } if (botstates[ent->s.number]) @@ -2982,7 +2982,7 @@ int CTFTakesPriority(bot_state_t *bs) } else { - numDefenders++; + //numDefenders++; } } else @@ -3962,9 +3962,9 @@ void CommanderBotCTFAI(bot_state_t *bs) int enemyHasOurFlag = 0; int weHaveEnemyFlag = 0; int numOnMyTeam = 0; - int numOnEnemyTeam = 0; + //int numOnEnemyTeam = 0; int numAttackers = 0; - int numDefenders = 0; + //int numDefenders = 0; if (level.clients[bs->client].sess.sessionTeam == TEAM_RED) { @@ -4005,7 +4005,7 @@ void CommanderBotCTFAI(bot_state_t *bs) } else { - numOnEnemyTeam++; + //numOnEnemyTeam++; } if (botstates[ent->s.number]) @@ -4017,7 +4017,7 @@ void CommanderBotCTFAI(bot_state_t *bs) } else { - numDefenders++; + //numDefenders++; } } else @@ -4199,7 +4199,7 @@ void CommanderBotTeamplayAI(bot_state_t *bs) { int i = 0; int squadmates = 0; - int teammates = 0; + //int teammates = 0; int teammate_indanger = -1; int teammate_helped = 0; int foundsquadleader = 0; @@ -4234,7 +4234,7 @@ void CommanderBotTeamplayAI(bot_state_t *bs) if (ent && ent->client && OnSameTeam(&g_entities[bs->client], ent)) { - teammates++; + //teammates++; if (ent->health < worsthealth) { @@ -6499,7 +6499,7 @@ void NewBotAI_Getup(bot_state_t *bs) useTheForce = qtrue; } - if (!useTheForce && (bs->frame_Enemy_Len < 200) || (bs->cur_ps.fd.forceGripBeingGripped > level.time)) { + if ((!useTheForce && ((bs->frame_Enemy_Len < 200) || (bs->cur_ps.fd.forceGripBeingGripped > level.time)))) { if (!(g_forcePowerDisable.integer & (1 << FP_PUSH)) && bs->cur_ps.fd.forcePowersKnown & (1 << FP_PUSH)) { level.clients[bs->client].ps.fd.forcePowerSelected = FP_PUSH; useTheForce = qtrue; @@ -7493,7 +7493,11 @@ void NewBotAI_GetMovement(bot_state_t *bs) trap->EA_MoveForward(bs->client); crouch = qtrue; } - else if ((g_entities[bs->client].health < 25 || (g_entities[bs->client].health < 50 && bs->cur_ps.fd.forcePower < 30) && !(bs->cur_ps.fd.forcePowersActive & (1 << FP_ABSORB))) && (bs->frame_Enemy_Len < 450)) { + else if ((g_entities[bs->client].health < 25) || + ((g_entities[bs->client].health < 50) + && (bs->cur_ps.fd.forcePower < 30) + && !(bs->cur_ps.fd.forcePowersActive & (1 << FP_ABSORB)) + && (bs->frame_Enemy_Len < 450))) { qboolean wallRun = qfalse; //Running routine, we should add a wallrun search to this. @@ -7657,8 +7661,8 @@ qboolean NewBotAI_IsEnemyPullable(bot_state_t *bs) { int NewBotAI_GetPull(bot_state_t *bs) { const int ourHealth = g_entities[bs->client].health, hisHealth = bs->currentEnemy->health, ourForce = bs->cur_ps.fd.forcePower; - int weight = ourHealth - hisHealth; - + int healthDiff = ourHealth - hisHealth; + float weight = (float)healthDiff; if (g_forcePowerDisable.integer & (1 << FP_PULL)) return 0; if (!(bs->cur_ps.fd.forcePowersKnown & (1 << FP_PULL))) @@ -7703,24 +7707,24 @@ int NewBotAI_GetPull(bot_state_t *bs) { } if (BG_InKnockDown(bs->currentEnemy->client->ps.legsAnim)) { //Com_Printf("pullable 3\n"); - return (weight * 2); + return (int)(weight * 2); } //Com_Printf("pullable 1\n"); if (bs->cur_ps.fd.forceSide == FORCE_LIGHTSIDE) { if (bs->frame_Enemy_Len < 250 && ourForce > 32) - return (weight); + return (int)weight; } else - return (weight); + return (int)weight; } else { //When should we pull stun? //Lets say they should be on the same plane roughly.. float heightDiff = bs->cur_ps.origin[2] - bs->currentEnemy->client->ps.origin[2]; //Us - them. Positive means we are higher. if (heightDiff > -20 && heightDiff < 40) {//If we are less than 20 above or less than 40 below) if (bs->frame_Enemy_Len < 100 && ourForce >= 60) { //Close enough and enough force - weight = ourForce * 0.1f; + weight = (float)ourForce * 0.1f; //Com_Printf("weight: %i\n", weight); - return (weight); + return (int)weight; } } diff --git a/codemp/game/bg_pmove.c b/codemp/game/bg_pmove.c index 78923e049b..9d6e8cc33c 100644 --- a/codemp/game/bg_pmove.c +++ b/codemp/game/bg_pmove.c @@ -1312,7 +1312,7 @@ void PM_AirAccelerate (vec3_t wishdir, float wishspeed, float accel) { int i; float addspeed, accelspeed, currentspeed, wishspd = wishspeed; - + if (pm->ps->pm_type == PM_DEAD) return; if (pm->ps->pm_flags & PMF_TIME_WATERJUMP) @@ -3337,7 +3337,7 @@ static qboolean PM_CheckJump( void ) if (added > 0) { if (moveStyle == MV_QW || moveStyle == MV_PJK) pm->ps->velocity[2] += (added * 0.75f); //Forcejump rampjump initial upspeed - else if ((moveStyle == MV_WSW)) + else if (moveStyle == MV_WSW) pm->ps->velocity[2] += (added * 0.75f);//Make rampjump weaker for wsw since no speedloss else pm->ps->velocity[2] += (added * 1.25f); //Make rampjump stronger for cpm/q3/slick @@ -4066,7 +4066,7 @@ static void PM_ThrustMove(void) if (pm->ps->stats[STAT_WJTIME] > 500) { //500 to 0 float strength; float basespeed = pm->ps->basespeed; - float dot = DotProduct(pml.forward, pm->ps->velocity); //-1 to 1. -1 should be strongest 1 sh ould be weakest. + float dot = DotProduct(pml.forward, pm->ps->velocity); //-1 to 1. -1 should be strongest 1 sh ould be weakest. if (dot < 0) dot = 0; @@ -4077,7 +4077,7 @@ static void PM_ThrustMove(void) //Com_Printf("Strength modifier is %.2f because dot is %.2f and speed is %.2f\n", strength, dot, basespeed); //Modify strength based on current vel length. Faster we are going, less it boosts. but define "we are going" as the vel length times the dotproduct of vel and forward. Lower cap at 0 instead of -1. - + if (strength > 3) strength = 3; else if (strength < 0.4) @@ -4108,7 +4108,7 @@ static void PM_BlinkMove(void) //Just blink for now //Todo - fix the trace behaviour where if it hits a plane it just stops at that spot. Should slide along for the rest of the stepsize? this makes it really hard to use this if you are on the ground and aimed even 1 degree down //Todo, rewrite so only checks if button is used. Also way to pick a special (force profile?). Also rewrite so this calls individual special functions. - //Maybe there is a better way to do this performance-wise. Or a way to redesign the traces so that instead of doign 1 every frame, it does 1 every time the trace stepsize > 100 or something. + //Maybe there is a better way to do this performance-wise. Or a way to redesign the traces so that instead of doign 1 every frame, it does 1 every time the trace stepsize > 100 or something. //E.g. adding the blink stepsize each frame and only doing a trace when it hits the limit, then resetting the counter. //Doing time*time means the traces at start/finish are very small @@ -9745,7 +9745,7 @@ if (pm->ps->duelInProgress) addTime = 1050; break; case WP_THERMAL: - if (!pm->ps->stats[STAT_RACEMODE] && (g_tweakWeapons.integer & WT_IMPACT_NITRON) || (g_tweakWeapons.integer & WT_TRIBES)) + if (!(pm->ps->stats[STAT_RACEMODE]) && ((g_tweakWeapons.integer & WT_IMPACT_NITRON) || (g_tweakWeapons.integer & WT_TRIBES))) addTime = 1500; break; case WP_DET_PACK: @@ -12568,10 +12568,11 @@ void PM_MoveForKata(usercmd_t *ucmd) } } +/* static QINLINE float bg_roundfloat(float n) { return (n < 0.0f) ? ceilf(n - 0.5f) : floorf(n + 0.5f); -} +}*/ void PmoveSingle (pmove_t *pmove) { qboolean stiffenedUp = qfalse; diff --git a/codemp/game/g_account.c b/codemp/game/g_account.c index 3f802a7190..4c81321e0b 100644 --- a/codemp/game/g_account.c +++ b/codemp/game/g_account.c @@ -455,11 +455,11 @@ void G_AddDuelElo(char *winner, char *loser, int type, int duration, int winner_ if (newUserCutoff < 0) newUserCutoff = 0; - if (provisionalCutoff < 0); + if (provisionalCutoff < 0) provisionalCutoff = 0; - if (provisionalChangeBig < 0.1f); + if (provisionalChangeBig < 0.1f) provisionalChangeBig = 0.1f; - if (provisionalChangeSmall < 0.1f); + if (provisionalChangeSmall < 0.1f) provisionalChangeSmall = 0.1f; winnerDuelCount = GetDuelCount(winner, type, end_time, db); @@ -1801,7 +1801,7 @@ void G_AddRaceTime(char *username, char *message, int duration_ms, int style, in sqlite3_stmt * stmt; int s; int season_oldBest, season_oldRank = 0, season_newRank = -1, global_oldBest, global_oldRank = 0, global_newRank = -1; //Changed newrank to be -1 ?? - float addedScore; + float addedScore = 0.0f; gclient_t *cl; const int season = G_GetSeason(); @@ -2328,7 +2328,7 @@ void Cmd_ChangePassword_f( gentity_t *ent ) { sqlite3 * db; char * sql; sqlite3_stmt * stmt; - int row = 0, s; + int s; //row = 0, s; char username[16], enteredPassword[16], newPassword[16], password[16]; if (trap->Argc() != 4) { @@ -2365,7 +2365,7 @@ void Cmd_ChangePassword_f( gentity_t *ent ) { s = sqlite3_step(stmt); if (s == SQLITE_ROW) { Q_strncpyz(password, (char*)sqlite3_column_text(stmt, 0), sizeof(password)); - row++; + //row++; } else if (s == SQLITE_DONE) break; @@ -2712,8 +2712,8 @@ void Svcmd_AccountInfo_f(void) sqlite3 * db; char * sql; sqlite3_stmt * stmt; - int lastlogin, created, racetime; - unsigned int lastip; + int lastlogin = 0, created = 0, racetime = 0; + unsigned int lastip = 0; int s; char timeStr[64] = { 0 }, buf[MAX_STRING_CHARS - 64] = { 0 }; @@ -2883,7 +2883,7 @@ void Svcmd_FlagAccount_f( void ) { for (i=0; ipers.userName && cl->pers.userName[0] && !Q_stricmp(cl->pers.userName, username)) { + if (cl->pers.userName[0] && !Q_stricmp(cl->pers.userName, username)) { if (flags & (1 << index)) cl->sess.accountFlags &= ~(1 << index); else @@ -2930,7 +2930,7 @@ void Svcmd_FlagAccount_f( void ) { for (i=0; ipers.userName && cl->pers.userName[0] && !Q_stricmp(cl->pers.userName, username)) { + if (cl->pers.userName[0] && !Q_stricmp(cl->pers.userName, username)) { cl->sess.accountFlags = bitmask; break; } @@ -2951,7 +2951,7 @@ void Svcmd_ListAdmins_f(void) char * sql; sqlite3_stmt * stmt; int s; - unsigned int flags; + //unsigned int flags; char adminString[16]; int row = 1; @@ -2965,7 +2965,7 @@ void Svcmd_ListAdmins_f(void) while (1) { s = sqlite3_step(stmt); if (s == SQLITE_ROW) { - flags = sqlite3_column_int(stmt, 1); + //flags = sqlite3_column_int(stmt, 1); Q_strncpyz(adminString, "Admin", sizeof(adminString)); Com_Printf(va("^5%2i^3: ^3%-18s %s^7\n", row, (char*)sqlite3_column_text(stmt, 0), adminString)); row++; @@ -3450,7 +3450,7 @@ void Cmd_ACRegister_f( gentity_t *ent ) { //Temporary, until global shit is done } void Cmd_ACLogout_f( gentity_t *ent ) { //If logged in, print logout msg, remove login status. - if (ent->client->pers.userName && ent->client->pers.userName[0]) { + if (ent->client->pers.userName[0]) { if (ent->client->sess.raceMode && !ent->client->pers.practice && ent->client->pers.stats.startTime) { ent->client->pers.stats.racetime += (trap->Milliseconds() - ent->client->pers.stats.startTime)*0.001f - ent->client->afkDuration*0.001f; ent->client->afkDuration = 0; @@ -3506,7 +3506,7 @@ void Cmd_JoinTeam_f( gentity_t *ent ) { sqlite3_stmt * stmt; int s;//, row = 0; qboolean inviteOnly = qfalse; - int count; + int count = 0; CALL_SQLITE (open (LOCAL_DB_PATH, & db)); @@ -4275,7 +4275,7 @@ void Cmd_AdminTeam_f( gentity_t *ent ) { return; } - if (!ent->client->pers.userName || !ent->client->pers.userName[0]) { + if (!ent->client->pers.userName[0]) { trap->SendServerCommand(ent-g_entities, "print \"You must be logged in to use this command.\n\""); return; } @@ -5922,7 +5922,7 @@ void Cmd_DFCompare_f(gentity_t *ent) { char inputString[16], inputStyleString[16], myUsername[16], theirUsername[16]; const int args = trap->Argc(); - if (!ent->client->pers.userName || !ent->client->pers.userName[0]) { + if (!ent->client->pers.userName[0]) { trap->SendServerCommand(ent - g_entities, "print \"You must be logged in to use this command.\n\""); return; } @@ -6623,7 +6623,7 @@ void Cmd_DFTodo_f(gentity_t *ent) { char styleString[16] = {0}, inputString[32], partialCourseName[40], username[16]; qboolean enteredCoursename = qfalse; - if (!ent->client->pers.userName || !ent->client->pers.userName[0]) { + if (!ent->client->pers.userName[0]) { trap->SendServerCommand(ent-g_entities, "print \"You must be logged in to use this command.\n\""); return; } @@ -6859,7 +6859,7 @@ void Cmd_DFPopular_f(gentity_t *ent) { return; //Arg doesnt match any expected values so error. } - if (enteredUsername && (!ent->client->pers.userName || !ent->client->pers.userName[0])) { + if (enteredUsername && (!ent->client->pers.userName[0])) { trap->SendServerCommand(ent-g_entities, "print \"You must be logged in to use this command.\n\""); return; } diff --git a/codemp/game/g_active.c b/codemp/game/g_active.c index 94c4e08873..8790dfd882 100644 --- a/codemp/game/g_active.c +++ b/codemp/game/g_active.c @@ -3208,7 +3208,7 @@ void G_SetTauntAnim( gentity_t *ent, int taunt ) } if (ent->client->ps.weapon == WP_SABER) //JAPRO - Serverside - Saber bow sound fix { - if ( ent->client->ps.saberHolstered == 1 && ent->client->saber[1].model && ent->client->saber[1].model[0] ) + if ( ent->client->ps.saberHolstered == 1 && ent->client->saber[1].model[0] ) {//turn off second saber G_Sound( ent, CHAN_WEAPON, ent->client->saber[1].soundOff ); } @@ -4491,7 +4491,7 @@ void ClientThink_real( gentity_t *ent ) { } } } - if (ent->client->pers.lastUserName && ent->client->pers.lastUserName[0] && duelAgainst->client->pers.lastUserName && duelAgainst->client->pers.lastUserName[0]) {//loda + if (ent->client->pers.lastUserName[0] && duelAgainst->client->pers.lastUserName[0]) {//loda if (!(ent->client->sess.accountFlags & JAPRO_ACCOUNTFLAG_NODUEL) && !(duelAgainst->client->sess.accountFlags & JAPRO_ACCOUNTFLAG_NODUEL)) G_AddDuel(ent->client->pers.lastUserName, duelAgainst->client->pers.lastUserName, ent->client->pers.duelStartTime, dueltypes[ent->client->ps.clientNum], ent->client->ps.stats[STAT_HEALTH], ent->client->ps.stats[STAT_ARMOR]); } @@ -5450,7 +5450,7 @@ void ClientThink_real( gentity_t *ent ) { { int delay = 300; if (g_tweakSaber.integer & ST_FASTCYCLE) { - if (!(ent->client->saber[0].singleBladeStyle || (ent->client->saber[1].model && ent->client->saber[1].model[0])))//Single + if (!(ent->client->saber[0].singleBladeStyle || (ent->client->saber[1].model[0])))//Single delay = 100; } if (ent->client->genCmdDebounce[GENCMD_DELAY_SABERSWITCH] > level.time - delay) //Not sure what this should be.. on baseJK you can bypass any delay, though it seems clearly intended to be 300ms delay.. diff --git a/codemp/game/g_client.c b/codemp/game/g_client.c index 39ec0acfbd..98bd6e4f8b 100644 --- a/codemp/game/g_client.c +++ b/codemp/game/g_client.c @@ -2845,7 +2845,7 @@ char *ClientConnect( int clientNum, qboolean firstTime, qboolean isBot ) { } //Com_Printf("CLIENTCONNECT: IP: %s, OLD SLOT IP: %s\n", tmpIP, level.clients[clientNum].sess.IP); - if (!isBot && !level.clients[clientNum].sess.IP[0] || !CompareIPs(tmpIP, level.clients[clientNum].sess.IP)) { //New Client, remove ignore if it was there + if ((!isBot && !level.clients[clientNum].sess.IP[0]) || !CompareIPs(tmpIP, level.clients[clientNum].sess.IP)) { //New Client, remove ignore if it was there ClientRemoveIgnore(clientNum);//JAPRO IGNORE, move this to clientConnect, and only do it if IP does not match previous slot } @@ -4181,17 +4181,17 @@ void ClientSpawn(gentity_t *ent) { { //maxHealth = Com_Clampi( 1, 100, atoi( Info_ValueForKey( userinfo, "handicap" ) ) ); if (client->pers.tribesClass == 3) { - maxHealth = maxHealth = 1000; + maxHealth = 1000; client->ps.iModelScale = 125; VectorSet(ent->modelScale, 1.25f, 1.25f, 1.25f); VectorScale(ent->r.mins, 1.25f, ent->r.mins); VectorScale(ent->r.maxs, 1.25f, ent->r.maxs); } else if (client->pers.tribesClass == 2 || (g_tribesMode.integer == 2)) { - maxHealth = maxHealth = 700; + maxHealth = 700; } else if (client->pers.tribesClass == 1) { - maxHealth = maxHealth = 500; + maxHealth = 500; client->ps.iModelScale = 94; VectorSet(ent->modelScale, 0.92f, 0.94f, 0.94f); VectorScale(ent->r.mins, 0.94f, ent->r.mins); @@ -4859,16 +4859,16 @@ void ClientDisconnect( int clientNum ) { if (ent->client->ps.duelInProgress) { gentity_t *duelAgainst = &g_entities[ent->client->ps.duelIndex]; - if (ent->client->pers.lastUserName && ent->client->pers.lastUserName[0] && duelAgainst->client && duelAgainst->client->pers.lastUserName && duelAgainst->client->pers.lastUserName[0]) { + if (ent->client->pers.lastUserName[0] && duelAgainst->client && duelAgainst->client->pers.lastUserName[0]) { //Trying to dodge the duel, no no no if (!(ent->client->sess.accountFlags & JAPRO_ACCOUNTFLAG_NODUEL) && !(duelAgainst->client->sess.accountFlags & JAPRO_ACCOUNTFLAG_NODUEL)) G_AddDuel(duelAgainst->client->pers.lastUserName, ent->client->pers.lastUserName, duelAgainst->client->pers.duelStartTime, dueltypes[ent->client->ps.clientNum], duelAgainst->client->ps.stats[STAT_HEALTH], duelAgainst->client->ps.stats[STAT_ARMOR]); } } - if (ent->client->pers.userName && ent->client->pers.userName[0]) { + if (ent->client->pers.userName[0]) { if (ent->client->sess.raceMode && !ent->client->pers.practice && ent->client->pers.stats.startTime) { - ent->client->pers.stats.racetime += (trap->Milliseconds() - ent->client->pers.stats.startTime)*0.001f - ent->client->afkDuration*0.001f; + ent->client->pers.stats.racetime += (trap->Milliseconds() - (float)ent->client->pers.stats.startTime)*0.001f - ent->client->afkDuration*0.001f; ent->client->afkDuration = 0; } if (ent->client->pers.stats.racetime > 120.0f) { diff --git a/codemp/game/g_cmds.c b/codemp/game/g_cmds.c index 92a66810ca..bfe820f17b 100644 --- a/codemp/game/g_cmds.c +++ b/codemp/game/g_cmds.c @@ -747,7 +747,7 @@ static QINLINE void ResetSpecificPlayerTimers(gentity_t* ent, qboolean print) { ent->client->ps.ammo[AMMO_DETPACK] = 4; } - if (ent->client->pers.userName && ent->client->pers.userName[0]) { + if (ent->client->pers.userName[0]) { if (ent->client->sess.raceMode && !ent->client->pers.practice && ent->client->pers.stats.startTime) { ent->client->pers.stats.racetime += (trap->Milliseconds() - ent->client->pers.stats.startTime) * 0.001f - ent->client->afkDuration * 0.001f; ent->client->afkDuration = 0; @@ -1527,7 +1527,7 @@ void SetTeam( gentity_t *ent, char *s, qboolean forcedToJoin ) {//JAPRO - Modifi if (client->ps.duelInProgress) { gentity_t *duelAgainst = &g_entities[client->ps.duelIndex]; - if (ent->client->pers.lastUserName && ent->client->pers.lastUserName[0] && duelAgainst->client && duelAgainst->client->pers.lastUserName && duelAgainst->client->pers.lastUserName[0]) { + if (ent->client->pers.lastUserName[0] && duelAgainst->client && duelAgainst->client->pers.lastUserName[0]) { if (!(ent->client->sess.accountFlags & JAPRO_ACCOUNTFLAG_NODUEL) && !(duelAgainst->client->sess.accountFlags & JAPRO_ACCOUNTFLAG_NODUEL)) G_AddDuel(duelAgainst->client->pers.lastUserName, ent->client->pers.lastUserName, duelAgainst->client->pers.duelStartTime, dueltypes[ent->client->ps.clientNum], duelAgainst->client->ps.stats[STAT_HEALTH], duelAgainst->client->ps.stats[STAT_ARMOR]); } diff --git a/codemp/game/g_items.c b/codemp/game/g_items.c index c6e1e0af67..ee2348ff34 100644 --- a/codemp/game/g_items.c +++ b/codemp/game/g_items.c @@ -3341,12 +3341,12 @@ so the client will know which ones to precache void SaveRegisteredItems( void ) { char string[MAX_ITEMS+1]; int i; - int count; + //int count; - count = 0; + //count = 0; for ( i = 0 ; i < bg_numItems ; i++ ) { if ( itemRegistered[i] ) { - count++; + //count++; string[i] = '1'; } else { string[i] = '0'; diff --git a/codemp/game/g_main.c b/codemp/game/g_main.c index b3b18c123c..95520aa6d7 100644 --- a/codemp/game/g_main.c +++ b/codemp/game/g_main.c @@ -87,10 +87,10 @@ All but the last will have the teamchain field set to the next one void G_FindTeams( void ) { gentity_t *e, *e2; int i, j; - int c, c2; + //int c, c2; - c = 0; - c2 = 0; + //c = 0; + //c2 = 0; for ( i=MAX_CLIENTS, e=g_entities+i ; i < level.num_entities ; i++,e++ ) { if (!e->inuse) continue; @@ -101,8 +101,8 @@ void G_FindTeams( void ) { if (e->r.contents==CONTENTS_TRIGGER) continue;//triggers NEVER link up in teams! e->teammaster = e; - c++; - c2++; + //c++; + //c2++; for (j=i+1, e2=e+1 ; j < level.num_entities ; j++,e2++) { if (!e2->inuse) @@ -113,7 +113,7 @@ void G_FindTeams( void ) { continue; if (!strcmp(e->team, e2->team)) { - c2++; + //c2++; e2->teamchain = e->teamchain; e->teamchain = e2; e2->teammaster = e; diff --git a/codemp/game/g_mover.c b/codemp/game/g_mover.c index 1523e0d5bd..44a05fdfe3 100644 --- a/codemp/game/g_mover.c +++ b/codemp/game/g_mover.c @@ -981,7 +981,7 @@ void Use_BinaryMover( gentity_t *ent, gentity_t *other, gentity_t *activator ) strength = (height / time) * 2.0f; activator->client->ps.velocity[0] = activator->client->ps.velocity[1] = 0; //reset our xyspeed... meh - if (strength > activator->client->ps.velocity[2])//Only apply the jumppad if it would speed them up + if (strength > activator->client->ps.velocity[2]) //Only apply the jumppad if it would speed them up activator->client->ps.velocity[2] = strength; //trap->Print("Height: %.2f, time: %.2fstrength: %.2f\n", height, time, strength); diff --git a/codemp/game/g_svcmds.c b/codemp/game/g_svcmds.c index b3a9bc6f4f..a555934560 100644 --- a/codemp/game/g_svcmds.c +++ b/codemp/game/g_svcmds.c @@ -686,7 +686,7 @@ void Svcmd_ChangeGametype_f (void) { //because of "variable change -- restarting ent = &g_entities[i]; if (!ent->client || !ent->inuse) continue; - if (level.gametype < GT_TEAM && (ent->client->sess.sessionTeam == TEAM_RED) || (ent->client->sess.sessionTeam == TEAM_BLUE)) + if ((level.gametype < GT_TEAM) && ((ent->client->sess.sessionTeam == TEAM_RED) || (ent->client->sess.sessionTeam == TEAM_BLUE))) SetTeam(ent, "f", qtrue); if (level.gametype >= GT_TEAM && (ent->client->sess.sessionTeam == TEAM_FREE) && !ent->client->sess.raceMode) { if (red) @@ -882,7 +882,7 @@ void Svcmd_ToggleTweakWeapons_f( void ) { else { char arg[8] = { 0 }; int index; - const uint32_t mask = ((1 << MAX_WEAPON_TWEAKS) - 1); //overflow? + const uint32_t mask = (1 << MAX_WEAPON_TWEAKS); //overflow? trap->Argv( 1, arg, sizeof(arg) ); index = atoi( arg ); diff --git a/codemp/game/g_syscalls.c b/codemp/game/g_syscalls.c index dc38b9660c..9fb5948304 100644 --- a/codemp/game/g_syscalls.c +++ b/codemp/game/g_syscalls.c @@ -149,9 +149,14 @@ static QINLINE void BeginHack(int entityNum) int i; for (i = 0; i < level.num_entities; i++) { //This is numentities not max_clients because of NPCS if (i != entityNum && i != level.clients[entityNum].ps.duelIndex) { - if (g_entities[i].inuse && - ((g_entities[i].s.eType == ET_PLAYER || g_entities[i].s.eType == ET_NPC) || - ((dueltypes[level.clients[entityNum].ps.clientNum] <= 1) && g_entities[i].s.eType == ET_GENERAL && (!Q_stricmp(g_entities[i].classname, "laserTrap")) || (!Q_stricmp(g_entities[i].classname, "detpack"))))) { + if ((g_entities[i].inuse) && + ((g_entities[i].s.eType == ET_PLAYER) || + (g_entities[i].s.eType == ET_NPC) || + ((g_entities[i].s.eType == ET_GENERAL) && + ((dueltypes[level.clients[entityNum].ps.clientNum] <= 1) && + (!(Q_stricmp(g_entities[i].classname, "laserTrap")) || + (!(Q_stricmp(g_entities[i].classname, "detpack")))))))) + { saved[i] = g_entities[i].r.ownerNum; g_entities[i].r.ownerNum = entityNum; } @@ -162,11 +167,15 @@ static QINLINE void BeginHack(int entityNum) int i; for (i = 0; i < level.num_entities; i++) { ////This is numentities not max_clients because of NPCS if (i != entityNum) { - if (g_entities[i].inuse && - ((g_entities[i].s.eType == ET_PLAYER) || - (g_entities[i].s.eType == ET_NPC) || - (g_entities[i].s.eType == ET_MOVER && ((!Q_stricmp(g_entities[i].classname, "func_door") || !Q_stricmp(g_entities[i].classname, "func_plat")))) || - (g_entities[i].s.eType == ET_GENERAL && (!Q_stricmp(g_entities[i].classname, "laserTrap")) || (!Q_stricmp(g_entities[i].classname, "detpack"))))) + if ((g_entities[i].inuse) && + ((g_entities[i].s.eType == ET_PLAYER) || + (g_entities[i].s.eType == ET_NPC) || + ((g_entities[i].s.eType == ET_MOVER) && + (!(Q_stricmp(g_entities[i].classname, "func_door")) || + (!(Q_stricmp(g_entities[i].classname, "func_plat"))))) || + ((g_entities[i].s.eType == ET_GENERAL) && + (!(Q_stricmp(g_entities[i].classname, "laserTrap")) || + (!(Q_stricmp(g_entities[i].classname, "detpack"))))))) { saved[i] = g_entities[i].r.ownerNum; g_entities[i].r.ownerNum = entityNum; @@ -207,7 +216,7 @@ static QINLINE void EndHack(int entityNum) { //Should be inline? if (i != entityNum && i != level.clients[entityNum].ps.duelIndex) { if (g_entities[i].inuse && ((g_entities[i].s.eType == ET_PLAYER || g_entities[i].s.eType == ET_NPC) || - ((dueltypes[level.clients[entityNum].ps.clientNum] <= 1) && g_entities[i].s.eType == ET_GENERAL && (!Q_stricmp(g_entities[i].classname, "laserTrap")) || (!Q_stricmp(g_entities[i].classname, "detpack"))))) { + (((dueltypes[level.clients[entityNum].ps.clientNum] <= 1) && (g_entities[i].s.eType == ET_GENERAL)) && (!Q_stricmp(g_entities[i].classname, "laserTrap") || !Q_stricmp(g_entities[i].classname, "detpack"))))) { g_entities[i].r.ownerNum = saved[i]; } } @@ -217,11 +226,10 @@ static QINLINE void EndHack(int entityNum) { //Should be inline? int i; for (i = 0; i < level.num_entities; i++) { if (i != entityNum) { - if (g_entities[i].inuse && - ((g_entities[i].s.eType == ET_PLAYER) || - (g_entities[i].s.eType == ET_NPC) || - (g_entities[i].s.eType == ET_MOVER && ((!Q_stricmp(g_entities[i].classname, "func_door") || !Q_stricmp(g_entities[i].classname, "func_plat")))) || - (g_entities[i].s.eType == ET_GENERAL && (!Q_stricmp(g_entities[i].classname, "laserTrap")) || (!Q_stricmp(g_entities[i].classname, "detpack"))))) + if ((g_entities[i].inuse && (g_entities[i].s.eType == ET_PLAYER)) || + (g_entities[i].inuse && (g_entities[i].s.eType == ET_NPC)) || + ((g_entities[i].s.eType == ET_MOVER) && (!Q_stricmp(g_entities[i].classname, "func_door") || !Q_stricmp(g_entities[i].classname, "func_plat"))) || + ((g_entities[i].s.eType == ET_GENERAL) && (!Q_stricmp(g_entities[i].classname, "laserTrap") || !Q_stricmp(g_entities[i].classname, "detpack")))) { g_entities[i].r.ownerNum = saved[i]; } diff --git a/codemp/game/g_team.c b/codemp/game/g_team.c index 211ce4fec5..a8ff73b400 100644 --- a/codemp/game/g_team.c +++ b/codemp/game/g_team.c @@ -754,7 +754,7 @@ int Team_TouchOneFlagBase (gentity_t *ent, gentity_t *other, int team) { other->client->pers.teamState.captures++; other->client->rewardTime = level.time + REWARD_SPRITE_TIME; other->client->ps.persistant[PERS_CAPTURES]++; - if (other->client->pers.userName && other->client->pers.userName[0]) + if (other->client->pers.userName[0]) G_AddSimpleStat(other->client->pers.userName, 4); // other gets another 10 frag bonus @@ -838,7 +838,7 @@ int Team_TouchOurFlag( gentity_t *ent, gentity_t *other, int team ) { AddScore(other, ent->r.currentOrigin, CTF_RECOVERY_BONUS); other->client->pers.teamState.flagrecovery++; - if (other->client->pers.userName && other->client->pers.userName[0]) + if (other->client->pers.userName[0]) G_AddSimpleStat(other->client->pers.userName, 5); @@ -933,7 +933,7 @@ int Team_TouchOurFlag( gentity_t *ent, gentity_t *other, int team ) { other->client->pers.teamState.captures++; other->client->rewardTime = level.time + REWARD_SPRITE_TIME; other->client->ps.persistant[PERS_CAPTURES]++; - if (other->client->pers.userName && other->client->pers.userName[0]) + if (other->client->pers.userName[0]) G_AddSimpleStat(other->client->pers.userName, 4); // other gets another 10 frag bonus diff --git a/codemp/game/g_trigger.c b/codemp/game/g_trigger.c index 635745b94c..016ee59d34 100644 --- a/codemp/game/g_trigger.c +++ b/codemp/game/g_trigger.c @@ -1695,7 +1695,7 @@ void TimerStop(gentity_t *trigger, gentity_t *player, trace_t *trace) {//JAPRO T G_Sound(player, CHAN_AUTO, trigger->noise_index); if (ValidRaceSettings(trigger->spawnflags, player)) { valid = qtrue; - if (player->client->pers.userName && player->client->pers.userName[0]) + if (player->client->pers.userName[0]) Q_strncpyz(c, S_COLOR_CYAN, sizeof(c)); else Q_strncpyz(c, S_COLOR_GREEN, sizeof(c)); @@ -2159,11 +2159,11 @@ void NewPush(gentity_t *trigger, gentity_t *player, trace_t *trace) {//JAPRO Tim G_Sound(player, CHAN_AUTO, trigger->noise_index); if (trigger->spawnflags & 1) { - if ((!g_fixSlidePhysics.integer && abs(player->client->lastVelocity[0]) > 350) || (g_fixSlidePhysics.integer && abs(player->client->lastVelocity[0]) > 90)) + if ((!g_fixSlidePhysics.integer && fabsf(player->client->lastVelocity[0]) > 350) || (g_fixSlidePhysics.integer && fabsf(player->client->lastVelocity[0]) > 90)) player->client->ps.velocity[0] = player->client->lastVelocity[0] * scale;//XVel Relative Scale } if (trigger->spawnflags & 2) { - if ((!g_fixSlidePhysics.integer && abs(player->client->lastVelocity[1]) > 350) || (g_fixSlidePhysics.integer && abs(player->client->lastVelocity[1]) > 90)) + if ((!g_fixSlidePhysics.integer && fabsf(player->client->lastVelocity[1]) > 350) || (g_fixSlidePhysics.integer && fabsf(player->client->lastVelocity[1]) > 90)) player->client->ps.velocity[1] = player->client->lastVelocity[1] * scale;//YVel Relative Scale } if (trigger->spawnflags & 4) { diff --git a/codemp/game/g_weapon.c b/codemp/game/g_weapon.c index 324f39fc73..76c5a63687 100644 --- a/codemp/game/g_weapon.c +++ b/codemp/game/g_weapon.c @@ -844,7 +844,7 @@ void WP_DisruptorProjectileFire(gentity_t* ent, qboolean altFire) else { if (g_tweakWeapons.integer & WT_TRIBES) damage = 15 * g_weaponDamageScale.value; - else + else damage = 30 * g_weaponDamageScale.value; missile->s.generic1 = 2;//always make the bullet a little bigger missile->s.eFlags |= EF_ALT_FIRING; //have client render it right diff --git a/codemp/game/sqlite3.c b/codemp/game/sqlite3.c index e87a2c5bf6..fde538961d 100644 --- a/codemp/game/sqlite3.c +++ b/codemp/game/sqlite3.c @@ -77263,7 +77263,7 @@ static int resolveSelectStep(Walker *pWalker, Select *p){ NameContext *pOuterNC; /* Context that contains this SELECT */ NameContext sNC; /* Name context of this SELECT */ int isCompound; /* True if p is a compound select */ - int nCompound; /* Number of compound terms processed so far */ + //int nCompound; /* Number of compound terms processed so far */ Parse *pParse; /* Parsing context */ ExprList *pEList; /* Result set expression list */ int i; /* Loop counter */ @@ -77294,7 +77294,7 @@ static int resolveSelectStep(Walker *pWalker, Select *p){ } isCompound = p->pPrior!=0; - nCompound = 0; + //nCompound = 0; pLeftmost = p; while( p ){ assert( (p->selFlags & SF_Expanded)!=0 ); @@ -77424,7 +77424,7 @@ static int resolveSelectStep(Walker *pWalker, Select *p){ /* Advance to the next term of the compound */ p = p->pPrior; - nCompound++; + //nCompound++; } /* Resolve the ORDER BY on a compound SELECT after all terms of diff --git a/codemp/icarus/BlockStream.cpp b/codemp/icarus/BlockStream.cpp index 2c0398186a..6ec877fa1a 100644 --- a/codemp/icarus/BlockStream.cpp +++ b/codemp/icarus/BlockStream.cpp @@ -653,13 +653,12 @@ int CBlockStream::Open( char *buffer, long size ) m_stream = buffer; - for ( size_t i = 0; i < sizeof( id_header ); i++ ) + for (char & i : id_header) { - id_header[i] = GetChar(); + i = GetChar(); } - version = GetFloat(); - version = LittleFloat(version); + version = LittleFloat(GetFloat()); //Check for valid header if ( strcmp( id_header, IBI_HEADER_ID ) ) diff --git a/codemp/mp3code/towave.c b/codemp/mp3code/towave.c index 98d09c0037..98b24d2f94 100644 --- a/codemp/mp3code/towave.c +++ b/codemp/mp3code/towave.c @@ -377,7 +377,7 @@ char *C_MP3_GetUnpackedSize(void *pvData, int iSourceBytesRemaining, int *piUnpa int iDestWriteIndex = 0; int iFrameBytes; - int iFrameCounter; + //int iFrameCounter; DEC_INFO decinfo; IN_OUT x; @@ -408,7 +408,7 @@ char *C_MP3_GetUnpackedSize(void *pvData, int iSourceBytesRemaining, int *piUnpa // decode... // - for (iFrameCounter = 0;;iFrameCounter++) + for (;;) { if ( iSourceBytesRemaining == 0 || iSourceBytesRemaining < iFrameBytes) break; // end of file @@ -478,7 +478,7 @@ char *C_MP3_UnpackRawPCM( void *pvData, int iSourceBytesRemaining, int *piUnpack int iDestWriteIndex = 0; int iFrameBytes; - int iFrameCounter; + //int iFrameCounter; DEC_INFO decinfo; IN_OUT x; @@ -514,7 +514,7 @@ char *C_MP3_UnpackRawPCM( void *pvData, int iSourceBytesRemaining, int *piUnpack // decode... // - for (iFrameCounter = 0;;iFrameCounter++) + for (;;) { if ( iSourceBytesRemaining == 0 || iSourceBytesRemaining < iFrameBytes) break; // end of file diff --git a/codemp/qcommon/files.cpp b/codemp/qcommon/files.cpp index e1fa0aecce..ec174eb95f 100755 --- a/codemp/qcommon/files.cpp +++ b/codemp/qcommon/files.cpp @@ -1079,7 +1079,7 @@ void FS_FCloseAio( int handle ) { // if we started to record a demo and a demo with the same path was still not fully closed. // This can happen presumably due to random hiccups/latencies in the IO process or threading or whatever. // We don't really need to worry about this. - Com_Printf("FS_FCloseAio: NOTE: File is not async or not closed: handle %i (%s)\n",f, fsh[f].name ? fsh[f].name : ""); + Com_Printf("FS_FCloseAio: NOTE: File is not async or not closed: handle %i (%s)\n",f, fsh[f].name); } return; } @@ -3253,7 +3253,7 @@ FS_Which_f void FS_Which_f( void ) { searchpath_t *search; char *filename; - qboolean isDLL; + //qboolean isDLL; filename = Cmd_Argv(1); @@ -3274,7 +3274,7 @@ void FS_Which_f( void ) { return; } - isDLL = FS_IsExt(filename, ".dll", strlen(filename)); + //isDLL = FS_IsExt(filename, ".dll", strlen(filename)); // just wants to see if file is there for ( search=fs_searchpaths; search; search=search->next ) { @@ -4617,7 +4617,7 @@ bool FS_LoadMachOBundle( const char *name ) unzFile dll; byte* buf; char dllName[MAX_QPATH]; - char *tempName; + //char *tempName; unz_file_info zfi; //read zipped bundle from pk3 @@ -4631,7 +4631,7 @@ bool FS_LoadMachOBundle( const char *name ) //unique filename to avoid any clashes Com_sprintf( dllName, sizeof(dllName), "%sXXXXXX", name ); - tempName = mktemp( dllName ); + //tempName = mktemp( dllName ); f = FS_FOpenFileWrite( dllName ); diff --git a/codemp/rd-common/tr_image_tga.cpp b/codemp/rd-common/tr_image_tga.cpp index 58dbb7fc05..e44b62e991 100644 --- a/codemp/rd-common/tr_image_tga.cpp +++ b/codemp/rd-common/tr_image_tga.cpp @@ -147,15 +147,15 @@ void LoadTGA ( const char *name, byte **pic, int *width, int *height) // bits 4-5 = pixel order/dir // bits 6-7 scan line interleave (00b=none,01b=2way interleave,10b=4way) // - int iYStart,iXStart,iYStep,iXStep; + int iYStart, iYStep; //iXStart,iXStep; switch(pHeader->byScanLineOrder & 0x30) { default: // default case stops the compiler complaining about using uninitialised vars case 0x00: // left to right, bottom to top - iXStart = 0; - iXStep = 1; + //iXStart = 0; + //iXStep = 1; iYStart = pHeader->wImageHeight-1; iYStep = -1; @@ -164,8 +164,8 @@ void LoadTGA ( const char *name, byte **pic, int *width, int *height) case 0x10: // right to left, bottom to top - iXStart = pHeader->wImageWidth-1; - iXStep = -1; + //iXStart = pHeader->wImageWidth-1; + //iXStep = -1; iYStart = pHeader->wImageHeight-1; iYStep = -1; @@ -174,8 +174,8 @@ void LoadTGA ( const char *name, byte **pic, int *width, int *height) case 0x20: // left to right, top to bottom - iXStart = 0; - iXStep = 1; + //iXStart = 0; + //iXStep = 1; iYStart = 0; iYStep = 1; @@ -184,8 +184,8 @@ void LoadTGA ( const char *name, byte **pic, int *width, int *height) case 0x30: // right to left, top to bottom - iXStart = pHeader->wImageWidth-1; - iXStep = -1; + //iXStart = pHeader->wImageWidth-1; + //iXStep = -1; iYStart = 0; iYStep = 1; @@ -218,7 +218,7 @@ void LoadTGA ( const char *name, byte **pic, int *width, int *height) for (int y=iYStart, iYCount=0; iYCountwImageHeight; y+=iYStep, iYCount++) { pOut = pRGBA + y * pHeader->wImageWidth *4; - for (int x=iXStart, iXCount=0; iXCountwImageWidth; x+=iXStep, iXCount++) + for (int iXCount=0; iXCountwImageWidth; iXCount++) { switch (pHeader->byImagePlanes) { diff --git a/codemp/rd-dedicated/G2_bones.cpp b/codemp/rd-dedicated/G2_bones.cpp index 1df9d71a60..98473bab0e 100644 --- a/codemp/rd-dedicated/G2_bones.cpp +++ b/codemp/rd-dedicated/G2_bones.cpp @@ -2157,8 +2157,8 @@ static bool G2_RagDollSetup(CGhoul2Info &ghoul2,int frameNum,bool resetOrigin,co assert(ghoul2.mFileName[0]); boneInfo_v &blist = ghoul2.mBlist; rag.clear(); - int numRendered=0; - int numNotRendered=0; + //int numRendered=0; + //int numNotRendered=0; //int pelvisAt=-1; for(size_t i=0; iofsLODs ); for ( l = 0 ; l < mdxm->numLODs ; l++) { - int triCount = 0; + //int triCount = 0; LL(lod->ofsEnd); // swap all the surfaces @@ -3437,7 +3437,7 @@ qboolean R_LoadMDXM( model_t *mod, void *buffer, const char *mod_name, qboolean LL(surf->ofsBoneReferences); // LL(surf->maxVertBoneWeights); - triCount += surf->numTriangles; + //triCount += surf->numTriangles; if ( surf->numVerts > SHADER_MAX_VERTEXES ) { Com_Error (ERR_DROP, "R_LoadMDXM: %s has more than %i verts on a surface (%i)", diff --git a/codemp/rd-dedicated/tr_model.cpp b/codemp/rd-dedicated/tr_model.cpp index ff15e7dd97..97b654a371 100644 --- a/codemp/rd-dedicated/tr_model.cpp +++ b/codemp/rd-dedicated/tr_model.cpp @@ -859,7 +859,7 @@ qboolean ServerLoadMDXM( model_t *mod, void *buffer, const char *mod_name, qbool lod = (mdxmLOD_t *) ( (byte *)mdxm + mdxm->ofsLODs ); for ( l = 0 ; l < mdxm->numLODs ; l++) { - int triCount = 0; + //int triCount = 0; LL(lod->ofsEnd); // swap all the surfaces @@ -876,7 +876,7 @@ qboolean ServerLoadMDXM( model_t *mod, void *buffer, const char *mod_name, qbool LL(surf->ofsBoneReferences); // LL(surf->maxVertBoneWeights); - triCount += surf->numTriangles; + //triCount += surf->numTriangles; if ( surf->numVerts > SHADER_MAX_VERTEXES ) { return qfalse; @@ -1584,17 +1584,6 @@ void RE_HunkClearCrap(void) tr.numSkins = 0; } -void R_ModelFree(void) -{ - if(CachedModels) { - RE_RegisterModels_DeleteAll(); - delete CachedModels; - CachedModels = NULL; - } -} - - - /* ================ R_Modellist_f diff --git a/codemp/rd-rend2/G2_bones.cpp b/codemp/rd-rend2/G2_bones.cpp index 13169ee43a..73d9c67576 100644 --- a/codemp/rd-rend2/G2_bones.cpp +++ b/codemp/rd-rend2/G2_bones.cpp @@ -2260,8 +2260,8 @@ static bool G2_RagDollSetup(CGhoul2Info &ghoul2,int frameNum,bool resetOrigin,co assert(ghoul2.mFileName[0]); boneInfo_v &blist = ghoul2.mBlist; rag.clear(); - int numRendered=0; - int numNotRendered=0; + //int numRendered=0; + //int numNotRendered=0; //int pelvisAt=-1; for(size_t i=0; iimg_buffer >= s->img_buffer_end; } +/* static void stbi__skip(stbi__context *s, int n) { if (n < 0) { @@ -1421,7 +1423,7 @@ static void stbi__skip(stbi__context *s, int n) } } s->img_buffer += n; -} +}*/ static int stbi__getn(stbi__context *s, stbi_uc *buffer, int n) { @@ -1448,17 +1450,18 @@ static int stbi__getn(stbi__context *s, stbi_uc *buffer, int n) return 0; } +/* static int stbi__get16be(stbi__context *s) { int z = stbi__get8(s); return (z << 8) + stbi__get8(s); -} - +}*/ +/* static stbi__uint32 stbi__get32be(stbi__context *s) { stbi__uint32 z = stbi__get16be(s); return (z << 16) + stbi__get16be(s); -} +}*/ #if defined(STBI_NO_BMP) && defined(STBI_NO_TGA) && defined(STBI_NO_GIF) // nothing @@ -1492,6 +1495,8 @@ static stbi__uint32 stbi__get32le(stbi__context *s) // assume data buffer is malloced, so malloc a new one and free that one // only failure mode is malloc failing +/* + static stbi_uc stbi__compute_y(int r, int g, int b) { return (stbi_uc)(((r * 77) + (g * 150) + (29 * b)) >> 8); @@ -1589,7 +1594,7 @@ static stbi__uint16 *stbi__convert_format16(stbi__uint16 *data, int img_n, int r STBI_FREE(data); return good; } - + */ #ifndef STBI_NO_LINEAR static float *stbi__ldr_to_hdr(stbi_uc *data, int x, int y, int comp) { diff --git a/codemp/rd-rend2/tr_backend.cpp b/codemp/rd-rend2/tr_backend.cpp index 768c2c4204..ec29ea9924 100644 --- a/codemp/rd-rend2/tr_backend.cpp +++ b/codemp/rd-rend2/tr_backend.cpp @@ -95,7 +95,7 @@ void GL_SelectTexture( int unit ) void GL_BindToTMU( image_t *image, int tmu ) { int texnum; - int oldtmu = glState.currenttmu; + //int oldtmu = glState.currenttmu; if (!image) texnum = 0; @@ -1195,8 +1195,8 @@ static void RB_SubmitDrawSurfsForDepthFill( { shader_t *oldShader = nullptr; int oldEntityNum = -1; - int oldSort = -1; - int oldDepthRange = 0; + //int oldSort = -1; + //int oldDepthRange = 0; CBoneCache *oldBoneCache = nullptr; drawSurf_t *drawSurf = drawSurfs; @@ -1254,7 +1254,7 @@ static void RB_SubmitDrawSurfsForDepthFill( oldShader = shader; } - oldSort = drawSurf->sort; + //oldSort = drawSurf->sort; // change the modelview matrix if needed if ( entityNum != oldEntityNum ) @@ -1282,9 +1282,9 @@ static void RB_SubmitDrawSurfs( { shader_t *oldShader = nullptr; int oldEntityNum = -1; - int oldSort = -1; + //int oldSort = -1; int oldFogNum = -1; - int oldDepthRange = 0; + //int oldDepthRange = 0; int oldDlighted = 0; int oldPostRender = 0; int oldCubemapIndex = -1; @@ -1329,7 +1329,7 @@ static void RB_SubmitDrawSurfs( continue; } - oldSort = drawSurf->sort; + //oldSort = drawSurf->sort; // // change the tess parameters if needed diff --git a/codemp/rd-rend2/tr_bsp.cpp b/codemp/rd-rend2/tr_bsp.cpp index 0df88ddf5c..6c1101f942 100644 --- a/codemp/rd-rend2/tr_bsp.cpp +++ b/codemp/rd-rend2/tr_bsp.cpp @@ -192,7 +192,7 @@ static void R_LoadLightmaps( world_t *worldData, lump_t *l, lump_t *surfs ) { int imageSize; int i, j, numLightmaps = 0, textureInternalFormat = 0; float maxIntensity = 0; - double sumIntensity = 0; + //double sumIntensity = 0; int numColorComponents = 3; bool hdr_capable = glRefConfig.floatLightmap && r_hdr->integer; @@ -499,7 +499,7 @@ static void R_LoadLightmaps( world_t *worldData, lump_t *l, lump_t *surfs ) { image[j * 4 + 2] = out[2] * 255; image[j * 4 + 3] = 255; - sumIntensity += intensity; + //sumIntensity += intensity; } else { @@ -2050,7 +2050,7 @@ static void R_CreateWorldVBOs( world_t *worldData ) int numIndexes; glIndex_t *indexes; - int numSortedSurfaces, numSurfaces; + int numSortedSurfaces; //, numSurfaces; msurface_t *surface, **firstSurf, **lastSurf, **currSurf; msurface_t **surfacesSorted; @@ -2161,14 +2161,14 @@ static void R_CreateWorldVBOs( world_t *worldData ) // count verts/indexes/surfaces numVerts = 0; numIndexes = 0; - numSurfaces = 0; + //numSurfaces = 0; for (currSurf = firstSurf; currSurf < lastSurf; currSurf++) { srfBspSurface_t *bspSurf = (srfBspSurface_t *) (*currSurf)->data; numVerts += bspSurf->numVerts; numIndexes += bspSurf->numIndexes; - numSurfaces++; + //numSurfaces++; } ri.Printf(PRINT_ALL, "...calculating world VBO %d ( %i verts %i tris )\n", k, numVerts, numIndexes / 3); @@ -3298,10 +3298,10 @@ static void R_RenderAllCubemaps() R_IssuePendingRenderCommands(); R_InitNextFrame(); - GLenum cubemapFormat = GL_RGBA8; + //GLenum cubemapFormat = GL_RGBA8; if (r_hdr->integer) { - cubemapFormat = GL_RGBA16F; + //cubemapFormat = GL_RGBA16F; } for (int k = 0; k <= r_cubeMappingBounces->integer; k++) @@ -3327,7 +3327,7 @@ void R_LoadWeatherZones(world_t *worldData, lump_t *brushesLump, lump_t *sidesLu { dbrush_t *brushes; dbrushside_t *sides; - int brushesCount, sidesCount; + int brushesCount; //, sidesCount; brushes = (dbrush_t *)(fileBase + brushesLump->fileofs); if (brushesLump->filelen % sizeof(*brushes)) { @@ -3339,7 +3339,7 @@ void R_LoadWeatherZones(world_t *worldData, lump_t *brushesLump, lump_t *sidesLu if (sidesLump->filelen % sizeof(*sides)) { ri.Error(ERR_DROP, "LoadMap: funny lump size in %s", worldData->name); } - sidesCount = sidesLump->filelen / sizeof(*sides); + //sidesCount = sidesLump->filelen / sizeof(*sides); tr.weatherSystem->weatherBrushType = WEATHER_BRUSHES_NONE; @@ -4019,7 +4019,7 @@ static void R_GenerateSurfaceSprites( const world_t *world, int worldIndex ) for (int i = 0; i < tr.numShaders; i++) { const shader_t *shader = tr.shaders[i]; - if (shader->spriteUbo != NULL) + if (shader->spriteUbo != 0) continue; numSpriteStages += shader->numSurfaceSpriteStages; diff --git a/codemp/rd-rend2/tr_curve.cpp b/codemp/rd-rend2/tr_curve.cpp index bdb8494242..718f07f209 100644 --- a/codemp/rd-rend2/tr_curve.cpp +++ b/codemp/rd-rend2/tr_curve.cpp @@ -116,7 +116,7 @@ static void MakeMeshNormals( int width, int height, srfVert_t ctrl[MAX_GRID_SIZE int i, j, k, dist; vec3_t normal; vec3_t sum; - int count = 0; + //int count = 0; vec3_t base; vec3_t delta; int x, y; @@ -156,7 +156,7 @@ static int neighbors[8][2] = { for ( i = 0 ; i < width ; i++ ) { for ( j = 0 ; j < height ; j++ ) { - count = 0; + //count = 0; dv = &ctrl[j][i]; VectorCopy( dv->xyz, base ); for ( k = 0 ; k < 8 ; k++ ) { @@ -205,7 +205,7 @@ static int neighbors[8][2] = { continue; } VectorAdd( normal, sum, sum ); - count++; + //count++; } //if ( count == 0 ) { // printf("bad normal\n"); diff --git a/codemp/rd-rend2/tr_ghoul2.cpp b/codemp/rd-rend2/tr_ghoul2.cpp index 5b22f8103e..96d1987841 100644 --- a/codemp/rd-rend2/tr_ghoul2.cpp +++ b/codemp/rd-rend2/tr_ghoul2.cpp @@ -3169,7 +3169,7 @@ void R_AddGhoulSurfaces( trRefEntity_t *ent, int entityNum ) return; } - int currentTime = G2API_GetTime(tr.refdef.time); + //int currentTime = G2API_GetTime(tr.refdef.time); // cull the entire model if merged bounding box of both frames is outside // the view frustum. @@ -4189,7 +4189,7 @@ qboolean R_LoadMDXM(model_t *mod, void *buffer, const char *mod_name, qboolean & lod = (mdxmLOD_t *) ( (byte *)mdxm + mdxm->ofsLODs ); for ( l = 0 ; l < mdxm->numLODs ; l++) { - int triCount = 0; + //int triCount = 0; LL(lod->ofsEnd); // swap all the surfaces @@ -4206,7 +4206,7 @@ qboolean R_LoadMDXM(model_t *mod, void *buffer, const char *mod_name, qboolean & LL(surf->ofsBoneReferences); // LL(surf->maxVertBoneWeights); - triCount += surf->numTriangles; + //triCount += surf->numTriangles; if ( surf->numVerts > SHADER_MAX_VERTEXES ) { Com_Error( diff --git a/codemp/rd-rend2/tr_glsl.cpp b/codemp/rd-rend2/tr_glsl.cpp index 5a3201fa52..f31bbdfe58 100644 --- a/codemp/rd-rend2/tr_glsl.cpp +++ b/codemp/rd-rend2/tr_glsl.cpp @@ -516,6 +516,7 @@ static void GLSL_LinkProgram(GLuint program) } } +#if defined (_DEBUG) static void GLSL_ShowProgramUniforms(GLuint program) { int i, count, size; @@ -540,6 +541,7 @@ static void GLSL_ShowProgramUniforms(GLuint program) qglUseProgram(0); } +#endif static void GLSL_BindShaderInterface( shaderProgram_t *program ) { diff --git a/codemp/rd-rend2/tr_image_stb.cpp b/codemp/rd-rend2/tr_image_stb.cpp index 17a2baae20..adf330e24f 100644 --- a/codemp/rd-rend2/tr_image_stb.cpp +++ b/codemp/rd-rend2/tr_image_stb.cpp @@ -29,6 +29,7 @@ static void* R_LocalMalloc(size_t size) return ri.Hunk_AllocateTempMemory(size); } +/* static void* R_LocalReallocSized(void *ptr, size_t old_size, size_t new_size) { void *mem = ri.Hunk_AllocateTempMemory(new_size); @@ -38,7 +39,8 @@ static void* R_LocalReallocSized(void *ptr, size_t old_size, size_t new_size) ri.Hunk_FreeTempMemory(ptr); } return mem; -} +}*/ + static void R_LocalFree(void *ptr) { if (ptr) diff --git a/codemp/rd-rend2/tr_init.cpp b/codemp/rd-rend2/tr_init.cpp index 09f0fb53f5..3d1a4a4c99 100644 --- a/codemp/rd-rend2/tr_init.cpp +++ b/codemp/rd-rend2/tr_init.cpp @@ -1896,7 +1896,7 @@ static void R_InitStaticConstants() GL_UNIFORM_BUFFER, tr.defaultShaderInstanceUboOffset, sizeof(shaderInstanceBlock), &shaderInstanceBlock); alignedBlockSize += (sizeof(ShaderInstanceBlock) + alignment) & ~alignment; - qglBindBuffer(GL_UNIFORM_BUFFER, NULL); + qglBindBuffer(GL_UNIFORM_BUFFER, 0); glState.currentGlobalUBO = -1; GL_CheckErrors(); diff --git a/codemp/rd-rend2/tr_main.cpp b/codemp/rd-rend2/tr_main.cpp index 02dc9e8698..610dffa69e 100644 --- a/codemp/rd-rend2/tr_main.cpp +++ b/codemp/rd-rend2/tr_main.cpp @@ -1406,7 +1406,7 @@ static qboolean SurfIsOffscreen( const msurface_t *surface, int entityNum, vec4_ int numTriangles; vec4_t clip, eye; int i; - unsigned int pointOr = 0; + //unsigned int pointOr = 0; unsigned int pointAnd = (unsigned int)~0; // TODO: Check if set properly here already @@ -1444,7 +1444,7 @@ static qboolean SurfIsOffscreen( const msurface_t *surface, int entityNum, vec4_ } } pointAnd &= pointFlags; - pointOr |= pointFlags; + //pointOr |= pointFlags; } // trivially reject @@ -1547,10 +1547,10 @@ qboolean R_MirrorViewBySurface (msurface_t *surface, int entityNum) { newParms.flags |= VPF_NOVIEWMODEL; // Calculate window coordinates of this surface to get tight fitting scissor rectangle - int viewportWidth = oldParms.viewportWidth; - int viewportHeight = oldParms.viewportHeight; - float viewportCenterX = oldParms.viewportX + 0.5f * viewportWidth; - float viewportCenterY = oldParms.viewportY + 0.5f * viewportHeight; + //int viewportWidth = oldParms.viewportWidth; + //int viewportHeight = oldParms.viewportHeight; + // float viewportCenterX = oldParms.viewportX + 0.5f * viewportWidth; + // float viewportCenterY = oldParms.viewportY + 0.5f * viewportHeight; /*int minRectX = INT_MAX; int minRectY = INT_MAX; @@ -2270,7 +2270,7 @@ void R_SetupPshadowMaps(trRefdef_t *refdef) model_t *model = R_GetModelByHandle( ent->e.hModel ); pshadow_t shadow; float radius = 0.0f; - float scale = 1.0f; + //float scale = 1.0f; vec3_t diff; int j; @@ -2279,7 +2279,7 @@ void R_SetupPshadowMaps(trRefdef_t *refdef) if (ent->e.nonNormalizedAxes) { - scale = VectorLength( ent->e.axis[0] ); + //scale = VectorLength( ent->e.axis[0] ); } switch (model->type) @@ -2404,7 +2404,7 @@ void R_SetupPshadowMaps(trRefdef_t *refdef) void R_RenderCubemapSide(int cubemapIndex, int cubemapSide, bool bounce) { refdef_t refdef = {}; - float oldColorScale = tr.refdef.colorScale; + //float oldColorScale = tr.refdef.colorScale; VectorCopy(tr.cubemaps[cubemapIndex].origin, refdef.vieworg); refdef.fov_x = 90; diff --git a/codemp/rd-rend2/tr_model.cpp b/codemp/rd-rend2/tr_model.cpp index 0f9d746110..133a54d52a 100644 --- a/codemp/rd-rend2/tr_model.cpp +++ b/codemp/rd-rend2/tr_model.cpp @@ -590,7 +590,7 @@ qboolean R_LoadMDXM_Server( model_t *mod, void *buffer, const char *mod_name, qb lod = (mdxmLOD_t *) ( (byte *)mdxm + mdxm->ofsLODs ); for ( l = 0 ; l < mdxm->numLODs ; l++) { - int triCount = 0; + //int triCount = 0; LL(lod->ofsEnd); // swap all the surfaces @@ -607,7 +607,7 @@ qboolean R_LoadMDXM_Server( model_t *mod, void *buffer, const char *mod_name, qb LL(surf->ofsBoneReferences); // LL(surf->maxVertBoneWeights); - triCount += surf->numTriangles; + //triCount += surf->numTriangles; if ( surf->numVerts > SHADER_MAX_VERTEXES ) { return qfalse; diff --git a/codemp/rd-rend2/tr_shade.cpp b/codemp/rd-rend2/tr_shade.cpp index bc65a71cb7..3800e95ead 100644 --- a/codemp/rd-rend2/tr_shade.cpp +++ b/codemp/rd-rend2/tr_shade.cpp @@ -51,7 +51,7 @@ void R_DrawElementsVBO( int numIndexes, glIndex_t firstIndex, glIndex_t minIndex GL_DrawIndexed(GL_TRIANGLES, numIndexes, GL_INDEX_TYPE, offset, 1, 0); } - +/* static void R_DrawMultiElementsVBO( int multiDrawPrimitives, glIndex_t *multiDrawMinIndex, glIndex_t *multiDrawMaxIndex, GLsizei *multiDrawNumIndexes, glIndex_t **multiDrawFirstIndex) { @@ -60,7 +60,7 @@ static void R_DrawMultiElementsVBO( int multiDrawPrimitives, glIndex_t *multiDra multiDrawNumIndexes, multiDrawFirstIndex, multiDrawPrimitives); -} +} */ /* @@ -828,9 +828,8 @@ static UniformBlockBinding GetBonesBlockUniformBinding( static UniformBlockBinding GetShaderInstanceBlockUniformBinding( const trRefEntity_t *refEntity, const shader_t *shader) { - const GLuint currentFrameUbo = backEndData->currentFrame->ubo; - UniformBlockBinding binding = {}; - binding.ubo = tr.shaderInstanceUbo; + UniformBlockBinding binding = {}; + binding.ubo = tr.shaderInstanceUbo; binding.block = UNIFORM_BLOCK_SHADER_INSTANCE; if (shader->ShaderInstanceUboOffset == -1) @@ -1490,10 +1489,10 @@ static void RB_IterateStagesGeneric( shaderCommands_t *input, const VertexArrays uniformDataWriter.SetUniformInt(UNIFORM_FOGINDEX, input->fogNum - 1); } - float volumetricBaseValue = -1.0f; + //float volumetricBaseValue = -1.0f; if ( backEnd.currentEntity->e.renderfx & RF_VOLUMETRIC ) { - volumetricBaseValue = backEnd.currentEntity->e.shaderRGBA[0] / 255.0f; + //volumetricBaseValue = backEnd.currentEntity->e.shaderRGBA[0] / 255.0f; } else { @@ -1525,7 +1524,7 @@ static void RB_IterateStagesGeneric( shaderCommands_t *input, const VertexArrays vertColor[3] = 0.0f; } - if (backEnd.currentEntity->e.hModel != NULL) + if (backEnd.currentEntity->e.hModel != 0) { model_t *model = R_GetModelByHandle(backEnd.currentEntity->e.hModel); if (model->type != MOD_BRUSH) diff --git a/codemp/rd-rend2/tr_shade_calc.cpp b/codemp/rd-rend2/tr_shade_calc.cpp index 840bc8087a..3eb4208eb5 100644 --- a/codemp/rd-rend2/tr_shade_calc.cpp +++ b/codemp/rd-rend2/tr_shade_calc.cpp @@ -598,7 +598,9 @@ void RB_DeformTessGeometry( void ) { case DEFORM_TEXT7: DeformText( backEnd.refdef.text[ds->deformation - DEFORM_TEXT0] ); break; - } + default: + break; + } } } diff --git a/codemp/rd-rend2/tr_shader.cpp b/codemp/rd-rend2/tr_shader.cpp index e26859ffea..3ea9d09388 100644 --- a/codemp/rd-rend2/tr_shader.cpp +++ b/codemp/rd-rend2/tr_shader.cpp @@ -3315,7 +3315,7 @@ static qboolean CollapseStagesToGLSL(void) { shaderStage_t *pStage = &stages[i]; shaderStage_t *diffuse, *lightmap; - qboolean parallax, tcgen, diffuselit, vertexlit; + qboolean tcgen, diffuselit, vertexlit; //,parallax if (!pStage->active) continue; @@ -3329,7 +3329,7 @@ static qboolean CollapseStagesToGLSL(void) continue; diffuse = pStage; - parallax = qfalse; + //parallax = qfalse; lightmap = NULL; // we have a diffuse map, find matching lightmap diff --git a/codemp/rd-rend2/tr_weather.cpp b/codemp/rd-rend2/tr_weather.cpp index f3a5620673..b440e6e6ce 100644 --- a/codemp/rd-rend2/tr_weather.cpp +++ b/codemp/rd-rend2/tr_weather.cpp @@ -282,7 +282,7 @@ namespace // Now test if the intersected point is actually on the brush for (int j = 0; j < currentWeatherBrush->numPlanes; j++) { - vec4_t *plane = ¤tWeatherBrush->planes[j]; +// vec4_t *plane = ¤tWeatherBrush->planes[j]; vec3_t normal = { currentWeatherBrush->planes[j][0], currentWeatherBrush->planes[j][1], diff --git a/codemp/rd-vanilla/G2_bones.cpp b/codemp/rd-vanilla/G2_bones.cpp index 67379509db..95db4a8cd1 100644 --- a/codemp/rd-vanilla/G2_bones.cpp +++ b/codemp/rd-vanilla/G2_bones.cpp @@ -2274,8 +2274,8 @@ static bool G2_RagDollSetup(CGhoul2Info &ghoul2,int frameNum,bool resetOrigin,co assert(ghoul2.mFileName[0]); boneInfo_v &blist = ghoul2.mBlist; rag.clear(); - int numRendered=0; - int numNotRendered=0; + //int numRendered=0; + //int numNotRendered=0; //int pelvisAt=-1; for(size_t i=0; ivalue; - fTexelHeightOffset += r_DynamicGlowDelta->value; + //fTexelHeightOffset += r_DynamicGlowDelta->value; } // Disable multi-texturing. diff --git a/codemp/rd-vanilla/tr_bsp.cpp b/codemp/rd-vanilla/tr_bsp.cpp index ebabb798e2..2941444b8f 100644 --- a/codemp/rd-vanilla/tr_bsp.cpp +++ b/codemp/rd-vanilla/tr_bsp.cpp @@ -172,7 +172,7 @@ static void R_LoadLightmaps( lump_t *l, const char *psMapName, world_t &worldDat byte image[LIGHTMAP_SIZE*LIGHTMAP_SIZE*4]; int i, j; float maxIntensity = 0; - double sumIntensity = 0; + //double sumIntensity = 0; if (&worldData == &s_worldData) { @@ -235,7 +235,7 @@ static void R_LoadLightmaps( lump_t *l, const char *psMapName, world_t &worldDat image[j*4+2] = out[2] * 255; image[j*4+3] = 255; - sumIntensity += intensity; + //sumIntensity += intensity; } } else { for ( j = 0 ; j < LIGHTMAP_SIZE * LIGHTMAP_SIZE; j++ ) { @@ -1292,7 +1292,8 @@ void R_StitchAllPatches( world_t &worldData ) { grid1->lodStitched = qtrue; stitched = qtrue; // - numstitches += R_TryStitchingPatch( i, worldData ); + numstitches += + R_TryStitchingPatch( i, worldData ); } } while (stitched); diff --git a/codemp/rd-vanilla/tr_ghoul2.cpp b/codemp/rd-vanilla/tr_ghoul2.cpp index ddd23285db..5ef14576c8 100644 --- a/codemp/rd-vanilla/tr_ghoul2.cpp +++ b/codemp/rd-vanilla/tr_ghoul2.cpp @@ -4328,7 +4328,7 @@ qboolean R_LoadMDXM( model_t *mod, void *buffer, const char *mod_name, qboolean lod = (mdxmLOD_t *) ( (byte *)mdxm + mdxm->ofsLODs ); for ( l = 0 ; l < mdxm->numLODs ; l++) { - int triCount = 0; + //int triCount = 0; LL(lod->ofsEnd); // swap all the surfaces @@ -4345,7 +4345,7 @@ qboolean R_LoadMDXM( model_t *mod, void *buffer, const char *mod_name, qboolean LL(surf->ofsBoneReferences); LL(surf->ofsEnd); - triCount += surf->numTriangles; + //triCount += surf->numTriangles; if ( surf->numVerts > SHADER_MAX_VERTEXES ) { Com_Error (ERR_DROP, "R_LoadMDXM: %s has more than %i verts on a surface (%i)", diff --git a/codemp/rd-vanilla/tr_main.cpp b/codemp/rd-vanilla/tr_main.cpp index 1dc44c7c9f..d5a482caf8 100644 --- a/codemp/rd-vanilla/tr_main.cpp +++ b/codemp/rd-vanilla/tr_main.cpp @@ -852,7 +852,7 @@ static qboolean SurfIsOffscreen( const drawSurf_t *drawSurf, vec4_t clipDest[128 int dlighted; vec4_t clip, eye; int i; - unsigned int pointOr = 0; + //unsigned int pointOr = 0; unsigned int pointAnd = (unsigned int)~0; R_RotateForViewer(); @@ -880,7 +880,7 @@ static qboolean SurfIsOffscreen( const drawSurf_t *drawSurf, vec4_t clipDest[128 } } pointAnd &= pointFlags; - pointOr |= pointFlags; + //pointOr |= pointFlags; } // trivially reject diff --git a/codemp/rd-vanilla/tr_model.cpp b/codemp/rd-vanilla/tr_model.cpp index 92c30ce4bd..1f1ac46c64 100644 --- a/codemp/rd-vanilla/tr_model.cpp +++ b/codemp/rd-vanilla/tr_model.cpp @@ -923,7 +923,7 @@ qboolean ServerLoadMDXM( model_t *mod, void *buffer, const char *mod_name, qbool lod = (mdxmLOD_t *) ( (byte *)mdxm + mdxm->ofsLODs ); for ( l = 0 ; l < mdxm->numLODs ; l++) { - int triCount = 0; + //int triCount = 0; LL(lod->ofsEnd); // swap all the surfaces @@ -940,7 +940,7 @@ qboolean ServerLoadMDXM( model_t *mod, void *buffer, const char *mod_name, qbool LL(surf->ofsBoneReferences); LL(surf->ofsEnd); - triCount += surf->numTriangles; + //triCount += surf->numTriangles; if ( surf->numVerts > SHADER_MAX_VERTEXES ) { return qfalse; diff --git a/codemp/rd-vulkan/G2_bones.cpp b/codemp/rd-vulkan/G2_bones.cpp index 67379509db..95db4a8cd1 100644 --- a/codemp/rd-vulkan/G2_bones.cpp +++ b/codemp/rd-vulkan/G2_bones.cpp @@ -2274,8 +2274,8 @@ static bool G2_RagDollSetup(CGhoul2Info &ghoul2,int frameNum,bool resetOrigin,co assert(ghoul2.mFileName[0]); boneInfo_v &blist = ghoul2.mBlist; rag.clear(); - int numRendered=0; - int numNotRendered=0; + //int numRendered=0; + //int numNotRendered=0; //int pelvisAt=-1; for(size_t i=0; ilodStitched = qtrue; stitched = qtrue; // - numstitches += R_TryStitchingPatch( i, worldData ); + numstitches += + R_TryStitchingPatch( i, worldData ); } } while (stitched); diff --git a/codemp/rd-vulkan/tr_ghoul2.cpp b/codemp/rd-vulkan/tr_ghoul2.cpp index b39eb5213a..6a6ba6af9b 100644 --- a/codemp/rd-vulkan/tr_ghoul2.cpp +++ b/codemp/rd-vulkan/tr_ghoul2.cpp @@ -3553,7 +3553,7 @@ void RB_SurfaceGhoul(CRenderableSurface* surf) //float *texCoords = tess.texCoords[0][baseVertex]; float* texCoords = tess.texCoords[0][baseVertex]; - int hack = baseVertex; + //int hack = baseVertex; //rww - since the array is arranged as such we cannot increment //the relative memory position to get where we want. Maybe this //is why sof2 has the texCoords array reversed. In any case, I @@ -4285,7 +4285,7 @@ qboolean R_LoadMDXM( model_t *mod, void *buffer, const char *mod_name, qboolean lod = (mdxmLOD_t *) ( (byte *)mdxm + mdxm->ofsLODs ); for ( l = 0 ; l < mdxm->numLODs ; l++) { - int triCount = 0; + //int triCount = 0; LL(lod->ofsEnd); // swap all the surfaces @@ -4302,7 +4302,7 @@ qboolean R_LoadMDXM( model_t *mod, void *buffer, const char *mod_name, qboolean LL(surf->ofsBoneReferences); LL(surf->ofsEnd); - triCount += surf->numTriangles; + //triCount += surf->numTriangles; if ( surf->numVerts > SHADER_MAX_VERTEXES ) { Com_Error (ERR_DROP, "R_LoadMDXM: %s has more than %i verts on a surface (%i)", diff --git a/codemp/rd-vulkan/tr_main.cpp b/codemp/rd-vulkan/tr_main.cpp index 7cdf5caa58..9bd7faee48 100644 --- a/codemp/rd-vulkan/tr_main.cpp +++ b/codemp/rd-vulkan/tr_main.cpp @@ -295,6 +295,7 @@ void R_TransformModelToClip( const vec3_t src, const float *modelMatrix, const f R_TransformModelToClipMVP ========================== */ +/* static void R_TransformModelToClipMVP( const vec3_t src, const float *mvp, vec4_t clip ) { int i; @@ -305,7 +306,7 @@ static void R_TransformModelToClipMVP( const vec3_t src, const float *mvp, vec4_ src[2] * mvp[i + 2 * 4] + 1 * mvp[i + 3 * 4]; } -} +}*/ /* ========================== diff --git a/codemp/rd-vulkan/tr_model.cpp b/codemp/rd-vulkan/tr_model.cpp index 838e9475e0..b486596e4f 100644 --- a/codemp/rd-vulkan/tr_model.cpp +++ b/codemp/rd-vulkan/tr_model.cpp @@ -912,7 +912,7 @@ qboolean ServerLoadMDXM( model_t *mod, void *buffer, const char *mod_name, qbool lod = (mdxmLOD_t *) ( (byte *)mdxm + mdxm->ofsLODs ); for ( l = 0 ; l < mdxm->numLODs ; l++) { - int triCount = 0; + //int triCount = 0; LL(lod->ofsEnd); // swap all the surfaces @@ -929,7 +929,7 @@ qboolean ServerLoadMDXM( model_t *mod, void *buffer, const char *mod_name, qbool LL(surf->ofsBoneReferences); LL(surf->ofsEnd); - triCount += surf->numTriangles; + //triCount += surf->numTriangles; if ( surf->numVerts > SHADER_MAX_VERTEXES ) { return qfalse; diff --git a/codemp/rd-vulkan/tr_quicksprite.cpp b/codemp/rd-vulkan/tr_quicksprite.cpp index 73eb588dd1..c599c52ce6 100644 --- a/codemp/rd-vulkan/tr_quicksprite.cpp +++ b/codemp/rd-vulkan/tr_quicksprite.cpp @@ -37,7 +37,7 @@ CQuickSpriteSystem SQuickSprite; ////////////////////////////////////////////////////////////////////// CQuickSpriteSystem::CQuickSpriteSystem() : - vk_pipeline(NULL), + vk_pipeline(0), mTexBundle(NULL), mFogIndex(-1), mUseFog(qfalse) diff --git a/codemp/rd-vulkan/tr_shader.cpp b/codemp/rd-vulkan/tr_shader.cpp index d2884b9ce8..1fd6aba8e6 100644 --- a/codemp/rd-vulkan/tr_shader.cpp +++ b/codemp/rd-vulkan/tr_shader.cpp @@ -3659,6 +3659,7 @@ pass, trying to guess which is the correct one to best aproximate what it is supposed to look like. ================= */ +/* static void VertexLightingCollapse( void ) { int stage; @@ -3752,7 +3753,7 @@ static void VertexLightingCollapse( void ) Com_Memset(pStage, 0, sizeof(*pStage)); } -} +} */ static qboolean EqualACgen( const shaderStage_t *st1, const shaderStage_t *st2 ) { @@ -3833,7 +3834,7 @@ static qboolean EqualTCgen( int bundle, const shaderStage_t *st1, const shaderSt if (memcmp(b1->tcGenVectors, b2->tcGenVectors, sizeof(*b1->tcGenVectors) * 2) != 0) { return qfalse; } - } + } //if ( b1->tcGen == TCGEN_ENVIRONMENT_MAPPED_FP ) { // if ( b1->isScreenMap != b2->isScreenMap ) { @@ -4514,7 +4515,7 @@ shader_t *FinishShader( void ) } // this will be a copy of the vk_pipeline[0] but with faceculling disabled - pStage->vk_2d_pipeline = NULL; + pStage->vk_2d_pipeline = 0; #ifdef USE_FOG_COLLAPSE diff --git a/codemp/rd-vulkan/utils/stb_dxt.h b/codemp/rd-vulkan/utils/stb_dxt.h index 37ca8d4a85..3ffa8a17b5 100644 --- a/codemp/rd-vulkan/utils/stb_dxt.h +++ b/codemp/rd-vulkan/utils/stb_dxt.h @@ -995,7 +995,7 @@ void rygCompressYCoCg( unsigned char *dst, unsigned char *src, int w, int h ) } } - +/* static void stbgl__compress(unsigned char *p, unsigned char *rgba, int w, int h, int isDxt5) { int i,j,y,y2; @@ -1038,7 +1038,7 @@ static void stbgl__compress(unsigned char *p, unsigned char *rgba, int w, int h, } // assert(p <= end); } - +*/ static inline unsigned char linearize(unsigned char inByte) { float srgbVal = ((float)inByte) / 255.0f; diff --git a/codemp/rd-vulkan/vk_attachments.cpp b/codemp/rd-vulkan/vk_attachments.cpp index 9417842d88..dfe3ae6b9a 100644 --- a/codemp/rd-vulkan/vk_attachments.cpp +++ b/codemp/rd-vulkan/vk_attachments.cpp @@ -157,7 +157,7 @@ static void vk_alloc_attachment_memory( void ) attachments[i].access_flags, attachments[i].image_layout, VK_QUEUE_FAMILY_IGNORED, VK_QUEUE_FAMILY_IGNORED, - NULL, NULL + 0, 0 ); } vk_end_command_buffer(command_buffer); diff --git a/codemp/rd-vulkan/vk_debug.cpp b/codemp/rd-vulkan/vk_debug.cpp index e9b60d9c09..6f150494cd 100644 --- a/codemp/rd-vulkan/vk_debug.cpp +++ b/codemp/rd-vulkan/vk_debug.cpp @@ -51,7 +51,7 @@ void QDECL vk_debug( const char *msg, ... ) { va_end(argptr); fp = fopen("./vk_log.log", "a"); - fprintf(fp, text); + fprintf(fp, "%s", text); fclose(fp); #endif return; diff --git a/codemp/rd-vulkan/vk_frame.cpp b/codemp/rd-vulkan/vk_frame.cpp index 3b08000435..6ce579f75e 100644 --- a/codemp/rd-vulkan/vk_frame.cpp +++ b/codemp/rd-vulkan/vk_frame.cpp @@ -533,7 +533,7 @@ void vk_create_framebuffers() } VK_CHECK(qvkCreateFramebuffer(vk.device, &desc, NULL, &vk.framebuffers.main[i])); - VK_SET_OBJECT_NAME(vk.framebuffers.main[i], va("framebuffer - main %i"), VK_DEBUG_REPORT_OBJECT_TYPE_FRAMEBUFFER_EXT); + VK_SET_OBJECT_NAME(vk.framebuffers.main[i], "framebuffer - main", VK_DEBUG_REPORT_OBJECT_TYPE_FRAMEBUFFER_EXT); } else { if (i == 0) { @@ -882,11 +882,11 @@ static void vk_begin_render_pass( VkRenderPass renderPass, VkFramebuffer frameBu clear_values[ (int)( vk.msaaActive ? 2 : 0 ) ].color = { { 0.75f, 0.75f, 0.75f, 1.0f } }; break; case RENDER_PASS_DGLOW: - clear_values[ (int)( vk.msaaActive ? 2 : 0 ) ].color = { { 0.0f, 0.0f, 0.0f, 1.0f } }; - break; case RENDER_PASS_REFRACTION: clear_values[ (int)( vk.msaaActive ? 2 : 0 ) ].color = { { 0.0f, 0.0f, 0.0f, 1.0f } }; break; + default: + break; } #endif #ifndef USE_REVERSED_DEPTH @@ -915,7 +915,7 @@ static void vk_begin_screenmap_render_pass( void ) VK_IMAGE_ASPECT_COLOR_BIT, 0, VK_IMAGE_LAYOUT_UNDEFINED, VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, VK_QUEUE_FAMILY_IGNORED, VK_QUEUE_FAMILY_IGNORED, - NULL, NULL); + 0, 0); vk.renderPassIndex = RENDER_PASS_SCREENMAP; @@ -1076,20 +1076,20 @@ void vk_refraction_extract( void ) { 0, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, VK_ACCESS_TRANSFER_READ_BIT, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL, VK_QUEUE_FAMILY_IGNORED, VK_QUEUE_FAMILY_IGNORED, - NULL, NULL); + 0, 0); vk_record_image_layout_transition(vk.cmd->command_buffer, srcImage, VK_IMAGE_ASPECT_COLOR_BIT, VK_ACCESS_TRANSFER_READ_BIT, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, srcImageAccess, srcImageLayout, VK_QUEUE_FAMILY_IGNORED, VK_QUEUE_FAMILY_IGNORED, - NULL, NULL); + 0, 0); } void vk_begin_post_refraction_extract_render_pass( void ) { - VkViewport viewport{}; - VkRect2D scissor_rect{}; + //VkViewport viewport{}; + //VkRect2D scissor_rect{}; VkFramebuffer frameBuffer = vk.framebuffers.refraction.extract; vk.renderPassIndex = RENDER_PASS_REFRACTION; @@ -1521,7 +1521,7 @@ void vk_read_pixels( byte *buffer, uint32_t width, uint32_t height ) srcImageAccess, srcImageLayout, VK_ACCESS_TRANSFER_READ_BIT, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, VK_QUEUE_FAMILY_IGNORED, VK_QUEUE_FAMILY_IGNORED, - NULL, NULL); + 0, 0); } vk_record_image_layout_transition(command_buffer, dstImage, @@ -1529,7 +1529,7 @@ void vk_read_pixels( byte *buffer, uint32_t width, uint32_t height ) 0, VK_IMAGE_LAYOUT_UNDEFINED, VK_ACCESS_TRANSFER_WRITE_BIT, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, VK_QUEUE_FAMILY_IGNORED, VK_QUEUE_FAMILY_IGNORED, - NULL, NULL); + 0, 0); // end_command_buffer( command_buffer ); @@ -1660,7 +1660,7 @@ void vk_read_pixels( byte *buffer, uint32_t width, uint32_t height ) VK_ACCESS_TRANSFER_READ_BIT, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, srcImageAccess, srcImageLayout, VK_QUEUE_FAMILY_IGNORED, VK_QUEUE_FAMILY_IGNORED, - NULL, NULL); + 0, 0); vk_end_command_buffer(command_buffer); } diff --git a/codemp/rd-vulkan/vk_image.cpp b/codemp/rd-vulkan/vk_image.cpp index 324c191af7..cb0a5da44b 100644 --- a/codemp/rd-vulkan/vk_image.cpp +++ b/codemp/rd-vulkan/vk_image.cpp @@ -329,10 +329,10 @@ void vk_record_image_layout_transition( VkCommandBuffer cmdBuf, VkImage image, barrier.subresourceRange.baseArrayLayer = 0; barrier.subresourceRange.layerCount = VK_REMAINING_ARRAY_LAYERS; - if ( src_stage_mask == NULL ) + if ( src_stage_mask == 0 ) src_stage_mask = VK_PIPELINE_STAGE_ALL_COMMANDS_BIT; - if ( dst_stage_mask == NULL ) + if ( dst_stage_mask == 0 ) dst_stage_mask = VK_PIPELINE_STAGE_ALL_COMMANDS_BIT; qvkCmdPipelineBarrier(cmdBuf, src_stage_mask, dst_stage_mask, 0, 0, NULL, 0, NULL, 1, &barrier); @@ -765,14 +765,14 @@ void vk_upload_image_data( image_t *image, int x, int y, int width, vk_record_image_layout_transition(command_buffer, image->handle, VK_IMAGE_ASPECT_COLOR_BIT, 0, VK_IMAGE_LAYOUT_UNDEFINED, VK_ACCESS_TRANSFER_WRITE_BIT, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, VK_QUEUE_FAMILY_IGNORED, VK_QUEUE_FAMILY_IGNORED, - NULL, NULL); + 0, 0); qvkCmdCopyBufferToImage(command_buffer, vk_world.staging_buffer, image->handle, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, num_regions, regions); vk_record_image_layout_transition(command_buffer, image->handle, VK_IMAGE_ASPECT_COLOR_BIT, VK_ACCESS_TRANSFER_WRITE_BIT, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, VK_ACCESS_SHADER_READ_BIT, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL, VK_QUEUE_FAMILY_IGNORED, VK_QUEUE_FAMILY_IGNORED, - NULL, NULL); + 0, 0); vk_end_command_buffer(command_buffer); @@ -828,7 +828,7 @@ static void allocate_and_bind_image_memory( VkImage image ) { result = qvkAllocateMemory(vk.device, &alloc_info, NULL, &memory); if (result < 0) { - ri.Error(ERR_DROP, va("GPU memory heap overflow: Code %i", result)); + ri.Error(ERR_DROP, "%s", va("GPU memory heap overflow: Code %i", result)); vk_restart_swapchain( __func__ ); } diff --git a/codemp/rd-vulkan/vk_instance.cpp b/codemp/rd-vulkan/vk_instance.cpp index 8b3e9afe0b..1852ef4b27 100644 --- a/codemp/rd-vulkan/vk_instance.cpp +++ b/codemp/rd-vulkan/vk_instance.cpp @@ -718,10 +718,12 @@ void vk_init_library( void ) uint32_t device_count; int device_index, i; VkResult res; - qboolean deviceCountRetried = qfalse; - +#ifdef _WIN32 + qboolean deviceCountRetried = qfalse; __initStart: - Com_Memset(&vk, 0, sizeof(vk)); +#endif + + Com_Memset(&vk, 0, sizeof(vk)); qvkGetInstanceProcAddr = (PFN_vkGetInstanceProcAddr)ri.VK_GetInstanceProcAddress(); if (qvkGetInstanceProcAddr == NULL) diff --git a/codemp/rd-vulkan/vk_shade_geometry.cpp b/codemp/rd-vulkan/vk_shade_geometry.cpp index f9a3b5fc1c..66527604e1 100644 --- a/codemp/rd-vulkan/vk_shade_geometry.cpp +++ b/codemp/rd-vulkan/vk_shade_geometry.cpp @@ -1658,7 +1658,7 @@ void RB_StageIteratorGeneric( void ) // for 2D flipped images if ( backEnd.projection2D ) { - if ( pStage->vk_2d_pipeline == NULL ) { + if ( pStage->vk_2d_pipeline == 0 ) { vk_get_pipeline_def(pStage->vk_pipeline[0], &def); // use an excisting pipeline with the same def or create a new one. diff --git a/codemp/rd-vulkan/vk_swapchain.cpp b/codemp/rd-vulkan/vk_swapchain.cpp index 865bf3b616..7ba726b7d5 100644 --- a/codemp/rd-vulkan/vk_swapchain.cpp +++ b/codemp/rd-vulkan/vk_swapchain.cpp @@ -239,7 +239,7 @@ void vk_create_swapchain( VkPhysicalDevice physical_device, VkDevice device, 0, VK_IMAGE_LAYOUT_UNDEFINED, VK_ACCESS_MEMORY_READ_BIT, vk.initSwapchainLayout, VK_QUEUE_FAMILY_IGNORED, VK_QUEUE_FAMILY_IGNORED, - NULL, NULL ); + 0, 0 ); } vk_end_command_buffer( command_buffer ); diff --git a/codemp/ui/ui_main.c b/codemp/ui/ui_main.c index d08c3388c6..1977ae76e5 100644 --- a/codemp/ui/ui_main.c +++ b/codemp/ui/ui_main.c @@ -2110,7 +2110,7 @@ static void UI_DrawTeamMember(rectDef_t *rect, float scale, vec4_t color, qboole static void UI_DrawMapPreview(rectDef_t *rect, float scale, vec4_t color, qboolean net) { int map = (net) ? ui_currentNetMap.integer : ui_currentMap.integer; - qhandle_t levelShot; + qhandle_t levelShot = 0; if (map < 0 || map > uiInfo.mapCount) { if (net) { trap->Cvar_Set("ui_currentNetMap", "0"); @@ -2129,7 +2129,7 @@ static void UI_DrawMapPreview(rectDef_t *rect, float scale, vec4_t color, qboole if (uiInfo.mapList[map].levelShot > 0) { levelShot = uiInfo.mapList[map].levelShot; } - else if (uiInfo.uiDC.widthRatioCoef >= 0.74f && uiInfo.uiDC.widthRatioCoef <= 0.76f) { + else if ((uiInfo.uiDC.widthRatioCoef >= 0.74f) && (uiInfo.uiDC.widthRatioCoef <= 0.76f)) { levelShot = trap->R_RegisterShaderNoMip("menu/art/unknownmap_mp_16_9"); } @@ -2404,11 +2404,11 @@ static void UI_DrawNetSource(rectDef_t *rect, float scale, vec4_t color, int tex } static void UI_DrawNetMapPreview(rectDef_t *rect, float scale, vec4_t color) { - qhandle_t previewImage; + qhandle_t previewImage = 0; if (uiInfo.serverStatus.currentServerPreview > 0) { previewImage = uiInfo.serverStatus.currentServerPreview; } - else if (uiInfo.uiDC.widthRatioCoef >= 0.74f && uiInfo.uiDC.widthRatioCoef <= 0.76f) { + else if ((uiInfo.uiDC.widthRatioCoef >= 0.74f) && (uiInfo.uiDC.widthRatioCoef <= 0.76f)) { previewImage = trap->R_RegisterShaderNoMip("menu/art/unknownmap_mp_16_9"); } @@ -8905,7 +8905,7 @@ static int UI_HeadCountByColor(void) { { skinName = uiInfo.q3HeadNames[i]; while (*skinName != '/') { - *skinName++; + skinName++; } if (*skinName == '\0' || !strlen(skinName)) skinName = uiInfo.q3HeadNames[i]; @@ -9065,7 +9065,7 @@ static void UI_BuildServerDisplayList(int force) { int i, count, maxClients, ping, game, len, passw/*, visible*/; char info[MAX_STRING_CHARS]; // qboolean startRefresh = qtrue; TTimo: unused - static int numinvisible; + //static int numinvisible; int lanSource; if (!(force || uiInfo.uiDC.realTime > uiInfo.serverStatus.nextDisplayRefresh)) { @@ -9091,7 +9091,7 @@ static void UI_BuildServerDisplayList(int force) { lanSource = UI_SourceForLAN(); if (force) { - numinvisible = 0; + //numinvisible = 0; // clear number of displayed servers uiInfo.serverStatus.numDisplayServers = 0; uiInfo.serverStatus.numPlayersOnServers = 0; @@ -9192,7 +9192,7 @@ static void UI_BuildServerDisplayList(int force) { // done with this server if (ping > 0) { trap->LAN_MarkServerVisible(lanSource, i, qfalse); - numinvisible++; + //numinvisible++; } } } @@ -9362,7 +9362,7 @@ UI_BuildFindPlayerList ================== */ static void UI_BuildFindPlayerList(qboolean force) { - static int numFound, numTimeOuts; + static int numFound; //, numTimeOuts; int i, j, resend; serverStatusInfo_t info; char name[MAX_NAME_LENGTH+2]; @@ -9402,7 +9402,7 @@ static void UI_BuildFindPlayerList(qboolean force) { // sizeof(uiInfo.foundPlayerServerNames[uiInfo.numFoundPlayerServers-1]), // "searching %d...", uiInfo.pendingServerStatus.num); numFound = 0; - numTimeOuts++; + //numTimeOuts++; } for (i = 0; i < MAX_SERVERSTATUSREQUESTS; i++) { // if this pending server is valid @@ -9453,7 +9453,7 @@ static void UI_BuildFindPlayerList(qboolean force) { if (!uiInfo.pendingServerStatus.server[i].valid || uiInfo.pendingServerStatus.server[i].startTime < uiInfo.uiDC.realTime - ui_serverStatusTimeOut.integer) { if (uiInfo.pendingServerStatus.server[i].valid) { - numTimeOuts++; + //numTimeOuts++; } // reset server status request for this address UI_GetServerStatusInfo( uiInfo.pendingServerStatus.server[i].adrstr, NULL ); @@ -9801,7 +9801,7 @@ static const char *UI_SelectedTeamHead(int index, int *actual) { { //ugly mess below skinName = uiInfo.q3HeadNames[i]; while (*skinName != '/') { - *skinName++; + skinName++; } if (*skinName == '\0' || !strlen(skinName)) skinName = uiInfo.q3HeadNames[i]; diff --git a/lib/libpng/pngread.c b/lib/libpng/pngread.c index 87a789157b..f1431447e7 100644 --- a/lib/libpng/pngread.c +++ b/lib/libpng/pngread.c @@ -3413,8 +3413,7 @@ png_image_read_background(png_voidp argument) for (pass = 0; pass < passes; ++pass) { - png_bytep row = png_voidcast(png_bytep, - display->first_row); + //png_bytep row = png_voidcast(png_bytep, display->first_row); unsigned int startx, stepx, stepy; png_uint_32 y; @@ -3520,7 +3519,7 @@ png_image_read_background(png_voidp argument) inrow += 2; /* gray and alpha channel */ } - row += display->row_bytes; + //row += display->row_bytes; } } } diff --git a/shared/sdl/sdl_input.cpp b/shared/sdl/sdl_input.cpp index be1959c8a8..943b808ad2 100644 --- a/shared/sdl/sdl_input.cpp +++ b/shared/sdl/sdl_input.cpp @@ -619,6 +619,9 @@ void IN_Init( void *windowData ) in_joystick = Cvar_Get( "in_joystick", "0", CVAR_ARCHIVE_ND|CVAR_LATCH ); // mouse variables +#ifdef MACOS_X + in_mouse = Cvar_Set( "in_mouse", "2" ); //"Raw Input" does not work on mac +#endif in_mouse = Cvar_Get( "in_mouse", "1", CVAR_ARCHIVE ); in_nograb = Cvar_Get( "in_nograb", "0", CVAR_ARCHIVE_ND ); in_mouserepeat = Cvar_Get("in_mouserepeat", "0", CVAR_ARCHIVE);