[
  {
    "path": ".clang-format",
    "content": "BasedOnStyle: WebKit\nAccessModifierOffset: -4\nAlignAfterOpenBracket: Align\nAlignConsecutiveAssignments: false\nAlignConsecutiveDeclarations: false\nAlignConsecutiveMacros: true\nAlignEscapedNewlines: Left\nAlignOperands: true\nAlignTrailingComments: true\nAllowAllArgumentsOnNextLine: false\nAllowAllConstructorInitializersOnNextLine: false\nAllowAllParametersOfDeclarationOnNextLine: false\nAllowShortBlocksOnASingleLine: Always\nAllowShortCaseLabelsOnASingleLine: true\nAllowShortFunctionsOnASingleLine: All\nAllowShortIfStatementsOnASingleLine: Never\nAllowShortLoopsOnASingleLine: false\nAlwaysBreakBeforeMultilineStrings: false\nBinPackArguments: true\nBinPackParameters: true\nBreakBeforeBraces: Allman\nBreakBeforeBinaryOperators: NonAssignment\nBreakBeforeTernaryOperators: true\nBreakConstructorInitializers: AfterColon\nBreakInheritanceList: AfterColon\nBreakStringLiterals: false\nIncludeBlocks: Regroup\nIndentCaseLabels: false\nIndentWidth: 4\nLanguage: Cpp\nMaxEmptyLinesToKeep: 1\nPointerAlignment: Right\nReflowComments: true\nSortIncludes: false\nSpaceAfterCStyleCast: false\nSpaceAfterLogicalNot: false\nSpaceBeforeAssignmentOperators: true\nSpaceBeforeCtorInitializerColon: true\nSpaceBeforeInheritanceColon: true\nSpaceBeforeParens: ControlStatements\nSpaceBeforeRangeBasedForLoopColon: true\nSpaceBeforeSquareBrackets: false\nSpaceInEmptyBlock: true\nSpaceInEmptyParentheses: false\nSpacesInCStyleCastParentheses: false\nSpacesInConditionalStatement: true\nSpacesInParentheses: true\nSpacesInSquareBrackets: false\nTabWidth: 4\nUseTab: ForIndentation"
  },
  {
    "path": ".gitattributes",
    "content": "* text=auto eol=lf\n*.{cmd,[cC][mM][dD]} text eol=crlf\n*.{bat,[bB][aA][tT]} text eol=crlf"
  },
  {
    "path": ".github/workflows/build.yml",
    "content": "name: Build and Deploy\non: [ push, pull_request ]\n\njobs:\n  android:\n    name: Android\n    runs-on: ubuntu-latest\n    steps:\n      - name: Checkout sources\n        uses: actions/checkout@v5\n        with:\n          fetch-depth: 0\n          submodules: recursive\n      - name: Setup Java\n        uses: actions/setup-java@v4\n        with:\n          java-version: 17\n          distribution: 'temurin'\n          cache: gradle\n      - name: Build and Sign APK\n        env:\n          KEYSTORE_FILE_PATH: ${{ github.workspace }}/signingkey.jks\n          KEYSTORE_PASSWORD: ${{ secrets.KEY_STORE_PASSWORD }}\n          KEY_ALIAS: ${{ secrets.ALIAS }}\n          KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}\n        run: |\n          if [[ -n \"${{ secrets.SIGNING_KEY }}\" ]]; then\n            echo \"${{ secrets.SIGNING_KEY }}\" | base64 --decode > ${{ env.KEYSTORE_FILE_PATH }}\n            ./gradlew assembleGitContinuous\n            mv app/build/outputs/apk/git/continuous/app-git-continuous.apk CS16Client-Android.apk\n          else\n            ./gradlew assembleGitDebug\n            mv app/build/outputs/apk/git/debug/app-git-debug.apk CS16Client-Android.apk\n          fi\n        working-directory: android\n      - name: Upload artifacts\n        uses: actions/upload-artifact@v4\n        with:\n          name: Android\n          path: android/CS16Client-Android.apk\n  psvita:\n    name: PS Vita\n    runs-on: ubuntu-latest\n    steps:\n      - name: Checkout sources\n        uses: actions/checkout@v5\n        with:\n          fetch-depth: 0\n          submodules: recursive\n      - name: Install dependencies\n        run: |\n          sudo apt-get update\n          sudo apt-get install libatomic1 libgcc-s1 \\\n            libstdc++6 gcc-multilib g++-multilib \\\n            ninja-build libfontconfig-dev\n      - name: Setup VitaSDK\n        run: |\n          scripts/psvita_sdk.sh\n          echo \"VITASDK=/usr/local/vitasdk\" >> $GITHUB_ENV\n          echo \"$VITASDK/bin\" >> $GITHUB_PATH\n      - name: Configure CMake\n        run: cmake --preset \"psvita-release\"\n      - name: Generate configuration files\n        working-directory: build\n        run: ${{ github.workspace }}/scripts/psvita_generate_configs.sh\n      - name: Build and Package\n        working-directory: build\n        run: |\n          cmake --build . --parallel $(nproc)\n          cpack --config CPackConfig.cmake\n      - name: Upload artifacts\n        uses: actions/upload-artifact@v4\n        with:\n          name: PSVita\n          path: build/*.zip\n  windows:\n    name: Windows\n    runs-on: windows-latest\n    strategy:\n      matrix:\n        arch: [ 'x86', 'amd64' ]\n      fail-fast: false\n    steps:\n      - name: Checkout sources\n        uses: actions/checkout@v5\n        with:\n          fetch-depth: 0\n          submodules: recursive\n      - name: Setup Visual Studio\n        uses: ilammy/msvc-dev-cmd@v1\n        with:\n          arch: ${{ matrix.arch }}\n      - name: Configure\n        run: cmake --preset \"win32-ci-${{ matrix.arch }}\"\n      - name: Build and Package\n        run: |\n          cmake --build .\n          cpack --config CPackConfig.cmake\n        working-directory: build\n      - name: Upload artifacts\n        uses: actions/upload-artifact@v4\n        with:\n          name: ${{ runner.os }}-${{ matrix.arch }}\n          path: build/*.zip\n  linux:\n    name: Linux\n    runs-on: ubuntu-latest\n    strategy:\n      matrix:\n        arch: [ 'i386', 'amd64' ]\n      fail-fast: false\n    steps:\n      - name: Checkout sources\n        uses: actions/checkout@v4\n        with:\n          fetch-depth: 0\n          submodules: recursive\n      - name: Install dependencies\n        run: |\n          sudo dpkg --add-architecture i386\n          sudo apt-get update\n          sudo apt-get install libatomic1:i386 libgcc-s1:i386 \\\n            libstdc++6:i386 gcc-multilib g++-multilib \\\n            ninja-build libfontconfig-dev:i386 libfontconfig-dev\n      - name: Configure\n        run: cmake --preset \"linux-ci-${{ matrix.arch }}\"\n      - name: Build and Package\n        run: |\n          cmake --build .\n          cpack --config CPackConfig.cmake\n        working-directory: build\n      - name: Upload artifacts\n        uses: actions/upload-artifact@v4\n        with:\n          name: ${{ runner.os }}-${{ matrix.arch }}\n          path: build/*.tar.gz\n  macos:\n    name: macOS\n    strategy:\n      matrix:\n        os: [ 'macos-15-intel', 'macos-latest' ]\n        arch: [ 'x86_64', 'arm64' ]\n        exclude:\n          - os: macos-15-intel\n            arch: arm64\n          - os: macos-latest\n            arch: x86_64\n      fail-fast: false\n    runs-on: ${{ matrix.os }}\n    steps:\n      - name: Checkout sources\n        uses: actions/checkout@v5\n        with:\n          fetch-depth: 0\n          submodules: recursive\n      - name: Install dependencies\n        run: brew install cmake gcc ninja fontconfig\n      - name: Configure\n        run: cmake --preset \"macos-ci-${{ matrix.arch }}\"\n      - name: Build and Package\n        run: |\n          cmake --build .\n          cpack --config CPackConfig.cmake\n        working-directory: build\n      - name: Upload artifacts\n        uses: actions/upload-artifact@v4\n        with:\n          name: ${{ runner.os }}-${{ matrix.arch }}\n          path: build/*.zip\n  release:\n    name: Release\n    runs-on: ubuntu-latest\n    if: github.ref == 'refs/heads/main' && always()\n    needs: [ android, windows, linux, psvita, macos ]\n    steps:\n      - name: Fetch artifacts\n        uses: actions/download-artifact@v4\n      - name: Remove old release\n        run: |\n          TAG_NAME=${{ github.ref_name == 'main' && 'continuous' || format('continuous-{0}', github.ref_name) }}\n          echo \"TAG_NAME=$TAG_NAME\" >> $GITHUB_ENV\n          if gh release list --repo ${{ github.repository }} | grep -q -e \"$TAG_NAME\"; then\n            gh release delete \"$TAG_NAME\" --yes --cleanup-tag --repo ${{ github.repository }}\n          fi\n        env:\n          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n      - name: Upload new release\n        run: |\n          gh release create ${{ env.TAG_NAME }} --title \"CS16Client development build\" --prerelease */CS16Client-* \\\n            --repo ${{ github.repository }}\n        env:\n          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n"
  },
  {
    "path": ".gitignore",
    "content": "# Compiled Object files\n*.slo\n*.lo\n*.o\n*.obj\n\n# Precompiled Headers\n*.gch\n*.pch\n\n# Compiled Dynamic libraries\n*.so\n*.dylib\n*.dll\n\n# Fortran module files\n*.mod\n\n# Compiled Static libraries\n*.lai\n*.la\n*.a\n*.lib\n\n# Executables\n*.exe\n*.out\n*.app\n\n*.user\n*.sdf\n*.opendb\n*.pdb\n*.iobj\n*.lastbuildstate\n*.tlog\n*.log\n*.suo\n*.ipch\n*.ipdb\n*.exp\n*.idb\n*.ilk\n*.autosave\n\nandroid/app/src/main/assets\n*-build\n*admob-id.xml\n\nbuild/\n\n.vscode/\n\n.gradle/\n.externalNativeBuild\n.cxx/\n.idea/\nlocal.properties\n.project\n.classpath\n.gradle\n.settings\nrelease/\n*.tasks\nregamebuild/\n.vs/"
  },
  {
    "path": ".gitmodules",
    "content": "[submodule \"3rdparty/yapb\"]\n\tpath = 3rdparty/yapb\n\turl = https://github.com/yapb/yapb\n[submodule \"3rdparty/mainui_cpp\"]\n\tpath = 3rdparty/mainui_cpp\n\turl = https://github.com/Velaron/mainui_cpp\n[submodule \"3rdparty/ReGameDLL_CS\"]\n\tpath = 3rdparty/ReGameDLL_CS\n\turl = https://github.com/Velaron/ReGameDLL_CS\n[submodule \"3rdparty/miniutl\"]\n\tpath = 3rdparty/miniutl\n\turl = https://github.com/FWGS/MiniUTL\n"
  },
  {
    "path": "3rdparty/cs16client-extras/gfx/shell/strings.lst",
    "content": "189\t\" \"\n190\t\"Learn how to play Counter-Strike, be prepared for the real battles.\"\n191\t\"Load to a saved place in the training mission.\"\n192\t\"Save your place in the training mission, or load a past save.\"\n193\t\"Change Counter-Strike's video, audio, and control settings.\"\n194\t\"Read Half-Life's readme.txt.\"\n196\t\"Quit Counter-Strike.\"\n198\t\"Get online and play Counter-Strike with others from around the world.\"\n323\t\"Disable graphic visuals. If this is turned on, Counter-Strike will not be playable.\"\n324\t\"Download the latest version of Half-Life: Counter-Strike.\"\n398\t\"If the server allows it, this option will help you aim at enemies.\"\n391\t\"Check this box and enter password to disable visuals inappropriate for younger players and multiplayer.  Anyone wishing to change this setting will need to use this password. IMPORTANT NOTE:  If this is turned on, Counter-Strike will not be playable.\"\n400\t\"Read the official Counter-Strike Manual, learn how to play.\"\n402\t\"cstrike\\manual\\manual.htm\"\n416\t\"Visit Counter-Strike.net\"\n417\t\"www.counter-strike.net\"\n426\t\"Get the latest updates, official news, and see the entire CS Network!\"\n503\t\"Disabled.\"\n530\t\"Play/download other mods, or go back to Half-Life.\""
  },
  {
    "path": "3rdparty/cs16client-extras/touch/bots/bots.cfg",
    "content": "_reset_menu\ncmd_scripting 1\nset menu_root_path \"touch/bots\"\nset _menu_file_name \"bots.cfg\"\nalias build_menu \"exec touch/customcmd\"\nalias build_language \"exec touch/custom/my_menu-language\"\nset _menu_id my_menu-1-bots\nset _menu_level 1\nset _menu_min 3\nset _menu_max 9\n\nbuild_language\n\nset _menu_type_3 1\nset _menu_txt_3 \"Add bot\"\nset _menu_cmd_3 \"exec touch/bots/my_menu-2-addbot\"\nset _menu_icn_3 \"touch/bots/right.tga\"\n\nset _menu_type_4 1\nset _menu_txt_4 \"Settings\"\nset _menu_cmd_4 \"exec touch/bots/my_menu-2-settings\"\nset _menu_icn_4 \"touch/bots/right.tga\"\n\nset _menu_type_5 1\nset _menu_txt_5 \"Kill all bots\"\nif $yb_freeze_bots  >= 0\n:set _menu_cmd_5 \"bot_kill;yb kill\";else\n:set _menu_cmd_5 \"bot_kill\"\nset _menu_icn_5 \"\"\n\nset _menu_type_6 1\nset _menu_txt_6 \"Remove all bots\"\nif $yb_freeze_bots  >= 0\n:set _menu_cmd_6 \"bot_kick;yb removebots\";else\n:set _menh_cmd_6 \"bot_kick\"\nset _menu_icn_6 \"\"\n\nset _menu_type_7 2\nset _menu_txt_7 \"Stop bots\"\nset _menu_cmd_7 \"bot_stop\"\nset _menu_f7 $bot_stop\n\nset _menu_type_8 1\nif $yb_freeze_bots  >= 0\n:set _menu_txt_8 \"Open YaPB menu\"\n:set _menu_cmd_8 \"_erase_frame; yb menu\"\n:set _menu_icn_8 \"touch/bots/right.tga\"\nelse\n:set _menu_txt_8 \"$_menu_txt_exit\"\n:set _menu_cmd_8 \"_erase_frame\"\n:set _menu_icn_8 \"\"\n\nif $yb_freeze_bots  >= 0\n:set _menu_type_9 1\n:set _menu_txt_9 \"$_menu_txt_exit\"\n:set _menu_cmd_9 \"_erase_frame\"\n:set _menu_icn_9 \"\"\nelse\n:set _menu_type_9 0\n\nbuild_menu\n\nif $enable_controls = 1;:touch_setclientonly 0;else;:touch_setclientonly 1\nexec touch/custom/my_menu-5-controls.cfg\n\nalias ybmenu \"_erase_frame; yb menu\"\nif $bot_allow_shield >= 0\n:echo\nelse\n:ybmenu\n"
  },
  {
    "path": "3rdparty/cs16client-extras/touch/bots/my_menu-2-addbot.cfg",
    "content": "cmd_scripting 1\nset menu_root_path \"touch/bots\"\nset _menu_id my_menu-2-addbot\nset _menu_level 2\nset _menu_min 3\nset _menu_max 6\n\nset _menu_type_3 1\nset _menu_txt_3 \"Add several by quota\"\nset _menu_cmd_3 \"exec touch/bots/my_menu-3-quota\"\nset _menu_icn_3 \"touch/bots/right.tga\"\n\nset _menu_type_4 1\nset _menu_txt_4 \"Add random\"\nset _menu_cmd_4 \"bot_add\"\nset _menu_icn_4 \"\"\n\nset _menu_type_5 1\nset _menu_txt_5 \"Add Terrorist\"\nset _menu_cmd_5 \"bot_add_t\"\nset _menu_icn_5 \"\"\n\nset _menu_type_6 1\nset _menu_txt_6 \"Add Counter-Terrorist\"\nset _menu_cmd_6 \"bot_add_ct\"\nset _menu_icn_6 \"\"\n\nbuild_menu\n"
  },
  {
    "path": "3rdparty/cs16client-extras/touch/bots/my_menu-2-settings.cfg",
    "content": "cmd_scripting 1\nset menu_root_path \"touch/bots\"\nset _menu_id my_menu-2-settings\nset _menu_level 2\nset _menu_min 3\nset _menu_max 9\n\nset _menu_type_3 1\nset _menu_txt_3 \"Weapon settings\"\nset _menu_cmd_3 \"exec touch/bots/my_menu-3-set1\"\nset _menu_icn_3 \"touch/bots/right.tga\"\n\nset _menu_type_4 1\nset _menu_txt_4 \"Weapon modes\"\nset _menu_cmd_4 \"exec touch/bots/my_menu-3-set2\"\nset _menu_icn_4 \"touch/bots/right.tga\"\n\nset _menu_type_5 1\nset _menu_txt_5 \"Difficulty\"\nset _menu_cmd_5 \"exec touch/bots/my_menu-3-set3\"\nset _menu_icn_5 \"touch/bots/right.tga\"\n\nset _menu_type_6 1\nset _menu_txt_6 \"Chatter\"\nset _menu_cmd_6 \"exec touch/bots/my_menu-3-set4\"\nset _menu_icn_6 \"touch/bots/right.tga\"\n\nset _menu_type_7 1\nset _menu_txt_7 \"Behavior\"\nset _menu_cmd_7 \"exec touch/bots/my_menu-3-set5\"\nset _menu_icn_7 \"touch/bots/right.tga\"\n\nset _menu_type_8 1\nset _menu_txt_8 \"Quota mode\"\nset _menu_cmd_8 \"exec touch/bots/my_menu-3-set6\"\nset _menu_icn_8 \"touch/bots/right.tga\"\n\nset _menu_type_9 3\nset _menu_txt_9 \"Name prefix\"\nset _menu_cmd_9 \"bot_prefix\"\nset _menu_f9 $bot_prefix\n\nbuild_menu\n"
  },
  {
    "path": "3rdparty/cs16client-extras/touch/bots/my_menu-3-quota.cfg",
    "content": "cmd_scripting 1\nset menu_root_path \"touch/bots\"\nset _menu_id my_menu-3-quota\nset _menu_level 3\nset _menu_min 3\nset _menu_max 8\n\nset _menu_type_3 1\nset _menu_txt_3 \"Add bots by quota\"\nset _menu_cmd_3 \"bot_quota $bot_quota_value\"\nset _menu_icn_3 \"\"\n\nset _menu_type_4 3\nset _menu_txt_4 \"Bot quota\"\nset _menu_cmd_4 \"bot_quota_value\"\nset _menu_f4 $bot_quota_value\n\nset _menu_type_5 1\nset _menu_txt_5 \"Bots join any team\"\nset _menu_cmd_5 \"bot_join_team any\"\nset _menu_icn_5 \"\"\n\nset _menu_type_6 1\nset _menu_txt_6 \"Bots join Terrorists\"\nset _menu_cmd_6 \"bot_join_team t\"\nset _menu_icn_6 \"\"\n\nset _menu_type_7 1\nset _menu_txt_7 \"Bots join Counter-Terrorists\"\nset _menu_cmd_7 \"bot_join_team ct\"\nset _menu_icn_7 \"\"\n\nset _menu_type_8 2\nset _menu_txt_8 \"Bots join; after player\"\nset _menu_cmd_8 \"bot_join_after_player\"\nset _menu_f8 $bot_join_after_player\n\nbuild_menu\n\nif $bot_join_team = any;:touch_setcolor _menu_S5_my_menu-3-quota 156 77 20 180\nif $bot_join_team = t;:touch_setcolor _menu_S6_my_menu-3-quota 156 77 20 180\nif $bot_join_team = ct;:touch_setcolor _menu_S7_my_menu-3-quota 156 77 20 180\n"
  },
  {
    "path": "3rdparty/cs16client-extras/touch/bots/my_menu-3-set1.cfg",
    "content": "cmd_scripting 1\nset menu_root_path \"touch/bots\"\nset _menu_id my_menu-3-set1\nset _menu_level 3\nset _menu_min 3\nset _menu_max 10\n\nset _menu_type_3 2\nset _menu_txt_3 \"Pistols\"\nset _menu_cmd_3 \"bot_allow_pistols\"\nset _menu_f3 $bot_allow_pistols\n\nset _menu_type_4 2\nset _menu_txt_4 \"Shotguns\"\nset _menu_cmd_4 \"bot_allow_shotguns\"\nset _menu_f4 $bot_allow_shotguns\n\nset _menu_type_5 2\nset _menu_txt_5 \"Submachine; guns\"\nset _menu_cmd_5 \"bot_allow_sub_machine_guns\"\nset _menu_f5 $bot_allow_sub_machine_guns\n\nset _menu_type_6 2\nset _menu_txt_6 \"Rifles\"\nset _menu_cmd_6 \"bot_allow_rifles\"\nset _menu_f6 $bot_allow_rifles\n\nset _menu_type_7 2\nset _menu_txt_7 \"Sniper; rifles\"\nset _menu_cmd_7 \"bot_allow_snipers\"\nset _menu_f7 $bot_allow_snipers\n\nset _menu_type_8 2\nset _menu_txt_8 \"Machine guns\"\nset _menu_cmd_8 \"bot_allow_machine_guns\"\nset _menu_f8 $bot_allow_machine_guns\n\nset _menu_type_9 2\nset _menu_txt_9 \"Grenades\"\nset _menu_cmd_9 \"bot_allow_grenades\"\nset _menu_f9 $bot_allow_grenades\n\nset _menu_type_10 2\nset _menu_txt_10 \"Shield\"\nset _menu_cmd_10 \"bot_allow_shield\"\nset _menu_f10 $bot_allow_shield\n\nbuild_menu\n"
  },
  {
    "path": "3rdparty/cs16client-extras/touch/bots/my_menu-3-set2.cfg",
    "content": "cmd_scripting 1\nset menu_root_path \"touch/bots\"\nset _menu_id my_menu-3-set2\nset _menu_level 3\nset _menu_min 4\nset _menu_max 7\n\nset _menu_type_4 1\nset _menu_txt_4 \"Knives only\"\nset _menu_cmd_4 \"bot_knives_only\"\nset _menu_icn_4 \"\"\n\nset _menu_type_5 1\nset _menu_txt_5 \"Pistols only\"\nset _menu_cmd_5 \"bot_pistols_only\"\nset _menu_icn_5 \"\"\n\nset _menu_type_6 1\nset _menu_txt_6 \"Snipers only\"\nset _menu_cmd_6 \"bot_snipers_only\"\nset _menu_icn_6 \"\"\n\nset _menu_type_7 1\nset _menu_txt_7 \"All weapons\"\nset _menu_cmd_7 \"bot_all_weapons\"\nset _menu_icn_7 \"\"\n\nbuild_menu\n"
  },
  {
    "path": "3rdparty/cs16client-extras/touch/bots/my_menu-3-set3.cfg",
    "content": "cmd_scripting 1\nset menu_root_path \"touch/bots\"\nset _menu_id my_menu-3-set3\nset _menu_level 3\nset _menu_min 5\nset _menu_max 8\n\nset _menu_type_5 1\nset _menu_txt_5 \"Easy\"\nset _menu_cmd_5 \"bot_difficulty 0\"\nset _menu_icn_5 \"\"\n\nset _menu_type_6 1\nset _menu_txt_6 \"Normal\"\nset _menu_cmd_6 \"bot_difficulty 1\"\nset _menu_icn_6 \"\"\n\nset _menu_type_7 1\nset _menu_txt_7 \"Hard\"\nset _menu_cmd_7 \"bot_difficulty 2\"\nset _menu_icn_7 \"\"\n\nset _menu_type_8 1\nset _menu_txt_8 \"Very Hard\"\nset _menu_cmd_8 \"bot_difficulty 3\"\nset _menu_icn_8 \"\"\n\nbuild_menu\n\nif $bot_difficulty = 0;:touch_setcolor _menu_S5_my_menu-3-set3 156 77 20 180\nif $bot_difficulty = 1;:touch_setcolor _menu_S6_my_menu-3-set3 156 77 20 180\nif $bot_difficulty = 2;:touch_setcolor _menu_S7_my_menu-3-set3 156 77 20 180\nif $bot_difficulty = 3;:touch_setcolor _menu_S8_my_menu-3-set3 156 77 20 180\n"
  },
  {
    "path": "3rdparty/cs16client-extras/touch/bots/my_menu-3-set4.cfg",
    "content": "cmd_scripting 1\nset menu_root_path \"touch/bots\"\nset _menu_id my_menu-3-set4\nset _menu_level 3\nset _menu_min 6\nset _menu_max 9\n\nset _menu_type_6 1\nset _menu_txt_6 \"Normal\"\nset _menu_cmd_6 \"bot_chatter normal\"\nset _menu_icn_6 \"\"\n\nset _menu_type_7 1\nset _menu_txt_7 \"Minimal\"\nset _menu_cmd_7 \"bot_chatter minimal\"\nset _menu_icn_7 \"\"\n\nset _menu_type_8 1\nset _menu_txt_8 \"Radio Only\"\nset _menu_cmd_8 \"bot_chatter radio\"\nset _menu_icn_8 \"\"\n\nset _menu_type_9 1\nset _menu_txt_9 \"Disabled\"\nset _menu_cmd_9 \"bot_chatter off\"\nset _menu_icn_9 \"\"\n\nbuild_menu\n\nif $bot_chatter = normal;:touch_setcolor _menu_S6_my_menu-3-set4 156 77 20 180\nif $bot_chatter = minimal;:touch_setcolor _menu_S7_my_menu-3-set4 156 77 20 180\nif $bot_chatter = radio;:touch_setcolor _menu_S8_my_menu-3-set4 156 77 20 180\nif $bot_chatter = off;:touch_setcolor _menu_S9_my_menu-3-set4 156 77 20 180\n"
  },
  {
    "path": "3rdparty/cs16client-extras/touch/bots/my_menu-3-set5.cfg",
    "content": "cmd_scripting 1\nset menu_root_path \"touch/bots\"\nset _menu_id my_menu-3-set5\nset _menu_level 3\nset _menu_min 7\nset _menu_max 10\n\nset _menu_type_7 2\nset _menu_txt_7 \"Bots make; room for; players\"\nset _menu_cmd_7 \"bot_auto_vacate\"\nset _menu_f7 $bot_auto_vacate\n\nset _menu_type_8 2\nset _menu_txt_8 \"Bots defer; to human; objectives\"\nset _menu_cmd_8 \"bot_defer_to_human\"\nset _menu_f8 $bot_defer_to_human\n\nset _menu_type_9 2\nset _menu_txt_9 \"Allow rogues\"\nset _menu_cmd_9 \"bot_allow_rogues\"\nset _menu_f9 $bot_allow_rogues\n\nset _menu_type_10 2\nset _menu_txt_10 \"Walk only\"\nset _menu_cmd_10 \"bot_walk\"\nset _menu_f10 $bot_walk\n\nbuild_menu\n"
  },
  {
    "path": "3rdparty/cs16client-extras/touch/bots/my_menu-3-set6.cfg",
    "content": "cmd_scripting 1\nset menu_root_path \"touch/bots\"\nset _menu_id my_menu-3-set6\nset _menu_level 3\nset _menu_min 8\nset _menu_max 10\n\nset _menu_type_8 1\nset _menu_txt_8 \"Normal\"\nset _menu_cmd_8 \"bot_quota_mode normal\"\nset _menu_icn_8 \"\"\n\nset _menu_type_9 1\nset _menu_txt_9 \"Fill\"\nset _menu_cmd_9 \"bot_quota_mode fill\"\nset _menu_icn_9 \"\"\n\nset _menu_type_10 1\nset _menu_txt_10 \"Match\"\nset _menu_cmd_10 \"bot_quota_mode match\"\nset _menu_icn_10 \"\"\n\nbuild_menu\n\nif $bot_quota_mode = normal;:touch_setcolor _menu_S8_my_menu-3-set6 156 77 20 180\nif $bot_quota_mode = fill;:touch_setcolor _menu_S9_my_menu-3-set6 156 77 20 180\nif $bot_quota_mode = match;:touch_setcolor _menu_S0_my_menu-3-set6 156 77 20 180\n"
  },
  {
    "path": "3rdparty/cs16client-extras/touch/buy.cfg",
    "content": "// Coded by Alprnn357\r\ntouch_setclientonly 1\r\ncmd_scripting 1\r\ntouch_set_stroke 1 255 174 0 150\r\n\r\nalias _erase_frame \"touch_removebutton _menu_*; _menu_off; slot10\"\r\nalias _menu_off \"touch_setclientonly 0\"\r\nalias _click \"play media/launch_select1.wav; vibrate 30\"\r\n\r\ntouch_addbutton \"_menu_bg_crn4\" \"gfx/vgui/round_corner_se.tga\" \"\" 0.880000 0.924444 0.900000 0.960000 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_crn2\" \"gfx/vgui/round_corner_ne.tga\" \"\" 0.880000 0.035556 0.900000 0.071111 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_crn1\" \"gfx/vgui/round_corner_nw.tga\" \"\" 0.100000 0.035556 0.120000 0.071111 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_crn3\" \"gfx/vgui/round_corner_sw.tga\" \"\" 0.100000 0.924444 0.120000 0.960000 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_top1\" \"*black\" \"\" 0.120000 0.035556 0.880000 0.071111 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_top2\" \"*black\" \"\" 0.100000 0.071111 0.900000 0.160000 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_bottom\" \"*black\" \"\" 0.120000 0.924444 0.880000 0.960000 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_body\" \"*black\" \"\" 0.100000 0.165000 0.900000 0.924444 0 0 0 150 6\r\nif $menu_bg_fill >= 1;:touch_removebutton _menu_bg_*;:touch_addbutton _menu_bg_body *black \"\" 0 0 1 1 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_icn_logo\" \"gfx/vgui/cs_logo.tga\" \"\" 0.110000 0.053333 0.160000 0.142222 255 174 0 255 6\r\ntouch_addbutton \"_menu_bg_txt_logo\" \"#BUY MENU\" \"\" 0.170000 0.071111 0.890000 0.142222 255 174 0 255 6\r\n\r\ntouch_addbutton \"_menu_txt_title\" \"#SHOP BY CATEGORY\" \"\" 0.140000 0.177778 0.860000 0.213333 255 174 0 255 4\r\ntouch_addbutton \"_menu_slot1\" \"*white\" \"+menu_slot1\" 0.140000 0.213333 0.360000 0.266667 0 0 0 150 260\r\ntouch_addbutton \"_menu_txt_slot1\" \"#1 PISTOLS\" \"\" 0.150000 0.231111 0.360000 0.266667 255 174 0 255 4\r\ntouch_addbutton \"_menu_slot2\" \"*white\" \"+menu_slot2\" 0.140000 0.284444 0.360000 0.337778 0 0 0 150 260\r\ntouch_addbutton \"_menu_txt_slot2\" \"#2 SHOTGUNS\" \"\" 0.150000 0.302222 0.360000 0.337778 255 174 0 255 4\r\ntouch_addbutton \"_menu_slot3\" \"*white\" \"+menu_slot3\" 0.140000 0.355556 0.360000 0.408889 0 0 0 150 260\r\ntouch_addbutton \"_menu_txt_slot3\" \"#3 SMG\" \"\" 0.150000 0.373333 0.360000 0.408889 255 174 0 255 4\r\ntouch_addbutton \"_menu_slot4\" \"*white\" \"+menu_slot4\" 0.140000 0.426667 0.360000 0.480000 0 0 0 150 260\r\ntouch_addbutton \"_menu_txt_slot4\" \"#4 RIFLES\" \"\" 0.150000 0.444444 0.360000 0.480000 255 174 0 255 4\r\ntouch_addbutton \"_menu_slot5\" \"*white\" \"+menu_slot5\" 0.140000 0.497778 0.360000 0.551111 0 0 0 150 260\r\ntouch_addbutton \"_menu_txt_slot5\" \"#5 MACHINE GUNS\" \"\" 0.150000 0.515556 0.360000 0.551111 255 174 0 255 4\r\ntouch_addbutton \"_menu_slot6\" \"*white\" \"+menu_slot6\" 0.140000 0.568889 0.360000 0.622222 0 0 0 150 260\r\ntouch_addbutton \"_menu_txt_slot6\" \"#6 PRIMARY AMMO\" \"\" 0.150000 0.586667 0.360000 0.622222 255 174 0 255 4\r\ntouch_addbutton \"_menu_slot7\" \"*white\" \"+menu_slot7\" 0.140000 0.640000 0.360000 0.693333 0 0 0 150 260\r\ntouch_addbutton \"_menu_txt_slot7\" \"#7 SECONDARY AMMO\" \"\" 0.150000 0.657778 0.360000 0.693333 255 174 0 255 4\r\ntouch_addbutton \"_menu_slot8\" \"*white\" \"+menu_slot8\" 0.140000 0.711111 0.360000 0.764444 0 0 0 150 260\r\ntouch_addbutton \"_menu_txt_slot8\" \"#8 EQUIPMENT\" \"\" 0.150000 0.728889 0.360000 0.764444 255 174 0 255 4\r\n//touch_addbutton \"_menu_slot9\" \"*white\" \"\" 0.140000 0.782222 0.360000 0.835556 0 0 0 150 260\r\n//touch_addbutton \"_menu_txt_slot9\" \"#9 SLOT\" \"\" 0.150000 0.800000 0.360000 0.835556 255 174 0 255 4\r\ntouch_addbutton \"_menu_slot0\" \"*white\" \"+menu_slot0\" 0.14 0.871111 0.36 0.924444 0 0 0 150 260\r\ntouch_addbutton \"_menu_txt_slot0\" \"#0 CANCEL\" \"\" 0.15 0.888889 0.36 0.924444 255 174 0 255 4\r\ntouch_addbutton \"_menu_seperator\" \"*white\" \"\" 0.374000 0.213333 0.376000 0.924444 0 0 0 150 260\r\ntouch_addbutton \"_menu_autobuy\" \"*white\" \"+menu_autobuy\" 0.390000 0.213333 0.610000 0.266667 0 0 0 150 260\r\ntouch_addbutton \"_menu_txt_autobuy\" \"#A AUTO-BUY\" \"\" 0.400000 0.231111 0.610000 0.266667 255 174 0 255 4\r\ntouch_addbutton \"_menu_rebuy\" \"*white\" \"+menu_rebuy\" 0.390000 0.284444 0.610000 0.337778 0 0 0 150 260\r\ntouch_addbutton \"_menu_txt_rebuy\" \"#R RE-BUY PREVIOUS\" \"\" 0.400000 0.302222 0.610000 0.337778 255 174 0 255 4\r\n\r\ntouch_addbutton \"_menu_txt_money\" \"#YOU HAVE \\$$cscl_currentmoney\" \"_menu_refresh\" 0.170000 0.106667 0.890000 0.160000 255 174 0 255 4\r\nalias _menu_refresh \"exec touch/buy.cfg\"\r\n\r\n//alias +menu_slot0 \"touch_setcolor _menu_slot0 255 174 0 150\"\r\n//alias -menu_slot0 \"touch_setcolor _menu_slot0 0 0 0 150\"\r\n\r\nalias +menu_slot0 \"_click; touch_setcolor _menu_slot0 255 174 0 150\"\r\nalias -menu_slot0 \"touch_setcolor _menu_slot0 0 0 0 150; _erase_frame\"\r\n\r\nalias +menu_slot1 \"_click; touch_setcolor _menu_slot1 255 174 0 150\"\r\nalias -menu_slot1 \"touch_setcolor _menu_slot1 0 0 0 150; _erase_frame; showvguimenu 29\"\r\n\r\nalias +menu_slot2 \"_click; touch_setcolor _menu_slot2 255 174 0 150\"\r\nalias -menu_slot2 \"touch_setcolor _menu_slot2 0 0 0 150; _erase_frame; showvguimenu 30\"\r\n\r\nalias +menu_slot3 \"_click; touch_setcolor _menu_slot3 255 174 0 150\"\r\nalias -menu_slot3 \"touch_setcolor _menu_slot3 0 0 0 150; _erase_frame; showvguimenu 32\"\r\n\r\nalias +menu_slot4 \"_click; touch_setcolor _menu_slot4 255 174 0 150\"\r\nalias -menu_slot4 \"touch_setcolor _menu_slot4 0 0 0 150; _erase_frame; showvguimenu 31\"\r\n\r\nalias +menu_slot5 \"_click; touch_setcolor _menu_slot5 255 174 0 150\"\r\nalias -menu_slot5 \"touch_setcolor _menu_slot5 0 0 0 150; _erase_frame; showvguimenu 33\"\r\n\r\nalias +menu_slot6 \"_click; touch_setcolor _menu_slot6 255 174 0 150\"\r\nalias -menu_slot6 \"touch_setcolor _menu_slot6 0 0 0 150; primammo; _erase_frame\"\r\n\r\nalias +menu_slot7 \"_click; touch_setcolor _menu_slot7 255 174 0 150\"\r\nalias -menu_slot7 \"touch_setcolor _menu_slot7 0 0 0 150; secammo; _erase_frame\"\r\n\r\nalias +menu_slot8 \"_click; touch_setcolor _menu_slot8 255 174 0 150\"\r\nalias -menu_slot8 \"touch_setcolor _menu_slot8 0 0 0 150; _erase_frame; showvguimenu 34\"\r\n\r\nalias +menu_autobuy \"_click; touch_setcolor _menu_autobuy 255 174 0 150\"\r\nalias -menu_autobuy \"touch_setcolor _menu_autobuy 0 0 0 150; autobuy; _erase_frame\"\r\n\r\nalias +menu_rebuy \"_click; touch_setcolor _menu_rebuy 255 174 0 150\"\r\nalias -menu_rebuy \"touch_setcolor _menu_rebuy 0 0 0 150; rebuy; _erase_frame\"\r\n"
  },
  {
    "path": "3rdparty/cs16client-extras/touch/buy_item_ct.cfg",
    "content": "// Coded by Alprnn357\r\ntouch_setclientonly 1\r\ncmd_scripting 1\r\ntouch_set_stroke 1 255 174 0 150\r\n\r\nalias _erase_frame \"touch_removebutton _menu_*; _menu_off; slot10\"\r\nalias _menu_off \"touch_setclientonly 0\"\r\nalias _click \"play media/launch_select1.wav; vibrate 30\"\r\n\r\ntouch_addbutton \"_menu_bg_crn4\" \"gfx/vgui/round_corner_se.tga\" \"\" 0.880000 0.924444 0.900000 0.960000 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_crn2\" \"gfx/vgui/round_corner_ne.tga\" \"\" 0.880000 0.035556 0.900000 0.071111 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_crn1\" \"gfx/vgui/round_corner_nw.tga\" \"\" 0.100000 0.035556 0.120000 0.071111 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_crn3\" \"gfx/vgui/round_corner_sw.tga\" \"\" 0.100000 0.924444 0.120000 0.960000 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_top1\" \"*black\" \"\" 0.120000 0.035556 0.880000 0.071111 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_top2\" \"*black\" \"\" 0.100000 0.071111 0.900000 0.160000 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_bottom\" \"*black\" \"\" 0.120000 0.924444 0.880000 0.960000 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_body\" \"*black\" \"\" 0.100000 0.165000 0.900000 0.924444 0 0 0 150 6\r\nif $menu_bg_fill >= 1;:touch_removebutton _menu_bg_*;:touch_addbutton _menu_bg_body *black \"\" 0 0 1 1 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_icn_logo\" \"gfx/vgui/cs_logo.tga\" \"\" 0.110000 0.053333 0.160000 0.142222 255 174 0 255 6\r\ntouch_addbutton \"_menu_bg_txt_logo\" \"#BUY EQUIPMENT\" \"\" 0.170000 0.071111 0.890000 0.142222 255 174 0 255 6\r\n\r\n//touch_addbutton \"_menu_txt_title\" \"#THE TITLE\" \"\" 0.140000 0.177778 0.860000 0.213333 255 174 0 255 4\r\ntouch_addbutton \"_menu_slot1\" \"*white\" \"_menu_select_slot1\" 0.140000 0.213333 0.360000 0.266667 0 0 0 150 260\r\ntouch_addbutton \"_menu_txt_slot1\" \"#1 KEVLAR\" \"\" 0.150000 0.231111 0.360000 0.266667 255 174 0 255 4\r\ntouch_addbutton \"_menu_slot2\" \"*white\" \"_menu_select_slot2\" 0.140000 0.284444 0.360000 0.337778 0 0 0 150 260\r\ntouch_addbutton \"_menu_txt_slot2\" \"#2 KEVLAR+HELMET\" \"\" 0.150000 0.302222 0.360000 0.337778 255 174 0 255 4\r\ntouch_addbutton \"_menu_slot3\" \"*white\" \"_menu_select_slot3\" 0.140000 0.355556 0.360000 0.408889 0 0 0 150 260\r\ntouch_addbutton \"_menu_txt_slot3\" \"#3 FLASHBANG\" \"\" 0.150000 0.373333 0.360000 0.408889 255 174 0 255 4\r\ntouch_addbutton \"_menu_slot4\" \"*white\" \"_menu_select_slot4\" 0.140000 0.426667 0.360000 0.480000 0 0 0 150 260\r\ntouch_addbutton \"_menu_txt_slot4\" \"#4 HE GRENADE\" \"\" 0.150000 0.444444 0.360000 0.480000 255 174 0 255 4\r\ntouch_addbutton \"_menu_slot5\" \"*white\" \"_menu_select_slot5\" 0.140000 0.497778 0.360000 0.551111 0 0 0 150 260\r\ntouch_addbutton \"_menu_txt_slot5\" \"#5 SMOKE GRENADE\" \"\" 0.150000 0.515556 0.360000 0.551111 255 174 0 255 4\r\nif $cscl_mapprefix == \"de_\"\r\n:touch_addbutton \"_menu_slot6\" \"*white\" \"_menu_select_slot6\" 0.140000 0.568889 0.360000 0.622222 0 0 0 150 260\r\n:touch_addbutton \"_menu_txt_slot6\" \"#6 DEFUSAL KIT\" \"\" 0.150000 0.586667 0.360000 0.622222 255 174 0 255 4\r\nelse\r\n:touch_addbutton \"_menu_slot6\" \"*white\" \"_menu_select_slot6_noconfirm\" 0.140000 0.568889 0.360000 0.622222 0 0 0 150 260\r\n:touch_addbutton \"_menu_txt_slot6\" \"#6 DEFUSAL KIT\" \"\" 0.150000 0.586667 0.360000 0.622222 129 85 0 255 4\r\ntouch_addbutton \"_menu_slot7\" \"*white\" \"_menu_select_slot7\" 0.140000 0.640000 0.360000 0.693333 0 0 0 150 260\r\ntouch_addbutton \"_menu_txt_slot7\" \"#7 NIGHTVISION\" \"\" 0.150000 0.657778 0.360000 0.693333 255 174 0 255 4\r\ntouch_addbutton \"_menu_slot8\" \"*white\" \"_menu_select_slot8\" 0.140000 0.711111 0.360000 0.764444 0 0 0 150 260\r\ntouch_addbutton \"_menu_txt_slot8\" \"#8 TACTICAL SHIELD\" \"\" 0.150000 0.728889 0.360000 0.764444 255 174 0 255 4\r\n//touch_addbutton \"_menu_slot9\" \"*white\" \"\" 0.140000 0.782222 0.360000 0.835556 0 0 0 150 260\r\n//touch_addbutton \"_menu_txt_slot9\" \"#9 SLOT\" \"\" 0.150000 0.800000 0.360000 0.835556 255 174 0 255 4\r\ntouch_addbutton \"_menu_slot0\" \"*white\" \"+menu_slot0\" 0.14 0.871111 0.36 0.924444 0 0 0 150 260\r\ntouch_addbutton \"_menu_txt_slot0\" \"#0 CANCEL\" \"\" 0.15 0.888889 0.36 0.924444 255 174 0 255 4\r\n\r\nset _menu_money_item1 \"650\"; if $cscl_currentmoney < $_menu_money_item1;: touch_setcolor _menu_txt_slot1 129 85 0 255\r\nset _menu_money_item2 \"1000\"; if $cscl_currentmoney < $_menu_money_item2;: touch_setcolor _menu_txt_slot2 129 85 0 255\r\nset _menu_money_item3 \"200\"; if $cscl_currentmoney < $_menu_money_item3;: touch_setcolor _menu_txt_slot3 129 85 0 255\r\nset _menu_money_item4 \"300\"; if $cscl_currentmoney < $_menu_money_item4;: touch_setcolor _menu_txt_slot4 129 85 0 255\r\nset _menu_money_item5 \"300\"; if $cscl_currentmoney < $_menu_money_item5;: touch_setcolor _menu_txt_slot5 129 85 0 255\r\nset _menu_money_item6 \"200\"; if $cscl_currentmoney < $_menu_money_item6;: touch_setcolor _menu_txt_slot6 129 85 0 255\r\nset _menu_money_item7 \"1250\"; if $cscl_currentmoney < $_menu_money_item7;: touch_setcolor _menu_txt_slot7 129 85 0 255\r\nset _menu_money_item8 \"2200\"; if $cscl_currentmoney < $_menu_money_item8;: touch_setcolor _menu_txt_slot8 129 85 0 255\r\n\r\ntouch_addbutton \"_menu_frame\" \"*white\" \"\" 0.390000 0.213333 0.840000 0.551111 0 0 0 150 260\r\ntouch_addbutton \"_menu_frame_icn_class1\" \"gfx/vgui/kevlar.tga\" \"\" 0.430000 0.215333 0.810000 0.549111 255 255 255 255 4\r\ntouch_addbutton \"_menu_frame_icn_class2\" \"gfx/vgui/kevlar_helmet.tga\" \"\" 0.430000 0.215333 0.810000 0.549111 255 255 255 255 4\r\ntouch_addbutton \"_menu_frame_icn_class3\" \"gfx/vgui/flashbang.tga\" \"\" 0.430000 0.215333 0.810000 0.549111 255 255 255 255 4\r\ntouch_addbutton \"_menu_frame_icn_class4\" \"gfx/vgui/hegrenade.tga\" \"\" 0.430000 0.215333 0.810000 0.549111 255 255 255 255 4\r\ntouch_addbutton \"_menu_frame_icn_class5\" \"gfx/vgui/smokegrenade.tga\" \"\" 0.430000 0.215333 0.810000 0.549111 255 255 255 255 4\r\ntouch_addbutton \"_menu_frame_icn_class6\" \"gfx/vgui/defuser.tga\" \"\" 0.430000 0.215333 0.810000 0.549111 255 255 255 255 4\r\ntouch_addbutton \"_menu_frame_icn_class7\" \"gfx/vgui/nightvision.tga\" \"\" 0.430000 0.215333 0.810000 0.549111 255 255 255 255 4\r\ntouch_addbutton \"_menu_frame_icn_class8\" \"gfx/vgui/shield.tga\" \"\" 0.430000 0.215333 0.810000 0.549111 255 255 255 255 4\r\n\r\ntouch_addbutton \"_menu_confirm\" \"*white\" \"+menu_confirm\" 0.62 0.871111 0.84 0.924444 0 0 0 150 260\r\ntouch_addbutton \"_menu_confirm_txt\" \"#BUY THE ITEM\" \"\" 0.63 0.888889 0.84 0.924444 255 174 0 255 4\r\n\r\ntouch_addbutton \"_menu_frame_txt_data1\" \"#PRICE;DESCRIPTION\" \"\" 0.390000 0.551111 0.560000 0.853333 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_data2\" \"#TITLE;SUBTITLE\" \"\" 0.390000 0.551111 0.560000 0.853333 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc1\" \"#: \\$$_menu_money_item1;: A Kevlar vest that protects ; against projectiles\" \"\" 0.560000 0.551111 0.840000 0.853333 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc2\" \"#: \\$$_menu_money_item2;: A kevlar vest and a ballistic ; helmet which both protect ; against projectiles.\" \"\" 0.560000 0.551111 0.840000 0.853333 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc3\" \"#: \\$$_menu_money_item3;: Makes a loud noise and ; blinding flash when thrown ; at enemy (pull pin first). ; Useful for causing distractions ; before entering an area.\" \"\" 0.560000 0.551111 0.840000 0.853333 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc4\" \"#: \\$$_menu_money_item4;: A high-explosive device. Pull ; the pin, release the spoon ; and throw.\" \"\" 0.560000 0.551111 0.840000 0.853333 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc5\" \"#: \\$$_menu_money_item5;: A diversionary device that ; can be used to provide ; temporary cover for moving ; from place to place.\" \"\" 0.560000 0.551111 0.840000 0.853333 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc6\" \"#: \\$$_menu_money_item6;: A bomb defusal kit used to ; speed up the bomb defusal ; process.\" \"\" 0.560000 0.551111 0.840000 0.853333 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc7\" \"#: \\$$_menu_money_item7;: Nightvision goggles which ; allow the user to see more ; effectively in dark areas.\" \"\" 0.560000 0.551111 0.840000 0.853333 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc8\" \"#: \\$$_menu_money_item8;: Barrier-type shield for ; street tactics and ; intervention.\" \"\" 0.560000 0.551111 0.840000 0.853333 240 180 24 255 4\r\n\r\ntouch_addbutton \"_menu_txt_money\" \"#YOU HAVE \\$$cscl_currentmoney\" \"_menu_refresh\" 0.170000 0.106667 0.890000 0.160000 255 174 0 255 4\r\nalias _menu_refresh \"exec touch/buy_item_ct.cfg\"\r\n\r\nalias _menu_none \"touch_setcolor _menu_slot* 0 0 0 150; touch_hide _menu_frame_icn_class*; touch_hide _menu_frame_txt_data*; touch_hide _menu_frame_txt_desc*; touch_hide _menu_confirm*\"\r\n_menu_none\r\n\r\n//alias +menu_slot0 \"touch_setcolor _menu_slot0 255 174 0 150\"\r\n//alias -menu_slot0 \"touch_setcolor _menu_slot0 0 0 0 150\"\r\n//alias _menu_select_slot1 \"_menu_none; touch_setcolor _menu_slot1 255 174 0 150; touch_show _menu_frame_icn_class1; touch_show _menu_frame_txt_desc1; if $cscl_currentmoney>=0;:_menu_show_confirm ; alias _menu_confirmed joinclass 1\"\r\n\r\nalias +menu_slot0 \"_click; touch_setcolor _menu_slot0 255 174 0 150\"\r\nalias -menu_slot0 \"touch_setcolor _menu_slot0 0 0 0 150; _erase_frame\"\r\nif $buymenu_stayon >= 1;:alias -menu_slot0 \"touch_setcolor _menu_slot0 0 0 0 150; _erase_frame; buy\"\r\n\r\nalias _menu_confirmed \"\"\r\nalias _menu_show_confirm \"touch_show _menu_confirm*\"\r\n\r\nalias _menu_select_slot1 \"_click; _menu_none; touch_setcolor _menu_slot1 255 174 0 150; touch_show _menu_frame_icn_class1; touch_show _menu_frame_txt_data1; touch_show _menu_frame_txt_desc1; if $cscl_currentmoney >= $_menu_money_item1;:_menu_show_confirm ; alias _menu_confirmed vest\"\r\nalias _menu_select_slot2 \"_click; _menu_none; touch_setcolor _menu_slot2 255 174 0 150; touch_show _menu_frame_icn_class2; touch_show _menu_frame_txt_data1; touch_show _menu_frame_txt_desc2; if $cscl_currentmoney >= $_menu_money_item2;:_menu_show_confirm ; alias _menu_confirmed vesthelm\"\r\nalias _menu_select_slot3 \"_click; _menu_none; touch_setcolor _menu_slot3 255 174 0 150; touch_show _menu_frame_icn_class3; touch_show _menu_frame_txt_data1; touch_show _menu_frame_txt_desc3; if $cscl_currentmoney >= $_menu_money_item3;:_menu_show_confirm ; alias _menu_confirmed flash\"\r\nalias _menu_select_slot4 \"_click; _menu_none; touch_setcolor _menu_slot4 255 174 0 150; touch_show _menu_frame_icn_class4; touch_show _menu_frame_txt_data1; touch_show _menu_frame_txt_desc4; if $cscl_currentmoney >= $_menu_money_item4;:_menu_show_confirm ; alias _menu_confirmed hegren\"\r\nalias _menu_select_slot5 \"_click; _menu_none; touch_setcolor _menu_slot5 255 174 0 150; touch_show _menu_frame_icn_class5; touch_show _menu_frame_txt_data1; touch_show _menu_frame_txt_desc5; if $cscl_currentmoney >= $_menu_money_item5;:_menu_show_confirm ; alias _menu_confirmed sgren\"\r\nalias _menu_select_slot6 \"_click; _menu_none; touch_setcolor _menu_slot6 255 174 0 150; touch_show _menu_frame_icn_class6; touch_show _menu_frame_txt_data1; touch_show _menu_frame_txt_desc6; if $cscl_currentmoney >= $_menu_money_item6;:_menu_show_confirm ; alias _menu_confirmed defuser\"\r\nalias _menu_select_slot6_noconfirm \"_click; _menu_none; touch_setcolor _menu_slot6 255 174 0 150; touch_show _menu_frame_icn_class6; touch_show _menu_frame_txt_data1; touch_show _menu_frame_txt_desc6\"\r\nalias _menu_select_slot7 \"_click; _menu_none; touch_setcolor _menu_slot7 255 174 0 150; touch_show _menu_frame_icn_class7; touch_show _menu_frame_txt_data1; touch_show _menu_frame_txt_desc7; if $cscl_currentmoney >= $_menu_money_item7;:_menu_show_confirm ; alias _menu_confirmed nvgs\"\r\nalias _menu_select_slot8 \"_click; _menu_none; touch_setcolor _menu_slot8 255 174 0 150; touch_show _menu_frame_icn_class8; touch_show _menu_frame_txt_data1; touch_show _menu_frame_txt_desc8; if $cscl_currentmoney >= $_menu_money_item8;:_menu_show_confirm ; alias _menu_confirmed shield\"\r\n\r\nalias +menu_confirm \"_click; touch_setcolor _menu_confirm 255 174 0 150\"\r\nalias -menu_confirm \"touch_setcolor _menu_confirm 0 0 0 150; _menu_confirmed; wait; wait; _erase_frame\"\r\n"
  },
  {
    "path": "3rdparty/cs16client-extras/touch/buy_item_t.cfg",
    "content": "// Coded by Alprnn357\r\ntouch_setclientonly 1\r\ncmd_scripting 1\r\ntouch_set_stroke 1 255 174 0 150\r\n\r\nalias _erase_frame \"touch_removebutton _menu_*; _menu_off; slot10\"\r\nalias _menu_off \"touch_setclientonly 0\"\r\nalias _click \"play media/launch_select1.wav; vibrate 30\"\r\n\r\ntouch_addbutton \"_menu_bg_crn4\" \"gfx/vgui/round_corner_se.tga\" \"\" 0.880000 0.924444 0.900000 0.960000 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_crn2\" \"gfx/vgui/round_corner_ne.tga\" \"\" 0.880000 0.035556 0.900000 0.071111 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_crn1\" \"gfx/vgui/round_corner_nw.tga\" \"\" 0.100000 0.035556 0.120000 0.071111 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_crn3\" \"gfx/vgui/round_corner_sw.tga\" \"\" 0.100000 0.924444 0.120000 0.960000 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_top1\" \"*black\" \"\" 0.120000 0.035556 0.880000 0.071111 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_top2\" \"*black\" \"\" 0.100000 0.071111 0.900000 0.160000 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_bottom\" \"*black\" \"\" 0.120000 0.924444 0.880000 0.960000 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_body\" \"*black\" \"\" 0.100000 0.165000 0.900000 0.924444 0 0 0 150 6\r\nif $menu_bg_fill >= 1;:touch_removebutton _menu_bg_*;:touch_addbutton _menu_bg_body *black \"\" 0 0 1 1 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_icn_logo\" \"gfx/vgui/cs_logo.tga\" \"\" 0.110000 0.053333 0.160000 0.142222 255 174 0 255 6\r\ntouch_addbutton \"_menu_bg_txt_logo\" \"#BUY EQUIPMENT\" \"\" 0.170000 0.071111 0.890000 0.142222 255 174 0 255 6\r\n\r\n//touch_addbutton \"_menu_txt_title\" \"#THE TITLE\" \"\" 0.140000 0.177778 0.860000 0.213333 255 174 0 255 4\r\ntouch_addbutton \"_menu_slot1\" \"*white\" \"_menu_select_slot1\" 0.140000 0.213333 0.360000 0.266667 0 0 0 150 260\r\ntouch_addbutton \"_menu_txt_slot1\" \"#1 KEVLAR\" \"\" 0.150000 0.231111 0.360000 0.266667 255 174 0 255 4\r\ntouch_addbutton \"_menu_slot2\" \"*white\" \"_menu_select_slot2\" 0.140000 0.284444 0.360000 0.337778 0 0 0 150 260\r\ntouch_addbutton \"_menu_txt_slot2\" \"#2 KEVLAR+HELMET\" \"\" 0.150000 0.302222 0.360000 0.337778 255 174 0 255 4\r\ntouch_addbutton \"_menu_slot3\" \"*white\" \"_menu_select_slot3\" 0.140000 0.355556 0.360000 0.408889 0 0 0 150 260\r\ntouch_addbutton \"_menu_txt_slot3\" \"#3 FLASHBANG\" \"\" 0.150000 0.373333 0.360000 0.408889 255 174 0 255 4\r\ntouch_addbutton \"_menu_slot4\" \"*white\" \"_menu_select_slot4\" 0.140000 0.426667 0.360000 0.480000 0 0 0 150 260\r\ntouch_addbutton \"_menu_txt_slot4\" \"#4 HE GRENADE\" \"\" 0.150000 0.444444 0.360000 0.480000 255 174 0 255 4\r\ntouch_addbutton \"_menu_slot5\" \"*white\" \"_menu_select_slot5\" 0.140000 0.497778 0.360000 0.551111 0 0 0 150 260\r\ntouch_addbutton \"_menu_txt_slot5\" \"#5 SMOKE GRENADE\" \"\" 0.150000 0.515556 0.360000 0.551111 255 174 0 255 4\r\ntouch_addbutton \"_menu_slot6\" \"*white\" \"_menu_select_slot6\" 0.140000 0.568889 0.360000 0.622222 0 0 0 150 260\r\ntouch_addbutton \"_menu_txt_slot6\" \"#6 NIGHTVISION\" \"\" 0.150000 0.586667 0.360000 0.622222 255 174 0 255 4\r\n//touch_addbutton \"_menu_slot7\" \"*white\" \"\" 0.140000 0.640000 0.360000 0.693333 0 0 0 150 260\r\n//touch_addbutton \"_menu_txt_slot7\" \"#7 SLOT\" \"\" 0.150000 0.657778 0.360000 0.693333 255 174 0 255 4\r\n//touch_addbutton \"_menu_slot8\" \"*white\" \"\" 0.140000 0.711111 0.360000 0.764444 0 0 0 150 260\r\n//touch_addbutton \"_menu_txt_slot8\" \"#8 SLOT\" \"\" 0.150000 0.728889 0.360000 0.764444 255 174 0 255 4\r\n//touch_addbutton \"_menu_slot9\" \"*white\" \"\" 0.140000 0.782222 0.360000 0.835556 0 0 0 150 260\r\n//touch_addbutton \"_menu_txt_slot9\" \"#9 SLOT\" \"\" 0.150000 0.800000 0.360000 0.835556 255 174 0 255 4\r\ntouch_addbutton \"_menu_slot0\" \"*white\" \"+menu_slot0\" 0.14 0.871111 0.36 0.924444 0 0 0 150 260\r\ntouch_addbutton \"_menu_txt_slot0\" \"#0 CANCEL\" \"\" 0.15 0.888889 0.36 0.924444 255 174 0 255 4\r\n\r\nset _menu_money_item1 \"650\"; if $cscl_currentmoney < $_menu_money_item1;: touch_setcolor _menu_txt_slot1 129 85 0 255\r\nset _menu_money_item2 \"1000\"; if $cscl_currentmoney < $_menu_money_item2;: touch_setcolor _menu_txt_slot2 129 85 0 255\r\nset _menu_money_item3 \"200\"; if $cscl_currentmoney < $_menu_money_item3;: touch_setcolor _menu_txt_slot3 129 85 0 255\r\nset _menu_money_item4 \"300\"; if $cscl_currentmoney < $_menu_money_item4;: touch_setcolor _menu_txt_slot4 129 85 0 255\r\nset _menu_money_item5 \"300\"; if $cscl_currentmoney < $_menu_money_item5;: touch_setcolor _menu_txt_slot5 129 85 0 255\r\nset _menu_money_item6 \"1250\"; if $cscl_currentmoney < $_menu_money_item6;: touch_setcolor _menu_txt_slot6 129 85 0 255\r\n//set _menu_money_item7 \"\"; if $cscl_currentmoney < $_menu_money_item7;: touch_setcolor _menu_txt_slot7 129 85 0 255\r\n//set _menu_money_item8 \"\"; if $cscl_currentmoney < $_menu_money_item8;: touch_setcolor _menu_txt_slot8 129 85 0 255\r\n\r\ntouch_addbutton \"_menu_frame\" \"*white\" \"\" 0.390000 0.213333 0.840000 0.551111 0 0 0 150 260\r\ntouch_addbutton \"_menu_frame_icn_class1\" \"gfx/vgui/kevlar.tga\" \"\" 0.430000 0.215333 0.810000 0.549111 255 255 255 255 4\r\ntouch_addbutton \"_menu_frame_icn_class2\" \"gfx/vgui/kevlar_helmet.tga\" \"\" 0.430000 0.215333 0.810000 0.549111 255 255 255 255 4\r\ntouch_addbutton \"_menu_frame_icn_class3\" \"gfx/vgui/flashbang.tga\" \"\" 0.430000 0.215333 0.810000 0.549111 255 255 255 255 4\r\ntouch_addbutton \"_menu_frame_icn_class4\" \"gfx/vgui/hegrenade.tga\" \"\" 0.430000 0.215333 0.810000 0.549111 255 255 255 255 4\r\ntouch_addbutton \"_menu_frame_icn_class5\" \"gfx/vgui/smokegrenade.tga\" \"\" 0.430000 0.215333 0.810000 0.549111 255 255 255 255 4\r\ntouch_addbutton \"_menu_frame_icn_class6\" \"gfx/vgui/nightvision.tga\" \"\" 0.430000 0.215333 0.810000 0.549111 255 255 255 255 4\r\n//touch_addbutton \"_menu_frame_icn_class7\" \"\" \"\" 0.430000 0.215333 0.810000 0.549111 255 255 255 255 4\r\n//touch_addbutton \"_menu_frame_icn_class8\" \"\" \"\" 0.430000 0.215333 0.810000 0.549111 255 255 255 255 4\r\n\r\ntouch_addbutton \"_menu_confirm\" \"*white\" \"+menu_confirm\" 0.62 0.871111 0.84 0.924444 0 0 0 150 260\r\ntouch_addbutton \"_menu_confirm_txt\" \"#BUY THE ITEM\" \"\" 0.63 0.888889 0.84 0.924444 255 174 0 255 4\r\n\r\ntouch_addbutton \"_menu_frame_txt_data1\" \"#PRICE;DESCRIPTION\" \"\" 0.390000 0.551111 0.560000 0.853333 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_data2\" \"#TITLE;SUBTITLE\" \"\" 0.390000 0.551111 0.560000 0.853333 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc1\" \"#: \\$$_menu_money_item1;: A Kevlar vest that protects ; against projectiles\" \"\" 0.560000 0.551111 0.840000 0.853333 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc2\" \"#: \\$$_menu_money_item2;: A kevlar vest and a ballistic ; helmet which both protect ; against projectiles.\" \"\" 0.560000 0.551111 0.840000 0.853333 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc3\" \"#: \\$$_menu_money_item3;: Makes a loud noise and ; blinding flash when thrown ; at enemy (pull pin first). ; Useful for causing distractions ; before entering an area.\" \"\" 0.560000 0.551111 0.840000 0.853333 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc4\" \"#: \\$$_menu_money_item4;: A high-explosive device. Pull ; the pin, release the spoon ; and throw.\" \"\" 0.560000 0.551111 0.840000 0.853333 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc5\" \"#: \\$$_menu_money_item5;: A diversionary device that ; can be used to provide ; temporary cover for moving ; from place to place.\" \"\" 0.560000 0.551111 0.840000 0.853333 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc6\" \"#: \\$$_menu_money_item6;: Nightvision goggles which ; allow the user to see more ; effectively in dark areas.\" \"\" 0.560000 0.551111 0.840000 0.853333 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc7\" \"\" \"\" 0.560000 0.551111 0.840000 0.853333 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc8\" \"\" \"\" 0.560000 0.551111 0.840000 0.853333 240 180 24 255 4\r\n\r\ntouch_addbutton \"_menu_txt_money\" \"#YOU HAVE \\$$cscl_currentmoney\" \"_menu_refresh\" 0.170000 0.106667 0.890000 0.160000 255 174 0 255 4\r\nalias _menu_refresh \"exec touch/buy_item_t.cfg\"\r\n\r\nalias _menu_none \"touch_setcolor _menu_slot* 0 0 0 150; touch_hide _menu_frame_icn_class*; touch_hide _menu_frame_txt_data*; touch_hide _menu_frame_txt_desc*; touch_hide _menu_confirm*\"\r\n_menu_none\r\n\r\n//alias +menu_slot0 \"touch_setcolor _menu_slot0 255 174 0 150\"\r\n//alias -menu_slot0 \"touch_setcolor _menu_slot0 0 0 0 150\"\r\n//alias _menu_select_slot1 \"_menu_none; touch_setcolor _menu_slot1 255 174 0 150; touch_show _menu_frame_icn_class1; touch_show _menu_frame_txt_desc1; if $cscl_currentmoney>=0;:_menu_show_confirm ; alias _menu_confirmed joinclass 1\"\r\n\r\nalias +menu_slot0 \"_click; touch_setcolor _menu_slot0 255 174 0 150\"\r\nalias -menu_slot0 \"touch_setcolor _menu_slot0 0 0 0 150; _erase_frame\"\r\nif $buymenu_stayon >= 1;:alias -menu_slot0 \"touch_setcolor _menu_slot0 0 0 0 150; _erase_frame; buy\"\r\n\r\nalias _menu_confirmed \"\"\r\nalias _menu_show_confirm \"touch_show _menu_confirm*\"\r\n\r\nalias _menu_select_slot1 \"_click; _menu_none; touch_setcolor _menu_slot1 255 174 0 150; touch_show _menu_frame_icn_class1; touch_show _menu_frame_txt_data1; touch_show _menu_frame_txt_desc1; if $cscl_currentmoney >= $_menu_money_item1;:_menu_show_confirm ; alias _menu_confirmed vest\"\r\nalias _menu_select_slot2 \"_click; _menu_none; touch_setcolor _menu_slot2 255 174 0 150; touch_show _menu_frame_icn_class2; touch_show _menu_frame_txt_data1; touch_show _menu_frame_txt_desc2; if $cscl_currentmoney >= $_menu_money_item2;:_menu_show_confirm ; alias _menu_confirmed vesthelm\"\r\nalias _menu_select_slot3 \"_click; _menu_none; touch_setcolor _menu_slot3 255 174 0 150; touch_show _menu_frame_icn_class3; touch_show _menu_frame_txt_data1; touch_show _menu_frame_txt_desc3; if $cscl_currentmoney >= $_menu_money_item3;:_menu_show_confirm ; alias _menu_confirmed flash\"\r\nalias _menu_select_slot4 \"_click; _menu_none; touch_setcolor _menu_slot4 255 174 0 150; touch_show _menu_frame_icn_class4; touch_show _menu_frame_txt_data1; touch_show _menu_frame_txt_desc4; if $cscl_currentmoney >= $_menu_money_item4;:_menu_show_confirm ; alias _menu_confirmed hegren\"\r\nalias _menu_select_slot5 \"_click; _menu_none; touch_setcolor _menu_slot5 255 174 0 150; touch_show _menu_frame_icn_class5; touch_show _menu_frame_txt_data1; touch_show _menu_frame_txt_desc5; if $cscl_currentmoney >= $_menu_money_item5;:_menu_show_confirm ; alias _menu_confirmed sgren\"\r\nalias _menu_select_slot6 \"_click; _menu_none; touch_setcolor _menu_slot6 255 174 0 150; touch_show _menu_frame_icn_class6; touch_show _menu_frame_txt_data1; touch_show _menu_frame_txt_desc6; if $cscl_currentmoney >= $_menu_money_item6;:_menu_show_confirm ; alias _menu_confirmed nvgs\"\r\n//alias _menu_select_slot7 \"_click; _menu_none; touch_setcolor _menu_slot7 255 174 0 150; touch_show _menu_frame_icn_class7; touch_show _menu_frame_txt_data1; touch_show _menu_frame_txt_desc7; if $cscl_currentmoney >= $_menu_money_item7;:_menu_show_confirm ; alias _menu_confirmed \"\r\n//alias _menu_select_slot8 \"_click; _menu_none; touch_setcolor _menu_slot8 255 174 0 150; touch_show _menu_frame_icn_class8; touch_show _menu_frame_txt_data1; touch_show _menu_frame_txt_desc8; if $cscl_currentmoney >= $_menu_money_item8;:_menu_show_confirm ; alias _menu_confirmed \"\r\n\r\nalias +menu_confirm \"_click; touch_setcolor _menu_confirm 255 174 0 150\"\r\nalias -menu_confirm \"touch_setcolor _menu_confirm 0 0 0 150; _menu_confirmed; wait; wait; _erase_frame\"\r\n"
  },
  {
    "path": "3rdparty/cs16client-extras/touch/buy_machinegun_ct.cfg",
    "content": "// Coded by Alprnn357\r\ntouch_setclientonly 1\r\ncmd_scripting 1\r\ntouch_set_stroke 1 255 174 0 150\r\n\r\nalias _erase_frame \"touch_removebutton _menu_*; _menu_off; slot10\"\r\nalias _menu_off \"touch_setclientonly 0\"\r\nalias _click \"play media/launch_select1.wav; vibrate 30\"\r\n\r\ntouch_addbutton \"_menu_bg_crn4\" \"gfx/vgui/round_corner_se.tga\" \"\" 0.880000 0.924444 0.900000 0.960000 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_crn2\" \"gfx/vgui/round_corner_ne.tga\" \"\" 0.880000 0.035556 0.900000 0.071111 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_crn1\" \"gfx/vgui/round_corner_nw.tga\" \"\" 0.100000 0.035556 0.120000 0.071111 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_crn3\" \"gfx/vgui/round_corner_sw.tga\" \"\" 0.100000 0.924444 0.120000 0.960000 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_top1\" \"*black\" \"\" 0.120000 0.035556 0.880000 0.071111 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_top2\" \"*black\" \"\" 0.100000 0.071111 0.900000 0.160000 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_bottom\" \"*black\" \"\" 0.120000 0.924444 0.880000 0.960000 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_body\" \"*black\" \"\" 0.100000 0.165000 0.900000 0.924444 0 0 0 150 6\r\nif $menu_bg_fill >= 1;:touch_removebutton _menu_bg_*;:touch_addbutton _menu_bg_body *black \"\" 0 0 1 1 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_icn_logo\" \"gfx/vgui/cs_logo.tga\" \"\" 0.110000 0.053333 0.160000 0.142222 255 174 0 255 6\r\ntouch_addbutton \"_menu_bg_txt_logo\" \"#BUY MACHINE GUNS (PRIMARY WEAPON)\" \"\" 0.170000 0.071111 0.890000 0.142222 255 174 0 255 6\r\n\r\n//touch_addbutton \"_menu_txt_title\" \"#THE TITLE\" \"\" 0.140000 0.177778 0.860000 0.213333 255 174 0 255 4\r\ntouch_addbutton \"_menu_slot1\" \"*white\" \"_menu_select_slot1\" 0.140000 0.213333 0.360000 0.266667 0 0 0 150 260\r\ntouch_addbutton \"_menu_txt_slot1\" \"#1 M249\" \"\" 0.150000 0.231111 0.360000 0.266667 255 174 0 255 4\r\n//touch_addbutton \"_menu_slot2\" \"*white\" \"_menu_select_slot2\" 0.140000 0.284444 0.360000 0.337778 0 0 0 150 260\r\n//touch_addbutton \"_menu_txt_slot2\" \"#2 SLOT\" \"\" 0.150000 0.302222 0.360000 0.337778 255 174 0 255 4\r\n//touch_addbutton \"_menu_slot3\" \"*white\" \"_menu_select_slot3\" 0.140000 0.355556 0.360000 0.408889 0 0 0 150 260\r\n//touch_addbutton \"_menu_txt_slot3\" \"#3 SLOT\" \"\" 0.150000 0.373333 0.360000 0.408889 255 174 0 255 4\r\n//touch_addbutton \"_menu_slot4\" \"*white\" \"_menu_select_slot4\" 0.140000 0.426667 0.360000 0.480000 0 0 0 150 260\r\n//touch_addbutton \"_menu_txt_slot4\" \"#4 SLOT\" \"\" 0.150000 0.444444 0.360000 0.480000 255 174 0 255 4\r\n//touch_addbutton \"_menu_slot5\" \"*white\" \"_menu_select_slot5\" 0.140000 0.497778 0.360000 0.551111 0 0 0 150 260\r\n//touch_addbutton \"_menu_txt_slot5\" \"#5 SLOT\" \"\" 0.150000 0.515556 0.360000 0.551111 255 174 0 255 4\r\n//touch_addbutton \"_menu_slot6\" \"*white\" \"_menu_select_slot6\" 0.140000 0.568889 0.360000 0.622222 0 0 0 150 260\r\n//touch_addbutton \"_menu_txt_slot6\" \"#6 SLOT\" \"\" 0.150000 0.586667 0.360000 0.622222 255 174 0 255 4\r\n//touch_addbutton \"_menu_slot7\" \"*white\" \"_menu_select_slot7\" 0.140000 0.640000 0.360000 0.693333 0 0 0 150 260\r\n//touch_addbutton \"_menu_txt_slot7\" \"#7 SLOT\" \"\" 0.150000 0.657778 0.360000 0.693333 255 174 0 255 4\r\n//touch_addbutton \"_menu_slot8\" \"*white\" \"_menu_select_slot8\" 0.140000 0.711111 0.360000 0.764444 0 0 0 150 260\r\n//touch_addbutton \"_menu_txt_slot8\" \"#8 SLOT\" \"\" 0.150000 0.728889 0.360000 0.764444 255 174 0 255 4\r\n//touch_addbutton \"_menu_slot9\" \"*white\" \"\" 0.140000 0.782222 0.360000 0.835556 0 0 0 150 260\r\n//touch_addbutton \"_menu_txt_slot9\" \"#9 SLOT\" \"\" 0.150000 0.800000 0.360000 0.835556 255 174 0 255 4\r\ntouch_addbutton \"_menu_slot0\" \"*white\" \"+menu_slot0\" 0.14 0.871111 0.36 0.924444 0 0 0 150 260\r\ntouch_addbutton \"_menu_txt_slot0\" \"#0 CANCEL\" \"\" 0.15 0.888889 0.36 0.924444 255 174 0 255 4\r\n\r\nset _menu_money_item1 \"5750\"; if $cscl_currentmoney < $_menu_money_item1;: touch_setcolor _menu_txt_slot1 129 85 0 255\r\n//set _menu_money_item2 \"\"; if $cscl_currentmoney < $_menu_money_item2;: touch_setcolor _menu_txt_slot2 129 85 0 255\r\n//set _menu_money_item3 \"\"; if $cscl_currentmoney < $_menu_money_item3;: touch_setcolor _menu_txt_slot3 129 85 0 255\r\n//set _menu_money_item4 \"\"; if $cscl_currentmoney < $_menu_money_item4;: touch_setcolor _menu_txt_slot4 129 85 0 255\r\n//set _menu_money_item5 \"\"; if $cscl_currentmoney < $_menu_money_item5;: touch_setcolor _menu_txt_slot5 129 85 0 255\r\n//set _menu_money_item6 \"\"; if $cscl_currentmoney < $_menu_money_item6;: touch_setcolor _menu_txt_slot6 129 85 0 255\r\n//set _menu_money_item7 \"\"; if $cscl_currentmoney < $_menu_money_item7;: touch_setcolor _menu_txt_slot7 129 85 0 255\r\n//set _menu_money_item8 \"\"; if $cscl_currentmoney < $_menu_money_item8;: touch_setcolor _menu_txt_slot8 129 85 0 255\r\n\r\ntouch_addbutton \"_menu_frame\" \"*white\" \"\" 0.390000 0.213333 0.840000 0.551111 0 0 0 150 260\r\ntouch_addbutton \"_menu_frame_icn_class1\" \"gfx/vgui/m249.tga\" \"\" 0.430000 0.215333 0.810000 0.549111 255 255 255 255 4\r\n//touch_addbutton \"_menu_frame_icn_class2\" \"\" \"\" 0.430000 0.215333 0.810000 0.549111 255 255 255 255 4\r\n//touch_addbutton \"_menu_frame_icn_class3\" \"\" \"\" 0.430000 0.215333 0.810000 0.549111 255 255 255 255 4\r\n//touch_addbutton \"_menu_frame_icn_class4\" \"\" \"\" 0.430000 0.215333 0.810000 0.549111 255 255 255 255 4\r\n//touch_addbutton \"_menu_frame_icn_class5\" \"\" \"\" 0.430000 0.215333 0.810000 0.549111 255 255 255 255 4\r\n//touch_addbutton \"_menu_frame_icn_class6\" \"\" \"\" 0.430000 0.215333 0.810000 0.549111 255 255 255 255 4\r\n//touch_addbutton \"_menu_frame_icn_class7\" \"\" \"\" 0.430000 0.215333 0.810000 0.549111 255 255 255 255 4\r\n//touch_addbutton \"_menu_frame_icn_class8\" \"\" \"\" 0.430000 0.215333 0.810000 0.549111 255 255 255 255 4\r\n\r\ntouch_addbutton \"_menu_confirm\" \"*white\" \"+menu_confirm\" 0.62 0.871111 0.84 0.924444 0 0 0 150 260\r\ntouch_addbutton \"_menu_confirm_txt\" \"#BUY THE ITEM\" \"\" 0.63 0.888889 0.84 0.924444 255 174 0 255 4\r\n\r\ntouch_addbutton \"_menu_frame_txt_data1_1\" \"#PRICE\" \"\" 0.39 0.551111 0.56 0.586667 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data1_2\" \"#COUNTRY OF ORIGIN\" \"\" 0.39 0.586667 0.56 0.622222 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data1_3\" \"#CALIBER\" \"\" 0.39 0.622222 0.56 0.657778 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data1_4\" \"#CLIP CAPACITY\" \"\" 0.39 0.657778 0.56 0.693333 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data1_5\" \"#RATE OF FIRE\" \"\" 0.39 0.693333 0.56 0.728889 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data1_6\" \"#WEIGHT (LOADED)\" \"\" 0.39 0.728889 0.56 0.764444 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data1_7\" \"#PROJECTILE WEIGHT\" \"\" 0.39 0.764444 0.56 0.8 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data1_8\" \"#MUZZLE VELOCITY\" \"\" 0.39 0.8 0.56 0.835556 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data1_9\" \"#MUZZLE ENERGY\" \"\" 0.39 0.835556 0.56 0.871111 240 180 24 255 4\r\n\r\ntouch_addbutton \"_menu_frame_txt_data2_1\" \"#PRICE\" \"\" 0.39 0.551111 0.56 0.586667 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data2_2\" \"#COUNTRY OF ORIGIN\" \"\" 0.39 0.586667 0.56 0.622222 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data2_3\" \"#CALIBER\" \"\" 0.39 0.622222 0.56 0.657778 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data2_4\" \"#CLIP CAPACITY\" \"\" 0.39 0.657778 0.56 0.693333 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data2_5\" \"#RATE OF FIRE\" \"\" 0.39 0.693333 0.56 0.728889 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data2_6\" \"#WEIGHT (EMPTY)\" \"\" 0.39 0.728889 0.56 0.764444 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data2_7\" \"#PROJECTILE WEIGHT\" \"\" 0.39 0.764444 0.56 0.8 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data2_8\" \"#MUZZLE VELOCITY\" \"\" 0.39 0.8 0.56 0.835556 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data2_9\" \"#MUZZLE ENERGY\" \"\" 0.39 0.835556 0.56 0.871111 240 180 24 255 4\r\n\r\ntouch_addbutton \"_menu_frame_txt_desc1_1\" \"#: \\$$_menu_money_item1\" \"\" 0.56 0.551111 0.84 0.586667 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc1_2\" \"#: BELGIUM\" \"\" 0.56 0.586667 0.84 0.622222 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc1_3\" \"#: 5.56 PARABELLUM\" \"\" 0.56 0.622222 0.84 0.657778 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc1_4\" \"#: 100 ROUNDS\" \"\" 0.56 0.657778 0.84 0.693333 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc1_5\" \"#: 600 RPM\" \"\" 0.56 0.693333 0.84 0.728889 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc1_6\" \"#: 6KG\" \"\" 0.56 0.728889 0.84 0.764444 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc1_7\" \"#: 4 GRAMS\" \"\" 0.56 0.764444 0.84 0.8 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc1_8\" \"#: 3000 FEET/SECOND\" \"\" 0.56 0.8 0.84 0.835556 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc1_9\" \"#: 1600 JOULES\" \"\" 0.56 0.835556 0.84 0.871111 240 180 24 255 4\r\n\r\ntouch_addbutton \"_menu_frame_txt_desc2_1\" \"#: \" \"\" 0.56 0.551111 0.84 0.586667 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc2_2\" \"#: \" \"\" 0.56 0.586667 0.84 0.622222 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc2_3\" \"#: \" \"\" 0.56 0.622222 0.84 0.657778 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc2_4\" \"#: \" \"\" 0.56 0.657778 0.84 0.693333 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc2_5\" \"#: \" \"\" 0.56 0.693333 0.84 0.728889 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc2_6\" \"#: \" \"\" 0.56 0.728889 0.84 0.764444 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc2_7\" \"#: \" \"\" 0.56 0.764444 0.84 0.8 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc2_8\" \"#: \" \"\" 0.56 0.8 0.84 0.835556 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc2_9\" \"#: \" \"\" 0.56 0.835556 0.84 0.871111 240 180 24 255 4\r\n\r\n//touch_addbutton \"_menu_frame_txt_desc3_1\" \"#: \" \"\" 0.56 0.551111 0.84 0.586667 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc3_2\" \"#: \" \"\" 0.56 0.586667 0.84 0.622222 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc3_3\" \"#: \" \"\" 0.56 0.622222 0.84 0.657778 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc3_4\" \"#: \" \"\" 0.56 0.657778 0.84 0.693333 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc3_5\" \"#: \" \"\" 0.56 0.693333 0.84 0.728889 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc3_6\" \"#: \" \"\" 0.56 0.728889 0.84 0.764444 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc3_7\" \"#: \" \"\" 0.56 0.764444 0.84 0.8 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc3_8\" \"#: \" \"\" 0.56 0.8 0.84 0.835556 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc3_9\" \"#: \" \"\" 0.56 0.835556 0.84 0.871111 240 180 24 255 4\r\n\r\n//touch_addbutton \"_menu_frame_txt_desc4_1\" \"#: \" \"\" 0.56 0.551111 0.84 0.586667 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc4_2\" \"#: \" \"\" 0.56 0.586667 0.84 0.622222 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc4_3\" \"#: \" \"\" 0.56 0.622222 0.84 0.657778 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc4_4\" \"#: \" \"\" 0.56 0.657778 0.84 0.693333 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc4_5\" \"#: \" \"\" 0.56 0.693333 0.84 0.728889 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc4_6\" \"#: \" \"\" 0.56 0.728889 0.84 0.764444 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc4_7\" \"#: \" \"\" 0.56 0.764444 0.84 0.8 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc4_8\" \"#: \" \"\" 0.56 0.8 0.84 0.835556 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc4_9\" \"#: \" \"\" 0.56 0.835556 0.84 0.871111 240 180 24 255 4\r\n\r\n//touch_addbutton \"_menu_frame_txt_desc5_1\" \"#: \" \"\" 0.56 0.551111 0.84 0.586667 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc5_2\" \"#: \" \"\" 0.56 0.586667 0.84 0.622222 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc5_3\" \"#: \" \"\" 0.56 0.622222 0.84 0.657778 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc5_4\" \"#: \" \"\" 0.56 0.657778 0.84 0.693333 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc5_5\" \"#: \" \"\" 0.56 0.693333 0.84 0.728889 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc5_6\" \"#: \" \"\" 0.56 0.728889 0.84 0.764444 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc5_7\" \"#: \" \"\" 0.56 0.764444 0.84 0.8 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc5_8\" \"#: \" \"\" 0.56 0.8 0.84 0.835556 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc5_9\" \"#: \" \"\" 0.56 0.835556 0.84 0.871111 240 180 24 255 4\r\n\r\n//touch_addbutton \"_menu_frame_txt_desc6_1\" \"#: \" \"\" 0.56 0.551111 0.84 0.586667 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc6_2\" \"#: \" \"\" 0.56 0.586667 0.84 0.622222 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc6_3\" \"#: \" \"\" 0.56 0.622222 0.84 0.657778 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc6_4\" \"#: \" \"\" 0.56 0.657778 0.84 0.693333 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc6_5\" \"#: \" \"\" 0.56 0.693333 0.84 0.728889 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc6_6\" \"#: \" \"\" 0.56 0.728889 0.84 0.764444 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc6_7\" \"#: \" \"\" 0.56 0.764444 0.84 0.8 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc6_8\" \"#: \" \"\" 0.56 0.8 0.84 0.835556 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc6_9\" \"#: \" \"\" 0.56 0.835556 0.84 0.871111 240 180 24 255 4\r\n\r\n//touch_addbutton \"_menu_frame_txt_desc7_1\" \"#: \" \"\" 0.56 0.551111 0.84 0.586667 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc7_2\" \"#: \" \"\" 0.56 0.586667 0.84 0.622222 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc7_3\" \"#: \" \"\" 0.56 0.622222 0.84 0.657778 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc7_4\" \"#: \" \"\" 0.56 0.657778 0.84 0.693333 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc7_5\" \"#: \" \"\" 0.56 0.693333 0.84 0.728889 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc7_6\" \"#: \" \"\" 0.56 0.728889 0.84 0.764444 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc7_7\" \"#: \" \"\" 0.56 0.764444 0.84 0.8 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc7_8\" \"#: \" \"\" 0.56 0.8 0.84 0.835556 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc7_9\" \"#: \" \"\" 0.56 0.835556 0.84 0.871111 240 180 24 255 4\r\n\r\n//touch_addbutton \"_menu_frame_txt_desc8_1\" \"#: \" \"\" 0.56 0.551111 0.84 0.586667 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc8_2\" \"#: \" \"\" 0.56 0.586667 0.84 0.622222 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc8_3\" \"#: \" \"\" 0.56 0.622222 0.84 0.657778 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc8_4\" \"#: \" \"\" 0.56 0.657778 0.84 0.693333 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc8_5\" \"#: \" \"\" 0.56 0.693333 0.84 0.728889 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc8_6\" \"#: \" \"\" 0.56 0.728889 0.84 0.764444 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc8_7\" \"#: \" \"\" 0.56 0.764444 0.84 0.8 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc8_8\" \"#: \" \"\" 0.56 0.8 0.84 0.835556 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc8_9\" \"#: \" \"\" 0.56 0.835556 0.84 0.871111 240 180 24 255 4\r\n\r\ntouch_addbutton \"_menu_txt_money\" \"#YOU HAVE \\$$cscl_currentmoney\" \"_menu_refresh\" 0.170000 0.106667 0.890000 0.160000 255 174 0 255 4\r\nalias _menu_refresh \"exec touch/buy_machinegun_ct.cfg\"\r\n\r\nalias _menu_none \"touch_setcolor _menu_slot* 0 0 0 150; touch_hide _menu_frame_icn_class*; touch_hide _menu_frame_txt_data*; touch_hide _menu_frame_txt_desc*; touch_hide _menu_confirm*\"\r\n_menu_none\r\n\r\n//alias +menu_slot0 \"touch_setcolor _menu_slot0 255 174 0 150\"\r\n//alias -menu_slot0 \"touch_setcolor _menu_slot0 0 0 0 150\"\r\n//alias _menu_select_slot1 \"_menu_none; touch_setcolor _menu_slot1 255 174 0 150; touch_show _menu_frame_icn_class1; touch_show _menu_frame_txt_desc1; if $cscl_currentmoney>=0;:_menu_show_confirm ; alias _menu_confirmed joinclass 1\"\r\n\r\nalias +menu_slot0 \"_click; touch_setcolor _menu_slot0 255 174 0 150\"\r\nalias -menu_slot0 \"touch_setcolor _menu_slot0 0 0 0 150; _erase_frame\"\r\nif $buymenu_stayon >= 1;:alias -menu_slot0 \"touch_setcolor _menu_slot0 0 0 0 150; _erase_frame; buy\"\r\n\r\nalias _menu_confirmed \"\"\r\nalias _menu_show_confirm \"touch_show _menu_confirm*\"\r\n\r\nalias _menu_select_slot1 \"_click; _menu_none; touch_setcolor _menu_slot1 255 174 0 150; touch_show _menu_frame_icn_class1; touch_show _menu_frame_txt_data1_*; touch_show _menu_frame_txt_desc1_*; if $cscl_currentmoney >= $_menu_money_item1;:_menu_show_confirm ; alias _menu_confirmed m249\"\r\n//alias _menu_select_slot2 \"_click; _menu_none; touch_setcolor _menu_slot2 255 174 0 150; touch_show _menu_frame_icn_class2; touch_show _menu_frame_txt_data2_*; touch_show _menu_frame_txt_desc2_*; if $cscl_currentmoney >= $_menu_money_item2;:_menu_show_confirm ; alias _menu_confirmed \"\r\n//alias _menu_select_slot3 \"_click; _menu_none; touch_setcolor _menu_slot3 255 174 0 150; touch_show _menu_frame_icn_class3; touch_show _menu_frame_txt_data1_*; touch_show _menu_frame_txt_desc3_*; if $cscl_currentmoney >= $_menu_money_item3;:_menu_show_confirm ; alias _menu_confirmed \"\r\n//alias _menu_select_slot4 \"_click; _menu_none; touch_setcolor _menu_slot4 255 174 0 150; touch_show _menu_frame_icn_class4; touch_show _menu_frame_txt_data1_*; touch_show _menu_frame_txt_desc4_*; if $cscl_currentmoney >= $_menu_money_item4;:_menu_show_confirm ; alias _menu_confirmed \"\r\n//alias _menu_select_slot5 \"_click; _menu_none; touch_setcolor _menu_slot5 255 174 0 150; touch_show _menu_frame_icn_class5; touch_show _menu_frame_txt_data1_*; touch_show _menu_frame_txt_desc5_*; if $cscl_currentmoney >= $_menu_money_item5;:_menu_show_confirm ; alias _menu_confirmed \"\r\n//alias _menu_select_slot6 \"_click; _menu_none; touch_setcolor _menu_slot6 255 174 0 150; touch_show _menu_frame_icn_class6; touch_show _menu_frame_txt_data1_*; touch_show _menu_frame_txt_desc6_*; if $cscl_currentmoney >= $_menu_money_item6;:_menu_show_confirm ; alias _menu_confirmed \"\r\n//alias _menu_select_slot7 \"_click; _menu_none; touch_setcolor _menu_slot7 255 174 0 150; touch_show _menu_frame_icn_class7; touch_show _menu_frame_txt_data1_*; touch_show _menu_frame_txt_desc7_*; if $cscl_currentmoney >= $_menu_money_item7;:_menu_show_confirm ; alias _menu_confirmed \"\r\n//alias _menu_select_slot8 \"_click; _menu_none; touch_setcolor _menu_slot8 255 174 0 150; touch_show _menu_frame_icn_class8; touch_show _menu_frame_txt_data1_*; touch_show _menu_frame_txt_desc8_*; if $cscl_currentmoney >= $_menu_money_item8;:_menu_show_confirm ; alias _menu_confirmed \"\r\n\r\nalias +menu_confirm \"_click; touch_setcolor _menu_confirm 255 174 0 150\"\r\nalias -menu_confirm \"touch_setcolor _menu_confirm 0 0 0 150; _menu_confirmed; wait; wait; _erase_frame\"\r\n"
  },
  {
    "path": "3rdparty/cs16client-extras/touch/buy_machinegun_t.cfg",
    "content": "// Coded by Alprnn357\r\ntouch_setclientonly 1\r\ncmd_scripting 1\r\ntouch_set_stroke 1 255 174 0 150\r\n\r\nalias _erase_frame \"touch_removebutton _menu_*; _menu_off; slot10\"\r\nalias _menu_off \"touch_setclientonly 0\"\r\nalias _click \"play media/launch_select1.wav; vibrate 30\"\r\n\r\ntouch_addbutton \"_menu_bg_crn4\" \"gfx/vgui/round_corner_se.tga\" \"\" 0.880000 0.924444 0.900000 0.960000 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_crn2\" \"gfx/vgui/round_corner_ne.tga\" \"\" 0.880000 0.035556 0.900000 0.071111 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_crn1\" \"gfx/vgui/round_corner_nw.tga\" \"\" 0.100000 0.035556 0.120000 0.071111 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_crn3\" \"gfx/vgui/round_corner_sw.tga\" \"\" 0.100000 0.924444 0.120000 0.960000 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_top1\" \"*black\" \"\" 0.120000 0.035556 0.880000 0.071111 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_top2\" \"*black\" \"\" 0.100000 0.071111 0.900000 0.160000 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_bottom\" \"*black\" \"\" 0.120000 0.924444 0.880000 0.960000 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_body\" \"*black\" \"\" 0.100000 0.165000 0.900000 0.924444 0 0 0 150 6\r\nif $menu_bg_fill >= 1;:touch_removebutton _menu_bg_*;:touch_addbutton _menu_bg_body *black \"\" 0 0 1 1 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_icn_logo\" \"gfx/vgui/cs_logo.tga\" \"\" 0.110000 0.053333 0.160000 0.142222 255 174 0 255 6\r\ntouch_addbutton \"_menu_bg_txt_logo\" \"#BUY MACHINE GUNS (PRIMARY WEAPON)\" \"\" 0.170000 0.071111 0.890000 0.142222 255 174 0 255 6\r\n\r\n//touch_addbutton \"_menu_txt_title\" \"#THE TITLE\" \"\" 0.140000 0.177778 0.860000 0.213333 255 174 0 255 4\r\ntouch_addbutton \"_menu_slot1\" \"*white\" \"_menu_select_slot1\" 0.140000 0.213333 0.360000 0.266667 0 0 0 150 260\r\ntouch_addbutton \"_menu_txt_slot1\" \"#1 M249\" \"\" 0.150000 0.231111 0.360000 0.266667 255 174 0 255 4\r\n//touch_addbutton \"_menu_slot2\" \"*white\" \"_menu_select_slot2\" 0.140000 0.284444 0.360000 0.337778 0 0 0 150 260\r\n//touch_addbutton \"_menu_txt_slot2\" \"#2 SLOT\" \"\" 0.150000 0.302222 0.360000 0.337778 255 174 0 255 4\r\n//touch_addbutton \"_menu_slot3\" \"*white\" \"_menu_select_slot3\" 0.140000 0.355556 0.360000 0.408889 0 0 0 150 260\r\n//touch_addbutton \"_menu_txt_slot3\" \"#3 SLOT\" \"\" 0.150000 0.373333 0.360000 0.408889 255 174 0 255 4\r\n//touch_addbutton \"_menu_slot4\" \"*white\" \"_menu_select_slot4\" 0.140000 0.426667 0.360000 0.480000 0 0 0 150 260\r\n//touch_addbutton \"_menu_txt_slot4\" \"#4 SLOT\" \"\" 0.150000 0.444444 0.360000 0.480000 255 174 0 255 4\r\n//touch_addbutton \"_menu_slot5\" \"*white\" \"_menu_select_slot5\" 0.140000 0.497778 0.360000 0.551111 0 0 0 150 260\r\n//touch_addbutton \"_menu_txt_slot5\" \"#5 SLOT\" \"\" 0.150000 0.515556 0.360000 0.551111 255 174 0 255 4\r\n//touch_addbutton \"_menu_slot6\" \"*white\" \"_menu_select_slot6\" 0.140000 0.568889 0.360000 0.622222 0 0 0 150 260\r\n//touch_addbutton \"_menu_txt_slot6\" \"#6 SLOT\" \"\" 0.150000 0.586667 0.360000 0.622222 255 174 0 255 4\r\n//touch_addbutton \"_menu_slot7\" \"*white\" \"_menu_select_slot7\" 0.140000 0.640000 0.360000 0.693333 0 0 0 150 260\r\n//touch_addbutton \"_menu_txt_slot7\" \"#7 SLOT\" \"\" 0.150000 0.657778 0.360000 0.693333 255 174 0 255 4\r\n//touch_addbutton \"_menu_slot8\" \"*white\" \"_menu_select_slot8\" 0.140000 0.711111 0.360000 0.764444 0 0 0 150 260\r\n//touch_addbutton \"_menu_txt_slot8\" \"#8 SLOT\" \"\" 0.150000 0.728889 0.360000 0.764444 255 174 0 255 4\r\n//touch_addbutton \"_menu_slot9\" \"*white\" \"\" 0.140000 0.782222 0.360000 0.835556 0 0 0 150 260\r\n//touch_addbutton \"_menu_txt_slot9\" \"#9 SLOT\" \"\" 0.150000 0.800000 0.360000 0.835556 255 174 0 255 4\r\ntouch_addbutton \"_menu_slot0\" \"*white\" \"+menu_slot0\" 0.14 0.871111 0.36 0.924444 0 0 0 150 260\r\ntouch_addbutton \"_menu_txt_slot0\" \"#0 CANCEL\" \"\" 0.15 0.888889 0.36 0.924444 255 174 0 255 4\r\n\r\nset _menu_money_item1 \"5750\"; if $cscl_currentmoney < $_menu_money_item1;: touch_setcolor _menu_txt_slot1 129 85 0 255\r\n//set _menu_money_item2 \"\"; if $cscl_currentmoney < $_menu_money_item2;: touch_setcolor _menu_txt_slot2 129 85 0 255\r\n//set _menu_money_item3 \"\"; if $cscl_currentmoney < $_menu_money_item3;: touch_setcolor _menu_txt_slot3 129 85 0 255\r\n//set _menu_money_item4 \"\"; if $cscl_currentmoney < $_menu_money_item4;: touch_setcolor _menu_txt_slot4 129 85 0 255\r\n//set _menu_money_item5 \"\"; if $cscl_currentmoney < $_menu_money_item5;: touch_setcolor _menu_txt_slot5 129 85 0 255\r\n//set _menu_money_item6 \"\"; if $cscl_currentmoney < $_menu_money_item6;: touch_setcolor _menu_txt_slot6 129 85 0 255\r\n//set _menu_money_item7 \"\"; if $cscl_currentmoney < $_menu_money_item7;: touch_setcolor _menu_txt_slot7 129 85 0 255\r\n//set _menu_money_item8 \"\"; if $cscl_currentmoney < $_menu_money_item8;: touch_setcolor _menu_txt_slot8 129 85 0 255\r\n\r\ntouch_addbutton \"_menu_frame\" \"*white\" \"\" 0.390000 0.213333 0.840000 0.551111 0 0 0 150 260\r\ntouch_addbutton \"_menu_frame_icn_class1\" \"gfx/vgui/m249.tga\" \"\" 0.430000 0.215333 0.810000 0.549111 255 255 255 255 4\r\n//touch_addbutton \"_menu_frame_icn_class2\" \"\" \"\" 0.430000 0.215333 0.810000 0.549111 255 255 255 255 4\r\n//touch_addbutton \"_menu_frame_icn_class3\" \"\" \"\" 0.430000 0.215333 0.810000 0.549111 255 255 255 255 4\r\n//touch_addbutton \"_menu_frame_icn_class4\" \"\" \"\" 0.430000 0.215333 0.810000 0.549111 255 255 255 255 4\r\n//touch_addbutton \"_menu_frame_icn_class5\" \"\" \"\" 0.430000 0.215333 0.810000 0.549111 255 255 255 255 4\r\n//touch_addbutton \"_menu_frame_icn_class6\" \"\" \"\" 0.430000 0.215333 0.810000 0.549111 255 255 255 255 4\r\n//touch_addbutton \"_menu_frame_icn_class7\" \"\" \"\" 0.430000 0.215333 0.810000 0.549111 255 255 255 255 4\r\n//touch_addbutton \"_menu_frame_icn_class8\" \"\" \"\" 0.430000 0.215333 0.810000 0.549111 255 255 255 255 4\r\n\r\ntouch_addbutton \"_menu_confirm\" \"*white\" \"+menu_confirm\" 0.62 0.871111 0.84 0.924444 0 0 0 150 260\r\ntouch_addbutton \"_menu_confirm_txt\" \"#BUY THE ITEM\" \"\" 0.63 0.888889 0.84 0.924444 255 174 0 255 4\r\n\r\ntouch_addbutton \"_menu_frame_txt_data1_1\" \"#PRICE\" \"\" 0.39 0.551111 0.56 0.586667 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data1_2\" \"#COUNTRY OF ORIGIN\" \"\" 0.39 0.586667 0.56 0.622222 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data1_3\" \"#CALIBER\" \"\" 0.39 0.622222 0.56 0.657778 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data1_4\" \"#CLIP CAPACITY\" \"\" 0.39 0.657778 0.56 0.693333 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data1_5\" \"#RATE OF FIRE\" \"\" 0.39 0.693333 0.56 0.728889 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data1_6\" \"#WEIGHT (LOADED)\" \"\" 0.39 0.728889 0.56 0.764444 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data1_7\" \"#PROJECTILE WEIGHT\" \"\" 0.39 0.764444 0.56 0.8 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data1_8\" \"#MUZZLE VELOCITY\" \"\" 0.39 0.8 0.56 0.835556 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data1_9\" \"#MUZZLE ENERGY\" \"\" 0.39 0.835556 0.56 0.871111 240 180 24 255 4\r\n\r\ntouch_addbutton \"_menu_frame_txt_data2_1\" \"#PRICE\" \"\" 0.39 0.551111 0.56 0.586667 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data2_2\" \"#COUNTRY OF ORIGIN\" \"\" 0.39 0.586667 0.56 0.622222 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data2_3\" \"#CALIBER\" \"\" 0.39 0.622222 0.56 0.657778 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data2_4\" \"#CLIP CAPACITY\" \"\" 0.39 0.657778 0.56 0.693333 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data2_5\" \"#RATE OF FIRE\" \"\" 0.39 0.693333 0.56 0.728889 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data2_6\" \"#WEIGHT (EMPTY)\" \"\" 0.39 0.728889 0.56 0.764444 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data2_7\" \"#PROJECTILE WEIGHT\" \"\" 0.39 0.764444 0.56 0.8 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data2_8\" \"#MUZZLE VELOCITY\" \"\" 0.39 0.8 0.56 0.835556 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data2_9\" \"#MUZZLE ENERGY\" \"\" 0.39 0.835556 0.56 0.871111 240 180 24 255 4\r\n\r\ntouch_addbutton \"_menu_frame_txt_desc1_1\" \"#: \\$$_menu_money_item1\" \"\" 0.56 0.551111 0.84 0.586667 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc1_2\" \"#: BELGIUM\" \"\" 0.56 0.586667 0.84 0.622222 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc1_3\" \"#: 5.56 PARABELLUM\" \"\" 0.56 0.622222 0.84 0.657778 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc1_4\" \"#: 100 ROUNDS\" \"\" 0.56 0.657778 0.84 0.693333 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc1_5\" \"#: 600 RPM\" \"\" 0.56 0.693333 0.84 0.728889 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc1_6\" \"#: 6KG\" \"\" 0.56 0.728889 0.84 0.764444 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc1_7\" \"#: 4 GRAMS\" \"\" 0.56 0.764444 0.84 0.8 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc1_8\" \"#: 3000 FEET/SECOND\" \"\" 0.56 0.8 0.84 0.835556 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc1_9\" \"#: 1600 JOULES\" \"\" 0.56 0.835556 0.84 0.871111 240 180 24 255 4\r\n\r\ntouch_addbutton \"_menu_frame_txt_desc2_1\" \"#: \" \"\" 0.56 0.551111 0.84 0.586667 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc2_2\" \"#: \" \"\" 0.56 0.586667 0.84 0.622222 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc2_3\" \"#: \" \"\" 0.56 0.622222 0.84 0.657778 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc2_4\" \"#: \" \"\" 0.56 0.657778 0.84 0.693333 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc2_5\" \"#: \" \"\" 0.56 0.693333 0.84 0.728889 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc2_6\" \"#: \" \"\" 0.56 0.728889 0.84 0.764444 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc2_7\" \"#: \" \"\" 0.56 0.764444 0.84 0.8 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc2_8\" \"#: \" \"\" 0.56 0.8 0.84 0.835556 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc2_9\" \"#: \" \"\" 0.56 0.835556 0.84 0.871111 240 180 24 255 4\r\n\r\n//touch_addbutton \"_menu_frame_txt_desc3_1\" \"#: \" \"\" 0.56 0.551111 0.84 0.586667 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc3_2\" \"#: \" \"\" 0.56 0.586667 0.84 0.622222 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc3_3\" \"#: \" \"\" 0.56 0.622222 0.84 0.657778 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc3_4\" \"#: \" \"\" 0.56 0.657778 0.84 0.693333 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc3_5\" \"#: \" \"\" 0.56 0.693333 0.84 0.728889 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc3_6\" \"#: \" \"\" 0.56 0.728889 0.84 0.764444 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc3_7\" \"#: \" \"\" 0.56 0.764444 0.84 0.8 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc3_8\" \"#: \" \"\" 0.56 0.8 0.84 0.835556 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc3_9\" \"#: \" \"\" 0.56 0.835556 0.84 0.871111 240 180 24 255 4\r\n\r\n//touch_addbutton \"_menu_frame_txt_desc4_1\" \"#: \" \"\" 0.56 0.551111 0.84 0.586667 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc4_2\" \"#: \" \"\" 0.56 0.586667 0.84 0.622222 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc4_3\" \"#: \" \"\" 0.56 0.622222 0.84 0.657778 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc4_4\" \"#: \" \"\" 0.56 0.657778 0.84 0.693333 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc4_5\" \"#: \" \"\" 0.56 0.693333 0.84 0.728889 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc4_6\" \"#: \" \"\" 0.56 0.728889 0.84 0.764444 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc4_7\" \"#: \" \"\" 0.56 0.764444 0.84 0.8 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc4_8\" \"#: \" \"\" 0.56 0.8 0.84 0.835556 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc4_9\" \"#: \" \"\" 0.56 0.835556 0.84 0.871111 240 180 24 255 4\r\n\r\n//touch_addbutton \"_menu_frame_txt_desc5_1\" \"#: \" \"\" 0.56 0.551111 0.84 0.586667 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc5_2\" \"#: \" \"\" 0.56 0.586667 0.84 0.622222 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc5_3\" \"#: \" \"\" 0.56 0.622222 0.84 0.657778 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc5_4\" \"#: \" \"\" 0.56 0.657778 0.84 0.693333 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc5_5\" \"#: \" \"\" 0.56 0.693333 0.84 0.728889 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc5_6\" \"#: \" \"\" 0.56 0.728889 0.84 0.764444 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc5_7\" \"#: \" \"\" 0.56 0.764444 0.84 0.8 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc5_8\" \"#: \" \"\" 0.56 0.8 0.84 0.835556 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc5_9\" \"#: \" \"\" 0.56 0.835556 0.84 0.871111 240 180 24 255 4\r\n\r\n//touch_addbutton \"_menu_frame_txt_desc6_1\" \"#: \" \"\" 0.56 0.551111 0.84 0.586667 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc6_2\" \"#: \" \"\" 0.56 0.586667 0.84 0.622222 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc6_3\" \"#: \" \"\" 0.56 0.622222 0.84 0.657778 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc6_4\" \"#: \" \"\" 0.56 0.657778 0.84 0.693333 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc6_5\" \"#: \" \"\" 0.56 0.693333 0.84 0.728889 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc6_6\" \"#: \" \"\" 0.56 0.728889 0.84 0.764444 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc6_7\" \"#: \" \"\" 0.56 0.764444 0.84 0.8 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc6_8\" \"#: \" \"\" 0.56 0.8 0.84 0.835556 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc6_9\" \"#: \" \"\" 0.56 0.835556 0.84 0.871111 240 180 24 255 4\r\n\r\n//touch_addbutton \"_menu_frame_txt_desc7_1\" \"#: \" \"\" 0.56 0.551111 0.84 0.586667 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc7_2\" \"#: \" \"\" 0.56 0.586667 0.84 0.622222 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc7_3\" \"#: \" \"\" 0.56 0.622222 0.84 0.657778 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc7_4\" \"#: \" \"\" 0.56 0.657778 0.84 0.693333 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc7_5\" \"#: \" \"\" 0.56 0.693333 0.84 0.728889 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc7_6\" \"#: \" \"\" 0.56 0.728889 0.84 0.764444 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc7_7\" \"#: \" \"\" 0.56 0.764444 0.84 0.8 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc7_8\" \"#: \" \"\" 0.56 0.8 0.84 0.835556 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc7_9\" \"#: \" \"\" 0.56 0.835556 0.84 0.871111 240 180 24 255 4\r\n\r\n//touch_addbutton \"_menu_frame_txt_desc8_1\" \"#: \" \"\" 0.56 0.551111 0.84 0.586667 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc8_2\" \"#: \" \"\" 0.56 0.586667 0.84 0.622222 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc8_3\" \"#: \" \"\" 0.56 0.622222 0.84 0.657778 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc8_4\" \"#: \" \"\" 0.56 0.657778 0.84 0.693333 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc8_5\" \"#: \" \"\" 0.56 0.693333 0.84 0.728889 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc8_6\" \"#: \" \"\" 0.56 0.728889 0.84 0.764444 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc8_7\" \"#: \" \"\" 0.56 0.764444 0.84 0.8 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc8_8\" \"#: \" \"\" 0.56 0.8 0.84 0.835556 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc8_9\" \"#: \" \"\" 0.56 0.835556 0.84 0.871111 240 180 24 255 4\r\n\r\ntouch_addbutton \"_menu_txt_money\" \"#YOU HAVE \\$$cscl_currentmoney\" \"_menu_refresh\" 0.170000 0.106667 0.890000 0.160000 255 174 0 255 4\r\nalias _menu_refresh \"exec touch/buy_machinegun_ct.cfg\"\r\n\r\nalias _menu_none \"touch_setcolor _menu_slot* 0 0 0 150; touch_hide _menu_frame_icn_class*; touch_hide _menu_frame_txt_data*; touch_hide _menu_frame_txt_desc*; touch_hide _menu_confirm*\"\r\n_menu_none\r\n\r\n//alias +menu_slot0 \"touch_setcolor _menu_slot0 255 174 0 150\"\r\n//alias -menu_slot0 \"touch_setcolor _menu_slot0 0 0 0 150\"\r\n//alias _menu_select_slot1 \"_menu_none; touch_setcolor _menu_slot1 255 174 0 150; touch_show _menu_frame_icn_class1; touch_show _menu_frame_txt_desc1; if $cscl_currentmoney>=0;:_menu_show_confirm ; alias _menu_confirmed joinclass 1\"\r\n\r\nalias +menu_slot0 \"_click; touch_setcolor _menu_slot0 255 174 0 150\"\r\nalias -menu_slot0 \"touch_setcolor _menu_slot0 0 0 0 150; _erase_frame\"\r\nif $buymenu_stayon >= 1;:alias -menu_slot0 \"touch_setcolor _menu_slot0 0 0 0 150; _erase_frame; buy\"\r\n\r\nalias _menu_confirmed \"\"\r\nalias _menu_show_confirm \"touch_show _menu_confirm*\"\r\n\r\nalias _menu_select_slot1 \"_click; _menu_none; touch_setcolor _menu_slot1 255 174 0 150; touch_show _menu_frame_icn_class1; touch_show _menu_frame_txt_data1_*; touch_show _menu_frame_txt_desc1_*; if $cscl_currentmoney >= $_menu_money_item1;:_menu_show_confirm ; alias _menu_confirmed m249\"\r\n//alias _menu_select_slot2 \"_click; _menu_none; touch_setcolor _menu_slot2 255 174 0 150; touch_show _menu_frame_icn_class2; touch_show _menu_frame_txt_data2_*; touch_show _menu_frame_txt_desc2_*; if $cscl_currentmoney >= $_menu_money_item2;:_menu_show_confirm ; alias _menu_confirmed \"\r\n//alias _menu_select_slot3 \"_click; _menu_none; touch_setcolor _menu_slot3 255 174 0 150; touch_show _menu_frame_icn_class3; touch_show _menu_frame_txt_data1_*; touch_show _menu_frame_txt_desc3_*; if $cscl_currentmoney >= $_menu_money_item3;:_menu_show_confirm ; alias _menu_confirmed \"\r\n//alias _menu_select_slot4 \"_click; _menu_none; touch_setcolor _menu_slot4 255 174 0 150; touch_show _menu_frame_icn_class4; touch_show _menu_frame_txt_data1_*; touch_show _menu_frame_txt_desc4_*; if $cscl_currentmoney >= $_menu_money_item4;:_menu_show_confirm ; alias _menu_confirmed \"\r\n//alias _menu_select_slot5 \"_click; _menu_none; touch_setcolor _menu_slot5 255 174 0 150; touch_show _menu_frame_icn_class5; touch_show _menu_frame_txt_data1_*; touch_show _menu_frame_txt_desc5_*; if $cscl_currentmoney >= $_menu_money_item5;:_menu_show_confirm ; alias _menu_confirmed \"\r\n//alias _menu_select_slot6 \"_click; _menu_none; touch_setcolor _menu_slot6 255 174 0 150; touch_show _menu_frame_icn_class6; touch_show _menu_frame_txt_data1_*; touch_show _menu_frame_txt_desc6_*; if $cscl_currentmoney >= $_menu_money_item6;:_menu_show_confirm ; alias _menu_confirmed \"\r\n//alias _menu_select_slot7 \"_click; _menu_none; touch_setcolor _menu_slot7 255 174 0 150; touch_show _menu_frame_icn_class7; touch_show _menu_frame_txt_data1_*; touch_show _menu_frame_txt_desc7_*; if $cscl_currentmoney >= $_menu_money_item7;:_menu_show_confirm ; alias _menu_confirmed \"\r\n//alias _menu_select_slot8 \"_click; _menu_none; touch_setcolor _menu_slot8 255 174 0 150; touch_show _menu_frame_icn_class8; touch_show _menu_frame_txt_data1_*; touch_show _menu_frame_txt_desc8_*; if $cscl_currentmoney >= $_menu_money_item8;:_menu_show_confirm ; alias _menu_confirmed \"\r\n\r\nalias +menu_confirm \"_click; touch_setcolor _menu_confirm 255 174 0 150\"\r\nalias -menu_confirm \"touch_setcolor _menu_confirm 0 0 0 150; _menu_confirmed; wait; wait; _erase_frame\"\r\n"
  },
  {
    "path": "3rdparty/cs16client-extras/touch/buy_pistol_ct.cfg",
    "content": "// Coded by Alprnn357\r\ntouch_setclientonly 1\r\ncmd_scripting 1\r\ntouch_set_stroke 1 255 174 0 150\r\n\r\nalias _erase_frame \"touch_removebutton _menu_*; _menu_off; slot10\"\r\nalias _menu_off \"touch_setclientonly 0\"\r\nalias _click \"play media/launch_select1.wav; vibrate 30\"\r\n\r\ntouch_addbutton \"_menu_bg_crn4\" \"gfx/vgui/round_corner_se.tga\" \"\" 0.880000 0.924444 0.900000 0.960000 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_crn2\" \"gfx/vgui/round_corner_ne.tga\" \"\" 0.880000 0.035556 0.900000 0.071111 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_crn1\" \"gfx/vgui/round_corner_nw.tga\" \"\" 0.100000 0.035556 0.120000 0.071111 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_crn3\" \"gfx/vgui/round_corner_sw.tga\" \"\" 0.100000 0.924444 0.120000 0.960000 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_top1\" \"*black\" \"\" 0.120000 0.035556 0.880000 0.071111 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_top2\" \"*black\" \"\" 0.100000 0.071111 0.900000 0.160000 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_bottom\" \"*black\" \"\" 0.120000 0.924444 0.880000 0.960000 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_body\" \"*black\" \"\" 0.100000 0.165000 0.900000 0.924444 0 0 0 150 6\r\nif $menu_bg_fill >= 1;:touch_removebutton _menu_bg_*;:touch_addbutton _menu_bg_body *black \"\" 0 0 1 1 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_icn_logo\" \"gfx/vgui/cs_logo.tga\" \"\" 0.110000 0.053333 0.160000 0.142222 255 174 0 255 6\r\ntouch_addbutton \"_menu_bg_txt_logo\" \"#BUY PISTOLS (SECONDARY WEAPON)\" \"\" 0.170000 0.071111 0.890000 0.142222 255 174 0 255 6\r\n\r\n//touch_addbutton \"_menu_txt_title\" \"#THE TITLE\" \"\" 0.140000 0.177778 0.860000 0.213333 255 174 0 255 4\r\ntouch_addbutton \"_menu_slot1\" \"*white\" \"_menu_select_slot1\" 0.140000 0.213333 0.360000 0.266667 0 0 0 150 260\r\ntouch_addbutton \"_menu_txt_slot1\" \"#1 9X19MM SIDEARM\" \"\" 0.150000 0.231111 0.360000 0.266667 255 174 0 255 4\r\ntouch_addbutton \"_menu_slot2\" \"*white\" \"_menu_select_slot2\" 0.140000 0.284444 0.360000 0.337778 0 0 0 150 260\r\ntouch_addbutton \"_menu_txt_slot2\" \"#2 K&M .45 TACTICAL\" \"\" 0.150000 0.302222 0.360000 0.337778 255 174 0 255 4\r\ntouch_addbutton \"_menu_slot3\" \"*white\" \"_menu_select_slot3\" 0.140000 0.355556 0.360000 0.408889 0 0 0 150 260\r\ntouch_addbutton \"_menu_txt_slot3\" \"#3 228 COMPACT\" \"\" 0.150000 0.373333 0.360000 0.408889 255 174 0 255 4\r\ntouch_addbutton \"_menu_slot4\" \"*white\" \"_menu_select_slot4\" 0.140000 0.426667 0.360000 0.480000 0 0 0 150 260\r\ntouch_addbutton \"_menu_txt_slot4\" \"#4 NIGHT HAWK .50C\" \"\" 0.150000 0.444444 0.360000 0.480000 255 174 0 255 4\r\ntouch_addbutton \"_menu_slot5\" \"*white\" \"_menu_select_slot5\" 0.140000 0.497778 0.360000 0.551111 0 0 0 150 260\r\ntouch_addbutton \"_menu_txt_slot5\" \"#5 ES FIVE-SEVEN\" \"\" 0.150000 0.515556 0.360000 0.551111 255 174 0 255 4\r\n//touch_addbutton \"_menu_slot6\" \"*white\" \"_menu_select_slot6\" 0.140000 0.568889 0.360000 0.622222 0 0 0 150 260\r\n//touch_addbutton \"_menu_txt_slot6\" \"#6 SLOT\" \"\" 0.150000 0.586667 0.360000 0.622222 255 174 0 255 4\r\n//touch_addbutton \"_menu_slot7\" \"*white\" \"_menu_select_slot7\" 0.140000 0.640000 0.360000 0.693333 0 0 0 150 260\r\n//touch_addbutton \"_menu_txt_slot7\" \"#7 SLOT\" \"\" 0.150000 0.657778 0.360000 0.693333 255 174 0 255 4\r\n//touch_addbutton \"_menu_slot8\" \"*white\" \"_menu_select_slot8\" 0.140000 0.711111 0.360000 0.764444 0 0 0 150 260\r\n//touch_addbutton \"_menu_txt_slot8\" \"#8 SLOT\" \"\" 0.150000 0.728889 0.360000 0.764444 255 174 0 255 4\r\n//touch_addbutton \"_menu_slot9\" \"*white\" \"\" 0.140000 0.782222 0.360000 0.835556 0 0 0 150 260\r\n//touch_addbutton \"_menu_txt_slot9\" \"#9 SLOT\" \"\" 0.150000 0.800000 0.360000 0.835556 255 174 0 255 4\r\ntouch_addbutton \"_menu_slot0\" \"*white\" \"+menu_slot0\" 0.14 0.871111 0.36 0.924444 0 0 0 150 260\r\ntouch_addbutton \"_menu_txt_slot0\" \"#0 CANCEL\" \"\" 0.15 0.888889 0.36 0.924444 255 174 0 255 4\r\n\r\nset _menu_money_item1 \"400\"; if $cscl_currentmoney < $_menu_money_item1;: touch_setcolor _menu_txt_slot1 129 85 0 255\r\nset _menu_money_item2 \"500\"; if $cscl_currentmoney < $_menu_money_item2;: touch_setcolor _menu_txt_slot2 129 85 0 255\r\nset _menu_money_item3 \"600\"; if $cscl_currentmoney < $_menu_money_item3;: touch_setcolor _menu_txt_slot3 129 85 0 255\r\nset _menu_money_item4 \"650\"; if $cscl_currentmoney < $_menu_money_item4;: touch_setcolor _menu_txt_slot4 129 85 0 255\r\nset _menu_money_item5 \"750\"; if $cscl_currentmoney < $_menu_money_item5;: touch_setcolor _menu_txt_slot5 129 85 0 255\r\n//set _menu_money_item6 \"\"; if $cscl_currentmoney < $_menu_money_item6;: touch_setcolor _menu_txt_slot6 129 85 0 255\r\n//set _menu_money_item7 \"\"; if $cscl_currentmoney < $_menu_money_item7;: touch_setcolor _menu_txt_slot7 129 85 0 255\r\n//set _menu_money_item8 \"\"; if $cscl_currentmoney < $_menu_money_item8;: touch_setcolor _menu_txt_slot8 129 85 0 255\r\n\r\ntouch_addbutton \"_menu_frame\" \"*white\" \"\" 0.390000 0.213333 0.840000 0.551111 0 0 0 150 260\r\ntouch_addbutton \"_menu_frame_icn_class1\" \"gfx/vgui/glock18.tga\" \"\" 0.430000 0.215333 0.810000 0.549111 255 255 255 255 4\r\ntouch_addbutton \"_menu_frame_icn_class2\" \"gfx/vgui/usp45.tga\" \"\" 0.430000 0.215333 0.810000 0.549111 255 255 255 255 4\r\ntouch_addbutton \"_menu_frame_icn_class3\" \"gfx/vgui/p228.tga\" \"\" 0.430000 0.215333 0.810000 0.549111 255 255 255 255 4\r\ntouch_addbutton \"_menu_frame_icn_class4\" \"gfx/vgui/deserteagle.tga\" \"\" 0.430000 0.215333 0.810000 0.549111 255 255 255 255 4\r\ntouch_addbutton \"_menu_frame_icn_class5\" \"gfx/vgui/fiveseven.tga\" \"\" 0.430000 0.215333 0.810000 0.549111 255 255 255 255 4\r\n//touch_addbutton \"_menu_frame_icn_class6\" \"\" \"\" 0.430000 0.215333 0.810000 0.549111 255 255 255 255 4\r\n//touch_addbutton \"_menu_frame_icn_class7\" \"\" \"\" 0.430000 0.215333 0.810000 0.549111 255 255 255 255 4\r\n//touch_addbutton \"_menu_frame_icn_class8\" \"\" \"\" 0.430000 0.215333 0.810000 0.549111 255 255 255 255 4\r\n\r\ntouch_addbutton \"_menu_confirm\" \"*white\" \"+menu_confirm\" 0.62 0.871111 0.84 0.924444 0 0 0 150 260\r\ntouch_addbutton \"_menu_confirm_txt\" \"#BUY THE ITEM\" \"\" 0.63 0.888889 0.84 0.924444 255 174 0 255 4\r\n\r\ntouch_addbutton \"_menu_frame_txt_data1_1\" \"#PRICE\" \"\" 0.39 0.551111 0.56 0.586667 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data1_2\" \"#COUNTRY OF ORIGIN\" \"\" 0.39 0.586667 0.56 0.622222 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data1_3\" \"#CALIBER\" \"\" 0.39 0.622222 0.56 0.657778 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data1_4\" \"#CLIP CAPACITY\" \"\" 0.39 0.657778 0.56 0.693333 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data1_5\" \"#RATE OF FIRE\" \"\" 0.39 0.693333 0.56 0.728889 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data1_6\" \"#WEIGHT (LOADED)\" \"\" 0.39 0.728889 0.56 0.764444 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data1_7\" \"#PROJECTILE WEIGHT\" \"\" 0.39 0.764444 0.56 0.8 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data1_8\" \"#MUZZLE VELOCITY\" \"\" 0.39 0.8 0.56 0.835556 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data1_9\" \"#MUZZLE ENERGY\" \"\" 0.39 0.835556 0.56 0.871111 240 180 24 255 4\r\n\r\ntouch_addbutton \"_menu_frame_txt_data2_1\" \"#PRICE\" \"\" 0.39 0.551111 0.56 0.586667 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data2_2\" \"#COUNTRY OF ORIGIN\" \"\" 0.39 0.586667 0.56 0.622222 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data2_3\" \"#CALIBER\" \"\" 0.39 0.622222 0.56 0.657778 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data2_4\" \"#CLIP CAPACITY\" \"\" 0.39 0.657778 0.56 0.693333 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data2_5\" \"#RATE OF FIRE\" \"\" 0.39 0.693333 0.56 0.728889 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data2_6\" \"#WEIGHT (EMPTY)\" \"\" 0.39 0.728889 0.56 0.764444 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data2_7\" \"#PROJECTILE WEIGHT\" \"\" 0.39 0.764444 0.56 0.8 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data2_8\" \"#MUZZLE VELOCITY\" \"\" 0.39 0.8 0.56 0.835556 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data2_9\" \"#MUZZLE ENERGY\" \"\" 0.39 0.835556 0.56 0.871111 240 180 24 255 4\r\n\r\ntouch_addbutton \"_menu_frame_txt_desc1_1\" \"#: \\$$_menu_money_item1\" \"\" 0.56 0.551111 0.84 0.586667 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc1_2\" \"#: AUSTRIA\" \"\" 0.56 0.586667 0.84 0.622222 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc1_3\" \"#: 9MM PARABELLUM\" \"\" 0.56 0.622222 0.84 0.657778 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc1_4\" \"#: 20 ROUNDS\" \"\" 0.56 0.657778 0.84 0.693333 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc1_5\" \"#: N/A\" \"\" 0.56 0.693333 0.84 0.728889 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc1_6\" \"#: 0.9KG\" \"\" 0.56 0.728889 0.84 0.764444 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc1_7\" \"#: 8 GRAMS\" \"\" 0.56 0.764444 0.84 0.8 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc1_8\" \"#: 1132 FEET/SECOND\" \"\" 0.56 0.8 0.84 0.835556 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc1_9\" \"#: 475 JOULES\" \"\" 0.56 0.835556 0.84 0.871111 240 180 24 255 4\r\n\r\ntouch_addbutton \"_menu_frame_txt_desc2_1\" \"#: \\$$_menu_money_item2\" \"\" 0.56 0.551111 0.84 0.586667 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc2_2\" \"#: GERMANY\" \"\" 0.56 0.586667 0.84 0.622222 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc2_3\" \"#: .45 ACP\" \"\" 0.56 0.622222 0.84 0.657778 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc2_4\" \"#: 12 ROUNDS\" \"\" 0.56 0.657778 0.84 0.693333 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc2_5\" \"#: N/A\" \"\" 0.56 0.693333 0.84 0.728889 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc2_6\" \"#: 1KG\" \"\" 0.56 0.728889 0.84 0.764444 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc2_7\" \"#: 15.2 GRAMS\" \"\" 0.56 0.764444 0.84 0.8 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc2_8\" \"#: 886 FEET/SECOND\" \"\" 0.56 0.8 0.84 0.835556 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc2_9\" \"#: 553 JOULES\" \"\" 0.56 0.835556 0.84 0.871111 240 180 24 255 4\r\n\r\ntouch_addbutton \"_menu_frame_txt_desc3_1\" \"#: \\$$_menu_money_item3\" \"\" 0.56 0.551111 0.84 0.586667 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc3_2\" \"#: SWITZERLAND/GERMANY\" \"\" 0.56 0.586667 0.84 0.622222 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc3_3\" \"#: .357 SIG\" \"\" 0.56 0.622222 0.84 0.657778 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc3_4\" \"#: 13 ROUNDS\" \"\" 0.56 0.657778 0.84 0.693333 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc3_5\" \"#: N/A\" \"\" 0.56 0.693333 0.84 0.728889 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc3_6\" \"#: 1.03KG\" \"\" 0.56 0.728889 0.84 0.764444 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc3_7\" \"#: 8.1 GRAMS\" \"\" 0.56 0.764444 0.84 0.8 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc3_8\" \"#: 1400 FEET/SECOND\" \"\" 0.56 0.8 0.84 0.835556 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc3_9\" \"#: 600 JOULES\" \"\" 0.56 0.835556 0.84 0.871111 240 180 24 255 4\r\n\r\ntouch_addbutton \"_menu_frame_txt_desc4_1\" \"#: \\$$_menu_money_item4\" \"\" 0.56 0.551111 0.84 0.586667 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc4_2\" \"#: ISRAEL\" \"\" 0.56 0.586667 0.84 0.622222 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc4_3\" \"#: .50 ACTION EXPRESS\" \"\" 0.56 0.622222 0.84 0.657778 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc4_4\" \"#: 7 ROUNDS\" \"\" 0.56 0.657778 0.84 0.693333 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc4_5\" \"#: N/A\" \"\" 0.56 0.693333 0.84 0.728889 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc4_6\" \"#: 1.8KG\" \"\" 0.56 0.728889 0.84 0.764444 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc4_7\" \"#: 19.4 GRAMS\" \"\" 0.56 0.764444 0.84 0.8 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc4_8\" \"#: 1380 FEET/SECOND\" \"\" 0.56 0.8 0.84 0.835556 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc4_9\" \"#: 1650 JOULES\" \"\" 0.56 0.835556 0.84 0.871111 240 180 24 255 4\r\n\r\ntouch_addbutton \"_menu_frame_txt_desc5_1\" \"#: \\$$_menu_money_item5\" \"\" 0.56 0.551111 0.84 0.586667 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc5_2\" \"#: BELGIUM\" \"\" 0.56 0.586667 0.84 0.622222 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc5_3\" \"#: 5.7 X 28MM\" \"\" 0.56 0.622222 0.84 0.657778 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc5_4\" \"#: 20 ROUNDS\" \"\" 0.56 0.657778 0.84 0.693333 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc5_5\" \"#: N/A\" \"\" 0.56 0.693333 0.84 0.728889 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc5_6\" \"#: 0.618KG\" \"\" 0.56 0.728889 0.84 0.764444 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc5_7\" \"#: 2 GRAMS\" \"\" 0.56 0.764444 0.84 0.8 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc5_8\" \"#: 2345 FEET/SECOND\" \"\" 0.56 0.8 0.84 0.835556 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc5_9\" \"#: 465 JOULES\" \"\" 0.56 0.835556 0.84 0.871111 240 180 24 255 4\r\n\r\n//touch_addbutton \"_menu_frame_txt_desc6_1\" \"#: \" \"\" 0.56 0.551111 0.84 0.586667 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc6_2\" \"#: \" \"\" 0.56 0.586667 0.84 0.622222 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc6_3\" \"#: \" \"\" 0.56 0.622222 0.84 0.657778 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc6_4\" \"#: \" \"\" 0.56 0.657778 0.84 0.693333 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc6_5\" \"#: \" \"\" 0.56 0.693333 0.84 0.728889 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc6_6\" \"#: \" \"\" 0.56 0.728889 0.84 0.764444 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc6_7\" \"#: \" \"\" 0.56 0.764444 0.84 0.8 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc6_8\" \"#: \" \"\" 0.56 0.8 0.84 0.835556 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc6_9\" \"#: \" \"\" 0.56 0.835556 0.84 0.871111 240 180 24 255 4\r\n\r\n//touch_addbutton \"_menu_frame_txt_desc7_1\" \"#: \" \"\" 0.56 0.551111 0.84 0.586667 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc7_2\" \"#: \" \"\" 0.56 0.586667 0.84 0.622222 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc7_3\" \"#: \" \"\" 0.56 0.622222 0.84 0.657778 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc7_4\" \"#: \" \"\" 0.56 0.657778 0.84 0.693333 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc7_5\" \"#: \" \"\" 0.56 0.693333 0.84 0.728889 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc7_6\" \"#: \" \"\" 0.56 0.728889 0.84 0.764444 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc7_7\" \"#: \" \"\" 0.56 0.764444 0.84 0.8 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc7_8\" \"#: \" \"\" 0.56 0.8 0.84 0.835556 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc7_9\" \"#: \" \"\" 0.56 0.835556 0.84 0.871111 240 180 24 255 4\r\n\r\n//touch_addbutton \"_menu_frame_txt_desc8_1\" \"#: \" \"\" 0.56 0.551111 0.84 0.586667 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc8_2\" \"#: \" \"\" 0.56 0.586667 0.84 0.622222 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc8_3\" \"#: \" \"\" 0.56 0.622222 0.84 0.657778 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc8_4\" \"#: \" \"\" 0.56 0.657778 0.84 0.693333 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc8_5\" \"#: \" \"\" 0.56 0.693333 0.84 0.728889 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc8_6\" \"#: \" \"\" 0.56 0.728889 0.84 0.764444 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc8_7\" \"#: \" \"\" 0.56 0.764444 0.84 0.8 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc8_8\" \"#: \" \"\" 0.56 0.8 0.84 0.835556 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc8_9\" \"#: \" \"\" 0.56 0.835556 0.84 0.871111 240 180 24 255 4\r\n\r\ntouch_addbutton \"_menu_txt_money\" \"#YOU HAVE \\$$cscl_currentmoney\" \"_menu_refresh\" 0.170000 0.106667 0.890000 0.160000 255 174 0 255 4\r\nalias _menu_refresh \"exec touch/buy_pistol_ct.cfg\"\r\n\r\nalias _menu_none \"touch_setcolor _menu_slot* 0 0 0 150; touch_hide _menu_frame_icn_class*; touch_hide _menu_frame_txt_data*; touch_hide _menu_frame_txt_desc*; touch_hide _menu_confirm*\"\r\n_menu_none\r\n\r\n//alias +menu_slot0 \"touch_setcolor _menu_slot0 255 174 0 150\"\r\n//alias -menu_slot0 \"touch_setcolor _menu_slot0 0 0 0 150\"\r\n//alias _menu_select_slot1 \"_menu_none; touch_setcolor _menu_slot1 255 174 0 150; touch_show _menu_frame_icn_class1; touch_show _menu_frame_txt_desc1; if $cscl_currentmoney>=0;:_menu_show_confirm ; alias _menu_confirmed joinclass 1\"\r\n\r\nalias +menu_slot0 \"_click; touch_setcolor _menu_slot0 255 174 0 150\"\r\nalias -menu_slot0 \"touch_setcolor _menu_slot0 0 0 0 150; _erase_frame\"\r\nif $buymenu_stayon >= 1;:alias -menu_slot0 \"touch_setcolor _menu_slot0 0 0 0 150; _erase_frame; buy\"\r\n\r\nalias _menu_confirmed \"\"\r\nalias _menu_show_confirm \"touch_show _menu_confirm*\"\r\n\r\nalias _menu_select_slot1 \"_click; _menu_none; touch_setcolor _menu_slot1 255 174 0 150; touch_show _menu_frame_icn_class1; touch_show _menu_frame_txt_data1_*; touch_show _menu_frame_txt_desc1_*; if $cscl_currentmoney >= $_menu_money_item1;:_menu_show_confirm ; alias _menu_confirmed glock\"\r\nalias _menu_select_slot2 \"_click; _menu_none; touch_setcolor _menu_slot2 255 174 0 150; touch_show _menu_frame_icn_class2; touch_show _menu_frame_txt_data2_*; touch_show _menu_frame_txt_desc2_*; if $cscl_currentmoney >= $_menu_money_item2;:_menu_show_confirm ; alias _menu_confirmed usp\"\r\nalias _menu_select_slot3 \"_click; _menu_none; touch_setcolor _menu_slot3 255 174 0 150; touch_show _menu_frame_icn_class3; touch_show _menu_frame_txt_data1_*; touch_show _menu_frame_txt_desc3_*; if $cscl_currentmoney >= $_menu_money_item3;:_menu_show_confirm ; alias _menu_confirmed p228\"\r\nalias _menu_select_slot4 \"_click; _menu_none; touch_setcolor _menu_slot4 255 174 0 150; touch_show _menu_frame_icn_class4; touch_show _menu_frame_txt_data1_*; touch_show _menu_frame_txt_desc4_*; if $cscl_currentmoney >= $_menu_money_item4;:_menu_show_confirm ; alias _menu_confirmed deagle\"\r\nalias _menu_select_slot5 \"_click; _menu_none; touch_setcolor _menu_slot5 255 174 0 150; touch_show _menu_frame_icn_class5; touch_show _menu_frame_txt_data1_*; touch_show _menu_frame_txt_desc5_*; if $cscl_currentmoney >= $_menu_money_item5;:_menu_show_confirm ; alias _menu_confirmed fiveseven\"\r\n//alias _menu_select_slot6 \"_click; _menu_none; touch_setcolor _menu_slot6 255 174 0 150; touch_show _menu_frame_icn_class6; touch_show _menu_frame_txt_data1_*; touch_show _menu_frame_txt_desc6_*; if $cscl_currentmoney >= $_menu_money_item6;:_menu_show_confirm ; alias _menu_confirmed \"\r\n//alias _menu_select_slot7 \"_click; _menu_none; touch_setcolor _menu_slot7 255 174 0 150; touch_show _menu_frame_icn_class7; touch_show _menu_frame_txt_data1_*; touch_show _menu_frame_txt_desc7_*; if $cscl_currentmoney >= $_menu_money_item7;:_menu_show_confirm ; alias _menu_confirmed \"\r\n//alias _menu_select_slot8 \"_click; _menu_none; touch_setcolor _menu_slot8 255 174 0 150; touch_show _menu_frame_icn_class8; touch_show _menu_frame_txt_data1_*; touch_show _menu_frame_txt_desc8_*; if $cscl_currentmoney >= $_menu_money_item8;:_menu_show_confirm ; alias _menu_confirmed \"\r\n\r\nalias +menu_confirm \"_click; touch_setcolor _menu_confirm 255 174 0 150\"\r\nalias -menu_confirm \"touch_setcolor _menu_confirm 0 0 0 150; _menu_confirmed; wait; wait; _erase_frame\"\r\n"
  },
  {
    "path": "3rdparty/cs16client-extras/touch/buy_pistol_t.cfg",
    "content": "// Coded by Alprnn357\r\ntouch_setclientonly 1\r\ncmd_scripting 1\r\ntouch_set_stroke 1 255 174 0 150\r\n\r\nalias _erase_frame \"touch_removebutton _menu_*; _menu_off; slot10\"\r\nalias _menu_off \"touch_setclientonly 0\"\r\nalias _click \"play media/launch_select1.wav; vibrate 30\"\r\n\r\ntouch_addbutton \"_menu_bg_crn4\" \"gfx/vgui/round_corner_se.tga\" \"\" 0.880000 0.924444 0.900000 0.960000 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_crn2\" \"gfx/vgui/round_corner_ne.tga\" \"\" 0.880000 0.035556 0.900000 0.071111 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_crn1\" \"gfx/vgui/round_corner_nw.tga\" \"\" 0.100000 0.035556 0.120000 0.071111 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_crn3\" \"gfx/vgui/round_corner_sw.tga\" \"\" 0.100000 0.924444 0.120000 0.960000 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_top1\" \"*black\" \"\" 0.120000 0.035556 0.880000 0.071111 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_top2\" \"*black\" \"\" 0.100000 0.071111 0.900000 0.160000 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_bottom\" \"*black\" \"\" 0.120000 0.924444 0.880000 0.960000 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_body\" \"*black\" \"\" 0.100000 0.165000 0.900000 0.924444 0 0 0 150 6\r\nif $menu_bg_fill >= 1;:touch_removebutton _menu_bg_*;:touch_addbutton _menu_bg_body *black \"\" 0 0 1 1 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_icn_logo\" \"gfx/vgui/cs_logo.tga\" \"\" 0.110000 0.053333 0.160000 0.142222 255 174 0 255 6\r\ntouch_addbutton \"_menu_bg_txt_logo\" \"#BUY PISTOLS (SECONDARY WEAPON)\" \"\" 0.170000 0.071111 0.890000 0.142222 255 174 0 255 6\r\n\r\n//touch_addbutton \"_menu_txt_title\" \"#THE TITLE\" \"\" 0.140000 0.177778 0.860000 0.213333 255 174 0 255 4\r\ntouch_addbutton \"_menu_slot1\" \"*white\" \"_menu_select_slot1\" 0.140000 0.213333 0.360000 0.266667 0 0 0 150 260\r\ntouch_addbutton \"_menu_txt_slot1\" \"#1 9X19MM SIDEARM\" \"\" 0.150000 0.231111 0.360000 0.266667 255 174 0 255 4\r\ntouch_addbutton \"_menu_slot2\" \"*white\" \"_menu_select_slot2\" 0.140000 0.284444 0.360000 0.337778 0 0 0 150 260\r\ntouch_addbutton \"_menu_txt_slot2\" \"#2 K&M .45 TACTICAL\" \"\" 0.150000 0.302222 0.360000 0.337778 255 174 0 255 4\r\ntouch_addbutton \"_menu_slot3\" \"*white\" \"_menu_select_slot3\" 0.140000 0.355556 0.360000 0.408889 0 0 0 150 260\r\ntouch_addbutton \"_menu_txt_slot3\" \"#3 228 COMPACT\" \"\" 0.150000 0.373333 0.360000 0.408889 255 174 0 255 4\r\ntouch_addbutton \"_menu_slot4\" \"*white\" \"_menu_select_slot4\" 0.140000 0.426667 0.360000 0.480000 0 0 0 150 260\r\ntouch_addbutton \"_menu_txt_slot4\" \"#4 NIGHT HAWK .50C\" \"\" 0.150000 0.444444 0.360000 0.480000 255 174 0 255 4\r\ntouch_addbutton \"_menu_slot5\" \"*white\" \"_menu_select_slot5\" 0.140000 0.497778 0.360000 0.551111 0 0 0 150 260\r\ntouch_addbutton \"_menu_txt_slot5\" \"#5 .40 DUAL ELITES\" \"\" 0.150000 0.515556 0.360000 0.551111 255 174 0 255 4\r\n//touch_addbutton \"_menu_slot6\" \"*white\" \"_menu_select_slot6\" 0.140000 0.568889 0.360000 0.622222 0 0 0 150 260\r\n//touch_addbutton \"_menu_txt_slot6\" \"#6 SLOT\" \"\" 0.150000 0.586667 0.360000 0.622222 255 174 0 255 4\r\n//touch_addbutton \"_menu_slot7\" \"*white\" \"_menu_select_slot7\" 0.140000 0.640000 0.360000 0.693333 0 0 0 150 260\r\n//touch_addbutton \"_menu_txt_slot7\" \"#7 SLOT\" \"\" 0.150000 0.657778 0.360000 0.693333 255 174 0 255 4\r\n//touch_addbutton \"_menu_slot8\" \"*white\" \"_menu_select_slot8\" 0.140000 0.711111 0.360000 0.764444 0 0 0 150 260\r\n//touch_addbutton \"_menu_txt_slot8\" \"#8 SLOT\" \"\" 0.150000 0.728889 0.360000 0.764444 255 174 0 255 4\r\n//touch_addbutton \"_menu_slot9\" \"*white\" \"\" 0.140000 0.782222 0.360000 0.835556 0 0 0 150 260\r\n//touch_addbutton \"_menu_txt_slot9\" \"#9 SLOT\" \"\" 0.150000 0.800000 0.360000 0.835556 255 174 0 255 4\r\ntouch_addbutton \"_menu_slot0\" \"*white\" \"+menu_slot0\" 0.14 0.871111 0.36 0.924444 0 0 0 150 260\r\ntouch_addbutton \"_menu_txt_slot0\" \"#0 CANCEL\" \"\" 0.15 0.888889 0.36 0.924444 255 174 0 255 4\r\n\r\nset _menu_money_item1 \"400\"; if $cscl_currentmoney < $_menu_money_item1;: touch_setcolor _menu_txt_slot1 129 85 0 255\r\nset _menu_money_item2 \"500\"; if $cscl_currentmoney < $_menu_money_item2;: touch_setcolor _menu_txt_slot2 129 85 0 255\r\nset _menu_money_item3 \"600\"; if $cscl_currentmoney < $_menu_money_item3;: touch_setcolor _menu_txt_slot3 129 85 0 255\r\nset _menu_money_item4 \"650\"; if $cscl_currentmoney < $_menu_money_item4;: touch_setcolor _menu_txt_slot4 129 85 0 255\r\nset _menu_money_item5 \"800\"; if $cscl_currentmoney < $_menu_money_item5;: touch_setcolor _menu_txt_slot5 129 85 0 255\r\n//set _menu_money_item6 \"\"; if $cscl_currentmoney < $_menu_money_item6;: touch_setcolor _menu_txt_slot6 129 85 0 255\r\n//set _menu_money_item7 \"\"; if $cscl_currentmoney < $_menu_money_item7;: touch_setcolor _menu_txt_slot7 129 85 0 255\r\n//set _menu_money_item8 \"\"; if $cscl_currentmoney < $_menu_money_item8;: touch_setcolor _menu_txt_slot8 129 85 0 255\r\n\r\ntouch_addbutton \"_menu_frame\" \"*white\" \"\" 0.390000 0.213333 0.840000 0.551111 0 0 0 150 260\r\ntouch_addbutton \"_menu_frame_icn_class1\" \"gfx/vgui/glock18.tga\" \"\" 0.430000 0.215333 0.810000 0.549111 255 255 255 255 4\r\ntouch_addbutton \"_menu_frame_icn_class2\" \"gfx/vgui/usp45.tga\" \"\" 0.430000 0.215333 0.810000 0.549111 255 255 255 255 4\r\ntouch_addbutton \"_menu_frame_icn_class3\" \"gfx/vgui/p228.tga\" \"\" 0.430000 0.215333 0.810000 0.549111 255 255 255 255 4\r\ntouch_addbutton \"_menu_frame_icn_class4\" \"gfx/vgui/deserteagle.tga\" \"\" 0.430000 0.215333 0.810000 0.549111 255 255 255 255 4\r\ntouch_addbutton \"_menu_frame_icn_class5\" \"gfx/vgui/elites.tga\" \"\" 0.430000 0.215333 0.810000 0.549111 255 255 255 255 4\r\n//touch_addbutton \"_menu_frame_icn_class6\" \"\" \"\" 0.430000 0.215333 0.810000 0.549111 255 255 255 255 4\r\n//touch_addbutton \"_menu_frame_icn_class7\" \"\" \"\" 0.430000 0.215333 0.810000 0.549111 255 255 255 255 4\r\n//touch_addbutton \"_menu_frame_icn_class8\" \"\" \"\" 0.430000 0.215333 0.810000 0.549111 255 255 255 255 4\r\ntouch_addbutton \"_menu_frame_txt_data1\" \"#PRICE;COUNTRY OF ORIGIN;CALIBER;CLIP CAPACITY;RATE OF FIRE;WEIGHT (LOADED);PROJECTILE WEIGHT;MUZZLE VELOCITY;MUZZLE ENERGY\" \"\" 0.390000 0.551111 0.560000 0.853333 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data2\" \"#PRICE;COUNTRY OF ORIGIN;CALIBER;CLIP CAPACITY;RATE OF FIRE;WEIGHT (EMPTY);PROJECTILE WEIGHT;MUZZLE VELOCITY;MUZZLE ENERGY\" \"\" 0.390000 0.551111 0.560000 0.853333 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc1\" \"#: \\$$_menu_money_item1;: AUSTRIA;: 9MM PARABELLUM;: 20 ROUNDS;: N/A;: 0.9KG;: 8 GRAMS;: 1132 FEET/SECOND;: 475 JOULES\" \"\" 0.560000 0.551111 0.840000 0.853333 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc2\" \"#: \\$$_menu_money_item2;: GERMANY;: .45 ACP;: 12 ROUNDS;: N/A;: 1KG;: 15.2 GRAMS;: 886 FEET/SECOND;: 553 JOULES\" \"\" 0.560000 0.551111 0.840000 0.853333 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc3\" \"#: \\$$_menu_money_item3;: SWITZERLAND/GERMANY;: .357 SIG;: 13 ROUNDS;: N/A;: 1.03KG;: 8.1 GRAMS;: 1400 FEET/SECOND;: 600 JOULES\" \"\" 0.560000 0.551111 0.840000 0.853333 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc4\" \"#: \\$$_menu_money_item4;: ISRAEL;: .50 ACTION EXPRESS;: 7 ROUNDS;: N/A;: 1.8KG;: 19.4 GRAMS;: 1380 FEET/SECOND;: 1650 JOULES\" \"\" 0.560000 0.551111 0.840000 0.853333 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc5\" \"#: \\$$_menu_money_item5;: ITALY;: .40 S&&W;: 15 ROUNDS;: N/A;: 1.15KG;: 8 GRAMS;: 1280 FEET/SECOND;: 606 JOULES\" \"\" 0.560000 0.551111 0.840000 0.853333 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc6\" \"#: \\$$_menu_money_item6;\" \"\" 0.560000 0.551111 0.840000 0.853333 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc7\" \"#: \\$$_menu_money_item7;\" \"\" 0.560000 0.551111 0.840000 0.853333 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc8\" \"#: \\$$_menu_money_item8;\" \"\" 0.560000 0.551111 0.840000 0.853333 240 180 24 255 4\r\n\r\ntouch_addbutton \"_menu_confirm\" \"*white\" \"+menu_confirm\" 0.62 0.871111 0.84 0.924444 0 0 0 150 260\r\ntouch_addbutton \"_menu_confirm_txt\" \"#BUY THE ITEM\" \"\" 0.63 0.888889 0.84 0.924444 255 174 0 255 4\r\n\r\ntouch_addbutton \"_menu_frame_txt_data1_1\" \"#PRICE\" \"\" 0.39 0.551111 0.56 0.586667 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data1_2\" \"#COUNTRY OF ORIGIN\" \"\" 0.39 0.586667 0.56 0.622222 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data1_3\" \"#CALIBER\" \"\" 0.39 0.622222 0.56 0.657778 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data1_4\" \"#CLIP CAPACITY\" \"\" 0.39 0.657778 0.56 0.693333 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data1_5\" \"#RATE OF FIRE\" \"\" 0.39 0.693333 0.56 0.728889 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data1_6\" \"#WEIGHT (LOADED)\" \"\" 0.39 0.728889 0.56 0.764444 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data1_7\" \"#PROJECTILE WEIGHT\" \"\" 0.39 0.764444 0.56 0.8 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data1_8\" \"#MUZZLE VELOCITY\" \"\" 0.39 0.8 0.56 0.835556 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data1_9\" \"#MUZZLE ENERGY\" \"\" 0.39 0.835556 0.56 0.871111 240 180 24 255 4\r\n\r\ntouch_addbutton \"_menu_frame_txt_data2_1\" \"#PRICE\" \"\" 0.39 0.551111 0.56 0.586667 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data2_2\" \"#COUNTRY OF ORIGIN\" \"\" 0.39 0.586667 0.56 0.622222 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data2_3\" \"#CALIBER\" \"\" 0.39 0.622222 0.56 0.657778 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data2_4\" \"#CLIP CAPACITY\" \"\" 0.39 0.657778 0.56 0.693333 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data2_5\" \"#RATE OF FIRE\" \"\" 0.39 0.693333 0.56 0.728889 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data2_6\" \"#WEIGHT (EMPTY)\" \"\" 0.39 0.728889 0.56 0.764444 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data2_7\" \"#PROJECTILE WEIGHT\" \"\" 0.39 0.764444 0.56 0.8 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data2_8\" \"#MUZZLE VELOCITY\" \"\" 0.39 0.8 0.56 0.835556 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data2_9\" \"#MUZZLE ENERGY\" \"\" 0.39 0.835556 0.56 0.871111 240 180 24 255 4\r\n\r\ntouch_addbutton \"_menu_frame_txt_desc1_1\" \"#: \\$$_menu_money_item1\" \"\" 0.56 0.551111 0.84 0.586667 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc1_2\" \"#: AUSTRIA\" \"\" 0.56 0.586667 0.84 0.622222 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc1_3\" \"#: 9MM PARABELLUM\" \"\" 0.56 0.622222 0.84 0.657778 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc1_4\" \"#: 20 ROUNDS\" \"\" 0.56 0.657778 0.84 0.693333 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc1_5\" \"#: N/A\" \"\" 0.56 0.693333 0.84 0.728889 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc1_6\" \"#: 0.9KG\" \"\" 0.56 0.728889 0.84 0.764444 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc1_7\" \"#: 8 GRAMS\" \"\" 0.56 0.764444 0.84 0.8 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc1_8\" \"#: 1132 FEET/SECOND\" \"\" 0.56 0.8 0.84 0.835556 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc1_9\" \"#: 475 JOULES\" \"\" 0.56 0.835556 0.84 0.871111 240 180 24 255 4\r\n\r\ntouch_addbutton \"_menu_frame_txt_desc2_1\" \"#: \\$$_menu_money_item2\" \"\" 0.56 0.551111 0.84 0.586667 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc2_2\" \"#: GERMANY\" \"\" 0.56 0.586667 0.84 0.622222 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc2_3\" \"#: .45 ACP\" \"\" 0.56 0.622222 0.84 0.657778 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc2_4\" \"#: 12 ROUNDS\" \"\" 0.56 0.657778 0.84 0.693333 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc2_5\" \"#: N/A\" \"\" 0.56 0.693333 0.84 0.728889 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc2_6\" \"#: 1KG\" \"\" 0.56 0.728889 0.84 0.764444 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc2_7\" \"#: 15.2 GRAMS\" \"\" 0.56 0.764444 0.84 0.8 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc2_8\" \"#: 886 FEET/SECOND\" \"\" 0.56 0.8 0.84 0.835556 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc2_9\" \"#: 553 JOULES\" \"\" 0.56 0.835556 0.84 0.871111 240 180 24 255 4\r\n\r\ntouch_addbutton \"_menu_frame_txt_desc3_1\" \"#: \\$$_menu_money_item3\" \"\" 0.56 0.551111 0.84 0.586667 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc3_2\" \"#: SWITZERLAND/GERMANY\" \"\" 0.56 0.586667 0.84 0.622222 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc3_3\" \"#: .357 SIG\" \"\" 0.56 0.622222 0.84 0.657778 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc3_4\" \"#: 13 ROUNDS\" \"\" 0.56 0.657778 0.84 0.693333 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc3_5\" \"#: N/A\" \"\" 0.56 0.693333 0.84 0.728889 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc3_6\" \"#: 1.03KG\" \"\" 0.56 0.728889 0.84 0.764444 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc3_7\" \"#: 8.1 GRAMS\" \"\" 0.56 0.764444 0.84 0.8 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc3_8\" \"#: 1400 FEET/SECOND\" \"\" 0.56 0.8 0.84 0.835556 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc3_9\" \"#: 600 JOULES\" \"\" 0.56 0.835556 0.84 0.871111 240 180 24 255 4\r\n\r\ntouch_addbutton \"_menu_frame_txt_desc4_1\" \"#: \\$$_menu_money_item4\" \"\" 0.56 0.551111 0.84 0.586667 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc4_2\" \"#: ISRAEL\" \"\" 0.56 0.586667 0.84 0.622222 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc4_3\" \"#: .50 ACTION EXPRESS\" \"\" 0.56 0.622222 0.84 0.657778 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc4_4\" \"#: 7 ROUNDS\" \"\" 0.56 0.657778 0.84 0.693333 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc4_5\" \"#: N/A\" \"\" 0.56 0.693333 0.84 0.728889 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc4_6\" \"#: 1.8KG\" \"\" 0.56 0.728889 0.84 0.764444 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc4_7\" \"#: 19.4 GRAMS\" \"\" 0.56 0.764444 0.84 0.8 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc4_8\" \"#: 1380 FEET/SECOND\" \"\" 0.56 0.8 0.84 0.835556 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc4_9\" \"#: 1650 JOULES\" \"\" 0.56 0.835556 0.84 0.871111 240 180 24 255 4\r\n\r\ntouch_addbutton \"_menu_frame_txt_desc5_1\" \"#: \\$$_menu_money_item5\" \"\" 0.56 0.551111 0.84 0.586667 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc5_2\" \"#: ITALY\" \"\" 0.56 0.586667 0.84 0.622222 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc5_3\" \"#: .40 S&&W\" \"\" 0.56 0.622222 0.84 0.657778 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc5_4\" \"#: 15 ROUNDS\" \"\" 0.56 0.657778 0.84 0.693333 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc5_5\" \"#: N/A\" \"\" 0.56 0.693333 0.84 0.728889 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc5_6\" \"#: 0.618KG\" \"\" 0.56 0.728889 0.84 0.764444 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc5_7\" \"#: 8 GRAMS\" \"\" 0.56 0.764444 0.84 0.8 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc5_8\" \"#: 1280 FEET/SECOND\" \"\" 0.56 0.8 0.84 0.835556 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc5_9\" \"#: 606 JOULES\" \"\" 0.56 0.835556 0.84 0.871111 240 180 24 255 4\r\n\r\n//touch_addbutton \"_menu_frame_txt_desc6_1\" \"#: \" \"\" 0.56 0.551111 0.84 0.586667 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc6_2\" \"#: \" \"\" 0.56 0.586667 0.84 0.622222 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc6_3\" \"#: \" \"\" 0.56 0.622222 0.84 0.657778 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc6_4\" \"#: \" \"\" 0.56 0.657778 0.84 0.693333 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc6_5\" \"#: \" \"\" 0.56 0.693333 0.84 0.728889 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc6_6\" \"#: \" \"\" 0.56 0.728889 0.84 0.764444 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc6_7\" \"#: \" \"\" 0.56 0.764444 0.84 0.8 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc6_8\" \"#: \" \"\" 0.56 0.8 0.84 0.835556 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc6_9\" \"#: \" \"\" 0.56 0.835556 0.84 0.871111 240 180 24 255 4\r\n\r\n//touch_addbutton \"_menu_frame_txt_desc7_1\" \"#: \" \"\" 0.56 0.551111 0.84 0.586667 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc7_2\" \"#: \" \"\" 0.56 0.586667 0.84 0.622222 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc7_3\" \"#: \" \"\" 0.56 0.622222 0.84 0.657778 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc7_4\" \"#: \" \"\" 0.56 0.657778 0.84 0.693333 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc7_5\" \"#: \" \"\" 0.56 0.693333 0.84 0.728889 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc7_6\" \"#: \" \"\" 0.56 0.728889 0.84 0.764444 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc7_7\" \"#: \" \"\" 0.56 0.764444 0.84 0.8 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc7_8\" \"#: \" \"\" 0.56 0.8 0.84 0.835556 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc7_9\" \"#: \" \"\" 0.56 0.835556 0.84 0.871111 240 180 24 255 4\r\n\r\n//touch_addbutton \"_menu_frame_txt_desc8_1\" \"#: \" \"\" 0.56 0.551111 0.84 0.586667 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc8_2\" \"#: \" \"\" 0.56 0.586667 0.84 0.622222 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc8_3\" \"#: \" \"\" 0.56 0.622222 0.84 0.657778 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc8_4\" \"#: \" \"\" 0.56 0.657778 0.84 0.693333 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc8_5\" \"#: \" \"\" 0.56 0.693333 0.84 0.728889 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc8_6\" \"#: \" \"\" 0.56 0.728889 0.84 0.764444 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc8_7\" \"#: \" \"\" 0.56 0.764444 0.84 0.8 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc8_8\" \"#: \" \"\" 0.56 0.8 0.84 0.835556 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc8_9\" \"#: \" \"\" 0.56 0.835556 0.84 0.871111 240 180 24 255 4\r\n\r\ntouch_addbutton \"_menu_txt_money\" \"#YOU HAVE \\$$cscl_currentmoney\" \"_menu_refresh\" 0.170000 0.106667 0.890000 0.160000 255 174 0 255 4\r\nalias _menu_refresh \"exec touch/buy_pistol_t.cfg\"\r\n\r\nalias _menu_none \"touch_setcolor _menu_slot* 0 0 0 150; touch_hide _menu_frame_icn_class*; touch_hide _menu_frame_txt_data*; touch_hide _menu_frame_txt_desc*; touch_hide _menu_confirm*\"\r\n_menu_none\r\n\r\n//alias +menu_slot0 \"touch_setcolor _menu_slot0 255 174 0 150\"\r\n//alias -menu_slot0 \"touch_setcolor _menu_slot0 0 0 0 150\"\r\n//alias _menu_select_slot1 \"_menu_none; touch_setcolor _menu_slot1 255 174 0 150; touch_show _menu_frame_icn_class1; touch_show _menu_frame_txt_desc1; if $cscl_currentmoney>=0;:_menu_show_confirm ; alias _menu_confirmed joinclass 1\"\r\n\r\nalias +menu_slot0 \"_click; touch_setcolor _menu_slot0 255 174 0 150\"\r\nalias -menu_slot0 \"touch_setcolor _menu_slot0 0 0 0 150; _erase_frame\"\r\nif $buymenu_stayon >= 1;:alias -menu_slot0 \"touch_setcolor _menu_slot0 0 0 0 150; _erase_frame; buy\"\r\n\r\nalias _menu_confirmed \"\"\r\nalias _menu_show_confirm \"touch_show _menu_confirm*\"\r\n\r\nalias _menu_select_slot1 \"_click; _menu_none; touch_setcolor _menu_slot1 255 174 0 150; touch_show _menu_frame_icn_class1; touch_show _menu_frame_txt_data1; touch_show _menu_frame_txt_desc1; if $cscl_currentmoney >= $_menu_money_item1;:_menu_show_confirm ; alias _menu_confirmed glock\"\r\nalias _menu_select_slot2 \"_click; _menu_none; touch_setcolor _menu_slot2 255 174 0 150; touch_show _menu_frame_icn_class2; touch_show _menu_frame_txt_data2; touch_show _menu_frame_txt_desc2; if $cscl_currentmoney >= $_menu_money_item2;:_menu_show_confirm ; alias _menu_confirmed usp\"\r\nalias _menu_select_slot3 \"_click; _menu_none; touch_setcolor _menu_slot3 255 174 0 150; touch_show _menu_frame_icn_class3; touch_show _menu_frame_txt_data1; touch_show _menu_frame_txt_desc3; if $cscl_currentmoney >= $_menu_money_item3;:_menu_show_confirm ; alias _menu_confirmed p228\"\r\nalias _menu_select_slot4 \"_click; _menu_none; touch_setcolor _menu_slot4 255 174 0 150; touch_show _menu_frame_icn_class4; touch_show _menu_frame_txt_data1; touch_show _menu_frame_txt_desc4; if $cscl_currentmoney >= $_menu_money_item4;:_menu_show_confirm ; alias _menu_confirmed deagle\"\r\nalias _menu_select_slot5 \"_click; _menu_none; touch_setcolor _menu_slot5 255 174 0 150; touch_show _menu_frame_icn_class5; touch_show _menu_frame_txt_data1; touch_show _menu_frame_txt_desc5; if $cscl_currentmoney >= $_menu_money_item5;:_menu_show_confirm ; alias _menu_confirmed elites\"\r\n//alias _menu_select_slot6 \"_click; _menu_none; touch_setcolor _menu_slot6 255 174 0 150; touch_show _menu_frame_icn_class6; touch_show _menu_frame_txt_data1; touch_show _menu_frame_txt_desc6; if $cscl_currentmoney >= $_menu_money_item6;:_menu_show_confirm ; alias _menu_confirmed \"\r\n//alias _menu_select_slot7 \"_click; _menu_none; touch_setcolor _menu_slot7 255 174 0 150; touch_show _menu_frame_icn_class7; touch_show _menu_frame_txt_data1; touch_show _menu_frame_txt_desc7; if $cscl_currentmoney >= $_menu_money_item7;:_menu_show_confirm ; alias _menu_confirmed \"\r\n//alias _menu_select_slot8 \"_click; _menu_none; touch_setcolor _menu_slot8 255 174 0 150; touch_show _menu_frame_icn_class8; touch_show _menu_frame_txt_data1; touch_show _menu_frame_txt_desc8; if $cscl_currentmoney >= $_menu_money_item8;:_menu_show_confirm ; alias _menu_confirmed \"\r\n\r\nalias +menu_confirm \"_click; touch_setcolor _menu_confirm 255 174 0 150\"\r\nalias -menu_confirm \"touch_setcolor _menu_confirm 0 0 0 150; _menu_confirmed; wait; wait; _erase_frame\"\r\n"
  },
  {
    "path": "3rdparty/cs16client-extras/touch/buy_rifle_ct.cfg",
    "content": "// Coded by Alprnn357\r\ntouch_setclientonly 1\r\ncmd_scripting 1\r\ntouch_set_stroke 1 255 174 0 150\r\n\r\nalias _erase_frame \"touch_removebutton _menu_*; _menu_off; slot10\"\r\nalias _menu_off \"touch_setclientonly 0\"\r\nalias _click \"play media/launch_select1.wav; vibrate 30\"\r\n\r\ntouch_addbutton \"_menu_bg_crn4\" \"gfx/vgui/round_corner_se.tga\" \"\" 0.880000 0.924444 0.900000 0.960000 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_crn2\" \"gfx/vgui/round_corner_ne.tga\" \"\" 0.880000 0.035556 0.900000 0.071111 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_crn1\" \"gfx/vgui/round_corner_nw.tga\" \"\" 0.100000 0.035556 0.120000 0.071111 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_crn3\" \"gfx/vgui/round_corner_sw.tga\" \"\" 0.100000 0.924444 0.120000 0.960000 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_top1\" \"*black\" \"\" 0.120000 0.035556 0.880000 0.071111 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_top2\" \"*black\" \"\" 0.100000 0.071111 0.900000 0.160000 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_bottom\" \"*black\" \"\" 0.120000 0.924444 0.880000 0.960000 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_body\" \"*black\" \"\" 0.100000 0.165000 0.900000 0.924444 0 0 0 150 6\r\nif $menu_bg_fill >= 1;:touch_removebutton _menu_bg_*;:touch_addbutton _menu_bg_body *black \"\" 0 0 1 1 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_icn_logo\" \"gfx/vgui/cs_logo.tga\" \"\" 0.110000 0.053333 0.160000 0.142222 255 174 0 255 6\r\ntouch_addbutton \"_menu_bg_txt_logo\" \"#BUY RIFLES (PRIMARY WEAPON)\" \"\" 0.170000 0.071111 0.890000 0.142222 255 174 0 255 6\r\n\r\n//touch_addbutton \"_menu_txt_title\" \"#THE TITLE\" \"\" 0.140000 0.177778 0.860000 0.213333 255 174 0 255 4\r\ntouch_addbutton \"_menu_slot1\" \"*white\" \"_menu_select_slot1\" 0.140000 0.213333 0.360000 0.266667 0 0 0 150 260\r\ntouch_addbutton \"_menu_txt_slot1\" \"#1 CLARION 5.56\" \"\" 0.150000 0.231111 0.360000 0.266667 255 174 0 255 4\r\ntouch_addbutton \"_menu_slot2\" \"*white\" \"_menu_select_slot2\" 0.140000 0.284444 0.360000 0.337778 0 0 0 150 260\r\ntouch_addbutton \"_menu_txt_slot2\" \"#2 SCHMIDT SCOUT\" \"\" 0.150000 0.302222 0.360000 0.337778 255 174 0 255 4\r\ntouch_addbutton \"_menu_slot3\" \"*white\" \"_menu_select_slot3\" 0.140000 0.355556 0.360000 0.408889 0 0 0 150 260\r\ntouch_addbutton \"_menu_txt_slot3\" \"#3 MAVERICK M4A1 CARBINE\" \"\" 0.150000 0.373333 0.360000 0.408889 255 174 0 255 4\r\ntouch_addbutton \"_menu_slot4\" \"*white\" \"_menu_select_slot4\" 0.140000 0.426667 0.360000 0.480000 0 0 0 150 260\r\ntouch_addbutton \"_menu_txt_slot4\" \"#4 BULLPUP\" \"\" 0.150000 0.444444 0.360000 0.480000 255 174 0 255 4\r\ntouch_addbutton \"_menu_slot5\" \"*white\" \"_menu_select_slot5\" 0.140000 0.497778 0.360000 0.551111 0 0 0 150 260\r\ntouch_addbutton \"_menu_txt_slot5\" \"#5 ES KRIEG 550 COMMANDO\" \"\" 0.150000 0.515556 0.360000 0.551111 255 174 0 255 4\r\ntouch_addbutton \"_menu_slot6\" \"*white\" \"_menu_select_slot6\" 0.140000 0.568889 0.360000 0.622222 0 0 0 150 260\r\ntouch_addbutton \"_menu_txt_slot6\" \"#6 MAGNUM SNIPER RIFLE\" \"\" 0.150000 0.586667 0.360000 0.622222 255 174 0 255 4\r\n//touch_addbutton \"_menu_slot7\" \"*white\" \"_menu_select_slot7\" 0.140000 0.640000 0.360000 0.693333 0 0 0 150 260\r\n//touch_addbutton \"_menu_txt_slot7\" \"#7 SLOT\" \"\" 0.150000 0.657778 0.360000 0.693333 255 174 0 255 4\r\n//touch_addbutton \"_menu_slot8\" \"*white\" \"_menu_select_slot8\" 0.140000 0.711111 0.360000 0.764444 0 0 0 150 260\r\n//touch_addbutton \"_menu_txt_slot8\" \"#8 SLOT\" \"\" 0.150000 0.728889 0.360000 0.764444 255 174 0 255 4\r\n//touch_addbutton \"_menu_slot9\" \"*white\" \"\" 0.140000 0.782222 0.360000 0.835556 0 0 0 150 260\r\n//touch_addbutton \"_menu_txt_slot9\" \"#9 SLOT\" \"\" 0.150000 0.800000 0.360000 0.835556 255 174 0 255 4\r\ntouch_addbutton \"_menu_slot0\" \"*white\" \"+menu_slot0\" 0.14 0.871111 0.36 0.924444 0 0 0 150 260\r\ntouch_addbutton \"_menu_txt_slot0\" \"#0 CANCEL\" \"\" 0.15 0.888889 0.36 0.924444 255 174 0 255 4\r\n\r\nset _menu_money_item1 \"2250\"; if $cscl_currentmoney < $_menu_money_item1;: touch_setcolor _menu_txt_slot1 129 85 0 255\r\nset _menu_money_item2 \"2750\"; if $cscl_currentmoney < $_menu_money_item2;: touch_setcolor _menu_txt_slot2 129 85 0 255\r\nset _menu_money_item3 \"3100\"; if $cscl_currentmoney < $_menu_money_item3;: touch_setcolor _menu_txt_slot3 129 85 0 255\r\nset _menu_money_item4 \"3500\"; if $cscl_currentmoney < $_menu_money_item4;: touch_setcolor _menu_txt_slot4 129 85 0 255\r\nset _menu_money_item5 \"4200\"; if $cscl_currentmoney < $_menu_money_item5;: touch_setcolor _menu_txt_slot5 129 85 0 255\r\nset _menu_money_item6 \"4750\"; if $cscl_currentmoney < $_menu_money_item6;: touch_setcolor _menu_txt_slot6 129 85 0 255\r\n//set _menu_money_item7 \"\"; if $cscl_currentmoney < $_menu_money_item7;: touch_setcolor _menu_txt_slot7 129 85 0 255\r\n//set _menu_money_item8 \"\"; if $cscl_currentmoney < $_menu_money_item8;: touch_setcolor _menu_txt_slot8 129 85 0 255\r\n\r\ntouch_addbutton \"_menu_frame\" \"*white\" \"\" 0.390000 0.213333 0.840000 0.551111 0 0 0 150 260\r\ntouch_addbutton \"_menu_frame_icn_class1\" \"gfx/vgui/famas.tga\" \"\" 0.430000 0.285333 0.810000 0.479111 255 255 255 255 4\r\ntouch_addbutton \"_menu_frame_icn_class2\" \"gfx/vgui/scout.tga\" \"\" 0.430000 0.285333 0.810000 0.479111 255 255 255 255 4\r\ntouch_addbutton \"_menu_frame_icn_class3\" \"gfx/vgui/m4a1.tga\" \"\" 0.430000 0.285333 0.810000 0.479111 255 255 255 255 4\r\ntouch_addbutton \"_menu_frame_icn_class4\" \"gfx/vgui/aug.tga\" \"\" 0.430000 0.285333 0.810000 0.479111 255 255 255 255 4\r\ntouch_addbutton \"_menu_frame_icn_class5\" \"gfx/vgui/sg550.tga\" \"\" 0.430000 0.285333 0.810000 0.479111 255 255 255 255 4\r\ntouch_addbutton \"_menu_frame_icn_class6\" \"gfx/vgui/awp.tga\" \"\" 0.430000 0.285333 0.810000 0.479111 255 255 255 255 4\r\n//touch_addbutton \"_menu_frame_icn_class7\" \"\" \"\" 0.430000 0.285333 0.810000 0.479111 255 255 255 255 4\r\n//touch_addbutton \"_menu_frame_icn_class8\" \"\" \"\" 0.430000 0.285333 0.810000 0.479111 255 255 255 255 4\r\n\r\ntouch_addbutton \"_menu_confirm\" \"*white\" \"+menu_confirm\" 0.62 0.871111 0.84 0.924444 0 0 0 150 260\r\ntouch_addbutton \"_menu_confirm_txt\" \"#BUY THE ITEM\" \"\" 0.63 0.888889 0.84 0.924444 255 174 0 255 4\r\n\r\ntouch_addbutton \"_menu_frame_txt_data1_1\" \"#PRICE\" \"\" 0.39 0.551111 0.56 0.586667 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data1_2\" \"#COUNTRY OF ORIGIN\" \"\" 0.39 0.586667 0.56 0.622222 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data1_3\" \"#CALIBER\" \"\" 0.39 0.622222 0.56 0.657778 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data1_4\" \"#CLIP CAPACITY\" \"\" 0.39 0.657778 0.56 0.693333 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data1_5\" \"#RATE OF FIRE\" \"\" 0.39 0.693333 0.56 0.728889 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data1_6\" \"#WEIGHT (LOADED)\" \"\" 0.39 0.728889 0.56 0.764444 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data1_7\" \"#PROJECTILE WEIGHT\" \"\" 0.39 0.764444 0.56 0.8 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data1_8\" \"#MUZZLE VELOCITY\" \"\" 0.39 0.8 0.56 0.835556 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data1_9\" \"#MUZZLE ENERGY\" \"\" 0.39 0.835556 0.56 0.871111 240 180 24 255 4\r\n\r\ntouch_addbutton \"_menu_frame_txt_data2_1\" \"#PRICE\" \"\" 0.39 0.551111 0.56 0.586667 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data2_2\" \"#COUNTRY OF ORIGIN\" \"\" 0.39 0.586667 0.56 0.622222 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data2_3\" \"#CALIBER\" \"\" 0.39 0.622222 0.56 0.657778 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data2_4\" \"#CLIP CAPACITY\" \"\" 0.39 0.657778 0.56 0.693333 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data2_5\" \"#RATE OF FIRE\" \"\" 0.39 0.693333 0.56 0.728889 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data2_6\" \"#WEIGHT (EMPTY)\" \"\" 0.39 0.728889 0.56 0.764444 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data2_7\" \"#PROJECTILE WEIGHT\" \"\" 0.39 0.764444 0.56 0.8 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data2_8\" \"#MUZZLE VELOCITY\" \"\" 0.39 0.8 0.56 0.835556 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data2_9\" \"#MUZZLE ENERGY\" \"\" 0.39 0.835556 0.56 0.871111 240 180 24 255 4\r\n\r\ntouch_addbutton \"_menu_frame_txt_desc1_1\" \"#: \\$$_menu_money_item1\" \"\" 0.56 0.551111 0.84 0.586667 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc1_2\" \"#: FRANCE\" \"\" 0.56 0.586667 0.84 0.622222 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc1_3\" \"#: 5.56 NATO\" \"\" 0.56 0.622222 0.84 0.657778 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc1_4\" \"#: 25 ROUNDS\" \"\" 0.56 0.657778 0.84 0.693333 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc1_5\" \"#: 1100 RPM\" \"\" 0.56 0.693333 0.84 0.728889 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc1_6\" \"#: 3.40KG\" \"\" 0.56 0.728889 0.84 0.764444 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc1_7\" \"#: 4 GRAMS\" \"\" 0.56 0.764444 0.84 0.8 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc1_8\" \"#: 2212 FEET/SECOND\" \"\" 0.56 0.8 0.84 0.835556 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc1_9\" \"#: 1712 JOULES\" \"\" 0.56 0.835556 0.84 0.871111 240 180 24 255 4\r\n\r\ntouch_addbutton \"_menu_frame_txt_desc2_1\" \"#: \\$$_menu_money_item2\" \"\" 0.56 0.551111 0.84 0.586667 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc2_2\" \"#: AUSTRIA\" \"\" 0.56 0.586667 0.84 0.622222 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc2_3\" \"#: 7.62 NATO\" \"\" 0.56 0.622222 0.84 0.657778 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc2_4\" \"#: 10 ROUNDS\" \"\" 0.56 0.657778 0.84 0.693333 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc2_5\" \"#: N/A\" \"\" 0.56 0.693333 0.84 0.728889 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc2_6\" \"#: 3.3KG\" \"\" 0.56 0.728889 0.84 0.764444 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc2_7\" \"#: 8 GRAMS\" \"\" 0.56 0.764444 0.84 0.8 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc2_8\" \"#: 2800 FEET/SECOND\" \"\" 0.56 0.8 0.84 0.835556 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc2_9\" \"#: 2200 JOULES\" \"\" 0.56 0.835556 0.84 0.871111 240 180 24 255 4\r\n\r\ntouch_addbutton \"_menu_frame_txt_desc3_1\" \"#: \\$$_menu_money_item3\" \"\" 0.56 0.551111 0.84 0.586667 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc3_2\" \"#: UNITED STATES OF AMERICA\" \"\" 0.56 0.586667 0.84 0.622222 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc3_3\" \"#: 5.56 NATO\" \"\" 0.56 0.622222 0.84 0.657778 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc3_4\" \"#: 30 ROUNDS\" \"\" 0.56 0.657778 0.84 0.693333 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc3_5\" \"#: 685 RPM\" \"\" 0.56 0.693333 0.84 0.728889 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc3_6\" \"#: 3.22KG\" \"\" 0.56 0.728889 0.84 0.764444 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc3_7\" \"#: 4 GRAMS\" \"\" 0.56 0.764444 0.84 0.8 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc3_8\" \"#: 2900 FEET/SECOND\" \"\" 0.56 0.8 0.84 0.835556 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc3_9\" \"#: 1570 JOULES\" \"\" 0.56 0.835556 0.84 0.871111 240 180 24 255 4\r\n\r\ntouch_addbutton \"_menu_frame_txt_desc4_1\" \"#: \\$$_menu_money_item4\" \"\" 0.56 0.551111 0.84 0.586667 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc4_2\" \"#: AUSTRIA\" \"\" 0.56 0.586667 0.84 0.622222 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc4_3\" \"#: 5.56 NATO\" \"\" 0.56 0.622222 0.84 0.657778 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc4_4\" \"#: 30 ROUNDS\" \"\" 0.56 0.657778 0.84 0.693333 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc4_5\" \"#: 727 RPM\" \"\" 0.56 0.693333 0.84 0.728889 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc4_6\" \"#: 4.09KG\" \"\" 0.56 0.728889 0.84 0.764444 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc4_7\" \"#: 4 GRAMS\" \"\" 0.56 0.764444 0.84 0.8 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc4_8\" \"#: 2900 FEET/SECOND\" \"\" 0.56 0.8 0.84 0.835556 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc4_9\" \"#: 1570 JOULES\" \"\" 0.56 0.835556 0.84 0.871111 240 180 24 255 4\r\n\r\ntouch_addbutton \"_menu_frame_txt_desc5_1\" \"#: \\$$_menu_money_item5\" \"\" 0.56 0.551111 0.84 0.586667 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc5_2\" \"#: SWITZERLAND\" \"\" 0.56 0.586667 0.84 0.622222 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc5_3\" \"#: 5.56 NATO\" \"\" 0.56 0.622222 0.84 0.657778 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc5_4\" \"#: 30 ROUNDS\" \"\" 0.56 0.657778 0.84 0.693333 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc5_5\" \"#: N/A\" \"\" 0.56 0.693333 0.84 0.728889 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc5_6\" \"#: 7.02KG\" \"\" 0.56 0.728889 0.84 0.764444 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc5_7\" \"#: 4 GRAMS\" \"\" 0.56 0.764444 0.84 0.8 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc5_8\" \"#: 3100 FEET/SECOND\" \"\" 0.56 0.8 0.84 0.835556 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc5_9\" \"#: 1650 JOULES\" \"\" 0.56 0.835556 0.84 0.871111 240 180 24 255 4\r\n\r\ntouch_addbutton \"_menu_frame_txt_desc6_1\" \"#: \\$$_menu_money_item6\" \"\" 0.56 0.551111 0.84 0.586667 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc6_2\" \"#: UNITED KINGDOM\" \"\" 0.56 0.586667 0.84 0.622222 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc6_3\" \"#: .338 LAPUA MAGNUM\" \"\" 0.56 0.622222 0.84 0.657778 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc6_4\" \"#: 10 ROUNDS\" \"\" 0.56 0.657778 0.84 0.693333 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc6_5\" \"#: N/A\" \"\" 0.56 0.693333 0.84 0.728889 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc6_6\" \"#: 6KG\" \"\" 0.56 0.728889 0.84 0.764444 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc6_7\" \"#: 16.2 GRAMS\" \"\" 0.56 0.764444 0.84 0.8 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc6_8\" \"#: 3000 FEET/SECOND\" \"\" 0.56 0.8 0.84 0.835556 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc6_9\" \"#: 7000 JOULES\" \"\" 0.56 0.835556 0.84 0.871111 240 180 24 255 4\r\n\r\n//touch_addbutton \"_menu_frame_txt_desc7_1\" \"#: \" \"\" 0.56 0.551111 0.84 0.586667 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc7_2\" \"#: \" \"\" 0.56 0.586667 0.84 0.622222 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc7_3\" \"#: \" \"\" 0.56 0.622222 0.84 0.657778 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc7_4\" \"#: \" \"\" 0.56 0.657778 0.84 0.693333 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc7_5\" \"#: \" \"\" 0.56 0.693333 0.84 0.728889 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc7_6\" \"#: \" \"\" 0.56 0.728889 0.84 0.764444 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc7_7\" \"#: \" \"\" 0.56 0.764444 0.84 0.8 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc7_8\" \"#: \" \"\" 0.56 0.8 0.84 0.835556 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc7_9\" \"#: \" \"\" 0.56 0.835556 0.84 0.871111 240 180 24 255 4\r\n\r\n//touch_addbutton \"_menu_frame_txt_desc8_1\" \"#: \" \"\" 0.56 0.551111 0.84 0.586667 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc8_2\" \"#: \" \"\" 0.56 0.586667 0.84 0.622222 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc8_3\" \"#: \" \"\" 0.56 0.622222 0.84 0.657778 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc8_4\" \"#: \" \"\" 0.56 0.657778 0.84 0.693333 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc8_5\" \"#: \" \"\" 0.56 0.693333 0.84 0.728889 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc8_6\" \"#: \" \"\" 0.56 0.728889 0.84 0.764444 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc8_7\" \"#: \" \"\" 0.56 0.764444 0.84 0.8 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc8_8\" \"#: \" \"\" 0.56 0.8 0.84 0.835556 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc8_9\" \"#: \" \"\" 0.56 0.835556 0.84 0.871111 240 180 24 255 4\r\n\r\ntouch_addbutton \"_menu_txt_money\" \"#YOU HAVE \\$$cscl_currentmoney\" \"_menu_refresh\" 0.170000 0.106667 0.890000 0.160000 255 174 0 255 4\r\nalias _menu_refresh \"exec touch/buy_rifle_ct.cfg\"\r\n\r\nalias _menu_none \"touch_setcolor _menu_slot* 0 0 0 150; touch_hide _menu_frame_icn_class*; touch_hide _menu_frame_txt_data*; touch_hide _menu_frame_txt_desc*; touch_hide _menu_confirm*\"\r\n_menu_none\r\n\r\nalias +menu_slot0 \"_click; touch_setcolor _menu_slot0 255 174 0 150\"\r\nalias -menu_slot0 \"touch_setcolor _menu_slot0 0 0 0 150; _erase_frame\"\r\nif $buymenu_stayon >= 1;:alias -menu_slot0 \"touch_setcolor _menu_slot0 0 0 0 150; _erase_frame; buy\"\r\n\r\nalias _menu_confirmed \"\"\r\nalias _menu_show_confirm \"touch_show _menu_confirm*\"\r\n\r\nalias _menu_select_slot1 \"_click; _menu_none; touch_setcolor _menu_slot1 255 174 0 150; touch_show _menu_frame_icn_class1; touch_show _menu_frame_txt_data1_*; touch_show _menu_frame_txt_desc1_*; if $cscl_currentmoney >= $_menu_money_item1;:_menu_show_confirm ; alias _menu_confirmed famas\"\r\nalias _menu_select_slot2 \"_click; _menu_none; touch_setcolor _menu_slot2 255 174 0 150; touch_show _menu_frame_icn_class2; touch_show _menu_frame_txt_data2_*; touch_show _menu_frame_txt_desc2_*; if $cscl_currentmoney >= $_menu_money_item2;:_menu_show_confirm ; alias _menu_confirmed scout\"\r\nalias _menu_select_slot3 \"_click; _menu_none; touch_setcolor _menu_slot3 255 174 0 150; touch_show _menu_frame_icn_class3; touch_show _menu_frame_txt_data2_*; touch_show _menu_frame_txt_desc3_*; if $cscl_currentmoney >= $_menu_money_item3;:_menu_show_confirm ; alias _menu_confirmed m4a1\"\r\nalias _menu_select_slot4 \"_click; _menu_none; touch_setcolor _menu_slot4 255 174 0 150; touch_show _menu_frame_icn_class4; touch_show _menu_frame_txt_data1_*; touch_show _menu_frame_txt_desc4_*; if $cscl_currentmoney >= $_menu_money_item4;:_menu_show_confirm ; alias _menu_confirmed aug\"\r\nalias _menu_select_slot5 \"_click; _menu_none; touch_setcolor _menu_slot5 255 174 0 150; touch_show _menu_frame_icn_class5; touch_show _menu_frame_txt_data2_*; touch_show _menu_frame_txt_desc5_*; if $cscl_currentmoney >= $_menu_money_item5;:_menu_show_confirm ; alias _menu_confirmed sg550\"\r\nalias _menu_select_slot6 \"_click; _menu_none; touch_setcolor _menu_slot6 255 174 0 150; touch_show _menu_frame_icn_class6; touch_show _menu_frame_txt_data1_*; touch_show _menu_frame_txt_desc6_*; if $cscl_currentmoney >= $_menu_money_item6;:_menu_show_confirm ; alias _menu_confirmed awp\"\r\n//alias _menu_select_slot7 \"_click; _menu_none; touch_setcolor _menu_slot7 255 174 0 150; touch_show _menu_frame_icn_class7; touch_show _menu_frame_txt_data1_*; touch_show _menu_frame_txt_desc7_*; if $cscl_currentmoney >= $_menu_money_item7;:_menu_show_confirm ; alias _menu_confirmed \"\r\n//alias _menu_select_slot8 \"_click; _menu_none; touch_setcolor _menu_slot8 255 174 0 150; touch_show _menu_frame_icn_class8; touch_show _menu_frame_txt_data1_*; touch_show _menu_frame_txt_desc8_*; if $cscl_currentmoney >= $_menu_money_item8;:_menu_show_confirm ; alias _menu_confirmed \"\r\n\r\nalias +menu_confirm \"_click; touch_setcolor _menu_confirm 255 174 0 150\"\r\nalias -menu_confirm \"touch_setcolor _menu_confirm 0 0 0 150; _menu_confirmed; wait; wait; _erase_frame\"\r\n"
  },
  {
    "path": "3rdparty/cs16client-extras/touch/buy_rifle_t.cfg",
    "content": "// Coded by Alprnn357\r\ntouch_setclientonly 1\r\ncmd_scripting 1\r\ntouch_set_stroke 1 255 174 0 150\r\n\r\nalias _erase_frame \"touch_removebutton _menu_*; _menu_off; slot10\"\r\nalias _menu_off \"touch_setclientonly 0\"\r\nalias _click \"play media/launch_select1.wav; vibrate 30\"\r\n\r\ntouch_addbutton \"_menu_bg_crn4\" \"gfx/vgui/round_corner_se.tga\" \"\" 0.880000 0.924444 0.900000 0.960000 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_crn2\" \"gfx/vgui/round_corner_ne.tga\" \"\" 0.880000 0.035556 0.900000 0.071111 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_crn1\" \"gfx/vgui/round_corner_nw.tga\" \"\" 0.100000 0.035556 0.120000 0.071111 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_crn3\" \"gfx/vgui/round_corner_sw.tga\" \"\" 0.100000 0.924444 0.120000 0.960000 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_top1\" \"*black\" \"\" 0.120000 0.035556 0.880000 0.071111 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_top2\" \"*black\" \"\" 0.100000 0.071111 0.900000 0.160000 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_bottom\" \"*black\" \"\" 0.120000 0.924444 0.880000 0.960000 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_body\" \"*black\" \"\" 0.100000 0.165000 0.900000 0.924444 0 0 0 150 6\r\nif $menu_bg_fill >= 1;:touch_removebutton _menu_bg_*;:touch_addbutton _menu_bg_body *black \"\" 0 0 1 1 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_icn_logo\" \"gfx/vgui/cs_logo.tga\" \"\" 0.110000 0.053333 0.160000 0.142222 255 174 0 255 6\r\ntouch_addbutton \"_menu_bg_txt_logo\" \"#BUY RIFLES (PRIMARY WEAPON)\" \"\" 0.170000 0.071111 0.890000 0.142222 255 174 0 255 6\r\n\r\n//touch_addbutton \"_menu_txt_title\" \"#THE TITLE\" \"\" 0.140000 0.177778 0.860000 0.213333 255 174 0 255 4\r\ntouch_addbutton \"_menu_slot1\" \"*white\" \"_menu_select_slot1\" 0.140000 0.213333 0.360000 0.266667 0 0 0 150 260\r\ntouch_addbutton \"_menu_txt_slot1\" \"#1 IDF DEFENDER\" \"\" 0.150000 0.231111 0.360000 0.266667 255 174 0 255 4\r\ntouch_addbutton \"_menu_slot2\" \"*white\" \"_menu_select_slot2\" 0.140000 0.284444 0.360000 0.337778 0 0 0 150 260\r\ntouch_addbutton \"_menu_txt_slot2\" \"#2 CV-47\" \"\" 0.150000 0.302222 0.360000 0.337778 255 174 0 255 4\r\ntouch_addbutton \"_menu_slot3\" \"*white\" \"_menu_select_slot3\" 0.140000 0.355556 0.360000 0.408889 0 0 0 150 260\r\ntouch_addbutton \"_menu_txt_slot3\" \"#3 SCHMIDT SCOUT\" \"\" 0.150000 0.373333 0.360000 0.408889 255 174 0 255 4\r\ntouch_addbutton \"_menu_slot4\" \"*white\" \"_menu_select_slot4\" 0.140000 0.426667 0.360000 0.480000 0 0 0 150 260\r\ntouch_addbutton \"_menu_txt_slot4\" \"#4 KRIEG 552\" \"\" 0.150000 0.444444 0.360000 0.480000 255 174 0 255 4\r\ntouch_addbutton \"_menu_slot5\" \"*white\" \"_menu_select_slot5\" 0.140000 0.497778 0.360000 0.551111 0 0 0 150 260\r\ntouch_addbutton \"_menu_txt_slot5\" \"#5 MAGNUM SNIPER RIFLE\" \"\" 0.150000 0.515556 0.360000 0.551111 255 174 0 255 4\r\ntouch_addbutton \"_menu_slot6\" \"*white\" \"_menu_select_slot6\" 0.140000 0.568889 0.360000 0.622222 0 0 0 150 260\r\ntouch_addbutton \"_menu_txt_slot6\" \"#6 D3/AU-1\" \"\" 0.150000 0.586667 0.360000 0.622222 255 174 0 255 4\r\n//touch_addbutton \"_menu_slot7\" \"*white\" \"_menu_select_slot7\" 0.140000 0.640000 0.360000 0.693333 0 0 0 150 260\r\n//touch_addbutton \"_menu_txt_slot7\" \"#7 SLOT\" \"\" 0.150000 0.657778 0.360000 0.693333 255 174 0 255 4\r\n//touch_addbutton \"_menu_slot8\" \"*white\" \"_menu_select_slot8\" 0.140000 0.711111 0.360000 0.764444 0 0 0 150 260\r\n//touch_addbutton \"_menu_txt_slot8\" \"#8 SLOT\" \"\" 0.150000 0.728889 0.360000 0.764444 255 174 0 255 4\r\n//touch_addbutton \"_menu_slot9\" \"*white\" \"\" 0.140000 0.782222 0.360000 0.835556 0 0 0 150 260\r\n//touch_addbutton \"_menu_txt_slot9\" \"#9 SLOT\" \"\" 0.150000 0.800000 0.360000 0.835556 255 174 0 255 4\r\ntouch_addbutton \"_menu_slot0\" \"*white\" \"+menu_slot0\" 0.14 0.871111 0.36 0.924444 0 0 0 150 260\r\ntouch_addbutton \"_menu_txt_slot0\" \"#0 CANCEL\" \"\" 0.15 0.888889 0.36 0.924444 255 174 0 255 4\r\n\r\nset _menu_money_item1 \"2000\"; if $cscl_currentmoney < $_menu_money_item1;: touch_setcolor _menu_txt_slot1 129 85 0 255\r\nset _menu_money_item2 \"2500\"; if $cscl_currentmoney < $_menu_money_item2;: touch_setcolor _menu_txt_slot2 129 85 0 255\r\nset _menu_money_item3 \"2750\"; if $cscl_currentmoney < $_menu_money_item3;: touch_setcolor _menu_txt_slot3 129 85 0 255\r\nset _menu_money_item4 \"3500\"; if $cscl_currentmoney < $_menu_money_item4;: touch_setcolor _menu_txt_slot4 129 85 0 255\r\nset _menu_money_item5 \"4750\"; if $cscl_currentmoney < $_menu_money_item5;: touch_setcolor _menu_txt_slot5 129 85 0 255\r\nset _menu_money_item6 \"5000\"; if $cscl_currentmoney < $_menu_money_item6;: touch_setcolor _menu_txt_slot6 129 85 0 255\r\n//set _menu_money_item7 \"\"; if $cscl_currentmoney < $_menu_money_item7;: touch_setcolor _menu_txt_slot7 129 85 0 255\r\n//set _menu_money_item8 \"\"; if $cscl_currentmoney < $_menu_money_item8;: touch_setcolor _menu_txt_slot8 129 85 0 255\r\n\r\ntouch_addbutton \"_menu_frame\" \"*white\" \"\" 0.390000 0.213333 0.840000 0.551111 0 0 0 150 260\r\ntouch_addbutton \"_menu_frame_icn_class1\" \"gfx/vgui/galil.tga\" \"\" 0.430000 0.285333 0.810000 0.479111 255 255 255 255 4\r\ntouch_addbutton \"_menu_frame_icn_class2\" \"gfx/vgui/ak47.tga\" \"\" 0.430000 0.285333 0.810000 0.479111 255 255 255 255 4\r\ntouch_addbutton \"_menu_frame_icn_class3\" \"gfx/vgui/scout.tga\" \"\" 0.430000 0.285333 0.810000 0.479111 255 255 255 255 4\r\ntouch_addbutton \"_menu_frame_icn_class4\" \"gfx/vgui/sg552.tga\" \"\" 0.430000 0.285333 0.810000 0.479111 255 255 255 255 4\r\ntouch_addbutton \"_menu_frame_icn_class5\" \"gfx/vgui/awp.tga\" \"\" 0.430000 0.285333 0.810000 0.479111 255 255 255 255 4\r\ntouch_addbutton \"_menu_frame_icn_class6\" \"gfx/vgui/g3sg1.tga\" \"\" 0.430000 0.285333 0.810000 0.479111 255 255 255 255 4\r\n//touch_addbutton \"_menu_frame_icn_class7\" \"\" \"\" 0.430000 0.285333 0.810000 0.479111 255 255 255 255 4\r\n//touch_addbutton \"_menu_frame_icn_class8\" \"\" \"\" 0.430000 0.285333 0.810000 0.479111 255 255 255 255 4\r\n\r\ntouch_addbutton \"_menu_confirm\" \"*white\" \"+menu_confirm\" 0.62 0.871111 0.84 0.924444 0 0 0 150 260\r\ntouch_addbutton \"_menu_confirm_txt\" \"#BUY THE ITEM\" \"\" 0.63 0.888889 0.84 0.924444 255 174 0 255 4\r\n\r\ntouch_addbutton \"_menu_frame_txt_data1_1\" \"#PRICE\" \"\" 0.39 0.551111 0.56 0.586667 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data1_2\" \"#COUNTRY OF ORIGIN\" \"\" 0.39 0.586667 0.56 0.622222 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data1_3\" \"#CALIBER\" \"\" 0.39 0.622222 0.56 0.657778 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data1_4\" \"#CLIP CAPACITY\" \"\" 0.39 0.657778 0.56 0.693333 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data1_5\" \"#RATE OF FIRE\" \"\" 0.39 0.693333 0.56 0.728889 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data1_6\" \"#WEIGHT (LOADED)\" \"\" 0.39 0.728889 0.56 0.764444 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data1_7\" \"#PROJECTILE WEIGHT\" \"\" 0.39 0.764444 0.56 0.8 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data1_8\" \"#MUZZLE VELOCITY\" \"\" 0.39 0.8 0.56 0.835556 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data1_9\" \"#MUZZLE ENERGY\" \"\" 0.39 0.835556 0.56 0.871111 240 180 24 255 4\r\n\r\ntouch_addbutton \"_menu_frame_txt_data2_1\" \"#PRICE\" \"\" 0.39 0.551111 0.56 0.586667 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data2_2\" \"#COUNTRY OF ORIGIN\" \"\" 0.39 0.586667 0.56 0.622222 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data2_3\" \"#CALIBER\" \"\" 0.39 0.622222 0.56 0.657778 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data2_4\" \"#CLIP CAPACITY\" \"\" 0.39 0.657778 0.56 0.693333 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data2_5\" \"#RATE OF FIRE\" \"\" 0.39 0.693333 0.56 0.728889 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data2_6\" \"#WEIGHT (EMPTY)\" \"\" 0.39 0.728889 0.56 0.764444 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data2_7\" \"#PROJECTILE WEIGHT\" \"\" 0.39 0.764444 0.56 0.8 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data2_8\" \"#MUZZLE VELOCITY\" \"\" 0.39 0.8 0.56 0.835556 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data2_9\" \"#MUZZLE ENERGY\" \"\" 0.39 0.835556 0.56 0.871111 240 180 24 255 4\r\n\r\ntouch_addbutton \"_menu_frame_txt_desc1_1\" \"#: \\$$_menu_money_item1\" \"\" 0.56 0.551111 0.84 0.586667 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc1_2\" \"#: ISRAEL\" \"\" 0.56 0.586667 0.84 0.622222 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc1_3\" \"#: .308\" \"\" 0.56 0.622222 0.84 0.657778 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc1_4\" \"#: 35 ROUNDS\" \"\" 0.56 0.657778 0.84 0.693333 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc1_5\" \"#: 675 RPM\" \"\" 0.56 0.693333 0.84 0.728889 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc1_6\" \"#: 4.35KG\" \"\" 0.56 0.728889 0.84 0.764444 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc1_7\" \"#: 4 GRAMS\" \"\" 0.56 0.764444 0.84 0.8 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc1_8\" \"#: 2013 FEET/SECOND\" \"\" 0.56 0.8 0.84 0.835556 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc1_9\" \"#: 1712 JOULES\" \"\" 0.56 0.835556 0.84 0.871111 240 180 24 255 4\r\n\r\ntouch_addbutton \"_menu_frame_txt_desc2_1\" \"#: \\$$_menu_money_item2\" \"\" 0.56 0.551111 0.84 0.586667 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc2_2\" \"#: RUSSIA\" \"\" 0.56 0.586667 0.84 0.622222 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc2_3\" \"#: 7.62 NATO\" \"\" 0.56 0.622222 0.84 0.657778 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc2_4\" \"#: 30 ROUNDS\" \"\" 0.56 0.657778 0.84 0.693333 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc2_5\" \"#: 600 RPM\" \"\" 0.56 0.693333 0.84 0.728889 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc2_6\" \"#: 4.79KG\" \"\" 0.56 0.728889 0.84 0.764444 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc2_7\" \"#: 7.9 GRAMS\" \"\" 0.56 0.764444 0.84 0.8 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc2_8\" \"#: 2329 FEET/SECOND\" \"\" 0.56 0.8 0.84 0.835556 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc2_9\" \"#: 1992 JOULES\" \"\" 0.56 0.835556 0.84 0.871111 240 180 24 255 4\r\n\r\ntouch_addbutton \"_menu_frame_txt_desc3_1\" \"#: \\$$_menu_money_item3\" \"\" 0.56 0.551111 0.84 0.586667 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc3_2\" \"#: AUSTRIA\" \"\" 0.56 0.586667 0.84 0.622222 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc3_3\" \"#: 7.62 NATO\" \"\" 0.56 0.622222 0.84 0.657778 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc3_4\" \"#: 10 ROUNDS\" \"\" 0.56 0.657778 0.84 0.693333 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc3_5\" \"#: N/A\" \"\" 0.56 0.693333 0.84 0.728889 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc3_6\" \"#: 3.3KG\" \"\" 0.56 0.728889 0.84 0.764444 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc3_7\" \"#: 8 GRAMS\" \"\" 0.56 0.764444 0.84 0.8 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc3_8\" \"#: 2800 FEET/SECOND\" \"\" 0.56 0.8 0.84 0.835556 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc3_9\" \"#: 2200 JOULES\" \"\" 0.56 0.835556 0.84 0.871111 240 180 24 255 4\r\n\r\ntouch_addbutton \"_menu_frame_txt_desc4_1\" \"#: \\$$_menu_money_item4\" \"\" 0.56 0.551111 0.84 0.586667 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc4_2\" \"#: SWITZERLAND\" \"\" 0.56 0.586667 0.84 0.622222 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc4_3\" \"#: 5.56 NATO\" \"\" 0.56 0.622222 0.84 0.657778 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc4_4\" \"#: 30 ROUNDS\" \"\" 0.56 0.657778 0.84 0.693333 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc4_5\" \"#: 727 RPM\" \"\" 0.56 0.693333 0.84 0.728889 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc4_6\" \"#: 3.1KG\" \"\" 0.56 0.728889 0.84 0.764444 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc4_7\" \"#: 4 GRAMS\" \"\" 0.56 0.764444 0.84 0.8 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc4_8\" \"#: 2900 FEET/SECOND\" \"\" 0.56 0.8 0.84 0.835556 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc4_9\" \"#: 1570 JOULES\" \"\" 0.56 0.835556 0.84 0.871111 240 180 24 255 4\r\n\r\ntouch_addbutton \"_menu_frame_txt_desc5_1\" \"#: \\$$_menu_money_item5\" \"\" 0.56 0.551111 0.84 0.586667 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc5_2\" \"#: UNITED KINGDOM\" \"\" 0.56 0.586667 0.84 0.622222 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc5_3\" \"#: .338 LAPUA MAGNUM\" \"\" 0.56 0.622222 0.84 0.657778 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc5_4\" \"#: 10 ROUNDS\" \"\" 0.56 0.657778 0.84 0.693333 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc5_5\" \"#: N/A\" \"\" 0.56 0.693333 0.84 0.728889 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc5_6\" \"#: 6KG\" \"\" 0.56 0.728889 0.84 0.764444 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc5_7\" \"#: 16.2 GRAMS\" \"\" 0.56 0.764444 0.84 0.8 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc5_8\" \"#: 3000 FEET/SECOND\" \"\" 0.56 0.8 0.84 0.835556 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc5_9\" \"#: 7000 JOULES\" \"\" 0.56 0.835556 0.84 0.871111 240 180 24 255 4\r\n\r\ntouch_addbutton \"_menu_frame_txt_desc6_1\" \"#: \\$$_menu_money_item6\" \"\" 0.56 0.551111 0.84 0.586667 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc6_2\" \"#: GERMANY\" \"\" 0.56 0.586667 0.84 0.622222 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc6_3\" \"#: 7.62 NATO\" \"\" 0.56 0.622222 0.84 0.657778 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc6_4\" \"#: 20 ROUNDS\" \"\" 0.56 0.657778 0.84 0.693333 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc6_5\" \"#: N/A\" \"\" 0.56 0.693333 0.84 0.728889 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc6_6\" \"#: 4.41KG\" \"\" 0.56 0.728889 0.84 0.764444 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc6_7\" \"#: 8 GRAMS\" \"\" 0.56 0.764444 0.84 0.8 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc6_8\" \"#: 2800 FEET/SECOND\" \"\" 0.56 0.8 0.84 0.835556 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc6_9\" \"#: 2200 JOULES\" \"\" 0.56 0.835556 0.84 0.871111 240 180 24 255 4\r\n\r\n//touch_addbutton \"_menu_frame_txt_desc7_1\" \"#: \" \"\" 0.56 0.551111 0.84 0.586667 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc7_2\" \"#: \" \"\" 0.56 0.586667 0.84 0.622222 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc7_3\" \"#: \" \"\" 0.56 0.622222 0.84 0.657778 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc7_4\" \"#: \" \"\" 0.56 0.657778 0.84 0.693333 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc7_5\" \"#: \" \"\" 0.56 0.693333 0.84 0.728889 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc7_6\" \"#: \" \"\" 0.56 0.728889 0.84 0.764444 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc7_7\" \"#: \" \"\" 0.56 0.764444 0.84 0.8 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc7_8\" \"#: \" \"\" 0.56 0.8 0.84 0.835556 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc7_9\" \"#: \" \"\" 0.56 0.835556 0.84 0.871111 240 180 24 255 4\r\n\r\n//touch_addbutton \"_menu_frame_txt_desc8_1\" \"#: \" \"\" 0.56 0.551111 0.84 0.586667 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc8_2\" \"#: \" \"\" 0.56 0.586667 0.84 0.622222 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc8_3\" \"#: \" \"\" 0.56 0.622222 0.84 0.657778 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc8_4\" \"#: \" \"\" 0.56 0.657778 0.84 0.693333 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc8_5\" \"#: \" \"\" 0.56 0.693333 0.84 0.728889 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc8_6\" \"#: \" \"\" 0.56 0.728889 0.84 0.764444 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc8_7\" \"#: \" \"\" 0.56 0.764444 0.84 0.8 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc8_8\" \"#: \" \"\" 0.56 0.8 0.84 0.835556 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc8_9\" \"#: \" \"\" 0.56 0.835556 0.84 0.871111 240 180 24 255 4\r\n\r\ntouch_addbutton \"_menu_txt_money\" \"#YOU HAVE \\$$cscl_currentmoney\" \"_menu_refresh\" 0.170000 0.106667 0.890000 0.160000 255 174 0 255 4\r\nalias _menu_refresh \"exec touch/buy_rifle_t.cfg\"\r\n\r\nalias _menu_none \"touch_setcolor _menu_slot* 0 0 0 150; touch_hide _menu_frame_icn_class*; touch_hide _menu_frame_txt_data*; touch_hide _menu_frame_txt_desc*; touch_hide _menu_confirm*\"\r\n_menu_none\r\n\r\n//alias +menu_slot0 \"touch_setcolor _menu_slot0 255 174 0 150\"\r\n//alias -menu_slot0 \"touch_setcolor _menu_slot0 0 0 0 150\"\r\n//alias _menu_select_slot1 \"_menu_none; touch_setcolor _menu_slot1 255 174 0 150; touch_show _menu_frame_icn_class1; touch_show _menu_frame_txt_desc1; if $cscl_currentmoney>=0;:_menu_show_confirm ; alias _menu_confirmed joinclass 1\"\r\n\r\nalias +menu_slot0 \"_click; touch_setcolor _menu_slot0 255 174 0 150\"\r\nalias -menu_slot0 \"touch_setcolor _menu_slot0 0 0 0 150; _erase_frame\"\r\nif $buymenu_stayon >= 1;:alias -menu_slot0 \"touch_setcolor _menu_slot0 0 0 0 150; _erase_frame; buy\"\r\n\r\nalias _menu_confirmed \"\"\r\nalias _menu_show_confirm \"touch_show _menu_confirm*\"\r\n\r\nalias _menu_select_slot1 \"_click; _menu_none; touch_setcolor _menu_slot1 255 174 0 150; touch_show _menu_frame_icn_class1; touch_show _menu_frame_txt_data1_*; touch_show _menu_frame_txt_desc1_*; if $cscl_currentmoney >= $_menu_money_item1;:_menu_show_confirm ; alias _menu_confirmed galil\"\r\nalias _menu_select_slot2 \"_click; _menu_none; touch_setcolor _menu_slot2 255 174 0 150; touch_show _menu_frame_icn_class2; touch_show _menu_frame_txt_data2_*; touch_show _menu_frame_txt_desc2_*; if $cscl_currentmoney >= $_menu_money_item2;:_menu_show_confirm ; alias _menu_confirmed ak47\"\r\nalias _menu_select_slot3 \"_click; _menu_none; touch_setcolor _menu_slot3 255 174 0 150; touch_show _menu_frame_icn_class3; touch_show _menu_frame_txt_data2_*; touch_show _menu_frame_txt_desc3_*; if $cscl_currentmoney >= $_menu_money_item3;:_menu_show_confirm ; alias _menu_confirmed scout\"\r\nalias _menu_select_slot4 \"_click; _menu_none; touch_setcolor _menu_slot4 255 174 0 150; touch_show _menu_frame_icn_class4; touch_show _menu_frame_txt_data1_*; touch_show _menu_frame_txt_desc4_*; if $cscl_currentmoney >= $_menu_money_item4;:_menu_show_confirm ; alias _menu_confirmed sg552\"\r\nalias _menu_select_slot5 \"_click; _menu_none; touch_setcolor _menu_slot5 255 174 0 150; touch_show _menu_frame_icn_class5; touch_show _menu_frame_txt_data2_*; touch_show _menu_frame_txt_desc5_*; if $cscl_currentmoney >= $_menu_money_item5;:_menu_show_confirm ; alias _menu_confirmed awp\"\r\nalias _menu_select_slot6 \"_click; _menu_none; touch_setcolor _menu_slot6 255 174 0 150; touch_show _menu_frame_icn_class6; touch_show _menu_frame_txt_data1_*; touch_show _menu_frame_txt_desc6_*; if $cscl_currentmoney >= $_menu_money_item6;:_menu_show_confirm ; alias _menu_confirmed g3sg1\"\r\n//alias _menu_select_slot7 \"_click; _menu_none; touch_setcolor _menu_slot7 255 174 0 150; touch_show _menu_frame_icn_class7; touch_show _menu_frame_txt_data1_*; touch_show _menu_frame_txt_desc7_*; if $cscl_currentmoney >= $_menu_money_item7;:_menu_show_confirm ; alias _menu_confirmed \"\r\n//alias _menu_select_slot8 \"_click; _menu_none; touch_setcolor _menu_slot8 255 174 0 150; touch_show _menu_frame_icn_class8; touch_show _menu_frame_txt_data1_*; touch_show _menu_frame_txt_desc8_*; if $cscl_currentmoney >= $_menu_money_item8;:_menu_show_confirm ; alias _menu_confirmed \"\r\n\r\nalias +menu_confirm \"_click; touch_setcolor _menu_confirm 255 174 0 150\"\r\nalias -menu_confirm \"touch_setcolor _menu_confirm 0 0 0 150; _menu_confirmed; wait; wait; _erase_frame\"\r\n"
  },
  {
    "path": "3rdparty/cs16client-extras/touch/buy_shotgun_ct.cfg",
    "content": "// Coded by Alprnn357\r\ntouch_setclientonly 1\r\ncmd_scripting 1\r\ntouch_set_stroke 1 255 174 0 150\r\n\r\nalias _erase_frame \"touch_removebutton _menu_*; _menu_off; slot10\"\r\nalias _menu_off \"touch_setclientonly 0\"\r\nalias _click \"play media/launch_select1.wav; vibrate 30\"\r\n\r\ntouch_addbutton \"_menu_bg_crn4\" \"gfx/vgui/round_corner_se.tga\" \"\" 0.880000 0.924444 0.900000 0.960000 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_crn2\" \"gfx/vgui/round_corner_ne.tga\" \"\" 0.880000 0.035556 0.900000 0.071111 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_crn1\" \"gfx/vgui/round_corner_nw.tga\" \"\" 0.100000 0.035556 0.120000 0.071111 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_crn3\" \"gfx/vgui/round_corner_sw.tga\" \"\" 0.100000 0.924444 0.120000 0.960000 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_top1\" \"*black\" \"\" 0.120000 0.035556 0.880000 0.071111 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_top2\" \"*black\" \"\" 0.100000 0.071111 0.900000 0.160000 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_bottom\" \"*black\" \"\" 0.120000 0.924444 0.880000 0.960000 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_body\" \"*black\" \"\" 0.100000 0.165000 0.900000 0.924444 0 0 0 150 6\r\nif $menu_bg_fill >= 1;:touch_removebutton _menu_bg_*;:touch_addbutton _menu_bg_body *black \"\" 0 0 1 1 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_icn_logo\" \"gfx/vgui/cs_logo.tga\" \"\" 0.110000 0.053333 0.160000 0.142222 255 174 0 255 6\r\ntouch_addbutton \"_menu_bg_txt_logo\" \"#BUY SHOTGUNS (PRIMARY WEAPON)\" \"\" 0.170000 0.071111 0.890000 0.142222 255 174 0 255 6\r\n\r\n//touch_addbutton \"_menu_txt_title\" \"#THE TITLE\" \"\" 0.140000 0.177778 0.860000 0.213333 255 174 0 255 4\r\ntouch_addbutton \"_menu_slot1\" \"*white\" \"_menu_select_slot1\" 0.140000 0.213333 0.360000 0.266667 0 0 0 150 260\r\ntouch_addbutton \"_menu_txt_slot1\" \"#1 LEONE 12 GAUGE SUPER\" \"\" 0.150000 0.231111 0.360000 0.266667 255 174 0 255 4\r\ntouch_addbutton \"_menu_slot2\" \"*white\" \"_menu_select_slot2\" 0.140000 0.284444 0.360000 0.337778 0 0 0 150 260\r\ntouch_addbutton \"_menu_txt_slot2\" \"#2 LEONE YG1265 AUTO SHOTGUN\" \"\" 0.150000 0.302222 0.370000 0.337778 255 174 0 255 4\r\n//touch_addbutton \"_menu_slot3\" \"*white\" \"_menu_select_slot3\" 0.140000 0.355556 0.360000 0.408889 0 0 0 150 260\r\n//touch_addbutton \"_menu_txt_slot3\" \"#3 SLOT\" \"\" 0.150000 0.373333 0.360000 0.408889 255 174 0 255 4\r\n//touch_addbutton \"_menu_slot4\" \"*white\" \"_menu_select_slot4\" 0.140000 0.426667 0.360000 0.480000 0 0 0 150 260\r\n//touch_addbutton \"_menu_txt_slot4\" \"#4 SLOT\" \"\" 0.150000 0.444444 0.360000 0.480000 255 174 0 255 4\r\n//touch_addbutton \"_menu_slot5\" \"*white\" \"_menu_select_slot5\" 0.140000 0.497778 0.360000 0.551111 0 0 0 150 260\r\n//touch_addbutton \"_menu_txt_slot5\" \"#5 SLOT\" \"\" 0.150000 0.515556 0.360000 0.551111 255 174 0 255 4\r\n//touch_addbutton \"_menu_slot6\" \"*white\" \"_menu_select_slot6\" 0.140000 0.568889 0.360000 0.622222 0 0 0 150 260\r\n//touch_addbutton \"_menu_txt_slot6\" \"#6 SLOT\" \"\" 0.150000 0.586667 0.360000 0.622222 255 174 0 255 4\r\n//touch_addbutton \"_menu_slot7\" \"*white\" \"_menu_select_slot7\" 0.140000 0.640000 0.360000 0.693333 0 0 0 150 260\r\n//touch_addbutton \"_menu_txt_slot7\" \"#7 SLOT\" \"\" 0.150000 0.657778 0.360000 0.693333 255 174 0 255 4\r\n//touch_addbutton \"_menu_slot8\" \"*white\" \"_menu_select_slot8\" 0.140000 0.711111 0.360000 0.764444 0 0 0 150 260\r\n//touch_addbutton \"_menu_txt_slot8\" \"#8 SLOT\" \"\" 0.150000 0.728889 0.360000 0.764444 255 174 0 255 4\r\n//touch_addbutton \"_menu_slot9\" \"*white\" \"\" 0.140000 0.782222 0.360000 0.835556 0 0 0 150 260\r\n//touch_addbutton \"_menu_txt_slot9\" \"#9 SLOT\" \"\" 0.150000 0.800000 0.360000 0.835556 255 174 0 255 4\r\ntouch_addbutton \"_menu_slot0\" \"*white\" \"+menu_slot0\" 0.14 0.871111 0.36 0.924444 0 0 0 150 260\r\ntouch_addbutton \"_menu_txt_slot0\" \"#0 CANCEL\" \"\" 0.15 0.888889 0.36 0.924444 255 174 0 255 4\r\n\r\nset _menu_money_item1 \"1700\"; if $cscl_currentmoney < $_menu_money_item1;: touch_setcolor _menu_txt_slot1 129 85 0 255\r\nset _menu_money_item2 \"3000\"; if $cscl_currentmoney < $_menu_money_item2;: touch_setcolor _menu_txt_slot2 129 85 0 255\r\n//set _menu_money_item3 \"\"; if $cscl_currentmoney < $_menu_money_item3;: touch_setcolor _menu_txt_slot3 129 85 0 255\r\n//set _menu_money_item4 \"\"; if $cscl_currentmoney < $_menu_money_item4;: touch_setcolor _menu_txt_slot4 129 85 0 255\r\n//set _menu_money_item5 \"\"; if $cscl_currentmoney < $_menu_money_item5;: touch_setcolor _menu_txt_slot5 129 85 0 255\r\n//set _menu_money_item6 \"\"; if $cscl_currentmoney < $_menu_money_item6;: touch_setcolor _menu_txt_slot6 129 85 0 255\r\n//set _menu_money_item7 \"\"; if $cscl_currentmoney < $_menu_money_item7;: touch_setcolor _menu_txt_slot7 129 85 0 255\r\n//set _menu_money_item8 \"\"; if $cscl_currentmoney < $_menu_money_item8;: touch_setcolor _menu_txt_slot8 129 85 0 255\r\n\r\ntouch_addbutton \"_menu_frame\" \"*white\" \"\" 0.390000 0.213333 0.840000 0.551111 0 0 0 150 260\r\ntouch_addbutton \"_menu_frame_icn_class1\" \"gfx/vgui/m3.tga\" \"\" 0.430000 0.285333 0.810000 0.479111 255 255 255 255 4\r\ntouch_addbutton \"_menu_frame_icn_class2\" \"gfx/vgui/xm1014.tga\" \"\" 0.430000 0.285333 0.810000 0.479111 255 255 255 255 4\r\n//touch_addbutton \"_menu_frame_icn_class3\" \"\" \"\" 0.430000 0.285333 0.810000 0.479111 255 255 255 255 4\r\n//touch_addbutton \"_menu_frame_icn_class4\" \"\" \"\" 0.430000 0.285333 0.810000 0.479111 255 255 255 255 4\r\n//touch_addbutton \"_menu_frame_icn_class5\" \"\" \"\" 0.430000 0.285333 0.810000 0.479111 255 255 255 255 4\r\n//touch_addbutton \"_menu_frame_icn_class6\" \"\" \"\" 0.430000 0.285333 0.810000 0.479111 255 255 255 255 4\r\n//touch_addbutton \"_menu_frame_icn_class7\" \"\" \"\" 0.430000 0.285333 0.810000 0.479111 255 255 255 255 4\r\n//touch_addbutton \"_menu_frame_icn_class8\" \"\" \"\" 0.430000 0.285333 0.810000 0.479111 255 255 255 255 4\r\n\r\ntouch_addbutton \"_menu_confirm\" \"*white\" \"+menu_confirm\" 0.62 0.871111 0.84 0.924444 0 0 0 150 260\r\ntouch_addbutton \"_menu_confirm_txt\" \"#BUY THE ITEM\" \"\" 0.63 0.888889 0.84 0.924444 255 174 0 255 4\r\n\r\ntouch_addbutton \"_menu_frame_txt_data1_1\" \"#PRICE\" \"\" 0.39 0.551111 0.56 0.586667 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data1_2\" \"#COUNTRY OF ORIGIN\" \"\" 0.39 0.586667 0.56 0.622222 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data1_3\" \"#CALIBER\" \"\" 0.39 0.622222 0.56 0.657778 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data1_4\" \"#CLIP CAPACITY\" \"\" 0.39 0.657778 0.56 0.693333 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data1_5\" \"#RATE OF FIRE\" \"\" 0.39 0.693333 0.56 0.728889 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data1_6\" \"#WEIGHT (LOADED)\" \"\" 0.39 0.728889 0.56 0.764444 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data1_7\" \"#PROJECTILE WEIGHT\" \"\" 0.39 0.764444 0.56 0.8 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data1_8\" \"#MUZZLE VELOCITY\" \"\" 0.39 0.8 0.56 0.835556 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data1_9\" \"#MUZZLE ENERGY\" \"\" 0.39 0.835556 0.56 0.871111 240 180 24 255 4\r\n\r\ntouch_addbutton \"_menu_frame_txt_data2_1\" \"#PRICE\" \"\" 0.39 0.551111 0.56 0.586667 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data2_2\" \"#COUNTRY OF ORIGIN\" \"\" 0.39 0.586667 0.56 0.622222 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data2_3\" \"#CALIBER\" \"\" 0.39 0.622222 0.56 0.657778 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data2_4\" \"#CLIP CAPACITY\" \"\" 0.39 0.657778 0.56 0.693333 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data2_5\" \"#RATE OF FIRE\" \"\" 0.39 0.693333 0.56 0.728889 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data2_6\" \"#WEIGHT (EMPTY)\" \"\" 0.39 0.728889 0.56 0.764444 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data2_7\" \"#PROJECTILE WEIGHT\" \"\" 0.39 0.764444 0.56 0.8 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data2_8\" \"#MUZZLE VELOCITY\" \"\" 0.39 0.8 0.56 0.835556 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data2_9\" \"#MUZZLE ENERGY\" \"\" 0.39 0.835556 0.56 0.871111 240 180 24 255 4\r\n\r\ntouch_addbutton \"_menu_frame_txt_desc1_1\" \"#: \\$$_menu_money_item1\" \"\" 0.56 0.551111 0.84 0.586667 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc1_2\" \"#: ITALY\" \"\" 0.56 0.586667 0.84 0.622222 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc1_3\" \"#: 12 GAUGE\" \"\" 0.56 0.622222 0.84 0.657778 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc1_4\" \"#: 8 ROUNDS\" \"\" 0.56 0.657778 0.84 0.693333 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc1_5\" \"#: N/A\" \"\" 0.56 0.693333 0.84 0.728889 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc1_6\" \"#: 3.5KG\" \"\" 0.56 0.728889 0.84 0.764444 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc1_7\" \"#: 3.8 GRAMS\" \"\" 0.56 0.764444 0.84 0.8 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc1_8\" \"#: 1250 FEET/SECOND\" \"\" 0.56 0.8 0.84 0.835556 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc1_9\" \"#: 2429 JOULES\" \"\" 0.56 0.835556 0.84 0.871111 240 180 24 255 4\r\n\r\ntouch_addbutton \"_menu_frame_txt_desc2_1\" \"#: \\$$_menu_money_item2\" \"\" 0.56 0.551111 0.84 0.586667 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc2_2\" \"#: ITALY\" \"\" 0.56 0.586667 0.84 0.622222 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc2_3\" \"#: 12 GAUGE\" \"\" 0.56 0.622222 0.84 0.657778 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc2_4\" \"#: 7 ROUNDS\" \"\" 0.56 0.657778 0.84 0.693333 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc2_5\" \"#: 400 RPM\" \"\" 0.56 0.693333 0.84 0.728889 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc2_6\" \"#: 4KG\" \"\" 0.56 0.728889 0.84 0.764444 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc2_7\" \"#: 3.8 GRAMS/PELLET\" \"\" 0.56 0.764444 0.84 0.8 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc2_8\" \"#: 1250 FEET/SECOND\" \"\" 0.56 0.8 0.84 0.835556 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc2_9\" \"#: 2429 JOULES\" \"\" 0.56 0.835556 0.84 0.871111 240 180 24 255 4\r\n\r\n//touch_addbutton \"_menu_frame_txt_desc3_1\" \"#: \" \"\" 0.56 0.551111 0.84 0.586667 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc3_2\" \"#: \" \"\" 0.56 0.586667 0.84 0.622222 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc3_3\" \"#: \" \"\" 0.56 0.622222 0.84 0.657778 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc3_4\" \"#: \" \"\" 0.56 0.657778 0.84 0.693333 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc3_5\" \"#: \" \"\" 0.56 0.693333 0.84 0.728889 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc3_6\" \"#: \" \"\" 0.56 0.728889 0.84 0.764444 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc3_7\" \"#: \" \"\" 0.56 0.764444 0.84 0.8 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc3_8\" \"#: \" \"\" 0.56 0.8 0.84 0.835556 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc3_9\" \"#: \" \"\" 0.56 0.835556 0.84 0.871111 240 180 24 255 4\r\n\r\n//touch_addbutton \"_menu_frame_txt_desc4_1\" \"#: \" \"\" 0.56 0.551111 0.84 0.586667 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc4_2\" \"#: \" \"\" 0.56 0.586667 0.84 0.622222 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc4_3\" \"#: \" \"\" 0.56 0.622222 0.84 0.657778 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc4_4\" \"#: \" \"\" 0.56 0.657778 0.84 0.693333 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc4_5\" \"#: \" \"\" 0.56 0.693333 0.84 0.728889 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc4_6\" \"#: \" \"\" 0.56 0.728889 0.84 0.764444 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc4_7\" \"#: \" \"\" 0.56 0.764444 0.84 0.8 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc4_8\" \"#: \" \"\" 0.56 0.8 0.84 0.835556 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc4_9\" \"#: \" \"\" 0.56 0.835556 0.84 0.871111 240 180 24 255 4\r\n\r\n//touch_addbutton \"_menu_frame_txt_desc5_1\" \"#: \" \"\" 0.56 0.551111 0.84 0.586667 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc5_2\" \"#: \" \"\" 0.56 0.586667 0.84 0.622222 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc5_3\" \"#: \" \"\" 0.56 0.622222 0.84 0.657778 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc5_4\" \"#: \" \"\" 0.56 0.657778 0.84 0.693333 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc5_5\" \"#: \" \"\" 0.56 0.693333 0.84 0.728889 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc5_6\" \"#: \" \"\" 0.56 0.728889 0.84 0.764444 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc5_7\" \"#: \" \"\" 0.56 0.764444 0.84 0.8 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc5_8\" \"#: \" \"\" 0.56 0.8 0.84 0.835556 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc5_9\" \"#: \" \"\" 0.56 0.835556 0.84 0.871111 240 180 24 255 4\r\n\r\n//touch_addbutton \"_menu_frame_txt_desc6_1\" \"#: \" \"\" 0.56 0.551111 0.84 0.586667 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc6_2\" \"#: \" \"\" 0.56 0.586667 0.84 0.622222 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc6_3\" \"#: \" \"\" 0.56 0.622222 0.84 0.657778 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc6_4\" \"#: \" \"\" 0.56 0.657778 0.84 0.693333 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc6_5\" \"#: \" \"\" 0.56 0.693333 0.84 0.728889 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc6_6\" \"#: \" \"\" 0.56 0.728889 0.84 0.764444 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc6_7\" \"#: \" \"\" 0.56 0.764444 0.84 0.8 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc6_8\" \"#: \" \"\" 0.56 0.8 0.84 0.835556 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc6_9\" \"#: \" \"\" 0.56 0.835556 0.84 0.871111 240 180 24 255 4\r\n\r\n//touch_addbutton \"_menu_frame_txt_desc7_1\" \"#: \" \"\" 0.56 0.551111 0.84 0.586667 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc7_2\" \"#: \" \"\" 0.56 0.586667 0.84 0.622222 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc7_3\" \"#: \" \"\" 0.56 0.622222 0.84 0.657778 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc7_4\" \"#: \" \"\" 0.56 0.657778 0.84 0.693333 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc7_5\" \"#: \" \"\" 0.56 0.693333 0.84 0.728889 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc7_6\" \"#: \" \"\" 0.56 0.728889 0.84 0.764444 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc7_7\" \"#: \" \"\" 0.56 0.764444 0.84 0.8 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc7_8\" \"#: \" \"\" 0.56 0.8 0.84 0.835556 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc7_9\" \"#: \" \"\" 0.56 0.835556 0.84 0.871111 240 180 24 255 4\r\n\r\n//touch_addbutton \"_menu_frame_txt_desc8_1\" \"#: \" \"\" 0.56 0.551111 0.84 0.586667 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc8_2\" \"#: \" \"\" 0.56 0.586667 0.84 0.622222 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc8_3\" \"#: \" \"\" 0.56 0.622222 0.84 0.657778 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc8_4\" \"#: \" \"\" 0.56 0.657778 0.84 0.693333 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc8_5\" \"#: \" \"\" 0.56 0.693333 0.84 0.728889 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc8_6\" \"#: \" \"\" 0.56 0.728889 0.84 0.764444 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc8_7\" \"#: \" \"\" 0.56 0.764444 0.84 0.8 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc8_8\" \"#: \" \"\" 0.56 0.8 0.84 0.835556 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc8_9\" \"#: \" \"\" 0.56 0.835556 0.84 0.871111 240 180 24 255 4\r\n\r\ntouch_addbutton \"_menu_txt_money\" \"#YOU HAVE \\$$cscl_currentmoney\" \"_menu_refresh\" 0.170000 0.106667 0.890000 0.160000 255 174 0 255 4\r\nalias _menu_refresh \"exec touch/buy_shotgun_ct.cfg\"\r\n\r\nalias _menu_none \"touch_setcolor _menu_slot* 0 0 0 150; touch_hide _menu_frame_icn_class*; touch_hide _menu_frame_txt_data*; touch_hide _menu_frame_txt_desc*; touch_hide _menu_confirm*\"\r\n_menu_none\r\n\r\n//alias +menu_slot0 \"touch_setcolor _menu_slot0 255 174 0 150\"\r\n//alias -menu_slot0 \"touch_setcolor _menu_slot0 0 0 0 150\"\r\n//alias _menu_select_slot1 \"_menu_none; touch_setcolor _menu_slot1 255 174 0 150; touch_show _menu_frame_icn_class1; touch_show _menu_frame_txt_desc1; if $cscl_currentmoney>=0;:_menu_show_confirm ; alias _menu_confirmed joinclass 1\"\r\n\r\nalias +menu_slot0 \"_click; touch_setcolor _menu_slot0 255 174 0 150\"\r\nalias -menu_slot0 \"touch_setcolor _menu_slot0 0 0 0 150; _erase_frame\"\r\nif $buymenu_stayon >= 1;:alias -menu_slot0 \"touch_setcolor _menu_slot0 0 0 0 150; _erase_frame; buy\"\r\n\r\nalias _menu_confirmed \"\"\r\nalias _menu_show_confirm \"touch_show _menu_confirm*\"\r\n\r\nalias _menu_select_slot1 \"_click; _menu_none; touch_setcolor _menu_slot1 255 174 0 150; touch_show _menu_frame_icn_class1; touch_show _menu_frame_txt_data2_*; touch_show _menu_frame_txt_desc1_*; if $cscl_currentmoney >= $_menu_money_item1;:_menu_show_confirm ; alias _menu_confirmed m3\"\r\nalias _menu_select_slot2 \"_click; _menu_none; touch_setcolor _menu_slot2 255 174 0 150; touch_show _menu_frame_icn_class2; touch_show _menu_frame_txt_data2_*; touch_show _menu_frame_txt_desc2_*; if $cscl_currentmoney >= $_menu_money_item2;:_menu_show_confirm ; alias _menu_confirmed xm1014\"\r\n//alias _menu_select_slot3 \"_click; _menu_none; touch_setcolor _menu_slot3 255 174 0 150; touch_show _menu_frame_icn_class3; touch_show _menu_frame_txt_data2_*; touch_show _menu_frame_txt_desc3_*; if $cscl_currentmoney >= $_menu_money_item3;:_menu_show_confirm ; alias _menu_confirmed \"\r\n//alias _menu_select_slot4 \"_click; _menu_none; touch_setcolor _menu_slot4 255 174 0 150; touch_show _menu_frame_icn_class4; touch_show _menu_frame_txt_data1_*; touch_show _menu_frame_txt_desc4_*; if $cscl_currentmoney >= $_menu_money_item4;:_menu_show_confirm ; alias _menu_confirmed \"\r\n//alias _menu_select_slot5 \"_click; _menu_none; touch_setcolor _menu_slot5 255 174 0 150; touch_show _menu_frame_icn_class5; touch_show _menu_frame_txt_data2_*; touch_show _menu_frame_txt_desc5_*; if $cscl_currentmoney >= $_menu_money_item5;:_menu_show_confirm ; alias _menu_confirmed \"\r\n//alias _menu_select_slot6 \"_click; _menu_none; touch_setcolor _menu_slot6 255 174 0 150; touch_show _menu_frame_icn_class6; touch_show _menu_frame_txt_data1_*; touch_show _menu_frame_txt_desc6_*; if $cscl_currentmoney >= $_menu_money_item6;:_menu_show_confirm ; alias _menu_confirmed \"\r\n//alias _menu_select_slot7 \"_click; _menu_none; touch_setcolor _menu_slot7 255 174 0 150; touch_show _menu_frame_icn_class7; touch_show _menu_frame_txt_data1_*; touch_show _menu_frame_txt_desc7_*; if $cscl_currentmoney >= $_menu_money_item7;:_menu_show_confirm ; alias _menu_confirmed \"\r\n//alias _menu_select_slot8 \"_click; _menu_none; touch_setcolor _menu_slot8 255 174 0 150; touch_show _menu_frame_icn_class8; touch_show _menu_frame_txt_data1_*; touch_show _menu_frame_txt_desc8_*; if $cscl_currentmoney >= $_menu_money_item8;:_menu_show_confirm ; alias _menu_confirmed \"\r\n\r\nalias +menu_confirm \"_click; touch_setcolor _menu_confirm 255 174 0 150\"\r\nalias -menu_confirm \"touch_setcolor _menu_confirm 0 0 0 150; _menu_confirmed; wait; wait; _erase_frame\"\r\n"
  },
  {
    "path": "3rdparty/cs16client-extras/touch/buy_shotgun_t.cfg",
    "content": "// Coded by Alprnn357\r\ntouch_setclientonly 1\r\ncmd_scripting 1\r\ntouch_set_stroke 1 255 174 0 150\r\n\r\nalias _erase_frame \"touch_removebutton _menu_*; _menu_off; slot10\"\r\nalias _menu_off \"touch_setclientonly 0\"\r\nalias _click \"play media/launch_select1.wav; vibrate 30\"\r\n\r\ntouch_addbutton \"_menu_bg_crn4\" \"gfx/vgui/round_corner_se.tga\" \"\" 0.880000 0.924444 0.900000 0.960000 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_crn2\" \"gfx/vgui/round_corner_ne.tga\" \"\" 0.880000 0.035556 0.900000 0.071111 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_crn1\" \"gfx/vgui/round_corner_nw.tga\" \"\" 0.100000 0.035556 0.120000 0.071111 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_crn3\" \"gfx/vgui/round_corner_sw.tga\" \"\" 0.100000 0.924444 0.120000 0.960000 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_top1\" \"*black\" \"\" 0.120000 0.035556 0.880000 0.071111 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_top2\" \"*black\" \"\" 0.100000 0.071111 0.900000 0.160000 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_bottom\" \"*black\" \"\" 0.120000 0.924444 0.880000 0.960000 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_body\" \"*black\" \"\" 0.100000 0.165000 0.900000 0.924444 0 0 0 150 6\r\nif $menu_bg_fill >= 1;:touch_removebutton _menu_bg_*;:touch_addbutton _menu_bg_body *black \"\" 0 0 1 1 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_icn_logo\" \"gfx/vgui/cs_logo.tga\" \"\" 0.110000 0.053333 0.160000 0.142222 255 174 0 255 6\r\ntouch_addbutton \"_menu_bg_txt_logo\" \"#BUY SHOTGUNS (PRIMARY WEAPON)\" \"\" 0.170000 0.071111 0.890000 0.142222 255 174 0 255 6\r\n\r\n//touch_addbutton \"_menu_txt_title\" \"#THE TITLE\" \"\" 0.140000 0.177778 0.860000 0.213333 255 174 0 255 4\r\ntouch_addbutton \"_menu_slot1\" \"*white\" \"_menu_select_slot1\" 0.140000 0.213333 0.360000 0.266667 0 0 0 150 260\r\ntouch_addbutton \"_menu_txt_slot1\" \"#1 LEONE 12 GAUGE SUPER\" \"\" 0.150000 0.231111 0.360000 0.266667 255 174 0 255 4\r\ntouch_addbutton \"_menu_slot2\" \"*white\" \"_menu_select_slot2\" 0.140000 0.284444 0.360000 0.337778 0 0 0 150 260\r\ntouch_addbutton \"_menu_txt_slot2\" \"#2 LEONE YG1265 AUTO SHOTGUN\" \"\" 0.150000 0.302222 0.370000 0.337778 255 174 0 255 4\r\n//touch_addbutton \"_menu_slot3\" \"*white\" \"_menu_select_slot3\" 0.140000 0.355556 0.360000 0.408889 0 0 0 150 260\r\n//touch_addbutton \"_menu_txt_slot3\" \"#3 SLOT\" \"\" 0.150000 0.373333 0.360000 0.408889 255 174 0 255 4\r\n//touch_addbutton \"_menu_slot4\" \"*white\" \"_menu_select_slot4\" 0.140000 0.426667 0.360000 0.480000 0 0 0 150 260\r\n//touch_addbutton \"_menu_txt_slot4\" \"#4 SLOT\" \"\" 0.150000 0.444444 0.360000 0.480000 255 174 0 255 4\r\n//touch_addbutton \"_menu_slot5\" \"*white\" \"_menu_select_slot5\" 0.140000 0.497778 0.360000 0.551111 0 0 0 150 260\r\n//touch_addbutton \"_menu_txt_slot5\" \"#5 SLOT\" \"\" 0.150000 0.515556 0.360000 0.551111 255 174 0 255 4\r\n//touch_addbutton \"_menu_slot6\" \"*white\" \"_menu_select_slot6\" 0.140000 0.568889 0.360000 0.622222 0 0 0 150 260\r\n//touch_addbutton \"_menu_txt_slot6\" \"#6 SLOT\" \"\" 0.150000 0.586667 0.360000 0.622222 255 174 0 255 4\r\n//touch_addbutton \"_menu_slot7\" \"*white\" \"_menu_select_slot7\" 0.140000 0.640000 0.360000 0.693333 0 0 0 150 260\r\n//touch_addbutton \"_menu_txt_slot7\" \"#7 SLOT\" \"\" 0.150000 0.657778 0.360000 0.693333 255 174 0 255 4\r\n//touch_addbutton \"_menu_slot8\" \"*white\" \"_menu_select_slot8\" 0.140000 0.711111 0.360000 0.764444 0 0 0 150 260\r\n//touch_addbutton \"_menu_txt_slot8\" \"#8 SLOT\" \"\" 0.150000 0.728889 0.360000 0.764444 255 174 0 255 4\r\n//touch_addbutton \"_menu_slot9\" \"*white\" \"\" 0.140000 0.782222 0.360000 0.835556 0 0 0 150 260\r\n//touch_addbutton \"_menu_txt_slot9\" \"#9 SLOT\" \"\" 0.150000 0.800000 0.360000 0.835556 255 174 0 255 4\r\ntouch_addbutton \"_menu_slot0\" \"*white\" \"+menu_slot0\" 0.14 0.871111 0.36 0.924444 0 0 0 150 260\r\ntouch_addbutton \"_menu_txt_slot0\" \"#0 CANCEL\" \"\" 0.15 0.888889 0.36 0.924444 255 174 0 255 4\r\n\r\nset _menu_money_item1 \"1700\"; if $cscl_currentmoney < $_menu_money_item1;: touch_setcolor _menu_txt_slot1 129 85 0 255\r\nset _menu_money_item2 \"3000\"; if $cscl_currentmoney < $_menu_money_item2;: touch_setcolor _menu_txt_slot2 129 85 0 255\r\n//set _menu_money_item3 \"\"; if $cscl_currentmoney < $_menu_money_item3;: touch_setcolor _menu_txt_slot3 129 85 0 255\r\n//set _menu_money_item4 \"\"; if $cscl_currentmoney < $_menu_money_item4;: touch_setcolor _menu_txt_slot4 129 85 0 255\r\n//set _menu_money_item5 \"\"; if $cscl_currentmoney < $_menu_money_item5;: touch_setcolor _menu_txt_slot5 129 85 0 255\r\n//set _menu_money_item6 \"\"; if $cscl_currentmoney < $_menu_money_item6;: touch_setcolor _menu_txt_slot6 129 85 0 255\r\n//set _menu_money_item7 \"\"; if $cscl_currentmoney < $_menu_money_item7;: touch_setcolor _menu_txt_slot7 129 85 0 255\r\n//set _menu_money_item8 \"\"; if $cscl_currentmoney < $_menu_money_item8;: touch_setcolor _menu_txt_slot8 129 85 0 255\r\n\r\ntouch_addbutton \"_menu_frame\" \"*white\" \"\" 0.390000 0.213333 0.840000 0.551111 0 0 0 150 260\r\ntouch_addbutton \"_menu_frame_icn_class1\" \"gfx/vgui/m3.tga\" \"\" 0.430000 0.285333 0.810000 0.479111 255 255 255 255 4\r\ntouch_addbutton \"_menu_frame_icn_class2\" \"gfx/vgui/xm1014.tga\" \"\" 0.430000 0.285333 0.810000 0.479111 255 255 255 255 4\r\n//touch_addbutton \"_menu_frame_icn_class3\" \"\" \"\" 0.430000 0.285333 0.810000 0.479111 255 255 255 255 4\r\n//touch_addbutton \"_menu_frame_icn_class4\" \"\" \"\" 0.430000 0.285333 0.810000 0.479111 255 255 255 255 4\r\n//touch_addbutton \"_menu_frame_icn_class5\" \"\" \"\" 0.430000 0.285333 0.810000 0.479111 255 255 255 255 4\r\n//touch_addbutton \"_menu_frame_icn_class6\" \"\" \"\" 0.430000 0.285333 0.810000 0.479111 255 255 255 255 4\r\n//touch_addbutton \"_menu_frame_icn_class7\" \"\" \"\" 0.430000 0.285333 0.810000 0.479111 255 255 255 255 4\r\n//touch_addbutton \"_menu_frame_icn_class8\" \"\" \"\" 0.430000 0.285333 0.810000 0.479111 255 255 255 255 4\r\n\r\ntouch_addbutton \"_menu_confirm\" \"*white\" \"+menu_confirm\" 0.62 0.871111 0.84 0.924444 0 0 0 150 260\r\ntouch_addbutton \"_menu_confirm_txt\" \"#BUY THE ITEM\" \"\" 0.63 0.888889 0.84 0.924444 255 174 0 255 4\r\n\r\ntouch_addbutton \"_menu_frame_txt_data1_1\" \"#PRICE\" \"\" 0.39 0.551111 0.56 0.586667 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data1_2\" \"#COUNTRY OF ORIGIN\" \"\" 0.39 0.586667 0.56 0.622222 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data1_3\" \"#CALIBER\" \"\" 0.39 0.622222 0.56 0.657778 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data1_4\" \"#CLIP CAPACITY\" \"\" 0.39 0.657778 0.56 0.693333 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data1_5\" \"#RATE OF FIRE\" \"\" 0.39 0.693333 0.56 0.728889 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data1_6\" \"#WEIGHT (LOADED)\" \"\" 0.39 0.728889 0.56 0.764444 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data1_7\" \"#PROJECTILE WEIGHT\" \"\" 0.39 0.764444 0.56 0.8 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data1_8\" \"#MUZZLE VELOCITY\" \"\" 0.39 0.8 0.56 0.835556 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data1_9\" \"#MUZZLE ENERGY\" \"\" 0.39 0.835556 0.56 0.871111 240 180 24 255 4\r\n\r\ntouch_addbutton \"_menu_frame_txt_data2_1\" \"#PRICE\" \"\" 0.39 0.551111 0.56 0.586667 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data2_2\" \"#COUNTRY OF ORIGIN\" \"\" 0.39 0.586667 0.56 0.622222 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data2_3\" \"#CALIBER\" \"\" 0.39 0.622222 0.56 0.657778 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data2_4\" \"#CLIP CAPACITY\" \"\" 0.39 0.657778 0.56 0.693333 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data2_5\" \"#RATE OF FIRE\" \"\" 0.39 0.693333 0.56 0.728889 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data2_6\" \"#WEIGHT (EMPTY)\" \"\" 0.39 0.728889 0.56 0.764444 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data2_7\" \"#PROJECTILE WEIGHT\" \"\" 0.39 0.764444 0.56 0.8 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data2_8\" \"#MUZZLE VELOCITY\" \"\" 0.39 0.8 0.56 0.835556 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data2_9\" \"#MUZZLE ENERGY\" \"\" 0.39 0.835556 0.56 0.871111 240 180 24 255 4\r\n\r\ntouch_addbutton \"_menu_frame_txt_desc1_1\" \"#: \\$$_menu_money_item1\" \"\" 0.56 0.551111 0.84 0.586667 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc1_2\" \"#: ITALY\" \"\" 0.56 0.586667 0.84 0.622222 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc1_3\" \"#: 12 GAUGE\" \"\" 0.56 0.622222 0.84 0.657778 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc1_4\" \"#: 8 ROUNDS\" \"\" 0.56 0.657778 0.84 0.693333 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc1_5\" \"#: N/A\" \"\" 0.56 0.693333 0.84 0.728889 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc1_6\" \"#: 3.5KG\" \"\" 0.56 0.728889 0.84 0.764444 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc1_7\" \"#: 3.8 GRAMS\" \"\" 0.56 0.764444 0.84 0.8 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc1_8\" \"#: 1250 FEET/SECOND\" \"\" 0.56 0.8 0.84 0.835556 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc1_9\" \"#: 2429 JOULES\" \"\" 0.56 0.835556 0.84 0.871111 240 180 24 255 4\r\n\r\ntouch_addbutton \"_menu_frame_txt_desc2_1\" \"#: \\$$_menu_money_item2\" \"\" 0.56 0.551111 0.84 0.586667 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc2_2\" \"#: ITALY\" \"\" 0.56 0.586667 0.84 0.622222 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc2_3\" \"#: 12 GAUGE\" \"\" 0.56 0.622222 0.84 0.657778 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc2_4\" \"#: 7 ROUNDS\" \"\" 0.56 0.657778 0.84 0.693333 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc2_5\" \"#: 400 RPM\" \"\" 0.56 0.693333 0.84 0.728889 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc2_6\" \"#: 4KG\" \"\" 0.56 0.728889 0.84 0.764444 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc2_7\" \"#: 3.8 GRAMS/PELLET\" \"\" 0.56 0.764444 0.84 0.8 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc2_8\" \"#: 1250 FEET/SECOND\" \"\" 0.56 0.8 0.84 0.835556 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc2_9\" \"#: 2429 JOULES\" \"\" 0.56 0.835556 0.84 0.871111 240 180 24 255 4\r\n\r\n//touch_addbutton \"_menu_frame_txt_desc3_1\" \"#: \" \"\" 0.56 0.551111 0.84 0.586667 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc3_2\" \"#: \" \"\" 0.56 0.586667 0.84 0.622222 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc3_3\" \"#: \" \"\" 0.56 0.622222 0.84 0.657778 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc3_4\" \"#: \" \"\" 0.56 0.657778 0.84 0.693333 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc3_5\" \"#: \" \"\" 0.56 0.693333 0.84 0.728889 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc3_6\" \"#: \" \"\" 0.56 0.728889 0.84 0.764444 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc3_7\" \"#: \" \"\" 0.56 0.764444 0.84 0.8 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc3_8\" \"#: \" \"\" 0.56 0.8 0.84 0.835556 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc3_9\" \"#: \" \"\" 0.56 0.835556 0.84 0.871111 240 180 24 255 4\r\n\r\n//touch_addbutton \"_menu_frame_txt_desc4_1\" \"#: \" \"\" 0.56 0.551111 0.84 0.586667 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc4_2\" \"#: \" \"\" 0.56 0.586667 0.84 0.622222 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc4_3\" \"#: \" \"\" 0.56 0.622222 0.84 0.657778 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc4_4\" \"#: \" \"\" 0.56 0.657778 0.84 0.693333 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc4_5\" \"#: \" \"\" 0.56 0.693333 0.84 0.728889 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc4_6\" \"#: \" \"\" 0.56 0.728889 0.84 0.764444 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc4_7\" \"#: \" \"\" 0.56 0.764444 0.84 0.8 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc4_8\" \"#: \" \"\" 0.56 0.8 0.84 0.835556 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc4_9\" \"#: \" \"\" 0.56 0.835556 0.84 0.871111 240 180 24 255 4\r\n\r\n//touch_addbutton \"_menu_frame_txt_desc5_1\" \"#: \" \"\" 0.56 0.551111 0.84 0.586667 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc5_2\" \"#: \" \"\" 0.56 0.586667 0.84 0.622222 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc5_3\" \"#: \" \"\" 0.56 0.622222 0.84 0.657778 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc5_4\" \"#: \" \"\" 0.56 0.657778 0.84 0.693333 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc5_5\" \"#: \" \"\" 0.56 0.693333 0.84 0.728889 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc5_6\" \"#: \" \"\" 0.56 0.728889 0.84 0.764444 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc5_7\" \"#: \" \"\" 0.56 0.764444 0.84 0.8 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc5_8\" \"#: \" \"\" 0.56 0.8 0.84 0.835556 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc5_9\" \"#: \" \"\" 0.56 0.835556 0.84 0.871111 240 180 24 255 4\r\n\r\n//touch_addbutton \"_menu_frame_txt_desc6_1\" \"#: \" \"\" 0.56 0.551111 0.84 0.586667 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc6_2\" \"#: \" \"\" 0.56 0.586667 0.84 0.622222 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc6_3\" \"#: \" \"\" 0.56 0.622222 0.84 0.657778 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc6_4\" \"#: \" \"\" 0.56 0.657778 0.84 0.693333 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc6_5\" \"#: \" \"\" 0.56 0.693333 0.84 0.728889 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc6_6\" \"#: \" \"\" 0.56 0.728889 0.84 0.764444 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc6_7\" \"#: \" \"\" 0.56 0.764444 0.84 0.8 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc6_8\" \"#: \" \"\" 0.56 0.8 0.84 0.835556 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc6_9\" \"#: \" \"\" 0.56 0.835556 0.84 0.871111 240 180 24 255 4\r\n\r\n//touch_addbutton \"_menu_frame_txt_desc7_1\" \"#: \" \"\" 0.56 0.551111 0.84 0.586667 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc7_2\" \"#: \" \"\" 0.56 0.586667 0.84 0.622222 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc7_3\" \"#: \" \"\" 0.56 0.622222 0.84 0.657778 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc7_4\" \"#: \" \"\" 0.56 0.657778 0.84 0.693333 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc7_5\" \"#: \" \"\" 0.56 0.693333 0.84 0.728889 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc7_6\" \"#: \" \"\" 0.56 0.728889 0.84 0.764444 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc7_7\" \"#: \" \"\" 0.56 0.764444 0.84 0.8 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc7_8\" \"#: \" \"\" 0.56 0.8 0.84 0.835556 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc7_9\" \"#: \" \"\" 0.56 0.835556 0.84 0.871111 240 180 24 255 4\r\n\r\n//touch_addbutton \"_menu_frame_txt_desc8_1\" \"#: \" \"\" 0.56 0.551111 0.84 0.586667 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc8_2\" \"#: \" \"\" 0.56 0.586667 0.84 0.622222 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc8_3\" \"#: \" \"\" 0.56 0.622222 0.84 0.657778 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc8_4\" \"#: \" \"\" 0.56 0.657778 0.84 0.693333 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc8_5\" \"#: \" \"\" 0.56 0.693333 0.84 0.728889 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc8_6\" \"#: \" \"\" 0.56 0.728889 0.84 0.764444 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc8_7\" \"#: \" \"\" 0.56 0.764444 0.84 0.8 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc8_8\" \"#: \" \"\" 0.56 0.8 0.84 0.835556 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc8_9\" \"#: \" \"\" 0.56 0.835556 0.84 0.871111 240 180 24 255 4\r\n\r\ntouch_addbutton \"_menu_txt_money\" \"#YOU HAVE \\$$cscl_currentmoney\" \"_menu_refresh\" 0.170000 0.106667 0.890000 0.160000 255 174 0 255 4\r\nalias _menu_refresh \"exec touch/buy_shotgun_ct.cfg\"\r\n\r\nalias _menu_none \"touch_setcolor _menu_slot* 0 0 0 150; touch_hide _menu_frame_icn_class*; touch_hide _menu_frame_txt_data*; touch_hide _menu_frame_txt_desc*; touch_hide _menu_confirm*\"\r\n_menu_none\r\n\r\n//alias +menu_slot0 \"touch_setcolor _menu_slot0 255 174 0 150\"\r\n//alias -menu_slot0 \"touch_setcolor _menu_slot0 0 0 0 150\"\r\n//alias _menu_select_slot1 \"_menu_none; touch_setcolor _menu_slot1 255 174 0 150; touch_show _menu_frame_icn_class1; touch_show _menu_frame_txt_desc1; if $cscl_currentmoney>=0;:_menu_show_confirm ; alias _menu_confirmed joinclass 1\"\r\n\r\nalias +menu_slot0 \"_click; touch_setcolor _menu_slot0 255 174 0 150\"\r\nalias -menu_slot0 \"touch_setcolor _menu_slot0 0 0 0 150; _erase_frame\"\r\nif $buymenu_stayon >= 1;:alias -menu_slot0 \"touch_setcolor _menu_slot0 0 0 0 150; _erase_frame; buy\"\r\n\r\nalias _menu_confirmed \"\"\r\nalias _menu_show_confirm \"touch_show _menu_confirm*\"\r\n\r\nalias _menu_select_slot1 \"_click; _menu_none; touch_setcolor _menu_slot1 255 174 0 150; touch_show _menu_frame_icn_class1; touch_show _menu_frame_txt_data2_*; touch_show _menu_frame_txt_desc1_*; if $cscl_currentmoney >= $_menu_money_item1;:_menu_show_confirm ; alias _menu_confirmed m3\"\r\nalias _menu_select_slot2 \"_click; _menu_none; touch_setcolor _menu_slot2 255 174 0 150; touch_show _menu_frame_icn_class2; touch_show _menu_frame_txt_data2_*; touch_show _menu_frame_txt_desc2_*; if $cscl_currentmoney >= $_menu_money_item2;:_menu_show_confirm ; alias _menu_confirmed xm1014\"\r\n//alias _menu_select_slot3 \"_click; _menu_none; touch_setcolor _menu_slot3 255 174 0 150; touch_show _menu_frame_icn_class3; touch_show _menu_frame_txt_data2_*; touch_show _menu_frame_txt_desc3_*; if $cscl_currentmoney >= $_menu_money_item3;:_menu_show_confirm ; alias _menu_confirmed \"\r\n//alias _menu_select_slot4 \"_click; _menu_none; touch_setcolor _menu_slot4 255 174 0 150; touch_show _menu_frame_icn_class4; touch_show _menu_frame_txt_data1_*; touch_show _menu_frame_txt_desc4_*; if $cscl_currentmoney >= $_menu_money_item4;:_menu_show_confirm ; alias _menu_confirmed \"\r\n//alias _menu_select_slot5 \"_click; _menu_none; touch_setcolor _menu_slot5 255 174 0 150; touch_show _menu_frame_icn_class5; touch_show _menu_frame_txt_data2_*; touch_show _menu_frame_txt_desc5_*; if $cscl_currentmoney >= $_menu_money_item5;:_menu_show_confirm ; alias _menu_confirmed \"\r\n//alias _menu_select_slot6 \"_click; _menu_none; touch_setcolor _menu_slot6 255 174 0 150; touch_show _menu_frame_icn_class6; touch_show _menu_frame_txt_data1_*; touch_show _menu_frame_txt_desc6_*; if $cscl_currentmoney >= $_menu_money_item6;:_menu_show_confirm ; alias _menu_confirmed \"\r\n//alias _menu_select_slot7 \"_click; _menu_none; touch_setcolor _menu_slot7 255 174 0 150; touch_show _menu_frame_icn_class7; touch_show _menu_frame_txt_data1_*; touch_show _menu_frame_txt_desc7_*; if $cscl_currentmoney >= $_menu_money_item7;:_menu_show_confirm ; alias _menu_confirmed \"\r\n//alias _menu_select_slot8 \"_click; _menu_none; touch_setcolor _menu_slot8 255 174 0 150; touch_show _menu_frame_icn_class8; touch_show _menu_frame_txt_data1_*; touch_show _menu_frame_txt_desc8_*; if $cscl_currentmoney >= $_menu_money_item8;:_menu_show_confirm ; alias _menu_confirmed \"\r\n\r\nalias +menu_confirm \"_click; touch_setcolor _menu_confirm 255 174 0 150\"\r\nalias -menu_confirm \"touch_setcolor _menu_confirm 0 0 0 150; _menu_confirmed; wait; wait; _erase_frame\"\r\n"
  },
  {
    "path": "3rdparty/cs16client-extras/touch/buy_submachinegun_ct.cfg",
    "content": "// Coded by Alprnn357\r\ntouch_setclientonly 1\r\ncmd_scripting 1\r\ntouch_set_stroke 1 255 174 0 150\r\n\r\nalias _erase_frame \"touch_removebutton _menu_*; _menu_off; slot10\"\r\nalias _menu_off \"touch_setclientonly 0\"\r\nalias _click \"play media/launch_select1.wav; vibrate 30\"\r\n\r\ntouch_addbutton \"_menu_bg_crn4\" \"gfx/vgui/round_corner_se.tga\" \"\" 0.880000 0.924444 0.900000 0.960000 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_crn2\" \"gfx/vgui/round_corner_ne.tga\" \"\" 0.880000 0.035556 0.900000 0.071111 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_crn1\" \"gfx/vgui/round_corner_nw.tga\" \"\" 0.100000 0.035556 0.120000 0.071111 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_crn3\" \"gfx/vgui/round_corner_sw.tga\" \"\" 0.100000 0.924444 0.120000 0.960000 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_top1\" \"*black\" \"\" 0.120000 0.035556 0.880000 0.071111 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_top2\" \"*black\" \"\" 0.100000 0.071111 0.900000 0.160000 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_bottom\" \"*black\" \"\" 0.120000 0.924444 0.880000 0.960000 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_body\" \"*black\" \"\" 0.100000 0.165000 0.900000 0.924444 0 0 0 150 6\r\nif $menu_bg_fill >= 1;:touch_removebutton _menu_bg_*;:touch_addbutton _menu_bg_body *black \"\" 0 0 1 1 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_icn_logo\" \"gfx/vgui/cs_logo.tga\" \"\" 0.110000 0.053333 0.160000 0.142222 255 174 0 255 6\r\ntouch_addbutton \"_menu_bg_txt_logo\" \"#BUY SUBMACHINE GUNS (PRIMARY WEAPON)\" \"\" 0.170000 0.071111 0.890000 0.142222 255 174 0 255 6\r\n\r\n//touch_addbutton \"_menu_txt_title\" \"#THE TITLE\" \"\" 0.140000 0.177778 0.860000 0.213333 255 174 0 255 4\r\ntouch_addbutton \"_menu_slot1\" \"*white\" \"_menu_select_slot1\" 0.140000 0.213333 0.360000 0.266667 0 0 0 150 260\r\ntouch_addbutton \"_menu_txt_slot1\" \"#1 SCHMIDT MACHINE PISTOL\" \"\" 0.150000 0.231111 0.360000 0.266667 255 174 0 255 4\r\ntouch_addbutton \"_menu_slot2\" \"*white\" \"_menu_select_slot2\" 0.140000 0.284444 0.360000 0.337778 0 0 0 150 260\r\ntouch_addbutton \"_menu_txt_slot2\" \"#2 K&M SUB-MACHINE GUN\" \"\" 0.150000 0.302222 0.360000 0.337778 255 174 0 255 4\r\ntouch_addbutton \"_menu_slot3\" \"*white\" \"_menu_select_slot3\" 0.140000 0.355556 0.360000 0.408889 0 0 0 150 260\r\ntouch_addbutton \"_menu_txt_slot3\" \"#3 K&M UMP45\" \"\" 0.150000 0.373333 0.360000 0.408889 255 174 0 255 4\r\ntouch_addbutton \"_menu_slot4\" \"*white\" \"_menu_select_slot4\" 0.140000 0.426667 0.360000 0.480000 0 0 0 150 260\r\ntouch_addbutton \"_menu_txt_slot4\" \"#4 ES C90\" \"\" 0.150000 0.444444 0.360000 0.480000 255 174 0 255 4\r\n//touch_addbutton \"_menu_slot5\" \"*white\" \"_menu_select_slot5\" 0.140000 0.497778 0.360000 0.551111 0 0 0 150 260\r\n//touch_addbutton \"_menu_txt_slot5\" \"#5 SLOT\" \"\" 0.150000 0.515556 0.360000 0.551111 255 174 0 255 4\r\n//touch_addbutton \"_menu_slot6\" \"*white\" \"_menu_select_slot6\" 0.140000 0.568889 0.360000 0.622222 0 0 0 150 260\r\n//touch_addbutton \"_menu_txt_slot6\" \"#6 SLOT\" \"\" 0.150000 0.586667 0.360000 0.622222 255 174 0 255 4\r\n//touch_addbutton \"_menu_slot7\" \"*white\" \"_menu_select_slot7\" 0.140000 0.640000 0.360000 0.693333 0 0 0 150 260\r\n//touch_addbutton \"_menu_txt_slot7\" \"#7 SLOT\" \"\" 0.150000 0.657778 0.360000 0.693333 255 174 0 255 4\r\n//touch_addbutton \"_menu_slot8\" \"*white\" \"_menu_select_slot8\" 0.140000 0.711111 0.360000 0.764444 0 0 0 150 260\r\n//touch_addbutton \"_menu_txt_slot8\" \"#8 SLOT\" \"\" 0.150000 0.728889 0.360000 0.764444 255 174 0 255 4\r\n//touch_addbutton \"_menu_slot9\" \"*white\" \"\" 0.140000 0.782222 0.360000 0.835556 0 0 0 150 260\r\n//touch_addbutton \"_menu_txt_slot9\" \"#9 SLOT\" \"\" 0.150000 0.800000 0.360000 0.835556 255 174 0 255 4\r\ntouch_addbutton \"_menu_slot0\" \"*white\" \"+menu_slot0\" 0.14 0.871111 0.36 0.924444 0 0 0 150 260\r\ntouch_addbutton \"_menu_txt_slot0\" \"#0 CANCEL\" \"\" 0.15 0.888889 0.36 0.924444 255 174 0 255 4\r\n\r\nset _menu_money_item1 \"1250\"; if $cscl_currentmoney < $_menu_money_item1;: touch_setcolor _menu_txt_slot1 129 85 0 255\r\nset _menu_money_item2 \"1500\"; if $cscl_currentmoney < $_menu_money_item2;: touch_setcolor _menu_txt_slot2 129 85 0 255\r\nset _menu_money_item3 \"1700\"; if $cscl_currentmoney < $_menu_money_item3;: touch_setcolor _menu_txt_slot3 129 85 0 255\r\nset _menu_money_item4 \"2350\"; if $cscl_currentmoney < $_menu_money_item4;: touch_setcolor _menu_txt_slot4 129 85 0 255\r\n//set _menu_money_item5 \"\"; if $cscl_currentmoney < $_menu_money_item5;: touch_setcolor _menu_txt_slot5 129 85 0 255\r\n//set _menu_money_item6 \"\"; if $cscl_currentmoney < $_menu_money_item6;: touch_setcolor _menu_txt_slot6 129 85 0 255\r\n//set _menu_money_item7 \"\"; if $cscl_currentmoney < $_menu_money_item7;: touch_setcolor _menu_txt_slot7 129 85 0 255\r\n//set _menu_money_item8 \"\"; if $cscl_currentmoney < $_menu_money_item8;: touch_setcolor _menu_txt_slot8 129 85 0 255\r\n\r\ntouch_addbutton \"_menu_frame\" \"*white\" \"\" 0.390000 0.213333 0.840000 0.551111 0 0 0 150 260\r\ntouch_addbutton \"_menu_frame_icn_class1\" \"gfx/vgui/tmp.tga\" \"\" 0.430000 0.215333 0.810000 0.549111 255 255 255 255 4\r\ntouch_addbutton \"_menu_frame_icn_class2\" \"gfx/vgui/mp5.tga\" \"\" 0.430000 0.215333 0.810000 0.549111 255 255 255 255 4\r\ntouch_addbutton \"_menu_frame_icn_class3\" \"gfx/vgui/ump45.tga\" \"\" 0.430000 0.215333 0.810000 0.549111 255 255 255 255 4\r\ntouch_addbutton \"_menu_frame_icn_class4\" \"gfx/vgui/p90.tga\" \"\" 0.430000 0.215333 0.810000 0.549111 255 255 255 255 4\r\n//touch_addbutton \"_menu_frame_icn_class5\" \"\" \"\" 0.430000 0.215333 0.810000 0.549111 255 255 255 255 4\r\n//touch_addbutton \"_menu_frame_icn_class6\" \"\" \"\" 0.430000 0.215333 0.810000 0.549111 255 255 255 255 4\r\n//touch_addbutton \"_menu_frame_icn_class7\" \"\" \"\" 0.430000 0.215333 0.810000 0.549111 255 255 255 255 4\r\n//touch_addbutton \"_menu_frame_icn_class8\" \"\" \"\" 0.430000 0.215333 0.810000 0.549111 255 255 255 255 4\r\n\r\ntouch_addbutton \"_menu_confirm\" \"*white\" \"+menu_confirm\" 0.62 0.871111 0.84 0.924444 0 0 0 150 260\r\ntouch_addbutton \"_menu_confirm_txt\" \"#BUY THE ITEM\" \"\" 0.63 0.888889 0.84 0.924444 255 174 0 255 4\r\n\r\ntouch_addbutton \"_menu_frame_txt_data1_1\" \"#PRICE\" \"\" 0.39 0.551111 0.56 0.586667 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data1_2\" \"#COUNTRY OF ORIGIN\" \"\" 0.39 0.586667 0.56 0.622222 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data1_3\" \"#CALIBER\" \"\" 0.39 0.622222 0.56 0.657778 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data1_4\" \"#CLIP CAPACITY\" \"\" 0.39 0.657778 0.56 0.693333 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data1_5\" \"#RATE OF FIRE\" \"\" 0.39 0.693333 0.56 0.728889 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data1_6\" \"#WEIGHT (LOADED)\" \"\" 0.39 0.728889 0.56 0.764444 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data1_7\" \"#PROJECTILE WEIGHT\" \"\" 0.39 0.764444 0.56 0.8 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data1_8\" \"#MUZZLE VELOCITY\" \"\" 0.39 0.8 0.56 0.835556 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data1_9\" \"#MUZZLE ENERGY\" \"\" 0.39 0.835556 0.56 0.871111 240 180 24 255 4\r\n\r\ntouch_addbutton \"_menu_frame_txt_data2_1\" \"#PRICE\" \"\" 0.39 0.551111 0.56 0.586667 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data2_2\" \"#COUNTRY OF ORIGIN\" \"\" 0.39 0.586667 0.56 0.622222 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data2_3\" \"#CALIBER\" \"\" 0.39 0.622222 0.56 0.657778 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data2_4\" \"#CLIP CAPACITY\" \"\" 0.39 0.657778 0.56 0.693333 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data2_5\" \"#RATE OF FIRE\" \"\" 0.39 0.693333 0.56 0.728889 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data2_6\" \"#WEIGHT (EMPTY)\" \"\" 0.39 0.728889 0.56 0.764444 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data2_7\" \"#PROJECTILE WEIGHT\" \"\" 0.39 0.764444 0.56 0.8 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data2_8\" \"#MUZZLE VELOCITY\" \"\" 0.39 0.8 0.56 0.835556 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data2_9\" \"#MUZZLE ENERGY\" \"\" 0.39 0.835556 0.56 0.871111 240 180 24 255 4\r\n\r\ntouch_addbutton \"_menu_frame_txt_desc1_1\" \"#: \\$$_menu_money_item1\" \"\" 0.56 0.551111 0.84 0.586667 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc1_2\" \"#: AUSTRIA\" \"\" 0.56 0.586667 0.84 0.622222 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc1_3\" \"#: 9MM PARABELLUM\" \"\" 0.56 0.622222 0.84 0.657778 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc1_4\" \"#: 30 ROUNDS\" \"\" 0.56 0.657778 0.84 0.693333 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc1_5\" \"#: 857 RPM\" \"\" 0.56 0.693333 0.84 0.728889 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc1_6\" \"#: 1.3KG\" \"\" 0.56 0.728889 0.84 0.764444 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc1_7\" \"#: 8 GRAMS\" \"\" 0.56 0.764444 0.84 0.8 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc1_8\" \"#: 1280 FEET/SECOND\" \"\" 0.56 0.8 0.84 0.835556 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc1_9\" \"#: 606 JOULES\" \"\" 0.56 0.835556 0.84 0.871111 240 180 24 255 4\r\n\r\ntouch_addbutton \"_menu_frame_txt_desc2_1\" \"#: \\$$_menu_money_item2\" \"\" 0.56 0.551111 0.84 0.586667 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc2_2\" \"#: GERMANY\" \"\" 0.56 0.586667 0.84 0.622222 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc2_3\" \"#: 9MM PARABELLUM\" \"\" 0.56 0.622222 0.84 0.657778 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc2_4\" \"#: 30 ROUNDS\" \"\" 0.56 0.657778 0.84 0.693333 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc2_5\" \"#: 800 RPM\" \"\" 0.56 0.693333 0.84 0.728889 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc2_6\" \"#: 3.42KG\" \"\" 0.56 0.728889 0.84 0.764444 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc2_7\" \"#: 8 GRAMS\" \"\" 0.56 0.764444 0.84 0.8 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc2_8\" \"#: 1132 FEET/SECOND\" \"\" 0.56 0.8 0.84 0.835556 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc2_9\" \"#: 637 JOULES\" \"\" 0.56 0.835556 0.84 0.871111 240 180 24 255 4\r\n\r\ntouch_addbutton \"_menu_frame_txt_desc3_1\" \"#: \\$$_menu_money_item3\" \"\" 0.56 0.551111 0.84 0.586667 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc3_2\" \"#: GERMANY\" \"\" 0.56 0.586667 0.84 0.622222 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc3_3\" \"#: .45 ACP\" \"\" 0.56 0.622222 0.84 0.657778 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc3_4\" \"#: 25 ROUNDS\" \"\" 0.56 0.657778 0.84 0.693333 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc3_5\" \"#: 600 RPM\" \"\" 0.56 0.693333 0.84 0.728889 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc3_6\" \"#: 2.27KG\" \"\" 0.56 0.728889 0.84 0.764444 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc3_7\" \"#: 15.2 GRAMS\" \"\" 0.56 0.764444 0.84 0.8 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc3_8\" \"#: 1005 FEET/SECOND\" \"\" 0.56 0.8 0.84 0.835556 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc3_9\" \"#: 625 JOULES\" \"\" 0.56 0.835556 0.84 0.871111 240 180 24 255 4\r\n\r\ntouch_addbutton \"_menu_frame_txt_desc4_1\" \"#: \\$$_menu_money_item4\" \"\" 0.56 0.551111 0.84 0.586667 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc4_2\" \"#: BELGIUM\" \"\" 0.56 0.586667 0.84 0.622222 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc4_3\" \"#: 5.7 x 28MM\" \"\" 0.56 0.622222 0.84 0.657778 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc4_4\" \"#: 50 ROUNDS\" \"\" 0.56 0.657778 0.84 0.693333 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc4_5\" \"#: 900 RPM\" \"\" 0.56 0.693333 0.84 0.728889 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc4_6\" \"#: 3KG\" \"\" 0.56 0.728889 0.84 0.764444 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc4_7\" \"#: 2 GRAMS\" \"\" 0.56 0.764444 0.84 0.8 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc4_8\" \"#: 2345 FEET/SECOND\" \"\" 0.56 0.8 0.84 0.835556 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc4_9\" \"#: 465 JOULES\" \"\" 0.56 0.835556 0.84 0.871111 240 180 24 255 4\r\n\r\n//touch_addbutton \"_menu_frame_txt_desc5_1\" \"#: \" \"\" 0.56 0.551111 0.84 0.586667 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc5_2\" \"#: \" \"\" 0.56 0.586667 0.84 0.622222 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc5_3\" \"#: \" \"\" 0.56 0.622222 0.84 0.657778 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc5_4\" \"#: \" \"\" 0.56 0.657778 0.84 0.693333 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc5_5\" \"#: \" \"\" 0.56 0.693333 0.84 0.728889 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc5_6\" \"#: \" \"\" 0.56 0.728889 0.84 0.764444 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc5_7\" \"#: \" \"\" 0.56 0.764444 0.84 0.8 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc5_8\" \"#: \" \"\" 0.56 0.8 0.84 0.835556 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc5_9\" \"#: \" \"\" 0.56 0.835556 0.84 0.871111 240 180 24 255 4\r\n\r\n//touch_addbutton \"_menu_frame_txt_desc6_1\" \"#: \" \"\" 0.56 0.551111 0.84 0.586667 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc6_2\" \"#: \" \"\" 0.56 0.586667 0.84 0.622222 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc6_3\" \"#: \" \"\" 0.56 0.622222 0.84 0.657778 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc6_4\" \"#: \" \"\" 0.56 0.657778 0.84 0.693333 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc6_5\" \"#: \" \"\" 0.56 0.693333 0.84 0.728889 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc6_6\" \"#: \" \"\" 0.56 0.728889 0.84 0.764444 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc6_7\" \"#: \" \"\" 0.56 0.764444 0.84 0.8 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc6_8\" \"#: \" \"\" 0.56 0.8 0.84 0.835556 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc6_9\" \"#: \" \"\" 0.56 0.835556 0.84 0.871111 240 180 24 255 4\r\n\r\n//touch_addbutton \"_menu_frame_txt_desc7_1\" \"#: \" \"\" 0.56 0.551111 0.84 0.586667 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc7_2\" \"#: \" \"\" 0.56 0.586667 0.84 0.622222 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc7_3\" \"#: \" \"\" 0.56 0.622222 0.84 0.657778 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc7_4\" \"#: \" \"\" 0.56 0.657778 0.84 0.693333 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc7_5\" \"#: \" \"\" 0.56 0.693333 0.84 0.728889 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc7_6\" \"#: \" \"\" 0.56 0.728889 0.84 0.764444 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc7_7\" \"#: \" \"\" 0.56 0.764444 0.84 0.8 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc7_8\" \"#: \" \"\" 0.56 0.8 0.84 0.835556 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc7_9\" \"#: \" \"\" 0.56 0.835556 0.84 0.871111 240 180 24 255 4\r\n\r\n//touch_addbutton \"_menu_frame_txt_desc8_1\" \"#: \" \"\" 0.56 0.551111 0.84 0.586667 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc8_2\" \"#: \" \"\" 0.56 0.586667 0.84 0.622222 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc8_3\" \"#: \" \"\" 0.56 0.622222 0.84 0.657778 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc8_4\" \"#: \" \"\" 0.56 0.657778 0.84 0.693333 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc8_5\" \"#: \" \"\" 0.56 0.693333 0.84 0.728889 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc8_6\" \"#: \" \"\" 0.56 0.728889 0.84 0.764444 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc8_7\" \"#: \" \"\" 0.56 0.764444 0.84 0.8 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc8_8\" \"#: \" \"\" 0.56 0.8 0.84 0.835556 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc8_9\" \"#: \" \"\" 0.56 0.835556 0.84 0.871111 240 180 24 255 4\r\n\r\ntouch_addbutton \"_menu_txt_money\" \"#YOU HAVE \\$$cscl_currentmoney\" \"_menu_refresh\" 0.170000 0.106667 0.890000 0.160000 255 174 0 255 4\r\nalias _menu_refresh \"exec touch/buy_submachinegun_ct.cfg\"\r\n\r\nalias _menu_none \"touch_setcolor _menu_slot* 0 0 0 150; touch_hide _menu_frame_icn_class*; touch_hide _menu_frame_txt_data*; touch_hide _menu_frame_txt_desc*; touch_hide _menu_confirm*\"\r\n_menu_none\r\n\r\n//alias +menu_slot0 \"touch_setcolor _menu_slot0 255 174 0 150\"\r\n//alias -menu_slot0 \"touch_setcolor _menu_slot0 0 0 0 150\"\r\n//alias _menu_select_slot1 \"_menu_none; touch_setcolor _menu_slot1 255 174 0 150; touch_show _menu_frame_icn_class1; touch_show _menu_frame_txt_desc1; if $cscl_currentmoney>=0;:_menu_show_confirm ; alias _menu_confirmed joinclass 1\"\r\n\r\nalias +menu_slot0 \"_click; touch_setcolor _menu_slot0 255 174 0 150\"\r\nalias -menu_slot0 \"touch_setcolor _menu_slot0 0 0 0 150; _erase_frame\"\r\nif $buymenu_stayon >= 1;:alias -menu_slot0 \"touch_setcolor _menu_slot0 0 0 0 150; _erase_frame; buy\"\r\n\r\nalias _menu_confirmed \"\"\r\nalias _menu_show_confirm \"touch_show _menu_confirm*\"\r\n\r\nalias _menu_select_slot1 \"_click; _menu_none; touch_setcolor _menu_slot1 255 174 0 150; touch_show _menu_frame_icn_class1; touch_show _menu_frame_txt_data2_*; touch_show _menu_frame_txt_desc1_*; if $cscl_currentmoney >= $_menu_money_item1;:_menu_show_confirm ; alias _menu_confirmed tmp\"\r\nalias _menu_select_slot2 \"_click; _menu_none; touch_setcolor _menu_slot2 255 174 0 150; touch_show _menu_frame_icn_class2; touch_show _menu_frame_txt_data2_*; touch_show _menu_frame_txt_desc2_*; if $cscl_currentmoney >= $_menu_money_item2;:_menu_show_confirm ; alias _menu_confirmed mp5\"\r\nalias _menu_select_slot3 \"_click; _menu_none; touch_setcolor _menu_slot3 255 174 0 150; touch_show _menu_frame_icn_class3; touch_show _menu_frame_txt_data1_*; touch_show _menu_frame_txt_desc3_*; if $cscl_currentmoney >= $_menu_money_item3;:_menu_show_confirm ; alias _menu_confirmed ump45\"\r\nalias _menu_select_slot4 \"_click; _menu_none; touch_setcolor _menu_slot4 255 174 0 150; touch_show _menu_frame_icn_class4; touch_show _menu_frame_txt_data1_*; touch_show _menu_frame_txt_desc4_*; if $cscl_currentmoney >= $_menu_money_item4;:_menu_show_confirm ; alias _menu_confirmed p90\"\r\n//alias _menu_select_slot5 \"_click; _menu_none; touch_setcolor _menu_slot5 255 174 0 150; touch_show _menu_frame_icn_class5; touch_show _menu_frame_txt_data1_*; touch_show _menu_frame_txt_desc5_*; if $cscl_currentmoney >= $_menu_money_item5;:_menu_show_confirm ; alias _menu_confirmed \"\r\n//alias _menu_select_slot6 \"_click; _menu_none; touch_setcolor _menu_slot6 255 174 0 150; touch_show _menu_frame_icn_class6; touch_show _menu_frame_txt_data1_*; touch_show _menu_frame_txt_desc6_*; if $cscl_currentmoney >= $_menu_money_item6;:_menu_show_confirm ; alias _menu_confirmed \"\r\n//alias _menu_select_slot7 \"_click; _menu_none; touch_setcolor _menu_slot7 255 174 0 150; touch_show _menu_frame_icn_class7; touch_show _menu_frame_txt_data1_*; touch_show _menu_frame_txt_desc7_*; if $cscl_currentmoney >= $_menu_money_item7;:_menu_show_confirm ; alias _menu_confirmed \"\r\n//alias _menu_select_slot8 \"_click; _menu_none; touch_setcolor _menu_slot8 255 174 0 150; touch_show _menu_frame_icn_class8; touch_show _menu_frame_txt_data1_*; touch_show _menu_frame_txt_desc8_*; if $cscl_currentmoney >= $_menu_money_item8;:_menu_show_confirm ; alias _menu_confirmed \"\r\n\r\nalias +menu_confirm \"_click; touch_setcolor _menu_confirm 255 174 0 150\"\r\nalias -menu_confirm \"touch_setcolor _menu_confirm 0 0 0 150; _menu_confirmed; wait; wait; _erase_frame\"\r\n"
  },
  {
    "path": "3rdparty/cs16client-extras/touch/buy_submachinegun_t.cfg",
    "content": "// Coded by Alprnn357\r\ntouch_setclientonly 1\r\ncmd_scripting 1\r\ntouch_set_stroke 1 255 174 0 150\r\n\r\nalias _erase_frame \"touch_removebutton _menu_*; _menu_off; slot10\"\r\nalias _menu_off \"touch_setclientonly 0\"\r\nalias _click \"play media/launch_select1.wav; vibrate 30\"\r\n\r\ntouch_addbutton \"_menu_bg_crn4\" \"gfx/vgui/round_corner_se.tga\" \"\" 0.880000 0.924444 0.900000 0.960000 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_crn2\" \"gfx/vgui/round_corner_ne.tga\" \"\" 0.880000 0.035556 0.900000 0.071111 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_crn1\" \"gfx/vgui/round_corner_nw.tga\" \"\" 0.100000 0.035556 0.120000 0.071111 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_crn3\" \"gfx/vgui/round_corner_sw.tga\" \"\" 0.100000 0.924444 0.120000 0.960000 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_top1\" \"*black\" \"\" 0.120000 0.035556 0.880000 0.071111 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_top2\" \"*black\" \"\" 0.100000 0.071111 0.900000 0.160000 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_bottom\" \"*black\" \"\" 0.120000 0.924444 0.880000 0.960000 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_body\" \"*black\" \"\" 0.100000 0.165000 0.900000 0.924444 0 0 0 150 6\r\nif $menu_bg_fill >= 1;:touch_removebutton _menu_bg_*;:touch_addbutton _menu_bg_body *black \"\" 0 0 1 1 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_icn_logo\" \"gfx/vgui/cs_logo.tga\" \"\" 0.110000 0.053333 0.160000 0.142222 255 174 0 255 6\r\ntouch_addbutton \"_menu_bg_txt_logo\" \"#BUY SUBMACHINE GUNS (PRIMARY WEAPON)\" \"\" 0.170000 0.071111 0.890000 0.142222 255 174 0 255 6\r\n\r\n//touch_addbutton \"_menu_txt_title\" \"#THE TITLE\" \"\" 0.140000 0.177778 0.860000 0.213333 255 174 0 255 4\r\ntouch_addbutton \"_menu_slot1\" \"*white\" \"_menu_select_slot1\" 0.140000 0.213333 0.360000 0.266667 0 0 0 150 260\r\ntouch_addbutton \"_menu_txt_slot1\" \"#1 INGRAM MAC-10\" \"\" 0.150000 0.231111 0.360000 0.266667 255 174 0 255 4\r\ntouch_addbutton \"_menu_slot2\" \"*white\" \"_menu_select_slot2\" 0.140000 0.284444 0.360000 0.337778 0 0 0 150 260\r\ntouch_addbutton \"_menu_txt_slot2\" \"#2 K&M SUB-MACHINE GUN\" \"\" 0.150000 0.302222 0.360000 0.337778 255 174 0 255 4\r\ntouch_addbutton \"_menu_slot3\" \"*white\" \"_menu_select_slot3\" 0.140000 0.355556 0.360000 0.408889 0 0 0 150 260\r\ntouch_addbutton \"_menu_txt_slot3\" \"#3 K&M UMP45\" \"\" 0.150000 0.373333 0.360000 0.408889 255 174 0 255 4\r\ntouch_addbutton \"_menu_slot4\" \"*white\" \"_menu_select_slot4\" 0.140000 0.426667 0.360000 0.480000 0 0 0 150 260\r\ntouch_addbutton \"_menu_txt_slot4\" \"#4 ES C90\" \"\" 0.150000 0.444444 0.360000 0.480000 255 174 0 255 4\r\n//touch_addbutton \"_menu_slot5\" \"*white\" \"_menu_select_slot5\" 0.140000 0.497778 0.360000 0.551111 0 0 0 150 260\r\n//touch_addbutton \"_menu_txt_slot5\" \"#5 SLOT\" \"\" 0.150000 0.515556 0.360000 0.551111 255 174 0 255 4\r\n//touch_addbutton \"_menu_slot6\" \"*white\" \"_menu_select_slot6\" 0.140000 0.568889 0.360000 0.622222 0 0 0 150 260\r\n//touch_addbutton \"_menu_txt_slot6\" \"#6 SLOT\" \"\" 0.150000 0.586667 0.360000 0.622222 255 174 0 255 4\r\n//touch_addbutton \"_menu_slot7\" \"*white\" \"_menu_select_slot7\" 0.140000 0.640000 0.360000 0.693333 0 0 0 150 260\r\n//touch_addbutton \"_menu_txt_slot7\" \"#7 SLOT\" \"\" 0.150000 0.657778 0.360000 0.693333 255 174 0 255 4\r\n//touch_addbutton \"_menu_slot8\" \"*white\" \"_menu_select_slot8\" 0.140000 0.711111 0.360000 0.764444 0 0 0 150 260\r\n//touch_addbutton \"_menu_txt_slot8\" \"#8 SLOT\" \"\" 0.150000 0.728889 0.360000 0.764444 255 174 0 255 4\r\n//touch_addbutton \"_menu_slot9\" \"*white\" \"\" 0.140000 0.782222 0.360000 0.835556 0 0 0 150 260\r\n//touch_addbutton \"_menu_txt_slot9\" \"#9 SLOT\" \"\" 0.150000 0.800000 0.360000 0.835556 255 174 0 255 4\r\ntouch_addbutton \"_menu_slot0\" \"*white\" \"+menu_slot0\" 0.14 0.871111 0.36 0.924444 0 0 0 150 260\r\ntouch_addbutton \"_menu_txt_slot0\" \"#0 CANCEL\" \"\" 0.15 0.888889 0.36 0.924444 255 174 0 255 4\r\n\r\nset _menu_money_item1 \"1400\"; if $cscl_currentmoney < $_menu_money_item1;: touch_setcolor _menu_txt_slot1 129 85 0 255\r\nset _menu_money_item2 \"1500\"; if $cscl_currentmoney < $_menu_money_item2;: touch_setcolor _menu_txt_slot2 129 85 0 255\r\nset _menu_money_item3 \"1700\"; if $cscl_currentmoney < $_menu_money_item3;: touch_setcolor _menu_txt_slot3 129 85 0 255\r\nset _menu_money_item4 \"2350\"; if $cscl_currentmoney < $_menu_money_item4;: touch_setcolor _menu_txt_slot4 129 85 0 255\r\n//set _menu_money_item5 \"\"; if $cscl_currentmoney < $_menu_money_item5;: touch_setcolor _menu_txt_slot5 129 85 0 255\r\n//set _menu_money_item6 \"\"; if $cscl_currentmoney < $_menu_money_item6;: touch_setcolor _menu_txt_slot6 129 85 0 255\r\n//set _menu_money_item7 \"\"; if $cscl_currentmoney < $_menu_money_item7;: touch_setcolor _menu_txt_slot7 129 85 0 255\r\n//set _menu_money_item8 \"\"; if $cscl_currentmoney < $_menu_money_item8;: touch_setcolor _menu_txt_slot8 129 85 0 255\r\n\r\ntouch_addbutton \"_menu_frame\" \"*white\" \"\" 0.390000 0.213333 0.840000 0.551111 0 0 0 150 260\r\ntouch_addbutton \"_menu_frame_icn_class1\" \"gfx/vgui/mac10.tga\" \"\" 0.430000 0.215333 0.810000 0.549111 255 255 255 255 4\r\ntouch_addbutton \"_menu_frame_icn_class2\" \"gfx/vgui/mp5.tga\" \"\" 0.430000 0.215333 0.810000 0.549111 255 255 255 255 4\r\ntouch_addbutton \"_menu_frame_icn_class3\" \"gfx/vgui/ump45.tga\" \"\" 0.430000 0.215333 0.810000 0.549111 255 255 255 255 4\r\ntouch_addbutton \"_menu_frame_icn_class4\" \"gfx/vgui/p90.tga\" \"\" 0.430000 0.215333 0.810000 0.549111 255 255 255 255 4\r\n//touch_addbutton \"_menu_frame_icn_class5\" \"\" \"\" 0.430000 0.215333 0.810000 0.549111 255 255 255 255 4\r\n//touch_addbutton \"_menu_frame_icn_class6\" \"\" \"\" 0.430000 0.215333 0.810000 0.549111 255 255 255 255 4\r\n//touch_addbutton \"_menu_frame_icn_class7\" \"\" \"\" 0.430000 0.215333 0.810000 0.549111 255 255 255 255 4\r\n//touch_addbutton \"_menu_frame_icn_class8\" \"\" \"\" 0.430000 0.215333 0.810000 0.549111 255 255 255 255 4\r\n\r\ntouch_addbutton \"_menu_confirm\" \"*white\" \"+menu_confirm\" 0.62 0.871111 0.84 0.924444 0 0 0 150 260\r\ntouch_addbutton \"_menu_confirm_txt\" \"#BUY THE ITEM\" \"\" 0.63 0.888889 0.84 0.924444 255 174 0 255 4\r\n\r\ntouch_addbutton \"_menu_frame_txt_data1_1\" \"#PRICE\" \"\" 0.39 0.551111 0.56 0.586667 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data1_2\" \"#COUNTRY OF ORIGIN\" \"\" 0.39 0.586667 0.56 0.622222 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data1_3\" \"#CALIBER\" \"\" 0.39 0.622222 0.56 0.657778 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data1_4\" \"#CLIP CAPACITY\" \"\" 0.39 0.657778 0.56 0.693333 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data1_5\" \"#RATE OF FIRE\" \"\" 0.39 0.693333 0.56 0.728889 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data1_6\" \"#WEIGHT (LOADED)\" \"\" 0.39 0.728889 0.56 0.764444 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data1_7\" \"#PROJECTILE WEIGHT\" \"\" 0.39 0.764444 0.56 0.8 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data1_8\" \"#MUZZLE VELOCITY\" \"\" 0.39 0.8 0.56 0.835556 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data1_9\" \"#MUZZLE ENERGY\" \"\" 0.39 0.835556 0.56 0.871111 240 180 24 255 4\r\n\r\ntouch_addbutton \"_menu_frame_txt_data2_1\" \"#PRICE\" \"\" 0.39 0.551111 0.56 0.586667 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data2_2\" \"#COUNTRY OF ORIGIN\" \"\" 0.39 0.586667 0.56 0.622222 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data2_3\" \"#CALIBER\" \"\" 0.39 0.622222 0.56 0.657778 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data2_4\" \"#CLIP CAPACITY\" \"\" 0.39 0.657778 0.56 0.693333 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data2_5\" \"#RATE OF FIRE\" \"\" 0.39 0.693333 0.56 0.728889 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data2_6\" \"#WEIGHT (EMPTY)\" \"\" 0.39 0.728889 0.56 0.764444 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data2_7\" \"#PROJECTILE WEIGHT\" \"\" 0.39 0.764444 0.56 0.8 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data2_8\" \"#MUZZLE VELOCITY\" \"\" 0.39 0.8 0.56 0.835556 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_data2_9\" \"#MUZZLE ENERGY\" \"\" 0.39 0.835556 0.56 0.871111 240 180 24 255 4\r\n\r\ntouch_addbutton \"_menu_frame_txt_desc1_1\" \"#: \\$$_menu_money_item1\" \"\" 0.56 0.551111 0.84 0.586667 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc1_2\" \"#: UNITED STATES OF AMERICA\" \"\" 0.56 0.586667 0.84 0.622222 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc1_3\" \"#: .45 ACP\" \"\" 0.56 0.622222 0.84 0.657778 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc1_4\" \"#: 30 ROUNDS\" \"\" 0.56 0.657778 0.84 0.693333 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc1_5\" \"#: 857 RPM\" \"\" 0.56 0.693333 0.84 0.728889 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc1_6\" \"#: 3.82 KG\" \"\" 0.56 0.728889 0.84 0.764444 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc1_7\" \"#: 15.2 GRAMS\" \"\" 0.56 0.764444 0.84 0.8 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc1_8\" \"#: 919 FEET/SECOND\" \"\" 0.56 0.8 0.84 0.835556 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc1_9\" \"#: 584 JOULES\" \"\" 0.56 0.835556 0.84 0.871111 240 180 24 255 4\r\n\r\ntouch_addbutton \"_menu_frame_txt_desc2_1\" \"#: \\$$_menu_money_item2\" \"\" 0.56 0.551111 0.84 0.586667 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc2_2\" \"#: GERMANY\" \"\" 0.56 0.586667 0.84 0.622222 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc2_3\" \"#: 9MM PARABELLUM\" \"\" 0.56 0.622222 0.84 0.657778 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc2_4\" \"#: 30 ROUNDS\" \"\" 0.56 0.657778 0.84 0.693333 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc2_5\" \"#: 800 RPM\" \"\" 0.56 0.693333 0.84 0.728889 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc2_6\" \"#: 3.42KG\" \"\" 0.56 0.728889 0.84 0.764444 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc2_7\" \"#: 8 GRAMS\" \"\" 0.56 0.764444 0.84 0.8 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc2_8\" \"#: 1132 FEET/SECOND\" \"\" 0.56 0.8 0.84 0.835556 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc2_9\" \"#: 637 JOULES\" \"\" 0.56 0.835556 0.84 0.871111 240 180 24 255 4\r\n\r\ntouch_addbutton \"_menu_frame_txt_desc3_1\" \"#: \\$$_menu_money_item3\" \"\" 0.56 0.551111 0.84 0.586667 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc3_2\" \"#: GERMANY\" \"\" 0.56 0.586667 0.84 0.622222 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc3_3\" \"#: .45 ACP\" \"\" 0.56 0.622222 0.84 0.657778 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc3_4\" \"#: 25 ROUNDS\" \"\" 0.56 0.657778 0.84 0.693333 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc3_5\" \"#: 600 RPM\" \"\" 0.56 0.693333 0.84 0.728889 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc3_6\" \"#: 2.27KG\" \"\" 0.56 0.728889 0.84 0.764444 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc3_7\" \"#: 15.2 GRAMS\" \"\" 0.56 0.764444 0.84 0.8 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc3_8\" \"#: 1005 FEET/SECOND\" \"\" 0.56 0.8 0.84 0.835556 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc3_9\" \"#: 625 JOULES\" \"\" 0.56 0.835556 0.84 0.871111 240 180 24 255 4\r\n\r\ntouch_addbutton \"_menu_frame_txt_desc4_1\" \"#: \\$$_menu_money_item4\" \"\" 0.56 0.551111 0.84 0.586667 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc4_2\" \"#: BELGIUM\" \"\" 0.56 0.586667 0.84 0.622222 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc4_3\" \"#: 5.7 x 28MM\" \"\" 0.56 0.622222 0.84 0.657778 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc4_4\" \"#: 50 ROUNDS\" \"\" 0.56 0.657778 0.84 0.693333 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc4_5\" \"#: 900 RPM\" \"\" 0.56 0.693333 0.84 0.728889 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc4_6\" \"#: 3KG\" \"\" 0.56 0.728889 0.84 0.764444 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc4_7\" \"#: 2 GRAMS\" \"\" 0.56 0.764444 0.84 0.8 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc4_8\" \"#: 2345 FEET/SECOND\" \"\" 0.56 0.8 0.84 0.835556 240 180 24 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc4_9\" \"#: 465 JOULES\" \"\" 0.56 0.835556 0.84 0.871111 240 180 24 255 4\r\n\r\n//touch_addbutton \"_menu_frame_txt_desc5_1\" \"#: \" \"\" 0.56 0.551111 0.84 0.586667 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc5_2\" \"#: \" \"\" 0.56 0.586667 0.84 0.622222 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc5_3\" \"#: \" \"\" 0.56 0.622222 0.84 0.657778 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc5_4\" \"#: \" \"\" 0.56 0.657778 0.84 0.693333 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc5_5\" \"#: \" \"\" 0.56 0.693333 0.84 0.728889 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc5_6\" \"#: \" \"\" 0.56 0.728889 0.84 0.764444 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc5_7\" \"#: \" \"\" 0.56 0.764444 0.84 0.8 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc5_8\" \"#: \" \"\" 0.56 0.8 0.84 0.835556 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc5_9\" \"#: \" \"\" 0.56 0.835556 0.84 0.871111 240 180 24 255 4\r\n\r\n//touch_addbutton \"_menu_frame_txt_desc6_1\" \"#: \" \"\" 0.56 0.551111 0.84 0.586667 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc6_2\" \"#: \" \"\" 0.56 0.586667 0.84 0.622222 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc6_3\" \"#: \" \"\" 0.56 0.622222 0.84 0.657778 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc6_4\" \"#: \" \"\" 0.56 0.657778 0.84 0.693333 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc6_5\" \"#: \" \"\" 0.56 0.693333 0.84 0.728889 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc6_6\" \"#: \" \"\" 0.56 0.728889 0.84 0.764444 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc6_7\" \"#: \" \"\" 0.56 0.764444 0.84 0.8 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc6_8\" \"#: \" \"\" 0.56 0.8 0.84 0.835556 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc6_9\" \"#: \" \"\" 0.56 0.835556 0.84 0.871111 240 180 24 255 4\r\n\r\n//touch_addbutton \"_menu_frame_txt_desc7_1\" \"#: \" \"\" 0.56 0.551111 0.84 0.586667 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc7_2\" \"#: \" \"\" 0.56 0.586667 0.84 0.622222 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc7_3\" \"#: \" \"\" 0.56 0.622222 0.84 0.657778 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc7_4\" \"#: \" \"\" 0.56 0.657778 0.84 0.693333 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc7_5\" \"#: \" \"\" 0.56 0.693333 0.84 0.728889 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc7_6\" \"#: \" \"\" 0.56 0.728889 0.84 0.764444 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc7_7\" \"#: \" \"\" 0.56 0.764444 0.84 0.8 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc7_8\" \"#: \" \"\" 0.56 0.8 0.84 0.835556 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc7_9\" \"#: \" \"\" 0.56 0.835556 0.84 0.871111 240 180 24 255 4\r\n\r\n//touch_addbutton \"_menu_frame_txt_desc8_1\" \"#: \" \"\" 0.56 0.551111 0.84 0.586667 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc8_2\" \"#: \" \"\" 0.56 0.586667 0.84 0.622222 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc8_3\" \"#: \" \"\" 0.56 0.622222 0.84 0.657778 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc8_4\" \"#: \" \"\" 0.56 0.657778 0.84 0.693333 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc8_5\" \"#: \" \"\" 0.56 0.693333 0.84 0.728889 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc8_6\" \"#: \" \"\" 0.56 0.728889 0.84 0.764444 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc8_7\" \"#: \" \"\" 0.56 0.764444 0.84 0.8 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc8_8\" \"#: \" \"\" 0.56 0.8 0.84 0.835556 240 180 24 255 4\r\n//touch_addbutton \"_menu_frame_txt_desc8_9\" \"#: \" \"\" 0.56 0.835556 0.84 0.871111 240 180 24 255 4\r\n\r\ntouch_addbutton \"_menu_txt_money\" \"#YOU HAVE \\$$cscl_currentmoney\" \"_menu_refresh\" 0.170000 0.106667 0.890000 0.160000 255 174 0 255 4\r\nalias _menu_refresh \"exec touch/buy_submachinegun_t.cfg\"\r\n\r\nalias _menu_none \"touch_setcolor _menu_slot* 0 0 0 150; touch_hide _menu_frame_icn_class*; touch_hide _menu_frame_txt_data*; touch_hide _menu_frame_txt_desc*; touch_hide _menu_confirm*\"\r\n_menu_none\r\n\r\n//alias +menu_slot0 \"touch_setcolor _menu_slot0 255 174 0 150\"\r\n//alias -menu_slot0 \"touch_setcolor _menu_slot0 0 0 0 150\"\r\n//alias _menu_select_slot1 \"_menu_none; touch_setcolor _menu_slot1 255 174 0 150; touch_show _menu_frame_icn_class1; touch_show _menu_frame_txt_desc1; if $cscl_currentmoney>=0;:_menu_show_confirm ; alias _menu_confirmed joinclass 1\"\r\n\r\nalias +menu_slot0 \"_click; touch_setcolor _menu_slot0 255 174 0 150\"\r\nalias -menu_slot0 \"touch_setcolor _menu_slot0 0 0 0 150; _erase_frame\"\r\nif $buymenu_stayon >= 1;:alias -menu_slot0 \"touch_setcolor _menu_slot0 0 0 0 150; _erase_frame; buy\"\r\n\r\nalias _menu_confirmed \"\"\r\nalias _menu_show_confirm \"touch_show _menu_confirm*\"\r\n\r\nalias _menu_select_slot1 \"_click; _menu_none; touch_setcolor _menu_slot1 255 174 0 150; touch_show _menu_frame_icn_class1; touch_show _menu_frame_txt_data1_*; touch_show _menu_frame_txt_desc1_*; if $cscl_currentmoney >= $_menu_money_item1;:_menu_show_confirm ; alias _menu_confirmed mac10\"\r\nalias _menu_select_slot2 \"_click; _menu_none; touch_setcolor _menu_slot2 255 174 0 150; touch_show _menu_frame_icn_class2; touch_show _menu_frame_txt_data2_*; touch_show _menu_frame_txt_desc2_*; if $cscl_currentmoney >= $_menu_money_item2;:_menu_show_confirm ; alias _menu_confirmed mp5\"\r\nalias _menu_select_slot3 \"_click; _menu_none; touch_setcolor _menu_slot3 255 174 0 150; touch_show _menu_frame_icn_class3; touch_show _menu_frame_txt_data1_*; touch_show _menu_frame_txt_desc3_*; if $cscl_currentmoney >= $_menu_money_item3;:_menu_show_confirm ; alias _menu_confirmed ump45\"\r\nalias _menu_select_slot4 \"_click; _menu_none; touch_setcolor _menu_slot4 255 174 0 150; touch_show _menu_frame_icn_class4; touch_show _menu_frame_txt_data1_*; touch_show _menu_frame_txt_desc4_*; if $cscl_currentmoney >= $_menu_money_item4;:_menu_show_confirm ; alias _menu_confirmed p90\"\r\n//alias _menu_select_slot5 \"_click; _menu_none; touch_setcolor _menu_slot5 255 174 0 150; touch_show _menu_frame_icn_class5; touch_show _menu_frame_txt_data1_*; touch_show _menu_frame_txt_desc5_*; if $cscl_currentmoney >= $_menu_money_item5;:_menu_show_confirm ; alias _menu_confirmed \"\r\n//alias _menu_select_slot6 \"_click; _menu_none; touch_setcolor _menu_slot6 255 174 0 150; touch_show _menu_frame_icn_class6; touch_show _menu_frame_txt_data1_*; touch_show _menu_frame_txt_desc6_*; if $cscl_currentmoney >= $_menu_money_item6;:_menu_show_confirm ; alias _menu_confirmed \"\r\n//alias _menu_select_slot7 \"_click; _menu_none; touch_setcolor _menu_slot7 255 174 0 150; touch_show _menu_frame_icn_class7; touch_show _menu_frame_txt_data1_*; touch_show _menu_frame_txt_desc7_*; if $cscl_currentmoney >= $_menu_money_item7;:_menu_show_confirm ; alias _menu_confirmed \"\r\n//alias _menu_select_slot8 \"_click; _menu_none; touch_setcolor _menu_slot8 255 174 0 150; touch_show _menu_frame_icn_class8; touch_show _menu_frame_txt_data1_*; touch_show _menu_frame_txt_desc8_*; if $cscl_currentmoney >= $_menu_money_item8;:_menu_show_confirm ; alias _menu_confirmed \"\r\n\r\nalias +menu_confirm \"_click; touch_setcolor _menu_confirm 255 174 0 150\"\r\nalias -menu_confirm \"touch_setcolor _menu_confirm 0 0 0 150; _menu_confirmed; wait; wait; _erase_frame\"\r\n"
  },
  {
    "path": "3rdparty/cs16client-extras/touch/chooseteam.cfg",
    "content": "// Coded by Alprnn357\r\ntouch_setclientonly 1\r\ncmd_scripting 1\r\ntouch_set_stroke 1 255 174 0 150\r\nset scenario_defined 0\r\n\r\nalias _erase_frame \"touch_removebutton _menu_*; _menu_off; hidescoreboard2; slot10\"\r\nalias _menu_off \"touch_setclientonly 0\"\r\nalias _click \"play media/launch_select1.wav; vibrate 30\"\r\n\r\ntouch_addbutton \"_menu_bg_crn4\" \"gfx/vgui/round_corner_se.tga\" \"\" 0.880000 0.924444 0.900000 0.960000 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_crn2\" \"gfx/vgui/round_corner_ne.tga\" \"\" 0.880000 0.035556 0.900000 0.071111 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_crn1\" \"gfx/vgui/round_corner_nw.tga\" \"\" 0.100000 0.035556 0.120000 0.071111 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_crn3\" \"gfx/vgui/round_corner_sw.tga\" \"\" 0.100000 0.924444 0.120000 0.960000 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_top1\" \"*black\" \"\" 0.120000 0.035556 0.880000 0.071111 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_top2\" \"*black\" \"\" 0.100000 0.071111 0.900000 0.160000 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_bottom\" \"*black\" \"\" 0.120000 0.924444 0.880000 0.960000 0 0 0 150 6\r\n//touch_addbutton \"_menu_bg_body\" \"*black\" \"\" 0.100000 0.165000 0.900000 0.924444 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_body1\" \"*black\" \"\" 0.100000 0.165000 0.390000 0.924444 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_body2\" \"*black\" \"\" 0.390000 0.835556 0.860000 0.924444 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_body3\" \"*black\" \"\" 0.860000 0.165000 0.900000 0.924444 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_body4\" \"*black\" \"\" 0.390000 0.165000 0.860000 0.213333 0 0 0 150 6\r\nif $menu_bg_fill >= 1\r\n:touch_removebutton _menu_bg_*\r\n:touch_addbutton _menu_bg_body1 *black \"\" 0 0 0.390000 1 0 0 0 150 6\r\n:touch_addbutton _menu_bg_body2 *black \"\" 0.390000 0.835556 0.860000 1 0 0 0 150 6\r\n:touch_addbutton _menu_bg_body3 *black \"\" 0.860000 0 1 1 0 0 0 150 6\r\n:touch_addbutton _menu_bg_body4 *black \"\" 0.390000 0 0.860000 0.213333 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_icn_logo\" \"gfx/vgui/cs_logo.tga\" \"_menu_vip\" 0.110000 0.053333 0.160000 0.142222 255 174 0 255 6\r\ntouch_addbutton \"_menu_bg_txt_logo\" \"#SELECT TEAM\" \"\" 0.170000 0.071111 0.890000 0.142222 255 174 0 255 6\r\n\r\n//touch_addbutton \"_menu_txt_title\" \"#THE TITLE\" \"\" 0.140000 0.177778 0.860000 0.213333 255 174 0 255 4\r\ntouch_addbutton \"_menu_slot1\" \"*white\" \"+menu_slot1\" 0.140000 0.213333 0.360000 0.266667 0 0 0 150 260\r\ntouch_addbutton \"_menu_txt_slot1\" \"#1 TERRORIST FORCES\" \"\" 0.150000 0.231111 0.360000 0.266667 255 174 0 255 4\r\ntouch_addbutton \"_menu_slot2\" \"*white\" \"+menu_slot2\" 0.140000 0.284444 0.360000 0.337778 0 0 0 150 260\r\ntouch_addbutton \"_menu_txt_slot2\" \"#2 CT FORCES\" \"\" 0.150000 0.302222 0.360000 0.337778 255 174 0 255 4\r\ntouch_addbutton \"_menu_slot3\" \"*white\" \"+menu_slot3\" 0.140000 0.355556 0.360000 0.408889 0 0 0 150 260\r\ntouch_addbutton \"_menu_txt_slot3\" \"#3 BECOME VIP\" \"\" 0.150000 0.373333 0.360000 0.408889 255 174 0 255 4\r\n//touch_addbutton \"_menu_slot4\" \"*white\" \"\" 0.140000 0.426667 0.360000 0.480000 0 0 0 150 260\r\n//touch_addbutton \"_menu_txt_slot4\" \"#4 SLOT\" \"\" 0.150000 0.444444 0.360000 0.480000 255 174 0 255 4\r\ntouch_addbutton \"_menu_slot5\" \"*white\" \"+menu_slot5\" 0.140000 0.497778 0.360000 0.551111 0 0 0 150 260\r\ntouch_addbutton \"_menu_txt_slot5\" \"#5 AUTO ASSIGN\" \"\" 0.150000 0.515556 0.360000 0.551111 255 174 0 255 4\r\ntouch_addbutton \"_menu_slot6\" \"*white\" \"+menu_slot6\" 0.140000 0.568889 0.360000 0.622222 0 0 0 150 260\r\ntouch_addbutton \"_menu_txt_slot6\" \"#6 SPECTATE\" \"\" 0.150000 0.586667 0.360000 0.622222 255 174 0 255 4\r\n//touch_addbutton \"_menu_slot7\" \"*white\" \"\" 0.140000 0.640000 0.360000 0.693333 0 0 0 150 260\r\n//touch_addbutton \"_menu_txt_slot7\" \"#7 SLOT\" \"\" 0.150000 0.657778 0.360000 0.693333 255 174 0 255 4\r\n//touch_addbutton \"_menu_slot8\" \"*white\" \"\" 0.140000 0.711111 0.360000 0.764444 0 0 0 150 260\r\n//touch_addbutton \"_menu_txt_slot8\" \"#8 SLOT\" \"\" 0.150000 0.728889 0.360000 0.764444 255 174 0 255 4\r\ntouch_addbutton \"_menu_slot9\" \"*white\" \"+menu_slot9\" 0.140000 0.782222 0.360000 0.835556 0 0 0 150 260\r\ntouch_addbutton \"_menu_txt_slot9\" \"#9 SHOW SCOREBOARD\" \"\" 0.150000 0.800000 0.360000 0.835556 255 174 0 255 4\r\ntouch_addbutton \"_menu_slot0\" \"*white\" \"+menu_slot0\" 0.14 0.871111 0.36 0.924444 0 0 0 150 260\r\ntouch_addbutton \"_menu_txt_slot0\" \"#0 CANCEL\" \"\" 0.15 0.888889 0.36 0.924444 255 174 0 255 4\r\ntouch_addbutton \"_menu_frame\" \"*white\" \"\" 0.390000 0.213333 0.860000 0.835556 0 0 0 200 260\r\n\r\nif $cscl_mapprefix == as_\r\n:scenario_defined 1\r\n:touch_addbutton \"_menu_frame_txt_title\" \"#VIP Assassination scenario.\" \"\" 0.400000 0.231111 0.850000 0.817778 255 174 0 255 4\r\n:touch_addbutton \"_menu_frame_txt_desc1\" \"#Terrorists:;The Terrorists must eliminate the VIP before he reaches the;extraction point.\" \"\" 0.400000 0.284444 0.850000 0.426667 255 174 0 255 4\r\n:touch_addbutton \"_menu_frame_txt_desc2\" \"#Counter-Terrorists:;Escort the VIP to the extraction point, eliminating Terrorist forces;along the way.\" \"\" 0.400000 0.444444 0.850000 0.551111 255 174 0 255 4\r\n\r\nif $cscl_mapprefix == cs_\r\n:scenario_defined 1\r\n:touch_addbutton \"_menu_frame_txt_title\" \"#Hostage Rescue scenario.\" \"\" 0.400000 0.231111 0.850000 0.817778 255 174 0 255 4\r\n:touch_addbutton \"_menu_frame_txt_desc1\" \"#Terrorists:;Prevent hostages from being rescued by Сounter-Terrorist forces.\" \"\" 0.400000 0.284444 0.850000 0.426667 255 174 0 255 4\r\n:touch_addbutton \"_menu_frame_txt_desc2\" \"#Counter-Terrorists:;Escort the hostages to the rescue zone.\" \"\" 0.400000 0.444444 0.850000 0.551111 255 174 0 255 4\r\n\r\nif $cscl_mapprefix == de_\r\n:scenario_defined 1\r\n:touch_addbutton \"_menu_frame_txt_title\" \"#Bomb Plant/Defuse scenario.\" \"\" 0.400000 0.231111 0.850000 0.817778 255 174 0 255 4\r\n:touch_addbutton \"_menu_frame_txt_desc1\" \"#Terrorists:;A terrorist carrying C4 must blow up one of the payloads or;strategic objects.\" \"\" 0.400000 0.284444 0.850000 0.426667 255 174 0 255 4\r\n:touch_addbutton \"_menu_frame_txt_desc2\" \"#Counter-Terrorists:;Prevent Terrorists from blowing up payloads or strategic objects.\" \"\" 0.400000 0.444444 0.850000 0.551111 255 174 0 255 4\r\n\r\nif $cscl_mapprefix == es_\r\n:scenario_defined 1\r\n:touch_addbutton \"_menu_frame_txt_title\" \"#Terrorist Escape scenario.\" \"\" 0.400000 0.231111 0.850000 0.817778 255 174 0 255 4\r\n:touch_addbutton \"_menu_frame_txt_desc1\" \"#Terrorists:;Find places with equipment and use it for defense during your;escape.\" \"\" 0.400000 0.284444 0.850000 0.426667 255 174 0 255 4\r\n:touch_addbutton \"_menu_frame_txt_desc2\" \"#Counter-Terrorists:;Do not let the Terrorists escape.\" \"\" 0.400000 0.444444 0.850000 0.551111 255 174 0 255 4\r\n\r\nif $cscl_mapprefix == csde_\r\n:scenario_defined 1\r\n:touch_addbutton \"_menu_frame_txt_title\" \"#Hostage Rescue and Bomb Plant/Defuse scenario.\" \"\" 0.400000 0.231111 0.850000 0.817778 255 174 0 255 4\r\n:touch_addbutton \"_menu_frame_txt_desc1\" \"#Terrorists:;Destroy one of the payloads or strategic objects and don't let the;Counter-Terrorists rescue the hostages.\" \"\" 0.400000 0.284444 0.850000 0.426667 255 174 0 255 4\r\n:touch_addbutton \"_menu_frame_txt_desc2\" \"#Counter-Terrorists:;Rescue the hostages and prevent the terrorists from blowing up;any objects.\" \"\" 0.400000 0.444444 0.850000 0.551111 255 174 0 255 4\r\n\r\nif $cscl_mapprefix == fy_\r\n:scenario_defined 1\r\n:touch_addbutton \"_menu_frame_txt_title\" \"#Fight Yard scenario.\" \"\" 0.400000 0.231111 0.850000 0.817778 255 174 0 255 4\r\n:touch_addbutton \"_menu_frame_txt_desc1\" \"#Pick up weapons from the ground or look for the buy zone and;kill each other.\" \"\" 0.400000 0.284444 0.850000 0.426667 255 174 0 255 4\r\n\r\nif $cscl_mapprefix == he_\r\n:scenario_defined 1\r\n:touch_addbutton \"_menu_frame_txt_title\" \"#Grenade Wars scenario.\" \"\" 0.400000 0.231111 0.850000 0.817778 255 174 0 255 4\r\n:touch_addbutton \"_menu_frame_txt_desc1\" \"#You have to blow each other up with high explosive grenades.\" \"\" 0.400000 0.284444 0.850000 0.426667 255 174 0 255 4\r\n\r\nif $cscl_mapprefix == awp_\r\n:scenario_defined 1\r\n:touch_addbutton \"_menu_frame_txt_title\" \"#Sniper Wars scenario.\" \"\" 0.400000 0.231111 0.850000 0.817778 255 174 0 255 4\r\n:touch_addbutton \"_menu_frame_txt_desc1\" \"#You have to kill enemies with a sniper rifle.\" \"\" 0.400000 0.284444 0.850000 0.426667 255 174 0 255 4\r\n\r\nif $cscl_mapprefix == ka_\r\n:scenario_defined 1\r\n:touch_addbutton \"_menu_frame_txt_title\" \"#Knife Arena scenario.\" \"\" 0.400000 0.231111 0.850000 0.817778 255 174 0 255 4\r\n:touch_addbutton \"_menu_frame_txt_desc1\" \"#You have to kill enemies with a knife.\" \"\" 0.400000 0.284444 0.850000 0.426667 255 174 0 255 4\r\n\r\nif $cscl_mapprefix == 1hp_\r\n:scenario_defined 1\r\n:touch_addbutton \"_menu_frame_txt_title\" \"#1 Health Point scenario.\" \"\" 0.400000 0.231111 0.850000 0.817778 255 174 0 255 4\r\n:touch_addbutton \"_menu_frame_txt_desc1\" \"#You need to kill enemies with a knife with one health point.\" \"\" 0.400000 0.284444 0.850000 0.426667 255 174 0 255 4\r\n\r\nif $cscl_mapprefix == 35hp_\r\n:scenario_defined 1\r\n:touch_addbutton \"_menu_frame_txt_title\" \"#35 Health Points scenario.\" \"\" 0.400000 0.231111 0.850000 0.817778 255 174 0 255 4\r\n:touch_addbutton \"_menu_frame_txt_desc1\" \"#You need to kill enemies with a knife with 35 health points.\" \"\" 0.400000 0.284444 0.850000 0.426667 255 174 0 255 4\r\n\r\nif $cscl_mapprefix == aim_\r\n:scenario_defined 1\r\n:touch_addbutton \"_menu_frame_txt_title\" \"#Aim Training scenario.\" \"\" 0.400000 0.231111 0.850000 0.817778 255 174 0 255 4\r\n:touch_addbutton \"_menu_frame_txt_desc1\" \"#On this map, you can train your aim on a specific type of weapon.\" \"\" 0.400000 0.284444 0.850000 0.426667 255 174 0 255 4\r\n\r\nif $cscl_mapprefix == dm_\r\n:scenario_defined 1\r\n:touch_addbutton \"_menu_frame_txt_title\" \"#Deathmatch scenario.\" \"\" 0.400000 0.231111 0.850000 0.817778 255 174 0 255 4\r\n:touch_addbutton \"_menu_frame_txt_desc1\" \"#The objective is simple - kill each other to death.;No additional tasks are provided.\" \"\" 0.400000 0.284444 0.850000 0.426667 255 174 0 255 4\r\n\r\nif $scenario_defined != 1\r\n:touch_addbutton \"_menu_frame_txt_title\" \"#The map scenario is undefined.\" \"\" 0.400000 0.231111 0.850000 0.817778 255 174 0 255 4\r\n\r\nalias +menu_slot0 \"_click; touch_setcolor _menu_slot0 255 174 0 150\"\r\nalias -menu_slot0 \"touch_setcolor _menu_slot0 0 0 0 150; slot10; _erase_frame\"\r\n\r\nalias +menu_slot1 \"_click; touch_setcolor _menu_slot1 255 174 0 150\"\r\nalias -menu_slot1 \"touch_setcolor _menu_slot1 0 0 0 150; jointeam 1; wait; wait; _erase_frame\"\r\n\r\nalias +menu_slot2 \"_click; touch_setcolor _menu_slot2 255 174 0 150\"\r\nalias -menu_slot2 \"touch_setcolor _menu_slot2 0 0 0 150; jointeam 2; wait; wait; _erase_frame\"\r\n\r\nalias +menu_slot3 \"_click; touch_setcolor _menu_slot3 255 174 0 150\"\r\nalias -menu_slot3 \"touch_setcolor _menu_slot3 0 0 0 150; jointeam 3; wait; wait; _erase_frame\"\r\n\r\nalias +menu_slot5 \"_click; touch_setcolor _menu_slot5 255 174 0 150\"\r\nalias -menu_slot5 \"touch_setcolor _menu_slot5 0 0 0 150; jointeam 5; wait; wait; _erase_frame\"\r\n\r\nalias +menu_slot6 \"_click; touch_setcolor _menu_slot6 255 174 0 150\"\r\nalias -menu_slot6 \"touch_setcolor _menu_slot6 0 0 0 150; jointeam 6; wait; wait; _erase_frame\"\r\n\r\nalias +menu_slot9 \"_click; touch_setcolor _menu_slot9 255 174 0 150\"\r\nalias -menu_slot9 \"touch_setcolor _menu_slot9 0 0 0 150; _menu_scores\"\r\n\r\nalias _menu_vip \"_menu_vip_show\"\r\nalias _menu_vip_show \"alias _menu_vip _menu_vip_hide; touch_show _menu_*slot3\"\r\nalias _menu_vip_hide \"alias _menu_vip _menu_vip_show; touch_hide _menu_*slot3\"\r\n\r\nalias _menu_scores \"_menu_scores_show\"\r\nalias _menu_scores_show \"teammenu_showscores 1; alias _menu_scores _menu_scores_hide; touch_settexture _menu_txt_slot9 \\\"#9 HIDE SCOREBOARD\\\"; touch_setcolor _menu_frame 0 0 0 0; touch_hide _menu_frame_*; showscoreboard2 0.390000 0.860000 0.213333 0.835556 0 0 0 200\"\r\nalias _menu_scores_hide \"teammenu_showscores 0; alias _menu_scores _menu_scores_show; touch_settexture _menu_txt_slot9 \\\"#9 SHOW SCOREBOARD\\\"; touch_setcolor _menu_frame 0 0 0 200; touch_show _menu_frame_*; hidescoreboard2\"\r\n\r\nif $cscl_mapprefix == as_\r\n:_menu_vip_show\r\nelse\r\n:_menu_vip_hide\r\n\r\nif $teammenu_showscores >= 1\r\n:_menu_scores_show\r\n"
  },
  {
    "path": "3rdparty/cs16client-extras/touch/chooseteam_ct.cfg",
    "content": "// Coded by Alprnn357\r\ntouch_setclientonly 1\r\ncmd_scripting 1\r\ntouch_set_stroke 1 255 174 0 150\r\n\r\nalias _erase_frame \"touch_removebutton _menu_*; _menu_off\"\r\nalias _menu_off \"touch_setclientonly 0\"\r\nalias _click \"play media/launch_select1.wav; vibrate 30\"\r\n\r\ntouch_addbutton \"_menu_bg_crn4\" \"gfx/vgui/round_corner_se.tga\" \"\" 0.880000 0.924444 0.900000 0.960000 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_crn2\" \"gfx/vgui/round_corner_ne.tga\" \"\" 0.880000 0.035556 0.900000 0.071111 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_crn1\" \"gfx/vgui/round_corner_nw.tga\" \"\" 0.100000 0.035556 0.120000 0.071111 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_crn3\" \"gfx/vgui/round_corner_sw.tga\" \"\" 0.100000 0.924444 0.120000 0.960000 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_top1\" \"*black\" \"\" 0.120000 0.035556 0.880000 0.071111 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_top2\" \"*black\" \"\" 0.100000 0.071111 0.900000 0.160000 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_bottom\" \"*black\" \"\" 0.120000 0.924444 0.880000 0.960000 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_body\" \"*black\" \"\" 0.100000 0.165000 0.900000 0.924444 0 0 0 150 6\r\nif $menu_bg_fill >= 1;:touch_removebutton _menu_bg_*;:touch_addbutton _menu_bg_body *black \"\" 0 0 1 1 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_icn_logo\" \"gfx/vgui/cs_logo.tga\" \"\" 0.110000 0.053333 0.160000 0.142222 255 174 0 255 6\r\ntouch_addbutton \"_menu_bg_txt_logo\" \"#CHOOSE A CLASS\" \"\" 0.170000 0.071111 0.890000 0.142222 255 174 0 255 6\r\n\r\n//touch_addbutton \"_menu_txt_title\" \"#THE TITLE\" \"\" 0.140000 0.177778 0.860000 0.213333 255 174 0 255 4\r\ntouch_addbutton \"_menu_slot1\" \"*white\" \"_menu_select_slot1\" 0.140000 0.213333 0.360000 0.266667 0 0 0 150 260\r\ntouch_addbutton \"_menu_txt_slot1\" \"#1 SEAL TEAM 6\" \"\" 0.150000 0.231111 0.360000 0.266667 255 174 0 255 4\r\ntouch_addbutton \"_menu_slot2\" \"*white\" \"_menu_select_slot2\" 0.140000 0.284444 0.360000 0.337778 0 0 0 150 260\r\ntouch_addbutton \"_menu_txt_slot2\" \"#2 GSG-9\" \"\" 0.150000 0.302222 0.360000 0.337778 255 174 0 255 4\r\ntouch_addbutton \"_menu_slot3\" \"*white\" \"_menu_select_slot3\" 0.140000 0.355556 0.360000 0.408889 0 0 0 150 260\r\ntouch_addbutton \"_menu_txt_slot3\" \"#3 SAS\" \"\" 0.150000 0.373333 0.360000 0.408889 255 174 0 255 4\r\ntouch_addbutton \"_menu_slot4\" \"*white\" \"_menu_select_slot4\" 0.140000 0.426667 0.360000 0.480000 0 0 0 150 260\r\ntouch_addbutton \"_menu_txt_slot4\" \"#4 GIGN\" \"\" 0.150000 0.444444 0.360000 0.480000 255 174 0 255 4\r\nif $gamedir == \"czero\"\r\n:touch_addbutton \"_menu_slot5\" \"*white\" \"_menu_select_slot5\" 0.140000 0.497778 0.360000 0.551111 0 0 0 150 260\r\n:touch_addbutton \"_menu_txt_slot5\" \"#5 SPETSNAZ\" \"\" 0.150000 0.515556 0.360000 0.551111 255 174 0 255 4\r\n:touch_addbutton \"_menu_slot6\" \"*white\" \"_menu_select_slot6\" 0.140000 0.568889 0.360000 0.622222 0 0 0 150 260\r\n:touch_addbutton \"_menu_txt_slot6\" \"#6 AUTO-SELECT\" \"\" 0.150000 0.586667 0.360000 0.622222 255 174 0 255 4\r\nelse\r\n:touch_addbutton \"_menu_slot5\" \"*white\" \"_menu_select_slot5\" 0.140000 0.497778 0.360000 0.551111 0 0 0 150 260\r\n:touch_addbutton \"_menu_txt_slot5\" \"#5 AUTO-SELECT\" \"\" 0.150000 0.515556 0.360000 0.551111 255 174 0 255 4\r\n//touch_addbutton \"_menu_slot6\" \"*white\" \"\" 0.140000 0.568889 0.360000 0.622222 0 0 0 150 260\r\n//touch_addbutton \"_menu_txt_slot6\" \"#6 SPECTATE\" \"\" 0.150000 0.586667 0.360000 0.622222 255 174 0 255 4\r\n//touch_addbutton \"_menu_slot7\" \"*white\" \"\" 0.140000 0.640000 0.360000 0.693333 0 0 0 150 260\r\n//touch_addbutton \"_menu_txt_slot7\" \"#7 SLOT\" \"\" 0.150000 0.657778 0.360000 0.693333 255 174 0 255 4\r\n//touch_addbutton \"_menu_slot8\" \"*white\" \"\" 0.140000 0.711111 0.360000 0.764444 0 0 0 150 260\r\n//touch_addbutton \"_menu_txt_slot8\" \"#8 SLOT\" \"\" 0.150000 0.728889 0.360000 0.764444 255 174 0 255 4\r\n//touch_addbutton \"_menu_slot9\" \"*white\" \"\" 0.140000 0.782222 0.360000 0.835556 0 0 0 150 260\r\n//touch_addbutton \"_menu_txt_slot9\" \"#9 SLOT\" \"\" 0.150000 0.800000 0.360000 0.835556 255 174 0 255 4\r\n//touch_addbutton \"_menu_slot0\" \"*white\" \"+menu_slot0\" 0.14 0.871111 0.36 0.924444 0 0 0 150 260\r\n//touch_addbutton \"_menu_txt_slot0\" \"#0 CANCEL\" \"\" 0.15 0.888889 0.36 0.924444 255 174 0 255 4\r\ntouch_addbutton \"_menu_frame\" \"*white\" \"\" 0.390000 0.213333 0.840000 0.551111 0 0 0 150 260\r\ntouch_addbutton \"_menu_frame_icn_class1\" \"gfx/vgui/urban.tga\" \"\" 0.480000 0.215333 0.750000 0.549111 255 255 255 255 4\r\ntouch_addbutton \"_menu_frame_icn_class2\" \"gfx/vgui/gsg9.tga\" \"\" 0.480000 0.215333 0.750000 0.549111 255 255 255 255 4\r\ntouch_addbutton \"_menu_frame_icn_class3\" \"gfx/vgui/sas.tga\" \"\" 0.480000 0.215333 0.750000 0.549111 255 255 255 255 4\r\ntouch_addbutton \"_menu_frame_icn_class4\" \"gfx/vgui/gign.tga\" \"\" 0.480000 0.215333 0.750000 0.549111 255 255 255 255 4\r\nif $gamedir == \"czero\"\r\n:touch_addbutton \"_menu_frame_icn_class5\" \"gfx/vgui/spetsnaz.tga\" \"\" 0.480000 0.215333 0.750000 0.549111 255 255 255 255 4\r\n:touch_addbutton \"_menu_frame_icn_class6\" \"gfx/vgui/ct_random.tga\" \"\" 0.480000 0.215333 0.750000 0.549111 255 255 255 255 4\r\nelse\r\n:touch_addbutton \"_menu_frame_icn_class5\" \"gfx/vgui/ct_random.tga\" \"\" 0.480000 0.215333 0.750000 0.549111 255 255 255 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc1\" \"#ST-6 (to be known later as DEVGRU) was founded in 1980 under ;the command of Lieutenant-Commander Richard Marcincko. ;ST-6 was placed on permanent alert to respond to terrorist;attacks against American targets worldwide.\" \"\" 0.390000 0.568889 0.840000 0.835556 255 174 0 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc2\" \"#GSG-9 was born out of the tragic events that led to the death ;of several Israeli athletes during the 1972 Olympic games ;in Munich, Germany.\" \"\" 0.390000 0.568889 0.840000 0.835556 255 174 0 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc3\" \"#The world-renowned British SAS was founded in the Second ;World War by a man named David Stirling. Their role during;WW2 involved gathering intelligence behind enemy lines and;executing sabotage strikes and assassinations against key targets.\" \"\" 0.390000 0.568889 0.840000 0.835556 255 174 0 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc4\" \"#France's elite Counter-Terrorist unit, the GIGN, was designed;to be a fast response force that could decisively react to any;large-scale terrorist incident. Consisting of no more than 100;men, the GIGN has earned its reputation.\" \"\" 0.390000 0.568889 0.840000 0.835556 255 174 0 255 4\r\nif $gamedir == \"czero\"\r\n:touch_addbutton \"_menu_frame_txt_desc5\" \"#The primary missions of the Russian SPETSNAZ are:;acquiring intelligence on major economic and military;installations and either destroying them or putting them out;of action, organizing sabotage and acts of subversion,\" \"\" 0.390000 0.568889 0.840000 0.835556 255 174 0 255 4\r\n:touch_addbutton \"_menu_frame_txt_desc5a\" \"#;;;;carrying out punitive operations against rebels, forming and;training insurgent detachments, etc.\" \"\" 0.390000 0.568889 0.840000 0.835556 255 174 0 255 4\r\n:touch_addbutton \"_menu_frame_txt_desc6\" \"#Auto-Select randomly selects a character model.\" \"\" 0.390000 0.568889 0.840000 0.835556 255 174 0 255 4\r\nelse\r\n:touch_addbutton \"_menu_frame_txt_desc5\" \"#Auto-Select randomly selects a character model.\" \"\" 0.390000 0.568889 0.840000 0.835556 255 174 0 255 4\r\ntouch_addbutton \"_menu_confirm\" \"*white\" \"+menu_confirm\" 0.620000 0.853333 0.840000 0.906667 0 0 0 150 260\r\ntouch_addbutton \"_menu_confirm_txt\" \"#CONFIRM THE SELECTION\" \"\" 0.630000 0.871111 0.840000 0.906667 255 174 0 255 4\r\n\r\nalias _menu_none \"touch_setcolor _menu_slot* 0 0 0 150; touch_hide _menu_frame_icn_class*; touch_hide _menu_frame_txt_desc*; touch_hide _menu_confirm*\"\r\n_menu_none\r\n\r\nalias _menu_confirmed \"\"\r\n\r\nalias _menu_select_slot1 \"_click; _menu_none; touch_setcolor _menu_slot1 255 174 0 150; touch_show _menu_frame_icn_class1; touch_show _menu_frame_txt_desc1; touch_show _menu_confirm*; alias _menu_confirmed joinclass 1\"\r\nalias _menu_select_slot2 \"_click; _menu_none; touch_setcolor _menu_slot2 255 174 0 150; touch_show _menu_frame_icn_class2; touch_show _menu_frame_txt_desc2; touch_show _menu_confirm*; alias _menu_confirmed joinclass 2\"\r\nalias _menu_select_slot3 \"_click; _menu_none; touch_setcolor _menu_slot3 255 174 0 150; touch_show _menu_frame_icn_class3; touch_show _menu_frame_txt_desc3; touch_show _menu_confirm*; alias _menu_confirmed joinclass 3\"\r\nalias _menu_select_slot4 \"_click; _menu_none; touch_setcolor _menu_slot4 255 174 0 150; touch_show _menu_frame_icn_class4; touch_show _menu_frame_txt_desc4; touch_show _menu_confirm*; alias _menu_confirmed joinclass 4\"\r\nalias _menu_select_slot5 \"_click; _menu_none; touch_setcolor _menu_slot5 255 174 0 150; touch_show _menu_frame_icn_class5; touch_show _menu_frame_txt_desc5; touch_show _menu_frame_txt_desc5a; touch_show _menu_confirm*; alias _menu_confirmed joinclass 5\"\r\nalias _menu_select_slot6 \"_click; _menu_none; touch_setcolor _menu_slot6 255 174 0 150; touch_show _menu_frame_icn_class6; touch_show _menu_frame_txt_desc6; touch_show _menu_confirm*; alias _menu_confirmed joinclass 6\"\r\n\r\nalias +menu_confirm \"_click; touch_setcolor _menu_confirm 255 174 0 150\"\r\nalias -menu_confirm \"touch_setcolor _menu_confirm 0 0 0 150; _menu_confirmed; wait; wait; _erase_frame\"\r\n"
  },
  {
    "path": "3rdparty/cs16client-extras/touch/chooseteam_tr.cfg",
    "content": "// Coded by Alprnn357\r\ntouch_setclientonly 1\r\ncmd_scripting 1\r\ntouch_set_stroke 1 255 174 0 150\r\n\r\nalias _erase_frame \"touch_removebutton _menu_*; _menu_off\"\r\nalias _menu_off \"touch_setclientonly 0\"\r\nalias _click \"play media/launch_select1.wav; vibrate 30\"\r\n\r\ntouch_addbutton \"_menu_bg_crn4\" \"gfx/vgui/round_corner_se.tga\" \"\" 0.880000 0.924444 0.900000 0.960000 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_crn2\" \"gfx/vgui/round_corner_ne.tga\" \"\" 0.880000 0.035556 0.900000 0.071111 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_crn1\" \"gfx/vgui/round_corner_nw.tga\" \"\" 0.100000 0.035556 0.120000 0.071111 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_crn3\" \"gfx/vgui/round_corner_sw.tga\" \"\" 0.100000 0.924444 0.120000 0.960000 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_top1\" \"*black\" \"\" 0.120000 0.035556 0.880000 0.071111 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_top2\" \"*black\" \"\" 0.100000 0.071111 0.900000 0.160000 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_bottom\" \"*black\" \"\" 0.120000 0.924444 0.880000 0.960000 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_body\" \"*black\" \"\" 0.100000 0.165000 0.900000 0.924444 0 0 0 150 6\r\nif $menu_bg_fill >= 1;:touch_removebutton _menu_bg_*;:touch_addbutton _menu_bg_body *black \"\" 0 0 1 1 0 0 0 150 6\r\ntouch_addbutton \"_menu_bg_icn_logo\" \"gfx/vgui/cs_logo.tga\" \"\" 0.110000 0.053333 0.160000 0.142222 255 174 0 255 6\r\ntouch_addbutton \"_menu_bg_txt_logo\" \"#CHOOSE A CLASS\" \"\" 0.170000 0.071111 0.890000 0.142222 255 174 0 255 6\r\n\r\n//touch_addbutton \"_menu_txt_title\" \"#THE TITLE\" \"\" 0.140000 0.177778 0.860000 0.213333 255 174 0 255 4\r\ntouch_addbutton \"_menu_slot1\" \"*white\" \"_menu_select_slot1\" 0.140000 0.213333 0.360000 0.266667 0 0 0 150 260\r\ntouch_addbutton \"_menu_txt_slot1\" \"#1 PHOENIX CONNEXION\" \"\" 0.150000 0.231111 0.360000 0.266667 255 174 0 255 4\r\ntouch_addbutton \"_menu_slot2\" \"*white\" \"_menu_select_slot2\" 0.140000 0.284444 0.360000 0.337778 0 0 0 150 260\r\ntouch_addbutton \"_menu_txt_slot2\" \"#2 ELITE CREW\" \"\" 0.150000 0.302222 0.360000 0.337778 255 174 0 255 4\r\ntouch_addbutton \"_menu_slot3\" \"*white\" \"_menu_select_slot3\" 0.140000 0.355556 0.360000 0.408889 0 0 0 150 260\r\ntouch_addbutton \"_menu_txt_slot3\" \"#3 ARCTIC AVENGERS\" \"\" 0.150000 0.373333 0.360000 0.408889 255 174 0 255 4\r\ntouch_addbutton \"_menu_slot4\" \"*white\" \"_menu_select_slot4\" 0.140000 0.426667 0.360000 0.480000 0 0 0 150 260\r\ntouch_addbutton \"_menu_txt_slot4\" \"#4 GUERILLA WARFARE\" \"\" 0.150000 0.444444 0.360000 0.480000 255 174 0 255 4\r\nif $gamedir == \"czero\"\r\n:touch_addbutton \"_menu_slot5\" \"*white\" \"_menu_select_slot5\" 0.140000 0.497778 0.360000 0.551111 0 0 0 150 260\r\n:touch_addbutton \"_menu_txt_slot5\" \"#5 MIDWEST MILITIA\" \"\" 0.150000 0.515556 0.360000 0.551111 255 174 0 255 4\r\n:touch_addbutton \"_menu_slot6\" \"*white\" \"_menu_select_slot6\" 0.140000 0.568889 0.360000 0.622222 0 0 0 150 260\r\n:touch_addbutton \"_menu_txt_slot6\" \"#6 AUTO-SELECT\" \"\" 0.150000 0.586667 0.360000 0.622222 255 174 0 255 4\r\nelse\r\n:touch_addbutton \"_menu_slot5\" \"*white\" \"_menu_select_slot5\" 0.140000 0.497778 0.360000 0.551111 0 0 0 150 260\r\n:touch_addbutton \"_menu_txt_slot5\" \"#5 AUTO-SELECT\" \"\" 0.150000 0.515556 0.360000 0.551111 255 174 0 255 4\r\n//touch_addbutton \"_menu_slot6\" \"*white\" \"+menu_slot6\" 0.140000 0.568889 0.360000 0.622222 0 0 0 150 260\r\n//touch_addbutton \"_menu_txt_slot6\" \"#6 SPECTATE\" \"\" 0.150000 0.586667 0.360000 0.622222 255 174 0 255 4\r\n//touch_addbutton \"_menu_slot7\" \"*white\" \"\" 0.140000 0.640000 0.360000 0.693333 0 0 0 150 260\r\n//touch_addbutton \"_menu_txt_slot7\" \"#7 SLOT\" \"\" 0.150000 0.657778 0.360000 0.693333 255 174 0 255 4\r\n//touch_addbutton \"_menu_slot8\" \"*white\" \"\" 0.140000 0.711111 0.360000 0.764444 0 0 0 150 260\r\n//touch_addbutton \"_menu_txt_slot8\" \"#8 SLOT\" \"\" 0.150000 0.728889 0.360000 0.764444 255 174 0 255 4\r\n//touch_addbutton \"_menu_slot9\" \"*white\" \"\" 0.140000 0.782222 0.360000 0.835556 0 0 0 150 260\r\n//touch_addbutton \"_menu_txt_slot9\" \"#9 SLOT\" \"\" 0.150000 0.800000 0.360000 0.835556 255 174 0 255 4\r\n//touch_addbutton \"_menu_slot0\" \"*white\" \"+menu_slot0\" 0.14 0.871111 0.36 0.924444 0 0 0 150 260\r\n//touch_addbutton \"_menu_txt_slot0\" \"#0 CANCEL\" \"\" 0.15 0.888889 0.36 0.924444 255 174 0 255 4\r\ntouch_addbutton \"_menu_frame\" \"*white\" \"\" 0.390000 0.213333 0.840000 0.551111 0 0 0 150 260\r\ntouch_addbutton \"_menu_frame_icn_class1\" \"gfx/vgui/terror.tga\" \"\" 0.480000 0.215333 0.750000 0.549111 255 255 255 255 4\r\ntouch_addbutton \"_menu_frame_icn_class2\" \"gfx/vgui/leet.tga\" \"\" 0.480000 0.215333 0.750000 0.549111 255 255 255 255 4\r\ntouch_addbutton \"_menu_frame_icn_class3\" \"gfx/vgui/arctic.tga\" \"\" 0.480000 0.215333 0.750000 0.549111 255 255 255 255 4\r\ntouch_addbutton \"_menu_frame_icn_class4\" \"gfx/vgui/guerilla.tga\" \"\" 0.480000 0.215333 0.750000 0.549111 255 255 255 255 4\r\nif $gamedir == \"czero\"\r\n:touch_addbutton \"_menu_frame_icn_class5\" \"gfx/vgui/militia.tga\" \"\" 0.480000 0.215333 0.750000 0.549111 255 255 255 255 4\r\n:touch_addbutton \"_menu_frame_icn_class6\" \"gfx/vgui/t_random.tga\" \"\" 0.480000 0.215333 0.750000 0.549111 255 255 255 255 4\r\nelse\r\n:touch_addbutton \"_menu_frame_icn_class5\" \"gfx/vgui/t_random.tga\" \"\" 0.480000 0.215333 0.750000 0.549111 255 255 255 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc1\" \"#Having established a reputation for killing anyone that gets;in their way, the Phoenix Faction is one of the most feared;terrorist groups in Eastern Europe. Formed shortly after the;breakup of the USSR.\" \"\" 0.390000 0.568889 0.840000 0.835556 255 174 0 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc2\" \"#Middle Eastern fundamentalist group bent on world domination;and various other evil deeds.\" \"\" 0.390000 0.568889 0.840000 0.835556 255 174 0 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc3\" \"#Swedish terrorist faction founded in 1977. Famous for their ;bombing of the Canadian embassy in 1990.\" \"\" 0.390000 0.568889 0.840000 0.835556 255 174 0 255 4\r\ntouch_addbutton \"_menu_frame_txt_desc4\" \"#A terrorist faction founded in the Middle East, this group has;a reputation for ruthlessness. Their disgust for the American;lifestyle was demonstrated in their 1982 bombing of a school;bus full of Rock and Roll musicians.\" \"\" 0.390000 0.568889 0.840000 0.835556 255 174 0 255 4\r\nif $gamedir == \"czero\"\r\n:touch_addbutton \"_menu_frame_txt_desc5\" \"#The Midwest Militia is a right-wing extremist movement;consisting of formal and informal armed paramilitary groups.;This anti-government group was founded in 1993 after the;standoff in Waco, Texas.\" \"\" 0.390000 0.568889 0.840000 0.835556 255 174 0 255 4\r\n:touch_addbutton \"_menu_frame_txt_desc6\" \"#Auto-Select randomly selects a character model.\" \"\" 0.390000 0.568889 0.840000 0.835556 255 174 0 255 4\r\nelse\r\n:touch_addbutton \"_menu_frame_txt_desc5\" \"#Auto-Select randomly selects a character model.\" \"\" 0.390000 0.568889 0.840000 0.835556 255 174 0 255 4\r\ntouch_addbutton \"_menu_confirm\" \"*white\" \"+menu_confirm\" 0.620000 0.853333 0.840000 0.906667 0 0 0 150 260\r\ntouch_addbutton \"_menu_confirm_txt\" \"#CONFIRM THE SELECTION\" \"\" 0.630000 0.871111 0.840000 0.906667 255 174 0 255 4\r\n\r\nalias _menu_none \"touch_setcolor _menu_slot* 0 0 0 150; touch_hide _menu_frame_icn_class*; touch_hide _menu_frame_txt_desc*; touch_hide _menu_confirm*\"\r\n_menu_none\r\n\r\nalias _menu_confirmed \"\"\r\n\r\nalias _menu_select_slot1 \"_click; _menu_none; touch_setcolor _menu_slot1 255 174 0 150; touch_show _menu_frame_icn_class1; touch_show _menu_frame_txt_desc1; touch_show _menu_confirm*; alias _menu_confirmed joinclass 1\"\r\nalias _menu_select_slot2 \"_click; _menu_none; touch_setcolor _menu_slot2 255 174 0 150; touch_show _menu_frame_icn_class2; touch_show _menu_frame_txt_desc2; touch_show _menu_confirm*; alias _menu_confirmed joinclass 2\"\r\nalias _menu_select_slot3 \"_click; _menu_none; touch_setcolor _menu_slot3 255 174 0 150; touch_show _menu_frame_icn_class3; touch_show _menu_frame_txt_desc3; touch_show _menu_confirm*; alias _menu_confirmed joinclass 3\"\r\nalias _menu_select_slot4 \"_click; _menu_none; touch_setcolor _menu_slot4 255 174 0 150; touch_show _menu_frame_icn_class4; touch_show _menu_frame_txt_desc4; touch_show _menu_confirm*; alias _menu_confirmed joinclass 4\"\r\nalias _menu_select_slot5 \"_click; _menu_none; touch_setcolor _menu_slot5 255 174 0 150; touch_show _menu_frame_icn_class5; touch_show _menu_frame_txt_desc5; touch_show _menu_confirm*; alias _menu_confirmed joinclass 5\"\r\nalias _menu_select_slot6 \"_click; _menu_none; touch_setcolor _menu_slot6 255 174 0 150; touch_show _menu_frame_icn_class6; touch_show _menu_frame_txt_desc6; touch_show _menu_confirm*; alias _menu_confirmed joinclass 6\"\r\n\r\nalias +menu_confirm \"_click; touch_setcolor _menu_confirm 255 174 0 150\"\r\nalias -menu_confirm \"touch_setcolor _menu_confirm 0 0 0 150; _menu_confirmed; wait; wait; _erase_frame\"\r\n"
  },
  {
    "path": "3rdparty/cs16client-extras/touch/cmd/cmd.cfg",
    "content": "//=======================================================================\n// TOUCH COMMAND MENU\n// Copyright (c) 2016 Mikhail Stepanov aka ahsim\n//=======================================================================\n_reset_menu\ncmd_scripting 1\nset menu_root_path \"touch/cmd\"\nset _menu_file_name \"cmd.cfg\"\nalias build_menu \"exec touch/customcmd\"\nalias build_language \"exec touch/custom/my_menu-language\"\nset _menu_id my_menu-1-cmd\nset _menu_level 1\nset _menu_min 3\nset _menu_max 8\n\nbuild_language\n\nset _menu_type_3 1\nset _menu_txt_3 \"Game Settings\"\nset _menu_cmd_3 \"exec $menu_root_path/my_menu-2-game\"\nset _menu_icn_3 \"touch/cmd/right.tga\"\n\nset _menu_type_4 1\nset _menu_txt_4 \"Graphics\"\nset _menu_cmd_4 \"exec $menu_root_path/my_menu-2-graphic\"\nset _menu_icn_4 \"touch/cmd/right.tga\"\n\nset _menu_type_5 1\nset _menu_txt_5 \"Server Settings\"\nset _menu_cmd_5 \"exec $menu_root_path/my_menu-2-server\"\nset _menu_icn_5 \"touch/cmd/right.tga\"\n\nset _menu_type_6 1\nset _menu_txt_6 \"Connection\"\nset _menu_cmd_6 \"exec $menu_root_path/my_menu-2-connection\"\nset _menu_icn_6 \"touch/cmd/right.tga\"\n\nset _menu_type_7 1\nset _menu_txt_7 \"Record Demo\"\nset _menu_cmd_7 \"exec $menu_root_path/my_menu-2-demo\"\nset _menu_icn_7 \"touch/cmd/right.tga\"\n\nset _menu_type_8 1\nset _menu_txt_8 \"$_menu_txt_exit\"\nset _menu_cmd_8 \"_erase_frame\"\nset _menu_icn_8 \"\"\n\nbuild_menu\n\nif $enable_controls = 1;:touch_setclientonly 0;else;:touch_setclientonly 1\nexec touch/custom/my_menu-5-controls.cfg\n"
  },
  {
    "path": "3rdparty/cs16client-extras/touch/cmd/my_menu-2-connection.cfg",
    "content": "//=======================================================================\n// TOUCH COMMAND MENU\n// Copyright (c) 2016 Mikhail Stepanov aka ahsim\n//=======================================================================\ncmd_scripting 1\nset menu_root_path \"touch/cmd\"\nset _menu_id my_menu-2-connection\nset _menu_level 2\nset _menu_min 6\nset _menu_max 10\n\nset _menu_type_6 3\nset _menu_txt_6 \"Rate\"\nset _menu_cmd_6 \"rate\"\nset _menu_f6 $rate\n\nset _menu_type_7 3\nset _menu_txt_7 \"Update Rate\"\nset _menu_cmd_7 \"cl_updaterate\"\nset _menu_f7 $cl_updaterate\n\nset _menu_type_8 3\nset _menu_txt_8 \"Command Rate\"\nset _menu_cmd_8 \"cl_cmdrate\"\nset _menu_f8 $cl_cmdrate\n\nset _menu_type_9 2\nset _menu_txt_9 \"Net Speeds\"\nset _menu_cmd_9 \"net_speeds\"\nset _menu_f9 $net_speeds\n\nset _menu_type_10 2\nset _menu_txt_10 \"Net Graph\"\nset _menu_cmd_10 \"net_graph\"\nset _menu_f10 $net_graph\n\nbuild_menu\n"
  },
  {
    "path": "3rdparty/cs16client-extras/touch/cmd/my_menu-2-demo.cfg",
    "content": "cmd_scripting 1\nset menu_root_path \"touch/cmd\"\nset _menu_id my_menu-2-demo\nset _menu_level 2\nset _menu_min 7\nset _menu_max 9\n\nset _menu_type_7 1\nset _menu_txt_7 \"Start recording\"\nset _menu_cmd_7 \"messagemode record; _erase_frame\"\nset _menu_icn_7 \"\"\n\nset _menu_type_8 1\nset _menu_txt_8 \"Stop recording\"\nset _menu_cmd_8 \"stop; _erase_frame\"\nset _menu_icn_8 \"\"\n\nset _menu_type_9 1\nset _menu_txt_9 \"Play demo\"\nset _menu_cmd_9 \"messagemode playdemo; _erase_frame\"\nset _menu_icn_9 \"\"\n\nbuild_menu\n"
  },
  {
    "path": "3rdparty/cs16client-extras/touch/cmd/my_menu-2-game.cfg",
    "content": "//=======================================================================\n// TOUCH COMMAND MENU\n// Copyright (c) 2016 Mikhail Stepanov aka ahsim\n//=======================================================================\ncmd_scripting 1\nset menu_root_path \"touch/cmd\"\nset _menu_id my_menu-2-game\nset _menu_level 2\nset _menu_min 3\nset _menu_max 9\n\nset _menu_type_3 1\nset _menu_txt_3 \"HUD\"\nset _menu_cmd_3 \"exec $menu_root_path/my_menu-3-hud\"\nset _menu_icn_3 \"touch/cmd/right.tga\"\n\nset _menu_type_4 1\nset _menu_txt_4 \"Scoreboard\"\nset _menu_cmd_4 \"exec $menu_root_path/my_menu-3-scoreboard\"\nset _menu_icn_4 \"touch/cmd/right.tga\"\n\nset _menu_type_5 1\nset _menu_txt_5 \"Console\"\nset _menu_cmd_5 \"exec $menu_root_path/my_menu-3-console\"\nset _menu_icn_5 \"touch/cmd/right.tga\"\n\nset _menu_type_6 1\nset _menu_txt_6 \"Numerical menu\"\nset _menu_cmd_6 \"exec $menu_root_path/my_menu-3-numerical\"\nset _menu_icn_6 \"touch/cmd/right.tga\"\n\nset _menu_type_7 1\nset _menu_txt_7 \"Radar\"\nset _menu_cmd_7 \"exec $menu_root_path/my_menu-3-radar\"\nset _menu_icn_7 \"touch/cmd/right.tga\"\n\nset _menu_type_8 1\nset _menu_txt_8 \"Crosshair\"\nset _menu_cmd_8 \"exec $menu_root_path/my_menu-3-crosshair\"\nset _menu_icn_8 \"touch/cmd/right.tga\"\n\nset _menu_type_9 1\nset _menu_txt_9 \"Voice\"\nset _menu_cmd_9 \"exec $menu_root_path/my_menu-3-voice\"\nset _menu_icn_9 \"touch/cmd/right.tga\"\n\nbuild_menu\n"
  },
  {
    "path": "3rdparty/cs16client-extras/touch/cmd/my_menu-2-graphic.cfg",
    "content": "//=======================================================================\n// TOUCH COMMAND MENU\n// Copyright (c) 2016 Mikhail Stepanov aka ahsim\n//=======================================================================\ncmd_scripting 1\nset menu_root_path \"touch/cmd\"\nset _menu_id my_menu-2-graphic\nset _menu_level 2\nset _menu_min 4\nset _menu_max 10\n\nset _menu_type_4 1\nset _menu_txt_4 \"Texture Quality\"\nset _menu_cmd_4 \"exec $menu_root_path/my_menu-3-texture\"\nset _menu_icn_4 \"touch/cmd/right.tga\"\n\nset _menu_type_5 1\nset _menu_txt_5 \"Models\"\nset _menu_cmd_5 \"exec $menu_root_path/my_menu-3-model\"\nset _menu_icn_5 \"touch/cmd/right.tga\"\n\nset _menu_type_6 1\nset _menu_txt_6 \"FPS Counter\"\nset _menu_cmd_6 \"exec $menu_root_path/my_menu-3-fps\"\nset _menu_icn_6 \"touch/cmd/right.tga\"\n\nset _menu_type_7 3\nset _menu_txt_7 \"Max FPS\"\nset _menu_cmd_7 \"fps_max\"\nset _menu_f7 $fps_max\n\nset _menu_type_8 3\nset _menu_txt_8 \"Max decals\"\nset _menu_cmd_8 \"r_decals\"\nset _menu_f8 $r_decals\n\nset _menu_type_9 2\nset _menu_txt_9 \"Weather\"\nset _menu_cmd_9 \"cl_weather\"\nset _menu_f9 $cl_weather\n\nset _menu_type_10 2\nset _menu_txt_10 \"Shadows\"\nset _menu_cmd_10 \"cl_shadows\"\nset _menu_f10 $cl_shadows\n\nbuild_menu\n"
  },
  {
    "path": "3rdparty/cs16client-extras/touch/cmd/my_menu-2-server.cfg",
    "content": "//=======================================================================\n// TOUCH COMMAND MENU\n// Copyright (c) 2016 Mikhail Stepanov aka ahsim\n//=======================================================================\ncmd_scripting 1\nset menu_root_path \"touch/cmd\"\nset _menu_id my_menu-2-server\nset _menu_level 2\nset _menu_min 5\nset _menu_max 10\n\nset _menu_type_5 1\nset _menu_txt_5 \"Maps\"\nset _menu_cmd_5 \"exec $menu_root_path/my_menu-3-maps\"\nset _menu_icn_5 \"touch/cmd/right.tga\"\n\nset _menu_type_6 1\nset _menu_txt_6 \"CVars\"\nset _menu_cmd_6 \"exec $menu_root_path/my_menu-3-cvars\"\nset _menu_icn_6 \"touch/cmd/right.tga\"\n\nset _menu_type_7 1\nset _menu_txt_7 \"Restart\"\nset _menu_cmd_7 \"_erase_frame; restart\"\nset _menu_icn_7 \"\"\n\nset _menu_type_8 3\nset _menu_txt_8 \"Restart; in ... seconds\"\nset _menu_cmd_8 \"sv_restartround\"\nset _menu_f8 $sv_restartround\n\nset _menu_type_9 1\nset _menu_txt_9 \"Reconnect\"\nset _menu_cmd_9 \"_erase_frame; reconnect\"\nset _menu_icn_9 \"\"\n\nset _menu_type_10 1\nset _menu_txt_10 \"Disconnect\"\nset _menu_cmd_10 \"_erase_frame; disconnect\"\nset _menu_icn_10 \"\"\n\nbuild_menu\n"
  },
  {
    "path": "3rdparty/cs16client-extras/touch/cmd/my_menu-3-console.cfg",
    "content": "//=======================================================================\n// TOUCH COMMAND MENU\n// Copyright (c) 2016 Mikhail Stepanov aka ahsim\n//=======================================================================\ncmd_scripting 1\nset menu_root_path \"touch/cmd\"\nset _menu_id my_menu-3-console\nset _menu_level 3\nset _menu_min 4\nset _menu_max 10\n\nset _menu_type_4 3\nset _menu_txt_4 \"Text color\"\nset _menu_cmd_4 \"con_color\"\nset _menu_f4 $con_color\n\nset _menu_type_5 3\nset _menu_txt_5 \"Notify time\"\nset _menu_cmd_5 \"con_notifytime\"\nset _menu_f5 $con_notifytime\n\nset _menu_type_6 3\nset _menu_txt_6 \"Charset\"\nset _menu_cmd_6 \"con_charset\"\nset _menu_f6 $con_charset\n\nset _menu_type_7 3\nset _menu_txt_7 \"Font number\"\nset _menu_cmd_7 \"con_fontnum\"\nset _menu_f7 $con_fontnum\n\nset _menu_type_8 3\nset _menu_txt_8 \"Font texture; scale\"\nset _menu_cmd_8 \"con_fontscale\"\nset _menu_f8 $con_fontscale\n\nset _menu_type_9 3\nset _menu_txt_9 \"Font render\"\nset _menu_cmd_9 \"con_fontrender\"\nset _menu_f9 $con_fontrender\n\nset _menu_type_10 3\nset _menu_txt_10 \"Font size\"\nset _menu_cmd_10 \"con_fontsize\"\nset _menu_f10 $con_fontsize\n\nbuild_menu\n"
  },
  {
    "path": "3rdparty/cs16client-extras/touch/cmd/my_menu-3-crosshair.cfg",
    "content": "cmd_scripting 1\r\nset menu_root_path \"touch/cmd\"\r\nset _menu_id my_menu-3-crosshair\r\nset _menu_level 3\r\nset _menu_min 6\r\nset _menu_max 10\r\n\r\nset _menu_type_6 3\r\nset _menu_txt_6 \"Color\"\r\nset _menu_cmd_6 \"cl_crosshair_color\"\r\nset _menu_f6 $cl_crosshair_color\r\n\r\nset _menu_type_7 1\r\nset _menu_txt_7 \"Size\"\r\nset _menu_cmd_7 \"exec $menu_root_path/my_menu-4-cross-size\"\r\nset _menu_icn_7 \"touch/cmd/right.tga\"\r\n\r\nset _menu_type_8 2\r\nset _menu_txt_8 \"Dynamic\"\r\nset _menu_cmd_8 \"cl_dynamiccrosshair\"\r\nset _menu_f8 $cl_dynamiccrosshair\r\n\r\nset _menu_type_9 2\r\nset _menu_txt_9 \"Transparent\"\r\nset _menu_cmd_9 \"cl_crosshair_translucent\"\r\nset _menu_f9 $cl_crosshair_translucent\r\n\r\nset _menu_type_10 1\r\nset _menu_txt_10 \"Advanced crosshair\"\r\nset _menu_cmd_10 \"exec $menu_root_path/my_menu-4-xhair\"\r\nset _menu_icn_10 \"touch/cmd/right.tga\"\r\n\r\nbuild_menu\r\n"
  },
  {
    "path": "3rdparty/cs16client-extras/touch/cmd/my_menu-3-cvars.cfg",
    "content": "//=======================================================================\n// TOUCH COMMAND MENU\n// Copyright (c) 2016 Mikhail Stepanov aka ahsim\n//=======================================================================\ncmd_scripting 1\nset menu_root_path \"touch/cmd\"\nset _menu_id my_menu-3-cvars\nset _menu_level 3\nset _menu_min 5\nset _menu_max 10\n\nset _menu_type_5 1\nset _menu_txt_5 \"Log CVars\"\nset _menu_cmd_5 \"exec $menu_root_path/my_menu-4-cvar0\"\nset _menu_icn_5 \"touch/cmd/right.tga\"\n\nset _menu_type_6 1\nset _menu_txt_6 \"Server CVars\"\nset _menu_cmd_6 \"exec $menu_root_path/my_menu-4-cvar1\"\nset _menu_icn_6 \"touch/cmd/right.tga\"\n\nset _menu_type_7 1\nset _menu_txt_7 \"Team CVars\"\nset _menu_cmd_7 \"exec $menu_root_path/my_menu-4-cvar2\"\nset _menu_icn_7 \"touch/cmd/right.tga\"\n\nset _menu_type_8 1\nset _menu_txt_8 \"Game CVars\"\nset _menu_cmd_8 \"exec $menu_root_path/my_menu-4-cvar3\"\nset _menu_icn_8 \"touch/cmd/right.tga\"\n\nset _menu_type_9 1\nset _menu_txt_9 \"Map CVars\"\nset _menu_cmd_9 \"exec $menu_root_path/my_menu-4-cvar4\"\nset _menu_icn_9 \"touch/cmd/right.tga\"\n\nset _menu_type_10 1\nset _menu_txt_10 \"Other CVars\"\nset _menu_cmd_10 \"exec $menu_root_path/my_menu-4-cvar5\"\nset _menu_icn_10 \"touch/cmd/right.tga\"\n\nbuild_menu\n"
  },
  {
    "path": "3rdparty/cs16client-extras/touch/cmd/my_menu-3-fps.cfg",
    "content": "cmd_scripting 1\nset menu_root_path \"touch/cmd\"\nset _menu_id my_menu-3-fps\nset _menu_level 3\nset _menu_min 6\nset _menu_max 8\n\nset _menu_type_6 1\nset _menu_txt_6 \"Hide\"\nset _menu_cmd_6 \"cl_showfps 0\"\nset _menu_icn_6 \"\"\n\nset _menu_type_7 1\nset _menu_txt_7 \"Show\"\nset _menu_cmd_7 \"cl_showfps 1\"\nset _menu_icn_7 \"\"\n\nset _menu_type_8 1\nset _menu_txt_8 \"Show detailed\"\nset _menu_cmd_8 \"cl_showfps 2\"\nset _menu_icn_8 \"\"\n\nbuild_menu\n\nif $cl_showfps = 0;:touch_setcolor _menu_S6_my_menu-3-fps 156 77 20 180\nif $cl_showfps = 1;:touch_setcolor _menu_S7_my_menu-3-fps 156 77 20 180\nif $cl_showfps = 2;:touch_setcolor _menu_S8_my_menu-3-fps 156 77 20 180\n"
  },
  {
    "path": "3rdparty/cs16client-extras/touch/cmd/my_menu-3-hud.cfg",
    "content": "//=======================================================================\r\n// TOUCH COMMAND MENU\r\n// Copyright (c) 2016 Mikhail Stepanov aka ahsim\r\n//=======================================================================\r\ncmd_scripting 1\r\nset menu_root_path \"touch/cmd\"\r\nset _menu_id my_menu-3-hud\r\nset _menu_level 3\r\nset _menu_min 3\r\nset _menu_max 9\r\n\r\nset _menu_type_3 2\r\nset _menu_txt_3 \"Draw HUD\"\r\nset _menu_cmd_3 \"hud_draw\"\r\nset _menu_f3 $hud_draw\r\n\r\nset _menu_type_4 2\r\nset _menu_txt_4 \"Fast weapon; switch\"\r\nset _menu_cmd_4 \"hud_fastswitch\"\r\nset _menu_f4 $hud_fastswitch\r\n\r\nset _menu_type_5 2\r\nset _menu_txt_5 \"Saytext\"\r\nset _menu_cmd_5 \"hud_saytext\"\r\nset _menu_f5 $hud_saytext\r\n\r\nset _menu_type_6 2\r\nset _menu_txt_6 \"Textmode\"\r\nset _menu_cmd_6 \"hud_textmode\"\r\nset _menu_f6 $hud_textmode\r\n\r\nset _menu_type_7 2\r\nset _menu_txt_7 \"Center player; information\"\r\nset _menu_cmd_7 \"hud_centerid\"\r\nset _menu_f7 $hud_centerid\r\n\r\nset _menu_type_8 3\r\nset _menu_txt_8 \"HUD Scale; (restart to apply)\"\r\nset _menu_cmd_8 \"hud_scale\"\r\nset _menu_f8 $hud_scale\r\n\r\nset _menu_type_9 3\r\nset _menu_txt_9 \"HUD Color\"\r\nset _menu_cmd_9 \"hud_color\"\r\nset _menu_f9 $hud_color\r\n\r\nbuild_menu\r\n"
  },
  {
    "path": "3rdparty/cs16client-extras/touch/cmd/my_menu-3-maps.cfg",
    "content": "//=======================================================================\n// TOUCH RADIO MENU\n// Copyright (c) 2016 Mikhail Stepanov aka ahsim\n//=======================================================================\ncmd_scripting 1\nset menu_root_path \"touch/cmd\"\nset _menu_id my_menu-3-maps\nset _menu_level 3\nset _menu_min 3\nset _menu_max 9\n\nset _menu_type_3 1\nset _menu_txt_3 \"de_dust2\"\nset _menu_cmd_3 \"changelevel de_dust2\"\nset _menu_icn_3 \"\"\n\nset _menu_type_4 1\nset _menu_txt_4 \"de_inferno\"\nset _menu_cmd_4 \"changelevel de_inferno\"\nset _menu_icn_4 \"\"\n\nset _menu_type_5 1\nset _menu_txt_5 \"de_mirage\"\nset _menu_cmd_5 \"changelevel de_mirage\"\nset _menu_icn_5 \"\"\n\nset _menu_type_6 1\nset _menu_txt_6 \"de_nuke\"\nset _menu_cmd_6 \"changelevel de_nuke\"\nset _menu_icn_6 \"\"\n\nset _menu_type_7 1\nset _menu_txt_7 \"de_train\"\nset _menu_cmd_7 \"changelevel de_train\"\nset _menu_icn_7 \"\"\n\nset _menu_type_8 1\nset _menu_txt_8 \"Change map to ...\"\nset _menu_cmd_8 \"messagemode changelevel\"\nset _menu_icn_8 \"\"\n\nset _menu_type_9 1\nset _menu_txt_9 \"Show full maps list\"\nset _menu_cmd_9 \"maps *;wait;toggleconsole\"\nset _menu_icn_9 \"\"\n\nbuild_menu\n"
  },
  {
    "path": "3rdparty/cs16client-extras/touch/cmd/my_menu-3-model.cfg",
    "content": "//=======================================================================\n// TOUCH COMMAND MENU\n// Copyright (c) 2016 Mikhail Stepanov aka ahsim\n//=======================================================================\ncmd_scripting 1\nset menu_root_path \"touch/cmd\"\nset _menu_id my_menu-3-model\nset _menu_level 3\nset _menu_min 5\nset _menu_max 6\n\nset _menu_type_5 2\nset _menu_txt_5 \"Himodels\"\nset _menu_cmd_5 \"cl_himodels\"\nset _menu_f5 $cl_himodels\n\nset _menu_type_6 2\nset _menu_txt_6 \"Minmodels\"\nset _menu_cmd_6 \"cl_minmodels\"\nset _menu_f6 $cl_minmodels\n\nbuild_menu\n"
  },
  {
    "path": "3rdparty/cs16client-extras/touch/cmd/my_menu-3-numerical.cfg",
    "content": "//=======================================================================\n// TOUCH COMMAND MENU\n// Copyright (c) 2016 Mikhail Stepanov aka ahsim\n//=======================================================================\ncmd_scripting 1\nset menu_root_path \"touch/cmd\"\nset _menu_id my_menu-3-numerical\nset _menu_level 3\nset _menu_min 6\nset _menu_max 10\n\nset _menu_type_6 1\nset _menu_txt_6 \"Disabled\"\nset _menu_cmd_6 \"numericalmenu 0\"\nset _menu_icn_6 \"\"\n\nset _menu_type_7 1\nset _menu_txt_7 \"Center\"\nset _menu_cmd_7 \"numericalmenu 1\"\nset _menu_icn_7 \"\"\n\nset _menu_type_8 1\nset _menu_txt_8 \"Bottom; 2 lines\"\nset _menu_cmd_8 \"numericalmenu 2\"\nset _menu_icn_8 \"\"\n\nset _menu_type_9 1\nset _menu_txt_9 \"Bottom; 1 line\"\nset _menu_cmd_9 \"numericalmenu 3\"\nset _menu_icn_9 \"\"\n\nset _menu_type_10 2\nset _menu_txt_10 \"Hide other; buttons\"\nset _menu_cmd_10 \"numericalmenu_clientonly\"\nset _menu_f10 $numericalmenu_clientonly\n\nbuild_menu\n\nif $numericalmenu = 0;:touch_setcolor _menu_S6_my_menu-3-numerical 156 77 20 180\nif $numericalmenu = 1;:touch_setcolor _menu_S7_my_menu-3-numerical 156 77 20 180\nif $numericalmenu = 2;:touch_setcolor _menu_S8_my_menu-3-numerical 156 77 20 180\nif $numericalmenu = 3;:touch_setcolor _menu_S9_my_menu-3-numerical 156 77 20 180\n\n"
  },
  {
    "path": "3rdparty/cs16client-extras/touch/cmd/my_menu-3-radar.cfg",
    "content": "cmd_scripting 1\nset menu_root_path \"touch/cmd\"\nset _menu_id my_menu-3-radar\nset _menu_level 3\nset _menu_min 7\nset _menu_max 9\n\nset _menu_type_7 1\nset _menu_txt_7 \"Hide\"\nset _menu_cmd_7 \"hideradar\"\nset _menu_icn_7 \"\"\n\nset _menu_type_8 1\nset _menu_txt_8 \"Show\"\nset _menu_cmd_8 \"drawradar\"\nset _menu_icn_8 \"\"\n\nset _menu_type_9 2\nset _menu_txt_9 \"Solid\"\nset _menu_cmd_9 \"cl_radartype\"\nset _menu_f9 $cl_radartype\n\nbuild_menu\n"
  },
  {
    "path": "3rdparty/cs16client-extras/touch/cmd/my_menu-3-scoreboard.cfg",
    "content": "//=======================================================================\n// TOUCH COMMAND MENU\n// Copyright (c) 2016 Mikhail Stepanov aka ahsim\n//=======================================================================\ncmd_scripting 1\nset menu_root_path \"touch/cmd\"\nset _menu_id my_menu-3-scoreboard\nset _menu_level 3\nset _menu_min 4\nset _menu_max 6\n\nset _menu_type_4 1\nset _menu_txt_4 \"Short\"\nset _menu_cmd_4 \"checkscoreboard 2\"\nset _menu_icn_4 \"\"\n\nset _menu_type_5 1\nset _menu_txt_5 \"Full\"\nset _menu_cmd_5 \"checkscoreboard 1\"\nset _menu_icn_5 \"\"\n\nset _menu_type_6 1\nset _menu_txt_6 \"Classic\"\nset _menu_cmd_6 \"checkscoreboard 3\"\nset _menu_icn_6 \"\"\n\nbuild_menu\n\nif $checkscoreboard = 2;:touch_setcolor _menu_S4_my_menu-3-scoreboard 156 77 20 180\nif $checkscoreboard = 1;:touch_setcolor _menu_S5_my_menu-3-scoreboard 156 77 20 180\nif $checkscoreboard = 3;:touch_setcolor _menu_S6_my_menu-3-scoreboard 156 77 20 180\n"
  },
  {
    "path": "3rdparty/cs16client-extras/touch/cmd/my_menu-3-texture.cfg",
    "content": "//=======================================================================\n// TOUCH COMMAND MENU\n// Copyright (c) 2016 Mikhail Stepanov aka ahsim\n//=======================================================================\ncmd_scripting 1\nset menu_root_path \"touch/cmd\"\nset _menu_id my_menu-3-texture\nset _menu_level 3\nset _menu_min 4\nset _menu_max 6\n\nset _menu_type_4 1\nset _menu_txt_4 \"Low\"\nset _menu_cmd_4 \"gl_texture_nearest 1\"\nset _menu_icn_4 \"\"\n\nset _menu_type_5 1\nset _menu_txt_5 \"Normal\"\nset _menu_cmd_5 \"gl_texture_nearest 0\"\nset _menu_icn_5 \"\"\n\nset _menu_type_6 2\nset _menu_txt_6 \"Detail; textures\"\nset _menu_cmd_6 \"r_detailtextures\"\nset _menu_f6 $r_detailtextures\n\nbuild_menu\n\nif $gl_texture_nearest = 0;:touch_setcolor _menu_S4_my_menu-3-texture 156 77 20 180\nif $gl_texture_nearest = 1;:touch_setcolor _menu_S5_my_menu-3-texture 156 77 20 180\n"
  },
  {
    "path": "3rdparty/cs16client-extras/touch/cmd/my_menu-3-voice.cfg",
    "content": "cmd_scripting 1\nset menu_root_path \"touch/cmd\"\nset _menu_id my_menu-3-voice\nset _menu_level 3\nset _menu_min 5\nset _menu_max 10\n\nset _menu_type_5 2\nset _menu_txt_5 \"Enable voice; chat\"\nset _menu_cmd_5 \"voice_enable\"\nset _menu_f5 $voice_enable\n\nset _menu_type_6 2\nset _menu_txt_6 \"Loopback to; the speaker\"\nset _menu_cmd_6 \"voice_loopback\"\nset _menu_f6 $voice_loopback\n\nset _menu_type_7 2\nset _menu_txt_7 \"Input from; .wav file\"\nset _menu_cmd_7 \"voice_inputfromfile\"\nset _menu_f7 $voice_inputfromfile\n\nset _menu_type_8 3\nset _menu_txt_8 \"Volume scale\"\nset _menu_cmd_8 \"voice_scale\"\nset _menu_f8 $voice_scale\n\nset _menu_type_9 3\nset _menu_txt_9 \"Voice gain; (maximum)\"\nset _menu_cmd_9 \"voice_maxgain\"\nset _menu_f9 $voice_maxgain\n\nset _menu_type_10 3\nset _menu_txt_10 \"Voice gain; (average)\"\nset _menu_cmd_10 \"voice_avggain\"\nset _menu_f10 $voice_avggain\n\nbuild_menu\n"
  },
  {
    "path": "3rdparty/cs16client-extras/touch/cmd/my_menu-4-cross-size.cfg",
    "content": "cmd_scripting 1\nset menu_root_path \"touch/cmd\"\nset _menu_id my_menu-4-cross-size\nset _menu_level 4\nset _menu_min 7\nset _menu_max 10\n\nset _menu_type_7 1\nset _menu_txt_7 \"Auto\"\nset _menu_cmd_7 \"cl_crosshair_size auto\"\nset _menu_icn_7 \"\"\n\nset _menu_type_8 1\nset _menu_txt_8 \"Small\"\nset _menu_cmd_8 \"cl_crosshair_size small\"\nset _menu_icn_8 \"\"\n\nset _menu_type_9 1\nset _menu_txt_9 \"Medium\"\nset _menu_cmd_9 \"cl_crosshair_size medium\"\nset _menu_icn_9 \"\"\n\nset _menu_type_10 1\nset _menu_txt_10 \"Large\"\nset _menu_cmd_10 \"cl_crosshair_size large\"\nset _menu_icn_10 \"\"\n\nbuild_menu\n\nif $cl_crosshair_size = auto;:touch_setcolor _menu_S7_my_menu-4-cross-size 156 77 20 180\nif $cl_crosshair_size = small;:touch_setcolor _menu_S8_my_menu-4-cross-size 156 77 20 180\nif $cl_crosshair_size = medium;:touch_setcolor _menu_S9_my_menu-4-cross-size 156 77 20 180\nif $cl_crosshair_size = large;:touch_setcolor _menu_S0_my_menu-4-cross-size 156 77 20 180\n"
  },
  {
    "path": "3rdparty/cs16client-extras/touch/cmd/my_menu-4-cvar0.cfg",
    "content": "cmd_scripting 1\nset menu_root_path \"touch/cmd\"\nset _menu_id my_menu-4-cvar0\nset _menu_level 4\nset _menu_min 5\nset _menu_max 8\n\nset _menu_type_5 1\nset _menu_txt_5 \"Log detail\"\nset _menu_cmd_5 \"exec $menu_root_path/my_menu-5-cvar0-2\"\nset _menu_icn_5 \"touch/cmd/right.tga\"\n\nset _menu_type_6 2\nset _menu_txt_6 \"Log file\"\nset _menu_cmd_6 \"mp_logfile\"\nset _menu_f6 $mp_logfile\n\nset _menu_type_7 2\nset _menu_txt_7 \"Log echo\"\nset _menu_cmd_7 \"mp_logecho\"\nset _menu_f7 $mp_logecho\n\nset _menu_type_8 2\nset _menu_txt_8 \"Log messages\"\nset _menu_cmd_8 \"mp_logmessages\"\nset _menu_f8 $mp_logmessages\n\nbuild_menu\n"
  },
  {
    "path": "3rdparty/cs16client-extras/touch/cmd/my_menu-4-cvar1.cfg",
    "content": "cmd_scripting 1\nset menu_root_path \"touch/cmd\"\nset _menu_id my_menu-4-cvar1\nset _menu_level 4\nset _menu_min 3\nset _menu_max 10\n\nset _menu_type_3 3\nset _menu_txt_3 \"Server name\"\nset _menu_cmd_3 \"hostname\"\nset _menu_f3 $hostname\n\nset _menu_type_4 3\nset _menu_txt_4 \"Max players\"\nset _menu_cmd_4 \"maxplayers\"\nset _menu_f4 $maxplayers\n\nset _menu_type_5 3\nset _menu_txt_5 \"Default map\"\nset _menu_cmd_5 \"defaultmap\"\nset _menu_f5 $defaultmap\n\nset _menu_type_6 2\nset _menu_txt_6 \"Cheats\"\nset _menu_cmd_6 \"sv_cheats\"\nset _menu_f6 $sv_cheats\n\nset _menu_type_7 2\nset _menu_txt_7 \"Entity Tools\"\nset _menu_cmd_7 \"sv_enttools_enable\"\nset _menu_f7 $sv_enttools_enable\n\nset _menu_type_8 2\nset _menu_txt_8 \"Air move\"\nset _menu_cmd_8 \"sv_airmove\"\nset _menu_f8 $sv_airmove\n\nset _menu_type_9 2\nset _menu_txt_9 \"Enable voice; (server)\"\nset _menu_cmd_9 \"sv_voiceenable\"\nset _menu_f9 $sv_voiceenable\n\nset _menu_type_10 1\nset _menu_txt_10 \"Voice quality level; (server)\"\nset _menu_cmd_10 \"exec $menu_root_path/my_menu-5-voicequality\"\nset _menu_icn_10 \"touch/cmd/right.tga\"\n\nbuild_menu\n"
  },
  {
    "path": "3rdparty/cs16client-extras/touch/cmd/my_menu-4-cvar2.cfg",
    "content": "cmd_scripting 1\nset menu_root_path \"touch/cmd\"\nset _menu_id my_menu-4-cvar2\nset _menu_level 4\nset _menu_min 1\nset _menu_max 10\n\nset _menu_type_1 2\nset _menu_txt_1 \"Allow; spectators\"\nset _menu_cmd_1 \"allow_spectators\"\nset _menu_f1 $allow_spectators\n\nset _menu_type_2 1\nset _menu_txt_2 \"Players can join team\"\nset _menu_cmd_2 \"exec $menu_root_path/my_menu-5-cvar2-2\"\nset _menu_icn_2 \"touch/cmd/right.tga\"\n\nset _menu_type_3 2\nset _menu_txt_3 \"Friendly fire\"\nset _menu_cmd_3 \"mp_friendlyfire\"\nset _menu_f3 $mp_friendlyfire\n\nset _menu_type_4 3\nset _menu_txt_4 \"Team limit\"\nset _menu_cmd_4 \"mp_limitteams\"\nset _menu_f4 $mp_limitteams\n\nset _menu_type_5 2\nset _menu_txt_5 \"Auto balance\"\nset _menu_cmd_5 \"mp_autoteambalance\"\nset _menu_f5 $mp_autoteambalance\n\nset _menu_type_6 2\nset _menu_txt_6 \"Auto kick\"\nset _menu_cmd_6 \"mp_autokick\"\nset _menu_f6 $mp_autokick\n\nset _menu_type_7 3\nset _menu_txt_7 \"Auto kick; timeout\"\nset _menu_cmd_7 \"mp_autokick_timeout\"\nset _menu_f7 $mp_autokick_timeout\n\nset _menu_type_8 3\nset _menu_txt_8 \"Kick percent\"\nset _menu_cmd_8 \"mp_kickpercent\"\nset _menu_f8 $mp_kickpercent\n\nset _menu_type_9 2\nset _menu_txt_9 \"Force respawn\"\nset _menu_cmd_9 \"mp_forcerespawn\"\nset _menu_f9 $mp_forcerespawn\n\nset _menu_type_10 2\nset _menu_txt_10 \"Free For All\"\nset _menu_cmd_10 \"mp_freeforall\"\nset _menu_f10 $mp_freeforall\n\nbuild_menu\n"
  },
  {
    "path": "3rdparty/cs16client-extras/touch/cmd/my_menu-4-cvar3.cfg",
    "content": "cmd_scripting 1\nset menu_root_path \"touch/cmd\"\nset _menu_id my_menu-4-cvar3\nset _menu_level 4\nset _menu_min 1\nset _menu_max 10\n\nset _menu_type_1 3\nset _menu_txt_1 \"Max rounds\"\nset _menu_cmd_1 \"mp_maxrounds\"\nset _menu_f1 $mp_maxrounds\n\nset _menu_type_2 3\nset _menu_txt_2 \"Round restart; delay\"\nset _menu_cmd_2 \"mp_round_restart_delay\"\nset _menu_f2 $mp_round_restart_delay\n\nset _menu_type_3 2\nset _menu_txt_3 \"Infinite; rounds\"\nset _menu_cmd_3 \"mp_round_infinite\"\nset _menu_f3 $mp_round_infinite\n\nset _menu_type_4 3\nset _menu_txt_4 \"Round over\"\nset _menu_cmd_4 \"mp_roundover\"\nset _menu_f4 $mp_roundover\n\nset _menu_type_5 3\nset _menu_txt_5 \"Round time\"\nset _menu_cmd_5 \"mp_roundtime\"\nset _menu_f5 $mp_roundtime\n\nset _menu_type_6 3\nset _menu_txt_6 \"Buy time\"\nset _menu_cmd_6 \"mp_buytime\"\nset _menu_f6 $mp_buytime\n\nset _menu_type_7 3\nset _menu_txt_7 \"C4 timer\"\nset _menu_cmd_7 \"mp_c4timer\"\nset _menu_f7 $mp_c4timer\n\nset _menu_type_8 3\nset _menu_txt_8 \"Freeze time\"\nset _menu_cmd_8 \"mp_freezetime\"\nset _menu_f8 $mp_freezetime\n\nset _menu_type_9 3\nset _menu_txt_9 \"Max money\"\nset _menu_cmd_9 \"mp_maxmoney\"\nset _menu_f9 $mp_maxmoney\n\nset _menu_type_10 3\nset _menu_txt_10 \"Start money\"\nset _menu_cmd_10 \"mp_startmoney\"\nset _menu_f10 $mp_startmoney\n\nbuild_menu\n\nexec $menu_root_path/my_menu-5-cvar3-2\n"
  },
  {
    "path": "3rdparty/cs16client-extras/touch/cmd/my_menu-4-cvar4.cfg",
    "content": "cmd_scripting 1\nset menu_root_path \"touch/cmd\"\nset _menu_id my_menu-4-cvar4\nset _menu_level 4\nset _menu_min 4\nset _menu_max 10\n\nset _menu_type_4 2\nset _menu_txt_4 \"Kill in a; filled spawn\"\nset _menu_cmd_4 \"mp_kill_filled_spawn\"\nset _menu_f4 $mp_kill_filled_spawn\n\nset _menu_type_5 2\nset _menu_txt_5 \"Legacy bomb; target touch\"\nset _menu_cmd_5 \"mp_legacy_bombtarget_touch\"\nset _menu_f5 $mp_legacy_bombtarget_touch\n\nset _menu_type_6 2\nset _menu_txt_6 \"Footsteps\"\nset _menu_cmd_6 \"mp_footsteps\"\nset _menu_f6 $mp_footsteps\n\nset _menu_type_7 2\nset _menu_txt_7 \"Hurtable; hostages\"\nset _menu_cmd_7 \"mp_hostage_hurtable\"\nset _menu_f7 $mp_hostage_hurtable\n\nset _menu_type_8 3\nset _menu_txt_8 \"Hostage; penalty\"\nset _menu_cmd_8 \"mp_hostagepenalty\"\nset _menu_f8 $mp_hostagepenalty\n\nset _menu_type_9 3\nset _menu_txt_9 \"Item stay time\"\nset _menu_cmd_9 \"mp_item_staytime\"\nset _menu_f9 $mp_item_staytime\n\nset _menu_type_10 2\nset _menu_txt_10 \"Flashlight\"\nset _menu_cmd_10 \"mp_flashlight\"\nset _menu_f10 $mp_flashlight\n\nbuild_menu\n"
  },
  {
    "path": "3rdparty/cs16client-extras/touch/cmd/my_menu-4-cvar5.cfg",
    "content": "cmd_scripting 1\nset menu_root_path \"touch/cmd\"\nset _menu_id my_menu-4-cvar5\nset _menu_level 4\nset _menu_min 1\nset _menu_max 10\n\nset _menu_type_1 3\nset _menu_txt_1 \"Map vote ratio\"\nset _menu_cmd_1 \"mp_mapvoteratio\"\nset _menu_f1 $mp_mapvoteratio\n\nset _menu_type_2 3\nset _menu_txt_2 \"Decals\"\nset _menu_cmd_2 \"mp_decals\"\nset _menu_f2 $mp_decals\n\nset _menu_type_3 3\nset _menu_txt_3 \"Decal frequency\"\nset _menu_cmd_3 \"decalfrequency\"\nset _menu_f3 $decalfrequency\n\nset _menu_type_4 2\nset _menu_txt_4 \"Pausable\"\nset _menu_cmd_4 \"pausable\"\nset _menu_f4 $pausable\n\nset _menu_type_5 2\nset _menu_txt_5 \"Old bomb; defused sound\"\nset _menu_cmd_5 \"mp_old_bomb_defused_sound\"\nset _menu_f5 $mp_old_bomb_defused_sound\n\nset _menu_type_6 1\nset _menu_txt_6 \"Player ID in status bar\"\nset _menu_cmd_6 \"exec $menu_root_path/my_menu-5-cvar5-2\"\nset _menu_icn_6 \"touch/cmd/right.tga\"\n\nset _menu_type_7 2\nset _menu_txt_7 \"Consistency\"\nset _menu_cmd_7 \"mp_consistency\"\nset _menu_f7 $mp_consistency\n\nset _menu_type_8 2\nset _menu_txt_8 \"Fade to black\"\nset _menu_cmd_8 \"mp_fadetoblack\"\nset _menu_f8 $mp_fadetoblack\n\nset _menu_type_9 2\nset _menu_txt_9 \"Show radio; icon\"\nset _menu_cmd_9 \"mp_show_radioicon\"\nset _menu_f9 $mp_show_radioicon\n\nset _menu_type_10 2\nset _menu_txt_10 \"Punish; team killers\"\nset _menu_cmd_10 \"mp_tkpunish\"\nset _menu_f10 $mp_tkpunish\n\nbuild_menu\n"
  },
  {
    "path": "3rdparty/cs16client-extras/touch/cmd/my_menu-4-xhair.cfg",
    "content": "cmd_scripting 1\r\nset menu_root_path \"touch/cmd\"\r\nset _menu_id my_menu-4-xhair\r\nset _menu_level 4\r\nset _menu_min 1\r\nset _menu_max 10\r\n\r\nset _menu_type_1 2\r\nset _menu_txt_1 \"Enable\"\r\nset _menu_cmd_1 \"xhair_enable\"\r\nset _menu_f1 $xhair_enable\r\n\r\nset _menu_type_2 2\r\nset _menu_txt_2 \"Enable; dynamic; move\"\r\nset _menu_cmd_2 \"xhair_dynamic_move\"\r\nset _menu_f2 $xhair_dynamic_move\r\n\r\nset _menu_type_3 2\r\nset _menu_txt_3 \"T-Shape\"\r\nset _menu_cmd_3 \"xhair_t\"\r\nset _menu_f3 $xhair_t\r\n\r\nset _menu_type_4 2\r\nset _menu_txt_4 \"Additive\"\r\nset _menu_cmd_4 \"xhair_additive\"\r\nset _menu_f4 $xhair_additive\r\n\r\nset _menu_type_5 2\r\nset _menu_txt_5 \"Gap uses; weapon value\"\r\nset _menu_cmd_5 \"xhair_gap_useweaponvalue\"\r\nset _menu_f5 $xhair_gap_useweaponvalue\r\n\r\nset _menu_type_6 2\r\nset _menu_txt_6 \"Dot\"\r\nset _menu_cmd_6 \"xhair_dot\"\r\nset _menu_f6 $xhair_dot\r\n\r\nset _menu_type_7 3\r\nset _menu_txt_7 \"Color\"\r\nset _menu_cmd_7 \"xhair_color\"\r\nset _menu_f7 $xhair_color\r\n\r\nset _menu_type_8 3\r\nset _menu_txt_8 \"Gap\"\r\nset _menu_cmd_8 \"xhair_gap\"\r\nset _menu_f8 $xhair_gap\r\n\r\nset _menu_type_9 3\r\nset _menu_txt_9 \"Padding\"\r\nset _menu_cmd_9 \"xhair_pad\"\r\nset _menu_f9 $xhair_pad\r\n\r\nset _menu_type_10 1\r\nset _menu_txt_10 \"Open More\"\r\nset _menu_cmd_10 \"exec $menu_root_path/my_menu-5-xhair\"\r\nset _menu_icn_10 \"touch/cmd/right.tga\"\r\n\r\nbuild_menu\r\n"
  },
  {
    "path": "3rdparty/cs16client-extras/touch/cmd/my_menu-5-cvar0-2.cfg",
    "content": "cmd_scripting 1\nset menu_root_path \"touch/cmd\"\nset _menu_id my_menu-5-cvar0-2\nset _menu_level 5\nset _menu_min 5\nset _menu_max 8\n\nset _menu_type_5 1\nset _menu_txt_5 \"Log no attacks\"\nset _menu_cmd_5 \"mp_logdetail 0\"\nset _menu_icn_5 \"\"\n\nset _menu_type_6 1\nset _menu_txt_6 \"Log enemy attacks\"\nset _menu_cmd_6 \"mp_logdetail 1\"\nset _menu_icn_6 \"\"\n\nset _menu_type_7 1\nset _menu_txt_7 \"Log teammate attacks\"\nset _menu_cmd_7 \"mp_logdetail 2\"\nset _menu_icn_7 \"\"\n\nset _menu_type_8 1\nset _menu_txt_8 \"Log enemy and; teammate attacks\"\nset _menu_cmd_8 \"mp_logdetail 3\"\nset _menu_icn_8 \"\"\n\nbuild_menu\n\nif $mp_logdetail = 0;:touch_setcolor _menu_S5_my_menu-5-cvar0-2 156 77 20 180\nif $mp_logdetail = 1;:touch_setcolor _menu_S6_my_menu-5-cvar0-2 156 77 20 180\nif $mp_logdetail = 2;:touch_setcolor _menu_S7_my_menu-5-cvar0-2 156 77 20 180\nif $mp_logdetail = 3;:touch_setcolor _menu_S8_my_menu-5-cvar0-2 156 77 20 180\n\n"
  },
  {
    "path": "3rdparty/cs16client-extras/touch/cmd/my_menu-5-cvar2-2.cfg",
    "content": "cmd_scripting 1\nset menu_root_path \"touch/cmd\"\nset _menu_id my_menu-5-cvar2-2\nset _menu_level 5\nset _menu_min 2\nset _menu_max 4\n\nset _menu_type_2 1\nset _menu_txt_2 \"Any\"\nset _menu_cmd_2 \"humans_join_team any\"\nset _menu_icn_2 \"\"\n\nset _menu_type_3 1\nset _menu_txt_3 \"Terrorist\"\nset _menu_cmd_3 \"humans_join_team t\"\nset _menu_icn_3 \"\"\n\nset _menu_type_4 1\nset _menu_txt_4 \"Counter-Terrorist\"\nset _menu_cmd_4 \"humans_join_team ct\"\nset _menu_icn_4 \"\"\n\nbuild_menu\n\nif $humans_join_team = any;:touch_setcolor _menu_S2_my_menu-5-cvar2-2 156 77 20 180\nif $humans_join_team = t;:touch_setcolor _menu_S3_my_menu-5-cvar2-2 156 77 20 180\nif $humans_join_team = ct;:touch_setcolor _menu_S4_my_menu-5-cvar2-2 156 77 20 180\n\n\n"
  },
  {
    "path": "3rdparty/cs16client-extras/touch/cmd/my_menu-5-cvar3-2.cfg",
    "content": "cmd_scripting 1\nset menu_root_path \"touch/cmd\"\nset _menu_id my_menu-5-cvar3-2\nset _menu_level 5\nset _menu_min 1\nset _menu_max 4\n\nset _menu_type_1 3\nset _menu_txt_1 \"Time limit\"\nset _menu_cmd_1 \"mp_timelimit\"\nset _menu_f1 $mp_timelimit\n\nset _menu_type_2 3\nset _menu_txt_2 \"Win limit\"\nset _menu_cmd_2 \"mp_winlimit\"\nset _menu_f2 $mp_winlimit\n\nset _menu_type_3 3\nset _menu_txt_3 \"Frag limit\"\nset _menu_cmd_3 \"mp_fraglimit\"\nset _menu_f3 $mp_fraglimit\n\nset _menu_type_4 3\nset _menu_txt_4 \"Chat time\"\nset _menu_cmd_4 \"mp_chattime\"\nset _menu_f4 $mp_chattime\n\nbuild_menu"
  },
  {
    "path": "3rdparty/cs16client-extras/touch/cmd/my_menu-5-cvar5-2.cfg",
    "content": "cmd_scripting 1\nset menu_root_path \"touch/cmd\"\nset _menu_id my_menu-5-cvar5-2\nset _menu_level 5\nset _menu_min 6\nset _menu_max 8\n\nset _menu_type_6 1\nset _menu_txt_6 \"Show for everyone\"\nset _menu_cmd_6 \"mp_playerid 0\"\nset _menu_icn_6 \"\"\n\nset _menu_type_7 1\nset _menu_txt_7 \"Show only for teammates; and hostages\"\nset _menu_cmd_7 \"mp_playerid 1\"\nset _menu_icn_7 \"\"\n\nset _menu_type_8 1\nset _menu_txt_8 \"Don't show\"\nset _menu_cmd_8 \"mp_playerid 2\"\nset _menu_icn_8 \"\"\n\nbuild_menu\n\nif $mp_playerid = 0;:touch_setcolor _menu_S6_my_menu-5-cvar5-2 156 77 20 180\nif $mp_playerid = 1;:touch_setcolor _menu_S7_my_menu-5-cvar5-2 156 77 20 180\nif $mp_playerid = 2;:touch_setcolor _menu_S8_my_menu-5-cvar5-2 156 77 20 180\n\n"
  },
  {
    "path": "3rdparty/cs16client-extras/touch/cmd/my_menu-5-voicequality.cfg",
    "content": "cmd_scripting 1\nset menu_root_path \"touch/cmd\"\nset _menu_id my_menu-5-voicequality\nset _menu_level 5\nset _menu_min 5\nset _menu_max 10\n\nset _menu_type_5 1\nset _menu_txt_5 \"Higher\"\nset _menu_cmd_5 \"sv_voicequality 5\"\nset _menu_icn_5 \"\"\n\nset _menu_type_6 1\nset _menu_txt_6 \"High\"\nset _menu_cmd_6 \"sv_voicequality 4\"\nset _menu_icn_6 \"\"\n\nset _menu_type_7 1\nset _menu_txt_7 \"Normal\"\nset _menu_cmd_7 \"sv_voicequality 3\"\nset _menu_icn_7 \"\"\n\nset _menu_type_8 1\nset _menu_txt_8 \"Low\"\nset _menu_cmd_8 \"sv_voicequality 2\"\nset _menu_icn_8 \"\"\n\nset _menu_type_9 1\nset _menu_txt_9 \"Lower\"\nset _menu_cmd_9 \"sv_voicequality 1\"\nset _menu_icn_9 \"\"\n\nset _menu_type_10 1\nset _menu_txt_10 \"Worst\"\nset _menu_cmd_10 \"sv_voicequality 0\"\nset _menu_icn_10 \"\"\n\nbuild_menu\n\nif $sv_voicequality = 0;:touch_setcolor _menu_S0_my_menu-5-voicequality 156 77 20 180\nif $sv_voicequality = 1;:touch_setcolor _menu_S9_my_menu-5-voicequality 156 77 20 180\nif $sv_voicequality = 2;:touch_setcolor _menu_S8_my_menu-5-voicequality 156 77 20 180\nif $sv_voicequality = 3;:touch_setcolor _menu_S7_my_menu-5-voicequality 156 77 20 180\nif $sv_voicequality = 4;:touch_setcolor _menu_S6_my_menu-5-voicequality 156 77 20 180\nif $sv_voicequality = 5;:touch_setcolor _menu_S5_my_menu-5-voicequality 156 77 20 180\n"
  },
  {
    "path": "3rdparty/cs16client-extras/touch/cmd/my_menu-5-xhair.cfg",
    "content": "cmd_scripting 1\r\nset menu_root_path \"touch/cmd\"\r\nset _menu_id my_menu-5-xhair\r\nset _menu_level 5\r\nset _menu_min 8\r\nset _menu_max 10\r\n\r\nset _menu_type_8 3\r\nset _menu_txt_8 \"Size\"\r\nset _menu_cmd_8 \"xhair_size\"\r\nset _menu_f8 $xhair_size\r\n\r\nset _menu_type_9 3\r\nset _menu_txt_9 \"Thickness\"\r\nset _menu_cmd_9 \"xhair_thick\"\r\nset _menu_f9 $xhair_thick\r\n\r\nset _menu_type_10 3\r\nset _menu_txt_10 \"Dynamic Scaling\"\r\nset _menu_cmd_10 \"xhair_dynamic_scale\"\r\nset _menu_f10 $xhair_dynamic_scale\r\n\r\nbuild_menu\r\n"
  },
  {
    "path": "3rdparty/cs16client-extras/touch/custom/dm_menu.cfg",
    "content": "// * Auto generated file\n\ntouch_setclientonly 1\n\n// global overstroke (width, r, g, b, a)\ntouch_set_stroke 1 240 140 0 200\n\n// Background & buttons\ntouch_addbutton \"_menu_bg\" \"*white\" \"\" 0.03 0.193611 0.965 0.831386 0 0 0 80 260\ntouch_addbutton \"_menu_bg2\" \"*white\" \"\" 0.095 0.0569444 0.965 0.182222 0 0 0 80 260\ntouch_addbutton \"_menu_bg3\" \"*white\" \"\" 0.03 0.0569444 0.09 0.182222 0 0 0 80 260\n\n//touch_addbutton \"_menu_button_bg0\" \"*white\" \"\" 0.04 0.3075 0.215 0.82 0 0 0 80 260\n//touch_addbutton \"_menu_button_bg1\" \"*white\" \"\" 0.04 0.205 0.215 0.296111 0 0 0 80 260\ntouch_addbutton \"_menu_button_bg2\" \"*white\" \"ak47;primammo ;touch_setcolor _menu_button_bg* 0 0 0 80 ;touch_setcolor _menu_button_bg2 140 140 0 80\" 0.22 0.205 0.4 0.296111 0 0 0 80 260\ntouch_addbutton \"_menu_button_bg3\" \"*white\" \"m4a1;primammo ;touch_setcolor _menu_button_bg* 0 0 0 80 ;touch_setcolor _menu_button_bg3 140 140 0 80\" 0.22 0.3075 0.4 0.398611 0 0 0 80 260\ntouch_addbutton \"_menu_button_bg4\" \"*white\" \"awp;primammo ;touch_setcolor _menu_button_bg* 0 0 0 80 ;touch_setcolor _menu_button_bg4 140 140 0 80\" 0.22 0.41 0.4 0.501111 0 0 0 80 260\ntouch_addbutton \"_menu_button_bg5\" \"*white\" \"galil;primammo ;touch_setcolor _menu_button_bg* 0 0 0 80 ;touch_setcolor _menu_button_bg5 140 140 0 80\" 0.22 0.5125 0.4 0.603611 0 0 0 80 260\ntouch_addbutton \"_menu_button_bg6\" \"*white\" \"aug;primammo ;touch_setcolor _menu_button_bg* 0 0 0 80 ;touch_setcolor _menu_button_bg6 140 140 0 80\" 0.22 0.615 0.4 0.706111 0 0 0 80 260\ntouch_addbutton \"_menu_button_bg7\" \"*white\" \"famas;primammo ;touch_setcolor _menu_button_bg* 0 0 0 80 ;touch_setcolor _menu_button_bg7 140 140 0 80\" 0.22 0.728889 0.4 0.82 0 0 0 80 260\ntouch_addbutton \"_menu_button_bg8\" \"*white\" \"p90;primammo ;touch_setcolor _menu_button_bg* 0 0 0 80 ;touch_setcolor _menu_button_bg8 140 140 0 80\" 0.405 0.205 0.585 0.296111 0 0 0 80 260\ntouch_addbutton \"_menu_button_bg9\" \"*white\" \"mp5;primammo ;touch_setcolor _menu_button_bg* 0 0 0 80 ;touch_setcolor _menu_button_bg9 140 140 0 80\" 0.405 0.3075 0.585 0.398611 0 0 0 80 260\ntouch_addbutton \"_menu_button_bg10\" \"*white\" \"mac10;primammo ;touch_setcolor _menu_button_bg* 0 0 0 80 ;touch_setcolor _menu_button_bg10 140 140 0 80\" 0.405 0.41 0.585 0.501111 0 0 0 80 260\ntouch_addbutton \"_menu_button_bg11\" \"*white\" \"m3;primammo ;touch_setcolor _menu_button_bg* 0 0 0 80 ;touch_setcolor _menu_button_bg11 140 140 0 80\" 0.405 0.5125 0.585 0.603611 0 0 0 80 260\ntouch_addbutton \"_menu_button_bg12\" \"*white\" \"xm1014;primammo ;touch_setcolor _menu_button_bg* 0 0 0 80 ;touch_setcolor _menu_button_bg12 140 140 0 80\" 0.405 0.615 0.585 0.706111 0 0 0 80 260\ntouch_addbutton \"_menu_button_bg13\" \"*white\" \"scout;primammo ;touch_setcolor _menu_button_bg* 0 0 0 80 ;touch_setcolor _menu_button_bg13 140 140 0 80\" 0.405 0.728889 0.585 0.82 0 0 0 80 260\ntouch_addbutton \"_menu_button_bg14\" \"*white\" \"ump45;primammo ;touch_setcolor _menu_button_bg* 0 0 0 80 ;touch_setcolor _menu_button_bg14 140 140 0 80\" 0.59 0.205 0.77 0.296111 0 0 0 80 260\ntouch_addbutton \"_menu_button_bg15\" \"*white\" \"tmp;primammo ;touch_setcolor _menu_button_bg* 0 0 0 80 ;touch_setcolor _menu_button_bg15 140 140 0 80\" 0.59 0.3075 0.77 0.398611 0 0 0 80 260\ntouch_addbutton \"_menu_button_bg16\" \"*white\" \"sg550;primammo ;touch_setcolor _menu_button_bg* 0 0 0 80 ;touch_setcolor _menu_button_bg16 140 140 0 80\" 0.59 0.41 0.77 0.501111 0 0 0 80 260\ntouch_addbutton \"_menu_button_bg17\" \"*white\" \"g3sg1;primammo ;touch_setcolor _menu_button_bg* 0 0 0 80 ;touch_setcolor _menu_button_bg17 140 140 0 80\" 0.59 0.5125 0.77 0.603611 0 0 0 80 260\ntouch_addbutton \"_menu_button_bg18\" \"*white\" \"m249;primammo ;touch_setcolor _menu_button_bg* 0 0 0 80 ;touch_setcolor _menu_button_bg18 140 140 0 80\" 0.59 0.615 0.77 0.706111 0 0 0 80 260\ntouch_addbutton \"_menu_button_bg19\" \"*white\" \"sg552;primammo ;touch_setcolor _menu_button_bg* 0 0 0 80 ;touch_setcolor _menu_button_bg19 140 140 0 80\" 0.59 0.728889 0.77 0.82 0 0 0 80 260\ntouch_addbutton \"_menu_button_bg20\" \"*white\" \"deagle;secammo ;touch_setcolor _menu_button_bg* 0 0 0 80 ;touch_setcolor _menu_button_bg20 140 140 0 80\" 0.775 0.205 0.955 0.296111 0 0 0 80 260\ntouch_addbutton \"_menu_button_bg21\" \"*white\" \"elite;secammo ;touch_setcolor _menu_button_bg* 0 0 0 80 ;touch_setcolor _menu_button_bg21 140 140 0 80\" 0.775 0.3075 0.955 0.398611 0 0 0 80 260\ntouch_addbutton \"_menu_button_bg22\" \"*white\" \"glock18;secammo ;touch_setcolor _menu_button_bg* 0 0 0 80 ;touch_setcolor _menu_button_bg22 140 140 0 80\" 0.775 0.41 0.955 0.501111 0 0 0 80 260\ntouch_addbutton \"_menu_button_bg23\" \"*white\" \"fiveseven;secammo ;touch_setcolor _menu_button_bg* 0 0 0 80 ;touch_setcolor _menu_button_bg23 140 140 0 80\" 0.775 0.5125 0.955 0.603611 0 0 0 80 260\ntouch_addbutton \"_menu_button_bg24\" \"*white\" \"p228;secammo ;touch_setcolor _menu_button_bg* 0 0 0 80 ;touch_setcolor _menu_button_bg24 140 140 0 80\" 0.775 0.615 0.955 0.706111 0 0 0 80 260\ntouch_addbutton \"_menu_button_bg25\" \"*white\" \"usp;secammo ;touch_setcolor _menu_button_bg* 0 0 0 80 ;touch_setcolor _menu_button_bg25 140 140 0 80\" 0.775 0.728889 0.955 0.82 0 0 0 80 260\n//touch_addbutton \"_menu_button_bg26\" \"*white\" \"\" 0.04 0.41 0.215 0.501111 0 0 0 80 260\n//touch_addbutton \"_menu_button_bg27\" \"*white\" \"\" 0.04 0.5125 0.215 0.603611 0 0 0 80 260\n//touch_addbutton \"_menu_button_bg28\" \"*white\" \"\" 0.04 0.615 0.215 0.706111 0 0 0 80 260\n//touch_addbutton \"_menu_button_bg29\" \"*white\" \"\" 0.04 0.728889 0.215 0.82 0 0 0 80 260\n//touch_addbutton \"_menu_button_bg30\" \"*white\" \"\" 0.04 0.3075 0.215 0.82 0 0 0 80 260\n\ntouch_addbutton \"_menu_button1\" \"*white\" \"touch_removebutton _menu_* ;touch_setclientonly 0\" 0.03 0.842775 0.24 0.968053 0 0 0 80 260\ntouch_addbutton \"_menu_button2\" \"*white\" \"\" 0.245 0.842775 0.455 0.968053 0 0 0 80 73\ntouch_addbutton \"_menu_button3\" \"*white\" \"\" 0.54 0.842776 0.75 0.968054 0 0 0 80 73\ntouch_addbutton \"_menu_button4\" \"*white\" \"\" 0.755 0.842776 0.965 0.968054 0 0 0 80 73\n\n// Icons\ntouch_addbutton \"_menu_icon\" \"gfx/vgui/CS_logo\" \"\" 0.03 0.0569444 0.09 0.182222 240 140 0 255 78\ntouch_addbutton \"_menu_bg_icon\" \"gfx/vgui/ak47\" \"\" 0.315 0.205 0.4 0.296111 255 255 255 255 78\ntouch_addbutton \"_menu_bg_icon2\" \"gfx/vgui/m4a1\" \"\" 0.315 0.3075 0.4 0.398611 255 255 255 255 78\ntouch_addbutton \"_menu_bg_icon3\" \"gfx/vgui/awp\" \"\" 0.315 0.41 0.4 0.501111 255 255 255 255 78\ntouch_addbutton \"_menu_bg_icon4\" \"gfx/vgui/galil\" \"\" 0.315 0.5125 0.4 0.603611 255 255 255 255 78\ntouch_addbutton \"_menu_bg_icon5\" \"gfx/vgui/aug\" \"\" 0.315 0.615 0.4 0.706111 255 255 255 255 78\ntouch_addbutton \"_menu_bg_icon6\" \"gfx/vgui/famas\" \"\" 0.315 0.728889 0.4 0.82 255 255 255 255 78\ntouch_addbutton \"_menu_bg_icon7\" \"gfx/vgui/p90\" \"\" 0.5 0.205 0.585 0.296111 255 255 255 255 78\ntouch_addbutton \"_menu_bg_icon8\" \"gfx/vgui/mp5.tga\" \"\" 0.5 0.3075 0.585 0.398611 255 255 255 255 78\ntouch_addbutton \"_menu_bg_icon9\" \"gfx/vgui/mac10\" \"\" 0.5 0.41 0.585 0.501111 255 255 255 255 78\ntouch_addbutton \"_menu_bg_icon10\" \"gfx/vgui/m3\" \"\" 0.5 0.5125 0.585 0.603611 255 255 255 255 78\ntouch_addbutton \"_menu_bg_icon11\" \"gfx/vgui/xm1014\" \"\" 0.5 0.615 0.585 0.706111 255 255 255 255 78\ntouch_addbutton \"_menu_bg_icon12\" \"gfx/vgui/scout\" \"\" 0.5 0.728889 0.585 0.82 255 255 255 255 78\ntouch_addbutton \"_menu_bg_icon13\" \"gfx/vgui/ump45\" \"\" 0.685 0.205 0.77 0.296111 255 255 255 255 78\ntouch_addbutton \"_menu_bg_icon14\" \"gfx/vgui/tmp\" \"\" 0.685 0.3075 0.77 0.398611 255 255 255 255 78\ntouch_addbutton \"_menu_bg_icon15\" \"gfx/vgui/sg550\" \"\" 0.685 0.41 0.77 0.501111 255 255 255 255 78\ntouch_addbutton \"_menu_bg_icon16\" \"gfx/vgui/g3sg1\" \"\" 0.685 0.5125 0.77 0.603611 255 255 255 255 78\ntouch_addbutton \"_menu_bg_icon17\" \"gfx/vgui/m249\" \"\" 0.685 0.615 0.77 0.706111 255 255 255 255 78\ntouch_addbutton \"_menu_bg_icon18\" \"gfx/vgui/sg552\" \"\" 0.685 0.728889 0.77 0.82 255 255 255 255 78\ntouch_addbutton \"_menu_bg_icon19\" \"gfx/vgui/deserteagle\" \"\" 0.87 0.205 0.955 0.296111 255 255 255 255 78\ntouch_addbutton \"_menu_bg_icon20\" \"gfx/vgui/elites\" \"\" 0.87 0.3075 0.955 0.398611 255 255 255 255 78\ntouch_addbutton \"_menu_bg_icon21\" \"gfx/vgui/glock18\" \"\" 0.87 0.41 0.955 0.501111 255 255 255 255 78\ntouch_addbutton \"_menu_bg_icon22\" \"gfx/vgui/fiveseven\" \"\" 0.87 0.5125 0.955 0.603611 255 255 255 255 78\ntouch_addbutton \"_menu_bg_icon23\" \"gfx/vgui/p228\" \"\" 0.87 0.615 0.955 0.706111 255 255 255 255 78\ntouch_addbutton \"_menu_bg_icon24\" \"gfx/vgui/usp45\" \"\" 0.87 0.728889 0.955 0.82 255 255 255 255 78\n//touch_addbutton \"_menu_bg_icon1-25\" \"*\" \"\" 0.13 0.3075 0.215 0.398611 255 255 255 255 78\n//touch_addbutton \"_menu_bg_icon26\" \"*\" \"\" 0.13 0.41 0.215 0.501111 255 255 255 255 78\n//touch_addbutton \"_menu_bg_icon27\" \"*\" \"\" 0.13 0.5125 0.215 0.603611 255 255 255 255 78\n//touch_addbutton \"_menu_bg_icon28\" \"*\" \"\" 0.13 0.615 0.215 0.706111 255 255 255 255 78\n//touch_addbutton \"_menu_bg_icon29\" \"*\" \"\" 0.13 0.728889 0.215 0.82 255 255 255 255 78\n//touch_addbutton \"_menu_bg_icon0-1\" \"*\" \"\" 0.13 0.205 0.215 0.296111 255 255 255 255 78\n\n// Text\n//touch_addbutton \"_menu_text_bg0-1\" \"# TEXT\" \"\" 0.05 0.227778 0.14 0.284722 240 140 0 255 78\ntouch_addbutton \"_menu_text_bg\" \"# DM  | SELECT WEAPON\" \"\" 0.44 0.1025 0.95 0.170833 240 140 0 255 78\n//touch_addbutton \"_menu_text_bg1\" \"# TEXT\" \"\" 0.055 0.227778 0.21 0.284722 240 140 0 255 73\ntouch_addbutton \"_menu_text_exit\" \"# CLOSE\" \"\" 0.11 0.888333 0.235 0.945278 240 140 0 255 78\n//touch_addbutton \"_menu_text_button1\" \"# TEXT\" \"\" 0.32 0.888333 0.445 0.945278 240 140 0 255 73\n//touch_addbutton \"_menu_text_button2\" \"# TEXT\" \"\" 0.62 0.888333 0.745 0.945278 240 140 0 255 73\n//touch_addbutton \"_menu_text_button3\" \"# TEXT\" \"\" 0.835 0.888333 0.96 0.945278 240 140 0 255 73\ntouch_addbutton \"_menu_bg_text1\" \"# AK47\" \"\" 0.23 0.227778 0.32 0.284722 240 140 0 255 78\ntouch_addbutton \"_menu_bg_text2\" \"# M4A1\" \"\" 0.23 0.330278 0.32 0.387222 240 140 0 255 78\ntouch_addbutton \"_menu_bg_text3\" \"# AWP\" \"\" 0.23 0.432778 0.32 0.489722 240 140 0 255 78\ntouch_addbutton \"_menu_bg_text4\" \"# GALIL\" \"\" 0.23 0.535278 0.32 0.592222 240 140 0 255 78\ntouch_addbutton \"_menu_bg_text5\" \"# AUG\" \"\" 0.23 0.637778 0.32 0.694722 240 140 0 255 78\ntouch_addbutton \"_menu_bg_text6\" \"# FAMAS\" \"\" 0.23 0.751667 0.32 0.808611 240 140 0 255 78\ntouch_addbutton \"_menu_bg_text7\" \"# P90\" \"\" 0.415 0.227778 0.505 0.284722 240 140 0 255 78\ntouch_addbutton \"_menu_bg_text8\" \"# MP5\" \"\" 0.415 0.330278 0.505 0.387222 240 140 0 255 78\ntouch_addbutton \"_menu_bg_text9\" \"# MAC\" \"\" 0.415 0.432778 0.505 0.489722 240 140 0 255 78\ntouch_addbutton \"_menu_bg_text10\" \"# M3\" \"\" 0.415 0.535278 0.505 0.592222 240 140 0 255 78\ntouch_addbutton \"_menu_bg_text11\" \"# XM1014\" \"\" 0.415 0.637778 0.505 0.694722 240 140 0 255 78\ntouch_addbutton \"_menu_bg_text12\" \"# SCOUT\" \"\" 0.415 0.751667 0.505 0.808611 240 140 0 255 78\ntouch_addbutton \"_menu_bg_text13\" \"# UMP\" \"\" 0.6 0.227778 0.69 0.284722 240 140 0 255 78\ntouch_addbutton \"_menu_bg_text14\" \"# TMP\" \"\" 0.6 0.330278 0.69 0.387222 240 140 0 255 78\ntouch_addbutton \"_menu_bg_text15\" \"# SG550\" \"\" 0.6 0.432778 0.69 0.489722 240 140 0 255 78\ntouch_addbutton \"_menu_bg_text16\" \"# G3SG1\" \"\" 0.6 0.535278 0.69 0.592222 240 140 0 255 78\ntouch_addbutton \"_menu_bg_text17\" \"# M249\" \"\" 0.6 0.637778 0.69 0.694722 240 140 0 255 78\ntouch_addbutton \"_menu_bg_text18\" \"# SG552\" \"\" 0.6 0.751667 0.69 0.808611 240 140 0 255 78\ntouch_addbutton \"_menu_bg_text19\" \"# DEAGLE\" \"\" 0.785 0.227778 0.875 0.284722 240 140 0 255 78\ntouch_addbutton \"_menu_bg_text20\" \"# ELITES\" \"\" 0.785 0.330278 0.875 0.387222 240 140 0 255 78\ntouch_addbutton \"_menu_bg_text21\" \"# GLOCK18\" \"\" 0.785 0.432778 0.875 0.489722 240 140 0 255 78\ntouch_addbutton \"_menu_bg_text22\" \"# FIVESEVEN\" \"\" 0.785 0.535278 0.875 0.592222 240 140 0 255 78\ntouch_addbutton \"_menu_bg_text23\" \"# P228\" \"\" 0.785 0.637778 0.875 0.694722 240 140 0 255 78\ntouch_addbutton \"_menu_bg_text24\" \"# USP\" \"\" 0.785 0.751667 0.875 0.808611 240 140 0 255 78\n//touch_addbutton \"_menu_bg_text25\" \"# TEXT\" \"\" 0.05 0.330278 0.14 0.387222 240 140 0 255 78\n//touch_addbutton \"_menu_bg_text26\" \"# TEXT\" \"\" 0.05 0.432778 0.14 0.489722 240 140 0 255 78\n//touch_addbutton \"_menu_bg_text27\" \"# TEXT\" \"\" 0.05 0.535278 0.14 0.592222 240 140 0 255 78\n//touch_addbutton \"_menu_bg_text28\" \"# TEXT\" \"\" 0.05 0.637778 0.14 0.694722 240 140 0 255 78\n//touch_addbutton \"_menu_bg_text29\" \"# TEXT\" \"\" 0.05 0.751667 0.14 0.808611 240 140 0 255 78\n"
  },
  {
    "path": "3rdparty/cs16client-extras/touch/custom/my_menu-5-controls.cfg",
    "content": "//=======================================================================\n// TOUCH RADIO MENU\n// Copyright (c) 2016 Mikhail Stepanov aka ahsim\n//=======================================================================\ncmd_scripting 1\nset _menu_f1 $enable_controls\nset _menu_id my_menu-5-controls\n\ntouch_addbutton \"_menu_S1_$_menu_id\" \"*white\" \"\" 0.8 0.9 0.9 1 0 0 0 180 260\ntouch_addbutton \"_menu_on1_$_menu_id\" \"*white\" \"_click_cnd; enable_controls 1; exec $menu_root_path/$_menu_file_name; touch_setcolor _menu_on1_$_menu_id 156 77 20 180; touch_setcolor _menu_off1_$_menu_id 0 0 0 180\" 0.9 0.9 0.95 1 0 0 0 180 260\ntouch_addbutton \"_menu_off1_$_menu_id\" \"*white\" \"_click_cnd; enable_controls 0; exec $menu_root_path/$_menu_file_name; touch_setcolor _menu_on1_$_menu_id 0 0 0 180; touch_setcolor _menu_off1_$_menu_id 156 77 20 180\" 0.95 0.9 1 1 0 0 0 180 260\ntouch_addbutton \"_menu_t1_$_menu_id\" \"# $_menu_txt_controls\" \"\" 0.8 0.925 0.9 1 255 174 0 255 4\ntouch_addbutton \"_menu_t1on_$_menu_id\" \"#  $_menu_txt_on\" \"\" 0.9 0.925 0.95 1 255 174 0 255 4\ntouch_addbutton \"_menu_t1off_$_menu_id\" \"#  $_menu_txt_off\" \"\" 0.95 0.925 1 1 255 174 0 255 4\nif $_menu_f1 = 1\n:touch_setcolor \"_menu_on1_$_menu_id\" 156 77 20 180\nelse\n:touch_setcolor \"_menu_off1_$_menu_id\" 156 77 20 180\n"
  },
  {
    "path": "3rdparty/cs16client-extras/touch/custom/my_menu-language.cfg",
    "content": "cmd_scripting 1\nif $ui_language = english\t// English\n:set _menu_txt_on \"ON\"\n:set _menu_txt_off \"OFF\"\n:set _menu_txt_controls \"Enable; controls\"\n:set _menu_txt_exit \"Exit\"\nif $ui_language = russian\t// Russian\n:cl_charset \"utf-8\"\t\t// Fix utf-8 text problem\n:set _menu_txt_on \"Вкл\"\n:set _menu_txt_off \"Выкл\"\n:set _menu_txt_controls \"Включить; управление\"\n:set _menu_txt_exit \"Выход\"\n\necho \"^3Debug:^7UI Language ^1$ui_language^7 loaded\"\n"
  },
  {
    "path": "3rdparty/cs16client-extras/touch/customcmd.cfg",
    "content": "// \t\tFounder of customcmd guy named as 'ahsim' not mine, i just re-write and delete sh1t from code.\t\t//\n//\t\tby /w_sh1t - github.com/wh1tesh1t/\t\t//\n\n//\t\tSetup customcmd\ncmd_scripting 1\nif $touch_setclientonly = 1;:touch_setclientonly 0;:touch_setclientonly 1 // Fix. Disable and Enable touch_setclientonly when value=1\n\n//\tLanguage\nif $ui_language = english\t// English\n:set _menu_txt_on \"ON\"\n:set _menu_txt_off \"OFF\"\n:set _menu_txt_controls \"Enable; controls\"\n:set _menu_txt_exit \"Exit\"\nif $ui_language = russian\t// Russian\n:cl_charset \"utf-8\"\t\t// Fix utf-8 text problem\n:set _menu_txt_on \"Вкл\"\n:set _menu_txt_off \"Выкл\"\n:set _menu_txt_controls \"Включить; управление\"\n:set _menu_txt_exit \"Выход\"\n\n//\tCvars\nif \"$touch_move_indicator > 0\";:set touch_indicator_value \"$touch_move_indicator\";:set touch_move_indicator 0\nset _menu_stroke 1 156 77 20 200 ;touch_set_stroke $_menu_stroke\nset _menu_sel_bg \"156 77 20 180\"\nset _menu_bg \"0 0 0 180\"\nset _menu_text_color \"255 174 0 255\"\nset _menu_bg_texture \"*white\"\nset _menu_fade_enable 1\nset _menu_click_cnd media/launch_select1.wav\nset _menu_click_cnd_back media/launch_upmenu1.wav\nset _menu_vibrate_value 30\n//\tAlias commands\nalias _erase_frame \"touch_removebutton _menu_*; touch_setclientonly 0; set touch_move_indicator $touch_indicator_value; unalias _erase_frame\"\nalias _reset_menu \"touch_removebutton _menu_*; touch_setclientonly 0\"\nalias _click_cnd \"play $_menu_click_cnd ; vibrate $_menu_vibrate_value\"\nalias _click_cnd_back \"play $_menu_click_cnd_back ; vibrate $_menu_vibrate_value\"\nalias _closemenu_2 \"touch_removebutton _menu_*_my_menu-2-*; touch_removebutton _menu_*_my_menu-3-*; touch_removebutton _menu_*_my_menu-4-*; touch_removebutton _menu_*_my_menu-5-*;alias _closemenu_2 \\\"\\\"\"\nalias _closemenu_3 \"touch_removebutton _menu_*_my_menu-3-*; touch_removebutton _menu_*_my_menu-4-*; touch_removebutton _menu_*_my_menu-5-*; alias _closemenu_3 \\\"\\\"\"\nalias _closemenu_4 \"touch_removebutton _menu_*_my_menu-4-*; touch_removebutton _menu_*_my_menu-5-*; alias _closemenu_4 \\\"\\\"\"\nalias _closemenu_5 \"touch_removebutton _menu_*_my_menu-5-*; alias _closemenu_5 \\\"\\\"\"\n//\tMovement buttons\nif $menu_move_enable >= 1 // Enable/Disable _menu_move when value=1 or higher\n:touch_addbutton \"_menu_move\" \"\" \"_move\" 0 0.1 0.5 1 0 0 0 0 6\nif $menu_look_enable >= 1 // Enable/Disable _menu_look when value=1 or higher\n:touch_addbutton \"_menu_look\" \"\" \"_look\" 0.5 0 1 1 0 0 0 0 6\n//\tCoordinates and closemenu for each level\nif $_menu_level = 1\n:set _menu_x1 0 ;:set _menu_x2 0.2 ;:set _menu_xon1 0.1 ;:set _menu_xon2 0.15 ;:set _menu_xset 0.13 ;:set _menu_ix1 0.17\nif $_menu_level = 2\n:set _menu_x1 0.2 ;:set _menu_x2 0.4 ;:set _menu_xon1 0.3 ;:set _menu_xon2 0.35 ;:set _menu_xset 0.33 ;:set _menu_ix1 0.37\n:_closemenu_2\nif $_menu_level = 3\n:set _menu_x1 0.4 ;:set _menu_x2 0.6 ;:set _menu_xon1 0.5 ;:set _menu_xon2 0.55 ;:set _menu_xset 0.53 ;:set _menu_ix1 0.57\n:_closemenu_3\nif $_menu_level = 4\n:set _menu_x1 0.6 ;:set _menu_x2 0.8 ;:set _menu_xon1 0.7 ;:set _menu_xon2 0.75 ;:set _menu_xset 0.73 ;:set _menu_ix1 0.77\n:_closemenu_4\nif $_menu_level = 5\n:set _menu_x1 0.8 ;:set _menu_x2 1 ;:set _menu_xon1 0.9 ;:set _menu_xon2 0.95 ;:set _menu_xset 0.93 ;:set _menu_ix1 0.97\n:_closemenu_5\n//\tRefresh button\ntouch_addbutton \"_menu_refresh\" \"$_menu_bg_texture\" \"_click_cnd; touch_show _menu*; touch_hide _menu_refresh*; exec $menu_root_path/$_menu_id\" 0 0 1 1 $_menu_bg 5\n//\t\tBuilding buttons\nif $_menu_min <= 1;:if $_menu_max >= 1;::if $_menu_type_1 = 1\n:::touch_addbutton \"_menu_S1_$_menu_id\" \"$_menu_bg_texture\" \"_click_cnd; touch_setcolor _menu_S*_$_menu_id $_menu_bg; touch_setcolor _menu_S1_$_menu_id $_menu_sel_bg;$_menu_cmd_1\" $_menu_x1 0 $_menu_x2 0.1 $_menu_bg 260\n:::touch_addbutton \"_menu_t1_$_menu_id\" \"# $_menu_txt_1\" \"\" $_menu_x1 0.025 $_menu_x2 0.1 $_menu_text_color 4\n:::touch_addbutton \"_menu_i1_$_menu_id\" \"$_menu_icn_1\" \"\" $_menu_ix1 0.025 $_menu_x2 0.065 $_menu_text_color 4\n::if $_menu_type_1 = 2\n:::touch_addbutton \"_menu_S1_$_menu_id\" \"$_menu_bg_texture\" \"\" $_menu_x1 0 $_menu_xon1 0.1 $_menu_bg 260\n:::touch_addbutton \"_menu_on1_$_menu_id\" \"$_menu_bg_texture\" \"_click_cnd; $_menu_cmd_1 1; touch_setcolor _menu_on1_$_menu_id $_menu_sel_bg; touch_setcolor _menu_off1_$_menu_id $_menu_bg\" $_menu_xon1 0 $_menu_xon2 0.1 $_menu_bg 260\n:::touch_addbutton \"_menu_off1_$_menu_id\" \"$_menu_bg_texture\" \"_click_cnd; $_menu_cmd_1 0; touch_setcolor _menu_on1_$_menu_id $_menu_bg; touch_setcolor _menu_off1_$_menu_id $_menu_sel_bg\" $_menu_xon2 0 $_menu_x2 0.1 $_menu_bg 260\n:::touch_addbutton \"_menu_t1_$_menu_id\" \"# $_menu_txt_1\" \"\" $_menu_x1 0.025 $_menu_xon1 0.1 $_menu_text_color 4\n:::touch_addbutton \"_menu_t1on_$_menu_id\" \"#  $_menu_txt_on\" \"\" $_menu_xon1 0.025 $_menu_xon2 0.1 $_menu_text_color 4\n:::touch_addbutton \"_menu_t1off_$_menu_id\" \"#  $_menu_txt_off\" \"\" $_menu_xon2 0.025 $_menu_x2 0.1 $_menu_text_color 4\n:::if $_menu_f1 = 1\n::::touch_setcolor \"_menu_on1_$_menu_id\" $_menu_sel_bg\n:::else\n::::touch_setcolor \"_menu_off1_$_menu_id\" $_menu_sel_bg\n::if $_menu_type_1 = 3\n:::touch_addbutton \"_menu_S1_$_menu_id\" \"$_menu_bg_texture\" \"_click_cnd;messagemode $_menu_cmd_1; touch_hide _menu*; touch_show _menu_refresh\" $_menu_x1 0 $_menu_x2 0.1 $_menu_bg 260\n:::touch_addbutton \"_menu_C1_$_menu_id\" \"$_menu_bg_texture\" \"\" $_menu_xset 0 $_menu_x2 0.1 0 0 0 0 260\n:::touch_addbutton \"_menu_t1_$_menu_id\" \"# $_menu_txt_1\" \"\" $_menu_x1 0.025 $_menu_xset 0.1 $_menu_text_color 4\n:::touch_addbutton \"_menu_U1_$_menu_id\" \"# $_menu_f1\" \"\" $_menu_xset 0.025 $_menu_x2 0.1 $_menu_text_color 4\n::if $_menu_type_1 = 4\n:::touch_addbutton \"_menu_i1_$_menu_id\" \"$_menu_icn_1\" \"_click_cnd;$_menu_cmd_1\" $_menu_x1 0 $_menu_x2 0.3 255 255 255 180 260\n:::touch_addbutton \"_menu_t1_$_menu_id\" \"# $_menu_txt_1\" \"\" $_menu_x1 0 $_menu_x2 0.1 $_menu_text_color 4\n:::_menu_icn_1 \"\"\n::if $_menu_type_1 = 5\n:::touch_addbutton \"_menu_t1_$_menu_id\" \"# $_menu_txt_1\" \"\" $_menu_x1 0.025 $_menu_x2 0.1 $_menu_text_color 4\n\nif $_menu_min <= 2;:if $_menu_max >= 2;::if $_menu_type_2 = 1\n:::touch_addbutton \"_menu_S2_$_menu_id\" \"$_menu_bg_texture\" \"_click_cnd; touch_setcolor _menu_S*_$_menu_id $_menu_bg; touch_setcolor _menu_S2_$_menu_id $_menu_sel_bg;$_menu_cmd_2\" $_menu_x1 0.1 $_menu_x2 0.2 $_menu_bg 260\n:::touch_addbutton \"_menu_t2_$_menu_id\" \"# $_menu_txt_2\" \"\" $_menu_x1 0.125 $_menu_x2 0.2 $_menu_text_color 4\n:::touch_addbutton \"_menu_i2_$_menu_id\" \"$_menu_icn_2\" \"\" $_menu_ix1 0.125 $_menu_x2 0.165 $_menu_text_color 4\n::if $_menu_type_2 = 2\n:::touch_addbutton \"_menu_S2_$_menu_id\" \"$_menu_bg_texture\" \"\" $_menu_x1 0.1 $_menu_xon1 0.2 $_menu_bg 260\n:::touch_addbutton \"_menu_on2_$_menu_id\" \"$_menu_bg_texture\" \"_click_cnd; $_menu_cmd_2 1; touch_setcolor _menu_on2_$_menu_id $_menu_sel_bg; touch_setcolor _menu_off2_$_menu_id $_menu_bg\" $_menu_xon1 0.1 $_menu_xon2 0.2 $_menu_bg 260\n:::touch_addbutton \"_menu_off2_$_menu_id\" \"$_menu_bg_texture\" \"_click_cnd; $_menu_cmd_2 0; touch_setcolor _menu_on2_$_menu_id $_menu_bg; touch_setcolor _menu_off2_$_menu_id $_menu_sel_bg\" $_menu_xon2 0.1 $_menu_x2 0.2 $_menu_bg 260\n:::touch_addbutton \"_menu_t2_$_menu_id\" \"# $_menu_txt_2\" \"\" $_menu_x1 0.125 $_menu_xon1 0.2 $_menu_text_color 4\n:::touch_addbutton \"_menu_t2on_$_menu_id\" \"#  $_menu_txt_on\" \"\" $_menu_xon1 0.125 $_menu_xon2 0.2 $_menu_text_color 4\n:::touch_addbutton \"_menu_t2off_$_menu_id\" \"#  $_menu_txt_off\" \"\" $_menu_xon2 0.125 $_menu_x2 0.2 $_menu_text_color 4\n:::if $_menu_f2 = 1\n::::touch_setcolor \"_menu_on2_$_menu_id\" $_menu_sel_bg\n:::else\n::::touch_setcolor \"_menu_off2_$_menu_id\" $_menu_sel_bg\n::if $_menu_type_2 = 3\n:::touch_addbutton \"_menu_S2_$_menu_id\" \"$_menu_bg_texture\" \"_click_cnd;messagemode $_menu_cmd_2; touch_hide _menu*; touch_show _menu_refresh\" $_menu_x1 0.1 $_menu_x2 0.2 $_menu_bg 260\n:::touch_addbutton \"_menu_C2_$_menu_id\" \"$_menu_bg_texture\" \"\" $_menu_xset 0.1 $_menu_x2 0.2 0 0 0 0 260\n:::touch_addbutton \"_menu_t2_$_menu_id\" \"# $_menu_txt_2\" \"\" $_menu_x1 0.125 $_menu_xset 0.2 $_menu_text_color 4\n:::touch_addbutton \"_menu_U2_$_menu_id\" \"# $_menu_f2\" \"\" $_menu_xset 0.125 $_menu_x2 0.2 $_menu_text_color 4\n::if $_menu_type_2 = 4\n:::touch_addbutton \"_menu_i2_$_menu_id\" \"$_menu_icn_2\" \"_click_cnd;$_menu_cmd_2\" $_menu_x1 0.1 $_menu_x2 0.4 255 255 255 180 260\n:::touch_addbutton \"_menu_t2_$_menu_id\" \"# $_menu_txt_2\" \"\" $_menu_x1 0.1 $_menu_x2 0.2 $_menu_text_color 4\n:::_menu_icn_2 \"\"\n::if $_menu_type_2 = 5\n:::touch_addbutton \"_menu_t2_$_menu_id\" \"# $_menu_txt_2\" \"\" $_menu_x1 0.125 $_menu_x2 0.2 $_menu_text_color 4\n\nif $_menu_min <= 3;:if $_menu_max >= 3;::if $_menu_type_3 = 1\n:::touch_addbutton \"_menu_S3_$_menu_id\" \"$_menu_bg_texture\" \"_click_cnd; touch_setcolor _menu_S*_$_menu_id $_menu_bg; touch_setcolor _menu_S3_$_menu_id $_menu_sel_bg;$_menu_cmd_3\" $_menu_x1 0.2 $_menu_x2 0.3 $_menu_bg 260\n:::touch_addbutton \"_menu_t3_$_menu_id\" \"# $_menu_txt_3\" \"\" $_menu_x1 0.225 $_menu_x2 0.3 $_menu_text_color 4\n:::touch_addbutton \"_menu_i3_$_menu_id\" \"$_menu_icn_3\" \"\" $_menu_ix1 0.225 $_menu_x2 0.265 $_menu_text_color 4\n::if $_menu_type_3 = 2\n:::touch_addbutton \"_menu_S3_$_menu_id\" \"$_menu_bg_texture\" \"\" $_menu_x1 0.2 $_menu_xon1 0.3 $_menu_bg 260\n:::touch_addbutton \"_menu_on3_$_menu_id\" \"$_menu_bg_texture\" \"_click_cnd; $_menu_cmd_3 1; touch_setcolor _menu_on3_$_menu_id $_menu_sel_bg; touch_setcolor _menu_off3_$_menu_id $_menu_bg\" $_menu_xon1 0.2 $_menu_xon2 0.3 $_menu_bg 260\n:::touch_addbutton \"_menu_off3_$_menu_id\" \"$_menu_bg_texture\" \"_click_cnd; $_menu_cmd_3 0; touch_setcolor _menu_on3_$_menu_id $_menu_bg; touch_setcolor _menu_off3_$_menu_id $_menu_sel_bg\" $_menu_xon2 0.2 $_menu_x2 0.3 $_menu_bg 260\n:::touch_addbutton \"_menu_t3_$_menu_id\" \"# $_menu_txt_3\" \"\" $_menu_x1 0.225 $_menu_xon1 0.3 $_menu_text_color 4\n:::touch_addbutton \"_menu_t3on_$_menu_id\" \"#  $_menu_txt_on\" \"\" $_menu_xon1 0.225 $_menu_xon2 0.3 $_menu_text_color 4\n:::touch_addbutton \"_menu_t3off_$_menu_id\" \"#  $_menu_txt_off\" \"\" $_menu_xon2 0.225 $_menu_x2 0.3 $_menu_text_color 4\n:::if $_menu_f3 = 1\n::::touch_setcolor \"_menu_on3_$_menu_id\" $_menu_sel_bg\n:::else\n::::touch_setcolor \"_menu_off3_$_menu_id\" $_menu_sel_bg\n::if $_menu_type_3 = 3\n:::touch_addbutton \"_menu_S3_$_menu_id\" \"$_menu_bg_texture\" \"_click_cnd;messagemode $_menu_cmd_3; touch_hide _menu*; touch_show _menu_refresh\" $_menu_x1 0.2 $_menu_x2 0.3 $_menu_bg 260\n:::touch_addbutton \"_menu_C3_$_menu_id\" \"$_menu_bg_texture\" \"\" $_menu_xset 0.2 $_menu_x2 0.3 0 0 0 0 260\n:::touch_addbutton \"_menu_t3_$_menu_id\" \"# $_menu_txt_3\" \"\" $_menu_x1 0.225 $_menu_xset 0.3 $_menu_text_color 4\n:::touch_addbutton \"_menu_U3_$_menu_id\" \"# $_menu_f3\" \"\" $_menu_xset 0.225 $_menu_x2 0.3 $_menu_text_color 4\n::if $_menu_type_3 = 4\n:::touch_addbutton \"_menu_i3_$_menu_id\" \"$_menu_icn_3\" \"_click_cnd;$_menu_cmd_3\" $_menu_x1 0.2 $_menu_x2 0.5 255 255 255 180 260\n:::touch_addbutton \"_menu_t3_$_menu_id\" \"# $_menu_txt_3\" \"\" $_menu_x1 0.2 $_menu_x2 0.3 $_menu_text_color 4\n:::_menu_icn_3 \"\"\n::if $_menu_type_3 = 5\n:::touch_addbutton \"_menu_t3_$_menu_id\" \"# $_menu_txt_3\" \"\" $_menu_x1 0.225 $_menu_x2 0.3 $_menu_text_color 4\n\nif $_menu_min <= 4;:if $_menu_max >= 4;::if $_menu_type_4 = 1\n:::touch_addbutton \"_menu_S4_$_menu_id\" \"$_menu_bg_texture\" \"_click_cnd; touch_setcolor _menu_S*_$_menu_id $_menu_bg; touch_setcolor _menu_S4_$_menu_id $_menu_sel_bg;$_menu_cmd_4\" $_menu_x1 0.3 $_menu_x2 0.4 $_menu_bg 260\n:::touch_addbutton \"_menu_t4_$_menu_id\" \"# $_menu_txt_4\" \"\" $_menu_x1 0.325 $_menu_x2 0.4 $_menu_text_color 4\n:::touch_addbutton \"_menu_i4_$_menu_id\" \"$_menu_icn_4\" \"\" $_menu_ix1 0.325 $_menu_x2 0.365 $_menu_text_color 4\n::if $_menu_type_4 = 2\n:::touch_addbutton \"_menu_S4_$_menu_id\" \"$_menu_bg_texture\" \"\" $_menu_x1 0.3 $_menu_xon1 0.4 $_menu_bg 260\n:::touch_addbutton \"_menu_on4_$_menu_id\" \"$_menu_bg_texture\" \"_click_cnd; $_menu_cmd_4 1; touch_setcolor _menu_on4_$_menu_id $_menu_sel_bg; touch_setcolor _menu_off4_$_menu_id $_menu_bg\" $_menu_xon1 0.3 $_menu_xon2 0.4 $_menu_bg 260\n:::touch_addbutton \"_menu_off4_$_menu_id\" \"$_menu_bg_texture\" \"_click_cnd; $_menu_cmd_4 0; touch_setcolor _menu_on4_$_menu_id $_menu_bg; touch_setcolor _menu_off4_$_menu_id $_menu_sel_bg\" $_menu_xon2 0.3 $_menu_x2 0.4 $_menu_bg 260\n:::touch_addbutton \"_menu_t4_$_menu_id\" \"# $_menu_txt_4\" \"\" $_menu_x1 0.325 $_menu_xon2 0.4 $_menu_text_color 4\n:::touch_addbutton \"_menu_t4on_$_menu_id\" \"#  $_menu_txt_on\" \"\" $_menu_xon1 0.325 $_menu_xon2 0.4 $_menu_text_color 4\n:::touch_addbutton \"_menu_t4off_$_menu_id\" \"#  $_menu_txt_off\" \"\" $_menu_xon2 0.325 $_menu_x2 0.4 $_menu_text_color 4\n:::if $_menu_f4 = 1\n::::touch_setcolor \"_menu_on4_$_menu_id\" $_menu_sel_bg\n:::else\n::::touch_setcolor \"_menu_off4_$_menu_id\" $_menu_sel_bg\n::if $_menu_type_4 = 3\n:::touch_addbutton \"_menu_S4_$_menu_id\" \"$_menu_bg_texture\" \"_click_cnd;messagemode $_menu_cmd_4; touch_hide _menu*; touch_show _menu_refresh\" $_menu_x1 0.3 $_menu_x2 0.4 $_menu_bg 260\n:::touch_addbutton \"_menu_C4_$_menu_id\" \"$_menu_bg_texture\" \"\" $_menu_xset 0.3 $_menu_x2 0.4 0 0 0 0 260\n:::touch_addbutton \"_menu_t4_$_menu_id\" \"# $_menu_txt_4\" \"\" $_menu_x1 0.325 $_menu_xset 0.4 $_menu_text_color 4\n:::touch_addbutton \"_menu_U4_$_menu_id\" \"# $_menu_f4\" \"\" $_menu_xset 0.325 $_menu_x2 0.4 $_menu_text_color 4\n::if $_menu_type_4 = 4\n:::touch_addbutton \"_menu_i4_$_menu_id\" \"$_menu_icn_4\" \"_click_cnd;$_menu_cmd_4\" $_menu_x1 0.3 $_menu_x2 0.6 255 255 255 180 260\n:::touch_addbutton \"_menu_t4_$_menu_id\" \"# $_menu_txt_4\" \"\" $_menu_x1 0.3 $_menu_x2 0.4 $_menu_text_color 4\n:::_menu_icn_4 \"\"\n::if $_menu_type_4 = 5\n:::touch_addbutton \"_menu_t4_$_menu_id\" \"# $_menu_txt_4\" \"\" $_menu_x1 0.325 $_menu_x2 0.4 $_menu_text_color 4\n\nif $_menu_min <= 5;:if $_menu_max >= 5;::if $_menu_type_5 = 1\n:::touch_addbutton \"_menu_S5_$_menu_id\" \"$_menu_bg_texture\" \"_click_cnd; touch_setcolor _menu_S*_$_menu_id $_menu_bg; touch_setcolor _menu_S5_$_menu_id $_menu_sel_bg;$_menu_cmd_5\" $_menu_x1 0.4 $_menu_x2 0.5 $_menu_bg 260\n:::touch_addbutton \"_menu_t5_$_menu_id\" \"# $_menu_txt_5\" \"\" $_menu_x1 0.425 $_menu_x2 0.5 $_menu_text_color 4\n:::touch_addbutton \"_menu_i5_$_menu_id\" \"$_menu_icn_5\" \"\" $_menu_ix1 0.425 $_menu_x2 0.465 $_menu_text_color 4\n::if $_menu_type_5 = 2\n:::touch_addbutton \"_menu_S5_$_menu_id\" \"$_menu_bg_texture\" \"\" $_menu_x1 0.4 $_menu_xon1 0.5 $_menu_bg 260\n:::touch_addbutton \"_menu_on5_$_menu_id\" \"$_menu_bg_texture\" \"_click_cnd; $_menu_cmd_5 1; touch_setcolor _menu_on5_$_menu_id $_menu_sel_bg; touch_setcolor _menu_off5_$_menu_id $_menu_bg\" $_menu_xon1 0.4 $_menu_xon2 0.5 $_menu_bg 260\n:::touch_addbutton \"_menu_off5_$_menu_id\" \"$_menu_bg_texture\" \"_click_cnd; $_menu_cmd_5 0; touch_setcolor _menu_on5_$_menu_id $_menu_bg; touch_setcolor _menu_off5_$_menu_id $_menu_sel_bg\" $_menu_xon2 0.4 $_menu_x2 0.5 $_menu_bg 260\n:::touch_addbutton \"_menu_t5_$_menu_id\" \"# $_menu_txt_5\" \"\" $_menu_x1 0.425 $_menu_xon2 0.5 $_menu_text_color 4\n:::touch_addbutton \"_menu_t5on_$_menu_id\" \"#  $_menu_txt_on\" \"\" $_menu_xon1 0.425 $_menu_xon2 0.5 $_menu_text_color 4\n:::touch_addbutton \"_menu_t5off_$_menu_id\" \"#  $_menu_txt_off\" \"\" $_menu_xon2 0.425 $_menu_x2 0.5 $_menu_text_color 4\n:::if $_menu_f5 = 1\n::::touch_setcolor \"_menu_on5_$_menu_id\" $_menu_sel_bg\n:::else\n::::touch_setcolor \"_menu_off5_$_menu_id\" $_menu_sel_bg\n::if $_menu_type_5 = 3\n:::touch_addbutton \"_menu_S5_$_menu_id\" \"$_menu_bg_texture\" \"_click_cnd;messagemode $_menu_cmd_5; touch_hide _menu*; touch_show _menu_refresh\" $_menu_x1 0.4 $_menu_x2 0.5 $_menu_bg 260\n:::touch_addbutton \"_menu_C5_$_menu_id\" \"$_menu_bg_texture\" \"\" $_menu_xset 0.4 $_menu_x2 0.5 0 0 0 0 260\n:::touch_addbutton \"_menu_t5_$_menu_id\" \"# $_menu_txt_5\" \"\" $_menu_x1 0.425 $_menu_xset 0.5 $_menu_text_color 4\n:::touch_addbutton \"_menu_U5_$_menu_id\" \"# $_menu_f5\" \"\" $_menu_xset 0.425 $_menu_x2 0.5 $_menu_text_color 4\n::if $_menu_type_5 = 4\n:::touch_addbutton \"_menu_i5_$_menu_id\" \"$_menu_icn_5\" \"_click_cnd;$_menu_cmd_1\" $_menu_x1 0.4 $_menu_x2 0.7 255 255 255 180 260\n:::touch_addbutton \"_menu_t5_$_menu_id\" \"# $_menu_txt_5\" \"\" $_menu_x1 0.4 $_menu_x2 0.5 $_menu_text_color 4\n:::_menu_icn_5 \"\"\n::if $_menu_type_5 = 5\n:::touch_addbutton \"_menu_t5_$_menu_id\" \"# $_menu_txt_5\" \"\" $_menu_x1 0.425 $_menu_x2 0.5 $_menu_text_color 4\n\nif $_menu_min <= 6;:if $_menu_max >= 6;::if $_menu_type_6 = 1\n:::touch_addbutton \"_menu_S6_$_menu_id\" \"*white\" \"_click_cnd; touch_setcolor _menu_S*_$_menu_id $_menu_bg; touch_setcolor _menu_S6_$_menu_id $_menu_sel_bg;$_menu_cmd_6\" $_menu_x1 0.5 $_menu_x2 0.6 $_menu_bg 260\n:::touch_addbutton \"_menu_t6_$_menu_id\" \"# $_menu_txt_6\" \"\" $_menu_x1 0.525 $_menu_x2 0.6 $_menu_text_color 4\n:::touch_addbutton \"_menu_i6_$_menu_id\" \"$_menu_icn_6\" \"\" $_menu_ix1 0.525 $_menu_x2 0.565 $_menu_text_color 4\n::if $_menu_type_6 = 2\n:::touch_addbutton \"_menu_S6_$_menu_id\" \"*white\" \"\" $_menu_x1 0.5 $_menu_xon1 0.6 $_menu_bg 260\n:::touch_addbutton \"_menu_on6_$_menu_id\" \"*white\" \"_click_cnd; $_menu_cmd_6 1; touch_setcolor _menu_on6_$_menu_id $_menu_sel_bg; touch_setcolor _menu_off6_$_menu_id $_menu_bg\" $_menu_xon1 0.5 $_menu_xon2 0.6 $_menu_bg 260\n:::touch_addbutton \"_menu_off6_$_menu_id\" \"*white\" \"_click_cnd; $_menu_cmd_6 0; touch_setcolor _menu_on6_$_menu_id $_menu_bg; touch_setcolor _menu_off6_$_menu_id $_menu_sel_bg\" $_menu_xon2 0.5 $_menu_x2 0.6 $_menu_bg 260\n:::touch_addbutton \"_menu_t6_$_menu_id\" \"# $_menu_txt_6\" \"\" $_menu_x1 0.525 $_menu_xon2 0.6 $_menu_text_color 4\n:::touch_addbutton \"_menu_t6on_$_menu_id\" \"#  $_menu_txt_on\" \"\" $_menu_xon1 0.525 $_menu_xon2 0.6 $_menu_text_color 4\n:::touch_addbutton \"_menu_t6off_$_menu_id\" \"#  $_menu_txt_off\" \"\" $_menu_xon2 0.525 $_menu_x2 0.6 $_menu_text_color 4\n:::if $_menu_f6 = 1\n::::touch_setcolor \"_menu_on6_$_menu_id\" $_menu_sel_bg\n:::else\n::::touch_setcolor \"_menu_off6_$_menu_id\" $_menu_sel_bg\n::if $_menu_type_6 = 3\n:::touch_addbutton \"_menu_S6_$_menu_id\" \"*white\" \"_click_cnd;messagemode $_menu_cmd_6; touch_hide _menu*; touch_show _menu_refresh\" $_menu_x1 0.5 $_menu_x2 0.6 $_menu_bg 260\n:::touch_addbutton \"_menu_C6_$_menu_id\" \"*white\" \"\" $_menu_xset 0.5 $_menu_x2 0.6 0 0 0 0 260\n:::touch_addbutton \"_menu_t6_$_menu_id\" \"# $_menu_txt_6\" \"\" $_menu_x1 0.525 $_menu_xset 0.6 $_menu_text_color 4\n:::touch_addbutton \"_menu_U6_$_menu_id\" \"# $_menu_f6\" \"\" $_menu_xset 0.525 $_menu_x2 0.6 $_menu_text_color 4\n::if $_menu_type_6 = 4\n:::touch_addbutton \"_menu_i6_$_menu_id\" \"$_menu_icn_6\" \"_click_cnd;$_menu_cmd_6\" $_menu_x1 0.5 $_menu_x2 0.8 255 255 255 180 260\n:::touch_addbutton \"_menu_t6_$_menu_id\" \"# $_menu_txt_6\" \"\" $_menu_x1 0.5 $_menu_x2 0.6 $_menu_text_color 4\n:::_menu_icn_6 \"\"\n::if $_menu_type_6 = 5\n:::touch_addbutton \"_menu_t6_$_menu_id\" \"# $_menu_txt_6\" \"\" $_menu_x1 0.525 $_menu_x2 0.6 $_menu_text_color 4\n\nif $_menu_min <= 7;:if $_menu_max >= 7;::if $_menu_type_7 = 1\n:::touch_addbutton \"_menu_S7_$_menu_id\" \"*white\" \"_click_cnd; touch_setcolor _menu_S*_$_menu_id $_menu_bg; touch_setcolor _menu_S7_$_menu_id $_menu_sel_bg;$_menu_cmd_7\" $_menu_x1 0.6 $_menu_x2 0.7 $_menu_bg 260\n:::touch_addbutton \"_menu_t7_$_menu_id\" \"# $_menu_txt_7\" \"\" $_menu_x1 0.625 $_menu_x2 0.7 $_menu_text_color 4\n:::touch_addbutton \"_menu_i7_$_menu_id\" \"$_menu_icn_7\" \"\" $_menu_ix1 0.625 $_menu_x2 0.665 $_menu_text_color 4\n::if $_menu_type_7 = 2\n:::touch_addbutton \"_menu_S7_$_menu_id\" \"*white\" \"\" $_menu_x1 0.6 $_menu_xon1 0.7 $_menu_bg 260\n:::touch_addbutton \"_menu_on7_$_menu_id\" \"*white\" \"_click_cnd; $_menu_cmd_7 1; touch_setcolor _menu_on7_$_menu_id $_menu_sel_bg; touch_setcolor _menu_off7_$_menu_id $_menu_bg\" $_menu_xon1 0.6 $_menu_xon2 0.7 $_menu_bg 260\n:::touch_addbutton \"_menu_off7_$_menu_id\" \"*white\" \"_click_cnd; $_menu_cmd_7 0; touch_setcolor _menu_on7_$_menu_id $_menu_bg; touch_setcolor _menu_off7_$_menu_id $_menu_sel_bg\" $_menu_xon2 0.6 $_menu_x2 0.7 $_menu_bg 260\n:::touch_addbutton \"_menu_t7_$_menu_id\" \"# $_menu_txt_7\" \"\" $_menu_x1 0.625 $_menu_xon2 0.7 $_menu_text_color 4\n:::touch_addbutton \"_menu_t7on_$_menu_id\" \"#  $_menu_txt_on\" \"\" $_menu_xon1 0.625 $_menu_xon2 0.7 $_menu_text_color 4\n:::touch_addbutton \"_menu_t7off_$_menu_id\" \"#  $_menu_txt_off\" \"\" $_menu_xon2 0.625 $_menu_x2 0.7 $_menu_text_color 4\n:::if $_menu_f7 = 1\n::::touch_setcolor \"_menu_on7_$_menu_id\" $_menu_sel_bg\n:::else\n::::touch_setcolor \"_menu_off7_$_menu_id\" $_menu_sel_bg\n::if $_menu_type_7 = 3\n:::touch_addbutton \"_menu_S7_$_menu_id\" \"*white\" \"_click_cnd;messagemode $_menu_cmd_7; touch_hide _menu*; touch_show _menu_refresh\" $_menu_x1 0.6 $_menu_x2 0.7 $_menu_bg 260\n:::touch_addbutton \"_menu_C7_$_menu_id\" \"*white\" \"\" $_menu_xset 0.6 $_menu_x2 0.7 0 0 0 0 260\n:::touch_addbutton \"_menu_t7_$_menu_id\" \"# $_menu_txt_7\" \"\" $_menu_x1 0.625 $_menu_xset 0.7 $_menu_text_color 4\n:::touch_addbutton \"_menu_U7_$_menu_id\" \"# $_menu_f7\" \"\" $_menu_xset 0.625 $_menu_x2 0.7 $_menu_text_color 4\n::if $_menu_type_7 = 4\n:::touch_addbutton \"_menu_i7_$_menu_id\" \"$_menu_icn_7\" \"_click_cnd;$_menu_cmd_7\" $_menu_x1 0.6 $_menu_x2 0.9 255 255 255 180 260\n:::touch_addbutton \"_menu_t7_$_menu_id\" \"# $_menu_txt_7\" \"\" $_menu_x1 0.6 $_menu_x2 0.7 $_menu_text_color 4\n:::_menu_icn_7 \"\"\n::if $_menu_type_7 = 5\n:::touch_addbutton \"_menu_t7_$_menu_id\" \"# $_menu_txt_7\" \"\" $_menu_x1 0.625 $_menu_x2 0.7 $_menu_text_color 4\n\nif $_menu_min <= 8;:if $_menu_max >= 8;::if $_menu_type_8 = 1\n:::touch_addbutton \"_menu_S8_$_menu_id\" \"*white\" \"_click_cnd; touch_setcolor _menu_S*_$_menu_id $_menu_bg; touch_setcolor _menu_S8_$_menu_id $_menu_sel_bg;$_menu_cmd_8\" $_menu_x1 0.7 $_menu_x2 0.8 $_menu_bg 260\n:::touch_addbutton \"_menu_t8_$_menu_id\" \"# $_menu_txt_8\" \"\" $_menu_x1 0.725 $_menu_x2 0.8 $_menu_text_color 4\n:::touch_addbutton \"_menu_i8_$_menu_id\" \"$_menu_icn_8\" \"\" $_menu_ix1 0.725 $_menu_x2 0.765 $_menu_text_color 4\n::if $_menu_type_8 = 2\n:::touch_addbutton \"_menu_S8_$_menu_id\" \"*white\" \"\" $_menu_x1 0.7 $_menu_xon1 0.8 $_menu_bg 260\n:::touch_addbutton \"_menu_on8_$_menu_id\" \"*white\" \"_click_cnd; $_menu_cmd_8 1; touch_setcolor _menu_on8_$_menu_id $_menu_sel_bg; touch_setcolor _menu_off8_$_menu_id $_menu_bg\" $_menu_xon1 0.7 $_menu_xon2 0.8 $_menu_bg 260\n:::touch_addbutton \"_menu_off8_$_menu_id\" \"*white\" \"_click_cnd; $_menu_cmd_8 0; touch_setcolor _menu_on8_$_menu_id $_menu_bg; touch_setcolor _menu_off8_$_menu_id $_menu_sel_bg\" $_menu_xon2 0.7 $_menu_x2 0.8 $_menu_bg 260\n:::touch_addbutton \"_menu_t8_$_menu_id\" \"# $_menu_txt_8\" \"\" $_menu_x1 0.725 $_menu_xon2 0.8 $_menu_text_color 4\n:::touch_addbutton \"_menu_t8on_$_menu_id\" \"#  $_menu_txt_on\" \"\" $_menu_xon1 0.725 $_menu_xon2 0.8 $_menu_text_color 4\n:::touch_addbutton \"_menu_t8off_$_menu_id\" \"#  $_menu_txt_off\" \"\" $_menu_xon2 0.725 $_menu_x2 0.8 $_menu_text_color 4\n:::if $_menu_f8 = 1\n::::touch_setcolor \"_menu_on8_$_menu_id\" $_menu_sel_bg\n:::else\n::::touch_setcolor \"_menu_off8_$_menu_id\" $_menu_sel_bg\n::if $_menu_type_8 = 3\n:::touch_addbutton \"_menu_S8_$_menu_id\" \"*white\" \"_click_cnd;messagemode $_menu_cmd_8; touch_hide _menu*; touch_show _menu_refresh\" $_menu_x1 0.7 $_menu_x2 0.8 $_menu_bg 260\n:::touch_addbutton \"_menu_C8_$_menu_id\" \"*white\" \"\" $_menu_xset 0.7 $_menu_x2 0.8 0 0 0 0 260\n:::touch_addbutton \"_menu_t8_$_menu_id\" \"# $_menu_txt_8\" \"\" $_menu_x1 0.725 $_menu_xset 0.8 $_menu_text_color 4\n:::touch_addbutton \"_menu_U8_$_menu_id\" \"# $_menu_f8\" \"\" $_menu_xset 0.725 $_menu_x2 0.8 $_menu_text_color 4\n::if $_menu_type_8 = 4\n:::touch_addbutton \"_menu_i8_$_menu_id\" \"$_menu_icn_8\" \"_click_cnd;$_menu_cmd_8\" $_menu_x1 0.7 $_menu_x2 1 255 255 255 180 260\n:::touch_addbutton \"_menu_t8_$_menu_id\" \"# $_menu_txt_8\" \"\" $_menu_x1 0.7 $_menu_x2 0.8 $_menu_text_color 4\n:::_menu_icn_8 \"\"\n::if $_menu_type_8 = 5\n:::touch_addbutton \"_menu_t8_$_menu_id\" \"# $_menu_txt_8\" \"\" $_menu_x1 0.725 $_menu_x2 0.8 $_menu_text_color 4\n\nif $_menu_min <= 9;:if $_menu_max >= 9;::if $_menu_type_9 = 1\n:::touch_addbutton \"_menu_S9_$_menu_id\" \"*white\" \"_click_cnd; touch_setcolor _menu_S*_$_menu_id $_menu_bg; touch_setcolor _menu_S9_$_menu_id $_menu_sel_bg;$_menu_cmd_9\" $_menu_x1 0.8 $_menu_x2 0.9 $_menu_bg 260\n:::touch_addbutton \"_menu_t9_$_menu_id\" \"# $_menu_txt_9\" \"\" $_menu_x1 0.825 $_menu_x2 0.9 $_menu_text_color 4\n:::touch_addbutton \"_menu_i9_$_menu_id\" \"$_menu_icn_9\" \"\" $_menu_ix1 0.825 $_menu_x2 0.865 $_menu_text_color 4\n::if $_menu_type_9 = 2\n:::touch_addbutton \"_menu_S9_$_menu_id\" \"*white\" \"\" $_menu_x1 0.8 $_menu_xon1 0.9 $_menu_bg 260\n:::touch_addbutton \"_menu_on9_$_menu_id\" \"*white\" \"_click_cnd; $_menu_cmd_9 1; touch_setcolor _menu_on9_$_menu_id $_menu_sel_bg; touch_setcolor _menu_off9_$_menu_id $_menu_bg\" $_menu_xon1 0.8 $_menu_xon2 0.9 $_menu_bg 260\n:::touch_addbutton \"_menu_off9_$_menu_id\" \"*white\" \"_click_cnd; $_menu_cmd_9 0; touch_setcolor _menu_on9_$_menu_id $_menu_bg; touch_setcolor _menu_off9_$_menu_id $_menu_sel_bg\" $_menu_xon2 0.8 $_menu_x2 0.9 $_menu_bg 260\n:::touch_addbutton \"_menu_t9_$_menu_id\" \"# $_menu_txt_9\" \"\" $_menu_x1 0.825 $_menu_xon2 0.9 $_menu_text_color 4\n:::touch_addbutton \"_menu_t9on_$_menu_id\" \"#  $_menu_txt_on\" \"\" $_menu_xon1 0.825 $_menu_xon2 0.9 $_menu_text_color 4\n:::touch_addbutton \"_menu_t9off_$_menu_id\" \"#  $_menu_txt_off\" \"\" $_menu_xon2 0.825 $_menu_x2 0.9 $_menu_text_color 4\n:::if $_menu_f9 = 1\n::::touch_setcolor \"_menu_on9_$_menu_id\" $_menu_sel_bg\n:::else\n::::touch_setcolor \"_menu_off9_$_menu_id\" $_menu_sel_bg\n::if $_menu_type_9 = 3\n:::touch_addbutton \"_menu_S9_$_menu_id\" \"*white\" \"_click_cnd;messagemode $_menu_cmd_9; touch_hide _menu*; touch_show _menu_refresh\" $_menu_x1 0.8 $_menu_x2 0.9 $_menu_bg 260\n:::touch_addbutton \"_menu_C9_$_menu_id\" \"*white\" \"\" $_menu_xset 0.8 $_menu_x2 0.9 0 0 0 0 260\n:::touch_addbutton \"_menu_t9_$_menu_id\" \"# $_menu_txt_9\" \"\" $_menu_x1 0.825 $_menu_xset 0.9 $_menu_text_color 4\n:::touch_addbutton \"_menu_U9_$_menu_id\" \"# $_menu_f9\" \"\" $_menu_xset 0.825 $_menu_x2 0.9 $_menu_text_color 4\n::if $_menu_type_9 = 4\n:::touch_addbutton \"_menu_i9_$_menu_id\" \"$_menu_icn_9\" \"_click_cnd;$_menu_cmd_9\" $_menu_x1 0.8 $_menu_x2 1 255 255 255 180 260\n:::touch_addbutton \"_menu_t9_$_menu_id\" \"# $_menu_txt_9\" \"\" $_menu_x1 0.8 $_menu_x2 0.9 $_menu_text_color 4\n:::_menu_icn_9 \"\"\n::if $_menu_type_9 = 5\n:::touch_addbutton \"_menu_t9_$_menu_id\" \"# $_menu_txt_9\" \"\" $_menu_x1 0.825 $_menu_x2 0.9 $_menu_text_color 4\n\nif $_menu_min <= 10;:if $_menu_max >= 10;::if $_menu_type_10 = 1\n:::touch_addbutton \"_menu_S0_$_menu_id\" \"*white\" \"_click_cnd; touch_setcolor _menu_S*_$_menu_id $_menu_bg; touch_setcolor _menu_S0_$_menu_id $_menu_sel_bg;$_menu_cmd_10\" $_menu_x1 0.9 $_menu_x2 1 $_menu_bg 260\n:::touch_addbutton \"_menu_t0_$_menu_id\" \"# $_menu_txt_10\" \"\" $_menu_x1 0.925 $_menu_x2 1.0 $_menu_text_color 4\n:::touch_addbutton \"_menu_i0_$_menu_id\" \"$_menu_icn_10\" \"\" $_menu_ix1 0.925 $_menu_x2 0.965 $_menu_text_color 4\n::if $_menu_type_10 = 2\n:::touch_addbutton \"_menu_S0_$_menu_id\" \"*white\" \"\" $_menu_x1 0.9 $_menu_xon1 1 $_menu_bg 260\n:::touch_addbutton \"_menu_on0_$_menu_id\" \"*white\" \"_click_cnd; $_menu_cmd_10 1; touch_setcolor _menu_on0_$_menu_id $_menu_sel_bg; touch_setcolor _menu_off0_$_menu_id $_menu_bg\" $_menu_xon1 0.9 $_menu_xon2 1 $_menu_bg 260\n:::touch_addbutton \"_menu_off0_$_menu_id\" \"*white\" \"_click_cnd; $_menu_cmd_10 0; touch_setcolor _menu_on0_$_menu_id $_menu_bg; touch_setcolor _menu_off0_$_menu_id $_menu_sel_bg\" $_menu_xon2 0.9 $_menu_x2 1 $_menu_bg 260\n:::touch_addbutton \"_menu_t0_$_menu_id\" \"# $_menu_txt_10\" \"\" $_menu_x1 0.925 $_menu_xon1 1 $_menu_text_color 4\n:::touch_addbutton \"_menu_t0on_$_menu_id\" \"#  $_menu_txt_on\" \"\" $_menu_xon1 0.925 $_menu_xon2 1 $_menu_text_color 4\n:::touch_addbutton \"_menu_t0off_$_menu_id\" \"#  $_menu_txt_off\" \"\" $_menu_xon2 0.925 $_menu_x2 1 $_menu_text_color 4\n:::if $_menu_f10 = 1\n::::touch_setcolor \"_menu_on0_$_menu_id\" $_menu_sel_bg\n:::else\n::::touch_setcolor \"_menu_off0_$_menu_id\" $_menu_sel_bg\n::if $_menu_type_10 = 3\n:::touch_addbutton \"_menu_S0_$_menu_id\" \"*white\" \"_click_cnd;messagemode $_menu_cmd_10; touch_hide _menu*; touch_show _menu_refresh\" $_menu_x1 0.9 $_menu_x2 1 $_menu_bg 260\n:::touch_addbutton \"_menu_C0_$_menu_id\" \"*white\" \"\" $_menu_xset 0.9 $_menu_x2 1 0 0 0 0 260\n:::touch_addbutton \"_menu_t0_$_menu_id\" \"# $_menu_txt_10\" \"\" $_menu_x1 0.925 $_menu_xset 1 $_menu_text_color 4\n:::touch_addbutton \"_menu_U0_$_menu_id\" \"# $_menu_f10\" \"\" $_menu_xset 0.925 $_menu_x2 1 $_menu_text_color 4\n::if $_menu_type_10 = 4\n:::touch_addbutton \"_menu_i0_$_menu_id\" \"$_menu_icn_10\" \"_click_cnd;$_menu_cmd_10\" $_menu_x1 0.9 $_menu_x2 1 255 255 255 180 260\n:::touch_addbutton \"_menu_t0_$_menu_id\" \"# $_menu_txt_10\" \"\" $_menu_x1 0.9 $_menu_x2 1.0 $_menu_text_color 4\n:::_menu_icn_10 \"\"\n::if $_menu_type_10 = 5\n:::touch_addbutton \"_menu_t0_$_menu_id\" \"# $_menu_txt_10\" \"\" $_menu_x1 0.925 $_menu_x2 1.0 $_menu_text_color 4\n\nif $_menu_fade_enable = 1;:set _menu_fade_time 5 1 0 ;:touch_fade _menu_*_$_menu_id $_menu_fade_time\n"
  },
  {
    "path": "3rdparty/cs16client-extras/touch/numerical_menu.cfg",
    "content": "cmd_scripting 1\n\nif $numericalmenu = 1\n:exec touch/numerical_menu1\nif $numericalmenu = 2\n:exec touch/numerical_menu2\nif $numericalmenu = 3\n:exec touch/numerical_menu3\n"
  },
  {
    "path": "3rdparty/cs16client-extras/touch/numerical_menu1.cfg",
    "content": "if $numericalmenu_clientonly = 1\r\n:alias _erase_frame \"touch_removebutton _menu_*; unalias _erase_frame; touch_setclientonly 0\"\r\n:touch_setclientonly 1\r\nelse\r\n:alias _erase_frame \"touch_removebutton _menu_*; unalias _erase_frame\"\r\n\r\ntouch_addbutton \"_menu_slot1\" \"touch/gfx/key_1\" \"slot1; _erase_frame\" 0.360000 0.142222 0.460000 0.320000 255 255 255 150 6\r\ntouch_addbutton \"_menu_slot2\" \"touch/gfx/key_2\" \"slot2; _erase_frame\" 0.460000 0.142222 0.560000 0.320000 255 255 255 150 6\r\ntouch_addbutton \"_menu_slot3\" \"touch/gfx/key_3\" \"slot3; _erase_frame\" 0.560000 0.142222 0.660000 0.320000 255 255 255 150 6\r\ntouch_addbutton \"_menu_slot4\" \"touch/gfx/key_4\" \"slot4; _erase_frame\" 0.360000 0.320000 0.460000 0.497778 255 255 255 150 6\r\ntouch_addbutton \"_menu_slot5\" \"touch/gfx/key_5\" \"slot5; _erase_frame\" 0.460000 0.320000 0.560000 0.497778 255 255 255 150 6\r\ntouch_addbutton \"_menu_slot6\" \"touch/gfx/key_6\" \"slot6; _erase_frame\" 0.560000 0.320000 0.660000 0.497778 255 255 255 150 6\r\ntouch_addbutton \"_menu_slot7\" \"touch/gfx/key_7\" \"slot7; _erase_frame\" 0.360000 0.497778 0.460000 0.675556 255 255 255 150 6\r\ntouch_addbutton \"_menu_slot8\" \"touch/gfx/key_8\" \"slot8; _erase_frame\" 0.460000 0.497778 0.560000 0.675556 255 255 255 150 6\r\ntouch_addbutton \"_menu_slot9\" \"touch/gfx/key_9\" \"slot9; _erase_frame\" 0.560000 0.497778 0.660000 0.675556 255 255 255 150 6\r\ntouch_addbutton \"_menu_slot10\" \"touch/gfx/key_0\" \"slot10; _erase_frame\" 0.460000 0.675556 0.560000 0.853333 255 255 255 150 6\r\n"
  },
  {
    "path": "3rdparty/cs16client-extras/touch/numerical_menu2.cfg",
    "content": "if $numericalmenu_clientonly = 1\r\n:alias _erase_frame \"touch_removebutton _menu_*; unalias _erase_frame; touch_setclientonly 0\"\r\n:touch_setclientonly 1\r\nelse\r\n:alias _erase_frame \"touch_removebutton _menu_*; unalias _erase_frame\"\r\n\r\ntouch_addbutton \"_menu_slot1\" \"touch/gfx/key_1\" \"slot1; _erase_frame\" 0.060000 0.711111 0.140000 0.853333 255 255 255 150 6\r\ntouch_addbutton \"_menu_slot2\" \"touch/gfx/key_2\" \"slot2; _erase_frame\" 0.140000 0.711111 0.220000 0.853333 255 255 255 150 6\r\ntouch_addbutton \"_menu_slot3\" \"touch/gfx/key_3\" \"slot3; _erase_frame\" 0.220000 0.711111 0.300000 0.853333 255 255 255 150 6\r\ntouch_addbutton \"_menu_slot4\" \"touch/gfx/key_4\" \"slot4; _erase_frame\" 0.300000 0.711111 0.380000 0.853333 255 255 255 150 6\r\ntouch_addbutton \"_menu_slot5\" \"touch/gfx/key_5\" \"slot5; _erase_frame\" 0.380000 0.711111 0.460000 0.853333 255 255 255 150 6\r\ntouch_addbutton \"_menu_slot6\" \"touch/gfx/key_6\" \"slot6; _erase_frame\" 0.060000 0.853333 0.140000 0.995556 255 255 255 150 6\r\ntouch_addbutton \"_menu_slot7\" \"touch/gfx/key_7\" \"slot7; _erase_frame\" 0.140000 0.853333 0.220000 0.995556 255 255 255 150 6\r\ntouch_addbutton \"_menu_slot8\" \"touch/gfx/key_8\" \"slot8; _erase_frame\" 0.220000 0.853333 0.300000 0.995556 255 255 255 150 6\r\ntouch_addbutton \"_menu_slot9\" \"touch/gfx/key_9\" \"slot9; _erase_frame\" 0.300000 0.853333 0.380000 0.995556 255 255 255 150 6\r\ntouch_addbutton \"_menu_slot10\" \"touch/gfx/key_0\" \"slot10; _erase_frame\" 0.380000 0.853333 0.460000 0.995556 255 255 255 150 6\r\n"
  },
  {
    "path": "3rdparty/cs16client-extras/touch/numerical_menu3.cfg",
    "content": "if $numericalmenu_clientonly = 1\r\n:alias _erase_frame \"touch_removebutton _menu_*; unalias _erase_frame; touch_setclientonly 0\"\r\n:touch_setclientonly 1\r\nelse\r\n:alias _erase_frame \"touch_removebutton _menu_*; unalias _erase_frame\"\r\n\r\ntouch_addbutton \"_menu_slot1\" \"touch/gfx/key_1\" \"slot1; _erase_frame\" 0.060000 0.853333 0.140000 0.995556 255 255 255 150 6\r\ntouch_addbutton \"_menu_slot2\" \"touch/gfx/key_2\" \"slot2; _erase_frame\" 0.140000 0.853333 0.220000 0.995556 255 255 255 150 6\r\ntouch_addbutton \"_menu_slot3\" \"touch/gfx/key_3\" \"slot3; _erase_frame\" 0.220000 0.853333 0.300000 0.995556 255 255 255 150 6\r\ntouch_addbutton \"_menu_slot4\" \"touch/gfx/key_4\" \"slot4; _erase_frame\" 0.300000 0.853333 0.380000 0.995556 255 255 255 150 6\r\ntouch_addbutton \"_menu_slot5\" \"touch/gfx/key_5\" \"slot5; _erase_frame\" 0.380000 0.853333 0.460000 0.995556 255 255 255 150 6\r\ntouch_addbutton \"_menu_slot6\" \"touch/gfx/key_6\" \"slot6; _erase_frame\" 0.540000 0.853333 0.620000 0.995556 255 255 255 150 6\r\ntouch_addbutton \"_menu_slot7\" \"touch/gfx/key_7\" \"slot7; _erase_frame\" 0.620000 0.853333 0.700000 0.995556 255 255 255 150 6\r\ntouch_addbutton \"_menu_slot8\" \"touch/gfx/key_8\" \"slot8; _erase_frame\" 0.700000 0.853333 0.780000 0.995556 255 255 255 150 6\r\ntouch_addbutton \"_menu_slot9\" \"touch/gfx/key_9\" \"slot9; _erase_frame\" 0.780000 0.853333 0.860000 0.995556 255 255 255 150 6\r\ntouch_addbutton \"_menu_slot10\" \"touch/gfx/key_0\" \"slot10; _erase_frame\" 0.860000 0.853333 0.940000 0.995556 255 255 255 150 6\r\n"
  },
  {
    "path": "3rdparty/cs16client-extras/touch/radioa.cfg",
    "content": "//=======================================================================\n// TOUCH RADIO MENU\n// Copyright (c) 2016 Mikhail Stepanov aka ahsim\n//=======================================================================\ncmd_scripting 1\nset menu_root_path \"touch\"\nalias build_menu \"exec touch/customcmd\"\nset _menu_id my_menu-2-radioa\nset _menu_level 2\nset _menu_min 2\nset _menu_max 7\n\nset _menu_type_2 1\nset _menu_txt_2 \"Cover Me\"\nset _menu_cmd_2 \"slot1; _erase_frame\"\nset _menu_icn_2 \"\"\n\nset _menu_type_3 1\nset _menu_txt_3 \"You Take the Point\"\nset _menu_cmd_3 \"slot2; _erase_frame\"\nset _menu_icn_3 \"\"\n\nset _menu_type_4 1\nset _menu_txt_4 \"Hold This Position\"\nset _menu_cmd_4 \"slot3; _erase_frame\"\nset _menu_icn_4 \"\"\n\nset _menu_type_5 1\nset _menu_txt_5 \"Regroup Team\"\nset _menu_cmd_5 \"slot4; _erase_frame\"\nset _menu_icn_5 \"\"\n\nset _menu_type_6 1\nset _menu_txt_6 \"Follow Me\"\nset _menu_cmd_6 \"slot5; _erase_frame\"\nset _menu_icn_6 \"\"\n\nset _menu_type_7 1\nset _menu_txt_7 \"Taking Fire,;Need Assistance\"\nset _menu_cmd_7 \"slot6; _erase_frame\"\nset _menu_icn_7 \"\"\n\nbuild_menu\n"
  },
  {
    "path": "3rdparty/cs16client-extras/touch/radiob.cfg",
    "content": "//=======================================================================\n// TOUCH RADIO MENU\n// Copyright (c) 2016 Mikhail Stepanov aka ahsim\n//=======================================================================\ncmd_scripting 1\nset menu_root_path \"touch\"\nalias build_menu \"exec touch/customcmd\"\nset _menu_id my_menu-2-radiob\nset _menu_level 2\nset _menu_min 2\nset _menu_max 7\n\nset _menu_type_2 1\nset _menu_txt_2 \"Go, go, go\"\nset _menu_cmd_2 \"slot1; _erase_frame\"\nset _menu_icn_2 \"\"\n\nset _menu_type_3 1\nset _menu_txt_3 \"Fall Back\"\nset _menu_cmd_3 \"slot2; _erase_frame\"\nset _menu_icn_3 \"\"\n\nset _menu_type_4 1\nset _menu_txt_4 \"Stick Together Team\"\nset _menu_cmd_4 \"slot3; _erase_frame\"\nset _menu_icn_4 \"\"\n\nset _menu_type_5 1\nset _menu_txt_5 \"Get in Position\"\nset _menu_cmd_5 \"slot4; _erase_frame\"\nset _menu_icn_5 \"\"\n\nset _menu_type_6 1\nset _menu_txt_6 \"Storm the Front\"\nset _menu_cmd_6 \"slot5; _erase_frame\"\nset _menu_icn_6 \"\"\n\nset _menu_type_7 1\nset _menu_txt_7 \"Report In\"\nset _menu_cmd_7 \"slot6; _erase_frame\"\nset _menu_icn_7 \"\"\n\nbuild_menu\n"
  },
  {
    "path": "3rdparty/cs16client-extras/touch/radioc.cfg",
    "content": "//=======================================================================\n// TOUCH RADIO MENU\n// Copyright (c) 2016 Mikhail Stepanov aka ahsim\n//=======================================================================\ncmd_scripting 1\nset menu_root_path \"touch\"\nalias build_menu \"exec touch/customcmd\"\nset _menu_id my_menu-2-radioc\nset _menu_level 2\nset _menu_min 2\nset _menu_max 10\n\nset _menu_type_2 1\nset _menu_txt_2 \"Affirmative/Roger\"\nset _menu_cmd_2 \"slot1; _erase_frame\"\nset _menu_icn_2 \"\"\n\nset _menu_type_3 1\nset _menu_txt_3 \"Enemy Spotted\"\nset _menu_cmd_3 \"slot2; _erase_frame\"\nset _menu_icn_3 \"\"\n\nset _menu_type_4 1\nset _menu_txt_4 \"Need Backup\"\nset _menu_cmd_4 \"slot3; _erase_frame\"\nset _menu_icn_4 \"\"\n\nset _menu_type_5 1\nset _menu_txt_5 \"Sector Clear\"\nset _menu_cmd_5 \"slot4; _erase_frame\"\nset _menu_icn_5 \"\"\n\nset _menu_type_6 1\nset _menu_txt_6 \"I'm in Position\"\nset _menu_cmd_6 \"slot5; _erase_frame\"\nset _menu_icn_7 \"\"\n\nset _menu_type_7 1\nset _menu_txt_7 \"Reporting In\"\nset _menu_cmd_7 \"slot6; _erase_frame\"\nset _menu_icn_7 \"\"\n\nset _menu_type_8 1\nset _menu_txt_8 \"It's gonna Blow!\"\nset _menu_cmd_8 \"slot7; _erase_frame\"\nset _menu_icn_8 \"\"\n\nset _menu_type_9 1\nset _menu_txt_9 \"Negative\"\nset _menu_cmd_9 \"slot8; _erase_frame\"\nset _menu_icn_9 \"\"\n\nset _menu_type_10 1\nset _menu_txt_10 \"Enemy Down\"\nset _menu_cmd_10 \"slot9; _erase_frame\"\nset _menu_icn_10 \"\"\n\nbuild_menu\n"
  },
  {
    "path": "3rdparty/cs16client-extras/touch/radioselector.cfg",
    "content": "//=======================================================================\n// TOUCH RADIO MENU\n// Copyright (c) 2016 Mikhail Stepanov aka ahsim\n//=======================================================================\ncmd_scripting 1\nset menu_root_path \"touch\"\nset _menu_file_name \"radioselector.cfg\"\nalias build_menu \"exec touch/customcmd\"\nset _menu_id radioselector\nset _menu_level 1\nset _menu_min 3\nset _menu_max 8\n\nset _menu_type_3 1\nset _menu_txt_3 \"Radio commands\"\nset _menu_cmd_3 \"radio1; if $_extended_menus = 0;:_erase_frame\"\nset _menu_icn_3 \"touch/cmd/right.tga\"\n\nset _menu_type_4 1\nset _menu_txt_4 \"Group radio commands\"\nset _menu_cmd_4 \"radio2; if $_extended_menus = 0;:_erase_frame\"\nset _menu_icn_4 \"touch/cmd/right.tga\"\n\nset _menu_type_5 1\nset _menu_txt_5 \"Radio responses/reports\"\nset _menu_cmd_5 \"radio3; if $_extended_menus = 0;:_erase_frame\"\nset _menu_icn_5 \"touch/cmd/right.tga\"\n\nset _menu_type_6 5\nset _menu_txt_6 \"\"\nset _menu_cmd_6 \"\"\nset _menu_icn_6 \"\"\n\nset _menu_type_7 1\nset _menu_txt_7 \"All chat\"\nset _menu_cmd_7 \"messagemode; _erase_frame\"\nset _menu_icn_7 \"\"\n\nset _menu_type_8 1\nset _menu_txt_8 \"Team chat\"\nset _menu_cmd_8 \"messagemode2; _erase_frame\"\nset _menu_icn_8 \"\"\n\nbuild_menu\n\nif $enable_controls = 1;:touch_setclientonly 0;else;:touch_setclientonly 1\nexec touch/custom/my_menu-5-controls.cfg\n\ntouch_addbutton \"_menu_slot2_my_menu\" \"*white\" \"\" 0 0.1 0.2 0.2 156 77 20 180 260\ntouch_addbutton \"_menu_txt2_my_menu\" \"#RADIO\" \"\" 0.01 0.135 0.2 0.2 255 174 0 255 4\ntouch_addbutton \"_menu_slot4_my_menu\" \"*white\" \"\" 0 0.5 0.2 0.6 156 77 20 180 260\ntouch_addbutton \"_menu_txt4_my_menu\" \"#CHAT\" \"\" 0.01 0.535 0.2 0.6 255 174 0 255 4\ntouch_addbutton \"_menu_slot10\" \"*white\" \"_click_cnd_back; _erase_frame\" 0 0.8 0.2 0.9 120 60 12 180 260\ntouch_addbutton \"_menu_txt_slot10\" \"#EXIT\" \"\" 0.01 0.835 0.2 0.9 255 174 0 255 4\n"
  },
  {
    "path": "3rdparty/cs16client-extras/touch/scoreboard.cfg",
    "content": "//=======================================================================\n//      Copyright (c) 2016 Poverennov Sergey aka SergioPoverony\n//=======================================================================\n\ncmd_scripting 1\n\nif $checkscoreboard = 1\n:exec touch/scoreboard_full.cfg\nif $checkscoreboard = 2\n:exec touch/scoreboard_short.cfg\nif $checkscoreboard = 3\n:exec touch/scoreboard_classic.cfg\n"
  },
  {
    "path": "3rdparty/cs16client-extras/touch/scoreboard_classic.cfg",
    "content": "touch_setclientonly 1\n+showscores\nalias hidescore \"touch_removebutton _menu_*; -showscores; touch_setclientonly 0\"\ntouch_addbutton \"_menu_score_exit\" \"\" \"hidescore\" 0.000000 0.000000 1.000000 1.00000000 255 255 255 255 6\n"
  },
  {
    "path": "3rdparty/cs16client-extras/touch/scoreboard_full.cfg",
    "content": "//=======================================================================\n//      Copyright (c) 2016 Poverennov Sergey aka SergioPoverony\n//=======================================================================\n\ntouch_setclientonly 1\nshowscoreboard2 0.04 0.9608 0.068 0.937 0 0 0 186\nalias hidescore \"touch_removebutton _menu*; hidescoreboard2; touch_setclientonly 0\"\ntouch_addbutton \"_menu_corner1\" \"gfx/vgui/round_corner_ne.tga\" \"\" 0.960000 0.034043 0.980000 0.068085 255 255 255 186 6\ntouch_addbutton \"_menu_corner2\" \"gfx/vgui/round_corner_sw.tga\" \"\" 0.020000 0.936170 0.040000 0.970213 255 255 255 186 6\ntouch_addbutton \"_menu_corner3\" \"gfx/vgui/round_corner_se.tga\" \"\" 0.960000 0.936170 0.980000 0.970213 255 255 255 186 6\ntouch_addbutton \"_menu_corner6\" \"gfx/vgui/round_corner_nw.tga\" \"\" 0.020000 0.034043 0.040000 0.068085 255 255 255 186 6\ntouch_addbutton \"_menu_corner4\" \"*black\" \"\" 0.040000 0.034043 0.960000 0.068085 255 255 255 186 6\ntouch_addbutton \"_menu_corner5\" \"*black\" \"\" 0.040000 0.936170 0.960000 0.970213 255 255 255 186 6\ntouch_addbutton \"_menu_corner7\" \"*black\" \"\" 0.960000 0.068085 0.980000 0.936170 255 255 255 186 6\ntouch_addbutton \"_menu_corner8\" \"*black\" \"\" 0.020000 0.068085 0.040000 0.936170 255 255 255 186 6\ntouch_addbutton \"_menu_score_exit\" \"\" \"hidescore\" 0.000000 0.000000 1.000000 1.00000000 255 255 255 255 6\n\n"
  },
  {
    "path": "3rdparty/cs16client-extras/touch/scoreboard_short.cfg",
    "content": "//=======================================================================\n//      Copyright (c) 2016 Poverennov Sergey aka SergioPoverony\n//=======================================================================\n\ntouch_setclientonly 1\nshowscoreboard2 0.18 0.85 0.0680 0.937 0 0 0 186\nalias hidescore \"touch_removebutton _menu*; hidescoreboard2; touch_setclientonly 0\"\ntouch_addbutton \"_menu_corner7\" \"*black\" \"\" 0.850000 0.068085 0.870000 0.936170 255 255 255 186 6\ntouch_addbutton \"_menu_corner8\" \"*black\" \"\" 0.160000 0.068085 0.180000 0.936170 255 255 255 186 6\ntouch_addbutton \"_menu_corner4\" \"*black\" \"\" 0.180000 0.034043 0.850000 0.068085 255 255 255 186 6\ntouch_addbutton \"_menu_corner5\" \"*black\" \"\" 0.180000 0.936170 0.850000 0.970213 255 255 255 186 6\ntouch_addbutton \"_menu_corner3\" \"gfx/vgui/round_corner_se.tga\" \"\" 0.850000 0.936170 0.870000 0.970213 255 255 255 186 6\ntouch_addbutton \"_menu_corner2\" \"gfx/vgui/round_corner_sw.tga\" \"\" 0.160000 0.936170 0.180000 0.970213 255 255 255 186 6\ntouch_addbutton \"_menu_corner1\" \"gfx/vgui/round_corner_ne.tga\" \"\" 0.850000 0.034043 0.870000 0.068085 255 255 255 186 6\ntouch_addbutton \"_menu_corner6\" \"gfx/vgui/round_corner_nw.tga\" \"\" 0.160000 0.034043 0.180000 0.068085 255 255 255 186 6\ntouch_addbutton \"_menu_score_exit\" \"\" \"hidescore\" 0.000000 0.000000 1.000000 1.00000000 255 255 255 255 6\n"
  },
  {
    "path": "3rdparty/cs16client-extras/touch.cfg",
    "content": "//=======================================================================\n//\tCopyright SDLash3D team & XashXT group 2016 ©\n//\t\t\ttouchscreen config\n//=======================================================================\n\ntouch_config_file \"touch_profiles/phone_ahsim.cfg\"\n\n// touch cvars\n\n// _move sensitivity settings\ntouch_forwardzone \"0.124444\"\ntouch_sidezone \"0.070000\"\n\n// _look sensitivity settings\ntouch_pitch \"50.000000\"\ntouch_yaw \"50.000000\"\n\n// grid settings\ntouch_grid_count \"50\"\ntouch_grid_enable \"1\"\n\n// global overstroke (width, r, g, b, a)\ntouch_set_stroke 1 156 77 20 200\n\n// highlight when pressed\ntouch_highlight_r \"1.000000\"\ntouch_highlight_g \"0.500000\"\ntouch_highlight_b \"1.000000\"\ntouch_highlight_a \"1.000000\"\n\n// _joy and _dpad options\ntouch_dpad_radius \"1.000000\"\ntouch_joy_radius \"1.000000\"\n\n// how much slowdown when Precise Look button pressed\ntouch_precise_amount \"0.500000\"\n\n// enable/disable move indicator\ntouch_move_indicator \"3\"\n\n// reset menu state when execing config\ntouch_setclientonly 0\n\n// touch buttons\ntouch_removeall\ntouch_addbutton \"move\" \"\" \"_move\" 0.000000 0.106667 0.500000 0.995556 255 255 255 150 0\ntouch_addbutton \"look\" \"\" \"_look\" 0.500000 0.106667 1.000000 0.995556 255 255 255 150 0\ntouch_addbutton \"jump\" \"touch/gfx/jump\" \"+jump\" 0.900000 0.142222 1.000000 0.320000 255 255 255 150 0 1\ntouch_addbutton \"walk\" \"touch/gfx/walk\" \"+speed\" 0.080000 0.782222 0.180000 0.960000 255 255 255 150 0 1\ntouch_addbutton \"score\" \"touch/gfx/score\" \"scoreboard\" 0.920000 0.000000 1.000000 0.142222 255 255 255 150 0 1\ntouch_addbutton \"attack2\" \"touch/gfx/attack2\" \"+attack2\" 0.780000 0.177778 0.860000 0.320000 255 255 255 150 0 1\ntouch_addbutton \"use\" \"touch/gfx/use\" \"+use\" 0.920000 0.355556 1.000000 0.497778 255 255 255 150 0 1\ntouch_addbutton \"reload\" \"touch/gfx/reload\" \"+reload\" 0.000000 0.533333 0.100000 0.711111 255 255 255 150 0 1\ntouch_addbutton \"say\" \"touch/gfx/chat_all\" \"touch_hide say;touch_hide say2;messagemode\" 0.080000 0.248889 0.140000 0.355556 255 255 255 150 1 1\ntouch_addbutton \"say2\" \"touch/gfx/chat_team\" \"touch_hide say;touch_hide say2;messagemode2\" 0.160000 0.248889 0.220000 0.355556 255 255 255 150 1 1\ntouch_addbutton \"change_team\" \"touch/gfx/change_team\" \"chooseteam\" 0.000000 0.817778 0.060000 0.924444 255 255 255 150 0 1\ntouch_addbutton \"flight\" \"touch/gfx/flaghtlight\" \"impulse 100\" 0.740000 0.000000 0.800000 0.106667 255 255 255 150 1 1\ntouch_addbutton \"plus_nvg\" \"touch/gfx/plus\" \"nvgadjustup\" 0.700000 0.106667 0.760000 0.213333 255 255 255 150 1 1\ntouch_addbutton \"minus_nvg\" \"touch/gfx/minus\" \"nvgadjustdown\" 0.620000 0.106667 0.680000 0.213333 255 255 255 150 1 1\ntouch_addbutton \"nightvision\" \"touch/gfx/nightvision\" \"nightvision;toggle_plusminus\" 0.660000 0.000000 0.720000 0.106667 255 255 255 150 1 1\ntouch_addbutton \"w1\" \"touch/gfx/w_rifle\" \"slot1\" 0.100000 0.000000 0.160000 0.106667 255 255 255 150 0 1\ntouch_addbutton \"w2\" \"touch/gfx/w_pistol\" \"slot2\" 0.180000 0.000000 0.240000 0.106667 255 255 255 150 0 1\ntouch_addbutton \"w3\" \"touch/gfx/w_knife\" \"slot3\" 0.260000 0.000000 0.320000 0.106667 255 255 255 150 0 1\ntouch_addbutton \"w4\" \"touch/gfx/w_grenade\" \"slot4\" 0.100000 0.142222 0.160000 0.248889 255 255 255 150 0 1\ntouch_addbutton \"w5\" \"touch/gfx/w_c4\" \"slot5\" 0.180000 0.142222 0.240000 0.248889 255 255 255 150 0 1\ntouch_addbutton \"buy\" \"touch/gfx/buy\" \"buy\" 0.460000 0.853333 0.540000 0.995556 255 255 255 150 0 1\ntouch_addbutton \"drop\" \"touch/gfx/drop\" \"drop\" 0.380000 0.000000 0.440000 0.106667 255 255 255 150 0 1\ntouch_addbutton \"light\" \"touch/gfx/light\" \"toggle_light\" 0.580000 0.000000 0.640000 0.106667 255 255 255 150 0 1\ntouch_addbutton \"cancelselect\" \"touch/gfx/exit\" \"cancelselect\" 0.480000 0.142222 0.540000 0.248889 255 255 255 150 1 1\ntouch_addbutton \"invprev\" \"touch/gfx/left\" \"invprev\" 0.000000 0.711111 0.060000 0.817778 255 255 255 150 1 1\ntouch_addbutton \"invnext\" \"touch/gfx/right\" \"invnext\" 0.060000 0.711111 0.120000 0.817778 255 255 255 150 1 1\ntouch_addbutton \"radio\" \"touch/gfx/radio\" \"showvguimenu 38\" 0.000000 0.391111 0.060000 0.497778 255 255 255 150 0 1\ntouch_addbutton \"touch_edit\" \"touch/gfx/settings\" \"touch_enableedit\" 0.460000 0.000000 0.540000 0.142222 255 255 255 150 0 1\ntouch_addbutton \"spraypaint\" \"touch/gfx/spraypaint\" \"impulse 201\" 0.820000 0.000000 0.880000 0.106667 255 255 255 150 0 1\ntouch_addbutton \"attack\" \"touch/gfx/attack\" \"+attack\" 0.780000 0.391111 0.900000 0.604444 255 255 255 150 0 1\ntouch_addbutton \"duck\" \"touch/gfx/duck\" \"+duck\" 0.900000 0.711111 1.000000 0.888889 255 255 255 150 512 1\ntouch_addbutton \"chat\" \"touch/gfx/chat\" \"toggle_chat\" 0.000000 0.248889 0.060000 0.355556 255 255 255 150 1 1\ntouch_addbutton \"duck_sw\" \"touch/gfx/duck\" \"crouchtoggle\" 0.800000 0.711111 0.900000 0.888889 255 255 255 150 1 1\ntouch_addbutton \"show_numbers\" \"touch_default/show_weapons\" \"exec touch_default/numbers.cfg\" 0.460000 0.711111 0.540000 0.853333 255 255 255 150 1 1\ntouch_addbutton \"cmd\" \"touch/gfx/cmdmenu\" \"exec touch/cmd/cmd\" 0.360000 0.142222 0.420000 0.248889 255 255 255 150 0 1\ntouch_addbutton \"bots\" \"touch/gfx/botmenu\" \"exec touch/bots/bots\" 0.280000 0.142222 0.340000 0.248889 255 255 255 150 0 1\n"
  },
  {
    "path": "3rdparty/cs16client-extras/touch_default/numbers.cfg",
    "content": "touch_hide show_numbers\nalias _numbers_clean \"touch_removebutton _numbers_*;touch_show show_numbers;unalias _numbers_clean\"\ntouch_addbutton \"_numbers_slot1\" \"touch/gfx/key_1\" \"slot1\" 0.020000 0.845443 0.100000 0.980713 255 255 255 200 6 1\ntouch_addbutton \"_numbers_slot2\" \"touch/gfx/key_2\" \"slot2\" 0.100000 0.845443 0.180000 0.980713 255 255 255 200 6 1\ntouch_addbutton \"_numbers_slot3\" \"touch/gfx/key_3\" \"slot3\" 0.180000 0.845443 0.260000 0.980713 255 255 255 200 6 1\ntouch_addbutton \"_numbers_slot4\" \"touch/gfx/key_4\" \"slot4\" 0.260000 0.845443 0.340000 0.980713 255 255 255 200 6 1\ntouch_addbutton \"_numbers_slot5\" \"touch/gfx/key_5\" \"slot5\" 0.340000 0.845443 0.420000 0.980713 255 255 255 200 6 1\ntouch_addbutton \"_numbers_slot6\" \"touch/gfx/key_6\" \"slot6\" 0.560000 0.845443 0.640000 0.980713 255 255 255 200 6 1\ntouch_addbutton \"_numbers_slot7\" \"touch/gfx/key_7\" \"slot7\" 0.640000 0.845443 0.720000 0.980713 255 255 255 200 6 1\ntouch_addbutton \"_numbers_slot8\" \"touch/gfx/key_8\" \"slot8\" 0.720000 0.845443 0.800000 0.980713 255 255 255 200 6 1\ntouch_addbutton \"_numbers_slot9\" \"touch/gfx/key_9\" \"slot9\" 0.800000 0.845443 0.880000 0.980713 255 255 255 200 6 1\ntouch_addbutton \"_numbers_slot10\" \"touch/gfx/key_0\" \"slot10\" 0.880000 0.845443 0.960000 0.980713 255 255 255 200 6 1\ntouch_addbutton \"_numbers_hide\" \"touch_default/next_weap\" \"_numbers_clean\" 0.440000 0.879260 0.520000 1 255 255 255 200 6 1\n"
  },
  {
    "path": "3rdparty/cs16client-extras/touch_presets/phone_ahsim.cfg",
    "content": "//=======================================================================\n//\tCopyright SDLash3D team & XashXT group 2016 ©\n//\t\t\ttouchscreen config\n//=======================================================================\n\ntouch_config_file \"touch_profiles/phone_ahsim.cfg\"\n\n// touch cvars\n\n// _move sensitivity settings\ntouch_forwardzone \"0.124444\"\ntouch_sidezone \"0.070000\"\n\n// _look sensitivity settings\ntouch_pitch \"50.000000\"\ntouch_yaw \"50.000000\"\n\n// grid settings\ntouch_grid_count \"50\"\ntouch_grid_enable \"1\"\n\n// global overstroke (width, r, g, b, a)\ntouch_set_stroke 1 156 77 20 200\n\n// highlight when pressed\ntouch_highlight_r \"1.000000\"\ntouch_highlight_g \"0.500000\"\ntouch_highlight_b \"1.000000\"\ntouch_highlight_a \"1.000000\"\n\n// _joy and _dpad options\ntouch_dpad_radius \"1.000000\"\ntouch_joy_radius \"1.000000\"\n\n// how much slowdown when Precise Look button pressed\ntouch_precise_amount \"0.500000\"\n\n// enable/disable move indicator\ntouch_move_indicator \"3\"\n\n// reset menu state when execing config\ntouch_setclientonly 0\n\n// touch buttons\ntouch_removeall\ntouch_addbutton \"move\" \"\" \"_move\" 0.000000 0.106667 0.500000 0.995556 255 255 255 150 0\ntouch_addbutton \"look\" \"\" \"_look\" 0.500000 0.106667 1.000000 0.995556 255 255 255 150 0\ntouch_addbutton \"jump\" \"touch/gfx/jump\" \"+jump\" 0.900000 0.142222 1.000000 0.320000 255 255 255 150 0 1\ntouch_addbutton \"walk\" \"touch/gfx/walk\" \"+speed\" 0.080000 0.782222 0.180000 0.960000 255 255 255 150 0 1\ntouch_addbutton \"score\" \"touch/gfx/score\" \"scoreboard\" 0.920000 0.000000 1.000000 0.142222 255 255 255 150 0 1\ntouch_addbutton \"attack2\" \"touch/gfx/attack2\" \"+attack2\" 0.780000 0.177778 0.860000 0.320000 255 255 255 150 0 1\ntouch_addbutton \"use\" \"touch/gfx/use\" \"+use\" 0.920000 0.355556 1.000000 0.497778 255 255 255 150 0 1\ntouch_addbutton \"reload\" \"touch/gfx/reload\" \"+reload\" 0.000000 0.533333 0.100000 0.711111 255 255 255 150 0 1\ntouch_addbutton \"say\" \"touch/gfx/chat_all\" \"touch_hide say;touch_hide say2;messagemode\" 0.080000 0.248889 0.140000 0.355556 255 255 255 150 1 1\ntouch_addbutton \"say2\" \"touch/gfx/chat_team\" \"touch_hide say;touch_hide say2;messagemode2\" 0.160000 0.248889 0.220000 0.355556 255 255 255 150 1 1\ntouch_addbutton \"change_team\" \"touch/gfx/change_team\" \"chooseteam\" 0.000000 0.817778 0.060000 0.924444 255 255 255 150 0 1\ntouch_addbutton \"flight\" \"touch/gfx/flaghtlight\" \"impulse 100\" 0.740000 0.000000 0.800000 0.106667 255 255 255 150 1 1\ntouch_addbutton \"plus_nvg\" \"touch/gfx/plus\" \"nvgadjustup\" 0.700000 0.106667 0.760000 0.213333 255 255 255 150 1 1\ntouch_addbutton \"minus_nvg\" \"touch/gfx/minus\" \"nvgadjustdown\" 0.620000 0.106667 0.680000 0.213333 255 255 255 150 1 1\ntouch_addbutton \"nightvision\" \"touch/gfx/nightvision\" \"nightvision;toggle_plusminus\" 0.660000 0.000000 0.720000 0.106667 255 255 255 150 1 1\ntouch_addbutton \"w1\" \"touch/gfx/w_rifle\" \"slot1\" 0.100000 0.000000 0.160000 0.106667 255 255 255 150 0 1\ntouch_addbutton \"w2\" \"touch/gfx/w_pistol\" \"slot2\" 0.180000 0.000000 0.240000 0.106667 255 255 255 150 0 1\ntouch_addbutton \"w3\" \"touch/gfx/w_knife\" \"slot3\" 0.260000 0.000000 0.320000 0.106667 255 255 255 150 0 1\ntouch_addbutton \"w4\" \"touch/gfx/w_grenade\" \"slot4\" 0.100000 0.142222 0.160000 0.248889 255 255 255 150 0 1\ntouch_addbutton \"w5\" \"touch/gfx/w_c4\" \"slot5\" 0.180000 0.142222 0.240000 0.248889 255 255 255 150 0 1\ntouch_addbutton \"buy\" \"touch/gfx/buy\" \"buy\" 0.460000 0.853333 0.540000 0.995556 255 255 255 150 0 1\ntouch_addbutton \"drop\" \"touch/gfx/drop\" \"drop\" 0.380000 0.000000 0.440000 0.106667 255 255 255 150 0 1\ntouch_addbutton \"light\" \"touch/gfx/light\" \"toggle_light\" 0.580000 0.000000 0.640000 0.106667 255 255 255 150 0 1\ntouch_addbutton \"cancelselect\" \"touch/gfx/exit\" \"cancelselect\" 0.480000 0.142222 0.540000 0.248889 255 255 255 150 1 1\ntouch_addbutton \"invprev\" \"touch/gfx/left\" \"invprev\" 0.000000 0.711111 0.060000 0.817778 255 255 255 150 1 1\ntouch_addbutton \"invnext\" \"touch/gfx/right\" \"invnext\" 0.060000 0.711111 0.120000 0.817778 255 255 255 150 1 1\ntouch_addbutton \"radio\" \"touch/gfx/radio\" \"showvguimenu 38\" 0.000000 0.391111 0.060000 0.497778 255 255 255 150 0 1\ntouch_addbutton \"touch_edit\" \"touch/gfx/settings\" \"touch_enableedit\" 0.460000 0.000000 0.540000 0.142222 255 255 255 150 0 1\ntouch_addbutton \"spraypaint\" \"touch/gfx/spraypaint\" \"impulse 201\" 0.820000 0.000000 0.880000 0.106667 255 255 255 150 0 1\ntouch_addbutton \"attack\" \"touch/gfx/attack\" \"+attack\" 0.780000 0.391111 0.900000 0.604444 255 255 255 150 0 1\ntouch_addbutton \"duck\" \"touch/gfx/duck\" \"+duck\" 0.900000 0.711111 1.000000 0.888889 255 255 255 150 512 1\ntouch_addbutton \"chat\" \"touch/gfx/chat\" \"toggle_chat\" 0.000000 0.248889 0.060000 0.355556 255 255 255 150 1 1\ntouch_addbutton \"duck_sw\" \"touch/gfx/duck\" \"crouchtoggle\" 0.800000 0.711111 0.900000 0.888889 255 255 255 150 1 1\ntouch_addbutton \"show_numbers\" \"touch_default/show_weapons\" \"exec touch_default/numbers.cfg\" 0.460000 0.711111 0.540000 0.853333 255 255 255 150 1 1\ntouch_addbutton \"cmd\" \"touch/gfx/cmdmenu\" \"exec touch/cmd/cmd\" 0.360000 0.142222 0.420000 0.248889 255 255 255 150 0 1\ntouch_addbutton \"bots\" \"touch/gfx/botmenu\" \"exec touch/bots/bots\" 0.280000 0.142222 0.340000 0.248889 255 255 255 150 0 1\n"
  },
  {
    "path": "3rdparty/cs16client-extras/touch_presets/phone_poverony.cfg",
    "content": "//=======================================================================\n//\tCopyright SDLash3D team & XashXT group 2016 ©\n//\t\t\ttouchscreen preset\n//=======================================================================\n\ntouch_config_file \"touch_profiles/sergiopoverony_selected.cfg\"\n\n// touch cvars\n\n// _move sensitivity settings\ntouch_forwardzone \"0.080000\"\ntouch_sidezone \"0.040000\"\n\n// _look sensitivity settings\ntouch_pitch \"20.000000\"\ntouch_yaw \"50.000000\"\n\n// grid settings\ntouch_grid_count \"100\"\ntouch_grid_enable \"1\"\n\n// global overstroke (width, r, g, b, a)\ntouch_set_stroke 2 90 90 90 200\n\n// highlight when pressed\ntouch_highlight_r \"1.000000\"\ntouch_highlight_g \"1.000000\"\ntouch_highlight_b \"1.000000\"\ntouch_highlight_a \"1.000000\"\n\n// _joy and _dpad options\ntouch_dpad_radius \"1.000000\"\ntouch_joy_radius \"1.000000\"\n\n// how much slowdown when Precise Look button pressed\ntouch_precise_amount \"0.500000\"\n\n// enable/disable move indicator\ntouch_move_indicator \"0\"\n\n// reset menu state when execing config\ntouch_setclientonly 0\n\n// touch buttons\ntouch_removeall\ntouch_addbutton \"move\" \"\" \"_move\" 0.000000 0.160000 0.470000 0.995556 255 255 255 100 0 1\ntouch_addbutton \"look\" \"\" \"_look\" 0.460000 0.035556 1.000000 0.995556 255 255 255 100 0 1\ntouch_addbutton \"nightvision\" \"touch/gfx/nightvision\" \"nightvision;toggle_plusminus\" 0.360000 0.711111 0.440000 0.853333 255 255 255 100 1 1\ntouch_addbutton \"minus_nvg\" \"touch/gfx/minus\" \"nvgadjustdown\" 0.340000 0.622222 0.400000 0.728889 255 255 255 100 1 1\ntouch_addbutton \"plus_nvg\" \"touch/gfx/plus\" \"nvgadjustup\" 0.400000 0.622222 0.460000 0.728889 255 255 255 100 1 1\ntouch_addbutton \"jump\" \"touch/gfx/jump\" \"+jump\" 0.900000 0.817778 1.000000 0.995556 255 255 255 100 0 1\ntouch_addbutton \"w4\" \"touch/gfx/w_grenade\" \"slot4\" 0.840000 0.000000 0.920000 0.142222 255 255 255 100 0 1\ntouch_addbutton \"w3\" \"touch/gfx/w_knife\" \"slot3\" 0.920000 0.000000 1.000000 0.142222 255 255 255 100 0 1\ntouch_addbutton \"w2\" \"touch/gfx/w_pistol\" \"slot2\" 0.760000 0.000000 0.840000 0.142222 255 255 255 100 0 1\ntouch_addbutton \"w1\" \"touch/gfx/w_rifle\" \"slot1\" 0.680000 0.000000 0.760000 0.142222 255 255 255 100 0 1\ntouch_addbutton \"w5\" \"touch/gfx/w_c4\" \"slot5\" 0.600000 0.000000 0.680000 0.142222 255 255 255 100 0 1\ntouch_addbutton \"attack2\" \"touch/gfx/attack2\" \"+attack2\" 0.890000 0.480000 1.000000 0.675556 255 255 255 100 0 1\ntouch_addbutton \"duck\" \"touch/gfx/duck\" \"+duck\" 0.000000 0.817778 0.100000 0.995556 255 255 255 100 512 1\ntouch_addbutton \"joy\" \"touch/gfx/joy\" \"_joy\" 0.130000 0.586667 0.220000 0.746667 255 255 255 100 1 1\ntouch_addbutton \"dpad\" \"touch/gfx/dpad\" \"_dpad\" 0.070000 0.480000 0.280000 0.853333 255 255 255 100 0 1\ntouch_addbutton \"light\" \"touch/gfx/light\" \"toggle_light\" 0.360000 0.853333 0.440000 0.995556 255 255 255 100 0 1\ntouch_addbutton \"score\" \"touch/gfx/score\" \"scoreboard\" 0.520000 0.853333 0.600000 0.995556 255 255 255 100 0 1\ntouch_addbutton \"reload\" \"touch/gfx/reload\" \"+reload\" 0.620000 0.640000 0.730000 0.835556 255 255 255 100 0 1\ntouch_addbutton \"buy\" \"touch/gfx/buy\" \"buy\" 0.670000 0.835556 0.750000 0.977778 255 255 255 100 0 1\ntouch_addbutton \"bots\" \"touch/gfx/botmenu\" \"exec touch/bots/bots\" 0.190000 0.000000 0.270000 0.142222 255 255 255 100 1 1\ntouch_addbutton \"cmd\" \"touch/gfx/cmdmenu\" \"exec touch/cmd/cmd\" 0.110000 0.000000 0.190000 0.142222 255 255 255 100 1 1\ntouch_addbutton \"touch_edit\" \"touch/gfx/settings\" \"touch_enableedit\" 0.270000 0.000000 0.350000 0.142222 255 255 255 100 1 1\ntouch_addbutton \"use\" \"touch/gfx/use\" \"+use\" 0.680000 0.515556 0.760000 0.657778 255 255 255 100 0 1\ntouch_addbutton \"exit\" \"touch/gfx/exit\" \"cancelselect\" 0.350000 0.000000 0.430000 0.142222 255 255 255 100 1 1\ntouch_addbutton \"change_team\" \"touch/gfx/change_team\" \"chooseteam\" 0.430000 0.000000 0.510000 0.142222 255 255 255 100 1 1\ntouch_addbutton \"down\" \"touch/gfx/left\" \"toggle_down\" 0.520000 0.000000 0.600000 0.142222 255 255 255 100 0 1\ntouch_addbutton \"radio\" \"touch/gfx/radio\" \"showvguimenu 38\" 0.000000 0.160000 0.100000 0.337778 255 255 255 100 0 1\ntouch_addbutton \"spraypaint\" \"touch/gfx/spraypaint\" \"impulse 201\" 0.100000 0.177778 0.180000 0.320000 255 255 255 100 0 1\ntouch_addbutton \"invprev\" \"touch/gfx/left\" \"invprev\" 0.180000 0.177778 0.260000 0.320000 255 255 255 100 1 1\ntouch_addbutton \"invnext\" \"touch/gfx/right\" \"invnext\" 0.260000 0.177778 0.340000 0.320000 255 255 255 100 1 1\ntouch_addbutton \"walk\" \"touch/gfx/walk\" \"+speed\" 0.000000 0.355556 0.100000 0.533333 255 255 255 100 0 1\ntouch_addbutton \"duck_sw\" \"touch/gfx/duck\" \"crouchtoggle\" 0.260000 0.817778 0.360000 0.995556 255 255 255 100 0 1\ntouch_addbutton \"attack\" \"touch/gfx/attack\" \"+attack\" 0.730000 0.586667 0.910000 0.906667 255 255 255 100 0 1\ntouch_addbutton \"drop\" \"touch/gfx/drop\" \"drop\" 0.440000 0.711111 0.520000 0.853333 255 255 255 100 0 1\ntouch_addbutton \"show_numbers\" \"touch_default/show_weapons\" \"exec touch_default/numbers.cfg\" 0.440000 0.853333 0.520000 0.995556 255 255 255 100 0 1\ntouch_addbutton \"flight\" \"touch/gfx/flaghtlight\" \"impulse 100\" 0.920000 0.142222 1.000000 0.284444 255 255 255 100 1 1\n\n// round button coordinates to grid\ntouch_roundall\n"
  },
  {
    "path": "3rdparty/cs16client-extras/touch_presets/psvita.cfg",
    "content": "//=======================================================================\n//\tGenerated by Xash3D FWGS (3679, 43364ec, master, psvita-armv7hf)\n//\t\t\ttouchscreen config\n//=======================================================================\n\ntouch_config_file \"touch_presets/psvita.cfg\"\n\n// touch cvars\n\n// sensitivity settings\ntouch_pitch \"60\"\ntouch_yaw \"60\"\ntouch_forwardzone \"0.124444\"\ntouch_sidezone \"0.07\"\ntouch_nonlinear_look \"0\"\ntouch_pow_factor \"1.3\"\ntouch_pow_mult \"400\"\ntouch_exp_mult \"0\"\n\n// grid settings\ntouch_grid_count \"50\"\ntouch_grid_enable \"1\"\n\n// global overstroke (width, r, g, b, a)\ntouch_set_stroke 1 255 174 0 150\n\n// highlight when pressed\ntouch_highlight_r \"1\"\ntouch_highlight_g \"0.5\"\ntouch_highlight_b \"1\"\ntouch_highlight_a \"1\"\n\n// _joy and _dpad options\ntouch_dpad_radius \"1\"\ntouch_joy_radius \"1\"\n\n// how much slowdown when Precise Look button pressed\ntouch_precise_amount \"0.5\"\n\n// enable/disable move indicator\ntouch_move_indicator \"0\"\n\n// reset menu state when execing config\ntouch_setclientonly 0\n\n// touch buttons\ntouch_removeall\ntouch_aspectratio 0.566667\ntouch_addbutton \"look\" \"\" \"_look\" 0.5 0.105882 1 0.988235 255 255 255 150 0\ntouch_addbutton \"score\" \"touch/gfx/score\" \"scoreboard\" 0.92 0 1 0.141176 255 255 255 150 0\ntouch_addbutton \"say\" \"touch/gfx/chat_all\" \"touch_hide say;touch_hide say2;messagemode\" 0.08 0.248889 0.14 0.354771 255 255 255 150 1\ntouch_addbutton \"say2\" \"touch/gfx/chat_team\" \"touch_hide say;touch_hide say2;messagemode2\" 0.16 0.248889 0.22 0.354771 255 255 255 150 1\ntouch_addbutton \"flight\" \"touch/gfx/flaghtlight\" \"impulse 100\" 0.74 0 0.8 0.105882 255 255 255 150 1\ntouch_addbutton \"plus_nvg\" \"touch/gfx/plus\" \"nvgadjustup\" 0.7 0.106667 0.76 0.212549 255 255 255 150 1\ntouch_addbutton \"minus_nvg\" \"touch/gfx/minus\" \"nvgadjustdown\" 0.62 0.106667 0.68 0.212549 255 255 255 150 1\ntouch_addbutton \"nightvision\" \"touch/gfx/nightvision\" \"nightvision;toggle_plusminus\" 0.66 0 0.72 0.105882 255 255 255 150 1\ntouch_addbutton \"drop\" \"touch/gfx/drop\" \"drop\" 0.38 0 0.44 0.105882 255 255 255 150 0\ntouch_addbutton \"light\" \"touch/gfx/light\" \"toggle_light\" 0.58 0 0.64 0.105882 255 255 255 150 0\ntouch_addbutton \"radio\" \"touch/gfx/radio\" \"showvguimenu 38\" 0 0.391111 0.06 0.496993 255 255 255 150 0\ntouch_addbutton \"spraypaint\" \"touch/gfx/spraypaint\" \"impulse 201\" 0.82 0 0.88 0.105882 255 255 255 150 0\ntouch_addbutton \"chat\" \"touch/gfx/chat\" \"toggle_chat\" 0 0.248889 0.06 0.354771 255 255 255 150 0\ntouch_addbutton \"w1\" \"touch/gfx/w_rifle\" \"slot1\" 0.14 0 0.2 0.105882 255 255 255 150 0\ntouch_addbutton \"w2\" \"touch/gfx/w_pistol\" \"slot2\" 0.22 0 0.28 0.105882 255 255 255 150 0\ntouch_addbutton \"w3\" \"touch/gfx/w_knife\" \"slot3\" 0.3 0 0.36 0.105882 255 255 255 150 0\ntouch_addbutton \"duck_sw\" \"touch/gfx/duck\" \"crouchtoggle\" 0.34 0.811772 0.44 0.988242 255 255 255 150 0\ntouch_addbutton \"touch_edit\" \"touch/gfx/settings\" \"touch_enableedit\" 0.46 0 0.54 0.141176 255 255 255 150 0\ntouch_addbutton \"voicechat\" \"touch/gfx/voicechat\" \"+voicerecord\" 0.86 0.105882 0.92 0.211765 255 255 255 150 0\ntouch_addbutton \"show_numbers\" \"touch_default/show_weapons\" \"exec touch_default/numbers.cfg\" 0.46 0.811765 0.54 0.952941 255 255 255 150 0\ntouch_addbutton \"cancelselect\" \"touch/gfx/exit\" \"cancelselect\" 0.48 0.141176 0.54 0.247059 255 255 255 150 1\ntouch_addbutton \"buy\" \"touch/gfx/buy\" \"buy\" 0.56 0.847059 0.64 0.988235 255 255 255 150 0\ntouch_addbutton \"w4\" \"touch/gfx/w_grenade\" \"slot4\" 0.14 0.141176 0.2 0.247059 255 255 255 150 0\ntouch_addbutton \"w5\" \"touch/gfx/w_c4\" \"slot5\" 0.22 0.141176 0.28 0.247059 255 255 255 150 0\ntouch_addbutton \"bots\" \"touch/gfx/botmenu\" \"exec touch/bots/bots\" 0.3 0.141176 0.36 0.247059 255 255 255 150 0\ntouch_addbutton \"cmd\" \"touch/gfx/cmdmenu\" \"exec touch/cmd/cmd\" 0.38 0.141176 0.44 0.247059 255 255 255 150 0\n"
  },
  {
    "path": "3rdparty/cs16client-extras/touch_presets/tablet_poverony.cfg",
    "content": "//=======================================================================\n//\tCopyright SDLash3D team & XashXT group 2016 ©\n//\t\t\ttouchscreen config\n//=======================================================================\n\ntouch_config_file \"touch_profiles/tablet_poverony.cfg\"\n\n// touch cvars\n\n// _move sensitivity settings\ntouch_forwardzone \"0.080000\"\ntouch_sidezone \"0.040000\"\n\n// _look sensitivity settings\ntouch_pitch \"50.000000\"\ntouch_yaw \"50.000000\"\n\n// grid settings\ntouch_grid_count \"100\"\ntouch_grid_enable \"1\"\n\n// global overstroke (width, r, g, b, a)\ntouch_set_stroke 2 90 90 90 200\n\n// highlight when pressed\ntouch_highlight_r \"1.000000\"\ntouch_highlight_g \"1.000000\"\ntouch_highlight_b \"1.000000\"\ntouch_highlight_a \"1.000000\"\n\n// _joy and _dpad options\ntouch_dpad_radius \"1.000000\"\ntouch_joy_radius \"3.000000\"\n\n// how much slowdown when Precise Look button pressed\ntouch_precise_amount \"0.500000\"\n\n// enable/disable move indicator\ntouch_move_indicator \"2\"\n\n// reset menu state when execing config\ntouch_setclientonly 0\n\n// touch buttons\ntouch_removeall\ntouch_addbutton \"move\" \"\" \"_move\" 0.000000 0.444444 0.460000 0.995556 255 255 255 150 0\ntouch_addbutton \"look\" \"\" \"_look\" 0.470000 0.248889 1.000000 0.604444 255 255 255 150 0\ntouch_addbutton \"joy\" \"touch/gfx/joy\" \"_joy\" 0.290000 0.187234 0.410000 0.391489 255 255 255 150 1 1\ntouch_addbutton \"dpad\" \"touch/gfx/dpad\" \"_dpad\" 0.170000 0.187234 0.290000 0.391489 255 255 255 150 1 1\ntouch_addbutton \"invprev\" \"touch/gfx/left\" \"invprev\" 0.000000 0.323404 0.080000 0.459574 255 255 255 150 1 1\ntouch_addbutton \"invnext\" \"touch/gfx/right\" \"invnext\" 0.080000 0.323404 0.160000 0.459574 255 255 255 150 1 1\ntouch_addbutton \"radio\" \"touch/gfx/radio\" \"showvguimenu 38\" 0.000000 0.187234 0.080000 0.323404 255 255 255 150 0 1\ntouch_addbutton \"reload\" \"touch/gfx/reload\" \"+reload\" 0.680000 0.680851 0.760000 0.817021 255 255 255 150 0 1\ntouch_addbutton \"use\" \"touch/gfx/use\" \"+use\" 0.700000 0.544681 0.780000 0.680851 255 255 255 150 0 1\ntouch_addbutton \"spraypaint\" \"touch/gfx/spraypaint\" \"impulse 201\" 0.700000 0.817021 0.780000 0.953192 255 255 255 150 0 1\ntouch_addbutton \"drop\" \"touch/gfx/drop\" \"drop\" 0.780000 0.868085 0.860000 1.004255 255 255 255 150 0 1\ntouch_addbutton \"jump\" \"touch/gfx/jump\" \"+jump\" 0.880000 0.800000 0.980000 0.970213 255 255 255 150 0 1\ntouch_addbutton \"attack\" \"touch/gfx/attack\" \"+attack\" 0.760000 0.612766 0.910000 0.868085 255 255 255 150 0 1\ntouch_addbutton \"attack2\" \"touch/gfx/attack2\" \"+attack2\" 0.900000 0.578723 1.000000 0.748936 255 255 255 150 0 1\ntouch_addbutton \"w5\" \"touch/gfx/w_c4\" \"slot5\" 0.760000 0.102128 0.840000 0.238298 255 255 255 150 0 1\ntouch_addbutton \"w1\" \"touch/gfx/w_rifle\" \"slot1\" 0.780000 0.238298 0.860000 0.374468 255 255 255 150 0 1\ntouch_addbutton \"w2\" \"touch/gfx/w_pistol\" \"slot2\" 0.840000 0.136170 0.920000 0.272340 255 255 255 150 0 1\ntouch_addbutton \"w4\" \"touch/gfx/w_grenade\" \"slot4\" 0.880000 0.017021 0.960000 0.153191 255 255 255 150 0 1\ntouch_addbutton \"w3\" \"touch/gfx/w_knife\" \"slot3\" 0.920000 0.136170 1.000000 0.272340 255 255 255 150 0 1\ntouch_addbutton \"flight\" \"touch/gfx/flaghtlight\" \"impulse 100\" 0.280000 0.851064 0.360000 0.987234 255 255 255 150 1 1\ntouch_addbutton \"light\" \"touch/gfx/light\" \"toggle_light\" 0.360000 0.851064 0.440000 0.987234 255 255 255 150 0 1\ntouch_addbutton \"buy\" \"touch/gfx/buy\" \"buy\" 0.440000 0.851064 0.520000 0.987234 255 255 255 150 0 1\ntouch_addbutton \"score\" \"touch/gfx/score\" \"scoreboard\" 0.520000 0.851064 0.600000 0.987234 255 255 255 150 0 1\ntouch_addbutton \"nightvision\" \"touch/gfx/nightvision\" \"nightvision;toggle_plusminus\" 0.360000 0.714894 0.440000 0.851064 255 255 255 150 1 1\ntouch_addbutton \"minus_nvg\" \"touch/gfx/minus\" \"nvgadjustdown\" 0.340000 0.629787 0.400000 0.731915 255 255 255 150 1 1\ntouch_addbutton \"plus_nvg\" \"touch/gfx/plus\" \"nvgadjustup\" 0.400000 0.629787 0.460000 0.731915 255 255 255 150 1 1\ntouch_addbutton \"show_numbers\" \"touch_default/show_weapons\" \"exec touch_default/numbers.cfg\" 0.440000 0.714894 0.520000 0.851064 255 255 255 150 1 1\ntouch_addbutton \"duck\" \"touch/gfx/duck\" \"+duck\" 0.000000 0.817021 0.100000 0.987234 255 255 255 150 512 1\ntouch_addbutton \"duck_sw\" \"touch/gfx/duck\" \"crouchtoggle\" 0.100000 0.817021 0.200000 0.987234 255 255 255 150 1 1\ntouch_addbutton \"change_team\" \"touch/gfx/change_team\" \"chooseteam\" 0.540000 0.000000 0.620000 0.136170 255 255 255 150 0 1\ntouch_addbutton \"exit\" \"touch/gfx/exit\" \"cancelselect\" 0.460000 0.000000 0.540000 0.136170 255 255 255 150 0 1\ntouch_addbutton \"touch_edit\" \"touch/gfx/settings\" \"touch_enableedit\" 0.380000 0.000000 0.460000 0.136170 255 255 255 150 0 1\ntouch_addbutton \"cmd\" \"touch/gfx/cmdmenu\" \"exec touch/cmd/cmd\" 0.100000 0.248889 0.200000 0.426667 255 255 255 150 1 1\ntouch_addbutton \"radio\" \"touch/gfx/radio\" \"showvguimenu 38\" 0.000000 0.248889 0.100000 0.426667 255 255 255 150 0 1\ntouch_addbutton \"walk\" \"touch/gfx/walk\" \"+speed\" 0.000000 0.640000 0.100000 0.817778 255 255 255 150 0 1\n"
  },
  {
    "path": "3rdparty/cs16client-extras/touch_presets/touch_swank.cfg",
    "content": "//=======================================================================\n//\tCopyright SDLash3D team & XashXT group 2016 ©\n//\t\t\ttouchscreen config\n//=======================================================================\n\ntouch_config_file \"touch_profiles/touch_swank.cfg\"\n\n// touch cvars\n\n// _move sensitivity settings\ntouch_forwardzone \"0.124444\"\ntouch_sidezone \"0.066667\"\n\n// _look sensitivity settings\ntouch_pitch \"162.000000\"\ntouch_yaw \"162.000000\"\n\n// grid settings\ntouch_grid_count \"60\"\ntouch_grid_enable \"1\"\n\n// global overstroke (width, r, g, b, a)\ntouch_set_stroke 1 156 77 20 200\n\n// highlight when pressed\ntouch_highlight_r \"122.000000\"\ntouch_highlight_g \"122.000000\"\ntouch_highlight_b \"122.000000\"\ntouch_highlight_a \"180.000000\"\n\n// _joy and _dpad options\ntouch_dpad_radius \"1.000000\"\ntouch_joy_radius \"1.000000\"\n\n// how much slowdown when Precise Look button pressed\ntouch_precise_amount \"0.550000\"\n\n// enable/disable move indicator\ntouch_move_indicator \"3\"\n\n// reset menu state when execing config\ntouch_setclientonly 0\n\n// touch buttons\ntouch_removeall\ntouch_addbutton \"move\" \"\" \"_move\" 0.000000 0.166667 0.416667 1.000000 255 255 255 130 0\ntouch_addbutton \"look\" \"\" \"_look\" 0.416667 0.000000 1.000000 1.000000 255 255 255 130 0\ntouch_addbutton \"buy\" \"touch/gfx/buy\" \"buy\" 0.316667 0.861111 0.400000 1.000000 255 255 255 130 0 1\ntouch_addbutton \"score\" \"touch/gfx/score\" \"scoreboard\" 0.400000 0.861111 0.483333 1.000000 255 255 255 130 0 1\ntouch_addbutton \"w2\" \"touch/gfx/w_pistol\" \"slot2\" 0.833333 0.111111 0.916667 0.250000 255 255 255 130 0 1\ntouch_addbutton \"w1\" \"touch/gfx/w_rifle\" \"slot1\" 0.750000 0.111111 0.833333 0.250000 255 255 255 130 0 1\ntouch_addbutton \"w3\" \"touch/gfx/w_knife\" \"slot3\" 0.850000 0.000000 0.916667 0.111111 255 255 255 130 0 1\ntouch_addbutton \"w4\" \"touch/gfx/w_grenade\" \"slot4\" 0.783333 0.000000 0.850000 0.111111 255 255 255 130 0 1\ntouch_addbutton \"w5\" \"touch/gfx/w_c4\" \"slot5\" 0.716667 0.000000 0.783333 0.111111 255 255 255 130 0 1\ntouch_addbutton \"reload\" \"touch/gfx/reload\" \"+reload\" 0.916667 0.083333 1.000000 0.222222 255 255 255 130 0 1\ntouch_addbutton \"jump\" \"touch/gfx/jump\" \"+jump\" 0.900000 0.222222 1.000000 0.388889 255 255 255 130 0 1\ntouch_addbutton \"use\" \"touch/gfx/use\" \"+use\" 0.900000 0.388889 1.000000 0.555556 255 255 255 130 0 1\ntouch_addbutton \"attack2\" \"touch/gfx/attack2\" \"+attack2\" 0.800000 0.250000 0.900000 0.416667 255 255 255 130 0 1\ntouch_addbutton \"touch_edit\" \"touch/gfx/settings\" \"touch_enableedit\" 0.450000 0.000000 0.533333 0.138889 255 255 255 130 0 1\ntouch_addbutton \"cmd\" \"touch/gfx/cmdmenu\" \"exec touch/cmd/cmd\" 0.383333 0.000000 0.450000 0.111111 255 255 255 130 0 1\ntouch_addbutton \"bots\" \"touch/gfx/botmenu\" \"exec touch/bots/bots\" 0.316667 0.000000 0.383333 0.111111 255 255 255 130 0 1\ntouch_addbutton \"spraypaint\" \"touch/gfx/spraypaint\" \"impulse 201\" 0.600000 0.000000 0.666667 0.111111 255 255 255 130 0 1\ntouch_addbutton \"nightvision\" \"touch/gfx/nightvision\" \"nightvision\" 0.533333 0.111111 0.600000 0.222222 255 255 255 130 1 1\ntouch_addbutton \"flight\" \"touch/gfx/flaghtlight\" \"impulse 100\" 0.600000 0.111111 0.666667 0.222222 255 255 255 130 1 1\ntouch_addbutton \"radio\" \"touch/gfx/radio\" \"showvguimenu 38\" 0.250000 0.000000 0.316667 0.111111 255 255 255 130 0 1\ntouch_addbutton \"change_team\" \"touch/gfx/change_team\" \"chooseteam\" 0.183333 0.000000 0.250000 0.111111 255 255 255 130 0 1\ntouch_addbutton \"duck\" \"touch/gfx/duck\" \"+duck\" 0.900000 0.833333 1.000000 1.000000 255 255 255 130 0 1\ntouch_addbutton \"attack\" \"touch/gfx/attack\" \"+attack\" 0.783333 0.416667 0.900000 0.611111 255 255 255 130 512 1\ntouch_addbutton \"duck_sw\" \"touch/gfx/duck\" \"crouchtoggle\" 0.800000 0.833333 0.900000 1.000000 255 255 255 130 1 1\ntouch_addbutton \"light\" \"touch/gfx/light\" \"toggle_light\" 0.533333 0.000000 0.600000 0.111111 255 255 255 130 0 1\ntouch_addbutton \"show_numbers\" \"touch_default/show_weapons\" \"exec touch_default/numbers.cfg\" 0.466667 0.722222 0.550000 0.861111 255 255 255 130 1 1\ntouch_addbutton \"drop\" \"touch/gfx/drop\" \"drop\" 0.050000 0.277778 0.133333 0.416667 255 255 255 130 0 1\n"
  },
  {
    "path": "3rdparty/cs16client-extras/userconfig.d/touch_defalias.cfg",
    "content": "//==============================================================================================\n//  Copyright (c) 2016 Poverennov Sergey aka SergioPoverony and Mikhail Stepanov aka ahsim\n//==============================================================================================\n\ncmd_scripting 1\n\n// TOGGLE CROUCH or STAY\nalias crouchtoggle \"crouchdown\"\nalias crouchdown \"+duck; alias crouchtoggle crouchup\"\nalias crouchup \"-duck; alias crouchtoggle crouchdown\"\n\n// TOGGLE MESSAGES\nalias toggle_chat show_say\nalias show_say \"touch_show say*;alias toggle_chat hide_say\"\nalias hide_say \"touch_hide say*;alias toggle_chat show_say\"\n\n// TOGGLE LIGHT\nalias toggle_light show_light\nalias show_light \"touch_show flight; touch_show nightvision; alias toggle_light hide_light\"\nalias hide_light \"touch_hide flight; touch_hide nightvision; touch_hide plus_nvg; touch_hide minus_nvg; alias toggle_light show_light\"\n\n// TOGGLE PLUS/MINUS\nalias toggle_plusminus show_plusminus\nalias show_plusminus \"touch_show plus_nvg; touch_show minus_nvg;alias toggle_plusminus hide_plusminus\"\nalias hide_plusminus \"touch_hide plus_nvg; touch_hide minus_nvg;alias toggle_plusminus show_plusminus\"\n\nalias toggle_down show_down\nalias show_down \"touch_show cmd; touch_show change_team; touch_show bots; touch_show touch_edit; touch_show exit; alias toggle_down hide_down\"\nalias hide_down \"touch_hide cmd ;touch_hide change_team; touch_hide bots; touch_hide touch_edit; touch_hide exit; alias toggle_down show_down\"\n\n// SCOREBOARD\nalias scoreboard \"exec touch/scoreboard.cfg\"\n\n// SET CVARS FOR MENU\nset enable_controls \"0\"\nset bot_quota_value \"9\"\n"
  },
  {
    "path": "3rdparty/cs16client-extras/userconfig.d/userconfig.cfg",
    "content": "// Default cvars\ncl_nopred 0\ncl_lc 1\ncl_lw 1\ncl_charset utf-8\nhud_utf8 1"
  },
  {
    "path": "CMakeLists.txt",
    "content": "cmake_minimum_required(VERSION 3.10)\nproject(cs16-client)\n\nset(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} \"${CMAKE_CURRENT_SOURCE_DIR}/cmake/\")\n\ninclude(LibraryNaming)\n# include(ExternalProject)\n\n# for extras packaging\nfind_package(Python COMPONENTS Interpreter REQUIRED)\n\nif (Python_FOUND)\n\tmessage(STATUS \"Python interpreter found: ${Python_EXECUTABLE}\")\nelse()\n\tmessage(FATAL_ERROR \"Python not found. Please install Python.\")\nendif()\n\noption(BUILD_CLIENT \"Build client library.\" ON)\noption(BUILD_MAINUI \"Build menu library.\" ON)\noption(BUILD_SERVER \"Build server library.\" ON)\n\nset(GAME_DIR \"cstrike\" CACHE STRING \"Game directory name.\")\nset(CLIENT_INSTALL_DIR \"cl_dlls\" CACHE STRING \"Client library location.\")\nset(SERVER_INSTALL_DIR \"dlls\" CACHE STRING \"Server library location.\")\n\n# if(MSVC AND CMAKE_BUILD_TYPE STREQUAL \"Debug\")\n# \tadd_compile_options(/fsanitize=address)\n# \tadd_link_options(/fsanitize=address)\n# endif()\n\nif(VITA)\n\tmessage(STATUS \"Building for PS Vita\")\n\tadd_compile_options(-fno-use-cxa-atexit)\nendif()\n\nif(BUILD_CLIENT)\n\tadd_subdirectory(cl_dll)\nendif()\n\n# if(CMAKE_BUILD_TYPE STREQUAL \"Debug\")\n# \tset(MESON_BUILD_TYPE debug)\n# elseif(CMAKE_BUILD_TYPE STREQUAL \"RelWithDebInfo\")\n# \tset(MESON_BUILD_TYPE debugoptimized)\n# else()\n# \tset(MESON_BUILD_TYPE release)\n# endif()\n\nif(BUILD_SERVER)\n\t# ExternalProject_Add(\n\t# \tyapb\n\t# \tSOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/yapb\n\t# \tCONFIGURE_COMMAND meson setup --buildtype ${MESON_BUILD_TYPE} build\n\t# \tBUILD_COMMAND meson compile -C build\n\t# \tBUILD_ALWAYS 1\n\t# \tBUILD_IN_SOURCE 1\n\t# \tINSTALL_COMMAND meson install -C build --destdir ${CMAKE_INSTALL_PREFIX}\n\t# )\n\tadd_subdirectory(3rdparty/yapb)\n\tset_target_postfix(yapb)\n\n\tset(XASH_COMPAT ON CACHE BOOL \"\" FORCE)\n\tadd_subdirectory(3rdparty/ReGameDLL_CS)\nendif()\n\nif(BUILD_MAINUI)\n#\tset(CS16CLIENT ON)\n\t# set(XASH_SDK ../../)\n\tadd_subdirectory(3rdparty/mainui_cpp)\nendif()\n\nset(GRAPHS_OUTPUT \"${CMAKE_CURRENT_BINARY_DIR}/graphs\")\n\nexecute_process(\n\tCOMMAND ${Python_EXECUTABLE}\n\t${CMAKE_CURRENT_SOURCE_DIR}/scripts/yapb_graph_dl.py\n\t${GRAPHS_OUTPUT}/addons/yapb/data/graph\n)\n\nset(EXTRAS_DIR \"${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/cs16client-extras\")\nset(YAPB_DIR \"${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/yapb/cfg\")\n\nif(ANDROID)\n\tset(EXTRAS_OUTPUT \"${CMAKE_CURRENT_SOURCE_DIR}/android/app/src/main/assets\")\n\n\tfile(GLOB EXTRAS_FILES \"${EXTRAS_DIR}/*\")\n\tfile(GLOB YAPB_FILES \"${YAPB_DIR}/*\" \"${GRAPHS_OUTPUT}/*\")\n\n\tfile(REMOVE_RECURSE ${EXTRAS_OUTPUT})\n\tfile(\n\t\tCOPY ${EXTRAS_FILES} ${YAPB_FILES}\n\t\tDESTINATION ${EXTRAS_OUTPUT}\n\t)\nelse()\n\tset(EXTRAS_OUTPUT \"${CMAKE_CURRENT_BINARY_DIR}/extras.pk3\")\n\n\texecute_process(\n\t\tCOMMAND ${Python_EXECUTABLE}\n\t\t${CMAKE_CURRENT_SOURCE_DIR}/scripts/pack_extras.py\n\t\t${EXTRAS_OUTPUT}\n\t\t${EXTRAS_DIR}\n\t\t${YAPB_DIR}\n\t\t${GRAPHS_OUTPUT}\n\t)\n\n\tadd_custom_target(generate_extras ALL\n\t\tDEPENDS ${GRAPHS_OUTPUT} ${EXTRAS_OUTPUT}\n\t)\n\n\tinstall(\n\t\tFILES \"${EXTRAS_OUTPUT}\"\n\t\tDESTINATION ${GAME_DIR}\n\t)\nendif()\n\nif(VITA)\n\tinstall(\n\t\tFILES\n\t\t\"${CMAKE_CURRENT_BINARY_DIR}/config.cfg\"\n\t\t\"${CMAKE_CURRENT_BINARY_DIR}/video.cfg\"\n\t\t\"${CMAKE_CURRENT_BINARY_DIR}/opengl.cfg\"\n\t\tDESTINATION \"${GAME_DIR}/\"\n\t)\n\n\tinstall(\n\t\tFILES\n\t\t\"${CMAKE_CURRENT_BINARY_DIR}/kb_def.lst\"\n\t\tDESTINATION \"${GAME_DIR}/gfx/shell\"\n\t)\nendif()\n\nif(WIN32)\n\tset(CPACK_GENERATOR \"ZIP\")\n\tset(CPACK_PACKAGE_FILE_NAME \"CS16Client-${CMAKE_SYSTEM_NAME}-${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}\")\nelseif(VITA)\n\tset(CPACK_GENERATOR \"ZIP\")\n\tset(CPACK_PACKAGE_FILE_NAME \"CS16Client-PSVita\")\nelseif(APPLE)\n\tset(CPACK_GENERATOR \"ZIP\")\n\tset(CPACK_PACKAGE_FILE_NAME \"CS16Client-macOS-${CMAKE_SYSTEM_PROCESSOR}\")\nelse()\n\tset(CPACK_GENERATOR \"TGZ\")\n\tset(CPACK_PACKAGE_FILE_NAME \"CS16Client-${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}\")\nendif()\n\nset(CPACK_INCLUDE_TOPLEVEL_DIRECTORY OFF)\n\ninclude(CPack)"
  },
  {
    "path": "CMakePresets.json",
    "content": "{\n  \"version\": 3,\n  \"cmakeMinimumRequired\": {\n    \"major\": 3,\n    \"minor\": 21,\n    \"patch\": 0\n  },\n  \"configurePresets\": [\n    {\n      \"name\": \"win32-debug-amd64\",\n      \"displayName\": \"Windows Debug - amd64\",\n      \"generator\": \"Ninja\",\n      \"architecture\": {\n        \"value\": \"x64\",\n        \"strategy\": \"external\"\n      },\n      \"binaryDir\": \"${sourceDir}/build\",\n      \"cacheVariables\": {\n        \"CMAKE_BUILD_TYPE\": \"Debug\",\n        \"CMAKE_C_COMPILER\": \"cl\",\n        \"CMAKE_CXX_COMPILER\": \"cl\"\n      },\n      \"vendor\": {\n        \"microsoft.com/VisualStudioSettings/CMake/1.0\": {\n          \"hostOS\": [\n            \"Windows\"\n          ]\n        }\n      }\n    },\n    {\n      \"name\": \"win32-debug-x86\",\n      \"inherits\": \"win32-debug-amd64\",\n      \"displayName\": \"Windows Debug - x86\",\n      \"architecture\": {\n        \"value\": \"x86\",\n        \"strategy\": \"external\"\n      }\n    },\n    {\n      \"name\": \"win32-release-amd64\",\n      \"inherits\": \"win32-debug-amd64\",\n      \"displayName\": \"Windows Release - amd64\",\n      \"cacheVariables\": {\n        \"CMAKE_BUILD_TYPE\": \"Release\"\n      }\n    },\n    {\n      \"name\": \"win32-release-x86\",\n      \"inherits\": \"win32-debug-x86\",\n      \"displayName\": \"Windows Release - x86\",\n      \"cacheVariables\": {\n        \"CMAKE_BUILD_TYPE\": \"Release\"\n      }\n    },\n    {\n      \"name\": \"linux-release-amd64\",\n      \"displayName\": \"Linux Release - amd64\",\n      \"generator\": \"Ninja\",\n      \"architecture\": {\n        \"value\": \"x64\",\n        \"strategy\": \"external\"\n      },\n      \"cacheVariables\": {\n        \"CMAKE_BUILD_TYPE\": \"Release\"\n      },\n      \"binaryDir\": \"${sourceDir}/build\"\n    },\n    {\n      \"name\": \"linux-release-i386\",\n      \"inherits\": \"linux-release-amd64\",\n      \"displayName\": \"Linux Release - i386\",\n      \"architecture\": {\n        \"value\": \"x86\",\n        \"strategy\": \"external\"\n      },\n      \"toolchainFile\": \"${sourceDir}/toolchains/i386-linux-gnu.cmake\"\n    },\n    {\n      \"name\": \"psvita-debug\",\n      \"displayName\": \"PS Vita - Debug\",\n      \"generator\": \"Unix Makefiles\",\n      \"toolchainFile\": \"$env{VITASDK}/share/vita.toolchain.cmake\",\n      \"cacheVariables\": {\n        \"CMAKE_BUILD_TYPE\": \"Debug\",\n        \"BUILD_SERVER\": \"OFF\",\n        \"MAINUI_USE_STB\": \"ON\",\n        \"CMAKE_PROJECT_cs16-client_INCLUDE\": \"$env{VITASDK}/share/vrtld_shim.cmake\"\n      },\n      \"binaryDir\": \"${sourceDir}/build\"\n    },\n    {\n      \"name\": \"psvita-release\",\n      \"displayName\": \"PS Vita - Release\",\n      \"generator\": \"Unix Makefiles\",\n      \"toolchainFile\": \"$env{VITASDK}/share/vita.toolchain.cmake\",\n      \"cacheVariables\": {\n        \"CMAKE_BUILD_TYPE\": \"Release\",\n        \"BUILD_SERVER\": \"OFF\",\n        \"MAINUI_USE_STB\": \"ON\",\n        \"CMAKE_PROJECT_cs16-client_INCLUDE\": \"$env{VITASDK}/share/vrtld_shim.cmake\"\n      },\n      \"binaryDir\": \"${sourceDir}/build\"\n    },\n    {\n      \"name\": \"linux-ci-amd64\",\n      \"inherits\": \"linux-release-amd64\",\n      \"displayName\": \"Linux CI - amd64\",\n      \"cacheVariables\": {\n        \"CMAKE_BUILD_TYPE\": \"RelWithDebInfo\"\n      }\n    },\n    {\n      \"name\": \"linux-ci-i386\",\n      \"inherits\": \"linux-release-i386\",\n      \"displayName\": \"Linux CI - i386\",\n      \"cacheVariables\": {\n        \"CMAKE_BUILD_TYPE\": \"RelWithDebInfo\"\n      }\n    },\n    {\n      \"name\": \"win32-ci-amd64\",\n      \"inherits\": \"win32-debug-amd64\",\n      \"displayName\": \"Windows CI - amd64\",\n      \"cacheVariables\": {\n        \"CMAKE_BUILD_TYPE\": \"RelWithDebInfo\"\n      }\n    },\n    {\n      \"name\": \"win32-ci-x86\",\n      \"inherits\": \"win32-debug-x86\",\n      \"displayName\": \"Windows CI - x86\",\n      \"cacheVariables\": {\n        \"CMAKE_BUILD_TYPE\": \"RelWithDebInfo\"\n      }\n    },\n    {\n      \"name\": \"macos-ci-x86_64\",\n      \"displayName\": \"macOS CI - x86_64\",\n      \"generator\": \"Ninja\",\n      \"architecture\": {\n        \"value\": \"x64\",\n        \"strategy\": \"external\"\n      },\n      \"cacheVariables\": {\n        \"CMAKE_BUILD_TYPE\": \"RelWithDebInfo\",\n        \"CMAKE_C_COMPILER\": \"gcc\",\n        \"CMAKE_CXX_COMPILER\": \"g++\",\n        \"CMAKE_CXX_STANDARD\": \"11\",\n        \"CMAKE_CXX_STANDARD_REQUIRED\": \"ON\"\n      },\n      \"binaryDir\": \"${sourceDir}/build\"\n    },\n    {\n      \"name\": \"macos-ci-arm64\",\n      \"inherits\": \"macos-ci-x86_64\",\n      \"displayName\": \"macOS CI - arm64\",\n      \"architecture\": {\n        \"value\": \"arm64\",\n        \"strategy\": \"external\"\n      }\n    }\n  ]\n}"
  },
  {
    "path": "LICENSE",
    "content": "CS16Client LICENSE\n==================\n\nCopyright (C) 2015-2016 Flying With Gauss\n\nThis program is free software; you can redistribute it and/or modify it\nunder the terms of the GNU General Public License as published by the\nFree Software Foundation; either version 2 of the License, or (at\nyour option) any later version.\n\nThis program is distributed in the hope that it will be useful, but\nWITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\nGeneral Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with this program; if not, write to the Free Software Foundation,\nInc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\n\nIn addition, as a special exception, the author gives permission to\nlink the code of this program with the Half-Life Game Engine (\"HL\nEngine\") and Modified Game Libraries (\"MODs\") developed by Valve,\nL.L.C (\"Valve\").  You must obey the GNU General Public License in all\nrespects for all of the code used other than the HL Engine and MODs\nfrom Valve.  If you modify this file, you may extend this exception\nto your version of the file, but you are not obligated to do so.  If\nyou do not wish to do so, delete this exception statement from your\nversion.\n\n\nHalf Life 1 SDK LICENSE\n======================\n\nHalf Life 1 SDK Copyright(C) Valve Corp.  \n\nTHIS DOCUMENT DESCRIBES A CONTRACT BETWEEN YOU AND VALVE CORPORATION (?Valve?).  PLEASE READ IT BEFORE DOWNLOADING OR USING THE HALF LIFE 1 SDK (?SDK?). BY DOWNLOADING AND/OR USING THE SOURCE ENGINE SDK YOU ACCEPT THIS LICENSE. IF YOU DO NOT AGREE TO THE TERMS OF THIS LICENSE PLEASE DON?T DOWNLOAD OR USE THE SDK.\n\nYou may, free of charge, download and use the SDK to develop a modified Valve game running on the Source engine.  You may distribute your modified Valve game in source and object code form, but only for free. Terms of use for Valve games are found in the Steam Subscriber Agreement located here: http://store.steampowered.com/subscriber_agreement/ \n\nYou may copy, modify, and distribute the SDK and any modifications you make to the SDK in source and object code form, but only for free.  Any distribution of this SDK must include this license.txt and third_party_licenses.txt.  \n \nAny distribution of the SDK or a substantial portion of the SDK must include the above copyright notice and the following: \n\nDISCLAIMER OF WARRANTIES.  THE SOURCE SDK AND ANY OTHER MATERIAL DOWNLOADED BY LICENSEE IS PROVIDED ?AS IS?.  VALVE AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES WITH RESPECT TO THE SDK, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY, NON-INFRINGEMENT, TITLE AND FITNESS FOR A PARTICULAR PURPOSE.  \n\nLIMITATION OF LIABILITY.  IN NO EVENT SHALL VALVE OR ITS SUPPLIERS BE LIABLE FOR ANY SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR INABILITY TO USE THE ENGINE AND/OR THE SDK, EVEN IF VALVE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.  \n \n \nIf you would like to use the SDK for a commercial purpose, please contact Valve at sourceengine@valvesoftware.com.\n"
  },
  {
    "path": "README.md",
    "content": "# CS16Client [![Build Status](https://github.com/Velaron/cs16-client/actions/workflows/build.yml/badge.svg)](https://github.com/Velaron/cs16-client/actions) <img align=\"right\" width=\"128\" height=\"128\" src=\"https://github.com/Velaron/cs16-client/raw/main/android/app/src/main/ic_launcher-playstore.png\" alt=\"CS16Client\" />\nReverse-engineered Counter Strike 1.6 client, designed for mobile platforms and other officially non-supported platforms.\n\n## Donate\n[![Boosty.to](https://img.shields.io/badge/Boosty-F15F2C?logo=boosty&logoColor=fff&style=for-the-badge)](https://boosty.to/velaron)\n\n[Support me](https://boosty.to/velaron) on Boosty.to, if you like my work and would like to support further development goals, like reverse-engineering other great mods.\n\nImportant contributors:\n* [a1batross](https://github.com/a1batross), initial project creator and maintainer.\n* [jeefo](https://github.com/jeefo), the creator of [YaPB](https://github.com/yapb/yapb).\n* The people behind [ReGameDLL_CS](https://github.com/rehlds/ReGameDLL_CS) project.\n* [Vladislav4KZ](https://github.com/Vladislav4KZ), bug-tester and maintainer.\n* [SNMetamorph](https://github.com/SNMetamorph), author of the PSVita port.\n* [Alprnn357](https://github.com/Alprnn357), touch menus maintainer.\n* [wh1tesh1t](https://github.com/wh1tesh1t), [pwd491](https://github.com/pwd491), [Elinsrc](https://github.com/Elinsrc), [xiaodo1337](https://github.com/xiaodo1337), [nekonomicon](https://github.com/nekonomicon), [lewa-j](https://github.com/lewa-j) and others for minor contributions.\n\n## Download\nYou can download a build at the `Releases` section, or use these links for common platforms:\n* [Android](https://github.com/Velaron/cs16-client/releases/download/continuous/CS16Client-Android.apk)\n* [Linux](https://github.com/Velaron/cs16-client/releases/download/continuous/CS16Client-Linux-i386.tar.gz)\n* [Windows](https://github.com/Velaron/cs16-client/releases/download/continuous/CS16Client-Windows-X86.zip)\n* [PS Vita](https://github.com/Velaron/cs16-client/releases/download/continuous/CS16Client-PSVita.zip)\n* [macOS (arm64)](https://github.com/Velaron/cs16-client/releases/download/continuous/CS16Client-macOS-arm64.zip) - not tested\n* [macOS (x86_64)](https://github.com/Velaron/cs16-client/releases/download/continuous/CS16Client-macOS-x86_64.zip) - not tested\n\n[Other platforms...](https://github.com/Velaron/cs16-client/releases/tag/continuous)\n\n## Installation\nTo run CS16Client you need the [latest developer build of Xash3D FWGS](https://github.com/FWGS/xash3d-fwgs/releases/tag/continuous).\nYou have to own the [game on Steam](https://store.steampowered.com/app/10/CounterStrike//) and copy `valve` and `cstrike` folders into your Xash3D FWGS directory.\nAfter that, just install the APK and run.\n\n## Configuration (CVars)\n| CVar                     | Default       | Min | Max | Description                                                                                 |\n|--------------------------|---------------|-----|-----|---------------------------------------------------------------------------------------------|\n| hud_color                | \"255 160 0\"   | -   | -   | HUD color in RGB.                                                                           |\n| cl_quakeguns             | 0             | 0   | 1   | Draw centered weapons.                                                                      |\n| cl_weaponlag             | 0             | 0.0 | -   | Enable weapon lag/sway.                                                                     |\n| xhair_additive           | 0             | 0   | 1   | Makes the crosshair additive.                                                               |\n| xhair_color              | \"0 255 0 255\" | -   | -   | Crosshair's color (RGBA).                                                                   |\n| xhair_dot                | 0             | 0   | 1   | Enables crosshair dot.                                                                      |\n| xhair_dynamic_move       | 1             | 0   | 1   | Jumping, crouching and moving will affect the dynamic crosshair (like cl_dynamiccrosshair). |\n| xhair_dynamic_scale      | 0             | 0   | -   | Scale of the dynamic crosshair movement.                                                    |\n| xhair_gap_useweaponvalue | 0             | 0   | 1   | Makes the crosshair gap scale depend on the active weapon.                                  |\n| xhair_enable             | 0             | 0   | 1   | Enables enhanced crosshair.                                                                 |\n| xhair_gap                | 0             | 0   | 15  | Space between crosshair's lines.                                                            |\n| xhair_pad                | 0             | 0   | -   | Border around crosshair.                                                                    |\n| xhair_size               | 4             | 0   | -   | Crosshair size.                                                                             |\n| xhair_t                  | 0             | 0   | 1   | Enables T-shaped crosshair.                                                                 |\n| xhair_thick              | 0             | 0   | -   | Crosshair thickness.                                                                        |\n\n## Building\nClone the source code:\n```shell\ngit clone https://github.com/Velaron/cs16-client --recursive\n```\n\n### Using CMakePresets.json\n```shell\ncmake --preset <preset-name>\ncmake --build build\ncmake --install build --prefix <path-to-your-installation>\n```\n\n### Windows\n```shell\ncmake -A Win32 -S . -B build\ncmake --build build --config Release\ncmake --install build --prefix <path-to-your-installation>\n```\n### Linux and macOS\n```shell\ncmake -S . -B build\ncmake --build build --config Release\ncmake --install build --prefix <path-to-your-installation>\n```\n### Android\n```shell\ncd android\n./gradlew assembleRelease\n```\n"
  },
  {
    "path": "android/app/build.gradle",
    "content": "import java.time.LocalDateTime\nimport java.time.Month\nimport java.time.temporal.ChronoUnit\n\napply plugin: \"com.android.application\"\n\nandroid {\n\tnamespace = \"su.xash.cs16client\"\n\tndkVersion = \"28.2.13676358\"\n\tcompileSdk = 36\n\n\tdefaultConfig {\n\t\tapplicationId = \"su.xash.cs16client\"\n\t\tversionName = \"1.35-\" + getGitHash()\n\t\tversionCode = getBuildNum()\n\t\tminSdk = 21\n\t\ttargetSdk = 36\n\t}\n\n\tcompileOptions {\n\t\tsourceCompatibility = JavaVersion.VERSION_11\n\t\ttargetCompatibility = JavaVersion.VERSION_11\n\t}\n\n\texternalNativeBuild {\n\t\tcmake {\n\t\t\tversion = \"3.22.1\"\n\t\t\tpath file(\"../../CMakeLists.txt\")\n\t\t}\n\t}\n\n\tlint {\n\t\tabortOnError = false\n\t}\n\n\tpackaging {\n\t\tjniLibs {\n\t\t\tkeepDebugSymbols.add(\"**/*.so\")\n\t\t\tuseLegacyPackaging = true\n\t\t}\n\t}\n\n\tsigningConfigs {\n\t\tdebug {}\n\n\t\tcontinuous {\n\t\t\tif (System.getenv('KEYSTORE_FILE_PATH') != null) {\n\t\t\t\tstoreFile = file(System.getenv('KEYSTORE_FILE_PATH'))\n\t\t\t\tstorePassword = System.getenv('KEYSTORE_PASSWORD')\n\t\t\t\tkeyAlias = System.getenv('KEY_ALIAS')\n\t\t\t\tkeyPassword = System.getenv('KEY_PASSWORD')\n\t\t\t}\n\t\t}\n\t}\n\n\tbuildTypes {\n\t\tdebug {\n\t\t\tdebuggable = true\n\t\t\tapplicationIdSuffix = \".test\"\n\n\t\t\tproguardFiles getDefaultProguardFile(\"proguard-android.txt\"), \"proguard-rules.txt\"\n\t\t}\n\n\t\trelease {\n\t\t\tminifyEnabled = true\n\t\t\tshrinkResources = true\n\n\t\t\tproguardFiles getDefaultProguardFile(\"proguard-android.txt\"), \"proguard-rules.txt\"\n\t\t}\n\n\t\tcreate(\"continuous\") {\n\t\t\tinitWith(getByName(\"release\"))\n\t\t\tapplicationIdSuffix = \".test\"\n\t\t\tsigningConfig = signingConfigs.continuous\n\t\t}\n\t}\n\n\tflavorDimensions += \"version\"\n\n\tproductFlavors {\n\t\tcreate(\"googlePlay\") {\n\t\t\tdimension = \"version\"\n\t\t\tapplicationId = \"in.celest.xash3d.cs16client\"\n\t\t\tbuildConfigField(\"Boolean\", \"IS_GOOGLE_PLAY_BUILD\", \"true\")\n\t\t}\n\n\t\tcreate(\"git\") {\n\t\t\tdimension = \"version\"\n\t\t\tbuildConfigField(\"Boolean\", \"IS_GOOGLE_PLAY_BUILD\", \"false\")\n\t\t}\n\t}\n\n\tbuildFeatures {\n\t\tbuildConfig = true\n\t}\n}\n\nstatic def getBuildNum() {\n\tLocalDateTime now = LocalDateTime.now()\n\tLocalDateTime releaseDate = LocalDateTime.of(2015, Month.OCTOBER, 29, 0, 0, 0)\n\tint qBuildNum = releaseDate.until(now, ChronoUnit.DAYS)\n\tint minuteOfDay = now.getHour() * 60 + now.getMinute()\n\treturn qBuildNum * 10000 + minuteOfDay\n}\n\ndef getGitHash() {\n\tProcess process = new ProcessBuilder(\"git\", \"rev-parse\", \"--short\", \"HEAD\")\n\t\t\t.directory(project.rootDir)\n\t\t\t.redirectErrorStream(true)\n\t\t\t.start()\n\tInputStreamReader inputStreamReader = new InputStreamReader(process.getInputStream())\n\tBufferedReader bufferedReader = new BufferedReader(inputStreamReader)\n\n\treturn bufferedReader.getText().trim()\n}"
  },
  {
    "path": "android/app/src/main/AndroidManifest.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:tools=\"http://schemas.android.com/tools\">\n\n    <application\n        android:forceQueryable=\"true\"\n        android:icon=\"@mipmap/ic_launcher\"\n        android:label=\"@string/app_name\"\n        android:roundIcon=\"@mipmap/ic_launcher\"\n        tools:targetApi=\"r\">\n\n        <activity\n            android:name=\".MainActivity\"\n            android:exported=\"true\">\n            <intent-filter>\n                <action android:name=\"android.intent.action.MAIN\" />\n\n                <category android:name=\"android.intent.category.LAUNCHER\" />\n            </intent-filter>\n\n            <intent-filter>\n                <action android:name=\"su.xash.engine.MOD\" />\n            </intent-filter>\n        </activity>\n\n\t\t<activity\n\t\t\tandroid:name=\".CZeroActivity\"\n\t\t\tandroid:icon=\"@mipmap/ic_launcher_cz\"\n\t\t\tandroid:label=\"CSCZClient\"\n\t\t\tandroid:roundIcon=\"@mipmap/ic_launcher_cz\"\n\t\t\tandroid:exported=\"true\">\n\t\t\t<intent-filter>\n\t\t\t\t<action android:name=\"android.intent.action.MAIN\" />\n\n\t\t\t\t<category android:name=\"android.intent.category.LAUNCHER\" />\n\t\t\t</intent-filter>\n\n\t\t\t<intent-filter>\n\t\t\t\t<action android:name=\"su.xash.engine.MOD\" />\n\t\t\t</intent-filter>\n\t\t</activity>\n    </application>\n\n    <queries>\n        <package android:name=\"su.xash.engine\" />\n        <package android:name=\"su.xash.engine.test\" />\n    </queries>\n</manifest>"
  },
  {
    "path": "android/app/src/main/java/su/xash/cs16client/CZeroActivity.java",
    "content": "package su.xash.cs16client;\n\nimport android.app.Activity;\nimport android.content.ComponentName;\nimport android.content.Intent;\nimport android.content.pm.PackageManager;\nimport android.net.Uri;\nimport android.os.Bundle;\n\npublic class CZeroActivity extends Activity {\n    @Override\n    protected void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n\n        String pkg = \"su.xash.engine.test\";\n\n        try {\n            getPackageManager().getPackageInfo(pkg, 0);\n        } catch (PackageManager.NameNotFoundException e) {\n            try {\n                pkg = \"su.xash.engine\";\n                getPackageManager().getPackageInfo(pkg, 0);\n            } catch (PackageManager.NameNotFoundException ex) {\n                startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(\"https://github.com/FWGS/xash3d-fwgs/releases/tag/continuous\")).setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK));\n                finish();\n                return;\n            }\n        }\n\n        startActivity(new Intent().setComponent(new ComponentName(pkg, \"su.xash.engine.XashActivity\"))\n                .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK)\n                .putExtra(\"gamedir\", \"czero\")\n                .putExtra(\"gamelibdir\", getApplicationInfo().nativeLibraryDir)\n                .putExtra(\"argv\", \"-dev 2 -log -dll @yapb\")\n                .putExtra(\"package\", getPackageName()));\n        finish();\n    }\n}\n"
  },
  {
    "path": "android/app/src/main/java/su/xash/cs16client/MainActivity.java",
    "content": "package su.xash.cs16client;\n\nimport android.app.Activity;\nimport android.content.ComponentName;\nimport android.content.Intent;\nimport android.content.pm.PackageManager;\nimport android.net.Uri;\nimport android.os.Bundle;\n\npublic class MainActivity extends Activity {\n    @Override\n    protected void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n\n        String pkg = \"su.xash.engine.test\";\n\n        try {\n            getPackageManager().getPackageInfo(pkg, 0);\n        } catch (PackageManager.NameNotFoundException e) {\n            try {\n                pkg = \"su.xash.engine\";\n                getPackageManager().getPackageInfo(pkg, 0);\n            } catch (PackageManager.NameNotFoundException ex) {\n                startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(\"https://github.com/FWGS/xash3d-fwgs/releases/tag/continuous\")).setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK));\n                finish();\n                return;\n            }\n        }\n\n        startActivity(new Intent().setComponent(new ComponentName(pkg, \"su.xash.engine.XashActivity\"))\n                .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK)\n                .putExtra(\"gamedir\", \"cstrike\")\n                .putExtra(\"gamelibdir\", getApplicationInfo().nativeLibraryDir)\n                .putExtra(\"argv\", \"-dev 2 -log -dll @yapb\")\n                .putExtra(\"package\", getPackageName()));\n        finish();\n    }\n}\n"
  },
  {
    "path": "android/app/src/main/res/drawable/ic_launcher_cz_foreground.xml",
    "content": "<vector xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:width=\"108dp\"\n    android:height=\"108dp\"\n    android:viewportWidth=\"432\"\n    android:viewportHeight=\"432\">\n  <group android:scaleX=\"0.99\"\n      android:scaleY=\"0.99\"\n      android:translateX=\"6.12\"\n      android:translateY=\"2.16\">\n    <path\n        android:pathData=\"M282.5,151.1v-6.7h-3v3.2h-6.9v-3h-1.8v2.6h-6.7v-4.2h-1.4v-0.8h-1.2v2.4h-1.4v1.2h-8.3v-1.4h-7.6v-2.8h-4v1.4h-7.2c-0.5,0.6 -1,1.1 -1.4,1.6 -0.7,0.9 -1.3,1.9 -1.8,2.8h-4l-4.1,-0.7 -0.2,1.6c0.4,-3.3 0.7,-5.5 0.5,-5.7 -0.9,-1.6 1.7,-4.6 2.1,-5.1l2.2,-3.6 -2.3,-4.9c-3.7,-7.9 -9.2,-12.2 -14.5,-11.3 -5.4,1 -6.8,1.6 -10.5,4.9 -3,2.8 -4.1,4.7 -5,8.8 -0.6,2.9 -0.8,6 -0.4,6.9 0.4,1.1 0,1.7 -0.9,1.7s-4.6,3.9 -8.5,8.6l-6.9,8.5 -1.2,9.2c-1.2,8.4 -5.1,29 -6.7,34.4 -0.4,1.4 -0.2,2.3 0.5,2.3s0.9,1.3 0.5,3.7c-0.3,2.1 0,5.1 0.5,6.6 0.9,2.2 0.6,4.4 -1.5,11.5 -1.4,4.8 -4.5,15.6 -6.7,23.9 -3.9,14 -4.4,15.4 -7,16.4 -3.5,1.5 -11.8,10.6 -14.4,15.8l-2,4.1 2.1,7.1c1.8,6.1 2.7,7.6 5.7,9.6s4.3,2.3 7.8,1.7c5.2,-0.8 6.9,-3.9 5.2,-9.5 -0.6,-2 -1.1,-3.9 -1.1,-4.3s3.1,-0.6 6.9,-0.6c6.3,0 7,-0.2 7.7,-2.3 0.4,-1.2 2.5,-6 4.6,-10.6 2.2,-4.6 4.6,-10.7 5.3,-13.5 2.2,-8.2 11.7,-30.6 13,-30.6 2.3,0 6.4,4.1 11.9,11.8 3,4.2 7.5,9.7 10,12.1 2.6,2.6 4.8,5.7 5.1,7.5 0.4,1.7 2.2,9.4 4.2,17.1 2.2,9.1 3.3,15.2 2.9,17.5 -0.7,4.7 2.7,9.6 9.9,13.9 5.2,3.2 6,3.3 10.3,2.5 6.3,-1.2 6.5,-3.4 1.4,-12.3 -3.6,-6.2 -4.1,-7.9 -4.7,-15.8 -0.3,-4.8 -1.3,-11.6 -2.1,-15 -0.8,-3.5 -1.4,-8.2 -1.3,-10.5 0,-3.6 -0.6,-5.4 -4.2,-10.8 -2.3,-3.6 -5.8,-8.3 -7.6,-10.6 -3.7,-4.6 -4.1,-6.8 -1.6,-8.3 1.6,-0.8 1.6,-1.2 -0.2,-4.6 -1.1,-2 -4.2,-6.2 -6.8,-9.3 -2.7,-3.1 -5.6,-7 -6.5,-8.5 -1.3,-2.1 -2.2,-2.7 -3.9,-2.2 -2.2,0.5 -2.3,0.2 -2.3,-4.4s0.4,-5.1 2,-5.6c2.2,-0.7 2.8,-2.6 3.2,-9.5l0.3,-4.5s0.4,-2.5 0.9,-6.2v1c-0.1,0 4.2,0 4.2,0q0,0.2 0,0l10.9,0.8c0.9,-0.4 1.8,-0.9 2.6,-1.4 1.8,-0.9 3.2,-2 4.4,-3 0.1,-0.1 0.4,-0.3 0.8,-0.4 0.4,0 0.7,-0.3 0.8,-0.4 1.6,-1.6 2.7,-2.7 3.4,-3.3s1.1,-1 1.4,-1 0.4,0 0.6,0.1h1.4c0.8,0 1.5,-0.1 2.1,-0.1s1.1,-0.2 1.7,-0.3c0.6,0 1.1,-0.3 1.6,-0.4l1.8,-3.2c0.3,-0.4 0.5,-0.7 0.6,-0.8 0.3,-0.2 0.5,0 0.6,0.8 0.3,1.1 0.8,3.1 1.7,5.9 0.9,2.8 2.5,6 4.7,9.6l4.2,-2c-1.5,-2.5 -2.7,-5 -3.6,-7.2 -1,-1.9 -1.7,-3.8 -2.2,-5.8s-0.7,-3.6 -0.4,-4.6c0.4,0 0.9,0 1.4,-0.2 0.4,-0.2 0.9,-0.3 1.4,-0.5 0.6,-0.2 1.1,-0.4 1.6,-0.7 0.9,-0.5 1.5,-1.4 1.8,-2.4 0.2,-0.6 0.2,-1.1 0.2,-1.6h20.5v-4.2h-5.2,0.1ZM240.4,156.3c-0.8,0.8 -1.8,1.5 -3,2 -1.5,0.7 -2.6,1.1 -3.5,1.5s-1.6,0.6 -2.3,0.7c-0.8,0.3 -1.4,0.8 -1.9,1.5 -0.5,0.8 -1,1.1 -1.7,1.1h0.2c-0.3,0.2 -0.8,0.2 -1.5,0.2s-1.4,0 -2.1,0.2c-0.9,0 -0.4,-6 0.3,-6.4 0.6,-0.3 1.1,-0.6 1.8,-0.9s1.3,-0.6 2,-0.9 1.7,-0.4 3,-0.3h4.2c1.5,0.2 3.3,0.2 5.3,0.2 -0.1,0.3 -0.4,0.6 -0.8,1h0Z\"\n        android:fillColor=\"#152036\"/>\n  </group>\n</vector>\n"
  },
  {
    "path": "android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<adaptive-icon xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <background android:drawable=\"@color/ic_launcher_background\"/>\n    <foreground android:drawable=\"@mipmap/ic_launcher_foreground\"/>\n    <monochrome android:drawable=\"@mipmap/ic_launcher_monochrome\"/>\n</adaptive-icon>"
  },
  {
    "path": "android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_cz.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<adaptive-icon xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <background android:drawable=\"@color/ic_launcher_cz_background\"/>\n    <foreground android:drawable=\"@drawable/ic_launcher_cz_foreground\"/>\n</adaptive-icon>"
  },
  {
    "path": "android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_cz_round.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<adaptive-icon xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <background android:drawable=\"@color/ic_launcher_cz_background\"/>\n    <foreground android:drawable=\"@drawable/ic_launcher_cz_foreground\"/>\n</adaptive-icon>"
  },
  {
    "path": "android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_foreground.xml",
    "content": "<vector xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:width=\"432dp\"\n    android:height=\"432dp\"\n    android:viewportWidth=\"432\"\n    android:viewportHeight=\"432\">\n  <path\n      android:pathData=\"M282.5,151.1v-6.7h-3v3.2h-6.9v-3h-1.8v2.6h-6.7v-4.2h-1.4v-0.8h-1.2v2.4h-1.4v1.2h-8.3v-1.4h-7.6v-2.8h-4v1.4h-7.2c-0.5,0.6 -1,1.1 -1.4,1.6 -0.7,0.9 -1.3,1.9 -1.8,2.8h-4l-4.1,-0.7 -0.2,1.6c0.4,-3.3 0.7,-5.5 0.5,-5.7 -0.9,-1.6 1.7,-4.6 2.1,-5.1l2.2,-3.6 -2.3,-4.9c-3.7,-7.9 -9.2,-12.2 -14.5,-11.3 -5.4,1 -6.8,1.6 -10.5,4.9 -3,2.8 -4.1,4.7 -5,8.8 -0.6,2.9 -0.8,6 -0.4,6.9 0.4,1.1 0,1.7 -0.9,1.7s-4.6,3.9 -8.5,8.6l-6.9,8.5 -1.2,9.2c-1.2,8.4 -5.1,29 -6.7,34.4 -0.4,1.4 -0.2,2.3 0.5,2.3s0.9,1.3 0.5,3.7c-0.3,2.1 0,5.1 0.5,6.6 0.9,2.2 0.6,4.4 -1.5,11.5 -1.4,4.8 -4.5,15.6 -6.7,23.9 -3.9,14 -4.4,15.4 -7,16.4 -3.5,1.5 -11.8,10.6 -14.4,15.8l-2,4.1 2.1,7.1c1.8,6.1 2.7,7.6 5.7,9.6s4.3,2.3 7.8,1.7c5.2,-0.8 6.9,-3.9 5.2,-9.5 -0.6,-2 -1.1,-3.9 -1.1,-4.3s3.1,-0.6 6.9,-0.6c6.3,0 7,-0.2 7.7,-2.3 0.4,-1.2 2.5,-6 4.6,-10.6 2.2,-4.6 4.6,-10.7 5.3,-13.5 2.2,-8.2 11.7,-30.6 13,-30.6 2.3,0 6.4,4.1 11.9,11.8 3,4.2 7.5,9.7 10,12.1 2.6,2.6 4.8,5.7 5.1,7.5 0.4,1.7 2.2,9.4 4.2,17.1 2.2,9.1 3.3,15.2 2.9,17.5 -0.7,4.7 2.7,9.6 9.9,13.9 5.2,3.2 6,3.3 10.3,2.5 6.3,-1.2 6.5,-3.4 1.4,-12.3 -3.6,-6.2 -4.1,-7.9 -4.7,-15.8 -0.3,-4.8 -1.3,-11.6 -2.1,-15 -0.8,-3.5 -1.4,-8.2 -1.3,-10.5 0,-3.6 -0.6,-5.4 -4.2,-10.8 -2.3,-3.6 -5.8,-8.3 -7.6,-10.6 -3.7,-4.6 -4.1,-6.8 -1.6,-8.3 1.6,-0.8 1.6,-1.2 -0.2,-4.6 -1.1,-2 -4.2,-6.2 -6.8,-9.3 -2.7,-3.1 -5.6,-7 -6.5,-8.5 -1.3,-2.1 -2.2,-2.7 -3.9,-2.2 -2.2,0.5 -2.3,0.2 -2.3,-4.4s0.4,-5.1 2,-5.6c2.2,-0.7 2.8,-2.6 3.2,-9.5l0.3,-4.5s0.4,-2.5 0.9,-6.2v1c-0.1,0 4.2,0 4.2,0q0,0.2 0,0l10.9,0.8c0.9,-0.4 1.8,-0.9 2.6,-1.4 1.8,-0.9 3.2,-2 4.4,-3 0.1,-0.1 0.4,-0.3 0.8,-0.4 0.4,0 0.7,-0.3 0.8,-0.4 1.6,-1.6 2.7,-2.7 3.4,-3.3s1.1,-1 1.4,-1 0.4,0 0.6,0.1h1.4c0.8,0 1.5,-0.1 2.1,-0.1s1.1,-0.2 1.7,-0.3c0.6,0 1.1,-0.3 1.6,-0.4l1.8,-3.2c0.3,-0.4 0.5,-0.7 0.6,-0.8 0.3,-0.2 0.5,0 0.6,0.8 0.3,1.1 0.8,3.1 1.7,5.9 0.9,2.8 2.5,6 4.7,9.6l4.2,-2c-1.5,-2.5 -2.7,-5 -3.6,-7.2 -1,-1.9 -1.7,-3.8 -2.2,-5.8s-0.7,-3.6 -0.4,-4.6c0.4,0 0.9,0 1.4,-0.2 0.4,-0.2 0.9,-0.3 1.4,-0.5 0.6,-0.2 1.1,-0.4 1.6,-0.7 0.9,-0.5 1.5,-1.4 1.8,-2.4 0.2,-0.6 0.2,-1.1 0.2,-1.6h20.5v-4.2h-5.2,0.1ZM240.4,156.3c-0.8,0.8 -1.8,1.5 -3,2 -1.5,0.7 -2.6,1.1 -3.5,1.5s-1.6,0.6 -2.3,0.7c-0.8,0.3 -1.4,0.8 -1.9,1.5 -0.5,0.8 -1,1.1 -1.7,1.1h0.2c-0.3,0.2 -0.8,0.2 -1.5,0.2s-1.4,0 -2.1,0.2c-0.9,0 -0.4,-6 0.3,-6.4 0.6,-0.3 1.1,-0.6 1.8,-0.9s1.3,-0.6 2,-0.9 1.7,-0.4 3,-0.3h4.2c1.5,0.2 3.3,0.2 5.3,0.2 -0.1,0.3 -0.4,0.6 -0.8,1h0Z\"\n      android:fillColor=\"#152036\"/>\n</vector>\n"
  },
  {
    "path": "android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_monochrome.xml",
    "content": "<vector xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:width=\"432dp\"\n    android:height=\"432dp\"\n    android:viewportWidth=\"432\"\n    android:viewportHeight=\"432\">\n  <path\n      android:fillColor=\"#FF000000\"\n      android:pathData=\"M282.5,151.1v-6.7h-3v3.2h-6.9v-3h-1.8v2.6h-6.7v-4.2h-1.4v-0.8h-1.2v2.4h-1.4v1.2h-8.3v-1.4h-7.6v-2.8h-4v1.4h-7.2c-0.5,0.6 -1,1.1 -1.4,1.6 -0.7,0.9 -1.3,1.9 -1.8,2.8h-4l-4.1,-0.7 -0.2,1.6c0.4,-3.3 0.7,-5.5 0.5,-5.7 -0.9,-1.6 1.7,-4.6 2.1,-5.1l2.2,-3.6 -2.3,-4.9c-3.7,-7.9 -9.2,-12.2 -14.5,-11.3 -5.4,1 -6.8,1.6 -10.5,4.9 -3,2.8 -4.1,4.7 -5,8.8 -0.6,2.9 -0.8,6 -0.4,6.9 0.4,1.1 0,1.7 -0.9,1.7s-4.6,3.9 -8.5,8.6l-6.9,8.5 -1.2,9.2c-1.2,8.4 -5.1,29 -6.7,34.4 -0.4,1.4 -0.2,2.3 0.5,2.3s0.9,1.3 0.5,3.7c-0.3,2.1 0,5.1 0.5,6.6 0.9,2.2 0.6,4.4 -1.5,11.5 -1.4,4.8 -4.5,15.6 -6.7,23.9 -3.9,14 -4.4,15.4 -7,16.4 -3.5,1.5 -11.8,10.6 -14.4,15.8l-2,4.1 2.1,7.1c1.8,6.1 2.7,7.6 5.7,9.6s4.3,2.3 7.8,1.7c5.2,-0.8 6.9,-3.9 5.2,-9.5 -0.6,-2 -1.1,-3.9 -1.1,-4.3s3.1,-0.6 6.9,-0.6c6.3,0 7,-0.2 7.7,-2.3 0.4,-1.2 2.5,-6 4.6,-10.6 2.2,-4.6 4.6,-10.7 5.3,-13.5 2.2,-8.2 11.7,-30.6 13,-30.6 2.3,0 6.4,4.1 11.9,11.8 3,4.2 7.5,9.7 10,12.1 2.6,2.6 4.8,5.7 5.1,7.5 0.4,1.7 2.2,9.4 4.2,17.1 2.2,9.1 3.3,15.2 2.9,17.5 -0.7,4.7 2.7,9.6 9.9,13.9 5.2,3.2 6,3.3 10.3,2.5 6.3,-1.2 6.5,-3.4 1.4,-12.3 -3.6,-6.2 -4.1,-7.9 -4.7,-15.8 -0.3,-4.8 -1.3,-11.6 -2.1,-15 -0.8,-3.5 -1.4,-8.2 -1.3,-10.5 0,-3.6 -0.6,-5.4 -4.2,-10.8 -2.3,-3.6 -5.8,-8.3 -7.6,-10.6 -3.7,-4.6 -4.1,-6.8 -1.6,-8.3 1.6,-0.8 1.6,-1.2 -0.2,-4.6 -1.1,-2 -4.2,-6.2 -6.8,-9.3 -2.7,-3.1 -5.6,-7 -6.5,-8.5 -1.3,-2.1 -2.2,-2.7 -3.9,-2.2 -2.2,0.5 -2.3,0.2 -2.3,-4.4s0.4,-5.1 2,-5.6c2.2,-0.7 2.8,-2.6 3.2,-9.5l0.3,-4.5s0.4,-2.5 0.9,-6.2v1c-0.1,0 4.2,0 4.2,0 0,0.2 0,0.2 0,0l10.9,0.8c0.9,-0.4 1.8,-0.9 2.6,-1.4 1.8,-0.9 3.2,-2 4.4,-3 0.1,-0.1 0.4,-0.3 0.8,-0.4 0.4,0 0.7,-0.3 0.8,-0.4 1.6,-1.6 2.7,-2.7 3.4,-3.3 0.7,-0.6 1.1,-1 1.4,-1 0.3,0 0.4,0 0.6,0.1 0.2,0 0.6,0 1.4,0 0.8,0 1.5,-0.1 2.1,-0.1 0.6,0 1.1,-0.2 1.7,-0.3 0.6,0 1.1,-0.3 1.6,-0.4l1.8,-3.2c0.3,-0.4 0.5,-0.7 0.6,-0.8 0.3,-0.2 0.5,0 0.6,0.8 0.3,1.1 0.8,3.1 1.7,5.9 0.9,2.8 2.5,6 4.7,9.6l4.2,-2c-1.5,-2.5 -2.7,-5 -3.6,-7.2 -1,-1.9 -1.7,-3.8 -2.2,-5.8s-0.7,-3.6 -0.4,-4.6c0.4,0 0.9,0 1.4,-0.2 0.4,-0.2 0.9,-0.3 1.4,-0.5 0.6,-0.2 1.1,-0.4 1.6,-0.7 0.9,-0.5 1.5,-1.4 1.8,-2.4 0.2,-0.6 0.2,-1.1 0.2,-1.6h20.5v-4.2h-5.2ZM240.4,156.3c-0.8,0.8 -1.8,1.5 -3,2 -1.5,0.7 -2.6,1.1 -3.5,1.5 -0.9,0.4 -1.6,0.6 -2.3,0.7 -0.8,0.3 -1.4,0.8 -1.9,1.5 -0.5,0.8 -1,1.1 -1.7,1.1h0.2c-0.3,0.2 -0.8,0.2 -1.5,0.2s-1.4,0 -2.1,0.2c-0.9,0 -0.4,-6 0.3,-6.4 0.6,-0.3 1.1,-0.6 1.8,-0.9s1.3,-0.6 2,-0.9 1.7,-0.4 3,-0.3c1.3,0 2.7,0 4.2,0 1.5,0.2 3.3,0.2 5.3,0.2 -0.1,0.3 -0.4,0.6 -0.8,1Z\"/>\n</vector>\n"
  },
  {
    "path": "android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<adaptive-icon xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <background android:drawable=\"@color/ic_launcher_background\"/>\n    <foreground android:drawable=\"@mipmap/ic_launcher_foreground\"/>\n    <monochrome android:drawable=\"@mipmap/ic_launcher_monochrome\"/>\n</adaptive-icon>"
  },
  {
    "path": "android/app/src/main/res/values/ic_launcher_background.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n    <color name=\"ic_launcher_background\">#EEEEEE</color>\n</resources>"
  },
  {
    "path": "android/app/src/main/res/values/ic_launcher_cz_background.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n    <color name=\"ic_launcher_cz_background\">#FFFA71</color>\n</resources>"
  },
  {
    "path": "android/app/src/main/res/values/strings.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n    <string name=\"app_name\">CS16Client</string>\n</resources>"
  },
  {
    "path": "android/build.gradle",
    "content": "buildscript {\n\trepositories {\n\t\tmavenCentral()\n\t\tgoogle()\n\t}\n\n\tdependencies {\n\t\tclasspath 'com.android.tools.build:gradle:8.12.0'\n    }\n}\n\nallprojects {\n\trepositories {\n\t\tmavenCentral()\n\t\tgoogle()\n\t}\n}\n"
  },
  {
    "path": "android/gradle/wrapper/gradle-wrapper.properties",
    "content": "#Thu Oct 26 16:18:24 EEST 2023\ndistributionBase=GRADLE_USER_HOME\ndistributionPath=wrapper/dists\ndistributionUrl=https\\://services.gradle.org/distributions/gradle-8.13-bin.zip\nzipStoreBase=GRADLE_USER_HOME\nzipStorePath=wrapper/dists\n"
  },
  {
    "path": "android/gradle.properties",
    "content": "# Project-wide Gradle settings.\n\n# IDE (e.g. Android Studio) users:\n# Gradle settings configured through the IDE *will override*\n# any settings specified in this file.\n\n# For more details on how to configure your build environment visit\n# http://www.gradle.org/docs/current/userguide/build_environment.html\n\n# Specifies the JVM arguments used for the daemon process.\n# The setting is particularly useful for tweaking memory settings.\n# Default value: -Xmx10248m -XX:MaxPermSize=256m\norg.gradle.jvmargs=-Xmx2048m -XX:MaxMetaspaceSize=384m\n\n# When configured, Gradle will run in incubating parallel mode.\n# This option should only be used with decoupled projects. More details, visit\n# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects\n# org.gradle.parallel=true\n# android.useDeprecatedNdk=true\nandroid.enableJetifier=true\nandroid.useAndroidX=true"
  },
  {
    "path": "android/gradlew",
    "content": "#!/usr/bin/env bash\n\n##############################################################################\n##\n##  Gradle start up script for UN*X\n##\n##############################################################################\n\n# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.\nDEFAULT_JVM_OPTS=\"\"\n\nAPP_NAME=\"Gradle\"\nAPP_BASE_NAME=`basename \"$0\"`\n\n# Use the maximum available, or set MAX_FD != -1 to use that value.\nMAX_FD=\"maximum\"\n\nwarn ( ) {\n    echo \"$*\"\n}\n\ndie ( ) {\n    echo\n    echo \"$*\"\n    echo\n    exit 1\n}\n\n# OS specific support (must be 'true' or 'false').\ncygwin=false\nmsys=false\ndarwin=false\ncase \"`uname`\" in\n  CYGWIN* )\n    cygwin=true\n    ;;\n  Darwin* )\n    darwin=true\n    ;;\n  MINGW* )\n    msys=true\n    ;;\nesac\n\n# Attempt to set APP_HOME\n# Resolve links: $0 may be a link\nPRG=\"$0\"\n# Need this for relative symlinks.\nwhile [ -h \"$PRG\" ] ; do\n    ls=`ls -ld \"$PRG\"`\n    link=`expr \"$ls\" : '.*-> \\(.*\\)$'`\n    if expr \"$link\" : '/.*' > /dev/null; then\n        PRG=\"$link\"\n    else\n        PRG=`dirname \"$PRG\"`\"/$link\"\n    fi\ndone\nSAVED=\"`pwd`\"\ncd \"`dirname \\\"$PRG\\\"`/\" >/dev/null\nAPP_HOME=\"`pwd -P`\"\ncd \"$SAVED\" >/dev/null\n\nCLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar\n\n# Determine the Java command to use to start the JVM.\nif [ -n \"$JAVA_HOME\" ] ; then\n    if [ -x \"$JAVA_HOME/jre/sh/java\" ] ; then\n        # IBM's JDK on AIX uses strange locations for the executables\n        JAVACMD=\"$JAVA_HOME/jre/sh/java\"\n    else\n        JAVACMD=\"$JAVA_HOME/bin/java\"\n    fi\n    if [ ! -x \"$JAVACMD\" ] ; then\n        die \"ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME\n\nPlease set the JAVA_HOME variable in your environment to match the\nlocation of your Java installation.\"\n    fi\nelse\n    JAVACMD=\"java\"\n    which java >/dev/null 2>&1 || die \"ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.\n\nPlease set the JAVA_HOME variable in your environment to match the\nlocation of your Java installation.\"\nfi\n\n# Increase the maximum file descriptors if we can.\nif [ \"$cygwin\" = \"false\" -a \"$darwin\" = \"false\" ] ; then\n    MAX_FD_LIMIT=`ulimit -H -n`\n    if [ $? -eq 0 ] ; then\n        if [ \"$MAX_FD\" = \"maximum\" -o \"$MAX_FD\" = \"max\" ] ; then\n            MAX_FD=\"$MAX_FD_LIMIT\"\n        fi\n        ulimit -n $MAX_FD\n        if [ $? -ne 0 ] ; then\n            warn \"Could not set maximum file descriptor limit: $MAX_FD\"\n        fi\n    else\n        warn \"Could not query maximum file descriptor limit: $MAX_FD_LIMIT\"\n    fi\nfi\n\n# For Darwin, add options to specify how the application appears in the dock\nif $darwin; then\n    GRADLE_OPTS=\"$GRADLE_OPTS \\\"-Xdock:name=$APP_NAME\\\" \\\"-Xdock:icon=$APP_HOME/media/gradle.icns\\\"\"\nfi\n\n# For Cygwin, switch paths to Windows format before running java\nif $cygwin ; then\n    APP_HOME=`cygpath --path --mixed \"$APP_HOME\"`\n    CLASSPATH=`cygpath --path --mixed \"$CLASSPATH\"`\n    JAVACMD=`cygpath --unix \"$JAVACMD\"`\n\n    # We build the pattern for arguments to be converted via cygpath\n    ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`\n    SEP=\"\"\n    for dir in $ROOTDIRSRAW ; do\n        ROOTDIRS=\"$ROOTDIRS$SEP$dir\"\n        SEP=\"|\"\n    done\n    OURCYGPATTERN=\"(^($ROOTDIRS))\"\n    # Add a user-defined pattern to the cygpath arguments\n    if [ \"$GRADLE_CYGPATTERN\" != \"\" ] ; then\n        OURCYGPATTERN=\"$OURCYGPATTERN|($GRADLE_CYGPATTERN)\"\n    fi\n    # Now convert the arguments - kludge to limit ourselves to /bin/sh\n    i=0\n    for arg in \"$@\" ; do\n        CHECK=`echo \"$arg\"|egrep -c \"$OURCYGPATTERN\" -`\n        CHECK2=`echo \"$arg\"|egrep -c \"^-\"`                                 ### Determine if an option\n\n        if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then                    ### Added a condition\n            eval `echo args$i`=`cygpath --path --ignore --mixed \"$arg\"`\n        else\n            eval `echo args$i`=\"\\\"$arg\\\"\"\n        fi\n        i=$((i+1))\n    done\n    case $i in\n        (0) set -- ;;\n        (1) set -- \"$args0\" ;;\n        (2) set -- \"$args0\" \"$args1\" ;;\n        (3) set -- \"$args0\" \"$args1\" \"$args2\" ;;\n        (4) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" ;;\n        (5) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" ;;\n        (6) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" ;;\n        (7) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" \"$args6\" ;;\n        (8) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" \"$args6\" \"$args7\" ;;\n        (9) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" \"$args6\" \"$args7\" \"$args8\" ;;\n    esac\nfi\n\n# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules\nfunction splitJvmOpts() {\n    JVM_OPTS=(\"$@\")\n}\neval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS\nJVM_OPTS[${#JVM_OPTS[*]}]=\"-Dorg.gradle.appname=$APP_BASE_NAME\"\n\nexec \"$JAVACMD\" \"${JVM_OPTS[@]}\" -classpath \"$CLASSPATH\" org.gradle.wrapper.GradleWrapperMain \"$@\"\n"
  },
  {
    "path": "android/gradlew.bat",
    "content": "@if \"%DEBUG%\" == \"\" @echo off\n@rem ##########################################################################\n@rem\n@rem  Gradle startup script for Windows\n@rem\n@rem ##########################################################################\n\n@rem Set local scope for the variables with windows NT shell\nif \"%OS%\"==\"Windows_NT\" setlocal\n\n@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.\nset DEFAULT_JVM_OPTS=\n\nset DIRNAME=%~dp0\nif \"%DIRNAME%\" == \"\" set DIRNAME=.\nset APP_BASE_NAME=%~n0\nset APP_HOME=%DIRNAME%\n\n@rem Find java.exe\nif defined JAVA_HOME goto findJavaFromJavaHome\n\nset JAVA_EXE=java.exe\n%JAVA_EXE% -version >NUL 2>&1\nif \"%ERRORLEVEL%\" == \"0\" goto init\n\necho.\necho ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.\necho.\necho Please set the JAVA_HOME variable in your environment to match the\necho location of your Java installation.\n\ngoto fail\n\n:findJavaFromJavaHome\nset JAVA_HOME=%JAVA_HOME:\"=%\nset JAVA_EXE=%JAVA_HOME%/bin/java.exe\n\nif exist \"%JAVA_EXE%\" goto init\n\necho.\necho ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%\necho.\necho Please set the JAVA_HOME variable in your environment to match the\necho location of your Java installation.\n\ngoto fail\n\n:init\n@rem Get command-line arguments, handling Windowz variants\n\nif not \"%OS%\" == \"Windows_NT\" goto win9xME_args\nif \"%@eval[2+2]\" == \"4\" goto 4NT_args\n\n:win9xME_args\n@rem Slurp the command line arguments.\nset CMD_LINE_ARGS=\nset _SKIP=2\n\n:win9xME_args_slurp\nif \"x%~1\" == \"x\" goto execute\n\nset CMD_LINE_ARGS=%*\ngoto execute\n\n:4NT_args\n@rem Get arguments from the 4NT Shell from JP Software\nset CMD_LINE_ARGS=%$\n\n:execute\n@rem Setup the command line\n\nset CLASSPATH=%APP_HOME%\\gradle\\wrapper\\gradle-wrapper.jar\n\n@rem Execute Gradle\n\"%JAVA_EXE%\" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% \"-Dorg.gradle.appname=%APP_BASE_NAME%\" -classpath \"%CLASSPATH%\" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%\n\n:end\n@rem End local scope for the variables with windows NT shell\nif \"%ERRORLEVEL%\"==\"0\" goto mainEnd\n\n:fail\nrem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of\nrem the _cmd.exe /c_ return code!\nif  not \"\" == \"%GRADLE_EXIT_CONSOLE%\" exit 1\nexit /b 1\n\n:mainEnd\nif \"%OS%\"==\"Windows_NT\" endlocal\n\n:omega\n"
  },
  {
    "path": "android/settings.gradle",
    "content": "include ':app'\n\nrootProject.name = 'CS16Client'"
  },
  {
    "path": "cl_dll/CMakeLists.txt",
    "content": "cmake_minimum_required(VERSION 3.10)\nproject(client)\n\nset(CLIENT_LIB client)\n\nfile(GLOB CS_CLIENT_SRC \"*.cpp\")\nfile(GLOB CS_EV_SRC \"events/*.cpp\")\nfile(GLOB CS_WPN_SRC \"cs_wpn/*.cpp\")\nfile(GLOB CS_WPNSH_SRC \"../dlls/wpn_shared/*.cpp\")\nfile(GLOB CS_HUD_SRC \"hud/*.cpp\")\nfile(GLOB CS_STUDIO_SRC \"studio/*.cpp\")\nfile(GLOB CS_INPUT_SRC \"input/*.cpp\")\nfile(GLOB CS_PM_SRC \"../pm_shared/*.cpp\")\nfile(GLOB CS_GAMSH_SRC \"../game_shared/*.cpp\")\nfile(GLOB MINIUTL_SRC \"../3rdparty/mainui_cpp/miniutl/*.cpp\")\n\nlist(REMOVE_ITEM CS_CLIENT_SRC \"${CMAKE_CURRENT_SOURCE_DIR}/ev_hldm.cpp\")\nlist(REMOVE_ITEM CS_INPUT_SRC \"${CMAKE_CURRENT_SOURCE_DIR}/input/input_sdl.cpp\")\nlist(REMOVE_ITEM CS_CLIENT_SRC \"${CMAKE_CURRENT_SOURCE_DIR}/inputw32.cpp\")\nlist(REMOVE_ITEM CS_WPN_SRC \"${CMAKE_CURRENT_SOURCE_DIR}/cs_wpn/cs_baseentity.cpp\")\nlist(APPEND CS_CLIENT_SRC ../common/interface.cpp)\nlist(APPEND CS_CLIENT_SRC ../public/utflib.cpp)\n\nlist(APPEND CS_CLIENT_SRC ${CS_EV_SRC})\nlist(APPEND CS_CLIENT_SRC ${CS_WPN_SRC})\nlist(APPEND CS_CLIENT_SRC ${CS_WPNSH_SRC})\nlist(APPEND CS_CLIENT_SRC ${CS_HUD_SRC})\nlist(APPEND CS_CLIENT_SRC ${CS_STUDIO_SRC})\nlist(APPEND CS_CLIENT_SRC ${CS_PM_SRC})\nlist(APPEND CS_CLIENT_SRC ${CS_INPUT_SRC})\nlist(APPEND CS_CLIENT_SRC ${CS_GAMSH_SRC})\nlist(APPEND CS_CLIENT_SRC ${MINIUTL_SRC})\n\ninclude_directories(\n\tinclude\n\tinclude/hud\n\tinclude/studio\n\tinclude/math\n\t../cl_dll\n\t../common\n\t../engine\n\t../pm_shared\n\t../dlls\n\t../game_shared\n\t../public/\n\t../public/cl_dll\n\t../3rdparty/mainui_cpp\n\t../3rdparty/mainui_cpp/controls\n\t../3rdparty/mainui_cpp/menus\n\t../3rdparty/mainui_cpp/miniutl)\n\nadd_definitions(-DCLIENT_WEAPONS -DCLIENT_DLL -DSTDINT_H=<cstdint>)\n\nif(NOT MSVC)\n\tadd_definitions(-DLINUX -D_LINUX)\n\tadd_definitions(-Dstricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp -fms-extensions)\nelse()\n\tadd_definitions(-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE)\nendif()\n\nadd_library(${CLIENT_LIB} SHARED ${CS_CLIENT_SRC})\n\nset_target_postfix(${CLIENT_LIB})\n\ninstall(TARGETS ${CLIENT_LIB}\n\tDESTINATION \"${GAME_DIR}/${CLIENT_INSTALL_DIR}/\"\n\tPERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE\n\t    GROUP_READ GROUP_EXECUTE\n\t\tWORLD_READ WORLD_EXECUTE)\n\n# Install PDB file on Windows\nif(MSVC)\n\tinstall(FILES $<TARGET_PDB_FILE:${CLIENT_LIB}>\n\t\tDESTINATION \"${GAME_DIR}/${CLIENT_INSTALL_DIR}/\" OPTIONAL)\nendif()"
  },
  {
    "path": "cl_dll/GameStudioModelRenderer.cpp",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\n*\tThis product contains software technology licensed from Id\n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc.\n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n\n// Big thanks to Chicken Fortress developers\n// for this code.\n#include <assert.h>\n#include \"hud.h\"\n#include \"cl_util.h\"\n#include \"const.h\"\n#include \"com_model.h\"\n#include \"studio.h\"\n#include \"entity_state.h\"\n#include \"cl_entity.h\"\n#include \"dlight.h\"\n#include \"triangleapi.h\"\n\n#include <stdio.h>\n#include <string.h>\n#include <memory.h>\n#include <math.h>\n\n#include \"studio_util.h\"\n#include \"r_studioint.h\"\n\n#include \"StudioModelRenderer.h\"\n#include \"GameStudioModelRenderer.h\"\n#include \"pm_defs.h\"\n#include \"camera.h\"\n#include \"eventscripts.h\"\n\n#define ANIM_WALK_SEQUENCE 3\n#define ANIM_JUMP_SEQUENCE 6\n#define ANIM_SWIM_1 8\n#define ANIM_SWIM_2 9\n#define ANIM_FIRST_DEATH_SEQUENCE 101\n#define ANIM_LAST_DEATH_SEQUENCE 159\n#define ANIM_FIRST_EMOTION_SEQUENCE 198\n#define ANIM_LAST_EMOTION_SEQUENCE 207\n\nCGameStudioModelRenderer g_StudioRenderer;\n\nint g_rseq;\nint g_gaitseq;\nvec3_t g_clorg;\nvec3_t g_clang;\n\nvoid CounterStrike_GetSequence(int *seq, int *gaitseq)\n{\n\t*seq = g_rseq;\n\t*gaitseq = g_gaitseq;\n}\n\nvoid CounterStrike_GetOrientation(float *o, float *a)\n{\n\tVectorCopy(g_clorg, o);\n\tVectorCopy(g_clang, a);\n}\n\nfloat g_flStartScaleTime;\nint iPrevRenderState;\nint iRenderStateChanged;\n\nengine_studio_api_t IEngineStudio;\n\nstatic client_anim_state_t g_state;\nstatic client_anim_state_t g_clientstate;\n\nCGameStudioModelRenderer::CGameStudioModelRenderer(void)\n{\n\tm_bLocal = false;\n}\n\nmstudioanim_t *CGameStudioModelRenderer::LookupAnimation(mstudioseqdesc_t *pseqdesc, int index)\n{\n\tmstudioanim_t *panim = NULL;\n\n\tpanim = StudioGetAnim(m_pRenderModel, pseqdesc);\n\n\tif (index < 0)\n\t\treturn panim;\n\n\tif (index > (pseqdesc->numblends - 1))\n\t\treturn panim;\n\n\tpanim += index * m_pStudioHeader->numbones;\n\treturn panim;\n}\n\nvoid CGameStudioModelRenderer::StudioSetupBones(void)\n{\n\tint i;\n\tdouble f;\n\n\tmstudiobone_t *pbones;\n\tmstudioseqdesc_t *pseqdesc;\n\tmstudioanim_t *panim;\n\n\tstatic float pos[MAXSTUDIOBONES][3];\n\tstatic vec4_t q[MAXSTUDIOBONES];\n\tfloat bonematrix[3][4];\n\n\tstatic float pos2[MAXSTUDIOBONES][3];\n\tstatic vec4_t q2[MAXSTUDIOBONES];\n\tstatic float pos3[MAXSTUDIOBONES][3];\n\tstatic vec4_t q3[MAXSTUDIOBONES];\n\tstatic float pos4[MAXSTUDIOBONES][3];\n\tstatic vec4_t q4[MAXSTUDIOBONES];\n\n\tif (!m_pCurrentEntity->player)\n\t{\n\t\tCStudioModelRenderer::StudioSetupBones();\n\t\treturn;\n\t}\n\n\tif (m_pCurrentEntity->curstate.sequence >= m_pStudioHeader->numseq)\n\t\tm_pCurrentEntity->curstate.sequence = 0;\n\n\tpseqdesc = (mstudioseqdesc_t *)((byte *)m_pStudioHeader + m_pStudioHeader->seqindex) + m_pCurrentEntity->curstate.sequence;\n\tpanim = StudioGetAnim(m_pRenderModel, pseqdesc);\n\n\tf = StudioEstimateFrame(pseqdesc);\n\n\tif (m_pPlayerInfo->gaitsequence == ANIM_WALK_SEQUENCE)\n\t{\n\t\tif (m_pCurrentEntity->curstate.blending[0] <= 26)\n\t\t{\n\t\t\tm_pCurrentEntity->curstate.blending[0] = 0;\n\t\t\tm_pCurrentEntity->latched.prevseqblending[0] = m_pCurrentEntity->curstate.blending[0];\n\t\t}\n\t\telse\n\t\t{\n\t\t\tm_pCurrentEntity->curstate.blending[0] -= 26;\n\t\t\tm_pCurrentEntity->latched.prevseqblending[0] = m_pCurrentEntity->curstate.blending[0];\n\t\t}\n\t}\n\n\tif (pseqdesc->numblends == 9)\n\t{\n\t\tfloat s = m_pCurrentEntity->curstate.blending[0];\n\t\tfloat t = m_pCurrentEntity->curstate.blending[1];\n\n\t\tif (s <= 127.0)\n\t\t{\n\t\t\ts = (s * 2.0);\n\n\t\t\tif (t <= 127.0)\n\t\t\t{\n\t\t\t\tt = (t * 2.0);\n\n\t\t\t\tStudioCalcRotations(pos, q, pseqdesc, panim, f);\n\t\t\t\tpanim = LookupAnimation(pseqdesc, 1);\n\t\t\t\tStudioCalcRotations(pos2, q2, pseqdesc, panim, f);\n\t\t\t\tpanim = LookupAnimation(pseqdesc, 3);\n\t\t\t\tStudioCalcRotations(pos3, q3, pseqdesc, panim, f);\n\t\t\t\tpanim = LookupAnimation(pseqdesc, 4);\n\t\t\t\tStudioCalcRotations(pos4, q4, pseqdesc, panim, f);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tt = 2.0 * (t - 127.0);\n\n\t\t\t\tpanim = LookupAnimation(pseqdesc, 3);\n\t\t\t\tStudioCalcRotations(pos, q, pseqdesc, panim, f);\n\t\t\t\tpanim = LookupAnimation(pseqdesc, 4);\n\t\t\t\tStudioCalcRotations(pos2, q2, pseqdesc, panim, f);\n\t\t\t\tpanim = LookupAnimation(pseqdesc, 6);\n\t\t\t\tStudioCalcRotations(pos3, q3, pseqdesc, panim, f);\n\t\t\t\tpanim = LookupAnimation(pseqdesc, 7);\n\t\t\t\tStudioCalcRotations(pos4, q4, pseqdesc, panim, f);\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\ts = 2.0 * (s - 127.0);\n\n\t\t\tif (t <= 127.0)\n\t\t\t{\n\t\t\t\tt = (t * 2.0);\n\n\t\t\t\tpanim = LookupAnimation(pseqdesc, 1);\n\t\t\t\tStudioCalcRotations(pos, q, pseqdesc, panim, f);\n\t\t\t\tpanim = LookupAnimation(pseqdesc, 2);\n\t\t\t\tStudioCalcRotations(pos2, q2, pseqdesc, panim, f);\n\t\t\t\tpanim = LookupAnimation(pseqdesc, 4);\n\t\t\t\tStudioCalcRotations(pos3, q3, pseqdesc, panim, f);\n\t\t\t\tpanim = LookupAnimation(pseqdesc, 5);\n\t\t\t\tStudioCalcRotations(pos4, q4, pseqdesc, panim, f);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tt = 2.0 * (t - 127.0);\n\n\t\t\t\tpanim = LookupAnimation(pseqdesc, 4);\n\t\t\t\tStudioCalcRotations(pos, q, pseqdesc, panim, f);\n\t\t\t\tpanim = LookupAnimation(pseqdesc, 5);\n\t\t\t\tStudioCalcRotations(pos2, q2, pseqdesc, panim, f);\n\t\t\t\tpanim = LookupAnimation(pseqdesc, 7);\n\t\t\t\tStudioCalcRotations(pos3, q3, pseqdesc, panim, f);\n\t\t\t\tpanim = LookupAnimation(pseqdesc, 8);\n\t\t\t\tStudioCalcRotations(pos4, q4, pseqdesc, panim, f);\n\t\t\t}\n\t\t}\n\n\t\ts /= 255.0;\n\t\tt /= 255.0;\n\n\t\tStudioSlerpBones(q, pos, q2, pos2, s);\n\t\tStudioSlerpBones(q3, pos3, q4, pos4, s);\n\t\tStudioSlerpBones(q, pos, q3, pos3, t);\n\t}\n\telse\n\t{\n\t\tStudioCalcRotations(pos, q, pseqdesc, panim, f);\n\t}\n\n\tif (m_fDoInterp && m_pCurrentEntity->latched.sequencetime && (m_pCurrentEntity->latched.sequencetime + 0.2 > m_clTime) && (m_pCurrentEntity->latched.prevsequence < m_pStudioHeader->numseq))\n\t{\n\t\tstatic float pos1b[MAXSTUDIOBONES][3];\n\t\tstatic vec4_t q1b[MAXSTUDIOBONES];\n\t\tfloat s = m_pCurrentEntity->latched.prevseqblending[0];\n\t\tfloat t = m_pCurrentEntity->latched.prevseqblending[1];\n\n\t\tpseqdesc = (mstudioseqdesc_t *)((byte *)m_pStudioHeader + m_pStudioHeader->seqindex) + m_pCurrentEntity->latched.prevsequence;\n\t\tpanim = StudioGetAnim(m_pRenderModel, pseqdesc);\n\n\t\tif (pseqdesc->numblends == 9)\n\t\t{\n\t\t\tif (s <= 127.0)\n\t\t\t{\n\t\t\t\ts = (s * 2.0);\n\n\t\t\t\tif (t <= 127.0)\n\t\t\t\t{\n\t\t\t\t\tt = (t * 2.0);\n\n\t\t\t\t\tStudioCalcRotations(pos1b, q1b, pseqdesc, panim, m_pCurrentEntity->latched.prevframe);\n\t\t\t\t\tpanim = LookupAnimation(pseqdesc, 1);\n\t\t\t\t\tStudioCalcRotations(pos2, q2, pseqdesc, panim, m_pCurrentEntity->latched.prevframe);\n\t\t\t\t\tpanim = LookupAnimation(pseqdesc, 3);\n\t\t\t\t\tStudioCalcRotations(pos3, q3, pseqdesc, panim, m_pCurrentEntity->latched.prevframe);\n\t\t\t\t\tpanim = LookupAnimation(pseqdesc, 4);\n\t\t\t\t\tStudioCalcRotations(pos4, q4, pseqdesc, panim, m_pCurrentEntity->latched.prevframe);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tt = 2.0 * (t - 127.0);\n\n\t\t\t\t\tpanim = LookupAnimation(pseqdesc, 3);\n\t\t\t\t\tStudioCalcRotations(pos1b, q1b, pseqdesc, panim, m_pCurrentEntity->latched.prevframe);\n\t\t\t\t\tpanim = LookupAnimation(pseqdesc, 4);\n\t\t\t\t\tStudioCalcRotations(pos2, q2, pseqdesc, panim, m_pCurrentEntity->latched.prevframe);\n\t\t\t\t\tpanim = LookupAnimation(pseqdesc, 6);\n\t\t\t\t\tStudioCalcRotations(pos3, q3, pseqdesc, panim, m_pCurrentEntity->latched.prevframe);\n\t\t\t\t\tpanim = LookupAnimation(pseqdesc, 7);\n\t\t\t\t\tStudioCalcRotations(pos4, q4, pseqdesc, panim, m_pCurrentEntity->latched.prevframe);\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\ts = 2.0 * (s - 127.0);\n\n\t\t\t\tif (t <= 127.0)\n\t\t\t\t{\n\t\t\t\t\tt = (t * 2.0);\n\n\t\t\t\t\tpanim = LookupAnimation(pseqdesc, 1);\n\t\t\t\t\tStudioCalcRotations(pos1b, q1b, pseqdesc, panim, m_pCurrentEntity->latched.prevframe);\n\t\t\t\t\tpanim = LookupAnimation(pseqdesc, 2);\n\t\t\t\t\tStudioCalcRotations(pos2, q2, pseqdesc, panim, m_pCurrentEntity->latched.prevframe);\n\t\t\t\t\tpanim = LookupAnimation(pseqdesc, 4);\n\t\t\t\t\tStudioCalcRotations(pos3, q3, pseqdesc, panim, m_pCurrentEntity->latched.prevframe);\n\t\t\t\t\tpanim = LookupAnimation(pseqdesc, 5);\n\t\t\t\t\tStudioCalcRotations(pos4, q4, pseqdesc, panim, m_pCurrentEntity->latched.prevframe);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tt = 2.0 * (t - 127.0);\n\n\t\t\t\t\tpanim = LookupAnimation(pseqdesc, 4);\n\t\t\t\t\tStudioCalcRotations(pos1b, q1b, pseqdesc, panim, m_pCurrentEntity->latched.prevframe);\n\t\t\t\t\tpanim = LookupAnimation(pseqdesc, 5);\n\t\t\t\t\tStudioCalcRotations(pos2, q2, pseqdesc, panim, m_pCurrentEntity->latched.prevframe);\n\t\t\t\t\tpanim = LookupAnimation(pseqdesc, 7);\n\t\t\t\t\tStudioCalcRotations(pos3, q3, pseqdesc, panim, m_pCurrentEntity->latched.prevframe);\n\t\t\t\t\tpanim = LookupAnimation(pseqdesc, 8);\n\t\t\t\t\tStudioCalcRotations(pos4, q4, pseqdesc, panim, m_pCurrentEntity->latched.prevframe);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\ts /= 255.0;\n\t\t\tt /= 255.0;\n\n\t\t\tStudioSlerpBones(q1b, pos1b, q2, pos2, s);\n\t\t\tStudioSlerpBones(q3, pos3, q4, pos4, s);\n\t\t\tStudioSlerpBones(q1b, pos1b, q3, pos3, t);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tStudioCalcRotations(pos1b, q1b, pseqdesc, panim, m_pCurrentEntity->latched.prevframe);\n\t\t}\n\n\t\ts = 1.0 - (m_clTime - m_pCurrentEntity->latched.sequencetime) / 0.2;\n\t\tStudioSlerpBones(q, pos, q1b, pos1b, s);\n\t}\n\telse\n\t{\n\t\tm_pCurrentEntity->latched.prevframe = f;\n\t}\n\n\tpbones = (mstudiobone_t *)((byte *)m_pStudioHeader + m_pStudioHeader->boneindex);\n\n\tif (m_pPlayerInfo && (m_pCurrentEntity->curstate.sequence < ANIM_FIRST_DEATH_SEQUENCE || m_pCurrentEntity->curstate.sequence > ANIM_LAST_DEATH_SEQUENCE) && (m_pCurrentEntity->curstate.sequence < ANIM_FIRST_EMOTION_SEQUENCE || m_pCurrentEntity->curstate.sequence > ANIM_LAST_EMOTION_SEQUENCE) && m_pCurrentEntity->curstate.sequence != ANIM_SWIM_1 && m_pCurrentEntity->curstate.sequence != ANIM_SWIM_2)\n\t{\n\t\tint copy = 1;\n\n\t\tif (m_pPlayerInfo->gaitsequence >= m_pStudioHeader->numseq)\n\t\t\tm_pPlayerInfo->gaitsequence = 0;\n\n\t\tpseqdesc = (mstudioseqdesc_t *)((byte *)m_pStudioHeader + m_pStudioHeader->seqindex ) + m_pPlayerInfo->gaitsequence;\n\n\t\tpanim = StudioGetAnim(m_pRenderModel, pseqdesc);\n\t\tStudioCalcRotations(pos2, q2, pseqdesc, panim, m_pPlayerInfo->gaitframe);\n\n\t\tfor (i = 0; i < m_pStudioHeader->numbones; i++)\n\t\t{\n\t\t\tif (!strcmp(pbones[i].name, \"Bip01 Spine\"))\n\t\t\t\tcopy = 0;\n\t\t\telse if (!strcmp(pbones[pbones[i].parent].name, \"Bip01 Pelvis\"))\n\t\t\t\tcopy = 1;\n\n\t\t\tif (copy)\n\t\t\t{\n\t\t\t\tmemcpy(pos[i], pos2[i], sizeof(pos[i]));\n\t\t\t\tmemcpy(q[i], q2[i], sizeof(q[i]));\n\t\t\t}\n\t\t}\n\t}\n\n\tfor (i = 0; i < m_pStudioHeader->numbones; i++)\n\t{\n\t\tQuaternionMatrix(q[i], bonematrix);\n\n\t\tbonematrix[0][3] = pos[i][0];\n\t\tbonematrix[1][3] = pos[i][1];\n\t\tbonematrix[2][3] = pos[i][2];\n\n\t\tif (pbones[i].parent == -1)\n\t\t{\n\t\t\tif (IEngineStudio.IsHardware())\n\t\t\t{\n\t\t\t\tConcatTransforms((*m_protationmatrix), bonematrix, (*m_pbonetransform)[i]);\n\t\t\t\tMatrixCopy((*m_pbonetransform)[i], (*m_plighttransform)[i]);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tConcatTransforms((*m_paliastransform), bonematrix, (*m_pbonetransform)[i]);\n\t\t\t\tConcatTransforms((*m_protationmatrix), bonematrix, (*m_plighttransform)[i]);\n\t\t\t}\n\n\t\t\tStudioFxTransform(m_pCurrentEntity, (*m_pbonetransform)[i]);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tConcatTransforms((*m_pbonetransform)[pbones[i].parent], bonematrix, (*m_pbonetransform)[i]);\n\t\t\tConcatTransforms((*m_plighttransform)[pbones[i].parent], bonematrix, (*m_plighttransform)[i]);\n\t\t}\n\t}\n}\n\nvoid CGameStudioModelRenderer::StudioEstimateGait(entity_state_t *pplayer)\n{\n\tfloat dt;\n\tvec3_t est_velocity;\n\n\tdt = (m_clTime - m_clOldTime);\n\tdt = max(0.0, dt);\n\tdt = min(1.0, dt);\n\n\tif (dt == 0 || m_pPlayerInfo->renderframe == m_nFrameCount)\n\t{\n\t\tm_flGaitMovement = 0;\n\t\treturn;\n\t}\n\n\tif (m_fGaitEstimation)\n\t{\n\t\tVectorSubtract(m_pCurrentEntity->origin, m_pPlayerInfo->prevgaitorigin, est_velocity);\n\t\tVectorCopy(m_pCurrentEntity->origin, m_pPlayerInfo->prevgaitorigin);\n\t\tm_flGaitMovement = est_velocity.Length();\n\n\t\tif (dt <= 0 || m_flGaitMovement / dt < 5)\n\t\t{\n\t\t\tm_flGaitMovement = 0;\n\t\t\test_velocity[0] = 0;\n\t\t\test_velocity[1] = 0;\n\t\t}\n\t}\n\telse\n\t{\n\t\tVectorCopy(pplayer->velocity, est_velocity);\n\t\tm_flGaitMovement = est_velocity.Length() * dt;\n\t}\n\n\tif (est_velocity[1] == 0 && est_velocity[0] == 0)\n\t{\n\t\tfloat flYawDiff = m_pCurrentEntity->angles[YAW] - m_pPlayerInfo->gaityaw;\n\t\tflYawDiff = flYawDiff - (int)(flYawDiff / 360) * 360;\n\n\t\tif (flYawDiff > 180)\n\t\t\tflYawDiff -= 360;\n\n\t\tif (flYawDiff < -180)\n\t\t\tflYawDiff += 360;\n\n\t\tif (dt < 0.25)\n\t\t\tflYawDiff *= dt * 4;\n\t\telse\n\t\t\tflYawDiff *= dt;\n\n\t\tm_pPlayerInfo->gaityaw += flYawDiff;\n\t\tm_pPlayerInfo->gaityaw = m_pPlayerInfo->gaityaw - (int)(m_pPlayerInfo->gaityaw / 360) * 360;\n\n\t\tm_flGaitMovement = 0;\n\t}\n\telse\n\t{\n\t\tm_pPlayerInfo->gaityaw = (atan2(est_velocity[1], est_velocity[0]) * 180 / M_PI);\n\n\t\tif (m_pPlayerInfo->gaityaw > 180)\n\t\t\tm_pPlayerInfo->gaityaw = 180;\n\n\t\tif (m_pPlayerInfo->gaityaw < -180)\n\t\t\tm_pPlayerInfo->gaityaw = -180;\n\t}\n}\n\nvoid CGameStudioModelRenderer::StudioPlayerBlend(mstudioseqdesc_t *pseqdesc, int *pBlend, float *pPitch)\n{\n\tfloat range = 45.0;\n\n\t*pBlend = (*pPitch * 3);\n\n\tif (*pBlend <= -range)\n\t\t*pBlend = 255;\n\telse if (*pBlend >= range)\n\t\t*pBlend = 0;\n\telse\n\t\t*pBlend = 255 * (range - *pBlend) / (2 * range);\n\n\t*pPitch = 0;\n}\n\nvoid CGameStudioModelRenderer::CalculatePitchBlend(entity_state_t *pplayer)\n{\n\tmstudioseqdesc_t *pseqdesc;\n\tint iBlend;\n\n\tpseqdesc = (mstudioseqdesc_t *)((byte *)m_pStudioHeader + m_pStudioHeader->seqindex) + m_pCurrentEntity->curstate.sequence;\n\n\tStudioPlayerBlend(pseqdesc, &iBlend, &m_pCurrentEntity->angles[PITCH]);\n\n\tm_pCurrentEntity->latched.prevangles[PITCH] = m_pCurrentEntity->angles[PITCH];\n\tm_pCurrentEntity->curstate.blending[1] = iBlend;\n\tm_pCurrentEntity->latched.prevblending[1] = m_pCurrentEntity->curstate.blending[1];\n\tm_pCurrentEntity->latched.prevseqblending[1] = m_pCurrentEntity->curstate.blending[1];\n}\n\nvoid CGameStudioModelRenderer::CalculateYawBlend(entity_state_t *pplayer)\n{\n\tfloat flYaw;\n\n\tStudioEstimateGait(pplayer);\n\n\tflYaw = m_pCurrentEntity->angles[YAW] - m_pPlayerInfo->gaityaw;\n\tflYaw = fmod(flYaw, 360.0f);\n\n\tif (flYaw < -180)\n\t\tflYaw = flYaw + 360;\n\telse if (flYaw > 180)\n\t\tflYaw = flYaw - 360;\n\n\tfloat maxyaw = 120.0;\n\n\tif (flYaw > maxyaw)\n\t{\n\t\tm_pPlayerInfo->gaityaw = m_pPlayerInfo->gaityaw - 180;\n\t\tm_flGaitMovement = -m_flGaitMovement;\n\t\tflYaw = flYaw - 180;\n\t}\n\telse if (flYaw < -maxyaw)\n\t{\n\t\tm_pPlayerInfo->gaityaw = m_pPlayerInfo->gaityaw + 180;\n\t\tm_flGaitMovement = -m_flGaitMovement;\n\t\tflYaw = flYaw + 180;\n\t}\n\n\tfloat blend_yaw = (flYaw / 90.0) * 128.0 + 127.0;\n\n\tblend_yaw = 255.0 - bound( 0.0, blend_yaw, 255.0 );\n\n\tm_pCurrentEntity->curstate.blending[0] = (int)(blend_yaw);\n\tm_pCurrentEntity->latched.prevblending[0] = m_pCurrentEntity->curstate.blending[0];\n\tm_pCurrentEntity->latched.prevseqblending[0] = m_pCurrentEntity->curstate.blending[0];\n\n\tm_pCurrentEntity->angles[YAW] = m_pPlayerInfo->gaityaw;\n\n\tif (m_pCurrentEntity->angles[YAW] < -0)\n\t\tm_pCurrentEntity->angles[YAW] += 360;\n\n\tm_pCurrentEntity->latched.prevangles[YAW] = m_pCurrentEntity->angles[YAW];\n}\n\nvoid CGameStudioModelRenderer::StudioProcessGait(entity_state_t *pplayer)\n{\n\tmstudioseqdesc_t *pseqdesc;\n\n\tCalculateYawBlend(pplayer);\n\tCalculatePitchBlend(pplayer);\n\n\n\tpseqdesc = (mstudioseqdesc_t *)((byte *)m_pStudioHeader + m_pStudioHeader->seqindex) + pplayer->gaitsequence;\n\n\tif (pseqdesc->linearmovement[0] > 0)\n\t\tm_pPlayerInfo->gaitframe += (m_flGaitMovement / pseqdesc->linearmovement[0]) * pseqdesc->numframes;\n\telse\n\t{\n\t\tfloat dt = bound( 0.0, (m_clTime - m_clOldTime), 1.0 );\n\t\tm_pPlayerInfo->gaitframe += pseqdesc->fps * dt * m_pCurrentEntity->curstate.framerate;\n\t}\n\n\tm_pPlayerInfo->gaitframe = m_pPlayerInfo->gaitframe - (int)(m_pPlayerInfo->gaitframe / pseqdesc->numframes) * pseqdesc->numframes;\n\n\tif (m_pPlayerInfo->gaitframe < 0)\n\t\tm_pPlayerInfo->gaitframe += pseqdesc->numframes;\n}\n\nvoid CGameStudioModelRenderer::SavePlayerState(entity_state_t *pplayer)\n{\n\tclient_anim_state_t *st;\n\tcl_entity_t *ent = IEngineStudio.GetCurrentEntity();\n\n\tif (!ent)\n\t\treturn;\n\n\tst = &g_state;\n\n\tst->angles = ent->curstate.angles;\n\tst->origin = ent->curstate.origin;\n\n\tst->realangles = ent->angles;\n\n\tst->sequence = ent->curstate.sequence;\n\tst->gaitsequence = pplayer->gaitsequence;\n\tst->animtime = ent->curstate.animtime;\n\tst->frame = ent->curstate.frame;\n\tst->framerate = ent->curstate.framerate;\n\n\tmemcpy(st->blending, ent->curstate.blending, 2);\n\tmemcpy(st->controller, ent->curstate.controller, 4);\n\n\tst->lv = ent->latched;\n}\n\nvoid GetSequenceInfo(void *pmodel, client_anim_state_t *pev, float *pflFrameRate, float *pflGroundSpeed)\n{\n\tstudiohdr_t *pstudiohdr;\n\tpstudiohdr = (studiohdr_t *)pmodel;\n\n\tif (!pstudiohdr)\n\t\treturn;\n\n\tmstudioseqdesc_t *pseqdesc;\n\n\tif (pev->sequence >= pstudiohdr->numseq)\n\t{\n\t\t*pflFrameRate = 0.0;\n\t\t*pflGroundSpeed = 0.0;\n\t\treturn;\n\t}\n\n\tpseqdesc = (mstudioseqdesc_t *)((byte *)pstudiohdr + pstudiohdr->seqindex) + (int)pev->sequence;\n\n\tif (pseqdesc->numframes > 1)\n\t{\n\t\t*pflFrameRate = 256 * pseqdesc->fps / (pseqdesc->numframes - 1);\n\t\t*pflGroundSpeed = sqrt(pseqdesc->linearmovement[0] * pseqdesc->linearmovement[0] + pseqdesc->linearmovement[1] * pseqdesc->linearmovement[1] + pseqdesc->linearmovement[2] * pseqdesc->linearmovement[2]);\n\t\t*pflGroundSpeed = *pflGroundSpeed * pseqdesc->fps / (pseqdesc->numframes - 1);\n\t}\n\telse\n\t{\n\t\t*pflFrameRate = 256.0;\n\t\t*pflGroundSpeed = 0.0;\n\t}\n}\n\nint GetSequenceFlags(void *pmodel, client_anim_state_t *pev)\n{\n\tstudiohdr_t *pstudiohdr;\n\tpstudiohdr = (studiohdr_t *)pmodel;\n\n\tif (!pstudiohdr || pev->sequence >= pstudiohdr->numseq)\n\t\treturn 0;\n\n\tmstudioseqdesc_t *pseqdesc;\n\tpseqdesc = (mstudioseqdesc_t *)((byte *)pstudiohdr + pstudiohdr->seqindex) + (int)pev->sequence;\n\n\treturn pseqdesc->flags;\n}\n\nfloat StudioFrameAdvance(client_anim_state_t *st, float framerate, float flInterval)\n{\n\tif (flInterval == 0.0)\n\t{\n\t\tflInterval = (gEngfuncs.GetClientTime() - st->animtime);\n\n\t\tif (flInterval <= 0.001)\n\t\t{\n\t\t\tst->animtime = gEngfuncs.GetClientTime();\n\t\t\treturn 0.0;\n\t\t}\n\t}\n\n\tif (!st->animtime)\n\t\tflInterval = 0.0;\n\n\tst->frame += flInterval * framerate * st->framerate;\n\tst->animtime = gEngfuncs.GetClientTime();\n\n\tif (st->frame < 0.0 || st->frame >= 256.0)\n\t{\n\t\tif (st->m_fSequenceLoops)\n\t\t\tst->frame -= (int)(st->frame / 256.0) * 256.0;\n\t\telse\n\t\t\tst->frame = (st->frame < 0.0) ? 0 : 255;\n\n\t\tst->m_fSequenceFinished = TRUE;\n\t}\n\n\treturn flInterval;\n}\n\nvoid CGameStudioModelRenderer::SetupClientAnimation(entity_state_t *pplayer)\n{\n\tstatic double oldtime;\n\tdouble curtime, dt;\n\n\tclient_anim_state_t *st;\n\tfloat fr, gs;\n\n\tcl_entity_t *ent = IEngineStudio.GetCurrentEntity();\n\n\tif (!ent)\n\t\treturn;\n\n\tcurtime = gEngfuncs.GetClientTime();\n\tdt = bound( 0.0, (curtime - oldtime), 1.0 );\n\n\toldtime = curtime;\n\tst = &g_clientstate;\n\n\tst->framerate = 1.0;\n\n\tint oldseq = st->sequence;\n\tCounterStrike_GetSequence(&st->sequence, &st->gaitsequence);\n\tCounterStrike_GetOrientation((float *)&st->origin, (float *)&st->angles);\n\tVectorCopy(st->angles, st->realangles);\n\n\tif (st->sequence != oldseq)\n\t{\n\t\tst->frame = 0.0;\n\t\tst->lv.prevsequence = oldseq;\n\t\tst->lv.sequencetime = st->animtime;\n\n\t\tmemcpy(st->lv.prevseqblending, st->blending, 2);\n\t\tmemcpy(st->lv.prevcontroller, st->controller, 4);\n\t}\n\n\tvoid *pmodel = (studiohdr_t *)IEngineStudio.Mod_Extradata(ent->model);\n\n\tif( !pmodel )\n\t\treturn;\n\n\n\tGetSequenceInfo(pmodel, st, &fr, &gs);\n\tst->m_fSequenceLoops = ((GetSequenceFlags(pmodel, st) & STUDIO_LOOPING) != 0);\n\tStudioFrameAdvance(st, fr, dt);\n\n\tent->angles = st->realangles;\n\n\tent->curstate.angles = st->angles;\n\tent->curstate.origin = st->origin;\n\n\tent->curstate.sequence = st->sequence;\n\tpplayer->gaitsequence = st->gaitsequence;\n\tent->curstate.animtime = st->animtime;\n\tent->curstate.frame = st->frame;\n\tent->curstate.framerate = st->framerate;\n\n\tmemcpy(ent->curstate.blending, st->blending, 2);\n\tmemcpy(ent->curstate.controller, st->controller, 4);\n\n\tent->latched = st->lv;\n}\n\nvoid CGameStudioModelRenderer::RestorePlayerState(entity_state_t *pplayer)\n{\n\tclient_anim_state_t *st;\n\tcl_entity_t *ent = IEngineStudio.GetCurrentEntity();\n\n\tif (!ent)\n\t\treturn;\n\n\tst = &g_clientstate;\n\n\tst->angles = ent->curstate.angles;\n\tst->origin = ent->curstate.origin;\n\n\tst->realangles = ent->angles;\n\n\tst->sequence = ent->curstate.sequence;\n\tst->gaitsequence = pplayer->gaitsequence;\n\tst->animtime = ent->curstate.animtime;\n\tst->frame = ent->curstate.frame;\n\tst->framerate = ent->curstate.framerate;\n\n\tmemcpy(st->blending, ent->curstate.blending, 2);\n\tmemcpy(st->controller, ent->curstate.controller, 4);\n\n\tst->lv = ent->latched;\n\n\tst = &g_state;\n\n\tent->angles = st->realangles;\n\n\tent->curstate.angles = st->angles;\n\tent->curstate.origin = st->origin;\n\n\tent->curstate.sequence = st->sequence;\n\tpplayer->gaitsequence = st->gaitsequence;\n\tent->curstate.animtime = st->animtime;\n\tent->curstate.frame = st->frame;\n\tent->curstate.framerate = st->framerate;\n\n\tmemcpy(ent->curstate.blending, st->blending, 2);\n\tmemcpy(ent->curstate.controller, st->controller, 4);\n\n\tent->latched = st->lv;\n}\n\nint CGameStudioModelRenderer::StudioDrawPlayer(int flags, entity_state_t *pplayer)\n{\n\tint iret = 0;\n\tbool isLocalPlayer = false;\n\n\tm_pplayer = pplayer;\n\n\tif (m_bLocal && IEngineStudio.GetCurrentEntity() == gEngfuncs.GetLocalPlayer())\n\t\tisLocalPlayer = true;\n\n\tif (isLocalPlayer)\n\t{\n\t\tSavePlayerState(pplayer);\n\t\tSetupClientAnimation(pplayer);\n\t}\n\n\tiret = _StudioDrawPlayer(flags, pplayer);\n\n\tif (isLocalPlayer)\n\t\tRestorePlayerState(pplayer);\n\n\tif( m_pCvarShadows->value != 0.0f )\n\t{\n\t\tVector chestpos;\n\n\t\tfor( int i = 0; i < m_nCachedBones; i++ )\n\t\t{\n\t\t\tif( !strcmp(m_nCachedBoneNames[i], \"Bip01 Spine3\") )\n\t\t\t{\n\t\t\t\tchestpos.x = m_rgCachedBoneTransform[i][0][3];\n\t\t\t\tchestpos.y = m_rgCachedBoneTransform[i][1][3];\n\t\t\t\tchestpos.z = m_rgCachedBoneTransform[i][2][3];\n\t\t\t\tStudioDrawShadow(chestpos, 20.0f);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\tm_pplayer = NULL;\n\n\treturn iret;\n}\n\nbool WeaponHasAttachments(entity_state_t *pplayer)\n{\n\tstudiohdr_t *modelheader = NULL;\n\tmodel_t *pweaponmodel;\n\n\tif (!pplayer)\n\t\treturn false;\n\n\tpweaponmodel = IEngineStudio.GetModelByIndex(pplayer->weaponmodel);\n\tmodelheader = (studiohdr_t *)IEngineStudio.Mod_Extradata(pweaponmodel);\n\n\tif( !modelheader )\n\t\treturn false;\n\n\treturn (modelheader->numattachments != 0);\n}\n\nint CGameStudioModelRenderer::_StudioDrawPlayer(int flags, entity_state_t *pplayer)\n{\n\tm_pCurrentEntity = IEngineStudio.GetCurrentEntity();\n\n\tIEngineStudio.GetTimes(&m_nFrameCount, &m_clTime, &m_clOldTime);\n\tIEngineStudio.GetViewInfo(m_vRenderOrigin, m_vUp, m_vRight, m_vNormal);\n\tIEngineStudio.GetAliasScale(&m_fSoftwareXScale, &m_fSoftwareYScale);\n\n\tm_nPlayerIndex = pplayer->number - 1;\n\n\tif (m_nPlayerIndex < 0 || m_nPlayerIndex >= gEngfuncs.GetMaxClients())\n\t\treturn 0;\n\n\t/*m_pRenderModel = IEngineStudio.SetupPlayerModel(m_nPlayerIndex);\n\n\tif (m_pRenderModel == NULL)\n\t\treturn 0;*/\n\n\textra_player_info_t *pExtra = g_PlayerExtraInfo + pplayer->number;\n\n\tif( gHUD.cl_minmodels && gHUD.cl_minmodels->value )\n\t{\n\t\tint team = pExtra->teamnumber;\n\t\tif( team == TEAM_TERRORIST )\n\t\t{\n\t\t\t// set leet if model isn't valid\n\t\t\tint modelIdx = gHUD.cl_min_t && BIsValidTModelIndex(gHUD.cl_min_t->value) ? gHUD.cl_min_t->value : 1;\n\n\t\t\tm_pRenderModel = gEngfuncs.CL_LoadModel( sPlayerModelFiles[ modelIdx ], NULL );\n\t\t}\n\t\telse if( team == TEAM_CT )\n\t\t{\n\t\t\tif( pExtra->vip )\n\t\t\t\tm_pRenderModel = gEngfuncs.CL_LoadModel( sPlayerModelFiles[3], NULL );\n\t\t\telse\n\t\t\t{\n\t\t\t\t// set gign, if model isn't valud\n\t\t\t\tint modelIdx = gHUD.cl_min_ct && BIsValidCTModelIndex(gHUD.cl_min_ct->value) ? gHUD.cl_min_ct->value : 2;\n\n\t\t\t\tm_pRenderModel = gEngfuncs.CL_LoadModel( sPlayerModelFiles[ modelIdx ], NULL );\n\t\t\t}\n\t\t}\n\t}\n\telse\n\t{\n\t\tm_pRenderModel = IEngineStudio.SetupPlayerModel( m_nPlayerIndex );\n\t}\n\n\tif( !m_pRenderModel )\n\t{\n\t\treturn 0;\n\t}\n\n\tm_pStudioHeader = (studiohdr_t *)IEngineStudio.Mod_Extradata(m_pRenderModel);\n\n\tif( !m_pStudioHeader )\n\t\treturn 0;\n\n\tIEngineStudio.StudioSetHeader(m_pStudioHeader);\n\tIEngineStudio.SetRenderModel(m_pRenderModel);\n\n\tif (m_pCurrentEntity->curstate.sequence >= m_pStudioHeader->numseq)\n\t\tm_pCurrentEntity->curstate.sequence = 0;\n\n\tif (pplayer->sequence >= m_pStudioHeader->numseq)\n\t\tpplayer->sequence = 0;\n\n\tif (m_pCurrentEntity->curstate.gaitsequence >= m_pStudioHeader->numseq)\n\t\tm_pCurrentEntity->curstate.gaitsequence = 0;\n\n\tif (pplayer->gaitsequence >= m_pStudioHeader->numseq)\n\t\tpplayer->gaitsequence = 0;\n\n\tif (pplayer->gaitsequence)\n\t{\n\t\tvec3_t orig_angles(m_pCurrentEntity->angles);\n\t\tm_pPlayerInfo = IEngineStudio.PlayerInfo(m_nPlayerIndex);\n\n\t\tStudioProcessGait(pplayer);\n\n\t\tm_pPlayerInfo->gaitsequence = pplayer->gaitsequence;\n\t\tm_pPlayerInfo = NULL;\n\n\t\tStudioSetUpTransform(0);\n\t\tm_pCurrentEntity->angles = orig_angles;\n\t}\n\telse\n\t{\n\t\tm_pCurrentEntity->curstate.controller[0] = 127;\n\t\tm_pCurrentEntity->curstate.controller[1] = 127;\n\t\tm_pCurrentEntity->curstate.controller[2] = 127;\n\t\tm_pCurrentEntity->curstate.controller[3] = 127;\n\t\tm_pCurrentEntity->latched.prevcontroller[0] = m_pCurrentEntity->curstate.controller[0];\n\t\tm_pCurrentEntity->latched.prevcontroller[1] = m_pCurrentEntity->curstate.controller[1];\n\t\tm_pCurrentEntity->latched.prevcontroller[2] = m_pCurrentEntity->curstate.controller[2];\n\t\tm_pCurrentEntity->latched.prevcontroller[3] = m_pCurrentEntity->curstate.controller[3];\n\n\t\tm_pPlayerInfo = IEngineStudio.PlayerInfo(m_nPlayerIndex);\n\n\t\tCalculatePitchBlend(pplayer);\n\t\tCalculateYawBlend(pplayer);\n\n\t\tm_pPlayerInfo->gaitsequence = 0;\n\t\tStudioSetUpTransform(0);\n\t}\n\n\tif (flags & STUDIO_RENDER)\n\t{\n\t\t(*m_pModelsDrawn)++;\n\t\t(*m_pStudioModelCount)++;\n\n\t\tif (m_pStudioHeader->numbodyparts == 0)\n\t\t\treturn 1;\n\t}\n\n\tm_pPlayerInfo = IEngineStudio.PlayerInfo(m_nPlayerIndex);\n\n\tStudioSetupBones();\n\tStudioSaveBones();\n\n\tm_pPlayerInfo->renderframe = m_nFrameCount;\n\tm_pPlayerInfo = NULL;\n\n\tif (flags & STUDIO_EVENTS && (!(flags & STUDIO_RENDER) || !pplayer->weaponmodel || !WeaponHasAttachments(pplayer)))\n\t{\n\t\tStudioCalcAttachments();\n\t\tIEngineStudio.StudioClientEvents();\n\n\t\tif (m_pCurrentEntity->index > 0)\n\t\t{\n\t\t\tcl_entity_t *ent = gEngfuncs.GetEntityByIndex(m_pCurrentEntity->index);\n\t\t\tmemcpy(ent->attachment, m_pCurrentEntity->attachment, sizeof(vec3_t) * 4);\n\t\t}\n\t}\n\n\tif (flags & STUDIO_RENDER)\n\t{\n\t\talight_t lighting;\n\t\tvec3_t dir;\n\n\t\tlighting.plightvec = dir;\n\n\t\tIEngineStudio.StudioDynamicLight(m_pCurrentEntity, &lighting);\n\t\tIEngineStudio.StudioEntityLight(&lighting);\n\t\tIEngineStudio.StudioSetupLighting(&lighting);\n\n\t\tm_pPlayerInfo = IEngineStudio.PlayerInfo(m_nPlayerIndex);\n\t\tm_nTopColor = m_pPlayerInfo->topcolor;\n\n\t\tif (m_nTopColor < 0)\n\t\t\tm_nTopColor = 0;\n\n\t\tif (m_nTopColor > 360)\n\t\t\tm_nTopColor = 360;\n\n\t\tm_nBottomColor = m_pPlayerInfo->bottomcolor;\n\n\t\tif (m_nBottomColor < 0)\n\t\t\tm_nBottomColor = 0;\n\n\t\tif (m_nBottomColor > 360)\n\t\t\tm_nBottomColor = 360;\n\n\t\tIEngineStudio.StudioSetRemapColors(m_nTopColor, m_nBottomColor);\n\n\t\tStudioRenderModel(dir);\n\t\tm_pPlayerInfo = NULL;\n\n\t\tif (pplayer->weaponmodel)\n\t\t{\n\t\t\tstudiohdr_t *saveheader = m_pStudioHeader;\n\t\t\tcl_entity_t saveent = *m_pCurrentEntity;\n\n\t\t\tmodel_t *pweaponmodel = IEngineStudio.GetModelByIndex(pplayer->weaponmodel);\n\n\t\t\tm_pStudioHeader = (studiohdr_t *)IEngineStudio.Mod_Extradata(pweaponmodel);\n\t\t\tif( !m_pStudioHeader )\n\t\t\t\treturn 0;\n\n\t\t\tIEngineStudio.StudioSetHeader(m_pStudioHeader);\n\n\t\t\tStudioMergeBones(pweaponmodel);\n\n\t\t\tIEngineStudio.StudioSetupLighting(&lighting);\n\n\t\t\tStudioRenderModel(dir);\n\n\t\t\tStudioCalcAttachments();\n\n\t\t\tif (m_pCurrentEntity->index > 0)\n\t\t\t\tmemcpy(saveent.attachment, m_pCurrentEntity->attachment, sizeof(vec3_t) * m_pStudioHeader->numattachments);\n\n\t\t\t*m_pCurrentEntity = saveent;\n\t\t\tm_pStudioHeader = saveheader;\n\t\t\tIEngineStudio.StudioSetHeader(m_pStudioHeader);\n\n\t\t\tif (flags & STUDIO_EVENTS)\n\t\t\t\tIEngineStudio.StudioClientEvents();\n\t\t}\n\t}\n\n\treturn 1;\n}\n\n\nvoid CGameStudioModelRenderer::StudioFxTransform(cl_entity_t *ent, float transform[3][4])\n{\n\tswitch (ent->curstate.renderfx)\n\t{\n\tcase kRenderFxDistort:\n\tcase kRenderFxHologram:\n\t{\n\t\tif (Com_RandomLong(0, 49) == 0)\n\t\t{\n\t\t\tint axis = Com_RandomLong(0, 1);\n\n\t\t\tif (axis == 1)\n\t\t\t\taxis = 2;\n\n\t\t\tVectorScale( transform[axis], gEngfuncs.pfnRandomFloat( 1, 1.484 ), transform[axis] );\n\t\t}\n\t\telse if (Com_RandomLong(0, 49) == 0)\n\t\t{\n\t\t\tfloat offset;\n\n\t\t\toffset = gEngfuncs.pfnRandomFloat(-10, 10);\n\t\t\ttransform[Com_RandomLong(0, 2)][3] += offset;\n\t\t}\n\n\t\tbreak;\n\t}\n\n\tcase kRenderFxExplode:\n\t{\n\t\tif (iRenderStateChanged)\n\t\t{\n\t\t\tg_flStartScaleTime = m_clTime;\n\t\t\tiRenderStateChanged = FALSE;\n\t\t}\n\n\t\tfloat flTimeDelta = m_clTime - g_flStartScaleTime;\n\n\t\tif (flTimeDelta > 0)\n\t\t{\n\t\t\tfloat flScale = 0.001;\n\n\t\t\tif (flTimeDelta <= 2.0)\n\t\t\t\tflScale = 1.0 - (flTimeDelta / 2.0);\n\n\t\t\tfor (int i = 0; i < 3; i++)\n\t\t\t{\n\t\t\t\tfor (int j = 0; j < 3; j++)\n\t\t\t\t\ttransform[i][j] *= flScale;\n\t\t\t}\n\t\t}\n\n\t\tbreak;\n\t}\n\t}\n}\n\nvoid R_StudioInit(void)\n{\n\tg_StudioRenderer.Init();\n}\n\nint R_StudioDrawPlayer(int flags, entity_state_t *pplayer)\n{\n#ifndef NDEBUG\n\tif( g_StudioRenderer.m_pCvarDebug->value >= 8 )\n\t{\n\t\t\tcl_entity_t *pCurrentEntity = IEngineStudio.GetCurrentEntity();\n\t\t\tint ret = 0;\n\n\t\t\tif( pCurrentEntity )\n\t\t\t{\n\t\t\t\t\tcvar_t *drawEntites = g_StudioRenderer.m_pCvarDrawEntities;\n\t\t\t\t\tg_StudioRenderer.m_pCvarDebug->value -= 8;\n\t\t\t\t\tg_StudioRenderer.m_pCvarDrawEntities = g_StudioRenderer.m_pCvarDebug;\n\n\t\t\t\t\t// first draw interpolated\n\t\t\t\t\tret = g_StudioRenderer.StudioDrawPlayer( flags, pplayer );\n\n\t\t\t\t\t// then draw non-interpolated\n\t\t\t\t\t/*{\n\t\t\t\t\t\tVector saveOrigin = pCurrentEntity->origin;\n\t\t\t\t\t\tint savefx = pCurrentEntity->curstate.renderfx;\n\t\t\t\t\t\tint saveamt = pCurrentEntity->curstate.renderamt;\n\t\t\t\t\t\tcolor24 savecolor = pCurrentEntity->curstate.rendercolor;\n\n\t\t\t\t\t\tpCurrentEntity->curstate.renderfx = kRenderFxGlowShell;\n\t\t\t\t\t\tpCurrentEntity->curstate.rendercolor.r = 0;\n\t\t\t\t\t\tpCurrentEntity->curstate.rendercolor.g = 0;\n\t\t\t\t\t\tpCurrentEntity->curstate.rendercolor.b = 255;\n\t\t\t\t\t\tpCurrentEntity->curstate.renderamt = 255;\n\t\t\t\t\t\tpCurrentEntity->origin = pCurrentEntity->curstate.origin;\n\n\t\t\t\t\t\tg_StudioRenderer.StudioDrawPlayer( flags, pplayer );\n\t\t\t\t\t\tpCurrentEntity->origin = saveOrigin;\n\t\t\t\t\t\tpCurrentEntity->curstate.renderfx = savefx;\n\t\t\t\t\t\tpCurrentEntity->curstate.renderamt   = saveamt;\n\t\t\t\t\t\tpCurrentEntity->curstate.rendercolor = savecolor;\n\t\t\t\t\t}\n\n\t\t\t\t\t// then draw non-interpolated\n\t\t\t\t\t{\n\t\t\t\t\t\tVector saveOrigin = pCurrentEntity->origin;\n\t\t\t\t\t\tint savefx = pCurrentEntity->curstate.renderfx;\n\t\t\t\t\t\tint saveamt = pCurrentEntity->curstate.renderamt;\n\t\t\t\t\t\tcolor24 savecolor = pCurrentEntity->curstate.rendercolor;\n\n\t\t\t\t\t\tpCurrentEntity->curstate.renderfx = kRenderFxGlowShell;\n\t\t\t\t\t\tpCurrentEntity->curstate.rendercolor.r = 255;\n\t\t\t\t\t\tpCurrentEntity->curstate.rendercolor.g = 0;\n\t\t\t\t\t\tpCurrentEntity->curstate.rendercolor.b = 0;\n\t\t\t\t\t\tpCurrentEntity->curstate.renderamt = 255;\n\t\t\t\t\t\tpCurrentEntity->origin = pCurrentEntity->prevstate.origin;\n\n\t\t\t\t\t\tg_StudioRenderer.StudioDrawPlayer( flags, pplayer );\n\t\t\t\t\t\tpCurrentEntity->origin = saveOrigin;\n\t\t\t\t\t\tpCurrentEntity->curstate.renderfx    = savefx;\n\t\t\t\t\t\tpCurrentEntity->curstate.renderamt   = saveamt;\n\t\t\t\t\t\tpCurrentEntity->curstate.rendercolor = savecolor;\n\t\t\t\t\t}*/\n\n\n\t\t\t\t\tg_StudioRenderer.m_pCvarDrawEntities = drawEntites;\n\t\t\t\t\tg_StudioRenderer.m_pCvarDebug->value += 8;\n\t\t\t}\n\n\t\t\treturn ret;\n\t}\n\telse\n#endif\n\treturn g_StudioRenderer.StudioDrawPlayer(flags, pplayer);\n}\n\nint R_StudioDrawModel(int flags)\n{\n\treturn g_StudioRenderer.StudioDrawModel(flags);\n}\n// The simple drawing interface we'll pass back to the engine\nr_studio_interface_t studio =\n{\n\tSTUDIO_INTERFACE_VERSION,\n\tR_StudioDrawModel,\n\tR_StudioDrawPlayer,\n};\n\n/*\n====================\nHUD_GetStudioModelInterface\nExport this function for the engine to use the studio renderer class to render objects.\n====================\n*/\nint DLLEXPORT HUD_GetStudioModelInterface( int version, struct r_studio_interface_s **ppinterface, struct engine_studio_api_s *pstudio )\n{\n\tif ( version != STUDIO_INTERFACE_VERSION )\n\t\treturn 0;\n\n\t// Point the engine to our callbacks\n\t*ppinterface = &studio;\n\n\t// Copy in engine helper functions\n\tIEngineStudio = *pstudio;\n\n\t// Initialize local variables, etc.\n\tR_StudioInit();\n\n\t// Success\n\treturn 1;\n}\n\n"
  },
  {
    "path": "cl_dll/GameStudioModelRenderer.h",
    "content": "\n/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\n*\tThis product contains software technology licensed from Id\n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc.\n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n\n// Big thanks to Chicken Fortress developers\n// for this code.\n\n#pragma once\n#if !defined (GAMESTUDIOMODELRENDERER_H)\n#define GAMESTUDIOMODELRENDERER_H\n\n#include \"studio.h\"\n#include \"StudioModelRenderer.h\"\n\nenum BoneIndex\n{\n\tBONE_HEAD,\n\tBONE_PELVIS,\n\tBONE_SPINE1,\n\tBONE_SPINE2,\n\tBONE_SPINE3,\n\tBONE_MAX,\n};\n\nstruct client_anim_state_t\n{\n\tvec3_t origin;\n\tvec3_t angles;\n\n\tvec3_t realangles;\n\n\tfloat animtime;\n\tfloat frame;\n\tint sequence;\n\tint gaitsequence;\n\tfloat framerate;\n\n\tint m_fSequenceLoops;\n\tint m_fSequenceFinished;\n\n\tbyte controller[4];\n\tbyte blending[2];\n\n\tlatchedvars_t lv;\n};\n\nclass CGameStudioModelRenderer : public CStudioModelRenderer\n{\npublic:\n\tCGameStudioModelRenderer(void);\n\npublic:\n\tvirtual void StudioSetupBones(void);\n\tvirtual void StudioEstimateGait(entity_state_t *pplayer);\n\tvirtual void StudioProcessGait(entity_state_t *pplayer);\n\tvirtual int StudioDrawPlayer(int flags, entity_state_t *pplayer);\n\tvirtual int _StudioDrawPlayer(int flags, entity_state_t *pplayer);\n\tvirtual void StudioFxTransform(cl_entity_t *ent, float transform[3][4]);\n\tvirtual void StudioPlayerBlend(mstudioseqdesc_t *pseqdesc, int *pBlend, float *pPitch);\n\tvirtual void CalculateYawBlend(entity_state_t *pplayer);\n\tvirtual void CalculatePitchBlend(entity_state_t *pplayer);\n\nprivate:\n\tvoid SavePlayerState(entity_state_t *pplayer);\n\tvoid SetupClientAnimation(entity_state_t *pplayer);\n\tvoid RestorePlayerState(entity_state_t *pplayer);\n\tmstudioanim_t* LookupAnimation(mstudioseqdesc_t *pseqdesc, int index);\n\nprivate:\n\tint m_nPlayerGaitSequences[MAX_CLIENTS];\n\tbool m_bLocal;\n};\n\nextern CGameStudioModelRenderer g_StudioRenderer;\nextern int g_rseq;\nextern int g_gaitseq;\nextern Vector g_clorg;\nextern Vector g_clang;\n\n#endif\n"
  },
  {
    "path": "cl_dll/ScenarioStatus.cpp",
    "content": ""
  },
  {
    "path": "cl_dll/SniperScope.cpp",
    "content": ""
  },
  {
    "path": "cl_dll/StudioModelRenderer.cpp",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\n*\tThis product contains software technology licensed from Id\n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc.\n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n\n// Big thanks to Chicken Fortress developers\n// for this code.\n#include <assert.h>\n#include \"hud.h\"\n#include \"cl_util.h\"\n#include \"const.h\"\n#include \"com_model.h\"\n#include \"studio.h\"\n#include \"entity_state.h\"\n#include \"cl_entity.h\"\n#include \"dlight.h\"\n#include \"triangleapi.h\"\n\n#include <stdio.h>\n#include <string.h>\n#include <memory.h>\n#include <math.h>\n\n#include \"studio_util.h\"\n#include \"r_studioint.h\"\n\n#include \"StudioModelRenderer.h\"\n#include \"GameStudioModelRenderer.h\"\n\n#include \"event_api.h\"\n#include \"pm_defs.h\"\n\n#include \"com_weapons.h\"\n\nextern CGameStudioModelRenderer g_StudioRenderer;\nextern engine_studio_api_t IEngineStudio;\ntypedef struct pmtrace_s pmtrace_t;\n\nvoid CStudioModelRenderer::Init(void)\n{\n\tm_pCvarHiModels = IEngineStudio.GetCvar(\"cl_himodels\");\n\tm_pCvarDeveloper = IEngineStudio.GetCvar(\"developer\");\n\tm_pCvarDrawEntities = IEngineStudio.GetCvar(\"r_drawentities\");\n\tm_pCvarShadows = CVAR_CREATE(\"cl_shadows\", \"1\", FCVAR_ARCHIVE );\n#ifndef NDEBUG\n\tm_pCvarDebug = CVAR_CREATE( \"r_smr_debug\", \"0\", 0 );\n#endif\n\tm_pChromeSprite = IEngineStudio.GetChromeSprite();\n\n\tIEngineStudio.GetModelCounters(&m_pStudioModelCount, &m_pModelsDrawn);\n\n\tm_pbonetransform = (float (*)[MAXSTUDIOBONES][3][4])IEngineStudio.StudioGetBoneTransform();\n\tm_plighttransform = (float (*)[MAXSTUDIOBONES][3][4])IEngineStudio.StudioGetLightTransform();\n\tm_paliastransform = (float (*)[3][4])IEngineStudio.StudioGetAliasTransform();\n\tm_protationmatrix = (float (*)[3][4])IEngineStudio.StudioGetRotationMatrix();\n}\n\nCStudioModelRenderer::CStudioModelRenderer(void)\n{\n\tm_fDoInterp = 1;\n\tm_fGaitEstimation = 1;\n\tm_pCurrentEntity = NULL;\n\tm_pCvarHiModels = NULL;\n\tm_pCvarDeveloper = NULL;\n\tm_pCvarDrawEntities = NULL;\n\tm_pChromeSprite = NULL;\n\tm_pStudioModelCount = NULL;\n\tm_pModelsDrawn = NULL;\n\tm_protationmatrix = NULL;\n\tm_paliastransform = NULL;\n\tm_pbonetransform = NULL;\n\tm_plighttransform = NULL;\n\tm_pStudioHeader = NULL;\n\tm_pBodyPart = NULL;\n\tm_pSubModel = NULL;\n\tm_pPlayerInfo = NULL;\n\tm_pRenderModel = NULL;\n\tm_iShadowSprite = 0;\n}\n\nCStudioModelRenderer::~CStudioModelRenderer(void)\n{\n}\n\nvoid CStudioModelRenderer::StudioCalcBoneAdj(float dadt, float *adj, const byte *pcontroller1, const byte *pcontroller2, byte mouthopen)\n{\n\tint i, j;\n\tfloat value;\n\tmstudiobonecontroller_t *pbonecontroller;\n\n\tpbonecontroller = (mstudiobonecontroller_t *)((byte *)m_pStudioHeader + m_pStudioHeader->bonecontrollerindex);\n\n\tfor (j = 0; j < m_pStudioHeader->numbonecontrollers; j++)\n\t{\n\t\ti = pbonecontroller[j].index;\n\n\t\tif (i <= 3)\n\t\t{\n\t\t\tif (pbonecontroller[j].type & STUDIO_RLOOP)\n\t\t\t{\n\t\t\t\tif (abs(pcontroller1[i] - pcontroller2[i]) > 128)\n\t\t\t\t{\n\t\t\t\t\tint a, b;\n\t\t\t\t\ta = (pcontroller1[j] + 128) % 256;\n\t\t\t\t\tb = (pcontroller2[j] + 128) % 256;\n\t\t\t\t\tvalue = ((a * dadt) + (b * (1 - dadt)) - 128) * (360.0 / 256.0) + pbonecontroller[j].start;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tvalue = ((pcontroller1[i] * dadt + (pcontroller2[i]) * (1.0 - dadt))) * (360.0 / 256.0) + pbonecontroller[j].start;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tvalue = (pcontroller1[i] * dadt + pcontroller2[i] * (1.0 - dadt)) / 255.0;\n\n\t\t\t\tif (value < 0)\n\t\t\t\t\tvalue = 0;\n\n\t\t\t\tif (value > 1.0)\n\t\t\t\t\tvalue = 1.0;\n\n\t\t\t\tvalue = (1.0 - value) * pbonecontroller[j].start + value * pbonecontroller[j].end;\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tvalue = mouthopen / 64.0;\n\n\t\t\tif (value > 1.0)\n\t\t\t\tvalue = 1.0;\n\n\t\t\tvalue = (1.0 - value) * pbonecontroller[j].start + value * pbonecontroller[j].end;\n\t\t}\n\n\t\tswitch (pbonecontroller[j].type & STUDIO_TYPES)\n\t\t{\n\t\t\tcase STUDIO_XR:\n\t\t\tcase STUDIO_YR:\n\t\t\tcase STUDIO_ZR:\n\t\t\t{\n\t\t\t\tadj[j] = value * (M_PI / 180.0);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase STUDIO_X:\n\t\t\tcase STUDIO_Y:\n\t\t\tcase STUDIO_Z:\n\t\t\t{\n\t\t\t\tadj[j] = value;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n}\n\nvoid CStudioModelRenderer::StudioCalcBoneQuaterion(int frame, float s, mstudiobone_t *pbone, mstudioanim_t *panim, float *adj, float *q)\n{\n\tint j, k;\n\tvec4_t q1, q2;\n\tvec3_t angle1, angle2;\n\tmstudioanimvalue_t *panimvalue;\n\n\tfor (j = 0; j < 3; j++)\n\t{\n\t\tif (panim->offset[j + 3] == 0)\n\t\t{\n\t\t\tangle2[j] = angle1[j] = pbone->value[j + 3];\n\t\t}\n\t\telse\n\t\t{\n\t\t\tpanimvalue = (mstudioanimvalue_t *)((byte *)panim + panim->offset[j + 3]);\n\t\t\tk = frame;\n\n\t\t\tif (panimvalue->num.total < panimvalue->num.valid)\n\t\t\t\tk = 0;\n\n\t\t\twhile (panimvalue->num.total <= k)\n\t\t\t{\n\t\t\t\tk -= panimvalue->num.total;\n\t\t\t\tpanimvalue += panimvalue->num.valid + 1;\n\n\t\t\t\tif (panimvalue->num.total < panimvalue->num.valid)\n\t\t\t\t\tk = 0;\n\t\t\t}\n\n\t\t\tif (panimvalue->num.valid > k)\n\t\t\t{\n\t\t\t\tangle1[j] = panimvalue[k + 1].value;\n\n\t\t\t\tif (panimvalue->num.valid > k + 1)\n\t\t\t\t{\n\t\t\t\t\tangle2[j] = panimvalue[k + 2].value;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tif (panimvalue->num.total > k + 1)\n\t\t\t\t\t\tangle2[j] = angle1[j];\n\t\t\t\t\telse\n\t\t\t\t\t\tangle2[j] = panimvalue[panimvalue->num.valid + 2].value;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tangle1[j] = panimvalue[panimvalue->num.valid].value;\n\n\t\t\t\tif (panimvalue->num.total > k + 1)\n\t\t\t\t\tangle2[j] = angle1[j];\n\t\t\t\telse\n\t\t\t\t\tangle2[j] = panimvalue[panimvalue->num.valid + 2].value;\n\t\t\t}\n\n\t\t\tangle1[j] = pbone->value[j + 3] + angle1[j] * pbone->scale[j + 3];\n\t\t\tangle2[j] = pbone->value[j + 3] + angle2[j] * pbone->scale[j + 3];\n\t\t}\n\n\t\tif (pbone->bonecontroller[j + 3] != -1)\n\t\t{\n\t\t\tangle1[j] += adj[pbone->bonecontroller[j + 3]];\n\t\t\tangle2[j] += adj[pbone->bonecontroller[j + 3]];\n\t\t}\n\t}\n\n\tif (!VectorCompare(angle1, angle2))\n\t{\n\t\tAngleQuaternion(angle1, q1);\n\t\tAngleQuaternion(angle2, q2);\n\t\tQuaternionSlerp(q1, q2, s, q);\n\t}\n\telse\n\t{\n\t\tAngleQuaternion(angle1, q);\n\t}\n}\n\nvoid CStudioModelRenderer::StudioCalcBonePosition(int frame, float s, mstudiobone_t *pbone, mstudioanim_t *panim, float *adj, float *pos)\n{\n\tint j, k;\n\tmstudioanimvalue_t *panimvalue;\n\n\tfor (j = 0; j < 3; j++)\n\t{\n\t\tpos[j] = pbone->value[j];\n\n\t\tif (panim->offset[j] != 0)\n\t\t{\n\t\t\tpanimvalue = (mstudioanimvalue_t *)((byte *)panim + panim->offset[j]);\n\t\t\tk = frame;\n\n\t\t\tif (panimvalue->num.total < panimvalue->num.valid)\n\t\t\t\tk = 0;\n\n\t\t\twhile (panimvalue->num.total <= k)\n\t\t\t{\n\t\t\t\tk -= panimvalue->num.total;\n\t\t\t\tpanimvalue += panimvalue->num.valid + 1;\n\n\t\t\t\tif (panimvalue->num.total < panimvalue->num.valid)\n\t\t\t\t\tk = 0;\n\t\t\t}\n\n\t\t\tif (panimvalue->num.valid > k)\n\t\t\t{\n\t\t\t\tif (panimvalue->num.valid > k + 1)\n\t\t\t\t\tpos[j] += (panimvalue[k + 1].value * (1.0 - s) + s * panimvalue[k + 2].value) * pbone->scale[j];\n\t\t\t\telse\n\t\t\t\t\tpos[j] += panimvalue[k + 1].value * pbone->scale[j];\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif (panimvalue->num.total <= k + 1)\n\t\t\t\t\tpos[j] += (panimvalue[panimvalue->num.valid].value * (1.0 - s) + s * panimvalue[panimvalue->num.valid + 2].value) * pbone->scale[j];\n\t\t\t\telse\n\t\t\t\t\tpos[j] += panimvalue[panimvalue->num.valid].value * pbone->scale[j];\n\t\t\t}\n\t\t}\n\n\t\tif (pbone->bonecontroller[j] != -1 && adj)\n\t\t\tpos[j] += adj[pbone->bonecontroller[j]];\n\t}\n}\n\nvoid CStudioModelRenderer::StudioSlerpBones(vec4_t q1[], float pos1[][3], vec4_t q2[], float pos2[][3], float s)\n{\n\tint i;\n\tvec4_t q3;\n\tfloat s1;\n\n\tif (s < 0)\n\t\ts = 0;\n\telse if (s > 1.0)\n\t\ts = 1.0;\n\n\ts1 = 1.0 - s;\n\n\tfor (i = 0; i < m_pStudioHeader->numbones; i++)\n\t{\n\t\tQuaternionSlerp(q1[i], q2[i], s, q3);\n\n\t\tq1[i][0] = q3[0];\n\t\tq1[i][1] = q3[1];\n\t\tq1[i][2] = q3[2];\n\t\tq1[i][3] = q3[3];\n\t\tpos1[i][0] = pos1[i][0] * s1 + pos2[i][0] * s;\n\t\tpos1[i][1] = pos1[i][1] * s1 + pos2[i][1] * s;\n\t\tpos1[i][2] = pos1[i][2] * s1 + pos2[i][2] * s;\n\t}\n}\n\nmstudioanim_t *CStudioModelRenderer::StudioGetAnim(model_t *pSubModel, mstudioseqdesc_t *pseqdesc)\n{\n\tmstudioseqgroup_t *pseqgroup;\n\tcache_user_t *paSequences;\n\n\tpseqgroup = (mstudioseqgroup_t *)((byte *)m_pStudioHeader + m_pStudioHeader->seqgroupindex) + pseqdesc->seqgroup;\n\n\tif (pseqdesc->seqgroup == 0)\n\t\treturn (mstudioanim_t *)((byte *)m_pStudioHeader + pseqdesc->animindex);\n\n\tpaSequences = (cache_user_t *)pSubModel->submodels;\n\n\tif (paSequences == NULL)\n\t{\n\t\tpaSequences = (cache_user_t *)IEngineStudio.Mem_Calloc(16, sizeof(cache_user_t));\n\t\tpSubModel->submodels = (dmodel_t *)paSequences;\n\t}\n\n\tif (!IEngineStudio.Cache_Check((struct cache_user_s *)&(paSequences[pseqdesc->seqgroup])))\n\t{\n\t\tgEngfuncs.Con_DPrintf(\"loading %s\\n\", pseqgroup->name);\n\t\tIEngineStudio.LoadCacheFile(pseqgroup->name, (struct cache_user_s *)&paSequences[pseqdesc->seqgroup]);\n\t}\n\n\treturn (mstudioanim_t *)((byte *)paSequences[pseqdesc->seqgroup].data + pseqdesc->animindex);\n}\n\nvoid CStudioModelRenderer::StudioPlayerBlend(mstudioseqdesc_t *pseqdesc, int *pBlend, float *pPitch)\n{\n\t*pBlend = (*pPitch * 3);\n\n\tif (*pBlend < pseqdesc->blendstart[0])\n\t{\n\t\t*pPitch -= pseqdesc->blendstart[0] / 3.0;\n\t\t*pBlend = 0;\n\t}\n\telse if (*pBlend > pseqdesc->blendend[0])\n\t{\n\t\t*pPitch -= pseqdesc->blendend[0] / 3.0;\n\t\t*pBlend = 255;\n\t}\n\telse\n\t{\n\t\tif (pseqdesc->blendend[0] - pseqdesc->blendstart[0] < 0.1)\n\t\t\t*pBlend = 127;\n\t\telse\n\t\t\t*pBlend = 255 * (*pBlend - pseqdesc->blendstart[0]) / (pseqdesc->blendend[0] - pseqdesc->blendstart[0]);\n\n\t\t*pPitch = 0;\n\t}\n}\n\nvoid CStudioModelRenderer::StudioSetUpTransform(int trivial_accept)\n{\n\tint i;\n\tvec3_t angles;\n\tvec3_t modelpos;\n\n\tVectorCopy(m_pCurrentEntity->origin, modelpos);\n\n\tangles[ROLL] = m_pCurrentEntity->curstate.angles[ROLL];\n\tangles[PITCH] = m_pCurrentEntity->curstate.angles[PITCH];\n\tangles[YAW] = m_pCurrentEntity->curstate.angles[YAW];\n\n\tif (m_pCurrentEntity->curstate.movetype != MOVETYPE_NONE)\n\t{\n\t\tVectorCopy(m_pCurrentEntity->angles, angles);\n\t}\n\n\tangles[PITCH] = -angles[PITCH];\n\tAngleMatrix(angles, (*m_protationmatrix));\n\n\tif (!IEngineStudio.IsHardware())\n\t{\n\t\tstatic float viewmatrix[3][4];\n\n\t\tVectorCopy(m_vRight, viewmatrix[0]);\n\t\tVectorCopy(m_vUp, viewmatrix[1]);\n\t\tVectorInverse(viewmatrix[1]);\n\t\tVectorCopy(m_vNormal, viewmatrix[2]);\n\n\t\t(*m_protationmatrix)[0][3] = modelpos[0] - m_vRenderOrigin[0];\n\t\t(*m_protationmatrix)[1][3] = modelpos[1] - m_vRenderOrigin[1];\n\t\t(*m_protationmatrix)[2][3] = modelpos[2] - m_vRenderOrigin[2];\n\n\t\tConcatTransforms(viewmatrix, (*m_protationmatrix), (*m_paliastransform));\n\n\t\tif (trivial_accept)\n\t\t{\n\t\t\tfor (i = 0; i < 4; i++)\n\t\t\t{\n\t\t\t\t(*m_paliastransform)[0][i] *= m_fSoftwareXScale * (1.0 / (ZISCALE * 0x10000));\n\t\t\t\t(*m_paliastransform)[1][i] *= m_fSoftwareYScale * (1.0 / (ZISCALE * 0x10000));\n\t\t\t\t(*m_paliastransform)[2][i] *= 1.0 / (ZISCALE * 0x10000);\n\t\t\t}\n\t\t}\n\t}\n\n\t(*m_protationmatrix)[0][3] = modelpos[0];\n\t(*m_protationmatrix)[1][3] = modelpos[1];\n\t(*m_protationmatrix)[2][3] = modelpos[2];\n}\n\nfloat CStudioModelRenderer::StudioEstimateInterpolant(void)\n{\n\tfloat dadt = 1.0;\n\n\tif (m_fDoInterp && (m_pCurrentEntity->curstate.animtime >= m_pCurrentEntity->latched.prevanimtime + 0.01))\n\t{\n\t\tdadt = (m_clTime - m_pCurrentEntity->curstate.animtime) / 0.1;\n\n\t\tif (dadt > 2.0)\n\t\t\tdadt = 2.0;\n\t}\n\n\treturn dadt;\n}\n\nvoid CStudioModelRenderer::StudioCalcRotations(float pos[][3], vec4_t *q, mstudioseqdesc_t *pseqdesc, mstudioanim_t *panim, float f)\n{\n\tint i;\n\tint frame;\n\tmstudiobone_t *pbone;\n\n\tfloat s;\n\tfloat adj[MAXSTUDIOCONTROLLERS];\n\tfloat dadt;\n\n\tif (f > pseqdesc->numframes - 1)\n\t\tf = 0;\n\telse if (f < -0.01)\n\t\tf = -0.01;\n\n\tframe = (int)f;\n\tdadt = StudioEstimateInterpolant();\n\ts = (f - frame);\n\n\tpbone = (mstudiobone_t *)((byte *)m_pStudioHeader + m_pStudioHeader->boneindex);\n\n\tStudioCalcBoneAdj(dadt, adj, m_pCurrentEntity->curstate.controller, m_pCurrentEntity->latched.prevcontroller, m_pCurrentEntity->mouth.mouthopen);\n\n\tfor (i = 0; i < m_pStudioHeader->numbones; i++, pbone++, panim++)\n\t{\n\t\tStudioCalcBoneQuaterion(frame, s, pbone, panim, adj, q[i]);\n\t\tStudioCalcBonePosition(frame, s, pbone, panim, adj, pos[i]);\n\t}\n\n\tif (pseqdesc->motiontype & STUDIO_X)\n\t\tpos[pseqdesc->motionbone][0] = 0.0;\n\n\tif (pseqdesc->motiontype & STUDIO_Y)\n\t\tpos[pseqdesc->motionbone][1] = 0.0;\n\n\tif (pseqdesc->motiontype & STUDIO_Z)\n\t\tpos[pseqdesc->motionbone][2] = 0.0;\n\n\ts = 0 * ((1.0 - (f - (int)(f))) / (pseqdesc->numframes)) * m_pCurrentEntity->curstate.framerate;\n\n\tif (pseqdesc->motiontype & STUDIO_LX)\n\t\tpos[pseqdesc->motionbone][0] += s * pseqdesc->linearmovement[0];\n\n\tif (pseqdesc->motiontype & STUDIO_LY)\n\t\tpos[pseqdesc->motionbone][1] += s * pseqdesc->linearmovement[1];\n\n\tif (pseqdesc->motiontype & STUDIO_LZ)\n\t\tpos[pseqdesc->motionbone][2] += s * pseqdesc->linearmovement[2];\n}\n\nvoid CStudioModelRenderer::StudioFxTransform(cl_entity_t *ent, float transform[3][4])\n{\n\tswitch (ent->curstate.renderfx)\n\t{\n\t\tcase kRenderFxDistort:\n\t\tcase kRenderFxHologram:\n\t\t{\n\t\t\tif (Com_RandomLong(0, 49) == 0)\n\t\t\t{\n\t\t\t\tint axis = Com_RandomLong(0, 1);\n\n\t\t\t\tif (axis == 1)\n\t\t\t\t\taxis = 2;\n\n\t\t\t\tVectorScale( transform[axis], gEngfuncs.pfnRandomFloat(1,1.484), transform[axis] );\n\t\t\t}\n\t\t\telse if (Com_RandomLong(0, 49) == 0)\n\t\t\t{\n\t\t\t\tfloat offset;\n\t\t\t\tint axis = Com_RandomLong(0, 1);\n\n\t\t\t\tif (axis == 1)\n\t\t\t\t\taxis = 2;\n\n\t\t\t\toffset = gEngfuncs.pfnRandomFloat(-10, 10);\n\t\t\t\ttransform[Com_RandomLong(0, 2)][3] += offset;\n\t\t\t}\n\n\t\t\tbreak;\n\t\t}\n\n\t\tcase kRenderFxExplode:\n\t\t{\n\t\t\tfloat scale;\n\n\t\t\tscale = 1.0 + (m_clTime - ent->curstate.animtime) * 10.0;\n\n\t\t\tif (scale > 2)\n\t\t\t\tscale = 2;\n\n\t\t\ttransform[0][1] *= scale;\n\t\t\ttransform[1][1] *= scale;\n\t\t\ttransform[2][1] *= scale;\n\t\t\tbreak;\n\t\t}\n\t}\n}\n\nfloat CStudioModelRenderer::StudioEstimateFrame(mstudioseqdesc_t *pseqdesc)\n{\n\tdouble dfdt, f;\n\n\tif (m_fDoInterp)\n\t{\n\t\tif (m_clTime < m_pCurrentEntity->curstate.animtime)\n\t\t\tdfdt = 0;\n\t\telse\n\t\t\tdfdt = (m_clTime - m_pCurrentEntity->curstate.animtime) * m_pCurrentEntity->curstate.framerate * pseqdesc->fps;\n\t}\n\telse\n\t\tdfdt = 0;\n\n\tif (pseqdesc->numframes <= 1)\n\t\tf = 0;\n\telse\n\t\tf = (m_pCurrentEntity->curstate.frame * (pseqdesc->numframes - 1)) / 256.0;\n\n\tf += dfdt;\n\n\tif (pseqdesc->flags & STUDIO_LOOPING)\n\t{\n\t\tif (pseqdesc->numframes > 1)\n\t\t\tf -= (int)(f / (pseqdesc->numframes - 1)) * (pseqdesc->numframes - 1);\n\n\t\tif (f < 0)\n\t\t\tf += (pseqdesc->numframes - 1);\n\t}\n\telse\n\t{\n\t\tif (f >= pseqdesc->numframes - 1.001)\n\t\t\tf = pseqdesc->numframes - 1.001;\n\n\t\tif (f < 0.0)\n\t\t\tf = 0.0;\n\t}\n\n\treturn f;\n}\n\nvoid CStudioModelRenderer::StudioSetupBones(void)\n{\n\tint i;\n\tdouble f;\n\n\tmstudiobone_t *pbones;\n\tmstudioseqdesc_t *pseqdesc;\n\tmstudioanim_t *panim;\n\n\tstatic float pos[MAXSTUDIOBONES][3];\n\tstatic vec4_t q[MAXSTUDIOBONES];\n\tfloat bonematrix[3][4];\n\n\tstatic float pos2[MAXSTUDIOBONES][3];\n\tstatic vec4_t q2[MAXSTUDIOBONES];\n\tstatic float pos3[MAXSTUDIOBONES][3];\n\tstatic vec4_t q3[MAXSTUDIOBONES];\n\tstatic float pos4[MAXSTUDIOBONES][3];\n\tstatic vec4_t q4[MAXSTUDIOBONES];\n\n\tif( m_pCurrentEntity->curstate.sequence >= m_pStudioHeader->numseq\n\t\t|| m_pCurrentEntity->curstate.sequence < 0 )\n\t\tm_pCurrentEntity->curstate.sequence = 0;\n\n\tpseqdesc = (mstudioseqdesc_t *)((byte *)m_pStudioHeader + m_pStudioHeader->seqindex) + m_pCurrentEntity->curstate.sequence;\n\n\tf = StudioEstimateFrame(pseqdesc);\n\tpanim = StudioGetAnim(m_pRenderModel, pseqdesc);\n\n\tStudioCalcRotations(pos, q, pseqdesc, panim, f);\n\n\tif (pseqdesc->numblends > 1)\n\t{\n\t\tfloat s;\n\t\tfloat dadt;\n\n\t\tpanim += m_pStudioHeader->numbones;\n\t\tStudioCalcRotations(pos2, q2, pseqdesc, panim, f);\n\n\t\tdadt = StudioEstimateInterpolant();\n\t\ts = (m_pCurrentEntity->curstate.blending[0] * dadt + m_pCurrentEntity->latched.prevblending[0] * (1.0 - dadt)) / 255.0;\n\n\t\tStudioSlerpBones(q, pos, q2, pos2, s);\n\n\t\tif (pseqdesc->numblends == 4)\n\t\t{\n\t\t\tpanim += m_pStudioHeader->numbones;\n\t\t\tStudioCalcRotations(pos3, q3, pseqdesc, panim, f);\n\n\t\t\tpanim += m_pStudioHeader->numbones;\n\t\t\tStudioCalcRotations(pos4, q4, pseqdesc, panim, f);\n\n\t\t\ts = (m_pCurrentEntity->curstate.blending[0] * dadt + m_pCurrentEntity->latched.prevblending[0] * (1.0 - dadt)) / 255.0;\n\t\t\tStudioSlerpBones(q3, pos3, q4, pos4, s);\n\n\t\t\ts = (m_pCurrentEntity->curstate.blending[1] * dadt + m_pCurrentEntity->latched.prevblending[1] * (1.0 - dadt)) / 255.0;\n\t\t\tStudioSlerpBones(q, pos, q3, pos3, s);\n\t\t}\n\t}\n\n\tif (m_fDoInterp && m_pCurrentEntity->latched.sequencetime && (m_pCurrentEntity->latched.sequencetime + 0.2 > m_clTime) && (m_pCurrentEntity->latched.prevsequence < m_pStudioHeader->numseq))\n\t{\n\t\tstatic float pos1b[MAXSTUDIOBONES][3];\n\t\tstatic vec4_t q1b[MAXSTUDIOBONES];\n\t\tfloat s;\n\n\t\tpseqdesc = (mstudioseqdesc_t *)((byte *)m_pStudioHeader + m_pStudioHeader->seqindex) + m_pCurrentEntity->latched.prevsequence;\n\t\tpanim = StudioGetAnim(m_pRenderModel, pseqdesc);\n\n\t\tStudioCalcRotations(pos1b, q1b, pseqdesc, panim, m_pCurrentEntity->latched.prevframe);\n\n\t\tif (pseqdesc->numblends > 1)\n\t\t{\n\t\t\tpanim += m_pStudioHeader->numbones;\n\t\t\tStudioCalcRotations(pos2, q2, pseqdesc, panim, m_pCurrentEntity->latched.prevframe);\n\n\t\t\ts = (m_pCurrentEntity->latched.prevseqblending[0]) / 255.0;\n\t\t\tStudioSlerpBones(q1b, pos1b, q2, pos2, s);\n\n\t\t\tif (pseqdesc->numblends == 4)\n\t\t\t{\n\t\t\t\tpanim += m_pStudioHeader->numbones;\n\t\t\t\tStudioCalcRotations(pos3, q3, pseqdesc, panim, m_pCurrentEntity->latched.prevframe);\n\n\t\t\t\tpanim += m_pStudioHeader->numbones;\n\t\t\t\tStudioCalcRotations(pos4, q4, pseqdesc, panim, m_pCurrentEntity->latched.prevframe);\n\n\t\t\t\ts = (m_pCurrentEntity->latched.prevseqblending[0]) / 255.0;\n\t\t\t\tStudioSlerpBones(q3, pos3, q4, pos4, s);\n\n\t\t\t\ts = (m_pCurrentEntity->latched.prevseqblending[1]) / 255.0;\n\t\t\t\tStudioSlerpBones(q1b, pos1b, q3, pos3, s);\n\t\t\t}\n\t\t}\n\n\t\ts = 1.0 - (m_clTime - m_pCurrentEntity->latched.sequencetime) / 0.2;\n\t\tStudioSlerpBones(q, pos, q1b, pos1b, s);\n\t}\n\telse\n\t{\n\t\tm_pCurrentEntity->latched.prevframe = f;\n\t}\n\n\tpbones = (mstudiobone_t *)((byte *)m_pStudioHeader + m_pStudioHeader->boneindex);\n\n\tif (m_pPlayerInfo && m_pPlayerInfo->gaitsequence != 0)\n\t{\n\t\tpseqdesc = (mstudioseqdesc_t *)((byte *)m_pStudioHeader + m_pStudioHeader->seqindex) + m_pPlayerInfo->gaitsequence;\n\n\t\tpanim = StudioGetAnim(m_pRenderModel, pseqdesc);\n\t\tStudioCalcRotations(pos2, q2, pseqdesc, panim, m_pPlayerInfo->gaitframe);\n\n\t\tfor (i = 0; i < m_pStudioHeader->numbones; i++)\n\t\t{\n\t\t\tif (strcmp(pbones[i].name, \"Bip01 Spine\") == 0)\n\t\t\t\tbreak;\n\n\t\t\tmemcpy(pos[i], pos2[i], sizeof( pos[i]));\n\t\t\tmemcpy(q[i], q2[i], sizeof( q[i]));\n\t\t}\n\t}\n\n\tbool bIsViewModel = gEngfuncs.GetViewModel() == m_pCurrentEntity;\n\n\tfor (i = 0; i < m_pStudioHeader->numbones; i++)\n\t{\n\t\tQuaternionMatrix(q[i], bonematrix);\n\n\t\tbonematrix[0][3] = pos[i][0];\n\t\tbonematrix[1][3] = pos[i][1];\n\t\tbonematrix[2][3] = pos[i][2];\n\n\t\tif (pbones[i].parent == -1)\n\t\t{\n\t\t\tif (IEngineStudio.IsHardware())\n\t\t\t{\n\t\t\t\t// i know this looks HORRIBLE but I'm too lazy to simplify this right now\n\t\t\t\tif( gHUD.cl_righthand && gHUD.cl_righthand->value > 0.0f && bIsViewModel )\n\t\t\t\t{\n\t\t\t\t\tbonematrix[1][0] = -bonematrix[1][0];\n\t\t\t\t\tbonematrix[1][1] = -bonematrix[1][1];\n\t\t\t\t\tbonematrix[1][2] = -bonematrix[1][2];\n\t\t\t\t\tbonematrix[1][3] = -bonematrix[1][3];\n\t\t\t\t}\n\n\t\t\t\tConcatTransforms((*m_protationmatrix), bonematrix, (*m_pbonetransform)[i]);\n\t\t\t\tMatrixCopy((*m_pbonetransform)[i], (*m_plighttransform)[i]);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tConcatTransforms((*m_paliastransform), bonematrix, (*m_pbonetransform)[i]);\n\t\t\t\tConcatTransforms((*m_protationmatrix), bonematrix, (*m_plighttransform)[i]);\n\t\t\t}\n\n\t\t\tStudioFxTransform(m_pCurrentEntity, (*m_pbonetransform)[i]);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tConcatTransforms((*m_pbonetransform)[pbones[i].parent], bonematrix, (*m_pbonetransform)[i]);\n\t\t\tConcatTransforms((*m_plighttransform)[pbones[i].parent], bonematrix, (*m_plighttransform)[i]);\n\t\t}\n\t}\n}\n\nvoid CStudioModelRenderer::StudioSaveBones(void)\n{\n\tint i;\n\n\tmstudiobone_t *pbones;\n\tpbones = (mstudiobone_t *)((byte *)m_pStudioHeader + m_pStudioHeader->boneindex);\n\n\tm_nCachedBones = m_pStudioHeader->numbones;\n\n\tfor (i = 0; i < m_pStudioHeader->numbones; i++)\n\t{\n\t\tstrncpy(m_nCachedBoneNames[i], pbones[i].name, 32);\n\t\tMatrixCopy((*m_pbonetransform)[i], m_rgCachedBoneTransform[i]);\n\t\tMatrixCopy((*m_plighttransform)[i], m_rgCachedLightTransform[i]);\n\t}\n\n}\n\nvoid CStudioModelRenderer::StudioMergeBones(model_t *pSubModel)\n{\n\tint i, j;\n\tdouble f;\n\n\tmstudiobone_t *pbones;\n\tmstudioseqdesc_t *pseqdesc;\n\tmstudioanim_t *panim;\n\n\tstatic float pos[MAXSTUDIOBONES][3];\n\tfloat bonematrix[3][4];\n\tstatic vec4_t q[MAXSTUDIOBONES];\n\n\tif( !m_pStudioHeader || !m_pCurrentEntity )\n\t\treturn;\n\n\tif (m_pCurrentEntity->curstate.sequence >= m_pStudioHeader->numseq)\n\t\tm_pCurrentEntity->curstate.sequence = 0;\n\n\tpseqdesc = (mstudioseqdesc_t *)((byte *)m_pStudioHeader + m_pStudioHeader->seqindex) + m_pCurrentEntity->curstate.sequence;\n\n\tf = StudioEstimateFrame(pseqdesc);\n\n\t/*if (m_pCurrentEntity->latched.prevframe > f)\n\t{\n\t}*/\n\n\tpanim = StudioGetAnim(pSubModel, pseqdesc);\n\tStudioCalcRotations(pos, q, pseqdesc, panim, f);\n\n\tpbones = (mstudiobone_t *)((byte *)m_pStudioHeader + m_pStudioHeader->boneindex);\n\n\tfor (i = 0; i < m_pStudioHeader->numbones; i++)\n\t{\n\t\tfor (j = 0; j < m_nCachedBones; j++)\n\t\t{\n\t\t\tif (stricmp(pbones[i].name, m_nCachedBoneNames[j]) == 0)\n\t\t\t{\n\t\t\t\tMatrixCopy(m_rgCachedBoneTransform[j], (*m_pbonetransform)[i]);\n\t\t\t\tMatrixCopy(m_rgCachedLightTransform[j], (*m_plighttransform)[i]);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tif (j >= m_nCachedBones)\n\t\t{\n\t\t\tQuaternionMatrix(q[i], bonematrix);\n\n\t\t\tbonematrix[0][3] = pos[i][0];\n\t\t\tbonematrix[1][3] = pos[i][1];\n\t\t\tbonematrix[2][3] = pos[i][2];\n\n\t\t\tif (pbones[i].parent == -1)\n\t\t\t{\n\t\t\t\tif (IEngineStudio.IsHardware())\n\t\t\t\t{\n\t\t\t\t\tConcatTransforms((*m_protationmatrix), bonematrix, (*m_pbonetransform)[i]);\n\t\t\t\t\tMatrixCopy((*m_pbonetransform)[i], (*m_plighttransform)[i]);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tConcatTransforms((*m_paliastransform), bonematrix, (*m_pbonetransform)[i]);\n\t\t\t\t\tConcatTransforms((*m_protationmatrix), bonematrix, (*m_plighttransform)[i]);\n\t\t\t\t}\n\n\t\t\t\tStudioFxTransform(m_pCurrentEntity, (*m_pbonetransform)[i]);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tConcatTransforms((*m_pbonetransform)[pbones[i].parent], bonematrix, (*m_pbonetransform)[i]);\n\t\t\t\tConcatTransforms((*m_plighttransform)[pbones[i].parent], bonematrix, (*m_plighttransform)[i]);\n\t\t\t}\n\t\t}\n\t}\n}\n\nint CStudioModelRenderer::StudioDrawModel(int flags)\n{\n\tbool bChangedRightHand = false;\n\tint iRightHandValue;\n\n\tm_pCurrentEntity = IEngineStudio.GetCurrentEntity();\n\n\tIEngineStudio.GetTimes(&m_nFrameCount, &m_clTime, &m_clOldTime);\n\tIEngineStudio.GetViewInfo(m_vRenderOrigin, m_vUp, m_vRight, m_vNormal);\n\tIEngineStudio.GetAliasScale(&m_fSoftwareXScale, &m_fSoftwareYScale);\n\n\tif (m_pCurrentEntity->curstate.renderfx == kRenderFxDeadPlayer)\n\t{\n\t\tentity_state_t deadplayer;\n\n\t\tint result;\n\t\tint save_interp;\n\n\t\tif (m_pCurrentEntity->curstate.renderamt <= 0 || m_pCurrentEntity->curstate.renderamt > gEngfuncs.GetMaxClients())\n\t\t\treturn 0;\n\n\t\tdeadplayer = *(IEngineStudio.GetPlayerState(m_pCurrentEntity->curstate.renderamt - 1));\n\n\t\tdeadplayer.number = m_pCurrentEntity->curstate.renderamt;\n\t\tdeadplayer.weaponmodel = 0;\n\t\tdeadplayer.gaitsequence = 0;\n\n\t\tdeadplayer.movetype = MOVETYPE_NONE;\n\t\tVectorCopy(m_pCurrentEntity->curstate.angles, deadplayer.angles);\n\t\tVectorCopy(m_pCurrentEntity->curstate.origin, deadplayer.origin);\n\n\t\tsave_interp = m_fDoInterp;\n\t\tm_fDoInterp = 0;\n\n\t\tresult = StudioDrawPlayer(flags, &deadplayer);\n\n\t\tm_fDoInterp = save_interp;\n\t\treturn result;\n\t}\n\n\tm_pRenderModel = m_pCurrentEntity->model;\n\tm_pStudioHeader = (studiohdr_t *)IEngineStudio.Mod_Extradata(m_pRenderModel);\n\n\tIEngineStudio.StudioSetHeader(m_pStudioHeader);\n\tIEngineStudio.SetRenderModel(m_pRenderModel);\n\n\tStudioSetUpTransform(0);\n\n\tif (flags & STUDIO_RENDER)\n\t{\n\t\tif (!IEngineStudio.StudioCheckBBox())\n\t\t\treturn 0;\n\n\t\t(*m_pModelsDrawn)++;\n\t\t(*m_pStudioModelCount)++;\n\n\t\tif (m_pStudioHeader->numbodyparts == 0)\n\t\t\treturn 1;\n\t}\n\n\tbool bShieldDetected = false;\n\tbool bIsViewModel = gEngfuncs.GetViewModel() == m_pCurrentEntity;\n\n\tif ( bIsViewModel && m_pStudioHeader )\n\t{\n\t\tif ( strstr( m_pStudioHeader->name, \"shield\" ) )\n\t\t{\n\t\t\tbShieldDetected = true;\n\t\t}\n\t}\n\n\tif( ( g_bHoldingKnife || bShieldDetected ) && !( gHUD.GetGameType() == GAME_CZERO ) && bIsViewModel )\n\t{\n\t\tbChangedRightHand = true;\n\n\t\tiRightHandValue = gHUD.cl_righthand->value;\n\n\t\tgHUD.cl_righthand->value = !gHUD.cl_righthand->value;\n\t}\n\n\tif (m_pCurrentEntity->curstate.movetype == MOVETYPE_FOLLOW)\n\t\tStudioMergeBones(m_pRenderModel);\n\telse\n\t\tStudioSetupBones();\n\n\tStudioSaveBones();\n\n\tif (flags & STUDIO_EVENTS)\n\t{\n\t\tStudioCalcAttachments();\n\t\tIEngineStudio.StudioClientEvents();\n\n\t\tif (m_pCurrentEntity->index > 0)\n\t\t{\n\t\t\tcl_entity_t *ent = gEngfuncs.GetEntityByIndex(m_pCurrentEntity->index);\n\t\t\tmemcpy(ent->attachment, m_pCurrentEntity->attachment, sizeof(vec3_t) * 4);\n\t\t}\n\t}\n\n\tif (flags & STUDIO_RENDER)\n\t{\n\t\talight_t lighting;\n\t\tvec3_t dir;\n\t\tlighting.plightvec = dir;\n\n\t\tIEngineStudio.StudioDynamicLight(m_pCurrentEntity, &lighting);\n\n\t\tIEngineStudio.StudioEntityLight(&lighting);\n\t\tIEngineStudio.StudioSetupLighting(&lighting);\n\n\t\tm_nTopColor = m_pCurrentEntity->curstate.colormap & 0xFF;\n\t\tm_nBottomColor = (m_pCurrentEntity->curstate.colormap & 0xFF00) >> 8;\n\n\t\tIEngineStudio.StudioSetRemapColors(m_nTopColor, m_nBottomColor);\n\n\t\tStudioRenderModel(dir);\n\t}\n\n\tif( bChangedRightHand )\n\t{\n\t\tgHUD.cl_righthand->value = iRightHandValue;\n\t}\n\n\treturn 1;\n}\n\nvoid CStudioModelRenderer::StudioEstimateGait(entity_state_t *pplayer)\n{\n\tfloat dt;\n\tvec3_t est_velocity;\n\n\tdt = (m_clTime - m_clOldTime);\n\n\tif (dt < 0)\n\t\tdt = 0;\n\telse if (dt > 1.0)\n\t\tdt = 1;\n\n\tif (dt == 0 || m_pPlayerInfo->renderframe == m_nFrameCount)\n\t{\n\t\tm_flGaitMovement = 0;\n\t\treturn;\n\t}\n\n\tif (m_fGaitEstimation)\n\t{\n\t\tVectorSubtract(m_pCurrentEntity->origin, m_pPlayerInfo->prevgaitorigin, est_velocity);\n\t\tVectorCopy(m_pCurrentEntity->origin, m_pPlayerInfo->prevgaitorigin);\n\t\tm_flGaitMovement = est_velocity.Length();\n\n\t\tif (dt <= 0 || m_flGaitMovement / dt < 5)\n\t\t{\n\t\t\tm_flGaitMovement = 0;\n\t\t\test_velocity[0] = 0;\n\t\t\test_velocity[1] = 0;\n\t\t}\n\t}\n\telse\n\t{\n\t\tVectorCopy(pplayer->velocity, est_velocity);\n\t\tm_flGaitMovement = est_velocity.Length() * dt;\n\t}\n\n\tif (est_velocity[1] == 0 && est_velocity[0] == 0)\n\t{\n\t\tfloat flYawDiff = m_pCurrentEntity->angles[YAW] - m_pPlayerInfo->gaityaw;\n\t\tflYawDiff = flYawDiff - (int)(flYawDiff / 360) * 360;\n\n\t\tif (flYawDiff > 180)\n\t\t\tflYawDiff -= 360;\n\t\tif (flYawDiff < -180)\n\t\t\tflYawDiff += 360;\n\n\t\tif (dt < 0.25)\n\t\t\tflYawDiff *= dt * 4;\n\t\telse\n\t\t\tflYawDiff *= dt;\n\n\t\tm_pPlayerInfo->gaityaw += flYawDiff;\n\t\tm_pPlayerInfo->gaityaw = m_pPlayerInfo->gaityaw - (int)(m_pPlayerInfo->gaityaw / 360) * 360;\n\t\tm_flGaitMovement = 0;\n\t}\n\telse\n\t{\n\t\tm_pPlayerInfo->gaityaw = (atan2(est_velocity[1], est_velocity[0]) * 180 / M_PI);\n\n\t\tif (m_pPlayerInfo->gaityaw > 180)\n\t\t\tm_pPlayerInfo->gaityaw = 180;\n\n\t\tif (m_pPlayerInfo->gaityaw < -180)\n\t\t\tm_pPlayerInfo->gaityaw = -180;\n\t}\n}\n\nvoid CStudioModelRenderer::StudioProcessGait(entity_state_t *pplayer)\n{\n\tmstudioseqdesc_t *pseqdesc;\n\tfloat dt;\n\tint iBlend;\n\tfloat flYaw;\n\n\tpseqdesc = (mstudioseqdesc_t *)((byte *)m_pStudioHeader + m_pStudioHeader->seqindex) + m_pCurrentEntity->curstate.sequence;\n\n\tStudioPlayerBlend(pseqdesc, &iBlend, &m_pCurrentEntity->angles[PITCH]);\n\n\tm_pCurrentEntity->latched.prevangles[PITCH] = m_pCurrentEntity->angles[PITCH];\n\tm_pCurrentEntity->curstate.blending[0] = iBlend;\n\tm_pCurrentEntity->latched.prevblending[0] = m_pCurrentEntity->curstate.blending[0];\n\tm_pCurrentEntity->latched.prevseqblending[0] = m_pCurrentEntity->curstate.blending[0];\n\n\tdt = (m_clTime - m_clOldTime);\n\n\tif (dt < 0)\n\t\tdt = 0;\n\telse if (dt > 1.0)\n\t\tdt = 1;\n\n\tStudioEstimateGait(pplayer);\n\n\tflYaw = m_pCurrentEntity->angles[YAW] - m_pPlayerInfo->gaityaw;\n\tflYaw = flYaw - (int)(flYaw / 360) * 360;\n\n\tif (flYaw < -180)\n\t\tflYaw = flYaw + 360;\n\n\tif (flYaw > 180)\n\t\tflYaw = flYaw - 360;\n\n\tif (flYaw > 120)\n\t{\n\t\tm_pPlayerInfo->gaityaw = m_pPlayerInfo->gaityaw - 180;\n\t\tm_flGaitMovement = -m_flGaitMovement;\n\t\tflYaw = flYaw - 180;\n\t}\n\telse if (flYaw < -120)\n\t{\n\t\tm_pPlayerInfo->gaityaw = m_pPlayerInfo->gaityaw + 180;\n\t\tm_flGaitMovement = -m_flGaitMovement;\n\t\tflYaw = flYaw + 180;\n\t}\n\n\tm_pCurrentEntity->curstate.controller[0] = ((flYaw / 4.0) + 30) / (60.0 / 255.0);\n\tm_pCurrentEntity->curstate.controller[1] = ((flYaw / 4.0) + 30) / (60.0 / 255.0);\n\tm_pCurrentEntity->curstate.controller[2] = ((flYaw / 4.0) + 30) / (60.0 / 255.0);\n\tm_pCurrentEntity->curstate.controller[3] = ((flYaw / 4.0) + 30) / (60.0 / 255.0);\n\tm_pCurrentEntity->latched.prevcontroller[0] = m_pCurrentEntity->curstate.controller[0];\n\tm_pCurrentEntity->latched.prevcontroller[1] = m_pCurrentEntity->curstate.controller[1];\n\tm_pCurrentEntity->latched.prevcontroller[2] = m_pCurrentEntity->curstate.controller[2];\n\tm_pCurrentEntity->latched.prevcontroller[3] = m_pCurrentEntity->curstate.controller[3];\n\n\tm_pCurrentEntity->angles[YAW] = m_pPlayerInfo->gaityaw;\n\n\tif (m_pCurrentEntity->angles[YAW] < -0)\n\t\tm_pCurrentEntity->angles[YAW] += 360;\n\n\tm_pCurrentEntity->latched.prevangles[YAW] = m_pCurrentEntity->angles[YAW];\n\n\tpseqdesc = (mstudioseqdesc_t *)((byte *)m_pStudioHeader + m_pStudioHeader->seqindex) + pplayer->gaitsequence;\n\n\tif (pseqdesc->linearmovement[0] > 0)\n\t\tm_pPlayerInfo->gaitframe += (m_flGaitMovement / pseqdesc->linearmovement[0]) * pseqdesc->numframes;\n\telse\n\t\tm_pPlayerInfo->gaitframe += pseqdesc->fps * dt;\n\n\tm_pPlayerInfo->gaitframe = m_pPlayerInfo->gaitframe - (int)(m_pPlayerInfo->gaitframe / pseqdesc->numframes) * pseqdesc->numframes;\n\n\tif (m_pPlayerInfo->gaitframe < 0)\n\t\tm_pPlayerInfo->gaitframe += pseqdesc->numframes;\n}\n\nint CStudioModelRenderer::StudioDrawPlayer(int flags, entity_state_t *pplayer)\n{\n\tm_pCurrentEntity = IEngineStudio.GetCurrentEntity();\n\n\tIEngineStudio.GetTimes(&m_nFrameCount, &m_clTime, &m_clOldTime);\n\tIEngineStudio.GetViewInfo(m_vRenderOrigin, m_vUp, m_vRight, m_vNormal);\n\tIEngineStudio.GetAliasScale(&m_fSoftwareXScale, &m_fSoftwareYScale);\n\n\tm_nPlayerIndex = pplayer->number - 1;\n\n\tif (m_nPlayerIndex < 0 || m_nPlayerIndex >= gEngfuncs.GetMaxClients())\n\t\treturn 0;\n\n\tm_pRenderModel = IEngineStudio.SetupPlayerModel(m_nPlayerIndex);\n\n\tif (m_pRenderModel == NULL)\n\t\treturn 0;\n\n\tm_pStudioHeader = (studiohdr_t *)IEngineStudio.Mod_Extradata(m_pRenderModel);\n\n\tIEngineStudio.StudioSetHeader(m_pStudioHeader);\n\tIEngineStudio.SetRenderModel(m_pRenderModel);\n\n\tif (pplayer->gaitsequence)\n\t{\n\t\tvec3_t orig_angles;\n\t\tm_pPlayerInfo = IEngineStudio.PlayerInfo(m_nPlayerIndex);\n\n\t\tVectorCopy(m_pCurrentEntity->angles, orig_angles);\n\n\t\tStudioProcessGait(pplayer);\n\n\t\tm_pPlayerInfo->gaitsequence = pplayer->gaitsequence;\n\t\tm_pPlayerInfo = NULL;\n\n\t\tStudioSetUpTransform(0);\n\t\tVectorCopy(orig_angles, m_pCurrentEntity->angles);\n\t}\n\telse\n\t{\n\t\tm_pCurrentEntity->curstate.controller[0] = 127;\n\t\tm_pCurrentEntity->curstate.controller[1] = 127;\n\t\tm_pCurrentEntity->curstate.controller[2] = 127;\n\t\tm_pCurrentEntity->curstate.controller[3] = 127;\n\t\tm_pCurrentEntity->latched.prevcontroller[0] = m_pCurrentEntity->curstate.controller[0];\n\t\tm_pCurrentEntity->latched.prevcontroller[1] = m_pCurrentEntity->curstate.controller[1];\n\t\tm_pCurrentEntity->latched.prevcontroller[2] = m_pCurrentEntity->curstate.controller[2];\n\t\tm_pCurrentEntity->latched.prevcontroller[3] = m_pCurrentEntity->curstate.controller[3];\n\n\t\tm_pPlayerInfo = IEngineStudio.PlayerInfo(m_nPlayerIndex);\n\t\tm_pPlayerInfo->gaitsequence = 0;\n\n\t\tStudioSetUpTransform(0);\n\t}\n\n\tif (flags & STUDIO_RENDER)\n\t{\n\t\tif (!IEngineStudio.StudioCheckBBox())\n\t\t\treturn 0;\n\n\t\t(*m_pModelsDrawn)++;\n\t\t(*m_pStudioModelCount)++;\n\n\t\tif (m_pStudioHeader->numbodyparts == 0)\n\t\t\treturn 1;\n\t}\n\n\tm_pPlayerInfo = IEngineStudio.PlayerInfo(m_nPlayerIndex);\n\n\tStudioSetupBones();\n\tStudioSaveBones();\n\n\tm_pPlayerInfo->renderframe = m_nFrameCount;\n\tm_pPlayerInfo = NULL;\n\n\tif (flags & STUDIO_EVENTS)\n\t{\n\t\tStudioCalcAttachments();\n\t\tIEngineStudio.StudioClientEvents();\n\n\t\tif (m_pCurrentEntity->index > 0)\n\t\t{\n\t\t\tcl_entity_t *ent = gEngfuncs.GetEntityByIndex(m_pCurrentEntity->index);\n\t\t\tmemcpy(ent->attachment, m_pCurrentEntity->attachment, sizeof(vec3_t) * 4);\n\t\t}\n\t}\n\n\tif (flags & STUDIO_RENDER)\n\t{\n\t\tif (m_pCvarHiModels->value && m_pRenderModel != m_pCurrentEntity->model)\n\t\t\tm_pCurrentEntity->curstate.body = 255;\n\n\t\tif (!(m_pCvarDeveloper->value == 0 && gEngfuncs.GetMaxClients() == 1) && (m_pRenderModel == m_pCurrentEntity->model))\n\t\t\tm_pCurrentEntity->curstate.body = 1;\n\n\t\talight_t lighting;\n\t\tvec3_t dir;\n\t\tlighting.plightvec = dir;\n\n\t\tIEngineStudio.StudioDynamicLight(m_pCurrentEntity, &lighting);\n\t\tIEngineStudio.StudioEntityLight(&lighting);\n\t\tIEngineStudio.StudioSetupLighting(&lighting);\n\n\t\tm_pPlayerInfo = IEngineStudio.PlayerInfo(m_nPlayerIndex);\n\n\t\tm_nTopColor = m_pPlayerInfo->topcolor;\n\n\t\tif (m_nTopColor < 0)\n\t\t\tm_nTopColor = 0;\n\n\t\tif (m_nTopColor > 360)\n\t\t\tm_nTopColor = 360;\n\n\t\tm_nBottomColor = m_pPlayerInfo->bottomcolor;\n\n\t\tif (m_nBottomColor < 0)\n\t\t\tm_nBottomColor = 0;\n\n\t\tif (m_nBottomColor > 360)\n\t\t\tm_nBottomColor = 360;\n\n\t\tIEngineStudio.StudioSetRemapColors(m_nTopColor, m_nBottomColor);\n\n\t\tStudioRenderModel(dir);\n\t\tm_pPlayerInfo = NULL;\n\n\t\tif (pplayer->weaponmodel)\n\t\t{\n\t\t\tcl_entity_t saveent = *m_pCurrentEntity;\n\t\t\tmodel_t *pweaponmodel = IEngineStudio.GetModelByIndex(pplayer->weaponmodel);\n\n\t\t\tm_pStudioHeader = (studiohdr_t *)IEngineStudio.Mod_Extradata(pweaponmodel);\n\t\t\tIEngineStudio.StudioSetHeader(m_pStudioHeader);\n\n\t\t\tStudioMergeBones(pweaponmodel);\n\n\t\t\tIEngineStudio.StudioSetupLighting(&lighting);\n\n\t\t\tStudioRenderModel(dir);\n\n\t\t\tStudioCalcAttachments();\n\n\t\t\t*m_pCurrentEntity = saveent;\n\t\t}\n\t}\n\n\treturn 1;\n}\n\nvoid CStudioModelRenderer::StudioCalcAttachments(void)\n{\n\tint i;\n\tmstudioattachment_t *pattachment;\n\n\tif (m_pStudioHeader->numattachments > 4)\n\t\tgEngfuncs.Con_DPrintf(\"Too many attachments on %s\\n\", m_pCurrentEntity->model->name);\n\n\tpattachment = (mstudioattachment_t *)((byte *)m_pStudioHeader + m_pStudioHeader->attachmentindex);\n\n\tfor (i = 0; i < m_pStudioHeader->numattachments; i++)\n\t\tVectorTransform(pattachment[i].org, (*m_plighttransform)[pattachment[i].bone], m_pCurrentEntity->attachment[i]);\n}\n\nvoid CStudioModelRenderer::StudioRenderModel(float *lightdir)\n{\n\tIEngineStudio.SetChromeOrigin();\n\n\tint iSaveRenderMode =  m_pCurrentEntity->curstate.rendermode;\n\tint iSaveRenderFx = m_pCurrentEntity->curstate.renderfx;\n\tint iSaveRenderAmt = m_pCurrentEntity->curstate.renderamt;\n\n\n\tIEngineStudio.SetForceFaceFlags(0);\n\tStudioRenderFinal();\n\n\tif (iSaveRenderFx == kRenderFxGlowShell)\n\t{\n\t\tm_pCurrentEntity->curstate.renderfx = kRenderFxGlowShell;\n\n\t\tgEngfuncs.pTriAPI->SpriteTexture(m_pChromeSprite, 0);\n\n\t\tIEngineStudio.SetForceFaceFlags(STUDIO_NF_CHROME);\n\t\tStudioRenderFinal();\n\t}\n\n\n\tm_pCurrentEntity->curstate.rendermode = iSaveRenderMode;\n\tm_pCurrentEntity->curstate.renderfx = iSaveRenderFx;\n\tm_pCurrentEntity->curstate.renderamt = iSaveRenderAmt;\n}\n\nvoid CStudioModelRenderer::StudioRenderFinal_Software(void)\n{\n\tint i;\n\n\tIEngineStudio.SetupRenderer(0);\n\n\t/*if (m_pCvarDrawEntities->value == 2)\n\t{\n\t\tIEngineStudio.StudioDrawBones();\n\t}\n\telse if (m_pCvarDrawEntities->value == 3)\n\t{\n\t\tIEngineStudio.StudioDrawHulls();\n\t}\n\telse*/\n\t{\n\t\tfor (i = 0; i < m_pStudioHeader->numbodyparts; i++)\n\t\t{\n\t\t\tIEngineStudio.StudioSetupModel(i, (void **)&m_pBodyPart, (void **)&m_pSubModel);\n\t\t\tIEngineStudio.StudioDrawPoints();\n\t\t}\n\t}\n\n\t/*if (m_pCvarDrawEntities->value == 4)\n\t{\n\t\tgEngfuncs.pTriAPI->RenderMode(kRenderTransAdd);\n\t\tIEngineStudio.StudioDrawHulls();\n\t\tgEngfuncs.pTriAPI->RenderMode(kRenderNormal);\n\t}\n\n\tif (m_pCvarDrawEntities->value == 5)\n\t\tIEngineStudio.StudioDrawAbsBBox();*/\n\n\tIEngineStudio.RestoreRenderer();\n}\n\nint twice;\n\nvoid CStudioModelRenderer::StudioRenderFinal_Hardware(void)\n{\n\tint i;\n\tint rendermode;\n\n\trendermode = IEngineStudio.GetForceFaceFlags() ? kRenderTransAdd : m_pCurrentEntity->curstate.rendermode;\n\tIEngineStudio.SetupRenderer(rendermode);\n\n\t/*if (m_pCvarDrawEntities->value == 2)\n\t{\n\t\tIEngineStudio.StudioDrawBones();\n\t}\n\telse if (m_pCvarDrawEntities->value == 3)\n\t{\n\t\tIEngineStudio.StudioDrawHulls();\n\t}\n\telse*/\n\t{\n\t\tfor (i = 0; i < m_pStudioHeader->numbodyparts; i++)\n\t\t{\n\t\t\tIEngineStudio.StudioSetupModel(i, (void **)&m_pBodyPart, (void **)&m_pSubModel);\n\n\t\t\tif (m_fDoInterp)\n\t\t\t\tm_pCurrentEntity->trivial_accept = 0;\n\n\t\t\tIEngineStudio.GL_SetRenderMode(rendermode);\n\t\t\tIEngineStudio.StudioSetRenderamt(m_pCurrentEntity->curstate.renderamt);\n\t\t\tIEngineStudio.StudioDrawPoints();\n\t\t}\n\t}\n\n\t/*if (m_pCvarDrawEntities->value == 4)\n\t{\n\t\tgEngfuncs.pTriAPI->RenderMode(kRenderTransAdd);\n\t\tIEngineStudio.StudioDrawHulls();\n\t\tgEngfuncs.pTriAPI->RenderMode(kRenderNormal);\n\t}*/\n\n\t//if (m_pCvarDrawEntities->value == 5)\n\t//\tIEngineStudio.StudioDrawAbsBBox();\n\n\tIEngineStudio.RestoreRenderer();\n}\n\nvoid CStudioModelRenderer::StudioRenderFinal(void)\n{\n\tif (IEngineStudio.IsHardware())\n\t\tStudioRenderFinal_Hardware();\n\telse\n\t\tStudioRenderFinal_Software();\n}\n\nvoid CStudioModelRenderer::StudioSetShadowSprite(int idx)\n{\n\tm_iShadowSprite = idx;\n}\n\nvoid CStudioModelRenderer::StudioDrawShadow( Vector origin, float scale )\n{\n\tVector endPoint = origin;\n\tVector p1, p2, p3, p4;\n\tpmtrace_t pmtrace;\n\n\tendPoint.z -= 150.0f;\n\n\tgEngfuncs.pEventAPI->EV_SetUpPlayerPrediction( false, true );\n\tgEngfuncs.pEventAPI->EV_PushPMStates( );\n\t\tgEngfuncs.pEventAPI->EV_SetSolidPlayers( -1 );\n\t\tgEngfuncs.pEventAPI->EV_SetTraceHull( 2 );\n\t\tgEngfuncs.pEventAPI->EV_PlayerTrace( origin, endPoint, PM_STUDIO_IGNORE | PM_GLASS_IGNORE, -1, &pmtrace );\n\tgEngfuncs.pEventAPI->EV_PopPMStates( );\n\n\t// don't allow shadow if player in solid area\n\tif( pmtrace.startsolid )\n\t\treturn;\n\n\t// don't allow shadow if doesn't hit anything\n\tif( pmtrace.fraction >= 1.0f )\n\t\treturn;\n\n\tpmtrace.plane.normal = pmtrace.plane.normal.Normalize( );\n\n\t// don't allow shadow on too lean planes\n\tif( pmtrace.plane.normal.z <= 0.7 )\n\t\treturn;\n\n\tpmtrace.plane.normal = pmtrace.plane.normal * scale * ( 1.0 - pmtrace.fraction );\n\n\n\t// add 2.0f to Z, for avoid Z-fighting\n\tp1.x = pmtrace.endpos.x - pmtrace.plane.normal.z;\n\tp1.y = pmtrace.endpos.y + pmtrace.plane.normal.z;\n\tp1.z = pmtrace.endpos.z + 2.0f + pmtrace.plane.normal.x - pmtrace.plane.normal.y;\n\n\tp2.x = pmtrace.endpos.x + pmtrace.plane.normal.z;\n\tp2.y = pmtrace.endpos.y + pmtrace.plane.normal.z;\n\tp2.z = pmtrace.endpos.z + 2.0f - pmtrace.plane.normal.x - pmtrace.plane.normal.y;\n\n\tp3.x = pmtrace.endpos.x + pmtrace.plane.normal.z;\n\tp3.y = pmtrace.endpos.y - pmtrace.plane.normal.z;\n\tp3.z = pmtrace.endpos.z + 2.0f - pmtrace.plane.normal.x + pmtrace.plane.normal.y;\n\n\tp4.x = pmtrace.endpos.x - pmtrace.plane.normal.z;\n\tp4.y = pmtrace.endpos.y - pmtrace.plane.normal.z;\n\tp4.z = pmtrace.endpos.z + 2.0f + pmtrace.plane.normal.x + pmtrace.plane.normal.y;\n\n\tIEngineStudio.StudioRenderShadow( m_iShadowSprite, p1, p2, p3, p4 );\n}\n"
  },
  {
    "path": "cl_dll/VGUI/CSProgressBar.cpp",
    "content": ""
  },
  {
    "path": "cl_dll/VGUI/CSProgressBar.h",
    "content": ""
  },
  {
    "path": "cl_dll/VGUI/CareerBox.cpp",
    "content": ""
  },
  {
    "path": "cl_dll/VGUI/CareerBox.h",
    "content": ""
  },
  {
    "path": "cl_dll/VGUI/WeaponSetLabel.h",
    "content": ""
  },
  {
    "path": "cl_dll/VGUI/backgroundpanel.cpp",
    "content": ""
  },
  {
    "path": "cl_dll/VGUI/basecareermenu.cpp",
    "content": ""
  },
  {
    "path": "cl_dll/VGUI/buymenu.cpp",
    "content": ""
  },
  {
    "path": "cl_dll/VGUI/buymouseoverpanelbutton.h",
    "content": ""
  },
  {
    "path": "cl_dll/VGUI/buypreset_editmenu.cpp",
    "content": ""
  },
  {
    "path": "cl_dll/VGUI/buypreset_listbox.cpp",
    "content": ""
  },
  {
    "path": "cl_dll/VGUI/buypreset_listbox.h",
    "content": ""
  },
  {
    "path": "cl_dll/VGUI/buypreset_mainmenu.cpp",
    "content": ""
  },
  {
    "path": "cl_dll/VGUI/buypresetimageinfo.cpp",
    "content": ""
  },
  {
    "path": "cl_dll/VGUI/buypresetpanel.cpp",
    "content": ""
  },
  {
    "path": "cl_dll/VGUI/buysubmenu.cpp",
    "content": ""
  },
  {
    "path": "cl_dll/VGUI/buysubmenu.h",
    "content": ""
  },
  {
    "path": "cl_dll/VGUI/careermatchendmenu.cpp",
    "content": ""
  },
  {
    "path": "cl_dll/VGUI/careerroundendmenu.cpp",
    "content": ""
  },
  {
    "path": "cl_dll/VGUI/counterstrikeviewport.cpp",
    "content": ""
  },
  {
    "path": "cl_dll/VGUI/counterstrikeviewport_interface.cpp",
    "content": ""
  },
  {
    "path": "cl_dll/VGUI/creditsmenu.cpp",
    "content": ""
  },
  {
    "path": "cl_dll/VGUI/cstrikeclassmenu.cpp",
    "content": ""
  },
  {
    "path": "cl_dll/VGUI/cstrikeclassmenu.h",
    "content": ""
  },
  {
    "path": "cl_dll/VGUI/cstrikeclientscoreboard.cpp",
    "content": ""
  },
  {
    "path": "cl_dll/VGUI/cstrikespectatorgui.cpp",
    "content": ""
  },
  {
    "path": "cl_dll/VGUI/cstriketeammenu.cpp",
    "content": ""
  },
  {
    "path": "cl_dll/ammo.cpp",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\t\n*\tThis product contains software technology licensed from Id \n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc. \n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n//\n// Ammo.cpp\n//\n// implementation of CHudAmmo class\n//\n\n#include \"hud.h\"\n#include \"cvardef.h\"\n#include \"cl_util.h\"\n#include \"parsemsg.h\"\n#include \"pm_shared.h\"\n\n#include <string.h>\n#include <stdio.h>\n\n#include \"ammohistory.h\"\n#include \"eventscripts.h\"\n#include \"com_weapons.h\"\n#include \"draw_util.h\"\n#include \"triangleapi.h\"\n#include \"weapontype.h\"\n\n#ifndef M_PI\n#define M_PI\t\t3.14159265358979323846\t// matches value in gcc v2 math.h\n#endif\n\nWEAPON *gpActiveSel;\t// NULL means off, 1 means just the menu bar, otherwise\n\t\t\t\t\t\t// this points to the active weapon menu item\nWEAPON *gpLastSel;\t\t// Last weapon menu selection \n\nclient_sprite_t *GetSpriteList(client_sprite_t *pList, const char *psz, int iRes, int iCount);\n\nWeaponsResource gWR;\n\nint g_weaponselect = 0;\nint g_weaponselect_frames = 0;\nint g_iShotsFired;\n\nvoid WeaponsResource :: LoadAllWeaponSprites( void )\n{\n\tfor( int i = 0; i < MAX_WEAPONS; i++ )\n\t{\n\t\tif ( rgWeapons[i].iId )\n\t\t\tLoadWeaponSprites( &rgWeapons[i] );\n\t}\n}\n\nint WeaponsResource :: CountAmmo( int iId ) \n{ \n\tif ( iId < 0 )\n\t\treturn 0;\n\n\treturn riAmmo[iId];\n}\n\nint WeaponsResource :: HasAmmo( WEAPON *p )\n{\n\tif ( !p )\n\t\treturn FALSE;\n\n\t// weapons with no max ammo can always be selected\n\tif ( p->iMax1 == -1 )\n\t\treturn TRUE;\n\n\treturn (p->iAmmoType == -1) || p->iClip > 0 || CountAmmo(p->iAmmoType) \n\t\t|| CountAmmo(p->iAmmo2Type) || ( p->iFlags & WEAPON_FLAGS_SELECTONEMPTY );\n}\n\n\nvoid WeaponsResource :: LoadWeaponSprites( WEAPON *pWeapon )\n{\n\tint i, iRes = gHUD.GetSpriteRes();\n\n\tchar sz[256];\n\n\tif ( !pWeapon )\n\t\treturn;\n\n\tmemset( &pWeapon->rcActive, 0, sizeof(wrect_t) );\n\tmemset( &pWeapon->rcInactive, 0, sizeof(wrect_t) );\n\tmemset( &pWeapon->rcAmmo, 0, sizeof(wrect_t) );\n\tmemset( &pWeapon->rcAmmo2, 0, sizeof(wrect_t) );\n\tpWeapon->hInactive = 0;\n\tpWeapon->hActive = 0;\n\tpWeapon->hAmmo = 0;\n\tpWeapon->hAmmo2 = 0;\n\n\tsnprintf(sz, sizeof(sz), \"sprites/%s.txt\", pWeapon->szName);\n\tclient_sprite_t *pList = SPR_GetList(sz, &i);\n\n\tif (!pList)\n\t\treturn;\n\n\tclient_sprite_t *p;\n\t\n\tp = GetSpriteList( pList, \"crosshair\", iRes, i );\n\tif (p)\n\t{\n\t\tsnprintf(sz, sizeof(sz), \"sprites/%s.spr\", p->szSprite);\n\t\tpWeapon->hCrosshair = SPR_Load(sz);\n\t\tpWeapon->rcCrosshair = p->rc;\n\t}\n\telse\n\t\tpWeapon->hCrosshair = 0;\n\n\tp = GetSpriteList(pList, \"autoaim\", iRes, i);\n\tif (p)\n\t{\n\t\tsnprintf(sz, sizeof(sz), \"sprites/%s.spr\", p->szSprite);\n\t\tpWeapon->hAutoaim = SPR_Load(sz);\n\t\tpWeapon->rcAutoaim = p->rc;\n\t}\n\telse\n\t\tpWeapon->hAutoaim = 0;\n\n\tp = GetSpriteList( pList, \"zoom\", iRes, i );\n\tif (p)\n\t{\n\t\tsnprintf(sz, sizeof(sz), \"sprites/%s.spr\", p->szSprite);\n\t\tpWeapon->hZoomedCrosshair = SPR_Load(sz);\n\t\tpWeapon->rcZoomedCrosshair = p->rc;\n\t}\n\telse\n\t{\n\t\tpWeapon->hZoomedCrosshair = pWeapon->hCrosshair; //default to non-zoomed crosshair\n\t\tpWeapon->rcZoomedCrosshair = pWeapon->rcCrosshair;\n\t}\n\n\tp = GetSpriteList(pList, \"zoom_autoaim\", iRes, i);\n\tif (p)\n\t{\n\t\tsnprintf(sz, sizeof(sz), \"sprites/%s.spr\", p->szSprite);\n\t\tpWeapon->hZoomedAutoaim = SPR_Load(sz);\n\t\tpWeapon->rcZoomedAutoaim = p->rc;\n\t}\n\telse\n\t{\n\t\tpWeapon->hZoomedAutoaim = pWeapon->hZoomedCrosshair;  //default to zoomed crosshair\n\t\tpWeapon->rcZoomedAutoaim = pWeapon->rcZoomedCrosshair;\n\t}\n\n\tp = GetSpriteList(pList, \"weapon\", iRes, i);\n\tif (p)\n\t{\n\t\tsnprintf(sz, sizeof(sz), \"sprites/%s.spr\", p->szSprite);\n\t\tpWeapon->hInactive = SPR_Load(sz);\n\t\tpWeapon->rcInactive = p->rc;\n\n\t\tgHR.iHistoryGap = max( gHR.iHistoryGap, pWeapon->rcActive.Height() );\n\t}\n\telse\n\t\tpWeapon->hInactive = 0;\n\n\tp = GetSpriteList(pList, \"weapon_s\", iRes, i);\n\tif (p)\n\t{\n\t\tsnprintf(sz, sizeof(sz), \"sprites/%s.spr\", p->szSprite);\n\t\tpWeapon->hActive = SPR_Load(sz);\n\t\tpWeapon->rcActive = p->rc;\n\t}\n\telse\n\t\tpWeapon->hActive = 0;\n\n\tp = GetSpriteList(pList, \"ammo\", iRes, i);\n\tif (p)\n\t{\n\t\tsnprintf(sz, sizeof(sz), \"sprites/%s.spr\", p->szSprite);\n\t\tpWeapon->hAmmo = SPR_Load(sz);\n\t\tpWeapon->rcAmmo = p->rc;\n\n\t\tgHR.iHistoryGap = max( gHR.iHistoryGap, pWeapon->rcActive.Height() );\n\t}\n\telse\n\t\tpWeapon->hAmmo = 0;\n\n\tp = GetSpriteList(pList, \"ammo2\", iRes, i);\n\tif (p)\n\t{\n\t\tsnprintf(sz, sizeof(sz), \"sprites/%s.spr\", p->szSprite);\n\t\tpWeapon->hAmmo2 = SPR_Load(sz);\n\t\tpWeapon->rcAmmo2 = p->rc;\n\n\t\tgHR.iHistoryGap = max( gHR.iHistoryGap, pWeapon->rcActive.Height() );\n\t}\n\telse\n\t\tpWeapon->hAmmo2 = 0;\n\n}\n\n// Returns the first weapon for a given slot.\nWEAPON *WeaponsResource :: GetFirstPos( int iSlot )\n{\n\tWEAPON *pret = NULL;\n\n\tfor (int i = 0; i < MAX_WEAPON_POSITIONS; i++)\n\t{\n\t\tif ( rgSlots[iSlot][i] /*&& HasAmmo( rgSlots[iSlot][i] )*/ )\n\t\t{\n\t\t\tpret = rgSlots[iSlot][i];\n\t\t\tbreak;\n\t\t}\n\t}\n\n\treturn pret;\n}\n\n\nWEAPON* WeaponsResource :: GetNextActivePos( int iSlot, int iSlotPos )\n{\n\tif ( iSlotPos >= MAX_WEAPON_POSITIONS || iSlot >= MAX_WEAPON_SLOTS )\n\t\treturn NULL;\n\n\tWEAPON *p = gWR.rgSlots[ iSlot ][ iSlotPos+1 ];\n\t\n\tif ( !p || !gWR.HasAmmo(p) )\n\t\treturn GetNextActivePos( iSlot, iSlotPos + 1 );\n\n\treturn p;\n}\n\n\nint giBucketHeight, giBucketWidth, giABHeight, giABWidth; // Ammo Bar width and height\n\nHSPRITE ghsprBuckets;\t\t\t\t\t// Sprite for top row of weapons menu\n\n// width of ammo fonts\n#define AMMO_SMALL_WIDTH 10\n#define AMMO_LARGE_WIDTH 20\n\n#define HISTORY_DRAW_TIME\t\"5\"\n\nint CHudAmmo::Init(void)\n{\n\tgHUD.AddHudElem(this);\n\n\tHOOK_MESSAGE(gHUD.m_Ammo, CurWeapon);\n\tHOOK_MESSAGE(gHUD.m_Ammo, WeaponList);\n\tHOOK_MESSAGE(gHUD.m_Ammo, AmmoPickup);\n\tHOOK_MESSAGE(gHUD.m_Ammo, WeapPickup);\n\tHOOK_MESSAGE(gHUD.m_Ammo, ItemPickup);\n\tHOOK_MESSAGE(gHUD.m_Ammo, HideWeapon);\n\tHOOK_MESSAGE(gHUD.m_Ammo, AmmoX);\n\tHOOK_MESSAGE(gHUD.m_Ammo, Crosshair);\n\tHOOK_MESSAGE(gHUD.m_Ammo, Brass);\n\n\tHOOK_COMMAND(gHUD.m_Ammo, \"slot1\", Slot1);\n\tHOOK_COMMAND(gHUD.m_Ammo, \"slot2\", Slot2);\n\tHOOK_COMMAND(gHUD.m_Ammo, \"slot3\", Slot3);\n\tHOOK_COMMAND(gHUD.m_Ammo, \"slot4\", Slot4);\n\tHOOK_COMMAND(gHUD.m_Ammo, \"slot5\", Slot5);\n\tHOOK_COMMAND(gHUD.m_Ammo, \"slot6\", Slot6);\n\tHOOK_COMMAND(gHUD.m_Ammo, \"slot7\", Slot7);\n\tHOOK_COMMAND(gHUD.m_Ammo, \"slot8\", Slot8);\n\tHOOK_COMMAND(gHUD.m_Ammo, \"slot9\", Slot9);\n\tHOOK_COMMAND(gHUD.m_Ammo, \"slot10\", Slot10);\n\tHOOK_COMMAND(gHUD.m_Ammo, \"cancelselect\", Close);\n\tHOOK_COMMAND(gHUD.m_Ammo, \"invnext\", NextWeapon);\n\tHOOK_COMMAND(gHUD.m_Ammo, \"invprev\", PrevWeapon);\n\tHOOK_COMMAND(gHUD.m_Ammo, \"adjust_crosshair\", Adjust_Crosshair);\n\tHOOK_COMMAND(gHUD.m_Ammo, \"rebuy\", Rebuy);\n\tHOOK_COMMAND(gHUD.m_Ammo, \"autobuy\", Autobuy);\n\n\tReset();\n\n\tm_pHud_DrawHistory_Time = CVAR_CREATE( \"hud_drawhistory_time\", HISTORY_DRAW_TIME, 0 );\n\tm_pHud_FastSwitch = CVAR_CREATE( \"hud_fastswitch\", \"0\", FCVAR_ARCHIVE );\t\t// controls whether or not weapons can be selected in one keypress\n\t// CVAR_CREATE( \"cl_observercrosshair\", \"1\", 0 );\n\tm_pClCrosshairColor = (convar_t*)CVAR_CREATE( \"cl_crosshair_color\", \"50 250 50\", FCVAR_ARCHIVE );\n\tm_pClCrosshairTranslucent = (convar_t*)CVAR_CREATE( \"cl_crosshair_translucent\", \"1\", FCVAR_ARCHIVE );\n\tm_pClCrosshairSize = (convar_t*)CVAR_CREATE( \"cl_crosshair_size\", \"auto\", FCVAR_ARCHIVE );\n\tm_pClDynamicCrosshair = CVAR_CREATE(\"cl_dynamiccrosshair\", \"1\", FCVAR_ARCHIVE);\n\n\tm_hStaticSpr = 0;\n\n\tm_iFlags = HUD_DRAW | HUD_THINK; //!!!\n\tm_R = 50;\n\tm_G = 250;\n\tm_B = 50;\n\tm_iAlpha = 200;\n\n\tm_cvarB = m_cvarR = m_cvarG = -1;\n\tm_iCurrentCrosshair = 0;\n\tm_bAdditive = true;\n\tm_iCrosshairScaleBase = -1;\n\tm_bDrawCrosshair = true;\n\n\tgWR.Init();\n\tgHR.Init();\n\n\txhair_enable = CVAR_CREATE( \"xhair_enable\", \"0\", FCVAR_ARCHIVE );\n\txhair_gap = CVAR_CREATE( \"xhair_gap\", \"0\", FCVAR_ARCHIVE );\n\txhair_size = CVAR_CREATE( \"xhair_size\", \"4\", FCVAR_ARCHIVE );\n\txhair_thick = CVAR_CREATE( \"xhair_thick\", \"0\", FCVAR_ARCHIVE );\n\txhair_pad = CVAR_CREATE( \"xhair_pad\", \"0\", FCVAR_ARCHIVE );\n\txhair_dot = CVAR_CREATE( \"xhair_dot\", \"0\", FCVAR_ARCHIVE );\n\txhair_t = CVAR_CREATE( \"xhair_t\", \"0\", FCVAR_ARCHIVE );\n\txhair_dynamic_scale = CVAR_CREATE( \"xhair_dynamic_scale\", \"0\", FCVAR_ARCHIVE );\n\txhair_gap_useweaponvalue = CVAR_CREATE( \"xhair_gap_useweaponvalue\", \"0\", FCVAR_ARCHIVE );\n\txhair_dynamic_move = CVAR_CREATE( \"xhair_dynamic_move\", \"1\", FCVAR_ARCHIVE );\n\n\txhair_color = CVAR_CREATE( \"xhair_color\", \"0 255 0 255\", FCVAR_ARCHIVE );\n\txhair_additive = CVAR_CREATE( \"xhair_additive\", \"0\", FCVAR_ARCHIVE );\n\n\treturn 1;\n}\n\nvoid CHudAmmo::Reset(void)\n{\n\tm_fFade = 0;\n\n\tgpActiveSel = NULL;\n\tgHUD.m_iHideHUDDisplay = 0;\n\n\tgWR.Reset();\n\tgHR.Reset();\n\n\t//\tVidInit();\n\n}\n\nint CHudAmmo::VidInit(void)\n{\n\t// Load sprites for buckets (top row of weapon menu)\n\tm_HUD_bucket0 = gHUD.GetSpriteIndex( \"bucket1\" );\n\tm_HUD_selection = gHUD.GetSpriteIndex( \"selection\" );\n\n\tghsprBuckets = gHUD.GetSprite(m_HUD_bucket0);\n\tgiBucketWidth = gHUD.GetSpriteRect(m_HUD_bucket0).Width();\n\tgiBucketHeight = gHUD.GetSpriteRect(m_HUD_bucket0).Height();\n\n\tgHR.iHistoryGap = max( gHR.iHistoryGap, giBucketHeight);\n\n\t// If we've already loaded weapons, let's get new sprites\n\tgWR.LoadAllWeaponSprites();\n\n\tgiABWidth = 20;\n\tgiABHeight = 4;\n\n\treturn 1;\n}\n\n//\n// Think:\n//  Used for selection of weapon menu item.\n//\nvoid CHudAmmo::Think(void)\n{\n\tif ( gHUD.m_fPlayerDead )\n\t\treturn;\n\n\tif ( gHUD.m_iWeaponBits != gWR.iOldWeaponBits )\n\t{\n\t\tgWR.iOldWeaponBits = gHUD.m_iWeaponBits;\n\n\t\tfor (int i = 0; i < MAX_WEAPONS-1; i++ )\n\t\t{\n\t\t\tWEAPON *p = gWR.GetWeapon(i);\n\n\t\t\tif ( p )\n\t\t\t{\n\t\t\t\tif ( gHUD.m_iWeaponBits & ( 1 << p->iId ) )\n\t\t\t\t{\n\t\t\t\t\tgWR.PickupWeapon( p );\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tif( gHUD.GetGameType() != GAME_CZERODS )\n\t\t\t\t\t\tgWR.DropWeapon( p );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tif (!gpActiveSel)\n\t\treturn;\n\n\t// has the player selected one?\n\tif (gHUD.m_iKeyBits & IN_ATTACK)\n\t{\n\t\tif (gpActiveSel != (WEAPON *)1)\n\t\t{\n\t\t\tServerCmd(gpActiveSel->szName);\n\t\t\tg_weaponselect = gpActiveSel->iId;\n\t\t\tg_weaponselect_frames = 3;\n\t\t}\n\n\t\tgpLastSel = gpActiveSel;\n\t\tgpActiveSel = NULL;\n\t\tgHUD.m_iKeyBits &= ~IN_ATTACK;\n\n\t\tPlaySound(\"common/wpn_select.wav\", 1);\n\t}\n\n}\n\n//\n// Helper function to return a Ammo pointer from id\n//\n\nHSPRITE* WeaponsResource :: GetAmmoPicFromWeapon( int iAmmoId, wrect_t& rect )\n{\n\tfor ( int i = 0; i < MAX_WEAPONS; i++ )\n\t{\n\t\tif ( rgWeapons[i].iAmmoType == iAmmoId )\n\t\t{\n\t\t\trect = rgWeapons[i].rcAmmo;\n\t\t\treturn &rgWeapons[i].hAmmo;\n\t\t}\n\t\telse if ( rgWeapons[i].iAmmo2Type == iAmmoId )\n\t\t{\n\t\t\trect = rgWeapons[i].rcAmmo2;\n\t\t\treturn &rgWeapons[i].hAmmo2;\n\t\t}\n\t}\n\n\treturn NULL;\n}\n\n\n// Menu Selection Code\n\nvoid WeaponsResource :: SelectSlot( int iSlot, int fAdvance, int iDirection )\n{\n\tif ( gHUD.m_Menu.m_fMenuDisplayed && (fAdvance == FALSE) && (iDirection == 1) )\t\n\t{ // menu is overriding slot use commands\n\t\tgHUD.m_Menu.SelectMenuItem( iSlot + 1 );  // slots are one off the key numbers\n\t\treturn;\n\t}\n\n\tif ( iSlot > MAX_WEAPON_SLOTS )\n\t\treturn;\n\n\tif ( gHUD.m_fPlayerDead || gHUD.m_iHideHUDDisplay & ( HIDEHUD_WEAPONS | HIDEHUD_ALL ) )\n\t\treturn;\n\n\tif (!(gHUD.m_iWeaponBits & (1<<(WEAPON_SUIT)) ))\n\t\treturn;\n\n\tif ( ! ( gHUD.m_iWeaponBits & ~(1<<(WEAPON_SUIT)) ))\n\t\treturn;\n\n\tWEAPON *p = NULL;\n\tbool fastSwitch = gHUD.m_Ammo.m_pHud_FastSwitch->value != 0.0f;\n\n\tif ( (gpActiveSel == NULL) || (gpActiveSel == (WEAPON *)1) || (iSlot != gpActiveSel->iSlot) )\n\t{\n\t\tPlaySound( \"common/wpn_hudon.wav\", 1 );\n\t\tp = GetFirstPos( iSlot );\n\n\t\tif ( p && fastSwitch ) // check for fast weapon switch mode\n\t\t{\n\t\t\t// if fast weapon switch is on, then weapons can be selected in a single keypress\n\t\t\t// but only if there is only one item in the bucket\n\t\t\tWEAPON *p2 = GetNextActivePos( p->iSlot, p->iSlotPos );\n\t\t\tif ( !p2 )\n\t\t\t{\t// only one active item in bucket, so change directly to weapon\n\t\t\t\tServerCmd( p->szName );\n\t\t\t\tg_weaponselect = p->iId;\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t}\n\telse\n\t{\n\t\tPlaySound(\"common/wpn_moveselect.wav\", 1);\n\t\tif ( gpActiveSel )\n\t\t\tp = GetNextActivePos( gpActiveSel->iSlot, gpActiveSel->iSlotPos );\n\t\tif ( !p )\n\t\t\tp = GetFirstPos( iSlot );\n\t}\n\n\t\n\tif ( !p )  // no selection found\n\t{\n\t\t// just display the weapon list, unless fastswitch is on just ignore it\n\t\tif ( !fastSwitch )\n\t\t\tgpActiveSel = (WEAPON *)1;\n\t\telse\n\t\t\tgpActiveSel = NULL;\n\t}\n\telse \n\t\tgpActiveSel = p;\n}\n\n//------------------------------------------------------------------------\n// Message Handlers\n//------------------------------------------------------------------------\n\n//\n// AmmoX  -- Update the count of a known type of ammo\n// \nint CHudAmmo::MsgFunc_AmmoX(const char *pszName, int iSize, void *pbuf)\n{\n\tBufferReader reader( pszName, pbuf, iSize );\n\n\tint iIndex = reader.ReadByte();\n\tint iCount = reader.ReadByte();\n\n\tgWR.SetAmmo( iIndex, abs(iCount) );\n\n\treturn 1;\n}\n\nint CHudAmmo::MsgFunc_AmmoPickup( const char *pszName, int iSize, void *pbuf )\n{\n\tBufferReader reader( pszName, pbuf, iSize );\n\tint iIndex = reader.ReadByte();\n\tint iCount = reader.ReadByte();\n\n\t// Add ammo to the history\n\tgHR.AddToHistory( HISTSLOT_AMMO, iIndex, abs(iCount) );\n\n\treturn 1;\n}\n\nint CHudAmmo::MsgFunc_WeapPickup( const char *pszName, int iSize, void *pbuf )\n{\n\tBufferReader reader( pszName, pbuf, iSize );\n\tint iIndex = reader.ReadByte();\n\n\t// Add the weapon to the history\n\tgHR.AddToHistory( HISTSLOT_WEAP, iIndex );\n\n\tif( gHUD.GetGameType() == GAME_CZERODS )\n\t{\n\t\tgWR.PickupWeapon( iIndex );\n\t}\n\n\treturn 1;\n}\n\nint CHudAmmo::MsgFunc_ItemPickup( const char *pszName, int iSize, void *pbuf )\n{\n\tBufferReader reader( pszName, pbuf, iSize );\n\tconst char *szName = reader.ReadString();\n\n\t// Add the weapon to the history\n\tgHR.AddToHistory( HISTSLOT_ITEM, szName );\n\n\treturn 1;\n}\n\n\nint CHudAmmo::MsgFunc_HideWeapon( const char *pszName, int iSize, void *pbuf )\n{\n\tBufferReader reader( pszName, pbuf, iSize );\n\t\n\tgHUD.m_iHideHUDDisplay = reader.ReadByte();\n\n\tif (gEngfuncs.IsSpectateOnly())\n\t\treturn 1;\n\n\tif ( gHUD.m_iHideHUDDisplay & ( HIDEHUD_WEAPONS | HIDEHUD_FLASHLIGHT | HIDEHUD_ALL ) )\n\t{\n\t\tgpActiveSel = NULL;\n\t\tHideCrosshair();\n\t}\n\n\treturn 1;\n}\n\n// \n//  CurWeapon: Update hud state with the current weapon and clip count. Ammo\n//  counts are updated with AmmoX. Server assures that the Weapon ammo type \n//  numbers match a real ammo type.\n//\nint CHudAmmo::MsgFunc_CurWeapon(const char *pszName, int iSize, void *pbuf )\n{\n\tBufferReader reader( pszName, pbuf, iSize );\n\n\tint iState = reader.ReadByte();\n\tint iId = reader.ReadChar();\n\tint iClip = reader.ReadChar();\n\n\tif ( iId < 1 )\n\t{\n\t\tHideCrosshair();\n\t\treturn 0;\n\t}\n\n\tif ( g_iUser1 != OBS_IN_EYE )\n\t{\n\t\t// Is player dead???\n\t\tif ((iId == -1) && (iClip == -1))\n\t\t{\n\t\t\tgHUD.m_fPlayerDead = TRUE;\n\t\t\tgpActiveSel = NULL;\n\t\t\treturn 1;\n\t\t}\n\t\tgHUD.m_fPlayerDead = FALSE;\n\t}\n\n\tWEAPON *pWeapon = gWR.GetWeapon( iId );\n\n\tif ( !pWeapon )\n\t\treturn 0;\n\n\tif ( iClip < -1 )\n\t\tpWeapon->iClip = abs(iClip);\n\telse\n\t\tpWeapon->iClip = iClip;\n\n\n\tif ( iState == 0 )\t// we're not the current weapon, so update no more\n\t\treturn 1;\n\n\tm_pWeapon = pWeapon;\n\n\tm_fFade = 200.0f; //!!!\n\n\treturn 1;\n}\n\n//\n// WeaponList -- Tells the hud about a new weapon type.\n//\nint CHudAmmo::MsgFunc_WeaponList(const char *pszName, int iSize, void *pbuf )\n{\n\tBufferReader reader( pszName, pbuf, iSize );\n\t\n\tWEAPON Weapon;\n\n\tstrncpy( Weapon.szName, reader.ReadString(), MAX_WEAPON_NAME );\n\tWeapon.szName[MAX_WEAPON_NAME-1] = 0;\n\tWeapon.iAmmoType = (int)reader.ReadChar();\n\t\n\tWeapon.iMax1 = reader.ReadByte();\n\tif (Weapon.iMax1 == 255)\n\t\tWeapon.iMax1 = -1;\n\n\tWeapon.iAmmo2Type = reader.ReadChar();\n\tWeapon.iMax2 = reader.ReadByte();\n\tif (Weapon.iMax2 == 255)\n\t\tWeapon.iMax2 = -1;\n\n\tWeapon.iSlot = reader.ReadChar();\n\tWeapon.iSlotPos = reader.ReadChar();\n\tWeapon.iId = reader.ReadChar();\n\tWeapon.iFlags = reader.ReadByte();\n\tWeapon.iClip = 0;\n\n\tgWR.AddWeapon( &Weapon );\n\n\treturn 1;\n\n}\n\nint CHudAmmo::MsgFunc_Crosshair(const char *pszName, int iSize, void *pbuf)\n{\n\tBufferReader reader( pszName, pbuf, iSize );\n\n\tif( reader.ReadByte() > 0)\n\t{\n\t\tm_bDrawCrosshair = true;\n\t}\n\telse\n\t{\n\t\tm_bDrawCrosshair = false;\n\t}\n   return 0;\n}\n\nint CHudAmmo::MsgFunc_Brass( const char *pszName, int iSize, void *pbuf )\n{\n\tBufferReader reader( pszName, pbuf, iSize );\n\treader.ReadByte(); // unused!\n\n\tVector origin, velocity;\n\torigin.x = reader.ReadCoord();\n\torigin.y = reader.ReadCoord();\n\torigin.z = reader.ReadCoord();\n\treader.ReadCoord(); // unused!\n\treader.ReadCoord(); // unused!\n\treader.ReadCoord(); // unused!\n\tvelocity.x = reader.ReadCoord();\n\tvelocity.y = reader.ReadCoord();\n\tvelocity.z = reader.ReadCoord();\n\n\tfloat Rotation = M_PI * reader.ReadAngle() / 180.0f;\n\tint ModelIndex = reader.ReadShort();\n\tint BounceSoundType = reader.ReadByte();\n\tint Life = reader.ReadByte();\n\tint Client = reader.ReadByte();\n\n\tfloat sin, cos, x, y;\n\tsin = fabs(Rotation);\n\tcos = fabs(Rotation);\n\n\tif( gHUD.cl_righthand->value != 0.0f && EV_IsLocal( Client ) )\n\t{\n\t\tvelocity.x += sin * -120.0;\n\t\tvelocity.y += cos * 120.0;\n\t\tx = 9.0 * sin;\n\t\ty = -9.0 * cos;\n\t}\n\telse\n\t{\n\t\tx = -9.0 * sin;\n\t\ty = 9.0 * cos;\n\t}\n\n\torigin.x += x;\n\torigin.y += y;\n\tEV_EjectBrass( origin, velocity, Rotation, ModelIndex, BounceSoundType, Life );\n\treturn 1;\n}\n\n//------------------------------------------------------------------------\n// Command Handlers\n//------------------------------------------------------------------------\n// Slot button pressed\nvoid CHudAmmo::SlotInput( int iSlot )\n{\n\tgWR.SelectSlot(iSlot, FALSE, 1);\n}\n\nvoid CHudAmmo::UserCmd_Slot1(void)\n{\n\tSlotInput( 0 );\n}\n\nvoid CHudAmmo::UserCmd_Slot2(void)\n{\n\tSlotInput( 1 );\n}\n\nvoid CHudAmmo::UserCmd_Slot3(void)\n{\n\tSlotInput( 2 );\n}\n\nvoid CHudAmmo::UserCmd_Slot4(void)\n{\n\tSlotInput( 3 );\n}\n\nvoid CHudAmmo::UserCmd_Slot5(void)\n{\n\tSlotInput( 4 );\n}\n\nvoid CHudAmmo::UserCmd_Slot6(void)\n{\n\tSlotInput( 5 );\n}\n\nvoid CHudAmmo::UserCmd_Slot7(void)\n{\n\tSlotInput( 6 );\n}\n\nvoid CHudAmmo::UserCmd_Slot8(void)\n{\n\tSlotInput( 7 );\n}\n\nvoid CHudAmmo::UserCmd_Slot9(void)\n{\n\tSlotInput( 8 );\n}\n\nvoid CHudAmmo::UserCmd_Slot10(void)\n{\n\tSlotInput( 9 );\n}\n\nvoid CHudAmmo::UserCmd_Adjust_Crosshair()\n{\n\tint newCrosshair;\n\tint oldCrosshair = m_iCurrentCrosshair;\n\n\tif ( gEngfuncs.Cmd_Argc() <= 1 )\n\t{\n\t\tnewCrosshair = (oldCrosshair + 1) % 5;\n\t}\n\telse\n\t{\n\t\tconst char *arg = gEngfuncs.Cmd_Argv(1);\n\t\tnewCrosshair = atoi(arg) % 10;\n\t}\n\n\tm_iCurrentCrosshair = newCrosshair;\n\tif ( newCrosshair <= 9 )\n\t{\n\t\tswitch ( newCrosshair )\n\t\t{\n\t\tcase 0:\n\t\tcase 5:\n\t\t\tm_R = 50;\n\t\t\tm_G = 250;\n\t\t\tm_B = 50;\n\t\t\tbreak;\n\t\tcase 1:\n\t\tcase 6:\n\t\t\tm_R = 250;\n\t\t\tm_G = 50;\n\t\t\tm_B = 50;\n\t\t\tbreak;\n\t\tcase 2:\n\t\tcase 7:\n\t\t\tm_R = 50;\n\t\t\tm_G = 50;\n\t\t\tm_B = 250;\n\t\t\tbreak;\n\t\tcase 3:\n\t\tcase 8:\n\t\t\tm_R = 250;\n\t\t\tm_G = 250;\n\t\t\tm_B = 50;\n\t\t\tbreak;\n\t\tcase 4:\n\t\tcase 9:\n\t\t\tm_R = 50;\n\t\t\tm_G = 250;\n\t\t\tm_B = 250;\n\t\t\tbreak;\n\t\t}\n\t\tm_bAdditive = newCrosshair < 5 ? true: false;\n\t}\n\telse\n\t{\n\t\tm_R = 50;\n\t\tm_G = 250;\n\t\tm_B = 50;\n\t\tm_bAdditive = 1;\n\t}\n\n\tchar s[16];\n\tsprintf(s, \"%d %d %d\", m_R, m_G, m_B);\n\tgEngfuncs.Cvar_Set(\"cl_crosshair_color\", s);\n\tgEngfuncs.Cvar_Set(\"cl_crosshair_translucent\", (char*)(m_bAdditive ? \"1\" : \"0\"));\n}\n\n\nvoid CHudAmmo::UserCmd_Close(void)\n{\n\tif (gpActiveSel)\n\t{\n\t\tgpLastSel = gpActiveSel;\n\t\tgpActiveSel = NULL;\n\t\tPlaySound(\"common/wpn_hudoff.wav\", 1);\n\t}\n\telse\n\t\tClientCmd(\"escape\");\n}\n\n\n// Selects the next item in the weapon menu\nvoid CHudAmmo::UserCmd_NextWeapon(void)\n{\n\tif ( gHUD.m_fPlayerDead || (gHUD.m_iHideHUDDisplay & (HIDEHUD_WEAPONS | HIDEHUD_ALL)) )\n\t\treturn;\n\n\tif ( !gpActiveSel || gpActiveSel == (WEAPON*)1 )\n\t\tgpActiveSel = m_pWeapon;\n\n\tint pos = 0;\n\tint slot = 0;\n\tif ( gpActiveSel )\n\t{\n\t\tpos = gpActiveSel->iSlotPos + 1;\n\t\tslot = gpActiveSel->iSlot;\n\t}\n\n\tfor ( int loop = 0; loop <= 1; loop++ )\n\t{\n\t\tfor ( ; slot < MAX_WEAPON_SLOTS; slot++ )\n\t\t{\n\t\t\tfor ( ; pos < MAX_WEAPON_POSITIONS; pos++ )\n\t\t\t{\n\t\t\t\tWEAPON *wsp = gWR.GetWeaponSlot( slot, pos );\n\n\t\t\t\tif ( wsp /*&& gWR.HasAmmo(wsp)*/ )\n\t\t\t\t{\n\t\t\t\t\tgpActiveSel = wsp;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tpos = 0;\n\t\t}\n\n\t\tslot = 0;  // start looking from the first slot again\n\t}\n\n\tgpActiveSel = NULL;\n}\n\n// Selects the previous item in the menu\nvoid CHudAmmo::UserCmd_PrevWeapon(void)\n{\n\tif ( gHUD.m_fPlayerDead || (gHUD.m_iHideHUDDisplay & (HIDEHUD_WEAPONS | HIDEHUD_ALL)) )\n\t\treturn;\n\n\tif ( !gpActiveSel || gpActiveSel == (WEAPON*)1 )\n\t\tgpActiveSel = m_pWeapon;\n\n\tint pos = MAX_WEAPON_POSITIONS-1;\n\tint slot = MAX_WEAPON_SLOTS-1;\n\tif ( gpActiveSel )\n\t{\n\t\tpos = gpActiveSel->iSlotPos - 1;\n\t\tslot = gpActiveSel->iSlot;\n\t}\n\t\n\tfor ( int loop = 0; loop <= 1; loop++ )\n\t{\n\t\tfor ( ; slot >= 0; slot-- )\n\t\t{\n\t\t\tfor ( ; pos >= 0; pos-- )\n\t\t\t{\n\t\t\t\tWEAPON *wsp = gWR.GetWeaponSlot( slot, pos );\n\n\t\t\t\tif ( wsp /*&& gWR.HasAmmo(wsp)*/ )\n\t\t\t\t{\n\t\t\t\t\tgpActiveSel = wsp;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tpos = MAX_WEAPON_POSITIONS-1;\n\t\t}\n\t\t\n\t\tslot = MAX_WEAPON_SLOTS-1;\n\t}\n\n\tgpActiveSel = NULL;\n}\n\nvoid CHudAmmo::UserCmd_Autobuy()\n{\n\tchar *afile = (char*)gEngfuncs.COM_LoadFile(\"autobuy.txt\", 5, NULL);\n\tchar *pfile = afile;\n\tchar token[1024];\n\tchar szCmd[1024];\n\tint remaining = 1023;\n\n\tif( !pfile )\n\t{\n\t\tConsolePrint( \"Can't open autobuy.txt file.\\n\" );\n\t\treturn;\n\t}\n\n\tstrcpy(szCmd, \"cl_setautobuy\");\n\tremaining -= sizeof( \"cl_setautobuy\" );\n\n\twhile((pfile = gEngfuncs.COM_ParseFile( pfile, token )))\n\t{\n\t\t// append space first\n\t\tstrncat(szCmd, \" \", remaining);\n\t\tstrncat(szCmd, token, remaining - 1);\n\n\t\tremaining -= strlen( token ) - 1;\n\t}\n\n\tgEngfuncs.pfnServerCmd( szCmd );\n\tgEngfuncs.COM_FreeFile( afile );\n}\n\nvoid CHudAmmo::UserCmd_Rebuy()\n{\n\tchar *afile = (char*)gEngfuncs.COM_LoadFile(\"rebuy.txt\", 5, NULL);\n\tchar *pfile = afile;\n\tchar token[1024];\n\tchar szCmd[1024];\n\tint lastCh;\n\tint remaining = 1023;\n\n\tif( !pfile )\n\t{\n\t\tConsolePrint( \"Can't open rebuy.txt file.\\n\" );\n\t\treturn;\n\t}\n\n\t// start with \\\"\n\tstrcpy(szCmd, \"cl_setrebuy \\\"\" );\n\tremaining -= sizeof( \"cl_setrebuy \\\"\" );\n\n\twhile((pfile = gEngfuncs.COM_ParseFile( pfile, token )))\n\t{\n\t\tstrncat(szCmd, token, remaining );\n\t\tremaining -= strlen( token );\n\n\t\t// append space after token\n\t\tstrncat(szCmd, \" \", remaining );\n\t\tremaining--;\n\t}\n\t// replace last space with \", before terminator\n\tlastCh = strlen(szCmd);\n\tszCmd[lastCh] = '\\\"';\n\n\tgEngfuncs.pfnServerCmd( szCmd );\n\tgEngfuncs.COM_FreeFile( afile );\n}\n\n\n//-------------------------------------------------------------------------\n// Drawing code\n//-------------------------------------------------------------------------\n\nint CHudAmmo::Draw(float flTime)\n{\n\tint a, x, y, r, g, b;\n\tint AmmoWidth;\n\n\tif (!(gHUD.m_iWeaponBits & (1<<(WEAPON_SUIT)) ))\n\t\treturn 1;\n\n\t// place it here, so pretty dynamic crosshair will work even in spectator!\n\tif( gHUD.m_iFOV > 40 )\n\t{\n\t\tHideCrosshair(); // hide static\n\n\t\t// draw a dynamic crosshair\n\t\tDrawCrosshair();\n\t}\n\telse\n\t{\n\t\tif( m_pWeapon )\n\t\t{\n\t\t\tSetCrosshair(m_pWeapon->hZoomedCrosshair, m_pWeapon->rcZoomedCrosshair, 255, 255, 255);\n\n\t\t\tDrawSpriteCrosshair();\n\t\t}\n\t}\n\n\tif ( (gHUD.m_iHideHUDDisplay & ( HIDEHUD_WEAPONS | HIDEHUD_ALL )) )\n\t\treturn 1;\n\n\t// Draw Weapon Menu\n\tDrawWList(flTime);\n\n\t// Draw ammo pickup history\n\tgHR.DrawAmmoHistory( flTime );\n\n\tif (!m_pWeapon)\n\t\treturn 0;\n\n\tWEAPON *pw = m_pWeapon; // shorthand\n\n\t// SPR_Draw Ammo\n\tif ((pw->iAmmoType < 0) && (pw->iAmmo2Type < 0))\n\t\treturn 0;\n\n\tint iFlags = DHN_DRAWZERO; // draw 0 values\n\n\tAmmoWidth = gHUD.GetSpriteRect(gHUD.m_HUD_number_0).Width();\n\n\ta = (int) max( MIN_ALPHA, m_fFade );\n\n\tif (m_fFade > 0)\n\t\tm_fFade -= (gHUD.m_flTimeDelta * 20);\n\n\tDrawUtils::UnpackRGB( r, g, b, gHUD.m_iDefaultHUDColor );\n\n\tDrawUtils::ScaleColors(r, g, b, a );\n\n\t// Does this weapon have a clip?\n\ty = ScreenHeight - gHUD.m_iFontHeight - gHUD.m_iFontHeight/2;\n\n\t// Does weapon have any ammo at all?\n\tif (m_pWeapon->iAmmoType > 0)\n\t{\n\t\tint iIconWidth = m_pWeapon->rcAmmo.Width();\n\t\t\n\t\tif (pw->iClip >= 0)\n\t\t{\n\t\t\t// room for the number and the '|' and the current ammo\n\t\t\t\n\t\t\tx = ScreenWidth - (8 * AmmoWidth) - iIconWidth;\n\t\t\tx = DrawUtils::DrawHudNumber(x, y, iFlags | DHN_3DIGITS, pw->iClip, r, g, b);\n\n\t\t\tint iBarWidth =  AmmoWidth/10;\n\n\t\t\tx += AmmoWidth/2;\n\n\t\t\tDrawUtils::UnpackRGB( r, g, b, gHUD.m_iDefaultHUDColor );\n\n\t\t\t// draw the | bar\n\t\t\tFillRGBA(x, y, iBarWidth, gHUD.m_iFontHeight, r, g, b, a);\n\n\t\t\tx += iBarWidth + AmmoWidth/2;;\n\n\t\t\t// GL Seems to need this\n\t\t\tDrawUtils::ScaleColors(r, g, b, a );\n\t\t\tx = DrawUtils::DrawHudNumber(x, y, iFlags | DHN_3DIGITS, gWR.CountAmmo(pw->iAmmoType), r, g, b);\n\n\n\t\t}\n\t\telse\n\t\t{\n\t\t\t// SPR_Draw a bullets only line\n\t\t\tx = ScreenWidth - 4 * AmmoWidth - iIconWidth;\n\t\t\tx = DrawUtils::DrawHudNumber(x, y, iFlags | DHN_3DIGITS, gWR.CountAmmo(pw->iAmmoType), r, g, b);\n\t\t}\n\n\t\t// Draw the ammo Icon\n\t\tint iOffset = (m_pWeapon->rcAmmo.Height())/8;\n\t\tSPR_Set(m_pWeapon->hAmmo, r, g, b);\n\t\tSPR_DrawAdditive(0, x, y - iOffset, &m_pWeapon->rcAmmo);\n\t}\n\n\t// Does weapon have seconday ammo?\n\tif (pw->iAmmo2Type > 0) \n\t{\n\t\tint iIconWidth = m_pWeapon->rcAmmo2.Width();\n\n\t\t// Do we have secondary ammo?\n\t\tif ((pw->iAmmo2Type != 0) && (gWR.CountAmmo(pw->iAmmo2Type) > 0))\n\t\t{\n\t\t\ty -= gHUD.m_iFontHeight + gHUD.m_iFontHeight/4;\n\t\t\tx = ScreenWidth - 4 * AmmoWidth - iIconWidth;\n\t\t\tx = DrawUtils::DrawHudNumber(x, y, iFlags|DHN_3DIGITS, gWR.CountAmmo(pw->iAmmo2Type), r, g, b);\n\n\t\t\t// Draw the ammo Icon\n\t\t\tSPR_Set(m_pWeapon->hAmmo2, r, g, b);\n\t\t\tint iOffset = (m_pWeapon->rcAmmo2.Height())/8;\n\t\t\tSPR_DrawAdditive(0, x, y - iOffset, &m_pWeapon->rcAmmo2);\n\t\t}\n\t}\n\n\treturn 1;\n}\n\nvoid CHudAmmo::DrawSpriteCrosshair()\n{\n\tint x, y;\n\n\tif( !m_hStaticSpr )\n\t\treturn;\n\n\tgEngfuncs.pfnSPR_Set( m_hStaticSpr, m_staticRgba.r, m_staticRgba.g, m_staticRgba.b );\n\n\tx = ( ScreenWidth - m_rcStaticRc.Width() ) / 2;\n\ty = ( ScreenHeight - m_rcStaticRc.Height() ) / 2;\n\n\t// gEngfuncs.pfnSPR_Draw( 0, x, y, &m_rcStaticRc );\n\tgEngfuncs.pfnSPR_DrawHoles( 0, x, y, &m_rcStaticRc );\n}\n\n#define WEST_XPOS (ScreenWidth / 2 - flCrosshairDistance - iLength + 1)\n#define EAST_XPOS (flCrosshairDistance + ScreenWidth / 2)\n#define EAST_WEST_YPOS (ScreenHeight / 2)\n\n#define NORTH_YPOS (ScreenHeight / 2 - flCrosshairDistance - iLength + 1)\n#define SOUTH_YPOS (ScreenHeight / 2 + flCrosshairDistance)\n#define NORTH_SOUTH_XPOS (ScreenWidth / 2)\n\n#define WEST_XPOS_R (TrueWidth / 2 - flCrosshairDistance - iLength + 1)\n#define EAST_XPOS_R (flCrosshairDistance + TrueWidth / 2)\n#define EAST_WEST_YPOS_R (TrueHeight / 2)\n\n#define NORTH_YPOS_R (TrueHeight / 2 - flCrosshairDistance - iLength + 1)\n#define SOUTH_YPOS_R (TrueHeight / 2 + flCrosshairDistance)\n#define NORTH_SOUTH_XPOS_R (TrueWidth / 2)\n\nint Distances[30][2] =\n{\n{ 8, 3 }, // 0\n{ 4, 3 }, // 1\n{ 5, 3 }, // 2\n{ 8, 3 }, // 3\n{ 9, 4 }, // 4\n{ 6, 3 }, // 5\n{ 9, 3 }, // 6\n{ 3, 3 }, // 7\n{ 8, 3 }, // 8\n{ 4, 3 }, // 9\n{ 8, 3 }, // 10\n{ 6, 3 }, // 11\n{ 5, 3 }, // 12\n{ 4, 3 }, // 13\n{ 4, 3 }, // 14\n{ 8, 3 }, // 15\n{ 8, 3 }, // 16\n{ 8, 3 }, // 17\n{ 6, 3 }, // 18\n{ 6, 3 }, // 19\n{ 8, 6 }, // 20\n{ 4, 3 }, // 21\n{ 7, 3 }, // 22\n{ 6, 4 }, // 23\n{ 8, 3 }, // 24\n{ 8, 3 }, // 25\n{ 5, 3 }, // 26\n{ 4, 4 }, // 27\n{ 7, 3 }, // 28\n{ 7, 3 }, // 29\n};\n\nenum\n{\n\tACCURACY_NONE = 0,\n\tACCURACY_JUMP = ( 1 << 0 ),\n\tACCURACY_RUN = ( 1 << 1 ),\n\t// ACCURACY_DUCK = (1 << 2),\n\tACCURACY_INACCURATE = ( 1 << 3 ),\n\tACCURACY_VERY_INACCURATE = ( 1 << 4 )\n};\n\nint CHudAmmo::GetWeaponAccuracyFlags( int weaponId )\n{\n\tint xhairWeaponFlags = g_iWeaponFlags;\n\n\tswitch ( weaponId )\n\t{\n\tcase WEAPON_P228:\n\tcase WEAPON_FIVESEVEN:\n\tcase WEAPON_DEAGLE:\n\t\treturn ( ACCURACY_DUCK | ACCURACY_RUN | ACCURACY_JUMP );\n\n\tcase WEAPON_MAC10:\n\tcase WEAPON_UMP45:\n\tcase WEAPON_MP5N:\n\tcase WEAPON_TMP:\n\t\treturn ACCURACY_JUMP;\n\n\tcase WEAPON_AUG:\n\tcase WEAPON_GALIL:\n\tcase WEAPON_M249:\n\tcase WEAPON_SG552:\n\tcase WEAPON_AK47:\n\tcase WEAPON_P90:\n\t\treturn ( ACCURACY_RUN | ACCURACY_JUMP );\n\n\tcase WEAPON_FAMAS:\n\t\treturn ( xhairWeaponFlags & 16 ) ? ( ACCURACY_VERY_INACCURATE | ACCURACY_RUN | ACCURACY_JUMP ) : ( ACCURACY_RUN | ACCURACY_JUMP );\n\n\tcase WEAPON_USP:\n\t\treturn ( xhairWeaponFlags & 1 ) ? ( ACCURACY_INACCURATE | ACCURACY_DUCK | ACCURACY_RUN | ACCURACY_JUMP ) : ( ACCURACY_DUCK | ACCURACY_RUN | ACCURACY_JUMP );\n\n\tcase WEAPON_GLOCK18:\n\t\treturn ( xhairWeaponFlags & 2 ) ? ( ACCURACY_VERY_INACCURATE | ACCURACY_DUCK | ACCURACY_RUN | ACCURACY_JUMP ) : ( ACCURACY_DUCK | ACCURACY_RUN | ACCURACY_JUMP );\n\n\tcase WEAPON_M4A1:\n\t\treturn ( xhairWeaponFlags & 4 ) ? ( ACCURACY_INACCURATE | ACCURACY_RUN | ACCURACY_JUMP ) : ( ACCURACY_RUN | ACCURACY_JUMP );\n\t}\n\n\treturn ACCURACY_NONE;\n}\n\n#define MAX_XHAIR_GAP 15\n\nint CHudAmmo::ScaleForRes( float value, int height )\n{\n\t/* \"default\" resolution is 640x480 */\n\treturn rint( value * ( (float)height / 480.0f ) );\n}\n\nfloat CHudAmmo::GetCrosshairGap( int weaponId )\n{\n\tstatic float xhairGap;\n\tstatic int lastShotsFired;\n\tstatic float xhairPrevTime;\n\tfloat minGap, deltaGap;\n\n\tint xhairPlayerFlags = g_iPlayerFlags;\n\tfloat xhairPlayerSpeed = g_flPlayerSpeed;\n\tfloat clientTime = gEngfuncs.GetClientTime();\n\tint xhairShotsFired = g_iShotsFired;\n\n\tswitch ( weaponId )\n\t{\n\tcase WEAPON_P228:\n\tcase WEAPON_HEGRENADE:\n\tcase WEAPON_SMOKEGRENADE:\n\tcase WEAPON_FIVESEVEN:\n\tcase WEAPON_USP:\n\tcase WEAPON_GLOCK18:\n\tcase WEAPON_AWP:\n\tcase WEAPON_FLASHBANG:\n\tcase WEAPON_DEAGLE:\n\t\tminGap = 8;\n\t\tdeltaGap = 3;\n\t\tbreak;\n\n\tcase WEAPON_SCOUT:\n\tcase WEAPON_SG550:\n\tcase WEAPON_SG552:\n\t\tminGap = 5;\n\t\tdeltaGap = 3;\n\t\tbreak;\n\n\tcase WEAPON_XM1014:\n\t\tminGap = 9;\n\t\tdeltaGap = 4;\n\t\tbreak;\n\n\tcase WEAPON_C4:\n\tcase WEAPON_UMP45:\n\tcase WEAPON_M249:\n\t\tminGap = 6;\n\t\tdeltaGap = 3;\n\t\tbreak;\n\n\tcase WEAPON_MAC10:\n\t\tminGap = 9;\n\t\tdeltaGap = 3;\n\t\tbreak;\n\n\tcase WEAPON_AUG:\n\t\tminGap = 3;\n\t\tdeltaGap = 3;\n\t\tbreak;\n\n\tcase WEAPON_MP5N:\n\t\tminGap = 6;\n\t\tdeltaGap = 2;\n\t\tbreak;\n\n\tcase WEAPON_M3:\n\t\tminGap = 8;\n\t\tdeltaGap = 6;\n\t\tbreak;\n\n\tcase WEAPON_TMP:\n\tcase WEAPON_KNIFE:\n\tcase WEAPON_P90:\n\t\tminGap = 7;\n\t\tdeltaGap = 3;\n\t\tbreak;\n\n\tcase WEAPON_G3SG1:\n\t\tminGap = 6;\n\t\tdeltaGap = 4;\n\t\tbreak;\n\n\tcase WEAPON_AK47:\n\t\tminGap = 4;\n\t\tdeltaGap = 4;\n\t\tbreak;\n\n\tdefault:\n\t\tminGap = 4;\n\t\tdeltaGap = 3;\n\t\tbreak;\n\t}\n\n\tif ( !xhair_gap_useweaponvalue->value )\n\t\tminGap = 4;\n\n\tfloat baseMinGap = minGap;\n\tfloat absMinGap = baseMinGap * 0.5f;\n\n\tint flags = GetWeaponAccuracyFlags( weaponId );\n\tif ( xhair_dynamic_move->value && flags )\n\t{\n\t\tif ( !( xhairPlayerFlags & FL_ONGROUND ) && ( flags & ACCURACY_AIR ) )\n\t\t{\n\t\t\tminGap *= 2.0f;\n\t\t}\n\t\telse if ( ( xhairPlayerFlags & FL_DUCKING ) && ( flags & ACCURACY_DUCK ) )\n\t\t{\n\t\t\tminGap *= 0.5f;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tfloat runLimit;\n\n\t\t\tswitch ( weaponId )\n\t\t\t{\n\t\t\tcase WEAPON_AUG:\n\t\t\tcase WEAPON_GALIL:\n\t\t\tcase WEAPON_FAMAS:\n\t\t\tcase WEAPON_M249:\n\t\t\tcase WEAPON_M4A1:\n\t\t\tcase WEAPON_SG552:\n\t\t\tcase WEAPON_AK47:\n\t\t\t\trunLimit = 140;\n\t\t\t\tbreak;\n\n\t\t\tcase WEAPON_P90:\n\t\t\t\trunLimit = 170;\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\trunLimit = 0;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tif ( xhairPlayerSpeed > runLimit && ( flags & ACCURACY_RUN ) )\n\t\t\t\tminGap *= 1.5f;\n\t\t}\n\n\t\tif ( flags & ACCURACY_INACCURATE )\n\t\t\tminGap *= 1.4f;\n\n\t\tif ( flags & ACCURACY_VERY_INACCURATE )\n\t\t\tminGap *= 1.4f;\n\n\t\tminGap = baseMinGap + ( minGap - baseMinGap ) * xhair_dynamic_scale->value;\n\t\tminGap = max( minGap, absMinGap );\n\t}\n\n\tif ( xhairPrevTime > clientTime )\n\t{\n\t\t// client restart\n\t\txhairPrevTime = clientTime;\n\t}\n\n\tfloat deltaTime = clientTime - xhairPrevTime;\n\txhairPrevTime = clientTime;\n\n\tif ( xhairShotsFired <= lastShotsFired )\n\t{\n\t\t// decay the crosshair as if we were always running at 100 fps\n\t\txhairGap -= ( 100 * deltaTime ) * ( 0.013f * xhairGap + 0.1f );\n\t}\n\telse\n\t{\n\t\txhairGap += deltaGap * xhair_dynamic_scale->value;\n\t\txhairGap = min( xhairGap, MAX_XHAIR_GAP );\n\t}\n\n\tif ( xhairShotsFired > 600 )\n\t\txhairShotsFired = 1;\n\n\tlastShotsFired = xhairShotsFired;\n\n\txhairGap = max( xhairGap, minGap );\n\n\treturn xhairGap + xhair_gap->value;\n}\n\nvoid CHudAmmo::DrawCrosshairSection( int _x0, int _y0, int _x1, int _y1 )\n{\n\tfloat x0 = (float)_x0;\n\tfloat y0 = (float)_y0;\n\tfloat x1 = (float)_x1;\n\tfloat y1 = (float)_y1;\n\tint color[4] = { 0, 255, 0, 255 };\n\n\t// float top_left[2] = { x0, y0 };\n\t// float top_right[2] = { x1, y0 };\n\t// float bottom_right[2] = { x1, y1 };\n\t// float bottom_left[2] = { x0, y1 };\n\n\tif ( sscanf( xhair_color->string, \"%d %d %d %d\", &color[0], &color[1], &color[2], &color[3] ) == 4 )\n\t{\n\t\tcolor[0] = bound( 0, color[0], 255 );\n\t\tcolor[1] = bound( 0, color[1], 255 );\n\t\tcolor[2] = bound( 0, color[2], 255 );\n\t\tcolor[3] = bound( 0, color[3], 255 );\n\t}\n\tgEngfuncs.pTriAPI->Color4f( color[0] / 255.0f, color[1] / 255.0f, color[2] / 255.0f, color[3] / 255.0f );\n\t// gEngfuncs.pTriAPI->Brightness( 1.0f );\n\n\tDrawUtils::Draw2DQuad( x0, y0, x1, y1 );\n}\n\nvoid CHudAmmo::DrawCrosshairPadding( int _pad, int _x0, int _y0, int _x1, int _y1 )\n{\n\tfloat pad = (float)_pad;\n\tfloat x0 = (float)_x0;\n\tfloat y0 = (float)_y0;\n\tfloat x1 = (float)_x1;\n\tfloat y1 = (float)_y1;\n\tint alpha = 255;\n\n\t// float out_top_left[2] = { x0 - pad, y0 - pad };\n\t// float out_top_right[2] = { x1 + pad, y0 - pad };\n\t// float out_bottom_right[2] = { x1 + pad, y1 + pad };\n\t// float out_bottom_left[2] = { x0 - pad, y1 + pad };\n\t// float in_top_left[2] = { x0, y0 };\n\t// float in_top_right[2] = { x1, y0 };\n\t// float in_bottom_right[2] = { x1, y1 };\n\t// float in_bottom_left[2] = { x0, y1 };\n\n\tif ( sscanf( xhair_color->string, \"%*d %*d %*d %d\", &alpha ) == 1 )\n\t{\n\t\talpha = bound( 0, alpha, 255 );\n\t}\n\tgEngfuncs.pTriAPI->Color4f( 0, 0, 0, alpha / 255.0f );\n\t// gEngfuncs.pTriAPI->Brightness( 1.0f );\n\n\tDrawUtils::Draw2DQuad( x0 - pad, y0 - pad, x1 + pad, y0 ); // top part\n\tDrawUtils::Draw2DQuad( x0 - pad, y1, x1 + pad, y1 + pad ); // bottom part\n\tDrawUtils::Draw2DQuad( x0 - pad, y0, x0, y1 );             // left part\n\tDrawUtils::Draw2DQuad( x1, y0, x1 + pad, y1 );             // right part\n}\n\nvoid CHudAmmo::DrawCrosshair( int weaponId )\n{\n\tint center_x, center_y;\n\tint gap, length, thickness;\n\tint y0, y1, x0, x1;\n\twrect_t inner;\n\twrect_t outer;\n\n\t/* calculate the coordinates */\n\tcenter_x = ( ScreenWidth / 2 ) * gHUD.m_flScale;\n\tcenter_y = ( ScreenHeight / 2 ) * gHUD.m_flScale;\n\n\tgap = ScaleForRes( GetCrosshairGap( weaponId ), ScreenHeight * gHUD.m_flScale );\n\tlength = ScaleForRes( xhair_size->value, ScreenHeight * gHUD.m_flScale );\n\tthickness = ScaleForRes( xhair_thick->value, ScreenHeight * gHUD.m_flScale );\n\tthickness = max( 1, thickness );\n\n\tinner.left = ( center_x - gap - thickness / 2 );\n\tinner.right = ( inner.left + 2 * gap + thickness );\n\tinner.top = ( center_y - gap - thickness / 2 );\n\tinner.bottom = ( inner.top + 2 * gap + thickness );\n\n\touter.left = ( inner.left - length );\n\touter.right = ( inner.right + length );\n\touter.top = ( inner.top - length );\n\touter.bottom = ( inner.bottom + length );\n\n\ty0 = ( center_y - thickness / 2 );\n\tx0 = ( center_x - thickness / 2 );\n\ty1 = ( y0 + thickness );\n\tx1 = ( x0 + thickness );\n\n\tgEngfuncs.pTriAPI->Brightness( 1.0f );\n\tgEngfuncs.pTriAPI->CullFace( TRI_NONE );\n\n\tgRenderAPI.GL_SelectTexture( 0 );\n\tgRenderAPI.GL_Bind( 0, gHUD.m_WhiteTex );\n\n\tif ( xhair_additive->value )\n\t\tgEngfuncs.pTriAPI->RenderMode( kRenderTransAdd );\n\telse\n\t\tgEngfuncs.pTriAPI->RenderMode( kRenderTransAlpha );\n\n\tif ( xhair_dot->value )\n\t\tDrawCrosshairSection( x0, y0, x1, y1 );\n\n\tif ( !xhair_t->value )\n\t\tDrawCrosshairSection( x0, outer.top, x1, inner.top );\n\n\tDrawCrosshairSection( x0, inner.bottom, x1, outer.bottom );\n\tDrawCrosshairSection( outer.left, y0, inner.left, y1 );\n\tDrawCrosshairSection( inner.right, y0, outer.right, y1 );\n\n\tif ( xhair_additive->value )\n\t\tgEngfuncs.pTriAPI->RenderMode( kRenderTransAlpha );\n\n\t/* draw padding if wanted */\n\tif ( xhair_pad->value )\n\t{\n\t\t/* don't scale this */\n\t\tint pad = (int)xhair_pad->value;\n\n\t\tif ( xhair_dot->value )\n\t\t\tDrawCrosshairPadding( pad, x0, y0, x1, y1 );\n\n\t\tif ( !xhair_t->value )\n\t\t\tDrawCrosshairPadding( pad, x0, outer.top, x1, inner.top );\n\n\t\tDrawCrosshairPadding( pad, x0, inner.bottom, x1, outer.bottom );\n\t\tDrawCrosshairPadding( pad, outer.left, y0, inner.left, y1 );\n\t\tDrawCrosshairPadding( pad, inner.right, y0, outer.right, y1 );\n\t}\n}\n\nvoid CHudAmmo::DrawCrosshair()\n{\n\tint flags, iDeltaDistance, iDistance, iLength, weaponid;\n\tfloat flCrosshairDistance;\n\n\tif ( !m_pWeapon )\n\t\treturn;\n\n\tweaponid = m_pWeapon->iId;\n\n\tif ( weaponid == WEAPON_AWP\n\t     || weaponid == WEAPON_SCOUT\n\t     || weaponid == WEAPON_SG550\n\t     || weaponid == WEAPON_G3SG1 )\n\t\treturn;\n\n\tif ( g_iWeaponFlags & WPNSTATE_SHIELD_DRAWN )\n\t\treturn;\n\n\tif ( weaponid <= 30 )\n\t{\n\t\tiDistance = Distances[weaponid - 1][0];\n\t\tiDeltaDistance = Distances[weaponid - 1][1];\n\t}\n\telse\n\t{\n\t\tiDistance = 4;\n\t\tiDeltaDistance = 3;\n\t}\n\n\tflags = GetWeaponAccuracyFlags( weaponid );\n\tif ( flags && m_pClDynamicCrosshair->value && !( gHUD.m_iHideHUDDisplay & 1 ) )\n\t{\n\t\tif ( g_iPlayerFlags & FL_ONGROUND || !( flags & ACCURACY_AIR ) )\n\t\t{\n\t\t\tif ( ( g_iPlayerFlags & FL_DUCKING ) && ( flags & ACCURACY_DUCK ) )\n\t\t\t{\n\t\t\t\tiDistance *= 0.5;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tint iWeaponSpeed = 0;\n\n\t\t\t\tswitch ( weaponid )\n\t\t\t\t{\n\t\t\t\tcase WEAPON_P90: // p90\n\t\t\t\t\tiWeaponSpeed = 170;\n\t\t\t\t\tbreak;\n\t\t\t\tcase WEAPON_AUG:   // aug\n\t\t\t\tcase WEAPON_GALIL: // galil\n\t\t\t\tcase WEAPON_FAMAS: // famas\n\t\t\t\tcase WEAPON_M249:  // m249\n\t\t\t\tcase WEAPON_M4A1:  // m4a1\n\t\t\t\tcase WEAPON_SG552: // sg552\n\t\t\t\tcase WEAPON_AK47:  // ak47\n\t\t\t\t\tiWeaponSpeed = 140;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tif ( ( flags & ACCURACY_SPEED ) && ( g_flPlayerSpeed >= iWeaponSpeed ) )\n\t\t\t\t\tiDistance *= 1.5;\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tiDistance *= 2;\n\t\t}\n\t\tif ( flags & ACCURACY_MULTIPLY_BY_14 )\n\t\t\tiDistance *= 1.4;\n\t\tif ( flags & ACCURACY_MULTIPLY_BY_14_2 )\n\t\t\tiDistance *= 1.4;\n\t}\n\n\tif ( m_iAmmoLastCheck >= g_iShotsFired )\n\t{\n\t\tm_flCrosshairDistance -= ( m_flCrosshairDistance * 0.013 + 0.1 );\n\t\tm_iAlpha += 2;\n\t}\n\telse\n\t{\n\t\tm_flCrosshairDistance = min( m_flCrosshairDistance + iDeltaDistance, 15.0f );\n\t\tm_iAlpha = max( m_iAlpha - 40, 120 );\n\t}\n\n\tif ( g_iShotsFired > 600 )\n\t\tg_iShotsFired = 1;\n\n\tCalcCrosshairColor();\n\tCalcCrosshairDrawMode();\n\tCalculateCrosshairSize();\n\n\tm_iAmmoLastCheck = g_iShotsFired;\n\tm_flCrosshairDistance = max( m_flCrosshairDistance, iDistance );\n\tiLength = ( m_flCrosshairDistance - iDistance ) * 0.5 + 5;\n\n\tif ( m_iAlpha > 255 )\n\t\tm_iAlpha = 255;\n\n\tif ( ScreenWidth != m_iCrosshairScaleBase )\n\t{\n\t\tflCrosshairDistance = ScreenWidth * m_flCrosshairDistance / m_iCrosshairScaleBase;\n\t\tiLength = ScreenWidth * iLength / m_iCrosshairScaleBase;\n\t}\n\telse\n\t{\n\t\tflCrosshairDistance = m_flCrosshairDistance;\n\t}\n\n\t// drawing\n\tif ( g_iXash && xhair_enable->value )\n\t{\n\t\tDrawCrosshair( weaponid );\n\t\treturn;\n\t}\n\n\tif ( m_bAdditive )\n\t{\n\t\tFillRGBA( WEST_XPOS, EAST_WEST_YPOS, iLength, 1, m_R, m_G, m_B, m_iAlpha );\n\t\tFillRGBA( EAST_XPOS, EAST_WEST_YPOS, iLength, 1, m_R, m_G, m_B, m_iAlpha );\n\t\tFillRGBA( NORTH_SOUTH_XPOS, NORTH_YPOS, 1, iLength, m_R, m_G, m_B, m_iAlpha );\n\t\tFillRGBA( NORTH_SOUTH_XPOS, SOUTH_YPOS, 1, iLength, m_R, m_G, m_B, m_iAlpha );\n\t}\n\telse\n\t{\n\t\tFillRGBABlend( WEST_XPOS, EAST_WEST_YPOS, iLength, 1, m_R, m_G, m_B, m_iAlpha );\n\t\tFillRGBABlend( EAST_XPOS, EAST_WEST_YPOS, iLength, 1, m_R, m_G, m_B, m_iAlpha );\n\t\tFillRGBABlend( NORTH_SOUTH_XPOS, NORTH_YPOS, 1, iLength, m_R, m_G, m_B, m_iAlpha );\n\t\tFillRGBABlend( NORTH_SOUTH_XPOS, SOUTH_YPOS, 1, iLength, m_R, m_G, m_B, m_iAlpha );\n\t}\n}\n\nvoid CHudAmmo::CalculateCrosshairSize()\n{\n\tint size;\n\n\tsize = strtol( m_pClCrosshairSize->string, NULL, 10 );\n\n\tif( size > 3 )\n\t{\n\t\tsize = -1;\n\t}\n\telse if( size == 0 && strcmp( \"0\", m_pClCrosshairSize->string ))\n\t{\n\t\tsize = -1;\n\t}\n\t\n\tif( !stricmp( m_pClCrosshairSize->string, \"auto\" ))\n\t{\n\t\tsize = 0;\n\t}\n\telse if( !stricmp( m_pClCrosshairSize->string, \"small\" ))\n\t{\n\t\tsize = 1;\n\t}\n\telse if( !stricmp( m_pClCrosshairSize->string, \"medium\" ))\n\t{\n\t\tsize = 2;\n\t}\n\telse if( !stricmp( m_pClCrosshairSize->string, \"large\" ))\n\t{\n\t\tsize = 3;\n\t}\n\n\tswitch( size )\n\t{\n\tcase -1:\n\t\tgEngfuncs.Con_Printf( \"usage: cl_crosshair_size <auto|small|medium|large>\\n\" );\n        break;\n\tcase 0:\n\t\tif( gHUD.m_scrinfo.iWidth > 640 )\n\t\t{\n\t\t\tif( gHUD.m_scrinfo.iWidth < 1024 )\n\t\t\t\tm_iCrosshairScaleBase = 800;\n\t\t\telse\n\t\t\t\tm_iCrosshairScaleBase = 640;\n\t\t}\n\t\tbreak;\n\tcase 1:\n\t\tm_iCrosshairScaleBase = 1024;\n\t\tbreak;\n\tcase 2:\n\t\tm_iCrosshairScaleBase = 800;\n\t\tbreak;\n\tcase 3:\n\tdefault:\n\t\tm_iCrosshairScaleBase = 640;\n\t\tbreak;\n\t}\n}\n\nvoid CHudAmmo::CalcCrosshairDrawMode()\n{\n\tstatic float prevDrawMode = -1;\n\tfloat drawMode = m_pClCrosshairTranslucent->value;\n\t\n\tif( gHUD.m_NVG.m_iFlags )\n\t{\n\t\tm_bAdditive = 0;\n\t\treturn;\n\t}\n\n\tif( drawMode == prevDrawMode )\n\t\treturn;\n\t\n\tif ( drawMode == 0.0f )\n\t{\n\t\tm_bAdditive = 0;\n\t}\n\telse if ( drawMode == 1.0f )\n\t{\n\t\tm_bAdditive = 1;\n\t}\n\telse\n\t{\n\t\tgEngfuncs.Con_Printf(\"usage: cl_crosshair_translucent <1|0>\\n\");\n\t\tgEngfuncs.Cvar_Set(\"cl_crosshair_translucent\", \"1\");\n\t}\n\t\n\tprevDrawMode = drawMode;\n}\n\nvoid CHudAmmo::CalcCrosshairColor()\n{\n\tstatic char prevColors[64] = { 0 };\n\tconst char *colors = m_pClCrosshairColor->string;\n\n\tif( gHUD.m_NVG.m_iFlags )\n\t{\n\t\tm_R = 250;\n\t\tm_G = 50;\n\t\tm_B = 50;\n\t\treturn;\n\t}\n\n\tif( strncmp( prevColors, colors, 64 ) )\n\t{\n\t\tstrncpy( prevColors, colors, 64 );\n\t\tprevColors[63] = 0;\n\t\n\t\tsscanf( colors, \"%d %d %d\", &m_cvarR, &m_cvarG, &m_cvarB);\n\n\t\tm_R = m_cvarR = bound( 0, m_cvarR, 255 );\n\t\tm_G = m_cvarG = bound( 0, m_cvarG, 255 );\n\t\tm_B = m_cvarB = bound( 0, m_cvarB, 255 );\n\t}\n\telse\n\t{\n\t\tm_R = m_cvarR;\n\t\tm_G = m_cvarG;\n\t\tm_B = m_cvarB;\n\t}\n}\n\n//\n// Draws the ammo bar on the hud\n//\nint DrawBar(int x, int y, int width, int height, float f)\n{\n\tint r, g, b;\n\n\tf = bound( 0, f, 1 );\n\t\n\tif (f)\n\t{\n\t\tint w = f * width;\n\n\t\t// Always show at least one pixel if we have ammo.\n\t\tif (w <= 0)\n\t\t\tw = 1;\n\t\tDrawUtils::UnpackRGB(r, g, b, RGB_GREENISH);\n\t\tFillRGBA(x, y, w, height, r, g, b, 255);\n\t\tx += w;\n\t\twidth -= w;\n\t}\n\n\tDrawUtils::UnpackRGB( r, g, b, gHUD.m_iDefaultHUDColor );\n\n\tFillRGBA(x, y, width, height, r, g, b, 128);\n\n\treturn (x + width);\n}\n\n\n\nvoid DrawAmmoBar(WEAPON *p, int x, int y, int width, int height)\n{\n\tif ( !p )\n\t\treturn;\n\t\n\tif (p->iAmmoType != -1)\n\t{\n\t\tif (!gWR.CountAmmo(p->iAmmoType))\n\t\t\treturn;\n\n\t\tfloat f = (float)gWR.CountAmmo(p->iAmmoType)/(float)p->iMax1;\n\t\t\n\t\tx = DrawBar(x, y, width, height, f);\n\n\n\t\t// Do we have secondary ammo too?\n\n\t\tif (p->iAmmo2Type != -1)\n\t\t{\n\t\t\tf = (float)gWR.CountAmmo(p->iAmmo2Type)/(float)p->iMax2;\n\n\t\t\tx += 5; //!!!\n\n\t\t\tDrawBar(x, y, width, height, f);\n\t\t}\n\t}\n}\n\n\n\n\n//\n// Draw Weapon Menu\n//\nint CHudAmmo::DrawWList(float flTime)\n{\n\tint r,g,b,x,y,a,i;\n\n\tif ( !gpActiveSel )\n\t\treturn 0;\n\n\tint iActiveSlot;\n\n\tif ( gpActiveSel == (WEAPON *)1 )\n\t\tiActiveSlot = -1;\t// current slot has no weapons\n\telse \n\t\tiActiveSlot = gpActiveSel->iSlot;\n\n\tx = gHUD.m_Radar.m_hRadar.rect.right + 10; //!!!\n\ty = 10; //!!!\n\t\n\n\t// Ensure that there are available choices in the active slot\n\tif ( iActiveSlot > 0 )\n\t{\n\t\tif ( !gWR.GetFirstPos( iActiveSlot ) )\n\t\t{\n\t\t\tgpActiveSel = (WEAPON *)1;\n\t\t\tiActiveSlot = -1;\n\t\t}\n\t}\n\t\t\n\t// Draw top line\n\tfor ( i = 0; i < MAX_WEAPON_SLOTS; i++ )\n\t{\n\t\tint iWidth;\n\n\t\tDrawUtils::UnpackRGB( r, g, b, gHUD.m_iDefaultHUDColor );\n\t\n\t\tif ( iActiveSlot == i )\n\t\t\ta = 255;\n\t\telse\n\t\t\ta = 192;\n\n\t\tDrawUtils::ScaleColors(r, g, b, 255);\n\t\tSPR_Set(gHUD.GetSprite(m_HUD_bucket0 + i), r, g, b );\n\n\t\t// make active slot wide enough to accommodate gun pictures\n\t\tif ( i == iActiveSlot )\n\t\t{\n\t\t\tWEAPON *p = gWR.GetFirstPos(iActiveSlot);\n\t\t\tif ( p )\n\t\t\t\tiWidth = p->rcActive.Width();\n\t\t\telse\n\t\t\t\tiWidth = giBucketWidth;\n\t\t}\n\t\telse\n\t\t\tiWidth = giBucketWidth;\n\n\t\tSPR_DrawAdditive(0, x, y, &gHUD.GetSpriteRect(m_HUD_bucket0 + i));\n\t\t\n\t\tx += iWidth + 5;\n\t}\n\n\n\ta = 128; //!!!\n\tx = gHUD.m_Radar.m_hRadar.rect.right + 10; //!!!;\n\n\t// Draw all of the buckets\n\tfor (i = 0; i < MAX_WEAPON_SLOTS; i++)\n\t{\n\t\ty = giBucketHeight + 10;\n\n\t\t// If this is the active slot, draw the bigger pictures,\n\t\t// otherwise just draw boxes\n\t\tif ( i == iActiveSlot )\n\t\t{\n\t\t\tWEAPON *p = gWR.GetFirstPos( i );\n\t\t\tint iWidth = giBucketWidth;\n\t\t\tif ( p )\n\t\t\t\tiWidth = p->rcActive.Width();\n\n\t\t\tfor ( int iPos = 0; iPos < MAX_WEAPON_POSITIONS; iPos++ )\n\t\t\t{\n\t\t\t\tp = gWR.GetWeaponSlot( i, iPos );\n\n\t\t\t\tif ( !p || !p->iId )\n\t\t\t\t\tcontinue;\n\n\t\t\t\n\t\t\t\t// if active, then we must have ammo.\n\t\t\t\tif ( gWR.HasAmmo(p) )\n\t\t\t\t{\n\t\t\t\t\tDrawUtils::UnpackRGB( r, g, b, gHUD.m_iDefaultHUDColor );\n\t\t\t\t\tDrawUtils::ScaleColors(r, g, b, 192);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tDrawUtils::UnpackRGB(r,g,b, RGB_REDISH);\n\t\t\t\t\tDrawUtils::ScaleColors(r, g, b, 128);\n\t\t\t\t}\n\n\n\t\t\t\tif ( gpActiveSel == p )\n\t\t\t\t{\n\t\t\t\t\tSPR_Set(p->hActive, r, g, b );\n\t\t\t\t\tSPR_DrawAdditive(0, x, y, &p->rcActive);\n\n\t\t\t\t\tSPR_Set(gHUD.GetSprite(m_HUD_selection), r, g, b );\n\t\t\t\t\tSPR_DrawAdditive(0, x, y, &gHUD.GetSpriteRect(m_HUD_selection));\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t// Draw Weapon if Red if no ammo\n\t\t\t\t\tSPR_Set( p->hInactive, r, g, b );\n\t\t\t\t\tSPR_DrawAdditive( 0, x, y, &p->rcInactive );\n\t\t\t\t}\n\n\t\t\t\t// Draw Ammo Bar\n\n\t\t\t\tDrawAmmoBar(p, x + giABWidth/2, y, giABWidth, giABHeight);\n\t\t\t\t\n\t\t\t\ty += p->rcActive.Height() + 5;\n\t\t\t}\n\n\t\t\tx += iWidth + 5;\n\n\t\t}\n\t\telse\n\t\t{\n\t\t\t// Draw Row of weapons.\n\n\t\t\tDrawUtils::UnpackRGB( r, g, b, gHUD.m_iDefaultHUDColor );\n\n\t\t\tfor ( int iPos = 0; iPos < MAX_WEAPON_POSITIONS; iPos++ )\n\t\t\t{\n\t\t\t\tWEAPON *p = gWR.GetWeaponSlot( i, iPos );\n\t\t\t\t\n\t\t\t\tif ( !p || !p->iId )\n\t\t\t\t\tcontinue;\n\n\t\t\t\tif ( gWR.HasAmmo(p) )\n\t\t\t\t{\n\t\t\t\t\tDrawUtils::UnpackRGB( r, g, b, gHUD.m_iDefaultHUDColor );\n\t\t\t\t\ta = 128;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tDrawUtils::UnpackRGB(r,g,b, RGB_REDISH);\n\t\t\t\t\ta = 96;\n\t\t\t\t}\n\n\t\t\t\tFillRGBA( x, y, giBucketWidth, giBucketHeight, r, g, b, a );\n\n\t\t\t\ty += giBucketHeight + 5;\n\t\t\t}\n\n\t\t\tx += giBucketWidth + 5;\n\t\t}\n\t}\t\n\n\treturn 1;\n\n}\n\n\n/*\n=================================\n\tGetSpriteList\n\nFinds and returns the matching \nsprite name 'psz' and resolution 'iRes'\nin the given sprite list 'pList'\niCount is the number of items in the pList\n=================================\n*/\nclient_sprite_t *GetSpriteList(client_sprite_t *pList, const char *psz, int iRes, int iCount)\n{\n\tif (!pList)\n\t\treturn NULL;\n\n\tint i = iCount;\n\tclient_sprite_t *p = pList;\n\n\twhile(i--)\n\t{\n\t\tif ((!strcmp(psz, p->szName)) && (p->iRes == iRes))\n\t\t\treturn p;\n\t\tp++;\n\t}\n\n\treturn NULL;\n}\n\n/*\n=================\nSetCrosshair\n\n=================\n*/\nvoid CHudAmmo::SetCrosshair(HSPRITE hSpr, wrect_t rect, int r, int g, int b)\n{\n\tm_hStaticSpr = hSpr;\n\tm_rcStaticRc = rect;\n\tm_staticRgba.r = r;\n\tm_staticRgba.g = g;\n\tm_staticRgba.b = b;\n\tm_staticRgba.a = 255;\n}\n\nvoid CHudAmmo::HideCrosshair()\n{\n\tm_hStaticSpr = 0;\n}\n\n"
  },
  {
    "path": "cl_dll/ammo_secondary.cpp",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\t\n*\tThis product contains software technology licensed from Id \n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc. \n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n//\n// ammo_secondary.cpp\n//\n// implementation of CHudAmmoSecondary class\n//\n\n#include \"hud.h\"\n#include \"cl_util.h\"\n#include <string.h>\n#include <stdio.h>\n#include \"parsemsg.h\"\n#include \"draw_util.h\"\n\nint CHudAmmoSecondary :: Init( void )\n{\n\tHOOK_MESSAGE( gHUD.m_AmmoSecondary, SecAmmoVal );\n\tHOOK_MESSAGE( gHUD.m_AmmoSecondary, SecAmmoIcon );\n\n\tgHUD.AddHudElem(this);\n\tm_HUD_ammoicon = 0;\n\n\tfor ( int i = 0; i < MAX_SEC_AMMO_VALUES; i++ )\n\t\tm_iAmmoAmounts[i] = -1;  // -1 means don't draw this value\n\n\tReset();\n\n\treturn 1;\n}\n\nvoid CHudAmmoSecondary :: Reset( void )\n{\n\tm_fFade = 0;\n}\n\nint CHudAmmoSecondary :: VidInit( void )\n{\n\treturn 1;\n}\n\nint CHudAmmoSecondary :: Draw(float flTime)\n{\n\tif ( (gHUD.m_iHideHUDDisplay & ( HIDEHUD_WEAPONS | HIDEHUD_ALL )) )\n\t\treturn 1;\n\n\t// draw secondary ammo icons above normal ammo readout\n\tint a, x, y, r, g, b, AmmoWidth;\n\tDrawUtils::UnpackRGB( r, g, b, gHUD.m_iDefaultHUDColor );\n\ta = (int) max( MIN_ALPHA, m_fFade );\n\tif (m_fFade > 0)\n\t\tm_fFade -= (gHUD.m_flTimeDelta * 20);  // slowly lower alpha to fade out icons\n\tDrawUtils::ScaleColors( r, g, b, a );\n\n\tAmmoWidth = gHUD.GetSpriteRect(gHUD.m_HUD_number_0).Width();\n\n\ty = ScreenHeight - (gHUD.m_iFontHeight*4);  // this is one font height higher than the weapon ammo values\n\tx = ScreenWidth - AmmoWidth;\n\n\tif ( m_HUD_ammoicon )\n\t{\n\t\t// Draw the ammo icon\n\t\tx -= (gHUD.GetSpriteRect(m_HUD_ammoicon).Width());\n\t\ty += (gHUD.GetSpriteRect(m_HUD_ammoicon).Height());\n\n\t\tSPR_Set( gHUD.GetSprite(m_HUD_ammoicon), r, g, b );\n\t\tSPR_DrawAdditive( 0, x, y, &gHUD.GetSpriteRect(m_HUD_ammoicon) );\n\t}\n\telse\n\t{  // move the cursor by the '0' char instead, since we don't have an icon to work with\n\t\tx -= AmmoWidth;\n\t\ty += (gHUD.GetSpriteRect(gHUD.m_HUD_number_0).Height());\n\t}\n\n\t// draw the ammo counts, in reverse order, from right to left\n\tfor ( int i = MAX_SEC_AMMO_VALUES-1; i >= 0; i-- )\n\t{\n\t\tif ( m_iAmmoAmounts[i] < 0 )\n\t\t\tcontinue; // negative ammo amounts imply that they shouldn't be drawn\n\n\t\t// half a char gap between the ammo number and the previous pic\n\t\tx -= (AmmoWidth / 2);\n\n\t\t// draw the number, right-aligned\n\t\tx -= (DrawUtils::GetNumWidth( m_iAmmoAmounts[i], DHN_DRAWZERO ) * AmmoWidth);\n\t\tDrawUtils::DrawHudNumber( x, y, DHN_DRAWZERO, m_iAmmoAmounts[i], r, g, b );\n\n\t\tif ( i != 0 )\n\t\t{\n\t\t\t// draw the divider bar\n\t\t\tx -= (AmmoWidth / 2);\n\t\t\tFillRGBA(x, y, (AmmoWidth/10), gHUD.m_iFontHeight, r, g, b, a);\n\t\t}\n\t}\n\n\treturn 1;\n}\n\n// Message handler for Secondary Ammo Value\n// accepts one value:\n//\t\tstring:  sprite name\nint CHudAmmoSecondary :: MsgFunc_SecAmmoIcon( const char *pszName, int iSize, void *pbuf )\n{\n\tBufferReader reader( pszName, pbuf, iSize );\n\tm_HUD_ammoicon = gHUD.GetSpriteIndex( reader.ReadString() );\n\n\treturn 1;\n}\n\n// Message handler for Secondary Ammo Icon\n// Sets an ammo value\n// takes two values:\n//\t\tbyte:  ammo index\n//\t\tbyte:  ammo value\nint CHudAmmoSecondary :: MsgFunc_SecAmmoVal( const char *pszName, int iSize, void *pbuf )\n{\n\tBufferReader reader( pszName, pbuf, iSize );\n\n\tint index = reader.ReadByte();\n\tif ( index < 0 || index >= MAX_SEC_AMMO_VALUES )\n\t\treturn 1;\n\n\tm_iAmmoAmounts[index] = reader.ReadByte();\n\tm_iFlags |= HUD_DRAW;\n\n\t// check to see if there is anything left to draw\n\tint count = 0;\n\tfor ( int i = 0; i < MAX_SEC_AMMO_VALUES; i++ )\n\t{\n\t\tcount += max( 0, m_iAmmoAmounts[i] );\n\t}\n\n\tif ( count == 0 ) \n\t{\t// the ammo fields are all empty, so turn off this hud area\n\t\tm_iFlags &= ~HUD_DRAW;\n\t\treturn 1;\n\t}\n\n\t// make the icons light up\n\tm_fFade = 200.0f;\n\n\treturn 1;\n}\n\n\n"
  },
  {
    "path": "cl_dll/ammohistory.cpp",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\t\n*\tThis product contains software technology licensed from Id \n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc. \n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n//\n//  ammohistory.cpp\n//\n\n\n#include \"hud.h\"\n#include \"cl_util.h\"\n#include \"parsemsg.h\"\n\n#include <string.h>\n#include <stdio.h>\n\n#include \"ammohistory.h\"\n#include \"draw_util.h\"\n\nHistoryResource gHR;\n\n#define AMMO_PICKUP_GAP (gHR.iHistoryGap+5)\n#define AMMO_PICKUP_PICK_HEIGHT\t\t(gHUD.m_iFontHeight * 3 + (gHR.iHistoryGap * 2))\n#define AMMO_PICKUP_HEIGHT_MAX\t\t(ScreenHeight - 100)\n\n#define MAX_ITEM_NAME\t32\nint HISTORY_DRAW_TIME = 5;\n\n// keep a list of items\nstruct ITEM_INFO\n{\n\tchar szName[MAX_ITEM_NAME];\n\tHSPRITE spr;\n\twrect_t rect;\n};\n\nvoid HistoryResource :: AddToHistory( int iType, int iId, int iCount )\n{\n\tif ( iType == HISTSLOT_AMMO && !iCount )\n\t\treturn;  // no amount, so don't add\n\n\tif ( (((AMMO_PICKUP_GAP * iCurrentHistorySlot) + AMMO_PICKUP_PICK_HEIGHT) > AMMO_PICKUP_HEIGHT_MAX) || (iCurrentHistorySlot >= MAX_HISTORY) )\n\t{\t// the pic would have to be drawn too high\n\t\t// so start from the bottom\n\t\tiCurrentHistorySlot = 0;\n\t}\n\t\n\tHIST_ITEM *freeslot = &rgAmmoHistory[iCurrentHistorySlot++];  // default to just writing to the first slot\n\tHISTORY_DRAW_TIME = gHUD.m_Ammo.m_pHud_DrawHistory_Time->value;\n\n\tfreeslot->type = iType;\n\tfreeslot->iId = iId;\n\tfreeslot->iCount = iCount;\n\tfreeslot->DisplayTime = gHUD.m_flTime + HISTORY_DRAW_TIME;\n}\n\nvoid HistoryResource :: AddToHistory( int iType, const char *szName, int iCount )\n{\n\tif ( iType != HISTSLOT_ITEM )\n\t\treturn;\n\n\tif ( (((AMMO_PICKUP_GAP * iCurrentHistorySlot) + AMMO_PICKUP_PICK_HEIGHT) > AMMO_PICKUP_HEIGHT_MAX) || (iCurrentHistorySlot >= MAX_HISTORY) )\n\t{\t// the pic would have to be drawn too high\n\t\t// so start from the bottom\n\t\tiCurrentHistorySlot = 0;\n\t}\n\n\tHIST_ITEM *freeslot = &rgAmmoHistory[iCurrentHistorySlot++];  // default to just writing to the first slot\n\n\t// I am really unhappy with all the code in this file\n\t// I am too, -- a1batross\n\n\tint i = gHUD.GetSpriteIndex( szName );\n\tif ( i == -1 )\n\t\treturn;  // unknown sprite name, don't add it to history\n\n\tfreeslot->iId = i;\n\tfreeslot->type = iType;\n\tfreeslot->iCount = iCount;\n\n\tHISTORY_DRAW_TIME = gHUD.m_Ammo.m_pHud_DrawHistory_Time->value;\n\tfreeslot->DisplayTime = gHUD.m_flTime + HISTORY_DRAW_TIME;\n}\n\n\nvoid HistoryResource :: CheckClearHistory( void )\n{\n\tfor ( int i = 0; i < MAX_HISTORY; i++ )\n\t{\n\t\tif ( rgAmmoHistory[i].type )\n\t\t\treturn;\n\t}\n\n\tiCurrentHistorySlot = 0;\n}\n\n//\n// Draw Ammo pickup history\n//\nint HistoryResource :: DrawAmmoHistory( float flTime )\n{\n\tfor ( int i = 0; i < MAX_HISTORY; i++ )\n\t{\n\t\tif ( rgAmmoHistory[i].type )\n\t\t{\n\t\t\trgAmmoHistory[i].DisplayTime = min( rgAmmoHistory[i].DisplayTime, gHUD.m_flTime + HISTORY_DRAW_TIME );\n\n\t\t\tif ( rgAmmoHistory[i].DisplayTime <= flTime )\n\t\t\t{  // pic drawing time has expired\n\t\t\t\tmemset( &rgAmmoHistory[i], 0, sizeof(HIST_ITEM) );\n\t\t\t\tCheckClearHistory();\n\t\t\t}\n\t\t\telse if ( rgAmmoHistory[i].type == HISTSLOT_AMMO )\n\t\t\t{\n\t\t\t\twrect_t rcPic;\n\t\t\t\tHSPRITE *spr = gWR.GetAmmoPicFromWeapon( rgAmmoHistory[i].iId, rcPic );\n\n\t\t\t\tint r, g, b;\n\t\t\t\tDrawUtils::UnpackRGB( r, g, b, gHUD.m_iDefaultHUDColor );\n\t\t\t\tfloat scale = (rgAmmoHistory[i].DisplayTime - flTime) * 80;\n\t\t\t\tDrawUtils::ScaleColors(r, g, b, min(scale, 255) );\n\n\t\t\t\t// Draw the pic\n\t\t\t\tint ypos = ScreenHeight - (AMMO_PICKUP_PICK_HEIGHT + (AMMO_PICKUP_GAP * i));\n\t\t\t\tint xpos = ScreenWidth - 24;\n\t\t\t\tif ( spr && *spr )    // weapon isn't loaded yet so just don't draw the pic\n\t\t\t\t{ // the dll has to make sure it has sent info the weapons you need\n\t\t\t\t\tSPR_Set( *spr, r, g, b );\n\t\t\t\t\tSPR_DrawAdditive( 0, xpos, ypos, &rcPic );\n\t\t\t\t}\n\n\t\t\t\t// Draw the number\n\t\t\t\tDrawUtils::DrawHudNumberString( xpos - 10, ypos, xpos - 100, rgAmmoHistory[i].iCount, r, g, b );\n\t\t\t}\n\t\t\telse if ( rgAmmoHistory[i].type == HISTSLOT_WEAP )\n\t\t\t{\n\t\t\t\tWEAPON *weap = gWR.GetWeapon( rgAmmoHistory[i].iId );\n\n\t\t\t\tif ( !weap )\n\t\t\t\t\tcontinue;  // we don't know about the weapon yet, so don't draw anything\n\n\t\t\t\tint r, g, b;\n\t\t\t\tDrawUtils::UnpackRGB( r, g, b, gHUD.m_iDefaultHUDColor );\n\n\t\t\t\tif ( !gWR.HasAmmo( weap ) )\n\t\t\t\t\tDrawUtils::UnpackRGB(r,g,b, RGB_REDISH);\t// if the weapon doesn't have ammo, display it as red\n\n\t\t\t\tfloat scale = (rgAmmoHistory[i].DisplayTime - flTime) * 80;\n\t\t\t\tDrawUtils::ScaleColors(r, g, b, min(scale, 255) );\n\n\t\t\t\tint ypos = ScreenHeight - (AMMO_PICKUP_PICK_HEIGHT + (AMMO_PICKUP_GAP * i));\n\t\t\t\tint xpos = ScreenWidth - (weap->rcInactive.Width());\n\t\t\t\tSPR_Set( weap->hInactive, r, g, b );\n\t\t\t\tSPR_DrawAdditive( 0, xpos, ypos, &weap->rcInactive );\n\t\t\t}\n\t\t\telse if ( rgAmmoHistory[i].type == HISTSLOT_ITEM )\n\t\t\t{\n\t\t\t\tint r, g, b;\n\n\t\t\t\tif ( !rgAmmoHistory[i].iId )\n\t\t\t\t\tcontinue;  // sprite not loaded\n\n\t\t\t\twrect_t rect = gHUD.GetSpriteRect( rgAmmoHistory[i].iId );\n\n\t\t\t\tDrawUtils::UnpackRGB( r, g, b, gHUD.m_iDefaultHUDColor );\n\t\t\t\tfloat scale = (rgAmmoHistory[i].DisplayTime - flTime) * 80;\n\t\t\t\tDrawUtils::ScaleColors(r, g, b, min(scale, 255) );\n\n\t\t\t\tint ypos = ScreenHeight - (AMMO_PICKUP_PICK_HEIGHT + (AMMO_PICKUP_GAP * i));\n\t\t\t\tint xpos = ScreenWidth - (rect.Width()) - 10;\n\n\t\t\t\tSPR_Set( gHUD.GetSprite( rgAmmoHistory[i].iId ), r, g, b );\n\t\t\t\tSPR_DrawAdditive( 0, xpos, ypos, &rect );\n\t\t\t}\n\t\t}\n\t}\n\n\n\treturn 1;\n}\n\n\n"
  },
  {
    "path": "cl_dll/ammohistory.h",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\t\n*\tThis product contains software technology licensed from Id \n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc. \n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n//\n// ammohistory.h\n//\n#pragma once\n// this is the max number of items in each bucket\n#define MAX_WEAPON_POSITIONS\t\t22\n\nclass WeaponsResource\n{\nprivate:\n\t// Information about weapons & ammo\n\tWEAPON\t\trgWeapons[MAX_WEAPONS];\t// Weapons Array\n\n\t// counts of weapons * ammo\n\tWEAPON*\t\trgSlots[MAX_WEAPON_SLOTS+1][MAX_WEAPON_POSITIONS+1];\t// The slots currently in use by weapons.  The value is a pointer to the weapon;  if it's NULL, no weapon is there\n\tint\t\t\triAmmo[MAX_AMMO_TYPES];\t\t\t\t\t\t\t// count of each ammo type\n\npublic:\n\tvoid Init( void )\n\t{\n\t\tmemset( rgWeapons, 0, sizeof rgWeapons );\n\t\tReset();\n\t}\n\n\tvoid Reset( void )\n\t{\n\t\tiOldWeaponBits = 0;\n\t\tmemset( rgSlots, 0, sizeof rgSlots );\n\t\tmemset( riAmmo, 0, sizeof riAmmo );\n\t}\n\n///// WEAPON /////\n\tint\t\t\tiOldWeaponBits;\n\n\tWEAPON *GetWeapon( int iId ) { return &rgWeapons[iId]; }\n\tvoid AddWeapon( WEAPON *wp ) \n\t{ \n\t\trgWeapons[ wp->iId ] = *wp;\t\n\t\tLoadWeaponSprites( &rgWeapons[ wp->iId ] );\n\t}\n\n\tvoid PickupWeapon( WEAPON *wp )\n\t{\n\t\trgSlots[ wp->iSlot ][ wp->iSlotPos ] = wp;\n\t}\n\n\tvoid PickupWeapon( int idx )\n\t{\n\t\tWEAPON *wp = &rgWeapons[ idx ];\n\t\tPickupWeapon( wp );\n\t}\n\n\tvoid DropWeapon( WEAPON *wp )\n\t{\n\t\trgSlots[ wp->iSlot ][ wp->iSlotPos ] = NULL;\n\t}\n\n\tvoid DropAllWeapons( void )\n\t{\n\t\tfor ( int i = 0; i < MAX_WEAPONS; i++ )\n\t\t{\n\t\t\tif ( rgWeapons[i].iId )\n\t\t\t\tDropWeapon( &rgWeapons[i] );\n\t\t}\n\t}\n\n\tWEAPON* GetWeaponSlot( int slot, int pos ) { return rgSlots[slot][pos]; }\n\n\tvoid LoadWeaponSprites( WEAPON* wp );\n\tvoid LoadAllWeaponSprites( void );\n\tWEAPON* GetFirstPos( int iSlot );\n\tvoid SelectSlot( int iSlot, int fAdvance, int iDirection );\n\tWEAPON* GetNextActivePos( int iSlot, int iSlotPos );\n\n\tint HasAmmo( WEAPON *p );\n\n///// AMMO /////\n\tAMMO GetAmmo( int iId ) { return iId; }\n\n\tvoid SetAmmo( int iId, int iCount ) { riAmmo[ iId ] = iCount;\t}\n\n\tint CountAmmo( int iId );\n\n\tHSPRITE* GetAmmoPicFromWeapon( int iAmmoId, wrect_t& rect );\n};\n\nextern WeaponsResource gWR;\n\n\n#define MAX_HISTORY 12\nenum {\n\tHISTSLOT_EMPTY,\n\tHISTSLOT_AMMO,\n\tHISTSLOT_WEAP,\n\tHISTSLOT_ITEM,\n};\n\nclass HistoryResource\n{\nprivate:\n\tstruct HIST_ITEM {\n\t\tint type;\n\t\tfloat DisplayTime;  // the time at which this item should be removed from the history\n\t\tint iCount;\n\t\tint iId;\n\t};\n\n\tHIST_ITEM rgAmmoHistory[MAX_HISTORY];\n\npublic:\n\n\tvoid Init( void )\n\t{\n\t\tReset();\n\t}\n\n\tvoid Reset( void )\n\t{\n\t\tmemset( rgAmmoHistory, 0, sizeof rgAmmoHistory );\n\t}\n\n\tint iHistoryGap;\n\tint iCurrentHistorySlot;\n\n\tvoid AddToHistory( int iType, int iId, int iCount = 0 );\n\tvoid AddToHistory( int iType, const char *szName, int iCount = 0 );\n\n\tvoid CheckClearHistory( void );\n\tint DrawAmmoHistory( float flTime );\n};\n\nextern HistoryResource gHR;\n\n\n\n"
  },
  {
    "path": "cl_dll/battery.cpp",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\t\n*\tThis product contains software technology licensed from Id \n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc. \n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n//\n// battery.cpp\n//\n// implementation of CHudBattery class\n//\n\n#include \"hud.h\"\n#include \"parsemsg.h\"\n#include \"cl_util.h\"\n#include \"draw_util.h\"\n\nint CHudBattery::Init( void )\n{\n\tm_iBat = 0;\n\tm_fFade = 0;\n\tm_iFlags = 0;\n\tm_enArmorType = Vest;\n\n\tHOOK_MESSAGE( gHUD.m_Battery, Battery );\n\tHOOK_MESSAGE( gHUD.m_Battery, ArmorType );\n\tgHUD.AddHudElem( this );\n\n\treturn 1;\n}\n\nint CHudBattery::VidInit( void )\n{\n\tm_hEmpty[Vest].SetSpriteByName(\"suit_empty\");\n\tm_hFull[Vest].SetSpriteByName(\"suit_full\");\n\tm_hEmpty[VestHelm].SetSpriteByName(\"suithelmet_empty\");\n\tm_hFull[VestHelm].SetSpriteByName(\"suithelmet_full\");\n\n\tm_iHeight = m_hFull[Vest].rect.Height();\n\tm_fFade = 0;\n\n\treturn 1;\n}\n\n\nint CHudBattery:: MsgFunc_Battery(const char *pszName, int iSize, void *pbuf )\n{\n\tBufferReader reader( pszName, pbuf, iSize );\n\n\tm_iFlags |= HUD_DRAW;\n\tint x = reader.ReadShort();\n\n\tif( x != m_iBat )\n\t{\n\t\tm_fFade = FADE_TIME;\n\t\tm_iBat = x;\n\t\tif( m_iBat < 0 )\n\t\t\tm_enArmorType = Vest;\n\t}\n\n\treturn 1;\n}\n\nint CHudBattery::Draw( float flTime )\n{\n\tif( gHUD.m_iHideHUDDisplay & HIDEHUD_HEALTH )\n\t\treturn 1;\n\n\tif (!(gHUD.m_iWeaponBits & (1<<(WEAPON_SUIT)) ))\n\t\treturn 1;\n\n\tint r, g, b, x, y, a;\n\twrect_t rc;\n\n\trc = m_hEmpty[m_enArmorType].rect;\n\n\t// battery can go from 0 to 100 so * 0.01 goes from 0 to 1\n\trc.top += m_iHeight * ((float)( 100 - ( min( 100, m_iBat ))) * 0.01f );\n\n\tDrawUtils::UnpackRGB( r, g, b, gHUD.m_iDefaultHUDColor );\n\n\t// Has health changed? Flash the health #\n\tif( m_fFade )\n\t{\n\t\tif( m_fFade > FADE_TIME )\n\t\t\tm_fFade = FADE_TIME;\n\n\t\tm_fFade -= (gHUD.m_flTimeDelta * 20);\n\n\t\tif( m_fFade <= 0 )\n\t\t{\n\t\t\tm_fFade = 0;\n\t\t}\n\n\t\t// Fade the health number back to dim\n\t\ta = MIN_ALPHA +  (m_fFade / FADE_TIME) * 128;\n\t}\n\telse\n\t{\n\t\ta = MIN_ALPHA;\n\t}\n\n\tDrawUtils::ScaleColors( r, g, b, a );\n\t\n\ty = ScreenHeight - gHUD.m_iFontHeight - gHUD.m_iFontHeight / 2;\n\tx = ScreenWidth / 5;\n\n\t// make sure we have the right sprite handles\n\tSPR_Set( m_hFull[m_enArmorType].spr, r, g, b );\n\tSPR_DrawAdditive( 0, x, y, &m_hFull[m_enArmorType].rect );\n\n\tif( rc.bottom > rc.top )\n\t{\n\t\tSPR_Set( m_hEmpty[m_enArmorType].spr, r, g, b );\n\t\tSPR_DrawAdditive( 0, x, y + (rc.top - m_hEmpty[m_enArmorType].rect.top), &rc );\n\t}\n\n\tx += (m_hEmpty[m_enArmorType].rect.Width());\n\tx = DrawUtils::DrawHudNumber( x, y, DHN_3DIGITS|DHN_DRAWZERO, m_iBat, r, g, b );\n\n\treturn 1;\n}\n\nint CHudBattery::MsgFunc_ArmorType(const char *pszName,  int iSize, void *pbuf )\n{\n\tBufferReader reader( pszName, pbuf, iSize );\n\n\tm_enArmorType = (armortype_t)reader.ReadByte();\n\n\treturn 1;\n}\n"
  },
  {
    "path": "cl_dll/buy_preset.cpp",
    "content": ""
  },
  {
    "path": "cl_dll/buy_preset_debug.cpp",
    "content": ""
  },
  {
    "path": "cl_dll/buy_preset_weapon_info.cpp",
    "content": ""
  },
  {
    "path": "cl_dll/buy_presets.cpp",
    "content": ""
  },
  {
    "path": "cl_dll/buy_presets.h",
    "content": ""
  },
  {
    "path": "cl_dll/cdll_int.cpp",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\t\n*\tThis product contains software technology licensed from Id \n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc. \n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n//\n//  cdll_int.c\n//\n// this implementation handles the linking of the engine to the DLL\n//\n\n#include \"hud.h\"\n#include \"cl_util.h\"\n#include \"netadr.h\"\n#include \"pmtrace.h\"\n\n#include \"pm_shared.h\"\n\n#include <string.h>\n#include \"interface.h\" // not used here\n#include \"render_api.h\"\n#include \"mobility_int.h\"\n#include \"vgui_parser.h\"\n\ncl_enginefunc_t\t\tgEngfuncs  = { };\nrender_api_t\t\tgRenderAPI = { };\nmobile_engfuncs_t\tgMobileAPI = { };\nCHud gHUD;\nint g_iXash = 0; // indicates a buildnum\nint g_iMobileAPIVersion = 0;\n\nvoid InitInput (void);\nvoid Game_HookEvents( void );\nvoid IN_Commands( void );\nvoid Input_Shutdown (void);\n\n/*\n========================== \n    Initialize\n\nCalled when the DLL is first loaded.\n==========================\n*/\nint DLLEXPORT Initialize( cl_enginefunc_t *pEnginefuncs, int iVersion )\n{\n\tif (iVersion != CLDLL_INTERFACE_VERSION)\n\t\treturn 0;\n\n\tgEngfuncs = *pEnginefuncs;\n\n\tsscanf( CVAR_GET_STRING( \"host_ver\" ), \"%d\", &g_iXash );\n\n\tGame_HookEvents();\n\n\treturn 1;\n}\n\n\n/*\n=============\nHUD_Shutdown\n\n=============\n*/\nvoid DLLEXPORT HUD_Shutdown( void )\n{\n\tgHUD.Shutdown();\n\tInput_Shutdown();\n\tLocalize_Free();\n}\n\n\n/*\n================================\nHUD_GetHullBounds\n\n  Engine calls this to enumerate player collision hulls, for prediction.  Return 0 if the hullnumber doesn't exist.\n================================\n*/\nint DLLEXPORT HUD_GetHullBounds( int hullnumber, float *mins, float *maxs )\n{\n\tint iret = 0;\n\n\tswitch ( hullnumber )\n\t{\n\tcase 0:\t\t\t\t// Normal player\n\t\tVector(-16, -16, -36).CopyToArray(mins);\n\t\tVector(16, 16, 36).CopyToArray(maxs);\n\t\tiret = 1;\n\t\tbreak;\n\tcase 1:\t\t\t\t// Crouched player\n\t\tVector(-16, -16, -18).CopyToArray(mins);\n\t\tVector(16, 16, 18).CopyToArray(maxs);\n\t\tiret = 1;\n\t\tbreak;\n\tcase 2:\t\t\t\t// Point based hull\n\t\tVector(0, 0, 0).CopyToArray(mins);\n\t\tVector(0, 0, 0).CopyToArray(maxs);\n\t\tiret = 1;\n\t\tbreak;\n\t}\n\n\treturn iret;\n}\n\n/*\n================================\nHUD_ConnectionlessPacket\n\n Return 1 if the packet is valid.  Set response_buffer_size if you want to send a response packet.  Incoming, it holds the max\n  size of the response_buffer, so you must zero it out if you choose not to respond.\n================================\n*/\nint\tDLLEXPORT HUD_ConnectionlessPacket( const struct netadr_s *net_from, const char *args, char *response_buffer, int *response_buffer_size )\n{\n\t// Parse stuff from args\n\t// int max_buffer_size = *response_buffer_size;\n\n\t// Zero it out since we aren't going to respond.\n\t// If we wanted to response, we'd write data into response_buffer\n\t*response_buffer_size = 0;\n\n\t// Since we don't listen for anything here, just respond that it's a bogus message\n\t// If we didn't reject the message, we'd return 1 for success instead.\n\treturn 0;\n}\n\nvoid DLLEXPORT HUD_PlayerMoveInit( struct playermove_s *ppmove )\n{\n\tPM_Init( ppmove );\n}\n\nchar DLLEXPORT HUD_PlayerMoveTexture( char *name )\n{\n\treturn PM_FindTextureType( name );\n}\n\nvoid DLLEXPORT HUD_PlayerMove( struct playermove_s *ppmove, int server )\n{\n\tPM_Move( ppmove, server );\n}\n\n#ifdef _CS16CLIENT_ENABLE_GSRC_SUPPORT\n/*\n=================\nHUD_GetRect\n\nVGui stub\n=================\n*/\nint *HUD_GetRect( void )\n{\n\tstatic int extent[4];\n\n\textent[0] = gEngfuncs.GetWindowCenterX() - ScreenWidth / 2;\n\textent[1] = gEngfuncs.GetWindowCenterY() - ScreenHeight / 2;\n\textent[2] = gEngfuncs.GetWindowCenterX() + ScreenWidth / 2;\n\textent[3] = gEngfuncs.GetWindowCenterY() + ScreenHeight / 2;\n\n\treturn extent;\n}\n#endif\n\n/*\n==========================\n\tHUD_VidInit\n\nCalled when the game initializes\nand whenever the vid_mode is changed\nso the HUD can reinitialize itself.\n==========================\n*/\n\nbool isLoaded = false;\n\nint DLLEXPORT HUD_VidInit( void )\n{\n\tgHUD.VidInit();\n\n\tisLoaded = true;\n\n\t//VGui_Startup();\n\n\treturn 1;\n}\n\n/*\n==========================\n\tHUD_Init\n\nCalled whenever the client connects\nto a server.  Reinitializes all \nthe hud variables.\n==========================\n*/\n\nvoid DLLEXPORT HUD_Init( void )\n{\n\tInitInput();\n\tgHUD.Init();\n\t//Scheme_Init();\n}\n\n\n/*\n==========================\n\tHUD_Redraw\n\ncalled every screen frame to\nredraw the HUD.\n===========================\n*/\n\nint DLLEXPORT HUD_Redraw( float time, int intermission )\n{\n\tgHUD.Redraw( time, intermission );\n\n\treturn 1;\n}\n\n\n/*\n==========================\n\tHUD_UpdateClientData\n\ncalled every time shared client\ndll/engine data gets changed,\nand gives the cdll a chance\nto modify the data.\n\nreturns 1 if anything has been changed, 0 otherwise.\n==========================\n*/\n\nint DLLEXPORT HUD_UpdateClientData(client_data_t *pcldata, float flTime )\n{\n\tIN_Commands();\n\n\treturn gHUD.UpdateClientData(pcldata, flTime );\n}\n\n/*\n==========================\n\tHUD_Reset\n\nCalled at start and end of demos to restore to \"non\"HUD state.\n==========================\n*/\n\nvoid DLLEXPORT HUD_Reset( void )\n{\n\tgHUD.VidInit();\n}\n\n/*\n==========================\nHUD_Frame\n\nCalled by engine every frame that client .dll is loaded\n==========================\n*/\n\nvoid DLLEXPORT HUD_Frame( double time )\n{\n#ifdef _CS16CLIENT_ENABLE_GSRC_SUPPORT\n\tgEngfuncs.VGui_ViewportPaintBackground(HUD_GetRect());\n#endif\n\n\tGetClientVoice()->Frame( time );\n}\n\n\n/*\n==========================\nHUD_VoiceStatus\n\nCalled when a player starts or stops talking.\n==========================\n*/\n\nvoid DLLEXPORT HUD_VoiceStatus(int entindex, qboolean bTalking)\n{\n\t// gHUD.m_Radio.Voice( entindex, bTalking );\n\n\tif ( entindex >= 0 && entindex < gEngfuncs.GetMaxClients() )\n\t{\n\t\tif ( bTalking )\n\t\t{\n\t\t\tg_PlayerExtraInfo[entindex].radarflashtime = gHUD.m_flTime;\n\t\t\tg_PlayerExtraInfo[entindex].radarflashes = 99999;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tg_PlayerExtraInfo[entindex].radarflashtime = -1.0f;\n\t\t\tg_PlayerExtraInfo[entindex].radarflashes = 0;\n\t\t}\n\t}\n\n\tGetClientVoice()->UpdateSpeakerStatus( entindex, bTalking );\n}\n\n/*\n==========================\nHUD_DirectorEvent\n\nCalled when a director event message was received\n==========================\n*/\n\nvoid DLLEXPORT HUD_DirectorMessage( int iSize, void *pbuf )\n{\n\t gHUD.m_Spectator.DirectorMessage( iSize, pbuf );\n}\n\n/*\n==========================\nHUD_GetRenderInterface\n\nCalled when Xash3D sends render api to us\n==========================\n*/\n\nint DLLEXPORT HUD_GetRenderInterface( int version, render_api_t *renderfuncs, render_interface_t *callback )\n{\n\tif( version != CL_RENDER_INTERFACE_VERSION )\n\t\treturn false;\n\n\tgRenderAPI = *renderfuncs;\n\n\t// we didn't send callbacks to engine, because we don't use it\n\t// *callback = renderInterface;\n\n\t// we have here a Host_Error, so check Xash for version\n\tif( g_iXash < MIN_XASH_VERSION )\n\t{\n\t\tgRenderAPI.Host_Error(\"Xash3D version check failed!\\nPlease update your Xash3D!\\n\");\n\t}\n\n\treturn true;\n}\n\n/*\n========================\nHUD_MobilityInterface\n========================\n*/\nint DLLEXPORT HUD_MobilityInterface( mobile_engfuncs_t *mobileapi )\n{\n\tif( mobileapi->version != MOBILITY_API_VERSION )\n\t{\n\t\tgEngfuncs.Con_Printf(\"Client Error: Mobile API version mismatch. Got: %i, want: %i\\n\",\n\t\t\tmobileapi->version, MOBILITY_API_VERSION);\n\n\t\tgRenderAPI.Host_Error(\"Xash3D Android version check failed!\\nPlease update your Xash3D Android!\\n\");\n\t\treturn 1;\n\t}\n\n\tg_iMobileAPIVersion = MOBILITY_API_VERSION;\n\tgMobileAPI = *mobileapi;\n\n#define TOUCH_ADDDEFAULT (*gMobileAPI.pfnTouchAddDefaultButton)\n\n\tgMobileAPI.pfnTouchResetDefaultButtons();\n\tunsigned char color[] = { 255, 255, 255, 150 };\n\tTOUCH_ADDDEFAULT( \"move\", \"\", \"_move\", 0.000000, 0.444444, 0.460000, 0.995556, color, 0, 0.673353, 0 );\n\tTOUCH_ADDDEFAULT( \"look\", \"\", \"_look\", 0.470000, 0.248889, 1.000000, 0.604444, color, 0, 0.377044, 0 );\n\tTOUCH_ADDDEFAULT( \"joy\", \"touch/gfx/joy\", \"_joy\", 0.290000, 0.187234, 0.410000, 0.400745, color, 0, 1.000000, 1 );\n\tTOUCH_ADDDEFAULT( \"dpad\", \"touch/gfx/dpad\", \"_dpad\", 0.170000, 0.187234, 0.290000, 0.400745, color, 0, 1.000000, 1 );\n\tTOUCH_ADDDEFAULT( \"invprev\", \"touch/gfx/left\", \"invprev\", 0.000000, 0.323404, 0.080000, 0.465745, color, 2, 1.000000, 1 );\n\tTOUCH_ADDDEFAULT( \"invnext\", \"touch/gfx/right\", \"invnext\", 0.080000, 0.323404, 0.160000, 0.465745, color, 2, 1.000000, 1 );\n\tTOUCH_ADDDEFAULT( \"reload\", \"touch/gfx/reload\", \"+reload\", 0.680000, 0.680851, 0.760000, 0.823192, color, 2, 1.000000, 0 );\n\tTOUCH_ADDDEFAULT( \"use\", \"touch/gfx/use\", \"+use\", 0.700000, 0.544681, 0.780000, 0.687022, color, 2, 1.000000, 0 );\n\tTOUCH_ADDDEFAULT( \"spraypaint\", \"touch/gfx/spraypaint\", \"impulse 201\", 0.700000, 0.817021, 0.780000, 0.959362, color, 2, 1.000000, 0 );\n\tTOUCH_ADDDEFAULT( \"drop\", \"touch/gfx/drop\", \"drop\", 0.780000, 0.868085, 0.860000, 1.010426, color, 2, 1.000000, 0 );\n\tTOUCH_ADDDEFAULT( \"jump\", \"touch/gfx/jump\", \"+jump\", 0.880000, 0.800000, 0.980000, 0.977926, color, 2, 1.000000, 0 );\n\tTOUCH_ADDDEFAULT( \"attack\", \"touch/gfx/attack\", \"+attack\", 0.760000, 0.612766, 0.910000, 0.879655, color, 2, 1.000000, 0 );\n\tTOUCH_ADDDEFAULT( \"attack2\", \"touch/gfx/attack2\", \"+attack2\", 0.900000, 0.578723, 1.000000, 0.756649, color, 2, 1.000000, 0 );\n\tTOUCH_ADDDEFAULT( \"w5\", \"touch/gfx/w_c4\", \"slot5\", 0.760000, 0.102128, 0.840000, 0.244469, color, 2, 1.000000, 0 );\n\tTOUCH_ADDDEFAULT( \"w1\", \"touch/gfx/w_rifle\", \"slot1\", 0.780000, 0.238298, 0.860000, 0.380639, color, 2, 1.000000, 0 );\n\tTOUCH_ADDDEFAULT( \"w2\", \"touch/gfx/w_pistol\", \"slot2\", 0.840000, 0.136170, 0.920000, 0.278511, color, 2, 1.000000, 0 );\n\tTOUCH_ADDDEFAULT( \"w4\", \"touch/gfx/w_grenade\", \"slot4\", 0.880000, 0.017021, 0.960000, 0.159362, color, 2, 1.000000, 0 );\n\tTOUCH_ADDDEFAULT( \"w3\", \"touch/gfx/w_knife\", \"slot3\", 0.920000, 0.136170, 1.000000, 0.278511, color, 2, 1.000000, 0 );\n\tTOUCH_ADDDEFAULT( \"flight\", \"touch/gfx/flaghtlight\", \"impulse 100\", 0.280000, 0.851064, 0.360000, 0.993405, color, 2, 1.000000, 1 );\n\tTOUCH_ADDDEFAULT( \"light\", \"touch/gfx/light\", \"toggle_light\", 0.360000, 0.851064, 0.440000, 0.993405, color, 2, 1.000000, 0 );\n\tTOUCH_ADDDEFAULT( \"buy\", \"touch/gfx/buy\", \"buy\", 0.440000, 0.851064, 0.520000, 0.993405, color, 2, 1.000000, 0 );\n\tTOUCH_ADDDEFAULT( \"score\", \"touch/gfx/score\", \"scoreboard\", 0.520000, 0.851064, 0.600000, 0.993405, color, 2, 1.000000, 0 );\n\tTOUCH_ADDDEFAULT( \"nightvision\", \"touch/gfx/nightvision\", \"nightvision;toggle_plusminus\", 0.360000, 0.714894, 0.440000, 0.857235, color, 2, 1.000000, 1 );\n\tTOUCH_ADDDEFAULT( \"minus_nvg\", \"touch/gfx/minus\", \"nvgadjustdown\", 0.340000, 0.629787, 0.400000, 0.736543, color, 2, 1.000000, 1 );\n\tTOUCH_ADDDEFAULT( \"plus_nvg\", \"touch/gfx/plus\", \"nvgadjustup\", 0.400000, 0.629787, 0.460000, 0.736543, color, 2, 1.000000, 1 );\n\tTOUCH_ADDDEFAULT( \"numbers\", \"touch_default/show_weapons\", \"exec touch_default/numbers.cfg\", 0.440000, 0.714894, 0.520000, 0.857235, color, 2, 1.000000, 1 );\n\tTOUCH_ADDDEFAULT( \"duck\", \"touch/gfx/duck\", \"+duck\", 0.000000, 0.817021, 0.100000, 0.994947, color, 2, 1.000000, 512 );\n\tTOUCH_ADDDEFAULT( \"duck_sw\", \"touch/gfx/duck\", \"crouchtoggle\", 0.100000, 0.817021, 0.200000, 0.994947, color, 2, 1.000000, 1 );\n\tTOUCH_ADDDEFAULT( \"change_team\", \"touch/gfx/change_team\", \"chooseteam\", 0.540000, 0.000000, 0.620000, 0.142341, color, 2, 1.000000, 0 );\n\tTOUCH_ADDDEFAULT( \"exit\", \"touch/gfx/exit\", \"cancelselect\", 0.460000, 0.000000, 0.540000, 0.142341, color, 2, 1.000000, 0 );\n\tTOUCH_ADDDEFAULT( \"touch_edit\", \"touch/gfx/settings\", \"touch_enableedit\", 0.380000, 0.000000, 0.460000, 0.142341, color, 2, 1.000000, 0 );\n\tTOUCH_ADDDEFAULT( \"cmd\", \"touch/gfx/cmdmenu\", \"exec touch/cmd/cmd\", 0.100000, 0.248889, 0.200000, 0.426815, color, 2, 1.000000, 1 );\n\tTOUCH_ADDDEFAULT( \"radio\", \"touch/gfx/radio\", \"showvguimenu 38\", 0.000000, 0.248889, 0.100000, 0.426815, color, 2, 1.000000, 0 );\n\tTOUCH_ADDDEFAULT( \"walk\", \"touch/gfx/walk\", \"+speed\", 0.000000, 0.640000, 0.100000, 0.817926, color, 2, 1.000000, 0 );\n\n\treturn 0;\n}\n\nextern \"C\" void DLLEXPORT HUD_ChatInputPosition( int *x, int *y )\n{\n}\n\nextern \"C\" int DLLEXPORT HUD_GetPlayerTeam(int iplayer)\n{\n\t// original seems to return team_id, but I'm not sure it's even set somewhere\n\tif ( iplayer <= MAX_PLAYERS )\n\t\treturn g_PlayerExtraInfo[iplayer].teamnumber;\n\treturn 0;\n}\n\n#include \"APIProxy.h\"\n\ncldll_func_dst_t *g_pcldstAddrs;\n\nextern \"C\" void DLLEXPORT F(void *pv)\n{\n\tcldll_func_t *pcldll_func = (cldll_func_t *)pv;\n\n\t// Hack!\n\tg_pcldstAddrs = ((cldll_func_dst_t *)pcldll_func->pHudVidInitFunc);\n\n\tcldll_func_t cldll_func =\n\t{\n\tInitialize,\n\tHUD_Init,\n\tHUD_VidInit,\n\tHUD_Redraw,\n\tHUD_UpdateClientData,\n\tHUD_Reset,\n\tHUD_PlayerMove,\n\tHUD_PlayerMoveInit,\n\tHUD_PlayerMoveTexture,\n\tIN_ActivateMouse,\n\tIN_DeactivateMouse,\n\tIN_MouseEvent,\n\tIN_ClearStates,\n\tIN_Accumulate,\n\tCL_CreateMove,\n\tCL_IsThirdPerson,\n\tCL_CameraOffset,\n\tKB_Find,\n\tCAM_Think,\n\tV_CalcRefdef,\n\tHUD_AddEntity,\n\tHUD_CreateEntities,\n\tHUD_DrawNormalTriangles,\n\tHUD_DrawTransparentTriangles,\n\tHUD_StudioEvent,\n\tHUD_PostRunCmd,\n\tHUD_Shutdown,\n\tHUD_TxferLocalOverrides,\n\tHUD_ProcessPlayerState,\n\tHUD_TxferPredictionData,\n\tDemo_ReadBuffer,\n\tHUD_ConnectionlessPacket,\n\tHUD_GetHullBounds,\n\tHUD_Frame,\n\tHUD_Key_Event,\n\tHUD_TempEntUpdate,\n\tHUD_GetUserEntity,\n\tHUD_VoiceStatus,\n\tHUD_DirectorMessage,\n\tHUD_GetStudioModelInterface,\n\tHUD_ChatInputPosition,\n\tHUD_GetPlayerTeam,\n\tNULL\n\t};\n\n\t*pcldll_func = cldll_func;\n}\n\n#include \"cl_dll/IGameClientExports.h\"\n\n//-----------------------------------------------------------------------------\n// Purpose: Exports functions that are used by the gameUI for UI dialogs\n//-----------------------------------------------------------------------------\nclass CClientExports : public IGameClientExports\n{\npublic:\n\t// returns the name of the server the user is connected to, if any\n\tvirtual const char *GetServerHostName()\n\t{\n\t\treturn gHUD.m_szServerName;\n\t}\n\n\t// ingame voice manipulation\n\tvirtual bool IsPlayerGameVoiceMuted( int playerIndex )\n\t{\n\t\tif ( GetClientVoice() )\n\t\t\treturn GetClientVoice()->IsPlayerBlocked( playerIndex );\n\n\t\treturn false;\n\t}\n\n\tvirtual void MutePlayerGameVoice( int playerIndex )\n\t{\n\t\tif ( GetClientVoice() )\n\t\t{\n\t\t\tGetClientVoice()->SetPlayerBlockedState( playerIndex, true );\n\t\t}\n\t}\n\n\tvirtual void UnmutePlayerGameVoice( int playerIndex )\n\t{\n\t\tif ( GetClientVoice() )\n\t\t{\n\t\t\tGetClientVoice()->SetPlayerBlockedState( playerIndex, false );\n\t\t}\n\t}\n};\n\nEXPOSE_SINGLE_INTERFACE(CClientExports, IGameClientExports, GAMECLIENTEXPORTS_INTERFACE_VERSION)\n\n"
  },
  {
    "path": "cl_dll/cl_dll.dsp",
    "content": "# Microsoft Developer Studio Project File - Name=\"cl_dll\" - Package Owner=<4>\r\n# Microsoft Developer Studio Generated Build File, Format Version 6.00\r\n# ** DO NOT EDIT **\r\n\r\n# TARGTYPE \"Win32 (x86) Dynamic-Link Library\" 0x0102\r\n\r\nCFG=cl_dll - Win32 Release\r\n!MESSAGE This is not a valid makefile. To build this project using NMAKE,\r\n!MESSAGE use the Export Makefile command and run\r\n!MESSAGE \r\n!MESSAGE NMAKE /f \"cl_dll.mak\".\r\n!MESSAGE \r\n!MESSAGE You can specify a configuration when running NMAKE\r\n!MESSAGE by defining the macro CFG on the command line. For example:\r\n!MESSAGE \r\n!MESSAGE NMAKE /f \"cl_dll.mak\" CFG=\"cl_dll - Win32 Release\"\r\n!MESSAGE \r\n!MESSAGE Possible choices for configuration are:\r\n!MESSAGE \r\n!MESSAGE \"cl_dll - Win32 Release\" (based on \"Win32 (x86) Dynamic-Link Library\")\r\n!MESSAGE \"cl_dll - Win32 Debug\" (based on \"Win32 (x86) Dynamic-Link Library\")\r\n!MESSAGE \r\n\r\n# Begin Project\r\n# PROP AllowPerConfigDependencies 0\r\n# PROP Scc_ProjName \"\"\r\n# PROP Scc_LocalPath \"\"\r\nCPP=cl.exe\r\nMTL=midl.exe\r\nRSC=rc.exe\r\n\r\n!IF  \"$(CFG)\" == \"cl_dll - Win32 Release\"\r\n\r\n# PROP BASE Use_MFC 0\r\n# PROP BASE Use_Debug_Libraries 0\r\n# PROP BASE Output_Dir \".\\Release\"\r\n# PROP BASE Intermediate_Dir \".\\Release\"\r\n# PROP BASE Target_Dir \"\"\r\n# PROP Use_MFC 0\r\n# PROP Use_Debug_Libraries 0\r\n# PROP Output_Dir \".\\Release\"\r\n# PROP Intermediate_Dir \".\\Release\"\r\n# PROP Ignore_Export_Lib 0\r\n# PROP Target_Dir \"\"\r\n# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D \"WIN32\" /D \"NDEBUG\" /D \"_WINDOWS\" /YX /c\r\n# ADD CPP /nologo /MT /W3 /GX /Zi /O2 /I \"..\\utils\\vgui\\include\" /I \"..\\engine\" /I \"..\\common\" /I \"..\\pm_shared\" /I \"..\\dlls\" /D \"WIN32\" /D \"NDEBUG\" /D \"_WINDOWS\" /D \"CLIENT_DLL\" /D \"CLIENT_WEAPONS\" /YX /FD /c\r\n# ADD BASE MTL /nologo /D \"NDEBUG\" /win32\r\n# ADD MTL /nologo /D \"NDEBUG\" /mktyplib203 /win32\r\n# ADD BASE RSC /l 0x409 /d \"NDEBUG\"\r\n# ADD RSC /l 0x409 /d \"NDEBUG\"\r\nBSC32=bscmake.exe\r\n# ADD BASE BSC32 /nologo\r\n# ADD BSC32 /nologo\r\nLINK32=link.exe\r\n# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386\r\n# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib winmm.lib ../utils/vgui/lib/win32_vc6/vgui.lib wsock32.lib /nologo /subsystem:windows /dll /map /machine:I386 /out:\".\\Release\\client.dll\"\r\n\r\n!ELSEIF  \"$(CFG)\" == \"cl_dll - Win32 Debug\"\r\n\r\n# PROP BASE Use_MFC 0\r\n# PROP BASE Use_Debug_Libraries 1\r\n# PROP BASE Output_Dir \".\\Debug\"\r\n# PROP BASE Intermediate_Dir \".\\Debug\"\r\n# PROP BASE Target_Dir \"\"\r\n# PROP Use_MFC 0\r\n# PROP Use_Debug_Libraries 1\r\n# PROP Output_Dir \".\\Debug\"\r\n# PROP Intermediate_Dir \".\\Debug\"\r\n# PROP Ignore_Export_Lib 0\r\n# PROP Target_Dir \"\"\r\n# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D \"WIN32\" /D \"_DEBUG\" /D \"_WINDOWS\" /YX /c\r\n# ADD CPP /nologo /G5 /MTd /W3 /Gm /GR /GX /ZI /Od /I \"..\\dlls\" /I \"..\\common\" /I \"..\\pm_shared\" /I \"..\\engine\" /I \"..\\utils\\vgui\\include\" /I \"..\\game_shared\" /D \"_DEBUG\" /D \"_MBCS\" /D \"WIN32\" /D \"_WINDOWS\" /D \"CLIENT_DLL\" /D \"CLIENT_WEAPONS\" /FR /YX /FD /c\r\n# ADD BASE MTL /nologo /D \"_DEBUG\" /win32\r\n# ADD MTL /nologo /D \"_DEBUG\" /mktyplib203 /win32\r\n# ADD BASE RSC /l 0x409 /d \"_DEBUG\"\r\n# ADD RSC /l 0x409 /d \"_DEBUG\"\r\nBSC32=bscmake.exe\r\n# ADD BASE BSC32 /nologo\r\n# ADD BSC32 /nologo\r\nLINK32=link.exe\r\n# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386\r\n# ADD LINK32 oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib winmm.lib ../utils/vgui/lib/win32_vc6/vgui.lib wsock32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /out:\".\\Debug\\client.dll\"\r\n\r\n!ENDIF \r\n\r\n# Begin Target\r\n\r\n# Name \"cl_dll - Win32 Release\"\r\n# Name \"cl_dll - Win32 Debug\"\r\n# Begin Group \"Source Files\"\r\n\r\n# PROP Default_Filter \"cpp;c;cxx;rc;def;r;odl;idl;hpj;bat;for;f90\"\r\n# Begin Group \"hl\"\r\n\r\n# PROP Default_Filter \"*.CPP\"\r\n# Begin Source File\r\n\r\nSOURCE=..\\dlls\\crossbow.cpp\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=..\\dlls\\crowbar.cpp\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=..\\dlls\\egon.cpp\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=.\\ev_hldm.cpp\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=..\\dlls\\gauss.cpp\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=..\\dlls\\handgrenade.cpp\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=.\\hl\\hl_baseentity.cpp\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=.\\hl\\hl_events.cpp\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=.\\hl\\hl_objects.cpp\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=.\\hl\\hl_weapons.cpp\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=..\\dlls\\wpn_shared\\hl_wpn_glock.cpp\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=..\\dlls\\hornetgun.cpp\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=..\\common\\interface.cpp\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=..\\dlls\\mp5.cpp\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=..\\dlls\\python.cpp\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=..\\dlls\\rpg.cpp\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=..\\dlls\\satchel.cpp\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=..\\dlls\\shotgun.cpp\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=..\\dlls\\squeakgrenade.cpp\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=..\\dlls\\tripmine.cpp\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=..\\game_shared\\vgui_scrollbar2.cpp\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=..\\game_shared\\vgui_slider2.cpp\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=..\\game_shared\\voice_banmgr.cpp\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=..\\game_shared\\voice_status.cpp\r\n# End Source File\r\n# End Group\r\n# Begin Source File\r\n\r\nSOURCE=.\\ammo.cpp\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=.\\ammo_secondary.cpp\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=.\\ammohistory.cpp\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=.\\battery.cpp\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=.\\cdll_int.cpp\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=.\\com_weapons.cpp\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=.\\death.cpp\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=.\\demo.cpp\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=.\\entity.cpp\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=.\\ev_common.cpp\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=.\\events.cpp\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=.\\flashlight.cpp\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=.\\GameStudioModelRenderer.cpp\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=.\\geiger.cpp\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=.\\health.cpp\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=.\\hud.cpp\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=.\\hud_msg.cpp\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=.\\hud_redraw.cpp\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=.\\hud_servers.cpp\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=.\\hud_spectator.cpp\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=.\\hud_update.cpp\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=.\\in_camera.cpp\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=.\\input.cpp\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=.\\inputw32.cpp\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=.\\menu.cpp\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=.\\message.cpp\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=.\\overview.cpp\r\n# PROP Exclude_From_Build 1\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=.\\parsemsg.cpp\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=.\\parsemsg.h\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=..\\pm_shared\\pm_debug.c\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=..\\pm_shared\\pm_math.c\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=..\\pm_shared\\pm_shared.c\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=.\\saytext.cpp\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=.\\status_icons.cpp\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=.\\statusbar.cpp\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=.\\studio_util.cpp\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=.\\StudioModelRenderer.cpp\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=.\\text_message.cpp\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=.\\train.cpp\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=.\\tri.cpp\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=.\\util.cpp\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=..\\game_shared\\vgui_checkbutton2.cpp\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=.\\vgui_ClassMenu.cpp\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=.\\vgui_ConsolePanel.cpp\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=.\\vgui_ControlConfigPanel.cpp\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=.\\vgui_CustomObjects.cpp\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=..\\game_shared\\vgui_grid.cpp\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=..\\game_shared\\vgui_helpers.cpp\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=.\\vgui_int.cpp\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=..\\game_shared\\vgui_listbox.cpp\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=..\\game_shared\\vgui_loadtga.cpp\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=.\\vgui_MOTDWindow.cpp\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=.\\vgui_SchemeManager.cpp\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=.\\vgui_ScorePanel.cpp\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=.\\vgui_ServerBrowser.cpp\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=.\\vgui_SpectatorPanel.cpp\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=.\\vgui_TeamFortressViewport.cpp\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=.\\vgui_teammenu.cpp\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=.\\view.cpp\r\n# End Source File\r\n# End Group\r\n# Begin Group \"Header Files\"\r\n\r\n# PROP Default_Filter \"h;hpp;hxx;hm;inl;fi;fd\"\r\n# Begin Source File\r\n\r\nSOURCE=.\\ammo.h\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=.\\ammohistory.h\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=.\\camera.h\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=.\\cl_dll.h\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=.\\com_weapons.h\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=.\\demo.h\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=.\\ev_hldm.h\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=.\\eventscripts.h\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=.\\GameStudioModelRenderer.h\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=.\\health.h\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=.\\hud.h\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=.\\hud_iface.h\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=.\\hud_servers.h\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=.\\hud_servers_priv.h\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=.\\hud_spectator.h\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=.\\in_defs.h\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=..\\common\\itrackeruser.h\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=.\\kbutton.h\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=.\\overview.h\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=..\\pm_shared\\pm_debug.h\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=..\\pm_shared\\pm_defs.h\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=..\\pm_shared\\pm_info.h\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=..\\pm_shared\\pm_materials.h\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=..\\pm_shared\\pm_movevars.h\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=..\\pm_shared\\pm_shared.h\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=.\\studio_util.h\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=.\\StudioModelRenderer.h\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=.\\util.h\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=.\\util_vector.h\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=.\\vgui_ConsolePanel.h\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=.\\vgui_ControlConfigPanel.h\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=.\\vgui_int.h\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=.\\vgui_SchemeManager.h\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=.\\vgui_ScorePanel.h\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=.\\vgui_ServerBrowser.h\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=.\\vgui_SpectatorPanel.h\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=.\\vgui_TeamFortressViewport.h\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=.\\view.h\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=..\\game_shared\\voice_banmgr.h\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=..\\game_shared\\voice_status.h\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=..\\game_shared\\voice_vgui_tweakdlg.h\r\n# End Source File\r\n# Begin Source File\r\n\r\nSOURCE=.\\wrect.h\r\n# End Source File\r\n# End Group\r\n# Begin Group \"Resource Files\"\r\n\r\n# PROP Default_Filter \"ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe\"\r\n# End Group\r\n# End Target\r\n# End Project\r\n"
  },
  {
    "path": "cl_dll/cl_util.h",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\t\n*\tThis product contains software technology licensed from Id \n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc. \n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n//\n// cl_util.h\n//\n#pragma once\n#include \"cvardef.h\"\n#ifndef TRUE\n#define TRUE 1\n#define FALSE 0\n#endif\n\nextern cvar_t *hud_textmode;\n\n#ifdef _MSC_VER\n#pragma warning(disable : 4244) // 'argument': conversion from 'float' to 'int', possible loss of data\n#pragma warning(disable : 4101) // unreferenced local variable\n#endif\n\n// Macros to hook function calls into the HUD object\n#define HOOK_MESSAGE_FUNC(name, func) gEngfuncs.pfnHookUserMsg(name, [](const char *pszName, int iSize, void *pbuf) \\\n{\\\n\treturn func(pszName, iSize, pbuf);\\\n})\n#define HOOK_MESSAGE(obj, name) HOOK_MESSAGE_FUNC( #name, obj.MsgFunc_##name )\n\n#define HOOK_COMMAND_FUNC(str, func, ...) gEngfuncs.pfnAddCommand( str, [](void) { func(__VA_ARGS__); })\n#define HOOK_COMMAND(obj, str, func) HOOK_COMMAND_FUNC( str, obj.UserCmd_##func, )\n\ninline float CVAR_GET_FLOAT( const char *x ) {\treturn gEngfuncs.pfnGetCvarFloat( (char*)x ); }\ninline char* CVAR_GET_STRING( const char *x ) {\treturn gEngfuncs.pfnGetCvarString( (char*)x ); }\ninline struct cvar_s *CVAR_CREATE( const char *cv, const char *val, const int flags ) {\treturn gEngfuncs.pfnRegisterVariable( (char*)cv, (char*)val, flags ); }\n\n#define SPR_Load (*gEngfuncs.pfnSPR_Load)\n#define SPR_Set (*gEngfuncs.pfnSPR_Set)\n#define SPR_Frames (*gEngfuncs.pfnSPR_Frames)\n#define SPR_GetList (*gEngfuncs.pfnSPR_GetList)\n\n// SPR_Draw  draws a the current sprite as solid\n#define SPR_Draw (*gEngfuncs.pfnSPR_Draw)\n// SPR_DrawHoles  draws the current sprites,  with color index255 not drawn (transparent)\n#define SPR_DrawHoles (*gEngfuncs.pfnSPR_DrawHoles)\n// SPR_DrawAdditive  adds the sprites RGB values to the background  (additive transulency)\n#define SPR_DrawAdditive (*gEngfuncs.pfnSPR_DrawAdditive)\n\n// SPR_EnableScissor  sets a clipping rect for HUD sprites.  (0,0) is the top-left hand corner of the screen.\n#define SPR_EnableScissor (*gEngfuncs.pfnSPR_EnableScissor)\n// SPR_DisableScissor  disables the clipping rect\n#define SPR_DisableScissor (*gEngfuncs.pfnSPR_DisableScissor)\n//\n#define FillRGBA (*gEngfuncs.pfnFillRGBA)\n#define FillRGBABlend (*gEngfuncs.pfnFillRGBABlend)\n\n\n// ScreenHeight returns the height of the screen, in pixels\n#define ScreenHeight (gHUD.m_scrinfo.iHeight)\n// ScreenWidth returns the width of the screen, in pixels\n#define ScreenWidth (gHUD.m_scrinfo.iWidth)\n\n#define TrueHeight (gHUD.m_truescrinfo.iHeight)\n#define TrueWidth (gHUD.m_truescrinfo.iWidth)\n\n// Use this to set any co-ords in 640x480 space\n#define XRES(x)\t\t((int)(float(x)  * ((float)ScreenWidth / 640.0f) + 0.5f))\n#define YRES(y)\t\t((int)(float(y)  * ((float)ScreenHeight / 480.0f) + 0.5f))\n\n// use this to project world coordinates to screen coordinates\n#define XPROJECT(x)\t( (1.0f+(x))*ScreenWidth*0.5f )\n#define YPROJECT(y) ( (1.0f-(y))*ScreenHeight*0.5f )\n\n#define GetScreenInfo (*gEngfuncs.pfnGetScreenInfo)\n#define ServerCmd (*gEngfuncs.pfnServerCmd)\n#define ClientCmd (*gEngfuncs.pfnClientCmd)\n#define FilteredClientCmd (*gEngfuncs.pfnFilteredClientCmd)\n#define AngleVectors (*gEngfuncs.pfnAngleVectors)\n#define Com_RandomLong (*gEngfuncs.pfnRandomLong)\n#define Com_RandomFloat (*gEngfuncs.pfnRandomFloat)\n\nextern float color[3]; // hud.cpp\n\n\n// Gets the height & width of a sprite,  at the specified frame\ninline int SPR_Height( HSPRITE x, int f = 0 )\n{\n\treturn gEngfuncs.pfnSPR_Height(x, f);\n}\ninline int SPR_Width( HSPRITE x, int f = 0 )\n{\n\treturn gEngfuncs.pfnSPR_Width(x, f);\n}\n\ninline client_textmessage_t *TextMessageGet( const char *pName )\n{\n\treturn gEngfuncs.pfnTextMessageGet( pName );\n}\n\ninline void ConsolePrint( const char *string )\n{\n\tgEngfuncs.pfnConsolePrint( string );\n}\n\ninline void CenterPrint( const char *string )\n{\n\tgEngfuncs.pfnCenterPrint( string );\n}\n\n// returns the players name of entity no.\n#define GetPlayerInfo (*gEngfuncs.pfnGetPlayerInfo)\n\n// sound functions\ninline void PlaySound( const char *szSound, float vol ) { gEngfuncs.pfnPlaySoundByName( szSound, vol ); }\ninline void PlaySound( int iSound, float vol ) { gEngfuncs.pfnPlaySoundByIndex( iSound, vol ); }\n\n#define max(a, b)  (((a) > (b)) ? (a) : (b))\n#define min(a, b)  (((a) < (b)) ? (a) : (b))\n#if !defined(__APPLE__) && !defined(_WIN32)\n#define fabs(x)\t   ((x) > 0 ? (x) : 0 - (x))\n#endif\n#define DotProduct(x,y) ((x)[0]*(y)[0]+(x)[1]*(y)[1]+(x)[2]*(y)[2])\n#define VectorSubtract(a,b,c) {(c)[0]=(a)[0]-(b)[0];(c)[1]=(a)[1]-(b)[1];(c)[2]=(a)[2]-(b)[2];}\n#define VectorAdd(a,b,c) {(c)[0]=(a)[0]+(b)[0];(c)[1]=(a)[1]+(b)[1];(c)[2]=(a)[2]+(b)[2];}\n#define VectorCopy(a,b) {(b)[0]=(a)[0];(b)[1]=(a)[1];(b)[2]=(a)[2];}\ninline void VectorClear(float *a) { a[0]=0.0;a[1]=0.0;a[2]=0.0;}\n#define DotProduct(x,y) ((x)[0]*(y)[0]+(x)[1]*(y)[1]+(x)[2]*(y)[2])\n#define VectorLength(a) ( sqrt( DotProduct( a, a )))\n#define VectorMA(a, scale, b, c) ((c)[0] = (a)[0] + (scale) * (b)[0],(c)[1] = (a)[1] + (scale) * (b)[1],(c)[2] = (a)[2] + (scale) * (b)[2])\n#define VectorScale(in, scale, out) ((out)[0] = (in)[0] * (scale),(out)[1] = (in)[1] * (scale),(out)[2] = (in)[2] * (scale))\nfloat VectorNormalize (float *v);\n#define VectorInverse(x) ((x)[0] = -(x)[0], (x)[1] = -(x)[1], (x)[2] = -(x)[2])\n\nextern float vec3_origin[3];\n\n#ifdef _MSC_VER\n// disable 'possible loss of data converting float to int' warning message\n#pragma warning( disable: 4244 )\n// disable 'truncation from 'const double' to 'float' warning message\n#pragma warning( disable: 4305 )\n#endif\n\nfloat *GetClientColor( int clientIndex );\ninline HSPRITE LoadSprite(const char *pszName)\n{\n\tchar sz[256];\n\tsnprintf(sz, 256, pszName, 640);\n\n\treturn SPR_Load(sz);\n}\n\nextern vec3_t g_ColorRed, g_ColorBlue, g_ColorYellow, g_ColorGrey, g_ColorGreen;\n\ninline void GetTeamColor( int &r, int &g, int &b, int teamIndex )\n{\n\tr = 255;\n\tg = 255;\n\tb = 255;\n\tswitch( teamIndex )\n\t{\n\tcase TEAM_TERRORIST:\n\t\tr *= g_ColorRed[0];\n\t\tg *= g_ColorRed[1];\n\t\tb *= g_ColorRed[2];\n\t\tbreak;\n\tcase TEAM_CT:\n\t\tr *= g_ColorBlue[0];\n\t\tg *= g_ColorBlue[1];\n\t\tb *= g_ColorBlue[2];\n\t\tbreak;\n\tcase TEAM_SPECTATOR:\n\tcase TEAM_UNASSIGNED:\n\t\tr *= g_ColorYellow[0];\n\t\tg *= g_ColorYellow[1];\n\t\tb *= g_ColorYellow[2];\n\t\tbreak;\n\tdefault:\n\t\tr *= g_ColorGrey[0];\n\t\tg *= g_ColorGrey[1];\n\t\tb *= g_ColorGrey[2];\n\t\tbreak;\n\t}\n}\n\n#define bound( min, num, max ) ((num) >= (min) ? ((num) < (max) ? (num) : (max)) : (min))\n#define RAD2DEG( x )\t((float)(x) * (float)(180.f / M_PI))\n#define DEG2RAD( x )\t((float)(x) * (float)(M_PI / 180.f))\n\nenum\n{\n\tGAME_CSTRIKE = 0, // 1.6\n\tGAME_CZERO = 1,   // czero\n\tGAME_CZERODS = 2  // ritual czero\n};\n"
  },
  {
    "path": "cl_dll/com_weapons.cpp",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\t\n*\tThis product contains software technology licensed from Id \n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc. \n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n\n// Com_Weapons.cpp\n// Shared weapons common/shared functions\n#include <stdarg.h>\n#include \"hud.h\"\n#include \"cl_util.h\"\n#include \"com_weapons.h\"\n\n#include \"const.h\"\n#include \"entity_state.h\"\n#include \"r_efx.h\"\n\n// g_runfuncs is true if this is the first time we've \"predicated\" a particular movement/firing\n//  command.  If it is 1, then we should play events/sounds etc., otherwise, we just will be\n//  updating state info, but not firing events\nint\tg_runfuncs = 0;\n\n// During our weapon prediction processing, we'll need to reference some data that is part of\n//  the final state passed into the postthink functionality.  We'll set this pointer and then\n//  reset it to NULL as appropriate\nstruct local_state_s *g_finalstate = NULL;\n\n/*\n====================\nCOM_Log\n\nLog debug messages to file ( appends )\n====================\n*/\nvoid COM_Log( char *pszFile, char *fmt, ...)\n{\n\tva_list\t\targptr;\n\tchar\t\tstring[1024];\n\tFILE *fp;\n\tconst char *pfilename;\n\t\n\tif ( !pszFile )\n\t{\n\t\tpfilename = \"c:\\\\hllog.txt\";\n\t}\n\telse\n\t{\n\t\tpfilename = pszFile;\n\t}\n\n\tva_start (argptr,fmt);\n\tvsprintf (string, fmt,argptr);\n\tva_end (argptr);\n\n\tfp = fopen( pfilename, \"a+t\");\n\tif (fp)\n\t{\n\t\tfprintf(fp, \"%s\", string);\n\t\tfclose(fp);\n\t}\n}\n\n// remember the current animation for the view model, in case we get out of sync with\n//  server.\nstatic int g_currentanim;\nstatic int g_currentweapon;\n\n/*\n=====================\nHUD_SendWeaponAnim\n\nChange weapon model animation\n=====================\n*/\nvoid HUD_SendWeaponAnim( int iAnim, int iWeaponId, int iBody, int iForce )\n{\n\tif( g_runfuncs || iForce )\n\t{\n\t\tg_currentanim = iAnim;\n\t\tg_currentweapon = iWeaponId;\n\n\t\t// Tell animation system new info\n\t\tgEngfuncs.pfnWeaponAnim( iAnim, iBody );\n\t}\n}\n\n/*\n=====================\nHUD_GetWeaponAnim\n\nRetrieve current predicted weapon animation\n=====================\n*/\nint HUD_GetWeaponAnim( void )\n{\n\treturn g_currentanim;\n}\n\n/*\n=====================\nHUD_GetWeapon\n\nRetrieve current predicted weapon id\n=====================\n*/\nint HUD_GetWeapon( void )\n{\n\treturn g_currentweapon;\n}\n\n/*\n=====================\nHUD_PlaySound\n\nPlay a sound, if we are seeing this command for the first time\n=====================\n*/\nvoid HUD_PlaySound( char *sound, float volume )\n{\n\tif ( !g_runfuncs || !g_finalstate )\n\t\treturn;\n\n\tgEngfuncs.pfnPlaySoundByNameAtLocation( sound, volume, (float *)&g_finalstate->playerstate.origin );\n}\n\n/*\n=====================\nHUD_PlaybackEvent\n\nDirectly queue up an event on the client\n=====================\n*/\nvoid HUD_PlaybackEvent( int flags, const edict_t *pInvoker, unsigned short eventindex, float delay,\n\tfloat *origin, float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2 )\n{\n\tif ( !g_runfuncs || !g_finalstate )\n\t     return;\n\n\tVector org;\n\tVector ang;\n\n\t// Weapon prediction events are assumed to occur at the player's origin\n\torg\t= g_finalstate->playerstate.origin;\n\tang\t= v_angles;\n\tgEngfuncs.pfnPlaybackEvent( flags, pInvoker, eventindex, delay, org, ang,\n\t\t\t\t\t\t\t\tfparam1, fparam2,\n\t\t\t\t\t\t\t\tiparam1, iparam2,\n\t\t\t\t\t\t\t\tbparam1, bparam2 );\n}\n\n/*\n=====================\nUTIL_WeaponTimeBase\n\nAlways 0.0 on client, even if not predicting weapons ( won't get called\n in that case )\n=====================\n*/\n/*\nmoved in util.h\n\nfloat UTIL_WeaponTimeBase( void )\n{\n\treturn 0.0;\n}\n*/\n\nstatic unsigned int glSeed = 0; \n\nunsigned int seed_table[ 256 ] =\n{\n\t28985, 27138, 26457, 9451, 17764, 10909, 28790, 8716, 6361, 4853, 17798, 21977, 19643, 20662, 10834, 20103,\n\t27067, 28634, 18623, 25849, 8576, 26234, 23887, 18228, 32587, 4836, 3306, 1811, 3035, 24559, 18399, 315,\n\t26766, 907, 24102, 12370, 9674, 2972, 10472, 16492, 22683, 11529, 27968, 30406, 13213, 2319, 23620, 16823,\n\t10013, 23772, 21567, 1251, 19579, 20313, 18241, 30130, 8402, 20807, 27354, 7169, 21211, 17293, 5410, 19223,\n\t10255, 22480, 27388, 9946, 15628, 24389, 17308, 2370, 9530, 31683, 25927, 23567, 11694, 26397, 32602, 15031,\n\t18255, 17582, 1422, 28835, 23607, 12597, 20602, 10138, 5212, 1252, 10074, 23166, 19823, 31667, 5902, 24630,\n\t18948, 14330, 14950, 8939, 23540, 21311, 22428, 22391, 3583, 29004, 30498, 18714, 4278, 2437, 22430, 3439,\n\t28313, 23161, 25396, 13471, 19324, 15287, 2563, 18901, 13103, 16867, 9714, 14322, 15197, 26889, 19372, 26241,\n\t31925, 14640, 11497, 8941, 10056, 6451, 28656, 10737, 13874, 17356, 8281, 25937, 1661, 4850, 7448, 12744,\n\t21826, 5477, 10167, 16705, 26897, 8839, 30947, 27978, 27283, 24685, 32298, 3525, 12398, 28726, 9475, 10208,\n\t617, 13467, 22287, 2376, 6097, 26312, 2974, 9114, 21787, 28010, 4725, 15387, 3274, 10762, 31695, 17320,\n\t18324, 12441, 16801, 27376, 22464, 7500, 5666, 18144, 15314, 31914, 31627, 6495, 5226, 31203, 2331, 4668,\n\t12650, 18275, 351, 7268, 31319, 30119, 7600, 2905, 13826, 11343, 13053, 15583, 30055, 31093, 5067, 761,\n\t9685, 11070, 21369, 27155, 3663, 26542, 20169, 12161, 15411, 30401, 7580, 31784, 8985, 29367, 20989, 14203,\n\t29694, 21167, 10337, 1706, 28578, 887, 3373, 19477, 14382, 675, 7033, 15111, 26138, 12252, 30996, 21409,\n\t25678, 18555, 13256, 23316, 22407, 16727, 991, 9236, 5373, 29402, 6117, 15241, 27715, 19291, 19888, 19847\n};\n\nunsigned int U_Random( void ) \n{ \n\tglSeed *= 69069; \n\tglSeed += seed_table[ glSeed & 0xff ];\n \n\treturn ( ++glSeed & 0x0fffffff ); \n} \n\nvoid U_Srand( unsigned int seed )\n{\n\tglSeed = seed_table[ seed & 0xff ];\n}\n\n/*\n=====================\nUTIL_SharedRandomLong\n=====================\n*/\nint UTIL_SharedRandomLong( unsigned int seed, int low, int high )\n{\n\tunsigned int range;\n\n\tU_Srand( (int)seed + low + high );\n\n\trange = high - low + 1;\n\tif ( !(range - 1) )\n\t{\n\t\treturn low;\n\t}\n\telse\n\t{\n\t\tint offset;\n\t\tint rnum;\n\n\t\trnum = U_Random();\n\n\t\toffset = rnum % range;\n\n\t\treturn (low + offset);\n\t}\n}\n\n/*\n=====================\nUTIL_SharedRandomFloat\n=====================\n*/\nfloat UTIL_SharedRandomFloat( unsigned int seed, float low, float high )\n{\n\t//\n\tunsigned int range;\n\n\tU_Srand( (int)seed + *(int *)&low + *(int *)&high );\n\n\tU_Random();\n\tU_Random();\n\n\trange = high - low;\n\tif ( !range )\n\t{\n\t\treturn low;\n\t}\n\telse\n\t{\n\t\tint tensixrand;\n\t\tfloat offset;\n\n\t\ttensixrand = U_Random() & 65535;\n\n\t\toffset = (float)tensixrand / 65536.0;\n\n\t\treturn (low + offset * range );\n\t}\n}\n"
  },
  {
    "path": "cl_dll/cs_wpn/cs_baseentity.cpp",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\t\n*\tThis product contains software technology licensed from Id \n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc. \n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n\n/*\n==========================\nThis file contains \"stubs\" of class member implementations so that we can predict certain\n weapons client side.  From time to time you might find that you need to implement part of the\n these functions.  If so, cut it from here, paste it in hl_weapons.cpp or somewhere else and\n add in the functionality you need.\n==========================\n*/\n#include    \"port.h\"\n#include\t\"extdll.h\"\n#include\t\"util.h\"\n#include\t\"cbase.h\"\n#include\t\"player.h\"\n#include\t\"weapons.h\"\n#include\t\"nodes.h\"\n#include\t\"soundent.h\"\n#include\t\"skill.h\"\n\n// Globals used by game logic\nconst Vector g_vecZero = Vector( 0, 0, 0 );\nint gmsgWeapPickup = 0;\nenginefuncs_t g_engfuncs;\nglobalvars_t  *gpGlobals;\nItemInfo CBasePlayerItem::ItemInfoArray[MAX_WEAPONS];\n\n"
  },
  {
    "path": "cl_dll/cs_wpn/cs_weapons.cpp",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\n*\tThis product contains software technology licensed from Id\n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc.\n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n\n#include \"port.h\"\n\n#include \"wrect.h\"\n#include \"cl_dll.h\"\n#include \"cl_util.h\"\n#include \"hud.h\"\n\n#include \"extdll.h\"\n#include \"util.h\"\n#include \"cbase.h\"\n#include \"monsters.h\"\n\n#define PLAYER_H\n#include \"weapons.h\"\n#undef PLAYER_H\n\n#include \"nodes.h\"\n#include \"player.h\"\n\n#include \"usercmd.h\"\n#include \"entity_state.h\"\n#include \"demo_api.h\"\n#include \"pm_defs.h\"\n#include \"event_api.h\"\n#include \"r_efx.h\"\n\n#include \"hud_iface.h\"\n#include \"com_weapons.h\"\n#include \"demo.h\"\n\n#include \"cl_entity.h\"\n\n#include \"pm_shared.h\"\n#include \"GameStudioModelRenderer.h\"\n#include \"ammohistory.h\"\n#ifndef min\n#define min(a,b)  (((a) < (b)) ? (a) : (b))\n#endif\n\n#ifndef max\n#define max(a,b)  (((a) > (b)) ? (a) : (b))\n#endif\n\n// Globals used by game logic\nconst Vector g_vecZero = Vector( 0, 0, 0 );\nenginefuncs_t g_engfuncs;\nglobalvars_t  *gpGlobals;\nItemInfo CBasePlayerItem::ItemInfoArray[MAX_WEAPONS];\n\n// Pool of client side entities/entvars_t\nstatic entvars_t\tev[ 32 ];\nstatic int\t\t\tnum_ents = 0;\n\n// The entity we'll use to represent the local client\nstatic CBasePlayer\tplayer;\n\n// Local version of game .dll global variables ( time, etc. )\nstatic globalvars_t\tGlobals = { };\n\nstatic CBasePlayerWeapon *g_pWpns[ 32 ];\n\n\n// CS Weapon placeholder entities\nstatic CAK47 g_AK47;\nstatic CAUG g_AUG;\nstatic CAWP g_AWP;\nstatic CC4 g_C4;\nstatic CDEAGLE g_DEAGLE;\nstatic CELITE g_ELITE;\nstatic CFamas g_Famas;\nstatic CFiveSeven g_FiveSeven;\nstatic CFlashbang g_Flashbang;\nstatic CG3SG1 g_G3SG1;\nstatic CGalil g_Galil;\nstatic CGLOCK18 g_GLOCK18;\nstatic CHEGrenade g_HEGrenade;\nstatic CKnife g_Knife;\nstatic CM249 g_M249;\nstatic CM3 g_M3;\nstatic CM4A1 g_M4A1;\nstatic CMAC10 g_MAC10;\nstatic CMP5N g_MP5N;\nstatic CP228 g_P228;\nstatic CP90 g_P90;\nstatic CSCOUT g_SCOUT;\nstatic CSG550 g_SG550;\nstatic CSG552 g_SG552;\nstatic CSmokeGrenade g_SmokeGrenade;\nstatic CTMP g_TMP;\nstatic CUMP45 g_UMP45;\nstatic CUSP g_USP;\nstatic CXM1014 g_XM1014;\n\nint    g_iWeaponFlags;\nbool   g_bInBombZone;\nint    g_iFreezeTimeOver;\nbool   g_bHoldingShield;\nbool   g_bHoldingKnife;\nfloat  g_flPlayerSpeed;\nint    g_iPlayerFlags;\nVector g_vPlayerVelocity;\nint    g_iWaterLevel;\n\n/*\n======================\nAlertMessage\n\nPrint debug messages to console\n======================\n*/\nvoid AlertMessage( ALERT_TYPE atype, const char *szFmt, ... )\n{\n\tva_list\t\targptr;\n\tstatic char\tstring[1024];\n\n\tva_start (argptr, szFmt);\n\tvsprintf (string, szFmt,argptr);\n\tva_end (argptr);\n\n\tgEngfuncs.Con_Printf( \"cl:  \" );\n\tgEngfuncs.Con_Printf( string );\n}\n\n/*\n=====================\nHUD_PrepEntity\n\nLinks the raw entity to an entvars_s holder.  If a player is passed in as the owner, then\nwe set up the m_pPlayer field.\n=====================\n*/\nedict_t *EHANDLE::Get(void)\n{\n\tif (!m_pent)\n\t\treturn NULL;\n\n\tif (m_pent->serialnumber != m_serialnumber)\n\t\treturn NULL;\n\n\treturn m_pent;\n}\n\nedict_t *EHANDLE::Set(edict_t *pent)\n{\n\tm_pent = pent;\n\n\tif (pent)\n\t\tm_serialnumber = m_pent->serialnumber;\n\n\treturn pent;\n}\n\nEHANDLE::operator CBaseEntity *(void)\n{\n\treturn (CBaseEntity *)GET_PRIVATE(Get());\n}\n\nCBaseEntity *EHANDLE::operator = (CBaseEntity *pEntity)\n{\n\tif (pEntity)\n\t{\n\t\tm_pent = ENT(pEntity->pev);\n\n\t\tif (m_pent)\n\t\t\tm_serialnumber = m_pent->serialnumber;\n\t}\n\telse\n\t{\n\t\tm_pent = NULL;\n\t\tm_serialnumber = 0;\n\t}\n\n\treturn pEntity;\n}\n\nEHANDLE::operator int(void)\n{\n\treturn Get() != NULL;\n}\n\nCBaseEntity *EHANDLE::operator ->(void)\n{\n\treturn (CBaseEntity *)GET_PRIVATE(Get());\n}\n\nvoid HUD_PrepEntity( CBaseEntity *pEntity )\n{\n\tmemset( &ev[ num_ents ], 0, sizeof( entvars_t ) );\n\tpEntity->pev = &ev[ num_ents++ ];\n\n\tpEntity->Precache();\n\tpEntity->Spawn();\n}\n\n\nvoid HUD_PrepEntity( CBasePlayerWeapon *pEntity, CBasePlayer *pWeaponOwner )\n{\n\tItemInfo info = {};\n\n\tmemset( &ev[ num_ents ], 0, sizeof( entvars_t ) );\n\tpEntity->pev = &ev[ num_ents++ ];\n\n\tpEntity->Precache();\n\tpEntity->Spawn();\n\tpEntity->m_pPlayer = pWeaponOwner;\n\tpEntity->GetItemInfo( &info );\n\n\tg_pWpns[ info.iId ] = pEntity;\n\tCBasePlayerItem::ItemInfoArray[ info.iId ] = info;\n}\n\n/*\n=====================\nCBaseEntity :: Killed\n\nIf weapons code \"kills\" an entity, just set its effects to EF_NODRAW\n=====================\n*/\nvoid CBaseEntity :: Killed( entvars_t *pevAttacker, int iGib )\n{\n\tpev->effects |= EF_NODRAW;\n}\n\n/*\n=====================\nCBasePlayerWeapon :: DefaultReload\n=====================\n*/\nBOOL CBasePlayerWeapon :: DefaultReload( int iClipSize, int iAnim, float fDelay, int body )\n{\n\tif( !m_pPlayer->m_pActiveItem )\n\t\treturn FALSE;\n\n\tif (m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0)\n\t\treturn FALSE;\n\n\tint j = min(iClipSize - m_iClip, player.m_rgAmmo[m_iPrimaryAmmoType]);\n\n\tif (j == 0)\n\t\treturn FALSE;\n\n\tm_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + fDelay;\n\n\t//!!UNDONE -- reload sound goes here !!!\n\tSendWeaponAnim( iAnim, UseDecrement() );\n\n\tm_fInReload = TRUE;\n\n\tm_flTimeWeaponIdle = UTIL_WeaponTimeBase() + fDelay + 0.5f;\n\treturn TRUE;\n}\n\n/*\n=====================\nCBasePlayerWeapon :: CanDeploy\n=====================\n*/\nBOOL CBasePlayerWeapon :: CanDeploy( void )\n{\n\treturn TRUE;\n}\n/*\n=====================\nCBasePlayer :: HasShield\n\n=====================\n*/\nbool CBasePlayer::HasShield()\n{\n\treturn g_bHoldingShield;\n}\n\n/*\n=====================\nCBasePlayerWeapon::HasSecondaryAttack()\n\n=====================\n*/\nbool CBasePlayerWeapon::HasSecondaryAttack()\n{\n\tif (m_pPlayer->HasShield())\n\t{\n\t\treturn true;\n\t}\n\n\tswitch (m_iId)\n\t{\n\tcase WEAPON_AK47:\n\tcase WEAPON_XM1014:\n\tcase WEAPON_MAC10:\n\tcase WEAPON_ELITE:\n\tcase WEAPON_FIVESEVEN:\n\tcase WEAPON_MP5N:\n\tcase WEAPON_M249:\n\tcase WEAPON_M3:\n\tcase WEAPON_TMP:\n\tcase WEAPON_DEAGLE:\n\tcase WEAPON_P228:\n\tcase WEAPON_P90:\n\tcase WEAPON_C4:\n\tcase WEAPON_GALIL:\n\t\treturn false;\n\tdefault:\n\t\tbreak;\n\t}\n\n\treturn true;\n}\n\nvoid CBasePlayerWeapon::FireRemaining(int &shotsFired, float &shootTime, BOOL isGlock18)\n{\n\tm_iClip--;\n\n\tif (m_iClip < 0)\n\t{\n\t\tm_iClip = 0;\n\t\tshotsFired = 3;\n\t\tshootTime = 0;\n\t\treturn;\n\t}\n\n\tUTIL_MakeVectors(m_pPlayer->pev->v_angle + m_pPlayer->pev->punchangle);\n\n\tVector vecSrc = m_pPlayer->GetGunPosition();\n\tVector vecDir;\n\n\tif (isGlock18)\n\t{\n\t\tvecDir = m_pPlayer->FireBullets3(vecSrc, gpGlobals->v_forward, 0.05, 8192, 1, BULLET_PLAYER_9MM, 18, 0.9, m_pPlayer->pev, TRUE, m_pPlayer->random_seed);\n\t\tPLAYBACK_EVENT_FULL(FEV_NOTHOST, ENT(m_pPlayer->pev), m_usFireGlock18, 0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y, (int)(m_pPlayer->pev->punchangle.x * 10000), (int)(m_pPlayer->pev->punchangle.y * 10000), m_iClip == 0, FALSE);\n\t\tm_pPlayer->ammo_9mm--;\n\t}\n\telse\n\t{\n\t\tvecDir = m_pPlayer->FireBullets3(vecSrc, gpGlobals->v_forward, m_fBurstSpread, 8192, 2, BULLET_PLAYER_556MM, 30, 0.96, m_pPlayer->pev, TRUE, m_pPlayer->random_seed);\n\t\tPLAYBACK_EVENT_FULL(FEV_NOTHOST, ENT(m_pPlayer->pev), m_usFireFamas, 0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y, (int)(m_pPlayer->pev->punchangle.x * 10000000), (int)(m_pPlayer->pev->punchangle.y * 10000000), FALSE, FALSE);\n\t\tm_pPlayer->ammo_556nato--;\n\t}\n\n\tm_pPlayer->pev->effects |= EF_MUZZLEFLASH;\n\n\tif (++shotsFired != 3)\n\t\tshootTime = gpGlobals->time + 0.1;\n\telse\n\t\tshootTime = 0;\n}\n\nbool CBasePlayerWeapon::ShieldSecondaryFire(int iUpAnim, int iDownAnim)\n{\n\tif (!m_pPlayer->HasShield())\n\t\treturn false;\n\n\tif (m_iWeaponState & WPNSTATE_SHIELD_DRAWN)\n\t{\n\t\tm_iWeaponState &= ~WPNSTATE_SHIELD_DRAWN;\n\t\tSendWeaponAnim(iDownAnim, UseDecrement() != FALSE);\n\t\tstrcpy(m_pPlayer->m_szAnimExtention, \"shieldgun\");\n\t\tm_fMaxSpeed = 250.0f;\n\t\tm_pPlayer->m_bShieldDrawn = false;\n\t}\n\telse\n\t{\n\t\tm_iWeaponState |= WPNSTATE_SHIELD_DRAWN;\n\t\tSendWeaponAnim(iUpAnim, UseDecrement() != FALSE);\n\t\tstrcpy(m_pPlayer->m_szAnimExtention, \"shielded\");\n\t\tm_fMaxSpeed = 180.0f;\n\t\tm_pPlayer->m_bShieldDrawn = true;\n\t}\n\n\tm_flNextSecondaryAttack = 0.4f;\n\tm_flNextPrimaryAttack = 0.4f;\n\tm_flTimeWeaponIdle = 0.6f;\n\n\treturn true;\n}\n\nvoid CBasePlayerWeapon::KickBack(float up_base, float lateral_base, float up_modifier, float lateral_modifier, float up_max, float lateral_max, int direction_change)\n{\n\n}\n\nvoid CBasePlayerWeapon::SetPlayerShieldAnim(void)\n{\n\tif (!m_pPlayer->HasShield())\n\t\treturn;\n\n\tif (m_iWeaponState & WPNSTATE_SHIELD_DRAWN)\n\t{\n\t\tstrcpy(m_pPlayer->m_szAnimExtention, \"shield\");\n\t}\n\telse\n\t{\n\t\tstrcpy(m_pPlayer->m_szAnimExtention, \"shieldgun\");\n\t}\n}\n\nvoid CBasePlayerWeapon::ResetPlayerShieldAnim(void)\n{\n\tif (m_pPlayer->HasShield())\n\t{\n\t\tif (m_iWeaponState & WPNSTATE_SHIELD_DRAWN)\n\t\t{\n\t\t\tstrcpy(m_pPlayer->m_szAnimExtention, \"shieldgun\");\n\t\t}\n\t}\n}\n\n/*\n=====================\nCBasePlayerWeapon :: DefaultDeploy\n\n=====================\n*/\nBOOL CBasePlayerWeapon :: DefaultDeploy( const char *szViewModel, const char *szWeaponModel, int iAnim, const char *szAnimExt, int skiplocal )\n{\n\tif ( !CanDeploy() )\n\t\treturn FALSE;\n\n\tgEngfuncs.CL_LoadModel( szViewModel, &m_pPlayer->pev->viewmodel );\n\n\tSendWeaponAnim( iAnim, skiplocal );\n\n\tm_pPlayer->m_flNextAttack = 0.75f;\n\tm_flTimeWeaponIdle = 1.5f;\n\treturn TRUE;\n}\n\n/*\n=====================\nCBasePlayerWeapon :: PlayEmptySound\n\n=====================\n*/\nBOOL CBasePlayerWeapon :: PlayEmptySound( void )\n{\n#if 0\n\tif (m_iPlayEmptySound)\n\t{\n\t\tswitch (m_iId)\n\t\t{\n\t\tcase WEAPON_USP:\n\t\tcase WEAPON_GLOCK18:\n\t\tcase WEAPON_P228:\n\t\tcase WEAPON_DEAGLE:\n\t\tcase WEAPON_ELITE:\n\t\tcase WEAPON_FIVESEVEN:\n\t\t\tHUD_PlaySound(\"weapons/dryfire_pistol.wav\", 0.8);\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tHUD_PlaySound(\"weapons/dryfire_rifle.wav\",  0.8);\n\t\t\tbreak;\n\t\t}\n\t}\n#endif\n\treturn 0;\n}\n\n/*\n=====================\nCBasePlayerWeapon :: ResetEmptySound\n\n=====================\n*/\nvoid CBasePlayerWeapon :: ResetEmptySound( void )\n{\n\tm_iPlayEmptySound = 1;\n}\n\n/*\n=====================\nCBasePlayerWeapon::Holster\n\nPut away weapon\n=====================\n*/\nvoid CBasePlayerWeapon::Holster( int skiplocal /* = 0 */ )\n{\n\tm_fInReload = FALSE; // cancel any reload in progress.\n\tm_pPlayer->pev->viewmodel = 0;\n}\n\n/*\n=====================\nCBasePlayerWeapon::SendWeaponAnim\n\nAnimate weapon model\n=====================\n*/\nvoid CBasePlayerWeapon::SendWeaponAnim( int iAnim, int skiplocal )\n{\n\t//gEngfuncs.Con_DPrintf( \"Predict::SendWeaponAnim( %i )\\n\", iAnim );\n\n\tm_pPlayer->pev->weaponanim = iAnim;\n\tHUD_SendWeaponAnim( iAnim, m_iId, 0, 0 );\n}\n\nvoid CBasePlayerWeapon::RetireWeapon()\n{\n\t// TODO: Implement\n\t// UTIL_GetNextBestWeapon( m_pPlayer, this );\n}\n\nVector CBaseEntity::FireBullets3 ( Vector vecSrc, Vector vecDirShooting, float flSpread, float flDistance, int iPenetration, int iBulletType, int iDamage, float flRangeModifier, entvars_t *pevAttacker, bool bPistol, int shared_rand )\n{\n\tfloat x, y, z;\n\n\tif ( pevAttacker )\n\t{\n\t\tx = UTIL_SharedRandomFloat(shared_rand, -0.5, 0.5) + UTIL_SharedRandomFloat(shared_rand + 1, -0.5, 0.5);\n\t\ty = UTIL_SharedRandomFloat(shared_rand + 2, -0.5, 0.5) + UTIL_SharedRandomFloat(shared_rand + 3, -0.5, 0.5);\n\t}\n\telse\n\t{\n\t\tdo\n\t\t{\n\t\t\tx = RANDOM_FLOAT(-0.5, 0.5) + RANDOM_FLOAT(-0.5, 0.5);\n\t\t\ty = RANDOM_FLOAT(-0.5, 0.5) + RANDOM_FLOAT(-0.5, 0.5);\n\t\t\tz = x * x + y * y;\n\t\t}\n\t\twhile (z > 1);\n\t}\n\n\treturn Vector(x * flSpread, y * flSpread, 0.0f);\n}\n/*\n=====================\nCBasePlayerWeapon::ItemPostFrame\n\nHandles weapon firing, reloading, etc.\n=====================\n*/\nvoid CBasePlayerWeapon::ItemPostFrame( void )\n{\n\tint button = m_pPlayer->pev->button;\n\n\tif (!HasSecondaryAttack())\n\t\tbutton &= ~IN_ATTACK2;\n\n\tif (m_flGlock18Shoot != 0)\n\t{\n\t\tm_iClip--;\n\t\tif( m_iClip < 0 )\n\t\t{\n\t\t\tm_iClip = m_iGlock18ShotsFired = 0;\n\t\t}\n\t\tFireRemaining(m_iGlock18ShotsFired, m_flGlock18Shoot, TRUE);\n\t}\n\telse if (gpGlobals->time > m_flFamasShoot && m_flFamasShoot != 0)\n\t{\n\t\tm_iClip--;\n\t\tif( m_iClip < 0 )\n\t\t{\n\t\t\tm_iClip = m_iFamasShotsFired = 0;\n\t\t}\n\t\tFireRemaining(m_iFamasShotsFired, m_flFamasShoot, FALSE);\n\t}\n\n\tif (m_flNextPrimaryAttack <= UTIL_WeaponTimeBase() )\n\t{\n\t\tif (m_pPlayer->m_bResumeZoom)\n\t\t{\n\t\t\tm_pPlayer->pev->fov = m_pPlayer->m_iFOV = m_pPlayer->m_iLastZoom;\n\n\t\t\tif (m_pPlayer->m_iFOV == m_pPlayer->m_iLastZoom)\n\t\t\t{\n\t\t\t\tm_pPlayer->m_bResumeZoom = false;\n\t\t\t\t// viewmodel hide is implemented elsewhere\n\t\t\t}\n\t\t}\n\t}\n\n\tif ( m_pPlayer->HasShield() )\n\t{\n\t\tif (m_fInReload && m_pPlayer->pev->button & IN_ATTACK2)\n\t\t{\n\t\t\tSecondaryAttack();\n\t\t\tm_pPlayer->pev->button &= ~IN_ATTACK2;\n\t\t\tm_fInReload = FALSE;\n\t\t\tm_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase();\n\t\t}\n\t}\n\n\tif ((m_fInReload) && m_pPlayer->m_flNextAttack <= UTIL_WeaponTimeBase())\n\t{\n\t\tint j = min(iMaxClip() - m_iClip, m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType]);\n\n\t\tm_iClip += j;\n\t\tm_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] -= j;\n\t\tm_fInReload = FALSE;\n\t}\n\n\tif ((button & IN_ATTACK2) && m_flNextSecondaryAttack <= UTIL_WeaponTimeBase())\n\t{\n\t\tif (pszAmmo2() && !m_pPlayer->m_rgAmmo[m_iSecondaryAmmoType])\n\t\t\tm_fFireOnEmpty = TRUE;\n\n\t\tSecondaryAttack();\n\t\tm_pPlayer->pev->button &= ~IN_ATTACK2;\n\t}\n\telse if ((m_pPlayer->pev->button & IN_ATTACK) && m_flNextPrimaryAttack <= UTIL_WeaponTimeBase())\n\t{\n\t\tif ((!m_iClip && pszAmmo1()) || (iMaxClip() == WEAPON_NOCLIP && !m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType]))\n\t\t\tm_fFireOnEmpty = TRUE;\n\n\t\tif (m_pPlayer->m_bCanShoot == true)\n\t\t\tPrimaryAttack();\n\t}\n\telse if (m_pPlayer->pev->button & IN_RELOAD && iMaxClip() != WEAPON_NOCLIP && !m_fInReload)\n\t{\n\t\tif (m_flNextPrimaryAttack < UTIL_WeaponTimeBase())\n\t\t{\n\t\t\tif (m_flFamasShoot == 0 && m_flGlock18Shoot == 0)\n\t\t\t{\n\t\t\t\tif (!(m_iWeaponState & WPNSTATE_SHIELD_DRAWN))\n\t\t\t\t\tReload();\n\t\t\t}\n\t\t}\n\t}\n\telse if (!(button & (IN_ATTACK | IN_ATTACK2)))\n\t{\n\t\tif (m_bDelayFire == true)\n\t\t{\n\t\t\tm_bDelayFire = false;\n\n\t\t\tif (m_iShotsFired > 15)\n\t\t\t\tm_iShotsFired = 15;\n\n\t\t\tm_flDecreaseShotsFired = gpGlobals->time + 0.4;\n\t\t}\n\n\t\tm_fFireOnEmpty = FALSE;\n\n\t\tif (m_iId != WEAPON_USP && m_iId != WEAPON_GLOCK18 && m_iId != WEAPON_P228 && m_iId != WEAPON_DEAGLE && m_iId != WEAPON_ELITE && m_iId != WEAPON_FIVESEVEN)\n\t\t{\n\t\t\tif (m_iShotsFired > 0)\n\t\t\t{\n\t\t\t\tif (gpGlobals->time > m_flDecreaseShotsFired)\n\t\t\t\t{\n\t\t\t\t\tm_iShotsFired--;\n\t\t\t\t\tm_flDecreaseShotsFired = gpGlobals->time + 0.0225;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\telse\n\t\t\tm_iShotsFired = 0;\n\n\n\t\tif (!(m_iWeaponState & WPNSTATE_SHIELD_DRAWN))\n\t\t{\n\n\t\t\tif (m_iClip == 0 && !(iFlags() & ITEM_FLAG_NOAUTORELOAD)\n\t\t\t\t\t&& m_flNextPrimaryAttack < UTIL_WeaponTimeBase())\n\t\t\t{\n\t\t\t\tif (m_flFamasShoot == 0 && m_flGlock18Shoot == 0)\n\t\t\t\t{\n\t\t\t\t\tReload();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tWeaponIdle();\n\t\treturn;\n\t}\n}\n\nfloat CBasePlayerWeapon::GetNextAttackDelay(float delay)\n{\n\tfloat flNextAttack = UTIL_WeaponTimeBase() + delay;\n\treturn flNextAttack;\n}\n\n/*\n=====================\nCBasePlayer::SelectLastItem\n\n=====================\n*/\nvoid CBasePlayer::SelectLastItem(void)\n{\n\tif (!m_pLastItem)\n\t{\n\t\treturn;\n\t}\n\n\tif ( m_pActiveItem && !m_pActiveItem->CanHolster() )\n\t{\n\t\treturn;\n\t}\n\n\tif (m_pActiveItem)\n\t\tm_pActiveItem->Holster( );\n\n\tCBasePlayerItem *pTemp = m_pActiveItem;\n\tm_pActiveItem = m_pLastItem;\n\tm_pLastItem = pTemp;\n\tm_pActiveItem->Deploy( );\n}\n\n/*\n=====================\nCBasePlayer::Killed\n\n=====================\n*/\nvoid CBasePlayer::Killed( entvars_t *pevAttacker, int iGib )\n{\n\t// Holster weapon immediately, to allow it to cleanup\n\tif ( m_pActiveItem )\n\t\t m_pActiveItem->Holster( );\n}\n\n/*\n=====================\nCBasePlayer::Spawn\n\n=====================\n*/\nvoid CBasePlayer::Spawn( void )\n{\n\tif (m_pActiveItem)\n\t\tm_pActiveItem->Deploy( );\n}\n\nVector CBasePlayer::GetGunPosition()\n{\n\tVector origin = pev->origin;\n\tVector view_ofs;\n\n\tgEngfuncs.pEventAPI->EV_LocalPlayerViewheight(view_ofs);\n\n\treturn origin + view_ofs;\n}\n\n/*\n=====================\nUTIL_TraceLine\n\nDon't actually trace, but act like the trace didn't hit anything.\n=====================\n*/\nvoid UTIL_TraceLine( const Vector &vecStart, const Vector &vecEnd, IGNORE_MONSTERS igmon, edict_t *pentIgnore, TraceResult *ptr )\n{\n\tmemset( ptr, 0, sizeof( *ptr ) );\n#if 0\n\tstatic float flLastFraction = 1.0f;\n\n\tif( g_runfuncs )\n\t{\n\t\tVector vStart = vecStart, vEnd = vecEnd;\n\t\tpmtrace_t pmtrace;\n\n\t\tgEngfuncs.pEventAPI->EV_SetTraceHull( 0 );\n\t\tgEngfuncs.pEventAPI->EV_PlayerTrace( vStart, vEnd, 0, -1, &pmtrace );\n\t\tflLastFraction = ptr->flFraction = pmtrace.fraction;\n\t\tptr->vecEndPos = pmtrace.endpos;\n\t}\n\telse\n\t{\n\t\tptr->flFraction = flLastFraction;\n\t}\n#else\n\tptr->flFraction = 1.0f;\n#endif\n}\n\nchar UTIL_TextureHit(TraceResult *ptr, Vector vecSrc, Vector vecEnd)\n{\n\tchar chTextureType;\n\tfloat rgfl1[3], rgfl2[3];\n\tconst char *pTextureName;\n\tchar szbuffer[64];\n\tCBaseEntity *pEntity;\n\n\tif( ptr->pHit == NULL )\n\t\treturn CHAR_TEX_FLESH;\n\n\tpEntity = CBaseEntity::Instance(ptr->pHit);\n\n\tif (pEntity && pEntity->Classify() != CLASS_NONE && pEntity->Classify() != CLASS_MACHINE)\n\t\treturn CHAR_TEX_FLESH;\n\n\tvecSrc.CopyToArray(rgfl1);\n\tvecEnd.CopyToArray(rgfl2);\n\n\tif (pEntity)\n\t\tpTextureName = TRACE_TEXTURE(ENT(pEntity->pev), rgfl1, rgfl2);\n\telse\n\t\tpTextureName = TRACE_TEXTURE(ENT(0), rgfl1, rgfl2);\n\n\tif (pTextureName)\n\t{\n\t\tif (*pTextureName == '-' || *pTextureName == '+')\n\t\t\tpTextureName += 2;\n\n\t\tif (*pTextureName == '{' || *pTextureName == '!' || *pTextureName == '~' || *pTextureName == ' ')\n\t\t\tpTextureName++;\n\n\t\tstrncpy(szbuffer, pTextureName, sizeof(szbuffer));\n\t\tszbuffer[CBTEXTURENAMEMAX - 1] = 0;\n\t\tchTextureType = PM_FindTextureType(szbuffer);\n\t}\n\telse\n\t\tchTextureType = 0;\n\n\treturn chTextureType;\n}\n\nCBasePlayer *UTIL_PlayerByIndex(int playerIndex)\n{\n#if 0\n\tCBaseEntity *pPlayer = NULL;\n\n\tif (playerIndex > 0 && playerIndex <= gpGlobals->maxClients)\n\t{\n\t\tedict_t *pPlayerEdict = INDEXENT(playerIndex);\n\n\t\tif (pPlayerEdict && !pPlayerEdict->free)\n\t\t\tpPlayer = CBaseEntity::Instance(pPlayerEdict);\n\t}\n\n\treturn pPlayer;\n#else\n\treturn &player;\n#endif\n}\n\nvoid Broadcast( const char *msg, int pitch ); // hud/radio\nvoid CBasePlayer::Radio(const char *msg_id, const char *msg_verbose, int pitch, bool showIcon)\n{\n\tBroadcast( msg_id, pitch );\n}\n\nvoid UTIL_MakeVectors( const Vector &vec )\n{\n\tgEngfuncs.pfnAngleVectors( vec, gpGlobals->v_forward, gpGlobals->v_right, gpGlobals->v_up );\n}\n\n/*\n=====================\nHUD_InitClientWeapons\n\nSet up weapons, player and functions needed to run weapons code client-side.\n=====================\n*/\nvoid HUD_InitClientWeapons( void )\n{\n\tstatic int initialized = 0;\n\tif ( initialized )\n\t\treturn;\n\n\tinitialized = 1;\n\n\t// Set up pointer ( dummy object )\n\tgpGlobals = &Globals;\n\n\t// Fill in current time ( probably not needed )\n\tgpGlobals->time = gEngfuncs.GetClientTime();\n\n\t// Fake functions\n\t//g_engfuncs.pfnSetClientMaxspeed = HUD_SetMaxSpeed;\n\n\t// Handled locally\n\tg_engfuncs.pfnPlaybackEvent\t\t= HUD_PlaybackEvent;\n\tg_engfuncs.pfnAlertMessage\t\t= AlertMessage;\n\n\t// Pass through to engine\n\tg_engfuncs.pfnPrecacheEvent\t\t= gEngfuncs.pfnPrecacheEvent;\n\tg_engfuncs.pfnRandomFloat\t\t= gEngfuncs.pfnRandomFloat;\n\tg_engfuncs.pfnRandomLong\t\t= gEngfuncs.pfnRandomLong;\n\n\t// Allocate a slot for the local player\n\tHUD_PrepEntity( &player\t);\n\n\t// Allocate slot(s) for each weapon that we are going to be predicting\n\tif( gHUD.GetGameType() != GAME_CZERODS )\n\t{\n\t\tHUD_PrepEntity( &g_P228, &player);\n\t\tHUD_PrepEntity( &g_SCOUT, &player);\n\t\tHUD_PrepEntity( &g_HEGrenade, &player);\n\t\tHUD_PrepEntity( &g_XM1014, &player);\n\t\tHUD_PrepEntity( &g_C4, &player);\n\t\tHUD_PrepEntity( &g_MAC10, &player);\n\t\tHUD_PrepEntity( &g_AUG, &player);\n\t\tHUD_PrepEntity( &g_SmokeGrenade, &player);\n\t\tHUD_PrepEntity( &g_ELITE, &player);\n\t\tHUD_PrepEntity( &g_FiveSeven, &player);\n\t\tHUD_PrepEntity( &g_UMP45, &player);\n\t\tHUD_PrepEntity( &g_SG550, &player);\n\t\tHUD_PrepEntity( &g_Galil, &player);\n\t\tHUD_PrepEntity( &g_Famas, &player);\n\t\tHUD_PrepEntity( &g_USP, &player);\n\t\tHUD_PrepEntity( &g_GLOCK18, &player);\n\t\tHUD_PrepEntity( &g_AWP, &player);\n\t\tHUD_PrepEntity( &g_MP5N, &player);\n\t\tHUD_PrepEntity( &g_M249, &player);\n\t\tHUD_PrepEntity( &g_M4A1, &player);\n\t\tHUD_PrepEntity( &g_M3, &player );\n\t\tHUD_PrepEntity( &g_TMP, &player);\n\t\tHUD_PrepEntity( &g_G3SG1, &player);\n\t\tHUD_PrepEntity( &g_Flashbang, &player);\n\t\tHUD_PrepEntity( &g_DEAGLE, &player);\n\t\tHUD_PrepEntity( &g_SG552, &player);\n\t\tHUD_PrepEntity( &g_AK47, &player);\n\t\tHUD_PrepEntity( &g_Knife, &player);\n\t\tHUD_PrepEntity( &g_P90, &player );\n\t}\n}\n\n\nint GetWeaponAccuracyFlags( int weaponid )\n{\n\tint result = 0;\n\n\tif( weaponid <= WEAPON_P90 )\n\t{\n\t\tswitch( weaponid )\n\t\t{\n\t\tcase WEAPON_AUG:\n\t\tcase WEAPON_GALIL:\n\t\tcase WEAPON_M249:\n\t\tcase WEAPON_SG552:\n\t\tcase WEAPON_AK47:\n\t\tcase WEAPON_P90:\n\t\t\tresult = ACCURACY_AIR | ACCURACY_SPEED;\n\t\t\tbreak;\n\t\tcase WEAPON_P228:\n\t\tcase WEAPON_FIVESEVEN:\n\t\tcase WEAPON_DEAGLE:\n\t\t\tresult = ACCURACY_AIR | ACCURACY_SPEED | ACCURACY_DUCK;\n\t\t\tbreak;\n\t\tcase WEAPON_GLOCK18:\n\t\t\tif( g_iWeaponFlags & WPNSTATE_GLOCK18_BURST_MODE)\n\t\t\t{\n\t\t\t\tresult = ACCURACY_AIR | ACCURACY_SPEED | ACCURACY_DUCK;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tresult = ACCURACY_AIR | ACCURACY_SPEED | ACCURACY_DUCK | ACCURACY_MULTIPLY_BY_14_2;\n\t\t\t}\n\t\t\tbreak;\n\t\tcase WEAPON_MAC10:\n\t\tcase WEAPON_UMP45:\n\t\tcase WEAPON_MP5N:\n\t\tcase WEAPON_TMP:\n\t\t\tresult = ACCURACY_AIR;\n\t\t\tbreak;\n\t\tcase WEAPON_M4A1:\n\t\t\tif(g_iWeaponFlags & WPNSTATE_USP_SILENCED)\n\t\t\t{\n\t\t\t\tresult = ACCURACY_AIR | ACCURACY_SPEED;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tresult = ACCURACY_AIR | ACCURACY_SPEED | ACCURACY_MULTIPLY_BY_14;\n\t\t\t}\n\t\t\tbreak;\n\t\tcase WEAPON_FAMAS:\n\t\t\tif(g_iWeaponFlags & WPNSTATE_FAMAS_BURST_MODE)\n\t\t\t{\n\t\t\t\tresult = ACCURACY_AIR | ACCURACY_SPEED;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tresult = ACCURACY_AIR | ACCURACY_SPEED | (1<<4);\n\t\t\t}\n\t\t\tbreak;\n\t\tcase WEAPON_USP:\n\t\t\tif(g_iWeaponFlags & WPNSTATE_USP_SILENCED)\n\t\t\t{\n\t\t\t\tresult = ACCURACY_AIR | ACCURACY_SPEED | ACCURACY_DUCK;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tresult = ACCURACY_AIR | ACCURACY_SPEED | ACCURACY_DUCK | ACCURACY_MULTIPLY_BY_14;\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t}\n\n\treturn result;\n}\n\n/*\n=====================\nHUD_WeaponsPostThink\n\nRun Weapon firing code on client\n=====================\n*/\nvoid HUD_WeaponsPostThink( local_state_s *from, local_state_s *to, usercmd_t *cmd, double time, unsigned int random_seed )\n{\n\tint i;\n\tint buttonsChanged;\n\tCBasePlayerWeapon *pWeapon = NULL;\n\tstatic int lasthealth;\n\tint flags;\n\n\tHUD_InitClientWeapons();\n\n\t// Get current clock\n\tgpGlobals->time = time;\n\n\t// Fill in data based on selected weapon\n\tswitch ( from->client.m_iId )\n\t{\n\t\tcase WEAPON_P228:\n\t\t\tpWeapon = &g_P228;\n\t\t\tbreak;\n\n\t\tcase WEAPON_SCOUT:\n\t\t\tpWeapon = &g_SCOUT;\n\t\t\tbreak;\n\n\t\tcase WEAPON_HEGRENADE:\n\t\t\tpWeapon = &g_HEGrenade;\n\t\t\tbreak;\n\n\t\tcase WEAPON_XM1014:\n\t\t\tpWeapon = &g_XM1014;\n\t\t\tbreak;\n\n\t\tcase WEAPON_C4:\n\t\t\tpWeapon = &g_C4;\n\t\t\tbreak;\n\n\t\tcase WEAPON_MAC10:\n\t\t\tpWeapon = &g_MAC10;\n\t\t\tbreak;\n\n\t\tcase WEAPON_AUG:\n\t\t\tpWeapon = &g_AUG;\n\t\t\tbreak;\n\n\t\tcase WEAPON_SMOKEGRENADE:\n\t\t\tpWeapon = &g_SmokeGrenade;\n\t\t\tbreak;\n\n\t\tcase WEAPON_ELITE:\n\t\t\tpWeapon = &g_ELITE;\n\t\t\tbreak;\n\n\t\tcase WEAPON_FIVESEVEN:\n\t\t\tpWeapon = &g_FiveSeven;\n\t\t\tbreak;\n\n\t\tcase WEAPON_UMP45:\n\t\t\tpWeapon = &g_UMP45;\n\t\t\tbreak;\n\n\t\tcase WEAPON_SG550:\n\t\t\tpWeapon = &g_SG550;\n\t\t\tbreak;\n\n\t\tcase WEAPON_GALIL:\n\t\t\tpWeapon = &g_Galil;\n\t\t\tbreak;\n\n\t\tcase WEAPON_FAMAS:\n\t\t\tpWeapon = &g_Famas;\n\t\t\tbreak;\n\n\t\tcase WEAPON_USP:\n\t\t\tpWeapon = &g_USP;\n\t\t\tbreak;\n\n\t\tcase WEAPON_GLOCK18:\n\t\t\tpWeapon = &g_GLOCK18;\n\t\t\tbreak;\n\n\t\tcase WEAPON_AWP:\n\t\t\tpWeapon = &g_AWP;\n\t\t\tbreak;\n\n\t\tcase WEAPON_MP5N:\n\t\t\tpWeapon = &g_MP5N;\n\t\t\tbreak;\n\n\t\tcase WEAPON_M249:\n\t\t\tpWeapon = &g_M249;\n\t\t\tbreak;\n\n\t\tcase WEAPON_M3:\n\t\t\tpWeapon = &g_M3;\n\t\t\tbreak;\n\n\t\tcase WEAPON_M4A1:\n\t\t\tpWeapon = &g_M4A1;\n\t\t\tbreak;\n\n\t\tcase WEAPON_TMP:\n\t\t\tpWeapon = &g_TMP;\n\t\t\tbreak;\n\n\t\tcase WEAPON_G3SG1:\n\t\t\tpWeapon = &g_G3SG1;\n\t\t\tbreak;\n\n\t\tcase WEAPON_FLASHBANG:\n\t\t\tpWeapon = &g_Flashbang;\n\t\t\tbreak;\n\n\t\tcase WEAPON_DEAGLE:\n\t\t\tpWeapon = &g_DEAGLE;\n\t\t\tbreak;\n\n\t\tcase WEAPON_SG552:\n\t\t\tpWeapon = &g_SG552;\n\t\t\tbreak;\n\n\t\tcase WEAPON_AK47:\n\t\t\tpWeapon = &g_AK47;\n\t\t\tbreak;\n\n\t\tcase WEAPON_KNIFE:\n\t\t\tpWeapon = &g_Knife;\n\t\t\tbreak;\n\n\t\tcase WEAPON_P90:\n\t\t\tpWeapon = &g_P90;\n\t\t\tbreak;\n\n\t\t/*case WEAPON_NONE:\n\t\t\tbreak;\n\n\t\tcase WEAPON_GLOCK:\n\t\tdefault:\n\t\t\tgEngfuncs.Con_Printf(\"VALVEWHY: Unknown Weapon %i is active.\\n\", from->client.m_iId );\n\t\t\tbreak;*/\n\t}\n\n\t// Store pointer to our destination entity_state_t so we can get our origin, etc. from it\n\t//  for setting up events on the client\n\tg_finalstate = to;\n\n\t// If we are running events/etc. go ahead and see if we\n\t//  managed to die between last frame and this one\n\t// If so, run the appropriate player killed or spawn function\n\tif ( g_runfuncs )\n\t{\n\t\tif ( to->client.health <= 0 && lasthealth > 0 )\n\t\t\tplayer.Killed( NULL, 0 );\n\t\telse if ( to->client.health > 0 && lasthealth <= 0 )\n\t\t\tplayer.Spawn();\n\n\t\tlasthealth = to->client.health;\n\t}\n\n\t// We are not predicting the current weapon, just bow out here.\n\tif ( !pWeapon )\n\t\treturn;\n\n\tfor ( i = 0; i < MAX_WEAPONS; i++ )\n\t{\n\t\tCBasePlayerWeapon *pCurrent = g_pWpns[ i ];\n\t\tif ( !pCurrent )\n\t\t\tcontinue;\n\n\t\tweapon_data_t *pfrom = from->weapondata + i;\n\n\t\tpCurrent->m_fInReload\t\t\t= pfrom->m_fInReload;\n\t\tpCurrent->m_fInSpecialReload\t= pfrom->m_fInSpecialReload;\n\t\tpCurrent->m_iClip\t\t\t\t= pfrom->m_iClip;\n\t\tpCurrent->m_flNextPrimaryAttack\t= pfrom->m_flNextPrimaryAttack;\n\t\tpCurrent->m_flNextSecondaryAttack = pfrom->m_flNextSecondaryAttack;\n\t\tpCurrent->m_flTimeWeaponIdle\t= pfrom->m_flTimeWeaponIdle;\n\t\tpCurrent->m_flStartThrow\t\t= pfrom->fuser2;\n\t\tpCurrent->m_flReleaseThrow\t\t= pfrom->fuser3;\n\t\tpCurrent->m_iSwing\t\t\t\t= pfrom->iuser1;\n\t\tpCurrent->m_iWeaponState\t\t= pfrom->m_iWeaponState;\n\t\tpCurrent->m_flLastFire\t\t\t= pfrom->m_fAimedDamage;\n\t\tpCurrent->m_iShotsFired\t\t\t= pfrom->m_fInZoom;\n\t}\n\n\tif( from->client.vuser4.x < 0 || from->client.vuser4.x > MAX_AMMO_TYPES )\n\t\tpWeapon->m_iPrimaryAmmoType = 0;\n\telse\n\t{\n\t\tpWeapon->m_iPrimaryAmmoType = (int)from->client.vuser4.x;\n\t\tplayer.m_rgAmmo[ pWeapon->m_iPrimaryAmmoType ]  = (int)from->client.vuser4.y;\n\t}\n\n\n\tg_iWeaponFlags = pWeapon->m_iWeaponState;\n\n\t// For random weapon events, use this seed to seed random # generator\n\tplayer.random_seed = random_seed;\n\n\t// Get old buttons from previous state.\n\tplayer.m_afButtonLast = from->playerstate.oldbuttons;\n\n\t// Which buttsons chave changed\n\tbuttonsChanged = (player.m_afButtonLast ^ cmd->buttons);\t// These buttons have changed this frame\n\n\t// Debounced button codes for pressed/released\n\t// The changed ones still down are \"pressed\"\n\tplayer.m_afButtonPressed =  buttonsChanged & cmd->buttons;\n\t// The ones not down are \"released\"\n\tplayer.m_afButtonReleased = buttonsChanged & (~cmd->buttons);\n\tplayer.pev->v_angle = cmd->viewangles;\n\tplayer.pev->origin = from->client.origin;\n\n\t// Set player variables that weapons code might check/alter\n\tplayer.pev->button = cmd->buttons;\n\n\tplayer.pev->velocity = from->client.velocity;\n\n\tplayer.pev->deadflag   = from->client.deadflag;\n\tplayer.pev->waterlevel = from->client.waterlevel;\n\tplayer.pev->maxspeed   = from->client.maxspeed;\n\tplayer.pev->punchangle = from->client.punchangle;\n\tplayer.pev->fov        = from->client.fov;\n\tplayer.pev->weaponanim = from->client.weaponanim;\n\tplayer.pev->viewmodel  = from->client.viewmodel;\n\tplayer.m_flNextAttack  = from->client.m_flNextAttack;\n\n\tg_iPlayerFlags    = player.pev->flags = from->client.flags;\n\tg_vPlayerVelocity = player.pev->velocity;\n\tg_flPlayerSpeed\t  = player.pev->velocity.Length();\n\tg_iWaterLevel     = player.pev->waterlevel;\n\n\t//Stores all our ammo info, so the client side weapons can use them.\n\tplayer.ammo_9mm\t\t\t= from->client.ammo_nails;\n\tplayer.ammo_556nato\t\t= from->client.ammo_cells;\n\tplayer.ammo_buckshot\t= from->client.ammo_shells;\n\tplayer.ammo_556natobox\t= from->client.ammo_rockets;\n\tplayer.ammo_762nato\t\t= (int)from->client.vuser2.x;\n\tplayer.ammo_45acp\t\t= (int)from->client.vuser2.y;\n\tplayer.ammo_50ae\t\t= (int)from->client.vuser2.z;\n\tplayer.ammo_338mag\t\t= (int)from->client.vuser3.x;\n\tplayer.ammo_57mm\t\t= (int)from->client.vuser3.y;\n\tplayer.ammo_357sig\t\t= (int)from->client.vuser3.z;\n\n\tcl_entity_t *pplayer = gEngfuncs.GetLocalPlayer();\n\tif( pplayer )\n\t{\n\t\tplayer.pev->origin = from->client.origin;\n\t\tplayer.pev->angles\t= pplayer->angles;\n\t\tplayer.pev->v_angle = v_angles;\n\t}\n\n\tflags = from->client.iuser3;\n\tg_bHoldingKnife\t\t= pWeapon->m_iId == WEAPON_KNIFE;\n\tplayer.m_bCanShoot\t= (flags & PLAYER_CAN_SHOOT) != 0;\n\tg_iFreezeTimeOver\t= !(flags & PLAYER_FREEZE_TIME_OVER);\n\tg_bInBombZone\t\t= (flags & PLAYER_IN_BOMB_ZONE) != 0;\n\n\t// validate if we can hold shield with specified weapon\n\tswitch( from->client.m_iId )\n\t{\n\tcase WEAPON_KNIFE:\n\tcase WEAPON_GLOCK18:\n\tcase WEAPON_USP:\n\tcase WEAPON_P228:\n\tcase WEAPON_DEAGLE:\n\tcase WEAPON_FIVESEVEN:\n\tcase WEAPON_HEGRENADE:\n\tcase WEAPON_FLASHBANG:\n\tcase WEAPON_SMOKEGRENADE:\n\t\tg_bHoldingShield\t= (flags & PLAYER_HOLDING_SHIELD) != 0;\n\t\tbreak;\n\tdefault:\n\t\tg_bHoldingShield = false;\n\t\tbreak;\n\t}\n\n\t// Point to current weapon object\n\tif ( from->client.m_iId )\n\t\tplayer.m_pActiveItem = pWeapon;\n\n\t// Don't go firing anything if we have died.\n\t// Or if we don't have a weapon model deployed\n\tif ( ( player.pev->deadflag != ( DEAD_DISCARDBODY + 1 ) ) &&\n\t\t !CL_IsDead() && player.pev->viewmodel && !g_iUser1 )\n\t{\n\t\tif( g_bHoldingKnife && pWeapon->m_iClientWeaponState &&\n\t\t\t\tplayer.pev->button & IN_FORWARD )\n\t\t\tplayer.m_flNextAttack = 0;\n\t\telse if( player.m_flNextAttack <= 0 )\n\t\t{\n\t\t\tpWeapon->ItemPostFrame();\n\t\t}\n\t}\n\n\t// Assume that we are not going to switch weapons\n\tto->client.m_iId\t\t\t\t\t= from->client.m_iId;\n\n\t// Now see if we issued a changeweapon command ( and we're not dead )\n\tif ( cmd->weaponselect && ( player.pev->deadflag != ( DEAD_DISCARDBODY + 1 ) ) )\n\t{\n\t\t// Switched to a different weapon?\n\t\tif ( from->weapondata[ cmd->weaponselect ].m_iId == cmd->weaponselect )\n\t\t{\n\t\t\tCBasePlayerWeapon *pNew = g_pWpns[ cmd->weaponselect ];\n\t\t\tif ( pNew && ( pNew != pWeapon ) )\n\t\t\t{\n\t\t\t\t// Put away old weapon\n\t\t\t\tif (player.m_pActiveItem)\n\t\t\t\t\tplayer.m_pActiveItem->Holster( );\n\n\t\t\t\tplayer.m_pLastItem = player.m_pActiveItem;\n\t\t\t\tplayer.m_pActiveItem = pNew;\n\n\t\t\t\t// Deploy new weapon\n\t\t\t\tif (player.m_pActiveItem)\n\t\t\t\t{\n\t\t\t\t\tplayer.m_pActiveItem->Deploy( );\n\t\t\t\t}\n\n\t\t\t\t// Update weapon id so we can predict things correctly.\n\t\t\t\tto->client.m_iId = cmd->weaponselect;\n\t\t\t}\n\t\t}\n\t}\n\n\t// Copy in results of prediction code\n\tto->client.viewmodel\t\t\t\t= player.pev->viewmodel;\n\tto->client.fov\t\t\t\t\t\t= player.pev->fov;\n\tto->client.weaponanim\t\t\t\t= player.pev->weaponanim;\n\tto->client.m_flNextAttack\t\t\t= player.m_flNextAttack;\n\tto->client.maxspeed\t\t\t\t\t= player.pev->maxspeed;\n\tto->client.punchangle\t\t\t\t= player.pev->punchangle;\n\n\n\tto->client.ammo_nails = player.ammo_9mm;\n\tto->client.ammo_cells = player.ammo_556nato;\n\tto->client.ammo_shells = player.ammo_buckshot;\n\tto->client.ammo_rockets = player.ammo_556natobox;\n\tto->client.vuser2.x = player.ammo_762nato;\n\tto->client.vuser2.y = player.ammo_45acp;\n\tto->client.vuser2.z = player.ammo_50ae;\n\tto->client.vuser3.x = player.ammo_338mag;\n\tto->client.vuser3.y = player.ammo_57mm;\n\tto->client.vuser3.z = player.ammo_357sig;\n\tto->client.iuser3 = flags;\n\n\n\n\n\t// Make sure that weapon animation matches what the game .dll is telling us\n\t//  over the wire ( fixes some animation glitches )\n\tif ( g_runfuncs && ( HUD_GetWeaponAnim() != to->client.weaponanim ) )\n\t\t// Force a fixed anim down to viewmodel\n\t\tHUD_SendWeaponAnim( to->client.weaponanim, to->client.m_iId, 2, 1 );\n\n\tif (pWeapon->m_iPrimaryAmmoType < MAX_AMMO_TYPES)\n\t{\n\t\tto->client.vuser4.x = pWeapon->m_iPrimaryAmmoType;\n\t\tto->client.vuser4.y = player.m_rgAmmo[ pWeapon->m_iPrimaryAmmoType ];\n\t}\n\telse\n\t{\n\t\tto->client.vuser4.x = -1.0;\n\t\tto->client.vuser4.y = 0;\n\t}\n\n\tfor ( i = 0; i < MAX_WEAPONS; i++ )\n\t{\n\t\tCBasePlayerWeapon *pCurrent = g_pWpns[ i ];\n\n\t\tweapon_data_t *pto = to->weapondata + i;\n\n\t\tif ( !pCurrent )\n\t\t{\n\t\t\tmemset( pto, 0, sizeof( weapon_data_t ) );\n\t\t\tcontinue;\n\t\t}\n\n\t\tpto->m_iClip\t\t\t\t\t= pCurrent->m_iClip;\n\n\t\tpto->m_flNextPrimaryAttack\t\t= pCurrent->m_flNextPrimaryAttack;\n\t\tpto->m_flNextSecondaryAttack\t= pCurrent->m_flNextSecondaryAttack;\n\t\tpto->m_flTimeWeaponIdle\t\t\t= pCurrent->m_flTimeWeaponIdle;\n\n\t\tpto->m_fInReload\t\t\t\t= pCurrent->m_fInReload;\n\t\tpto->m_fInSpecialReload\t\t\t= pCurrent->m_fInSpecialReload;\n\t\tpto->m_flNextReload\t\t\t\t= pCurrent->m_flNextReload;\n\t\tpto->fuser2\t\t\t\t\t\t= pCurrent->m_flStartThrow;\n\t\tpto->fuser3\t\t\t\t\t\t= pCurrent->m_flReleaseThrow;\n\t\tpto->iuser1\t\t\t\t\t\t= pCurrent->m_iSwing;\n\t\tpto->m_iWeaponState\t\t\t\t= pCurrent->m_iWeaponState;\n\t\tpto->m_fInZoom\t\t\t\t\t= pCurrent->m_iShotsFired;\n\t\tpto->m_fAimedDamage\t\t\t\t= pCurrent->m_flLastFire;\n\n\t\t// Decrement weapon counters, server does this at same time ( during post think, after doing everything else )\n\t\tpto->m_flNextReload\t\t\t\t-= cmd->msec / 1000.0f;\n\t\tpto->m_fNextAimBonus\t\t\t-= cmd->msec / 1000.0f;\n\t\tpto->m_flNextPrimaryAttack\t\t-= cmd->msec / 1000.0f;\n\t\tpto->m_flNextSecondaryAttack\t-= cmd->msec / 1000.0f;\n\t\tpto->m_flTimeWeaponIdle\t\t\t-= cmd->msec / 1000.0f;\n\n\n\t\tif( pto->m_flPumpTime != -9999.0f )\n\t\t{\n\t\t\tpto->m_flPumpTime -= cmd->msec / 1000.0f;\n\t\t\tif( pto->m_flPumpTime < -1.0f )\n\t\t\t\tpto->m_flPumpTime = 1.0f;\n\t\t}\n\n\t\tif ( pto->m_fNextAimBonus < -1.0 )\n\t\t{\n\t\t\tpto->m_fNextAimBonus = -1.0;\n\t\t}\n\n\t\tif ( pto->m_flNextPrimaryAttack < -1.0 )\n\t\t{\n\t\t\tpto->m_flNextPrimaryAttack = -1.0;\n\t\t}\n\n\t\tif ( pto->m_flNextSecondaryAttack < -0.001 )\n\t\t{\n\t\t\tpto->m_flNextSecondaryAttack = -0.001;\n\t\t}\n\n\t\tif ( pto->m_flTimeWeaponIdle < -0.001 )\n\t\t{\n\t\t\tpto->m_flTimeWeaponIdle = -0.001;\n\t\t}\n\n\t\tif ( pto->m_flNextReload < -0.001 )\n\t\t{\n\t\t\tpto->m_flNextReload = -0.001;\n\t\t}\n\n\t\t/*if ( pto->fuser1 < -0.001 )\n\t\t{\n\t\t\tpto->fuser1 = -0.001;\n\t\t}*/\n\t}\n\n\t// m_flNextAttack is now part of the weapons, but is part of the player instead\n\tto->client.m_flNextAttack -= cmd->msec / 1000.0f;\n\tif ( to->client.m_flNextAttack < -0.001 )\n\t{\n\t\tto->client.m_flNextAttack = -0.001;\n\t}\n\n\t// Wipe it so we can't use it after this frame\n\tg_finalstate = NULL;\n}\n\n/*\n=====================\nHUD_PostRunCmd\n\nClient calls this during prediction, after it has moved the player and updated any info changed into to->\ntime is the current client clock based on prediction\ncmd is the command that caused the movement, etc\nrunfuncs is 1 if this is the first time we've predicted this command.  If so, sounds and effects should play, otherwise, they should\nbe ignored\n=====================\n*/\nvoid DLLEXPORT HUD_PostRunCmd( local_state_t *from, local_state_t *to, struct usercmd_s *cmd, int runfuncs, double time, unsigned int random_seed )\n{\n\tg_runfuncs = runfuncs;\n\n\tHUD_WeaponsPostThink( from, to, cmd, time, random_seed );\n\tto->client.fov = g_lastFOV;\n\n\tif ( g_runfuncs )\n\t{\n\t\tg_gaitseq\t= to->playerstate.gaitsequence;\n\t\tg_rseq\t\t= to->playerstate.sequence;\n\t\tg_clang\t\t= cmd->viewangles;\n\t\tg_clorg\t\t= to->playerstate.origin;\n\t}\n}\n"
  },
  {
    "path": "cl_dll/death.cpp",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\t\n*\tThis product contains software technology licensed from Id \n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc. \n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n//\n// death notice\n//\n#include \"hud.h\"\n#include \"cl_util.h\"\n#include \"parsemsg.h\"\n\n#include <string.h>\n#include <stdio.h>\n#include \"draw_util.h\"\n\nfloat color[3];\n\nstruct DeathNoticeItem {\n\tchar szKiller[MAX_PLAYER_NAME_LENGTH*2];\n\tchar szVictim[MAX_PLAYER_NAME_LENGTH*2];\n\tint iId;\t// the index number of the associated sprite\n\tbool bSuicide;\n\tbool bTeamKill;\n\tbool bNonPlayerKill;\n\tfloat flDisplayTime;\n\tfloat *KillerColor;\n\tfloat *VictimColor;\n\tint iHeadShotId;\n};\n\n#define MAX_DEATHNOTICES\t4\nstatic int DEATHNOTICE_DISPLAY_TIME = 6;\n\n#define DEATHNOTICE_TOP\t\t32\n\nDeathNoticeItem rgDeathNoticeList[ MAX_DEATHNOTICES + 1 ];\n\ncvar_t *cl_killsound;\ncvar_t *cl_killsound_path;\n\nint CHudDeathNotice :: Init( void )\n{\n\tgHUD.AddHudElem( this );\n\n\tHOOK_MESSAGE( gHUD.m_DeathNotice, DeathMsg );\n\n\thud_deathnotice_time = CVAR_CREATE( \"hud_deathnotice_time\", \"6\", FCVAR_ARCHIVE );\n\tcl_killsound = CVAR_CREATE( \"cl_killsound\", \"0\", FCVAR_ARCHIVE );\n\tcl_killsound_path = CVAR_CREATE( \"cl_killsound_path\", \"buttons/bell1.wav\", FCVAR_ARCHIVE );\n\tm_iFlags = 0;\n\n\treturn 1;\n}\n\n\nvoid CHudDeathNotice :: InitHUDData( void )\n{\n\tmemset( rgDeathNoticeList, 0, sizeof(rgDeathNoticeList) );\n}\n\n\nint CHudDeathNotice :: VidInit( void )\n{\n\tm_HUD_d_skull = gHUD.GetSpriteIndex( \"d_skull\" );\n\tm_HUD_d_headshot = gHUD.GetSpriteIndex(\"d_headshot\");\n\n\treturn 1;\n}\n\nint CHudDeathNotice :: Draw( float flTime )\n{\n\tint x, y, r, g, b, i;\n\n\tfor( i = 0; i < MAX_DEATHNOTICES; i++ )\n\t{\n\t\tif ( rgDeathNoticeList[i].iId == 0 )\n\t\t\tbreak;  // we've gone through them all\n\n\t\tif ( rgDeathNoticeList[i].flDisplayTime < flTime )\n\t\t{ // display time has expired\n\t\t\t// remove the current item from the list\n\t\t\tmemmove( &rgDeathNoticeList[i], &rgDeathNoticeList[i+1], sizeof(DeathNoticeItem) * (MAX_DEATHNOTICES - i) );\n\t\t\ti--;  // continue on the next item;  stop the counter getting incremented\n\t\t\tcontinue;\n\t\t}\n\n\t\trgDeathNoticeList[i].flDisplayTime = min( rgDeathNoticeList[i].flDisplayTime, flTime + DEATHNOTICE_DISPLAY_TIME );\n\n\t\t// Hide when scoreboard drawing. It will break triapi\n\t\t//if ( gViewPort && gViewPort->AllowedToPrintText() )\n\t\t//if ( !gHUD.m_iNoConsolePrint )\n\t\t{\n\t\t\t// Draw the death notice\n\t\t\tif( !g_iUser1 )\n\t\t\t{\n\t\t\t\ty = YRES(DEATHNOTICE_TOP) + 2 + (20 * i);  //!!!\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\ty = ScreenHeight / 5 + 2 + (20 * i);\n\t\t\t}\n\n\t\t\tint id = (rgDeathNoticeList[i].iId == -1) ? m_HUD_d_skull : rgDeathNoticeList[i].iId;\n\t\t\tx = ScreenWidth - DrawUtils::ConsoleStringLen(rgDeathNoticeList[i].szVictim) - (gHUD.GetSpriteRect(id).Width());\n\t\t\tif( rgDeathNoticeList[i].iHeadShotId )\n\t\t\t\tx -= gHUD.GetSpriteRect(m_HUD_d_headshot).Width();\n\n\t\t\tif ( !rgDeathNoticeList[i].bSuicide )\n\t\t\t{\n\t\t\t\tx -= (5 + DrawUtils::ConsoleStringLen( rgDeathNoticeList[i].szKiller ) );\n\n\t\t\t\t// Draw killers name\n\t\t\t\tif ( rgDeathNoticeList[i].KillerColor )\n\t\t\t\t\tDrawUtils::SetConsoleTextColor( rgDeathNoticeList[i].KillerColor[0], rgDeathNoticeList[i].KillerColor[1], rgDeathNoticeList[i].KillerColor[2] );\n\t\t\t\tx = 5 + DrawUtils::DrawConsoleString( x, y, rgDeathNoticeList[i].szKiller );\n\t\t\t}\n\n\t\t\tr = 255;  g = 80;\tb = 0;\n\t\t\tif ( rgDeathNoticeList[i].bTeamKill )\n\t\t\t{\n\t\t\t\tr = 10;\tg = 240; b = 10;  // display it in sickly green\n\t\t\t}\n\n\t\t\t// Draw death weapon\n\t\t\tSPR_Set( gHUD.GetSprite(id), r, g, b );\n\t\t\tSPR_DrawAdditive( 0, x, y, &gHUD.GetSpriteRect(id) );\n\n\t\t\tx += (gHUD.GetSpriteRect(id).Width());\n\n\t\t\tif( rgDeathNoticeList[i].iHeadShotId)\n\t\t\t{\n\t\t\t\tSPR_Set( gHUD.GetSprite(m_HUD_d_headshot), r, g, b );\n\t\t\t\tSPR_DrawAdditive( 0, x, y, &gHUD.GetSpriteRect(m_HUD_d_headshot));\n\t\t\t\tx += (gHUD.GetSpriteRect(m_HUD_d_headshot).Width());\n\t\t\t}\n\n\t\t\t// Draw victims name (if it was a player that was killed)\n\t\t\tif (!rgDeathNoticeList[i].bNonPlayerKill)\n\t\t\t{\n\t\t\t\tif ( rgDeathNoticeList[i].VictimColor )\n\t\t\t\t\tDrawUtils::SetConsoleTextColor( rgDeathNoticeList[i].VictimColor[0], rgDeathNoticeList[i].VictimColor[1], rgDeathNoticeList[i].VictimColor[2] );\n\t\t\t\tx = DrawUtils::DrawConsoleString( x, y, rgDeathNoticeList[i].szVictim );\n\t\t\t}\n\t\t}\n\t}\n\n\tif( i == 0 )\n\t\tm_iFlags &= ~HUD_DRAW; // disable hud item\n\n\treturn 1;\n}\n\n// This message handler may be better off elsewhere\nint CHudDeathNotice :: MsgFunc_DeathMsg( const char *pszName, int iSize, void *pbuf )\n{\n\tm_iFlags |= HUD_DRAW;\n\n\tBufferReader reader( pszName, pbuf, iSize );\n\n\tint killer = reader.ReadByte();\n\tint victim = reader.ReadByte();\n\tint headshot = reader.ReadByte();\n\n\tchar killedwith[32];\n\tstrncpy( killedwith, \"d_\", sizeof(killedwith) );\n\tstrncat( killedwith, reader.ReadString(), sizeof( killedwith ) - 2 );\n\n\t//if (gViewPort)\n\t//\tgViewPort->DeathMsg( killer, victim );\n\tgHUD.m_Scoreboard.DeathMsg( killer, victim );\n\n\tgHUD.m_Spectator.DeathMessage(victim);\n\tint i;\n\tfor ( i = 0; i < MAX_DEATHNOTICES; i++ )\n\t{\n\t\tif ( rgDeathNoticeList[i].iId == 0 )\n\t\t\tbreak;\n\t}\n\tif ( i == MAX_DEATHNOTICES )\n\t{ // move the rest of the list forward to make room for this item\n\t\tmemmove( rgDeathNoticeList, rgDeathNoticeList+1, sizeof(DeathNoticeItem) * MAX_DEATHNOTICES );\n\t\ti = MAX_DEATHNOTICES - 1;\n\t}\n\n\t//if (gViewPort)\n\t\t//gViewPort->GetAllPlayersInfo();\n\tgHUD.m_Scoreboard.GetAllPlayersInfo();\n\n\t// Get the Killer's name\n\tconst char *killer_name = g_PlayerInfoList[ killer ].name;\n\tif ( !killer_name )\n\t{\n\t\tkiller_name = \"\";\n\t\trgDeathNoticeList[i].szKiller[0] = 0;\n\t}\n\telse\n\t{\n\t\trgDeathNoticeList[i].KillerColor = GetClientColor( killer );\n\t\tstrncpy( rgDeathNoticeList[i].szKiller, killer_name, MAX_PLAYER_NAME_LENGTH );\n\t\trgDeathNoticeList[i].szKiller[MAX_PLAYER_NAME_LENGTH-1] = 0;\n\t}\n\n\t// Get the Victim's name\n\tconst char *victim_name = NULL;\n\t// If victim is -1, the killer killed a specific, non-player object (like a sentrygun)\n\tif ( ((char)victim) != -1 )\n\t\tvictim_name = g_PlayerInfoList[ victim ].name;\n\tif ( !victim_name )\n\t{\n\t\tvictim_name = \"\";\n\t\trgDeathNoticeList[i].szVictim[0] = 0;\n\t}\n\telse\n\t{\n\t\trgDeathNoticeList[i].VictimColor = GetClientColor( victim );\n\t\tstrncpy( rgDeathNoticeList[i].szVictim, victim_name, MAX_PLAYER_NAME_LENGTH );\n\t\trgDeathNoticeList[i].szVictim[MAX_PLAYER_NAME_LENGTH-1] = 0;\n\t}\n\n\t// Is it a non-player object kill?\n\tif ( ((char)victim) == -1 )\n\t{\n\t\trgDeathNoticeList[i].bNonPlayerKill = true;\n\n\t\t// Store the object's name in the Victim slot (skip the d_ bit)\n\t\tstrncpy( rgDeathNoticeList[i].szVictim, killedwith+2, sizeof(killedwith) );\n\t}\n\telse\n\t{\n\t\tif ( killer == victim || killer == 0 )\n\t\t\trgDeathNoticeList[i].bSuicide = true;\n\n\t\tif ( !strncmp( killedwith, \"d_teammate\", sizeof(killedwith)  ) )\n\t\t\trgDeathNoticeList[i].bTeamKill = true;\n\t}\n\n\trgDeathNoticeList[i].iHeadShotId = headshot;\n\n\t// Find the sprite in the list\n\tint spr = gHUD.GetSpriteIndex( killedwith );\n\n\trgDeathNoticeList[i].iId = spr;\n\n\trgDeathNoticeList[i].flDisplayTime = gHUD.m_flTime + hud_deathnotice_time->value;\n\n\t// Play kill sound\n\tif ((g_PlayerInfoList[killer].thisplayer || g_iUser2 == killer) &&\n\t\t!rgDeathNoticeList[i].bNonPlayerKill &&\n\t\t!rgDeathNoticeList[i].bSuicide &&\n\t\tcl_killsound->value > 0.0f)\n\t{\n\t\tPlaySound(cl_killsound_path->string, cl_killsound->value);\n\t}\n\n\tif (rgDeathNoticeList[i].bNonPlayerKill)\n\t{\n\t\tConsolePrint( rgDeathNoticeList[i].szKiller );\n\t\tConsolePrint( \" killed a \" );\n\t\tConsolePrint( rgDeathNoticeList[i].szVictim );\n\t\tConsolePrint( \"\\n\" );\n\t}\n\telse\n\t{\n\t\t// record the death notice in the console\n\t\tif ( rgDeathNoticeList[i].bSuicide )\n\t\t{\n\t\t\tConsolePrint( rgDeathNoticeList[i].szVictim );\n\n\t\t\tif ( !strncmp( killedwith, \"d_world\", sizeof(killedwith)  ) )\n\t\t\t{\n\t\t\t\tConsolePrint( \" died\" );\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tConsolePrint( \" killed self\" );\n\t\t\t}\n\t\t}\n\t\telse if ( rgDeathNoticeList[i].bTeamKill )\n\t\t{\n\t\t\tConsolePrint( rgDeathNoticeList[i].szKiller );\n\t\t\tConsolePrint( \" killed his teammate \" );\n\t\t\tConsolePrint( rgDeathNoticeList[i].szVictim );\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif( headshot )\n\t\t\t\tConsolePrint( \"*** \");\n\t\t\tConsolePrint( rgDeathNoticeList[i].szKiller );\n\t\t\tConsolePrint( \" killed \" );\n\t\t\tConsolePrint( rgDeathNoticeList[i].szVictim );\n\t\t}\n\n\t\tif ( *killedwith && (*killedwith > 13 ) && strncmp( killedwith, \"d_world\", sizeof(killedwith) ) && !rgDeathNoticeList[i].bTeamKill )\n\t\t{\n\t\t\tif ( headshot )\n\t\t\t\tConsolePrint(\" with a headshot from \");\n\t\t\telse\n\t\t\t\tConsolePrint(\" with \");\n\n\t\t\tConsolePrint( killedwith+2 ); // skip over the \"d_\" part\n\t\t}\n\n\t\tif( headshot ) ConsolePrint( \" ***\");\n\t\tConsolePrint( \"\\n\" );\n\t}\n\n\treturn 1;\n}\n\n\n\n\n"
  },
  {
    "path": "cl_dll/demo.cpp",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\t\n*\tThis product contains software technology licensed from Id \n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc. \n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n#include \"hud.h\"\n#include \"cl_util.h\"\n#include \"demo.h\"\n#include \"demo_api.h\"\n#include <memory.h>\n\nint g_demosniper = 0;\nint g_demosniperdamage = 0;\nfloat g_demosniperorg[3];\nfloat g_demosniperangles[3];\nfloat g_demozoom;\n\n// FIXME:  There should be buffer helper functions to avoid all of the *(int *)& crap.\n\n/*\n=====================\nDemo_WriteBuffer\n\nWrite some data to the demo stream\n=====================\n*/\nvoid Demo_WriteBuffer( int type, int size, unsigned char *buffer )\n{\n\tint pos = 0;\n\tunsigned char buf[ 32 * 1024 ];\n\t*( int * )&buf[pos] = type;\n\tpos+=sizeof( int );\n\n\tmemcpy( &buf[pos], buffer, size );\n\n\t// Write full buffer out\n\tgEngfuncs.pDemoAPI->WriteBuffer( size + sizeof( int ), buf );\n}\n\n/*\n=====================\nDemo_ReadBuffer\n\nEngine wants us to parse some data from the demo stream\n=====================\n*/\nvoid DLLEXPORT Demo_ReadBuffer( int size, unsigned char *buffer )\n{\n\tint type;\n\tint i = 0;\n\n\ttype = *( int * )buffer;\n\ti += sizeof( int );\n\tswitch ( type )\n\t{\n\tcase TYPE_SNIPERDOT:\n\t\tg_demosniper = *(int * )&buffer[ i ];\n\t\ti += sizeof( int );\n\t\t\n\t\tif ( g_demosniper )\n\t\t{\n\t\t\tg_demosniperdamage = *( int * )&buffer[ i ];\n\t\t\ti += sizeof( int );\n\n\t\t\tg_demosniperangles[ 0 ] = *(float *)&buffer[i];\n\t\t\ti += sizeof( float );\n\t\t\tg_demosniperangles[ 1 ] = *(float *)&buffer[i];\n\t\t\ti += sizeof( float );\n\t\t\tg_demosniperangles[ 2 ] = *(float *)&buffer[i];\n\t\t\ti += sizeof( float );\n\t\t\tg_demosniperorg[ 0 ] = *(float *)&buffer[i];\n\t\t\ti += sizeof( float );\n\t\t\tg_demosniperorg[ 1 ] = *(float *)&buffer[i];\n\t\t\ti += sizeof( float );\n\t\t\tg_demosniperorg[ 2 ] = *(float *)&buffer[i];\n\t\t\ti += sizeof( float );\n\t\t}\n\t\tbreak;\n\tcase TYPE_ZOOM:\n\t\tg_demozoom = *(float * )&buffer[ i ];\n\t\ti += sizeof( float );\n\t\tbreak;\n\tdefault:\n\t\tgEngfuncs.Con_DPrintf( \"Unknown demo buffer type, skipping.\\n\" );\n\t\tbreak;\n\t}\n}\n"
  },
  {
    "path": "cl_dll/draw_util.cpp",
    "content": "/*\ndraw_util.cpp - Draw Utils\nCopyright (C) 2016 a1batross\n\nThis program is free software; you can redistribute it and/or modify it\nunder the terms of the GNU General Public License as published by the\nFree Software Foundation; either version 2 of the License, or (at\nyour option) any later version.\n\nThis program is distributed in the hope that it will be useful, but\nWITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\nGeneral Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with this program; if not, write to the Free Software Foundation,\nInc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\n\nIn addition, as a special exception, the author gives permission to\nlink the code of this program with the Half-Life Game Engine (\"HL\nEngine\") and Modified Game Libraries (\"MODs\") developed by Valve,\nL.L.C (\"Valve\").  You must obey the GNU General Public License in all\nrespects for all of the code used other than the HL Engine and MODs\nfrom Valve.  If you modify this file, you may extend this exception\nto your version of the file, but you are not obligated to do so.  If\nyou do not wish to do so, delete this exception statement from your\nversion.\n*/\n\n#include \"hud.h\"\n#include \"cl_util.h\"\n#include \"draw_util.h\"\n#include \"triangleapi.h\"\n#include <string.h>\n#include <ctype.h>\n#include \"utflib.h\"\n#include \"utlvector.h\"\n\nfloat DrawUtils::color[3];\n\n#define IsColorString( p )\t( p && *( p ) == '^' && *(( p ) + 1) && *(( p ) + 1) >= '0' && *(( p ) + 1 ) <= '9' )\n#define ColorIndex( c )\t((( c ) - '0' ) & 7 )\n\n// console color typeing\nbyte g_color_table[][4] =\n{\n{100, 100, 100, 255},\t// should be black, but hud font is additive, so printing black characters is impossible\n{255,   0,   0, 255},\t// red\n{  0, 255,   0, 255},\t// green\n{255, 255,   0, 255},\t// yellow\n{  0,   0, 255, 255},\t// blue\n{  0, 255, 255, 255},\t// cyan\n{255,   0, 255, 255},\t// magenta\n{240, 180,  24, 255},\t// default color (can be changed by user)\n};\n\nint g_codepage = 0;\nqboolean g_accept_utf8;\n\ncvar_t *con_charset;\ncvar_t *cl_charset;\n\n/*\n============================\nCon_UtfProcessChar\n\nConvert utf char to current font's single-byte encoding\n============================\n*/\nint Con_UtfProcessCharForce( int in )\n{\n\t// TODO: get rid of global state where possible\n\tstatic utfstate_t state = { 0 };\n\n\tuint32_t ch = Q_DecodeUTF8( &state, in );\n\n\tif( g_codepage == 1251 )\n\t\treturn Q_UnicodeToCP1251( ch );\n\tif( g_codepage == 1252 )\n\t\treturn Q_UnicodeToCP1252( ch );\n\n\treturn '?'; // not implemented yet\n}\n\nint Con_UtfProcessChar( int in )\n{\n\tif( !g_accept_utf8 ) // incoming character is not a UTF-8 sequence\n\t\treturn in;\n\n\t// otherwise, decode it and convert to selected codepage\n\treturn Con_UtfProcessCharForce( in );\n}\n\nint DrawUtils::DrawHudString( int xpos, int ypos, int iMaxX, const char *str, int r, int g, int b, float scale )\n{\n\tint first_xpos = xpos;\n\tchar *szIt = (char *)str;\n\n\tCon_UtfProcessChar( 0 );\n\n\t// draw the string until we hit the null character or a newline character\n\tfor ( ; *szIt != 0 && *szIt != '\\n'; szIt++ )\n\t{\n\t\tif ( *szIt == '\\\\' && *( szIt + 1 ) != '\\n' && *( szIt + 1 ) != 0 )\n\t\t{\n\t\t\t// an escape character\n\n\t\t\tswitch ( *( ++szIt ) )\n\t\t\t{\n\t\t\tcase 'y':\n\t\t\t\tUnpackRGB( r, g, b, RGB_YELLOWISH );\n\t\t\t\tcontinue;\n\t\t\tcase 'r':\n\t\t\t\tUnpackRGB( r, g, b, RGB_REDISH );\n\t\t\t\tcontinue;\n\t\t\tcase 'w':\n\t\t\t\tUnpackRGB( r, g, b, RGB_WHITE );\n\t\t\t\tcontinue;\n\t\t\tcase 'd':\n\t\t\t\tUnpackRGB( r, g, b, RGB_GRAY );\n\t\t\t\tcontinue;\n\t\t\tcase 'R':\n\t\t\t\txpos = iMaxX - gHUD.GetCharWidth( 'M' ) * 10;\n\t\t\t\t++szIt;\n\t\t\t}\n\t\t}\n\t\telse if( IsColorString( szIt ) )\n\t\t{\n\t\t\tszIt++;\n\t\t\tif( gHUD.hud_colored->value )\n\t\t\t{\n\t\t\t\tr = g_color_table[ColorIndex( *szIt )][0];\n\t\t\t\tg = g_color_table[ColorIndex( *szIt )][1];\n\t\t\t\tb = g_color_table[ColorIndex( *szIt )][2];\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\n\t\tint uch = Con_UtfProcessChar( (unsigned char)*szIt );\n\n\t\tint next = xpos + gHUD.GetCharWidth( uch ); // variable-width fonts look cool\n\n\t\tif ( next > iMaxX && iMaxX > 0 )\n\t\t\treturn xpos;\n\n\t\txpos += TextMessageDrawChar( xpos, ypos, ( unsigned char )*szIt, r, g, b, scale );\n\t}\n\n\treturn xpos;\n}\n\n\nint DrawUtils::DrawHudStringReverse( int xpos, int ypos, int iMinX, const char *szString, int r, int g, int b, float scale )\n{\n\tint first_xpos = xpos;\n\n\tstruct CharEntry {\n\t\tint start, end;\n\t\tint uch;\n\t\tint r, g, b;\n\t};\n\tCUtlVector<CharEntry> chars;\n\n\tint curR = r, curG = g, curB = b;\n\tCon_UtfProcessChar( 0 );\n\n\t// 1. Forward pass to identify characters and their correct colors\n\tfor ( int i = 0; szString[i] != '\\0'; )\n\t{\n\t\tif ( szString[i] == '\\\\' && szString[i + 1] != 0 && szString[i + 1] != '\\n' )\n\t\t{\n\t\t\tswitch ( szString[i + 1] )\n\t\t\t{\n\t\t\tcase 'y': UnpackRGB( curR, curG, curB, RGB_YELLOWISH ); break;\n\t\t\tcase 'r': UnpackRGB( curR, curG, curB, RGB_REDISH ); break;\n\t\t\tcase 'w': UnpackRGB( curR, curG, curB, RGB_WHITE ); break;\n\t\t\tcase 'd': UnpackRGB( curR, curG, curB, RGB_GRAY ); break;\n\t\t\tcase 'R':\n\t\t\t\t// Draw any characters collected so far (to the left of \\R)\n\t\t\t\tfor ( int j = chars.Count() - 1; j >= 0; j-- )\n\t\t\t\t{\n\t\t\t\t\tint width = gHUD.GetCharWidth( chars[j].uch );\n\t\t\t\t\tint next = xpos - width;\n\t\t\t\t\tif ( next < iMinX ) break;\n\t\t\t\t\txpos = next;\n\t\t\t\t\tint drawX = xpos;\n\t\t\t\t\tfor ( int k = chars[j].start; k <= chars[j].end; k++ )\n\t\t\t\t\t\tdrawX += TextMessageDrawChar( drawX, ypos, ( unsigned char )szString[k], chars[j].r, chars[j].g, chars[j].b, scale );\n\t\t\t\t}\n\t\t\t\tchars.Purge();\n\t\t\t\t// Draw the rest of the string forward from the left\n\t\t\t\treturn DrawHudString( iMinX, ypos, first_xpos, &szString[i+2], curR, curG, curB, scale );\n\t\t\t}\n\t\t\ti += 2;\n\t\t\tcontinue;\n\t\t}\n\t\telse if ( IsColorString( &szString[i] ) )\n\t\t{\n\t\t\tif ( gHUD.hud_colored->value )\n\t\t\t{\n\t\t\t\tcurR = g_color_table[ColorIndex( szString[i + 1] )][0];\n\t\t\t\tcurG = g_color_table[ColorIndex( szString[i + 1] )][1];\n\t\t\t\tcurB = g_color_table[ColorIndex( szString[i + 1] )][2];\n\t\t\t}\n\t\t\ti += 2;\n\t\t\tcontinue;\n\t\t}\n\n\t\t// Identify the character boundary\n\t\tint start = i;\n\t\tint next_i = i + 1;\n\t\tif ( g_accept_utf8 )\n\t\t{\n\t\t\twhile( szString[next_i] != '\\0' && (unsigned char)szString[next_i] >= 0x80 && (unsigned char)szString[next_i] <= 0xBF )\n\t\t\t\tnext_i++;\n\t\t}\n\n\t\t// Decode the character to get its width-code\n\t\tCon_UtfProcessChar( 0 );\n\t\tint uch = 0;\n\t\tfor ( int j = start; j < next_i; j++ )\n\t\t\tuch = Con_UtfProcessChar( (unsigned char)szString[j] );\n\n\t\tif ( uch )\n\t\t{\n\t\t\tCharEntry entry;\n\t\t\tentry.start = start;\n\t\t\tentry.end = next_i - 1;\n\t\t\tentry.uch = uch;\n\t\t\tentry.r = curR;\n\t\t\tentry.g = curG;\n\t\t\tentry.b = curB;\n\t\t\tchars.AddToTail( entry );\n\t\t}\n\t\ti = next_i;\n\t}\n\n\t// 2. Backward pass to draw collected characters\n\tfor ( int i = chars.Count() - 1; i >= 0; i-- )\n\t{\n\t\tint width = gHUD.GetCharWidth( chars[i].uch );\n\t\tint next = xpos - width;\n\n\t\tif ( next < iMinX )\n\t\t\treturn xpos;\n\n\t\txpos = next;\n\n\t\t// Draw all bytes of this character in forward order\n\t\tint drawX = xpos;\n\t\tfor ( int j = chars[i].start; j <= chars[i].end; j++ )\n\t\t\tdrawX += TextMessageDrawChar( drawX, ypos, ( unsigned char )szString[j], chars[i].r, chars[i].g, chars[i].b, scale );\n\t}\n\n\treturn xpos;\n}\n\nint DrawUtils::DrawHudNumber( int x, int y, int iFlags, int iNumber, int r, int g, int b )\n{\n\tint iWidth = gHUD.GetSpriteRect( gHUD.m_HUD_number_0 ).Width();\n\tint k;\n\n\tif ( iNumber > 0 )\n\t{\n\t\t// SPR_Draw 100's\n\t\tif ( iNumber >= 100 )\n\t\t{\n\t\t\tk = iNumber / 100;\n\t\t\tSPR_Set( gHUD.GetSprite( gHUD.m_HUD_number_0 + k ), r, g, b );\n\t\t\tSPR_DrawAdditive( 0, x, y, &gHUD.GetSpriteRect( gHUD.m_HUD_number_0 + k ) );\n\t\t\tx += iWidth;\n\t\t}\n\t\telse if ( iFlags & ( DHN_3DIGITS ) )\n\t\t{\n\t\t\t//SPR_DrawAdditive( 0, x, y, &rc );\n\t\t\tx += iWidth;\n\t\t}\n\n\t\t// SPR_Draw 10's\n\t\tif ( iNumber >= 10 )\n\t\t{\n\t\t\tk = ( iNumber % 100 ) / 10;\n\t\t\tSPR_Set( gHUD.GetSprite( gHUD.m_HUD_number_0 + k ), r, g, b );\n\t\t\tSPR_DrawAdditive( 0, x, y, &gHUD.GetSpriteRect( gHUD.m_HUD_number_0 + k ) );\n\t\t\tx += iWidth;\n\t\t}\n\t\telse if ( iFlags & ( DHN_3DIGITS | DHN_2DIGITS ) )\n\t\t{\n\t\t\t//SPR_DrawAdditive( 0, x, y, &rc );\n\t\t\tx += iWidth;\n\t\t}\n\n\t\t// SPR_Draw ones\n\t\tk = iNumber % 10;\n\t\tSPR_Set( gHUD.GetSprite( gHUD.m_HUD_number_0 + k ), r, g, b );\n\t\tSPR_DrawAdditive( 0, x, y, &gHUD.GetSpriteRect( gHUD.m_HUD_number_0 + k ) );\n\t\tx += iWidth;\n\t}\n\telse if ( iFlags & DHN_DRAWZERO )\n\t{\n\t\tSPR_Set( gHUD.GetSprite( gHUD.m_HUD_number_0 ), r, g, b );\n\n\t\t// SPR_Draw 100's\n\t\tif ( iFlags & ( DHN_3DIGITS ) )\n\t\t{\n\t\t\t//SPR_DrawAdditive( 0, x, y, &rc );\n\t\t\tx += iWidth;\n\t\t}\n\n\t\tif ( iFlags & ( DHN_3DIGITS | DHN_2DIGITS ) )\n\t\t{\n\t\t\t//SPR_DrawAdditive( 0, x, y, &rc );\n\t\t\tx += iWidth;\n\t\t}\n\n\t\t// SPR_Draw ones\n\n\t\tSPR_DrawAdditive( 0, x, y, &gHUD.GetSpriteRect( gHUD.m_HUD_number_0 ) );\n\t\tx += iWidth;\n\t}\n\n\treturn x;\n}\n\nint DrawUtils::DrawHudNumber2( int x, int y, bool DrawZero, int iDigits, int iNumber, int r, int g, int b )\n{\n\tint iWidth = gHUD.GetSpriteRect( gHUD.m_HUD_number_0 ).Width();\n\tx += ( iDigits - 1 ) * iWidth;\n\n\tint ResX = x + iWidth;\n\tdo\n\t{\n\t\tint k = iNumber % 10;\n\t\tiNumber /= 10;\n\t\tSPR_Set( gHUD.GetSprite( gHUD.m_HUD_number_0 + k ), r, g, b );\n\t\tSPR_DrawAdditive( 0, x, y, &gHUD.GetSpriteRect( gHUD.m_HUD_number_0 + k ) );\n\t\tx -= iWidth;\n\t\tiDigits--;\n\t} while ( iNumber > 0 || ( iDigits > 0 && DrawZero ) );\n\n\treturn ResX;\n}\n\nint DrawUtils::DrawHudNumber2( int x, int y, int iNumber, int r, int g, int b )\n{\n\tint iWidth = gHUD.GetSpriteRect( gHUD.m_HUD_number_0 ).Width();\n\n\tint iDigits = 0;\n\tint temp    = iNumber;\n\tdo\n\t{\n\t\tiDigits++;\n\t\ttemp /= 10;\n\t} while ( temp > 0 );\n\n\tx += ( iDigits - 1 ) * iWidth;\n\n\tint ResX = x + iWidth;\n\tdo\n\t{\n\t\tint k = iNumber % 10;\n\t\tiNumber /= 10;\n\t\tSPR_Set( gHUD.GetSprite( gHUD.m_HUD_number_0 + k ), r, g, b );\n\t\tSPR_DrawAdditive( 0, x, y, &gHUD.GetSpriteRect( gHUD.m_HUD_number_0 + k ) );\n\t\tx -= iWidth;\n\t} while ( iNumber > 0 );\n\n\treturn ResX;\n}\n\nvoid DrawUtils::Draw2DQuad( float x1, float y1, float x2, float y2 )\n{\n\t// REMOVE WHEN NANOGL BUG WILL BE FIXED\n\tgEngfuncs.pTriAPI->Begin( TRI_QUADS );\n\t// REMOVE WHEN NANOGL BUG WILL BE FIXED\n\n\tgEngfuncs.pTriAPI->TexCoord2f( 0, 0 );\n\tgEngfuncs.pTriAPI->Vertex3f( x1, y1, 0 );\n\n\tgEngfuncs.pTriAPI->TexCoord2f( 0, 1 );\n\tgEngfuncs.pTriAPI->Vertex3f( x1, y2, 0 );\n\n\tgEngfuncs.pTriAPI->TexCoord2f( 1, 1 );\n\tgEngfuncs.pTriAPI->Vertex3f( x2, y2, 0 );\n\n\tgEngfuncs.pTriAPI->TexCoord2f( 1, 0 );\n\tgEngfuncs.pTriAPI->Vertex3f( x2, y1, 0 );\n\n\t// REMOVE WHEN NANOGL BUG WILL BE FIXED\n\tgEngfuncs.pTriAPI->End( );\n\t// REMOVE WHEN NANOGL BUG WILL BE FIXED\n\n}\n\nint DrawUtils::HudStringLen( const char *szIt, float scale )\n{\n\tint l;\n\n\tCon_UtfProcessChar( 0 );\n\n\t// count length until we hit the null character or a newline character\n\tfor ( l = 0; *szIt != 0 && *szIt != '\\n'; szIt++ )\n\t{\n\t\tif( szIt[0] == '\\\\' && szIt[1] != '\\n' &&\n\t\t\t(szIt[1] == 'y' || szIt[1] == 'w' || szIt[1] == 'd' || szIt[1] == 'R') ) // not sure is reversing handled correctly\n\t\t{\n\t\t\tszIt++;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif( szIt[0] == '^' && isdigit( szIt[1] ) ) // suck down, unreadable nicknames. Check even if hud_colored is off\n\t\t{\n\t\t\tszIt++;\n\t\t\tcontinue;\n\t\t}\n\n\t\tint uch = Con_UtfProcessChar( (unsigned char)*szIt );\n\n\t\tif ( !uch )\n\t\t\tcontinue;\n\n\t\tl += gHUD.GetCharWidth( uch );\n\t}\n\n\treturn l;\n}\n"
  },
  {
    "path": "cl_dll/entity.cpp",
    "content": "//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============\n//\n// Purpose: \n//\n// $NoKeywords: $\n//=============================================================================\n\n// Client side entity management functions\n\n#include <memory.h>\n\n#include \"hud.h\"\n#include \"pm_defs.h\"\n#include \"pmtrace.h\"\n#include \"pm_shared.h\"\n#include \"cl_util.h\"\n#include \"const.h\"\n#include \"entity_types.h\"\n#include \"studio_event.h\" // def. of mstudioevent_t\n#include \"r_efx.h\"\n#include \"event_api.h\"\n#include \"com_model.h\"\n#include \"view.h\"\n#include \"eventscripts.h\"\n#include \"com_weapons.h\"\n#include \"ev_hldm.h\"\n\nextern vec3_t v_origin;\n\nint iOnTrain[MAX_PLAYERS];\n\n/*\n========================\nHUD_AddEntity\n\tReturn 0 to filter entity from visible list for rendering\n========================\n*/\nint DLLEXPORT HUD_AddEntity( int type, struct cl_entity_s *ent, const char *modelname )\n{\n\tswitch ( type )\n\t{\n\tcase ET_NORMAL:\n\tcase ET_PLAYER:\n\t\tif( ent->player && iOnTrain[ent->index] )\n\t\t{\n\t\t\tVectorCopy(ent->curstate.origin, ent->origin);\n\t\t\tVectorCopy(ent->curstate.angles, ent->angles);\n\t\t}\n\t\tbreak;\n\tcase ET_BEAM:\n\tcase ET_TEMPENTITY:\n\tcase ET_FRAGMENTED:\n\tdefault:\n\t\tbreak;\n\t}\n\t// each frame every entity passes this function, so the overview hooks it to filter the overview entities\n\t// in spectator mode:\n\t// each frame every entity passes this function, so the overview hooks \n\t// it to filter the overview entities\n\n\tif ( g_iUser1 )\n\t{\n\t\tgHUD.m_Spectator.AddOverviewEntity( type, ent, modelname );\n\n\t\tif ( (\tg_iUser1 == OBS_IN_EYE || gHUD.m_Spectator.m_pip->value == INSET_IN_EYE ) &&\n\t\t\t\tent->index == g_iUser2 )\n\t\t\treturn 0;\t// don't draw the player we are following in eye\n\n\t}\n\n\treturn 1;\n}\n\n/*\n=========================\nHUD_TxferLocalOverrides\n\nThe server sends us our origin with extra precision as part of the clientdata structure, not during the normal\nplayerstate update in entity_state_t.  In order for these overrides to eventually get to the appropriate playerstate\nstructure, we need to copy them into the state structure at this point.\n=========================\n*/\nvoid DLLEXPORT HUD_TxferLocalOverrides( struct entity_state_s *state, const struct clientdata_s *client )\n{\n\tVectorCopy( client->origin, state->origin );\n\n\t// Spectator\n\tstate->iuser1 = client->iuser1;\n\tstate->iuser2 = client->iuser2;\n\n\t// Duck prevention\n\tstate->iuser3 = client->iuser3;\n\n\t// Fire prevention\n\tstate->iuser4 = client->iuser4;\n}\n\n/*\n=========================\nHUD_ProcessPlayerState\n\nWe have received entity_state_t for this player over the network.  We need to copy appropriate fields to the\nplayerstate structure\n=========================\n*/\nvoid DLLEXPORT HUD_ProcessPlayerState( struct entity_state_s *dst, const struct entity_state_s *src )\n{\n\t// Copy in network data\n\tVectorCopy( src->origin, dst->origin );\n\tVectorCopy( src->angles, dst->angles );\n\n\tVectorCopy( src->velocity, dst->velocity );\n\n\tdst->frame\t\t\t\t\t= src->frame;\n\tdst->modelindex\t\t\t\t= src->modelindex;\n\tdst->skin\t\t\t\t\t= src->skin;\n\tdst->effects\t\t\t\t= src->effects;\n\tdst->weaponmodel\t\t\t= src->weaponmodel;\n\tdst->movetype\t\t\t\t= src->movetype;\n\tdst->sequence\t\t\t\t= src->sequence;\n\tdst->animtime\t\t\t\t= src->animtime;\n\t\n\tdst->solid\t\t\t\t\t= src->solid;\n\t\n\tdst->rendermode\t\t\t\t= src->rendermode;\n\tdst->renderamt\t\t\t\t= src->renderamt;\t\n\tdst->rendercolor.r\t\t\t= src->rendercolor.r;\n\tdst->rendercolor.g\t\t\t= src->rendercolor.g;\n\tdst->rendercolor.b\t\t\t= src->rendercolor.b;\n\tdst->renderfx\t\t\t\t= src->renderfx;\n\n\tdst->framerate\t\t\t\t= src->framerate;\n\tdst->body\t\t\t\t\t= src->body;\n\n\tmemcpy( &dst->controller[0], &src->controller[0], 4 * sizeof( byte ) );\n\tmemcpy( &dst->blending[0], &src->blending[0], 2 * sizeof( byte ) );\n\n\tVectorCopy( src->basevelocity, dst->basevelocity );\n\n\tdst->friction\t\t\t\t= src->friction;\n\tdst->gravity\t\t\t\t= src->gravity;\n\tdst->gaitsequence\t\t\t= src->gaitsequence;\n\tdst->spectator\t\t\t\t= src->spectator;\n\tdst->usehull\t\t\t\t= src->usehull;\n\tdst->playerclass\t\t\t= src->playerclass;\n\tdst->team\t\t\t\t\t= src->team;\n\tdst->colormap\t\t\t\t= src->colormap;\n\n\t// Save off some data so other areas of the Client DLL can get to it\n\tcl_entity_t *player = gEngfuncs.GetLocalPlayer();\t// Get the local player's index\n\tif( dst->number == player->index )\n\t{\n\t\tg_iTeamNumber = g_PlayerExtraInfo[dst->number].teamnumber;\n\n\t\tdst->iuser1 = g_iUser1 = src->iuser1;\n\t\tdst->iuser2 = g_iUser2 = src->iuser2;\n\t\tdst->iuser3 = g_iUser3 = src->iuser3;\n\t}\n\tdst->fuser2\t\t\t\t\t= src->fuser2;\n\tif( src->number > 0 && src->number < MAX_PLAYERS )\n\t{\n\t\tiOnTrain[src->number]\t\t= src->iuser4;\n\t}\n}\n\n/*\n=========================\nHUD_TxferPredictionData\n\nBecause we can predict an arbitrary number of frames before the server responds with an update, we need to be able to copy client side prediction data in\n from the state that the server ack'd receiving, which can be anywhere along the predicted frame path ( i.e., we could predict 20 frames into the future and the server ack's\n up through 10 of those frames, so we need to copy persistent client-side only state from the 10th predicted frame to the slot the server\n update is occupying.\n=========================\n*/\nvoid DLLEXPORT HUD_TxferPredictionData ( struct entity_state_s *ps, const struct entity_state_s *pps, struct clientdata_s *pcd, const struct clientdata_s *ppcd, struct weapon_data_s *wd, const struct weapon_data_s *pwd )\n{\n\tps->oldbuttons = pps->oldbuttons;\n\tps->flFallVelocity = pps->flFallVelocity;\n\tps->iStepLeft = pps->iStepLeft;\n\tps->playerclass\t= pps->playerclass;\n\tps->iuser4 = pps->iuser4;\n\n\tpcd->viewmodel = ppcd->viewmodel;\n\tpcd->m_iId = ppcd->m_iId;\n\tpcd->ammo_shells = ppcd->ammo_shells;\n\tpcd->ammo_nails\t= ppcd->ammo_nails;\n\tpcd->ammo_cells\t= ppcd->ammo_cells;\n\tpcd->ammo_rockets = ppcd->ammo_rockets;\n\tpcd->m_flNextAttack\t= ppcd->m_flNextAttack;\n\tpcd->fov = ppcd->fov;\n\tpcd->weaponanim = ppcd->weaponanim;\n\tpcd->tfstate = ppcd->tfstate;\n\tpcd->maxspeed = ppcd->maxspeed;\n\tpcd->deadflag = ppcd->deadflag;\n\tif( gEngfuncs.IsSpectateOnly() )\n\t{\n\t\tpcd->iuser1 = g_iUser1;\t// observer mode\n\t\tpcd->iuser2 = g_iUser2; // first target\n\t\tpcd->iuser3 = g_iUser3; // second target\n\t}\n\telse\n\t{\n\t\tpcd->iuser1\t= ppcd->iuser1;\n\t\tpcd->iuser2\t= ppcd->iuser2;\n\t\tpcd->iuser3 = ppcd->iuser3;\n\t}\n\tpcd->iuser4 = ppcd->iuser4;\n\tpcd->fuser2\t= ppcd->fuser2;\n\tpcd->fuser3\t= ppcd->fuser3;\n\tpcd->vuser2 = ppcd->vuser2;\n\tpcd->vuser3 = ppcd->vuser3;\n\tpcd->vuser4 = ppcd->vuser4;\n\n\tmemcpy( wd, pwd, sizeof( weapon_data_t ) * 32 );\n}\n\n/*\n=========================\nHUD_CreateEntities\n\t\nGives us a chance to add additional entities to the render this frame\n=========================\n*/\nvoid DLLEXPORT HUD_CreateEntities( void )\n{\n\t// Add in any game specific objects\n\n\tGetClientVoiceHud()->CreateEntities();\n}\n\n/*\n==============\nCL_MuzzleFlash\n\nDo muzzleflash\n==============\n*/\n// TODO: Broken!\n#define MAX_MUZZLEFLASH 4\nvoid CL_MuzzleFlash( cl_entity_t *entity, vec3_t pos, int type )\n{\n\tconst char *muzzleflash;\n\n\tTEMPENTITY\t*pTemp;\n\tint\t\tindex, frameCount;\n\tfloat\t\tscale;\n\n\textern int g_weaponselect_frames;\n\tif( g_weaponselect_frames )\n\t\treturn;\n\n\tindex = bound( 0, type % 5, MAX_MUZZLEFLASH - 1 );\n\tscale = (type / 10) * 0.1f;\n\tif( scale == 0.0f ) scale = 0.5f;\n\n\tswitch( index )\n\t{\n\tcase 0:\n\t\tmuzzleflash = \"sprites/muzzleflash1.spr\";\n\t\tbreak;\n\tcase 1:\n\t\tmuzzleflash = \"sprites/muzzleflash2.spr\";\n\t\tbreak;\n\tcase 2:\n\t\tmuzzleflash = \"sprites/muzzleflash3.spr\";\n\t\tbreak;\n\tcase 3:\n\t\tmuzzleflash = \"sprites/muzzleflash.spr\";\n\t\tbreak;\n\t}\n\n\tmodel_t *model = gEngfuncs.CL_LoadModel( muzzleflash, 0 );\n\tif( !model ) return;\n\n\tframeCount = model->numframes;\n\n\t// must set position for right culling on render\n\tpTemp = gEngfuncs.pEfxAPI->CL_TempEntAllocHigh( pos, model );\n\tif( !pTemp ) return;\n\tpTemp->entity.curstate.rendermode = kRenderTransAdd;\n\tpTemp->entity.curstate.renderamt = 255;\n\tpTemp->entity.curstate.framerate = 10;\n\tpTemp->entity.curstate.renderfx = 0;\n\tpTemp->die = gEngfuncs.GetClientTime() + gHUD.m_flTimeDelta * 1.5f; // die at next frame\n\tpTemp->entity.curstate.frame = Com_RandomLong( 0, frameCount - 1 );\n\tpTemp->flags |= FTENT_SPRANIMATE|FTENT_SPRANIMATELOOP;\n\tpTemp->frameMax = frameCount - 1;\n\n\tif( index == 0 )\n\t{\n\t\t// Rifle flash\n\t\tpTemp->entity.curstate.scale = scale * Com_RandomFloat( 0.5f, 0.6f );\n\t\tpTemp->entity.angles[2] = 90 * Com_RandomLong( 0, 3 );\n\t}\n\telse\n\t{\n\t\tpTemp->entity.curstate.scale = scale;\n\t\tpTemp->entity.angles[2] = Com_RandomLong( 0, 359 );\n\t}\n\n\tif( gHUD.cl_gunsmoke->value && EV_IsLocal( entity->index ))\n\t{\n\t\tVector smoke_origin = pos;\n\t\tVector forward;\n\n\t\tAngleVectors( v_angles, forward, NULL, NULL );\n\n\t\tfloat scale = pTemp->entity.curstate.scale;\n\n\t\tTEMPENTITY *te;\n\t\tif( index == 1 )\n\t\t{\n\t\t\tte = EV_CS16Client_CreateSmoke( SMOKE_PISTOL, smoke_origin, forward, 0,  scale, 7,7,7, false, g_vPlayerVelocity );\n\t\t\tif( te ) te->entity.angles[2] = pTemp->entity.angles[2];\n\t\t\tte = EV_CS16Client_CreateSmoke( SMOKE_PISTOL, smoke_origin, forward, 20, scale + 0.1, 10,10,10, false, g_vPlayerVelocity );\n\t\t\tif( te ) te->entity.angles[2] = pTemp->entity.angles[2];\n\t\t\tte = EV_CS16Client_CreateSmoke( SMOKE_PISTOL, smoke_origin, forward, 40, scale, 13,13,13, false, g_vPlayerVelocity );\n\t\t\tif( te ) te->entity.angles[2] = pTemp->entity.angles[2];\n\t\t}\n\t\telse\n\t\t{\n\t\t\tte = EV_CS16Client_CreateSmoke( SMOKE_RIFLE, smoke_origin, forward, 3, scale, 20, 20, 20, false, g_vPlayerVelocity );\n\n\t\t\tif( te ) te->entity.angles[2] = pTemp->entity.angles[2];\n\t\t}\n\t}\n}\n\n/*\n=========================\nHUD_StudioEvent\n\nThe entity's studio model description indicated an event was\nfired during this frame, handle the event by it's tag ( e.g., muzzleflash, sound )\n=========================\n*/\nvoid DLLEXPORT HUD_StudioEvent( const struct mstudioevent_s *event, struct cl_entity_s *entity )\n{\n// #define CL_MuzzleFlash( x, y, z ) gEngfuncs.pEfxAPI->R_MuzzleFlash( y, z )\n\tswitch( event->event )\n\t{\n\tcase 5001:\n\t\tgEngfuncs.pEfxAPI->R_MuzzleFlash( (float *)&entity->attachment[0], atoi( event->options) );\n\t\t// CL_MuzzleFlash( entity, (float *)&entity->attachment[0], atoi( event->options) );\n\t\tbreak;\n\tcase 5011:\n\t\tgEngfuncs.pEfxAPI->R_MuzzleFlash( (float *)&entity->attachment[1], atoi( event->options) );\n\t\t// CL_MuzzleFlash( entity, (float *)&entity->attachment[1], atoi( event->options) );\n\t\tbreak;\n\tcase 5021:\n\t\tgEngfuncs.pEfxAPI->R_MuzzleFlash( (float *)&entity->attachment[2], atoi( event->options) );\n\t\t// CL_MuzzleFlash( entity, (float *)&entity->attachment[2], atoi( event->options) );\n\t\tbreak;\n\tcase 5031:\n\t\tgEngfuncs.pEfxAPI->R_MuzzleFlash( (float *)&entity->attachment[3], atoi( event->options) );\n\t\t// CL_MuzzleFlash( entity, (float *)&entity->attachment[3], atoi( event->options) );\n\t\tbreak;\n\tcase 5002:\n\t\tgEngfuncs.pEfxAPI->R_SparkEffect( (float *)&entity->attachment[0], atoi( event->options), -100, 100 );\n\t\tbreak;\n\t// Client side sound\n\tcase 5004:\t\t\n\t\tif( entity == gEngfuncs.GetLocalPlayer() ||\n\t\t\tentity == gEngfuncs.GetViewModel() )\n\t\t{\n\t\t\tgEngfuncs.pfnPlaySoundByName( (char *)event->options, 1.0 );\n\t\t}\n\t\telse\n\t\t{\n\t\t\tgEngfuncs.pfnPlaySoundByNameAtLocation( (char *)event->options, 1.0, (float *)&entity->attachment[0] );\n\t\t}\n\t\tbreak;\n\tdefault:\n\t\tbreak;\n\t}\n}\n\n/*\n=================\nCL_UpdateTEnts\n\nSimulation and cleanup of temporary entities\n=================\n*/\nvoid DLLEXPORT HUD_TempEntUpdate (\n\tdouble frametime,   // Simulation time\n\tdouble client_time, // Absolute time on client\n\tdouble cl_gravity,  // True gravity on client\n\tTEMPENTITY **ppTempEntFree,   // List of freed temporary ents\n\tTEMPENTITY **ppTempEntActive, // List \n\tint\t\t( *Callback_AddVisibleEntity )( cl_entity_t *pEntity ),\n\tvoid\t( *Callback_TempEntPlaySound )( TEMPENTITY *pTemp, float damp ) )\n{\n\tstatic int gTempEntFrame = 0;\n\tint\t\t\ti;\n\tTEMPENTITY\t*pTemp, *pnext, *pprev;\n\tfloat\t\tgravity, gravitySlow, life, fastFreq;\n\n\t// g_flGravity = cl_gravity;\n\n/*\n\tif ( g_pParticleMan )\n\t\tg_pParticleMan->SetVariables( cl_gravity, vAngles );\n*/\n\n\t// Nothing to simulate\n\tif ( !*ppTempEntActive )\t\t\n\t\treturn;\n\n\t// in order to have tents collide with players, we have to run the player prediction code so\n\t// that the client has the player list. We run this code once when we detect any COLLIDEALL \n\t// tent, then set this BOOL to true so the code doesn't get run again if there's more than\n\t// one COLLIDEALL ent for this update. (often are).\n\tgEngfuncs.pEventAPI->EV_SetUpPlayerPrediction( false, true );\n\n\t// Store off the old count\n\tgEngfuncs.pEventAPI->EV_PushPMStates();\n\n\t// Now add in all of the players.\n\tgEngfuncs.pEventAPI->EV_SetSolidPlayers ( -1 );\t\n\n\t// !!!BUGBUG\t-- This needs to be time based\n\tgTempEntFrame = (gTempEntFrame+1) & 31;\n\n\tpTemp = *ppTempEntActive;\n\n\t// !!! Don't simulate while paused....  This is sort of a hack, revisit.\n\tif ( frametime <= 0.0 )\n\t{\n\t\twhile ( pTemp )\n\t\t{\n\t\t\tif ( !(pTemp->flags & FTENT_NOMODEL ) )\n\t\t\t{\n\t\t\t\tCallback_AddVisibleEntity( &pTemp->entity );\n\t\t\t}\n\t\t\tpTemp = pTemp->next;\n\t\t}\n\t\tgoto finish;\n\t}\n\n\tpprev = NULL;\n\tfastFreq = client_time * 5.5;\n\tgravity = -frametime * cl_gravity;\n\tgravitySlow = gravity * 0.5;\n\n\twhile ( pTemp )\n\t{\n\t\tint active;\n\n\t\tactive = 1;\n\n\t\tlife = pTemp->die - client_time;\n\t\tpnext = pTemp->next;\n\t\tif ( life < 0 )\n\t\t{\n\t\t\tif ( pTemp->flags & FTENT_FADEOUT )\n\t\t\t{\n\t\t\t\tif (pTemp->entity.curstate.rendermode == kRenderNormal)\n\t\t\t\t\tpTemp->entity.curstate.rendermode = kRenderTransTexture;\n\t\t\t\tpTemp->entity.curstate.renderamt = pTemp->entity.baseline.renderamt * ( 1 + life * pTemp->fadeSpeed );\n\t\t\t\tif ( pTemp->entity.curstate.renderamt <= 0 )\n\t\t\t\t\tactive = 0;\n\n\t\t\t}\n\t\t\telse \n\t\t\t\tactive = 0;\n\t\t}\n\t\tif ( !active )\t\t// Kill it\n\t\t{\n\t\t\tpTemp->next = *ppTempEntFree;\n\t\t\t*ppTempEntFree = pTemp;\n\t\t\tif ( !pprev )\t// Deleting at head of list\n\t\t\t\t*ppTempEntActive = pnext;\n\t\t\telse\n\t\t\t\tpprev->next = pnext;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tpprev = pTemp;\n\t\t\t\n\t\t\tVectorCopy( pTemp->entity.origin, pTemp->entity.prevstate.origin );\n\n\t\t\tif ( pTemp->flags & FTENT_SPARKSHOWER )\n\t\t\t{\n\t\t\t\t// Adjust speed if it's time\n\t\t\t\t// Scale is next think time\n\t\t\t\tif ( client_time > pTemp->entity.baseline.scale )\n\t\t\t\t{\n\t\t\t\t\t// Show Sparks\n\t\t\t\t\tgEngfuncs.pEfxAPI->R_SparkEffect( pTemp->entity.origin, 8, -200, 200 );\n\n\t\t\t\t\t// Reduce life\n\t\t\t\t\tpTemp->entity.baseline.framerate -= 0.1;\n\n\t\t\t\t\tif ( pTemp->entity.baseline.framerate <= 0.0 )\n\t\t\t\t\t{\n\t\t\t\t\t\tpTemp->die = client_time;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\t// So it will die no matter what\n\t\t\t\t\t\tpTemp->die = client_time + 0.5;\n\n\t\t\t\t\t\t// Next think\n\t\t\t\t\t\tpTemp->entity.baseline.scale = client_time + 0.1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if ( pTemp->flags & FTENT_PLYRATTACHMENT )\n\t\t\t{\n\t\t\t\tcl_entity_t *pClient;\n\n\t\t\t\tpClient = gEngfuncs.GetEntityByIndex( pTemp->clientIndex );\n\n\t\t\t\tVectorAdd( pClient->origin, pTemp->tentOffset, pTemp->entity.origin );\n\t\t\t}\n\t\t\telse if ( pTemp->flags & FTENT_SINEWAVE )\n\t\t\t{\n\t\t\t\tpTemp->x += pTemp->entity.baseline.origin[0] * frametime;\n\t\t\t\tpTemp->y += pTemp->entity.baseline.origin[1] * frametime;\n\n\t\t\t\tpTemp->entity.origin[0] = pTemp->x + sin( pTemp->entity.baseline.origin[2] + client_time * pTemp->entity.prevstate.frame ) * (10*pTemp->entity.curstate.framerate);\n\t\t\t\tpTemp->entity.origin[1] = pTemp->y + sin( pTemp->entity.baseline.origin[2] + fastFreq + 0.7 ) * (8*pTemp->entity.curstate.framerate);\n\t\t\t\tpTemp->entity.origin[2] += pTemp->entity.baseline.origin[2] * frametime;\n\t\t\t}\n\t\t\telse if ( pTemp->flags & FTENT_SPIRAL )\n\t\t\t{\n\t\t\t\t/*\n\t\t\t\tfloat s, c;\n\t\t\t\ts = sin( pTemp->entity.baseline.origin[2] + fastFreq );\n\t\t\t\tc = cos( pTemp->entity.baseline.origin[2] + fastFreq );\n\t\t\t\t*/\n\n\t\t\t\tpTemp->entity.origin[0] += pTemp->entity.baseline.origin[0] * frametime + 8 * sin( client_time * 20 + (long long)(void*)pTemp );\n\t\t\t\tpTemp->entity.origin[1] += pTemp->entity.baseline.origin[1] * frametime + 4 * sin( client_time * 30 + (long long)(void*)pTemp );\n\t\t\t\tpTemp->entity.origin[2] += pTemp->entity.baseline.origin[2] * frametime;\n\t\t\t}\n\t\t\t\n\t\t\telse \n\t\t\t{\n\t\t\t\tfor ( i = 0; i < 3; i++ ) \n\t\t\t\t\tpTemp->entity.origin[i] += pTemp->entity.baseline.origin[i] * frametime;\n\t\t\t}\n\t\t\t\n\t\t\tif ( pTemp->flags & FTENT_SPRANIMATE )\n\t\t\t{\n\t\t\t\tpTemp->entity.curstate.frame += frametime * pTemp->entity.curstate.framerate;\n\t\t\t\tif ( pTemp->entity.curstate.frame >= pTemp->frameMax )\n\t\t\t\t{\n\t\t\t\t\tpTemp->entity.curstate.frame = pTemp->entity.curstate.frame - (int)(pTemp->entity.curstate.frame);\n\n\t\t\t\t\tif ( pTemp->flags & 0x100000 )\n\t\t\t\t\t{\n\t\t\t\t\t\tpTemp = pnext;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( !(pTemp->flags & FTENT_SPRANIMATELOOP) )\n\t\t\t\t\t{\n\t\t\t\t\t\t// this animating sprite isn't set to loop, so destroy it.\n\t\t\t\t\t\tpTemp->die = client_time;\n\t\t\t\t\t\tpTemp = pnext;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if ( pTemp->flags & FTENT_SPRCYCLE )\n\t\t\t{\n\t\t\t\tpTemp->entity.curstate.frame += frametime * 10;\n\t\t\t\tif ( pTemp->entity.curstate.frame >= pTemp->frameMax )\n\t\t\t\t{\n\t\t\t\t\tpTemp->entity.curstate.frame = pTemp->entity.curstate.frame - (int)(pTemp->entity.curstate.frame);\n\t\t\t\t}\n\t\t\t}\n// Experiment\n#if 0\n\t\t\tif ( pTemp->flags & FTENT_SCALE )\n\t\t\t\tpTemp->entity.curstate.framerate += 20.0 * (frametime / pTemp->entity.curstate.framerate);\n#endif\n\n\t\t\tif ( pTemp->flags & FTENT_ROTATE )\n\t\t\t{\n\t\t\t\tpTemp->entity.angles[0] += pTemp->entity.baseline.angles[0] * frametime;\n\t\t\t\tpTemp->entity.angles[1] += pTemp->entity.baseline.angles[1] * frametime;\n\t\t\t\tpTemp->entity.angles[2] += pTemp->entity.baseline.angles[2] * frametime;\n\n\t\t\t\tVectorCopy( pTemp->entity.angles, pTemp->entity.latched.prevangles );\n\t\t\t}\n\n\t\t\tif ( pTemp->flags & (FTENT_COLLIDEALL | FTENT_COLLIDEWORLD) && !( pTemp->flags & FTENT_BODYGRAVITY ))\n\t\t\t{\n\t\t\t\tvec3_t\ttraceNormal;\n\t\t\t\tfloat\ttraceFraction = 1;\n\n\t\t\t\tif ( pTemp->flags & FTENT_COLLIDEALL )\n\t\t\t\t{\n\t\t\t\t\tpmtrace_t pmtrace;\n\t\t\t\t\tphysent_t *pe;\n\t\t\t\t\n\t\t\t\t\tgEngfuncs.pEventAPI->EV_SetTraceHull( 2 );\n\n\t\t\t\t\tgEngfuncs.pEventAPI->EV_PlayerTrace( pTemp->entity.prevstate.origin, pTemp->entity.origin, PM_STUDIO_BOX, -1, &pmtrace );\n\n\t\t\t\t\tif ( pmtrace.fraction != 1 )\n\t\t\t\t\t{\n\t\t\t\t\t\tpe = gEngfuncs.pEventAPI->EV_GetPhysent( pmtrace.ent );\n\n\t\t\t\t\t\tif ( !pmtrace.ent || ( pe->info != pTemp->clientIndex ) )\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttraceFraction = pmtrace.fraction;\n\t\t\t\t\t\t\tVectorCopy( pmtrace.plane.normal, traceNormal );\n\n\t\t\t\t\t\t\tif ( pTemp->hitcallback )\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t(*pTemp->hitcallback)( pTemp, &pmtrace );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse if ( pTemp->flags & FTENT_COLLIDEWORLD )\n\t\t\t\t{\n\t\t\t\t\tpmtrace_t pmtrace;\n\t\t\t\t\tVector *p_vEndPos;\n\t\t\t\t\t\n\t\t\t\t\tgEngfuncs.pEventAPI->EV_SetTraceHull( 2 );\n\n\t\t\t\t\tif ( pTemp->flags & FTENT_BODYTRACE )\n\t\t\t\t\t{\n\t\t\t\t\t\tVector vVel, vEndPos;\n\n\t\t\t\t\t\tVectorCopy( pTemp->entity.baseline.velocity, vVel );\n\t\t\t\t\t\tVectorNormalize( vVel );\n\t\t\t\t\t\tVectorMA( pTemp->entity.baseline.velocity, 36.0f, vVel, vEndPos );\n\t\t\t\t\t\tp_vEndPos = &vEndPos;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tp_vEndPos = &pTemp->entity.origin;\n\t\t\t\t\t}\n\n\t\t\t\t\tgEngfuncs.pEventAPI->EV_PlayerTrace( pTemp->entity.prevstate.origin, *p_vEndPos, PM_STUDIO_BOX | PM_WORLD_ONLY, -1, &pmtrace );\n\n\t\t\t\t\tif ( pmtrace.fraction != 1 )\n\t\t\t\t\t{\n\t\t\t\t\t\ttraceFraction = pmtrace.fraction;\n\t\t\t\t\t\tVectorCopy( pmtrace.plane.normal, traceNormal );\n\n\t\t\t\t\t\tif ( pTemp->flags & FTENT_SPARKSHOWER )\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t// Chop spark speeds a bit more\n\t\t\t\t\t\t\t//\n\t\t\t\t\t\t\tVectorScale( pTemp->entity.baseline.origin, 0.6, pTemp->entity.baseline.origin );\n\n\t\t\t\t\t\t\tif ( pTemp->entity.baseline.origin.Length() < 10 )\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tpTemp->entity.baseline.framerate = 0.0;\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif ( pTemp->hitcallback )\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t(*pTemp->hitcallback)( pTemp, &pmtrace );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif ( traceFraction != 1 )\t// Decent collision now, and damping works\n\t\t\t\t{\n\t\t\t\t\tfloat  proj, damp;\n\n\t\t\t\t\t// Place at contact point\n\t\t\t\t\tVectorMA( pTemp->entity.prevstate.origin, traceFraction*frametime, pTemp->entity.baseline.origin, pTemp->entity.origin );\n\t\t\t\t\t// Damp velocity\n\t\t\t\t\tdamp = pTemp->bounceFactor;\n\t\t\t\t\tif ( pTemp->flags & (FTENT_GRAVITY|FTENT_SLOWGRAVITY) )\n\t\t\t\t\t{\n\t\t\t\t\t\tdamp *= 0.5;\n\t\t\t\t\t\tif ( traceNormal[2] > 0.9 )\t\t// Hit floor?\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif ( pTemp->entity.baseline.origin[2] <= 0 && pTemp->entity.baseline.origin[2] >= gravity*3 )\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tdamp = 0;\t\t// Stop\n\t\t\t\t\t\t\t\tpTemp->flags &= ~(FTENT_ROTATE|FTENT_GRAVITY|FTENT_SLOWGRAVITY|FTENT_COLLIDEWORLD|FTENT_SMOKETRAIL);\n\t\t\t\t\t\t\t\tpTemp->entity.angles[0] = 0;\n\t\t\t\t\t\t\t\tpTemp->entity.angles[2] = 0;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (pTemp->hitSound)\n\t\t\t\t\t{\n\t\t\t\t\t\tCallback_TempEntPlaySound(pTemp, damp);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (pTemp->flags & FTENT_COLLIDEKILL)\n\t\t\t\t\t{\n\t\t\t\t\t\t// die on impact\n\t\t\t\t\t\tpTemp->flags &= ~FTENT_FADEOUT;\t\n\t\t\t\t\t\tpTemp->die = client_time;\t\t\t\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\t// Reflect velocity\n\t\t\t\t\t\tif ( damp != 0 )\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tproj = DotProduct( pTemp->entity.baseline.origin, traceNormal );\n\t\t\t\t\t\t\tVectorMA( pTemp->entity.baseline.origin, -proj*2, traceNormal, pTemp->entity.baseline.origin );\n\t\t\t\t\t\t\t// Reflect rotation (fake)\n\n\t\t\t\t\t\t\tpTemp->entity.angles[1] = -pTemp->entity.angles[1];\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\tif ( damp != 1 )\n\t\t\t\t\t\t{\n\n\t\t\t\t\t\t\tVectorScale( pTemp->entity.baseline.origin, damp, pTemp->entity.baseline.origin );\n\n\t\t\t\t\t\t\tif ( !( pTemp->flags & FTENT_BODYTRACE ))\n\t\t\t\t\t\t\t\tVectorScale( pTemp->entity.angles, 0.9f, pTemp->entity.angles );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\n\t\t\tif ( (pTemp->flags & FTENT_FLICKER) && gTempEntFrame == pTemp->entity.curstate.effects )\n\t\t\t{\n\t\t\t\tdlight_t *dl = gEngfuncs.pEfxAPI->CL_AllocDlight (0);\n\t\t\t\tVectorCopy (pTemp->entity.origin, dl->origin);\n\t\t\t\tdl->radius = 60;\n\t\t\t\tdl->color.r = 255;\n\t\t\t\tdl->color.g = 120;\n\t\t\t\tdl->color.b = 0;\n\t\t\t\tdl->die = client_time + 0.01;\n\t\t\t}\n\n\t\t\tif ( pTemp->flags & FTENT_SMOKETRAIL )\n\t\t\t{\n\t\t\t\tgEngfuncs.pEfxAPI->R_RocketTrail (pTemp->entity.prevstate.origin, pTemp->entity.origin, 1);\n\t\t\t}\n\n\t\t\tif ( !( pTemp->flags & FTENT_BODYGRAVITY ))\n\t\t\t{\n\t\t\t\tif ( pTemp->flags & FTENT_GRAVITY )\n\t\t\t\t\tpTemp->entity.baseline.origin[2] += gravity;\n\t\t\t\telse if ( pTemp->flags & FTENT_SLOWGRAVITY )\n\t\t\t\t\tpTemp->entity.baseline.origin[2] += gravitySlow;\n\t\t\t}\n\n\t\t\tif ( pTemp->flags & FTENT_CLIENTCUSTOM )\n\t\t\t{\n\t\t\t\tif ( pTemp->callback )\n\t\t\t\t{\n\t\t\t\t\t( *pTemp->callback )( pTemp, frametime, client_time );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Cull to PVS (not frustum cull, just PVS)\n\t\t\tif ( !(pTemp->flags & FTENT_NOMODEL ) )\n\t\t\t{\n\t\t\t\tif ( !Callback_AddVisibleEntity( &pTemp->entity ) )\n\t\t\t\t{\n\t\t\t\t\tif ( !(pTemp->flags & FTENT_PERSIST) ) \n\t\t\t\t\t{\n\t\t\t\t\t\tpTemp->die = client_time;\t\t// If we can't draw it this frame, just dump it.\n\t\t\t\t\t\tpTemp->flags &= ~FTENT_FADEOUT;\t// Don't fade out, just die\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tpTemp = pnext;\n\t}\n\nfinish:\n\t// Restore state info\n\tgEngfuncs.pEventAPI->EV_PopPMStates();\n}\n\n/*\n=================\nHUD_GetUserEntity\n\nIf you specify negative numbers for beam start and end point entities, then\n  the engine will call back into this function requesting a pointer to a cl_entity_t \n  object that describes the entity to attach the beam onto.\n\nIndices must start at 1, not zero.\n=================\n*/\ncl_entity_t DLLEXPORT *HUD_GetUserEntity( int index )\n{\n\treturn NULL;\n}\n\n"
  },
  {
    "path": "cl_dll/ev_common.cpp",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\t\n*\tThis product contains software technology licensed from Id \n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc. \n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n// shared event functions\n#include \"hud.h\"\n#include \"cl_util.h\"\n#include \"const.h\"\n#include \"entity_state.h\"\n#include \"cl_entity.h\"\n\n#include \"r_efx.h\"\n\n#include \"eventscripts.h\"\n#include \"event_api.h\"\n#include \"pm_shared.h\"\n#include \"events.h\"\n\nint g_iRShell, g_iPShell, g_iShotgunShell;\n\n/*\n======================\nGame_HookEvents\n\nAssociate script file name with callback functions.  Callback's must be extern \"C\" so\n the engine doesn't get confused about name mangling stuff.  Note that the format is\n always the same.  Of course, a clever mod team could actually embed parameters, behavior\n into the actual .sc files and create a .sc file parser and hook their functionality through\n that.. i.e., a scripting system.\n\nThat was what we were going to do, but we ran out of time...oh well.\n======================\n*/\nvoid Game_HookEvents( void )\n{\n\tHOOK_EVENT( ak47, FireAK47 );\n\tHOOK_EVENT( aug, FireAUG );\n\tHOOK_EVENT( awp, FireAWP );\n\tHOOK_EVENT( createexplo, CreateExplo );\n\tHOOK_EVENT( createsmoke, CreateSmoke );\n\tHOOK_EVENT( deagle, FireDEAGLE );\n\tHOOK_EVENT( decal_reset, DecalReset );\n\tHOOK_EVENT( elite_left, FireEliteLeft );\n\tHOOK_EVENT( elite_right, FireEliteRight );\n\tHOOK_EVENT( famas, FireFAMAS );\n\tHOOK_EVENT( fiveseven, Fire57 );\n\tHOOK_EVENT( g3sg1, FireG3SG1 );\n\tHOOK_EVENT( galil, FireGALIL );\n\tHOOK_EVENT( glock18, Fireglock18 );\n\tHOOK_EVENT( knife, Knife );\n\tHOOK_EVENT( m249, FireM249 );\n\tHOOK_EVENT( m3, FireM3 );\n\tHOOK_EVENT( m4a1, FireM4A1 );\n\tHOOK_EVENT( mac10, FireMAC10 );\n\tHOOK_EVENT( mp5n, FireMP5 );\n\tHOOK_EVENT( p228, FireP228 );\n\tHOOK_EVENT( p90, FireP90 );\n\tHOOK_EVENT( scout, FireScout );\n\tHOOK_EVENT( sg550, FireSG550 );\n\tHOOK_EVENT( sg552, FireSG552 );\n\tHOOK_EVENT( tmp, FireTMP );\n\tHOOK_EVENT( ump45, FireUMP45 );\n\tHOOK_EVENT( usp, FireUSP );\n\tHOOK_EVENT( vehicle, Vehicle );\n\tHOOK_EVENT( xm1014, FireXM1014 );\n\n\tif( !stricmp( gEngfuncs.pfnGetGameDirectory(), \"czeror\" ) )\n\t{\n\t\tHOOK_EVENT( m60, FireM60 );\n\t\tHOOK_EVENT( camera, FireCamera );\n\t\tHOOK_EVENT( fiberopticcamera, FireFiberOpticCamera );\n\t\tHOOK_EVENT( shieldgun, FireShieldGun );\n\t\tHOOK_EVENT( blowtorchholster, HolsterBlowtorch );\n\t\tHOOK_EVENT( blowtorchidle, IdleBlowtorch );\n\t\tHOOK_EVENT( blowtorch, FireBlowtorch );\n\t\tHOOK_EVENT( laws, FireLaws );\n\t\tHOOK_EVENT( briefcase, FireBriefcase );\n\t\tHOOK_EVENT( medkit, FireMedkit );\n\t\tHOOK_EVENT( syringe, FireSyringe );\n\t\tHOOK_EVENT( radio, FireRadio );\n\t\tHOOK_EVENT( zipline, FireZipline );\n\t\tHOOK_EVENT( create_glass, CreateGlass );\n\t\tHOOK_EVENT( explosion, GrenadeExplosion );\n\t}\n}\n\n/*\n=================\nEV_GetGunPosition\n\nFigure out the height of the gun\n=================\n*/\nvoid EV_GetGunPosition( event_args_t *args, Vector &pos, const Vector &origin )\n{\n\tint idx;\n\tVector view_ofs(0, 0, 0);\n\n\tidx = args->entindex;\n\n\tif ( EV_IsPlayer( idx ) )\n\t{\n\t\t// in spec mode use entity viewheigh, not own\n\t\tif ( EV_IsLocal( idx ) && !IS_FIRSTPERSON_SPEC )\n\t\t{\n\t\t\t// Grab predicted result for local player\n\t\t\tgEngfuncs.pEventAPI->EV_LocalPlayerViewheight( view_ofs );\n\t\t}\n\t\telse if ( args->ducking == 1 )\n\t\t{\n\t\t\tview_ofs[2] = VEC_DUCK_VIEW;\n\t\t}\n\t}\n\telse\n\t{\n\t\tview_ofs[2] = DEFAULT_VIEWHEIGHT;\n\t}\n\n\tpos = origin + view_ofs;\n}\n\n/*\n=================\nEV_GetDefaultShellInfo\n\nDetermine where to eject shells from\n=================\n*/\nvoid EV_GetDefaultShellInfo( event_args_t *args, float *origin, float *velocity, float *ShellVelocity, float *ShellOrigin, float *forward, float *right, float *up, float forwardScale, float upScale, float rightScale, bool bReverseDirection )\n{\n\tint idx = args->entindex;\n\n\tvec3_t view_ofs = { 0, 0, DEFAULT_VIEWHEIGHT };\n\tif ( EV_IsPlayer( idx ) )\n\t{\n\t\tif ( EV_IsLocal( idx ) )\n\t\t{\n\t\t\tgEngfuncs.pEventAPI->EV_LocalPlayerViewheight( view_ofs );\n\t\t}\n\t\telse if ( args->ducking == 1 )\n\t\t{\n\t\t\tview_ofs[2] = VEC_DUCK_VIEW;\n\t\t}\n\t}\n\n\tfloat fR = gEngfuncs.pfnRandomFloat( 50, 70 );\n\tfloat fU = gEngfuncs.pfnRandomFloat( 75, 175 );\n\tfloat fF = gEngfuncs.pfnRandomFloat( 25, 250 );\n\tfloat fDirection = rightScale > 0.0f ? -1.0f : 1.0f;\n\n\tfor ( int i = 0; i < 3; i++ )\n\t{\n\t\tif( bReverseDirection )\n\t\t{\n\t\t\tShellVelocity[i] = velocity[i] * 0.5f - right[i] * fR * fDirection + up[i] * fU + forward[i] * fF;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tShellVelocity[i] = velocity[i] * 0.5f + right[i] * fR * fDirection + up[i] * fU + forward[i] * fF;\n\t\t}\n\t\tShellOrigin[i]   = velocity[i] * 0.1f + origin[i] + view_ofs[i] +\n\t\t\t\tupScale * up[i] + forwardScale * forward[i] + rightScale * right[i];\n\t}\n}\n"
  },
  {
    "path": "cl_dll/ev_hldm.cpp",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\t\n*\tThis product contains software technology licensed from Id \n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc. \n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n#include \"hud.h\"\n#include \"cl_util.h\"\n#include \"const.h\"\n#include \"entity_state.h\"\n#include \"cl_entity.h\"\n#include \"entity_types.h\"\n#include \"usercmd.h\"\n#include \"pm_defs.h\"\n#include \"pm_materials.h\"\n\n#include \"eventscripts.h\"\n#include \"ev_hldm.h\"\n\n#include \"r_efx.h\"\n#include \"event_api.h\"\n#include \"event_args.h\"\n#include \"in_defs.h\"\n\n#include <string.h>\n\n#include \"r_studioint.h\"\n#include \"com_model.h\"\n\nextern engine_studio_api_t IEngineStudio;\n\nstatic int tracerCount[ 32 ];\n\nextern \"C\" char PM_FindTextureType( char *name );\n\nvoid V_PunchAxis( int axis, float punch );\nvoid VectorAngles( const float *forward, float *angles );\n\nextern cvar_t *cl_lw;\n\nextern \"C\"\n{\n\n// HLDM\nvoid EV_FireGlock1( struct event_args_s *args  );\nvoid EV_FireGlock2( struct event_args_s *args  );\nvoid EV_FireShotGunSingle( struct event_args_s *args  );\nvoid EV_FireShotGunDouble( struct event_args_s *args  );\nvoid EV_FireMP5( struct event_args_s *args  );\nvoid EV_FireMP52( struct event_args_s *args  );\nvoid EV_FirePython( struct event_args_s *args  );\nvoid EV_FireGauss( struct event_args_s *args  );\nvoid EV_SpinGauss( struct event_args_s *args  );\nvoid EV_Crowbar( struct event_args_s *args  );\nvoid EV_FireCrossbow( struct event_args_s *args  );\nvoid EV_FireCrossbow2( struct event_args_s *args  );\nvoid EV_FireRpg( struct event_args_s *args  );\nvoid EV_EgonFire( struct event_args_s *args  );\nvoid EV_EgonStop( struct event_args_s *args  );\nvoid EV_HornetGunFire( struct event_args_s *args  );\nvoid EV_TripmineFire( struct event_args_s *args  );\nvoid EV_SnarkFire( struct event_args_s *args  );\nvoid EV_Dummy( struct event_args_s *args );\n\nvoid EV_TrainPitchAdjust( struct event_args_s *args );\n}\n\n#define VECTOR_CONE_1DEGREES Vector( 0.00873, 0.00873, 0.00873 )\n#define VECTOR_CONE_2DEGREES Vector( 0.01745, 0.01745, 0.01745 )\n#define VECTOR_CONE_3DEGREES Vector( 0.02618, 0.02618, 0.02618 )\n#define VECTOR_CONE_4DEGREES Vector( 0.03490, 0.03490, 0.03490 )\n#define VECTOR_CONE_5DEGREES Vector( 0.04362, 0.04362, 0.04362 )\n#define VECTOR_CONE_6DEGREES Vector( 0.05234, 0.05234, 0.05234 )\n#define VECTOR_CONE_7DEGREES Vector( 0.06105, 0.06105, 0.06105 )\t\n#define VECTOR_CONE_8DEGREES Vector( 0.06976, 0.06976, 0.06976 )\n#define VECTOR_CONE_9DEGREES Vector( 0.07846, 0.07846, 0.07846 )\n#define VECTOR_CONE_10DEGREES Vector( 0.08716, 0.08716, 0.08716 )\n#define VECTOR_CONE_15DEGREES Vector( 0.13053, 0.13053, 0.13053 )\n#define VECTOR_CONE_20DEGREES Vector( 0.17365, 0.17365, 0.17365 )\n\n// play a strike sound based on the texture that was hit by the attack traceline.  VecSrc/VecEnd are the\n// original traceline endpoints used by the attacker, iBulletType is the type of bullet that hit the texture.\n// returns volume of strike instrument (crowbar) to play\nfloat EV_HLDM_PlayTextureSound( int idx, pmtrace_t *ptr, float *vecSrc, float *vecEnd, int iBulletType )\n{\n\t// hit the world, try to play sound based on texture material type\n\tchar chTextureType = CHAR_TEX_CONCRETE;\n\tfloat fvol;\n\tfloat fvolbar;\n\tchar *rgsz[4];\n\tint cnt;\n\tfloat fattn = ATTN_NORM;\n\tint entity;\n\tchar *pTextureName;\n\tchar texname[ 64 ];\n\tchar szbuffer[ 64 ];\n\n\tentity = gEngfuncs.pEventAPI->EV_IndexFromTrace( ptr );\n\n\t// FIXME check if playtexture sounds movevar is set\n\t//\n\n\tchTextureType = 0;\n\n\t// Player\n\tif ( entity >= 1 && entity <= gEngfuncs.GetMaxClients() )\n\t{\n\t\t// hit body\n\t\tchTextureType = CHAR_TEX_FLESH;\n\t}\n\telse if ( entity == 0 )\n\t{\n\t\t// get texture from entity or world (world is ent(0))\n\t\tpTextureName = (char *)gEngfuncs.pEventAPI->EV_TraceTexture( ptr->ent, vecSrc, vecEnd );\n\t\t\n\t\tif ( pTextureName )\n\t\t{\n\t\t\tstrcpy( texname, pTextureName );\n\t\t\tpTextureName = texname;\n\n\t\t\t// strip leading '-0' or '+0~' or '{' or '!'\n\t\t\tif (*pTextureName == '-' || *pTextureName == '+')\n\t\t\t{\n\t\t\t\tpTextureName += 2;\n\t\t\t}\n\n\t\t\tif (*pTextureName == '{' || *pTextureName == '!' || *pTextureName == '~' || *pTextureName == ' ')\n\t\t\t{\n\t\t\t\tpTextureName++;\n\t\t\t}\n\t\t\t\n\t\t\t// '}}'\n\t\t\tstrcpy( szbuffer, pTextureName );\n\t\t\tszbuffer[ CBTEXTURENAMEMAX - 1 ] = 0;\n\t\t\t\t\n\t\t\t// get texture type\n\t\t\tchTextureType = PM_FindTextureType( szbuffer );\t\n\t\t}\n\t}\n\t\n\tswitch (chTextureType)\n\t{\n\tdefault:\n\tcase CHAR_TEX_CONCRETE: fvol = 0.9;\tfvolbar = 0.6;\n\t\trgsz[0] = \"player/pl_step1.wav\";\n\t\trgsz[1] = \"player/pl_step2.wav\";\n\t\tcnt = 2;\n\t\tbreak;\n\tcase CHAR_TEX_METAL: fvol = 0.9; fvolbar = 0.3;\n\t\trgsz[0] = \"player/pl_metal1.wav\";\n\t\trgsz[1] = \"player/pl_metal2.wav\";\n\t\tcnt = 2;\n\t\tbreak;\n\tcase CHAR_TEX_DIRT:\tfvol = 0.9; fvolbar = 0.1;\n\t\trgsz[0] = \"player/pl_dirt1.wav\";\n\t\trgsz[1] = \"player/pl_dirt2.wav\";\n\t\trgsz[2] = \"player/pl_dirt3.wav\";\n\t\tcnt = 3;\n\t\tbreak;\n\tcase CHAR_TEX_VENT:\tfvol = 0.5; fvolbar = 0.3;\n\t\trgsz[0] = \"player/pl_duct1.wav\";\n\t\trgsz[1] = \"player/pl_duct1.wav\";\n\t\tcnt = 2;\n\t\tbreak;\n\tcase CHAR_TEX_GRATE: fvol = 0.9; fvolbar = 0.5;\n\t\trgsz[0] = \"player/pl_grate1.wav\";\n\t\trgsz[1] = \"player/pl_grate4.wav\";\n\t\tcnt = 2;\n\t\tbreak;\n\tcase CHAR_TEX_TILE:\tfvol = 0.8; fvolbar = 0.2;\n\t\trgsz[0] = \"player/pl_tile1.wav\";\n\t\trgsz[1] = \"player/pl_tile3.wav\";\n\t\trgsz[2] = \"player/pl_tile2.wav\";\n\t\trgsz[3] = \"player/pl_tile4.wav\";\n\t\tcnt = 4;\n\t\tbreak;\n\tcase CHAR_TEX_SLOSH: fvol = 0.9; fvolbar = 0.0;\n\t\trgsz[0] = \"player/pl_slosh1.wav\";\n\t\trgsz[1] = \"player/pl_slosh3.wav\";\n\t\trgsz[2] = \"player/pl_slosh2.wav\";\n\t\trgsz[3] = \"player/pl_slosh4.wav\";\n\t\tcnt = 4;\n\t\tbreak;\n\tcase CHAR_TEX_WOOD: fvol = 0.9; fvolbar = 0.2;\n\t\trgsz[0] = \"debris/wood1.wav\";\n\t\trgsz[1] = \"debris/wood2.wav\";\n\t\trgsz[2] = \"debris/wood3.wav\";\n\t\tcnt = 3;\n\t\tbreak;\n\tcase CHAR_TEX_GLASS:\n\tcase CHAR_TEX_COMPUTER:\n\t\tfvol = 0.8; fvolbar = 0.2;\n\t\trgsz[0] = \"debris/glass1.wav\";\n\t\trgsz[1] = \"debris/glass2.wav\";\n\t\trgsz[2] = \"debris/glass3.wav\";\n\t\tcnt = 3;\n\t\tbreak;\n\tcase CHAR_TEX_FLESH:\n\t\tif (iBulletType == BULLET_PLAYER_CROWBAR)\n\t\t\treturn 0.0; // crowbar already makes this sound\n\t\tfvol = 1.0;\tfvolbar = 0.2;\n\t\trgsz[0] = \"weapons/bullet_hit1.wav\";\n\t\trgsz[1] = \"weapons/bullet_hit2.wav\";\n\t\tfattn = 1.0;\n\t\tcnt = 2;\n\t\tbreak;\n\t}\n\n\t// play material hit sound\n\tgEngfuncs.pEventAPI->EV_PlaySound( 0, ptr->endpos, CHAN_STATIC, rgsz[gEngfuncs.pfnRandomLong(0,cnt-1)], fvol, fattn, 0, 96 + gEngfuncs.pfnRandomLong(0,0xf) );\n\treturn fvolbar;\n}\n\nchar *EV_HLDM_DamageDecal( physent_t *pe )\n{\n\tstatic char decalname[ 32 ];\n\tint idx;\n\n\tif ( pe->classnumber == 1 )\n\t{\n\t\tidx = gEngfuncs.pfnRandomLong( 0, 2 );\n\t\tsprintf( decalname, \"{break%i\", idx + 1 );\n\t}\n\telse if ( pe->rendermode != kRenderNormal )\n\t{\n\t\tsprintf( decalname, \"{bproof1\" );\n\t}\n\telse\n\t{\n\t\tidx = gEngfuncs.pfnRandomLong( 0, 4 );\n\t\tsprintf( decalname, \"{shot%i\", idx + 1 );\n\t}\n\treturn decalname;\n}\n\nvoid EV_HLDM_GunshotDecalTrace( pmtrace_t *pTrace, char *decalName )\n{\n\tint iRand;\n\tphysent_t *pe;\n\n\tgEngfuncs.pEfxAPI->R_BulletImpactParticles( pTrace->endpos );\n\n\tiRand = gEngfuncs.pfnRandomLong(0,0x7FFF);\n\tif ( iRand < (0x7fff/2) )// not every bullet makes a sound.\n\t{\n\t\tswitch( iRand % 5)\n\t\t{\n\t\tcase 0:\tgEngfuncs.pEventAPI->EV_PlaySound( -1, pTrace->endpos, 0, \"weapons/ric1.wav\", 1.0, ATTN_NORM, 0, PITCH_NORM ); break;\n\t\tcase 1:\tgEngfuncs.pEventAPI->EV_PlaySound( -1, pTrace->endpos, 0, \"weapons/ric2.wav\", 1.0, ATTN_NORM, 0, PITCH_NORM ); break;\n\t\tcase 2:\tgEngfuncs.pEventAPI->EV_PlaySound( -1, pTrace->endpos, 0, \"weapons/ric3.wav\", 1.0, ATTN_NORM, 0, PITCH_NORM ); break;\n\t\tcase 3:\tgEngfuncs.pEventAPI->EV_PlaySound( -1, pTrace->endpos, 0, \"weapons/ric4.wav\", 1.0, ATTN_NORM, 0, PITCH_NORM ); break;\n\t\tcase 4:\tgEngfuncs.pEventAPI->EV_PlaySound( -1, pTrace->endpos, 0, \"weapons/ric5.wav\", 1.0, ATTN_NORM, 0, PITCH_NORM ); break;\n\t\t}\n\t}\n\n\tpe = gEngfuncs.pEventAPI->EV_GetPhysent( pTrace->ent );\n\n\t// Only decal brush models such as the world etc.\n\tif (  decalName && decalName[0] && pe && ( pe->solid == SOLID_BSP || pe->movetype == MOVETYPE_PUSHSTEP ) )\n\t{\n\t\tif ( CVAR_GET_FLOAT( \"r_decals\" ) )\n\t\t{\n\t\t\tgEngfuncs.pEfxAPI->R_DecalShoot( \n\t\t\t\tgEngfuncs.pEfxAPI->Draw_DecalIndex( gEngfuncs.pEfxAPI->Draw_DecalIndexFromName( decalName ) ), \n\t\t\t\tgEngfuncs.pEventAPI->EV_IndexFromTrace( pTrace ), 0, pTrace->endpos, 0 );\n\t\t}\n\t}\n}\n\nvoid EV_HLDM_DecalGunshot( pmtrace_t *pTrace, int iBulletType )\n{\n\tphysent_t *pe;\n\n\tpe = gEngfuncs.pEventAPI->EV_GetPhysent( pTrace->ent );\n\n\tif ( pe && pe->solid == SOLID_BSP )\n\t{\n\t\tswitch( iBulletType )\n\t\t{\n\t\tcase BULLET_PLAYER_9MM:\n\t\tcase BULLET_MONSTER_9MM:\n\t\tcase BULLET_PLAYER_MP5:\n\t\tcase BULLET_MONSTER_MP5:\n\t\tcase BULLET_PLAYER_BUCKSHOT:\n\t\tcase BULLET_PLAYER_357:\n\t\tdefault:\n\t\t\t// smoke and decal\n\t\t\tEV_HLDM_GunshotDecalTrace( pTrace, EV_HLDM_DamageDecal( pe ) );\n\t\t\tbreak;\n\t\t}\n\t}\n}\n\nint EV_HLDM_CheckTracer( int idx, float *vecSrc, float *end, float *forward, float *right, int iBulletType, int iTracerFreq, int *tracerCount )\n{\n\tint tracer = 0;\n\tint i;\n\tqboolean player = idx >= 1 && idx <= gEngfuncs.GetMaxClients() ? true : false;\n\n\tif ( iTracerFreq != 0 && ( (*tracerCount)++ % iTracerFreq) == 0 )\n\t{\n\t\tvec3_t vecTracerSrc;\n\n\t\tif ( player )\n\t\t{\n\t\t\tvec3_t offset( 0, 0, -4 );\n\n\t\t\t// adjust tracer position for player\n\t\t\tfor ( i = 0; i < 3; i++ )\n\t\t\t{\n\t\t\t\tvecTracerSrc[ i ] = vecSrc[ i ] + offset[ i ] + right[ i ] * 2 + forward[ i ] * 16;\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tVectorCopy( vecSrc, vecTracerSrc );\n\t\t}\n\t\t\n\t\tif ( iTracerFreq != 1 )\t\t// guns that always trace also always decal\n\t\t\ttracer = 1;\n\n\t\tswitch( iBulletType )\n\t\t{\n\t\tcase BULLET_PLAYER_MP5:\n\t\tcase BULLET_MONSTER_MP5:\n\t\tcase BULLET_MONSTER_9MM:\n\t\tcase BULLET_MONSTER_12MM:\n\t\tdefault:\n\t\t\tEV_CreateTracer( vecTracerSrc, end );\n\t\t\tbreak;\n\t\t}\n\t}\n\n\treturn tracer;\n}\n\n\n/*\n================\nFireBullets\n\nGo to the trouble of combining multiple pellets into a single damage call.\n================\n*/\nvoid EV_HLDM_FireBullets( int idx, float *forward, float *right, float *up, int cShots, float *vecSrc, float *vecDirShooting, float flDistance, int iBulletType, int iTracerFreq, int *tracerCount, float flSpreadX, float flSpreadY )\n{\n\tint i;\n\tpmtrace_t tr;\n\tint iShot;\n\tint tracer;\n\t\n\tfor ( iShot = 1; iShot <= cShots; iShot++ )\t\n\t{\n\t\tvec3_t vecDir, vecEnd;\n\t\t\t\n\t\tfloat x, y, z;\n\t\t//We randomize for the Shotgun.\n\t\tif ( iBulletType == BULLET_PLAYER_BUCKSHOT )\n\t\t{\n\t\t\tdo {\n\t\t\t\tx = gEngfuncs.pfnRandomFloat(-0.5,0.5) + gEngfuncs.pfnRandomFloat(-0.5,0.5);\n\t\t\t\ty = gEngfuncs.pfnRandomFloat(-0.5,0.5) + gEngfuncs.pfnRandomFloat(-0.5,0.5);\n\t\t\t\tz = x*x+y*y;\n\t\t\t} while (z > 1);\n\n\t\t\tfor ( i = 0 ; i < 3; i++ )\n\t\t\t{\n\t\t\t\tvecDir[i] = vecDirShooting[i] + x * flSpreadX * right[ i ] + y * flSpreadY * up [ i ];\n\t\t\t\tvecEnd[i] = vecSrc[ i ] + flDistance * vecDir[ i ];\n\t\t\t}\n\t\t}//But other guns already have their spread randomized in the synched spread.\n\t\telse\n\t\t{\n\n\t\t\tfor ( i = 0 ; i < 3; i++ )\n\t\t\t{\n\t\t\t\tvecDir[i] = vecDirShooting[i] + flSpreadX * right[ i ] + flSpreadY * up [ i ];\n\t\t\t\tvecEnd[i] = vecSrc[ i ] + flDistance * vecDir[ i ];\n\t\t\t}\n\t\t}\n\n\t\tgEngfuncs.pEventAPI->EV_SetUpPlayerPrediction( false, true );\n\t\n\t\t// Store off the old count\n\t\tgEngfuncs.pEventAPI->EV_PushPMStates();\n\t\n\t\t// Now add in all of the players.\n\t\tgEngfuncs.pEventAPI->EV_SetSolidPlayers ( idx - 1 );\t\n\n\t\tgEngfuncs.pEventAPI->EV_SetTraceHull( 2 );\n\t\tgEngfuncs.pEventAPI->EV_PlayerTrace( vecSrc, vecEnd, PM_STUDIO_BOX, -1, &tr );\n\n\t\ttracer = EV_HLDM_CheckTracer( idx, vecSrc, tr.endpos, forward, right, iBulletType, iTracerFreq, tracerCount );\n\n\t\t// do damage, paint decals\n\t\tif ( tr.fraction != 1.0 )\n\t\t{\n\t\t\tswitch(iBulletType)\n\t\t\t{\n\t\t\tdefault:\n\t\t\tcase BULLET_PLAYER_9MM:\t\t\n\t\t\t\t\n\t\t\t\tEV_HLDM_PlayTextureSound( idx, &tr, vecSrc, vecEnd, iBulletType );\n\t\t\t\tEV_HLDM_DecalGunshot( &tr, iBulletType );\n\t\t\t\n\t\t\t\t\tbreak;\n\t\t\tcase BULLET_PLAYER_MP5:\t\t\n\t\t\t\t\n\t\t\t\tif ( !tracer )\n\t\t\t\t{\n\t\t\t\t\tEV_HLDM_PlayTextureSound( idx, &tr, vecSrc, vecEnd, iBulletType );\n\t\t\t\t\tEV_HLDM_DecalGunshot( &tr, iBulletType );\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase BULLET_PLAYER_BUCKSHOT:\n\t\t\t\t\n\t\t\t\tEV_HLDM_DecalGunshot( &tr, iBulletType );\n\t\t\t\n\t\t\t\tbreak;\n\t\t\tcase BULLET_PLAYER_357:\n\t\t\t\t\n\t\t\t\tEV_HLDM_PlayTextureSound( idx, &tr, vecSrc, vecEnd, iBulletType );\n\t\t\t\tEV_HLDM_DecalGunshot( &tr, iBulletType );\n\t\t\t\t\n\t\t\t\tbreak;\n\n\t\t\t}\n\t\t}\n\n\t\tgEngfuncs.pEventAPI->EV_PopPMStates();\n\t}\n}\n\n//======================\n//\t    GLOCK START\n//======================\nvoid EV_FireGlock1( event_args_t *args )\n{\n\tint idx;\n\tvec3_t origin;\n\tvec3_t angles;\n\tvec3_t velocity;\n\tint empty;\n\n\tvec3_t ShellVelocity;\n\tvec3_t ShellOrigin;\n\tint shell;\n\tvec3_t vecSrc, vecAiming;\n\tvec3_t up, right, forward;\n\t\n\tidx = args->entindex;\n\tVectorCopy( args->origin, origin );\n\tVectorCopy( args->angles, angles );\n\tVectorCopy( args->velocity, velocity );\n\n\tempty = args->bparam1;\n\tAngleVectors( angles, forward, right, up );\n\n\tshell = gEngfuncs.pEventAPI->EV_FindModelIndex (\"models/shell.mdl\");// brass shell\n\n\tif ( EV_IsLocal( idx ) )\n\t{\n\t\tEV_MuzzleFlash();\n\t\tgEngfuncs.pEventAPI->EV_WeaponAnimation( empty ? GLOCK_SHOOT_EMPTY : GLOCK_SHOOT, 2 );\n\n\t\tV_PunchAxis( 0, -2.0 );\n\t}\n\n\tEV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, right, up, 20, -12, 4 );\n\n\tEV_EjectBrass ( ShellOrigin, ShellVelocity, angles[ YAW ], shell, TE_BOUNCE_SHELL ); \n\n\tgEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_WEAPON, \"weapons/pl_gun3.wav\", gEngfuncs.pfnRandomFloat(0.92, 1.0), ATTN_NORM, 0, 98 + gEngfuncs.pfnRandomLong( 0, 3 ) );\n\n\tEV_GetGunPosition( args, vecSrc, origin );\n\t\n\tVectorCopy( forward, vecAiming );\n\n\tEV_HLDM_FireBullets( idx, forward, right, up, 1, vecSrc, vecAiming, 8192, BULLET_PLAYER_9MM, 0, 0, args->fparam1, args->fparam2 );\n}\n\nvoid EV_FireGlock2( event_args_t *args )\n{\n\tint idx;\n\tvec3_t origin;\n\tvec3_t angles;\n\tvec3_t velocity;\n\t\n\tvec3_t ShellVelocity;\n\tvec3_t ShellOrigin;\n\tint shell;\n\tvec3_t vecSrc, vecAiming;\n\tvec3_t vecSpread;\n\tvec3_t up, right, forward;\n\n\tidx = args->entindex;\n\tVectorCopy( args->origin, origin );\n\tVectorCopy( args->angles, angles );\n\tVectorCopy( args->velocity, velocity );\n\n\tAngleVectors( angles, forward, right, up );\n\n\tshell = gEngfuncs.pEventAPI->EV_FindModelIndex (\"models/shell.mdl\");// brass shell\n\n\tif ( EV_IsLocal( idx ) )\n\t{\n\t\t// Add muzzle flash to current weapon model\n\t\tEV_MuzzleFlash();\n\t\tgEngfuncs.pEventAPI->EV_WeaponAnimation( GLOCK_SHOOT, 2 );\n\n\t\tV_PunchAxis( 0, -2.0 );\n\t}\n\n\tEV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, right, up, 20, -12, 4 );\n\n\tEV_EjectBrass ( ShellOrigin, ShellVelocity, angles[ YAW ], shell, TE_BOUNCE_SHELL ); \n\n\tgEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_WEAPON, \"weapons/pl_gun3.wav\", gEngfuncs.pfnRandomFloat(0.92, 1.0), ATTN_NORM, 0, 98 + gEngfuncs.pfnRandomLong( 0, 3 ) );\n\n\tEV_GetGunPosition( args, vecSrc, origin );\n\t\n\tVectorCopy( forward, vecAiming );\n\n\tEV_HLDM_FireBullets( idx, forward, right, up, 1, vecSrc, vecAiming, 8192, BULLET_PLAYER_9MM, 0, &tracerCount[idx-1], args->fparam1, args->fparam2 );\n\t\n}\n//======================\n//\t   GLOCK END\n//======================\n\n//======================\n//\t  SHOTGUN START\n//======================\nvoid EV_FireShotGunDouble( event_args_t *args )\n{\n\tint idx;\n\tvec3_t origin;\n\tvec3_t angles;\n\tvec3_t velocity;\n\n\tint j;\n\tvec3_t ShellVelocity;\n\tvec3_t ShellOrigin;\n\tint shell;\n\tvec3_t vecSrc, vecAiming;\n\tvec3_t vecSpread;\n\tvec3_t up, right, forward;\n\tfloat flSpread = 0.01;\n\n\tidx = args->entindex;\n\tVectorCopy( args->origin, origin );\n\tVectorCopy( args->angles, angles );\n\tVectorCopy( args->velocity, velocity );\n\n\tAngleVectors( angles, forward, right, up );\n\n\tshell = gEngfuncs.pEventAPI->EV_FindModelIndex (\"models/shotgunshell.mdl\");// brass shell\n\n\tif ( EV_IsLocal( idx ) )\n\t{\n\t\t// Add muzzle flash to current weapon model\n\t\tEV_MuzzleFlash();\n\t\tgEngfuncs.pEventAPI->EV_WeaponAnimation( SHOTGUN_FIRE2, 2 );\n\t\tV_PunchAxis( 0, -10.0 );\n\t}\n\n\tfor ( j = 0; j < 2; j++ )\n\t{\n\t\tEV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, right, up, 32, -12, 6 );\n\n\t\tEV_EjectBrass ( ShellOrigin, ShellVelocity, angles[ YAW ], shell, TE_BOUNCE_SHOTSHELL ); \n\t}\n\n\tgEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_WEAPON, \"weapons/dbarrel1.wav\", gEngfuncs.pfnRandomFloat(0.98, 1.0), ATTN_NORM, 0, 85 + gEngfuncs.pfnRandomLong( 0, 0x1f ) );\n\n\tEV_GetGunPosition( args, vecSrc, origin );\n\tVectorCopy( forward, vecAiming );\n\n\tif ( gEngfuncs.GetMaxClients() > 1 )\n\t{\n\t\tEV_HLDM_FireBullets( idx, forward, right, up, 8, vecSrc, vecAiming, 2048, BULLET_PLAYER_BUCKSHOT, 0, &tracerCount[idx-1], 0.17365, 0.04362 );\n\t}\n\telse\n\t{\n\t\tEV_HLDM_FireBullets( idx, forward, right, up, 12, vecSrc, vecAiming, 2048, BULLET_PLAYER_BUCKSHOT, 0, &tracerCount[idx-1], 0.08716, 0.08716 );\n\t}\n}\n\nvoid EV_FireShotGunSingle( event_args_t *args )\n{\n\tint idx;\n\tvec3_t origin;\n\tvec3_t angles;\n\tvec3_t velocity;\n\t\n\tvec3_t ShellVelocity;\n\tvec3_t ShellOrigin;\n\tint shell;\n\tvec3_t vecSrc, vecAiming;\n\tvec3_t vecSpread;\n\tvec3_t up, right, forward;\n\tfloat flSpread = 0.01;\n\n\tidx = args->entindex;\n\tVectorCopy( args->origin, origin );\n\tVectorCopy( args->angles, angles );\n\tVectorCopy( args->velocity, velocity );\n\n\tAngleVectors( angles, forward, right, up );\n\n\tshell = gEngfuncs.pEventAPI->EV_FindModelIndex (\"models/shotgunshell.mdl\");// brass shell\n\n\tif ( EV_IsLocal( idx ) )\n\t{\n\t\t// Add muzzle flash to current weapon model\n\t\tEV_MuzzleFlash();\n\t\tgEngfuncs.pEventAPI->EV_WeaponAnimation( SHOTGUN_FIRE, 2 );\n\n\t\tV_PunchAxis( 0, -5.0 );\n\t}\n\n\tEV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, right, up, 32, -12, 6 );\n\n\tEV_EjectBrass ( ShellOrigin, ShellVelocity, angles[ YAW ], shell, TE_BOUNCE_SHOTSHELL ); \n\n\tgEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_WEAPON, \"weapons/sbarrel1.wav\", gEngfuncs.pfnRandomFloat(0.95, 1.0), ATTN_NORM, 0, 93 + gEngfuncs.pfnRandomLong( 0, 0x1f ) );\n\n\tEV_GetGunPosition( args, vecSrc, origin );\n\tVectorCopy( forward, vecAiming );\n\n\tif ( gEngfuncs.GetMaxClients() > 1 )\n\t{\n\t\tEV_HLDM_FireBullets( idx, forward, right, up, 4, vecSrc, vecAiming, 2048, BULLET_PLAYER_BUCKSHOT, 0, &tracerCount[idx-1], 0.08716, 0.04362 );\n\t}\n\telse\n\t{\n\t\tEV_HLDM_FireBullets( idx, forward, right, up, 6, vecSrc, vecAiming, 2048, BULLET_PLAYER_BUCKSHOT, 0, &tracerCount[idx-1], 0.08716, 0.08716 );\n\t}\n}\n//======================\n//\t   SHOTGUN END\n//======================\n\n//======================\n//\t    MP5 START\n//======================\nvoid EV_FireMP5( event_args_t *args )\n{\n\tint idx;\n\tvec3_t origin;\n\tvec3_t angles;\n\tvec3_t velocity;\n\n\tvec3_t ShellVelocity;\n\tvec3_t ShellOrigin;\n\tint shell;\n\tvec3_t vecSrc, vecAiming;\n\tvec3_t up, right, forward;\n\tfloat flSpread = 0.01;\n\n\tidx = args->entindex;\n\tVectorCopy( args->origin, origin );\n\tVectorCopy( args->angles, angles );\n\tVectorCopy( args->velocity, velocity );\n\n\tAngleVectors( angles, forward, right, up );\n\n\tshell = gEngfuncs.pEventAPI->EV_FindModelIndex (\"models/shell.mdl\");// brass shell\n\t\n\tif ( EV_IsLocal( idx ) )\n\t{\n\t\t// Add muzzle flash to current weapon model\n\t\tEV_MuzzleFlash();\n\t\tgEngfuncs.pEventAPI->EV_WeaponAnimation( MP5_FIRE1 + gEngfuncs.pfnRandomLong(0,2), 2 );\n\n\t\tV_PunchAxis( 0, gEngfuncs.pfnRandomFloat( -2, 2 ) );\n\t}\n\n\tEV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, right, up, 20, -12, 4 );\n\n\tEV_EjectBrass ( ShellOrigin, ShellVelocity, angles[ YAW ], shell, TE_BOUNCE_SHELL ); \n\n\tswitch( gEngfuncs.pfnRandomLong( 0, 1 ) )\n\t{\n\tcase 0:\n\t\tgEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_WEAPON, \"weapons/hks1.wav\", 1, ATTN_NORM, 0, 94 + gEngfuncs.pfnRandomLong( 0, 0xf ) );\n\t\tbreak;\n\tcase 1:\n\t\tgEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_WEAPON, \"weapons/hks2.wav\", 1, ATTN_NORM, 0, 94 + gEngfuncs.pfnRandomLong( 0, 0xf ) );\n\t\tbreak;\n\t}\n\n\tEV_GetGunPosition( args, vecSrc, origin );\n\tVectorCopy( forward, vecAiming );\n\n\tif ( gEngfuncs.GetMaxClients() > 1 )\n\t{\n\t\tEV_HLDM_FireBullets( idx, forward, right, up, 1, vecSrc, vecAiming, 8192, BULLET_PLAYER_MP5, 2, &tracerCount[idx-1], args->fparam1, args->fparam2 );\n\t}\n\telse\n\t{\n\t\tEV_HLDM_FireBullets( idx, forward, right, up, 1, vecSrc, vecAiming, 8192, BULLET_PLAYER_MP5, 2, &tracerCount[idx-1], args->fparam1, args->fparam2 );\n\t}\n}\n\n// We only predict the animation and sound\n// The grenade is still launched from the server.\nvoid EV_FireMP52( event_args_t *args )\n{\n\tint idx;\n\tvec3_t origin;\n\t\n\tidx = args->entindex;\n\tVectorCopy( args->origin, origin );\n\n\tif ( EV_IsLocal( idx ) )\n\t{\n\t\tgEngfuncs.pEventAPI->EV_WeaponAnimation( MP5_LAUNCH, 2 );\n\t\tV_PunchAxis( 0, -10 );\n\t}\n\t\n\tswitch( gEngfuncs.pfnRandomLong( 0, 1 ) )\n\t{\n\tcase 0:\n\t\tgEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_WEAPON, \"weapons/glauncher.wav\", 1, ATTN_NORM, 0, 94 + gEngfuncs.pfnRandomLong( 0, 0xf ) );\n\t\tbreak;\n\tcase 1:\n\t\tgEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_WEAPON, \"weapons/glauncher2.wav\", 1, ATTN_NORM, 0, 94 + gEngfuncs.pfnRandomLong( 0, 0xf ) );\n\t\tbreak;\n\t}\n}\n//======================\n//\t\t MP5 END\n//======================\n\n//======================\n//\t   PHYTON START \n//\t     ( .357 )\n//======================\nvoid EV_FirePython( event_args_t *args )\n{\n\tint idx;\n\tvec3_t origin;\n\tvec3_t angles;\n\tvec3_t velocity;\n\n\tvec3_t vecSrc, vecAiming;\n\tvec3_t up, right, forward;\n\tfloat flSpread = 0.01;\n\n\tidx = args->entindex;\n\tVectorCopy( args->origin, origin );\n\tVectorCopy( args->angles, angles );\n\tVectorCopy( args->velocity, velocity );\n\n\tAngleVectors( angles, forward, right, up );\n\n\tif ( EV_IsLocal( idx ) )\n\t{\n\t\t// Python uses different body in multiplayer versus single player\n\t\tint multiplayer = gEngfuncs.GetMaxClients() == 1 ? 0 : 1;\n\n\t\t// Add muzzle flash to current weapon model\n\t\tEV_MuzzleFlash();\n\t\tgEngfuncs.pEventAPI->EV_WeaponAnimation( PYTHON_FIRE1, multiplayer ? 1 : 0 );\n\n\t\tV_PunchAxis( 0, -10.0 );\n\t}\n\n\tswitch( gEngfuncs.pfnRandomLong( 0, 1 ) )\n\t{\n\tcase 0:\n\t\tgEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_WEAPON, \"weapons/357_shot1.wav\", gEngfuncs.pfnRandomFloat(0.8, 0.9), ATTN_NORM, 0, PITCH_NORM );\n\t\tbreak;\n\tcase 1:\n\t\tgEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_WEAPON, \"weapons/357_shot2.wav\", gEngfuncs.pfnRandomFloat(0.8, 0.9), ATTN_NORM, 0, PITCH_NORM );\n\t\tbreak;\n\t}\n\n\tEV_GetGunPosition( args, vecSrc, origin );\n\t\n\tVectorCopy( forward, vecAiming );\n\n\tEV_HLDM_FireBullets( idx, forward, right, up, 1, vecSrc, vecAiming, 8192, BULLET_PLAYER_357, 0, 0, args->fparam1, args->fparam2 );\n}\n//======================\n//\t    PHYTON END \n//\t     ( .357 )\n//======================\n\n//======================\n//\t   GAUSS START \n//======================\n#define SND_CHANGE_PITCH\t(1<<7)\t\t// duplicated in protocol.h change sound pitch\n\nvoid EV_SpinGauss( event_args_t *args )\n{\n\tint idx;\n\tvec3_t origin;\n\tvec3_t angles;\n\tvec3_t velocity;\n\tint iSoundState = 0;\n\n\tint pitch;\n\n\tidx = args->entindex;\n\tVectorCopy( args->origin, origin );\n\tVectorCopy( args->angles, angles );\n\tVectorCopy( args->velocity, velocity );\n\n\tpitch = args->iparam1;\n\n\tiSoundState = args->bparam1 ? SND_CHANGE_PITCH : 0;\n\n\tgEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_WEAPON, \"ambience/pulsemachine.wav\", 1.0, ATTN_NORM, iSoundState, pitch );\n}\n\n/*\n==============================\nEV_StopPreviousGauss\n\n==============================\n*/\nvoid EV_StopPreviousGauss( int idx )\n{\n\t// Make sure we don't have a gauss spin event in the queue for this guy\n\tgEngfuncs.pEventAPI->EV_KillEvents( idx, \"events/gaussspin.sc\" );\n\tgEngfuncs.pEventAPI->EV_StopSound( idx, CHAN_WEAPON, \"ambience/pulsemachine.wav\" );\n}\n\nextern float g_flApplyVel;\n\nvoid EV_FireGauss( event_args_t *args )\n{\n\tint idx;\n\tvec3_t origin;\n\tvec3_t angles;\n\tvec3_t velocity;\n\tfloat flDamage = args->fparam1;\n\tint primaryfire = args->bparam1;\n\n\tint m_fPrimaryFire = args->bparam1;\n\tint m_iWeaponVolume = GAUSS_PRIMARY_FIRE_VOLUME;\n\tvec3_t vecSrc;\n\tvec3_t vecDest;\n\tedict_t\t\t*pentIgnore;\n\tpmtrace_t tr, beam_tr;\n\tfloat flMaxFrac = 1.0;\n\tint\tnTotal = 0;\n\tint fHasPunched = 0;\n\tint fFirstBeam = 1;\n\tint\tnMaxHits = 10;\n\tphysent_t *pEntity;\n\tint m_iBeam, m_iGlow, m_iBalls;\n\tvec3_t up, right, forward;\n\n\tidx = args->entindex;\n\tVectorCopy( args->origin, origin );\n\tVectorCopy( args->angles, angles );\n\tVectorCopy( args->velocity, velocity );\n\n\tif ( args->bparam2 )\n\t{\n\t\tEV_StopPreviousGauss( idx );\n\t\treturn;\n\t}\n\n//\tCon_Printf( \"Firing gauss with %f\\n\", flDamage );\n\tEV_GetGunPosition( args, vecSrc, origin );\n\n\tm_iBeam = gEngfuncs.pEventAPI->EV_FindModelIndex( \"sprites/smoke.spr\" );\n\tm_iBalls = m_iGlow = gEngfuncs.pEventAPI->EV_FindModelIndex( \"sprites/hotglow.spr\" );\n\t\n\tAngleVectors( angles, forward, right, up );\n\n\tVectorMA( vecSrc, 8192, forward, vecDest );\n\n\tif ( EV_IsLocal( idx ) )\n\t{\n\t\tV_PunchAxis( 0, -2.0 );\n\t\tgEngfuncs.pEventAPI->EV_WeaponAnimation( GAUSS_FIRE2, 2 );\n\n\t\tif ( m_fPrimaryFire == false )\n\t\t\t g_flApplyVel = flDamage;\t\n\t\t\t \n\t}\n\n\tgEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_WEAPON, \"weapons/gauss2.wav\", 0.5 + flDamage * (1.0 / 400.0), ATTN_NORM, 0, 85 + gEngfuncs.pfnRandomLong( 0, 0x1f ) );\n\n\twhile (flDamage > 10 && nMaxHits > 0)\n\t{\n\t\tnMaxHits--;\n\n\t\tgEngfuncs.pEventAPI->EV_SetUpPlayerPrediction( false, true );\n\t\t\n\t\t// Store off the old count\n\t\tgEngfuncs.pEventAPI->EV_PushPMStates();\n\t\n\t\t// Now add in all of the players.\n\t\tgEngfuncs.pEventAPI->EV_SetSolidPlayers ( idx - 1 );\t\n\n\t\tgEngfuncs.pEventAPI->EV_SetTraceHull( 2 );\n\t\tgEngfuncs.pEventAPI->EV_PlayerTrace( vecSrc, vecDest, PM_STUDIO_BOX, -1, &tr );\n\n\t\tgEngfuncs.pEventAPI->EV_PopPMStates();\n\n\t\tif ( tr.allsolid )\n\t\t\tbreak;\n\n\t\tif (fFirstBeam)\n\t\t{\n\t\t\tif ( EV_IsLocal( idx ) )\n\t\t\t{\n\t\t\t\t// Add muzzle flash to current weapon model\n\t\t\t\tEV_MuzzleFlash();\n\t\t\t}\n\t\t\tfFirstBeam = 0;\n\n\t\t\tgEngfuncs.pEfxAPI->R_BeamEntPoint( \n\t\t\t\tidx | 0x1000,\n\t\t\t\ttr.endpos,\n\t\t\t\tm_iBeam,\n\t\t\t\t0.1,\n\t\t\t\tm_fPrimaryFire ? 1.0 : 2.5,\n\t\t\t\t0.0,\n\t\t\t\tm_fPrimaryFire ? 128.0 : flDamage,\n\t\t\t\t0,\n\t\t\t\t0,\n\t\t\t\t0,\n\t\t\t\tm_fPrimaryFire ? 255 : 255,\n\t\t\t\tm_fPrimaryFire ? 128 : 255,\n\t\t\t\tm_fPrimaryFire ? 0 : 255\n\t\t\t);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tgEngfuncs.pEfxAPI->R_BeamPoints( vecSrc,\n\t\t\t\ttr.endpos,\n\t\t\t\tm_iBeam,\n\t\t\t\t0.1,\n\t\t\t\tm_fPrimaryFire ? 1.0 : 2.5,\n\t\t\t\t0.0,\n\t\t\t\tm_fPrimaryFire ? 128.0 : flDamage,\n\t\t\t\t0,\n\t\t\t\t0,\n\t\t\t\t0,\n\t\t\t\tm_fPrimaryFire ? 255 : 255,\n\t\t\t\tm_fPrimaryFire ? 128 : 255,\n\t\t\t\tm_fPrimaryFire ? 0 : 255\n\t\t\t);\n\t\t}\n\n\t\tpEntity = gEngfuncs.pEventAPI->EV_GetPhysent( tr.ent );\n\t\tif ( pEntity == NULL )\n\t\t\tbreak;\n\n\t\tif ( pEntity->solid == SOLID_BSP )\n\t\t{\n\t\t\tfloat n;\n\n\t\t\tpentIgnore = NULL;\n\n\t\t\tn = -DotProduct( tr.plane.normal, forward );\n\n\t\t\tif (n < 0.5) // 60 degrees\t\n\t\t\t{\n\t\t\t\t// ALERT( at_console, \"reflect %f\\n\", n );\n\t\t\t\t// reflect\n\t\t\t\tvec3_t r;\n\t\t\t\n\t\t\t\tVectorMA( forward, 2.0 * n, tr.plane.normal, r );\n\n\t\t\t\tflMaxFrac = flMaxFrac - tr.fraction;\n\t\t\t\t\n\t\t\t\tVectorCopy( r, forward );\n\n\t\t\t\tVectorMA( tr.endpos, 8.0, forward, vecSrc );\n\t\t\t\tVectorMA( vecSrc, 8192.0, forward, vecDest );\n\n\t\t\t\tgEngfuncs.pEfxAPI->R_TempSprite( tr.endpos, vec3_origin, 0.2, m_iGlow, kRenderGlow, kRenderFxNoDissipation, flDamage * n / 255.0, flDamage * n * 0.5 * 0.1, FTENT_FADEOUT );\n\n\t\t\t\tvec3_t fwd;\n\t\t\t\tVectorAdd( tr.endpos, tr.plane.normal, fwd );\n\n\t\t\t\tgEngfuncs.pEfxAPI->R_Sprite_Trail( TE_SPRITETRAIL, tr.endpos, fwd, m_iBalls, 3, 0.1, gEngfuncs.pfnRandomFloat( 10, 20 ) / 100.0, 100,\n\t\t\t\t\t\t\t\t\t255, 100 );\n\n\t\t\t\t// lose energy\n\t\t\t\tif ( n == 0 )\n\t\t\t\t{\n\t\t\t\t\tn = 0.1;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tflDamage = flDamage * (1 - n);\n\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t// tunnel\n\t\t\t\tEV_HLDM_DecalGunshot( &tr, BULLET_MONSTER_12MM );\n\n\t\t\t\tgEngfuncs.pEfxAPI->R_TempSprite( tr.endpos, vec3_origin, 1.0, m_iGlow, kRenderGlow, kRenderFxNoDissipation, flDamage / 255.0, 6.0, FTENT_FADEOUT );\n\n\t\t\t\t// limit it to one hole punch\n\t\t\t\tif (fHasPunched)\n\t\t\t\t{\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tfHasPunched = 1;\n\t\t\t\t\n\t\t\t\t// try punching through wall if secondary attack (primary is incapable of breaking through)\n\t\t\t\tif ( !m_fPrimaryFire )\n\t\t\t\t{\n\t\t\t\t\tvec3_t start;\n\n\t\t\t\t\tVectorMA( tr.endpos, 8.0, forward, start );\n\n\t\t\t\t\t// Store off the old count\n\t\t\t\t\tgEngfuncs.pEventAPI->EV_PushPMStates();\n\t\t\t\t\t\t\n\t\t\t\t\t// Now add in all of the players.\n\t\t\t\t\tgEngfuncs.pEventAPI->EV_SetSolidPlayers ( idx - 1 );\n\n\t\t\t\t\tgEngfuncs.pEventAPI->EV_SetTraceHull( 2 );\n\t\t\t\t\tgEngfuncs.pEventAPI->EV_PlayerTrace( start, vecDest, PM_STUDIO_BOX, -1, &beam_tr );\n\n\t\t\t\t\tif ( !beam_tr.allsolid )\n\t\t\t\t\t{\n\t\t\t\t\t\tvec3_t delta;\n\t\t\t\t\t\tfloat n;\n\n\t\t\t\t\t\t// trace backwards to find exit point\n\n\t\t\t\t\t\tgEngfuncs.pEventAPI->EV_PlayerTrace( beam_tr.endpos, tr.endpos, PM_STUDIO_BOX, -1, &beam_tr );\n\n\t\t\t\t\t\tVectorSubtract( beam_tr.endpos, tr.endpos, delta );\n\t\t\t\t\t\t\n\t\t\t\t\t\tn = Length( delta );\n\n\t\t\t\t\t\tif (n < flDamage)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif (n == 0)\n\t\t\t\t\t\t\t\tn = 1;\n\t\t\t\t\t\t\tflDamage -= n;\n\n\t\t\t\t\t\t\t// absorption balls\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tvec3_t fwd;\n\t\t\t\t\t\t\t\tVectorSubtract( tr.endpos, forward, fwd );\n\t\t\t\t\t\t\t\tgEngfuncs.pEfxAPI->R_Sprite_Trail( TE_SPRITETRAIL, tr.endpos, fwd, m_iBalls, 3, 0.1, gEngfuncs.pfnRandomFloat( 10, 20 ) / 100.0, 100,\n\t\t\t\t\t\t\t\t\t255, 100 );\n\t\t\t\t\t\t\t}\n\n\t//////////////////////////////////// WHAT TO DO HERE\n\t\t\t\t\t\t\t// CSoundEnt::InsertSound ( bits_SOUND_COMBAT, pev->origin, NORMAL_EXPLOSION_VOLUME, 3.0 );\n\n\t\t\t\t\t\t\tEV_HLDM_DecalGunshot( &beam_tr, BULLET_MONSTER_12MM );\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tgEngfuncs.pEfxAPI->R_TempSprite( beam_tr.endpos, vec3_origin, 0.1, m_iGlow, kRenderGlow, kRenderFxNoDissipation, flDamage / 255.0, 6.0, FTENT_FADEOUT );\n\t\t\t\n\t\t\t\t\t\t\t// balls\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tvec3_t fwd;\n\t\t\t\t\t\t\t\tVectorSubtract( beam_tr.endpos, forward, fwd );\n\t\t\t\t\t\t\t\tgEngfuncs.pEfxAPI->R_Sprite_Trail( TE_SPRITETRAIL, beam_tr.endpos, fwd, m_iBalls, (int)(flDamage * 0.3), 0.1, gEngfuncs.pfnRandomFloat( 10, 20 ) / 100.0, 200,\n\t\t\t\t\t\t\t\t\t255, 40 );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tVectorAdd( beam_tr.endpos, forward, vecSrc );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tflDamage = 0;\n\t\t\t\t\t}\n\n\t\t\t\t\tgEngfuncs.pEventAPI->EV_PopPMStates();\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tif ( m_fPrimaryFire )\n\t\t\t\t\t{\n\t\t\t\t\t\t// slug doesn't punch through ever with primary \n\t\t\t\t\t\t// fire, so leave a little glowy bit and make some balls\n\t\t\t\t\t\tgEngfuncs.pEfxAPI->R_TempSprite( tr.endpos, vec3_origin, 0.2, m_iGlow, kRenderGlow, kRenderFxNoDissipation, 200.0 / 255.0, 0.3, FTENT_FADEOUT );\n\t\t\t\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tvec3_t fwd;\n\t\t\t\t\t\t\tVectorAdd( tr.endpos, tr.plane.normal, fwd );\n\t\t\t\t\t\t\tgEngfuncs.pEfxAPI->R_Sprite_Trail( TE_SPRITETRAIL, tr.endpos, fwd, m_iBalls, 8, 0.6, gEngfuncs.pfnRandomFloat( 10, 20 ) / 100.0, 100,\n\t\t\t\t\t\t\t\t255, 200 );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tflDamage = 0;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tVectorAdd( tr.endpos, forward, vecSrc );\n\t\t}\n\t}\n}\n//======================\n//\t   GAUSS END \n//======================\n\n//======================\n//\t   CROWBAR START\n//======================\n\nenum crowbar_e {\n\tCROWBAR_IDLE = 0,\n\tCROWBAR_DRAW,\n\tCROWBAR_HOLSTER,\n\tCROWBAR_ATTACK1HIT,\n\tCROWBAR_ATTACK1MISS,\n\tCROWBAR_ATTACK2MISS,\n\tCROWBAR_ATTACK2HIT,\n\tCROWBAR_ATTACK3MISS,\n\tCROWBAR_ATTACK3HIT\n};\n\nint g_iSwing;\n\n//Only predict the miss sounds, hit sounds are still played \n//server side, so players don't get the wrong idea.\nvoid EV_Crowbar( event_args_t *args )\n{\n\tint idx;\n\tvec3_t origin;\n\tvec3_t angles;\n\tvec3_t velocity;\n\n\tidx = args->entindex;\n\tVectorCopy( args->origin, origin );\n\t\n\t//Play Swing sound\n\tgEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_WEAPON, \"weapons/cbar_miss1.wav\", 1, ATTN_NORM, 0, PITCH_NORM); \n\n\tif ( EV_IsLocal( idx ) )\n\t{\n\t\tgEngfuncs.pEventAPI->EV_WeaponAnimation( CROWBAR_ATTACK1MISS, 1 );\n\n\t\tswitch( (g_iSwing++) % 3 )\n\t\t{\n\t\t\tcase 0:\n\t\t\t\tgEngfuncs.pEventAPI->EV_WeaponAnimation ( CROWBAR_ATTACK1MISS, 1 ); break;\n\t\t\tcase 1:\n\t\t\t\tgEngfuncs.pEventAPI->EV_WeaponAnimation ( CROWBAR_ATTACK2MISS, 1 ); break;\n\t\t\tcase 2:\n\t\t\t\tgEngfuncs.pEventAPI->EV_WeaponAnimation ( CROWBAR_ATTACK3MISS, 1 ); break;\n\t\t}\n\t}\n}\n//======================\n//\t   CROWBAR END \n//======================\n\n//======================\n//\t  CROSSBOW START\n//======================\nenum crossbow_e {\n\tCROSSBOW_IDLE1 = 0,\t// full\n\tCROSSBOW_IDLE2,\t\t// empty\n\tCROSSBOW_FIDGET1,\t// full\n\tCROSSBOW_FIDGET2,\t// empty\n\tCROSSBOW_FIRE1,\t\t// full\n\tCROSSBOW_FIRE2,\t\t// reload\n\tCROSSBOW_FIRE3,\t\t// empty\n\tCROSSBOW_RELOAD,\t// from empty\n\tCROSSBOW_DRAW1,\t\t// full\n\tCROSSBOW_DRAW2,\t\t// empty\n\tCROSSBOW_HOLSTER1,\t// full\n\tCROSSBOW_HOLSTER2,\t// empty\n};\n\n//=====================\n// EV_BoltCallback\n// This function is used to correct the origin and angles \n// of the bolt, so it looks like it's stuck on the wall.\n//=====================\nvoid EV_BoltCallback ( struct tempent_s *ent, float frametime, float currenttime )\n{\n\tent->entity.origin = ent->entity.baseline.vuser1;\n\tent->entity.angles = ent->entity.baseline.vuser2;\n}\n\nvoid EV_FireCrossbow2( event_args_t *args )\n{\n\tvec3_t vecSrc, vecEnd;\n\tvec3_t up, right, forward;\n\tpmtrace_t tr;\n\n\tint idx;\n\tvec3_t origin;\n\tvec3_t angles;\n\tvec3_t velocity;\n\n\tidx = args->entindex;\n\tVectorCopy( args->origin, origin );\n\tVectorCopy( args->angles, angles );\n\n\tVectorCopy( args->velocity, velocity );\n\t\n\tAngleVectors( angles, forward, right, up );\n\n\tEV_GetGunPosition( args, vecSrc, origin );\n\n\tVectorMA( vecSrc, 8192, forward, vecEnd );\n\n\tgEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_WEAPON, \"weapons/xbow_fire1.wav\", 1, ATTN_NORM, 0, 93 + gEngfuncs.pfnRandomLong(0,0xF) );\n\tgEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_ITEM, \"weapons/xbow_reload1.wav\", gEngfuncs.pfnRandomFloat(0.95, 1.0), ATTN_NORM, 0, 93 + gEngfuncs.pfnRandomLong(0,0xF) );\n\n\tif ( EV_IsLocal( idx ) )\n\t{\n\t\tif ( args->iparam1 )\n\t\t\tgEngfuncs.pEventAPI->EV_WeaponAnimation( CROSSBOW_FIRE1, 1 );\n\t\telse if ( args->iparam2 )\n\t\t\tgEngfuncs.pEventAPI->EV_WeaponAnimation( CROSSBOW_FIRE3, 1 );\n\t}\n\n\t// Store off the old count\n\tgEngfuncs.pEventAPI->EV_PushPMStates();\n\n\t// Now add in all of the players.\n\tgEngfuncs.pEventAPI->EV_SetSolidPlayers ( idx - 1 );\t\n\tgEngfuncs.pEventAPI->EV_SetTraceHull( 2 );\n\tgEngfuncs.pEventAPI->EV_PlayerTrace( vecSrc, vecEnd, PM_STUDIO_BOX, -1, &tr );\n\t\n\t//We hit something\n\tif ( tr.fraction < 1.0 )\n\t{\n\t\tphysent_t *pe = gEngfuncs.pEventAPI->EV_GetPhysent( tr.ent ); \n\n\t\t//Not the world, let's assume we hit something organic ( dog, cat, uncle joe, etc ).\n\t\tif ( pe->solid != SOLID_BSP )\n\t\t{\n\t\t\tswitch( gEngfuncs.pfnRandomLong(0,1) )\n\t\t\t{\n\t\t\tcase 0:\n\t\t\t\tgEngfuncs.pEventAPI->EV_PlaySound( idx, tr.endpos, CHAN_BODY, \"weapons/xbow_hitbod1.wav\", 1, ATTN_NORM, 0, PITCH_NORM ); break;\n\t\t\tcase 1:\n\t\t\t\tgEngfuncs.pEventAPI->EV_PlaySound( idx, tr.endpos, CHAN_BODY, \"weapons/xbow_hitbod2.wav\", 1, ATTN_NORM, 0, PITCH_NORM ); break;\n\t\t\t}\n\t\t}\n\t\t//Stick to world but don't stick to glass, it might break and leave the bolt floating. It can still stick to other non-transparent breakables though.\n\t\telse if ( pe->rendermode == kRenderNormal ) \n\t\t{\n\t\t\tgEngfuncs.pEventAPI->EV_PlaySound( 0, tr.endpos, CHAN_BODY, \"weapons/xbow_hit1.wav\", gEngfuncs.pfnRandomFloat(0.95, 1.0), ATTN_NORM, 0, PITCH_NORM );\n\t\t\n\t\t\t//Not underwater, do some sparks...\n\t\t\tif ( gEngfuncs.PM_PointContents( tr.endpos, NULL ) != CONTENTS_WATER)\n\t\t\t\t gEngfuncs.pEfxAPI->R_SparkShower( tr.endpos );\n\n\t\t\tvec3_t vBoltAngles;\n\t\t\tint iModelIndex = gEngfuncs.pEventAPI->EV_FindModelIndex( \"models/crossbow_bolt.mdl\" );\n\n\t\t\tVectorAngles( forward, vBoltAngles );\n\n\t\t\tTEMPENTITY *bolt = gEngfuncs.pEfxAPI->R_TempModel( tr.endpos - forward * 10, Vector( 0, 0, 0), vBoltAngles , 5, iModelIndex, TE_BOUNCE_NULL );\n\t\t\t\n\t\t\tif ( bolt )\n\t\t\t{\n\t\t\t\tbolt->flags |= ( FTENT_CLIENTCUSTOM ); //So it calls the callback function.\n\t\t\t\tbolt->entity.baseline.vuser1 = tr.endpos - forward * 10; // Pull out a little bit\n\t\t\t\tbolt->entity.baseline.vuser2 = vBoltAngles; //Look forward!\n\t\t\t\tbolt->callback = EV_BoltCallback; //So we can set the angles and origin back. (Stick the bolt to the wall)\n\t\t\t}\n\t\t}\n\t}\n\n\tgEngfuncs.pEventAPI->EV_PopPMStates();\n}\n\n//TODO: Fully predict the fliying bolt.\nvoid EV_FireCrossbow( event_args_t *args )\n{\n\tint idx;\n\tvec3_t origin;\n\n\tidx = args->entindex;\n\tVectorCopy( args->origin, origin );\n\t\n\tgEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_WEAPON, \"weapons/xbow_fire1.wav\", 1, ATTN_NORM, 0, 93 + gEngfuncs.pfnRandomLong(0,0xF) );\n\tgEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_ITEM, \"weapons/xbow_reload1.wav\", gEngfuncs.pfnRandomFloat(0.95, 1.0), ATTN_NORM, 0, 93 + gEngfuncs.pfnRandomLong(0,0xF) );\n\n\t//Only play the weapon anims if I shot it. \n\tif ( EV_IsLocal( idx ) )\n\t{\n\t\tif ( args->iparam1 )\n\t\t\tgEngfuncs.pEventAPI->EV_WeaponAnimation( CROSSBOW_FIRE1, 1 );\n\t\telse if ( args->iparam2 )\n\t\t\tgEngfuncs.pEventAPI->EV_WeaponAnimation( CROSSBOW_FIRE3, 1 );\n\n\t\tV_PunchAxis( 0, -2.0 );\n\t}\n}\n//======================\n//\t   CROSSBOW END \n//======================\n\n//======================\n//\t    RPG START \n//======================\nenum rpg_e {\n\tRPG_IDLE = 0,\n\tRPG_FIDGET,\n\tRPG_RELOAD,\t\t// to reload\n\tRPG_FIRE2,\t\t// to empty\n\tRPG_HOLSTER1,\t// loaded\n\tRPG_DRAW1,\t\t// loaded\n\tRPG_HOLSTER2,\t// unloaded\n\tRPG_DRAW_UL,\t// unloaded\n\tRPG_IDLE_UL,\t// unloaded idle\n\tRPG_FIDGET_UL,\t// unloaded fidget\n};\n\nvoid EV_FireRpg( event_args_t *args )\n{\n\tint idx;\n\tvec3_t origin;\n\n\tidx = args->entindex;\n\tVectorCopy( args->origin, origin );\n\t\n\tgEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_WEAPON, \"weapons/rocketfire1.wav\", 0.9, ATTN_NORM, 0, PITCH_NORM );\n\tgEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_ITEM, \"weapons/glauncher.wav\", 0.7, ATTN_NORM, 0, PITCH_NORM );\n\n\t//Only play the weapon anims if I shot it. \n\tif ( EV_IsLocal( idx ) )\n\t{\n\t\tgEngfuncs.pEventAPI->EV_WeaponAnimation( RPG_FIRE2, 1 );\n\t\n\t\tV_PunchAxis( 0, -5.0 );\n\t}\n}\n//======================\n//\t     RPG END \n//======================\n\n//======================\n//\t    EGON END \n//======================\nenum egon_e {\n\tEGON_IDLE1 = 0,\n\tEGON_FIDGET1,\n\tEGON_ALTFIREON,\n\tEGON_ALTFIRECYCLE,\n\tEGON_ALTFIREOFF,\n\tEGON_FIRE1,\n\tEGON_FIRE2,\n\tEGON_FIRE3,\n\tEGON_FIRE4,\n\tEGON_DRAW,\n\tEGON_HOLSTER\n};\n\nint g_fireAnims1[] = { EGON_FIRE1, EGON_FIRE2, EGON_FIRE3, EGON_FIRE4 };\nint g_fireAnims2[] = { EGON_ALTFIRECYCLE };\n\nenum EGON_FIRESTATE { FIRE_OFF, FIRE_CHARGE };\nenum EGON_FIREMODE { FIRE_NARROW, FIRE_WIDE};\n\n#define\tEGON_PRIMARY_VOLUME\t\t450\n#define EGON_BEAM_SPRITE\t\t\"sprites/xbeam1.spr\"\n#define EGON_FLARE_SPRITE\t\t\"sprites/XSpark1.spr\"\n#define EGON_SOUND_OFF\t\t\t\"weapons/egon_off1.wav\"\n#define EGON_SOUND_RUN\t\t\t\"weapons/egon_run3.wav\"\n#define EGON_SOUND_STARTUP\t\t\"weapons/egon_windup2.wav\"\n\n#define ARRAYSIZE(p)\t\t(sizeof(p)/sizeof(p[0]))\n\nBEAM *pBeam;\nBEAM *pBeam2;\n\nvoid EV_EgonFire( event_args_t *args )\n{\n\tint idx, iFireState, iFireMode;\n\tvec3_t origin;\n\n\tidx = args->entindex;\n\tVectorCopy( args->origin, origin );\n\tiFireState = args->iparam1;\n\tiFireMode = args->iparam2;\n\tint iStartup = args->bparam1;\n\n\n\tif ( iStartup )\n\t{\n\t\tif ( iFireMode == FIRE_WIDE )\n\t\t\tgEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_WEAPON, EGON_SOUND_STARTUP, 0.98, ATTN_NORM, 0, 125 );\n\t\telse\n\t\t\tgEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_WEAPON, EGON_SOUND_STARTUP, 0.9, ATTN_NORM, 0, 100 );\n\t}\n\telse\n\t{\n\t\tif ( iFireMode == FIRE_WIDE )\n\t\t\tgEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_STATIC, EGON_SOUND_RUN, 0.98, ATTN_NORM, 0, 125 );\n\t\telse\n\t\t\tgEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_STATIC, EGON_SOUND_RUN, 0.9, ATTN_NORM, 0, 100 );\n\t}\n\n\t//Only play the weapon anims if I shot it.\n\tif ( EV_IsLocal( idx ) )\n\t\tgEngfuncs.pEventAPI->EV_WeaponAnimation ( g_fireAnims1[ gEngfuncs.pfnRandomLong( 0, 3 ) ], 1 );\n\n\tif ( iStartup == 1 && EV_IsLocal( idx ) && !pBeam && !pBeam2 && cl_lw->value ) //Adrian: Added the cl_lw check for those lital people that hate weapon prediction.\n\t{\n\t\tvec3_t vecSrc, vecEnd, origin, angles, forward, right, up;\n\t\tpmtrace_t tr;\n\n\t\tcl_entity_t *pl = gEngfuncs.GetEntityByIndex( idx );\n\n\t\tif ( pl )\n\t\t{\n\t\t\tVectorCopy( gHUD.m_vecAngles, angles );\n\t\t\t\n\t\t\tAngleVectors( angles, forward, right, up );\n\n\t\t\tEV_GetGunPosition( args, vecSrc, pl->origin );\n\n\t\t\tVectorMA( vecSrc, 2048, forward, vecEnd );\n\n\t\t\tgEngfuncs.pEventAPI->EV_SetUpPlayerPrediction( false, true );\t\n\t\t\t\t\n\t\t\t// Store off the old count\n\t\t\tgEngfuncs.pEventAPI->EV_PushPMStates();\n\t\t\t\n\t\t\t// Now add in all of the players.\n\t\t\tgEngfuncs.pEventAPI->EV_SetSolidPlayers ( idx - 1 );\t\n\n\t\t\tgEngfuncs.pEventAPI->EV_SetTraceHull( 2 );\n\t\t\tgEngfuncs.pEventAPI->EV_PlayerTrace( vecSrc, vecEnd, PM_STUDIO_BOX, -1, &tr );\n\n\t\t\tgEngfuncs.pEventAPI->EV_PopPMStates();\n\n\t\t\tint iBeamModelIndex = gEngfuncs.pEventAPI->EV_FindModelIndex( EGON_BEAM_SPRITE );\n\n\t\t\tfloat r = 50.0f;\n\t\t\tfloat g = 50.0f;\n\t\t\tfloat b = 125.0f;\n\n\t\t\tif ( IEngineStudio.IsHardware() )\n\t\t\t{\n\t\t\t\tr /= 100.0f;\n\t\t\t\tg /= 100.0f;\n\t\t\t}\n\t\t\t\t\n\t\t\n\t\t\tpBeam = gEngfuncs.pEfxAPI->R_BeamEntPoint ( idx | 0x1000, tr.endpos, iBeamModelIndex, 99999, 3.5, 0.2, 0.7, 55, 0, 0, r, g, b );\n\n\t\t\tif ( pBeam )\n\t\t\t\t pBeam->flags |= ( FBEAM_SINENOISE );\n \n\t\t\tpBeam2 = gEngfuncs.pEfxAPI->R_BeamEntPoint ( idx | 0x1000, tr.endpos, iBeamModelIndex, 99999, 5.0, 0.08, 0.7, 25, 0, 0, r, g, b );\n\t\t}\n\t}\n}\n\nvoid EV_EgonStop( event_args_t *args )\n{\n\tint idx;\n\tvec3_t origin;\n\n\tidx = args->entindex;\n\tVectorCopy ( args->origin, origin );\n\n\tgEngfuncs.pEventAPI->EV_StopSound( idx, CHAN_STATIC, EGON_SOUND_RUN );\n\t\n\tif ( args->iparam1 )\n\t\t gEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_WEAPON, EGON_SOUND_OFF, 0.98, ATTN_NORM, 0, 100 );\n\n\tif ( EV_IsLocal( idx ) ) \n\t{\n\t\tif ( pBeam )\n\t\t{\n\t\t\tpBeam->die = 0.0;\n\t\t\tpBeam = NULL;\n\t\t}\n\t\t\t\n\t\t\n\t\tif ( pBeam2 )\n\t\t{\n\t\t\tpBeam2->die = 0.0;\n\t\t\tpBeam2 = NULL;\n\t\t}\n\t}\n}\n//======================\n//\t    EGON END \n//======================\n\n//======================\n//\t   HORNET START\n//======================\nenum hgun_e {\n\tHGUN_IDLE1 = 0,\n\tHGUN_FIDGETSWAY,\n\tHGUN_FIDGETSHAKE,\n\tHGUN_DOWN,\n\tHGUN_UP,\n\tHGUN_SHOOT\n};\n\nvoid EV_HornetGunFire( event_args_t *args )\n{\n\tint idx, iFireMode;\n\tvec3_t origin, angles, vecSrc, forward, right, up;\n\n\tidx = args->entindex;\n\tVectorCopy( args->origin, origin );\n\tVectorCopy( args->angles, angles );\n\tiFireMode = args->iparam1;\n\n\t//Only play the weapon anims if I shot it.\n\tif ( EV_IsLocal( idx ) )\n\t{\n\t\tV_PunchAxis( 0, gEngfuncs.pfnRandomLong ( 0, 2 ) );\n\t\tgEngfuncs.pEventAPI->EV_WeaponAnimation ( HGUN_SHOOT, 1 );\n\t}\n\n\tswitch ( gEngfuncs.pfnRandomLong ( 0 , 2 ) )\n\t{\n\t\tcase 0:\tgEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_WEAPON, \"agrunt/ag_fire1.wav\", 1, ATTN_NORM, 0, 100 );\tbreak;\n\t\tcase 1:\tgEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_WEAPON, \"agrunt/ag_fire2.wav\", 1, ATTN_NORM, 0, 100 );\tbreak;\n\t\tcase 2:\tgEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_WEAPON, \"agrunt/ag_fire3.wav\", 1, ATTN_NORM, 0, 100 );\tbreak;\n\t}\n}\n//======================\n//\t   HORNET END\n//======================\n\n//======================\n//\t   TRIPMINE START\n//======================\nenum tripmine_e {\n\tTRIPMINE_IDLE1 = 0,\n\tTRIPMINE_IDLE2,\n\tTRIPMINE_ARM1,\n\tTRIPMINE_ARM2,\n\tTRIPMINE_FIDGET,\n\tTRIPMINE_HOLSTER,\n\tTRIPMINE_DRAW,\n\tTRIPMINE_WORLD,\n\tTRIPMINE_GROUND,\n};\n\n//We only check if it's possible to put a trip mine\n//and if it is, then we play the animation. Server still places it.\nvoid EV_TripmineFire( event_args_t *args )\n{\n\tint idx;\n\tvec3_t vecSrc, angles, view_ofs, forward;\n\tpmtrace_t tr;\n\n\tidx = args->entindex;\n\tVectorCopy( args->origin, vecSrc );\n\tVectorCopy( args->angles, angles );\n\n\tAngleVectors ( angles, forward, NULL, NULL );\n\t\t\n\tif ( !EV_IsLocal ( idx ) )\n\t\treturn;\n\n\t// Grab predicted result for local player\n\tgEngfuncs.pEventAPI->EV_LocalPlayerViewheight( view_ofs );\n\n\tvecSrc = vecSrc + view_ofs;\n\n\t// Store off the old count\n\tgEngfuncs.pEventAPI->EV_PushPMStates();\n\n\t// Now add in all of the players.\n\tgEngfuncs.pEventAPI->EV_SetSolidPlayers ( idx - 1 );\t\n\tgEngfuncs.pEventAPI->EV_SetTraceHull( 2 );\n\tgEngfuncs.pEventAPI->EV_PlayerTrace( vecSrc, vecSrc + forward * 128, PM_NORMAL, -1, &tr );\n\n\t//Hit something solid\n\tif ( tr.fraction < 1.0 )\n\t\t gEngfuncs.pEventAPI->EV_WeaponAnimation ( TRIPMINE_DRAW, 0 );\n\t\n\tgEngfuncs.pEventAPI->EV_PopPMStates();\n}\n//======================\n//\t   TRIPMINE END\n//======================\n\n//======================\n//\t   SQUEAK START\n//======================\nenum squeak_e {\n\tSQUEAK_IDLE1 = 0,\n\tSQUEAK_FIDGETFIT,\n\tSQUEAK_FIDGETNIP,\n\tSQUEAK_DOWN,\n\tSQUEAK_UP,\n\tSQUEAK_THROW\n};\n\n#define VEC_HULL_MIN\t\tVector(-16, -16, -36)\n#define VEC_DUCK_HULL_MIN\tVector(-16, -16, -18 )\n\nvoid EV_SnarkFire( event_args_t *args )\n{\n\tint idx;\n\tvec3_t vecSrc, angles, view_ofs, forward;\n\tpmtrace_t tr;\n\n\tidx = args->entindex;\n\tVectorCopy( args->origin, vecSrc );\n\tVectorCopy( args->angles, angles );\n\n\tAngleVectors ( angles, forward, NULL, NULL );\n\t\t\n\tif ( !EV_IsLocal ( idx ) )\n\t\treturn;\n\t\n\tif ( args->ducking )\n\t\tvecSrc = vecSrc - ( VEC_HULL_MIN - VEC_DUCK_HULL_MIN );\n\t\n\t// Store off the old count\n\tgEngfuncs.pEventAPI->EV_PushPMStates();\n\n\t// Now add in all of the players.\n\tgEngfuncs.pEventAPI->EV_SetSolidPlayers ( idx - 1 );\t\n\tgEngfuncs.pEventAPI->EV_SetTraceHull( 2 );\n\tgEngfuncs.pEventAPI->EV_PlayerTrace( vecSrc + forward * 20, vecSrc + forward * 64, PM_NORMAL, -1, &tr );\n\n\t//Find space to drop the thing.\n\tif ( tr.allsolid == 0 && tr.startsolid == 0 && tr.fraction > 0.25 )\n\t\t gEngfuncs.pEventAPI->EV_WeaponAnimation ( SQUEAK_THROW, 0 );\n\t\n\tgEngfuncs.pEventAPI->EV_PopPMStates();\n}\n//======================\n//\t   SQUEAK END\n//======================\n\nvoid EV_TrainPitchAdjust( event_args_t *args )\n{\n\tint idx;\n\tvec3_t origin;\n\n\tunsigned short us_params;\n\tint noise;\n\tfloat m_flVolume;\n\tint pitch;\n\tint stop;\n\t\n\tchar sz[ 256 ];\n\n\tidx = args->entindex;\n\t\n\tVectorCopy( args->origin, origin );\n\n\tus_params = (unsigned short)args->iparam1;\n\tstop\t  = args->bparam1;\n\n\tm_flVolume\t= (float)(us_params & 0x003f)/40.0;\n\tnoise\t\t= (int)(((us_params) >> 12 ) & 0x0007);\n\tpitch\t\t= (int)( 10.0 * (float)( ( us_params >> 6 ) & 0x003f ) );\n\n\tswitch ( noise )\n\t{\n\tcase 1: strcpy( sz, \"plats/ttrain1.wav\"); break;\n\tcase 2: strcpy( sz, \"plats/ttrain2.wav\"); break;\n\tcase 3: strcpy( sz, \"plats/ttrain3.wav\"); break; \n\tcase 4: strcpy( sz, \"plats/ttrain4.wav\"); break;\n\tcase 5: strcpy( sz, \"plats/ttrain6.wav\"); break;\n\tcase 6: strcpy( sz, \"plats/ttrain7.wav\"); break;\n\tdefault:\n\t\t// no sound\n\t\tstrcpy( sz, \"\" );\n\t\treturn;\n\t}\n\n\tif ( stop )\n\t{\n\t\tgEngfuncs.pEventAPI->EV_StopSound( idx, CHAN_STATIC, sz );\n\t}\n\telse\n\t{\n\t\tgEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_STATIC, sz, m_flVolume, ATTN_NORM, SND_CHANGE_PITCH, pitch );\n\t}\n}\n\nint EV_TFC_IsAllyTeam( int iTeam1, int iTeam2 )\n{\n\treturn 0;\n}\n\nvoid EV_Dummy( struct event_args_s *args )\n{\n\tgEngfuncs.pEventAPI->EV_WeaponAnimation( 1, 1 );\n\treturn;\n}\n\n"
  },
  {
    "path": "cl_dll/events/ev_cs16.cpp",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\t\n*\tThis product contains software technology licensed from Id \n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc. \n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n#include \"hud.h\"\n#include \"cl_util.h\"\n#include \"const.h\"\n#include \"entity_state.h\"\n#include \"cl_entity.h\"\n#include \"entity_types.h\"\n#include \"usercmd.h\"\n#include \"pm_defs.h\"\n#include \"pm_materials.h\"\n\n#include \"eventscripts.h\"\n#include \"ev_hldm.h\"\n\n#include \"r_efx.h\"\n#include \"triangleapi.h\"\n#include \"event_api.h\"\n#include \"event_args.h\"\n#include \"in_defs.h\"\n\n#include <string.h>\n\n#include \"r_studioint.h\"\n#include \"com_model.h\"\n\n#include <assert.h>\n\n#include \"pm_shared.h\"\n#include \"com_weapons.h\"\n#include \"draw_util.h\"\n\nextern float g_flRoundTime;\n\nchar EV_HLDM_PlayTextureSound( int idx, pmtrace_t *ptr, const Vector &vecSrc, const Vector &vecEnd, int iBulletType, bool& isSky )\n{\n\t// hit the world, try to play sound based on texture material type\n\tchar chTextureType = CHAR_TEX_CONCRETE;\n\tfloat fvol;\n\tconst char *rgsz[6];\n\tint cnt;\n\tfloat fattn = ATTN_NORM;\n\tint entity;\n\tchar *pTextureName;\n\tchar texname[ 64 ];\n\tchar szbuffer[ 64 ];\n\n\tentity = gEngfuncs.pEventAPI->EV_IndexFromTrace( ptr );\n\n\t// FIXME check if playtexture sounds movevar is set\n\t//\n\n\tchTextureType = 0;\n\tisSky = false;\n\n\t// Player\n\tif ( entity >= 1 && entity <= gEngfuncs.GetMaxClients() )\n\t{\n\t\t// hit body\n\t\tchTextureType = CHAR_TEX_FLESH;\n\t}\n\telse if ( entity == 0 )\n\t{\n\t\t// get texture from entity or world (world is ent(0))\n\t\tpTextureName = (char *)gEngfuncs.pEventAPI->EV_TraceTexture( ptr->ent, vecSrc, vecEnd );\n\n\t\tif ( pTextureName )\n\t\t{\n\t\t\tstrncpy( texname, pTextureName, sizeof( texname ) );\n\t\t\ttexname[ sizeof( texname ) - 1 ] = 0;\n\t\t\tpTextureName = texname;\n\n\t\t\tif( !strcmp( pTextureName, \"sky\" ) )\n\t\t\t{\n\t\t\t\tisSky = true;\n\t\t\t}\n\t\t\t// strip leading '-0' or '+0~' or '{' or '!'\n\t\t\telse if (*pTextureName == '-' || *pTextureName == '+')\n\t\t\t{\n\t\t\t\tpTextureName += 2;\n\t\t\t}\n\t\t\telse if (*pTextureName == '{' || *pTextureName == '!' || *pTextureName == '~' || *pTextureName == ' ')\n\t\t\t{\n\t\t\t\tpTextureName++;\n\t\t\t}\n\n\t\t\t// '}}'\n\t\t\tstrncpy( szbuffer, pTextureName, sizeof(szbuffer) );\n\t\t\tszbuffer[ CBTEXTURENAMEMAX - 1 ] = 0;\n\n\t\t\t// get texture type\n\t\t\tchTextureType = PM_FindTextureType( szbuffer );\n\t\t}\n\t}\n\n\tswitch (chTextureType)\n\t{\n\tdefault:\n\tcase CHAR_TEX_CONCRETE:\n\t{\n\t\tfvol = 0.9;\n\t\trgsz[0] = \"player/pl_step1.wav\";\n\t\trgsz[1] = \"player/pl_step2.wav\";\n\t\tcnt = 2;\n\t\tbreak;\n\t}\n\tcase CHAR_TEX_METAL:\n\t{\n\t\tfvol = 0.9;\n\t\trgsz[0] = \"player/pl_metal1.wav\";\n\t\trgsz[1] = \"player/pl_metal2.wav\";\n\t\tcnt = 2;\n\t\tbreak;\n\t}\n\tcase CHAR_TEX_DIRT:\n\t{\n\t\tfvol = 0.9;\n\t\trgsz[0] = \"player/pl_dirt1.wav\";\n\t\trgsz[1] = \"player/pl_dirt2.wav\";\n\t\trgsz[2] = \"player/pl_dirt3.wav\";\n\t\tcnt = 3;\n\t\tbreak;\n\t}\n\tcase CHAR_TEX_VENT:\n\t{\n\t\tfvol = 0.5;\n\t\trgsz[0] = \"player/pl_duct1.wav\";\n\t\trgsz[1] = \"player/pl_duct1.wav\";\n\t\tcnt = 2;\n\t\tbreak;\n\t}\n\tcase CHAR_TEX_GRATE:\n\t{\n\t\tfvol = 0.9;\n\t\trgsz[0] = \"player/pl_grate1.wav\";\n\t\trgsz[1] = \"player/pl_grate4.wav\";\n\t\tcnt = 2;\n\t\tbreak;\n\t}\n\tcase CHAR_TEX_TILE:\n\t{\n\t\tfvol = 0.8;\n\t\trgsz[0] = \"player/pl_tile1.wav\";\n\t\trgsz[1] = \"player/pl_tile3.wav\";\n\t\trgsz[2] = \"player/pl_tile2.wav\";\n\t\trgsz[3] = \"player/pl_tile4.wav\";\n\t\tcnt = 4;\n\t\tbreak;\n\t}\n\tcase CHAR_TEX_SLOSH:\n\t{\n\t\tfvol = 0.9;\n\t\trgsz[0] = \"player/pl_slosh1.wav\";\n\t\trgsz[1] = \"player/pl_slosh3.wav\";\n\t\trgsz[2] = \"player/pl_slosh2.wav\";\n\t\trgsz[3] = \"player/pl_slosh4.wav\";\n\t\tcnt = 4;\n\t\tbreak;\n\t}\n\tcase CHAR_TEX_SNOW:\n\t{\n\t\tfvol = 0.7;\n\t\trgsz[0] = \"player/pl_snow1.wav\";\n\t\trgsz[1] = \"player/pl_snow2.wav\";\n\t\trgsz[2] = \"player/pl_snow3.wav\";\n\t\trgsz[3] = \"player/pl_snow4.wav\";\n\t\trgsz[4] = \"player/pl_snow5.wav\";\n\t\trgsz[5] = \"player/pl_snow6.wav\";\n\t\tcnt = 6;\n\t\tbreak;\n\t}\n\tcase CHAR_TEX_WOOD:\n\t{\n\t\tfvol = 0.9;\n\t\trgsz[0] = \"debris/wood1.wav\";\n\t\trgsz[1] = \"debris/wood2.wav\";\n\t\trgsz[2] = \"debris/wood3.wav\";\n\t\tcnt = 3;\n\t\tbreak;\n\t}\n\tcase CHAR_TEX_GLASS:\n\tcase CHAR_TEX_COMPUTER:\n\t{\n\t\tfvol = 0.8;\n\t\trgsz[0] = \"debris/glass1.wav\";\n\t\trgsz[1] = \"debris/glass2.wav\";\n\t\trgsz[2] = \"debris/glass3.wav\";\n\t\tcnt = 3;\n\t\tbreak;\n\t}\n\tcase CHAR_TEX_FLESH:\n\t{\n\t\tfvol = 1.0;\n\t\trgsz[0] = \"weapons/bullet_hit1.wav\";\n\t\trgsz[1] = \"weapons/bullet_hit2.wav\";\n\t\tfattn = 1.0;\n\t\tcnt = 2;\n\t\tbreak;\n\t}\n\t}\n\n\t// play material hit sound\n\tgEngfuncs.pEventAPI->EV_PlaySound( 0, ptr->endpos, CHAN_STATIC, rgsz[Com_RandomLong(0,cnt-1)], fvol, fattn, 0, 96 + Com_RandomLong(0,0xf) );\n\n\treturn chTextureType;\n}\n\nchar *EV_HLDM_DamageDecal( physent_t *pe )\n{\n\tstatic char decalname[ 32 ];\n\tint idx;\n\n\tif ( pe->classnumber == 1 )\n\t{\n\t\tidx = Com_RandomLong( 0, 2 );\n\t\tsprintf( decalname, \"{break%i\", idx + 1 );\n\t}\n\telse if ( pe->rendermode != kRenderNormal )\n\t{\n\t\tsprintf( decalname, \"{bproof1\" );\n\t}\n\telse\n\t{\n\t\tidx = Com_RandomLong( 0, 4 );\n\t\tsprintf( decalname, \"{shot%i\", idx + 1 );\n\t}\n\treturn decalname;\n}\n\nvoid EV_HLDM_GunshotDecalTrace( pmtrace_t *pTrace, char *decalName, char chTextureType )\n{\n\tint iRand;\n\tphysent_t *pe;\n\n\tgEngfuncs.pEfxAPI->R_BulletImpactParticles( pTrace->endpos );\n\n\n\tiRand = Com_RandomLong(0,0x7FFF);\n\tif ( iRand < (0x7fff/2) )// not every bullet makes a sound.\n\t{\n\t\tif( chTextureType == CHAR_TEX_VENT || chTextureType == CHAR_TEX_METAL )\n\t\t{\n\t\t\tswitch( iRand % 2 )\n\t\t\t{\n\t\t\tcase 0: gEngfuncs.pEventAPI->EV_PlaySound( -1, pTrace->endpos, 0, \"weapons/ric_metal-1.wav\", 1.0f, ATTN_NORM, 0, PITCH_NORM); break;\n\t\t\tcase 1: gEngfuncs.pEventAPI->EV_PlaySound( -1, pTrace->endpos, 0, \"weapons/ric_metal-2.wav\", 1.0f, ATTN_NORM, 0, PITCH_NORM); break;\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tswitch( iRand % 7)\n\t\t\t{\n\t\t\tcase 0:\tgEngfuncs.pEventAPI->EV_PlaySound( -1, pTrace->endpos, 0, \"weapons/ric1.wav\", 1.0, ATTN_NORM, 0, PITCH_NORM ); break;\n\t\t\tcase 1:\tgEngfuncs.pEventAPI->EV_PlaySound( -1, pTrace->endpos, 0, \"weapons/ric2.wav\", 1.0, ATTN_NORM, 0, PITCH_NORM ); break;\n\t\t\tcase 2:\tgEngfuncs.pEventAPI->EV_PlaySound( -1, pTrace->endpos, 0, \"weapons/ric3.wav\", 1.0, ATTN_NORM, 0, PITCH_NORM ); break;\n\t\t\tcase 3:\tgEngfuncs.pEventAPI->EV_PlaySound( -1, pTrace->endpos, 0, \"weapons/ric4.wav\", 1.0, ATTN_NORM, 0, PITCH_NORM ); break;\n\t\t\tcase 4:\tgEngfuncs.pEventAPI->EV_PlaySound( -1, pTrace->endpos, 0, \"weapons/ric5.wav\", 1.0, ATTN_NORM, 0, PITCH_NORM ); break;\n\t\t\tcase 5: gEngfuncs.pEventAPI->EV_PlaySound( -1, pTrace->endpos, 0, \"weapons/ric_conc-1.wav\", 1.0f, ATTN_NORM, 0, PITCH_NORM); break;\n\t\t\tcase 6: gEngfuncs.pEventAPI->EV_PlaySound( -1, pTrace->endpos, 0, \"weapons/ric_conc-2.wav\", 1.0f, ATTN_NORM, 0, PITCH_NORM); break;\n\t\t\t}\n\t\t}\n\n\t}\n\n\tpe = gEngfuncs.pEventAPI->EV_GetPhysent( pTrace->ent );\n\n\t// Only decal brush models such as the world etc.\n\tif (  decalName && decalName[0] && pe && ( pe->solid == SOLID_BSP || pe->movetype == MOVETYPE_PUSHSTEP ) )\n\t{\n\t\tif ( CVAR_GET_FLOAT( \"r_decals\" ) )\n\t\t{\n\t\t\tgEngfuncs.pEfxAPI->R_DecalShoot(\n\t\t\t\t\t\tgEngfuncs.pEfxAPI->Draw_DecalIndex( gEngfuncs.pEfxAPI->Draw_DecalIndexFromName( decalName ) ),\n\t\t\t\t\t\tgEngfuncs.pEventAPI->EV_IndexFromTrace( pTrace ), 0, pTrace->endpos, 0 );\n\n\t\t}\n\t}\n}\n\n\nvoid EV_WallPuff_Wind( struct tempent_s *te, float frametime, float currenttime )\n{\n\tstatic bool xWindDirection = true;\n\tstatic bool yWindDirection = true;\n\tstatic float xWindMagnitude;\n\tstatic float yWindMagnitude;\n\n\tif ( te->entity.curstate.frame > 7.0 )\n\t{\n\t\tte->entity.baseline.origin.x = 0.97 * te->entity.baseline.origin.x;\n\t\tte->entity.baseline.origin.y = 0.97 * te->entity.baseline.origin.y;\n\t\tte->entity.baseline.origin.z = 0.97 * te->entity.baseline.origin.z + 0.7;\n\t\tif ( te->entity.baseline.origin.z > 70.0 )\n\t\t\tte->entity.baseline.origin.z = 70.0;\n\t}\n\n\tif ( te->entity.curstate.frame > 6.0 )\n\t{\n\t\txWindMagnitude += 0.075;\n\t\tif ( xWindMagnitude > 5.0 )\n\t\t\txWindMagnitude = 5.0;\n\n\t\tyWindMagnitude += 0.075;\n\t\tif ( yWindMagnitude > 5.0 )\n\t\t\tyWindMagnitude = 5.0;\n\n\t\tte->entity.baseline.origin.x += xWindMagnitude * ( xWindDirection ? 1 : -1 );\n\t\tte->entity.baseline.origin.y += yWindMagnitude * ( yWindDirection ? 1 : -1 );\n\n\t\tif ( !Com_RandomLong(0, 10) && yWindMagnitude > 3.0 )\n\t\t{\n\t\t\tyWindMagnitude = 0;\n\t\t\tyWindDirection = !yWindDirection;\n\t\t}\n\t\tif ( !Com_RandomLong(0, 10) && xWindMagnitude > 3.0 )\n\t\t{\n\t\t\txWindMagnitude = 0;\n\t\t\txWindDirection = !xWindDirection;\n\t\t}\n\t}\n}\n\nvoid EV_SmokeRise( struct tempent_s *te, float frametime, float currenttime )\n{\n\tif ( te->entity.curstate.frame > 7.0 )\n\t{\n\t\tte->entity.baseline.origin = 0.97f * te->entity.baseline.origin;\n\t\tte->entity.baseline.origin.z += 0.7f;\n\n\t\tif( te->entity.baseline.origin.z > 70.0f )\n\t\t\tte->entity.baseline.origin.z = 70.0f;\n\t}\n}\n\nvoid EV_HugWalls(TEMPENTITY *te, pmtrace_s *ptr)\n{\n\tfloat len = te->entity.baseline.origin.Length();\n\tVector norm;\n\n\tif( len == 0.0f )\n\t\tnorm.x = norm.y = norm.z = 0.0f;\n\telse\n\t\tnorm = te->entity.baseline.origin / len;\n\n\tVector v2 = CrossProduct( ptr->plane.normal, CrossProduct( ptr->plane.normal, norm ) );\n\n\tlen = min( len * 1.5, 3000.0f );\n\n\tte->entity.baseline.origin.x = v2.z * len;\n\tte->entity.baseline.origin.y = v2.y * len;\n\tte->entity.baseline.origin.z = v2.x * len;\n}\n\nstruct\n{\n\tint count;\n\tconst char *files[4];\n} g_SmokeSprites[] =\n{\n\t{\n\t\t4,\n\t\t{\n\t\t\t\"sprites/wall_puff1.spr\",\n\t\t\t\"sprites/wall_puff2.spr\",\n\t\t\t\"sprites/wall_puff3.spr\",\n\t\t\t\"sprites/wall_puff4.spr\"\n\t\t}\n\t},\n\t{\n\t\t3,\n\t\t{\n\t\t\t\"sprites/rifle_smoke1.spr\",\n\t\t\t\"sprites/rifle_smoke2.spr\",\n\t\t\t\"sprites/rifle_smoke3.spr\"\n\t\t}\n\t},\n\t{\n\t\t2,\n\t\t{\n\t\t\t\"sprites/pistol_smoke1.spr\",\n\t\t\t\"sprites/pistol_smoke2.spr\"\n\t\t}\n\t},\n\t{\n\t\t4,\n\t\t{\n\t\t\t\"sprites/black_smoke1.spr\",\n\t\t\t\"sprites/black_smoke2.spr\",\n\t\t\t\"sprites/black_smoke3.spr\",\n\t\t\t\"sprites/black_smoke4.spr\"\n\t\t}\n\t}\n};\n\nTEMPENTITY *EV_CS16Client_CreateSmoke( ESmoke type, Vector origin, Vector dir,\n\tint speed, float scale, int r, int g, int b , bool wind, Vector velocity, int framerate , int teflags )\n{\n\tTEMPENTITY *te;\n\tconst char *path;\n\n\tassert( type <= SMOKE_BLACK );\n\n\tint rand = Com_RandomLong( 0, g_SmokeSprites[type].count - 1 );\n\tpath = g_SmokeSprites[type].files[rand];\n\n\tte = gEngfuncs.pEfxAPI->R_DefaultSprite( origin, gEngfuncs.pEventAPI->EV_FindModelIndex( path ), framerate );\n\n\tif( te )\n\t{\n\t\tif( wind )\n\t\t\tte->callback = EV_WallPuff_Wind;\n\t\telse\n\t\t\tte->callback = EV_SmokeRise;\n\t\tte->hitcallback = EV_HugWalls;\n\t\tte->flags |= teflags | FTENT_CLIENTCUSTOM;\n\t\tte->entity.curstate.rendermode = kRenderTransAdd;\n\t\tte->entity.curstate.rendercolor.r = r;\n\t\tte->entity.curstate.rendercolor.g = g;\n\t\tte->entity.curstate.rendercolor.b = b;\n\t\tte->entity.curstate.renderamt = Com_RandomLong( 100, 180 );\n\t\tte->entity.curstate.scale = scale;\n\t\tte->entity.baseline.origin = speed * dir;\n\n\t\tif( type != SMOKE_WALLPUFF && velocity.IsNull() )\n\t\t{\n\t\t\tvelocity = g_vPlayerVelocity;\n\t\t}\n\n\t\tif( !velocity.IsNull() )\n\t\t{\n\t\t\tvelocity.x *= 0.5;\n\t\t\tvelocity.y *= 0.5;\n\t\t\tvelocity.z *= 0.9;\n\t\t\tte->entity.baseline.origin = te->entity.baseline.origin + velocity;\n\t\t}\n\t}\n\n\treturn te;\n}\n\nvoid EV_HLDM_DecalGunshot(pmtrace_t *pTrace, int iBulletType, float scale, int r, int g, int b, bool bCreateWallPuff, bool bCreateSparks, char cTextureType, bool isSky)\n{\n\tphysent_t *pe;\n\n\tif( isSky )\n\t\treturn; // don't try to draw decals, spawn wall puff on skybox?\n\n\tpe = gEngfuncs.pEventAPI->EV_GetPhysent( pTrace->ent );\n\n\tif ( pe && pe->solid == SOLID_BSP )\n\t{\n\t\tEV_HLDM_GunshotDecalTrace( pTrace, EV_HLDM_DamageDecal( pe ), cTextureType );\n\n\t\t// create sparks\n\t\tif( gHUD.cl_weapon_sparks->value && bCreateSparks )\n\t\t{\n\t\t\tVector dir = pTrace->plane.normal;\n\n\t\t\tdir.x = dir.x * dir.x * gEngfuncs.pfnRandomFloat( 4.0f, 12.0f );\n\t\t\tdir.y = dir.y * dir.y * gEngfuncs.pfnRandomFloat( 4.0f, 12.0f );\n\t\t\tdir.z = dir.z * dir.z * gEngfuncs.pfnRandomFloat( 4.0f, 12.0f );\n\n\t\t\tgEngfuncs.pEfxAPI->R_StreakSplash( pTrace->endpos, dir, 4, Com_RandomLong( 5, 7 ), dir.z, -75.0f, 75.0f );\n\t\t}\n\n\t\t// create wallpuff\n\t\tif( gHUD.cl_weapon_wallpuff->value && bCreateWallPuff )\n\t\t{\n\t\t\tEV_CS16Client_CreateSmoke( SMOKE_WALLPUFF, pTrace->endpos, pTrace->plane.normal, 25, 0.5, r, g, b, true );\n\t\t}\n\t}\n}\n\n/*\n============\nEV_DescribeBulletTypeParameters\n\nSets iPenetrationPower and flPenetrationDistance.\nIf iBulletType is unknown, calls assert() and sets these two vars to 0\n============\n*/\nvoid EV_DescribeBulletTypeParameters(int iBulletType, int &iPenetrationPower, float &flPenetrationDistance)\n{\n\tswitch (iBulletType)\n\t{\n\tcase BULLET_PLAYER_9MM:\n\t{\n\t\tiPenetrationPower = 21;\n\t\tflPenetrationDistance = 800;\n\t\tbreak;\n\t}\n\n\tcase BULLET_PLAYER_45ACP:\n\t{\n\t\tiPenetrationPower = 15;\n\t\tflPenetrationDistance = 500;\n\t\tbreak;\n\t}\n\n\tcase BULLET_PLAYER_50AE:\n\t{\n\t\tiPenetrationPower = 30;\n\t\tflPenetrationDistance = 1000;\n\t\tbreak;\n\t}\n\n\tcase BULLET_PLAYER_762MM:\n\t{\n\t\tiPenetrationPower = 39;\n\t\tflPenetrationDistance = 5000;\n\t\tbreak;\n\t}\n\n\tcase BULLET_PLAYER_556MM:\n\t{\n\t\tiPenetrationPower = 35;\n\t\tflPenetrationDistance = 4000;\n\t\tbreak;\n\t}\n\n\tcase BULLET_PLAYER_338MAG:\n\t{\n\t\tiPenetrationPower = 45;\n\t\tflPenetrationDistance = 8000;\n\t\tbreak;\n\t}\n\n\tcase BULLET_PLAYER_57MM:\n\t{\n\t\tiPenetrationPower = 30;\n\t\tflPenetrationDistance = 2000;\n\t\tbreak;\n\t}\n\n\tcase BULLET_PLAYER_357SIG:\n\t{\n\t\tiPenetrationPower = 25;\n\t\tflPenetrationDistance = 800;\n\t\tbreak;\n\t}\n\n\tdefault:\n\t{\n\t\tiPenetrationPower = 0;\n\t\tflPenetrationDistance = 0;\n\t\tbreak;\n\t}\n\t}\n}\n\n\n\n/*\n================\nEV_HLDM_FireBullets\n\nGo to the trouble of combining multiple pellets into a single damage call.\n================\n*/\nvoid EV_HLDM_FireBullets(int idx,\n\t\t\t\t\t\t float *forward, float *right, float *up,\n\t\t\t\t\t\t int cShots,\n\t\t\t\t\t\t float *vecSrc, float *vecDirShooting, float *vecSpread,\n\t\t\t\t\t\t float flDistance, int iBulletType, int iPenetration)\n{\n\tint i;\n\tpmtrace_t tr;\n\tint iShot;\n\tint iPenetrationPower;\n\tfloat flPenetrationDistance;\n\tbool isSky;\n\n\tEV_DescribeBulletTypeParameters( iBulletType, iPenetrationPower, flPenetrationDistance );\n\n\tfor ( iShot = 1; iShot <= cShots; iShot++ )\n\t{\n\t\tVector vecShotSrc = vecSrc;\n\t\tint iShotPenetration = iPenetration;\n\t\tVector vecDir, vecEnd;\n\n\t\tif ( iBulletType == BULLET_PLAYER_BUCKSHOT )\n\t\t{\n\t\t\t//We randomize for the Shotgun.\n\t\t\tfloat x, y, z;\n\t\t\tdo {\n\t\t\t\tx = gEngfuncs.pfnRandomFloat(-0.5,0.5) + gEngfuncs.pfnRandomFloat(-0.5,0.5);\n\t\t\t\ty = gEngfuncs.pfnRandomFloat(-0.5,0.5) + gEngfuncs.pfnRandomFloat(-0.5,0.5);\n\t\t\t\tz = x*x+y*y;\n\t\t\t} while (z > 1);\n\n\t\t\tfor ( i = 0 ; i < 3; i++ )\n\t\t\t{\n\t\t\t\tvecDir[i] = vecDirShooting[i] + x * vecSpread[0] * right[ i ] + y * vecSpread[1] * up [ i ];\n\t\t\t\tvecEnd[i] = vecShotSrc[ i ] + flDistance * vecDir[ i ];\n\t\t\t}\n\t\t}\n\t\telse //But other guns already have their spread randomized in the synched spread.\n\t\t{\n\t\t\tfor ( i = 0 ; i < 3; i++ )\n\t\t\t{\n\t\t\t\tvecDir[i] = vecDirShooting[i] + vecSpread[0] * right[ i ] + vecSpread[1] * up [ i ];\n\t\t\t\tvecEnd[i] = vecShotSrc[ i ] + flDistance * vecDir[ i ];\n\t\t\t}\n\t\t}\n\n\t\tgEngfuncs.pEventAPI->EV_SetUpPlayerPrediction( false, true );\n\n\t\t// Store off the old count\n\t\tgEngfuncs.pEventAPI->EV_PushPMStates();\n\n\t\t// Now add in all of the players.\n\t\tgEngfuncs.pEventAPI->EV_SetSolidPlayers ( idx - 1 );\n\n\t\twhile (iShotPenetration != 0)\n\t\t{\n\t\t\tif( gEngfuncs.PM_PointContents( vecShotSrc, NULL ) == CONTENTS_SOLID )\n\t\t\t\tbreak;\n\n\t\t\tgEngfuncs.pEventAPI->EV_SetTraceHull( 2 );\n\n\t\t\tgEngfuncs.pEventAPI->EV_PlayerTrace( vecShotSrc, vecEnd, 0, -1, &tr );\n\n\t\t\tfloat flCurrentDistance = tr.fraction * flDistance;\n\n\t\t\tif( flCurrentDistance == 0.0f )\n\t\t\t{\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tif ( flCurrentDistance > flPenetrationDistance )\n\t\t\t\tiShotPenetration = 0;\n\t\t\telse iShotPenetration--;\n\n\t\t\tchar cTextureType = EV_HLDM_PlayTextureSound(idx, &tr, vecShotSrc, vecEnd, iBulletType, isSky );\n\t\t\tbool bSparks = true;\n\t\t\tint r_smoke, g_smoke, b_smoke;\n\t\t\tr_smoke = g_smoke = b_smoke = 40;\n\n\t\t\tswitch (cTextureType)\n\t\t\t{\n\t\t\tcase CHAR_TEX_METAL:\n\t\t\t\tiPenetrationPower *= 0.15;\n\t\t\t\tbreak;\n\t\t\tcase CHAR_TEX_CONCRETE:\n\t\t\t\tr_smoke = g_smoke = b_smoke = 65;\n\t\t\t\tiPenetrationPower *= 0.25;\n\t\t\t\tbreak;\n\t\t\tcase CHAR_TEX_VENT:\n\t\t\tcase CHAR_TEX_GRATE:\n\t\t\t\tiPenetrationPower *= 0.5;\n\t\t\t\tbreak;\n\t\t\tcase CHAR_TEX_TILE:\n\t\t\t\tiPenetrationPower *= 0.65;\n\t\t\t\tbreak;\n\t\t\tcase CHAR_TEX_COMPUTER:\n\t\t\t\tiPenetrationPower *= 0.4;\n\t\t\t\tbreak;\n\t\t\tcase CHAR_TEX_WOOD:\n\t\t\t\tbSparks = false;\n\t\t\t\tr_smoke = 75;\n\t\t\t\tg_smoke = 42;\n\t\t\t\tb_smoke = 15;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t// do damage, paint decals\n\t\t\tEV_HLDM_DecalGunshot( &tr, iBulletType, 0, r_smoke, g_smoke, b_smoke, true, bSparks, cTextureType, isSky );\n\n\t\t\tif(/* iBulletType == BULLET_PLAYER_BUCKSHOT ||*/ iShotPenetration <= 0 )\n\t\t\t{\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tflDistance = (flDistance - flCurrentDistance) * 0.5;\n\t\t\tVectorMA( tr.endpos, iPenetration, vecDir, vecShotSrc );\n\t\t\tVectorMA( vecShotSrc, flDistance, vecDir, vecEnd );\n\n\t\t\t// trace back, so we will have a decal on the other side of solid area\n\t\t\tpmtrace_t trOriginal;\n\n\t\t\tif( gEngfuncs.PM_PointContents( vecShotSrc, NULL ) != CONTENTS_SOLID )\n\t\t\t{\n\t\t\t\tgEngfuncs.pEventAPI->EV_SetTraceHull( 2 );\n\t\t\t\tgEngfuncs.pEventAPI->EV_PlayerTrace(vecShotSrc, vecSrc, 0, -1, &trOriginal);\n\t\t\t\tif( !trOriginal.startsolid )\n\t\t\t\t\tEV_HLDM_DecalGunshot( &trOriginal, iBulletType, 0, r_smoke, g_smoke, b_smoke, true, bSparks, cTextureType, isSky );\n\t\t\t}\n\t\t}\n\t\tgEngfuncs.pEventAPI->EV_PopPMStates();\n\t}\n\n}\n\nvoid EV_CS16Client_KillEveryRound( TEMPENTITY *te, float frametime, float current_time )\n{\n\tif( !g_flRoundTime && current_time > g_flRoundTime )\n\t{\n\t\t// Mark it die on next TempEntUpdate\n\t\tte->die = 0.0f;\n\t\t// Set null renderamt, so it will be invisible now\n\t\t// Also it will die immediately, if FTEMP_FADEOUT was set\n\t\tte->entity.curstate.renderamt = 0;\n\t}\n}\n\nvoid RemoveBody( TEMPENTITY *te, float frametime, float current_time )\n{\n\tif ( current_time >= gEngfuncs.pfnGetCvarFloat(\"cl_corpsestay\") + te->entity.curstate.fuser2 + 5.0f )\n\t\tte->entity.origin.z = te->entity.origin.z - 5.0f * frametime;\n}\n\nvoid HitBody( TEMPENTITY *ent, pmtrace_s *ptr )\n{\n\tif ( ptr->plane.normal.z > 0.0f )\n    \tent->flags |= FTENT_BODYGRAVITY;\n}\n\nTEMPENTITY *g_DeadPlayerModels[64];\n\nvoid CreateCorpse(Vector vOrigin, Vector vAngles, const char *pModel, float flAnimTime, int iSequence, int iBody)\n{\n\tint modelIdx = gEngfuncs.pEventAPI->EV_FindModelIndex(pModel);\n\tVector null(0, 0, 0);\n\tTEMPENTITY *model = gEngfuncs.pEfxAPI->R_TempModel( vOrigin, null, vAngles, 100.0f, modelIdx, 0 );\n\n\tif( model )\n\t{\n\t\tmodel->flags = (FTENT_CLIENTCUSTOM|FTENT_PERSIST|FTENT_SPRANIMATE|FTENT_FADEOUT|FTENT_COLLIDEWORLD|FTENT_BODYTRACE);\n\t\tmodel->frameMax = 255.0f;\n\t\tmodel->entity.curstate.framerate = 1.0f;\n\t\tmodel->entity.curstate.animtime = flAnimTime;\n\t\tmodel->entity.curstate.frame = 0.0f;\n\t\tmodel->entity.curstate.fuser1 = gHUD.m_flTime + 1.0f;\n\t\tmodel->entity.curstate.sequence = iSequence;\n\t\tmodel->entity.curstate.body = iBody;\n\t\tmodel->entity.baseline.renderamt = 255;\n\t\tmodel->entity.curstate.renderamt = 255;\n\t\tmodel->entity.curstate.fuser2 = gHUD.m_flTime + gEngfuncs.pfnGetCvarFloat(\"cl_corpsestay\");\n\t\tmodel->callback = RemoveBody;\n\t\tmodel->hitcallback = HitBody;\n\t\tmodel->bounceFactor = 0.0f;\n\t\tmodel->die = gEngfuncs.GetClientTime() + gEngfuncs.pfnGetCvarFloat(\"cl_corpsestay\") + 9.0f;\n\t\t//model->entity.curstate.renderfx = kRenderFxDeadPlayer;\n\t\t//model->entity.curstate.fuser4 = gHUD.m_flTime;\n\n\t\tfor ( int i = 0; i < 64; i++ )\n\t\t{\n\t\t\tif ( !g_DeadPlayerModels[i] )\n\t\t\t{\n\t\t\t\tg_DeadPlayerModels[i] = model;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "cl_dll/events/event_ak47.cpp",
    "content": "/*\n*\n*    This program is free software; you can redistribute it and/or modify it\n*    under the terms of the GNU General Public License as published by the\n*    Free Software Foundation; either version 2 of the License, or (at\n*    your option) any later version.\n*\n*    This program is distributed in the hope that it will be useful, but\n*    WITHOUT ANY WARRANTY; without even the implied warranty of\n*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n*    General Public License for more details.\n*\n*    You should have received a copy of the GNU General Public License\n*    along with this program; if not, write to the Free Software Foundation,\n*    Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\n*\n*    In addition, as a special exception, the author gives permission to\n*    link the code of this program with the Half-Life Game Engine (\"HL\n*    Engine\") and Modified Game Libraries (\"MODs\") developed by Valve,\n*    L.L.C (\"Valve\").  You must obey the GNU General Public License in all\n*    respects for all of the code used other than the HL Engine and MODs\n*    from Valve.  If you modify this file, you may extend this exception\n*    to your version of the file, but you are not obligated to do so.  If\n*    you do not wish to do so, delete this exception statement from your\n*    version.\n*\n*/\n#include \"events.h\"\n#include \"wpn_shared.h\"\n\nstatic const char *SOUNDS_NAME[] =\n{\n\t\"weapons/ak47-1.wav\",\n\t\"weapons/ak47-2.wav\"\n};\n\nvoid EV_FireAK47( event_args_t *args )\n{\n\tvec3_t ShellVelocity, ShellOrigin;\n\tVector vecSrc, vecAiming;\n\n\tint idx = args->entindex;\n\tVector origin( args->origin );\n\tVector angles(\n\t\targs->iparam1 / 100.0f + args->angles[0],\n\t\targs->iparam2 / 100.0f + args->angles[1],\n\t\targs->angles[2] );\n\tVector velocity( args->velocity );\n\tVector forward, right, up;\n\tAngleVectors( angles, forward, right, up );\n\n\tif ( EV_IsLocal( args->entindex ) )\n\t{\n\t\t++g_iShotsFired;\n\t\tgEngfuncs.pEventAPI->EV_WeaponAnimation(Com_RandomLong(AK47_SHOOT1, AK47_SHOOT3), 2);\n\t\tEV_MuzzleFlash();\n\t\tif( !gHUD.cl_righthand->value )\n\t\t{\n\t\t\tEV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, right, up, 20.0, -8.0, -10.0, 0);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tEV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, right, up, 20.0, -8.0, 10.0, 0);\n\t\t}\n\t}\n\telse\n\t{\n\t\tEV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, right, up, 20.0, -12.0, 4.0, 0);\n\t}\n\n\n\tEV_EjectBrass(ShellOrigin, ShellVelocity, angles[ YAW ], g_iRShell, TE_BOUNCE_SHELL);\n\n\tPLAY_EVENT_SOUND( SOUNDS_NAME[Com_RandomLong(0, 1)] );\n\n\tEV_GetGunPosition( args, vecSrc, origin );\n\tVectorCopy( forward, vecAiming );\n\n\tVector vSpread( args->fparam1, args->fparam2, 0.0f );\n\tEV_HLDM_FireBullets( idx,\n\t\tforward, right,\tup,\n\t\t1, vecSrc, vecAiming,\n\t\tvSpread, 8192.0, BULLET_PLAYER_762MM,\n\t\t2 );\n}\n"
  },
  {
    "path": "cl_dll/events/event_aug.cpp",
    "content": "/*\n*\n*    This program is free software; you can redistribute it and/or modify it\n*    under the terms of the GNU General Public License as published by the\n*    Free Software Foundation; either version 2 of the License, or (at\n*    your option) any later version.\n*\n*    This program is distributed in the hope that it will be useful, but\n*    WITHOUT ANY WARRANTY; without even the implied warranty of\n*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n*    General Public License for more details.\n*\n*    You should have received a copy of the GNU General Public License\n*    along with this program; if not, write to the Free Software Foundation,\n*    Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\n*\n*    In addition, as a special exception, the author gives permission to\n*    link the code of this program with the Half-Life Game Engine (\"HL\n*    Engine\") and Modified Game Libraries (\"MODs\") developed by Valve,\n*    L.L.C (\"Valve\").  You must obey the GNU General Public License in all\n*    respects for all of the code used other than the HL Engine and MODs\n*    from Valve.  If you modify this file, you may extend this exception\n*    to your version of the file, but you are not obligated to do so.  If\n*    you do not wish to do so, delete this exception statement from your\n*    version.\n*\n*/\n#include \"events.h\"\n#include \"wpn_shared.h\"\n\nstatic const char *SOUNDS_NAME = \"weapons/aug-1.wav\";\n\nvoid EV_FireAUG( struct event_args_s *args )\n{\n\tvec3_t ShellVelocity, ShellOrigin;\n\tVector vecSrc, vecAiming;\n\n\tint idx = args->entindex;\n\tVector origin( args->origin );\n\tVector angles(\n\t\targs->iparam1 / 100.0f + args->angles[0],\n\t\targs->iparam2 / 100.0f + args->angles[1],\n\t\targs->angles[2] );\n\tVector velocity( args->velocity );\n\tVector forward, right, up;\n\tAngleVectors( angles, forward, right, up );\n\n\tif ( EV_IsLocal( idx ) )\n\t{\n\t\t++g_iShotsFired;\n\t\tEV_MuzzleFlash();\n\t\tgEngfuncs.pEventAPI->EV_WeaponAnimation(Com_RandomLong(AUG_SHOOT1, AUG_SHOOT3), 2);\n\t\tif( !gHUD.cl_righthand->value )\n\t\t{\n\t\t\tEV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, right, up, 17.0, -8.0, -14.0, 0);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tEV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, right, up, 17.0, -8.0, 14.0, 0);\n\t\t}\n\t}\n\telse\n\t{\n\t\tEV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, right, up, 20.0, -12.0, 4.0, 0);\n\t}\n\n\tEV_EjectBrass(ShellOrigin, ShellVelocity, angles[ YAW ], g_iRShell, TE_BOUNCE_SHELL);\n\n\tPLAY_EVENT_SOUND( SOUNDS_NAME );\n\n\tEV_GetGunPosition( args, vecSrc, origin );\n\tVectorCopy( forward, vecAiming );\n\tVector vSpread;\n\t\n\tvSpread.x = args->fparam1;\n\tvSpread.y = args->fparam2;\n\tEV_HLDM_FireBullets( idx,\n\t\tforward, right,\tup,\n\t\t1, vecSrc, vecAiming,\n\t\tvSpread, 8192.0, BULLET_PLAYER_556MM,\n\t\t2 );\n}\n"
  },
  {
    "path": "cl_dll/events/event_awp.cpp",
    "content": "/*\n*\n*    This program is free software; you can redistribute it and/or modify it\n*    under the terms of the GNU General Public License as published by the\n*    Free Software Foundation; either version 2 of the License, or (at\n*    your option) any later version.\n*\n*    This program is distributed in the hope that it will be useful, but\n*    WITHOUT ANY WARRANTY; without even the implied warranty of\n*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n*    General Public License for more details.\n*\n*    You should have received a copy of the GNU General Public License\n*    along with this program; if not, write to the Free Software Foundation,\n*    Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\n*\n*    In addition, as a special exception, the author gives permission to\n*    link the code of this program with the Half-Life Game Engine (\"HL\n*    Engine\") and Modified Game Libraries (\"MODs\") developed by Valve,\n*    L.L.C (\"Valve\").  You must obey the GNU General Public License in all\n*    respects for all of the code used other than the HL Engine and MODs\n*    from Valve.  If you modify this file, you may extend this exception\n*    to your version of the file, but you are not obligated to do so.  If\n*    you do not wish to do so, delete this exception statement from your\n*    version.\n*\n*/\n#include \"events.h\"\n#include \"wpn_shared.h\"\n\n\nstatic const char *SOUNDS_NAME = \"weapons/awp1.wav\";\n\nvoid EV_FireAWP( event_args_t *args )\n{\n\tVector vecSrc, vecAiming;\n\n\tint idx = args->entindex;\n\tVector origin( args->origin );\n\tVector angles(\n\t\targs->iparam1 / 100.0f + args->angles[0],\n\t\targs->iparam2 / 100.0f + args->angles[1],\n\t\targs->angles[2]\n\t\t);\n\tVector velocity( args->velocity );\n\tVector forward, right, up;\n\n\tAngleVectors( angles, forward, right, up );\n\n\tif ( EV_IsLocal( idx ) )\n\t{\n\t\t++g_iShotsFired;\n\t\tEV_MuzzleFlash();\n\t\tgEngfuncs.pEventAPI->EV_WeaponAnimation( Com_RandomLong(AWP_SHOOT, AWP_SHOOT3), 2 );\n\t}\n\n\tPLAY_EVENT_SOUND( SOUNDS_NAME );\n\n\tEV_GetGunPosition( args, vecSrc, origin );\n\tVectorCopy( forward, vecAiming );\n\tVector vSpread;\n\t\n\tvSpread.x = args->fparam1;\n\tvSpread.y = args->fparam2;\n\tEV_HLDM_FireBullets( idx,\n\t\tforward, right,\tup,\n\t\t1, vecSrc, vecAiming,\n\t\tvSpread, 8192.0, BULLET_PLAYER_338MAG,\n\t\t3 );\n}\n"
  },
  {
    "path": "cl_dll/events/event_createexplo.cpp",
    "content": "/*\n*\n*    This program is free software; you can redistribute it and/or modify it\n*    under the terms of the GNU General Public License as published by the\n*    Free Software Foundation; either version 2 of the License, or (at\n*    your option) any later version.\n*\n*    This program is distributed in the hope that it will be useful, but\n*    WITHOUT ANY WARRANTY; without even the implied warranty of\n*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n*    General Public License for more details.\n*\n*    You should have received a copy of the GNU General Public License\n*    along with this program; if not, write to the Free Software Foundation,\n*    Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\n*\n*    In addition, as a special exception, the author gives permission to\n*    link the code of this program with the Half-Life Game Engine (\"HL\n*    Engine\") and Modified Game Libraries (\"MODs\") developed by Valve,\n*    L.L.C (\"Valve\").  You must obey the GNU General Public License in all\n*    respects for all of the code used other than the HL Engine and MODs\n*    from Valve.  If you modify this file, you may extend this exception\n*    to your version of the file, but you are not obligated to do so.  If\n*    you do not wish to do so, delete this exception statement from your\n*    version.\n*\n*/\n#include \"events.h\"\n\n// TODO: Implement. Used in CS:CZDS\nvoid EV_CreateExplo(event_args_s *args)\n{\n\tgEngfuncs.Con_DPrintf(\"^3EXPUROSION !!!111\");\n}\n"
  },
  {
    "path": "cl_dll/events/event_createsmoke.cpp",
    "content": "/*\n*\n*    This program is free software; you can redistribute it and/or modify it\n*    under the terms of the GNU General Public License as published by the\n*    Free Software Foundation; either version 2 of the License, or (at\n*    your option) any later version.\n*\n*    This program is distributed in the hope that it will be useful, but\n*    WITHOUT ANY WARRANTY; without even the implied warranty of\n*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n*    General Public License for more details.\n*\n*    You should have received a copy of the GNU General Public License\n*    along with this program; if not, write to the Free Software Foundation,\n*    Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\n*\n*    In addition, as a special exception, the author gives permission to\n*    link the code of this program with the Half-Life Game Engine (\"HL\n*    Engine\") and Modified Game Libraries (\"MODs\") developed by Valve,\n*    L.L.C (\"Valve\").  You must obey the GNU General Public License in all\n*    respects for all of the code used other than the HL Engine and MODs\n*    from Valve.  If you modify this file, you may extend this exception\n*    to your version of the file, but you are not obligated to do so.  If\n*    you do not wish to do so, delete this exception statement from your\n*    version.\n*\n*/\n#include \"events.h\"\n\n#include \"com_model.h\"\n\n#define SMOKE_CLOUDS 20\n\nvoid EV_CreateSmoke(event_args_s *args)\n{\n\tTEMPENTITY *pTemp;\n\n\tif( !args->bparam2 ) //first explosion\n\t{\n\t\tconst model_t *pGasModel = gEngfuncs.GetSpritePointer(gHUD.m_hGasPuff);\n\n\t\tfor( int i = 0; i < SMOKE_CLOUDS; i++ )\n\t\t{\n\t\t\t// randomize smoke cloud position\n\t\t\tVector org = args->origin;\n\t\t\tif( i != 0 )\n\t\t\t{\n\t\t\t\torg.x += Com_RandomFloat(-100.0f, 100.0f);\n\t\t\t\torg.y += Com_RandomFloat(-100.0f, 100.0f);\n\t\t\t}\n\t\t\torg.z += 30; \n\n\t\t\tpTemp = gEngfuncs.pEfxAPI->CL_TempEntAllocNoModel( org );\n\t\t\tif( pTemp )\n\t\t\t{\n\t\t\t\t// don't die when animation is ended\n\t\t\t\tpTemp->flags |= (FTENT_SPRANIMATELOOP | FTENT_COLLIDEWORLD | FTENT_CLIENTCUSTOM);\n\t\t\t\tpTemp->flags &= ~(FTENT_NOMODEL);\n\t\t\t\tpTemp->die = gEngfuncs.GetClientTime() + 30.0f;\n\t\t\t\tpTemp->callback = [](struct tempent_s *te, float frametime, float currenttime) -> void\n\t\t\t\t{\n\t\t\t\t\tif( te->entity.curstate.renderamt > 0 && currenttime >= te->entity.curstate.fuser3 )\n\t\t\t\t\t{\n\t\t\t\t\t\tte->entity.curstate.renderamt = 255.0f - (currenttime - te->entity.curstate.fuser3) * te->entity.baseline.renderamt ;\n\t\t\t\t\t\tif( te->entity.curstate.renderamt < 0 ) te->entity.curstate.renderamt = 0;\n\t\t\t\t\t}\n\t\t\t\t\tEV_CS16Client_KillEveryRound( te, frametime, currenttime );\n\t\t\t\t};\n\n\t\t\t\t// !!! Setup model !!!\n\t\t\t\tpTemp->entity.model = (struct model_s*)pGasModel;\n\t\t\t\tpTemp->frameMax = max( 0, pGasModel->numframes - 1 );\n\n\t\t\t\tpTemp->entity.curstate.fuser3 = gEngfuncs.GetClientTime() + 15.0f; // start fading after 15 sec\n\t\t\t\tpTemp->entity.curstate.fuser4 = gEngfuncs.GetClientTime(); // entity creation time\n\n\t\t\t\tpTemp->entity.curstate.renderamt = 255;\n\t\t\t\tpTemp->entity.curstate.rendermode = kRenderTransTexture;\n\t\t\t\tpTemp->entity.curstate.rendercolor.r = Com_RandomLong(210, 230);\n\t\t\t\tpTemp->entity.curstate.rendercolor.g = Com_RandomLong(210, 230);\n\t\t\t\tpTemp->entity.curstate.rendercolor.b = Com_RandomLong(210, 230);\n\t\t\t\tpTemp->entity.curstate.scale = 5.0f;\n\n\t\t\t\t// make it move slowly\n\t\t\t\tpTemp->entity.baseline.origin.x = Com_RandomLong(-5, 5);\n\t\t\t\tpTemp->entity.baseline.origin.y = Com_RandomLong(-5, 5);\n\t\t\t\tpTemp->entity.baseline.renderamt = 18;\n\n\t\t\t\tif( i == 0 )\n\t\t\t\t{\n\t\t\t\t\tgHUD.m_Spectator.AddOverviewEntityToList( gHUD.m_hGasPuff, &pTemp->entity, 14.0f );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\telse // second and other\n\t{\n\t\tint g = gEngfuncs.pfnRandomLong(155, 175);\n\n\t\tVector dir( args->fparam1, args->fparam2, 0.0f );\n\t\tVector vel( 0.0f, 0.0f, 0.0f );\n\n\t\tEV_CS16Client_CreateSmoke( SMOKE_BLACK, args->origin, dir, args->iparam1 / 100, 1.0f, g, g, g, true, vel, 25 );\n\t}\n}\n"
  },
  {
    "path": "cl_dll/events/event_czerods.cpp",
    "content": "// This is an open source non-commercial project. Dear PVS-Studio, please check it.\n// PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com\n/*\n*\n*    This program is free software; you can redistribute it and/or modify it\n*    under the terms of the GNU General Public License as published by the\n*    Free Software Foundation; either version 2 of the License, or (at\n*    your option) any later version.\n*\n*    This program is distributed in the hope that it will be useful, but\n*    WITHOUT ANY WARRANTY; without even the implied warranty of\n*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n*    General Public License for more details.\n*\n*    You should have received a copy of the GNU General Public License\n*    along with this program; if not, write to the Free Software Foundation,\n*    Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\n*\n*    In addition, as a special exception, the author gives permission to\n*    link the code of this program with the Half-Life Game Engine (\"HL\n*    Engine\") and Modified Game Libraries (\"MODs\") developed by Valve,\n*    L.L.C (\"Valve\").  You must obey the GNU General Public License in all\n*    respects for all of the code used other than the HL Engine and MODs\n*    from Valve.  If you modify this file, you may extend this exception\n*    to your version of the file, but you are not obligated to do so.  If\n*    you do not wish to do so, delete this exception statement from your\n*    version.\n*\n*/\n#include \"events.h\"\n\nvoid EV_FireM60( event_args_t *args )\n{\n\tVector ShellVelocity;\n\tVector ShellOrigin;\n\tVector vecSrc, vecAiming;\n\tint    idx = args->entindex;\n\tVector origin( args->origin );\n\tVector angles(\n\t\targs->iparam1 / 100.0f + args->angles[0],\n\t\targs->iparam2 / 100.0f + args->angles[1],\n\t\targs->angles[2]\n\t\t);\n\tVector velocity( args->velocity );\n\tVector forward, right, up;\n\n\tAngleVectors( angles, forward, right, up );\n\n\tif ( EV_IsLocal( idx ) )\n\t{\n\t\t++g_iShotsFired;\n\t\tEV_MuzzleFlash();\n\t\tgEngfuncs.pEventAPI->EV_WeaponAnimation(Com_RandomLong(1,2), 2);\n\t\tif( !gHUD.cl_righthand->value )\n\t\t{\n\t\t\tEV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, right, up, 20.0, -10.0, -13.0, true);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tEV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, right, up, 20.0, -10.0, 13.0, 0);\n\t\t}\n\t}\n\telse\n\t{\n\t\tEV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, right, up, 20.0, -12.0, 4.0, 0);\n\t}\n\n\n\tEV_EjectBrass(ShellOrigin, ShellVelocity, angles[ YAW ], g_iRShell, TE_BOUNCE_SHELL);\n\n\tPLAY_EVENT_SOUND( \"weapons/m60-1.wav\" );\n\n\tEV_GetGunPosition( args, vecSrc, origin );\n\tVectorCopy( forward, vecAiming );\n\tVector vSpread;\n\n\tvSpread.x = args->fparam1;\n\tvSpread.y = args->fparam2;\n\tEV_HLDM_FireBullets( idx,\n\t\tforward, right,\tup,\n\t\t1, vecSrc, vecAiming,\n\t\tvSpread, 8192.0, BULLET_PLAYER_762MM,\n\t\t2 );\n}\n\nvoid EV_FireCamera( event_args_t *args )\n{\n\tint idx = args->entindex;\n\tVector origin = args->origin;\n\n\tif( EV_IsLocal( idx ) )\n\t\tgEngfuncs.pEventAPI->EV_WeaponAnimation( 1, 2 );\n\n\tPLAY_EVENT_SOUND( \"weapons/camera-1.wav\" );\n}\nvoid EV_FireFiberOpticCamera( event_args_t *args )\n{\n\tConsolePrint( \"FIRE FIBER OPTIC CAMERA !!! !!! !!!\\n\");\n}\nvoid EV_FireShieldGun( event_args_t *args )\n{\n\n}\n\nint g_iBlowTorchFiring = 0;\nvoid EV_HolsterBlowtorch( event_args_t *args )\n{\n\tg_iBlowTorchFiring = 0;\n}\nvoid EV_IdleBlowtorch( event_args_t *args )\n{\n\tg_iBlowTorchFiring = 1;\n}\n\nvoid EV_FireBlowtorch( event_args_t *args )\n{\n\tint idx = args->entindex;\n\tVector origin = args->origin;\n\tVector angles(\n\t\targs->iparam1 / 10000000.0f + args->angles[0],\n\t\targs->iparam2 / 10000000.0f + args->angles[1],\n\t\targs->angles[2] );\n\n\tVector forward, right, up;\n\tVector vecSrc;\n\n\tAngleVectors( angles, forward, right, up );\n\n\tEV_GetGunPosition( args, vecSrc, origin );\n\n\tif ( EV_IsLocal(idx) )\n\t  gEngfuncs.pEventAPI->EV_WeaponAnimation(1, 2);\n\n\tg_iBlowTorchFiring = 2;\n\n\tVector vSpread( args->fparam1, args->fparam2, 0.0f );\n\n\tEV_HLDM_FireBullets( idx,\n\t\tforward, right,\tup,\n\t\t1, vecSrc, forward,\n\t\tvSpread, 36.0, BULLET_PLAYER_BLOWTORCH,\n\t\t2 );\n\n}\nvoid EV_FireLaws( event_args_t *args )\n{\n\n}\nvoid EV_FireBriefcase( event_args_t *args )\n{\n\tint idx = args->entindex;\n\tVector origin = args->origin;\n\n\tif( EV_IsLocal( idx ) )\n\t\tgEngfuncs.pEventAPI->EV_WeaponAnimation( 3, 2 );\n\n\tPLAY_EVENT_SOUND( \"weapons/briefcase_use.wav\" );\n}\nvoid EV_FireMedkit( event_args_t *args )\n{\n\tint idx = args->entindex;\n\tVector origin = args->origin;\n\n\tif( EV_IsLocal( idx ) )\n\t\tgEngfuncs.pEventAPI->EV_WeaponAnimation( 2, 2 );\n\n\tPLAY_EVENT_SOUND( \"weapons/blowtorch-1.wav\" );\n\n}\nvoid EV_FireSyringe( event_args_t *args )\n{\n\tint idx = args->entindex;\n\tVector origin = args->origin;\n\n\tif( EV_IsLocal( idx ) )\n\t\tgEngfuncs.pEventAPI->EV_WeaponAnimation( 2, 2 );\n\n\tPLAY_EVENT_SOUND( \"weapons/syringe_use.wav\" );\n\n}\nvoid EV_FireRadio( event_args_t *args )\n{\n\tint idx = args->entindex;\n\tVector origin = args->origin;\n\n\tif( EV_IsLocal( idx ) )\n\t\tgEngfuncs.pEventAPI->EV_WeaponAnimation( 1, 2 );\n\n\tPLAY_EVENT_SOUND( \"weapons/radio_activate.wav\" );\n}\nvoid EV_FireZipline( event_args_t *args )\n{\n\tif ( EV_IsLocal(args->entindex) )\n\t  gEngfuncs.pEventAPI->EV_WeaponAnimation(3, 2);\n}\nvoid EV_CreateGlass( event_args_t *args )\n{\n\n}\nvoid EV_GrenadeExplosion( event_args_t *args )\n{\n\n}\n"
  },
  {
    "path": "cl_dll/events/event_deagle.cpp",
    "content": "/*\n*\n*    This program is free software; you can redistribute it and/or modify it\n*    under the terms of the GNU General Public License as published by the\n*    Free Software Foundation; either version 2 of the License, or (at\n*    your option) any later version.\n*\n*    This program is distributed in the hope that it will be useful, but\n*    WITHOUT ANY WARRANTY; without even the implied warranty of\n*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n*    General Public License for more details.\n*\n*    You should have received a copy of the GNU General Public License\n*    along with this program; if not, write to the Free Software Foundation,\n*    Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\n*\n*    In addition, as a special exception, the author gives permission to\n*    link the code of this program with the Half-Life Game Engine (\"HL\n*    Engine\") and Modified Game Libraries (\"MODs\") developed by Valve,\n*    L.L.C (\"Valve\").  You must obey the GNU General Public License in all\n*    respects for all of the code used other than the HL Engine and MODs\n*    from Valve.  If you modify this file, you may extend this exception\n*    to your version of the file, but you are not obligated to do so.  If\n*    you do not wish to do so, delete this exception statement from your\n*    version.\n*\n*/\n#include \"events.h\"\n#include \"wpn_shared.h\"\n\n\nstatic const char *SOUNDS_NAME[] =\n{\n\t\"weapons/deagle-1.wav\",\n\t\"weapons/deagle-2.wav\"\n};\n\nvoid EV_FireDEAGLE( event_args_t *args )\n{\n\tVector ShellVelocity;\n\tVector ShellOrigin;\n\tvec3_t vecSrc;\n\n\tint idx = args->entindex;\n\tVector origin( args->origin );\n\tVector angles(\n\t\targs->iparam1 / 100.0f + args->angles[0],\n\t\targs->iparam2 / 100.0f + args->angles[1],\n\t\targs->angles[2]\n\t);\n\tVector velocity( args->velocity );\n\tVector forward, right, up;\n\tAngleVectors( angles, forward, right, up );\n\n\tif ( EV_IsLocal( idx ) )\n\t{\n\t\t++g_iShotsFired;\n\t\tEV_MuzzleFlash();\n\t\tif( !args->bparam1 )\n\t\t{\n\t\t\tgEngfuncs.pEventAPI->EV_WeaponAnimation( Com_RandomLong(DEAGLE_SHOOT1, DEAGLE_SHOOT2), 2 );\n\t\t}\n\t\telse\n\t\t{\n\t\t\tgEngfuncs.pEventAPI->EV_WeaponAnimation( DEAGLE_SHOOT_EMPTY, 2 );\n\t\t}\n\t\tif( !gHUD.cl_righthand->value )\n\t\t{\n\t\t\tEV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, right, up, 35.0, -11.0, -16.0, 0);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tEV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, right, up, 35.0, -11.0, 16.0, 0);\n\t\t}\n\t}\n\telse\n\t{\n\t\tEV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, right, up, 20.0, -12.0, 4.0, 0);\n\t}\n\n\tEV_EjectBrass(ShellOrigin, ShellVelocity, angles[ YAW ], g_iPShell, TE_BOUNCE_SHELL);\n\n\tPLAY_EVENT_SOUND( SOUNDS_NAME[Com_RandomLong(0, 1)] );\n\n\tEV_GetGunPosition( args, vecSrc, origin );\n\tVector vSpread( args->fparam1, args->fparam2, 0.0f );\n\t\n\tEV_HLDM_FireBullets( idx,\n\t\tforward, right,\tup,\n\t\t1, vecSrc, forward,\n\t\tvSpread, 8192.0, BULLET_PLAYER_50AE,\n\t\t2 );\n}\n"
  },
  {
    "path": "cl_dll/events/event_decal_reset.cpp",
    "content": "/*\n*\n*    This program is free software; you can redistribute it and/or modify it\n*    under the terms of the GNU General Public License as published by the\n*    Free Software Foundation; either version 2 of the License, or (at\n*    your option) any later version.\n*\n*    This program is distributed in the hope that it will be useful, but\n*    WITHOUT ANY WARRANTY; without even the implied warranty of\n*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n*    General Public License for more details.\n*\n*    You should have received a copy of the GNU General Public License\n*    along with this program; if not, write to the Free Software Foundation,\n*    Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\n*\n*    In addition, as a special exception, the author gives permission to\n*    link the code of this program with the Half-Life Game Engine (\"HL\n*    Engine\") and Modified Game Libraries (\"MODs\") developed by Valve,\n*    L.L.C (\"Valve\").  You must obey the GNU General Public License in all\n*    respects for all of the code used other than the HL Engine and MODs\n*    from Valve.  If you modify this file, you may extend this exception\n*    to your version of the file, but you are not obligated to do so.  If\n*    you do not wish to do so, delete this exception statement from your\n*    version.\n*\n*/\n#include <math.h>\n#include \"events.h\"\n\n// HACKHACK: This is very unreliable way to get round time\nfloat g_flRoundTime = 0.0f;\n\nextern TEMPENTITY *g_DeadPlayerModels[64];\n\nvoid EV_DecalReset(event_args_s *args)\n{\n\tint decalnum = (int)(gEngfuncs.pfnGetCvarFloat(\"r_decals\"));\n\n\tfor( int i = 0; i < decalnum; i++ )\n\t\tgEngfuncs.pEfxAPI->R_DecalRemoveAll( i );\n\t\n\tg_flRoundTime = gEngfuncs.GetClientTime();\n\t\n\tif ( g_DeadPlayerModels )\n\t{\n\t\tfor ( int i = 0; i < 64; i++ )\n\t\t{\n\t\t\tif ( g_DeadPlayerModels[i] )\n\t\t\t{\n\t\t\t\tg_DeadPlayerModels[i]->die = 0.0f;\n\t\t\t\tg_DeadPlayerModels[i] = NULL;\n\t\t\t}\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "cl_dll/events/event_elite.cpp",
    "content": "/*\n*\n*    This program is free software; you can redistribute it and/or modify it\n*    under the terms of the GNU General Public License as published by the\n*    Free Software Foundation; either version 2 of the License, or (at\n*    your option) any later version.\n*\n*    This program is distributed in the hope that it will be useful, but\n*    WITHOUT ANY WARRANTY; without even the implied warranty of\n*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n*    General Public License for more details.\n*\n*    You should have received a copy of the GNU General Public License\n*    along with this program; if not, write to the Free Software Foundation,\n*    Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\n*\n*    In addition, as a special exception, the author gives permission to\n*    link the code of this program with the Half-Life Game Engine (\"HL\n*    Engine\") and Modified Game Libraries (\"MODs\") developed by Valve,\n*    L.L.C (\"Valve\").  You must obey the GNU General Public License in all\n*    respects for all of the code used other than the HL Engine and MODs\n*    from Valve.  If you modify this file, you may extend this exception\n*    to your version of the file, but you are not obligated to do so.  If\n*    you do not wish to do so, delete this exception statement from your\n*    version.\n*\n*/\n#include \"events.h\"\n#include \"wpn_shared.h\"\n\n\nstatic const char *SOUNDS_NAME = \"weapons/elite_fire.wav\";\n\n// false is left\n// true is right\nvoid EV_FireElite( event_args_s *args, bool isRight )\n{\n\tVector ShellVelocity;\n\tVector ShellOrigin;\n\tVector vecSrc, vecAiming;\n\n\tint    idx = args->entindex;\n\tVector origin( args->origin );\n\tVector angles( args->angles );\n\tVector velocity( args->velocity );\n\tVector forward, right, up;\n\tint\t\tsequence;\n\tfloat flTimeDiff = args->fparam1;\n\tint iBulletsLeft = args->iparam2;\n\tAngleVectors( angles, forward, right, up );\n\n\tif ( EV_IsLocal( idx ) )\n\t{\n\t\t++g_iShotsFired;\n\t\tEV_MuzzleFlash();\n\n\t\tif( !iBulletsLeft ) sequence = ELITE_SHOOTLEFTLAST;\n\t\telse if( flTimeDiff >= 0.5 ) sequence = ELITE_SHOOTLEFT5;\n\t\telse if( flTimeDiff >= 0.4 ) sequence = ELITE_SHOOTLEFT4;\n\t\telse if( flTimeDiff >= 0.3 ) sequence = ELITE_SHOOTLEFT3;\n\t\telse if( flTimeDiff >= 0.2 ) sequence = ELITE_SHOOTLEFT2;\n\t\telse sequence = ELITE_SHOOTLEFT1;\n\n\t\tif( isRight )\n\t\t{\n\t\t\tsequence += (ELITE_SHOOTRIGHT1 - ELITE_SHOOTLEFT1);\n\n\t\t\tEV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, right, up, 35.0, -11.0, -16.0, 0);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tEV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, right, up, 35.0, -11.0, 16.0, 0);\n\t\t}\n\n\t\tgEngfuncs.pEventAPI->EV_WeaponAnimation(sequence, 2);\n\t}\n\telse\n\t{\n\t\tEV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, right, up, 20.0, -12.0, 4.0, 0);\n\t}\n\tEV_EjectBrass(ShellOrigin, ShellVelocity, angles[ YAW ], g_iPShell, TE_BOUNCE_SHELL);\n\n\tPLAY_EVENT_SOUND( SOUNDS_NAME );\n\n\tEV_GetGunPosition( args, vecSrc, origin );\n\tVectorCopy( forward, vecAiming );\n\tVector vSpread;\n\t\n\tvSpread.x = args->fparam2;\n\tvSpread.y = args->iparam1 / 100.0f;\n\n\tif( isRight )\n\t{\n\t\tvecSrc = vecSrc + right * 5;\n\t}\n\telse\n\t{\n\t\tvecSrc = vecSrc - right * 5;\n\t}\n\n\tEV_HLDM_FireBullets( idx,\n\t\tforward, right,\tup,\n\t\t1, vecSrc, vecAiming,\n\t\tvSpread, 8192.0, BULLET_PLAYER_9MM,\n\t\t2 );\n}\n\nvoid EV_FireEliteLeft(event_args_s *args)\n{\n\tEV_FireElite( args, false );\n}\n\nvoid EV_FireEliteRight( event_args_s *args )\n{\n\tEV_FireElite( args, true );\n}\n"
  },
  {
    "path": "cl_dll/events/event_famas.cpp",
    "content": "/*\n*\n*    This program is free software; you can redistribute it and/or modify it\n*    under the terms of the GNU General Public License as published by the\n*    Free Software Foundation; either version 2 of the License, or (at\n*    your option) any later version.\n*\n*    This program is distributed in the hope that it will be useful, but\n*    WITHOUT ANY WARRANTY; without even the implied warranty of\n*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n*    General Public License for more details.\n*\n*    You should have received a copy of the GNU General Public License\n*    along with this program; if not, write to the Free Software Foundation,\n*    Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\n*\n*    In addition, as a special exception, the author gives permission to\n*    link the code of this program with the Half-Life Game Engine (\"HL\n*    Engine\") and Modified Game Libraries (\"MODs\") developed by Valve,\n*    L.L.C (\"Valve\").  You must obey the GNU General Public License in all\n*    respects for all of the code used other than the HL Engine and MODs\n*    from Valve.  If you modify this file, you may extend this exception\n*    to your version of the file, but you are not obligated to do so.  If\n*    you do not wish to do so, delete this exception statement from your\n*    version.\n*\n*/\n#include \"events.h\"\n#include \"wpn_shared.h\"\n\n\nstatic const char *SOUNDS_NAME[] =\n{\n\t\"weapons/famas-1.wav\", \"weapons/famas-2.wav\"\n};\n\nvoid EV_FireFAMAS( event_args_t *args )\n{\n\tVector ShellVelocity;\n\tVector ShellOrigin;\n\tVector vecSrc, vecAiming;\n\n\tint idx = args->entindex;\n\tVector origin( args->origin );\n\tVector angles(\n\t\targs->iparam1 / 10000000.0f + args->angles[0],\n\t\targs->iparam2 / 10000000.0f + args->angles[1],\n\t\targs->angles[2]\n\t\t);\n\tVector velocity( args->velocity );\n\tVector forward, right, up;\n\n\tAngleVectors( angles, forward, right, up );\n\n\tif ( EV_IsLocal( idx ) )\n\t{\n\t\t++g_iShotsFired;\n\t\tEV_MuzzleFlash();\n\t\tgEngfuncs.pEventAPI->EV_WeaponAnimation(Com_RandomLong(FAMAS_SHOOT1,FAMAS_SHOOT3), 2);\n\t\tif( !gHUD.cl_righthand->value )\n\t\t{\n\t\t\tEV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, right, up, 17.0, -8.0, -14.0, 0);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tEV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, right, up, 17.0, -8.0, 14.0, 0);\n\t\t}\n\t}\n\telse\n\t{\n\t\tEV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, right, up, 20.0, -12.0, 4.0, 0);\n\t}\n\n\tEV_EjectBrass(ShellOrigin, ShellVelocity, angles[ YAW ], g_iRShell, TE_BOUNCE_SHELL);\n\n\tPLAY_EVENT_SOUND( SOUNDS_NAME[Com_RandomLong(0, 1)] );\n\n\tEV_GetGunPosition( args, vecSrc, origin );\n\tVectorCopy( forward, vecAiming );\n\tVector vSpread;\n\t\n\tvSpread.x = args->fparam1;\n\tvSpread.y = args->fparam2;\n\n\tEV_HLDM_FireBullets( idx,\n\t\tforward, right,\tup,\n\t\t1, vecSrc, vecAiming,\n\t\tvSpread, 8192.0, BULLET_PLAYER_556MM,\n\t\t2 );\n}\n"
  },
  {
    "path": "cl_dll/events/event_fiveseven.cpp",
    "content": "/*\n*\n*    This program is free software; you can redistribute it and/or modify it\n*    under the terms of the GNU General Public License as published by the\n*    Free Software Foundation; either version 2 of the License, or (at\n*    your option) any later version.\n*\n*    This program is distributed in the hope that it will be useful, but\n*    WITHOUT ANY WARRANTY; without even the implied warranty of\n*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n*    General Public License for more details.\n*\n*    You should have received a copy of the GNU General Public License\n*    along with this program; if not, write to the Free Software Foundation,\n*    Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\n*\n*    In addition, as a special exception, the author gives permission to\n*    link the code of this program with the Half-Life Game Engine (\"HL\n*    Engine\") and Modified Game Libraries (\"MODs\") developed by Valve,\n*    L.L.C (\"Valve\").  You must obey the GNU General Public License in all\n*    respects for all of the code used other than the HL Engine and MODs\n*    from Valve.  If you modify this file, you may extend this exception\n*    to your version of the file, but you are not obligated to do so.  If\n*    you do not wish to do so, delete this exception statement from your\n*    version.\n*\n*/\n#include \"events.h\"\n#include \"wpn_shared.h\"\n\n\nstatic const char *SOUNDS_NAME = \"weapons/fiveseven-1.wav\";\n\n\nvoid EV_Fire57(event_args_t *args)\n{\n\tVector ShellVelocity;\n\tVector ShellOrigin;\n\tVector vecSrc, vecAiming;\n\n\tint idx = args->entindex;\n\tVector origin( args->origin );\n\tVector angles(\n\t\targs->iparam1 / 100.0f + args->angles[0],\n\t\targs->iparam2 / 100.0f + args->angles[1],\n\t\targs->angles[2]\n\t\t);\n\tVector velocity( args->velocity );\n\tVector forward, right, up;\n\n\tAngleVectors( angles, forward, right, up );\n\n\tif ( EV_IsLocal( idx ) )\n\t{\n\t\t++g_iShotsFired;\n\t\tEV_MuzzleFlash();\n\t\tif( !args->bparam1 )\n\t\t{\n\t\t\tgEngfuncs.pEventAPI->EV_WeaponAnimation(Com_RandomLong(FIVESEVEN_SHOOT1, FIVESEVEN_SHOOT2), 2);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tgEngfuncs.pEventAPI->EV_WeaponAnimation(FIVESEVEN_SHOOT_EMPTY, 2);\n\t\t}\n\n\t\tif( !gHUD.cl_righthand->value )\n\t\t{\n\t\t\tEV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, right, up, 36.0, -14.0, -14.0, 0);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tEV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, right, up, 36.0, -14.0, 14.0, 0);\n\t\t}\n\t}\n\telse\n\t{\n\t\tEV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, right, up, 20.0, -12.0, 4.0, 0);\n\t}\n\n\tEV_EjectBrass(ShellOrigin, ShellVelocity, angles[ YAW ], g_iPShell, TE_BOUNCE_SHELL);\n\n\tPLAY_EVENT_SOUND( SOUNDS_NAME );\n\n\tEV_GetGunPosition( args, vecSrc, origin );\n\tVectorCopy( forward, vecAiming );\n\tVector vSpread;\n\t\n\tvSpread.x = args->fparam1;\n\tvSpread.y = args->fparam2;\n\tEV_HLDM_FireBullets( idx,\n\t\tforward, right,\tup,\n\t\t1, vecSrc, vecAiming,\n\t\tvSpread, 8192.0, BULLET_PLAYER_57MM,\n\t\t2 );\n}\n"
  },
  {
    "path": "cl_dll/events/event_g3sg1.cpp",
    "content": "/*\n*\n*    This program is free software; you can redistribute it and/or modify it\n*    under the terms of the GNU General Public License as published by the\n*    Free Software Foundation; either version 2 of the License, or (at\n*    your option) any later version.\n*\n*    This program is distributed in the hope that it will be useful, but\n*    WITHOUT ANY WARRANTY; without even the implied warranty of\n*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n*    General Public License for more details.\n*\n*    You should have received a copy of the GNU General Public License\n*    along with this program; if not, write to the Free Software Foundation,\n*    Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\n*\n*    In addition, as a special exception, the author gives permission to\n*    link the code of this program with the Half-Life Game Engine (\"HL\n*    Engine\") and Modified Game Libraries (\"MODs\") developed by Valve,\n*    L.L.C (\"Valve\").  You must obey the GNU General Public License in all\n*    respects for all of the code used other than the HL Engine and MODs\n*    from Valve.  If you modify this file, you may extend this exception\n*    to your version of the file, but you are not obligated to do so.  If\n*    you do not wish to do so, delete this exception statement from your\n*    version.\n*\n*/\n#include \"events.h\"\n#include \"wpn_shared.h\"\n\n\nstatic const char *SOUNDS_NAME = \"weapons/g3sg1-1.wav\";\n\nvoid EV_FireG3SG1(event_args_s *args)\n{\n\tvec3_t ShellVelocity, ShellOrigin;\n\tVector vecSrc, vecAiming;\n\n\tint idx = args->entindex;\n\tVector origin( args->origin );\n\tVector angles(\n\t\targs->iparam1 / 100.0f + args->angles[0],\n\t\targs->iparam2 / 100.0f + args->angles[1],\n\t\targs->angles[2]\n\t\t);\n\tVector velocity( args->velocity );\n\tVector forward, right, up;\n\tAngleVectors( angles, forward, right, up );\n\n\tif ( EV_IsLocal( args->entindex ) )\n\t{\n\t\t++g_iShotsFired;\n\t\tgEngfuncs.pEventAPI->EV_WeaponAnimation(Com_RandomLong(G3SG1_SHOOT, G3SG1_SHOOT2), 2);\n\t\tEV_MuzzleFlash();\n\t\tif( !gHUD.cl_righthand->value )\n\t\t{\n\t\t\tEV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, right, up, 20.0, -8.0, -10.0, 0);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tEV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, right, up, 17.0, -8.0, 10.0, 0);\n\t\t}\n\t}\n\telse\n\t{\n\t\tEV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, right, up, 20.0, -12.0, 4.0, 0);\n\t}\n\n\n\tEV_EjectBrass(ShellOrigin, ShellVelocity, angles[ YAW ], g_iRShell, TE_BOUNCE_SHELL);\n\n\tPLAY_EVENT_SOUND( SOUNDS_NAME );\n\n\tEV_GetGunPosition( args, vecSrc, origin );\n\tVectorCopy( forward, vecAiming );\n\tVector vSpread;\n\t\n\tvSpread.x = args->fparam1;\n\tvSpread.y = args->fparam2;\n\tEV_HLDM_FireBullets( idx,\n\t\tforward, right,\tup,\n\t\t1, vecSrc, vecAiming,\n\t\tvSpread, 8192.0, BULLET_PLAYER_762MM,\n\t\t2 );\n}\n"
  },
  {
    "path": "cl_dll/events/event_galil.cpp",
    "content": "/*\n*\n*    This program is free software; you can redistribute it and/or modify it\n*    under the terms of the GNU General Public License as published by the\n*    Free Software Foundation; either version 2 of the License, or (at\n*    your option) any later version.\n*\n*    This program is distributed in the hope that it will be useful, but\n*    WITHOUT ANY WARRANTY; without even the implied warranty of\n*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n*    General Public License for more details.\n*\n*    You should have received a copy of the GNU General Public License\n*    along with this program; if not, write to the Free Software Foundation,\n*    Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\n*\n*    In addition, as a special exception, the author gives permission to\n*    link the code of this program with the Half-Life Game Engine (\"HL\n*    Engine\") and Modified Game Libraries (\"MODs\") developed by Valve,\n*    L.L.C (\"Valve\").  You must obey the GNU General Public License in all\n*    respects for all of the code used other than the HL Engine and MODs\n*    from Valve.  If you modify this file, you may extend this exception\n*    to your version of the file, but you are not obligated to do so.  If\n*    you do not wish to do so, delete this exception statement from your\n*    version.\n*\n*/\n#include \"events.h\"\n#include \"wpn_shared.h\"\n\n\nstatic const char *SOUNDS_NAME[] =\n{\n\t\"weapons/galil-1.wav\", \"weapons/galil-2.wav\"\n};\n\n\nvoid EV_FireGALIL( event_args_t *args )\n{\n\tVector ShellVelocity;\n\tVector ShellOrigin;\n\tVector vecSrc, vecAiming;\n\tint idx = args->entindex;\n\tVector origin( args->origin );\n\tVector angles(\n\t\targs->iparam1 / 10000000.0f + args->angles[0],\n\t\targs->iparam2 / 10000000.0f + args->angles[1],\n\t\targs->angles[2]\n\t\t);\n\tVector velocity( args->velocity );\n\tVector forward, right, up;\n\n\n\tAngleVectors( angles, forward, right, up );\n\n\tif ( EV_IsLocal( idx ) )\n\t{\n\t\t++g_iShotsFired;\n\t\tEV_MuzzleFlash();\n\t\tgEngfuncs.pEventAPI->EV_WeaponAnimation(GALIL_SHOOT1 + Com_RandomLong(0,2), 2);\n\t\tif( !gHUD.cl_righthand->value )\n\t\t{\n\t\t\tEV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, right, up, 20.0, -8.0, -10.0, 0);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tEV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, right, up, 20.0, -8.0, 10.0, 0);\n\t\t}\n\t}\n\telse\n\t{\n\t\tEV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, right, up, 20.0, -12.0, 4.0, 0);\n\t}\n\n\n\tEV_EjectBrass(ShellOrigin, ShellVelocity, angles[ YAW ], g_iRShell, TE_BOUNCE_SHELL);\n\n\tPLAY_EVENT_SOUND( SOUNDS_NAME[Com_RandomLong( 0, 1 )] );\n\n\tEV_GetGunPosition( args, vecSrc, origin );\n\tVectorCopy( forward, vecAiming );\n\tVector vSpread;\n\n\tvSpread.x = args->fparam1;\n\tvSpread.y = args->fparam2;\n\tEV_HLDM_FireBullets( idx,\n\t\tforward, right,\tup,\n\t\t1, vecSrc, vecAiming,\n\t\tvSpread, 8192.0, BULLET_PLAYER_556MM,\n\t\t2 );\n}\n"
  },
  {
    "path": "cl_dll/events/event_glock18.cpp",
    "content": "/*\n*\n*    This program is free software; you can redistribute it and/or modify it\n*    under the terms of the GNU General Public License as published by the\n*    Free Software Foundation; either version 2 of the License, or (at\n*    your option) any later version.\n*\n*    This program is distributed in the hope that it will be useful, but\n*    WITHOUT ANY WARRANTY; without even the implied warranty of\n*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n*    General Public License for more details.\n*\n*    You should have received a copy of the GNU General Public License\n*    along with this program; if not, write to the Free Software Foundation,\n*    Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\n*\n*    In addition, as a special exception, the author gives permission to\n*    link the code of this program with the Half-Life Game Engine (\"HL\n*    Engine\") and Modified Game Libraries (\"MODs\") developed by Valve,\n*    L.L.C (\"Valve\").  You must obey the GNU General Public License in all\n*    respects for all of the code used other than the HL Engine and MODs\n*    from Valve.  If you modify this file, you may extend this exception\n*    to your version of the file, but you are not obligated to do so.  If\n*    you do not wish to do so, delete this exception statement from your\n*    version.\n*\n*/\n#include \"events.h\"\n#include \"wpn_shared.h\"\n\nbool g_bGlockBurstMode = false;\n\nstatic const char *SOUNDS_NAME[] =\n{\n\t\"weapons/glock18-1.wav\", \"weapons/glock18-2.wav\"\n};\n\nvoid EV_Fireglock18( event_args_t *args )\n{\n\tVector ShellVelocity;\n\tVector ShellOrigin;\n\tVector vecSrc, vecAiming;\n\n\tint    idx = args->entindex;\n\tVector origin( args->origin );\n\tVector angles(\n\t\targs->iparam1 / 100.0f + args->angles[0],\n\t\targs->iparam2 / 100.0f + args->angles[1],\n\t\targs->angles[2]\n\t\t);\n\tVector velocity( args->velocity );\n\tVector forward, right, up;\n\n\tAngleVectors( angles, forward, right, up );\n\n\tif ( EV_IsLocal( idx ) )\n\t{\n\t\t++g_iShotsFired;\n\t\tEV_MuzzleFlash();\n\t\tint seq;\n\t\tbool isBurst = (g_iWeaponFlags & WPNSTATE_GLOCK18_BURST_MODE) != 0 || g_bGlockBurstMode;\n\t\tif( !args->bparam1 )\n\t\t{\n\t\t\tif( g_bHoldingShield )\n\t\t\t{\n\t\t\t\tseq = Com_RandomLong(GLOCK18_SHIELD_SHOOT, GLOCK18_SHIELD_SHOOT2);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tseq = isBurst? GLOCK18_SHOOT : GLOCK18_SHOOT3;\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif( g_bHoldingShield )\n\t\t\t\tseq = GLOCK18_SHIELD_SHOOT_EMPTY;\n\t\t\telse\n\t\t\t\tseq = GLOCK18_SHOOT_EMPTY;\n\t\t}\n\t\tgEngfuncs.pEventAPI->EV_WeaponAnimation(seq, 2);\n\t\tif( !gHUD.cl_righthand->value )\n\t\t{\n\t\t\tEV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, right, up, 36.0, -14.0, -14.0, 0);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tEV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, right, up, 36.0, -14.0, 14.0, 0);\n\t\t}\n\t}\n\telse\n\t{\n\t\tEV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, right, up, 20.0, -12.0, 4.0, 0);\n\t}\n\n\n\tEV_EjectBrass(ShellOrigin, ShellVelocity, angles[ YAW ], g_iPShell, TE_BOUNCE_SHELL);\n\n\tPLAY_EVENT_SOUND( ((g_iWeaponFlags & WPNSTATE_GLOCK18_BURST_MODE) != 0 || g_bGlockBurstMode )\n\t\t\t\t\t\t&& !g_bHoldingShield ? SOUNDS_NAME[0] : SOUNDS_NAME[1] );\n\n\tEV_GetGunPosition( args, vecSrc, origin );\n\tVectorCopy( forward, vecAiming );\n\tVector vSpread;\n\t\n\tvSpread.x = args->fparam1;\n\tvSpread.y = args->fparam2;\n\tEV_HLDM_FireBullets( idx,\n\t\tforward, right,\tup,\n\t\t1, vecSrc, vecAiming,\n\t\tvSpread, 4096.0, BULLET_PLAYER_9MM,\n\t\t2 );\n}\n"
  },
  {
    "path": "cl_dll/events/event_knife.cpp",
    "content": "/*\n*\n*    This program is free software; you can redistribute it and/or modify it\n*    under the terms of the GNU General Public License as published by the\n*    Free Software Foundation; either version 2 of the License, or (at\n*    your option) any later version.\n*\n*    This program is distributed in the hope that it will be useful, but\n*    WITHOUT ANY WARRANTY; without even the implied warranty of\n*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n*    General Public License for more details.\n*\n*    You should have received a copy of the GNU General Public License\n*    along with this program; if not, write to the Free Software Foundation,\n*    Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\n*\n*    In addition, as a special exception, the author gives permission to\n*    link the code of this program with the Half-Life Game Engine (\"HL\n*    Engine\") and Modified Game Libraries (\"MODs\") developed by Valve,\n*    L.L.C (\"Valve\").  You must obey the GNU General Public License in all\n*    respects for all of the code used other than the HL Engine and MODs\n*    from Valve.  If you modify this file, you may extend this exception\n*    to your version of the file, but you are not obligated to do so.  If\n*    you do not wish to do so, delete this exception statement from your\n*    version.\n*\n*/\n#include \"events.h\"\n#include \"wpn_shared.h\"\n\n\nstatic const char *SOUNDS_NAME = \"weapons/knife_miss1.wav\";\n\nvoid EV_Knife( struct event_args_s *args )\n{\n\tint    idx = args->entindex;\n\tVector origin( args->origin );\n\n\tif( EV_IsLocal( idx ))\n\t\tgEngfuncs.pEventAPI->EV_WeaponAnimation( args->iparam1, 2 );\n\n\t//Play Swing sound\n\tPLAY_EVENT_SOUND( SOUNDS_NAME );\n}\n"
  },
  {
    "path": "cl_dll/events/event_m249.cpp",
    "content": "/*\n*\n*    This program is free software; you can redistribute it and/or modify it\n*    under the terms of the GNU General Public License as published by the\n*    Free Software Foundation; either version 2 of the License, or (at\n*    your option) any later version.\n*\n*    This program is distributed in the hope that it will be useful, but\n*    WITHOUT ANY WARRANTY; without even the implied warranty of\n*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n*    General Public License for more details.\n*\n*    You should have received a copy of the GNU General Public License\n*    along with this program; if not, write to the Free Software Foundation,\n*    Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\n*\n*    In addition, as a special exception, the author gives permission to\n*    link the code of this program with the Half-Life Game Engine (\"HL\n*    Engine\") and Modified Game Libraries (\"MODs\") developed by Valve,\n*    L.L.C (\"Valve\").  You must obey the GNU General Public License in all\n*    respects for all of the code used other than the HL Engine and MODs\n*    from Valve.  If you modify this file, you may extend this exception\n*    to your version of the file, but you are not obligated to do so.  If\n*    you do not wish to do so, delete this exception statement from your\n*    version.\n*\n*/\n#include \"events.h\"\n#include \"wpn_shared.h\"\n\n\nstatic const char *SOUNDS_NAME[] =\n{\n\t \"weapons/m249-1.wav\", \"weapons/m249-2.wav\"\n};\n\nvoid EV_FireM249(event_args_s *args)\n{\n\tvec3_t ShellVelocity, ShellOrigin;\n\tVector vecSrc, vecAiming;\n\n\tint    idx = args->entindex;\n\tVector origin( args->origin );\n\tVector angles(\n\t\targs->iparam1 / 100.0f + args->angles[0],\n\t\targs->iparam2 / 100.0f + args->angles[1],\n\t\targs->angles[2]\n\t\t);\n\tVector velocity( args->velocity );\n\tVector forward, right, up;\n\tAngleVectors( angles, forward, right, up );\n\n\tif ( EV_IsLocal( args->entindex ) )\n\t{\n\t\t++g_iShotsFired;\n\t\tgEngfuncs.pEventAPI->EV_WeaponAnimation(Com_RandomLong(M249_SHOOT1, M249_SHOOT2), 2);\n\t\tEV_MuzzleFlash();\n\t\tif( !gHUD.cl_righthand->value )\n\t\t{\n\t\t\tEV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, right, up, 20.0, -10.0, -13.0, 0);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tEV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, right, up, 20.0, -10.0, 13.0, 0);\n\t\t}\n\t}\n\telse\n\t{\n\t\tEV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, right, up, 20.0, -12.0, 4.0, 0);\n\t}\n\n\n\tEV_EjectBrass(ShellOrigin, ShellVelocity, angles[ YAW ], g_iRShell, TE_BOUNCE_SHELL);\n\n\tPLAY_EVENT_SOUND( SOUNDS_NAME[Com_RandomLong(0, 1)] );\n\n\tEV_GetGunPosition( args, vecSrc, origin );\n\tVectorCopy( forward, vecAiming );\n\tVector vSpread;\n\t\n\tvSpread.x = args->fparam1;\n\tvSpread.y = args->fparam2;\n\tEV_HLDM_FireBullets( idx,\n\t\tforward, right,\tup,\n\t\t1, vecSrc, vecAiming,\n\t\tvSpread, 8192.0, BULLET_PLAYER_556MM,\n\t\t2 );\n}\n"
  },
  {
    "path": "cl_dll/events/event_m3.cpp",
    "content": "/*\n*\n*    This program is free software; you can redistribute it and/or modify it\n*    under the terms of the GNU General Public License as published by the\n*    Free Software Foundation; either version 2 of the License, or (at\n*    your option) any later version.\n*\n*    This program is distributed in the hope that it will be useful, but\n*    WITHOUT ANY WARRANTY; without even the implied warranty of\n*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n*    General Public License for more details.\n*\n*    You should have received a copy of the GNU General Public License\n*    along with this program; if not, write to the Free Software Foundation,\n*    Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\n*\n*    In addition, as a special exception, the author gives permission to\n*    link the code of this program with the Half-Life Game Engine (\"HL\n*    Engine\") and Modified Game Libraries (\"MODs\") developed by Valve,\n*    L.L.C (\"Valve\").  You must obey the GNU General Public License in all\n*    respects for all of the code used other than the HL Engine and MODs\n*    from Valve.  If you modify this file, you may extend this exception\n*    to your version of the file, but you are not obligated to do so.  If\n*    you do not wish to do so, delete this exception statement from your\n*    version.\n*\n*/\n#include \"events.h\"\n#include \"wpn_shared.h\"\n\nstatic const char *SOUNDS_NAME = \"weapons/m3-1.wav\";\n\nvoid EV_FireM3( event_args_t *args )\n{\n\tVector vecSrc, vecAiming;\n\tint    idx = args->entindex;\n\tVector origin( args->origin );\n\tVector angles(\n\t\targs->iparam1 / 100.0f + args->angles[0],\n\t\targs->iparam2 / 100.0f + args->angles[1],\n\t\targs->angles[2]\n\t\t);\n\tVector velocity( args->velocity );\n\tVector forward, right, up;\n\n\tAngleVectors( angles, forward, right, up );\n\n\tif ( EV_IsLocal( idx ) )\n\t{\n\t\t++g_iShotsFired;\n\t\tEV_MuzzleFlash();\n\t\tgEngfuncs.pEventAPI->EV_WeaponAnimation(Com_RandomLong(M3_FIRE1, M3_FIRE2), 2);\n\t}\n\n\tPLAY_EVENT_SOUND( SOUNDS_NAME );\n\n\tEV_GetGunPosition( args, vecSrc, origin );\n\tVectorCopy( forward, vecAiming );\n\tVector vSpread;\n\t\n\tvSpread.x = 0.0725;\n\tvSpread.y = 0.0725;\n\tEV_HLDM_FireBullets( idx,\n\t\tforward, right,\tup,\n\t\t9, vecSrc, vecAiming,\n\t\tvSpread, 8192.0, BULLET_PLAYER_BUCKSHOT,\n\t\t1 );\n}\n"
  },
  {
    "path": "cl_dll/events/event_m4a1.cpp",
    "content": "/*\n*\n*    This program is free software; you can redistribute it and/or modify it\n*    under the terms of the GNU General Public License as published by the\n*    Free Software Foundation; either version 2 of the License, or (at\n*    your option) any later version.\n*\n*    This program is distributed in the hope that it will be useful, but\n*    WITHOUT ANY WARRANTY; without even the implied warranty of\n*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n*    General Public License for more details.\n*\n*    You should have received a copy of the GNU General Public License\n*    along with this program; if not, write to the Free Software Foundation,\n*    Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\n*\n*    In addition, as a special exception, the author gives permission to\n*    link the code of this program with the Half-Life Game Engine (\"HL\n*    Engine\") and Modified Game Libraries (\"MODs\") developed by Valve,\n*    L.L.C (\"Valve\").  You must obey the GNU General Public License in all\n*    respects for all of the code used other than the HL Engine and MODs\n*    from Valve.  If you modify this file, you may extend this exception\n*    to your version of the file, but you are not obligated to do so.  If\n*    you do not wish to do so, delete this exception statement from your\n*    version.\n*\n*/\n#include \"events.h\"\n#include \"wpn_shared.h\"\n\n\nstatic const char *SOUNDS_NAME[] =\n{\n\t\"weapons/m4a1-1.wav\",\n\t\"weapons/m4a1_unsil-1.wav\",\n\t\"weapons/m4a1_unsil-2.wav\"\n};\n\n// bparam1: 1 if silenced, 0 if unsilenced\nvoid EV_FireM4A1( event_args_t *args )\n{\n\tVector ShellVelocity;\n\tVector ShellOrigin;\n\tVector vecSrc, vecAiming;\n\tint    sequence, idx = args->entindex;\n\tVector origin( args->origin );\n\tVector angles(\n\t\targs->iparam1 / 100.0f + args->angles[0],\n\t\targs->iparam2 / 100.0f + args->angles[1],\n\t\targs->angles[2]\n\t\t);\n\tVector velocity( args->velocity );\n\tVector forward, right, up;\n\n\tAngleVectors( angles, forward, right, up );\n\n\tif ( EV_IsLocal( idx ) )\n\t{\n\t\t++g_iShotsFired;\n\t\tEV_MuzzleFlash();\n\t\tif( args->bparam1 )\n\t\t{\n\t\t\tsequence = Com_RandomLong( M4A1_SHOOT1, M4A1_SHOOT3 );\n\t\t}\n\t\telse\n\t\t{\n\t\t\tsequence = Com_RandomLong( M4A1_UNSIL_SHOOT1, M4A1_UNSIL_SHOOT3 );\n\t\t}\n\t\tgEngfuncs.pEventAPI->EV_WeaponAnimation(sequence, 2);\n\t\tif( !gHUD.cl_righthand->value )\n\t\t{\n\t\t\tEV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, right, up, 20.0, -8.0, -10.0, 0);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tEV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, right, up, 20.0, -8.0, 10.0, 0);\n\t\t}\n\t}\n\telse\n\t{\n\t\tEV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, right, up, 20.0, -12.0, 4.0, 0);\n\t}\n\n\n\tEV_EjectBrass(ShellOrigin, ShellVelocity, angles[ YAW ], g_iRShell, TE_BOUNCE_SHELL);\n\n\tPLAY_EVENT_SOUND( args->bparam1 ? SOUNDS_NAME[0] : SOUNDS_NAME[Com_RandomLong( 1, 2 )]);\n\n\tEV_GetGunPosition( args, vecSrc, origin );\n\tVectorCopy( forward, vecAiming );\n\tVector vSpread;\n\t\n\tvSpread.x = args->fparam1;\n\tvSpread.y = args->fparam2;\n\tEV_HLDM_FireBullets( idx,\n\t\tforward, right,\tup,\n\t\t1, vecSrc, vecAiming,\n\t\tvSpread, 8192.0, BULLET_PLAYER_556MM,\n\t\t2 );\n}\n"
  },
  {
    "path": "cl_dll/events/event_mac10.cpp",
    "content": "/*\n*\n*    This program is free software; you can redistribute it and/or modify it\n*    under the terms of the GNU General Public License as published by the\n*    Free Software Foundation; either version 2 of the License, or (at\n*    your option) any later version.\n*\n*    This program is distributed in the hope that it will be useful, but\n*    WITHOUT ANY WARRANTY; without even the implied warranty of\n*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n*    General Public License for more details.\n*\n*    You should have received a copy of the GNU General Public License\n*    along with this program; if not, write to the Free Software Foundation,\n*    Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\n*\n*    In addition, as a special exception, the author gives permission to\n*    link the code of this program with the Half-Life Game Engine (\"HL\n*    Engine\") and Modified Game Libraries (\"MODs\") developed by Valve,\n*    L.L.C (\"Valve\").  You must obey the GNU General Public License in all\n*    respects for all of the code used other than the HL Engine and MODs\n*    from Valve.  If you modify this file, you may extend this exception\n*    to your version of the file, but you are not obligated to do so.  If\n*    you do not wish to do so, delete this exception statement from your\n*    version.\n*\n*/\n#include \"events.h\"\n#include \"wpn_shared.h\"\n\n\nstatic const char *SOUNDS_NAME = \"weapons/mac10-1.wav\";\n\nvoid EV_FireMAC10(event_args_s *args)\n{\n\tvec3_t ShellVelocity, ShellOrigin;\n\tVector vecSrc, vecAiming;\n\tint    idx = args->entindex;\n\tVector origin( args->origin );\n\tVector angles(\n\t\targs->iparam1 / 100.0f + args->angles[0],\n\t\targs->iparam2 / 100.0f + args->angles[1],\n\t\targs->angles[2]\n\t\t);\n\tVector velocity( args->velocity );\n\tVector forward, right, up;\n\n\tAngleVectors( angles, forward, right, up );\n\n\tif ( EV_IsLocal( args->entindex ) )\n\t{\n\t\t++g_iShotsFired;\n\t\tgEngfuncs.pEventAPI->EV_WeaponAnimation(Com_RandomLong(MAC10_SHOOT1, MAC10_SHOOT3), 2);\n\t\tEV_MuzzleFlash();\n\t\tif( !gHUD.cl_righthand->value )\n\t\t{\n\t\t\tEV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, right, up, 32.0, -9.0, -11.0, 0);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tEV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, right, up, 32.0, -9.0, 11.0, 0);\n\t\t}\n\t}\n\telse\n\t{\n\t\tEV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, right, up, 20.0, -12.0, 4.0, 0);\n\t}\n\n\n\tEV_EjectBrass(ShellOrigin, ShellVelocity, angles[ YAW ], g_iRShell, TE_BOUNCE_SHELL);\n\n\tPLAY_EVENT_SOUND( SOUNDS_NAME );\n\n\tEV_GetGunPosition( args, vecSrc, origin );\n\tVectorCopy( forward, vecAiming );\n\tVector vSpread;\n\t\n\tvSpread.x = args->fparam1;\n\tvSpread.y = args->fparam2;\n\tEV_HLDM_FireBullets( idx,\n\t\tforward, right,\tup,\n\t\t1, vecSrc, vecAiming,\n\t\tvSpread, 8192.0, BULLET_PLAYER_45ACP,\n\t\t2 );\n}\n"
  },
  {
    "path": "cl_dll/events/event_mp5n.cpp",
    "content": "/*\n*\n*    This program is free software; you can redistribute it and/or modify it\n*    under the terms of the GNU General Public License as published by the\n*    Free Software Foundation; either version 2 of the License, or (at\n*    your option) any later version.\n*\n*    This program is distributed in the hope that it will be useful, but\n*    WITHOUT ANY WARRANTY; without even the implied warranty of\n*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n*    General Public License for more details.\n*\n*    You should have received a copy of the GNU General Public License\n*    along with this program; if not, write to the Free Software Foundation,\n*    Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\n*\n*    In addition, as a special exception, the author gives permission to\n*    link the code of this program with the Half-Life Game Engine (\"HL\n*    Engine\") and Modified Game Libraries (\"MODs\") developed by Valve,\n*    L.L.C (\"Valve\").  You must obey the GNU General Public License in all\n*    respects for all of the code used other than the HL Engine and MODs\n*    from Valve.  If you modify this file, you may extend this exception\n*    to your version of the file, but you are not obligated to do so.  If\n*    you do not wish to do so, delete this exception statement from your\n*    version.\n*\n*/\n#include \"events.h\"\n#include \"wpn_shared.h\"\n\n\nstatic const char *SOUNDS_NAME[] =\n{\n\t\"weapons/mp5-1.wav\",\n\t\"weapons/mp5-2.wav\"\n};\n\nvoid EV_FireMP5( event_args_t *args )\n{\n\tVector ShellVelocity;\n\tVector ShellOrigin;\n\tVector vecSrc, vecAiming;\n\tint    idx = args->entindex;\n\tVector origin( args->origin );\n\tVector angles(\n\t\targs->iparam1 / 100.0f + args->angles[0],\n\t\targs->iparam2 / 100.0f + args->angles[1],\n\t\targs->angles[2]\n\t\t);\n\tVector velocity( args->velocity );\n\tVector forward, right, up;\n\n\tAngleVectors( angles, forward, right, up );\n\n\tif ( EV_IsLocal( idx ) )\n\t{\n\t\t++g_iShotsFired;\n\t\tEV_MuzzleFlash();\n\t\tgEngfuncs.pEventAPI->EV_WeaponAnimation(MP5N_SHOOT1 + Com_RandomLong(0,2), 2);\n\t\tif( !gHUD.cl_righthand->value )\n\t\t{\n\t\t\tEV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, right, up, 36.0, -10.0, -11.0, 0);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tEV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, right, up, 36.0, -10.0, 11.0, 0);\n\t\t}\n\t}\n\telse\n\t{\n\t\tEV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, right, up, 20.0, -12.0, 4.0, 0);\n\t}\n\n\n\tEV_EjectBrass(ShellOrigin, ShellVelocity, angles[ YAW ], g_iRShell, TE_BOUNCE_SHELL);\n\n\tPLAY_EVENT_SOUND( SOUNDS_NAME[Com_RandomLong(0, 1)] );\n\n\tEV_GetGunPosition( args, vecSrc, origin );\n\tVectorCopy( forward, vecAiming );\n\tVector vSpread;\n\t\n\tvSpread.x = args->fparam1;\n\tvSpread.y = args->fparam2;\n\tEV_HLDM_FireBullets( idx,\n\t\tforward, right,\tup,\n\t\t1, vecSrc, vecAiming,\n\t\tvSpread, 8192.0, BULLET_PLAYER_9MM,\n\t\t2 );\n}\n"
  },
  {
    "path": "cl_dll/events/event_p228.cpp",
    "content": "/*\n*\n*    This program is free software; you can redistribute it and/or modify it\n*    under the terms of the GNU General Public License as published by the\n*    Free Software Foundation; either version 2 of the License, or (at\n*    your option) any later version.\n*\n*    This program is distributed in the hope that it will be useful, but\n*    WITHOUT ANY WARRANTY; without even the implied warranty of\n*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n*    General Public License for more details.\n*\n*    You should have received a copy of the GNU General Public License\n*    along with this program; if not, write to the Free Software Foundation,\n*    Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\n*\n*    In addition, as a special exception, the author gives permission to\n*    link the code of this program with the Half-Life Game Engine (\"HL\n*    Engine\") and Modified Game Libraries (\"MODs\") developed by Valve,\n*    L.L.C (\"Valve\").  You must obey the GNU General Public License in all\n*    respects for all of the code used other than the HL Engine and MODs\n*    from Valve.  If you modify this file, you may extend this exception\n*    to your version of the file, but you are not obligated to do so.  If\n*    you do not wish to do so, delete this exception statement from your\n*    version.\n*\n*/\n#include \"events.h\"\n#include \"wpn_shared.h\"\n\n\nstatic const char *SOUNDS_NAME = \"weapons/p228-1.wav\";\n\nvoid EV_FireP228(event_args_s *args)\n{\n\tVector ShellVelocity;\n\tVector ShellOrigin;\n\tVector vecSrc, vecAiming;\n\tint    idx = args->entindex;\n\tVector origin( args->origin );\n\tVector angles(\n\t\targs->iparam1 / 100.0f + args->angles[0],\n\t\targs->iparam2 / 100.0f + args->angles[1],\n\t\targs->angles[2]\n\t\t);\n\tVector velocity( args->velocity );\n\tVector forward, right, up;\n\n\tAngleVectors( angles, forward, right, up );\n\n\tif ( EV_IsLocal( idx ) )\n\t{\n\t\t++g_iShotsFired;\n\t\tEV_MuzzleFlash();\n\t\tint seq;\n\t\tif( !args->bparam1 )\n\t\t{\n\t\t\tif( g_bHoldingShield )\n\t\t\t\tseq = Com_RandomLong(P228_SHIELD_SHOOT1, P228_SHIELD_SHOOT2);\n\t\t\telse\n\t\t\t\tseq = Com_RandomLong(P228_SHOOT1, P228_SHOOT3);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tseq = g_bHoldingShield ? (int)P228_SHIELD_SHOOT_EMPTY : (int)P228_SHOOT_EMPTY;\n\t\t}\n\t\tgEngfuncs.pEventAPI->EV_WeaponAnimation(seq, 2);\n\t\tif( !gHUD.cl_righthand->value )\n\t\t{\n\t\t\tEV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, right, up, 36.0, -14.0, -14.0, 0);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tEV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, right, up, 36.0, -14.0, 14.0, 0);\n\t\t}\n\t}\n\telse\n\t{\n\t\tEV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, right, up, 20.0, -12.0, 4.0, 0);\n\t}\n\n\n\tEV_EjectBrass(ShellOrigin, ShellVelocity, angles[ YAW ], g_iPShell, TE_BOUNCE_SHELL);\n\tPLAY_EVENT_SOUND( SOUNDS_NAME );\n\n\tEV_GetGunPosition( args, vecSrc, origin );\n\tVectorCopy( forward, vecAiming );\n\tVector vSpread;\n\t\n\tvSpread.x = args->fparam1;\n\tvSpread.y = args->fparam2;\n\tEV_HLDM_FireBullets( idx,\n\t\tforward, right,\tup,\n\t\t1, vecSrc, vecAiming,\n\t\tvSpread, 8192.0, BULLET_PLAYER_357SIG,\n\t\t2 );\n}\n"
  },
  {
    "path": "cl_dll/events/event_p90.cpp",
    "content": "/*\n*\n*    This program is free software; you can redistribute it and/or modify it\n*    under the terms of the GNU General Public License as published by the\n*    Free Software Foundation; either version 2 of the License, or (at\n*    your option) any later version.\n*\n*    This program is distributed in the hope that it will be useful, but\n*    WITHOUT ANY WARRANTY; without even the implied warranty of\n*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n*    General Public License for more details.\n*\n*    You should have received a copy of the GNU General Public License\n*    along with this program; if not, write to the Free Software Foundation,\n*    Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\n*\n*    In addition, as a special exception, the author gives permission to\n*    link the code of this program with the Half-Life Game Engine (\"HL\n*    Engine\") and Modified Game Libraries (\"MODs\") developed by Valve,\n*    L.L.C (\"Valve\").  You must obey the GNU General Public License in all\n*    respects for all of the code used other than the HL Engine and MODs\n*    from Valve.  If you modify this file, you may extend this exception\n*    to your version of the file, but you are not obligated to do so.  If\n*    you do not wish to do so, delete this exception statement from your\n*    version.\n*\n*/\n#include \"events.h\"\n#include \"wpn_shared.h\"\n\n\nstatic const char *SOUNDS_NAME = \"weapons/p90-1.wav\";\n\nvoid EV_FireP90(event_args_s *args)\n{\n\tvec3_t ShellVelocity, ShellOrigin;\n\tVector vecSrc, vecAiming;\n\tint    idx = args->entindex;\n\tVector origin( args->origin );\n\tVector angles(\n\t\targs->iparam1 / 100.0f + args->angles[0],\n\t\targs->iparam2 / 100.0f + args->angles[1],\n\t\targs->angles[2]\n\t\t);\n\tVector velocity( args->velocity );\n\tVector forward, right, up;\n\n\tAngleVectors( angles, forward, right, up );\n\n\tif ( EV_IsLocal( args->entindex ) )\n\t{\n\t\t++g_iShotsFired;\n\t\tgEngfuncs.pEventAPI->EV_WeaponAnimation(Com_RandomLong(P90_SHOOT1, P90_SHOOT3), 2);\n\t\tEV_MuzzleFlash();\n\t\tif( !gHUD.cl_righthand->value )\n\t\t{\n\t\t\tEV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, right, up, 35.0, -16.0, -22.0, 0);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tEV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, right, up, 35.0, -16.0, 22.0, 0);\n\t\t}\n\t}\n\telse\n\t{\n\t\tEV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, right, up, 20.0, -12.0, 4.0, 0);\n\t}\n\n\tEV_EjectBrass(ShellOrigin, ShellVelocity, angles[ YAW ], g_iRShell, TE_BOUNCE_SHELL);\n\n\tPLAY_EVENT_SOUND( SOUNDS_NAME );\n\n\tEV_GetGunPosition( args, vecSrc, origin );\n\tVectorCopy( forward, vecAiming );\n\tVector vSpread;\n\t\n\tvSpread.x = args->fparam1;\n\tvSpread.y = args->fparam2;\n\tEV_HLDM_FireBullets( idx,\n\t\tforward, right,\tup,\n\t\t1, vecSrc, vecAiming,\n\t\tvSpread, 8192.0, BULLET_PLAYER_57MM,\n\t\t2 );\n}\n"
  },
  {
    "path": "cl_dll/events/event_scout.cpp",
    "content": "/*\n*\n*    This program is free software; you can redistribute it and/or modify it\n*    under the terms of the GNU General Public License as published by the\n*    Free Software Foundation; either version 2 of the License, or (at\n*    your option) any later version.\n*\n*    This program is distributed in the hope that it will be useful, but\n*    WITHOUT ANY WARRANTY; without even the implied warranty of\n*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n*    General Public License for more details.\n*\n*    You should have received a copy of the GNU General Public License\n*    along with this program; if not, write to the Free Software Foundation,\n*    Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\n*\n*    In addition, as a special exception, the author gives permission to\n*    link the code of this program with the Half-Life Game Engine (\"HL\n*    Engine\") and Modified Game Libraries (\"MODs\") developed by Valve,\n*    L.L.C (\"Valve\").  You must obey the GNU General Public License in all\n*    respects for all of the code used other than the HL Engine and MODs\n*    from Valve.  If you modify this file, you may extend this exception\n*    to your version of the file, but you are not obligated to do so.  If\n*    you do not wish to do so, delete this exception statement from your\n*    version.\n*\n*/\n#include \"events.h\"\n\nenum scout_e\n{\n\tSCOUT_IDLE,\n\tSCOUT_SHOOT,\n\tSCOUT_SHOOT2,\n\tSCOUT_RELOAD,\n\tSCOUT_DRAW\n};\n\nstatic const char *SOUNDS_NAME = \"weapons/scout_fire-1.wav\";\n\nvoid EV_FireScout(event_args_s *args)\n{\n\tVector vecSrc, vecAiming;\n\n\tint    idx = args->entindex;\n\tVector origin( args->origin );\n\tVector angles(\n\t\targs->iparam1 / 100.0f + args->angles[0],\n\t\targs->iparam2 / 100.0f + args->angles[1],\n\t\targs->angles[2]\n\t\t);\n\tVector velocity( args->velocity );\n\tVector forward, right, up;\n\n\tAngleVectors( angles, forward, right, up );\n\n\tif ( EV_IsLocal( idx ) )\n\t{\n\t\t++g_iShotsFired;\n\t\tEV_MuzzleFlash();\n\t\tgEngfuncs.pEventAPI->EV_WeaponAnimation( Com_RandomLong(SCOUT_SHOOT, SCOUT_SHOOT2), 2 );\n\t}\n\n\tPLAY_EVENT_SOUND( SOUNDS_NAME );\n\n\tEV_GetGunPosition( args, vecSrc, origin );\n\tVectorCopy( forward, vecAiming );\n\tVector vSpread;\n\t\n\tvSpread.x = args->fparam1 / 1000.0f;\n\tvSpread.y = args->fparam2 / 1000.0f;\n\tEV_HLDM_FireBullets( idx,\n\t\tforward, right,\tup,\n\t\t1, vecSrc, vecAiming,\n\t\tvSpread, 8192.0, BULLET_PLAYER_762MM,\n\t\t2 );\n}\n"
  },
  {
    "path": "cl_dll/events/event_sg550.cpp",
    "content": "/*\n*\n*    This program is free software; you can redistribute it and/or modify it\n*    under the terms of the GNU General Public License as published by the\n*    Free Software Foundation; either version 2 of the License, or (at\n*    your option) any later version.\n*\n*    This program is distributed in the hope that it will be useful, but\n*    WITHOUT ANY WARRANTY; without even the implied warranty of\n*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n*    General Public License for more details.\n*\n*    You should have received a copy of the GNU General Public License\n*    along with this program; if not, write to the Free Software Foundation,\n*    Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\n*\n*    In addition, as a special exception, the author gives permission to\n*    link the code of this program with the Half-Life Game Engine (\"HL\n*    Engine\") and Modified Game Libraries (\"MODs\") developed by Valve,\n*    L.L.C (\"Valve\").  You must obey the GNU General Public License in all\n*    respects for all of the code used other than the HL Engine and MODs\n*    from Valve.  If you modify this file, you may extend this exception\n*    to your version of the file, but you are not obligated to do so.  If\n*    you do not wish to do so, delete this exception statement from your\n*    version.\n*\n*/\n#include \"events.h\"\n#include \"wpn_shared.h\"\n\n\nstatic const char *SOUNDS_NAME = \"weapons/sg550-1.wav\";\n\nvoid EV_FireSG550(event_args_s *args)\n{\n\tVector ShellVelocity;\n\tVector ShellOrigin;\n\tVector vecSrc, vecAiming;\n\tint    idx = args->entindex;\n\tVector origin( args->origin );\n\tVector angles(\n\t\targs->iparam1 / 100.0f + args->angles[0],\n\t\targs->iparam2 / 100.0f + args->angles[1],\n\t\targs->angles[2]\n\t\t);\n\tVector velocity( args->velocity );\n\tVector forward, right, up;\n\n\tAngleVectors( angles, forward, right, up );\n\n\tif ( EV_IsLocal( idx ) )\n\t{\n\t\t++g_iShotsFired;\n\t\tEV_MuzzleFlash();\n\t\tgEngfuncs.pEventAPI->EV_WeaponAnimation( Com_RandomLong(SG550_SHOOT, SG550_SHOOT2), 2 );\n\t\tif( !gHUD.cl_righthand->value )\n\t\t{\n\t\t\tEV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, right, up, 20.0, -8.0, -10.0, 0);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tEV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, right, up, 17.0, -8.0, 10.0, 0);\n\t\t}\n\t}\n\telse\n\t{\n\t\tEV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, right, up, 20.0, -12.0, 4.0, 0);\n\t}\n\n\tEV_EjectBrass(ShellOrigin, ShellVelocity, angles[ YAW ], g_iRShell, TE_BOUNCE_SHELL);\n\n\tPLAY_EVENT_SOUND( SOUNDS_NAME );\n\n\n\tEV_GetGunPosition( args, vecSrc, origin );\n\tVectorCopy( forward, vecAiming );\n\tVector vSpread;\n\t\n\tvSpread.x = args->fparam1;\n\tvSpread.y = args->fparam2;\n\tEV_HLDM_FireBullets( idx,\n\t\tforward, right,\tup,\n\t\t1, vecSrc, vecAiming,\n\t\tvSpread, 8192.0, BULLET_PLAYER_556MM,\n\t\t2 );\n}\n"
  },
  {
    "path": "cl_dll/events/event_sg552.cpp",
    "content": "/*\n*\n*    This program is free software; you can redistribute it and/or modify it\n*    under the terms of the GNU General Public License as published by the\n*    Free Software Foundation; either version 2 of the License, or (at\n*    your option) any later version.\n*\n*    This program is distributed in the hope that it will be useful, but\n*    WITHOUT ANY WARRANTY; without even the implied warranty of\n*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n*    General Public License for more details.\n*\n*    You should have received a copy of the GNU General Public License\n*    along with this program; if not, write to the Free Software Foundation,\n*    Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\n*\n*    In addition, as a special exception, the author gives permission to\n*    link the code of this program with the Half-Life Game Engine (\"HL\n*    Engine\") and Modified Game Libraries (\"MODs\") developed by Valve,\n*    L.L.C (\"Valve\").  You must obey the GNU General Public License in all\n*    respects for all of the code used other than the HL Engine and MODs\n*    from Valve.  If you modify this file, you may extend this exception\n*    to your version of the file, but you are not obligated to do so.  If\n*    you do not wish to do so, delete this exception statement from your\n*    version.\n*\n*/\n#include \"events.h\"\n#include \"wpn_shared.h\"\n\n\nstatic const char *SOUNDS_NAME[] =\n{\n\t\"weapons/sg552-1.wav\", \"weapons/sg552-2.wav\"\n};\n\nvoid EV_FireSG552( event_args_t *args )\n{\n\tVector ShellVelocity;\n\tVector ShellOrigin;\n\tVector vecSrc, vecAiming;\n\tint    idx = args->entindex;\n\tVector origin( args->origin );\n\tVector angles(\n\t\targs->iparam1 / 100.0f + args->angles[0],\n\t\targs->iparam2 / 100.0f + args->angles[1],\n\t\targs->angles[2]\n\t\t);\n\tVector velocity( args->velocity );\n\tVector forward, right, up;\n\n\tAngleVectors( angles, forward, right, up );\n\n\tif ( EV_IsLocal( idx ) )\n\t{\n\t\t++g_iShotsFired;\n\t\tEV_MuzzleFlash();\n\t\tgEngfuncs.pEventAPI->EV_WeaponAnimation(Com_RandomLong(SG552_SHOOT1, SG552_SHOOT3), 2);\n\t\tif( !gHUD.cl_righthand->value )\n\t\t{\n\t\t\tEV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, right, up, 20.0, -8.0, -10.0, 0);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tEV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, right, up, 20.0, -8.0, 10.0, 0);\n\t\t}\n\t}\n\telse\n\t{\n\t\tEV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, right, up, 20.0, -12.0, 4.0, 0);\n\t}\n\n\tEV_EjectBrass(ShellOrigin, ShellVelocity, angles[ YAW ], g_iRShell, TE_BOUNCE_SHELL);\n\tPLAY_EVENT_SOUND( SOUNDS_NAME[Com_RandomLong(0, 1)] );\n\n\tEV_GetGunPosition( args, vecSrc, origin );\n\tVectorCopy( forward, vecAiming );\n\tVector vSpread;\n\t\n\tvSpread.x = args->fparam1;\n\tvSpread.y = args->fparam2;\n\tEV_HLDM_FireBullets( idx,\n\t\tforward, right,\tup,\n\t\t1, vecSrc, vecAiming,\n\t\tvSpread, 8192.0, BULLET_PLAYER_556MM,\n\t\t2 );\n}\n"
  },
  {
    "path": "cl_dll/events/event_tmp.cpp",
    "content": "/*\n*\n*    This program is free software; you can redistribute it and/or modify it\n*    under the terms of the GNU General Public License as published by the\n*    Free Software Foundation; either version 2 of the License, or (at\n*    your option) any later version.\n*\n*    This program is distributed in the hope that it will be useful, but\n*    WITHOUT ANY WARRANTY; without even the implied warranty of\n*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n*    General Public License for more details.\n*\n*    You should have received a copy of the GNU General Public License\n*    along with this program; if not, write to the Free Software Foundation,\n*    Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\n*\n*    In addition, as a special exception, the author gives permission to\n*    link the code of this program with the Half-Life Game Engine (\"HL\n*    Engine\") and Modified Game Libraries (\"MODs\") developed by Valve,\n*    L.L.C (\"Valve\").  You must obey the GNU General Public License in all\n*    respects for all of the code used other than the HL Engine and MODs\n*    from Valve.  If you modify this file, you may extend this exception\n*    to your version of the file, but you are not obligated to do so.  If\n*    you do not wish to do so, delete this exception statement from your\n*    version.\n*\n*/\n#include \"events.h\"\n#include \"wpn_shared.h\"\n\n\nstatic const char *SOUNDS_NAME[] =\n{\n\t\"weapons/tmp-1.wav\", \"weapons/tmp-2.wav\"\n};\n\nvoid EV_FireTMP(event_args_s *args)\n{\n\tVector ShellVelocity;\n\tVector ShellOrigin;\n\tVector vecSrc, vecAiming;\n\tint    idx = args->entindex;\n\tVector origin( args->origin );\n\tVector angles(\n\t\targs->iparam1 / 100.0f + args->angles[0],\n\t\targs->iparam2 / 100.0f + args->angles[1],\n\t\targs->angles[2]\n\t\t);\n\tVector velocity( args->velocity );\n\tVector forward, right, up;\n\n\tAngleVectors( angles, forward, right, up );\n\n\tif ( EV_IsLocal( idx ) )\n\t{\n\t\t++g_iShotsFired;\n\t\tEV_MuzzleFlash();\n\t\tgEngfuncs.pEventAPI->EV_WeaponAnimation(Com_RandomLong(TMP_SHOOT1, TMP_SHOOT3), 2);\n\t\tif( !gHUD.cl_righthand->value )\n\t\t{\n\t\t\tEV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, right, up, 32.0, -6.0, -11.0, 0);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tEV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, right, up, 32.0, -6.0, 11.0, 0);\n\t\t}\n\t}\n\telse\n\t{\n\t\tEV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, right, up, 20.0, -12.0, 4.0, 0);\n\t}\n\n\tEV_EjectBrass(ShellOrigin, ShellVelocity, angles[ YAW ], g_iPShell, TE_BOUNCE_SHELL);\n\tPLAY_EVENT_SOUND( SOUNDS_NAME[Com_RandomLong( 0, 1 )] );\n\tEV_GetGunPosition( args, vecSrc, origin );\n\tVectorCopy( forward, vecAiming );\n\tVector vSpread;\n\t\n\tvSpread.x = args->fparam1;\n\tvSpread.y = args->fparam2;\n\tEV_HLDM_FireBullets( idx,\n\t\tforward, right,\tup,\n\t\t1, vecSrc, vecAiming,\n\t\tvSpread, 8192.0, BULLET_PLAYER_9MM,\n\t\t2 );\n}\n"
  },
  {
    "path": "cl_dll/events/event_ump45.cpp",
    "content": "/*\n*\n*    This program is free software; you can redistribute it and/or modify it\n*    under the terms of the GNU General Public License as published by the\n*    Free Software Foundation; either version 2 of the License, or (at\n*    your option) any later version.\n*\n*    This program is distributed in the hope that it will be useful, but\n*    WITHOUT ANY WARRANTY; without even the implied warranty of\n*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n*    General Public License for more details.\n*\n*    You should have received a copy of the GNU General Public License\n*    along with this program; if not, write to the Free Software Foundation,\n*    Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\n*\n*    In addition, as a special exception, the author gives permission to\n*    link the code of this program with the Half-Life Game Engine (\"HL\n*    Engine\") and Modified Game Libraries (\"MODs\") developed by Valve,\n*    L.L.C (\"Valve\").  You must obey the GNU General Public License in all\n*    respects for all of the code used other than the HL Engine and MODs\n*    from Valve.  If you modify this file, you may extend this exception\n*    to your version of the file, but you are not obligated to do so.  If\n*    you do not wish to do so, delete this exception statement from your\n*    version.\n*\n*/\n#include \"events.h\"\n#include \"wpn_shared.h\"\n\n\nstatic const char *SOUNDS_NAME = \"weapons/ump45-1.wav\";\n\nvoid EV_FireUMP45(event_args_s *args)\n{\n\tVector ShellVelocity;\n\tVector ShellOrigin;\n\tVector vecSrc, vecAiming;\n\tint    idx = args->entindex;\n\tVector origin( args->origin );\n\tVector angles(\n\t\targs->iparam1 / 100.0f + args->angles[0],\n\t\targs->iparam2 / 100.0f + args->angles[1],\n\t\targs->angles[2]\n\t\t);\n\tVector velocity( args->velocity );\n\tVector forward, right, up;\n\n\tAngleVectors( angles, forward, right, up );\n\n\tif ( EV_IsLocal( idx ) )\n\t{\n\t\t++g_iShotsFired;\n\t\tEV_MuzzleFlash();\n\t\tgEngfuncs.pEventAPI->EV_WeaponAnimation(Com_RandomLong(UMP45_SHOOT1, UMP45_SHOOT3), 2);\n\t\tif( !gHUD.cl_righthand->value )\n\t\t{\n\t\t\tEV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, right, up, 34.0, -10.0, -11.0, 0);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tEV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, right, up, 34.0, -10.0, 11.0, 0);\n\t\t}\n\t}\n\telse\n\t{\n\t\tEV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, right, up, 20.0, -12.0, 4.0, 0);\n\t}\n\n\tEV_EjectBrass(ShellOrigin, ShellVelocity, angles[ YAW ], g_iPShell, TE_BOUNCE_SHELL);\n\tPLAY_EVENT_SOUND( SOUNDS_NAME );\n\tEV_GetGunPosition( args, vecSrc, origin );\n\tVectorCopy( forward, vecAiming );\n\tVector vSpread;\n\t\n\tvSpread.x = args->fparam1;\n\tvSpread.y = args->fparam2;\n\tEV_HLDM_FireBullets( idx,\n\t\tforward, right,\tup,\n\t\t1, vecSrc, vecAiming,\n\t\tvSpread, 8192.0, BULLET_PLAYER_45ACP,\n\t\t2 );\n}\n"
  },
  {
    "path": "cl_dll/events/event_usp.cpp",
    "content": "/*\n*\n*    This program is free software; you can redistribute it and/or modify it\n*    under the terms of the GNU General Public License as published by the\n*    Free Software Foundation; either version 2 of the License, or (at\n*    your option) any later version.\n*\n*    This program is distributed in the hope that it will be useful, but\n*    WITHOUT ANY WARRANTY; without even the implied warranty of\n*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n*    General Public License for more details.\n*\n*    You should have received a copy of the GNU General Public License\n*    along with this program; if not, write to the Free Software Foundation,\n*    Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\n*\n*    In addition, as a special exception, the author gives permission to\n*    link the code of this program with the Half-Life Game Engine (\"HL\n*    Engine\") and Modified Game Libraries (\"MODs\") developed by Valve,\n*    L.L.C (\"Valve\").  You must obey the GNU General Public License in all\n*    respects for all of the code used other than the HL Engine and MODs\n*    from Valve.  If you modify this file, you may extend this exception\n*    to your version of the file, but you are not obligated to do so.  If\n*    you do not wish to do so, delete this exception statement from your\n*    version.\n*\n*/\n#include \"events.h\"\n#include \"wpn_shared.h\"\n\nstatic const char *SOUNDS_NAME[] =\n{\n\t\"weapons/usp1.wav\",\n\t\"weapons/usp2.wav\",\n\t\"weapons/usp_unsil-1.wav\",\n};\nvoid EV_FireUSP( event_args_t *args )\n{\n\tVector ShellVelocity;\n\tVector ShellOrigin;\n\tVector vecSrc, vecAiming;\n\n\tbool silencer_on = !args->bparam2;\n\tbool empty\t\t = args->bparam1;\n\tint    idx = args->entindex;\n\tVector origin( args->origin );\n\tVector angles(\n\t\targs->iparam1 / 100.0f + args->angles[0],\n\t\targs->iparam2 / 100.0f + args->angles[1],\n\t\targs->angles[2]\n\t\t);\n\tVector velocity( args->velocity );\n\tVector forward, right, up;\n\n\tAngleVectors( angles, forward, right, up );\n\n\tif ( EV_IsLocal( idx ) )\n\t{\n\t\t++g_iShotsFired;\n\t\tint seq;\n\t\tif( g_bHoldingShield )\n\t\t{\n\t\t\tif( !empty )\n\t\t\t\tseq = Com_RandomLong(USP_SHIELD_SHOOT1, USP_SHIELD_SHOOT2);\n\t\t\telse seq = USP_SHIELD_SHOOT_EMPTY;\n\t\t}\n\t\telse if ( silencer_on )\n\t\t{\n\t\t\tif( !empty )\n\t\t\t\tseq = Com_RandomLong(USP_UNSIL_SHOOT1, USP_UNSIL_SHOOT3);\n\t\t\telse seq = USP_UNSIL_SHOOT_EMPTY;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tEV_MuzzleFlash();\n\t\t\tif( !empty )\n\t\t\t\tseq = Com_RandomLong(USP_SHOOT1, USP_SHOOT3);\n\t\t\telse seq = USP_SHOOT_EMPTY;\n\t\t}\n\n\t\tgEngfuncs.pEventAPI->EV_WeaponAnimation(seq, 2);\n\n\n\t\tif( !gHUD.cl_righthand->value )\n\t\t{\n\t\t\tEV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, right, up, 36.0, -14.0, -14.0, 0);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tEV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, right, up, 36.0, -14.0, 14.0, 0);\n\t\t}\n\t}\n\telse\n\t{\n\t\tEV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, right, up, 20.0, -12.0, 4.0, 0);\n\t}\n\n\n\tEV_EjectBrass(ShellOrigin, ShellVelocity, angles[ YAW ], g_iPShell, TE_BOUNCE_SHELL);\n\n\tPLAY_EVENT_SOUND( silencer_on? SOUNDS_NAME[2] : SOUNDS_NAME[Com_RandomLong(0, 1)] );\n\n\tEV_GetGunPosition( args, vecSrc, origin );\n\tVectorCopy( forward, vecAiming );\n\tVector vSpread;\n\t\n\tvSpread.x = args->fparam1;\n\tvSpread.y = args->fparam2;\n\tEV_HLDM_FireBullets( idx,\n\t\tforward, right,\tup,\n\t\t1, vecSrc, vecAiming,\n\t\tvSpread, 8192.0, BULLET_PLAYER_45ACP,\n\t\t2 );\n}\n"
  },
  {
    "path": "cl_dll/events/event_vehicle.cpp",
    "content": "/*\n*\n*    This program is free software; you can redistribute it and/or modify it\n*    under the terms of the GNU General Public License as published by the\n*    Free Software Foundation; either version 2 of the License, or (at\n*    your option) any later version.\n*\n*    This program is distributed in the hope that it will be useful, but\n*    WITHOUT ANY WARRANTY; without even the implied warranty of\n*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n*    General Public License for more details.\n*\n*    You should have received a copy of the GNU General Public License\n*    along with this program; if not, write to the Free Software Foundation,\n*    Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\n*\n*    In addition, as a special exception, the author gives permission to\n*    link the code of this program with the Half-Life Game Engine (\"HL\n*    Engine\") and Modified Game Libraries (\"MODs\") developed by Valve,\n*    L.L.C (\"Valve\").  You must obey the GNU General Public License in all\n*    respects for all of the code used other than the HL Engine and MODs\n*    from Valve.  If you modify this file, you may extend this exception\n*    to your version of the file, but you are not obligated to do so.  If\n*    you do not wish to do so, delete this exception statement from your\n*    version.\n*\n*/\n#include \"events.h\"\n\n#include <string.h>\n\nstatic const char *SOUNDS_NAME[] =\n{\n\t\"plats/vehicle1.wav\",\n\t\"plats/vehicle2.wav\",\n\t\"plats/vehicle3.wav\",\n\t\"plats/vehicle4.wav\",\n\t\"plats/vehicle6.wav\",\n\t\"plats/vehicle7.wav\"\n};\n\nstatic const char *SOUNDS_NAME_TRAIN[] =\n{\n\t\"plats/ttrain1.wav\",\n\t\"plats/ttrain2.wav\",\n\t\"plats/ttrain3.wav\",\n\t\"plats/ttrain4.wav\",\n\t\"plats/ttrain6.wav\",\n\t\"plats/ttrain7.wav\"\n};\n\n\nvoid EV_Vehicle(event_args_s *args)\n{\n\tVector origin(args->origin);\n\tint idx = args->entindex;\n\tunsigned short us_params = (unsigned short)args->iparam1;\n\tint stop\t  = args->bparam1;\n\tfloat m_flVolume\t= (float)(us_params & 0x003f)/40.0;\n\tint noise\t\t= (int)(((us_params) >> 12 ) & 0x0007);\n\tint pitch\t\t= (int)( 10.0 * (float)( ( us_params >> 6 ) & 0x003f ) );\n\n\n\tif( noise < 0 || noise > 5 )\n\t\treturn;\n\n\tif ( stop )\n\t{\n\t\tgEngfuncs.pEventAPI->EV_StopSound( idx, CHAN_STATIC, SOUNDS_NAME[noise] );\n\t}\n\telse\n\t{\n\t\tgEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_STATIC, SOUNDS_NAME[noise], m_flVolume, ATTN_NORM, 0, pitch );\n\t}\n}\n\n\nvoid EV_TrainPitchAdjust( event_args_t *args )\n{\n\tVector origin(args->origin);\n\tint idx = args->entindex;\n\tunsigned short us_params = (unsigned short)args->iparam1;\n\tint stop\t  = args->bparam1;\n\tfloat m_flVolume\t= (float)(us_params & 0x003f)/40.0;\n\tint noise\t\t= (int)(((us_params) >> 12 ) & 0x0007);\n\tint pitch\t\t= (int)( 10.0 * (float)( ( us_params >> 6 ) & 0x003f ) );\n\n\tif( noise < 0 || noise > 5 )\n\t\treturn;\n\n\tif ( stop )\n\t{\n\t\tgEngfuncs.pEventAPI->EV_StopSound( idx, CHAN_STATIC, SOUNDS_NAME_TRAIN[noise] );\n\t}\n\telse\n\t{\n\t\tgEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_STATIC, SOUNDS_NAME_TRAIN[noise], m_flVolume, ATTN_NORM, 0, pitch );\n\t}\n}\n"
  },
  {
    "path": "cl_dll/events/event_xm1014.cpp",
    "content": "/*\n*\n*    This program is free software; you can redistribute it and/or modify it\n*    under the terms of the GNU General Public License as published by the\n*    Free Software Foundation; either version 2 of the License, or (at\n*    your option) any later version.\n*\n*    This program is distributed in the hope that it will be useful, but\n*    WITHOUT ANY WARRANTY; without even the implied warranty of\n*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n*    General Public License for more details.\n*\n*    You should have received a copy of the GNU General Public License\n*    along with this program; if not, write to the Free Software Foundation,\n*    Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\n*\n*    In addition, as a special exception, the author gives permission to\n*    link the code of this program with the Half-Life Game Engine (\"HL\n*    Engine\") and Modified Game Libraries (\"MODs\") developed by Valve,\n*    L.L.C (\"Valve\").  You must obey the GNU General Public License in all\n*    respects for all of the code used other than the HL Engine and MODs\n*    from Valve.  If you modify this file, you may extend this exception\n*    to your version of the file, but you are not obligated to do so.  If\n*    you do not wish to do so, delete this exception statement from your\n*    version.\n*\n*/\n#include \"events.h\"\n#include \"wpn_shared.h\"\n\n\nstatic const char *SOUNDS_NAME = \"weapons/xm1014-1.wav\";\n\nvoid EV_FireXM1014(event_args_s *args)\n{\n\tVector ShellVelocity;\n\tVector ShellOrigin;\n\tVector vecSrc, vecAiming;\n\tint    idx = args->entindex;\n\tVector origin( args->origin );\n\tVector angles(\n\t\targs->iparam1 / 100.0f + args->angles[0],\n\t\targs->iparam2 / 100.0f + args->angles[1],\n\t\targs->angles[2]\n\t\t);\n\tVector velocity( args->velocity );\n\tVector forward, right, up;\n\n\tAngleVectors( angles, forward, right, up );\n\n\tif ( EV_IsLocal( idx ) )\n\t{\n\t\t++g_iShotsFired;\n\t\tEV_MuzzleFlash();\n\t\tgEngfuncs.pEventAPI->EV_WeaponAnimation(Com_RandomLong(XM1014_FIRE1, XM1014_FIRE2), 2);\n\t\tif( !gHUD.cl_righthand->value )\n\t\t{\n\t\t\tEV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, right, up, 22.0, -9.0, -11.0, 0);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tEV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, right, up, 22.0, -9.0, 11.0, 0);\n\t\t}\n\t}\n\telse\n\t{\n\t\tEV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, right, up, 20.0, -12.0, 4.0, 0);\n\t}\n\n\tEV_EjectBrass(ShellOrigin, ShellVelocity, angles[ YAW ], g_iShotgunShell, TE_BOUNCE_SHELL);\n\n\tPLAY_EVENT_SOUND( SOUNDS_NAME );\n\n\tEV_GetGunPosition( args, vecSrc, origin );\n\tVectorCopy( forward, vecAiming );\n\tVector vSpread;\n\t\n\tvSpread.x = 0.0725;\n\tvSpread.y = 0.0725;\n\tEV_HLDM_FireBullets( idx,\n\t\tforward, right,\tup,\n\t\t6, vecSrc, vecAiming,\n\t\tvSpread, 8192.0, BULLET_PLAYER_BUCKSHOT,\n\t\t1 );\n}\n"
  },
  {
    "path": "cl_dll/events.cpp",
    "content": ""
  },
  {
    "path": "cl_dll/flashlight.cpp",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\t\n*\tThis product contains software technology licensed from Id \n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc. \n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n//\n// flashlight.cpp\n//\n// implementation of CHudFlashlight class\n//\n\n#include \"hud.h\"\n#include \"cl_util.h\"\n#include \"parsemsg.h\"\n\n#include <string.h>\n#include <stdio.h>\n\n#include \"draw_util.h\"\n#include \"pm_shared.h\"\n\n#define BAT_NAME \"sprites/%d_Flashlight.spr\"\n\nint CHudFlashlight::Init(void)\n{\n\tm_fFade = 0;\n\tm_fOn = 0;\n\n\tHOOK_MESSAGE(gHUD.m_Flash, Flashlight);\n\tHOOK_MESSAGE(gHUD.m_Flash, FlashBat);\n\n\tm_iFlags |= HUD_DRAW;\n\n\tgHUD.AddHudElem(this);\n\n\treturn 1;\n}\n\nvoid CHudFlashlight::Reset(void)\n{\n\tm_fFade = 0;\n\tm_fOn = 0;\n}\n\nint CHudFlashlight::VidInit(void)\n{\n\tm_hSprite1.SetSpriteByName(\"flash_empty\");\n\tm_hSprite2.SetSpriteByName(\"flash_full\");\n\tm_hBeam.SetSpriteByName(\"flash_beam\");\n\tm_iWidth = m_hSprite1.rect.Width();\n\n\treturn 1;\n}\n\nint CHudFlashlight:: MsgFunc_FlashBat(const char *pszName,  int iSize, void *pbuf )\n{\n\tBufferReader reader( pszName, pbuf, iSize );\n\tint x = reader.ReadByte();\n\tm_iBat = x;\n\tm_flBat = ((float)x)/100.0;\n\n\treturn 1;\n}\n\nint CHudFlashlight:: MsgFunc_Flashlight(const char *pszName,  int iSize, void *pbuf )\n{\n\tBufferReader reader( pszName, pbuf, iSize );\n\tm_fOn = reader.ReadByte();\n\tint x = reader.ReadByte();\n\tm_iBat = x;\n\tm_flBat = ((float)x)/100.0;\n\n\treturn 1;\n}\n\nint CHudFlashlight::Draw(float flTime)\n{\n\tif ( gHUD.m_iHideHUDDisplay & ( HIDEHUD_FLASHLIGHT | HIDEHUD_ALL ) )\n\t\treturn 1;\n\n\tint r, g, b, x, y, a;\n\twrect_t rc;\n\n\tif (!(gHUD.m_iWeaponBits & (1<<(WEAPON_SUIT)) ))\n\t\treturn 1;\n\n\tif (g_iUser1 == OBS_IN_EYE)\n\t\treturn 1;\n\n\tif (m_fOn)\n\t\ta = 225;\n\telse\n\t\ta = MIN_ALPHA;\n\n\tif (m_flBat < 0.20)\n\t\tDrawUtils::UnpackRGB(r,g,b, RGB_REDISH);\n\telse\n\t\tDrawUtils::UnpackRGB( r, g, b, gHUD.m_iDefaultHUDColor );\n\n\tDrawUtils::ScaleColors(r, g, b, a);\n\n\ty = (m_hSprite1.rect.Height())/2;\n\tx = ScreenWidth - m_iWidth - m_iWidth/2 ;\n\n\t// Draw the flashlight casing\n\tSPR_Set(m_hSprite1.spr, r, g, b );\n\tSPR_DrawAdditive( 0,  x, y, &m_hSprite1.rect);\n\n\tif ( m_fOn )\n\t{  // draw the flashlight beam\n\t\tx = ScreenWidth - m_iWidth/2;\n\n\t\tSPR_Set( m_hBeam.spr, r, g, b );\n\t\tSPR_DrawAdditive( 0, x, y, &m_hBeam.rect );\n\t}\n\n\t// draw the flashlight energy level\n\tx = ScreenWidth - m_iWidth - m_iWidth/2 ;\n\tint iOffset = m_iWidth * (1.0 - m_flBat);\n\tif (iOffset < m_iWidth)\n\t{\n\t\trc = m_hSprite2.rect;\n\t\trc.left += iOffset;\n\n\t\tSPR_Set(m_hSprite2.spr, r, g, b );\n\t\tSPR_DrawAdditive( 0, x + iOffset, y, &rc);\n\t}\n\n\n\treturn 1;\n}\n"
  },
  {
    "path": "cl_dll/geiger.cpp",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\t\n*\tThis product contains software technology licensed from Id \n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc. \n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n//\n// Geiger.cpp\n//\n// implementation of CHudAmmo class\n//\n\n#include \"hud.h\"\n#include \"cl_util.h\"\n#include <string.h>\n#include <time.h>\n#include <stdio.h>\n\n#include \"parsemsg.h\"\n\nint CHudGeiger::Init(void)\n{\n\tHOOK_MESSAGE( gHUD.m_Geiger, Geiger );\n\n\tm_iGeigerRange = 0;\n\tm_iFlags = 0;\n\n\tgHUD.AddHudElem(this);\n\n\tsrand( (unsigned)time( NULL ) );\n\n\treturn 1;\n}\n\nint CHudGeiger::VidInit(void)\n{\n\treturn 1;\n}\n\nint CHudGeiger::MsgFunc_Geiger(const char *pszName,  int iSize, void *pbuf)\n{\n\n\tBufferReader reader( pszName, pbuf, iSize );\n\n\t// update geiger data\n\tm_iGeigerRange = reader.ReadByte() << 2;\n\n\tif( m_iGeigerRange < 0 || m_iGeigerRange > 1000 )\n\t\tm_iFlags &= ~HUD_DRAW;\n\telse\n\t\tm_iFlags |= HUD_DRAW;\n\n\treturn 1;\n}\n\nint CHudGeiger::Draw (float flTime)\n{\n\tint pct, i;\n\tfloat flvol;\n\t\n\tif (m_iGeigerRange < 1000 && m_iGeigerRange > 0)\n\t{\n\t\t// peicewise linear is better than continuous formula for this\n\t\tif (m_iGeigerRange > 800)\n\t\t{\n\t\t\tpct = 0;\t\t\t//Con_Printf ( \"range > 800\\n\");\n\t\t\ti = 0;\n\t\t}\n\t\telse if (m_iGeigerRange > 600)\n\t\t{\n\t\t\tpct = 2;\n\t\t\t//flvol = 0.4;\t\t//Con_Printf ( \"range > 600\\n\");\n\t\t\ti = 2;\n\t\t}\n\t\telse if (m_iGeigerRange > 500)\n\t\t{\n\t\t\tpct = 4;\n\t\t\t//flvol = 0.5;\t\t//Con_Printf ( \"range > 500\\n\");\n\t\t\ti = 2;\n\t\t}\n\t\telse if (m_iGeigerRange > 400)\n\t\t{\n\t\t\tpct = 8;\n\t\t\t//flvol = 0.6;\t\t//Con_Printf ( \"range > 400\\n\");\n\t\t\ti = 3;\n\t\t}\n\t\telse if (m_iGeigerRange > 300)\n\t\t{\n\t\t\tpct = 8;\n\t\t\t//flvol = 0.7;\t\t//Con_Printf ( \"range > 300\\n\");\n\t\t\ti = 3;\n\t\t}\n\t\telse if (m_iGeigerRange > 200)\n\t\t{\n\t\t\tpct = 28;\n\t\t\t//flvol = 0.78;\t\t//Con_Printf ( \"range > 200\\n\");\n\t\t\ti = 3;\n\t\t}\n\t\telse if (m_iGeigerRange > 150)\n\t\t{\n\t\t\tpct = 40;\n\t\t\t//flvol = 0.80;\t\t//Con_Printf ( \"range > 150\\n\");\n\t\t\ti = 3;\n\t\t}\n\t\telse if (m_iGeigerRange > 100)\n\t\t{\n\t\t\tpct = 60;\n\t\t\t//flvol = 0.85;\t\t//Con_Printf ( \"range > 100\\n\");\n\t\t\ti = 3;\n\t\t}\n\t\telse if (m_iGeigerRange > 75)\n\t\t{\n\t\t\tpct = 80;\n\t\t\t//flvol = 0.9;\t\t//Con_Printf ( \"range > 75\\n\");\n\t\t\t//gflGeigerDelay = cl.time + GEIGERDELAY * 0.75;\n\t\t\ti = 3;\n\t\t}\n\t\telse if (m_iGeigerRange > 50)\n\t\t{\n\t\t\tpct = 90;\n\t\t\t//flvol = 0.95;\t\t//Con_Printf ( \"range > 50\\n\");\n\t\t\ti = 2;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tpct = 95;\n\t\t\t//flvol = 1.0;\t\t//Con_Printf ( \"range < 50\\n\");\n\t\t\ti = 2;\n\t\t}\n\n\t\tflvol = Com_RandomFloat(0.25, 25);\n\n\t\tif( pct && (rand() & 127) < pct )\n\t\t{\n\t\t\t//S_StartDynamicSound (-1, 0, rgsfx[rand() % i], r_origin, flvol, 1.0, 0, 100);\t\n\t\t\tchar sz[256];\n\t\t\t\n\t\t\tint j = rand() & 1;\n\t\t\tif( i > 2 )\n\t\t\t\tj += rand() & 1;\n\n\t\t\tsprintf( sz, \"player/geiger%d.wav\", j + 1 );\n\t\t\tPlaySound( sz, flvol );\n\t\t\t\n\t\t}\n\t}\n\n\treturn 1;\n}\n"
  },
  {
    "path": "cl_dll/health.cpp",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\t\n*\tThis product contains software technology licensed from Id \n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc. \n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n//\n// Health.cpp\n//\n// implementation of CHudHealth class\n//\n\n#include \"stdio.h\"\n#include \"stdlib.h\"\n#include \"math.h\"\n\n#include \"hud.h\"\n#include \"cl_util.h\"\n#include \"parsemsg.h\"\n#include <string.h>\n#include \"eventscripts.h\"\n\n#include \"draw_util.h\"\n\n#include \"ev_hldm.h\"\n#include \"com_weapons.h\"\n\n#define PAIN_NAME \"sprites/%d_pain.spr\"\n#define DAMAGE_NAME \"sprites/%d_dmg.spr\"\n#define EPSILON 0.4f\n\nint giDmgHeight, giDmgWidth;\n\nint giDmgFlags[NUM_DMG_TYPES] = \n{\n\tDMG_POISON,\n\tDMG_ACID,\n\tDMG_FREEZE|DMG_SLOWFREEZE,\n\tDMG_DROWN,\n\tDMG_BURN|DMG_SLOWBURN,\n\tDMG_NERVEGAS,\n\tDMG_RADIATION,\n\tDMG_SHOCK,\n\tDMG_CALTROP,\n\tDMG_TRANQ,\n\tDMG_CONCUSS,\n\tDMG_HALLUC\n};\n\nenum\n{\n\tATK_FRONT = 0,\n\tATK_RIGHT,\n\tATK_REAR,\n\tATK_LEFT\n};\n\nint CHudHealth::Init(void)\n{\n\tHOOK_MESSAGE(gHUD.m_Health, Health);\n\tHOOK_MESSAGE(gHUD.m_Health, Damage);\n\tHOOK_MESSAGE(gHUD.m_Health, ScoreAttrib);\n\tHOOK_MESSAGE(gHUD.m_Health, ClCorpse);\n\tHOOK_MESSAGE( gHUD.m_Health, HealthInfo );\n\tHOOK_MESSAGE( gHUD.m_Health, Account );\n\n\tm_iHealth = 100;\n\tm_fFade = 0;\n\tm_iFlags = 0;\n\tm_bitsDamage = 0;\n\tgiDmgHeight = 0;\n\tgiDmgWidth = 0;\n\n\tfor( int i = 0; i < 4; i++ )\n\t\tm_fAttack[i] = 0;\n\n\tmemset(m_dmg, 0, sizeof(DAMAGE_IMAGE) * NUM_DMG_TYPES);\n\n\tCVAR_CREATE(\"cl_corpsestay\", \"600\", FCVAR_ARCHIVE);\n\tgHUD.AddHudElem(this);\n\treturn 1;\n}\n\nvoid CHudHealth::Reset( void )\n{\n\t// make sure the pain compass is cleared when the player respawns\n\tfor( int i = 0; i < 4; i++ )\n\t\tm_fAttack[i] = 0;\n\n\n\t// force all the flashing damage icons to expire\n\tm_bitsDamage = 0;\n\tfor ( int i = 0; i < NUM_DMG_TYPES; i++ )\n\t{\n\t\tm_dmg[i].fExpire = 0;\n\t}\n}\n\nint CHudHealth::VidInit(void)\n{\n\tm_hSprite = LoadSprite(PAIN_NAME);\n\n\tm_vAttackPos[ATK_FRONT].x = ScreenWidth  / 2.0 - SPR_Width ( m_hSprite, 0 ) / 2.0;\n\tm_vAttackPos[ATK_FRONT].y = ScreenHeight / 2.0 - SPR_Height( m_hSprite, 0 ) * 3;\n\n\tm_vAttackPos[ATK_RIGHT].x = ScreenWidth  / 2.0 + SPR_Width ( m_hSprite, 1 ) * 2;\n\tm_vAttackPos[ATK_RIGHT].y = ScreenHeight / 2.0 - SPR_Height( m_hSprite, 1 ) / 2.0;\n\n\tm_vAttackPos[ATK_REAR ].x = ScreenWidth  / 2.0 - SPR_Width ( m_hSprite, 2 ) / 2.0;\n\tm_vAttackPos[ATK_REAR ].y = ScreenHeight / 2.0 + SPR_Height( m_hSprite, 2 ) * 2;\n\n\tm_vAttackPos[ATK_LEFT ].x = ScreenWidth  / 2.0 - SPR_Width ( m_hSprite, 3 ) * 3;\n\tm_vAttackPos[ATK_LEFT ].y = ScreenHeight / 2.0 - SPR_Height( m_hSprite, 3 ) / 2.0;\n\n\n\tm_HUD_dmg_bio = gHUD.GetSpriteIndex( \"dmg_bio\" ) + 1;\n\tm_HUD_cross = gHUD.GetSpriteIndex( \"cross\" );\n\n\tgiDmgHeight = gHUD.GetSpriteRect(m_HUD_dmg_bio).Width();\n\tgiDmgWidth = gHUD.GetSpriteRect(m_HUD_dmg_bio).Height();\n\n\treturn 1;\n}\n\nint CHudHealth:: MsgFunc_Health(const char *pszName,  int iSize, void *pbuf )\n{\n\t// TODO: update local health data\n\tBufferReader reader( pszName, pbuf, iSize );\n\tint x = reader.ReadByte();\n\n\tm_iFlags |= HUD_DRAW;\n\n\t// Only update the fade if we've changed health\n\tif (x != m_iHealth)\n\t{\n\t\tm_fFade = FADE_TIME;\n\t\tm_iHealth = x;\n\t}\n\n\treturn 1;\n}\n\n\nint CHudHealth:: MsgFunc_Damage(const char *pszName,  int iSize, void *pbuf )\n{\n\tBufferReader reader( pszName, pbuf, iSize );\n\n\tint armor = reader.ReadByte();\t// armor\n\tint damageTaken = reader.ReadByte();\t// health\n\tlong bitsDamage = reader.ReadLong(); // damage bits\n\n\tvec3_t vecFrom;\n\n\tfor ( int i = 0 ; i < 3 ; i++)\n\t\tvecFrom[i] = reader.ReadCoord();\n\n\tUpdateTiles(gHUD.m_flTime, bitsDamage);\n\n\t// Actually took damage?\n\tif ( damageTaken > 0 || armor > 0 )\n\t{\n\t\tCalcDamageDirection(vecFrom);\n\t\tif( g_iXash )\n\t\t{\n\t\t\tfloat time = damageTaken * 4.0f + armor * 2.0f;\n\n\t\t\tif( time > 200.0f ) time = 200.0f;\n\t\t\tgMobileAPI.pfnVibrate( time, 0 );\n\t\t}\n\t}\n\treturn 1;\n}\n\nint CHudHealth:: MsgFunc_ScoreAttrib(const char *pszName,  int iSize, void *pbuf )\n{\n\tBufferReader reader( pszName, pbuf, iSize );\n\n\tint index = reader.ReadByte();\n\tunsigned char flags = reader.ReadByte();\n\tg_PlayerExtraInfo[index].dead   = !!(flags & PLAYER_DEAD);\n\tg_PlayerExtraInfo[index].has_c4 = !!(flags & PLAYER_HAS_C4);\n\tg_PlayerExtraInfo[index].vip    = !!(flags & PLAYER_VIP);\n\tg_PlayerExtraInfo[index].has_defuse_kit = !!(flags & PLAYER_HAS_DEFUSER);\n\treturn 1;\n}\n// Returns back a color from the\n// Green <-> Yellow <-> Red ramp\nvoid CHudHealth::GetPainColor( int &r, int &g, int &b, int &a )\n{\n#if 0\n\tint iHealth = m_iHealth;\n\n\tif (iHealth > 25)\n\t\tiHealth -= 25;\n\telse if ( iHealth < 0 )\n\t\tiHealth = 0;\n\tg = iHealth * 255 / 100;\n\tr = 255 - g;\n\tb = 0;\n#else\n\tif( m_iHealth <= 15 )\n\t{\n\t\ta = 255; // If health is getting low, make it bright red\n\t}\n\telse\n\t{\n\t\t// Has health changed? Flash the health #\n\t\tif (m_fFade)\n\t\t{\n\t\t\tm_fFade -= (gHUD.m_flTimeDelta * 20);\n\n\t\t\tif (m_fFade <= 0)\n\t\t\t{\n\t\t\t\tm_fFade = 0;\n\t\t\t\ta = MIN_ALPHA;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t// Fade the health number back to dim\n\t\t\t\ta = MIN_ALPHA +  (m_fFade/FADE_TIME) * 128;\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\ta = MIN_ALPHA;\n\t\t}\n\t}\n\n\tif (m_iHealth > 25)\n\t{\n\t\tDrawUtils::UnpackRGB( r, g, b, gHUD.m_iDefaultHUDColor );\n\t}\n\telse\n\t{\n\t\tr = 250;\n\t\tg = 0;\n\t\tb = 0;\n\t}\n#endif \n}\n\n\nint CHudHealth::Draw(float flTime)\n{\n\tif( !(gHUD.m_iHideHUDDisplay & HIDEHUD_HEALTH ) && !gEngfuncs.IsSpectateOnly() )\n\t{\n\t\tDrawHealthBar( flTime );\n\t\tDrawDamage( flTime );\n\t\tDrawPain( flTime );\n\t}\n\n\treturn 1;\n}\n\nvoid CHudHealth::DrawHealthBar( float flTime )\n{\n\tint r, g, b;\n\tint a = 0, x, y;\n\tint HealthWidth;\n\n\tGetPainColor( r, g, b, a );\n\tDrawUtils::ScaleColors(r, g, b, a );\n\n\t// Only draw health if we have the suit.\n\tif (gHUD.m_iWeaponBits & (1<<(WEAPON_SUIT)))\n\t{\n\t\tHealthWidth = gHUD.GetSpriteRect(gHUD.m_HUD_number_0).Width();\n\t\tint CrossWidth = gHUD.GetSpriteRect(m_HUD_cross).Width();\n\n\t\ty = ScreenHeight - gHUD.m_iFontHeight - gHUD.m_iFontHeight / 2;\n\t\tx = CrossWidth /2;\n\n\t\tSPR_Set(gHUD.GetSprite(m_HUD_cross), r, g, b);\n\t\tSPR_DrawAdditive(0, x, y, &gHUD.GetSpriteRect(m_HUD_cross));\n\n\t\tx = CrossWidth + HealthWidth / 2;\n\n\t\tx = DrawUtils::DrawHudNumber(x, y, DHN_3DIGITS | DHN_DRAWZERO, m_iHealth, r, g, b);\n\t}\n}\n\nvoid CHudHealth::CalcDamageDirection( Vector vecFrom )\n{\n\tVector\tforward, right, up;\n\tfloat\tside, front, flDistToTarget;\n\n\tif( vecFrom.IsNull() )\n\t{\n\t\tfor( int i = 0; i < 4; i++ )\n\t\t\tm_fAttack[i] = 0;\n\t\treturn;\n\t}\n\n\tvecFrom = vecFrom - gHUD.m_vecOrigin;\n\tflDistToTarget = vecFrom.Length();\n\tvecFrom = vecFrom.Normalize();\n\tAngleVectors (gHUD.m_vecAngles, forward, right, up);\n\n\tfront = DotProduct (vecFrom, right);\n\tside = DotProduct (vecFrom, forward);\n\n\tif (flDistToTarget <= 50)\n\t{\n\t\tfor( int i = 0; i < 4; i++ )\n\t\t\tm_fAttack[i] = 1;\n\t}\n\telse\n\t{\n\t\tif (side > EPSILON)\n\t\t\tm_fAttack[0] = max(m_fAttack[0], side);\n\t\tif (side < -EPSILON)\n\t\t\tm_fAttack[1] = max(m_fAttack[1], 0 - side );\n\t\tif (front > EPSILON)\n\t\t\tm_fAttack[2] = max(m_fAttack[2], front);\n\t\tif (front < -EPSILON)\n\t\t\tm_fAttack[3] = max(m_fAttack[3], 0 - front );\n\t}\n}\n\nvoid CHudHealth::DrawPain(float flTime)\n{\n\tif (m_fAttack[0] == 0 &&\n\t\tm_fAttack[1] == 0 &&\n\t\tm_fAttack[2] == 0 &&\n\t\tm_fAttack[3] == 0)\n\t\treturn;\n\n\tfloat a, fFade = gHUD.m_flTimeDelta * 2;\n\n\tfor( int i = 0; i < 4; i++ )\n\t{\n\t\tif( m_fAttack[i] > EPSILON )\n\t\t{\n\t\t\t/*GetPainColor(r, g, b);\n\t\t\tshade = a * max( m_fAttack[i], 0.5 );\n\t\t\tDrawUtils::ScaleColors(r, g, b, shade);*/\n\n\t\t\ta = max( m_fAttack[i], 0.5 );\n\n\t\t\tSPR_Set( m_hSprite, 255 * a, 255 * a, 255 * a);\n\t\t\tSPR_DrawAdditive( i, m_vAttackPos[i].x, m_vAttackPos[i].y, NULL );\n\t\t\tm_fAttack[i] = max( 0, m_fAttack[i] - fFade );\n\t\t}\n\t\telse\n\t\t\tm_fAttack[i] = 0;\n\t}\n}\n\nvoid CHudHealth::DrawDamage(float flTime)\n{\n\tint r, g, b, a;\n\n\tif (!m_bitsDamage)\n\t\treturn;\n\n\tDrawUtils::UnpackRGB( r, g, b, gHUD.m_iDefaultHUDColor );\n\n\ta = (int)( fabs(sin(flTime*2)) * 256.0);\n\n\tDrawUtils::ScaleColors(r, g, b, a);\n\tint i;\n\t// Draw all the items\n\tfor (i = 0; i < NUM_DMG_TYPES; i++)\n\t{\n\t\tif (m_bitsDamage & giDmgFlags[i])\n\t\t{\n\t\t\tDAMAGE_IMAGE *pdmg = &m_dmg[i];\n\t\t\tSPR_Set(gHUD.GetSprite(m_HUD_dmg_bio + i), r, g, b );\n\t\t\tSPR_DrawAdditive(0, pdmg->x, pdmg->y, &gHUD.GetSpriteRect(m_HUD_dmg_bio + i));\n\t\t}\n\t}\n\n\n\t// check for bits that should be expired\n\tfor ( i = 0; i < NUM_DMG_TYPES; i++ )\n\t{\n\t\tDAMAGE_IMAGE *pdmg = &m_dmg[i];\n\n\t\tif ( m_bitsDamage & giDmgFlags[i] )\n\t\t{\n\t\t\tpdmg->fExpire = min( flTime + DMG_IMAGE_LIFE, pdmg->fExpire );\n\n\t\t\tif ( pdmg->fExpire <= flTime\t\t// when the time has expired\n\t\t\t\t && a < 40 )\t\t\t\t\t\t// and the flash is at the low point of the cycle\n\t\t\t{\n\t\t\t\tpdmg->fExpire = 0;\n\n\t\t\t\tint y = pdmg->y;\n\t\t\t\tpdmg->x = pdmg->y = 0;\n\n\t\t\t\t// move everyone above down\n\t\t\t\tfor (int j = 0; j < NUM_DMG_TYPES; j++)\n\t\t\t\t{\n\t\t\t\t\tpdmg = &m_dmg[j];\n\t\t\t\t\tif ((pdmg->y) && (pdmg->y < y))\n\t\t\t\t\t\tpdmg->y += giDmgHeight;\n\n\t\t\t\t}\n\n\t\t\t\tm_bitsDamage &= ~giDmgFlags[i];  // clear the bits\n\t\t\t}\n\t\t}\n\t}\n}\n\n\nvoid CHudHealth::UpdateTiles(float flTime, long bitsDamage)\n{\t\n\tDAMAGE_IMAGE *pdmg;\n\n\t// Which types are new?\n\tlong bitsOn = ~m_bitsDamage & bitsDamage;\n\t\n\tfor (int i = 0; i < NUM_DMG_TYPES; i++)\n\t{\n\t\tpdmg = &m_dmg[i];\n\n\t\t// Is this one already on?\n\t\tif (m_bitsDamage & giDmgFlags[i])\n\t\t{\n\t\t\tpdmg->fExpire = flTime + DMG_IMAGE_LIFE; // extend the duration\n\t\t\tif (!pdmg->fBaseline)\n\t\t\t\tpdmg->fBaseline = flTime;\n\t\t}\n\n\t\t// Are we just turning it on?\n\t\tif (bitsOn & giDmgFlags[i])\n\t\t{\n\t\t\t// put this one at the bottom\n\t\t\tpdmg->x = giDmgWidth/8;\n\t\t\tpdmg->y = ScreenHeight - giDmgHeight * 2;\n\t\t\tpdmg->fExpire=flTime + DMG_IMAGE_LIFE;\n\t\t\t\n\t\t\t// move everyone else up\n\t\t\tfor (int j = 0; j < NUM_DMG_TYPES; j++)\n\t\t\t{\n\t\t\t\tif (j == i)\n\t\t\t\t\tcontinue;\n\n\t\t\t\tpdmg = &m_dmg[j];\n\t\t\t\tif (pdmg->y)\n\t\t\t\t\tpdmg->y -= giDmgHeight;\n\n\t\t\t}\n\t\t\tpdmg = &m_dmg[i];\n\t\t}\n\t}\n\n\t// damage bits are only turned on here;  they are turned off when the draw time has expired (in DrawDamage())\n\tm_bitsDamage |= bitsDamage;\n}\n\n\nint CHudHealth :: MsgFunc_ClCorpse(const char *pszName, int iSize, void *pbuf)\n{\n\tBufferReader reader(pbuf, iSize);\n\tchar *pModel, szModel[64];\n\tVector origin, angles;\n\tfloat delay;\n\tint seq, classID, teamID, playerID;\n\n\tpModel\t\t= reader.ReadString();\n\torigin.x\t= reader.ReadLong() / 128.0f;\n\torigin.y\t= reader.ReadLong() / 128.0f;\n\torigin.z\t= reader.ReadLong() / 128.0f;\n\tangles\t\t= reader.ReadCoordVector();\n\tdelay\t\t= gEngfuncs.GetClientTime() + (reader.ReadLong() / 100.0f);\n\tseq\t\t\t= reader.ReadByte();\n\tclassID\t\t= reader.ReadByte();\n\tteamID\t\t= reader.ReadByte();\n\tplayerID\t= reader.ReadByte();\n\n\tif( !gHUD.cl_minmodels->value )\n\t{\n\t\tif( !strstr(pModel, \"models/\") )\n\t\t\tsnprintf( szModel, sizeof(szModel), \"models/player/%s/%s.mdl\", pModel, pModel );\n\t\telse\n\t\t\tstrncpy( szModel, pModel, sizeof( szModel ));\n\t}\n\telse\n\t{\n\t\tint modelidx;\n\t\tif( teamID == TEAM_TERRORIST ) // terrorists\n\t\t{\n\t\t\tmodelidx = gHUD.cl_min_t->value;\n\t\t\tif( !BIsValidTModelIndex(modelidx) )\n\t\t\t\tmodelidx = PLAYERMODEL_LEET;\n\t\t}\n\t\telse if( teamID == TEAM_CT ) // ct\n\t\t{\n\t\t\tif( g_PlayerExtraInfo[playerID].vip )\n\t\t\t\tmodelidx = PLAYERMODEL_VIP;\n\t\t\telse if( !BIsValidCTModelIndex( gHUD.cl_min_ct->value ))\n\t\t\t\tmodelidx = PLAYERMODEL_GIGN;\n\t\t\telse modelidx = gHUD.cl_min_ct->value;\n\t\t}\n\t\telse modelidx = PLAYERMODEL_PLAYER;\n\n\t\tstrncpy( szModel, sPlayerModelFiles[modelidx], sizeof( szModel ) );\n\t}\n\tCreateCorpse( origin, angles, szModel, delay, seq, classID );\n\treturn 0;\n}\n\n/*\n============\nCL_IsDead\n\nReturns 1 if health is <= 0\n============\n*/\nbool CL_IsDead()\n{\n\tif( gHUD.m_Health.m_iHealth <= 0 )\n\t\treturn true;\n\treturn false;\n}\n\nint CHudHealth::MsgFunc_HealthInfo( const char *pszName, int iSize, void *buf )\n{\n\tBufferReader reader( pszName, buf, iSize );\n\n\tint idx = reader.ReadByte();\n\tint health = reader.ReadLong();\n\n\tif ( idx < MAX_PLAYERS )\n\t\tg_PlayerExtraInfo[idx].sb_health = health;\n\n\treturn 1;\n}\n\nint CHudHealth::MsgFunc_Account( const char *pszName, int iSize, void *buf )\n{\n\tBufferReader reader( pszName, buf, iSize );\n\n\tint idx = reader.ReadByte();\n\tint account = reader.ReadLong();\n\n\tif ( idx < MAX_PLAYERS )\n\t\tg_PlayerExtraInfo[idx].sb_account = account;\n\n\treturn 1;\n}\n"
  },
  {
    "path": "cl_dll/health.h",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\t\n*\tThis product contains software technology licensed from Id \n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc. \n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n#pragma once\n#define DMG_IMAGE_LIFE\t\t2\t// seconds that image is up\n\n#define DMG_IMAGE_POISON\t0\n#define DMG_IMAGE_ACID\t\t1\n#define DMG_IMAGE_COLD\t\t2\n#define DMG_IMAGE_DROWN\t\t3\n#define DMG_IMAGE_BURN\t\t4\n#define DMG_IMAGE_NERVE\t\t5\n#define DMG_IMAGE_RAD\t\t6\n#define DMG_IMAGE_SHOCK\t\t7\n//tf defines\n#define DMG_IMAGE_CALTROP\t8\n#define DMG_IMAGE_TRANQ\t\t9\n#define DMG_IMAGE_CONCUSS\t10\n#define DMG_IMAGE_HALLUC\t11\n#define NUM_DMG_TYPES\t\t12\n// instant damage\n\n#ifndef DMG_CRUSH\n#define DMG_GENERIC\t\t\t0\t\t\t// generic damage was done\n#define DMG_CRUSH\t\t\t(1 << 0)\t// crushed by falling or moving object\n#define DMG_BULLET\t\t\t(1 << 1)\t// shot\n#define DMG_SLASH\t\t\t(1 << 2)\t// cut, clawed, stabbed\n#define DMG_BURN\t\t\t(1 << 3)\t// heat burned\n#define DMG_FREEZE\t\t\t(1 << 4)\t// frozen\n#define DMG_FALL\t\t\t(1 << 5)\t// fell too far\n#define DMG_BLAST\t\t\t(1 << 6)\t// explosive blast damage\n#define DMG_CLUB\t\t\t(1 << 7)\t// crowbar, punch, headbutt\n#define DMG_SHOCK\t\t\t(1 << 8)\t// electric shock\n#define DMG_SONIC\t\t\t(1 << 9)\t// sound pulse shockwave\n#define DMG_ENERGYBEAM\t\t(1 << 10)\t// laser or other high energy beam \n#define DMG_NEVERGIB\t\t(1 << 12)\t// with this bit OR'd in, no damage type will be able to gib victims upon death\n#define DMG_ALWAYSGIB\t\t(1 << 13)\t// with this bit OR'd in, any damage type can be made to gib victims upon death.\n\n\n// time-based damage\n//mask off TF-specific stuff too\n#define DMG_TIMEBASED\t\t(~(0xff003fff))\t// mask for time-based damage\n\n\n#define DMG_DROWN\t\t\t(1 << 14)\t// Drowning\n#define DMG_FIRSTTIMEBASED  DMG_DROWN\n\n#define DMG_PARALYZE\t\t(1 << 15)\t// slows affected creature down\n#define DMG_NERVEGAS\t\t(1 << 16)\t// nerve toxins, very bad\n#define DMG_POISON\t\t\t(1 << 17)\t// blood poisioning\n#define DMG_RADIATION\t\t(1 << 18)\t// radiation exposure\n#define DMG_DROWNRECOVER\t(1 << 19)\t// drowning recovery\n#define DMG_ACID\t\t\t(1 << 20)\t// toxic chemicals or acid burns\n#define DMG_SLOWBURN\t\t(1 << 21)\t// in an oven\n#define DMG_SLOWFREEZE\t\t(1 << 22)\t// in a subzero freezer\n#define DMG_MORTAR\t\t\t(1 << 23)\t// Hit by air raid (done to distinguish grenade from mortar)\n\n#endif\n//TF ADDITIONS\n#define DMG_IGNITE\t\t\t(1 << 24)\t// Players hit by this begin to burn\n#define DMG_RADIUS_MAX\t\t(1 << 25)\t// Radius damage with this flag doesn't decrease over distance\n#define DMG_RADIUS_QUAKE\t(1 << 26)\t// Radius damage is done like Quake. 1/2 damage at 1/2 radius.\n#define DMG_IGNOREARMOR\t\t(1 << 27)\t// Damage ignores target's armor\n#define DMG_AIMED\t\t\t(1 << 28)   // Does Hit location damage\n#define DMG_WALLPIERCING\t(1 << 29)\t// Blast Damages ents through walls\n\n#define DMG_CALTROP\t\t\t\t(1<<30)\n#define DMG_HALLUC\t\t\t\t(1<<31)\n\n// TF Healing Additions for TakeHealth\n#define DMG_IGNORE_MAXHEALTH\tDMG_IGNITE\n// TF Redefines since we never use the originals\n#define DMG_NAIL\t\t\t\tDMG_SLASH\n#define DMG_NOT_SELF\t\t\tDMG_FREEZE\n\n\n#define DMG_TRANQ\t\t\t\tDMG_MORTAR\n#define DMG_CONCUSS\t\t\t\tDMG_SONIC\n\n\nstruct DAMAGE_IMAGE\n{\n\tfloat fExpire;\n\tfloat fBaseline;\n\tint\tx, y;\n};\n\t\n//\n//-----------------------------------------------------\n//\nclass CHudHealth: public CHudBase\n{\npublic:\n\tvirtual int Init( void );\n\tvirtual int VidInit( void );\n\tvirtual int Draw(float fTime);\n\tvirtual void Reset( void );\n\n\tint MsgFunc_Health(const char *pszName,  int iSize, void *pbuf);\n\tint MsgFunc_Damage(const char *pszName,  int iSize, void *pbuf);\n\tint MsgFunc_ScoreAttrib(const char *pszName,  int iSize, void *pbuf);\n\tint MsgFunc_ClCorpse(const char *pszName,  int iSize, void *pbuf);\n\tint MsgFunc_HealthInfo( const char *pszName, int iSize, void *pbuf );\n\tint MsgFunc_Account( const char *pszName, int iSize, void *pbuf );\n\n\tint m_iHealth;\n\tint m_HUD_dmg_bio;\n\tint m_HUD_cross;\n\t//float m_fAttackFront, m_fAttackRear, m_fAttackLeft, m_fAttackRight;\n\tfloat m_fAttack[4];\n\tvoid GetPainColor(int &r, int &g, int &b , int &a);\n\tfloat m_fFade;\n\n\tint m_iPlayerLastPointedAt;\nprivate:\n\tvoid DrawPain( float fTime );\n\tvoid DrawDamage( float fTime );\n\tvoid DrawHealthBar( float flTime );\n\tvoid CalcDamageDirection( Vector vecFrom );\n\tvoid UpdateTiles( float fTime, long bits );\n\n\tHSPRITE m_hSprite;\n\tHSPRITE m_hDamage;\n\tVector2D m_vAttackPos[4];\n\tDAMAGE_IMAGE m_dmg[NUM_DMG_TYPES];\n\tfloat m_flTimeFlash;\n\tint\tm_bitsDamage;\n\tcvar_t *cl_radartype;\n};\n"
  },
  {
    "path": "cl_dll/hl/hl_baseentity.cpp",
    "content": ""
  },
  {
    "path": "cl_dll/hl/hl_events.cpp",
    "content": ""
  },
  {
    "path": "cl_dll/hl/hl_objects.cpp",
    "content": ""
  },
  {
    "path": "cl_dll/hl/hl_weapons.cpp",
    "content": ""
  },
  {
    "path": "cl_dll/hud/MOTD.cpp",
    "content": "/***\n*\n*\tCopyright (c) 1999, Valve LLC. All rights reserved.\n*\t\n*\tThis product contains software technology licensed from Id \n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc. \n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n//\n// MOTD.cpp\n//\n// for displaying a server-sent message of the day\n//\n\n#include \"hud.h\"\n#include \"cl_util.h\"\n#include \"parsemsg.h\"\n#include \"kbutton.h\"\n#include \"triangleapi.h\"\n#include <string.h>\n#include <stdio.h>\n#include \"draw_util.h\"\n#include \"build.h\"\n\n#if XASH_WIN32 == 1 || XASH_PSVITA == 1\n#define strcasestr strstr\n#endif\n\nint CHudMOTD :: Init( void )\n{\n\tgHUD.AddHudElem( this );\n\n\tHOOK_MESSAGE( gHUD.m_MOTD, MOTD );\n\n\tcl_hide_motd = CVAR_CREATE(\"cl_hide_motd\", \"0\", FCVAR_ARCHIVE); // hide motd\n\tReset();\n\n\treturn 1;\n}\n\nint CHudMOTD :: VidInit( void )\n{\n\t// Load sprites here\n\treturn 1;\n}\n\nvoid CHudMOTD :: Reset( void )\n{\n\tm_iFlags &= ~HUD_DRAW;  // start out inactive\n\tm_szMOTD.Clear();\n\tm_iLines = 0;\n\tm_bShow = false;\n\tignoreThisMotd = false;\n}\n\n#define LINE_HEIGHT  13\n#define ROW_GAP  13\n#define ROW_RANGE_MIN 30\n#define ROW_RANGE_MAX ( ScreenHeight - 100 )\nint CHudMOTD :: Draw( float fTime )\n{\n\tgHUD.m_iNoConsolePrint &= ~( 1 << 1 );\n\tif( !m_bShow )\n\t\treturn 1;\n\n\tif( cl_hide_motd->value )\n\t{\n\t\tReset();\n\t\treturn 1;\n\t}\n\n\tgHUD.m_iNoConsolePrint |= 1 << 1;\n\t// find the top of where the MOTD should be drawn,  so the whole thing is centered in the screen\n\tint ypos = (ScreenHeight - LINE_HEIGHT * m_iLines)/2; // shift it up slightly\n\tchar *ch = m_szMOTD.Access();\n\tint xpos = (ScreenWidth - gHUD.GetCharWidth( 'M' ) * m_iMaxLength) / 2;\n\tif( xpos < 30 ) xpos = 30;\n\tint xmax = xpos + gHUD.GetCharWidth( 'M' ) * m_iMaxLength;\n\tint height = LINE_HEIGHT * m_iLines;\n\tint ypos_r=ypos;\n\tif( height > ROW_RANGE_MAX )\n\t{\n\t\typos = ROW_RANGE_MIN + 7 + scroll;\n\t\tif( ypos  > ROW_RANGE_MIN + 4 )\n\t\t\tscroll-= (ypos - ( ROW_RANGE_MIN + 4))/3.0;\n\t\tif( ypos + height < ROW_RANGE_MAX )\n\t\t\tscroll+= (ROW_RANGE_MAX - (ypos + height))/ 3.0;\n\t\typos_r = ROW_RANGE_MIN;\n\t\theight = ROW_RANGE_MAX;\n\t}\n\tif( xmax > ScreenWidth - 30 ) xmax = ScreenWidth - 30;\n\tchar *next_line;\n\tDrawUtils::DrawRectangle(xpos-5, ypos_r - 5, xmax - xpos+10, height + 10);\n\twhile ( *ch )\n\t{\n\t\tint line_length = 0;  // count the length of the current line\n\t\tfor ( next_line = ch; *next_line != '\\n' && *next_line != 0; next_line++ )\n\t\t\tline_length += gHUD.GetCharWidth( (unsigned char)*next_line );\n\t\tchar *top = next_line;\n\t\tif ( *top == '\\n' )\n\t\t\t*top = 0;\n\t\telse\n\t\t\ttop = NULL;\n\n\t\t// find where to start drawing the line\n\t\tif( (ypos > ROW_RANGE_MIN) && (ypos + LINE_HEIGHT <= ypos_r + height) )\n\t\t\tDrawUtils::DrawHudString( xpos, ypos, xmax, ch, 255, 180, 0 );\n\n\t\typos += LINE_HEIGHT;\n\n\t\tif ( top )  // restore \n\t\t\t*top = '\\n';\n\t\tch = next_line;\n\t\tif ( *ch == '\\n' )\n\t\t\tch++;\n\n\t\tif ( ypos > (ScreenHeight - 20) )\n\t\t\tbreak;  // don't let it draw too low\n\t}\n\t\n\treturn 1;\n}\n\nint CHudMOTD :: MsgFunc_MOTD( const char *pszName, int iSize, void *pbuf )\n{\n\tif( cl_hide_motd->value )\n\t\treturn 1;\n\n\tif ( m_iFlags & HUD_DRAW )\n\t{\n\t\tReset(); // clear the current MOTD in prep for this one\n\t}\n\n\tif( ignoreThisMotd )\n\t\treturn 1;\n\n\tBufferReader reader( pszName, pbuf, iSize );\n\n\tint is_finished = reader.ReadByte();\n\tm_szMOTD.Append( reader.ReadString() );\n\n\t// we still don't support html tags in motd :(\n\tif( strcasestr( m_szMOTD.String(), \"<!DOCTYPE HTML>\" ) )\n\t{\n\t\tReset();\n\t\tignoreThisMotd = true;\n\t}\n\n\tif ( is_finished )\n\t{\n\t\tint length = 0;\n\t\t\n\t\tm_iMaxLength = 0;\n\t\tm_iFlags |= HUD_DRAW;\n\n\n\t\tfor ( const char *sz = m_szMOTD.String(); *sz != 0; sz++ )  // count the number of lines in the MOTD\n\t\t{\n\t\t\tif ( *sz == '\\n' )\n\t\t\t{\n\t\t\t\tm_iLines++;\n\t\t\t\tif( length > m_iMaxLength )\n\t\t\t\t{\n\t\t\t\t\tm_iMaxLength = length;\n\t\t\t\t\tlength = 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\tlength++;\n\t\t}\n\t\t\n\t\tm_iLines++;\n\t\tif( length > m_iMaxLength )\n\t\t{\n\t\t\tm_iMaxLength = length;\n\t\t\tlength = 0;\n\t\t}\n\t\tm_bShow = true;\n\t}\n\n\treturn 1;\n}\n"
  },
  {
    "path": "cl_dll/hud/money.cpp",
    "content": "/*\nmoney.cpp -- Money HUD Widget\nCopyright (C) 2015-2016 a1batross\n\nThis program is free software; you can redistribute it and/or modify it\nunder the terms of the GNU General Public License as published by the\nFree Software Foundation; either version 2 of the License, or (at\nyour option) any later version.\n\nThis program is distributed in the hope that it will be useful, but\nWITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\nGeneral Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with this program; if not, write to the Free Software Foundation,\nInc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\n\nIn addition, as a special exception, the author gives permission to\nlink the code of this program with the Half-Life Game Engine (\"HL\nEngine\") and Modified Game Libraries (\"MODs\") developed by Valve,\nL.L.C (\"Valve\").  You must obey the GNU General Public License in all\nrespects for all of the code used other than the HL Engine and MODs\nfrom Valve.  If you modify this file, you may extend this exception\nto your version of the file, but you are not obligated to do so.  If\nyou do not wish to do so, delete this exception statement from your\nversion.\n*/\n\n\n#include \"stdio.h\"\n#include \"stdlib.h\"\n#include \"math.h\"\n\n#include \"hud.h\"\n#include \"cl_util.h\"\n#include \"parsemsg.h\"\n#include <string.h>\n#include \"vgui_parser.h\"\n#include \"draw_util.h\"\n\nint CHudMoney::Init( )\n{\n\tHOOK_MESSAGE( gHUD.m_Money, Money );\n\tHOOK_MESSAGE( gHUD.m_Money, BlinkAcct );\n\tgHUD.AddHudElem(this);\n\tm_fFade = 0;\n\tm_iFlags = 0;\n\treturn 1;\n}\n\nint CHudMoney::VidInit()\n{\n\tm_hDollar.SetSpriteByName(\"dollar\");\n\tm_hMinus.SetSpriteByName(\"minus\");\n\tm_hPlus.SetSpriteByName(\"plus\");\n\n\treturn 1;\n}\n\nint CHudMoney::Draw(float flTime)\n{\n\tif(( gHUD.m_iHideHUDDisplay & ( HIDEHUD_HEALTH ) ))\n\t\treturn 1;\n\n\tif (!(gHUD.m_iWeaponBits & (1<<(WEAPON_SUIT))))\n\t\treturn 1;\n\n\tint r, g, b, alphaBalance;\n\tm_fFade -= gHUD.m_flTimeDelta;\n\tif( m_fFade < 0)\n\t{\n\t\tm_fFade = 0.0f;\n\t\tm_iDelta = 0;\n\t}\n\tfloat interpolate = ( 5 - m_fFade ) / 5;\n\n\tint iDollarWidth = m_hDollar.rect.Width();\n\n\tint x = ScreenWidth - iDollarWidth * 7;\n\tint y = MONEY_YPOS;\n\n\tif( m_iBlinkAmt )\n\t{\n\t\tm_fBlinkTime += gHUD.m_flTimeDelta;\n\t\tDrawUtils::UnpackRGB( r, g, b, m_fBlinkTime > 0.5f? RGB_REDISH : gHUD.m_iDefaultHUDColor );\n\n\t\tif( m_fBlinkTime > 1.0f )\n\t\t{\n\t\t\tm_fBlinkTime = 0.0f;\n\t\t\t--m_iBlinkAmt;\n\t\t}\n\t}\n\telse\n\t{\n\t\tif( m_iDelta != 0 )\n\t\t{\n\t\t\tint iDeltaR, iDeltaG, iDeltaB;\n\t\t\tint iDollarHeight = m_hDollar.rect.Height();\n\t\t\tint iDeltaAlpha = 255 - interpolate * (255);\n\n\t\t\tDrawUtils::UnpackRGB  (iDeltaR, iDeltaG, iDeltaB, m_iDelta < 0 ? RGB_REDISH : RGB_GREENISH);\n\t\t\tDrawUtils::ScaleColors(iDeltaR, iDeltaG, iDeltaB, iDeltaAlpha);\n\n\t\t\tif( m_iDelta > 0 )\n\t\t\t{\n\t\t\t\tr = interpolate * ((gHUD.m_iDefaultHUDColor & 0xFF0000) >> 16);\n\t\t\t\tg = (RGB_GREENISH & 0xFF00) >> 8;\n\t\t\t\tb = (RGB_GREENISH & 0xFF);\n\n\t\t\t\t// draw delta\n\t\t\t\tSPR_Set(m_hPlus.spr, iDeltaR, iDeltaG, iDeltaB );\n\t\t\t\tSPR_DrawAdditive(0, x, y - iDollarHeight * 1.5, &m_hPlus.rect );\n\t\t\t}\n\t\t\telse if( m_iDelta < 0)\n\t\t\t{\n\t\t\t\tr = (RGB_REDISH & 0xFF0000) >> 16;\n\t\t\t\tg = ((RGB_REDISH & 0xFF00) >> 8) + interpolate * (((gHUD.m_iDefaultHUDColor & 0xFF00) >> 8) - ((RGB_REDISH & 0xFF00) >> 8));\n\t\t\t\tb = (RGB_REDISH & 0xFF) - interpolate * (RGB_REDISH & 0xFF);\n\n\t\t\t\tSPR_Set(m_hMinus.spr, iDeltaR, iDeltaG, iDeltaB );\n\t\t\t\tSPR_DrawAdditive(0, x, y - iDollarHeight * 1.5, &m_hMinus.rect );\n\t\t\t}\n\n\t\t\tDrawUtils::DrawHudNumber2( x + iDollarWidth, y - iDollarHeight * 1.5 , false, 5,\n\t\t\t\t\t\t\t\t\t   m_iDelta < 0 ? -m_iDelta : m_iDelta,\n\t\t\t\t\t\t\t\t\t   iDeltaR, iDeltaG, iDeltaB);\n\t\t\tFillRGBA(x + iDollarWidth / 4, y - iDollarHeight * 1.5 + gHUD.m_iFontHeight / 4, 2, 2, iDeltaR, iDeltaG, iDeltaB, iDeltaAlpha );\n\t\t}\n\t\telse DrawUtils::UnpackRGB( r, g, b, gHUD.m_iDefaultHUDColor );\n\t}\n\n\talphaBalance = 255 - interpolate * (255 - MIN_ALPHA);\n\n\n\tDrawUtils::ScaleColors( r, g, b, alphaBalance );\n\n\tSPR_Set(m_hDollar.spr, r, g, b);\n\tSPR_DrawAdditive(0, x, y, &m_hDollar.rect);\n\n\tDrawUtils::DrawHudNumber2( x + iDollarWidth, y, false, 5, m_iMoneyCount, r, g, b );\n\tFillRGBA(x + iDollarWidth / 4, y + gHUD.m_iFontHeight / 4, 2, 2, r, g, b, alphaBalance );\n\treturn 1;\n}\n\nint CHudMoney::MsgFunc_Money(const char *pszName, int iSize, void *pbuf)\n{\n\tBufferReader buf( pszName, pbuf, iSize );\n\tint iOldCount = m_iMoneyCount;\n\tm_iMoneyCount = buf.ReadLong();\n\tgEngfuncs.Cvar_SetValue( gHUD.cscl_currentmoney->name, m_iMoneyCount );\n\tm_iDelta = m_iMoneyCount - iOldCount;\n\tm_fFade = 5.0f; //fade for 5 seconds\n\tm_iFlags |= HUD_DRAW;\n\treturn 1;\n}\n\nint CHudMoney::MsgFunc_BlinkAcct(const char *pszName, int iSize, void *pbuf)\n{\n\tBufferReader buf( pszName, pbuf, iSize );\n\n\tm_iBlinkAmt = buf.ReadByte();\n\tm_fBlinkTime = 0;\n\treturn 1;\n}\n"
  },
  {
    "path": "cl_dll/hud/nvg.cpp",
    "content": "/*\nnvg.cpp - Night Vision Googles\nCopyright (C) 2015-2016 a1batross\n\nThis program is free software; you can redistribute it and/or modify it\nunder the terms of the GNU General Public License as published by the\nFree Software Foundation; either version 2 of the License, or (at\nyour option) any later version.\n\nThis program is distributed in the hope that it will be useful, but\nWITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\nGeneral Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with this program; if not, write to the Free Software Foundation,\nInc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\n\nIn addition, as a special exception, the author gives permission to\nlink the code of this program with the Half-Life Game Engine (\"HL\nEngine\") and Modified Game Libraries (\"MODs\") developed by Valve,\nL.L.C (\"Valve\").  You must obey the GNU General Public License in all\nrespects for all of the code used other than the HL Engine and MODs\nfrom Valve.  If you modify this file, you may extend this exception\nto your version of the file, but you are not obligated to do so.  If\nyou do not wish to do so, delete this exception statement from your\nversion.\n\n*/\n\n#include \"hud.h\"\n#include \"cl_util.h\"\n#include \"parsemsg.h\"\n#include \"r_efx.h\"\n#include \"dlight.h\"\n\nint CHudNVG::Init()\n{\n\tHOOK_MESSAGE( gHUD.m_NVG, NVGToggle);\n\tHOOK_COMMAND( gHUD.m_NVG,\"+nvgadjust\", NVGAdjustUp);\n\tHOOK_COMMAND( gHUD.m_NVG, \"-nvgadjust\", NVGAdjustDown);\n\tHOOK_COMMAND( gHUD.m_NVG, \"nvgadjustup\", NVGAdjustUp);\n\tHOOK_COMMAND( gHUD.m_NVG,\"nvgadjustdown\", NVGAdjustDown);\n\n\tcl_fancy_nvg = CVAR_CREATE( \"cl_fancy_nvg\", \"0\", FCVAR_ARCHIVE );\n\n\tgHUD.AddHudElem(this);\n\tm_iFlags = 0;\n\tm_iAlpha = 110; // 220 is max, 30 is min\n\n   return 0;\n}\n\n\nint CHudNVG::Draw(float flTime)\n{\n\tif( gEngfuncs.IsSpectateOnly() )\n\t{\n\t\treturn 1;\n\t}\n\n\tgEngfuncs.pfnFillRGBABlend(0, 0, ScreenWidth, ScreenHeight, 50, 225, 50, m_iAlpha);\n\n\t// draw a dynamic light on player's origin\n\tif( cl_fancy_nvg->value )\n\t{\n\t\t// recreate new dlight every frame\n\n\t\tdlight_t *dl = gEngfuncs.pEfxAPI->CL_AllocDlight ( 0 );\n\t\tdl->origin = gHUD.m_vecOrigin;\n\t\tdl->radius = Com_RandomLong( 750, 800 );\n\t\tdl->die = flTime + 0.1f;\n\t\tdl->color.r = 50;\n\t\tdl->color.g = 255;\n\t\tdl->color.b = 50;\n\t}\n\telse\n\t{\n\t\t// recreate if died\n\t\tif( !m_pLight || m_pLight->die < flTime )\n\t\t{\n\t\t\tm_pLight = gEngfuncs.pEfxAPI->CL_AllocDlight( 0 );\n\n\t\t\t// I hope no one is crazy so much to keep NVG for 9999 seconds\n\t\t\tm_pLight->die = flTime + 9999.0f;\n\t\t\tm_pLight->color.r = 50;\n\t\t\tm_pLight->color.g = 255;\n\t\t\tm_pLight->color.b = 50;\n\t\t}\n\n\t\t// just update origin\n\t\tif( m_pLight )\n\t\t{\n\t\t\tm_pLight->origin = gHUD.m_vecOrigin;\n\t\t\tm_pLight->radius = Com_RandomLong( 750, 800 );\n\t\t}\n\t}\n\treturn 1;\n}\n\nvoid CHudNVG::Reset( void )\n{\n\tm_iFlags = 0;\n\n\tif( m_pLight )\n\t{\n\t\tm_pLight->die = 0; // engine will remove this immediately\n\n\t\tm_pLight = NULL; // it's safe to set it 0 now\n\t}\n}\n\nint CHudNVG::MsgFunc_NVGToggle(const char *pszName, int iSize, void *pbuf)\n{\n\tBufferReader reader( pszName, pbuf, iSize );\n\n\tm_iFlags = reader.ReadByte() ? HUD_DRAW : 0;\n\n\tif( m_pLight )\n\t{\n\t\tm_pLight->die = 0; // engine will remove this immediately\n\n\t\tm_pLight = NULL; // it's safe to set it 0 now\n\t}\n\treturn 1;\n}\n\nvoid CHudNVG::UserCmd_NVGAdjustUp()\n{\n\tm_iAlpha = m_iAlpha + 20;\n\tm_iAlpha = min( 220, m_iAlpha );\n}\n\nvoid CHudNVG::UserCmd_NVGAdjustDown()\n{\n\tm_iAlpha = m_iAlpha - 20;\n\tm_iAlpha = max( 30, m_iAlpha );\n}\n"
  },
  {
    "path": "cl_dll/hud/radar.cpp",
    "content": "/*\nradar.cpp - Radar\nCopyright (C) 2016 a1batross\n\nThis program is free software; you can redistribute it and/or modify it\nunder the terms of the GNU General Public License as published by the\nFree Software Foundation; either version 2 of the License, or (at\nyour option) any later version.\n\nThis program is distributed in the hope that it will be useful, but\nWITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\nGeneral Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with this program; if not, write to the Free Software Foundation,\nInc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\n\nIn addition, as a special exception, the author gives permission to\nlink the code of this program with the Half-Life Game Engine (\"HL\nEngine\") and Modified Game Libraries (\"MODs\") developed by Valve,\nL.L.C (\"Valve\").  You must obey the GNU General Public License in all\nrespects for all of the code used other than the HL Engine and MODs\nfrom Valve.  If you modify this file, you may extend this exception\nto your version of the file, but you are not obligated to do so.  If\nyou do not wish to do so, delete this exception statement from your\nversion.\n*/\n\n#include \"hud.h\"\n#include \"cl_util.h\"\n#include \"parsemsg.h\"\n#include \"draw_util.h\"\n#include \"triangleapi.h\"\n#include \"vgui_parser.h\"\n#ifndef M_PI\n#define M_PI\t\t3.14159265358979323846\t// matches value in gcc v2 math.h\n#endif\n\nstatic byte\tr_RadarCross[8][8] =\n{\n{1,1,0,0,0,0,1,1},\n{1,1,1,0,0,1,1,1},\n{0,1,1,1,1,1,1,0},\n{0,0,1,1,1,1,0,0},\n{0,0,1,1,1,1,0,0},\n{0,1,1,1,1,1,1,0},\n{1,1,1,0,0,1,1,1},\n{1,1,0,0,0,0,1,1}\n};\n\nstatic byte\tr_RadarT[8][8] =\n{\n{1,1,1,1,1,1,1,1},\n{1,1,1,1,1,1,1,1},\n{0,0,0,1,1,0,0,0},\n{0,0,0,1,1,0,0,0},\n{0,0,0,1,1,0,0,0},\n{0,0,0,1,1,0,0,0},\n{0,0,0,1,1,0,0,0},\n{0,0,0,1,1,0,0,0}\n};\n\nstatic byte\tr_RadarFlippedT[8][8] =\n{\n{0,0,0,1,1,0,0,0},\n{0,0,0,1,1,0,0,0},\n{0,0,0,1,1,0,0,0},\n{0,0,0,1,1,0,0,0},\n{0,0,0,1,1,0,0,0},\n{0,0,0,1,1,0,0,0},\n{1,1,1,1,1,1,1,1},\n{1,1,1,1,1,1,1,1}\n};\n\n#define BLOCK_SIZE_MAX 1024\n\nstatic byte\tdata2D[BLOCK_SIZE_MAX*4];\t// intermediate texbuffer\n\nint CHudRadar::Init()\n{\n\tHOOK_MESSAGE( gHUD.m_Radar, Radar );\n\tHOOK_COMMAND( gHUD.m_Radar, \"drawradar\", ShowRadar );\n\tHOOK_COMMAND( gHUD.m_Radar, \"hideradar\", HideRadar );\n\tHOOK_MESSAGE( gHUD.m_Radar, HostageK );\n\tHOOK_MESSAGE( gHUD.m_Radar, HostagePos );\n\tHOOK_MESSAGE( gHUD.m_Radar, BombDrop );\n\tHOOK_MESSAGE( gHUD.m_Radar, BombPickup );\n\tHOOK_MESSAGE( gHUD.m_Radar, Location );\n\n\tm_iFlags = HUD_DRAW;\n\n\tcl_radartype = CVAR_CREATE( \"cl_radartype\", \"0\", FCVAR_ARCHIVE );\n\n\tbTexturesInitialized = bUseRenderAPI = false;\n\n\tgHUD.AddHudElem( this );\n\treturn 1;\n}\n\nvoid CHudRadar::Reset()\n{\n\t// make radar don't draw old players after new map\n\tfor( int i = 0; i < 34; i++ )\n\t{\n\t\tg_PlayerExtraInfo[i].radarflashes = 0;\n\n\t\tif( i <= MAX_HOSTAGES ) g_HostageInfo[i].radarflashes = 0;\n\t}\n}\n\nstatic void Radar_InitBitmap( int w, int h, byte *buf )\n{\n\tfor( int x = 0; x < w; x++ )\n\t{\n\t\tfor( int y = 0; y < h; y++ )\n\t\t{\n\t\t\tdata2D[(y * 8 + x) * 4 + 0] = 255;\n\t\t\tdata2D[(y * 8 + x) * 4 + 1] = 255;\n\t\t\tdata2D[(y * 8 + x) * 4 + 2] = 255;\n\t\t\tdata2D[(y * 8 + x) * 4 + 3] = buf[y*h + x]  * 255;\n\t\t}\n\t}\n}\n\nint CHudRadar::InitBuiltinTextures( void )\n{\n\ttexFlags_t defFlags = (texFlags_t)(TF_NOMIPMAP |TF_NEAREST | TF_CLAMP | TF_HAS_ALPHA);\n\n\tif( bTexturesInitialized )\n\t\treturn 1;\n\n\tconst struct\n\t{\n\t\tconst char\t*name;\n\t\tbyte\t*buf;\n\t\tint\t\t*texnum;\n\t\tint\t\tw, h;\n\t\tvoid\t(*init)( int w, int h, byte *buf );\n\t}\n\ttextures[] =\n\t{\n\t{ \"radarT\",\t\t   (byte*)r_RadarT,        &hT,\t       8, 8, Radar_InitBitmap },\n\t{ \"radarcross\",    (byte*)r_RadarCross,    &hCross,    8, 8, Radar_InitBitmap },\n\t{ \"radarflippedT\", (byte*)r_RadarFlippedT, &hFlippedT, 8, 8, Radar_InitBitmap }\n\t};\n\tsize_t\ti, num_builtin_textures = sizeof( textures ) / sizeof( textures[0] );\n\n\tfor( i = 0; i < num_builtin_textures; i++ )\n\t{\n\t\ttextures[i].init( textures[i].w, textures[i].h, textures[i].buf );\n\t\t*textures[i].texnum = gRenderAPI.GL_CreateTexture( textures[i].name, textures[i].w, textures[i].h, data2D, defFlags );\n\t\tif( *textures[i].texnum == 0 )\n\t\t{\n\t\t\t// it's maybe safer to leave texture render uninitialized and use classic fillrgba\n\t\t\tfor( size_t j = 0; j < i; j++ )\n\t\t\t{\n\t\t\t\tgRenderAPI.GL_FreeTexture( *textures[j].texnum );\n\t\t\t}\n\t\t\treturn 0;\n\t\t}\n\t}\n\n\tbTexturesInitialized = true;\n\n\treturn 1;\n}\n\nvoid CHudRadar::Shutdown( void )\n{\n\t// GL_FreeTexture( hDot ); engine inner texture\n\tif( bTexturesInitialized )\n\t{\n\t\tgRenderAPI.GL_FreeTexture( hT );\n\t\tgRenderAPI.GL_FreeTexture( hFlippedT );\n\t\tgRenderAPI.GL_FreeTexture( hCross );\n\t}\n}\n\nvoid CHudRadar::InitHUDData( void )\n{\n\tUserCmd_ShowRadar();\n\tReset();\n}\n\nint CHudRadar::VidInit(void)\n{\n\tbUseRenderAPI = g_iXash && InitBuiltinTextures();\n\n\tm_hRadar.SetSpriteByName( \"radar\" );\n\tm_hRadarOpaque.SetSpriteByName( \"radaropaque\" );\n\tiMaxRadius = (m_hRadar.rect.Width()) / 2.0f;\n\treturn 1;\n}\n\nvoid CHudRadar::UserCmd_HideRadar()\n{\n\tm_iFlags &= ~HUD_DRAW;\n}\n\nvoid CHudRadar::UserCmd_ShowRadar()\n{\n\tm_iFlags |= HUD_DRAW;\n}\n\nint CHudRadar::MsgFunc_Radar(const char *pszName,  int iSize, void *pbuf )\n{\n\tBufferReader reader( pszName, pbuf, iSize );\n\n\tint index = reader.ReadByte();\n\tg_PlayerExtraInfo[index].origin.x = reader.ReadCoord();\n\tg_PlayerExtraInfo[index].origin.y = reader.ReadCoord();\n\tg_PlayerExtraInfo[index].origin.z = reader.ReadCoord();\n\treturn 1;\n}\n\nbool CHudRadar::FlashTime( float flTime, extra_player_info_t *pplayer )\n{\n\t// radar flashing\n\tif( pplayer->radarflashes )\n\t{\n\t\tif( flTime > pplayer->radarflashtime )\n\t\t{\n\t\t\tpplayer->nextflash = !pplayer->nextflash;\n\t\t\tpplayer->radarflashtime += pplayer->radarflashtimedelta;\n\t\t\tpplayer->radarflashes--;\n\t\t}\n\t}\n\telse\n\t{\n\t\treturn true;\n\t}\n\n\treturn pplayer->nextflash;\n}\n\nbool CHudRadar::HostageFlashTime( float flTime, hostage_info_t *pplayer )\n{\n\t// radar flashing\n\tif( pplayer->radarflashes )\n\t{\n\t\tif( flTime > pplayer->radarflashtime )\n\t\t{\n\t\t\tpplayer->nextflash = !pplayer->nextflash;\n\t\t\tpplayer->radarflashtime += pplayer->radarflashtimedelta;\n\t\t\tpplayer->radarflashes--;\n\t\t}\n\t}\n\telse\n\t{\n\t\treturn false; // non-flashing hostage must be never drawn on radar!\n\t}\n\n\treturn pplayer->nextflash;\n}\n\nvoid CHudRadar::DrawZAxis( Vector pos, int r, int g, int b, int a )\n{\n\tconst float diff = 128;\n\n\tif( pos.z > -diff && pos.z < diff )\n\t{\n\t\tDrawRadarDot( pos.x, pos.y, r, g, b, a );\n\t}\n\telse if( pos.z <= -diff )\n\t{\n\t\t// higher than player\n\t\tDrawT( pos.x, pos.y, r, g, b, a );\n\t}\n\telse\n\t{\n\t\t// lower than player\n\t\tDrawFlippedT( pos.x, pos.y, r, g, b, a );\n\t}\n}\n\nint CHudRadar::Draw(float flTime)\n{\n\tif ( (gHUD.m_iHideHUDDisplay & HIDEHUD_HEALTH) ||\n\t\t gEngfuncs.IsSpectateOnly() ||\n\t\t !(gHUD.m_iWeaponBits & (1<<(WEAPON_SUIT))) ||\n\t\t gHUD.m_fPlayerDead )\n\t\treturn 1;\n\n\tint iTeamNumber = g_PlayerExtraInfo[ gHUD.m_Scoreboard.m_iPlayerNum ].teamnumber;\n\tint r, g, b;\n\n\tif( cl_radartype->value )\n\t{\n\t\tSPR_Set(m_hRadarOpaque.spr, 200, 200, 200);\n\t\tSPR_DrawHoles(0, 0, 0, &m_hRadarOpaque.rect);\n\t}\n\telse\n\t{\n\t\tSPR_Set( m_hRadar.spr, 25, 75, 25 );\n\t\tSPR_DrawAdditive( 0, 0, 0, &m_hRadarOpaque.rect );\n\t}\n\n\tif( bUseRenderAPI )\n\t{\n\t\tgEngfuncs.pTriAPI->RenderMode( kRenderTransAdd );\n\t\tgEngfuncs.pTriAPI->CullFace( TRI_NONE );\n\t\tgEngfuncs.pTriAPI->Brightness( 1 );\n\t}\n\n\tfor(int i = 0; i < 33; i++)\n\t{\n\t\t// skip local player and dead players\n\t\tif( i == gHUD.m_Scoreboard.m_iPlayerNum || g_PlayerExtraInfo[i].dead )\n\t\t\tcontinue;\n\n\t\t// skip non-teammates\n\t\tif( g_PlayerExtraInfo[i].teamnumber != iTeamNumber )\n\t\t\tcontinue;\n\n\t\t// decide should player draw at this time. For flashing.\n\t\t// Always true for non-flashing players\n\t\tif( !FlashTime( flTime, &g_PlayerExtraInfo[i]) )\n\t\t\tcontinue;\n\n\t\t// player with C4 or VIP must be red\n\t\tif( g_PlayerExtraInfo[i].has_c4 || g_PlayerExtraInfo[i].vip )\n\t\t{\n\t\t\tDrawUtils::UnpackRGB( r, g, b, RGB_REDISH );\n\t\t}\n\t\telse\n\t\t{\n\t\t\t// white\n\t\t\tDrawUtils::UnpackRGB( r, g, b, RGB_WHITE );\n\t\t}\n\n\t\t// calc radar position\n\t\tVector pos = WorldToRadar(gHUD.m_vecOrigin, g_PlayerExtraInfo[i].origin, gHUD.m_vecAngles);\n\n\t\tDrawZAxis( pos, r, g, b, 255 );\n\t}\n\n\t// Terrorist specific code( C4 Bomb )\n\tif( g_PlayerExtraInfo[gHUD.m_Scoreboard.m_iPlayerNum].teamnumber == TEAM_TERRORIST )\n\t{\n\t\tif ( !g_PlayerExtraInfo[33].dead &&\n\t\t\t g_PlayerExtraInfo[33].radarflashes &&\n\t\t\t FlashTime( flTime, &g_PlayerExtraInfo[33] ))\n\t\t{\n\t\t\tVector pos = WorldToRadar(gHUD.m_vecOrigin, g_PlayerExtraInfo[33].origin, gHUD.m_vecAngles);\n\t\t\tif( g_PlayerExtraInfo[33].playerclass ) // bomb planted\n\t\t\t{\n\t\t\t\tDrawCross( pos.x, pos.y, 255, 0, 0, 255 );\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tDrawZAxis( pos, 255, 0, 0, 255 );\n\t\t\t}\n\t\t}\n\t}\n\t// Counter-Terrorist specific code( hostages )\n\telse if( g_PlayerExtraInfo[gHUD.m_Scoreboard.m_iPlayerNum].teamnumber == TEAM_CT )\n\t{\n\t\t// draw hostages for CT\n\t\tfor( int i = 0; i < MAX_HOSTAGES; i++ )\n\t\t{\n\t\t\tif( !HostageFlashTime( flTime, g_HostageInfo + i ) )\n\t\t\t{\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tVector pos = WorldToRadar(gHUD.m_vecOrigin, g_HostageInfo[i].origin, gHUD.m_vecAngles);\n\t\t\tif( g_HostageInfo[i].dead )\n\t\t\t{\n\t\t\t\tDrawZAxis( pos, 255, 0, 0, 255 );\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tDrawZAxis( pos, 4, 25, 110, 255 );\n\t\t\t}\n\t\t}\n\t}\n\n\tDrawPlayerLocation( ( m_hRadarOpaque.rect.Height() ) + 10 );\n\n\treturn 0;\n}\n\nvoid CHudRadar::DrawPlayerLocation( int y )\n{\n\tconst char *szLocation = g_PlayerExtraInfo[gHUD.m_Scoreboard.m_iPlayerNum].location;\n\tif( szLocation[0] )\n\t{\n\t\t// Localize the location string\n\t\tconst char *szLocalizedLocation = Localize( szLocation );\n\n\t\t// don't draw unlocalized location\n\t\tif( szLocalizedLocation[0] == '#' )\n\t\t\treturn;\n\n\t\tint x = (m_hRadarOpaque.rect.Width()) / 2;\n\t\tint len = DrawUtils::ConsoleStringLen( szLocalizedLocation );\n\n\t\tx = x - len / 2;\n\t\tif( x < 0 ) x = 0;\n\n\t\tDrawUtils::SetConsoleTextColor( g_ColorGreen[0], g_ColorGreen[1], g_ColorGreen[2] );\n\t\tDrawUtils::DrawConsoleString( x, y, szLocalizedLocation );\n\t}\n}\n\ninline void CHudRadar::DrawColoredTexture( int x, int y, int size, byte r, byte g, byte b, byte a, int texHandle )\n{\n\tgRenderAPI.GL_Bind( 0, texHandle );\n\n\t// gEngfuncs.pTriAPI->Begin( TRI_QUADS );\n\n\tgEngfuncs.pTriAPI->Color4ub( r, g, b, a );\n\tDrawUtils::Draw2DQuad( (iMaxRadius + x - size * 2) * gHUD.m_flScale,\n\t\t\t\t\t\t   (iMaxRadius + y - size * 2) * gHUD.m_flScale,\n\t\t\t\t\t\t   (iMaxRadius + x + size * 2) * gHUD.m_flScale,\n\t\t\t\t\t\t   (iMaxRadius + y + size * 2) * gHUD.m_flScale);\n\t\n\t// gEngfuncs.pTriAPI->End();\n}\n\n\nvoid CHudRadar::DrawRadarDot( int x, int y, int r, int g, int b, int a )\n{\n\tconst int size = 1;\n\tif( bUseRenderAPI )\n\t{\n\t\tDrawColoredTexture( x, y, size, r, g, b, a, gHUD.m_WhiteTex );\n\t}\n\telse\n\t{\n\t\tFillRGBA(iMaxRadius + x - size*2, iMaxRadius + y - size*2, size*4, size*4, r, g, b, a);\n\t}\n}\n\n\nvoid CHudRadar::DrawCross( int x, int y, int r, int g, int b, int a )\n{\n\tconst int size = 2;\n\tif( bUseRenderAPI )\n\t{\n\t\tDrawColoredTexture( x, y, size, r, g, b, a, hCross );\n\t}\n\telse\n\t{\n\t\tFillRGBA(iMaxRadius + x, iMaxRadius + y, size, size, r, g, b, a);\n\t\tFillRGBA(iMaxRadius + x - size, iMaxRadius + y - size, size, size, r, g, b, a);\n\t\tFillRGBA(iMaxRadius + x - size, iMaxRadius + y + size, size, size, r, g, b, a);\n\t\tFillRGBA(iMaxRadius + x + size, iMaxRadius + y - size, size, size, r, g, b, a);\n\t\tFillRGBA(iMaxRadius + x + size, iMaxRadius + y + size, size, size, r, g, b, a);\n\t}\n}\n\nvoid CHudRadar::DrawT( int x, int y, int r, int g, int b, int a )\n{\n\tconst int size = 2;\n\n\tif( bUseRenderAPI )\n\t{\n\t\tDrawColoredTexture( x, y, size, r, g, b, a, hT );\n\t}\n\telse\n\t{\n\t\tFillRGBA( iMaxRadius + x - size, iMaxRadius + y - size, size * 3, size, r, g, b, a);\n\t\tFillRGBA( iMaxRadius + x, iMaxRadius + y, size, size * 2, r, g, b, a);\n\t}\n}\n\nvoid CHudRadar::DrawFlippedT( int x, int y, int r, int g, int b, int a )\n{\n\tconst int size = 2;\n\tif( bUseRenderAPI )\n\t{\n\t\tDrawColoredTexture( x, y, size, r, g, b, a, hFlippedT );\n\t}\n\telse\n\t{\n\t\tFillRGBA( iMaxRadius + x, iMaxRadius + y - size, size, size*2, r, g, b, a);\n\t\tFillRGBA( iMaxRadius + x - size, iMaxRadius + y + size, size*3, size, r, g, b, a);\n\t}\n}\n\n\nVector CHudRadar::WorldToRadar(const Vector vPlayerOrigin, const Vector vObjectOrigin, const Vector vAngles  )\n{\n\tVector2D diff = vObjectOrigin.Make2D() - vPlayerOrigin.Make2D();\n\tconst float RADAR_SCALE = 32.0f;\n\n\t// Supply epsilon values to avoid divide-by-zero\n\tif( diff.x == 0 )\n\t\tdiff.x = 0.00001f;\n\tif( diff.y == 0 )\n\t\tdiff.y = 0.00001f;\n\n\tfloat flOffset = DEG2RAD( vAngles.y - RAD2DEG( atan2( diff.y, diff.x ) ) );\n\n\t// this magic 32.0f just scales position on radar\n\tfloat iRadius = min( diff.Length() / RADAR_SCALE, iMaxRadius );\n\n\t// transform origin difference to radar source\n\tVector ret( (float)(iRadius * sin(flOffset)),\n\t\t\t\t(float)(iRadius * -cos(flOffset)),\n\t\t\t\t(float)(vPlayerOrigin.z - vObjectOrigin.z) );\n\n\treturn ret;\n}\n\nint CHudRadar::MsgFunc_BombDrop(const char *pszName, int iSize, void *pbuf)\n{\n\tBufferReader reader( pszName, pbuf, iSize );\n\n\tg_PlayerExtraInfo[33].origin.x = reader.ReadCoord();\n\tg_PlayerExtraInfo[33].origin.y = reader.ReadCoord();\n\tg_PlayerExtraInfo[33].origin.z = reader.ReadCoord();\n\n\tg_PlayerExtraInfo[33].radarflashes = 99999;\n\tg_PlayerExtraInfo[33].radarflashtime = gHUD.m_flTime;\n\tg_PlayerExtraInfo[33].radarflashtimedelta = 0.5f;\n\tstrncpy(g_PlayerExtraInfo[33].teamname, \"TERRORIST\", MAX_TEAM_NAME);\n\tg_PlayerExtraInfo[33].dead = false;\n\tg_PlayerExtraInfo[33].nextflash = true;\n\n\tint Flag = reader.ReadByte();\n\tg_PlayerExtraInfo[33].playerclass = Flag;\n\n\tif( Flag ) // bomb planted\n\t{\n\t\tgHUD.m_SpectatorGui.m_bBombPlanted = 0;\n\t\tgHUD.m_Timer.m_iFlags = 0;\n\t}\n\treturn 1;\n}\n\nint CHudRadar::MsgFunc_BombPickup(const char *pszName, int iSize, void *pbuf)\n{\n\tg_PlayerExtraInfo[33].radarflashes = false;\n\tg_PlayerExtraInfo[33].dead = true;\n\n\treturn 1;\n}\n\nint CHudRadar::MsgFunc_HostagePos(const char *pszName, int iSize, void *pbuf)\n{\n\n\tBufferReader reader( pszName, pbuf, iSize );\n\tint Flag = reader.ReadByte();\n\tint idx = reader.ReadByte();\n\tif( idx <= MAX_HOSTAGES )\n\t{\n\t\tg_HostageInfo[idx].origin.x = reader.ReadCoord();\n\t\tg_HostageInfo[idx].origin.y = reader.ReadCoord();\n\t\tg_HostageInfo[idx].origin.z = reader.ReadCoord();\n\t\tg_HostageInfo[idx].dead = false;\n\n\t\tif( Flag == 1 ) // first message about this hostage, start flashing\n\t\t{\n\t\t\tg_HostageInfo[idx].radarflashes = 99999;\n\t\t\tg_HostageInfo[idx].radarflashtime = gHUD.m_flTime;\n\t\t\tg_HostageInfo[idx].radarflashtimedelta = 0.5f;\n\t\t}\n\t}\n\n\treturn 1;\n}\n\nint CHudRadar::MsgFunc_HostageK(const char *pszName, int iSize, void *pbuf)\n{\n\tBufferReader reader( pszName, pbuf, iSize );\n\tint idx = reader.ReadByte();\n\tif ( idx <= MAX_HOSTAGES )\n\t{\n\t\tg_HostageInfo[idx].dead = true;\n\t\tg_HostageInfo[idx].radarflashtime = gHUD.m_flTime;\n\t\tg_HostageInfo[idx].radarflashes = 15;\n\t\tg_HostageInfo[idx].radarflashtimedelta = 0.1f;\n\t}\n\n\treturn 1;\n}\n\nint CHudRadar::MsgFunc_Location(const char *pszName, int iSize, void *pbuf)\n{\n\tBufferReader reader( pszName, pbuf, iSize );\n\n\tint player = reader.ReadByte();\n\tif( player <= MAX_PLAYERS )\n\t{\n\t\tconst char *location = reader.ReadString();\n\n\t\tstrncpy( g_PlayerExtraInfo[player].location, location, sizeof( g_PlayerExtraInfo[player].location ) );\n\t\tg_PlayerExtraInfo[player].location[31] = 0;\n\n\t\tGetClientVoiceHud()->UpdateLocation( player, g_PlayerExtraInfo[player].location );\n\t}\n\treturn 0;\n}\n"
  },
  {
    "path": "cl_dll/hud/radio.cpp",
    "content": "/*\nradio.cpp -- Radio HUD implementation\nCopyright (C) 2015-2016 a1batross\nThis program is free software; you can redistribute it and/or modify it\nunder the terms of the GNU General Public License as published by the\nFree Software Foundation; either version 2 of the License, or (at\nyour option) any later version.\n\nThis program is distributed in the hope that it will be useful, but\nWITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\nGeneral Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with this program; if not, write to the Free Software Foundation,\nInc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\n\nIn addition, as a special exception, the author gives permission to\nlink the code of this program with the Half-Life Game Engine (\"HL\nEngine\") and Modified Game Libraries (\"MODs\") developed by Valve,\nL.L.C (\"Valve\").  You must obey the GNU General Public License in all\nrespects for all of the code used other than the HL Engine and MODs\nfrom Valve.  If you modify this file, you may extend this exception\nto your version of the file, but you are not obligated to do so.  If\nyou do not wish to do so, delete this exception statement from your\nversion.\n*/\n#include \"hud.h\"\n#include \"parsemsg.h\"\n#include \"cl_util.h\"\n#include \"r_efx.h\"\n#include \"event_api.h\"\n#include \"com_model.h\"\n#include <string.h>\n\nint CHudRadio::Init( )\n{\n\tHOOK_MESSAGE( gHUD.m_Radio, SendAudio );\n\tHOOK_MESSAGE( gHUD.m_Radio, ReloadSound );\n\tHOOK_MESSAGE( gHUD.m_Radio, BotVoice );\n\tgHUD.AddHudElem( this );\n\tm_iFlags = 0;\n\treturn 1;\n}\n\n\nvoid Broadcast( const char *msg, int pitch )\n{\n\tif ( msg[0] == '%' && msg[1] == '!' )\n\t\tgEngfuncs.pfnPlaySoundVoiceByName( &msg[1], 1.0f, pitch );\n\telse\n\t\tgEngfuncs.pfnPlaySoundVoiceByName( msg, 1.0f, pitch );\n}\n\nint CHudRadio::MsgFunc_SendAudio( const char *pszName, int iSize, void *pbuf )\n{\n\tBufferReader reader( pszName, pbuf, iSize );\n\n\tint SenderID = reader.ReadByte( );\n\tchar *sentence = reader.ReadString( );\n\tint pitch = reader.ReadShort( );\n\n\tBroadcast( sentence, pitch );\n\n\tif( SenderID <= MAX_PLAYERS )\n\t{\n\t\tg_PlayerExtraInfo[SenderID].radarflashes = 22;\n\t\tg_PlayerExtraInfo[SenderID].radarflashtime = gHUD.m_flTime;\n\t\tg_PlayerExtraInfo[SenderID].radarflashtimedelta = 0.5f;\n\t}\n\treturn 1;\n}\n\nint CHudRadio::MsgFunc_ReloadSound( const char *pszName, int iSize, void *pbuf )\n{\n\tBufferReader reader( pszName, pbuf, iSize );\n\n\tint vol = reader.ReadByte( );\n\tif ( reader.ReadByte( ) )\n\t{\n\t\tgEngfuncs.pfnPlaySoundByName( \"weapons/generic_reload.wav\", vol / 255.0f );\n\t}\n\telse\n\t{\n\t\tgEngfuncs.pfnPlaySoundByName( \"weapons/generic_shot_reload.wav\", vol / 255.0f );\n\t}\n\treturn 1;\n}\n\n\nstatic void VoiceIconCallback(struct tempent_s *ent, float frametime, float currenttime)\n{\n\tint entIndex = ent->clientIndex;\n\tif( !g_PlayerExtraInfo[entIndex].talking )\n\t{\n\t\tg_PlayerExtraInfo[entIndex].talking = false;\n\t\tent->die = 0.0f;\n\t}\n}\n\nvoid CHudRadio::Voice(int entindex, bool bTalking)\n{\n\textra_player_info_t *pplayer;\n\tTEMPENTITY *temp;\n\tint spr;\n\n\tif( entindex < 0 || entindex > MAX_PLAYERS - 1) // bomb can't talk!\n\t\treturn;\n\n\tpplayer = g_PlayerExtraInfo + entindex;\n\n\tif( bTalking == pplayer->talking )\n\t\treturn; // user is talking already\n\n\tif( !bTalking && pplayer->talking )\n\t{\n\t\tpplayer->talking = false;\n\t\treturn; // stop talking\n\t}\n\n\tspr = gEngfuncs.pEventAPI->EV_FindModelIndex( \"sprites/voiceicon.spr\" );\n\tif( !spr ) return;\n\n\ttemp = gEngfuncs.pEfxAPI->R_DefaultSprite( vec3_origin, spr, 0 );\n\tif( !temp ) return;\n\n\tpplayer->talking = true; // sprite is created\n\n\ttemp->flags = FTENT_SPRANIMATELOOP | FTENT_CLIENTCUSTOM | FTENT_PLYRATTACHMENT;\n\ttemp->tentOffset.z = 40;\n\ttemp->clientIndex = entindex;\n\ttemp->callback = VoiceIconCallback;\n\ttemp->entity.curstate.scale = 0.60f;\n\ttemp->entity.curstate.rendermode = kRenderTransAdd;\n\ttemp->die = gHUD.m_flTime + 60.0f; // 60 seconds must be enough?\n}\n\nint CHudRadio::MsgFunc_BotVoice( const char *pszName, int iSize, void *buf )\n{\n\tBufferReader reader( pszName, buf, iSize );\n\n\tint enable   = reader.ReadByte();\n\tint entIndex = reader.ReadByte();\n\n\tHUD_VoiceStatus( entIndex, enable );\n\n\t// Voice( entIndex, enable );\n\n\treturn 1;\n}\n"
  },
  {
    "path": "cl_dll/hud/scenario.cpp",
    "content": "// This is an open source non-commercial project. Dear PVS-Studio, please check it.\n// PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com\n/*\nscenario.cpp -- CSCZ Scenario HUD implementation\nCopyright (C) 2017 a1batross\nThis program is free software; you can redistribute it and/or modify it\nunder the terms of the GNU General Public License as published by the\nFree Software Foundation; either version 2 of the License, or (at\nyour option) any later version.\n\nThis program is distributed in the hope that it will be useful, but\nWITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\nGeneral Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with this program; if not, write to the Free Software Foundation,\nInc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\n\nIn addition, as a special exception, the author gives permission to\nlink the code of this program with the Half-Life Game Engine (\"HL\nEngine\") and Modified Game Libraries (\"MODs\") developed by Valve,\nL.L.C (\"Valve\").  You must obey the GNU General Public License in all\nrespects for all of the code used other than the HL Engine and MODs\nfrom Valve.  If you modify this file, you may extend this exception\nto your version of the file, but you are not obligated to do so.  If\nyou do not wish to do so, delete this exception statement from your\nversion.\n*/\n\n#include \"hud.h\"\n#include \"parsemsg.h\"\n#include \"cl_util.h\"\n#include \"r_efx.h\"\n#include \"event_api.h\"\n#include \"com_model.h\"\n#include \"draw_util.h\"\n#include <string.h>\n\nint CHudScenario::Init( )\n{\n\tHOOK_MESSAGE( gHUD.m_Scenario, Scenario );\n\tm_iFlags = 0;\n\tgHUD.AddHudElem( this );\n\n\treturn 0;\n}\n\nint CHudScenario::VidInit( )\n{\n\treturn 0;\n}\n\nvoid CHudScenario::Reset()\n{\n\tm_sprite.spr = 0;\n}\n\nint CHudScenario::Draw(float flTime)\n{\n\tif( gHUD.m_iHideHUDDisplay & HIDEHUD_HEALTH || g_iUser1 || gEngfuncs.IsSpectateOnly() || !m_sprite.spr )\n\t\treturn 1;\n\n\tif (!(gHUD.m_iWeaponBits & (1<<(WEAPON_SUIT)) ))\n\t\treturn 1;\n\n\tint r, g, b;\n\tint x, y;\n\tDrawUtils::UnpackRGB( r, g, b, gHUD.m_iDefaultHUDColor );\n\n\tif( m_fFlashRate != 0.0f && m_fNextFlash < flTime )\n\t{\n\t\tm_iAlpha = m_iFlashAlpha;\n\t\tm_fNextFlash = flTime + m_fFlashRate;\n\t}\n\n\tif ( m_iAlpha > MIN_ALPHA ) m_iAlpha -= 20;\n\telse m_iAlpha = MIN_ALPHA;\n\n\tDrawUtils::ScaleColors( r, g, b, m_iAlpha );\n\n\tx = gHUD.m_Timer.m_right + gHUD.m_iFontWidth * 1.5;\n\ty = ScreenHeight - 1.5 * gHUD.m_iFontHeight - ( m_sprite.rect.Height() - gHUD.m_iFontHeight ) / 2 ;\n\n\tSPR_Set( m_sprite.spr, r, g, b );\n\tSPR_DrawAdditive( 0, x, y, &m_sprite.rect );\n\treturn 1;\n}\n\nint CHudScenario::MsgFunc_Scenario(const char *pszName, int iSize, void *buf)\n{\n\tBufferReader reader( pszName, buf, iSize );\n\n\tbool active = reader.ReadByte();\n\tif( !active )\n\t{\n\t\tm_iFlags = 0;\n\t\treturn 1;\n\t}\n\n\tm_iFlags = HUD_DRAW;\n\n\tconst char *spriteName = reader.ReadString();\n\tm_sprite.SetSpriteByName( spriteName );\n\n\tm_iFlashAlpha = reader.ReadByte();\n\tm_fFlashRate = reader.ReadShort() * 0.01;\n\tm_fNextFlash = reader.ReadShort() * 0.01 + gHUD.m_flTime;\n\n\treturn 1;\n}\n"
  },
  {
    "path": "cl_dll/hud/scoreboard.cpp",
    "content": "/***\n*\n*\tCopyright (c) 1999, Valve LLC. All rights reserved.\n*\n*\tThis product contains software technology licensed from Id\n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc.\n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n//\n// Scoreboard.cpp\n//\n// implementation of CHudScoreboard class\n//\n\n#include \"hud.h\"\n#include \"cl_util.h\"\n#include \"parsemsg.h\"\n#include \"triangleapi.h\"\n#include \"com_weapons.h\"\n#include \"cdll_dll.h\"\n\n#include <string.h>\n#include <stdio.h>\n#include \"draw_util.h\"\n#include \"vgui_parser.h\"\n#include <ctype.h>\n\nhud_player_info_t   g_PlayerInfoList[MAX_PLAYERS+1]; // player info from the engine\nextra_player_info_t\tg_PlayerExtraInfo[MAX_PLAYERS+1]; // additional player info sent directly to the client dll\nteam_info_t         g_TeamInfo[MAX_TEAMS+1];\nhostage_info_t      g_HostageInfo[MAX_HOSTAGES+1];\nint g_iUser1;\nint g_iUser2;\nint g_iUser3;\nint g_iTeamNumber;\n\n\n// X positions\n\nint xstart, xend;\nint ystart, yend;\n\nenum\n{\n\tCOL_NAME = 0,\n\tCOL_ATTRIB,\n\tCOL_HP,\n\tCOL_MONEY,\n\tCOL_KILLS,\n\tCOL_DEATHS,\n\tCOL_PING,\n\tTOTAL_COLUMNS\n};\n\nstatic struct Column\n{\n\tint start, end;\n\tconst char *name;\n\n\tColumn() :\n\t    start( 0 ), end( 0 ), name( nullptr ) { }\n\n\tColumn( int s, const char *n = nullptr, bool reverse = true )\n\t{\n\t\tname = n;\n\t\tend = 0;\n\t\tstart = 0;\n\n\t\tif ( reverse )\n\t\t{\n\t\t\tstart = s;\n\t\t\tif ( n )\n\t\t\t\tend = start - DrawUtils::HudStringLen( n );\n\t\t}\n\t\telse\n\t\t{\n\t\t\tstart = s;\n\t\t\tif ( n )\n\t\t\t\tend = start + DrawUtils::HudStringLen( n );\n\t\t}\n\t}\n} g_Columns[TOTAL_COLUMNS];\n\n//#include \"vgui_TeamFortressViewport.h\"\n\nint CHudScoreboard :: Init( void )\n{\n\tgHUD.AddHudElem( this );\n\n\t// Hook messages & commands here\n\tHOOK_COMMAND( gHUD.m_Scoreboard, \"+showscores\", ShowScores );\n\tHOOK_COMMAND( gHUD.m_Scoreboard, \"-showscores\", HideScores );\n\tHOOK_COMMAND( gHUD.m_Scoreboard, \"showscoreboard2\", ShowScoreboard2 );\n\tHOOK_COMMAND( gHUD.m_Scoreboard, \"hidescoreboard2\", HideScoreboard2 );\n\n\tHOOK_MESSAGE( gHUD.m_Scoreboard, ScoreInfo );\n\tHOOK_MESSAGE( gHUD.m_Scoreboard, TeamScore );\n\tHOOK_MESSAGE( gHUD.m_Scoreboard, TeamInfo );\n\n\tInitHUDData();\n\n\tcl_showpacketloss = CVAR_CREATE( \"cl_showpacketloss\", \"0\", FCVAR_ARCHIVE );\n\tcl_showplayerversion = CVAR_CREATE( \"cl_showplayerversion\", \"0\", 0 );\n\tcl_show_scoreboard_on_death = CVAR_CREATE( \"cl_show_scoreboard_on_death\", \"0\", FCVAR_ARCHIVE );\n\n\treturn 1;\n}\n\n\nint CHudScoreboard :: VidInit( void )\n{\n\txstart = ScreenWidth * 0.125f;\n\txend = ScreenWidth - xstart;\n\tystart = 100;\n\tyend = ScreenHeight - ystart;\n\tm_bForceDraw = false;\n\n\t// Load sprites here\n\treturn 1;\n}\n\nvoid CHudScoreboard :: InitHUDData( void )\n{\n\tmemset( g_PlayerExtraInfo, 0, sizeof g_PlayerExtraInfo );\n\tm_iLastKilledBy = 0;\n\tm_fLastKillTime = 0;\n\tm_iPlayerNum = 0;\n\tm_iNumTeams = 0;\n\tmemset( g_TeamInfo, 0, sizeof g_TeamInfo );\n\n\tfor ( int i = 1; i <= MAX_PLAYERS; i++ )\n\t{\n\t\tg_PlayerExtraInfo[i].sb_health = -1;\n\t\tg_PlayerExtraInfo[i].sb_account = -1;\n\t}\n\n\tm_iFlags &= ~HUD_DRAW;  // starts out inactive\n\n\tm_iFlags |= HUD_INTERMISSION; // is always drawn during an intermission\n}\n\nbool CHudScoreboard :: ShouldDrawScoreboard() const\n{\n\tif( m_bForceDraw )\n\t\treturn true;\n\n\tif( m_bShowscoresHeld || gHUD.m_iIntermission )\n\t\treturn true;\n\n\tif( cl_show_scoreboard_on_death && cl_show_scoreboard_on_death->value && gHUD.m_Health.m_iHealth <= 0 )\n\t\treturn true;\n\n\treturn false;\n}\n\n// Y positions\n#define ROW_GAP  15\n\nint CHudScoreboard :: Draw( float flTime )\n{\n\tif( !ShouldDrawScoreboard( ))\n\t\treturn 1;\n\n\tif( !m_bForceDraw )\n\t{\n\t\txstart     = 0.125f * ScreenWidth;\n\t\txend       = ScreenWidth - xstart;\n\t\tystart     = 90;\n\t\tyend       = ScreenHeight - ystart;\n\t\tm_colors.r = 0;\n\t\tm_colors.g = 0;\n\t\tm_colors.b = 0;\n\t\tm_colors.a = 153;\n\t\tm_bDrawStroke = true;\n\t}\n\n\treturn DrawScoreboard(flTime);\n}\n\nint CHudScoreboard :: DrawScoreboard( float fTime )\n{\n\tGetAllPlayersInfo();\n\tchar ServerName[90];\n\n//\tPacketloss removed on Kelly 'shipping nazi' Bailey's orders\n//\tif ( cl_showpacketloss && cl_showpacketloss->value && ( ScreenWidth >= 400 ) )\n//\t{\n//\t\tcan_show_packetloss = 1;\n//\t}\n\n\t// just sort the list on the fly\n\t// list is sorted first by frags, then by deaths\n\tfloat list_slot = 0;\n\n\t// calculate columns sizes\n\tg_Columns[COL_PING] = Column( xend - 15, Localize( \"#PlayerPing\" ) );\n\tg_Columns[COL_PING].end = min( g_Columns[COL_PING].end, g_Columns[COL_PING].start - DrawUtils::HudStringLen( \"9999\" ) );\n\n\tg_Columns[COL_DEATHS] = Column( g_Columns[COL_PING].end - 10, Localize( \"#PlayerDeath\" ) );\n\tg_Columns[COL_DEATHS].end = min( g_Columns[COL_DEATHS].end, g_Columns[COL_DEATHS].start - DrawUtils::HudStringLen( \"9999\" ) );\n\n\tg_Columns[COL_KILLS] = Column( g_Columns[COL_DEATHS].end - 10, Localize( \"#PlayerScore\" ) );\n\tg_Columns[COL_KILLS].end = min( g_Columns[COL_KILLS].end, g_Columns[COL_KILLS].start - DrawUtils::HudStringLen( \"9999\" ) );\n\n\tg_Columns[COL_MONEY] = Column( g_Columns[COL_KILLS].end - 10, Localize( \"#Cstrike_ACCOUNT\" ) );\n\tg_Columns[COL_MONEY].end = min( g_Columns[COL_MONEY].end, g_Columns[COL_MONEY].start - DrawUtils::HudStringLen( \"$16000\" ) );\n\n\tg_Columns[COL_HP] = Column( g_Columns[COL_MONEY].end - 10, Localize( \"#Cstrike_HEALTH\" ) );\n\tg_Columns[COL_HP].end = min( g_Columns[COL_HP].end, g_Columns[COL_HP].start - DrawUtils::HudStringLen( \"100\" ) );\n\n\tg_Columns[COL_ATTRIB] = Column( g_Columns[COL_HP].end - 10 );\n\tg_Columns[COL_ATTRIB].end = g_Columns[COL_ATTRIB].start - DrawUtils::HudStringLen( \"#Cstrike_DEFUSE_KIT\" );\n\n\tg_Columns[COL_NAME] = Column( xstart + 15, nullptr, false );\n\tg_Columns[COL_NAME].end = g_Columns[COL_ATTRIB].end - 10;\n\n\t// print the heading line\n\n\tDrawUtils::DrawRectangle(xstart, ystart, xend - xstart, yend - ystart,\n\t\tm_colors.r, m_colors.g, m_colors.b, m_colors.a, m_bDrawStroke);\n\n\tint ypos = ystart + (list_slot * ROW_GAP) + 5;\n\n\tif( gHUD.m_szServerName[0] )\n\t\t// snprintf( ServerName, 80, \"%s\", (char*)(gHUD.m_Teamplay ? \"TEAMS\" : \"PLAYERS\"), gHUD.m_szServerName );\n\t\tstrncpy( ServerName, gHUD.m_szServerName, 80 );\n\telse\n\t\tstrncpy( ServerName, gHUD.m_Teamplay ? \"TEAMS\" : \"PLAYERS\", 80 );\n\n\tDrawUtils::DrawHudString( g_Columns[COL_NAME].start, ypos, g_Columns[COL_NAME].end, ServerName, 255, 140, 0 );\n\tDrawUtils::DrawHudStringReverse( g_Columns[COL_HP].start, ypos, g_Columns[COL_HP].end, g_Columns[COL_HP].name, 255, 140, 0 );\n\tDrawUtils::DrawHudStringReverse( g_Columns[COL_MONEY].start, ypos, g_Columns[COL_MONEY].end, g_Columns[COL_MONEY].name, 255, 140, 0 );\n\tDrawUtils::DrawHudStringReverse( g_Columns[COL_KILLS].start, ypos, g_Columns[COL_KILLS].end, g_Columns[COL_KILLS].name, 255, 140, 0 );\n\tDrawUtils::DrawHudStringReverse( g_Columns[COL_DEATHS].start, ypos, g_Columns[COL_DEATHS].end, g_Columns[COL_DEATHS].name, 255, 140, 0 );\n\tDrawUtils::DrawHudStringReverse( g_Columns[COL_PING].start, ypos, g_Columns[COL_PING].end, g_Columns[COL_PING].name, 255, 140, 0 );\n\n\tlist_slot += 2;\n\typos = ystart + (list_slot * ROW_GAP);\n\tFillRGBA( xstart, ypos, xend - xstart, 1, 255, 140, 0, 255);  // draw the separator line\n\n\tlist_slot += 0.8;\n\n\tif ( gHUD.m_Teamplay )\n\t{\n\t\tDrawTeams( list_slot );\n\t}\n\telse\n\t{\n\t\t// it's not teamplay,  so just draw a simple player list\n\t\tDrawPlayers( list_slot );\n\t}\n\treturn 1;\n}\n\nint CHudScoreboard :: DrawTeams( float list_slot )\n{\n\tint j;\n\tint ypos = ystart + (list_slot * ROW_GAP) + 5;\n\n\t// clear out team scores\n\tfor ( int i = 1; i <= m_iNumTeams; i++ )\n\t{\n\t\tif ( !g_TeamInfo[i].scores_overriden )\n\t\t\tg_TeamInfo[i].frags = g_TeamInfo[i].deaths = 0;\n\t\tg_TeamInfo[i].sumping = 0;\n\t\tg_TeamInfo[i].players = 0;\n\t\tg_TeamInfo[i].already_drawn = FALSE;\n\t}\n\n\t// recalc the team scores, then draw them\n\tfor ( int i = 1; i < MAX_PLAYERS; i++ )\n\t{\n\t\tif ( !g_PlayerInfoList[i].name || !g_PlayerInfoList[i].name[0] )\n\t\t\tcontinue; // empty player slot, skip\n\n\t\tif ( g_PlayerExtraInfo[i].teamname[0] == 0 )\n\t\t\tcontinue; // skip over players who are not in a team\n\n\t\t// find what team this player is in\n\t\tfor ( j = 1; j <= m_iNumTeams; j++ )\n\t\t{\n\t\t\tif ( !stricmp( g_PlayerExtraInfo[i].teamname, g_TeamInfo[j].name ) )\n\t\t\t\tbreak;\n\t\t}\n\n\t\tif ( j > m_iNumTeams )  // player is not in a team, skip to the next guy\n\t\t\tcontinue;\n\n\t\tif ( !g_TeamInfo[j].scores_overriden )\n\t\t{\n\t\t\tg_TeamInfo[j].frags += g_PlayerExtraInfo[i].frags;\n\t\t\tg_TeamInfo[j].deaths += g_PlayerExtraInfo[i].deaths;\n\t\t}\n\n\t\tg_TeamInfo[j].sumping += g_PlayerInfoList[i].ping;\n\n\t\tif ( g_PlayerInfoList[i].thisplayer )\n\t\t\tg_TeamInfo[j].ownteam = TRUE;\n\t\telse\n\t\t\tg_TeamInfo[j].ownteam = FALSE;\n\n\t\tg_TeamInfo[j].players++;\n\t}\n\n\t// Draw the teams\n\tint iSpectatorPos = -1;\n\n\twhile( true )\n\t{\n\t\tint highest_frags = -99999; int lowest_deaths = 99999;\n\t\tint best_team = 0;\n\n\t\tfor ( int i = 1; i <= m_iNumTeams; i++ )\n\t\t{\n\t\t\t// don't draw team without players\n\t\t\tif ( g_TeamInfo[i].players <= 0 )\n\t\t\t\tcontinue;\n\n\t\t\tif (!strnicmp(g_TeamInfo[i].name, \"SPECTATOR\", MAX_TEAM_NAME))\n\t\t\t{\n\t\t\t\tiSpectatorPos = i;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif ( !g_TeamInfo[i].already_drawn && g_TeamInfo[i].frags >= highest_frags )\n\t\t\t{\n\t\t\t\tif ( g_TeamInfo[i].frags > highest_frags || g_TeamInfo[i].deaths < lowest_deaths )\n\t\t\t\t{\n\t\t\t\t\tbest_team = i;\n\t\t\t\t\tlowest_deaths = g_TeamInfo[i].deaths;\n\t\t\t\t\thighest_frags = g_TeamInfo[i].frags;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// draw the best team on the scoreboard\n\t\tif ( !best_team )\n\t\t{\n\t\t\t// if spectators is found and still not drawn\n\t\t\tif( iSpectatorPos != -1 && g_TeamInfo[iSpectatorPos].already_drawn == FALSE )\n\t\t\t\tbest_team = iSpectatorPos;\n\t\t\telse break;\n\t\t}\n\t\t// draw out the best team\n\t\tteam_info_t *team_info = &g_TeamInfo[best_team];\n\n\t\t// don't draw team without players\n\t\tif ( team_info->players <= 0 )\n\t\t\tcontinue;\n\n\t\typos = ystart + (list_slot * ROW_GAP);\n\n\t\t// check we haven't drawn too far down\n\t\tif ( ypos > yend )  // don't draw to close to the lower border\n\t\t\tbreak;\n\n\t\tint r, g, b;\n\t\tchar teamName[64];\n\n\t\tchar numPlayers[16];\n\t\tsprintf( numPlayers, \"%d\", team_info->players );\n\n\t\tchar fmtString[32];\n\t\tconst char *fmtStringName = team_info->players == 1 ? \"#Cstrike_ScoreBoard_Player\" : \"#Cstrike_ScoreBoard_Players\";\n\t\tstrncpy( fmtString, Localize( fmtStringName ), sizeof( fmtString ) );\n\n\t\tif ( !strcmp( fmtString, fmtStringName ) )\n\t\t\tstrncpy( fmtString, team_info->players == 1 ? \"%s    -   %s player\" : \"%s    -   %s players\", sizeof( fmtString ) );\n\t\telse\n\t\t\tLocalize_StripIndices( fmtString );\n\n\t\tGetTeamColor( r, g, b, team_info->teamnumber );\n\t\tswitch ( team_info->teamnumber )\n\t\t{\n\t\tcase TEAM_TERRORIST:\n\t\t\tsnprintf( teamName, sizeof( teamName ), fmtString, Localize( \"#Cstrike_ScoreBoard_Ter\" ), numPlayers );\n\t\t\tDrawUtils::DrawHudNumberString( g_Columns[COL_KILLS].start, ypos, g_Columns[COL_KILLS].end, team_info->frags, r, g, b );\n\t\t\tbreak;\n\t\tcase TEAM_CT:\n\t\t\tsnprintf( teamName, sizeof( teamName ), fmtString, Localize( \"#Cstrike_ScoreBoard_CT\" ), numPlayers );\n\t\t\tDrawUtils::DrawHudNumberString( g_Columns[COL_KILLS].start, ypos, g_Columns[COL_KILLS].end, team_info->frags, r, g, b );\n\t\t\tbreak;\n\t\tcase TEAM_SPECTATOR:\n\t\tcase TEAM_UNASSIGNED:\n\t\t\tstrncpy( teamName, Localize( \"#Spectators\" ), sizeof( teamName ) );\n\t\t\tbreak;\n\t\t}\n\n\t\tDrawUtils::DrawHudString( g_Columns[COL_NAME].start, ypos, g_Columns[COL_NAME].end, teamName, r, g, b );\n\t\tDrawUtils::DrawHudNumberString( g_Columns[COL_PING].start, ypos, g_Columns[COL_PING].end, team_info->sumping / team_info->players, r, g, b );\n\n\t\tteam_info->already_drawn = TRUE;  // set the already_drawn to be TRUE, so this team won't get drawn again\n\n\t\t// draw underline\n\t\tlist_slot += 1.2f;\n\t\tFillRGBA( xstart, ystart + (list_slot * ROW_GAP), xend - xstart, 1, r, g, b, 255);\n\n\t\tlist_slot += 0.4f;\n\t\t// draw all the players that belong to this team, indented slightly\n\t\tlist_slot = DrawPlayers( list_slot, 10, team_info->name );\n\t}\n\n\t// draw all the players who are not in a team\n\tlist_slot += 4.0f;\n\tDrawPlayers( list_slot, 0, \"\" );\n\n\treturn 1;\n}\n\n// returns the ypos where it finishes drawing\nint CHudScoreboard :: DrawPlayers( float list_slot, int nameoffset, const char *team )\n{\n\t// draw the players, in order,  and restricted to team if set\n\twhile ( 1 )\n\t{\n\t\t// Find the top ranking player\n\t\tint highest_frags = -99999;\tint lowest_deaths = 99999;\n\t\tint best_player = 0;\n\n\t\tfor ( int i = 1; i < MAX_PLAYERS; i++ )\n\t\t{\n\t\t\tif ( g_PlayerInfoList[i].name && g_PlayerExtraInfo[i].frags >= highest_frags )\n\t\t\t{\n\t\t\t\tif ( !(team && stricmp(g_PlayerExtraInfo[i].teamname, team)) )  // make sure it is the specified team\n\t\t\t\t{\n\t\t\t\t\textra_player_info_t *pl_info = &g_PlayerExtraInfo[i];\n\t\t\t\t\tif ( pl_info->frags > highest_frags || pl_info->deaths < lowest_deaths )\n\t\t\t\t\t{\n\t\t\t\t\t\tbest_player = i;\n\t\t\t\t\t\tlowest_deaths = pl_info->deaths;\n\t\t\t\t\t\thighest_frags = pl_info->frags;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif ( !best_player )\n\t\t\tbreak;\n\n\t\t// draw out the best player\n\t\thud_player_info_t *pl_info = &g_PlayerInfoList[best_player];\n\n\t\tint ypos = ystart + (list_slot * ROW_GAP);\n\n\t\t// check we haven't drawn too far down\n\t\tif ( ypos > yend )  // don't draw to close to the lower border\n\t\t\tbreak;\n\n\t\tint r = 255, g = 255, b = 255;\n\t\tfloat *colors = GetClientColor( best_player );\n\t\tr *= colors[0];\n\t\tg *= colors[1];\n\t\tb *= colors[2];\n\n\t\tif(pl_info->thisplayer) // hey, it's me!\n\t\t{\n\t\t\tFillRGBABlend( xstart, ypos, xend - xstart, ROW_GAP, 255, 255, 255, 15 );\n\t\t}\n\n\t\tDrawUtils::DrawHudString( g_Columns[COL_NAME].start + nameoffset, ypos, g_Columns[COL_NAME].start + 350, pl_info->name, r, g, b );\n\n\t\tif( cl_showplayerversion->value == 0.0f )\n\t\t{\n\t\t\tif( team && stricmp( team, \"SPECTATOR\" ))\n\t\t\t{\n\t\t\t\t// draw bomb( if player have the bomb )\n\t\t\t\tif( g_PlayerExtraInfo[best_player].dead )\n\t\t\t\t\tDrawUtils::DrawHudStringReverse( g_Columns[COL_ATTRIB].start, ypos, g_Columns[COL_ATTRIB].end, Localize( \"#Cstrike_DEAD\" ), r, g, b );\n\t\t\t\telse if( g_PlayerExtraInfo[best_player].has_c4 )\n\t\t\t\t\tDrawUtils::DrawHudStringReverse( g_Columns[COL_ATTRIB].start, ypos, g_Columns[COL_ATTRIB].end, Localize( \"#Cstrike_BOMB\" ), r, g, b );\n\t\t\t\telse if( g_PlayerExtraInfo[best_player].vip )\n\t\t\t\t\tDrawUtils::DrawHudStringReverse( g_Columns[COL_ATTRIB].start, ypos, g_Columns[COL_ATTRIB].end, Localize( \"#Cstrike_VIP\" ),  r, g, b );\n\t\t\t\telse if (g_PlayerExtraInfo[best_player].has_defuse_kit )\n\t\t\t\t\tDrawUtils::DrawHudStringReverse( g_Columns[COL_ATTRIB].start, ypos, g_Columns[COL_ATTRIB].end, Localize( \"#Cstrike_DEFUSE_KIT\" ),  r, g, b );\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tDrawUtils::DrawHudStringReverse( g_Columns[COL_ATTRIB].start, ypos, g_Columns[COL_ATTRIB].end, gEngfuncs.PlayerInfo_ValueForKey( best_player, \"cscl_ver\" ),  r, g, b );\n\t\t}\n\n\t\tif ( g_PlayerExtraInfo[best_player].sb_health >= 0 && !g_PlayerExtraInfo[best_player].dead )\n\t\t{\n\t\t\tif ( gHUD.m_pShowHealth->value )\n\t\t\t{\n\t\t\t\tstatic char buf[64];\n\t\t\t\tsprintf( buf, \"%d\", g_PlayerExtraInfo[best_player].sb_health );\n\t\t\t\tDrawUtils::DrawHudStringReverse( g_Columns[COL_HP].start, ypos, g_Columns[COL_HP].end, buf, r, g, b );\n\t\t\t}\n\t\t}\n\n\t\tif ( g_PlayerExtraInfo[best_player].sb_account >= 0 )\n\t\t{\n\t\t\tif ( gHUD.m_pShowMoney->value )\n\t\t\t{\n\t\t\t\tstatic char buf[64];\n\t\t\t\tsprintf( buf, \"$%d\", g_PlayerExtraInfo[best_player].sb_account );\n\t\t\t\tDrawUtils::DrawHudStringReverse( g_Columns[COL_MONEY].start, ypos, g_Columns[COL_MONEY].end, buf, r, g, b );\n\t\t\t}\n\t\t}\n\n\t\t// draw kills (right to left)\n\t\tif( team && stricmp( team, \"SPECTATOR\" ) )\n\t\t{\n\t\t\tDrawUtils::DrawHudNumberString( g_Columns[COL_KILLS].start, ypos, g_Columns[COL_KILLS].end, g_PlayerExtraInfo[best_player].frags, r, g, b );\n\n\t\t\t// draw deaths\n\t\t\tDrawUtils::DrawHudNumberString( g_Columns[COL_DEATHS].start, ypos, g_Columns[COL_DEATHS].end, g_PlayerExtraInfo[best_player].deaths, r, g, b );\n\t\t}\n\n\t\t// draw ping & packetloss\n\t\tconst char *value;\n\t\tif( pl_info->ping <= 5  // must be 0, until Xash's bug not fixed\n\t\t\t&& ( value = gEngfuncs.PlayerInfo_ValueForKey( best_player, \"*bot\" ) )\n\t\t\t&& atoi( value ) > 0 )\n\t\t{\n\t\t\tDrawUtils::DrawHudStringReverse( g_Columns[COL_PING].start, ypos, g_Columns[COL_PING].end, \"BOT\", r, g, b );\n\t\t}\n\t\telse\n\t\t{\n\t\t\tstatic char buf[64];\n\t\t\tsprintf( buf, \"%d\", pl_info->ping );\n\t\t\tDrawUtils::DrawHudStringReverse( g_Columns[COL_PING].start, ypos, g_Columns[COL_PING].end, buf, r, g, b );\n\t\t}\n\n\t\tpl_info->name = NULL;  // set the name to be NULL, so this client won't get drawn again\n\t\tlist_slot++;\n\t}\n\n\tlist_slot += 2.0f;\n\n\treturn list_slot;\n}\n\n\nvoid CHudScoreboard :: GetAllPlayersInfo( void )\n{\n\tfor ( int i = 1; i < MAX_PLAYERS; i++ )\n\t{\n\t\tGetPlayerInfo( i, &g_PlayerInfoList[i] );\n\n\t\tif ( g_PlayerInfoList[i].thisplayer )\n\t\t\tm_iPlayerNum = i;  // !!!HACK: this should be initialized elsewhere... maybe gotten from the engine\n\t}\n}\n\nint CHudScoreboard :: MsgFunc_ScoreInfo( const char *pszName, int iSize, void *pbuf )\n{\n\tm_iFlags |= HUD_DRAW;\n\n\tBufferReader reader( pszName, pbuf, iSize );\n\tshort cl = reader.ReadByte();\n\tshort frags = reader.ReadShort();\n\tshort deaths = reader.ReadShort();\n\tshort playerclass = reader.ReadShort();\n\tshort teamnumber = reader.ReadShort();\n\n\tif ( cl > 0 && cl <= MAX_PLAYERS )\n\t{\n\t\tg_PlayerExtraInfo[cl].frags = frags;\n\t\tg_PlayerExtraInfo[cl].deaths = deaths;\n\t\tg_PlayerExtraInfo[cl].playerclass = playerclass;\n\t\tg_PlayerExtraInfo[cl].teamnumber = teamnumber;\n\n\t\t//gViewPort->UpdateOnPlayerInfo();\n\t}\n\n\treturn 1;\n}\n\n// Message handler for TeamInfo message\n// accepts two values:\n//\t\tbyte: client number\n//\t\tstring: client team name\nint CHudScoreboard :: MsgFunc_TeamInfo( const char *pszName, int iSize, void *pbuf )\n{\n\tBufferReader reader( pszName, pbuf, iSize );\n\tshort cl = reader.ReadByte();\n\tint teamNumber = 0;\n\n\tif ( cl > 0 && cl <= MAX_PLAYERS )\n\t{\n\t\t// set the players team\n\t\tchar teamName[MAX_TEAM_NAME];\n\t\tstrncpy( teamName, reader.ReadString(), MAX_TEAM_NAME );\n\t\tteamName[MAX_TEAM_NAME-1] = 0;\n\n\t\tif( !strcmp( teamName, \"TERRORIST\") )\n\t\t\tteamNumber = TEAM_TERRORIST;\n\t\telse if( !strcmp( teamName, \"CT\") )\n\t\t\tteamNumber = TEAM_CT;\n\t\telse if( !strcmp( teamName, \"SPECTATOR\" ) || !strcmp( teamName, \"UNASSIGNED\" ) )\n\t\t{\n\t\t\tteamNumber = TEAM_SPECTATOR;\n\t\t\tstrncpy( teamName, \"SPECTATOR\", MAX_TEAM_NAME );\n\t\t}\n\t\t// just in case\n\t\telse teamNumber = TEAM_UNASSIGNED;\n\n\t\tstrncpy( g_PlayerExtraInfo[cl].teamname, teamName, MAX_TEAM_NAME );\n\t\tg_PlayerExtraInfo[cl].teamnumber = teamNumber;\n\t}\n\n\t// rebuild the list of teams\n\n\t// clear out player counts from teams\n\tfor ( int i = 1; i <= m_iNumTeams; i++ )\n\t{\n\t\tg_TeamInfo[i].players = 0;\n\t}\n\n\t// rebuild the team list\n\tGetAllPlayersInfo();\n\tm_iNumTeams = 0;\n\n\tfor ( int i = 1; i < MAX_PLAYERS; i++ )\n\t{\n\t\tint j;\n\t\t//if ( g_PlayerInfoList[i].name == NULL )\n\t\t//\tcontinue;\n\n\t\tif ( g_PlayerExtraInfo[i].teamname[0] == 0 )\n\t\t\tcontinue; // skip over players who are not in a team\n\n\t\t// is this player in an existing team?\n\t\tfor ( j = 1; j <= m_iNumTeams; j++ )\n\t\t{\n\t\t\tif ( g_TeamInfo[j].name[0] == '\\0' )\n\t\t\t\tbreak;\n\n\t\t\tif ( !stricmp( g_PlayerExtraInfo[i].teamname, g_TeamInfo[j].name ) )\n\t\t\t\tbreak;\n\t\t}\n\n\t\tif ( j > m_iNumTeams )\n\t\t{\n\t\t\t// they aren't in a listed team, so make a new one\n\t\t\tfor ( j = 1; j <= m_iNumTeams; j++ )\n\t\t\t{\n\t\t\t\tif ( g_TeamInfo[j].name[0] == '\\0' )\n\t\t\t\t\tbreak;\n\t\t\t}\n\n\n\t\t\tm_iNumTeams = max( j, m_iNumTeams );\n\n\t\t\tstrncpy( g_TeamInfo[j].name, g_PlayerExtraInfo[i].teamname, MAX_TEAM_NAME );\n\t\t\tg_TeamInfo[j].teamnumber = g_PlayerExtraInfo[i].teamnumber;\n\t\t\tg_TeamInfo[j].players = 0;\n\t\t}\n\n\t\tg_TeamInfo[j].players++;\n\t}\n\n\t// clear out any empty teams\n\tfor ( int i = 1; i <= m_iNumTeams; i++ )\n\t{\n\t\tif ( g_TeamInfo[i].players < 1 )\n\t\t\tmemset( &g_TeamInfo[i], 0, sizeof(team_info_t) );\n\t}\n\n\treturn 1;\n}\n\n// Message handler for TeamScore message\n// accepts three values:\n//\t\tstring: team name\n//\t\tshort: teams kills\n//\t\tshort: teams deaths\n// if this message is never received, then scores will simply be the combined totals of the players.\nint CHudScoreboard :: MsgFunc_TeamScore( const char *pszName, int iSize, void *pbuf )\n{\n\tBufferReader reader( pszName, pbuf, iSize );\n\tchar *TeamName = reader.ReadString();\n\tint i;\n\n\t// find the team matching the name\n\tfor ( i = 0; i < m_iNumTeams; i++ )\n\t{\n\t\tif ( !stricmp( TeamName, g_TeamInfo[i].name ) )\n\t\t\tbreak;\n\t}\n\tif ( i > m_iNumTeams )\n\t{\n\t\treader.Flush();\n\t\treturn 1;\n\t}\n\n\t// use this new score data instead of combined player scores\n\tg_TeamInfo[i].scores_overriden = TRUE;\n\tg_TeamInfo[i].frags = reader.ReadShort();\n\t// g_TeamInfo[i].deaths = reader.ReadShort();\n\n\treturn 1;\n}\n\nvoid CHudScoreboard :: DeathMsg( int killer, int victim )\n{\n\t// if we were the one killed,  or the world killed us, set the scoreboard to indicate suicide\n\tif ( victim == m_iPlayerNum || killer == 0 )\n\t{\n\t\tm_iLastKilledBy = killer ? killer : m_iPlayerNum;\n\t\tm_fLastKillTime = gHUD.m_flTime + 10;\t// display who we were killed by for 10 seconds\n\n\t\tif ( killer == m_iPlayerNum )\n\t\t\tm_iLastKilledBy = m_iPlayerNum;\n\t}\n}\n\n\n\nvoid CHudScoreboard :: UserCmd_ShowScores( void )\n{\n\tm_bForceDraw = false;\n\tm_bShowscoresHeld = true;\n}\n\nvoid CHudScoreboard :: UserCmd_HideScores( void )\n{\n\tm_bForceDraw = m_bShowscoresHeld = false;\n}\n\n\nvoid CHudScoreboard\t:: UserCmd_ShowScoreboard2()\n{\n\tif( gEngfuncs.Cmd_Argc() != 9 )\n\t{\n\t\tConsolePrint(\"showscoreboard2 <xstart> <xend> <ystart> <yend> <r> <g> <b> <a>\");\n\t}\n\n\txstart     = atof(gEngfuncs.Cmd_Argv(1)) * ScreenWidth;\n\txend       = atof(gEngfuncs.Cmd_Argv(2)) * ScreenWidth;\n\tystart     = atof(gEngfuncs.Cmd_Argv(3)) * ScreenHeight;\n\tyend       = atof(gEngfuncs.Cmd_Argv(4)) * ScreenHeight;\n\tm_colors.r = atoi(gEngfuncs.Cmd_Argv(5));\n\tm_colors.b = atoi(gEngfuncs.Cmd_Argv(6));\n\tm_colors.b = atoi(gEngfuncs.Cmd_Argv(7));\n\tm_colors.a = atoi(gEngfuncs.Cmd_Argv(8));\n\tm_bDrawStroke = false;\n\tm_bForceDraw = true;\n}\n\nvoid CHudScoreboard :: UserCmd_HideScoreboard2()\n{\n\tm_bForceDraw = m_bShowscoresHeld = false; // and disable it\n}\n"
  },
  {
    "path": "cl_dll/hud/sniperscope.cpp",
    "content": "/*\nhud_overlays.cpp - HUD Overlays\nCopyright (C) 2015-2016 a1batross\n\nThis program is free software; you can redistribute it and/or modify it\nunder the terms of the GNU General Public License as published by the\nFree Software Foundation; either version 2 of the License, or (at\nyour option) any later version.\n\nThis program is distributed in the hope that it will be useful, but\nWITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\nGeneral Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with this program; if not, write to the Free Software Foundation,\nInc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\n\nIn addition, as a special exception, the author gives permission to\nlink the code of this program with the Half-Life Game Engine (\"HL\nEngine\") and Modified Game Libraries (\"MODs\") developed by Valve,\nL.L.C (\"Valve\").  You must obey the GNU General Public License in all\nrespects for all of the code used other than the HL Engine and MODs\nfrom Valve.  If you modify this file, you may extend this exception\nto your version of the file, but you are not obligated to do so.  If\nyou do not wish to do so, delete this exception statement from your\nversion.\n\n*/\n\n#include \"hud.h\"\n#include \"triangleapi.h\"\n#include \"r_efx.h\"\n#include \"cl_util.h\"\n\n#include \"draw_util.h\"\n\nint CHudSniperScope::Init()\n{\n\tif( g_iXash )\n\t\tgHUD.AddHudElem(this);\n\n\tm_iFlags = HUD_DRAW;\n\tm_iScopeArc[0] = m_iScopeArc[1] =m_iScopeArc[2] = m_iScopeArc[3]  = 0;\n\treturn 1;\n}\n\nint CHudSniperScope::VidInit()\n{\n\tif( g_iXash == 0 )\n\t{\n\t\tConsolePrint(\"^3No Xash Found Warning^7: CHudSniperScope is disabled!\\n\");\n\t\tm_iFlags = 0;\n\t\treturn 0;\n\t}\n\n\tm_iScopeArc[0] = gRenderAPI.GL_LoadTexture(\"sprites/scope_arc_nw.tga\", NULL, 0, TF_NEAREST|TF_NOMIPMAP|TF_CLAMP);\n\tm_iScopeArc[1] = gRenderAPI.GL_LoadTexture(\"sprites/scope_arc_ne.tga\", NULL, 0, TF_NEAREST|TF_NOMIPMAP|TF_CLAMP);\n\tm_iScopeArc[2] = gRenderAPI.GL_LoadTexture(\"sprites/scope_arc.tga\",    NULL, 0, TF_NEAREST|TF_NOMIPMAP|TF_CLAMP);\n\tm_iScopeArc[3] = gRenderAPI.GL_LoadTexture(\"sprites/scope_arc_sw.tga\", NULL, 0, TF_NEAREST|TF_NOMIPMAP|TF_CLAMP);\n\n\tif( !m_iScopeArc[0] || !m_iScopeArc[1] || !m_iScopeArc[2] || !m_iScopeArc[3] )\n\t{\n\t\tgRenderAPI.Host_Error( \"^3Error^7: Cannot load Sniper Scope arcs. Check sprites/scope_arc*.tga files\\n\" );\n\t}\n\t\n\tleft = (TrueWidth - TrueHeight)/2.0;\n\tright = left + TrueHeight;\n\tcenterx = TrueWidth/2.0;\n\tcentery = TrueHeight/2.0;\n\treturn 1;\n}\n\ninline void DrawTexture( int tex, float x1, float y1, float x2, float y2 )\n{\n\tgRenderAPI.GL_Bind( 0, tex );\n\t//gEngfuncs.pTriAPI->Begin( TRI_QUADS );\n\tDrawUtils::Draw2DQuad( x1, y1, x2, y2 );\n\t//gEngfuncs.pTriAPI->End();\n}\n\nint CHudSniperScope::Draw(float flTime)\n{\n\tif(gHUD.m_iFOV > 40)\n\t\treturn 1;\n\n\tgEngfuncs.pTriAPI->RenderMode(kRenderTransColor);\n\tgEngfuncs.pTriAPI->Brightness(1.0);\n\tgEngfuncs.pTriAPI->Color4ub(0, 0, 0, 255);\n\tgEngfuncs.pTriAPI->CullFace(TRI_NONE);\n\n\tgRenderAPI.GL_SelectTexture(0);\n\n\tDrawTexture( m_iScopeArc[0], left, 0, centerx, centery );\n\tDrawTexture( m_iScopeArc[1], centerx, 0, right, centery );\n\tDrawTexture( m_iScopeArc[2], centerx, centery, right, TrueHeight );\n\tDrawTexture( m_iScopeArc[3], left, centery, centerx, TrueHeight );\n\n\tgRenderAPI.GL_Bind( 0, gHUD.m_WhiteTex );\n\t// gEngfuncs.pTriAPI->Begin( TRI_QUADS );\n\t\tDrawUtils::Draw2DQuad( 0, 0, left + 2, TrueHeight );\n\t\tDrawUtils::Draw2DQuad( right, 0, right + ( TrueWidth - right ), TrueHeight );\n\t\n\t// default crosshair pixel perfect lines\n\t\tDrawUtils::Draw2DQuad( left, centery + 1, right, centery + 2 );\n\t\tDrawUtils::Draw2DQuad( centerx - 1, 0, centerx, TrueHeight );\n\t// gEngfuncs.pTriAPI->End();\n\n\treturn 0;\n}\n\nvoid CHudSniperScope::Shutdown()\n{\n\tfor( int i = 0; i < 4; i++ )\n\t\tgRenderAPI.GL_FreeTexture( m_iScopeArc[i] );\n}\n"
  },
  {
    "path": "cl_dll/hud/spectator_gui.cpp",
    "content": "/*\nspectator_gui.cpp - HUD Overlays\nCopyright (C) 2015 a1batross\n\nThis program is free software; you can redistribute it and/or modify it\nunder the terms of the GNU General Public License as published by the\nFree Software Foundation; either version 2 of the License, or (at\nyour option) any later version.\n\nThis program is distributed in the hope that it will be useful, but\nWITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\nGeneral Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with this program; if not, write to the Free Software Foundation,\nInc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\n\nIn addition, as a special exception, the author gives permission to\nlink the code of this program with the Half-Life Game Engine (\"HL\nEngine\") and Modified Game Libraries (\"MODs\") developed by Valve,\nL.L.C (\"Valve\").  You must obey the GNU General Public License in all\nrespects for all of the code used other than the HL Engine and MODs\nfrom Valve.  If you modify this file, you may extend this exception\nto your version of the file, but you are not obligated to do so.  If\nyou do not wish to do so, delete this exception statement from your\nversion.\n*/\n\n#include <string.h>\n\n#include \"hud.h\"\n#include \"cl_util.h\"\n#include \"parsemsg.h\"\n\n#include \"vgui_parser.h\"\n#include \"triangleapi.h\"\n#include \"draw_util.h\"\n\n/*\n * We will draw all elements inside a box. It's size 16x10.\n */\n\n#define XPOS( x ) ( (x) / 16.0f )\n#define YPOS( y ) ( (y) / 10.0f  )\n\n#define INT_XPOS(x) int(XPOS(x) * ScreenWidth)\n#define INT_YPOS(y) int(YPOS(y) * ScreenHeight)\n\nint CHudSpectatorGui::Init()\n{\n\tif( !g_iXash )\n\t\treturn 1;\n\n\tHOOK_MESSAGE( gHUD.m_SpectatorGui, SpecHealth );\n\tHOOK_MESSAGE( gHUD.m_SpectatorGui, SpecHealth2 );\n\n\tHOOK_COMMAND( gHUD.m_SpectatorGui, \"_spec_toggle_menu\", ToggleSpectatorMenu );\n\tHOOK_COMMAND( gHUD.m_SpectatorGui, \"_spec_toggle_menu_options\", ToggleSpectatorMenuOptions );\n\t// close\n\t// help\n\t// settings\n\t// pip\n\t// autodirector\n\t// showscores\n\n\tHOOK_COMMAND( gHUD.m_SpectatorGui, \"_spec_toggle_menu_options_settings\", ToggleSpectatorMenuOptionsSettings );\n\t// settings\n\t// // chat msgs\n\t// // show status\n\t// // view cone\n\t// // player names\n\n\tHOOK_COMMAND( gHUD.m_SpectatorGui, \"_spec_toggle_menu_spectate_options\", ToggleSpectatorMenuSpectateOptions );\n\t// chase map overview\n\t// free map overview\n\t// first person\n\t// free look\n\t// free chase camera\n\t// locked chase camera\n\n\tHOOK_COMMAND_FUNC( \"_spec_find_next_player_reverse\", gHUD.m_Spectator.FindNextPlayer, true );\n\tHOOK_COMMAND_FUNC( \"_spec_find_next_player\", gHUD.m_Spectator.FindNextPlayer, false );\n\n\tgHUD.AddHudElem(this);\n\tm_iFlags = HUD_DRAW;\n\tm_menuFlags = 0;\n\tm_hTimerTexture = 0;\n\treturn 1;\n}\n\nint CHudSpectatorGui::VidInit()\n{\n\tif( !g_iXash )\n\t{\n\t\tConsolePrint(\"Warning: CHudSpectatorGui is disabled! Dude, are you running me on old GoldSrc?\\n\");\n\t\tm_iFlags = 0;\n\t\treturn 0;\n\t}\n\n\tm_hTimerTexture = gRenderAPI.GL_LoadTexture(\"gfx/vgui/timer.tga\", NULL, 0, TF_NEAREST |TF_NOMIPMAP|TF_CLAMP );\n\tm_hChecked     = gRenderAPI.GL_LoadTexture(\"gfx/vgui/640_checked.tga\", NULL, 0, TF_NEAREST | TF_NOMIPMAP | TF_CLAMP );\n\tm_hArrowDown   = gRenderAPI.GL_LoadTexture(\"gfx/vgui/1920_arrowdown.tga\", NULL, 0, TF_NEAREST | TF_NOMIPMAP | TF_CLAMP );\n\tm_hArrowUp     = gRenderAPI.GL_LoadTexture(\"gfx/vgui/1920_arrowup.tga\", NULL, 0, TF_NEAREST | TF_NOMIPMAP | TF_CLAMP );\n\tm_hArrowLeft   = gRenderAPI.GL_LoadTexture(\"gfx/vgui/1920_arrowleft.tga\", NULL, 0, TF_NEAREST | TF_NOMIPMAP | TF_CLAMP );\n\tm_hArrowRight  = gRenderAPI.GL_LoadTexture(\"gfx/vgui/1920_arrowright.tga\", NULL, 0, TF_NEAREST | TF_NOMIPMAP | TF_CLAMP );\n\treturn 1;\n}\n\nvoid CHudSpectatorGui::Shutdown()\n{\n\tgRenderAPI.GL_FreeTexture( m_hTimerTexture );\n\tgRenderAPI.GL_FreeTexture( m_hChecked );\n\tgRenderAPI.GL_FreeTexture( m_hArrowDown );\n\tgRenderAPI.GL_FreeTexture( m_hArrowUp );\n\tgRenderAPI.GL_FreeTexture( m_hArrowLeft );\n\tgRenderAPI.GL_FreeTexture( m_hArrowRight );\n}\n\ninline void DrawButtonWithText( int x1, int y1, int wide, int tall, const char *sz, int r, int g, int b, bool highlight = false )\n{\n\tDrawUtils::DrawRectangle(x1, y1, wide, tall);\n\n\tif ( highlight )\n\t{\n\t\tFillRGBABlend(x1, y1, wide, tall, r, g, b, 48);\n\t}\n\n\tDrawUtils::DrawHudString(x1 + INT_XPOS(0.5), y1 + tall*0.5 - gHUD.GetCharHeight() * 0.5, x1 + wide, sz,\n\t\t\t\t\t\t\t r, g, b );\n}\n\n// Unified icon drawing helper. align: -1 = left, 0 = center, 1 = right\nstatic void DrawIconOnButton( int x1, int y1, int wide, int tall, int hTex, int align = -1, int r = 255, int g = 255, int b = 255, float alpha = 1.0f, int pad = 15 )\n{\n\tif( !hTex )\n\t\treturn;\n\n\tgRenderAPI.GL_SelectTexture( 0 );\n\tgRenderAPI.GL_Bind( 0, hTex );\n\tgEngfuncs.pTriAPI->RenderMode( kRenderTransAlpha );\n\tgEngfuncs.pTriAPI->Color4f( r / 255.0f, g / 255.0f, b / 255.0f, alpha );\n\n\tint uploadW = (int)gRenderAPI.RenderGetParm( PARM_TEX_WIDTH, hTex );\n\tint uploadH = (int)gRenderAPI.RenderGetParm( PARM_TEX_HEIGHT, hTex );\n\n\n\t// compute quad position in pixels\n\tfloat quadX = x1;\n\tfloat quadY = y1 + ( tall - uploadH ) / 2.0f;\n\n\tif( align == -1 ) // left\n\t\tquadX = x1 + pad; // small padding from left\n\telse if( align == 0 ) // center\n\t\tquadX = x1 + ( wide - uploadW ) * 0.5f;\n\telse if( align == 1 ) // right\n\t\tquadX = x1 + wide - uploadW - pad; // small padding from right\n\n\tDrawUtils::Draw2DQuad( quadX * gHUD.m_flScale,\n\t\t\t\t\t\t   quadY * gHUD.m_flScale,\n\t\t\t\t\t\t   (quadX + (float)uploadW) * gHUD.m_flScale,\n\t\t\t\t\t\t   (quadY + (float)uploadH) * gHUD.m_flScale );\n}\n\nint CHudSpectatorGui::Draw( float flTime )\n{\n\tif( !g_iUser1 )\n\t{\n\t\tif( m_menuFlags & ROOT_MENU )\n\t\t{\n\t\t\tUserCmd_ToggleSpectatorMenu(); // this will remove any submenus;\n\t\t\tm_menuFlags = 0;\n\t\t}\n\t\treturn 1;\n\t}\n\n\t// function name says it\n\tCalcAllNeededData( );\n\n\tint r = 255, g = 140, b = 0;\n\n\t// at first, draw these silly black bars\n\tint startpos = 0;\n\tif( gHUD.m_Spectator.m_pip->value != INSET_OFF ) // pip adjust\n\t{\n\t\tstartpos = XRES(gHUD.m_Spectator.m_OverviewData.insetWindowWidth) + XRES(gHUD.m_Spectator.m_OverviewData.insetWindowX);\n\t\tstartpos *= ScreenWidth / TrueWidth; // hud_scale adjust\n\t}\n\tFillRGBABlend(startpos, 0, ScreenWidth - startpos, INT_YPOS(2), 0, 0, 0, 153);\n\tFillRGBABlend(0, ScreenHeight - INT_YPOS(2), ScreenWidth, INT_YPOS(2), 0, 0, 0, 153);\n\n\tif ( gHUD.m_Spectator.m_drawstatus && gHUD.m_Spectator.m_drawstatus->value )\n\t{\n\t\t// divider\n\t\t{\n\t\t\tint divX = INT_XPOS(12.5);\n\t\t\tint divTop = INT_YPOS(2) * 0.25;\n\t\t\tint divBottom = INT_YPOS(2) * 0.5 + gHUD.GetCharHeight();\n\t\t\tint divH = divBottom - divTop;\n\t\t\tif (divH < gHUD.GetCharHeight()) divH = gHUD.GetCharHeight();\n\n\t\t\tint pad = (gHUD.GetCharHeight() * 2) / 3;\n\t\t\tif (pad < 1) pad = 1;\n\n\t\t\tint drawTop = divTop - pad;\n\t\t\tif (drawTop < 0) drawTop = 0;\n\t\t\tint drawH = divH + pad * 2;\n\t\t\tif (drawTop + drawH > ScreenHeight) drawH = ScreenHeight - drawTop;\n\n\t\t\tFillRGBABlend(divX, drawTop, 1, drawH, r, g, b, 255);\n\t\t}\n\n\t\t{ // mapname. extradata\n\t\t\tDrawUtils::DrawHudString( INT_XPOS(12.5) + 10, INT_YPOS(2) * 0.25, ScreenWidth, label.m_szMap, r, g, b );\n\n\t\t\tif( !m_bBombPlanted ) // timer remaining\n\t\t\t{\n\t\t\t\tif( m_hTimerTexture )\n\t\t\t\t{\n\t\t\t\t\tgRenderAPI.GL_SelectTexture( 0 );\n\t\t\t\t\tgRenderAPI.GL_Bind(0, m_hTimerTexture);\n\t\t\t\t\tgEngfuncs.pTriAPI->RenderMode( kRenderTransAlpha );\n\t\t\t\t\tgEngfuncs.pTriAPI->Color4f( 1.0f, 1.0f, 1.0f, 1.0f );\n\n\t\t\t\t\tfloat quadX = INT_XPOS(12.5) + 10;\n\t\t\t\t\tfloat quadY = INT_YPOS(2) * 0.5f;\n\t\t\t\t\tint uploadW = (int)gRenderAPI.RenderGetParm( PARM_TEX_WIDTH, m_hTimerTexture );\n\t\t\t\t\tint uploadH = (int)gRenderAPI.RenderGetParm( PARM_TEX_HEIGHT, m_hTimerTexture );\n\n\t\t\t\t\t// gEngfuncs.pTriAPI->Begin( TRI_QUADS );\n\t\t\t\t\tDrawUtils::Draw2DQuad( quadX * gHUD.m_flScale,\n\t\t\t\t\t\t\t\t\t\tquadY * gHUD.m_flScale,\n\t\t\t\t\t\t\t\t\t\t(quadX + (float)uploadW) * gHUD.m_flScale,\n\t\t\t\t\t\t\t\t\t\t(quadY + (float)uploadH) * gHUD.m_flScale );\n\t\t\t\t\t// gEngfuncs.pTriAPI->End();\n\t\t\t\t}\n\t\t\t\tDrawUtils::DrawHudString( INT_XPOS(12.5) + gHUD.GetCharHeight() * 1.5 + gHUD.GetCharWidth('M') , INT_YPOS(2) * 0.5, ScreenWidth,\n\t\t\t\t\t\t\t\t\t\tlabel.m_szTimer, r, g, b );\n\t\t\t}\n\t\t}\n\n\n\t\t{ // draw team here\n\t\t\tint iLen = DrawUtils::HudStringLen(\"Counter-Terrorists:\" );\n\n\t\t\tDrawUtils::DrawHudString( INT_XPOS(12.5) - iLen - 50 , INT_YPOS(2) * 0.25, INT_XPOS(12.5) - 50, \"Counter-Terrorists:\", r, g, b );\n\t\t\tDrawUtils::DrawHudString( INT_XPOS(12.5) - iLen - 50, INT_YPOS(2) * 0.5, INT_XPOS(12.5) - 50, \"Terrorists:\", r, g, b );\n\t\t\t// count\n\t\t\tDrawUtils::DrawHudNumberString( INT_XPOS(12.5) - 10, INT_YPOS(2) * 0.25, INT_XPOS(12.5) - 50, label.m_iCounterTerrorists, r, g, b );\n\t\t\tDrawUtils::DrawHudNumberString( INT_XPOS(12.5) - 10, INT_YPOS(2) * 0.5,  INT_XPOS(12.5) - 50, label.m_iTerrorists,        r, g, b );\n\t\t}\n\t}\n\n\tif( m_menuFlags & ROOT_MENU )\n\t{\n\t\t// draw the root menu\n\n\t\t// options\n\t\t{\n\t\t\t// highlight when opened\n\t\t\tif( m_menuFlags & MENU_OPTIONS )\n\t\t\t\tDrawButtonWithText(INT_XPOS(0.5),  INT_YPOS(8.5), INT_XPOS(4), INT_YPOS(1), \"Options\", r, g, b, true);\n\t\t\telse\n\t\t\t\tDrawButtonWithText(INT_XPOS(0.5),  INT_YPOS(8.5), INT_XPOS(4), INT_YPOS(1), \"Options\", r, g, b );\n\t\t\t// arrow on right part of button: down when closed, up when open\n\t\t\tif( m_menuFlags & MENU_OPTIONS )\n\t\t\t\tDrawIconOnButton( INT_XPOS(0.5), INT_YPOS(8.5), INT_XPOS(4), INT_YPOS(1), m_hArrowUp, 1, r, g, b );\n\t\t\telse\n\t\t\t\tDrawIconOnButton( INT_XPOS(0.5), INT_YPOS(8.5), INT_XPOS(4), INT_YPOS(1), m_hArrowDown, 1, r, g, b );\n\t\t}\n\n\t\tDrawUtils::DrawRectangle(INT_XPOS(5), INT_YPOS(8.5), INT_XPOS(1), INT_YPOS(1));\n\t\tDrawIconOnButton( INT_XPOS(5), INT_YPOS(8.5), INT_XPOS(1), INT_YPOS(1), m_hArrowLeft, 0, r, g, b );\n\n\t\tDrawUtils::DrawRectangle(INT_XPOS(6), INT_YPOS(8.5), INT_XPOS(4), INT_YPOS(1));\n\t\t// name will be drawn later\n\n\t\tDrawUtils::DrawRectangle(INT_XPOS(10), INT_YPOS(8.5), INT_XPOS(1), INT_YPOS(1));\n\t\tDrawIconOnButton( INT_XPOS(10), INT_YPOS(8.5), INT_XPOS(1), INT_YPOS(1), m_hArrowRight, 0, r, g, b );\n\n\t\t// spectate options\n\t\t{\n\t\t\t// highlight when opened\n\t\t\tif( m_menuFlags & MENU_SPEC_OPTIONS )\n\t\t\t\tDrawButtonWithText(INT_XPOS(11.5), INT_YPOS(8.5), INT_XPOS(4), INT_YPOS(1), \"Spectate Options\", r, g, b, true);\n\t\t\telse\n\t\t\t\tDrawButtonWithText(INT_XPOS(11.5), INT_YPOS(8.5), INT_XPOS(4), INT_YPOS(1), \"Spectate Options\", r, g, b );\n\t\t\t// arrow on right part of button: down when closed, up when open\n\t\t\tif( m_menuFlags & MENU_SPEC_OPTIONS )\n\t\t\t\tDrawIconOnButton( INT_XPOS(11.5), INT_YPOS(8.5), INT_XPOS(4), INT_YPOS(1), m_hArrowUp, 1, r, g, b );\n\t\t\telse\n\t\t\t\tDrawIconOnButton( INT_XPOS(11.5), INT_YPOS(8.5), INT_XPOS(4), INT_YPOS(1), m_hArrowDown, 1, r, g, b );\n\t\t}\n\n\t\tif( m_menuFlags & MENU_OPTIONS )\n\t\t{\n\t\t\tDrawButtonWithText(INT_XPOS(0.5), INT_YPOS(2.5), INT_XPOS(4), INT_YPOS(1), \"Close\", r, g, b );\n\t\t\tDrawButtonWithText(INT_XPOS(0.5), INT_YPOS(3.5), INT_XPOS(4), INT_YPOS(1), \"Help\", r, g, b );\n\t\t\t\n\t\t\t// settings\n\t\t\t{\n\t\t\t\t// highlight when opened\n\t\t\t\tif( m_menuFlags & MENU_OPTIONS_SETTINGS )\n\t\t\t\t\tDrawButtonWithText(INT_XPOS(0.5), INT_YPOS(4.5), INT_XPOS(4), INT_YPOS(1), \"Settings\", r, g, b, true );\n\t\t\t\telse\n\t\t\t\t\tDrawButtonWithText(INT_XPOS(0.5), INT_YPOS(4.5), INT_XPOS(4), INT_YPOS(1), \"Settings\", r, g, b );\n\n\t\t\t\tDrawIconOnButton( INT_XPOS(0.5), INT_YPOS(4.5), INT_XPOS(4), INT_YPOS(1), m_hArrowRight, 1, r, g, b );\n\t\t\t}\n\n\t\t\tDrawButtonWithText(INT_XPOS(0.5), INT_YPOS(5.5), INT_XPOS(4), INT_YPOS(1), \"Picture-in-Picture\", r, g, b );\n\t\t\tif( gHUD.m_Spectator.m_pip && gHUD.m_Spectator.m_pip->value != INSET_OFF )\n\t\t\t\tDrawIconOnButton( INT_XPOS(0.5), INT_YPOS(5.5), INT_XPOS(4), INT_YPOS(1), m_hChecked, -1, r, g, b );\n\n\t\t\tDrawButtonWithText(INT_XPOS(0.5), INT_YPOS(6.5), INT_XPOS(4), INT_YPOS(1), \"Autodirector\", r, g, b );\n\t\t\tif( gHUD.m_Spectator.m_autoDirector && gHUD.m_Spectator.m_autoDirector->value )\n\t\t\t\tDrawIconOnButton( INT_XPOS(0.5), INT_YPOS(6.5), INT_XPOS(4), INT_YPOS(1), m_hChecked, -1, r, g, b );\n\n\t\t\tDrawButtonWithText(INT_XPOS(0.5), INT_YPOS(7.5), INT_XPOS(4), INT_YPOS(1), \"Show scores\", r, g, b );\n\t\t\tif( gHUD.m_Scoreboard.m_bForceDraw || gHUD.m_Scoreboard.m_bShowscoresHeld )\n\t\t\t\tDrawIconOnButton( INT_XPOS(0.5), INT_YPOS(7.5), INT_XPOS(4), INT_YPOS(1), m_hChecked, -1, r, g, b );\n\n\t\t\tif( m_menuFlags & MENU_OPTIONS_SETTINGS )\n\t\t\t{\n\t\t\t\tDrawButtonWithText(INT_XPOS(4.5), INT_YPOS(4.5), INT_XPOS(4), INT_YPOS(1), \"Chat messages\", r, g, b );\n\t\t\t\tif( gHUD.m_Spectator.m_HUD_saytext && gHUD.m_Spectator.m_HUD_saytext->value )\n\t\t\t\t\tDrawIconOnButton( INT_XPOS(4.5), INT_YPOS(4.5), INT_XPOS(4), INT_YPOS(1), m_hChecked, -1, r, g, b );\n\n\t\t\t\tDrawButtonWithText(INT_XPOS(4.5), INT_YPOS(5.5), INT_XPOS(4), INT_YPOS(1), \"Show status\", r, g, b );\n\t\t\t\tif( gHUD.m_Spectator.m_drawstatus && gHUD.m_Spectator.m_drawstatus->value )\n\t\t\t\t\tDrawIconOnButton( INT_XPOS(4.5), INT_YPOS(5.5), INT_XPOS(4), INT_YPOS(1), m_hChecked, -1, r, g, b );\n\n\t\t\t\tDrawButtonWithText(INT_XPOS(4.5), INT_YPOS(6.5), INT_XPOS(4), INT_YPOS(1), \"View cone\", r, g, b );\n\t\t\t\tif( gHUD.m_Spectator.m_drawcone && gHUD.m_Spectator.m_drawcone->value )\n\t\t\t\t\tDrawIconOnButton( INT_XPOS(4.5), INT_YPOS(6.5), INT_XPOS(4), INT_YPOS(1), m_hChecked, -1, r, g, b );\n\n\t\t\t\tDrawButtonWithText(INT_XPOS(4.5), INT_YPOS(7.5), INT_XPOS(4), INT_YPOS(1), \"Player names\", r, g, b );\n\t\t\t\tif( gHUD.m_Spectator.m_drawnames && gHUD.m_Spectator.m_drawnames->value )\n\t\t\t\t\tDrawIconOnButton( INT_XPOS(4.5), INT_YPOS(7.5), INT_XPOS(4), INT_YPOS(1), m_hChecked, -1, r, g, b );\n\t\t\t}\n\t\t}\n\n\t\tif( m_menuFlags & MENU_SPEC_OPTIONS )\n\t\t{\n\t\t\tDrawButtonWithText(INT_XPOS(11.5), INT_YPOS(2.5), INT_XPOS(4), INT_YPOS(1), \"Chase Map Overview\", r, g, b );\n\t\t\tDrawButtonWithText(INT_XPOS(11.5), INT_YPOS(3.5), INT_XPOS(4), INT_YPOS(1), \"Free Map Overview\", r, g, b );\n\t\t\tDrawButtonWithText(INT_XPOS(11.5), INT_YPOS(4.5), INT_XPOS(4), INT_YPOS(1), \"First Person\", r, g, b );\n\t\t\tDrawButtonWithText(INT_XPOS(11.5), INT_YPOS(5.5), INT_XPOS(4), INT_YPOS(1), \"Free look\", r, g, b );\n\t\t\tDrawButtonWithText(INT_XPOS(11.5), INT_YPOS(6.5), INT_XPOS(4), INT_YPOS(1), \"Free Chase Camera\", r, g, b );\n\t\t\tDrawButtonWithText(INT_XPOS(11.5), INT_YPOS(7.5), INT_XPOS(4), INT_YPOS(1), \"Locked Chase Camera\", r, g, b );\n\t\t}\n\t}\n\n\t//if( !label.m_szNameAndHealth[0] )\n\t//{\n\t\tint iLen = DrawUtils::HudStringLen( label.m_szNameAndHealth );\n\t\tGetTeamColor( r, g, b, g_PlayerExtraInfo[ g_iUser2 ].teamnumber );\n\t\tDrawUtils::DrawHudString( ScreenWidth * 0.5 - iLen * 0.5, INT_YPOS(9) - gHUD.GetCharHeight() * 0.5 , ScreenWidth,\n\t\t\t\t\t\t\t\t  label.m_szNameAndHealth, r, g, b );\n\t//}\n\n\treturn 1;\n}\n\nvoid CHudSpectatorGui::CalcAllNeededData( )\n{\n\t// mapname\n\tif( !label.m_szMap[0] )\n\t{\n\t\tstatic char szMapNameStripped[55];\n\t\tconst char *szMapName = gEngfuncs.pfnGetLevelName(); //  \"maps/%s.bsp\"\n\t\tstrncpy( szMapNameStripped, szMapName + 5, sizeof( szMapNameStripped ) );\n\t\tszMapNameStripped[strlen(szMapNameStripped) - 4] = '\\0';\n\t\tsnprintf( label.m_szMap, sizeof( label.m_szMap ), \"Map: %s\", szMapNameStripped );\n\t}\n\n\t// team\n\t/*label.m_iTerrorists        = 0;\n\tlabel.m_iCounterTerrorists = 0;\n\tfor( int i = 0; i < MAX_PLAYERS; i++ )\n\t{\n\t\tif( g_PlayerExtraInfo[i].dead )\n\t\t\tcontinue; // show remaining\n\n\t\tswitch( g_PlayerExtraInfo[i].teamnumber )\n\t\t{\n\t\tcase TEAM_CT:\n\t\t\tlabel.m_iCounterTerrorists++;\n\t\tcase TEAM_TERRORIST:\n\t\t\tlabel.m_iTerrorists++;\n\t\t}\n\t}*/\n\n\tlabel.m_iCounterTerrorists = 0;\n\tlabel.m_iTerrorists = 0;\n\tfor( int i = 1; i <= gHUD.m_Scoreboard.m_iNumTeams; i++ )\n\t{\n\t\tswitch( g_TeamInfo[i].teamnumber )\n\t\t{\n\t\tcase TEAM_CT:\n\t\t\tlabel.m_iCounterTerrorists = g_TeamInfo[i].frags;\n\t\t\tbreak;\n\t\tcase TEAM_TERRORIST:\n\t\t\tlabel.m_iTerrorists = g_TeamInfo[i].frags;\n\t\t\tbreak;\n\t\t}\n\t}\n\n\t// timer\n\t// time must be positive\n\tif( !m_bBombPlanted )\n\t{\n\t\tint iMinutes = max( 0, (int)( gHUD.m_Timer.m_iTime + gHUD.m_Timer.m_fStartTime - gHUD.m_flTime ) / 60);\n\t\tint iSeconds = max( 0, (int)( gHUD.m_Timer.m_iTime + gHUD.m_Timer.m_fStartTime - gHUD.m_flTime ) - (iMinutes * 60));\n\n\t\tsprintf( label.m_szTimer, \"%i:%02i\", iMinutes, iSeconds );\n\t}\n\n\t// player name\n\tif( g_iUser2 > 0 && g_iUser2 < MAX_PLAYERS )\n\t{\n\t\thud_player_info_t sInfo;\n\t\tGetPlayerInfo( g_iUser2, &sInfo );\n\n\t\tsnprintf( label.m_szNameAndHealth, sizeof( label.m_szNameAndHealth ),\n\t\t\t\t  \"%s (%i)\",  sInfo.name, g_PlayerExtraInfo[g_iUser2].health );\n\t}\n\telse label.m_szNameAndHealth[0] = '\\0';\n}\n\nvoid CHudSpectatorGui::InitHUDData()\n{\n\tm_bBombPlanted = false;\n\tlabel.m_szMap[0] = '\\0';\n}\n\nvoid CHudSpectatorGui::Reset()\n{\n\tm_bBombPlanted = false;\n\tif( m_menuFlags & ROOT_MENU )\n\t{\n\t\tUserCmd_ToggleSpectatorMenu(); // this will remove any submenus;\n\t\tm_menuFlags = 0;\n\t}\n}\n\nint CHudSpectatorGui::MsgFunc_SpecHealth(const char *pszName, int iSize, void *buf)\n{\n\tBufferReader reader( pszName, buf, iSize );\n\n\tint health = reader.ReadByte();\n\n\tg_PlayerExtraInfo[g_iUser2].health = health;\n\tgHUD.m_Health.m_iPlayerLastPointedAt = g_iUser2;\n\n\treturn 1;\n}\n\nint CHudSpectatorGui::MsgFunc_SpecHealth2(const char *pszName, int iSize, void *buf)\n{\n\tBufferReader reader( pszName, buf, iSize );\n\n\tint health = reader.ReadByte();\n\tint client = reader.ReadByte();\n\n\tg_PlayerExtraInfo[client].health = health;\n\tgHUD.m_Health.m_iPlayerLastPointedAt = g_iUser2;\n\n\treturn 1;\n}\n\n#define PLACE_DEFAULT_SIZE_BUTTON_AT_X_Y(x, y) XPOS(x), YPOS(y), XPOS(x + 4.0f), YPOS(y + 1.0f)\n\nvoid CHudSpectatorGui::UserCmd_ToggleSpectatorMenu()\n{\n\tstatic byte color[4] = {0, 0, 0, 0};\n\n\tif( !g_iMobileAPIVersion )\n\t\treturn;\n\n\tgMobileAPI.pfnTouchSetClientOnly( !(m_menuFlags & ROOT_MENU) );\n\n\tif( !(m_menuFlags & ROOT_MENU) )\n\t{\n\t\tm_menuFlags |= ROOT_MENU;\n\n\t\tgMobileAPI.pfnTouchAddClientButton( \"_spec_menu_options\", \"*white\", \"_spec_toggle_menu_options\",\n\t\t\tPLACE_DEFAULT_SIZE_BUTTON_AT_X_Y( 0.5f, 8.5f ), color, 0, 1.0f, 0 );\n\n\t\tgMobileAPI.pfnTouchAddClientButton( \"_spec_menu_find_next_player_reverse\", \"*white\", \"_spec_find_next_player_reverse\",\n\t\t\tXPOS(5.0f), YPOS(8.5f), XPOS(6.0f), YPOS(9.5f), color, 0, 1.0f, 0 );\n\n\t\tgMobileAPI.pfnTouchAddClientButton( \"_spec_menu_find_next_player\", \"*white\", \"_spec_find_next_player\",\n\t\t\tXPOS(10.0f),YPOS(8.5f), XPOS(11.0f),YPOS(9.5f), color, 0, 1.0f, 0 );\n\n\t\tgMobileAPI.pfnTouchAddClientButton( \"_spec_menu_spectate_options\", \"*white\", \"_spec_toggle_menu_spectate_options\",\n\t\t\tPLACE_DEFAULT_SIZE_BUTTON_AT_X_Y( 11.5f, 8.5f ),color, 0, 1.0f, 0 );\n\t}\n\telse\n\t{\n\t\tm_menuFlags &= ~ROOT_MENU;\n\t\tm_menuFlags &= ~MENU_OPTIONS;\n\t\tm_menuFlags &= ~MENU_OPTIONS_SETTINGS;\n\t\tm_menuFlags &= ~MENU_SPEC_OPTIONS;\n\t\tgMobileAPI.pfnTouchRemoveButton( \"_spec_*\" );\n\t}\n}\n\nvoid CHudSpectatorGui::UserCmd_ToggleSpectatorMenuOptions()\n{\n\tstatic byte color[4] = {0, 0, 0, 0};\n\n\tif( !(m_menuFlags & ROOT_MENU) || !g_iMobileAPIVersion )\n\t\treturn;\n\n\tif( !(m_menuFlags & MENU_OPTIONS) )\n\t{\n\t\tm_menuFlags |= MENU_OPTIONS;\n\t\tgMobileAPI.pfnTouchAddClientButton( \"_spec_opt_close\", \"*white\", \"_spec_toggle_menu\",\n\t\t\tPLACE_DEFAULT_SIZE_BUTTON_AT_X_Y( 0.5f, 2.5f ), color, 0, 1.0f, 0 );\n\t\tgMobileAPI.pfnTouchAddClientButton( \"_spec_opt_help\", \"*white\", \"spec_help; _spec_toggle_menu_options\",\n\t\t\tPLACE_DEFAULT_SIZE_BUTTON_AT_X_Y( 0.5f, 3.5f ), color, 0, 1.0f, 0 );\n\t\tgMobileAPI.pfnTouchAddClientButton( \"_spec_opt_settings\", \"*white\", \"_spec_toggle_menu_options_settings\",\n\t\t\tPLACE_DEFAULT_SIZE_BUTTON_AT_X_Y( 0.5f, 4.5f ), color, 0, 1.0f, 0 );\n\t\tgMobileAPI.pfnTouchAddClientButton( \"_spec_opt_pip\", \"*white\", \"spec_pip t; _spec_toggle_menu_options\",\n\t\t\tPLACE_DEFAULT_SIZE_BUTTON_AT_X_Y( 0.5f, 5.5f ), color, 0, 1.0f, 0 );\n\t\tgMobileAPI.pfnTouchAddClientButton( \"_spec_opt_ad\", \"*white\", \"spec_autodirector t; _spec_toggle_menu_options\",\n\t\t\tPLACE_DEFAULT_SIZE_BUTTON_AT_X_Y( 0.5f, 6.5f ), color, 0, 1.0f, 0 );\n\t\tgMobileAPI.pfnTouchAddClientButton( \"_spec_opt_showscores\", \"*white\", \"_spec_toggle_menu_options; scoreboard\",\n\t\t\tPLACE_DEFAULT_SIZE_BUTTON_AT_X_Y( 0.5f, 7.5f ), color, 0, 1.0f, 0 );\n\t}\n\telse\n\t{\n\t\tm_menuFlags &= ~MENU_OPTIONS;\n\t\tm_menuFlags &= ~MENU_OPTIONS_SETTINGS;\n\t\tgMobileAPI.pfnTouchRemoveButton( \"_spec_opt_*\" );\n\t}\n}\n\nvoid CHudSpectatorGui::UserCmd_ToggleSpectatorMenuOptionsSettings()\n{\n\tstatic byte color[4] = {0, 0, 0, 0};\n\n\tif( !(m_menuFlags & ROOT_MENU) || !g_iMobileAPIVersion )\n\t\treturn;\n\n\tif( !(m_menuFlags & MENU_OPTIONS_SETTINGS) )\n\t{\n\t\tm_menuFlags |= MENU_OPTIONS_SETTINGS;\n\t\tgMobileAPI.pfnTouchAddClientButton( \"_spec_opt_chat_msgs\", \"*white\", \"hud_saytext t; _spec_toggle_menu_options_settings\",\n\t\t\tPLACE_DEFAULT_SIZE_BUTTON_AT_X_Y( 4.5f, 4.5f ), color, 0, 1.0f, 0 );\n\t\tgMobileAPI.pfnTouchAddClientButton( \"_spec_opt_set_status\", \"*white\", \"spec_drawstatus t; _spec_toggle_menu_options_settings\",\n\t\t\tPLACE_DEFAULT_SIZE_BUTTON_AT_X_Y( 4.5f, 5.5f ), color, 0, 1.0f, 0 );\n\t\tgMobileAPI.pfnTouchAddClientButton( \"_spec_opt_draw_cones\", \"*white\", \"spec_drawcone t; _spec_toggle_menu_options_settings\",\n\t\t\tPLACE_DEFAULT_SIZE_BUTTON_AT_X_Y( 4.5f, 6.5f ), color, 0, 1.0f, 0 );\n\t\tgMobileAPI.pfnTouchAddClientButton( \"_spec_opt_draw_names\", \"*white\", \"spec_drawnames t; _spec_toggle_menu_options_settings\",\n\t\t\tPLACE_DEFAULT_SIZE_BUTTON_AT_X_Y( 4.5f, 7.5f ), color, 0, 1.0f, 0 );\n\t}\n\telse\n\t{\n\t\tm_menuFlags &= ~MENU_OPTIONS_SETTINGS;\n\t\tgMobileAPI.pfnTouchRemoveButton( \"_spec_opt_set_*\" );\n\t}\n}\n\nvoid CHudSpectatorGui::UserCmd_ToggleSpectatorMenuSpectateOptions()\n{\n\tstatic byte color[4] = {0, 0, 0, 0};\n\n\tif( !(m_menuFlags & ROOT_MENU) || !g_iMobileAPIVersion )\n\t\treturn;\n\n\tif( !(m_menuFlags & MENU_SPEC_OPTIONS) )\n\t{\n\t\tm_menuFlags |= MENU_SPEC_OPTIONS;\n\t\tgMobileAPI.pfnTouchAddClientButton( \"_spec_spec_6\", \"*white\", \"spec_mode 6; _spec_toggle_menu_spectate_options\",\n\t\t\tPLACE_DEFAULT_SIZE_BUTTON_AT_X_Y( 11.5f, 2.5f ), color, 0, 1.0f, 0 );\n\t\tgMobileAPI.pfnTouchAddClientButton( \"_spec_spec_5\", \"*white\", \"spec_mode 5; _spec_toggle_menu_spectate_options\",\n\t\t\tPLACE_DEFAULT_SIZE_BUTTON_AT_X_Y( 11.5f, 3.5f ), color, 0, 1.0f, 0 );\n\t\tgMobileAPI.pfnTouchAddClientButton( \"_spec_spec_4\", \"*white\", \"spec_mode 4; _spec_toggle_menu_spectate_options\",\n\t\t\tPLACE_DEFAULT_SIZE_BUTTON_AT_X_Y( 11.5f, 4.5f ), color, 0, 1.0f, 0 );\n\t\tgMobileAPI.pfnTouchAddClientButton( \"_spec_spec_3\", \"*white\", \"spec_mode 3; _spec_toggle_menu_spectate_options\",\n\t\t\tPLACE_DEFAULT_SIZE_BUTTON_AT_X_Y( 11.5f, 5.5f ), color, 0, 1.0f, 0 );\n\t\tgMobileAPI.pfnTouchAddClientButton( \"_spec_spec_2\", \"*white\", \"spec_mode 2; _spec_toggle_menu_spectate_options\",\n\t\t\tPLACE_DEFAULT_SIZE_BUTTON_AT_X_Y( 11.5f, 6.5f ), color, 0, 1.0f, 0 );\n\t\tgMobileAPI.pfnTouchAddClientButton( \"_spec_spec_1\", \"*white\", \"spec_mode 1; _spec_toggle_menu_spectate_options\",\n\t\t\tPLACE_DEFAULT_SIZE_BUTTON_AT_X_Y( 11.5f, 7.5f ), color, 0, 1.0f, 0 );\n\t}\n\telse\n\t{\n\t\tm_menuFlags &= ~MENU_SPEC_OPTIONS;\n\t\tgMobileAPI.pfnTouchRemoveButton( \"_spec_spec_*\" );\n\t}\n}\n"
  },
  {
    "path": "cl_dll/hud/timer.cpp",
    "content": "/*\ntimer.cpp -- HUD timer, progress bars, etc\nCopyright (C) 2015-2016 a1batross\nThis program is free software; you can redistribute it and/or modify it\nunder the terms of the GNU General Public License as published by the\nFree Software Foundation; either version 2 of the License, or (at\nyour option) any later version.\n\nThis program is distributed in the hope that it will be useful, but\nWITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\nGeneral Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with this program; if not, write to the Free Software Foundation,\nInc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\n\nIn addition, as a special exception, the author gives permission to\nlink the code of this program with the Half-Life Game Engine (\"HL\nEngine\") and Modified Game Libraries (\"MODs\") developed by Valve,\nL.L.C (\"Valve\").  You must obey the GNU General Public License in all\nrespects for all of the code used other than the HL Engine and MODs\nfrom Valve.  If you modify this file, you may extend this exception\nto your version of the file, but you are not obligated to do so.  If\nyou do not wish to do so, delete this exception statement from your\nversion.\n*/\n\n#include \"stdio.h\"\n#include \"stdlib.h\"\n#include \"math.h\"\n\n#include \"hud.h\"\n#include \"cl_util.h\"\n#include \"parsemsg.h\"\n#include \"vgui_parser.h\"\n#include <string.h>\n#include \"draw_util.h\"\n\nint CHudTimer::Init()\n{\n\tHOOK_MESSAGE( gHUD.m_Timer, RoundTime );\n\tHOOK_MESSAGE( gHUD.m_Timer, ShowTimer );\n\tm_iFlags = 0;\n\tm_bPanicColorChange = false;\n\tgHUD.AddHudElem(this);\n\treturn 1;\n}\n\nint CHudTimer::VidInit()\n{\n\tm_HUD_timer = gHUD.GetSpriteIndex( \"stopwatch\" );\n\treturn 1;\n}\n\nint CHudTimer::Draw( float fTime )\n{\n\tif ( ( gHUD.m_iHideHUDDisplay & HIDEHUD_HEALTH ) )\n\t\treturn 1;\n\n\tif (!(gHUD.m_iWeaponBits & (1<<(WEAPON_SUIT)) ))\n\t\treturn 1;\n\tint r, g, b;\n\t// time must be positive\n\tint minutes = max( 0, (int)( m_iTime + m_fStartTime - gHUD.m_flTime ) / 60);\n\tint seconds = max( 0, (int)( m_iTime + m_fStartTime - gHUD.m_flTime ) - (minutes * 60));\n\n\tif( minutes * 60 + seconds > 20 )\n\t{\n\t\tDrawUtils::UnpackRGB( r, g, b, gHUD.m_iDefaultHUDColor );\n\t}\n\telse\n\t{\n\t\tm_flPanicTime += gHUD.m_flTimeDelta;\n\t\t// add 0.1 sec, so it's not flicker fast\n\t\tif( m_flPanicTime > ((float)seconds / 40.0f) + 0.1f)\n\t\t{\n\t\t\tm_flPanicTime = 0;\n\t\t\tm_bPanicColorChange = !m_bPanicColorChange;\n\t\t}\n\t\tDrawUtils::UnpackRGB( r, g, b, m_bPanicColorChange ? gHUD.m_iDefaultHUDColor : RGB_REDISH );\n\t}\n\n\tDrawUtils::ScaleColors( r, g, b, MIN_ALPHA );\n\n\tint iWatchWidth = gHUD.GetSpriteRect(m_HUD_timer).Width();\n\tint iDigitWidth = gHUD.GetSpriteRect(gHUD.m_HUD_number_0).Width();\n\tint iColonWidth = iDigitWidth / 2;\n\n\t// Always reserve space for 2 digits for minutes to keep layout consistent\n\tint totalWidth = iWatchWidth + 2 * iDigitWidth + iColonWidth + 2 * iDigitWidth;\n\n\tint x = (ScreenWidth - totalWidth) / 2;\n\tint y = ScreenHeight - 1.5 * gHUD.m_iFontHeight;\n\n\tSPR_Set(gHUD.GetSprite(m_HUD_timer), r, g, b);\n\tSPR_DrawAdditive(0, x, y, &gHUD.GetSpriteRect(m_HUD_timer));\n\tx += iWatchWidth;\n\n\tif (minutes < 10)\n\t\t// Shift x to the right by one digit width to reserve space for the leading zero, then draw 1 digit without the leading zero\n\t\tx = DrawUtils::DrawHudNumber2(x + iDigitWidth, y, false, 1, minutes, r, g, b);\n\telse\n\t\t// Draw 2 digits, including the leading zero if needed\n\t\tx = DrawUtils::DrawHudNumber2(x, y, true, 2, minutes, r, g, b);\n\n\t// Draw colon (\":\")\n\tFillRGBA(x + iColonWidth / 2, y + gHUD.m_iFontHeight / 4, 2, 2, r, g, b, 100);\n\tFillRGBA(x + iColonWidth / 2, y + gHUD.m_iFontHeight - gHUD.m_iFontHeight / 4, 2, 2, r, g, b, 100);\n\tx += iColonWidth;\n\n\tm_right = DrawUtils::DrawHudNumber2(x, y, true, 2, seconds, r, g, b);\n\n\treturn 1;\n}\n\nint CHudTimer::MsgFunc_RoundTime(const char *pszName, int iSize, void *pbuf)\n{\n\tBufferReader reader( pszName, pbuf, iSize );\n\tm_iTime = reader.ReadShort();\n\tm_fStartTime = gHUD.m_flTime;\n\tm_iFlags = HUD_DRAW;\n\treturn 1;\n}\n\nint CHudTimer::MsgFunc_ShowTimer(const char *pszName, int iSize, void *pbuf)\n{\n\tm_iFlags = HUD_DRAW;\n\treturn 1;\n}\n\n#define UPDATE_BOTPROGRESS 0\n#define CREATE_BOTPROGRESS 1\n#define REMOVE_BOTPROGRESS 2\n\nint CHudProgressBar::Init()\n{\n\tHOOK_MESSAGE( gHUD.m_ProgressBar, BarTime );\n\tHOOK_MESSAGE( gHUD.m_ProgressBar, BarTime2 );\n\tHOOK_MESSAGE( gHUD.m_ProgressBar, BotProgress );\n\tReset( );\n\tgHUD.AddHudElem(this);\n\treturn 1;\n}\n\nint CHudProgressBar::VidInit()\n{\n\treturn 1;\n}\n\nvoid CHudProgressBar::Reset( void )\n{\n\tm_iFlags = 0;\n\tm_szLocalizedHeader = NULL;\n\tm_szHeader[0] = '\\0';\n\tm_fStartTime = m_fPercent = 0.0f;\n}\n\nint CHudProgressBar::Draw( float flTime )\n{\n\t// allow only 0.0..1.0\n\tif( (m_fPercent < 0.0f) || (m_fPercent > 1.0f) )\n\t{\n\t\tm_iFlags = 0;\n\t\tm_fPercent = 0.0f;\n\t\treturn 1;\n\t}\n\n\tif( m_szLocalizedHeader && m_szLocalizedHeader[0] )\n\t{\n\t\tint r, g, b;\n\t\tDrawUtils::UnpackRGB( r, g, b, gHUD.m_iDefaultHUDColor );\n\t\tDrawUtils::DrawHudString( ScreenWidth / 4, ScreenHeight / 2, ScreenWidth, (char*)m_szLocalizedHeader, r, g, b );\n\n\t\tDrawUtils::DrawRectangle( ScreenWidth/ 4, ScreenHeight / 2 + gHUD.GetCharHeight(), ScreenWidth/2, ScreenHeight/30 );\n\t\tFillRGBA( ScreenWidth/4+2, ScreenHeight/2 + gHUD.GetCharHeight() + 2, m_fPercent * (ScreenWidth/2-4), ScreenHeight/30-4, 255, 140, 0, 255 );\n\t\treturn 1;\n\t}\n\n\t// prevent SIGFPE\n\tif( m_iDuration != 0.0f )\n\t{\n\t\tm_fPercent = ((flTime - m_fStartTime) / m_iDuration);\n\t}\n\telse\n\t{\n\t\tm_fPercent = 0.0f;\n\t\tm_iFlags = 0;\n\t\treturn 1;\n\t}\n\n\tDrawUtils::DrawRectangle( ScreenWidth/4, ScreenHeight*2/3, ScreenWidth/2, 10 );\n\tFillRGBA( ScreenWidth/4+2, ScreenHeight*2/3+2, m_fPercent * (ScreenWidth/2-4), 6, 255, 140, 0, 255 );\n\n\treturn 1;\n}\n\nint CHudProgressBar::MsgFunc_BarTime(const char *pszName, int iSize, void *pbuf)\n{\n\tBufferReader reader( pszName, pbuf, iSize );\n\n\tm_iDuration = reader.ReadShort();\n\tm_fPercent = 0.0f;\n\n\tm_fStartTime = gHUD.m_flTime;\n\n\tm_iFlags = HUD_DRAW;\n\treturn 1;\n}\n\nint CHudProgressBar::MsgFunc_BarTime2(const char *pszName, int iSize, void *pbuf)\n{\n\tBufferReader reader( pszName, pbuf, iSize );\n\n\tm_iDuration = reader.ReadShort();\n\tm_fPercent = m_iDuration * (float)reader.ReadShort() / 100.0f;\n\n\tm_fStartTime = gHUD.m_flTime;\n\n\tm_iFlags = HUD_DRAW;\n\treturn 1;\n}\n\nint CHudProgressBar::MsgFunc_BotProgress(const char *pszName, int iSize, void *pbuf)\n{\n\tBufferReader reader( pszName, pbuf, iSize );\n\tm_iDuration = 0.0f; // don't update our progress bar\n\tm_iFlags = HUD_DRAW;\n\n\tfloat fNewPercent;\n\tint flag = reader.ReadByte();\n\tswitch( flag )\n\t{\n\tcase CREATE_BOTPROGRESS:\n\t\tm_fPercent = 0.0f;\n\t\tbreak;\n\tcase UPDATE_BOTPROGRESS:\n\t\tfNewPercent = (float)reader.ReadByte() / 100.0f;\n\t\t// cs behavior:\n\t\t// just don't decrease percent values\n\t\tif( m_fPercent < fNewPercent )\n\t\t{\n\t\t\tm_fPercent = fNewPercent;\n\t\t}\n\t\tstrncpy(m_szHeader, reader.ReadString(), sizeof(m_szHeader));\n\t\tm_szHeader[sizeof(m_szHeader)-1] = 0;\n\n\t\tif( m_szHeader[0] == '#' )\n\t\t\tm_szLocalizedHeader = Localize(m_szHeader + 1);\n\t\telse\n\t\t\tm_szLocalizedHeader = m_szHeader;\n\t\tbreak;\n\tcase REMOVE_BOTPROGRESS:\n\tdefault:\n\t\tm_fPercent = 0.0f;\n\t\tm_szHeader[0] = '\\0';\n\t\tm_iFlags = 0;\n\t\tm_szLocalizedHeader = NULL;\n\t\tbreak;\n\t}\n\n\treturn 1;\n}\n"
  },
  {
    "path": "cl_dll/hud.cpp",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\t\n*\tThis product contains software technology licensed from Id \n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc. \n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n//\n// hud.cpp\n//\n// implementation of CHud class\n//\n\n#include <new>\n\n#include \"hud.h\"\n#include \"cl_util.h\"\n#include <string.h>\n#include <stdio.h>\n#include <assert.h>\n#include \"parsemsg.h\"\n\n#include \"demo.h\"\n#include \"demo_api.h\"\n#include \"vgui_parser.h\"\n#include \"rain.h\"\n\n#include \"camera.h\"\n\n#include \"draw_util.h\"\n\n#if _WIN32\n#define strncasecmp _strnicmp\n#endif\n\ncvar_t *cl_fog_r;\ncvar_t *cl_fog_g;\ncvar_t *cl_fog_b;\ncvar_t *cl_fog_density;\n\nextern client_sprite_t *GetSpriteList(client_sprite_t *pList, const char *psz, int iRes, int iCount);\n\n// Team Colors\nint iNumberOfTeamColors = 3;\nint iTeamColors[3][3] =\n{\n\t{ 204, 204, 204 }, // Spectators\n\t{ 255, 64, 64 }, // CT's\n\t{ 153, 204, 255 }  // T's\n};\n\nclass CCStrikeVoiceStatusHelper : public IVoiceStatusHelper\n{\npublic:\n\tvirtual void GetPlayerTextColor( int entindex, int color[3] )\n\t{\n\t\tcolor[0] = color[1] = color[2] = 255;\n\n\t\tif ( entindex < MAX_PLAYERS )\n\t\t{\n\t\t\tint iTeam = g_PlayerExtraInfo[entindex].teamnumber;\n\n\t\t\tif ( iTeam < 0 )\n\t\t\t{\n\t\t\t\tiTeam = 0;\n\t\t\t}\n\n\t\t\tiTeam = iTeam % iNumberOfTeamColors;\n\n\t\t\tcolor[0] = iTeamColors[iTeam][0];\n\t\t\tcolor[1] = iTeamColors[iTeam][1];\n\t\t\tcolor[2] = iTeamColors[iTeam][2];\n\t\t}\n\t}\n\n\tvirtual void UpdateCursorState()\n\t{\n\t\t// gViewPort->UpdateCursorState();\n\t}\n\n\tvirtual int GetAckIconHeight()\n\t{\n\t\treturn gHUD.m_iFontHeight * 3 + 6;\n\t}\n\n\tvirtual bool CanShowSpeakerLabels()\n\t{\n\t\treturn !gHUD.m_Scoreboard.m_bForceDraw && !gHUD.m_Scoreboard.m_bShowscoresHeld;\n\t}\n\n\tconst char *GetPlayerLocation( int entindex ) override\n\t{\n\t\tif ( entindex >= 1 && entindex <= MAX_PLAYERS )\n\t\t{\n\t\t\treturn g_PlayerExtraInfo[entindex].location;\n\t\t}\n\n\t\treturn \"\";\n\t}\n};\nstatic CCStrikeVoiceStatusHelper g_VoiceStatusHelper;\n\nwrect_t nullrc = { 0, 0, 0, 0 };\nfloat g_lastFOV = 0.0;\nconst char *sPlayerModelFiles[12] =\n{\n\t\"models/player.mdl\",\n\t\"models/player/leet/leet.mdl\", // t\n\t\"models/player/gign/gign.mdl\", // ct\n\t\"models/player/vip/vip.mdl\", //ct\n\t\"models/player/gsg9/gsg9.mdl\", // ct\n\t\"models/player/guerilla/guerilla.mdl\", // t\n\t\"models/player/arctic/arctic.mdl\", // t\n\t\"models/player/sas/sas.mdl\", // ct\n\t\"models/player/terror/terror.mdl\", // t\n\t\"models/player/urban/urban.mdl\", // ct\n\t\"models/player/spetsnaz/spetsnaz.mdl\", // ct\n\t\"models/player/militia/militia.mdl\" // t\n};\n\nvoid __CmdFunc_InputCommandSpecial()\n{\n#ifdef _CS16CLIENT_ALLOW_SPECIAL_SCRIPTING\n\tgEngfuncs.pfnClientCmd(\"_special\");\n#endif\n}\n\nvoid __CmdFunc_GunSmoke()\n{\n\tif( gHUD.cl_gunsmoke->value )\n\t\tgEngfuncs.Cvar_SetValue( \"cl_gunsmoke\", 0 );\n\telse\n\t\tgEngfuncs.Cvar_SetValue( \"cl_gunsmoke\", 1 );\n}\n\n/*\n============\nCOM_FileBase\n============\n*/\n// Extracts the base name of a file (no path, no extension, assumes '/' as path separator)\nvoid COM_FileBase ( const char *in, char *out)\n{\n\tint len, start, end;\n\n\tlen = strlen( in );\n\n\t// scan backward for '.'\n\tend = len - 1;\n\twhile ( end && in[end] != '.' && in[end] != '/' && in[end] != '\\\\' )\n\t\tend--;\n\n\tif ( in[end] != '.' )\t\t// no '.', copy to end\n\t\tend = len-1;\n\telse\n\t\tend--;\t\t\t\t\t// Found ',', copy to left of '.'\n\n\n\t// Scan backward for '/'\n\tstart = len-1;\n\twhile ( start >= 0 && in[start] != '/' && in[start] != '\\\\' )\n\t\tstart--;\n\n\tif ( in[start] != '/' && in[start] != '\\\\' )\n\t\tstart = 0;\n\telse\n\t\tstart++;\n\n\t// Length of new sting\n\tlen = end - start + 1;\n\n\t// Copy partial string\n\tstrncpy( out, &in[start], len );\n\t// Terminate it\n\tout[len] = 0;\n}\n\n/*\n=================\nHUD_IsGame\n\n=================\n*/\nint HUD_IsGame( const char *game )\n{\n\tconst char *gamedir;\n\tchar gd[ 1024 ];\n\n\tgamedir = gEngfuncs.pfnGetGameDirectory();\n\tif ( gamedir && gamedir[0] )\n\t{\n\t\tCOM_FileBase( gamedir, gd );\n\t\tif ( !stricmp( gd, game ) )\n\t\t\treturn 1;\n\t}\n\treturn 0;\n}\n\n#define XASH_GENERATE_BUILDNUM\n\n#if defined(XASH_GENERATE_BUILDNUM)\nstatic const char *date = __DATE__;\nstatic const char *mon[12] = { \"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\" };\nstatic char mond[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };\n#endif\n\nchar *Q_buildnum( void )\n{\n// do not touch this! Only author of Xash3D can increase buildnumbers!\n// Xash3D SDL: HAHAHA! I TOUCHED THIS!\n\tint m = 0, d = 0, y = 0;\n\tstatic int b = 0;\n\tstatic char buildnum[16];\n\n\tif( b != 0 )\n\t\treturn buildnum;\n\n\tfor( m = 0; m < 11; m++ )\n\t{\n\t\tif( !strncasecmp( &date[0], mon[m], 3 ))\n\t\t\tbreak;\n\t\td += mond[m];\n\t}\n\n\td += atoi( &date[4] ) - 1;\n\ty = atoi( &date[7] ) - 1900;\n\tb = d + (int)((y - 1) * 365.25f );\n\n\tif((( y % 4 ) == 0 ) && m > 1 )\n\t{\n\t\tb += 1;\n\t}\n\t//b -= 38752; // Feb 13 2007\n\tb -= 41940; // Oct 29 2015.\n\t// Happy birthday, cs16client! :)\n\n\tsnprintf( buildnum, sizeof(buildnum), \"%i\", b );\n\n\treturn buildnum;\n}\n\nint __MsgFunc_ADStop( const char *name, int size, void *buf ) { return 1; }\nint __MsgFunc_ItemStatus( const char *name, int size, void *buf ) { return 1; }\n// int __MsgFunc_ReqState( const char *name, int size, void *buf ) { return 1; }\nint __MsgFunc_ForceCam( const char *name, int size, void *buf ) { return 1; }\nint __MsgFunc_Spectator( const char *name, int size, void *buf ) { return 1; }\n\n#ifdef __ANDROID__\nbool evdev_open = false;\nvoid __CmdFunc_MouseSucksOpen( void ) { evdev_open = true; }\nvoid __CmdFunc_MouseSucksClose( void ) { evdev_open = false; }\n#endif\n\n\n// This is called every time the DLL is loaded\nvoid CHud :: Init( void )\n{\n\tSetGameType(); // call it first, so we will know gamedir at very early stage\n\n\tHOOK_COMMAND_FUNC( \"special\", __CmdFunc_InputCommandSpecial, );\n\tHOOK_COMMAND_FUNC( \"gunsmoke\", __CmdFunc_GunSmoke, );\n\n#ifdef __ANDROID__\n\tHOOK_COMMAND_FUNC( \"evdev_mouseopen\", __CmdFunc_MouseSucksOpen );\n\tHOOK_COMMAND_FUNC( \"evdev_mouseclose\", __CmdFunc_MouseSucksClose );\n#endif\n\t\n\tHOOK_MESSAGE( gHUD, Logo );\n\tHOOK_MESSAGE( gHUD, ResetHUD );\n\tHOOK_MESSAGE( gHUD, GameMode );\n\tHOOK_MESSAGE( gHUD, InitHUD );\n\tHOOK_MESSAGE( gHUD, ViewMode );\n\tHOOK_MESSAGE( gHUD, SetFOV );\n\tHOOK_MESSAGE( gHUD, Concuss );\n\tHOOK_MESSAGE( gHUD, ServerName );\n\tHOOK_MESSAGE( gHUD, ShadowIdx );\n\n\tgEngfuncs.pfnHookUserMsg( \"ADStop\", __MsgFunc_ADStop );\n\tgEngfuncs.pfnHookUserMsg( \"ItemStatus\", __MsgFunc_ItemStatus );\n\t// gEngfuncs.pfnHookUserMsg( \"ReqState\", __MsgFunc_ReqState );\n\tgEngfuncs.pfnHookUserMsg( \"ForceCam\", __MsgFunc_ForceCam );\n\tgEngfuncs.pfnHookUserMsg( \"Spectator\", __MsgFunc_Spectator );\n\n\tHOOK_MESSAGE( gHUD, Fog );\n\n\n\tCVAR_CREATE( \"_vgui_menus\", \"1\", FCVAR_ARCHIVE | FCVAR_USERINFO );\n\tCVAR_CREATE( \"_cl_autowepswitch\", \"1\", FCVAR_ARCHIVE | FCVAR_USERINFO );\n\tCVAR_CREATE( \"_ah\", \"0\", FCVAR_ARCHIVE | FCVAR_USERINFO );\n\n\t// TODO remove hack later\n\tCVAR_CREATE( \"numericalmenu\", \"1\", FCVAR_ARCHIVE );\n\tCVAR_CREATE( \"numericalmenu_clientonly\", \"1\", FCVAR_ARCHIVE );\n\tCVAR_CREATE( \"checkscoreboard\", \"1\", FCVAR_ARCHIVE );\n\tcscl_currentmap = CVAR_CREATE( \"cscl_currentmap\", \"\", 0 );\n\tcscl_mapprefix = CVAR_CREATE( \"cscl_mapprefix\", \"\", 0 );\n\tcscl_currentmoney = CVAR_CREATE( \"cscl_currentmoney\", \"0\", 0 );\n\tCVAR_CREATE( \"teammenu_showscores\", \"0\", FCVAR_ARCHIVE );\n\tCVAR_CREATE( \"menu_bg_fill\", \"0\", FCVAR_ARCHIVE );\n\tCVAR_CREATE( \"buymenu_stayon\", \"0\", FCVAR_ARCHIVE );\n\n\thud_textmode = CVAR_CREATE( \"hud_textmode\", \"0\", FCVAR_ARCHIVE );\n\thud_colored  = CVAR_CREATE( \"hud_colored\", \"0\", FCVAR_ARCHIVE );\n\tcl_righthand = CVAR_CREATE( \"cl_righthand\", \"1\", FCVAR_ARCHIVE );\n\tcl_weather   = CVAR_CREATE( \"cl_weather\", \"1\", FCVAR_ARCHIVE );\n\tcl_minmodels = CVAR_CREATE( \"cl_minmodels\", \"0\", FCVAR_ARCHIVE );\n\tcl_min_t     = CVAR_CREATE( \"cl_min_t\", \"1\", FCVAR_ARCHIVE );\n\tcl_min_ct    = CVAR_CREATE( \"cl_min_ct\", \"2\", FCVAR_ARCHIVE );\n\tdefault_fov  = CVAR_CREATE( \"default_fov\", \"90\", 0 );\n\tm_pCvarDraw  = CVAR_CREATE( \"hud_draw\", \"1\", FCVAR_ARCHIVE );\n\tfastsprites  = CVAR_CREATE( \"fastsprites\", \"0\", FCVAR_ARCHIVE );\n\tcl_gunsmoke  = CVAR_CREATE( \"cl_gunsmoke\", \"0\", FCVAR_ARCHIVE );\n\tcl_weapon_sparks = CVAR_CREATE( \"cl_weapon_sparks\", \"1\", FCVAR_ARCHIVE );\n\tcl_weapon_wallpuff = CVAR_CREATE( \"cl_weapon_wallpuff\", \"1\", FCVAR_ARCHIVE );\n\tzoom_sens_ratio = CVAR_CREATE( \"zoom_sensitivity_ratio\", \"1.2\", 0 );\n\n\tcl_charset = gEngfuncs.pfnGetCvarPointer( \"cl_charset\" );\n\tcon_charset = gEngfuncs.pfnGetCvarPointer( \"con_charset\" );\n\n\tcl_viewbob = CVAR_CREATE( \"cl_viewbob\", \"1\", FCVAR_ARCHIVE );\n\n\tm_pShowHealth = CVAR_CREATE( \"scoreboard_showhealth\", \"1\", FCVAR_ARCHIVE );\n\tm_pShowMoney = CVAR_CREATE( \"scoreboard_showmoney\", \"1\", FCVAR_ARCHIVE );\n\n\t// The cvar was taken from the OpenAG client\n\tm_pCvarColor = CVAR_CREATE( \"hud_color\", \"255 160 0\", FCVAR_ARCHIVE );\n\n\tif ( gEngfuncs.pfnGetCvarFloat( \"developer\" ) > 0.0f )\n\t{\n\t\tcl_fog_density = CVAR_CREATE( \"cl_fog_density\", \"0\", 0 );\n\t\tcl_fog_r = CVAR_CREATE( \"cl_fog_r\", \"0\", 0 );\n\t\tcl_fog_g = CVAR_CREATE( \"cl_fog_g\", \"0\", 0 );\n\t\tcl_fog_b = CVAR_CREATE( \"cl_fog_b\", \"0\", 0 );\n\t}\n\n\tCVAR_CREATE( \"cscl_ver\", Q_buildnum(), 1<<14 | FCVAR_USERINFO ); // init and userinfo\n\n\tm_iLogo = 0;\n\tm_iFOV = 0;\n\n\tm_pSpriteList = NULL;\n\n\t// Clear any old HUD list\n\tfor( HUDLIST *pList = m_pHudList; pList; pList = m_pHudList )\n\t{\n\t\tm_pHudList = m_pHudList->pNext;\n\t\tdelete pList;\n\t}\n\tm_pHudList = NULL;\n\n\t// In case we get messages before the first update -- time will be valid\n\tm_flTime = 1.0;\n\tm_iNoConsolePrint = 0;\n\tm_szServerName[0] = 0;\n\n\n\n\tLocalize_Init();\n\n\t// fullscreen overlays\n\tm_SniperScope.Init();\n\tm_NVG.Init();\n\n\t// Game HUD things\n\tm_Ammo.Init();\n\tm_Health.Init();\n\tm_Radio.Init();\n\tm_Timer.Init();\n\tm_Money.Init();\n\tm_AmmoSecondary.Init();\n\tm_Train.Init();\n\tm_Battery.Init();\n\tm_StatusIcons.Init();\n\tm_Radar.Init();\n\tm_Scenario.Init();\n\n\t// chat, death notice, status bars and other\n\tm_SayText.Init();\n\tm_Spectator.Init();\n\tm_Geiger.Init();\n\tm_Flash.Init();\n\tm_Message.Init();\n\tm_StatusBar.Init();\n\tm_DeathNotice.Init();\n\tm_TextMessage.Init();\n\tm_MOTD.Init();\n\n\t// all things that have own background and must be drawn last\n\tm_ProgressBar.Init();\n\tm_Menu.Init();\n\n\t// Spectator GUI is not need in singleplayer czeror\n\tif( GetGameType() != GAME_CZERODS )\n\t\tm_SpectatorGui.Init();\n\n\tm_Scoreboard.Init();\n\n\tGetClientVoice()->Init( &g_VoiceStatusHelper );\n\n\tInitRain();\n\n\t//ServersInit();\n\n\tgEngfuncs.Con_Printf( \"%s: ^2CS16Client^7 ver. %s initialized.\\n\", __FUNCTION__, CVAR_GET_STRING( \"cscl_ver\" ) );\n\n\tMsgFunc_ResetHUD(0, 0, NULL );\n}\n\n// CHud destructor\n// cleans up memory allocated for m_rg* arrays\nCHud :: ~CHud()\n{\n\tdelete [] m_rghSprites;\n\tdelete [] m_rgrcRects;\n\tdelete [] m_rgszSpriteNames;\n\n\t// Clear any old HUD list\n\tfor( HUDLIST *pList = m_pHudList; pList; pList = m_pHudList )\n\t{\n\t\tm_pHudList = m_pHudList->pNext;\n\t\tdelete pList;\n\t}\n\tm_pHudList = NULL;\n}\n\nvoid CHud :: VidInit( void )\n{\n\tstatic bool firstinit = true;\n\tm_scrinfo.iSize = sizeof( m_scrinfo );\n\tGetScreenInfo( &m_scrinfo );\n\n\tm_truescrinfo.iWidth = CVAR_GET_FLOAT(\"width\");\n\tm_truescrinfo.iHeight = CVAR_GET_FLOAT(\"height\");\n\n\t// ----------\n\t// Load Sprites\n\t// ---------\n\t//\tm_hsprFont = LoadSprite(\"sprites/%d_font.spr\");\n\t\n\tm_hsprLogo = 0;\n\n\tm_flScale = (float)TrueWidth / (float)ScreenWidth;\n\n\tm_iRes = 640;\n\n\t// Only load this once\n\tif( !m_pSpriteList )\n\t{\n\t\t// we need to load the hud.txt, and all sprites within\n\t\tm_pSpriteList = SPR_GetList(\"sprites/hud.txt\", &m_iSpriteCountAllRes);\n\n\t\tif( m_pSpriteList )\n\t\t{\n\t\t\t// count the number of sprites of the appropriate res\n\t\t\tm_iSpriteCount = 0;\n\t\t\tclient_sprite_t *p = m_pSpriteList;\n\t\t\tfor ( int j = 0; j < m_iSpriteCountAllRes; j++ )\n\t\t\t{\n\t\t\t\tif ( p->iRes == m_iRes )\n\t\t\t\t\tm_iSpriteCount++;\n\t\t\t\tp++;\n\t\t\t}\n\n\t\t\t// allocated memory for sprite handle arrays\n\t\t\tm_rghSprites      = new(std::nothrow) HSPRITE[m_iSpriteCount];\n\t\t\tm_rgrcRects       = new(std::nothrow) wrect_t[m_iSpriteCount];\n\t\t\tm_rgszSpriteNames = new(std::nothrow) char[m_iSpriteCount * MAX_SPRITE_NAME_LENGTH];;\n\n\t\t\tif( !m_rghSprites || !m_rgrcRects || !m_rgszSpriteNames )\n\t\t\t{\n\t\t\t\tgEngfuncs.pfnConsolePrint(\"CHud::VidInit(): Cannot allocate memory\");\n\t\t\t\tif( g_iXash )\n\t\t\t\t\tgRenderAPI.Host_Error(\"CHud::VidInit(): Cannot allocate memory\");\n\t\t\t}\n\n\t\t\tp = m_pSpriteList;\n\t\t\tfor ( int index = 0, j = 0; j < m_iSpriteCountAllRes; j++ )\n\t\t\t{\n\t\t\t\tif ( p->iRes == m_iRes )\n\t\t\t\t{\n\t\t\t\t\tchar sz[256];\n\t\t\t\t\tsprintf(sz, \"sprites/%s.spr\", p->szSprite);\n\t\t\t\t\tm_rghSprites[index] = SPR_Load(sz);\n\t\t\t\t\tm_rgrcRects[index] = p->rc;\n\t\t\t\t\tstrncpy( &m_rgszSpriteNames[index * MAX_SPRITE_NAME_LENGTH], p->szName, MAX_SPRITE_NAME_LENGTH );\n\n\t\t\t\t\tindex++;\n\t\t\t\t}\n\n\t\t\t\tp++;\n\t\t\t}\n\t\t}\n\t}\n\telse\n\t{\n\t\t// we have already have loaded the sprite reference from hud.txt, but\n\t\t// we need to make sure all the sprites have been loaded (we've gone through a transition, or loaded a save game)\n\t\tclient_sprite_t *p = m_pSpriteList;\n\t\tint index = 0;\n\t\tfor ( int j = 0; j < m_iSpriteCountAllRes; j++ )\n\t\t{\n\t\t\tif ( p->iRes == m_iRes )\n\t\t\t{\n\t\t\t\tchar sz[256];\n\t\t\t\tsprintf( sz, \"sprites/%s.spr\", p->szSprite );\n\t\t\t\tm_rghSprites[index] = SPR_Load(sz);\n\t\t\t\tindex++;\n\t\t\t}\n\n\t\t\tp++;\n\t\t}\n\t}\n\n\t// assumption: number_1, number_2, etc, are all listed and loaded sequentially\n\tm_HUD_number_0 = GetSpriteIndex( \"number_0\" );\n\n\tif( m_HUD_number_0 == -1 && g_iXash )\n\t{\n\t\tgRenderAPI.Host_Error( \"Failed to get number_0 sprite index. Check your game data!\" );\n\t\treturn;\n\t}\n\n\tif( g_iXash )\n\t{\n\t\t// get internal texture\n\t\tm_WhiteTex = gRenderAPI.GL_LoadTexture( \"*white\", NULL, 0, 0 );\n\t}\n\n\tm_iFontWidth  = GetSpriteRect(m_HUD_number_0).Width();\n\tm_iFontHeight = GetSpriteRect(m_HUD_number_0).Height();\n\n\tm_hGasPuff = SPR_Load(\"sprites/gas_puff_01.spr\");\n\n\tfor( HUDLIST *pList = m_pHudList; pList; pList = pList->pNext )\n\t\tpList->p->VidInit();\n\n#if 0\n\tif( firstinit && gEngfuncs.CheckParm( \"-firsttime\", NULL ) )\n\t{\n\t\tConsolePrint( \"firstrun\\n\" );\n\n\t\tClientCmd( \"exec touch_presets/phone_ahsim\" );\n\t\tgEngfuncs.Cvar_Set( \"touch_config_file\", \"touch_presets/phone_ahsim.cfg\" );\n\t}\n#endif\n\n\tfirstinit = false;\n}\n\nvoid CHud::Shutdown( void )\n{\n\tfor( HUDLIST *pList = m_pHudList; pList; pList = pList->pNext )\n\t{\n\t\tpList->p->Shutdown();\n\t}\n}\n\nint CHud::MsgFunc_Logo(const char *pszName,  int iSize, void *pbuf)\n{\n\tBufferReader reader( pszName, pbuf, iSize );\n\n\t// update Train data\n\tm_iLogo = reader.ReadByte();\n\n\treturn 1;\n}\n\nvoid CHud::SetGameType()\n{\n\tif( HUD_IsGame( \"czeror\" ) )\n\t\tm_iGameType = GAME_CZERODS;\n\telse if( HUD_IsGame( \"czero\" ))\n\t\tm_iGameType = GAME_CZERO;\n\telse m_iGameType = GAME_CSTRIKE;\n}\n\n/*\n=====================\nHUD_GetFOV\n\nReturns last FOV\n=====================\n*/\nfloat HUD_GetFOV( void )\n{\n\tif ( gEngfuncs.pDemoAPI->IsRecording() )\n\t{\n\t\t// Write it\n\t\tunsigned char buf[ sizeof(float) ];\n\n\t\t// Active\n\t\t*( float * )&buf = g_lastFOV;\n\n\t\tDemo_WriteBuffer( TYPE_ZOOM, sizeof(float), buf );\n\t}\n\n\tif ( gEngfuncs.pDemoAPI->IsPlayingback() )\n\t{\n\t\tg_lastFOV = g_demozoom;\n\t}\n\treturn g_lastFOV;\n}\n\nint CHud::MsgFunc_SetFOV(const char *pszName,  int iSize, void *pbuf)\n{\n\t//Weapon prediction already takes care of changing the fog. ( g_lastFOV ).\n#if 0 // VALVEWHY: original client checks for \"tfc\" here.\n\tif ( cl_lw && cl_lw->value )\n\t\treturn 1;\n#endif\n\n\tBufferReader reader( pszName, pbuf, iSize );\n\n\tint newfov = reader.ReadByte();\n\tint def_fov = default_fov->value;\n\n\tg_lastFOV = newfov;\n\tm_iFOV = newfov ? newfov : def_fov;\n\n\t// the clients fov is actually set in the client data update section of the hud\n\n\tif ( m_iFOV == def_fov ) // reset to saved sensitivity\n\t\tm_flMouseSensitivity = 0;\n\telse // set a new sensitivity that is proportional to the change from the FOV default\n\t\tm_flMouseSensitivity = sensitivity->value * ((float)newfov / (float)def_fov) * zoom_sens_ratio->value;\n\n\treturn 1;\n}\n\nvoid CHud::AddHudElem(CHudBase *phudelem)\n{\n\tassert( phudelem );\n\n\tHUDLIST *pdl, *ptemp;\n\n\tpdl = new(std::nothrow) HUDLIST;\n\tif( !pdl )\n\t{\n\t\tConsolePrint( \"Cannot allocate memory!\\n\" );\n\t\treturn;\n\t}\n\n\tpdl->p = phudelem;\n\tpdl->pNext = NULL;\n\n\tif (!m_pHudList)\n\t{\n\t\tm_pHudList = pdl;\n\t\treturn;\n\t}\n\n\t// find last\n\tfor( ptemp = m_pHudList; ptemp->pNext; ptemp = ptemp->pNext );\n\n\tptemp->pNext = pdl;\n}\n"
  },
  {
    "path": "cl_dll/hud.h",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\t\n*\tThis product contains software technology licensed from Id \n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc. \n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n//\t\t\t\n//  hud.h\n//\n// class CHud declaration\n//\n// CHud handles the message, calculation, and drawing the HUD\n//\n#pragma once\n\n#define RGB_YELLOWISH 0x00FFA000 //255,160,0\n#define RGB_REDISH 0x00FF1010 //255,16,16\n#define RGB_GREENISH 0x0000A000 //0,160,0\n#define RGB_WHITE 0x00FFFFFF\n#define RGB_GRAY 0x00808080\n\n#include <assert.h>\n#include <string.h>\n\n#include \"wrect.h\"\n#include \"cl_dll.h\"\n#include \"ammo.h\"\n\n#include \"csprite.h\"\n#include \"cvardef.h\"\n#include \"utlstring.h\"\n\n#define MIN_ALPHA\t 100\t\n#define\tHUDELEM_ACTIVE\t1\n#define CHudMsgFunc(x) int MsgFunc_##x(const char *pszName, int iSize, void *buf)\n#define CHudUserCmd(x) void UserCmd_##x()\n\nclass RGBA\n{\npublic:\n\tunsigned char r, g, b, a;\n};\n\nenum \n{ \n\tMAX_PLAYERS = 64,\n\tMAX_TEAMS = 64,\n\tMAX_TEAM_NAME = 16,\n\tMAX_LOCATION_NAME = 32\n};\n\n#define MAX_HOSTAGES 24\n\n#define PLAYERMODEL_PLAYER\t0\n#define PLAYERMODEL_LEET\t1\n#define PLAYERMODEL_GIGN\t2\n#define PLAYERMODEL_VIP\t\t3\nextern const char *sPlayerModelFiles[];\nextern wrect_t nullrc;\n\nclass CClientSprite;\n\ninline bool BIsValidTModelIndex( int i )\n{\n\tif ( i == 1 || i == 5 || i == 6 || i == 8 || i == 11 )\n\t\treturn true;\n\telse\n\t\treturn false;\n}\n\ninline bool BIsValidCTModelIndex( int i )\n{\n\tif ( i == 7 || i == 2 || i == 10 || i == 4 || i == 9)\n\t\treturn true;\n\telse\n\t\treturn false;\n}\n\n#define HUD_DRAW         (1 << 0)\n#define HUD_THINK        (1 << 1)\n#define HUD_ACTIVE       (HUD_DRAW | HUD_THINK)\n#define HUD_INTERMISSION (1 << 2)\n\n#define MAX_PLAYER_NAME_LENGTH\t\t32\n\n\nextern cvar_t *cl_fog_r;\nextern cvar_t *cl_fog_g;\nextern cvar_t *cl_fog_b;\nextern cvar_t *cl_fog_density;\n\nstruct FogParameters {\n\tfloat color[3];\n\tfloat density;\n\tbool affectsSkyBox;\n};\n\nextern FogParameters g_FogParameters;\n\n//\n//-----------------------------------------------------\n//\nclass CHudBase\n{\npublic:\n\tint\t  m_iFlags; // active, moving,\n\tvirtual\t\t~CHudBase() {}\n\tvirtual int Init( void ) {return 0;}\n\tvirtual int VidInit( void ) {return 0;}\n\tvirtual int Draw(float flTime) {return 0;}\n\tvirtual void Think(void) {return;}\n\tvirtual void Reset(void) {return;}\n\tvirtual void InitHUDData( void ) {}\t\t// called every time a server is connected to\n\tvirtual void Shutdown( void ) {}\n\n};\n\nstruct HUDLIST {\n\tCHudBase\t*p;\n\tHUDLIST\t\t*pNext;\n};\n\n\n\n//\n//-----------------------------------------------------\n//\n#include \"voice_status.h\"\n#include \"hud_spectator.h\"\n\n\n//\n//-----------------------------------------------------\n//\nclass CHudAmmo: public CHudBase\n{\n\tfriend class WeaponsResource;\n\tfriend class HistoryResource;\n\npublic:\n\tint Init( void );\n\tint VidInit( void );\n\tint Draw(float flTime);\n\tvoid Think(void);\n\tvoid Reset(void);\n\tvoid SetCrosshair( HSPRITE hSpr, wrect_t rect, int r, int g, int b );\n\tvoid HideCrosshair();\n\n\t// replace engine's buggy crosshair\n\tvoid DrawSpriteCrosshair();\n\n\t// dynamic crosshair\n\tvoid DrawCrosshair();\n\tvoid CalculateCrosshairSize();\n\tvoid CalcCrosshairDrawMode();\n\tvoid CalcCrosshairColor();\n\n\tstatic int ScaleForRes( float value, int height );\n\tfloat GetCrosshairGap( int weaponId );\n\tvoid DrawCrosshair( int weaponId );\n\tstatic int GetWeaponAccuracyFlags( int weaponId );\n\tvoid DrawCrosshairSection( int _x0, int _y0, int _x1, int _y1 );\n\tvoid DrawCrosshairPadding( int _pad, int _x0, int _y0, int _x1, int _y1 );\n\n\tint DrawWList(float flTime);\n\tCHudMsgFunc(CurWeapon);\n\tCHudMsgFunc(WeaponList);\n\tCHudMsgFunc(AmmoX);\n\tCHudMsgFunc(AmmoPickup);\n\tCHudMsgFunc(WeapPickup);\n\tCHudMsgFunc(ItemPickup);\n\tCHudMsgFunc(HideWeapon);\n\tCHudMsgFunc(Crosshair);\n\tCHudMsgFunc(Brass);\n\n\n\tvoid SlotInput( int iSlot );\n\tCHudUserCmd(Slot1);\n\tCHudUserCmd(Slot2);\n\tCHudUserCmd(Slot3);\n\tCHudUserCmd(Slot4);\n\tCHudUserCmd(Slot5);\n\tCHudUserCmd(Slot6);\n\tCHudUserCmd(Slot7);\n\tCHudUserCmd(Slot8);\n\tCHudUserCmd(Slot9);\n\tCHudUserCmd(Slot10);\n\tCHudUserCmd(Close);\n\tCHudUserCmd(NextWeapon);\n\tCHudUserCmd(PrevWeapon);\n\tCHudUserCmd(Adjust_Crosshair);\n\tCHudUserCmd(Rebuy);\n\tCHudUserCmd(Autobuy);\n\nprivate:\n\tfloat m_fFade;\n\tRGBA  m_rgba;\n\tWEAPON *m_pWeapon;\n\tint\tm_HUD_bucket0;\n\tint m_HUD_selection;\n\n\tint m_iAlpha;\n\tint m_R, m_G, m_B;\n\tint m_cvarR, m_cvarG, m_cvarB;\n\tint m_iCurrentCrosshair;\n\tint m_iCrosshairScaleBase;\n\tfloat m_flCrosshairDistance;\n\tbool m_bAdditive;\n\tbool m_bObserverCrosshair ;\n\tbool m_bDrawCrosshair;\n\tint m_iAmmoLastCheck;\n\n\tconvar_t *m_pClCrosshairColor;\n\tconvar_t *m_pClCrosshairTranslucent;\n\tconvar_t *m_pClCrosshairSize;\n\tcvar_t *m_pClDynamicCrosshair;\n\tcvar_t *m_pHud_FastSwitch;\n\tcvar_t *m_pHud_DrawHistory_Time;\n\n\t// replace buggy engine's crosshair\n\tHSPRITE m_hStaticSpr;\n\twrect_t m_rcStaticRc;\n\tRGBA m_staticRgba;\n\n\tcvar_t *xhair_enable;\n\n\tcvar_t *xhair_gap;\n\tcvar_t *xhair_size;\n\tcvar_t *xhair_thick;\n\tcvar_t *xhair_pad;\n\tcvar_t *xhair_dot;\n\tcvar_t *xhair_t;\n\tcvar_t *xhair_dynamic_scale;\n\tcvar_t *xhair_gap_useweaponvalue;\n\tcvar_t *xhair_dynamic_move;\n\n\tcvar_t *xhair_color;\n\tcvar_t *xhair_additive;\n\n\tcvar_t *cl_crosshair_color;\n\tcvar_t *cl_crosshair_translucent;\n\tcvar_t *hud_draw;\n};\n\n//\n//-----------------------------------------------------\n//\n\nclass CHudAmmoSecondary: public CHudBase\n{\npublic:\n\tint Init( void );\n\tint VidInit( void );\n\tvoid Reset( void );\n\tint Draw(float flTime);\n\n\tCHudMsgFunc(SecAmmoVal);\n\tCHudMsgFunc(SecAmmoIcon);\n\nprivate:\n\tenum {\n\t\tMAX_SEC_AMMO_VALUES = 4\n\t};\n\n\tint m_HUD_ammoicon; // sprite indices\n\tint m_iAmmoAmounts[MAX_SEC_AMMO_VALUES];\n\tfloat m_fFade;\n};\n\n\n#include \"health.h\"\n#include \"radar.h\"\n\n#define FADE_TIME 100\n\n\n//\n//-----------------------------------------------------\n//\nclass CHudGeiger: public CHudBase\n{\npublic:\n\tint Init( void );\n\tint VidInit( void );\n\tint Draw(float flTime);\n\tCHudMsgFunc(Geiger);\n\t\nprivate:\n\tint m_iGeigerRange;\n\n};\n\n//\n//-----------------------------------------------------\n//\nclass CHudTrain: public CHudBase\n{\npublic:\n\tint Init( void );\n\tint VidInit( void );\n\tint Draw(float flTime);\n\tCHudMsgFunc(Train);\n\nprivate:\n\tHSPRITE m_hSprite;\n\tint m_iPos;\n\n};\n\n//\n//-----------------------------------------------------\n//\n//  MOTD in cs16 must render HTML, so it disabled\n//\n\nclass CHudMOTD : public CHudBase\n{\npublic:\n\tint Init( void );\n\tint VidInit( void );\n\tint Draw( float flTime );\n\tvoid Reset( void );\n\n\tCHudMsgFunc(MOTD);\n\tvoid Scroll( int dir );\n\tvoid Scroll( float amount );\n\tfloat scroll;\n\tbool m_bShow;\n\tcvar_t *cl_hide_motd;\n\nprotected:\n\tstatic int MOTD_DISPLAY_TIME;\n\tCUtlString m_szMOTD;\n\t\n\tint m_iLines;\n\tint m_iMaxLength;\n\tbool ignoreThisMotd;\n};\n\n\nclass CHudScoreboard: public CHudBase\n{\n\tfriend class CHudSpectatorGui;\npublic:\n\tint Init( void );\n\tvoid InitHUDData( void );\n\tint VidInit( void );\n\tint Draw( float flTime );\n\n\tint DrawScoreboard( float flTime );\n\tint DrawTeams( float listslot );\n\tint DrawPlayers( float listslot, int nameoffset = 0, const char *team = NULL ); // returns the ypos where it finishes drawing\n\n\tvoid DeathMsg( int killer, int victim );\n\tvoid SetScoreboardDefaults( void );\n\tvoid GetAllPlayersInfo( void );\n\n\tbool ShouldDrawScoreboard() const;\n\n\tCHudUserCmd(ShowScores);\n\tCHudUserCmd(HideScores);\n\tCHudUserCmd(ShowScoreboard2);\n\tCHudUserCmd(HideScoreboard2);\n\n\tCHudMsgFunc(ScoreInfo);\n\tCHudMsgFunc(TeamInfo);\n\tCHudMsgFunc(TeamScore);\n\tCHudMsgFunc(TeamNames);\n\n\tint m_iPlayerNum;\n\tint m_iNumTeams;\n\n\tbool m_bForceDraw; // if called by showscoreboard2\n\tbool m_bShowscoresHeld;\n\nprivate:\n\tint m_iLastKilledBy;\n\tint m_fLastKillTime;\n\tRGBA m_colors;\n\tbool m_bDrawStroke;\n\tcvar_t *cl_showpacketloss;\n\tcvar_t *cl_showplayerversion;\n\tcvar_t *cl_show_scoreboard_on_death;\n};\n\n//\n//-----------------------------------------------------\n//\nclass CHudStatusBar : public CHudBase\n{\npublic:\n\tint Init( void );\n\tint VidInit( void );\n\tint Draw( float flTime );\n\tvoid Reset( void );\n\tvoid ParseStatusString( int line_num );\n\n\tCHudMsgFunc(StatusText);\n\tCHudMsgFunc(StatusValue);\n\nprotected:\n\tenum {\n\t\tMAX_STATUSTEXT_LENGTH = 128,\n\t\tMAX_STATUSBAR_VALUES = 8,\n\t\tMAX_STATUSBAR_LINES = 1\n\t};\n\n\tchar m_szStatusText[MAX_STATUSBAR_LINES][MAX_STATUSTEXT_LENGTH];  // a text string describing how the status bar is to be drawn\n\tchar m_szStatusBar[MAX_STATUSBAR_LINES][MAX_STATUSTEXT_LENGTH];\t// the constructed bar that is drawn\n\tint m_iStatusValues[MAX_STATUSBAR_VALUES];  // an array of values for use in the status bar\n\n\tint m_bReparseString; // set to TRUE whenever the m_szStatusBar needs to be recalculated\n\n\t// an array of colors...one color for each line\n\tfloat *m_pflNameColors[MAX_STATUSBAR_LINES];\n\n\tcvar_t *hud_centerid;\n};\n\nstruct extra_player_info_t \n{\n\tshort frags;\n\tshort deaths;\n\tshort team_id;\n\tqboolean has_c4;\n\tqboolean vip;\n\tVector origin;\n\n\t// radar stuff...\n\t// float radarflash;\n\t// qboolean radarflashon;\n\t// int radarflashes;\n\tint radarflashes;\n\tfloat radarflashtime;\n\tfloat radarflashtimedelta;\n\tbool nextflash;\n\n\tshort playerclass;\n\tshort teamnumber;\n\tchar teamname[MAX_TEAM_NAME];\n\tbool dead;\n\tfloat showhealth;\n\tint health;\n\tbool talking;\n\tchar location[MAX_LOCATION_NAME];\n\tint sb_health;\n\tint sb_account;\n\tqboolean has_defuse_kit;\n};\n\nstruct team_info_t \n{\n\tchar name[MAX_TEAM_NAME];\n\tshort frags;\n\tshort deaths;\n\tshort ownteam;\n\tshort players;\n\tint already_drawn;\n\tint scores_overriden;\n\tint sumping;\n\tint teamnumber;\n};\n\nstruct hostage_info_t\n{\n\tvec3_t origin;\n\tfloat radarflashtimedelta;\n\tfloat radarflashtime;\n\tbool dead;\n\tbool nextflash;\n\tint radarflashes;\n};\n\nextern hud_player_info_t\tg_PlayerInfoList[MAX_PLAYERS+1];\t   // player info from the engine\nextern extra_player_info_t  g_PlayerExtraInfo[MAX_PLAYERS+1];   // additional player info sent directly to the client dll\nextern team_info_t\t\t\tg_TeamInfo[MAX_TEAMS+1];\nextern hostage_info_t\t\tg_HostageInfo[MAX_HOSTAGES+1];\nextern int\t\t\t\t\tg_IsSpectator[MAX_PLAYERS+1];\n\n\n//\n//-----------------------------------------------------\n//\nclass CHudDeathNotice : public CHudBase\n{\npublic:\n\tint Init( void );\n\tvoid InitHUDData( void );\n\tint VidInit( void );\n\tint Draw( float flTime );\n\tCHudMsgFunc(DeathMsg);\n\nprivate:\n\tint m_HUD_d_skull;  // sprite index of skull icon\n\tint m_HUD_d_headshot;\n\tcvar_t *hud_deathnotice_time;\n};\n\n//\n//-----------------------------------------------------\n//\nclass CHudMenu : public CHudBase\n{\npublic:\n\tint Init( void );\n\tvoid InitHUDData( void );\n\tint VidInit( void );\n\tvoid Reset( void );\n\tint Draw( float flTime );\n\n\tCHudMsgFunc(ShowMenu);\n\tCHudMsgFunc(BuyClose);\n\tCHudMsgFunc(VGUIMenu);\n\t// server sends false when spectating is not allowed, and true when allowed\n\tCHudMsgFunc(AllowSpec);\n\n\tCHudUserCmd(OldStyleMenuClose);\n\tCHudUserCmd(OldStyleMenuOpen);\n\tCHudUserCmd(ShowVGUIMenu);\n\n\tvoid ShowVGUIMenu( int menuType ); // cs16client extension\n\n\tvoid SelectMenuItem( int menu_item );\n\n\tint m_fMenuDisplayed;\n\tbool m_bAllowSpec;\n\tcvar_t *_extended_menus;\n\tint m_bitsValidSlots;\n\tfloat m_flShutoffTime;\n\tint m_fWaitingForMore;\n\n};\n\n//\n//-----------------------------------------------------\n//\nclass CHudSayText : public CHudBase\n{\npublic:\n\tint Init( void );\n\tvoid InitHUDData( void );\n\tint VidInit( void );\n\tint Draw( float flTime );\n\tCHudMsgFunc(SayText);\n\tvoid SayTextPrint( const char *pszBuf, int iBufSize, int clientIndex = -1 );\n\tvoid SayTextPrint( char szBuf[3][256] );\n\tvoid EnsureTextFitsInOneLineAndWrapIfHaveTo( int line );\n\tfriend class CHudSpectator;\n\nprivate:\n\n\tstruct cvar_s *\tm_HUD_saytext;\n\tstruct cvar_s *\tm_HUD_saytext_time;\n};\n\n//\n//-----------------------------------------------------\n//\nclass CHudBattery: public CHudBase\n{\npublic:\n\tint Init( void );\n\tint VidInit( void );\n\tint Draw(float flTime);\n\tCHudMsgFunc(Battery);\n\tCHudMsgFunc(ArmorType);\n\t\nprivate:\n\tenum armortype_t {\n\t\tVest = 0,\n\t\tVestHelm\n\t} m_enArmorType;\n\n\tCClientSprite m_hEmpty[VestHelm + 1];\n\tCClientSprite m_hFull[VestHelm + 1];\n\tint\t  m_iBat;\n\tfloat m_fFade;\n\tint\t  m_iHeight;\t\t// width of the battery innards\n};\n\n\n//\n//-----------------------------------------------------\n//\nclass CHudFlashlight: public CHudBase\n{\npublic:\n\tint Init( void );\n\tint VidInit( void );\n\tint Draw(float flTime);\n\tvoid Reset( void );\n\tCHudMsgFunc(Flashlight);\n\tCHudMsgFunc(FlashBat);\n\t\nprivate:\n\tCClientSprite m_hSprite1;\n\tCClientSprite m_hSprite2;\n\tCClientSprite m_hBeam;\n\tfloat m_flBat;\n\tint\t  m_iBat;\n\tint\t  m_fOn;\n\tfloat m_fFade;\n\tint\t  m_iWidth;\t\t// width of the battery innards\n};\n\n//\n//-----------------------------------------------------\n//\nconst int maxHUDMessages = 16;\nstruct message_parms_t\n{\n\tclient_textmessage_t\t*pMessage;\n\tfloat\ttime;\n\tint x, y;\n\tint\ttotalWidth, totalHeight;\n\tint width;\n\tint lines;\n\tint lineLength;\n\tint length;\n\tint r, g, b;\n\tint text;\n\tint fadeBlend;\n\tfloat charTime;\n\tfloat fadeTime;\n};\n\nstruct hud_message_t\n{\n\tclient_textmessage_t\t*pMessage;\n\t// unsigned int font;\n\tchar args[4][256]; // 1024 bytes\n\tint arg_count;\n};\n\n//\n//-----------------------------------------------------\n//\n\nclass CHudTextMessage: public CHudBase\n{\npublic:\n\tint Init( void );\n\tstatic char *LocaliseTextString( const char *msg, char *dst_buffer, int buffer_size );\n\tstatic char *BufferedLocaliseTextString( const char *msg );\n\tstatic char *LookupString( char *msg_name, int *msg_dest = NULL );\n\tCHudMsgFunc(TextMsg);\n};\n\n//\n//-----------------------------------------------------\n//\n\nclass CHudMessage: public CHudBase\n{\npublic:\n\tfriend class CHudTextMessage;\n\tint Init( void );\n\tint VidInit( void );\n\tint Draw(float flTime);\n\tCHudMsgFunc(HudText);\n\tCHudMsgFunc(GameTitle);\n\tCHudMsgFunc(HudTextArgs);\n\tCHudMsgFunc(HudTextPro);\n\n\tfloat FadeBlend( float fadein, float fadeout, float hold, float localTime );\n\tint\tXPosition( float x, int width, int lineWidth );\n\tint YPosition( float y, int height );\n\n\tvoid MessageAdd( const char *pName, float time, qboolean hintMessage = 0/*, unsigned int font = 0 */ );\n\tvoid MessageAdd( client_textmessage_t *newMessage );\n\tvoid MessageDrawScan( client_textmessage_t *pMessage, float time );\n\tvoid MessageScanStart( void );\n\tvoid MessageScanNextChar( void );\n\tvoid Reset( void );\n\n\tclient_textmessage_t *AllocMessage( const char *text = NULL, client_textmessage_t *copyFrom = NULL );\n\nprivate:\n\thud_message_t\t\t\t\tm_pMessages[maxHUDMessages];\n\tfloat\t\t\t\t\t\tm_startTime[maxHUDMessages];\n\tmessage_parms_t\t\t\t\tm_parms;\n\tfloat\t\t\t\t\t\tm_gameTitleTime;\n\tclient_textmessage_t\t\t*m_pGameTitle;\n\n\tint m_HUD_title_life;\n\tint m_HUD_title_half;\n};\n\n//\n//-----------------------------------------------------\n//\n#define MAX_SPRITE_NAME_LENGTH\t24\n\nclass CHudStatusIcons: public CHudBase\n{\npublic:\n\tint Init( void );\n\tint VidInit( void );\n\tvoid Reset( void );\n\tint Draw(float flTime);\n\tCHudMsgFunc(StatusIcon);\n\n\tenum {\n\t\tMAX_ICONSPRITENAME_LENGTH = MAX_SPRITE_NAME_LENGTH,\n\t\tMAX_ICONSPRITES = 4,\n\t};\n\n\t\n\t//had to make these public so CHud could access them (to enable concussion icon)\n\t//could use a friend declaration instead...\n\tvoid EnableIcon( const char *pszIconName, unsigned char red, unsigned char green, unsigned char blue );\n\tvoid DisableIcon( const char *pszIconName );\n\n\tfriend class CHudScoreboard;\n\nprivate:\n\n\ttypedef struct\n\t{\n\t\tchar szSpriteName[MAX_ICONSPRITENAME_LENGTH];\n\t\tHSPRITE spr;\n\t\twrect_t rc;\n\t\tunsigned char r, g, b;\n\t\tunsigned char secR, secG, secB;\n\t\tfloat flTimeToChange;\n\t} icon_sprite_t;\n\n\ticon_sprite_t m_IconList[MAX_ICONSPRITES];\n};\n\n\n//\n//-----------------------------------------------------\n//\n#define MONEY_YPOS ScreenHeight - 3 * gHUD.m_iFontHeight\n\nclass CHudMoney : public CHudBase\n{\npublic:\n\tint Init( void );\n\tint VidInit( void );\n\tint Draw( float flTime );\n\tCHudMsgFunc(Money);\n\tCHudMsgFunc(BlinkAcct);\n\nprivate:\n\tint m_iMoneyCount;\n\tint m_iDelta;\n\tint m_iBlinkAmt;\n\tfloat m_fBlinkTime;\n\tfloat m_fFade;\n\tCClientSprite m_hDollar;\n\tCClientSprite m_hPlus;\n\tCClientSprite m_hMinus;\n};\n//\n//-----------------------------------------------------\n//\nclass CHudRadio: public CHudBase\n{\npublic:\n\tint Init( void );\n\tvoid Voice(int entindex, bool bTalking );\n\t// play a sentence from a radio\n\t// [byte] unknown (always 1)\n\t// [string] sentence name\n\t// [short] unknown. (always 100, it's a volume?)\n\tCHudMsgFunc(SendAudio);\n\tCHudMsgFunc(ReloadSound);\n\tCHudMsgFunc(BotVoice);\n};\n\n//\n//-----------------------------------------------------\n//\nclass CHudTimer: public CHudBase\n{\n\tfriend class CHudSpectatorGui;\npublic:\n\tint Init( void );\n\tint VidInit( void );\n\tint Draw(float fTime);\n\t// set up the timer.\n\t// [short]\n\tCHudMsgFunc(RoundTime);\n\t// show the timer\n\t// [empty]\n\tCHudMsgFunc(ShowTimer);\n\n\tint m_right;\nprivate:\n\tint m_HUD_timer;\n\tint m_iTime;\n\tfloat m_fStartTime;\n\tbool m_bPanicColorChange;\n\tfloat m_flPanicTime;\n};\n//\n//-----------------------------------------------------\n//\nclass CHudProgressBar: public CHudBase\n{\npublic:\n\tint Init( void );\n\tint VidInit( void );\n\tint Draw( float flTime );\n\tvoid Reset( void );\n\n\t// start progress bar\n\t// [short] Duration\n\tCHudMsgFunc(BarTime);\n\n\t// [short] Duration\n\t// [short] percent\n\tCHudMsgFunc(BarTime2);\n\tCHudMsgFunc(BotProgress);\n\nprivate:\n\tint m_iDuration;\n\tfloat m_fPercent;\n\tfloat m_fStartTime;\n\tchar m_szHeader[256];\n\tconst char *m_szLocalizedHeader;\n};\n\n//\n//-----------------------------------------------------\n//\n// class for drawing sniper scope\nclass CHudSniperScope: public CHudBase\n{\npublic:\n\tint Init( void );\n\tint VidInit( void );\n\tint Draw( float flTime );\n\tvoid Shutdown( void );\n\nprivate:\n\tfloat left, right, centerx, centery;\n\tint m_iScopeArc[4];\n};\n\n//\n//-----------------------------------------------------\n//\n\nclass CHudNVG: public CHudBase\n{\npublic:\n\tint Init( void );\n\tint Draw( float flTime );\n\tvoid Reset( void );\n\tCHudMsgFunc(NVGToggle);\n\n\tCHudUserCmd(NVGAdjustUp);\n\tCHudUserCmd(NVGAdjustDown);\nprivate:\n\tint m_iAlpha;\n\tcvar_t *cl_fancy_nvg;\n\tdlight_t *m_pLight;\n};\n\n//\n//-----------------------------------------------------\n//\n\nclass CHudScenario : public CHudBase\n{\npublic:\n\tint Init();\n\tint VidInit();\n\tint Draw(float flTime);\n\tvoid Reset();\n\n\tCHudMsgFunc(Scenario);\nprivate:\n\tCClientSprite m_sprite;\n\tint m_iAlpha;\n\tint m_iFlashAlpha;\n\tfloat m_fFlashRate;\n\tfloat m_fNextFlash;\n};\n\n//\n//-----------------------------------------------------\n//\n\nclass CHudSpectatorGui: public CHudBase\n{\npublic:\n\tint Init();\n\tint VidInit();\n\tint Draw( float flTime );\n\tvoid InitHUDData();\n\tvoid Reset();\n\tvoid Shutdown();\n\n\tCHudMsgFunc( SpecHealth );\n\tCHudMsgFunc( SpecHealth2 );\n\n\tCHudUserCmd( ToggleSpectatorMenu );\n\tCHudUserCmd( ToggleSpectatorMenuOptions );\n\tCHudUserCmd( ToggleSpectatorMenuOptionsSettings );\n\tCHudUserCmd( ToggleSpectatorMenuSpectateOptions );\n\n\tvoid CalcAllNeededData( );\n\n\tbool m_bBombPlanted;\n\nprivate:\t\n\t// szMapName is 64 bytes only. Removing \"maps/\" and \".bsp\" gived me this result\n\tclass Labels\n\t{\n\tpublic:\n\t\tshort m_iTerrorists;\n\t\tshort m_iCounterTerrorists;\n\t\tchar m_szTimer[64];\n\t\tchar m_szMap[64];\n\t\tchar m_szNameAndHealth[80];\n\t} label;\n\tint m_hTimerTexture;\n\tint m_hChecked;\n\tint m_hArrowDown;\n\tint m_hArrowUp;\n\tint m_hArrowLeft;\n\tint m_hArrowRight;\n\n\tenum {\n\t\tROOT_MENU = (1<<0),\n\t\tMENU_OPTIONS = (1<<1),\n\t\tMENU_OPTIONS_SETTINGS = (1<<2),\n\t\tMENU_SPEC_OPTIONS = (1<<3)\n\t};\n\tbyte m_menuFlags;\n};\n\n//\n//-----------------------------------------------------\n//\n\nclass CHud\n{\npublic:\n\tCHud() : m_pHudList(NULL), m_iSpriteCount(0), m_iRes(640)  {}\n\t~CHud();\t\t\t// destructor, frees allocated memory // thanks, Captain Obvious\n\n\tvoid Init( void );\n\tvoid VidInit( void );\n\tvoid Think( void );\n\tvoid Shutdown( void );\n\tint Redraw( float flTime, int intermission );\n\tint UpdateClientData( client_data_t *cdata, float time );\n\tvoid AddHudElem(CHudBase *p);\n\n\tinline float GetSensitivity() { return m_flMouseSensitivity; }\n\tinline HSPRITE GetSprite( int index )\n\t{\n\t\tassert( index >= -1 && index <= m_iSpriteCount );\n\n\t\treturn (index >= 0) ? m_rghSprites[index] : 0;\n\t}\n\n\tinline wrect_t& GetSpriteRect( int index )\n\t{\n\t\tassert( index >= -1 && index <= m_iSpriteCount );\n\n\t\treturn (index >= 0) ? m_rgrcRects[index]: nullrc;\n\t}\n\n\t// GetSpriteIndex()\n\t// searches through the sprite list loaded from hud.txt for a name matching SpriteName\n\t// returns an index into the gHUD.m_rghSprites[] array\n\t// returns -1 if sprite not found\n\tinline int GetSpriteIndex( const char *SpriteName )\n\t{\n\t\t// look through the loaded sprite name list for SpriteName\n\t\tfor ( int i = 0; i < m_iSpriteCount; i++ )\n\t\t{\n\t\t\tif ( strncmp( SpriteName, m_rgszSpriteNames + (i * MAX_SPRITE_NAME_LENGTH), MAX_SPRITE_NAME_LENGTH ) == 0 )\n\t\t\t\treturn i;\n\t\t}\n\n\t\tgEngfuncs.Con_Printf( \"GetSpriteIndex: %s sprite not found\\n\", SpriteName );\n\t\treturn -1; // invalid sprite\n\t}\n\n\tinline short GetCharWidth ( unsigned char ch )\n\t{\n\t\treturn m_scrinfo.charWidths[ ch ];\n\t}\n\n\tinline int GetCharHeight( )\n\t{\n\t\treturn m_scrinfo.iCharHeight;\n\t}\n\n\tinline int GetGameType( )\n\t{\n\t\treturn m_iGameType;\n\t}\n\n\tinline int GetSpriteRes()\n\t{\n\t\treturn m_iRes;\n\t}\n\n\n\tfloat   m_flTime;      // the current client time\n\tfloat   m_fOldTime;    // the time at which the HUD was last redrawn\n\tdouble  m_flTimeDelta; // the difference between flTime and fOldTime\n\tfloat   m_flScale;     // hud_scale->value\n\tVector\tm_vecOrigin;\n\tVector\tm_vecAngles;\n\tint\t\tm_iKeyBits;\n\tint\t\tm_iHideHUDDisplay;\n\tint\t\tm_iFOV;\n\tint\t\tm_Teamplay;\n\tcvar_t *m_pCvarDraw;\n\tcvar_t *fastsprites;\n\tcvar_t *cl_nopred;\n\tcvar_t *cl_weapon_wallpuff;\n\tcvar_t *cl_weapon_sparks;\n\tcvar_t *cl_lw;\n\tcvar_t *cl_righthand;\n\tcvar_t *cl_weather;\n\tcvar_t *cl_minmodels;\n\tcvar_t *cl_min_t;\n\tcvar_t *cl_min_ct;\n\tcvar_t *cl_gunsmoke;\n\tcvar_t *hud_textmode;\n\tcvar_t *hud_colored;\n\tcvar_t *cscl_currentmoney;\n\tcvar_t *cscl_currentmap;\n\tcvar_t *cscl_mapprefix;\n\tcvar_t *cl_viewbob;\n\n\tcvar_t* m_pCvarColor;\n\tunsigned long m_iDefaultHUDColor;\n\tvoid UpdateDefaultHUDColor();\n\n\tHSPRITE m_hGasPuff;\n\n\tint m_iFontHeight, m_iFontWidth;\n\tCHudAmmo        m_Ammo;\n\tCHudHealth      m_Health;\n\tCHudSpectator   m_Spectator;\n\tCHudGeiger      m_Geiger;\n\tCHudBattery\t    m_Battery;\n\tCHudTrain       m_Train;\n\tCHudFlashlight  m_Flash;\n\tCHudMessage     m_Message;\n\tCHudStatusBar   m_StatusBar;\n\tCHudDeathNotice m_DeathNotice;\n\tCHudSayText     m_SayText;\n\tCHudMenu        m_Menu;\n\tCHudAmmoSecondary m_AmmoSecondary;\n\tCHudTextMessage m_TextMessage;\n\tCHudStatusIcons m_StatusIcons;\n\tCHudScoreboard  m_Scoreboard;\n\tCHudMOTD        m_MOTD;\n\tCHudMoney       m_Money;\n\tCHudTimer       m_Timer;\n\tCHudRadio       m_Radio;\n\tCHudProgressBar m_ProgressBar;\n\tCHudSniperScope m_SniperScope;\n\tCHudNVG         m_NVG;\n\tCHudRadar       m_Radar;\n\tCHudSpectatorGui m_SpectatorGui;\n\tCHudScenario\tm_Scenario;\n\n\t// user messages\n\tCHudMsgFunc(Damage);\n\tCHudMsgFunc(GameMode);\n\tCHudMsgFunc(Logo);\n\tCHudMsgFunc(ResetHUD);\n\tCHudMsgFunc(InitHUD);\n\tCHudMsgFunc(ViewMode);\n\tCHudMsgFunc(SetFOV);\n\tCHudMsgFunc(Concuss);\n\tCHudMsgFunc(ShadowIdx);\n\tCHudMsgFunc(ServerName);\n\n\tCHudMsgFunc(Fog);\n\n\t// Screen information\n\tSCREENINFO\tm_scrinfo;\n\t// As Xash3D can fake m_scrinfo for hud scailing\n\t// we will use a real screen parameters\n\tSCREENINFO  m_truescrinfo;\n\n\tint\tm_iWeaponBits;\n\tint\tm_fPlayerDead;\n\tint m_iIntermission;\n\tint m_iNoConsolePrint;\n\n\t// sprite indexes\n\tint m_HUD_number_0;\n\n\tchar m_szServerName[64];\n\n\tint m_WhiteTex;\n\n\tcvar_t *m_pShowHealth;\n\tcvar_t *m_pShowMoney;\n\nprivate:\n\tvoid SetGameType();\n\n\tHUDLIST\t*m_pHudList;\n\tHSPRITE\tm_hsprLogo;\n\tint\tm_iLogo;\n\tclient_sprite_t\t*m_pSpriteList;\n\tint\tm_iSpriteCount;\n\tint\tm_iSpriteCountAllRes;\n\tfloat m_flMouseSensitivity;\n\tint\tm_iConcussionEffect;\n\tint\tm_iForceCamera;\n\tint m_iForceChaseCam;\n\tint m_iFadeToBlack;\n\tint m_iGameType;\n\tint\tm_iRes;\n\n\t// the memory for these arrays are allocated in the first call to CHud::VidInit(), when the hud.txt and associated sprites are loaded.\n\t// freed in ~CHud()\n\tHSPRITE *m_rghSprites;\t/*[HUD_SPRITE_COUNT]*/\t\t\t// the sprites loaded from hud.txt\n\twrect_t *m_rgrcRects;\t/*[HUD_SPRITE_COUNT]*/\n\tchar *m_rgszSpriteNames; /*[HUD_SPRITE_COUNT][MAX_SPRITE_NAME_LENGTH]*/\n\n\tcvar_t *hud_draw;\n\tcvar_t *default_fov;\n\tcvar_t *zoom_sens_ratio;\n};\n\nextern CHud gHUD;\nextern cvar_t *sensitivity;\n\nextern int g_iTeamNumber;\nextern int g_iUser1;\nextern int g_iUser2;\nextern int g_iUser3;\n"
  },
  {
    "path": "cl_dll/hud_msg.cpp",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\t\n*\tThis product contains software technology licensed from Id \n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc. \n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n//\n//  hud_msg.cpp\n//\n\n#include \"hud.h\"\n#include \"cl_util.h\"\n#include \"parsemsg.h\"\n#include \"r_efx.h\"\n#include \"rain.h\"\n#include \"com_model.h\"\n#include \"studio.h\"\n#include \"studio_util.h\"\n#include \"StudioModelRenderer.h\"\n#include \"GameStudioModelRenderer.h\"\n#include \"com_weapons.h\"\n\n#include <cstring>\n\n#include \"events.h\"\n\n#define MAX_CLIENTS 32\n\nextern float g_flRoundTime;\n\n/// USER-DEFINED SERVER MESSAGE HANDLERS\n\nint CHud :: MsgFunc_ResetHUD(const char *pszName, int iSize, void *pbuf )\n{\n\t// clear all hud data\n\tHUDLIST *pList = m_pHudList;\n\n\twhile ( pList )\n\t{\n\t\tif ( pList->p )\n\t\t\tpList->p->Reset();\n\t\tpList = pList->pNext;\n\t}\n\n\t// reset sensitivity\n\tm_flMouseSensitivity = 0;\n\n\t// reset concussion effect\n\tm_iConcussionEffect = 0;\n\n\tchar szMapPrefix[64] = { 0 };\n\tchar szMapName[64] = { 0 };\n\tconst char *szFullMapName = gEngfuncs.pfnGetLevelName();\n\tif ( szFullMapName && szFullMapName[0] )\n\t{\n\t\tstrncpy( szMapName, szFullMapName + 5, sizeof( szMapName ) );\n\t\tszMapName[strlen( szMapName ) - 4] = '\\0';\n\n\t\tint i = 0;\n\t\twhile ( szMapName[i] != '_' && szMapName[i] != '\\0' && i < sizeof( szMapPrefix ) - 1 )\n\t\t{\n\t\t\tszMapPrefix[i] = szMapName[i];\n\t\t\ti++;\n\t\t}\n\t\tszMapPrefix[i] = '_';\n\t\tszMapPrefix[i + 1] = '\\0';\n\t}\n\tgEngfuncs.Cvar_Set( gHUD.cscl_currentmap->name, szMapName );\n\tgEngfuncs.Cvar_Set( gHUD.cscl_mapprefix->name, szMapPrefix );\n\n\t// reinitialize models. We assume that server already precached all models.\n\t// NOTE: we're doing this in ResetHUD instead of InitHUD because it's not being\n\t// sent in demos, as it's not part of the signon packet and it's not sent with\n\t// fullupdate. Doing this in InitHUD essentially caches invalid model indices\n\tg_iRShell       = gEngfuncs.pEventAPI->EV_FindModelIndex( \"models/rshell.mdl\" );\n\tg_iPShell       = gEngfuncs.pEventAPI->EV_FindModelIndex( \"models/pshell.mdl\" );\n\tg_iShotgunShell = gEngfuncs.pEventAPI->EV_FindModelIndex( \"models/shotgunshell.mdl\" );\n\t\n\treturn 1;\n}\n\nvoid CAM_ToFirstPerson(void);\n\nint CHud :: MsgFunc_ViewMode( const char *pszName, int iSize, void *pbuf )\n{\n\tCAM_ToFirstPerson();\n\treturn 1;\n}\n\nint CHud :: MsgFunc_InitHUD( const char *pszName, int iSize, void *pbuf )\n{\n\t// prepare all hud data\n\tHUDLIST *pList = m_pHudList;\n\n\twhile (pList)\n\t{\n\t\tif ( pList->p )\n\t\t\tpList->p->InitHUDData();\n\t\tpList = pList->pNext;\n\t}\n\n\tg_iFreezeTimeOver = 0;\n\n\tg_FogParameters.density = 0.0f;\n\tg_FogParameters.affectsSkyBox = 0;\n\tg_FogParameters.color[0] = 0.0f;\n\tg_FogParameters.color[1] = 0.0f;\n\tg_FogParameters.color[2] = 0.0f;\n\n\tif( cl_fog_density )\n\t\tgEngfuncs.Cvar_SetValue( cl_fog_density->name, 0.0f );\n\t\n\tif( cl_fog_r )\n\t\tgEngfuncs.Cvar_SetValue( cl_fog_r->name, g_FogParameters.color[0] );\n\t\n\tif( cl_fog_g )\n\t\tgEngfuncs.Cvar_SetValue( cl_fog_g->name, g_FogParameters.color[1] );\n\t\n\tif( cl_fog_b )\n\t\tgEngfuncs.Cvar_SetValue( cl_fog_b->name, g_FogParameters.color[2] );\n\n\tmemset( g_PlayerExtraInfo, 0, sizeof(g_PlayerExtraInfo) );\n\n\tResetRain();\n\n\t// reset round time\n\tg_flRoundTime   = 0.0f;\n\n\treturn 1;\n}\n\n\nint CHud :: MsgFunc_GameMode(const char *pszName, int iSize, void *pbuf )\n{\n\tBufferReader reader( pszName, pbuf, iSize );\n\tm_Teamplay = reader.ReadByte();\n\n\treturn 1;\n}\n\nint CHud :: MsgFunc_Concuss( const char *pszName, int iSize, void *pbuf )\n{\n\tBufferReader reader( pszName, pbuf, iSize );\n\tm_iConcussionEffect = reader.ReadByte();\n\tif (m_iConcussionEffect)\n\t\tthis->m_StatusIcons.EnableIcon(\"dmg_concuss\",255,160,0);\n\telse\n\t\tthis->m_StatusIcons.DisableIcon(\"dmg_concuss\");\n\treturn 1;\n}\n\nint CHud::MsgFunc_ShadowIdx(const char *pszName, int iSize, void *pbuf)\n{\n\tBufferReader reader( pszName, pbuf, iSize );\n\n\tint idx = reader.ReadLong();\n\tg_StudioRenderer.StudioSetShadowSprite(idx);\n\treturn 1;\n}\n\nint CHud::MsgFunc_ServerName( const char *name, int size, void *buf )\n{\n\tBufferReader reader( name, buf, size );\n\tstrncpy( gHUD.m_szServerName, reader.ReadString(), 64 );\n\tgHUD.m_szServerName[63] = 0;\n\treturn 1;\n}\n\nint CHud::MsgFunc_Fog( const char *pszName, int iSize, void *pbuf )\n{\n\t//int flags;\n\n\tmemset( &g_FogParameters, 0, sizeof(FogParameters));\n\n\tBufferReader reader( pszName, pbuf, iSize );\n\n\tg_FogParameters.affectsSkyBox = false;\n\tg_FogParameters.color[0] = reader.ReadByte();\n\tg_FogParameters.color[1] = reader.ReadByte();\n\tg_FogParameters.color[2] = reader.ReadByte();\n\n\tunion\n\t{\n\t\tfloat f;\n\t\tchar b[4];\n\t} density;\n\n\tdensity.b[0] = reader.ReadByte();\n\tdensity.b[1] = reader.ReadByte();\n\tdensity.b[2] = reader.ReadByte();\n\tdensity.b[3] = reader.ReadByte();\n\n\tg_FogParameters.density = density.f;\n\n\tif( cl_fog_density )\n\t\tgEngfuncs.Cvar_SetValue( cl_fog_density->name, g_FogParameters.density );\n\t\n\tif( cl_fog_r )\n\t\tgEngfuncs.Cvar_SetValue( cl_fog_r->name, g_FogParameters.color[0] );\n\t\n\tif( cl_fog_g )\n\t\tgEngfuncs.Cvar_SetValue( cl_fog_g->name, g_FogParameters.color[1] );\n\t\n\tif( cl_fog_b )\n\t\tgEngfuncs.Cvar_SetValue( cl_fog_b->name, g_FogParameters.color[2] );\n\t\n\treturn 1;\n}\n"
  },
  {
    "path": "cl_dll/hud_redraw.cpp",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\t\n*\tThis product contains software technology licensed from Id \n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc. \n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n//\n// hud_redraw.cpp\n//\n#include <math.h>\n#include \"hud.h\"\n#include \"cl_util.h\"\n#include \"triangleapi.h\"\n\n#include <string.h>\n\n#include \"draw_util.h\"\n\n#define MAX_LOGO_FRAMES 56\n\nint grgLogoFrame[MAX_LOGO_FRAMES] = \n{\n\t1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 13, 13, 13, 13, 13, 12, 11, 10, 9, 8, 14, 15,\n\t16, 17, 18, 19, 20, 20, 20, 20, 20, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, \n\t29, 29, 29, 29, 29, 28, 27, 26, 25, 24, 30, 31 \n};\n\n\nextern int g_iVisibleMouse;\n\nfloat HUD_GetFOV( void );\n\n// Think\nvoid CHud::Think(void)\n{\n\tint newfov;\n\n\textern int g_weaponselect_frames;\n\tif( g_weaponselect_frames )\n\t\tg_weaponselect_frames--;\n\n\tfor( HUDLIST *pList = m_pHudList; pList; pList = pList->pNext )\n\t{\n\t\tif( pList->p->m_iFlags & HUD_THINK )\n\t\t\tpList->p->Think();\n\t}\n\n\tnewfov = HUD_GetFOV();\n\tm_iFOV = newfov ? newfov : default_fov->value;\n\n\t// the clients fov is actually set in the client data update section of the hud\n\n\t// Set a new sensitivity\n\tif ( m_iFOV == default_fov->value )\n\t{  \n\t\t// reset to saved sensitivity\n\t\tm_flMouseSensitivity = 0;\n\t}\n\telse\n\t{  \n\t\t// set a new sensitivity that is proportional to the change from the FOV default\n\t\tm_flMouseSensitivity = sensitivity->value * ((float)newfov / (float)default_fov->value) * zoom_sens_ratio->value;\n\t}\n\n\t// think about default fov\n\tif ( m_iFOV == 0 )\n\t{  // only let players adjust up in fov,  and only if they are not overriden by something else\n\t\tm_iFOV = max( default_fov->value, 90 );\n\t}\n\n}\n\n// Redraw\n// step through the local data,  placing the appropriate graphics & text as appropriate\n// returns 1 if they've changed, 0 otherwise\nint CHud :: Redraw( float flTime, int intermission )\n{\n\tm_fOldTime = m_flTime;\t// save time of previous redraw\n\tm_flTime = flTime;\n\tm_flTimeDelta = (double)m_flTime - m_fOldTime;\n\tstatic int m_flShotTime = 0;\n\n\t// Clock was reset, reset delta\n\tif ( m_flTimeDelta < 0 )\n\t\tm_flTimeDelta = 0;\n\n\tif (m_flShotTime && m_flShotTime < flTime)\n\t{\n\t\tgEngfuncs.pfnClientCmd(\"snapshot\\n\");\n\t\tm_flShotTime = 0;\n\t}\n\n\tm_iIntermission = intermission;\n\n\tUpdateDefaultHUDColor();\n\n\tif ( m_pCvarDraw->value && (intermission || !(m_iHideHUDDisplay & HIDEHUD_ALL) ) )\n\t{\n\t\tfor( HUDLIST *pList = m_pHudList; pList; pList = pList->pNext )\n\t\t{\n\t\t\tif( pList->p->m_iFlags & HUD_DRAW )\n\t\t\t{\n\t\t\t\tif( intermission && !(pList->p->m_iFlags & HUD_INTERMISSION) )\n\t\t\t\t\tcontinue; // skip no-intermission during intermission\n\n\t\t\t\tpList->p->Draw( flTime );\n\t\t\t}\n\t\t}\n\t}\n\n\t// are we in demo mode? do we need to draw the logo in the top corner?\n\tif (m_iLogo)\n\t{\n\t\tint x, y, i;\n\n\t\tif (m_hsprLogo == 0)\n\t\t\tm_hsprLogo = LoadSprite(\"sprites/%d_logo.spr\");\n\n\t\tSPR_Set(m_hsprLogo, 250, 250, 250 );\n\t\t\n\t\tx = SPR_Width(m_hsprLogo, 0);\n\t\tx = ScreenWidth - x;\n\t\ty = SPR_Height(m_hsprLogo, 0)/2;\n\n\t\t// Draw the logo at 20 fps\n\t\tint iFrame = (int)(flTime * 20) % MAX_LOGO_FRAMES;\n\t\ti = grgLogoFrame[iFrame] - 1;\n\n\t\tSPR_DrawAdditive(i, x, y, NULL);\n\t}\n\n\t// update codepage parameters\n\tif( !stricmp( con_charset->string, \"cp1251\" ))\n\t{\n\t\tg_codepage = 1251;\n\t}\n\telse if( !stricmp( con_charset->string, \"cp1252\" ))\n\t{\n\t\tg_codepage = 1252;\n\t}\n\telse\n\t{\n\t\tg_codepage = 0;\n\t}\n\n\tg_accept_utf8 = !stricmp( cl_charset->string, \"utf-8\" );\n\n\treturn 1;\n}\n\nvoid CHud::UpdateDefaultHUDColor()\n{\n\tint r, g, b;\n\n\tif (sscanf(m_pCvarColor->string, \"%d %d %d\", &r, &g, &b) == 3) {\n\t\tr = max(r, 0);\n\t\tg = max(g, 0);\n\t\tb = max(b, 0);\n\n\t\tr = min(r, 255);\n\t\tg = min(g, 255);\n\t\tb = min(b, 255);\n\n\t\tm_iDefaultHUDColor = (r << 16) | (g << 8) | b;\n\t} else {\n\t\tm_iDefaultHUDColor = RGB_YELLOWISH;\n\t}\n}\n"
  },
  {
    "path": "cl_dll/hud_spectator.cpp",
    "content": "//========= Copyright В© 1996-2002, Valve LLC, All rights reserved. ============\n//\n// Purpose: \n//\n// $NoKeywords: $\n//=============================================================================\n\n#include \"hud.h\"\n#include \"cl_util.h\"\n#include <string.h>\n#include \"cl_entity.h\"\n#include \"triangleapi.h\"\n#include \"hltv.h\"\n\n#include \"pm_shared.h\"\n#include \"pm_defs.h\"\n#include \"pmtrace.h\"\n#include \"parsemsg.h\"\n#include \"entity_types.h\"\n\n// these are included for the math functions\n#include \"com_model.h\"\n#include \"demo_api.h\"\n#include \"event_api.h\"\n#include \"studio_util.h\"\n#include \"screenfade.h\"\n#include \"draw_util.h\"\n\n#ifdef _MSC_VER\n#pragma warning(disable: 4244)\n#endif\n\nextern int\t\tiJumpSpectator;\nextern float\tvJumpOrigin[3];\nextern float\tvJumpAngles[3];\n\n\nextern void V_GetInEyePos(int entity, float * origin, float * angles );\nextern void V_ResetChaseCam();\nextern void V_GetChasePos(int target, float * cl_angles, float * origin, float * angles);\nextern float * GetClientColor( int clientIndex );\n\nextern vec3_t v_origin;\t\t// last view origin\nextern vec3_t v_angles;\t\t// last view angle\nextern vec3_t v_cl_angles;\t// last client/mouse angle\nextern vec3_t v_sim_org;\t// last sim origin\n\nvoid SpectatorMode(void)\n{\n\tif ( gEngfuncs.Cmd_Argc() <= 1 )\n\t{\n\t\tgEngfuncs.Con_Printf( \"usage:  spec_mode <Main Mode> [<Inset Mode>]\\n\" );\n\t\treturn;\n\t}\n\n\t// SetModes() will decide if command is executed on server or local\n\tif ( gEngfuncs.Cmd_Argc() == 2 )\n\t\tgHUD.m_Spectator.SetModes( atoi( gEngfuncs.Cmd_Argv(1) ), -1 );\n\telse if ( gEngfuncs.Cmd_Argc() == 3 )\n\t\tgHUD.m_Spectator.SetModes( atoi( gEngfuncs.Cmd_Argv(1) ), atoi( gEngfuncs.Cmd_Argv(2) )  );\n}\n\nvoid SpectatorSpray(void)\n{\n\tvec3_t forward;\n\n\tif ( !gEngfuncs.IsSpectateOnly() )\n\t\treturn;\n\n\tAngleVectors(v_angles,forward,NULL,NULL);\n\tVectorScale(forward, 128, forward);\n\tVectorAdd(forward, v_origin, forward);\n\tpmtrace_t * trace = gEngfuncs.PM_TraceLine( v_origin, forward, PM_TRACELINE_PHYSENTSONLY, 2, -1 );\n\tif ( trace->fraction != 1.0 )\n\t{\n\t\tchar string[128];\n\t\tsprintf(string, \"drc_spray %.2f %.2f %.2f %i\",\n\t\t\t\ttrace->endpos[0], trace->endpos[1], trace->endpos[2], trace->ent );\n\t\tgEngfuncs.pfnServerCmd(string);\n\t}\n\n}\nvoid SpectatorHelp(void)\n{\n\tchar *text = CHudTextMessage::BufferedLocaliseTextString( \"#Spec_Help_Text\" );\n\n\tif ( text )\n\t{\n\t\tint len = DrawUtils::ConsoleStringLen( text );\n\n\t\tDrawUtils::DrawConsoleString( (ScreenWidth - len) / 2, ScreenHeight / 3, text );\n\t}\n}\n\nvoid SpectatorMenu( void )\n{\n\tif ( gEngfuncs.Cmd_Argc() <= 1 )\n\t{\n\t\tgEngfuncs.Con_Printf( \"usage:  spec_menu <0|1>\\n\" );\n\t\treturn;\n\t}\n\tconst char *name = \"spec_menu_internal\";\n\tchar *arg = gEngfuncs.Cmd_Argv(1);\n\n\tif( arg[0] == 't' && arg[1] == '\\0' )\n\t\tgEngfuncs.Cvar_SetValue( name, !gEngfuncs.pfnGetCvarFloat(name) );\n\telse\n\t\tgEngfuncs.Cvar_Set( name, gEngfuncs.Cmd_Argv(1) );\n}\n\nvoid SpecDrawNames( void )\n{\n\tif ( gEngfuncs.Cmd_Argc() <= 1 )\n\t{\n\t\tgEngfuncs.Con_Printf( \"usage:  spec_drawnames <0|1>\\n\" );\n\t\treturn;\n\t}\n\tconst char *name = \"spec_drawnames_internal\";\n\tchar *arg = gEngfuncs.Cmd_Argv(1);\n\n\tif( arg[0] == 't' && arg[1] == '\\0' )\n\t\tgEngfuncs.Cvar_SetValue( name, !gEngfuncs.pfnGetCvarFloat(name) );\n\telse\n\t\tgEngfuncs.Cvar_Set( name, gEngfuncs.Cmd_Argv(1) );}\n\nvoid SpecDrawCone( void )\n{\n\tif ( gEngfuncs.Cmd_Argc() <= 1 )\n\t{\n\t\tgEngfuncs.Con_Printf( \"usage:  spec_drawcone <0|1>\\n\" );\n\t\treturn;\n\t}\n\n\tconst char *name = \"spec_drawcone_internal\";\n\tchar *arg = gEngfuncs.Cmd_Argv(1);\n\tif( arg[0] == 't' && arg[1] == '\\0' )\n\t\tgEngfuncs.Cvar_SetValue( name, !gEngfuncs.pfnGetCvarFloat(name) );\n\telse\n\t\tgEngfuncs.Cvar_Set( name, gEngfuncs.Cmd_Argv(1) );\n}\nvoid SpecDrawStatus( void )\n{\n\tif ( gEngfuncs.Cmd_Argc() <= 1 )\n\t{\n\t\tgEngfuncs.Con_Printf( \"usage:  spec_drawstatus <0|1>\\n\" );\n\t\treturn;\n\t}\n\n\tconst char *name = \"spec_drawstatus_internal\";\n\tchar *arg = gEngfuncs.Cmd_Argv(1);\n\tif( arg[0] == 't' && arg[1] == '\\0' )\n\t\tgEngfuncs.Cvar_SetValue( name, !gEngfuncs.pfnGetCvarFloat(name) );\n\telse\n\t\tgEngfuncs.Cvar_Set( name, gEngfuncs.Cmd_Argv(1) );\n}\n\nvoid SpecAutoDirector( void )\n{\n\tif ( gEngfuncs.Cmd_Argc() <= 1 )\n\t{\n\t\tgEngfuncs.Con_Printf( \"usage:  spec_autodirector <0|1>\\n\" );\n\t\treturn;\n\t}\n\n\tconst char *name = \"spec_autodirector_internal\";\n\tchar *arg = gEngfuncs.Cmd_Argv(1);\n\n\tif( arg[0] == 't' && arg[1] == '\\0' )\n\t\tgEngfuncs.Cvar_SetValue( name, !gEngfuncs.pfnGetCvarFloat(name) );\n\telse\n\t\tgEngfuncs.Cvar_Set( name, gEngfuncs.Cmd_Argv(1) );\n}\n\nvoid SpecPip( void )\n{\n\tif ( gEngfuncs.Cmd_Argc() <= 1 )\n\t{\n\t\tgEngfuncs.Con_Printf( \"usage:  spec_pip <0|1>\\n\" );\n\t\treturn;\n\t}\n\n\tconst char *name = \"spec_pip_internal\";\n\tchar *arg = gEngfuncs.Cmd_Argv(1);\n\n\tif( arg[0] == 't' && arg[1] == '\\0' )\n\t{\n\t\tif ( gHUD.m_Spectator.m_pip && (int)gHUD.m_Spectator.m_pip->value != INSET_OFF )\n\t\t{\n\t\t\tgHUD.m_Spectator.SetModes( -1, INSET_OFF );\n\t\t}\n\t\telse\n\t\t{\n\t\t\t// ensure overview data and map sprite are loaded before enabling PiP\n\t\t\tgHUD.m_Spectator.ParseOverviewFile();\n\t\t\tgHUD.m_Spectator.LoadMapSprites();\n\n\t\t\t// if map overview is open in fullscreen, show Locked Chase Cam in inset (player chase)\n\t\t\tint insetMode = INSET_MAP_FREE;\n\t\t\tif ( g_iUser1 == OBS_MAP_FREE || g_iUser1 == OBS_MAP_CHASE )\n\t\t\t\tinsetMode = INSET_CHASE_LOCKED;\n\t\t\tgHUD.m_Spectator.SetModes( -1, insetMode );\n\t\t}\n\t}\n\telse\n\t{\n\t\tgEngfuncs.Cvar_Set( name, gEngfuncs.Cmd_Argv(1) );\n\t}\n}\n\nvoid HudSayText( void )\n{\n\tif ( gEngfuncs.Cmd_Argc() <= 1 )\n\t{\n\t\tgEngfuncs.Con_Printf( \"usage:  hud_saytext <0|1>\\n\" );\n\t\treturn;\n\t}\n\n\tconst char *name = \"hud_saytext_internal\";\n\tchar *arg = gEngfuncs.Cmd_Argv(1);\n\n\tif( arg[0] == 't' && arg[1] == '\\0' )\n\t\tgEngfuncs.Cvar_SetValue( name, !gEngfuncs.pfnGetCvarFloat(name) );\n\telse\n\t\tgEngfuncs.Cvar_Set( name, gEngfuncs.Cmd_Argv(1) );\n}\n\n//-----------------------------------------------------------------------------\n// Purpose: \n//-----------------------------------------------------------------------------\nint CHudSpectator::Init()\n{\n\tgHUD.AddHudElem(this);\n\n\tm_iFlags |= HUD_DRAW | HUD_THINK;\n\tm_flNextObserverInput = 0.0f;\n\tm_zoomDelta\t= 0.0f;\n\tm_moveDelta = 0.0f;\n\tm_chatEnabled = (gHUD.m_SayText.m_HUD_saytext->value!=0);\n\tiJumpSpectator\t= 0;\n\n\tmemset( &m_OverviewData, 0, sizeof(m_OverviewData));\n\tmemset( &m_OverviewEntities, 0, sizeof(m_OverviewEntities));\n\tm_lastPrimaryObject = m_lastSecondaryObject = 0;\n\n\tgEngfuncs.pfnAddCommand (\"spec_mode\", SpectatorMode );\n\tgEngfuncs.pfnAddCommand (\"spec_decal\", SpectatorSpray );\n\tgEngfuncs.pfnAddCommand (\"spec_help\", SpectatorHelp );\n\tgEngfuncs.pfnAddCommand (\"spec_menu\", SpectatorMenu );\n\tgEngfuncs.pfnAddCommand (\"spec_drawnames\", SpecDrawNames );\n\tgEngfuncs.pfnAddCommand (\"spec_drawcone\", SpecDrawCone );\n\tgEngfuncs.pfnAddCommand (\"spec_drawstatus\", SpecDrawStatus );\n\tgEngfuncs.pfnAddCommand (\"hud_saytext\", HudSayText );\n\tgEngfuncs.pfnAddCommand (\"spec_autodirector\", SpecAutoDirector );\n\tgEngfuncs.pfnAddCommand (\"spec_pip\", SpecPip );\n\n\tm_drawnames\t\t= gEngfuncs.pfnRegisterVariable(\"spec_drawnames_internal\",\"1\",0);\n\tm_drawcone\t\t= gEngfuncs.pfnRegisterVariable(\"spec_drawcone_internal\",\"1\",0);\n\tm_drawstatus\t= gEngfuncs.pfnRegisterVariable(\"spec_drawstatus_internal\",\"1\",0);\n\tm_autoDirector\t= gEngfuncs.pfnRegisterVariable(\"spec_autodirector_internal\",\"1\",0);\n\tm_HUD_saytext \t= gEngfuncs.pfnRegisterVariable(\"hud_saytext_internal\",\"1\",0);\n\tm_pip\t\t\t= gEngfuncs.pfnRegisterVariable(\"spec_pip_internal\",\"1\",0);\n\tm_lastAutoDirector = 0.0f;\n\t\n\tif ( !m_drawnames || !m_drawcone || !m_drawstatus || !m_autoDirector || !m_pip )\n\t{\n\t\tgEngfuncs.Con_Printf(\"ERROR! Couldn't register all spectator variables.\\n\");\n\t\treturn 0;\n\t}\n\n\treturn 1;\n}\n\n\n//-----------------------------------------------------------------------------\n// UTIL_StringToVector originally from ..\\dlls\\util.cpp, slightly changed\n//-----------------------------------------------------------------------------\n\nvoid UTIL_StringToVector( float * pVector, const char *pString )\n{\n\tchar *pstr, *pfront, tempString[128];\n\tint\tj;\n\n\tstrncpy( tempString, pString, sizeof( tempString ) );\n\ttempString[ sizeof( tempString ) - 1 ] = '\\0';\n\tpstr = pfront = tempString;\n\t\n\tfor ( j = 0; j < 3; j++ )\n\t{\n\t\tpVector[j] = atof( pfront );\n\t\t\n\t\twhile ( *pstr && *pstr != ' ' )\n\t\t\tpstr++;\n\t\tif (!*pstr)\n\t\t\tbreak;\n\t\tpstr++;\n\t\tpfront = pstr;\n\t}\n\n\tif (j < 2)\n\t{\n\t\tfor (j = j+1;j < 3; j++)\n\t\t\tpVector[j] = 0;\n\t}\n}\n\nint UTIL_FindEntityInMap( const char * name, float * origin, float * angle)\n{\n\tint\t\t\t\tn,found = 0;\n\tchar\t\t\tkeyname[256];\n\tchar\t\t\ttoken[1024];\n\n\tcl_entity_t *\tpEnt = gEngfuncs.GetEntityByIndex( 0 );\t// get world model\n\n\tif ( !pEnt ) return 0;\n\n\tif ( !pEnt->model )\treturn 0;\n\n\tchar * data = pEnt->model->entities;\n\n\twhile (data)\n\t{\n\t\tdata = gEngfuncs.COM_ParseFile(data, token);\n\t\t\n\t\tif ( (token[0] == '}') ||  (token[0]==0) )\n\t\t\tbreak;\n\n\t\tif (!data)\n\t\t{\n\t\t\tgEngfuncs.Con_DPrintf(\"UTIL_FindEntityInMap: EOF without closing brace\\n\");\n\t\t\treturn 0;\n\t\t}\n\n\t\tif (token[0] != '{')\n\t\t{\n\t\t\tgEngfuncs.Con_DPrintf(\"UTIL_FindEntityInMap: expected {\\n\");\n\t\t\treturn 0;\n\t\t}\n\n\t\t// we parse the first { now parse entities properties\n\t\t\n\t\twhile ( 1 )\n\t\t{\n\t\t\t// parse key\n\t\t\tdata = gEngfuncs.COM_ParseFile(data, token);\n\t\t\tif (token[0] == '}')\n\t\t\t\tbreak; // finish parsing this entity\n\n\t\t\tif (!data)\n\t\t\t{\n\t\t\t\tgEngfuncs.Con_DPrintf(\"UTIL_FindEntityInMap: EOF without closing brace\\n\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\t\n\t\t\tstrncpy (keyname, token, sizeof(keyname));\n\t\t\tkeyname[sizeof(keyname)-1]=0;\n\n\t\t\t// another hack to fix keynames with trailing spaces\n\t\t\tn = strlen(keyname);\n\t\t\twhile (n && keyname[n-1] == ' ')\n\t\t\t{\n\t\t\t\tkeyname[n-1] = 0;\n\t\t\t\tn--;\n\t\t\t}\n\t\t\t\n\t\t\t// parse value\n\t\t\tdata = gEngfuncs.COM_ParseFile(data, token);\n\t\t\tif (!data)\n\t\t\t{\n\t\t\t\tgEngfuncs.Con_DPrintf(\"UTIL_FindEntityInMap: EOF without closing brace\\n\");\n\t\t\t\treturn 0;\n\t\t\t};\n\n\t\t\tif (token[0] == '}')\n\t\t\t{\n\t\t\t\tgEngfuncs.Con_DPrintf(\"UTIL_FindEntityInMap: closing brace without data\");\n\t\t\t\treturn 0;\n\t\t\t}\n\n\t\t\tif (!strcmp(keyname,\"classname\"))\n\t\t\t{\n\t\t\t\tif (!strcmp(token, name ))\n\t\t\t\t{\n\t\t\t\t\tfound = 1;\t// thats our entity\n\t\t\t\t}\n\t\t\t};\n\n\t\t\tif( !strcmp( keyname, \"angle\" ) )\n\t\t\t{\n\t\t\t\tfloat y = atof( token );\n\t\t\t\t\n\t\t\t\tif (y >= 0)\n\t\t\t\t{\n\t\t\t\t\tangle[0] = 0.0f;\n\t\t\t\t\tangle[1] = y;\n\t\t\t\t}\n\t\t\t\telse if ((int)y == -1)\n\t\t\t\t{\n\t\t\t\t\tangle[0] = -90.0f;\n\t\t\t\t\tangle[1] =   0.0f;;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tangle[0] = 90.0f;\n\t\t\t\t\tangle[1] =  0.0f;\n\t\t\t\t}\n\n\t\t\t\tangle[2] =  0.0f;\n\t\t\t}\n\n\t\t\tif( !strcmp( keyname, \"angles\" ) )\n\t\t\t{\n\t\t\t\tUTIL_StringToVector(angle, token);\n\t\t\t}\n\t\t\t\n\t\t\tif (!strcmp(keyname,\"origin\"))\n\t\t\t{\n\t\t\t\tUTIL_StringToVector(origin, token);\n\n\t\t\t};\n\n\t\t} // while (1)\n\n\t\tif (found)\n\t\t\treturn 1;\n\n\t}\n\n\treturn 0;\t// we search all entities, but didn't found the correct\n\n}\n\n//-----------------------------------------------------------------------------\n// SetSpectatorStartPosition(): \n// Get valid map position and 'beam' spectator to this position\n//-----------------------------------------------------------------------------\n\nvoid CHudSpectator::SetSpectatorStartPosition()\n{\n\t// search for info_player start\n\tif ( UTIL_FindEntityInMap( \"trigger_camera\",  m_cameraOrigin, m_cameraAngles ) )\n\t\tiJumpSpectator = 1;\n\n\telse if ( UTIL_FindEntityInMap( \"info_player_start\",  m_cameraOrigin, m_cameraAngles ) )\n\t\tiJumpSpectator = 1;\n\n\telse if ( UTIL_FindEntityInMap( \"info_player_deathmatch\",  m_cameraOrigin, m_cameraAngles ) )\n\t\tiJumpSpectator = 1;\n\n\telse if ( UTIL_FindEntityInMap( \"info_player_coop\",  m_cameraOrigin, m_cameraAngles ) )\n\t\tiJumpSpectator = 1;\n\telse\n\t{\n      static const Vector &nullvec = Vector (0.0, 0.0, 0.0);\n\t\t// jump to 0,0,0 if no better position was found\n\t\tVectorCopy(nullvec, m_cameraOrigin);\n\t\tVectorCopy(nullvec, m_cameraAngles);\n\t}\n\t\n\tVectorCopy(m_cameraOrigin, vJumpOrigin);\n\tVectorCopy(m_cameraAngles, vJumpAngles);\n\n\tiJumpSpectator = 1;\t// jump anyway\n}\n\n//-----------------------------------------------------------------------------\n// Purpose: Loads new icons\n//-----------------------------------------------------------------------------\nint CHudSpectator::VidInit()\n{\n\tm_hsprPlayer\t\t= SPR_Load(\"sprites/iplayer.spr\");\n\tm_hsprPlayerBlue\t= SPR_Load(\"sprites/iplayerblue.spr\");\n\tm_hsprPlayerRed\t\t= SPR_Load(\"sprites/iplayerred.spr\");\n\tm_hsprPlayerDead\t= SPR_Load(\"sprites/iplayerdead.spr\");\n\tm_hsprPlayerVIP\t\t= SPR_Load(\"sprites/iplayervip.spr\");\n\tm_hsprPlayerC4\t\t= SPR_Load(\"sprites/iplayerc4.spr\");\n\tm_hsprUnkownMap\t\t= SPR_Load(\"sprites/tile.spr\");\n\tm_hsprBeam\t\t\t= SPR_Load(\"sprites/laserbeam.spr\");\n\tm_hsprCamera\t\t= SPR_Load(\"sprites/camera.spr\");\n\tm_hsprBomb\t\t\t= SPR_Load(\"sprites/ic4.spr\");\n\tm_hsprBackpack\t\t= SPR_Load(\"sprites/ibackpack.spr\");\n\tm_hsprHostage\t\t= SPR_Load(\"sprites/ihostage.spr\");\n\t\n\treturn 1;\n}\n\n//-----------------------------------------------------------------------------\n// Purpose: \n// Input  : flTime - \n//\t\t\tintermission - \n//-----------------------------------------------------------------------------\nint CHudSpectator::Draw(float flTime)\n{\n\tint lx;\n\n\tchar string[256];\n\tfloat * color;\n\n\t// draw only in spectator mode\n\tif ( !g_iUser1  )\n\t\treturn 0;\n\n\tif ( m_lastAutoDirector != m_autoDirector->value )\n\t{\n\t\tm_lastAutoDirector = m_autoDirector->value;\n\t\tchar cmd[64];\n\t\tsnprintf(cmd, sizeof(cmd), \"spec_set_ad %f\", m_autoDirector->value);\n\t\tgEngfuncs.pfnClientCmd(cmd);\n\t\tif ( m_lastAutoDirector == 0.0 )\n\t\t{\n\t\t\tif ( g_iUser1 == OBS_CHASE_LOCKED )\n\t\t\t{\n\t\t\t\tSetModes(OBS_CHASE_FREE, INSET_OFF);\n\t\t\t}\n\t\t}\n\t\telse if ( g_iUser1 == OBS_CHASE_FREE )\n\t\t{\n\t\t\tSetModes(OBS_CHASE_LOCKED, INSET_OFF);\n\t\t}\n\t}\n\n\t// if user pressed zoom, aplly changes\n\tif ( (m_zoomDelta != 0.0f) && (\tg_iUser1 == OBS_MAP_FREE ) )\n\t{\n\t\tm_mapZoom += m_zoomDelta;\n\n\t\tif ( m_mapZoom > 3.0f )\n\t\t\tm_mapZoom = 3.0f;\n\n\t\tif ( m_mapZoom < 0.5f )\n\t\t\tm_mapZoom = 0.5f;\n\t}\n\n\t// if user moves in map mode, change map origin\n\tif ( (m_moveDelta != 0.0f) && (g_iUser1 != OBS_ROAMING) )\n\t{\n\t\tvec3_t\tright;\n\t\tAngleVectors(v_angles, NULL, right, NULL);\n\t\tVectorNormalize(right);\n\t\tVectorScale(right, m_moveDelta, right );\n\n\t\tVectorAdd( m_mapOrigin, right, m_mapOrigin )\n\n\t}\n\t\n\t// Only draw the icon names only if map mode is in Main Mode\n\tif ( g_iUser1 < OBS_MAP_FREE  )\n\t\treturn 1;\n\t\n\tif ( !m_drawnames->value )\n\t\treturn 1;\n\t\n\t// make sure we have player info\n\t//gViewPort->GetAllPlayersInfo();\n\tgHUD.m_Scoreboard.GetAllPlayersInfo();\n\n\t// loop through all the players and draw additional infos to their sprites on the map\n\tfor (int i = 0; i < MAX_PLAYERS; i++)\n\t{\n\n\t\tif ( m_vPlayerPos[i][2]<0 )\t// marked as invisible ?\n\t\t\tcontinue;\n\n\t\t// can player exist without name?\n\t\tif( !g_PlayerInfoList[i+1].name )\n\t\t\tcontinue;\n\t\t\n\t\t// check if name would be in inset window\n\t\tif ( m_pip->value != INSET_OFF )\n\t\t{\n\t\t\tif (\tm_vPlayerPos[i][0] > XRES( m_OverviewData.insetWindowX ) &&\n\t\t\t\t\tm_vPlayerPos[i][1] > YRES( m_OverviewData.insetWindowY ) &&\n\t\t\t\t\tm_vPlayerPos[i][0] < XRES( m_OverviewData.insetWindowX + m_OverviewData.insetWindowWidth ) &&\n\t\t\t\t\tm_vPlayerPos[i][1] < YRES( m_OverviewData.insetWindowY + m_OverviewData.insetWindowHeight)\n\t\t\t\t\t) continue;\n\t\t}\n\n\t\tcolor = GetClientColor( i+1 ); // ???\n\n\t\t// draw the players name and health underneath\n\t\tsprintf(string, \"%s\", g_PlayerInfoList[i+1].name );\n\t\t\n\t\tlx = strlen(string)*3; // 3 is avg. character length :)\n\n\t\tDrawUtils::SetConsoleTextColor( color[0], color[1], color[2] );\n\t\tDrawUtils::DrawConsoleString( m_vPlayerPos[i][0]-lx,m_vPlayerPos[i][1], string);\n\t\t\n\t}\n\n\n\t// Only draw the overview if Map Mode is selected for this view\n\tif ( m_iDrawCycle == 0 &&  ( (g_iUser1 != OBS_MAP_FREE) && (g_iUser1 != OBS_MAP_CHASE) ) )\n\t\treturn 1;\n\n\tif ( m_iDrawCycle == 1 && m_pip->value < INSET_MAP_FREE )\n\t\treturn 1;\n\n\treturn 1;\n}\n\n\nvoid CHudSpectator::DirectorMessage( int iSize, void *pbuf )\n{\n\tfloat\tvalue;\n\tchar *\tstring;\n\n\tBufferReader reader( \"DRCMsg\", pbuf, iSize );\n\n\tint cmd = reader.ReadByte();\n\n\tswitch ( cmd )\t// director command byte\n\t{\n\tcase DRC_CMD_START\t:\n\t\t// now we have to do some things clientside, since the proxy doesn't know our mod\n\t\tg_iTeamNumber = 0;\n\n\t\t// fake a InitHUD & ResetHUD message\n\t\tgHUD.MsgFunc_InitHUD(NULL,0, NULL);\n\t\tgHUD.MsgFunc_ResetHUD(NULL, 0, NULL);\n\n\t\tbreak;\n\n\tcase DRC_CMD_EVENT\t:\n\t\tm_lastPrimaryObject\t\t=\treader.ReadWord();\n\t\tm_lastSecondaryObject\t=\treader.ReadWord();\n\t\tm_iObserverFlags\t\t=\treader.ReadLong();\n\n\t\tif ( m_autoDirector->value )\n\t\t{\n\t\t\tif ( (g_iUser2 != m_lastPrimaryObject) || (g_iUser3 != m_lastSecondaryObject) )\n\t\t\t\tV_ResetChaseCam();\n\n\t\t\tg_iUser2 = m_lastPrimaryObject;\n\t\t\tg_iUser3 = m_lastSecondaryObject;\n\t\t}\n\n\t\t// gEngfuncs.Con_Printf(\"Director Camera: %i %i\\n\", firstObject, secondObject);\n\t\tbreak;\n\n\tcase DRC_CMD_MODE  :\n\t\tif ( m_autoDirector->value )\n\t\t{\n\t\t\tSetModes( reader.ReadByte(), -1 );\n\t\t}\n\t\tbreak;\n\n\tcase DRC_CMD_CAMERA\t:\n\t\tif ( m_autoDirector->value )\n\t\t{\n\t\t\tvJumpOrigin[0] = reader.ReadCoord();\t// position\n\t\t\tvJumpOrigin[1] = reader.ReadCoord();\n\t\t\tvJumpOrigin[2] = reader.ReadCoord();\n\n\t\t\tvJumpAngles[0] = reader.ReadCoord();\t// view angle\n\t\t\tvJumpAngles[1] = reader.ReadCoord();\n\t\t\tvJumpAngles[2] = reader.ReadCoord();\n\n\t\t\tgEngfuncs.SetViewAngles( vJumpAngles );\n\n\t\t\tiJumpSpectator = 1;\n\t\t}\n\t\tbreak;\n\n\tcase DRC_CMD_MESSAGE:\n\t{\n\t\tclient_textmessage_t * msg = &m_HUDMessages[m_lastHudMessage];\n\n\t\tmsg->effect = reader.ReadByte();\t\t// effect\n\n\t\tint r, g, b;\n\n\t\tDrawUtils::UnpackRGB( r, g, b, reader.ReadLong() );\t\t// color\n\t\tmsg->r2 = msg->r1 = bound( 0, r, 255 );\n\t\tmsg->g2 = msg->g1 = bound( 0, g, 255 );\n\t\tmsg->b2 = msg->b1 = bound( 0, b, 255 );\n\t\tmsg->a2 = msg->a1 = 0xFF;\t// not transparent\n\n\t\tmsg->x = reader.ReadFloat();\t// x pos\n\t\tmsg->y = reader.ReadFloat();\t// y pos\n\n\t\tmsg->fadein\t\t= reader.ReadFloat();\t// fadein\n\t\tmsg->fadeout\t= reader.ReadFloat();\t// fadeout\n\t\tmsg->holdtime\t= reader.ReadFloat();\t// holdtime\n\t\tmsg->fxtime\t\t= reader.ReadFloat();\t// fxtime;\n\n\t\tstrncpy( m_HUDMessageText[m_lastHudMessage], reader.ReadString(), 128 );\n\t\tm_HUDMessageText[m_lastHudMessage][127]=0;\t// text\n\n\t\tmsg->pMessage = m_HUDMessageText[m_lastHudMessage];\n\t\tmsg->pName\t  = \"HUD_MESSAGE\";\n\n\t\tgHUD.m_Message.MessageAdd( msg );\n\n\t\tm_lastHudMessage++;\n\t\tm_lastHudMessage %= MAX_SPEC_HUD_MESSAGES;\n\n\t}\n\n\t\tbreak;\n\n\tcase DRC_CMD_SOUND :\n\t\tstring = reader.ReadString();\n\t\tvalue =  reader.ReadFloat();\n\n\t\t// gEngfuncs.Con_Printf(\"DRC_CMD_FX_SOUND: %s %.2f\\n\", string, value );\n\t\tgEngfuncs.pEventAPI->EV_PlaySound(0, v_origin, CHAN_BODY, string, value, ATTN_NORM, 0, PITCH_NORM );\n\n\t\tbreak;\n\n\tcase DRC_CMD_TIMESCALE\t:\n\t\tvalue = reader.ReadFloat();\n\t\tbreak;\n\n\n\n\tcase DRC_CMD_STATUS:\n\t\treader.ReadLong(); // total number of spectator slots\n\t\tm_iSpectatorNumber = reader.ReadLong(); // total number of spectator\n\t\treader.ReadWord(); // total number of relay proxies\n\n\t\t//gViewPort->UpdateSpectatorPanel();\n\t\tbreak;\n\n\tcase DRC_CMD_BANNER:\n\t\t// gEngfuncs.Con_DPrintf(\"GUI: Banner %s\\n\",reader.ReadString() ); // name of banner tga eg gfx/temp/7454562234563475.tga\n\t\t//gViewPort->m_pSpectatorPanel->m_TopBanner->LoadImage( reader.ReadString() );\n\t\t//gViewPort->UpdateSpectatorPanel();\n\t\tbreak;\n\n\t\t/*case DRC_CMD_FADE:\n\t\t\t\t\t\t\tbreak;*/\n\n\tcase DRC_CMD_STUFFTEXT:\n\t\tFilteredClientCmd( reader.ReadString() );\n\t\tbreak;\n\tdefault\t\t\t:\tgEngfuncs.Con_DPrintf(\"CHudSpectator::DirectorMessage: unknown command %i.\\n\", cmd );\n\t}\n}\n\nvoid CHudSpectator::FindNextPlayer(bool bReverse)\n{\n\t// MOD AUTHORS: Modify the logic of this function if you want to restrict the observer to watching\n\t//\t\t\t\tonly a subset of the players. e.g. Make it check the target's team.\n\n\tint\t\tiStart;\n\tcl_entity_t * pEnt = NULL;\n\n\t// if we are NOT in HLTV mode, spectator targets are set on server\n\tif ( !gEngfuncs.IsSpectateOnly() )\n\t{\n\t\tchar cmdstring[32];\n\t\t// forward command to server\n\t\tsprintf(cmdstring,\"follownext %i\",bReverse?1:0);\n\t\tgEngfuncs.pfnServerCmd(cmdstring);\n\t\treturn;\n\t}\n\t\n\tif ( g_iUser2 )\n\t\tiStart = g_iUser2;\n\telse\n\t\tiStart = 1;\n\n\tg_iUser2 = 0;\n\n\tint\t    iCurrent = iStart;\n\n\tint iDir = bReverse ? -1 : 1;\n\n\t// make sure we have player info\n\t//gViewPort->GetAllPlayersInfo();\n\tgHUD.m_Scoreboard.GetAllPlayersInfo();\n\n\tdo\n\t{\n\t\tiCurrent += iDir;\n\n\t\t// Loop through the clients\n\t\tif (iCurrent > MAX_PLAYERS)\n\t\t\tiCurrent = 1;\n\t\tif (iCurrent < 1)\n\t\t\tiCurrent = MAX_PLAYERS;\n\n\t\tpEnt = gEngfuncs.GetEntityByIndex( iCurrent );\n\n\t\tif ( !IsActivePlayer( pEnt ) )\n\t\t\tcontinue;\n\n\t\t// MOD AUTHORS: Add checks on target here.\n\n\t\tg_iUser2 = iCurrent;\n\t\tbreak;\n\n\t} while ( iCurrent != iStart );\n\n\t// Did we find a target?\n\tif ( !g_iUser2 )\n\t{\n\t\tgEngfuncs.Con_DPrintf( \"No observer targets.\\n\" );\n\t\t// take save camera position\n\t\tVectorCopy(m_cameraOrigin, vJumpOrigin);\n\t\tVectorCopy(m_cameraAngles, vJumpAngles);\n\t}\n\telse\n\t{\n\t\t// use new entity position for roaming\n\t\tVectorCopy ( pEnt->origin, vJumpOrigin );\n\t\tVectorCopy ( pEnt->angles, vJumpAngles );\n\t}\n\tiJumpSpectator = 1;\n}\n\nvoid CHudSpectator::HandleButtonsDown( int ButtonPressed )\n{\n\tdouble time = gEngfuncs.GetClientTime();\n\n\tint newMainMode\t\t= g_iUser1;\n\tint newInsetMode\t= m_pip->value;\n\n\t// gEngfuncs.Con_Printf(\" HandleButtons:%i\\n\", ButtonPressed );\n\t//\tif ( !gViewPort )\n\n\t//Not in intermission.\n\tif ( gHUD.m_iIntermission )\n\t\treturn;\n\n\tif ( !g_iUser1 )\n\t\treturn; // don't do anything if not in spectator mode\n\n\t// don't handle buttons during normal demo playback\n\tif ( gEngfuncs.pDemoAPI->IsPlayingback() && !gEngfuncs.IsSpectateOnly() )\n\t\treturn;\n\t// Slow down mouse clicks.\n\tif ( m_flNextObserverInput > time )\n\t\treturn;\n\n\t// enable spectator screen\n\tif ( ButtonPressed & IN_DUCK )\n\t{\n\t\tgHUD.m_SpectatorGui.UserCmd_ToggleSpectatorMenu();\n\t}\n\n\t//  'Use' changes inset window mode\n\tif ( ButtonPressed & IN_USE )\n\t{\n\t\tnewInsetMode = ToggleInset(true);\n\t}\n\n\t// if not in HLTV mode, buttons are handled server side\n\tif ( gEngfuncs.IsSpectateOnly() )\n\t{\n\t\t// changing target or chase mode not in overviewmode without inset window\n\n\t\t// Jump changes main window modes\n\t\tif ( ButtonPressed & IN_JUMP )\n\t\t{\n\t\t\tif ( g_iUser1 == OBS_CHASE_LOCKED )\n\t\t\t\tnewMainMode = OBS_CHASE_FREE;\n\n\t\t\telse if ( g_iUser1 == OBS_CHASE_FREE )\n\t\t\t\tnewMainMode = OBS_IN_EYE;\n\n\t\t\telse if ( g_iUser1 == OBS_IN_EYE )\n\t\t\t\tnewMainMode = OBS_ROAMING;\n\n\t\t\telse if ( g_iUser1 == OBS_ROAMING )\n\t\t\t\tnewMainMode = OBS_MAP_FREE;\n\n\t\t\telse if ( g_iUser1 == OBS_MAP_FREE )\n\t\t\t\tnewMainMode = OBS_MAP_CHASE;\n\n\t\t\telse\n\t\t\t\tnewMainMode = OBS_CHASE_FREE;\t// don't use OBS_CHASE_LOCKED anymore\n\t\t}\n\n\t\t// Attack moves to the next player\n\t\tif ( ButtonPressed & (IN_ATTACK | IN_ATTACK2) )\n\t\t{\n\t\t\tFindNextPlayer( (ButtonPressed & IN_ATTACK2) ? true:false );\n\n\t\t\tif ( g_iUser1 == OBS_ROAMING )\n\t\t\t{\n\t\t\t\tgEngfuncs.SetViewAngles( vJumpAngles );\n\t\t\t\tiJumpSpectator = 1;\n\t\t\t\tgHUD.m_Health.m_iPlayerLastPointedAt = g_iUser2;\n\t\t\t\tg_PlayerExtraInfo[g_iUser2].showhealth = gHUD.m_flTime + 3.0f;\n\t\t\t}\n\t\t\t// lease directed mode if player want to see another player\n\t\t\tm_autoDirector->value = 0.0f;\n\t\t}\n\t}\n\n\tSetModes(newMainMode, newInsetMode);\n\n\tif ( g_iUser1 == OBS_MAP_FREE )\n\t{\n\t\tif ( ButtonPressed & IN_FORWARD )\n\t\t\tm_zoomDelta =  0.01f;\n\n\t\tif ( ButtonPressed & IN_BACK )\n\t\t\tm_zoomDelta = -0.01f;\n\t\t\n\t\tif ( ButtonPressed & IN_MOVELEFT )\n\t\t\tm_moveDelta = -12.0f;\n\n\t\tif ( ButtonPressed & IN_MOVERIGHT )\n\t\t\tm_moveDelta =  12.0f;\n\t}\n\n\tm_flNextObserverInput = time + 0.2;\n}\n\nvoid CHudSpectator::HandleButtonsUp( int ButtonPressed )\n{\n\t//if ( !gViewPort )\n\t//return;\n\n\t//\tif ( !gViewPort->m_pSpectatorPanel->isVisible() )\n\t//\treturn; // don't do anything if not in spectator mode\n\n\tif ( ButtonPressed & (IN_FORWARD | IN_BACK) )\n\t\tm_zoomDelta = 0.0f;\n\t\n\tif ( ButtonPressed & (IN_MOVELEFT | IN_MOVERIGHT) )\n\t\tm_moveDelta = 0.0f;\n}\n\nvoid CHudSpectator::SetModes(int iNewMainMode, int iNewInsetMode)\n{\n\t// if value == -1 keep old value\n\tif ( iNewMainMode == -1 )\n\t\tiNewMainMode = g_iUser1;\n\n\tif ( iNewInsetMode == -1 )\n\t\tiNewInsetMode = m_pip->value;\n\n\t// inset mode is handled only clients side\n\tm_pip->value = iNewInsetMode;\n\t\n\tif ( iNewMainMode < OBS_CHASE_LOCKED || iNewMainMode > OBS_MAP_CHASE )\n\t{\n\t\tgEngfuncs.Con_Printf(\"Invalid spectator mode.\\n\");\n\t\treturn;\n\t}\n\t\n\t// main modes ettings will override inset window settings\n\tif ( iNewMainMode != g_iUser1 )\n\t{\n\t\t// if we are NOT in HLTV mode, main spectator mode is set on server\n\t\tif ( !gEngfuncs.IsSpectateOnly() )\n\t\t{\n\t\t\tchar cmdstring[32];\n\t\t\t// forward command to server\n\t\t\tsprintf(cmdstring,\"specmode %i\",iNewMainMode );\n\t\t\tgEngfuncs.pfnServerCmd(cmdstring);\n\t\t\treturn;\n\t\t}\n\n\t\tif ( !g_iUser2 && (iNewMainMode != OBS_ROAMING ) )\t// make sure we have a target\n\t\t{\n\t\t\t// choose last Director object if still available\n\t\t\tif ( IsActivePlayer( gEngfuncs.GetEntityByIndex( m_lastPrimaryObject ) ) )\n\t\t\t{\n\t\t\t\tg_iUser2 = m_lastPrimaryObject;\n\t\t\t\tg_iUser3 = m_lastSecondaryObject;\n\t\t\t}\n\t\t\telse\n\t\t\t\tFindNextPlayer(false); // find any target\n\t\t}\n\n\t\tswitch ( iNewMainMode )\n\t\t{\n\t\tcase OBS_CHASE_LOCKED:\tg_iUser1 = OBS_CHASE_LOCKED;\n\t\t\tbreak;\n\n\t\tcase OBS_CHASE_FREE :\tg_iUser1 = OBS_CHASE_FREE;\n\t\t\tbreak;\n\n\t\tcase OBS_ROAMING\t:\t// jump to current vJumpOrigin/angle\n\t\t\tg_iUser1 = OBS_ROAMING;\n\t\t\tif ( g_iUser2 )\n\t\t\t{\n\t\t\t\tV_GetChasePos( g_iUser2, v_cl_angles, vJumpOrigin, vJumpAngles );\n\t\t\t\tgEngfuncs.SetViewAngles( vJumpAngles );\n\t\t\t\tiJumpSpectator = 1;\n\t\t\t}\n\t\t\tbreak;\n\n\t\tcase OBS_IN_EYE\t\t:\tg_iUser1 = OBS_IN_EYE;\n\t\t\tbreak;\n\n\t\tcase OBS_MAP_FREE\t:\tg_iUser1 = OBS_MAP_FREE;\n\t\t\t// reset user values\n\t\t\tm_mapZoom = m_OverviewData.zoom;\n\t\t\tm_mapOrigin = m_OverviewData.origin;\n\t\t\tbreak;\n\n\t\tcase OBS_MAP_CHASE\t:\tg_iUser1 = OBS_MAP_CHASE;\n\t\t\t// reset user values\n\t\t\tm_mapZoom = m_OverviewData.zoom;\n\t\t\tm_mapOrigin = m_OverviewData.origin;\n\t\t\tbreak;\n\t\t}\n\n\t\tchar string[128];\n\t\tsprintf(string, \"#Spec_Mode%d\", g_iUser1 );\n\t\tsprintf(string, \"%c%s\", HUD_PRINTCENTER, CHudTextMessage::BufferedLocaliseTextString( string ));\n\t\tgHUD.m_TextMessage.MsgFunc_TextMsg(NULL, strlen(string)+1, string );\n\t}\n\n\t//gViewPort->UpdateSpectatorPanel();\n\n}\n\nbool CHudSpectator::IsActivePlayer(cl_entity_t * ent)\n{\n\treturn ( ent &&\n\t\t\t ent->player &&\n\t\t\t ent->curstate.solid != SOLID_NOT &&\n\t\t\tent != gEngfuncs.GetLocalPlayer() &&\n\t\t\tg_PlayerInfoList[ent->index].name != NULL\n\t\t\t);\n}\n\n\nbool CHudSpectator::ParseOverviewFile( )\n{\n\tchar filename[255];\n\tchar levelname[255];\n\tchar token[1024];\n\tfloat height;\n\n\tchar *pfile  = NULL;\n\n\tmemset( &m_OverviewData, 0, sizeof(m_OverviewData));\n\n\t// fill in standrd values\n\tm_OverviewData.insetWindowX = 4;\t// upper left corner\n\tm_OverviewData.insetWindowY = 4;\n\tm_OverviewData.insetWindowHeight = 180;\n\tm_OverviewData.insetWindowWidth = 240;\n\tm_OverviewData.origin[0] = 0.0f;\n\tm_OverviewData.origin[1] = 0.0f;\n\tm_OverviewData.origin[2] = 0.0f;\n\tm_OverviewData.zoom\t= 1.0f;\n\tm_OverviewData.layers = 0;\n\tm_OverviewData.layersHeights[0] = 0.0f;\n\tstrncpy( m_OverviewData.map, gEngfuncs.pfnGetLevelName(), sizeof(m_OverviewData.map) );\n\n\tif ( strlen( m_OverviewData.map ) == 0 )\n\t\treturn false; // not active yet\n\n\tstrncpy(levelname, m_OverviewData.map + 5, sizeof( levelname ));\n\tlevelname[strlen(levelname)-4] = 0;\n\t\n\tsnprintf(filename, sizeof( filename ), \"overviews/%s.txt\", levelname );\n\n\tpfile = (char *)gEngfuncs.COM_LoadFile( filename, 5, NULL);\n\n\tif (!pfile)\n\t{\n\t\tgEngfuncs.Con_Printf(\"Couldn't open file %s. Using default values for overiew mode.\\n\", filename );\n\t\treturn false;\n\t}\n\t\n\t\n\twhile (true)\n\t{\n\t\tpfile = gEngfuncs.COM_ParseFile(pfile, token);\n\n\t\tif (!pfile)\n\t\t\tbreak;\n\n\t\tif ( !stricmp( token, \"global\" ) )\n\t\t{\n\t\t\t// parse the global data\n\t\t\tpfile = gEngfuncs.COM_ParseFile(pfile, token);\n\t\t\tif ( stricmp( token, \"{\" ) )\n\t\t\t{\n\t\t\t\tgEngfuncs.Con_Printf(\"Error parsing overview file %s. (expected { )\\n\", filename );\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tpfile = gEngfuncs.COM_ParseFile(pfile,token);\n\n\t\t\twhile (stricmp( token, \"}\") )\n\t\t\t{\n\t\t\t\tif ( !stricmp( token, \"zoom\" ) )\n\t\t\t\t{\n\t\t\t\t\tpfile = gEngfuncs.COM_ParseFile(pfile,token);\n\t\t\t\t\tm_OverviewData.zoom = atof( token );\n\t\t\t\t}\n\t\t\t\telse if ( !stricmp( token, \"origin\" ) )\n\t\t\t\t{\n\t\t\t\t\tpfile = gEngfuncs.COM_ParseFile(pfile, token);\n\t\t\t\t\tm_OverviewData.origin[0] = atof( token );\n\t\t\t\t\tpfile = gEngfuncs.COM_ParseFile(pfile,token);\n\t\t\t\t\tm_OverviewData.origin[1] = atof( token );\n\t\t\t\t\tpfile = gEngfuncs.COM_ParseFile(pfile, token);\n\t\t\t\t\tm_OverviewData.origin[2] = atof( token );\n\t\t\t\t}\n\t\t\t\telse if ( !stricmp( token, \"rotated\" ) )\n\t\t\t\t{\n\t\t\t\t\tpfile = gEngfuncs.COM_ParseFile(pfile,token);\n\t\t\t\t\tm_OverviewData.rotated = atoi( token );\n\t\t\t\t}\n\t\t\t\telse if ( !stricmp( token, \"inset\" ) )\n\t\t\t\t{\n\t\t\t\t\tpfile = gEngfuncs.COM_ParseFile(pfile,token);\n\t\t\t\t\tm_OverviewData.insetWindowX = atof( token );\n\t\t\t\t\tpfile = gEngfuncs.COM_ParseFile(pfile,token);\n\t\t\t\t\tm_OverviewData.insetWindowY = atof( token );\n\t\t\t\t\tpfile = gEngfuncs.COM_ParseFile(pfile,token);\n\t\t\t\t\tm_OverviewData.insetWindowWidth = atof( token );\n\t\t\t\t\tpfile = gEngfuncs.COM_ParseFile(pfile,token);\n\t\t\t\t\tm_OverviewData.insetWindowHeight = atof( token );\n\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tgEngfuncs.Con_Printf(\"Error parsing overview file %s. (%s unknown)\\n\", filename, token );\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\tpfile = gEngfuncs.COM_ParseFile(pfile,token); // parse next token\n\n\t\t\t}\n\t\t}\n\t\telse if ( !stricmp( token, \"layer\" ) )\n\t\t{\n\t\t\t// parse a layer data\n\n\t\t\tif ( m_OverviewData.layers == OVERVIEW_MAX_LAYERS )\n\t\t\t{\n\t\t\t\tgEngfuncs.Con_Printf(\"Error parsing overview file %s. ( too many layers )\\n\", filename );\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tpfile = gEngfuncs.COM_ParseFile(pfile,token);\n\n\n\t\t\tif ( stricmp( token, \"{\" ) )\n\t\t\t{\n\t\t\t\tgEngfuncs.Con_Printf(\"Error parsing overview file %s. (expected { )\\n\", filename );\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tpfile = gEngfuncs.COM_ParseFile(pfile,token);\n\n\t\t\twhile (stricmp( token, \"}\") )\n\t\t\t{\n\t\t\t\tif ( !stricmp( token, \"image\" ) )\n\t\t\t\t{\n\t\t\t\t\tpfile = gEngfuncs.COM_ParseFile(pfile,token);\n\t\t\t\t\tstrncpy(m_OverviewData.layersImages[ m_OverviewData.layers ], token, 255);\n\t\t\t\t\tm_OverviewData.layersImages[ m_OverviewData.layers ][254] = 0;\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\telse if ( !stricmp( token, \"height\" ) )\n\t\t\t\t{\n\t\t\t\t\tpfile = gEngfuncs.COM_ParseFile(pfile,token);\n\t\t\t\t\theight = atof(token);\n\t\t\t\t\tm_OverviewData.layersHeights[ m_OverviewData.layers ] = height;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tgEngfuncs.Con_Printf(\"Error parsing overview file %s. (%s unknown)\\n\", filename, token );\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\tpfile = gEngfuncs.COM_ParseFile(pfile,token); // parse next token\n\t\t\t}\n\n\t\t\tm_OverviewData.layers++;\n\n\t\t}\n\t}\n\n\tgEngfuncs.COM_FreeFile( pfile );\n\n\tm_mapZoom = m_OverviewData.zoom;\n\tm_mapOrigin = m_OverviewData.origin;\n\n\treturn true;\n\n}\n\nvoid CHudSpectator::LoadMapSprites()\n{\n\t// right now only support for one map layer\n\tif (m_OverviewData.layers > 0 )\n\t{\n\t\tm_MapSprite = gEngfuncs.LoadMapSprite( m_OverviewData.layersImages[0] );\n\t}\n\telse\n\t\tm_MapSprite = NULL; // the standard \"unknown map\" sprite will be used instead\n}\n\n// 1 = s, 2 = t, 3 = 2048\nstatic const int st_to_vec[6][3] =\n{\n{  3, -1,  2 },\n{ -3,  1,  2 },\n{  1,  3,  2 },\n{ -1, -3,  2 },\n{ -2, -1,  3 },  // 0 degrees yaw, look straight up\n{  2, -1, -3 }   // look straight down\n};\n\nvoid MakeSkyVec( float s, float t, int axis )\n{\n\tint\tj, k, farclip;\n\tvec3_t\tv, b;\n\n\tfarclip = 4096;\n\n\tb[0] = s * (farclip >> 1);\n\tb[1] = t * (farclip >> 1);\n\tb[2] = (farclip >> 1);\n\n\tfor( j = 0; j < 3; j++ )\n\t{\n\t\tk = st_to_vec[axis][j];\n\t\tv[j] = (k < 0) ? -b[-k-1] : b[k-1];\n\t\t// v[j] += RI.cullorigin[j];\n\t}\n\n\t// avoid bilerp seam\n\ts = (s + 1.0f) * 0.5f;\n\tt = (t + 1.0f) * 0.5f;\n\n\tif( s < 1.0f / 512.0f )\n\t\ts = 1.0f / 512.0f;\n\telse if( s > 511.0f / 512.0f )\n\t\ts = 511.0f / 512.0f;\n\tif( t < 1.0f / 512.0f )\n\t\tt = 1.0f / 512.0f;\n\telse if( t > 511.0f / 512.0f )\n\t\tt = 511.0f / 512.0f;\n\n\tt = 1.0f - t;\n\n\tgEngfuncs.pTriAPI->TexCoord2f( s, t );\n\tgEngfuncs.pTriAPI->Vertex3fv( v );\n}\n\nvoid CHudSpectator::DrawOverviewLayer()\n{\n\tfloat screenaspect, xs, ys, xStep, yStep, x,y,z;\n\tint ix,iy,i,xTiles,yTiles,frame;\n\tmodel_t *   dummySprite = (struct model_s *)gEngfuncs.GetSpritePointer( m_hsprUnkownMap);\n\n\tif ( m_MapSprite )\n\t{\n\t\ti = m_MapSprite->numframes / (4*3);\n\t\ti = sqrt(i);\n\t\txTiles = i*4;\n\t\tyTiles = i*3;\n\t}\n\telse\n\t{\n\t\txTiles = 8;\n\t\tyTiles = 6;\n\t}\n\n\tscreenaspect = 4.0f/3.0f;\n\n\n\txs = m_OverviewData.origin[0];\n\tys = m_OverviewData.origin[1];\n\tz  = ( 90.0f - v_angles[0] ) / 90.0f;\n\tz *= m_OverviewData.layersHeights[0]; // gOverviewData.z_min - 32;\n\n\t// i = r_overviewTexture + ( layer*OVERVIEW_X_TILES*OVERVIEW_Y_TILES );\n\t/*gEngfuncs.pTriAPI->RenderMode( kRenderNormal );\n\tgEngfuncs.pTriAPI->CullFace( TRI_NONE );\n\tgEngfuncs.pTriAPI->Color4f( 0, 0, 0, 1.0f );\n\tgEngfuncs.pTriAPI->Begin( TRI_QUADS );\n\n\tfloat\t\tskyMins[2][6];\n\tfloat\t\tskyMaxs[2][6];\n\n\tfor( i = 0; i < 6; i++ )\n\t{\n\t\t// GL_Bind( XASH_TEXTURE0, tr.skyboxTextures[r_skyTexOrder[i]] );\n\n\t\tskyMins[0][i] = skyMins[1][i] = -1.0f;\n\t\tskyMaxs[0][i] = skyMaxs[1][i] = 1.0f;\n\n\t\tgEngfuncs.pTriAPI->Begin( TRI_QUADS );\n\t\tMakeSkyVec( skyMins[0][i], skyMins[1][i], i );\n\t\tMakeSkyVec( skyMins[0][i], skyMaxs[1][i], i );\n\t\tMakeSkyVec( skyMaxs[0][i], skyMaxs[1][i], i );\n\t\tMakeSkyVec( skyMaxs[0][i], skyMins[1][i], i );\n\t\tgEngfuncs.pTriAPI->End();\n\t}*/\n\n\tgEngfuncs.pTriAPI->RenderMode( kRenderTransTexture );\n\tgEngfuncs.pTriAPI->CullFace( TRI_NONE );\t\n\tgEngfuncs.pTriAPI->Color4f( 1.0, 1.0, 1.0, 1.0 );\n\tframe = 0;\t\n\n\t// rotated view ?\n\tif ( m_OverviewData.rotated )\n\t{\n\t\txStep = (2*4096.0f / m_OverviewData.zoom ) / xTiles;\n\t\tyStep = -(2*4096.0f / (m_OverviewData.zoom* screenaspect) ) / yTiles;\n\n\t\ty = ys + (4096.0f / (m_OverviewData.zoom * screenaspect));\n\n\t\tfor (iy = 0; iy < yTiles; iy++)\n\t\t{\n\t\t\tx = xs - (4096.0f / (m_OverviewData.zoom));\n\n\t\t\tfor (ix = 0; ix < xTiles; ix++)\n\t\t\t{\n\t\t\t\tif ( m_MapSprite )\n\t\t\t\t\tgEngfuncs.pTriAPI->SpriteTexture( m_MapSprite, frame );\n\t\t\t\telse\n\t\t\t\t\tgEngfuncs.pTriAPI->SpriteTexture( dummySprite, 0 );\n\n\t\t\t\tgEngfuncs.pTriAPI->Begin( TRI_QUADS );\n\t\t\t\tgEngfuncs.pTriAPI->TexCoord2f( 0, 0 );\n\t\t\t\tgEngfuncs.pTriAPI->Vertex3f (x, y, z);\n\n\t\t\t\tgEngfuncs.pTriAPI->TexCoord2f( 1, 0 );\n\t\t\t\tgEngfuncs.pTriAPI->Vertex3f (x+xStep ,y,  z);\n\n\t\t\t\tgEngfuncs.pTriAPI->TexCoord2f( 1, 1 );\n\t\t\t\tgEngfuncs.pTriAPI->Vertex3f (x+xStep, y+yStep, z);\n\n\t\t\t\tgEngfuncs.pTriAPI->TexCoord2f( 0, 1 );\n\t\t\t\tgEngfuncs.pTriAPI->Vertex3f (x, y+yStep, z);\n\t\t\t\tgEngfuncs.pTriAPI->End();\n\n\t\t\t\tframe++;\n\t\t\t\tx+= xStep;\n\t\t\t}\n\n\t\t\ty+=yStep;\n\t\t}\n\t}\n\telse\n\t{\n\t\txStep = -(2*4096.0f / m_OverviewData.zoom ) / xTiles;\n\t\tyStep = -(2*4096.0f / (m_OverviewData.zoom* screenaspect) ) / yTiles;\n\n\n\t\tx = xs + (4096.0f / (m_OverviewData.zoom * screenaspect ));\n\n\t\t\n\t\t\n\t\tfor (ix = 0; ix < yTiles; ix++)\n\t\t{\n\t\t\t\n\t\t\ty = ys + (4096.0f / (m_OverviewData.zoom));\n\n\t\t\tfor (iy = 0; iy < xTiles; iy++)\n\t\t\t{\n\t\t\t\tif ( m_MapSprite )\n\t\t\t\t\tgEngfuncs.pTriAPI->SpriteTexture( m_MapSprite, frame );\n\t\t\t\telse\n\t\t\t\t\tgEngfuncs.pTriAPI->SpriteTexture( dummySprite, 0 );\n\n\t\t\t\tgEngfuncs.pTriAPI->Begin( TRI_QUADS );\n\t\t\t\tgEngfuncs.pTriAPI->TexCoord2f( 0, 0 );\n\t\t\t\tgEngfuncs.pTriAPI->Vertex3f (x, y, z);\n\n\t\t\t\tgEngfuncs.pTriAPI->TexCoord2f( 0, 1 );\n\t\t\t\tgEngfuncs.pTriAPI->Vertex3f (x+xStep ,y,  z);\n\n\t\t\t\tgEngfuncs.pTriAPI->TexCoord2f( 1, 1 );\n\t\t\t\tgEngfuncs.pTriAPI->Vertex3f (x+xStep, y+yStep, z);\n\n\t\t\t\tgEngfuncs.pTriAPI->TexCoord2f( 1, 0 );\n\t\t\t\tgEngfuncs.pTriAPI->Vertex3f (x, y+yStep, z);\n\t\t\t\tgEngfuncs.pTriAPI->End();\n\n\t\t\t\tframe++;\n\t\t\t\t\n\t\t\t\ty+=yStep;\n\t\t\t}\n\n\t\t\tx+= xStep;\n\t\t\t\n\t\t}\n\t}\n}\n\nvoid CHudSpectator::DrawOverviewEntities()\n{\n\tint\t\t\t\ti,ir,ig,ib;\n\tstruct model_s *hSpriteModel;\n\tvec3_t\t\t\torigin, angles, point, forward, right, left, up, world, screen, offset;\n\tfloat\t\t\tx,y,z, r,g,b, sizeScale = 4.0f;\n\tcl_entity_t *\tent;\n\tfloat rmatrix[3][4];\t// transformation matrix\n\t\n\tfloat\t\t\tzScale = (90.0f - v_angles[0] ) / 90.0f;\n\n\n\tz = m_OverviewData.layersHeights[0] * zScale;\n\t// get yellow/brown HUD color\n\tDrawUtils::UnpackRGB( ir, ig, ib, gHUD.m_iDefaultHUDColor );\n\tr = (float)ir/255.0f;\n\tg = (float)ig/255.0f;\n\tb = (float)ib/255.0f;\n\t\n\tgEngfuncs.pTriAPI->CullFace( TRI_NONE );\n\n\tfor (i=0; i < MAX_PLAYERS; i++ )\n\t\tm_vPlayerPos[i][2] = -1;\t// mark as invisible\n\n\t// draw all players\n\tfor (i=0 ; i < MAX_OVERVIEW_ENTITIES ; i++)\n\t{\n\t\tif ( !m_OverviewEntities[i].hSprite )\n\t\t\tcontinue;\n\n\t\thSpriteModel = (struct model_s *)gEngfuncs.GetSpritePointer( m_OverviewEntities[i].hSprite );\n\t\tent = m_OverviewEntities[i].entity;\n\t\t\n\t\tgEngfuncs.pTriAPI->SpriteTexture( hSpriteModel, 0 );\n\t\tgEngfuncs.pTriAPI->RenderMode( kRenderTransTexture );\n\n\t\t// see R_DrawSpriteModel\n\t\t// draws players sprite\n\n\t\tAngleVectors(ent->angles, right, up, NULL );\n\n\t\tVectorCopy(ent->origin,origin);\n\n\t\tgEngfuncs.pTriAPI->Begin( TRI_QUADS );\n\n\t\tgEngfuncs.pTriAPI->Color4f( 1.0, 1.0, 1.0, 1.0 );\n\n\t\tgEngfuncs.pTriAPI->TexCoord2f (1, 0);\n\t\tVectorMA (origin,  16.0f * sizeScale, up, point);\n\t\tVectorMA (point,   16.0f * sizeScale, right, point);\n\t\tpoint[2] *= zScale;\n\t\tgEngfuncs.pTriAPI->Vertex3fv (point);\n\n\t\tgEngfuncs.pTriAPI->TexCoord2f (0, 0);\n\n\t\tVectorMA (origin,  16.0f * sizeScale, up, point);\n\t\tVectorMA (point,  -16.0f * sizeScale, right, point);\n\t\tpoint[2] *= zScale;\n\t\tgEngfuncs.pTriAPI->Vertex3fv (point);\n\n\t\tgEngfuncs.pTriAPI->TexCoord2f (0,1);\n\t\tVectorMA (origin, -16.0f * sizeScale, up, point);\n\t\tVectorMA (point,  -16.0f * sizeScale, right, point);\n\t\tpoint[2] *= zScale;\n\t\tgEngfuncs.pTriAPI->Vertex3fv (point);\n\n\t\tgEngfuncs.pTriAPI->TexCoord2f (1,1);\n\t\tVectorMA (origin, -16.0f * sizeScale, up, point);\n\t\tVectorMA (point,   16.0f * sizeScale, right, point);\n\t\tpoint[2] *= zScale;\n\t\tgEngfuncs.pTriAPI->Vertex3fv (point);\n\n\t\tgEngfuncs.pTriAPI->End ();\n\n\n\t\tif ( !ent->player)\n\t\t\tcontinue;\n\t\t// draw line under player icons\n\t\torigin[2] *= zScale;\n\n\t\tgEngfuncs.pTriAPI->RenderMode( kRenderTransAdd );\n\n\t\thSpriteModel = (struct model_s *)gEngfuncs.GetSpritePointer( m_hsprBeam );\n\t\tgEngfuncs.pTriAPI->SpriteTexture( hSpriteModel, 0 );\n\n\t\tgEngfuncs.pTriAPI->Color4f(r, g, b, 0.3);\n\n\t\tgEngfuncs.pTriAPI->Begin ( TRI_QUADS );\n\t\tgEngfuncs.pTriAPI->TexCoord2f (1, 0);\n\t\tgEngfuncs.pTriAPI->Vertex3f (origin[0]+4, origin[1]+4, origin[2]-zScale);\n\t\tgEngfuncs.pTriAPI->TexCoord2f (0, 0);\n\t\tgEngfuncs.pTriAPI->Vertex3f (origin[0]-4, origin[1]-4, origin[2]-zScale);\n\t\tgEngfuncs.pTriAPI->TexCoord2f (0, 1);\n\t\tgEngfuncs.pTriAPI->Vertex3f (origin[0]-4, origin[1]-4,z);\n\t\tgEngfuncs.pTriAPI->TexCoord2f (1, 1);\n\t\tgEngfuncs.pTriAPI->Vertex3f (origin[0]+4, origin[1]+4,z);\n\t\tgEngfuncs.pTriAPI->End ();\n\n\t\tgEngfuncs.pTriAPI->Begin ( TRI_QUADS );\n\t\tgEngfuncs.pTriAPI->TexCoord2f (1, 0);\n\t\tgEngfuncs.pTriAPI->Vertex3f (origin[0]-4, origin[1]+4, origin[2]-zScale);\n\t\tgEngfuncs.pTriAPI->TexCoord2f (0, 0);\n\t\tgEngfuncs.pTriAPI->Vertex3f (origin[0]+4, origin[1]-4, origin[2]-zScale);\n\t\tgEngfuncs.pTriAPI->TexCoord2f (0, 1);\n\t\tgEngfuncs.pTriAPI->Vertex3f (origin[0]+4, origin[1]-4,z);\n\t\tgEngfuncs.pTriAPI->TexCoord2f (1, 1);\n\t\tgEngfuncs.pTriAPI->Vertex3f (origin[0]-4, origin[1]+4,z);\n\t\tgEngfuncs.pTriAPI->End ();\n\n\t\t// calculate screen position for name and infromation in hud::draw()\n\t\tif ( gEngfuncs.pTriAPI->WorldToScreen(origin,screen) )\n\t\t\tcontinue;\t// object is behind viewer\n\n\t\tscreen[0] = XPROJECT(screen[0]);\n\t\tscreen[1] = YPROJECT(screen[1]);\n\t\tscreen[2] = 0.0f;\n\n\t\t// calculate some offset under the icon\n\t\torigin[0]+=32.0f;\n\t\torigin[1]+=32.0f;\n\n\t\tgEngfuncs.pTriAPI->WorldToScreen(origin,offset);\n\n\t\toffset[0] = XPROJECT(offset[0]);\n\t\toffset[1] = YPROJECT(offset[1]);\n\t\toffset[2] = 0.0f;\n\n\t\tVectorSubtract(offset, screen, offset );\n\n\t\tint playerNum = ent->index - 1;\n\n\t\tm_vPlayerPos[playerNum][0] = screen[0];\n\t\tm_vPlayerPos[playerNum][1] = screen[1] + offset.Length();\n\t\tm_vPlayerPos[playerNum][2] = 1;\t// mark player as visible\n\t}\n\n\tif ( !m_pip->value || !m_drawcone->value )\n\t\treturn;\n\n\t// get current camera position and angle\n\n\tif ( m_pip->value == INSET_IN_EYE || g_iUser1 == OBS_IN_EYE )\n\t{\n\t\tV_GetInEyePos( g_iUser2, origin, angles );\n\t}\n\telse if ( m_pip->value == INSET_CHASE_FREE  || g_iUser1 == OBS_CHASE_FREE )\n\t{\n\t\tV_GetChasePos( g_iUser2, v_cl_angles, origin, angles );\n\t}\n\telse if ( g_iUser1 == OBS_ROAMING )\n\t{\n\t\tVectorCopy( v_sim_org, origin );\n\t\tVectorCopy( v_cl_angles, angles );\n\t}\n\telse\n\t\tV_GetChasePos( g_iUser2, NULL, origin, angles );\n\n\t\n\t// draw camera sprite\n\n\tx = origin[0];\n\ty = origin[1];\n\tz = origin[2];\n\n\tangles[0] = 0; // always show horizontal camera sprite\n\n\thSpriteModel = (struct model_s *)gEngfuncs.GetSpritePointer( m_hsprCamera );\n\tgEngfuncs.pTriAPI->RenderMode( kRenderTransAdd );\n\tgEngfuncs.pTriAPI->SpriteTexture( hSpriteModel, 0 );\n\t\n\t\n\tgEngfuncs.pTriAPI->Color4f( r, g, b, 1.0 );\n\n\tAngleVectors(angles, forward, NULL, NULL );\n\tVectorScale (forward, 512.0f, forward);\n\t\n\toffset[0] =  0.0f;\n\toffset[1] = 45.0f;\n\toffset[2] =  0.0f;\n\n\tAngleMatrix(offset, rmatrix );\n\tVectorTransform(forward, rmatrix , right );\n\n\toffset[1]= -45.0f;\n\tAngleMatrix(offset, rmatrix );\n\tVectorTransform(forward, rmatrix , left );\n\n\tgEngfuncs.pTriAPI->Begin (TRI_TRIANGLES);\n\tgEngfuncs.pTriAPI->TexCoord2f( 0, 0 );\n\tgEngfuncs.pTriAPI->Vertex3f (x+right[0], y+right[1], (z+right[2]) * zScale);\n\n\tgEngfuncs.pTriAPI->TexCoord2f( 0, 1 );\n\tgEngfuncs.pTriAPI->Vertex3f (x, y, z  * zScale);\n\n\tgEngfuncs.pTriAPI->TexCoord2f( 1, 1 );\n\tgEngfuncs.pTriAPI->Vertex3f (x+left[0], y+left[1], (z+left[2]) * zScale);\n\tgEngfuncs.pTriAPI->End ();\n\n}\n\n\n\nvoid CHudSpectator::DrawOverview()\n{\n\tstatic bool glClearForce = false;\n\tstatic float old_glClearValue;\n\n\t// draw only in sepctator mode\n\tif ( !g_iUser1 || (m_iDrawCycle == 0 &&  ( (g_iUser1 != OBS_MAP_FREE) && (g_iUser1 != OBS_MAP_CHASE) )) || (m_iDrawCycle == 1 && m_pip->value < INSET_MAP_FREE) )\n\t{\n\t\t// fix non clearing background for overview\n\t\tif( glClearForce )\n\t\t{\n\t\t\tgEngfuncs.Cvar_SetValue(\"gl_clear\", old_glClearValue );\n\t\t\tglClearForce = false;\n\t\t}\n\t\treturn;\n\t}\n\n\t// fix non clearing background for overview\n\tif( !glClearForce )\n\t{\n\t\told_glClearValue = CVAR_GET_FLOAT(\"gl_clear\");\n\t\tgEngfuncs.Cvar_Set(\"gl_clear\", \"1\");\n\t\tglClearForce = true;\n\t}\n\n\tDrawOverviewLayer();\n\tDrawOverviewEntities();\n\tCheckOverviewEntities();\n}\nvoid CHudSpectator::CheckOverviewEntities()\n{\n\tdouble time = gEngfuncs.GetClientTime();\n\n\t// removes old entities from list\n\tfor ( int i = 0; i< MAX_OVERVIEW_ENTITIES; i++ )\n\t{\n\t\t// remove entity from list if it is too old\n\t\tif ( m_OverviewEntities[i].killTime < time )\n\t\t{\n\t\t\tmemset( &m_OverviewEntities[i], 0, sizeof (overviewEntity_t) );\n\t\t}\n\t}\n}\n\nbool CHudSpectator::AddOverviewEntity( int type, struct cl_entity_s *ent, const char *modelname)\n{\n\tHSPRITE\thSprite = 0;\n\tdouble  duration = -1.0f;\t// duration -1 means show it only this frame;\n\n\tif ( !ent )\n\t\treturn false;\n\n\tif ( type == ET_PLAYER )\n\t{\n\t\tif ( ent->curstate.solid != SOLID_NOT)\n\t\t{\n\t\t\tswitch ( g_PlayerExtraInfo[ent->index].teamnumber )\n\t\t\t{\n\t\t\t// blue and red teams are swapped in CS and TFC\n\t\t\tcase TEAM_TERRORIST: hSprite = m_hsprPlayerRed; break;\n\t\t\tcase TEAM_CT: hSprite = m_hsprPlayerBlue; break;\n\t\t\tdefault: hSprite = m_hsprPlayer; break;\n\t\t\t}\n\n\t\t\tif( g_PlayerExtraInfo[ent->index].has_c4 )\n\t\t\t\thSprite = m_hsprPlayerC4;\n\t\t\telse if( g_PlayerExtraInfo[ent->index].vip )\n\t\t\t\thSprite = m_hsprPlayerVIP;\n\n\t\t\treturn AddOverviewEntityToList(hSprite, ent, gEngfuncs.GetClientTime() + duration );\n\t\t}\n\t\telse\n\t\t\treturn false;\t// it's an spectator\n\t}\n\t/*else if (type == ET_NORMAL)\n\t{\n\t\treturn false;\n\t}\n\telse\n\t{\n\t\telse return false;\n\t}*/\n\n\tif( !stricmp( modelname, \"models/w_c4.mdl\" ))\n\t\thSprite = m_hsprBomb;\n\telse if( !stricmp( modelname, \"models/w_backpack.mdl\" ))\n\t\thSprite = m_hsprBackpack;\n\telse if( strstr( modelname, \"models/hostage\") || strstr( modelname, \"models/scientist\"))\n\t\thSprite = m_hsprHostage;\n\telse return false;\n\n\treturn AddOverviewEntityToList(hSprite, ent, gEngfuncs.GetClientTime() + duration );\n}\n\nvoid CHudSpectator::DeathMessage(int victim)\n{\n\t// find out where the victim is\n\tcl_entity_t *pl = gEngfuncs.GetEntityByIndex(victim);\n\n\tif (pl && pl->player)\n\t\tAddOverviewEntityToList(m_hsprPlayerDead, pl, gEngfuncs.GetClientTime() + 2.0f );\n}\n\nbool CHudSpectator::AddOverviewEntityToList(HSPRITE sprite, cl_entity_t *ent, double killTime)\n{\n\tfor ( int i = 0; i< MAX_OVERVIEW_ENTITIES; i++ )\n\t{\n\t\t// find empty entity slot\n\t\tif ( m_OverviewEntities[i].entity == NULL)\n\t\t{\n\t\t\tm_OverviewEntities[i].entity = ent;\n\t\t\tm_OverviewEntities[i].hSprite = sprite;\n\t\t\tm_OverviewEntities[i].killTime = killTime;\n\t\t\treturn true;\n\t\t}\n\t}\n\n\treturn false;\t// maximum overview entities reached\n}\nvoid CHudSpectator::CheckSettings()\n{\n\t// disallow same inset mode as main mode:\n\n\tm_pip->value = (int)m_pip->value;\n\t\n\tif ( ( g_iUser1 < OBS_MAP_FREE ) && ( m_pip->value == INSET_CHASE_FREE || m_pip->value == INSET_IN_EYE ) )\n\t{\n\t\t// otherwise both would show in World picures\n\t\tm_pip->value = INSET_MAP_FREE;\n\t}\n\n\tif ( ( g_iUser1 >= OBS_MAP_FREE ) && ( m_pip->value >= INSET_MAP_FREE ) )\n\t{\n\t\t// both would show map views\n\t\tm_pip->value = INSET_CHASE_FREE;\n\t}\n\n\t// disble in intermission screen\n\tif ( gHUD.m_iIntermission )\n\t\tm_pip->value = INSET_OFF;\n\n\t// check chat mode\n\tif ( m_chatEnabled != (gHUD.m_SayText.m_HUD_saytext->value!=0) )\n\t{\n\t\t// hud_saytext changed\n\t\tm_chatEnabled = (gHUD.m_SayText.m_HUD_saytext->value!=0);\n\n\t\tif ( gEngfuncs.IsSpectateOnly() )\n\t\t{\n\t\t\t// tell proxy our new chat mode\n\t\t\tchar chatcmd[32];\n\t\t\tsprintf(chatcmd, \"ignoremsg %i\", m_chatEnabled?0:1 );\n\t\t\tgEngfuncs.pfnServerCmd(chatcmd);\n\t\t}\n\t}\n\n\t// if we are a real player on server don't allow inset window\n\t// in First Person mode since this is our restricted forcecamera mode 2\n\t// team number 3 = SPECTATOR see player.h\n\n\tif ( ( (g_iTeamNumber == 1) || (g_iTeamNumber == 2)) && (g_iUser1 == OBS_IN_EYE) )\n\t\tm_pip->value = INSET_OFF;\n\n\t// draw small border around inset view, adjust upper black bar\n\t//\tgViewPort->m_pSpectatorPanel->EnableInsetView( m_pip->value != INSET_OFF );\n}\n\nint CHudSpectator::ToggleInset(bool allowOff)\n{\n\tint newInsetMode = (int)m_pip->value + 1;\n\n\tif ( g_iUser1 < OBS_MAP_FREE )\n\t{\n\t\tif ( newInsetMode > INSET_MAP_CHASE )\n\t\t{\n\t\t\tif (allowOff)\n\t\t\t\tnewInsetMode = INSET_OFF;\n\t\t\telse\n\t\t\t\tnewInsetMode = INSET_MAP_FREE;\n\t\t}\n\n\t\tif ( newInsetMode == INSET_CHASE_FREE )\n\t\t\tnewInsetMode = INSET_MAP_FREE;\n\t}\n\telse\n\t{\n\t\tif ( newInsetMode > INSET_IN_EYE )\n\t\t{\n\t\t\tif (allowOff)\n\t\t\t\tnewInsetMode = INSET_OFF;\n\t\t\telse\n\t\t\t\tnewInsetMode = INSET_CHASE_FREE;\n\t\t}\n\t}\n\n\treturn newInsetMode;\n}\nvoid CHudSpectator::Reset()\n{\n\t// Reset HUD\n\tif ( strcmp( m_OverviewData.map, gEngfuncs.pfnGetLevelName() ) )\n\t{\n\t\t// update level overview if level changed\n\t\tParseOverviewFile();\n\t\tLoadMapSprites();\n\t}\n\n\tmemset( &m_OverviewEntities, 0, sizeof(m_OverviewEntities));\n\n\tSetSpectatorStartPosition();\n}\n\nvoid CHudSpectator::InitHUDData()\n{\n\tm_lastPrimaryObject = m_lastSecondaryObject = 0;\n\tm_flNextObserverInput = 0.0f;\n\tm_lastHudMessage = 0;\n\tm_iSpectatorNumber = 0;\n\tiJumpSpectator\t= 0;\n\tg_iUser1 = g_iUser2 = 0;\n\n\tmemset( &m_OverviewData, 0, sizeof(m_OverviewData));\n\tmemset( &m_OverviewEntities, 0, sizeof(m_OverviewEntities));\n\n\tif ( gEngfuncs.IsSpectateOnly() || gEngfuncs.pDemoAPI->IsPlayingback() )\n\t\tm_autoDirector->value = 1.0f;\n\telse\n\t\tm_autoDirector->value = 0.0f;\n\n\tReset();\n\n\tSetModes( OBS_CHASE_FREE, INSET_OFF );\n\n\tg_iUser2 = 0; // fake not target until first camera command\n\n\t// reset HUD FOV\n\tgHUD.m_iFOV =  CVAR_GET_FLOAT(\"default_fov\");\n}\n\nint CHudSpectator::MsgFunc_Spectator(const char *pszName, int iSize, void *buf)\n{\n\treturn 1;\n}\n\nint CHudSpectator::MsgFunc_ADStop(const char *pszName, int iSize, void *buf)\n{\n\tm_autoDirector->value = 0;\n\treturn 1;\n}\n"
  },
  {
    "path": "cl_dll/hud_spectator.h",
    "content": "//========= Copyright ? 1996-2002, Valve LLC, All rights reserved. ============\n//\n// Purpose:\n//\n// $NoKeywords: $\n//=============================================================================\n#pragma once\n#ifndef SPECTATOR_H\n#define SPECTATOR_H\n\n#include \"cl_entity.h\"\n#include \"hud.h\"\n\n\n#define INSET_OFF\t\t\t\t0\n#define INSET_CHASE_LOCKED\t\t1\n#define\tINSET_CHASE_FREE\t\t2\n#define\tINSET_IN_EYE\t\t\t3\n#define\tINSET_MAP_FREE\t\t\t4\n#define\tINSET_MAP_CHASE\t\t\t5\n\n#define MAX_SPEC_HUD_MESSAGES\t8\n\n\n\n#define OVERVIEW_TILE_SIZE\t\t256\t\t// don't change this\n#define OVERVIEW_MAX_LAYERS\t\t1\n\n//-----------------------------------------------------------------------------\n// Purpose: Handles the drawing of the spectator stuff (camera & top-down map and all the things on it )\n//-----------------------------------------------------------------------------\n\ntypedef struct overviewInfo_s {\n\tchar\t\tmap[64];\t// cl.levelname or empty\n\tvec3_t\t\torigin;\t\t// center of map\n\tfloat\t\tzoom;\t\t// zoom of map images\n\tint\t\t\tlayers;\t\t// how may layers do we have\n\tfloat\t\tlayersHeights[OVERVIEW_MAX_LAYERS];\n\tchar\t\tlayersImages[OVERVIEW_MAX_LAYERS][255];\n\tqboolean\trotated;\t// are map images rotated (90 degrees) ?\n\n\tint\t\t\tinsetWindowX;\n\tint\t\t\tinsetWindowY;\n\tint\t\t\tinsetWindowHeight;\n\tint\t\t\tinsetWindowWidth;\n} overviewInfo_t;\n\ntypedef struct overviewEntity_s {\n\n\tHSPRITE\t\t\t\t\thSprite;\n\tstruct cl_entity_s *\tentity;\n\tdouble\t\t\t\t\tkillTime;\n} overviewEntity_t;\n\n#define\t MAX_OVERVIEW_ENTITIES\t\t128\n\nclass CHudSpectator : public CHudBase\n{\npublic:\n\tvoid Reset();\n\n\tint  ToggleInset(bool allowOff);\n\tvoid CheckSettings();\n\tvoid InitHUDData( void );\n\tbool AddOverviewEntityToList( HSPRITE sprite, cl_entity_t * ent, double killTime);\n\tvoid DeathMessage(int victim);\n\tbool AddOverviewEntity( int type, struct cl_entity_s *ent, const char *modelname );\n\tvoid CheckOverviewEntities();\n\tvoid DrawOverview();\n\tvoid DrawOverviewEntities();\n\tvoid GetMapPosition( float * returnvec );\n\tvoid DrawOverviewLayer();\n\tvoid LoadMapSprites();\n\tbool ParseOverviewFile();\n\tbool IsActivePlayer(cl_entity_t * ent);\n\tvoid SetModes(int iMainMode, int iInsetMode);\n\tvoid HandleButtonsDown(int ButtonPressed);\n\tvoid HandleButtonsUp(int ButtonPressed);\n\tvoid FindNextPlayer( bool bReverse );\n\tvoid DirectorMessage( int iSize, void *pbuf );\n\tvoid SetSpectatorStartPosition();\n\tCHudMsgFunc(Spectator);\n\tCHudMsgFunc(ADStop);\n\tint Init();\n\tint VidInit();\n\n\tint Draw(float flTime);\n\n\tint m_iDrawCycle;\n\tclient_textmessage_t m_HUDMessages[MAX_SPEC_HUD_MESSAGES];\n\tchar\t\t\t\tm_HUDMessageText[MAX_SPEC_HUD_MESSAGES][128];\n\tint\t\t\t\t\tm_lastHudMessage;\n\toverviewInfo_t\t\tm_OverviewData;\n\toverviewEntity_t\tm_OverviewEntities[MAX_OVERVIEW_ENTITIES];\n\tint\t\t\t\t\tm_iObserverFlags;\n\tint\t\t\t\t\tm_iSpectatorNumber;\n\n\tfloat\t\t\t\tm_mapZoom;\t\t// zoom the user currently uses\n\tvec3_t\t\t\t\tm_mapOrigin;\t// origin where user rotates around\n\tcvar_t *\t\t\tm_drawnames;\n\tcvar_t *\t\t\tm_drawcone;\n\tcvar_t *\t\t\tm_drawstatus;\n\tcvar_t *\t\t\tm_HUD_saytext;\n\tcvar_t *\t\t\tm_autoDirector;\n\tfloat\t\t\t\tm_lastAutoDirector;\n\tcvar_t *\t\t\tm_pip;\n\n\n\tqboolean\t\t\tm_chatEnabled;\n\n\tvec3_t\t\t\t\tm_cameraOrigin;\t// a help camera\n\tvec3_t\t\t\t\tm_cameraAngles;\t// and it's angles\n\n\nprivate:\n\tvec3_t\t\tm_vPlayerPos[MAX_PLAYERS];\n\tHSPRITE\t\tm_hsprPlayerC4;\n\tHSPRITE\t\tm_hsprPlayerVIP;\n\tHSPRITE\t\tm_hsprHostage;\n\tHSPRITE\t\tm_hsprBackpack;\n\tHSPRITE\t\tm_hsprBomb;\n\tHSPRITE\t\tm_hsprPlayerBlue;\n\tHSPRITE\t\tm_hsprPlayerRed;\n\tHSPRITE\t\tm_hsprPlayer;\n\tHSPRITE\t\tm_hsprCamera;\n\tHSPRITE\t\tm_hsprPlayerDead;\n\tHSPRITE\t\tm_hsprViewcone;\n\tHSPRITE\t\tm_hsprUnkownMap;\n\tHSPRITE\t\tm_hsprBeam;\n\n\twrect_t\t\tm_crosshairRect;\n\n\tstruct model_s * m_MapSprite;\t// each layer image is saved in one sprite, where each tile is a sprite frame\n\tfloat\t\tm_flNextObserverInput;\n\tfloat\t\tm_zoomDelta;\n\tfloat\t\tm_moveDelta;\n\tint\t\t\tm_lastPrimaryObject;\n\tint\t\t\tm_lastSecondaryObject;\n};\n\n#endif // SPECTATOR_H\n"
  },
  {
    "path": "cl_dll/hud_update.cpp",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\t\n*\tThis product contains software technology licensed from Id \n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc. \n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n//\n//  hud_update.cpp\n//\n\n#include <math.h>\n#include \"hud.h\"\n#include \"cl_util.h\"\n#include <stdlib.h>\n#include <memory.h>\n\nint CL_ButtonBits( int );\nvoid CL_ResetButtonBits( int bits );\n\nextern float v_idlescale;\nextern void HUD_SetCmdBits( int bits );\n\nint CHud::UpdateClientData(client_data_t *cdata, float time)\n{\n\tm_vecOrigin = cdata->origin;\n\tm_vecAngles = cdata->viewangles;\n\n\tm_iKeyBits = CL_ButtonBits( 0 );\n\tm_iWeaponBits = cdata->iWeaponBits;\n\n\tThink();\n\n\tcdata->fov = m_iFOV;\n\t\n\tv_idlescale = m_iConcussionEffect;\n\n\tCL_ResetButtonBits( m_iKeyBits );\n\n\t// return 1 if in anything in the client_data struct has been changed, 0 otherwise\n\treturn 1;\n}\n\n\n"
  },
  {
    "path": "cl_dll/hud_vgui2print.cpp",
    "content": ""
  },
  {
    "path": "cl_dll/in_camera.cpp",
    "content": "//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============\n//\n// Purpose: \n//\n// $NoKeywords: $\n//=============================================================================\n\n#include \"hud.h\"\n#include \"cl_util.h\"\n#include \"camera.h\"\n#include \"kbutton.h\"\n#include \"cvardef.h\"\n#include \"usercmd.h\"\n#include \"const.h\"\n#include \"camera.h\"\n#include \"in_defs.h\"\n#ifdef _WIN32\n#include \"port.h\"\n#endif\nfloat CL_KeyState (kbutton_t *key);\n\nextern cl_enginefunc_t gEngfuncs;\n\n//-------------------------------------------------- Constants\n\n#define CAM_DIST_DELTA 1.0\n#define CAM_ANGLE_DELTA 2.5\n#define CAM_ANGLE_SPEED 2.5\n#define CAM_MIN_DIST 30.0\n#define CAM_ANGLE_MOVE .5\n#define MAX_ANGLE_DIFF 10.0\n#define PITCH_MAX 90.0\n#define PITCH_MIN 0\n#define YAW_MAX  135.0\n#define YAW_MIN\t -135.0\n\nenum ECAM_Command\n{\n\tCAM_COMMAND_NONE = 0,\n\tCAM_COMMAND_TOTHIRDPERSON = 1,\n\tCAM_COMMAND_TOFIRSTPERSON = 2\n};\n\n//-------------------------------------------------- Global Variables\n\ncvar_t\t*cam_command;\ncvar_t\t*cam_snapto;\ncvar_t\t*cam_idealyaw;\ncvar_t\t*cam_idealpitch;\ncvar_t\t*cam_idealdist;\ncvar_t\t*cam_contain;\n\ncvar_t\t*c_maxpitch;\ncvar_t\t*c_minpitch;\ncvar_t\t*c_maxyaw;\ncvar_t\t*c_minyaw;\ncvar_t\t*c_maxdistance;\ncvar_t\t*c_mindistance;\n\n// pitch, yaw, dist\nvec3_t cam_ofs;\n\n// In third person\nint cam_thirdperson;\nint cam_mousemove; //true if we are moving the cam with the mouse, False if not\nint iMouseInUse=0;\nint cam_distancemove;\nextern int mouse_x, mouse_y;  //used to determine what the current x and y values are\nint cam_old_mouse_x, cam_old_mouse_y; //holds the last ticks mouse movement\nPOINT\t\tcam_mouse;\n//-------------------------------------------------- Local Variables\n\nstatic kbutton_t cam_pitchup, cam_pitchdown, cam_yawleft, cam_yawright;\nstatic kbutton_t cam_in, cam_out;\n\n//-------------------------------------------------- Prototypes\n\nvoid CAM_ToThirdPerson(void);\nvoid CAM_ToFirstPerson(void);\nvoid CAM_StartDistance(void);\nvoid CAM_EndDistance(void);\n\n\n//-------------------------------------------------- Local Functions\n\nfloat MoveToward( float cur, float goal, float maxspeed )\n{\n\tif( cur != goal )\n\t{\n\t\tif( fabs( cur - goal ) > 180.0 )\n\t\t{\n\t\t\tif( cur < goal )\n\t\t\t\tcur += 360.0;\n\t\t\telse\n\t\t\t\tcur -= 360.0;\n\t\t}\n\n\t\tif( cur < goal )\n\t\t{\n\t\t\tif( cur < goal - 1.0 )\n\t\t\t\tcur += ( goal - cur ) / 4.0;\n\t\t\telse\n\t\t\t\tcur = goal;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif( cur > goal + 1.0 )\n\t\t\t\tcur -= ( cur - goal ) / 4.0;\n\t\t\telse\n\t\t\t\tcur = goal;\n\t\t}\n\t}\n\n\n\t// bring cur back into range\n\tif( cur < 0 )\n\t\tcur += 360.0;\n\telse if( cur >= 360 )\n\t\tcur -= 360;\n\n\treturn cur;\n}\n\n\n//-------------------------------------------------- Global Functions\n\nstruct moveclip_t\n{\n\tvec3_t\t\tboxmins, boxmaxs;// enclose the test object along entire move\n\tfloat\t\t*mins, *maxs;\t// size of the moving object\n\tvec3_t\t\tmins2, maxs2;\t// size when clipping against mosnters\n\tfloat\t\t*start, *end;\n\ttrace_t\t\ttrace;\n\tint\t\t\ttype;\n\tedict_t\t\t*passedict;\n\tqboolean\tmonsterclip;\n};\n\nvoid DLLEXPORT CAM_Think( void )\n{\n\tvec3_t origin;\n\tvec3_t ext, pnt, camForward, camRight, camUp;\n\tmoveclip_t\tclip;\n\tfloat dist;\n\tvec3_t camAngles;\n\tfloat flSensitivity;\n\tvec3_t viewangles;\n\n\tswitch( (int) cam_command->value )\n\t{\n\t\tcase CAM_COMMAND_TOTHIRDPERSON:\n\t\t\tCAM_ToThirdPerson();\n\t\t\tbreak;\n\n\t\tcase CAM_COMMAND_TOFIRSTPERSON:\n\t\t\tCAM_ToFirstPerson();\n\t\t\tbreak;\n\n\t\tcase CAM_COMMAND_NONE:\n\t\tdefault:\n\t\t\tbreak;\n\t}\n\n\tif( !cam_thirdperson )\n\t\treturn;\n\t\n\tcamAngles[ PITCH ] = cam_idealpitch->value;\n\tcamAngles[ YAW ] = cam_idealyaw->value;\n\tdist = cam_idealdist->value;\n\t//\n\t//movement of the camera with the mouse\n\t//\n\tif (cam_mousemove)\n\t{\n\t    //get windows cursor position\n\t\tGetCursorPos (&cam_mouse);\n\t\t//check for X delta values and adjust accordingly\n\t\t//eventually adjust YAW based on amount of movement\n\t  //don't do any movement of the cam using YAW/PITCH if we are zooming in/out the camera\t\n\t  if (!cam_distancemove)\n\t  {\n\t\t\n\t\t//keep the camera within certain limits around the player (ie avoid certain bad viewing angles)  \n\t\tif (cam_mouse.x>gEngfuncs.GetWindowCenterX())\n\t\t{\n\t\t\t//if ((camAngles[YAW]>=225.0)||(camAngles[YAW]<135.0))\n\t\t\tif (camAngles[YAW]<c_maxyaw->value)\n\t\t\t{\n\t\t\t\tcamAngles[ YAW ] += (CAM_ANGLE_MOVE)*((cam_mouse.x-gEngfuncs.GetWindowCenterX())/2);\n\t\t\t}\n\t\t\tif (camAngles[YAW]>c_maxyaw->value)\n\t\t\t{\n\t\t\t\t\n\t\t\t\tcamAngles[YAW]=c_maxyaw->value;\n\t\t\t}\n\t\t}\n\t\telse if (cam_mouse.x<gEngfuncs.GetWindowCenterX())\n\t\t{\n\t\t\t//if ((camAngles[YAW]<=135.0)||(camAngles[YAW]>225.0))\n\t\t\tif (camAngles[YAW]>c_minyaw->value)\n\t\t\t{\n\t\t\t   camAngles[ YAW ] -= (CAM_ANGLE_MOVE)* ((gEngfuncs.GetWindowCenterX()-cam_mouse.x)/2);\n\t\t\t   \t\n\t\t\t}\n\t\t\tif (camAngles[YAW]<c_minyaw->value)\n\t\t\t{\n\t\t\t\tcamAngles[YAW]=c_minyaw->value;\n\t\t\t\t\n\t\t\t}\n\t\t}\n\n\t\t//check for y delta values and adjust accordingly\n\t\t//eventually adjust PITCH based on amount of movement\n\t\t//also make sure camera is within bounds\n\t\tif (cam_mouse.y>gEngfuncs.GetWindowCenterY())\n\t\t{\n\t\t\tif(camAngles[PITCH]<c_maxpitch->value)\n\t\t\t{\n\t\t\t    camAngles[PITCH] +=(CAM_ANGLE_MOVE)* ((cam_mouse.y-gEngfuncs.GetWindowCenterY())/2);\n\t\t\t}\n\t\t\tif (camAngles[PITCH]>c_maxpitch->value)\n\t\t\t{\n\t\t\t\tcamAngles[PITCH]=c_maxpitch->value;\n\t\t\t}\n\t\t}\n\t\telse if (cam_mouse.y<gEngfuncs.GetWindowCenterY())\n\t\t{\n\t\t\tif (camAngles[PITCH]>c_minpitch->value)\n\t\t\t{\n\t\t\t   camAngles[PITCH] -= (CAM_ANGLE_MOVE)*((gEngfuncs.GetWindowCenterY()-cam_mouse.y)/2);\n\t\t\t}\n\t\t\tif (camAngles[PITCH]<c_minpitch->value)\n\t\t\t{\n\t\t\t\tcamAngles[PITCH]=c_minpitch->value;\n\t\t\t}\n\t\t}\n\n\t\t//set old mouse coordinates to current mouse coordinates\n\t\t//since we are done with the mouse\n\n\t\tif ( ( flSensitivity = gHUD.GetSensitivity() ) != 0 )\n\t\t{\n\t\t\tcam_old_mouse_x=cam_mouse.x*flSensitivity;\n\t\t\tcam_old_mouse_y=cam_mouse.y*flSensitivity;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tcam_old_mouse_x=cam_mouse.x;\n\t\t\tcam_old_mouse_y=cam_mouse.y;\n\t\t}\n\t\tSetCursorPos (gEngfuncs.GetWindowCenterX(), gEngfuncs.GetWindowCenterY());\n\t  }\n\t}\n\n\t//Nathan code here\n\tif( CL_KeyState( &cam_pitchup ) )\n\t\tcamAngles[ PITCH ] += CAM_ANGLE_DELTA;\n\telse if( CL_KeyState( &cam_pitchdown ) )\n\t\tcamAngles[ PITCH ] -= CAM_ANGLE_DELTA;\n\n\tif( CL_KeyState( &cam_yawleft ) )\n\t\tcamAngles[ YAW ] -= CAM_ANGLE_DELTA;\n\telse if( CL_KeyState( &cam_yawright ) )\n\t\tcamAngles[ YAW ] += CAM_ANGLE_DELTA;\n\n\tif( CL_KeyState( &cam_in ) )\n\t{\n\t\tdist -= CAM_DIST_DELTA;\n\t\tif( dist < CAM_MIN_DIST )\n\t\t{\n\t\t\t// If we go back into first person, reset the angle\n\t\t\tcamAngles[ PITCH ] = 0;\n\t\t\tcamAngles[ YAW ] = 0;\n\t\t\tdist = CAM_MIN_DIST;\n\t\t}\n\n\t}\n\telse if( CL_KeyState( &cam_out ) )\n\t\tdist += CAM_DIST_DELTA;\n\n\tif (cam_distancemove)\n\t{\n\t\tif (cam_mouse.y>gEngfuncs.GetWindowCenterY())\n\t\t{\n\t\t\tif(dist<c_maxdistance->value)\n\t\t\t{\n\t\t\t\tdist +=CAM_DIST_DELTA * ((cam_mouse.y-gEngfuncs.GetWindowCenterY())/2.0);\n\t\t\t}\n\t\t\tif (dist>c_maxdistance->value)\n\t\t\t{\n\t\t\t\tdist=c_maxdistance->value;\n\t\t\t}\n\t\t}\n\t\telse if (cam_mouse.y<gEngfuncs.GetWindowCenterY())\n\t\t{\n\t\t\tif (dist>c_mindistance->value)\n\t\t\t{\n\t\t\t   dist -= (CAM_DIST_DELTA)*((gEngfuncs.GetWindowCenterY()-cam_mouse.y)/2.0);\n\t\t\t}\n\t\t\tif (dist<c_mindistance->value)\n\t\t\t{\n\t\t\t\tdist=c_mindistance->value;\n\t\t\t}\n\t\t}\n\t\t//set old mouse coordinates to current mouse coordinates\n\t\t//since we are done with the mouse\n\t\tcam_old_mouse_x=cam_mouse.x*gHUD.GetSensitivity();\n\t\tcam_old_mouse_y=cam_mouse.y*gHUD.GetSensitivity();\n\t\tSetCursorPos (gEngfuncs.GetWindowCenterX(), gEngfuncs.GetWindowCenterY());\n\t}\n\t// update ideal\n\tcam_idealpitch->value = camAngles[ PITCH ];\n\tcam_idealyaw->value = camAngles[ YAW ];\n\tcam_idealdist->value = dist;\n\n\t// Move towards ideal\n\tVectorCopy( cam_ofs, camAngles );\n\n\tgEngfuncs.GetViewAngles( (float *)viewangles );\n\n\tif( cam_snapto->value )\n\t{\n\t\tcamAngles[ YAW ] = cam_idealyaw->value + viewangles[ YAW ];\n\t\tcamAngles[ PITCH ] = cam_idealpitch->value + viewangles[ PITCH ];\n\t\tcamAngles[ 2 ] = cam_idealdist->value;\n\t}\n\telse\n\t{\n\t\tif( camAngles[ YAW ] - viewangles[ YAW ] != cam_idealyaw->value )\n\t\t\tcamAngles[ YAW ] = MoveToward( camAngles[ YAW ], cam_idealyaw->value + viewangles[ YAW ], CAM_ANGLE_SPEED );\n\n\t\tif( camAngles[ PITCH ] - viewangles[ PITCH ] != cam_idealpitch->value )\n\t\t\tcamAngles[ PITCH ] = MoveToward( camAngles[ PITCH ], cam_idealpitch->value + viewangles[ PITCH ], CAM_ANGLE_SPEED );\n\n\t\tif( fabs( camAngles[ 2 ] - cam_idealdist->value ) < 2.0 )\n\t\t\tcamAngles[ 2 ] = cam_idealdist->value;\n\t\telse\n\t\t\tcamAngles[ 2 ] += ( cam_idealdist->value - camAngles[ 2 ] ) / 4.0;\n\t}\n\tcam_ofs[ 0 ] = camAngles[ 0 ];\n\tcam_ofs[ 1 ] = camAngles[ 1 ];\n\tcam_ofs[ 2 ] = dist;\n}\n\nextern void KeyDown (kbutton_t *b);\t// HACK\nextern void KeyUp (kbutton_t *b);\t// HACK\n\nvoid CAM_PitchUpDown(void) { KeyDown( &cam_pitchup ); }\nvoid CAM_PitchUpUp(void) { KeyUp( &cam_pitchup ); }\nvoid CAM_PitchDownDown(void) { KeyDown( &cam_pitchdown ); }\nvoid CAM_PitchDownUp(void) { KeyUp( &cam_pitchdown ); }\nvoid CAM_YawLeftDown(void) { KeyDown( &cam_yawleft ); }\nvoid CAM_YawLeftUp(void) { KeyUp( &cam_yawleft ); }\nvoid CAM_YawRightDown(void) { KeyDown( &cam_yawright ); }\nvoid CAM_YawRightUp(void) { KeyUp( &cam_yawright ); }\nvoid CAM_InDown(void) { KeyDown( &cam_in ); }\nvoid CAM_InUp(void) { KeyUp( &cam_in ); }\nvoid CAM_OutDown(void) { KeyDown( &cam_out ); }\nvoid CAM_OutUp(void) { KeyUp( &cam_out ); }\n\nvoid CAM_ToThirdPerson(void)\n{ \n\tvec3_t viewangles;\n\n#if !defined( _DEBUG )\n\tif ( gEngfuncs.GetMaxClients() > 1 )\n\t{\n\t\t// no thirdperson in multiplayer.\n\t\treturn;\n\t}\n#endif\n\n\tgEngfuncs.GetViewAngles( (float *)viewangles );\n\n\tif( !cam_thirdperson )\n\t{\n\t\tcam_thirdperson = 1; \n\t\t\n\t\tcam_ofs[ YAW ] = viewangles[ YAW ]; \n\t\tcam_ofs[ PITCH ] = viewangles[ PITCH ]; \n\t\tcam_ofs[ 2 ] = CAM_MIN_DIST; \n\t}\n\n\tgEngfuncs.Cvar_SetValue( \"cam_command\", 0 );\n}\n\nvoid CAM_ToFirstPerson(void) \n{ \n\tcam_thirdperson = 0;\n\t\n\tgEngfuncs.Cvar_SetValue( \"cam_command\", 0 );\n}\n\nvoid CAM_ToggleSnapto( void )\n{ \n\tgEngfuncs.Cvar_SetValue( \"cam_snapto\", cam_snapto->value ? 0.0 : 1.0 );\n\t//cam_snapto->value = !cam_snapto->value;\n}\n\nvoid CAM_Init( void )\n{\n\tgEngfuncs.pfnAddCommand( \"+campitchup\", CAM_PitchUpDown );\n\tgEngfuncs.pfnAddCommand( \"-campitchup\", CAM_PitchUpUp );\n\tgEngfuncs.pfnAddCommand( \"+campitchdown\", CAM_PitchDownDown );\n\tgEngfuncs.pfnAddCommand( \"-campitchdown\", CAM_PitchDownUp );\n\tgEngfuncs.pfnAddCommand( \"+camyawleft\", CAM_YawLeftDown );\n\tgEngfuncs.pfnAddCommand( \"-camyawleft\", CAM_YawLeftUp );\n\tgEngfuncs.pfnAddCommand( \"+camyawright\", CAM_YawRightDown );\n\tgEngfuncs.pfnAddCommand( \"-camyawright\", CAM_YawRightUp );\n\tgEngfuncs.pfnAddCommand( \"+camin\", CAM_InDown );\n\tgEngfuncs.pfnAddCommand( \"-camin\", CAM_InUp );\n\tgEngfuncs.pfnAddCommand( \"+camout\", CAM_OutDown );\n\tgEngfuncs.pfnAddCommand( \"-camout\", CAM_OutUp );\n\tgEngfuncs.pfnAddCommand( \"thirdperson\", CAM_ToThirdPerson );\n\tgEngfuncs.pfnAddCommand( \"firstperson\", CAM_ToFirstPerson );\n\tgEngfuncs.pfnAddCommand( \"+cammousemove\",CAM_StartMouseMove);\n\tgEngfuncs.pfnAddCommand( \"-cammousemove\",CAM_EndMouseMove);\n\tgEngfuncs.pfnAddCommand( \"+camdistance\", CAM_StartDistance );\n\tgEngfuncs.pfnAddCommand( \"-camdistance\", CAM_EndDistance );\n\tgEngfuncs.pfnAddCommand( \"snapto\", CAM_ToggleSnapto );\n\n\tcam_command\t\t\t\t= gEngfuncs.pfnRegisterVariable ( \"cam_command\", \"0\", 0 );\t // tells camera to go to thirdperson\n\tcam_snapto\t\t\t\t= gEngfuncs.pfnRegisterVariable ( \"cam_snapto\", \"0\", 0 );\t // snap to thirdperson view\n\tcam_idealyaw\t\t\t= gEngfuncs.pfnRegisterVariable ( \"cam_idealyaw\", \"90\", 0 );\t // thirdperson yaw\n\tcam_idealpitch\t\t\t= gEngfuncs.pfnRegisterVariable ( \"cam_idealpitch\", \"0\", 0 );\t // thirperson pitch\n\tcam_idealdist\t\t\t= gEngfuncs.pfnRegisterVariable ( \"cam_idealdist\", \"64\", 0 );\t // thirdperson distance\n\tcam_contain\t\t\t\t= gEngfuncs.pfnRegisterVariable ( \"cam_contain\", \"0\", 0 );\t// contain camera to world\n\n\tc_maxpitch\t\t\t\t= gEngfuncs.pfnRegisterVariable ( \"c_maxpitch\", \"90.0\", 0 );\n\tc_minpitch\t\t\t\t= gEngfuncs.pfnRegisterVariable ( \"c_minpitch\", \"0.0\", 0 );\n\tc_maxyaw\t\t\t\t= gEngfuncs.pfnRegisterVariable ( \"c_maxyaw\",   \"135.0\", 0 );\n\tc_minyaw\t\t\t\t= gEngfuncs.pfnRegisterVariable ( \"c_minyaw\",   \"-135.0\", 0 );\n\tc_maxdistance\t\t\t= gEngfuncs.pfnRegisterVariable ( \"c_maxdistance\",   \"200.0\", 0 );\n\tc_mindistance\t\t\t= gEngfuncs.pfnRegisterVariable ( \"c_mindistance\",   \"30.0\", 0 );\n}\n\nvoid CAM_ClearStates( void )\n{\n\tvec3_t viewangles;\n\n\tgEngfuncs.GetViewAngles( (float *)viewangles );\n\n\tcam_pitchup.state = 0;\n\tcam_pitchdown.state = 0;\n\tcam_yawleft.state = 0;\n\tcam_yawright.state = 0;\n\tcam_in.state = 0;\n\tcam_out.state = 0;\n\n\tcam_thirdperson = 0;\n\tcam_command->value = 0;\n\tcam_mousemove=0;\n\n\tcam_snapto->value = 0;\n\tcam_distancemove = 0;\n\n\tcam_ofs[ 0 ] = 0.0;\n\tcam_ofs[ 1 ] = 0.0;\n\tcam_ofs[ 2 ] = CAM_MIN_DIST;\n\n\tcam_idealpitch->value = viewangles[ PITCH ];\n\tcam_idealyaw->value = viewangles[ YAW ];\n\tcam_idealdist->value = CAM_MIN_DIST;\n}\n\nvoid CAM_StartMouseMove(void)\n{\n\tfloat flSensitivity;\n\t\t\n\t//only move the cam with mouse if we are in third person.\n\tif (cam_thirdperson)\n\t{\n\t\t//set appropriate flags and initialize the old mouse position\n\t\t//variables for mouse camera movement\n\t\tif (!cam_mousemove)\n\t\t{\n\t\t\tcam_mousemove=1;\n\t\t\tiMouseInUse=1;\n\t\t\tGetCursorPos (&cam_mouse);\n\n\t\t\tif ( ( flSensitivity = gHUD.GetSensitivity() ) != 0 )\n\t\t\t{\n\t\t\t\tcam_old_mouse_x=cam_mouse.x*flSensitivity;\n\t\t\t\tcam_old_mouse_y=cam_mouse.y*flSensitivity;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tcam_old_mouse_x=cam_mouse.x;\n\t\t\t\tcam_old_mouse_y=cam_mouse.y;\n\t\t\t}\n\t\t}\n\t}\n\t//we are not in 3rd person view..therefore do not allow camera movement\n\telse\n\t{   \n\t\tcam_mousemove=0;\n\t\tiMouseInUse=0;\n\t}\n}\n\n//the key has been released for camera movement\n//tell the engine that mouse camera movement is off\nvoid CAM_EndMouseMove(void)\n{\n   cam_mousemove=0;\n   iMouseInUse=0;\n}\n\n\n//----------------------------------------------------------\n//routines to start the process of moving the cam in or out \n//using the mouse\n//----------------------------------------------------------\nvoid CAM_StartDistance(void)\n{\n\t//only move the cam with mouse if we are in third person.\n\tif (cam_thirdperson)\n\t{\n\t  //set appropriate flags and initialize the old mouse position\n\t  //variables for mouse camera movement\n\t  if (!cam_distancemove)\n\t  {\n\t\t  cam_distancemove=1;\n\t\t  cam_mousemove=1;\n\t\t  iMouseInUse=1;\n\t\t  GetCursorPos (&cam_mouse);\n\t\t  cam_old_mouse_x=cam_mouse.x*gHUD.GetSensitivity();\n\t\t  cam_old_mouse_y=cam_mouse.y*gHUD.GetSensitivity();\n\t  }\n\t}\n\t//we are not in 3rd person view..therefore do not allow camera movement\n\telse\n\t{   \n\t\tcam_distancemove=0;\n\t\tcam_mousemove=0;\n\t\tiMouseInUse=0;\n\t}\n}\n\n//the key has been released for camera movement\n//tell the engine that mouse camera movement is off\nvoid CAM_EndDistance(void)\n{\n   cam_distancemove=0;\n   cam_mousemove=0;\n   iMouseInUse=0;\n}\n\nint DLLEXPORT CL_IsThirdPerson( void )\n{\n\treturn (cam_thirdperson ? 1 : 0) || (g_iUser1 && gEngfuncs.GetLocalPlayer() && (g_iUser2 == gEngfuncs.GetLocalPlayer()->index) );\n}\n\nvoid DLLEXPORT CL_CameraOffset( float *ofs )\n{\n\tVectorCopy( cam_ofs, ofs );\n}\n"
  },
  {
    "path": "cl_dll/include/camera.h",
    "content": "//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============\n//\n// Purpose: \n//\n// $NoKeywords: $\n//=============================================================================\n\n// Camera.h  --  defines and such for a 3rd person camera\n// NOTE: must include quakedef.h first\n#pragma once\n#ifndef _CAMERA_H_\n#define _CAMEA_H_\n\n// pitch, yaw, dist\nextern vec3_t cam_ofs;\n// Using third person camera\nextern int cam_thirdperson;\n\nvoid CAM_Init( void );\nvoid CAM_ClearStates( void );\nvoid CAM_StartMouseMove(void);\nvoid CAM_EndMouseMove(void);\n\n#endif\t\t// _CAMERA_H_\n"
  },
  {
    "path": "cl_dll/include/cl_dll.h",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\t\n*\tThis product contains software technology licensed from Id \n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc. \n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n//\n//  cl_dll.h\n//\n\n// 4-23-98  JOHN\n#pragma once\n#ifndef CL_DLL_H\n#define CL_DLL_H\n//\n//  This DLL is linked by the client when they first initialize.\n// This DLL is responsible for the following tasks:\n//\t\t- Loading the HUD graphics upon initialization\n//\t\t- Drawing the HUD graphics every frame\n//\t\t- Handling the custum HUD-update packets\n//\ntypedef unsigned char byte;\ntypedef unsigned short word;\ntypedef float vec_t;\ntypedef int (*pfnUserMsgHook)(const char *pszName, int iSize, void *pbuf);\n\n#define MIN_XASH_VERSION 3137\n\n#include <stdint.h>\n\n#include \"util_vector.h\"\n\n#include \"../engine/cdll_int.h\"\n#include \"../dlls/cdll_dll.h\"\n\n#include \"exportdef.h\"\n\n#include \"render_api.h\"\n#include \"mobility_int.h\"\n\nextern \"C\"\n{\nint        DLLEXPORT Initialize( cl_enginefunc_t *pEnginefuncs, int iVersion );\nint        DLLEXPORT HUD_VidInit( void );\nvoid       DLLEXPORT HUD_Init( void );\nint        DLLEXPORT HUD_Redraw( float flTime, int intermission );\nint        DLLEXPORT HUD_UpdateClientData( client_data_t *cdata, float flTime );\nvoid       DLLEXPORT HUD_Reset( void );\nvoid       DLLEXPORT HUD_PlayerMove( struct playermove_s *ppmove, int server );\nvoid       DLLEXPORT HUD_PlayerMoveInit( struct playermove_s *ppmove );\nchar       DLLEXPORT HUD_PlayerMoveTexture( char *name );\nint        DLLEXPORT HUD_ConnectionlessPacket( const struct netadr_s *net_from, const char *args, char *response_buffer, int *response_buffer_size );\nint        DLLEXPORT HUD_GetHullBounds( int hullnumber, float *mins, float *maxs );\nvoid       DLLEXPORT HUD_Frame( double time );\nvoid       DLLEXPORT HUD_VoiceStatus( int entindex, qboolean bTalking );\nvoid       DLLEXPORT HUD_DirectorMessage( int iSize, void *pbuf );\nint        DLLEXPORT HUD_GetRenderInterface( int version, render_api_t *renderfuncs, render_interface_t *callback );\nint        DLLEXPORT HUD_MobilityInterface( mobile_engfuncs_t *mobileapi );\nvoid       DLLEXPORT HUD_PostRunCmd( struct local_state_s *from, struct local_state_s *to, struct usercmd_s *cmd, int runfuncs, double time, unsigned int random_seed );\nint        DLLEXPORT HUD_AddEntity( int type, struct cl_entity_s *ent, const char *modelname );\nvoid       DLLEXPORT HUD_CreateEntities( void );\nvoid       DLLEXPORT HUD_StudioEvent(const struct mstudioevent_s *event, cl_entity_s *entity );\nvoid       DLLEXPORT HUD_TxferLocalOverrides( struct entity_state_s *state, const struct clientdata_s *client );\nvoid       DLLEXPORT HUD_ProcessPlayerState( struct entity_state_s *dst, const struct entity_state_s *src );\nvoid       DLLEXPORT HUD_TxferPredictionData( struct entity_state_s *ps, const struct entity_state_s *pps, struct clientdata_s *pcd, const struct clientdata_s *ppcd, struct weapon_data_s *wd, const struct weapon_data_s *pwd );\nvoid       DLLEXPORT HUD_TempEntUpdate( double frametime, double client_time, double cl_gravity, struct tempent_s **ppTempEntFree, struct tempent_s **ppTempEntActive, int ( *Callback_AddVisibleEntity )( struct cl_entity_s *pEntity ), void ( *Callback_TempEntPlaySound )( struct tempent_s *pTemp, float damp ) );\nvoid       DLLEXPORT HUD_Shutdown( void );\nint        DLLEXPORT HUD_Key_Event( int eventcode, int keynum, const char *pszCurrentBinding );\nint        DLLEXPORT HUD_GetStudioModelInterface( int version, struct r_studio_interface_s **ppinterface, struct engine_studio_api_s *pstudio );\nvoid       DLLEXPORT HUD_DrawNormalTriangles( void );\nvoid       DLLEXPORT HUD_DrawTransparentTriangles( void );\nvoid       DLLEXPORT CAM_Think( void );\nint        DLLEXPORT CL_IsThirdPerson( void );\nvoid       DLLEXPORT CL_CameraOffset( float *ofs );\nvoid       DLLEXPORT CL_CreateMove( float frametime, struct usercmd_s *cmd, int active );\nvoid       DLLEXPORT IN_ActivateMouse( void );\nvoid       DLLEXPORT IN_DeactivateMouse( void );\nvoid       DLLEXPORT IN_MouseEvent( int mstate );\nvoid       DLLEXPORT IN_Accumulate( void );\nvoid       DLLEXPORT IN_ClearStates( void );\nvoid       DLLEXPORT V_CalcRefdef( struct ref_params_s *pparams );\nvoid       DLLEXPORT Demo_ReadBuffer( int size, unsigned char *buffer );\nstruct cl_entity_s DLLEXPORT *HUD_GetUserEntity( int index );\nstruct kbutton_s   DLLEXPORT *KB_Find( const char *name );\n\nvoid       DLLEXPORT IN_ClientMoveEvent( float forwardmove, float sidemove );\nvoid       DLLEXPORT IN_ClientLookEvent( float relyaw, float relpitch );\n}\n\n\nextern cl_enginefunc_t gEngfuncs;\nextern render_api_t gRenderAPI;\nextern mobile_engfuncs_t gMobileAPI;\nextern int g_iXash; // indicates buildnum\nextern int g_iMobileAPIVersion; // indicates version. 0 if no mobile API\n#endif // CL_DLL_H\n"
  },
  {
    "path": "cl_dll/include/com_weapons.h",
    "content": "//========= Copyright пїЅ 1996-2002, Valve LLC, All rights reserved. ============\n//\n// Purpose: \n//\n// $NoKeywords: $\n//=============================================================================\n#pragma once\n// com_weapons.h\n// Shared weapons common function prototypes\n#if !defined( COM_WEAPONSH )\n#define COM_WEAPONSH\n\n\n#include \"hud_iface.h\"\n#include \"weapontype.h\"\n#define PLAYER_CAN_SHOOT (1 << 0)\n#define PLAYER_FREEZE_TIME_OVER ( 1 << 1 )\n#define PLAYER_IN_BOMB_ZONE (1 << 2)\n#define PLAYER_HOLDING_SHIELD (1 << 3)\n\n#define CROSSHAIR_\n#define ACCURACY_AIR (1 << 0) // accuracy depends on FL_ONGROUND\n#define ACCURACY_SPEED (1 << 1)\n#define ACCURACY_DUCK (1 << 2) // more accurate when ducking\n#define ACCURACY_MULTIPLY_BY_14 (1 << 3) // accuracy multiply to 1.4\n#define ACCURACY_MULTIPLY_BY_14_2 (1 << 4) // accuracy multiply to 1.4\n\nextern \"C\"\n{\n\tvoid _DLLEXPORT HUD_PostRunCmd( struct local_state_s *from, struct local_state_s *to, struct usercmd_s *cmd, int runfuncs, double time, unsigned int random_seed );\n}\n\nbool\t\t\tCL_IsDead();\n\nfloat\t\t\tUTIL_SharedRandomFloat( unsigned int seed, float low, float high );\nint\t\t\t\tUTIL_SharedRandomLong( unsigned int seed, int low, int high );\n\nint\t\t\t\tHUD_GetWeaponAnim( void );\nvoid\t\t\tHUD_SendWeaponAnim(int iAnim, int iWeaponId, int iBody, int iForce = 0 );\nint\t\t\t\tHUD_GetWeapon( void );\nvoid\t\t\tHUD_PlaySound( char *sound, float volume );\nvoid\t\t\tHUD_PlaybackEvent( int flags, const struct edict_s *pInvoker, unsigned short eventindex, float delay, float *origin, float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2 );\n//void\t\t\tHUD_SetMaxSpeed( const struct edict_s *ed, float speed );\nint\t\t\t\tGetWeaponAccuracyFlags( int weaponid );\n\nextern cvar_t *cl_lw;\n\nextern int g_runfuncs;\nextern vec3_t v_angles;\nextern float g_lastFOV;\nextern int g_iWeaponFlags;\nextern bool g_bInBombZone;\nextern int g_iFreezeTimeOver;\nextern bool g_bHoldingShield;\nextern bool g_bHoldingKnife;\nextern int g_iPlayerFlags;\nextern float g_flPlayerSpeed;\nextern Vector g_vPlayerVelocity;\nextern struct local_state_s *g_curstate;\nextern struct local_state_s *g_finalstate;\nextern int g_iShotsFired;\n\n#endif\n"
  },
  {
    "path": "cl_dll/include/csprite.h",
    "content": "\n/*\n*\n*    This program is free software; you can redistribute it and/or modify it\n*    under the terms of the GNU General Public License as published by the\n*    Free Software Foundation; either version 2 of the License, or (at\n*    your option) any later version.\n*\n*    This program is distributed in the hope that it will be useful, but\n*    WITHOUT ANY WARRANTY; without even the implied warranty of\n*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n*    General Public License for more details.\n*\n*    You should have received a copy of the GNU General Public License\n*    along with this program; if not, write to the Free Software Foundation,\n*    Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\n*\n*    In addition, as a special exception, the author gives permission to\n*    link the code of this program with the Half-Life Game Engine (\"HL\n*    Engine\") and Modified Game Libraries (\"MODs\") developed by Valve,\n*    L.L.C (\"Valve\").  You must obey the GNU General Public License in all\n*    respects for all of the code used other than the HL Engine and MODs\n*    from Valve.  If you modify this file, you may extend this exception\n*    to your version of the file, but you are not obligated to do so.  If\n*    you do not wish to do so, delete this exception statement from your\n*    version.\n*\n*/\n\n#pragma once\n#ifndef CSPRITE_H\n#define CSPRITE_H\n\n// defined in util.cpp\nHSPRITE HUD_GetSprite( int index );\nwrect_t HUD_GetSpriteRect( int index );\nint HUD_GetSpriteIndexByName( const char *sz );\n\nclass CClientSprite {\npublic:\n\tinline CClientSprite(const char *sprName)\n\t{\n\t\tSetSpriteByName(sprName);\n\t}\n\tinline CClientSprite()\n\t{\n\t\tspr = 0;\n\t\tindex = 0;\n\t\trect.bottom = rect.left = rect.right = rect.top = 0;\n\t}\n\n\tinline void SetSpriteByName( const char *sprName )\n\t{\n\t\tindex = HUD_GetSpriteIndexByName(sprName);\n\t\tspr\t= HUD_GetSprite(index);\n\t\trect = HUD_GetSpriteRect(index);\n\t}\n\n\tint index;\n\tHSPRITE spr;\n\twrect_t rect;\n};\n\n#endif \n"
  },
  {
    "path": "cl_dll/include/demo.h",
    "content": "//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============\n//\n// Purpose: \n//\n// $NoKeywords: $\n//=============================================================================\n#pragma once\n#if !defined( DEMOH )\n#define DEMOH\n\n// Types of demo messages we can write/parse\nenum\n{\n\tTYPE_SNIPERDOT = 0,\n\tTYPE_ZOOM\n};\n\nvoid Demo_WriteBuffer( int type, int size, unsigned char *buffer );\n\nextern int g_demosniper;\nextern int g_demosniperdamage;\nextern float g_demosniperorg[3];\nextern float g_demosniperangles[3];\nextern float g_demozoom;\n\n#endif"
  },
  {
    "path": "cl_dll/include/draw_util.h",
    "content": "/*\n*\n*    This program is free software; you can redistribute it and/or modify it\n*    under the terms of the GNU General Public License as published by the\n*    Free Software Foundation; either version 2 of the License, or (at\n*    your option) any later version.\n*\n*    This program is distributed in the hope that it will be useful, but\n*    WITHOUT ANY WARRANTY; without even the implied warranty of\n*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n*    General Public License for more details.\n*\n*    You should have received a copy of the GNU General Public License\n*    along with this program; if not, write to the Free Software Foundation,\n*    Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\n*\n*    In addition, as a special exception, the author gives permission to\n*    link the code of this program with the Half-Life Game Engine (\"HL\n*    Engine\") and Modified Game Libraries (\"MODs\") developed by Valve,\n*    L.L.C (\"Valve\").  You must obey the GNU General Public License in all\n*    respects for all of the code used other than the HL Engine and MODs\n*    from Valve.  If you modify this file, you may extend this exception\n*    to your version of the file, but you are not obligated to do so.  If\n*    you do not wish to do so, delete this exception statement from your\n*    version.\n*\n*/\n#pragma once\n#ifndef DRAW_UTIL_H\n#define DRAW_UTIL_H\n// Drawing primitives\n\n#define DHN_DRAWZERO 1\n#define DHN_2DIGITS  2\n#define DHN_3DIGITS  4\n\nextern int g_codepage;\nextern qboolean g_accept_utf8;\n\nextern cvar_t *con_charset;\nextern cvar_t *cl_charset;\n\n\nint Con_UtfProcessChar( int in );\nint Con_UtfProcessCharForce( int in );\n\nclass DrawUtils\n{\npublic:\n\tstatic int DrawHudNumber(int x, int y, int iFlags, int iNumber,\n\t\t\t\t\t\t int r, int g, int b );\n\n\tstatic int DrawHudNumber2( int x, int y, bool DrawZero, int iDigits, int iNumber,\n\t\t\t\t\t\t   int r, int g, int b);\n\n\tstatic int DrawHudNumber2( int x, int y, int iNumber,\n\t\t\t\t\t\t   int r, int g, int b);\n\n\tstatic int DrawHudString(int x, int y, int iMaxX, const char *szString,\n\t\t\t\t\t\t int r, int g, int b, float scale = 0.0f );\n\n\tstatic int DrawHudStringReverse( int xpos, int ypos, int iMinX, const char *szString,\n\t\t\t\t\t\t\t\t int r, int g, int b, float scale = 0.0f );\n\n\tstatic inline int DrawHudNumberString( int xpos, int ypos, int iMinX, int iNumber,\n\t\t\t\t\t\t\t\tint r, int g, int b, float scale = 0.0f )\n\t{\n\t\tchar szString[16];\n\t\tsnprintf( szString, sizeof(szString), \"%d\", iNumber );\n\t\treturn DrawHudStringReverse( xpos, ypos, iMinX, szString, r, g, b, scale );\n\t}\n\n\tstatic int HudStringLen( const char *szIt, float scale = 1 );\n\n\t// legacy shit came with Valve\n\tstatic inline int GetNumWidth(int iNumber, int iFlags)\n\t{\n\t\tif ( iFlags & ( DHN_3DIGITS ) )\n\t\t\treturn 3;\n\n\t\tif ( iFlags & ( DHN_2DIGITS ) )\n\t\t\treturn 2;\n\n\t\tif ( iNumber <= 0 )\n\t\t\treturn iFlags & DHN_DRAWZERO ? 1 : 0;\n\n\t\tif ( iNumber < 10 )\n\t\t\treturn 1;\n\n\t\tif ( iNumber < 100 )\n\t\t\treturn 2;\n\n\t\treturn 3;\n\t}\n\n\tstatic inline int DrawConsoleString(int x, int y, const char *string)\n\t{\n\t\tif ( gHUD.hud_textmode->value )\n\t\t{\n\t\t\tint ret  = DrawHudString( x, y, 9999, (char *)string, color[0] * 255, color[1] * 255, color[2] * 255 );\n\t\t\tcolor[0] = color[1] = color[2] = 1.0f;\n\t\t\treturn ret;\n\t\t}\n\t\telse\n\t\t\treturn gEngfuncs.pfnDrawConsoleString( x, y, (char *)string );\n\t}\n\n\tstatic inline void SetConsoleTextColor( float r, float g, float b )\n\t{\n\t\tif ( gHUD.hud_textmode->value )\n\t\t\tcolor[0] = r, color[1] = g, color[2] = b;\n\t\telse\n\t\t\tgEngfuncs.pfnDrawSetTextColor( r, g, b );\n\t}\n\n\tstatic inline void SetConsoleTextColor( unsigned char r, unsigned char g, unsigned char b )\n\t{\n\t\tif ( gHUD.hud_textmode->value )\n\t\t\tcolor[0] = r / 255.0f, color[1] = g / 255.0f, color[2] = b / 255.0f;\n\t\telse\n\t\t\tgEngfuncs.pfnDrawSetTextColor( r / 255.0f, g / 255.0f, b / 255.0f );\n\t}\n\n\tstatic inline int ConsoleStringLen(  const char *szIt )\n\t{\n\t\tif ( gHUD.hud_textmode->value )\n\t\t{\n\t\t\treturn HudStringLen( (char *)szIt );\n\t\t}\n\t\telse\n\t\t{\n\t\t\tint _width;\n\t\t\tint _height;\n\n\t\t\tgEngfuncs.pfnDrawConsoleStringLen( szIt, &_width, &_height );\n\t\t\treturn _width;\n\t\t}\n\t}\n\n\tstatic inline void ConsoleStringSize( const char *szIt, int *width, int *height )\n\t{\n\t\tif ( gHUD.hud_textmode->value )\n\t\t\t*height = 13, *width = HudStringLen( (char *)szIt );\n\t\telse\n\t\t\tgEngfuncs.pfnDrawConsoleStringLen( szIt, width, height );\n\t}\n\n\tstatic inline int TextMessageDrawChar( int x, int y, int number, int r, int g, int b, float scale = 0.0f )\n\t{\n\t\tint ret;\n\t\tif( scale && g_iMobileAPIVersion )\n\t\t\tret = gMobileAPI.pfnDrawScaledCharacter( x, y, number, r, g, b, scale ) / gHUD.m_flScale;\n\t\telse\n\t\t\tret = gEngfuncs.pfnDrawCharacter( x, y, number, r, g, b );\n\t\treturn ret;\n\t}\n\n\tstatic inline void UnpackRGB( int &r, int &g, int &b, const unsigned long ulRGB )\n\t{\n\t\tr = (ulRGB & 0xFF0000) >>16;\n\t\tg = (ulRGB & 0xFF00) >> 8;\n\t\tb = ulRGB & 0xFF;\n\t}\n\n\tstatic inline void ScaleColors( int &r, int &g, int &b, const int a )\n\t{\n\t\tr *= a / 255.0f;\n\t\tg *= a / 255.0f;\n\t\tb *= a / 255.0f;\n\t}\n\n\tstatic inline void DrawRectangle( int x, int y, int wide, int tall,\n\t\t\t\t\t\t   int r = 0, int g = 0, int b = 0, int a = 153,\n\t\t\t\t\t\t   bool drawStroke = true )\n\t{\n\t\tFillRGBABlend( x, y, wide, tall, r, g, b, a );\n\t\tif ( drawStroke )\n\t\t{\n\t\t\t// TODO: remove this hardcoded hardcore\n\t\t\tFillRGBA( x + 1,        y,            wide - 1, 1,        255, 140, 0, 255 );\n\t\t\tFillRGBA( x,            y,            1,        tall - 1, 255, 140, 0, 255 );\n\t\t\tFillRGBA( x + wide - 1, y + 1,        1,        tall - 1, 255, 140, 0, 255 );\n\t\t\tFillRGBA( x,            y + tall - 1, wide - 1, 1,        255, 140, 0, 255 );\n\t\t}\n\t}\n\n\tstatic void Draw2DQuad( float x1, float y1, float x2, float y2 );\n\tstatic void DrawStretchPic( float x, float y, float w, float h,\n\t\t\t\t\t\t\t\tfloat s1 = 0, float t1 = 0, float s2 = 1, float t2 = 1);\n\n\nprivate:\n\t// console string color\n\tstatic float color[3];\n};\n\n#endif // DRAW_UTIL_H\n"
  },
  {
    "path": "cl_dll/include/ev_hldm.h",
    "content": "//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============\n//\n// Purpose: \n//\n// $NoKeywords: $\n//=============================================================================\n#pragma once\n#if !defined ( EV_HLDMH )\n#define EV_HLDMH\n\nenum ESmoke\n{\n\tSMOKE_WALLPUFF = 0,\n\tSMOKE_RIFLE,\n\tSMOKE_PISTOL,\n\tSMOKE_BLACK\n};\n\nvoid EV_HLDM_GunshotDecalTrace(pmtrace_t *pTrace, char *decalName , char chTextureType);\nvoid EV_HLDM_DecalGunshot(pmtrace_t *pTrace, int iBulletType, float scale, int r, int g, int b, bool bCreateSparks, char cTextureType, bool isSky);\nvoid EV_HLDM_FireBullets(int idx,\n\t\t\t\t\t\t float *forward, float *right, float *up,\n\t\t\t\t\t\t int cShots,\n\t\t\t\t\t\t float *vecSrc, float *vecDirShooting, float *vecSpread,\n\t\t\t\t\t\t float flDistance, int iBulletType, int iPenetration);\nvoid EV_CS16Client_KillEveryRound( struct tempent_s *te, float frametime, float currenttime );\nstruct tempent_s *EV_CS16Client_CreateSmoke( ESmoke type, Vector origin, Vector dir, int speed, float scale, int r, int g, int b , bool wind, Vector velocity = Vector(0, 0, 0), int framerate = 35, int teflags = FTENT_COLLIDEALL );\n#endif // EV_HLDMH\n"
  },
  {
    "path": "cl_dll/include/events.h",
    "content": "/*\n*\n*    This program is free software; you can redistribute it and/or modify it\n*    under the terms of the GNU General Public License as published by the\n*    Free Software Foundation; either version 2 of the License, or (at\n*    your option) any later version.\n*\n*    This program is distributed in the hope that it will be useful, but\n*    WITHOUT ANY WARRANTY; without even the implied warranty of\n*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n*    General Public License for more details.\n*\n*    You should have received a copy of the GNU General Public License\n*    along with this program; if not, write to the Free Software Foundation,\n*    Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\n*\n*    In addition, as a special exception, the author gives permission to\n*    link the code of this program with the Half-Life Game Engine (\"HL\n*    Engine\") and Modified Game Libraries (\"MODs\") developed by Valve,\n*    L.L.C (\"Valve\").  You must obey the GNU General Public License in all\n*    respects for all of the code used other than the HL Engine and MODs\n*    from Valve.  If you modify this file, you may extend this exception\n*    to your version of the file, but you are not obligated to do so.  If\n*    you do not wish to do so, delete this exception statement from your\n*    version.\n*\n*/\n#pragma once\n#ifndef EVENTS_H\n#define EVENTS_H\n\n#include \"hud.h\"\n#include \"cl_util.h\"\n#include \"const.h\"\n#include \"entity_state.h\"\n#include \"cl_entity.h\"\n\n#include \"r_efx.h\"\n\n#include \"eventscripts.h\"\n#include \"event_api.h\"\n#include \"pm_defs.h\"\n#include \"ev_hldm.h\"\n#include \"com_weapons.h\"\n\n#ifndef PITCH\n// MOVEMENT INFO\n// up / down\n#define\tPITCH\t0\n// left / right\n#define\tYAW\t\t1\n// fall over\n#define\tROLL\t2\n#endif\n\n#define DECLARE_EVENT( x ) void EV_##x( struct event_args_s *args )\n#define HOOK_EVENT( x, y ) gEngfuncs.pfnHookEvent( \"events/\" #x \".sc\", EV_##y )\n\n#define PLAY_EVENT_SOUND( x ) gEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_WEAPON, (x), VOL_NORM, ATTN_NORM, 0, 94 + gEngfuncs.pfnRandomLong( 0, 15 ) )\n\n\n// enable it until fix isn't applied in Xash3D\n//#define _CS16CLIENT_FIX_EVENT_ORIGIN\n\nextern int g_iPShell;\nextern int g_iRShell;\nextern int g_iShotgunShell;\n\nextern \"C\"\n{\nDECLARE_EVENT(FireAK47);\nDECLARE_EVENT(FireAUG);\nDECLARE_EVENT(FireAWP);\nDECLARE_EVENT(CreateExplo);\nDECLARE_EVENT(CreateSmoke);\nDECLARE_EVENT(FireDEAGLE);\nDECLARE_EVENT(DecalReset);\nDECLARE_EVENT(FireEliteLeft);\nDECLARE_EVENT(FireEliteRight);\nDECLARE_EVENT(FireFAMAS);\nDECLARE_EVENT(Fire57);\nDECLARE_EVENT(FireG3SG1);\nDECLARE_EVENT(FireGALIL);\nDECLARE_EVENT(Fireglock18);\nDECLARE_EVENT(Knife);\nDECLARE_EVENT(FireM249);\nDECLARE_EVENT(FireM3);\nDECLARE_EVENT(FireM4A1);\nDECLARE_EVENT(FireMAC10);\nDECLARE_EVENT(FireMP5);\nDECLARE_EVENT(FireP228);\nDECLARE_EVENT(FireP90);\nDECLARE_EVENT(FireScout);\nDECLARE_EVENT(FireSG550);\nDECLARE_EVENT(FireSG552);\nDECLARE_EVENT(FireTMP);\nDECLARE_EVENT(FireUMP45);\nDECLARE_EVENT(FireUSP);\nDECLARE_EVENT(Vehicle);\nDECLARE_EVENT(FireXM1014);\nDECLARE_EVENT(TrainPitchAdjust);\n\n// CZERODS START\nDECLARE_EVENT( FireM60 );\nDECLARE_EVENT( FireCamera );\nDECLARE_EVENT( FireFiberOpticCamera );\nDECLARE_EVENT( FireShieldGun );\nDECLARE_EVENT( HolsterBlowtorch );\nDECLARE_EVENT( IdleBlowtorch );\nDECLARE_EVENT( FireBlowtorch );\nDECLARE_EVENT( FireLaws );\nDECLARE_EVENT( FireBriefcase );\nDECLARE_EVENT( FireMedkit );\nDECLARE_EVENT( FireSyringe );\nDECLARE_EVENT( FireRadio );\nDECLARE_EVENT( FireZipline );\nDECLARE_EVENT( CreateGlass );\nDECLARE_EVENT( GrenadeExplosion );\n// CZERODS END\n}\n\nvoid Game_HookEvents( void );\n\n#endif\n"
  },
  {
    "path": "cl_dll/include/eventscripts.h",
    "content": "//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============\n//\n// Purpose: \n//\n// $NoKeywords: $\n//=============================================================================\n#pragma once\n// eventscripts.h\n#if !defined ( EVENTSCRIPTSH )\n#define EVENTSCRIPTSH\n\n#include \"pmtrace.h\"\n#include \"pm_shared.h\"\n#include \"event_api.h\"\n#include \"r_efx.h\"\n\n// defaults for clientinfo messages\n#define\tDEFAULT_VIEWHEIGHT\t17\n#define VEC_DUCK_VIEW 12\n\n#define FTENT_FADEOUT\t\t\t0x00000080\n\n#define DMG_GENERIC\t\t\t0\t\t\t// generic damage was done\n#define DMG_CRUSH\t\t\t(1 << 0)\t// crushed by falling or moving object\n#define DMG_BULLET\t\t\t(1 << 1)\t// shot\n#define DMG_SLASH\t\t\t(1 << 2)\t// cut, clawed, stabbed\n#define DMG_BURN\t\t\t(1 << 3)\t// heat burned\n#define DMG_FREEZE\t\t\t(1 << 4)\t// frozen\n#define DMG_FALL\t\t\t(1 << 5)\t// fell too far\n#define DMG_BLAST\t\t\t(1 << 6)\t// explosive blast damage\n#define DMG_CLUB\t\t\t(1 << 7)\t// crowbar, punch, headbutt\n#define DMG_SHOCK\t\t\t(1 << 8)\t// electric shock\n#define DMG_SONIC\t\t\t(1 << 9)\t// sound pulse shockwave\n#define DMG_ENERGYBEAM\t\t(1 << 10)\t// laser or other high energy beam \n#define DMG_NEVERGIB\t\t(1 << 12)\t// with this bit OR'd in, no damage type will be able to gib victims upon death\n#define DMG_ALWAYSGIB\t\t(1 << 13)\t// with this bit OR'd in, any damage type can be made to gib victims upon death.\n\n// time-based damage\n//mask off TF-specific stuff too\n#define DMG_TIMEBASED\t\t(~(0xff003fff))\t// mask for time-based damage\n\n#define DMG_DROWN\t\t\t(1 << 14)\t// Drowning\n#define DMG_FIRSTTIMEBASED  DMG_DROWN\n\n#define DMG_PARALYZE\t\t(1 << 15)\t// slows affected creature down\n#define DMG_NERVEGAS\t\t(1 << 16)\t// nerve toxins, very bad\n#define DMG_POISON\t\t\t(1 << 17)\t// blood poisioning\n#define DMG_RADIATION\t\t(1 << 18)\t// radiation exposure\n#define DMG_DROWNRECOVER\t(1 << 19)\t// drowning recovery\n#define DMG_ACID\t\t\t(1 << 20)\t// toxic chemicals or acid burns\n#define DMG_SLOWBURN\t\t(1 << 21)\t// in an oven\n#define DMG_SLOWFREEZE\t\t(1 << 22)\t// in a subzero freezer\n#define DMG_MORTAR\t\t\t(1 << 23)\t// Hit by air raid (done to distinguish grenade from mortar)\n\n//TF ADDITIONS\n#define DMG_IGNITE\t\t\t(1 << 24)\t// Players hit by this begin to burn\n#define DMG_RADIUS_MAX\t\t(1 << 25)\t// Radius damage with this flag doesn't decrease over distance\n#define DMG_RADIUS_QUAKE\t(1 << 26)\t// Radius damage is done like Quake. 1/2 damage at 1/2 radius.\n#define DMG_IGNOREARMOR\t\t(1 << 27)\t// Damage ignores target's armor\n#define DMG_AIMED\t\t\t(1 << 28)   // Does Hit location damage\n#define DMG_WALLPIERCING\t(1 << 29)\t// Blast Damages ents through walls\n\n#define DMG_CALTROP\t\t\t\t(1<<30)\n#define DMG_HALLUC\t\t\t\t(1<<31)\n\n#define IS_FIRSTPERSON_SPEC ( g_iUser1 == OBS_IN_EYE || (g_iUser1 && (gHUD.m_Spectator.m_pip->value == INSET_IN_EYE)) )\n\n// Some of these are HL/TFC specific?\nvoid EV_GetGunPosition( struct event_args_s *args, Vector &pos, const Vector &origin );\nvoid EV_GetDefaultShellInfo( struct event_args_s *args, float *origin, float *velocity, float *ShellVelocity, float *ShellOrigin, float *forward, float *right, float *up, float forwardScale, float upScale, float rightScale, bool bReverseDirection = false );\nvoid CreateCorpse(Vector vOrigin, Vector vAngles, const char *pModel, float flAnimTime, int iSequence, int iBody);\n\n\n// Very simple and little functions that can be inlined\n\n/*\n=================\nEV_MuzzleFlash\n\nFlag weapon/view model for muzzle flash\n=================\n*/\ninline void EV_MuzzleFlash( void )\n{\n\t// Add muzzle flash to current weapon model\n\tcl_entity_t *ent = gEngfuncs.GetViewModel();\n\tif ( !ent )\n\t\treturn;\n\n\t// Or in the muzzle flash\n\tent->curstate.effects |= EF_MUZZLEFLASH;\n}\n\n/*\n=================\nEV_IsPlayer\n\nIs the entity's index in the player range?\n=================\n*/\ninline bool EV_IsPlayer( int idx )\n{\n\tif ( idx >= 1 && idx <= gEngfuncs.GetMaxClients() )\n\t\treturn true;\n\n\treturn false;\n}\n\n\n/*\n=================\nEV_IsLocal\n\nIs the entity == the local player\n=================\n*/\ninline bool EV_IsLocal( int idx )\n{\n\t// check if we are in some way in first person spec mode\n\tif ( IS_FIRSTPERSON_SPEC  )\n\t\treturn (g_iUser2 == idx);\n\telse\n\t\treturn gEngfuncs.pEventAPI->EV_IsLocal( idx - 1 ) ? true : false;\n}\n\n/*\n=================\nEV_EjectBrass\n\nBullet shell casings\n=================\n*/\ninline void EV_EjectBrass( float *origin, float *velocity, float rotation, int model, int soundtype, float life = 2.5f )\n{\n\tVector angles(0.0f, 0.0f, rotation);\n\tgEngfuncs.pEfxAPI->R_TempModel( origin, velocity, angles, life, model, soundtype );\n}\n\n\n#endif // EVENTSCRIPTS_H\n"
  },
  {
    "path": "cl_dll/include/hud/ammo.h",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\t\n*\tThis product contains software technology licensed from Id \n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc. \n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n#pragma once\n#ifndef __AMMO_H__\n#define __AMMO_H__\n\n#define MAX_WEAPON_NAME 128\n\n\n#define WEAPON_FLAGS_SELECTONEMPTY\t1\n\n#define WEAPON_IS_ONTARGET 0x40\n\nstruct WEAPON\n{\n\tchar\tszName[MAX_WEAPON_NAME];\n\tint\t\tiAmmoType;\n\tint\t\tiAmmo2Type;\n\tint\t\tiMax1;\n\tint\t\tiMax2;\n\tint\t\tiSlot;\n\tint\t\tiSlotPos;\n\tint\t\tiFlags;\n\tint\t\tiId;\n\tint\t\tiClip;\n\n\tint\t\tiCount;\t\t// # of itesm in plist\n\n\tHSPRITE hActive;\n\twrect_t rcActive;\n\tHSPRITE hInactive;\n\twrect_t rcInactive;\n\tHSPRITE\thAmmo;\n\twrect_t rcAmmo;\n\tHSPRITE hAmmo2;\n\twrect_t rcAmmo2;\n\tHSPRITE hCrosshair;\n\twrect_t rcCrosshair;\n\tHSPRITE hAutoaim;\n\twrect_t rcAutoaim;\n\tHSPRITE hZoomedCrosshair;\n\twrect_t rcZoomedCrosshair;\n\tHSPRITE hZoomedAutoaim;\n\twrect_t rcZoomedAutoaim;\n};\n\ntypedef int AMMO;\n\n\n#endif"
  },
  {
    "path": "cl_dll/include/hud/hud_iface.h",
    "content": "//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============\n//\n// Purpose: \n//\n// $NoKeywords: $\n//=============================================================================\n#pragma once\n#if !defined( HUD_IFACEH )\n#define HUD_IFACEH\n\n#include \"exportdef.h\"\n\ntypedef int (*pfnUserMsgHook)(const char *pszName, int iSize, void *pbuf);\n#include \"wrect.h\"\n#include \"../engine/cdll_int.h\"\nextern cl_enginefunc_t gEngfuncs;\n\n#endif\n"
  },
  {
    "path": "cl_dll/include/hud/radar.h",
    "content": "/*\nradar.h\nCopyright (C) 2015 a1batross\n*/\n#pragma once\n#ifndef RADAR_H\n#define RADAR_H\n\nclass CClientSprite;\n\nclass CHudRadar: public CHudBase\n{\npublic:\n\tvirtual int Init();\n\tvirtual int VidInit();\n\tvirtual int Draw( float flTime );\n\tvirtual void InitHUDData();\n\tvirtual void Reset();\n\tvirtual void Shutdown();\n\n\tint MsgFunc_Radar(const char *pszName,  int iSize, void *pbuf);\n\n\tvoid UserCmd_ShowRadar();\n\tvoid UserCmd_HideRadar();\n\tCClientSprite m_hRadar;\n\tCClientSprite m_hRadarOpaque;\n\n\tint MsgFunc_BombDrop(const char *pszName, int iSize, void *pbuf);\n\tint MsgFunc_BombPickup(const char *pszName, int iSize, void *pbuf);\n\tint MsgFunc_HostagePos(const char *pszName, int iSize, void *pbuf);\n\tint MsgFunc_HostageK(const char *pszName, int iSize, void *pbuf);\n\tint MsgFunc_Location(const char *pszName, int iSize, void *pbuf);\nprivate:\n\n\tcvar_t *cl_radartype;\n\n\tint InitBuiltinTextures();\n\tvoid DrawPlayerLocation(int y);\n\tvoid DrawRadarDot(int x, int y, int r, int g, int b, int a);\n\tvoid DrawCross(int x, int y, int r, int g, int b, int a );\n\n\t// Call DrawT, DrawFlippedT or DrawRadarDot considering z value\n\tinline void DrawZAxis( Vector pos, int r, int g, int b, int a );\n\n\tvoid DrawT( int x, int y, int r, int g, int b, int a );\n\tvoid DrawFlippedT( int x, int y, int r, int g, int b, int a );\n\tbool HostageFlashTime( float flTime, struct hostage_info_t *pplayer );\n\tbool FlashTime( float flTime, struct extra_player_info_t *pplayer );\n\tVector WorldToRadar(const Vector vPlayerOrigin, const Vector vObjectOrigin, const Vector vAngles );\n\tinline void DrawColoredTexture( int x, int y, int size, byte r, byte g, byte b, byte a, int texHandle );\n\n\tbool bUseRenderAPI, bTexturesInitialized;\n\tint hCross, hT, hFlippedT;\n\tint iMaxRadius;\n};\n\n#endif // RADAR_H\n"
  },
  {
    "path": "cl_dll/include/in_defs.h",
    "content": "//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============\n//\n// Purpose: \n//\n// $NoKeywords: $\n//=============================================================================\n#pragma once\n#if !defined( IN_DEFSH )\n#define IN_DEFSH\n\n// up / down\n#define\tPITCH\t0\n// left / right\n#define\tYAW\t\t1\n// fall over\n#define\tROLL\t2 \n\n#ifdef _WIN32\n#define HSPRITE WINAPI_HSPRITE\n#include <windows.h>\n#undef HSPRITE\n#else\n#ifndef PORT_H\ntypedef struct point_s{\n\tint x;\n\tint y;\n} POINT;\n#endif\n#define GetCursorPos(x)\n#define SetCursorPos(x,y)\n#endif\n\n#endif\n"
  },
  {
    "path": "cl_dll/include/input.h",
    "content": "#pragma once\n#ifndef INPUT_H\n#define INPUT_H\n\nextern kbutton_t\tin_strafe;\nextern kbutton_t\tin_mlook;\nextern kbutton_t\tin_speed;\nextern kbutton_t\tin_jlook;\nextern kbutton_t\tin_forward;\nextern kbutton_t\tin_back;\nextern kbutton_t\tin_moveleft;\nextern kbutton_t\tin_moveright;\n\nextern cvar_t\t*m_pitch;\nextern cvar_t\t*m_yaw;\nextern cvar_t\t*m_forward;\nextern cvar_t\t*m_side;\n\nextern cvar_t *lookstrafe;\nextern cvar_t *lookspring;\nextern cvar_t *cl_pitchdown;\nextern cvar_t *cl_pitchup;\nextern cvar_t *cl_yawspeed;\nextern cvar_t *cl_sidespeed;\nextern cvar_t *cl_forwardspeed;\nextern cvar_t *cl_pitchspeed;\nextern cvar_t *cl_movespeedkey;\n\n#endif // INPUT_H\n"
  },
  {
    "path": "cl_dll/include/kbutton.h",
    "content": "//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============\n//\n// Purpose: \n//\n// $NoKeywords: $\n//=============================================================================\n#pragma once\n#if !defined( KBUTTONH )\n#define KBUTTONH\n\ntypedef struct kbutton_s\n{\n\tint\t\tdown[2];\t\t// key nums holding it down\n\tint\t\tstate;\t\t\t// low bit is down state\n} kbutton_t;\n\n#endif // !KBUTTONH"
  },
  {
    "path": "cl_dll/include/math/neon_mathfun.h",
    "content": "/* NEON implementation of sin, cos, exp and log\n\n   Inspired by Intel Approximate Math library, and based on the\n   corresponding algorithms of the cephes math library\n*/\n\n/* Copyright (C) 2011  Julien Pommier\n\n  This software is provided 'as-is', without any express or implied\n  warranty.  In no event will the authors be held liable for any damages\n  arising from the use of this software.\n\n  Permission is granted to anyone to use this software for any purpose,\n  including commercial applications, and to alter it and redistribute it\n  freely, subject to the following restrictions:\n\n  1. The origin of this software must not be misrepresented; you must not\n     claim that you wrote the original software. If you use this software\n     in a product, an acknowledgment in the product documentation would be\n     appreciated but is not required.\n  2. Altered source versions must be plainly marked as such, and must not be\n     misrepresented as being the original software.\n  3. This notice may not be removed or altered from any source distribution.\n\n  (this is the zlib license)\n*/\n\n#include <arm_neon.h>\n\ntypedef float32x4_t v4sf;  // vector of 4 float\ntypedef uint32x4_t v4su;  // vector of 4 uint32\ntypedef int32x4_t v4si;  // vector of 4 uint32\n\n#define c_inv_mant_mask ~0x7f800000u\n#define c_cephes_SQRTHF 0.707106781186547524\n#define c_cephes_log_p0 7.0376836292E-2\n#define c_cephes_log_p1 - 1.1514610310E-1\n#define c_cephes_log_p2 1.1676998740E-1\n#define c_cephes_log_p3 - 1.2420140846E-1\n#define c_cephes_log_p4 + 1.4249322787E-1\n#define c_cephes_log_p5 - 1.6668057665E-1\n#define c_cephes_log_p6 + 2.0000714765E-1\n#define c_cephes_log_p7 - 2.4999993993E-1\n#define c_cephes_log_p8 + 3.3333331174E-1\n#define c_cephes_log_q1 -2.12194440e-4\n#define c_cephes_log_q2 0.693359375\n\n/* natural logarithm computed for 4 simultaneous float \n   return NaN for x <= 0\n*/\nv4sf log_ps(v4sf x) {\n  v4sf one = vdupq_n_f32(1);\n\n  x = vmaxq_f32(x, vdupq_n_f32(0)); /* force flush to zero on denormal values */\n  v4su invalid_mask = vcleq_f32(x, vdupq_n_f32(0));\n\n  v4si ux = vreinterpretq_s32_f32(x);\n  \n  v4si emm0 = vshrq_n_s32(ux, 23);\n\n  /* keep only the fractional part */\n  ux = vandq_s32(ux, vdupq_n_s32(c_inv_mant_mask));\n  ux = vorrq_s32(ux, vreinterpretq_s32_f32(vdupq_n_f32(0.5f)));\n  x = vreinterpretq_f32_s32(ux);\n\n  emm0 = vsubq_s32(emm0, vdupq_n_s32(0x7f));\n  v4sf e = vcvtq_f32_s32(emm0);\n\n  e = vaddq_f32(e, one);\n\n  /* part2: \n     if( x < SQRTHF ) {\n       e -= 1;\n       x = x + x - 1.0;\n     } else { x = x - 1.0; }\n  */\n  v4su mask = vcltq_f32(x, vdupq_n_f32(c_cephes_SQRTHF));\n  v4sf tmp = vreinterpretq_f32_u32(vandq_u32(vreinterpretq_u32_f32(x), mask));\n  x = vsubq_f32(x, one);\n  e = vsubq_f32(e, vreinterpretq_f32_u32(vandq_u32(vreinterpretq_u32_f32(one), mask)));\n  x = vaddq_f32(x, tmp);\n\n  v4sf z = vmulq_f32(x,x);\n\n  v4sf y = vdupq_n_f32(c_cephes_log_p0);\n  y = vmulq_f32(y, x);\n  y = vaddq_f32(y, vdupq_n_f32(c_cephes_log_p1));\n  y = vmulq_f32(y, x);\n  y = vaddq_f32(y, vdupq_n_f32(c_cephes_log_p2));\n  y = vmulq_f32(y, x);\n  y = vaddq_f32(y, vdupq_n_f32(c_cephes_log_p3));\n  y = vmulq_f32(y, x);\n  y = vaddq_f32(y, vdupq_n_f32(c_cephes_log_p4));\n  y = vmulq_f32(y, x);\n  y = vaddq_f32(y, vdupq_n_f32(c_cephes_log_p5));\n  y = vmulq_f32(y, x);\n  y = vaddq_f32(y, vdupq_n_f32(c_cephes_log_p6));\n  y = vmulq_f32(y, x);\n  y = vaddq_f32(y, vdupq_n_f32(c_cephes_log_p7));\n  y = vmulq_f32(y, x);\n  y = vaddq_f32(y, vdupq_n_f32(c_cephes_log_p8));\n  y = vmulq_f32(y, x);\n\n  y = vmulq_f32(y, z);\n  \n\n  tmp = vmulq_f32(e, vdupq_n_f32(c_cephes_log_q1));\n  y = vaddq_f32(y, tmp);\n\n\n  tmp = vmulq_f32(z, vdupq_n_f32(0.5f));\n  y = vsubq_f32(y, tmp);\n\n  tmp = vmulq_f32(e, vdupq_n_f32(c_cephes_log_q2));\n  x = vaddq_f32(x, y);\n  x = vaddq_f32(x, tmp);\n  x = vreinterpretq_f32_u32(vorrq_u32(vreinterpretq_u32_f32(x), invalid_mask)); // negative arg will be NAN\n  return x;\n}\n\n#define c_exp_hi 88.3762626647949f\n#define c_exp_lo -88.3762626647949f\n\n#define c_cephes_LOG2EF 1.44269504088896341\n#define c_cephes_exp_C1 0.693359375\n#define c_cephes_exp_C2 -2.12194440e-4\n\n#define c_cephes_exp_p0 1.9875691500E-4\n#define c_cephes_exp_p1 1.3981999507E-3\n#define c_cephes_exp_p2 8.3334519073E-3\n#define c_cephes_exp_p3 4.1665795894E-2\n#define c_cephes_exp_p4 1.6666665459E-1\n#define c_cephes_exp_p5 5.0000001201E-1\n\n/* exp() computed for 4 float at once */\nv4sf exp_ps(v4sf x) {\n  v4sf tmp, fx;\n\n  v4sf one = vdupq_n_f32(1);\n  x = vminq_f32(x, vdupq_n_f32(c_exp_hi));\n  x = vmaxq_f32(x, vdupq_n_f32(c_exp_lo));\n\n  /* express exp(x) as exp(g + n*log(2)) */\n  fx = vmlaq_f32(vdupq_n_f32(0.5f), x, vdupq_n_f32(c_cephes_LOG2EF));\n\n  /* perform a floorf */\n  tmp = vcvtq_f32_s32(vcvtq_s32_f32(fx));\n\n  /* if greater, subtract 1 */\n  v4su mask = vcgtq_f32(tmp, fx);    \n  mask = vandq_u32(mask, vreinterpretq_u32_f32(one));\n\n\n  fx = vsubq_f32(tmp, vreinterpretq_f32_u32(mask));\n\n  tmp = vmulq_f32(fx, vdupq_n_f32(c_cephes_exp_C1));\n  v4sf z = vmulq_f32(fx, vdupq_n_f32(c_cephes_exp_C2));\n  x = vsubq_f32(x, tmp);\n  x = vsubq_f32(x, z);\n\n  static const float cephes_exp_p[6] = { c_cephes_exp_p0, c_cephes_exp_p1, c_cephes_exp_p2, c_cephes_exp_p3, c_cephes_exp_p4, c_cephes_exp_p5 };\n  v4sf y = vld1q_dup_f32(cephes_exp_p+0);\n  v4sf c1 = vld1q_dup_f32(cephes_exp_p+1); \n  v4sf c2 = vld1q_dup_f32(cephes_exp_p+2); \n  v4sf c3 = vld1q_dup_f32(cephes_exp_p+3); \n  v4sf c4 = vld1q_dup_f32(cephes_exp_p+4); \n  v4sf c5 = vld1q_dup_f32(cephes_exp_p+5);\n\n  y = vmulq_f32(y, x);\n  z = vmulq_f32(x,x);\n  y = vaddq_f32(y, c1);\n  y = vmulq_f32(y, x);\n  y = vaddq_f32(y, c2);\n  y = vmulq_f32(y, x);\n  y = vaddq_f32(y, c3);\n  y = vmulq_f32(y, x);\n  y = vaddq_f32(y, c4);\n  y = vmulq_f32(y, x);\n  y = vaddq_f32(y, c5);\n  \n  y = vmulq_f32(y, z);\n  y = vaddq_f32(y, x);\n  y = vaddq_f32(y, one);\n\n  /* build 2^n */\n  int32x4_t mm;\n  mm = vcvtq_s32_f32(fx);\n  mm = vaddq_s32(mm, vdupq_n_s32(0x7f));\n  mm = vshlq_n_s32(mm, 23);\n  v4sf pow2n = vreinterpretq_f32_s32(mm);\n\n  y = vmulq_f32(y, pow2n);\n  return y;\n}\n\n#define c_minus_cephes_DP1 -0.78515625\n#define c_minus_cephes_DP2 -2.4187564849853515625e-4\n#define c_minus_cephes_DP3 -3.77489497744594108e-8\n#define c_sincof_p0 -1.9515295891E-4\n#define c_sincof_p1  8.3321608736E-3\n#define c_sincof_p2 -1.6666654611E-1\n#define c_coscof_p0  2.443315711809948E-005\n#define c_coscof_p1 -1.388731625493765E-003\n#define c_coscof_p2  4.166664568298827E-002\n#define c_cephes_FOPI 1.27323954473516 // 4 / M_PI\n\n/* evaluation of 4 sines & cosines at once.\n\n   The code is the exact rewriting of the cephes sinf function.\n   Precision is excellent as long as x < 8192 (I did not bother to\n   take into account the special handling they have for greater values\n   -- it does not return garbage for arguments over 8192, though, but\n   the extra precision is missing).\n\n   Note that it is such that sinf((float)M_PI) = 8.74e-8, which is the\n   surprising but correct result.\n\n   Note also that when you compute sin(x), cos(x) is available at\n   almost no extra price so both sin_ps and cos_ps make use of\n   sincos_ps..\n  */\nvoid sincos_ps(v4sf x, v4sf *ysin, v4sf *ycos) { // any x\n  v4sf xmm1, xmm2, xmm3, y;\n\n  v4su emm2;\n  \n  v4su sign_mask_sin, sign_mask_cos;\n  sign_mask_sin = vcltq_f32(x, vdupq_n_f32(0));\n  x = vabsq_f32(x);\n\n  /* scale by 4/Pi */\n  y = vmulq_f32(x, vdupq_n_f32(c_cephes_FOPI));\n\n  /* store the integer part of y in mm0 */\n  emm2 = vcvtq_u32_f32(y);\n  /* j=(j+1) & (~1) (see the cephes sources) */\n  emm2 = vaddq_u32(emm2, vdupq_n_u32(1));\n  emm2 = vandq_u32(emm2, vdupq_n_u32(~1));\n  y = vcvtq_f32_u32(emm2);\n\n  /* get the polynom selection mask \n     there is one polynom for 0 <= x <= Pi/4\n     and another one for Pi/4<x<=Pi/2\n\n     Both branches will be computed.\n  */\n  v4su poly_mask = vtstq_u32(emm2, vdupq_n_u32(2));\n  \n  /* The magic pass: \"Extended precision modular arithmetic\" \n     x = ((x - y * DP1) - y * DP2) - y * DP3; */\n  xmm1 = vmulq_n_f32(y, c_minus_cephes_DP1);\n  xmm2 = vmulq_n_f32(y, c_minus_cephes_DP2);\n  xmm3 = vmulq_n_f32(y, c_minus_cephes_DP3);\n  x = vaddq_f32(x, xmm1);\n  x = vaddq_f32(x, xmm2);\n  x = vaddq_f32(x, xmm3);\n\n  sign_mask_sin = veorq_u32(sign_mask_sin, vtstq_u32(emm2, vdupq_n_u32(4)));\n  sign_mask_cos = vtstq_u32(vsubq_u32(emm2, vdupq_n_u32(2)), vdupq_n_u32(4));\n\n  /* Evaluate the first polynom  (0 <= x <= Pi/4) in y1, \n     and the second polynom      (Pi/4 <= x <= 0) in y2 */\n  v4sf z = vmulq_f32(x,x);\n  v4sf y1, y2;\n\n  y1 = vmulq_n_f32(z, c_coscof_p0);\n  y2 = vmulq_n_f32(z, c_sincof_p0);\n  y1 = vaddq_f32(y1, vdupq_n_f32(c_coscof_p1));\n  y2 = vaddq_f32(y2, vdupq_n_f32(c_sincof_p1));\n  y1 = vmulq_f32(y1, z);\n  y2 = vmulq_f32(y2, z);\n  y1 = vaddq_f32(y1, vdupq_n_f32(c_coscof_p2));\n  y2 = vaddq_f32(y2, vdupq_n_f32(c_sincof_p2));\n  y1 = vmulq_f32(y1, z);\n  y2 = vmulq_f32(y2, z);\n  y1 = vmulq_f32(y1, z);\n  y2 = vmulq_f32(y2, x);\n  y1 = vsubq_f32(y1, vmulq_f32(z, vdupq_n_f32(0.5f)));\n  y2 = vaddq_f32(y2, x);\n  y1 = vaddq_f32(y1, vdupq_n_f32(1));\n\n  /* select the correct result from the two polynoms */  \n  v4sf ys = vbslq_f32(poly_mask, y1, y2);\n  v4sf yc = vbslq_f32(poly_mask, y2, y1);\n  *ysin = vbslq_f32(sign_mask_sin, vnegq_f32(ys), ys);\n  *ycos = vbslq_f32(sign_mask_cos, yc, vnegq_f32(yc));\n}\n\nv4sf sin_ps(v4sf x) {\n  v4sf ysin, ycos; \n  sincos_ps(x, &ysin, &ycos); \n  return ysin;\n}\n\nv4sf cos_ps(v4sf x) {\n  v4sf ysin, ycos; \n  sincos_ps(x, &ysin, &ycos); \n  return ycos;\n}\n\n\n"
  },
  {
    "path": "cl_dll/include/math/sse_mathfun.h",
    "content": "/* SIMD (SSE1+MMX or SSE2) implementation of sin, cos, exp and log\n\n   Inspired by Intel Approximate Math library, and based on the\n   corresponding algorithms of the cephes math library\n\n   The default is to use the SSE1 version. If you define USE_SSE2 the\n   the SSE2 intrinsics will be used in place of the MMX intrinsics. Do\n   not expect any significant performance improvement with SSE2.\n*/\n\n/* Copyright (C) 2007  Julien Pommier\n\n  This software is provided 'as-is', without any express or implied\n  warranty.  In no event will the authors be held liable for any damages\n  arising from the use of this software.\n\n  Permission is granted to anyone to use this software for any purpose,\n  including commercial applications, and to alter it and redistribute it\n  freely, subject to the following restrictions:\n\n  1. The origin of this software must not be misrepresented; you must not\n     claim that you wrote the original software. If you use this software\n     in a product, an acknowledgment in the product documentation would be\n     appreciated but is not required.\n  2. Altered source versions must be plainly marked as such, and must not be\n     misrepresented as being the original software.\n  3. This notice may not be removed or altered from any source distribution.\n\n  (this is the zlib license)\n*/\n\n#include <xmmintrin.h>\n\n/* yes I know, the top of this file is quite ugly */\n\n#ifdef _MSC_VER /* visual c++ */\n# define ALIGN16_BEG __declspec(align(16))\n# define ALIGN16_END \n#else /* gcc or icc */\n# define ALIGN16_BEG\n# define ALIGN16_END __attribute__((aligned(16)))\n#endif\n\n/* __m128 is ugly to write */\ntypedef __m128 v4sf;  // vector of 4 float (sse1)\n\n#ifdef USE_SSE2\n# include <emmintrin.h>\ntypedef __m128i v4si; // vector of 4 int (sse2)\n#else\ntypedef __m64 v2si;   // vector of 2 int (mmx)\n#endif\n\n/* declare some SSE constants -- why can't I figure a better way to do that? */\n#define _PS_CONST(Name, Val)                                            \\\n  static const ALIGN16_BEG float _ps_##Name[4] ALIGN16_END = { Val, Val, Val, Val }\n#define _PI32_CONST(Name, Val)                                            \\\n  static const ALIGN16_BEG int _pi32_##Name[4] ALIGN16_END = { Val, Val, Val, Val }\n#define _PS_CONST_TYPE(Name, Type, Val)                                 \\\n  static const ALIGN16_BEG Type _ps_##Name[4] ALIGN16_END = { Val, Val, Val, Val }\n\n_PS_CONST(1  , 1.0f);\n_PS_CONST(0p5, 0.5f);\n/* the smallest non denormalized float number */\n_PS_CONST_TYPE(min_norm_pos, int, 0x00800000);\n_PS_CONST_TYPE(mant_mask, int, 0x7f800000);\n_PS_CONST_TYPE(inv_mant_mask, int, ~0x7f800000);\n\n_PS_CONST_TYPE(sign_mask, int, (int)0x80000000);\n_PS_CONST_TYPE(inv_sign_mask, int, ~0x80000000);\n\n_PI32_CONST(1, 1);\n_PI32_CONST(inv1, ~1);\n_PI32_CONST(2, 2);\n_PI32_CONST(4, 4);\n_PI32_CONST(0x7f, 0x7f);\n\n_PS_CONST(cephes_SQRTHF, 0.707106781186547524);\n_PS_CONST(cephes_log_p0, 7.0376836292E-2);\n_PS_CONST(cephes_log_p1, - 1.1514610310E-1);\n_PS_CONST(cephes_log_p2, 1.1676998740E-1);\n_PS_CONST(cephes_log_p3, - 1.2420140846E-1);\n_PS_CONST(cephes_log_p4, + 1.4249322787E-1);\n_PS_CONST(cephes_log_p5, - 1.6668057665E-1);\n_PS_CONST(cephes_log_p6, + 2.0000714765E-1);\n_PS_CONST(cephes_log_p7, - 2.4999993993E-1);\n_PS_CONST(cephes_log_p8, + 3.3333331174E-1);\n_PS_CONST(cephes_log_q1, -2.12194440e-4);\n_PS_CONST(cephes_log_q2, 0.693359375);\n\n#ifndef USE_SSE2\ntypedef union xmm_mm_union {\n  __m128 xmm;\n  __m64 mm[2];\n} xmm_mm_union;\n\n#define COPY_XMM_TO_MM(xmm_, mm0_, mm1_) {          \\\n    xmm_mm_union u; u.xmm = xmm_;                   \\\n    mm0_ = u.mm[0];                                 \\\n    mm1_ = u.mm[1];                                 \\\n}\n\n#define COPY_MM_TO_XMM(mm0_, mm1_, xmm_) {                         \\\n    xmm_mm_union u; u.mm[0]=mm0_; u.mm[1]=mm1_; xmm_ = u.xmm;      \\\n  }\n\n#endif // USE_SSE2\n\n/* natural logarithm computed for 4 simultaneous float \n   return NaN for x <= 0\n*/\nv4sf log_ps(v4sf x) {\n#ifdef USE_SSE2\n  v4si emm0;\n#else\n  v2si mm0, mm1;\n#endif\n  v4sf one = *(v4sf*)_ps_1;\n\n  v4sf invalid_mask = _mm_cmple_ps(x, _mm_setzero_ps());\n\n  x = _mm_max_ps(x, *(v4sf*)_ps_min_norm_pos);  /* cut off denormalized stuff */\n\n#ifndef USE_SSE2\n  /* part 1: x = frexpf(x, &e); */\n  COPY_XMM_TO_MM(x, mm0, mm1);\n  mm0 = _mm_srli_pi32(mm0, 23);\n  mm1 = _mm_srli_pi32(mm1, 23);\n#else\n  emm0 = _mm_srli_epi32(_mm_castps_si128(x), 23);\n#endif\n  /* keep only the fractional part */\n  x = _mm_and_ps(x, *(v4sf*)_ps_inv_mant_mask);\n  x = _mm_or_ps(x, *(v4sf*)_ps_0p5);\n\n#ifndef USE_SSE2\n  /* now e=mm0:mm1 contain the really base-2 exponent */\n  mm0 = _mm_sub_pi32(mm0, *(v2si*)_pi32_0x7f);\n  mm1 = _mm_sub_pi32(mm1, *(v2si*)_pi32_0x7f);\n  v4sf e = _mm_cvtpi32x2_ps(mm0, mm1);\n  _mm_empty(); /* bye bye mmx */\n#else\n  emm0 = _mm_sub_epi32(emm0, *(v4si*)_pi32_0x7f);\n  v4sf e = _mm_cvtepi32_ps(emm0);\n#endif\n\n  e = _mm_add_ps(e, one);\n\n  /* part2: \n     if( x < SQRTHF ) {\n       e -= 1;\n       x = x + x - 1.0;\n     } else { x = x - 1.0; }\n  */\n  v4sf mask = _mm_cmplt_ps(x, *(v4sf*)_ps_cephes_SQRTHF);\n  v4sf tmp = _mm_and_ps(x, mask);\n  x = _mm_sub_ps(x, one);\n  e = _mm_sub_ps(e, _mm_and_ps(one, mask));\n  x = _mm_add_ps(x, tmp);\n\n\n  v4sf z = _mm_mul_ps(x,x);\n\n  v4sf y = *(v4sf*)_ps_cephes_log_p0;\n  y = _mm_mul_ps(y, x);\n  y = _mm_add_ps(y, *(v4sf*)_ps_cephes_log_p1);\n  y = _mm_mul_ps(y, x);\n  y = _mm_add_ps(y, *(v4sf*)_ps_cephes_log_p2);\n  y = _mm_mul_ps(y, x);\n  y = _mm_add_ps(y, *(v4sf*)_ps_cephes_log_p3);\n  y = _mm_mul_ps(y, x);\n  y = _mm_add_ps(y, *(v4sf*)_ps_cephes_log_p4);\n  y = _mm_mul_ps(y, x);\n  y = _mm_add_ps(y, *(v4sf*)_ps_cephes_log_p5);\n  y = _mm_mul_ps(y, x);\n  y = _mm_add_ps(y, *(v4sf*)_ps_cephes_log_p6);\n  y = _mm_mul_ps(y, x);\n  y = _mm_add_ps(y, *(v4sf*)_ps_cephes_log_p7);\n  y = _mm_mul_ps(y, x);\n  y = _mm_add_ps(y, *(v4sf*)_ps_cephes_log_p8);\n  y = _mm_mul_ps(y, x);\n\n  y = _mm_mul_ps(y, z);\n  \n\n  tmp = _mm_mul_ps(e, *(v4sf*)_ps_cephes_log_q1);\n  y = _mm_add_ps(y, tmp);\n\n\n  tmp = _mm_mul_ps(z, *(v4sf*)_ps_0p5);\n  y = _mm_sub_ps(y, tmp);\n\n  tmp = _mm_mul_ps(e, *(v4sf*)_ps_cephes_log_q2);\n  x = _mm_add_ps(x, y);\n  x = _mm_add_ps(x, tmp);\n  x = _mm_or_ps(x, invalid_mask); // negative arg will be NAN\n  return x;\n}\n\n_PS_CONST(exp_hi,\t88.3762626647949f);\n_PS_CONST(exp_lo,\t-88.3762626647949f);\n\n_PS_CONST(cephes_LOG2EF, 1.44269504088896341);\n_PS_CONST(cephes_exp_C1, 0.693359375);\n_PS_CONST(cephes_exp_C2, -2.12194440e-4);\n\n_PS_CONST(cephes_exp_p0, 1.9875691500E-4);\n_PS_CONST(cephes_exp_p1, 1.3981999507E-3);\n_PS_CONST(cephes_exp_p2, 8.3334519073E-3);\n_PS_CONST(cephes_exp_p3, 4.1665795894E-2);\n_PS_CONST(cephes_exp_p4, 1.6666665459E-1);\n_PS_CONST(cephes_exp_p5, 5.0000001201E-1);\n\nv4sf exp_ps(v4sf x) {\n  v4sf tmp = _mm_setzero_ps(), fx;\n#ifdef USE_SSE2\n  v4si emm0;\n#else\n  v2si mm0, mm1;\n#endif\n  v4sf one = *(v4sf*)_ps_1;\n\n  x = _mm_min_ps(x, *(v4sf*)_ps_exp_hi);\n  x = _mm_max_ps(x, *(v4sf*)_ps_exp_lo);\n\n  /* express exp(x) as exp(g + n*log(2)) */\n  fx = _mm_mul_ps(x, *(v4sf*)_ps_cephes_LOG2EF);\n  fx = _mm_add_ps(fx, *(v4sf*)_ps_0p5);\n\n  /* how to perform a floorf with SSE: just below */\n#ifndef USE_SSE2\n  /* step 1 : cast to int */\n  tmp = _mm_movehl_ps(tmp, fx);\n  mm0 = _mm_cvttps_pi32(fx);\n  mm1 = _mm_cvttps_pi32(tmp);\n  /* step 2 : cast back to float */\n  tmp = _mm_cvtpi32x2_ps(mm0, mm1);\n#else\n  emm0 = _mm_cvttps_epi32(fx);\n  tmp  = _mm_cvtepi32_ps(emm0);\n#endif\n  /* if greater, subtract 1 */\n  v4sf mask = _mm_cmpgt_ps(tmp, fx);    \n  mask = _mm_and_ps(mask, one);\n  fx = _mm_sub_ps(tmp, mask);\n\n  tmp = _mm_mul_ps(fx, *(v4sf*)_ps_cephes_exp_C1);\n  v4sf z = _mm_mul_ps(fx, *(v4sf*)_ps_cephes_exp_C2);\n  x = _mm_sub_ps(x, tmp);\n  x = _mm_sub_ps(x, z);\n\n  z = _mm_mul_ps(x,x);\n  \n  v4sf y = *(v4sf*)_ps_cephes_exp_p0;\n  y = _mm_mul_ps(y, x);\n  y = _mm_add_ps(y, *(v4sf*)_ps_cephes_exp_p1);\n  y = _mm_mul_ps(y, x);\n  y = _mm_add_ps(y, *(v4sf*)_ps_cephes_exp_p2);\n  y = _mm_mul_ps(y, x);\n  y = _mm_add_ps(y, *(v4sf*)_ps_cephes_exp_p3);\n  y = _mm_mul_ps(y, x);\n  y = _mm_add_ps(y, *(v4sf*)_ps_cephes_exp_p4);\n  y = _mm_mul_ps(y, x);\n  y = _mm_add_ps(y, *(v4sf*)_ps_cephes_exp_p5);\n  y = _mm_mul_ps(y, z);\n  y = _mm_add_ps(y, x);\n  y = _mm_add_ps(y, one);\n\n  /* build 2^n */\n#ifndef USE_SSE2\n  z = _mm_movehl_ps(z, fx);\n  mm0 = _mm_cvttps_pi32(fx);\n  mm1 = _mm_cvttps_pi32(z);\n  mm0 = _mm_add_pi32(mm0, *(v2si*)_pi32_0x7f);\n  mm1 = _mm_add_pi32(mm1, *(v2si*)_pi32_0x7f);\n  mm0 = _mm_slli_pi32(mm0, 23); \n  mm1 = _mm_slli_pi32(mm1, 23);\n  \n  v4sf pow2n; \n  COPY_MM_TO_XMM(mm0, mm1, pow2n);\n  _mm_empty();\n#else\n  emm0 = _mm_cvttps_epi32(fx);\n  emm0 = _mm_add_epi32(emm0, *(v4si*)_pi32_0x7f);\n  emm0 = _mm_slli_epi32(emm0, 23);\n  v4sf pow2n = _mm_castsi128_ps(emm0);\n#endif\n  y = _mm_mul_ps(y, pow2n);\n  return y;\n}\n\n_PS_CONST(minus_cephes_DP1, -0.78515625);\n_PS_CONST(minus_cephes_DP2, -2.4187564849853515625e-4);\n_PS_CONST(minus_cephes_DP3, -3.77489497744594108e-8);\n_PS_CONST(sincof_p0, -1.9515295891E-4);\n_PS_CONST(sincof_p1,  8.3321608736E-3);\n_PS_CONST(sincof_p2, -1.6666654611E-1);\n_PS_CONST(coscof_p0,  2.443315711809948E-005);\n_PS_CONST(coscof_p1, -1.388731625493765E-003);\n_PS_CONST(coscof_p2,  4.166664568298827E-002);\n_PS_CONST(cephes_FOPI, 1.27323954473516); // 4 / M_PI\n\n\n/* evaluation of 4 sines at onces, using only SSE1+MMX intrinsics so\n   it runs also on old athlons XPs and the pentium III of your grand\n   mother.\n\n   The code is the exact rewriting of the cephes sinf function.\n   Precision is excellent as long as x < 8192 (I did not bother to\n   take into account the special handling they have for greater values\n   -- it does not return garbage for arguments over 8192, though, but\n   the extra precision is missing).\n\n   Note that it is such that sinf((float)M_PI) = 8.74e-8, which is the\n   surprising but correct result.\n\n   Performance is also surprisingly good, 1.33 times faster than the\n   macos vsinf SSE2 function, and 1.5 times faster than the\n   __vrs4_sinf of amd's ACML (which is only available in 64 bits). Not\n   too bad for an SSE1 function (with no special tuning) !\n   However the latter libraries probably have a much better handling of NaN,\n   Inf, denormalized and other special arguments..\n\n   On my core 1 duo, the execution of this function takes approximately 95 cycles.\n\n   From what I have observed on the experiments with Intel AMath lib, switching to an\n   SSE2 version would improve the perf by only 10%.\n\n   Since it is based on SSE intrinsics, it has to be compiled at -O2 to\n   deliver full speed.\n*/\nv4sf sin_ps(v4sf x) { // any x\n  v4sf xmm1, xmm2 = _mm_setzero_ps(), xmm3, sign_bit, y;\n\n#ifdef USE_SSE2\n  v4si emm0, emm2;\n#else\n  v2si mm0, mm1, mm2, mm3;\n#endif\n  sign_bit = x;\n  /* take the absolute value */\n  x = _mm_and_ps(x, *(v4sf*)_ps_inv_sign_mask);\n  /* extract the sign bit (upper one) */\n  sign_bit = _mm_and_ps(sign_bit, *(v4sf*)_ps_sign_mask);\n  \n  /* scale by 4/Pi */\n  y = _mm_mul_ps(x, *(v4sf*)_ps_cephes_FOPI);\n\n#ifdef USE_SSE2\n  /* store the integer part of y in mm0 */\n  emm2 = _mm_cvttps_epi32(y);\n  /* j=(j+1) & (~1) (see the cephes sources) */\n  emm2 = _mm_add_epi32(emm2, *(v4si*)_pi32_1);\n  emm2 = _mm_and_si128(emm2, *(v4si*)_pi32_inv1);\n  y = _mm_cvtepi32_ps(emm2);\n\n  /* get the swap sign flag */\n  emm0 = _mm_and_si128(emm2, *(v4si*)_pi32_4);\n  emm0 = _mm_slli_epi32(emm0, 29);\n  /* get the polynom selection mask \n     there is one polynom for 0 <= x <= Pi/4\n     and another one for Pi/4<x<=Pi/2\n\n     Both branches will be computed.\n  */\n  emm2 = _mm_and_si128(emm2, *(v4si*)_pi32_2);\n  emm2 = _mm_cmpeq_epi32(emm2, _mm_setzero_si128());\n  \n  v4sf swap_sign_bit = _mm_castsi128_ps(emm0);\n  v4sf poly_mask = _mm_castsi128_ps(emm2);\n  sign_bit = _mm_xor_ps(sign_bit, swap_sign_bit);\n  \n#else\n  /* store the integer part of y in mm0:mm1 */\n  xmm2 = _mm_movehl_ps(xmm2, y);\n  mm2 = _mm_cvttps_pi32(y);\n  mm3 = _mm_cvttps_pi32(xmm2);\n  /* j=(j+1) & (~1) (see the cephes sources) */\n  mm2 = _mm_add_pi32(mm2, *(v2si*)_pi32_1);\n  mm3 = _mm_add_pi32(mm3, *(v2si*)_pi32_1);\n  mm2 = _mm_and_si64(mm2, *(v2si*)_pi32_inv1);\n  mm3 = _mm_and_si64(mm3, *(v2si*)_pi32_inv1);\n  y = _mm_cvtpi32x2_ps(mm2, mm3);\n  /* get the swap sign flag */\n  mm0 = _mm_and_si64(mm2, *(v2si*)_pi32_4);\n  mm1 = _mm_and_si64(mm3, *(v2si*)_pi32_4);\n  mm0 = _mm_slli_pi32(mm0, 29);\n  mm1 = _mm_slli_pi32(mm1, 29);\n  /* get the polynom selection mask */\n  mm2 = _mm_and_si64(mm2, *(v2si*)_pi32_2);\n  mm3 = _mm_and_si64(mm3, *(v2si*)_pi32_2);\n  mm2 = _mm_cmpeq_pi32(mm2, _mm_setzero_si64());\n  mm3 = _mm_cmpeq_pi32(mm3, _mm_setzero_si64());\n  v4sf swap_sign_bit, poly_mask;\n  COPY_MM_TO_XMM(mm0, mm1, swap_sign_bit);\n  COPY_MM_TO_XMM(mm2, mm3, poly_mask);\n  sign_bit = _mm_xor_ps(sign_bit, swap_sign_bit);\n  _mm_empty(); /* good-bye mmx */\n#endif\n  \n  /* The magic pass: \"Extended precision modular arithmetic\" \n     x = ((x - y * DP1) - y * DP2) - y * DP3; */\n  xmm1 = *(v4sf*)_ps_minus_cephes_DP1;\n  xmm2 = *(v4sf*)_ps_minus_cephes_DP2;\n  xmm3 = *(v4sf*)_ps_minus_cephes_DP3;\n  xmm1 = _mm_mul_ps(y, xmm1);\n  xmm2 = _mm_mul_ps(y, xmm2);\n  xmm3 = _mm_mul_ps(y, xmm3);\n  x = _mm_add_ps(x, xmm1);\n  x = _mm_add_ps(x, xmm2);\n  x = _mm_add_ps(x, xmm3);\n\n  /* Evaluate the first polynom  (0 <= x <= Pi/4) */\n  y = *(v4sf*)_ps_coscof_p0;\n  v4sf z = _mm_mul_ps(x,x);\n\n  y = _mm_mul_ps(y, z);\n  y = _mm_add_ps(y, *(v4sf*)_ps_coscof_p1);\n  y = _mm_mul_ps(y, z);\n  y = _mm_add_ps(y, *(v4sf*)_ps_coscof_p2);\n  y = _mm_mul_ps(y, z);\n  y = _mm_mul_ps(y, z);\n  v4sf tmp = _mm_mul_ps(z, *(v4sf*)_ps_0p5);\n  y = _mm_sub_ps(y, tmp);\n  y = _mm_add_ps(y, *(v4sf*)_ps_1);\n  \n  /* Evaluate the second polynom  (Pi/4 <= x <= 0) */\n\n  v4sf y2 = *(v4sf*)_ps_sincof_p0;\n  y2 = _mm_mul_ps(y2, z);\n  y2 = _mm_add_ps(y2, *(v4sf*)_ps_sincof_p1);\n  y2 = _mm_mul_ps(y2, z);\n  y2 = _mm_add_ps(y2, *(v4sf*)_ps_sincof_p2);\n  y2 = _mm_mul_ps(y2, z);\n  y2 = _mm_mul_ps(y2, x);\n  y2 = _mm_add_ps(y2, x);\n\n  /* select the correct result from the two polynoms */  \n  xmm3 = poly_mask;\n  y2 = _mm_and_ps(xmm3, y2); //, xmm3);\n  y = _mm_andnot_ps(xmm3, y);\n  y = _mm_add_ps(y,y2);\n  /* update the sign */\n  y = _mm_xor_ps(y, sign_bit);\n  return y;\n}\n\n/* almost the same as sin_ps */\nv4sf cos_ps(v4sf x) { // any x\n  v4sf xmm1, xmm2 = _mm_setzero_ps(), xmm3, y;\n#ifdef USE_SSE2\n  v4si emm0, emm2;\n#else\n  v2si mm0, mm1, mm2, mm3;\n#endif\n  /* take the absolute value */\n  x = _mm_and_ps(x, *(v4sf*)_ps_inv_sign_mask);\n  \n  /* scale by 4/Pi */\n  y = _mm_mul_ps(x, *(v4sf*)_ps_cephes_FOPI);\n  \n#ifdef USE_SSE2\n  /* store the integer part of y in mm0 */\n  emm2 = _mm_cvttps_epi32(y);\n  /* j=(j+1) & (~1) (see the cephes sources) */\n  emm2 = _mm_add_epi32(emm2, *(v4si*)_pi32_1);\n  emm2 = _mm_and_si128(emm2, *(v4si*)_pi32_inv1);\n  y = _mm_cvtepi32_ps(emm2);\n\n  emm2 = _mm_sub_epi32(emm2, *(v4si*)_pi32_2);\n  \n  /* get the swap sign flag */\n  emm0 = _mm_andnot_si128(emm2, *(v4si*)_pi32_4);\n  emm0 = _mm_slli_epi32(emm0, 29);\n  /* get the polynom selection mask */\n  emm2 = _mm_and_si128(emm2, *(v4si*)_pi32_2);\n  emm2 = _mm_cmpeq_epi32(emm2, _mm_setzero_si128());\n  \n  v4sf sign_bit = _mm_castsi128_ps(emm0);\n  v4sf poly_mask = _mm_castsi128_ps(emm2);\n#else\n  /* store the integer part of y in mm0:mm1 */\n  xmm2 = _mm_movehl_ps(xmm2, y);\n  mm2 = _mm_cvttps_pi32(y);\n  mm3 = _mm_cvttps_pi32(xmm2);\n\n  /* j=(j+1) & (~1) (see the cephes sources) */\n  mm2 = _mm_add_pi32(mm2, *(v2si*)_pi32_1);\n  mm3 = _mm_add_pi32(mm3, *(v2si*)_pi32_1);\n  mm2 = _mm_and_si64(mm2, *(v2si*)_pi32_inv1);\n  mm3 = _mm_and_si64(mm3, *(v2si*)_pi32_inv1);\n\n  y = _mm_cvtpi32x2_ps(mm2, mm3);\n\n\n  mm2 = _mm_sub_pi32(mm2, *(v2si*)_pi32_2);\n  mm3 = _mm_sub_pi32(mm3, *(v2si*)_pi32_2);\n\n  /* get the swap sign flag in mm0:mm1 and the \n     polynom selection mask in mm2:mm3 */\n\n  mm0 = _mm_andnot_si64(mm2, *(v2si*)_pi32_4);\n  mm1 = _mm_andnot_si64(mm3, *(v2si*)_pi32_4);\n  mm0 = _mm_slli_pi32(mm0, 29);\n  mm1 = _mm_slli_pi32(mm1, 29);\n\n  mm2 = _mm_and_si64(mm2, *(v2si*)_pi32_2);\n  mm3 = _mm_and_si64(mm3, *(v2si*)_pi32_2);\n\n  mm2 = _mm_cmpeq_pi32(mm2, _mm_setzero_si64());\n  mm3 = _mm_cmpeq_pi32(mm3, _mm_setzero_si64());\n\n  v4sf sign_bit, poly_mask;\n  COPY_MM_TO_XMM(mm0, mm1, sign_bit);\n  COPY_MM_TO_XMM(mm2, mm3, poly_mask);\n  _mm_empty(); /* good-bye mmx */\n#endif\n  /* The magic pass: \"Extended precision modular arithmetic\" \n     x = ((x - y * DP1) - y * DP2) - y * DP3; */\n  xmm1 = *(v4sf*)_ps_minus_cephes_DP1;\n  xmm2 = *(v4sf*)_ps_minus_cephes_DP2;\n  xmm3 = *(v4sf*)_ps_minus_cephes_DP3;\n  xmm1 = _mm_mul_ps(y, xmm1);\n  xmm2 = _mm_mul_ps(y, xmm2);\n  xmm3 = _mm_mul_ps(y, xmm3);\n  x = _mm_add_ps(x, xmm1);\n  x = _mm_add_ps(x, xmm2);\n  x = _mm_add_ps(x, xmm3);\n  \n  /* Evaluate the first polynom  (0 <= x <= Pi/4) */\n  y = *(v4sf*)_ps_coscof_p0;\n  v4sf z = _mm_mul_ps(x,x);\n\n  y = _mm_mul_ps(y, z);\n  y = _mm_add_ps(y, *(v4sf*)_ps_coscof_p1);\n  y = _mm_mul_ps(y, z);\n  y = _mm_add_ps(y, *(v4sf*)_ps_coscof_p2);\n  y = _mm_mul_ps(y, z);\n  y = _mm_mul_ps(y, z);\n  v4sf tmp = _mm_mul_ps(z, *(v4sf*)_ps_0p5);\n  y = _mm_sub_ps(y, tmp);\n  y = _mm_add_ps(y, *(v4sf*)_ps_1);\n  \n  /* Evaluate the second polynom  (Pi/4 <= x <= 0) */\n\n  v4sf y2 = *(v4sf*)_ps_sincof_p0;\n  y2 = _mm_mul_ps(y2, z);\n  y2 = _mm_add_ps(y2, *(v4sf*)_ps_sincof_p1);\n  y2 = _mm_mul_ps(y2, z);\n  y2 = _mm_add_ps(y2, *(v4sf*)_ps_sincof_p2);\n  y2 = _mm_mul_ps(y2, z);\n  y2 = _mm_mul_ps(y2, x);\n  y2 = _mm_add_ps(y2, x);\n\n  /* select the correct result from the two polynoms */  \n  xmm3 = poly_mask;\n  y2 = _mm_and_ps(xmm3, y2); //, xmm3);\n  y = _mm_andnot_ps(xmm3, y);\n  y = _mm_add_ps(y,y2);\n  /* update the sign */\n  y = _mm_xor_ps(y, sign_bit);\n\n  return y;\n}\n\n/* since sin_ps and cos_ps are almost identical, sincos_ps could replace both of them..\n   it is almost as fast, and gives you a free cosine with your sine */\nvoid sincos_ps(v4sf x, v4sf *s, v4sf *c) {\n  v4sf xmm1, xmm2, xmm3 = _mm_setzero_ps(), sign_bit_sin, y;\n#ifdef USE_SSE2\n  v4si emm0, emm2, emm4;\n#else\n  v2si mm0, mm1, mm2, mm3, mm4, mm5;\n#endif\n  sign_bit_sin = x;\n  /* take the absolute value */\n  x = _mm_and_ps(x, *(v4sf*)_ps_inv_sign_mask);\n  /* extract the sign bit (upper one) */\n  sign_bit_sin = _mm_and_ps(sign_bit_sin, *(v4sf*)_ps_sign_mask);\n  \n  /* scale by 4/Pi */\n  y = _mm_mul_ps(x, *(v4sf*)_ps_cephes_FOPI);\n    \n#ifdef USE_SSE2\n  /* store the integer part of y in emm2 */\n  emm2 = _mm_cvttps_epi32(y);\n\n  /* j=(j+1) & (~1) (see the cephes sources) */\n  emm2 = _mm_add_epi32(emm2, *(v4si*)_pi32_1);\n  emm2 = _mm_and_si128(emm2, *(v4si*)_pi32_inv1);\n  y = _mm_cvtepi32_ps(emm2);\n\n  emm4 = emm2;\n\n  /* get the swap sign flag for the sine */\n  emm0 = _mm_and_si128(emm2, *(v4si*)_pi32_4);\n  emm0 = _mm_slli_epi32(emm0, 29);\n  v4sf swap_sign_bit_sin = _mm_castsi128_ps(emm0);\n\n  /* get the polynom selection mask for the sine*/\n  emm2 = _mm_and_si128(emm2, *(v4si*)_pi32_2);\n  emm2 = _mm_cmpeq_epi32(emm2, _mm_setzero_si128());\n  v4sf poly_mask = _mm_castsi128_ps(emm2);\n#else\n  /* store the integer part of y in mm2:mm3 */\n  xmm3 = _mm_movehl_ps(xmm3, y);\n  mm2 = _mm_cvttps_pi32(y);\n  mm3 = _mm_cvttps_pi32(xmm3);\n\n  /* j=(j+1) & (~1) (see the cephes sources) */\n  mm2 = _mm_add_pi32(mm2, *(v2si*)_pi32_1);\n  mm3 = _mm_add_pi32(mm3, *(v2si*)_pi32_1);\n  mm2 = _mm_and_si64(mm2, *(v2si*)_pi32_inv1);\n  mm3 = _mm_and_si64(mm3, *(v2si*)_pi32_inv1);\n\n  y = _mm_cvtpi32x2_ps(mm2, mm3);\n\n  mm4 = mm2;\n  mm5 = mm3;\n\n  /* get the swap sign flag for the sine */\n  mm0 = _mm_and_si64(mm2, *(v2si*)_pi32_4);\n  mm1 = _mm_and_si64(mm3, *(v2si*)_pi32_4);\n  mm0 = _mm_slli_pi32(mm0, 29);\n  mm1 = _mm_slli_pi32(mm1, 29);\n  v4sf swap_sign_bit_sin;\n  COPY_MM_TO_XMM(mm0, mm1, swap_sign_bit_sin);\n\n  /* get the polynom selection mask for the sine */\n\n  mm2 = _mm_and_si64(mm2, *(v2si*)_pi32_2);\n  mm3 = _mm_and_si64(mm3, *(v2si*)_pi32_2);\n  mm2 = _mm_cmpeq_pi32(mm2, _mm_setzero_si64());\n  mm3 = _mm_cmpeq_pi32(mm3, _mm_setzero_si64());\n  v4sf poly_mask;\n  COPY_MM_TO_XMM(mm2, mm3, poly_mask);\n#endif\n\n  /* The magic pass: \"Extended precision modular arithmetic\" \n     x = ((x - y * DP1) - y * DP2) - y * DP3; */\n  xmm1 = *(v4sf*)_ps_minus_cephes_DP1;\n  xmm2 = *(v4sf*)_ps_minus_cephes_DP2;\n  xmm3 = *(v4sf*)_ps_minus_cephes_DP3;\n  xmm1 = _mm_mul_ps(y, xmm1);\n  xmm2 = _mm_mul_ps(y, xmm2);\n  xmm3 = _mm_mul_ps(y, xmm3);\n  x = _mm_add_ps(x, xmm1);\n  x = _mm_add_ps(x, xmm2);\n  x = _mm_add_ps(x, xmm3);\n\n#ifdef USE_SSE2\n  emm4 = _mm_sub_epi32(emm4, *(v4si*)_pi32_2);\n  emm4 = _mm_andnot_si128(emm4, *(v4si*)_pi32_4);\n  emm4 = _mm_slli_epi32(emm4, 29);\n  v4sf sign_bit_cos = _mm_castsi128_ps(emm4);\n#else\n  /* get the sign flag for the cosine */\n  mm4 = _mm_sub_pi32(mm4, *(v2si*)_pi32_2);\n  mm5 = _mm_sub_pi32(mm5, *(v2si*)_pi32_2);\n  mm4 = _mm_andnot_si64(mm4, *(v2si*)_pi32_4);\n  mm5 = _mm_andnot_si64(mm5, *(v2si*)_pi32_4);\n  mm4 = _mm_slli_pi32(mm4, 29);\n  mm5 = _mm_slli_pi32(mm5, 29);\n  v4sf sign_bit_cos;\n  COPY_MM_TO_XMM(mm4, mm5, sign_bit_cos);\n  _mm_empty(); /* good-bye mmx */\n#endif\n\n  sign_bit_sin = _mm_xor_ps(sign_bit_sin, swap_sign_bit_sin);\n\n  \n  /* Evaluate the first polynom  (0 <= x <= Pi/4) */\n  v4sf z = _mm_mul_ps(x,x);\n  y = *(v4sf*)_ps_coscof_p0;\n\n  y = _mm_mul_ps(y, z);\n  y = _mm_add_ps(y, *(v4sf*)_ps_coscof_p1);\n  y = _mm_mul_ps(y, z);\n  y = _mm_add_ps(y, *(v4sf*)_ps_coscof_p2);\n  y = _mm_mul_ps(y, z);\n  y = _mm_mul_ps(y, z);\n  v4sf tmp = _mm_mul_ps(z, *(v4sf*)_ps_0p5);\n  y = _mm_sub_ps(y, tmp);\n  y = _mm_add_ps(y, *(v4sf*)_ps_1);\n  \n  /* Evaluate the second polynom  (Pi/4 <= x <= 0) */\n\n  v4sf y2 = *(v4sf*)_ps_sincof_p0;\n  y2 = _mm_mul_ps(y2, z);\n  y2 = _mm_add_ps(y2, *(v4sf*)_ps_sincof_p1);\n  y2 = _mm_mul_ps(y2, z);\n  y2 = _mm_add_ps(y2, *(v4sf*)_ps_sincof_p2);\n  y2 = _mm_mul_ps(y2, z);\n  y2 = _mm_mul_ps(y2, x);\n  y2 = _mm_add_ps(y2, x);\n\n  /* select the correct result from the two polynoms */  \n  xmm3 = poly_mask;\n  v4sf ysin2 = _mm_and_ps(xmm3, y2);\n  v4sf ysin1 = _mm_andnot_ps(xmm3, y);\n  y2 = _mm_sub_ps(y2,ysin2);\n  y = _mm_sub_ps(y, ysin1);\n\n  xmm1 = _mm_add_ps(ysin1,ysin2);\n  xmm2 = _mm_add_ps(y,y2);\n \n  /* update the sign */\n  *s = _mm_xor_ps(xmm1, sign_bit_sin);\n  *c = _mm_xor_ps(xmm2, sign_bit_cos);\n}\n\n"
  },
  {
    "path": "cl_dll/include/overview.h",
    "content": "//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============\n//\n// Purpose: \n//\n// $NoKeywords: $\n//=============================================================================\n#pragma once\n#ifndef OVERVIEW_H\n#define OVERVIEW_H\n\n\n//-----------------------------------------------------------------------------\n// Purpose: Handles the drawing of the top-down map and all the things on it\n//-----------------------------------------------------------------------------\nclass CHudOverview : public CHudBase\n{\npublic:\n\tint Init();\n\tint VidInit();\n\n\tint Draw(float flTime);\n\tvoid InitHUDData( void );\n\nprivate:\n\tHSPRITE m_hsprPlayer;\n\tHSPRITE m_hsprViewcone;\n};\n\n\n#endif // OVERVIEW_H\n"
  },
  {
    "path": "cl_dll/include/parsemsg.h",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\t\n*\tThis product contains software technology licensed from Id \n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc. \n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n//\n//  parsemsg.h\n//\n#pragma once\n#define ASSERT( x )\n\n#include <stdint.h>\n\nclass BufferReader\n{\npublic:\n\tBufferReader( const char *name, void *buf, int size ) :\n\t\tm_szMsgName( name ), m_pBuf( (uint8_t*)buf ), m_iSize( size ), m_iRead( 0 ), m_bBad( false ) {}\n\tBufferReader( void *buf, int size ) : BufferReader( \"not set\", buf, size ) {}\n\n#ifdef _DEBUG\n\tinline ~BufferReader( void );\n#endif\n\n\tvoid Flush( void );\n\tbool Bad( void ) { return m_bBad; }\n\tbool Eof( void ) { return m_iRead >= m_iSize - 1; }\n\n\tbool Valid( void ) { return !Bad() && !Eof(); }\n\n\ttemplate<typename T> T Read( void );\n\n\tint8_t ReadChar( void );\n\tuint8_t ReadByte( void );\n\tint16_t ReadShort( void );\n\tint16_t ReadWord( void );\n\tint32_t ReadLong( void ); // no mistake here, we assume that long is 32 bit.\n\tchar *ReadString( void );\n\tfloat ReadFloat( void );\n\tfloat ReadCoord( void );\n\tfloat ReadAngle( void );\n\tfloat ReadHiResAngle( void );\n\tVector ReadCoordVector( void );\n\nprivate:\n\tconst char *m_szMsgName;\n\tuint8_t *m_pBuf;\n\tsize_t   m_iSize;\n\tsize_t   m_iRead;\n\tbool     m_bBad;\n};\n\ninline void BufferReader::Flush( void )\n{\n\tm_iRead = m_iSize - 1;\n}\n\ntemplate<typename T>\ninline T BufferReader::Read( void )\n{\n\tif( m_bBad )\n\t\treturn -1;\n\n\t// don't go out of bounds\n\tif( m_iRead + sizeof( T ) > m_iSize )\n\t{\n\t\tm_bBad = true;\n\n\t\t// may occur, but safe\n\t\t//gEngfuncs.Con_DPrintf( \"BufferReader(%s): buffer overrun. Expected %i\\n\", m_szMsgName, m_iSize );\n\t\treturn -1;\n\t}\n\n\tif( sizeof( T ) == 1 )\n\t\treturn m_pBuf[m_iRead++];\n\n\t// T t = *(T*)(m_pBuf + m_iRead);\n\tT t;\n\tmemcpy( &t, m_pBuf + m_iRead, sizeof( T ) );\n\tm_iRead += sizeof( T );\n\n\treturn t;\n}\n\n\ntemplate<>\ninline char* BufferReader::Read( void )\n{\n\tstatic char string[2048];\n\n\tif( m_bBad )\n\t\treturn (char*)\"\"; // do not return NULL, may break strcpy's\n\n\tsize_t l;\n\tfor( l = 0; l < sizeof(string) - 1; l++)\n\t{\n\t\tif( m_iRead > m_iSize )\n\t\t\tbreak;\n\n\t\tint8_t c = ReadChar();\n\t\tif( c == -1 || c == 0 )\n\t\t\tbreak;\n\n\t\tstring[l] = c;\n\t}\n\n\tstring[l] = 0;\n\n\treturn string;\n\n}\n\ntemplate<>\ninline float BufferReader::Read( void )\n{\n\tunion\n\t{\n\t\tunsigned char b[4];\n\t\tfloat f;\n\t} tr;\n\n\tif( m_bBad )\n\t\treturn -1.0f;\n\n\tif( m_iRead + 4 > m_iSize )\n\t{\n\t\tm_bBad = true;\n\t\treturn -1.0f;\n\t}\n\n\tfor( int i = 0; i < 4; i++ )\n\t\ttr.b[i] = m_pBuf[m_iRead + i];\n\n\tm_iRead += 4;\n\n\treturn tr.f;\n}\n\ninline int8_t BufferReader::ReadChar( void )\n{\n\treturn Read<int8_t>();\n}\n\ninline uint8_t BufferReader::ReadByte( void )\n{\n\treturn Read<uint8_t>();\n}\n\ninline int16_t BufferReader::ReadShort( void )\n{\n\treturn Read<int16_t>();\n}\n\ninline int16_t BufferReader::ReadWord( void )\n{\n\treturn ReadShort();\n}\n\ninline int32_t BufferReader::ReadLong( void )\n{\n\treturn Read<int32_t>();\n}\n\ninline char *BufferReader::ReadString( void )\n{\n\treturn Read<char*>();\n}\n\ninline float BufferReader::ReadFloat( void )\n{\n\treturn Read<float>();\n}\n\ninline float BufferReader::ReadCoord( void )\n{\n\treturn ReadShort() * 0.125f;\n}\n\ninline Vector BufferReader::ReadCoordVector( void )\n{\n\tVector v;\n\tv.x = ReadCoord();\n\tv.y = ReadCoord();\n\tv.z = ReadCoord();\n\n\treturn v;\n}\n\ninline float BufferReader::ReadAngle( void )\n{\n\treturn ReadChar() * 360.0f / 256.0f;\n}\n\ninline float BufferReader::ReadHiResAngle( void )\n{\n\treturn ReadShort() * 360.0f / 65536.0f;\n}\n\n#ifdef _DEBUG\nBufferReader::~BufferReader()\n{\n\t//if( m_iRead < m_iSize - 1 )\n\t//\tgEngfuncs.Con_DPrintf( \"BufferReader(%s): destroyed before reaching end. Expected %i, read %i\\n\", m_szMsgName, m_iSize, m_iRead );\n}\n#endif\n"
  },
  {
    "path": "cl_dll/include/rain.h",
    "content": "/***\n*\n*\tCopyright (c) 1996-2004, Shambler Team. All rights reserved.\n*\t\n*\tThis product contains software technology licensed from Id \n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc. \n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Shambler Team.  All other use, distribution, or modification is prohibited\n*   without written permission from Shambler Team.\n*\n****/\n/*\n====== rain.h ========================================================\n*/\n#pragma once\n#ifndef __RAIN_H__\n#define __RAIN_H__\n\nvoid ProcessRain( void );\nvoid ProcessFXObjects( void );\nvoid ResetRain( void );\nvoid InitRain( void );\nvoid DrawRain( void );\nvoid DrawFXObjects( void );\n\n#endif\n"
  },
  {
    "path": "cl_dll/include/studio/StudioModelRenderer.h",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\n*\tThis product contains software technology licensed from Id\n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc.\n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n\n// Big thanks to Chicken Fortress developers\n// for this code.\n#pragma once\n#ifndef STUDIOMODELRENDERER_H\n#define STUDIOMODELRENDERER_H\n\n#include \"studio.h\"\n#include \"com_model.h\"\n\nclass CStudioModelRenderer\n{\npublic:\n\tCStudioModelRenderer(void);\n\tvirtual ~CStudioModelRenderer(void);\n\npublic:\n\tvirtual void Init(void);\n\tvirtual int StudioDrawModel(int flags);\n\tvirtual int StudioDrawPlayer(int flags, struct entity_state_s *pplayer);\n\npublic:\n\tvirtual mstudioanim_t *StudioGetAnim(model_t *pSubModel, mstudioseqdesc_t *pseqdesc);\n\tvirtual void StudioSetUpTransform(int trivial_accept);\n\tvirtual void StudioSetupBones(void);\n\tvirtual void StudioCalcAttachments(void);\n\tvirtual void StudioSaveBones(void);\n\tvirtual void StudioMergeBones(model_t *pSubModel);\n\tvirtual float StudioEstimateInterpolant(void);\n\tvirtual float StudioEstimateFrame(mstudioseqdesc_t *pseqdesc);\n\tvirtual void StudioFxTransform(cl_entity_t *ent, float transform[3][4]);\n\tvirtual void StudioSlerpBones(vec4_t q1[], float pos1[][3], vec4_t q2[], float pos2[][3], float s);\n\tvirtual void StudioCalcBoneAdj(float dadt, float *adj, const byte *pcontroller1, const byte *pcontroller2, byte mouthopen);\n\tvirtual void StudioCalcBoneQuaterion(int frame, float s, mstudiobone_t *pbone, mstudioanim_t *panim, float *adj, float *q);\n\tvirtual void StudioCalcBonePosition(int frame, float s, mstudiobone_t *pbone, mstudioanim_t *panim, float *adj, float *pos);\n\tvirtual void StudioCalcRotations(float pos[][3], vec4_t *q, mstudioseqdesc_t *pseqdesc, mstudioanim_t *panim, float f);\n\tvirtual void StudioRenderModel(float *lightdir);\n\tvirtual void StudioRenderFinal(void);\n\tvirtual void StudioRenderFinal_Software(void);\n\tvirtual void StudioRenderFinal_Hardware(void);\n\tvirtual void StudioPlayerBlend(mstudioseqdesc_t *pseqdesc, int *pBlend, float *pPitch);\n\tvirtual void StudioEstimateGait(entity_state_t *pplayer);\n\tvirtual void StudioProcessGait(entity_state_t *pplayer);\n\tvirtual void StudioSetShadowSprite(int idx);\n\tvoid StudioDrawShadow(Vector origin, float scale);\n\n\npublic:\n\tdouble m_clTime;\n\tdouble m_clOldTime;\n\tint m_fDoInterp;\n\tint m_iShadowSprite;\n\tint m_fGaitEstimation;\n\tint m_nFrameCount;\n\tcvar_t *m_pCvarHiModels;\n\tcvar_t *m_pCvarDeveloper;\n\tcvar_t *m_pCvarDrawEntities;\n\tcvar_t *m_pCvarShadows;\n\tcvar_t *m_pCvarDebug;\n\tcl_entity_t *m_pCurrentEntity;\n\tmodel_t *m_pRenderModel;\n\tplayer_info_t *m_pPlayerInfo;\n\tint m_nPlayerIndex;\n\tfloat m_flGaitMovement;\n\tstudiohdr_t *m_pStudioHeader;\n\tmstudiobodyparts_t *m_pBodyPart;\n\tmstudiomodel_t *m_pSubModel;\n\tint m_nTopColor;\n\tint m_nBottomColor;\n\tmodel_t *m_pChromeSprite;\n\tint m_nCachedBones;\n\tchar m_nCachedBoneNames[MAXSTUDIOBONES][32];\n\tfloat m_rgCachedBoneTransform[MAXSTUDIOBONES][3][4];\n\tfloat m_rgCachedLightTransform[MAXSTUDIOBONES][3][4];\n\tfloat m_fSoftwareXScale, m_fSoftwareYScale;\n\tfloat m_vUp[3];\n\tfloat m_vRight[3];\n\tfloat m_vNormal[3];\n\tfloat m_vRenderOrigin[3];\n\tint *m_pStudioModelCount;\n\tint *m_pModelsDrawn;\n\tfloat (*m_protationmatrix)[3][4];\n\tfloat (*m_paliastransform)[3][4];\n\tfloat (*m_pbonetransform)[MAXSTUDIOBONES][3][4];\n\tfloat (*m_plighttransform)[MAXSTUDIOBONES][3][4];\n\tentity_state_t *m_pplayer;\n};\n\n#endif\n"
  },
  {
    "path": "cl_dll/include/studio/studio_util.h",
    "content": "//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============\n//\n// Purpose: \n//\n// $NoKeywords: $\n//=============================================================================\n#pragma once\n#if !defined( STUDIO_UTIL_H )\n#define STUDIO_UTIL_H\n\n\n#ifndef M_PI\n#define M_PI\t\t3.14159265358979323846\t// matches value in gcc v2 math.h\n#endif\n\n#ifndef PITCH\n// MOVEMENT INFO\n// up / down\n#define\tPITCH\t0\n// left / right\n#define\tYAW\t\t1\n// fall over\n#define\tROLL\t2\n#endif\n\n#define FDotProduct( a, b ) (fabs((a[0])*(b[0])) + fabs((a[1])*(b[1])) + fabs((a[2])*(b[2])))\n\nvoid\tAngleMatrix (const float *angles, float (*matrix)[4] );\nint\t\tVectorCompare (const float *v1, const float *v2);\nvoid\tCrossProduct (const float *v1, const float *v2, float *cross);\nvoid\tVectorTransform( const float *in1, float ( *in2 )[4], float *out );\nvoid\tConcatTransforms (float in1[3][4], float in2[3][4], float out[3][4]);\n#define MatrixCopy( in, out ) memcpy( ( out ), ( in ), sizeof( float ) * 3 * 4 );\nvoid\tQuaternionMatrix( vec4_t quaternion, float (*matrix)[4] );\nvoid\tQuaternionSlerp( vec4_t p, vec4_t q, float t, vec4_t qt );\nvoid\tAngleQuaternion( float *angles, vec4_t quaternion );\n\n#endif // STUDIO_UTIL_H\n"
  },
  {
    "path": "cl_dll/include/tf_defs.h",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\t\n*\tThis product contains software technology licensed from Id \n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc. \n*\tAll Rights Reserved.\n*\n****/\n\n#ifndef __TF_DEFS_H\n#define __TF_DEFS_H\n\n//===========================================================================\n// OLD OPTIONS.QC\n//===========================================================================\n#define DEFAULT_AUTOZOOM\t\t FALSE\n#define WEINER_SNIPER                           // autoaiming for sniper rifle\n#define FLAME_MAXWORLDNUM        20             // maximum number of flames in the world. DO NOT PUT BELOW 20.\n\n//#define MAX_WORLD_PIPEBOMBS      15             // This is divided between teams - this is the most you should have on a net server\n#define MAX_PLAYER_PIPEBOMBS\t 8\t\t\t\t// maximum number of pipebombs any 1 player can have active\n#define MAX_PLAYER_AMMOBOXES  3\t\t\t\t// maximum number of ammoboxes any 1 player can have active\n\n//#define MAX_WORLD_FLARES         9              // This is the total number of flares allowed in the world at one time\n//#define MAX_WORLD_AMMOBOXES      20             // This is divided between teams - this is the most you should have on a net server\n#define GR_TYPE_MIRV_NO          4              // Number of Mirvs a Mirv Grenade breaks into\n#define GR_TYPE_NAPALM_NO        8              // Number of flames napalm grenade breaks into (unused if net server)\n#define MEDIKIT_IS_BIOWEAPON\t\t\t\t\t// Medikit acts as a bioweapon against enemies\n\n#define TEAM_HELP_RATE   60     // used only if teamplay bit 64 (help team with lower score) is set.  \n\t\t\t\t\t\t\t\t// 60 is a mild setting, and won't make too much difference\n\t\t\t\t\t\t\t\t// increasing it _decreases_ the amount of help the losing team gets\n\t\t\t\t\t\t\t\t// Minimum setting is 1, which would really help the losing team\n\n#define DISPLAY_CLASS_HELP\t\t\tTRUE            // Change this to #OFF if you don't want the class help to \n\t\t\t\t\t\t\t\t\t\t\t\t\t// appear whenever a player connects\n#define NEVER_TEAMFRAGS\t\t\t\tFALSE\t\t\t// teamfrags options always off \n#define ALWAYS_TEAMFRAGS\t\t\tFALSE\t\t\t// teamfrags options always on \n#define CHECK_SPEEDS\t\t\t\tTRUE            // makes sure players aren't moving too fast\n#define SNIPER_RIFLE_RELOAD_TIME    1.5\t\t\t\t// seconds\n\n#define MAPBRIEFING_MAXTEXTLENGTH\t512\n#define PLAYER_PUSH_VELOCITY\t\t\t 50\t\t\t// Players push teammates if they're moving under this speed\n\n// Debug Options\n//#define MAP_DEBUG                     // Debug for Map code. I suggest running in a hi-res\n\t\t\t\t\t\t\t\t\t\t// mode and/or piping the output from the server to a file.\n#ifdef MAP_DEBUG\n\t#define MDEBUG(x) x\n#else\n\t#define MDEBUG(x)\n#endif\n//#define VERBOSE                       // Verbose Debugging on/off\n\n//===========================================================================\n// OLD QUAKE Defs\n//===========================================================================\n// items\n#define IT_AXE\t\t\t\t\t4096 \n#define IT_SHOTGUN\t\t\t\t1 \n#define IT_SUPER_SHOTGUN\t\t2 \n#define IT_NAILGUN\t\t\t\t4 \n#define IT_SUPER_NAILGUN\t\t8 \n#define IT_GRENADE_LAUNCHER\t\t16 \n#define IT_ROCKET_LAUNCHER\t\t32 \n#define IT_LIGHTNING\t\t\t64 \n#define IT_EXTRA_WEAPON\t\t\t128 \n\n#define IT_SHELLS\t\t\t\t256 \n#define IT_NAILS\t\t\t\t512 \n#define IT_ROCKETS\t\t\t\t1024 \n#define IT_CELLS\t\t\t\t2048 \n\n#define IT_ARMOR1\t\t\t\t8192 \n#define IT_ARMOR2\t\t\t\t16384 \n#define IT_ARMOR3\t\t\t\t32768 \n#define IT_SUPERHEALTH\t\t\t65536 \n\n#define IT_KEY1\t\t\t\t\t131072 \n#define IT_KEY2\t\t\t\t\t262144 \n\n#define IT_INVISIBILITY\t\t\t524288 \n#define IT_INVULNERABILITY\t\t1048576 \n#define IT_SUIT\t\t\t\t\t2097152\n#define IT_QUAD\t\t\t\t\t4194304 \n#define IT_HOOK\t\t\t\t\t8388608\n\n#define IT_KEY3\t\t\t\t\t16777216\t// Stomp invisibility\n#define IT_KEY4\t\t\t\t\t33554432\t// Stomp invulnerability\n\n//===========================================================================\n// TEAMFORTRESS Defs\n//===========================================================================\n// TeamFortress State Flags\n#define TFSTATE_GRENPRIMED\t\t1 \t// Whether the player has a primed grenade\n#define TFSTATE_RELOADING\t\t2 \t// Whether the player is reloading\n#define TFSTATE_ALTKILL\t\t\t4  \t// #TRUE if killed with a weapon not in self.weapon: NOT USED ANYMORE\n#define TFSTATE_RANDOMPC\t\t8   // Whether Playerclass is random, new one each respawn\n#define TFSTATE_INFECTED\t\t16 \t// set when player is infected by the bioweapon\n#define TFSTATE_INVINCIBLE\t\t32 \t// Player has permanent Invincibility (Usually by GoalItem)\n#define TFSTATE_INVISIBLE\t\t64 \t// Player has permanent Invisibility (Usually by GoalItem)\n#define TFSTATE_QUAD\t\t\t128 // Player has permanent Quad Damage (Usually by GoalItem)\n#define TFSTATE_RADSUIT\t\t\t256 // Player has permanent Radsuit (Usually by GoalItem)\n#define TFSTATE_BURNING\t\t\t512 // Is on fire\n#define TFSTATE_GRENTHROWING\t1024  // is throwing a grenade\n#define TFSTATE_AIMING\t\t\t2048  // is using the laser sight\n#define TFSTATE_ZOOMOFF\t\t\t4096  // doesn't want the FOV changed when zooming\n#define TFSTATE_RESPAWN_READY\t8192  // is waiting for respawn, and has pressed fire\n#define TFSTATE_HALLUCINATING  16384  // set when player is hallucinating\n#define TFSTATE_TRANQUILISED   32768  // set when player is tranquilised\n#define TFSTATE_CANT_MOVE\t   65536  // set when player is setting a detpack\n#define TFSTATE_RESET_FLAMETIME 131072 // set when the player has to have his flames increased in health\n\n// Defines used by TF_T_Damage (see combat.qc)\n#define TF_TD_IGNOREARMOUR\t1  // Bypasses the armour of the target\n#define TF_TD_NOTTEAM\t\t2  // Doesn't damage a team member (indicates direct fire weapon)\n#define TF_TD_NOTSELF\t\t4  // Doesn't damage self\n\n#define TF_TD_OTHER\t\t\t0  // Ignore armorclass\n#define TF_TD_SHOT\t\t\t1  // Bullet damage\n#define TF_TD_NAIL\t\t\t2  // Nail damage\n#define TF_TD_EXPLOSION\t\t4  // Explosion damage\n#define TF_TD_ELECTRICITY\t8  // Electric damage\n#define TF_TD_FIRE\t\t\t16  // Fire damage\n#define TF_TD_NOSOUND\t\t256 // Special damage. Makes no sound/painframe, etc\n\n/*==================================================*/\n/* Toggleable Game Settings\t\t\t\t\t\t\t*/\n/*==================================================*/\n#define TF_RESPAWNDELAY1\t5 \t// seconds of waiting before player can respawn\n#define TF_RESPAWNDELAY2\t10 \t// seconds of waiting before player can respawn\n#define TF_RESPAWNDELAY3\t20 \t// seconds of waiting before player can respawn\n\n#define TEAMPLAY_NORMAL\t\t\t 1\t\t\t\n#define TEAMPLAY_HALFDIRECT\t\t 2\n#define TEAMPLAY_NODIRECT\t\t 4\n#define TEAMPLAY_HALFEXPLOSIVE\t 8\n#define TEAMPLAY_NOEXPLOSIVE\t 16\n#define TEAMPLAY_LESSPLAYERSHELP 32\n#define TEAMPLAY_LESSSCOREHELP\t 64\n#define TEAMPLAY_HALFDIRECTARMOR 128\n#define TEAMPLAY_NODIRECTARMOR \t 256\n#define TEAMPLAY_HALFEXPARMOR\t 512\n#define TEAMPLAY_NOEXPARMOR\t\t 1024\n#define TEAMPLAY_HALFDIRMIRROR\t 2048\n#define TEAMPLAY_FULLDIRMIRROR\t 4096\n#define TEAMPLAY_HALFEXPMIRROR\t 8192\n#define TEAMPLAY_FULLEXPMIRROR\t 16384\n\n#define TEAMPLAY_TEAMDAMAGE\t\t(TEAMPLAY_NODIRECT | TEAMPLAY_HALFDIRECT | TEAMPLAY_HALFEXPLOSIVE | TEAMPLAY_NOEXPLOSIVE)\n// FortressMap stuff\n#define TEAM1_CIVILIANS 1\t\n#define TEAM2_CIVILIANS 2\n#define TEAM3_CIVILIANS 4\t\n#define TEAM4_CIVILIANS 8\t\n\n// Defines for the playerclass\n#define PC_UNDEFINED\t0 \n\n#define PC_SCOUT\t\t1 \n#define PC_SNIPER\t\t2 \n#define PC_SOLDIER\t\t3 \n#define PC_DEMOMAN\t\t4 \n#define PC_MEDIC\t\t5 \n#define PC_HVYWEAP\t\t6 \n#define PC_PYRO\t\t\t7\n#define PC_SPY\t\t\t8\n#define PC_ENGINEER\t\t9\n\n// Insert new class definitions here\n\n// PC_RANDOM _MUST_ be the third last class\n#define PC_RANDOM\t\t10 \t\t// Random playerclass\n#define PC_CIVILIAN\t\t11\t\t// Civilians are a special class. They cannot\n\t\t\t\t\t\t\t\t// be chosen by players, only enforced by maps\n#define PC_LASTCLASS\t12 \t\t// Use this as the high-boundary for any loops\n\t\t\t\t\t\t\t\t// through the playerclass.\n\n#define SENTRY_COLOR\t10\t\t// will be in the PC_RANDOM slot for team colors\n\n// These are just for the scanner\n#define SCAN_SENTRY\t\t13\n#define SCAN_GOALITEM\t14\n\n// Values returned by CheckArea\nenum\n{\n\tCAREA_CLEAR,\n\tCAREA_BLOCKED,\n\tCAREA_NOBUILD\n};\n\n/*==================================================*/\n/* Impulse Defines\t\t                        \t*/\n/*==================================================*/\n// Alias check to see whether they already have the aliases\n#define TF_ALIAS_CHECK\t\t13 \n\n// CTF Support Impulses\n#define HOOK_IMP1\t\t22\n#define FLAG_INFO\t\t23\n#define HOOK_IMP2\t\t39\n\n// Axe\n#define AXE_IMP\t\t\t40\n\n// Camera Impulse\n#define TF_CAM_TARGET\t\t\t50\n#define TF_CAM_ZOOM\t\t\t\t51\n#define TF_CAM_ANGLE\t\t\t52\n#define TF_CAM_VEC\t\t\t\t53\n#define TF_CAM_PROJECTILE\t\t54\n#define TF_CAM_PROJECTILE_Z\t\t55\n#define TF_CAM_REVANGLE\t\t\t56\n#define TF_CAM_OFFSET\t\t\t57\n#define TF_CAM_DROP\t\t\t\t58\t\n#define TF_CAM_FADETOBLACK\t\t59\n#define TF_CAM_FADEFROMBLACK\t60\n#define TF_CAM_FADETOWHITE\t\t61\n#define TF_CAM_FADEFROMWHITE\t62\n\n// Last Weapon impulse\n#define TF_LAST_WEAPON\t\t\t69\n\n// Status Bar Resolution Settings.  Same as CTF to maintain ease of use.\n#define TF_STATUSBAR_RES_START\t71\n#define TF_STATUSBAR_RES_END\t81\n\n// Clan Messages\n#define TF_MESSAGE_1\t\t\t82\n#define TF_MESSAGE_2\t\t\t83\n#define TF_MESSAGE_3\t\t\t84\n#define TF_MESSAGE_4\t\t\t85\n#define TF_MESSAGE_5\t\t\t86\n\n#define TF_CHANGE_CLASS\t\t\t99\t// Bring up the Class Change menu\n\n// Added to PC_??? to get impulse to use if this clashes with your \n// own impulses, just change this value, not the PC_??\n#define TF_CHANGEPC\t\t\t100 \n// The next few impulses are all the class selections\n//PC_SCOUT\t\t101 \n//PC_SNIPER\t\t102 \n//PC_SOLDIER\t103 \n//PC_DEMOMAN\t104 \n//PC_MEDIC\t\t105 \n//PC_HVYWEAP\t106 \n//PC_PYRO\t\t107 \n//PC_RANDOM\t\t108\n//PC_CIVILIAN\t109  // Cannot be used\n//PC_SPY\t\t110\n//PC_ENGINEER\t111\n\n// Help impulses\n#define TF_DISPLAYLOCATION  118\n#define TF_STATUS_QUERY\t\t119\n\n#define TF_HELP_MAP\t\t\t131\n\n// Information impulses\n#define TF_INVENTORY\t\t135\n#define TF_SHOWTF\t\t\t136 \n#define TF_SHOWLEGALCLASSES\t137\n\n// Team Impulses\n#define TF_TEAM_1\t\t\t140   // Join Team 1\n#define TF_TEAM_2\t\t\t141   // Join Team 2\n#define TF_TEAM_3\t\t\t142   // Join Team 3\n#define TF_TEAM_4\t\t\t143   // Join Team 4\n#define TF_TEAM_CLASSES\t\t144   // Impulse to display team classes\n#define TF_TEAM_SCORES\t\t145   // Impulse to display team scores\n#define TF_TEAM_LIST\t\t146   // Impulse to display the players in each team.\n\n// Grenade Impulses\n#define TF_GRENADE_1\t\t150   // Prime grenade type 1\n#define TF_GRENADE_2\t\t151   // Prime grenade type 2\n#define TF_GRENADE_T\t\t152   // Throw primed grenade\n\n// Impulses for new items\n//#define TF_SCAN\t\t\t\t159\t\t// Scanner Pre-Impulse\n#define TF_AUTO_SCAN\t\t159\t\t// Scanner On/Off\n#define TF_SCAN_ENEMY\t\t160\t\t// Impulses to toggle scanning of enemies\n#define TF_SCAN_FRIENDLY\t161\t\t// Impulses to toggle scanning of friendlies \n//#define TF_SCAN_10\t\t\t162\t\t// Scan using 10 enery (1 cell)\n#define TF_SCAN_SOUND\t\t162\t\t// Scanner sounds on/off\n#define TF_SCAN_30\t\t\t163\t\t// Scan using 30 energy (2 cells)\n#define TF_SCAN_100\t\t\t164\t\t// Scan using 100 energy (5 cells)\n#define TF_DETPACK_5\t\t165\t\t// Detpack set to 5 seconds\n#define TF_DETPACK_20\t\t166\t\t// Detpack set to 20 seconds\n#define TF_DETPACK_50\t\t167\t\t// Detpack set to 50 seconds\n#define TF_DETPACK\t\t\t168\t\t// Detpack Pre-Impulse\n#define TF_DETPACK_STOP\t\t169\t\t// Impulse to stop setting detpack\n#define TF_PB_DETONATE\t\t170\t\t// Detonate Pipebombs\n\n// Special skill\n#define TF_SPECIAL_SKILL\t171\n\n// Ammo Drop impulse\n#define TF_DROP_AMMO        172\n\n// Reload impulse\n#define TF_RELOAD\t\t\t173\n\n// auto-zoom toggle\n#define TF_AUTOZOOM\t\t\t174\n\n// drop/pass commands\n#define TF_DROPKEY\t\t\t175\n\n// Select Medikit\t\t\n#define TF_MEDIKIT\t\t\t176\n\n// Spy Impulses\n#define TF_SPY_SPY\t\t\t177\t\t// On net, go invisible, on LAN, change skin/color\n#define TF_SPY_DIE\t\t\t178\t\t// Feign Death\n\n// Engineer Impulses\n#define TF_ENGINEER_BUILD\t179\n#define TF_ENGINEER_SANDBAG\t180\n\n// Medic\n#define TF_MEDIC_HELPME\t\t181\n\n// Status bar\n#define TF_STATUSBAR_ON\t\t182\n#define TF_STATUSBAR_OFF\t183\n\n// Discard impulse\n#define TF_DISCARD \t  \t\t184\n\n// ID Player impulse\n#define TF_ID\t \t  \t\t185\n\n// Clan Battle impulses\n#define TF_SHOWIDS\t\t\t186\n\n// More Engineer Impulses\n#define TF_ENGINEER_DETDISP 187\n#define TF_ENGINEER_DETSENT 188\n\n// Admin Commands\n#define TF_ADMIN_DEAL_CYCLE\t\t189\n#define TF_ADMIN_KICK\t\t\t190\n#define TF_ADMIN_BAN\t\t\t191\n#define TF_ADMIN_COUNTPLAYERS\t192\n#define TF_ADMIN_CEASEFIRE\t\t193\n\n// Drop Goal Items\n#define TF_DROPGOALITEMS \t\t194\n\n// More Admin Commands\n#define TF_ADMIN_NEXT\t\t\t195\n\n// More Engineer Impulses\n#define TF_ENGINEER_DETEXIT \t196\n#define TF_ENGINEER_DETENTRANCE\t197\n\n// Yet MORE Admin Commands\n#define TF_ADMIN_LISTIPS\t\t198\n\n// Silent Spy Feign\n#define TF_SPY_SILENTDIE\t\t199\n\n\n/*==================================================*/\n/* Defines for the ENGINEER's Building ability\t\t*/\n/*==================================================*/\n// Ammo costs\n#define AMMO_COST_SHELLS\t\t2\t\t// Metal needed to make 1 shell\n#define AMMO_COST_NAILS\t\t\t1\n#define AMMO_COST_ROCKETS\t\t2\n#define AMMO_COST_CELLS\t\t\t2\n\n// Building types\n#define BUILD_DISPENSER\t\t\t\t1\n#define BUILD_SENTRYGUN\t\t\t\t2\n#define BUILD_MORTAR\t\t\t\t3\n#define BUILD_TELEPORTER_ENTRANCE\t4\n#define BUILD_TELEPORTER_EXIT\t\t5\n\n// Building metal costs\n#define BUILD_COST_DISPENSER\t100\t\t// Metal needed to built \n#define BUILD_COST_SENTRYGUN\t130\t\t\n#define BUILD_COST_MORTAR\t\t150\t\t\n#define BUILD_COST_TELEPORTER\t125\t\t\n\n#define BUILD_COST_SANDBAG\t\t20\t\t// Built with a separate alias\n\n// Building times\n#define BUILD_TIME_DISPENSER\t2\t\t// seconds to build\n#define BUILD_TIME_SENTRYGUN\t5\t\t\n#define BUILD_TIME_MORTAR\t\t5\t\t\n#define BUILD_TIME_TELEPORTER\t4\t\t\n\n// Building health levels\n#define BUILD_HEALTH_DISPENSER\t150\t\t// Health of the building\n#define BUILD_HEALTH_SENTRYGUN\t150\t\t\n#define BUILD_HEALTH_MORTAR\t\t200\t\t\n#define BUILD_HEALTH_TELEPORTER 80\n\n// Dispenser's maximum carrying capability\n#define BUILD_DISPENSER_MAX_SHELLS  400\n#define BUILD_DISPENSER_MAX_NAILS   600\n#define BUILD_DISPENSER_MAX_ROCKETS 300\n#define BUILD_DISPENSER_MAX_CELLS   400\n#define BUILD_DISPENSER_MAX_ARMOR   500\n\n// Build state sent down to client\n#define BS_BUILDING\t\t\t(1<<0)\n#define BS_HAS_DISPENSER\t(1<<1)\n#define BS_HAS_SENTRYGUN\t(1<<2)\n#define BS_CANB_DISPENSER\t(1<<3)\n#define BS_CANB_SENTRYGUN\t(1<<4)\n/*==================================================*/\n/* Ammo quantities for dropping & dispenser use\t\t*/\n/*==================================================*/\n#define DROP_SHELLS   20\n#define DROP_NAILS    20\n#define DROP_ROCKETS  10\n#define DROP_CELLS    10\n#define DROP_ARMOR\t  40\n\n/*==================================================*/\n/* Team Defines\t\t\t\t            \t\t\t*/\n/*==================================================*/\n#define TM_MAX_NO\t4 \t\t\t// Max number of teams. Simply changing this value isn't enough.\n\t\t\t\t\t\t\t\t// A new global to hold new team colors is needed, and more flags\n\t\t\t\t\t\t\t\t// in the spawnpoint spawnflags may need to be used.\n\t\t\t\t\t\t\t\t// Basically, don't change this unless you know what you're doing :)\n\n/*==================================================*/\n/* New Weapon Defines\t\t                        */\n/*==================================================*/\n#define WEAP_HOOK\t\t\t\t1\n#define WEAP_BIOWEAPON\t\t\t2\n#define WEAP_MEDIKIT\t\t\t4\n#define WEAP_SPANNER\t\t\t8\n#define WEAP_AXE\t\t\t\t16\n#define WEAP_SNIPER_RIFLE\t\t32\n#define WEAP_AUTO_RIFLE\t\t\t64\n#define WEAP_SHOTGUN\t\t\t128\n#define WEAP_SUPER_SHOTGUN\t\t256\n#define WEAP_NAILGUN\t\t\t512\n#define WEAP_SUPER_NAILGUN\t\t1024\n#define WEAP_GRENADE_LAUNCHER\t2048\n#define WEAP_FLAMETHROWER\t\t4096\n#define WEAP_ROCKET_LAUNCHER\t8192\n#define WEAP_INCENDIARY\t\t\t16384\n#define WEAP_ASSAULT_CANNON\t\t32768\n#define WEAP_LIGHTNING\t\t\t65536\n#define WEAP_DETPACK\t\t\t131072\n#define WEAP_TRANQ\t\t\t\t262144\n#define WEAP_LASER\t\t\t\t524288\n// still room for 12 more weapons\n// but we can remove some by giving the weapons\n// a weapon mode (like the rifle)\n\n// HL-compatible weapon numbers\n#define WEAPON_HOOK\t\t\t\t1\n#define WEAPON_BIOWEAPON\t\t(WEAPON_HOOK+1)\n#define WEAPON_MEDIKIT\t\t\t(WEAPON_HOOK+2)\n#define WEAPON_SPANNER\t\t\t(WEAPON_HOOK+3)\n#define WEAPON_AXE\t\t\t\t(WEAPON_HOOK+4)\n#define WEAPON_SNIPER_RIFLE\t\t(WEAPON_HOOK+5)\n#define WEAPON_AUTO_RIFLE\t\t(WEAPON_HOOK+6)\n#define WEAPON_TF_SHOTGUN\t\t(WEAPON_HOOK+7)\n#define WEAPON_SUPER_SHOTGUN\t(WEAPON_HOOK+8)\n#define WEAPON_NAILGUN\t\t\t(WEAPON_HOOK+9)\n#define WEAPON_SUPER_NAILGUN\t(WEAPON_HOOK+10)\n#define WEAPON_GRENADE_LAUNCHER\t(WEAPON_HOOK+11)\n#define WEAPON_FLAMETHROWER\t\t(WEAPON_HOOK+12)\n#define WEAPON_ROCKET_LAUNCHER\t(WEAPON_HOOK+13)\n#define WEAPON_INCENDIARY\t\t(WEAPON_HOOK+14)\n#define WEAPON_ASSAULT_CANNON\t(WEAPON_HOOK+16)\n#define WEAPON_LIGHTNING\t\t(WEAPON_HOOK+17)\n#define WEAPON_DETPACK\t\t\t(WEAPON_HOOK+18)\n#define WEAPON_TRANQ\t\t\t(WEAPON_HOOK+19)\n#define WEAPON_LASER\t\t\t(WEAPON_HOOK+20)\n#define WEAPON_PIPEBOMB_LAUNCHER (WEAPON_HOOK+21)\n#define WEAPON_KNIFE\t\t\t(WEAPON_HOOK+22)\n#define WEAPON_BENCHMARK\t\t(WEAPON_HOOK+23)\n\n/*==================================================*/\n/* New Weapon Related Defines\t\t                */\n/*==================================================*/\n// shots per reload \n#define RE_SHOTGUN\t\t\t8\n#define RE_SUPER_SHOTGUN\t16 // 8 shots\n#define RE_GRENADE_LAUNCHER\t6 \n#define RE_ROCKET_LAUNCHER\t4 \n\n// reload times\n#define RE_SHOTGUN_TIME\t\t\t\t2 \n#define RE_SUPER_SHOTGUN_TIME\t\t3 \n#define RE_GRENADE_LAUNCHER_TIME\t4 \n#define RE_ROCKET_LAUNCHER_TIME\t\t5 \n\n// Maximum velocity you can move and fire the Sniper Rifle\n#define WEAP_SNIPER_RIFLE_MAX_MOVE\t50 \n\n// Medikit\n#define WEAP_MEDIKIT_HEAL\t200  // Amount medikit heals per hit\n#define WEAP_MEDIKIT_OVERHEAL 50 // Amount of superhealth over max_health the medikit will dispense\n\n// Spanner\n#define WEAP_SPANNER_REPAIR 10\n\n// Detpack\n#define WEAP_DETPACK_DISARMTIME\t\t3   \t// Time it takes to disarm a Detpack\n#define WEAP_DETPACK_SETTIME\t\t3   \t// Time it takes to set a Detpack\n#define WEAP_DETPACK_SIZE\t\t\t700\t \t// Explosion Size\n#define WEAP_DETPACK_GOAL_SIZE\t\t1500 \t// Explosion Size for goal triggering\n#define WEAP_DETPACK_BITS_NO\t\t12  \t// Bits that detpack explodes into\n\n// Tranquiliser Gun\n#define TRANQ_TIME\t\t\t15\n\n// Grenades\n#define GR_PRIMETIME\t\t3\n#define GR_CALTROP_PRIME\t0.5\n#define GR_TYPE_NONE\t\t0 \n#define GR_TYPE_NORMAL\t\t1 \n#define GR_TYPE_CONCUSSION\t2 \n#define GR_TYPE_NAIL\t\t3 \n#define GR_TYPE_MIRV\t\t4 \n#define GR_TYPE_NAPALM\t\t5 \n//#define GR_TYPE_FLARE\t\t6 \n#define GR_TYPE_GAS\t\t\t7\n#define GR_TYPE_EMP\t\t\t8\n#define GR_TYPE_CALTROP\t\t9\n//#define GR_TYPE_FLASH\t\t10\n\n// Defines for WeaponMode\n#define GL_NORMAL\t0 \n#define GL_PIPEBOMB\t1\n\n// Defines for OLD Concussion Grenade\n#define GR_OLD_CONCUSS_TIME\t\t5 \n#define GR_OLD_CONCUSS_DEC\t\t20 \n\n// Defines for Concussion Grenade\n#define GR_CONCUSS_TIME\t\t0.25 \n#define GR_CONCUSS_DEC\t\t10\n#define MEDIUM_PING\t\t\t150\n#define HIGH_PING\t\t\t200\n\n// Defines for the Gas Grenade\n#define GR_HALLU_TIME\t\t0.3\n#define GR_OLD_HALLU_TIME\t0.5\n#define GR_HALLU_DEC\t\t2.5\n\n// Defines for the BioInfection\n#define BIO_JUMP_RADIUS 128\t\t// The distance the bioinfection can jump between players\n\n/*==================================================*/\n/* New Items\t\t\t                        \t*/\n/*==================================================*/\n#define NIT_SCANNER\t\t\t\t1 \n\n#define NIT_SILVER_DOOR_OPENED \t#IT_KEY1\t// 131072 \n#define NIT_GOLD_DOOR_OPENED \t#IT_KEY2\t// 262144\n\n/*==================================================*/\n/* New Item Flags\t\t                        \t*/\n/*==================================================*/\n#define NIT_SCANNER_ENEMY\t\t1 \t// Detect enemies\n#define NIT_SCANNER_FRIENDLY\t2 \t// Detect friendlies (team members)\n#define NIT_SCANNER_SOUND\t\t4 \t// Motion detection. Only report moving entities.\n\n/*==================================================*/\n/* New Item Related Defines\t\t                    */\n/*==================================================*/\n#define NIT_SCANNER_POWER\t\t\t25\t// The amount of power spent on a scan with the scanner\n\t\t\t\t\t\t\t\t\t\t// is multiplied by this to get the scanrange.\n#define NIT_SCANNER_MAXCELL\t\t\t50 \t// The maximum number of cells than can be used in one scan\n#define NIT_SCANNER_MIN_MOVEMENT\t50 \t// The minimum velocity an entity must have to be detected\n\t\t\t\t\t\t\t\t\t\t// by scanners that only detect movement\n\n/*==================================================*/\n/* Variables used for New Weapons and Reloading     */\n/*==================================================*/\n// Armor Classes : Bitfields. Use the \"armorclass\" of armor for the Armor Type.\n#define AT_SAVESHOT\t\t\t1   // Kevlar  \t : Reduces bullet damage by 15%\n#define AT_SAVENAIL\t\t\t2   // Wood :) \t : Reduces nail damage by 15%\n#define AT_SAVEEXPLOSION\t4  \t// Blast   \t : Reduces explosion damage by 15%\n#define AT_SAVEELECTRICITY\t8 \t// Shock\t : Reduces electricity damage by 15%\n#define AT_SAVEFIRE\t\t\t16 \t// Asbestos\t : Reduces fire damage by 15%\n\n/*==========================================================================*/\n/* TEAMFORTRESS CLASS DETAILS\t\t\t\t\t\t\t\t\t\t\t\t*/\n/*==========================================================================*/\n// Class Details for SCOUT\n#define PC_SCOUT_SKIN\t\t\t\t4 \t\t// Skin for this class when Classkin is on.\n#define PC_SCOUT_MAXHEALTH\t\t\t75 \t\t// Maximum Health Level\n#define PC_SCOUT_MAXSPEED\t\t\t400\t\t// Maximum movement speed\n#define PC_SCOUT_MAXSTRAFESPEED\t\t400\t\t// Maximum strafing movement speed\n#define PC_SCOUT_MAXARMOR\t\t\t50 \t\t// Maximum Armor Level, of any armor class\n#define PC_SCOUT_INITARMOR\t\t\t25 \t\t// Armor level when respawned\n#define PC_SCOUT_MAXARMORTYPE\t\t0.3\t\t// Maximum level of Armor absorption\n#define PC_SCOUT_INITARMORTYPE\t\t0.3\t\t// Absorption Level of armor when respawned\n#define PC_SCOUT_ARMORCLASSES\t\t3 \t\t// #AT_SAVESHOT | #AT_SAVENAIL   \t\t<-Armor Classes allowed for this class\n#define PC_SCOUT_INITARMORCLASS\t\t0 \t\t// Armorclass worn when respawned\n#define PC_SCOUT_WEAPONS\t\t\tWEAP_AXE | WEAP_SHOTGUN | WEAP_NAILGUN\n#define PC_SCOUT_MAXAMMO_SHOT\t\t50 \t\t// Maximum amount of shot ammo this class can carry\n#define PC_SCOUT_MAXAMMO_NAIL\t\t200\t\t// Maximum amount of nail ammo this class can carry\n#define PC_SCOUT_MAXAMMO_CELL\t\t100\t\t// Maximum amount of cell ammo this class can carry\n#define PC_SCOUT_MAXAMMO_ROCKET\t\t25 \t\t// Maximum amount of rocket ammo this class can carry\n#define PC_SCOUT_INITAMMO_SHOT\t\t25 \t\t// Amount of shot ammo this class has when respawned\n#define PC_SCOUT_INITAMMO_NAIL\t\t100\t\t// Amount of nail ammo this class has when respawned\n#define PC_SCOUT_INITAMMO_CELL\t\t50 \t\t// Amount of cell ammo this class has when respawned\n#define PC_SCOUT_INITAMMO_ROCKET\t0 \t\t// Amount of rocket ammo this class has when respawned\n#define PC_SCOUT_GRENADE_TYPE_1\t\tGR_TYPE_CALTROP\t\t\t //    <- 1st Type of Grenade this class has\n#define PC_SCOUT_GRENADE_TYPE_2\t\tGR_TYPE_CONCUSSION      //    <- 2nd Type of Grenade this class has\n#define PC_SCOUT_GRENADE_INIT_1\t\t2 \t\t// Number of grenades of Type 1 this class has when respawned\n#define PC_SCOUT_GRENADE_INIT_2\t\t3 \t\t// Number of grenades of Type 2 this class has when respawned\n#define PC_SCOUT_TF_ITEMS\t\t\tNIT_SCANNER  // <- TeamFortress Items this class has\n\n#define PC_SCOUT_MOTION_MIN_I\t\t0.5 \t// < Short range\n#define PC_SCOUT_MOTION_MIN_MOVE\t50 \t\t// Minimum vlen of player velocity to be picked up by motion detector\n#define PC_SCOUT_SCAN_TIME\t\t\t2\t\t// # of seconds between each scan pulse\n#define PC_SCOUT_SCAN_RANGE\t\t\t100\t\t// Default scanner range\n#define PC_SCOUT_SCAN_COST\t\t\t2\t\t// Default scanner cell usage per scan\n\n// Class Details for SNIPER\n#define PC_SNIPER_SKIN\t\t\t\t5 \n#define PC_SNIPER_MAXHEALTH\t\t\t90 \n#define PC_SNIPER_MAXSPEED\t\t\t300 \t\t\n#define PC_SNIPER_MAXSTRAFESPEED\t300 \n#define PC_SNIPER_MAXARMOR\t\t\t50 \n#define PC_SNIPER_INITARMOR\t\t\t0 \n#define PC_SNIPER_MAXARMORTYPE\t\t0.3 \n#define PC_SNIPER_INITARMORTYPE\t\t0.3 \n#define PC_SNIPER_ARMORCLASSES\t\t3 \t\t// #AT_SAVESHOT | #AT_SAVENAIL\n#define PC_SNIPER_INITARMORCLASS\t0 \n#define PC_SNIPER_WEAPONS\t\t\tWEAP_SNIPER_RIFLE | WEAP_AUTO_RIFLE | WEAP_AXE | WEAP_NAILGUN\n#define PC_SNIPER_MAXAMMO_SHOT\t\t75 \n#define PC_SNIPER_MAXAMMO_NAIL\t\t100 \n#define PC_SNIPER_MAXAMMO_CELL\t\t50 \n#define PC_SNIPER_MAXAMMO_ROCKET\t25 \n#define PC_SNIPER_INITAMMO_SHOT\t\t60 \n#define PC_SNIPER_INITAMMO_NAIL\t\t50 \n#define PC_SNIPER_INITAMMO_CELL\t\t0 \n#define PC_SNIPER_INITAMMO_ROCKET\t0 \n#define PC_SNIPER_GRENADE_TYPE_1\tGR_TYPE_NORMAL\n#define PC_SNIPER_GRENADE_TYPE_2\tGR_TYPE_NONE\n#define PC_SNIPER_GRENADE_INIT_1\t2 \t \n#define PC_SNIPER_GRENADE_INIT_2\t0\n#define PC_SNIPER_TF_ITEMS\t\t\t0 \n\n// Class Details for SOLDIER\n#define PC_SOLDIER_SKIN\t\t\t\t6 \t\t\t\n#define PC_SOLDIER_MAXHEALTH\t\t100\t \n#define PC_SOLDIER_MAXSPEED\t\t\t240 \n#define PC_SOLDIER_MAXSTRAFESPEED\t240 \n#define PC_SOLDIER_MAXARMOR\t\t\t200 \n#define PC_SOLDIER_INITARMOR\t\t100 \n#define PC_SOLDIER_MAXARMORTYPE\t\t0.8 \n#define PC_SOLDIER_INITARMORTYPE\t0.8 \n#define PC_SOLDIER_ARMORCLASSES\t\t31 \t\t// ALL\n#define PC_SOLDIER_INITARMORCLASS\t0 \n#define PC_SOLDIER_WEAPONS\t\t \tWEAP_AXE | WEAP_SHOTGUN | WEAP_SUPER_SHOTGUN | WEAP_ROCKET_LAUNCHER\n#define PC_SOLDIER_MAXAMMO_SHOT\t\t100 \n#define PC_SOLDIER_MAXAMMO_NAIL\t\t100 \n#define PC_SOLDIER_MAXAMMO_CELL\t\t50 \n#define PC_SOLDIER_MAXAMMO_ROCKET\t50 \n#define PC_SOLDIER_INITAMMO_SHOT\t50 \n#define PC_SOLDIER_INITAMMO_NAIL\t0 \n#define PC_SOLDIER_INITAMMO_CELL\t0 \n#define PC_SOLDIER_INITAMMO_ROCKET\t10 \n#define PC_SOLDIER_GRENADE_TYPE_1\tGR_TYPE_NORMAL\n#define PC_SOLDIER_GRENADE_TYPE_2\tGR_TYPE_NAIL\n#define PC_SOLDIER_GRENADE_INIT_1\t2\n#define PC_SOLDIER_GRENADE_INIT_2\t1 \t \n#define PC_SOLDIER_TF_ITEMS\t\t\t0 \n\n#define MAX_NAIL_GRENS\t\t\t\t2\t// Can only have 2 Nail grens active\n#define MAX_NAPALM_GRENS\t\t\t2\t// Can only have 2 Napalm grens active\n#define MAX_GAS_GRENS\t\t\t\t2\t// Can only have 2 Gas grenades active\n#define MAX_MIRV_GRENS\t\t\t\t2\t// Can only have 2 Mirv's\n#define MAX_CONCUSSION_GRENS\t\t3\n#define MAX_CALTROP_CANS\t\t\t3\n\n// Class Details for DEMOLITION MAN\n#define PC_DEMOMAN_SKIN\t\t\t\t1 \n#define PC_DEMOMAN_MAXHEALTH\t\t90 \n#define PC_DEMOMAN_MAXSPEED\t\t\t280 \t\t\n#define PC_DEMOMAN_MAXSTRAFESPEED\t280 \n#define PC_DEMOMAN_MAXARMOR\t\t\t120 \n#define PC_DEMOMAN_INITARMOR\t\t50 \n#define PC_DEMOMAN_MAXARMORTYPE\t\t0.6 \n#define PC_DEMOMAN_INITARMORTYPE\t0.6 \n#define PC_DEMOMAN_ARMORCLASSES\t\t31 \t\t// ALL\n#define PC_DEMOMAN_INITARMORCLASS\t0 \t\t\n#define PC_DEMOMAN_WEAPONS\t\t\tWEAP_AXE | WEAP_SHOTGUN | WEAP_GRENADE_LAUNCHER | WEAP_DETPACK\n#define PC_DEMOMAN_MAXAMMO_SHOT\t\t75 \n#define PC_DEMOMAN_MAXAMMO_NAIL\t\t50 \n#define PC_DEMOMAN_MAXAMMO_CELL\t\t50 \n#define PC_DEMOMAN_MAXAMMO_ROCKET\t50 \n#define PC_DEMOMAN_MAXAMMO_DETPACK\t1 \n#define PC_DEMOMAN_INITAMMO_SHOT\t30 \n#define PC_DEMOMAN_INITAMMO_NAIL\t0 \n#define PC_DEMOMAN_INITAMMO_CELL\t0 \n#define PC_DEMOMAN_INITAMMO_ROCKET\t20 \n#define PC_DEMOMAN_INITAMMO_DETPACK\t1 \n#define PC_DEMOMAN_GRENADE_TYPE_1\tGR_TYPE_NORMAL\n#define PC_DEMOMAN_GRENADE_TYPE_2\tGR_TYPE_MIRV\n#define PC_DEMOMAN_GRENADE_INIT_1\t2\n#define PC_DEMOMAN_GRENADE_INIT_2\t2 \t \n#define PC_DEMOMAN_TF_ITEMS\t\t\t0 \n\n// Class Details for COMBAT MEDIC\n#define PC_MEDIC_SKIN\t\t\t\t3 \n#define PC_MEDIC_MAXHEALTH\t\t\t90 \n#define PC_MEDIC_MAXSPEED\t\t\t320 \n#define PC_MEDIC_MAXSTRAFESPEED\t\t320 \n#define PC_MEDIC_MAXARMOR\t\t\t100\n#define PC_MEDIC_INITARMOR\t\t\t50 \n#define PC_MEDIC_MAXARMORTYPE\t\t0.6 \n#define PC_MEDIC_INITARMORTYPE\t\t0.3 \n#define PC_MEDIC_ARMORCLASSES\t\t11 \t\t// ALL except EXPLOSION\n#define PC_MEDIC_INITARMORCLASS\t\t0 \n#define PC_MEDIC_WEAPONS\t\t\tWEAP_BIOWEAPON | WEAP_MEDIKIT | WEAP_SHOTGUN | WEAP_SUPER_SHOTGUN | WEAP_SUPER_NAILGUN\n#define PC_MEDIC_MAXAMMO_SHOT\t\t75 \n#define PC_MEDIC_MAXAMMO_NAIL\t\t150 \n#define PC_MEDIC_MAXAMMO_CELL\t\t50 \n#define PC_MEDIC_MAXAMMO_ROCKET\t\t25 \n#define PC_MEDIC_MAXAMMO_MEDIKIT\t100 \n#define PC_MEDIC_INITAMMO_SHOT\t\t50 \n#define PC_MEDIC_INITAMMO_NAIL\t\t50 \n#define PC_MEDIC_INITAMMO_CELL\t\t0 \n#define PC_MEDIC_INITAMMO_ROCKET\t0 \n#define PC_MEDIC_INITAMMO_MEDIKIT\t50 \n#define PC_MEDIC_GRENADE_TYPE_1\t\tGR_TYPE_NORMAL\n#define PC_MEDIC_GRENADE_TYPE_2\t\tGR_TYPE_CONCUSSION\n#define PC_MEDIC_GRENADE_INIT_1\t\t2\n#define PC_MEDIC_GRENADE_INIT_2\t\t2 \t \n#define PC_MEDIC_TF_ITEMS\t\t\t0 \n#define PC_MEDIC_REGEN_TIME\t\t\t3   // Number of seconds between each regen.\n#define PC_MEDIC_REGEN_AMOUNT\t\t2 \t// Amount of health regenerated each regen.\n\n// Class Details for HVYWEAP\n#define PC_HVYWEAP_SKIN\t\t\t\t2 \n#define PC_HVYWEAP_MAXHEALTH\t\t100 \n#define PC_HVYWEAP_MAXSPEED\t\t\t230\t\t\n#define PC_HVYWEAP_MAXSTRAFESPEED\t230\n#define PC_HVYWEAP_MAXARMOR\t\t\t300 \n#define PC_HVYWEAP_INITARMOR\t\t150 \n#define PC_HVYWEAP_MAXARMORTYPE\t\t0.8 \n#define PC_HVYWEAP_INITARMORTYPE\t0.8 \n#define PC_HVYWEAP_ARMORCLASSES\t\t31 \t\t\t// ALL\n#define PC_HVYWEAP_INITARMORCLASS\t0 \t\t\n#define PC_HVYWEAP_WEAPONS\t\t\tWEAP_ASSAULT_CANNON | WEAP_AXE | WEAP_SHOTGUN | WEAP_SUPER_SHOTGUN\n#define PC_HVYWEAP_MAXAMMO_SHOT\t\t200 \n#define PC_HVYWEAP_MAXAMMO_NAIL\t\t200 \n#define PC_HVYWEAP_MAXAMMO_CELL\t\t50 \n#define PC_HVYWEAP_MAXAMMO_ROCKET\t25 \n#define PC_HVYWEAP_INITAMMO_SHOT\t200 \n#define PC_HVYWEAP_INITAMMO_NAIL\t0 \n#define PC_HVYWEAP_INITAMMO_CELL\t30 \n#define PC_HVYWEAP_INITAMMO_ROCKET\t0 \n#define PC_HVYWEAP_GRENADE_TYPE_1\tGR_TYPE_NORMAL\n#define PC_HVYWEAP_GRENADE_TYPE_2\tGR_TYPE_MIRV\n#define PC_HVYWEAP_GRENADE_INIT_1\t2\n#define PC_HVYWEAP_GRENADE_INIT_2\t1 \t \n#define PC_HVYWEAP_TF_ITEMS\t\t\t0 \n#define PC_HVYWEAP_CELL_USAGE\t\t7\t// Amount of cells spent to power up assault cannon\n\n\n\n// Class Details for PYRO\n#define PC_PYRO_SKIN\t\t\t21 \n#define PC_PYRO_MAXHEALTH\t\t100 \n#define PC_PYRO_MAXSPEED\t\t300 \n#define PC_PYRO_MAXSTRAFESPEED\t300\n#define PC_PYRO_MAXARMOR\t\t150 \n#define PC_PYRO_INITARMOR\t\t50 \n#define PC_PYRO_MAXARMORTYPE\t0.6 \n#define PC_PYRO_INITARMORTYPE\t0.6 \n#define PC_PYRO_ARMORCLASSES\t27 \t\t// ALL except EXPLOSION\n#define PC_PYRO_INITARMORCLASS\t16  \t// #AT_SAVEFIRE\n#define PC_PYRO_WEAPONS\t\t\tWEAP_INCENDIARY | WEAP_FLAMETHROWER | WEAP_AXE | WEAP_SHOTGUN\n#define PC_PYRO_MAXAMMO_SHOT\t40 \n#define PC_PYRO_MAXAMMO_NAIL\t50 \n#define PC_PYRO_MAXAMMO_CELL\t200 \n#define PC_PYRO_MAXAMMO_ROCKET\t20 \n#define PC_PYRO_INITAMMO_SHOT\t20 \n#define PC_PYRO_INITAMMO_NAIL\t0 \n#define PC_PYRO_INITAMMO_CELL\t120 \n#define PC_PYRO_INITAMMO_ROCKET\t5 \n#define PC_PYRO_GRENADE_TYPE_1\tGR_TYPE_NORMAL\n#define PC_PYRO_GRENADE_TYPE_2\tGR_TYPE_NAPALM\n#define PC_PYRO_GRENADE_INIT_1\t2\n#define PC_PYRO_GRENADE_INIT_2\t4 \t \n#define PC_PYRO_TF_ITEMS\t\t0\n#define PC_PYRO_ROCKET_USAGE\t3\t// Number of rockets per incendiary cannon shot\n\n// Class Details for SPY\n#define PC_SPY_SKIN\t\t\t\t22 \n#define PC_SPY_MAXHEALTH\t\t90 \n#define PC_SPY_MAXSPEED\t\t\t300 \n#define PC_SPY_MAXSTRAFESPEED\t300 \n#define PC_SPY_MAXARMOR\t\t\t100 \n#define PC_SPY_INITARMOR\t\t25 \n#define PC_SPY_MAXARMORTYPE\t\t0.6\t\t// Was 0.3 \n#define PC_SPY_INITARMORTYPE\t0.6\t\t// Was 0.3\n#define PC_SPY_ARMORCLASSES\t\t27 \t\t// ALL except EXPLOSION\n#define PC_SPY_INITARMORCLASS\t0  \n#define PC_SPY_WEAPONS\t\t\tWEAP_AXE | WEAP_TRANQ | WEAP_SUPER_SHOTGUN | WEAP_NAILGUN\n#define PC_SPY_MAXAMMO_SHOT\t\t40 \n#define PC_SPY_MAXAMMO_NAIL\t\t100 \n#define PC_SPY_MAXAMMO_CELL\t\t30 \n#define PC_SPY_MAXAMMO_ROCKET\t15 \n#define PC_SPY_INITAMMO_SHOT\t40 \n#define PC_SPY_INITAMMO_NAIL\t50 \n#define PC_SPY_INITAMMO_CELL\t10 \n#define PC_SPY_INITAMMO_ROCKET\t0 \n#define PC_SPY_GRENADE_TYPE_1\tGR_TYPE_NORMAL\n#define PC_SPY_GRENADE_TYPE_2\tGR_TYPE_GAS\n#define PC_SPY_GRENADE_INIT_1\t2 \t \n#define PC_SPY_GRENADE_INIT_2\t2 \t \n#define PC_SPY_TF_ITEMS\t\t\t0 \n#define PC_SPY_CELL_REGEN_TIME\t\t5\t\n#define PC_SPY_CELL_REGEN_AMOUNT\t1\n#define PC_SPY_CELL_USAGE\t\t\t3\t// Amount of cells spent while invisible\n#define PC_SPY_GO_UNDERCOVER_TIME\t4\t// Time it takes to go undercover\n\n// Class Details for ENGINEER\n#define PC_ENGINEER_SKIN\t\t\t22 \t\t// Not used anymore\n#define PC_ENGINEER_MAXHEALTH\t\t80 \n#define PC_ENGINEER_MAXSPEED\t\t300 \n#define PC_ENGINEER_MAXSTRAFESPEED\t300\n#define PC_ENGINEER_MAXARMOR\t\t50\n#define PC_ENGINEER_INITARMOR\t\t25 \n#define PC_ENGINEER_MAXARMORTYPE\t0.6 \n#define PC_ENGINEER_INITARMORTYPE\t0.3 \n#define PC_ENGINEER_ARMORCLASSES\t31 \t\t// ALL\n#define PC_ENGINEER_INITARMORCLASS\t0  \n#define PC_ENGINEER_WEAPONS\t\t\tWEAP_SPANNER | WEAP_LASER | WEAP_SUPER_SHOTGUN\n#define PC_ENGINEER_MAXAMMO_SHOT\t50\n#define PC_ENGINEER_MAXAMMO_NAIL\t50 \n#define PC_ENGINEER_MAXAMMO_CELL\t200\t\t// synonymous with metal \n#define PC_ENGINEER_MAXAMMO_ROCKET\t30 \n#define PC_ENGINEER_INITAMMO_SHOT\t20 \n#define PC_ENGINEER_INITAMMO_NAIL\t25 \n#define PC_ENGINEER_INITAMMO_CELL\t100 \t// synonymous with metal \n#define PC_ENGINEER_INITAMMO_ROCKET\t0 \n#define PC_ENGINEER_GRENADE_TYPE_1\tGR_TYPE_NORMAL\n#define PC_ENGINEER_GRENADE_TYPE_2\tGR_TYPE_EMP\n#define PC_ENGINEER_GRENADE_INIT_1\t2 \t \n#define PC_ENGINEER_GRENADE_INIT_2\t2 \t \n#define PC_ENGINEER_TF_ITEMS\t\t0 \n\n// Class Details for CIVILIAN\n#define PC_CIVILIAN_SKIN\t\t\t22 \n#define PC_CIVILIAN_MAXHEALTH\t\t50\n#define PC_CIVILIAN_MAXSPEED\t\t240\n#define PC_CIVILIAN_MAXSTRAFESPEED\t240\n#define PC_CIVILIAN_MAXARMOR\t\t0\n#define PC_CIVILIAN_INITARMOR\t\t0 \n#define PC_CIVILIAN_MAXARMORTYPE\t0\n#define PC_CIVILIAN_INITARMORTYPE\t0 \n#define PC_CIVILIAN_ARMORCLASSES\t0 \t\t\n#define PC_CIVILIAN_INITARMORCLASS\t0\n#define PC_CIVILIAN_WEAPONS\t\t\tWEAP_AXE\n#define PC_CIVILIAN_MAXAMMO_SHOT\t0\n#define PC_CIVILIAN_MAXAMMO_NAIL\t0 \n#define PC_CIVILIAN_MAXAMMO_CELL\t0 \n#define PC_CIVILIAN_MAXAMMO_ROCKET\t0 \n#define PC_CIVILIAN_INITAMMO_SHOT\t0 \n#define PC_CIVILIAN_INITAMMO_NAIL\t0 \n#define PC_CIVILIAN_INITAMMO_CELL\t0 \n#define PC_CIVILIAN_INITAMMO_ROCKET\t0 \n#define PC_CIVILIAN_GRENADE_TYPE_1\t0\n#define PC_CIVILIAN_GRENADE_TYPE_2\t0\n#define PC_CIVILIAN_GRENADE_INIT_1\t0 \t \n#define PC_CIVILIAN_GRENADE_INIT_2\t0 \t \n#define PC_CIVILIAN_TF_ITEMS\t\t0 \n\n\n/*==========================================================================*/\n/* TEAMFORTRESS GOALS\t\t\t\t\t\t\t\t\t\t\t\t\t\t*/\n/*==========================================================================*/\n// For all these defines, see the tfortmap.txt that came with the zip\n// for complete descriptions.\n// Defines for Goal Activation types : goal_activation (in goals)\n#define TFGA_TOUCH\t\t\t1  // Activated when touched\n#define TFGA_TOUCH_DETPACK\t2  // Activated when touched by a detpack explosion\n#define TFGA_REVERSE_AP\t\t4  // Activated when AP details are _not_ met\n#define TFGA_SPANNER\t\t8  // Activated when hit by an engineer's spanner\n#define TFGA_DROPTOGROUND\t2048 // Drop to Ground when spawning\n\n// Defines for Goal Effects types : goal_effect\n#define TFGE_AP\t\t\t\t  1  // AP is affected. Default.\n#define TFGE_AP_TEAM\t\t  2  // All of the AP's team.\n#define TFGE_NOT_AP_TEAM\t  4  // All except AP's team.\n#define TFGE_NOT_AP\t\t\t  8  // All except AP.\n#define TFGE_WALL\t\t\t  16 // If set, walls stop the Radius effects\n#define TFGE_SAME_ENVIRONMENT 32 // If set, players in a different environment to the Goal are not affected\n#define TFGE_TIMER_CHECK_AP\t  64 // If set, Timer Goals check their critera for all players fitting their effects\n\n// Defines for Goal Result types : goal_result\n#define TFGR_SINGLE\t\t\t\t1  // Goal can only be activated once\n#define TFGR_ADD_BONUSES\t\t2 \t// Any Goals activated by this one give their bonuses\n#define TFGR_ENDGAME\t\t\t4 \t// Goal fires Intermission, displays scores, and ends level\n#define TFGR_NO_ITEM_RESULTS\t8\t// GoalItems given by this Goal don't do results\n#define TFGR_REMOVE_DISGUISE\t16 // Prevent/Remove undercover from any Spy\n#define TFGR_FORCE_RESPAWN\t\t32 // Forces the player to teleport to a respawn point\n#define TFGR_DESTROY_BUILDINGS\t64 // Destroys this player's buildings, if anys\n\n// Defines for Goal Group Result types : goal_group\n// None!\n// But I'm leaving this variable in there, since it's fairly likely\n// that some will show up sometime.\n\n// Defines for Goal Item types, : goal_activation (in items)\n#define TFGI_GLOW\t\t\t1   // Players carrying this GoalItem will glow\n#define TFGI_SLOW\t\t\t2   // Players carrying this GoalItem will move at half-speed\n#define TFGI_DROP\t\t\t4   // Players dying with this item will drop it\n#define TFGI_RETURN_DROP\t8   // Return if a player with it dies\n#define TFGI_RETURN_GOAL\t16  // Return if a player with it has it removed by a goal's activation\n#define TFGI_RETURN_REMOVE\t32  // Return if it is removed by TFGI_REMOVE\n#define TFGI_REVERSE_AP\t\t64  // Only pickup if the player _doesn't_ match AP Details\n#define TFGI_REMOVE\t\t\t128 // Remove if left untouched for 2 minutes after being dropped\n#define TFGI_KEEP\t\t\t256 // Players keep this item even when they die\n#define TFGI_ITEMGLOWS\t\t512\t// Item glows when on the ground\n#define TFGI_DONTREMOVERES\t1024 // Don't remove results when the item is removed\n#define TFGI_DROPTOGROUND\t2048 // Drop To Ground when spawning\n#define TFGI_CANBEDROPPED\t4096 // Can be voluntarily dropped by players\n#define TFGI_SOLID\t\t\t8192 // Is solid... blocks bullets, etc\n\n// Defines for methods of GoalItem returning\n#define GI_RET_DROP_DEAD \t0\t\t// Dropped by a dead player\n#define GI_RET_DROP_LIVING \t1\t\t// Dropped by a living player\n#define GI_RET_GOAL\t\t\t2\t\t// Returned by a Goal\n#define GI_RET_TIME\t\t\t3\t\t// Returned due to timeout\n\n// Defines for TeamSpawnpoints : goal_activation (in teamspawns)\n#define TFSP_MULTIPLEITEMS\t1  // Give out the GoalItem multiple times\n#define TFSP_MULTIPLEMSGS\t2  // Display the message multiple times\n\n// Defines for TeamSpawnpoints : goal_effects (in teamspawns)\n#define TFSP_REMOVESELF\t\t1  // Remove itself after being spawned on\n\n// Defines for Goal States\n#define TFGS_ACTIVE\t\t1 \n#define TFGS_INACTIVE\t2 \n#define TFGS_REMOVED\t3 \n#define TFGS_DELAYED\t4\n\n// Defines for GoalItem Removing from Player Methods\n#define GI_DROP_PLAYERDEATH\t  0\t\t// Dropped by a dying player\n#define GI_DROP_REMOVEGOAL\t  1\t\t// Removed by a Goal\n#define GI_DROP_PLAYERDROP\t  2\t\t// Dropped by a player\n\n// Legal Playerclass Handling\n#define TF_ILL_SCOUT \t\t1\n#define TF_ILL_SNIPER\t\t2\n#define TF_ILL_SOLDIER\t\t4\n#define TF_ILL_DEMOMAN\t\t8\n#define TF_ILL_MEDIC\t\t16\n#define TF_ILL_HVYWEP\t\t32\n#define TF_ILL_PYRO\t\t\t64\n#define TF_ILL_RANDOMPC\t\t128\n#define TF_ILL_SPY\t\t\t256\n#define TF_ILL_ENGINEER\t\t512\n\n// Addition classes\n#define CLASS_TFGOAL\t\t\t\t\t128\n#define CLASS_TFGOAL_TIMER\t\t\t129\n#define CLASS_TFGOAL_ITEM\t\t\t130\n#define CLASS_TFSPAWN\t\t\t\t   131\n\n/*==========================================================================*/\n/* Flamethrower\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t*/\n/*==========================================================================*/\n#define FLAME_PLYRMAXTIME\t5.0 // lifetime in seconds of a flame on a player\n#define FLAME_MAXBURNTIME\t8  \t// lifetime in seconds of a flame on the world (big ones)\n#define NAPALM_MAXBURNTIME\t20 \t// lifetime in seconds of flame from a napalm grenade\n#define FLAME_MAXPLYRFLAMES\t4 \t// maximum number of flames on a player\n#define FLAME_NUMLIGHTS\t\t1 \t// maximum number of light flame \n#define FLAME_BURNRATIO\t\t0.3 // the chance of a flame not 'sticking'\n#define GR_TYPE_FLAMES_NO\t15 \t// number of flames spawned when a grenade explode\n#define FLAME_DAMAGE_TIME\t1\t// Interval between damage burns from flames\n#define FLAME_EFFECT_TIME\t0.2\t// frequency at which we display flame effects.\n#define FLAME_THINK_TIME\t0.1\t// Seconds between times the flame checks burn\n#define PER_FLAME_DAMAGE\t2\t// Damage taken per second per flame by burning players\n\n/*==================================================*/\n/* CTF Support defines \t\t\t\t\t\t\t\t*/\n/*==================================================*/\n#define CTF_FLAG1 \t\t1\n#define CTF_FLAG2 \t\t2\n#define CTF_DROPOFF1 \t3\n#define CTF_DROPOFF2 \t4\n#define CTF_SCORE1   \t5\n#define CTF_SCORE2   \t6\n\n//.float\thook_out;\n\n/*==================================================*/\n/* Camera defines\t \t\t\t\t\t\t\t\t*/\n/*==================================================*/\n/*\nfloat live_camera;\n.float camdist;\n.vector camangle;\n.entity camera_list;\n*/\n\n/*==================================================*/\n/* QuakeWorld defines \t\t\t\t\t\t\t\t*/\n/*==================================================*/\n/*\nfloat already_chosen_map;\n\n// grappling hook variables\n.entity\thook;\t\n.float\ton_hook;\n.float  fire_held_down;// flag - TRUE if player is still holding down the\n                       // fire button after throwing a hook.\n*/\n/*==================================================*/\n/* Server Settings\t\t\t\t\t\t\t\t    */\n/*==================================================*/\n// Admin modes\n#define ADMIN_MODE_NONE\t0\n#define ADMIN_MODE_DEAL\t1\n\n/*==================================================*/\n/* Death Message defines\t\t\t\t\t\t\t*/\n/*==================================================*/\n#define DMSG_SHOTGUN\t\t\t1\n#define DMSG_SSHOTGUN\t\t\t2\n#define DMSG_NAILGUN\t\t\t3\n#define DMSG_SNAILGUN\t\t\t4\n#define DMSG_GRENADEL\t\t\t5\n#define DMSG_ROCKETL\t\t\t6\n#define DMSG_LIGHTNING\t\t\t7\n#define DMSG_GREN_HAND\t\t\t8\n#define DMSG_GREN_NAIL\t\t\t9\n#define DMSG_GREN_MIRV\t\t\t10\n#define DMSG_GREN_PIPE\t\t\t11\n#define DMSG_DETPACK\t\t\t12\n#define DMSG_BIOWEAPON\t\t\t13\n#define DMSG_BIOWEAPON_ATT\t\t14\n#define DMSG_FLAME\t\t\t\t15\n#define DMSG_DETPACK_DIS\t\t16\n#define DMSG_AXE\t\t\t\t17\n#define DMSG_SNIPERRIFLE\t\t18\n#define DMSG_AUTORIFLE\t\t\t19\n#define DMSG_ASSAULTCANNON\t\t20\n#define DMSG_HOOK\t\t\t\t21\n#define DMSG_BACKSTAB\t\t\t22\n#define DMSG_MEDIKIT\t\t\t23\n#define DMSG_GREN_GAS\t\t\t24\n#define DMSG_TRANQ\t\t\t\t25\n#define DMSG_LASERBOLT\t\t\t26\n#define DMSG_SENTRYGUN_BULLET \t27\n#define DMSG_SNIPERLEGSHOT\t\t28\n#define DMSG_SNIPERHEADSHOT\t\t29\n#define DMSG_GREN_EMP\t\t\t30\n#define DMSG_GREN_EMP_AMMO\t\t31\n#define DMSG_SPANNER\t\t\t32\n#define DMSG_INCENDIARY\t\t\t33\n#define DMSG_SENTRYGUN_ROCKET\t34\n#define DMSG_GREN_FLASH\t\t\t35\n#define DMSG_TRIGGER\t\t\t36\n#define DMSG_MIRROR\t\t\t\t37\n#define DMSG_SENTRYDEATH\t\t38\n#define DMSG_DISPENSERDEATH\t\t39\n#define DMSG_GREN_AIRPIPE\t\t40\n#define DMSG_CALTROP\t\t\t41\n\n/*==================================================*/\n// TOGGLEFLAGS\n/*==================================================*/\n// Some of the toggleflags aren't used anymore, but the bits are still\n// there to provide compatibility with old maps\n#define TFLAG_CLASS_PERSIST\t\t\t(1 << 0)  \t\t// Persistent Classes Bit\n#define TFLAG_CHEATCHECK\t\t\t(1 << 1) \t\t// Cheatchecking Bit\n#define TFLAG_RESPAWNDELAY\t\t\t(1 << 2) \t\t// RespawnDelay bit\n//#define TFLAG_UN\t\t\t\t\t(1 << 3)\t\t// NOT USED ANYMORE\n#define TFLAG_OLD_GRENS\t\t\t\t(1 << 3)\t\t// Use old concussion grenade and flash grenade\n#define TFLAG_UN2\t\t\t\t\t(1 << 4)\t\t// NOT USED ANYMORE\n#define TFLAG_UN3\t\t\t\t\t(1 << 5)\t\t// NOT USED ANYMORE\n#define TFLAG_UN4\t\t\t\t\t(1 << 6)\t\t// NOT USED ANYMORE: Was Autoteam. CVAR tfc_autoteam used now.\n#define TFLAG_TEAMFRAGS\t\t\t\t(1 << 7)\t\t// Individual Frags, or Frags = TeamScore\n#define TFLAG_FIRSTENTRY\t\t\t(1 << 8)\t\t// Used to determine the first time toggleflags is set\n\t\t\t\t\t\t\t\t\t\t\t\t\t// In a map. Cannot be toggled by players.\n#define TFLAG_SPYINVIS\t\t\t\t(1 << 9)\t\t// Spy invisible only\n#define TFLAG_GRAPPLE\t\t\t\t(1 << 10)\t// Grapple on/off\n//#define TFLAG_FULLTEAMSCORE\t\t(1 << 11)  \t// Each Team's score is TeamScore + Frags\n#define TFLAG_FLAGEMULATION\t\t\t(1 << 12)  \t// Flag emulation on for old TF maps\n#define TFLAG_USE_STANDARD\t\t\t(1 << 13)  \t// Use the TF War standard for Flag emulation\n\n#define TFLAG_FRAGSCORING\t\t\t(1 << 14)\t// Use frag scoring only\n\n/*======================*/\n//      Menu stuff      //\n/*======================*/\n\n#define MENU_DEFAULT\t\t\t\t1\n#define MENU_TEAM \t\t\t\t\t2\n#define MENU_CLASS \t\t\t\t\t3\n#define MENU_MAPBRIEFING\t\t\t4\n#define MENU_INTRO \t\t\t\t\t5\n#define MENU_CLASSHELP\t\t\t\t6\n#define MENU_CLASSHELP2 \t\t\t7\n#define MENU_REPEATHELP \t\t\t8\n\n#define MENU_SPECHELP\t\t\t\t9\n\n\n#define MENU_SPY\t\t\t\t\t12\n#define MENU_SPY_SKIN\t\t\t\t13\n#define MENU_SPY_COLOR\t\t\t\t14\n#define MENU_ENGINEER\t\t\t\t15\n#define MENU_ENGINEER_FIX_DISPENSER\t16\n#define MENU_ENGINEER_FIX_SENTRYGUN\t17\n#define MENU_ENGINEER_FIX_MORTAR\t18\n#define MENU_DISPENSER\t\t\t\t19\n#define MENU_CLASS_CHANGE\t\t\t20\n#define MENU_TEAM_CHANGE\t\t\t21\n\n#define MENU_REFRESH_RATE \t\t\t25\n\n#define MENU_VOICETWEAK\t\t\t\t50\n\n//============================\n// Timer Types\n#define TF_TIMER_ANY\t\t\t\t0\n#define TF_TIMER_CONCUSSION\t\t\t1\n#define TF_TIMER_INFECTION\t\t\t2\n#define TF_TIMER_HALLUCINATION\t\t3\n#define TF_TIMER_TRANQUILISATION\t4\n#define TF_TIMER_ROTHEALTH\t\t\t5\n#define TF_TIMER_REGENERATION\t\t6\n#define TF_TIMER_GRENPRIME\t\t\t7\n#define TF_TIMER_CELLREGENERATION\t8\n#define TF_TIMER_DETPACKSET\t\t\t9\n#define TF_TIMER_DETPACKDISARM\t\t10\n#define TF_TIMER_BUILD\t\t\t\t11\n#define TF_TIMER_CHECKBUILDDISTANCE 12\n#define TF_TIMER_DISGUISE\t\t\t13\n#define TF_TIMER_DISPENSERREFILL\t14\n\n// Non Player timers\n#define TF_TIMER_RETURNITEM\t\t\t100\n#define TF_TIMER_DELAYEDGOAL\t\t101\n#define TF_TIMER_ENDROUND\t\t\t102\n\n//============================\n// Teamscore printing\n#define TS_PRINT_SHORT\t\t\t\t1\n#define TS_PRINT_LONG\t\t\t\t2\n#define TS_PRINT_LONG_TO_ALL\t\t3\n\n#ifndef TF_DEFS_ONLY\n\ntypedef struct\n{\n\tint topColor;\n\tint bottomColor;\n} team_color_t;\n\n\n/*==================================================*/\n/* GLOBAL VARIABLES\t\t\t\t\t\t\t\t\t*/\n/*==================================================*/\n// FortressMap stuff\nextern float number_of_teams;\t// number of teams supported by the map\nextern int   illegalclasses[5];\t// Illegal playerclasses for all teams\nextern int   civilianteams;\t\t// Bitfield holding Civilian teams\nextern Vector  rgbcolors[5];\t\t // RGB colors for each of the 4 teams\n\nextern team_color_t teamcolors[5][PC_LASTCLASS]; // Colors for each of the 4 teams\n\nextern int   teamscores[5];\t\t// Goal Score of each team\nextern int\t g_iOrderedTeams[5]; // Teams ordered into order of winners->losers\nextern int\t teamfrags[5];\t\t// Total Frags for each team\nextern int   teamlives[5];\t\t// Number of lives each team's players have\nextern int   teammaxplayers[5];\t// Max number of players allowed in each team\nextern float teamadvantage[5];\t// only used if the teamplay equalisation bits are set\n\t\t\t\t\t\t\t\t// stores the damage ratio players take/give\nextern int   teamallies[5];\t\t// Keeps track of which teams are allied\nextern string_t\tteam_names[5];\n\nextern BOOL  CTF_Map;\nextern BOOL  birthday;\nextern BOOL  christmas;\n\nextern float num_world_flames;\n\n// Clan Battle stuff\nextern float clan_scores_dumped;\nextern float cb_prematch_time;\nextern float fOldPrematch;\nextern float fOldCeaseFire;\nextern float cb_ceasefire_time;\nextern float last_id;\nextern float spy_off;\nextern float old_grens;\t\t\nextern float flagem_checked;\nextern float flNextEqualisationCalc;\nextern BOOL  cease_fire;\nextern BOOL  no_cease_fire_text;\nextern BOOL  initial_cease_fire;\nextern BOOL  last_cease_fire;\n// Autokick stuff\nextern float autokick_kills;\n\nextern float deathmsg;\t\t// Global, which is set before every T_Damage, to indicate\n\t\t\t\t\t\t\t// the death message that should be used.\n\nextern char *sTeamSpawnNames[];\nextern char *sClassNames[];\nextern char *sNewClassModelFiles[];\nextern char *sOldClassModelFiles[];\nextern char *sClassModels[];\nextern char *sClassCfgs[];\nextern char *sGrenadeNames[];\nextern string_t\tteam_menu_string;\t\n\nextern int toggleflags;\t\t\t\t\t// toggleable flags\n\nextern CBaseEntity* g_pLastSpawns[5];\nextern BOOL g_bFirstClient;\n\nextern float g_fNextPrematchAlert;\n\ntypedef struct\n{\n\tint\t\t\tip;\n\tedict_t\t*pEdict;\n} ip_storage_t;\n\nextern ip_storage_t g_IpStorage[32];\n\nclass CGhost;\n/*==========================================================================*/\nBOOL ClassIsRestricted(float tno, int pc);\nchar* GetTeamName(int tno);\nint TeamFortress_GetNoPlayers();\nvoid DestroyBuilding(CBaseEntity *eng, char *bld);\nvoid teamsprint( int tno, CBaseEntity *ignore, int msg_dest, const char *st, const char *param1 = NULL, const char *param2 = NULL, const char *param3 = NULL );\nfloat anglemod( float v );\n\n// Team Funcs\nBOOL TeamFortress_TeamIsCivilian(float tno);\nvoid TeamFortress_TeamShowScores(BOOL bLong, CBasePlayer *pPlayer);\nBOOL TeamFortress_TeamPutPlayerInTeam();\nvoid TeamFortress_TeamSetColor(int tno);\nvoid TeamFortress_TeamIncreaseScore(int tno, int scoretoadd);\nint TeamFortress_TeamGetScoreFrags(int tno);\nint TeamFortress_TeamGetNoPlayers(int tno);\nfloat TeamEqualiseDamage(CBaseEntity *targ, CBaseEntity *attacker, float damage);\nBOOL IsSpawnPointValid( Vector &pos );\nBOOL TeamFortress_SortTeams( void );\nvoid DumpClanScores( void );\nvoid CalculateTeamEqualiser();\n\n// mapscript funcs\nvoid ParseTFServerSettings();\nvoid ParseTFMapSettings();\nCBaseEntity* Finditem(int ino);\nCBaseEntity* Findgoal(int gno);\nCBaseEntity* Findteamspawn(int gno);\nvoid RemoveGoal(CBaseEntity *Goal);\nvoid tfgoalitem_GiveToPlayer(CBaseEntity *Item, CBasePlayer *AP, CBaseEntity *Goal);\nvoid dremove( CBaseEntity *te );\nvoid tfgoalitem_RemoveFromPlayer(CBaseEntity *Item, CBasePlayer *AP, int iMethod);\nvoid tfgoalitem_drop(CBaseEntity *Item, BOOL PAlive, CBasePlayer *P);\nvoid DisplayItemStatus(CBaseEntity *Goal, CBasePlayer *Player, CBaseEntity *Item);\nvoid tfgoalitem_checkgoalreturn(CBaseEntity *Item);\nvoid DoGoalWork(CBaseEntity *Goal, CBasePlayer *AP);\nvoid DoResults(CBaseEntity *Goal, CBasePlayer *AP, BOOL bAddBonuses);\nvoid DoGroupWork(CBaseEntity *Goal, CBasePlayer *AP);\n// hooks into the mapscript for all entities\nBOOL ActivateDoResults(CBaseEntity *Goal, CBasePlayer *AP, CBaseEntity *ActivatingGoal);\nBOOL ActivationSucceeded(CBaseEntity *Goal, CBasePlayer *AP, CBaseEntity *ActivatingGoal);\n\n// prematch & ceasefire\nvoid Display_Prematch();\nvoid Check_Ceasefire();\n\n// admin\nvoid KickPlayer( CBaseEntity *pTarget );\nvoid BanPlayer( CBaseEntity *pTarget );\nCGhost *FindGhost( int iGhostID );\nint GetBattleID( edict_t *pEntity );\n\nextern cvar_t\ttfc_spam_penalty1;// the initial gag penalty for a spammer (seconds)\nextern cvar_t\ttfc_spam_penalty2;// incremental gag penalty (seconds) for each time gagged spammer continues to speak.\nextern cvar_t\ttfc_spam_limit; // at this many points, gag the spammer\nextern cvar_t\ttfc_clanbattle, tfc_clanbattle_prematch, tfc_prematch, tfc_clanbattle_ceasefire, tfc_balance_teams, tfc_balance_scores;\nextern cvar_t   tfc_clanbattle_locked, tfc_birthday, tfc_autokick_kills, tfc_fragscoring, tfc_autokick_time, tfc_adminpwd;\nextern cvar_t\tweaponstay, footsteps, flashlight, aimcrosshair, falldamage, teamplay;\nextern cvar_t\tallow_spectators;\n\n/*==========================================================================*/\nclass CTFFlame : public CBaseMonster\n{\npublic:\n\tvoid\tSpawn( void );\n\tvoid\tPrecache( void );\n\tvoid\tEXPORT FlameThink( void );\n\tstatic  CTFFlame *FlameSpawn( CBaseEntity *pOwner, CBaseEntity *pTarget );\n\tvoid\tFlameDestroy( void );\n\n\tfloat\tm_flNextDamageTime;\n};\n\n/*==========================================================================*/\n// MAPSCRIPT CLASSES\nclass CTFGoal : public CBaseAnimating\n{\npublic:\n\tvoid\tSpawn( void );\n\tvoid\tStartGoal( void );\n\tvoid\tEXPORT PlaceGoal( void );\n\tvoid\tUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value );\n\tint\t\tClassify ( void ) { return\tCLASS_TFGOAL; }\n\n\tvoid\tSetObjectCollisionBox( void );\n};\n \nclass CTFGoalItem : public CTFGoal\n{\npublic:\n\tvoid\tSpawn( void );\n\tvoid\tStartItem( void );\n\tvoid\tEXPORT PlaceItem( void );\n\tint\t\tClassify ( void ) { return\tCLASS_TFGOAL_ITEM; }\n\n\tfloat\tm_flDroppedAt;\n};\n\nclass CTFTimerGoal : public CTFGoal\n{\npublic:\n\tvoid\tSpawn( void );\n\tint\t\tClassify ( void ) { return\tCLASS_TFGOAL_TIMER; }\n};\n\nclass CTFSpawn : public CBaseEntity\n{\npublic:\n\tvoid\tSpawn( void );\n\tvoid\tActivate( void );\n\tint\t\tClassify ( void ) { return\tCLASS_TFSPAWN; }\n\tBOOL\tCheckTeam( int iTeamNo );\n\n\tEHANDLE m_pTeamCheck;\n};\n\nclass CTFDetect : public CBaseEntity\n{\npublic:\n\tvoid\tSpawn( void );\n\tint\t\tClassify ( void ) { return\tCLASS_TFGOAL; }\n};\n\nclass CTelefragDeath : public CBaseEntity\n{\npublic:\n\tvoid\t\tSpawn( void );\n\tvoid\t\tEXPORT\tDeathTouch( CBaseEntity *pOther );\n};\n\nclass CTeamCheck : public CBaseDelay\n{\npublic:\n\tvoid Spawn( void );\n\tvoid Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value );\n\tBOOL TeamMatches( int iTeam );\n};\n\nclass CTeamSet : public CBaseDelay\n{\npublic:\n\tvoid Spawn( void );\n\tvoid Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value );\n};\n\n#endif // TF_DEFS_ONLY\n#endif // __TF_DEFS_H\n\n\n"
  },
  {
    "path": "cl_dll/include/unicode_strtools.h",
    "content": "/*\n*\n*    This program is free software; you can redistribute it and/or modify it\n*    under the terms of the GNU General Public License as published by the\n*    Free Software Foundation; either version 2 of the License, or (at\n*    your option) any later version.\n*\n*    This program is distributed in the hope that it will be useful, but\n*    WITHOUT ANY WARRANTY; without even the implied warranty of\n*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n*    General Public License for more details.\n*\n*    You should have received a copy of the GNU General Public License\n*    along with this program; if not, write to the Free Software Foundation,\n*    Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\n*\n*    In addition, as a special exception, the author gives permission to\n*    link the code of this program with the Half-Life Game Engine (\"HL\n*    Engine\") and Modified Game Libraries (\"MODs\") developed by Valve,\n*    L.L.C (\"Valve\").  You must obey the GNU General Public License in all\n*    respects for all of the code used other than the HL Engine and MODs\n*    from Valve.  If you modify this file, you may extend this exception\n*    to your version of the file, but you are not obligated to do so.  If\n*    you do not wish to do so, delete this exception statement from your\n*    version.\n*\n*/\n#pragma once\n#ifndef UNICODE_STR_TOOLS_H\n#define UNICODE_STR_TOOLS_H\n\n\n#ifdef _WIN32\n\ntypedef wchar_t uchar16;\ntypedef unsigned int uchar32;\n\n#else\n\ntypedef unsigned short uchar16;\ntypedef unsigned int uchar32;\n\n#endif // _WIN32\n\nenum EStringConvertErrorPolicy\n{\n\t_STRINGCONVERTFLAG_SKIP = 1,\n\t_STRINGCONVERTFLAG_FAIL = 2,\n\t_STRINGCONVERTFLAG_ASSERT = 4,\n\n\tSTRINGCONVERT_REPLACE = 0,\n\tSTRINGCONVERT_SKIP = 1,\n\tSTRINGCONVERT_FAIL = 2,\n\n\tSTRINGCONVERT_ASSERT_REPLACE = 4,\n\tSTRINGCONVERT_ASSERT_SKIP = 5,\n\tSTRINGCONVERT_ASSERT_FAIL = 6,\n};\n\nbool Q_IsValidUChar32(uchar32 uVal);\nint Q_UTF32ToUChar32(const uchar32 *pUTF32, uchar32 &uVal, bool &bErr);\nint Q_UChar32ToUTF32Len(uchar32 uVal);\nint Q_UChar32ToUTF32(uchar32 uVal, uchar32 *pUTF32);\nint Q_UChar32ToUTF8Len(uchar32 uVal);\nint Q_UChar32ToUTF16Len(uchar32 uVal);\nint Q_UChar32ToUTF16(uchar32 uVal, uchar16 *pUTF16Out);\nint Q_UChar32ToUTF8(uchar32 uVal, char *pUTF8Out);\nint Q_UTF16ToUChar32(const uchar16 *pUTF16, uchar32 &uValueOut, bool &bErrorOut);\nint Q_UTF8ToUTF16(const char *pUTF8, uchar16 *pUTF16, int cubDestSizeInBytes, EStringConvertErrorPolicy ePolicy);\nint Q_UTF8ToUTF32(const char *pUTF8, uchar32 *pUTF32, int cubDestSizeInBytes, EStringConvertErrorPolicy ePolicy);\nint Q_UTF16ToUTF8(const uchar16 *pUTF16, char *pUTF8, int cubDestSizeInBytes, EStringConvertErrorPolicy ePolicy);\nint Q_UTF16ToUTF32(const uchar16 *pUTF16, uchar32 *pUTF32, int cubDestSizeInBytes, EStringConvertErrorPolicy ePolicy);\nint Q_UTF32ToUTF8(const uchar32 *pUTF32, char *pUTF8, int cubDestSizeInBytes, EStringConvertErrorPolicy ePolicy);\nint Q_UTF32ToUTF16(const uchar32 *pUTF32, uchar16 *pUTF16, int cubDestSizeInBytes, EStringConvertErrorPolicy ePolicy);\nint Q_UTF8ToUChar32(const char *pUTF8_, uchar32 &uValueOut, bool &bErrorOut);\nqboolean Q_UnicodeValidate(const char *pUTF8);\nint Q_UnicodeLength(const char *pUTF8);\nchar *Q_UnicodeAdvance(char *pUTF8, int nChars);\n//bool Q_IsMeanSpaceW(uchar16 wch);\nbool Q_IsDeprecatedW(uchar16 wch);\nuchar16 *StripUnprintableWorker(uchar16 *pwch, bool *pbStrippedAny);\nqboolean Q_StripUnprintableAndSpace(char *pch);\nqboolean V_UTF8ToUChar32(const char *pUTF8_, uchar32 *uValueOut);\nint Q_UnicodeRepair(char *pUTF8);\nwchar_t *Q_AdvanceSpace (wchar_t *start);\nwchar_t *Q_ReadUToken (wchar_t *start, wchar_t *token, int tokenBufferSize, bool &quoted);\n\n#endif // UNICODE_STR_TOOLS_H\n"
  },
  {
    "path": "cl_dll/include/vgui_parser.h",
    "content": "/*\n*\n*    This program is free software; you can redistribute it and/or modify it\n*    under the terms of the GNU General Public License as published by the\n*    Free Software Foundation; either version 2 of the License, or (at\n*    your option) any later version.\n*\n*    This program is distributed in the hope that it will be useful, but\n*    WITHOUT ANY WARRANTY; without even the implied warranty of\n*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n*    General Public License for more details.\n*\n*    You should have received a copy of the GNU General Public License\n*    along with this program; if not, write to the Free Software Foundation,\n*    Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\n*\n*    In addition, as a special exception, the author gives permission to\n*    link the code of this program with the Half-Life Game Engine (\"HL\n*    Engine\") and Modified Game Libraries (\"MODs\") developed by Valve,\n*    L.L.C (\"Valve\").  You must obey the GNU General Public License in all\n*    respects for all of the code used other than the HL Engine and MODs\n*    from Valve.  If you modify this file, you may extend this exception\n*    to your version of the file, but you are not obligated to do so.  If\n*    you do not wish to do so, delete this exception statement from your\n*    version.\n*\n*/\n#pragma once\n#ifndef VGUI_PARSER_H\n#define VGUI_PARSER_H\n\n#define MAX_TOLOCALIZE_STRING_SIZE 256\n#define MAX_LOCALIZEDSTRING_SIZE 2048\n\nvoid Localize_Init( );\nvoid Localize_Free( );\n\nconst char* Localize( const char* string );\nvoid StripEndNewlineFromString( char *str );\n\nvoid Localize_StripIndices( char *s );\n#endif\n"
  },
  {
    "path": "cl_dll/include/view.h",
    "content": "//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============\n//\n// Purpose: \n//\n// $NoKeywords: $\n//=============================================================================\n#pragma once\n#if !defined ( VIEWH )\n#define VIEWH \n\nvoid V_StartPitchDrift( void );\nvoid V_StopPitchDrift( void );\n\n#endif // !VIEWH"
  },
  {
    "path": "cl_dll/include/wrect.h",
    "content": "//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============\n//\n// Purpose: \n//\n// $NoKeywords: $\n//=============================================================================\n\n#pragma once\n#if !defined( WRECTH )\n#define WRECTH\n\ntypedef struct rect_s\n{\n\tint\tleft;\n\tint right;\n\tint top;\n\tint bottom;\n\n#ifdef __cplusplus\n\tint Width()\n\t{\n\t\treturn right - left;\n\t}\n\n\tint Height()\n\t{\n\t\treturn bottom - top;\n\t}\n#endif\n} wrect_t;\n\n#endif\n"
  },
  {
    "path": "cl_dll/input/input_sdl.cpp",
    "content": "//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============\n//\n// Purpose: \n//\n// $NoKeywords: $\n//=============================================================================\n\n// in_win.c -- windows 95 mouse and joystick code\n// 02/21/97 JCB Added extended DirectInput code to support external controllers.\n\n#include \"port.h\"\n\n#include \"hud.h\"\n#include \"cl_util.h\"\n#include \"camera.h\"\n#include \"kbutton.h\"\n#include \"cvardef.h\"\n#include \"usercmd.h\"\n#include \"const.h\"\n#include \"camera.h\"\n#include \"in_defs.h\"\n#include \"../engine/keydefs.h\"\n#include \"view.h\"\n#include \"input.h\"\n\n#include <SDL2/SDL_mouse.h>\n#include <SDL2/SDL_gamecontroller.h>\n\n#define MOUSE_BUTTON_COUNT 5\n\n// Set this to 1 to show mouse cursor.  Experimental\nint\tg_iVisibleMouse = 0;\n\nextern int iMouseInUse;\n\n\n// mouse variables\ncvar_t\t\t*m_filter;\ncvar_t\t\t*sensitivity;\n\n// Custom mouse acceleration (0 disable, 1 to enable, 2 enable with separate yaw/pitch rescale)\nstatic cvar_t *m_customaccel;\n//Formula: mousesensitivity = ( rawmousedelta^m_customaccel_exponent ) * m_customaccel_scale + sensitivity\n// If mode is 2, then x and y sensitivity are scaled by m_pitch and m_yaw respectively.\n// Custom mouse acceleration value.\nstatic cvar_t *m_customaccel_scale;\n//Max mouse move scale factor, 0 for no limit\nstatic cvar_t *m_customaccel_max;\n//Mouse move is raised to this power before being scaled by scale factor\nstatic cvar_t *m_customaccel_exponent;\n\nint\t\t\tmouse_buttons;\nint\t\t\tmouse_oldbuttonstate;\nPOINT\t\tcurrent_pos;\nint\t\t\told_mouse_x, old_mouse_y, mx_accum, my_accum;\nfloat\t\tmouse_x, mouse_y;\n\nstatic int\tmouseactive = 0;\nint\t\t\tmouseinitialized;\n\n// joystick defines and variables\n// where should defines be moved?\n#define JOY_ABSOLUTE_AXIS\t0x00000000\t\t// control like a joystick\n#define JOY_RELATIVE_AXIS\t0x00000010\t\t// control like a mouse, spinner, trackball\n#define\tJOY_MAX_AXES\t\t6\t\t\t\t// X, Y, Z, R, U, V\n#define JOY_AXIS_X\t\t\t0\n#define JOY_AXIS_Y\t\t\t1\n#define JOY_AXIS_Z\t\t\t2\n#define JOY_AXIS_R\t\t\t3\n#define JOY_AXIS_U\t\t\t4\n#define JOY_AXIS_V\t\t\t5\n\nenum _ControlList\n{\n\tAxisNada = 0,\n\tAxisForward,\n\tAxisLook,\n\tAxisSide,\n\tAxisTurn\n};\n\n\n\nDWORD\tdwAxisMap[ JOY_MAX_AXES ];\nDWORD\tdwControlMap[ JOY_MAX_AXES ];\nint\tpdwRawValue[ JOY_MAX_AXES ];\nDWORD\t\tjoy_oldbuttonstate, joy_oldpovstate;\n\nint\t\t\tjoy_id;\nDWORD\t\tjoy_numbuttons;\n\nSDL_GameController *s_pJoystick = NULL;\n\n// none of these cvars are saved over a session\n// this means that advanced controller configuration needs to be executed\n// each time.  this avoids any problems with getting back to a default usage\n// or when changing from one controller to another.  this way at least something\n// works.\ncvar_t\t*in_joystick;\ncvar_t\t*joy_name;\ncvar_t\t*joy_advanced;\ncvar_t\t*joy_advaxisx;\ncvar_t\t*joy_advaxisy;\ncvar_t\t*joy_advaxisz;\ncvar_t\t*joy_advaxisr;\ncvar_t\t*joy_advaxisu;\ncvar_t\t*joy_advaxisv;\ncvar_t\t*joy_forwardthreshold;\ncvar_t\t*joy_sidethreshold;\ncvar_t\t*joy_pitchthreshold;\ncvar_t\t*joy_yawthreshold;\ncvar_t\t*joy_forwardsensitivity;\ncvar_t\t*joy_sidesensitivity;\ncvar_t\t*joy_pitchsensitivity;\ncvar_t\t*joy_yawsensitivity;\ncvar_t\t*joy_wwhack1;\ncvar_t\t*joy_wwhack2;\n\nint\t\t\tjoy_avail, joy_advancedinit, joy_haspov;\n\n#ifdef _WIN32\nDWORD\ts_hMouseThreadId = 0;\nHANDLE\ts_hMouseThread = 0;\nHANDLE\ts_hMouseQuitEvent = 0;\nHANDLE\ts_hMouseDoneQuitEvent = 0;\n#endif\n\n/*\n===========\nForce_CenterView_f\n===========\n*/\nvoid Force_CenterView_f (void)\n{\n\tvec3_t viewangles;\n\n\tif (!iMouseInUse)\n\t{\n\t\tgEngfuncs.GetViewAngles( (float *)viewangles );\n\t    viewangles[PITCH] = 0;\n\t\tgEngfuncs.SetViewAngles( (float *)viewangles );\n\t}\n}\n\n#ifdef _WIN32\nlong s_mouseDeltaX = 0;\nlong s_mouseDeltaY = 0;\nPOINT\t\told_mouse_pos;\n\nlong ThreadInterlockedExchange( long *pDest, long value )\n{\n\treturn InterlockedExchange( pDest, value );\n}\n\n\nDWORD WINAPI MousePos_ThreadFunction( LPVOID p )\n{\n\ts_hMouseDoneQuitEvent = CreateEvent( NULL, FALSE, FALSE, NULL );\n\n\twhile ( 1 )\n\t{\n\t\tif ( WaitForSingleObject( s_hMouseQuitEvent, (int)m_mousethread_sleep->value ) == WAIT_OBJECT_0 )\n\t\t{\n\t\t\treturn 0;\n\t\t}\n\n\t\tif ( mouseactive )\n\t\t{\n\t\t\tPOINT\t\tmouse_pos;\n\t\t\tGetCursorPos(&mouse_pos);\n\n\t\t\tvolatile int mx = mouse_pos.x - old_mouse_pos.x + s_mouseDeltaX;\n\t\t\tvolatile int my = mouse_pos.y - old_mouse_pos.y + s_mouseDeltaY;\n \n\t\t\tThreadInterlockedExchange( &old_mouse_pos.x, mouse_pos.x );\n\t\t\tThreadInterlockedExchange( &old_mouse_pos.y, mouse_pos.y );\n\n\t\t\tThreadInterlockedExchange( &s_mouseDeltaX, mx );\n\t\t\tThreadInterlockedExchange( &s_mouseDeltaY, my );\n\t\t}\n\t}\n\n\tSetEvent( s_hMouseDoneQuitEvent );\n\n\treturn 0;\n}\n#endif\n\n/*\n===========\nIN_ActivateMouse\n===========\n*/\nvoid DLLEXPORT IN_ActivateMouse (void)\n{\n\tif (mouseinitialized)\n\t{\n#ifdef _WIN32\n\t\tif (mouseparmsvalid)\n\t\t\trestore_spi = SystemParametersInfo (SPI_SETMOUSE, 0, newmouseparms, 0);\n\n#endif\n\t\tmouseactive = 1;\n\t}\n}\n\n\n/*\n===========\nIN_DeactivateMouse\n===========\n*/\nvoid DLLEXPORT IN_DeactivateMouse (void)\n{\n\tif (mouseinitialized)\n\t{\n#ifdef _WIN32\n\t\tif (restore_spi)\n\t\t\tSystemParametersInfo (SPI_SETMOUSE, 0, originalmouseparms, 0);\n\n#endif\n\n\t\tmouseactive = 0;\n\t}\n}\n\n/*\n===========\nIN_StartupMouse\n===========\n*/\nvoid IN_StartupMouse (void)\n{\n\tif ( gEngfuncs.CheckParm (\"-nomouse\", NULL ) ) \n\t\treturn; \n\n\tmouseinitialized = 1;\n#ifdef _WIN32\n\tmouseparmsvalid = SystemParametersInfo (SPI_GETMOUSE, 0, originalmouseparms, 0);\n\n\tif (mouseparmsvalid)\n\t{\n\t\tif ( gEngfuncs.CheckParm (\"-noforcemspd\", NULL ) ) \n\t\t\tnewmouseparms[2] = originalmouseparms[2];\n\n\t\tif ( gEngfuncs.CheckParm (\"-noforcemaccel\", NULL ) ) \n\t\t{\n\t\t\tnewmouseparms[0] = originalmouseparms[0];\n\t\t\tnewmouseparms[1] = originalmouseparms[1];\n\t\t}\n\n\t\tif ( gEngfuncs.CheckParm (\"-noforcemparms\", NULL ) ) \n\t\t{\n\t\t\tnewmouseparms[0] = originalmouseparms[0];\n\t\t\tnewmouseparms[1] = originalmouseparms[1];\n\t\t\tnewmouseparms[2] = originalmouseparms[2];\n\t\t}\n\t}\n#endif\n\t\n\tmouse_buttons = MOUSE_BUTTON_COUNT;\n}\n\n/*\n===========\nIN_Shutdown\n===========\n*/\nvoid IN_Shutdown (void)\n{\n\tIN_DeactivateMouse ();\n\n#ifdef _WIN32\n\tif ( s_hMouseQuitEvent )\n\t{\n\t\tSetEvent( s_hMouseQuitEvent );\n\t\tWaitForSingleObject( s_hMouseDoneQuitEvent, 100 );\n\t}\n\t\n\tif ( s_hMouseThread )\n\t{\n\t\tTerminateThread( s_hMouseThread, 0 );\n\t\tCloseHandle( s_hMouseThread );\n\t\ts_hMouseThread = (HANDLE)0;\n\t}\n\t\n\tif ( s_hMouseQuitEvent )\n\t{\n\t\tCloseHandle( s_hMouseQuitEvent );\n\t\ts_hMouseQuitEvent = (HANDLE)0;\n\t}\n\t\n\t\n\tif ( s_hMouseDoneQuitEvent )\n\t{\n\t\tCloseHandle( s_hMouseDoneQuitEvent );\n\t\ts_hMouseDoneQuitEvent = (HANDLE)0;\n\t}\n#endif\n}\n\n/*\n===========\nIN_GetMousePos\n\nAsk for mouse position from engine\n===========\n*/\nvoid IN_GetMousePos( int *mx, int *my )\n{\n\tgEngfuncs.GetMousePosition( mx, my );\n}\n\n/*\n===========\nIN_ResetMouse\n\nFIXME: Call through to engine?\n===========\n*/\nvoid IN_ResetMouse( void )\n{\n\t// no work to do in SDL\n}\n\n/*\n===========\nIN_MouseEvent\n===========\n*/\nvoid DLLEXPORT IN_MouseEvent (int mstate)\n{\n\tint\t\ti;\n\n\tif ( iMouseInUse || g_iVisibleMouse )\n\t\treturn;\n\n\t// perform button actions\n\tfor (i=0 ; i<mouse_buttons ; i++)\n\t{\n\t\tif ( (mstate & (1<<i)) &&\n\t\t\t!(mouse_oldbuttonstate & (1<<i)) )\n\t\t{\n\t\t\tgEngfuncs.Key_Event (K_MOUSE1 + i, 1);\n\t\t}\n\n\t\tif ( !(mstate & (1<<i)) &&\n\t\t\t(mouse_oldbuttonstate & (1<<i)) )\n\t\t{\n\t\t\tgEngfuncs.Key_Event (K_MOUSE1 + i, 0);\n\t\t}\n\t}\t\n\t\n\tmouse_oldbuttonstate = mstate;\n}\n\n//-----------------------------------------------------------------------------\n// Purpose: Allows modulation of mouse scaling/senstivity value and application\n//  of custom algorithms.\n// Input  : *x - \n//\t\t\t*y - \n//-----------------------------------------------------------------------------\nvoid IN_ScaleMouse( float *x, float *y )\n{\n\tfloat mx = *x;\n\tfloat my = *y;\n\n\t// This is the default sensitivity\n\tfloat mouse_senstivity = ( gHUD.GetSensitivity() != 0 ) ? gHUD.GetSensitivity() : sensitivity->value;\n\n\t// Using special accleration values\n\tif ( m_customaccel->value != 0 ) \n\t{ \n\t\tfloat raw_mouse_movement_distance = sqrt( mx * mx + my * my );\n\t\tfloat acceleration_scale = m_customaccel_scale->value;\n\t\tfloat accelerated_sensitivity_max = m_customaccel_max->value;\n\t\tfloat accelerated_sensitivity_exponent = m_customaccel_exponent->value;\n\t\tfloat accelerated_sensitivity = ( (float)pow( raw_mouse_movement_distance, accelerated_sensitivity_exponent ) * acceleration_scale + mouse_senstivity );\n\n\t\tif ( accelerated_sensitivity_max > 0.0001f && \n\t\t\taccelerated_sensitivity > accelerated_sensitivity_max )\n\t\t{\n\t\t\taccelerated_sensitivity = accelerated_sensitivity_max;\n\t\t}\n\n\t\t*x *= accelerated_sensitivity; \n\t\t*y *= accelerated_sensitivity; \n\n\t\t// Further re-scale by yaw and pitch magnitude if user requests alternate mode 2\n\t\t// This means that they will need to up their value for m_customaccel_scale greatly (>40x) since m_pitch/yaw default\n\t\t//  to 0.022\n\t\tif ( m_customaccel->value == 2 )\n\t\t{ \n\t\t\t*x *= m_yaw->value; \n\t\t\t*y *= m_pitch->value; \n\t\t} \n\t}\n\telse\n\t{ \n\t\t// Just apply the default\n\t\t*x *= mouse_senstivity;\n\t\t*y *= mouse_senstivity;\n\t}\n}\n\n/*\n===========\nIN_MouseMove\n===========\n*/\nvoid IN_MouseMove ( float frametime, usercmd_t *cmd)\n{\n\tint\t\tmx, my;\n\tvec3_t viewangles;\n\n\tgEngfuncs.GetViewAngles( (float *)viewangles );\n\n\t//jjb - this disbles normal mouse control if the user is trying to \n\t//      move the camera, or if the mouse cursor is visible or if we're in intermission\n\tif ( !iMouseInUse && !gHUD.m_iIntermission && !g_iVisibleMouse )\n\t{\n\t\tint deltaX, deltaY;\n#ifdef _WIN32\n\t\tif ( !m_bRawInput )\n\t\t{\n\t\t\tif ( m_bMouseThread )\n\t\t\t{\n\t\t\t\tThreadInterlockedExchange( &current_pos.x, s_mouseDeltaX );\n\t\t\t\tThreadInterlockedExchange( &current_pos.y, s_mouseDeltaY );\n\t\t\t\tThreadInterlockedExchange( &s_mouseDeltaX, 0 );\n\t\t\t\tThreadInterlockedExchange( &s_mouseDeltaY, 0 );\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tGetCursorPos (&current_pos);\n\t\t\t}\n\t\t}\n\t\telse\n#endif\n\t\t{\n\t\t\tSDL_GetRelativeMouseState( &deltaX, &deltaY );\n\t\t\tcurrent_pos.x = deltaX;\n\t\t\tcurrent_pos.y = deltaY;\t\n\t\t}\n\t\t\n#ifdef _WIN32\n\t\tif ( !m_bRawInput )\n\t\t{\n\t\t\tif ( m_bMouseThread )\n\t\t\t{\n\t\t\t\tmx = current_pos.x;\n\t\t\t\tmy = current_pos.y;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tmx = current_pos.x - gEngfuncs.GetWindowCenterX() + mx_accum;\n\t\t\t\tmy = current_pos.y - gEngfuncs.GetWindowCenterY() + my_accum;\n\t\t\t}\n\t\t}\n\t\telse\n#endif\n\t\t{\n\t\t\tmx = deltaX + mx_accum;\n\t\t\tmy = deltaY + my_accum;\n\t\t}\n\t\t\n\t\tmx_accum = 0;\n\t\tmy_accum = 0;\n\n\t\tif (m_filter && m_filter->value)\n\t\t{\n\t\t\tmouse_x = (mx + old_mouse_x) * 0.5;\n\t\t\tmouse_y = (my + old_mouse_y) * 0.5;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tmouse_x = mx;\n\t\t\tmouse_y = my;\n\t\t}\n\n\t\told_mouse_x = mx;\n\t\told_mouse_y = my;\n\n\t\t// Apply custom mouse scaling/acceleration\n\t\tIN_ScaleMouse( &mouse_x, &mouse_y );\n\n\t\t// add mouse X/Y movement to cmd\n\t\tif ( (in_strafe.state & 1) || (lookstrafe->value && (in_mlook.state & 1) ))\n\t\t\tcmd->sidemove += m_side->value * mouse_x;\n\t\telse\n\t\t\tviewangles[YAW] -= m_yaw->value * mouse_x;\n\n\t\tif ( (in_mlook.state & 1) && !(in_strafe.state & 1))\n\t\t{\n\t\t\tviewangles[PITCH] += m_pitch->value * mouse_y;\n\t\t\tif (viewangles[PITCH] > cl_pitchdown->value)\n\t\t\t\tviewangles[PITCH] = cl_pitchdown->value;\n\t\t\tif (viewangles[PITCH] < -cl_pitchup->value)\n\t\t\t\tviewangles[PITCH] = -cl_pitchup->value;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif ((in_strafe.state & 1) && gEngfuncs.IsNoClipping() )\n\t\t\t{\n\t\t\t\tcmd->upmove -= m_forward->value * mouse_y;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tcmd->forwardmove -= m_forward->value * mouse_y;\n\t\t\t}\n\t\t}\n\n\t\t// if the mouse has moved, force it to the center, so there's room to move\n\t\tif ( mx || my )\n\t\t{\n\t\t\tIN_ResetMouse();\n\t\t}\n\t}\n\n\tgEngfuncs.SetViewAngles( (float *)viewangles );\n\n/*\n//#define TRACE_TEST\n#if defined( TRACE_TEST )\n\t{\n\t\tint mx, my;\n\t\tvoid V_Move( int mx, int my );\n\t\tIN_GetMousePos( &mx, &my );\n\t\tV_Move( mx, my );\n\t}\n#endif\n*/\n}\n\n/*\n===========\nIN_Accumulate\n===========\n*/\nvoid DLLEXPORT IN_Accumulate (void)\n{\n\t//only accumulate mouse if we are not moving the camera with the mouse\n\tif ( !iMouseInUse && !g_iVisibleMouse)\n\t{\n\t    if (mouseactive)\n\t    {\n#ifdef _WIN32\n\t\t\tif ( !m_bRawInput )\n\t\t\t{\n\t\t\t\tif ( !m_bMouseThread )\n\t\t\t\t{\n\t\t\t\t\tGetCursorPos (&current_pos);\n\t\t\t\t\t\n\t\t\t\t\tmx_accum += current_pos.x - gEngfuncs.GetWindowCenterX();\n\t\t\t\t\tmy_accum += current_pos.y - gEngfuncs.GetWindowCenterY();\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n#endif\n\t\t\t{\n\t\t\t\tint deltaX, deltaY;\n\t\t\t\tSDL_GetRelativeMouseState( &deltaX, &deltaY );\n\t\t\t\tmx_accum += deltaX;\n\t\t\t\tmy_accum += deltaY;\t\n\t\t\t}\n\t\t\t// force the mouse to the center, so there's room to move\n\t\t\tIN_ResetMouse();\n\t\t\t\n\t\t}\n\t}\n\n}\n\n/*\n===================\nIN_ClearStates\n===================\n*/\nvoid DLLEXPORT IN_ClearStates (void)\n{\n\tif ( !mouseactive )\n\t\treturn;\n\n\tmx_accum = 0;\n\tmy_accum = 0;\n\tmouse_oldbuttonstate = 0;\n}\n\n/* \n=============== \nIN_StartupJoystick \n=============== \n*/  \nvoid IN_StartupJoystick (void) \n{ \n\t// abort startup if user requests no joystick\n\tif ( gEngfuncs.CheckParm (\"-nojoy\", NULL ) ) \n\t\treturn; \n \n \t// assume no joystick\n\tjoy_avail = 0; \n\n\tint nJoysticks = SDL_NumJoysticks();\n\tif ( nJoysticks > 0 )\n\t{\n\t\tfor ( int i = 0; i < nJoysticks; i++ )\n\t\t{\n\t\t\tif ( SDL_IsGameController( i ) )\n\t\t\t{\n\t\t\t\ts_pJoystick = SDL_GameControllerOpen( i );\n\t\t\t\tif ( s_pJoystick )\n\t\t\t\t{\n\t\t\t\t\t//save the joystick's number of buttons and POV status\n\t\t\t\t\tjoy_numbuttons = SDL_CONTROLLER_BUTTON_MAX;\n\t\t\t\t\tjoy_haspov = 0;\n\t\t\t\t\t\n\t\t\t\t\t// old button and POV states default to no buttons pressed\n\t\t\t\t\tjoy_oldbuttonstate = joy_oldpovstate = 0;\n\t\t\t\t\t\n\t\t\t\t\t// mark the joystick as available and advanced initialization not completed\n\t\t\t\t\t// this is needed as cvars are not available during initialization\n\t\t\t\t\tgEngfuncs.Con_Printf (\"joystick found\\n\\n\", SDL_GameControllerName(s_pJoystick)); \n\t\t\t\t\tjoy_avail = 1; \n\t\t\t\t\tjoy_advancedinit = 0;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t}\n\t\t}\n\t}\n\telse\n\t{\n\t\tgEngfuncs.Con_DPrintf (\"joystick not found -- driver not present\\n\\n\");\n\t}\n\t\n}\n\n\nint RawValuePointer (int axis)\n{\n\tswitch (axis)\n\t{\n\t\tdefault:\n\t\tcase JOY_AXIS_X:\n\t\t\treturn SDL_GameControllerGetAxis( s_pJoystick, SDL_CONTROLLER_AXIS_LEFTX );\n\t\tcase JOY_AXIS_Y:\n\t\t\treturn SDL_GameControllerGetAxis( s_pJoystick, SDL_CONTROLLER_AXIS_LEFTY );\n\t\tcase JOY_AXIS_Z:\n\t\t\treturn SDL_GameControllerGetAxis( s_pJoystick, SDL_CONTROLLER_AXIS_RIGHTX );\n\t\tcase JOY_AXIS_R:\n\t\t\treturn SDL_GameControllerGetAxis( s_pJoystick, SDL_CONTROLLER_AXIS_RIGHTY );\n\t\t\n\t}\n}\n\n/*\n===========\nJoy_AdvancedUpdate_f\n===========\n*/\nvoid Joy_AdvancedUpdate_f (void)\n{\n\n\t// called once by IN_ReadJoystick and by user whenever an update is needed\n\t// cvars are now available\n\tint\ti;\n\tDWORD dwTemp;\n\n\t// initialize all the maps\n\tfor (i = 0; i < JOY_MAX_AXES; i++)\n\t{\n\t\tdwAxisMap[i] = AxisNada;\n\t\tdwControlMap[i] = JOY_ABSOLUTE_AXIS;\n\t\tpdwRawValue[i] = RawValuePointer(i);\n\t}\n\n\tif( joy_advanced->value == 0.0)\n\t{\n\t\t// default joystick initialization\n\t\t// 2 axes only with joystick control\n\t\tdwAxisMap[JOY_AXIS_X] = AxisTurn;\n\t\t// dwControlMap[JOY_AXIS_X] = JOY_ABSOLUTE_AXIS;\n\t\tdwAxisMap[JOY_AXIS_Y] = AxisForward;\n\t\t// dwControlMap[JOY_AXIS_Y] = JOY_ABSOLUTE_AXIS;\n\t}\n\telse\n\t{\n\t\tif ( strcmp ( joy_name->string, \"joystick\") != 0 )\n\t\t{\n\t\t\t// notify user of advanced controller\n\t\t\tgEngfuncs.Con_Printf (\"\\n%s configured\\n\\n\", joy_name->string);\n\t\t}\n\n\t\t// advanced initialization here\n\t\t// data supplied by user via joy_axisn cvars\n\t\tdwTemp = (DWORD) joy_advaxisx->value;\n\t\tdwAxisMap[JOY_AXIS_X] = dwTemp & 0x0000000f;\n\t\tdwControlMap[JOY_AXIS_X] = dwTemp & JOY_RELATIVE_AXIS;\n\t\tdwTemp = (DWORD) joy_advaxisy->value;\n\t\tdwAxisMap[JOY_AXIS_Y] = dwTemp & 0x0000000f;\n\t\tdwControlMap[JOY_AXIS_Y] = dwTemp & JOY_RELATIVE_AXIS;\n\t\tdwTemp = (DWORD) joy_advaxisz->value;\n\t\tdwAxisMap[JOY_AXIS_Z] = dwTemp & 0x0000000f;\n\t\tdwControlMap[JOY_AXIS_Z] = dwTemp & JOY_RELATIVE_AXIS;\n\t\tdwTemp = (DWORD) joy_advaxisr->value;\n\t\tdwAxisMap[JOY_AXIS_R] = dwTemp & 0x0000000f;\n\t\tdwControlMap[JOY_AXIS_R] = dwTemp & JOY_RELATIVE_AXIS;\n\t\tdwTemp = (DWORD) joy_advaxisu->value;\n\t\tdwAxisMap[JOY_AXIS_U] = dwTemp & 0x0000000f;\n\t\tdwControlMap[JOY_AXIS_U] = dwTemp & JOY_RELATIVE_AXIS;\n\t\tdwTemp = (DWORD) joy_advaxisv->value;\n\t\tdwAxisMap[JOY_AXIS_V] = dwTemp & 0x0000000f;\n\t\tdwControlMap[JOY_AXIS_V] = dwTemp & JOY_RELATIVE_AXIS;\n\t}\n}\n\n\n/*\n===========\nIN_Commands\n===========\n*/\nvoid IN_Commands (void)\n{\n\tint\t\ti, key_index;\n\n\tif (!joy_avail)\n\t{\n\t\treturn;\n\t}\n\n\tDWORD\tbuttonstate, povstate;\n\t\n\t// loop through the joystick buttons\n\t// key a joystick event or auxiliary event for higher number buttons for each state change\n\tbuttonstate = 0;\n\tfor ( i = 0; i < SDL_CONTROLLER_BUTTON_MAX; i++ )\n\t{\n\t\tif ( SDL_GameControllerGetButton( s_pJoystick, (SDL_GameControllerButton)i ) )\n\t\t{\n\t\t\tbuttonstate |= 1<<i;\n\t\t}\n\t}\n\t\n\tfor (i = 0; i < JOY_MAX_AXES; i++)\n\t{\n\t\tpdwRawValue[i] = RawValuePointer(i);\n\t}\n\n\tfor (i=0 ; i < (int)joy_numbuttons ; i++)\n\t{\n\t\tif ( (buttonstate & (1<<i)) && !(joy_oldbuttonstate & (1<<i)) )\n\t\t{\n\t\t\tkey_index = (i < 4) ? K_JOY1 : K_AUX1;\n\t\t\tgEngfuncs.Key_Event (key_index + i, 1);\n\t\t}\n\n\t\tif ( !(buttonstate & (1<<i)) && (joy_oldbuttonstate & (1<<i)) )\n\t\t{\n\t\t\tkey_index = (i < 4) ? K_JOY1 : K_AUX1;\n\t\t\tgEngfuncs.Key_Event (key_index + i, 0);\n\t\t}\n\t}\n\tjoy_oldbuttonstate = buttonstate;\n\n\tif (joy_haspov)\n\t{\n\t\t// convert POV information into 4 bits of state information\n\t\t// this avoids any potential problems related to moving from one\n\t\t// direction to another without going through the center position\n\t\tpovstate = 0;\n\t\t// determine which bits have changed and key an auxiliary event for each change\n\t\tfor (i=0 ; i < 4 ; i++)\n\t\t{\n\t\t\tif ( (povstate & (1<<i)) && !(joy_oldpovstate & (1<<i)) )\n\t\t\t{\n\t\t\t\tgEngfuncs.Key_Event (K_AUX29 + i, 1);\n\t\t\t}\n\n\t\t\tif ( !(povstate & (1<<i)) && (joy_oldpovstate & (1<<i)) )\n\t\t\t{\n\t\t\t\tgEngfuncs.Key_Event (K_AUX29 + i, 0);\n\t\t\t}\n\t\t}\n\t\tjoy_oldpovstate = povstate;\n\t}\n}\n\n\n/* \n=============== \nIN_ReadJoystick\n=============== \n*/  \nint IN_ReadJoystick (void)\n{\n\tSDL_JoystickUpdate();\n\treturn 1;\n}\n\n\n/*\n===========\nIN_JoyMove\n===========\n*/\nvoid IN_JoyMove ( float frametime, usercmd_t *cmd )\n{\n\tfloat\tspeed, aspeed;\n\tfloat\tfAxisValue, fTemp;\n\tint\t\ti;\n\tvec3_t viewangles;\n\n\tgEngfuncs.GetViewAngles( (float *)viewangles );\n\n\n\t// complete initialization if first time in\n\t// this is needed as cvars are not available at initialization time\n\tif( joy_advancedinit != 1 )\n\t{\n\t\tJoy_AdvancedUpdate_f();\n\t\tjoy_advancedinit = 1;\n\t}\n\n\t// verify joystick is available and that the user wants to use it\n\tif (!joy_avail || !in_joystick->value)\n\t{\n\t\treturn; \n\t}\n \n\t// collect the joystick data, if possible\n\tif (IN_ReadJoystick () != 1)\n\t{\n\t\treturn;\n\t}\n\n\tif (in_speed.state & 1)\n\t\tspeed = cl_movespeedkey->value;\n\telse\n\t\tspeed = 1;\n\n\taspeed = speed * frametime;\n\n\t// loop through the axes\n\tfor (i = 0; i < JOY_MAX_AXES; i++)\n\t{\n\t\t// get the floating point zero-centered, potentially-inverted data for the current axis\n\t\tfAxisValue = (float)pdwRawValue[i];\n\n\t\tif (joy_wwhack2->value != 0.0)\n\t\t{\n\t\t\tif (dwAxisMap[i] == AxisTurn)\n\t\t\t{\n\t\t\t\t// this is a special formula for the Logitech WingMan Warrior\n\t\t\t\t// y=ax^b; where a = 300 and b = 1.3\n\t\t\t\t// also x values are in increments of 800 (so this is factored out)\n\t\t\t\t// then bounds check result to level out excessively high spin rates\n\t\t\t\tfTemp = 300.0 * pow(abs(fAxisValue) / 800.0, 1.3);\n\t\t\t\tif (fTemp > 14000.0)\n\t\t\t\t\tfTemp = 14000.0;\n\t\t\t\t// restore direction information\n\t\t\t\tfAxisValue = (fAxisValue > 0.0) ? fTemp : -fTemp;\n\t\t\t}\n\t\t}\n\n\t\t// convert range from -32768..32767 to -1..1 \n\t\tfAxisValue /= 32768.0;\n\n\t\tswitch (dwAxisMap[i])\n\t\t{\n\t\tcase AxisForward:\n\t\t\tif ((joy_advanced->value == 0.0) && (in_jlook.state & 1))\n\t\t\t{\n\t\t\t\t// user wants forward control to become look control\n\t\t\t\tif (fabs(fAxisValue) > joy_pitchthreshold->value)\n\t\t\t\t{\t\t\n\t\t\t\t\t// if mouse invert is on, invert the joystick pitch value\n\t\t\t\t\t// only absolute control support here (joy_advanced is 0)\n\t\t\t\t\tif (m_pitch->value < 0.0)\n\t\t\t\t\t{\n\t\t\t\t\t\tviewangles[PITCH] -= (fAxisValue * joy_pitchsensitivity->value) * aspeed * cl_pitchspeed->value;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tviewangles[PITCH] += (fAxisValue * joy_pitchsensitivity->value) * aspeed * cl_pitchspeed->value;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t// user wants forward control to be forward control\n\t\t\t\tif (fabs(fAxisValue) > joy_forwardthreshold->value)\n\t\t\t\t{\n\t\t\t\t\tcmd->forwardmove += (fAxisValue * joy_forwardsensitivity->value) * speed * cl_forwardspeed->value;\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak;\n\n\t\tcase AxisSide:\n\t\t\tif (fabs(fAxisValue) > joy_sidethreshold->value)\n\t\t\t{\n\t\t\t\tcmd->sidemove += (fAxisValue * joy_sidesensitivity->value) * speed * cl_sidespeed->value;\n\t\t\t}\n\t\t\tbreak;\n\n\t\tcase AxisTurn:\n\t\t\tif ((in_strafe.state & 1) || (lookstrafe->value && (in_jlook.state & 1)))\n\t\t\t{\n\t\t\t\t// user wants turn control to become side control\n\t\t\t\tif (fabs(fAxisValue) > joy_sidethreshold->value)\n\t\t\t\t{\n\t\t\t\t\tcmd->sidemove -= (fAxisValue * joy_sidesensitivity->value) * speed * cl_sidespeed->value;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t// user wants turn control to be turn control\n\t\t\t\tif (fabs(fAxisValue) > joy_yawthreshold->value)\n\t\t\t\t{\n\t\t\t\t\tif(dwControlMap[i] == JOY_ABSOLUTE_AXIS)\n\t\t\t\t\t{\n\t\t\t\t\t\tviewangles[YAW] += (fAxisValue * joy_yawsensitivity->value) * aspeed * cl_yawspeed->value;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tviewangles[YAW] += (fAxisValue * joy_yawsensitivity->value) * speed * 180.0;\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak;\n\n\t\tcase AxisLook:\n\t\t\tif (in_jlook.state & 1)\n\t\t\t{\n\t\t\t\tif (fabs(fAxisValue) > joy_pitchthreshold->value)\n\t\t\t\t{\n\t\t\t\t\t// pitch movement detected and pitch movement desired by user\n\t\t\t\t\tif(dwControlMap[i] == JOY_ABSOLUTE_AXIS)\n\t\t\t\t\t{\n\t\t\t\t\t\tviewangles[PITCH] += (fAxisValue * joy_pitchsensitivity->value) * aspeed * cl_pitchspeed->value;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tviewangles[PITCH] += (fAxisValue * joy_pitchsensitivity->value) * speed * 180.0;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak;\n\n\t\tdefault:\n\t\t\tbreak;\n\t\t}\n\t}\n\n\t// bounds check pitch\n\tif (viewangles[PITCH] > cl_pitchdown->value)\n\t\tviewangles[PITCH] = cl_pitchdown->value;\n\tif (viewangles[PITCH] < -cl_pitchup->value)\n\t\tviewangles[PITCH] = -cl_pitchup->value;\n\n\tgEngfuncs.SetViewAngles( (float *)viewangles );\n}\n\n/*\n===========\nIN_Move\n===========\n*/\nvoid IN_Move ( float frametime, usercmd_t *cmd)\n{\n\tif ( !iMouseInUse && mouseactive )\n\t{\n\t\tIN_MouseMove ( frametime, cmd);\n\t}\n\n\tIN_JoyMove ( frametime, cmd);\n}\n\n/*\n===========\nIN_Init\n===========\n*/\nvoid IN_Init (void)\n{\n\tm_filter\t\t\t\t= gEngfuncs.pfnRegisterVariable ( \"m_filter\",\"0\", FCVAR_ARCHIVE );\n\tsensitivity\t\t\t\t= gEngfuncs.pfnRegisterVariable ( \"sensitivity\",\"3\", FCVAR_ARCHIVE ); // user mouse sensitivity setting.\n\n\tin_joystick\t\t\t\t= gEngfuncs.pfnRegisterVariable ( \"joystick\",\"0\", FCVAR_ARCHIVE );\n\tjoy_name\t\t\t\t= gEngfuncs.pfnRegisterVariable ( \"joyname\", \"joystick\", 0 );\n\tjoy_advanced\t\t\t= gEngfuncs.pfnRegisterVariable ( \"joyadvanced\", \"0\", 0 );\n\tjoy_advaxisx\t\t\t= gEngfuncs.pfnRegisterVariable ( \"joyadvaxisx\", \"0\", 0 );\n\tjoy_advaxisy\t\t\t= gEngfuncs.pfnRegisterVariable ( \"joyadvaxisy\", \"0\", 0 );\n\tjoy_advaxisz\t\t\t= gEngfuncs.pfnRegisterVariable ( \"joyadvaxisz\", \"0\", 0 );\n\tjoy_advaxisr\t\t\t= gEngfuncs.pfnRegisterVariable ( \"joyadvaxisr\", \"0\", 0 );\n\tjoy_advaxisu\t\t\t= gEngfuncs.pfnRegisterVariable ( \"joyadvaxisu\", \"0\", 0 );\n\tjoy_advaxisv\t\t\t= gEngfuncs.pfnRegisterVariable ( \"joyadvaxisv\", \"0\", 0 );\n\tjoy_forwardthreshold\t= gEngfuncs.pfnRegisterVariable ( \"joyforwardthreshold\", \"0.15\", 0 );\n\tjoy_sidethreshold\t\t= gEngfuncs.pfnRegisterVariable ( \"joysidethreshold\", \"0.15\", 0 );\n\tjoy_pitchthreshold\t\t= gEngfuncs.pfnRegisterVariable ( \"joypitchthreshold\", \"0.15\", 0 );\n\tjoy_yawthreshold\t\t= gEngfuncs.pfnRegisterVariable ( \"joyyawthreshold\", \"0.15\", 0 );\n\tjoy_forwardsensitivity\t= gEngfuncs.pfnRegisterVariable ( \"joyforwardsensitivity\", \"-1.0\", 0 );\n\tjoy_sidesensitivity\t\t= gEngfuncs.pfnRegisterVariable ( \"joysidesensitivity\", \"-1.0\", 0 );\n\tjoy_pitchsensitivity\t= gEngfuncs.pfnRegisterVariable ( \"joypitchsensitivity\", \"1.0\", 0 );\n\tjoy_yawsensitivity\t\t= gEngfuncs.pfnRegisterVariable ( \"joyyawsensitivity\", \"-1.0\", 0 );\n\tjoy_wwhack1\t\t\t\t= gEngfuncs.pfnRegisterVariable ( \"joywwhack1\", \"0.0\", 0 );\n\tjoy_wwhack2\t\t\t\t= gEngfuncs.pfnRegisterVariable ( \"joywwhack2\", \"0.0\", 0 );\n\n\tm_customaccel\t\t\t= gEngfuncs.pfnRegisterVariable ( \"m_customaccel\", \"0\", FCVAR_ARCHIVE );\n\tm_customaccel_scale\t\t= gEngfuncs.pfnRegisterVariable ( \"m_customaccel_scale\", \"0.04\", FCVAR_ARCHIVE );\n\tm_customaccel_max\t\t= gEngfuncs.pfnRegisterVariable ( \"m_customaccel_max\", \"0\", FCVAR_ARCHIVE );\n\tm_customaccel_exponent\t= gEngfuncs.pfnRegisterVariable ( \"m_customaccel_exponent\", \"1\", FCVAR_ARCHIVE );\n\n#ifdef _WIN32\n\tm_bRawInput\t\t\t\t= CVAR_GET_FLOAT( \"m_rawinput\" ) > 0;\n\tm_bMouseThread\t\t\t= gEngfuncs.CheckParm (\"-mousethread\", NULL ) != NULL;\n\tm_mousethread_sleep\t\t\t= gEngfuncs.pfnRegisterVariable ( \"m_mousethread_sleep\", \"10\", FCVAR_ARCHIVE );\n\n\tif ( !m_bRawInput && m_bMouseThread && m_mousethread_sleep ) \n\t{\n\t\ts_mouseDeltaX = s_mouseDeltaY = 0;\n\t\t\n\t\ts_hMouseQuitEvent = CreateEvent( NULL, FALSE, FALSE, NULL );\n\t\tif ( s_hMouseQuitEvent )\n\t\t{\n\t\t\ts_hMouseThread = CreateThread( NULL, 0, MousePos_ThreadFunction, NULL, 0, &s_hMouseThreadId );\n\t\t}\n\t}\n#endif\n\n\tgEngfuncs.pfnAddCommand (\"force_centerview\", Force_CenterView_f);\n\tgEngfuncs.pfnAddCommand (\"joyadvancedupdate\", Joy_AdvancedUpdate_f);\n\n\tIN_StartupMouse ();\n\tIN_StartupJoystick ();\n}\n"
  },
  {
    "path": "cl_dll/input/input_xash3d.cpp",
    "content": "#include \"hud.h\"\n#include \"usercmd.h\"\n#include \"cvardef.h\"\n#include \"kbutton.h\"\n#include \"keydefs.h\"\n#include \"input.h\"\n\n#define\tPITCH\t0\n#define\tYAW\t\t1\n#define\tROLL\t2 \n\ncvar_t\t*cl_laddermode;\ncvar_t\t*sensitivity;\ncvar_t\t*in_joystick;\ncvar_t\t*evdev_grab;\n\n\nfloat ac_forwardmove;\nfloat ac_sidemove;\nint ac_movecount;\nfloat rel_yaw;\nfloat rel_pitch;\nbool bMouseInUse = false;\n\nextern Vector dead_viewangles;\nextern bool evdev_open;\n\n#define F 1U<<0\t// Forward\n#define B 1U<<1\t// Back\n#define L 1U<<2\t// Left\n#define R 1U<<3\t// Right\n#define T 1U<<4\t// Forward stop\n#define S 1U<<5\t// Side stop\n\n#define BUTTON_DOWN\t\t1\n#define IMPULSE_DOWN\t2\n#define IMPULSE_UP\t\t4\n\nbool CL_IsDead();\n\nvoid IN_ToggleButtons( float forwardmove, float sidemove )\n{\n\tstatic unsigned int moveflags = T | S;\n\n\tif( forwardmove )\n\t\tmoveflags &= ~T;\n\telse\n\t{\n\t\t//if( in_forward.state || in_back.state ) gEngfuncs.Con_Printf(\"Buttons pressed f%d b%d\\n\", in_forward.state, in_back.state);\n\t\tif( !( moveflags & T ) )\n\t\t{\n\t\t\t//IN_ForwardUp();\n\t\t\t//IN_BackUp();\n\t\t\t//gEngfuncs.Con_Printf(\"Reset forwardmove state f%d b%d\\n\", in_forward.state, in_back.state);\n\t\t\tin_forward.state &= ~BUTTON_DOWN;\n\t\t\tin_back.state &= ~BUTTON_DOWN;\n\t\t\tmoveflags |= T;\n\t\t}\n\t}\n\tif( sidemove )\n\t\tmoveflags &= ~S;\n\telse\n\t{\n\t\t//gEngfuncs.Con_Printf(\"l%d r%d\\n\", in_moveleft.state, in_moveright.state);\n\t\t//if( in_moveleft.state || in_moveright.state ) gEngfuncs.Con_Printf(\"Buttons pressed l%d r%d\\n\", in_moveleft.state, in_moveright.state);\n\t\tif( !( moveflags & S ) )\n\t\t{\n\t\t\t//IN_MoverightUp();\n\t\t\t//IN_MoveleftUp();\n\t\t\t//gEngfuncs.Con_Printf(\"Reset sidemove state f%d b%d\\n\", in_moveleft.state, in_moveright.state);\n\t\t\tin_moveleft.state &= ~BUTTON_DOWN;\n\t\t\tin_moveright.state &= ~BUTTON_DOWN;\n\t\t\tmoveflags |= S;\n\t\t}\n\t}\n\n\tif ( forwardmove > 0.7 && !( moveflags & F ))\n\t{\n\t\tmoveflags |= F;\n\t\tin_forward.state |= BUTTON_DOWN;\n\t}\n\tif ( forwardmove < 0.7 && ( moveflags & F ))\n\t{\n\t\tmoveflags &= ~F;\n\t\tin_forward.state &= ~BUTTON_DOWN;\n\t}\n\tif ( forwardmove < -0.7 && !( moveflags & B ))\n\t{\n\t\tmoveflags |= B;\n\t\tin_back.state |= BUTTON_DOWN;\n\t}\n\tif ( forwardmove > -0.7 && ( moveflags & B ))\n\t{\n\t\tmoveflags &= ~B;\n\t\tin_back.state &= ~BUTTON_DOWN;\n\t}\n\tif ( sidemove > 0.9 && !( moveflags & R ))\n\t{\n\t\tmoveflags |= R;\n\t\tin_moveright.state |= BUTTON_DOWN;\n\t}\n\tif ( sidemove < 0.9 && ( moveflags & R ))\n\t{\n\t\tmoveflags &= ~R;\n\t\tin_moveright.state &= ~BUTTON_DOWN;\n\t}\n\tif ( sidemove < -0.9 && !( moveflags & L ))\n\t{\n\t\tmoveflags |= L;\n\t\tin_moveleft.state |= BUTTON_DOWN;\n\t}\n\tif ( sidemove > -0.9 && ( moveflags & L ))\n\t{\n\t\tmoveflags &= ~L;\n\t\tin_moveleft.state &= ~BUTTON_DOWN;\n\t}\n\n}\n\nvoid IN_ClientMoveEvent( float forwardmove, float sidemove )\n{\n\t//gEngfuncs.Con_Printf(\"IN_MoveEvent\\n\");\n\n\tac_forwardmove += forwardmove;\n\tac_sidemove += sidemove;\n\tac_movecount++;\n}\n\nvoid IN_ClientLookEvent( float relyaw, float relpitch )\n{\n\trel_yaw += relyaw;\n\trel_pitch += relpitch;\n}\n\n// Rotate camera and add move values to usercmd\nvoid IN_Move( float frametime, usercmd_t *cmd )\n{\n\tVector viewangles;\n\tbool bLadder = false;\n\n\tif( gHUD.m_iIntermission )\n\t\treturn; // we can't move during intermission\n\n\n\tif( cl_laddermode->value != 2 )\n\t{\n\t\tcl_entity_t *pplayer = gEngfuncs.GetLocalPlayer();\n\t\tif( pplayer )\n\t\t\tbLadder = pplayer->curstate.movetype == MOVETYPE_FLY;\n\t}\n\t//if(ac_forwardmove || ac_sidemove)\n\t//gEngfuncs.Con_Printf(\"Move: %f %f %f %f\\n\", ac_forwardmove, ac_sidemove, rel_pitch, rel_yaw);\n#if 0\n\tif( in_mlook.state & 1 )\n\t{\n\t\tV_StopPitchDrift();\n\t}\n#endif\n\n\tif( CL_IsDead( ) )\n\t{\n\t\tviewangles = dead_viewangles; // HACKHACK: see below\n\t}\n\telse\n\t{\n\t\tgEngfuncs.GetViewAngles( viewangles );\n\t}\n\n\tif( gHUD.GetSensitivity() != 0 )\n\t{\n\t\trel_yaw *= gHUD.GetSensitivity();\n\t\trel_pitch *= gHUD.GetSensitivity();\n\t}\n\telse\n\t{\n\t\trel_yaw *= sensitivity->value;\n\t\trel_pitch *= sensitivity->value;\n\t}\n\tif(gHUD.m_MOTD.cl_hide_motd->value == 0.0f && gHUD.m_MOTD.m_bShow)\n\t{\n\t\tgHUD.m_MOTD.scroll += rel_pitch;\n\t}\n\telse\n\t{\n\t\tviewangles[PITCH] += rel_pitch;\n\t\tviewangles[YAW] += rel_yaw;\n\t\tif( bLadder )\n\t\t{\n\t\t\tif( ( cl_laddermode->value == 1 ) )\n\t\t\t\tviewangles[YAW] -= ac_sidemove * 5;\n\t\t\tac_sidemove = 0;\n\t\t}\n\t}\n\tif (viewangles[PITCH] > cl_pitchdown->value)\n\t\tviewangles[PITCH] = cl_pitchdown->value;\n\tif (viewangles[PITCH] < -cl_pitchup->value)\n\t\tviewangles[PITCH] = -cl_pitchup->value;\n\n\n\tif( !CL_IsDead( ) )\n\t{\n\t\tgEngfuncs.SetViewAngles( viewangles );\n\t}\n\n\tdead_viewangles = viewangles;\n\t\n\tif( ac_movecount )\n\t{\n\t\tIN_ToggleButtons( ac_forwardmove / ac_movecount, ac_sidemove / ac_movecount );\n\t\tif( ac_forwardmove ) cmd->forwardmove  = ac_forwardmove * cl_forwardspeed->value / ac_movecount;\n\t\tif( ac_sidemove ) cmd->sidemove  = ac_sidemove * cl_sidespeed->value / ac_movecount;\n\t\tif (in_speed.state & 1)\n\t\t{\n\t\t\tcmd->forwardmove *= cl_movespeedkey->value;\n\t\t\tcmd->sidemove *= cl_movespeedkey->value;\n\t\t}\n\t}\n\t\n\tac_sidemove = ac_forwardmove = rel_pitch = rel_yaw = 0;\n\tac_movecount = 0;\n}\n\nvoid DLLEXPORT IN_MouseEvent( int mstate )\n{\n\tstatic int mouse_oldbuttonstate;\n\t// perform button actions\n\tfor( int i = 0; i < 5; i++ )\n\t{\n\t\tif(( mstate & (1 << i)) && !( mouse_oldbuttonstate & (1 << i)))\n\t\t{\n\t\t\tgEngfuncs.Key_Event( K_MOUSE1 + i, 1 );\n\t\t}\n\n\t\tif( !( mstate & (1 << i)) && ( mouse_oldbuttonstate & (1 << i)))\n\t\t{\n\t\t\tgEngfuncs.Key_Event( K_MOUSE1 + i, 0 );\n\t\t}\n\t}\t\n\t\n\tmouse_oldbuttonstate = mstate;\n\tbMouseInUse = true;\n}\n\n// Stubs\n\nvoid DLLEXPORT IN_ClearStates ( void )\n{\n\t//gEngfuncs.Con_Printf(\"IN_ClearStates\\n\");\n}\n\nvoid  DLLEXPORT IN_ActivateMouse ( void )\n{\n\t//gEngfuncs.Con_Printf(\"IN_ActivateMouse\\n\");\n}\n\nvoid DLLEXPORT  IN_DeactivateMouse ( void )\n{\n\t//gEngfuncs.Con_Printf(\"IN_DeactivateMouse\\n\");\n}\n\nvoid DLLEXPORT IN_Accumulate ( void )\n{\n\t//gEngfuncs.Con_Printf(\"IN_Accumulate\\n\");\n}\n\nvoid IN_Commands ( void )\n{\n\t//gEngfuncs.Con_Printf(\"IN_Commands\\n\");\n}\n\nvoid IN_Shutdown ( void )\n{\n}\n// Register cvars and reset data\nvoid IN_Init( void )\n{\n\tsensitivity = gEngfuncs.pfnRegisterVariable ( \"sensitivity\", \"3\", FCVAR_ARCHIVE );\n\tin_joystick = gEngfuncs.pfnRegisterVariable ( \"joystick\", \"0\", FCVAR_ARCHIVE );\n\tcl_laddermode = gEngfuncs.pfnRegisterVariable ( \"cl_laddermode\", \"2\", FCVAR_ARCHIVE );\n\tevdev_grab = gEngfuncs.pfnGetCvarPointer(\"evdev_grab\");\n\n\tac_forwardmove = ac_sidemove = rel_yaw = rel_pitch = 0;\n}\n"
  },
  {
    "path": "cl_dll/input.cpp",
    "content": "//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============\n//\n// Purpose: \n//\n// $NoKeywords: $\n//=============================================================================\n\n// cl.input.c  -- builds an intended movement command to send to the server\n\n//xxxxxx Move bob and pitch drifting code here and other stuff from view if needed\n\n// Quake is a trademark of Id Software, Inc., (c) 1996 Id Software, Inc. All\n// rights reserved.\n#include \"hud.h\"\n#include \"cl_util.h\"\n#include \"camera.h\"\n#include \"kbutton.h\"\n#include \"cvardef.h\"\n#include \"usercmd.h\"\n#include \"const.h\"\n#include \"camera.h\"\n#include \"in_defs.h\"\n#include \"view.h\"\n#include <string.h>\n#include <ctype.h>\n\n#include \"vgui_parser.h\"\n#include \"com_weapons.h\"\n\nextern int g_weaponselect;\nextern cl_enginefunc_t gEngfuncs;\n\n// Defined in pm_math.c\nfloat anglemod( float a );\n\nvoid IN_Init (void);\nvoid IN_Move ( float frametime, usercmd_t *cmd);\nvoid IN_Shutdown( void );\nvoid V_Init( void );\nvoid VectorAngles( const float *forward, float *angles );\nint CL_ButtonBits( int );\n\n// xxx need client dll function to get and clear impuse\nextern cvar_t *in_joystick;\n\nint\tin_impulse\t= 0;\nint\tin_cancel\t= 0;\n\ncvar_t\t*m_pitch;\ncvar_t\t*m_yaw;\ncvar_t\t*m_forward;\ncvar_t\t*m_side;\n\ncvar_t\t*lookstrafe;\ncvar_t\t*lookspring;\ncvar_t\t*cl_pitchup;\ncvar_t\t*cl_pitchdown;\ncvar_t\t*cl_upspeed;\ncvar_t\t*cl_forwardspeed;\ncvar_t\t*cl_backspeed;\ncvar_t\t*cl_sidespeed;\ncvar_t\t*cl_movespeedkey;\ncvar_t\t*cl_yawspeed;\ncvar_t\t*cl_pitchspeed;\ncvar_t\t*cl_anglespeedkey;\ncvar_t\t*cl_vsmoothing;\n/*\n===============================================================================\n\nKEY BUTTONS\n\nContinuous button event tracking is complicated by the fact that two different\ninput sources (say, mouse button 1 and the control key) can both press the\nsame button, but the button should only be released when both of the\npressing key have been released.\n\nWhen a key event issues a button command (+forward, +attack, etc), it appends\nits key number as a parameter to the command so it can be matched up with\nthe release.\n\nstate bit 0 is the current state of the key\nstate bit 1 is edge triggered on the up to down transition\nstate bit 2 is edge triggered on the down to up transition\n\n===============================================================================\n*/\n\n\nkbutton_t\tin_mlook;\nkbutton_t\tin_klook;\nkbutton_t\tin_jlook;\nkbutton_t\tin_left;\nkbutton_t\tin_right;\nkbutton_t\tin_forward;\nkbutton_t\tin_back;\nkbutton_t\tin_lookup;\nkbutton_t\tin_lookdown;\nkbutton_t\tin_moveleft;\nkbutton_t\tin_moveright;\nkbutton_t\tin_strafe;\nkbutton_t\tin_speed;\nkbutton_t\tin_use;\nkbutton_t\tin_jump;\nkbutton_t\tin_attack;\nkbutton_t\tin_attack2;\nkbutton_t\tin_up;\nkbutton_t\tin_down;\nkbutton_t\tin_duck;\nkbutton_t\tin_reload;\nkbutton_t\tin_alt1;\nkbutton_t\tin_score;\nkbutton_t\tin_break;\nkbutton_t\tin_graph;  // Display the netgraph\n\nstruct kblist_t\n{\n\tkblist_t *next;\n\tkbutton_t *pkey;\n\tchar name[32];\n};\n\nkblist_t *g_kbkeys = NULL;\n\n/*\n============\nKB_ConvertString\n\nRemoves references to +use and replaces them with the keyname in the output string.  If\n a binding is unfound, then the original text is retained.\nNOTE:  Only works for text with +word in it.\n============\n*/\nint KB_ConvertString( char *in, char **ppout )\n{\n\tchar sz[ 4096 ];\n\tchar binding[ 64 ];\n\tchar *p;\n\tchar *pOut;\n\tchar *pEnd;\n\tconst char *pBinding;\n\n\tif ( !ppout )\n\t\treturn 0;\n\n\t*ppout = NULL;\n\tp = in;\n\tpOut = sz;\n\twhile ( *p )\n\t{\n\t\tif ( *p == '+' )\n\t\t{\n\t\t\tpEnd = binding;\n\t\t\twhile ( *p && ( isalnum( *p ) || ( pEnd == binding ) ) && ( ( pEnd - binding ) < 63 ) )\n\t\t\t{\n\t\t\t\t*pEnd++ = *p++;\n\t\t\t}\n\n\t\t\t*pEnd =  '\\0';\n\n\t\t\tpBinding = NULL;\n\t\t\tif ( strlen( binding + 1 ) > 0 )\n\t\t\t{\n\t\t\t\t// See if there is a binding for binding?\n\t\t\t\tpBinding = gEngfuncs.Key_LookupBinding( binding + 1 );\n\t\t\t}\n\n\t\t\tif ( pBinding )\n\t\t\t{\n\t\t\t\t*pOut++ = '[';\n\t\t\t\tpEnd = (char *)pBinding;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tpEnd = binding;\n\t\t\t}\n\n\t\t\twhile ( *pEnd )\n\t\t\t{\n\t\t\t\t*pOut++ = *pEnd++;\n\t\t\t}\n\n\t\t\tif ( pBinding )\n\t\t\t{\n\t\t\t\t*pOut++ = ']';\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\t*pOut++ = *p++;\n\t\t}\n\t}\n\n\t*pOut = '\\0';\n\n\tpOut = ( char * )malloc( strlen( sz ) + 1 );\n\tstrcpy( pOut, sz );\n\t*ppout = pOut;\n\n\treturn 1;\n}\n\n/*\n============\nKB_Find\n\nAllows the engine to get a kbutton_t directly ( so it can check +mlook state, etc ) for saving out to .cfg files\n============\n*/\nstruct kbutton_s DLLEXPORT *KB_Find( const char *name )\n{\n\tkblist_t *p;\n\tp = g_kbkeys;\n\twhile ( p )\n\t{\n\t\tif ( !stricmp( name, p->name ) )\n\t\t\treturn p->pkey;\n\n\t\tp = p->next;\n\t}\n\treturn NULL;\n}\n\n/*\n============\nKB_Add\n\nAdd a kbutton_t * to the list of pointers the engine can retrieve via KB_Find\n============\n*/\nvoid KB_Add( const char *name, kbutton_t *pkb )\n{\n\tkblist_t *p;\t\n\tkbutton_t *kb;\n\n\tkb = KB_Find( name );\n\t\n\tif ( kb )\n\t\treturn;\n\n\tp = ( kblist_t * )malloc( sizeof( kblist_t ) );\n\tmemset( p, 0, sizeof( *p ) );\n\n\tstrcpy( p->name, name );\n\tp->pkey = pkb;\n\n\tp->next = g_kbkeys;\n\tg_kbkeys = p;\n}\n\n/*\n============\nKB_Init\n\nAdd kbutton_t definitions that the engine can query if needed\n============\n*/\nvoid KB_Init( void )\n{\n\tg_kbkeys = NULL;\n\n\tKB_Add( \"in_graph\", &in_graph );\n\tKB_Add( \"in_mlook\", &in_mlook );\n\tKB_Add( \"in_jlook\", &in_jlook );\n}\n\n/*\n============\nKB_Shutdown\n\nClear kblist\n============\n*/\nvoid KB_Shutdown( void )\n{\n\tkblist_t *p, *n;\n\tp = g_kbkeys;\n\twhile ( p )\n\t{\n\t\tn = p->next;\n\t\tfree( p );\n\t\tp = n;\n\t}\n\tg_kbkeys = NULL;\n}\n\n/*\n============\nKeyDown\n============\n*/\nvoid KeyDown (kbutton_t *b)\n{\n\tint\t\tk;\n\tchar\t*c;\n\n\tc = gEngfuncs.Cmd_Argv(1);\n\tif (c[0])\n\t\tk = atoi(c);\n\telse\n\t\tk = -1;\t\t// typed manually at the console for continuous down\n\n\tif (k == b->down[0] || k == b->down[1])\n\t\treturn;\t\t// repeating key\n\t\n\tif (!b->down[0])\n\t\tb->down[0] = k;\n\telse if (!b->down[1])\n\t\tb->down[1] = k;\n\telse\n\t{\n\t\tgEngfuncs.Con_DPrintf (\"Three keys down for a button '%c' '%c' '%c'!\\n\", b->down[0], b->down[1], c);\n\t\treturn;\n\t}\n\t\n\tif (b->state & 1)\n\t\treturn;\t\t// still down\n\tb->state |= 1 + 2;\t// down + impulse down\n}\n\n/*\n============\nKeyUp\n============\n*/\nvoid KeyUp (kbutton_t *b)\n{\n\tint\t\tk;\n\tchar\t*c;\n\t\n\tc = gEngfuncs.Cmd_Argv(1);\n\tif (c[0])\n\t\tk = atoi(c);\n\telse\n\t{ // typed manually at the console, assume for unsticking, so clear all\n\t\tb->down[0] = b->down[1] = 0;\n\t\tb->state = 4;\t// impulse up\n\t\treturn;\n\t}\n\n\tif (b->down[0] == k)\n\t\tb->down[0] = 0;\n\telse if (b->down[1] == k)\n\t\tb->down[1] = 0;\n\telse\n\t\treturn;\t\t// key up without coresponding down (menu pass through)\n\tif (b->down[0] || b->down[1])\n\t{\n\t\t//Con_Printf (\"Keys down for button: '%c' '%c' '%c' (%d,%d,%d)!\\n\", b->down[0], b->down[1], c, b->down[0], b->down[1], c);\n\t\treturn;\t\t// some other key is still holding it down\n\t}\n\n\tif (!(b->state & 1))\n\t\treturn;\t\t// still up (this should not happen)\n\n\tb->state &= ~1;\t\t// now up\n\tb->state |= 4; \t\t// impulse up\n}\n\n/*\n============\nHUD_Key_Event\n\nReturn 1 to allow engine to process the key, otherwise, act on it as needed\n============\n*/\nint DLLEXPORT HUD_Key_Event( int down, int keynum, const char *pszCurrentBinding )\n{\n\treturn 1;\n}\n\nvoid IN_BreakDown( void ) { KeyDown( &in_break );}\nvoid IN_BreakUp( void ) { KeyUp( &in_break ); }\nvoid IN_KLookDown (void) {KeyDown(&in_klook);}\nvoid IN_KLookUp (void) {KeyUp(&in_klook);}\nvoid IN_JLookDown (void) {KeyDown(&in_jlook);}\nvoid IN_JLookUp (void) {KeyUp(&in_jlook);}\nvoid IN_MLookDown (void) {KeyDown(&in_mlook);}\nvoid IN_UpDown(void) {KeyDown(&in_up);}\nvoid IN_UpUp(void) {KeyUp(&in_up);}\nvoid IN_DownDown(void) {KeyDown(&in_down);}\nvoid IN_DownUp(void) {KeyUp(&in_down);}\nvoid IN_LeftDown(void) {KeyDown(&in_left);}\nvoid IN_LeftUp(void) {KeyUp(&in_left);}\nvoid IN_RightDown(void) {KeyDown(&in_right);}\nvoid IN_RightUp(void) {KeyUp(&in_right);}\n\nvoid IN_ForwardDown(void)\n{\n\tKeyDown(&in_forward);\n\tgHUD.m_Spectator.HandleButtonsDown( IN_FORWARD );\n}\n\nvoid IN_ForwardUp(void)\n{\n\tKeyUp(&in_forward);\n\tgHUD.m_Spectator.HandleButtonsUp( IN_FORWARD );\n}\n\nvoid IN_BackDown(void)\n{\n\tKeyDown(&in_back);\n\tgHUD.m_Spectator.HandleButtonsDown( IN_BACK );\n}\n\nvoid IN_BackUp(void)\n{\n\tKeyUp(&in_back);\n\tgHUD.m_Spectator.HandleButtonsUp( IN_BACK );\n}\nvoid IN_LookupDown(void) {KeyDown(&in_lookup);}\nvoid IN_LookupUp(void) {KeyUp(&in_lookup);}\nvoid IN_LookdownDown(void) {KeyDown(&in_lookdown);}\nvoid IN_LookdownUp(void) {KeyUp(&in_lookdown);}\nvoid IN_MoveleftDown(void)\n{\n\tKeyDown(&in_moveleft);\n\tgHUD.m_Spectator.HandleButtonsDown( IN_MOVELEFT );\n}\n\nvoid IN_MoveleftUp(void)\n{\n\tKeyUp(&in_moveleft);\n\tgHUD.m_Spectator.HandleButtonsUp( IN_MOVELEFT );\n}\n\nvoid IN_MoverightDown(void)\n{\n\tKeyDown(&in_moveright);\n\tgHUD.m_Spectator.HandleButtonsDown( IN_MOVERIGHT );\n}\n\nvoid IN_MoverightUp(void)\n{\n\tKeyUp(&in_moveright);\n\tgHUD.m_Spectator.HandleButtonsUp( IN_MOVERIGHT );\n}\nvoid IN_SpeedDown(void) {KeyDown(&in_speed);}\nvoid IN_SpeedUp(void) {KeyUp(&in_speed);}\nvoid IN_StrafeDown(void) {KeyDown(&in_strafe);}\nvoid IN_StrafeUp(void) {KeyUp(&in_strafe);}\n\n// needs capture by hud/vgui also\nextern void __CmdFunc_InputPlayerSpecial(void);\n\nvoid IN_Attack2Down(void) \n{\n\tKeyDown(&in_attack2);\n\n\tgHUD.m_Spectator.HandleButtonsDown( IN_ATTACK2 );\n}\n\nvoid IN_Attack2Up(void) {KeyUp(&in_attack2);}\nvoid IN_UseDown (void)\n{\n\tKeyDown(&in_use);\n\tgHUD.m_Spectator.HandleButtonsDown( IN_USE );\n}\nvoid IN_UseUp (void) {KeyUp(&in_use);}\nvoid IN_JumpDown (void)\n{\n\tKeyDown(&in_jump);\n\tgHUD.m_Spectator.HandleButtonsDown( IN_JUMP );\n\n}\nvoid IN_JumpUp (void) {KeyUp(&in_jump);}\nvoid IN_DuckDown(void)\n{\n\tKeyDown(&in_duck);\n\tgHUD.m_Spectator.HandleButtonsDown( IN_DUCK );\n\n}\nvoid IN_DuckUp(void) {KeyUp(&in_duck);}\nvoid IN_ReloadDown(void) {KeyDown(&in_reload);}\nvoid IN_ReloadUp(void) {KeyUp(&in_reload);}\nvoid IN_Alt1Down(void) {KeyDown(&in_alt1);}\nvoid IN_Alt1Up(void) {KeyUp(&in_alt1);}\nvoid IN_GraphDown(void) {KeyDown(&in_graph);}\nvoid IN_GraphUp(void) {KeyUp(&in_graph);}\n\nvoid IN_AttackDown(void)\n{\n\tKeyDown( &in_attack );\n\tgHUD.m_Spectator.HandleButtonsDown( IN_ATTACK );\n}\n\nvoid IN_AttackUp(void)\n{\n\tKeyUp( &in_attack );\n\tin_cancel = 0;\n}\n\n// Special handling\nvoid IN_Cancel(void)\n{\n\tin_cancel = 1;\n}\n\nvoid IN_Impulse (void)\n{\n\tin_impulse = atoi( gEngfuncs.Cmd_Argv(1) );\n}\n\nvoid IN_ScoreDown(void)\n{\n\tKeyDown(&in_score);\n}\n\nvoid IN_ScoreUp(void)\n{\n\tKeyUp(&in_score);\n}\n\nvoid IN_MLookUp (void)\n{\n\tKeyUp( &in_mlook );\n#if 0\n\tif ( !( in_mlook.state & 1 ) && lookspring->value )\n\t{\n\t\tV_StartPitchDrift();\n\t}\n#endif\n}\n\n/*\n===============\nCL_KeyState\n\nReturns 0.25 if a key was pressed and released during the frame,\n0.5 if it was pressed and held\n0 if held then released, and\n1.0 if held for the entire time\n===============\n*/\nfloat CL_KeyState (kbutton_t *key)\n{\n\tfloat\t\tval = 0.0;\n\tint\t\t\timpulsedown, impulseup, down;\n\t\n\timpulsedown = key->state & 2;\n\timpulseup\t= key->state & 4;\n\tdown\t\t= key->state & 1;\n\t\n\tif ( impulsedown && !impulseup )\n\t{\n\t\t// pressed and held this frame?\n\t\tval = down ? 0.5 : 0.0;\n\t}\n\n\tif ( impulseup && !impulsedown )\n\t{\n\t\t// released this frame?\n\t\t// val = down ? 0.0 : 0.0;\n\t\tval = 0.0;\n\t}\n\n\tif ( !impulsedown && !impulseup )\n\t{\n\t\t// held the entire frame?\n\t\tval = down ? 1.0 : 0.0;\n\t}\n\n\tif ( impulsedown && impulseup )\n\t{\n\t\tif ( down )\n\t\t{\n\t\t\t// released and re-pressed this frame\n\t\t\tval = 0.75;\t\n\t\t}\n\t\telse\n\t\t{\n\t\t\t// pressed and released this frame\n\t\t\tval = 0.25;\t\n\t\t}\n\t}\n\n\t// clear impulses\n\tkey->state &= 1;\t\t\n\treturn val;\n}\n\n/*\n================\nCL_AdjustAngles\n\nMoves the local angle positions\n================\n*/\nvoid CL_AdjustAngles ( float frametime, float *viewangles )\n{\n\tfloat\tspeed;\n\tfloat\tup, down;\n\t\n\tif (in_speed.state & 1)\n\t{\n\t\tspeed = frametime * cl_anglespeedkey->value;\n\t}\n\telse\n\t{\n\t\tspeed = frametime;\n\t}\n\n\tif (!(in_strafe.state & 1))\n\t{\n\t\tviewangles[YAW] -= speed*cl_yawspeed->value*CL_KeyState (&in_right);\n\t\tviewangles[YAW] += speed*cl_yawspeed->value*CL_KeyState (&in_left);\n\t\tviewangles[YAW] = anglemod(viewangles[YAW]);\n\t}\n\tif (in_klook.state & 1)\n\t{\n\t\t//V_StopPitchDrift ();\n\t\tviewangles[PITCH] -= speed*cl_pitchspeed->value * CL_KeyState (&in_forward);\n\t\tviewangles[PITCH] += speed*cl_pitchspeed->value * CL_KeyState (&in_back);\n\t}\n\t\n\tup = CL_KeyState (&in_lookup);\n\tdown = CL_KeyState(&in_lookdown);\n\t\n\tviewangles[PITCH] -= speed*cl_pitchspeed->value * up;\n\tviewangles[PITCH] += speed*cl_pitchspeed->value * down;\n#if 0\n\tif (up || down)\n\t\tV_StopPitchDrift ();\n#endif\n\tif (viewangles[PITCH] > cl_pitchdown->value)\n\t\tviewangles[PITCH] = cl_pitchdown->value;\n\tif (viewangles[PITCH] < -cl_pitchup->value)\n\t\tviewangles[PITCH] = -cl_pitchup->value;\n\n\tif (viewangles[ROLL] > 50)\n\t\tviewangles[ROLL] = 50;\n\tif (viewangles[ROLL] < -50)\n\t\tviewangles[ROLL] = -50;\n}\n\n/*\n================\nCL_CreateMove\n\nSend the intended movement message to the server\nif active == 1 then we are 1) not playing back demos ( where our commands are ignored ) and\n2 ) we have finished signing on to server\n================\n*/\nvoid DLLEXPORT CL_CreateMove ( float frametime, struct usercmd_s *cmd, int active )\n{\t\n\tfloat spd;\n\tvec3_t viewangles;\n\tstatic vec3_t oldangles;\n\n\tif ( active )\n\t{\n\t\t//memset( viewangles, 0, sizeof( vec3_t ) );\n\t\t//viewangles[ 0 ] = viewangles[ 1 ] = viewangles[ 2 ] = 0.0;\n\t\tgEngfuncs.GetViewAngles( (float *)viewangles );\n\n\t\tCL_AdjustAngles ( frametime, viewangles );\n\n\t\tmemset (cmd, 0, sizeof(*cmd));\n\t\t\n\t\tgEngfuncs.SetViewAngles( (float *)viewangles );\n\n\t\tif ( in_strafe.state & 1 )\n\t\t{\n\t\t\tcmd->sidemove += cl_sidespeed->value * CL_KeyState (&in_right);\n\t\t\tcmd->sidemove -= cl_sidespeed->value * CL_KeyState (&in_left);\n\t\t}\n\n\t\tcmd->sidemove += cl_sidespeed->value * CL_KeyState (&in_moveright);\n\t\tcmd->sidemove -= cl_sidespeed->value * CL_KeyState (&in_moveleft);\n\n\t\tcmd->upmove += cl_upspeed->value * CL_KeyState (&in_up);\n\t\tcmd->upmove -= cl_upspeed->value * CL_KeyState (&in_down);\n\n\t\tif ( !(in_klook.state & 1 ) )\n\t\t{\t\n\t\t\tif(gHUD.m_MOTD.m_bShow)\n\t\t\t{\n\t\t\t\tgHUD.m_MOTD.scroll -= CL_KeyState (&in_forward);\n\t\t\t\tgHUD.m_MOTD.scroll += CL_KeyState (&in_back);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tcmd->forwardmove += cl_forwardspeed->value * CL_KeyState (&in_forward);\n\t\t\t\tcmd->forwardmove -= cl_backspeed->value * CL_KeyState (&in_back);\n\t\t\t}\n\t\t}\t\n\n\t\t// adjust for speed key\n\t\tif ( in_speed.state & 1 )\n\t\t{\n\t\t\tcmd->forwardmove *= cl_movespeedkey->value;\n\t\t\tcmd->sidemove *= cl_movespeedkey->value;\n\t\t\tcmd->upmove *= cl_movespeedkey->value;\n\t\t}\n\n\t\t// clip to maxspeed\n\t\tspd = gEngfuncs.GetClientMaxspeed();\n\t\tif ( spd != 0.0 )\n\t\t{\n\t\t\t// scale the 3 speeds so that the total velocity is not > cl.maxspeed\n\t\t\tfloat fmov = sqrt( (cmd->forwardmove*cmd->forwardmove) + (cmd->sidemove*cmd->sidemove) + (cmd->upmove*cmd->upmove) );\n\n\t\t\tif ( fmov > spd )\n\t\t\t{\n\t\t\t\tfloat fratio = spd / fmov;\n\t\t\t\tcmd->forwardmove *= fratio;\n\t\t\t\tcmd->sidemove *= fratio;\n\t\t\t\tcmd->upmove *= fratio;\n\t\t\t}\n\t\t}\n\n\t\t// Allow mice and other controllers to add their inputs\n\t\tIN_Move ( frametime, cmd );\n\t}\n\n\tcmd->impulse = in_impulse;\n\tin_impulse = 0;\n\n\tcmd->weaponselect = g_weaponselect;\n\tg_weaponselect = 0;\n\t//\n\t// set button and flag bits\n\t//\n\tcmd->buttons = CL_ButtonBits( 1 );\n\n\t// If they're in a modal dialog, ignore the attack button.\n\tif ( GetClientVoice()->IsInSquelchMode() )\n\t\tcmd->buttons &= ~IN_ATTACK;\n\n\t// Using joystick?\n\tif ( in_joystick->value )\n\t{\n\t\tif ( cmd->forwardmove > 0 )\n\t\t{\n\t\t\tcmd->buttons |= IN_FORWARD;\n\t\t}\n\t\telse if ( cmd->forwardmove < 0 )\n\t\t{\n\t\t\tcmd->buttons |= IN_BACK;\n\t\t}\n\t}\n\n\tgEngfuncs.GetViewAngles( (float *)viewangles );\n\t// Set current view angles.\n\n\tif ( CL_IsDead() )\n\t{\n\t\tVectorCopy( oldangles, cmd->viewangles );\n\t}\n\telse\n\t{\n\t\tVectorCopy( viewangles, cmd->viewangles );\n\t\tVectorCopy( viewangles, oldangles );\n\t}\n\n}\n\n/*\n============\nCL_ButtonBits\n\nReturns appropriate button info for keyboard and mouse state\nSet bResetState to 1 to clear old state info\n============\n*/\nint CL_ButtonBits( int bResetState )\n{\n\tint bits = 0;\n\n\tif ( in_attack.state & 3 )\n\t{\n\t\tif(gHUD.m_MOTD.m_bShow)\n\t\t\tgHUD.m_MOTD.Reset();\n\t\telse\n\t\t\tbits |= IN_ATTACK;\n\t}\n\t\n\tif (in_duck.state & 3)\n\t{\n\t\tbits |= IN_DUCK;\n\t}\n \n\tif (in_jump.state & 3)\n\t{\n\t\tbits |= IN_JUMP;\n\t}\n\n\tif ( in_forward.state & 3 )\n\t{\n\t\tbits |= IN_FORWARD;\n\t}\n\t\n\tif (in_back.state & 3)\n\t{\n\t\tbits |= IN_BACK;\n\t}\n\n\tif (in_use.state & 3)\n\t{\n\t\tbits |= IN_USE;\n\t}\n\n\tif (in_cancel)\n\t{\n\t\tbits |= IN_CANCEL;\n\t}\n\n\tif ( in_left.state & 3 )\n\t{\n\t\tbits |= IN_LEFT;\n\t}\n\t\n\tif (in_right.state & 3)\n\t{\n\t\tbits |= IN_RIGHT;\n\t}\n\t\n\tif ( in_moveleft.state & 3 )\n\t{\n\t\tbits |= IN_MOVELEFT;\n\t}\n\t\n\tif (in_moveright.state & 3)\n\t{\n\t\tbits |= IN_MOVERIGHT;\n\t}\n\n\tif (in_attack2.state & 3)\n\t{\n\t\tbits |= IN_ATTACK2;\n\t}\n\n\tif (in_reload.state & 3)\n\t{\n\t\tbits |= IN_RELOAD;\n\t}\n\n\tif (in_alt1.state & 3)\n\t{\n\t\tbits |= IN_ALT1;\n\t}\n\n\tif ( in_score.state & 3 )\n\t{\n\t\tbits |= IN_SCORE;\n\t}\n\n\t// Intermission? Show scoreboard too\n\tif( gHUD.m_Scoreboard.ShouldDrawScoreboard( ))\n\t{\n\t\tbits |= IN_SCORE;\n\t}\n\n\tif ( bResetState )\n\t{\n\t\tin_attack.state &= ~2;\n\t\tin_duck.state &= ~2;\n\t\tin_jump.state &= ~2;\n\t\tin_forward.state &= ~2;\n\t\tin_back.state &= ~2;\n\t\tin_use.state &= ~2;\n\t\tin_left.state &= ~2;\n\t\tin_right.state &= ~2;\n\t\tin_moveleft.state &= ~2;\n\t\tin_moveright.state &= ~2;\n\t\tin_attack2.state &= ~2;\n\t\tin_reload.state &= ~2;\n\t\tin_alt1.state &= ~2;\n\t\tin_score.state &= ~2;\n\t}\n\n\treturn bits;\n}\n\n/*\n============\nCL_ResetButtonBits\n\n============\n*/\nvoid CL_ResetButtonBits( int bits )\n{\n\tint bitsNew = CL_ButtonBits( 0 ) ^ bits;\n\n\t// Has the attack button been changed\n\tif ( bitsNew & IN_ATTACK )\n\t{\n\t\t// Was it pressed? or let go?\n\t\tif ( bits & IN_ATTACK )\n\t\t{\n\t\t\tKeyDown( &in_attack );\n\t\t}\n\t\telse\n\t\t{\n\t\t\t// totally clear state\n\t\t\tin_attack.state &= ~7;\n\t\t}\n\t}\n}\n\n/*\n============\nInitInput\n============\n*/\nvoid InitInput (void)\n{\n\tgEngfuncs.pfnAddCommand (\"+moveup\",IN_UpDown);\n\tgEngfuncs.pfnAddCommand (\"-moveup\",IN_UpUp);\n\tgEngfuncs.pfnAddCommand (\"+movedown\",IN_DownDown);\n\tgEngfuncs.pfnAddCommand (\"-movedown\",IN_DownUp);\n\tgEngfuncs.pfnAddCommand (\"+left\",IN_LeftDown);\n\tgEngfuncs.pfnAddCommand (\"-left\",IN_LeftUp);\n\tgEngfuncs.pfnAddCommand (\"+right\",IN_RightDown);\n\tgEngfuncs.pfnAddCommand (\"-right\",IN_RightUp);\n\tgEngfuncs.pfnAddCommand (\"+forward\",IN_ForwardDown);\n\tgEngfuncs.pfnAddCommand (\"-forward\",IN_ForwardUp);\n\tgEngfuncs.pfnAddCommand (\"+back\",IN_BackDown);\n\tgEngfuncs.pfnAddCommand (\"-back\",IN_BackUp);\n\tgEngfuncs.pfnAddCommand (\"+lookup\", IN_LookupDown);\n\tgEngfuncs.pfnAddCommand (\"-lookup\", IN_LookupUp);\n\tgEngfuncs.pfnAddCommand (\"+lookdown\", IN_LookdownDown);\n\tgEngfuncs.pfnAddCommand (\"-lookdown\", IN_LookdownUp);\n\tgEngfuncs.pfnAddCommand (\"+strafe\", IN_StrafeDown);\n\tgEngfuncs.pfnAddCommand (\"-strafe\", IN_StrafeUp);\n\tgEngfuncs.pfnAddCommand (\"+moveleft\", IN_MoveleftDown);\n\tgEngfuncs.pfnAddCommand (\"-moveleft\", IN_MoveleftUp);\n\tgEngfuncs.pfnAddCommand (\"+moveright\", IN_MoverightDown);\n\tgEngfuncs.pfnAddCommand (\"-moveright\", IN_MoverightUp);\n\tgEngfuncs.pfnAddCommand (\"+speed\", IN_SpeedDown);\n\tgEngfuncs.pfnAddCommand (\"-speed\", IN_SpeedUp);\n\tgEngfuncs.pfnAddCommand (\"+attack\", IN_AttackDown);\n\tgEngfuncs.pfnAddCommand (\"-attack\", IN_AttackUp);\n\tgEngfuncs.pfnAddCommand (\"+attack2\", IN_Attack2Down);\n\tgEngfuncs.pfnAddCommand (\"-attack2\", IN_Attack2Up);\n\tgEngfuncs.pfnAddCommand (\"+use\", IN_UseDown);\n\tgEngfuncs.pfnAddCommand (\"-use\", IN_UseUp);\n\tgEngfuncs.pfnAddCommand (\"+jump\", IN_JumpDown);\n\tgEngfuncs.pfnAddCommand (\"-jump\", IN_JumpUp);\n\tgEngfuncs.pfnAddCommand (\"impulse\", IN_Impulse);\n\tgEngfuncs.pfnAddCommand (\"+klook\", IN_KLookDown);\n\tgEngfuncs.pfnAddCommand (\"-klook\", IN_KLookUp);\n\tgEngfuncs.pfnAddCommand (\"+mlook\", IN_MLookDown);\n\tgEngfuncs.pfnAddCommand (\"-mlook\", IN_MLookUp);\n\tgEngfuncs.pfnAddCommand (\"+jlook\", IN_JLookDown);\n\tgEngfuncs.pfnAddCommand (\"-jlook\", IN_JLookUp);\n\tgEngfuncs.pfnAddCommand (\"+duck\", IN_DuckDown);\n\tgEngfuncs.pfnAddCommand (\"-duck\", IN_DuckUp);\n\tgEngfuncs.pfnAddCommand (\"+reload\", IN_ReloadDown);\n\tgEngfuncs.pfnAddCommand (\"-reload\", IN_ReloadUp);\n\tgEngfuncs.pfnAddCommand (\"+alt1\", IN_Alt1Down);\n\tgEngfuncs.pfnAddCommand (\"-alt1\", IN_Alt1Up);\n\tgEngfuncs.pfnAddCommand (\"+score\", IN_ScoreDown);\n\tgEngfuncs.pfnAddCommand (\"-score\", IN_ScoreUp);\n\tgEngfuncs.pfnAddCommand (\"+graph\", IN_GraphDown);\n\tgEngfuncs.pfnAddCommand (\"-graph\", IN_GraphUp);\n\tgEngfuncs.pfnAddCommand (\"+break\",IN_BreakDown);\n\tgEngfuncs.pfnAddCommand (\"-break\",IN_BreakUp);\n\n\tlookstrafe\t\t\t= gEngfuncs.pfnRegisterVariable ( \"lookstrafe\", \"0\", FCVAR_ARCHIVE );\n\tlookspring\t\t\t= gEngfuncs.pfnRegisterVariable ( \"lookspring\", \"0\", FCVAR_ARCHIVE );\n\tcl_anglespeedkey\t= gEngfuncs.pfnRegisterVariable ( \"cl_anglespeedkey\", \"0.67\", 0 );\n\tcl_yawspeed\t\t\t= gEngfuncs.pfnRegisterVariable ( \"cl_yawspeed\", \"210\", 0 );\n\tcl_pitchspeed\t\t= gEngfuncs.pfnRegisterVariable ( \"cl_pitchspeed\", \"225\", 0 );\n\tcl_upspeed\t\t\t= gEngfuncs.pfnRegisterVariable ( \"cl_upspeed\", \"320\", 0 );\n\tcl_forwardspeed\t\t= gEngfuncs.pfnRegisterVariable ( \"cl_forwardspeed\", \"400\", FCVAR_ARCHIVE );\n\tcl_backspeed\t\t= gEngfuncs.pfnRegisterVariable ( \"cl_backspeed\", \"400\", FCVAR_ARCHIVE );\n\tcl_sidespeed\t\t= gEngfuncs.pfnRegisterVariable ( \"cl_sidespeed\", \"400\", 0 );\n\tcl_movespeedkey\t\t= gEngfuncs.pfnRegisterVariable ( \"cl_movespeedkey\", \"0.52\", 0 );\n\tcl_pitchup\t\t\t= gEngfuncs.pfnRegisterVariable ( \"cl_pitchup\", \"89\", 0 );\n\tcl_pitchdown\t\t= gEngfuncs.pfnRegisterVariable ( \"cl_pitchdown\", \"89\", 0 );\n\n\tcl_vsmoothing\t\t= gEngfuncs.pfnRegisterVariable ( \"cl_vsmoothing\", \"0.05\", FCVAR_ARCHIVE );\n\n\tm_pitch\t\t\t    = gEngfuncs.pfnRegisterVariable ( \"m_pitch\",\"0.022\", FCVAR_ARCHIVE );\n\tm_yaw\t\t\t\t= gEngfuncs.pfnRegisterVariable ( \"m_yaw\",\"0.022\", FCVAR_ARCHIVE );\n\tm_forward\t\t\t= gEngfuncs.pfnRegisterVariable ( \"m_forward\",\"1\", FCVAR_ARCHIVE );\n\tm_side\t\t\t\t= gEngfuncs.pfnRegisterVariable ( \"m_side\",\"0.8\", FCVAR_ARCHIVE );\n\n\t// Initialize third person camera controls.\n\tCAM_Init();\n\t// Initialize inputs\n\tIN_Init();\n\t// Initialize keyboard\n\tKB_Init();\n\t// Initialize view system\n\tV_Init();\n}\n\n/*\n============\nInput_Shutdown\n============\n*/\nvoid Input_Shutdown (void)\n{\n\tIN_Shutdown();\n\tKB_Shutdown();\n}\n"
  },
  {
    "path": "cl_dll/inputw32.cpp",
    "content": "//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============\n//\n// Purpose: \n//\n// $NoKeywords: $\n//=============================================================================\n\n// in_win.c -- windows 95 mouse and joystick code\n// 02/21/97 JCB Added extended DirectInput code to support external controllers.\n\n#include \"hud.h\"\n#include \"cl_util.h\"\n#include \"camera.h\"\n#include \"kbutton.h\"\n#include \"cvardef.h\"\n#include \"usercmd.h\"\n#include \"const.h\"\n#include \"camera.h\"\n#include \"in_defs.h\"\n#include \"../engine/keydefs.h\"\n#include \"view.h\"\n#include \"port.h\"\n\n#define MOUSE_BUTTON_COUNT 5\n\n// Set this to 1 to show mouse cursor.  Experimental\nint\tg_iVisibleMouse = 0;\n\nextern \"C\" \n{\n\tvoid DLLEXPORT IN_ActivateMouse( void );\n\tvoid DLLEXPORT IN_DeactivateMouse( void );\n\tvoid DLLEXPORT IN_MouseEvent (int mstate);\n\tvoid DLLEXPORT IN_Accumulate (void);\n\tvoid DLLEXPORT IN_ClearStates (void);\n}\n\nextern cl_enginefunc_t gEngfuncs;\n\nextern int iMouseInUse;\n\nextern kbutton_t\tin_strafe;\nextern kbutton_t\tin_mlook;\nextern kbutton_t\tin_speed;\nextern kbutton_t\tin_jlook;\n\nextern cvar_t\t*m_pitch;\nextern cvar_t\t*m_yaw;\nextern cvar_t\t*m_forward;\nextern cvar_t\t*m_side;\n\nextern cvar_t *lookstrafe;\nextern cvar_t *lookspring;\nextern cvar_t *cl_pitchdown;\nextern cvar_t *cl_pitchup;\nextern cvar_t *cl_yawspeed;\nextern cvar_t *cl_sidespeed;\nextern cvar_t *cl_forwardspeed;\nextern cvar_t *cl_pitchspeed;\nextern cvar_t *cl_movespeedkey;\n\n// mouse variables\ncvar_t\t\t*m_filter;\ncvar_t\t\t*sensitivity;\n\nint\t\t\tmouse_buttons;\nint\t\t\tmouse_oldbuttonstate;\nPOINT\t\tcurrent_pos;\nint\t\t\tmouse_x, mouse_y, old_mouse_x, old_mouse_y, mx_accum, my_accum;\n\nstatic int\trestore_spi;\nstatic int\toriginalmouseparms[3], newmouseparms[3] = {0, 0, 1};\nstatic int\tmouseactive;\nint\t\t\tmouseinitialized;\nstatic int\tmouseparmsvalid;\nstatic int\tmouseshowtoggle = 1;\n\n// joystick defines and variables\n// where should defines be moved?\n#define JOY_ABSOLUTE_AXIS\t0x00000000\t\t// control like a joystick\n#define JOY_RELATIVE_AXIS\t0x00000010\t\t// control like a mouse, spinner, trackball\n#define\tJOY_MAX_AXES\t\t6\t\t\t\t// X, Y, Z, R, U, V\n#define JOY_AXIS_X\t\t\t0\n#define JOY_AXIS_Y\t\t\t1\n#define JOY_AXIS_Z\t\t\t2\n#define JOY_AXIS_R\t\t\t3\n#define JOY_AXIS_U\t\t\t4\n#define JOY_AXIS_V\t\t\t5\n\nenum _ControlList\n{\n\tAxisNada = 0,\n\tAxisForward,\n\tAxisLook,\n\tAxisSide,\n\tAxisTurn\n};\n\nDWORD dwAxisFlags[JOY_MAX_AXES] =\n{\n\tJOY_RETURNX,\n\tJOY_RETURNY,\n\tJOY_RETURNZ,\n\tJOY_RETURNR,\n\tJOY_RETURNU,\n\tJOY_RETURNV\n};\n\nDWORD\tdwAxisMap[ JOY_MAX_AXES ];\nDWORD\tdwControlMap[ JOY_MAX_AXES ];\nPDWORD\tpdwRawValue[ JOY_MAX_AXES ];\n\n// none of these cvars are saved over a session\n// this means that advanced controller configuration needs to be executed\n// each time.  this avoids any problems with getting back to a default usage\n// or when changing from one controller to another.  this way at least something\n// works.\ncvar_t\t*in_joystick;\ncvar_t\t*joy_name;\ncvar_t\t*joy_advanced;\ncvar_t\t*joy_advaxisx;\ncvar_t\t*joy_advaxisy;\ncvar_t\t*joy_advaxisz;\ncvar_t\t*joy_advaxisr;\ncvar_t\t*joy_advaxisu;\ncvar_t\t*joy_advaxisv;\ncvar_t\t*joy_forwardthreshold;\ncvar_t\t*joy_sidethreshold;\ncvar_t\t*joy_pitchthreshold;\ncvar_t\t*joy_yawthreshold;\ncvar_t\t*joy_forwardsensitivity;\ncvar_t\t*joy_sidesensitivity;\ncvar_t\t*joy_pitchsensitivity;\ncvar_t\t*joy_yawsensitivity;\ncvar_t\t*joy_wwhack1;\ncvar_t\t*joy_wwhack2;\n\nint\t\t\tjoy_avail, joy_advancedinit, joy_haspov;\nDWORD\t\tjoy_oldbuttonstate, joy_oldpovstate;\n\nint\t\t\tjoy_id;\nDWORD\t\tjoy_flags;\nDWORD\t\tjoy_numbuttons;\n\nstatic JOYINFOEX\tji;\n\n/*\n===========\nForce_CenterView_f\n===========\n*/\nvoid Force_CenterView_f (void)\n{\n\tvec3_t viewangles;\n\n\tif (!iMouseInUse)\n\t{\n\t\tgEngfuncs.GetViewAngles( (float *)viewangles );\n\t    viewangles[PITCH] = 0;\n\t\tgEngfuncs.SetViewAngles( (float *)viewangles );\n\t}\n}\n\n/*\n===========\nIN_ActivateMouse\n===========\n*/\nvoid DLLEXPORT IN_ActivateMouse (void)\n{\n\tif (mouseinitialized)\n\t{\n\t\tif (mouseparmsvalid)\n\t\t\trestore_spi = SystemParametersInfo (SPI_SETMOUSE, 0, newmouseparms, 0);\n\t\tmouseactive = 1;\n\t}\n}\n\n/*\n===========\nIN_DeactivateMouse\n===========\n*/\nvoid DLLEXPORT IN_DeactivateMouse (void)\n{\n\tif (mouseinitialized)\n\t{\n\t\tif (restore_spi)\n\t\t\tSystemParametersInfo (SPI_SETMOUSE, 0, originalmouseparms, 0);\n\n\t\tmouseactive = 0;\n\t}\n}\n\n/*\n===========\nIN_StartupMouse\n===========\n*/\nvoid IN_StartupMouse (void)\n{\n\tif ( gEngfuncs.CheckParm (\"-nomouse\", NULL ) ) \n\t\treturn; \n\n\tmouseinitialized = 1;\n\tmouseparmsvalid = SystemParametersInfo (SPI_GETMOUSE, 0, originalmouseparms, 0);\n\n\tif (mouseparmsvalid)\n\t{\n\t\tif ( gEngfuncs.CheckParm (\"-noforcemspd\", NULL ) ) \n\t\t\tnewmouseparms[2] = originalmouseparms[2];\n\n\t\tif ( gEngfuncs.CheckParm (\"-noforcemaccel\", NULL ) ) \n\t\t{\n\t\t\tnewmouseparms[0] = originalmouseparms[0];\n\t\t\tnewmouseparms[1] = originalmouseparms[1];\n\t\t}\n\n\t\tif ( gEngfuncs.CheckParm (\"-noforcemparms\", NULL ) ) \n\t\t{\n\t\t\tnewmouseparms[0] = originalmouseparms[0];\n\t\t\tnewmouseparms[1] = originalmouseparms[1];\n\t\t\tnewmouseparms[2] = originalmouseparms[2];\n\t\t}\n\t}\n\n\tmouse_buttons = MOUSE_BUTTON_COUNT;\n}\n\n/*\n===========\nIN_Shutdown\n===========\n*/\nvoid IN_Shutdown (void)\n{\n\tIN_DeactivateMouse ();\n}\n\n/*\n===========\nIN_GetMousePos\n\nAsk for mouse position from engine\n===========\n*/\nvoid IN_GetMousePos( int *mx, int *my )\n{\n\tgEngfuncs.GetMousePosition( mx, my );\n}\n\n/*\n===========\nIN_ResetMouse\n\nFIXME: Call through to engine?\n===========\n*/\nvoid IN_ResetMouse( void )\n{\n\tSetCursorPos ( gEngfuncs.GetWindowCenterX(), gEngfuncs.GetWindowCenterY() );\t\n}\n\n/*\n===========\nIN_MouseEvent\n===========\n*/\nvoid DLLEXPORT IN_MouseEvent (int mstate)\n{\n\tint\t\ti;\n\n\tif ( iMouseInUse || g_iVisibleMouse )\n\t\treturn;\n\n\t// perform button actions\n\tfor (i=0 ; i<mouse_buttons ; i++)\n\t{\n\t\tif ( (mstate & (1<<i)) &&\n\t\t\t!(mouse_oldbuttonstate & (1<<i)) )\n\t\t{\n\t\t\tgEngfuncs.Key_Event (K_MOUSE1 + i, 1);\n\t\t}\n\n\t\tif ( !(mstate & (1<<i)) &&\n\t\t\t(mouse_oldbuttonstate & (1<<i)) )\n\t\t{\n\t\t\tgEngfuncs.Key_Event (K_MOUSE1 + i, 0);\n\t\t}\n\t}\t\n\t\n\tmouse_oldbuttonstate = mstate;\n}\n\n/*\n===========\nIN_MouseMove\n===========\n*/\nvoid IN_MouseMove ( float frametime, usercmd_t *cmd)\n{\n\tint\t\tmx, my;\n\tvec3_t viewangles;\n\n\tgEngfuncs.GetViewAngles( (float *)viewangles );\n\n#if 0\n\tif ( in_mlook.state & 1)\n\t{\n\t\tV_StopPitchDrift ();\n\t}\n#endif\n\n\t//jjb - this disbles normal mouse control if the user is trying to \n\t//      move the camera, or if the mouse cursor is visible or if we're in intermission\n\tif ( !iMouseInUse && !g_iVisibleMouse && !gHUD.m_iIntermission )\n\t{\n\t\tGetCursorPos (&current_pos);\n\n\t\tmx = current_pos.x - gEngfuncs.GetWindowCenterX() + mx_accum;\n\t\tmy = current_pos.y - gEngfuncs.GetWindowCenterY() + my_accum;\n\n\t\tmx_accum = 0;\n\t\tmy_accum = 0;\n\n\t\tif (m_filter->value)\n\t\t{\n\t\t\tmouse_x = (mx + old_mouse_x) * 0.5;\n\t\t\tmouse_y = (my + old_mouse_y) * 0.5;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tmouse_x = mx;\n\t\t\tmouse_y = my;\n\t\t}\n\n\t\told_mouse_x = mx;\n\t\told_mouse_y = my;\n\n\t\tif ( gHUD.GetSensitivity() != 0 )\n\t\t{\n\t\t\tmouse_x *= gHUD.GetSensitivity();\n\t\t\tmouse_y *= gHUD.GetSensitivity();\n\t\t}\n\t\telse\n\t\t{\n\t\t\tmouse_x *= sensitivity->value;\n\t\t\tmouse_y *= sensitivity->value;\n\t\t}\n\n\t\t// add mouse X/Y movement to cmd\n\t\tif ( (in_strafe.state & 1) || (lookstrafe->value && (in_mlook.state & 1) ))\n\t\t\tcmd->sidemove += m_side->value * mouse_x;\n\t\telse\n\t\t\tviewangles[YAW] -= m_yaw->value * mouse_x;\n\n\t\tif ( (in_mlook.state & 1) && !(in_strafe.state & 1))\n\t\t{\n\t\t\tviewangles[PITCH] += m_pitch->value * mouse_y;\n\t\t\tif (viewangles[PITCH] > cl_pitchdown->value)\n\t\t\t\tviewangles[PITCH] = cl_pitchdown->value;\n\t\t\tif (viewangles[PITCH] < -cl_pitchup->value)\n\t\t\t\tviewangles[PITCH] = -cl_pitchup->value;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif ((in_strafe.state & 1) && gEngfuncs.IsNoClipping() )\n\t\t\t{\n\t\t\t\tcmd->upmove -= m_forward->value * mouse_y;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tcmd->forwardmove -= m_forward->value * mouse_y;\n\t\t\t}\n\t\t}\n\n\t\t// if the mouse has moved, force it to the center, so there's room to move\n\t\tif ( mx || my )\n\t\t{\n\t\t\tIN_ResetMouse();\n\t\t}\n\t}\n\n\tgEngfuncs.SetViewAngles( (float *)viewangles );\n\n/*\n//#define TRACE_TEST\n#if defined( TRACE_TEST )\n\t{\n\t\tint mx, my;\n\t\tvoid V_Move( int mx, int my );\n\t\tIN_GetMousePos( &mx, &my );\n\t\tV_Move( mx, my );\n\t}\n#endif\n*/\n}\n\n/*\n===========\nIN_Accumulate\n===========\n*/\nvoid DLLEXPORT IN_Accumulate (void)\n{\n\t//only accumulate mouse if we are not moving the camera with the mouse\n\tif ( !iMouseInUse && !g_iVisibleMouse )\n\t{\n\t    if (mouseactive)\n\t    {\n\t\t\tGetCursorPos (&current_pos);\n\n\t\t\tmx_accum += current_pos.x - gEngfuncs.GetWindowCenterX();\n\t\t\tmy_accum += current_pos.y - gEngfuncs.GetWindowCenterY();\n\n\t\t\t// force the mouse to the center, so there's room to move\n\t\t\tIN_ResetMouse();\n\t\t}\n\t}\n\n}\n\n/*\n===================\nIN_ClearStates\n===================\n*/\nvoid DLLEXPORT IN_ClearStates (void)\n{\n\tif ( !mouseactive )\n\t\treturn;\n\n\tmx_accum = 0;\n\tmy_accum = 0;\n\tmouse_oldbuttonstate = 0;\n}\n\n/* \n=============== \nIN_StartupJoystick \n=============== \n*/  \nvoid IN_StartupJoystick (void) \n{ \n\tint\t\t\tnumdevs;\n\tJOYCAPS\t\tjc;\n\tMMRESULT\tmmr;\n \n \t// assume no joystick\n\tjoy_avail = 0; \n\n\t// abort startup if user requests no joystick\n\tif ( gEngfuncs.CheckParm (\"-nojoy\", NULL ) ) \n\t\treturn; \n \n\t// verify joystick driver is present\n\tif ((numdevs = joyGetNumDevs ()) == 0)\n\t{\n\t\tgEngfuncs.Con_DPrintf (\"joystick not found -- driver not present\\n\\n\");\n\t\treturn;\n\t}\n\n\t// cycle through the joystick ids for the first valid one\n\tfor (joy_id=0 ; joy_id<numdevs ; joy_id++)\n\t{\n\t\tmemset (&ji, 0, sizeof(ji));\n\t\tji.dwSize = sizeof(ji);\n\t\tji.dwFlags = JOY_RETURNCENTERED;\n\n\t\tif ((mmr = joyGetPosEx (joy_id, &ji)) == JOYERR_NOERROR)\n\t\t\tbreak;\n\t} \n\n\t// abort startup if we didn't find a valid joystick\n\tif (mmr != JOYERR_NOERROR)\n\t{\n\t\tgEngfuncs.Con_DPrintf (\"joystick not found -- no valid joysticks (%x)\\n\\n\", mmr);\n\t\treturn;\n\t}\n\n\t// get the capabilities of the selected joystick\n\t// abort startup if command fails\n\tmemset (&jc, 0, sizeof(jc));\n\tif ((mmr = joyGetDevCaps (joy_id, &jc, sizeof(jc))) != JOYERR_NOERROR)\n\t{\n\t\tgEngfuncs.Con_DPrintf (\"joystick not found -- invalid joystick capabilities (%x)\\n\\n\", mmr); \n\t\treturn;\n\t}\n\n\t// save the joystick's number of buttons and POV status\n\tjoy_numbuttons = jc.wNumButtons;\n\tjoy_haspov = jc.wCaps & JOYCAPS_HASPOV;\n\n\t// old button and POV states default to no buttons pressed\n\tjoy_oldbuttonstate = joy_oldpovstate = 0;\n\n\t// mark the joystick as available and advanced initialization not completed\n\t// this is needed as cvars are not available during initialization\n\tgEngfuncs.Con_Printf (\"joystick found\\n\\n\", mmr); \n\tjoy_avail = 1; \n\tjoy_advancedinit = 0;\n}\n\n\n/*\n===========\nRawValuePointer\n===========\n*/\nPDWORD RawValuePointer (int axis)\n{\n\tswitch (axis)\n\t{\n\tcase JOY_AXIS_X:\n\t\treturn &ji.dwXpos;\n\tcase JOY_AXIS_Y:\n\t\treturn &ji.dwYpos;\n\tcase JOY_AXIS_Z:\n\t\treturn &ji.dwZpos;\n\tcase JOY_AXIS_R:\n\t\treturn &ji.dwRpos;\n\tcase JOY_AXIS_U:\n\t\treturn &ji.dwUpos;\n\tcase JOY_AXIS_V:\n\t\treturn &ji.dwVpos;\n\t}\n\t// FIX: need to do some kind of error\n\treturn &ji.dwXpos;\n}\n\n\n/*\n===========\nJoy_AdvancedUpdate_f\n===========\n*/\nvoid Joy_AdvancedUpdate_f (void)\n{\n\n\t// called once by IN_ReadJoystick and by user whenever an update is needed\n\t// cvars are now available\n\tint\ti;\n\tDWORD dwTemp;\n\n\t// initialize all the maps\n\tfor (i = 0; i < JOY_MAX_AXES; i++)\n\t{\n\t\tdwAxisMap[i] = AxisNada;\n\t\tdwControlMap[i] = JOY_ABSOLUTE_AXIS;\n\t\tpdwRawValue[i] = RawValuePointer(i);\n\t}\n\n\tif( joy_advanced->value == 0.0)\n\t{\n\t\t// default joystick initialization\n\t\t// 2 axes only with joystick control\n\t\tdwAxisMap[JOY_AXIS_X] = AxisTurn;\n\t\t// dwControlMap[JOY_AXIS_X] = JOY_ABSOLUTE_AXIS;\n\t\tdwAxisMap[JOY_AXIS_Y] = AxisForward;\n\t\t// dwControlMap[JOY_AXIS_Y] = JOY_ABSOLUTE_AXIS;\n\t}\n\telse\n\t{\n\t\tif ( strcmp ( joy_name->string, \"joystick\") != 0 )\n\t\t{\n\t\t\t// notify user of advanced controller\n\t\t\tgEngfuncs.Con_Printf (\"\\n%s configured\\n\\n\", joy_name->string);\n\t\t}\n\n\t\t// advanced initialization here\n\t\t// data supplied by user via joy_axisn cvars\n\t\tdwTemp = (DWORD) joy_advaxisx->value;\n\t\tdwAxisMap[JOY_AXIS_X] = dwTemp & 0x0000000f;\n\t\tdwControlMap[JOY_AXIS_X] = dwTemp & JOY_RELATIVE_AXIS;\n\t\tdwTemp = (DWORD) joy_advaxisy->value;\n\t\tdwAxisMap[JOY_AXIS_Y] = dwTemp & 0x0000000f;\n\t\tdwControlMap[JOY_AXIS_Y] = dwTemp & JOY_RELATIVE_AXIS;\n\t\tdwTemp = (DWORD) joy_advaxisz->value;\n\t\tdwAxisMap[JOY_AXIS_Z] = dwTemp & 0x0000000f;\n\t\tdwControlMap[JOY_AXIS_Z] = dwTemp & JOY_RELATIVE_AXIS;\n\t\tdwTemp = (DWORD) joy_advaxisr->value;\n\t\tdwAxisMap[JOY_AXIS_R] = dwTemp & 0x0000000f;\n\t\tdwControlMap[JOY_AXIS_R] = dwTemp & JOY_RELATIVE_AXIS;\n\t\tdwTemp = (DWORD) joy_advaxisu->value;\n\t\tdwAxisMap[JOY_AXIS_U] = dwTemp & 0x0000000f;\n\t\tdwControlMap[JOY_AXIS_U] = dwTemp & JOY_RELATIVE_AXIS;\n\t\tdwTemp = (DWORD) joy_advaxisv->value;\n\t\tdwAxisMap[JOY_AXIS_V] = dwTemp & 0x0000000f;\n\t\tdwControlMap[JOY_AXIS_V] = dwTemp & JOY_RELATIVE_AXIS;\n\t}\n\n\t// compute the axes to collect from DirectInput\n\tjoy_flags = JOY_RETURNCENTERED | JOY_RETURNBUTTONS | JOY_RETURNPOV;\n\tfor (i = 0; i < JOY_MAX_AXES; i++)\n\t{\n\t\tif (dwAxisMap[i] != AxisNada)\n\t\t{\n\t\t\tjoy_flags |= dwAxisFlags[i];\n\t\t}\n\t}\n}\n\n\n/*\n===========\nIN_Commands\n===========\n*/\nvoid IN_Commands (void)\n{\n\tint\t\ti, key_index;\n\tDWORD\tbuttonstate, povstate;\n\n\tif (!joy_avail)\n\t{\n\t\treturn;\n\t}\n\n\t\n\t// loop through the joystick buttons\n\t// key a joystick event or auxiliary event for higher number buttons for each state change\n\tbuttonstate = ji.dwButtons;\n\tfor (i=0 ; i < (int)joy_numbuttons ; i++)\n\t{\n\t\tif ( (buttonstate & (1<<i)) && !(joy_oldbuttonstate & (1<<i)) )\n\t\t{\n\t\t\tkey_index = (i < 4) ? K_JOY1 : K_AUX1;\n\t\t\tgEngfuncs.Key_Event (key_index + i, 1);\n\t\t}\n\n\t\tif ( !(buttonstate & (1<<i)) && (joy_oldbuttonstate & (1<<i)) )\n\t\t{\n\t\t\tkey_index = (i < 4) ? K_JOY1 : K_AUX1;\n\t\t\tgEngfuncs.Key_Event (key_index + i, 0);\n\t\t}\n\t}\n\tjoy_oldbuttonstate = buttonstate;\n\n\tif (joy_haspov)\n\t{\n\t\t// convert POV information into 4 bits of state information\n\t\t// this avoids any potential problems related to moving from one\n\t\t// direction to another without going through the center position\n\t\tpovstate = 0;\n\t\tif(ji.dwPOV != JOY_POVCENTERED)\n\t\t{\n\t\t\tif (ji.dwPOV == JOY_POVFORWARD)\n\t\t\t\tpovstate |= 0x01;\n\t\t\tif (ji.dwPOV == JOY_POVRIGHT)\n\t\t\t\tpovstate |= 0x02;\n\t\t\tif (ji.dwPOV == JOY_POVBACKWARD)\n\t\t\t\tpovstate |= 0x04;\n\t\t\tif (ji.dwPOV == JOY_POVLEFT)\n\t\t\t\tpovstate |= 0x08;\n\t\t}\n\t\t// determine which bits have changed and key an auxiliary event for each change\n\t\tfor (i=0 ; i < 4 ; i++)\n\t\t{\n\t\t\tif ( (povstate & (1<<i)) && !(joy_oldpovstate & (1<<i)) )\n\t\t\t{\n\t\t\t\tgEngfuncs.Key_Event (K_AUX29 + i, 1);\n\t\t\t}\n\n\t\t\tif ( !(povstate & (1<<i)) && (joy_oldpovstate & (1<<i)) )\n\t\t\t{\n\t\t\t\tgEngfuncs.Key_Event (K_AUX29 + i, 0);\n\t\t\t}\n\t\t}\n\t\tjoy_oldpovstate = povstate;\n\t}\n}\n\n\n/* \n=============== \nIN_ReadJoystick\n=============== \n*/  \nint IN_ReadJoystick (void)\n{\n\n\tmemset (&ji, 0, sizeof(ji));\n\tji.dwSize = sizeof(ji);\n\tji.dwFlags = joy_flags;\n\n\tif (joyGetPosEx (joy_id, &ji) == JOYERR_NOERROR)\n\t{\n\t\t// this is a hack -- there is a bug in the Logitech WingMan Warrior DirectInput Driver\n\t\t// rather than having 32768 be the zero point, they have the zero point at 32668\n\t\t// go figure -- anyway, now we get the full resolution out of the device\n\t\tif (joy_wwhack1->value != 0.0)\n\t\t{\n\t\t\tji.dwUpos += 100;\n\t\t}\n\t\treturn 1;\n\t}\n\telse\n\t{\n\t\t// read error occurred\n\t\t// turning off the joystick seems too harsh for 1 read error,\\\n\t\t// but what should be done?\n\t\t// Con_Printf (\"IN_ReadJoystick: no response\\n\");\n\t\t// joy_avail = 0;\n\t\treturn 0;\n\t}\n}\n\n\n/*\n===========\nIN_JoyMove\n===========\n*/\nvoid IN_JoyMove ( float frametime, usercmd_t *cmd )\n{\n\tfloat\tspeed, aspeed;\n\tfloat\tfAxisValue, fTemp;\n\tint\t\ti;\n\tvec3_t viewangles;\n\n\tgEngfuncs.GetViewAngles( (float *)viewangles );\n\n\n\t// complete initialization if first time in\n\t// this is needed as cvars are not available at initialization time\n\tif( joy_advancedinit != 1 )\n\t{\n\t\tJoy_AdvancedUpdate_f();\n\t\tjoy_advancedinit = 1;\n\t}\n\n\t// verify joystick is available and that the user wants to use it\n\tif (!joy_avail || !in_joystick->value)\n\t{\n\t\treturn; \n\t}\n \n\t// collect the joystick data, if possible\n\tif (IN_ReadJoystick () != 1)\n\t{\n\t\treturn;\n\t}\n\n\tif (in_speed.state & 1)\n\t\tspeed = cl_movespeedkey->value;\n\telse\n\t\tspeed = 1;\n\n\taspeed = speed * frametime;\n\n\t// loop through the axes\n\tfor (i = 0; i < JOY_MAX_AXES; i++)\n\t{\n\t\t// get the floating point zero-centered, potentially-inverted data for the current axis\n\t\tfAxisValue = (float) *pdwRawValue[i];\n\t\t// move centerpoint to zero\n\t\tfAxisValue -= 32768.0;\n\n\t\tif (joy_wwhack2->value != 0.0)\n\t\t{\n\t\t\tif (dwAxisMap[i] == AxisTurn)\n\t\t\t{\n\t\t\t\t// this is a special formula for the Logitech WingMan Warrior\n\t\t\t\t// y=ax^b; where a = 300 and b = 1.3\n\t\t\t\t// also x values are in increments of 800 (so this is factored out)\n\t\t\t\t// then bounds check result to level out excessively high spin rates\n\t\t\t\tfTemp = 300.0 * powf(fabs(fAxisValue) / 800.0, 1.3);\n\t\t\t\tif (fTemp > 14000.0)\n\t\t\t\t\tfTemp = 14000.0;\n\t\t\t\t// restore direction information\n\t\t\t\tfAxisValue = (fAxisValue > 0.0) ? fTemp : -fTemp;\n\t\t\t}\n\t\t}\n\n\t\t// convert range from -32768..32767 to -1..1 \n\t\tfAxisValue /= 32768.0;\n\n\t\tswitch (dwAxisMap[i])\n\t\t{\n\t\tcase AxisForward:\n\t\t\tif ((joy_advanced->value == 0.0) && (in_jlook.state & 1))\n\t\t\t{\n\t\t\t\t// user wants forward control to become look control\n\t\t\t\tif (fabs(fAxisValue) > joy_pitchthreshold->value)\n\t\t\t\t{\t\t\n\t\t\t\t\t// if mouse invert is on, invert the joystick pitch value\n\t\t\t\t\t// only absolute control support here (joy_advanced is 0)\n\t\t\t\t\tif (m_pitch->value < 0.0)\n\t\t\t\t\t{\n\t\t\t\t\t\tviewangles[PITCH] -= (fAxisValue * joy_pitchsensitivity->value) * aspeed * cl_pitchspeed->value;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tviewangles[PITCH] += (fAxisValue * joy_pitchsensitivity->value) * aspeed * cl_pitchspeed->value;\n\t\t\t\t\t}\n#if 0\n\t\t\t\t\tV_StopPitchDrift();\n#endif\n\t\t\t\t}\n#if 0\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t// no pitch movement\n\t\t\t\t\t// disable pitch return-to-center unless requested by user\n\t\t\t\t\t// *** this code can be removed when the lookspring bug is fixed\n\t\t\t\t\t// *** the bug always has the lookspring feature on\n\t\t\t\t\tif(lookspring->value == 0.0)\n\t\t\t\t\t{\n\t\t\t\t\t\tV_StopPitchDrift();\n\t\t\t\t\t}\n\t\t\t\t}\n#endif\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t// user wants forward control to be forward control\n\t\t\t\tif (fabs(fAxisValue) > joy_forwardthreshold->value)\n\t\t\t\t{\n\t\t\t\t\tcmd->forwardmove += (fAxisValue * joy_forwardsensitivity->value) * speed * cl_forwardspeed->value;\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak;\n\n\t\tcase AxisSide:\n\t\t\tif (fabs(fAxisValue) > joy_sidethreshold->value)\n\t\t\t{\n\t\t\t\tcmd->sidemove += (fAxisValue * joy_sidesensitivity->value) * speed * cl_sidespeed->value;\n\t\t\t}\n\t\t\tbreak;\n\n\t\tcase AxisTurn:\n\t\t\tif ((in_strafe.state & 1) || (lookstrafe->value && (in_jlook.state & 1)))\n\t\t\t{\n\t\t\t\t// user wants turn control to become side control\n\t\t\t\tif (fabs(fAxisValue) > joy_sidethreshold->value)\n\t\t\t\t{\n\t\t\t\t\tcmd->sidemove -= (fAxisValue * joy_sidesensitivity->value) * speed * cl_sidespeed->value;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t// user wants turn control to be turn control\n\t\t\t\tif (fabs(fAxisValue) > joy_yawthreshold->value)\n\t\t\t\t{\n\t\t\t\t\tif(dwControlMap[i] == JOY_ABSOLUTE_AXIS)\n\t\t\t\t\t{\n\t\t\t\t\t\tviewangles[YAW] += (fAxisValue * joy_yawsensitivity->value) * aspeed * cl_yawspeed->value;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tviewangles[YAW] += (fAxisValue * joy_yawsensitivity->value) * speed * 180.0;\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak;\n\n\t\tcase AxisLook:\n\t\t\tif (in_jlook.state & 1)\n\t\t\t{\n\t\t\t\tif (fabs(fAxisValue) > joy_pitchthreshold->value)\n\t\t\t\t{\n\t\t\t\t\t// pitch movement detected and pitch movement desired by user\n\t\t\t\t\tif(dwControlMap[i] == JOY_ABSOLUTE_AXIS)\n\t\t\t\t\t{\n\t\t\t\t\t\tviewangles[PITCH] += (fAxisValue * joy_pitchsensitivity->value) * aspeed * cl_pitchspeed->value;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tviewangles[PITCH] += (fAxisValue * joy_pitchsensitivity->value) * speed * 180.0;\n\t\t\t\t\t}\n#if 0\n\t\t\t\t\tV_StopPitchDrift();\n#endif\n\t\t\t\t}\n#if 0\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t// no pitch movement\n\t\t\t\t\t// disable pitch return-to-center unless requested by user\n\t\t\t\t\t// *** this code can be removed when the lookspring bug is fixed\n\t\t\t\t\t// *** the bug always has the lookspring feature on\n\t\t\t\t\tif( lookspring->value == 0.0 )\n\t\t\t\t\t{\n\t\t\t\t\t\tV_StopPitchDrift();\n\t\t\t\t\t}\n\t\t\t\t}\n#endif\n\t\t\t}\n\t\t\tbreak;\n\n\t\tdefault:\n\t\t\tbreak;\n\t\t}\n\t}\n\n\t// bounds check pitch\n\tif (viewangles[PITCH] > cl_pitchdown->value)\n\t\tviewangles[PITCH] = cl_pitchdown->value;\n\tif (viewangles[PITCH] < -cl_pitchup->value)\n\t\tviewangles[PITCH] = -cl_pitchup->value;\n\n\tgEngfuncs.SetViewAngles( (float *)viewangles );\n\n}\n\n/*\n===========\nIN_Move\n===========\n*/\nvoid IN_Move ( float frametime, usercmd_t *cmd)\n{\n\tif ( !iMouseInUse && mouseactive )\n\t{\n\t\tIN_MouseMove ( frametime, cmd);\n\t}\n\n\tIN_JoyMove ( frametime, cmd);\n}\n\n/*\n===========\nIN_Init\n===========\n*/\nvoid IN_Init (void)\n{\n\tm_filter\t\t\t\t= gEngfuncs.pfnRegisterVariable ( \"m_filter\",\"0\", FCVAR_ARCHIVE );\n\tsensitivity\t\t\t\t= gEngfuncs.pfnRegisterVariable ( \"sensitivity\",\"3\", FCVAR_ARCHIVE ); // user mouse sensitivity setting.\n\n\tin_joystick\t\t\t\t= gEngfuncs.pfnRegisterVariable ( \"joystick\",\"0\", FCVAR_ARCHIVE );\n\tjoy_name\t\t\t\t= gEngfuncs.pfnRegisterVariable ( \"joyname\", \"joystick\", 0 );\n\tjoy_advanced\t\t\t= gEngfuncs.pfnRegisterVariable ( \"joyadvanced\", \"0\", 0 );\n\tjoy_advaxisx\t\t\t= gEngfuncs.pfnRegisterVariable ( \"joyadvaxisx\", \"0\", 0 );\n\tjoy_advaxisy\t\t\t= gEngfuncs.pfnRegisterVariable ( \"joyadvaxisy\", \"0\", 0 );\n\tjoy_advaxisz\t\t\t= gEngfuncs.pfnRegisterVariable ( \"joyadvaxisz\", \"0\", 0 );\n\tjoy_advaxisr\t\t\t= gEngfuncs.pfnRegisterVariable ( \"joyadvaxisr\", \"0\", 0 );\n\tjoy_advaxisu\t\t\t= gEngfuncs.pfnRegisterVariable ( \"joyadvaxisu\", \"0\", 0 );\n\tjoy_advaxisv\t\t\t= gEngfuncs.pfnRegisterVariable ( \"joyadvaxisv\", \"0\", 0 );\n\tjoy_forwardthreshold\t= gEngfuncs.pfnRegisterVariable ( \"joyforwardthreshold\", \"0.15\", 0 );\n\tjoy_sidethreshold\t\t= gEngfuncs.pfnRegisterVariable ( \"joysidethreshold\", \"0.15\", 0 );\n\tjoy_pitchthreshold\t\t= gEngfuncs.pfnRegisterVariable ( \"joypitchthreshold\", \"0.15\", 0 );\n\tjoy_yawthreshold\t\t= gEngfuncs.pfnRegisterVariable ( \"joyyawthreshold\", \"0.15\", 0 );\n\tjoy_forwardsensitivity\t= gEngfuncs.pfnRegisterVariable ( \"joyforwardsensitivity\", \"-1.0\", 0 );\n\tjoy_sidesensitivity\t\t= gEngfuncs.pfnRegisterVariable ( \"joysidesensitivity\", \"-1.0\", 0 );\n\tjoy_pitchsensitivity\t= gEngfuncs.pfnRegisterVariable ( \"joypitchsensitivity\", \"1.0\", 0 );\n\tjoy_yawsensitivity\t\t= gEngfuncs.pfnRegisterVariable ( \"joyyawsensitivity\", \"-1.0\", 0 );\n\tjoy_wwhack1\t\t\t\t= gEngfuncs.pfnRegisterVariable ( \"joywwhack1\", \"0.0\", 0 );\n\tjoy_wwhack2\t\t\t\t= gEngfuncs.pfnRegisterVariable ( \"joywwhack2\", \"0.0\", 0 );\n\n\tgEngfuncs.pfnAddCommand (\"force_centerview\", Force_CenterView_f);\n\tgEngfuncs.pfnAddCommand (\"joyadvancedupdate\", Joy_AdvancedUpdate_f);\n\n\tIN_StartupMouse ();\n\tIN_StartupJoystick ();\n}"
  },
  {
    "path": "cl_dll/interpolation.cpp",
    "content": ""
  },
  {
    "path": "cl_dll/menu.cpp",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\t\n*\tThis product contains software technology licensed from Id \n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc. \n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n//\n// menu.cpp\n//\n// generic menu handler\n//\n#include \"hud.h\"\n#include \"cl_util.h\"\n#include \"parsemsg.h\"\n\n#include <string.h>\n#include <stdio.h>\n#include \"draw_util.h\"\n\n//#include \"vgui_TeamFortressViewport.h\"\n\n#define MAX_MENU_STRING\t512\n\nchar g_szMenuString[MAX_MENU_STRING];\nchar g_szPrelocalisedMenuString[MAX_MENU_STRING];\n\nint KB_ConvertString( char *in, char **ppout );\n\nvoid Touch_CloseMenu()\n{\n\tgMobileAPI.pfnTouchRemoveButton( \"_menu_*\" );\n\tgMobileAPI.pfnTouchSetClientOnly( 0 );\n}\n\nint CHudMenu :: Init( void )\n{\n\tgHUD.AddHudElem( this );\n\n\tHOOK_MESSAGE( gHUD.m_Menu, ShowMenu );\n\tHOOK_MESSAGE( gHUD.m_Menu, VGUIMenu );\n\tHOOK_MESSAGE( gHUD.m_Menu, BuyClose );\n\tHOOK_MESSAGE( gHUD.m_Menu, AllowSpec );\n\tHOOK_COMMAND( gHUD.m_Menu, \"client_buy_open\", OldStyleMenuOpen );\n\tHOOK_COMMAND( gHUD.m_Menu, \"client_buy_close\", OldStyleMenuClose );\n\tHOOK_COMMAND( gHUD.m_Menu, \"showvguimenu\", ShowVGUIMenu );\n\n\t_extended_menus = CVAR_CREATE(\"_extended_menus\", \"1\", FCVAR_ARCHIVE);\n\n\tInitHUDData();\n\n\tm_bAllowSpec = true; // by default, spectating is allowed\n\n\treturn 1;\n}\n\nvoid CHudMenu :: InitHUDData( void )\n{\n\tm_fMenuDisplayed = 0;\n\tm_bitsValidSlots = 0;\n\tReset();\n}\n\nvoid CHudMenu :: Reset( void )\n{\n\tg_szPrelocalisedMenuString[0] = 0;\n\tm_fWaitingForMore = FALSE;\n}\n\nint CHudMenu :: VidInit( void )\n{\n\treturn 1;\n}\n\nint CHudMenu :: Draw( float flTime )\n{\n\t// check for if menu is set to disappear\n\tif ( m_flShutoffTime > 0 )\n\t{\n\t\tif ( m_flShutoffTime <= gHUD.m_flTime )\n\t\t{  // times up, shutoff\n\t\t\tUserCmd_OldStyleMenuClose();\n\t\t\treturn 1;\n\t\t}\n\t}\n\n\t// don't draw the menu if the scoreboard is being shown\n\t//if ( gViewPort && gViewPort->IsScoreBoardVisible() )\n\t\t//return 1;\n\n\t// draw the menu, along the left-hand side of the screen\n\n\t// count the number of newlines\n\tint nlc = 0;\n\tint i;\n\tfor ( i = 0; i < MAX_MENU_STRING && g_szMenuString[i] != '\\0'; i++ )\n\t{\n\t\tif ( g_szMenuString[i] == '\\n' )\n\t\t\tnlc++;\n\t}\n\n\t// center it\n\tint y = (ScreenHeight/2) - ((nlc/2)*12) - 40; // make sure it is above the say text\n\tint x = 20;\n\n\ti = 0;\n\twhile ( i < MAX_MENU_STRING && g_szMenuString[i] != '\\0' )\n\t{\n\t\tDrawUtils::DrawHudString( x, y, 320, g_szMenuString + i, 255, 255, 255 );\n\t\ty += 24;\n\n\t\twhile ( i < MAX_MENU_STRING && g_szMenuString[i] != '\\0' && g_szMenuString[i] != '\\n' )\n\t\t\ti++;\n\t\tif ( g_szMenuString[i] == '\\n' )\n\t\t\ti++;\n\t}\n\t\n\treturn 1;\n}\n\n// selects an item from the menu\nvoid CHudMenu :: SelectMenuItem( int menu_item )\n{\n\t// if menu_item is in a valid slot,  send a menuselect command to the server\n\tif ( (menu_item > 0) && (m_bitsValidSlots & (1 << (menu_item-1))) )\n\t{\n\t\tchar szbuf[32];\n\t\tsprintf( szbuf, \"menuselect %d\\n\", menu_item );\n\t\tClientCmd( szbuf );\n\n\t\tUserCmd_OldStyleMenuClose();\n\t}\n}\n\n\n// Message handler for ShowMenu message\n// takes four values:\n//\t\tshort: a bitfield of keys that are valid input\n//\t\tchar : the duration, in seconds, the menu should stay up. -1 means is stays until something is chosen.\n//\t\tbyte : a boolean, TRUE if there is more string yet to be received before displaying the menu, FALSE if it's the last string\n//\t\tstring: menu string to display\n// if this message is never received, then scores will simply be the combined totals of the players.\nint CHudMenu :: MsgFunc_ShowMenu( const char *pszName, int iSize, void *pbuf )\n{\n\tchar *temp = NULL, *menustring;\n\n\tBufferReader reader( pszName, pbuf, iSize );\n\n\tm_bitsValidSlots = reader.ReadShort();\n\tint DisplayTime = reader.ReadChar();\n\tint NeedMore = reader.ReadByte();\n\n\tif ( DisplayTime > 0 )\n\t\tm_flShutoffTime = DisplayTime + gHUD.m_flTime;\n\telse\n\t\tm_flShutoffTime = -1;\n\n\tif ( !m_bitsValidSlots )\n\t{\n\t\tUserCmd_OldStyleMenuClose(); // no valid slots means that the menu should be turned off\n\t\treturn 1;\n\t}\n\n\tmenustring = reader.ReadString();\n\n\t// menu will be replaced by scripted touch config\n\t// so execute it and exit\n\tif( _extended_menus->value != 0.0f )\n\t{\n\t\tif( !strncmp(menustring, \"#Radio\", 6 ) )\n\t\t{\n\t\t\tif( menustring[6] == 'A' )\n\t\t\t{\n\t\t\t\tShowVGUIMenu(MENU_RADIOA); return 1;\n\t\t\t}\n\t\t\telse if( menustring[6] == 'B' )\n\t\t\t{\n\t\t\t\tShowVGUIMenu(MENU_RADIOB); return 1;\n\t\t\t}\n\t\t\telse if( menustring[6] == 'C' )\n\t\t\t{\n\t\t\t\tShowVGUIMenu(MENU_RADIOC); return 1;\n\t\t\t}\n\t\t\telse ShowVGUIMenu( MENU_NUMERICAL_MENU ); // we just show touch screen numbers\n\t\t}\n\t\telse ShowVGUIMenu(MENU_NUMERICAL_MENU);\n\t}\n\telse ShowVGUIMenu(MENU_NUMERICAL_MENU);\n\n\tif ( !m_fWaitingForMore ) // this is the start of a new menu\n\t{\n\t\tstrncpy( g_szPrelocalisedMenuString, menustring, MAX_MENU_STRING - 1 );\n\t}\n\telse\n\t{  // append to the current menu string\n\t\tstrncat( g_szPrelocalisedMenuString, menustring, MAX_MENU_STRING - strlen(g_szPrelocalisedMenuString) - 1 );\n\t}\n\tg_szPrelocalisedMenuString[MAX_MENU_STRING-1] = 0;  // ensure null termination (strncat/strncpy does not)\n\n\tif ( !NeedMore )\n\t{  // we have the whole string, so we can localise it now\n\t\tstrncpy( g_szMenuString, gHUD.m_TextMessage.BufferedLocaliseTextString( g_szPrelocalisedMenuString ), MAX_MENU_STRING );\n\t\tg_szMenuString[MAX_MENU_STRING-1] = 0;\n\t\t// Swap in characters\n\t\tif ( KB_ConvertString( g_szMenuString, &temp ) )\n\t\t{\n\t\t\tstrncpy( g_szMenuString, temp, MAX_MENU_STRING );\n\t\t\tg_szMenuString[MAX_MENU_STRING-1] = 0;\n\t\t\tfree( temp );\n\t\t}\n\t}\n\n\tm_fMenuDisplayed = 1;\n\tm_iFlags |= HUD_DRAW;\n\n\tm_fWaitingForMore = NeedMore;\n\n\treturn 1;\n}\n\nint CHudMenu::MsgFunc_VGUIMenu( const char *pszName, int iSize, void *pbuf )\n{\n\tBufferReader reader( pszName, pbuf, iSize );\n\n\tint menuType = reader.ReadByte();\n\tm_bitsValidSlots = reader.ReadShort(); // is ignored\n\n\tShowVGUIMenu(menuType);\n\treturn 1;\n}\n\nint CHudMenu::MsgFunc_BuyClose(const char *pszName, int iSize, void *pbuf)\n{\n\tTouch_CloseMenu();\n\n\treturn 1;\n}\n\nint CHudMenu::MsgFunc_AllowSpec(const char *pszName, int iSize, void *pbuf)\n{\n\tBufferReader reader( pszName, pbuf, iSize );\n\n\tm_bAllowSpec = (bool)reader.ReadByte();\n\n\treturn 1;\n}\n\nvoid CHudMenu::UserCmd_OldStyleMenuOpen()\n{\n\tm_flShutoffTime = -1; // stay open until user will not close it\n\tstrncpy( g_szMenuString, gHUD.m_TextMessage.BufferedLocaliseTextString(\"Buy\"), MAX_MENU_STRING );\n\tg_szMenuString[MAX_MENU_STRING-1] = 0;\n}\n\nvoid CHudMenu::UserCmd_OldStyleMenuClose()\n{\n\tm_fMenuDisplayed = 0; // no valid slots means that the menu should be turned off\n\tm_iFlags &= ~HUD_DRAW;\n\n\tTouch_CloseMenu();\n}\n\n// lol, no real VGUI here\n// it's really good only for touchscreen\n\nvoid CHudMenu::ShowVGUIMenu( int menuType )\n{\n\tconst char *szCmd;\n\n\tswitch(menuType)\n\t{\n\tcase MENU_TEAM:\n\t\tszCmd = \"exec touch/chooseteam.cfg\";\n\t\tbreak;\n\tcase MENU_CLASS_T:\n\t\tszCmd = \"exec touch/chooseteam_tr.cfg\";\n\t\tbreak;\n\tcase MENU_CLASS_CT:\n\t\tszCmd = \"exec touch/chooseteam_ct.cfg\";\n\t\tbreak;\n\tcase MENU_BUY:\n\t\tszCmd = \"exec touch/buy.cfg\";\n\t\tbreak;\n\tcase MENU_BUY_PISTOL:\n\t\tif( g_PlayerExtraInfo[gHUD.m_Scoreboard.m_iPlayerNum].teamnumber == TEAM_TERRORIST )\n\t\t\tszCmd = \"exec touch/buy_pistol_t.cfg\";\n\t\telse szCmd = \"exec touch/buy_pistol_ct.cfg\";\n\t\tbreak;\n\tcase MENU_BUY_SHOTGUN:\n\t\tif( g_PlayerExtraInfo[gHUD.m_Scoreboard.m_iPlayerNum].teamnumber == TEAM_TERRORIST )\n\t\t\tszCmd = \"exec touch/buy_shotgun_t.cfg\";\n\t\telse szCmd = \"exec touch/buy_shotgun_ct.cfg\";\n\t\tbreak;\n\tcase MENU_BUY_RIFLE:\n\t\tif( g_PlayerExtraInfo[gHUD.m_Scoreboard.m_iPlayerNum].teamnumber == TEAM_TERRORIST )\n\t\t\tszCmd = \"exec touch/buy_rifle_t.cfg\";\n\t\telse szCmd =\"exec touch/buy_rifle_ct.cfg\";\n\t\tbreak;\n\tcase MENU_BUY_SUBMACHINEGUN:\n\t\tif( g_PlayerExtraInfo[gHUD.m_Scoreboard.m_iPlayerNum].teamnumber == TEAM_TERRORIST )\n\t\t\tszCmd = \"exec touch/buy_submachinegun_t.cfg\";\n\t\telse szCmd = \"exec touch/buy_submachinegun_ct.cfg\";\n\t\tbreak;\n\tcase MENU_BUY_MACHINEGUN:\n\t\tif( g_PlayerExtraInfo[gHUD.m_Scoreboard.m_iPlayerNum].teamnumber == TEAM_TERRORIST )\n\t\t\tszCmd = \"exec touch/buy_machinegun_t.cfg\";\n\t\telse szCmd = \"exec touch/buy_machinegun_ct.cfg\";\n\t\tbreak;\n\tcase MENU_BUY_ITEM:\n\t\tif( g_PlayerExtraInfo[gHUD.m_Scoreboard.m_iPlayerNum].teamnumber == TEAM_TERRORIST )\n\t\t\tszCmd = \"exec touch/buy_item_t.cfg\";\n\t\telse szCmd = \"exec touch/buy_item_ct.cfg\";\n\t\tbreak;\n\tcase MENU_RADIOA:\n\t\tszCmd = \"exec touch/radioa.cfg\";\n\t\tbreak;\n\tcase MENU_RADIOB:\n\t\tszCmd = \"exec touch/radiob.cfg\";\n\t\tbreak;\n\tcase MENU_RADIOC:\n\t\tszCmd = \"exec touch/radioc.cfg\";\n\t\tbreak;\n\tcase MENU_RADIOSELECTOR:\n\t\tszCmd = \"exec touch/radioselector.cfg\";\n\t\tbreak;\n\tcase MENU_BUY_CSDM:\n\t\tszCmd = \"exec touch/custom/dm_menu.cfg\";\n\t\tbreak;\n\tcase MENU_NUMERICAL_MENU:\n#ifdef __ANDROID__\n\t\tszCmd = \"exec touch/numerical_menu.cfg\";\n\t\tbreak;\n#else\n\t\treturn;\n#endif\n\tdefault:\n\t\tUserCmd_OldStyleMenuClose();\n\t\treturn;\n\t}\n\n\tm_fMenuDisplayed = 1;\n\tClientCmd(szCmd);\n}\n\nvoid CHudMenu::UserCmd_ShowVGUIMenu()\n{\n\tif( gEngfuncs.Cmd_Argc() < 2 )\n\t{\n\t\tConsolePrint(\"usage: showvguimenu <menuType>\\n\");\n\t\treturn;\n\t}\n\n\tint menuType = atoi(gEngfuncs.Cmd_Argv(1));\n\tShowVGUIMenu(menuType);\n}\n"
  },
  {
    "path": "cl_dll/message.cpp",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\t\n*\tThis product contains software technology licensed from Id \n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc. \n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n//\n// Message.cpp\n//\n// implementation of CHudMessage class\n//\n\n#include \"hud.h\"\n#include \"cl_util.h\"\n#include <string.h>\n#include <stdio.h>\n#include \"parsemsg.h\"\n#include \"vgui_parser.h\"\n#include \"draw_util.h\"\n\nstatic int Utf8StringLen(const char *pszText)\n{\n\tif ( !pszText ) return 0;\n\tint length = 0;\n\tCon_UtfProcessChar( 0 );\n\twhile ( *pszText )\n\t{\n\t\tint uch = Con_UtfProcessChar( (unsigned char)*pszText );\n\t\tif ( uch )\n\t\t\tlength++;\n\t\tpszText++;\n\t}\n\treturn length;\n}\n\nint CHudMessage::Init(void)\n{\n\tHOOK_MESSAGE( gHUD.m_Message, HudText );\n\tHOOK_MESSAGE( gHUD.m_Message, GameTitle );\n\tHOOK_MESSAGE( gHUD.m_Message, HudTextPro );\n\tHOOK_MESSAGE( gHUD.m_Message, HudTextArgs );\n\n\tgHUD.AddHudElem(this);\n\tReset();\n\n\treturn 1;\n}\n\nint CHudMessage::VidInit( void )\n{\n\tm_HUD_title_half = gHUD.GetSpriteIndex( \"title_half\" );\n\tm_HUD_title_life = gHUD.GetSpriteIndex( \"title_life\" );\n\n\treturn 1;\n}\n\n\nvoid CHudMessage::Reset( void )\n{\n\tmemset( m_pMessages, 0, sizeof( m_pMessages[0] ) * maxHUDMessages );\n\tmemset( m_startTime, 0, sizeof( m_startTime[0] ) * maxHUDMessages );\n\t\n\tm_gameTitleTime = 0;\n\tm_pGameTitle = NULL;\n}\n\n\nfloat CHudMessage::FadeBlend( float fadein, float fadeout, float hold, float localTime )\n{\n\tfloat fadeTime = fadein + hold;\n\tfloat fadeBlend;\n\n\tif ( localTime < 0 )\n\t\treturn 0;\n\n\tif ( localTime < fadein )\n\t{\n\t\tfadeBlend = 1 - ((fadein - localTime) / fadein);\n\t}\n\telse if ( localTime > fadeTime )\n\t{\n\t\tif ( fadeout > 0 )\n\t\t\tfadeBlend = 1 - ((localTime - fadeTime) / fadeout);\n\t\telse\n\t\t\tfadeBlend = 0;\n\t}\n\telse\n\t\tfadeBlend = 1;\n\n\treturn fadeBlend;\n}\n\n\nint\tCHudMessage::XPosition( float x, int width, int totalWidth )\n{\n\tint xPos;\n\n\tif ( x == -1 )\n\t{\n\t\txPos = (ScreenWidth - width) / 2;\n\t}\n\telse\n\t{\n\t\tif ( x < 0 )\n\t\t\txPos = (1.0 + x) * ScreenWidth - totalWidth;\t// Alight right\n\t\telse\n\t\t\txPos = x * ScreenWidth;\n\t}\n\n\tif ( xPos + width > ScreenWidth )\n\t\txPos = ScreenWidth - width;\n\telse if ( xPos < 0 )\n\t\txPos = 0;\n\n\treturn xPos;\n}\n\n\nint CHudMessage::YPosition( float y, int height )\n{\n\tint yPos;\n\n\tif ( y == -1 )\t// Centered?\n\t\tyPos = (ScreenHeight - height) * 0.5;\n\telse\n\t{\n\t\t// Alight bottom?\n\t\tif ( y < 0 )\n\t\t\tyPos = (1.0 + y) * ScreenHeight - height;\t// Alight bottom\n\t\telse // align top\n\t\t\tyPos = y * ScreenHeight;\n\t}\n\n\tif ( yPos + height > ScreenHeight )\n\t\tyPos = ScreenHeight - height;\n\telse if ( yPos < 0 )\n\t\tyPos = 0;\n\n\treturn yPos;\n}\n\n\nvoid CHudMessage::MessageScanNextChar( void )\n{\n\tint srcRed = m_parms.pMessage->r1;\n\tint srcGreen = m_parms.pMessage->g1;\n\tint srcBlue = m_parms.pMessage->b1;\n\tint destRed, destGreen, destBlue, blend;\n\tdestRed = destGreen = destBlue = blend = 0;\n\n\tswitch( m_parms.pMessage->effect )\n\t{\n\t// Fade-in / Fade-out\n\tcase 0:\n\tcase 1:\n\t\tdestRed = destGreen = destBlue = 0;\n\t\tblend = m_parms.fadeBlend;\n\t\tbreak;\n\n\tcase 2:\n\t\tm_parms.charTime += m_parms.pMessage->fadein;\n\t\tif ( m_parms.charTime > m_parms.time )\n\t\t{\n\t\t\tsrcRed = srcGreen = srcBlue = 0;\n\t\t\tblend = 0;\t// pure source\n\t\t}\n\t\telse\n\t\t{\n\t\t\tfloat deltaTime = m_parms.time - m_parms.charTime;\n\n\t\t\tdestRed = destGreen = destBlue = 0;\n\t\t\tif ( m_parms.time > m_parms.fadeTime )\n\t\t\t{\n\t\t\t\tblend = m_parms.fadeBlend;\n\t\t\t}\n\t\t\telse if ( deltaTime > m_parms.pMessage->fxtime )\n\t\t\t\tblend = 0;\t// pure dest\n\t\t\telse\n\t\t\t{\n\t\t\t\tdestRed = m_parms.pMessage->r2;\n\t\t\t\tdestGreen = m_parms.pMessage->g2;\n\t\t\t\tdestBlue = m_parms.pMessage->b2;\n\t\t\t\tblend = 255 - (deltaTime * (1.0/m_parms.pMessage->fxtime) * 255.0 + 0.5);\n\t\t\t}\n\t\t}\n\t\tbreak;\n\t}\n\tif ( blend > 255 )\n\t\tblend = 255;\n\telse if ( blend < 0 )\n\t\tblend = 0;\n\n\tm_parms.r = ((srcRed * (255-blend)) + (destRed * blend)) >> 8;\n\tm_parms.g = ((srcGreen * (255-blend)) + (destGreen * blend)) >> 8;\n\tm_parms.b = ((srcBlue * (255-blend)) + (destBlue * blend)) >> 8;\n\n\tif ( m_parms.pMessage->effect == 1 && m_parms.charTime != 0 )\n\t{\n\t\tif ( m_parms.x >= 0 && m_parms.y >= 0 && (m_parms.x + gHUD.GetCharWidth( m_parms.text )) <= ScreenWidth )\n\t\t\tDrawUtils::TextMessageDrawChar( m_parms.x, m_parms.y, m_parms.text, m_parms.pMessage->r2, m_parms.pMessage->g2, m_parms.pMessage->b2 );\n\t}\n}\n\n\nvoid CHudMessage::MessageScanStart( void )\n{\n\tswitch( m_parms.pMessage->effect )\n\t{\n\t// Fade-in / out with flicker\n\tcase 1:\n\tcase 0:\n\t\tm_parms.fadeTime = m_parms.pMessage->fadein + m_parms.pMessage->holdtime;\n\t\t\n\n\t\tif ( m_parms.time < m_parms.pMessage->fadein )\n\t\t{\n\t\t\tm_parms.fadeBlend = ((m_parms.pMessage->fadein - m_parms.time) * (1.0/m_parms.pMessage->fadein) * 255);\n\t\t}\n\t\telse if ( m_parms.time > m_parms.fadeTime )\n\t\t{\n\t\t\tif ( m_parms.pMessage->fadeout > 0 )\n\t\t\t\tm_parms.fadeBlend = (((m_parms.time - m_parms.fadeTime) / m_parms.pMessage->fadeout) * 255);\n\t\t\telse\n\t\t\t\tm_parms.fadeBlend = 255; // Pure dest (off)\n\t\t}\n\t\telse\n\t\t\tm_parms.fadeBlend = 0;\t// Pure source (on)\n\t\tm_parms.charTime = 0;\n\n\t\tif ( m_parms.pMessage->effect == 1 && (rand()%100) < 10 )\n\t\t\tm_parms.charTime = 1;\n\t\tbreak;\n\n\tcase 2:\n\t\tm_parms.fadeTime = (m_parms.pMessage->fadein * m_parms.length) + m_parms.pMessage->holdtime;\n\t\t\n\t\tif ( m_parms.time > m_parms.fadeTime && m_parms.pMessage->fadeout > 0 )\n\t\t\tm_parms.fadeBlend = (((m_parms.time - m_parms.fadeTime) / m_parms.pMessage->fadeout) * 255);\n\t\telse\n\t\t\tm_parms.fadeBlend = 0;\n\t\tbreak;\n\t}\n}\n\n\nvoid CHudMessage::MessageDrawScan( client_textmessage_t *pMessage, float time )\n{\n\tint i, j, length, width;\n\tconst char *pText;\n\tunsigned char line[512];\n\n\tpText = pMessage->pMessage;\n\t// Count lines\n\tm_parms.lines = 1;\n\tm_parms.time = time;\n\tm_parms.pMessage = pMessage;\n\tlength = 0;\n\twidth = 0;\n\tm_parms.totalWidth = 0;\n\tCon_UtfProcessChar( 0 );\n\twhile ( *pText )\n\t{\n\t\tif ( *pText == '\\n' )\n\t\t{\n\t\t\tm_parms.lines++;\n\t\t\tif ( width > m_parms.totalWidth )\n\t\t\t\tm_parms.totalWidth = width;\n\t\t\twidth = 0;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tint uch = Con_UtfProcessChar( (unsigned char)*pText );\n\n\t\t\tif ( !uch )\n\t\t\t{\n\t\t\t\tpText++;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\twidth += gHUD.GetCharWidth( uch );\n\t\t}\n\t\tpText++;\n\t\tlength++;\n\t}\n\tm_parms.length = length;\n\tm_parms.totalHeight = (m_parms.lines * gHUD.GetCharHeight());\n\n\n\tm_parms.y = YPosition( pMessage->y, m_parms.totalHeight );\n\tpText = pMessage->pMessage;\n\n\tm_parms.charTime = 0;\n\n\tMessageScanStart();\n\n\tfor ( i = 0; i < m_parms.lines; i++ )\n\t{\n\t\tm_parms.lineLength = 0;\n\t\tm_parms.width = 0;\n\t\twhile ( *pText && *pText != '\\n' && m_parms.lineLength < sizeof (line) - 1)\n\t\t{\n\t\t\tunsigned char c = *pText;\n\t\t\tline[m_parms.lineLength] = c;\n\t\t\tm_parms.lineLength++;\n\t\t\tint uch = Con_UtfProcessChar( c );\n\n\t\t\tif ( !uch )\n\t\t\t{\n\t\t\t\tpText++;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tm_parms.width += gHUD.GetCharWidth( uch );\n\t\t\tpText++;\n\t\t}\n\t\tpText++;\t\t// Skip LF\n\t\tline[m_parms.lineLength] = 0;\n\n\t\tm_parms.x = XPosition( pMessage->x, m_parms.width, m_parms.totalWidth );\n\n\t\tCon_UtfProcessChar( 0 );\n\t\tfor ( j = 0; j < m_parms.lineLength; j++ )\n\t\t{\n\t\t\tm_parms.text = line[j];\n\t\t\tint uch = Con_UtfProcessChar( m_parms.text );\n\t\t\tint next = m_parms.x + gHUD.GetCharWidth( uch ? uch : m_parms.text );\n\n\t\t\tfloat savedCharTime = m_parms.charTime;\n\t\t\tMessageScanNextChar();\n\n\t\t\tif ( !uch )\n\t\t\t\tm_parms.charTime = savedCharTime;\n\t\t\t\n\t\t\tif ( m_parms.x >= 0 && m_parms.y >= 0 && next <= ScreenWidth )\n\t\t\t\tm_parms.x += DrawUtils::TextMessageDrawChar( m_parms.x, m_parms.y, m_parms.text, m_parms.r, m_parms.g, m_parms.b );\n\t\t}\n\n\t\tm_parms.y += gHUD.GetCharHeight();\n\t}\n}\n\n\nint CHudMessage::Draw( float fTime )\n{\n\tint i, drawn;\n\tclient_textmessage_t *pMessage;\n\tfloat endTime;\n\n\tdrawn = 0;\n\n\tif ( m_gameTitleTime > 0 )\n\t{\n\t\tfloat localTime = gHUD.m_flTime - m_gameTitleTime;\n\t\tfloat brightness;\n\n\t\t// Maybe timer isn't set yet\n\t\tif ( m_gameTitleTime > gHUD.m_flTime )\n\t\t\tm_gameTitleTime = gHUD.m_flTime;\n\n\t\tif ( localTime > (m_pGameTitle->fadein + m_pGameTitle->holdtime + m_pGameTitle->fadeout) )\n\t\t\tm_gameTitleTime = 0;\n\t\telse\n\t\t{\n\t\t\tbrightness = FadeBlend( m_pGameTitle->fadein, m_pGameTitle->fadeout, m_pGameTitle->holdtime, localTime );\n\n\t\t\tint halfWidth = gHUD.GetSpriteRect(m_HUD_title_half).Width();\n\t\t\tint fullWidth = halfWidth + gHUD.GetSpriteRect(m_HUD_title_life).Width();\n\t\t\tint fullHeight = gHUD.GetSpriteRect(m_HUD_title_half).Height();\n\n\t\t\tint x = XPosition( m_pGameTitle->x, fullWidth, fullWidth );\n\t\t\tint y = YPosition( m_pGameTitle->y, fullHeight );\n\n\n\t\t\tSPR_Set( gHUD.GetSprite(m_HUD_title_half), brightness * m_pGameTitle->r1, brightness * m_pGameTitle->g1, brightness * m_pGameTitle->b1 );\n\t\t\tSPR_DrawAdditive( 0, x, y, &gHUD.GetSpriteRect(m_HUD_title_half) );\n\n\t\t\tSPR_Set( gHUD.GetSprite(m_HUD_title_life), brightness * m_pGameTitle->r1, brightness * m_pGameTitle->g1, brightness * m_pGameTitle->b1 );\n\t\t\tSPR_DrawAdditive( 0, x + halfWidth, y, &gHUD.GetSpriteRect(m_HUD_title_life) );\n\n\t\t\tdrawn = 1;\n\t\t}\n\t}\n\t// Fixup level transitions\n\tfor ( i = 0; i < maxHUDMessages; i++ )\n\t{\n\t\t// Assume m_parms.time contains last time\n\t\tif ( m_pMessages[i].pMessage )\n\t\t{\n\t\t\tpMessage = m_pMessages[i].pMessage;\n\t\t\tif ( m_startTime[i] > gHUD.m_flTime )\n\t\t\t\tm_startTime[i] = gHUD.m_flTime + m_parms.time - m_startTime[i] + 0.2;\t// Server takes 0.2 seconds to spawn, adjust for this\n\t\t}\n\t}\n\n\tfor ( i = 0; i < maxHUDMessages; i++ )\n\t{\n\t\tif ( m_pMessages[i].pMessage )\n\t\t{\n\t\t\tpMessage = m_pMessages[i].pMessage;\n\n\t\t\t// This is when the message is over\n\t\t\tswitch( pMessage->effect )\n\t\t\t{\n\t\t\t// TODO: HACK to prevent crashing\n\t\t\tdefault:\n\t\t\tcase 0:\n\t\t\tcase 1:\n\t\t\t\tendTime = m_startTime[i] + pMessage->fadein + pMessage->fadeout + pMessage->holdtime;\n\t\t\t\tbreak;\n\t\t\t\n\t\t\t// Fade in is per character in scanning messages\n\t\t\tcase 2:\n\t\t\t\tendTime = m_startTime[i] + (pMessage->fadein * Utf8StringLen( pMessage->pMessage )) + pMessage->fadeout + pMessage->holdtime;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tif ( fTime <= endTime )\n\t\t\t{\n\t\t\t\tfloat messageTime = fTime - m_startTime[i];\n\n\t\t\t\t// Draw the message\n\t\t\t\t// effect 0 is fade in/fade out\n\t\t\t\t// effect 1 is flickery credits\n\t\t\t\t// effect 2 is write out (training room)\n\t\t\t\tMessageDrawScan( pMessage, messageTime );\n\n\t\t\t\tdrawn++;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t// The message is over\n\t\t\t\tif( !strcmp( m_pMessages[i].pMessage->pName, \"Custom\" ) )\n\t\t\t\t{\n\t\t\t\t\tdelete[] m_pMessages[i].pMessage->pMessage;\n\t\t\t\t}\n\t\t\t\tm_pMessages[i].pMessage = NULL;\n\t\t\t}\n\t\t}\n\t}\n\n\t// Remember the time -- to fix up level transitions\n\tm_parms.time = gHUD.m_flTime;\n\t// Don't call until we get another message\n\tif ( !drawn )\n\t\tm_iFlags &= ~HUD_DRAW;\n\n\treturn 1;\n}\n\n\nvoid CHudMessage::MessageAdd( const char *pName, float time, qboolean hintMessage/*, unsigned int font */ )\n{\n\tint i, j;\n\tclient_textmessage_t *tempMessage;\n\tclient_textmessage_t *message;\n\n\tfor ( i = 0; i < maxHUDMessages; i++ )\n\t{\n\t\tif ( !m_pMessages[i].pMessage )\n\t\t{\n\t\t\t// Trim off a leading # if it's there\n\t\t\tif ( pName[0] == '#' ) \n\t\t\t\ttempMessage = TextMessageGet( pName+1 );\n\t\t\telse\n\t\t\t\ttempMessage = TextMessageGet( pName );\n\n\t\t\tif( tempMessage )\n\t\t\t{\n\t\t\t\tif( tempMessage->pMessage[0] == '#' )\n\t\t\t\t{\n\t\t\t\t\tmessage = AllocMessage( CHudTextMessage::BufferedLocaliseTextString( tempMessage->pMessage ), tempMessage );\n\t\t\t\t}\n\t\t\t\telse if( !strcmp( tempMessage->pName, \"Custom\" ) ) // Hey, it's mine way of detecting allocated message\n\t\t\t\t{\n\t\t\t\t\tmessage = AllocMessage( tempMessage->pMessage, tempMessage );\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tmessage = tempMessage;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tchar *localized = (char *)pName;\n\t\t\t\tif( pName[0] == '#' )\n\t\t\t\t{\n\t\t\t\t\tlocalized = (char *)Localize( pName + 1 );\n\t\t\t\t}\n\n\t\t\t\t// If we couldnt find it in the titles.txt, just create it\n\t\t\t\tmessage = AllocMessage( localized );\n\n\t\t\t\tmessage->effect = 2;\n\t\t\t\tmessage->r1 = message->g1 = message->b1 = message->a1 = 100;\n\t\t\t\tmessage->r2 = 240;\n\t\t\t\tmessage->g2 = 110;\n\t\t\t\tmessage->b2 = 0;\n\t\t\t\tmessage->a2 = 0;\n\t\t\t\tmessage->x = -1;\t\t// Centered\n\t\t\t\tmessage->y = 0.7;\n\t\t\t\tmessage->fadein = 0.01;\n\t\t\t\tmessage->fadeout = 1.5;\n\t\t\t\tmessage->fxtime = 0.25;\n\t\t\t\tmessage->holdtime = 5;\n\t\t\t}\n\n\t\t\tif ( message && hintMessage )\n\t\t\t{\n\t\t\t\tmessage->effect = 2;\n\t\t\t\tmessage->r1 = 40;\n\t\t\t\tmessage->g1 = 255;\n\t\t\t\tmessage->b1 = 40;\n\t\t\t\tmessage->a1 = 200;\n\t\t\t\tmessage->r2 = 0;\n\t\t\t\tmessage->g2 = 255;\n\t\t\t\tmessage->b2 = 0;\n\t\t\t\tmessage->a2 = 200;\n\t\t\t\tmessage->x = -1.0;\n\t\t\t\tmessage->y = 0.7;\n\t\t\t\tmessage->fadein = 0.01;\n\t\t\t\tmessage->fadeout = 0.7;\n\t\t\t\tmessage->fxtime = 0.07;\n\t\t\t\tmessage->holdtime = 5.0;\n\n\t\t\t\tif ( !strcmp( pName, \"#Spec_Duck\" ) )\n\t\t\t\t{\n\t\t\t\t\tmessage->holdtime = 6.0;\n\t\t\t\t}\n\t\t\t\telse if ( message->pMessage )\n\t\t\t\t{\n\t\t\t\t\tfloat lengthHold = (float)Utf8StringLen( message->pMessage ) / 25.0f;\n\t\t\t\t\tif ( lengthHold < 1.0f )\n\t\t\t\t\t\tlengthHold = 1.0f;\n\t\t\t\t\tmessage->holdtime = lengthHold;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tmessage->holdtime = 1.0;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// safety check - don't add empty messages\n            if ( !message || !message->pMessage || message->pMessage[0] == '\\0' ) \n            {\n                // clean up custom messages\n                if ( message && !strcmp(message->pName, \"Custom\") ) \n                {\n                    delete[] message->pMessage;\n                }\n                return; // bail out if message is empty\n            }\n\n\t\t\tfor ( j = 0; j < maxHUDMessages; j++ )\n\t\t\t{\n\t\t\t\tif ( m_pMessages[j].pMessage )\n\t\t\t\t{\n\t\t\t\t\t// is this message already in the list\n\t\t\t\t\tif ( !strcmp( message->pMessage, m_pMessages[j].pMessage->pMessage ) )\n\t\t\t\t\t{\n\t\t\t\t\t\tif( !strcmp( message->pName, \"Custom\" ) )\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tdelete[] message->pMessage;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\t// get rid of any other messages in same location (only one displays at a time)\n\t\t\t\t\tif ( fabs( message->y - m_pMessages[j].pMessage->y ) < 0.0001 && fabs( message->x - m_pMessages[j].pMessage->x ) < 0.0001 )\n\t\t\t\t\t{\n\t\t\t\t\t\tif( !strcmp( m_pMessages[j].pMessage->pName, \"Custom\" ) )\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tdelete[] m_pMessages[j].pMessage->pMessage;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tm_pMessages[j].pMessage = NULL;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tm_pMessages[i].pMessage = message;\n\t\t\t// m_pMessages[i].font = font;\n\t\t\tm_startTime[i] = time;\n\t\t\treturn;\n\t\t}\n\t}\n}\n\n\nint CHudMessage::MsgFunc_HudText( const char *pszName,  int iSize, void *pbuf )\n{\n\tBufferReader reader( pszName, pbuf, iSize );\n\n\tchar *pString = reader.ReadString();\n\n\tMessageAdd( pString, gHUD.m_flTime );\n\t// Remember the time -- to fix up level transitions\n\tm_parms.time = gHUD.m_flTime;\n\n\t// Turn on drawing\n\tm_iFlags |= HUD_DRAW;\n\n\treturn 1;\n}\n\n\nint CHudMessage::MsgFunc_GameTitle( const char *pszName,  int iSize, void *pbuf )\n{\n\tm_pGameTitle = TextMessageGet( \"GAMETITLE\" );\n\tif ( m_pGameTitle != NULL )\n\t{\n\t\tm_gameTitleTime = gHUD.m_flTime;\n\n\t\t// Turn on drawing\n\t\tm_iFlags |= HUD_DRAW;\n\t}\n\n\treturn 1;\n}\n\nvoid CHudMessage::MessageAdd(client_textmessage_t * newMessage )\n{\n\tclient_textmessage_t *message;\n\n\tm_parms.time = gHUD.m_flTime;\n\n\t// Turn on drawing\n\tm_iFlags |= HUD_DRAW;\n\n\tif( !strcmp( newMessage->pName, \"Custom\" ) ) // Hey, it's mine way of detecting allocated message\n\t{\n\t\tmessage = AllocMessage( newMessage->pMessage, newMessage );\n\t}\n\telse\n\t{\n\t\tmessage = newMessage;\n\t}\n\n\tfor ( int i = 0; i < maxHUDMessages; i++ )\n\t{\n\t\tif ( !m_pMessages[i].pMessage )\n\t\t{\n\t\t\tm_pMessages[i].pMessage = message;\n\t\t\tm_startTime[i] = gHUD.m_flTime;\n\t\t\treturn;\n\t\t}\n\t}\n\n}\n\n\nint CHudMessage::MsgFunc_HudTextPro( const char *pszName, int iSize, void *pbuf )\n{\n\tconst char *sz;\n\tqboolean hintMessage;\n\tBufferReader reader( pszName, pbuf, iSize );\n\tsz = reader.ReadString();\n\thintMessage = reader.ReadByte();\n\n\tMessageAdd(sz, gHUD.m_flTime, hintMessage/*, Newfont*/ ); // TODO\n\n\t// Remember the time -- to fix up level transitions\n\tm_parms.time = gHUD.m_flTime;\n\n\t// Turn on drawing\n\tm_iFlags |= HUD_DRAW;\n\treturn 1;\n}\n\nint CHudMessage::MsgFunc_HudTextArgs( const char *pszName, int iSize, void *pbuf )\n{\n\tBufferReader reader( pszName, pbuf, iSize );\n\n\tconst char *sz = reader.ReadString();\n\tqboolean hintMessage = reader.ReadByte();\n\n\tMessageAdd( sz, gHUD.m_flTime, hintMessage/*, Newfont*/ ); // TODO\n\n\tint slot = -1;\n\tfor ( int i = 0; i < maxHUDMessages; i++ )\n\t{\n\t\tif ( m_pMessages[i].pMessage && m_startTime[i] == gHUD.m_flTime )\n\t\t{\n\t\t\tslot = i;\n\t\t\tbreak;\n\t\t}\n\t}\n\n\tif ( slot != -1 )\n\t{\n\t\tint argCount = reader.ReadByte();\n\t\tif ( argCount > 4 ) argCount = 4;\n\t\tif ( argCount < 0 ) argCount = 0;\n\n\t\tm_pMessages[slot].arg_count = argCount;\n\n\t\tfor ( int i = 0; i < argCount; i++ )\n\t\t{\n\t\t\tconst char *arg = reader.ReadString();\n\t\t\tif ( !arg ) arg = \"\";\n\n\t\t\tconst char *localizedArg = Localize( arg );\n\t\t\tstrncpy( m_pMessages[slot].args[i], localizedArg, 128 );\n\t\t\tm_pMessages[slot].args[i][127] = 0;\n\t\t}\n\t}\n\n\t// Remember the time -- to fix up level transitions\n\tm_parms.time = gHUD.m_flTime;\n\n\t// Turn on drawing\n\tm_iFlags |= HUD_DRAW;\n\n\treturn 1;\n}\n\nclient_textmessage_t *CHudMessage::AllocMessage( const char *text, client_textmessage_t *copyFrom )\n{\n\tconst int MAX_CUSTOM_MESSAGES = 16;\n\tconst int MAX_CUSTOM_MESSAGES_MASK = (MAX_CUSTOM_MESSAGES-1);\n\tstatic client_textmessage_t\tg_pCustomMessage[MAX_CUSTOM_MESSAGES] = { };\n\tstatic int g_iCustomMessageMod = 0;\n\n\tclient_textmessage_t *ret = &g_pCustomMessage[g_iCustomMessageMod];\n\tg_iCustomMessageMod = (g_iCustomMessageMod + 1) & MAX_CUSTOM_MESSAGES_MASK;\n\n\tif( copyFrom )\n\t{\n\t\t*ret = *copyFrom;\n\t}\n\n\tif( text )\n\t{\n\t\tint len = strlen( text );\n\t\tchar *szCustomText = new char[len + 1];\n\t\tstrcpy( szCustomText, text );\n\n\t\tret->pName = \"Custom\";\n\t\tret->pMessage = szCustomText;\n\t}\n\n\treturn ret;\n}\n"
  },
  {
    "path": "cl_dll/nightvision.cpp",
    "content": ""
  },
  {
    "path": "cl_dll/rain.cpp",
    "content": "/***\n*\n*\tCopyright (c) 2005, BUzer.\n*\t\n*\tUsed with permission for Spirit of Half-Life 1.5\n*\n****/\n/*\n====== rain.cpp ========================================================\n*/\n\n#include <memory.h>\n#include \"hud.h\"\n#include \"pm_math.h\"\n#include \"cl_util.h\"\n#include \"const.h\"\n#include \"entity_types.h\"\n#include \"cdll_int.h\"\n#include \"pm_defs.h\"\n#include \"event_api.h\"\n\n#include \"rain.h\"\n#include \"r_efx.h\"\n#include \"con_nprint.h\"\n#include \"triangleapi.h\"\n#include \"parsemsg.h\"\n\n#undef fabs\n#include <new>\n\n#include \"com_model.h\"\n\n#define DRIPSPEED    900\t\t// speed of raindrips (pixel per secs)\n#define SNOWSPEED    200\t\t// speed of snowflakes\n#define SNOWFADEDIST 80\n\n#define MAXDRIPS 2000\t// max raindrops\n#define MAXFX    3000\t// max effects\n\n#define DRIP_SPRITE_HALFHEIGHT 64\n#define DRIP_SPRITE_HALFWIDTH  1\n#define SNOW_SPRITE_HALFSIZE   3\n\n// radius water rings\n#define MAXRINGHALFSIZE\t25\n\nstruct\n{\n\tVector2D wind;\n\tVector2D rand;\n\n\tfloat    distFromPlayer;\n\tfloat    globalHeight;\n\n\tint      dripsPerSecond;\n\tint\t     weatherMode;\t// 0 - snow, 1 - rain\n\tint      weatherValue;\n\n\tfloat    curtime;    // current time\n\tfloat    oldtime;    // last time we have updated drips\n\tfloat    timedelta;  // difference between old time and current time\n\tfloat    nextspawntime;  // when the next drip should be spawned\n\n\tint dripcounter;\n\tint fxcounter;\n\tfloat heightFromPlayer;\n\n\tHSPRITE hsprRain;\n\tHSPRITE hsprSnow;\n\tHSPRITE hsprRipple;\n} Rain;\n\nbool Rain_Initialized = false;\n\nenum\n{\n\tNO_LANDING = 0,\n\tDEFAULT_LANDING,\n\tWATER_LANDING\n};\n\nstruct cl_drip_t\n{\n\tVector\t\torigin;\n\tfloat\t\tbirthTime;\n\tfloat\t\tminHeight;\t// minimal height to kill raindrop\n\tfloat\t\talpha;\n\n\tVector2D    Delta; // side speed\n\tint         land;\n\n\tcl_drip_t*\t\tp_Next;\t\t// next drip in chain\n\tcl_drip_t*\t\tp_Prev;\t\t// previous drip in chain\n} FirstChainDrip;\n\nstruct cl_rainfx_t\n{\n\tVector\t\torigin;\n\tfloat\t\tbirthTime;\n\tfloat\t\tlife;\n\tfloat\t\talpha;\n\n\tint type;\n\n\tcl_rainfx_t*\t\tp_Next;\t\t// next fx in chain\n\tcl_rainfx_t*\t\tp_Prev;\t\t// previous fx in chain\n} FirstChainFX;\n\n\n#ifdef _DEBUG\ncvar_t *debug_rain = NULL;\n#endif\n\n\n/*\n=================================\nWaterLandingEffect\n=================================\n*/\nvoid LandingEffect( cl_drip_t *drip )\n{\n\tif( drip->land == NO_LANDING )\n\t\treturn;\n\n\tif (Rain.fxcounter >= MAXFX)\n\t{\n\t\t//gEngfuncs.Con_Printf( \"Rain error: FX limit overflow!\\n\" );\n\t\treturn;\n\t}\n\n\tcl_rainfx_t *newFX = new(std::nothrow) cl_rainfx_t;\n\tif( !newFX )\n\t{\n\t\tgEngfuncs.Con_Printf( \"Rain error: failed to allocate FX object!\\n\");\n\t\treturn;\n\t}\n\n\tnewFX->alpha = gEngfuncs.pfnRandomFloat(0.6, 0.9);\n\tnewFX->origin = drip->origin;\n\tnewFX->origin.z = drip->minHeight; // correct position\n\tnewFX->birthTime = Rain.curtime;\n\tnewFX->life = gEngfuncs.pfnRandomFloat(0.7, 1);\n\tnewFX->type = drip->land;\n\n\t// add to first place in chain\n\tnewFX->p_Next = FirstChainFX.p_Next;\n\tnewFX->p_Prev = &FirstChainFX;\n\tif (newFX->p_Next != NULL)\n\t\tnewFX->p_Next->p_Prev = newFX;\n\tFirstChainFX.p_Next = newFX;\n\n\tRain.fxcounter++;\n}\n/*\n=================================\nProcessRain\n\nMust think every frame.\n=================================\n*/\nvoid ProcessRain( void )\n{\n\tint speed = Rain.weatherMode ? SNOWSPEED : DRIPSPEED;\n\n\tRain.oldtime = Rain.curtime; // save old time\n\tRain.curtime = gEngfuncs.GetClientTime();\n\tRain.timedelta = Rain.curtime - Rain.oldtime;\n\n\tif( gHUD.cl_weather->value > 3.0f )\n\t\tgEngfuncs.Cvar_Set( \"cl_weather\", \"3\" );\n\n\tRain.weatherValue = gHUD.cl_weather->value;\n\n\tif( Rain.dripsPerSecond == 0 )\n\t\treturn; // disabled\n\n\t// first frame\n\tif( Rain.oldtime == 0 || ( Rain.dripsPerSecond == 0 && FirstChainDrip.p_Next == NULL ) )\n\t{\n\t\t// fix first frame bug with nextspawntime\n\t\tRain.nextspawntime = Rain.curtime;\n\t\treturn;\n\t}\n\n\tif( !Rain.timedelta )\n\t\treturn; // not in pause\n\n\tint spawnDrips = (Rain.dripsPerSecond + (Rain.weatherValue - 1) * 150);\n\tdouble timeBetweenDrips = 1.0 / (double)(spawnDrips);\n\n#ifdef _DEBUG\n\t// save debug info\n\tfloat debug_lifetime = 0;\n\tint debug_howmany = 0;\n\tint debug_attempted = 0;\n\tint debug_dropped = 0;\n#endif\n\n\tfor( cl_drip_t *curDrip = FirstChainDrip.p_Next, *nextDrip = NULL;\n\t\t curDrip;\n\t\t curDrip = nextDrip ) // go through list\n\t{\n\t\tnextDrip = curDrip->p_Next; // save pointer to next drip\n\n\t\tcurDrip->origin.x += Rain.timedelta * curDrip->Delta.x;\n\t\tcurDrip->origin.y += Rain.timedelta * curDrip->Delta.y;\n\t\tcurDrip->origin.z -= Rain.timedelta * speed;\n\n\t\t// remove drip if its origin lower than minHeight\n\t\tif (curDrip->origin.z < curDrip->minHeight)\n\t\t{\n\t\t\tLandingEffect( curDrip );\n#ifdef _DEBUG\n\t\t\tif( debug_rain->value )\n\t\t\t{\n\t\t\t\tdebug_lifetime += ( Rain.curtime - curDrip->birthTime );\n\t\t\t\tdebug_howmany++;\n\t\t\t}\n#endif\n\n\t\t\tcurDrip->p_Prev->p_Next = curDrip->p_Next; // link chain\n\t\t\tif( nextDrip != NULL )\n\t\t\t\tnextDrip->p_Prev = curDrip->p_Prev;\n\t\t\tdelete curDrip;\n\n\t\t\tRain.dripcounter--;\n\t\t}\n\t}\n\n\tif( !Rain.weatherValue )\n\t{\n\t\tRain.nextspawntime = Rain.curtime;\n\t\treturn;\n\t}\n\n\tint maxDelta = speed * Rain.timedelta; // maximum height randomize distance\n\tfloat falltime = (Rain.globalHeight + 4096) / speed;\n\n\tfor( ; Rain.nextspawntime < Rain.curtime; Rain.nextspawntime += timeBetweenDrips )\n\t{\n#ifdef _DEBUG\n\t\tif( debug_rain->value )\n\t\t\tdebug_attempted++;\n#endif\n\t\t\t\t\n\t\tif( Rain.dripcounter < spawnDrips ) // check for overflow\n\t\t{\n\t\t\tfloat deathHeight;\n\t\t\tVector vecStart, vecEnd, vecStartStart;\n\t\t\tVector2D Delta( Rain.wind.x + gEngfuncs.pfnRandomFloat( Rain.rand.x * -1, Rain.rand.x ),\n\t\t\t\t\t\t\tRain.wind.y + gEngfuncs.pfnRandomFloat( Rain.rand.y * -1, Rain.rand.y ));\n\t\t\tpmtrace_t pmtrace, pmtrace2;\n\n\t\t\tvecStart.x = gEngfuncs.pfnRandomFloat( gHUD.m_vecOrigin.x - Rain.distFromPlayer, gHUD.m_vecOrigin.x + Rain.distFromPlayer );\n\t\t\tvecStart.y = gEngfuncs.pfnRandomFloat( gHUD.m_vecOrigin.y - Rain.distFromPlayer, gHUD.m_vecOrigin.y + Rain.distFromPlayer );\n\t\t\tvecStart.z = gHUD.m_vecOrigin.z + Rain.heightFromPlayer;\n\n\t\t\t// find a point at bottom of map\n\t\t\tvecEnd.x = falltime * Delta.x;\n\t\t\tvecEnd.y = falltime * Delta.y;\n\t\t\tvecEnd.z = -4096;\n\n\t\t\tif( gEngfuncs.PM_PointContents( vecStart, NULL ) == CONTENTS_SOLID )\n\t\t\t{\n#ifdef _DEBUG\n\t\t\t\tif( debug_rain->value )\n\t\t\t\t\tdebug_dropped++;\n#endif\n\t\t\t\tcontinue; // drip cannot be placed\n\t\t\t}\n\n\t\t\tgEngfuncs.pEventAPI->EV_SetTraceHull( 2 );\n\t\t\tgEngfuncs.pEventAPI->EV_PlayerTrace( vecStart, vecEnd, PM_WORLD_ONLY, -1, &pmtrace );\n\n\t\t\tif( pmtrace.startsolid )\n\t\t\t{\n#ifdef _DEBUG\n\t\t\t\tif( debug_rain->value )\n\t\t\t\t\tdebug_dropped++;\n#endif\n\t\t\t\tcontinue; // drip cannot be placed\n\t\t\t}\n\n\t\t\tvecStartStart = vecStart;\n\t\t\tvecStartStart.z = 999999;\n\n\t\t\t// second trace. Check that player have a real sky above him\n\t\t\tconst char *s = gEngfuncs.pEventAPI->EV_TraceTexture( pmtrace.ent, vecStart, vecStartStart );\n\t\t\tif( !s || strcmp( s, \"sky\" ) )\n\t\t\t{\n#ifdef _DEBUG\n\t\t\t\tif( debug_rain->value )\n\t\t\t\t\tdebug_dropped++;\n#endif\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t\n\t\t\t// falling to water?\n\t\t\tint contents = gEngfuncs.PM_PointContents( pmtrace.endpos, NULL );\n\t\t\tif( contents == CONTENTS_WATER )\n\t\t\t{\n\t\t\t\tint waterEntity = gEngfuncs.PM_WaterEntity( pmtrace.endpos );\n\t\t\t\tif( waterEntity > 0 )\n\t\t\t\t{\n\t\t\t\t\tcl_entity_t *pwater = gEngfuncs.GetEntityByIndex( waterEntity );\n\t\t\t\t\tif( pwater && ( pwater->model != NULL ) )\n\t\t\t\t\t{\n\t\t\t\t\t\tdeathHeight = pwater->curstate.maxs[2];\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tgEngfuncs.Con_Printf(\"Rain error: can't get water entity\\n\");\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tgEngfuncs.Con_Printf(\"Rain error: water is not func_water entity\\n\");\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tdeathHeight = pmtrace.endpos[2];\n\t\t\t}\n\n\t\t\t// just in case..\n\t\t\tif (deathHeight > vecStart[2])\n\t\t\t{\n\t\t\t\tgEngfuncs.Con_Printf(\"Rain error: can't create drip in water\\n\");\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tcl_drip_t *newClDrip = new(std::nothrow) cl_drip_t;\n\t\t\tif( !newClDrip )\n\t\t\t{\n\t\t\t\tRain.dripsPerSecond = 0; // disable rain\n\t\t\t\tgEngfuncs.Con_Printf( \"Rain error: failed to allocate object!\\n\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t\n\t\t\tvecStart[2] -= gEngfuncs.pfnRandomFloat( 0, maxDelta ); // randomize a bit\n\t\t\t\n\t\t\tnewClDrip->alpha     = gEngfuncs.pfnRandomFloat( 0.12, 0.2 );\n\t\t\tnewClDrip->origin    = vecStart;\n\t\t\tnewClDrip->Delta     = Delta;\n\t\t\tnewClDrip->birthTime = Rain.curtime; // store time when it was spawned\n\t\t\tnewClDrip->minHeight = deathHeight;\n\n\t\t\tif( contents == CONTENTS_WATER )\n\t\t\t{\n\t\t\t\tnewClDrip->land = WATER_LANDING;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tnewClDrip->land = NO_LANDING;\n\t\t\t}\n\t\t\t/*else if( pmtrace->fraction < 1.0f && pmtrace->plane.normal.z > 0.71 && !pmtrace->inopen)\n\t\t\t{\n\t\t\t\tnewClDrip->land = DEFAULT_LANDING;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tnewClDrip->land = NO_LANDING;\n\t\t\t}*/\n\n\t\t\t// add to first place in chain\n\t\t\tnewClDrip->p_Next = FirstChainDrip.p_Next;\n\t\t\tnewClDrip->p_Prev = &FirstChainDrip;\n\t\t\tif (newClDrip->p_Next != NULL)\n\t\t\t\tnewClDrip->p_Next->p_Prev = newClDrip;\n\t\t\tFirstChainDrip.p_Next = newClDrip;\n\n\t\t\tRain.dripcounter++;\n\t\t}\n\t\telse\n\t\t{\n\t\t\t//gEngfuncs.Con_Printf( \"Rain error: Drip limit overflow!\\n\" );\n\t\t\treturn;\n\t\t}\n\t}\n\n#ifdef _DEBUG\n\tif( debug_rain->value ) // print debug info\n\t{\n\t\tcon_nprint_t info =\n\t\t{\n\t\t\t1,\n\t\t\t0.5f,\n\t\t\t{1.0f, 0.6f, 0.0f }\n\t\t};\n\t\tgEngfuncs.Con_NXPrintf( &info, \"Rain info: Drips exist: %i\\n\", Rain.dripcounter );\n\n\t\tinfo.index = 2;\n\t\tgEngfuncs.Con_NXPrintf( &info, \"Rain info: FX's exist: %i\\n\", Rain.fxcounter );\n\n\t\tinfo.index = 3;\n\t\tgEngfuncs.Con_NXPrintf( &info, \"Rain info: Attempted/Dropped: %i, %i\\n\", debug_attempted, debug_dropped);\n\t\tif( debug_howmany )\n\t\t{\n\t\t\tfloat ave = debug_lifetime / (float)debug_howmany;\n\n\t\t\tinfo.index = 4;\n\t\t\tgEngfuncs.Con_NXPrintf( &info, \"Rain info: Average drip life time: %f\\n\", ave);\n\t\t}\n\t}\n#endif\n}\n\n/*\n=================================\nProcessFXObjects\n\nRemove all fx objects with out time to live\nCall every frame before ProcessRain\n=================================\n*/\nvoid ProcessFXObjects( void )\n{\n\tfor( cl_rainfx_t *curFX = FirstChainFX.p_Next, *nextFX = NULL;\n\t\t curFX;\n\t\t curFX = nextFX )\n\t{\n\t\tnextFX = curFX->p_Next; // save pointer to next\n\n\t\t// delete current?\n\t\tif( curFX->birthTime + curFX->life < Rain.curtime )\n\t\t{\n\t\t\tcurFX->p_Prev->p_Next = curFX->p_Next; // link chain\n\t\t\tif( nextFX )\n\t\t\t\tnextFX->p_Prev = curFX->p_Prev;\n\n\t\t\tdelete curFX;\n\t\t\tRain.fxcounter--;\n\t\t}\n\t}\n}\n\n/*\n=================================\nResetRain\n\nclear memory, delete all objects\n=================================\n*/\nvoid ResetRain( void )\n{\n\t// delete all drips\n\tfor( cl_drip_t *curDrip = FirstChainDrip.p_Next; curDrip;\n\t\t curDrip = FirstChainDrip.p_Next, Rain.dripcounter-- )\n\t{\n\t\tFirstChainDrip.p_Next = curDrip->p_Next;\n\t\tdelete curDrip;\n\t}\n\n\t// delete all FX objects\n\tfor( cl_rainfx_t *curFX = FirstChainFX.p_Next; curFX;\n\t\t curFX = FirstChainFX.p_Next, Rain.fxcounter-- )\n\t{\n\t\tFirstChainFX.p_Next = curFX->p_Next;\n\t\tdelete curFX;\n\t}\n\n\tInitRain();\n\treturn;\n}\n\n\nint __MsgFunc_ReceiveW(const char *pszName, int iSize, void *pbuf)\n{\n\tBufferReader reader( pszName, pbuf, iSize);\n\n\tint iWeatherType = reader.ReadByte();\n\n\tif( iWeatherType == 0 )\n\t{\n\t\tResetRain();\n\t\treturn 1;\n\t}\n\n\tRain.distFromPlayer = 500;\n\tRain.dripsPerSecond = 500;\n\tRain.wind.x = Rain.wind.y = 30;\n\tRain.rand.x = Rain.rand.y = 0;\n\tRain.weatherMode = iWeatherType - 1;\n\tRain.globalHeight = 100;\n\tRain.heightFromPlayer = 100;\n\n\treturn 1;\n}\n\n/*\n=================================\nInitRain\ninitialze system\n=================================\n*/\nvoid InitRain( void )\n{\n\tmemset( &Rain, 0, sizeof(Rain) );\n\tmemset( &FirstChainDrip, 0, sizeof( cl_drip_t ));\n\tmemset( &FirstChainFX, 0, sizeof( cl_rainfx_t ));\n\n#ifdef _DEBUG\n\tif( !debug_rain )\n\t\tdebug_rain = CVAR_CREATE( \"Rain.debug\", \"0\", 0 );\n#endif\n\n\tRain.hsprRain = SPR_Load(\"sprites/effects/rain.spr\");\n\tRain.hsprSnow = SPR_Load(\"sprites/effects/snowflake.spr\");\n\tRain.hsprRipple = SPR_Load(\"sprites/effects/ripple.spr\");\n\n\tif( !Rain_Initialized )\n\t{\n\t\tHOOK_MESSAGE_FUNC( \"ReceiveW\", __MsgFunc_ReceiveW );\n\n\t\tRain_Initialized = Rain.hsprRain && Rain.hsprSnow && Rain.hsprRipple;\n\t}\n}\n\n\nvoid SetPoint( float x, float y, float z, float (*matrix)[4])\n{\n\tVector point( x, y, z ), result;\n\n\tVectorTransform( point, matrix, result );\n\n\tgEngfuncs.pTriAPI->Vertex3fv( result );\n}\n\n\n\n/*\n=================================\nDrawRain\n\ndraw raindrips and snowflakes\n=================================\n*/\nvoid DrawRain( void )\n{\n\tif (FirstChainDrip.p_Next == NULL)\n\t\treturn; // no drips to draw\n\n\tcl_entity_t *player = gEngfuncs.GetLocalPlayer();\n\n\tif( Rain.weatherMode == 0 ) // draw rain\n\t{\n\t\tconst model_s *pTexture = gEngfuncs.GetSpritePointer( Rain.hsprRain );\n\t\tif( !pTexture )\n\t\t\treturn;\n\n\t\tgEngfuncs.pTriAPI->SpriteTexture( (struct model_s *)pTexture, 0 );\n\t\tgEngfuncs.pTriAPI->RenderMode( kRenderTransAdd );\n\t\tgEngfuncs.pTriAPI->CullFace( TRI_NONE );\n\n\t\tfor( cl_drip_t *Drip = FirstChainDrip.p_Next; Drip; Drip = Drip->p_Next )\n\t\t{\n\t\t\tVector2D toPlayer, shift(Drip->Delta * DRIP_SPRITE_HALFHEIGHT / DRIPSPEED);\n\t\t\ttoPlayer.x = (player->origin.x - Drip->origin.x) * DRIP_SPRITE_HALFWIDTH;\n\t\t\ttoPlayer.y = (player->origin.y - Drip->origin.y) * DRIP_SPRITE_HALFWIDTH;\n\t\t\ttoPlayer = toPlayer.Normalize();\n\n\t\t\t// --- draw triangle --------------------------\n\t\t\tgEngfuncs.pTriAPI->Color4f( 1.0, 1.0, 1.0, Drip->alpha );\n\t\t\tgEngfuncs.pTriAPI->Begin( TRI_TRIANGLES );\n\n\t\t\t\tgEngfuncs.pTriAPI->TexCoord2f( 0, 0 );\n\t\t\t\tgEngfuncs.pTriAPI->Vertex3f( Drip->origin.x-toPlayer.y - shift.x,\n\t\t\t\t\t\tDrip->origin.y + toPlayer.x - shift.y,\n\t\t\t\t\t\tDrip->origin.z + DRIP_SPRITE_HALFHEIGHT );\n\n\t\t\t\tgEngfuncs.pTriAPI->TexCoord2f( 0.5, 1 );\n\t\t\t\tgEngfuncs.pTriAPI->Vertex3f( Drip->origin.x + shift.x,\n\t\t\t\t\t\tDrip->origin.y + shift.y,\n\t\t\t\t\t\tDrip->origin.z - DRIP_SPRITE_HALFHEIGHT );\n\n\t\t\t\tgEngfuncs.pTriAPI->TexCoord2f( 1, 0 );\n\t\t\t\tgEngfuncs.pTriAPI->Vertex3f( Drip->origin.x+toPlayer.y - shift.x,\n\t\t\t\t\t\tDrip->origin.y - toPlayer.x - shift.y,\n\t\t\t\t\t\tDrip->origin.z + DRIP_SPRITE_HALFHEIGHT);\n\n\t\t\tgEngfuncs.pTriAPI->End();\n\t\t\t// --- draw triangle end ----------------------\n\t\t}\n\t}\n\n\telse\t// draw snow\n\t{\n\t\tconst model_s *pTexture = gEngfuncs.GetSpritePointer( Rain.hsprSnow );\n\t\tif( !pTexture )\n\t\t\treturn;\n\n\t\tfloat visibleHeight = Rain.globalHeight - SNOWFADEDIST;\n\t\tvec3_t normal;\n\t\tfloat  matrix[3][4];\n\n\t\tgEngfuncs.GetViewAngles( normal );\n\t\tAngleMatrix (normal, matrix);\t// calc view matrix\n\n\t\tgEngfuncs.pTriAPI->SpriteTexture( (struct model_s *)pTexture, 0 );\n\t\tgEngfuncs.pTriAPI->RenderMode( kRenderTransAdd );\n\t\tgEngfuncs.pTriAPI->CullFace( TRI_NONE );\n\n\n\t\tfor( cl_drip_t *Drip = FirstChainDrip.p_Next; Drip; Drip = Drip->p_Next )\n\t\t{\n\t\t\tmatrix[0][3] = Drip->origin.x; // write origin to matrix\n\t\t\tmatrix[1][3] = Drip->origin.y;\n\t\t\tmatrix[2][3] = Drip->origin.z;\n\n\t\t\t// apply start fading effect\n\t\t\tfloat alpha = (Drip->origin.z <= visibleHeight) ?\n\t\t\t\t\t\t\t  Drip->alpha :\n\t\t\t\t\t\t\t  (((gHUD.m_vecOrigin.z + Rain.heightFromPlayer) - Drip->origin.z) / (float)SNOWFADEDIST) * Drip->alpha;\n\n\t\t\t// --- draw quad --------------------------\n\t\t\tgEngfuncs.pTriAPI->Color4f( 1.0, 1.0, 1.0, alpha );\n\t\t\tgEngfuncs.pTriAPI->Begin( TRI_QUADS );\n\n\t\t\t\tgEngfuncs.pTriAPI->TexCoord2f( 0, 0 );\n\t\t\t\tSetPoint(0, SNOW_SPRITE_HALFSIZE, SNOW_SPRITE_HALFSIZE, matrix);\n\n\t\t\t\tgEngfuncs.pTriAPI->TexCoord2f( 0, 1 );\n\t\t\t\tSetPoint(0, SNOW_SPRITE_HALFSIZE, -SNOW_SPRITE_HALFSIZE, matrix);\n\n\t\t\t\tgEngfuncs.pTriAPI->TexCoord2f( 1, 1 );\n\t\t\t\tSetPoint(0, -SNOW_SPRITE_HALFSIZE, -SNOW_SPRITE_HALFSIZE, matrix);\n\n\t\t\t\tgEngfuncs.pTriAPI->TexCoord2f( 1, 0 );\n\t\t\t\tSetPoint(0, -SNOW_SPRITE_HALFSIZE, SNOW_SPRITE_HALFSIZE, matrix);\n\n\t\t\tgEngfuncs.pTriAPI->End();\n\t\t\t// --- draw quad end ----------------------\n\t\t}\n\t}\n}\n\n/*\n=================================\nDrawFXObjects\n=================================\n*/\nvoid DrawFXObjects( void )\n{\n\n\tif( !FirstChainFX.p_Next )\n\t\treturn;\n\n\tconst model_s *pTexture = gEngfuncs.GetSpritePointer( Rain.hsprRipple );\n\tgEngfuncs.pTriAPI->SpriteTexture( (struct model_s *)pTexture, 0 );\n\tgEngfuncs.pTriAPI->RenderMode( kRenderTransAdd );\n\tgEngfuncs.pTriAPI->CullFace( TRI_NONE );\n\n\t// go through objects list\n\tfor( cl_rainfx_t *curFX = FirstChainFX.p_Next; curFX; curFX = curFX->p_Next )\n\t{\n\t\tswitch( curFX->type )\n\t\t{\n\t\tcase WATER_LANDING:\n\t\t{\n\t\t\t// fadeout\n\t\t\tfloat alpha = ((curFX->birthTime + curFX->life - Rain.curtime) / curFX->life) * curFX->alpha;\n\t\t\tfloat size = (Rain.curtime - curFX->birthTime) * MAXRINGHALFSIZE;\n\n\t\t\t// --- draw quad --------------------------\n\t\t\tgEngfuncs.pTriAPI->Color4f( 1.0, 1.0, 1.0, alpha );\n\t\t\tgEngfuncs.pTriAPI->Begin( TRI_QUADS );\n\n\t\t\t\tgEngfuncs.pTriAPI->TexCoord2f( 0, 0 );\n\t\t\t\tgEngfuncs.pTriAPI->Vertex3f(curFX->origin.x - size, curFX->origin.y - size, curFX->origin.z);\n\n\t\t\t\tgEngfuncs.pTriAPI->TexCoord2f( 0, 1 );\n\t\t\t\tgEngfuncs.pTriAPI->Vertex3f(curFX->origin.x - size, curFX->origin.y + size, curFX->origin.z);\n\n\t\t\t\tgEngfuncs.pTriAPI->TexCoord2f( 1, 1 );\n\t\t\t\tgEngfuncs.pTriAPI->Vertex3f(curFX->origin.x + size, curFX->origin.y + size, curFX->origin.z);\n\n\t\t\t\tgEngfuncs.pTriAPI->TexCoord2f( 1, 0 );\n\t\t\t\tgEngfuncs.pTriAPI->Vertex3f(curFX->origin.x + size, curFX->origin.y - size, curFX->origin.z);\n\n\t\t\tgEngfuncs.pTriAPI->End();\n\t\t\t// --- draw quad end ----------------------\n\t\t}\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "cl_dll/readme.txt",
    "content": "  client dll readme.txt\n-------------------------\n\nThis file details the structure of the half-life client dll,  and\nhow it communicates with the half-life game engine.\n\n\nEngine callback functions:\n\nDrawing functions:\n\tHSPRITE SPR_Load( char *picname );\n\t\tLoads a sprite into memory, and returns a handle to it.\n\n\tint  SPR_Frames( HSPRITE sprite );\n\t\tReturns the number of frames stored in the specified sprite.\n\n\tint  SPR_Height( HSPRITE x, int frame )\n\t\tReturns the height, in pixels, of a sprite at the specified frame.  \n\t\tReturns 0 is the frame number or the sprite handle is invalid.\n\n\tint  SPR_Width( HSPRITE x, int f )\n\t\tReturns the width, in pixels, of a sprite at the specified frame.  \n\t\tReturns 0 is the frame number or the sprite handle is invalid.\n\n\tint  SPR_Set( HSPRITE sprite, int r, int g, int b );\n\t\tPrepares a sprite about to be drawn.  RBG color values are applied to the sprite at this time.\n\n\n\tvoid  SPR_Draw( int frame, int x, int y );\n\t\tPrecondition:  SPR_Set has already been called for a sprite.\n\t\tDraws the currently active sprite to the screen,  at position (x,y), where (0,0) is\n\t\tthe top left-hand corner of the screen.\n\n\n\tvoid  SPR_DrawHoles( int frame, int x, int y );\n\t\tPrecondition:  SPR_Set has already been called for a sprite.\n\t\tDraws the currently active sprite to the screen.  Color index #255 is treated as transparent.\n\n\tvoid  SPR_DrawAdditive( int frame, int x, int y );\n\t\tPrecondition:  SPR_Set has already been called for a sprite.\n\t\tDraws the currently active sprite to the screen,  adding it's color values to the background.\n\n\tvoid  SPR_EnableScissor( int x, int y, int width, int height );\n\t\tCreates a clipping rectangle.  No pixels will be drawn outside the specified area.  Will\n\t\tstay in effect until either the next frame,  or SPR_DisableScissor is called.\n\n\tvoid  SPR_DisableScissor( void );\n\t\tDisables the effect of an SPR_EnableScissor call.\n\n\tint\t IsHighRes( void );\n\t\treturns 1 if the res mode is 640x480 or higher;  0 otherwise.\n\n\tint\t ScreenWidth( void );\n\t\treturns the screen width, in pixels.\n\n\tint\t ScreenHeight( void );\n\t\treturns the screen height, in pixels.\n\n// Sound functions\n\tvoid PlaySound( char *szSound, int volume )\n\t\tplays the sound 'szSound' at the specified volume.  Loads the sound if it hasn't been cached.\n\t\tIf it can't find the sound,  it displays an error message and plays no sound.\n\n\tvoid PlaySound( int iSound, int volume )\n\t\tPrecondition:  iSound has been precached.\n\t\tPlays the sound, from the precache list.\n\n\n// Communication functions\n\tvoid  SendClientCmd( char *szCmdString );\n\t\tsends a command to the server,  just as if the client had typed the szCmdString at the console.\n\n\tchar *GetPlayerName( int entity_number );\n\t\treturns a pointer to a string, that contains the name of the specified client.  \n\t\tReturns NULL if the entity_number is not a client.\n\t\t\n\n\tDECLARE_MESSAGE(),  HOOK_MESSAGE()\n\t\tThese two macros bind the message sending between the entity DLL and the client DLL to\n\t\tthe CHud object.\n\n\t\tHOOK_MESSAGE( message_name )\n\t\t\t This is used inside CHud::Init().  It calls into the engine to hook that message\n\t\t\t from the incoming message stream.\n\t\t\t Precondition:  There must be a function of name UserMsg_message_name declared\n\t\t\t for CHud.  Eg,  CHud::UserMsg_Health() must be declared if you want to \n\t\t\t use HOOK_MESSAGE( Health );\n\n\t\tDECLARE_MESSAGE( message_name )\n\t\t\tFor each HOOK_MESSAGE you must have an equivalent DECLARE_MESSAGE.  This creates\n\t\t\ta function which passes the hooked messages into the CHud object.\n\n\n\tHOOK_COMMAND(),  DECLARE_COMMAND()\n\t\tThese two functions declare and hook console commands into the client dll.\n\t\t\n\t\tHOOK_COMMAND( char *command, command_name )\n\t\t\tWhenever the user types the 'command' at the console,  the function 'command_name'\n\t\t\twill be called.\n\t\t\tPrecondition: There must be a function of the name UserCmd_command_name declared\n\t\t\tfor CHud. Eg,  CHud::UserMsg_ShowScores() must be declared if you want to\n\t\t\tuse HOOK_COMMAND( \"+showscores\", ShowScores );\n\n\t\tDECLARE_COMMAND( command_name )\n\t\t\tFor each HOOK_COMMAND you must have an equivalent DECLARE_COMMAND.  This creates\n\t\t\ta function which passes the hooked commands into the CHud object.\n\t\t\n"
  },
  {
    "path": "cl_dll/saytext.cpp",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\t\n*\tThis product contains software technology licensed from Id \n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc. \n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n//\n// saytext.cpp\n//\n// implementation of CHudSayText class\n//\n\n#include \"hud.h\"\n#include \"cl_util.h\"\n#include \"parsemsg.h\"\n\n#include <string.h>\n#include <stdio.h>\n#include <ctype.h>\n#include \"vgui_parser.h\"\n#include \"draw_util.h\"\n#include \"com_weapons.h\"\n#include \"utlstring.h\"\n//#include \"vgui_TeamFortressViewport.h\"\n\nextern float *GetClientColor( int clientIndex );\n\n#define MAX_LINES\t5\n#define MAX_CHARS_PER_LINE\t1024  /* it can be less than this, depending on char size */\n\n// allow 20 pixels on either side of the text\n#define MAX_LINE_WIDTH  ( ScreenWidth - 40 )\n#define LINE_START  10\n\nstatic char g_szLineBuffer[ MAX_LINES + 1 ][ MAX_CHARS_PER_LINE ];\nstatic float *g_pflNameColors[ MAX_LINES + 1 ];\nstatic int g_iNameLengths[ MAX_LINES + 1 ];\nstatic float flScrollTime = 0;  // the time at which the lines next scroll up\n\nstatic int Y_START = 0;\nstatic int line_height = 0;\n\nint CHudSayText :: Init( void )\n{\n\tgHUD.AddHudElem( this );\n\n\tHOOK_MESSAGE( gHUD.m_SayText, SayText );\n\n\tInitHUDData();\n\n\tm_HUD_saytext =\t\t\tgEngfuncs.pfnRegisterVariable( \"hud_saytext_internal\", \"1\", 0 );\n\tm_HUD_saytext_time =\tgEngfuncs.pfnRegisterVariable( \"hud_saytext_time\", \"5\", 0 );\n\n\tm_iFlags |= HUD_INTERMISSION; // is always drawn during an intermission\n\n\treturn 1;\n}\n\n\nvoid CHudSayText :: InitHUDData( void )\n{\n\tmemset( g_szLineBuffer, 0, sizeof g_szLineBuffer );\n\tmemset( g_pflNameColors, 0, sizeof g_pflNameColors );\n\tmemset( g_iNameLengths, 0, sizeof g_iNameLengths );\n}\n\nint CHudSayText :: VidInit( void )\n{\n\treturn 1;\n}\n\n\nint ScrollTextUp( void )\n{\n\tg_szLineBuffer[MAX_LINES][0] = 0;\n\tmemmove( g_szLineBuffer[0], g_szLineBuffer[1], sizeof(g_szLineBuffer) - sizeof(g_szLineBuffer[0]) ); // overwrite the first line // -V512\n\tmemmove( &g_pflNameColors[0], &g_pflNameColors[1], sizeof(g_pflNameColors) - sizeof(g_pflNameColors[0]) );\n\tmemmove( &g_iNameLengths[0], &g_iNameLengths[1], sizeof(g_iNameLengths) - sizeof(g_iNameLengths[0]) );\n\tg_szLineBuffer[MAX_LINES-1][0] = 0;\n\n\tif ( g_szLineBuffer[0][0] == ' ' ) // also scroll up following lines\n\t{\n\t\tg_szLineBuffer[0][0] = 2;\n\t\treturn 1 + ScrollTextUp();\n\t}\n\n\treturn 1;\n}\n\nint CHudSayText :: Draw( float flTime )\n{\n\tint y = Y_START;\n\n\t//if ( ( gViewPort && gViewPort->AllowedToPrintText() == FALSE) || !m_HUD_saytext->value )\n\tif ( !m_HUD_saytext->value )\n\t\treturn 1;\n\n\t// make sure the scrolltime is within reasonable bounds,  to guard against the clock being reset\n\tflScrollTime = min( flScrollTime, flTime + m_HUD_saytext_time->value );\n\n\t// make sure the scrolltime is within reasonable bounds,  to guard against the clock being reset\n\tflScrollTime = min( flScrollTime, flTime + m_HUD_saytext_time->value );\n\n\tif ( flScrollTime <= flTime )\n\t{\n\t\tif ( *g_szLineBuffer[0] )\n\t\t{\n\t\t\tflScrollTime = flTime + m_HUD_saytext_time->value;\n\t\t\t// push the console up\n\t\t\tScrollTextUp();\n\t\t}\n\t\telse\n\t\t{ // buffer is empty,  just disable drawing of this section\n\t\t\tm_iFlags &= ~HUD_DRAW;\n\t\t}\n\t}\n\t\n\tfor (int i = 0; i < MAX_LINES; i++)\n\t{\n\t\tif (!g_szLineBuffer[i][0]) // skip empty string\n\t\t\tcontinue;\n\n\t\tint current_x = LINE_START;\n\t\tconst char* text = g_szLineBuffer[i];\n\t\tsize_t length = strlen(text);\n\n\t\t// default color if not set\n\t\tDrawUtils::SetConsoleTextColor(g_ColorYellow[0], g_ColorYellow[1], g_ColorYellow[2]);\n\n\t\t// buffer for accumulating characters of the same color\n\t\tchar color_buffer[256] = {0};\n\t\tsize_t buffer_pos = 0;\n\n\t\tfor (size_t c = 0; c < length; c++)\n\t\t{\n\t\t\t// color code parse\n\t\t\t// '\\x01' - normal (yellow); '\\0x03' - teamcolor (R GREY B); '\\x04' - green\n\t\t\tif (text[c] == '\\x01' || text[c] == '\\x03' || text[c] == '\\x04')\n\t\t\t{\n\t\t\t\t// if there are characters in the buffer, we draw them with the current color\n\t\t\t\tif (buffer_pos > 0)\n\t\t\t\t{\n\t\t\t\t\tcolor_buffer[buffer_pos] = '\\x00';\n\t\t\t\t\tcurrent_x = DrawUtils::DrawConsoleString(current_x, y, color_buffer);\n\t\t\t\t\tbuffer_pos = 0;\n\t\t\t\t}\n\n\t\t\t\t// switch to color code\n\t\t\t\tchar color_code = text[c];\n\t\t\t\tswitch (color_code)\n\t\t\t\t{\n\t\t\t\t\tcase '\\x01': // yellow normal\n\t\t\t\t\t\tDrawUtils::SetConsoleTextColor(g_ColorYellow[0], g_ColorYellow[1], g_ColorYellow[2]);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase '\\x03': // team color\n\t\t\t\t\t\tif (g_pflNameColors[i])\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tDrawUtils::SetConsoleTextColor(g_pflNameColors[i][0], g_pflNameColors[i][1], g_pflNameColors[i][2]);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase '\\x04': // green\n\t\t\t\t\t\tDrawUtils::SetConsoleTextColor(g_ColorGreen[0], g_ColorGreen[1], g_ColorGreen[2]);\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// add char to buf\n\t\t\tif (buffer_pos < sizeof(color_buffer) - 1)\n\t\t\t{\n\t\t\t\tcolor_buffer[buffer_pos++] = text[c];\n\t\t\t}\n\t\t}\n\n\t\t// draw the remaining characters\n\t\tif (buffer_pos > 0)\n\t\t{\n\t\t\tcolor_buffer[buffer_pos] = '\\x00';\n\t\t\tDrawUtils::DrawConsoleString(current_x, y, color_buffer);\n\t\t}\n\n\t\ty += line_height;\n\t}\n\t\n\treturn 1;\n}\n\nstruct\n{\n\tconst char key[32];\n\tconst char value[64];\n\tint numArgs;\n\tbool allowDead;\n\tbool replaceFirstArgToName;\n\tbool swap;\n} sayTextFmt[] =\n{\n\t{\n\t\t\"#Cstrike_Chat_CT\",\n\t\t\"\\x03(Counter-Terrorist) %s : \\x01%s\",\n\t\t2, true, true, false\n\t},\n\t{\n\t\t\"#Cstrike_Chat_T\",\n\t\t\"\\x03(Terrorist) %s : \\x01%s\",\n\t\t2, true, true, false\n\t},\n\t{\n\t\t\"#Cstrike_Chat_CT_Dead\",\n\t\t\"\\x03*DEAD*(Counter-Terrorist) %s : \\x01%s\",\n\t\t2, false, true, false\n\t},\n\t{\n\t\t\"#Cstrike_Chat_T_Dead\",\n\t\t\"\\x03*DEAD*(Terrorist) %s : \\x01%s\",\n\t\t2, false, true, false\n\t},\n\t{\n\t\t\"#Cstrike_Chat_Spec\",\n\t\t\"\\x03(Spectator) %s : \\x03%s\",\n\t\t2, false, true, false\n\t},\n\t{\n\t\t\"#Cstrike_Chat_All\",\n\t\t\"\\x03%s : \\x01%s\",\n\t\t2, true, true, false\n\t},\n\t{\n\t\t\"#Cstrike_Chat_AllDead\",\n\t\t\"\\x03*DEAD* %s: \\x01%s\",\n\t\t2, false, true, false\n\t},\n\t{\n\t\t\"#Cstrike_Chat_AllSpec\",\n\t\t\"\\x03*SPEC* %s: \\x03%s\",\n\t\t2, false, true, false\n\t},\n\t{\n\t\t\"#Cstrike_Name_Change\",\n\t\t\"\\x03* %s changed name to %s\",\n\t\t2, true, false, false\n\t},\n\t{\n\t\t\"#Cstrike_Chat_T_Loc\",\n\t\t\"\\x03*(Terrorist) %s @ %s : \\x01%s\",\n\t\t3, true, true, true\n\t},\n\t{\n\t\t\"#Cstrike_Chat_CT_Loc\",\n\t\t\"\\x03*(Counter-Terrorist) %s @ %s : \\x01%s\",\n\t\t3, true, true, true\n\t},\n\t{\n\t\t\"#Spec_PlayerItem\",\n\t\t\"%s\",\n\t\t1, true, false, false,\n\t},\n};\n\nint CHudSayText :: MsgFunc_SayText( const char *pszName, int iSize, void *pbuf )\n{\n\tBufferReader reader( pszName, pbuf, iSize );\n\tint client_index, argc, numArgs;\t\t// the client who spoke the message\n\tCUtlString fmt;\n\tCUtlString argv[3];\n\tconst char *fmt_tran = nullptr;\n\tbool allowDead, replaceFirstArgToName, swap;\n\n\tclient_index = reader.ReadByte();\n\n\t// find all arguments\n\tfmt = reader.ReadString();\n\n\tfor( argc = 0; argc < 3; argc++ )\n\t{\n\t\tconst char *arg = reader.ReadString();\n\t\tif( !arg[0] && !reader.Valid() )\n\t\t\tbreak;\n\n\t\targv[argc] = arg;\n\t}\n\n\t// see if argv[0] is translatable\n\tif( fmt[0] == '#' )\n\t{\n\t\tfor( int i = 0; i < sizeof( sayTextFmt ) / sizeof( sayTextFmt[0] ); i++ )\n\t\t{\n\t\t\tif( !strcmp( fmt, sayTextFmt[i].key ))\n\t\t\t{\n\t\t\t\tfmt_tran = (char*)sayTextFmt[i].value;\n\t\t\t\tallowDead = sayTextFmt[i].allowDead;\n\t\t\t\tnumArgs = sayTextFmt[i].numArgs;\n\n\t\t\t\t// VALVEWHY: Second argument may be null string, but not on name changing.\n\t\t\t\treplaceFirstArgToName = sayTextFmt[i].replaceFirstArgToName;\n\n\t\t\t\t// VALVEWHY #2: location is last argument, so swap\n\t\t\t\tswap = sayTextFmt[i].swap;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\t// no translations\n\tif( !fmt_tran )\n\t{\n\t\tfmt_tran = fmt.Get();\n\t\tnumArgs = argc;\n\t\tallowDead = true;\n\t\treplaceFirstArgToName = false;\n\t\tswap = false;\n\t}\n\n\t// Convert indexed placeholders (%s1, %s2) to standard C-format (%s) \n\t// to ensure compatibility with snprintf below.\n\tCUtlString fmt_local = fmt_tran;\n\tLocalize_StripIndices( fmt_local.Access() );\n\n\t// If text is sent from dead player or spectator\n\t// don't draw it, until local player isn't specator or dead.\n\tif( !allowDead && !CL_IsDead() && !g_iUser1 )\n\t{\n\t\treturn 1;\n\t}\n\n\tbool nameArgReplaced = false;\n\n\t// Resolve missing nickname locally via client_index mapping.\n\tif( !replaceFirstArgToName && client_index > 0 && numArgs > 0 && argv[0].Length() == 0 )\n\t{\n\t\tGetPlayerInfo( client_index, &g_PlayerInfoList[client_index] );\n\t\targv[0] = g_PlayerInfoList[client_index].name;\n\t\tnameArgReplaced = true;\n\t}\n\n\tif( replaceFirstArgToName )\n\t{\n\t\tGetPlayerInfo( client_index, &g_PlayerInfoList[client_index] );\n\t\targv[0] = g_PlayerInfoList[client_index].name;\n\t\tnameArgReplaced = true;\n\t}\n\n\t// Strip indices from argument strings too (when not replaced by name)\n\tfor( int i = 0; i < numArgs; ++i )\n\t{\n\t\tif( !(i == 0 && nameArgReplaced) )\n\t\t{\n\t\t\tLocalize_StripIndices( argv[i].Access() );\n\t\t}\n\t}\n\n\tCUtlString dst;\n\tchar tmp[1024];\n\n\tswitch( numArgs )\n\t{\n\tcase 3:\n\t\tif( swap )\n\t\t\tsnprintf( tmp, sizeof( tmp ), fmt_local.Get(), argv[0].Get(), argv[2].Get(), argv[1].Get() );\n\t\telse\n\t\t\tsnprintf( tmp, sizeof( tmp ), fmt_local.Get(), argv[0].Get(), argv[1].Get(), argv[2].Get() );\n\t\tbreak;\n\tcase 2:\n\t\tsnprintf( tmp, sizeof( tmp ), fmt_local.Get(), argv[0].Get(), argv[1].Get() );\n\t\tbreak;\n\tcase 1:\n\t\tsnprintf( tmp, sizeof( tmp ), fmt_local.Get(), argv[0].Get() );\n\t\tbreak;\n\tcase 0:\n\t\tstrncpy( tmp, fmt_local.Get(), sizeof( tmp ) );\n\t\ttmp[sizeof(tmp)-1] = 0;\n\t\tbreak;\n\t}\n\t\n\tdst = tmp;\n\tSayTextPrint( dst.Get(), dst.Length(), client_index );\n\n\treturn 1;\n}\n\nvoid CHudSayText :: SayTextPrint( const char *pszBuf, int iBufSize, int clientIndex )\n{\n\t// find an empty string slot\n\tint i;\n\tfor ( i = 0; i < MAX_LINES; i++ )\n\t{\n\t\tif ( ! *g_szLineBuffer[i] )\n\t\t\tbreak;\n\t}\n\tif ( i == MAX_LINES )\n\t{\n\t\t// force scroll buffer up\n\t\tScrollTextUp();\n\t\ti = MAX_LINES - 1;\n\t}\n\n\tg_iNameLengths[i] = 0;\n\tg_pflNameColors[i] = NULL;\n\n#if 1\n\t// if it's a say message, search for the players name in the string\n\tif ( clientIndex > 0 )\n\t{\n\t\tGetPlayerInfo( clientIndex, &g_PlayerInfoList[clientIndex] );\n\t\tconst char *pName = g_PlayerInfoList[clientIndex].name;\n\t\tg_pflNameColors[i] = GetClientColor( clientIndex );\n\n\t\tif ( pName )\n\t\t{\n\t\t\tconst char *nameInString = strstr( pszBuf, pName );\n\n\t\t\tif ( nameInString )\n\t\t\t{\n\t\t\t\tg_iNameLengths[i] = strlen( pName ) + (nameInString - pszBuf);\n\t\t\t}\n\t\t}\n\t}\n#endif\n\n\n\tstrncpy( g_szLineBuffer[i], pszBuf, max(iBufSize -1, MAX_CHARS_PER_LINE-1) );\n\n\t// make sure the text fits in one line\n\tEnsureTextFitsInOneLineAndWrapIfHaveTo( i );\n\n\t// Set scroll time\n\tif ( i == 0 )\n\t{\n\t\tflScrollTime = gHUD.m_flTime + m_HUD_saytext_time->value;\n\t}\n\n\tm_iFlags |= HUD_DRAW;\n\tPlaySound( \"misc/talk.wav\", 1 );\n\n\tif( !g_iUser1 )\n\t{\n\t\tY_START = ScreenHeight - 60;\n\t}\n\telse\n\t{\n\t\tY_START = ScreenHeight * 4 / 5;\n\t}\n\tY_START -= (line_height * (MAX_LINES+1));\n\n}\n\nvoid CHudSayText :: EnsureTextFitsInOneLineAndWrapIfHaveTo( int line )\n{\n\tint line_width = 0;\n\tDrawUtils::ConsoleStringSize(g_szLineBuffer[line], &line_width, &line_height );\n\n\tif ( (line_width + LINE_START) > MAX_LINE_WIDTH )\n\t{ // string is too long to fit on line\n\t\t// scan the string until we find what word is too long,  and wrap the end of the sentence after the word\n\t\tint length = LINE_START;\n\t\tint tmp_len = 0;\n\t\tchar *last_break = NULL;\n\t\tfor ( char *x = g_szLineBuffer[line]; *x != 0; x++ )\n\t\t{\n\t\t\t// check for a color change, if so skip past it\n\t\t\tif ( x[0] == '/' && x[1] == '(' )\n\t\t\t{\n\t\t\t\tx += 2;\n\t\t\t\t// skip forward until past mode specifier\n\t\t\t\twhile ( *x != 0 && *x != ')' )\n\t\t\t\t\tx++;\n\n\t\t\t\tif ( *x != 0 )\n\t\t\t\t\tx++;\n\n\t\t\t\tif ( *x == 0 )\n\t\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tchar buf[2];\n\t\t\tbuf[1] = 0;\n\n\t\t\tif ( *x == ' ' && x != g_szLineBuffer[line] )  // store each line break,  except for the very first character\n\t\t\t\tlast_break = x;\n\n\t\t\tbuf[0] = *x;  // get the length of the current character\n\t\t\tDrawUtils::ConsoleStringSize( buf, &tmp_len, &line_height );\n\t\t\tlength += tmp_len;\n\n\t\t\tif ( length > MAX_LINE_WIDTH )\n\t\t\t{  // needs to be broken up\n\t\t\t\tif ( !last_break )\n\t\t\t\t\tlast_break = x-1;\n\n\t\t\t\tx = last_break;\n\n\t\t\t\t// find an empty string slot\n\t\t\t\tint j;\n\t\t\t\tdo \n\t\t\t\t{\n\t\t\t\t\tfor ( j = 0; j < MAX_LINES; j++ )\n\t\t\t\t\t{\n\t\t\t\t\t\tif ( ! *g_szLineBuffer[j] )\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tif ( j == MAX_LINES )\n\t\t\t\t\t{\n\t\t\t\t\t\t// need to make more room to display text, scroll stuff up then fix the pointers\n\t\t\t\t\t\tint linesmoved = ScrollTextUp();\n\t\t\t\t\t\tline -= linesmoved;\n\t\t\t\t\t\tlast_break = last_break - (sizeof(g_szLineBuffer[0]) * linesmoved);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\twhile ( j == MAX_LINES );\n\n\t\t\t\t// copy remaining string into next buffer,  making sure it starts with a space character\n\t\t\t\tif ( (char)*last_break == (char)' ' )\n\t\t\t\t{\n\t\t\t\t\tint linelen = strlen(g_szLineBuffer[j]);\n\t\t\t\t\tint remaininglen = strlen(last_break);\n\n\t\t\t\t\tif ( (linelen - remaininglen) <= MAX_CHARS_PER_LINE )\n\t\t\t\t\t\tstrcat( g_szLineBuffer[j], last_break );\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tif ( (strlen(g_szLineBuffer[j]) - strlen(last_break) - 2) < MAX_CHARS_PER_LINE )\n\t\t\t\t\t{\n\t\t\t\t\t\tstrcat( g_szLineBuffer[j], \" \" );\n\t\t\t\t\t\tstrcat( g_szLineBuffer[j], last_break );\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t*last_break = 0; // cut off the last string\n\n\t\t\t\tEnsureTextFitsInOneLineAndWrapIfHaveTo( j );\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "cl_dll/status_icons.cpp",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\t\n*\tThis product contains software technology licensed from Id \n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc. \n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n//\n// status_icons.cpp\n//\n#include \"hud.h\"\n#include \"cl_util.h\"\n#include \"const.h\"\n#include \"entity_state.h\"\n#include \"cl_entity.h\"\n#include <string.h>\n#include <stdio.h>\n#include \"parsemsg.h\"\n#include \"event_api.h\"\n#include \"com_weapons.h\"\n\nint CHudStatusIcons::Init( void )\n{\n\tHOOK_MESSAGE( gHUD.m_StatusIcons, StatusIcon );\n\n\tgHUD.AddHudElem( this );\n\n\tReset();\n\n\treturn 1;\n}\n\nint CHudStatusIcons::VidInit( void )\n{\n\treturn 1;\n}\n\nvoid CHudStatusIcons::Reset( void )\n{\n\tmemset( m_IconList, 0, sizeof m_IconList );\n\tm_iFlags &= ~HUD_DRAW;\n}\n\n// Draw status icons along the left-hand side of the screen\nint CHudStatusIcons::Draw( float flTime )\n{\n\tif (gEngfuncs.IsSpectateOnly())\n\t\treturn 1;\n\t// find starting position to draw from, along right-hand side of screen\n\tint x = 5;\n\tint y = ScreenHeight / 2;\n\n\t// loop through icon list, and draw any valid icons drawing up from the middle of screen\n\tfor ( int i = 0; i < MAX_ICONSPRITES; i++ )\n\t{\n\t\tif ( m_IconList[i].spr )\n\t\t{\n\t\t\ty -= ( m_IconList[i].rc.Height() ) + 5;\n\t\t\t\n\t\t\tif( g_bInBombZone && !strcmp(m_IconList[i].szSpriteName, \"c4\") && ((int)(flTime * 10) % 2))\n\t\t\t\tSPR_Set( m_IconList[i].spr, 255, 16, 16 );\n\t\t\telse SPR_Set( m_IconList[i].spr, m_IconList[i].r, m_IconList[i].g, m_IconList[i].b );\n\t\t\tSPR_DrawAdditive( 0, x, y, &m_IconList[i].rc );\n\t\t}\n\t}\n\t\n\treturn 1;\n}\n\n// Message handler for StatusIcon message\n// accepts five values:\n//\t\tbyte   : TRUE = ENABLE icon, FALSE = DISABLE icon\n//\t\tstring : the sprite name to display\n//\t\tbyte   : red\n//\t\tbyte   : green\n//\t\tbyte   : blue\nint CHudStatusIcons::MsgFunc_StatusIcon( const char *pszName, int iSize, void *pbuf )\n{\n\tBufferReader reader( pszName, pbuf, iSize );\n\n\tint ShouldEnable = reader.ReadByte();\n\tchar *pszIconName = reader.ReadString();\n\n\tif ( ShouldEnable )\n\t{\n\t\tint r = reader.ReadByte();\n\t\tint g = reader.ReadByte();\n\t\tint b = reader.ReadByte();\n\t\tEnableIcon( pszIconName, r, g, b );\n\t\tm_iFlags |= HUD_DRAW;\n\t}\n\telse\n\t{\n\t\tDisableIcon( pszIconName );\n\t}\n\n\treturn 1;\n}\n\n// add the icon to the icon list, and set it's drawing color\nvoid CHudStatusIcons::EnableIcon( const char *pszIconName, unsigned char red, unsigned char green, unsigned char blue )\n{\n\t// check to see if the sprite is in the current list\n\tint i;\n\tfor ( i = 0; i < MAX_ICONSPRITES; i++ )\n\t{\n\t\tif ( !stricmp( m_IconList[i].szSpriteName, pszIconName ) )\n\t\t\tbreak;\n\t}\n\n\tif ( i == MAX_ICONSPRITES )\n\t{\n\t\t// icon not in list, so find an empty slot to add to\n\t\tfor ( i = 0; i < MAX_ICONSPRITES; i++ )\n\t\t{\n\t\t\tif ( !m_IconList[i].spr )\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\t// if we've run out of space in the list, overwrite the first icon\n\tif ( i == MAX_ICONSPRITES )\n\t{\n\t\ti = 0;\n\t}\n\n\t// Load the sprite and add it to the list\n\t// the sprite must be listed in hud.txt\n\tint spr_index = gHUD.GetSpriteIndex( pszIconName );\n\tm_IconList[i].spr = gHUD.GetSprite( spr_index );\n\tm_IconList[i].rc = gHUD.GetSpriteRect( spr_index );\n\tm_IconList[i].r = red;\n\tm_IconList[i].g = green;\n\tm_IconList[i].b = blue;\n\tstrncpy( m_IconList[i].szSpriteName, pszIconName, MAX_ICONSPRITENAME_LENGTH );\n\tm_IconList[i].szSpriteName[MAX_ICONSPRITENAME_LENGTH-1]=0;\n}\n\nvoid CHudStatusIcons::DisableIcon( const char *pszIconName )\n{\n\t// find the sprite is in the current list\n\tfor ( int i = 0; i < MAX_ICONSPRITES; i++ )\n\t{\n\t\tif ( !stricmp( m_IconList[i].szSpriteName, pszIconName ) )\n\t\t{\n\t\t\t// clear the item from the list\n\t\t\tmemset( &m_IconList[i], 0, sizeof( icon_sprite_t ) );\n\t\t\treturn;\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "cl_dll/statusbar.cpp",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\t\n*\tThis product contains software technology licensed from Id \n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc. \n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n//\n// statusbar.cpp\n//\n// generic text status bar, set by game dll\n// runs across bottom of screen\n//\n\n#include \"hud.h\"\n#include \"cl_util.h\"\n#include \"parsemsg.h\"\n\n#include <string.h>\n#include <stdio.h>\n#include \"draw_util.h\"\n\n#define STATUSBAR_ID_LINE\t\t0\n\ninline void InsertTextMsg( char *szDst, size_t sLen, const char *szMsgName)\n{\n\tclient_textmessage_t *msg = TextMessageGet(szMsgName);\n\tif( msg )\n\t{\n\t\tstrncpy( szDst, msg->pMessage, sLen );\n\t}\n\telse strncpy( szDst, szMsgName, sLen );\n\tszDst[sLen-1] = 0;\n}\n\nint CHudStatusBar :: Init( void )\n{\n\tgHUD.AddHudElem( this );\n\n\tHOOK_MESSAGE( gHUD.m_StatusBar, StatusText );\n\tHOOK_MESSAGE( gHUD.m_StatusBar, StatusValue );\n\n\tReset();\n\n\thud_centerid = CVAR_CREATE( \"hud_centerid\", \"0\", FCVAR_ARCHIVE );\n\n\treturn 1;\n}\n\nint CHudStatusBar :: VidInit( void )\n{\n\t// Load sprites here\n\n\treturn 1;\n}\n\nvoid CHudStatusBar :: Reset( void )\n{\n\tint i = 0;\n\n\tm_iFlags &= ~HUD_DRAW;  // start out inactive\n\tfor ( i = 0; i < MAX_STATUSBAR_LINES; i++ )\n\t\tm_szStatusText[i][0] = 0;\n\tmemset( m_iStatusValues, 0, sizeof m_iStatusValues );\n\n\tm_iStatusValues[0] = 1;  // 0 is the special index, which always returns true\n\n\tfor ( i = 0; i < MAX_PLAYERS; i++ )\n\t\tg_PlayerExtraInfo[i].showhealth = 0.0f;\n\n\t// reset our colors for the status bar lines (yellow is default)\n\tfor ( i = 0; i < MAX_STATUSBAR_LINES; i++ )\n\t\tm_pflNameColors[i] = g_ColorYellow;\n}\n\nvoid CHudStatusBar :: ParseStatusString( int line_num )\n{\n\t// localise string first\n\tchar szBuffer[MAX_STATUSTEXT_LENGTH];\n\tmemset( szBuffer, 0, sizeof szBuffer );\n\tgHUD.m_TextMessage.LocaliseTextString( m_szStatusText[line_num], szBuffer, MAX_STATUSTEXT_LENGTH );\n\n\t// parse m_szStatusText & m_iStatusValues into m_szStatusBar\n\tmemset( m_szStatusBar[line_num], 0, MAX_STATUSTEXT_LENGTH );\n\tchar *src = szBuffer;\n\tchar *dst = m_szStatusBar[line_num];\n\n\tchar *src_start = src, *dst_start = dst;\n\n\twhile ( *src != 0 )\n\t{\n\t\twhile ( *src == '\\n' )\n\t\t\tsrc++;  // skip over any newlines\n\n\t\tif ( ((src - src_start) >= MAX_STATUSTEXT_LENGTH) || ((dst - dst_start) >= MAX_STATUSTEXT_LENGTH) )\n\t\t\tbreak;\n\n\t\tint index = atoi( src );\n\t\t// should we draw this line?\n\t\tif ( (index >= 0 && index < MAX_STATUSBAR_VALUES) && (m_iStatusValues[index] != 0) )\n\t\t{  // parse this line and append result to the status bar\n\t\t\twhile ( *src >= '0' && *src <= '9' )\n\t\t\t\tsrc++;\n\n\t\t\tif ( *src == '\\n' || *src == 0 )\n\t\t\t\tcontinue; // no more left in this text line\n\n\t\t\t// copy the text, char by char, until we hit a % or a \\n\n\t\t\twhile ( *src != '\\n' && *src != 0 )\n\t\t\t{\n\t\t\t\tif ( *src != '%' )\n\t\t\t\t{  // just copy the character\n\t\t\t\t\t*dst = *src;\n\t\t\t\t\tdst++, src++;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t// get the descriptor\n\t\t\t\t\tchar valtype = *(++src); // move over %\n\n\t\t\t\t\t// if it's a %, draw a % sign\n\t\t\t\t\tif ( valtype == '%' )\n\t\t\t\t\t{\n\t\t\t\t\t\t*dst = valtype;\n\t\t\t\t\t\tdst++, src++;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\n\t\t\t\t\t// move over descriptor, then get and move over the index\n\t\t\t\t\tindex = atoi( ++src ); \n\t\t\t\t\twhile ( *src >= '0' && *src <= '9' )\n\t\t\t\t\t\tsrc++;\n\n\t\t\t\t\tif ( index >= 0 && index < MAX_STATUSBAR_VALUES )\n\t\t\t\t\t{\n\t\t\t\t\t\tint indexval = m_iStatusValues[index];\n\n\t\t\t\t\t\t// get the string to substitute in place of the %XX\n\t\t\t\t\t\tchar szRepString[MAX_PLAYER_NAME_LENGTH];\n\t\t\t\t\t\tswitch ( valtype )\n\t\t\t\t\t\t{\n\t\t\t\t\t\tcase 'p':  // player name\n\t\t\t\t\t\t\tGetPlayerInfo( indexval, &g_PlayerInfoList[indexval] );\n\t\t\t\t\t\t\tif ( g_PlayerInfoList[indexval].name != NULL )\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tstrncpy( szRepString, g_PlayerInfoList[indexval].name, MAX_PLAYER_NAME_LENGTH );\n\t\t\t\t\t\t\t\tgHUD.m_Health.m_iPlayerLastPointedAt = indexval;\n\t\t\t\t\t\t\t\tm_pflNameColors[line_num] = GetClientColor( indexval );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tstrncpy( szRepString, \"******\", MAX_PLAYER_NAME_LENGTH );\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'i':  // number\n\t\t\t\t\t\t\tg_PlayerExtraInfo[gHUD.m_Health.m_iPlayerLastPointedAt].health = indexval;\n\t\t\t\t\t\t\tg_PlayerExtraInfo[gHUD.m_Health.m_iPlayerLastPointedAt].showhealth = gHUD.m_flTime + 5.0f;\n\t\t\t\t\t\t\tsprintf( szRepString, \"%d\", indexval );\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'h':  // health\n\t\t\t\t\t\t\tInsertTextMsg(szRepString, MAX_PLAYER_NAME_LENGTH, \"Health\");\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'c':\n\t\t\t\t\t\t\tif( indexval == 1 )\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tInsertTextMsg(szRepString, MAX_PLAYER_NAME_LENGTH, \"Friend\");\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse if( indexval == 2 )\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tInsertTextMsg(szRepString, MAX_PLAYER_NAME_LENGTH, \"Enemy\");\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse if( indexval == 3 )\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tInsertTextMsg(szRepString, MAX_PLAYER_NAME_LENGTH, \"Hostage\");\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse szRepString[0] = 0;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tszRepString[0] = 0;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tfor ( char *cp = szRepString; *cp != 0 && ((dst - dst_start) < MAX_STATUSTEXT_LENGTH); cp++, dst++ )\n\t\t\t\t\t\t\t*dst = *cp;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\t// skip to next line of text\n\t\t\twhile ( *src != 0 && *src != '\\n' )\n\t\t\t\tsrc++;\n\t\t}\n\t}\n}\n\nint CHudStatusBar :: Draw( float fTime )\n{\n\tbool empty = true;\n\n\tif ( m_bReparseString )\n\t{\n\t\tfor ( int i = 0; i < MAX_STATUSBAR_LINES; i++ )\n\t\t{\n\t\t\tm_pflNameColors[i] = g_ColorYellow;\n\t\t\tParseStatusString( i );\n\t\t}\n\t\tm_bReparseString = FALSE;\n\t}\n\n\tif( g_iUser1 > 0 )\n\t{\n\t\t// this is a spectator, so don't draw any statusbars\n\t\treturn 0;\n\t}\n\n\tint Y_START = ScreenHeight - YRES(32 + 4);\n\n\t// Draw the status bar lines\n\tfor ( int i = 0; i < MAX_STATUSBAR_LINES; i++ )\n\t{\n\t\tif( !m_szStatusBar[i][0] )\n\t\t\tcontinue;\n\t\telse empty = false;\n\n\t\tint TextHeight, TextWidth;\n\t\tDrawUtils::ConsoleStringSize( m_szStatusBar[i], &TextWidth, &TextHeight );\n\n\t\tint x = 4;\n\t\tint y = Y_START - ( 4 + TextHeight * i ); // draw along bottom of screen\n\n\t\t// let user set status ID bar centering\n\t\tif ( i == STATUSBAR_ID_LINE && hud_centerid->value != 0.0f )\n\t\t{\n\t\t\tx = max( 0, max(2, (ScreenWidth - TextWidth)) / 2 );\n\t\t\ty = (ScreenHeight / 2) + (TextHeight * hud_centerid->value );\n\t\t}\n\n\t\tif ( m_pflNameColors[i] )\n\t\t\tDrawUtils::SetConsoleTextColor( m_pflNameColors[i][0], m_pflNameColors[i][1], m_pflNameColors[i][2] );\n\n\t\tDrawUtils::DrawConsoleString( x, y, m_szStatusBar[i] );\n\t}\n\n\tif( empty )\n\t{\n\t\tm_iFlags &= ~HUD_DRAW;\n\t}\n\n\treturn 1;\n}\n\n// Message handler for StatusText message\n// accepts two values:\n//\t\tbyte: line number of status bar text \n//\t\tstring: status bar text\n// this string describes how the status bar should be drawn\n// a semi-regular expression:\n// ( slotnum ([a..z] [%pX] [%iX])*)*\n// where slotnum is an index into the Value table (see below)\n// if slotnum is 0, the string is always drawn\n// if StatusValue[slotnum] != 0, the following string is drawn, up to the next newline - otherwise the text is skipped up to next newline\n// %pX, where X is an integer, will substitute a player name here, getting the player index from StatusValue[X]\n// %iX, where X is an integer, will substitute a number here, getting the number from StatusValue[X]\nint CHudStatusBar :: MsgFunc_StatusText( const char *pszName, int iSize, void *pbuf )\n{\n\tBufferReader reader( pszName, pbuf, iSize );\n\n\tint line = reader.ReadByte();\n\n\tif ( line < 0 || line >= MAX_STATUSBAR_LINES )\n\t\treturn 1;\n\n\tstrncpy( m_szStatusText[line], reader.ReadString(), MAX_STATUSTEXT_LENGTH );\n\tm_szStatusText[line][MAX_STATUSTEXT_LENGTH-1] = 0;  // ensure it's null terminated ( strncpy() won't null terminate if read string too long)\n\n\tm_iFlags |= HUD_DRAW;  // we have status text, so turn on the status bar\n\n\tm_bReparseString = TRUE;\n\n\treturn 1;\n}\n\n// Message handler for StatusText message\n// accepts two values:\n//\t\tbyte: index into the status value array\n//\t\tshort: value to store\nint CHudStatusBar :: MsgFunc_StatusValue( const char *pszName, int iSize, void *pbuf )\n{\n\tBufferReader reader( pszName, pbuf, iSize );\n\n\tint index = reader.ReadByte();\n\tif ( index < 1 || index >= MAX_STATUSBAR_VALUES )\n\t\treturn 1; // index out of range\n\n\tm_iStatusValues[index] = reader.ReadShort();\n\tm_iFlags |= HUD_DRAW;  // we have status text, so turn on the status bar\n\n\tm_bReparseString = TRUE;\n\t\n\treturn 1;\n}\n"
  },
  {
    "path": "cl_dll/studio_util.cpp",
    "content": "//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============\n//\n// Purpose: \n//\n// $NoKeywords: $\n//=============================================================================\n\n#include <memory.h>\n#include \"hud.h\"\n#include \"cl_util.h\"\n#include \"const.h\"\n#include \"com_model.h\"\n#include \"studio_util.h\"\n\n#ifdef VECTORIZE_SINCOS\n\n// Test shown that this is not so effictively\n#if defined(__SSE__) || defined(_M_IX86_FP)\n#if defined(__SSE2__) || defined(_M_IX86_FP)\n  #define USE_SSE2\n #endif\n#include \"sse_mathfun.h\"\n#endif\n\n\n#if defined(__ARM_NEON__) || defined(__NEON__)\n\t#include \"neon_mathfun.h\"\n#endif\n\n\nvoid SinCosFastVector(float r1, float r2, float r3, float r4,\n\t\t\t\t\t  float *s0, float *s1, float *s2, float *s3,\n\t\t\t\t\t  float *c0, float *c1, float *c2, float *c3)\n{\n\tv4sf rad_vector = {r1, r2, r3, r4};\n\tv4sf sin_vector, cos_vector;\n\n\tsincos_ps(rad_vector, &sin_vector, &cos_vector);\n\n\t*s0 = sin_vector[0];\n\tif(s1) *s1 = sin_vector[1];\n\tif(s2) *s2 = sin_vector[2];\n\tif(s3) *s3 = sin_vector[3];\n\n\t*c0 = cos_vector[0];\n\tif(s1) *c1 = cos_vector[1];\n\tif(s2) *c2 = cos_vector[2];\n\tif(s3) *c3 = cos_vector[3];\n}\n#endif\n\n\n/*\n====================\nCrossProduct\n\n====================\n*/\n/*\nvoid CrossProduct (const float *v1, const float *v2, float *cross)\n{\n\tcross[0] = v1[1]*v2[2] - v1[2]*v2[1];\n\tcross[1] = v1[2]*v2[0] - v1[0]*v2[2];\n\tcross[2] = v1[0]*v2[1] - v1[1]*v2[0];\n}\n*/\n/*\n================\nConcatTransforms\n\n================\n*/\nvoid ConcatTransforms (float in1[3][4], float in2[3][4], float out[3][4])\n{\n\tout[0][0] = in1[0][0] * in2[0][0] + in1[0][1] * in2[1][0] + in1[0][2] * in2[2][0];\n\tout[0][1] = in1[0][0] * in2[0][1] + in1[0][1] * in2[1][1] + in1[0][2] * in2[2][1];\n\tout[0][2] = in1[0][0] * in2[0][2] + in1[0][1] * in2[1][2] +\tin1[0][2] * in2[2][2];\n\tout[0][3] = in1[0][0] * in2[0][3] + in1[0][1] * in2[1][3] +\tin1[0][2] * in2[2][3] + in1[0][3];\n\tout[1][0] = in1[1][0] * in2[0][0] + in1[1][1] * in2[1][0] +\tin1[1][2] * in2[2][0];\n\tout[1][1] = in1[1][0] * in2[0][1] + in1[1][1] * in2[1][1] +\tin1[1][2] * in2[2][1];\n\tout[1][2] = in1[1][0] * in2[0][2] + in1[1][1] * in2[1][2] +\tin1[1][2] * in2[2][2];\n\tout[1][3] = in1[1][0] * in2[0][3] + in1[1][1] * in2[1][3] +\tin1[1][2] * in2[2][3] + in1[1][3];\n\tout[2][0] = in1[2][0] * in2[0][0] + in1[2][1] * in2[1][0] +\tin1[2][2] * in2[2][0];\n\tout[2][1] = in1[2][0] * in2[0][1] + in1[2][1] * in2[1][1] +\tin1[2][2] * in2[2][1];\n\tout[2][2] = in1[2][0] * in2[0][2] + in1[2][1] * in2[1][2] +\tin1[2][2] * in2[2][2];\n\tout[2][3] = in1[2][0] * in2[0][3] + in1[2][1] * in2[1][3] +\tin1[2][2] * in2[2][3] + in1[2][3];\n}\n\n// angles index are not the same as ROLL, PITCH, YAW\n\n/*\n====================\nAngleQuaternion\n\n====================\n*/\nvoid AngleQuaternion( float *angles, vec4_t quaternion )\n{\n\tfloat\t\tsr, sp, sy, cr, cp, cy;\n\n#ifdef VECTORIZE_SINCOS\n\tSinCosFastVector( angles[2] * 0.5,\n\t\t\t\t\t  angles[1] * 0.5,\n\t\t\t\t\t  angles[0] * 0.5, 0,\n\t\t\t\t\t  &sy, &sp, &sr, NULL,\n\t\t\t\t\t  &cy, &cp, &cr, NULL);\n#else\n\tfloat\t\tangle;\n\n\t// FIXME: rescale the inputs to 1/2 angle\n\tangle = angles[2] * 0.5;\n\tsy = sin(angle);\n\tcy = cos(angle);\n\tangle = angles[1] * 0.5;\n\tsp = sin(angle);\n\tcp = cos(angle);\n\tangle = angles[0] * 0.5;\n\tsr = sin(angle);\n\tcr = cos(angle);\n#endif\n\n\tquaternion[0] = sr * cp * cy - cr * sp * sy; // X\n\tquaternion[1] = cr * sp * cy + sr * cp * sy; // Y\n\tquaternion[2] = cr * cp * sy - sr * sp * cy; // Z\n\tquaternion[3] = cr * cp * cy + sr * sp * sy; // W\n}\n\n/*\n====================\nQuaternionSlerp\n\n====================\n*/\nvoid QuaternionSlerp( vec4_t p, vec4_t q, float t, vec4_t qt )\n{\n\tint i;\n\tfloat\tomega, cosom, sinom, sclp, sclq;\n\n\t// decide if one of the quaternions is backwards\n\tfloat a = 0;\n\tfloat b = 0;\n\n\tfor (i = 0; i < 4; i++)\n\t{\n\t\ta += (p[i]-q[i])*(p[i]-q[i]);\n\t\tb += (p[i]+q[i])*(p[i]+q[i]);\n\t}\n\tif (a > b)\n\t{\n\t\tfor (i = 0; i < 4; i++)\n\t\t{\n\t\t\tq[i] = -q[i];\n\t\t}\n\t}\n\n\tcosom = p[0]*q[0] + p[1]*q[1] + p[2]*q[2] + p[3]*q[3];\n\n\tif ((1.0 + cosom) > 0.000001)\n\t{\n\t\tif ((1.0 - cosom) > 0.000001)\n\t\t{\n\t\t\tomega = acos( cosom );\n\t\t\tsinom = sin( omega );\n\t\t\tsclp = sin( (1.0 - t)*omega) / sinom;\n\t\t\tsclq = sin( t*omega ) / sinom;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tsclp = 1.0 - t;\n\t\t\tsclq = t;\n\t\t}\n\t\tfor (i = 0; i < 4; i++) {\n\t\t\tqt[i] = sclp * p[i] + sclq * q[i];\n\t\t}\n\t}\n\telse\n\t{\n\t\tqt[0] = -q[1];\n\t\tqt[1] = q[0];\n\t\tqt[2] = -q[3];\n\t\tqt[3] = q[2];\n\t\tsclp = sin( (1.0 - t) * (0.5 * M_PI));\n\t\tsclq = sin( t * (0.5 * M_PI));\n\t\tfor (i = 0; i < 3; i++)\n\t\t{\n\t\t\tqt[i] = sclp * p[i] + sclq * qt[i];\n\t\t}\n\t}\n}\n\n/*\n====================\nQuaternionMatrix\n\n====================\n*/\nvoid QuaternionMatrix( vec4_t quaternion, float (*matrix)[4] )\n{\n\tmatrix[0][0] = 1.0 - 2.0 * quaternion[1] * quaternion[1] - 2.0 * quaternion[2] * quaternion[2];\n\tmatrix[1][0] = 2.0 * quaternion[0] * quaternion[1] + 2.0 * quaternion[3] * quaternion[2];\n\tmatrix[2][0] = 2.0 * quaternion[0] * quaternion[2] - 2.0 * quaternion[3] * quaternion[1];\n\n\tmatrix[0][1] = 2.0 * quaternion[0] * quaternion[1] - 2.0 * quaternion[3] * quaternion[2];\n\tmatrix[1][1] = 1.0 - 2.0 * quaternion[0] * quaternion[0] - 2.0 * quaternion[2] * quaternion[2];\n\tmatrix[2][1] = 2.0 * quaternion[1] * quaternion[2] + 2.0 * quaternion[3] * quaternion[0];\n\n\tmatrix[0][2] = 2.0 * quaternion[0] * quaternion[2] + 2.0 * quaternion[3] * quaternion[1];\n\tmatrix[1][2] = 2.0 * quaternion[1] * quaternion[2] - 2.0 * quaternion[3] * quaternion[0];\n\tmatrix[2][2] = 1.0 - 2.0 * quaternion[0] * quaternion[0] - 2.0 * quaternion[1] * quaternion[1];\n}\n"
  },
  {
    "path": "cl_dll/text_message.cpp",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\t\n*\tThis product contains software technology licensed from Id \n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc. \n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n//\n// text_message.cpp\n//\n// implementation of CHudTextMessage class\n//\n// this class routes messages through titles.txt for localisation\n//\n\n#include \"hud.h\"\n#include \"cl_util.h\"\n#include <string.h>\n#include <stdio.h>\n#include \"parsemsg.h\"\n#include \"vgui_parser.h\"\n#include \"ctype.h\"\n#include \"draw_util.h\"\n\nint CHudTextMessage::Init(void)\n{\n\tHOOK_MESSAGE( gHUD.m_TextMessage, TextMsg );\n\n\tgHUD.AddHudElem( this );\n\tm_iFlags = 0;\n\n\treturn 1;\n}\n\n// Searches through the string for any msg names (indicated by a '#')\n// any found are looked up in titles.txt and the new message substituted\n// the new value is pushed into dst_buffer\nchar *CHudTextMessage::LocaliseTextString( const char *msg, char *dst_buffer, int buffer_size )\n{\n\tint len = buffer_size;\n\tchar *dst = dst_buffer;\n\tfor ( char *src = (char*)msg; *src != 0 && buffer_size > 0; buffer_size-- )\n\t{\n\t\tif ( *src == '#' )\n\t\t{\n\t\t\t// cut msg name out of string\n\t\t\tstatic char word_buf[255];\n\t\t\tchar *wdst = word_buf, *word_start = src;\n\t\t\tfor ( ++src ; (*src >= 'A' && *src <= 'z') || (*src >= '0' && *src <= '9'); wdst++, src++ )\n\t\t\t{\n\t\t\t\t*wdst = *src;\n\t\t\t}\n\t\t\t*wdst = 0;\n\n\t\t\t// lookup msg name in titles.txt\n\t\t\tclient_textmessage_t *clmsg = TextMessageGet( word_buf );\n\t\t\tif ( !clmsg || !(clmsg->pMessage) )\n\t\t\t{\n\t\t\t\t// look also in vgui2 translations\n\t\t\t\tconst char *str = Localize( word_buf );\n\t\t\t\tif( str )\n\t\t\t\t{\n\t\t\t\t\tstrncpy(dst, str, buffer_size);\n\t\t\t\t\tbuffer_size = 0;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tsrc = word_start;\n\t\t\t\t\t*dst = *src;\n\t\t\t\t\tdst++, src++;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif(clmsg->pMessage[0] == '#')\n\t\t\t{\n\t\t\t\tstrncpy(dst, Localize(clmsg->pMessage+1), buffer_size);\n\t\t\t\tbuffer_size = 0;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t// copy string into message over the msg name\n\t\t\t\tfor ( char *wsrc = (char*)clmsg->pMessage; *wsrc != 0; wsrc++, dst++ )\n\t\t\t\t{\n\t\t\t\t\t*dst = *wsrc;\n\t\t\t\t}\n\t\t\t\t*dst = 0;\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\t*dst = *src;\n\t\t\tdst++, src++;\n\t\t\t*dst = 0;\n\t\t}\n\t}\n\n\tdst_buffer[len-1] = 0; // ensure null termination\n\treturn dst_buffer;\n}\n\n// As above, but with a local static buffer\nchar *CHudTextMessage::BufferedLocaliseTextString( const char *msg )\n{\n\tstatic char dst_buffer[1024];\n\tLocaliseTextString( msg, dst_buffer, 1024 );\n\treturn dst_buffer;\n}\n\n// Simplified version of LocaliseTextString;  assumes string is only one word\nchar *CHudTextMessage::LookupString( char *msg, int *msg_dest )\n{\n\tif ( !msg )\n\t\treturn (char*)\"\";\n\n\t// '#' character indicates this is a reference to a string in titles.txt, and not the string itself\n\tif ( msg[0] == '#' ) \n\t{\n\t\t// this is a message name, so look up the real message\n\t\tclient_textmessage_t *clmsg = TextMessageGet( msg+1 );\n\n\t\tif ( !clmsg || !(clmsg->pMessage) )\n\t\t\treturn (char*)msg; // lookup failed, so return the original string\n\t\t\t\t\n\t\tif ( msg_dest )\n\t\t{\n\t\t\t// check to see if titles.txt info overrides msg destination\n\t\t\t// if clmsg->effect is less than 0, then clmsg->effect holds -1 * message_destination\n\t\t\tif ( clmsg->effect < 0 )  // \n\t\t\t\t*msg_dest = -clmsg->effect;\n\t\t}\n\n\t\tif( clmsg->pMessage[0] == '#')\n\t\t\treturn (char *)Localize( clmsg->pMessage + 1);\n\n\t\treturn (char*)clmsg->pMessage;\n\t}\n\telse\n\t{  // nothing special about this message, so just return the same string\n\t\treturn (char*)msg;\n\t}\n}\n\nvoid StripEndNewlineFromString( char *str )\n{\n\tint s = strlen( str ) - 1;\n\tif ( str[s] == '\\n' || str[s] == '\\r' )\n\t\tstr[s] = 0;\n}\n\n// converts all '\\r' characters to '\\n', so that the engine can deal with the properly\n// returns a pointer to str\nchar* ConvertCRtoNL( char *str )\n{\n\tfor ( char *ch = str; *ch != 0; ch++ )\n\t\tif ( *ch == '\\r' )\n\t\t\t*ch = '\\n';\n\treturn str;\n}\n\n// Message handler for text messages\n// displays a string, looking them up from the titles.txt file, which can be localised\n// parameters:\n//   byte:   message direction  ( HUD_PRINTCONSOLE, HUD_PRINTNOTIFY, HUD_PRINTCENTER, HUD_PRINTTALK )\n//   string: message\n// optional parameters:\n//   string: message parameter 1\n//   string: message parameter 2\n//   string: message parameter 3\n//   string: message parameter 4\n// any string that starts with the character '#' is a message name, and is used to look up the real message in titles.txt\n// the next (optional) one to four strings are parameters for that string (which can also be message names if they begin with '#')\n#define MAX_TEXTMSG_STRING 512\nint CHudTextMessage::MsgFunc_TextMsg( const char *pszName, int iSize, void *pbuf )\n{\n\tBufferReader reader( pszName, pbuf, iSize );\n\n\tint msg_dest = reader.ReadByte();\n\tint clientIdx = -1;\n\n\tstatic char szBuf[6][MAX_TEXTMSG_STRING];\n\tchar *msg_text = LookupString( reader.ReadString(), &msg_dest );\n\tmsg_text = strncpy( szBuf[0], msg_text, MAX_TEXTMSG_STRING );\n\tszBuf[0][MAX_TEXTMSG_STRING - 1] = 0;\n\n\t// keep reading strings and using C format strings for substituting the strings into the localised text string\n\tfor( int i = 1; i <= 4; i++ )\n\t{\n\t\tchar *raw = reader.ReadString();\n\t\t\n\t\t// Don't replace the second format argument (player name)\n\t\tchar *str = (i == 2) ? raw : LookupString( raw );\n\t\tconst char *localized = (i == 2) ? str : Localize( str );\n\n\t\tstrncpy( szBuf[i], localized, MAX_TEXTMSG_STRING );\n\t\tszBuf[i][MAX_TEXTMSG_STRING-1] = 0;\n\n\t\t// these strings are meant for substitution into the main strings, so cull the automatic end newlines\n\t\tStripEndNewlineFromString( szBuf[i] );\n\t}\n\n\tchar *psz = szBuf[5];\n\n\t// Remove numbers after %s.\n\t// VALVEWHY?\n\tLocalize_StripIndices( msg_text );\n\n\tswitch ( msg_dest )\n\t{\n\tcase HUD_PRINTCENTER:\n\t{\n\t\tsnprintf( psz, MAX_TEXTMSG_STRING, msg_text, szBuf[1], szBuf[2], szBuf[3], szBuf[4] );\n\n\t\tConvertCRtoNL( psz );\n\n\t\tint len = DrawUtils::ConsoleStringLen( psz );\n\n\t\tDrawUtils::DrawConsoleString( (ScreenWidth - len) / 2, ScreenHeight / 3, psz );\n\n\t\tCenterPrint( psz );\n\t\tbreak;\n\t}\n\tcase HUD_PRINTNOTIFY:\n\t\tpsz[0] = 1;  // mark this message to go into the notify buffer\n\t\tsnprintf( psz+1, MAX_TEXTMSG_STRING - 1, msg_text, szBuf[1], szBuf[2], szBuf[3], szBuf[4] );\n\t\tConsolePrint( ConvertCRtoNL( psz ) );\n\t\tbreak;\n\n\tcase HUD_PRINTTALK:\n\t\tpsz[0] = 2; // mark, so SayTextPrint will color it\n\t\tsnprintf( psz+1, MAX_TEXTMSG_STRING-1, msg_text, szBuf[1], szBuf[2], szBuf[3], szBuf[4] );\n\t\tgHUD.m_SayText.SayTextPrint( ConvertCRtoNL( psz ), 128 );\n\t\tbreak;\n\n\tcase HUD_PRINTCONSOLE:\n\t\tsnprintf( psz, MAX_TEXTMSG_STRING, msg_text, szBuf[1], szBuf[2], szBuf[3], szBuf[4] );\n\t\tConsolePrint( ConvertCRtoNL( psz ) );\n\t\tbreak;\n\n\tcase HUD_PRINTRADIO:\n\t\tpsz[0] = 2;\n\t\tLocalize_StripIndices( szBuf[1] );\n\t\tsnprintf( psz + 1, MAX_TEXTMSG_STRING-1, szBuf[1], szBuf[2], szBuf[3], szBuf[4] );\n\n\t\tclientIdx = atoi( szBuf[0] );\n\t\tgHUD.m_SayText.SayTextPrint( ConvertCRtoNL( psz ), 128, clientIdx );\n\t\tbreak;\n\t}\n\n\treturn 1;\n}\n"
  },
  {
    "path": "cl_dll/train.cpp",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\t\n*\tThis product contains software technology licensed from Id \n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc. \n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n//\n// Train.cpp\n//\n// implementation of CHudAmmo class\n//\n\n#include \"hud.h\"\n#include \"cl_util.h\"\n#include <string.h>\n#include <stdio.h>\n#include \"parsemsg.h\"\n#include \"draw_util.h\"\n\nint CHudTrain::Init(void)\n{\n\tHOOK_MESSAGE( gHUD.m_Train, Train );\n\n\tm_iPos = 0;\n\tm_iFlags = 0;\n\tgHUD.AddHudElem(this);\n\n\treturn 1;\n}\n\nint CHudTrain::VidInit(void)\n{\n\tm_hSprite = 0;\n\n\treturn 1;\n}\n\nint CHudTrain::Draw(float fTime)\n{\n\tif ( !m_hSprite )\n\t\tm_hSprite = LoadSprite(\"sprites/%d_train.spr\");\n\n\tif (m_iPos)\n\t{\n\t\tint r, g, b, x, y;\n\n\t\tDrawUtils::UnpackRGB( r, g, b, gHUD.m_iDefaultHUDColor );\n\t\tSPR_Set(m_hSprite, r, g, b );\n\n\t\t// This should show up to the right and part way up the armor number\n\t\ty = ScreenHeight - SPR_Height(m_hSprite,0) - gHUD.m_iFontHeight;\n\t\tx = ScreenWidth/3 + SPR_Width(m_hSprite,0)/4;\n\n\t\tSPR_DrawAdditive( m_iPos - 1,  x, y, NULL);\n\n\t}\n\n\treturn 1;\n}\n\n\nint CHudTrain::MsgFunc_Train(const char *pszName,  int iSize, void *pbuf)\n{\n\tBufferReader reader( pszName, pbuf, iSize );\n\n\t// update Train data\n\tm_iPos = reader.ReadByte();\n\n\tif (m_iPos)\n\t\tm_iFlags |= HUD_DRAW;\n\telse\n\t\tm_iFlags &= ~HUD_DRAW;\n\n\treturn 1;\n}\n"
  },
  {
    "path": "cl_dll/tri.cpp",
    "content": "//========= Copyright ? 1996-2002, Valve LLC, All rights reserved. ============\n//\n// Purpose:\n//\n// $NoKeywords: $\n//=============================================================================\n\n// Triangle rendering, if any\n#include \"hud.h\"\n#include \"cl_util.h\"\n\n// Triangle rendering apis are in gEngfuncs.pTriAPI\n#include \"const.h\"\n#include \"entity_state.h\"\n#include \"cl_entity.h\"\n#include \"triangleapi.h\"\n#include \"rain.h\"\n\nextern int g_iWaterLevel;\n\nFogParameters g_FogParameters;\n\nvoid RenderFog()\n{\n\tFogParameters fog;\n\n\tfog = g_FogParameters;\n\n\tif( cl_fog_density )\n\t\tfog.density = cl_fog_density->value;\n\n\tif( cl_fog_r )\n\t\tfog.color[0] = cl_fog_r->value;\n\n\tif( cl_fog_g )\n\t\tfog.color[1] = cl_fog_g->value;\n\n\tif( cl_fog_b )\n\t\tfog.color[2] = cl_fog_b->value;\n\t\n\tgEngfuncs.pTriAPI->FogParams( fog.density, fog.affectsSkyBox );\n\tgEngfuncs.pTriAPI->Fog( fog.color, 100.0f, 2000.0f, g_iWaterLevel <= 1 ? fog.density > 0.0f : 0 );\n}\n\n/*\n=================\nHUD_DrawNormalTriangles\n\nNon-transparent triangles-- add them here\n=================\n*/\nvoid DLLEXPORT HUD_DrawNormalTriangles( void )\n{\n\tgHUD.m_Spectator.DrawOverview();\n}\n\n/*\n=================\nHUD_DrawTransparentTriangles\n\nRender any triangles with transparent rendermode needs here\n=================\n*/\nextern bool Rain_Initialized;\nvoid DLLEXPORT HUD_DrawTransparentTriangles( void )\n{\n\tRenderFog();\n\n\tif( Rain_Initialized )\n\t{\n\t\tProcessFXObjects();\n\t\tProcessRain();\n\t\tDrawRain();\n\t\tDrawFXObjects();\n\t}\n}\n"
  },
  {
    "path": "cl_dll/tri.h",
    "content": ""
  },
  {
    "path": "cl_dll/unicode_strtools.cpp",
    "content": "/*\n*\n*    This program is free software; you can redistribute it and/or modify it\n*    under the terms of the GNU General Public License as published by the\n*    Free Software Foundation; either version 2 of the License, or (at\n*    your option) any later version.\n*\n*    This program is distributed in the hope that it will be useful, but\n*    WITHOUT ANY WARRANTY; without even the implied warranty of\n*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n*    General Public License for more details.\n*\n*    You should have received a copy of the GNU General Public License\n*    along with this program; if not, write to the Free Software Foundation,\n*    Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\n*\n*    In addition, as a special exception, the author gives permission to\n*    link the code of this program with the Half-Life Game Engine (\"HL\n*    Engine\") and Modified Game Libraries (\"MODs\") developed by Valve,\n*    L.L.C (\"Valve\").  You must obey the GNU General Public License in all\n*    respects for all of the code used other than the HL Engine and MODs\n*    from Valve.  If you modify this file, you may extend this exception\n*    to your version of the file, but you are not obligated to do so.  If\n*    you do not wish to do so, delete this exception statement from your\n*    version.\n*\n*/\n#include <extdll.h>\n#include \"unicode_strtools.h\"\n#ifndef _MSC_VER\n#include <wctype.h>\n#endif\n\n/* <f2fc1> ../engine/unicode_strtools.cpp:23 */\n//-----------------------------------------------------------------------------\n// Purpose: determine if a uchar32 represents a valid Unicode code point\n//-----------------------------------------------------------------------------\nbool Q_IsValidUChar32(uchar32 uVal)\n{\n\t// Values > 0x10FFFF are explicitly invalid; ditto for UTF-16 surrogate halves,\n\t// values ending in FFFE or FFFF, or values in the 0x00FDD0-0x00FDEF reserved range\n\treturn (uVal < 0x110000u) && ((uVal - 0x00D800u) > 0x7FFu) && ((uVal & 0xFFFFu) < 0xFFFEu) && ((uVal - 0x00FDD0u) > 0x1Fu);\n}\n\n/* <f38f8> ../engine/unicode_strtools.cpp:50 */\nint Q_UTF32ToUChar32(const uchar32 *pUTF32, uchar32 &uVal, bool &bErr)\n{\n\tif (Q_IsValidUChar32(pUTF32[0]))\n\t{\n\t\tuVal = pUTF32[0];\n\t\tbErr = false;\n\t\treturn 1;\n\t}\n\telse if (pUTF32[0] - 55296 >= 0x400 || (pUTF32[1] - 56320) >= 0x400)\n\t{\n\t\tuVal = 63;\n\t\tbErr = true;\n\t\treturn 1;\n\t}\n\telse\n\t{\n\t\tuVal = pUTF32[1] + ((uchar32)(pUTF32[0] - 55287) << 10);\n\t\tif (Q_IsValidUChar32(uVal))\n\t\t{\n\t\t\tbErr = false;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tuVal = 63;\n\t\t\tbErr = true;\n\t\t}\n\t\treturn 2;\n\t}\n}\n\n/* <f2fab> ../engine/unicode_strtools.cpp:57 */\nint Q_UChar32ToUTF32Len(uchar32 uVal)\n{\n\treturn (uVal > 0xFFFF) ? 2 : 1;\n}\n\n/* <f330f> ../engine/unicode_strtools.cpp:62 */\nint Q_UChar32ToUTF32(uchar32 uVal, uchar32 *pUTF32)\n{\n\tif (uVal <= 0xFFFF)\n\t{\n\t\tpUTF32[0] = uVal;\n\t\treturn 1;\n\t}\n\telse\n\t{\n\t\tpUTF32[1] = (uVal & 0x3FF) | 0xDC00;\n\t\tpUTF32[0] = ((uVal - 0x10000) >> 10) | 0xD800;\n\t\treturn 2;\n\t}\n}\n\n/* <f4344> ../engine/unicode_strtools.cpp:70 */\ntemplate<\n\ttypename T_IN,\n\ttypename T_OUT,\n\tbool UNK,\n\tqboolean(*IN_TO_UCHAR32)(const T_IN *pUTF8, uchar32 &uValueOut, bool &bErrorOut),\n\tint(UCHAR32_TO_OUT_LEN)(uchar32 uVal),\n\tint(UCHAR32_TO_OUT)(uchar32 uVal, T_OUT *pUTF8Out)\n>\nint Q_UnicodeConvertT(const T_IN *pIn, T_OUT *pOut, int nOutBytes, EStringConvertErrorPolicy ePolicy)\n{\n\tint nOut = 0;\n\tif (pOut)\n\t{\n\t\tint nMaxOut = nOutBytes / sizeof(T_OUT) - 1;\n\t\tif (nMaxOut <= 0)\n\t\t\treturn 0;\n\n\t\twhile (*pIn)\n\t\t{\n\t\t\tbool bErr;\n\t\t\tuchar32 uVal;\n\t\t\tpIn += IN_TO_UCHAR32(pIn, uVal, bErr);\n\t\t\tint nOutElems = UCHAR32_TO_OUT_LEN(uVal);\n\t\t\tif (nOutElems + nOut > nMaxOut)\n\t\t\t\tbreak;\n\t\t\tnOut += UCHAR32_TO_OUT(uVal, &pOut[nOut]);\n\t\t\tif (bErr)\n\t\t\t{\n\t\t\t\tif (ePolicy & STRINGCONVERT_SKIP)\n\t\t\t\t{\n\t\t\t\t\tnOut -= nOutElems;\n\t\t\t\t}\n\t\t\t\telse if (ePolicy & STRINGCONVERT_FAIL)\n\t\t\t\t{\n\t\t\t\t\tpOut[0] = 0;\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\n\t\t\t}\n\t\t}\n\n\t\tpOut[nOut] = 0;\n\t}\n\telse\n\t{\n\t\twhile (*pIn)\n\t\t{\n\t\t\tbool bErr;\n\t\t\tuchar32 uVal;\n\t\t\tpIn += IN_TO_UCHAR32(pIn, uVal, bErr);\n\t\t\tint nOutElems = UCHAR32_TO_OUT_LEN(uVal);\n\t\t\tif (bErr)\n\t\t\t{\n\t\t\t\tif (ePolicy & STRINGCONVERT_SKIP)\n\t\t\t\t{\n\t\t\t\t\tnOut -= nOutElems;\n\t\t\t\t}\n\t\t\t\telse if (ePolicy & STRINGCONVERT_FAIL)\n\t\t\t\t{\n\t\t\t\t\t// pOut[0] = 0; //FIXME: pOut is always null there\n\t\t\t\t\t//TODO: V522 Dereferencing of the null pointer 'pOut' might take place.\n\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\n\t\t\t}\n\t\t}\n\t}\n\treturn (nOut + 1) * sizeof(T_OUT);\n}\n\n/* <f2fe5> ../engine/unicode_strtools.cpp:137 */\nint Q_UChar32ToUTF8Len(uchar32 uVal)\n{\n\tif (uVal <= 0x7F)\n\t\treturn 1;\n\n\tif (uVal > 0x7FF)\n\t\treturn (uVal > 0xFFFF) + 3;\n\telse\n\t\treturn 2;\n}\n\n/* <f3030> ../engine/unicode_strtools.cpp:152 */\nint Q_UChar32ToUTF16Len(uchar32 uVal)\n{\n\treturn (uVal > 0xFFFF) ? 2 : 1;\n}\n\n/* <f3002> ../engine/unicode_strtools.cpp:163 */\nint Q_UChar32ToUTF16(uchar32 uVal, uchar16 *pUTF16Out)\n{\n\tif (uVal <= 0xFFFF)\n\t{\n\t\tpUTF16Out[0] = uVal;\n\t\treturn 1;\n\t}\n\telse\n\t{\n\t\tpUTF16Out[1] = (uVal & 0x3FF) | 0xDC00;\n\t\tpUTF16Out[0] = ((uVal - 0x10000) >> 10) | 0xD800;\n\t\treturn 2;\n\t}\n}\n\n/* <f3192> ../engine/unicode_strtools.cpp:180 */\nint Q_UChar32ToUTF8(uchar32 uVal, char *pUTF8Out)\n{\n\tif (uVal <= 0x7F)\n\t{\n\t\t*pUTF8Out = uVal;\n\t\treturn 1;\n\t}\n\telse if (uVal <= 0x7FF)\n\t{\n\t\t*pUTF8Out = (uVal >> 6) | 0xC0;\n\t\tpUTF8Out[1] = (uVal & 0x3F) | 0x80;\n\t\treturn 2;\n\t}\n\telse if (uVal <= 0xFFFF)\n\t{\n\t\t*pUTF8Out = (uVal >> 12) | 0xE0;\n\t\tpUTF8Out[2] = (uVal & 0x3F) | 0x80;\n\t\tpUTF8Out[1] = ((uVal >> 6) & 0x3F) | 0x80;\n\t\treturn 3;\n\t}\n\telse\n\t{\n\t\t*pUTF8Out = ((uVal >> 18) & 7) | 0xF0;\n\t\tpUTF8Out[1] = ((uVal >> 12) & 0x3F) | 0x80;\n\t\tpUTF8Out[3] = (uVal & 0x3F) | 0x80;\n\t\tpUTF8Out[2] = ((uVal >> 6) & 0x3F) | 0x80;\n\t\treturn 4;\n\t}\n}\n\n/* <f32b4> ../engine/unicode_strtools.cpp:209 */\nint Q_UTF16ToUChar32(const uchar16 *pUTF16, uchar32 &uValueOut, bool &bErrorOut)\n{\n\tif (Q_IsValidUChar32(pUTF16[0]))\n\t{\n\t\tuValueOut = pUTF16[0];\n\t\tbErrorOut = false;\n\t\treturn 1;\n\t}\n\telse if (pUTF16[0] - 55296 >= 0x400 || (pUTF16[1] - 56320) >= 0x400)\n\t{\n\t\tuValueOut = 63;\n\t\tbErrorOut = true;\n\t\treturn 1;\n\t}\n\telse\n\t{\n\t\tuValueOut = pUTF16[1] + ((uchar32)(pUTF16[0] - 55287) << 10);\n\t\tif (Q_IsValidUChar32(uValueOut))\n\t\t{\n\t\t\tbErrorOut = false;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tuValueOut = 63;\n\t\t\tbErrorOut = true;\n\t\t}\n\t\treturn 2;\n\t}\n}\n\n/* <f4468> ../engine/unicode_strtools.cpp:246 */\nint Q_UTF8ToUTF16(const char *pUTF8, uchar16 *pUTF16, int cubDestSizeInBytes, EStringConvertErrorPolicy ePolicy)\n{\n\treturn Q_UnicodeConvertT<char, uchar16, true, Q_UTF8ToUChar32, Q_UChar32ToUTF16Len, Q_UChar32ToUTF16>(pUTF8, pUTF16, cubDestSizeInBytes, ePolicy);\n}\n\n/* <f3822> ../engine/unicode_strtools.cpp:254 */\nint Q_UTF8ToUTF32(const char *pUTF8, uchar32 *pUTF32, int cubDestSizeInBytes, EStringConvertErrorPolicy ePolicy)\n{\n\treturn Q_UnicodeConvertT<char, uchar32, true, Q_UTF8ToUChar32, Q_UChar32ToUTF32Len, Q_UChar32ToUTF32>(pUTF8, pUTF32, cubDestSizeInBytes, ePolicy);\n}\n\n/* <f3d09> ../engine/unicode_strtools.cpp:262 */\nint Q_UTF16ToUTF8(const uchar16 *pUTF16, char *pUTF8, int cubDestSizeInBytes, EStringConvertErrorPolicy ePolicy)\n{\n\treturn Q_UnicodeConvertT<uchar16, char, true, Q_UTF16ToUChar32, Q_UChar32ToUTF8Len, Q_UChar32ToUTF8>(pUTF16, pUTF8, cubDestSizeInBytes, ePolicy);\n}\n\n/* <f3f0d> ../engine/unicode_strtools.cpp:270 */\nint Q_UTF16ToUTF32(const uchar16 *pUTF16, uchar32 *pUTF32, int cubDestSizeInBytes, EStringConvertErrorPolicy ePolicy)\n{\n\treturn Q_UnicodeConvertT<uchar16, uchar32, true, Q_UTF16ToUChar32, Q_UChar32ToUTF32Len, Q_UChar32ToUTF32>(pUTF16, pUTF32, cubDestSizeInBytes, ePolicy);\n}\n\n/* <f38aa> ../engine/unicode_strtools.cpp:278 */\nint Q_UTF32ToUTF8(const uchar32 *pUTF32, char *pUTF8, int cubDestSizeInBytes, EStringConvertErrorPolicy ePolicy)\n{\n\treturn Q_UnicodeConvertT<uchar32, char, true, Q_UTF32ToUChar32, Q_UChar32ToUTF8Len, Q_UChar32ToUTF8>(pUTF32, pUTF8, cubDestSizeInBytes, ePolicy);\n}\n\n/* <f404a> ../engine/unicode_strtools.cpp:286 */\nint Q_UTF32ToUTF16(const uchar32 *pUTF32, uchar16 *pUTF16, int cubDestSizeInBytes, EStringConvertErrorPolicy ePolicy)\n{\n\treturn Q_UnicodeConvertT<uchar32, uchar16, true, Q_UTF32ToUChar32, Q_UChar32ToUTF16Len, Q_UChar32ToUTF16>(pUTF32, pUTF16, cubDestSizeInBytes, ePolicy);\n}\n\n/* <f4251> ../engine/unicode_strtools.cpp:346 */\n// Decode one character from a UTF-8 encoded string. Treats 6-byte CESU-8 sequences\n// as a single character, as if they were a correctly-encoded 4-byte UTF-8 sequence.\nint Q_UTF8ToUChar32(const char *pUTF8_, uchar32 &uValueOut, bool &bErrorOut)\n{\n\tconst byte *pUTF8 = (const byte *)pUTF8_;\n\n\tint nBytes = 1;\n\tuint32 uValue = pUTF8[0];\n\tuint32 uMinValue = 0;\n\n\t// 0....... single byte\n\tif (uValue < 0x80)\n\t\tgoto decodeFinishedNoCheck;\n\n\t// Expecting at least a two-byte sequence with 0xC0 <= first <= 0xF7 (110...... and 11110...)\n\tif ((uValue - 0xC0u) > 0x37u || (pUTF8[1] & 0xC0) != 0x80)\n\t\tgoto decodeError;\n\n\tuValue = (uValue << 6) - (0xC0 << 6) + pUTF8[1] - 0x80;\n\tnBytes = 2;\n\tuMinValue = 0x80;\n\n\t// 110..... two-byte lead byte\n\tif (!(uValue & (0x20 << 6)))\n\t\tgoto decodeFinished;\n\n\t// Expecting at least a three-byte sequence\n\tif ((pUTF8[2] & 0xC0) != 0x80)\n\t\tgoto decodeError;\n\n\tuValue = (uValue << 6) - (0x20 << 12) + pUTF8[2] - 0x80;\n\tnBytes = 3;\n\tuMinValue = 0x800;\n\n\t// 1110.... three-byte lead byte\n\tif (!(uValue & (0x10 << 12)))\n\t\tgoto decodeFinishedMaybeCESU8;\n\n\t// Expecting a four-byte sequence, longest permissible in UTF-8\n\tif ((pUTF8[3] & 0xC0) != 0x80)\n\t\tgoto decodeError;\n\n\tuValue = (uValue << 6) - (0x10 << 18) + pUTF8[3] - 0x80;\n\tnBytes = 4;\n\tuMinValue = 0x10000;\n\n\t// 11110... four-byte lead byte. fall through to finished.\n\ndecodeFinished:\n\tif (uValue >= uMinValue && Q_IsValidUChar32(uValue))\n\t{\ndecodeFinishedNoCheck:\n\t\tuValueOut = uValue;\n\t\tbErrorOut = false;\n\t\treturn nBytes;\n\t}\ndecodeError:\n\tuValueOut = '?';\n\tbErrorOut = true;\n\treturn nBytes;\n\ndecodeFinishedMaybeCESU8:\n\t// Do we have a full UTF-16 surrogate pair that's been UTF-8 encoded afterwards?\n\t// That is, do we have 0xD800-0xDBFF followed by 0xDC00-0xDFFF? If so, decode it all.\n\tif ((uValue - 0xD800u) < 0x400u && pUTF8[3] == 0xED && (byte)(pUTF8[4] - 0xB0) < 0x10 && (pUTF8[5] & 0xC0) == 0x80)\n\t{\n\t\tuValue = 0x10000 + ((uValue - 0xD800u) << 10) + ((byte)(pUTF8[4] - 0xB0) << 6) + pUTF8[5] - 0x80;\n\t\tnBytes = 6;\n\t\tuMinValue = 0x10000;\n\t}\n\tgoto decodeFinished;\n}\n\n/* <f45fd> ../engine/unicode_strtools.cpp:423 */\n//-----------------------------------------------------------------------------\n// Purpose: Returns false if UTF-8 string contains invalid sequences.\n//-----------------------------------------------------------------------------\nqboolean Q_UnicodeValidate(const char *pUTF8)\n{\n\tbool bError = false;\n\twhile (*pUTF8)\n\t{\n\t\tuchar32 uVal;\n\t\t// Our UTF-8 decoder silently fixes up 6-byte CESU-8 (improperly re-encoded UTF-16) sequences.\n\t\t// However, these are technically not valid UTF-8. So if we eat 6 bytes at once, it's an error.\n\t\tint nCharSize = Q_UTF8ToUChar32(pUTF8, uVal, bError);\n\t\tif (bError || nCharSize == 6)\n\t\t\treturn false;\n\t\tpUTF8 += nCharSize;\n\t}\n\treturn true;\n}\n\n/* <f4665> ../engine/unicode_strtools.cpp:442 */\nint Q_UnicodeLength(const char *pUTF8)\n{\n\tint nChars = 0;\n\n\twhile (*pUTF8)\n\t{\n\t\tbool bError;\n\t\tuchar32 uVal;\n\n\t\tpUTF8 += Q_UTF8ToUChar32(pUTF8, uVal, bError);\n\n\t\t++nChars;\n\t}\n\n\treturn nChars;\n}\n\n/* <f46d1> ../engine/unicode_strtools.cpp:459 */\nchar *Q_UnicodeAdvance(char *pUTF8, int nChars)\n{\n\tuchar32 uVal = 0;\n\tbool bError = false;\n\n\twhile (nChars > 0 && *pUTF8)\n\t{\n\t\tpUTF8 += Q_UTF8ToUChar32(pUTF8, uVal, bError);\n\t\t--nChars;\n\t}\n\n\treturn pUTF8;\n}\n\nwchar_t *Q_AdvanceSpace (wchar_t *start)\n{\n   while (*start != 0 && iswspace (*start))\n      start++;\n\n   return start;\n}\n\nwchar_t *Q_ReadUToken (wchar_t *start, wchar_t *token, int tokenBufferSize, bool &quoted)\n{\n   // skip over any whitespace\n   start = Q_AdvanceSpace (start);\n   quoted = false;\n   *token = 0;\n\n   if (!*start)\n   {\n      return start;\n   }\n\n   // check to see if it's a quoted string\n   if (*start == '\\\"')\n   {\n      quoted = true;\n      // copy out the string until we hit an end quote\n      start++;\n      int count = 0;\n      while (*start && *start != '\\\"' && count < tokenBufferSize - 1)\n      {\n         // check for special characters\n         if (*start == '\\\\' && *(start + 1) == 'n')\n         {\n            start++;\n            *token = '\\n';\n         }\n         else if (*start == '\\\\' && *(start + 1) == '\\\"')\n         {\n            start++;\n            *token = '\\\"';\n         }\n         else\n         {\n            *token = *start;\n         }\n\n         start++;\n         token++;\n         count++;\n      }\n\n      if (*start == '\\\"')\n      {\n         start++;\n      }\n   }\n   else\n   {\n      // copy out the string until we hit a whitespace\n      int count = 0;\n      while (*start && !iswspace (*start) && count < tokenBufferSize - 1)\n      {\n         // no checking for special characters if it's not a quoted string\n         *token = *start;\n\n         start++;\n         token++;\n         count++;\n      }\n   }\n\n   *token = 0;\n   return start;\n}\n\n/* <f4737> ../engine/unicode_strtools.cpp:479 */\n//-----------------------------------------------------------------------------\n// Purpose: returns true if a wide character is a \"mean\" space; that is,\n//\t\t\tif it is technically a space or punctuation, but causes disruptive\n//\t\t\tbehavior when used in names, web pages, chat windows, etc.\n//\n//\t\t\tcharacters in this set are removed from the beginning and/or end of strings\n//\t\t\tby Q_AggressiveStripPrecedingAndTrailingWhitespaceW() \n//-----------------------------------------------------------------------------\nbool Q_IsMeanSpaceW(uchar32 wch)\n{\n\tbool bIsMean = false;\n\n\tswitch (wch)\n\t{\n\tcase 0x0082:\t// BREAK PERMITTED HERE\n\tcase 0x0083:\t// NO BREAK PERMITTED HERE\n\tcase 0x00A0:\t// NO-BREAK SPACE\n\tcase 0x034F:\t// COMBINING GRAPHEME JOINER\n\tcase 0x2000:\t// EN QUAD\n\tcase 0x2001:\t// EM QUAD\n\tcase 0x2002:\t// EN SPACE\n\tcase 0x2003:\t// EM SPACE\n\tcase 0x2004:\t// THICK SPACE\n\tcase 0x2005:\t// MID SPACE\n\tcase 0x2006:\t// SIX SPACE\n\tcase 0x2007:\t// figure space\n\tcase 0x2008:\t// PUNCTUATION SPACE\n\tcase 0x2009:\t// THIN SPACE\n\tcase 0x200A:\t// HAIR SPACE\n\tcase 0x200B:\t// ZERO-WIDTH SPACE\n\tcase 0x200C:\t// ZERO-WIDTH NON-JOINER\n\tcase 0x200D:\t// ZERO WIDTH JOINER\n\tcase 0x2028:\t// LINE SEPARATOR\n\tcase 0x2029:\t// PARAGRAPH SEPARATOR\n\tcase 0x202F:\t// NARROW NO-BREAK SPACE\n\tcase 0x2060:\t// word joiner\n\tcase 0xFEFF:\t// ZERO-WIDTH NO BREAK SPACE\n\tcase 0xFFFC:\t// OBJECT REPLACEMENT CHARACTER\n\t\tbIsMean = true;\n\t\tbreak;\n\t}\n\n\treturn bIsMean;\n}\n\n/* <f37f5> ../engine/unicode_strtools.cpp:566 */\nbool Q_IsDeprecatedW(uchar16 wch)\n{\n\tbool bIsDeprecated = false;\n\n\tswitch (wch)\n\t{\n\tcase 0x202A:\n\tcase 0x202B:\n\tcase 0x202C:\n\tcase 0x202D:\n\tcase 0x202E:\n\tcase 0x206A:\n\tcase 0x206B:\n\tcase 0x206C:\n\tcase 0x206D:\n\tcase 0x206E:\n\tcase 0x206F:\n\t\tbIsDeprecated = true;\n\t\tbreak;\n\t}\n\n\treturn bIsDeprecated;\n}\n\n/* <f47bc> ../engine/unicode_strtools.cpp:600 */\n//-----------------------------------------------------------------------------\n// Purpose: strips trailing whitespace; returns pointer inside string just past\n// any leading whitespace.\n//\n// bAggresive = true causes this function to also check for \"mean\" spaces,\n// which we don't want in persona names or chat strings as they're disruptive\n// to the user experience.\n//-----------------------------------------------------------------------------\nstatic uchar16 *StripWhitespaceWorker(uchar16 *pwch, int cchLength, bool *pbStrippedWhitespace)\n{\n\t// walk backwards from the end of the string, killing any whitespace\n\t*pbStrippedWhitespace = false;\n\n\tuchar16 *pwchEnd = pwch + cchLength;\n\twhile (--pwchEnd >= pwch)\n\t{\n\t\tif (!iswspace(*pwchEnd) && !Q_IsMeanSpaceW(*pwchEnd))\n\t\t\tbreak;\n\n\t\t*pwchEnd = 0;\n\t\t*pbStrippedWhitespace = true;\n\t}\n\n\t// walk forward in the string\n\twhile (pwch < pwchEnd)\n\t{\n\t\tif (!iswspace(*pwch))\n\t\t\tbreak;\n\n\t\t*pbStrippedWhitespace = true;\n\t\tpwch++;\n\t}\n\n\treturn pwch;\n}\n\n/* <f3860> ../engine/unicode_strtools.cpp:653 */\nuchar16 *StripUnprintableWorker(uchar16 *pwch, bool *pbStrippedAny)\n{\n\tuchar16 *pwchSource = pwch;\n\tuchar16 *pwchDest = pwch;\n\t*pbStrippedAny = 0;\n\n\twhile (*pwchSource)\n\t{\n\t\tuchar16 cc = *pwchSource;\n\t\tif (*pwchSource >= 0x20u && !Q_IsDeprecatedW(cc) && cc != 0x2026)\n\t\t{\n\t\t\t*pwchDest = cc;\n\t\t\t++pwchDest;\n\t\t}\n\t\t++pwchSource;\n\t}\n\n\t*pwchDest = 0;\n\t*pbStrippedAny = pwchSource != pwchDest;\n\treturn pwch;\n}\n\n/* <f4800> ../engine/unicode_strtools.cpp:691 */\nqboolean Q_StripUnprintableAndSpace(char *pch)\n{\n\tbool bStrippedAny;\n\tbool bStrippedWhitespace;\n\tint cch = strlen(pch);\n\tint cubDest = (cch + 1) * sizeof(uchar16);\n\tuchar16 *pwch_alloced = (uchar16 *)malloc(cubDest);\n\tbStrippedAny = false;\n\tbStrippedWhitespace = false;\n\n\t// TODO: here is using Q_UTF8ToUTF32 by DWARF\n\tint cwch = (unsigned int)Q_UTF8ToUTF16(pch, (uchar16 *)pwch_alloced, cubDest, _STRINGCONVERTFLAG_ASSERT) >> 1;\n\tuchar16 *pwch = StripUnprintableWorker(pwch_alloced, &bStrippedAny);\n\tpwch = StripWhitespaceWorker(pwch, cwch - 1, &bStrippedWhitespace);\n\tif (bStrippedWhitespace || bStrippedAny)\n\t{\n\t\t// TODO: here is using Q_UTF32ToUTF8 by DWARF\n\t\tQ_UTF16ToUTF8(pwch, pch, cch, STRINGCONVERT_ASSERT_REPLACE);\n\t}\n\n\tfree(pwch_alloced);\n\treturn bStrippedAny;\n}\n\n/* <f4a0d> ../engine/unicode_strtools.cpp:717 */\nqboolean V_UTF8ToUChar32(const char *pUTF8_, uchar32 *uValueOut)\n{\n\tbool bError = false;\n\tQ_UTF8ToUChar32(pUTF8_, *uValueOut, bError);\n\treturn bError;\n}\n\n/* <f4a63> ../engine/unicode_strtools.cpp:724 */\nint Q_UnicodeRepair(char *pUTF8)\n{\n\treturn Q_UnicodeConvertT<char, char, true, Q_UTF8ToUChar32, Q_UChar32ToUTF8Len, Q_UChar32ToUTF8>(pUTF8, pUTF8, 65535, STRINGCONVERT_SKIP);\n}\n"
  },
  {
    "path": "cl_dll/util.cpp",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\t\n*\tThis product contains software technology licensed from Id \n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc. \n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n//\n// util.cpp\n//\n// implementation of class-less helper functions\n//\n\n#include \"stdio.h\"\n#include \"stdlib.h\"\n#include \"math.h\"\n\n#include \"hud.h\"\n#include \"cl_util.h\"\n#include <string.h>\n\n#ifndef M_PI\n#define M_PI\t\t3.14159265358979323846\t// matches value in gcc v2 math.h\n#endif\n\n//vec3_t vec3_origin( 0, 0, 0 );\n\n//double sqrt(double x);\n\nfloat rsqrt( float number )\n{\n\tint\ti;\n\tfloat\tx, y;\n\n\tif( number == 0.0f )\n\t\treturn 0.0f;\n\n\tx = number * 0.5f;\n\ti = *(int *)&number;\t// evil floating point bit level hacking\n\ti = 0x5f3759df - (i >> 1);\t// what the fuck?\n\ty = *(float *)&i;\n\ty = y * (1.5f - (x * y * y));\t// first iteration\n\n\treturn y;\n}\n\nint HUD_GetSpriteIndexByName( const char *sz )\n{\n\treturn gHUD.GetSpriteIndex(sz);\n}\n\nHSPRITE HUD_GetSprite( int index )\n{\n\treturn gHUD.GetSprite(index);\n}\n\nwrect_t HUD_GetSpriteRect( int index )\n{\n\treturn gHUD.GetSpriteRect( index );\n}\n\nvec3_t g_ColorBlue\t= { 0.6, 0.8, 1.0 };\nvec3_t g_ColorRed\t= { 1.0, 0.25, 0.25 };\nvec3_t g_ColorGreen\t= { 0.0, 1.0, 0.0 };\nvec3_t g_ColorYellow= { 1.0, 0.7, 0.0 };\nvec3_t g_ColorGrey\t= { 0.8, 0.8, 0.8 };\n\nfloat *GetClientColor( int clientIndex )\n{\n\tswitch ( g_PlayerExtraInfo[clientIndex].teamnumber )\n\t{\n\tcase TEAM_CT:         return g_ColorBlue;\n\tcase TEAM_TERRORIST:  return g_ColorRed;\n\tcase TEAM_UNASSIGNED:\n\tcase TEAM_SPECTATOR:  return g_ColorGrey;\n\tcase 4:\t\t          return g_ColorGreen;\n\tdefault:              return g_ColorGrey;\n\t}\n}\n"
  },
  {
    "path": "cl_dll/util_vector.h",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\t\n*\tThis product contains software technology licensed from Id \n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc. \n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n//  Vector.h\n// A subset of the extdll.h in the project HL Entity DLL\n//\n#pragma once\n#ifndef VECTOR_H\n#define VECTOR_H\n\n// Misc C-runtime library headers\n#include \"stdio.h\"\n#include \"stdlib.h\"\n#include \"math.h\"\n\nfloat rsqrt( float x );\n\n// Header file containing definition of globalvars_t and entvars_t\ntypedef int\tfunc_t;\t\t\t\t\t//\ntypedef int\tstring_t;\t\t\t\t// from engine's pr_comp.h;\ntypedef float vec_t;\t\t\t\t// needed before including progdefs.h\n\n//=========================================================\n// 2DVector - used for many pathfinding and many other \n// operations that are treated as planar rather than 3d.\n//=========================================================\nclass Vector2D\n{\npublic:\n\tinline Vector2D(void)\t\t\t\t\t\t\t\t\t{ }\n\tinline Vector2D(float X, float Y)\t\t\t\t\t\t{ x = X; y = Y; }\n\tinline Vector2D operator+(const Vector2D& v)\tconst\t{ return Vector2D(x+v.x, y+v.y);\t}\n\tinline Vector2D operator-(const Vector2D& v)\tconst\t{ return Vector2D(x-v.x, y-v.y);\t}\n\tinline Vector2D operator*(float fl)\t\t\t\tconst\t{ return Vector2D(x*fl, y*fl);\t}\n\tinline Vector2D operator/(float fl)\t\t\t\tconst\t{ return Vector2D(x/fl, y/fl);\t}\n\t\n\tinline float Length(void)\t\t\t\t\t\tconst\t{ return (float)sqrt(x*x + y*y );\t\t}\n\n\tinline Vector2D Normalize ( void ) const\n\t{\n\t\tfloat flLen = rsqrt( x * x + y * y );\n\t\tif ( flLen == 0 ) return Vector2D( 0.0f, 0.0f );\n\t\telse return Vector2D( x * flLen, y * flLen );\n\t}\n\n\tvec_t\tx, y;\n};\n\ninline float DotProduct(const Vector2D& a, const Vector2D& b) { return( a.x*b.x + a.y*b.y ); }\ninline Vector2D operator*(float fl, const Vector2D& v)\t{ return v * fl; }\n\n//=========================================================\n// 3D Vector\n//=========================================================\nclass Vector\t\t\t\t\t\t// same data-layout as engine's vec3_t,\n{\t\t\t\t\t\t\t\t//\t\twhich is a vec_t[3]\npublic:\n\t// Construction/destruction\n\tinline Vector(void)\t\t\t\t\t\t\t\t{ }\n\tinline Vector(float X, float Y, float Z)\t\t{ x = X; y = Y; z = Z;\t\t\t\t\t\t}\n\tinline Vector(double X, double Y, double Z)\t\t{ x = (float)X; y = (float)Y; z = (float)Z;\t}\n\tinline Vector(int X, int Y, int Z)\t\t\t\t{ x = (float)X; y = (float)Y; z = (float)Z;\t}\n\tinline Vector(const Vector& v)\t\t\t\t\t{ x = v.x; y = v.y; z = v.z;\t\t\t\t} \n\tinline Vector(float rgfl[3])\t\t\t\t\t{ x = rgfl[0]; y = rgfl[1]; z = rgfl[2];\t}\n\n\t// Operators\n\tinline Vector operator-(void) const\t\t\t\t{ return Vector(-x,-y,-z);\t\t\t\t}\n\tinline int operator==(const Vector& v) const\t{ return x==v.x && y==v.y && z==v.z;\t}\n\tinline int operator!=(const Vector& v) const\t{ return !(*this==v);\t\t\t\t\t}\n\tinline Vector operator+(const Vector& v) const\t{ return Vector(x+v.x, y+v.y, z+v.z);\t}\n\tinline Vector operator-(const Vector& v) const\t{ return Vector(x-v.x, y-v.y, z-v.z);\t}\n\tinline Vector operator*(float fl) const\t\t\t{ return Vector(x*fl, y*fl, z*fl);\t\t}\n\tinline Vector operator/(float fl) const\t\t\t{ return Vector(x/fl, y/fl, z/fl);\t\t}\n\t\n\t// Methods\n\tinline void CopyToArray(float* rgfl) const\t\t{ rgfl[0] = x, rgfl[1] = y, rgfl[2] = z; }\n\tinline float Length(void) const\t\t\t\t\t{ return (float)sqrt(x*x + y*y + z*z); }\n\toperator float *()\t\t\t\t\t\t\t\t{ return &x; } // Vectors will now automatically convert to float * when needed\n\toperator const float *() const\t\t\t\t\t{ return &x; } // Vectors will now automatically convert to float * when needed\n\tinline Vector Normalize(void) const\n\t{\n\t\t/*float flLen = Length();\n\t\tif (flLen == 0) return Vector(0,0,1); // ????\n\t\tflLen = 1 / flLen;*/\n\n\t\tfloat flLen = rsqrt( x * x + y * y + z * z );\n\t\tif( flLen == 0.0f ) return Vector( 0, 0, 1 ); // ????\n\t\treturn Vector(x * flLen, y * flLen, z * flLen);\n\t}\n\n\tinline Vector NormalizeLength( float &len ) const\n\t{\n\t\tlen = Length();\n\t\tif( len == 0.0f ) return Vector( 0, 0, 1 );\n\n\t\treturn Vector( x / len, y / len, z / len );\n\t}\n\n\tinline Vector2D Make2D ( void ) const\n\t{\n\t\treturn Vector2D( x, y );\n\t}\n\tinline float Length2D(void) const\t\t\t\t\t{ return (float)sqrt(x*x + y*y); }\n\tinline bool IsNull(void) const { return !x && !y && !z; }\n\n\t// Members\n\tvec_t x, y, z;\n};\ninline Vector operator*(float fl, const Vector& v)\t{ return v * fl; }\ninline float DotProduct(const Vector& a, const Vector& b) { return(a.x*b.x+a.y*b.y+a.z*b.z); }\ninline Vector CrossProduct(const Vector& a, const Vector& b) { return Vector( a.y*b.z - a.z*b.y, a.z*b.x - a.x*b.z, a.x*b.y - a.y*b.x ); }\n\n#define vec3_t Vector\n#endif // VECTOR_H\n"
  },
  {
    "path": "cl_dll/vgui_parser.cpp",
    "content": "/*\n*\n*    This program is free software; you can redistribute it and/or modify it\n*    under the terms of the GNU General Public License as published by the\n*    Free Software Foundation; either version 2 of the License, or (at\n*    your option) any later version.\n*\n*    This program is distributed in the hope that it will be useful, but\n*    WITHOUT ANY WARRANTY; without even the implied warranty of\n*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n*    General Public License for more details.\n*\n*    You should have received a copy of the GNU General Public License\n*    along with this program; if not, write to the Free Software Foundation,\n*    Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\n*\n*    In addition, as a special exception, the author gives permission to\n*    link the code of this program with the Half-Life Game Engine (\"HL\n*    Engine\") and Modified Game Libraries (\"MODs\") developed by Valve,\n*    L.L.C (\"Valve\").  You must obey the GNU General Public License in all\n*    respects for all of the code used other than the HL Engine and MODs\n*    from Valve.  If you modify this file, you may extend this exception\n*    to your version of the file, but you are not obligated to do so.  If\n*    you do not wish to do so, delete this exception statement from your\n*    version.\n*\n*/\n\n#include \"port.h\"\n\n#include <string.h>\n#include \"wrect.h\" // need for cl_dll.h\n#include \"cl_dll.h\"\n#include \"vgui_parser.h\"\n#include \"unicode_strtools.h\"\n\n#include \"errno.h\"\n#include <ctype.h>\n\n#include \"interface.h\"\n\n// evil pasta hacks\n#define uint64 uint64_bruh\n#define int64 int64_bruh\n#include \"miniutl.h\"\n#include \"utlhashmap.h\"\n#undef uint64\n#undef int64\n\nstatic CUtlHashMap<const char *, const char *> hashed_cmds;\n\nchar *StringCopy( const char *input )\n{\n\tif( !input ) return NULL;\n\n\tchar *out = new char[strlen( input ) + 1];\n\tstrcpy( out, input );\n\n\treturn out;\n}\n\nconst char *Localize( const char *szStr )\n{\n\tif( szStr )\n\t{\n\t\tchar *str = strdup( szStr );\n\t\tchar *p = str;\n\n\t\tStripEndNewlineFromString( str );\n\n\t\tif( *p == '#' )\n\t\t\tp++;\n\n\t\tint i = hashed_cmds.Find( p );\n\n\t\tfree( str );\n\n\t\tif( i != hashed_cmds.InvalidIndex() )\n\t\t\treturn hashed_cmds[i];\n\t}\n\n\treturn szStr;\n}\n\nstatic void Dictionary_Insert( const char *key, const char *value )\n{\n\tint i = hashed_cmds.Find( key );\n\n\t// don't allow dupes, delete older strings\n\tif( i != hashed_cmds.InvalidIndex() )\n\t{\n\t\tconst char *old = hashed_cmds[i];\n\n\t\thashed_cmds[i] = StringCopy( value );\n\n\t\tdelete[] old;\n\t}\n\telse\n\t{\n\t\tconst char *first = StringCopy( key );\n\t\tconst char *second = StringCopy( value );\n\n\t\thashed_cmds.Insert( first, second );\n\t}\n}\n\nstatic void Localize_AddToDictionary( const char *name, const char *lang )\n{\n\tchar filename[64], token[4096];\n\tchar *pfile, *afile = nullptr, *pFileBuf;\n\tint i = 0, len;\n\tbool isUtf16 = false;\n\n\tsnprintf( filename, sizeof( filename ), \"resource/%s_%s.txt\", name, lang );\n\n\tpFileBuf = reinterpret_cast<char*>( gEngfuncs.COM_LoadFile( filename, 5, &len ));\n\n\tif( !pFileBuf )\n\t{\n\t\tgEngfuncs.Con_Printf( \"Localize_AddToDict( %s ): couldn't open file. Some strings will not be localized!.\\n\", filename );\n\t\treturn;\n\t}\n\n\t// support only utf-16le\n\tif( pFileBuf[0] == '\\xFF' && pFileBuf[1] == '\\xFE' )\n\t{\n\t\tif( len > 3 && !pFileBuf[2] && !pFileBuf[3] )\n\t\t{\n\t\t\tgEngfuncs.Con_Printf( \"Localize_AddToDict( %s ): couldn't parse file. UTF-32 little endian isn't supported\\n\", filename );\n\t\t\tgoto error;\n\t\t}\n\t\tisUtf16 = true;\n\t}\n\telse if( pFileBuf[0] == '\\xFE' && pFileBuf[1] == '\\xFF' )\n\t{\n\t\tgEngfuncs.Con_Printf( \"Localize_AddToDict( %s ): couldn't parse file. UTF-16/UTF-32 big endian isn't supported\\n\", filename );\n\t\tgoto error;\n\t}\n\n\tif( isUtf16 )\n\t{\n\t\tint ansiLength = len + 1;\n\t\tuchar16 *autf16 = new uchar16[len/2 + 1];\n\n\t\tmemcpy( autf16, pFileBuf + 2, len - 1 );\n\t\tautf16[len/2-1] = 0; //null terminator\n\n\t\tafile = new char[ansiLength]; // save original pointer, so we can free it later\n\n\t\tQ_UTF16ToUTF8( autf16, afile, ansiLength, STRINGCONVERT_ASSERT_REPLACE );\n\n\t\tdelete[] autf16;\n\t}\n\telse\n\t{\n\t\tafile = pFileBuf;\n\n\t\t// strip UTF-8 BOM\n\t\tif( afile[0] == '\\xEF' && afile[1] == '\\xBB' && afile[2] == '\\xBF')\n\t\t\tafile += 3;\n\t}\n\n\tpfile = afile;\n\n\tpfile = gEngfuncs.COM_ParseFile( pfile, token );\n\n\tif( stricmp( token, \"lang\" ))\n\t{\n\t\tgEngfuncs.Con_Printf( \"Localize_AddToDict( %s ): invalid header, got %s\", filename, token );\n\t\tgoto error;\n\t}\n\n\tpfile = gEngfuncs.COM_ParseFile( pfile, token );\n\n\tif( strcmp( token, \"{\" ))\n\t{\n\t\tgEngfuncs.Con_Printf( \"Localize_AddToDict( %s ): want {, got %s\", filename, token );\n\t\tgoto error;\n\t}\n\n\tpfile = gEngfuncs.COM_ParseFile( pfile, token );\n\n\tif( stricmp( token, \"Language\" ))\n\t{\n\t\tgEngfuncs.Con_Printf( \"Localize_AddToDict( %s ): want Language, got %s\", filename, token );\n\t\tgoto error;\n\t}\n\n\t// skip language actual name\n\tpfile = gEngfuncs.COM_ParseFile( pfile, token );\n\n\tpfile = gEngfuncs.COM_ParseFile( pfile, token );\n\n\tif( stricmp( token, \"Tokens\" ))\n\t{\n\t\tgEngfuncs.Con_Printf( \"Localize_AddToDict( %s ): want Tokens, got %s\", filename, token );\n\t\tgoto error;\n\t}\n\n\tpfile = gEngfuncs.COM_ParseFile( pfile, token );\n\n\tif( strcmp( token, \"{\" ))\n\t{\n\t\tgEngfuncs.Con_Printf( \"Localize_AddToDict( %s ): want { after Tokens, got %s\", filename, token );\n\t\tgoto error;\n\t}\n\n\twhile( (pfile = gEngfuncs.COM_ParseFile( pfile, token )))\n\t{\n\t\tif( !strcmp( token, \"}\" ))\n\t\t\tbreak;\n\n\t\tchar szLocString[4096];\n\t\tpfile = gEngfuncs.COM_ParseFile( pfile, szLocString );\n\n\t\tif( !strcmp( szLocString, \"}\" ))\n\t\t\tbreak;\n\n\t\tif( pfile )\n\t\t{\n\t\t\t// Con_DPrintf(\"New token: %s %s\\n\", token, szLocString );\n\t\t\tDictionary_Insert( token, szLocString );\n\t\t\ti++;\n\t\t}\n\t}\n\nerror:\n\tif( isUtf16 && afile )\n\t\tdelete[] afile;\n\n\tgEngfuncs.COM_FreeFile( pFileBuf );\n}\n\nstatic void Localize_InitLanguage( const char *language )\n{\n\tconst char *gamedir = gEngfuncs.pfnGetGameDirectory();\n\n\t// if gamedir isn't valve, then load standard HL1 strings\n\tif( strcmp( gamedir, \"valve\" ))\n\t\tLocalize_AddToDictionary( \"valve\",  language );\n\n\t// if gamedir is czero, also load cstrike strings\n\tif ( strcmp( gamedir, \"czero\" ) == 0 )\n\t\tLocalize_AddToDictionary( \"cstrike\", language );\n\t\n\t// mod strings override default ones\n\tLocalize_AddToDictionary( gamedir,  language );\n}\n\nvoid Localize_Init( void )\n{\n\tgEngfuncs.pfnClientCmd( \"exec mainui.cfg\\n\" );\n\n\thashed_cmds.Purge();\n\n\t// always load default language translation\n\tLocalize_InitLanguage( \"english\" );\n\n\tconst char *language = gEngfuncs.pfnGetCvarString( \"ui_language\" );\n\n\tif( language[0] && strcmp( language, \"english\" ))\n\t\tLocalize_InitLanguage( language );\n}\n\nvoid Localize_Free( void )\n{\n\tFOR_EACH_HASHMAP( hashed_cmds, i )\n\t{\n\t\tconst char *first = hashed_cmds.Key( i );\n\t\tconst char *second = hashed_cmds.Element( i );\n\n\t\tdelete[] (char*)first;\n\t\tdelete[] (char*)second;\n\t}\n\n\thashed_cmds.Purge();\n}\n\nvoid Localize_StripIndices( char *s )\n{\n\tif ( strlen( s ) >= 3 )\n\t{\n\t\tfor ( size_t i = 0; i < strlen( s ) - 2; i++ )\n\t\t{\n\t\t\tif ( s[i] == '%' && s[i + 1] == 's' && isdigit( s[i + 2] ) )\n\t\t\t{\n\t\t\t\tchar *first = &s[i + 2];\n\t\t\t\tchar *second = &s[i + 3];\n\n\t\t\t\tsize_t len = strlen( second );\n\n\t\t\t\tmemmove( first, second, strlen( second ) );\n\t\t\t\tfirst[len] = '\\0'; // one character has been removed and string moved, set null terminator\n\t\t\t}\n\t\t}\n\t}\n}"
  },
  {
    "path": "cl_dll/view.cpp",
    "content": "//========= Copyright ? 1996-2002, Valve LLC, All rights reserved. ============\n//\n// Purpose:\n//\n// $NoKeywords: $\n//=============================================================================\n\n// view/refresh setup functions\n\n#include <string.h>\n\n#include \"hud.h\"\n#include \"pm_math.h\"\n#include \"cl_util.h\"\n#include \"cvardef.h\"\n#include \"usercmd.h\"\n#include \"const.h\"\n\n#include \"entity_state.h\"\n#include \"cl_entity.h\"\n#include \"ref_params.h\"\n#include \"in_defs.h\" // PITCH YAW ROLL\n#include \"pm_movevars.h\"\n#include \"pm_shared.h\"\n#include \"pm_defs.h\"\n#include \"pm_debug.h\"\n#include \"event_api.h\"\n#include \"pmtrace.h\"\n#include \"screenfade.h\"\n#include \"shake.h\"\n#include \"hltv.h\"\n#include \"r_studioint.h\"\n#include \"com_model.h\"\n#include \"kbutton.h\"\n#include \"input.h\"\n#include \"com_weapons.h\"\n\n#ifndef M_PI\n#define M_PI\t\t3.14159265358979323846\t// matches value in gcc v2 math.h\n#endif\n\nextern float\tvJumpOrigin[3];\nextern float\tvJumpAngles[3];\n\n\nextern engine_studio_api_t IEngineStudio;\n\n/*\nThe view is allowed to move slightly from it's true position for bobbing,\nbut if it exceeds 8 pixels linear distance (spherical, not box), the list of\nentities sent from the server may not include everything in the pvs, especially\nwhen crossing a water boudnary.\n*/\n\nextern cvar_t\t*cl_forwardspeed;\nextern cvar_t\t*chase_active;\nextern cvar_t\t*scr_ofsx, *scr_ofsy, *scr_ofsz;\nextern cvar_t\t*cl_vsmoothing;\n\n#define\tCAM_MODE_RELAX\t\t1\n#define CAM_MODE_FOCUS\t\t2\n\nvec3_t v_origin, v_angles, v_cl_angles, v_sim_org, v_lastAngles, ev_punchangle;\nVector dead_viewangles( 0, 0, 0 ); // fake viewangles, for fixing\nfloat  v_frametime, v_lastDistance;\nfloat  v_cameraRelaxAngle\t= 5.0f;\nfloat  v_cameraFocusAngle\t= 35.0f;\nint\t   v_cameraMode = CAM_MODE_FOCUS;\nbool   v_resetCamera = 1;\n\ncvar_t\t*scr_ofsx;\ncvar_t\t*scr_ofsy;\ncvar_t\t*scr_ofsz;\n\ncvar_t\t*v_centermove;\ncvar_t\t*v_centerspeed;\n\ncvar_t\t*cl_bobcycle;\ncvar_t\t*cl_bob;\ncvar_t\t*cl_bobup;\ncvar_t\t*cl_waterdist;\ncvar_t\t*cl_chasedist;\ncvar_t\t*cl_weaponlag;\ncvar_t\t*cl_quakeguns;\n\n// These cvars are not registered (so users can't cheat), so set the ->value field directly\n// Register these cvars in V_Init() if needed for easy tweaking\ncvar_t\tv_iyaw_cycle\t\t= {\"v_iyaw_cycle\", \"2\", 0, 2, NULL};\ncvar_t\tv_iroll_cycle\t\t= {\"v_iroll_cycle\", \"0.5\", 0, 0.5, NULL};\ncvar_t\tv_ipitch_cycle\t\t= {\"v_ipitch_cycle\", \"1\", 0, 1, NULL};\ncvar_t\tv_iyaw_level\t\t= {\"v_iyaw_level\", \"0.3\", 0, 0.3, NULL};\ncvar_t\tv_iroll_level\t\t= {\"v_iroll_level\", \"0.1\", 0, 0.1, NULL};\ncvar_t\tv_ipitch_level\t\t= {\"v_ipitch_level\", \"0.3\", 0, 0.3, NULL};\n\nfloat\tv_idlescale;  // used by TFC for concussion grenade effect\n\n//=============================================================================\n/*\nvoid V_NormalizeAngles( float *angles )\n{\n\tint i;\n\t// Normalize angles\n\tfor ( i = 0; i < 3; i++ )\n\t{\n\t\tif ( angles[i] > 180.0 )\n\t\t{\n\t\t\tangles[i] -= 360.0;\n\t\t}\n\t\telse if ( angles[i] < -180.0 )\n\t\t{\n\t\t\tangles[i] += 360.0;\n\t\t}\n\t}\n}\n*/\n/*\n===================\nV_InterpolateAngles\n\nInterpolate Euler angles.\nFIXME:  Use Quaternions to avoid discontinuities\nFrac is 0.0 to 1.0 ( i.e., should probably be clamped, but doesn't have to be )\n===================\n*/\n/*\nvoid V_InterpolateAngles( float *start, float *end, float *output, float frac )\n{\n\tint i;\n\tfloat ang1, ang2;\n\tfloat d;\n\n\tV_NormalizeAngles( start );\n\tV_NormalizeAngles( end );\n\n\tfor ( i = 0 ; i < 3 ; i++ )\n\t{\n\t\tang1 = start[i];\n\t\tang2 = end[i];\n\n\t\td = ang2 - ang1;\n\t\tif ( d > 180 )\n\t\t{\n\t\t\td -= 360;\n\t\t}\n\t\telse if ( d < -180 )\n\t\t{\n\t\t\td += 360;\n\t\t}\n\n\t\toutput[i] = ang1 + d * frac;\n\t}\n\n\tV_NormalizeAngles( output );\n} */\n\n// Quakeworld bob code, this fixes jitters in the mutliplayer since the clock (pparams->time) isn't quite linear\nfloat V_CalcBob ( struct ref_params_s *pparams )\n{\n\tstatic\tdouble\tbobtime;\n\tstatic float\tbob;\n\tfloat\tcycle;\n\tstatic float\tlasttime;\n\tvec3_t\tvel;\n\n\n\tif ( pparams->onground == -1 ||\n\t\t pparams->time == lasttime )\n\t{\n\t\t// just use old value\n\t\treturn bob;\n\t}\n\n\tlasttime = pparams->time;\n\n\tbobtime += pparams->frametime;\n\tcycle = bobtime - (int)( bobtime / cl_bobcycle->value ) * cl_bobcycle->value;\n\tcycle /= cl_bobcycle->value;\n\n\tif ( cycle < cl_bobup->value )\n\t{\n\t\tcycle = M_PI * cycle / cl_bobup->value;\n\t}\n\telse\n\t{\n\t\tcycle = M_PI + M_PI * ( cycle - cl_bobup->value )/( 1.0 - cl_bobup->value );\n\t}\n\n\t// bob is proportional to simulated velocity in the xy plane\n\t// (don't count Z, or jumping messes it up)\n\tVectorCopy( pparams->simvel, vel );\n\tvel[2] = 0;\n\n\tbob = sqrt( vel[0] * vel[0] + vel[1] * vel[1] ) * cl_bob->value;\n\tbob = bob * 0.3 + bob * 0.7 * sin(cycle);\n\tbob = min( bob, 4.0f );\n\tbob = max( bob, -7.0f );\n\treturn bob;\n\n}\n\n/*\n===============\nV_CalcRoll\nUsed by view and sv_user\n===============\n*/\nfloat V_CalcRoll (vec3_t angles, vec3_t velocity, float rollangle, float rollspeed )\n{\n\tfloat   sign;\n\tfloat   side;\n\tfloat   value;\n\tvec3_t  forward, right, up;\n\n\tAngleVectors ( angles, forward, right, up );\n\n\tside = DotProduct (velocity, right);\n\tsign = side < 0 ? -1 : 1;\n\tside = fabs( side );\n\n\tvalue = rollangle;\n\tif (side < rollspeed)\n\t{\n\t\tside = side * value / rollspeed;\n\t}\n\telse\n\t{\n\t\tside = value;\n\t}\n\treturn side * sign;\n}\n#if 0\ntypedef struct pitchdrift_s\n{\n\tfloat\t\tpitchvel;\n\tint\t\t\tnodrift;\n\tfloat\t\tdriftmove;\n\tdouble\t\tlaststop;\n} pitchdrift_t;\n\nstatic pitchdrift_t pd;\n\nvoid V_StartPitchDrift( void )\n{\n\tif ( pd.laststop == gEngfuncs.GetClientTime() )\n\t{\n\t\treturn;\t\t// something else is keeping it from drifting\n\t}\n\n\tif ( pd.nodrift || !pd.pitchvel )\n\t{\n\t\tpd.pitchvel = v_centerspeed->value;\n\t\tpd.nodrift = 0;\n\t\tpd.driftmove = 0;\n\t}\n}\n\nvoid V_StopPitchDrift ( void )\n{\n\tpd.laststop = gEngfuncs.GetClientTime();\n\tpd.nodrift = 1;\n\tpd.pitchvel = 0;\n}\n\n/*\n===============\nV_DriftPitch\n\nMoves the client pitch angle towards idealpitch sent by the server.\n\nIf the user is adjusting pitch manually, either with lookup/lookdown,\nmlook and mouse, or klook and keyboard, pitch drifting is constantly stopped.\n===============\n*/\nvoid V_DriftPitch ( struct ref_params_s *pparams )\n{\n\tfloat\t\tdelta, move;\n\n\tif ( gEngfuncs.IsNoClipping() || !pparams->onground || pparams->demoplayback || pparams->spectator )\n\t{\n\t\tpd.driftmove = 0;\n\t\tpd.pitchvel = 0;\n\t\treturn;\n\t}\n\n\t// don't count small mouse motion\n\tif (pd.nodrift)\n\t{\n\t\tif ( fabs( pparams->cmd->forwardmove ) < cl_forwardspeed->value )\n\t\t\tpd.driftmove = 0;\n\t\telse\n\t\t\tpd.driftmove += pparams->frametime;\n\n\t\tif ( pd.driftmove > v_centermove->value)\n\t\t{\n\t\t\tV_StartPitchDrift ();\n\t\t}\n\t\treturn;\n\t}\n\n\tdelta = pparams->idealpitch - pparams->cl_viewangles[PITCH];\n\n\tif (!delta)\n\t{\n\t\tpd.pitchvel = 0;\n\t\treturn;\n\t}\n\n\tmove = pparams->frametime * pd.pitchvel;\n\tpd.pitchvel += pparams->frametime * v_centerspeed->value;\n\n\tif (delta > 0)\n\t{\n\t\tif (move > delta)\n\t\t{\n\t\t\tpd.pitchvel = 0;\n\t\t\tmove = delta;\n\t\t}\n\t\tpparams->cl_viewangles[PITCH] += move;\n\t}\n\telse if (delta < 0)\n\t{\n\t\tif (move > -delta)\n\t\t{\n\t\t\tpd.pitchvel = 0;\n\t\t\tmove = -delta;\n\t\t}\n\t\tpparams->cl_viewangles[PITCH] -= move;\n\t}\n}\n#endif\n/*\n==============================================================================\n\t\t\t\t\t\tVIEW RENDERING\n==============================================================================\n*/\n\n/*\n=============\nV_DropPunchAngle\n\n=============\n*/\nvoid V_DropPunchAngle ( float frametime, float *ev_punchangle )\n{\n\tfloat\tlen;\n\n\tlen = VectorNormalize ( ev_punchangle );\n\tlen -= (10.0 + len * 0.5) * frametime;\n\tlen = max( len, 0.0 );\n\tVectorScale ( ev_punchangle, len, ev_punchangle );\n}\n\n\n/*\n==================\nV_CalcGunAngle\n==================\n*/\nvoid V_CalcGunAngle ( struct ref_params_s *pparams )\n{\n\tcl_entity_t *viewent;\n\n\tviewent = gEngfuncs.GetViewModel();\n\tif ( !viewent )\n\t\treturn;\n\n\tviewent->angles[YAW]   =  pparams->viewangles[YAW]   + pparams->crosshairangle[YAW];\n\tviewent->angles[PITCH] = -pparams->viewangles[PITCH] + pparams->crosshairangle[PITCH] * 0.25;\n\tviewent->angles[ROLL]  -= v_idlescale * sin(pparams->time*v_iroll_cycle.value) * v_iroll_level.value;\n\n\t// don't apply all of the v_ipitch to prevent normally unseen parts of viewmodel from coming into view.\n\tviewent->angles[PITCH] -= v_idlescale * sin(pparams->time*v_ipitch_cycle.value) * (v_ipitch_level.value * 0.5);\n\tviewent->angles[YAW]   -= v_idlescale * sin(pparams->time*v_iyaw_cycle.value) * v_iyaw_level.value;\n\n\tif ( !( gHUD.cl_viewbob && gHUD.cl_viewbob->value ) )\n\t{\n\t\tVectorCopy( viewent->angles, viewent->curstate.angles );\n\t\tVectorCopy( viewent->angles, viewent->latched.prevangles );\n\t}\n}\n\n/*\n==============\nV_AddIdle\n\nIdle swaying\n==============\n*/\nvoid V_AddIdle ( struct ref_params_s *pparams )\n{\n\tpparams->viewangles[ROLL]  += v_idlescale * sin(pparams->time * v_iroll_cycle.value) * v_iroll_level.value;\n\tpparams->viewangles[PITCH] += v_idlescale * sin(pparams->time * v_ipitch_cycle.value) * v_ipitch_level.value;\n\tpparams->viewangles[YAW]   += v_idlescale * sin(pparams->time * v_iyaw_cycle.value) * v_iyaw_level.value;\n}\n\n\n/*\n==============\nV_CalcViewRoll\n\nRoll is induced by movement and damage\n==============\n*/\nvoid V_CalcViewRoll ( struct ref_params_s *pparams )\n{\n\tfloat\t\tside;\n\tcl_entity_t *viewentity;\n\n\tviewentity = gEngfuncs.GetEntityByIndex( pparams->viewentity );\n\tif ( !viewentity )\n\t\treturn;\n\n\tside = V_CalcRoll ( viewentity->angles, pparams->simvel, pparams->movevars->rollangle, pparams->movevars->rollspeed );\n\n\tpparams->viewangles[ROLL] += side;\n\n\tif ( pparams->health <= 0 && ( pparams->viewheight[2] != 0 ) )\n\t{\n\t\t// only roll the view if the player is dead and the viewheight[2] is nonzero\n\t\t// this is so deadcam in multiplayer will work.\n\t\tpparams->viewangles[ROLL] = 80;\t// dead view angle\n\t\treturn;\n\t}\n}\n\nvoid V_SmoothInterpolateAngles( float * startAngle, float * endAngle, float * finalAngle, float degreesPerSec )\n{\n\tfloat absd,frac,d,threshold;\n\n\tNormalizeAngles( startAngle );\n\tNormalizeAngles( endAngle );\n\n\tfor ( int i = 0 ; i < 3 ; i++ )\n\t{\n\t\td = endAngle[i] - startAngle[i];\n\n\t\tif ( d > 180.0f )\n\t\t{\n\t\t\td -= 360.0f;\n\t\t}\n\t\telse if ( d < -180.0f )\n\t\t{\n\t\t\td += 360.0f;\n\t\t}\n\n\t\tabsd = fabs(d);\n\n\t\tif ( absd > 0.01f )\n\t\t{\n\t\t\tfrac = degreesPerSec * v_frametime;\n\n\t\t\tthreshold= degreesPerSec / 4;\n\n\t\t\tif ( absd < threshold )\n\t\t\t{\n\t\t\t\tfloat h = absd / threshold;\n\t\t\t\th *= h;\n\t\t\t\tfrac*= h;  // slow down last degrees\n\t\t\t}\n\n\t\t\tif ( frac >  absd )\n\t\t\t{\n\t\t\t\tfinalAngle[i] = endAngle[i];\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif ( d>0)\n\t\t\t\t\tfinalAngle[i] = startAngle[i] + frac;\n\t\t\t\telse\n\t\t\t\t\tfinalAngle[i] = startAngle[i] - frac;\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tfinalAngle[i] = endAngle[i];\n\t\t}\n\n\t}\n\n\tNormalizeAngles( finalAngle );\n}\n\n\n/*\n==================\nV_CalcIntermissionRefdef\n\n==================\n*/\nvoid V_CalcIntermissionRefdef ( struct ref_params_s *pparams )\n{\n\tcl_entity_t\t*view;\n\tfloat\t\told;\n\n\t// view is the weapon model (only visible from inside body)\n\tview = gEngfuncs.GetViewModel();\n\n\tVectorCopy ( pparams->simorg, pparams->vieworg );\n\tVectorCopy ( pparams->cl_viewangles, pparams->viewangles );\n\n\tview->model = NULL;\n\n\t// allways idle in intermission\n\told = v_idlescale;\n\tv_idlescale = 1;\n\n\tV_AddIdle ( pparams );\n\n\tif ( gEngfuncs.IsSpectateOnly() )\n\t{\n\t\t// in HLTV we must go to 'intermission' position by ourself\n\t\tVectorCopy( gHUD.m_Spectator.m_cameraOrigin, pparams->vieworg );\n\t\tVectorCopy( gHUD.m_Spectator.m_cameraAngles, pparams->viewangles );\n\t}\n\n\tv_idlescale = old;\n\n\tv_cl_angles = pparams->cl_viewangles;\n\tv_origin = pparams->vieworg;\n\tv_angles = pparams->viewangles;\n}\n\n#define ORIGIN_BACKUP 64\n#define ORIGIN_MASK ( ORIGIN_BACKUP - 1 )\n\nstruct viewinterp_t\n{\n\tVector Origins[ ORIGIN_BACKUP ];\n\tfloat OriginTime[ ORIGIN_BACKUP ];\n\n\tVector Angles[ ORIGIN_BACKUP ];\n\tfloat AngleTime[ ORIGIN_BACKUP ];\n\n\tint CurrentOrigin;\n\tint CurrentAngle;\n};\n\nfloat GetGunOffset( cl_entity_t *e )\n{\n\tint id = HUD_GetWeapon();\n\n\tswitch( id )\n\t{\n\tcase WEAPON_GLOCK18:\n\t\treturn -4.55f;\n\tcase WEAPON_USP:\n\t\treturn -4.64f;\n\tcase WEAPON_P228:\n\t\treturn -4.65f;\n\tcase WEAPON_DEAGLE:\n\t\treturn -4.71f;\n\tcase WEAPON_FIVESEVEN:\n\t\treturn -4.84f;\n\tcase WEAPON_M3:\n\t\treturn -5.03f;\n\tcase WEAPON_XM1014:\n\t\treturn -5.82f;\n\tcase WEAPON_MAC10:\n\t\treturn -5.05f;\n\tcase WEAPON_TMP:\n\t\treturn -6.47f;\n\tcase WEAPON_MP5N:\n\t\treturn -5.53f;\n\tcase WEAPON_UMP45:\n\t\treturn -5.53f;\n\tcase WEAPON_P90:\n\t\treturn -4.32f;\n\tcase WEAPON_SCOUT:\n\t\treturn -5.14f;\n\tcase WEAPON_AWP:\n\t\treturn -6.02f;\n\tcase WEAPON_FAMAS:\n\t\treturn -4.84f;\n\tcase WEAPON_AUG:\n\t\treturn -6.02f;\n\tcase WEAPON_M4A1:\n\t\treturn -7.0f; //-6.47f;\n\tcase WEAPON_SG550:\n\t\treturn -7.11f;\n\tcase WEAPON_AK47:\n\t\treturn -6.79f;\n\tcase WEAPON_G3SG1:\n\t\treturn -6.19f;\n\tcase WEAPON_SG552:\n\t\treturn -5.27f;\n\tcase WEAPON_GALIL:\n\t\treturn -4.78f;\n\tcase WEAPON_M249:\n\t\treturn -5.13f;\n\t}\n\treturn 0;\n}\n\nvoid V_CalcQuakeGuns()\n{\n#if 1\n\tcl_entity_s * vm = gEngfuncs.GetViewModel();\n\n\tif(!cl_quakeguns->value)\n\t\treturn;\n\t\n\tif(!vm)\n\t\treturn;\n\n\tfloat gunoffsetr = GetGunOffset(vm);\n\tif(gunoffsetr == 0)\n\t\treturn;\n\n\tfloat* org = vm->origin;\n\n\tvec3_t forward, right, up;\n\n\tgEngfuncs.pfnAngleVectors(v_angles, forward, right, up);\n\n\torg[0] += forward[0] + up[0] + right[0]*gunoffsetr;\n\torg[1] += forward[1] + up[1] + right[1]*gunoffsetr;\n\torg[2] += forward[2] + up[2] + right[2]*gunoffsetr;\n#endif\n}\n\n\n//==========================\n// V_CalcViewModelLag\n//==========================\nvoid V_CalcViewModelLag( ref_params_t *pparams, Vector &origin, Vector &angles )\n{\n\tstatic Vector m_vecLastFacing;\n\n\tif( cl_weaponlag->value <= 0.0f )\n\t\treturn;\n\n\t// Calculate our drift\n\tVector forward, right, up;\n\n\tAngleVectors( angles, forward, right, up );\n\n\tif( pparams->frametime != 0.0f )\t// not in paused\n\t{\n\t\tVector vDifference = forward - m_vecLastFacing;\n\n\t\tfloat flSpeed = 5.0f;\n\n\t\t// If we start to lag too far behind, we'll increase the \"catch up\" speed.\n\t\t// Solves the problem with fast cl_yawspeed, m_yaw or joysticks rotating quickly.\n\t\t// The old code would slam lastfacing with origin causing the viewmodel to pop to a new position\n\t\tfloat flDiff = vDifference.Length();\n\t\tif( flDiff > cl_weaponlag->value )\n\t\t\tflSpeed *= flDiff / cl_weaponlag->value;\n\n\t\t// FIXME:  Needs to be predictable?\n\t\tm_vecLastFacing = m_vecLastFacing + vDifference * ( flSpeed * pparams->frametime );\n\t\t// Make sure it doesn't grow out of control!!!\n\t\tm_vecLastFacing = m_vecLastFacing.Normalize();\n\t\torigin = origin + flSpeed * -vDifference;\n\t}\n\n\t// this just breaks centered weapons on pitch changing\n\tif( !cl_quakeguns->value )\n\t{\n\t\tAngleVectors( v_angles, forward, right, up );\n\n\t\tfloat pitch = v_angles[PITCH];\n\n\t\tif( pitch > 180.0f )\n\t\t\tpitch -= 360.0f;\n\t\telse if( pitch < -180.0f )\n\t\t\tpitch += 360.0f;\n\n\t\tpitch = -pitch;\n\n\t\t// FIXME: These are the old settings that caused too many exposed polys on some models\n\t\torigin = origin + forward * ( pitch * 0.035f )\n\t\t\t\t\t\t+ right   * ( pitch * 0.03f  )\n\t\t\t\t\t\t+ up      * ( pitch * 0.02f  );\n\n\t}\n}\n\n/*\n==================\nV_CalcRefdef\n\n==================\n*/\nvoid V_CalcNormalRefdef ( struct ref_params_s *pparams )\n{\n\tcl_entity_t\t\t*ent, *view;\n\tint\t\t\t\ti;\n\tvec3_t\t\t\tangles;\n\tfloat\t\t\tbob, waterOffset;\n\tstatic viewinterp_t\t\tViewInterp;\n\n\tstatic float oldz = 0;\n\tstatic float lasttime;\n\n\tvec3_t camAngles, camForward, camRight, camUp;\n\tcl_entity_t *pwater;\n\n\tif ( gEngfuncs.IsSpectateOnly() )\n\t{\n\t\tent = gEngfuncs.GetEntityByIndex( g_iUser2 );\n\t}\n\telse\n\t{\n\t\t// ent is the player model ( visible when out of body )\n\t\tent = gEngfuncs.GetLocalPlayer();\n\t}\n\n\t// view is the weapon model (only visible from inside body)\n\tview = gEngfuncs.GetViewModel();\n\n\t// transform the view offset by the model's matrix to get the offset from\n\t// model origin for the view\n\tbob = V_CalcBob ( pparams );\n\n\t// refresh position\n\tVectorCopy ( pparams->simorg, pparams->vieworg );\n\tpparams->vieworg[2] += ( bob );\n\tVectorAdd( pparams->vieworg, pparams->viewheight, pparams->vieworg );\n\n\tif( pparams->health <= 0 )\n\t{\n\t\tVectorCopy( dead_viewangles, pparams->viewangles );\n\t}\n\telse\n\t{\n\t\tVectorCopy ( pparams->cl_viewangles, pparams->viewangles );\n\t}\n\n\tgEngfuncs.V_CalcShake();\n\tgEngfuncs.V_ApplyShake( pparams->vieworg, pparams->viewangles, 1.0 );\n\n\t// never let view origin sit exactly on a node line, because a water plane can\n\t// disappear when viewed with the eye exactly on it.\n\t// FIXME, we send origin at 1/128 now, change this?\n\t// the server protocol only specifies to 1/16 pixel, so add 1/32 in each axis\n\n\tpparams->vieworg[0] += 1.0/32;\n\tpparams->vieworg[1] += 1.0/32;\n\tpparams->vieworg[2] += 1.0/32;\n\n\t// Check for problems around water, move the viewer artificially if necessary\n\t// -- this prevents drawing errors in GL due to waves\n\n\twaterOffset = 0;\n\tif ( pparams->waterlevel >= 2 )\n\t{\n\t\tint\t\ti, contents, waterDist, waterEntity;\n\t\tvec3_t\tpoint;\n\t\twaterDist = cl_waterdist->value;\n\n\t\tif ( pparams->hardware )\n\t\t{\n\t\t\twaterEntity = gEngfuncs.PM_WaterEntity( pparams->simorg );\n\t\t\tif ( waterEntity >= 0 && waterEntity < pparams->max_entities )\n\t\t\t{\n\t\t\t\tpwater = gEngfuncs.GetEntityByIndex( waterEntity );\n\t\t\t\tif ( pwater && ( pwater->model != NULL ) )\n\t\t\t\t{\n\t\t\t\t\twaterDist += ( pwater->curstate.scale * 16 );\t// Add in wave height\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\twaterEntity = 0;\t// Don't need this in software\n\t\t}\n\n\t\tVectorCopy( pparams->vieworg, point );\n\n\t\t// Eyes are above water, make sure we're above the waves\n\t\tif ( pparams->waterlevel == 2 )\n\t\t{\n\t\t\tpoint[2] -= waterDist;\n\t\t\tfor ( i = 0; i < waterDist; i++ )\n\t\t\t{\n\t\t\t\tcontents = gEngfuncs.PM_PointContents( point, NULL );\n\t\t\t\tif ( contents > CONTENTS_WATER )\n\t\t\t\t\tbreak;\n\t\t\t\tpoint[2] += 1;\n\t\t\t}\n\t\t\twaterOffset = (point[2] + waterDist) - pparams->vieworg[2];\n\t\t}\n\t\telse\n\t\t{\n\t\t\t// eyes are under water.  Make sure we're far enough under\n\t\t\tpoint[2] += waterDist;\n\n\t\t\tfor ( i = 0; i < waterDist; i++ )\n\t\t\t{\n\t\t\t\tcontents = gEngfuncs.PM_PointContents( point, NULL );\n\t\t\t\tif ( contents <= CONTENTS_WATER )\n\t\t\t\t\tbreak;\n\t\t\t\tpoint[2] -= 1;\n\t\t\t}\n\t\t\twaterOffset = (point[2] - waterDist) - pparams->vieworg[2];\n\t\t}\n\t}\n\n\tpparams->vieworg[2] += waterOffset;\n\n\tV_CalcViewRoll ( pparams );\n\n\tV_AddIdle ( pparams );\n\n\t// offsets\n\tif( pparams->health <= 0 )\n\t{\n\t\tVectorCopy( dead_viewangles, angles );\n\t}\n\telse\n\t{\n\t\tVectorCopy( pparams->cl_viewangles, angles );\n\t}\n\n\tAngleVectors ( angles, pparams->forward, pparams->right, pparams->up );\n\n\t// don't allow cheats in multiplayer\n\tif ( pparams->maxclients <= 1 )\n\t{\n\t\tfor ( i=0 ; i<3 ; i++ )\n\t\t{\n\t\t\tpparams->vieworg[i] += scr_ofsx->value*pparams->forward[i] + scr_ofsy->value*pparams->right[i] + scr_ofsz->value*pparams->up[i];\n\t\t}\n\t}\n\n\t// Treating cam_ofs[2] as the distance\n\t/*if( CL_IsThirdPerson() )\n\t{\n\t\tvec3_t ofs;\n\n\t\tofs[0] = ofs[1] = ofs[2] = 0.0;\n\n\t\tCL_CameraOffset( (float *)&ofs );\n\n\t\tVectorCopy( ofs, camAngles );\n\t\tcamAngles[ ROLL ]\t= 0;\n\n\t\tAngleVectors( camAngles, camForward, camRight, camUp );\n\n\t\tfor ( i = 0; i < 3; i++ )\n\t\t{\n\t\t\tpparams->vieworg[ i ] += -ofs[2] * camForward[ i ];\n\t\t}\n\t}*/\n\n\t// Give gun our viewangles\n\tif( pparams->health <= 0 )\n\t{\n\t\tVectorCopy( dead_viewangles, view->angles );\n\t}\n\telse\n\t{\n\t\tVectorCopy ( pparams->cl_viewangles, view->angles );\n\t}\n\n\t// set up gun position\n\tV_CalcGunAngle ( pparams );\n\n\t// Use predicted origin as view origin.\n\tVectorCopy ( pparams->simorg, view->origin );\n\tview->origin[2] += ( waterOffset );\n\tVectorAdd( view->origin, pparams->viewheight, view->origin );\n\n\t// Let the viewmodel shake at about 10% of the amplitude\n\tgEngfuncs.V_ApplyShake( view->origin, view->angles, 0.9 );\n\n\tfor ( i = 0; i < 3; i++ )\n\t{\n\t\tview->origin[ i ] += bob * 0.4 * pparams->forward[ i ];\n\t}\n\tview->origin[2] += bob;\n\n\t// throw in a little tilt.\n\tview->angles[YAW]   -= bob * 0.5;\n\tview->angles[ROLL]  -= bob * 1;\n\tview->angles[PITCH] -= bob * 0.3;\n\n\t// pushing the view origin down off of the same X/Z plane as the ent's origin will give the\n\t// gun a very nice 'shifting' effect when the player looks up/down. If there is a problem\n\t// with view model distortion, this may be a cause. (SJB).\n\tview->origin[2] -= 1;\n\n\t// fudge position around to keep amount of weapon visible\n\t// roughly equal with different FOV\n\tif (pparams->viewsize == 110)\n\t{\n\t\tview->origin[2] += 1;\n\t}\n\telse if (pparams->viewsize == 100)\n\t{\n\t\tview->origin[2] += 2;\n\t}\n\telse if (pparams->viewsize == 90)\n\t{\n\t\tview->origin[2] += 1;\n\t}\n\telse if (pparams->viewsize == 80)\n\t{\n\t\tview->origin[2] += 0.5;\n\t}\n\n\t// Don't allow viewmodel, if we are in sniper scope\n\tif( gHUD.m_iFOV <= 40 )\n\t\tview->model = NULL;\n\n\t// Add in the punchangle, if any\n\tpparams->viewangles = pparams->viewangles + pparams->punchangle;\n\n#if 0\n\t// Include client side punch, too\n\tVectorAdd ( pparams->viewangles, (float *)&ev_punchangle, pparams->viewangles);\n\n\tV_DropPunchAngle ( pparams->frametime, (float *)&ev_punchangle );\n#endif\n\t// smooth out stair step ups\n#if 1\n\tif ( !pparams->smoothing && pparams->onground && pparams->simorg[2] - oldz > 0)\n\t{\n\t\tfloat steptime;\n\n\t\tsteptime = pparams->time - lasttime;\n\t\tif (steptime < 0)\n\t\t\t//FIXME\t\tI_Error (\"steptime < 0\");\n\t\t\tsteptime = 0;\n\n\t\toldz += steptime * 150;\n\t\tif (oldz > pparams->simorg[2])\n\t\t\toldz = pparams->simorg[2];\n\t\tif (pparams->simorg[2] - oldz > 18)\n\t\t\toldz = pparams->simorg[2]- 18;\n\t\tpparams->vieworg[2] += oldz - pparams->simorg[2];\n\t\tview->origin[2] += oldz - pparams->simorg[2];\n\t}\n\telse\n\t{\n\t\toldz = pparams->simorg[2];\n\t}\n#endif\n\n\tstatic Vector lastorg;\n\tVector delta;\n\n\tdelta = pparams->simorg - lastorg;\n\n\tif( delta.x || delta.y || delta.z )\n\t{\n\t\tViewInterp.Origins[ ViewInterp.CurrentOrigin & ORIGIN_MASK ] = pparams->simorg;\n\t\tViewInterp.OriginTime[ ViewInterp.CurrentOrigin & ORIGIN_MASK ] = pparams->time;\n\t\tViewInterp.CurrentOrigin++;\n\n\t\tlastorg = pparams->simorg;\n\t}\n\n\tV_CalcQuakeGuns();\n\tV_CalcViewModelLag( pparams, view->origin, view->angles );\n\n\t// Smooth out whole view in multiplayer when on trains, lifts\n\tif ( cl_vsmoothing && cl_vsmoothing->value && ( pparams->smoothing && ( pparams->maxclients > 1 ) ) )\n\t{\n\t\tint foundidx;\n\t\tint i;\n\t\tfloat t;\n\n\t\tif ( cl_vsmoothing->value < 0.0 )\n\t\t\tgEngfuncs.Cvar_SetValue( \"cl_vsmoothing\", 0.0 );\n\n\t\tt = pparams->time - cl_vsmoothing->value;\n\n\t\tfor ( i = 1; i < ORIGIN_MASK; i++ )\n\t\t{\n\t\t\tfoundidx = ViewInterp.CurrentOrigin - 1 - i;\n\t\t\tif ( ViewInterp.OriginTime[ foundidx & ORIGIN_MASK ] <= t )\n\t\t\t\tbreak;\n\t\t}\n\n\t\tif ( i < ORIGIN_MASK && ViewInterp.OriginTime[ foundidx & ORIGIN_MASK ] != 0.0 )\n\t\t{\n\t\t\t// Interpolate\n\t\t\tvec3_t delta;\n\t\t\tdouble frac;\n\t\t\tdouble dt;\n\t\t\tvec3_t neworg;\n\n\t\t\tdt = ViewInterp.OriginTime[ (foundidx + 1) & ORIGIN_MASK ] - ViewInterp.OriginTime[ foundidx & ORIGIN_MASK ];\n\t\t\tif ( dt > 0.0 )\n\t\t\t{\n\t\t\t\tfrac = ( t - ViewInterp.OriginTime[ foundidx & ORIGIN_MASK] ) / dt;\n\t\t\t\tfrac = min( 1.0, frac );\n\t\t\t\tVectorSubtract( ViewInterp.Origins[ ( foundidx + 1 ) & ORIGIN_MASK ], ViewInterp.Origins[ foundidx & ORIGIN_MASK ], delta );\n\t\t\t\tVectorMA( ViewInterp.Origins[ foundidx & ORIGIN_MASK ], frac, delta, neworg );\n\n\t\t\t\t// Don't interpolate large changes\n\t\t\t\tif ( Length( delta ) < 64 )\n\t\t\t\t{\n\t\t\t\t\tVectorSubtract( neworg, pparams->simorg, delta );\n\n\t\t\t\t\tVectorAdd( pparams->simorg, delta, pparams->simorg );\n\t\t\t\t\tVectorAdd( pparams->vieworg, delta, pparams->vieworg );\n\t\t\t\t\tVectorAdd( view->origin, delta, view->origin );\n\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\n\t// Store off v_angles before munging for third person\n\tv_angles = pparams->viewangles;\n\tv_lastAngles = pparams->viewangles;\n\t//\tv_cl_angles = pparams->cl_viewangles;\t// keep old user mouse angles !\n\tif ( CL_IsThirdPerson() )\n\t{\n\t\tVectorCopy( camAngles, pparams->viewangles);\n\t\tfloat pitch = camAngles[ 0 ];\n\n\t\t// Normalize angles\n\t\tif ( pitch > 180 )\n\t\t\tpitch -= 360.0;\n\t\telse if ( pitch < -180 )\n\t\t\tpitch += 360;\n\n\t\t// Player pitch is inverted\n\t\tpitch /= -3.0;\n\n\t\t// Slam local player's pitch value\n\t\tent->angles[ 0 ] = pitch;\n\t\tent->curstate.angles[ 0 ] = pitch;\n\t\tent->prevstate.angles[ 0 ] = pitch;\n\t\tent->latched.prevangles[ 0 ] = pitch;\n\t}\n\n\t// override all previous settings if the viewent isn't the client\n\tif ( pparams->viewentity > pparams->maxclients )\n\t{\n\t\tcl_entity_t *viewentity;\n\t\tviewentity = gEngfuncs.GetEntityByIndex( pparams->viewentity );\n\t\tif ( viewentity )\n\t\t{\n\t\t\tVectorCopy( viewentity->origin, pparams->vieworg );\n\t\t\tVectorCopy( viewentity->angles, pparams->viewangles );\n\n\t\t\t// Store off overridden viewangles\n\t\t\tv_angles = pparams->viewangles;\n\t\t}\n\t}\n\n\tif ( gHUD.cl_viewbob && gHUD.cl_viewbob->value )\n\t{\n\t\tVectorCopy( view->origin, view->curstate.origin );\n\t\tVectorCopy( view->origin, view->latched.prevorigin );\n\t\tVectorCopy( view->angles, view->curstate.angles );\n\t\tVectorCopy( view->angles, view->latched.prevangles );\n\t}\n\n\tlasttime = pparams->time;\n\n\tv_origin = pparams->vieworg;\n}\n\n// Get the origin of the Observer based around the target's position and angles\nvoid V_GetChaseOrigin( float * angles, float * origin, float distance, float * returnvec )\n{\n\tVector vecStart, vecEnd;\n\tpmtrace_t *trace;\n\tint maxLoops = 8;\n\n\tVector forward, right, up;\n\n\t// trace back from the target using the player's view angles\n\tAngleVectors( angles, forward, right, up );\n\tforward = -forward;\n\n\tvecStart = origin;\n\tvecEnd = vecStart + forward * distance;\n\n\tint ignoreent = -1;\t// first, ignore no entity\n\tcl_entity_t *ent = NULL;\n\n\twhile( maxLoops > 0 )\n\t{\n\t\ttrace = gEngfuncs.PM_TraceLine( vecStart, vecEnd, PM_TRACELINE_PHYSENTSONLY, 2, ignoreent );\n\n\t\tif( trace->ent <= 0 )\n\t\t\tbreak; // we hit the world or nothing, stop trace\n\n\t\tent = gEngfuncs.GetEntityByIndex( PM_GetPhysEntInfo( trace->ent ));\n\t\tif( ent == NULL ) break;\n\n\t\t// hit non-player solid BSP, stop here\n\t\tif( ent->curstate.solid == SOLID_BSP && !ent->player )\n\t\t\tbreak;\n\n\t\t// if close enought to end pos, stop, otherwise continue trace\n\t\tif( trace->fraction < 1.0f )\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tignoreent = trace->ent;\t// ignore last hit entity\n\t\t\tvecStart = trace->endpos;\n\t\t}\n\t\tmaxLoops--;\n\t}\n\n\tVectorMA( trace->endpos, 8, trace->plane.normal, returnvec );\n\tv_lastDistance = (trace->endpos - Vector(origin)).Length();\t// real distance without offset\n}\n\nvoid V_GetDeathCam(cl_entity_t * ent1, cl_entity_t * ent2, float * angle, float * origin)\n{\n\tfloat newAngle[3];\n\tfloat newOrigin[3];\n\tstatic vec3_t nonDestructedOrigin;\n\tfloat distance = 168.0f;\n\n\tv_lastDistance += v_frametime * 96.0f;\t// move unit per seconds back\n\n\tif ( v_resetCamera )\n\t\tv_lastDistance = 64.0f;\n\n\tif ( distance > v_lastDistance )\n\t\tdistance = v_lastDistance;\n\n\tif (ent1->origin.x == 0 && ent1->origin.y == 0 && ent1->origin.z == 0)\n\t\tnonDestructedOrigin.CopyToArray(newOrigin);\n\telse\n\t{\n\t\tnonDestructedOrigin = ent1->origin;\n\t\tVectorCopy(ent1->origin, newOrigin);\n\t}\n\n\tif ( ent1->player )\n\t\tnewOrigin[2]+= 17; // head level of living player\n\n\t// get new angle towards second target\n\tif ( ent2 )\n\t{\n\t\tVectorSubtract(ent2->origin, nonDestructedOrigin, newAngle);\n\t\tVectorAngles( newAngle, newAngle );\n\t\tnewAngle[0] = -newAngle[0];\n\t}\n\telse\n\t{\n\t\t// if no second target is given, look down to dead player\n\t\tnewAngle[0] = 90.0f;\n\t\tnewAngle[1] = 0.0f;\n\t\tnewAngle[2] = 0;\n\t}\n\n\t// and smooth view\n\tV_SmoothInterpolateAngles( v_lastAngles, newAngle, angle, 120.0f );\n\n\tV_GetChaseOrigin( angle, newOrigin, distance, origin );\n\n\tVectorCopy(angle, v_lastAngles);\n}\n\nvoid V_GetSingleTargetCam(cl_entity_t * ent1, float * angle, float * origin)\n{\n\tfloat newAngle[3]; float newOrigin[3];\n\n\tint flags \t   = gHUD.m_Spectator.m_iObserverFlags;\n\n\t// see is target is a dead player\n\tbool deadPlayer = ent1->player && (ent1->curstate.solid == SOLID_NOT);\n\n\tfloat dfactor   = ( flags & DRC_FLAG_DRAMATIC )? -1.0f : 1.0f;\n\n\tfloat distance = 112.0f + ( 16.0f * dfactor ); // get close if dramatic;\n\n\t// go away in final scenes or if player just died\n\tif ( flags & DRC_FLAG_FINAL )\n\t\tdistance*=2.0f;\n\telse if ( deadPlayer )\n\t\tdistance*=1.5f;\n\n\t// let v_lastDistance float smoothly away\n\tv_lastDistance+= v_frametime * 32.0f;\t// move unit per seconds back\n\n\tif ( distance > v_lastDistance )\n\t\tdistance = v_lastDistance;\n\n\tVectorCopy(ent1->origin, newOrigin);\n\n\tif ( ent1->player )\n\t{\n\t\tif ( deadPlayer )\n\t\t\tnewOrigin[2]+= 2;\t//laying on ground\n\t\telse\n\t\t\tnewOrigin[2]+= 17; // head level of living player\n\n\t}\n\telse\n\t\tnewOrigin[2]+= 8;\t// object, tricky, must be above bomb in CS\n\n\t// we have no second target, choose view direction based on\n\t// show front of primary target\n\tVectorCopy(ent1->angles, newAngle);\n\n\t// show dead players from front, normal players back\n\tif ( flags & DRC_FLAG_FACEPLAYER )\n\t\tnewAngle[1]+= 180.0f;\n\n\n\tnewAngle[0]+= 12.5f * dfactor; // lower angle if dramatic\n\n\t// if final scene (bomb), show from real high pos\n\tif ( flags & DRC_FLAG_FINAL )\n\t\tnewAngle[0] = 22.5f;\n\n\t// choose side of object/player\n\tif ( flags & DRC_FLAG_SIDE )\n\t\tnewAngle[1]+=22.5f;\n\telse\n\t\tnewAngle[1]-=22.5f;\n\n\tV_SmoothInterpolateAngles( v_lastAngles, newAngle, angle, 120.0f );\n\n\t// HACK, if player is dead don't clip against his dead body, can't check this\n\tV_GetChaseOrigin( angle, newOrigin, distance, origin );\n}\n\nfloat MaxAngleBetweenAngles(  float * a1, float * a2 )\n{\n\tfloat d, maxd = 0.0f;\n\n\tNormalizeAngles( a1 );\n\tNormalizeAngles( a2 );\n\n\tfor ( int i = 0 ; i < 3 ; i++ )\n\t{\n\t\td = a2[i] - a1[i];\n\t\tif ( d > 180 )\n\t\t{\n\t\t\td -= 360;\n\t\t}\n\t\telse if ( d < -180 )\n\t\t{\n\t\t\td += 360;\n\t\t}\n\n\t\td = fabs(d);\n\n\t\tif ( d > maxd )\n\t\t\tmaxd=d;\n\t}\n\n\treturn maxd;\n}\n\nvoid V_GetDoubleTargetsCam(cl_entity_t\t * ent1, cl_entity_t * ent2,float * angle, float * origin)\n{\n\tfloat newAngle[3]; float newOrigin[3]; float tempVec[3];\n\n\tint flags \t   = gHUD.m_Spectator.m_iObserverFlags;\n\n\tfloat dfactor   = ( flags & DRC_FLAG_DRAMATIC )? -1.0f : 1.0f;\n\n\tfloat distance = 112.0f + ( 16.0f * dfactor ); // get close if dramatic;\n\n\t// go away in final scenes or if player just died\n\tif ( flags & DRC_FLAG_FINAL )\n\t\tdistance*=2.0f;\n\n\t// let v_lastDistance float smoothly away\n\tv_lastDistance+= v_frametime * 32.0f;\t// move unit per seconds back\n\n\tif ( distance > v_lastDistance )\n\t\tdistance = v_lastDistance;\n\n\tVectorCopy(ent1->origin, newOrigin);\n\n\tif ( ent1->player )\n\t\tnewOrigin[2]+= 17; // head level of living player\n\telse\n\t\tnewOrigin[2]+= 8;\t// object, tricky, must be above bomb in CS\n\n\t// get new angle towards second target\n\tVectorSubtract( ent2->origin, ent1->origin, newAngle );\n\n\tVectorAngles( newAngle, newAngle );\n\tnewAngle[0] = -newAngle[0];\n\n\t// set angle different in Dramtaic scenes\n\tnewAngle[0]+= 12.5f * dfactor; // lower angle if dramatic\n\n\tif ( flags & DRC_FLAG_SIDE )\n\t\tnewAngle[1]+=22.5f;\n\telse\n\t\tnewAngle[1]-=22.5f;\n\n\tfloat d = MaxAngleBetweenAngles( v_lastAngles, newAngle );\n\n\tif ( ( d < v_cameraFocusAngle) && ( v_cameraMode == CAM_MODE_RELAX ) )\n\t{\n\t\t// difference is to small and we are in relax camera mode, keep viewangles\n\t\tVectorCopy(v_lastAngles, newAngle );\n\t}\n\telse if ( (d < v_cameraRelaxAngle) && (v_cameraMode == CAM_MODE_FOCUS) )\n\t{\n\t\t// we catched up with our target, relax again\n\t\tv_cameraMode = CAM_MODE_RELAX;\n\t}\n\telse\n\t{\n\t\t// target move too far away, focus camera again\n\t\tv_cameraMode = CAM_MODE_FOCUS;\n\t}\n\n\t// and smooth view, if not a scene cut\n\tif ( v_resetCamera || (v_cameraMode == CAM_MODE_RELAX) )\n\t{\n\t\tVectorCopy( newAngle, angle );\n\t}\n\telse\n\t{\n\t\tV_SmoothInterpolateAngles( v_lastAngles, newAngle, angle, 180.0f );\n\t}\n\n\tV_GetChaseOrigin( newAngle, newOrigin, distance, origin );\n\n\t// move position up, if very close at target\n\tif ( v_lastDistance < 64.0f )\n\t\torigin[2]+= 16.0f*( 1.0f - (v_lastDistance / 64.0f ) );\n\n\t// calculate angle to second target\n\tVectorSubtract( ent2->origin, origin, tempVec );\n\tVectorAngles( tempVec, tempVec );\n\ttempVec[0] = -tempVec[0];\n\n\t/* take middle between two viewangles\n\tInterpolateAngles( newAngle, tempVec, newAngle, 0.5f); */\n\n\n\n}\n\nvoid V_GetDirectedChasePosition(cl_entity_t\t * ent1, cl_entity_t * ent2,float * angle, float * origin)\n{\n\n\tif ( v_resetCamera )\n\t{\n\t\tv_lastDistance = 4096.0f;\n\t\t// v_cameraMode = CAM_MODE_FOCUS;\n\t}\n\n\tif ( ( ent2 == (cl_entity_t*)0xFFFFFFFF ) || ( ent1->player && (ent1->curstate.solid == SOLID_NOT) ) )\n\t{\n\t\t// we have no second target or player just died\n\t\tV_GetSingleTargetCam(ent1, angle, origin);\n\t}\n\telse if ( ent2 )\n\t{\n\t\t// keep both target in view\n\t\tV_GetDoubleTargetsCam( ent1, ent2, angle, origin );\n\t}\n\telse\n\t{\n\t\t// second target disappeard somehow (dead)\n\n\t\t// keep last good viewangle\n\t\tfloat newOrigin[3];\n\n\t\tint flags \t   = gHUD.m_Spectator.m_iObserverFlags;\n\n\t\tfloat dfactor   = ( flags & DRC_FLAG_DRAMATIC )? -1.0f : 1.0f;\n\n\t\tfloat distance = 112.0f + ( 16.0f * dfactor ); // get close if dramatic;\n\n\t\t// go away in final scenes or if player just died\n\t\tif ( flags & DRC_FLAG_FINAL )\n\t\t\tdistance*=2.0f;\n\n\t\t// let v_lastDistance float smoothly away\n\t\tv_lastDistance+= v_frametime * 32.0f;\t// move unit per seconds back\n\n\t\tif ( distance > v_lastDistance )\n\t\t\tdistance = v_lastDistance;\n\n\t\tVectorCopy(ent1->origin, newOrigin);\n\n\t\tif ( ent1->player )\n\t\t\tnewOrigin[2]+= 17; // head level of living player\n\t\telse\n\t\t\tnewOrigin[2]+= 8;\t// object, tricky, must be above bomb in CS\n\n\t\tV_GetChaseOrigin( angle, newOrigin, distance, origin );\n\t}\n\n\tVectorCopy(angle, v_lastAngles);\n}\n\nvoid V_GetChasePos(int target, float * cl_angles, float * origin, float * angles)\n{\n\tcl_entity_t\t *\tent = NULL;\n\tcl_entity_t *local = gEngfuncs.GetLocalPlayer();\n\n\tif ( target )\n\t{\n\t\tent = gEngfuncs.GetEntityByIndex( target );\n\t}\n\n\tif (!ent)\n\t{\n\t\t// just copy a save in-map position\n\t\tVectorCopy ( vJumpAngles, angles );\n\t\tVectorCopy ( vJumpOrigin, origin );\n\t\treturn;\n\t}\n\n\n\tif( ent->index == local->index )\n\t{\n\t\tif ( g_iUser3 && g_iUser3 != 1 )\n\t\t\tV_GetDeathCam( ent, gEngfuncs.GetEntityByIndex( g_iUser3 ),\n\t\t\t\t\t\t   angles, origin );\n\t\telse\n\t\t\tV_GetDeathCam( ent, NULL,\n\t\t\t\t\t\t   angles, origin );\n\t}\n\telse if ( gHUD.m_Spectator.m_autoDirector->value )\n\t{\n\t\tif ( g_iUser3 && g_iUser3 != 1 )\n\t\t\tV_GetDirectedChasePosition( ent, gEngfuncs.GetEntityByIndex( g_iUser3 ),\n\t\t\t\t\t\t\t\t\t\tangles, origin );\n\t\telse\n\t\t\tV_GetDirectedChasePosition( ent, (cl_entity_t*)0xFFFFFFFF,\n\t\t\t\t\t\t\t\t\t\tangles, origin );\n\t}\n\telse\n\t{\n\t\tif ( cl_angles == NULL )\t// no mouse angles given, use entity angles ( locked mode )\n\t\t{\n\t\t\tVectorCopy ( ent->angles, angles);\n\t\t\tangles[0]*=-1;\n\t\t}\n\t\telse\n\t\t\tVectorCopy ( cl_angles, angles);\n\n\n\t\tVectorCopy ( ent->origin, origin);\n\n\t\torigin[2]+= 28; // DEFAULT_VIEWHEIGHT - some offset\n\n\t\tV_GetChaseOrigin( angles, origin, cl_chasedist->value, origin );\n\t}\n\n\tv_resetCamera = false;\n}\n\nvoid V_ResetChaseCam()\n{\n\tv_resetCamera = true;\n}\n\n\nvoid V_GetInEyePos(int target, float * origin, float * angles )\n{\n\tif ( !target)\n\t{\n\t\t// just copy a save in-map position\n\t\tVectorCopy ( vJumpAngles, angles );\n\t\tVectorCopy ( vJumpOrigin, origin );\n\t\treturn;\n\t};\n\n\n\tcl_entity_t\t * ent = gEngfuncs.GetEntityByIndex( target );\n\n\tif ( !ent )\n\t\treturn;\n\n\tVectorCopy ( ent->origin, origin );\n\tVectorCopy ( ent->angles, angles );\n\n\tangles[PITCH]*=-3.0f;\t// see CL_ProcessEntityUpdate()\n\n\tif ( ent->curstate.solid == SOLID_NOT )\n\t{\n\t\tangles[ROLL] = 80;\t// dead view angle\n\t\torigin[2]+= -8 ; // PM_DEAD_VIEWHEIGHT\n\t}\n\telse if (ent->curstate.usehull == 1 )\n\t\torigin[2]+= 12; // VEC_DUCK_VIEW;\n\telse\n\t\t// exacty eye position can't be calculated since it depends on\n\t\t// client values like cl_bobcycle, this offset matches the default values\n\t\torigin[2]+= 28; // DEFAULT_VIEWHEIGHT\n}\n\nvoid V_GetMapFreePosition( float * cl_angles, float * origin, float * angles )\n{\n\tvec3_t forward;\n\tvec3_t zScaledTarget;\n\n\tVectorCopy(cl_angles, angles);\n\n\t// modify angles since we don't wanna see map's bottom\n\tangles[0] = 51.25f + 38.75f*(angles[0]/90.0f);\n\n\tzScaledTarget[0] = gHUD.m_Spectator.m_mapOrigin[0];\n\tzScaledTarget[1] = gHUD.m_Spectator.m_mapOrigin[1];\n\tzScaledTarget[2] = gHUD.m_Spectator.m_mapOrigin[2] * (( 90.0f - angles[0] ) / 90.0f );\n\n\n\tAngleVectors(angles, forward, NULL, NULL);\n\n\tVectorNormalize(forward);\n\n\tVectorMA(zScaledTarget, -( 4096.0f / gHUD.m_Spectator.m_mapZoom ), forward , origin);\n}\n\nvoid V_GetMapChasePosition(int target, float * cl_angles, float * origin, float * angles)\n{\n\tvec3_t forward;\n\n\tif ( target )\n\t{\n\t\tcl_entity_t\t *\tent = gEngfuncs.GetEntityByIndex( target );\n\n\t\tif ( gHUD.m_Spectator.m_autoDirector->value )\n\t\t{\n\t\t\t// this is done to get the angles made by director mode\n\t\t\tV_GetChasePos(target, cl_angles, origin, angles);\n\t\t\tVectorCopy(ent->origin, origin);\n\n\t\t\t// keep fix chase angle horizontal\n\t\t\tangles[0] = 45.0f;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tVectorCopy(cl_angles, angles);\n\t\t\tVectorCopy(ent->origin, origin);\n\n\t\t\t// modify angles since we don't wanna see map's bottom\n\t\t\tangles[0] = 51.25f + 38.75f*(angles[0]/90.0f);\n\t\t}\n\t}\n\telse\n\t{\n\t\t// keep out roaming position, but modify angles\n\t\tVectorCopy(cl_angles, angles);\n\t\tangles[0] = 51.25f + 38.75f*(angles[0]/90.0f);\n\t}\n\n\torigin[2] *= (( 90.0f - angles[0] ) / 90.0f );\n\tangles[2] = 0.0f;\t// don't roll angle (if chased player is dead)\n\n\tAngleVectors(angles, forward, NULL, NULL);\n\n\tVectorNormalize(forward);\n\n\tVectorMA(origin, -1536, forward, origin);\n}\n\nint V_FindViewModelByWeaponModel( int iWeaponIndex )\n{\n\tmodel_t *pWeaponModel = IEngineStudio.GetModelByIndex( iWeaponIndex );\n\tif ( pWeaponModel )\n\t{\n\t\tstatic char szViewModelName[MAX_MODEL_NAME];\n\t\tstrncpy( szViewModelName, pWeaponModel->name, sizeof( szViewModelName ) );\n\n\t\tchar *szSub = strstr( szViewModelName, \"/p_\" );\n\t\tif( szSub )\n\t\t{\n\t\t\t// szSub pointer is a part of szViewModelName\n\t\t\tszSub[1] = 'v';\n\t\t\treturn gEngfuncs.pEventAPI->EV_FindModelIndex(szViewModelName);\n\t\t}\n\t\treturn 0;\n\t}\n\telse\n\t\treturn 0;\n\n}\n\n\n/*\n==================\nV_CalcSpectatorRefdef\n\n==================\n*/\nvoid V_CalcSpectatorRefdef ( struct ref_params_s * pparams )\n{\n\tstatic vec3_t\t\t\tvelocity ( 0.0f, 0.0f, 0.0f);\n\n\tstatic int lastWeaponModelIndex = 0;\n\tstatic int lastViewModelIndex = 0;\n\n\tcl_entity_t\t * ent = gEngfuncs.GetEntityByIndex( g_iUser2 );\n\n\tpparams->onlyClientDraw = false;\n\n\t// refresh position\n\tVectorCopy ( pparams->simorg, v_sim_org );\n\n\t// get old values\n\tVectorCopy ( pparams->cl_viewangles, v_cl_angles );\n\tVectorCopy ( pparams->viewangles, v_angles );\n\tVectorCopy ( pparams->vieworg, v_origin );\n\n\tif ( ( g_iUser1 == OBS_IN_EYE || gHUD.m_Spectator.m_pip->value == INSET_IN_EYE ) && ent )\n\t{\n\t\t// calculate player velocity\n\t\tfloat timeDiff = ent->curstate.msg_time - ent->prevstate.msg_time;\n\n\t\tif ( timeDiff > 0 )\n\t\t{\n\t\t\tvec3_t distance;\n\t\t\tVectorSubtract(ent->prevstate.origin, ent->curstate.origin, distance);\n\t\t\tVectorScale(distance, 1/timeDiff, distance );\n\n\t\t\tvelocity[0] = velocity[0]*0.9f + distance[0]*0.1f;\n\t\t\tvelocity[1] = velocity[1]*0.9f + distance[1]*0.1f;\n\t\t\tvelocity[2] = velocity[2]*0.9f + distance[2]*0.1f;\n\n\t\t\tVectorCopy(velocity, pparams->simvel);\n\t\t}\n\n\t\t// predict missing client data and set weapon model ( in HLTV mode or inset in eye mode )\n\t\tif ( gEngfuncs.IsSpectateOnly() )\n\t\t{\n\t\t\tV_GetInEyePos( g_iUser2, pparams->simorg, pparams->cl_viewangles );\n\n\t\t\tpparams->health = 1;\n\n\t\t\tcl_entity_t\t*gunModel = gEngfuncs.GetViewModel();\n\n\t\t\tif ( lastWeaponModelIndex != ent->curstate.weaponmodel )\n\t\t\t{\n\t\t\t\t// weapon model changed\n\n\t\t\t\tlastWeaponModelIndex = ent->curstate.weaponmodel;\n\t\t\t\tlastViewModelIndex = V_FindViewModelByWeaponModel( lastWeaponModelIndex );\n\t\t\t\tif ( lastViewModelIndex )\n\t\t\t\t{\n\t\t\t\t\tgEngfuncs.pfnWeaponAnim(0,0);\t// reset weapon animation\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t// model not found\n\t\t\t\t\tgunModel->model = NULL;\t// disable weapon model\n\t\t\t\t\tlastWeaponModelIndex = lastViewModelIndex = 0;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ( lastViewModelIndex )\n\t\t\t{\n\t\t\t\tgunModel->model = IEngineStudio.GetModelByIndex( lastViewModelIndex );\n\t\t\t\tgunModel->curstate.modelindex = lastViewModelIndex;\n\t\t\t\tgunModel->curstate.frame = 0;\n\t\t\t\tgunModel->curstate.colormap = 0;\n\t\t\t\tgunModel->index = g_iUser2;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tgunModel->model = NULL;\t// disable weaopn model\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\t// only get viewangles from entity\n\t\t\tVectorCopy ( ent->angles, pparams->cl_viewangles );\n\t\t\tpparams->cl_viewangles[PITCH]*=-3.0f;\t// see CL_ProcessEntityUpdate()\n\t\t}\n\t}\n\n\tv_frametime = pparams->frametime;\n\n\tif ( pparams->nextView == 0 )\n\t{\n\t\t// first renderer cycle, full screen\n\n\t\tswitch ( g_iUser1 )\n\t\t{\n\t\tcase OBS_CHASE_LOCKED:\n\t\t\tV_GetChasePos( g_iUser2, NULL, v_origin, v_angles );\n\t\t\tbreak;\n\n\t\tcase OBS_CHASE_FREE:\n\t\t\tV_GetChasePos( g_iUser2, v_cl_angles, v_origin, v_angles );\n\t\t\tbreak;\n\n\t\tcase OBS_ROAMING:\n\t\t\tVectorCopy (v_cl_angles, v_angles);\n\t\t\tVectorCopy (v_sim_org, v_origin);\n\t\t\tbreak;\n\n\t\tcase OBS_IN_EYE:\n\t\t\tV_CalcNormalRefdef ( pparams );\n\t\t\tbreak;\n\n\t\tcase OBS_MAP_FREE:\n\t\t\tpparams->onlyClientDraw = true;\n\t\t\tV_GetMapFreePosition( v_cl_angles, v_origin, v_angles );\n\t\t\tbreak;\n\n\t\tcase OBS_MAP_CHASE:\n\t\t\tpparams->onlyClientDraw = true;\n\t\t\tV_GetMapChasePosition( g_iUser2, v_cl_angles, v_origin, v_angles );\n\t\t\tbreak;\n\t\t}\n\n\t\tif ( gHUD.m_Spectator.m_pip->value )\n\t\t\tpparams->nextView = 1;\t// force a second renderer view\n\n\t\tgHUD.m_Spectator.m_iDrawCycle = 0;\n\n\t}\n\telse\n\t{\n\t\t// second renderer cycle, inset window\n\n\t\t// set inset parameters\n\t\tpparams->viewport[0] = XRES(gHUD.m_Spectator.m_OverviewData.insetWindowX);\t// change viewport to inset window\n\t\tpparams->viewport[1] = YRES(gHUD.m_Spectator.m_OverviewData.insetWindowY);\n\t\tpparams->viewport[2] = XRES(gHUD.m_Spectator.m_OverviewData.insetWindowWidth);\n\t\tpparams->viewport[3] = YRES(gHUD.m_Spectator.m_OverviewData.insetWindowHeight);\n\t\tpparams->nextView\t = 0;\t// on further view\n\n\t\t// override some settings in certain modes\n\t\tswitch ( (int)gHUD.m_Spectator.m_pip->value )\n\t\t{\n\t\tcase INSET_CHASE_LOCKED:\n\t\t\tV_GetChasePos( g_iUser2, NULL, v_origin, v_angles );\n\t\t\tbreak;\n\t\t\n\t\tcase INSET_CHASE_FREE:\n\t\t\tV_GetChasePos( g_iUser2, v_cl_angles, v_origin, v_angles );\n\t\t\tbreak;\n\n\t\tcase INSET_IN_EYE:\n\t\t\tV_CalcNormalRefdef ( pparams );\n\t\t\tbreak;\n\n\t\tcase INSET_MAP_FREE:\n\t\t\tpparams->onlyClientDraw = true;\n\t\t\tV_GetMapFreePosition( v_cl_angles, v_origin, v_angles );\n\t\t\tbreak;\n\n\t\tcase INSET_MAP_CHASE:\n\t\t\tpparams->onlyClientDraw = true;\n\n\t\t\tif ( g_iUser1 == OBS_ROAMING )\n\t\t\t\tV_GetMapChasePosition( 0, v_cl_angles, v_origin, v_angles );\n\t\t\telse\n\t\t\t\tV_GetMapChasePosition( g_iUser2, v_cl_angles, v_origin, v_angles );\n\n\t\t\tbreak;\n\t\t}\n\n\t\tgHUD.m_Spectator.m_iDrawCycle = 1;\n\t}\n\n\t// write back new values into pparams\n\tVectorCopy ( v_cl_angles, pparams->cl_viewangles );\n\tVectorCopy ( v_angles, pparams->viewangles )\n\tVectorCopy ( v_origin, pparams->vieworg );\n}\n\nvoid V_CalcThirdPersonRefdef( ref_params_t *pparams )\n{\n\tstatic float lasttime, oldz = 0;\n\n\tpparams->vieworg = pparams->simorg;\n\tpparams->vieworg = pparams->vieworg + pparams->viewheight;\n\tpparams->viewangles = pparams->cl_viewangles + pparams->punchangle + ev_punchangle;\n\n\tv_angles = pparams->viewangles;\n\tv_lastAngles = pparams->viewangles;\n\n\t// never let view origin sit exactly on a node line, because a water plane can\n\t// disappear when viewed with the eye exactly on it.\n\t// FIXME, we send origin at 1/128 now, change this?\n\t// the server protocol only specifies to 1/16 pixel, so add 1/32 in each axis\n\tpparams->vieworg[0] += 1.0f / 32;\n\tpparams->vieworg[1] += 1.0f / 32;\n\tpparams->vieworg[2] += 1.0f / 32;\n\n\t// this is smooth stair climbing in thirdperson mode but not affected for client model :(\n\tif( !pparams->smoothing && pparams->onground && pparams->simorg[2] - oldz > 0.0f )\n\t{\n\t\tfloat steptime;\n\n\t\tsteptime = pparams->time - lasttime;\n\t\tif( steptime < 0 ) steptime = 0;\n\n\t\toldz += steptime * 150.0f;\n\n\t\tif( oldz > pparams->simorg[2] )\n\t\t\toldz = pparams->simorg[2];\n\t\tif( pparams->simorg[2] - oldz > pparams->movevars->stepsize )\n\t\t\toldz = pparams->simorg[2] - pparams->movevars->stepsize;\n\n\t\tpparams->vieworg[2] += oldz - pparams->simorg[2];\n\t}\n\telse\n\t{\n\t\toldz = pparams->simorg[2];\n\t}\n\n\tlasttime = pparams->time;\n\n\tvec3_t ofs, camAngles, camForward, camRight, camUp;\n\n\tofs[0] = ofs[1] = ofs[2] = 0.0;\n\n\tCL_CameraOffset( (float *)&ofs );\n\n\tVectorCopy( ofs, camAngles );\n\tcamAngles[ ROLL ]\t= 0;\n\n\tAngleVectors( camAngles, camForward, camRight, camUp );\n\n\tfor ( int i = 0; i < 3; i++ )\n\t{\n\t\tpparams->vieworg[ i ] += -ofs[2] * camForward[ i ];\n\t}\n\n\tVectorCopy( camAngles, pparams->viewangles);\n\n\tV_GetChaseOrigin( pparams->viewangles, pparams->vieworg, cl_chasedist->value, pparams->vieworg );\n\n\tfloat pitch = pparams->viewangles[PITCH];\n\n\t// normalize angles\n\tif( pitch > 180.0f )\n\t\tpitch -= 360.0f;\n\telse if( pitch < -180.0f )\n\t\tpitch += 360.0f;\n\n\t// player pitch is inverted\n\tpitch /= -3.0;\n\n\tcl_entity_t *ent = gEngfuncs.GetLocalPlayer();\n\n\t// slam local player's pitch value\n\tent->angles[PITCH] = pitch;\n\tent->curstate.angles[PITCH] = pitch;\n\tent->prevstate.angles[PITCH] = pitch;\n\tent->latched.prevangles[PITCH] = pitch;\n}\n\nvoid DLLEXPORT V_CalcRefdef( struct ref_params_s *pparams )\n{\n\t// intermission / finale rendering\n\tif ( pparams->intermission )\n\t{\n\t\tV_CalcIntermissionRefdef ( pparams );\n\t}\n\telse if ( g_iUser1 )\t// g_iUser true if in spectator mode\n\t{\n\t\tV_CalcSpectatorRefdef ( pparams );\n\t}\n\telse if ( CL_IsThirdPerson() )\n\t{\n\t\tV_CalcThirdPersonRefdef ( pparams );\n\t}\n\telse\n\t{\n\t\tV_CalcNormalRefdef ( pparams );\n\t}\n}\n\n/*\n=============\nV_Init\n=============\n*/\nvoid V_Init (void)\n{\n\t//gEngfuncs.pfnAddCommand (\"centerview\", V_StartPitchDrift );\n\n\tscr_ofsx\t\t\t= gEngfuncs.pfnRegisterVariable( \"scr_ofsx\",\"0\", 0 );\n\tscr_ofsy\t\t\t= gEngfuncs.pfnRegisterVariable( \"scr_ofsy\",\"0\", 0 );\n\tscr_ofsz\t\t\t= gEngfuncs.pfnRegisterVariable( \"scr_ofsz\",\"0\", 0 );\n\n\tv_centermove\t\t= gEngfuncs.pfnRegisterVariable( \"v_centermove\", \"0.15\", 0 );\n\tv_centerspeed\t\t= gEngfuncs.pfnRegisterVariable( \"v_centerspeed\",\"500\", 0 );\n\n\tcl_bobcycle\t\t\t= gEngfuncs.pfnRegisterVariable( \"cl_bobcycle\",\"0.8\", 0 );// best default for my experimental gun wag (sjb)\n\tcl_bob\t\t\t\t= gEngfuncs.pfnRegisterVariable( \"cl_bob\",\"0.01\", FCVAR_ARCHIVE );// best default for my experimental gun wag (sjb)\n\tcl_bobup\t\t\t= gEngfuncs.pfnRegisterVariable( \"cl_bobup\",\"0.5\", 0 );\n\tcl_waterdist\t\t= gEngfuncs.pfnRegisterVariable( \"cl_waterdist\",\"4\", 0 );\n\tcl_chasedist\t\t= gEngfuncs.pfnRegisterVariable( \"cl_chasedist\",\"112\", 0 );\n\n\tcl_quakeguns\t\t= gEngfuncs.pfnRegisterVariable( \"cl_quakeguns\", \"0\", FCVAR_ARCHIVE );\n\tcl_weaponlag\t\t= gEngfuncs.pfnRegisterVariable( \"cl_weaponlag\", \"0\", FCVAR_ARCHIVE );\n}\n"
  },
  {
    "path": "cl_dll/z_weather.cpp",
    "content": ""
  },
  {
    "path": "cl_dll/z_weather.h",
    "content": ""
  },
  {
    "path": "cmake/LibraryNaming.cmake",
    "content": "include_guard(GLOBAL)\ninclude(CheckSymbolExists)\n\nmacro(check_build_target symbol)\n\tcheck_symbol_exists(${symbol} \"build.h\" ${symbol})\nendmacro()\n\nmacro(check_group_build_target symbol group)\n\tif(NOT ${group})\n\t\tcheck_build_target(${symbol})\n\t\tif(${symbol})\n\t\t\tset(${group} TRUE)\n\t\tendif()\n\telse()\n\t\tset(${symbol} FALSE)\n\tendif()\nendmacro()\n\n# So there is a problem:\n# 1. Total number of these symbols only grows, as we support more and more ports\n# 2. CMake don't have a way to check symbols in parallel (similar to Waf's multicheck)\n# 3. MSVC is incredibly slow at everything (startup, parsing, generating error)\n\n# Solution: group these symbols and set variable if one of them was found\n# this way we can reorder to reorder them by most common configurations\n# but we can't generate this list anymore! ... OR IS IT ???\n\n# Well, after reordering positions in engine's buildenums.h, we can partially autogenerate this list!\n# echo \"check_build_target(XASH_64BIT)\"\n# grep \"#define PLATFORM\" buildenums.h     | cut -d' ' -f 2 | cut -d_ -f 2- | awk '{ print \"check_group_build_target(XASH_\" $1 \" XASH_PLATFORM)\" }'\n# grep \"#define ARCHITECTURE\" buildenums.h | cut -d' ' -f 2 | cut -d_ -f 2- | awk '{ print \"check_group_build_target(XASH_\" $1 \" XASH_ARCHITECTURE)\"\n# grep \"#define ENDIAN\" buildenums.h  | cut -d' ' -f 2 | cut -d_ -f 2- | awk '{ print \"check_group_build_target(XASH_\" $1 \"_ENDIAN XASH_ENDIANNESS)\"}'\n# echo \"if(XASH_ARM)\"\n# grep '^#undef XASH' build.h | grep \"XASH_ARM[v_]\" |  awk '{ print \"check_build_target(\" $2 \")\"}'\n# echo \"endif()\"\n# echo \"if(XASH_RISCV)\"\n# grep '^#undef XASH' build.h | grep \"XASH_RISCV_\" |  awk '{ print \"check_build_target(\" $2 \")\"}'\n# echo \"endif()\"\n\n# NOTE: Android must have priority over Linux to work correctly, as Android matches both Linux and it's own macros!\n\nset(CMAKE_REQUIRED_INCLUDES \"${PROJECT_SOURCE_DIR}/public/\")\ncheck_build_target(XASH_64BIT)\ncheck_group_build_target(XASH_WIN32 XASH_PLATFORM)\ncheck_group_build_target(XASH_ANDROID XASH_PLATFORM)\ncheck_group_build_target(XASH_LINUX XASH_PLATFORM)\ncheck_group_build_target(XASH_FREEBSD XASH_PLATFORM)\ncheck_group_build_target(XASH_APPLE XASH_PLATFORM)\ncheck_group_build_target(XASH_NETBSD XASH_PLATFORM)\ncheck_group_build_target(XASH_OPENBSD XASH_PLATFORM)\ncheck_group_build_target(XASH_EMSCRIPTEN XASH_PLATFORM)\ncheck_group_build_target(XASH_DOS4GW XASH_PLATFORM)\ncheck_group_build_target(XASH_HAIKU XASH_PLATFORM)\ncheck_group_build_target(XASH_SERENITY XASH_PLATFORM)\ncheck_group_build_target(XASH_IRIX XASH_PLATFORM)\ncheck_group_build_target(XASH_NSWITCH XASH_PLATFORM)\ncheck_group_build_target(XASH_PSVITA XASH_PLATFORM)\ncheck_group_build_target(XASH_WASI XASH_PLATFORM)\ncheck_group_build_target(XASH_SUNOS XASH_PLATFORM)\ncheck_group_build_target(XASH_X86 XASH_ARCHITECTURE)\ncheck_group_build_target(XASH_AMD64 XASH_ARCHITECTURE)\ncheck_group_build_target(XASH_ARM XASH_ARCHITECTURE)\ncheck_group_build_target(XASH_MIPS XASH_ARCHITECTURE)\ncheck_group_build_target(XASH_PPC XASH_ARCHITECTURE)\ncheck_group_build_target(XASH_JS XASH_ARCHITECTURE)\ncheck_group_build_target(XASH_WASM XASH_ARCHITECTURE)\ncheck_group_build_target(XASH_E2K XASH_ARCHITECTURE)\ncheck_group_build_target(XASH_RISCV XASH_ARCHITECTURE)\ncheck_group_build_target(XASH_LITTLE_ENDIAN XASH_ENDIANNESS)\ncheck_group_build_target(XASH_BIG_ENDIAN XASH_ENDIANNESS)\nif(XASH_ARM)\ncheck_build_target(XASH_ARM_HARDFP)\ncheck_build_target(XASH_ARM_SOFTFP)\ncheck_build_target(XASH_ARMv4)\ncheck_build_target(XASH_ARMv5)\ncheck_build_target(XASH_ARMv6)\ncheck_build_target(XASH_ARMv7)\ncheck_build_target(XASH_ARMv8)\nendif()\nif(XASH_RISCV)\ncheck_build_target(XASH_RISCV_DOUBLEFP)\ncheck_build_target(XASH_RISCV_SINGLEFP)\ncheck_build_target(XASH_RISCV_SOFTFP)\nendif()\nif(XASH_ANDROID)\ncheck_build_target(XASH_TERMUX)\nendif()\nunset(CMAKE_REQUIRED_INCLUDES)\n\n# engine/common/build.c\nif(XASH_ANDROID)\n\tset(BUILDOS \"android\")\nelseif(XASH_WIN32 OR XASH_LINUX OR XASH_APPLE)\n\tset(BUILDOS \"\") # no prefix for default OS\nelseif(XASH_FREEBSD)\n\tset(BUILDOS \"freebsd\")\nelseif(XASH_NETBSD)\n\tset(BUILDOS \"netbsd\")\nelseif(XASH_OPENBSD)\n\tset(BUILDOS \"openbsd\")\nelseif(XASH_EMSCRIPTEN)\n\tset(BUILDOS \"emscripten\")\nelseif(XASH_DOS4GW)\n\tset(BUILDOS \"DOS4GW\")\nelseif(XASH_HAIKU)\n\tset(BUILDOS \"haiku\")\nelseif(XASH_SERENITY)\n\tset(BUILDOS \"serenityos\")\nelseif(XASH_NSWITCH)\n\tset(BUILDOS \"nswitch\")\nelseif(XASH_PSVITA)\n\tset(BUILDOS \"psvita\")\nelseif(XASH_IRIX)\n\tset(BUILDOS \"irix\")\nelseif(XASH_WASI)\n\tset(BUILDOS \"wasi\")\nelseif(XASH_SUNOS)\n\tset(BUILDOS \"sunos\")\nelse()\n\tmessage(SEND_ERROR \"Place your operating system name here! If this is a mistake, try to fix conditions above and report a bug\")\nendif()\n\nif(XASH_AMD64)\n\tset(BUILDARCH \"amd64\")\nelseif(XASH_X86)\n\tif(XASH_WIN32 OR XASH_LINUX OR XASH_APPLE)\n\t\tset(BUILDARCH \"\") # no prefix for default OS\n\telse()\n\t\tset(BUILDARCH \"i386\")\n\tendif()\nelseif(XASH_ARM AND XASH_64BIT)\n\tset(BUILDARCH \"arm64\")\nelseif(XASH_ARM)\n\tset(BUILDARCH \"armv\")\n\tif(XASH_ARMv8)\n\t\tset(BUILDARCH \"${BUILDARCH}8_32\")\n\telseif(XASH_ARMv7)\n\t\tset(BUILDARCH \"${BUILDARCH}7\")\n\telseif(XASH_ARMv6)\n\t\tset(BUILDARCH \"${BUILDARCH}6\")\n\telseif(XASH_ARMv5)\n\t\tset(BUILDARCH \"${BUILDARCH}5\")\n\telseif(XASH_ARMv4)\n\t\tset(BUILDARCH \"${BUILDARCH}4\")\n\telse()\n\t\tmessage(SEND_ERROR \"Unknown ARM\")\n\tendif()\n\n\tif(XASH_ARM_HARDFP)\n\t\tset(BUILDARCH \"${BUILDARCH}hf\")\n\telse()\n\t\tset(BUILDARCH \"${BUILDARCH}l\")\n\tendif()\nelseif(XASH_MIPS)\n\tset(BUILDARCH \"mips\")\n\tif(XASH_64BIT)\n\t\tset(BUILDARCH \"${BUILDARCH}64\")\n\tendif()\n\n\tif(XASH_LITTLE_ENDIAN)\n\t\tset(BUILDARCH \"${BUILDARCH}el\")\n\tendif()\nelseif(XASH_RISCV)\n\tset(BUILDARCH \"riscv\")\n\tif(XASH_64BIT)\n\t\tset(BUILDARCH \"${BUILDARCH}64\")\n\telse()\n\t\tset(BUILDARCH \"${BUILDARCH}32\")\n\tendif()\n\n\tif(XASH_RISCV_DOUBLEFP)\n\t\tset(BUILDARCH \"${BUILDARCH}d\")\n\telseif(XASH_RISCV_SINGLEFP)\n\t\tset(BUILDARCH \"${BUILDARCH}f\")\n\tendif()\nelseif(XASH_JS)\n\tset(BUILDARCH \"javascript\")\nelseif(XASH_E2K)\n\tset(BUILDARCH \"e2k\")\nelseif(XASH_PPC)\n\tset(BUILDARCH \"ppc\")\n\tif(XASH_64BIT)\n\t\tset(BUILDARCH \"${BUILDARCH}64\")\n\tendif()\n\n\tif(XASH_LITTLE_ENDIAN)\n\t\tset(BUILDARCH \"${BUILDARCH}el\")\n\tendif()\nelseif(XASH_WASM)\n\tif(XASH_64BIT)\n\t\tset(BUILDARCH \"wasm64\")\n\telse()\n\t\tset(BUILDARCH \"wasm32\")\n\tendif()\nelse()\n\tmessage(SEND_ERROR \"Place your architecture name here! If this is a mistake, try to fix conditions above and report a bug\")\nendif()\n\nif(BUILDOS AND BUILDARCH)\n\tset(POSTFIX \"_${BUILDOS}_${BUILDARCH}\")\nelseif(BUILDARCH)\n\tset(POSTFIX \"_${BUILDARCH}\")\nelse()\n\tset(POSTFIX \"\")\nendif()\n\nmessage(STATUS \"Library postfix: \" ${POSTFIX})\n\nmacro(set_target_postfix target)\n\tset_target_properties(${target} PROPERTIES OUTPUT_NAME \"${target}${POSTFIX}\")\n\tif(NOT ANDROID)\n\t\tset_target_properties(${target} PROPERTIES PREFIX \"\")\n\tendif()\nendmacro()\n\nmacro(set_target_postfix_with_name target name)\n\tset_target_properties(${target} PROPERTIES OUTPUT_NAME \"${name}${POSTFIX}\")\n\tif(NOT ANDROID)\n\t\tset_target_properties(${target} PROPERTIES PREFIX \"\")\n\tendif()\nendmacro()\n\n"
  },
  {
    "path": "common/beamdef.h",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\t\n*\tThis product contains software technology licensed from Id \n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc. \n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n#if !defined ( BEAMDEFH )\n#define BEAMDEFH\n#ifdef _WIN32\n#ifndef __MINGW32__\n#pragma once\n#endif /* not __MINGW32__ */\n#endif\n\n#define FBEAM_STARTENTITY\t\t0x00000001\n#define FBEAM_ENDENTITY\t\t\t0x00000002\n#define FBEAM_FADEIN\t\t\t0x00000004\n#define FBEAM_FADEOUT\t\t\t0x00000008\n#define FBEAM_SINENOISE\t\t\t0x00000010\n#define FBEAM_SOLID\t\t\t\t0x00000020\n#define FBEAM_SHADEIN\t\t\t0x00000040\n#define FBEAM_SHADEOUT\t\t\t0x00000080\n#define FBEAM_STARTVISIBLE\t\t0x10000000\t\t// Has this client actually seen this beam's start entity yet?\n#define FBEAM_ENDVISIBLE\t\t0x20000000\t\t// Has this client actually seen this beam's end entity yet?\n#define FBEAM_ISACTIVE\t\t\t0x40000000\n#define FBEAM_FOREVER\t\t\t0x80000000\n\ntypedef struct beam_s BEAM;\nstruct beam_s\n{\n\tBEAM\t\t*next;\n\tint\t\t\ttype;\n\tint\t\t\tflags;\n\tvec3_t\t\tsource;\n\tvec3_t\t\ttarget;\n\tvec3_t\t\tdelta;\n\tfloat\t\tt;\t\t// 0 .. 1 over lifetime of beam\n\tfloat\t\tfreq;\n\tfloat\t\tdie;\n\tfloat\t\twidth;\n\tfloat\t\tamplitude;\n\tfloat\t\tr, g, b;\n\tfloat\t\tbrightness;\n\tfloat\t\tspeed;\n\tfloat\t\tframeRate;\n\tfloat\t\tframe;\n\tint\t\t\tsegments;\n\tint\t\t\tstartEntity;\n\tint\t\t\tendEntity;\n\tint\t\t\tmodelIndex;\n\tint\t\t\tframeCount;\n\tstruct model_s\t\t*pFollowModel;\n\tstruct particle_s\t*particles;\n};\n\n#endif\n"
  },
  {
    "path": "common/cl_entity.h",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\t\n*\tThis product contains software technology licensed from Id \n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc. \n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n// cl_entity.h\n#if !defined( CL_ENTITYH )\n#define CL_ENTITYH\n#ifdef _WIN32\n#ifndef __MINGW32__\n#pragma once\n#endif /* not __MINGW32__ */\n#endif\n\ntypedef struct efrag_s\n{\n\tstruct mleaf_s\t\t*leaf;\n\tstruct efrag_s\t\t*leafnext;\n\tstruct cl_entity_s\t*entity;\n\tstruct efrag_s\t\t*entnext;\n} efrag_t;\n\ntypedef struct\n{\n\tbyte\t\t\t\t\tmouthopen;\t\t// 0 = mouth closed, 255 = mouth agape\n\tbyte\t\t\t\t\tsndcount;\t\t// counter for running average\n\tint\t\t\t\t\t\tsndavg;\t\t\t// running average\n} mouth_t;\n\ntypedef struct\n{\n\tfloat\t\t\t\t\tprevanimtime;  \n\tfloat\t\t\t\t\tsequencetime;\n\tbyte\t\t\t\t\tprevseqblending[2];\n\tvec3_t\t\t\t\t\tprevorigin;\n\tvec3_t\t\t\t\t\tprevangles;\n\n\tint\t\t\t\t\t\tprevsequence;\n\tfloat\t\t\t\t\tprevframe;\n\n\tbyte\t\t\t\t\tprevcontroller[4];\n\tbyte\t\t\t\t\tprevblending[2];\n} latchedvars_t;\n\ntypedef struct\n{\n\t// Time stamp for this movement\n\tfloat\t\t\t\t\tanimtime;\n\n\tvec3_t\t\t\t\t\torigin;\n\tvec3_t\t\t\t\t\tangles;\n} position_history_t;\n\ntypedef struct cl_entity_s cl_entity_t;\n\n#define HISTORY_MAX\t\t64  // Must be power of 2\n#define HISTORY_MASK\t( HISTORY_MAX - 1 )\n\n\n#if !defined( ENTITY_STATEH )\n#include \"entity_state.h\"\n#endif\n\n#if !defined( PROGS_H )\n#include \"progs.h\"\n#endif\n\nstruct cl_entity_s\n{\n\tint\t\t\t\t\t\tindex;      // Index into cl_entities ( should match actual slot, but not necessarily )\n\n\tqboolean\t\t\t\tplayer;     // True if this entity is a \"player\"\n\t\n\tentity_state_t\t\t\tbaseline;   // The original state from which to delta during an uncompressed message\n\tentity_state_t\t\t\tprevstate;  // The state information from the penultimate message received from the server\n\tentity_state_t\t\t\tcurstate;   // The state information from the last message received from server\n\n\tint\t\t\t\t\t\tcurrent_position;  // Last received history update index\n\tposition_history_t\t\tph[ HISTORY_MAX ];   // History of position and angle updates for this player\n\n\tmouth_t\t\t\t\t\tmouth;\t\t\t// For synchronizing mouth movements.\n\n\tlatchedvars_t\t\t\tlatched;\t\t// Variables used by studio model rendering routines\n\n\t// Information based on interplocation, extrapolation, prediction, or just copied from last msg received.\n\t//\n\tfloat\t\t\t\t\tlastmove;\n\n\t// Actual render position and angles\n\tvec3_t\t\t\t\t\torigin;\n\tvec3_t\t\t\t\t\tangles;\n\n\t// Attachment points\n\tvec3_t\t\t\t\t\tattachment[4];\n\n\t// Other entity local information\n\tint\t\t\t\t\t\ttrivial_accept;\n\n\tstruct model_s\t\t\t*model;\t\t\t// cl.model_precache[ curstate.modelindes ];  all visible entities have a model\n\tstruct efrag_s\t\t\t*efrag;\t\t\t// linked list of efrags\n\tstruct mnode_s\t\t\t*topnode;\t\t// for bmodels, first world node that splits bmodel, or NULL if not split\n\n\tfloat\t\t\t\t\tsyncbase;\t\t// for client-side animations -- used by obsolete alias animation system, remove?\n\tint\t\t\t\t\t\tvisframe;\t\t// last frame this entity was found in an active leaf\n\tcolorVec\t\t\t\tcvFloorColor;\n};\n\n#endif // !CL_ENTITYH\n"
  },
  {
    "path": "common/com_model.h",
    "content": "//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============\n//\n// Purpose: \n//\n// $NoKeywords: $\n//=============================================================================\n\n// com_model.h\n#if !defined( COM_MODEL_H )\n#define COM_MODEL_H\n#if defined( _WIN32 )\n#ifndef __MINGW32__\n#pragma once\n#endif /* not __MINGW32__ */\n#endif\n\n#define STUDIO_RENDER 1\n#define STUDIO_EVENTS 2\n\n#define MAX_CLIENTS\t\t\t32\n#define\tMAX_EDICTS\t\t\t900\n\n#define MAX_MODEL_NAME\t\t64\n#define MAX_MAP_HULLS\t\t4\n#define\tMIPLEVELS\t\t\t4\n#define\tNUM_AMBIENTS\t\t4\t\t// automatic ambient sounds\n#define\tMAXLIGHTMAPS\t\t4\n#define\tPLANE_ANYZ\t\t\t5\n\n#define ALIAS_Z_CLIP_PLANE\t5\n\n// flags in finalvert_t.flags\n#define ALIAS_LEFT_CLIP\t\t\t\t0x0001\n#define ALIAS_TOP_CLIP\t\t\t\t0x0002\n#define ALIAS_RIGHT_CLIP\t\t\t0x0004\n#define ALIAS_BOTTOM_CLIP\t\t\t0x0008\n#define ALIAS_Z_CLIP\t\t\t\t0x0010\n#define ALIAS_ONSEAM\t\t\t\t0x0020\n#define ALIAS_XY_CLIP_MASK\t\t\t0x000F\n\n#define\tZISCALE\t((float)0x8000)\n\n#define CACHE_SIZE\t32\t\t// used to align key data structures\n\ntypedef enum\n{\n\tmod_brush, \n\tmod_sprite, \n\tmod_alias, \n\tmod_studio\n} modtype_t;\n\n// must match definition in modelgen.h\n#ifndef SYNCTYPE_T\n#define SYNCTYPE_T\n\ntypedef enum\n{\n\tST_SYNC=0,\n\tST_RAND\n} synctype_t;\n\n#endif\n\ntypedef struct\n{\n\tfloat\t\tmins[3], maxs[3];\n\tfloat\t\torigin[3];\n\tint\t\t\theadnode[MAX_MAP_HULLS];\n\tint\t\t\tvisleafs;\t\t// not including the solid leaf 0\n\tint\t\t\tfirstface, numfaces;\n} dmodel_t;\n\n// plane_t structure\ntypedef struct mplane_s\n{\n\tvec3_t\tnormal;\t\t\t// surface normal\n\tfloat\tdist;\t\t\t// closest appoach to origin\n\tbyte\ttype;\t\t\t// for texture axis selection and fast side tests\n\tbyte\tsignbits;\t\t// signx + signy<<1 + signz<<1\n\tbyte\tpad[2];\n} mplane_t;\n\ntypedef struct\n{\n\tvec3_t\t\tposition;\n} mvertex_t;\n\ntypedef struct\n{\n\tunsigned short\tv[2];\n\tunsigned int\tcachededgeoffset;\n} medge_t;\n\ntypedef struct texture_s\n{\n\tchar\t\tname[16];\n\tunsigned\twidth, height;\n\tint\t\t\tanim_total;\t\t\t\t// total tenths in sequence ( 0 = no)\n\tint\t\t\tanim_min, anim_max;\t\t// time for this frame min <=time< max\n\tstruct texture_s *anim_next;\t\t// in the animation sequence\n\tstruct texture_s *alternate_anims;\t// bmodels in frame 1 use these\n\tunsigned\toffsets[MIPLEVELS];\t\t// four mip maps stored\n\tunsigned\tpaloffset;\n} texture_t;\n\ntypedef struct\n{\n\tfloat\t\tvecs[2][4];\t\t// [s/t] unit vectors in world space. \n\t\t\t\t\t\t\t\t// [i][3] is the s/t offset relative to the origin.\n\t\t\t\t\t\t\t\t// s or t = dot(3Dpoint,vecs[i])+vecs[i][3]\n\tfloat\t\tmipadjust;\t\t// ?? mipmap limits for very small surfaces\n\ttexture_t\t*texture;\n\tint\t\t\tflags;\t\t\t// sky or slime, no lightmap or 256 subdivision\n} mtexinfo_t;\n\ntypedef struct mnode_s\n{\n// common with leaf\n\tint\t\t\tcontents;\t\t// 0, to differentiate from leafs\n\tint\t\t\tvisframe;\t\t// node needs to be traversed if current\n\t\n\tshort\t\tminmaxs[6];\t\t// for bounding box culling\n\n\tstruct mnode_s\t*parent;\n\n// node specific\n\tmplane_t\t*plane;\n\tstruct mnode_s\t*children[2];\t\n\n\tunsigned short\t\tfirstsurface;\n\tunsigned short\t\tnumsurfaces;\n} mnode_t;\n\ntypedef struct msurface_s\tmsurface_t;\ntypedef struct decal_s\t\tdecal_t;\n\n// JAY: Compress this as much as possible\nstruct decal_s\n{\n\tdecal_t\t\t*pnext;\t\t\t// linked list for each surface\n\tmsurface_t\t*psurface;\t\t// Surface id for persistence / unlinking\n\tshort\t\tdx;\t\t\t\t// Offsets into surface texture (in texture coordinates, so we don't need floats)\n\tshort\t\tdy;\n\tshort\t\ttexture;\t\t// Decal texture\n\tbyte\t\tscale;\t\t\t// Pixel scale\n\tbyte\t\tflags;\t\t\t// Decal flags\n\n\tshort\t\tentityIndex;\t// Entity this is attached to\n};\n\ntypedef struct mleaf_s\n{\n// common with node\n\tint\t\t\tcontents;\t\t// wil be a negative contents number\n\tint\t\t\tvisframe;\t\t// node needs to be traversed if current\n\n\tshort\t\tminmaxs[6];\t\t// for bounding box culling\n\n\tstruct mnode_s\t*parent;\n\n// leaf specific\n\tbyte\t\t*compressed_vis;\n\tstruct efrag_s\t*efrags;\n\n\tmsurface_t\t**firstmarksurface;\n\tint\t\t\tnummarksurfaces;\n\tint\t\t\tkey;\t\t\t// BSP sequence number for leaf's contents\n\tbyte\t\tambient_sound_level[NUM_AMBIENTS];\n} mleaf_t;\n\nstruct msurface_s\n{\n\tint\t\t\tvisframe;\t\t// should be drawn when node is crossed\n\n\tint\t\t\tdlightframe;\t// last frame the surface was checked by an animated light\n\tint\t\t\tdlightbits;\t\t// dynamically generated. Indicates if the surface illumination \n\t\t\t\t\t\t\t\t// is modified by an animated light.\n\n\tmplane_t\t*plane;\t\t\t// pointer to shared plane\t\t\t\n\tint\t\t\tflags;\t\t\t// see SURF_ #defines\n\n\tint\t\t\tfirstedge;\t// look up in model->surfedges[], negative numbers\n\tint\t\t\tnumedges;\t// are backwards edges\n\t\n// surface generation data\n\tstruct surfcache_s\t*cachespots[MIPLEVELS];\n\n\tshort\t\ttexturemins[2]; // smallest s/t position on the surface.\n\tshort\t\textents[2];\t\t// ?? s/t texture size, 1..256 for all non-sky surfaces\n\n\tmtexinfo_t\t*texinfo;\t\t\n\t\n// lighting info\n\tbyte\t\tstyles[MAXLIGHTMAPS]; // index into d_lightstylevalue[] for animated lights \n\t\t\t\t\t\t\t\t\t  // no one surface can be effected by more than 4 \n\t\t\t\t\t\t\t\t\t  // animated lights.\n\tcolor24\t\t*samples;\n\t\n\tdecal_t\t\t*pdecals;\n};\n\ntypedef struct\n{\n\tint\t\t\tplanenum;\n\tshort\t\tchildren[2];\t// negative numbers are contents\n} dclipnode_t;\n\ntypedef struct hull_s\n{\n\tdclipnode_t\t*clipnodes;\n\tmplane_t\t*planes;\n\tint\t\t\tfirstclipnode;\n\tint\t\t\tlastclipnode;\n\tvec3_t\t\tclip_mins;\n\tvec3_t\t\tclip_maxs;\n} hull_t;\n\n#if !defined( CACHE_USER ) && !defined( QUAKEDEF_H )\n#define CACHE_USER\ntypedef struct cache_user_s\n{\n\tvoid\t*data;\n} cache_user_t;\n#endif\n\ntypedef struct model_s\n{\n\tchar\t\tname[ MAX_MODEL_NAME ];\n\tqboolean\tneedload;\t\t// bmodels and sprites don't cache normally\n\n\tmodtype_t\ttype;\n\tint\t\t\tnumframes;\n\tsynctype_t\tsynctype;\n\t\n\tint\t\t\tflags;\n\n//\n// volume occupied by the model\n//\t\t\n\tvec3_t\t\tmins, maxs;\n\tfloat\t\tradius;\n\n//\n// brush model\n//\n\tint\t\t\tfirstmodelsurface, nummodelsurfaces;\n\n\tint\t\t\tnumsubmodels;\n\tdmodel_t\t*submodels;\n\n\tint\t\t\tnumplanes;\n\tmplane_t\t*planes;\n\n\tint\t\t\tnumleafs;\t\t// number of visible leafs, not counting 0\n\tstruct mleaf_s\t\t*leafs;\n\n\tint\t\t\tnumvertexes;\n\tmvertex_t\t*vertexes;\n\n\tint\t\t\tnumedges;\n\tmedge_t\t\t*edges;\n\n\tint\t\t\tnumnodes;\n\tmnode_t\t\t*nodes;\n\n\tint\t\t\tnumtexinfo;\n\tmtexinfo_t\t*texinfo;\n\n\tint\t\t\tnumsurfaces;\n\tmsurface_t\t*surfaces;\n\n\tint\t\t\tnumsurfedges;\n\tint\t\t\t*surfedges;\n\n\tint\t\t\tnumclipnodes;\n\tdclipnode_t\t*clipnodes;\n\n\tint\t\t\tnummarksurfaces;\n\tmsurface_t\t**marksurfaces;\n\n\thull_t\t\thulls[MAX_MAP_HULLS];\n\n\tint\t\t\tnumtextures;\n\ttexture_t\t**textures;\n\n\tbyte\t\t*visdata;\n\n\tcolor24\t\t*lightdata;\n\n\tchar\t\t*entities;\n\n//\n// additional model data\n//\n\tcache_user_t\tcache;\t\t// only access through Mod_Extradata\n\n} model_t;\n\ntypedef vec_t vec4_t[4];\n\ntypedef struct alight_s\n{\n\tint\t\t\tambientlight;\t// clip at 128\n\tint\t\t\tshadelight;\t\t// clip at 192 - ambientlight\n\tvec3_t\t\tcolor;\n\tfloat\t\t*plightvec;\n} alight_t;\n\ntypedef struct auxvert_s\n{\n\tfloat\tfv[3];\t\t// viewspace x, y\n} auxvert_t;\n\n#include \"custom.h\"\n\n#define\tMAX_INFO_STRING\t\t\t256\n#define\tMAX_SCOREBOARDNAME\t\t32\ntypedef struct player_info_s\n{\n\t// User id on server\n\tint\t\tuserid;\n\n\t// User info string\n\tchar\tuserinfo[ MAX_INFO_STRING ];\n\n\t// Name\n\tchar\tname[ MAX_SCOREBOARDNAME ];\n\n\t// Spectator or not, unused\n\tint\t\tspectator;\n\n\tint\t\tping;\n\tint\t\tpacket_loss;\n\n\t// skin information\n\tchar\tmodel[MAX_QPATH];\n\tint\t\ttopcolor;\n\tint\t\tbottomcolor;\n\n\t// last frame rendered\n\tint\t\trenderframe;\t\n\n\t// Gait frame estimation\n\tint\t\tgaitsequence;\n\tfloat\tgaitframe;\n\tfloat\tgaityaw;\n\tvec3_t\tprevgaitorigin;\n\n\tcustomization_t customdata;\n} player_info_t;\n\n#endif // #define COM_MODEL_H\n"
  },
  {
    "path": "common/con_nprint.h",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\t\n*\tThis product contains software technology licensed from Id \n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc. \n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n#if !defined( CON_NPRINTH )\n#define CON_NPRINTH\n#ifdef _WIN32\n#ifndef __MINGW32__\n#pragma once\n#endif /* not __MINGW32__ */\n#endif\n\ntypedef struct con_nprint_s\n{\n\tint\t\tindex;\t\t\t// Row #\n\tfloat\ttime_to_live;\t// # of seconds before it disappears\n\tfloat\tcolor[ 3 ];\t\t// RGB colors ( 0.0 -> 1.0 scale )\n} con_nprint_t;\n\n#endif\n"
  },
  {
    "path": "common/const.h",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\t\n*\tThis product contains software technology licensed from Id \n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc. \n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n#ifndef CONST_H\n#define CONST_H\n//\n// Constants shared by the engine and dlls\n// This header file included by engine files and DLL files.\n// Most came from server.h\n\n// edict->flags\n#define FL_FLY\t\t(1<<0)\t// Changes the SV_Movestep() behavior to not need to be on ground\n#define FL_SWIM\t\t(1<<1)\t// Changes the SV_Movestep() behavior to not need to be on ground (but stay in water)\n#define FL_CONVEYOR\t\t(1<<2)\n#define FL_CLIENT\t\t(1<<3)\n#define FL_INWATER\t\t(1<<4)\n#define FL_MONSTER\t\t(1<<5)\n#define FL_GODMODE\t\t(1<<6)\n#define FL_NOTARGET\t\t(1<<7)\n#define FL_SKIPLOCALHOST\t(1<<8)\t// Don't send entity to local host, it's predicting this entity itself\n#define FL_ONGROUND\t\t(1<<9)\t// At rest / on the ground\n#define FL_PARTIALGROUND\t(1<<10)\t// not all corners are valid\n#define FL_WATERJUMP\t(1<<11)\t// player jumping out of water\n#define FL_FROZEN\t\t(1<<12)\t// Player is frozen for 3rd person camera\n#define FL_FAKECLIENT\t(1<<13)\t// JAC: fake client, simulated server side; don't send network messages to them\n#define FL_DUCKING\t\t(1<<14)\t// Player flag -- Player is fully crouched\n#define FL_FLOAT\t\t(1<<15)\t// Apply floating force to this entity when in water\n#define FL_GRAPHED\t\t(1<<16)\t// worldgraph has this ent listed as something that blocks a connection\n\n// UNDONE: Do we need these?\n#define FL_IMMUNE_WATER\t(1<<17)\n#define FL_IMMUNE_SLIME\t(1<<18)\n#define FL_IMMUNE_LAVA\t(1<<19)\n\n#define FL_PROXY\t\t(1<<20)\t// This is a spectator proxy\n#define FL_ALWAYSTHINK\t(1<<21)\t// Brush model flag -- call think every frame regardless of nextthink - ltime (for constantly changing velocity/path)\n#define FL_BASEVELOCITY\t(1<<22)\t// Base velocity has been applied this frame (used to convert base velocity into momentum)\n#define FL_MONSTERCLIP\t(1<<23)\t// Only collide in with monsters who have FL_MONSTERCLIP set\n#define FL_ONTRAIN\t\t(1<<24)\t// Player is _controlling_ a train, so movement commands should be ignored on client during prediction.\n#define FL_WORLDBRUSH\t(1<<25)\t// Not moveable/removeable brush entity (really part of the world, but represented as an entity for transparency or something)\n#define FL_SPECTATOR\t(1<<26)\t// This client is a spectator, don't run touch functions, etc.\n#define FL_CUSTOMENTITY\t(1<<29)\t// This is a custom entity\n#define FL_KILLME\t\t(1<<30)\t// This entity is marked for death -- This allows the engine to kill ents at the appropriate time\n#define FL_DORMANT\t\t(1<<31)\t// Entity is dormant, no updates to client\n\n// Goes into globalvars_t.trace_flags\n#define FTRACE_SIMPLEBOX\t\t(1<<0)\t// Traceline with a simple box\n#define FTRACE_IGNORE_GLASS\t\t(1<<1)\t// traceline will be ignored entities with rendermode != kRenderNormal\n\n// walkmove modes\n#define WALKMOVE_NORMAL\t\t0\t// normal walkmove\n#define WALKMOVE_WORLDONLY\t\t1\t// doesn't hit ANY entities, no matter what the solid type\n#define WALKMOVE_CHECKONLY\t\t2\t// move, but don't touch triggers\n\n// edict->movetype values\n#define MOVETYPE_NONE\t\t0\t// never moves\n//#define\tMOVETYPE_ANGLENOCLIP\t1\n//#define\tMOVETYPE_ANGLECLIP\t\t2\n#define MOVETYPE_WALK\t\t3\t// Player only - moving on the ground\n#define MOVETYPE_STEP\t\t4\t// gravity, special edge handling -- monsters use this\n#define MOVETYPE_FLY\t\t5\t// No gravity, but still collides with stuff\n#define MOVETYPE_TOSS\t\t6\t// gravity/collisions\n#define MOVETYPE_PUSH\t\t7\t// no clip to world, push and crush\n#define MOVETYPE_NOCLIP\t\t8\t// No gravity, no collisions, still do velocity/avelocity\n#define MOVETYPE_FLYMISSILE\t\t9\t// extra size to monsters\n#define MOVETYPE_BOUNCE\t\t10\t// Just like Toss, but reflect velocity when contacting surfaces\n#define MOVETYPE_BOUNCEMISSILE\t11\t// bounce w/o gravity\n#define MOVETYPE_FOLLOW\t\t12\t// track movement of aiment\n#define MOVETYPE_PUSHSTEP\t\t13\t// BSP model that needs physics/world collisions (uses nearest hull for world collision)\n#define MOVETYPE_COMPOUND\t\t14\t// glue two entities together (simple movewith)\n\n// edict->solid values\n// NOTE: Some movetypes will cause collisions independent of SOLID_NOT/SOLID_TRIGGER when the entity moves\n// SOLID only effects OTHER entities colliding with this one when they move - UGH!\n#define SOLID_NOT\t\t\t0\t// no interaction with other objects\n#define SOLID_TRIGGER\t\t1\t// touch on edge, but not blocking\n#define SOLID_BBOX\t\t\t2\t// touch on edge, block\n#define SOLID_SLIDEBOX\t\t3\t// touch on edge, but not an onground\n#define SOLID_BSP\t\t\t4\t// bsp clip, touch on edge, block\n#define SOLID_CUSTOM\t\t5\t// call external callbacks for tracing\n\n// edict->deadflag values\n#define DEAD_NO\t\t\t0 \t// alive\n#define DEAD_DYING\t\t\t1 \t// playing death animation or still falling off of a ledge waiting to hit ground\n#define DEAD_DEAD\t\t\t2 \t// dead. lying still.\n#define DEAD_RESPAWNABLE\t\t3\n#define DEAD_DISCARDBODY\t\t4\n\n#define DAMAGE_NO\t\t\t0\n#define DAMAGE_YES\t\t\t1\n#define DAMAGE_AIM\t\t\t2\n\n// entity effects\n#define EF_BRIGHTFIELD\t\t1\t// swirling cloud of particles\n#define EF_MUZZLEFLASH\t\t2\t// single frame ELIGHT on entity attachment 0\n#define EF_BRIGHTLIGHT\t\t4\t// DLIGHT centered at entity origin\n#define EF_DIMLIGHT\t\t\t8\t// player flashlight\n#define EF_INVLIGHT\t\t\t16\t// get lighting from ceiling\n#define EF_NOINTERP\t\t\t32\t// don't interpolate the next frame\n#define EF_LIGHT\t\t\t64\t// rocket flare glow sprite\n#define EF_NODRAW\t\t\t128\t// don't draw entity\n\n\n\n#define EF_NOREFLECT\t\t(1<<24)\t// Entity won't reflecting in mirrors\n#define EF_REFLECTONLY\t\t(1<<25)\t// Entity will be drawing only in mirrors\n#define EF_NOWATERCSG\t\t(1<<26)\t// Do not remove sides for func_water entity\n#define EF_FULLBRIGHT\t\t(1<<27)\t// Just get fullbright\n#define EF_NOSHADOW\t\t\t(1<<28)\t// ignore shadow for this entity\n#define EF_MERGE_VISIBILITY\t\t(1<<29)\t// this entity allowed to merge vis (e.g. env_sky or portal camera)\n#define EF_REQUEST_PHS\t\t(1<<30)\t// This entity requested phs bitvector instead of pvsbitvector in AddToFullPack calls\n// g-cont. one reserved bit here for me\n\n// entity flags\n#define EFLAG_SLERP\t\t\t1\t// do studio interpolation of this entity\n\t\t\n//\n// temp entity events\n//\n#define\tTE_BEAMPOINTS\t\t0\t// beam effect between two points\n// coord coord coord (start position) \n// coord coord coord (end position) \n// short (sprite index) \n// byte (starting frame) \n// byte (frame rate in 0.1's) \n// byte (life in 0.1's) \n// byte (line width in 0.1's) \n// byte (noise amplitude in 0.01's) \n// byte,byte,byte (color)\n// byte (brightness)\n// byte (scroll speed in 0.1's)\n\n#define\tTE_BEAMENTPOINT\t\t1\t// beam effect between point and entity\n// short (start entity) \n// coord coord coord (end position) \n// short (sprite index) \n// byte (starting frame) \n// byte (frame rate in 0.1's) \n// byte (life in 0.1's) \n// byte (line width in 0.1's) \n// byte (noise amplitude in 0.01's) \n// byte,byte,byte (color)\n// byte (brightness)\n// byte (scroll speed in 0.1's)\n\n#define\tTE_GUNSHOT\t\t2\t// particle effect plus ricochet sound\n// coord coord coord (position) \n\n#define\tTE_EXPLOSION\t\t3\t// additive sprite, 2 dynamic lights, flickering particles, explosion sound, move vertically 8 pps\n// coord coord coord (position) \n// short (sprite index)\n// byte (scale in 0.1's)\n// byte (framerate)\n// byte (flags)\n//\n// The Explosion effect has some flags to control performance/aesthetic features:\n#define TE_EXPLFLAG_NONE\t\t0\t// all flags clear makes default Half-Life explosion\n#define TE_EXPLFLAG_NOADDITIVE\t1\t// sprite will be drawn opaque (ensure that the sprite you send is a non-additive sprite)\n#define TE_EXPLFLAG_NODLIGHTS\t\t2\t// do not render dynamic lights\n#define TE_EXPLFLAG_NOSOUND\t\t4\t// do not play client explosion sound\n#define TE_EXPLFLAG_NOPARTICLES\t8\t// do not draw particles\n#define TE_EXPLFLAG_DRAWALPHA\t\t16\t// sprite will be drawn alpha\n#define TE_EXPLFLAG_ROTATE\t\t32\t// rotate the sprite randomly\n\n#define\tTE_TAREXPLOSION\t\t4\t// Quake1 \"tarbaby\" explosion with sound\n// coord coord coord (position) \n\n#define\tTE_SMOKE\t\t\t5\t// alphablend sprite, move vertically 30 pps\n// coord coord coord (position) \n// short (sprite index)\n// byte (scale in 0.1's)\n// byte (framerate)\n\n#define\tTE_TRACER\t\t\t6\t// tracer effect from point to point\n// coord, coord, coord (start) \n// coord, coord, coord (end)\n\n#define\tTE_LIGHTNING\t\t7\t// TE_BEAMPOINTS with simplified parameters\n// coord, coord, coord (start) \n// coord, coord, coord (end) \n// byte (life in 0.1's) \n// byte (width in 0.1's) \n// byte (amplitude in 0.01's)\n// short (sprite model index)\n\n#define\tTE_BEAMENTS\t\t8\t\t\n// short (start entity) \n// short (end entity) \n// short (sprite index) \n// byte (starting frame) \n// byte (frame rate in 0.1's) \n// byte (life in 0.1's) \n// byte (line width in 0.1's) \n// byte (noise amplitude in 0.01's) \n// byte,byte,byte (color)\n// byte (brightness)\n// byte (scroll speed in 0.1's)\n\n#define\tTE_SPARKS\t\t\t9\t// 8 random tracers with gravity, ricochet sprite\n// coord coord coord (position) \n\n#define\tTE_LAVASPLASH\t\t10\t// Quake1 lava splash\n// coord coord coord (position) \n\n#define\tTE_TELEPORT\t\t11\t// Quake1 teleport splash\n// coord coord coord (position) \n\n#define TE_EXPLOSION2\t\t12\t// Quake1 colormaped (base palette) particle explosion with sound\n// coord coord coord (position) \n// byte (starting color)\n// byte (num colors)\n\n#define TE_BSPDECAL\t\t\t13\t// Decal from the .BSP file \n// coord, coord, coord (x,y,z), decal position (center of texture in world)\n// short (texture index of precached decal texture name)\n// short (entity index)\n// [optional - only included if previous short is non-zero (not the world)] short (index of model of above entity)\n\n#define TE_IMPLOSION\t\t14\t// tracers moving toward a point\n// coord, coord, coord (position)\n// byte (radius)\n// byte (count)\n// byte (life in 0.1's) \n\n#define TE_SPRITETRAIL\t\t15\t// line of moving glow sprites with gravity, fadeout, and collisions\n// coord, coord, coord (start) \n// coord, coord, coord (end) \n// short (sprite index)\n// byte (count)\n// byte (life in 0.1's) \n// byte (scale in 0.1's) \n// byte (velocity along vector in 10's)\n// byte (randomness of velocity in 10's)\n\n#define TE_BEAM\t\t\t16\t// obsolete\n\n#define TE_SPRITE\t\t\t17\t// additive sprite, plays 1 cycle\n// coord, coord, coord (position) \n// short (sprite index) \n// byte (scale in 0.1's) \n// byte (brightness)\n\n#define TE_BEAMSPRITE\t\t18\t// A beam with a sprite at the end\n// coord, coord, coord (start position) \n// coord, coord, coord (end position) \n// short (beam sprite index) \n// short (end sprite index) \n\n#define TE_BEAMTORUS\t\t19\t// screen aligned beam ring, expands to max radius over lifetime\n// coord coord coord (center position) \n// coord coord coord (axis and radius) \n// short (sprite index) \n// byte (starting frame) \n// byte (frame rate in 0.1's) \n// byte (life in 0.1's) \n// byte (line width in 0.1's) \n// byte (noise amplitude in 0.01's) \n// byte,byte,byte (color)\n// byte (brightness)\n// byte (scroll speed in 0.1's)\n\n#define TE_BEAMDISK\t\t\t20\t// disk that expands to max radius over lifetime\n// coord coord coord (center position) \n// coord coord coord (axis and radius) \n// short (sprite index) \n// byte (starting frame) \n// byte (frame rate in 0.1's) \n// byte (life in 0.1's) \n// byte (line width in 0.1's) \n// byte (noise amplitude in 0.01's) \n// byte,byte,byte (color)\n// byte (brightness)\n// byte (scroll speed in 0.1's)\n\n#define TE_BEAMCYLINDER\t\t21\t// cylinder that expands to max radius over lifetime\n// coord coord coord (center position) \n// coord coord coord (axis and radius) \n// short (sprite index) \n// byte (starting frame) \n// byte (frame rate in 0.1's) \n// byte (life in 0.1's) \n// byte (line width in 0.1's) \n// byte (noise amplitude in 0.01's) \n// byte,byte,byte (color)\n// byte (brightness)\n// byte (scroll speed in 0.1's)\n\n#define TE_BEAMFOLLOW\t\t22\t// create a line of decaying beam segments until entity stops moving\n// short (entity:attachment to follow)\n// short (sprite index)\n// byte (life in 0.1's) \n// byte (line width in 0.1's) \n// byte,byte,byte (color)\n// byte (brightness)\n\n#define TE_GLOWSPRITE\t\t23\t\t\n// coord, coord, coord (pos) short (model index) byte (scale / 10)\n\n#define TE_BEAMRING\t\t\t24\t// connect a beam ring to two entities\n// short (start entity) \n// short (end entity) \n// short (sprite index) \n// byte (starting frame) \n// byte (frame rate in 0.1's) \n// byte (life in 0.1's) \n// byte (line width in 0.1's) \n// byte (noise amplitude in 0.01's) \n// byte,byte,byte (color)\n// byte (brightness)\n// byte (scroll speed in 0.1's)\n\n#define TE_STREAK_SPLASH\t25\t\t// oriented shower of tracers\n// coord coord coord (start position) \n// coord coord coord (direction vector) \n// byte (color)\n// short (count)\n// short (base speed)\n// short (random velocity)\n\n#define TE_BEAMHOSE\t\t\t26\t// obsolete\n\n#define TE_DLIGHT\t\t\t27\t// dynamic light, effect world, minor entity effect\n// coord, coord, coord (pos) \n// byte (radius in 10's) \n// byte byte byte (color)\n// byte (life in 10's)\n// byte (decay rate in 10's)\n\n#define TE_ELIGHT\t\t\t28\t// point entity light, no world effect\n// short (entity:attachment to follow)\n// coord coord coord (initial position) \n// coord (radius)\n// byte byte byte (color)\n// byte (life in 0.1's)\n// coord (decay rate)\n\n#define TE_TEXTMESSAGE\t\t29\n// short 1.2.13 x (-1 = center)\n// short 1.2.13 y (-1 = center)\n// byte Effect 0 = fade in/fade out\n// 1 is flickery credits\n// 2 is write out (training room)\n// 4 bytes r,g,b,a color1\t(text color)\n// 4 bytes r,g,b,a color2\t(effect color)\n// ushort 8.8 fadein time\n// ushort 8.8  fadeout time\n// ushort 8.8 hold time\n// optional ushort 8.8 fxtime\t(time the highlight lags behing the leading text in effect 2)\n// string text message\t\t(512 chars max sz string)\n#define TE_LINE\t\t\t30\n// coord, coord, coord\tstartpos\n// coord, coord, coord\tendpos\n// short life in 0.1 s\n// 3 bytes r, g, b\n\n#define TE_BOX\t\t\t31\n// coord, coord, coord\tboxmins\n// coord, coord, coord\tboxmaxs\n// short life in 0.1 s\n// 3 bytes r, g, b\n\n#define TE_KILLBEAM\t\t\t99\t// kill all beams attached to entity\n// short (entity)\n\n#define TE_LARGEFUNNEL\t\t100\n// coord coord coord (funnel position)\n// short (sprite index) \n// short (flags) \n\n#define\tTE_BLOODSTREAM\t\t101\t// particle spray\n// coord coord coord (start position)\n// coord coord coord (spray vector)\n// byte (color)\n// byte (speed)\n\n#define\tTE_SHOWLINE\t\t102\t// line of particles every 5 units, dies in 30 seconds\n// coord coord coord (start position)\n// coord coord coord (end position)\n\n#define TE_BLOOD\t\t\t103\t// particle spray\n// coord coord coord (start position)\n// coord coord coord (spray vector)\n// byte (color)\n// byte (speed)\n\n#define TE_DECAL\t\t\t104\t// Decal applied to a brush entity (not the world)\n// coord, coord, coord (x,y,z), decal position (center of texture in world)\n// byte (texture index of precached decal texture name)\n// short (entity index)\n\n#define TE_FIZZ\t\t\t105\t// create alpha sprites inside of entity, float upwards\n// short (entity)\n// short (sprite index)\n// byte (density)\n\n#define TE_MODEL\t\t\t106\t// create a moving model that bounces and makes a sound when it hits\n// coord, coord, coord (position) \n// coord, coord, coord (velocity)\n// angle (initial yaw)\n// short (model index)\n// byte (bounce sound type)\n// byte (life in 0.1's)\n\n#define TE_EXPLODEMODEL\t\t107\t// spherical shower of models, picks from set\n// coord, coord, coord (origin)\n// coord (velocity)\n// short (model index)\n// short (count)\n// byte (life in 0.1's)\n\n#define TE_BREAKMODEL\t\t108\t// box of models or sprites\n// coord, coord, coord (position)\n// coord, coord, coord (size)\n// coord, coord, coord (velocity)\n// byte (random velocity in 10's)\n// short (sprite or model index)\n// byte (count)\n// byte (life in 0.1 secs)\n// byte (flags)\n\n#define TE_GUNSHOTDECAL\t\t109\t// decal and ricochet sound\n// coord, coord, coord (position)\n// short (entity index???)\n// byte (decal???)\n\n#define TE_SPRITE_SPRAY\t\t110\t// spay of alpha sprites\n// coord, coord, coord (position)\n// coord, coord, coord (velocity)\n// short (sprite index)\n// byte (count)\n// byte (speed)\n// byte (noise)\n\n#define TE_ARMOR_RICOCHET\t\t111\t// quick spark sprite, client ricochet sound. \n// coord, coord, coord (position)\n// byte (scale in 0.1's)\n\n#define TE_PLAYERDECAL\t\t112\t// ???\n// byte (playerindex)\n// coord, coord, coord (position)\n// short (entity???)\n// byte (decal number???)\n// [optional] short (model index???)\n\n#define TE_BUBBLES\t\t\t113\t// create alpha sprites inside of box, float upwards\n// coord, coord, coord (min start position)\n// coord, coord, coord (max start position)\n// coord (float height)\n// short (model index)\n// byte (count)\n// coord (speed)\n\n#define TE_BUBBLETRAIL\t\t114\t// create alpha sprites along a line, float upwards\n// coord, coord, coord (min start position)\n// coord, coord, coord (max start position)\n// coord (float height)\n// short (model index)\n// byte (count)\n// coord (speed)\n\n#define TE_BLOODSPRITE\t\t115\t// spray of opaque sprite1's that fall, single sprite2 for 1..2 secs (this is a high-priority tent)\n// coord, coord, coord (position)\n// short (sprite1 index)\n// short (sprite2 index)\n// byte (color)\n// byte (scale)\n\n#define TE_WORLDDECAL\t\t116\t// Decal applied to the world brush\n// coord, coord, coord (x,y,z), decal position (center of texture in world)\n// byte (texture index of precached decal texture name)\n\n#define TE_WORLDDECALHIGH\t\t117\t// Decal (with texture index > 256) applied to world brush\n// coord, coord, coord (x,y,z), decal position (center of texture in world)\n// byte (texture index of precached decal texture name - 256)\n\n#define TE_DECALHIGH\t\t118\t// Same as TE_DECAL, but the texture index was greater than 256\n// coord, coord, coord (x,y,z), decal position (center of texture in world)\n// byte (texture index of precached decal texture name - 256)\n// short (entity index)\n\n#define TE_PROJECTILE\t\t119\t// Makes a projectile (like a nail) (this is a high-priority tent)\n// coord, coord, coord (position)\n// coord, coord, coord (velocity)\n// short (modelindex)\n// byte (life)\n// byte (owner)  projectile won't collide with owner (if owner == 0, projectile will hit any client).\n\n#define TE_SPRAY\t\t\t120\t// Throws a shower of sprites or models\n// coord, coord, coord (position)\n// coord, coord, coord (direction)\n// short (modelindex)\n// byte (count)\n// byte (speed)\n// byte (noise)\n// byte (rendermode)\n\n#define TE_PLAYERSPRITES\t\t121\t// sprites emit from a player's bounding box (ONLY use for players!)\n// byte (playernum)\n// short (sprite modelindex)\n// byte (count)\n// byte (variance) (0 = no variance in size) (10 = 10% variance in size)\n\n#define TE_PARTICLEBURST\t\t122\t// very similar to lavasplash.\n// coord (origin)\n// short (radius)\n// byte (particle color)\n// byte (duration * 10) (will be randomized a bit)\n\n#define TE_FIREFIELD\t\t123\t// makes a field of fire.\n// coord (origin)\n// short (radius) (fire is made in a square around origin. -radius, -radius to radius, radius)\n// short (modelindex)\n// byte (count)\n// byte (flags)\n// byte (duration (in seconds) * 10) (will be randomized a bit)\n//\n// to keep network traffic low, this message has associated flags that fit into a byte:\n#define TEFIRE_FLAG_ALLFLOAT\t1 // all sprites will drift upwards as they animate\n#define TEFIRE_FLAG_SOMEFLOAT\t2 // some of the sprites will drift upwards. (50% chance)\n#define TEFIRE_FLAG_LOOP\t4 // if set, sprite plays at 15 fps, otherwise plays at whatever rate stretches the animation over the sprite's duration.\n#define TEFIRE_FLAG_ALPHA\t8 // if set, sprite is rendered alpha blended at 50% else, opaque\n#define TEFIRE_FLAG_PLANAR\t16 // if set, all fire sprites have same initial Z instead of randomly filling a cube. \n\n#define TE_PLAYERATTACHMENT\t\t124\t// attaches a TENT to a player (this is a high-priority tent)\n// byte (entity index of player)\n// coord (vertical offset) ( attachment origin.z = player origin.z + vertical offset )\n// short (model index)\n// short (life * 10 );\n\n#define TE_KILLPLAYERATTACHMENTS\t125\t// will expire all TENTS attached to a player.\n// byte (entity index of player)\n\n#define TE_MULTIGUNSHOT\t\t126\t// much more compact shotgun message\n// This message is used to make a client approximate a 'spray' of gunfire.\n// Any weapon that fires more than one bullet per frame and fires in a bit of a spread is\n// a good candidate for MULTIGUNSHOT use. (shotguns)\n//\n// NOTE: This effect makes the client do traces for each bullet, these client traces ignore\n// entities that have studio models.Traces are 4096 long.\n//\n// coord (origin)\n// coord (origin)\n// coord (origin)\n// coord (direction)\n// coord (direction)\n// coord (direction)\n// coord (x noise * 100)\n// coord (y noise * 100)\n// byte (count)\n// byte (bullethole decal texture index)\n\n#define TE_USERTRACER\t\t127\t// larger message than the standard tracer, but allows some customization.\n// coord (origin)\n// coord (origin)\n// coord (origin)\n// coord (velocity)\n// coord (velocity)\n// coord (velocity)\n// byte ( life * 10 )\n// byte ( color ) this is an index into an array of color vectors in the engine. (0 - )\n// byte ( length * 10 )\n\n#define MSG_BROADCAST\t\t0\t// unreliable to all\n#define MSG_ONE\t\t\t1\t// reliable to one (msg_entity)\n#define MSG_ALL\t\t\t2\t// reliable to all\n#define MSG_INIT\t\t\t3\t// write to the init string\n#define MSG_PVS\t\t\t4\t// Ents in PVS of org\n#define MSG_PAS\t\t\t5\t// Ents in PAS of org\n#define MSG_PVS_R\t\t\t6\t// Reliable to PVS\n#define MSG_PAS_R\t\t\t7\t// Reliable to PAS\n#define MSG_ONE_UNRELIABLE\t\t8\t// Send to one client, but don't put in reliable stream, put in unreliable datagram ( could be dropped )\n#define MSG_SPEC\t\t\t9\t// Sends to all spectator proxies\n\n// contents of a spot in the world\n#define CONTENTS_EMPTY\t\t-1\n#define CONTENTS_SOLID\t\t-2\n#define CONTENTS_WATER\t\t-3\n#define CONTENTS_SLIME\t\t-4\n#define CONTENTS_LAVA\t\t-5\n#define CONTENTS_SKY\t\t-6\n// These additional contents constants are defined in bspfile.h\n#define CONTENTS_ORIGIN\t\t-7\t// removed at csg time\n#define CONTENTS_CLIP\t\t-8\t// changed to contents_solid\n#define CONTENTS_CURRENT_0\t\t-9\n#define CONTENTS_CURRENT_90\t\t-10\n#define CONTENTS_CURRENT_180\t\t-11\n#define CONTENTS_CURRENT_270\t\t-12\n#define CONTENTS_CURRENT_UP\t\t-13\n#define CONTENTS_CURRENT_DOWN\t\t-14\n#define CONTENTS_TRANSLUCENT\t\t-15\n\n#define CONTENTS_LADDER\t\t-16\n\n#define CONTENT_FLYFIELD\t\t-17\n#define CONTENT_GRAVITY_FLYFIELD\t-18\n#define CONTENT_FOG\t\t\t-19\n\n#define CONTENT_EMPTY\t\t-1\n#define CONTENT_SOLID\t\t-2\n#define CONTENT_WATER\t\t-3\n#define CONTENT_SLIME\t\t-4\n#define CONTENT_LAVA\t\t-5\n#define CONTENT_SKY\t\t\t-6\n\n// channels\n#define CHAN_AUTO\t\t\t0\n#define CHAN_WEAPON\t\t\t1\n#define CHAN_VOICE\t\t\t2\n#define CHAN_ITEM\t\t\t3\n#define CHAN_BODY\t\t\t4\n#define CHAN_STREAM\t\t\t5\t// allocate stream channel from the static or dynamic area\n#define CHAN_STATIC\t\t\t6\t// allocate channel from the static area \n#define CHAN_NETWORKVOICE_BASE\t7\t// voice data coming across the network\n#define CHAN_NETWORKVOICE_END\t\t500\t// network voice data reserves slots (CHAN_NETWORKVOICE_BASE through CHAN_NETWORKVOICE_END).\n\n// attenuation values\n#define ATTN_NONE\t\t\t0\n#define ATTN_NORM\t\t\t(float)0.8\n#define ATTN_IDLE\t\t\t(float)2\n#define ATTN_STATIC\t\t\t(float)1.25 \n\n// pitch values\n#define PITCH_NORM\t\t\t100\t// non-pitch shifted\n#define PITCH_LOW\t\t\t95\t// other values are possible - 0-255, where 255 is very high\n#define PITCH_HIGH\t\t\t120\n\n// volume values\n#define VOL_NORM\t\t\t1.0\n\n// plats\n#define PLAT_LOW_TRIGGER\t\t1\n\n// Trains\n#define SF_TRAIN_WAIT_RETRIGGER\t1\n#define SF_TRAIN_START_ON\t\t4\t// Train is initially moving\n#define SF_TRAIN_PASSABLE\t\t8\t// Train is not solid -- used to make water trains\n\n// buttons\n#define IN_ATTACK\t\t\t(1<<0)\n#define IN_JUMP\t\t\t(1<<1)\n#define IN_DUCK\t\t\t(1<<2)\n#define IN_FORWARD\t\t\t(1<<3)\n#define IN_BACK\t\t\t(1<<4)\n#define IN_USE\t\t\t(1<<5)\n#define IN_CANCEL\t\t\t(1<<6)\n#define IN_LEFT\t\t\t(1<<7)\n#define IN_RIGHT\t\t\t(1<<8)\n#define IN_MOVELEFT\t\t\t(1<<9)\n#define IN_MOVERIGHT\t\t(1<<10)\n#define IN_ATTACK2\t\t\t(1<<11)\n#define IN_RUN\t\t\t(1<<12)\n#define IN_RELOAD\t\t\t(1<<13)\n#define IN_ALT1\t\t\t(1<<14)\n#define IN_SCORE\t\t\t(1<<15)   // Used by client.dll for when scoreboard is held down\n\n// Break Model Defines\n#define BREAK_TYPEMASK\t\t0x4F\n#define BREAK_GLASS\t\t\t0x01\n#define BREAK_METAL\t\t\t0x02\n#define BREAK_FLESH\t\t\t0x04\n#define BREAK_WOOD\t\t\t0x08\n#define BREAK_SMOKE\t\t\t0x10\n#define BREAK_TRANS\t\t\t0x20\n#define BREAK_CONCRETE\t\t0x40\n#define BREAK_2\t\t\t0x80\n\n// Colliding temp entity sounds\n#define BOUNCE_GLASS\t\tBREAK_GLASS\n#define BOUNCE_METAL\t\tBREAK_METAL\n#define BOUNCE_FLESH\t\tBREAK_FLESH\n#define BOUNCE_WOOD\t\t\tBREAK_WOOD\n#define BOUNCE_SHRAP\t\t0x10\n#define BOUNCE_SHELL\t\t0x20\n#define BOUNCE_CONCRETE\t\tBREAK_CONCRETE\n#define BOUNCE_SHOTSHELL\t\t0x80\n\n// Temp entity bounce sound types\n#define TE_BOUNCE_NULL\t\t0\n#define TE_BOUNCE_SHELL\t\t1\n#define TE_BOUNCE_SHOTSHELL\t\t2\n\n// Rendering constants\nenum \n{\t\n\tkRenderNormal,\t\t// src\n\tkRenderTransColor,\t\t// c*a+dest*(1-a)\n\tkRenderTransTexture,\t// src*a+dest*(1-a)\n\tkRenderGlow,\t\t// src*a+dest -- No Z buffer checks\n\tkRenderTransAlpha,\t\t// src*srca+dest*(1-srca)\n\tkRenderTransAdd,\t\t// src*a+dest\n\tkRenderWorldGlow\t\t// Same as kRenderGlow but not fixed size in screen space\n};\n\nenum \n{\t\n\tkRenderFxNone = 0, \n\tkRenderFxPulseSlow, \n\tkRenderFxPulseFast, \n\tkRenderFxPulseSlowWide, \n\tkRenderFxPulseFastWide, \n\tkRenderFxFadeSlow, \n\tkRenderFxFadeFast, \n\tkRenderFxSolidSlow, \n\tkRenderFxSolidFast, \t   \n\tkRenderFxStrobeSlow, \n\tkRenderFxStrobeFast, \n\tkRenderFxStrobeFaster, \n\tkRenderFxFlickerSlow, \n\tkRenderFxFlickerFast,\n\tkRenderFxNoDissipation,\n\tkRenderFxDistort,\t\t\t// Distort/scale/translate flicker\n\tkRenderFxHologram,\t\t\t// kRenderFxDistort + distance fade\n\tkRenderFxDeadPlayer,\t\t// kRenderAmt is the player index\n\tkRenderFxExplode,\t\t\t// Scale up really big!\n\tkRenderFxGlowShell,\t\t\t// Glowing Shell\n\tkRenderFxClampMinScale\t\t// Keep this sprite from getting very small (SPRITES only!)\n};\n\ntypedef int\t\tfunc_t;\ntypedef int\t\tstring_t;\n\ntypedef unsigned char\tbyte;\ntypedef unsigned short\tword;\n\n#undef true\n#undef false\n\n#ifndef __cplusplus\ntypedef enum { false, true }\tqboolean;\n#else \ntypedef int qboolean;\n#endif\n\ntypedef struct\n{\n\tbyte\tr, g, b;\n} color24;\n\ntypedef struct\n{\n\tunsigned\tr, g, b, a;\n} colorVec;\n\ntypedef struct link_s\n{\n\tstruct link_s\t*prev, *next;\n} link_t;\n\ntypedef struct edict_s edict_t;\n\ntypedef struct\n{\n\tvec3_t\tnormal;\n\tfloat\tdist;\n} plane_t;\n\ntypedef struct\n{\n\tqboolean\tallsolid;\t\t// if true, plane is not valid\n\tqboolean\tstartsolid;\t// if true, the initial point was in a solid area\n\tqboolean\tinopen, inwater;\n\tfloat\tfraction;\t\t// time completed, 1.0 = didn't hit anything\n\tvec3_t\tendpos;\t\t// final position\n\tplane_t\tplane;\t\t// surface normal at impact\n\tedict_t\t*ent;\t\t// entity the surface is on\n\tint\thitgroup;\t\t// 0 == generic, non zero is specific body part\n} trace_t;\n\n#endif//CONST_H\n"
  },
  {
    "path": "common/crc.h",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\t\n*\tThis product contains software technology licensed from Id \n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc. \n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n/* crc.h */\n#ifndef CRC_H\n#define CRC_H\n#ifdef _WIN32\n#ifndef __MINGW32__\n#pragma once\n#endif /* not __MINGW32__ */\n#endif\n\n// MD5 Hash\ntypedef struct\n{\n\tunsigned int buf[4];\n    unsigned int bits[2];\n    unsigned char in[64];\n} MD5Context_t;\n\n\ntypedef unsigned long CRC32_t;\nvoid CRC32_Init(CRC32_t *pulCRC);\nCRC32_t CRC32_Final(CRC32_t pulCRC);\nvoid CRC32_ProcessBuffer(CRC32_t *pulCRC, void *p, int len);\nvoid CRC32_ProcessByte(CRC32_t *pulCRC, unsigned char ch);\nint CRC_File(CRC32_t *crcvalue, char *pszFileName);\n\nunsigned char COM_BlockSequenceCRCByte (unsigned char *base, int length, int sequence);\n\nvoid MD5Init(MD5Context_t *context);\nvoid MD5Update(MD5Context_t *context, unsigned char const *buf,\n               unsigned int len);\nvoid MD5Final(unsigned char digest[16], MD5Context_t *context);\nvoid Transform(unsigned int buf[4], unsigned int const in[16]);\n\nint MD5_Hash_File(unsigned char digest[16], char *pszFileName, int bUsefopen, int bSeed, unsigned int seed[4]);\nchar *MD5_Print(unsigned char hash[16]);\nint MD5_Hash_CachedFile(unsigned char digest[16], unsigned char *pCache, int nFileSize, int bSeed, unsigned int seed[4]);\n\nint CRC_MapFile(CRC32_t *crcvalue, char *pszFileName);\n\n#endif\n"
  },
  {
    "path": "common/cvardef.h",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\t\n*\tThis product contains software technology licensed from Id \n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc. \n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n#ifndef CVARDEF_H\n#define CVARDEF_H\n\n#define\tFCVAR_ARCHIVE\t\t(1<<0)\t// set to cause it to be saved to vars.rc\n#define\tFCVAR_USERINFO\t\t(1<<1)\t// changes the client's info string\n#define\tFCVAR_SERVER\t\t(1<<2)\t// notifies players when changed\n#define FCVAR_EXTDLL\t\t(1<<3)\t// defined by external DLL\n#define FCVAR_CLIENTDLL     (1<<4)  // defined by the client dll\n#define FCVAR_PROTECTED     (1<<5)  // It's a server cvar, but we don't send the data since it's a password, etc.  Sends 1 if it's not bland/zero, 0 otherwise as value\n#define FCVAR_SPONLY        (1<<6)  // This cvar cannot be changed by clients connected to a multiplayer server.\n#define FCVAR_PRINTABLEONLY (1<<7)  // This cvar's string cannot contain unprintable characters ( e.g., used for player name etc ).\n#define FCVAR_UNLOGGED\t\t(1<<8)  // If this is a FCVAR_SERVER, don't log changes to the log file / console if we are creating a log\n\ntypedef struct cvar_s\n{\n\tconst char\t*name;\n\tconst char\t*string;\n\tint\t\tflags;\n\tfloat\tvalue;\n\tstruct cvar_s *next;\n} cvar_t;\n\n\ntypedef int qboolean;\n\n// WARNING: Private structure from Xash3D Engine. Use with caution\ntypedef struct convar_s\n{\n\t// this part shared with cvar_t\n\tchar\t\t*name;\n\tchar\t\t*string;\n\tint\t\tflags;\n\tfloat\t\tvalue;\n\tstruct convar_s\t*next;\n\n\t// this part unique for convar_t\n\tint\t\tinteger;\t\t// atoi( string )\n\tqboolean\t\tmodified;\t\t// set each time the cvar is changed\n\tchar\t\t*reset_string;\t// cvar_restart will reset to this value\n\tchar\t\t*latched_string;\t// for CVAR_LATCH vars\n\tchar\t\t*description;\t// variable descrition info\n} convar_t;\n#endif\n"
  },
  {
    "path": "common/demo_api.h",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\t\n*\tThis product contains software technology licensed from Id \n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc. \n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n#if !defined ( DEMO_APIH )\n#define DEMO_APIH\n#ifdef _WIN32\n#ifndef __MINGW32__\n#pragma once\n#endif /* not __MINGW32__ */\n#endif\n\ntypedef struct demo_api_s\n{\n\tint\t\t( *IsRecording )\t( void );\n\tint\t\t( *IsPlayingback )\t( void );\n\tint\t\t( *IsTimeDemo )\t\t( void );\n\tvoid\t( *WriteBuffer )\t( int size, unsigned char *buffer );\n} demo_api_t;\n\nextern demo_api_t demoapi;\n\n#endif\n"
  },
  {
    "path": "common/director_cmds.h",
    "content": "//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============\n//\n// Purpose: \n//\n// $NoKeywords: $\n//=============================================================================\n\n// director_cmds.h\n// sub commands for svc_director\n\n#define DRC_ACTIVE\t\t\t\t0\t// tells client that he's an spectator and will get director command\n#define DRC_STATUS\t\t\t\t1\t// send status infos about proxy \n#define DRC_CAMERA\t\t\t\t2\t// set the actual director camera position\n#define DRC_EVENT\t\t\t\t3\t// informs the dircetor about ann important game event\n\n\n#define DRC_FLAG_PRIO_MASK\t\t0x0F\t//\tpriorities between 0 and 15 (15 most important)\n#define DRC_FLAG_SIDE\t\t\t(1<<4)\t\n#define DRC_FLAG_DRAMATIC\t\t(1<<5)\n\n\n\n// commands of the director API function CallDirectorProc(...)\n\n#define DRCAPI_NOP\t\t\t\t\t0\t// no operation\n#define DRCAPI_ACTIVE\t\t\t\t1\t// de/acivates director mode in engine\n#define DRCAPI_STATUS\t\t\t\t2   // request proxy information\n#define DRCAPI_SETCAM\t\t\t\t3\t// set camera n to given position and angle\n#define DRCAPI_GETCAM\t\t\t\t4\t// request camera n position and angle\n#define DRCAPI_DIRPLAY\t\t\t\t5\t// set director time and play with normal speed\n#define DRCAPI_DIRFREEZE\t\t\t6\t// freeze directo at this time\n#define DRCAPI_SETVIEWMODE\t\t\t7\t// overview or 4 cameras \n#define DRCAPI_SETOVERVIEWPARAMS\t8\t// sets parameter for overview mode\n#define DRCAPI_SETFOCUS\t\t\t\t9\t// set the camera which has the input focus\n#define DRCAPI_GETTARGETS\t\t\t10\t// queries engine for player list\n#define DRCAPI_SETVIEWPOINTS\t\t11\t// gives engine all waypoints\n\n\n"
  },
  {
    "path": "common/dlight.h",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\t\n*\tThis product contains software technology licensed from Id \n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc. \n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n#if !defined ( DLIGHTH )\n#define DLIGHTH\n#ifdef _WIN32\n#ifndef __MINGW32__\n#pragma once\n#endif /* not __MINGW32__ */\n#endif\n\ntypedef struct dlight_s\n{\n\tvec3_t\torigin;\n\tfloat\tradius;\n\tcolor24\tcolor;\n\tfloat\tdie;\t\t\t\t// stop lighting after this time\n\tfloat\tdecay;\t\t\t\t// drop this each second\n\tfloat\tminlight;\t\t\t// don't add when contributing less\n\tint\t\tkey;\n\tqboolean\tdark;\t\t\t// subtracts light instead of adding\n} dlight_t;\n\n#endif\n"
  },
  {
    "path": "common/dll_state.h",
    "content": "//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============\n//\n// Purpose: \n//\n// $NoKeywords: $\n//=============================================================================\n\n//DLL State Flags\n\n#define DLL_INACTIVE 0\t\t// no dll\n#define DLL_ACTIVE   1\t\t// dll is running\n#define DLL_PAUSED   2\t\t// dll is paused\n#define DLL_CLOSE    3\t\t// closing down dll\n#define DLL_TRANS    4 \t\t// Level Transition\n\n// DLL Pause reasons\n\n#define DLL_NORMAL        0   // User hit Esc or something.\n#define DLL_QUIT          4   // Quit now\n#define DLL_RESTART       6   // Switch to launcher for linux, does a quit but returns 1\n\n// DLL Substate info ( not relevant )\n#define ENG_NORMAL         (1<<0)\n"
  },
  {
    "path": "common/engine_launcher_api.h",
    "content": "//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============\n//\n// Purpose: \n//\n// $NoKeywords: $\n//=============================================================================\n\n// engine/launcher interface\n#if !defined( ENGINE_LAUNCHER_APIH )\n#define ENGINE_LAUNCHER_APIH\n#ifdef _WIN32\n#ifndef __MINGW32__\n#pragma once\n#endif /* not __MINGW32__ */\n#endif\n\n//typedef void ( *xcommand_t ) ( void );\n\n#define RENDERTYPE_UNDEFINED\t0\n#define RENDERTYPE_SOFTWARE\t\t1\n#define RENDERTYPE_HARDWARE\t\t2\n\n#define ENGINE_LAUNCHER_API_VERSION 1\n\ntypedef struct engine_api_s\n{\n\tint\t\tversion;\n\tint\t\trendertype;\n\tint\t\tsize;\n\n\t// Functions\n\tint\t\t( *GetEngineState )\t\t\t\t( void );\n\tvoid\t( *Cbuf_AddText )\t\t\t\t( char *text ); // append cmd at end of buf\n\tvoid\t( *Cbuf_InsertText )\t\t\t( char *text ); // insert cmd at start of buf\n\tvoid\t( *Cmd_AddCommand )\t\t\t\t( char *cmd_name, void ( *funcname )( void ) );\n\tint\t\t( *Cmd_Argc )\t\t\t\t\t( void );\n\tchar\t*( *Cmd_Args )\t\t\t\t\t( void );\n\tchar\t*( *Cmd_Argv )\t\t\t\t\t( int arg );\n\tvoid\t( *Con_Printf )\t\t\t\t\t( char *, ... );\n\tvoid\t( *Con_SafePrintf )\t\t\t\t( char *, ... );\n\tvoid\t( *Cvar_Set )\t\t\t\t\t( char *var_name, char *value );\n\tvoid\t( *Cvar_SetValue )\t\t\t\t( char *var_name, float value );\n\tint\t\t( *Cvar_VariableInt )\t\t\t( char *var_name );\n\tchar\t*( *Cvar_VariableString )\t\t( char *var_name );\n\tfloat\t( *Cvar_VariableValue )\t\t\t( char *var_name );\n\tvoid\t( *ForceReloadProfile )\t\t\t( void );\n\tint\t\t( *GetGameInfo )\t\t\t\t( struct GameInfo_s *pGI, char *pszChannel );\n\tvoid\t( *GameSetBackground )\t\t\t( int bBack );\n\tvoid\t( *GameSetState )\t\t\t\t( int iState );\n\tvoid\t( *GameSetSubState )\t\t\t( int iState );\n\tint\t\t( *GetPauseState )\t\t\t\t( void );\n\tint\t\t( *Host_Frame )\t\t\t\t\t( float time, int iState, int *stateInfo );\n\tvoid\t( *Host_GetHostInfo )\t\t\t( float *fps, int *nActive, int *nSpectators, int *nMaxPlayers, char *pszMap );\n\tvoid\t( *Host_Shutdown )\t\t\t\t( void );\n\tint\t\t( *Game_Init )\t\t\t\t\t( char *lpCmdLine, unsigned char *pMem, int iSize, struct exefuncs_s *pef, void *, int );\n\tvoid\t( *IN_ActivateMouse )\t\t\t( void );\n\tvoid\t( *IN_ClearStates )\t\t\t\t( void );\n\tvoid\t( *IN_DeactivateMouse )\t\t\t( void );\n\tvoid\t( *IN_MouseEvent )\t\t\t\t( int mstate );\n\tvoid\t( *Keyboard_ReturnToGame )\t\t( void );\n\tvoid\t( *Key_ClearStates )\t\t\t( void );\n\tvoid\t( *Key_Event )\t\t\t\t\t( int key, int down );\n\tint\t\t( *LoadGame )\t\t\t\t\t( const char *pszSlot );\n\tvoid\t( *S_BlockSound )\t\t\t\t( void );\n\tvoid\t( *S_ClearBuffer )\t\t\t\t( void );\n\tvoid\t( *S_GetDSPointer )\t\t\t\t( struct IDirectSound **lpDS, struct IDirectSoundBuffer **lpDSBuf );\n\tvoid \t*( *S_GetWAVPointer )\t\t\t( void );\n\tvoid\t( *S_UnblockSound )\t\t\t\t( void );\n\tint\t\t( *SaveGame )\t\t\t\t\t( const char *pszSlot, const char *pszComment );\n\tvoid\t( *SetAuth )\t\t\t\t\t( void *pobj );\n\tvoid\t( *SetMessagePumpDisableMode )\t( int bMode );\n\tvoid\t( *SetPauseState )\t\t\t\t( int bPause );\n\tvoid\t( *SetStartupMode )\t\t\t\t( int bMode );\n\tvoid\t( *SNDDMA_Shutdown )\t\t\t( void );\n\tvoid\t( *Snd_AcquireBuffer )\t\t\t( void );\n\tvoid\t( *Snd_ReleaseBuffer )\t\t\t( void );\n\tvoid\t( *StoreProfile )\t\t\t\t( void );\n\tdouble\t( *Sys_FloatTime )\t\t\t\t( void );\n\tvoid\t( *VID_UpdateWindowVars )\t\t( void *prc, int x, int y );\n\tvoid\t( *VID_UpdateVID )\t\t\t\t( struct viddef_s *pvid );\n\n\t// VGUI interfaces\n\tvoid\t( *VGui_CallEngineSurfaceProc )\t( void* hwnd, unsigned int msg, unsigned int wparam, long lparam );\n\n\t// notifications that the launcher is taking/giving focus to the engine\n\tvoid    ( *EngineTakingFocus )\t\t\t( void );\n\tvoid    ( *LauncherTakingFocus )\t\t( void );\n\n#ifdef _WIN32\n\t// Only filled in by rendertype RENDERTYPE_HARDWARE\n\tvoid\t( *GL_Init )\t\t\t\t\t( void );\n\tint\t\t( *GL_SetMode )\t\t\t\t\t( HWND hwndGame, HDC *pmaindc, HGLRC *pbaseRC, int fD3D, const char *p, const char *pszCmdLine );\n\tvoid\t( *GL_Shutdown )\t\t\t\t( HWND hwnd, HDC hdc, HGLRC hglrc );\n\n\tvoid\t( *QGL_D3DShared )\t\t\t\t( struct tagD3DGlobals *d3dGShared );\n\n\tint\t\t( WINAPI *glSwapBuffers )\t\t( HDC dc );\n\tvoid\t( *DirectorProc ) ( unsigned int cmd, void * params );\n#else\n\t// NOT USED IN LINUX!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\tvoid\t( *GL_Init )\t\t\t\t\t( void );\n\tvoid\t( *GL_SetMode )\t\t\t\t\t( void );\n\tvoid\t( *GL_Shutdown )\t\t\t\t( void );\n\tvoid\t( *QGL_D3DShared )\t\t\t\t( void );\n\tvoid\t( *glSwapBuffers )\t\t\t\t( void );\n\tvoid\t( *DirectorProc )\t\t\t\t( void );\n\t// LINUX\n#endif\n\n} engine_api_t;\n\n#endif // ENGINE_LAUNCHER_APIH\n"
  },
  {
    "path": "common/entity_state.h",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\t\n*\tThis product contains software technology licensed from Id \n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc. \n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n#if !defined( ENTITY_STATEH )\n#define ENTITY_STATEH\n#ifdef _WIN32\n#ifndef __MINGW32__\n#pragma once\n#endif /* not __MINGW32__ */\n#endif\n\n// For entityType below\n#define ENTITY_NORMAL\t\t(1<<0)\n#define ENTITY_BEAM\t\t\t(1<<1)\n\n// Entity state is used for the baseline and for delta compression of a packet of \n//  entities that is sent to a client.\ntypedef struct entity_state_s entity_state_t;\n\nstruct entity_state_s\n{\n// Fields which are filled in by routines outside of delta compression\n\tint\t\t\tentityType;\n\t// Index into cl_entities array for this entity.\n\tint\t\t\tnumber;      \n\tfloat\t\tmsg_time;\n\n\t// Message number last time the player/entity state was updated.\n\tint\t\t\tmessagenum;\t\t\n\n\t// Fields which can be transitted and reconstructed over the network stream\n\tvec3_t\t\torigin;\n\tvec3_t\t\tangles;\n\n\tint\t\t\tmodelindex;\n\tint\t\t\tsequence;\n\tfloat\t\tframe;\n\tint\t\t\tcolormap;\n\tshort\t\tskin;\n\tshort\t\tsolid;\n\tint\t\t\teffects;\n\tfloat\t\tscale;\n\n\tbyte\t\teflags;\n\t\n\t// Render information\n\tint\t\t\trendermode;\n\tint\t\t\trenderamt;\n\tcolor24\t\trendercolor;\n\tint\t\t\trenderfx;\n\n\tint\t\t\tmovetype;\n\tfloat\t\tanimtime;\n\tfloat\t\tframerate;\n\tint\t\t\tbody;\n\tbyte\t\tcontroller[4];\n\tbyte\t\tblending[4];\n\tvec3_t\t\tvelocity;\n\n\t// Send bbox down to client for use during prediction.\n\tvec3_t\t\tmins;    \n\tvec3_t\t\tmaxs;\n\n\tint\t\t\taiment;\n\t// If owned by a player, the index of that player ( for projectiles ).\n\tint\t\t\towner; \n\n\t// Friction, for prediction.\n\tfloat\t\tfriction;       \n\t// Gravity multiplier\n\tfloat\t\tgravity;\t\t\n\n// PLAYER SPECIFIC\n\tint\t\t\tteam;\n\tint\t\t\tplayerclass;\n\tint\t\t\thealth;\n\tqboolean\tspectator;  \n\tint         weaponmodel;\n\tint\t\t\tgaitsequence;\n\t// If standing on conveyor, e.g.\n\tvec3_t\t\tbasevelocity;   \n\t// Use the crouched hull, or the regular player hull.\n\tint\t\t\tusehull;\t\t\n\t// Latched buttons last time state updated.\n\tint\t\t\toldbuttons;     \n\t// -1 = in air, else pmove entity number\n\tint\t\t\tonground;\t\t\n\tint\t\t\tiStepLeft;\n\t// How fast we are falling\n\tfloat\t\tflFallVelocity;  \n\n\tfloat\t\tfov;\n\tint\t\t\tweaponanim;\n\n\t// Parametric movement overrides\n\tvec3_t\t\t\t\tstartpos;\n\tvec3_t\t\t\t\tendpos;\n\tfloat\t\t\t\timpacttime;\n\tfloat\t\t\t\tstarttime;\n\n\t// For mods\n\tint\t\t\tiuser1;\n\tint\t\t\tiuser2;\n\tint\t\t\tiuser3;\n\tint\t\t\tiuser4;\n\tfloat\t\tfuser1;\n\tfloat\t\tfuser2;\n\tfloat\t\tfuser3;\n\tfloat\t\tfuser4;\n\tvec3_t\t\tvuser1;\n\tvec3_t\t\tvuser2;\n\tvec3_t\t\tvuser3;\n\tvec3_t\t\tvuser4;\n};\n\n#include \"pm_info.h\"\n\ntypedef struct clientdata_s\n{\n\tvec3_t\t\t\t\torigin;\n\tvec3_t\t\t\t\tvelocity;\n\n\tint\t\t\t\t\tviewmodel;\n\tvec3_t\t\t\t\tpunchangle;\n\tint\t\t\t\t\tflags;\n\tint\t\t\t\t\twaterlevel;\n\tint\t\t\t\t\twatertype;\n\tvec3_t\t\t\t\tview_ofs;\n\tfloat\t\t\t\thealth;\n\n\tint\t\t\t\t\tbInDuck;\n\n\tint\t\t\t\t\tweapons; // remove?\n\t\n\tint\t\t\t\t\tflTimeStepSound;\n\tint\t\t\t\t\tflDuckTime;\n\tint\t\t\t\t\tflSwimTime;\n\tint\t\t\t\t\twaterjumptime;\n\n\tfloat\t\t\t\tmaxspeed;\n\n\tfloat\t\t\t\tfov;\n\tint\t\t\t\t\tweaponanim;\n\n\tint\t\t\t\t\tm_iId;\n\tint\t\t\t\t\tammo_shells;\n\tint\t\t\t\t\tammo_nails;\n\tint\t\t\t\t\tammo_cells;\n\tint\t\t\t\t\tammo_rockets;\n\tfloat\t\t\t\tm_flNextAttack;\n\t\n\tint\t\t\t\t\ttfstate;\n\n\tint\t\t\t\t\tpushmsec;\n\n\tint\t\t\t\t\tdeadflag;\n\n\tchar\t\t\t\tphysinfo[ MAX_PHYSINFO_STRING ];\n\n\t// For mods\n\tint\t\t\t\t\tiuser1;\n\tint\t\t\t\t\tiuser2;\n\tint\t\t\t\t\tiuser3;\n\tint\t\t\t\t\tiuser4;\n\tfloat\t\t\t\tfuser1;\n\tfloat\t\t\t\tfuser2;\n\tfloat\t\t\t\tfuser3;\n\tfloat\t\t\t\tfuser4;\n\tvec3_t\t\t\t\tvuser1;\n\tvec3_t\t\t\t\tvuser2;\n\tvec3_t\t\t\t\tvuser3;\n\tvec3_t\t\t\t\tvuser4;\n} clientdata_t;\n\n#include \"weaponinfo.h\"\n\ntypedef struct local_state_s\n{\n\tentity_state_t playerstate;\n\tclientdata_t   client;\n\tweapon_data_t  weapondata[ 32 ];\n} local_state_t;\n\n#endif // !ENTITY_STATEH\n"
  },
  {
    "path": "common/entity_types.h",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\t\n*\tThis product contains software technology licensed from Id \n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc. \n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n// entity_types.h\n#if !defined( ENTITY_TYPESH )\n#define ENTITY_TYPESH\n\n#define ET_NORMAL\t\t0\n#define ET_PLAYER\t\t1\n#define ET_TEMPENTITY\t2\n#define ET_BEAM\t\t\t3\n// BMODEL or SPRITE that was split across BSP nodes\n#define ET_FRAGMENTED\t4\n\n#endif // !ENTITY_TYPESH\n"
  },
  {
    "path": "common/enums.h",
    "content": "/***\n *\n *\tCopyright (c) 2009, Valve LLC. All rights reserved.\n *\t\n *\tThis product contains software technology licensed from Id \n *\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc. \n *\tAll Rights Reserved.\n *\n *   Use, distribution, and modification of this source code and/or resulting\n *   object code is restricted to non-commercial enhancements to products from\n *   Valve LLC.  All other use, distribution, or modification is prohibited\n *   without written permission from Valve LLC.\n *\n ****/\n\n#ifndef ENUMS_H\n#define ENUMS_H\n\ntypedef enum netsrc_s\n\t{\n\t\tNS_CLIENT,\n\t\tNS_SERVER,\n\t\tNS_MULTICAST\t// xxxMO\n\t} netsrc_t;\n\t\n#endif\n\n"
  },
  {
    "path": "common/event_api.h",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\t\n*\tThis product contains software technology licensed from Id \n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc. \n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n#if !defined ( EVENT_APIH )\n#define EVENT_APIH\n#ifdef _WIN32\n#ifndef __MINGW32__\n#pragma once\n#endif /* not __MINGW32__ */\n#endif\n\n#define EVENT_API_VERSION 1\n\ntypedef struct event_api_s\n{\n\tint\t\tversion;\n\tvoid\t( *EV_PlaySound ) ( int ent, float *origin, int channel, const char *sample, float volume, float attenuation, int fFlags, int pitch );\n\tvoid\t( *EV_StopSound ) ( int ent, int channel, const char *sample );\n\tint\t\t( *EV_FindModelIndex )( const char *pmodel );\n\tint\t\t( *EV_IsLocal ) ( int playernum );\n\tint\t\t( *EV_LocalPlayerDucking ) ( void );\n\tvoid\t( *EV_LocalPlayerViewheight ) ( float * );\n\tvoid\t( *EV_LocalPlayerBounds ) ( int hull, float *mins, float *maxs );\n\tint\t\t( *EV_IndexFromTrace) ( struct pmtrace_s *pTrace );\n\tstruct physent_s *( *EV_GetPhysent ) ( int idx );\n\tvoid\t( *EV_SetUpPlayerPrediction ) ( int dopred, int bIncludeLocalClient );\n\tvoid\t( *EV_PushPMStates ) ( void );\n\tvoid\t( *EV_PopPMStates ) ( void );\n\tvoid\t( *EV_SetSolidPlayers ) (int playernum);\n\tvoid\t( *EV_SetTraceHull ) ( int hull );\n\tvoid\t( *EV_PlayerTrace ) ( float *start, float *end, int traceFlags, int ignore_pe, struct pmtrace_s *tr );\n\tvoid\t( *EV_WeaponAnimation ) ( int sequence, int body );\n\tunsigned short ( *EV_PrecacheEvent ) ( int type, const char* psz );\n\tvoid\t( *EV_PlaybackEvent ) ( int flags, const struct edict_s *pInvoker, unsigned short eventindex, float delay, float *origin, float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2 );\n\tconst char *( *EV_TraceTexture ) ( int ground, const float *vstart, const float *vend );\n\tvoid\t( *EV_StopAllSounds ) ( int entnum, int entchannel );\n\tvoid    ( *EV_KillEvents ) ( int entnum, const char *eventname );\n} event_api_t;\n\nextern event_api_t eventapi;\n\n#endif\n"
  },
  {
    "path": "common/event_args.h",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\t\n*\tThis product contains software technology licensed from Id \n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc. \n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n#if !defined( EVENT_ARGSH )\n#define EVENT_ARGSH\n#ifdef _WIN32\n#ifndef __MINGW32__\n#pragma once\n#endif /* not __MINGW32__ */\n#endif\n\n// Event was invoked with stated origin\n#define FEVENT_ORIGIN\t( 1<<0 )\n\n// Event was invoked with stated angles\n#define FEVENT_ANGLES\t( 1<<1 )\n\ntypedef struct event_args_s\n{\n\tint\t\tflags;\n\n\t// Transmitted\n\tint\t\tentindex;\n\n\tfloat\torigin[3];\n\tfloat\tangles[3];\n\tfloat\tvelocity[3];\n\n\tint\t\tducking;\n\n\tfloat\tfparam1;\n\tfloat\tfparam2;\n\n\tint\t\tiparam1;\n\tint\t\tiparam2;\n\n\tint\t\tbparam1;\n\tint\t\tbparam2;\n} event_args_t;\n\n#endif\n"
  },
  {
    "path": "common/event_flags.h",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\t\n*\tThis product contains software technology licensed from Id \n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc. \n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n#if !defined( EVENT_FLAGSH )\n#define EVENT_FLAGSH\n#ifdef _WIN32\n#ifndef __MINGW32__\n#pragma once\n#endif /* not __MINGW32__ */\n#endif\n\n// Skip local host for event send.\n#define FEV_NOTHOST\t\t(1<<0)    \n\n// Send the event reliably.  You must specify the origin and angles and use\n// PLAYBACK_EVENT_FULL for this to work correctly on the server for anything\n// that depends on the event origin/angles.  I.e., the origin/angles are not\n// taken from the invoking edict for reliable events.\n#define FEV_RELIABLE\t(1<<1)\t \n\n// Don't restrict to PAS/PVS, send this event to _everybody_ on the server ( useful for stopping CHAN_STATIC\n//  sounds started by client event when client is not in PVS anymore ( hwguy in TFC e.g. ).\n#define FEV_GLOBAL\t\t(1<<2)\n\n// If this client already has one of these events in its queue, just update the event instead of sending it as a duplicate\n//\n#define FEV_UPDATE\t\t(1<<3)\n\n// Only send to entity specified as the invoker\n#define\tFEV_HOSTONLY\t(1<<4)\n\n// Only send if the event was created on the server.\n#define FEV_SERVER\t\t(1<<5)\n\n// Only issue event client side ( from shared code )\n#define FEV_CLIENT\t\t(1<<6)\n\n#endif\n"
  },
  {
    "path": "common/exefuncs.h",
    "content": "//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============\n//\n// Purpose: \n//\n// $NoKeywords: $\n//=============================================================================\n\n// exefuncs.h\n#ifndef EXEFUNCS_H\n#define EXEFUNCS_H\n\n// Engine hands this to DLLs for functionality callbacks\ntypedef struct exefuncs_s\n{\n\tint\t\t\tfMMX;\n\tint\t\t\tiCPUMhz;\n\tvoid\t\t(*unused1)(void);\n\tvoid\t\t(*unused2)(void);\n\tvoid\t\t(*unused3)(void);\n\tvoid\t\t(*unused4)(void);\n\tvoid\t\t(*VID_ForceLockState)(int lk);\n\tint\t\t\t(*VID_ForceUnlockedAndReturnState)(void);\n\tvoid\t\t(*unused5)(void);\n\tvoid\t\t(*unused6)(void);\n\tvoid\t\t(*unused7)(void);\n\tvoid\t\t(*unused8)(void);\n\tvoid\t\t(*unused9)(void);\n\tvoid\t\t(*unused10)(void);\n\tvoid\t\t(*unused11)(void);\n\tvoid\t\t(*unused12)(void);\n\tvoid\t\t(*unused13)(void);\n\tvoid\t\t(*unused14)(void);\n\tvoid\t\t(*unused15)(void);\n\tvoid        (*ErrorMessage)(int nLevel, const char *pszErrorMessage);\n\tvoid\t\t(*unused16)(void);\n\tvoid        (*Sys_Printf)(char *fmt, ...);\n\tvoid\t\t(*unused17)(void);\n\tvoid\t\t(*unused18)(void);\n\tvoid\t\t(*unused19)(void);\n\tvoid\t\t(*unused20)(void);\n\tvoid\t\t(*unused21)(void);\n\tvoid\t\t(*unused22)(void);\n\tvoid\t\t(*unused23)(void);\n\tvoid\t\t(*unused24)(void);\n\tvoid\t\t(*unused25)(void);\n\tvoid\t\t(*unused26)(void);\n\tvoid\t\t(*unused27)(void);\n} exefuncs_t;\n\n#endif\n"
  },
  {
    "path": "common/gameinfo.h",
    "content": "/*\ngameinfo.h - current game info\nCopyright (C) 2010 Uncle Mike\n\nThis program is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\nGNU General Public License for more details.\n*/\n\n#ifndef GAMEINFO_H\n#define GAMEINFO_H\n\n#define GFL_NOMODELS\t(1<<0)\n#define GFL_NOSKILLS\t(1<<1)\n#define GFL_RENDER_PICBUTTON_TEXT   (1<<2)\n\n/*\n========================================================================\n\nGAMEINFO stuff\n\ninternal shared gameinfo structure (readonly for engine parts)\n========================================================================\n*/\ntypedef struct\n{\n\t// filesystem info\n\tchar\t\tgamefolder[64];\t// used for change game '-game x'\n\tchar\t\tstartmap[64];\t// map to start singleplayer game\n\tchar\t\ttrainmap[64];\t// map to start hazard course (if specified)\n\tchar\t\ttitle[64];\t// Game Main Title\n\tchar\t\tversion[14];\t// game version (optional)\n\tshort\t\tflags;\t\t// game flags\n\n\t// about mod info\n\tchar\t\tgame_url[256];\t// link to a developer's site\n\tchar\t\tupdate_url[256];\t// link to updates page\n\tchar\t\ttype[64];\t\t// single, toolkit, multiplayer etc\n\tchar\t\tdate[64];\n\tchar\t\tsize[64];\t\t// displayed mod size\n\n\tint\t\tgamemode;\n} GAMEINFO;\n\n#endif//GAMEINFO_H\n"
  },
  {
    "path": "common/hltv.h",
    "content": "//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============\n//\n// Purpose: \n//\n// $NoKeywords: $\n//=============================================================================\n\n// hltv.h\n// all shared consts between server, clients and proxy\n\n#ifndef HLTV_H\n#define HLTV_H\n\n#define TYPE_CLIENT\t\t\t\t0\t// client is a normal HL client (default)\n#define TYPE_PROXY\t\t\t\t1\t// client is another proxy\n#define TYPE_COMMENTATOR\t\t3\t// client is a commentator\n#define TYPE_DEMO\t\t\t\t4\t// client is a demo file\n// sub commands of svc_hltv:\n#define HLTV_ACTIVE\t\t\t\t0\t// tells client that he's an spectator and will get director commands\n#define HLTV_STATUS\t\t\t\t1\t// send status infos about proxy \n#define HLTV_LISTEN\t\t\t\t2\t// tell client to listen to a multicast stream\n\n// sub commands of svc_director:\n#define DRC_CMD_NONE\t\t\t\t0\t// NULL director command\n#define DRC_CMD_START\t\t\t\t1\t// start director mode\n#define DRC_CMD_EVENT\t\t\t\t2\t// informs about director command\n#define DRC_CMD_MODE\t\t\t\t3\t// switches camera modes\n#define DRC_CMD_CAMERA\t\t\t\t4\t// sets camera registers\n#define DRC_CMD_TIMESCALE\t\t\t5\t// sets time scale\n#define DRC_CMD_MESSAGE\t\t\t\t6\t// send HUD centerprint\n#define DRC_CMD_SOUND\t\t\t\t7\t// plays a particular sound\n#define DRC_CMD_STATUS\t\t\t\t8\t// status info about broadcast\n#define DRC_CMD_BANNER\t\t\t\t9\t// banner file name for HLTV gui\n#define\tDRC_CMD_FADE\t\t\t\t10\t// send screen fade command\n#define DRC_CMD_SHAKE\t\t\t\t11\t// send screen shake command\n#define DRC_CMD_STUFFTEXT\t\t\t12\t// like the normal svc_stufftext but as director command\n\n#define DRC_CMD_LAST\t\t\t\t12\n\n\n\n// HLTV_EVENT event flags\n#define DRC_FLAG_PRIO_MASK\t\t0x0F\t// priorities between 0 and 15 (15 most important)\n#define DRC_FLAG_SIDE\t\t\t(1<<4)\t// \n#define DRC_FLAG_DRAMATIC\t\t(1<<5)\t// is a dramatic scene\n#define DRC_FLAG_SLOWMOTION\t\t(1<<6)  // would look good in SloMo\n#define DRC_FLAG_FACEPLAYER\t\t(1<<7)  // player is doning something (reload/defuse bomb etc)\n#define DRC_FLAG_INTRO\t\t\t(1<<8)\t// is a introduction scene\n#define DRC_FLAG_FINAL\t\t\t(1<<9)\t// is a final scene\n#define DRC_FLAG_NO_RANDOM\t\t(1<<10)\t// don't randomize event data\n\n\n#define MAX_DIRECTOR_CMD_PARAMETERS\t\t4\n#define MAX_DIRECTOR_CMD_STRING\t\t\t128\n\n\n#endif // HLTV_H\n"
  },
  {
    "path": "common/in_buttons.h",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\t\n*\tThis product contains software technology licensed from Id \n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc. \n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n#ifndef IN_BUTTONS_H\n#define IN_BUTTONS_H\n#ifdef _WIN32\n#ifndef __MINGW32__\n#pragma once\n#endif /* not __MINGW32__ */\n#endif\n\n\n#ifndef CONST_H\n#define IN_ATTACK\t(1 << 0)\n#define IN_JUMP\t\t(1 << 1)\n#define IN_DUCK\t\t(1 << 2)\n#define IN_FORWARD\t(1 << 3)\n#define IN_BACK\t\t(1 << 4)\n#define IN_USE\t\t(1 << 5)\n#define IN_CANCEL\t(1 << 6)\n#define IN_LEFT\t\t(1 << 7)\n#define IN_RIGHT\t(1 << 8)\n#define IN_MOVELEFT\t(1 << 9)\n#define IN_MOVERIGHT (1 << 10)\n#define IN_ATTACK2\t(1 << 11)\n#define IN_RUN      (1 << 12)\n#define IN_RELOAD\t(1 << 13)\n#define IN_ALT1\t\t(1 << 14)\n#define IN_SCORE\t(1 << 15)   // Used by client.dll for when scoreboard is held down\n#endif\n\n#endif // IN_BUTTONS_H\n"
  },
  {
    "path": "common/interface.cpp",
    "content": "//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============\n//\n// Purpose: \n//\n// $NoKeywords: $\n//=============================================================================\n\n#include <string.h>\n#include <stdlib.h>\n#include <stdio.h>\n#include \"interface.h\"\n\n#if XASH_PSVITA == 1\n#include <unistd.h>\n#define VRTLD_LIBDL_COMPAT\n#include <vrtld.h>\n#elif XASH_APPLE == 1\n#include <dlfcn.h>\n#include <unistd.h>\n#endif\n\n#if !defined( _WIN32 )\n// Linux doesn't have this function so this emulates its functionality\n//\n//\nvoid *GetModuleHandle( const char *name )\n{\n\tvoid *handle;\n\n\tif ( name == NULL )\n\t{\n\t\t// hmm, how can this be handled under linux....\n\t\t// is it even needed?\n\t\treturn NULL;\n\t}\n\n\tif ( ( handle = dlopen( name, RTLD_NOW ) ) == NULL )\n\t{\n\t\t//printf(\"Error:%s\\n\",dlerror());\n\t\t// couldn't open this file\n\t\treturn NULL;\n\t}\n\n\t// read \"man dlopen\" for details\n\t// in short dlopen() inc a ref count\n\t// so dec the ref count by performing the close\n\tdlclose( handle );\n\treturn handle;\n}\n#endif\n\n// ------------------------------------------------------------------------------------ //\n// InterfaceReg.\n// ------------------------------------------------------------------------------------ //\nInterfaceReg *InterfaceReg::s_pInterfaceRegs = NULL;\n\nInterfaceReg::InterfaceReg( InstantiateInterfaceFn fn, const char *pName ) :\n    m_pName( pName )\n{\n\tm_CreateFn = fn;\n\tm_pNext = s_pInterfaceRegs;\n\ts_pInterfaceRegs = this;\n}\n\n// ------------------------------------------------------------------------------------ //\n// CreateInterface.\n// ------------------------------------------------------------------------------------ //\nEXPORT_FUNCTION IBaseInterface *CreateInterface( const char *pName, int *pReturnCode )\n{\n\tInterfaceReg *pCur;\n\n\tfor ( pCur = InterfaceReg::s_pInterfaceRegs; pCur; pCur = pCur->m_pNext )\n\t{\n\t\tif ( strcmp( pCur->m_pName, pName ) == 0 )\n\t\t{\n\t\t\tif ( pReturnCode )\n\t\t\t{\n\t\t\t\t*pReturnCode = IFACE_OK;\n\t\t\t}\n\t\t\treturn pCur->m_CreateFn();\n\t\t}\n\t}\n\n\tif ( pReturnCode )\n\t{\n\t\t*pReturnCode = IFACE_FAILED;\n\t}\n\treturn NULL;\n}\n\n#ifdef LINUX\nstatic IBaseInterface *CreateInterfaceLocal( const char *pName, int *pReturnCode )\n{\n\tInterfaceReg *pCur;\n\n\tfor ( pCur = InterfaceReg::s_pInterfaceRegs; pCur; pCur = pCur->m_pNext )\n\t{\n\t\tif ( strcmp( pCur->m_pName, pName ) == 0 )\n\t\t{\n\t\t\tif ( pReturnCode )\n\t\t\t{\n\t\t\t\t*pReturnCode = IFACE_OK;\n\t\t\t}\n\t\t\treturn pCur->m_CreateFn();\n\t\t}\n\t}\n\n\tif ( pReturnCode )\n\t{\n\t\t*pReturnCode = IFACE_FAILED;\n\t}\n\treturn NULL;\n}\n#endif\n\n#ifdef _WIN32\n#define WIN32_LEAN_AND_MEAN\n#include \"windows.h\"\n#endif\n\n//-----------------------------------------------------------------------------\n// Purpose: returns a pointer to a function, given a module\n// Input  : pModuleName - module name\n//\t\t\t*pName - proc name\n//-----------------------------------------------------------------------------\n//static hlds_run wants to use this function\nstatic void *Sys_GetProcAddress( const char *pModuleName, const char *pName )\n{\n\treturn GetProcAddress( GetModuleHandle( pModuleName ), pName );\n}\n\n//-----------------------------------------------------------------------------\n// Purpose: returns a pointer to a function, given a module\n// Input  : pModuleName - module name\n//\t\t\t*pName - proc name\n//-----------------------------------------------------------------------------\n// hlds_run wants to use this function\nvoid *Sys_GetProcAddress( void *pModuleHandle, const char *pName )\n{\n#if defined( _WIN32 )\n\treturn GetProcAddress( (HINSTANCE)pModuleHandle, pName );\n#else\n\treturn GetProcAddress( pModuleHandle, pName );\n#endif\n}\n\n//-----------------------------------------------------------------------------\n// Purpose: Loads a DLL/component from disk and returns a handle to it\n// Input  : *pModuleName - filename of the component\n// Output : opaque handle to the module (hides system dependency)\n//-----------------------------------------------------------------------------\nCSysModule *Sys_LoadModule( const char *pModuleName )\n{\n#if defined( _WIN32 )\n\tHMODULE hDLL = LoadLibrary( pModuleName );\n#else\n\tHMODULE hDLL = NULL;\n\tchar szAbsoluteModuleName[1024];\n\tszAbsoluteModuleName[0] = 0;\n\tif ( pModuleName[0] != '/' )\n\t{\n\t\tchar szCwd[1024];\n\t\tchar szAbsoluteModuleName[1024];\n\n\t\tgetcwd( szCwd, sizeof( szCwd ) );\n\t\tif ( szCwd[strlen( szCwd ) - 1] == '/' )\n\t\t\tszCwd[strlen( szCwd ) - 1] = 0;\n\n\t\t_snprintf( szAbsoluteModuleName, sizeof( szAbsoluteModuleName ), \"%s/%s\", szCwd, pModuleName );\n\n\t\thDLL = dlopen( szAbsoluteModuleName, RTLD_NOW );\n\t}\n\telse\n\t{\n\t\t_snprintf( szAbsoluteModuleName, sizeof( szAbsoluteModuleName ), \"%s\", pModuleName );\n\t\thDLL = dlopen( pModuleName, RTLD_NOW );\n\t}\n#endif\n\n\tif ( !hDLL )\n\t{\n\t\tchar str[512];\n#if defined( _WIN32 )\n\t\t_snprintf( str, sizeof( str ), \"%s.dll\", pModuleName );\n\t\thDLL = LoadLibrary( str );\n#elif defined( __APPLE__ )\n\t\tprintf( \"Error:%s\\n\", dlerror() );\n\t\t_snprintf( str, sizeof( str ), \"%s.dylib\", szAbsoluteModuleName );\n\t\thDLL = dlopen( str, RTLD_NOW );\n#else\n\t\tprintf( \"Error:%s\\n\", dlerror() );\n\t\t_snprintf( str, sizeof( str ), \"%s.so\", szAbsoluteModuleName );\n\t\thDLL = dlopen( str, RTLD_NOW );\n#endif\n\t}\n\n\treturn reinterpret_cast<CSysModule *>( hDLL );\n}\n\n//-----------------------------------------------------------------------------\n// Purpose: Unloads a DLL/component from\n// Input  : *pModuleName - filename of the component\n// Output : opaque handle to the module (hides system dependency)\n//-----------------------------------------------------------------------------\nvoid Sys_UnloadModule( CSysModule *pModule )\n{\n\tif ( !pModule )\n\t\treturn;\n\n\tHMODULE hDLL = reinterpret_cast<HMODULE>( pModule );\n#if defined( _WIN32 )\n\tFreeLibrary( hDLL );\n#else\n\tdlclose( (void *)hDLL );\n#endif\n}\n\n//-----------------------------------------------------------------------------\n// Purpose: returns a pointer to a function, given a module\n// Input  : module - windows HMODULE from Sys_LoadModule()\n//\t\t\t*pName - proc name\n// Output : factory for this module\n//-----------------------------------------------------------------------------\nCreateInterfaceFn Sys_GetFactory( CSysModule *pModule )\n{\n\tif ( !pModule )\n\t\treturn NULL;\n\n\tHMODULE hDLL = reinterpret_cast<HMODULE>( pModule );\n#if defined( _WIN32 )\n\treturn reinterpret_cast<CreateInterfaceFn>( GetProcAddress( hDLL, CREATEINTERFACE_PROCNAME ) );\n#else\n\t// Linux gives this error:\n\t//../public/interface.cpp: In function `IBaseInterface *(*Sys_GetFactory\n\t//(CSysModule *)) (const char *, int *)':\n\t//../public/interface.cpp:154: ISO C++ forbids casting between\n\t//pointer-to-function and pointer-to-object\n\t//\n\t// so lets get around it :)\n\treturn (CreateInterfaceFn)( GetProcAddress( hDLL, CREATEINTERFACE_PROCNAME ) );\n#endif\n}\n\n//-----------------------------------------------------------------------------\n// Purpose: returns the instance of this module\n// Output : interface_instance_t\n//-----------------------------------------------------------------------------\nCreateInterfaceFn Sys_GetFactoryThis( void )\n{\n#ifdef LINUX\n\treturn CreateInterfaceLocal;\n#else\n\treturn CreateInterface;\n#endif\n}\n\n//-----------------------------------------------------------------------------\n// Purpose: returns the instance of the named module\n// Input  : *pModuleName - name of the module\n// Output : interface_instance_t - instance of that module\n//-----------------------------------------------------------------------------\nCreateInterfaceFn Sys_GetFactory( const char *pModuleName )\n{\n#if defined( _WIN32 )\n\treturn static_cast<CreateInterfaceFn>( Sys_GetProcAddress( pModuleName, CREATEINTERFACE_PROCNAME ) );\n#else\n\t// Linux gives this error:\n\t//../public/interface.cpp: In function `IBaseInterface *(*Sys_GetFactory\n\t//(const char *)) (const char *, int *)':\n\t//../public/interface.cpp:186: invalid static_cast from type `void *' to\n\t//type `IBaseInterface *(*) (const char *, int *)'\n\t//\n\t// so lets use the old style cast.\n\treturn (CreateInterfaceFn)( Sys_GetProcAddress( pModuleName, CREATEINTERFACE_PROCNAME ) );\n#endif\n}"
  },
  {
    "path": "common/interface.h",
    "content": "\n// This header defines the interface convention used in the valve engine.\n// To make an interface and expose it:\n//    1. Derive from IBaseInterface.\n//    2. The interface must be ALL pure virtuals, and have no data members.\n//    3. Define a name for it.\n//    4. In its implementation file, use EXPOSE_INTERFACE or EXPOSE_SINGLE_INTERFACE.\n\n// Versioning\n// There are two versioning cases that are handled by this:\n// 1. You add functions to the end of an interface, so it is binary compatible with the previous interface. In this case,\n//    you need two EXPOSE_INTERFACEs: one to expose your class as the old interface and one to expose it as the new interface.\n// 2. You update an interface so it's not compatible anymore (but you still want to be able to expose the old interface\n//    for legacy code). In this case, you need to make a new version name for your new interface, and make a wrapper interface and\n//    expose it for the old interface.\n\n//#if _MSC_VER >= 1300  // VC7\n//#include \"tier1/interface.h\"\n//#else\n\n#ifndef __INTERFACE_H__\n#define __INTERFACE_H__\n\n#include \"build.h\"\n\n#if XASH_LINUX == 1\n#include <dlfcn.h> // dlopen,dlclose, et al\n#include <unistd.h>\n#endif\n\n#if !defined( _WIN32 )\n#define HMODULE        void *\n#define GetProcAddress dlsym\n#define _snprintf snprintf\n#endif\n\nvoid *Sys_GetProcAddress( void *pModuleHandle, const char *pName );\n\n// All interfaces derive from this.\nclass IBaseInterface\n{\npublic:\n\tvirtual ~IBaseInterface() { }\n};\n\n#define CREATEINTERFACE_PROCNAME \"CreateInterface\"\ntypedef IBaseInterface *( *CreateInterfaceFn )( const char *pName, int *pReturnCode );\n\ntypedef IBaseInterface *( *InstantiateInterfaceFn )();\n\n// Used internally to register classes.\nclass InterfaceReg\n{\npublic:\n\tInterfaceReg( InstantiateInterfaceFn fn, const char *pName );\n\npublic:\n\tInstantiateInterfaceFn m_CreateFn;\n\tconst char *m_pName;\n\n\tInterfaceReg *m_pNext; // For the global list.\n\tstatic InterfaceReg *s_pInterfaceRegs;\n};\n\n// Use this to expose an interface that can have multiple instances.\n// e.g.:\n// EXPOSE_INTERFACE( CInterfaceImp, IInterface, \"MyInterface001\" )\n// This will expose a class called CInterfaceImp that implements IInterface (a pure class)\n// clients can receive a pointer to this class by calling CreateInterface( \"MyInterface001\" )\n//\n// In practice, the shared header file defines the interface (IInterface) and version name (\"MyInterface001\")\n// so that each component can use these names/vtables to communicate\n//\n// A single class can support multiple interfaces through multiple inheritance\n//\n// Use this if you want to write the factory function.\n#define EXPOSE_INTERFACE_FN( functionName, interfaceName, versionName ) \\\n\tstatic InterfaceReg __g_Create##className##_reg( functionName, versionName );\n\n#define EXPOSE_INTERFACE( className, interfaceName, versionName )                                       \\\n\tstatic IBaseInterface *__Create##className##_interface() { return (interfaceName *)new className; } \\\n\tstatic InterfaceReg __g_Create##className##_reg( __Create##className##_interface, versionName );\n\n// Use this to expose a singleton interface with a global variable you've created.\n#define EXPOSE_SINGLE_INTERFACE_GLOBALVAR( className, interfaceName, versionName, globalVarName )                        \\\n\tstatic IBaseInterface *__Create##className##interfaceName##_interface() { return (IBaseInterface *)&globalVarName; } \\\n\tstatic InterfaceReg __g_Create##className##interfaceName##_reg( __Create##className##interfaceName##_interface, versionName );\n\n// Use this to expose a singleton interface. This creates the global variable for you automatically.\n#define EXPOSE_SINGLE_INTERFACE( className, interfaceName, versionName ) \\\n\tstatic className __g_##className##_singleton;                        \\\n\tEXPOSE_SINGLE_INTERFACE_GLOBALVAR( className, interfaceName, versionName, __g_##className##_singleton )\n\n#ifdef _WIN32\n#define EXPORT_FUNCTION __declspec( dllexport )\n#else\n\t#define EXPORT_FUNCTION __attribute__((visibility(\"default\")))\n#endif\n\n// This function is automatically exported and allows you to access any interfaces exposed with the above macros.\n// if pReturnCode is set, it will return one of the following values\n// extend this for other error conditions/code\nenum\n{\n\tIFACE_OK = 0,\n\tIFACE_FAILED\n};\n\nextern \"C\"\n{\n\tEXPORT_FUNCTION IBaseInterface* CreateInterface(const char *pName, int *pReturnCode);\n}\n\nextern CreateInterfaceFn Sys_GetFactoryThis( void );\n\n//-----------------------------------------------------------------------------\n// UNDONE: This is obsolete, use the module load/unload/get instead!!!\n//-----------------------------------------------------------------------------\nextern CreateInterfaceFn Sys_GetFactory( const char *pModuleName );\n\n// load/unload components\nclass CSysModule;\n\n//-----------------------------------------------------------------------------\n// Load & Unload should be called in exactly one place for each module\n// The factory for that module should be passed on to dependent components for\n// proper versioning.\n//-----------------------------------------------------------------------------\nextern CSysModule *Sys_LoadModule( const char *pModuleName );\nextern void Sys_UnloadModule( CSysModule *pModule );\n\nextern CreateInterfaceFn Sys_GetFactory( CSysModule *pModule );\n\n#endif // __INTERFACE_H__"
  },
  {
    "path": "common/ivoicetweak.h",
    "content": "//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============\n//\n// Purpose: \n//\n// $NoKeywords: $\n//=============================================================================\n\n#ifndef IVOICETWEAK_H\n#define IVOICETWEAK_H\n#ifdef _WIN32\n#ifndef __MINGW32__\n#pragma once\n#endif /* not __MINGW32__ */\n#endif\n\n// These provide access to the voice controls.\ntypedef enum\n{\n\tMicrophoneVolume=0,\t\t\t// values 0-1.\n\tOtherSpeakerScale\t\t\t// values 0-1. Scales how loud other players are.\n} VoiceTweakControl;\n\n\ntypedef struct IVoiceTweak_s\n{\n\t// These turn voice tweak mode on and off. While in voice tweak mode, the user's voice is echoed back\n\t// without sending to the server. \n\tint\t\t\t\t(*StartVoiceTweakMode)();\t// Returns 0 on error.\n\tvoid\t\t\t(*EndVoiceTweakMode)();\n\t\n\t// Get/set control values.\n\tvoid\t\t\t(*SetControlFloat)(VoiceTweakControl iControl, float value);\n\tfloat\t\t\t(*GetControlFloat)(VoiceTweakControl iControl);\n} IVoiceTweak;\n\n\n#endif // IVOICETWEAK_H\n"
  },
  {
    "path": "common/kbutton.h",
    "content": "//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============\n//\n// Purpose: \n//\n// $NoKeywords: $\n//=============================================================================\n\n#pragma once\n#if !defined( KBUTTONH )\n#define KBUTTONH\n\ntypedef struct kbutton_s\n{\n\tint\t\tdown[2];\t\t// key nums holding it down\n\tint\t\tstate;\t\t\t// low bit is down state\n} kbutton_t;\n\n#endif // !KBUTTONH\n"
  },
  {
    "path": "common/lightstyle.h",
    "content": "/*\nlightstyle.h - lighstyle description\nCopyright (C) 2011 Uncle Mike\n\nThis program is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\nGNU General Public License for more details.\n*/\n\n#ifndef LIGHTSTYLE_H\n#define LIGHTSTYLE_H\n\ntypedef struct\n{\n\tchar\t\tpattern[256];\n\tfloat\t\tmap[256];\n\tint\t\tlength;\n\tfloat\t\tvalue;\n\tqboolean\t\tinterp;\t\t// allow to interpolate this lightstyle\n\tfloat\t\ttime;\t\t// local time warranties that new style begins from the start, not mid or end of the sequence\n} lightstyle_t;\n\n#endif//LIGHTSTYLE_H"
  },
  {
    "path": "common/mathlib.h",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\t\n*\tThis product contains software technology licensed from Id \n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc. \n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n// mathlib.h\n\ntypedef float vec_t;\ntypedef vec_t vec3_t[3];\ntypedef vec_t vec4_t[4];\t// x,y,z,w\ntypedef vec_t vec5_t[5];\n\ntypedef short vec_s_t;\ntypedef vec_s_t vec3s_t[3];\ntypedef vec_s_t vec4s_t[4];\t// x,y,z,w\ntypedef vec_s_t vec5s_t[5];\n\ntypedef\tint\tfixed4_t;\ntypedef\tint\tfixed8_t;\ntypedef\tint\tfixed16_t;\n\n#ifndef M_PI\n#define M_PI\t\t3.14159265358979323846\t// matches value in gcc v2 math.h\n#endif\n\nstruct mplane_s;\n\nextern float vec3_origin[3];\nextern\tint nanmask;\n\n#define\tIS_NAN(x) (((*(int *)&x)&nanmask)==nanmask)\n\n#ifndef VECTOR_H\n\t#define DotProduct(x,y) ((x)[0]*(y)[0]+(x)[1]*(y)[1]+(x)[2]*(y)[2])\n#endif\n\n#define VectorSubtract(a,b,c) {(c)[0]=(a)[0]-(b)[0];(c)[1]=(a)[1]-(b)[1];(c)[2]=(a)[2]-(b)[2];}\n#define VectorAdd(a,b,c) {(c)[0]=(a)[0]+(b)[0];(c)[1]=(a)[1]+(b)[1];(c)[2]=(a)[2]+(b)[2];}\n#define VectorCopy(a,b) {(b)[0]=(a)[0];(b)[1]=(a)[1];(b)[2]=(a)[2];}\n#define VectorClear(a) {(a)[0]=0.0;(a)[1]=0.0;(a)[2]=0.0;}\n\nvoid VectorMA (const vec3_t veca, float scale, const vec3_t vecb, vec3_t vecc);\n\nvec_t _DotProduct (vec3_t v1, vec3_t v2);\nvoid _VectorSubtract (vec3_t veca, vec3_t vecb, vec3_t out);\nvoid _VectorAdd (vec3_t veca, vec3_t vecb, vec3_t out);\nvoid _VectorCopy (vec3_t in, vec3_t out);\n\nint VectorCompare (const vec_t *v1, const vec_t *v2);\nfloat Length (const vec_t *v);\nvoid CrossProduct (const vec_t *v1, const vec_t *v2, vec_t *cross);\nfloat VectorNormalize (vec_t *v);\t\t// returns vector length\nvoid VectorInverse (vec3_t v);\nvoid VectorScale (const vec3_t in, vec_t scale, vec3_t out);\nint Q_log2(int val);\n\nvoid R_ConcatRotations (float in1[3][3], float in2[3][3], float out[3][3]);\nvoid R_ConcatTransforms (float in1[3][4], float in2[3][4], float out[3][4]);\n\n// Here are some \"manual\" INLINE routines for doing floating point to integer conversions\nextern short new_cw, old_cw;\n\ntypedef union DLONG {\n\tint\t\ti[2];\n\tdouble\td;\n\tfloat\tf;\n\t} DLONG;\n\nextern DLONG\tdlong;\n\n#if defined(_MSC_VER) && !defined(_WIN64)\nvoid __inline set_fpu_cw(void)\n{\n_asm\t\n\t{\t\twait\n\t\t\tfnstcw\told_cw\n\t\t\twait\n\t\t\tmov\t\tax, word ptr old_cw\n\t\t\tor\t\tah, 0xc\n\t\t\tmov\t\tword ptr new_cw,ax\n\t\t\tfldcw\tnew_cw\n\t}\n}\n\nint __inline quick_ftol(float f)\n{\n\t_asm {\n\t\t// Assumes that we are already in chop mode, and only need a 32-bit int\n\t\tfld\t\tDWORD PTR f\n\t\tfistp\tDWORD PTR dlong\n\t}\n\treturn dlong.i[0];\n}\n\nvoid __inline restore_fpu_cw(void)\n{\n\t_asm\tfldcw\told_cw\n}\n#else\n#define set_fpu_cw() /* */\n#define quick_ftol(f) ftol(f)\n#define restore_fpu_cw() /* */\n#endif\n\nvoid FloorDivMod (double numer, double denom, int *quotient,\n\t\tint *rem);\nfixed16_t Invert24To16(fixed16_t val);\nint GreatestCommonDivisor (int i1, int i2);\n\nvoid AngleVectors (const vec3_t angles, vec3_t forward, vec3_t right, vec3_t up);\nvoid AngleVectorsTranspose (const vec3_t angles, vec3_t forward, vec3_t right, vec3_t up);\n#define AngleIVectors\tAngleVectorsTranspose\n\nvoid AngleMatrix (const vec_t *angles, float (*matrix)[4] );\nvoid AngleIMatrix (const vec3_t angles, float (*matrix)[4] );\nvoid VectorTransform(const vec_t *in1, float (*in2)[4], vec_t *out);\n\nvoid NormalizeAngles( vec_t *angles );\nvoid InterpolateAngles( vec3_t start, vec3_t end, vec3_t output, float frac );\nfloat AngleBetweenVectors( const vec3_t v1, const vec3_t v2 );\n\n\nvoid VectorMatrix( vec3_t forward, vec3_t right, vec3_t up);\nvoid VectorAngles( const vec_t *forward, vec_t *angles );\n\nint InvertMatrix( const float * m, float *out );\n\nint BoxOnPlaneSide (vec3_t emins, vec3_t emaxs, struct mplane_s *plane);\nfloat anglemod(float a);\n\n// up / down\n#define\tPITCH\t0\n// left / right\n#define\tYAW\t\t1\n// fall over\n#define\tROLL\t2\n\n\n#define BOX_ON_PLANE_SIDE(emins, emaxs, p)\t\\\n\t(((p)->type < 3)?\t\t\t\t\t\t\\\n\t(\t\t\t\t\t\t\t\t\t\t\\\n\t\t((p)->dist <= (emins)[(p)->type])?\t\\\n\t\t\t1\t\t\t\t\t\t\t\t\\\n\t\t:\t\t\t\t\t\t\t\t\t\\\n\t\t(\t\t\t\t\t\t\t\t\t\\\n\t\t\t((p)->dist >= (emaxs)[(p)->type])?\\\n\t\t\t\t2\t\t\t\t\t\t\t\\\n\t\t\t:\t\t\t\t\t\t\t\t\\\n\t\t\t\t3\t\t\t\t\t\t\t\\\n\t\t)\t\t\t\t\t\t\t\t\t\\\n\t)\t\t\t\t\t\t\t\t\t\t\\\n\t:\t\t\t\t\t\t\t\t\t\t\\\n\t\tBoxOnPlaneSide( (emins), (emaxs), (p)))\n"
  },
  {
    "path": "common/net_api.h",
    "content": "//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============\n//\n// Purpose: \n//\n// $NoKeywords: $\n//=============================================================================\n\n#if !defined( NET_APIH )\n#define NET_APIH\n#ifdef _WIN32\n#ifndef __MINGW32__\n#pragma once\n#endif /* not __MINGW32__ */\n#endif\n\n#if !defined ( NETADRH )\n#include \"netadr.h\"\n#endif\n\n#define NETAPI_REQUEST_SERVERLIST\t( 0 )  // Doesn't need a remote address\n#define NETAPI_REQUEST_PING\t\t\t( 1 )\n#define NETAPI_REQUEST_RULES\t\t( 2 )\n#define NETAPI_REQUEST_PLAYERS\t\t( 3 )\n#define NETAPI_REQUEST_DETAILS\t\t( 4 )\n\n// Set this flag for things like broadcast requests, etc. where the engine should not\n//  kill the request hook after receiving the first response\n#define FNETAPI_MULTIPLE_RESPONSE ( 1<<0 )\n\ntypedef void ( *net_api_response_func_t ) ( struct net_response_s *response );\n\n#define NET_SUCCESS\t\t\t\t\t\t( 0 )\n#define NET_ERROR_TIMEOUT\t\t\t\t( 1<<0 )\n#define NET_ERROR_PROTO_UNSUPPORTED\t\t( 1<<1 )\n#define NET_ERROR_UNDEFINED\t\t\t\t( 1<<2 )\n\ntypedef struct net_adrlist_s\n{\n\tstruct net_adrlist_s\t*next;\n\tnetadr_t\t\t\t\tremote_address;\n} net_adrlist_t;\n\ntypedef struct net_response_s\n{\n\t// NET_SUCCESS or an error code\n\tint\t\t\terror;\n\n\t// Context ID\n\tint\t\t\tcontext;\n\t// Type\n\tint\t\t\ttype;\n\n\t// Server that is responding to the request\n\tnetadr_t\tremote_address;\n\n\t// Response RTT ping time\n\tdouble\t\tping;\n\t// Key/Value pair string ( separated by backlash \\ characters )\n\t// WARNING:  You must copy this buffer in the callback function, because it is freed\n\t//  by the engine right after the call!!!!\n\t// ALSO:  For NETAPI_REQUEST_SERVERLIST requests, this will be a pointer to a linked list of net_adrlist_t's\n\tvoid\t\t*response;\n} net_response_t;\n\ntypedef struct net_status_s\n{\n\t\t// Connected to remote server?  1 == yes, 0 otherwise\n\tint\t\t\tconnected; \n\t// Client's IP address\n\tnetadr_t\tlocal_address;\n\t// Address of remote server\n\tnetadr_t\tremote_address;\n\t// Packet Loss ( as a percentage )\n\tint\t\t\tpacket_loss;\n\t// Latency, in seconds ( multiply by 1000.0 to get milliseconds )\n\tdouble\t\tlatency;\n\t// Connection time, in seconds\n\tdouble\t\tconnection_time;\n\t// Rate setting ( for incoming data )\n\tdouble\t\trate;\n} net_status_t;\n\ntypedef struct net_api_s\n{\n\t// APIs\n\tvoid\t\t( *InitNetworking )( void );\n\tvoid\t\t( *Status ) ( struct net_status_s *status );\n\tvoid\t\t( *SendRequest) ( int context, int request, int flags, double timeout, struct netadr_s *remote_address, net_api_response_func_t response );\n\tvoid\t\t( *CancelRequest ) ( int context );\n\tvoid\t\t( *CancelAllRequests ) ( void );\n\tchar\t\t*( *AdrToString ) ( struct netadr_s *a );\n\tint\t\t\t( *CompareAdr ) ( struct netadr_s *a, struct netadr_s *b );\n\tint\t\t\t( *StringToAdr ) ( char *s, struct netadr_s *a );\n\tconst char *( *ValueForKey ) ( const char *s, const char *key );\n\tvoid\t\t( *RemoveKey ) ( char *s, const char *key );\n\tvoid\t\t( *SetValueForKey ) (char *s, const char *key, const char *value, int maxsize );\n} net_api_t;\n\nextern net_api_t netapi;\n\n#endif // NET_APIH\n"
  },
  {
    "path": "common/netadr.h",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\t\n*\tThis product contains software technology licensed from Id \n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc. \n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n// netadr.h\n#ifndef NETADR_H\n#define NETADR_H\n#ifdef _WIN32\n#ifndef __MINGW32__\n#pragma once\n#endif /* not __MINGW32__ */\n#endif\n\ntypedef enum\n{\n\tNA_UNUSED,\n\tNA_LOOPBACK,\n\tNA_BROADCAST,\n\tNA_IP,\n\tNA_IPX,\n\tNA_BROADCAST_IPX\n} netadrtype_t;\n\ntypedef struct netadr_s\n{\n\tnetadrtype_t\ttype;\n\tunsigned char\tip[4];\n\tunsigned char\tipx[10];\n\tunsigned short\tport;\n} netadr_t;\n\n#endif // NETADR_H\n"
  },
  {
    "path": "common/nowin.h",
    "content": "//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============\n//\n// Purpose: \n//\n// $NoKeywords: $\n//=============================================================================\n\n#ifndef INC_NOWIN_H\n#define INC_NOWIN_H\n#ifndef _WIN32\n\n#include <unistd.h>\n\n#endif //!_WIN32\n#endif //INC_NOWIN_H\n"
  },
  {
    "path": "common/particledef.h",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\t\n*\tThis product contains software technology licensed from Id \n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc. \n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n#if !defined( PARTICLEDEFH )\n#define PARTICLEDEFH\n#ifdef _WIN32\n#ifndef __MINGW32__\n#pragma once\n#endif /* not __MINGW32__ */\n#endif\n\ntypedef enum {\n\tpt_static, \n\tpt_grav,\n\tpt_slowgrav,\n\tpt_fire,\n\tpt_explode,\n\tpt_explode2,\n\tpt_blob,\n\tpt_blob2,\n\tpt_vox_slowgrav,\n\tpt_vox_grav,\n\tpt_clientcustom   // Must have callback function specified\n} ptype_t;\n\n// !!! if this is changed, it must be changed in d_ifacea.h too !!!\ntypedef struct particle_s\n{\n// driver-usable fields\n\tvec3_t\t\torg;\n\tshort\t\tcolor;\n\tshort\t\tpackedColor;\n// drivers never touch the following fields\n\tstruct particle_s\t*next;\n\tvec3_t\t\tvel;\n\tfloat\t\tramp;\n\tfloat\t\tdie;\n\tptype_t\t\ttype;\n\tvoid\t\t(*deathfunc)( struct particle_s *particle );\n\n\t// for pt_clientcusttom, we'll call this function each frame\n\tvoid\t\t(*callback)( struct particle_s *particle, float frametime );\n\t\n\t// For deathfunc, etc.\n\tunsigned char context;\n} particle_t;\n\n#endif\n"
  },
  {
    "path": "common/pmtrace.h",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\t\n*\tThis product contains software technology licensed from Id \n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc. \n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n#if !defined( PMTRACEH )\n#define PMTRACEH\n#ifdef _WIN32\n#ifndef __MINGW32__\n#pragma once\n#endif /* not __MINGW32__ */\n#endif\n\ntypedef struct\n{\n\tvec3_t\tnormal;\n\tfloat\tdist;\n} pmplane_t;\n\ntypedef struct pmtrace_s pmtrace_t;\n\nstruct pmtrace_s\n{\n\tqboolean\tallsolid;\t      // if true, plane is not valid\n\tqboolean\tstartsolid;\t      // if true, the initial point was in a solid area\n\tqboolean\tinopen, inwater;  // End point is in empty space or in water\n\tfloat\t\tfraction;\t\t  // time completed, 1.0 = didn't hit anything\n\tvec3_t\t\tendpos;\t\t\t  // final position\n\tpmplane_t\tplane;\t\t      // surface normal at impact\n\tint\t\t\tent;\t\t\t  // entity at impact\n\tvec3_t      deltavelocity;    // Change in player's velocity caused by impact.  \n\t\t\t\t\t\t\t\t  // Only run on server.\n\tint         hitgroup;\n};\n\n#endif\n"
  },
  {
    "path": "common/port.h",
    "content": "/*\nport.h -- Portability Layer for Windows types\nCopyright (C) 2015 Alibek Omarov\n\nThis program is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\nGNU General Public License for more details.\n*/\n\n#pragma once\n#ifndef PORT_H\n#define PORT_H\n\n#include \"build.h\"\n\n#ifdef XASH_VGUI\n\t#if !(defined(__i386__) || defined(_X86_) || defined(_WIN32))\n\t#error \"VGUI is exists only for x86. You must disable VGUI flag or build Xash3D for x86 target.\"\n    #endif\n#endif\n\n#ifndef _WIN32\n\t#if XASH_LINUX == 1\n\t#include <limits.h>\n\t#include <dlfcn.h>\n\t#endif\n\n    #ifdef __APPLE__\n\t\t#include <sys/syslimits.h>\n\t\t#define OS_LIB_EXT \"dylib\"\n    #else\n\t\t#ifdef __linux__\n\t\t\t#include <linux/limits.h>\n\t\t#endif\n\t\t#define OS_LIB_EXT \"so\"\n    #endif\n\n    #ifdef __ANDROID__\n\t\t#define XASH_THREADS\n\t\t#ifdef LOAD_HARDFP\n\t\t\t#define MENUDLL \"libmenu_hardfp.so\"\n\t\t\t#define CLIENTDLL \"libclient_hardfp.so\"\n\t\t\t#define SERVERDLL \"libserver_hardfp.so\"\n\t\t#else\n\t\t\t#define MENUDLL \"libmenu.so\"\n\t\t\t#define CLIENTDLL \"libclient.so\"\n\t\t\t#define SERVERDLL \"libserver.so\"\n\t\t#endif\n\t\t#define GAMEPATH \"/sdcard/xash\"\n    #else\n\t\t#define MENUDLL \"libxashmenu.\" OS_LIB_EXT\n\t\t#define CLIENTDLL \"client.\" OS_LIB_EXT\n\t\t#ifdef PANDORA\n\t\t\t#define SERVERDLL \"hl.\" OS_LIB_EXT\n\t\t\t#define LIBPATH \".\"\n\t\t\t#define GAMEPATH \".\"\n\t\t#endif\n    #endif\n\n\t#define VGUI_SUPPORT_DLL \"libvgui_support.\" OS_LIB_EXT\n\n\t#define TRUE\t    1\n\t#define FALSE\t    0\n\n    // Windows-specific\n    #define _stdcall\n    #define __stdcall\n    #define __cdecl\n\t#define _inline\t    static inline\n    #define O_BINARY    0\t\t//In Linux O_BINARY didn't exist\n\n    // Windows functions to Linux equivalent\n\t#define _mkdir( x )\t\t\t\t\tmkdir( x, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH )\n\t#define LoadLibrary( x )\t\t\tdlopen( x, RTLD_NOW )\n\t#define GetProcAddress( x, y )\t\tdlsym( x, y )\n\t#define SetCurrentDirectory( x )\t(!chdir( x ))\n\t#define FreeLibrary( x )\t\t\tdlclose( x )\n\t#define MAKEWORD(a,b)\t\t\t\t((short int)(((unsigned char)(a))|(((short int)((unsigned char)(b)))<<8)))\n\t#define max(a, b)  (((a) > (b)) ? (a) : (b))\n\t#define min(a, b)  (((a) < (b)) ? (a) : (b))\n\t#define tell(a)\t\t\t\t\t\tlseek(a, 0, SEEK_CUR)\n\n    typedef unsigned char   BYTE;\n    typedef unsigned char   byte;\n    typedef short int\t    WORD;\n    typedef unsigned int    DWORD;\n    typedef long int\t    LONG;\n    typedef unsigned long int   ULONG;\n    typedef long\t    WPARAM;\n    typedef unsigned int    LPARAM;\n\n    typedef void* HANDLE;\n    typedef void* HMODULE;\n    typedef void* HINSTANCE;\n\n    typedef char* LPSTR;\n\n    typedef struct tagPOINT\n    {\n\tint x, y;\n    } POINT;\n#else\n\t#define strcasecmp _stricmp\n\t#define strncasecmp _strnicmp\n\t#define open _open\n\t#define read _read\n\n\t// shut-up compiler warnings\n\t#pragma warning(disable : 4244)\t// MIPS\n\t#pragma warning(disable : 4018)\t// signed/unsigned mismatch\n\t#pragma warning(disable : 4305)\t// truncation from const double to float\n\t#pragma warning(disable : 4115)\t// named type definition in parentheses\n\t#pragma warning(disable : 4100)\t// unreferenced formal parameter\n\t#pragma warning(disable : 4127)\t// conditional expression is constant\n\t#pragma warning(disable : 4057)\t// differs in indirection to slightly different base types\n\t#pragma warning(disable : 4201)\t// nonstandard extension used\n\t#pragma warning(disable : 4706)\t// assignment within conditional expression\n\t#pragma warning(disable : 4054)\t// type cast' : from function pointer\n\t#pragma warning(disable : 4310)\t// cast truncates constant value\n\t#pragma warning(disable : 4244) // 'argument': conversion from 'float' to 'int', possible loss of data\n\n\t#define HSPRITE WINAPI_HSPRITE\n\t#include <windows.h>\n\t#undef HSPRITE\n\n    #define OS_LIB_EXT \"dll\"\n    #define MENUDLL \"menu.\" OS_LIB_EXT\n    #define CLIENTDLL \"client.\" OS_LIB_EXT\n\t#define VGUI_SUPPORT_DLL \"../vgui_support.\" OS_LIB_EXT\n#endif\n\n#endif\n"
  },
  {
    "path": "common/qfont.h",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\t\n*\tThis product contains software technology licensed from Id \n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc. \n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n#if !defined( QFONTH )\n#define QFONTH\n#ifdef _WIN32\n#ifndef __MINGW32__\n#pragma once\n#endif /* not __MINGW32__ */\n#endif\n\n// Font stuff\n\n#define NUM_GLYPHS 256\n\ntypedef struct\n{\n\tshort startoffset;\n\tshort charwidth;\n} charinfo;\n\ntypedef struct qfont_s\n{\n\tint \t\twidth, height;\n\tint\t\t\trowcount;\n\tint\t\t\trowheight;\n\tcharinfo\tfontinfo[ NUM_GLYPHS ];\n\tbyte \t\tdata[4];\n} qfont_t;\n\n#endif // qfont.h\n"
  },
  {
    "path": "common/r_efx.h",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\t\n*\tThis product contains software technology licensed from Id \n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc. \n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n#if !defined ( R_EFXH )\n#define R_EFXH\n#ifdef _WIN32\n#ifndef __MINGW32__\n#pragma once\n#endif /* not __MINGW32__ */\n#endif\n\n// particle_t\n#if !defined( PARTICLEDEFH )  \n#include \"particledef.h\"\n#endif\n\n// BEAM\n#if !defined( BEAMDEFH )\n#include \"beamdef.h\"\n#endif\n\n// dlight_t\n#if !defined ( DLIGHTH )\n#include \"dlight.h\"\n#endif\n\n// cl_entity_t\n#if !defined( CL_ENTITYH )\n#include \"cl_entity.h\"\n#endif\n\n/*\n// FOR REFERENCE, These are the built-in tracer colors.  Note, color 4 is the one\n//  that uses the tracerred/tracergreen/tracerblue and traceralpha cvar settings\ncolor24 gTracerColors[] =\n{\n\t{ 255, 255, 255 },\t\t// White\n\t{ 255, 0, 0 },\t\t\t// Red\n\t{ 0, 255, 0 },\t\t\t// Green\n\t{ 0, 0, 255 },\t\t\t// Blue\n\t{ 0, 0, 0 },\t\t\t// Tracer default, filled in from cvars, etc.\n\t{ 255, 167, 17 },\t\t// Yellow-orange sparks\n\t{ 255, 130, 90 },\t\t// Yellowish streaks (garg)\n\t{ 55, 60, 144 },\t\t// Blue egon streak\n\t{ 255, 130, 90 },\t\t// More Yellowish streaks (garg)\n\t{ 255, 140, 90 },\t\t// More Yellowish streaks (garg)\n\t{ 200, 130, 90 },\t\t// More red streaks (garg)\n\t{ 255, 120, 70 },\t\t// Darker red streaks (garg)\n};\n*/\n\n// Temporary entity array\n#define TENTPRIORITY_LOW\t0\n#define TENTPRIORITY_HIGH\t1\n\n// TEMPENTITY flags\n#define\tFTENT_NONE\t\t\t\t0x00000000\n#define\tFTENT_SINEWAVE\t\t\t0x00000001\n#define\tFTENT_GRAVITY\t\t\t0x00000002\n#define FTENT_ROTATE\t\t\t0x00000004\n#define\tFTENT_SLOWGRAVITY\t\t0x00000008\n#define FTENT_SMOKETRAIL\t\t0x00000010\n#define FTENT_COLLIDEWORLD\t\t0x00000020\n#define FTENT_FLICKER\t\t\t0x00000040\n#define FTENT_FADEOUT\t\t\t0x00000080\n#define FTENT_SPRANIMATE\t\t0x00000100\n#define FTENT_HITSOUND\t\t\t0x00000200\n#define FTENT_SPIRAL\t\t\t0x00000400\n#define FTENT_SPRCYCLE\t\t\t0x00000800\n#define FTENT_COLLIDEALL\t\t0x00001000 // will collide with world and slideboxes\n#define FTENT_PERSIST\t\t\t0x00002000 // tent is not removed when unable to draw \n#define FTENT_COLLIDEKILL\t\t0x00004000 // tent is removed upon collision with anything\n#define FTENT_PLYRATTACHMENT\t0x00008000 // tent is attached to a player (owner)\n#define FTENT_SPRANIMATELOOP\t0x00010000 // animating sprite doesn't die when last frame is displayed\n#define FTENT_SPARKSHOWER\t\t0x00020000\n#define FTENT_NOMODEL\t\t\t0x00040000 // Doesn't have a model, never try to draw ( it just triggers other things )\n#define FTENT_CLIENTCUSTOM\t\t0x00080000 // Must specify callback.  Callback function is responsible for killing tempent and updating fields ( unless other flags specify how to do things )\n#define FTENT_BODYTRACE\t\t\t0x00100000\n#define FTENT_BODYGRAVITY\t\t0x00200000\n\ntypedef struct tempent_s\tTEMPENTITY;\ntypedef struct tempent_s\n{\n\tint\t\t\tflags;\n\tfloat\t\tdie;\n\tfloat\t\tframeMax;\n\tfloat\t\tx;\n\tfloat\t\ty;\n\tfloat\t\tz;\n\tfloat\t\tfadeSpeed;\n\tfloat\t\tbounceFactor;\n\tint\t\t\thitSound;\n\tvoid\t\t( *hitcallback )\t( struct tempent_s *ent, struct pmtrace_s *ptr );\n\tvoid\t\t( *callback )\t\t( struct tempent_s *ent, float frametime, float currenttime );\n\tTEMPENTITY\t*next;\n\tint\t\t\tpriority;\n\tshort\t\tclientIndex;\t// if attached, this is the index of the client to stick to\n\t\t\t\t\t\t\t\t// if COLLIDEALL, this is the index of the client to ignore\n\t\t\t\t\t\t\t\t// TENTS with FTENT_PLYRATTACHMENT MUST set the clientindex! \n\n\tvec3_t\t\ttentOffset;\t\t// if attached, client origin + tentOffset = tent origin.\n\tcl_entity_t\tentity;\n\n\t// baseline.origin\t\t- velocity\n\t// baseline.renderamt\t- starting fadeout intensity\n\t// baseline.angles\t\t- angle velocity\n} TEMPENTITY;\n\ntypedef struct efx_api_s efx_api_t;\n\nstruct efx_api_s\n{\n\tparticle_t  *( *R_AllocParticle )\t\t\t( void ( *callback ) ( struct particle_s *particle, float frametime ) );\n\tvoid\t\t( *R_BlobExplosion )\t\t\t( float * org );\n\tvoid\t\t( *R_Blood )\t\t\t\t\t( float * org, float * dir, int pcolor, int speed );\n\tvoid\t\t( *R_BloodSprite )\t\t\t\t( float * org, int colorindex, int modelIndex, int modelIndex2, float size );\n\tvoid\t\t( *R_BloodStream )\t\t\t\t( float * org, float * dir, int pcolor, int speed );\n\tvoid\t\t( *R_BreakModel )\t\t\t\t( float *pos, float *size, float *dir, float random, float life, int count, int modelIndex, char flags );\n\tvoid\t\t( *R_Bubbles )\t\t\t\t\t( float * mins, float * maxs, float height, int modelIndex, int count, float speed );\n\tvoid\t\t( *R_BubbleTrail )\t\t\t\t( float * start, float * end, float height, int modelIndex, int count, float speed );\n\tvoid\t\t( *R_BulletImpactParticles )\t( float * pos );\n\tvoid\t\t( *R_EntityParticles )\t\t\t( struct cl_entity_s *ent );\n\tvoid\t\t( *R_Explosion )\t\t\t\t( float *pos, int model, float scale, float framerate, int flags );\n\tvoid\t\t( *R_FizzEffect )\t\t\t\t( struct cl_entity_s *pent, int modelIndex, int density );\n\tvoid\t\t( *R_FireField ) \t\t\t\t( float * org, int radius, int modelIndex, int count, int flags, float life );\n\tvoid\t\t( *R_FlickerParticles )\t\t\t( float * org );\n\tvoid\t\t( *R_FunnelSprite )\t\t\t\t( float *org, int modelIndex, int reverse );\n\tvoid\t\t( *R_Implosion )\t\t\t\t( float * end, float radius, int count, float life );\n\tvoid\t\t( *R_LargeFunnel )\t\t\t\t( float * org, int reverse );\n\tvoid\t\t( *R_LavaSplash )\t\t\t\t( float * org );\n\tvoid\t\t( *R_MultiGunshot )\t\t\t\t( float * org, float * dir, float * noise, int count, int decalCount, int *decalIndices );\n\tvoid\t\t( *R_MuzzleFlash )\t\t\t\t( float *pos1, int type );\n\tvoid\t\t( *R_ParticleBox )\t\t\t\t( float *mins, float *maxs, unsigned char r, unsigned char g, unsigned char b, float life );\n\tvoid\t\t( *R_ParticleBurst )\t\t\t( float * pos, int size, int color, float life );\n\tvoid\t\t( *R_ParticleExplosion )\t\t( float * org );\n\tvoid\t\t( *R_ParticleExplosion2 )\t\t( float * org, int colorStart, int colorLength );\n\tvoid\t\t( *R_ParticleLine )\t\t\t\t( float * start, float *end, unsigned char r, unsigned char g, unsigned char b, float life );\n\tvoid\t\t( *R_PlayerSprites )\t\t\t( int client, int modelIndex, int count, int size );\n\tvoid\t\t( *R_Projectile )\t\t\t\t( float * origin, float * velocity, int modelIndex, int life, int owner, void (*hitcallback)( struct tempent_s *ent, struct pmtrace_s *ptr ) );\n\tvoid\t\t( *R_RicochetSound )\t\t\t( float * pos );\n\tvoid\t\t( *R_RicochetSprite )\t\t\t( float *pos, struct model_s *pmodel, float duration, float scale );\n\tvoid\t\t( *R_RocketFlare )\t\t\t\t( float *pos );\n\tvoid\t\t( *R_RocketTrail )\t\t\t\t( float * start, float * end, int type );\n\tvoid\t\t( *R_RunParticleEffect )\t\t( float * org, float * dir, int color, int count );\n\tvoid\t\t( *R_ShowLine )\t\t\t\t\t( float * start, float * end );\n\tvoid\t\t( *R_SparkEffect )\t\t\t\t( float *pos, int count, int velocityMin, int velocityMax );\n\tvoid\t\t( *R_SparkShower )\t\t\t\t( float *pos );\n\tvoid\t\t( *R_SparkStreaks )\t\t\t\t( float * pos, int count, int velocityMin, int velocityMax );\n\tvoid\t\t( *R_Spray )\t\t\t\t\t( float * pos, float * dir, int modelIndex, int count, int speed, int spread, int rendermode );\n\tvoid\t\t( *R_Sprite_Explode )\t\t\t( TEMPENTITY *pTemp, float scale, int flags );\n\tvoid\t\t( *R_Sprite_Smoke )\t\t\t\t( TEMPENTITY *pTemp, float scale );\n\tvoid\t\t( *R_Sprite_Spray )\t\t\t\t( float * pos, float * dir, int modelIndex, int count, int speed, int iRand );\n\tvoid\t\t( *R_Sprite_Trail )\t\t\t\t( int type, float * start, float * end, int modelIndex, int count, float life, float size, float amplitude, int renderamt, float speed );\n\tvoid\t\t( *R_Sprite_WallPuff )\t\t\t( TEMPENTITY *pTemp, float scale );\n\tvoid\t\t( *R_StreakSplash )\t\t\t\t( float * pos, float * dir, int color, int count, float speed, int velocityMin, int velocityMax );\n\tvoid\t\t( *R_TracerEffect )\t\t\t\t( float * start, float * end );\n\tvoid\t\t( *R_UserTracerParticle )\t\t( float * org, float * vel, float life, int colorIndex, float length, unsigned char deathcontext, void ( *deathfunc)( struct particle_s *particle ) );\n\tparticle_t *( *R_TracerParticles )\t\t\t( float * org, float * vel, float life );\n\tvoid\t\t( *R_TeleportSplash )\t\t\t( float * org );\n\tvoid\t\t( *R_TempSphereModel )\t\t\t( float *pos, float speed, float life, int count, int modelIndex );\n\tTEMPENTITY\t*( *R_TempModel )\t\t\t\t( float *pos, float *dir, float *angles, float life, int modelIndex, int soundtype );\n\tTEMPENTITY\t*( *R_DefaultSprite )\t\t\t( float *pos, int spriteIndex, float framerate );\n\tTEMPENTITY\t*( *R_TempSprite )\t\t\t\t( float *pos, float *dir, float scale, int modelIndex, int rendermode, int renderfx, float a, float life, int flags );\n\tint\t\t\t( *Draw_DecalIndex )\t\t\t( int id );\n\tint\t\t\t( *Draw_DecalIndexFromName )\t( char *name );\n\tvoid\t\t( *R_DecalShoot )\t\t\t\t( int textureIndex, int entity, int modelIndex, float * position, int flags );\n\tvoid\t\t( *R_AttachTentToPlayer )\t\t( int client, int modelIndex, float zoffset, float life );\n\tvoid\t\t( *R_KillAttachedTents )\t\t( int client );\n\tBEAM\t\t*( *R_BeamCirclePoints )\t\t( int type, float * start, float * end, int modelIndex, float life, float width, float amplitude, float brightness, float speed, int startFrame, float framerate, float r, float g, float b );\n\tBEAM\t\t*( *R_BeamEntPoint )\t\t\t( int startEnt, float * end, int modelIndex, float life, float width, float amplitude, float brightness, float speed, int startFrame, float framerate, float r, float g, float b );\n\tBEAM\t\t*( *R_BeamEnts )\t\t\t\t( int startEnt, int endEnt, int modelIndex, float life, float width, float amplitude, float brightness, float speed, int startFrame, float framerate, float r, float g, float b );\n\tBEAM\t\t*( *R_BeamFollow )\t\t\t\t( int startEnt, int modelIndex, float life, float width, float r, float g, float b, float brightness );\n\tvoid\t\t( *R_BeamKill )\t\t\t\t\t( int deadEntity );\n\tBEAM\t\t*( *R_BeamLightning )\t\t\t( float * start, float * end, int modelIndex, float life, float width, float amplitude, float brightness, float speed );\n\tBEAM\t\t*( *R_BeamPoints )\t\t\t\t( float * start, float * end, int modelIndex, float life, float width, float amplitude, float brightness, float speed, int startFrame, float framerate, float r, float g, float b );\n\tBEAM\t\t*( *R_BeamRing )\t\t\t\t( int startEnt, int endEnt, int modelIndex, float life, float width, float amplitude, float brightness, float speed, int startFrame, float framerate, float r, float g, float b );\n\tdlight_t\t*( *CL_AllocDlight )\t\t\t( int key );\n\tdlight_t\t*( *CL_AllocElight )\t\t\t( int key );\n\tTEMPENTITY\t*( *CL_TempEntAlloc )\t\t\t( float * org, struct model_s *model );\n\tTEMPENTITY\t*( *CL_TempEntAllocNoModel )\t( float * org );\n\tTEMPENTITY\t*( *CL_TempEntAllocHigh )\t\t( float * org, struct model_s *model );\n\tTEMPENTITY\t*( *CL_TentEntAllocCustom )\t\t( float *origin, struct model_s *model, int high, void ( *callback ) ( struct tempent_s *ent, float frametime, float currenttime ) );\n\tvoid\t\t( *R_GetPackedColor )\t\t\t( short *packed, short color );\n\tshort\t\t( *R_LookupColor )\t\t\t\t( unsigned char r, unsigned char g, unsigned char b );\n\tvoid\t\t( *R_DecalRemoveAll )\t\t\t( int textureIndex ); //textureIndex points to the decal index in the array, not the actual texture index.\n};\n\nextern efx_api_t efx;\n\n#endif\n"
  },
  {
    "path": "common/r_studioint.h",
    "content": "//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============\n//\n// Purpose: \n//\n// $NoKeywords: $\n//=============================================================================\n\n#if !defined( R_STUDIOINT_H )\n#define R_STUDIOINT_H\n#if defined( _WIN32 )\n#ifndef __MINGW32__\n#pragma once\n#endif /* not __MINGW32__ */\n#endif\n\n#define STUDIO_INTERFACE_VERSION 1\n\ntypedef struct engine_studio_api_s\n{\n\t// Allocate number*size bytes and zero it\n\tvoid\t\t\t*( *Mem_Calloc )\t\t\t\t( int number, size_t size );\n\t// Check to see if pointer is in the cache\n\tvoid\t\t\t*( *Cache_Check )\t\t\t\t( struct cache_user_s *c );\n\t// Load file into cache ( can be swapped out on demand )\n\tvoid\t\t\t( *LoadCacheFile )\t\t\t\t( char *path, struct cache_user_s *cu );\n\t// Retrieve model pointer for the named model\n\tstruct model_s\t*( *Mod_ForName )\t\t\t\t( const char *name, int crash_if_missing );\n\t// Retrieve pointer to studio model data block from a model\n\tvoid\t\t\t*( *Mod_Extradata )\t\t\t\t( struct model_s *mod );\n\t// Retrieve indexed model from client side model precache list\n\tstruct model_s\t*( *GetModelByIndex )\t\t\t( int index );\n\t// Get entity that is set for rendering\n\tstruct cl_entity_s * ( *GetCurrentEntity )\t\t( void );\n\t// Get referenced player_info_t\n\tstruct player_info_s *( *PlayerInfo )\t\t\t( int index );\n\t// Get most recently received player state data from network system\n\tstruct entity_state_s *( *GetPlayerState )\t\t( int index );\n\t// Get viewentity\n\tstruct cl_entity_s * ( *GetViewEntity )\t\t\t( void );\n\t// Get current frame count, and last two timestampes on client\n\tvoid\t\t\t( *GetTimes )\t\t\t\t\t( int *framecount, double *current, double *old );\n\t// Get a pointer to a cvar by name\n\tstruct cvar_s\t*( *GetCvar )\t\t\t\t\t( const char *name );\n\t// Get current render origin and view vectors ( up, right and vpn )\n\tvoid\t\t\t( *GetViewInfo )\t\t\t\t( float *origin, float *upv, float *rightv, float *vpnv );\n\t// Get sprite model used for applying chrome effect\n\tstruct model_s\t*( *GetChromeSprite )\t\t\t( void );\n\t// Get model counters so we can incement instrumentation\n\tvoid\t\t\t( *GetModelCounters )\t\t\t( int **s, int **a );\n\t// Get software scaling coefficients\n\tvoid\t\t\t( *GetAliasScale )\t\t\t\t( float *x, float *y );\n\n\t// Get bone, light, alias, and rotation matrices\n\tfloat\t\t\t****( *StudioGetBoneTransform ) ( void );\n\tfloat\t\t\t****( *StudioGetLightTransform )( void );\n\tfloat\t\t\t***( *StudioGetAliasTransform ) ( void );\n\tfloat\t\t\t***( *StudioGetRotationMatrix ) ( void );\n\n\t// Set up body part, and get submodel pointers\n\tvoid\t\t\t( *StudioSetupModel )\t\t\t( int bodypart, void **ppbodypart, void **ppsubmodel );\n\t// Check if entity's bbox is in the view frustum\n\tint\t\t\t\t( *StudioCheckBBox )\t\t\t( void );\n\t// Apply lighting effects to model\n\tvoid\t\t\t( *StudioDynamicLight )\t\t\t( struct cl_entity_s *ent, struct alight_s *plight );\n\tvoid\t\t\t( *StudioEntityLight )\t\t\t( struct alight_s *plight );\n\tvoid\t\t\t( *StudioSetupLighting )\t\t( struct alight_s *plighting );\n\n\t// Draw mesh vertices\n\tvoid\t\t\t( *StudioDrawPoints )\t\t\t( void );\n\n\t// Draw hulls around bones\n\tvoid\t\t\t( *StudioDrawHulls )\t\t\t( void );\n\t// Draw bbox around studio models\n\tvoid\t\t\t( *StudioDrawAbsBBox )\t\t\t( void );\n\t// Draws bones\n\tvoid\t\t\t( *StudioDrawBones )\t\t\t( void );\n\t// Loads in appropriate texture for model\n\tvoid\t\t\t( *StudioSetupSkin )\t\t\t( void *ptexturehdr, int index );\n\t// Sets up for remapped colors\n\tvoid\t\t\t( *StudioSetRemapColors )\t\t( int top, int bottom );\n\t// Set's player model and returns model pointer\n\tstruct model_s\t*( *SetupPlayerModel )\t\t\t( int index );\n\t// Fires any events embedded in animation\n\tvoid\t\t\t( *StudioClientEvents )\t\t\t( void );\n\t// Retrieve/set forced render effects flags\n\tint\t\t\t\t( *GetForceFaceFlags )\t\t\t( void );\n\tvoid\t\t\t( *SetForceFaceFlags )\t\t\t( int flags );\n\t// Tell engine the value of the studio model header\n\tvoid\t\t\t( *StudioSetHeader )\t\t\t( void *header );\n\t// Tell engine which model_t * is being renderered\n\tvoid\t\t\t( *SetRenderModel )\t\t\t\t( struct model_s *model );\n\n\t// Final state setup and restore for rendering\n\tvoid\t\t\t( *SetupRenderer )\t\t\t\t( int rendermode );\n\tvoid\t\t\t( *RestoreRenderer )\t\t\t( void );\n\n\t// Set render origin for applying chrome effect\n\tvoid\t\t\t( *SetChromeOrigin )\t\t\t( void );\n\n\t// True if using D3D/OpenGL\n\tint\t\t\t\t( *IsHardware )\t\t\t\t\t( void );\n\t\n\t// Only called by hardware interface\n\tvoid\t\t\t( *GL_StudioDrawShadow )\t\t( void );\n\tvoid\t\t\t( *GL_SetRenderMode )\t\t\t( int mode );\n\n\tvoid\t\t( *StudioSetRenderamt )( int iRenderamt );\n\tvoid\t\t( *StudioSetCullState )( int iCull );\n\tvoid\t\t( *StudioRenderShadow )( int iSprite, float *p1, float *p2, float *p3, float *p4 );\n} engine_studio_api_t;\n\ntypedef struct server_studio_api_s\n{\n\t// Allocate number*size bytes and zero it\n\tvoid\t\t\t*( *Mem_Calloc )\t\t\t\t( int number, size_t size );\n\t// Check to see if pointer is in the cache\n\tvoid\t\t\t*( *Cache_Check )\t\t\t\t( struct cache_user_s *c );\n\t// Load file into cache ( can be swapped out on demand )\n\tvoid\t\t\t( *LoadCacheFile )\t\t\t\t( char *path, struct cache_user_s *cu );\n\t// Retrieve pointer to studio model data block from a model\n\tvoid\t\t\t*( *Mod_Extradata )\t\t\t\t( struct model_s *mod );\n} server_studio_api_t;\n\n\n// client blending\ntypedef struct r_studio_interface_s\n{\n\tint\t\t\t\tversion;\n\tint\t\t\t\t( *StudioDrawModel\t)\t\t\t( int flags );\n\tint\t\t\t\t( *StudioDrawPlayer\t)\t\t\t( int flags, struct entity_state_s *pplayer );\n} r_studio_interface_t;\n\nextern r_studio_interface_t *pStudioAPI;\n\n// server blending\n#define SV_BLENDING_INTERFACE_VERSION 1\n\ntypedef struct sv_blending_interface_s\n{\n\tint\tversion;\n\n\tvoid\t( *SV_StudioSetupBones )( struct model_s *pModel, \n\t\t\t\t\tfloat frame,\n\t\t\t\t\tint sequence,\n\t\t\t\t\tconst vec3_t angles,\n\t\t\t\t\tconst vec3_t origin,\n\t\t\t\t\tconst byte *pcontroller,\n\t\t\t\t\tconst byte *pblending,\n\t\t\t\t\tint iBone,\n\t\t\t\t\tconst edict_t *pEdict );\n} sv_blending_interface_t;\n\n#endif // R_STUDIOINT_H\n"
  },
  {
    "path": "common/ref_params.h",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\n*\tThis product contains software technology licensed from Id\n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc.\n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n\n#ifndef REF_PARAMS_H\n#define REF_PARAMS_H\n\ntypedef struct ref_params_s\n{\n\t// output\n\tvec3_t\t\tvieworg;\n\tvec3_t\t\tviewangles;\n\n\tvec3_t\t\tforward;\n\tvec3_t\t\tright;\n\tvec3_t\t\tup;\n\n\t// Client frametime;\n\tfloat\t\tframetime;\n\t// Client time\n\tfloat\t\ttime;\n\n\t// Misc\n\tint\t\tintermission;\n\tint\t\tpaused;\n\tint\t\tspectator;\n\tint\t\tonground;\n\tint\t\twaterlevel;\n\n\tvec3_t\t\tsimvel;\n\tvec3_t\t\tsimorg;\n\n\tvec3_t\t\tviewheight;\n\tfloat\t\tidealpitch;\n\n\tvec3_t\t\tcl_viewangles;\n\tint\t\thealth;\n\tvec3_t\t\tcrosshairangle;\n\tfloat\t\tviewsize;\n\n\tvec3_t\t\tpunchangle;\n\tint\t\tmaxclients;\n\tint\t\tviewentity;\n\tint\t\tplayernum;\n\tint\t\tmax_entities;\n\tint\t\tdemoplayback;\n\tint\t\thardware;\n\tint\t\tsmoothing;\n\n\t// Last issued usercmd\n\tstruct usercmd_s\t*cmd;\n\n\t// Movevars\n\tstruct movevars_s\t*movevars;\n\n\tint\t\tviewport[4];\t// the viewport coordinates x, y, width, height\n\tint\t\tnextView;\t\t// the renderer calls ClientDLL_CalcRefdef() and Renderview\n\t\t\t\t\t// so long in cycles until this value is 0 (multiple views)\n\tint\t\tonlyClientDraw;\t// if !=0 nothing is drawn by the engine except clientDraw functions\n} ref_params_t;\n\n// same as ref_params but for overview mode\ntypedef struct ref_overview_s\n{\n\tvec3_t\t\torigin;\n\tqboolean\t\trotated;\n\n\tfloat\t\txLeft;\n\tfloat\t\txRight;\n\tfloat\t\tyTop;\n\tfloat\t\tyBottom;\n\tfloat\t\tzFar;\n\tfloat\t\tzNear;\n\tfloat\t\tflZoom;\n} ref_overview_t;\n\n// ref_viewpass_t->flags\n#define RF_DRAW_WORLD\t(1<<0)\t\t// pass should draw the world (otherwise it's player menu model)\n#define RF_DRAW_CUBEMAP\t(1<<1)\t\t// special 6x pass to render cubemap\\skybox sides\n#define RF_DRAW_OVERVIEW\t(1<<2)\t\t// overview mode is active\n#define RF_ONLY_CLIENTDRAW\t(1<<3)\t\t// nothing is drawn by the engine except clientDraw functions\n\n// intermediate struct for viewpass (or just a single frame)\ntypedef struct ref_viewpass_s\n{\n\tint\t\tviewport[4];\t// size of new viewport\n\tvec3_t\t\tvieworigin;\t// view origin\n\tvec3_t\t\tviewangles;\t// view angles\n\tint\t\tviewentity;\t// entitynum (P2: Savior uses this)\n\tfloat\t\tfov_x, fov_y;\t// vertical & horizontal FOV\n\tint\t\tflags;\t\t// if !=0 nothing is drawn by the engine except clientDraw functions\n} ref_viewpass_t;\n\n#endif//REF_PARAMS_H"
  },
  {
    "path": "common/render_api.h",
    "content": "/*\nrender_api.h - Xash3D extension for client interface\nCopyright (C) 2011 Uncle Mike\n\nThis program is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\nGNU General Public License for more details.\n*/\n\n#ifndef RENDER_API_H\n#define RENDER_API_H\n\n#include \"lightstyle.h\"\n#include \"dlight.h\"\n\n#define CL_RENDER_INTERFACE_VERSION\t37\t// Xash3D 1.0\n#define MAX_STUDIO_DECALS\t\t4096\t// + unused space of BSP decals\n\n// render info parms\n#define PARM_TEX_WIDTH\t1\t// all parms with prefix 'TEX_' receive arg as texnum\n#define PARM_TEX_HEIGHT\t2\t// otherwise it's not used\n#define PARM_TEX_SRC_WIDTH\t3\n#define PARM_TEX_SRC_HEIGHT\t4\n#define PARM_TEX_SKYBOX\t5\t// second arg as skybox ordering num\n#define PARM_TEX_SKYTEXNUM\t6\t// skytexturenum for quake sky\n#define PARM_TEX_LIGHTMAP\t7\t// second arg as number 0 - 128\n#define PARM_TEX_TARGET\t8\n#define PARM_TEX_TEXNUM\t9\n#define PARM_TEX_FLAGS\t10\n#define PARM_TEX_DEPTH\t11\t// 3D texture depth or 2D array num layers\n//reserved\n#define PARM_TEX_GLFORMAT\t13\t// get a texture GL-format\n#define PARM_TEX_ENCODE\t14\t// custom encoding for DXT image\n#define PARM_TEX_MIPCOUNT\t15\t// count of mipmaps (0 - autogenerated, 1 - disabled of mipmapping)\n#define PARM_BSP2_SUPPORTED\t16\t// tell custom renderer what engine is support BSP2 in this build\n#define PARM_SKY_SPHERE\t17\t// sky is quake sphere ?\n#define PARAM_GAMEPAUSED\t18\t// game is paused\n#define PARM_MAP_HAS_DELUXE\t19\t// map has deluxedata\n#define PARM_MAX_ENTITIES\t20\n#define PARM_WIDESCREEN\t21\n#define PARM_FULLSCREEN\t22\n#define PARM_SCREEN_WIDTH\t23\n#define PARM_SCREEN_HEIGHT\t24\n#define PARM_CLIENT_INGAME\t25\n#define PARM_FEATURES\t26\t// same as movevars->features\n#define PARM_ACTIVE_TMU\t27\t// for debug\n#define PARM_LIGHTSTYLEVALUE\t28\t// second arg is stylenum\n#define PARM_MAX_IMAGE_UNITS\t29\n#define PARM_CLIENT_ACTIVE\t30\n#define PARM_REBUILD_GAMMA\t31\t// if true lightmaps rebuilding for gamma change\n#define PARM_DEDICATED_SERVER\t32\n#define PARM_SURF_SAMPLESIZE\t33\t// lightmap resolution per face (second arg interpret as facenumber)\n#define PARM_GL_CONTEXT_TYPE\t34\t// opengl or opengles\n#define PARM_GLES_WRAPPER\t35\t//\n#define PARM_STENCIL_ACTIVE\t36\n#define PARM_WATER_ALPHA\t37\n#define PARM_TEX_MEMORY\t38\t// returns total memory of uploaded texture in bytes\n#define PARM_DELUXEDATA\t39\t// nasty hack, convert int to pointer\n#define PARM_SHADOWDATA\t40\t// nasty hack, convert int to pointer\n\n// skybox ordering\nenum\n{\n\tSKYBOX_RIGHT\t= 0,\n\tSKYBOX_BACK,\n\tSKYBOX_LEFT,\n\tSKYBOX_FORWARD,\n\tSKYBOX_UP,\n\tSKYBOX_DOWN,\n};\n\ntypedef enum\n{\n\tTF_COLORMAP\t= 0,\t\t// just for tabulate source\n\tTF_NEAREST\t= (1<<0),\t\t// disable texfilter\n\tTF_KEEP_SOURCE\t= (1<<1),\t\t// some images keep source\n\tTF_NOFLIP_TGA\t= (1<<2),\t\t// Steam background completely ignore tga attribute 0x20\n\tTF_EXPAND_SOURCE\t= (1<<3),\t\t// Don't keep source as 8-bit expand to RGBA\n// reserved\n\tTF_RECTANGLE\t= (1<<5),\t\t// this is GL_TEXTURE_RECTANGLE\n\tTF_CUBEMAP\t= (1<<6),\t\t// it's cubemap texture\n\tTF_DEPTHMAP\t= (1<<7),\t\t// custom texture filter used\n\tTF_QUAKEPAL\t= (1<<8),\t\t// image has an quake1 palette\n\tTF_LUMINANCE\t= (1<<9),\t\t// force image to grayscale\n\tTF_SKYSIDE\t= (1<<10),\t// this is a part of skybox\n\tTF_CLAMP\t\t= (1<<11),\t// clamp texcoords to [0..1] range\n\tTF_NOMIPMAP\t= (1<<12),\t// don't build mips for this image\n\tTF_HAS_LUMA\t= (1<<13),\t// sets by GL_UploadTexture\n\tTF_MAKELUMA\t= (1<<14),\t// create luma from quake texture (only q1 textures contain luma-pixels)\n\tTF_NORMALMAP\t= (1<<15),\t// is a normalmap\n\tTF_HAS_ALPHA\t= (1<<16),\t// image has alpha (used only for GL_CreateTexture)\n\tTF_FORCE_COLOR\t= (1<<17),\t// force upload monochrome textures as RGB (detail textures)\n\tTF_UPDATE\t\t= (1<<18),\t// allow to update already loaded texture\n\tTF_BORDER\t\t= (1<<19),\t// zero clamp for projected textures\n\tTF_TEXTURE_3D\t= (1<<20),\t// this is GL_TEXTURE_3D\n\tTF_ATLAS_PAGE\t= (1<<21),\t// bit who indicate lightmap page or deluxemap page\n\tTF_ALPHACONTRAST\t= (1<<22),\t// special texture mode for A2C\n// reserved\n// reserved\n\tTF_IMG_UPLOADED\t= (1<<25),\t// this is set for first time when called glTexImage, otherwise it will be call glTexSubImage\n\tTF_ARB_FLOAT\t= (1<<26),\t// float textures\n\tTF_NOCOMPARE\t= (1<<27),\t// disable comparing for depth textures\n\tTF_ARB_16BIT\t= (1<<28),\t// keep image as 16-bit (not 24)\n\tTF_MULTISAMPLE\t= (1<<29)\t// multisampling texture\n} texFlags_t;\n\ntypedef enum\n{\n\tCONTEXT_TYPE_GL = 0, // compatibility profile\n\tCONTEXT_TYPE_GLES_1_X,\n\tCONTEXT_TYPE_GLES_2_X,\n\tCONTEXT_TYPE_GL_CORE\n} gl_context_type_t;\n\ntypedef enum\n{\n\tGLES_WRAPPER_NONE = 0,\t\t// native GL\n\tGLES_WRAPPER_NANOGL,\t\t// used on GLES platforms\n\tGLES_WRAPPER_WES,\t\t// used on GLES platforms\n\tGLES_WRAPPER_GL4ES,\t\t// used on GLES platforms\n} gles_wrapper_t;\n\n// 30 bytes here\ntypedef struct modelstate_s\n{\n\tshort\t\tsequence;\n\tshort\t\tframe;\t\t// 10 bits multiple by 4, should be enough\n\tbyte\t\tblending[2];\n\tbyte\t\tcontroller[4];\n\tbyte\t\tposeparam[16];\n\tbyte\t\tbody;\n\tbyte\t\tskin;\n\tshort\t\tscale;\t\t// model scale (multiplied by 16)\n} modelstate_t;\n\ntypedef struct decallist_s\n{\n\tvec3_t\t\tposition;\n\tchar\t\tname[64];\n\tshort\t\tentityIndex;\n\tbyte\t\tdepth;\n\tbyte\t\tflags;\n\tfloat\t\tscale;\n\n\t// this is the surface plane that we hit so that\n\t// we can move certain decals across\n\t// transitions if they hit similar geometry\n\tvec3_t\t\timpactPlaneNormal;\n\n\tmodelstate_t\tstudio_state;\t// studio decals only\n} decallist_t;\n\nstruct ref_viewpass_s;\n\ntypedef struct render_api_s\n{\n\t// Get renderer info (doesn't changes engine state at all)\n\tintptr_t\t(*RenderGetParm)( int parm, int arg );\t// generic\n\tvoid\t\t(*GetDetailScaleForTexture)( int texture, float *xScale, float *yScale );\n\tvoid\t\t(*GetExtraParmsForTexture)( int texture, byte *red, byte *green, byte *blue, byte *alpha );\n\tlightstyle_t*\t(*GetLightStyle)( int number );\n\tdlight_t*\t\t(*GetDynamicLight)( int number );\n\tdlight_t*\t\t(*GetEntityLight)( int number );\n\tbyte\t\t(*LightToTexGamma)( byte color );\t// software gamma support\n\tfloat\t\t(*GetFrameTime)( void );\n\n\t// Set renderer info (tell engine about changes)\n\tvoid\t\t(*R_SetCurrentEntity)( struct cl_entity_s *ent ); // tell engine about both currententity and currentmodel\n\tvoid\t\t(*R_SetCurrentModel)( struct model_s *mod );\t// change currentmodel but leave currententity unchanged\n\tint\t\t(*R_FatPVS)( const float *org, float radius, byte *visbuffer, qboolean merge, qboolean fullvis );\n\tvoid\t\t(*R_StoreEfrags)( struct efrag_s **ppefrag, int framecount );// store efrags for static entities\n\n\t// Texture tools\n\tint\t\t(*GL_FindTexture)( const char *name );\n\tconst char*\t(*GL_TextureName)( unsigned int texnum );\n\tconst byte*\t(*GL_TextureData)( unsigned int texnum ); // may be NULL\n\tint\t\t(*GL_LoadTexture)( const char *name, const byte *buf, size_t size, int flags );\n\tint\t\t(*GL_CreateTexture)( const char *name, int width, int height, const void *buffer, texFlags_t flags );\n\tint\t\t(*GL_LoadTextureArray)( const char **names, int flags );\n\tint\t\t(*GL_CreateTextureArray)( const char *name, int width, int height, int depth, const void *buffer, texFlags_t flags );\n\tvoid\t\t(*GL_FreeTexture)( unsigned int texnum );\n\n\t// Decals manipulating (draw & remove)\n\tvoid\t\t(*DrawSingleDecal)( struct decal_s *pDecal, struct msurface_s *fa );\n\tfloat\t\t*(*R_DecalSetupVerts)( struct decal_s *pDecal, struct msurface_s *surf, int texture, int *outCount );\n\tvoid\t\t(*R_EntityRemoveDecals)( struct model_s *mod ); // remove all the decals from specified entity (BSP only)\n\n\t// AVIkit support\n\tvoid\t\t*(*AVI_LoadVideo)( const char *filename, qboolean load_audio );\n\tint\t\t(*AVI_GetVideoInfo)( void *Avi, int *xres, int *yres, float *duration ); // a1ba: changed longs to int\n\tint\t\t(*AVI_GetVideoFrameNumber)( void *Avi, float time );\n\tbyte\t\t*(*AVI_GetVideoFrame)( void *Avi, int frame );\n\tvoid\t\t(*AVI_UploadRawFrame)( int texture, int cols, int rows, int width, int height, const byte *data );\n\tvoid\t\t(*AVI_FreeVideo)( void *Avi );\n\tint\t\t(*AVI_IsActive)( void *Avi );\n\tvoid\t\t(*AVI_StreamSound)( void *Avi, int entnum, float fvol, float attn, float synctime );\n\tvoid\t\t(*AVI_Reserved0)( void );\t// for potential interface expansion without broken compatibility\n\tvoid\t\t(*AVI_Reserved1)( void );\n\n\t// glState related calls (must use this instead of normal gl-calls to prevent de-synchornize local states between engine and the client)\n\tvoid\t\t(*GL_Bind)( int tmu, unsigned int texnum );\n\tvoid\t\t(*GL_SelectTexture)( int tmu );\n\tvoid\t\t(*GL_LoadTextureMatrix)( const float *glmatrix );\n\tvoid\t\t(*GL_TexMatrixIdentity)( void );\n\tvoid\t\t(*GL_CleanUpTextureUnits)( int last );\t// pass 0 for clear all the texture units\n\tvoid\t\t(*GL_TexGen)( unsigned int coord, unsigned int mode );\n\tvoid\t\t(*GL_TextureTarget)( unsigned int target ); // change texture unit mode without bind texture\n\tvoid\t\t(*GL_TexCoordArrayMode)( unsigned int texmode );\n\tvoid*\t\t(*GL_GetProcAddress)( const char *name );\n\tvoid\t\t(*GL_UpdateTexSize)( int texnum, int width, int height, int depth ); // recalc statistics\n\tvoid\t\t(*GL_Reserved0)( void );\t// for potential interface expansion without broken compatibility\n\tvoid\t\t(*GL_Reserved1)( void );\n\n\t// Misc renderer functions\n\tvoid\t\t(*GL_DrawParticles)( const struct ref_viewpass_s *rvp, qboolean trans_pass, float frametime );\n\tvoid\t\t(*EnvShot)( const float *vieworg, const char *name, qboolean skyshot, int shotsize ); // store skybox into gfx\\env folder\n\tint\t\t(*SPR_LoadExt)( const char *szPicName, unsigned int texFlags ); // extended version of SPR_Load\n\tcolorVec\t\t(*LightVec)( const float *start, const float *end, float *lightspot, float *lightvec );\n\tstruct mstudiotex_s *( *StudioGetTexture )( struct cl_entity_s *e );\n\tconst struct ref_overview_s *( *GetOverviewParms )( void );\n\tconst char\t*( *GetFileByIndex )( int fileindex );\n\tint\t\t(*pfnSaveFile)( const char *filename, const void *data, int len );\n\tvoid\t\t(*R_Reserved0)( void );\n\n\t// static allocations\n\tvoid\t\t*(*pfnMemAlloc)( size_t cb, const char *filename, const int fileline );\n\tvoid\t\t(*pfnMemFree)( void *mem, const char *filename, const int fileline );\n\n \t// engine utils (not related with render API but placed here)\n\tchar\t\t**(*pfnGetFilesList)( const char *pattern, int *numFiles, int gamedironly );\n\tunsigned int\t(*pfnFileBufferCRC32)( const void *buffer, const int length );\n\tint\t\t(*COM_CompareFileTime)( const char *filename1, const char *filename2, int *iCompare );\n\tvoid\t\t(*Host_Error)( const char *error, ... ); // cause Host Error\n\tvoid*\t\t( *pfnGetModel )( int modelindex );\n\tfloat\t\t(*pfnTime)( void );\t\t\t\t// Sys_DoubleTime\n\tvoid\t\t(*Cvar_Set)( const char *name, const char *value );\n\tvoid\t\t(*S_FadeMusicVolume)( float fadePercent );\t// fade background track (0-100 percents)\n\t// a1ba: changed long to int\n\tvoid\t\t(*SetRandomSeed)( int lSeed );\t\t// set custom seed for RANDOM_FLOAT\\RANDOM_LONG for predictable random\n\t// ONLY ADD NEW FUNCTIONS TO THE END OF THIS STRUCT.  INTERFACE VERSION IS FROZEN AT 37\n} render_api_t;\n\n// render callbacks\ntypedef struct render_interface_s\n{\n\tint\t\tversion;\n\t// passed through R_RenderFrame (0 - use engine renderer, 1 - use custom client renderer)\n\tint\t\t(*GL_RenderFrame)( const struct ref_viewpass_s *rvp );\n\t// build all the lightmaps on new level or when gamma is changed\n\tvoid\t\t(*GL_BuildLightmaps)( void );\n\t// setup map bounds for ortho-projection when we in dev_overview mode\n\tvoid\t\t(*GL_OrthoBounds)( const float *mins, const float *maxs );\n\t// prepare studio decals for save\n\tint\t\t(*R_CreateStudioDecalList)( decallist_t *pList, int count );\n\t// clear decals by engine request (e.g. for demo recording or vid_restart)\n\tvoid\t\t(*R_ClearStudioDecals)( void );\n\t// grab r_speeds message\n\tqboolean\t(*R_SpeedsMessage)( char *out, size_t size );\n\t// alloc or destroy model custom data\n\tvoid\t\t(*Mod_ProcessUserData)( struct model_s *mod, qboolean create, const byte *buffer );\n\t// alloc or destroy entity custom data\n\tvoid\t\t(*R_ProcessEntData)( qboolean allocate );\n\t// get visdata for current frame from custom renderer\n\tbyte*\t\t(*Mod_GetCurrentVis)( void );\n\t// tell the renderer what new map is started\n\tvoid\t\t(*R_NewMap)( void );\n\t// clear the render entities before each frame\n\tvoid\t\t(*R_ClearScene)( void );\n\t// shuffle previous & next states for lerping\n\tvoid\t\t(*CL_UpdateLatchedVars)( struct cl_entity_s *e, qboolean reset );\n} render_interface_t;\n\n#endif//RENDER_API_H"
  },
  {
    "path": "common/screenfade.h",
    "content": "//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============\n//\n// Purpose: \n//\n// $NoKeywords: $\n//=============================================================================\n\n#if !defined( SCREENFADEH )\n#define SCREENFADEH\n#ifdef _WIN32\n#ifndef __MINGW32__\n#pragma once\n#endif /* not __MINGW32__ */\n#endif\n\ntypedef struct screenfade_s\n{\n\tfloat\t\tfadeSpeed;\t\t// How fast to fade (tics / second) (+ fade in, - fade out)\n\tfloat\t\tfadeEnd;\t\t// When the fading hits maximum\n\tfloat\t\tfadeTotalEnd;\t// Total End Time of the fade (used for FFADE_OUT)\n\tfloat\t\tfadeReset;\t\t// When to reset to not fading (for fadeout and hold)\n\tbyte\t\tfader, fadeg, fadeb, fadealpha;\t// Fade color\n\tint\t\t\tfadeFlags;\t\t// Fading flags\n} screenfade_t;\n\n#endif // !SCREENFADEH\n"
  },
  {
    "path": "common/studio_event.h",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\t\n*\tThis product contains software technology licensed from Id \n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc. \n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n#if !defined( STUDIO_EVENTH )\n#define STUDIO_EVENTH\n#ifdef _WIN32\n#ifndef __MINGW32__\n#pragma once\n#endif /* not __MINGW32__ */\n#endif\n\ntypedef struct mstudioevent_s\n{\n\tint \t\t\t\tframe;\n\tint\t\t\t\t\tevent;\n\tint\t\t\t\t\ttype;\n\tchar\t\t\t\toptions[64];\n} mstudioevent_t;\n\n#endif // STUDIO_EVENTH\n"
  },
  {
    "path": "common/triangleapi.h",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\t\n*\tThis product contains software technology licensed from Id \n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc. \n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n#if !defined( TRIANGLEAPIH )\n#define TRIANGLEAPIH\n#ifdef _WIN32\n#ifndef __MINGW32__\n#pragma once\n#endif /* not __MINGW32__ */\n#endif\n\ntypedef enum \n{\n\tTRI_FRONT = 0,\n\tTRI_NONE = 1,\n} TRICULLSTYLE;\n\n#define TRI_API_VERSION\t\t1\n\n#define TRI_TRIANGLES\t\t0\n#define TRI_TRIANGLE_FAN\t1\n#define TRI_QUADS\t\t\t2\n#define TRI_POLYGON\t\t\t3\n#define TRI_LINES\t\t\t4\t\n#define TRI_TRIANGLE_STRIP\t5\n#define TRI_QUAD_STRIP\t\t6\n#define TRI_POINTS\t\t\t7 // Xash3D added\n\ntypedef struct triangleapi_s\n{\n\tint\t\t\tversion;\n\n\tvoid\t\t( *RenderMode )( int mode );\n\tvoid\t\t( *Begin )( int primitiveCode );\n\tvoid\t\t( *End ) ( void );\n\n\tvoid\t\t( *Color4f ) ( float r, float g, float b, float a );\n\tvoid\t\t( *Color4ub ) ( unsigned char r, unsigned char g, unsigned char b, unsigned char a );\n\tvoid\t\t( *TexCoord2f ) ( float u, float v );\n\tvoid\t\t( *Vertex3fv ) ( float *worldPnt );\n\tvoid\t\t( *Vertex3f ) ( float x, float y, float z );\n\tvoid\t\t( *Brightness ) ( float brightness );\n\tvoid\t\t( *CullFace ) ( TRICULLSTYLE style );\n\tint\t\t\t( *SpriteTexture ) ( struct model_s *pSpriteModel, int frame );\n\tint\t\t\t( *WorldToScreen ) ( float *world, float *screen );  // Returns 1 if it's z clipped\n\tvoid\t\t( *Fog ) ( float flFogColor[3], float flStart, float flEnd, int bOn ); //Works just like GL_FOG, flFogColor is r/g/b.\n\tvoid\t\t( *ScreenToWorld ) ( float *screen, float *world  ); \n\tvoid\t(*GetMatrix)( const int pname, float *matrix );\n\tint\t(*BoxInPVS)( float *mins, float *maxs );\n\tvoid\t(*LightAtPoint)( float *pos, float *value );\n\tvoid\t(*Color4fRendermode)( float r, float g, float b, float a, int rendermode );\n\tvoid\t(*FogParams)( float flDensity, int iFogSkybox );\n\n\n} triangleapi_t;\n\n#endif // !TRIANGLEAPIH\n"
  },
  {
    "path": "common/usercmd.h",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\t\n*\tThis product contains software technology licensed from Id \n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc. \n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n#ifndef USERCMD_H\n#define USERCMD_H\n#ifdef _WIN32\n#ifndef __MINGW32__\n#pragma once\n#endif /* not __MINGW32__ */\n#endif\n\ntypedef struct usercmd_s\n{\n\tshort\tlerp_msec;      // Interpolation time on client\n\tbyte\tmsec;           // Duration in ms of command\n\tvec3_t\tviewangles;     // Command view angles.\n\n// intended velocities\n\tfloat\tforwardmove;    // Forward velocity.\n\tfloat\tsidemove;       // Sideways velocity.\n\tfloat\tupmove;         // Upward velocity.\n\tbyte\tlightlevel;     // Light level at spot where we are standing.\n\tunsigned short  buttons;  // Attack buttons\n\tbyte    impulse;          // Impulse command issued.\n\tbyte\tweaponselect;\t// Current weapon id\n\n// Experimental player impact stuff.\n\tint\t\timpact_index;\n\tvec3_t\timpact_position;\n} usercmd_t;\n\n#endif // USERCMD_H\n"
  },
  {
    "path": "common/weaponinfo.h",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\t\n*\tThis product contains software technology licensed from Id \n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc. \n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n#if !defined ( WEAPONINFOH )\n#define WEAPONINFOH\n#ifdef _WIN32\n#ifndef __MINGW32__\n#pragma once\n#endif /* not __MINGW32__ */\n#endif\n\n// Info about weapons player might have in his/her possession\ntypedef struct weapon_data_s\n{\n\tint\t\t\tm_iId;\n\tint\t\t\tm_iClip;\n\n\tfloat\t\tm_flNextPrimaryAttack;\n\tfloat\t\tm_flNextSecondaryAttack;\n\tfloat\t\tm_flTimeWeaponIdle;\n\n\tint\t\t\tm_fInReload;\n\tint\t\t\tm_fInSpecialReload;\n\tfloat\t\tm_flNextReload;\n\tfloat\t\tm_flPumpTime;\n\tfloat\t\tm_fReloadTime;\n\n\tfloat\t\tm_fAimedDamage;\n\tfloat\t\tm_fNextAimBonus;\n\tint\t\t\tm_fInZoom;\n\tint\t\t\tm_iWeaponState;\n\n\tint\t\t\tiuser1;\n\tint\t\t\tiuser2;\n\tint\t\t\tiuser3;\n\tint\t\t\tiuser4;\n\tfloat\t\tfuser1;\n\tfloat\t\tfuser2;\n\tfloat\t\tfuser3;\n\tfloat\t\tfuser4;\n} weapon_data_t;\n\n#endif\n"
  },
  {
    "path": "common/wrect.h",
    "content": "/*\nwrect.h - rectangle definition\nCopyright (C) 2010 Uncle Mike\n\nThis program is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\nGNU General Public License for more details.\n*/\n\n#ifndef WRECT_H\n#define WRECT_H\n\ntypedef struct wrect_s\n{\n\tint\tleft, right, top, bottom;\n} wrect_t;\n\n#endif//WRECT_H"
  },
  {
    "path": "common/xash3d_types.h",
    "content": "// basic typedefs\n#ifndef XASH_TYPES_H\n#define XASH_TYPES_H\n\n#include \"build.h\"\n\n#if XASH_IRIX\n#include <port.h>\n#endif\n\n#if XASH_WIN32\n#include <wchar.h> // off_t\n#endif // _WIN32\n\n#include <sys/types.h> // off_t\n#include STDINT_H\n#include <assert.h>\n\ntypedef uint8_t  byte;\ntypedef float    vec_t;\ntypedef vec_t    vec2_t[2];\ntypedef vec_t    vec3_t[3];\ntypedef vec_t    vec4_t[4];\ntypedef vec_t    quat_t[4];\ntypedef byte     rgba_t[4];\t// unsigned byte colorpack\ntypedef byte     rgb_t[3];\t\t// unsigned byte colorpack\ntypedef vec_t    matrix3x4[3][4];\ntypedef vec_t    matrix4x4[4][4];\ntypedef uint32_t poolhandle_t;\n\n#undef true\n#undef false\n\n// true and false are keywords in C++ and C23\n#if !__cplusplus &&  __STDC_VERSION__ < 202311L\nenum { false, true };\n#endif\ntypedef int qboolean;\n\n#define MAX_STRING    256  // generic string\n#define MAX_VA_STRING 1024 // compatibility macro\n#define MAX_SYSPATH   1024 // system filepath\n#define MAX_MODS      512  // environment games that engine can keep visible\n\n#define BIT( n )\t\t( 1U << ( n ))\n#define BIT64( n )\t\t( 1ULL << ( n ))\n#define SetBits( iBitVector, bits )\t((iBitVector) = (iBitVector) | (bits))\n#define ClearBits( iBitVector, bits )\t((iBitVector) = (iBitVector) & ~(bits))\n#define FBitSet( iBitVector, bit )\t((iBitVector) & (bit))\n\n#ifndef __cplusplus\n#ifdef NULL\n#undef NULL\n#endif\n\n#define NULL\t\t((void *)0)\n#endif\n\n// color strings\n#define IsColorString( p )\t( p && *( p ) == '^' && *(( p ) + 1) && *(( p ) + 1) >= '0' && *(( p ) + 1 ) <= '9' )\n#define ColorIndex( c )\t((( c ) - '0' ) & 7 )\n\n#if defined( __GNUC__ )\n\t#if defined( __i386__ )\n\t\t#define EXPORT         __attribute__(( visibility( \"default\" ), force_align_arg_pointer ))\n\t\t#define GAME_EXPORT    __attribute__(( force_align_arg_pointer ))\n\t#else\n\t\t#define EXPORT         __attribute__(( visibility ( \"default\" )))\n\t\t#define GAME_EXPORT\n\t#endif\n\n\t#define MALLOC __attribute__(( malloc ))\n\n\t// added in GCC 11\n\t#if __GNUC__ >= 11\n\t\t// might want to set noclone due to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116893\n\t\t// but it's easier to not force mismatched-dealloc to error yet\n\t\t#define MALLOC_LIKE( x, y ) __attribute__(( malloc( x, y )))\n\t#else\n\t\t#define MALLOC_LIKE( x, y ) MALLOC\n\t#endif\n\t#define NORETURN           __attribute__(( noreturn ))\n\t#define NONNULL            __attribute__(( nonnull ))\n\t#define RETURNS_NONNULL    __attribute__(( returns_nonnull ))\n\t#if __clang__\n\t\t#define PFN_RETURNS_NONNULL // clang has bugged returns_nonnull for functions pointers, it's ignored and generates a warning about objective-c? O_o\n\t#else\n\t\t#define PFN_RETURNS_NONNULL RETURNS_NONNULL\n\t#endif\n\t#define FORMAT_CHECK( x )  __attribute__(( format( printf, x, x + 1 )))\n\t#define ALLOC_CHECK( x )   __attribute__(( alloc_size( x )))\n\t#define NO_ASAN            __attribute__(( no_sanitize( \"address\" )))\n\t#define WARN_UNUSED_RESULT __attribute__(( warn_unused_result ))\n\t#define RENAME_SYMBOL( x ) asm( x )\n#else\n\t#if defined( _MSC_VER )\n\t\t#define EXPORT         __declspec( dllexport )\n\t\t#define NO_ASAN        __declspec( no_sanitize_address )\n\t#else\n\t\t#define EXPORT\n\t\t#define NO_ASAN\n\t#endif\n\t#define GAME_EXPORT\n\t#define NORETURN\n\t#define NONNULL\n\t#define RETURNS_NONNULL\n\t#define PFN_RETURNS_NONNULL\n\t#define FORMAT_CHECK( x )\n\t#define ALLOC_CHECK( x )\n\t#define RENAME_SYMBOL( x )\n\t#define MALLOC\n\t#define MALLOC_LIKE( x, y )\n\t#define WARN_UNUSED_RESULT\n#endif\n\n#if defined( __has_feature )\n\t#if __has_feature( address_sanitizer )\n\t\t#define USE_ASAN 1\n\t#endif // __has_feature\n#endif // defined( __has_feature )\n\n#if !defined( USE_ASAN ) && defined( __SANITIZE_ADDRESS__ )\n#define USE_ASAN 1\n#endif\n\n#if __GNUC__ >= 3\n\t#define unlikely( x )     __builtin_expect( x, 0 )\n\t#define likely( x )       __builtin_expect( x, 1 )\n#elif defined( __has_builtin )\n\t#if __has_builtin( __builtin_expect ) // this must be after defined() check\n\t\t#define unlikely( x )     __builtin_expect( x, 0 )\n\t\t#define likely( x )       __builtin_expect( x, 1 )\n\t#endif\n#endif\n\n#if !defined( unlikely ) || !defined( likely )\n\t#define unlikely( x ) ( x )\n\t#define likely( x )   ( x )\n#endif\n\n#if __STDC_VERSION__ >= 202311L || __cplusplus >= 201103L // C23 or C++ static_assert is a keyword\n\t#define STATIC_ASSERT_( ignore, x, y ) static_assert( x, y )\n\t#define STATIC_ASSERT  static_assert\n#elif __STDC_VERSION__ >= 201112L // in C11 it's _Static_assert\n\t#define STATIC_ASSERT_( ignore, x, y ) _Static_assert( x, y )\n\t#define STATIC_ASSERT  _Static_assert\n#else\n\t#define STATIC_ASSERT_( id, x, y ) extern int id[( x ) ? 1 : -1]\n\t// need these to correctly expand the line macro\n\t#define STATIC_ASSERT_3( line, x, y ) STATIC_ASSERT_( static_assert_ ## line, x, y )\n\t#define STATIC_ASSERT_2( line, x, y ) STATIC_ASSERT_3( line, x, y )\n\t#define STATIC_ASSERT( x, y ) STATIC_ASSERT_2( __LINE__, x, y )\n#endif\n\n// at least, statically check size of some public structures\n#if XASH_64BIT\n#define STATIC_CHECK_SIZEOF( type, size32, size64 ) \\\n\tSTATIC_ASSERT( sizeof( type ) == size64, #type \" unexpected size\" )\n#else\n#define STATIC_CHECK_SIZEOF( type, size32, size64 ) \\\n\tSTATIC_ASSERT( sizeof( type ) == size32, #type \" unexpected size\" )\n#endif\n\n#if !defined( __cplusplus ) && __STDC_VERSION__ >= 199101L // not C++ and C99 or newer\n\t#define XASH_RESTRICT restrict\n#elif _MSC_VER || __GNUC__ || __clang__ // compiler-specific extensions\n\t#define XASH_RESTRICT __restrict\n#else\n\t#define XASH_RESTRICT // nothing\n#endif\n\n#ifdef XASH_BIG_ENDIAN\n#define LittleLong(x) (((int)(((x)&255)<<24)) + ((int)((((x)>>8)&255)<<16)) + ((int)(((x)>>16)&255)<<8) + (((x) >> 24)&255))\n#define LittleLongSW(x) (x = LittleLong(x) )\n#define LittleShort(x) ((short)( (((short)(x) >> 8) & 255) + (((short)(x) & 255) << 8)))\n#define LittleShortSW(x) (x = LittleShort(x) )\n_inline float LittleFloat( float f )\n{\n\tunion\n\t{\n\t\tfloat f;\n\t\tunsigned char b[4];\n\t} dat1, dat2;\n\n\tdat1.f = f;\n\tdat2.b[0] = dat1.b[3];\n\tdat2.b[1] = dat1.b[2];\n\tdat2.b[2] = dat1.b[1];\n\tdat2.b[3] = dat1.b[0];\n\n\treturn dat2.f;\n}\n#else\n#define LittleLong(x) (x)\n#define LittleLongSW(x)\n#define LittleShort(x) (x)\n#define LittleShortSW(x)\n#define LittleFloat(x) (x)\n#endif\n\n\ntypedef unsigned int dword;\ntypedef unsigned int uint;\ntypedef char         string[MAX_STRING];\ntypedef off_t        fs_offset_t;\n#if XASH_WIN32\ntypedef int          fs_size_t; // return type of _read, _write funcs\n#else /* !XASH_WIN32 */\ntypedef ssize_t      fs_size_t;\n#endif /* !XASH_WIN32 */\n\ntypedef void *(*pfnCreateInterface_t)( const char *, int * );\n\n// config strings are a general means of communication from\n// the server to all connected clients.\n// each config string can be at most CS_SIZE characters.\n#if XASH_LOW_MEMORY == 0\n#define MAX_QPATH\t\t64\t// max length of a game pathname\n#elif XASH_LOW_MEMORY == 2\n#define MAX_QPATH\t\t32 // should be enough for singleplayer\n#elif XASH_LOW_MEMORY == 1\n#define MAX_QPATH 48\n#endif\n#define MAX_OSPATH\t\t260\t// max length of a filesystem pathname\n#define CS_SIZE\t\t64\t// size of one config string\n#define CS_TIME\t\t16\t// size of time string\n\n#endif // XASH_TYPES_H"
  },
  {
    "path": "dlls/activity.h",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\n*\tThis product contains software technology licensed from Id\n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc.\n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n#ifndef ACTIVITY_H\n#define ACTIVITY_H\n\ntypedef enum\n{\n\tACT_RESET,\n\tACT_IDLE,\n\tACT_GUARD,\n\tACT_WALK,\n\tACT_RUN,\n\tACT_FLY,\n\tACT_SWIM,\n\tACT_HOP,\n\tACT_LEAP,\n\tACT_FALL,\n\tACT_LAND,\n\tACT_STRAFE_LEFT,\n\tACT_STRAFE_RIGHT,\n\tACT_ROLL_LEFT,\n\tACT_ROLL_RIGHT,\n\tACT_TURN_LEFT,\n\tACT_TURN_RIGHT,\n\tACT_CROUCH,\n\tACT_CROUCHIDLE,\n\tACT_STAND,\n\tACT_USE,\n\tACT_SIGNAL1,\n\tACT_SIGNAL2,\n\tACT_SIGNAL3,\n\tACT_TWITCH,\n\tACT_COWER,\n\tACT_SMALL_FLINCH,\n\tACT_BIG_FLINCH,\n\tACT_RANGE_ATTACK1,\n\tACT_RANGE_ATTACK2,\n\tACT_MELEE_ATTACK1,\n\tACT_MELEE_ATTACK2,\n\tACT_RELOAD,\n\tACT_ARM,\n\tACT_DISARM,\n\tACT_EAT,\n\tACT_DIESIMPLE,\n\tACT_DIEBACKWARD,\n\tACT_DIEFORWARD,\n\tACT_DIEVIOLENT,\n\tACT_BARNACLE_HIT,\n\tACT_BARNACLE_PULL,\n\tACT_BARNACLE_CHOMP,\n\tACT_BARNACLE_CHEW,\n\tACT_SLEEP,\n\tACT_INSPECT_FLOOR,\n\tACT_INSPECT_WALL,\n\tACT_IDLE_ANGRY,\n\tACT_WALK_HURT,\n\tACT_RUN_HURT,\n\tACT_HOVER,\n\tACT_GLIDE,\n\tACT_FLY_LEFT,\n\tACT_FLY_RIGHT,\n\tACT_DETECT_SCENT,\n\tACT_SNIFF,\n\tACT_BITE,\n\tACT_THREAT_DISPLAY,\n\tACT_FEAR_DISPLAY,\n\tACT_EXCITED,\n\tACT_SPECIAL_ATTACK1,\n\tACT_SPECIAL_ATTACK2,\n\tACT_COMBAT_IDLE,\n\tACT_WALK_SCARED,\n\tACT_RUN_SCARED,\n\tACT_VICTORY_DANCE,\n\tACT_DIE_HEADSHOT,\n\tACT_DIE_CHESTSHOT,\n\tACT_DIE_GUTSHOT,\n\tACT_DIE_BACKSHOT,\n\tACT_FLINCH_HEAD,\n\tACT_FLINCH_CHEST,\n\tACT_FLINCH_STOMACH,\n\tACT_FLINCH_LEFTARM,\n\tACT_FLINCH_RIGHTARM,\n\tACT_FLINCH_LEFTLEG,\n\tACT_FLINCH_RIGHTLEG,\n\tACT_FLINCH,\n\tACT_LARGE_FLINCH,\n\tACT_HOLDBOMB,\n\tACT_IDLE_FIDGET,\n\tACT_IDLE_SCARED,\n\tACT_IDLE_SCARED_FIDGET,\n\tACT_FOLLOW_IDLE,\n\tACT_FOLLOW_IDLE_FIDGET,\n\tACT_FOLLOW_IDLE_SCARED,\n\tACT_FOLLOW_IDLE_SCARED_FIDGET,\n\tACT_CROUCH_IDLE,\n\tACT_CROUCH_IDLE_FIDGET,\n\tACT_CROUCH_IDLE_SCARED,\n\tACT_CROUCH_IDLE_SCARED_FIDGET,\n\tACT_CROUCH_WALK,\n\tACT_CROUCH_WALK_SCARED,\n\tACT_CROUCH_DIE,\n\tACT_WALK_BACK,\n\tACT_IDLE_SNEAKY,\n\tACT_IDLE_SNEAKY_FIDGET,\n\tACT_WALK_SNEAKY,\n\tACT_WAVE,\n\tACT_YES,\n\tACT_NO\n}\nActivity;\n\ntypedef struct\n{\n\tint type;\n\tchar *name;\n}\nactivity_map_t;\n\nextern activity_map_t activity_map[];\n#endif"
  },
  {
    "path": "dlls/basemonster.h",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\n*\tThis product contains software technology licensed from Id\n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc.\n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n#ifndef BASEMONSTER_H\n#define BASEMONSTER_H\n\nclass CBaseMonster : public CBaseToggle\n{\npublic:\n\tvirtual void KeyValue(KeyValueData *pkvd) { }\n\tvirtual float ChangeYaw(int speed) { return 0; }\n\tvirtual BOOL HasHumanGibs(void) { return FALSE; }\n\tvirtual BOOL HasAlienGibs(void) { return FALSE; }\n\tvirtual void FadeMonster(void) { }\n\tvirtual void GibMonster(void) { }\n\tvirtual Activity GetDeathActivity(void) { return ACT_DIE_HEADSHOT; }\n\tvirtual void BecomeDead(void) { }\n\tvirtual BOOL ShouldFadeOnDeath(void) { return FALSE; }\n\tvirtual int IRelationship(CBaseEntity *pTarget) { return 0; }\n\tvirtual int TakeHealth(float flHealth, int bitsDamageType) { return 0; }\n\tvirtual int TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) { return 0; }\n\tvirtual void Killed(entvars_t *pevAttacker, int iGib) { }\n\tvirtual void PainSound(void) { return; }\n\tvirtual void ResetMaxSpeed(void) {}\n\tvirtual void ReportAIState(void) { }\n\tvirtual void MonsterInitDead(void) { }\n\tvirtual void Look(int iDistance) { }\n\tvirtual CBaseEntity *BestVisibleEnemy(void) { return NULL; }\n\tvirtual BOOL FInViewCone(CBaseEntity *pEntity) { return FALSE; }\n\tvirtual BOOL FInViewCone(Vector *pOrigin) { return FALSE; }\n\tvirtual int BloodColor(void) { return m_bloodColor; }\n\tvirtual BOOL IsAlive(void) { return (pev->deadflag != DEAD_DEAD); }\n\npublic:\n\tvoid MakeIdealYaw(Vector vecTarget);\n\tActivity GetSmallFlinchActivity(void);\n\tBOOL ShouldGibMonster(int iGib);\n\tvoid CallGibMonster(void);\n\tBOOL FCheckAITrigger(void);\n\tint DeadTakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType);\n\tfloat DamageForce(float damage);\n\tvoid RadiusDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int iClassIgnore, int bitsDamageType);\n\tvoid RadiusDamage(Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int iClassIgnore, int bitsDamageType);\n\tvoid EXPORT CorpseFallThink(void);\n\tCBaseEntity *CheckTraceHullAttack(float flDist, int iDamage, int iDmgType);\n\tvoid TraceAttack(entvars_t *pevAttacker, float flDamage, const Vector &vecDir, TraceResult *ptr, int bitsDamageType) {}\n\tvoid MakeDamageBloodDecal(int cCount, float flNoise, TraceResult *ptr, const Vector &vecDir);\n\tvoid BloodSplat(const Vector &vecPos, const Vector &vecDir, int hitgroup, int iDamage);\n\npublic:\n\tinline void SetConditions(int iConditions) { m_afConditions |= iConditions; }\n\tinline void ClearConditions(int iConditions) { m_afConditions &= ~iConditions; }\n\tinline BOOL HasConditions(int iConditions) { if (m_afConditions & iConditions) return TRUE; return FALSE; }\n\tinline BOOL HasAllConditions(int iConditions) { if ((m_afConditions & iConditions) == iConditions) return TRUE; return FALSE; }\n\tinline void Remember(int iMemory) { m_afMemory |= iMemory; }\n\tinline void Forget(int iMemory) { m_afMemory &= ~iMemory; }\n\tinline BOOL HasMemory(int iMemory) { if (m_afMemory & iMemory) return TRUE; return FALSE; }\n\tinline BOOL HasAllMemories(int iMemory) { if ((m_afMemory & iMemory) == iMemory) return TRUE; return FALSE; }\n\tinline void StopAnimation(void) { pev->framerate = 0; }\n\npublic:\n\tActivity m_Activity;\n\tActivity m_IdealActivity;\n\tint m_LastHitGroup;\n\tint m_bitsDamageType;\n\tBYTE m_rgbTimeBasedDamage[CDMG_TIMEBASED];\n\tMONSTERSTATE m_MonsterState;\n\tMONSTERSTATE m_IdealMonsterState;\n\tint m_afConditions;\n\tint m_afMemory;\n\tfloat m_flNextAttack;\n\tEHANDLE m_hEnemy;\n\tEHANDLE m_hTargetEnt;\n\tfloat m_flFieldOfView;\n\tint m_bloodColor;\n\tVector m_HackedGunPos;\n\tVector m_vecEnemyLKP;\n};\n#endif\n"
  },
  {
    "path": "dlls/cbase.h",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\n*\tThis product contains software technology licensed from Id\n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc.\n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n\n#define FCAP_CUSTOMSAVE 0x00000001\n#define FCAP_ACROSS_TRANSITION 0x00000002\n#define FCAP_MUST_SPAWN 0x00000004\n#define FCAP_DONT_SAVE 0x80000000\n#define FCAP_IMPULSE_USE 0x00000008\n#define FCAP_CONTINUOUS_USE 0x00000010\n#define FCAP_ONOFF_USE 0x00000020\n#define FCAP_DIRECTIONAL_USE 0x00000040\n#define FCAP_MASTER 0x00000080\n#define FCAP_FORCE_TRANSITION 0x00000080\n#include \"port.h\"\n\n#include \"saverestore.h\"\n#include \"schedule.h\"\n\n#ifndef MONSTEREVENT_H\n#include \"monsterevent.h\"\n#endif\n\n#undef CREATE_NAMED_ENTITY\n#undef REMOVE_ENTITY\n\nedict_t *CREATE_NAMED_ENTITY(int iClass);\nvoid REMOVE_ENTITY(edict_t *e);\nvoid CONSOLE_ECHO(char *pszMsg, ...);\nvoid CONSOLE_ECHO_LOGGED(char *pszMsg, ...);\n\n#include \"exportdef.h\"\n\nextern \"C\" EXPORT int GetEntityAPI(DLL_FUNCTIONS *pFunctionTable, int interfaceVersion);\nextern \"C\" EXPORT int GetEntityAPI2(DLL_FUNCTIONS *pFunctionTable, int *interfaceVersion);\nextern \"C\" EXPORT int GetNewDLLFunctions(NEW_DLL_FUNCTIONS *pFunctionTable, int *interfaceVersion);\n\ntypedef enum\n{\n\tCLASSNAME\n}\nhash_types_e;\n\ntypedef struct hash_item_s\n{\n\tentvars_t *pev;\n\tstruct hash_item_s *next;\n\tstruct hash_item_s *lastHash;\n\tint pevIndex;\n}\nhash_item_t;\n\nint CaseInsensitiveHash(const char *string, int iBounds);\nvoid EmptyEntityHashTable(void);\nvoid AddEntityHashValue(struct entvars_s *pev, const char *value, hash_types_e fieldType);\nvoid RemoveEntityHashValue(struct entvars_s *pev, const char *value, hash_types_e fieldType);\nvoid printEntities(void);\nvoid loopPerformance(void);\n#ifdef CLIENT_DLL\nvoid Broadcast( const char*, int );\n#endif\n\n\nextern int DispatchSpawn(edict_t *pent);\nextern void DispatchKeyValue(edict_t *pentKeyvalue, KeyValueData *pkvd);\nextern void DispatchTouch(edict_t *pentTouched, edict_t *pentOther);\nextern void DispatchUse(edict_t *pentUsed, edict_t *pentOther);\nextern void DispatchThink(edict_t *pent);\nextern void DispatchBlocked(edict_t *pentBlocked, edict_t *pentOther);\nextern void DispatchSave(edict_t *pent, SAVERESTOREDATA *pSaveData);\nextern int DispatchRestore(edict_t *pent, SAVERESTOREDATA *pSaveData, int globalEntity);\nextern void DispatchObjectCollsionBox(edict_t *pent);\nextern void SaveWriteFields(SAVERESTOREDATA *pSaveData, const char *pname, void *pBaseData, TYPEDESCRIPTION *pFields, int fieldCount);\nextern void SaveReadFields(SAVERESTOREDATA *pSaveData, const char *pname, void *pBaseData, TYPEDESCRIPTION *pFields, int fieldCount);\nextern void SaveGlobalState(SAVERESTOREDATA *pSaveData);\nextern void RestoreGlobalState(SAVERESTOREDATA *pSaveData);\nextern void ResetGlobalState(void);\n\ntypedef enum\n{\n\tUSE_OFF,\n\tUSE_ON,\n\tUSE_SET,\n\tUSE_TOGGLE\n}\nUSE_TYPE;\n\nextern void FireTargets(const char *targetName, CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);\n\ntypedef void (CBaseEntity::*BASEPTR)(void);\ntypedef void (CBaseEntity::*ENTITYFUNCPTR)(CBaseEntity *pOther);\ntypedef void (CBaseEntity::*USEPTR)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);\n\n#define CLASS_NONE 0\n#define CLASS_MACHINE 1\n#define CLASS_PLAYER 2\n#define CLASS_HUMAN_PASSIVE 3\n#define CLASS_HUMAN_MILITARY 4\n#define CLASS_ALIEN_MILITARY 5\n#define CLASS_ALIEN_PASSIVE 6\n#define CLASS_ALIEN_MONSTER 7\n#define CLASS_ALIEN_PREY 8\n#define CLASS_ALIEN_PREDATOR 9\n#define CLASS_INSECT 10\n#define CLASS_PLAYER_ALLY 11\n#define CLASS_PLAYER_BIOWEAPON 12\n#define CLASS_ALIEN_BIOWEAPON 13\n#define CLASS_VEHICLE 14\n#define CLASS_BARNACLE 99\n\nclass CBaseEntity;\nclass CBaseMonster;\nclass CBasePlayerItem;\nclass CSquadMonster;\n\n#define SF_NORESPAWN (1<<30)\n\nclass EHANDLE\n{\npublic:\n\tedict_t *Get(void);\n\tedict_t *Set(edict_t *pent);\n\n\toperator int ();\n\toperator CBaseEntity *();\n\n\tCBaseEntity *operator = (CBaseEntity *pEntity);\n\tCBaseEntity *operator ->();\n\nprivate:\n\tedict_t *m_pent;\n\tint m_serialnumber;\n};\n\nclass CBaseEntity\n{\npublic:\n\tvirtual void Spawn(void) {}\n\tvirtual void Precache(void) {}\n\tvirtual void Restart(void) {}\n\tvirtual void KeyValue(KeyValueData *pkvd) { pkvd->fHandled = FALSE; }\n\tvirtual int Save(CSave &save) { return 1; }\n\tvirtual int Restore(CRestore &restore) { return 1; }\n\tvirtual int ObjectCaps(void) { return FCAP_ACROSS_TRANSITION; }\n\tvirtual void Activate(void) {}\n\tvirtual void SetObjectCollisionBox(void) {}\n\tvirtual int Classify(void) { return CLASS_NONE; }\n\tvirtual void DeathNotice(entvars_t *pevChild) {}\n\tvirtual void TraceAttack(entvars_t *pevAttacker, float flDamage, const Vector &vecDir, TraceResult *ptr, int bitsDamageType) { }\n\tvirtual int TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) { return 1; }\n\tvirtual int TakeHealth(float flHealth, int bitsDamageType) { return 1; }\n\tvirtual void Killed(entvars_t *pevAttacker, int iGib);\n\tvirtual int BloodColor(void) { return DONT_BLEED; }\n\tvirtual void TraceBleed(float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType) { }\n\tvirtual BOOL IsTriggered(CBaseEntity *pActivator) { return TRUE; }\n\tvirtual CBaseMonster *MyMonsterPointer(void) { return NULL; }\n\tvirtual CSquadMonster *MySquadMonsterPointer(void) { return NULL; }\n\tvirtual int GetToggleState(void) { return TS_AT_TOP; }\n\tvirtual void AddPoints(int score, BOOL bAllowNegativeScore) {}\n\tvirtual void AddPointsToTeam(int score, BOOL bAllowNegativeScore) {}\n\tvirtual BOOL AddPlayerItem(CBasePlayerItem *pItem) { return 0; }\n\tvirtual BOOL RemovePlayerItem(CBasePlayerItem *pItem) { return 0; }\n\tvirtual int GiveAmmo(int iAmount, char *szName, int iMax) { return -1; }\n\tvirtual float GetDelay(void) { return 0; }\n\tvirtual int IsMoving(void) { return pev->velocity != g_vecZero; }\n\tvirtual void OverrideReset(void) {}\n\tvirtual int DamageDecal(int bitsDamageType) { return -1; }\n\tvirtual void SetToggleState(int state) {}\n\tvirtual void StartSneaking(void) {}\n\tvirtual void StopSneaking(void) {}\n\tvirtual BOOL OnControls(entvars_t *onpev) { return FALSE; }\n\tvirtual BOOL IsSneaking(void) { return FALSE; }\n\tvirtual BOOL IsAlive(void) { return (pev->deadflag == DEAD_NO) && pev->health > 0; }\n\tvirtual BOOL IsBSPModel(void) { return pev->solid == SOLID_BSP || pev->movetype == MOVETYPE_PUSHSTEP; }\n\tvirtual BOOL ReflectGauss(void) { return IsBSPModel() && !pev->takedamage; }\n\tvirtual BOOL HasTarget(string_t targetname) { return FStrEq(STRING(targetname), STRING(pev->targetname)); }\n\tvirtual BOOL IsInWorld(void) { return TRUE; }\n\tvirtual BOOL IsPlayer(void) { return FALSE; }\n\tvirtual BOOL IsNetClient(void) { return FALSE; }\n\tvirtual const char *TeamID(void) { return \"\"; }\n\tvirtual CBaseEntity *GetNextTarget(void) { return 0; }\n\tvirtual void Think(void) { if (m_pfnThink) (this->*m_pfnThink)(); }\n\tvirtual void Touch(CBaseEntity *pOther) { if (m_pfnTouch) (this->*m_pfnTouch)(pOther); }\n\tvirtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { if (m_pfnUse) (this->*m_pfnUse)(pActivator, pCaller, useType, value); }\n\tvirtual void Blocked(CBaseEntity *pOther) { if (m_pfnBlocked) (this->*m_pfnBlocked)(pOther); }\n\tvirtual CBaseEntity *Respawn(void) { return NULL; }\n\tvirtual void UpdateOwner(void) {}\n\tvirtual BOOL FBecomeProne(void) { return FALSE; }\n\tvirtual Vector Center(void) { return (pev->absmax + pev->absmin) * 0.5; }\n\tvirtual Vector EyePosition(void) { return pev->origin + pev->view_ofs; }\n\tvirtual Vector EarPosition(void) { return pev->origin + pev->view_ofs; }\n\tvirtual Vector BodyTarget(const Vector &posSrc) { return Center(); }\n\tvirtual int Illumination(void) { return GETENTITYILLUM(ENT(pev)); }\n\tvirtual BOOL FVisible(CBaseEntity *pEntity) { return FALSE; }\n\tvirtual BOOL FVisible(const Vector &vecOrigin) { return FALSE; }\n\npublic:\n\tvoid EXPORT SUB_Remove(void) { }\n\tvoid EXPORT SUB_DoNothing(void);\n\tvoid EXPORT SUB_StartFadeOut(void);\n\tvoid EXPORT SUB_FadeOut(void);\n\tvoid EXPORT SUB_CallUseToggle(void) { Use(this, this, USE_TOGGLE, 0); }\n\tvoid SUB_UseTargets(CBaseEntity *pActivator, USE_TYPE useType, float value);\n\npublic:\n\tvoid UpdateOnRemove(void);\n\tint ShouldToggle(USE_TYPE useType, BOOL currentState) { return 0; }\n\tvoid FireBullets(ULONG cShots, Vector vecSrc, Vector vecDirShooting, Vector vecSpread, float flDistance, int iBulletType, int iTracerFreq = 4, int iDamage = 0, entvars_t *pevAttacker = NULL);\n\tVector FireBullets3(Vector vecSrc, Vector vecDirShooting, float flSpread, float flDistance, int iPenetration, int iBulletType, int iDamage, float flRangeModifier, entvars_t *pevAttacker, bool bPistol, int shared_rand = 0);\n\tint Intersects(CBaseEntity *pOther) { return 0; }\n\tvoid MakeDormant(void) { }\n\tint IsDormant(void) { return 0; }\n\tBOOL IsLockedByMaster(void) { return FALSE; }\n\npublic:\n\tstatic CBaseEntity *Instance(edict_t *pent) { return (CBaseEntity *)GET_PRIVATE(pent ? pent : ENT(0)); }\n\tstatic CBaseEntity *Instance(entvars_t *instpev) { return Instance(ENT(instpev)); }\n\tstatic CBaseEntity *Instance(int inst_eoffset) { return Instance(ENT(inst_eoffset)); }\n\n\tCBaseMonster *GetMonsterPointer(entvars_t *pevMonster)\n\t{\n\t\tCBaseEntity *pEntity = Instance(pevMonster);\n\n\t\tif (pEntity)\n\t\t\treturn pEntity->MyMonsterPointer();\n\n\t\treturn NULL;\n\t}\n\n\tCBaseMonster *GetMonsterPointer(edict_t *pentMonster)\n\t{\n\t\tCBaseEntity *pEntity = Instance(pentMonster);\n\n\t\tif (pEntity)\n\t\t\treturn pEntity->MyMonsterPointer();\n\n\t\treturn NULL;\n\t}\n\n#if defined(_DEBUG) && !defined(CLIENT_DLL)\n\tvoid FunctionCheck(void *pFunction, const char *name)\n\t{\n\t\tif (pFunction && !NAME_FOR_FUNCTION((unsigned long)(pFunction)))\n\t\t{ \n\t\t\tALERT(at_error, \"No EXPORT: %s:%s (%08lx)\\n\", STRING(pev->classname), name, (unsigned long)pFunction);\n\t\t\tUTIL_LogPrintf(\"No EXPORT: %s:%s (%08lx)\\n\", STRING(pev->classname), name, (unsigned long)pFunction);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif (pFunction)\n\t\t\t\tUTIL_LogPrintf(\"Has EXPORT: %s:%s (%08lx)\\n\", STRING(pev->classname), name, (unsigned long)pFunction);\n\t\t}\n\t}\n\n\tBASEPTR ThinkSet(BASEPTR func, const char *name)\n\t{\n\t\tm_pfnThink = func;\n\t\tFunctionCheck((void *)*((int *)((char *)this + (offsetof(CBaseEntity, m_pfnThink)))), name);\n\t\treturn func;\n\t}\n\n\tENTITYFUNCPTR TouchSet(ENTITYFUNCPTR func, const char *name)\n\t{\n\t\tm_pfnTouch = func;\n\t\tFunctionCheck((void *)*((int *)((char *)this + (offsetof(CBaseEntity, m_pfnTouch)))), name);\n\t\treturn func;\n\t}\n\n\tUSEPTR UseSet(USEPTR func, const char *name)\n\t{\n\t\tm_pfnUse = func;\n\t\tFunctionCheck((void *)*((int *)((char *)this + (offsetof(CBaseEntity, m_pfnUse)))), name);\n\t\treturn func;\n\t}\n\n\tENTITYFUNCPTR BlockedSet(ENTITYFUNCPTR func, const char *name)\n\t{\n\t\tm_pfnBlocked = func;\n\t\tFunctionCheck((void *)*((int *)((char *)this + (offsetof(CBaseEntity, m_pfnBlocked)))), name);\n\t\treturn func;\n\t}\n#endif\n\n\tstatic CBaseEntity *Create(char *szName, const Vector &vecOrigin, const Vector &vecAngles, edict_t *pentOwner = NULL) { return NULL; }\n\n\tedict_t *edict(void) { return ENT(pev); }\n\tEOFFSET eoffset(void) { return OFFSET(pev); }\n\tint entindex(void) { return ENTINDEX(edict()); }\n\npublic:\n\tvoid *operator new(size_t stAllocateBlock, entvars_t *newpev) { return ALLOC_PRIVATE(ENT(newpev), stAllocateBlock); }\n\n#if defined(_MSC_VER) && _MSC_VER >= 1200\n\tvoid operator delete(void *pMem, entvars_t *pev) { pev->flags |= FL_KILLME; }\n#endif\n\npublic:\n\tstatic TYPEDESCRIPTION m_SaveData[];\n\npublic:\n\tentvars_t *pev;\n\tCBaseEntity *m_pGoalEnt;\n\tCBaseEntity *m_pLink;\n\tvoid (CBaseEntity::*m_pfnThink)(void);\n\tvoid (CBaseEntity::*m_pfnTouch)(CBaseEntity *pOther);\n\tvoid (CBaseEntity::*m_pfnUse)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);\n\tvoid (CBaseEntity::*m_pfnBlocked)(CBaseEntity *pOther);\n\tint current_ammo;\n\tint currentammo;\n\tint maxammo_buckshot;\n\tint ammo_buckshot;\n\tint maxammo_9mm;\n\tint ammo_9mm;\n\tint maxammo_556nato;\n\tint ammo_556nato;\n\tint maxammo_556natobox;\n\tint ammo_556natobox;\n\tint maxammo_762nato;\n\tint ammo_762nato;\n\tint maxammo_45acp;\n\tint ammo_45acp;\n\tint maxammo_50ae;\n\tint ammo_50ae;\n\tint maxammo_338mag;\n\tint ammo_338mag;\n\tint maxammo_57mm;\n\tint ammo_57mm;\n\tint maxammo_357sig;\n\tint ammo_357sig;\n\tfloat m_flStartThrow;\n\tfloat m_flReleaseThrow;\n\tint m_iSwing;\n\tbool has_disconnected;\n};\n\n#if defined(_DEBUG) && !defined(CLIENT_DLL)\n#define SetThink(a) ThinkSet(static_cast <void (CBaseEntity::*)(void)>(a), (char*)#a)\n#define SetTouch(a) TouchSet(static_cast <void (CBaseEntity::*)(CBaseEntity *)>(a), #a)\n#define SetUse(a) UseSet(static_cast <void (CBaseEntity::*)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value)>(a), #a)\n#define SetBlocked(a) BlockedSet(static_cast <void (CBaseEntity::*)(CBaseEntity *)>(a), #a)\n#else\n#define SetThink(a) m_pfnThink = static_cast<void (CBaseEntity::*)(void)>(a)\n#define SetTouch(a) m_pfnTouch = static_cast<void (CBaseEntity::*)(CBaseEntity *)>(a)\n#define SetUse(a) m_pfnUse = static_cast<void (CBaseEntity::*)(CBaseEntity *, CBaseEntity *, USE_TYPE, float)>(a)\n#define SetBlocked(a) m_pfnBlocked = static_cast<void (CBaseEntity::*)(CBaseEntity *)>(a)\n#endif\n\nclass CPointEntity : public CBaseEntity\n{\npublic:\n\tvoid Spawn(void);\n\tint ObjectCaps(void) { return CBaseEntity::ObjectCaps() & ~FCAP_ACROSS_TRANSITION; }\n};\n\ntypedef struct locksounds\n{\n\tstring_t sLockedSound;\n\tstring_t sLockedSentence;\n\tstring_t sUnlockedSound;\n\tstring_t sUnlockedSentence;\n\tint iLockedSentence;\n\tint iUnlockedSentence;\n\tfloat flwaitSound;\n\tfloat flwaitSentence;\n\tBYTE bEOFLocked;\n\tBYTE bEOFUnlocked;\n}\nlocksound_t;\n\nvoid PlayLockSounds(entvars_t *pev, locksound_t *pls, int flocked, int fbutton);\n\n#define MAX_MULTI_TARGETS 16\n#define MS_MAX_TARGETS 32\n\nclass CMultiSource : public CPointEntity\n{\npublic:\n\tvoid Spawn(void);\n\tvoid KeyValue(KeyValueData *pkvd);\n\tvoid Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);\n\tint ObjectCaps(void) { return (CPointEntity::ObjectCaps() | FCAP_MASTER); }\n\tBOOL IsTriggered(CBaseEntity *pActivator);\n\tint Save(CSave &save);\n\tint Restore(CRestore &restore);\n\npublic:\n\tvoid EXPORT Register(void);\n\npublic:\n\tstatic TYPEDESCRIPTION m_SaveData[];\n\npublic:\n\tEHANDLE m_rgEntities[MS_MAX_TARGETS];\n\tint m_rgTriggered[MS_MAX_TARGETS];\n\tint m_iTotal;\n\tstring_t m_globalstate;\n};\n\nclass CBaseDelay : public CBaseEntity\n{\npublic:\n\tvoid KeyValue(KeyValueData *pkvd) { }\n\tint Save(CSave &save) { return 1; }\n\tint Restore(CRestore &restore) { return 1; }\n\npublic:\n\tvoid SUB_UseTargets(CBaseEntity *pActivator, USE_TYPE useType, float value);\n\npublic:\n\tvoid EXPORT DelayThink(void);\n\npublic:\n\tstatic TYPEDESCRIPTION m_SaveData[];\n\npublic:\n\tfloat m_flDelay;\n\tint m_iszKillTarget;\n};\n\nclass CBaseAnimating : public CBaseDelay\n{\npublic:\n\tvirtual int Save(CSave &save) { return 1; }\n\tvirtual int Restore(CRestore &restore) { return 1; }\n\tvirtual void HandleAnimEvent(MonsterEvent_t *pEvent) {}\n\npublic:\n\tfloat StudioFrameAdvance(float flInterval = 0);\n\tint GetSequenceFlags(void);\n\tint LookupActivity(int activity) { return 0; }\n\tint LookupActivityHeaviest(int activity) { return 0; }\n\tint LookupSequence(const char *label) { return 0; }\n\tvoid ResetSequenceInfo(void) { }\n\tvoid DispatchAnimEvents(float flFutureInterval = 0.1) { }\n\tfloat SetBoneController(int iController, float flValue) { return 0; }\n\tvoid InitBoneControllers(void) { }\n\tfloat SetBlending(int iBlender, float flValue) { return 0; }\n\tvoid GetBonePosition(int iBone, Vector &origin, Vector &angles) { }\n\tvoid GetAutomovement(Vector &origin, Vector &angles, float flInterval = 0.1) { }\n\tint FindTransition(int iEndingSequence, int iGoalSequence, int *piDir) { return -1; }\n\tvoid GetAttachment(int iAttachment, Vector &origin, Vector &angles) { }\n\tvoid SetBodygroup(int iGroup, int iValue) {}\n\tint GetBodygroup(int iGroup) { return 0; }\n\tint ExtractBbox(int sequence, float *mins, float *maxs) { return 0; }\n\tvoid SetSequenceBox(void) { }\n\npublic:\n\tstatic TYPEDESCRIPTION m_SaveData[];\n\npublic:\n\tfloat m_flFrameRate;\n\tfloat m_flGroundSpeed;\n\tfloat m_flLastEventCheck;\n\tBOOL m_fSequenceFinished;\n\tBOOL m_fSequenceLoops;\n};\n\n#define SF_ITEM_USE_ONLY 256\n\nclass CBaseToggle : public CBaseAnimating\n{\npublic:\n\tvoid KeyValue(KeyValueData *pkvd) { }\n\tint Save(CSave &save) { return 1; }\n\tint Restore(CRestore &restore) { return 1; }\n\tint GetToggleState(void) { return m_toggle_state; }\n\tfloat GetDelay(void) { return m_flWait; }\n\npublic:\n\tvoid LinearMove(Vector vecDest, float flSpeed);\n\tvoid EXPORT LinearMoveDone(void);\n\tvoid AngularMove(Vector vecDestAngle, float flSpeed);\n\tvoid EXPORT AngularMoveDone(void);\n\tBOOL IsLockedByMaster(void);\n\npublic:\n\tstatic float AxisValue(int flags, const Vector &angles);\n\tstatic void AxisDir(entvars_t *pev);\n\tstatic float AxisDelta(int flags, const Vector &angle1, const Vector &angle2);\n\npublic:\n\tstatic TYPEDESCRIPTION m_SaveData[];\n\npublic:\n\tTOGGLE_STATE m_toggle_state;\n\tfloat m_flActivateFinished;\n\tfloat m_flMoveDistance;\n\tfloat m_flWait;\n\tfloat m_flLip;\n\tfloat m_flTWidth;\n\tfloat m_flTLength;\n\tVector m_vecPosition1;\n\tVector m_vecPosition2;\n\tVector m_vecAngle1;\n\tVector m_vecAngle2;\n\tint m_cTriggersLeft;\n\tfloat m_flHeight;\n\tEHANDLE m_hActivator;\n\tvoid (CBaseToggle::*m_pfnCallWhenMoveDone)(void);\n\tVector m_vecFinalDest;\n\tVector m_vecFinalAngle;\n\tint m_bitsDamageInflict;\n\tstring_t m_sMaster;\n};\n\n#define SetMoveDone(a) m_pfnCallWhenMoveDone = static_cast<void (CBaseToggle::*)(void)>(a)\n\n#define GIB_HEALTH_VALUE -30\n\n#define ROUTE_SIZE 8\n#define MAX_OLD_ENEMIES 4\n\n#define bits_CAP_DUCK (1<<0)\n#define bits_CAP_JUMP (1<<1)\n#define bits_CAP_STRAFE (1<<2)\n#define bits_CAP_SQUAD (1<<3)\n#define bits_CAP_SWIM (1<<4)\n#define bits_CAP_CLIMB (1<<5)\n#define bits_CAP_USE (1<<6)\n#define bits_CAP_HEAR (1<<7)\n#define bits_CAP_AUTO_DOORS (1<<8)\n#define bits_CAP_OPEN_DOORS (1<<9)\n#define bits_CAP_TURN_HEAD (1<<10)\n#define bits_CAP_RANGE_ATTACK1 (1<<11)\n#define bits_CAP_RANGE_ATTACK2 (1<<12)\n#define bits_CAP_MELEE_ATTACK1 (1<<13)\n#define bits_CAP_MELEE_ATTACK2 (1<<14)\n#define bits_CAP_FLY (1<<15)\n#define bits_CAP_DOORS_GROUP (bits_CAP_USE | bits_CAP_AUTO_DOORS | bits_CAP_OPEN_DOORS)\n\n#define DMG_GENERIC 0\n#ifndef DMG_CRUSH\n#define DMG_CRUSH (1<<0)\n#define DMG_BULLET (1<<1)\n#define DMG_SLASH (1<<2)\n#define DMG_BURN (1<<3)\n#define DMG_FREEZE (1<<4)\n#define DMG_FALL (1<<5)\n#define DMG_BLAST (1<<6)\n#define DMG_CLUB (1<<7)\n#define DMG_SHOCK (1<<8)\n#define DMG_SONIC (1<<9)\n#define DMG_ENERGYBEAM (1<<10)\n#define DMG_NEVERGIB (1<<12)\n#define DMG_ALWAYSGIB (1<<13)\n#define DMG_DROWN (1<<14)\n#define DMG_TIMEBASED (~(0x3FFF))\n\n#define DMG_PARALYZE (1<<15)\n#define DMG_NERVEGAS (1<<16)\n#define DMG_POISON (1<<17)\n#define DMG_RADIATION (1<<18)\n#define DMG_DROWNRECOVER (1<<19)\n#define DMG_ACID (1<<20)\n#define DMG_SLOWBURN (1<<21)\n#define DMG_SLOWFREEZE (1<<22)\n#define DMG_MORTAR (1<<23)\n#endif\n#define DMG_EXPLOSION (1<<24)\n#define DMG_GIB_CORPSE (DMG_CRUSH | DMG_FALL | DMG_BLAST | DMG_SONIC | DMG_CLUB)\n#define DMG_SHOWNHUD (DMG_POISON | DMG_ACID | DMG_FREEZE | DMG_SLOWFREEZE | DMG_DROWN | DMG_BURN | DMG_SLOWBURN | DMG_NERVEGAS | DMG_RADIATION | DMG_SHOCK)\n\n#define PARALYZE_DURATION 2\n#define PARALYZE_DAMAGE 1.0\n\n#define NERVEGAS_DURATION 2\n#define NERVEGAS_DAMAGE 5.0\n\n#define POISON_DURATION 5\n#define POISON_DAMAGE 2.0\n\n#define RADIATION_DURATION 2\n#define RADIATION_DAMAGE 1.0\n\n#define ACID_DURATION 2\n#define ACID_DAMAGE 5.0\n\n#define SLOWBURN_DURATION 2\n#define SLOWBURN_DAMAGE 1.0\n\n#define SLOWFREEZE_DURATION 2\n#define SLOWFREEZE_DAMAGE 1.0\n\n#define itbd_Paralyze 0\n#define itbd_NerveGas 1\n#define itbd_Poison 2\n#define itbd_Radiation 3\n#define itbd_DrownRecover 4\n#define itbd_Acid 5\n#define itbd_SlowBurn 6\n#define itbd_SlowFreeze 7\n#define CDMG_TIMEBASED 8\n\n#define GIB_NORMAL 0\n#define GIB_NEVER 1\n#define GIB_ALWAYS 2\n\nclass CBaseMonster;\nclass CCineMonster;\nclass CSound;\n\n#include \"basemonster.h\"\n\nchar *ButtonSound(int sound);\n\nclass CBaseButton : public CBaseToggle\n{\npublic:\n\tvoid Spawn(void);\n\tvoid Precache(void);\n\tvoid KeyValue(KeyValueData* pkvd);\n\tint ObjectCaps(void) { return (CBaseToggle:: ObjectCaps() & ~FCAP_ACROSS_TRANSITION) | (pev->takedamage ? 0 : FCAP_IMPULSE_USE); }\n\tint TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType);\n\tint Save(CSave &save);\n\tint Restore(CRestore &restore);\n\npublic:\n\tvoid RotSpawn(void);\n\tvoid ButtonActivate(void);\n\tvoid SparkSoundCache(void);\n\n\tvoid EXPORT ButtonShot(void);\n\tvoid EXPORT ButtonTouch(CBaseEntity *pOther);\n\tvoid EXPORT ButtonSpark(void);\n\tvoid EXPORT TriggerAndWait(void);\n\tvoid EXPORT ButtonReturn(void);\n\tvoid EXPORT ButtonBackHome(void);\n\tvoid EXPORT ButtonUse(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);\n\tenum BUTTON_CODE { BUTTON_NOTHING, BUTTON_ACTIVATE, BUTTON_RETURN };\n\tBUTTON_CODE ButtonResponseToTouch(void);\n\npublic:\n\tstatic TYPEDESCRIPTION m_SaveData[];\n\npublic:\n\tBOOL m_fStayPushed;\n\tBOOL m_fRotating;\n\tstring_t m_strChangeTarget;\n\tlocksound_t m_ls;\n\tBYTE m_bLockedSound;\n\tBYTE m_bLockedSentence;\n\tBYTE m_bUnlockedSound;\n\tBYTE m_bUnlockedSentence;\n\tint m_sounds;\n};\n\ntemplate <class T> T *GetClassPtr(T *a)\n{\n\tentvars_t *pev = (entvars_t *)a;\n\n\tif (pev == NULL)\n\t\tpev = VARS(CREATE_ENTITY());\n\n\ta = (T *)GET_PRIVATE(ENT(pev));\n\n\tif (a == NULL)\n\t{\n\t\ta = new(pev) T;\n\t\ta->pev = pev;\n\t}\n\n\treturn a;\n}\n\nclass CWorld : public CBaseEntity\n{\npublic:\n\tvoid Spawn(void);\n\tvoid Precache(void);\n\tvoid KeyValue(KeyValueData *pkvd);\n};\n\nclass CClientFog : public CBaseEntity\n{\npublic:\n\tvoid Spawn(void);\n\tvoid KeyValue(KeyValueData *pkvd);\n\npublic:\n\tint m_iStartDist, m_iEndDist;\n\tfloat m_fDensity;\n};\n"
  },
  {
    "path": "dlls/cdll_dll.h",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\n*\tThis product contains software technology licensed from Id\n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc.\n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n#ifndef CDLL_DLL_H\n#define CDLL_DLL_H\n\n#define MAX_WEAPONS 32\n#define MAX_WEAPON_SLOTS 5\n#define MAX_ITEM_TYPES 6\n#define MAX_ITEMS 4\n\n#define DEFAULT_FOV\t\t\t90\t\t// the default field of view\n\n#define HIDEHUD_WEAPONS (1<<0)\n#define HIDEHUD_FLASHLIGHT (1<<1)\n#define HIDEHUD_ALL (1<<2)\n#define HIDEHUD_HEALTH (1<<3)\n#define HIDEHUD_TIMER (1<<4)\n#define HIDEHUD_MONEY (1<<5)\n#define HIDEHUD_CROSSHAIR (1<<6)\n\n#define MAX_AMMO_TYPES 32\n#define MAX_AMMO_SLOTS 32\n\n#define HUD_PRINTNOTIFY 1\n#define HUD_PRINTCONSOLE 2\n#define HUD_PRINTTALK 3\n#define HUD_PRINTCENTER 4\n#define HUD_PRINTRADIO 5\n\n\n#define SCORE_STATUS_DEAD (1<<0)\n#define SCORE_STATUS_BOMB (1<<1)\n#define SCORE_STATUS_VIP (1<<2)\n\n#define STATUSICON_HIDE 0\n#define STATUSICON_SHOW 1\n#define STATUSICON_FLASH 2\n\n#define TEAM_UNASSIGNED 0\n#define TEAM_TERRORIST 1\n#define TEAM_CT 2\n#define TEAM_SPECTATOR 3\n\n#define CLASS_UNASSIGNED 0\n#define CLASS_URBAN 1\n#define CLASS_TERROR 2\n#define CLASS_LEET 3\n#define CLASS_ARCTIC 4\n#define CLASS_GSG9 5\n#define CLASS_GIGN 6\n#define CLASS_SAS 7\n#define CLASS_GUERILLA 8\n#define CLASS_VIP 9\n#define CLASS_MILITIA 10\n#define CLASS_SPETSNAZ 11\n\n#define MENU_KEY_1 (1<<0)\n#define MENU_KEY_2 (1<<1)\n#define MENU_KEY_3 (1<<2)\n#define MENU_KEY_4 (1<<3)\n#define MENU_KEY_5 (1<<4)\n#define MENU_KEY_6 (1<<5)\n#define MENU_KEY_7 (1<<6)\n#define MENU_KEY_8 (1<<7)\n#define MENU_KEY_9 (1<<8)\n#define MENU_KEY_0 (1<<9)\n\n#define MENU_TEAM 2\n#define MENU_MAPBRIEFING 4\n#define MENU_CLASS_T 26\n#define MENU_CLASS_CT 27\n#define MENU_BUY 28\n#define MENU_BUY_PISTOL 29\n#define MENU_BUY_SHOTGUN 30\n#define MENU_BUY_RIFLE 31\n#define MENU_BUY_SUBMACHINEGUN 32\n#define MENU_BUY_MACHINEGUN 33\n#define MENU_BUY_ITEM 34\n// -- cs16client extension start -- //\n#define MENU_RADIOA 35\n#define MENU_RADIOB 36\n#define MENU_RADIOC 37\n#define MENU_RADIOSELECTOR 38\n#define MENU_BUY_CSDM 39\n#define MENU_NUMERICAL_MENU -1\n// -- cs16client extension end -- //\n\n\n#define IUSER3_CANSHOOT (1<<0)\n#define IUSER3_FREEZETIMEOVER (1<<1)\n#define IUSER3_INBOMBZONE (1<<2)\n#define IUSER3_HOLDINGSHIELD (1<<3)\n\n#define ITEMSTATE_HASNIGHTVISION (1<<0)\n#define ITEMSTATE_HASDEFUSER (1<<1)\n\n#define PLAYER_DEAD (1<<0)\n#define PLAYER_HAS_C4 (1<<1)\n#define PLAYER_VIP (1<<2)\n#define PLAYER_HAS_DEFUSER (1<<3)\n\n#define WEAPON_SUIT 31\n#endif\n"
  },
  {
    "path": "dlls/effects.h",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\n*\tThis product contains software technology licensed from Id\n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc.\n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n#ifndef EFFECTS_H\n#define EFFECTS_H\n\n#define SF_BEAM_STARTON 0x0001\n#define SF_BEAM_TOGGLE 0x0002\n#define SF_BEAM_RANDOM 0x0004\n#define SF_BEAM_RING 0x0008\n#define SF_BEAM_SPARKSTART 0x0010\n#define SF_BEAM_SPARKEND 0x0020\n#define SF_BEAM_DECALS 0x0040\n#define SF_BEAM_SHADEIN 0x0080\n#define SF_BEAM_SHADEOUT 0x0100\n#define SF_BEAM_TEMPORARY 0x8000\n\n#define SF_SPRITE_STARTON 0x0001\n#define SF_SPRITE_ONCE 0x0002\n#define SF_SPRITE_TEMPORARY 0x8000\n\nclass CSprite : public CPointEntity\n{\npublic:\n\tvoid Spawn(void);\n\tvoid Restart(void);\n\tvoid Precache(void);\n\n\tint ObjectCaps(void)\n\t{\n\t\tint flags = 0;\n\n\t\tif (pev->spawnflags & SF_SPRITE_TEMPORARY)\n\t\t\tflags = FCAP_DONT_SAVE;\n\n\t\treturn (CBaseEntity::ObjectCaps() & ~FCAP_ACROSS_TRANSITION) | flags;\n\t}\n\n\tvoid Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);\n\tvoid Animate(float frames);\n\tvoid Expand(float scaleSpeed, float fadeSpeed);\n\tvoid SpriteInit(const char *pSpriteName, const Vector &origin);\n\n\tinline void SetAttachment(edict_t *pEntity, int attachment)\n\t{\n\t\tif (pEntity)\n\t\t{\n\t\t\tpev->skin = ENTINDEX(pEntity);\n\t\t\tpev->body = attachment;\n\t\t\tpev->aiment = pEntity;\n\t\t\tpev->movetype = MOVETYPE_FOLLOW;\n\t\t}\n\t}\n\tvoid TurnOff(void);\n\tvoid TurnOn(void);\n\npublic:\n\tinline float Frames(void){ return m_maxFrame; }\n\n\tinline void SetTransparency(int rendermode, int r, int g, int b, int a, int fx)\n\t{\n\t\tpev->rendermode = rendermode;\n\t\tpev->rendercolor.x = r;\n\t\tpev->rendercolor.y = g;\n\t\tpev->rendercolor.z = b;\n\t\tpev->renderamt = a;\n\t\tpev->renderfx = fx;\n\t}\n\tinline void SetTexture(int spriteIndex) { pev->modelindex = spriteIndex; }\n\tinline void SetScale(float scale) { pev->scale = scale; }\n\tinline void SetColor(int r, int g, int b) { pev->rendercolor.x = r; pev->rendercolor.y = g; pev->rendercolor.z = b; }\n\tinline void SetBrightness(int brightness){ pev->renderamt = brightness; }\n\n\tinline void AnimateAndDie(float framerate)\n\t{\n\t\tSetThink(&CSprite::AnimateUntilDead);\n\t\tpev->framerate = framerate;\n\t\tpev->dmgtime = gpGlobals->time + (m_maxFrame / framerate);\n\t\tpev->nextthink = gpGlobals->time;\n\t}\n\npublic:\n\tvoid EXPORT AnimateThink(void);\n\tvoid EXPORT ExpandThink(void);\n\tvoid EXPORT AnimateUntilDead(void);\n\n\tvirtual int Save(CSave &save);\n\tvirtual int Restore(CRestore &restore);\n\tstatic TYPEDESCRIPTION m_SaveData[];\n\tstatic CSprite *SpriteCreate(const char *pSpriteName, const Vector &origin, BOOL animate);\n\nprivate:\n\tfloat m_lastTime;\n\tfloat m_maxFrame;\n};\n\nclass CBeam : public CBaseEntity\n{\npublic:\n\tvoid Spawn(void);\n\tvoid Precache(void);\n\n\tint ObjectCaps(void)\n\t{\n\t\tint flags = 0;\n\n\t\tif (pev->spawnflags & SF_BEAM_TEMPORARY)\n\t\t\tflags = FCAP_DONT_SAVE;\n\n\t\treturn (CBaseEntity::ObjectCaps() & ~FCAP_ACROSS_TRANSITION) | flags;\n\t}\n\npublic:\n\tinline void SetType(int type) { pev->rendermode = (pev->rendermode & 0xF0) | (type & 0x0F); }\n\tinline void SetFlags(int flags) { pev->rendermode = (pev->rendermode & 0x0F) | (flags & 0xF0); }\n\tinline void SetStartPos(const Vector &pos) { pev->origin = pos; }\n\tinline void SetEndPos(const Vector &pos){ pev->angles = pos; }\n\n\tvoid SetStartEntity(int entityIndex);\n\tvoid SetEndEntity(int entityIndex);\n\n\tinline void SetStartAttachment(int attachment) { pev->sequence = (pev->sequence & 0x0FFF) | ((attachment & 0xF) << 12); }\n\tinline void SetEndAttachment(int attachment) { pev->skin = (pev->skin & 0x0FFF) | ((attachment & 0xF) << 12); }\n\tinline void SetTexture(int spriteIndex) { pev->modelindex = spriteIndex; }\n\tinline void SetWidth(int width) { pev->scale = width; }\n\tinline void SetNoise(int amplitude) { pev->body = amplitude; }\n\tinline void SetColor(int r, int g, int b) { pev->rendercolor.x = r; pev->rendercolor.y = g; pev->rendercolor.z = b; }\n\tinline void SetBrightness(int brightness) { pev->renderamt = brightness; }\n\tinline void SetFrame(float frame) { pev->frame = frame; }\n\tinline void SetScrollRate(int speed){ pev->animtime = speed; }\n\npublic:\n\tinline int GetType(void) { return pev->rendermode & 0x0F; }\n\tinline int GetFlags(void) { return pev->rendermode & 0xF0; }\n\tinline int GetStartEntity(void) { return pev->sequence & 0xFFF; }\n\tinline int GetEndEntity(void) { return pev->skin & 0xFFF; }\n\tconst Vector &GetStartPos(void);\n\tconst Vector &GetEndPos(void);\n\npublic:\n\tVector Center(void){ return (GetStartPos() + GetEndPos()) * 0.5; }\n\npublic:\n\tinline int GetTexture(void) { return pev->modelindex; }\n\tinline int GetWidth(void) { return (int)(pev->scale); }\n\tinline int GetNoise(void) { return pev->body; }\n\tinline int GetBrightness(void) { return (int)(pev->renderamt); }\n\tinline int GetFrame(void) { return (int)(pev->frame); }\n\tinline int GetScrollRate(void){ return (int)(pev->animtime); }\n\npublic:\n\tvoid EXPORT TriggerTouch(CBaseEntity *pOther);\n\tvoid RelinkBeam(void);\n\tvoid DoSparks(const Vector &start, const Vector &end);\n\tCBaseEntity *RandomTargetname(const char *szName);\n\tvoid BeamDamage(TraceResult *ptr);\n\tvoid BeamInit(const char *pSpriteName, int width);\n\tvoid PointsInit(const Vector &start, const Vector &end);\n\tvoid PointEntInit(const Vector &start, int endIndex);\n\tvoid EntsInit(int startIndex, int endIndex);\n\tvoid HoseInit(const Vector &start, const Vector &direction);\n\npublic:\n\tstatic CBeam *BeamCreate(const char *pSpriteName, int width);\n\npublic:\n\tinline void LiveForTime(float time){ SetThink(&CBaseEntity::SUB_Remove); pev->nextthink = gpGlobals->time + time; }\n\n\tinline void BeamDamageInstant(TraceResult *ptr, float damage)\n\t{\n\t\tpev->dmg = damage;\n\t\tpev->dmgtime = gpGlobals->time - 1;\n\t\tBeamDamage(ptr);\n\t}\n};\n\n#define SF_MESSAGE_ONCE 0x0001\n#define SF_MESSAGE_ALL 0x0002\n\nclass CLaser : public CBeam\n{\npublic:\n\tvoid Spawn(void);\n\tvoid Precache(void);\n\tvoid KeyValue(KeyValueData *pkvd);\n\tvoid Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);\n\tint Save(CSave &save);\n\tint Restore(CRestore &restore);\n\npublic:\n\tvoid TurnOn(void);\n\tvoid TurnOff(void);\n\tint IsOn(void);\n\npublic:\n\tvoid FireAtPoint(TraceResult &point);\n\tvoid EXPORT StrikeThink(void);\n\npublic:\n\tstatic TYPEDESCRIPTION m_SaveData[];\n\npublic:\n\tCSprite *m_pSprite;\n\tint m_iszSpriteName;\n\tVector m_firePosition;\n};\n\n#endif"
  },
  {
    "path": "dlls/enginecallback.h",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\t\n*\tThis product contains software technology licensed from Id \n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc. \n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n#ifndef ENGINECALLBACK_H\n#define ENGINECALLBACK_H\n#ifdef _WIN32\n#ifndef __MINGW32__\n#pragma once\n#endif /* not __MINGW32__ */\n#endif\n\n#include \"event_flags.h\"\n\n// Must be provided by user of this code\nextern enginefuncs_t g_engfuncs;\n\n// The actual engine callbacks\n#define GETPLAYERUSERID (*g_engfuncs.pfnGetPlayerUserId)\n#define PRECACHE_GENERIC\t(*g_engfuncs.pfnPrecacheGeneric)\n#ifdef CLIENT_DLL\ninline int PRECACHE_MODEL( const char *s ) { return 0; }\ninline int PRECACHE_SOUND( const char *s ) { return 0; }\n#define SET_MODEL(x, y)\n#else\n#define PRECACHE_MODEL\t(*g_engfuncs.pfnPrecacheModel)\n#define PRECACHE_SOUND\t(*g_engfuncs.pfnPrecacheSound)\n#define SET_MODEL\t\t(*g_engfuncs.pfnSetModel)\n#endif\n#define MODEL_INDEX\t\t(*g_engfuncs.pfnModelIndex)\n#define MODEL_FRAMES\t(*g_engfuncs.pfnModelFrames)\n#define SET_SIZE\t\t(*g_engfuncs.pfnSetSize)\n#define CHANGE_LEVEL\t(*g_engfuncs.pfnChangeLevel)\n#define GET_SPAWN_PARMS\t(*g_engfuncs.pfnGetSpawnParms)\n#define SAVE_SPAWN_PARMS (*g_engfuncs.pfnSaveSpawnParms)\n#define VEC_TO_YAW\t\t(*g_engfuncs.pfnVecToYaw)\n#define VEC_TO_ANGLES\t(*g_engfuncs.pfnVecToAngles)\n#define MOVE_TO_ORIGIN  (*g_engfuncs.pfnMoveToOrigin)\n#define oldCHANGE_YAW\t\t(*g_engfuncs.pfnChangeYaw)\n#define CHANGE_PITCH\t(*g_engfuncs.pfnChangePitch)\n#define MAKE_VECTORS\t(*g_engfuncs.pfnMakeVectors)\n#define CREATE_ENTITY\t(*g_engfuncs.pfnCreateEntity)\n#define REMOVE_ENTITY\t(*g_engfuncs.pfnRemoveEntity)\n#define CREATE_NAMED_ENTITY\t\t(*g_engfuncs.pfnCreateNamedEntity)\n#define MAKE_STATIC\t\t(*g_engfuncs.pfnMakeStatic)\n#define ENT_IS_ON_FLOOR\t(*g_engfuncs.pfnEntIsOnFloor)\n#define DROP_TO_FLOOR\t(*g_engfuncs.pfnDropToFloor)\n#define WALK_MOVE\t\t(*g_engfuncs.pfnWalkMove)\n#define SET_ORIGIN\t\t(*g_engfuncs.pfnSetOrigin)\n#define EMIT_SOUND_DYN2 (*g_engfuncs.pfnEmitSound)\n#define BUILD_SOUND_MSG (*g_engfuncs.pfnBuildSoundMsg)\n#define TRACE_LINE\t\t(*g_engfuncs.pfnTraceLine)\n#define TRACE_TOSS\t\t(*g_engfuncs.pfnTraceToss)\n#define TRACE_MONSTER_HULL\t\t(*g_engfuncs.pfnTraceMonsterHull)\n#define TRACE_HULL\t\t(*g_engfuncs.pfnTraceHull)\n#define GET_AIM_VECTOR\t(*g_engfuncs.pfnGetAimVector)\n#define SERVER_COMMAND\t(*g_engfuncs.pfnServerCommand)\n#define SERVER_EXECUTE2\t(*g_engfuncs.pfnServerExecute)//SERVER_EXECUTE already present in windows winspool.h\n#define CLIENT_COMMAND\t(*g_engfuncs.pfnClientCommand)\n#define PARTICLE_EFFECT\t(*g_engfuncs.pfnParticleEffect)\n#define LIGHT_STYLE\t\t(*g_engfuncs.pfnLightStyle)\n#define DECAL_INDEX\t\t(*g_engfuncs.pfnDecalIndex)\n#define POINT_CONTENTS\t(*g_engfuncs.pfnPointContents)\n#define CRC32_INIT           (*g_engfuncs.pfnCRC32_Init)\n#define CRC32_PROCESS_BUFFER (*g_engfuncs.pfnCRC32_ProcessBuffer)\n#define CRC32_PROCESS_BYTE   (*g_engfuncs.pfnCRC32_ProcessByte)\n#define CRC32_FINAL          (*g_engfuncs.pfnCRC32_Final)\n#define RANDOM_LONG\t\t(*g_engfuncs.pfnRandomLong)\n#define RANDOM_FLOAT\t(*g_engfuncs.pfnRandomFloat)\n#define GETPLAYERAUTHID\t(*g_engfuncs.pfnGetPlayerAuthId)\n#define GAME_TIME\t\t(*g_engfuncs.pfnTime)\n\ninline void MESSAGE_BEGIN( int msg_dest, int msg_type, const float *pOrigin = NULL, edict_t *ed = NULL ) {\n\t(*g_engfuncs.pfnMessageBegin)(msg_dest, msg_type, pOrigin, ed);\n}\n#define MESSAGE_END\t\t(*g_engfuncs.pfnMessageEnd)\n#define WRITE_BYTE\t\t(*g_engfuncs.pfnWriteByte)\n#define WRITE_CHAR\t\t(*g_engfuncs.pfnWriteChar)\n#define WRITE_SHORT\t\t(*g_engfuncs.pfnWriteShort)\n#define WRITE_LONG\t\t(*g_engfuncs.pfnWriteLong)\n#define WRITE_ANGLE\t\t(*g_engfuncs.pfnWriteAngle)\n#define WRITE_COORD\t\t(*g_engfuncs.pfnWriteCoord)\n#define WRITE_STRING\t(*g_engfuncs.pfnWriteString)\n#define WRITE_ENTITY\t(*g_engfuncs.pfnWriteEntity)\n#define CVAR_REGISTER\t(*g_engfuncs.pfnCVarRegister)\n#define CVAR_GET_FLOAT\t(*g_engfuncs.pfnCVarGetFloat)\n#define CVAR_GET_STRING\t(*g_engfuncs.pfnCVarGetString)\n#define CVAR_SET_FLOAT\t(*g_engfuncs.pfnCVarSetFloat)\n#define CVAR_SET_STRING\t(*g_engfuncs.pfnCVarSetString)\n#define CVAR_GET_POINTER (*g_engfuncs.pfnCVarGetPointer)\n#define ALERT\t\t\t(*g_engfuncs.pfnAlertMessage)\n#define ENGINE_FPRINTF\t(*g_engfuncs.pfnEngineFprintf)\n#define ALLOC_PRIVATE\t(*g_engfuncs.pfnPvAllocEntPrivateData)\ninline void *GET_PRIVATE( edict_t *pent )\n{\n\tif ( pent )\n\t\treturn pent->pvPrivateData;\n\treturn NULL;\n}\n\n#define FREE_PRIVATE\t(*g_engfuncs.pfnFreeEntPrivateData)\n//#define STRING\t\t\t(*g_engfuncs.pfnSzFromIndex)\n#define ALLOC_STRING\t(*g_engfuncs.pfnAllocString)\n#define FIND_ENTITY_BY_STRING\t(*g_engfuncs.pfnFindEntityByString)\n#define GETENTITYILLUM\t(*g_engfuncs.pfnGetEntityIllum)\n#define FIND_ENTITY_IN_SPHERE\t\t(*g_engfuncs.pfnFindEntityInSphere)\n#define FIND_CLIENT_IN_PVS\t\t\t(*g_engfuncs.pfnFindClientInPVS)\n#define EMIT_AMBIENT_SOUND\t\t\t(*g_engfuncs.pfnEmitAmbientSound)\n#define GET_MODEL_PTR\t\t\t\t(*g_engfuncs.pfnGetModelPtr)\n#define REG_USER_MSG\t\t\t\t(*g_engfuncs.pfnRegUserMsg)\n#define GET_BONE_POSITION\t\t\t(*g_engfuncs.pfnGetBonePosition)\n#define FUNCTION_FROM_NAME\t\t\t(*g_engfuncs.pfnFunctionFromName)\n#define NAME_FOR_FUNCTION\t\t\t(*g_engfuncs.pfnNameForFunction)\n#define TRACE_TEXTURE\t\t\t\t(*g_engfuncs.pfnTraceTexture)\n#define CLIENT_PRINTF\t\t\t\t(*g_engfuncs.pfnClientPrintf)\n#define CMD_ARGS\t\t\t\t\t(*g_engfuncs.pfnCmd_Args)\n#define CMD_ARGC\t\t\t\t\t(*g_engfuncs.pfnCmd_Argc)\n#define CMD_ARGV\t\t\t\t\t(*g_engfuncs.pfnCmd_Argv)\n#define GET_ATTACHMENT\t\t\t(*g_engfuncs.pfnGetAttachment)\n#define SET_VIEW\t\t\t\t(*g_engfuncs.pfnSetView)\n#define SET_CROSSHAIRANGLE\t\t(*g_engfuncs.pfnCrosshairAngle)\n#define LOAD_FILE_FOR_ME\t\t(*g_engfuncs.pfnLoadFileForMe)\n#define FREE_FILE\t\t\t\t(*g_engfuncs.pfnFreeFile)\n#define COMPARE_FILE_TIME\t\t(*g_engfuncs.pfnCompareFileTime)\n#define GET_GAME_DIR\t\t\t(*g_engfuncs.pfnGetGameDir)\n#define IS_MAP_VALID\t\t\t(*g_engfuncs.pfnIsMapValid)\n#define NUMBER_OF_ENTITIES\t\t(*g_engfuncs.pfnNumberOfEntities)\n#define IS_DEDICATED_SERVER\t\t(*g_engfuncs.pfnIsDedicatedServer)\n\n#define PRECACHE_EVENT\t\t\t(*g_engfuncs.pfnPrecacheEvent)\n#define PLAYBACK_EVENT_FULL\t\t(*g_engfuncs.pfnPlaybackEvent)\n\n#define ENGINE_SET_PVS\t\t\t(*g_engfuncs.pfnSetFatPVS)\n#define ENGINE_SET_PAS\t\t\t(*g_engfuncs.pfnSetFatPAS)\n\n#define ENGINE_CHECK_VISIBILITY (*g_engfuncs.pfnCheckVisibility)\n\n#define DELTA_SET\t\t\t\t( *g_engfuncs.pfnDeltaSetField )\n#define DELTA_UNSET\t\t\t\t( *g_engfuncs.pfnDeltaUnsetField )\n#define DELTA_ADDENCODER\t\t( *g_engfuncs.pfnDeltaAddEncoder )\n#define ENGINE_CURRENT_PLAYER   ( *g_engfuncs.pfnGetCurrentPlayer )\n\n#define\tENGINE_CANSKIP\t\t\t( *g_engfuncs.pfnCanSkipPlayer )\n\n#define DELTA_FINDFIELD\t\t\t( *g_engfuncs.pfnDeltaFindField )\n#define DELTA_SETBYINDEX\t\t( *g_engfuncs.pfnDeltaSetFieldByIndex )\n#define DELTA_UNSETBYINDEX\t\t( *g_engfuncs.pfnDeltaUnsetFieldByIndex )\n\n#define ENGINE_GETPHYSINFO\t\t( *g_engfuncs.pfnGetPhysicsInfoString )\n\n#define ENGINE_SETGROUPMASK\t\t( *g_engfuncs.pfnSetGroupMask )\n\n#define ENGINE_INSTANCE_BASELINE ( *g_engfuncs.pfnCreateInstancedBaseline )\n\n#define ENGINE_FORCE_UNMODIFIED\t( *g_engfuncs.pfnForceUnmodified )\n\n#define PLAYER_CNX_STATS\t\t( *g_engfuncs.pfnGetPlayerStats )\n#define CREATE_FAKE_CLIENT  ( *g_engfuncs.pfnCreateFakeClient )\n#define GET_USERINFO   ( *g_engfuncs.pfnGetInfoKeyBuffer )\n#define SET_KEY_VALUE   ( *g_engfuncs.pfnSetKeyValue )\n#define SET_CLIENT_KEY_VALUE ( *g_engfuncs.pfnSetClientKeyValue )\n#define GET_INFO_BUFFER   (*g_engfuncs.pfnGetInfoKeyBuffer)\n#define GET_KEY_VALUE   (*g_engfuncs.pfnInfoKeyValue)\n#endif\t\t//ENGINECALLBACK_H\n"
  },
  {
    "path": "dlls/exportdef.h",
    "content": "#ifndef EXPORTDEF_H\n#define EXPORTDEF_H\n#if defined _WIN32 || defined __CYGWIN__\n\t#ifdef __GNUC__\n\t\t#define EXPORT __attribute__ ((dllexport))\n\t#else\n\t\t#define EXPORT __declspec(dllexport) // Note: actually gcc seems to also supports this syntax.\n\t#endif\n#else\n  #if __GNUC__ >= 4\n\t#define EXPORT __attribute__ ((visibility (\"default\")))\n   #else\n\t#define EXPORT\n  #endif\n#endif\n#define DLLEXPORT EXPORT\n#define _DLLEXPORT EXPORT\n#endif // EXPORTDEF_H\n"
  },
  {
    "path": "dlls/extdll.h",
    "content": "/***\n*\n*\tCopyright (c) 1996-2001, Valve LLC. All rights reserved.\n*\t\n*\tThis product contains software technology licensed from Id \n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc. \n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n#ifndef EXTDLL_H\n#define EXTDLL_H\n\n//\n// Global header file for extension DLLs\n//\n\n// Allow \"DEBUG\" in addition to default \"_DEBUG\"\n#ifdef _DEBUG\n#define DEBUG 1\n#endif\n\n#ifdef _MSC_VER\n// Silence certain warnings\n#pragma warning(disable : 4244)\t\t// int or float down-conversion\n#pragma warning(disable : 4305)\t\t// int or float data truncation\n#pragma warning(disable : 4201)\t\t// nameless struct/union\n#pragma warning(disable : 4514)\t\t// unreferenced inline function removed\n#pragma warning(disable : 4100)\t\t// unreferenced formal parameter\n#endif\n\n#include \"archtypes.h\"     // DAL\n\n// Prevent tons of unused windows definitions\n#ifdef _WIN32\n#define WIN32_LEAN_AND_MEAN\n#define NOWINRES\n#define NOSERVICE\n#define NOMCX\n#define NOIME\n#include \"windows.h\"\n#else // _WIN32\ntypedef unsigned char BYTE;\ntypedef int BOOL;\n#define MAX_PATH PATH_MAX\n#include <limits.h>\n#include <stdarg.h>\n#include <string.h> // memset \n\n#define _vsnprintf(a,b,c,d) vsnprintf(a,b,c,d)\n#endif //_WIN32\n\n// Misc C-runtime library headers\n#include \"stdio.h\"\n#include \"stdlib.h\"\n#include \"math.h\"\n\n#ifndef min\n#define min(a,b)  (((a) < (b)) ? (a) : (b))\n#endif\n#ifndef max\n#define max(a,b)  (((a) > (b)) ? (a) : (b))\n#endif\n\n// Header file containing definition of globalvars_t and entvars_t\n//typedef unsigned int func_t;\t\t\t\t\t//\n//typedef unsigned int string_t;\t\t\t\t// from engine's pr_comp.h;\ntypedef float vec_t;\t\t\t\t// needed before including progdefs.h\n\n// Vector class\n#include \"vector.h\"\n\n// Defining it as a (bogus) struct helps enforce type-checking\n#define vec3_t Vector\n\n// Shared engine/DLL constants\n#include \"const.h\"\n#include \"progdefs.h\"\n#include \"edict.h\"\n\n// Shared header describing protocol between engine and DLLs\n#include \"eiface.h\"\n\n// Shared header between the client DLL and the game DLLs\n#include \"cdll_dll.h\"\n\n#endif //EXTDLL_H\n"
  },
  {
    "path": "dlls/gamerules.h",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\n*\tThis product contains software technology licensed from Id\n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc.\n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n\nclass CBasePlayerItem;\nclass CBasePlayer;\nclass CItem;\nclass CBasePlayerAmmo;\n\n#define MAX_MOTD_CHUNK 60\n#define MAX_MOTD_LENGTH 1536\n\n#define STARTMONEY_MAX 32000\n#define STARTMONEY_MIN 800\nenum\n{\n\tGR_NONE = 0,\n\tGR_WEAPON_RESPAWN_YES,\n\tGR_WEAPON_RESPAWN_NO,\n\tGR_AMMO_RESPAWN_YES,\n\tGR_AMMO_RESPAWN_NO,\n\tGR_ITEM_RESPAWN_YES,\n\tGR_ITEM_RESPAWN_NO,\n\tGR_PLR_DROP_GUN_ALL,\n\tGR_PLR_DROP_GUN_ACTIVE,\n\tGR_PLR_DROP_GUN_NO,\n\tGR_PLR_DROP_AMMO_ALL,\n\tGR_PLR_DROP_AMMO_ACTIVE,\n\tGR_PLR_DROP_AMMO_NO\n};\n\nenum\n{\n\tGR_NOTTEAMMATE = 0,\n\tGR_TEAMMATE,\n\tGR_ENEMY,\n\tGR_ALLY,\n\tGR_NEUTRAL\n};\n\nclass CGameRules\n{\npublic:\n\tvirtual void RefreshSkillData(void);\n\tvirtual void Think(void) = 0;\n\tvirtual BOOL IsAllowedToSpawn(CBaseEntity *pEntity) = 0;\n\tvirtual BOOL FAllowFlashlight(void) = 0;\n\tvirtual BOOL FShouldSwitchWeapon(CBasePlayer *pPlayer, CBasePlayerItem *pWeapon) = 0;\n\tvirtual BOOL GetNextBestWeapon(CBasePlayer *pPlayer, CBasePlayerItem *pCurrentWeapon) = 0;\n\tvirtual BOOL IsMultiplayer(void) = 0;\n\tvirtual BOOL IsDeathmatch(void) = 0;\n\tvirtual BOOL IsTeamplay(void) { return FALSE; }\n\tvirtual BOOL IsCoOp(void) = 0;\n\tvirtual const char *GetGameDescription(void) { return \"Counter-Strike\"; }\n\tvirtual BOOL ClientConnected(edict_t *pEntity, const char *pszName, const char *pszAddress, char szRejectReason[128]) = 0;\n\tvirtual void InitHUD(CBasePlayer *pl) = 0;\n\tvirtual void ClientDisconnected(edict_t *pClient) = 0;\n\tvirtual void UpdateGameMode(CBasePlayer *pPlayer) {}\n\tvirtual float FlPlayerFallDamage(CBasePlayer *pPlayer) = 0;\n\tvirtual BOOL FPlayerCanTakeDamage(CBasePlayer *pPlayer, CBaseEntity *pAttacker) { return TRUE; }\n\tvirtual BOOL ShouldAutoAim(CBasePlayer *pPlayer, edict_t *target) { return TRUE; }\n\tvirtual void PlayerSpawn(CBasePlayer *pPlayer) = 0;\n\tvirtual void PlayerThink(CBasePlayer *pPlayer) = 0;\n\tvirtual BOOL FPlayerCanRespawn(CBasePlayer *pPlayer) = 0;\n\tvirtual float FlPlayerSpawnTime(CBasePlayer *pPlayer) = 0;\n\tvirtual edict_t *GetPlayerSpawnSpot(CBasePlayer *pPlayer);\n\tvirtual BOOL AllowAutoTargetCrosshair(void) { return TRUE; }\n\tvirtual BOOL ClientCommand_DeadOrAlive(CBasePlayer *pPlayer, const char *pcmd) { return FALSE; }\n\tvirtual BOOL ClientCommand(CBasePlayer *pPlayer, const char *pcmd) { return FALSE; }\n\tvirtual void ClientUserInfoChanged(CBasePlayer *pPlayer, char *infobuffer) {}\n\tvirtual int IPointsForKill(CBasePlayer *pAttacker, CBasePlayer *pKilled) = 0;\n\tvirtual void PlayerKilled(CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pInflictor) = 0;\n\tvirtual void DeathNotice(CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pInflictor) = 0;\n\tvirtual BOOL CanHavePlayerItem(CBasePlayer *pPlayer, CBasePlayerItem *pWeapon);\n\tvirtual void PlayerGotWeapon(CBasePlayer *pPlayer, CBasePlayerItem *pWeapon) = 0;\n\tvirtual int WeaponShouldRespawn(CBasePlayerItem *pWeapon) = 0;\n\tvirtual float FlWeaponRespawnTime(CBasePlayerItem *pWeapon) = 0;\n\tvirtual float FlWeaponTryRespawn(CBasePlayerItem *pWeapon) = 0;\n\tvirtual Vector VecWeaponRespawnSpot(CBasePlayerItem *pWeapon) = 0;\n\tvirtual BOOL CanHaveItem(CBasePlayer *pPlayer, CItem *pItem) = 0;\n\tvirtual void PlayerGotItem(CBasePlayer *pPlayer, CItem *pItem) = 0;\n\tvirtual int ItemShouldRespawn(CItem *pItem) = 0;\n\tvirtual float FlItemRespawnTime(CItem *pItem) = 0;\n\tvirtual Vector VecItemRespawnSpot(CItem *pItem) = 0;\n\tvirtual BOOL CanHaveAmmo(CBasePlayer *pPlayer, const char *pszAmmoName, int iMaxCarry);\n\tvirtual void PlayerGotAmmo(CBasePlayer *pPlayer, char *szName, int iCount) = 0;\n\tvirtual int AmmoShouldRespawn(CBasePlayerAmmo *pAmmo) = 0;\n\tvirtual float FlAmmoRespawnTime(CBasePlayerAmmo *pAmmo) = 0;\n\tvirtual Vector VecAmmoRespawnSpot(CBasePlayerAmmo *pAmmo) = 0;\n\tvirtual float FlHealthChargerRechargeTime(void) = 0;\n\tvirtual float FlHEVChargerRechargeTime(void) { return 0; }\n\tvirtual int DeadPlayerWeapons(CBasePlayer *pPlayer) = 0;\n\tvirtual int DeadPlayerAmmo(CBasePlayer *pPlayer) = 0;\n\tvirtual const char *GetTeamID(CBaseEntity *pEntity) = 0;\n\tvirtual int PlayerRelationship(CBaseEntity *pPlayer, CBaseEntity *pTarget) = 0;\n\tvirtual int GetTeamIndex(const char *pTeamName) { return -1; }\n\tvirtual const char *GetIndexedTeamName(int teamIndex) { return \"\"; }\n\tvirtual BOOL IsValidTeam(const char *pTeamName) { return TRUE; }\n\tvirtual void ChangePlayerTeam(CBasePlayer *pPlayer, const char *pTeamName, BOOL bKill, BOOL bGib) {}\n\tvirtual const char *SetDefaultPlayerTeam(CBasePlayer *pPlayer) { return \"\"; }\n\tvirtual BOOL PlayTextureSounds(void) { return TRUE; }\n\tvirtual BOOL FAllowMonsters(void) = 0;\n\tvirtual void EndMultiplayerGame(void) {}\n\tvirtual BOOL IsFreezePeriod(void) { return m_bFreezePeriod; }\n\tvirtual void ServerDeactivate(void) {}\n\tvirtual void CheckMapConditions(void) {}\n\npublic:\n\tBOOL m_bFreezePeriod;\n\tBOOL m_bBombDropped;\n};\n\nextern char *GetTeam(int teamNo);\nextern void Broadcast(const char *sentence, int pitch = 100 );\nextern CGameRules *InstallGameRules(void);\n\nclass CHalfLifeRules : public CGameRules\n{\npublic:\n\tCHalfLifeRules(void);\n\npublic:\n\tvirtual void Think(void);\n\tvirtual BOOL IsAllowedToSpawn(CBaseEntity *pEntity);\n\tvirtual BOOL FAllowFlashlight(void) { return TRUE; }\n\tvirtual BOOL FShouldSwitchWeapon(CBasePlayer *pPlayer, CBasePlayerItem *pWeapon);\n\tvirtual BOOL GetNextBestWeapon(CBasePlayer *pPlayer, CBasePlayerItem *pCurrentWeapon);\n\tvirtual BOOL IsMultiplayer(void);\n\tvirtual BOOL IsDeathmatch(void);\n\tvirtual BOOL IsCoOp(void);\n\tvirtual BOOL ClientConnected(edict_t *pEntity, const char *pszName, const char *pszAddress, char szRejectReason[128]);\n\tvirtual void InitHUD(CBasePlayer *pl);\n\tvirtual void ClientDisconnected(edict_t *pClient);\n\tvirtual float FlPlayerFallDamage(CBasePlayer *pPlayer);\n\tvirtual void PlayerSpawn(CBasePlayer *pPlayer);\n\tvirtual void PlayerThink(CBasePlayer *pPlayer);\n\tvirtual BOOL FPlayerCanRespawn(CBasePlayer *pPlayer);\n\tvirtual float FlPlayerSpawnTime(CBasePlayer *pPlayer);\n\tvirtual edict_t *GetPlayerSpawnSpot(CBasePlayer *pPlayer);\n\tvirtual BOOL AllowAutoTargetCrosshair(void);\n\tvirtual int IPointsForKill(CBasePlayer *pAttacker, CBasePlayer *pKilled);\n\tvirtual void PlayerKilled(CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pInflictor);\n\tvirtual void DeathNotice(CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pInflictor);\n\tvirtual void PlayerGotWeapon(CBasePlayer *pPlayer, CBasePlayerItem *pWeapon);\n\tvirtual int WeaponShouldRespawn(CBasePlayerItem *pWeapon);\n\tvirtual float FlWeaponRespawnTime(CBasePlayerItem *pWeapon);\n\tvirtual float FlWeaponTryRespawn(CBasePlayerItem *pWeapon);\n\tvirtual Vector VecWeaponRespawnSpot(CBasePlayerItem *pWeapon);\n\tvirtual BOOL CanHaveItem(CBasePlayer *pPlayer, CItem *pItem);\n\tvirtual void PlayerGotItem(CBasePlayer *pPlayer, CItem *pItem);\n\tvirtual int ItemShouldRespawn(CItem *pItem);\n\tvirtual float FlItemRespawnTime(CItem *pItem);\n\tvirtual Vector VecItemRespawnSpot(CItem *pItem);\n\tvirtual void PlayerGotAmmo(CBasePlayer *pPlayer, char *szName, int iCount);\n\tvirtual int AmmoShouldRespawn(CBasePlayerAmmo *pAmmo);\n\tvirtual float FlAmmoRespawnTime(CBasePlayerAmmo *pAmmo);\n\tvirtual Vector VecAmmoRespawnSpot(CBasePlayerAmmo *pAmmo);\n\tvirtual float FlHealthChargerRechargeTime(void);\n\tvirtual int DeadPlayerWeapons(CBasePlayer *pPlayer);\n\tvirtual int DeadPlayerAmmo(CBasePlayer *pPlayer);\n\tvirtual BOOL FAllowMonsters(void);\n\tvirtual const char *GetTeamID(CBaseEntity *pEntity) { return \"\"; }\n\tvirtual int PlayerRelationship(CBaseEntity *pPlayer, CBaseEntity *pTarget);\n};\n\n#define MAX_MAPS 100\n#define MAX_VIPQUEUES 5\n\nenum\n{\n\tWINSTATUS_CT = 1,\n\tWINSTATUS_TERRORIST,\n\tWINSTATUS_DRAW\n};\n\n#define Target_Bombed 1\n#define VIP_Escaped 2\n#define VIP_Assassinated 3\n#define Terrorists_Escaped 4\n#define CTs_PreventEscape 5\n#define Escaping_Terrorists_Neutralized 6\n#define Bomb_Defused 7\n#define CTs_Win 8\n#define Terrorists_Win 9\n#define Round_Draw 10\n#define All_Hostages_Rescued 11\n#define Target_Saved 12\n#define Hostages_Not_Rescued 13\n#define Terrorists_Not_Escaped 14\n#define VIP_Not_Escaped 15\n#define Game_Commencing 16\n\n#include \"voice_gamemgr.h\"\n\nclass CHalfLifeMultiplay : public CGameRules\n{\npublic:\n\tCHalfLifeMultiplay(void);\n\npublic:\n\tvirtual void Think(void);\n\tvirtual void RefreshSkillData(void);\n\tvirtual BOOL IsAllowedToSpawn(CBaseEntity *pEntity);\n\tvirtual BOOL FAllowFlashlight(void);\n\tvirtual BOOL FShouldSwitchWeapon(CBasePlayer *pPlayer, CBasePlayerItem *pWeapon);\n\tvirtual BOOL GetNextBestWeapon(CBasePlayer *pPlayer, CBasePlayerItem *pCurrentWeapon);\n\tvirtual BOOL IsMultiplayer(void);\n\tvirtual BOOL IsDeathmatch(void);\n\tvirtual BOOL IsCoOp(void);\n\tvirtual BOOL ClientConnected(edict_t *pEntity, const char *pszName, const char *pszAddress, char szRejectReason[128]);\n\tvirtual void InitHUD(CBasePlayer *pl);\n\tvirtual void ClientDisconnected(edict_t *pClient);\n\tvirtual void UpdateGameMode(CBasePlayer *pPlayer);\n\tvirtual float FlPlayerFallDamage(CBasePlayer *pPlayer);\n\tvirtual BOOL FPlayerCanTakeDamage(CBasePlayer *pPlayer, CBaseEntity *pAttacker);\n\tvirtual void PlayerSpawn(CBasePlayer *pPlayer);\n\tvirtual void PlayerThink(CBasePlayer *pPlayer);\n\tvirtual BOOL FPlayerCanRespawn(CBasePlayer *pPlayer);\n\tvirtual float FlPlayerSpawnTime(CBasePlayer *pPlayer);\n\tvirtual edict_t *GetPlayerSpawnSpot(CBasePlayer *pPlayer);\n\tvirtual BOOL AllowAutoTargetCrosshair(void);\n\tvirtual BOOL ClientCommand_DeadOrAlive(CBasePlayer *pPlayer, const char *pcmd);\n\tvirtual BOOL ClientCommand(CBasePlayer *pPlayer, const char *pcmd);\n\tvirtual void ClientUserInfoChanged(CBasePlayer *pPlayer, char *infobuffer);\n\tvirtual int IPointsForKill(CBasePlayer *pAttacker, CBasePlayer *pKilled);\n\tvirtual void PlayerKilled(CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pInflictor);\n\tvirtual void DeathNotice(CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pInflictor);\n\tvirtual BOOL CanHavePlayerItem(CBasePlayer *pPlayer, CBasePlayerItem *pWeapon);\n\tvirtual void PlayerGotWeapon(CBasePlayer *pPlayer, CBasePlayerItem *pWeapon);\n\tvirtual int WeaponShouldRespawn(CBasePlayerItem *pWeapon);\n\tvirtual float FlWeaponRespawnTime(CBasePlayerItem *pWeapon);\n\tvirtual float FlWeaponTryRespawn(CBasePlayerItem *pWeapon);\n\tvirtual Vector VecWeaponRespawnSpot(CBasePlayerItem *pWeapon);\n\tvirtual BOOL CanHaveItem(CBasePlayer *pPlayer, CItem *pItem);\n\tvirtual void PlayerGotItem(CBasePlayer *pPlayer, CItem *pItem);\n\tvirtual int ItemShouldRespawn(CItem *pItem);\n\tvirtual float FlItemRespawnTime(CItem *pItem);\n\tvirtual Vector VecItemRespawnSpot(CItem *pItem);\n\tvirtual void PlayerGotAmmo(CBasePlayer *pPlayer, char *szName, int iCount);\n\tvirtual int AmmoShouldRespawn(CBasePlayerAmmo *pAmmo);\n\tvirtual float FlAmmoRespawnTime(CBasePlayerAmmo *pAmmo);\n\tvirtual Vector VecAmmoRespawnSpot(CBasePlayerAmmo *pAmmo);\n\tvirtual float FlHealthChargerRechargeTime(void);\n\tvirtual float FlHEVChargerRechargeTime(void);\n\tvirtual int DeadPlayerWeapons(CBasePlayer *pPlayer);\n\tvirtual int DeadPlayerAmmo(CBasePlayer *pPlayer);\n\tvirtual const char *GetTeamID(CBaseEntity *pEntity) { return \"\"; }\n\tvirtual int PlayerRelationship(CBaseEntity *pPlayer, CBaseEntity *pTarget);\n\tvirtual BOOL PlayTextureSounds(void) { return FALSE; }\n\tvirtual BOOL FAllowMonsters(void);\n\tvirtual void EndMultiplayerGame(void) { GoToIntermission(); }\n\tvirtual void CheckMapConditions(void);\n\tvirtual void ServerDeactivate(void);\n\tvirtual void CleanUpMap(void);\n\tvirtual void RestartRound(void);\n\tvirtual void CheckWinConditions(void);\n\tvirtual void RemoveGuns(void);\n\tvirtual void GiveC4(void);\n\tvirtual void ChangeLevel(void);\n\tvirtual void GoToIntermission(void);\n\tvirtual void SetRestartServerAtRoundEnd();\n\tvirtual BOOL ShouldRestart();\npublic:\n\tvoid SendMOTDToClient(edict_t *client);\n\tvoid InitializePlayerCounts(int &NumAliveTerrorist, int &NumAliveCT, int &NumDeadTerrorist, int &NumDeadCT);\n\tBOOL NeededPlayersCheck(BOOL &bNeededPlayers);\n\tBOOL VIPRoundEndCheck(BOOL bNeededPlayers);\n\tBOOL PrisonRoundEndCheck(int NumAliveTerrorist, int NumAliveCT, int NumDeadTerrorist, int NumDeadCT, BOOL bNeededPlayers);\n\tBOOL BombRoundEndCheck(BOOL bNeededPlayers);\n\tBOOL TeamExterminationCheck(int NumAliveTerrorist, int NumAliveCT, int NumDeadTerrorist, int NumDeadCT, BOOL bNeededPlayers);\n\tBOOL HostageRescueRoundEndCheck(BOOL bNeededPlayers);\n\tvoid BalanceTeams(void);\n\tBOOL IsThereABomber(void);\n\tBOOL IsThereABomb(void);\n\tBOOL TeamFull(int team_id);\n\tBOOL TeamStacked(int newTeam_id, int curTeam_id);\n\tvoid StackVIPQueue(void);\n\tvoid CheckVIPQueue(void);\n\tBOOL IsVIPQueueEmpty(void);\n\tBOOL AddToVIPQueue(CBasePlayer *pPlayer);\n\tvoid ResetCurrentVIP(void);\n\tvoid PickNextVIP(void);\n\tvoid CheckFreezePeriodExpired(void);\n\tvoid CheckRoundTimeExpired(void);\n\tvoid CheckLevelInitialized(void);\n\tvoid CheckRestartRound(void);\n\tBOOL CheckTimeLimit(void);\n\tBOOL CheckMaxRounds(void);\n\tBOOL CheckGameOver(void);\n\tBOOL CheckWinLimit(void);\n\tvoid CheckAllowSpecator(void);\n\tvoid CheckGameCvar(void);\n\tvoid DisplayMaps(CBasePlayer *pPlayer, int mapId);\n\tvoid ResetAllMapVotes(void);\n\tvoid ProcessMapVote(CBasePlayer *pPlayer, int mapId);\n\tvoid UpdateTeamScores(void);\n\tvoid SwapAllPlayers(void);\n\tvoid TerminateRound(float tmDelay, int iWinStatus);\n\tvoid QueueCareerRoundEndMenu(float tmDelay, int iWinStatus);\n\tfloat TimeRemaining(void) { return m_iRoundTimeSecs - gpGlobals->time + m_fRoundCount; }\n\tBOOL HasRoundTimeExpired(void);\n\tBOOL IsBombPlanted(void);\n\tvoid MarkLivingPlayersOnTeamAsNotReceivingMoneyNextRound(int team);\n\tvoid CareerRestart(void);\n\tBOOL IsCareer(void) { return FALSE; }\n\npublic:\n\tCVoiceGameMgr m_VoiceGameMgr;\n\tfloat m_fTeamCount;\n\tfloat m_flCheckWinConditions;\n\tfloat m_fRoundCount;\n\tint m_iRoundTime;\n\tint m_iRoundTimeSecs;\n\tint m_iIntroRoundTime;\n\tfloat m_fIntroRoundCount;\n\tint m_iAccountTerrorist;\n\tint m_iAccountCT;\n\tint m_iNumTerrorist;\n\tint m_iNumCT;\n\tint m_iNumSpawnableTerrorist;\n\tint m_iNumSpawnableCT;\n\tint m_iSpawnPointCount_Terrorist;\n\tint m_iSpawnPointCount_CT;\n\tint m_iHostagesRescued;\n\tint m_iHostagesTouched;\n\tint m_iRoundWinStatus;\n\tshort m_iNumCTWins;\n\tshort m_iNumTerroristWins;\n\tbool m_bTargetBombed;\n\tbool m_bBombDefused;\n\tbool m_bMapHasBombTarget;\n\tbool m_bMapHasBombZone;\n\tbool m_bMapHasBuyZone;\n\tbool m_bMapHasRescueZone;\n\tbool m_bMapHasEscapeZone;\n\tint m_iMapHasVIPSafetyZone;\n\tint m_bMapHasCameras;\n\tint m_iC4Timer;\n\tint m_iC4Guy;\n\tint m_iLoserBonus;\n\tint m_iNumConsecutiveCTLoses;\n\tint m_iNumConsecutiveTerroristLoses;\n\tfloat m_fMaxIdlePeriod;\n\tint m_iLimitTeams;\n\tbool m_bLevelInitialized;\n\tbool m_bRoundTerminating;\n\tbool m_bCompleteReset;\n\tfloat m_flRequiredEscapeRatio;\n\tint m_iNumEscapers;\n\tint m_iHaveEscaped;\n\tbool m_bCTCantBuy;\n\tbool m_bTCantBuy;\n\tfloat m_flBombRadius;\n\tint m_iConsecutiveVIP;\n\tint m_iTotalGunCount;\n\tint m_iTotalGrenadeCount;\n\tint m_iTotalArmourCount;\n\tint m_iUnBalancedRounds;\n\tint m_iNumEscapeRounds;\n\tint m_iMapVotes[MAX_MAPS];\n\tint m_iLastPick;\n\tint m_iMaxMapTime;\n\tint m_iMaxRounds;\n\tint m_iTotalRoundsPlayed;\n\tint m_iMaxRoundsWon;\n\tint m_iStoredSpectValue;\n\tfloat m_flForceCameraValue;\n\tfloat m_flForceChaseCamValue;\n\tfloat m_flFadeToBlackValue;\n\tCBasePlayer *m_pVIP;\n\tCBasePlayer *VIPQueue[MAX_VIPQUEUES];\n\tfloat m_flIntermissionEndTime;\n\tfloat m_flIntermissionStartTime;\n\tint m_iEndIntermissionButtonHit;\n\tfloat m_tmNextPeriodicThink;\n\tbool m_bFirstConnected;\n\tbool m_bInCareerGame;\n\tfloat m_fCareerRoundMenuTime;\n\tint m_iCareerMatchWins;\n\tint m_iRoundWinDifference;\n\tfloat m_fCareerMatchMenuTime;\n\tbool m_bSkipSpawn;\n\tBOOL m_bShouldRestart;\n};\n\nextern DLL_GLOBAL CHalfLifeMultiplay *g_pGameRules;\n"
  },
  {
    "path": "dlls/monsterevent.h",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\n*\tThis product contains software technology licensed from Id\n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc.\n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n#ifndef MONSTEREVENT_H\n#define MONSTEREVENT_H\n\ntypedef struct\n{\n\tint event;\n\tchar *options;\n}\nMonsterEvent_t;\n\n#define EVENT_SPECIFIC 0\n#define EVENT_SCRIPTED 1000\n#define EVENT_SHARED 2000\n#define EVENT_CLIENT 5000\n\n#define MONSTER_EVENT_BODYDROP_LIGHT 2001\n#define MONSTER_EVENT_BODYDROP_HEAVY 2002\n#define MONSTER_EVENT_SWISHSOUND 2010\n\n#endif"
  },
  {
    "path": "dlls/monsters.h",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\n*\tThis product contains software technology licensed from Id\n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc.\n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n#ifndef MONSTERS_H\n#include \"skill.h\"\n#define MONSTERS_H\n\ntypedef enum\n{\n\tHITGROUP_GENERIC,\n\tHITGROUP_HEAD,\n\tHITGROUP_CHEST,\n\tHITGROUP_STOMACH,\n\tHITGROUP_LEFTARM,\n\tHITGROUP_RIGHTARM,\n\tHITGROUP_LEFTLEG,\n\tHITGROUP_RIGHTLEG,\n\tHITGROUP_SHIELD,\n\tNUM_HITGROUPS\n}\nHitBoxGroup;\n\n#define SF_MONSTER_WAIT_TILL_SEEN 1\n#define SF_MONSTER_GAG 2\n#define SF_MONSTER_HITMONSTERCLIP 4\n#define SF_MONSTER_PRISONER 16\n#define SF_MONSTER_WAIT_FOR_SCRIPT 128\n#define SF_MONSTER_PREDISASTER 256\n#define SF_MONSTER_FADECORPSE 512\n#define SF_MONSTER_FALL_TO_GROUND 0x80000000\n#define SF_MONSTER_TURRET_AUTOACTIVATE 32\n#define SF_MONSTER_TURRET_STARTINACTIVE 64\n\nextern void UTIL_MoveToOrigin(edict_t *pent, const Vector &vecGoal, float flDist, int iMoveType);\nVector VecCheckToss(entvars_t *pev, const Vector &vecSpot1, Vector vecSpot2, float flGravityAdj = 1);\nVector VecCheckThrow(entvars_t *pev, const Vector &vecSpot1, Vector vecSpot2, float flSpeed, float flGravityAdj = 1);\n\nextern DLL_GLOBAL Vector g_vecAttackDir;\nextern DLL_GLOBAL CONSTANT float g_flMeleeRange;\nextern DLL_GLOBAL CONSTANT float g_flMediumRange;\nextern DLL_GLOBAL CONSTANT float g_flLongRange;\n\nextern void EjectBrass(const Vector &vecOrigin, const Vector &vecLeft, const Vector &vecVelocity, float rotation, int model, int soundtype, int entityIndex);\nextern void EjectBrass2(const Vector &vecOrigin, const Vector &vecVelocity, float rotation, int model, int soundtype, entvars_t *pev);\nextern void ExplodeModel(const Vector &vecOrigin, float speed, int model, int count);\n\nBOOL FBoxVisible(entvars_t *pevLooker, entvars_t *pevTarget);\nBOOL FBoxVisible(entvars_t *pevLooker, entvars_t *pevTarget, Vector &vecTargetOrigin, float flSize = 0);\n\n#define R_AL -2\n#define R_FR -1\n#define R_NO 0\n#define R_DL 1\n#define R_HT 2\n#define R_NM 3\n\n#define bits_MEMORY_KILLED (1<<7)\n\nclass CGib : public CBaseEntity\n{\npublic:\n\tvoid Spawn(const char *szGibModel); // -V762\n\tint ObjectCaps(void) { return (CBaseEntity::ObjectCaps() & ~FCAP_ACROSS_TRANSITION) | FCAP_DONT_SAVE; }\n\npublic:\n\tvoid EXPORT BounceGibTouch(CBaseEntity *pOther);\n\tvoid EXPORT StickyGibTouch(CBaseEntity *pOther);\n\tvoid EXPORT WaitTillLand(void);\n\tvoid LimitVelocity(void);\n\npublic:\n\tstatic void SpawnHeadGib(entvars_t *pevVictim);\n\tstatic void SpawnRandomGibs(entvars_t *pevVictim, int cGibs, int human);\n\tstatic void SpawnStickyGibs(entvars_t *pevVictim, Vector vecOrigin, int cGibs);\n\npublic:\n\tint m_bloodColor;\n\tint m_cBloodDecals;\n\tint m_material;\n\tfloat m_lifeTime;\n};\n\n#endif\n"
  },
  {
    "path": "dlls/nodes.h",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\n*\tThis product contains software technology licensed from Id\n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc.\n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n#ifndef NODES_H\n#define NODES_H\n\n#define bits_NODE_GROUP_REALM 1\n\nclass CLink\n{\npublic:\n\tentvars_t *m_pLinkEnt;\n};\n\nclass CGraph\n{\npublic:\n\tBOOL m_fGraphPresent;\n\tBOOL m_fGraphPointersSet;\n\tint m_cLinks;\n\tCLink *m_pLinkPool;\n\npublic:\n\tvoid InitGraph(void);\n\tint AllocNodes(void);\n\tint CheckNODFile(char *szMapName);\n\tint FLoadGraph(char *szMapName);\n\tint FSetGraphPointers(void);\n\tvoid ShowNodeConnections(int iNode);\n\tint FindNearestNode(const Vector &vecOrigin, CBaseEntity *pEntity);\n\tint FindNearestNode(const Vector &vecOrigin, int afNodeTypes);\n};\n\nextern CGraph WorldGraph;\n#endif"
  },
  {
    "path": "dlls/player.h",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\n*\tThis product contains software technology licensed from Id\n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc.\n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n#ifndef PLAYER_H\n#define PLAYER_H\n\n#include \"pm_materials.h\"\n#include \"weapons.h\"\n\n#define MAX_PLAYER_NAME_LENGTH 32\n#define MAX_AUTOBUY_LENGTH 256\n#define MAX_REBUY_LENGTH 256\n#define MAX_LACTION_LENGTH 32\n\n#define PLAYER_FATAL_FALL_SPEED (float)1100\n#define PLAYER_MAX_SAFE_FALL_SPEED (float)500\n#define DAMAGE_FOR_FALL_SPEED (float)100.0 / (PLAYER_FATAL_FALL_SPEED - PLAYER_MAX_SAFE_FALL_SPEED)\n#define PLAYER_MIN_BOUNCE_SPEED (float)350\n#define PLAYER_FALL_PUNCH_THRESHOLD (float)250.0\n\n#define PFLAG_ONLADDER (1<<0)\n#define PFLAG_ONSWING (1<<0)\n#define PFLAG_ONTRAIN (1<<1)\n#define PFLAG_ONBARNACLE (1<<2)\n#define PFLAG_DUCKING (1<<3)\n#define PFLAG_USING (1<<4)\n#define PFLAG_OBSERVER (1<<5)\n\n#define TRAIN_ACTIVE 0x80\n#define TRAIN_NEW 0xc0\n#define TRAIN_OFF 0x00\n#define TRAIN_NEUTRAL 0x01\n#define TRAIN_SLOW 0x02\n#define TRAIN_MEDIUM 0x03\n#define TRAIN_FAST 0x04\n#define TRAIN_BACK 0x05\n\n#define DHF_ROUND_STARTED (1<<1)\n#define DHF_HOSTAGE_SEEN_FAR (1<<2)\n#define DHF_HOSTAGE_SEEN_NEAR (1<<3)\n#define DHF_HOSTAGE_USED (1<<4)\n#define DHF_HOSTAGE_INJURED (1<<5)\n#define DHF_HOSTAGE_KILLED (1<<6)\n#define DHF_FRIEND_SEEN (1<<7)\n#define DHF_ENEMY_SEEN (1<<8)\n#define DHF_FRIEND_INJURED (1<<9)\n#define DHF_FRIEND_KILLED (1<<10)\n#define DHF_ENEMY_KILLED (1<<11)\n#define DHF_BOMB_RETRIEVED (1<<12)\n#define DHF_AMMO_EXHAUSTED (1<<15)\n#define DHF_IN_TARGET_ZONE (1<<16)\n#define DHF_IN_RESCUE_ZONE (1<<17)\n#define DHF_IN_ESCAPE_ZONE (1<<18)\n#define DHF_IN_VIPSAFETY_ZONE (1<<19)\n#define DHF_NIGHTVISION (1<<20)\n#define DHF_HOSTAGE_CTMOVE (1<<21)\n#define\tDHF_SPEC_DUCK (1<<22)\n\n#define DHM_ROUND_CLEAR (DHF_ROUND_STARTED | DHF_HOSTAGE_KILLED | DHF_FRIEND_KILLED | DHF_BOMB_RETRIEVED)\n#define DHM_CONNECT_CLEAR (DHF_HOSTAGE_SEEN_FAR | DHF_HOSTAGE_SEEN_NEAR | DHF_HOSTAGE_USED | DHF_HOSTAGE_INJURED | DHF_FRIEND_SEEN | DHF_ENEMY_SEEN | DHF_FRIEND_INJURED | DHF_ENEMY_KILLED | DHF_AMMO_EXHAUSTED | DHF_IN_TARGET_ZONE | DHF_IN_RESCUE_ZONE | DHF_IN_ESCAPE_ZONE | DHF_IN_VIPSAFETY_ZONE | DHF_HOSTAGE_CTMOVE | DHF_SPEC_DUCK)\n\n#define SIGNAL_BUY (1<<0)\n#define SIGNAL_BOMB (1<<1)\n#define SIGNAL_RESCUE (1<<2)\n#define SIGNAL_ESCAPE (1<<3)\n#define SIGNAL_VIPSAFETY (1<<4)\n\nclass CUnifiedSignals\n{\npublic:\n\tCUnifiedSignals(void)\n\t{\n\t\tm_flSignal = 0;\n\t\tm_flState = 0;\n\t}\n\npublic:\n\tvoid Update(void)\n\t{\n\t\tm_flState = m_flSignal;\n\t\tm_flSignal = 0;\n\t}\n\n\tvoid Signal(int flags) { m_flSignal |= flags; }\n\tint GetSignal(void) { return m_flSignal; }\n\tint GetState(void) { return m_flState; }\n\nprivate:\n\tint m_flSignal;\n\tint m_flState;\n};\n\n#define IGNOREMSG_NONE 0\n#define IGNOREMSG_ENEMY 1\n#define IGNOREMSG_TEAM 2\n\n#define CSUITPLAYLIST 4\n\n#define SUIT_GROUP TRUE\n#define SUIT_SENTENCE FALSE\n\n#define SUIT_REPEAT_OK 0\n#define SUIT_NEXT_IN_30SEC 30\n#define SUIT_NEXT_IN_1MIN 60\n#define SUIT_NEXT_IN_5MIN 300\n#define SUIT_NEXT_IN_10MIN 600\n#define SUIT_NEXT_IN_30MIN 1800\n#define SUIT_NEXT_IN_1HOUR 3600\n\n#define CSUITNOREPEAT 32\n\n#define SOUND_FLASHLIGHT_ON \"items/flashlight1.wav\"\n#define SOUND_FLASHLIGHT_OFF \"items/flashlight1.wav\"\n\n#define TEAM_NAME_LENGTH 16\n\ntypedef enum\n{\n\tPLAYER_IDLE,\n\tPLAYER_WALK,\n\tPLAYER_JUMP,\n\tPLAYER_SUPERJUMP,\n\tPLAYER_DIE,\n\tPLAYER_ATTACK1,\n\tPLAYER_ATTACK2,\n\tPLAYER_FLINCH,\n\tPLAYER_LARGE_FLINCH,\n\tPLAYER_RELOAD,\n\tPLAYER_HOLDBOMB\n}\nPLAYER_ANIM;\n\ntypedef enum\n{\n\tMenu_OFF,\n\tMenu_ChooseTeam,\n\tMenu_IGChooseTeam,\n\tMenu_ChooseAppearance,\n\tMenu_Buy,\n\tMenu_BuyPistol,\n\tMenu_BuyRifle,\n\tMenu_BuyMachineGun,\n\tMenu_BuyShotgun,\n\tMenu_BuySubMachineGun,\n\tMenu_BuyItem,\n\tMenu_Radio1,\n\tMenu_Radio2,\n\tMenu_Radio3,\n\tMenu_ClientBuy\n}\nMenu;\n\ntypedef enum\n{\n\tMODEL_UNASSIGNED,\n\tMODEL_URBAN,\n\tMODEL_TERROR,\n\tMODEL_LEET,\n\tMODEL_ARCTIC,\n\tMODEL_GSG9,\n\tMODEL_GIGN,\n\tMODEL_SAS,\n\tMODEL_GUERILLA,\n\tMODEL_VIP,\n\tMODEL_MILITIA,\n\tMODEL_SPETSNAZ\n}\nModelName;\n\ntypedef enum\n{\n\tJOINED,\n\tSHOWLTEXT,\n\tREADINGLTEXT,\n\tSHOWTEAMSELECT,\n\tPICKINGTEAM,\n\tGETINTOGAME\n}\nJoinState;\n\ntypedef struct\n{\n\tint m_primaryWeapon;\n\tint m_primaryAmmo;\n\tint m_secondaryWeapon;\n\tint m_secondaryAmmo;\n\tint m_heGrenade;\n\tint m_flashbang;\n\tint m_smokeGrenade;\n\tBOOL m_defuser;\n\tBOOL m_nightVision;\n\tint m_armor;\n}\nRebuyStruct;\n\ntypedef enum\n{\n\tTHROW_NONE,\n\tTHROW_FORWARD,\n\tTHROW_BACKWARD,\n\tTHROW_HITVEL,\n\tTHROW_BOMB,\n\tTHROW_GRENADE,\n\tTHROW_HITVEL_MINUS_AIRVEL\n}\nThrowDirection;\n\n#define MAX_ID_RANGE 2048\n#define MAX_SPECTATOR_ID_RANGE 8192\n#define SBAR_STRING_SIZE 128\n\n#define SBAR_TARGETTYPE_TEAMMATE 1\n#define SBAR_TARGETTYPE_ENEMY 2\n#define SBAR_TARGETTYPE_HOSTAGE 3\n\nenum sbar_data\n{\n\tSBAR_ID_TARGETTYPE = 1,\n\tSBAR_ID_TARGETNAME,\n\tSBAR_ID_TARGETHEALTH,\n\tSBAR_END\n};\n\ntypedef enum\n{\n\tSILENT,\n\tCALM,\n\tINTENSE\n}\nMusicState;\n\n#define CHAT_INTERVAL 1.0\n\nclass CBasePlayer : public CBaseMonster\n{\npublic:\n\tvirtual void Spawn(void);\n\tvirtual void Precache(void) { }\n\tvirtual void Restart(void) { }\n\tvirtual int Save(CSave &save) { return 1; }\n\tvirtual int Restore(CRestore &restore) { return 1; }\n\tvirtual int ObjectCaps(void) { return CBaseMonster::ObjectCaps() & ~FCAP_ACROSS_TRANSITION; }\n\tvirtual int Classify(void) { return 0; }\n\tvirtual void TraceAttack(entvars_t *pevAttacker, float flDamage, const Vector &vecDir, TraceResult *ptr, int bitsDamageType) { }\n\tvirtual int TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) { return 0; }\n\tvirtual int TakeHealth(float flHealth, int bitsDamageType) { return 0; }\n\tvirtual void Killed(entvars_t *pevAttacker, int iGib);\n\tvirtual void AddPoints(int score, BOOL bAllowNegativeScore) {}\n\tvirtual void AddPointsToTeam(int score, BOOL bAllowNegativeScore) {}\n\tvirtual BOOL AddPlayerItem(CBasePlayerItem *pItem) { return false; }\n\tvirtual BOOL RemovePlayerItem(CBasePlayerItem *pItem) { return false; }\n\tvirtual int GiveAmmo(int iAmount, char *szName, int iMax){ return 0; }\n\tvirtual void StartSneaking(void) { m_tSneaking = gpGlobals->time - 1; }\n\tvirtual void StopSneaking(void) { m_tSneaking = gpGlobals->time + 30; }\n\tvirtual BOOL IsSneaking(void) { return m_tSneaking <= gpGlobals->time; }\n\tvirtual BOOL IsAlive(void) { return pev->deadflag == DEAD_NO && pev->health > 0; }\n\tvirtual BOOL IsPlayer(void) { return TRUE; }\n\tvirtual BOOL IsNetClient(void) { return TRUE; }\n\tvirtual const char *TeamID(void) { return NULL; }\n\tvirtual BOOL FBecomeProne(void) { return TRUE; }\n\tvirtual Vector BodyTarget(const Vector &posSrc) { return Center() + pev->view_ofs * RANDOM_FLOAT(0.5, 1.1); }\n\tvirtual int Illumination(void) { return 0; }\n\tvirtual BOOL ShouldFadeOnDeath(void) { return FALSE; }\n\tvirtual void ResetMaxSpeed(void) {  }\n\tvirtual void Jump(void) { }\n\tvirtual void Duck(void) { }\n\tvirtual void PreThink(void) { }\n\tvirtual void PostThink(void) { }\n\tvirtual Vector GetGunPosition(void);\n\tvirtual BOOL IsBot(void) { return FALSE; }\n\tvirtual void UpdateClientData(void) { }\n\tvirtual void ImpulseCommands(void) { }\n\tvirtual void RoundRespawn(void) { }\n\tvirtual Vector GetAutoaimVector(float flDelta) { return g_vecZero; }\n\tvirtual void Blind(float flUntilTime, float flHoldTime, float flFadeTime, int iAlpha) { }\n\tvirtual void OnTouchingWeapon(CBasePlayerWeapon *pWeapon) {}\n\npublic:\n\tvoid Pain(int hitgroup, bool hitkevlar);\n\tvoid RenewItems(void);\n\tvoid PackDeadPlayerItems(void);\n\tvoid RemoveAllItems(BOOL removeSuit);\n\tvoid SwitchTeam(void);\n\tBOOL SwitchWeapon(CBasePlayerItem *pWeapon);\n\tBOOL IsOnLadder(void);\n\tBOOL FlashlightIsOn(void);\n\tvoid FlashlightTurnOn(void);\n\tvoid FlashlightTurnOff(void);\n\tvoid UpdatePlayerSound(void);\n\tvoid DeathSound(void);\n\tvoid SetAnimation(PLAYER_ANIM playerAnim);\n\tvoid SetWeaponAnimType(const char *szExtention);\n\tvoid CheatImpulseCommands(int iImpulse);\n\tvoid StartDeathCam(void);\n\tvoid StartObserver(const Vector &vecPosition, const Vector &vecViewAngle);\n\tCBaseEntity *Observer_IsValidTarget(int iTarget, bool bOnlyTeam);\n\tvoid Observer_FindNextPlayer(bool bReverse, char *name = NULL);\n\tvoid Observer_HandleButtons(void);\n\tvoid Observer_SetMode(int iMode);\n\tvoid Observer_CheckTarget(void);\n\tvoid Observer_CheckProperties(void);\n\tint IsObserver(void) { return pev->iuser1; }\n\tbool IsObservingPlayer(CBasePlayer *pTarget);\n\tvoid SetObserverAutoDirector(bool bState);\n\tBOOL CanSwitchObserverModes(void);\n\tvoid DropPlayerItem(const char *pszItemName);\n\tvoid ThrowPrimary(void);\n\tvoid ThrowWeapon(char *pszWeaponName);\n\tBOOL HasPlayerItem(CBasePlayerItem *pCheckItem);\n\tBOOL HasNamedPlayerItem(const char *pszItemName);\n\tBOOL HasWeapons(void);\n\tvoid SelectPrevItem(int iItem);\n\tvoid SelectNextItem(int iItem);\n\tvoid SelectLastItem(void);\n\tvoid SelectItem(const char *pstr);\n\tvoid ItemPreFrame(void);\n\tvoid ItemPostFrame(void);\n\tvoid GiveNamedItem(const char *szName);\n\tvoid EnableControl(BOOL fControl);\n\tvoid SendAmmoUpdate(void);\n\tvoid SendFOV(int iFOV);\n\tvoid SendHostagePos(void);\n\tvoid SendHostageIcons(void);\n\tvoid SendWeatherInfo(void);\n\tvoid WaterMove(void);\n\tvoid EXPORT PlayerDeathThink(void);\n\tvoid PlayerUse(void);\n\tvoid CheckSuitUpdate(void);\n\tvoid SetSuitUpdate(const char *name, int fgroup, int iNoRepeat);\n\tvoid UpdateGeigerCounter(void);\n\tvoid CheckTimeBasedDamage(void);\n\tvoid BarnacleVictimBitten(entvars_t *pevBarnacle);\n\tvoid BarnacleVictimReleased(void);\n\tstatic int GetAmmoIndex(const char *psz);\n\tint AmmoInventory(int iAmmoIndex);\n\tvoid ResetAutoaim(void);\n\tVector AutoaimDeflection(Vector &vecSrc, float flDist, float flDelta);\n\tvoid ForceClientDllUpdate(void);\n\tvoid SetCustomDecalFrames(int nFrames);\n\tint GetCustomDecalFrames(void);\n\tvoid TabulateAmmo(void);\n\tvoid SetProgressBarTime(int iTime);\n\tvoid SetProgressBarTime2(int iTime, float flLastTime);\n\tvoid SetPlayerModel(BOOL HasC4);\n\tvoid SetNewPlayerModel(const char *model);\n\tvoid CheckPowerups(entvars_t *pev);\n\tvoid SmartRadio(void);\n\tvoid Radio(const char *msg_id, const char *msg_verbose, int pitch = 100, bool showIcon = true);\n\tvoid GiveDefaultItems(void);\n\tvoid SetBombIcon(BOOL bFlash);\n\tvoid SetScoreAttrib(CBasePlayer *dest);\n\tvoid SetScoreboardAttributes(CBasePlayer *pPlayer = NULL);\n\tBOOL IsBombGuy(void);\n\tBOOL ShouldDoLargeFlinch(int nHitGroup, int nGunType);\n\tBOOL IsArmored(int nHitGroup);\n\tbool HintMessage(const char *pMessage, BOOL bDisplayIfDead = FALSE, BOOL bOverrideClientSettings = FALSE);\n\tvoid AddAccount(int amount, bool bTrackChange = true);\n\tvoid SyncRoundTimer(void);\n\tvoid MenuPrint(const char *text);\n\tvoid ResetMenu(void);\n\tvoid MakeVIP(void);\n\tvoid JoiningThink(void);\n\tvoid ResetStamina(void);\n\tvoid Disappear(void);\n\tvoid RemoveLevelText(void);\n\tvoid MoveToNextIntroCamera(void);\n\tvoid SpawnClientSideCorpse(void);\n\tvoid SetPrefsFromUserinfo(char *infobuffer);\n\tvoid HostageUsed(void);\n\tbool CanPlayerBuy(bool display);\n\tvoid StudioEstimateGait(void);\n\tvoid CalculatePitchBlend(void);\n\tvoid CalculateYawBlend(void);\n\tvoid StudioProcessGait(void);\n\tvoid HandleSignals(void);\n\tvoid EnterEscapeZone(void);\n\tvoid LeaveEscapeZone(void);\n\tvoid EnterVIPSafetyZone(void);\n\tvoid LeaveVIPSafetyZone(void);\n\tvoid InitStatusBar(void);\n\tvoid UpdateStatusBar(void);\n\tbool IsHittingShield(const Vector &vecDirection, TraceResult *ptr);\n\tbool IsReloading(void);\n\tbool IsThrowingGrenade(void);\n\tvoid StopReload(void);\n\tvoid DrawnShiled(void);\n\tbool HasShield(void);\n\tvoid UpdateShieldCrosshair(bool bShieldDrawn);\n\tvoid DropShield(bool bDeploy);\n\tvoid GiveShield(bool bRetire);\n\tbool IsProtectedByShield(void);\n\tvoid RemoveShield(void);\n\tvoid UpdateLocation(bool bForceUpdate);\n\tvoid ClientCommand(const char *arg0, const char *arg1 = NULL, const char *arg2 = NULL, const char *arg3 = NULL);\n\tvoid ClearAutoBuyData(void);\n\tvoid AddAutoBuyData(const char *string);\n\tvoid InitRebuyData(const char *string);\n\tvoid AutoBuy(void);\n\tbool ShouldExecuteAutoBuyCommand(const AutoBuyInfoStruct *commandInfo, bool boughtPrimary, bool boughtSecondary);\n\tAutoBuyInfoStruct *GetAutoBuyCommandInfo(const char *command);\n\tvoid PrioritizeAutoBuyString(char *autobuyString, const char *priorityString);\n\tvoid ParseAutoBuyString(const char *string, bool &boughtPrimary, bool &boughtSecondary);\n\tvoid PostAutoBuyCommandProcessing(const AutoBuyInfoStruct *commandInfo, bool &boughtPrimary, bool &boughtSecondary);\n\tvoid BuildRebuyStruct(void);\n\tvoid Rebuy(void);\n\tvoid RebuyPrimaryWeapon(void);\n\tvoid RebuyPrimaryAmmo(void);\n\tvoid RebuySecondaryWeapon(void);\n\tvoid RebuySecondaryAmmo(void);\n\tvoid RebuyHEGrenade(void);\n\tvoid RebuyFlashbang(void);\n\tvoid RebuySmokeGrenade(void);\n\tvoid RebuyDefuser(void);\n\tvoid RebuyNightVision(void);\n\tvoid RebuyArmor(void);\n\npublic:\n\tstatic TYPEDESCRIPTION m_playerSaveData[];\n\npublic:\n\tint random_seed;\n\tunsigned short m_usPlayerBleed;\n\tEHANDLE m_hObserverTarget;\n\tfloat m_flNextObserverInput;\n\tint m_iObserverWeapon;\n\tint m_iObserverC4State;\n\tbool m_bObserverHasDefuser;\n\tint m_iObserverLastMode;\n\tfloat m_flFlinchTime;\n\tfloat m_flAnimTime;\n\tbool m_bHighDamage;\n\tfloat m_flVelocityModifier;\n\tint m_iLastZoom;\n\tbool m_bResumeZoom;\n\tfloat m_flEjectBrass;\n\tint m_iKevlar;\n\tbool m_bNotKilled;\n\tint m_iTeam;\n\tint m_iAccount;\n\tbool m_bHasPrimary;\n\tfloat m_flDeathThrowTime;\n\tint m_iThrowDirection;\n\tfloat m_flLastTalk;\n\tbool m_bJustConnected;\n\tbool m_bContextHelp;\n\tJoinState m_iJoiningState;\n\tCBaseEntity *m_pIntroCamera;\n\tfloat m_fIntroCamTime;\n\tfloat m_fLastMovement;\n\tbool m_bMissionBriefing;\n\tbool m_bTeamChanged;\n\tint m_iModelName;\n\tint m_iTeamKills;\n\tint m_iIgnoreGlobalChat;\n\tbool m_bHasNightVision;\n\tbool m_bNightVisionOn;\n\tVector m_vRecentPath[20];\n\tfloat m_flIdleCheckTime;\n\tfloat m_flRadioTime;\n\tint m_iRadioMessages;\n\tbool m_bIgnoreRadio;\n\tbool m_bHasC4;\n\tbool m_bHasDefuser;\n\tbool m_bKilledByBomb;\n\tVector m_vBlastVector;\n\tbool m_bKilledByGrenade;\n\tint m_flDisplayHistory;\n\tint m_iMenu;\n\tint m_iChaseTarget;\n\tCBaseEntity *m_pChaseTarget;\n\tBOOL m_fCamSwitch;\n\tbool m_bEscaped;\n\tbool m_bIsVIP;\n\tfloat m_tmNextRadarUpdate;\n\tVector m_vLastOrigin;\n\tint m_iCurrentKickVote;\n\tfloat m_flNextVoteTime;\n\tbool m_bJustKilledTeammate;\n\tint m_iHostagesKilled;\n\tint m_iMapVote;\n\tbool m_bCanShoot;\n\tfloat m_flLastFired;\n\tfloat m_flLastAttackedTeammate;\n\tbool m_bHeadshotKilled;\n\tbool m_bPunishedForTK;\n\tbool m_bReceivesNoMoneyNextRound;\n\tint m_iTimeCheckAllowed;\n\tbool m_bHasChangedName;\n\tchar m_szNewName[MAX_PLAYER_NAME_LENGTH];\n\tbool m_bIsDefusing;\n\tfloat m_tmHandleSignals;\n\tCUnifiedSignals m_signals;\n\tedict_t *m_pentCurBombTarget;\n\tint m_iPlayerSound;\n\tint m_iTargetVolume;\n\tint m_iWeaponVolume;\n\tint m_iExtraSoundTypes;\n\tint m_iWeaponFlash;\n\tfloat m_flStopExtraSoundTime;\n\tfloat m_flFlashLightTime;\n\tint m_iFlashBattery;\n\tint m_afButtonLast;\n\tint m_afButtonPressed;\n\tint m_afButtonReleased;\n\tedict_t *m_pentSndLast;\n\tfloat m_flSndRoomtype;\n\tfloat m_flSndRange;\n\tfloat m_flFallVelocity;\n\tint m_rgItems[MAX_ITEMS];\n\tint m_fNewAmmo;\n\tunsigned int m_afPhysicsFlags;\n\tfloat m_fNextSuicideTime;\n\tfloat m_flTimeStepSound;\n\tfloat m_flTimeWeaponIdle;\n\tfloat m_flSwimTime;\n\tfloat m_flDuckTime;\n\tfloat m_flWallJumpTime;\n\tfloat m_flSuitUpdate;\n\tint m_rgSuitPlayList[CSUITPLAYLIST];\n\tint m_iSuitPlayNext;\n\tint m_rgiSuitNoRepeat[CSUITNOREPEAT];\n\tfloat m_rgflSuitNoRepeatTime[CSUITNOREPEAT];\n\tint m_lastDamageAmount;\n\tfloat m_tbdPrev;\n\tfloat m_flgeigerRange;\n\tfloat m_flgeigerDelay;\n\tint m_igeigerRangePrev;\n\tint m_iStepLeft;\n\tchar m_szTextureName[CBTEXTURENAMEMAX];\n\tchar m_chTextureType;\n\tint m_idrowndmg;\n\tint m_idrownrestored;\n\tint m_bitsHUDDamage;\n\tBOOL m_fInitHUD;\n\tBOOL m_fGameHUDInitialized;\n\tint m_iTrain;\n\tBOOL m_fWeapon;\n\tEHANDLE m_pTank;\n\tfloat m_fDeadTime;\n\tBOOL m_fNoPlayerSound;\n\tBOOL m_fLongJump;\n\tfloat m_tSneaking;\n\tint m_iUpdateTime;\n\tint m_iClientHealth;\n\tint m_iClientBattery;\n\tint m_iHideHUD;\n\tint m_iClientHideHUD;\n\tint m_iFOV;\n\tint m_iClientFOV;\n\tint m_iNumSpawns;\n\tCBaseEntity *m_pObserver;\n\tCBasePlayerItem *m_rgpPlayerItems[MAX_ITEM_TYPES];\n\tCBasePlayerItem *m_pActiveItem;\n\tCBasePlayerItem *m_pClientActiveItem;\n\tCBasePlayerItem *m_pLastItem;\n\tint m_rgAmmo[MAX_AMMO_SLOTS];\n\tint m_rgAmmoLast[MAX_AMMO_SLOTS];\n\tVector m_vecAutoAim;\n\tBOOL m_fOnTarget;\n\tint m_iDeaths;\n\tint m_izSBarState[SBAR_END];\n\tfloat m_flNextSBarUpdateTime;\n\tfloat m_flStatusBarDisappearDelay;\n\tchar m_SbarString0[SBAR_STRING_SIZE];\n\tint m_lastx, m_lasty;\n\tint m_nCustomSprayFrames;\n\tfloat m_flNextDecalTime;\n\tchar m_szTeamName[TEAM_NAME_LENGTH];\n\tint m_modelIndexPlayer;\n\tchar m_szAnimExtention[32];\n\tint m_iGaitsequence;\n\tfloat m_flGaitframe;\n\tfloat m_flGaityaw;\n\tvec3_t m_prevgaitorigin;\n\tfloat m_flPitch;\n\tfloat m_flYaw;\n\tfloat m_flGaitMovement;\n\tint m_iAutoWepSwitch;\n\tbool m_bVGUIMenus;\n\tbool m_bShowHints;\n\tbool m_bShieldDrawn;\n\tbool m_bOwnsShield;\n\tbool m_bWasFollowing;\n\tfloat m_flNextFollowTime;\n\tfloat m_flYawModifier;\n\tfloat m_blindUntilTime;\n\tfloat m_blindStartTime;\n\tfloat m_blindHoldTime;\n\tfloat m_blindFadeTime;\n\tfloat m_blindAlpha;\n\tfloat m_allowAutoFollowTime;\n\tchar m_autoBuyString[MAX_AUTOBUY_LENGTH];\n\tchar *m_rebuyString;\n\tRebuyStruct m_rebuyStruct;\n\tbool m_bIsInRebuy;\n\tfloat m_flLastUpdateTime;\n\tchar m_lastLocation[MAX_LACTION_LENGTH];\n\tint m_progressStart;\n\tint m_progressEnd;\n\tbool m_bObserverAutoDirector;\n\tbool m_canSwitchObserverModes;\n\tfloat m_heartBeatTime;\n\tint m_intenseTimestamp;\n\tint m_silentTimestamp;\n\tMusicState m_musicState;\n\tint m_flLastCommandTime[8];\n};\n\n#define AUTOAIM_2DEGREES 0.0348994967025\n#define AUTOAIM_5DEGREES 0.08715574274766\n#define AUTOAIM_8DEGREES 0.1391731009601\n#define AUTOAIM_10DEGREES 0.1736481776669\n\nextern int gmsgHudText;\nextern int gmsgShowMenu;\nextern int gmsgVGUIMenu;\nextern int gmsgScenarioIcon;\nextern int gmsgBombDrop;\n\nextern BOOL gInitHUD;\n\nvoid SendItemStatus(CBasePlayer *pPlayer);\n\nextern bool UseBotArgs;\nextern const char *BotArgs[4];\n\n#endif\n"
  },
  {
    "path": "dlls/saverestore.h",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\n*\tThis product contains software technology licensed from Id\n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc.\n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n#ifndef SAVERESTORE_H\n#define SAVERESTORE_H\n\nclass CBaseEntity;\n\nclass CSaveRestoreBuffer\n{\npublic:\n\tCSaveRestoreBuffer(void);\n\tCSaveRestoreBuffer(SAVERESTOREDATA *pdata);\n\tvirtual ~CSaveRestoreBuffer(void);\n\npublic:\n\tint EntityIndex(entvars_t *pevLookup);\n\tint EntityIndex(edict_t *pentLookup);\n\tint EntityIndex(EOFFSET eoLookup);\n\tint EntityIndex(CBaseEntity *pEntity);\n\tint EntityFlags(int entityIndex, int flags) { return EntityFlagsSet(entityIndex, 0); }\n\tint EntityFlagsSet(int entityIndex, int flags);\n\tedict_t *EntityFromIndex(int entityIndex);\n\tunsigned short TokenHash(const char *pszToken);\n\nprotected:\n\tSAVERESTOREDATA *m_pdata;\n\tvoid BufferRewind(int size);\n\tunsigned int HashString(const char *pszToken);\n\nprivate:\n\tvoid operator = (CSaveRestoreBuffer &);\n\tCSaveRestoreBuffer(const CSaveRestoreBuffer &);\n};\n\nclass CSave : public CSaveRestoreBuffer\n{\npublic:\n\tCSave(SAVERESTOREDATA *pdata): CSaveRestoreBuffer(pdata) {};\n\npublic:\n\tvoid WriteShort(const char *pname, const short *value, int count);\n\tvoid WriteInt(const char *pname, const int *value, int count);\n\tvoid WriteFloat(const char *pname, const float *value, int count);\n\tvoid WriteTime(const char *pname, const float *value, int count);\n\tvoid WriteData(const char *pname, int size, const char *pdata);\n\tvoid WriteString(const char *pname, const char *pstring);\n\tvoid WriteString(const char *pname, const int *stringId, int count);\n\tvoid WriteVector(const char *pname, const Vector &value);\n\tvoid WriteVector(const char *pname, const float *value, int count);\n\tvoid WritePositionVector(const char *pname, const Vector &value);\n\tvoid WritePositionVector(const char *pname, const float *value, int count);\n\tvoid WriteFunction(const char *pname, const int *value, int count);\n\tint WriteEntVars(const char *pname, entvars_t *pev);\n\tint WriteFields(const char *pname, void *pBaseData, TYPEDESCRIPTION *pFields, int fieldCount);\n\nprivate:\n\tint DataEmpty(const char *pdata, int size);\n\tvoid BufferField(const char *pname, int size, const char *pdata);\n\tvoid BufferString(char *pdata, int len);\n\tvoid BufferData(const char *pdata, int size);\n\tvoid BufferHeader(const char *pname, int size);\n};\n\ntypedef struct\n{\n\tunsigned short size;\n\tunsigned short token;\n\tchar *pData;\n}\nHEADER;\n\nclass CRestore : public CSaveRestoreBuffer\n{\npublic:\n\tCRestore(SAVERESTOREDATA *pdata): CSaveRestoreBuffer(pdata), m_global(0), m_precache(TRUE) {}\n\npublic:\n\tint ReadEntVars(const char *pname, entvars_t *pev);\n\tint ReadFields(const char *pname, void *pBaseData, TYPEDESCRIPTION *pFields, int fieldCount);\n\tint ReadField(void *pBaseData, TYPEDESCRIPTION *pFields, int fieldCount, int startField, int size, char *pName, void *pData);\n\tint ReadInt(void);\n\tshort ReadShort(void);\n\tint ReadNamedInt(const char *pName);\n\tchar *ReadNamedString(const char *pName);\n\tint Empty(void) { return (!m_pdata) || ((m_pdata->pCurrentData - m_pdata->pBaseData) >= m_pdata->bufferSize); }\n\tinline void SetGlobalMode(int global) { m_global = global; }\n\tvoid PrecacheMode(BOOL mode){ m_precache = mode; }\n\nprivate:\n\tchar *BufferPointer(void);\n\tvoid BufferReadBytes(char *pOutput, int size);\n\tvoid BufferSkipBytes(int bytes);\n\tint BufferSkipZString(void);\n\tint BufferCheckZString(const char *string);\n\tvoid BufferReadHeader(HEADER *pheader);\n\nprivate:\n\tint m_global;\n\tBOOL m_precache;\n};\n\n#define MAX_ENTITYARRAY 64\n\n#define IMPLEMENT_SAVERESTORE(derivedClass,baseClass) \\\n\tint derivedClass::Save(CSave &save)\\\n{\\\n\tif (!baseClass::Save(save))\\\n\treturn 0;\\\n\treturn save.WriteFields(#derivedClass, this, m_SaveData, ARRAYSIZE(m_SaveData));\\\n}\\\n\tint derivedClass::Restore(CRestore &restore)\\\n{\\\n\tif (!baseClass::Restore(restore))\\\n\treturn 0;\\\n\treturn restore.ReadFields(#derivedClass, this, m_SaveData, ARRAYSIZE(m_SaveData));\\\n}\n\ntypedef enum { GLOBAL_OFF = 0, GLOBAL_ON = 1, GLOBAL_DEAD = 2 } GLOBALESTATE;\ntypedef struct globalentity_s globalentity_t;\n\nstruct globalentity_s\n{\n\tchar name[64];\n\tchar levelName[32];\n\tGLOBALESTATE state;\n\tglobalentity_t *pNext;\n};\n\nclass CGlobalState\n{\npublic:\n\tCGlobalState(void);\n\npublic:\n\tvoid Reset(void);\n\tvoid ClearStates(void);\n\tvoid EntityAdd(string_t globalname, string_t mapName, GLOBALESTATE state);\n\tvoid EntitySetState(string_t globalname, GLOBALESTATE state);\n\tvoid EntityUpdate(string_t globalname, string_t mapname);\n\tconst globalentity_t *EntityFromTable(string_t globalname);\n\tGLOBALESTATE EntityGetState(string_t globalname);\n\tint EntityInTable(string_t globalname) { return (Find(globalname) != NULL) ? 1 : 0; }\n\tint Save(CSave &save);\n\tint Restore(CRestore &restore);\n\tvoid DumpGlobals(void);\n\npublic:\n\tstatic TYPEDESCRIPTION m_SaveData[];\n\nprivate:\n\tglobalentity_t *Find(string_t globalname);\n\tglobalentity_t *m_pList;\n\tint m_listCount;\n\nprivate:\n\tvoid operator = (CGlobalState &);\n\tCGlobalState(const CGlobalState &);\n};\n\nextern CGlobalState gGlobalState;\n#endif"
  },
  {
    "path": "dlls/schedule.h",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\n*\tThis product contains software technology licensed from Id\n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc.\n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n#ifndef SCHEDULE_H\n#define SCHEDULE_H\n\n#define bits_COND_SEE_HATE (1<<1)\n#define bits_COND_SEE_FEAR (1<<2)\n#define bits_COND_SEE_DISLIKE (1<<3)\n#define bits_COND_SEE_ENEMY (1<<4)\n#define bits_COND_LIGHT_DAMAGE (1<<8)\n#define bits_COND_HEAVY_DAMAGE (1<<9)\n#define bits_COND_SEE_CLIENT (1<<21)\n#define bits_COND_SEE_NEMESIS (1<<22)\n\n#endif"
  },
  {
    "path": "dlls/skill.h",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\n*\tThis product contains software technology licensed from Id\n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc.\n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n\nstruct skilldata_t\n{\n\tint iSkillLevel;\n\tfloat agruntHealth;\n\tfloat agruntDmgPunch;\n\tfloat apacheHealth;\n\tfloat barneyHealth;\n\tfloat bigmommaHealthFactor;\n\tfloat bigmommaDmgSlash;\n\tfloat bigmommaDmgBlast;\n\tfloat bigmommaRadiusBlast;\n\tfloat bullsquidHealth;\n\tfloat bullsquidDmgBite;\n\tfloat bullsquidDmgWhip;\n\tfloat bullsquidDmgSpit;\n\tfloat gargantuaHealth;\n\tfloat gargantuaDmgSlash;\n\tfloat gargantuaDmgFire;\n\tfloat gargantuaDmgStomp;\n\tfloat hassassinHealth;\n\tfloat headcrabHealth;\n\tfloat headcrabDmgBite;\n\tfloat hgruntHealth;\n\tfloat hgruntDmgKick;\n\tfloat hgruntShotgunPellets;\n\tfloat hgruntGrenadeSpeed;\n\tfloat houndeyeHealth;\n\tfloat houndeyeDmgBlast;\n\tfloat slaveHealth;\n\tfloat slaveDmgClaw;\n\tfloat slaveDmgClawrake;\n\tfloat slaveDmgZap;\n\tfloat ichthyosaurHealth;\n\tfloat ichthyosaurDmgShake;\n\tfloat leechHealth;\n\tfloat leechDmgBite;\n\tfloat controllerHealth;\n\tfloat controllerDmgZap;\n\tfloat controllerSpeedBall;\n\tfloat controllerDmgBall;\n\tfloat nihilanthHealth;\n\tfloat nihilanthZap;\n\tfloat scientistHealth;\n\tfloat snarkHealth;\n\tfloat snarkDmgBite;\n\tfloat snarkDmgPop;\n\tfloat zombieHealth;\n\tfloat zombieDmgOneSlash;\n\tfloat zombieDmgBothSlash;\n\tfloat turretHealth;\n\tfloat miniturretHealth;\n\tfloat sentryHealth;\n\tfloat plrDmgCrowbar;\n\tfloat plrDmg9MM;\n\tfloat plrDmg357;\n\tfloat plrDmgMP5;\n\tfloat plrDmgM203Grenade;\n\tfloat plrDmgBuckshot;\n\tfloat plrDmgCrossbowClient;\n\tfloat plrDmgCrossbowMonster;\n\tfloat plrDmgRPG;\n\tfloat plrDmgGauss;\n\tfloat plrDmgEgonNarrow;\n\tfloat plrDmgEgonWide;\n\tfloat plrDmgHornet;\n\tfloat plrDmgHandGrenade;\n\tfloat plrDmgSatchel;\n\tfloat plrDmgTripmine;\n\tfloat monDmg9MM;\n\tfloat monDmgMP5;\n\tfloat monDmg12MM;\n\tfloat monDmgHornet;\n\tfloat suitchargerCapacity;\n\tfloat batteryCapacity;\n\tfloat healthchargerCapacity;\n\tfloat healthkitCapacity;\n\tfloat scientistHeal;\n\tfloat monHead;\n\tfloat monChest;\n\tfloat monStomach;\n\tfloat monLeg;\n\tfloat monArm;\n\tfloat plrHead;\n\tfloat plrChest;\n\tfloat plrStomach;\n\tfloat plrLeg;\n\tfloat plrArm;\n};\n\nextern DLL_GLOBAL skilldata_t gSkillData;\nfloat GetSkillCvar(char *pName);\nextern DLL_GLOBAL int g_iSkillLevel;\n\n#define SKILL_EASY 1\n#define SKILL_MEDIUM 2\n#define SKILL_HARD 3"
  },
  {
    "path": "dlls/soundent.h",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\n*\tThis product contains software technology licensed from Id\n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc.\n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n\n#define MAX_WORLD_SOUNDS 64\n\n#define bits_SOUND_NONE 0\n#define bits_SOUND_COMBAT (1<<0)\n#define bits_SOUND_WORLD (1<<1)\n#define bits_SOUND_PLAYER (1<< 2)\n#define bits_SOUND_CARCASS (1<< 3)\n#define bits_SOUND_MEAT (1<< 4)\n#define bits_SOUND_DANGER (1<< 5)\n#define bits_SOUND_GARBAGE (1<< 6)\n\n#define bits_ALL_SOUNDS 0xFFFFFFFF\n\n#define SOUNDLIST_EMPTY\t-1\n\n#define SOUNDLISTTYPE_FREE 1\n#define SOUNDLISTTYPE_ACTIVE 2\n\n#define SOUND_NEVER_EXPIRE -1\n\nclass CSound\n{\npublic:\n\tvoid Clear(void);\n\tvoid Reset(void);\n\npublic:\n\tVector m_vecOrigin;\n\tint m_iType;\n\tint m_iVolume;\n\tfloat m_flExpireTime;\n\tint m_iNext;\n\tint m_iNextAudible;\n\npublic:\n\tBOOL FIsSound(void);\n\tBOOL FIsScent(void);\n};\n\nclass CSoundEnt : public CBaseEntity \n{\npublic:\n\tvoid Precache(void);\n\tvoid Spawn(void);\n\tvoid Think(void);\n\tvoid Initialize(void);\n\tint ObjectCaps(void) { return FCAP_DONT_SAVE; }\n\npublic:\n\tstatic void InsertSound(int iType, const Vector &vecOrigin, int iVolume, float flDuration);\n\tstatic void FreeSound(int iSound, int iPrevious);\n\tstatic int ActiveList(void);\n\tstatic int FreeList(void);\n\tstatic CSound *SoundPointerForIndex(int iIndex);\n\tstatic int ClientSoundIndex(edict_t *pClient);\n\npublic:\n\tBOOL IsEmpty(void) { return m_iActiveSound == SOUNDLIST_EMPTY; }\n\tint ISoundsInList(int iListType);\n\tint IAllocSound(void);\n\npublic:\n\tint m_iFreeSound;\n\tint m_iActiveSound;\n\tint m_cLastActiveSounds;\n\tBOOL m_fShowReport;\n\nprivate:\n\tCSound m_SoundPool[MAX_WORLD_SOUNDS];\n};"
  },
  {
    "path": "dlls/stdafx.h",
    "content": "#ifndef stdafx_h__\n#define stdafx_h__\n\n#include \"port.h\"\n#include \"extdll.h\"\n#include \"util.h\"\n\n#endif // stdafx_h__\n"
  },
  {
    "path": "dlls/util.h",
    "content": "#ifndef util_h__\n#define util_h__\n\n/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\n*\tThis product contains software technology licensed from Id\n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc.\n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n\n#include \"port.h\"\n#include <string.h>\n#ifndef ACTIVITY_H\n#include \"activity.h\"\n#endif\n\n#ifndef ENGINECALLBACK_H\n#include \"enginecallback.h\"\n#endif\n\ninline void MESSAGE_BEGIN(int msg_dest, int msg_type, const float *pOrigin, entvars_t *ent);\nextern globalvars_t *gpGlobals;\n\n#define STRING(offset) reinterpret_cast<const char *>(gpGlobals->pStringBase + (uintp)offset)\n#define MAKE_STRING(str) (reinterpret_cast<uintp>(str) - reinterpret_cast<uintp>(STRING(0)))\n\ninline edict_t *FIND_ENTITY_BY_CLASSNAME(edict_t *entStart, const char *pszName)\n{\n\treturn FIND_ENTITY_BY_STRING(entStart, \"classname\", pszName);\n}\n\ninline edict_t *FIND_ENTITY_BY_TARGETNAME(edict_t *entStart, const char *pszName)\n{\n\treturn FIND_ENTITY_BY_STRING(entStart, \"targetname\", pszName);\n}\n\ninline edict_t *FIND_ENTITY_BY_TARGET(edict_t *entStart, const char *pszName)\n{\n\treturn FIND_ENTITY_BY_STRING(entStart, \"target\", pszName);\n}\n\n#define WRITEKEY_INT(pf, szKeyName, iKeyValue) ENGINE_FPRINTF(pf, \"\\\"%s\\\" \\\"%d\\\"\\n\", szKeyName, iKeyValue)\n#define WRITEKEY_FLOAT(pf, szKeyName, flKeyValue) ENGINE_FPRINTF(pf, \"\\\"%s\\\" \\\"%f\\\"\\n\", szKeyName, flKeyValue)\n#define WRITEKEY_STRING(pf, szKeyName, szKeyValue) ENGINE_FPRINTF(pf, \"\\\"%s\\\" \\\"%s\\\"\\n\", szKeyName, szKeyValue)\n#define WRITEKEY_VECTOR(pf, szKeyName, flX, flY, flZ) ENGINE_FPRINTF(pf, \"\\\"%s\\\" \\\"%f %f %f\\\"\\n\", szKeyName, flX, flY, flZ)\n\n#define SetBits(flBitVector, bits) ((flBitVector) = (int)(flBitVector) | (bits))\n#define ClearBits(flBitVector, bits) ((flBitVector) = (int)(flBitVector) & ~(bits))\n#define FBitSet(flBitVector, bit) ((int)(flBitVector) & (bit))\n\n#define FILE_GLOBAL static\n#define DLL_GLOBAL\n#define CONSTANT\n\ntypedef int EOFFSET;\ntypedef int BOOL;\n\n#define M_PI 3.14159265358979323846\n\n#define DECLARE_GLOBAL_METHOD(MethodName) extern void DLLEXPORT MethodName(void)\n#define GLOBAL_METHOD(funcname) void DLLEXPORT funcname(void)\n\n#ifdef CLIENT_DLL\n#define LINK_ENTITY_TO_CLASS( x, y )\n#elif defined(_WIN32)\n#define LINK_ENTITY_TO_CLASS(mapClassName, DLLClassName) \\\n\textern \"C\" EXPORT void mapClassName(entvars_t *pev); \\\n\tvoid mapClassName(entvars_t *pev) { GetClassPtr((DLLClassName *)pev); }\n#else\n#define LINK_ENTITY_TO_CLASS(mapClassName,DLLClassName) extern \"C\" void mapClassName(entvars_t *pev); void mapClassName(entvars_t *pev) { GetClassPtr((DLLClassName *)pev); }\n#endif\n\n#if defined(DEBUG) && !defined(CLIENT_DLL)\n\textern edict_t *DBG_EntOfVars(const entvars_t *pev);\n\tinline edict_t *ENT(const entvars_t *pev) { return DBG_EntOfVars(pev); }\n#else\n\tinline edict_t *ENT(const entvars_t *pev) { return pev->pContainingEntity; }\n#endif\ninline edict_t *ENT(edict_t *pent) { return pent; }\ninline edict_t *ENT(EOFFSET eoffset) { return (*g_engfuncs.pfnPEntityOfEntOffset)(eoffset); }\ninline EOFFSET OFFSET(EOFFSET eoffset) { return eoffset; }\ninline EOFFSET OFFSET(const edict_t *pent)\n{\n#if _DEBUG\n\tif (!pent)\n\t\tALERT(at_error, \"Bad ent in OFFSET()\\n\");\n#endif\n\treturn (*g_engfuncs.pfnEntOffsetOfPEntity)(pent);\n}\n\ninline EOFFSET OFFSET(entvars_t *pev)\n{\n#if _DEBUG\n\tif (!pev)\n\t\tALERT(at_error, \"Bad pev in OFFSET()\\n\");\n#endif\n\treturn OFFSET(ENT(pev));\n}\ninline entvars_t *VARS(entvars_t *pev) { return pev; }\n\ninline entvars_t *VARS(edict_t *pent)\n{\n\tif (!pent)\n\t\treturn NULL;\n\n\treturn &pent->v;\n}\n\ninline entvars_t *VARS(EOFFSET eoffset) { return VARS(ENT(eoffset)); }\ninline int ENTINDEX(edict_t *pEdict) { return (*g_engfuncs.pfnIndexOfEdict)(pEdict); }\ninline edict_t *INDEXENT(int iEdictNum) { return (*g_engfuncs.pfnPEntityOfEntIndex)(iEdictNum); }\n\ninline void MESSAGE_BEGIN(int msg_dest, int msg_type, const float *pOrigin, entvars_t *ent) { (*g_engfuncs.pfnMessageBegin)(msg_dest, msg_type, pOrigin, ENT(ent)); }\n\n#define eoNullEntity 0\ninline BOOL FNullEnt(EOFFSET eoffset) { return eoffset == 0; }\ninline BOOL FNullEnt(const edict_t *pent) { return pent == NULL || FNullEnt(OFFSET(pent)); }\ninline BOOL FNullEnt(entvars_t *pev) { return pev == NULL || FNullEnt(OFFSET(pev)); }\n\n#define iStringNull 0\ninline BOOL FStringNull(int iString) { return iString == iStringNull; }\n\n#define cchMapNameMost 32\n\n#define VIEW_FIELD_FULL (float)-1\n#define VIEW_FIELD_WIDE (float)-0.7\n#define VIEW_FIELD_NARROW (float)0.7\n#define VIEW_FIELD_ULTRA_NARROW (float)0.9\n\n#define DONT_BLEED -1\n#define BLOOD_COLOR_RED (BYTE)247\n#define BLOOD_COLOR_YELLOW (BYTE)195\n#define BLOOD_COLOR_GREEN BLOOD_COLOR_YELLOW\n\ntypedef enum\n{\n\tMONSTERSTATE_NONE = 0,\n\tMONSTERSTATE_IDLE,\n\tMONSTERSTATE_COMBAT,\n\tMONSTERSTATE_ALERT,\n\tMONSTERSTATE_HUNT,\n\tMONSTERSTATE_PRONE,\n\tMONSTERSTATE_SCRIPT,\n\tMONSTERSTATE_PLAYDEAD,\n\tMONSTERSTATE_DEAD\n}\nMONSTERSTATE;\n\ntypedef enum\n{\n\tTS_AT_TOP,\n\tTS_AT_BOTTOM,\n\tTS_GOING_UP,\n\tTS_GOING_DOWN\n}\nTOGGLE_STATE;\n\ninline BOOL FStrEq(const char *sz1, const char *sz2) { return (!strcmp(sz1, sz2)); }\ninline BOOL FClassnameIs(edict_t *pent, const char *szClassname) { return FStrEq(STRING(VARS(pent)->classname), szClassname); }\ninline BOOL FClassnameIs(entvars_t *pev, const char *szClassname) { return FStrEq(STRING(pev->classname), szClassname); }\n\nclass CBaseEntity;\nclass CBasePlayer;\n\nextern void UTIL_SetSize(entvars_t *pev, const Vector &vecMin, const Vector &vecMax);\nextern float UTIL_VecToYaw(const Vector &vec);\nextern Vector UTIL_VecToAngles(const Vector &vec);\nextern float UTIL_AngleMod(float a);\nextern float UTIL_AngleDiff(float destAngle, float srcAngle);\n\nextern CBaseEntity *UTIL_FindEntityInSphere(CBaseEntity *pStartEntity, const Vector &vecCenter, float flRadius);\nextern CBaseEntity *UTIL_FindEntityByString_Old(CBaseEntity *pStartEntity, const char *szKeyword, const char *szValue);\nextern CBaseEntity *UTIL_FindEntityByString(CBaseEntity *pStartEntity, const char *szKeyword, const char *szValue);\n#ifndef CLIENT_DLL\nextern CBaseEntity *UTIL_FindEntityByClassname(CBaseEntity *pStartEntity, const char *szName);\n#else\ninline CBaseEntity *UTIL_FindEntityByClassname(CBaseEntity *, const char* ) { return NULL; }\n#endif\nextern CBaseEntity *UTIL_FindEntityByTargetname(CBaseEntity *pStartEntity, const char *szName);\nextern CBaseEntity *UTIL_FindEntityGeneric(const char *szName, Vector &vecSrc, float flRadius);\nextern CBasePlayer *UTIL_PlayerByIndex(int playerIndex);\n\n#define UTIL_EntitiesInPVS(pent) (*g_engfuncs.pfnEntitiesInPVS)(pent)\n\nextern void UTIL_MakeVectors(const Vector &vecAngles);\nextern int UTIL_MonstersInSphere(CBaseEntity **pList, int listMax, const Vector &center, float radius);\nextern int UTIL_EntitiesInBox(CBaseEntity **pList, int listMax, const Vector &mins, const Vector &maxs, int flagMask);\ninline void UTIL_MakeVectorsPrivate(const Vector &vecAngles, float *p_vForward, float *p_vRight, float *p_vUp) { g_engfuncs.pfnAngleVectors(vecAngles, p_vForward, p_vRight, p_vUp); }\nextern void UTIL_MakeAimVectors(const Vector &vecAngles);\nextern void UTIL_MakeInvVectors(const Vector &vec, globalvars_t *pgv);\n\nextern void UTIL_SetOrigin(entvars_t *pev, const Vector &vecOrigin);\nextern void UTIL_EmitAmbientSound(edict_t *entity, const Vector &vecOrigin, const char *samp, float vol, float attenuation, int fFlags, int pitch);\nextern void UTIL_ParticleEffect(const Vector &vecOrigin, const Vector &vecDirection, ULONG ulColor, ULONG ulCount);\nextern void UTIL_ScreenShake(const Vector &center, float amplitude, float frequency, float duration, float radius);\nextern void UTIL_ScreenShakeAll(const Vector &center, float amplitude, float frequency, float duration);\nextern void UTIL_ShowMessage(const char *pString, CBaseEntity *pPlayer);\nextern void UTIL_ShowMessageAll(const char *pString);\nextern void UTIL_ScreenFadeAll(const Vector &color, float fadeTime, float holdTime, int alpha, int flags);\nextern void UTIL_ScreenFade(CBaseEntity *pEntity, const Vector &color, float fadeTime, float fadeHold, int alpha, int flags);\n\ntypedef enum { ignore_monsters = 1, dont_ignore_monsters = 0, missile = 2 } IGNORE_MONSTERS;\ntypedef enum { ignore_glass = 1, dont_ignore_glass = 0 } IGNORE_GLASS;\nextern void UTIL_TraceLine(const Vector &vecStart, const Vector &vecEnd, IGNORE_MONSTERS igmon, edict_t *pentIgnore, TraceResult *ptr);\nextern void UTIL_TraceLine(const Vector &vecStart, const Vector &vecEnd, IGNORE_MONSTERS igmon, IGNORE_GLASS ignoreGlass, edict_t *pentIgnore, TraceResult *ptr);\ntypedef enum { point_hull = 0, human_hull = 1, large_hull = 2, head_hull = 3 } HULL_TYPE;\n#ifndef CLIENT_DLL\nextern void UTIL_TraceHull(const Vector &vecStart, const Vector &vecEnd, IGNORE_MONSTERS igmon, int hullNumber, edict_t *pentIgnore, TraceResult *ptr);\n#else\ninline void UTIL_TraceHull(const Vector &vecStart, const Vector &vecEnd, IGNORE_MONSTERS igmon, int hullNumber, edict_t *pentIgnore, TraceResult *ptr) {}\n#endif\nextern TraceResult UTIL_GetGlobalTrace(void);\nextern void UTIL_TraceModel(const Vector &vecStart, const Vector &vecEnd, int hullNumber, edict_t *pentModel, TraceResult *ptr);\nextern Vector UTIL_GetAimVector(edict_t *pent, float flSpeed);\nextern int UTIL_PointContents(const Vector &vec);\n\nextern int UTIL_IsMasterTriggered(string_t sMaster, CBaseEntity *pActivator);\nextern void UTIL_BloodStream(const Vector &origin, const Vector &direction, int color, int amount);\nextern void UTIL_BloodDrips(const Vector &origin, const Vector &direction, int color, int amount);\nextern Vector UTIL_RandomBloodVector(void);\nextern BOOL UTIL_ShouldShowBlood(int bloodColor);\nextern void UTIL_BloodDecalTrace(TraceResult *pTrace, int bloodColor);\nextern void UTIL_DecalTrace(TraceResult *pTrace, int decalNumber);\nextern void UTIL_PlayerDecalTrace(TraceResult *pTrace, int playernum, int decalNumber, BOOL bIsCustom);\nextern void UTIL_GunshotDecalTrace(TraceResult *pTrace, int decalNumber);\nextern void UTIL_Sparks(const Vector &position);\nextern void UTIL_Ricochet(const Vector &position, float scale);\nextern void UTIL_StringToVector(float *pVector, const char *pString);\nextern void UTIL_StringToIntArray(int *pVector, int count, const char *pString);\nextern Vector UTIL_ClampVectorToBox(const Vector &input, const Vector &clampSize);\nextern float UTIL_Approach(float target, float value, float speed);\nextern float UTIL_ApproachAngle(float target, float value, float speed);\nextern float UTIL_AngleDistance(float next, float cur);\nextern char *UTIL_VarArgs(char *format, ...);\nextern void UTIL_Remove(CBaseEntity *pEntity);\nextern BOOL UTIL_IsValidEntity(edict_t *pent);\nextern BOOL UTIL_TeamsMatch(const char *pTeamName1, const char *pTeamName2);\nextern float UTIL_SplineFraction(float value, float scale);\nextern float UTIL_WaterLevel(const Vector &position, float minz, float maxz);\nextern void UTIL_Bubbles(Vector mins, Vector maxs, int count);\nextern void UTIL_BubbleTrail(Vector from, Vector to, int count);\nextern void UTIL_PrecacheOther(const char *szClassname);\nextern void UTIL_ClientPrintAll(int msg_dest, const char *msg_name, const char *param1 = NULL, const char *param2 = NULL, const char *param3 = NULL, const char *param4 = NULL);\n\ninline void UTIL_CenterPrintAll(const char *msg_name, const char *param1 = NULL, const char *param2 = NULL, const char *param3 = NULL, const char *param4 = NULL)\n{\n\tUTIL_ClientPrintAll(HUD_PRINTCENTER, msg_name, param1, param2, param3, param4);\n}\n\nclass CBasePlayerItem;\nclass CBasePlayer;\n\nextern BOOL UTIL_GetNextBestWeapon(CBasePlayer *pPlayer, CBasePlayerItem *pCurrentWeapon);\n#ifndef CLIENT_DLL\nextern void ClientPrint(entvars_t *client, int msg_dest, const char *msg_name, const char *param1 = NULL, const char *param2 = NULL, const char *param3 = NULL, const char *param4 = NULL);\n#else\ninline void ClientPrint(entvars_t *client, int msg_dest, const char *msg_name, const char *param1 = NULL, const char *param2 = NULL, const char *param3 = NULL, const char *param4 = NULL) { }\n#endif\nextern void UTIL_SayText(const char *pText, CBaseEntity *pEntity);\nextern void UTIL_SayTextAll(const char *pText, CBaseEntity *pEntity);\n\ntypedef struct hudtextparms_s\n{\n\tfloat x;\n\tfloat y;\n\tint effect;\n\tbyte r1, g1, b1, a1;\n\tbyte r2, g2, b2, a2;\n\tfloat fadeinTime;\n\tfloat fadeoutTime;\n\tfloat holdTime;\n\tfloat fxTime;\n\tint channel;\n}\nhudtextparms_t;\n\nextern void UTIL_HudMessageAll(const hudtextparms_t &textparms, const char *pMessage);\nextern void UTIL_HudMessage(CBaseEntity *pEntity, const hudtextparms_t &textparms, const char *pMessage);\n\nextern char *UTIL_dtos1(int d);\nextern char *UTIL_dtos2(int d);\nextern char *UTIL_dtos3(int d);\nextern char *UTIL_dtos4(int d);\nextern void UTIL_LogPrintf(const char *fmt, ...);\nextern float UTIL_DotPoints(const Vector &vecSrc, const Vector &vecCheck, const Vector &vecDir);\nextern void UTIL_StripToken(const char *pKey, char *pDest);\nextern char UTIL_TextureHit(TraceResult *ptrHit, Vector vecSrc, Vector vecEnd);\nextern bool UTIL_IsGame(const char *gameName);\nextern float UTIL_GetPlayerGaitYaw(int playerIndex);\nextern int UTIL_HumansInGame(bool ignoreSpectators);\n\nextern void SetMovedir(entvars_t *pev);\nextern Vector VecBModelOrigin(entvars_t *pevBModel);\nextern int BuildChangeList(LEVELLIST *pLevelList, int maxList);\n\n#ifdef DEBUG\nvoid DBG_AssertFunction(BOOL fExpr, const char *szExpr, const char *szFile, int szLine, const char *szMessage);\n#define ASSERT(f) DBG_AssertFunction(f, #f, __FILE__, __LINE__, NULL)\n#define ASSERTSZ(f, sz)\tDBG_AssertFunction(f, #f, __FILE__, __LINE__, sz)\n#else\n#define ASSERT(f)\n#define ASSERTSZ(f, sz)\n#endif\n\nextern DLL_GLOBAL const Vector g_vecZero;\n\n#define LANGUAGE_ENGLISH 0\n#define LANGUAGE_GERMAN 1\n#define LANGUAGE_FRENCH 2\n#define LANGUAGE_BRITISH 3\n\nextern DLL_GLOBAL int g_Language;\n\n#define AMBIENT_SOUND_STATIC 0\n#define AMBIENT_SOUND_EVERYWHERE 1\n#define AMBIENT_SOUND_SMALLRADIUS 2\n#define AMBIENT_SOUND_MEDIUMRADIUS 4\n#define AMBIENT_SOUND_LARGERADIUS 8\n#define AMBIENT_SOUND_START_SILENT 16\n#define AMBIENT_SOUND_NOT_LOOPING 32\n\n#define SPEAKER_START_SILENT 1\n\n#define SND_SPAWNING (1<<8)\n#define SND_STOP (1<<5)\n#define SND_CHANGE_VOL (1<<6)\n#define SND_CHANGE_PITCH (1<<7)\n\n#define LFO_SQUARE 1\n#define LFO_TRIANGLE 2\n#define LFO_RANDOM 3\n\n#define SF_BRUSH_ROTATE_Y_AXIS 0\n#define SF_BRUSH_ROTATE_INSTANT 1\n#define SF_BRUSH_ROTATE_BACKWARDS 2\n#define SF_BRUSH_ROTATE_Z_AXIS 4\n#define SF_BRUSH_ROTATE_X_AXIS 8\n#define SF_PENDULUM_AUTO_RETURN 16\n#define SF_PENDULUM_PASSABLE 32\n\n#define SF_BRUSH_ROTATE_SMALLRADIUS 128\n#define SF_BRUSH_ROTATE_MEDIUMRADIUS 256\n#define SF_BRUSH_ROTATE_LARGERADIUS 512\n\n#define PUSH_BLOCK_ONLY_X 1\n#define PUSH_BLOCK_ONLY_Y 2\n\n#define VEC_HULL_MIN Vector(-16, -16, -36)\n#define VEC_HULL_MAX Vector(16, 16, 36)\n#define VEC_HUMAN_HULL_MIN Vector(-16, -16, 0)\n#define VEC_HUMAN_HULL_MAX Vector(16, 16, 72)\n#define VEC_HUMAN_HULL_DUCK Vector(16, 16, 36)\n\n#define VEC_VIEW Vector(0, 0, 17)\n\n#define VEC_DUCK_HULL_MIN Vector(-16, -16, -18)\n#define VEC_DUCK_HULL_MAX Vector(16, 16, 32)\n#define VEC_DUCK_VIEW Vector(0, 0, 12)\n\n#define SVC_TEMPENTITY 23\n#define SVC_INTERMISSION 30\n#define SVC_CDTRACK 32\n#define SVC_WEAPONANIM 35\n#define SVC_ROOMTYPE 37\n#define SVC_DIRECTOR 51\n\n#define SF_TRIGGER_ALLOWMONSTERS 1\n#define SF_TRIGGER_NOCLIENTS 2\n#define SF_TRIGGER_PUSHABLES 4\n\n#define SF_BREAK_TRIGGER_ONLY 1\n#define SF_BREAK_TOUCH 2\n#define SF_BREAK_PRESSURE 4\n#define SF_BREAK_CROWBAR 256\n\n#define SF_PUSH_BREAKABLE 128\n\n#define SF_LIGHT_START_OFF 1\n\n#define SPAWNFLAG_NOMESSAGE 1\n#define SPAWNFLAG_NOTOUCH 1\n#define SPAWNFLAG_DROIDONLY 4\n\n#define SPAWNFLAG_USEONLY 1\n\n#define TELE_PLAYER_ONLY 1\n#define TELE_SILENT 2\n\n#define SF_TRIG_PUSH_ONCE 1\n\n#define CBSENTENCENAME_MAX 16\n#define CVOXFILESENTENCEMAX 1536\n\nextern char gszallsentencenames[CVOXFILESENTENCEMAX][CBSENTENCENAME_MAX];\nextern int gcallsentences;\n\nint USENTENCEG_Pick(int isentenceg, char *szfound);\nint USENTENCEG_PickSequential(int isentenceg, char *szfound, int ipick, int freset);\nvoid USENTENCEG_InitLRU(unsigned char *plru, int count);\n\nvoid SENTENCEG_Init(void);\nvoid SENTENCEG_Stop(edict_t *entity, int isentenceg, int ipick);\nint SENTENCEG_PlayRndI(edict_t *entity, int isentenceg, float volume, float attenuation, int flags, int pitch);\nint SENTENCEG_PlayRndSz(edict_t *entity, const char *szrootname, float volume, float attenuation, int flags, int pitch);\nint SENTENCEG_PlaySequentialSz(edict_t *entity, const char *szrootname, float volume, float attenuation, int flags, int pitch, int ipick, int freset);\nint SENTENCEG_GetIndex(const char *szrootname);\nint SENTENCEG_Lookup(const char *sample, char *sentencenum);\n\nvoid TEXTURETYPE_Init(void);\nchar TEXTURETYPE_Find(char *name);\nfloat TEXTURETYPE_PlaySound(TraceResult *ptr, Vector vecSrc, Vector vecEnd, int iBulletType);\n\n#ifndef CLIENT_WEAPONS\nvoid EMIT_SOUND_DYN(edict_t *entity, int channel, const char *sample, float volume, float attenuation, int flags, int pitch);\n#else\ninline void EMIT_SOUND_DYN(edict_t *entity, int channel, const char *sample, float volume, float attenuation, int flags, int pitch) { }\n#endif\n\ninline void EMIT_SOUND(edict_t *entity, int channel, const char *sample, float volume, float attenuation)\n{\n\tEMIT_SOUND_DYN(entity, channel, sample, volume, attenuation, 0, PITCH_NORM);\n}\n\ninline void STOP_SOUND(edict_t *entity, int channel, const char *sample)\n{\n\tEMIT_SOUND_DYN(entity, channel, sample, 0, 0, SND_STOP, PITCH_NORM);\n}\n\nvoid EMIT_SOUND_SUIT(edict_t *entity, const char *sample);\nvoid EMIT_GROUPID_SUIT(edict_t *entity, int isentenceg);\nvoid EMIT_GROUPNAME_SUIT(edict_t *entity, const char *groupname);\n\n#define PRECACHE_SOUND_ARRAY(a) \\\n{ for (int i = 0; i < (int)(ARRAYSIZE(a)); i++) PRECACHE_SOUND((char *) a [i]); }\n\n#define EMIT_SOUND_ARRAY_DYN(chan, array) \\\n\tEMIT_SOUND_DYN(ENT(pev), chan, array[RANDOM_LONG(0,A RRAYSIZE(array) - 1)], 1, ATTN_NORM, 0, RANDOM_LONG(95, 105));\n\n#define RANDOM_SOUND_ARRAY(array) (array)[RANDOM_LONG(0, ARRAYSIZE((array)) - 1)]\n\n#define PLAYBACK_EVENT(flags, who, index) PLAYBACK_EVENT_FULL(flags, who, index, 0, (float *)&g_vecZero, (float *)&g_vecZero, 0.0, 0.0, 0, 0, 0, 0);\n#define PLAYBACK_EVENT_DELAY(flags, who, index, delay) PLAYBACK_EVENT_FULL(flags, who, index, delay, (float *)&g_vecZero, (float *)&g_vecZero, 0.0, 0.0, 0, 0, 0, 0);\n\n#define GROUP_OP_AND 0\n#define GROUP_OP_NAND 1\n\nextern int g_groupmask;\nextern int g_groupop;\n\nclass UTIL_GroupTrace\n{\npublic:\n\tUTIL_GroupTrace(int groupmask, int op);\n\t~UTIL_GroupTrace(void);\n\nprivate:\n\tint m_oldgroupmask, m_oldgroupop;\n};\n\nvoid UTIL_SetGroupTrace(int groupmask, int op);\nvoid UTIL_UnsetGroupTrace(void);\n\nint UTIL_SharedRandomLong(unsigned int seed, int low, int high);\nfloat UTIL_SharedRandomFloat(unsigned int seed, float low, float high);\n\n#ifndef CLIENT_WEAPONS\nfloat UTIL_WeaponTimeBase(void);\n#else\ninline float UTIL_WeaponTimeBase( void ) { return 0; }\n#endif\n#endif // util_h__\n"
  },
  {
    "path": "dlls/vector.h",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\t\n*\tThis product contains software technology licensed from Id \n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc. \n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification ofthissource code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n#ifndef VECTOR_H\n#define VECTOR_H\n\n//=========================================================\n// 2DVector - used for many pathfinding and many other \n// operations that are treated as planar rather than 3d.\n//=========================================================\nclass Vector2D\n{\npublic:\n\tinline Vector2D(void): x(0.0), y(0.0)\t\t\t\t\t\t\t{ }\n\tinline Vector2D(float X, float Y): x(0.0), y(0.0)\t\t\t\t{ x = X; y = Y; }\n\tinline Vector2D operator+(const Vector2D& v)\tconst\t{ return Vector2D(x+v.x, y+v.y);}\n\tinline Vector2D operator-(const Vector2D& v)\tconst\t{ return Vector2D(x-v.x, y-v.y);}\n\tinline Vector2D operator*(float fl)\t\t\t\tconst\t{ return Vector2D(x*fl, y*fl);}\n\tinline Vector2D operator/(float fl)\t\t\t\tconst\t{ return Vector2D(x/fl, y/fl);}\n\t\n\tinline float Length(void)\t\t\t\t\t\tconst\t{ return sqrt(x*x + y*y);\t}\n\n\tinline Vector2D Normalize (void) const\n\t{\n\n\t\tfloat flLen = Length();\n\t\tif (flLen == 0)\n\t\t{\n\t\t\treturn Vector2D( 0, 0);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tflLen = 1 / flLen;\n\t\t\treturn Vector2D( x * flLen, y * flLen );\n\t\t}\n\t}\n\n\tvec_t\tx, y;\n};\n\ninline float DotProduct(const Vector2D& a, const Vector2D& b) { return( a.x*b.x + a.y*b.y); }\ninline Vector2D operator*(float fl, const Vector2D& v)\t{ return v * fl; }\n\n//=========================================================\n// 3D Vector\n//=========================================================\nclass Vector // same data-layout as engine's vec3_t,\n{\t\t\t\t\t\t\t//\t\twhich is a vec_t[3]\npublic:\n\t// Construction/destruction\n\tinline Vector(void): x(0.0), y(0.0), z(0.0)\t\t\t\t\t{ }\n\tinline Vector(float X, float Y, float Z): x(0.0), y(0.0), z(0.0)\t{ x = X; y = Y; z = Z;\t\t\t}\n\t//inline Vector(double X, double Y, double Z)\t\t{ x = (float)X; y = (float)Y; z = (float)Z;}\n\t//inline Vector(int X, int Y, int Z)\t\t\t\t{ x = (float)X; y = (float)Y; z = (float)Z;}\n\tinline Vector(const Vector& v): x(0.0), y(0.0), z(0.0)\t\t{ x = v.x; y = v.y; z = v.z;\t\t\t} \n\tinline Vector(float rgfl[3]): x(0.0), y(0.0), z(0.0)\t\t{ x = rgfl[0]; y = rgfl[1]; z = rgfl[2];}\n\n\t// Operators\n\tinline Vector operator-(void) const\t\t\t\t{ return Vector(-x,-y,-z);\t\t\t}\n\tinline int operator==(const Vector& v) const\t{ return x==v.x && y==v.y && z==v.z;}\n\tinline int operator!=(const Vector& v) const\t{ return !(*this==v);\t\t\t\t}\n\tinline Vector operator+(const Vector& v) const\t{ return Vector(x+v.x, y+v.y, z+v.z);}\n\tinline Vector operator-(const Vector& v) const\t{ return Vector(x-v.x, y-v.y, z-v.z);}\n\tinline Vector operator*(float fl) const\t\t\t{ return Vector(x*fl, y*fl, z*fl);\t}\n\tinline Vector operator/(float fl) const\t\t\t{ return Vector(x/fl, y/fl, z/fl);\t}\n\t\n\t// Methods\n\tinline void CopyToArray(float* rgfl) const\t\t{ rgfl[0] = x, rgfl[1] = y, rgfl[2] = z; }\n\tinline float Length(void) const\t\t\t\t\t{ return sqrt(x*x + y*y + z*z); }\n\toperator float *()\t\t\t\t\t\t\t\t{ return &x; } // Vectors will now automatically convert to float * when needed\n\toperator const float *() const\t\t\t\t\t{ return &x; } // Vectors will now automatically convert to float * when needed\n\tinline Vector Normalize(void) const\n\t{\n\t\tfloat flLen = Length();\n\t\tif (flLen == 0) return Vector(0,0,1); // ????\n\t\tflLen = 1 / flLen;\n\t\treturn Vector(x * flLen, y * flLen, z * flLen);\n\t}\n\n\tinline Vector2D Make2D (void) const\n\t{\n\t\tVector2D\tVec2;\n\n\t\tVec2.x = x;\n\t\tVec2.y = y;\n\n\t\treturn Vec2;\n\t}\n\tinline float Length2D(void) const\t\t\t\t\t{ return sqrt(x*x + y*y); }\n\n\t// Members\n\tvec_t x, y, z;\n};\ninline Vector operator*(float fl, const Vector& v)\t{ return v * fl; }\ninline float DotProduct(const Vector& a, const Vector& b) { return(a.x*b.x+a.y*b.y+a.z*b.z); }\ninline Vector CrossProduct(const Vector& a, const Vector& b) { return Vector(a.y*b.z - a.z*b.y, a.z*b.x - a.x*b.z, a.x*b.y - a.y*b.x); }\n\n\n#endif\n"
  },
  {
    "path": "dlls/weapons.h",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\n*\tThis product contains software technology licensed from Id\n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc.\n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n#ifndef WEAPONS_H\n#define WEAPONS_H\n\n#include \"effects.h\"\n\nclass CBasePlayer;\nextern int gmsgWeapPickup;\nextern int gmsgReloadSound;\n\nclass CGrenade : public CBaseMonster\n{\npublic:\n\tvoid Spawn(void);\n\tint Save(CSave &save);\n\tint Restore(CRestore &restore);\n\tvirtual void BounceSound(void);\n\tint ObjectCaps(void) { return m_bIsC4 != false ? FCAP_CONTINUOUS_USE : 0; }\n\tint BloodColor(void) { return DONT_BLEED; }\n\tvoid Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);\n\tvoid Killed(entvars_t *pevAttacker, int iGib);\n\npublic:\n\ttypedef enum { SATCHEL_DETONATE = 0, SATCHEL_RELEASE } SATCHELCODE;\n\npublic:\n#ifndef CLIENT_DLL\n\tstatic CGrenade *ShootTimed(entvars_t *pevOwner, Vector vecStart, Vector vecVelocity, float time);\n\tstatic CGrenade *ShootTimed2(entvars_t *pevOwner, Vector vecStart, Vector vecVelocity, float time, int iTeam, unsigned short usEvent);\n\tstatic CGrenade *ShootContact(entvars_t *pevOwner, Vector vecStart, Vector vecVelocity);\n\tstatic CGrenade *ShootSmokeGrenade(entvars_t *pevOwner, Vector vecStart, Vector vecVelocity, float time, unsigned short usEvent);\n\tstatic CGrenade *ShootSatchelCharge(entvars_t *pevOwner, Vector vecStart, Vector vecVelocity);\n#else\n\tstatic CGrenade *ShootTimed(entvars_t *pevOwner, Vector vecStart, Vector vecVelocity, float time) { return NULL; }\n\tstatic CGrenade *ShootTimed2(entvars_t *pevOwner, Vector vecStart, Vector vecVelocity, float time, int iTeam, unsigned short usEvent) { return NULL; }\n\tstatic CGrenade *ShootContact(entvars_t *pevOwner, Vector vecStart, Vector vecVelocity) { return NULL; }\n\tstatic CGrenade *ShootSmokeGrenade(entvars_t *pevOwner, Vector vecStart, Vector vecVelocity, float time, unsigned short usEvent) { return NULL; }\n\tstatic CGrenade *ShootSatchelCharge(entvars_t *pevOwner, Vector vecStart, Vector vecVelocity) { return NULL; }\n#endif\n\tstatic void UseSatchelCharges(entvars_t *pevOwner, SATCHELCODE code);\n\npublic:\n\tvoid Explode(Vector vecSrc, Vector vecAim);\n\tvoid Explode(TraceResult *pTrace, int bitsDamageType);\n\tvoid Explode2(TraceResult *pTrace, int bitsDamageType);\n\tvoid Explode3(TraceResult *pTrace, int bitsDamageType);\n\tvoid EXPORT Smoke(void);\n\tvoid EXPORT SG_Smoke(void);\n\tvoid EXPORT Smoke2(void);\n\tvoid EXPORT Smoke3_A(void);\n\tvoid EXPORT Smoke3_B(void);\n\tvoid EXPORT Smoke3_C(void);\n\tvoid EXPORT BounceTouch(CBaseEntity *pOther);\n\tvoid EXPORT SlideTouch(CBaseEntity *pOther);\n\tvoid EXPORT ExplodeTouch(CBaseEntity *pOther);\n\tvoid EXPORT DangerSoundThink(void);\n\tvoid EXPORT PreDetonate(void);\n\tvoid EXPORT Detonate(void);\n\tvoid EXPORT SG_Detonate(void);\n\tvoid EXPORT Detonate2(void);\n\tvoid EXPORT Detonate3(void);\n\tvoid EXPORT DetonateUse(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);\n\tvoid EXPORT TumbleThink(void);\n\tvoid EXPORT SG_TumbleThink(void);\n\tvoid EXPORT C4Think(void);\n\tvoid EXPORT C4Touch(CBaseEntity *pOther) {}\n\npublic:\n\tstatic TYPEDESCRIPTION m_SaveData[];\n\npublic:\n\tbool m_bStartDefuse;\n\tbool m_bIsC4;\n\tEHANDLE m_pBombDefuser;\n\tfloat m_flDefuseCountDown;\n\tfloat m_flC4Blow;\n\tfloat m_flNextFreqInterval;\n\tfloat m_flNextBeep;\n\tfloat m_flNextFreq;\n\tchar *m_sBeepName;\n\tfloat m_fAttenu;\n\tfloat m_flNextBlink;\n\tfloat m_fNextDefuse;\n\tbool m_bJustBlew;\n\tint m_iTeam;\n\tint m_iCurWave;\n\tedict_t *m_pentCurBombTarget;\n\tint m_SGSmoke;\n\tint m_angle;\n\tunsigned short m_usEvent;\n\tbool m_bLightSmoke;\n\tbool m_bDetonated;\n\tVector m_vSmokeDetonate;\n\tint m_iBounceCount;\n\tBOOL m_fRegisteredSound;\n};\n\n#define ITEM_HEALTHKIT 1\n#define ITEM_ANTIDOTE 2\n#define ITEM_SECURITY 3\n#define ITEM_BATTERY 4\n\n#define WEAPON_ALLWEAPONS (~(1 << WEAPON_SUIT))\n#define WEAPON_SUIT 31\n#define MAX_WEAPONS 32\n\n#define MAX_NORMAL_BATTERY 100\n\n#define WEAPON_NOCLIP -1\n\n#define _9MM_MAX_CARRY MAX_AMMO_9MM\n#define BUCKSHOT_MAX_CARRY MAX_AMMO_BUCKSHOT\n#define _556NATO_MAX_CARRY MAX_AMMO_556NATO\n#define _556NATOBOX_MAX_CARRY MAX_AMMO_556NATOBOX\n#define _762NATO_MAX_CARRY MAX_AMMO_762NATO\n#define _45ACP_MAX_CARRY MAX_AMMO_45ACP\n#define _50AE_MAX_CARRY MAX_AMMO_50AE\n#define _338MAGNUM_MAX_CARRY MAX_AMMO_338MAGNUM\n#define _57MM_MAX_CARRY MAX_AMMO_57MM\n#define _357SIG_MAX_CARRY MAX_AMMO_357SIG\n\n#define HEGRENADE_MAX_CARRY 1\n#define FLASHBANG_MAX_CARRY 2\n#define SMOKEGRENADE_MAX_CARRY 1\n#define C4_MAX_CARRY 1\n\n\n#define ITEM_FLAG_SELECTONEMPTY 1\n#define ITEM_FLAG_NOAUTORELOAD 2\n#define ITEM_FLAG_NOAUTOSWITCHEMPTY 4\n#define ITEM_FLAG_LIMITINWORLD 8\n#define ITEM_FLAG_EXHAUSTIBLE 16\n\n#define WPNSLOT_PRIMARY 1\n#define WPNSLOT_SECONDARY 2\n#define WPNSLOT_KNIFE 3\n#define WPNSLOT_GRENADE 4\n#define WPNSLOT_C4 5\n\n#define WEAPON_IS_ONTARGET 0x40\n\ntypedef struct\n{\n\tint iSlot;\n\tint iPosition;\n\tconst char *pszAmmo1;\n\tint iMaxAmmo1;\n\tconst char *pszAmmo2;\n\tint iMaxAmmo2;\n\tconst char *pszName;\n\tint iMaxClip;\n\tint iId;\n\tint iFlags;\n\tint iWeight;\n}\nItemInfo;\n\ntypedef struct\n{\n\tconst char *pszName;\n\tint iId;\n}\nAmmoInfo;\n\nclass CBasePlayerItem : public CBaseAnimating\n{\npublic:\n\tvirtual int Save(CSave &save) { return 1; }\n\tvirtual int Restore(CRestore &restore) { return 1; }\n\tvirtual void SetObjectCollisionBox(void) { }\n\tvirtual int AddToPlayer(CBasePlayer *pPlayer) { return false; }\n\tvirtual int AddDuplicate(CBasePlayerItem *pItem) { return FALSE; }\n\tvirtual int GetItemInfo(ItemInfo *p) { return 0; }\n\tvirtual BOOL CanDeploy(void) { return TRUE; }\n\tvirtual BOOL CanDrop(void) { return TRUE; }\n\tvirtual BOOL Deploy(void) { return TRUE; }\n\tvirtual BOOL IsWeapon(void) { return FALSE; }\n\tvirtual BOOL CanHolster(void) { return TRUE; }\n\tvirtual void Holster(int skiplocal = 0) {}\n\tvirtual void UpdateItemInfo(void) {}\n\tvirtual void ItemPreFrame(void) {}\n\tvirtual void ItemPostFrame(void) {}\n\tvirtual void Drop(void) {}\n\tvirtual void Kill(void) {}\n\tvirtual void AttachToPlayer(CBasePlayer *pPlayer) {}\n\tvirtual int PrimaryAmmoIndex(void) { return -1; }\n\tvirtual int SecondaryAmmoIndex(void) { return -1; }\n\tvirtual int UpdateClientData(CBasePlayer *pPlayer) { return 0; }\n\tvirtual CBasePlayerItem *GetWeaponPtr(void) { return NULL; }\n\tvirtual float GetMaxSpeed(void) { return 260; }\n\tvirtual int iItemSlot(void) { return 0; }\n\npublic:\n\tvoid EXPORT DestroyItem(void) {}\n\tvoid EXPORT DefaultTouch(CBaseEntity *pOther) {}\n\tvoid EXPORT FallThink(void) {}\n\tvoid EXPORT Materialize(void) {}\n\tvoid EXPORT AttemptToMaterialize(void) {}\n\tCBaseEntity *Respawn(void) { return this; }\n\tvoid FallInit(void) { }\n\tvoid CheckRespawn(void) {}\n\npublic:\n\tstatic TYPEDESCRIPTION m_SaveData[];\n\tstatic ItemInfo ItemInfoArray[MAX_WEAPONS];\n\tstatic AmmoInfo AmmoInfoArray[MAX_AMMO_SLOTS];\n\npublic:\n\tCBasePlayer *m_pPlayer;\n\tCBasePlayerItem *m_pNext;\n\tint m_iId;\n\npublic:\n\tint iItemPosition(void) { return ItemInfoArray[m_iId].iPosition; }\n\tconst char *pszAmmo1(void) { return ItemInfoArray[m_iId].pszAmmo1; }\n\tint iMaxAmmo1(void) { return ItemInfoArray[m_iId].iMaxAmmo1; }\n\tconst char *pszAmmo2(void) { return ItemInfoArray[m_iId].pszAmmo2; }\n\tint iMaxAmmo2(void) { return ItemInfoArray[m_iId].iMaxAmmo2; }\n\tconst char *pszName(void) { return ItemInfoArray[m_iId].pszName; }\n\tint iMaxClip(void) { return ItemInfoArray[m_iId].iMaxClip; }\n\tint iWeight(void) { return ItemInfoArray[m_iId].iWeight; }\n\tint iFlags(void) { return ItemInfoArray[m_iId].iFlags; }\n};\n\nclass CBasePlayerWeapon : public CBasePlayerItem\n{\npublic:\n\tvirtual int Save(CSave &save) { return 1; }\n\tvirtual int Restore(CRestore &restore) { return 1; }\n\tvirtual int AddToPlayer(CBasePlayer *pPlayer) { return 0; }\n\tvirtual int AddDuplicate(CBasePlayerItem *pItem) { return 0; }\n\tvirtual int ExtractAmmo(CBasePlayerWeapon *pWeapon) { return 0; }\n\tvirtual int ExtractClipAmmo(CBasePlayerWeapon *pWeapon) { return 0; }\n\tvirtual int AddWeapon(void) { ExtractAmmo(this); return TRUE; }\n\tvirtual void UpdateItemInfo(void) {}\n\tvirtual BOOL PlayEmptySound(void);\n\tvirtual void ResetEmptySound(void);\n\tvirtual void SendWeaponAnim(int iAnim, int skiplocal = 0);\n\tvirtual BOOL CanDeploy(void);\n\tvirtual BOOL IsWeapon(void) { return TRUE; }\n\tvirtual BOOL IsUseable(void) { return true; }\n\tvirtual void ItemPostFrame(void);\n\tvirtual void PrimaryAttack(void) {}\n\tvirtual void SecondaryAttack(void) {}\n\tvirtual void Reload(void) {}\n\tvirtual void WeaponIdle(void) {}\n\tvirtual int UpdateClientData(CBasePlayer *pPlayer) { return 0; }\n\tvirtual void RetireWeapon(void);\n\tvirtual BOOL ShouldWeaponIdle(void) { return FALSE; }\n\tvirtual void Holster(int skiplocal = 0);\n\tvirtual BOOL UseDecrement(void) { return FALSE; }\n\tvirtual CBasePlayerItem *GetWeaponPtr(void) { return (CBasePlayerItem *)this; }\n\npublic:\n\tBOOL DefaultDeploy(const char *szViewModel, const char *szWeaponModel, int iAnim, const char *szAnimExt, int skiplocal = 0);\n\tint DefaultReload(int iClipSize, int iAnim, float fDelay, int body = 0);\n\tvoid ReloadSound(void);\n\tBOOL AddPrimaryAmmo(int iCount, char *szName, int iMaxClip, int iMaxCarry) { return true; }\n\tBOOL AddSecondaryAmmo(int iCount, char *szName, int iMaxCarry) { return true; }\n\tint PrimaryAmmoIndex(void) { return -1; }\n\tint SecondaryAmmoIndex(void) { return -1; }\n\tvoid EjectBrassLate(void);\n\tvoid KickBack(float up_base, float lateral_base, float up_modifier, float lateral_modifier, float up_max, float lateral_max, int direction_change);\n\tvoid FireRemaining(int &shotsFired, float &shootTime, BOOL isGlock18);\n\tvoid SetPlayerShieldAnim(void);\n\tvoid ResetPlayerShieldAnim(void);\n\tbool ShieldSecondaryFire(int up_anim, int down_anim);\n\tbool HasSecondaryAttack(void);\n\tfloat GetNextAttackDelay(float delay);\n\npublic:\n\tstatic TYPEDESCRIPTION m_SaveData[];\n\npublic:\n\tint m_iPlayEmptySound;\n\tint m_fFireOnEmpty;\n\tfloat m_flNextPrimaryAttack;\n\tfloat m_flNextSecondaryAttack;\n\tfloat m_flTimeWeaponIdle;\n\tint m_iPrimaryAmmoType;\n\tint m_iSecondaryAmmoType;\n\tint m_iClip;\n\tint m_iClientClip;\n\tint m_iClientWeaponState;\n\tint m_fInReload;\n\tint m_fInSpecialReload;\n\tint m_iDefaultAmmo;\n\tint m_iShellId;\n\tint m_fMaxSpeed;\n\tbool m_bDelayFire;\n\tint m_iDirection;\n\tbool m_bSecondarySilencerOn;\n\tfloat m_flAccuracy;\n\tfloat m_flLastFire;\n\tint m_iShotsFired;\n\tVector m_vVecAiming;\n\tstring_t model_name;\n\tfloat m_flGlock18Shoot;\n\tint m_iGlock18ShotsFired;\n\tfloat m_flFamasShoot;\n\tint m_iFamasShotsFired;\n\tfloat m_fBurstSpread;\n\tint m_iWeaponState;\n\tfloat m_flNextReload;\n\tfloat m_flDecreaseShotsFired;\n\tunsigned short m_usFireGlock18;\n\tunsigned short m_usFireFamas;\n};\n\nclass CBasePlayerAmmo : public CBaseEntity\n{\npublic:\n\tvirtual void Spawn(void){}\n\tvirtual BOOL AddAmmo(CBaseEntity *pOther) { return TRUE; }\n\npublic:\n\tvoid EXPORT Materialize(void) { }\n\tvoid EXPORT DefaultTouch(CBaseEntity *pOther) { }\n\tCBaseEntity *Respawn(void) { return this; }\n};\n\nextern DLL_GLOBAL short g_sModelIndexLaser;\nextern DLL_GLOBAL const char *g_pModelNameLaser;\nextern DLL_GLOBAL short g_sModelIndexLaserDot;\nextern DLL_GLOBAL short g_sModelIndexFireball;\nextern DLL_GLOBAL short g_sModelIndexFireball2;\nextern DLL_GLOBAL short g_sModelIndexFireball3;\nextern DLL_GLOBAL short g_sModelIndexFireball4;\nextern DLL_GLOBAL short g_sModelIndexSmoke;\nextern DLL_GLOBAL short g_sModelIndexSmokePuff;\nextern DLL_GLOBAL short g_sModelIndexWExplosion;\nextern DLL_GLOBAL short g_sModelIndexBubbles;\nextern DLL_GLOBAL short g_sModelIndexBloodDrop;\nextern DLL_GLOBAL short g_sModelIndexBloodSpray;\nextern DLL_GLOBAL short g_sModelIndexRadio;\nextern DLL_GLOBAL short g_sModelIndexCTGhost;\nextern DLL_GLOBAL short g_sModelIndexTGhost;\nextern DLL_GLOBAL short g_sModelIndexC4Glow;\n\n#ifndef CLIENT_WEAPONS\nextern void ClearMultiDamage(void);\nextern void ApplyMultiDamage(entvars_t *pevInflictor, entvars_t *pevAttacker);\nextern void AddMultiDamage(entvars_t *pevInflictor, CBaseEntity *pEntity, float flDamage, int bitsDamageType);\nextern void DecalGunshot(TraceResult *pTrace, int iBulletType, bool ClientOnly, entvars_t *pShooter, bool bHitMetal);\nextern void SpawnBlood(Vector vecSpot, int bloodColor, float flDamage);\nextern int DamageDecal(CBaseEntity *pEntity, int bitsDamageType);\nextern void RadiusFlash(Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage);\nextern void RadiusDamage(Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, float flRadius, int iClassIgnore, int bitsDamageType);\n#else\ninline void ClearMultiDamage(void) { }\ninline void ApplyMultiDamage(entvars_t *pevInflictor, entvars_t *pevAttacker) { }\ninline void DecalGunshot(TraceResult *pTrace, int iBulletType, bool ClientOnly, entvars_t *pShooter, bool bHitMetal) { }\n#endif\ntypedef struct\n{\n\tCBaseEntity *pEntity;\n\tfloat amount;\n\tint type;\n}\nMULTIDAMAGE;\n\nextern MULTIDAMAGE gMultiDamage;\n\n#define LOUD_GUN_VOLUME 1000\n#define NORMAL_GUN_VOLUME 600\n#define QUIET_GUN_VOLUME 200\n\n#define BRIGHT_GUN_FLASH 512\n#define NORMAL_GUN_FLASH 256\n#define DIM_GUN_FLASH 128\n\n#define BIG_EXPLOSION_VOLUME 2048\n#define NORMAL_EXPLOSION_VOLUME 1024\n#define SMALL_EXPLOSION_VOLUME 512\n\n#define WEAPON_ACTIVITY_VOLUME 64\n\n#define VECTOR_CONE_1DEGREES Vector(0.00873, 0.00873, 0.00873)\n#define VECTOR_CONE_2DEGREES Vector(0.01745, 0.01745, 0.01745)\n#define VECTOR_CONE_3DEGREES Vector(0.02618, 0.02618, 0.02618)\n#define VECTOR_CONE_4DEGREES Vector(0.03490, 0.03490, 0.03490)\n#define VECTOR_CONE_5DEGREES Vector(0.04362, 0.04362, 0.04362)\n#define VECTOR_CONE_6DEGREES Vector(0.05234, 0.05234, 0.05234)\n#define VECTOR_CONE_7DEGREES Vector(0.06105, 0.06105, 0.06105)\n#define VECTOR_CONE_8DEGREES Vector(0.06976, 0.06976, 0.06976)\n#define VECTOR_CONE_9DEGREES Vector(0.07846, 0.07846, 0.07846)\n#define VECTOR_CONE_10DEGREES Vector(0.08716, 0.08716, 0.08716)\n#define VECTOR_CONE_15DEGREES Vector(0.13053, 0.13053, 0.13053)\n#define VECTOR_CONE_20DEGREES Vector(0.17365, 0.17365, 0.17365)\n\nclass CWeaponBox : public CBaseEntity\n{\npublic:\n\tvoid Spawn(void);\n\tvoid Precache(void);\n\tvoid KeyValue(KeyValueData *pkvd);\n\tint Save(CSave &save);\n\tint Restore(CRestore &restore);\n\tvoid Touch(CBaseEntity *pOther);\n\tvoid SetObjectCollisionBox(void);\n\npublic:\n\tBOOL IsEmpty(void);\n\tint GiveAmmo(int iCount, char *szName, int iMax, int *pIndex = NULL); // -V762\n\tvoid EXPORT Kill(void);\n\tBOOL HasWeapon(CBasePlayerItem *pCheckItem);\n\tBOOL PackWeapon(CBasePlayerItem *pWeapon);\n\tBOOL PackAmmo(int iszName, int iCount);\n\npublic:\n\tstatic TYPEDESCRIPTION m_SaveData[];\n\npublic:\n\tCBasePlayerItem *m_rgpPlayerItems[MAX_ITEM_TYPES];\n\tint m_rgiszAmmo[MAX_AMMO_SLOTS];\n\tint m_rgAmmo[MAX_AMMO_SLOTS];\n\tint m_cAmmoTypes;\n};\n\nclass CWShield : public CBaseEntity\n{\npublic:\n\tvoid Spawn(void);\n\tvoid EXPORT Touch(CBaseEntity *pOther);\n\tvoid SetCantBePickedUpByUser(CBaseEntity *pEntity, float time);\n\npublic:\n\tEHANDLE m_hEntToIgnoreTouchesFrom;\n\tfloat m_flTimeToIgnoreTouches;\n};\n\n#ifdef PLAYER_H\n\nclass CAK47 : public CBasePlayerWeapon\n{\npublic:\n\tvoid Spawn(void);\n\tvoid Precache(void);\n\tint GetItemInfo(ItemInfo *p);\n\tBOOL Deploy(void);\n\tfloat GetMaxSpeed(void) { return 221; }\n\tint iItemSlot(void) { return WPNSLOT_PRIMARY; }\n\tvoid PrimaryAttack(void);\n\tvoid Reload(void);\n\tvoid WeaponIdle(void);\n\n\tBOOL UseDecrement(void)\n\t{\n#ifdef CLIENT_WEAPONS\n\t\treturn TRUE;\n#else\n\t\treturn FALSE;\n#endif\n\t}\n\nprivate:\n\tvoid AK47Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim);\n\nprivate:\n\tint m_iShell;\n\tint iShellOn;\n\tunsigned short m_usFireAK47;\n};\n\nclass CAUG : public CBasePlayerWeapon\n{\npublic:\n\tvoid Spawn(void);\n\tvoid Precache(void);\n\tint GetItemInfo(ItemInfo *p);\n\tBOOL Deploy(void);\n\tfloat GetMaxSpeed(void) { return 240; }\n\tint iItemSlot(void) { return WPNSLOT_PRIMARY; }\n\tvoid PrimaryAttack(void);\n\tvoid SecondaryAttack(void);\n\tvoid Reload(void);\n\tvoid WeaponIdle(void);\n\n\tBOOL UseDecrement(void)\n\t{\n#ifdef CLIENT_WEAPONS\n\t\treturn TRUE;\n#else\n\t\treturn FALSE;\n#endif\n\t}\n\npublic:\n\tvoid AUGFire(float flSpread, float flCycleTime, BOOL fUseAutoAim);\n\nprivate:\n\tint m_iShell;\n\tint iShellOn;\n\tunsigned short m_usFireAug;\n};\n\nclass CAWP : public CBasePlayerWeapon\n{\npublic:\n\tvoid Spawn(void);\n\tvoid Precache(void);\n\tint GetItemInfo(ItemInfo *p);\n\tBOOL Deploy(void);\n\tfloat GetMaxSpeed(void);\n\tint iItemSlot(void) { return WPNSLOT_PRIMARY; }\n\tvoid PrimaryAttack(void);\n\tvoid SecondaryAttack(void);\n\tvoid Reload(void);\n\tvoid WeaponIdle(void);\n\n\tBOOL UseDecrement(void)\n\t{\n#ifdef CLIENT_WEAPONS\n\t\treturn TRUE;\n#else\n\t\treturn FALSE;\n#endif\n\t}\n\nprivate:\n\tvoid AWPFire(float flSpread, float flCycleTime, BOOL fUseAutoAim);\n\nprivate:\n\tint m_iShell;\n\tunsigned short m_usFireAWP;\n};\n\n// for usermsg BombDrop\n#define BOMB_FLAG_DROPPED\t0 // if the bomb was dropped due to voluntary dropping or death/disconnect\n#define BOMB_FLAG_PLANTED\t1 // if the bomb has been planted will also trigger the round timer to hide will also show where the dropped bomb on the Terrorist team's radar.\n\nclass CC4 : public CBasePlayerWeapon\n{\npublic:\n\tvoid Spawn(void);\n\tvoid Precache(void);\n\tvoid KeyValue(KeyValueData *pkvd);\n\tvoid Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);\n\tint GetItemInfo(ItemInfo *p);\n\tBOOL Deploy(void);\n\tvoid Holster(int skiplocal);\n\tfloat GetMaxSpeed(void) { return 250; }\n\tint iItemSlot(void) { return WPNSLOT_C4; }\n\tvoid PrimaryAttack(void);\n\tvoid WeaponIdle(void);\n\n\tBOOL UseDecrement(void)\n\t{\n#ifdef CLIENT_WEAPONS\n\t\treturn TRUE;\n#else\n\t\treturn FALSE;\n#endif\n\t}\n\npublic:\n\tbool m_bStartedArming;\n\tbool m_bBombPlacedAnimation;\n\tfloat m_fArmedTime;\n\tbool m_bHasShield;\n};\n\nclass CDEAGLE : public CBasePlayerWeapon\n{\npublic:\n\tvoid Spawn(void);\n\tvoid Precache(void);\n\tint GetItemInfo(ItemInfo *p);\n\tBOOL Deploy(void);\n\tfloat GetMaxSpeed(void) { return m_fMaxSpeed; }\n\tint iItemSlot(void) { return WPNSLOT_SECONDARY; }\n\tvoid PrimaryAttack(void);\n\tvoid SecondaryAttack(void);\n\tvoid Reload(void);\n\tvoid WeaponIdle(void);\n\n\tBOOL UseDecrement(void)\n\t{\n#ifdef CLIENT_WEAPONS\n\t\treturn TRUE;\n#else\n\t\treturn FALSE;\n#endif\n\t}\n\nprivate:\n\tvoid DEAGLEFire(float flSpread, float flCycleTime, BOOL fUseAutoAim);\n\nprivate:\n\tint m_iShell;\n\tunsigned short m_usFireDeagle;\n};\n\nclass CELITE : public CBasePlayerWeapon\n{\npublic:\n\tvoid Spawn(void);\n\tvoid Precache(void);\n\tint GetItemInfo(ItemInfo *p);\n\tBOOL Deploy(void);\n\tfloat GetMaxSpeed(void) { return 250; }\n\tint iItemSlot(void) { return WPNSLOT_SECONDARY; }\n\tvoid PrimaryAttack(void);\n\tvoid Reload(void);\n\tvoid WeaponIdle(void);\n\n\tBOOL UseDecrement(void)\n\t{\n#ifdef CLIENT_WEAPONS\n\t\treturn TRUE;\n#else\n\t\treturn FALSE;\n#endif\n\t}\n\nprivate:\n\tvoid ELITEFire(float flSpread, float flCycleTime, BOOL fUseAutoAim);\n\nprivate:\n\tint m_iShell;\n\tunsigned short m_usFireELITE_LEFT;\n\tunsigned short m_usFireELITE_RIGHT;\n};\n\nclass CFamas : public CBasePlayerWeapon\n{\npublic:\n\tvoid Spawn(void);\n\tvoid Precache(void);\n\tint GetItemInfo(ItemInfo *p);\n\tBOOL Deploy(void);\n\tfloat GetMaxSpeed(void) { return 240; }\n\tint iItemSlot(void) { return WPNSLOT_PRIMARY; }\n\tvoid PrimaryAttack(void);\n\tvoid SecondaryAttack(void);\n\tvoid Reload(void);\n\tvoid WeaponIdle(void);\n\n\tBOOL UseDecrement(void)\n\t{\n#ifdef CLIENT_WEAPONS\n\t\treturn TRUE;\n#else\n\t\treturn FALSE;\n#endif\n\t}\n\nprivate:\n\tvoid FamasFire(float flSpread, float flCycleTime, BOOL fUseAutoAim, BOOL bFireBurst);\n\nprivate:\n\tint m_iShell;\n\tint iShellOn;\n};\n\nclass CFiveSeven : public CBasePlayerWeapon\n{\npublic:\n\tvoid Spawn(void);\n\tvoid Precache(void);\n\tint GetItemInfo(ItemInfo *p);\n\tBOOL Deploy(void);\n\tfloat GetMaxSpeed(void) { return m_fMaxSpeed; }\n\tint iItemSlot(void) { return WPNSLOT_SECONDARY; }\n\tvoid PrimaryAttack(void);\n\tvoid SecondaryAttack(void);\n\tvoid Reload(void);\n\tvoid WeaponIdle(void);\n\n\tBOOL UseDecrement(void)\n\t{\n#ifdef CLIENT_WEAPONS\n\t\treturn TRUE;\n#else\n\t\treturn FALSE;\n#endif\n\t}\n\nprivate:\n\tvoid FiveSevenFire(float flSpread, float flCycleTime, BOOL fUseAutoAim);\n\nprivate:\n\tint m_iShell;\n\tunsigned short m_usFireFiveSeven;\n};\n\nclass CFlashbang : public CBasePlayerWeapon\n{\npublic:\n\tvoid Spawn(void);\n\tvoid Precache(void);\n\tint GetItemInfo(ItemInfo *p);\n\tBOOL CanDeploy(void);\n\tBOOL CanDrop(void) { return FALSE; }\n\tBOOL Deploy(void);\n\tvoid Holster(int skiplocal);\n\tfloat GetMaxSpeed(void) { return m_fMaxSpeed; }\n\tint iItemSlot(void) { return WPNSLOT_GRENADE; }\n\tvoid PrimaryAttack(void);\n\tvoid SecondaryAttack(void);\n\tvoid WeaponIdle(void);\n\tvoid SetPlayerShieldAnim(void);\n\tvoid ResetPlayerShieldAnim(void);\n\tbool ShieldSecondaryFire(int up_anim, int down_anim);\n\n\tBOOL UseDecrement(void)\n\t{\n#ifdef CLIENT_WEAPONS\n\t\treturn TRUE;\n#else\n\t\treturn FALSE;\n#endif\n\t}\n};\n\nclass CG3SG1 : public CBasePlayerWeapon\n{\npublic:\n\tvoid Spawn(void);\n\tvoid Precache(void);\n\tint GetItemInfo(ItemInfo *p);\n\tBOOL Deploy(void);\n\tfloat GetMaxSpeed(void);\n\tint iItemSlot(void) { return WPNSLOT_PRIMARY; }\n\tvoid PrimaryAttack(void);\n\tvoid SecondaryAttack(void);\n\tvoid Reload(void);\n\tvoid WeaponIdle(void);\n\n\tBOOL UseDecrement(void)\n\t{\n#ifdef CLIENT_WEAPONS\n\t\treturn TRUE;\n#else\n\t\treturn FALSE;\n#endif\n\t}\n\nprivate:\n\tvoid G3SG1Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim);\n\nprivate:\n\tint m_iShell;\n\tunsigned short m_usFireG3SG1;\n};\n\nclass CGalil : public CBasePlayerWeapon\n{\npublic:\n\tvoid Spawn(void);\n\tvoid Precache(void);\n\tint GetItemInfo(ItemInfo *p);\n\tBOOL Deploy(void);\n\tfloat GetMaxSpeed(void) { return 240; }\n\tint iItemSlot(void) { return WPNSLOT_PRIMARY; }\n\tvoid PrimaryAttack(void);\n\tvoid Reload(void);\n\tvoid WeaponIdle(void);\n\n\tBOOL UseDecrement(void)\n\t{\n#ifdef CLIENT_WEAPONS\n\t\treturn TRUE;\n#else\n\t\treturn FALSE;\n#endif\n\t}\n\nprivate:\n\tvoid GalilFire(float flSpread, float flCycleTime, BOOL fUseAutoAim);\n\nprivate:\n\tint m_iShell;\n\tint iShellOn;\n\tunsigned short m_usFireGalil;\n};\n\nclass CGLOCK18 : public CBasePlayerWeapon\n{\npublic:\n\tvoid Spawn(void);\n\tvoid Precache(void);\n\tint GetItemInfo(ItemInfo *p);\n\tBOOL Deploy(void);\n\tfloat GetMaxSpeed(void) { return m_fMaxSpeed; }\n\tint iItemSlot(void) { return WPNSLOT_SECONDARY; }\n\tvoid PrimaryAttack(void);\n\tvoid SecondaryAttack(void);\n\tvoid Reload(void);\n\tvoid WeaponIdle(void);\n\n\tBOOL UseDecrement(void)\n\t{\n#ifdef CLIENT_WEAPONS\n\t\treturn TRUE;\n#else\n\t\treturn FALSE;\n#endif\n\t}\n\nprivate:\n\tvoid GLOCK18Fire(float flSpread, float flCycleTime, BOOL fUseBurstMode);\n\nprivate:\n\tint m_iShell;\n\tbool m_bBurstFire;\n};\n\nclass CHEGrenade : public CBasePlayerWeapon\n{\npublic:\n\tvoid Spawn(void);\n\tvoid Precache(void);\n\tint GetItemInfo(ItemInfo *p);\n\tBOOL CanDeploy(void);\n\tBOOL CanDrop(void) { return FALSE; }\n\tBOOL Deploy(void);\n\tBOOL CanHolster(void);\n\tvoid Holster(int skiplocal);\n\tfloat GetMaxSpeed(void) { return m_fMaxSpeed; }\n\tint iItemSlot(void) { return WPNSLOT_GRENADE; }\n\tvoid PrimaryAttack(void);\n\tvoid SecondaryAttack(void);\n\tvoid WeaponIdle(void);\n\tvoid SetPlayerShieldAnim(void);\n\tvoid ResetPlayerShieldAnim(void);\n\tbool ShieldSecondaryFire(int up_anim, int down_anim);\n\n\tBOOL UseDecrement(void)\n\t{\n#ifdef CLIENT_WEAPONS\n\t\treturn TRUE;\n#else\n\t\treturn FALSE;\n#endif\n\t}\n\npublic:\n\tunsigned short m_usCreateExplosion;\n};\n\nclass CKnife : public CBasePlayerWeapon\n{\npublic:\n\tvoid Spawn(void);\n\tvoid Precache(void);\n\tint GetItemInfo(ItemInfo *p);\n\tBOOL CanDrop(void) { return FALSE; }\n\tBOOL Deploy(void);\n\tvoid Holster(int skiplocal);\n\tfloat GetMaxSpeed(void) { return m_fMaxSpeed; }\n\tint iItemSlot(void) { return WPNSLOT_KNIFE; }\n\tvoid PrimaryAttack(void);\n\tvoid SecondaryAttack(void);\n\tvoid SetPlayerShieldAnim(void);\n\tvoid ResetPlayerShieldAnim(void);\n\tbool ShieldSecondaryFire(int up_anim, int down_anim);\n\tvoid WeaponIdle(void);\n\n\tBOOL UseDecrement(void)\n\t{\n#ifdef CLIENT_WEAPONS\n\t\treturn TRUE;\n#else\n\t\treturn FALSE;\n#endif\n\t}\n\npublic:\n\tvoid WeaponAnimation(int iAnimation);\n\tvoid EXPORT SwingAgain(void);\n\tvoid EXPORT Smack(void);\n\tint Swing(int fFirst);\n\tint Stab(int fFirst);\n\nprivate:\n\t//int m_iSwing; //Already exists in CBaseDelay\n\tTraceResult m_trHit;\n\tunsigned short m_usKnife;\n};\n\nclass CM249 : public CBasePlayerWeapon\n{\npublic:\n\tvoid Spawn(void);\n\tvoid Precache(void);\n\tint GetItemInfo(ItemInfo *p);\n\tBOOL Deploy(void);\n\tfloat GetMaxSpeed(void) { return 220; }\n\tint iItemSlot(void) { return WPNSLOT_PRIMARY; }\n\tvoid PrimaryAttack(void);\n\tvoid Reload(void);\n\tvoid WeaponIdle(void);\n\n\tBOOL UseDecrement(void)\n\t{\n#ifdef CLIENT_WEAPONS\n\t\treturn TRUE;\n#else\n\t\treturn FALSE;\n#endif\n\t}\n\nprivate:\n\tvoid M249Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim);\n\nprivate:\n\tint m_iShell;\n\tint iShellOn;\n\tunsigned short m_usFireM249;\n};\n\nclass CM3 : public CBasePlayerWeapon\n{\npublic:\n\tvoid Spawn(void);\n\tvoid Precache(void);\n\tint GetItemInfo(ItemInfo *p);\n\tBOOL Deploy(void);\n\tfloat GetMaxSpeed(void) { return 230; }\n\tint iItemSlot(void) { return WPNSLOT_PRIMARY; }\n\tvoid PrimaryAttack(void);\n\tvoid Reload(void);\n\tvoid WeaponIdle(void);\n\n\tBOOL UseDecrement(void)\n\t{\n#ifdef CLIENT_WEAPONS\n\t\treturn TRUE;\n#else\n\t\treturn FALSE;\n#endif\n\t}\n\nprivate:\n\tint m_iShell;\n\tfloat m_flPumpTime;\n\tunsigned short m_usFireM3;\n};\n\nclass CM4A1 : public CBasePlayerWeapon\n{\npublic:\n\tvoid Spawn(void);\n\tvoid Precache(void);\n\tint GetItemInfo(ItemInfo *p);\n\tBOOL Deploy(void);\n\tfloat GetMaxSpeed(void) { return 230; }\n\tint iItemSlot(void) { return WPNSLOT_PRIMARY; }\n\tvoid PrimaryAttack(void);\n\tvoid SecondaryAttack(void);\n\tvoid Reload(void);\n\tvoid WeaponIdle(void);\n\n\tBOOL UseDecrement(void)\n\t{\n#ifdef CLIENT_WEAPONS\n\t\treturn TRUE;\n#else\n\t\treturn FALSE;\n#endif\n\t}\n\nprivate:\n\tvoid M4A1Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim);\n\nprivate:\n\tint m_iShell;\n\tint iShellOn;\n\tunsigned short m_usFireM4A1;\n};\n\nclass CMAC10 : public CBasePlayerWeapon\n{\npublic:\n\tvoid Spawn(void);\n\tvoid Precache(void);\n\tint GetItemInfo(ItemInfo *p);\n\tBOOL Deploy(void);\n\tfloat GetMaxSpeed(void) { return 250; }\n\tint iItemSlot(void) { return WPNSLOT_PRIMARY; }\n\tvoid PrimaryAttack(void);\n\tvoid Reload(void);\n\tvoid WeaponIdle(void);\n\n\tBOOL UseDecrement(void)\n\t{\n#ifdef CLIENT_WEAPONS\n\t\treturn TRUE;\n#else\n\t\treturn FALSE;\n#endif\n\t}\n\nprivate:\n\tvoid MAC10Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim);\n\nprivate:\n\tint m_iShell;\n\tint iShellOn;\n\tunsigned short m_usFireMAC10;\n};\n\nclass CMP5N : public CBasePlayerWeapon\n{\npublic:\n\tvoid Spawn(void);\n\tvoid Precache(void);\n\tint GetItemInfo(ItemInfo *p);\n\tBOOL Deploy(void);\n\tfloat GetMaxSpeed(void) { return 250; }\n\tint iItemSlot(void) { return WPNSLOT_PRIMARY; }\n\tvoid PrimaryAttack(void);\n\tvoid Reload(void);\n\tvoid WeaponIdle(void);\n\n\tBOOL UseDecrement(void)\n\t{\n#ifdef CLIENT_WEAPONS\n\t\treturn TRUE;\n#else\n\t\treturn FALSE;\n#endif\n\t}\n\nprivate:\n\tvoid MP5NFire(float flSpread, float flCycleTime, BOOL fUseAutoAim);\n\nprivate:\n\tint m_iShell;\n\tint iShellOn;\n\tunsigned short m_usFireMP5N;\n};\n\nclass CP228 : public CBasePlayerWeapon\n{\npublic:\n\tvoid Spawn(void);\n\tvoid Precache(void);\n\tint GetItemInfo(ItemInfo *p);\n\tBOOL Deploy(void);\n\tfloat GetMaxSpeed(void) { return m_fMaxSpeed; }\n\tint iItemSlot(void) { return WPNSLOT_SECONDARY; }\n\tvoid PrimaryAttack(void);\n\tvoid SecondaryAttack(void);\n\tvoid Reload(void);\n\tvoid WeaponIdle(void);\n\n\tBOOL UseDecrement(void)\n\t{\n#ifdef CLIENT_WEAPONS\n\t\treturn TRUE;\n#else\n\t\treturn FALSE;\n#endif\n\t}\n\nprivate:\n\tvoid P228Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim);\n\nprivate:\n\tint m_iShell;\n\tunsigned short m_usFireP228;\n};\n\nclass CP90 : public CBasePlayerWeapon\n{\npublic:\n\tvoid Spawn(void);\n\tvoid Precache(void);\n\tint GetItemInfo(ItemInfo *p);\n\tBOOL Deploy(void);\n\tfloat GetMaxSpeed(void) { return 245; }\n\tint iItemSlot(void) { return WPNSLOT_PRIMARY; }\n\tvoid PrimaryAttack(void);\n\tvoid Reload(void);\n\tvoid WeaponIdle(void);\n\n\tBOOL UseDecrement(void)\n\t{\n#ifdef CLIENT_WEAPONS\n\t\treturn TRUE;\n#else\n\t\treturn FALSE;\n#endif\n\t}\n\nprivate:\n\tvoid P90Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim);\n\nprivate:\n\tint m_iShell;\n\tint iShellOn;\n\tunsigned short m_usFireP90;\n};\n\nclass CSCOUT : public CBasePlayerWeapon\n{\npublic:\n\tvoid Spawn(void);\n\tvoid Precache(void);\n\tint GetItemInfo(ItemInfo *p);\n\tBOOL Deploy(void);\n\tfloat GetMaxSpeed(void);\n\tint iItemSlot(void) { return WPNSLOT_PRIMARY; }\n\tvoid PrimaryAttack(void);\n\tvoid SecondaryAttack(void);\n\tvoid Reload(void);\n\tvoid WeaponIdle(void);\n\n\tBOOL UseDecrement(void)\n\t{\n#ifdef CLIENT_WEAPONS\n\t\treturn TRUE;\n#else\n\t\treturn FALSE;\n#endif\n\t}\n\nprivate:\n\tvoid SCOUTFire(float flSpread, float flCycleTime, BOOL fUseAutoAim);\n\nprivate:\n\tint m_iShell;\n\tunsigned short m_usFireScout;\n};\n\nclass CSG550 : public CBasePlayerWeapon\n{\npublic:\n\tvoid Spawn(void);\n\tvoid Precache(void);\n\tint GetItemInfo(ItemInfo *p);\n\tBOOL Deploy(void);\n\tfloat GetMaxSpeed(void);\n\tint iItemSlot(void) { return WPNSLOT_PRIMARY; }\n\tvoid PrimaryAttack(void);\n\tvoid SecondaryAttack(void);\n\tvoid Reload(void);\n\tvoid WeaponIdle(void);\n\n\tBOOL UseDecrement(void)\n\t{\n#ifdef CLIENT_WEAPONS\n\t\treturn TRUE;\n#else\n\t\treturn FALSE;\n#endif\n\t}\n\nprivate:\n\tvoid SG550Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim);\n\nprivate:\n\tint m_iShell;\n\tunsigned short m_usFireSG550;\n};\n\nclass CSG552 : public CBasePlayerWeapon\n{\npublic:\n\tvoid Spawn(void);\n\tvoid Precache(void);\n\tint GetItemInfo(ItemInfo *p);\n\tBOOL Deploy(void);\n\tfloat GetMaxSpeed(void);\n\tint iItemSlot(void) { return WPNSLOT_PRIMARY; }\n\tvoid PrimaryAttack(void);\n\tvoid SecondaryAttack(void);\n\tvoid Reload(void);\n\tvoid WeaponIdle(void);\n\n\tBOOL UseDecrement(void)\n\t{\n#ifdef CLIENT_WEAPONS\n\t\treturn TRUE;\n#else\n\t\treturn FALSE;\n#endif\n\t}\n\npublic:\n\tvoid SG552Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim);\n\nprivate:\n\tint m_iShell;\n\tint iShellOn;\n\tunsigned short m_usFireSG552;\n};\n\nclass CSmokeGrenade : public CBasePlayerWeapon\n{\npublic:\n\tvoid Spawn(void);\n\tvoid Precache(void);\n\tint GetItemInfo(ItemInfo *p);\n\tBOOL CanDeploy(void);\n\tBOOL CanDrop(void) { return FALSE; }\n\tBOOL Deploy(void);\n\tvoid Holster(int skiplocal);\n\tfloat GetMaxSpeed(void) { return m_fMaxSpeed; }\n\tint iItemSlot(void) { return WPNSLOT_GRENADE; }\n\tvoid PrimaryAttack(void);\n\tvoid SecondaryAttack(void);\n\tvoid WeaponIdle(void);\n\tvoid SetPlayerShieldAnim(void);\n\tvoid ResetPlayerShieldAnim(void);\n\tbool ShieldSecondaryFire(int up_anim, int down_anim);\n\n\tBOOL UseDecrement(void)\n\t{\n#ifdef CLIENT_WEAPONS\n\t\treturn TRUE;\n#else\n\t\treturn FALSE;\n#endif\n\t}\n\npublic:\n\tunsigned short m_usCreateSmoke;\n};\n\nclass CTMP : public CBasePlayerWeapon\n{\npublic:\n\tvoid Spawn(void);\n\tvoid Precache(void);\n\tint GetItemInfo(ItemInfo *p);\n\tBOOL Deploy(void);\n\tfloat GetMaxSpeed(void) { return 250; }\n\tint iItemSlot(void) { return WPNSLOT_PRIMARY; }\n\tvoid PrimaryAttack(void);\n\tvoid Reload(void);\n\tvoid WeaponIdle(void);\n\n\tBOOL UseDecrement(void)\n\t{\n#ifdef CLIENT_WEAPONS\n\t\treturn TRUE;\n#else\n\t\treturn FALSE;\n#endif\n\t}\n\nprivate:\n\tvoid TMPFire(float flSpread, float flCycleTime, BOOL fUseAutoAim);\n\nprivate:\n\tint m_iShell;\n\tint iShellOn;\n\tunsigned short m_usFireTMP;\n};\n\nclass CUMP45 : public CBasePlayerWeapon\n{\npublic:\n\tvoid Spawn(void);\n\tvoid Precache(void);\n\tint GetItemInfo(ItemInfo *p);\n\tBOOL Deploy(void);\n\tfloat GetMaxSpeed(void) { return 250; }\n\tint iItemSlot(void) { return WPNSLOT_PRIMARY; }\n\tvoid PrimaryAttack(void);\n\tvoid Reload(void);\n\tvoid WeaponIdle(void);\n\n\tBOOL UseDecrement(void)\n\t{\n#ifdef CLIENT_WEAPONS\n\t\treturn TRUE;\n#else\n\t\treturn FALSE;\n#endif\n\t}\n\nprivate:\n\tvoid UMP45Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim);\n\nprivate:\n\tint m_iShell;\n\tint iShellOn;\n\tunsigned short m_usFireUMP45;\n};\n\nclass CUSP : public CBasePlayerWeapon\n{\npublic:\n\tvoid Spawn(void);\n\tvoid Precache(void);\n\tint GetItemInfo(ItemInfo *p);\n\tBOOL Deploy(void);\n\tfloat GetMaxSpeed(void) { return 250; }\n\tint iItemSlot(void) { return WPNSLOT_SECONDARY; }\n\tvoid PrimaryAttack(void);\n\tvoid SecondaryAttack(void);\n\tvoid Reload(void);\n\tvoid WeaponIdle(void);\n\n\tBOOL UseDecrement(void)\n\t{\n#ifdef CLIENT_WEAPONS\n\t\treturn TRUE;\n#else\n\t\treturn FALSE;\n#endif\n\t}\n\nprivate:\n\tvoid USPFire(float flSpread, float flCycleTime, BOOL fUseAutoAim);\n\nprivate:\n\tint m_iShell;\n\tunsigned short m_usFireUSP;\n};\n\nclass CXM1014 : public CBasePlayerWeapon\n{\npublic:\n\tvoid Spawn(void);\n\tvoid Precache(void);\n\tint GetItemInfo(ItemInfo *p);\n\tBOOL Deploy(void);\n\tfloat GetMaxSpeed(void) { return 240; }\n\tint iItemSlot(void) { return WPNSLOT_PRIMARY; }\n\tvoid PrimaryAttack(void);\n\tvoid Reload(void);\n\tvoid WeaponIdle(void);\n\n\tBOOL UseDecrement(void)\n\t{\n#ifdef CLIENT_WEAPONS\n\t\treturn TRUE;\n#else\n\t\treturn FALSE;\n#endif\n\t}\n\nprivate:\n\tint m_iShell;\n\tfloat m_flPumpTime;\n\tunsigned short m_usFireXM1014;\n};\n\n#endif\n\n#define ARMOURY_MP5NAVY 0\n#define ARMOURY_TMP 1\n#define ARMOURY_P90 2\n#define ARMOURY_MAC10 3\n#define ARMOURY_AK47 4\n#define ARMOURY_SG552 5\n#define ARMOURY_M4A1 6\n#define ARMOURY_AUG 7\n#define ARMOURY_SCOUT 8\n#define ARMOURY_G3SG1 9\n#define ARMOURY_AWP 10\n#define ARMOURY_M3 11\n#define ARMOURY_XM1014 12\n#define ARMOURY_M249 13\n#define ARMOURY_FLASHBANG 14\n#define ARMOURY_HEGRENADE 15\n#define ARMOURY_KEVLAR 16\n#define ARMOURY_ASSAULT 17\n#define ARMOURY_SMOKEGRENADE 18\n\nclass CArmoury : public CBaseEntity\n{\npublic:\n\tvoid Spawn(void);\n\tvoid Precache(void);\n\tvoid Restart(void);\n\tvoid KeyValue(KeyValueData *pkvd);\n\npublic:\n\tvoid EXPORT ArmouryTouch(CBaseEntity *pOther);\n\npublic:\n\tint m_iItem;\n\tint m_iCount;\n\tint m_iInitialCount;\n\tbool m_bAlreadyCounted;\n};\n\n#include \"wpn_shared.h\"\n#include \"weapontype.h\"\n\n#endif\n"
  },
  {
    "path": "dlls/weapontype.h",
    "content": "/*\r\n*\r\n*   This program is free software; you can redistribute it and/or modify it\r\n*   under the terms of the GNU General Public License as published by the\r\n*   Free Software Foundation; either version 2 of the License, or (at\r\n*   your option) any later version.\r\n*\r\n*   This program is distributed in the hope that it will be useful, but\r\n*   WITHOUT ANY WARRANTY; without even the implied warranty of\r\n*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\r\n*   General Public License for more details.\r\n*\r\n*   You should have received a copy of the GNU General Public License\r\n*   along with this program; if not, write to the Free Software Foundation,\r\n*   Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r\n*\r\n*   In addition, as a special exception, the author gives permission to\r\n*   link the code of this program with the Half-Life Game Engine (\"HL\r\n*   Engine\") and Modified Game Libraries (\"MODs\") developed by Valve,\r\n*   L.L.C (\"Valve\").  You must obey the GNU General Public License in all\r\n*   respects for all of the code used other than the HL Engine and MODs\r\n*   from Valve.  If you modify this file, you may extend this exception\r\n*   to your version of the file, but you are not obligated to do so.  If\r\n*   you do not wish to do so, delete this exception statement from your\r\n*   version.\r\n*\r\n*/\r\n\r\n#ifndef WEAPONTYPE_H\r\n#define WEAPONTYPE_H\r\n#ifdef _WIN32\r\n#pragma once\r\n#endif\r\n\r\nenum WeaponIdType\r\n{\r\n\tWEAPON_NONE,\r\n\tWEAPON_P228,\r\n\tWEAPON_GLOCK,\r\n\tWEAPON_SCOUT,\r\n\tWEAPON_HEGRENADE,\r\n\tWEAPON_XM1014,\r\n\tWEAPON_C4,\r\n\tWEAPON_MAC10,\r\n\tWEAPON_AUG,\r\n\tWEAPON_SMOKEGRENADE,\r\n\tWEAPON_ELITE,\r\n\tWEAPON_FIVESEVEN,\r\n\tWEAPON_UMP45,\r\n\tWEAPON_SG550,\r\n\tWEAPON_GALIL,\r\n\tWEAPON_FAMAS,\r\n\tWEAPON_USP,\r\n\tWEAPON_GLOCK18,\r\n\tWEAPON_AWP,\r\n\tWEAPON_MP5N,\r\n\tWEAPON_M249,\r\n\tWEAPON_M3,\r\n\tWEAPON_M4A1,\r\n\tWEAPON_TMP,\r\n\tWEAPON_G3SG1,\r\n\tWEAPON_FLASHBANG,\r\n\tWEAPON_DEAGLE,\r\n\tWEAPON_SG552,\r\n\tWEAPON_AK47,\r\n\tWEAPON_KNIFE,\r\n\tWEAPON_P90,\r\n\tWEAPON_SHIELDGUN = 99\r\n};\r\n\r\nenum AutoBuyClassType\r\n{\r\n\tAUTOBUYCLASS_NONE\t\t= 0,\r\n\tAUTOBUYCLASS_PRIMARY\t\t= (1 << 0),\r\n\tAUTOBUYCLASS_SECONDARY\t\t= (1 << 1),\r\n\tAUTOBUYCLASS_AMMO\t\t= (1 << 2),\r\n\tAUTOBUYCLASS_ARMOR\t\t= (1 << 3),\r\n\tAUTOBUYCLASS_DEFUSER\t\t= (1 << 4),\r\n\tAUTOBUYCLASS_PISTOL\t\t= (1 << 5),\r\n\tAUTOBUYCLASS_SMG\t\t= (1 << 6),\r\n\tAUTOBUYCLASS_RIFLE\t\t= (1 << 7),\r\n\tAUTOBUYCLASS_SNIPERRIFLE\t= (1 << 8),\r\n\tAUTOBUYCLASS_SHOTGUN\t\t= (1 << 9),\r\n\tAUTOBUYCLASS_MACHINEGUN\t\t= (1 << 10),\r\n\tAUTOBUYCLASS_GRENADE\t\t= (1 << 11),\r\n\tAUTOBUYCLASS_NIGHTVISION\t= (1 << 12),\r\n\tAUTOBUYCLASS_SHIELD\t\t= (1 << 13),\r\n};\r\n\r\nenum AmmoCostType\r\n{\r\n\tAMMO_338MAG_PRICE\t= 125,\r\n\tAMMO_357SIG_PRICE\t= 50,\r\n\tAMMO_45ACP_PRICE\t= 25,\r\n\tAMMO_50AE_PRICE\t\t= 40,\r\n\tAMMO_556MM_PRICE\t= 60,\r\n\tAMMO_57MM_PRICE\t\t= 50,\r\n\tAMMO_762MM_PRICE\t= 80,\r\n\tAMMO_9MM_PRICE\t\t= 20,\r\n\tAMMO_BUCKSHOT_PRICE\t= 65,\r\n};\r\n\r\nenum WeaponCostType\r\n{\r\n\tAK47_PRICE\t= 2500,\r\n\tAWP_PRICE\t= 4750,\r\n\tDEAGLE_PRICE\t= 650,\r\n\tG3SG1_PRICE\t= 5000,\r\n\tSG550_PRICE\t= 4200,\r\n\tGLOCK18_PRICE\t= 400,\r\n\tM249_PRICE\t= 5750,\r\n\tM3_PRICE\t= 1700,\r\n\tM4A1_PRICE\t= 3100,\r\n\tAUG_PRICE\t= 3500,\r\n\tMP5NAVY_PRICE\t= 1500,\r\n\tP228_PRICE\t= 600,\r\n\tP90_PRICE\t= 2350,\r\n\tUMP45_PRICE\t= 1700,\r\n\tMAC10_PRICE\t= 1400,\r\n\tSCOUT_PRICE\t= 2750,\r\n\tSG552_PRICE\t= 3500,\r\n\tTMP_PRICE\t= 1250,\r\n\tUSP_PRICE\t= 500,\r\n\tELITE_PRICE\t= 800,\r\n\tFIVESEVEN_PRICE\t= 750,\r\n\tXM1014_PRICE\t= 3000,\r\n\tGALIL_PRICE\t= 2000,\r\n\tFAMAS_PRICE\t= 2250,\r\n\tSHIELDGUN_PRICE\t= 2200,\r\n};\r\n\r\nenum WeaponState\r\n{\r\n\tWPNSTATE_USP_SILENCED\t\t= (1 << 0),\r\n\tWPNSTATE_GLOCK18_BURST_MODE\t= (1 << 1),\r\n\tWPNSTATE_M4A1_SILENCED\t\t= (1 << 2),\r\n\tWPNSTATE_ELITE_LEFT\t\t= (1 << 3),\r\n\tWPNSTATE_FAMAS_BURST_MODE\t= (1 << 4),\r\n\tWPNSTATE_SHIELD_DRAWN\t\t= (1 << 5),\r\n};\r\n\r\n// custom enum\r\n// the default amount of ammo that comes with each gun when it spawns\r\nenum ClipGiveDefault\r\n{\r\n\tP228_DEFAULT_GIVE\t\t= 13,\r\n\tGLOCK18_DEFAULT_GIVE\t\t= 20,\r\n\tSCOUT_DEFAULT_GIVE\t\t= 10,\r\n\tHEGRENADE_DEFAULT_GIVE\t\t= 1,\r\n\tXM1014_DEFAULT_GIVE\t\t= 7,\r\n\tC4_DEFAULT_GIVE\t\t\t= 1,\r\n\tMAC10_DEFAULT_GIVE\t\t= 30,\r\n\tAUG_DEFAULT_GIVE\t\t= 30,\r\n\tSMOKEGRENADE_DEFAULT_GIVE\t= 1,\r\n\tELITE_DEFAULT_GIVE\t\t= 30,\r\n\tFIVESEVEN_DEFAULT_GIVE\t\t= 20,\r\n\tUMP45_DEFAULT_GIVE\t\t= 25,\r\n\tSG550_DEFAULT_GIVE\t\t= 30,\r\n\tGALIL_DEFAULT_GIVE\t\t= 35,\r\n\tFAMAS_DEFAULT_GIVE\t\t= 25,\r\n\tUSP_DEFAULT_GIVE\t\t= 12,\r\n\tAWP_DEFAULT_GIVE\t\t= 10,\r\n\tMP5NAVY_DEFAULT_GIVE\t\t= 30,\r\n\tM249_DEFAULT_GIVE\t\t= 100,\r\n\tM3_DEFAULT_GIVE\t\t\t= 8,\r\n\tM4A1_DEFAULT_GIVE\t\t= 30,\r\n\tTMP_DEFAULT_GIVE\t\t= 30,\r\n\tG3SG1_DEFAULT_GIVE\t\t= 20,\r\n\tFLASHBANG_DEFAULT_GIVE\t\t= 1,\r\n\tDEAGLE_DEFAULT_GIVE\t\t= 7,\r\n\tSG552_DEFAULT_GIVE\t\t= 30,\r\n\tAK47_DEFAULT_GIVE\t\t= 30,\r\n\t/*KNIFE_DEFAULT_GIVE\t\t= 1,*/\r\n\tP90_DEFAULT_GIVE\t\t= 50,\r\n};\r\n\r\nenum ClipSizeType\r\n{\r\n\tP228_MAX_CLIP\t\t= 13,\r\n\tGLOCK18_MAX_CLIP\t= 20,\r\n\tSCOUT_MAX_CLIP\t\t= 10,\r\n\tXM1014_MAX_CLIP\t\t= 7,\r\n\tMAC10_MAX_CLIP\t\t= 30,\r\n\tAUG_MAX_CLIP\t\t= 30,\r\n\tELITE_MAX_CLIP\t\t= 30,\r\n\tFIVESEVEN_MAX_CLIP\t= 20,\r\n\tUMP45_MAX_CLIP\t\t= 25,\r\n\tSG550_MAX_CLIP\t\t= 30,\r\n\tGALIL_MAX_CLIP\t\t= 35,\r\n\tFAMAS_MAX_CLIP\t\t= 25,\r\n\tUSP_MAX_CLIP\t\t= 12,\r\n\tAWP_MAX_CLIP\t\t= 10,\r\n\tMP5N_MAX_CLIP\t\t= 30,\r\n\tM249_MAX_CLIP\t\t= 100,\r\n\tM3_MAX_CLIP\t\t= 8,\r\n\tM4A1_MAX_CLIP\t\t= 30,\r\n\tTMP_MAX_CLIP\t\t= 30,\r\n\tG3SG1_MAX_CLIP\t\t= 20,\r\n\tDEAGLE_MAX_CLIP\t\t= 7,\r\n\tSG552_MAX_CLIP\t\t= 30,\r\n\tAK47_MAX_CLIP\t\t= 30,\r\n\tP90_MAX_CLIP\t\t= 50,\r\n};\r\n\r\nenum WeightWeapon\r\n{\r\n\tP228_WEIGHT\t\t= 5,\r\n\tGLOCK18_WEIGHT\t\t= 5,\r\n\tSCOUT_WEIGHT\t\t= 30,\r\n\tHEGRENADE_WEIGHT\t= 2,\r\n\tXM1014_WEIGHT\t\t= 20,\r\n\tC4_WEIGHT\t\t= 3,\r\n\tMAC10_WEIGHT\t\t= 25,\r\n\tAUG_WEIGHT\t\t= 25,\r\n\tSMOKEGRENADE_WEIGHT\t= 1,\r\n\tELITE_WEIGHT\t\t= 5,\r\n\tFIVESEVEN_WEIGHT\t= 5,\r\n\tUMP45_WEIGHT\t\t= 25,\r\n\tSG550_WEIGHT\t\t= 20,\r\n\tGALIL_WEIGHT\t\t= 25,\r\n\tFAMAS_WEIGHT\t\t= 75,\r\n\tUSP_WEIGHT\t\t= 5,\r\n\tAWP_WEIGHT\t\t= 30,\r\n\tMP5NAVY_WEIGHT\t\t= 25,\r\n\tM249_WEIGHT\t\t= 25,\r\n\tM3_WEIGHT\t\t= 20,\r\n\tM4A1_WEIGHT\t\t= 25,\r\n\tTMP_WEIGHT\t\t= 25,\r\n\tG3SG1_WEIGHT\t\t= 20,\r\n\tFLASHBANG_WEIGHT\t= 1,\r\n\tDEAGLE_WEIGHT\t\t= 7,\r\n\tSG552_WEIGHT\t\t= 25,\r\n\tAK47_WEIGHT\t\t= 25,\r\n\tP90_WEIGHT\t\t= 26,\r\n\tKNIFE_WEIGHT\t\t= 0,\r\n};\r\n\r\nenum MaxAmmoType\r\n{\r\n\tMAX_AMMO_BUCKSHOT\t= 32,\r\n\tMAX_AMMO_9MM\t\t= 120,\r\n\tMAX_AMMO_556NATO\t= 90,\r\n\tMAX_AMMO_556NATOBOX\t= 200,\r\n\tMAX_AMMO_762NATO\t= 90,\r\n\tMAX_AMMO_45ACP\t\t= 100,\r\n\tMAX_AMMO_50AE\t\t= 35,\r\n\tMAX_AMMO_338MAGNUM\t= 30,\r\n\tMAX_AMMO_57MM\t\t= 100,\r\n\tMAX_AMMO_357SIG\t\t= 52,\r\n\r\n\t// custom\r\n\tMAX_AMMO_SMOKEGRENADE\t= 1,\r\n\tMAX_AMMO_HEGRENADE\t= 1,\r\n\tMAX_AMMO_FLASHBANG\t= 2,\r\n};\r\n\r\nenum AmmoType\r\n{\r\n\tAMMO_NONE,\r\n\tAMMO_338MAGNUM,\r\n\tAMMO_762NATO,\r\n\tAMMO_556NATOBOX,\r\n\tAMMO_556NATO,\r\n\tAMMO_BUCKSHOT,\r\n\tAMMO_45ACP,\r\n\tAMMO_57MM,\r\n\tAMMO_50AE,\r\n\tAMMO_357SIG,\r\n\tAMMO_9MM,\r\n\tAMMO_FLASHBANG,\r\n\tAMMO_HEGRENADE,\r\n\tAMMO_SMOKEGRENADE,\r\n\tAMMO_C4,\r\n\r\n\tAMMO_MAX_TYPES\r\n};\r\n\r\nenum WeaponClassType\r\n{\r\n\tWEAPONCLASS_NONE,\r\n\tWEAPONCLASS_KNIFE,\r\n\tWEAPONCLASS_PISTOL,\r\n\tWEAPONCLASS_GRENADE,\r\n\tWEAPONCLASS_SUBMACHINEGUN,\r\n\tWEAPONCLASS_SHOTGUN,\r\n\tWEAPONCLASS_MACHINEGUN,\r\n\tWEAPONCLASS_RIFLE,\r\n\tWEAPONCLASS_SNIPERRIFLE,\r\n\tWEAPONCLASS_MAX,\r\n};\r\n\r\nenum AmmoBuyAmount\r\n{\r\n\tAMMO_338MAG_BUY\t\t= 10,\r\n\tAMMO_357SIG_BUY\t\t= 13,\r\n\tAMMO_45ACP_BUY\t\t= 12,\r\n\tAMMO_50AE_BUY\t\t= 7,\r\n\tAMMO_556NATO_BUY\t= 30,\r\n\tAMMO_556NATOBOX_BUY\t= 30,\r\n\tAMMO_57MM_BUY\t\t= 50,\r\n\tAMMO_762NATO_BUY\t= 30,\r\n\tAMMO_9MM_BUY\t\t= 30,\r\n\tAMMO_BUCKSHOT_BUY\t= 8,\r\n};\r\n\r\nenum ItemCostType\r\n{\r\n\tASSAULTSUIT_PRICE\t= 1000,\r\n\tFLASHBANG_PRICE\t\t= 200,\r\n\tHEGRENADE_PRICE\t\t= 300,\r\n\tSMOKEGRENADE_PRICE\t= 300,\r\n\tKEVLAR_PRICE\t\t= 650,\r\n\tHELMET_PRICE\t\t= 350,\r\n\tNVG_PRICE\t\t= 1250,\r\n\tDEFUSEKIT_PRICE\t\t= 200,\r\n};\r\n\r\nenum shieldgun_e\r\n{\r\n\tSHIELDGUN_IDLE,\r\n\tSHIELDGUN_SHOOT1,\r\n\tSHIELDGUN_SHOOT2,\r\n\tSHIELDGUN_SHOOT_EMPTY,\r\n\tSHIELDGUN_RELOAD,\r\n\tSHIELDGUN_DRAW,\r\n\tSHIELDGUN_DRAWN_IDLE,\r\n\tSHIELDGUN_UP,\r\n\tSHIELDGUN_DOWN,\r\n};\r\n\r\n// custom\r\nenum shieldgren_e\r\n{\r\n\tSHIELDREN_IDLE = 4,\r\n\tSHIELDREN_UP,\r\n\tSHIELDREN_DOWN\r\n};\r\n\r\nenum InventorySlotType\r\n{\r\n\tNONE_SLOT,\r\n\tPRIMARY_WEAPON_SLOT,\r\n\tPISTOL_SLOT,\r\n\tKNIFE_SLOT,\r\n\tGRENADE_SLOT,\r\n\tC4_SLOT,\r\n};\r\n \r\nenum Bullet\r\n{\r\n\tBULLET_NONE,\r\n\tBULLET_PLAYER_9MM,\r\n\tBULLET_PLAYER_MP5,\r\n\tBULLET_PLAYER_357,\r\n\tBULLET_PLAYER_BUCKSHOT,\r\n\tBULLET_PLAYER_CROWBAR,\r\n\tBULLET_MONSTER_9MM,\r\n\tBULLET_MONSTER_MP5,\r\n\tBULLET_MONSTER_12MM,\r\n\tBULLET_PLAYER_45ACP,\r\n\tBULLET_PLAYER_338MAG,\r\n\tBULLET_PLAYER_762MM,\r\n\tBULLET_PLAYER_556MM,\r\n\tBULLET_PLAYER_50AE,\r\n\tBULLET_PLAYER_57MM,\r\n\tBULLET_PLAYER_357SIG,\r\n\r\n\t// CSCZDS\r\n\tBULLET_PLAYER_BLOWTORCH\r\n};\r\n\r\nstruct WeaponStruct\r\n{\r\n\tint m_type;\r\n\tint m_price;\r\n\tint m_side;\r\n\tint m_slot;\r\n\tint m_ammoPrice;\r\n};\r\n\r\nstruct AutoBuyInfoStruct\r\n{\r\n\tAutoBuyClassType m_class;\r\n\tchar *m_command;\r\n\tchar *m_classname;\r\n};\r\n\r\nstruct WeaponAliasInfo\r\n{\r\n\tchar *alias;\r\n\tWeaponIdType id;\r\n};\r\n\r\nstruct WeaponBuyAliasInfo\r\n{\r\n\tchar *alias;\r\n\tWeaponIdType id;\r\n\tchar *failName;\r\n};\r\n\r\nstruct WeaponClassAliasInfo\r\n{\r\n\tchar *alias;\r\n\tWeaponClassType id;\r\n};\r\n\r\nstruct WeaponInfoStruct\r\n{\r\n\tint id;\r\n\tint cost;\r\n\tint clipCost;\r\n\tint buyClipSize;\r\n\tint gunClipSize;\r\n\tint maxRounds;\r\n\tAmmoType ammoType;\r\n\tchar *entityName;\r\n\r\n\t// custom\r\n\tconst char *ammoName;\r\n};\r\n\r\nstruct WeaponSlotInfo\r\n{\r\n\tWeaponIdType id;\r\n\tInventorySlotType slot;\r\n\tconst char *weaponName;\r\n};\r\n\r\nextern AutoBuyInfoStruct g_autoBuyInfo[35];\r\nextern WeaponStruct g_weaponStruct[MAX_WEAPONS];\r\n\r\n// WeaponType\r\nWeaponIdType AliasToWeaponID(const char *alias);\r\nconst char *BuyAliasToWeaponID(const char *alias, WeaponIdType &id);\r\nconst char *WeaponIDToAlias(int id);\r\nWeaponClassType AliasToWeaponClass(const char *alias);\r\nWeaponClassType WeaponIDToWeaponClass(int id);\r\nbool IsPrimaryWeapon(int id);\r\nbool IsSecondaryWeapon(int id);\r\nbool CanBuyWeaponByMaptype(int playerTeam, WeaponIdType weaponID, bool useAssasinationRestrictions);\r\nvoid WeaponInfoReset();\r\n\r\nWeaponInfoStruct* GetWeaponInfo(int weaponID);\r\nWeaponInfoStruct* GetWeaponInfo(const char* weaponName);\r\n\r\nWeaponSlotInfo* GetWeaponSlot(WeaponIdType weaponID);\r\nWeaponSlotInfo* GetWeaponSlot(const char* weaponName);\r\n\r\n#endif // WEAPONTYPE_H\r\n"
  },
  {
    "path": "dlls/wpn_shared/wpn_ak47.cpp",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\n*\tThis product contains software technology licensed from Id\n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc.\n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n\n#include \"stdafx.h\"\n#include \"cbase.h\"\n#include \"player.h\"\n#include \"weapons.h\"\n\nLINK_ENTITY_TO_CLASS(weapon_ak47, CAK47)\n\nvoid CAK47::Spawn(void)\n{\n\tpev->classname = MAKE_STRING(\"weapon_ak47\");\n\n\tPrecache();\n\n\tm_iId = WEAPON_AK47;\n\tSET_MODEL(edict(), \"models/w_ak47.mdl\");\n\n\tm_iDefaultAmmo = AK47_DEFAULT_GIVE;\n\tm_flAccuracy = 0.2f;\n\tm_iShotsFired = 0;\n\n\tFallInit();\n}\n\nvoid CAK47::Precache(void)\n{\n\tPRECACHE_MODEL(\"models/v_ak47.mdl\");\n\tPRECACHE_MODEL(\"models/w_ak47.mdl\");\n\n\tPRECACHE_SOUND(\"weapons/ak47-1.wav\");\n\tPRECACHE_SOUND(\"weapons/ak47-2.wav\");\n\tPRECACHE_SOUND(\"weapons/ak47_clipout.wav\");\n\tPRECACHE_SOUND(\"weapons/ak47_clipin.wav\");\n\tPRECACHE_SOUND(\"weapons/ak47_boltpull.wav\");\n\n\tm_iShell = PRECACHE_MODEL(\"models/rshell.mdl\");\n\tm_usFireAK47 = PRECACHE_EVENT(1, \"events/ak47.sc\");\n}\n\nint CAK47::GetItemInfo(ItemInfo *p)\n{\n\tp->pszName = STRING(pev->classname);\n\tp->pszAmmo1 = \"762Nato\";\n\tp->iMaxAmmo1 = MAX_AMMO_762NATO;\n\tp->pszAmmo2 = NULL;\n\tp->iMaxAmmo2 = -1;\n\tp->iMaxClip = AK47_MAX_CLIP;\n\tp->iSlot = 0;\n\tp->iPosition = 1;\n\tp->iId = m_iId = WEAPON_AK47;\n\tp->iFlags = 0;\n\tp->iWeight = AK47_WEIGHT;\n\n\treturn 1;\n}\n\nBOOL CAK47::Deploy(void)\n{\n\tm_flAccuracy = 0.2f;\n\tm_iShotsFired = 0;\n\tiShellOn = 1;\n\n\treturn DefaultDeploy(\"models/v_ak47.mdl\", \"models/p_ak47.mdl\", AK47_DRAW, \"ak47\", UseDecrement() != FALSE);\n}\n\nvoid CAK47::PrimaryAttack(void)\n{\n\tif (!(m_pPlayer->pev->flags & FL_ONGROUND))\n\t{\n\t\tAK47Fire(0.04 + (0.4 * m_flAccuracy), 0.0955, FALSE);\n\t}\n\telse if (m_pPlayer->pev->velocity.Length2D() > 140)\n\t{\n\t\tAK47Fire(0.04 + (0.07 * m_flAccuracy), 0.0955, FALSE);\n\t}\n\telse\n\t{\n\t\tAK47Fire(0.0275 * m_flAccuracy, 0.0955, FALSE);\n\t}\n}\n\nvoid CAK47::AK47Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim)\n{\n\tVector vecAiming, vecSrc, vecDir;\n\tint flag;\n\n\tm_bDelayFire = true;\n\t++m_iShotsFired;\n\n\tm_flAccuracy = ((m_iShotsFired * m_iShotsFired * m_iShotsFired) / 200) + 0.35f;\n\n\tif (m_flAccuracy > 1.25f)\n\t\tm_flAccuracy = 1.25f;\n\n\tif (m_iClip <= 0)\n\t{\n\t\tif (m_fFireOnEmpty)\n\t\t{\n\t\t\tPlayEmptySound();\n\t\t\tm_flNextPrimaryAttack = GetNextAttackDelay(0.2);\n\t\t}\n\n#ifndef CLIENT_DLL\n\t\tif (TheBots != NULL)\n\t\t{\n\t\t\tTheBots->OnEvent(EVENT_WEAPON_FIRED_ON_EMPTY, m_pPlayer);\n\t\t}\n#endif\n\n\t\treturn;\n\t}\n\n\t--m_iClip;\n\tm_pPlayer->pev->effects |= EF_MUZZLEFLASH;\n#ifndef CLIENT_DLL\n\tm_pPlayer->SetAnimation(PLAYER_ATTACK1);\n#endif\n\n\tUTIL_MakeVectors(m_pPlayer->pev->v_angle + m_pPlayer->pev->punchangle);\n\n\tvecSrc = m_pPlayer->GetGunPosition();\n\tvecAiming = gpGlobals->v_forward;\n\n\tvecDir = m_pPlayer->FireBullets3(vecSrc, vecAiming, flSpread, 8192, 2, BULLET_PLAYER_762MM,\n\t\tAK47_DAMAGE, AK47_RANGE_MODIFER, m_pPlayer->pev, false, m_pPlayer->random_seed);\n\n#ifdef CLIENT_WEAPONS\n\tflag = FEV_NOTHOST;\n#else\n\tflag = 0;\n#endif\n\n\tPLAYBACK_EVENT_FULL(flag, m_pPlayer->edict(), m_usFireAK47, 0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y,\n\t\tint(m_pPlayer->pev->punchangle.x * 100), int(m_pPlayer->pev->punchangle.y * 100), FALSE, FALSE);\n\n\tm_pPlayer->m_iWeaponVolume = NORMAL_GUN_VOLUME;\n\tm_pPlayer->m_iWeaponFlash = BRIGHT_GUN_FLASH;\n\n\tm_flNextPrimaryAttack = m_flNextSecondaryAttack = GetNextAttackDelay(flCycleTime);\n\n#ifndef CLIENT_DLL\n\tif (!m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0)\n\t{\n\t\tm_pPlayer->SetSuitUpdate(\"!HEV_AMO0\", FALSE, 0);\n\t}\n#endif\n\n\tm_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.9f;\n\n\tif (m_pPlayer->pev->velocity.Length2D() > 0)\n\t{\n\t\tKickBack(1.5, 0.45, 0.225, 0.05, 6.5, 2.5, 7);\n\t}\n\telse if (!(m_pPlayer->pev->flags & FL_ONGROUND))\n\t{\n\t\tKickBack(2.0, 1.0, 0.5, 0.35, 9.0, 6.0, 5);\n\t}\n\telse if (m_pPlayer->pev->flags & FL_DUCKING)\n\t{\n\t\tKickBack(0.9, 0.35, 0.15, 0.025, 5.5, 1.5, 9);\n\t}\n\telse\n\t{\n\t\tKickBack(1.0, 0.375, 0.175, 0.0375, 5.75, 1.75, 8);\n\t}\n}\n\nvoid CAK47::Reload(void)\n{\n\tif (m_pPlayer->ammo_762nato <= 0)\n\t\treturn;\n\n\tif (DefaultReload(iMaxClip(), AK47_RELOAD, AK47_RELOAD_TIME))\n\t{\n#ifndef CLIENT_DLL\n\t\tm_pPlayer->SetAnimation(PLAYER_RELOAD);\n#endif\n\t\tm_flAccuracy = 0.2f;\n\t\tm_iShotsFired = 0;\n\t\tm_bDelayFire = false;\n\t}\n}\n\nvoid CAK47::WeaponIdle(void)\n{\n\tResetEmptySound();\n\tm_pPlayer->GetAutoaimVector(AUTOAIM_10DEGREES);\n\n\tif (m_flTimeWeaponIdle <= UTIL_WeaponTimeBase())\n\t{\n\t\tm_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 20.0f;\n\t\tSendWeaponAnim(AK47_IDLE1, UseDecrement() != FALSE);\n\t}\n}\n"
  },
  {
    "path": "dlls/wpn_shared/wpn_aug.cpp",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\n*\tThis product contains software technology licensed from Id\n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc.\n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n\n#include \"stdafx.h\"\n#include \"cbase.h\"\n#include \"player.h\"\n#include \"weapons.h\"\n\nLINK_ENTITY_TO_CLASS(weapon_aug, CAUG)\n\nvoid CAUG::Spawn(void)\n{\n\tpev->classname = MAKE_STRING(\"weapon_aug\");\n\n\tPrecache();\n\n\tm_iId = WEAPON_AUG;\n\tSET_MODEL(edict(), \"models/w_aug.mdl\");\n\n\tm_iDefaultAmmo = AUG_DEFAULT_GIVE;\n\tm_flAccuracy = 0.2f;\n\tm_iShotsFired = 0;\n\n\tFallInit();\n}\n\nvoid CAUG::Precache(void)\n{\n\tPRECACHE_MODEL(\"models/v_aug.mdl\");\n\tPRECACHE_MODEL(\"models/w_aug.mdl\");\n\n\tPRECACHE_SOUND(\"weapons/aug-1.wav\");\n\tPRECACHE_SOUND(\"weapons/aug_clipout.wav\");\n\tPRECACHE_SOUND(\"weapons/aug_clipin.wav\");\n\tPRECACHE_SOUND(\"weapons/aug_boltpull.wav\");\n\tPRECACHE_SOUND(\"weapons/aug_boltslap.wav\");\n\tPRECACHE_SOUND(\"weapons/aug_forearm.wav\");\n\n\tm_iShell = PRECACHE_MODEL(\"models/rshell.mdl\");\n\tm_usFireAug = PRECACHE_EVENT(1, \"events/aug.sc\");\n}\n\nint CAUG::GetItemInfo(ItemInfo *p)\n{\n\tp->pszName = STRING(pev->classname);\n\tp->pszAmmo1 = \"556Nato\";\n\tp->iMaxAmmo1 = MAX_AMMO_556NATO;\n\tp->pszAmmo2 = NULL;\n\tp->iMaxAmmo2 = -1;\n\tp->iMaxClip = AUG_MAX_CLIP;\n\tp->iSlot = 0;\n\tp->iPosition = 14;\n\tp->iId = m_iId = WEAPON_AUG;\n\tp->iFlags = 0;\n\tp->iWeight = AUG_WEIGHT;\n\n\treturn 1;\n}\n\nBOOL CAUG::Deploy(void)\n{\n\tm_flAccuracy = 0.2f;\n\tm_iShotsFired = 0;\n\tiShellOn = 1;\n\n\treturn DefaultDeploy(\"models/v_aug.mdl\", \"models/p_aug.mdl\", AUG_DRAW, \"carbine\", UseDecrement() != FALSE);\n}\n\nvoid CAUG::SecondaryAttack(void)\n{\n\tif (m_pPlayer->m_iFOV == DEFAULT_FOV)\n\t\tm_pPlayer->pev->fov = m_pPlayer->m_iFOV = 55;\n\telse\n\t\tm_pPlayer->pev->fov = m_pPlayer->m_iFOV = 90;\n\n\tm_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.3f;\n}\n\nvoid CAUG::PrimaryAttack(void)\n{\n\tif (!(m_pPlayer->pev->flags & FL_ONGROUND))\n\t{\n\t\tAUGFire(0.035 + (0.4 * m_flAccuracy), 0.0825, FALSE);\n\t}\n\telse if (m_pPlayer->pev->velocity.Length2D() > 140)\n\t{\n\t\tAUGFire(0.035 + (0.07 * m_flAccuracy), 0.0825, FALSE);\n\t}\n\telse if (m_pPlayer->pev->fov == DEFAULT_FOV)\n\t{\n\t\tAUGFire(0.02 * m_flAccuracy, 0.0825, FALSE);\n\t}\n\telse\n\t{\n\t\tAUGFire(0.02 * m_flAccuracy, 0.135, FALSE);\n\t}\n}\n\nvoid CAUG::AUGFire(float flSpread, float flCycleTime, BOOL fUseAutoAim)\n{\n\tVector vecAiming, vecSrc, vecDir;\n\tint flag;\n\n\tm_bDelayFire = true;\n\t++m_iShotsFired;\n\n\tm_flAccuracy = ((m_iShotsFired * m_iShotsFired * m_iShotsFired) / 215) + 0.3f;\n\n\tif (m_flAccuracy > 1.0f)\n\t\tm_flAccuracy = 1.0f;\n\n\tif (m_iClip <= 0)\n\t{\n\t\tif (m_fFireOnEmpty)\n\t\t{\n\t\t\tPlayEmptySound();\n\t\t\tm_flNextPrimaryAttack = GetNextAttackDelay(0.2);\n\t\t}\n\n#ifndef CLIENT_DLL\n\t\tif (TheBots != NULL)\n\t\t{\n\t\t\tTheBots->OnEvent(EVENT_WEAPON_FIRED_ON_EMPTY, m_pPlayer);\n\t\t}\n#endif\n\n\t\treturn;\n\t}\n\n\t--m_iClip;\n\tm_pPlayer->pev->effects |= EF_MUZZLEFLASH;\n#ifndef CLIENT_DLL\n\tm_pPlayer->SetAnimation(PLAYER_ATTACK1);\n#endif\n\tm_pPlayer->m_iWeaponVolume = NORMAL_GUN_VOLUME;\n\tm_pPlayer->m_iWeaponFlash = BRIGHT_GUN_FLASH;\n\n\tUTIL_MakeVectors(m_pPlayer->pev->v_angle + m_pPlayer->pev->punchangle);\n\n\tvecSrc = m_pPlayer->GetGunPosition();\n\tvecAiming = gpGlobals->v_forward;\n\n\tvecDir = m_pPlayer->FireBullets3(vecSrc, vecAiming, flSpread, 8192, 2, BULLET_PLAYER_556MM,\n\t\tAUG_DAMAGE, AUG_RANGE_MODIFER, m_pPlayer->pev, false, m_pPlayer->random_seed);\n\n#ifdef CLIENT_WEAPONS\n\tflag = FEV_NOTHOST;\n#else\n\tflag = 0;\n#endif\n\n\tPLAYBACK_EVENT_FULL(flag, m_pPlayer->edict(), m_usFireAug, 0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y,\n\t\tint(m_pPlayer->pev->punchangle.x * 100), int(m_pPlayer->pev->punchangle.y * 100), FALSE, FALSE);\n\n\tm_flNextPrimaryAttack = m_flNextSecondaryAttack = GetNextAttackDelay(flCycleTime);\n\n#ifndef CLIENT_DLL\n\tif (!m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0)\n\t{\n\t\tm_pPlayer->SetSuitUpdate(\"!HEV_AMO0\", FALSE, 0);\n\t}\n#endif\n\n\tm_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.9f;\n\n\tif (m_pPlayer->pev->velocity.Length2D() > 0)\n\t{\n\t\tKickBack(1.0, 0.45, 0.275, 0.05, 4.0, 2.5, 7);\n\t}\n\telse if (!(m_pPlayer->pev->flags & FL_ONGROUND))\n\t{\n\t\tKickBack(1.25, 0.45, 0.22, 0.18, 5.5, 4.0, 5);\n\t}\n\telse if (m_pPlayer->pev->flags & FL_DUCKING)\n\t{\n\t\tKickBack(0.575, 0.325, 0.2, 0.011, 3.25, 2.0, 8);\n\t}\n\telse\n\t{\n\t\tKickBack(0.625, 0.375, 0.25, 0.0125, 3.5, 2.25, 8);\n\t}\n}\n\nvoid CAUG::Reload(void)\n{\n\tif (m_pPlayer->ammo_556nato <= 0)\n\t\treturn;\n\n\tif (DefaultReload(iMaxClip(), AUG_RELOAD, AUG_RELOAD_TIME))\n\t{\n#ifndef CLIENT_DLL\n\t\tm_pPlayer->SetAnimation(PLAYER_RELOAD);\n#endif\n\t\tif (m_pPlayer->m_iFOV != DEFAULT_FOV)\n\t\t{\n\t\t\tSecondaryAttack();\n\t\t}\n\n\t\tm_flAccuracy = 0;\n\t\tm_iShotsFired = 0;\n\t\tm_bDelayFire = false;\n\t}\n}\n\nvoid CAUG::WeaponIdle(void)\n{\n\tResetEmptySound();\n\tm_pPlayer->GetAutoaimVector(AUTOAIM_10DEGREES);\n\n\tif (m_flTimeWeaponIdle > UTIL_WeaponTimeBase())\n\t{\n\t\treturn;\n\t}\n\n\tm_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 20.0f;\n\tSendWeaponAnim(AUG_IDLE1, UseDecrement() != FALSE);\n}\n"
  },
  {
    "path": "dlls/wpn_shared/wpn_awp.cpp",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\n*\tThis product contains software technology licensed from Id\n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc.\n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n\n#include \"stdafx.h\"\n#include \"cbase.h\"\n#include \"player.h\"\n#include \"weapons.h\"\n\nLINK_ENTITY_TO_CLASS(weapon_awp, CAWP)\n\nvoid CAWP::Spawn(void)\n{\n\tpev->classname = MAKE_STRING(\"weapon_awp\");\n\n\tPrecache();\n\n\tm_iId = WEAPON_AWP;\n\tSET_MODEL(ENT(pev), \"models/w_awp.mdl\");\n\n\tm_iDefaultAmmo = AWP_DEFAULT_GIVE;\n\tFallInit();\n}\n\nvoid CAWP::Precache(void)\n{\n\tPRECACHE_MODEL(\"models/v_awp.mdl\");\n\tPRECACHE_MODEL(\"models/w_awp.mdl\");\n\n\tPRECACHE_SOUND(\"weapons/awp1.wav\");\n\tPRECACHE_SOUND(\"weapons/boltpull1.wav\");\n\tPRECACHE_SOUND(\"weapons/boltup.wav\");\n\tPRECACHE_SOUND(\"weapons/boltdown.wav\");\n\tPRECACHE_SOUND(\"weapons/zoom.wav\");\n\tPRECACHE_SOUND(\"weapons/awp_deploy.wav\");\n\tPRECACHE_SOUND(\"weapons/awp_clipin.wav\");\n\tPRECACHE_SOUND(\"weapons/awp_clipout.wav\");\n\n\tm_iShell = PRECACHE_MODEL(\"models/rshell_big.mdl\");\n\tm_iShellId = m_iShell;\n\tm_usFireAWP = PRECACHE_EVENT(1, \"events/awp.sc\");\n}\n\nint CAWP::GetItemInfo(ItemInfo *p)\n{\n\tp->pszName = STRING(pev->classname);\n\tp->pszAmmo1 = \"338Magnum\";\n\tp->iMaxAmmo1 = MAX_AMMO_338MAGNUM;\n\tp->pszAmmo2 = NULL;\n\tp->iMaxAmmo2 = -1;\n\tp->iMaxClip = AWP_MAX_CLIP;\n\tp->iSlot = 0;\n\tp->iPosition = 2;\n\tp->iId = m_iId = WEAPON_AWP;\n\tp->iFlags = 0;\n\tp->iWeight = AWP_WEIGHT;\n\n\treturn 1;\n}\n\nBOOL CAWP::Deploy(void)\n{\n\tif (DefaultDeploy(\"models/v_awp.mdl\", \"models/p_awp.mdl\", AWP_DRAW, \"rifle\", UseDecrement() != FALSE))\n\t{\n\t\tm_pPlayer->m_flNextAttack = GetNextAttackDelay(1.45);\n\t\tm_flNextPrimaryAttack = m_pPlayer->m_flNextAttack;\n\t\tm_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 1.0f;\n\n\t\treturn TRUE;\n\t}\n\n\treturn FALSE;\n}\n\nvoid CAWP::SecondaryAttack(void)\n{\n\tswitch (m_pPlayer->m_iFOV)\n\t{\n\tcase 90: m_pPlayer->m_iFOV = m_pPlayer->pev->fov = 40; break;\n\tcase 40: m_pPlayer->m_iFOV = m_pPlayer->pev->fov = 10; break;\n\tdefault: m_pPlayer->m_iFOV = m_pPlayer->pev->fov = 90; break;\n\t}\n\n#ifndef CLIENT_DLL\n\tif (TheBots != NULL)\n\t{\n\t\tTheBots->OnEvent(EVENT_WEAPON_ZOOMED, m_pPlayer);\n\t}\n#endif\n\n\tm_pPlayer->ResetMaxSpeed();\n\tEMIT_SOUND(m_pPlayer->edict(), CHAN_ITEM, \"weapons/zoom.wav\", 0.2, 2.4);\n\n\tm_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.3;\n}\n\nvoid CAWP::PrimaryAttack(void)\n{\n\tif (!(m_pPlayer->pev->flags & FL_ONGROUND))\n\t{\n\t\tAWPFire(0.85, 1.45, FALSE);\n\t}\n\telse if (m_pPlayer->pev->velocity.Length2D() > 140)\n\t{\n\t\tAWPFire(0.25, 1.45, FALSE);\n\t}\n\telse if (m_pPlayer->pev->velocity.Length2D() > 10)\n\t{\n\t\tAWPFire(0.1, 1.45, FALSE);\n\t}\n\telse if (m_pPlayer->pev->flags & FL_DUCKING)\n\t{\n\t\tAWPFire(0.0, 1.45, FALSE);\n\t}\n\telse\n\t{\n\t\tAWPFire(0.001, 1.45, FALSE);\n\t}\n}\n\nvoid CAWP::AWPFire(float flSpread, float flCycleTime, BOOL fUseAutoAim)\n{\n\tVector vecAiming, vecSrc, vecDir;\n\tint flag;\n\n\tif (m_pPlayer->pev->fov != DEFAULT_FOV)\n\t{\n\t\tm_pPlayer->m_bResumeZoom = true;\n\t\tm_pPlayer->m_iLastZoom = m_pPlayer->m_iFOV;\n\n\t\t// reset a fov\n\t\tm_pPlayer->m_iFOV = DEFAULT_FOV;\n\t\tm_pPlayer->pev->fov = DEFAULT_FOV;\n\t}\n\t// If we are not zoomed in, the bullet diverts more.\n\telse\n\t{\n\t\tflSpread += 0.08f;\n\t}\n\n\tif (m_iClip <= 0)\n\t{\n\t\tif (m_fFireOnEmpty)\n\t\t{\n\t\t\tPlayEmptySound();\n\t\t\tm_flNextPrimaryAttack = GetNextAttackDelay(0.2);\n\t\t}\n\n#ifndef CLIENT_DLL\n\t\tif (TheBots != NULL)\n\t\t{\n\t\t\tTheBots->OnEvent(EVENT_WEAPON_FIRED_ON_EMPTY, m_pPlayer);\n\t\t}\n#endif\n\n\t\treturn;\n\t}\n\n\t--m_iClip;\n\tm_pPlayer->pev->effects |= EF_MUZZLEFLASH;\n#ifndef CLIENT_DLL\n\tm_pPlayer->SetAnimation(PLAYER_ATTACK1);\n#endif\n\tUTIL_MakeVectors(m_pPlayer->pev->v_angle + m_pPlayer->pev->punchangle);\n\n\tm_pPlayer->m_flEjectBrass = gpGlobals->time + 0.55f;\n\tm_pPlayer->m_iWeaponVolume = BIG_EXPLOSION_VOLUME;\n\tm_pPlayer->m_iWeaponFlash = NORMAL_GUN_FLASH;\n\n\tvecSrc = m_pPlayer->GetGunPosition();\n\tvecAiming = gpGlobals->v_forward;\n\n\tvecDir = m_pPlayer->FireBullets3(vecSrc, vecAiming, flSpread, 8192, 3, BULLET_PLAYER_338MAG, AWP_DAMAGE, AWP_RANGE_MODIFER, m_pPlayer->pev, true, m_pPlayer->random_seed);\n\n#ifdef CLIENT_WEAPONS\n\tflag = FEV_NOTHOST;\n#else\n\tflag = 0;\n#endif\n\n\tPLAYBACK_EVENT_FULL(flag, m_pPlayer->edict(), m_usFireAWP, 0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y,\n\t\tint(m_pPlayer->pev->punchangle.x * 100), int(m_pPlayer->pev->punchangle.x * 100), FALSE, FALSE);\n\n\tm_flNextPrimaryAttack = m_flNextSecondaryAttack = GetNextAttackDelay(flCycleTime);\n\n#ifndef CLIENT_DLL\n\tif (!m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0)\n\t{\n\t\tm_pPlayer->SetSuitUpdate(\"!HEV_AMO0\", FALSE, 0);\n\t}\n#endif\n\n\tm_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 2.0f;\n\tm_pPlayer->pev->punchangle.x -= 2.0f;\n}\n\nvoid CAWP::Reload(void)\n{\n\tif (m_pPlayer->ammo_338mag <= 0)\n\t\treturn;\n\n\tif (DefaultReload(iMaxClip(), AWP_RELOAD, AWP_RELOAD_TIME))\n\t{\n#ifndef CLIENT_DLL\n\t\tm_pPlayer->SetAnimation(PLAYER_RELOAD);\n#endif\n\t\tif (m_pPlayer->pev->fov != DEFAULT_FOV)\n\t\t{\n\t\t\tm_pPlayer->m_iFOV = 10;\n\t\t\tm_pPlayer->pev->fov = 10;\n\n\t\t\tSecondaryAttack();\n\t\t}\n\t}\n}\n\nvoid CAWP::WeaponIdle(void)\n{\n\tResetEmptySound();\n\tm_pPlayer->GetAutoaimVector(AUTOAIM_10DEGREES);\n\n\tif (m_flTimeWeaponIdle <= UTIL_WeaponTimeBase() && m_iClip)\n\t{\n\t\tm_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 60.0f;\n\t\tSendWeaponAnim(AWP_IDLE, UseDecrement() != FALSE);\n\t}\n}\n\nfloat CAWP::GetMaxSpeed(void)\n{\n\tif (m_pPlayer->m_iFOV == DEFAULT_FOV)\n\t\treturn AWP_MAX_SPEED;\n\n\t// Slower speed when zoomed in.\n\treturn AWP_MAX_SPEED_ZOOM;\n}\n"
  },
  {
    "path": "dlls/wpn_shared/wpn_c4.cpp",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\n*\tThis product contains software technology licensed from Id\n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc.\n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n\n#include \"stdafx.h\"\n#include \"cbase.h\"\n#include \"player.h\"\n#include \"weapons.h\"\n#include \"hltv.h\"\n#include \"gamerules.h\"\n\n//#define C4MADNESS\n#ifdef CLIENT_WEAPONS\nextern bool g_bInBombZone;\n#endif\n\nLINK_ENTITY_TO_CLASS(weapon_c4, CC4)\n\nvoid CC4::Spawn(void)\n{\n\tSET_MODEL(ENT(pev), \"models/w_backpack.mdl\");\n\n\tpev->frame = 0;\n\tpev->body = 3;\n\tpev->sequence = 0;\n\tpev->framerate = 0;\n\n\tm_iId = WEAPON_C4;\n\tm_iDefaultAmmo = C4_DEFAULT_GIVE;\n\tm_bStartedArming = false;\n\tm_fArmedTime = 0;\n\n\tif (!FStringNull(pev->targetname))\n\t{\n\t\tpev->effects |= EF_NODRAW;\n\t\tDROP_TO_FLOOR(edict());\n\t\treturn;\n\t}\n\n\tFallInit();\n\tSetThink(&CBasePlayerItem::FallThink);\n\tpev->nextthink = UTIL_WeaponTimeBase() + 0.1f;\n}\n\nvoid CC4::Precache(void)\n{\n\tPRECACHE_MODEL(\"models/v_c4.mdl\");\n\tPRECACHE_MODEL(\"models/w_backpack.mdl\");\n\n\tPRECACHE_SOUND(\"weapons/c4_click.wav\");\n}\n\nint CC4::GetItemInfo(ItemInfo *p)\n{\n\tp->pszName = STRING(pev->classname);\n\tp->pszAmmo1 = \"C4\";\n\tp->iMaxAmmo1 = C4_MAX_AMMO;\n\tp->pszAmmo2 = NULL;\n\tp->iMaxAmmo2 = -1;\n\tp->iMaxClip = WEAPON_NOCLIP;\n\tp->iSlot = 4;\n\tp->iPosition = 3;\n\tp->iId = m_iId = WEAPON_C4;\n\tp->iWeight = C4_WEIGHT;\n\tp->iFlags = ITEM_FLAG_LIMITINWORLD | ITEM_FLAG_EXHAUSTIBLE;\n\n\treturn 1;\n}\n\nBOOL CC4::Deploy(void)\n{\n\tpev->body = 0;\n\n\tm_bStartedArming = false;\n\tm_fArmedTime = 0;\n\n\tif (m_pPlayer->HasShield())\n\t{\n\t\tm_bHasShield = true;\n\t\tm_pPlayer->pev->gamestate = 1;\n\t}\n\n\treturn DefaultDeploy(\"models/v_c4.mdl\", \"models/p_c4.mdl\", C4_DRAW, \"c4\", UseDecrement() != FALSE);\n}\n\nvoid CC4::Holster(int skiplocal)\n{\n\tm_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5f;\n\tm_bStartedArming = false;\t// stop arming sequence\n\n\tif (!m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType])\n\t{\n\t\tm_pPlayer->pev->weapons &= ~(1 << WEAPON_C4);\n\t\tDestroyItem();\n\t}\n\n\tif (m_bHasShield)\n\t{\n\t\tm_pPlayer->pev->gamestate = 0;\n\t\tm_bHasShield = false;\n\t}\n}\n\nvoid CC4::PrimaryAttack(void)\n{\n\tif (m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0)\n\t\treturn;\n\n\tint inBombZone = (m_pPlayer->m_signals.GetState() & SIGNAL_BOMB) == SIGNAL_BOMB;\n\tint onGround = (m_pPlayer->pev->flags & FL_ONGROUND) == FL_ONGROUND;\n\tbool bPlaceBomb = (onGround && inBombZone);\n\n\tif (!m_bStartedArming)\n\t{\n\t\tif (!inBombZone)\n\t\t{\n\t\t\tClientPrint(m_pPlayer->pev, HUD_PRINTCENTER, \"#C4_Plant_At_Bomb_Spot\");\n\t\t\tm_flNextPrimaryAttack = GetNextAttackDelay(1.0);\n\t\t\treturn;\n\t\t}\n\n\t\tif (!onGround)\n\t\t{\n\t\t\tClientPrint(m_pPlayer->pev, HUD_PRINTCENTER, \"#C4_Plant_Must_Be_On_Ground\");\n\t\t\tm_flNextPrimaryAttack = GetNextAttackDelay(1.0);\n\t\t\treturn;\n\t\t}\n\n\t\tm_bStartedArming = true;\n\t\tm_bBombPlacedAnimation = false;\n\t\tm_fArmedTime = gpGlobals->time + C4_ARMING_ON_TIME;\n\n\t\t// player \"arming bomb\" animation\n\t\tSendWeaponAnim(C4_ARM, UseDecrement() != FALSE);\n\n#ifndef CLIENT_DLL\n\t\t// freeze the player in place while planting\n\t\tSET_CLIENT_MAXSPEED(m_pPlayer->edict(), 1.0);\n\t\tm_pPlayer->SetAnimation(PLAYER_ATTACK1);\n\t\tm_pPlayer->SetProgressBarTime(C4_ARMING_ON_TIME);\n#endif\n\t}\n\telse\n\t{\n\t\tif (bPlaceBomb)\n\t\t{\n#ifndef CLIENT_DLL\n\t\t\tCBaseEntity *pEntity = NULL;\n\t\t\tCBasePlayer *pTempPlayer = NULL;\n#endif\n\n\t\t\tif (m_fArmedTime <= gpGlobals->time)\n\t\t\t{\n\t\t\t\tif (m_bStartedArming)\n\t\t\t\t{\n\t\t\t\t\tm_bStartedArming = false;\n\t\t\t\t\tm_fArmedTime = 0;\n\n\t\t\t\t\tBroadcast(\"BOMBPL\");\n\t\t\t\t\tm_pPlayer->m_bHasC4 = false;\n\n#ifndef CLIENT_DLL\n\t\t\t\t\tif (pev->speed != 0 && CSGameRules())\n\t\t\t\t\t{\n\t\t\t\t\t\tCSGameRules()->m_iC4Timer = int(pev->speed);\n\t\t\t\t\t}\n#endif\n\n#ifndef CLIENT_DLL\n\t\t\t\t\tCGrenade *pBomb = CGrenade::ShootSatchelCharge(m_pPlayer->pev, m_pPlayer->pev->origin, Vector(0, 0, 0));\n\n\t\t\t\t\tMESSAGE_BEGIN(MSG_SPEC, SVC_DIRECTOR);\n\t\t\t\t\t\tWRITE_BYTE(9);\n\t\t\t\t\t\tWRITE_BYTE(DRC_CMD_EVENT);\n\t\t\t\t\t\tWRITE_SHORT(m_pPlayer->entindex());\n\t\t\t\t\t\tWRITE_SHORT(0);\n\t\t\t\t\t\tWRITE_LONG(DRC_FLAG_FACEPLAYER | 11);\n\t\t\t\t\tMESSAGE_END();\n\n\t\t\t\t\tMESSAGE_BEGIN(MSG_ALL, gmsgBombDrop);\n\t\t\t\t\t\tWRITE_COORD(pBomb->pev->origin.x);\n\t\t\t\t\t\tWRITE_COORD(pBomb->pev->origin.y);\n\t\t\t\t\t\tWRITE_COORD(pBomb->pev->origin.z);\n\t\t\t\t\t\tWRITE_BYTE(BOMB_FLAG_PLANTED);\n\t\t\t\t\tMESSAGE_END();\n\n\t\t\t\t\tUTIL_ClientPrintAll(HUD_PRINTCENTER, \"#Bomb_Planted\");\n\n\t\t\t\t\tif (TheBots)\n\t\t\t\t\t{\n\t\t\t\t\t\tTheBots->OnEvent(EVENT_BOMB_PLANTED, m_pPlayer, pBomb);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (TheCareerTasks && CSGameRules()->IsCareer() && !m_pPlayer->IsBot())\n\t\t\t\t\t{\n\t\t\t\t\t\tTheCareerTasks->HandleEvent(EVENT_BOMB_PLANTED, m_pPlayer);\n\t\t\t\t\t}\n\t\t\t\t\tUTIL_LogPrintf(\"\\\"%s<%i><%s><TERRORIST>\\\" triggered \\\"Planted_The_Bomb\\\"\\n\",\n\t\t\t\t\t\tSTRING(m_pPlayer->pev->netname),\n\t\t\t\t\t\tGETPLAYERUSERID(m_pPlayer->edict()),\n\t\t\t\t\t\tGETPLAYERAUTHID(m_pPlayer->edict()));\n\n\n\t\t\t\t\tg_pGameRules->m_bBombDropped = FALSE;\n#endif\n\n\t\t\t\t\t// Play the plant sound.\n\t\t\t\t\tEMIT_SOUND(edict(), CHAN_WEAPON, \"weapons/c4_plant.wav\", VOL_NORM, ATTN_NORM);\n\n\t\t\t\t\t// hide the backpack in Terrorist's models.\n\t\t\t\t\tm_pPlayer->pev->body = 0;\n\n\t\t\t\t\t// release the player from being frozen\n\t\t\t\t\tm_pPlayer->ResetMaxSpeed();\n\n#ifndef CLIENT_DLL\n\t\t\t\t\t// No more c4!\n\t\t\t\t\tm_pPlayer->SetBombIcon(FALSE);\n#endif\n\t\t\t\t\tif (--m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0)\n\t\t\t\t\t{\n\t\t\t\t\t\tRetireWeapon();\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif (m_fArmedTime - 0.75f <= gpGlobals->time && !m_bBombPlacedAnimation)\n\t\t\t\t{\n\t\t\t\t\t// call the c4 Placement animation\n\t\t\t\t\tm_bBombPlacedAnimation = true;\n\t\t\t\t\tSendWeaponAnim(C4_DROP, UseDecrement() != FALSE);\n\n#ifndef CLIENT_DLL\n\t\t\t\t\t// player \"place\" animation\n\t\t\t\t\tm_pPlayer->SetAnimation(PLAYER_HOLDBOMB);\n#endif\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif (inBombZone)\n\t\t\t\tClientPrint(m_pPlayer->pev, HUD_PRINTCENTER, \"#C4_Plant_Must_Be_On_Ground\");\n\t\t\telse\n\t\t\t\tClientPrint(m_pPlayer->pev, HUD_PRINTCENTER, \"#C4_Arming_Cancelled\");\n\n\t\t\tm_bStartedArming = false;\n\t\t\tm_flNextPrimaryAttack = GetNextAttackDelay(1.5);\n\n\t\t\t// release the player from being frozen, we've somehow left the bomb zone\n\t\t\tm_pPlayer->ResetMaxSpeed();\n#ifndef CLIENT_DLL\n\t\t\tm_pPlayer->SetProgressBarTime(0);\n\t\t\tm_pPlayer->SetAnimation(PLAYER_HOLDBOMB);\n#endif\n\t\t\t// this means the placement animation is canceled\n\t\t\tif (m_bBombPlacedAnimation)\n\t\t\t\tSendWeaponAnim(C4_DRAW, UseDecrement() != FALSE);\n\t\t\telse\n\t\t\t\tSendWeaponAnim(C4_IDLE1, UseDecrement() != FALSE);\n\n\t\t\treturn;\n\t\t}\n\t}\n\n\tm_flNextPrimaryAttack = GetNextAttackDelay(0.3);\n\tm_flTimeWeaponIdle = UTIL_WeaponTimeBase() + RANDOM_FLOAT(10, 15);\n}\n\nvoid CC4::WeaponIdle(void)\n{\n\tif (m_bStartedArming)\n\t{\n\t\t// if the player releases the attack button cancel the arming sequence\n\t\tm_bStartedArming = false;\n\n\t\t// release the player from being frozen\n\t\tm_pPlayer->ResetMaxSpeed();\n\n\t\tm_flNextPrimaryAttack = GetNextAttackDelay(1.0);\n#ifndef CLIENT_DLL\n\t\tm_pPlayer->SetProgressBarTime(0);\n#endif\n\t\t// this means the placement animation is canceled\n\t\tif (m_bBombPlacedAnimation)\n\t\t\tSendWeaponAnim(C4_DRAW, UseDecrement() != FALSE);\n\t\telse\n\t\t\tSendWeaponAnim(C4_IDLE1, UseDecrement() != FALSE);\n\t}\n\n\tif (m_flTimeWeaponIdle <= UTIL_WeaponTimeBase())\n\t{\n\t\tif (m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0)\n\t\t{\n\t\t\tRetireWeapon();\n\t\t\treturn;\n\t\t}\n\n\t\tSendWeaponAnim(C4_DRAW, UseDecrement() != FALSE);\n\t\tSendWeaponAnim(C4_IDLE1, UseDecrement() != FALSE);\n\t}\n}\n\nvoid CC4::KeyValue(KeyValueData *pkvd)\n{\n\tif (FStrEq(pkvd->szKeyName, \"detonatedelay\"))\n\t{\n\t\tpev->speed = atof(pkvd->szValue);\n\t\tpkvd->fHandled = TRUE;\n\t}\n\telse if (FStrEq(pkvd->szKeyName, \"detonatetarget\"))\n\t{\n\t\tpev->noise1 = ALLOC_STRING(pkvd->szValue);\n\t\tpkvd->fHandled = TRUE;\n\t}\n\telse if (FStrEq(pkvd->szKeyName, \"defusetarget\"))\n\t{\n\t\tpev->target = ALLOC_STRING(pkvd->szValue);\n\t\tpkvd->fHandled = TRUE;\n\t}\n\telse\n\t{\n\t\tCBaseEntity::KeyValue(pkvd);\n\t}\n}\n\nvoid CC4::Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value)\n{\n\tif (m_pPlayer)\n\t\treturn;\n\n\tCBasePlayer *pPlayer = UTIL_PlayerByIndex(1);\n\tif (pPlayer)\n\t{\n\t\tedict_t *m_pentOldCurBombTarget = pPlayer->m_pentCurBombTarget;\n\t\tpPlayer->m_pentCurBombTarget = NULL;\n\n#ifndef CLIENT_DLL\n\t\tif (pev->speed != 0 && CSGameRules())\n\t\t{\n\t\t\tCSGameRules()->m_iC4Timer = int(pev->speed);\n\t\t}\n#endif\n\n\t\tEMIT_SOUND(edict(), CHAN_WEAPON, \"weapons/c4_plant.wav\", VOL_NORM, ATTN_NORM);\n\n\t\tCGrenade::ShootSatchelCharge(m_pPlayer->pev, m_pPlayer->pev->origin, Vector(0, 0, 0));\n\n\t\tCGrenade *pC4 = NULL;\n\t\twhile ((pC4 = (CGrenade *)UTIL_FindEntityByClassname(pC4, \"grenade\")))\n\t\t{\n\t\t\tif (pC4->m_bIsC4 && pC4->m_flNextFreq == gpGlobals->time)\n\t\t\t{\n\t\t\t\tpC4->pev->target = pev->target;\n\t\t\t\tpC4->pev->noise1 = pev->noise1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tpPlayer->m_pentCurBombTarget = m_pentOldCurBombTarget;\n\t\tSUB_Remove();\n\t}\n}\n"
  },
  {
    "path": "dlls/wpn_shared/wpn_deagle.cpp",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\n*\tThis product contains software technology licensed from Id\n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc.\n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n\n#include \"stdafx.h\"\n#include \"cbase.h\"\n#include \"player.h\"\n#include \"weapons.h\"\n\nLINK_ENTITY_TO_CLASS(weapon_deagle, CDEAGLE)\n\nvoid CDEAGLE::Spawn(void)\n{\n\tpev->classname = MAKE_STRING(\"weapon_deagle\");\n\n\tPrecache();\n\n\tm_iId = WEAPON_DEAGLE;\n\tSET_MODEL(edict(), \"models/w_deagle.mdl\");\n\n\tm_iDefaultAmmo = DEAGLE_DEFAULT_GIVE;\n\tm_iWeaponState &= ~WPNSTATE_SHIELD_DRAWN;\n\tm_fMaxSpeed = DEAGLE_MAX_SPEED;\n\tm_flAccuracy = 0.9f;\n\n\tFallInit();\n}\n\nvoid CDEAGLE::Precache(void)\n{\n\tPRECACHE_MODEL(\"models/v_deagle.mdl\");\n\tPRECACHE_MODEL(\"models/shield/v_shield_deagle.mdl\");\n\tPRECACHE_MODEL(\"models/w_deagle.mdl\");\n\n\tPRECACHE_SOUND(\"weapons/deagle-1.wav\");\n\tPRECACHE_SOUND(\"weapons/deagle-2.wav\");\n\tPRECACHE_SOUND(\"weapons/de_clipout.wav\");\n\tPRECACHE_SOUND(\"weapons/de_clipin.wav\");\n\tPRECACHE_SOUND(\"weapons/de_deploy.wav\");\n\n\tm_iShell = PRECACHE_MODEL(\"models/pshell.mdl\");\n\tm_usFireDeagle = PRECACHE_EVENT(1, \"events/deagle.sc\");\n}\n\nint CDEAGLE::GetItemInfo(ItemInfo *p)\n{\n\tp->pszName = STRING(pev->classname);\n\tp->pszAmmo1 = \"50AE\";\n\tp->iMaxAmmo1 = MAX_AMMO_50AE;\n\tp->pszAmmo2 = NULL;\n\tp->iMaxAmmo2 = -1;\n\tp->iMaxClip = DEAGLE_MAX_CLIP;\n\tp->iSlot = 1;\n\tp->iPosition = 1;\n\tp->iId = m_iId = WEAPON_DEAGLE;\n\tp->iFlags = 0;\n\tp->iWeight = DEAGLE_WEIGHT;\n\n\treturn 1;\n}\n\nBOOL CDEAGLE::Deploy(void)\n{\n\tm_flAccuracy = 0.9f;\n\tm_fMaxSpeed = DEAGLE_MAX_SPEED;\n\tm_iWeaponState &= ~WPNSTATE_SHIELD_DRAWN;\n\tm_pPlayer->m_bShieldDrawn = false;\n\n\tif (m_pPlayer->HasShield())\n\t\treturn DefaultDeploy(\"models/shield/v_shield_deagle.mdl\", \"models/shield/p_shield_deagle.mdl\", DEAGLE_DRAW, \"shieldgun\", UseDecrement() != FALSE);\n\telse\n\t\treturn DefaultDeploy(\"models/v_deagle.mdl\", \"models/p_deagle.mdl\", DEAGLE_DRAW, \"onehanded\", UseDecrement() != FALSE);\n}\n\nvoid CDEAGLE::PrimaryAttack(void)\n{\n\tif (!(m_pPlayer->pev->flags & FL_ONGROUND))\n\t{\n\t\tDEAGLEFire(1.5 * (1 - m_flAccuracy), 0.3, FALSE);\n\t}\n\telse if (m_pPlayer->pev->velocity.Length2D() > 0)\n\t{\n\t\tDEAGLEFire(0.25 * (1 - m_flAccuracy), 0.3, FALSE);\n\t}\n\telse if (m_pPlayer->pev->flags & FL_DUCKING)\n\t{\n\t\tDEAGLEFire(0.115 * (1 - m_flAccuracy), 0.3, FALSE);\n\t}\n\telse\n\t{\n\t\tDEAGLEFire(0.13 * (1 - m_flAccuracy), 0.3, FALSE);\n\t}\n}\n\nvoid CDEAGLE::SecondaryAttack(void)\n{\n\tShieldSecondaryFire(SHIELDGUN_UP, SHIELDGUN_DOWN);\n}\n\nvoid CDEAGLE::DEAGLEFire(float flSpread, float flCycleTime, BOOL fUseAutoAim)\n{\n\tVector vecAiming, vecSrc, vecDir;\n\tint flag;\n\n\tflCycleTime -= 0.075f;\n\n\tif (++m_iShotsFired > 1)\n\t{\n\t\treturn;\n\t}\n\n\tif (m_flLastFire != 0.0)\n\t{\n\t\tm_flAccuracy -= (0.4f - (gpGlobals->time - m_flLastFire)) * 0.35f;\n\n\t\tif (m_flAccuracy > 0.9f)\n\t\t{\n\t\t\tm_flAccuracy = 0.9f;\n\t\t}\n\t\telse if (m_flAccuracy < 0.55f)\n\t\t{\n\t\t\tm_flAccuracy = 0.55f;\n\t\t}\n\t}\n\n\tm_flLastFire = gpGlobals->time;\n\n\tif (m_iClip <= 0)\n\t{\n\t\tif (m_fFireOnEmpty)\n\t\t{\n\t\t\tPlayEmptySound();\n\t\t\tm_flNextPrimaryAttack = GetNextAttackDelay(0.2);\n\t\t}\n\n#ifndef CLIENT_DLL\n\t\tif (TheBots != NULL)\n\t\t{\n\t\t\tTheBots->OnEvent(EVENT_WEAPON_FIRED_ON_EMPTY, m_pPlayer);\n\t\t}\n#endif\n\n\t\treturn;\n\t}\n\n\t--m_iClip;\n\tm_pPlayer->pev->effects |= EF_MUZZLEFLASH;\n\tSetPlayerShieldAnim();\n\n#ifndef CLIENT_DLL\n\tm_pPlayer->SetAnimation(PLAYER_ATTACK1);\n#endif\n\tUTIL_MakeVectors(m_pPlayer->pev->v_angle + m_pPlayer->pev->punchangle);\n\n\tm_pPlayer->m_iWeaponVolume = BIG_EXPLOSION_VOLUME;\n\tm_pPlayer->m_iWeaponFlash = NORMAL_GUN_FLASH;\n\n\tvecSrc = m_pPlayer->GetGunPosition();\n\tvecAiming = gpGlobals->v_forward;\n\n\tvecDir = m_pPlayer->FireBullets3(vecSrc, vecAiming, flSpread, 4096, 2, BULLET_PLAYER_50AE, DEAGLE_DAMAGE, DEAGLE_RANGE_MODIFER, m_pPlayer->pev, true, m_pPlayer->random_seed);\n\n#ifdef CLIENT_WEAPONS\n\tflag = FEV_NOTHOST;\n#else\n\tflag = 0;\n#endif\n\n\tPLAYBACK_EVENT_FULL(flag, m_pPlayer->edict(), m_usFireDeagle, 0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y,\n\t\tint(m_pPlayer->pev->punchangle.x * 100), int(m_pPlayer->pev->punchangle.y * 100), m_iClip == 0, FALSE);\n\n\tm_flNextPrimaryAttack = m_flNextSecondaryAttack = GetNextAttackDelay(flCycleTime);\n\n#ifndef CLIENT_DLL\n\tif (!m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0)\n\t{\n\t\tm_pPlayer->SetSuitUpdate(\"!HEV_AMO0\", FALSE, FALSE);\n\t}\n#endif\n\n\tm_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.8f;\n\tm_pPlayer->pev->punchangle.x -= 2;\n\tResetPlayerShieldAnim();\n}\n\nvoid CDEAGLE::Reload(void)\n{\n\tif (m_pPlayer->ammo_50ae <= 0)\n\t\treturn;\n\n\tif (DefaultReload(iMaxClip(), DEAGLE_RELOAD, DEAGLE_RELOAD_TIME))\n\t{\n#ifndef CLIENT_DLL\n\t\tm_pPlayer->SetAnimation(PLAYER_RELOAD);\n#endif\n\t\tm_flAccuracy = 0.9f;\n\t}\n}\n\nvoid CDEAGLE::WeaponIdle(void)\n{\n\tResetEmptySound();\n\tm_pPlayer->GetAutoaimVector(AUTOAIM_10DEGREES);\n\n\tif (m_flTimeWeaponIdle <= UTIL_WeaponTimeBase())\n\t{\n\t\tm_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 20.0f;\n\n\t\tif (m_iWeaponState & WPNSTATE_SHIELD_DRAWN)\n\t\t{\n\t\t\tSendWeaponAnim(SHIELDGUN_DRAWN_IDLE, UseDecrement() != FALSE);\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "dlls/wpn_shared/wpn_elite.cpp",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\n*\tThis product contains software technology licensed from Id\n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc.\n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n\n#include \"stdafx.h\"\n#include \"cbase.h\"\n#include \"player.h\"\n#include \"weapons.h\"\n\nLINK_ENTITY_TO_CLASS(weapon_elite, CELITE)\n\nvoid CELITE::Spawn(void)\n{\n\tpev->classname = MAKE_STRING(\"weapon_elite\");\n\n\tPrecache();\n\n\tm_iId = WEAPON_ELITE;\n\tSET_MODEL(edict(), \"models/w_elite.mdl\");\n\n\tm_iDefaultAmmo = ELITE_DEFAULT_GIVE;\n\tm_flAccuracy = 0.88f;\n\n\tFallInit();\n}\n\nvoid CELITE::Precache(void)\n{\n\tPRECACHE_MODEL(\"models/v_elite.mdl\");\n\tPRECACHE_MODEL(\"models/w_elite.mdl\");\n\n\tPRECACHE_SOUND(\"weapons/elite_fire.wav\");\n\tPRECACHE_SOUND(\"weapons/elite_reloadstart.wav\");\n\tPRECACHE_SOUND(\"weapons/elite_leftclipin.wav\");\n\tPRECACHE_SOUND(\"weapons/elite_clipout.wav\");\n\tPRECACHE_SOUND(\"weapons/elite_sliderelease.wav\");\n\tPRECACHE_SOUND(\"weapons/elite_rightclipin.wav\");\n\tPRECACHE_SOUND(\"weapons/elite_deploy.wav\");\n\n\tm_iShell = PRECACHE_MODEL(\"models/pshell.mdl\");\n\n\tm_usFireELITE_LEFT = PRECACHE_EVENT(1, \"events/elite_left.sc\");\n\tm_usFireELITE_RIGHT = PRECACHE_EVENT(1, \"events/elite_right.sc\");\n}\n\nint CELITE::GetItemInfo(ItemInfo *p)\n{\n\tp->pszName = STRING(pev->classname);\n\tp->pszAmmo1 = \"9mm\";\n\tp->iMaxAmmo1 = MAX_AMMO_9MM;\n\tp->pszAmmo2 = NULL;\n\tp->iMaxAmmo2 = -1;\n\tp->iMaxClip = ELITE_MAX_CLIP;\n\tp->iSlot = 1;\n\tp->iPosition = 5;\n\tp->iId = m_iId = WEAPON_ELITE;\n\tp->iFlags = 0;\n\tp->iWeight = ELITE_WEIGHT;\n\n\treturn 1;\n}\n\nBOOL CELITE::Deploy(void)\n{\n\tm_flAccuracy = 0.88f;\n\n\tif (!(m_iClip & 1))\n\t{\n\t\tm_iWeaponState |= WPNSTATE_ELITE_LEFT;\n\t}\n\n\treturn DefaultDeploy(\"models/v_elite.mdl\", \"models/p_elite.mdl\", ELITE_DRAW, \"dualpistols\", UseDecrement() != FALSE);\n}\n\nvoid CELITE::PrimaryAttack(void)\n{\n\tif (!(m_pPlayer->pev->flags & FL_ONGROUND))\n\t{\n\t\tELITEFire(1.3 * (1 - m_flAccuracy), 0.2, FALSE);\n\t}\n\telse if (m_pPlayer->pev->velocity.Length2D() > 0)\n\t{\n\t\tELITEFire(0.175 * (1 - m_flAccuracy), 0.2, FALSE);\n\t}\n\telse if (m_pPlayer->pev->flags & FL_DUCKING)\n\t{\n\t\tELITEFire(0.08 * (1 - m_flAccuracy), 0.2, FALSE);\n\t}\n\telse\n\t{\n\t\tELITEFire(0.1 * (1 - m_flAccuracy), 0.2, FALSE);\n\t}\n}\n\nvoid CELITE::ELITEFire(float flSpread, float flCycleTime, BOOL fUseAutoAim)\n{\n\tfloat flTimeDiff;\n\tint flag;\n\tVector vecAiming;\n\tVector vecSrc;\n\tVector vecDir;\n\n#ifdef REGAMEDLL_FIXES\n\tflCycleTime -= 0.078f;\n#else\n\tflCycleTime -= 0.125f;\n#endif\n\n\tif (++m_iShotsFired > 1)\n\t{\n\t\treturn;\n\t}\n\n\tflTimeDiff = gpGlobals->time - m_flLastFire;\n\n\tif (m_flLastFire)\n\t{\n\t\tm_flAccuracy -= (0.325f - flTimeDiff) * 0.275f;\n\n\t\tif (m_flAccuracy > 0.88f)\n\t\t{\n\t\t\tm_flAccuracy = 0.88f;\n\t\t}\n\t\telse if (m_flAccuracy < 0.55f)\n\t\t{\n\t\t\tm_flAccuracy = 0.55f;\n\t\t}\n\t}\n\n\tm_flLastFire = gpGlobals->time;\n\n\tif (m_iClip <= 0)\n\t{\n\t\tif (m_fFireOnEmpty)\n\t\t{\n\t\t\tPlayEmptySound();\n\t\t\tm_flNextPrimaryAttack = GetNextAttackDelay(0.2);\n\t\t}\n\n#ifndef CLIENT_DLL\n\t\tif (TheBots != NULL)\n\t\t{\n\t\t\tTheBots->OnEvent(EVENT_WEAPON_FIRED_ON_EMPTY, m_pPlayer);\n\t\t}\n#endif\n\n\t\treturn;\n\t}\n\n\tm_flNextPrimaryAttack = m_flNextSecondaryAttack = GetNextAttackDelay(flCycleTime);\n\n\t--m_iClip;\n\tm_pPlayer->m_iWeaponVolume = BIG_EXPLOSION_VOLUME;\n\tm_pPlayer->m_iWeaponFlash = DIM_GUN_FLASH;\n\n\tUTIL_MakeVectors(m_pPlayer->pev->v_angle + m_pPlayer->pev->punchangle);\n\n\tm_pPlayer->pev->effects |= EF_MUZZLEFLASH;\n\n\tvecSrc = m_pPlayer->GetGunPosition();\n\tvecAiming = gpGlobals->v_forward;\n\n#ifdef CLIENT_WEAPONS\n\tflag = FEV_NOTHOST;\n#else\n\tflag = 0;\n#endif\n\n\tif (m_iWeaponState & WPNSTATE_ELITE_LEFT)\n\t{\n#ifndef CLIENT_DLL\n\t\tm_pPlayer->SetAnimation(PLAYER_ATTACK1);\n#endif\n\t\tm_iWeaponState &= ~WPNSTATE_ELITE_LEFT;\n\n\t\tvecDir = m_pPlayer->FireBullets3(vecSrc - gpGlobals->v_right * 5, vecAiming, flSpread,\n\t\t\t8192, BULLET_PLAYER_9MM, 1, ELITE_DAMAGE, ELITE_RANGE_MODIFER, m_pPlayer->pev, true, m_pPlayer->random_seed);\n\n\t\tPLAYBACK_EVENT_FULL(flag, m_pPlayer->edict(), m_usFireELITE_LEFT, 0, (float *)&g_vecZero, (float *)&g_vecZero, flTimeDiff, vecDir.x,\n\t\t\tint(vecDir.y * 100), m_iClip, FALSE, FALSE);\n\t}\n\telse\n\t{\n#ifndef CLIENT_DLL\n\t\tm_pPlayer->SetAnimation(PLAYER_ATTACK2);\n#endif\n\t\tm_iWeaponState |= WPNSTATE_ELITE_LEFT;\n\n\t\tvecDir = m_pPlayer->FireBullets3(vecSrc + gpGlobals->v_right * 5, vecAiming, flSpread,\n\t\t\t8192, BULLET_PLAYER_9MM, 1, ELITE_DAMAGE, ELITE_RANGE_MODIFER, m_pPlayer->pev, true, m_pPlayer->random_seed);\n\n\t\tPLAYBACK_EVENT_FULL(flag, m_pPlayer->edict(), m_usFireELITE_RIGHT, 0, (float *)&g_vecZero, (float *)&g_vecZero, flTimeDiff, vecDir.x,\n\t\t\tint(vecDir.y * 100), m_iClip, FALSE, FALSE);\n\t}\n\n#ifndef CLIENT_DLL\n\tif (!m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0)\n\t{\n\t\tm_pPlayer->SetSuitUpdate(\"!HEV_AMO0\", FALSE, 0);\n\t}\n#endif\n\n\tm_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 2.0f;\n\tm_pPlayer->pev->punchangle.x -= 2.0f;\n}\n\nvoid CELITE::Reload(void)\n{\n\tif (m_pPlayer->ammo_9mm <= 0)\n\t\treturn;\n\n\tif (DefaultReload(iMaxClip(), ELITE_RELOAD, ELITE_RELOAD_TIME))\n\t{\n#ifndef CLIENT_DLL\n\t\tm_pPlayer->SetAnimation(PLAYER_RELOAD);\n#endif\n\t\tm_flAccuracy = 0.88f;\n\t}\n}\n\nvoid CELITE::WeaponIdle(void)\n{\n\tResetEmptySound();\n\tm_pPlayer->GetAutoaimVector(AUTOAIM_10DEGREES);\n\n\tif (m_flTimeWeaponIdle <= UTIL_WeaponTimeBase())\n\t{\n\t\tif (m_iClip)\n\t\t{\n\t\t\tint iAnim = (m_iClip == 1) ? ELITE_IDLE_LEFTEMPTY : ELITE_IDLE;\n\t\t\tm_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 60.0f;\n\t\t\tSendWeaponAnim(iAnim, UseDecrement() != FALSE);\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "dlls/wpn_shared/wpn_famas.cpp",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\n*\tThis product contains software technology licensed from Id\n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc.\n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n\n#include \"stdafx.h\"\n#include \"cbase.h\"\n#include \"player.h\"\n#include \"weapons.h\"\n\nLINK_ENTITY_TO_CLASS(weapon_famas, CFamas)\n\nvoid CFamas::Spawn(void)\n{\n\tpev->classname = MAKE_STRING(\"weapon_famas\");\n\n\tPrecache();\n\n\tm_iId = WEAPON_FAMAS;\n\tSET_MODEL(ENT(pev), \"models/w_famas.mdl\");\n\n\tm_iDefaultAmmo = FAMAS_DEFAULT_GIVE;\n\tm_iFamasShotsFired = 0;\n\tm_flFamasShoot = 0;\n\n\tFallInit();\n}\n\nvoid CFamas::Precache(void)\n{\n\tPRECACHE_MODEL(\"models/v_famas.mdl\");\n\tPRECACHE_MODEL(\"models/w_famas.mdl\");\n\n\tPRECACHE_SOUND(\"weapons/famas-1.wav\");\n\tPRECACHE_SOUND(\"weapons/famas-2.wav\");\n\tPRECACHE_SOUND(\"weapons/famas_clipout.wav\");\n\tPRECACHE_SOUND(\"weapons/famas_clipin.wav\");\n\tPRECACHE_SOUND(\"weapons/famas_boltpull.wav\");\n\tPRECACHE_SOUND(\"weapons/famas_boltslap.wav\");\n\tPRECACHE_SOUND(\"weapons/famas_forearm.wav\");\n\tPRECACHE_SOUND(\"weapons/famas-burst.wav\");\n\n\tm_iShell = PRECACHE_MODEL(\"models/rshell.mdl\");\n\tm_usFireFamas = PRECACHE_EVENT(1, \"events/famas.sc\");\n}\n\nint CFamas::GetItemInfo(ItemInfo *p)\n{\n\tp->pszName = STRING(pev->classname);\n\tp->pszAmmo1 = \"556Nato\";\n\tp->iMaxAmmo1 = MAX_AMMO_556NATO;\n\tp->pszAmmo2 = NULL;\n\tp->iMaxAmmo2 = -1;\n\tp->iMaxClip = FAMAS_MAX_CLIP;\n\tp->iSlot = 0;\n\tp->iPosition = 18;\n\tp->iId = m_iId = WEAPON_FAMAS;\n\tp->iFlags = 0;\n\tp->iWeight = FAMAS_WEIGHT;\n\n\treturn 1;\n}\n\nBOOL CFamas::Deploy(void)\n{\n\tm_iShotsFired = 0;\n\tm_iFamasShotsFired = 0;\n\tm_flFamasShoot = 0;\n\tm_flAccuracy = 0.2f;\n\n\tiShellOn = 1;\n\n\treturn DefaultDeploy(\"models/v_famas.mdl\", \"models/p_famas.mdl\", FAMAS_DRAW, \"carbine\", UseDecrement() != FALSE);\n}\n\nvoid CFamas::SecondaryAttack(void)\n{\n\tif (m_iWeaponState & WPNSTATE_FAMAS_BURST_MODE)\n\t{\n\t\tClientPrint(m_pPlayer->pev, HUD_PRINTCENTER, \"#Switch_To_FullAuto\");\n\t\tm_iWeaponState &= ~WPNSTATE_FAMAS_BURST_MODE;\n\t}\n\telse\n\t{\n\t\tClientPrint(m_pPlayer->pev, HUD_PRINTCENTER, \"#Switch_To_BurstFire\");\n\t\tm_iWeaponState |= WPNSTATE_FAMAS_BURST_MODE;\n\t}\n\n\tm_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.3f;\n}\n\nvoid CFamas::PrimaryAttack(void)\n{\n\tif (m_pPlayer->pev->waterlevel == 3)\n\t{\n\t\tPlayEmptySound();\n\t\tm_flNextPrimaryAttack = GetNextAttackDelay(0.15);\n\t\treturn;\n\t}\n\n\tbool bFireBurst = (m_iWeaponState & WPNSTATE_FAMAS_BURST_MODE) == WPNSTATE_FAMAS_BURST_MODE;\n\n\tif (!(m_pPlayer->pev->flags & FL_ONGROUND))\n\t{\n\t\tFamasFire(0.030 + 0.3 * m_flAccuracy, 0.0825, FALSE, bFireBurst);\n\t}\n\telse if (m_pPlayer->pev->velocity.Length2D() > 140)\n\t{\n\t\tFamasFire(0.030 + 0.07 * m_flAccuracy, 0.0825, FALSE, bFireBurst);\n\t}\n\telse\n\t{\n\t\tFamasFire(0.02 * m_flAccuracy, 0.0825, FALSE, bFireBurst);\n\t}\n}\n\nvoid CFamas::FamasFire(float flSpread, float flCycleTime, BOOL fUseAutoAim, BOOL bFireBurst)\n{\n\tVector vecAiming, vecSrc, vecDir;\n\tint flag;\n\n\tif (bFireBurst)\n\t{\n\t\tm_iFamasShotsFired = 0;\n\t\tflCycleTime = 0.55f;\n\t}\n\telse\n\t{\n\t\tflSpread += 0.01f;\n\t}\n\n\tm_bDelayFire = true;\n\t++m_iShotsFired;\n\n\tm_flAccuracy = (m_iShotsFired * m_iShotsFired * m_iShotsFired / 215) + 0.3f;\n\n\tif (m_flAccuracy > 1.0f)\n\t\tm_flAccuracy = 1.0f;\n\n\tif (m_iClip <= 0)\n\t{\n\t\tif (m_fFireOnEmpty)\n\t\t{\n\t\t\tPlayEmptySound();\n\t\t\tm_flNextPrimaryAttack = GetNextAttackDelay(0.2);\n\t\t}\n\n#ifndef CLIENT_DLL\n\t\tif (TheBots != NULL)\n\t\t{\n\t\t\tTheBots->OnEvent(EVENT_WEAPON_FIRED_ON_EMPTY, m_pPlayer);\n\t\t}\n#endif\n\n\t\treturn;\n\t}\n\n\t--m_iClip;\n\tm_pPlayer->pev->effects |= EF_MUZZLEFLASH;\n#ifndef CLIENT_DLL\n\tm_pPlayer->SetAnimation(PLAYER_ATTACK1);\n#endif\n\n\tUTIL_MakeVectors(m_pPlayer->pev->v_angle + m_pPlayer->pev->punchangle);\n\n\tm_pPlayer->m_iWeaponVolume = NORMAL_GUN_VOLUME;\n\tm_pPlayer->m_iWeaponFlash = BRIGHT_GUN_FLASH;\n\n\tvecSrc = m_pPlayer->GetGunPosition();\n\tvecAiming = gpGlobals->v_forward;\n\n\tvecDir = m_pPlayer->FireBullets3(vecSrc, vecAiming, flSpread, 8192, 2, BULLET_PLAYER_556MM,\n\t\tbFireBurst ? FAMAS_DAMAGE_BURST : FAMAS_DAMAGE, FAMAS_RANGE_MODIFER, m_pPlayer->pev, false, m_pPlayer->random_seed);\n\n#ifdef CLIENT_WEAPONS\n\tflag = FEV_NOTHOST;\n#else\n\tflag = 0;\n#endif\n\n\tPLAYBACK_EVENT_FULL(flag, m_pPlayer->edict(), m_usFireFamas, 0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y,\n\t\tint(m_pPlayer->pev->punchangle.x * 10000000), int(m_pPlayer->pev->punchangle.y * 10000000), FALSE, FALSE);\n\n\tm_flNextPrimaryAttack = m_flNextSecondaryAttack = GetNextAttackDelay(flCycleTime);\n\n#ifndef CLIENT_DLL\n\tif (!m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0)\n\t{\n\t\tm_pPlayer->SetSuitUpdate(\"!HEV_AMO0\", FALSE, 0);\n\t}\n#endif\n\n\tm_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.1f;\n\n\tif (m_pPlayer->pev->velocity.Length2D() > 0)\n\t{\n\t\tKickBack(1.0, 0.45, 0.275, 0.05, 4.0, 2.5, 7);\n\t}\n\telse if (!(m_pPlayer->pev->flags & FL_ONGROUND))\n\t{\n\t\tKickBack(1.25, 0.45, 0.22, 0.18, 5.5, 4.0, 5);\n\t}\n\telse if (m_pPlayer->pev->flags & FL_DUCKING)\n\t{\n\t\tKickBack(0.575, 0.325, 0.2, 0.011, 3.25, 2.0, 8);\n\t}\n\telse\n\t{\n\t\tKickBack(0.625, 0.375, 0.25, 0.0125, 3.5, 2.25, 8);\n\t}\n\n\tif (bFireBurst)\n\t{\n\t\t++m_iFamasShotsFired;\n\t\tm_fBurstSpread = flSpread;\n\t\tm_flFamasShoot = gpGlobals->time + 0.05f;\n\t}\n}\n\nvoid CFamas::Reload(void)\n{\n\tif (m_pPlayer->ammo_556nato <= 0)\n\t\treturn;\n\n\tif (DefaultReload(iMaxClip(), FAMAS_RELOAD, FAMAS_RELOAD_TIME))\n\t{\n#ifndef CLIENT_DLL\n\t\tm_pPlayer->SetAnimation(PLAYER_RELOAD);\n#endif\n\t\tif (m_pPlayer->m_iFOV != DEFAULT_FOV)\n\t\t{\n\t\t\tSecondaryAttack();\n\t\t}\n\n\t\tm_flAccuracy = 0;\n\t\tm_iShotsFired = 0;\n\t\tm_bDelayFire = false;\n\t}\n}\n\nvoid CFamas::WeaponIdle(void)\n{\n\tResetEmptySound();\n\tm_pPlayer->GetAutoaimVector(AUTOAIM_10DEGREES);\n\n\tif (m_flTimeWeaponIdle <= UTIL_WeaponTimeBase())\n\t{\n\t\tm_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 20.0f;\n\t\tSendWeaponAnim(FAMAS_IDLE1, UseDecrement() != FALSE);\n\t}\n}\n"
  },
  {
    "path": "dlls/wpn_shared/wpn_fiveseven.cpp",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\n*\tThis product contains software technology licensed from Id\n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc.\n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n\n#include \"stdafx.h\"\n#include \"cbase.h\"\n#include \"player.h\"\n#include \"weapons.h\"\n\nLINK_ENTITY_TO_CLASS(weapon_fiveseven, CFiveSeven)\n\nvoid CFiveSeven::Spawn(void)\n{\n\tpev->classname = MAKE_STRING(\"weapon_fiveseven\");\n\n\tPrecache();\n\n\tm_iId = WEAPON_FIVESEVEN;\n\tSET_MODEL(edict(), \"models/w_fiveseven.mdl\");\n\n\tm_iDefaultAmmo = FIVESEVEN_DEFAULT_GIVE;\n\tm_iWeaponState &= ~WPNSTATE_SHIELD_DRAWN;\n\tm_flAccuracy = 0.92f;\n\n\tFallInit();\n}\n\nvoid CFiveSeven::Precache(void)\n{\n\tPRECACHE_MODEL(\"models/v_fiveseven.mdl\");\n\tPRECACHE_MODEL(\"models/w_fiveseven.mdl\");\n\tPRECACHE_MODEL(\"models/shield/v_shield_fiveseven.mdl\");\n\n\tPRECACHE_SOUND(\"weapons/fiveseven-1.wav\");\n\tPRECACHE_SOUND(\"weapons/fiveseven_clipout.wav\");\n\tPRECACHE_SOUND(\"weapons/fiveseven_clipin.wav\");\n\tPRECACHE_SOUND(\"weapons/fiveseven_sliderelease.wav\");\n\tPRECACHE_SOUND(\"weapons/fiveseven_slidepull.wav\");\n\n\tm_iShell = PRECACHE_MODEL(\"models/pshell.mdl\");\n\tm_usFireFiveSeven = PRECACHE_EVENT(1, \"events/fiveseven.sc\");\n}\n\nint CFiveSeven::GetItemInfo(ItemInfo *p)\n{\n\tp->pszName = STRING(pev->classname);\n\tp->pszAmmo1 = \"57mm\";\n\tp->iMaxAmmo1 = MAX_AMMO_57MM;\n\tp->pszAmmo2 = NULL;\n\tp->iMaxAmmo2 = -1;\n\tp->iMaxClip = FIVESEVEN_MAX_CLIP;\n\tp->iSlot = 1;\n\tp->iPosition = 6;\n\tp->iId = m_iId = WEAPON_FIVESEVEN;\n\tp->iFlags = 0;\n\tp->iWeight = FIVESEVEN_WEIGHT;\n\n\treturn 1;\n}\n\nBOOL CFiveSeven::Deploy(void)\n{\n\tm_flAccuracy = 0.92f;\n\tm_fMaxSpeed = FIVESEVEN_MAX_SPEED;\n\tm_iWeaponState &= ~WPNSTATE_SHIELD_DRAWN;\n\tm_pPlayer->m_bShieldDrawn = false;\n\n\tif (m_pPlayer->HasShield())\n\t\treturn DefaultDeploy(\"models/shield/v_shield_fiveseven.mdl\", \"models/shield/p_shield_fiveseven.mdl\", FIVESEVEN_DRAW, \"shieldgun\", UseDecrement() != FALSE);\n\telse\n\t\treturn DefaultDeploy(\"models/v_fiveseven.mdl\", \"models/p_fiveseven.mdl\", FIVESEVEN_DRAW, \"onehanded\", UseDecrement() != FALSE);\n}\n\nvoid CFiveSeven::PrimaryAttack(void)\n{\n\tif (!(m_pPlayer->pev->flags & FL_ONGROUND))\n\t{\n\t\tFiveSevenFire(1.5 * (1 - m_flAccuracy), 0.2, FALSE);\n\t}\n\telse if (m_pPlayer->pev->velocity.Length2D() > 0)\n\t{\n\t\tFiveSevenFire(0.255 * (1 - m_flAccuracy), 0.2, FALSE);\n\t}\n\telse if (m_pPlayer->pev->flags & FL_DUCKING)\n\t{\n\t\tFiveSevenFire(0.075 * (1 - m_flAccuracy), 0.2, FALSE);\n\t}\n\telse\n\t{\n\t\tFiveSevenFire(0.15 * (1 - m_flAccuracy), 0.2, FALSE);\n\t}\n}\n\nvoid CFiveSeven::SecondaryAttack(void)\n{\n\tShieldSecondaryFire(SHIELDGUN_UP, SHIELDGUN_DOWN);\n}\n\nvoid CFiveSeven::FiveSevenFire(float flSpread, float flCycleTime, BOOL fUseAutoAim)\n{\n\tVector vecAiming, vecSrc, vecDir;\n\tint flag;\n\n\tflCycleTime -= 0.05;\n\n\tif (++m_iShotsFired > 1)\n\t{\n\t\treturn;\n\t}\n\n\tif (m_flLastFire != 0.0f)\n\t{\n\t\tm_flAccuracy -= (0.275f - (gpGlobals->time - m_flLastFire)) * 0.25f;\n\n\t\tif (m_flAccuracy > 0.92f)\n\t\t{\n\t\t\tm_flAccuracy = 0.92f;\n\t\t}\n\t\telse if (m_flAccuracy < 0.725f)\n\t\t{\n\t\t\tm_flAccuracy = 0.725f;\n\t\t}\n\t}\n\n\tm_flLastFire = gpGlobals->time;\n\n\tif (m_iClip <= 0)\n\t{\n\t\tif (m_fFireOnEmpty)\n\t\t{\n\t\t\tPlayEmptySound();\n\t\t\tm_flNextPrimaryAttack = GetNextAttackDelay(0.2);\n\t\t}\n\n#ifndef CLIENT_DLL\n\t\tif (TheBots != NULL)\n\t\t{\n\t\t\tTheBots->OnEvent(EVENT_WEAPON_FIRED_ON_EMPTY, m_pPlayer);\n\t\t}\n#endif\n\n\t\treturn;\n\t}\n\n\t--m_iClip;\n\tm_pPlayer->pev->effects |= EF_MUZZLEFLASH;\n\tSetPlayerShieldAnim();\n\n#ifndef CLIENT_DLL\n\tm_pPlayer->SetAnimation(PLAYER_ATTACK1);\n#endif\n\tUTIL_MakeVectors(m_pPlayer->pev->v_angle + m_pPlayer->pev->punchangle);\n\n\tm_pPlayer->m_iWeaponVolume = BIG_EXPLOSION_VOLUME;\n\tm_pPlayer->m_iWeaponFlash = DIM_GUN_FLASH;\n\n\tvecSrc = m_pPlayer->GetGunPosition();\n\tvecAiming = gpGlobals->v_forward;\n\n\tvecDir = m_pPlayer->FireBullets3(vecSrc, vecAiming, flSpread, 4096, 1, BULLET_PLAYER_57MM, FIVESEVEN_DAMAGE, FIVESEVEN_RANGE_MODIFER, m_pPlayer->pev, false, m_pPlayer->random_seed);\n\n#ifdef CLIENT_WEAPONS\n\tflag = FEV_NOTHOST;\n#else\n\tflag = 0;\n#endif\n\n\tPLAYBACK_EVENT_FULL(flag, m_pPlayer->edict(), m_usFireFiveSeven, 0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y,\n\t\tint(m_pPlayer->pev->punchangle.x * 100), int(m_pPlayer->pev->punchangle.y * 100), m_iClip == 0, FALSE);\n\n\tm_flNextPrimaryAttack = m_flNextSecondaryAttack = GetNextAttackDelay(flCycleTime);\n\n#ifndef CLIENT_DLL\n\tif (!m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0)\n\t{\n\t\tm_pPlayer->SetSuitUpdate(\"!HEV_AMO0\", FALSE, FALSE);\n\t}\n#endif\n\n\tm_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 2.0f;\n\tm_pPlayer->pev->punchangle.x -= 2.0f;\n\tResetPlayerShieldAnim();\n}\n\nvoid CFiveSeven::Reload(void)\n{\n\tif (m_pPlayer->ammo_57mm <= 0)\n\t\treturn;\n\n\tif (DefaultReload(iMaxClip(), FIVESEVEN_RELOAD, FIVESEVEN_RELOAD_TIME))\n\t{\n#ifndef CLIENT_DLL\n\t\tm_pPlayer->SetAnimation(PLAYER_RELOAD);\n#endif\n\t\tm_flAccuracy = 0.92f;\n\t}\n}\n\nvoid CFiveSeven::WeaponIdle(void)\n{\n\tResetEmptySound();\n\tm_pPlayer->GetAutoaimVector(AUTOAIM_10DEGREES);\n\n\tif (m_flTimeWeaponIdle > UTIL_WeaponTimeBase())\n\t{\n\t\treturn;\n\t}\n\n\tif (m_pPlayer->HasShield())\n\t{\n\t\tm_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 20.0f;\n\n\t\tif (m_iWeaponState & WPNSTATE_SHIELD_DRAWN)\n\t\t{\n\t\t\tSendWeaponAnim(SHIELDGUN_DRAWN_IDLE, UseDecrement() != FALSE);\n\t\t}\n\t}\n\telse if (m_iClip)\n\t{\n\t\tm_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 3.0625f;\n\t\tSendWeaponAnim(FIVESEVEN_IDLE, UseDecrement() != FALSE);\n\t}\n}\n"
  },
  {
    "path": "dlls/wpn_shared/wpn_flashbang.cpp",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\n*\tThis product contains software technology licensed from Id\n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc.\n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n\n#include \"stdafx.h\"\n#include \"cbase.h\"\n#include \"player.h\"\n#include \"weapons.h\"\n\nLINK_ENTITY_TO_CLASS(weapon_flashbang, CFlashbang)\n\nvoid CFlashbang::Spawn(void)\n{\n\tpev->classname = MAKE_STRING(\"weapon_flashbang\");\n\n\tPrecache();\n\n\tm_iId = WEAPON_FLASHBANG;\n\tSET_MODEL(edict(), \"models/w_flashbang.mdl\");\n\n\tpev->dmg = 4;\n\n\tm_iDefaultAmmo = FLASHBANG_DEFAULT_GIVE;\n\tm_flStartThrow = 0;\n\tm_flReleaseThrow = -1.0f;\n\tm_iWeaponState &= ~WPNSTATE_SHIELD_DRAWN;\n\n\t// get ready to fall down.\n\tFallInit();\n}\n\nvoid CFlashbang::Precache(void)\n{\n\tPRECACHE_MODEL(\"models/v_flashbang.mdl\");\n\tPRECACHE_MODEL(\"models/shield/v_shield_flashbang.mdl\");\n\n\tPRECACHE_SOUND(\"weapons/flashbang-1.wav\");\n\tPRECACHE_SOUND(\"weapons/flashbang-2.wav\");\n\tPRECACHE_SOUND(\"weapons/pinpull.wav\");\n}\n\nint CFlashbang::GetItemInfo(ItemInfo *p)\n{\n\tp->pszName = STRING(pev->classname);\n\tp->pszAmmo1 = \"Flashbang\";\n\n\tp->iMaxAmmo1 = MAX_AMMO_FLASHBANG;\n\tp->iMaxClip = WEAPON_NOCLIP;\n\n\tp->pszAmmo2 = NULL;\n\tp->iMaxAmmo2 = -1;\n\tp->iSlot = 3;\n\tp->iPosition = 2;\n\tp->iId = m_iId = WEAPON_FLASHBANG;\n\tp->iWeight = FLASHBANG_WEIGHT;\n\tp->iFlags = ITEM_FLAG_LIMITINWORLD | ITEM_FLAG_EXHAUSTIBLE;\n\n\treturn 1;\n}\n\nBOOL CFlashbang::Deploy(void)\n{\n\tm_flReleaseThrow = -1.0f;\n\tm_fMaxSpeed = FLASHBANG_MAX_SPEED;\n\n\tm_iWeaponState &= ~WPNSTATE_SHIELD_DRAWN;\n\tm_pPlayer->m_bShieldDrawn = false;\n\n\tif (m_pPlayer->HasShield())\n\t\treturn DefaultDeploy(\"models/shield/v_shield_flashbang.mdl\", \"models/shield/p_shield_flashbang.mdl\", FLASHBANG_DRAW, \"shieldgren\", UseDecrement() != FALSE);\n\telse\n\t\treturn DefaultDeploy(\"models/v_flashbang.mdl\", \"models/p_flashbang.mdl\", FLASHBANG_DRAW, \"grenade\", UseDecrement() != FALSE);\n}\n\nvoid CFlashbang::Holster(int skiplocal)\n{\n\tm_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5f;\n\n\tif (!m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType])\n\t{\n\t\tm_pPlayer->pev->weapons &= ~(1 << WEAPON_FLASHBANG);\n\t\tDestroyItem();\n\t}\n\n\tm_flStartThrow = 0;\n\tm_flReleaseThrow = -1.0f;\n}\n\nvoid CFlashbang::PrimaryAttack(void)\n{\n\tif (m_iWeaponState & WPNSTATE_SHIELD_DRAWN)\n\t{\n\t\treturn;\n\t}\n\n\tif (!m_flStartThrow && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] > 0)\n\t{\n\t\tm_flReleaseThrow = 0;\n\t\tm_flStartThrow = gpGlobals->time;\n\n\t\tSendWeaponAnim(FLASHBANG_PULLPIN, UseDecrement() != FALSE);\n\t\tm_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.5f;\n\t}}\n\nvoid CFlashbang::SetPlayerShieldAnim(void)\n{\n\tif (!m_pPlayer->HasShield())\n\t\treturn;\n\n\tif (m_iWeaponState & WPNSTATE_SHIELD_DRAWN)\n\t\tstrcpy(m_pPlayer->m_szAnimExtention, \"shield\");\n\telse\n\t\tstrcpy(m_pPlayer->m_szAnimExtention, \"shieldgren\");\n}\n\nvoid CFlashbang::ResetPlayerShieldAnim(void)\n{\n\tif (!m_pPlayer->HasShield())\n\t\treturn;\n\n\tif (m_iWeaponState & WPNSTATE_SHIELD_DRAWN)\n\t{\n\t\tstrcpy(m_pPlayer->m_szAnimExtention, \"shieldgren\");\n\t}\n}\n\nbool CFlashbang::ShieldSecondaryFire(int iUpAnim, int iDownAnim)\n{\n\tif (!m_pPlayer->HasShield() || m_flStartThrow > 0)\n\t{\n\t\treturn false;\n\t}\n\n\tif (m_iWeaponState & WPNSTATE_SHIELD_DRAWN)\n\t{\n\t\tm_iWeaponState &= ~WPNSTATE_SHIELD_DRAWN;\n\t\tSendWeaponAnim(iDownAnim, UseDecrement() != FALSE);\n\n\t\tstrcpy(m_pPlayer->m_szAnimExtention, \"shieldgren\");\n\n\t\tm_fMaxSpeed = FLASHBANG_MAX_SPEED;\n\t\tm_pPlayer->m_bShieldDrawn = false;\n\t}\n\telse\n\t{\n\t\tm_iWeaponState |= WPNSTATE_SHIELD_DRAWN;\n\t\tSendWeaponAnim(iUpAnim, UseDecrement() != FALSE);\n\n\t\tstrcpy(m_pPlayer->m_szAnimExtention, \"shielded\");\n\n\t\tm_fMaxSpeed = FLASHBANG_MAX_SPEED_SHIELD;\n\t\tm_pPlayer->m_bShieldDrawn = true;\n\t}\n\n#ifndef CLIENT_DLL\n\tm_pPlayer->UpdateShieldCrosshair((m_iWeaponState & WPNSTATE_SHIELD_DRAWN) != WPNSTATE_SHIELD_DRAWN);\n#endif\n\tm_pPlayer->ResetMaxSpeed();\n\n\tm_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.4f;\n\tm_flNextPrimaryAttack = GetNextAttackDelay(0.4);\n\tm_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.6f;\n\n\treturn true;\n}\n\nvoid CFlashbang::SecondaryAttack(void)\n{\n\tShieldSecondaryFire(SHIELDGUN_DRAW, SHIELDGUN_DRAWN_IDLE);\n}\n\nvoid CFlashbang::WeaponIdle(void)\n{\n\tif (m_flReleaseThrow == 0 && m_flStartThrow != 0.0f)\n\t\tm_flReleaseThrow = gpGlobals->time;\n\n\tif (m_flTimeWeaponIdle > UTIL_WeaponTimeBase())\n\t\treturn;\n\n\tif (m_flStartThrow)\n\t{\n\t\tm_pPlayer->Radio(\"%!MRAD_FIREINHOLE\", \"#Fire_in_the_hole\");\n\n\t\tVector angThrow = m_pPlayer->pev->v_angle + m_pPlayer->pev->punchangle;\n\n\t\tif (angThrow.x < 0)\n\t\t\tangThrow.x = -10 + angThrow.x * ((90 - 10) / 90.0);\n\t\telse\n\t\t\tangThrow.x = -10 + angThrow.x * ((90 + 10) / 90.0);\n\n\t\tfloat flVel = (90.0f - angThrow.x) * 6.0f;\n\n\t\tif (flVel > 750.0f)\n\t\t\tflVel = 750.0f;\n\n\t\tUTIL_MakeVectors(angThrow);\n\n\t\tVector vecSrc = m_pPlayer->pev->origin + m_pPlayer->pev->view_ofs + gpGlobals->v_forward * 16;\n\t\tVector vecThrow = gpGlobals->v_forward * flVel + m_pPlayer->pev->velocity;\n\n\t\tCGrenade::ShootTimed(m_pPlayer->pev, vecSrc, vecThrow, 1.5);\n\n\t\tSendWeaponAnim(FLASHBANG_THROW, UseDecrement() != FALSE);\n\t\tSetPlayerShieldAnim();\n\n\t\t// player \"shoot\" animation\n#ifndef CLIENT_DLL\n\t\tm_pPlayer->SetAnimation(PLAYER_ATTACK1);\n#endif\n\n\t\tm_flStartThrow = 0;\n\t\tm_flNextPrimaryAttack = GetNextAttackDelay(0.5);\n\t\tm_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.75f;\n\n\t\tif (--m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0)\n\t\t{\n\t\t\t// just threw last grenade\n\t\t\t// set attack times in the future, and weapon idle in the future so we can see the whole throw\n\t\t\t// animation, weapon idle will automatically retire the weapon for us.\n\t\t\t// ensure that the animation can finish playing\n\t\t\tm_flTimeWeaponIdle = m_flNextSecondaryAttack = m_flNextPrimaryAttack = GetNextAttackDelay(0.5);\n\t\t}\n\n\t\tResetPlayerShieldAnim();\n\t}\n\telse if (m_flReleaseThrow > 0)\n\t{\n\t\t// we've finished the throw, restart.\n\t\tm_flStartThrow = 0;\n\t\tRetireWeapon();\n\t}\n\telse if (m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType])\n\t{\n\t\tint iAnim;\n\t\tfloat flRand = RANDOM_FLOAT(0, 1);\n\n\t\tif (m_pPlayer->HasShield())\n\t\t{\n\t\t\tm_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 20.0f;\n\n\t\t\tif (m_iWeaponState & WPNSTATE_SHIELD_DRAWN)\n\t\t\t{\n\t\t\t\tSendWeaponAnim(SHIELDREN_IDLE, UseDecrement() != FALSE);\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif (flRand <= 0.75)\n\t\t\t{\n\t\t\t\tiAnim = FLASHBANG_IDLE;\n\n\t\t\t\t// how long till we do this again.\n\t\t\t\tm_flTimeWeaponIdle = UTIL_WeaponTimeBase() + RANDOM_FLOAT(10, 15);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t#ifdef REGAMEDLL_FIXES\n\t\t\t\tiAnim = FLASHBANG_IDLE;\n\t\t\t#else\n\t\t\t\t// TODO: This is a bug?\n\t\t\t\tiAnim = *(int *)&flRand;\n\t\t\t#endif\n\t\t\t\tm_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 75.0f / 30.0f;\n\t\t\t}\n\n\t\t\tSendWeaponAnim(iAnim, UseDecrement() != FALSE);\n\t\t}\n\t}\n}\n\nBOOL CFlashbang::CanDeploy(void)\n{\n\treturn m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] != 0;\n}\n"
  },
  {
    "path": "dlls/wpn_shared/wpn_g3sg1.cpp",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\n*\tThis product contains software technology licensed from Id\n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc.\n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n\n#include \"stdafx.h\"\n#include \"cbase.h\"\n#include \"player.h\"\n#include \"weapons.h\"\n\nLINK_ENTITY_TO_CLASS(weapon_g3sg1, CG3SG1)\n\nvoid CG3SG1::Spawn(void)\n{\n\tpev->classname = MAKE_STRING(\"weapon_g3sg1\");\n\n\tPrecache();\n\n\tm_iId = WEAPON_G3SG1;\n\tSET_MODEL(edict(), \"models/w_g3sg1.mdl\");\n\n\tm_iDefaultAmmo = G3SG1_DEFAULT_GIVE;\n\tm_flLastFire = 0;\n\n\tFallInit();\n}\n\nvoid CG3SG1::Precache(void)\n{\n\tPRECACHE_MODEL(\"models/v_g3sg1.mdl\");\n\tPRECACHE_MODEL(\"models/w_g3sg1.mdl\");\n\n\tPRECACHE_SOUND(\"weapons/g3sg1-1.wav\");\n\tPRECACHE_SOUND(\"weapons/g3sg1_slide.wav\");\n\tPRECACHE_SOUND(\"weapons/g3sg1_clipin.wav\");\n\tPRECACHE_SOUND(\"weapons/g3sg1_clipout.wav\");\n\tPRECACHE_SOUND(\"weapons/zoom.wav\");\n\n\tm_iShellId = m_iShell = PRECACHE_MODEL(\"models/rshell.mdl\");\n\tm_usFireG3SG1 = PRECACHE_EVENT(1, \"events/g3sg1.sc\");\n}\n\nint CG3SG1::GetItemInfo(ItemInfo *p)\n{\n\tp->pszName = STRING(pev->classname);\n\tp->pszAmmo1 = \"762Nato\";\n\tp->iMaxAmmo1 = MAX_AMMO_762NATO;\n\tp->pszAmmo2 = NULL;\n\tp->iMaxAmmo2 = -1;\n\tp->iMaxClip = G3SG1_MAX_CLIP;\n\tp->iSlot = 0;\n\tp->iPosition = 3;\n\tp->iId = m_iId = WEAPON_G3SG1;\n\tp->iFlags = 0;\n\tp->iWeight = G3SG1_WEIGHT;\n\n\treturn 1;\n}\n\nBOOL CG3SG1::Deploy(void)\n{\n\tm_flAccuracy = 0.2f;\n\treturn DefaultDeploy(\"models/v_g3sg1.mdl\", \"models/p_g3sg1.mdl\", G3SG1_DRAW, \"mp5\", UseDecrement() != FALSE);\n}\n\nvoid CG3SG1::SecondaryAttack(void)\n{\n\tswitch (m_pPlayer->m_iFOV)\n\t{\n\tcase 90: m_pPlayer->m_iFOV = m_pPlayer->pev->fov = 40; break;\n\tcase 40: m_pPlayer->m_iFOV = m_pPlayer->pev->fov = 15; break;\n\tdefault: m_pPlayer->m_iFOV = m_pPlayer->pev->fov = 90; break;\n\t}\n\n\tm_pPlayer->ResetMaxSpeed();\n\n#ifndef CLIENT_DLL\n\tif (TheBots != NULL)\n\t{\n\t\tTheBots->OnEvent(EVENT_WEAPON_ZOOMED, m_pPlayer);\n\t}\n#endif\n\n\tEMIT_SOUND(m_pPlayer->edict(), CHAN_ITEM, \"weapons/zoom.wav\", 0.2, 2.4);\n\tm_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.3f;\n}\n\nvoid CG3SG1::PrimaryAttack(void)\n{\n\tif (!(m_pPlayer->pev->flags & FL_ONGROUND))\n\t{\n\t\tG3SG1Fire(0.45, 0.25, FALSE);\n\t}\n\telse if (m_pPlayer->pev->velocity.Length2D() > 0)\n\t{\n\t\tG3SG1Fire(0.15, 0.25, FALSE);\n\t}\n\telse if (m_pPlayer->pev->flags & FL_DUCKING)\n\t{\n\t\tG3SG1Fire(0.035, 0.25, FALSE);\n\t}\n\telse\n\t{\n\t\tG3SG1Fire(0.055, 0.25, FALSE);\n\t}\n}\n\nvoid CG3SG1::G3SG1Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim)\n{\n\tVector vecAiming, vecSrc, vecDir;\n\tint flag;\n\n\tif (m_pPlayer->pev->fov == DEFAULT_FOV)\n\t{\n\t\tflSpread += 0.025f;\n\t}\n\n\tif (m_flLastFire)\n\t{\n\t\tm_flAccuracy = (gpGlobals->time - m_flLastFire) * 0.3f + 0.55f;\n\n\t\tif (m_flAccuracy > 0.98f)\n\t\t{\n\t\t\tm_flAccuracy = 0.98f;\n\t\t}\n\t}\n\telse\n\t{\n\t\tm_flAccuracy = 0.98f;\n\t}\n\n\tm_flLastFire = gpGlobals->time;\n\n\tif (m_iClip <= 0)\n\t{\n\t\tif (m_fFireOnEmpty)\n\t\t{\n\t\t\tPlayEmptySound();\n\t\t\tm_flNextPrimaryAttack = GetNextAttackDelay(0.2);\n\t\t}\n\n#ifndef CLIENT_DLL\n\t\tif (TheBots != NULL)\n\t\t{\n\t\t\tTheBots->OnEvent(EVENT_WEAPON_FIRED_ON_EMPTY, m_pPlayer);\n\t\t}\n#endif\n\n\t\treturn;\n\t}\n\n\t--m_iClip;\n\tm_pPlayer->pev->effects |= EF_MUZZLEFLASH;\n#ifndef CLIENT_DLL\n\tm_pPlayer->SetAnimation(PLAYER_ATTACK1);\n#endif\n\n\tUTIL_MakeVectors(m_pPlayer->pev->v_angle + m_pPlayer->pev->punchangle);\n\n\tm_pPlayer->m_iWeaponVolume = BIG_EXPLOSION_VOLUME;\n\tm_pPlayer->m_iWeaponFlash = NORMAL_GUN_FLASH;\n\n\tvecSrc = m_pPlayer->GetGunPosition();\n\tvecAiming = gpGlobals->v_forward;\n\n\tvecDir = m_pPlayer->FireBullets3(vecSrc, vecAiming, (1 - m_flAccuracy) * flSpread, 8192, 3, BULLET_PLAYER_762MM, G3SG1_DAMAGE, G3SG1_RANGE_MODIFER, m_pPlayer->pev, true, m_pPlayer->random_seed);\n\n#ifdef CLIENT_WEAPONS\n\tflag = FEV_NOTHOST;\n#else\n\tflag = 0;\n#endif\n\n\tPLAYBACK_EVENT_FULL(flag, m_pPlayer->edict(), m_usFireG3SG1, 0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y,\n\t\tint(m_pPlayer->pev->punchangle.x * 100), int(m_pPlayer->pev->punchangle.x * 100), FALSE, FALSE);\n\n\tm_flNextPrimaryAttack = m_flNextSecondaryAttack = GetNextAttackDelay(flCycleTime);\n\n#ifndef CLIENT_DLL\n\tif (!m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0)\n\t{\n\t\tm_pPlayer->SetSuitUpdate(\"!HEV_AMO0\", FALSE, 0);\n\t}\n#endif\n\n\tm_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.8f;\n\n\tm_pPlayer->pev->punchangle.x -= UTIL_SharedRandomFloat(m_pPlayer->random_seed + 4, 0.75, 1.75) + m_pPlayer->pev->punchangle.x * 0.25f;\n\tm_pPlayer->pev->punchangle.y += UTIL_SharedRandomFloat(m_pPlayer->random_seed + 5, -0.75, 0.75);\n}\n\nvoid CG3SG1::Reload(void)\n{\n\tif (m_pPlayer->ammo_762nato <= 0)\n\t\treturn;\n\n\tif (DefaultReload(iMaxClip(), G3SG1_RELOAD, G3SG1_RELOAD_TIME))\n\t{\n\t\tm_flAccuracy = 0.2f;\n#ifndef CLIENT_DLL\n\t\tm_pPlayer->SetAnimation(PLAYER_RELOAD);\n#endif\n\t\tif (m_pPlayer->pev->fov != DEFAULT_FOV)\n\t\t{\n\t\t\tm_pPlayer->m_iFOV = m_pPlayer->pev->fov = 15;\n\t\t\tSecondaryAttack();\n\t\t}\n\t}\n}\n\nvoid CG3SG1::WeaponIdle(void)\n{\n\tResetEmptySound();\n\tm_pPlayer->GetAutoaimVector(AUTOAIM_10DEGREES);\n\n\tif (m_flTimeWeaponIdle <= UTIL_WeaponTimeBase())\n\t{\n\t\tif (m_iClip)\n\t\t{\n\t\t\tm_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 60.0f;\n\t\t\tSendWeaponAnim(G3SG1_IDLE, UseDecrement() != FALSE);\n\t\t}\n\t}\n}\n\nfloat CG3SG1::GetMaxSpeed(void)\n{\n\treturn (m_pPlayer->m_iFOV == DEFAULT_FOV) ? G3SG1_MAX_SPEED : G3SG1_MAX_SPEED_ZOOM;\n}\n"
  },
  {
    "path": "dlls/wpn_shared/wpn_galil.cpp",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\n*\tThis product contains software technology licensed from Id\n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc.\n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n\n#include \"stdafx.h\"\n#include \"cbase.h\"\n#include \"player.h\"\n#include \"weapons.h\"\n\n\nLINK_ENTITY_TO_CLASS(weapon_galil, CGalil)\n\nvoid CGalil::Spawn(void)\n{\n\tpev->classname = MAKE_STRING(\"weapon_galil\");\n\n\tPrecache();\n\n\tm_iId = WEAPON_GALIL;\n\tSET_MODEL(edict(), \"models/w_galil.mdl\");\n\n\tm_iDefaultAmmo = GALIL_DEFAULT_GIVE;\n\n\tFallInit();\n}\n\nvoid CGalil::Precache(void)\n{\n\tPRECACHE_MODEL(\"models/v_galil.mdl\");\n\tPRECACHE_MODEL(\"models/w_galil.mdl\");\n\n\tPRECACHE_SOUND(\"weapons/galil-1.wav\");\n\tPRECACHE_SOUND(\"weapons/galil-2.wav\");\n\tPRECACHE_SOUND(\"weapons/galil_clipout.wav\");\n\tPRECACHE_SOUND(\"weapons/galil_clipin.wav\");\n\tPRECACHE_SOUND(\"weapons/galil_boltpull.wav\");\n\n\tm_iShell = PRECACHE_MODEL(\"models/rshell.mdl\");\n\tm_usFireGalil = PRECACHE_EVENT(1, \"events/galil.sc\");\n}\n\nint CGalil::GetItemInfo(ItemInfo *p)\n{\n\tp->pszName = STRING(pev->classname);\n\tp->pszAmmo1 = \"556Nato\";\n\tp->iMaxAmmo1 = MAX_AMMO_556NATO;\n\tp->pszAmmo2 = NULL;\n\tp->iMaxAmmo2 = -1;\n\tp->iMaxClip = GALIL_MAX_CLIP;\n\tp->iSlot = 0;\n\tp->iPosition = 17;\n\tp->iId = m_iId = WEAPON_GALIL;\n\tp->iFlags = 0;\n\tp->iWeight = GALIL_WEIGHT;\n\n\treturn 1;\n}\n\nBOOL CGalil::Deploy(void)\n{\n\tm_flAccuracy = 0.2f;\n\tm_iShotsFired = 0;\n\tiShellOn = 1;\n\n\treturn DefaultDeploy(\"models/v_galil.mdl\", \"models/p_galil.mdl\", GALIL_DRAW, \"ak47\", UseDecrement() != FALSE);\n}\n\nvoid CGalil::PrimaryAttack(void)\n{\n\tif (m_pPlayer->pev->waterlevel == 3)\n\t{\n\t\tPlayEmptySound();\n\t\tm_flNextPrimaryAttack = GetNextAttackDelay(0.15);\n\t\treturn;\n\t}\n\n\tif (!(m_pPlayer->pev->flags & FL_ONGROUND))\n\t{\n\t\tGalilFire(0.04 + (0.3 * m_flAccuracy), 0.0875, FALSE);\n\t}\n\telse if (m_pPlayer->pev->velocity.Length2D() > 140)\n\t{\n\t\tGalilFire(0.04 + (0.07 * m_flAccuracy), 0.0875, FALSE);\n\t}\n\telse\n\t{\n\t\tGalilFire(0.0375 * m_flAccuracy, 0.0875, FALSE);\n\t}\n}\n\nvoid CGalil::GalilFire(float flSpread, float flCycleTime, BOOL fUseAutoAim)\n{\n\tVector vecAiming, vecSrc, vecDir;\n\tint flag;\n\n\tm_bDelayFire = true;\n\t++m_iShotsFired;\n\n\tm_flAccuracy = ((m_iShotsFired * m_iShotsFired * m_iShotsFired) / 200) + 0.35f;\n\n\tif (m_flAccuracy > 1.25f)\n\t\tm_flAccuracy = 1.25f;\n\n\tif (m_iClip <= 0)\n\t{\n\t\tif (m_fFireOnEmpty)\n\t\t{\n\t\t\tPlayEmptySound();\n\t\t\tm_flNextPrimaryAttack = GetNextAttackDelay(0.2);\n\t\t}\n\n#ifndef CLIENT_DLL\n\t\tif (TheBots != NULL)\n\t\t{\n\t\t\tTheBots->OnEvent(EVENT_WEAPON_FIRED_ON_EMPTY, m_pPlayer);\n\t\t}\n#endif\n\n\t\treturn;\n\t}\n\n\t--m_iClip;\n\tm_pPlayer->pev->effects |= EF_MUZZLEFLASH;\n#ifndef CLIENT_DLL\n\tm_pPlayer->SetAnimation(PLAYER_ATTACK1);\n#endif\n\tUTIL_MakeVectors(m_pPlayer->pev->v_angle + m_pPlayer->pev->punchangle);\n\n\tvecSrc = m_pPlayer->GetGunPosition();\n\tvecAiming = gpGlobals->v_forward;\n\n\tvecDir = m_pPlayer->FireBullets3(vecSrc, vecAiming, flSpread, 8192, 2, BULLET_PLAYER_556MM,\n\t\tGALIL_DAMAGE, GALIL_RANGE_MODIFER, m_pPlayer->pev, false, m_pPlayer->random_seed);\n\n#ifdef CLIENT_WEAPONS\n\tflag = FEV_NOTHOST;\n#else\n\tflag = 0;\n#endif\n\n\tPLAYBACK_EVENT_FULL(flag, m_pPlayer->edict(), m_usFireGalil, 0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y,\n\t\tint(m_pPlayer->pev->punchangle.x * 10000000), int(m_pPlayer->pev->punchangle.y * 10000000), FALSE, FALSE);\n\n\tm_pPlayer->m_iWeaponVolume = NORMAL_GUN_VOLUME;\n\tm_pPlayer->m_iWeaponFlash = BRIGHT_GUN_FLASH;\n\n\tm_flNextPrimaryAttack = m_flNextSecondaryAttack = GetNextAttackDelay(flCycleTime);\n\n#ifndef CLIENT_DLL\n\tif (!m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0)\n\t{\n\t\tm_pPlayer->SetSuitUpdate(\"!HEV_AMO0\", FALSE, 0);\n\t}\n#endif\n\n\tm_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.28f;\n\n\tif (m_pPlayer->pev->velocity.Length2D() > 0)\n\t{\n\t\tKickBack(1.0, 0.45, 0.28, 0.045, 3.75, 3.0, 7);\n\t}\n\telse if (!(m_pPlayer->pev->flags & FL_ONGROUND))\n\t{\n\t\tKickBack(1.2, 0.5, 0.23, 0.15, 5.5, 3.5, 6);\n\t}\n\telse if (m_pPlayer->pev->flags & FL_DUCKING)\n\t{\n\t\tKickBack(0.6, 0.3, 0.2, 0.0125, 3.25, 2.0, 7);\n\t}\n\telse\n\t{\n\t\tKickBack(0.65, 0.35, 0.25, 0.015, 3.5, 2.25, 7);\n\t}\n}\n\nvoid CGalil::Reload(void)\n{\n\t// to prevent reload if not enough ammo\n\tif (m_pPlayer->ammo_556nato <= 0)\n\t\treturn;\n\n\tif (DefaultReload(iMaxClip(), GALIL_RELOAD, GALIL_RELOAD_TIME))\n\t{\n#ifndef CLIENT_DLL\n\t\tm_pPlayer->SetAnimation(PLAYER_RELOAD);\n#endif\n\t\tm_flAccuracy = 0.2f;\n\t\tm_iShotsFired = 0;\n\t\tm_bDelayFire = false;\n\t}\n}\n\nvoid CGalil::WeaponIdle(void)\n{\n\tResetEmptySound();\n\tm_pPlayer->GetAutoaimVector(AUTOAIM_10DEGREES);\n\n\tif (m_flTimeWeaponIdle <= UTIL_WeaponTimeBase())\n\t{\n\t\tm_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 20.0f;\n\t\tSendWeaponAnim(GALIL_IDLE1, UseDecrement() != FALSE);\n\t}\n}\n"
  },
  {
    "path": "dlls/wpn_shared/wpn_glock18.cpp",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\n*\tThis product contains software technology licensed from Id\n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc.\n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n\n#include \"stdafx.h\"\n#include \"cbase.h\"\n#include \"player.h\"\n#include \"weapons.h\"\n\n#ifdef CLIENT_WEAPONS\nextern bool g_bGlockBurstMode;\n#endif\n\nLINK_ENTITY_TO_CLASS(weapon_glock18, CGLOCK18)\n\nvoid CGLOCK18::Spawn(void)\n{\n\tpev->classname = MAKE_STRING(\"weapon_glock18\");\n\n\tPrecache();\n\n\tm_iId = WEAPON_GLOCK18;\n\tSET_MODEL(edict(), \"models/w_glock18.mdl\");\n\n\tm_iWeaponState &= ~WPNSTATE_SHIELD_DRAWN;\n\tm_iDefaultAmmo = GLOCK18_DEFAULT_GIVE;\n\tm_bBurstFire = false;\n\n\tm_iGlock18ShotsFired = 0;\n\tm_flGlock18Shoot = 0;\n\tm_flAccuracy = 0.9f;\n\n\tFallInit();\n}\n\nvoid CGLOCK18::Precache(void)\n{\n\tPRECACHE_MODEL(\"models/v_glock18.mdl\");\n\tPRECACHE_MODEL(\"models/w_glock18.mdl\");\n\tPRECACHE_MODEL(\"models/shield/v_shield_glock18.mdl\");\n\n\tPRECACHE_SOUND(\"weapons/glock18-1.wav\");\n\tPRECACHE_SOUND(\"weapons/glock18-2.wav\");\n\tPRECACHE_SOUND(\"weapons/clipout1.wav\");\n\tPRECACHE_SOUND(\"weapons/clipin1.wav\");\n\tPRECACHE_SOUND(\"weapons/sliderelease1.wav\");\n\tPRECACHE_SOUND(\"weapons/slideback1.wav\");\n\tPRECACHE_SOUND(\"weapons/357_cock1.wav\");\n\tPRECACHE_SOUND(\"weapons/de_clipin.wav\");\n\tPRECACHE_SOUND(\"weapons/de_clipout.wav\");\n\n\tm_iShellId = m_iShell = PRECACHE_MODEL(\"models/pshell.mdl\");\n\tm_usFireGlock18 = PRECACHE_EVENT(1, \"events/glock18.sc\");\n}\n\nint CGLOCK18::GetItemInfo(ItemInfo *p)\n{\n\tp->pszName = STRING(pev->classname);\n\tp->pszAmmo1 = \"9mm\";\n\tp->iMaxAmmo1 = MAX_AMMO_9MM;\n\tp->pszAmmo2 = NULL;\n\tp->iMaxAmmo2 = -1;\n\tp->iMaxClip = GLOCK18_MAX_CLIP;\n\tp->iSlot = 1;\n\tp->iPosition = 2;\n\tp->iId = m_iId = WEAPON_GLOCK18;\n\tp->iFlags = 0;\n\tp->iWeight = GLOCK18_WEIGHT;\n\n\treturn 1;\n}\n\nBOOL CGLOCK18::Deploy(void)\n{\n\tm_iWeaponState &= ~WPNSTATE_SHIELD_DRAWN;\n\n\tm_bBurstFire = false;\n\tm_iGlock18ShotsFired = 0;\n\tm_flGlock18Shoot = 0;\n\tm_flAccuracy = 0.9f;\n\tm_fMaxSpeed = GLOCK18_MAX_SPEED;\n\n\tm_pPlayer->m_bShieldDrawn = false;\n\n\tif (m_pPlayer->HasShield())\n\t{\n\t\tm_iWeaponState &= ~WPNSTATE_GLOCK18_BURST_MODE;\n\t\treturn DefaultDeploy(\"models/shield/v_shield_glock18.mdl\", \"models/shield/p_shield_glock18.mdl\", GLOCK18_SHIELD_DRAW, \"shieldgun\", UseDecrement() != FALSE);\n\t}\n\telse if (RANDOM_LONG(0, 1))\n\t{\n\t\treturn DefaultDeploy(\"models/v_glock18.mdl\", \"models/p_glock18.mdl\", GLOCK18_DRAW, \"onehanded\", UseDecrement() != FALSE);\n\t}\n\n\treturn DefaultDeploy(\"models/v_glock18.mdl\", \"models/p_glock18.mdl\", GLOCK18_DRAW2, \"onehanded\", UseDecrement() != FALSE);\n}\n\nvoid CGLOCK18::SecondaryAttack(void)\n{\n\tif (ShieldSecondaryFire(GLOCK18_SHIELD_UP, GLOCK18_SHIELD_DOWN))\n\t{\n\t\treturn;\n\t}\n\n\tif (m_iWeaponState & WPNSTATE_GLOCK18_BURST_MODE)\n\t{\n\t\tClientPrint(m_pPlayer->pev, HUD_PRINTCENTER, \"#Switch_To_SemiAuto\");\n\t\tm_iWeaponState &= ~WPNSTATE_GLOCK18_BURST_MODE;\n\t}\n\telse\n\t{\n\t\tClientPrint(m_pPlayer->pev, HUD_PRINTCENTER, \"#Switch_To_BurstFire\");\n\t\tm_iWeaponState |= WPNSTATE_GLOCK18_BURST_MODE;\n\t}\n\n\tm_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.3f;\n}\n\nvoid CGLOCK18::PrimaryAttack(void)\n{\n\tif (m_iWeaponState & WPNSTATE_GLOCK18_BURST_MODE)\n\t{\n\t\tif (!(m_pPlayer->pev->flags & FL_ONGROUND))\n\t\t{\n\t\t\tGLOCK18Fire(1.2 * (1 - m_flAccuracy), 0.5, TRUE);\n\t\t}\n\t\telse if (m_pPlayer->pev->velocity.Length2D() > 0)\n\t\t{\n\t\t\tGLOCK18Fire(0.185 * (1 - m_flAccuracy), 0.5, TRUE);\n\t\t}\n\t\telse if (m_pPlayer->pev->flags & FL_DUCKING)\n\t\t{\n\t\t\tGLOCK18Fire(0.095 * (1 - m_flAccuracy), 0.5, TRUE);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tGLOCK18Fire(0.3 * (1 - m_flAccuracy), 0.5, TRUE);\n\t\t}\n\t}\n\telse\n\t{\n\t\tif (!(m_pPlayer->pev->flags & FL_ONGROUND))\n\t\t{\n\t\t\tGLOCK18Fire(1.0 * (1 - m_flAccuracy), 0.2, FALSE);\n\t\t}\n\t\telse if (m_pPlayer->pev->velocity.Length2D() > 0)\n\t\t{\n\t\t\tGLOCK18Fire(0.165 * (1 - m_flAccuracy), 0.2, FALSE);\n\t\t}\n\t\telse if (m_pPlayer->pev->flags & FL_DUCKING)\n\t\t{\n\t\t\tGLOCK18Fire(0.075 * (1 - m_flAccuracy), 0.2, FALSE);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tGLOCK18Fire(0.1 * (1 - m_flAccuracy), 0.2, FALSE);\n\t\t}\n\t}\n}\n\nvoid CGLOCK18::GLOCK18Fire(float flSpread, float flCycleTime, BOOL bFireBurst)\n{\n\tVector vecAiming, vecSrc, vecDir;\n\tint flag;\n\n\tif (bFireBurst)\n\t{\n\t\tm_iGlock18ShotsFired = 0;\n\t}\n\telse\n\t{\n\t\tif (++m_iShotsFired > 1)\n\t\t{\n\t\t\treturn;\n\t\t}\n\n\t\tflCycleTime -= 0.05f;\n\t}\n\n\tif (m_flLastFire)\n\t{\n\t\t// Mark the time of this shot and determine the accuracy modifier based on the last shot fired...\n\t\tm_flAccuracy -= (0.325f - (gpGlobals->time - m_flLastFire)) * 0.275f;\n\n\t\tif (m_flAccuracy > 0.9f)\n\t\t{\n\t\t\tm_flAccuracy = 0.9f;\n\t\t}\n\t\telse if (m_flAccuracy < 0.6f)\n\t\t{\n\t\t\tm_flAccuracy = 0.6f;\n\t\t}\n\t}\n\n\tm_flLastFire = gpGlobals->time;\n\n\tif (m_iClip <= 0)\n\t{\n\t\tif (m_fFireOnEmpty)\n\t\t{\n\t\t\tPlayEmptySound();\n\t\t\tm_flNextPrimaryAttack = GetNextAttackDelay(0.2);\n\t\t}\n\n#ifndef CLIENT_DLL\n\t\tif (TheBots != NULL)\n\t\t{\n\t\t\tTheBots->OnEvent(EVENT_WEAPON_FIRED_ON_EMPTY, m_pPlayer);\n\t\t}\n#endif\n\n\t\treturn;\n\t}\n\n\t--m_iClip;\n\tm_pPlayer->pev->effects |= EF_MUZZLEFLASH;\n\n#ifndef CLIENT_DLL\n\t// player \"shoot\" animation\n\tm_pPlayer->SetAnimation(PLAYER_ATTACK1);\n#endif\n\tUTIL_MakeVectors(m_pPlayer->pev->v_angle + m_pPlayer->pev->punchangle);\n\n\t// non-silenced\n\tm_pPlayer->m_iWeaponVolume = NORMAL_GUN_VOLUME;\n\tm_pPlayer->m_iWeaponFlash = NORMAL_GUN_FLASH;\n\n\tvecSrc = m_pPlayer->GetGunPosition();\n\tvecAiming = gpGlobals->v_forward;\n\n\tvecDir = m_pPlayer->FireBullets3(vecSrc, vecAiming, flSpread, 8192, 1, BULLET_PLAYER_9MM, GLOCK18_DAMAGE, GLOCK18_RANGE_MODIFER, m_pPlayer->pev, true, m_pPlayer->random_seed);\n\n#ifdef CLIENT_WEAPONS\n\tflag = FEV_NOTHOST;\n#else\n\tflag = 0;\n#endif\n\n\tPLAYBACK_EVENT_FULL(flag, m_pPlayer->edict(), m_usFireGlock18, 0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y,\n\t\tint(m_pPlayer->pev->punchangle.x * 100), int(m_pPlayer->pev->punchangle.y * 100), m_iClip == 0, FALSE);\n\n\tm_flNextPrimaryAttack = m_flNextSecondaryAttack = GetNextAttackDelay(flCycleTime);\n\n#ifndef CLIENT_DLL\n\tif (!m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0)\n\t{\n\t\t// HEV suit - indicate out of ammo condition\n\t\tm_pPlayer->SetSuitUpdate(\"!HEV_AMO0\", FALSE, FALSE);\n\t}\n#endif\n\n\tm_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 2.5f;\n\n\tif (bFireBurst)\n\t{\n\t\t// Fire off the next two rounds\n\t\t++m_iGlock18ShotsFired;\n\t\tm_flGlock18Shoot = gpGlobals->time + 0.1f;\n\t}\n\n\tResetPlayerShieldAnim();\n}\n\nvoid CGLOCK18::Reload(void)\n{\n\tint iResult;\n\tif (m_pPlayer->ammo_9mm <= 0)\n\t\treturn;\n\n\tif (m_pPlayer->HasShield())\n\t\tiResult = GLOCK18_SHIELD_RELOAD;\n\telse if (RANDOM_LONG(0, 1))\n\t\tiResult = GLOCK18_RELOAD;\n\telse\n\t\tiResult = GLOCK18_RELOAD2;\n\n\tif (DefaultReload(iMaxClip(), iResult, GLOCK18_RELOAD_TIME))\n\t{\n#ifndef CLIENT_DLL\n\t\tm_pPlayer->SetAnimation(PLAYER_RELOAD);\n#endif\n\t\tm_flAccuracy = 0.9;\n\t}\n}\n\nvoid CGLOCK18::WeaponIdle(void)\n{\n\tint iAnim;\n\tfloat flRand;\n\n\tResetEmptySound();\n\tm_pPlayer->GetAutoaimVector(AUTOAIM_10DEGREES);\n\n\tif (m_flTimeWeaponIdle > UTIL_WeaponTimeBase())\n\t{\n\t\treturn;\n\t}\n\n\tif (m_pPlayer->HasShield())\n\t{\n\t\tm_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 20.0f;\n\n\t\tif (m_iWeaponState & WPNSTATE_SHIELD_DRAWN)\n\t\t{\n\t\t\tSendWeaponAnim(GLOCK18_SHIELD_IDLE, UseDecrement() != FALSE);\n\t\t}\n\t}\n\t// only idle if the slid isn't back\n\telse if (m_iClip)\n\t{\n\t\tflRand = RANDOM_FLOAT(0, 1);\n\n\t\tif (flRand <= 0.3f)\n\t\t{\n\t\t\tiAnim = GLOCK18_IDLE3;\n\t\t\tm_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 3.0625f;\n\t\t}\n\t\telse if (flRand <= 0.6f)\n\t\t{\n\t\t\tiAnim = GLOCK18_IDLE1;\n\t\t\tm_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 3.75f;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tiAnim = GLOCK18_IDLE2;\n\t\t\tm_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 2.5f;\n\t\t}\n\n\t\tSendWeaponAnim(iAnim, UseDecrement() != FALSE);\n\t}\n}\n"
  },
  {
    "path": "dlls/wpn_shared/wpn_hegrenade.cpp",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\n*\tThis product contains software technology licensed from Id\n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc.\n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n\n#include \"stdafx.h\"\n#include \"cbase.h\"\n#include \"player.h\"\n#include \"weapons.h\"\n\nLINK_ENTITY_TO_CLASS(weapon_hegrenade, CHEGrenade)\n\nvoid CHEGrenade::Spawn(void)\n{\n\tPrecache();\n\n\tm_iId = WEAPON_HEGRENADE;\n\tSET_MODEL(edict(), \"models/w_hegrenade.mdl\");\n\n\tpev->dmg = 4;\n\n\tm_iDefaultAmmo = HEGRENADE_DEFAULT_GIVE;\n\tm_flStartThrow = 0;\n\tm_flReleaseThrow = -1.0f;\n\tm_iWeaponState &= ~WPNSTATE_SHIELD_DRAWN;\n\n\t// get ready to fall down.\n\tFallInit();\n}\n\nvoid CHEGrenade::Precache(void)\n{\n\tPRECACHE_MODEL(\"models/v_hegrenade.mdl\");\n\tPRECACHE_MODEL(\"models/shield/v_shield_hegrenade.mdl\");\n\n\tPRECACHE_SOUND(\"weapons/hegrenade-1.wav\");\n\tPRECACHE_SOUND(\"weapons/hegrenade-2.wav\");\n\tPRECACHE_SOUND(\"weapons/he_bounce-1.wav\");\n\tPRECACHE_SOUND(\"weapons/pinpull.wav\");\n\n\tm_usCreateExplosion = PRECACHE_EVENT(1, \"events/createexplo.sc\");\n}\n\nint CHEGrenade::GetItemInfo(ItemInfo *p)\n{\n\tp->pszName = STRING(pev->classname);\n\tp->pszAmmo1 = \"HEGrenade\";\n\n\tp->iMaxAmmo1 = MAX_AMMO_HEGRENADE;\n\tp->iMaxClip = WEAPON_NOCLIP;\n\n\tp->pszAmmo2 = NULL;\n\tp->iMaxAmmo2 = -1;\n\tp->iSlot = 3;\n\tp->iPosition = 1;\n\tp->iId = m_iId = WEAPON_HEGRENADE;\n\tp->iWeight = HEGRENADE_WEIGHT;\n\tp->iFlags = ITEM_FLAG_LIMITINWORLD | ITEM_FLAG_EXHAUSTIBLE;\n\n\treturn 1;}\n\nBOOL CHEGrenade::Deploy(void)\n{\n\tm_flReleaseThrow = -1.0f;\n\tm_fMaxSpeed = HEGRENADE_MAX_SPEED;\n\tm_iWeaponState &= ~WPNSTATE_SHIELD_DRAWN;\n\n\tm_pPlayer->m_bShieldDrawn = false;\n\n\tif (m_pPlayer->HasShield())\n\t\treturn DefaultDeploy(\"models/shield/v_shield_hegrenade.mdl\", \"models/shield/p_shield_hegrenade.mdl\", HEGRENADE_DRAW, \"shieldgren\", UseDecrement() != FALSE);\n\telse\n\t\treturn DefaultDeploy(\"models/v_hegrenade.mdl\", \"models/p_hegrenade.mdl\", HEGRENADE_DRAW, \"grenade\", UseDecrement() != FALSE);\n}\n\nBOOL CHEGrenade::CanHolster(void)\n{\n\treturn m_flStartThrow == 0;\n}\n\nvoid CHEGrenade::Holster(int skiplocal)\n{\n\tm_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5f;\n\n\tif (!m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType])\n\t{\n\t\tm_pPlayer->pev->weapons &= ~(1 << WEAPON_HEGRENADE);\n\t\tDestroyItem();\n\t}\n\n\tm_flStartThrow = 0;\n\tm_flReleaseThrow = -1.0f;\n}\n\nvoid CHEGrenade::PrimaryAttack(void)\n{\n\tif (m_iWeaponState & WPNSTATE_SHIELD_DRAWN)\n\t{\n\t\treturn;\n\t}\n\n\tif (!m_flStartThrow && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] > 0)\n\t{\n\t\tm_flReleaseThrow = 0;\n\t\tm_flStartThrow = gpGlobals->time;\n\n\t\tSendWeaponAnim(HEGRENADE_PULLPIN, UseDecrement() != FALSE);\n\t\tm_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.5f;\n\t}\n}\n\nvoid CHEGrenade::SetPlayerShieldAnim(void)\n{\n\tif (!m_pPlayer->HasShield())\n\t\treturn;\n\n\tif (m_iWeaponState & WPNSTATE_SHIELD_DRAWN)\n\t\tstrcpy(m_pPlayer->m_szAnimExtention, \"shield\");\n\telse\n\t\tstrcpy(m_pPlayer->m_szAnimExtention, \"shieldgren\");\n}\n\nvoid CHEGrenade::ResetPlayerShieldAnim(void)\n{\n\tif (!m_pPlayer->HasShield())\n\t\treturn;\n\n\tif (m_iWeaponState & WPNSTATE_SHIELD_DRAWN)\n\t{\n\t\tstrcpy(m_pPlayer->m_szAnimExtention, \"shieldgren\");\n\t}\n}\n\nbool CHEGrenade::ShieldSecondaryFire(int iUpAnim, int iDownAnim)\n{\n\tif (!m_pPlayer->HasShield() || m_flStartThrow > 0)\n\t{\n\t\treturn false;\n\t}\n\n\tif (m_iWeaponState & WPNSTATE_SHIELD_DRAWN)\n\t{\n\t\tm_iWeaponState &= ~WPNSTATE_SHIELD_DRAWN;\n\t\tSendWeaponAnim(iDownAnim, UseDecrement() != FALSE);\n\t\tstrcpy(m_pPlayer->m_szAnimExtention, \"shieldgren\");\n\n\t\tm_fMaxSpeed = HEGRENADE_MAX_SPEED;\n\t\tm_pPlayer->m_bShieldDrawn = false;\n\t}\n\telse\n\t{\n\t\tm_iWeaponState |= WPNSTATE_SHIELD_DRAWN;\n\t\tSendWeaponAnim(iUpAnim, UseDecrement() != FALSE);\n\t\tstrcpy(m_pPlayer->m_szAnimExtention, \"shielded\");\n\n\t\tm_fMaxSpeed = HEGRENADE_MAX_SPEED_SHIELD;\n\t\tm_pPlayer->m_bShieldDrawn = true;\n\t}\n\n#ifndef CLIENT_DLL\n\tm_pPlayer->UpdateShieldCrosshair((m_iWeaponState & WPNSTATE_SHIELD_DRAWN) != WPNSTATE_SHIELD_DRAWN);\n#endif\n\tm_pPlayer->ResetMaxSpeed();\n\n\tm_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.4f;\n\tm_flNextPrimaryAttack = GetNextAttackDelay(0.4);\n\tm_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.6f;\n\n\treturn true;\n}\n\nvoid CHEGrenade::SecondaryAttack(void)\n{\n\tShieldSecondaryFire(SHIELDGUN_DRAW, SHIELDGUN_DRAWN_IDLE);\n}\n\nvoid CHEGrenade::WeaponIdle(void)\n{\n\tif (m_flReleaseThrow == 0 && m_flStartThrow != 0.0f)\n\t\tm_flReleaseThrow = gpGlobals->time;\n\n\tif (m_flTimeWeaponIdle > UTIL_WeaponTimeBase())\n\t\treturn;\n\n\tif (m_flStartThrow)\n\t{\n\t\tm_pPlayer->Radio(\"%!MRAD_FIREINHOLE\", \"#Fire_in_the_hole\");\n\n\t\tVector angThrow = m_pPlayer->pev->v_angle + m_pPlayer->pev->punchangle;\n\n\t\tif (angThrow.x < 0)\n\t\t\tangThrow.x = -10 + angThrow.x * ((90 - 10) / 90.0);\n\t\telse\n\t\t\tangThrow.x = -10 + angThrow.x * ((90 + 10) / 90.0);\n\n\t\tfloat flVel = (90.0f - angThrow.x) * 6.0f;\n\n\t\tif (flVel > 750.0f)\n\t\t\tflVel = 750.0f;\n\n\t\tUTIL_MakeVectors(angThrow);\n\n\t\tVector vecSrc = m_pPlayer->pev->origin + m_pPlayer->pev->view_ofs + gpGlobals->v_forward * 16;\n\t\tVector vecThrow = gpGlobals->v_forward * flVel + m_pPlayer->pev->velocity;\n\n\t\tCGrenade::ShootTimed2(m_pPlayer->pev, vecSrc, vecThrow, 1.5, m_pPlayer->m_iTeam, m_usCreateExplosion);\n\n\t\tSendWeaponAnim(HEGRENADE_THROW, UseDecrement() != FALSE);\n\t\tSetPlayerShieldAnim();\n\n#ifndef CLIENT_DLL\n\t\t// player \"shoot\" animation\n\t\tm_pPlayer->SetAnimation(PLAYER_ATTACK1);\n#endif\n\t\tm_flStartThrow = 0;\n\t\tm_flNextPrimaryAttack = GetNextAttackDelay(0.5);\n\t\tm_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.75f;\n\n\t\tif (--m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0)\n\t\t{\n\t\t\t// just threw last grenade\n\t\t\t// set attack times in the future, and weapon idle in the future so we can see the whole throw\n\t\t\t// animation, weapon idle will automatically retire the weapon for us.\n\t\t\t// ensure that the animation can finish playing\n\t\t\tm_flTimeWeaponIdle = m_flNextSecondaryAttack = m_flNextPrimaryAttack = GetNextAttackDelay(0.5);\n\t\t}\n\n\t\tResetPlayerShieldAnim();\n\t}\n\telse if (m_flReleaseThrow > 0)\n\t{\n\t\t// we've finished the throw, restart.\n\t\tm_flStartThrow = 0;\n\n\t\tif (m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType])\n\t\t{\n\t\t\tSendWeaponAnim(HEGRENADE_DRAW, UseDecrement() != FALSE);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tRetireWeapon();\n\t\t\treturn;\n\t\t}\n\n\t\tm_flTimeWeaponIdle = UTIL_WeaponTimeBase() + RANDOM_FLOAT(10, 15);\n\t\tm_flReleaseThrow = -1.0f;\n\t}\n\telse if (m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType])\n\t{\n\t\tif (m_pPlayer->HasShield())\n\t\t{\n\t\t\tm_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 20.0f;\n\n\t\t\tif (m_iWeaponState & WPNSTATE_SHIELD_DRAWN)\n\t\t\t{\n\t\t\t\tSendWeaponAnim(SHIELDREN_IDLE, UseDecrement() != FALSE);\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tSendWeaponAnim(HEGRENADE_IDLE, UseDecrement() != FALSE);\n\n\t\t\t// how long till we do this again.\n\t\t\tm_flTimeWeaponIdle = UTIL_WeaponTimeBase() + RANDOM_FLOAT(10, 15);\n\t\t}\n\t}\n}\n\nBOOL CHEGrenade::CanDeploy(void)\n{\n\treturn m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] != 0;\n}\n"
  },
  {
    "path": "dlls/wpn_shared/wpn_knife.cpp",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\n*\tThis product contains software technology licensed from Id\n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc.\n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n\n#include \"stdafx.h\"\n#include \"cbase.h\"\n#include \"player.h\"\n#include \"weapons.h\"\n\n#define KNIFE_BODYHIT_VOLUME 128\n#define KNIFE_WALLHIT_VOLUME 512\n\nLINK_ENTITY_TO_CLASS(weapon_knife, CKnife)\n\nvoid CKnife::Spawn()\n{\n\tPrecache();\n\n\tm_iId = WEAPON_KNIFE;\n\tSET_MODEL(edict(), \"models/w_knife.mdl\");\n\n\tm_iWeaponState &= ~WPNSTATE_SHIELD_DRAWN;\n\tm_iClip = WEAPON_NOCLIP;\n\n\tFallInit();\n}\n\nvoid CKnife::Precache()\n{\n\tPRECACHE_MODEL(\"models/v_knife.mdl\");\n\tPRECACHE_MODEL(\"models/shield/v_shield_knife.mdl\");\n\tPRECACHE_MODEL(\"models/w_knife.mdl\");\n\n\tPRECACHE_SOUND(\"weapons/knife_deploy1.wav\");\n\tPRECACHE_SOUND(\"weapons/knife_hit1.wav\");\n\tPRECACHE_SOUND(\"weapons/knife_hit2.wav\");\n\tPRECACHE_SOUND(\"weapons/knife_hit3.wav\");\n\tPRECACHE_SOUND(\"weapons/knife_hit4.wav\");\n\tPRECACHE_SOUND(\"weapons/knife_slash1.wav\");\n\tPRECACHE_SOUND(\"weapons/knife_slash2.wav\");\n\tPRECACHE_SOUND(\"weapons/knife_stab.wav\");\n\tPRECACHE_SOUND(\"weapons/knife_hitwall1.wav\");\n\n\tm_usKnife = PRECACHE_EVENT(1, \"events/knife.sc\");\n}\n\nint CKnife::GetItemInfo(ItemInfo *p)\n{\n\tp->pszName = STRING(pev->classname);\n\tp->pszAmmo1 = NULL;\n\tp->iMaxAmmo1 = -1;\n\tp->pszAmmo2 = NULL;\n\tp->iMaxAmmo2 = -1;\n\tp->iMaxClip = WEAPON_NOCLIP;\n\tp->iSlot = 2;\n\tp->iPosition = 1;\n\tp->iId = WEAPON_KNIFE;\n\n\t// TODO: it is not being used\n\t//p->iFlags = 0;\n\n\tp->iWeight = KNIFE_WEIGHT;\n\n\treturn 1;\n}\n\nBOOL CKnife::Deploy()\n{\n\tEMIT_SOUND(m_pPlayer->edict(), CHAN_ITEM, \"weapons/knife_deploy1.wav\", 0.3, 2.4);\n\n\tm_iSwing = 0;\n\tm_fMaxSpeed = KNIFE_MAX_SPEED;\n\n\tm_iWeaponState &= ~WPNSTATE_SHIELD_DRAWN;\n\tm_pPlayer->m_bShieldDrawn = false;\n\n\tif (m_pPlayer->HasShield())\n\t{\n\t\treturn DefaultDeploy(\"models/shield/v_shield_knife.mdl\", \"models/shield/p_shield_knife.mdl\", KNIFE_SHIELD_DRAW, \"shieldknife\", UseDecrement() != FALSE);\n\t}\n\telse\n\t\treturn DefaultDeploy(\"models/v_knife.mdl\", \"models/p_knife.mdl\", KNIFE_DRAW, \"knife\", UseDecrement() != FALSE);\n}\n\nvoid CKnife::Holster(int skiplocal)\n{\n\tm_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5f;\n}\n\nvoid CKnife::WeaponAnimation(int iAnimation)\n{\n\tint flag;\n\n#ifdef CLIENT_WEAPONS\n\tflag = FEV_NOTHOST;\n#else\n\tflag = 0;\n#endif\n\n\tPLAYBACK_EVENT_FULL(flag, m_pPlayer->edict(), m_usKnife,\n\t\t0.0, (float *)&g_vecZero, (float *)&g_vecZero,\n\t\t0.0,\n\t\t0.0,\n\t\tiAnimation, 2, 3, 4);\n}\n\nvoid FindHullIntersection(const Vector &vecSrc, TraceResult &tr, float *mins, float *maxs, edict_t *pEntity)\n{\n\tint i, j, k;\n\tfloat distance;\n\tfloat *minmaxs[2] = { mins, maxs };\n\tTraceResult tmpTrace;\n\tVector vecHullEnd = tr.vecEndPos;\n\tVector vecEnd;\n\n\tdistance = 1e6f;\n\n\tvecHullEnd = vecSrc + ((vecHullEnd - vecSrc) * 2);\n\tUTIL_TraceLine(vecSrc, vecHullEnd, dont_ignore_monsters, pEntity, &tmpTrace);\n\n\tif (tmpTrace.flFraction < 1.0f)\n\t{\n\t\ttr = tmpTrace;\n\t\treturn;\n\t}\n\n\tfor (i = 0; i < 2; ++i)\n\t{\n\t\tfor (j = 0; j < 2; ++j)\n\t\t{\n\t\t\tfor (k = 0; k < 2; ++k)\n\t\t\t{\n\t\t\t\tvecEnd.x = vecHullEnd.x + minmaxs[i][0];\n\t\t\t\tvecEnd.y = vecHullEnd.y + minmaxs[j][1];\n\t\t\t\tvecEnd.z = vecHullEnd.z + minmaxs[k][2];\n\n\t\t\t\tUTIL_TraceLine(vecSrc, vecEnd, dont_ignore_monsters, pEntity, &tmpTrace);\n\n\t\t\t\tif (tmpTrace.flFraction < 1.0f)\n\t\t\t\t{\n\t\t\t\t\tfloat thisDistance = (tmpTrace.vecEndPos - vecSrc).Length();\n\n\t\t\t\t\tif (thisDistance < distance)\n\t\t\t\t\t{\n\t\t\t\t\t\ttr = tmpTrace;\n\t\t\t\t\t\tdistance = thisDistance;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\nvoid CKnife::PrimaryAttack()\n{\n\tSwing(TRUE);\n}\n\nvoid CKnife::SetPlayerShieldAnim()\n{\n\tif (!m_pPlayer->HasShield())\n\t\treturn;\n\n\tif (m_iWeaponState & WPNSTATE_SHIELD_DRAWN)\n\t{\n\t\tstrcpy(m_pPlayer->m_szAnimExtention, \"shield\");\n\t}\n\telse\n\t{\n\t\tstrcpy(m_pPlayer->m_szAnimExtention, \"shieldknife\");\n\t}\n}\n\nvoid CKnife::ResetPlayerShieldAnim()\n{\n\tif (!m_pPlayer->HasShield())\n\t\treturn;\n\n\tif (m_iWeaponState & WPNSTATE_SHIELD_DRAWN)\n\t{\n\t\tstrcpy(m_pPlayer->m_szAnimExtention, \"shieldknife\");\n\t}\n}\n\nbool CKnife::ShieldSecondaryFire(int iUpAnim, int iDownAnim)\n{\n\tif (!m_pPlayer->HasShield())\n\t{\n\t\treturn false;\n\t}\n\n\tif (m_iWeaponState & WPNSTATE_SHIELD_DRAWN)\n\t{\n\t\tm_iWeaponState &= ~WPNSTATE_SHIELD_DRAWN;\n\n\t\tSendWeaponAnim(iDownAnim, UseDecrement() != FALSE);\n\n\t\tstrcpy(m_pPlayer->m_szAnimExtention, \"shieldknife\");\n\n\t\tm_fMaxSpeed = KNIFE_MAX_SPEED;\n\t\tm_pPlayer->m_bShieldDrawn = false;\n\t}\n\telse\n\t{\n\t\tm_iWeaponState |= WPNSTATE_SHIELD_DRAWN;\n\t\tSendWeaponAnim(iUpAnim, UseDecrement() != FALSE);\n\n\t\tstrcpy(m_pPlayer->m_szAnimExtention, \"shielded\");\n\n\t\tm_fMaxSpeed = KNIFE_MAX_SPEED_SHIELD;\n\t\tm_pPlayer->m_bShieldDrawn = true;\n\t}\n\n#ifndef CLIENT_DLL\n\tm_pPlayer->UpdateShieldCrosshair((m_iWeaponState & WPNSTATE_SHIELD_DRAWN) != WPNSTATE_SHIELD_DRAWN);\n#endif\n\tm_pPlayer->ResetMaxSpeed();\n\n\tm_flNextPrimaryAttack = GetNextAttackDelay(0.4);\n\tm_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.4f;\n\tm_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.6f;\n\n\treturn true;\n}\n\nvoid CKnife::SecondaryAttack()\n{\n\tif (!ShieldSecondaryFire(KNIFE_SHIELD_UP, KNIFE_SHIELD_DOWN))\n\t{\n\t\tStab(TRUE);\n\t\tpev->nextthink = UTIL_WeaponTimeBase() + 0.35f;\n\t}\n}\n\nvoid CKnife::Smack()\n{\n\tDecalGunshot(&m_trHit, BULLET_PLAYER_CROWBAR, false, m_pPlayer->pev, false);\n}\n\nvoid CKnife::SwingAgain()\n{\n\tSwing(FALSE);\n}\n\nvoid CKnife::WeaponIdle()\n{\n\tResetEmptySound();\n\tm_pPlayer->GetAutoaimVector(AUTOAIM_10DEGREES);\n\n\tif (m_flTimeWeaponIdle > UTIL_WeaponTimeBase())\n\t\treturn;\n\n\tif (m_pPlayer->m_bShieldDrawn)\n\t\treturn;\n\n\tm_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 20.0f;\n\n\t// only idle if the slid isn't back\n\tSendWeaponAnim(KNIFE_IDLE, UseDecrement() != FALSE);\n}\n\nint CKnife::Swing(int fFirst)\n{\n\tint fDidHit = FALSE;\n\tTraceResult tr;\n\tVector vecSrc, vecEnd;\n\n\tUTIL_MakeVectors(m_pPlayer->pev->v_angle);\n\n\tvecSrc = m_pPlayer->GetGunPosition();\n\tvecEnd = vecSrc + gpGlobals->v_forward * 48.0f;\n\n\tUTIL_TraceLine(vecSrc, vecEnd, dont_ignore_monsters, m_pPlayer->edict(), &tr);\n\n\tif (tr.flFraction >= 1.0f)\n\t{\n\t\tUTIL_TraceHull(vecSrc, vecEnd, dont_ignore_monsters, head_hull, m_pPlayer->edict(), &tr);\n\n\t\tif (tr.flFraction < 1.0f)\n\t\t{\n\t\t\t// Calculate the point of intersection of the line (or hull) and the object we hit\n\t\t\t// This is and approximation of the \"best\" intersection\n\t\t\tCBaseEntity *pHit = CBaseEntity::Instance(tr.pHit);\n\n\t\t\tif (!pHit || pHit->IsBSPModel())\n\t\t\t{\n\t\t\t\tFindHullIntersection(vecSrc, tr, VEC_DUCK_HULL_MIN, VEC_DUCK_HULL_MAX, m_pPlayer->edict());\n\t\t\t}\n\n\t\t\t// This is the point on the actual surface (the hull could have hit space)\n\t\t\tvecEnd = tr.vecEndPos;\n\t\t}\n\t}\n\n\tif (tr.flFraction >= 1.0f)\n\t{\n\t\tif (fFirst)\n\t\t{\n\t\t\tif (!m_pPlayer->HasShield())\n\t\t\t{\n\t\t\t\tswitch ((m_iSwing++) % 2)\n\t\t\t\t{\n\t\t\t\tcase 0: SendWeaponAnim(KNIFE_MIDATTACK1HIT, UseDecrement() != FALSE); break;\n\t\t\t\tcase 1: SendWeaponAnim(KNIFE_MIDATTACK2HIT, UseDecrement() != FALSE); break;\n\t\t\t\t}\n\n\t\t\t\t// miss\n\t\t\t\tm_flNextPrimaryAttack = GetNextAttackDelay(0.35);\n\t\t\t\tm_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.5f;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tSendWeaponAnim(KNIFE_SHIELD_ATTACKHIT, UseDecrement() != FALSE);\n\n\t\t\t\tm_flNextPrimaryAttack = GetNextAttackDelay(1.0);\n\t\t\t\tm_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 1.2f;\n\t\t\t}\n\n\t\t\tm_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 2.0f;\n\n\t\t\t// play wiff or swish sound\n\t\t\tif (RANDOM_LONG(0, 1))\n\t\t\t\tEMIT_SOUND_DYN(m_pPlayer->edict(), CHAN_WEAPON, \"weapons/knife_slash1.wav\", VOL_NORM, ATTN_NORM, 0, 94);\n\t\t\telse\n\t\t\t\tEMIT_SOUND_DYN(m_pPlayer->edict(), CHAN_WEAPON, \"weapons/knife_slash2.wav\", VOL_NORM, ATTN_NORM, 0, 94);\n\n#ifndef CLIENT_DLL\n\t\t\t// player \"shoot\" animation\n\t\t\tm_pPlayer->SetAnimation(PLAYER_ATTACK1);\n#endif\n\t\t}\n\t}\n\telse\n\t{\n\t\t// hit\n\t\tfDidHit = TRUE;\n\n\t\tif (!m_pPlayer->HasShield())\n\t\t{\n\t\t\tswitch ((m_iSwing++) % 2)\n\t\t\t{\n\t\t\tcase 0: SendWeaponAnim(KNIFE_MIDATTACK1HIT, UseDecrement() != FALSE); break;\n\t\t\tcase 1: SendWeaponAnim(KNIFE_MIDATTACK2HIT, UseDecrement() != FALSE); break;\n\t\t\t}\n\n\t\t\tm_flNextPrimaryAttack = GetNextAttackDelay(0.4);\n\t\t\tm_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.5f;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tSendWeaponAnim(KNIFE_SHIELD_ATTACKHIT, UseDecrement() != FALSE);\n\n\t\t\tm_flNextPrimaryAttack = GetNextAttackDelay(1.0);\n\t\t\tm_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 1.2f;\n\t\t}\n\n\t\tm_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 2.0f;\n\n\t\t// play thwack, smack, or dong sound\n\t\tfloat flVol = 1.0f;\n\t\tint fHitWorld = TRUE;\n\n\t\tCBaseEntity *pEntity = CBaseEntity::Instance(tr.pHit);\n\t\tSetPlayerShieldAnim();\n\n#ifndef CLIENT_DLL\n\t\t// player \"shoot\" animation\n\t\tm_pPlayer->SetAnimation(PLAYER_ATTACK1);\n#endif\n\t\tClearMultiDamage();\n\n\t\tif (m_flNextPrimaryAttack + 0.4f < UTIL_WeaponTimeBase())\n\t\t\tpEntity->TraceAttack(m_pPlayer->pev, 20, gpGlobals->v_forward, &tr, (DMG_NEVERGIB | DMG_BULLET));\n\t\telse\n\t\t\tpEntity->TraceAttack(m_pPlayer->pev, 15, gpGlobals->v_forward, &tr, (DMG_NEVERGIB | DMG_BULLET));\n\n\t\tApplyMultiDamage(m_pPlayer->pev, m_pPlayer->pev);\n\n#ifndef REGAMEDLL_FIXES\n\t\tif (pEntity != NULL)\t// -V595\n#endif\n\t\t{\n\t\t\tif (pEntity->Classify() != CLASS_NONE && pEntity->Classify() != CLASS_MACHINE)\n\t\t\t{\n\t\t\t\t// play thwack or smack sound\n\t\t\t\tswitch (RANDOM_LONG(0, 3))\n\t\t\t\t{\n\t\t\t\tcase 0: EMIT_SOUND(m_pPlayer->edict(), CHAN_WEAPON, \"weapons/knife_hit1.wav\", VOL_NORM, ATTN_NORM); break;\n\t\t\t\tcase 1: EMIT_SOUND(m_pPlayer->edict(), CHAN_WEAPON, \"weapons/knife_hit2.wav\", VOL_NORM, ATTN_NORM); break;\n\t\t\t\tcase 2: EMIT_SOUND(m_pPlayer->edict(), CHAN_WEAPON, \"weapons/knife_hit3.wav\", VOL_NORM, ATTN_NORM); break;\n\t\t\t\tcase 3: EMIT_SOUND(m_pPlayer->edict(), CHAN_WEAPON, \"weapons/knife_hit4.wav\", VOL_NORM, ATTN_NORM); break;\n\t\t\t\t}\n\n\t\t\t\tm_pPlayer->m_iWeaponVolume = KNIFE_BODYHIT_VOLUME;\n\n\t\t\t\tif (!pEntity->IsAlive())\n\t\t\t\t\treturn TRUE;\n\t\t\t\telse\n\t\t\t\t\tflVol = 0.1f;\n\n\t\t\t\tfHitWorld = FALSE;\n\t\t\t}\n\t\t}\n\n\t\t// play texture hit sound\n\t\t// UNDONE: Calculate the correct point of intersection when we hit with the hull instead of the line\n\n\t\tif (fHitWorld)\n\t\t{\n#ifndef CLIENT_DLL\n\t\t\tfloat fvolbar = TEXTURETYPE_PlaySound(&tr, vecSrc, vecSrc + (vecEnd - vecSrc) * 2, BULLET_PLAYER_CROWBAR);\n\t\t\t//fvolbar = 1.0;\n#endif\n\n\t\t\tif (RANDOM_LONG(0, 1) > 1)\n\t\t\t{\n\t\t\t\tfHitWorld = FALSE;\n\t\t\t}\n\t\t}\n\n\t\tif (!fHitWorld)\n\t\t{\n\t\t\t// delay the decal a bit\n\t\t\tm_trHit = tr;\n\t\t\tSetThink(&CKnife::Smack);\n\n\t\t\tpev->nextthink = UTIL_WeaponTimeBase() + 0.2f;\n\t\t\tm_pPlayer->m_iWeaponVolume = int(flVol * KNIFE_WALLHIT_VOLUME);\n\n\t\t\tResetPlayerShieldAnim();\n\t\t}\n\t\telse\n\t\t{\n\t\t\t// also play knife strike\n\t\t\tEMIT_SOUND_DYN(m_pPlayer->edict(), CHAN_ITEM, \"weapons/knife_hitwall1.wav\", VOL_NORM, ATTN_NORM, 0, RANDOM_LONG(0, 3) + 98);\n\t\t}\n\t}\n\n\treturn fDidHit;\n}\n\nint CKnife::Stab(int fFirst)\n{\n\tint fDidHit = FALSE;\n\tTraceResult tr;\n\tVector vecSrc, vecEnd;\n\n\tUTIL_MakeVectors(m_pPlayer->pev->v_angle);\n\n\tvecSrc = m_pPlayer->GetGunPosition();\n\tvecEnd = vecSrc + gpGlobals->v_forward * 32.0f;\n\n\tUTIL_TraceLine(vecSrc, vecEnd, dont_ignore_monsters, m_pPlayer->edict(), &tr);\n\n\tif (tr.flFraction >= 1.0f)\n\t{\n\t\tUTIL_TraceHull(vecSrc, vecEnd, dont_ignore_monsters, head_hull, m_pPlayer->edict(), &tr);\n\n\t\tif (tr.flFraction < 1.0f)\n\t\t{\n\t\t\t// Calculate the point of intersection of the line (or hull) and the object we hit\n\t\t\t// This is and approximation of the \"best\" intersection\n\t\t\tCBaseEntity *pHit = CBaseEntity::Instance(tr.pHit);\n\n\t\t\tif (!pHit || pHit->IsBSPModel())\n\t\t\t{\n\t\t\t\tFindHullIntersection(vecSrc, tr, VEC_DUCK_HULL_MIN, VEC_DUCK_HULL_MAX, m_pPlayer->edict());\n\t\t\t}\n\n\t\t\t// This is the point on the actual surface (the hull could have hit space)\n\t\t\tvecEnd = tr.vecEndPos;\n\t\t}\n\t}\n\n\tif (tr.flFraction >= 1.0f)\n\t{\n\t\tif (fFirst)\n\t\t{\n\t\t\tSendWeaponAnim(KNIFE_STABMISS, UseDecrement() != FALSE);\n\n\t\t\tm_flNextPrimaryAttack = GetNextAttackDelay(1.0);\n\t\t\tm_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 1.0f;\n\n\t\t\t// play wiff or swish sound\n\t\t\tif (RANDOM_LONG(0, 1))\n\t\t\t\tEMIT_SOUND_DYN(m_pPlayer->edict(), CHAN_WEAPON, \"weapons/knife_slash1.wav\", VOL_NORM, ATTN_NORM, 0, 94);\n\t\t\telse\n\t\t\t\tEMIT_SOUND_DYN(m_pPlayer->edict(), CHAN_WEAPON, \"weapons/knife_slash2.wav\", VOL_NORM, ATTN_NORM, 0, 94);\n\n#ifndef CLIENT_DLL\n\t\t\t// player \"shoot\" animation\n\t\t\tm_pPlayer->SetAnimation(PLAYER_ATTACK1);\n#endif\n\t\t}\n\t}\n\telse\n\t{\n\t\t// hit\n\t\tfDidHit = TRUE;\n\n\t\tSendWeaponAnim(KNIFE_STABHIT, UseDecrement() != FALSE);\n\n\t\tm_flNextPrimaryAttack = GetNextAttackDelay(1.1);\n\t\tm_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 1.1f;\n\n\t\t// play thwack, smack, or dong sound\n\t\tfloat flVol = 1.0f;\n\t\tint fHitWorld = TRUE;\n\n\t\tCBaseEntity *pEntity = CBaseEntity::Instance(tr.pHit);\n\n#ifndef CLIENT_DLL\n\t\t// player \"shoot\" animation\n\t\tm_pPlayer->SetAnimation(PLAYER_ATTACK1);\n#endif\n\n\t\tfloat flDamage = 65.0f;\n\n\t\tif (pEntity != NULL && pEntity->IsPlayer())\n\t\t{\n\t\t\tVector2D vec2LOS;\n\t\t\tfloat flDot;\n\t\t\tVector vMyForward = gpGlobals->v_forward;\n\n\t\t\tUTIL_MakeVectors(pEntity->pev->angles);\n\n\t\t\tvec2LOS = vMyForward.Make2D();\n\t\t\tvec2LOS = vec2LOS.Normalize();\n\n\t\t\tflDot = DotProduct(vec2LOS, gpGlobals->v_forward.Make2D());\n\n\t\t\t//Triple the damage if we are stabbing them in the back.\n\t\t\tif (flDot > 0.80f)\n\t\t\t{\n\t\t\t\tflDamage *= 3.0f;\n\t\t\t}\n\t\t}\n\n\t\tUTIL_MakeVectors(m_pPlayer->pev->v_angle);\n\t\tClearMultiDamage();\n\n\t\tpEntity->TraceAttack(m_pPlayer->pev, flDamage, gpGlobals->v_forward, &tr, (DMG_NEVERGIB | DMG_BULLET));\n\t\tApplyMultiDamage(m_pPlayer->pev, m_pPlayer->pev);\n\n#ifndef REGAMEDLL_FIXES\n\t\tif (pEntity != NULL)\t// -V595\n#endif\n\t\t{\n\t\t\tif (pEntity->Classify() != CLASS_NONE && pEntity->Classify() != CLASS_MACHINE)\n\t\t\t{\n\t\t\t\tEMIT_SOUND(m_pPlayer->edict(), CHAN_WEAPON, \"weapons/knife_stab.wav\", VOL_NORM, ATTN_NORM);\n\t\t\t\tm_pPlayer->m_iWeaponVolume = KNIFE_BODYHIT_VOLUME;\n\n\t\t\t\tif (!pEntity->IsAlive())\n\t\t\t\t\treturn TRUE;\n\t\t\t\telse\n\t\t\t\t\tflVol = 0.1f;\n\n\t\t\t\tfHitWorld = FALSE;\n\t\t\t}\n\t\t}\n\n\t\t// play texture hit sound\n\t\t// UNDONE: Calculate the correct point of intersection when we hit with the hull instead of the line\n\n\t\tif (fHitWorld)\n\t\t{\n#ifndef CLIENT_DLL\n\t\t\tfloat fvolbar = TEXTURETYPE_PlaySound(&tr, vecSrc, vecSrc + (vecEnd - vecSrc) * 2, BULLET_PLAYER_CROWBAR);\n\t\t\t//fvolbar = 1.0;\n#endif\n\n\t\t\tif (RANDOM_LONG(0, 1) > 1)\n\t\t\t{\n\t\t\t\tfHitWorld = FALSE;\n\t\t\t}\n\t\t}\n\n\t\tif (!fHitWorld)\n\t\t{\n\t\t\t// delay the decal a bit\n\t\t\tm_trHit = tr;\n\t\t\tm_pPlayer->m_iWeaponVolume = int(flVol * KNIFE_WALLHIT_VOLUME);\n\n\t\t\tSetThink(&CKnife::Smack);\n\t\t\tpev->nextthink = UTIL_WeaponTimeBase() + 0.2f;\n\n\t\t\tResetPlayerShieldAnim();\n\t\t}\n\t\telse\n\t\t{\n\t\t\t// also play knife strike\n\t\t\tEMIT_SOUND_DYN(m_pPlayer->edict(), CHAN_ITEM, \"weapons/knife_hitwall1.wav\", VOL_NORM, ATTN_NORM, 0, RANDOM_LONG(0, 3) + 98);\n\t\t}\n\t}\n\n\treturn fDidHit;\n}\n"
  },
  {
    "path": "dlls/wpn_shared/wpn_m249.cpp",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\n*\tThis product contains software technology licensed from Id\n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc.\n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n\n#include \"stdafx.h\"\n#include \"cbase.h\"\n#include \"player.h\"\n#include \"weapons.h\"\n\nLINK_ENTITY_TO_CLASS(weapon_m249, CM249)\n\nvoid CM249::Spawn()\n{\n\tpev->classname = MAKE_STRING(\"weapon_m249\");\n\n\tPrecache();\n\n\tm_iId = WEAPON_M249;\n\tSET_MODEL(edict(), \"models/w_m249.mdl\");\n\n\tm_iDefaultAmmo = M249_DEFAULT_GIVE;\n\tm_flAccuracy = 0.2f;\n\tm_iShotsFired = 0;\n\n\tFallInit();\n}\n\nvoid CM249::Precache()\n{\n\tPRECACHE_MODEL(\"models/v_m249.mdl\");\n\tPRECACHE_MODEL(\"models/w_m249.mdl\");\n\n\tPRECACHE_SOUND(\"weapons/m249-1.wav\");\n\tPRECACHE_SOUND(\"weapons/m249-2.wav\");\n\tPRECACHE_SOUND(\"weapons/m249_boxout.wav\");\n\tPRECACHE_SOUND(\"weapons/m249_boxin.wav\");\n\tPRECACHE_SOUND(\"weapons/m249_chain.wav\");\n\tPRECACHE_SOUND(\"weapons/m249_coverup.wav\");\n\tPRECACHE_SOUND(\"weapons/m249_coverdown.wav\");\n\n\tm_iShell = PRECACHE_MODEL(\"models/rshell.mdl\");\n\tm_usFireM249 = PRECACHE_EVENT(1, \"events/m249.sc\");\n}\n\nint CM249::GetItemInfo(ItemInfo *p)\n{\n\tp->pszName = STRING(pev->classname);\n\tp->pszAmmo1 = \"556NatoBox\";\n\tp->iMaxAmmo1 = MAX_AMMO_556NATOBOX;\n\tp->pszAmmo2 = NULL;\n\tp->iMaxAmmo2 = -1;\n\tp->iMaxClip = M249_MAX_CLIP;\n\tp->iSlot = 0;\n\tp->iPosition = 4;\n\tp->iId = m_iId = WEAPON_M249;\n\tp->iFlags = 0;\n\tp->iWeight = M249_WEIGHT;\n\n\treturn 1;\n}\n\nBOOL CM249::Deploy()\n{\n\tm_flAccuracy = 0.2f;\n\tm_iShotsFired = 0;\n\tiShellOn = 1;\n\n\treturn DefaultDeploy(\"models/v_m249.mdl\", \"models/p_m249.mdl\", M249_DRAW, \"m249\", UseDecrement() != FALSE);\n}\n\nvoid CM249::PrimaryAttack()\n{\n\tif (!(m_pPlayer->pev->flags & FL_ONGROUND))\n\t{\n\t\tM249Fire(0.045 + (0.5 * m_flAccuracy), 0.1, FALSE);\n\t}\n\telse if (m_pPlayer->pev->velocity.Length2D() > 140)\n\t{\n\t\tM249Fire(0.045 + (0.095 * m_flAccuracy), 0.1, FALSE);\n\t}\n\telse\n\t{\n\t\tM249Fire(0.03 * m_flAccuracy, 0.1, FALSE);\n\t}\n}\n\nvoid CM249::M249Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim)\n{\n\tVector vecAiming, vecSrc, vecDir;\n\tint flag;\n\n\tm_bDelayFire = true;\n\t++m_iShotsFired;\n\n\tm_flAccuracy = ((m_iShotsFired * m_iShotsFired * m_iShotsFired) / 175) + 0.4f;\n\n\tif (m_flAccuracy > 0.9f)\n\t\tm_flAccuracy = 0.9f;\n\n\tif (m_iClip <= 0)\n\t{\n\t\tif (m_fFireOnEmpty)\n\t\t{\n\t\t\tPlayEmptySound();\n\t\t\tm_flNextPrimaryAttack = GetNextAttackDelay(0.2);\n\t\t}\n\n#ifndef CLIENT_DLL\n\t\tif (TheBots != NULL)\n\t\t{\n\t\t\tTheBots->OnEvent(EVENT_WEAPON_FIRED_ON_EMPTY, m_pPlayer);\n\t\t}\n#endif\n\n\t\treturn;\n\t}\n\n\t--m_iClip;\n\tm_pPlayer->pev->effects |= EF_MUZZLEFLASH;\n#ifndef CLIENT_DLL\n\tm_pPlayer->SetAnimation(PLAYER_ATTACK1);\n#endif\n\n\tUTIL_MakeVectors(m_pPlayer->pev->v_angle + m_pPlayer->pev->punchangle);\n\n\tm_pPlayer->m_iWeaponVolume = NORMAL_GUN_VOLUME;\n\tm_pPlayer->m_iWeaponFlash = BRIGHT_GUN_FLASH;\n\n\tvecSrc = m_pPlayer->GetGunPosition();\n\tvecAiming = gpGlobals->v_forward;\n\n\tvecDir = m_pPlayer->FireBullets3(vecSrc, vecAiming, flSpread, 8192, 2, BULLET_PLAYER_556MM,\n\t\tM249_DAMAGE, M249_RANGE_MODIFER, m_pPlayer->pev, false, m_pPlayer->random_seed);\n\n#ifdef CLIENT_WEAPONS\n\tflag = FEV_NOTHOST;\n#else\n\tflag = 0;\n#endif\n\n\tPLAYBACK_EVENT_FULL(flag, m_pPlayer->edict(), m_usFireM249, 0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y,\n\t\tint(m_pPlayer->pev->punchangle.x * 100), int(m_pPlayer->pev->punchangle.y * 100), FALSE, FALSE);\n\n\tm_flNextPrimaryAttack = m_flNextSecondaryAttack = GetNextAttackDelay(flCycleTime);\n\n#ifndef CLIENT_DLL\n\tif (!m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0)\n\t{\n\t\tm_pPlayer->SetSuitUpdate(\"!HEV_AMO0\", FALSE, 0);\n\t}\n#endif\n\n\tm_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.6f;\n\n\tif (!(m_pPlayer->pev->flags & FL_ONGROUND))\n\t{\n\t\tKickBack(1.8, 0.65, 0.45, 0.125, 5.0, 3.5, 8);\n\t}\n\telse if (m_pPlayer->pev->velocity.Length2D() > 0)\n\t{\n\t\tKickBack(1.1, 0.5, 0.3, 0.06, 4.0, 3.0, 8);\n\t}\n\telse if (m_pPlayer->pev->flags & FL_DUCKING)\n\t{\n\t\tKickBack(0.75, 0.325, 0.25, 0.025, 3.5, 2.5, 9);\n\t}\n\telse\n\t{\n\t\tKickBack(0.8, 0.35, 0.3, 0.03, 3.75, 3.0, 9);\n\t}\n}\n\nvoid CM249::Reload()\n{\n#ifdef REGAMEDLL_FIXES\n\t// to prevent reload if not enough ammo\n\tif (m_pPlayer->ammo_556natobox <= 0)\n\t\treturn;\n#endif\n\n\tif (DefaultReload(iMaxClip(), M249_RELOAD, M249_RELOAD_TIME))\n\t{\n#ifndef CLIENT_DLL\n\t\tm_pPlayer->SetAnimation(PLAYER_RELOAD);\n#endif\n\t\tm_flAccuracy = 0.2f;\n\t\tm_bDelayFire = false;\n\t\tm_iShotsFired = 0;\n\t}\n}\n\nvoid CM249::WeaponIdle()\n{\n\tResetEmptySound();\n\tm_pPlayer->GetAutoaimVector(AUTOAIM_10DEGREES);\n\n\tif (m_flTimeWeaponIdle > UTIL_WeaponTimeBase())\n\t{\n\t\treturn;\n\t}\n\n\tm_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 20.0f;\n\tSendWeaponAnim(M249_IDLE1, UseDecrement() != FALSE);\n}\n"
  },
  {
    "path": "dlls/wpn_shared/wpn_m3.cpp",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\n*\tThis product contains software technology licensed from Id\n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc.\n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n\n#include \"stdafx.h\"\n#include \"cbase.h\"\n#include \"player.h\"\n#include \"weapons.h\"\n\nLINK_ENTITY_TO_CLASS(weapon_m3, CM3)\n\nvoid CM3::Spawn(void)\n{\n\tpev->classname = MAKE_STRING(\"weapon_m3\");\n\n\tPrecache();\n\n\tm_iId = WEAPON_M3;\n\tSET_MODEL(edict(), \"models/w_m3.mdl\");\n\n\tm_iDefaultAmmo = M3_DEFAULT_GIVE;\n\n\tFallInit();\n}\n\nvoid CM3::Precache()\n{\n\tPRECACHE_MODEL(\"models/v_m3.mdl\");\n\tPRECACHE_MODEL(\"models/w_m3.mdl\");\n\n\tm_iShellId = m_iShell = PRECACHE_MODEL(\"models/shotgunshell.mdl\");\n\n\tPRECACHE_SOUND(\"weapons/m3-1.wav\");\n\tPRECACHE_SOUND(\"weapons/m3_insertshell.wav\");\n\tPRECACHE_SOUND(\"weapons/m3_pump.wav\");\n\tPRECACHE_SOUND(\"weapons/reload1.wav\");\n\tPRECACHE_SOUND(\"weapons/reload3.wav\");\n\n\tm_usFireM3 = PRECACHE_EVENT(1, \"events/m3.sc\");\n}\n\nint CM3::GetItemInfo(ItemInfo *p)\n{\n\tp->pszName = STRING(pev->classname);\n\tp->pszAmmo1 = \"buckshot\";\n\tp->iMaxAmmo1 = MAX_AMMO_BUCKSHOT;\n\tp->pszAmmo2 = NULL;\n\tp->iMaxAmmo2 = -1;\n\tp->iMaxClip = M3_MAX_CLIP;\n\tp->iSlot = 0;\n\tp->iPosition = 5;\n\tp->iId = m_iId = WEAPON_M3;\n\tp->iFlags = 0;\n\tp->iWeight = M3_WEIGHT;\n\n\treturn 1;\n}\n\nBOOL CM3::Deploy()\n{\n\treturn DefaultDeploy(\"models/v_m3.mdl\", \"models/p_m3.mdl\", M3_DRAW, \"shotgun\", UseDecrement() != FALSE);\n}\n\nvoid CM3::PrimaryAttack()\n{\n\tVector vecAiming, vecSrc, vecDir;\n\tint flag;\n\n\t// don't fire underwater\n\tif (m_pPlayer->pev->waterlevel == 3)\n\t{\n\t\tPlayEmptySound();\n\t\tm_flNextPrimaryAttack = GetNextAttackDelay(0.15);\n\t\treturn;\n\t}\n\n\tif (m_iClip <= 0)\n\t{\n\t\tReload();\n\n\t\tif (!m_iClip)\n\t\t{\n\t\t\tPlayEmptySound();\n\t\t}\n\n#ifndef CLIENT_DLL\n\t\tif (TheBots != NULL)\n\t\t{\n\t\t\tTheBots->OnEvent(EVENT_WEAPON_FIRED_ON_EMPTY, m_pPlayer);\n\t\t}\n#endif\n\n\t\tm_flNextPrimaryAttack = GetNextAttackDelay(1);\n\t\treturn;\n\t}\n\n\tm_pPlayer->m_iWeaponVolume = LOUD_GUN_VOLUME;\n\tm_pPlayer->m_iWeaponFlash = BRIGHT_GUN_FLASH;\n\t--m_iClip;\n\n\tm_pPlayer->pev->effects |= EF_MUZZLEFLASH;\n#ifndef CLIENT_DLL\n\t// player \"shoot\" animation\n\tm_pPlayer->SetAnimation(PLAYER_ATTACK1);\n#endif\n\n\tUTIL_MakeVectors(m_pPlayer->pev->v_angle + m_pPlayer->pev->punchangle);\n\n\tvecSrc = m_pPlayer->GetGunPosition();\n\tvecAiming = gpGlobals->v_forward;\n\n#ifndef CLIENT_DLL\n\tm_pPlayer->FireBullets(9, vecSrc, vecAiming, M3_CONE_VECTOR, 3000, BULLET_PLAYER_BUCKSHOT, 0);\n#endif\n\n#ifdef CLIENT_WEAPONS\n\tflag = FEV_NOTHOST;\n#else\n\tflag = 0;\n#endif\n\n\tPLAYBACK_EVENT_FULL(flag, m_pPlayer->edict(), m_usFireM3, 0, (float *)&g_vecZero, (float *)&g_vecZero, 0, 0, 0, 0, FALSE, FALSE);\n\n#ifndef CLIENT_DLL\n\tif (!m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0)\n\t{\n\t\t// HEV suit - indicate out of ammo condition\n\t\tm_pPlayer->SetSuitUpdate(\"!HEV_AMO0\", FALSE, 0);\n\t}\n#endif\n\n\tif (m_iClip != 0)\n\t\tm_flPumpTime = UTIL_WeaponTimeBase() + 0.5f;\n\n\tm_flNextPrimaryAttack = GetNextAttackDelay(0.875);\n\tm_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.875f;\n\n\tif (m_iClip != 0)\n\t\tm_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 2.5f;\n\telse\n\t\tm_flTimeWeaponIdle = 0.875f;\n\n\tm_fInSpecialReload = 0;\n\n\tif (m_pPlayer->pev->flags & FL_ONGROUND)\n\t\tm_pPlayer->pev->punchangle.x -= UTIL_SharedRandomLong(m_pPlayer->random_seed + 1, 4, 6);\n\telse\n\t\tm_pPlayer->pev->punchangle.x -= UTIL_SharedRandomLong(m_pPlayer->random_seed + 1, 8, 11);\n\n\tm_pPlayer->m_flEjectBrass = gpGlobals->time + 0.45f;\n}\n\nvoid CM3::Reload()\n{\n\tif (m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0 || m_iClip == iMaxClip())\n\t\treturn;\n\n\t// don't reload until recoil is done\n\tif (m_flNextPrimaryAttack > UTIL_WeaponTimeBase())\n\t\treturn;\n\n\t// check to see if we're ready to reload\n\tif (m_fInSpecialReload == 0)\n\t{\n#ifndef CLIENT_DLL\n\t\tm_pPlayer->SetAnimation(PLAYER_RELOAD);\n#endif\n\t\tSendWeaponAnim(M3_START_RELOAD, UseDecrement() != FALSE);\n\n\t\tm_fInSpecialReload = 1;\n\t\tm_flNextSecondaryAttack = m_flTimeWeaponIdle = m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.55f;\n\t\tm_flNextPrimaryAttack = GetNextAttackDelay(0.55);\n\t}\n\telse if (m_fInSpecialReload == 1)\n\t{\n\t\tif (m_flTimeWeaponIdle > UTIL_WeaponTimeBase())\n\t\t\treturn;\n\n\t\t// was waiting for gun to move to side\n\t\tm_fInSpecialReload = 2;\n\t\tSendWeaponAnim(M3_RELOAD, UseDecrement());\n\n\t\tm_flTimeWeaponIdle = m_flNextReload = UTIL_WeaponTimeBase() + 0.45f;\n\t}\n\telse\n\t{\n\t\t++m_iClip;\n\n#ifdef REGAMEDLL_ADD\n\t\tif (refill_bpammo_weapons.value < 3.0f)\n#endif\n\t\t{\n\t\t\t--m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType];\n\t\t\t--m_pPlayer->ammo_buckshot;\n\t\t}\n\n\t\tm_fInSpecialReload = 1;\n\t}\n}\n\nvoid CM3::WeaponIdle()\n{\n\tResetEmptySound();\n\tm_pPlayer->GetAutoaimVector(AUTOAIM_5DEGREES);\n\n\tif (m_flPumpTime && m_flPumpTime < UTIL_WeaponTimeBase())\n\t{\n\t\tm_flPumpTime = 0;\n\t}\n\n\tif (m_flTimeWeaponIdle < UTIL_WeaponTimeBase())\n\t{\n\t\tif (m_iClip == 0 && m_fInSpecialReload == 0 && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType])\n\t\t{\n\t\t\tReload();\n\t\t}\n\t\telse if (m_fInSpecialReload != 0)\n\t\t{\n\t\t\tif (m_iClip != iMaxClip() && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType])\n\t\t\t{\n\t\t\t\tReload();\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t// reload debounce has timed out\n\t\t\t\tSendWeaponAnim(M3_PUMP, UseDecrement() != FALSE);\n\n\t\t\t\tm_fInSpecialReload = 0;\n\t\t\t\tm_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.5f;\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tSendWeaponAnim(M3_IDLE, UseDecrement() != FALSE);\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "dlls/wpn_shared/wpn_m4a1.cpp",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\n*\tThis product contains software technology licensed from Id\n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc.\n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n\n#include \"stdafx.h\"\n#include \"cbase.h\"\n#include \"player.h\"\n#include \"weapons.h\"\n\nLINK_ENTITY_TO_CLASS(weapon_m4a1, CM4A1)\n\nvoid CM4A1::Spawn(void)\n{\n\tpev->classname = MAKE_STRING(\"weapon_m4a1\");\n\n\tPrecache();\n\n\tm_iId = WEAPON_M4A1;\n\tSET_MODEL(edict(), \"models/w_m4a1.mdl\");\n\n\tm_iDefaultAmmo = M4A1_DEFAULT_GIVE;\n\tm_flAccuracy = 0.2f;\n\tm_iShotsFired = 0;\n\tm_bDelayFire = true;\n\n\tFallInit();\n}\n\nvoid CM4A1::Precache()\n{\n\tPRECACHE_MODEL(\"models/v_m4a1.mdl\");\n\tPRECACHE_MODEL(\"models/w_m4a1.mdl\");\n\n\tPRECACHE_SOUND(\"weapons/m4a1-1.wav\");\n\tPRECACHE_SOUND(\"weapons/m4a1_unsil-1.wav\");\n\tPRECACHE_SOUND(\"weapons/m4a1_unsil-2.wav\");\n\tPRECACHE_SOUND(\"weapons/m4a1_clipin.wav\");\n\tPRECACHE_SOUND(\"weapons/m4a1_clipout.wav\");\n\tPRECACHE_SOUND(\"weapons/m4a1_boltpull.wav\");\n\tPRECACHE_SOUND(\"weapons/m4a1_deploy.wav\");\n\tPRECACHE_SOUND(\"weapons/m4a1_silencer_on.wav\");\n\tPRECACHE_SOUND(\"weapons/m4a1_silencer_off.wav\");\n\n\tm_iShell = PRECACHE_MODEL(\"models/rshell.mdl\");\n\tm_usFireM4A1 = PRECACHE_EVENT(1, \"events/m4a1.sc\");\n}\n\nint CM4A1::GetItemInfo(ItemInfo *p)\n{\n\tp->pszName = STRING(pev->classname);\n\tp->pszAmmo1 = \"556Nato\";\n\tp->iMaxAmmo1 = MAX_AMMO_556NATO;\n\tp->pszAmmo2 = NULL;\n\tp->iMaxAmmo2 = -1;\n\tp->iMaxClip = M4A1_MAX_CLIP;\n\tp->iSlot = 0;\n\tp->iPosition = 6;\n\tp->iId = m_iId = WEAPON_M4A1;\n\tp->iFlags = 0;\n\tp->iWeight = M4A1_WEIGHT;\n\n\treturn 1;\n}\n\nBOOL CM4A1::Deploy()\n{\n\tm_bDelayFire = true;\n\tm_flAccuracy = 0.2f;\n\tm_iShotsFired = 0;\n\n\tiShellOn = 1;\n\n\tif (m_iWeaponState & WPNSTATE_M4A1_SILENCED)\n\t\treturn DefaultDeploy(\"models/v_m4a1.mdl\", \"models/p_m4a1.mdl\", M4A1_DRAW, \"rifle\", UseDecrement() != FALSE);\n\telse\n\t\treturn DefaultDeploy(\"models/v_m4a1.mdl\", \"models/p_m4a1.mdl\", M4A1_UNSIL_DRAW, \"rifle\", UseDecrement() != FALSE);\n}\n\nvoid CM4A1::SecondaryAttack()\n{\n\tif (m_iWeaponState & WPNSTATE_M4A1_SILENCED)\n\t{\n\t\tm_iWeaponState &= ~WPNSTATE_M4A1_SILENCED;\n\t\tSendWeaponAnim(M4A1_DETACH_SILENCER, UseDecrement() != FALSE);\n\t\tstrcpy(m_pPlayer->m_szAnimExtention, \"rifle\");\n\t}\n\telse\n\t{\n\t\tm_iWeaponState |= WPNSTATE_M4A1_SILENCED;\n\t\tSendWeaponAnim(M4A1_ATTACH_SILENCER, UseDecrement() != FALSE);\n\t\tstrcpy(m_pPlayer->m_szAnimExtention, \"rifle\");\n\t}\n\n\tm_flTimeWeaponIdle = m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 2.0f;\n\tm_flNextPrimaryAttack = GetNextAttackDelay(2.0);\n}\n\nvoid CM4A1::PrimaryAttack()\n{\n\tif (m_iWeaponState & WPNSTATE_M4A1_SILENCED)\n\t{\n\t\tif (!(m_pPlayer->pev->flags & FL_ONGROUND))\n\t\t{\n\t\t\tM4A1Fire(0.035 + (0.4 * m_flAccuracy), 0.0875, FALSE);\n\t\t}\n\t\telse if (m_pPlayer->pev->velocity.Length2D() > 140)\n\t\t{\n\t\t\tM4A1Fire(0.035 + (0.07 * m_flAccuracy), 0.0875, FALSE);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tM4A1Fire(0.025 * m_flAccuracy, 0.0875, FALSE);\n\t\t}\n\t}\n\telse\n\t{\n\t\tif (!(m_pPlayer->pev->flags & FL_ONGROUND))\n\t\t{\n\t\t\tM4A1Fire(0.035 + (0.4 * m_flAccuracy), 0.0875, FALSE);\n\t\t}\n\t\telse if (m_pPlayer->pev->velocity.Length2D() > 140)\n\t\t{\n\t\t\tM4A1Fire(0.035 + (0.07 * m_flAccuracy), 0.0875, FALSE);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tM4A1Fire(0.02 * m_flAccuracy, 0.0875, FALSE);\n\t\t}\n\t}\n}\n\nvoid CM4A1::M4A1Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim)\n{\n\tVector vecAiming, vecSrc, vecDir;\n\tint flag;\n\n\tm_bDelayFire = true;\n\t++m_iShotsFired;\n\n\tm_flAccuracy = ((m_iShotsFired * m_iShotsFired * m_iShotsFired) / 220) + 0.3f;\n\n\tif (m_flAccuracy > 1)\n\t\tm_flAccuracy = 1;\n\n\tif (m_iClip <= 0)\n\t{\n\t\tif (m_fFireOnEmpty)\n\t\t{\n\t\t\tPlayEmptySound();\n\t\t\tm_flNextPrimaryAttack = GetNextAttackDelay(0.2);\n\t\t}\n\n#ifndef CLIENT_DLL\n\t\tif (TheBots != NULL)\n\t\t{\n\t\t\tTheBots->OnEvent(EVENT_WEAPON_FIRED_ON_EMPTY, m_pPlayer);\n\t\t}\n#endif\n\n\t\treturn;\n\t}\n\n\t--m_iClip;\n#ifndef CLIENT_DLL\n\tm_pPlayer->SetAnimation(PLAYER_ATTACK1);\n#endif\n\tUTIL_MakeVectors(m_pPlayer->pev->v_angle + m_pPlayer->pev->punchangle);\n\n\tm_pPlayer->m_iWeaponVolume = NORMAL_GUN_VOLUME;\n\tm_pPlayer->m_iWeaponFlash = BRIGHT_GUN_FLASH;\n\n\tvecSrc = m_pPlayer->GetGunPosition();\n\tvecAiming = gpGlobals->v_forward;\n\n\tif (m_iWeaponState & WPNSTATE_M4A1_SILENCED)\n\t{\n\t\tvecDir = m_pPlayer->FireBullets3(vecSrc, vecAiming, flSpread, 8192, 2, BULLET_PLAYER_556MM,\n\t\t\tM4A1_DAMAGE_SIL, M4A1_RANGE_MODIFER_SIL, m_pPlayer->pev, false, m_pPlayer->random_seed);\n\t}\n\telse\n\t{\n\t\tvecDir = m_pPlayer->FireBullets3(vecSrc, vecAiming, flSpread, 8192, 2, BULLET_PLAYER_556MM,\n\t\t\tM4A1_DAMAGE, M4A1_RANGE_MODIFER, m_pPlayer->pev, false, m_pPlayer->random_seed);\n\n\t\tm_pPlayer->pev->effects |= EF_MUZZLEFLASH;\n\t}\n\n#ifdef CLIENT_WEAPONS\n\tflag = FEV_NOTHOST;\n#else\n\tflag = 0;\n#endif\n\n#ifndef REGAMEDLL_FIXES\n\t--m_pPlayer->ammo_556nato;\n#endif\n\n\tPLAYBACK_EVENT_FULL(flag, m_pPlayer->edict(), m_usFireM4A1, 0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y,\n\t\tint(m_pPlayer->pev->punchangle.x * 100), int(m_pPlayer->pev->punchangle.y * 100), (m_iWeaponState & WPNSTATE_M4A1_SILENCED) == WPNSTATE_M4A1_SILENCED, FALSE);\n\n\tm_flNextPrimaryAttack = m_flNextSecondaryAttack = GetNextAttackDelay(flCycleTime);\n#ifndef CLIENT_DLL\n\tif (!m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0)\n\t{\n\t\tm_pPlayer->SetSuitUpdate(\"!HEV_AMO0\", FALSE, 0);\n\t}\n#endif\n\tm_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.5f;\n\n\tif (m_pPlayer->pev->velocity.Length2D() > 0)\n\t{\n\t\tKickBack(1.0, 0.45, 0.28, 0.045, 3.75, 3.0, 7);\n\t}\n\telse if (!(m_pPlayer->pev->flags & FL_ONGROUND))\n\t{\n\t\tKickBack(1.2, 0.5, 0.23, 0.15, 5.5, 3.5, 6);\n\t}\n\telse if (m_pPlayer->pev->flags & FL_DUCKING)\n\t{\n\t\tKickBack(0.6, 0.3, 0.2, 0.0125, 3.25, 2.0, 7);\n\t}\n\telse\n\t{\n\t\tKickBack(0.65, 0.35, 0.25, 0.015, 3.5, 2.25, 7);\n\t}\n}\n\nvoid CM4A1::Reload()\n{\n\tif (m_pPlayer->ammo_556nato <= 0)\n\t\treturn;\n\n\tif (DefaultReload(iMaxClip(), ((m_iWeaponState & WPNSTATE_M4A1_SILENCED) == WPNSTATE_M4A1_SILENCED) ? M4A1_RELOAD : M4A1_UNSIL_RELOAD, M4A1_RELOAD_TIME))\n\t{\n#ifndef CLIENT_DLL\n\t\tm_pPlayer->SetAnimation(PLAYER_RELOAD);\n#endif\n\t\tm_flAccuracy = 0.2f;\n\t\tm_iShotsFired = 0;\n\t\tm_bDelayFire = false;\n\t}\n}\n\nvoid CM4A1::WeaponIdle()\n{\n\tResetEmptySound();\n\tm_pPlayer->GetAutoaimVector(AUTOAIM_10DEGREES);\n\n\tif (m_flTimeWeaponIdle > UTIL_WeaponTimeBase())\n\t{\n\t\treturn;\n\t}\n\n\tm_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 20.0f;\n\tSendWeaponAnim((m_iWeaponState & WPNSTATE_M4A1_SILENCED) == WPNSTATE_M4A1_SILENCED ? M4A1_IDLE : M4A1_UNSIL_IDLE, UseDecrement() != FALSE);\n}\n"
  },
  {
    "path": "dlls/wpn_shared/wpn_mac10.cpp",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\n*\tThis product contains software technology licensed from Id\n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc.\n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n\n#include \"stdafx.h\"\n#include \"cbase.h\"\n#include \"player.h\"\n#include \"weapons.h\"\n\nLINK_ENTITY_TO_CLASS(weapon_mac10, CMAC10)\n\nvoid CMAC10::Spawn(void)\n{\n\tpev->classname = MAKE_STRING(\"weapon_mac10\");\n\n\tPrecache();\n\n\tm_iId = WEAPON_MAC10;\n\tSET_MODEL(edict(), \"models/w_mac10.mdl\");\n\n\tm_iDefaultAmmo = MAC10_DEFAULT_GIVE;\n\tm_flAccuracy = 0.15f;\n\tm_bDelayFire = false;\n\n\tFallInit();\n}\n\nvoid CMAC10::Precache()\n{\n\tPRECACHE_MODEL(\"models/v_mac10.mdl\");\n\tPRECACHE_MODEL(\"models/w_mac10.mdl\");\n\n\tPRECACHE_SOUND(\"weapons/mac10-1.wav\");\n\tPRECACHE_SOUND(\"weapons/mac10_clipout.wav\");\n\tPRECACHE_SOUND(\"weapons/mac10_clipin.wav\");\n\tPRECACHE_SOUND(\"weapons/mac10_boltpull.wav\");\n\n\tm_iShell = PRECACHE_MODEL(\"models/pshell.mdl\");\n\tm_usFireMAC10 = PRECACHE_EVENT(1, \"events/mac10.sc\");\n}\n\nint CMAC10::GetItemInfo(ItemInfo *p)\n{\n\tp->pszName = STRING(pev->classname);\n\tp->pszAmmo1 = \"45acp\";\n\tp->iMaxAmmo1 = MAX_AMMO_45ACP;\n\tp->pszAmmo2 = NULL;\n\tp->iMaxAmmo2 = -1;\n\tp->iMaxClip = MAC10_MAX_CLIP;\n\tp->iSlot = 0;\n\tp->iPosition = 13;\n\tp->iId = m_iId = WEAPON_MAC10;\n\tp->iFlags = 0;\n\tp->iWeight = MAC10_WEIGHT;\n\n\treturn 1;\n}\n\nBOOL CMAC10::Deploy()\n{\n\tm_flAccuracy = 0.15f;\n\tiShellOn = 1;\n\tm_bDelayFire = false;\n\n\treturn DefaultDeploy(\"models/v_mac10.mdl\", \"models/p_mac10.mdl\", MAC10_DRAW, \"onehanded\", UseDecrement() != FALSE);\n}\n\nvoid CMAC10::PrimaryAttack()\n{\n\tif (!(m_pPlayer->pev->flags & FL_ONGROUND))\n\t{\n\t\tMAC10Fire(0.375 * m_flAccuracy, 0.07, FALSE);\n\t}\n\telse\n\t{\n\t\tMAC10Fire(0.03 * m_flAccuracy, 0.07, FALSE);\n\t}\n}\n\nvoid CMAC10::MAC10Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim)\n{\n\tVector vecAiming, vecSrc, vecDir;\n\tint flag;\n\n\tm_bDelayFire = true;\n\t++m_iShotsFired;\n\n\tm_flAccuracy = ((m_iShotsFired * m_iShotsFired * m_iShotsFired) / 200) + 0.6f;\n\n\tif (m_flAccuracy > 1.65f)\n\t\tm_flAccuracy = 1.65f;\n\n\tif (m_iClip <= 0)\n\t{\n\t\tif (m_fFireOnEmpty)\n\t\t{\n\t\t\tPlayEmptySound();\n\t\t\tm_flNextPrimaryAttack = GetNextAttackDelay(0.2);\n\t\t}\n\n#ifndef CLIENT_DLL\n\t\tif (TheBots != NULL)\n\t\t{\n\t\t\tTheBots->OnEvent(EVENT_WEAPON_FIRED_ON_EMPTY, m_pPlayer);\n\t\t}\n#endif\n\n\t\treturn;\n\t}\n\n\t--m_iClip;\n\tm_pPlayer->pev->effects |= EF_MUZZLEFLASH;\n#ifndef CLIENT_DLL\n\tm_pPlayer->SetAnimation(PLAYER_ATTACK1);\n#endif\n\tUTIL_MakeVectors(m_pPlayer->pev->v_angle + m_pPlayer->pev->punchangle);\n\n\tm_pPlayer->m_iWeaponVolume = NORMAL_GUN_VOLUME;\n\tm_pPlayer->m_iWeaponFlash = DIM_GUN_FLASH;\n\n\tvecSrc = m_pPlayer->GetGunPosition();\n\tvecAiming = gpGlobals->v_forward;\n\n\tvecDir = m_pPlayer->FireBullets3(vecSrc, vecAiming, flSpread, 8192, 1, BULLET_PLAYER_45ACP,\n\t\tMAC10_DAMAGE, MAC10_RANGE_MODIFER, m_pPlayer->pev, false, m_pPlayer->random_seed);\n\n#ifdef CLIENT_WEAPONS\n\tflag = FEV_NOTHOST;\n#else\n\tflag = 0;\n#endif\n\n\tPLAYBACK_EVENT_FULL(flag, m_pPlayer->edict(), m_usFireMAC10, 0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y,\n\t\tint(m_pPlayer->pev->punchangle.x * 100), int(m_pPlayer->pev->punchangle.y * 100), FALSE, FALSE);\n\n\tm_flNextPrimaryAttack = m_flNextSecondaryAttack = GetNextAttackDelay(flCycleTime);\n\n\tif (!m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0)\n\t{\n#ifndef CLIENT_DLL\n\t\tm_pPlayer->SetSuitUpdate(\"!HEV_AMO0\", FALSE, 0);\n#endif\n\t}\n\n\tm_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 2.0f;\n\n\tif (!(m_pPlayer->pev->flags & FL_ONGROUND))\n\t{\n\t\tKickBack(1.3, 0.55, 0.4, 0.05, 4.75, 3.75, 5);\n\t}\n\telse if (m_pPlayer->pev->velocity.Length2D() > 0)\n\t{\n\t\tKickBack(0.9, 0.45, 0.25, 0.035, 3.5, 2.75, 7);\n\t}\n\telse if (m_pPlayer->pev->flags & FL_DUCKING)\n\t{\n\t\tKickBack(0.75, 0.4, 0.175, 0.03, 2.75, 2.5, 10);\n\t}\n\telse\n\t{\n\t\tKickBack(0.775, 0.425, 0.2, 0.03, 3.0, 2.75, 9);\n\t}\n}\n\nvoid CMAC10::Reload()\n{\n\tif (m_pPlayer->ammo_45acp <= 0)\n\t\treturn;\n\n\tif (DefaultReload(iMaxClip(), MAC10_RELOAD, MAC10_RELOAD_TIME))\n\t{\n#ifndef CLIENT_DLL\n\t\tm_pPlayer->SetAnimation(PLAYER_RELOAD);\n#endif\n\t\tm_flAccuracy = 0;\n\t\tm_iShotsFired = 0;\n\t}\n}\n\nvoid CMAC10::WeaponIdle()\n{\n\tResetEmptySound();\n\tm_pPlayer->GetAutoaimVector(AUTOAIM_10DEGREES);\n\n\tif (m_flTimeWeaponIdle > UTIL_WeaponTimeBase())\n\t{\n\t\treturn;\n\t}\n\n\tm_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 20.0f;\n\tSendWeaponAnim(MAC10_IDLE1, UseDecrement() != FALSE);\n}\n"
  },
  {
    "path": "dlls/wpn_shared/wpn_mp5navy.cpp",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\n*\tThis product contains software technology licensed from Id\n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc.\n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n\n#include \"stdafx.h\"\n#include \"cbase.h\"\n#include \"player.h\"\n#include \"weapons.h\"\n\nLINK_ENTITY_TO_CLASS(weapon_mp5navy, CMP5N)\n\nvoid CMP5N::Spawn(void)\n{\n\tpev->classname = MAKE_STRING(\"weapon_mp5navy\");\n\n\tPrecache();\n\n\tm_iId = WEAPON_MP5N;\n\tSET_MODEL(edict(), \"models/w_mp5.mdl\");\n\n\tm_iDefaultAmmo = MP5NAVY_DEFAULT_GIVE;\n\tm_flAccuracy = 0.0f;\n\tm_bDelayFire = false;\n\n\tFallInit();\n}\n\nvoid CMP5N::Precache()\n{\n\tPRECACHE_MODEL(\"models/v_mp5.mdl\");\n\tPRECACHE_MODEL(\"models/w_mp5.mdl\");\n\n\tPRECACHE_SOUND(\"weapons/mp5-1.wav\");\n\tPRECACHE_SOUND(\"weapons/mp5-2.wav\");\n\tPRECACHE_SOUND(\"weapons/mp5_clipout.wav\");\n\tPRECACHE_SOUND(\"weapons/mp5_clipin.wav\");\n\tPRECACHE_SOUND(\"weapons/mp5_slideback.wav\");\n\n\tm_iShell = PRECACHE_MODEL(\"models/pshell.mdl\");\n\tm_usFireMP5N = PRECACHE_EVENT(1, \"events/mp5n.sc\");\n}\n\nint CMP5N::GetItemInfo(ItemInfo *p)\n{\n\tp->pszName = STRING(pev->classname);\n\tp->pszAmmo1 = \"9mm\";\n\tp->iMaxAmmo1 = MAX_AMMO_9MM;\n\tp->pszAmmo2 = NULL;\n\tp->iMaxAmmo2 = -1;\n\tp->iMaxClip = MP5N_MAX_CLIP;\n\tp->iSlot = 0;\n\tp->iPosition = 7;\n\tp->iId = m_iId = WEAPON_MP5N;\n\tp->iFlags = 0;\n\tp->iWeight = MP5NAVY_WEIGHT;\n\n\treturn 1;\n}\n\nBOOL CMP5N::Deploy()\n{\n\tm_flAccuracy = 0.0f;\n\tm_bDelayFire = false;\n\tiShellOn = 1;\n\n\treturn DefaultDeploy(\"models/v_mp5.mdl\", \"models/p_mp5.mdl\", MP5N_DRAW, \"mp5\", UseDecrement() != FALSE);\n}\n\nvoid CMP5N::PrimaryAttack()\n{\n\tif (!(m_pPlayer->pev->flags & FL_ONGROUND))\n\t{\n\t\tMP5NFire(0.2 * m_flAccuracy, 0.075, FALSE);\n\t}\n\telse\n\t{\n\t\tMP5NFire(0.04 * m_flAccuracy, 0.075, FALSE);\n\t}\n}\n\nvoid CMP5N::MP5NFire(float flSpread, float flCycleTime, BOOL fUseAutoAim)\n{\n\tVector vecAiming, vecSrc, vecDir;\n\tint flag;\n\n\tm_bDelayFire = true;\n\t++m_iShotsFired;\n\n\tm_flAccuracy = ((m_iShotsFired * m_iShotsFired) / 220.1) + 0.45f;\n\n\tif (m_flAccuracy > 0.75f)\n\t\tm_flAccuracy = 0.75f;\n\n\tif (m_iClip <= 0)\n\t{\n\t\tif (m_fFireOnEmpty)\n\t\t{\n\t\t\tPlayEmptySound();\n\t\t\tm_flNextPrimaryAttack = GetNextAttackDelay(0.2);\n\t\t}\n\n#ifndef CLIENT_DLL\n\t\tif (TheBots != NULL)\n\t\t{\n\t\t\tTheBots->OnEvent(EVENT_WEAPON_FIRED_ON_EMPTY, m_pPlayer);\n\t\t}\n#endif\n\n\t\treturn;\n\t}\n\n\t--m_iClip;\n\tm_pPlayer->pev->effects |= EF_MUZZLEFLASH;\n#ifndef CLIENT_DLL\n\tm_pPlayer->SetAnimation(PLAYER_ATTACK1);\n#endif\n\tUTIL_MakeVectors(m_pPlayer->pev->v_angle + m_pPlayer->pev->punchangle);\n\n\tvecSrc = m_pPlayer->GetGunPosition();\n\tvecAiming = gpGlobals->v_forward;\n\n\tvecDir = m_pPlayer->FireBullets3(vecSrc, vecAiming, flSpread, 8192, 1, BULLET_PLAYER_9MM,\n\t\tMP5N_DAMAGE, MP5N_RANGE_MODIFER, m_pPlayer->pev, false, m_pPlayer->random_seed);\n\n#ifdef CLIENT_WEAPONS\n\tflag = FEV_NOTHOST;\n#else\n\tflag = 0;\n#endif\n\n\tPLAYBACK_EVENT_FULL(flag, m_pPlayer->edict(), m_usFireMP5N, 0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y,\n\t\tint(m_pPlayer->pev->punchangle.x * 100), int(m_pPlayer->pev->punchangle.y * 100), FALSE, FALSE);\n\n\tm_pPlayer->m_iWeaponVolume = NORMAL_GUN_VOLUME;\n\tm_pPlayer->m_iWeaponFlash = DIM_GUN_FLASH;\n\n\tm_flNextPrimaryAttack = m_flNextSecondaryAttack = GetNextAttackDelay(flCycleTime);\n\n\tif (!m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0)\n\t{\n#ifndef CLIENT_DLL\n\t\tm_pPlayer->SetSuitUpdate(\"!HEV_AMO0\", FALSE, 0);\n#endif\n\t}\n\n\tm_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 2.0f;\n\n\tif (!(m_pPlayer->pev->flags & FL_ONGROUND))\n\t{\n\t\tKickBack(0.9, 0.475, 0.35, 0.0425, 5.0, 3.0, 6);\n\t}\n\telse if (m_pPlayer->pev->velocity.Length2D() > 0)\n\t{\n\t\tKickBack(0.5, 0.275, 0.2, 0.03, 3.0, 2.0, 10);\n\t}\n\telse if (m_pPlayer->pev->flags & FL_DUCKING)\n\t{\n\t\tKickBack(0.225, 0.15, 0.1, 0.015, 2.0, 1.0, 10);\n\t}\n\telse\n\t{\n\t\tKickBack(0.25, 0.175, 0.125, 0.02, 2.25, 1.25, 10);\n\t}\n}\n\nvoid CMP5N::Reload()\n{\n\tif (m_pPlayer->ammo_9mm <= 0)\n\t\treturn;\n\n\tif (DefaultReload(iMaxClip(), MP5N_RELOAD, MP5N_RELOAD_TIME))\n\t{\n#ifndef CLIENT_DLL\n\t\tm_pPlayer->SetAnimation(PLAYER_RELOAD);\n#endif\n\t\tm_flAccuracy = 0;\n\t\tm_iShotsFired = 0;\n\t}\n}\n\nvoid CMP5N::WeaponIdle()\n{\n\tResetEmptySound();\n\tm_pPlayer->GetAutoaimVector(AUTOAIM_10DEGREES);\n\n\tif (m_flTimeWeaponIdle > UTIL_WeaponTimeBase())\n\t{\n\t\treturn;\n\t}\n\n\tm_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 20.0f;\n\tSendWeaponAnim(MP5N_IDLE1, UseDecrement() != FALSE);\n}\n"
  },
  {
    "path": "dlls/wpn_shared/wpn_p228.cpp",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\n*\tThis product contains software technology licensed from Id\n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc.\n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n\n#include \"stdafx.h\"\n#include \"cbase.h\"\n#include \"player.h\"\n#include \"weapons.h\"\n\nLINK_ENTITY_TO_CLASS(weapon_p228, CP228)\n\nvoid CP228::Spawn(void)\n{\n\tpev->classname = MAKE_STRING(\"weapon_p228\");\n\n\tPrecache();\n\n\tm_iId = WEAPON_P228;\n\tSET_MODEL(ENT(pev), \"models/w_p228.mdl\");\n\n\tm_iWeaponState &= ~WPNSTATE_SHIELD_DRAWN;\n\tm_iDefaultAmmo = P228_DEFAULT_GIVE;\n\tm_flAccuracy = 0.9f;\n\n\tFallInit();\n}\n\nvoid CP228::Precache()\n{\n\tPRECACHE_MODEL(\"models/v_p228.mdl\");\n\tPRECACHE_MODEL(\"models/w_p228.mdl\");\n\tPRECACHE_MODEL(\"models/shield/v_shield_p228.mdl\");\n\n\tPRECACHE_SOUND(\"weapons/p228-1.wav\");\n\tPRECACHE_SOUND(\"weapons/p228_clipout.wav\");\n\tPRECACHE_SOUND(\"weapons/p228_clipin.wav\");\n\tPRECACHE_SOUND(\"weapons/p228_sliderelease.wav\");\n\tPRECACHE_SOUND(\"weapons/p228_slidepull.wav\");\n\n\tm_iShell = PRECACHE_MODEL(\"models/pshell.mdl\");\n\tm_usFireP228 = PRECACHE_EVENT(1, \"events/p228.sc\");\n}\n\nint CP228::GetItemInfo(ItemInfo *p)\n{\n\tp->pszName = STRING(pev->classname);\n\tp->pszAmmo1 = \"357SIG\";\n\tp->iMaxAmmo1 = MAX_AMMO_357SIG;\n\tp->pszAmmo2 = NULL;\n\tp->iMaxAmmo2 = -1;\n\tp->iMaxClip = P228_MAX_CLIP;\n\tp->iSlot = 1;\n\tp->iPosition = 3;\n\tp->iId = m_iId = WEAPON_P228;\n\tp->iFlags = 0;\n\tp->iWeight = P228_WEIGHT;\n\n\treturn 1;\n}\n\nBOOL CP228::Deploy()\n{\n\tm_flAccuracy = 0.9f;\n\tm_fMaxSpeed = P228_MAX_SPEED;\n\tm_iWeaponState &= ~WPNSTATE_SHIELD_DRAWN;\n\tm_pPlayer->m_bShieldDrawn = false;\n\n\tif (m_pPlayer->HasShield())\n\t\treturn DefaultDeploy(\"models/shield/v_shield_p228.mdl\", \"models/shield/p_shield_p228.mdl\", P228_SHIELD_DRAW, \"shieldgun\", UseDecrement() != FALSE);\n\telse\n\t\treturn DefaultDeploy(\"models/v_p228.mdl\", \"models/p_p228.mdl\", P228_DRAW, \"onehanded\", UseDecrement() != FALSE);\n}\n\nvoid CP228::PrimaryAttack()\n{\n\tif (!(m_pPlayer->pev->flags & FL_ONGROUND))\n\t{\n\t\tP228Fire(1.5 * (1 - m_flAccuracy), 0.2, FALSE);\n\t}\n\telse if (m_pPlayer->pev->velocity.Length2D() > 0)\n\t{\n\t\tP228Fire(0.255 * (1 - m_flAccuracy), 0.2, FALSE);\n\t}\n\telse if (m_pPlayer->pev->flags & FL_DUCKING)\n\t{\n\t\tP228Fire(0.075 * (1 - m_flAccuracy), 0.2, FALSE);\n\t}\n\telse\n\t{\n\t\tP228Fire(0.15 * (1 - m_flAccuracy), 0.2, FALSE);\n\t}\n}\n\nvoid CP228::SecondaryAttack()\n{\n\tShieldSecondaryFire(SHIELDGUN_UP, SHIELDGUN_DOWN);\n}\n\nvoid CP228::P228Fire(float flSpread, float flCycleTime, BOOL fUseSemi)\n{\n\tVector vecAiming, vecSrc, vecDir;\n\tint flag;\n\n\tflCycleTime -= 0.05f;\n\n\tif (++m_iShotsFired > 1)\n\t{\n\t\treturn;\n\t}\n\n\tif (m_flLastFire != 0.0f)\n\t{\n\t\tm_flAccuracy -= (0.325f - (gpGlobals->time - m_flLastFire)) * 0.3f;\n\n\t\tif (m_flAccuracy > 0.9f)\n\t\t{\n\t\t\tm_flAccuracy = 0.9f;\n\t\t}\n\t\telse if (m_flAccuracy < 0.6f)\n\t\t{\n\t\t\tm_flAccuracy = 0.6f;\n\t\t}\n\t}\n\n\tm_flLastFire = gpGlobals->time;\n\n\tif (m_iClip <= 0)\n\t{\n\t\tif (m_fFireOnEmpty)\n\t\t{\n\t\t\tPlayEmptySound();\n\t\t\tm_flNextPrimaryAttack = GetNextAttackDelay(0.2);\n\t\t}\n\n#ifndef CLIENT_DLL\n\t\tif (TheBots != NULL)\n\t\t{\n\t\t\tTheBots->OnEvent(EVENT_WEAPON_FIRED_ON_EMPTY, m_pPlayer);\n\t\t}\n#endif\n\n\t\treturn;\n\t}\n\n\t--m_iClip;\n\tm_pPlayer->pev->effects |= EF_MUZZLEFLASH;\n\tSetPlayerShieldAnim();\n\n#ifndef CLIENT_DLL\n\tm_pPlayer->SetAnimation(PLAYER_ATTACK1);\n#endif\n\tUTIL_MakeVectors(m_pPlayer->pev->v_angle + m_pPlayer->pev->punchangle);\n\n\tm_pPlayer->m_iWeaponVolume = BIG_EXPLOSION_VOLUME;\n\tm_pPlayer->m_iWeaponFlash = DIM_GUN_FLASH;\n\n\tvecSrc = m_pPlayer->GetGunPosition();\n\tvecAiming = gpGlobals->v_forward;\n\n\tvecDir = m_pPlayer->FireBullets3(vecSrc, vecAiming, flSpread, 4096, 1, BULLET_PLAYER_357SIG, P228_DAMAGE, P228_RANGE_MODIFER, m_pPlayer->pev, true, m_pPlayer->random_seed);\n\n#ifdef CLIENT_WEAPONS\n\tflag = FEV_NOTHOST;\n#else\n\tflag = 0;\n#endif\n\n\tPLAYBACK_EVENT_FULL(flag, m_pPlayer->edict(), m_usFireP228, 0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y,\n\t\tint(m_pPlayer->pev->punchangle.x * 100), int(m_pPlayer->pev->punchangle.y * 100), m_iClip == 0, FALSE);\n\n\tm_flNextPrimaryAttack = m_flNextSecondaryAttack = GetNextAttackDelay(flCycleTime);\n\n#ifndef CLIENT_DLL\n\tif (!m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0)\n\t{\n\t\tm_pPlayer->SetSuitUpdate(\"!HEV_AMO0\", FALSE, FALSE);\n\t}\n#endif\n\tm_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 2.0f;\n\tm_pPlayer->pev->punchangle.x -= 2;\n\tResetPlayerShieldAnim();\n}\n\nvoid CP228::Reload()\n{\n\tif (m_pPlayer->ammo_357sig <= 0)\n\t\treturn;\n\n\tif (DefaultReload(iMaxClip(), m_pPlayer->HasShield() ? (int)P228_SHIELD_RELOAD : (int)P228_RELOAD, P228_RELOAD_TIME))\n\t{\n#ifndef CLIENT_DLL\n\t\tm_pPlayer->SetAnimation(PLAYER_RELOAD);\n#endif\n\t\tm_flAccuracy = 0.9f;\n\t}\n}\n\nvoid CP228::WeaponIdle()\n{\n\tResetEmptySound();\n\tm_pPlayer->GetAutoaimVector(AUTOAIM_10DEGREES);\n\n\tif (m_flTimeWeaponIdle > UTIL_WeaponTimeBase())\n\t{\n\t\treturn;\n\t}\n\n\tif (m_pPlayer->HasShield())\n\t{\n\t\tm_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 20.0f;\n\n\t\tif (m_iWeaponState & WPNSTATE_SHIELD_DRAWN)\n\t\t{\n\t\t\tSendWeaponAnim(P228_SHIELD_IDLE_UP, UseDecrement() != FALSE);\n\t\t}\n\t}\n\telse if (m_iClip)\n\t{\n\t\tm_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 3.0625f;\n\t\tSendWeaponAnim(P228_IDLE, UseDecrement() != FALSE);\n\t}\n}\n"
  },
  {
    "path": "dlls/wpn_shared/wpn_p90.cpp",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\n*\tThis product contains software technology licensed from Id\n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc.\n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n\n#include \"stdafx.h\"\n#include \"cbase.h\"\n#include \"player.h\"\n#include \"weapons.h\"\n\nLINK_ENTITY_TO_CLASS(weapon_p90, CP90)\n\nvoid CP90::Spawn(void)\n{\n\tpev->classname = MAKE_STRING(\"weapon_p90\");\n\n\tPrecache();\n\n\tm_iId = WEAPON_P90;\n\tSET_MODEL(edict(), \"models/w_p90.mdl\");\n\n\tm_iDefaultAmmo = P90_DEFAULT_GIVE;\n\tm_flAccuracy = 0.2f;\n\tm_iShotsFired = 0;\n\tm_bDelayFire = false;\n\n\tFallInit();\n}\n\nvoid CP90::Precache()\n{\n\tPRECACHE_MODEL(\"models/v_p90.mdl\");\n\tPRECACHE_MODEL(\"models/w_p90.mdl\");\n\n\tPRECACHE_SOUND(\"weapons/p90-1.wav\");\n\tPRECACHE_SOUND(\"weapons/p90_clipout.wav\");\n\tPRECACHE_SOUND(\"weapons/p90_clipin.wav\");\n\tPRECACHE_SOUND(\"weapons/p90_boltpull.wav\");\n\tPRECACHE_SOUND(\"weapons/p90_cliprelease.wav\");\n\n\tm_iShell = PRECACHE_MODEL(\"models/rshell.mdl\");\n\tm_usFireP90 = PRECACHE_EVENT(1, \"events/p90.sc\");\n}\n\nint CP90::GetItemInfo(ItemInfo *p)\n{\n\tp->pszName = STRING(pev->classname);\n\tp->pszAmmo1 = \"57mm\";\n\tp->iMaxAmmo1 = MAX_AMMO_57MM;\n\tp->pszAmmo2 = NULL;\n\tp->iMaxAmmo2 = -1;\n\tp->iMaxClip = P90_MAX_CLIP;\n\tp->iSlot = 0;\n\tp->iPosition = 8;\n\tp->iId = m_iId = WEAPON_P90;\n\tp->iFlags = 0;\n\tp->iWeight = P90_WEIGHT;\n\n\treturn 1;\n}\n\nBOOL CP90::Deploy()\n{\n\tm_iShotsFired = 0;\n\tm_bDelayFire = false;\n\tm_flAccuracy = 0.2f;\n\n\tiShellOn = 1;\n\n\treturn DefaultDeploy(\"models/v_p90.mdl\", \"models/p_p90.mdl\", P90_DRAW, \"carbine\", UseDecrement() != FALSE);\n}\n\nvoid CP90::PrimaryAttack()\n{\n\tif (!(m_pPlayer->pev->flags & FL_ONGROUND))\n\t{\n\t\tP90Fire(0.3 * m_flAccuracy, 0.066, FALSE);\n\t}\n\telse if (m_pPlayer->pev->velocity.Length2D() > 170)\n\t{\n\t\tP90Fire(0.115 * m_flAccuracy, 0.066, FALSE);\n\t}\n\telse\n\t{\n\t\tP90Fire(0.045 * m_flAccuracy, 0.066, FALSE);\n\t}\n}\n\nvoid CP90::P90Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim)\n{\n\tVector vecAiming, vecSrc, vecDir;\n\tint flag;\n\n\tm_bDelayFire = true;\n\t++m_iShotsFired;\n\n\tm_flAccuracy = (m_iShotsFired * m_iShotsFired / 175) + 0.45f;\n\n\tif (m_flAccuracy > 1)\n\t\tm_flAccuracy = 1;\n\n\tif (m_iClip <= 0)\n\t{\n\t\tif (m_fFireOnEmpty)\n\t\t{\n\t\t\tPlayEmptySound();\n\t\t\tm_flNextPrimaryAttack = GetNextAttackDelay(0.2);\n\t\t}\n\n#ifndef CLIENT_DLL\n\t\tif (TheBots != NULL)\n\t\t{\n\t\t\tTheBots->OnEvent(EVENT_WEAPON_FIRED_ON_EMPTY, m_pPlayer);\n\t\t}\n#endif\n\n\t\treturn;\n\t}\n\n\t--m_iClip;\n\tm_pPlayer->pev->effects |= EF_MUZZLEFLASH;\n#ifndef CLIENT_DLL\n\tm_pPlayer->SetAnimation(PLAYER_ATTACK1);\n#endif\n\tUTIL_MakeVectors(m_pPlayer->pev->v_angle + m_pPlayer->pev->punchangle);\n\n\tm_pPlayer->m_iWeaponVolume = NORMAL_GUN_VOLUME;\n\tm_pPlayer->m_iWeaponFlash = DIM_GUN_FLASH;\n\n\tvecSrc = m_pPlayer->GetGunPosition();\n\tvecAiming = gpGlobals->v_forward;\n\n\tvecDir = m_pPlayer->FireBullets3(vecSrc, vecAiming, flSpread, 8192, 1, BULLET_PLAYER_57MM, P90_DAMAGE, P90_RANGE_MODIFER, m_pPlayer->pev, false, m_pPlayer->random_seed);\n\n#ifdef CLIENT_WEAPONS\n\tflag = FEV_NOTHOST;\n#else\n\tflag = 0;\n#endif\n\n\tPLAYBACK_EVENT_FULL(flag, m_pPlayer->edict(), m_usFireP90, 0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y,\n\t\tint(m_pPlayer->pev->punchangle.x * 100), int(m_pPlayer->pev->punchangle.y * 100), 5, FALSE);\n\n\tm_flNextPrimaryAttack = m_flNextSecondaryAttack = GetNextAttackDelay(flCycleTime);\n\n#ifndef CLIENT_DLL\n\tif (!m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0)\n\t{\n\t\tm_pPlayer->SetSuitUpdate(\"!HEV_AMO0\", FALSE, 0);\n\t}\n#endif\n\tm_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 2.0f;\n\n\tif (!(m_pPlayer->pev->flags & FL_ONGROUND))\n\t{\n\t\tKickBack(0.9, 0.45, 0.35, 0.04, 5.25, 3.5, 4);\n\t}\n\telse if (m_pPlayer->pev->velocity.Length2D() > 0)\n\t{\n\t\tKickBack(0.45, 0.3, 0.2, 0.0275, 4.0, 2.25, 7);\n\t}\n\telse if (m_pPlayer->pev->flags & FL_DUCKING)\n\t{\n\t\tKickBack(0.275, 0.2, 0.125, 0.02, 3.0, 1.0, 9);\n\t}\n\telse\n\t{\n\t\tKickBack(0.3, 0.225, 0.125, 0.02, 3.25, 1.25, 8);\n\t}\n}\n\nvoid CP90::Reload()\n{\n\tif (m_pPlayer->ammo_57mm <= 0)\n\t\treturn;\n\n\tif (DefaultReload(iMaxClip(), P90_RELOAD, P90_RELOAD_TIME))\n\t{\n#ifndef CLIENT_DLL\n\t\tm_pPlayer->SetAnimation(PLAYER_RELOAD);\n#endif\n\t\tm_flAccuracy = 0.2f;\n\t\tm_iShotsFired = 0;\n\t}\n}\n\nvoid CP90::WeaponIdle()\n{\n\tResetEmptySound();\n\tm_pPlayer->GetAutoaimVector(AUTOAIM_10DEGREES);\n\n\tif (m_flTimeWeaponIdle > UTIL_WeaponTimeBase())\n\t{\n\t\treturn;\n\t}\n\n\tm_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 20.0f;\n\tSendWeaponAnim(P90_IDLE1, UseDecrement() != FALSE);\n}\n"
  },
  {
    "path": "dlls/wpn_shared/wpn_scout.cpp",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\n*\tThis product contains software technology licensed from Id\n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc.\n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n\n#include \"stdafx.h\"\n#include \"cbase.h\"\n#include \"player.h\"\n#include \"weapons.h\"\n\nLINK_ENTITY_TO_CLASS(weapon_scout, CSCOUT)\n\nvoid CSCOUT::Spawn(void)\n{\n\tpev->classname = MAKE_STRING(\"weapon_scout\");\n\n\tPrecache();\n\n\tm_iId = WEAPON_SCOUT;\n\tSET_MODEL(edict(), \"models/w_scout.mdl\");\n\n\tm_iDefaultAmmo = SCOUT_DEFAULT_GIVE;\n\n\tFallInit();\n}\n\nvoid CSCOUT::Precache()\n{\n\tPRECACHE_MODEL(\"models/v_scout.mdl\");\n\tPRECACHE_MODEL(\"models/w_scout.mdl\");\n\n\tPRECACHE_SOUND(\"weapons/scout_fire-1.wav\");\n\tPRECACHE_SOUND(\"weapons/scout_bolt.wav\");\n\tPRECACHE_SOUND(\"weapons/scout_clipin.wav\");\n\tPRECACHE_SOUND(\"weapons/scout_clipout.wav\");\n\tPRECACHE_SOUND(\"weapons/zoom.wav\");\n\n\tm_iShellId = m_iShell = PRECACHE_MODEL(\"models/rshell_big.mdl\");\n\tm_usFireScout = PRECACHE_EVENT(1, \"events/scout.sc\");\n}\n\nint CSCOUT::GetItemInfo(ItemInfo *p)\n{\n\tp->pszName = STRING(pev->classname);\n\tp->pszAmmo1 = \"762Nato\";\n\tp->iMaxAmmo1 = MAX_AMMO_762NATO;\n\tp->pszAmmo2 = NULL;\n\tp->iMaxAmmo2 = -1;\n\tp->iMaxClip = SCOUT_MAX_CLIP;\n\tp->iSlot = 0;\n\tp->iPosition = 9;\n\tp->iId = m_iId = WEAPON_SCOUT;\n\tp->iFlags = 0;\n\tp->iWeight = SCOUT_WEIGHT;\n\n\treturn 1;\n}\n\nBOOL CSCOUT::Deploy()\n{\n\tif (DefaultDeploy(\"models/v_scout.mdl\", \"models/p_scout.mdl\", SCOUT_DRAW, \"rifle\", UseDecrement() != FALSE))\n\t{\n\t\tm_flNextPrimaryAttack = m_pPlayer->m_flNextAttack = GetNextAttackDelay(1.25);\n\t\tm_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 1.0f;\n\n\t\treturn TRUE;\n\t}\n\n\treturn FALSE;\n}\n\nvoid CSCOUT::SecondaryAttack()\n{\n\tswitch (m_pPlayer->m_iFOV)\n\t{\n\tcase 90: m_pPlayer->m_iFOV = m_pPlayer->pev->fov = 40; break;\n\tcase 40: m_pPlayer->m_iFOV = m_pPlayer->pev->fov = 15; break;\n#ifdef REGAMEDLL_FIXES\n\tdefault:\n#else\n\tcase 15:\n#endif\n\t\tm_pPlayer->m_iFOV = m_pPlayer->pev->fov = 90; break;\n\t}\n\n#ifndef CLIENT_DLL\n\tif (TheBots != NULL)\n\t{\n\t\tTheBots->OnEvent(EVENT_WEAPON_ZOOMED, m_pPlayer);\n\t}\n#endif\n\n\tm_pPlayer->ResetMaxSpeed();\n\tEMIT_SOUND(m_pPlayer->edict(), CHAN_ITEM, \"weapons/zoom.wav\", 0.2, 2.4);\n\tm_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.3;\n}\n\nvoid CSCOUT::PrimaryAttack()\n{\n\tif (!(m_pPlayer->pev->flags & FL_ONGROUND))\n\t{\n\t\tSCOUTFire(0.2, 1.25, FALSE);\n\t}\n\telse if (m_pPlayer->pev->velocity.Length2D() > 170)\n\t{\n\t\tSCOUTFire(0.075, 1.25, FALSE);\n\t}\n\telse if (m_pPlayer->pev->flags & FL_DUCKING)\n\t{\n\t\tSCOUTFire(0, 1.25, FALSE);\n\t}\n\telse\n\t{\n\t\tSCOUTFire(0.007, 1.25, FALSE);\n\t}\n}\n\nvoid CSCOUT::SCOUTFire(float flSpread, float flCycleTime, BOOL fUseAutoAim)\n{\n\tVector vecAiming, vecSrc, vecDir;\n\tint flag;\n\n\tif (m_pPlayer->pev->fov != DEFAULT_FOV)\n\t{\n\t\tm_pPlayer->m_bResumeZoom = true;\n\t\tm_pPlayer->m_iLastZoom = m_pPlayer->m_iFOV;\n\n\t\t// reset a fov\n\t\tm_pPlayer->m_iFOV = DEFAULT_FOV;\n\t}\n\telse\n\t{\n\t\tflSpread += 0.025f;\n\t}\n\n\tif (m_iClip <= 0)\n\t{\n\t\tif (m_fFireOnEmpty)\n\t\t{\n\t\t\tPlayEmptySound();\n\t\t\tm_flNextPrimaryAttack = GetNextAttackDelay(0.2);\n\t\t}\n\n#ifndef CLIENT_DLL\n\t\tif (TheBots != NULL)\n\t\t{\n\t\t\tTheBots->OnEvent(EVENT_WEAPON_FIRED_ON_EMPTY, m_pPlayer);\n\t\t}\n#endif\n\n\t\treturn;\n\t}\n\n\t--m_iClip;\n#ifndef CLIENT_DLL\n\tm_pPlayer->SetAnimation(PLAYER_ATTACK1);\n#endif\n\tUTIL_MakeVectors(m_pPlayer->pev->v_angle + m_pPlayer->pev->punchangle);\n\n\tm_pPlayer->m_flEjectBrass = gpGlobals->time + 0.56f;\n\tm_pPlayer->m_iWeaponVolume = BIG_EXPLOSION_VOLUME;\n\tm_pPlayer->m_iWeaponFlash = NORMAL_GUN_FLASH;\n\n\tvecSrc = m_pPlayer->GetGunPosition();\n\tvecAiming = gpGlobals->v_forward;\n\n\tvecDir = m_pPlayer->FireBullets3(vecSrc, vecAiming, flSpread, 8192, 3, BULLET_PLAYER_762MM, SCOUT_DAMAGE, SCOUT_RANGE_MODIFER, m_pPlayer->pev, true, m_pPlayer->random_seed);\n\n#ifdef CLIENT_WEAPONS\n\tflag = FEV_NOTHOST;\n#else\n\tflag = 0;\n#endif\n\n\tPLAYBACK_EVENT_FULL(flag, m_pPlayer->edict(), m_usFireScout, 0, (float *)&g_vecZero, (float *)&m_pPlayer->pev->angles, (vecDir.x * 1000), (vecDir.y * 1000),\n\t\tint(m_pPlayer->pev->punchangle.x * 100), int(m_pPlayer->pev->punchangle.x * 100), FALSE, FALSE);\n\n\tm_flNextPrimaryAttack = m_flNextSecondaryAttack = GetNextAttackDelay(flCycleTime);\n\n#ifndef CLIENT_DLL\n\tif (!m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0)\n\t{\n\t\tm_pPlayer->SetSuitUpdate(\"!HEV_AMO0\", FALSE, 0);\n\t}\n#endif\n\tm_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.8f;\n\tm_pPlayer->pev->punchangle.x -= 2.0f;\n}\n\nvoid CSCOUT::Reload()\n{\n#ifdef REGAMEDLL_FIXES\n\t// to prevent reload if not enough ammo\n\tif (m_pPlayer->ammo_762nato <= 0)\n\t\treturn;\n#endif\n\n\tif (DefaultReload(iMaxClip(), SCOUT_RELOAD, SCOUT_RELOAD_TIME))\n\t{\n\t\tif (m_pPlayer->pev->fov != DEFAULT_FOV)\n\t\t{\n\t\t\tm_pPlayer->pev->fov = m_pPlayer->m_iFOV = 15;\n\t\t\tSecondaryAttack();\n\t\t}\n\n#ifndef CLIENT_DLL\n\t\tm_pPlayer->SetAnimation(PLAYER_RELOAD);\n#endif\n\t}\n}\n\nvoid CSCOUT::WeaponIdle()\n{\n\tResetEmptySound();\n\tm_pPlayer->GetAutoaimVector(AUTOAIM_10DEGREES);\n\n\tif (m_flTimeWeaponIdle > UTIL_WeaponTimeBase())\n\t{\n\t\treturn;\n\t}\n\n\tif (m_iClip)\n\t{\n\t\tm_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 60.0f;\n\t\tSendWeaponAnim(SCOUT_IDLE, UseDecrement() != FALSE);\n\t}\n}\n\nfloat CSCOUT::GetMaxSpeed()\n{\n\treturn (m_pPlayer->m_iFOV == DEFAULT_FOV) ? SCOUT_MAX_SPEED : SCOUT_MAX_SPEED_ZOOM;\n}\n"
  },
  {
    "path": "dlls/wpn_shared/wpn_sg550.cpp",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\n*\tThis product contains software technology licensed from Id\n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc.\n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n\n#include \"stdafx.h\"\n#include \"cbase.h\"\n#include \"player.h\"\n#include \"weapons.h\"\n\nLINK_ENTITY_TO_CLASS(weapon_sg550, CSG550)\n\nvoid CSG550::Spawn(void)\n{\n\tpev->classname = MAKE_STRING(\"weapon_sg550\");\n\tPrecache();\n\n\tm_iId = WEAPON_SG550;\n\tSET_MODEL(edict(), \"models/w_sg550.mdl\");\n\n\tm_iDefaultAmmo = SG550_DEFAULT_GIVE;\n\tm_flLastFire = 0;\n\n\tFallInit();\n}\n\nvoid CSG550::Precache()\n{\n\tPRECACHE_MODEL(\"models/v_sg550.mdl\");\n\tPRECACHE_MODEL(\"models/w_sg550.mdl\");\n\n\tPRECACHE_SOUND(\"weapons/sg550-1.wav\");\n\tPRECACHE_SOUND(\"weapons/sg550_boltpull.wav\");\n\tPRECACHE_SOUND(\"weapons/sg550_clipin.wav\");\n\tPRECACHE_SOUND(\"weapons/sg550_clipout.wav\");\n\tPRECACHE_SOUND(\"weapons/zoom.wav\");\n\n\tm_iShellId = m_iShell = PRECACHE_MODEL(\"models/rshell.mdl\");\n\tm_usFireSG550 = PRECACHE_EVENT(1, \"events/sg550.sc\");\n}\n\nint CSG550::GetItemInfo(ItemInfo *p)\n{\n\tp->pszName = STRING(pev->classname);\n\tp->pszAmmo1 = \"556Nato\";\n\tp->iMaxAmmo1 = MAX_AMMO_556NATO;\n\tp->pszAmmo2 = NULL;\n\tp->iMaxAmmo2 = -1;\n\tp->iMaxClip = SG550_MAX_CLIP;\n\tp->iSlot = 0;\n\tp->iPosition = 16;\n\tp->iId = m_iId = WEAPON_SG550;\n\tp->iFlags = 0;\n\tp->iWeight = SG550_WEIGHT;\n\n\treturn 1;\n}\n\nBOOL CSG550::Deploy()\n{\n\treturn DefaultDeploy(\"models/v_sg550.mdl\", \"models/p_sg550.mdl\", SG550_DRAW, \"rifle\", UseDecrement() != FALSE);\n}\n\nvoid CSG550::SecondaryAttack()\n{\n\tswitch (m_pPlayer->m_iFOV)\n\t{\n\tcase 90: m_pPlayer->m_iFOV = m_pPlayer->pev->fov = 40; break;\n\tcase 40: m_pPlayer->m_iFOV = m_pPlayer->pev->fov = 15; break;\n#ifdef REGAMEDLL_FIXES\n\tdefault:\n#else\n\tcase 15:\n#endif\n\t\tm_pPlayer->m_iFOV = m_pPlayer->pev->fov = 90; break;\n\t}\n\n\tm_pPlayer->ResetMaxSpeed();\n\n#ifndef CLIENT_DLL\n\tif (TheBots != NULL)\n\t{\n\t\tTheBots->OnEvent(EVENT_WEAPON_ZOOMED, m_pPlayer);\n\t}\n#endif\n\n\tEMIT_SOUND(m_pPlayer->edict(), CHAN_ITEM, \"weapons/zoom.wav\", 0.2, 2.4);\n\tm_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.3;\n}\n\nvoid CSG550::PrimaryAttack()\n{\n\tif (!(m_pPlayer->pev->flags & FL_ONGROUND))\n\t{\n\t\tSG550Fire(0.45 * (1 - m_flAccuracy), 0.25, FALSE);\n\t}\n\telse if (m_pPlayer->pev->velocity.Length2D() > 0)\n\t{\n\t\tSG550Fire(0.15, 0.25, FALSE);\n\t}\n\telse if (m_pPlayer->pev->flags & FL_DUCKING)\n\t{\n\t\tSG550Fire(0.04 * (1 - m_flAccuracy), 0.25, FALSE);\n\t}\n\telse\n\t{\n\t\tSG550Fire(0.05 * (1 - m_flAccuracy), 0.25, FALSE);\n\t}\n}\n\nvoid CSG550::SG550Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim)\n{\n\tVector vecAiming, vecSrc, vecDir;\n\tint flag;\n\n\tif (m_pPlayer->pev->fov == DEFAULT_FOV)\n\t{\n\t\tflSpread += 0.025f;\n\t}\n\n\tif (m_flLastFire)\n\t{\n\t\tm_flAccuracy = (gpGlobals->time - m_flLastFire) * 0.35f + 0.65f;\n\n\t\tif (m_flAccuracy > 0.98f)\n\t\t{\n\t\t\tm_flAccuracy = 0.98f;\n\t\t}\n\t}\n\n\tm_flLastFire = gpGlobals->time;\n\n\tif (m_iClip <= 0)\n\t{\n\t\tif (m_fFireOnEmpty)\n\t\t{\n\t\t\tPlayEmptySound();\n\t\t\tm_flNextPrimaryAttack = GetNextAttackDelay(0.2);\n\t\t}\n\n#ifndef CLIENT_DLL\n\t\tif (TheBots != NULL)\n\t\t{\n\t\t\tTheBots->OnEvent(EVENT_WEAPON_FIRED_ON_EMPTY, m_pPlayer);\n\t\t}\n#endif\n\n\t\treturn;\n\t}\n\n\t--m_iClip;\n\tm_pPlayer->pev->effects |= EF_MUZZLEFLASH;\n#ifndef CLIENT_DLL\n\tm_pPlayer->SetAnimation(PLAYER_ATTACK1);\n#endif\n\tUTIL_MakeVectors(m_pPlayer->pev->v_angle + m_pPlayer->pev->punchangle);\n\n\tm_pPlayer->m_iWeaponVolume = BIG_EXPLOSION_VOLUME;\n\tm_pPlayer->m_iWeaponFlash = NORMAL_GUN_FLASH;\n\n\tvecSrc = m_pPlayer->GetGunPosition();\n\tvecAiming = gpGlobals->v_forward;\n\n\tvecDir = m_pPlayer->FireBullets3(vecSrc, vecAiming, flSpread, 8192, 2, BULLET_PLAYER_556MM, SG550_DAMAGE, SG550_RANGE_MODIFER, m_pPlayer->pev, true, m_pPlayer->random_seed);\n\n#ifdef CLIENT_WEAPONS\n\tflag = FEV_NOTHOST;\n#else\n\tflag = 0;\n#endif\n\n\tPLAYBACK_EVENT_FULL(flag, m_pPlayer->edict(), m_usFireSG550, 0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y,\n\t\tint(m_pPlayer->pev->punchangle.x * 100), int(m_pPlayer->pev->punchangle.x * 100), 5, FALSE);\n\n\tm_flNextPrimaryAttack = m_flNextSecondaryAttack = GetNextAttackDelay(flCycleTime);\n\n#ifndef CLIENT_DLL\n\tif (!m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0)\n\t{\n\t\tm_pPlayer->SetSuitUpdate(\"!HEV_AMO0\", FALSE, 0);\n\t}\n#endif\n\tm_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.8f;\n\n\tm_pPlayer->pev->punchangle.x -= UTIL_SharedRandomFloat(m_pPlayer->random_seed + 4, 0.75, 1.25) + m_pPlayer->pev->punchangle.x * 0.25;\n\tm_pPlayer->pev->punchangle.y += UTIL_SharedRandomFloat(m_pPlayer->random_seed + 5, -0.75, 0.75);\n}\n\nvoid CSG550::Reload()\n{\n\tif (m_pPlayer->ammo_556nato <= 0)\n\t\treturn;\n\n\tif (DefaultReload(iMaxClip(), SG550_RELOAD, SG550_RELOAD_TIME))\n\t{\n#ifndef CLIENT_DLL\n\t\tm_pPlayer->SetAnimation(PLAYER_RELOAD);\n#endif\n\t\tif (m_pPlayer->pev->fov != DEFAULT_FOV)\n\t\t{\n\t\t\tm_pPlayer->m_iFOV = m_pPlayer->pev->fov = 15;\n\t\t\tSecondaryAttack();\n\t\t}\n\t}\n}\n\nvoid CSG550::WeaponIdle()\n{\n\tResetEmptySound();\n\tm_pPlayer->GetAutoaimVector(AUTOAIM_10DEGREES);\n\n\tif (m_flTimeWeaponIdle > UTIL_WeaponTimeBase())\n\t{\n\t\treturn;\n\t}\n\n\tif (m_iClip)\n\t{\n\t\tm_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 60.0f;\n\t\tSendWeaponAnim(SG550_IDLE, UseDecrement() != FALSE);\n\t}\n}\n\nfloat CSG550::GetMaxSpeed()\n{\n\treturn (m_pPlayer->m_iFOV == DEFAULT_FOV) ? SG550_MAX_SPEED : SG550_MAX_SPEED_ZOOM;\n}\n"
  },
  {
    "path": "dlls/wpn_shared/wpn_sg552.cpp",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\n*\tThis product contains software technology licensed from Id\n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc.\n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n\n#include \"stdafx.h\"\n#include \"cbase.h\"\n#include \"player.h\"\n#include \"weapons.h\"\n\nLINK_ENTITY_TO_CLASS(weapon_sg552, CSG552)\n\nvoid CSG552::Spawn(void)\n{\n\tpev->classname = MAKE_STRING(\"weapon_sg552\");\n\n\tPrecache();\n\n\tm_iId = WEAPON_SG552;\n\tSET_MODEL(edict(), \"models/w_sg552.mdl\");\n\n\tm_iDefaultAmmo = SG552_DEFAULT_GIVE;\n\tm_flAccuracy = 0.2f;\n\tm_iShotsFired = 0;\n\n\tFallInit();\n}\n\nvoid CSG552::Precache()\n{\n\tPRECACHE_MODEL(\"models/v_sg552.mdl\");\n\tPRECACHE_MODEL(\"models/w_sg552.mdl\");\n\n\tPRECACHE_SOUND(\"weapons/sg552-1.wav\");\n\tPRECACHE_SOUND(\"weapons/sg552-2.wav\");\n\tPRECACHE_SOUND(\"weapons/sg552_clipout.wav\");\n\tPRECACHE_SOUND(\"weapons/sg552_clipin.wav\");\n\tPRECACHE_SOUND(\"weapons/sg552_boltpull.wav\");\n\n\tm_iShell = PRECACHE_MODEL(\"models/rshell.mdl\");\n\tm_usFireSG552 = PRECACHE_EVENT(1, \"events/sg552.sc\");\n}\n\nint CSG552::GetItemInfo(ItemInfo *p)\n{\n\tp->pszName = STRING(pev->classname);\n\tp->pszAmmo1 = \"556Nato\";\n\tp->iMaxAmmo1 = MAX_AMMO_556NATO;\n\tp->pszAmmo2 = NULL;\n\tp->iMaxAmmo2 = -1;\n\tp->iMaxClip = SG552_MAX_CLIP;\n\tp->iSlot = 0;\n\tp->iPosition = 10;\n\tp->iId = m_iId = WEAPON_SG552;\n\tp->iFlags = 0;\n\tp->iWeight = SG552_WEIGHT;\n\n\treturn 1;\n}\n\nBOOL CSG552::Deploy()\n{\n\tm_flAccuracy = 0.2f;\n\tm_iShotsFired = 0;\n\tiShellOn = 1;\n\n\treturn DefaultDeploy(\"models/v_sg552.mdl\", \"models/p_sg552.mdl\", SG552_DRAW, \"mp5\", UseDecrement() != FALSE);\n}\n\nvoid CSG552::SecondaryAttack()\n{\n\tif (m_pPlayer->m_iFOV == DEFAULT_FOV)\n\t\tm_pPlayer->pev->fov = m_pPlayer->m_iFOV = 55;\n\telse\n\t\tm_pPlayer->pev->fov = m_pPlayer->m_iFOV = 90;\n\n\tm_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.3f;\n}\n\nvoid CSG552::PrimaryAttack()\n{\n\tif (!(m_pPlayer->pev->flags & FL_ONGROUND))\n\t{\n\t\tSG552Fire(0.035 + (0.45 * m_flAccuracy), 0.0825, FALSE);\n\t}\n\telse if (m_pPlayer->pev->velocity.Length2D() > 140)\n\t{\n\t\tSG552Fire(0.035 + (0.075 * m_flAccuracy), 0.0825, FALSE);\n\t}\n\telse if (m_pPlayer->pev->fov == DEFAULT_FOV)\n\t{\n\t\tSG552Fire(0.02 * m_flAccuracy, 0.0825, FALSE);\n\t}\n\telse\n\t{\n\t\tSG552Fire(0.02 * m_flAccuracy, 0.135, FALSE);\n\t}\n}\n\nvoid CSG552::SG552Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim)\n{\n\tVector vecAiming, vecSrc, vecDir;\n\tint flag;\n\n\tm_bDelayFire = true;\n\tm_iShotsFired++;\n\n\tm_flAccuracy = ((m_iShotsFired * m_iShotsFired * m_iShotsFired) / 220) + 0.3f;\n\n\tif (m_flAccuracy > 1.0f)\n\t\tm_flAccuracy = 1.0f;\n\n\tif (m_iClip <= 0)\n\t{\n\t\tif (m_fFireOnEmpty)\n\t\t{\n\t\t\tPlayEmptySound();\n\t\t\tm_flNextPrimaryAttack = GetNextAttackDelay(0.2);\n\t\t}\n\n#ifndef CLIENT_DLL\n\t\tif (TheBots != NULL)\n\t\t{\n\t\t\tTheBots->OnEvent(EVENT_WEAPON_FIRED_ON_EMPTY, m_pPlayer);\n\t\t}\n#endif\n\n\t\treturn;\n\t}\n\n\tm_iClip--;\n\tm_pPlayer->pev->effects |= EF_MUZZLEFLASH;\n#ifndef CLIENT_DLL\n\tm_pPlayer->SetAnimation(PLAYER_ATTACK1);\n#endif\n\tm_pPlayer->m_iWeaponVolume = NORMAL_GUN_VOLUME;\n\tm_pPlayer->m_iWeaponFlash = BRIGHT_GUN_FLASH;\n\n\tUTIL_MakeVectors(m_pPlayer->pev->v_angle + m_pPlayer->pev->punchangle);\n\n\tvecSrc = m_pPlayer->GetGunPosition();\n\tvecAiming = gpGlobals->v_forward;\n\n\tvecDir = m_pPlayer->FireBullets3(vecSrc, vecAiming, flSpread, 8192, 2, BULLET_PLAYER_556MM,\n\t\tSG552_DAMAGE, SG552_RANGE_MODIFER, m_pPlayer->pev, false, m_pPlayer->random_seed);\n\n#ifdef CLIENT_WEAPONS\n\tflag = FEV_NOTHOST;\n#else\n\tflag = 0;\n#endif\n\n\tPLAYBACK_EVENT_FULL(flag, m_pPlayer->edict(), m_usFireSG552, 0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y,\n\t\tint(m_pPlayer->pev->punchangle.x * 100), int(m_pPlayer->pev->punchangle.y * 100), 5, FALSE);\n\n\tm_flNextPrimaryAttack = m_flNextSecondaryAttack = GetNextAttackDelay(flCycleTime);\n\n#ifndef CLIENT_DLL\n\tif (!m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0)\n\t{\n\t\tm_pPlayer->SetSuitUpdate(\"!HEV_AMO0\", FALSE, 0);\n\t}\n#endif\n\tm_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 2.0f;\n\n\tif (m_pPlayer->pev->velocity.Length2D() > 0)\n\t{\n\t\tKickBack(1.0, 0.45, 0.28, 0.04, 4.25, 2.5, 7);\n\t}\n\telse if (!(m_pPlayer->pev->flags & FL_ONGROUND))\n\t{\n\t\tKickBack(1.25, 0.45, 0.22, 0.18, 6.0, 4.0, 5);\n\t}\n\telse if (m_pPlayer->pev->flags & FL_DUCKING)\n\t{\n\t\tKickBack(0.6, 0.35, 0.2, 0.0125, 3.7, 2.0, 10);\n\t}\n\telse\n\t{\n\t\tKickBack(0.625, 0.375, 0.25, 0.0125, 4.0, 2.25, 9);\n\t}\n}\n\nvoid CSG552::Reload()\n{\n\tif (m_pPlayer->ammo_556nato <= 0)\n\t\treturn;\n\n\tif (DefaultReload(iMaxClip(), SG552_RELOAD, SG552_RELOAD_TIME))\n\t{\n\t\tif (m_pPlayer->m_iFOV != DEFAULT_FOV)\n\t\t{\n\t\t\tSecondaryAttack();\n\t\t}\n\n#ifndef CLIENT_DLL\n\t\tm_pPlayer->SetAnimation(PLAYER_RELOAD);\n#endif\n\t\tm_flAccuracy = 0.2f;\n\t\tm_iShotsFired = 0;\n\t\tm_bDelayFire = false;\n\t}\n}\n\nvoid CSG552::WeaponIdle()\n{\n\tResetEmptySound();\n\tm_pPlayer->GetAutoaimVector(AUTOAIM_10DEGREES);\n\n\tif (m_flTimeWeaponIdle > UTIL_WeaponTimeBase())\n\t{\n\t\treturn;\n\t}\n\n\tm_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 20.0f;\n\tSendWeaponAnim(SG552_IDLE1, UseDecrement() != FALSE);\n}\n\nfloat CSG552::GetMaxSpeed()\n{\n\tif (m_pPlayer->m_iFOV == DEFAULT_FOV)\n\t\treturn SG552_MAX_SPEED;\n\n\treturn SG552_MAX_SPEED_ZOOM;\n}\n"
  },
  {
    "path": "dlls/wpn_shared/wpn_smokegrenade.cpp",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\n*\tThis product contains software technology licensed from Id\n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc.\n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n\n#include \"stdafx.h\"\n#include \"cbase.h\"\n#include \"player.h\"\n#include \"weapons.h\"\n\nLINK_ENTITY_TO_CLASS(weapon_smokegrenade, CSmokeGrenade)\n\nvoid CSmokeGrenade::Spawn(void)\n{\n\tpev->classname = MAKE_STRING(\"weapon_smokegrenade\");\n\n\tPrecache();\n\n\tm_iId = WEAPON_SMOKEGRENADE;\n\tSET_MODEL(edict(), \"models/w_smokegrenade.mdl\");\n\n\tpev->dmg = 4;\n\n\tm_iDefaultAmmo = SMOKEGRENADE_DEFAULT_GIVE;\n\tm_flStartThrow = 0;\n\tm_flReleaseThrow = -1;\n\tm_iWeaponState &= ~WPNSTATE_SHIELD_DRAWN;\n\n\t// get ready to fall down.\n\tFallInit();\n}\n\nvoid CSmokeGrenade::Precache()\n{\n\tPRECACHE_MODEL(\"models/v_smokegrenade.mdl\");\n\tPRECACHE_MODEL(\"models/shield/v_shield_smokegrenade.mdl\");\n\n\tPRECACHE_SOUND(\"weapons/pinpull.wav\");\n\tPRECACHE_SOUND(\"weapons/sg_explode.wav\");\n\n\tm_usCreateSmoke = PRECACHE_EVENT(1, \"events/createsmoke.sc\");\n}\n\nint CSmokeGrenade::GetItemInfo(ItemInfo *p)\n{\n\tp->pszName = STRING(pev->classname);\n\tp->pszAmmo1 = \"SmokeGrenade\";\n\n\tp->iMaxAmmo1 = MAX_AMMO_SMOKEGRENADE;\n\tp->iMaxClip = WEAPON_NOCLIP;\n\n\tp->pszAmmo2 = NULL;\n\tp->iMaxAmmo2 = -1;\n\tp->iSlot = 3;\n\tp->iPosition = 3;\n\tp->iId = m_iId = WEAPON_SMOKEGRENADE;\n\tp->iWeight = SMOKEGRENADE_WEIGHT;\n\tp->iFlags = ITEM_FLAG_LIMITINWORLD | ITEM_FLAG_EXHAUSTIBLE;\n\n\treturn 1;\n}\n\nBOOL CSmokeGrenade::Deploy()\n{\n\tm_iWeaponState &= ~WPNSTATE_SHIELD_DRAWN;\n\n\tm_flReleaseThrow = -1;\n\tm_fMaxSpeed = SMOKEGRENADE_MAX_SPEED;\n\n\tm_pPlayer->m_bShieldDrawn = false;\n\n\tif (m_pPlayer->HasShield())\n\t\treturn DefaultDeploy(\"models/shield/v_shield_smokegrenade.mdl\", \"models/shield/p_shield_smokegrenade.mdl\", SMOKEGRENADE_DRAW, \"shieldgren\", UseDecrement() != FALSE);\n\telse\n\t\treturn DefaultDeploy(\"models/v_smokegrenade.mdl\", \"models/p_smokegrenade.mdl\", SMOKEGRENADE_DRAW, \"grenade\", UseDecrement() != FALSE);\n}\n\nvoid CSmokeGrenade::Holster(int skiplocal)\n{\n\tm_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5f;\n\n\tif (!m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType])\n\t{\n\t\t// no more smokegrenades!\n\t\t// clear the smokegrenade of bits for HUD\n\t\tm_pPlayer->pev->weapons &= ~(1 << WEAPON_SMOKEGRENADE);\n\t\tDestroyItem();\n\t}\n\n\tm_flStartThrow = 0;\n\tm_flReleaseThrow = -1;\n}\n\nvoid CSmokeGrenade::PrimaryAttack()\n{\n\tif (m_iWeaponState & WPNSTATE_SHIELD_DRAWN)\n\t\treturn;\n\n\tif (!m_flStartThrow && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] > 0)\n\t{\n\t\tm_flReleaseThrow = 0;\n\t\tm_flStartThrow = gpGlobals->time;\n\n\t\tSendWeaponAnim(SMOKEGRENADE_PINPULL, UseDecrement() != FALSE);\n\t\tm_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.5f;\n\t}\n}\n\nbool CSmokeGrenade::ShieldSecondaryFire(int iUpAnim, int iDownAnim)\n{\n\tif (!m_pPlayer->HasShield() || m_flStartThrow > 0)\n\t{\n\t\treturn false;\n\t}\n\n\tif (m_iWeaponState & WPNSTATE_SHIELD_DRAWN)\n\t{\n\t\tm_iWeaponState &= ~WPNSTATE_SHIELD_DRAWN;\n\t\tSendWeaponAnim(iDownAnim, UseDecrement() != FALSE);\n\n\t\tstrcpy(m_pPlayer->m_szAnimExtention, \"shieldgren\");\n\n\t\tm_fMaxSpeed = SMOKEGRENADE_MAX_SPEED;\n\t\tm_pPlayer->m_bShieldDrawn = false;\n\t}\n\telse\n\t{\n\t\tm_iWeaponState |= WPNSTATE_SHIELD_DRAWN;\n\t\tSendWeaponAnim(iUpAnim, UseDecrement() != FALSE);\n\n\t\tstrcpy(m_pPlayer->m_szAnimExtention, \"shielded\");\n\n\t\tm_fMaxSpeed = SMOKEGRENADE_MAX_SPEED_SHIELD;\n\t\tm_pPlayer->m_bShieldDrawn = true;\n\t}\n\n#ifndef CLIENT_DLL\n\tm_pPlayer->UpdateShieldCrosshair((m_iWeaponState & WPNSTATE_SHIELD_DRAWN) != WPNSTATE_SHIELD_DRAWN);\n#endif\n\tm_pPlayer->ResetMaxSpeed();\n\n\tm_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.4f;\n\tm_flNextPrimaryAttack = GetNextAttackDelay(0.4);\n\tm_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.6f;\n\n\treturn true;\n}\n\nvoid CSmokeGrenade::SecondaryAttack()\n{\n\tShieldSecondaryFire(SHIELDGUN_DRAW, SHIELDGUN_DRAWN_IDLE);\n}\n\nvoid CSmokeGrenade::SetPlayerShieldAnim()\n{\n\tif (!m_pPlayer->HasShield())\n\t\treturn;\n\n\tif (m_iWeaponState & WPNSTATE_SHIELD_DRAWN)\n\t\tstrcpy(m_pPlayer->m_szAnimExtention, \"shield\");\n\telse\n\t\tstrcpy(m_pPlayer->m_szAnimExtention, \"shieldgren\");\n}\n\nvoid CSmokeGrenade::ResetPlayerShieldAnim()\n{\n\tif (!m_pPlayer->HasShield())\n\t\treturn;\n\n\tif (m_iWeaponState & WPNSTATE_SHIELD_DRAWN)\n\t{\n\t\tstrcpy(m_pPlayer->m_szAnimExtention, \"shieldgren\");\n\t}\n}\n\nvoid CSmokeGrenade::WeaponIdle()\n{\n\tif (m_flReleaseThrow == 0)\n\t\tm_flReleaseThrow = gpGlobals->time;\n\n\tif (m_flTimeWeaponIdle > UTIL_WeaponTimeBase())\n\t\treturn;\n\n\tif (m_flStartThrow)\n\t{\n\t\tm_pPlayer->Radio(\"%!MRAD_FIREINHOLE\", \"#Fire_in_the_hole\");\n\n\t\tVector angThrow = m_pPlayer->pev->v_angle + m_pPlayer->pev->punchangle;\n\n\t\tif (angThrow.x < 0)\n\t\t\tangThrow.x = -10 + angThrow.x * ((90 - 10) / 90.0);\n\t\telse\n\t\t\tangThrow.x = -10 + angThrow.x * ((90 + 10) / 90.0);\n\n\t\tfloat flVel = (90.0f - angThrow.x) * 6.0f;\n\n\t\tif (flVel > 750.0f)\n\t\t\tflVel = 750.0f;\n\n\t\tUTIL_MakeVectors(angThrow);\n\n\t\tVector vecSrc = m_pPlayer->pev->origin + m_pPlayer->pev->view_ofs + gpGlobals->v_forward * 16.0f;\n\t\tVector vecThrow = gpGlobals->v_forward * flVel + m_pPlayer->pev->velocity;\n\n\t\tCGrenade::ShootSmokeGrenade(m_pPlayer->pev, vecSrc, vecThrow, 1.5, m_usCreateSmoke);\n\n\t\tSendWeaponAnim(SMOKEGRENADE_THROW, UseDecrement() != FALSE);\n\t\tSetPlayerShieldAnim();\n\n#ifndef CLIENT_DLL\n\t\t// player \"shoot\" animation\n\t\tm_pPlayer->SetAnimation(PLAYER_ATTACK1);\n#endif\n\t\tm_flStartThrow = 0;\n\t\tm_flNextPrimaryAttack = GetNextAttackDelay(0.5);\n\t\tm_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.75f;\n\n\t\tif (--m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0)\n\t\t{\n\t\t\t// just threw last grenade\n\t\t\t// set attack times in the future, and weapon idle in the future so we can see the whole throw\n\t\t\t// animation, weapon idle will automatically retire the weapon for us.\n\t\t\t// ensure that the animation can finish playing\n\t\t\tm_flTimeWeaponIdle = m_flNextSecondaryAttack = m_flNextPrimaryAttack = GetNextAttackDelay(0.5);\n\t\t}\n\n\t\tResetPlayerShieldAnim();\n\t}\n\telse if (m_flReleaseThrow > 0)\n\t{\n\t\t// we've finished the throw, restart.\n\t\tm_flStartThrow = 0;\n\n\t\tif (m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType])\n\t\t{\n\t\t\tSendWeaponAnim(SMOKEGRENADE_DRAW, UseDecrement() != FALSE);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tRetireWeapon();\n\t\t\treturn;\n\t\t}\n\n\t\tm_flTimeWeaponIdle = UTIL_WeaponTimeBase() + RANDOM_FLOAT(10, 15);\n\t\tm_flReleaseThrow = -1;\n\t}\n\telse if (m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType])\n\t{\n\t\tint iAnim;\n\t\tfloat flRand = RANDOM_FLOAT(0, 1);\n\n\t\tif (m_pPlayer->HasShield())\n\t\t{\n\t\t\tm_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 20.0f;\n\n\t\t\tif (m_iWeaponState & WPNSTATE_SHIELD_DRAWN)\n\t\t\t{\n\t\t\t\tSendWeaponAnim(SHIELDREN_IDLE, UseDecrement() != FALSE);\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif (flRand <= 0.75)\n\t\t\t{\n\t\t\t\tiAnim = SMOKEGRENADE_IDLE;\n\n\t\t\t\t// how long till we do this again.\n\t\t\t\tm_flTimeWeaponIdle = UTIL_WeaponTimeBase() + RANDOM_FLOAT(10, 15);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tiAnim = SMOKEGRENADE_IDLE;\n\t\t\t\tm_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 75.0f / 30.0f;\n\t\t\t}\n\n\t\t\tSendWeaponAnim(iAnim, UseDecrement() != FALSE);\n\t\t}\n\t}\n}\n\nBOOL CSmokeGrenade::CanDeploy()\n{\n\treturn m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] != 0;\n}\n"
  },
  {
    "path": "dlls/wpn_shared/wpn_tmp.cpp",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\n*\tThis product contains software technology licensed from Id\n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc.\n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n\n#include \"stdafx.h\"\n#include \"cbase.h\"\n#include \"player.h\"\n#include \"weapons.h\"\n\nLINK_ENTITY_TO_CLASS(weapon_tmp, CTMP)\n\nvoid CTMP::Spawn(void)\n{\n\tpev->classname = MAKE_STRING(\"weapon_tmp\");\n\n\tPrecache();\n\n\tm_iId = WEAPON_TMP;\n\tSET_MODEL(edict(), \"models/w_tmp.mdl\");\n\n\tm_iDefaultAmmo = TMP_DEFAULT_GIVE;\n\tm_flAccuracy = 0.2f;\n\tm_iShotsFired = 0;\n\tm_bDelayFire = false;\n\n\tFallInit();\n}\n\nvoid CTMP::Precache()\n{\n\tPRECACHE_MODEL(\"models/v_tmp.mdl\");\n\tPRECACHE_MODEL(\"models/w_tmp.mdl\");\n\n\tPRECACHE_SOUND(\"weapons/tmp-1.wav\");\n\tPRECACHE_SOUND(\"weapons/tmp-2.wav\");\n\n\tm_iShell = PRECACHE_MODEL(\"models/pshell.mdl\");\n\tm_usFireTMP = PRECACHE_EVENT(1, \"events/tmp.sc\");\n}\n\nint CTMP::GetItemInfo(ItemInfo *p)\n{\n\tp->pszName = STRING(pev->classname);\n\tp->pszAmmo1 = \"9mm\";\n\tp->iMaxAmmo1 = MAX_AMMO_9MM;\n\tp->pszAmmo2 = NULL;\n\tp->iMaxAmmo2 = -1;\n\tp->iMaxClip = TMP_MAX_CLIP;\n\tp->iSlot = 0;\n\tp->iPosition = 11;\n\tp->iId = m_iId = WEAPON_TMP;\n\tp->iFlags = 0;\n\tp->iWeight = TMP_WEIGHT;\n\n\treturn 1;\n}\n\nBOOL CTMP::Deploy()\n{\n\tm_flAccuracy = 0.2f;\n\tm_iShotsFired = 0;\n\tm_bDelayFire = false;\n\tiShellOn = 1;\n\n\treturn DefaultDeploy(\"models/v_tmp.mdl\", \"models/p_tmp.mdl\", TMP_DRAW, \"onehanded\", UseDecrement() != FALSE);\n}\n\nvoid CTMP::PrimaryAttack()\n{\n\tif (!(m_pPlayer->pev->flags & FL_ONGROUND))\n\t{\n\t\tTMPFire(0.25 * m_flAccuracy, 0.07, FALSE);\n\t}\n\telse\n\t{\n\t\tTMPFire(0.03 * m_flAccuracy, 0.07, FALSE);\n\t}\n}\n\nvoid CTMP::TMPFire(float flSpread, float flCycleTime, BOOL fUseAutoAim)\n{\n\tVector vecAiming, vecSrc, vecDir;\n\tint flag;\n\n\tm_bDelayFire = true;\n\t++m_iShotsFired;\n\n\tm_flAccuracy = ((m_iShotsFired * m_iShotsFired * m_iShotsFired) / 200) + 0.55f;\n\n\tif (m_flAccuracy > 1.4f)\n\t\tm_flAccuracy = 1.4f;\n\n\tif (m_iClip <= 0)\n\t{\n\t\tif (m_fFireOnEmpty)\n\t\t{\n\t\t\tPlayEmptySound();\n\t\t\tm_flNextPrimaryAttack = GetNextAttackDelay(0.2);\n\t\t}\n\n#ifndef CLIENT_DLL\n\t\tif (TheBots != NULL)\n\t\t{\n\t\t\tTheBots->OnEvent(EVENT_WEAPON_FIRED_ON_EMPTY, m_pPlayer);\n\t\t}\n#endif\n\n\t\treturn;\n\t}\n\n\t--m_iClip;\n#ifndef CLIENT_DLL\n\tm_pPlayer->SetAnimation(PLAYER_ATTACK1);\n#endif\n\tUTIL_MakeVectors(m_pPlayer->pev->v_angle + m_pPlayer->pev->punchangle);\n\n\tm_pPlayer->m_iWeaponVolume = NORMAL_GUN_VOLUME;\n\n\tvecSrc = m_pPlayer->GetGunPosition();\n\tvecAiming = gpGlobals->v_forward;\n\n\tvecDir = m_pPlayer->FireBullets3(vecSrc, vecAiming, flSpread, 8192, 1, BULLET_PLAYER_9MM,\n\t\tTMP_DAMAGE, TMP_RANGE_MODIFER, m_pPlayer->pev, false, m_pPlayer->random_seed);\n\n#ifdef CLIENT_WEAPONS\n\tflag = FEV_NOTHOST;\n#else\n\tflag = 0;\n#endif\n\n\tPLAYBACK_EVENT_FULL(flag, m_pPlayer->edict(), m_usFireTMP, 0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y,\n\t\tint(m_pPlayer->pev->punchangle.x * 100), int(m_pPlayer->pev->punchangle.y * 100), 5, FALSE);\n\n\tm_flNextPrimaryAttack = m_flNextSecondaryAttack = GetNextAttackDelay(flCycleTime);\n\n#ifndef CLIENT_DLL\n\tif (!m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0)\n\t{\n\t\tm_pPlayer->SetSuitUpdate(\"!HEV_AMO0\", FALSE, 0);\n\t}\n#endif\n\tm_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 2.0f;\n\n\tif (!(m_pPlayer->pev->flags & FL_ONGROUND))\n\t{\n\t\tKickBack(1.1, 0.5, 0.35, 0.045, 4.5, 3.5, 6);\n\t}\n\telse if (m_pPlayer->pev->velocity.Length2D() > 0)\n\t{\n\t\tKickBack(0.8, 0.4, 0.2, 0.03, 3.0, 2.5, 7);\n\t}\n\telse if (m_pPlayer->pev->flags & FL_DUCKING)\n\t{\n\t\tKickBack(0.7, 0.35, 0.125, 0.025, 2.5, 2.0, 10);\n\t}\n\telse\n\t{\n\t\tKickBack(0.725, 0.375, 0.15, 0.025, 2.75, 2.25, 9);\n\t}\n}\n\nvoid CTMP::Reload()\n{\n#ifdef REGAMEDLL_FIXES\n\t// to prevent reload if not enough ammo\n\tif (m_pPlayer->ammo_9mm <= 0)\n\t\treturn;\n#endif\n\n\tif (DefaultReload(iMaxClip(), TMP_RELOAD, TMP_RELOAD_TIME))\n\t{\n#ifndef CLIENT_DLL\n\t\tm_pPlayer->SetAnimation(PLAYER_RELOAD);\n#endif\n\t\tm_flAccuracy = 0.2f;\n\t\tm_iShotsFired = 0;\n\t}\n}\n\nvoid CTMP::WeaponIdle()\n{\n\tResetEmptySound();\n\tm_pPlayer->GetAutoaimVector(AUTOAIM_10DEGREES);\n\n\tif (m_flTimeWeaponIdle > UTIL_WeaponTimeBase())\n\t{\n\t\treturn;\n\t}\n\n\tm_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 20.0f;\n\tSendWeaponAnim(TMP_IDLE1, UseDecrement() != FALSE);\n}\n"
  },
  {
    "path": "dlls/wpn_shared/wpn_ump45.cpp",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\n*\tThis product contains software technology licensed from Id\n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc.\n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n\n#include \"stdafx.h\"\n#include \"cbase.h\"\n#include \"player.h\"\n#include \"weapons.h\"\n\nLINK_ENTITY_TO_CLASS(weapon_ump45, CUMP45)\n\nvoid CUMP45::Spawn(void)\n{\n\tpev->classname = MAKE_STRING(\"weapon_ump45\");\n\n\tPrecache();\n\n\tm_iId = WEAPON_UMP45;\n\tSET_MODEL(edict(), \"models/w_ump45.mdl\");\n\n\tm_iDefaultAmmo = UMP45_DEFAULT_GIVE;\n\tm_flAccuracy = 0.0f;\n\tm_bDelayFire = false;\n\n\tFallInit();\n}\n\nvoid CUMP45::Precache()\n{\n\tPRECACHE_MODEL(\"models/v_ump45.mdl\");\n\tPRECACHE_MODEL(\"models/w_ump45.mdl\");\n\n\tPRECACHE_SOUND(\"weapons/ump45-1.wav\");\n\tPRECACHE_SOUND(\"weapons/ump45_clipout.wav\");\n\tPRECACHE_SOUND(\"weapons/ump45_clipin.wav\");\n\tPRECACHE_SOUND(\"weapons/ump45_boltslap.wav\");\n\n\tm_iShell = PRECACHE_MODEL(\"models/pshell.mdl\");\n\tm_usFireUMP45 = PRECACHE_EVENT(1, \"events/ump45.sc\");\n}\n\nint CUMP45::GetItemInfo(ItemInfo *p)\n{\n\tp->pszName = STRING(pev->classname);\n#ifdef REGAMEDLL_FIXES\n\tp->pszAmmo1 = \"45acp\";\n#else\n\tp->pszAmmo1 = \"45ACP\";\n#endif\n\tp->iMaxAmmo1 = MAX_AMMO_45ACP;\n\tp->pszAmmo2 = NULL;\n\tp->iMaxAmmo2 = -1;\n\tp->iMaxClip = UMP45_MAX_CLIP;\n\tp->iSlot = 0;\n\tp->iPosition = 15;\n\tp->iId = m_iId = WEAPON_UMP45;\n\tp->iFlags = 0;\n\tp->iWeight = UMP45_WEIGHT;\n\n\treturn 1;\n}\n\nBOOL CUMP45::Deploy()\n{\n\tm_flAccuracy = 0.0f;\n\tm_bDelayFire = false;\n\tiShellOn = 1;\n\n\treturn DefaultDeploy(\"models/v_ump45.mdl\", \"models/p_ump45.mdl\", UMP45_DRAW, \"carbine\", UseDecrement() != FALSE);\n}\n\nvoid CUMP45::PrimaryAttack()\n{\n\tif (!(m_pPlayer->pev->flags & FL_ONGROUND))\n\t{\n\t\tUMP45Fire(0.24 * m_flAccuracy, 0.1, FALSE);\n\t}\n\telse\n\t{\n\t\tUMP45Fire(0.04 * m_flAccuracy, 0.1, FALSE);\n\t}\n}\n\nvoid CUMP45::UMP45Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim)\n{\n\tVector vecAiming, vecSrc, vecDir;\n\tint flag;\n\n\tm_bDelayFire = true;\n\t++m_iShotsFired;\n\n\tm_flAccuracy = ((m_iShotsFired * m_iShotsFired) / 210) + 0.5f;\n\n\tif (m_flAccuracy > 1.0f)\n\t\tm_flAccuracy = 1.0f;\n\n\tif (m_iClip <= 0)\n\t{\n\t\tif (m_fFireOnEmpty)\n\t\t{\n\t\t\tPlayEmptySound();\n\t\t\tm_flNextPrimaryAttack = GetNextAttackDelay(0.2);\n\t\t}\n\n#ifndef CLIENT_DLL\n\t\tif (TheBots != NULL)\n\t\t{\n\t\t\tTheBots->OnEvent(EVENT_WEAPON_FIRED_ON_EMPTY, m_pPlayer);\n\t\t}\n#endif\n\t\treturn;\n\t}\n\n\t--m_iClip;\n\tm_pPlayer->pev->effects |= EF_MUZZLEFLASH;\n#ifndef CLIENT_DLL\n\tm_pPlayer->SetAnimation(PLAYER_ATTACK1);\n#endif\n\tUTIL_MakeVectors(m_pPlayer->pev->v_angle + m_pPlayer->pev->punchangle);\n\n\tvecSrc = m_pPlayer->GetGunPosition();\n\tvecAiming = gpGlobals->v_forward;\n\n\tvecDir = m_pPlayer->FireBullets3(vecSrc, vecAiming, flSpread, 8192, 1, BULLET_PLAYER_45ACP,\n\t\tUMP45_DAMAGE, UMP45_RANGE_MODIFER, m_pPlayer->pev, false, m_pPlayer->random_seed);\n\n#ifdef CLIENT_WEAPONS\n\tflag = FEV_NOTHOST;\n#else\n\tflag = 0;\n#endif\n\n\tPLAYBACK_EVENT_FULL(flag, m_pPlayer->edict(), m_usFireUMP45, 0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y,\n\t\tint(m_pPlayer->pev->punchangle.x * 100), int(m_pPlayer->pev->punchangle.y * 100), FALSE, FALSE);\n\n\tm_pPlayer->m_iWeaponVolume = NORMAL_GUN_VOLUME;\n\tm_pPlayer->m_iWeaponFlash = DIM_GUN_FLASH;\n\n\tm_flNextPrimaryAttack = m_flNextSecondaryAttack = GetNextAttackDelay(flCycleTime);\n\n#ifndef CLIENT_DLL\n\tif (!m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0)\n\t{\n\t\tm_pPlayer->SetSuitUpdate(\"!HEV_AMO0\", FALSE, 0);\n\t}\n#endif\n\tm_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 2.0f;\n\n\tif (!(m_pPlayer->pev->flags & FL_ONGROUND))\n\t{\n\t\tKickBack(0.125, 0.65, 0.55, 0.0475, 5.5, 4.0, 10);\n\t}\n\telse if (m_pPlayer->pev->velocity.Length2D() > 0)\n\t{\n\t\tKickBack(0.55, 0.3, 0.225, 0.03, 3.5, 2.5, 10);\n\t}\n\telse if (m_pPlayer->pev->flags & FL_DUCKING)\n\t{\n\t\tKickBack(0.25, 0.175, 0.125, 0.02, 2.25, 1.25, 10);\n\t}\n\telse\n\t{\n\t\tKickBack(0.275, 0.2, 0.15, 0.0225, 2.5, 1.5, 10);\n\t}\n}\n\nvoid CUMP45::Reload()\n{\n\tif (m_pPlayer->ammo_45acp <= 0)\n\t\treturn;\n\n\tif (DefaultReload(iMaxClip(), UMP45_RELOAD, UMP45_RELOAD_TIME))\n\t{\n#ifndef CLIENT_DLL\n\t\tm_pPlayer->SetAnimation(PLAYER_RELOAD);\n#endif\n\t\tm_flAccuracy = 0.0f;\n\t\tm_iShotsFired = 0;\n\t}\n}\n\nvoid CUMP45::WeaponIdle()\n{\n\tResetEmptySound();\n\tm_pPlayer->GetAutoaimVector(AUTOAIM_10DEGREES);\n\n\tif (m_flTimeWeaponIdle > UTIL_WeaponTimeBase())\n\t{\n\t\treturn;\n\t}\n\n\tm_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 20.0f;\n\tSendWeaponAnim(UMP45_IDLE1, UseDecrement() != FALSE);\n}\n"
  },
  {
    "path": "dlls/wpn_shared/wpn_usp.cpp",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\n*\tThis product contains software technology licensed from Id\n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc.\n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n\n#include \"stdafx.h\"\n#include \"cbase.h\"\n#include \"player.h\"\n#include \"weapons.h\"\n\nLINK_ENTITY_TO_CLASS(weapon_usp, CUSP)\n\nvoid CUSP::Spawn(void)\n{\n\tpev->classname = MAKE_STRING(\"weapon_usp\");\n\n\tPrecache();\n\n\tm_iId = WEAPON_USP;\n\tSET_MODEL(ENT(pev), \"models/w_usp.mdl\");\n\n\tm_iWeaponState &= ~WPNSTATE_SHIELD_DRAWN;\n\tm_iDefaultAmmo = USP_DEFAULT_GIVE;\n\tm_flAccuracy = 0.92f;\n\n\tFallInit();\n}\n\nvoid CUSP::Precache()\n{\n\tPRECACHE_MODEL(\"models/v_usp.mdl\");\n\tPRECACHE_MODEL(\"models/w_usp.mdl\");\n\tPRECACHE_MODEL(\"models/shield/v_shield_usp.mdl\");\n\n\tPRECACHE_SOUND(\"weapons/usp1.wav\");\n\tPRECACHE_SOUND(\"weapons/usp2.wav\");\n\tPRECACHE_SOUND(\"weapons/usp_unsil-1.wav\");\n\tPRECACHE_SOUND(\"weapons/usp_clipout.wav\");\n\tPRECACHE_SOUND(\"weapons/usp_clipin.wav\");\n\tPRECACHE_SOUND(\"weapons/usp_silencer_on.wav\");\n\tPRECACHE_SOUND(\"weapons/usp_silencer_off.wav\");\n\tPRECACHE_SOUND(\"weapons/usp_sliderelease.wav\");\n\tPRECACHE_SOUND(\"weapons/usp_slideback.wav\");\n\n\tm_iShell = PRECACHE_MODEL(\"models/pshell.mdl\");\n\tm_usFireUSP = PRECACHE_EVENT(1, \"events/usp.sc\");\n}\n\nint CUSP::GetItemInfo(ItemInfo *p)\n{\n\tp->pszName = STRING(pev->classname);\n#ifdef REGAMEDLL_FIXES\n\tp->pszAmmo1 = \"45acp\";\n#else\n\tp->pszAmmo1 = \"45ACP\";\n#endif // REGAMEDLL_FIXES\n\tp->iMaxAmmo1 = MAX_AMMO_45ACP;\n\tp->pszAmmo2 = NULL;\n\tp->iMaxAmmo2 = -1;\n\tp->iMaxClip = USP_MAX_CLIP;\n\tp->iSlot = 1;\n\tp->iPosition = 4;\n\tp->iFlags = 0;\n\tp->iId = m_iId = WEAPON_USP;\n\tp->iWeight = USP_WEIGHT;\n\n\treturn 1;\n}\n\nBOOL CUSP::Deploy()\n{\n\tm_iWeaponState &= ~WPNSTATE_SHIELD_DRAWN;\n\tm_flAccuracy = 0.92f;\n\tm_fMaxSpeed = USP_MAX_SPEED;\n\tm_pPlayer->m_bShieldDrawn = false;\n\n\tif (m_pPlayer->HasShield())\n\t{\n\t\tm_iWeaponState &= ~WPNSTATE_USP_SILENCED;\n\t\treturn DefaultDeploy(\"models/shield/v_shield_usp.mdl\", \"models/shield/p_shield_usp.mdl\", USP_SHIELD_DRAW, \"shieldgun\", UseDecrement());\n\t}\n\telse if (m_iWeaponState & WPNSTATE_USP_SILENCED)\n\t{\n\t\treturn DefaultDeploy(\"models/v_usp.mdl\", \"models/p_usp.mdl\", USP_DRAW, \"onehanded\", UseDecrement());\n\t}\n\n\treturn DefaultDeploy(\"models/v_usp.mdl\", \"models/p_usp.mdl\", USP_UNSIL_DRAW, \"onehanded\", UseDecrement());\n}\n\nvoid CUSP::SecondaryAttack()\n{\n\tif (ShieldSecondaryFire(USP_SHIELD_UP, USP_SHIELD_DOWN))\n\t{\n\t\treturn;\n\t}\n\n\tif (m_iWeaponState & WPNSTATE_USP_SILENCED)\n\t{\n\t\tm_iWeaponState &= ~WPNSTATE_USP_SILENCED;\n\n\t\tSendWeaponAnim(USP_DETACH_SILENCER, UseDecrement() != FALSE);\n\t\tstrcpy(m_pPlayer->m_szAnimExtention, \"onehanded\");\n\t}\n\telse\n\t{\n\t\tm_iWeaponState |= WPNSTATE_USP_SILENCED;\n\n\t\tSendWeaponAnim(USP_ATTACH_SILENCER, UseDecrement() != FALSE);\n\t\tstrcpy(m_pPlayer->m_szAnimExtention, \"onehanded\");\n\t}\n\n\tm_flNextSecondaryAttack = m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 3.0f;\n\tm_flNextPrimaryAttack = GetNextAttackDelay(3.0);\n}\n\nvoid CUSP::PrimaryAttack()\n{\n\tif (m_iWeaponState & WPNSTATE_USP_SILENCED)\n\t{\n\t\tif (!(m_pPlayer->pev->flags & FL_ONGROUND))\n\t\t{\n\t\t\tUSPFire(1.3 * (1 - m_flAccuracy), 0.225, FALSE);\n\t\t}\n\t\telse if (m_pPlayer->pev->velocity.Length2D() > 0)\n\t\t{\n\t\t\tUSPFire(0.25 * (1 - m_flAccuracy), 0.225, FALSE);\n\t\t}\n\t\telse if (m_pPlayer->pev->flags & FL_DUCKING)\n\t\t{\n\t\t\tUSPFire(0.125 * (1 - m_flAccuracy), 0.225, FALSE);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tUSPFire(0.15 * (1 - m_flAccuracy), 0.225, FALSE);\n\t\t}\n\t}\n\telse\n\t{\n\t\tif (!(m_pPlayer->pev->flags & FL_ONGROUND))\n\t\t{\n\t\t\tUSPFire(1.2 * (1 - m_flAccuracy), 0.225, FALSE);\n\t\t}\n\t\telse if (m_pPlayer->pev->velocity.Length2D() > 0)\n\t\t{\n\t\t\tUSPFire(0.225 * (1 - m_flAccuracy), 0.225, FALSE);\n\t\t}\n\t\telse if (m_pPlayer->pev->flags & FL_DUCKING)\n\t\t{\n\t\t\tUSPFire(0.08 * (1 - m_flAccuracy), 0.225, FALSE);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tUSPFire(0.1 * (1 - m_flAccuracy), 0.225, FALSE);\n\t\t}\n\t}\n}\n\nvoid CUSP::USPFire(float flSpread, float flCycleTime, BOOL fUseSemi)\n{\n\tint flag;\n\tint iDamage;\n\tVector vecAiming, vecSrc, vecDir;\n\n\tflCycleTime -= 0.075f;\n\n\tif (++m_iShotsFired > 1)\n\t{\n\t\treturn;\n\t}\n\n\tif (m_flLastFire != 0.0f)\n\t{\n\t\tm_flAccuracy -= (0.3f - (gpGlobals->time - m_flLastFire)) * 0.275f;\n\n\t\tif (m_flAccuracy > 0.92f)\n\t\t{\n\t\t\tm_flAccuracy = 0.92f;\n\t\t}\n\t\telse if (m_flAccuracy < 0.6f)\n\t\t{\n\t\t\tm_flAccuracy = 0.6f;\n\t\t}\n\t}\n\n\tm_flLastFire = gpGlobals->time;\n\n\tif (m_iClip <= 0)\n\t{\n\t\tif (m_fFireOnEmpty)\n\t\t{\n\t\t\tPlayEmptySound();\n\t\t\tm_flNextPrimaryAttack = GetNextAttackDelay(0.2);\n\t\t}\n\n#ifndef CLIENT_DLL\n\t\tif (TheBots != NULL)\n\t\t{\n\t\t\tTheBots->OnEvent(EVENT_WEAPON_FIRED_ON_EMPTY, m_pPlayer);\n\t\t}\n#endif\n\n\t\treturn;\n\t}\n\n\tm_flNextPrimaryAttack = m_flNextSecondaryAttack = GetNextAttackDelay(flCycleTime);\n\n\t--m_iClip;\n\tSetPlayerShieldAnim();\n\n#ifndef CLIENT_DLL\n\tm_pPlayer->SetAnimation(PLAYER_ATTACK1);\n#endif\n\tm_pPlayer->m_iWeaponVolume = BIG_EXPLOSION_VOLUME;\n\tm_pPlayer->m_iWeaponFlash = DIM_GUN_FLASH;\n\n\tUTIL_MakeVectors(m_pPlayer->pev->v_angle + m_pPlayer->pev->punchangle);\n\n\tif (!(m_iWeaponState & WPNSTATE_USP_SILENCED))\n\t{\n\t\tm_pPlayer->pev->effects |= EF_MUZZLEFLASH;\n\t}\n\n\tvecSrc = m_pPlayer->GetGunPosition();\n\tvecAiming = gpGlobals->v_forward;\n\n\tiDamage = (m_iWeaponState & WPNSTATE_USP_SILENCED) ? USP_DAMAGE_SIL : USP_DAMAGE;\n\n\tvecDir = m_pPlayer->FireBullets3(vecSrc, vecAiming, flSpread, 4096, 1, BULLET_PLAYER_45ACP, iDamage, USP_RANGE_MODIFER, m_pPlayer->pev, true, m_pPlayer->random_seed);\n\n#ifdef CLIENT_WEAPONS\n\tflag = FEV_NOTHOST;\n#else\n\tflag = 0;\n#endif // CLIENT_WEAPONS\n\n\tPLAYBACK_EVENT_FULL(flag, m_pPlayer->edict(), m_usFireUSP, 0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y,\n\t\t(int)(m_pPlayer->pev->punchangle.x * 100), 0, m_iClip == 0, (m_iWeaponState & WPNSTATE_USP_SILENCED));\n\n#ifndef CLIENT_DLL\n\tif (!m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0)\n\t{\n\t\tm_pPlayer->SetSuitUpdate(\"!HEV_AMO0\", FALSE, FALSE);\n\t}\n#endif\n\tm_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 2.0f;\n\tm_pPlayer->pev->punchangle.x -= 2.0f;\n\tResetPlayerShieldAnim();\n}\n\nvoid CUSP::Reload()\n{\n\tif (m_pPlayer->ammo_45acp <= 0)\n\t\treturn;\n\n\tint iAnim;\n\tif (m_pPlayer->HasShield())\n\t\tiAnim = USP_SHIELD_RELOAD;\n\telse if (m_iWeaponState & WPNSTATE_USP_SILENCED)\n\t\tiAnim = USP_RELOAD;\n\telse\n\t\tiAnim = USP_UNSIL_RELOAD;\n\n\tif (DefaultReload(iMaxClip(), iAnim, USP_RELOAD_TIME))\n\t{\n#ifndef CLIENT_DLL\n\t\tm_pPlayer->SetAnimation(PLAYER_RELOAD);\n#endif\n\t\tm_flAccuracy = 0.92f;\n\t}\n}\n\nvoid CUSP::WeaponIdle()\n{\n\tResetEmptySound();\n\tm_pPlayer->GetAutoaimVector(AUTOAIM_10DEGREES);\n\n\tif (m_flTimeWeaponIdle > 0)\n\t{\n\t\treturn;\n\t}\n\n\tif (m_pPlayer->HasShield())\n\t{\n\t\tm_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 20.0f;\n\n\t\tif (m_iWeaponState & WPNSTATE_SHIELD_DRAWN)\n\t\t{\n\t\t\tSendWeaponAnim(USP_DRAW, UseDecrement());\n\t\t}\n\t}\n\telse if (m_iClip)\n\t{\n\t\tint iAnim = (~m_iWeaponState & WPNSTATE_USP_SILENCED) ? USP_UNSIL_IDLE: USP_IDLE;\n\n\t\tm_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 60.0f;\n\t\tSendWeaponAnim(iAnim, UseDecrement());\n\t}\n}\n"
  },
  {
    "path": "dlls/wpn_shared/wpn_xm1014.cpp",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\n*\tThis product contains software technology licensed from Id\n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc.\n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n\n#include \"stdafx.h\"\n#include \"cbase.h\"\n#include \"player.h\"\n#include \"weapons.h\"\n\nLINK_ENTITY_TO_CLASS(weapon_xm1014, CXM1014)\n\nvoid CXM1014::Spawn(void)\n{\n\tPrecache();\n\n\tm_iId = WEAPON_XM1014;\n\tSET_MODEL(edict(), \"models/w_xm1014.mdl\");\n\n\tm_iDefaultAmmo = XM1014_DEFAULT_GIVE;\n\n\t// get ready to fall\n\tFallInit();\n}\n\nvoid CXM1014::Precache()\n{\n\tPRECACHE_MODEL(\"models/v_xm1014.mdl\");\n\tPRECACHE_MODEL(\"models/w_xm1014.mdl\");\n\n\tm_iShellId = m_iShell = PRECACHE_MODEL(\"models/shotgunshell.mdl\");\n\n\tPRECACHE_SOUND(\"weapons/xm1014-1.wav\");\n\tPRECACHE_SOUND(\"weapons/reload1.wav\");\n\tPRECACHE_SOUND(\"weapons/reload3.wav\");\n\n\tm_usFireXM1014 = PRECACHE_EVENT(1, \"events/xm1014.sc\");\n}\n\nint CXM1014::GetItemInfo(ItemInfo *p)\n{\n\tp->pszName = STRING(pev->classname);\n\tp->pszAmmo1 = \"buckshot\";\n\tp->iMaxAmmo1 = MAX_AMMO_BUCKSHOT;\n\tp->pszAmmo2 = NULL;\n\tp->iMaxAmmo2 = -1;\n\tp->iMaxClip = XM1014_MAX_CLIP;\n\tp->iSlot = 0;\n\tp->iPosition = 12;\n\tp->iId = m_iId = WEAPON_XM1014;\n\tp->iFlags = 0;\n\tp->iWeight = XM1014_WEIGHT;\n\n\treturn 1;\n}\n\nBOOL CXM1014::Deploy()\n{\n\treturn DefaultDeploy(\"models/v_xm1014.mdl\", \"models/p_xm1014.mdl\", XM1014_DRAW, \"m249\", UseDecrement() != FALSE);\n}\n\nvoid CXM1014::PrimaryAttack()\n{\n\tVector vecAiming, vecSrc, vecDir;\n\tint flag;\n\n\t// don't fire underwater\n\tif (m_pPlayer->pev->waterlevel == 3)\n\t{\n\t\tPlayEmptySound();\n\t\tm_flNextPrimaryAttack = GetNextAttackDelay(0.15);\n\t\treturn;\n\t}\n\n\tif (m_iClip <= 0)\n\t{\n\t\tReload();\n\n\t\tif (!m_iClip)\n\t\t{\n\t\t\tPlayEmptySound();\n\t\t}\n\n#ifndef CLIENT_DLL\n\t\tif (TheBots != NULL)\n\t\t{\n\t\t\tTheBots->OnEvent(EVENT_WEAPON_FIRED_ON_EMPTY, m_pPlayer);\n\t\t}\n#endif\n\n\t\tm_flNextPrimaryAttack = GetNextAttackDelay(1);\n\t\treturn;\n\t}\n\n\tm_pPlayer->m_iWeaponVolume = LOUD_GUN_VOLUME;\n\tm_pPlayer->m_iWeaponFlash = BRIGHT_GUN_FLASH;\n\tm_iClip--;\n\n\tm_pPlayer->pev->effects |= EF_MUZZLEFLASH;\n\t// player \"shoot\" animation\n#ifndef CLIENT_DLL\n\tm_pPlayer->SetAnimation(PLAYER_ATTACK1);\n#endif\n\n\tUTIL_MakeVectors(m_pPlayer->pev->v_angle + m_pPlayer->pev->punchangle);\n\n\tvecSrc = m_pPlayer->GetGunPosition();\n\tvecAiming = gpGlobals->v_forward;\n\n#ifndef CLIENT_DLL\n\tm_pPlayer->FireBullets(6, vecSrc, vecAiming, XM1014_CONE_VECTOR, 3048, BULLET_PLAYER_BUCKSHOT, 0);\n#endif\n\n#ifdef CLIENT_WEAPONS\n\tflag = FEV_NOTHOST;\n#else\n\tflag = 0;\n#endif\n\n\tPLAYBACK_EVENT_FULL(flag, m_pPlayer->edict(), m_usFireXM1014, 0, (float *)&g_vecZero, (float *)&g_vecZero, m_vVecAiming.x, m_vVecAiming.y, 7,\n\t\tint(m_vVecAiming.x * 100), m_iClip == 0, FALSE);\n\n#ifndef CLIENT_DLL\n\tif (!m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0)\n\t{\n\t\t// HEV suit - indicate out of ammo condition\n\t\tm_pPlayer->SetSuitUpdate(\"!HEV_AMO0\", FALSE, 0);\n\t}\n#endif\n\tif (m_iClip != 0)\n\t\tm_flPumpTime = UTIL_WeaponTimeBase() + 0.125f;\n\n\tm_flNextPrimaryAttack = GetNextAttackDelay(0.25);\n\tm_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.25f;\n\n\tif (m_iClip != 0)\n\t\tm_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 2.25f;\n\telse\n\t\tm_flTimeWeaponIdle = 0.75f;\n\n\tm_fInSpecialReload = 0;\n\n\tif (m_pPlayer->pev->flags & FL_ONGROUND)\n\t\tm_pPlayer->pev->punchangle.x -= UTIL_SharedRandomLong(m_pPlayer->random_seed + 1, 3, 5);\n\telse\n\t\tm_pPlayer->pev->punchangle.x -= UTIL_SharedRandomLong(m_pPlayer->random_seed + 1, 7, 10);\n}\n\nvoid CXM1014::Reload()\n{\n\tif (m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0 || m_iClip == iMaxClip())\n\t\treturn;\n\n\t// don't reload until recoil is done\n\tif (m_flNextPrimaryAttack > UTIL_WeaponTimeBase())\n\t\treturn;\n\n\t// check to see if we're ready to reload\n\tif (m_fInSpecialReload == 0)\n\t{\n#ifndef CLIENT_DLL\n\t\tm_pPlayer->SetAnimation(PLAYER_RELOAD);\n#endif\n\t\tSendWeaponAnim(XM1014_START_RELOAD, UseDecrement() != FALSE);\n\n\t\tm_fInSpecialReload = 1;\n\t\tm_flNextSecondaryAttack = m_flTimeWeaponIdle = m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.55f;\n\t\tm_flNextPrimaryAttack = GetNextAttackDelay(0.55);\n\t}\n\telse if (m_fInSpecialReload == 1)\n\t{\n\t\tif (m_flTimeWeaponIdle > UTIL_WeaponTimeBase())\n\t\t\treturn;\n\n\t\t// was waiting for gun to move to side\n\t\tm_fInSpecialReload = 2;\n\n\t\tif (RANDOM_LONG(0, 1))\n\t\t\tEMIT_SOUND_DYN(m_pPlayer->edict(), CHAN_ITEM, \"weapons/reload1.wav\", VOL_NORM, ATTN_NORM, 0, 85 + RANDOM_LONG(0, 31));\n\t\telse\n\t\t\tEMIT_SOUND_DYN(m_pPlayer->edict(), CHAN_ITEM, \"weapons/reload3.wav\", VOL_NORM, ATTN_NORM, 0, 85 + RANDOM_LONG(0, 31));\n\n\t\tSendWeaponAnim(XM1014_RELOAD, UseDecrement());\n\n\t\tm_flTimeWeaponIdle = m_flNextReload = UTIL_WeaponTimeBase() + 0.3f;\n\t}\n\telse\n\t{\n\t\t++m_iClip;\n\n#ifdef REGAMEDLL_ADD\n\t\tif (refill_bpammo_weapons.value < 3.0f)\n#endif\n\t\t{\n\t\t\t--m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType];\n\t\t\t--m_pPlayer->ammo_buckshot;\n\t\t}\n\n\t\tm_fInSpecialReload = 1;\n\t}\n}\n\nvoid CXM1014::WeaponIdle()\n{\n\tResetEmptySound();\n\tm_pPlayer->GetAutoaimVector(AUTOAIM_5DEGREES);\n\n\tif (m_flPumpTime && m_flPumpTime < UTIL_WeaponTimeBase())\n\t{\n\t\tm_flPumpTime = 0;\n\t}\n\n\tif (m_flTimeWeaponIdle < UTIL_WeaponTimeBase())\n\t{\n\t\tif (m_iClip == 0 && m_fInSpecialReload == 0 && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType])\n\t\t{\n\t\t\tReload();\n\t\t}\n\t\telse if (m_fInSpecialReload != 0)\n\t\t{\n\t\t\tif (m_iClip != iMaxClip() && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType])\n\t\t\t{\n\t\t\t\tReload();\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t// reload debounce has timed out\n\t\t\t\tSendWeaponAnim(XM1014_PUMP, UseDecrement() != FALSE);\n\n\t\t\t\tm_fInSpecialReload = 0;\n\t\t\t\tm_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.5f;\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tSendWeaponAnim(XM1014_IDLE, UseDecrement() != FALSE);\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "dlls/wpn_shared.h",
    "content": "#pragma once\r\n\r\n//AK47\r\n#define AK47_MAX_SPEED\t\t\t221\r\n#define AK47_DAMAGE\t\t\t36\r\n#define AK47_RANGE_MODIFER\t\t0.98\r\n#define AK47_RELOAD_TIME\t\t2.45\r\n\r\nenum ak47_e\r\n{\r\n\tAK47_IDLE1,\r\n\tAK47_RELOAD,\r\n\tAK47_DRAW,\r\n\tAK47_SHOOT1,\r\n\tAK47_SHOOT2,\r\n\tAK47_SHOOT3\r\n};\r\n\r\n\r\n\r\n//AUG\r\n#define AUG_MAX_SPEED\t\t\t240\r\n#define AUG_DAMAGE\t\t\t32\r\n#define AUG_RANGE_MODIFER\t\t0.96\r\n#define AUG_RELOAD_TIME\t\t\t3.3\r\n\r\nenum aug_e\r\n{\r\n\tAUG_IDLE1,\r\n\tAUG_RELOAD,\r\n\tAUG_DRAW,\r\n\tAUG_SHOOT1,\r\n\tAUG_SHOOT2,\r\n\tAUG_SHOOT3\r\n};\r\n\r\n\r\n\r\n//AWP\r\n#define AWP_MAX_SPEED\t\t210\r\n#define AWP_MAX_SPEED_ZOOM\t150\r\n#define AWP_DAMAGE\t\t115\r\n#define AWP_RANGE_MODIFER\t0.99\r\n#define AWP_RELOAD_TIME\t\t2.5\r\n\r\nenum awp_e\r\n{\r\n\tAWP_IDLE,\r\n\tAWP_SHOOT,\r\n\tAWP_SHOOT2,\r\n\tAWP_SHOOT3,\r\n\tAWP_RELOAD,\r\n\tAWP_DRAW,\r\n};\r\n\r\n\r\n\r\n//C4\r\n#define C4_MAX_AMMO\t\t1\r\n#define C4_MAX_SPEED\t\t250.0\r\n#define C4_ARMING_ON_TIME\t3.0\r\n\r\nenum c4_e\r\n{\r\n\tC4_IDLE1,\r\n\tC4_DRAW,\r\n\tC4_DROP,\r\n\tC4_ARM\r\n};\r\n\r\n\r\n\r\n//Deagle\r\n#define DEAGLE_MAX_SPEED\t250\r\n#define DEAGLE_DAMAGE\t\t54\r\n#define DEAGLE_RANGE_MODIFER\t0.81\r\n#define DEAGLE_RELOAD_TIME\t2.2\r\n\r\nenum deagle_e\r\n{\r\n\tDEAGLE_IDLE1,\r\n\tDEAGLE_SHOOT1,\r\n\tDEAGLE_SHOOT2,\r\n\tDEAGLE_SHOOT_EMPTY,\r\n\tDEAGLE_RELOAD,\r\n\tDEAGLE_DRAW\r\n};\r\n\r\n\r\n\r\n//Elites\r\n#define ELITE_MAX_SPEED\t\t250\r\n#define ELITE_RELOAD_TIME\t4.5\r\n#define ELITE_DAMAGE\t\t36\r\n#define ELITE_RANGE_MODIFER\t0.75\r\n\r\nenum elite_e\r\n{\r\n\tELITE_IDLE,\r\n\tELITE_IDLE_LEFTEMPTY,\r\n\tELITE_SHOOTLEFT1,\r\n\tELITE_SHOOTLEFT2,\r\n\tELITE_SHOOTLEFT3,\r\n\tELITE_SHOOTLEFT4,\r\n\tELITE_SHOOTLEFT5,\r\n\tELITE_SHOOTLEFTLAST,\r\n\tELITE_SHOOTRIGHT1,\r\n\tELITE_SHOOTRIGHT2,\r\n\tELITE_SHOOTRIGHT3,\r\n\tELITE_SHOOTRIGHT4,\r\n\tELITE_SHOOTRIGHT5,\r\n\tELITE_SHOOTRIGHTLAST,\r\n\tELITE_RELOAD,\r\n\tELITE_DRAW\r\n};\r\n\r\n\r\n\r\n//Famas\r\n#define FAMAS_MAX_SPEED\t\t240\r\n#define FAMAS_RELOAD_TIME\t3.3\r\n#define FAMAS_DAMAGE\t\t30\r\n#define FAMAS_DAMAGE_BURST\t34\r\n#define FAMAS_RANGE_MODIFER\t0.96\r\n\r\nenum famas_e\r\n{\r\n\tFAMAS_IDLE1,\r\n\tFAMAS_RELOAD,\r\n\tFAMAS_DRAW,\r\n\tFAMAS_SHOOT1,\r\n\tFAMAS_SHOOT2,\r\n\tFAMAS_SHOOT3\r\n};\r\n\r\n\r\n\r\n//Fiveseven\r\n#define FIVESEVEN_MAX_SPEED\t\t250\r\n#define FIVESEVEN_DAMAGE\t\t20\r\n#define FIVESEVEN_RANGE_MODIFER\t\t0.885\r\n#define FIVESEVEN_RELOAD_TIME\t\t2.7\r\n\r\nenum fiveseven_e\r\n{\r\n\tFIVESEVEN_IDLE,\r\n\tFIVESEVEN_SHOOT1,\r\n\tFIVESEVEN_SHOOT2,\r\n\tFIVESEVEN_SHOOT_EMPTY,\r\n\tFIVESEVEN_RELOAD,\r\n\tFIVESEVEN_DRAW\r\n};\r\n\r\n\r\n\r\n//Flashbang\r\n#define FLASHBANG_MAX_SPEED\t\t250\r\n#define FLASHBANG_MAX_SPEED_SHIELD\t180\r\n\r\nenum flashbang_e\r\n{\r\n\tFLASHBANG_IDLE,\r\n\tFLASHBANG_PULLPIN,\r\n\tFLASHBANG_THROW,\r\n\tFLASHBANG_DRAW\r\n};\r\n\r\n\r\n\r\n//g3sg1\r\n#define G3SG1_MAX_SPEED\t\t210\r\n#define G3SG1_MAX_SPEED_ZOOM\t150\r\n#define G3SG1_DAMAGE\t\t80\r\n#define G3SG1_RANGE_MODIFER\t0.98\r\n#define G3SG1_RELOAD_TIME\t3.5\r\n\r\nenum g3sg1_e\r\n{\r\n\tG3SG1_IDLE,\r\n\tG3SG1_SHOOT,\r\n\tG3SG1_SHOOT2,\r\n\tG3SG1_RELOAD,\r\n\tG3SG1_DRAW\r\n};\r\n\r\n\r\n\r\n//galil\r\n#define GALIL_MAX_SPEED\t\t\t240\r\n#define GALIL_DAMAGE\t\t\t30\r\n#define GALIL_RANGE_MODIFER\t\t0.98\r\n#define GALIL_RELOAD_TIME\t\t2.45\r\n\r\nenum galil_e\r\n{\r\n\tGALIL_IDLE1,\r\n\tGALIL_RELOAD,\r\n\tGALIL_DRAW,\r\n\tGALIL_SHOOT1,\r\n\tGALIL_SHOOT2,\r\n\tGALIL_SHOOT3\r\n};\r\n\r\n\r\n\r\n//glock18\r\n#define GLOCK18_MAX_SPEED\t\t250\r\n#define GLOCK18_DAMAGE\t\t\t25\r\n#define GLOCK18_RANGE_MODIFER\t\t0.75\r\n#define GLOCK18_RELOAD_TIME\t\t2.2\r\n\r\nenum glock18_e\r\n{\r\n\tGLOCK18_IDLE1,\r\n\tGLOCK18_IDLE2,\r\n\tGLOCK18_IDLE3,\r\n\tGLOCK18_SHOOT,\r\n\tGLOCK18_SHOOT2,\r\n\tGLOCK18_SHOOT3,\r\n\tGLOCK18_SHOOT_EMPTY,\r\n\tGLOCK18_RELOAD,\r\n\tGLOCK18_DRAW,\r\n\tGLOCK18_HOLSTER,\r\n\tGLOCK18_ADD_SILENCER,\r\n\tGLOCK18_DRAW2,\r\n\tGLOCK18_RELOAD2\r\n};\r\n\r\nenum glock18_shield_e\r\n{\r\n\tGLOCK18_SHIELD_IDLE1,\r\n\tGLOCK18_SHIELD_SHOOT,\r\n\tGLOCK18_SHIELD_SHOOT2,\r\n\tGLOCK18_SHIELD_SHOOT_EMPTY,\r\n\tGLOCK18_SHIELD_RELOAD,\r\n\tGLOCK18_SHIELD_DRAW,\r\n\tGLOCK18_SHIELD_IDLE,\r\n\tGLOCK18_SHIELD_UP,\r\n\tGLOCK18_SHIELD_DOWN\r\n};\r\n\r\n\r\n\r\n//hegrenade\r\n#define HEGRENADE_MAX_SPEED\t\t250\r\n#define HEGRENADE_MAX_SPEED_SHIELD\t180\r\n\r\nenum hegrenade_e\r\n{\r\n\tHEGRENADE_IDLE,\r\n\tHEGRENADE_PULLPIN,\r\n\tHEGRENADE_THROW,\r\n\tHEGRENADE_DRAW\r\n};\r\n\r\n\r\n\r\n//knife\r\n#define KNIFE_BODYHIT_VOLUME\t\t128\r\n#define KNIFE_WALLHIT_VOLUME\t\t512\r\n#define KNIFE_MAX_SPEED\t\t\t250\r\n#define KNIFE_MAX_SPEED_SHIELD\t\t180\r\n\r\nenum knife_e\r\n{\r\n\tKNIFE_IDLE,\r\n\tKNIFE_ATTACK1HIT,\r\n\tKNIFE_ATTACK2HIT,\r\n\tKNIFE_DRAW,\r\n\tKNIFE_STABHIT,\r\n\tKNIFE_STABMISS,\r\n\tKNIFE_MIDATTACK1HIT,\r\n\tKNIFE_MIDATTACK2HIT\r\n};\r\n\r\nenum knife_shield_e\r\n{\r\n\tKNIFE_SHIELD_IDLE,\r\n\tKNIFE_SHIELD_SLASH,\r\n\tKNIFE_SHIELD_ATTACKHIT,\r\n\tKNIFE_SHIELD_DRAW,\r\n\tKNIFE_SHIELD_UPIDLE,\r\n\tKNIFE_SHIELD_UP,\r\n\tKNIFE_SHIELD_DOWN\r\n};\r\n\r\n\r\n\r\n//m3\r\n#define M3_MAX_SPEED\t\t230\r\n#define M3_CONE_VECTOR\t\tVector(0.0675, 0.0675, 0.0)\t// special shotgun spreads\r\n\r\nenum m3_e\r\n{\r\n\tM3_IDLE,\r\n\tM3_FIRE1,\r\n\tM3_FIRE2,\r\n\tM3_RELOAD,\r\n\tM3_PUMP,\r\n\tM3_START_RELOAD,\r\n\tM3_DRAW,\r\n\tM3_HOLSTER\r\n};\r\n\r\n\r\n\r\n//m4a1\r\n#define M4A1_MAX_SPEED\t\t230\r\n#define M4A1_DAMAGE\t\t32\r\n#define M4A1_DAMAGE_SIL\t\t33\r\n#define M4A1_RANGE_MODIFER      0.97\r\n#define M4A1_RANGE_MODIFER_SIL  0.95\r\n#define M4A1_RELOAD_TIME\t3.05\r\n\r\nenum m4a1_e\r\n{\r\n\tM4A1_IDLE,\r\n\tM4A1_SHOOT1,\r\n\tM4A1_SHOOT2,\r\n\tM4A1_SHOOT3,\r\n\tM4A1_RELOAD,\r\n\tM4A1_DRAW,\r\n\tM4A1_ATTACH_SILENCER,\r\n\tM4A1_UNSIL_IDLE,\r\n\tM4A1_UNSIL_SHOOT1,\r\n\tM4A1_UNSIL_SHOOT2,\r\n\tM4A1_UNSIL_SHOOT3,\r\n\tM4A1_UNSIL_RELOAD,\r\n\tM4A1_UNSIL_DRAW,\r\n\tM4A1_DETACH_SILENCER\r\n};\r\n\r\n\r\n\r\n//m249\r\n#define M249_MAX_SPEED\t\t\t220\r\n#define M249_DAMAGE\t\t\t32\r\n#define M249_RANGE_MODIFER\t\t0.97\r\n#define M249_RELOAD_TIME\t\t4.7\r\n\r\nenum m249_e\r\n{\r\n\tM249_IDLE1,\r\n\tM249_SHOOT1,\r\n\tM249_SHOOT2,\r\n\tM249_RELOAD,\r\n\tM249_DRAW\r\n};\r\n\r\n\r\n\r\n//mac10\r\n#define MAC10_MAX_SPEED\t\t\t250\r\n#define MAC10_DAMAGE\t\t\t29\r\n#define MAC10_RANGE_MODIFER\t\t0.82\r\n#define MAC10_RELOAD_TIME\t\t3.15\r\n\r\nenum mac10_e\r\n{\r\n\tMAC10_IDLE1,\r\n\tMAC10_RELOAD,\r\n\tMAC10_DRAW,\r\n\tMAC10_SHOOT1,\r\n\tMAC10_SHOOT2,\r\n\tMAC10_SHOOT3\r\n};\r\n\r\n\r\n\r\n//mp5navy\r\n#define MP5N_MAX_SPEED\t\t\t250\r\n#define MP5N_DAMAGE\t\t\t26\r\n#define MP5N_RANGE_MODIFER\t\t0.84\r\n#define MP5N_RELOAD_TIME\t\t2.63\r\n\r\nenum mp5n_e\r\n{\r\n\tMP5N_IDLE1,\r\n\tMP5N_RELOAD,\r\n\tMP5N_DRAW,\r\n\tMP5N_SHOOT1,\r\n\tMP5N_SHOOT2,\r\n\tMP5N_SHOOT3\r\n};\r\n\r\n\r\n\r\n//p90\r\n#define P90_MAX_SPEED\t\t245\r\n#define P90_DAMAGE\t\t21\r\n#define P90_RANGE_MODIFER\t0.885\r\n#define P90_RELOAD_TIME\t\t3.4\r\n\r\nenum p90_e\r\n{\r\n\tP90_IDLE1,\r\n\tP90_RELOAD,\r\n\tP90_DRAW,\r\n\tP90_SHOOT1,\r\n\tP90_SHOOT2,\r\n\tP90_SHOOT3\r\n};\r\n\r\n\r\n\r\n//p228\r\n#define P228_MAX_SPEED\t\t250\r\n#define P228_DAMAGE\t\t32\r\n#define P228_RANGE_MODIFER\t0.8\r\n#define P228_RELOAD_TIME\t2.7\r\n\r\nenum p228_e\r\n{\r\n\tP228_IDLE,\r\n\tP228_SHOOT1,\r\n\tP228_SHOOT2,\r\n\tP228_SHOOT3,\r\n\tP228_SHOOT_EMPTY,\r\n\tP228_RELOAD,\r\n\tP228_DRAW\r\n};\r\n\r\nenum p228_shield_e\r\n{\r\n\tP228_SHIELD_IDLE,\r\n\tP228_SHIELD_SHOOT1,\r\n\tP228_SHIELD_SHOOT2,\r\n\tP228_SHIELD_SHOOT_EMPTY,\r\n\tP228_SHIELD_RELOAD,\r\n\tP228_SHIELD_DRAW,\r\n\tP228_SHIELD_IDLE_UP,\r\n\tP228_SHIELD_UP,\r\n\tP228_SHIELD_DOWN\r\n};\r\n\r\n\r\n\r\n//scout\r\n#define SCOUT_MAX_SPEED\t\t\t260\r\n#define SCOUT_MAX_SPEED_ZOOM\t\t220\r\n#define SCOUT_DAMAGE\t\t\t75\r\n#define SCOUT_RANGE_MODIFER\t\t0.98\r\n#define SCOUT_RELOAD_TIME\t\t2\r\n\r\nenum scout_e\r\n{\r\n\tSCOUT_IDLE,\r\n\tSCOUT_SHOOT,\r\n\tSCOUT_SHOOT2,\r\n\tSCOUT_RELOAD,\r\n\tSCOUT_DRAW\r\n};\r\n\r\n\r\n\r\n//sg550\r\n#define SG550_MAX_SPEED\t\t\t210\r\n#define SG550_MAX_SPEED_ZOOM\t\t150\r\n#define SG550_DAMAGE\t\t\t70\r\n#define SG550_RANGE_MODIFER\t\t0.98\r\n#define SG550_RELOAD_TIME\t\t3.35\r\n\r\nenum sg550_e\r\n{\r\n\tSG550_IDLE,\r\n\tSG550_SHOOT,\r\n\tSG550_SHOOT2,\r\n\tSG550_RELOAD,\r\n\tSG550_DRAW\r\n};\r\n\r\n\r\n\r\n//sg552\r\n#define SG552_MAX_SPEED\t\t\t235\r\n#define SG552_MAX_SPEED_ZOOM\t\t200\r\n#define SG552_DAMAGE\t\t\t33\r\n#define SG552_RANGE_MODIFER\t\t0.955\r\n#define SG552_RELOAD_TIME\t\t3\r\n\r\nenum sg552_e\r\n{\r\n\tSG552_IDLE1,\r\n\tSG552_RELOAD,\r\n\tSG552_DRAW,\r\n\tSG552_SHOOT1,\r\n\tSG552_SHOOT2,\r\n\tSG552_SHOOT3\r\n};\r\n\r\n\r\n\r\n//smokegrenade\r\n#define SMOKEGRENADE_MAX_SPEED\t\t250\r\n#define SMOKEGRENADE_MAX_SPEED_SHIELD\t180\r\n\r\nenum smokegrenade_e\r\n{\r\n\tSMOKEGRENADE_IDLE,\r\n\tSMOKEGRENADE_PINPULL,\r\n\tSMOKEGRENADE_THROW,\r\n\tSMOKEGRENADE_DRAW\r\n};\r\n\r\n\r\n\r\n//tmp\r\n#define TMP_MAX_SPEED\t\t\t250\r\n#define TMP_DAMAGE\t\t\t20\r\n#define TMP_RANGE_MODIFER\t\t0.85\r\n#define TMP_RELOAD_TIME\t\t\t2.12\r\n\r\nenum tmp_e\r\n{\r\n\tTMP_IDLE1,\r\n\tTMP_RELOAD,\r\n\tTMP_DRAW,\r\n\tTMP_SHOOT1,\r\n\tTMP_SHOOT2,\r\n\tTMP_SHOOT3\r\n};\r\n\r\n\r\n\r\n//ump45\r\n#define UMP45_MAX_SPEED\t\t\t250\r\n#define UMP45_DAMAGE\t\t\t30\r\n#define UMP45_RANGE_MODIFER\t\t0.82\r\n#define UMP45_RELOAD_TIME\t\t3.5\r\n\r\nenum ump45_e\r\n{\r\n\tUMP45_IDLE1,\r\n\tUMP45_RELOAD,\r\n\tUMP45_DRAW,\r\n\tUMP45_SHOOT1,\r\n\tUMP45_SHOOT2,\r\n\tUMP45_SHOOT3\r\n};\r\n\r\n\r\n\r\n//tmp\r\n#define USP_MAX_SPEED\t\t250\r\n#define USP_DAMAGE\t\t34\r\n#define USP_DAMAGE_SIL\t\t30\r\n#define USP_RANGE_MODIFER\t0.79\r\n#define USP_RELOAD_TIME\t\t2.7\r\n\r\nenum usp_e\r\n{\r\n\tUSP_IDLE,\r\n\tUSP_SHOOT1,\r\n\tUSP_SHOOT2,\r\n\tUSP_SHOOT3,\r\n\tUSP_SHOOT_EMPTY,\r\n\tUSP_RELOAD,\r\n\tUSP_DRAW,\r\n\tUSP_ATTACH_SILENCER,\r\n\tUSP_UNSIL_IDLE,\r\n\tUSP_UNSIL_SHOOT1,\r\n\tUSP_UNSIL_SHOOT2,\r\n\tUSP_UNSIL_SHOOT3,\r\n\tUSP_UNSIL_SHOOT_EMPTY,\r\n\tUSP_UNSIL_RELOAD,\r\n\tUSP_UNSIL_DRAW,\r\n\tUSP_DETACH_SILENCER\r\n};\r\n\r\nenum usp_shield_e\r\n{\r\n\tUSP_SHIELD_IDLE,\r\n\tUSP_SHIELD_SHOOT1,\r\n\tUSP_SHIELD_SHOOT2,\r\n\tUSP_SHIELD_SHOOT_EMPTY,\r\n\tUSP_SHIELD_RELOAD,\r\n\tUSP_SHIELD_DRAW,\r\n\tUSP_SHIELD_UP_IDLE,\r\n\tUSP_SHIELD_UP,\r\n\tUSP_SHIELD_DOWN\r\n};\r\n\r\n\r\n\r\n//xm1014\r\n#define XM1014_MAX_SPEED\t240\r\n#define XM1014_CONE_VECTOR\tVector(0.0725, 0.0725, 0.0)\t// special shotgun spreads\r\n\r\nenum xm1014_e\r\n{\r\n\tXM1014_IDLE,\r\n\tXM1014_FIRE1,\r\n\tXM1014_FIRE2,\r\n\tXM1014_RELOAD,\r\n\tXM1014_PUMP,\r\n\tXM1014_START_RELOAD,\r\n\tXM1014_DRAW\r\n};\r\n"
  },
  {
    "path": "engine/APIProxy.h",
    "content": "#ifndef __APIPROXY__\n#define __APIPROXY__\n\n#include \"archtypes.h\"     // DAL\n#include \"netadr.h\"\n#include \"Sequence.h\"\n\n#ifndef _WIN32\n#include \"enums.h\"\n#endif\n\n#define\tMAX_ALIAS_NAME\t32\n\ntypedef struct cmdalias_s\n{\n\tstruct cmdalias_s\t*next;\n\tchar\tname[MAX_ALIAS_NAME];\n\tchar\t*value;\n} cmdalias_t;\n\n\n// ********************************************************\n// Functions exported by the client .dll\n// ********************************************************\n\n// Function type declarations for client exports\ntypedef int (*INITIALIZE_FUNC)\t( struct cl_enginefuncs_s*, int );\ntypedef void (*HUD_INIT_FUNC)\t\t( void );\ntypedef int (*HUD_VIDINIT_FUNC)\t( void );\ntypedef int (*HUD_REDRAW_FUNC)\t( float, int );\ntypedef int (*HUD_UPDATECLIENTDATA_FUNC) ( struct client_data_s*, float );\ntypedef void (*HUD_RESET_FUNC)    ( void );\ntypedef void (*HUD_CLIENTMOVE_FUNC)( struct playermove_s *ppmove, qboolean server );\ntypedef void (*HUD_CLIENTMOVEINIT_FUNC)( struct playermove_s *ppmove );\ntypedef char (*HUD_TEXTURETYPE_FUNC)( char *name );\ntypedef void (*HUD_IN_ACTIVATEMOUSE_FUNC) ( void );\ntypedef void (*HUD_IN_DEACTIVATEMOUSE_FUNC)\t\t( void );\ntypedef void (*HUD_IN_MOUSEEVENT_FUNC)\t\t( int mstate );\ntypedef void (*HUD_IN_CLEARSTATES_FUNC)\t\t( void );\ntypedef void (*HUD_IN_ACCUMULATE_FUNC ) ( void );\ntypedef void (*HUD_CL_CREATEMOVE_FUNC)\t\t( float frametime, struct usercmd_s *cmd, int active );\ntypedef int (*HUD_CL_ISTHIRDPERSON_FUNC) ( void );\ntypedef void (*HUD_CL_GETCAMERAOFFSETS_FUNC )( float *ofs );\ntypedef struct kbutton_s * (*HUD_KB_FIND_FUNC) ( const char *name );\ntypedef void ( *HUD_CAMTHINK_FUNC )( void );\ntypedef void ( *HUD_CALCREF_FUNC ) ( struct ref_params_s *pparams );\ntypedef int\t ( *HUD_ADDENTITY_FUNC ) ( int type, struct cl_entity_s *ent, const char *modelname );\ntypedef void ( *HUD_CREATEENTITIES_FUNC ) ( void );\ntypedef void ( *HUD_DRAWNORMALTRIS_FUNC ) ( void );\ntypedef void ( *HUD_DRAWTRANSTRIS_FUNC ) ( void );\ntypedef void ( *HUD_STUDIOEVENT_FUNC ) ( const struct mstudioevent_s *event, struct cl_entity_s *entity );\ntypedef void ( *HUD_POSTRUNCMD_FUNC ) ( struct local_state_s *from, struct local_state_s *to, struct usercmd_s *cmd, int runfuncs, double time, unsigned int random_seed );\ntypedef void ( *HUD_SHUTDOWN_FUNC ) ( void );\ntypedef void ( *HUD_TXFERLOCALOVERRIDES_FUNC )( struct entity_state_s *state, const struct clientdata_s *client );\ntypedef void ( *HUD_PROCESSPLAYERSTATE_FUNC )( struct entity_state_s *dst, const struct entity_state_s *src );\ntypedef void ( *HUD_TXFERPREDICTIONDATA_FUNC ) ( struct entity_state_s *ps, const struct entity_state_s *pps, struct clientdata_s *pcd, const struct clientdata_s *ppcd, struct weapon_data_s *wd, const struct weapon_data_s *pwd );\ntypedef void ( *HUD_DEMOREAD_FUNC ) ( int size, unsigned char *buffer );\ntypedef int ( *HUD_CONNECTIONLESS_FUNC )( const struct netadr_s *net_from, const char *args, char *response_buffer, int *response_buffer_size );\ntypedef\tint\t( *HUD_GETHULLBOUNDS_FUNC ) ( int hullnumber, float *mins, float *maxs );\ntypedef void (*HUD_FRAME_FUNC)\t\t( double );\ntypedef int (*HUD_KEY_EVENT_FUNC ) ( int eventcode, int keynum, const char *pszCurrentBinding );\ntypedef void (*HUD_TEMPENTUPDATE_FUNC) ( double frametime, double client_time, double cl_gravity, struct tempent_s **ppTempEntFree, struct tempent_s **ppTempEntActive, \tint ( *Callback_AddVisibleEntity )( struct cl_entity_s *pEntity ),\tvoid ( *Callback_TempEntPlaySound )( struct tempent_s *pTemp, float damp ) );\ntypedef struct cl_entity_s *(*HUD_GETUSERENTITY_FUNC ) ( int index );\ntypedef void (*HUD_VOICESTATUS_FUNC)(int entindex, qboolean bTalking);\ntypedef void (*HUD_DIRECTORMESSAGE_FUNC)( int iSize, void *pbuf );\ntypedef int ( *HUD_STUDIO_INTERFACE_FUNC )( int version, struct r_studio_interface_s **ppinterface, struct engine_studio_api_s *pstudio );\ntypedef void (*HUD_CHATINPUTPOSITION_FUNC)( int *x, int *y );\ntypedef int (*HUD_GETPLAYERTEAM)(int iplayer);\ntypedef void *(*CLIENTFACTORY)(); // this should be CreateInterfaceFn but that means including interface.h\n\t\t\t\t\t\t\t\t\t// which is a C++ file and some of the client files a C only... \n\t\t\t\t\t\t\t\t\t// so we return a void * which we then do a typecast on later.\n\n\n// Pointers to the exported client functions themselves\ntypedef struct\n{\n\tINITIALIZE_FUNC\t\t\t\t\t\tpInitFunc;\n\tHUD_INIT_FUNC\t\t\t\t\t\tpHudInitFunc;\n\tHUD_VIDINIT_FUNC\t\t\t\t\tpHudVidInitFunc;\n\tHUD_REDRAW_FUNC\t\t\t\t\t\tpHudRedrawFunc;\n\tHUD_UPDATECLIENTDATA_FUNC\t\t\tpHudUpdateClientDataFunc;\n\tHUD_RESET_FUNC\t\t\t\t\t\tpHudResetFunc;\n\tHUD_CLIENTMOVE_FUNC\t\t\t\t\tpClientMove;\n\tHUD_CLIENTMOVEINIT_FUNC\t\t\t\tpClientMoveInit;\n\tHUD_TEXTURETYPE_FUNC\t\t\t\tpClientTextureType;\n\tHUD_IN_ACTIVATEMOUSE_FUNC\t\t\tpIN_ActivateMouse;\n\tHUD_IN_DEACTIVATEMOUSE_FUNC\t\t\tpIN_DeactivateMouse;\n\tHUD_IN_MOUSEEVENT_FUNC\t\t\t\tpIN_MouseEvent;\n\tHUD_IN_CLEARSTATES_FUNC\t\t\t\tpIN_ClearStates;\n\tHUD_IN_ACCUMULATE_FUNC\t\t\t\tpIN_Accumulate;\n\tHUD_CL_CREATEMOVE_FUNC\t\t\t\tpCL_CreateMove;\n\tHUD_CL_ISTHIRDPERSON_FUNC\t\t\tpCL_IsThirdPerson;\n\tHUD_CL_GETCAMERAOFFSETS_FUNC\t\tpCL_GetCameraOffsets;\n\tHUD_KB_FIND_FUNC\t\t\t\t\tpFindKey;\n\tHUD_CAMTHINK_FUNC\t\t\t\t\tpCamThink;\n\tHUD_CALCREF_FUNC\t\t\t\t\tpCalcRefdef;\n\tHUD_ADDENTITY_FUNC\t\t\t\t\tpAddEntity;\n\tHUD_CREATEENTITIES_FUNC\t\t\t\tpCreateEntities;\n\tHUD_DRAWNORMALTRIS_FUNC\t\t\t\tpDrawNormalTriangles;\n\tHUD_DRAWTRANSTRIS_FUNC\t\t\t\tpDrawTransparentTriangles;\n\tHUD_STUDIOEVENT_FUNC\t\t\t\tpStudioEvent;\n\tHUD_POSTRUNCMD_FUNC\t\t\t\t\tpPostRunCmd;\n\tHUD_SHUTDOWN_FUNC\t\t\t\t\tpShutdown;\n\tHUD_TXFERLOCALOVERRIDES_FUNC\t\tpTxferLocalOverrides;\n\tHUD_PROCESSPLAYERSTATE_FUNC\t\t\tpProcessPlayerState;\n\tHUD_TXFERPREDICTIONDATA_FUNC\t\tpTxferPredictionData;\n\tHUD_DEMOREAD_FUNC\t\t\t\t\tpReadDemoBuffer;\n\tHUD_CONNECTIONLESS_FUNC\t\t\t\tpConnectionlessPacket;\n\tHUD_GETHULLBOUNDS_FUNC\t\t\t\tpGetHullBounds;\n\tHUD_FRAME_FUNC\t\t\t\t\t\tpHudFrame;\n\tHUD_KEY_EVENT_FUNC\t\t\t\t\tpKeyEvent;\n\tHUD_TEMPENTUPDATE_FUNC\t\t\t\tpTempEntUpdate;\n\tHUD_GETUSERENTITY_FUNC\t\t\t\tpGetUserEntity;\n\tHUD_VOICESTATUS_FUNC\t\t\t\tpVoiceStatus;\t\t// Possibly null on old client dlls.\n\tHUD_DIRECTORMESSAGE_FUNC\t\t\tpDirectorMessage;\t// Possibly null on old client dlls.\n\tHUD_STUDIO_INTERFACE_FUNC\t\t\tpStudioInterface;\t// Not used by all clients\n\tHUD_CHATINPUTPOSITION_FUNC\t\t\tpChatInputPosition;\t// Not used by all clients\n\tHUD_GETPLAYERTEAM\t\t\t\t\tpGetPlayerTeam; // Not used by all clients\n\tCLIENTFACTORY\t\t\t\t\t\tpClientFactory;\n} cldll_func_t;\n\n// Function type declarations for client destination functions\ntypedef void (*DST_INITIALIZE_FUNC)\t( struct cl_enginefuncs_s**, int *);\ntypedef void (*DST_HUD_INIT_FUNC)\t\t( void );\ntypedef void (*DST_HUD_VIDINIT_FUNC)\t( void );\ntypedef void (*DST_HUD_REDRAW_FUNC)\t( float*, int* );\ntypedef void (*DST_HUD_UPDATECLIENTDATA_FUNC) ( struct client_data_s**, float* );\ntypedef void (*DST_HUD_RESET_FUNC)    ( void );\ntypedef void (*DST_HUD_CLIENTMOVE_FUNC)( struct playermove_s **, qboolean * );\ntypedef void (*DST_HUD_CLIENTMOVEINIT_FUNC)( struct playermove_s ** );\ntypedef void (*DST_HUD_TEXTURETYPE_FUNC)( char ** );\ntypedef void (*DST_HUD_IN_ACTIVATEMOUSE_FUNC) ( void );\ntypedef void (*DST_HUD_IN_DEACTIVATEMOUSE_FUNC)\t\t( void );\ntypedef void (*DST_HUD_IN_MOUSEEVENT_FUNC)\t\t( int * );\ntypedef void (*DST_HUD_IN_CLEARSTATES_FUNC)\t\t( void );\ntypedef void (*DST_HUD_IN_ACCUMULATE_FUNC ) ( void );\ntypedef void (*DST_HUD_CL_CREATEMOVE_FUNC)\t\t( float *, struct usercmd_s **, int * );\ntypedef void (*DST_HUD_CL_ISTHIRDPERSON_FUNC) ( void );\ntypedef void (*DST_HUD_CL_GETCAMERAOFFSETS_FUNC )( float ** );\ntypedef void (*DST_HUD_KB_FIND_FUNC) ( const char ** );\ntypedef void (*DST_HUD_CAMTHINK_FUNC )( void );\ntypedef void (*DST_HUD_CALCREF_FUNC ) ( struct ref_params_s ** );\ntypedef void (*DST_HUD_ADDENTITY_FUNC ) ( int *, struct cl_entity_s **, const char ** );\ntypedef void (*DST_HUD_CREATEENTITIES_FUNC ) ( void );\ntypedef void (*DST_HUD_DRAWNORMALTRIS_FUNC ) ( void );\ntypedef void (*DST_HUD_DRAWTRANSTRIS_FUNC ) ( void );\ntypedef void (*DST_HUD_STUDIOEVENT_FUNC ) ( const struct mstudioevent_s **, struct cl_entity_s ** );\ntypedef void (*DST_HUD_POSTRUNCMD_FUNC ) ( struct local_state_s **, struct local_state_s **, struct usercmd_s **, int *, double *, unsigned int * );\ntypedef void (*DST_HUD_SHUTDOWN_FUNC ) ( void );\ntypedef void (*DST_HUD_TXFERLOCALOVERRIDES_FUNC )( struct entity_state_s **, const struct clientdata_s ** );\ntypedef void (*DST_HUD_PROCESSPLAYERSTATE_FUNC )( struct entity_state_s **, const struct entity_state_s ** );\ntypedef void (*DST_HUD_TXFERPREDICTIONDATA_FUNC ) ( struct entity_state_s **, const struct entity_state_s **, struct clientdata_s **, const struct clientdata_s **, struct weapon_data_s **, const struct weapon_data_s ** );\ntypedef void (*DST_HUD_DEMOREAD_FUNC ) ( int *, unsigned char ** );\ntypedef void (*DST_HUD_CONNECTIONLESS_FUNC )( const struct netadr_s **, const char **, char **, int ** );\ntypedef void (*DST_HUD_GETHULLBOUNDS_FUNC ) ( int *, float **, float ** );\ntypedef void (*DST_HUD_FRAME_FUNC)\t\t( double * );\ntypedef void (*DST_HUD_KEY_EVENT_FUNC ) ( int *, int *, const char ** );\ntypedef void (*DST_HUD_TEMPENTUPDATE_FUNC) ( double *, double *, double *, struct tempent_s ***, struct tempent_s ***, int ( **Callback_AddVisibleEntity )( struct cl_entity_s *pEntity ),\tvoid ( **Callback_TempEntPlaySound )( struct tempent_s *pTemp, float damp ) );\ntypedef void (*DST_HUD_GETUSERENTITY_FUNC ) ( int * );\ntypedef void (*DST_HUD_VOICESTATUS_FUNC)(int *, qboolean *);\ntypedef void (*DST_HUD_DIRECTORMESSAGE_FUNC)( int *, void ** );\ntypedef void (*DST_HUD_STUDIO_INTERFACE_FUNC ) ( int *, struct r_studio_interface_s ***, struct engine_studio_api_s ** );\ntypedef void (*DST_HUD_CHATINPUTPOSITION_FUNC)( int **, int ** );\ntypedef void (*DST_HUD_GETPLAYERTEAM)(int);\n\n// Pointers to the client destination functions\ntypedef struct\n{\n\tDST_INITIALIZE_FUNC\t\t\t\t\t\tpInitFunc;\n\tDST_HUD_INIT_FUNC\t\t\t\t\t\tpHudInitFunc;\n\tDST_HUD_VIDINIT_FUNC\t\t\t\t\tpHudVidInitFunc;\n\tDST_HUD_REDRAW_FUNC\t\t\t\t\t\tpHudRedrawFunc;\n\tDST_HUD_UPDATECLIENTDATA_FUNC\t\t\tpHudUpdateClientDataFunc;\n\tDST_HUD_RESET_FUNC\t\t\t\t\t\tpHudResetFunc;\n\tDST_HUD_CLIENTMOVE_FUNC\t\t\t\t\tpClientMove;\n\tDST_HUD_CLIENTMOVEINIT_FUNC\t\t\t\tpClientMoveInit;\n\tDST_HUD_TEXTURETYPE_FUNC\t\t\t\tpClientTextureType;\n\tDST_HUD_IN_ACTIVATEMOUSE_FUNC\t\t\tpIN_ActivateMouse;\n\tDST_HUD_IN_DEACTIVATEMOUSE_FUNC\t\t\tpIN_DeactivateMouse;\n\tDST_HUD_IN_MOUSEEVENT_FUNC\t\t\t\tpIN_MouseEvent;\n\tDST_HUD_IN_CLEARSTATES_FUNC\t\t\t\tpIN_ClearStates;\n\tDST_HUD_IN_ACCUMULATE_FUNC\t\t\t\tpIN_Accumulate;\n\tDST_HUD_CL_CREATEMOVE_FUNC\t\t\t\tpCL_CreateMove;\n\tDST_HUD_CL_ISTHIRDPERSON_FUNC\t\t\tpCL_IsThirdPerson;\n\tDST_HUD_CL_GETCAMERAOFFSETS_FUNC\t\tpCL_GetCameraOffsets;\n\tDST_HUD_KB_FIND_FUNC\t\t\t\t\tpFindKey;\n\tDST_HUD_CAMTHINK_FUNC\t\t\t\t\tpCamThink;\n\tDST_HUD_CALCREF_FUNC\t\t\t\t\tpCalcRefdef;\n\tDST_HUD_ADDENTITY_FUNC\t\t\t\t\tpAddEntity;\n\tDST_HUD_CREATEENTITIES_FUNC\t\t\t\tpCreateEntities;\n\tDST_HUD_DRAWNORMALTRIS_FUNC\t\t\t\tpDrawNormalTriangles;\n\tDST_HUD_DRAWTRANSTRIS_FUNC\t\t\t\tpDrawTransparentTriangles;\n\tDST_HUD_STUDIOEVENT_FUNC\t\t\t\tpStudioEvent;\n\tDST_HUD_POSTRUNCMD_FUNC\t\t\t\t\tpPostRunCmd;\n\tDST_HUD_SHUTDOWN_FUNC\t\t\t\t\tpShutdown;\n\tDST_HUD_TXFERLOCALOVERRIDES_FUNC\t\tpTxferLocalOverrides;\n\tDST_HUD_PROCESSPLAYERSTATE_FUNC\t\t\tpProcessPlayerState;\n\tDST_HUD_TXFERPREDICTIONDATA_FUNC\t\tpTxferPredictionData;\n\tDST_HUD_DEMOREAD_FUNC\t\t\t\t\tpReadDemoBuffer;\n\tDST_HUD_CONNECTIONLESS_FUNC\t\t\t\tpConnectionlessPacket;\n\tDST_HUD_GETHULLBOUNDS_FUNC\t\t\t\tpGetHullBounds;\n\tDST_HUD_FRAME_FUNC\t\t\t\t\t\tpHudFrame;\n\tDST_HUD_KEY_EVENT_FUNC\t\t\t\t\tpKeyEvent;\n\tDST_HUD_TEMPENTUPDATE_FUNC\t\t\t\tpTempEntUpdate;\n\tDST_HUD_GETUSERENTITY_FUNC\t\t\t\tpGetUserEntity;\n\tDST_HUD_VOICESTATUS_FUNC\t\t\t\tpVoiceStatus;\t// Possibly null on old client dlls.\n\tDST_HUD_DIRECTORMESSAGE_FUNC\t\t\tpDirectorMessage;\t// Possibly null on old client dlls.\n\tDST_HUD_STUDIO_INTERFACE_FUNC\t\t\tpStudioInterface;  // Not used by all clients\n\tDST_HUD_CHATINPUTPOSITION_FUNC\t\t\tpChatInputPosition;  // Not used by all clients\n\tDST_HUD_GETPLAYERTEAM\t\t\t\t\tpGetPlayerTeam; // Not used by all clients\n} cldll_func_dst_t;\n\n\n\n\n// ********************************************************\n// Functions exported by the engine\n// ********************************************************\n\n// Function type declarations for engine exports\ntypedef HSPRITE\t\t\t\t\t\t(*pfnEngSrc_pfnSPR_Load_t )\t\t\t( const char *szPicName );\ntypedef int\t\t\t\t\t\t\t(*pfnEngSrc_pfnSPR_Frames_t )\t\t\t( HSPRITE hPic );\ntypedef int\t\t\t\t\t\t\t(*pfnEngSrc_pfnSPR_Height_t )\t\t\t( HSPRITE hPic, int frame );\ntypedef int\t\t\t\t\t\t\t(*pfnEngSrc_pfnSPR_Width_t )\t\t\t( HSPRITE hPic, int frame );\ntypedef void\t\t\t\t\t\t(*pfnEngSrc_pfnSPR_Set_t )\t\t\t\t( HSPRITE hPic, int r, int g, int b );\ntypedef void\t\t\t\t\t\t(*pfnEngSrc_pfnSPR_Draw_t )\t\t\t( int frame, int x, int y, const struct rect_s *prc );\ntypedef void\t\t\t\t\t\t(*pfnEngSrc_pfnSPR_DrawHoles_t )\t\t( int frame, int x, int y, const struct rect_s *prc );\ntypedef void\t\t\t\t\t\t(*pfnEngSrc_pfnSPR_DrawAdditive_t )\t( int frame, int x, int y, const struct rect_s *prc );\ntypedef void\t\t\t\t\t\t(*pfnEngSrc_pfnSPR_EnableScissor_t )\t( int x, int y, int width, int height );\ntypedef void\t\t\t\t\t\t(*pfnEngSrc_pfnSPR_DisableScissor_t )\t( void );\ntypedef struct client_sprite_s\t*\t(*pfnEngSrc_pfnSPR_GetList_t )\t\t\t( const char *psz, int *piCount );\ntypedef void\t\t\t\t\t\t(*pfnEngSrc_pfnFillRGBA_t )\t\t\t( int x, int y, int width, int height, int r, int g, int b, int a );\ntypedef int\t\t\t\t\t\t\t(*pfnEngSrc_pfnGetScreenInfo_t ) \t\t( struct SCREENINFO_s *pscrinfo );\ntypedef void\t\t\t\t\t\t(*pfnEngSrc_pfnSetCrosshair_t )\t\t( HSPRITE hspr, wrect_t rc, int r, int g, int b );\ntypedef struct cvar_s *\t\t\t\t(*pfnEngSrc_pfnRegisterVariable_t )\t( const char *szName, const char *szValue, int flags );\ntypedef float\t\t\t\t\t\t(*pfnEngSrc_pfnGetCvarFloat_t )\t\t( const char *szName );\ntypedef char*\t\t\t\t\t\t(*pfnEngSrc_pfnGetCvarString_t )\t\t( const char *szName );\ntypedef int\t\t\t\t\t\t\t(*pfnEngSrc_pfnAddCommand_t )\t\t\t( const char *cmd_name, void (*pfnEngSrc_function)(void) );\ntypedef int\t\t\t\t\t\t\t(*pfnEngSrc_pfnHookUserMsg_t )\t\t\t( const char *szMsgName, pfnUserMsgHook pfn );\ntypedef int\t\t\t\t\t\t\t(*pfnEngSrc_pfnServerCmd_t )\t\t\t( const char *szCmdString );\ntypedef int\t\t\t\t\t\t\t(*pfnEngSrc_pfnClientCmd_t )\t\t\t( const char *szCmdString );\ntypedef void\t\t\t\t\t\t(*pfnEngSrc_pfnPrimeMusicStream_t )\t( char *szFilename, int looping );\ntypedef void\t\t\t\t\t\t(*pfnEngSrc_pfnGetPlayerInfo_t )\t\t( int ent_num, struct hud_player_info_s *pinfo );\ntypedef void\t\t\t\t\t\t(*pfnEngSrc_pfnPlaySoundByName_t )\t\t( const char *szSound, float volume );\ntypedef void\t\t\t\t\t\t(*pfnEngSrc_pfnPlaySoundByNameAtPitch_t )\t( const char *szSound, float volume, int pitch );\ntypedef void\t\t\t\t\t\t(*pfnEngSrc_pfnPlaySoundVoiceByName_t )\t\t( const char *szSound, float volume, int pitch );\ntypedef void\t\t\t\t\t\t(*pfnEngSrc_pfnPlaySoundByIndex_t )\t( int iSound, float volume );\ntypedef void\t\t\t\t\t\t(*pfnEngSrc_pfnAngleVectors_t )\t\t( const float * vecAngles, float * forward, float * right, float * up );\ntypedef struct client_textmessage_s*(*pfnEngSrc_pfnTextMessageGet_t )\t\t( const char *pName );\ntypedef int\t\t\t\t\t\t\t(*pfnEngSrc_pfnDrawCharacter_t )\t\t( int x, int y, int number, int r, int g, int b );\ntypedef int\t\t\t\t\t\t\t(*pfnEngSrc_pfnDrawConsoleString_t )\t( int x, int y, char *string );\ntypedef void\t\t\t\t\t\t(*pfnEngSrc_pfnDrawSetTextColor_t )\t( float r, float g, float b );\ntypedef void\t\t\t\t\t\t(*pfnEngSrc_pfnDrawConsoleStringLen_t )(  const char *string, int *length, int *height );\ntypedef void\t\t\t\t\t\t(*pfnEngSrc_pfnConsolePrint_t )\t\t( const char *string );\ntypedef void\t\t\t\t\t\t(*pfnEngSrc_pfnCenterPrint_t )\t\t\t( const char *string );\ntypedef int\t\t\t\t\t\t\t(*pfnEngSrc_GetWindowCenterX_t )\t\t( void );\ntypedef int\t\t\t\t\t\t\t(*pfnEngSrc_GetWindowCenterY_t )\t\t( void );\ntypedef void\t\t\t\t\t\t(*pfnEngSrc_GetViewAngles_t )\t\t\t( float * );\ntypedef void\t\t\t\t\t\t(*pfnEngSrc_SetViewAngles_t )\t\t\t( float * );\ntypedef int\t\t\t\t\t\t\t(*pfnEngSrc_GetMaxClients_t )\t\t\t( void );\ntypedef void\t\t\t\t\t\t(*pfnEngSrc_Cvar_SetValue_t )\t\t\t( const char *cvar, float value );\ntypedef int       \t\t\t\t\t(*pfnEngSrc_Cmd_Argc_t)\t\t\t\t\t(void);\t\ntypedef char *\t\t\t\t\t\t(*pfnEngSrc_Cmd_Argv_t )\t\t\t\t( int arg );\ntypedef void\t\t\t\t\t\t(*pfnEngSrc_Con_Printf_t )\t\t\t\t( const char *fmt, ... );\ntypedef void\t\t\t\t\t\t(*pfnEngSrc_Con_DPrintf_t )\t\t\t( const char *fmt, ... );\ntypedef void\t\t\t\t\t\t(*pfnEngSrc_Con_NPrintf_t )\t\t\t( int pos, const char *fmt, ... );\ntypedef void\t\t\t\t\t\t(*pfnEngSrc_Con_NXPrintf_t )\t\t\t( struct con_nprint_s *info, const char *fmt, ... );\ntypedef const char *\t\t\t\t(*pfnEngSrc_PhysInfo_ValueForKey_t )\t( const char *key );\ntypedef const char *\t\t\t\t(*pfnEngSrc_ServerInfo_ValueForKey_t )( const char *key );\ntypedef float\t\t\t\t\t\t(*pfnEngSrc_GetClientMaxspeed_t )\t\t( void );\ntypedef int\t\t\t\t\t\t\t(*pfnEngSrc_CheckParm_t )\t\t\t\t( const char *parm, char **ppnext );\ntypedef void\t\t\t\t\t\t(*pfnEngSrc_Key_Event_t )\t\t\t\t( int key, int down );\ntypedef void\t\t\t\t\t\t(*pfnEngSrc_GetMousePosition_t )\t\t( int *mx, int *my );\ntypedef int\t\t\t\t\t\t\t(*pfnEngSrc_IsNoClipping_t )\t\t\t( void );\ntypedef struct cl_entity_s *\t\t(*pfnEngSrc_GetLocalPlayer_t )\t\t( void );\ntypedef struct cl_entity_s *\t\t(*pfnEngSrc_GetViewModel_t )\t\t\t( void );\ntypedef struct cl_entity_s *\t\t(*pfnEngSrc_GetEntityByIndex_t )\t\t( int idx );\ntypedef float\t\t\t\t\t\t(*pfnEngSrc_GetClientTime_t )\t\t\t( void );\ntypedef void\t\t\t\t\t\t(*pfnEngSrc_V_CalcShake_t )\t\t\t( void );\ntypedef void\t\t\t\t\t\t(*pfnEngSrc_V_ApplyShake_t )\t\t\t( float *origin, float *angles, float factor );\ntypedef int\t\t\t\t\t\t\t(*pfnEngSrc_PM_PointContents_t )\t\t( float *point, int *truecontents );\ntypedef int\t\t\t\t\t\t\t(*pfnEngSrc_PM_WaterEntity_t )\t\t\t( float *p );\ntypedef struct pmtrace_s *\t\t\t(*pfnEngSrc_PM_TraceLine_t )\t\t\t( float *start, float *end, int flags, int usehull, int ignore_pe );\ntypedef struct model_s *\t\t\t(*pfnEngSrc_CL_LoadModel_t )\t\t\t( const char *modelname, int *index );\ntypedef int\t\t\t\t\t\t\t(*pfnEngSrc_CL_CreateVisibleEntity_t )\t( int type, struct cl_entity_s *ent );\ntypedef const struct model_s *\t\t(*pfnEngSrc_GetSpritePointer_t )\t\t( HSPRITE hSprite );\ntypedef void\t\t\t\t\t\t(*pfnEngSrc_pfnPlaySoundByNameAtLocation_t )\t( char *szSound, float volume, float *origin );\ntypedef unsigned short\t\t\t\t(*pfnEngSrc_pfnPrecacheEvent_t )\t\t( int type, const char* psz );\ntypedef void\t\t\t\t\t\t(*pfnEngSrc_pfnPlaybackEvent_t )\t\t( int flags, const struct edict_s *pInvoker, unsigned short eventindex, float delay, float *origin, float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2 );\ntypedef void\t\t\t\t\t\t(*pfnEngSrc_pfnWeaponAnim_t )\t\t\t( int iAnim, int body );\ntypedef float\t\t\t\t\t\t(*pfnEngSrc_pfnRandomFloat_t )\t\t\t( float flLow, float flHigh );\ntypedef int32\t\t\t\t\t\t(*pfnEngSrc_pfnRandomLong_t )\t\t\t( int32 lLow, int32 lHigh );\ntypedef void\t\t\t\t\t\t(*pfnEngSrc_pfnHookEvent_t )\t\t\t( const char *name, void ( *pfnEvent )( struct event_args_s *args ) );\ntypedef int\t\t\t\t\t\t\t(*pfnEngSrc_Con_IsVisible_t)\t\t\t();\ntypedef const char *\t\t\t\t(*pfnEngSrc_pfnGetGameDirectory_t )\t( void );\ntypedef struct cvar_s *\t\t\t\t(*pfnEngSrc_pfnGetCvarPointer_t )\t\t( const char *szName );\ntypedef const char *\t\t\t\t(*pfnEngSrc_Key_LookupBinding_t )\t\t( const char *pBinding );\ntypedef const char *\t\t\t\t(*pfnEngSrc_pfnGetLevelName_t )\t\t( void );\ntypedef void\t\t\t\t\t\t(*pfnEngSrc_pfnGetScreenFade_t )\t\t( struct screenfade_s *fade );\ntypedef void\t\t\t\t\t\t(*pfnEngSrc_pfnSetScreenFade_t )\t\t( struct screenfade_s *fade );\ntypedef void *\t\t\t\t\t\t(*pfnEngSrc_VGui_GetPanel_t )         ( );\ntypedef void                        (*pfnEngSrc_VGui_ViewportPaintBackground_t ) (int extents[4]);\ntypedef byte*\t\t\t\t\t\t(*pfnEngSrc_COM_LoadFile_t )\t\t\t\t( const char *path, int usehunk, int *pLength );\ntypedef char*\t\t\t\t\t\t(*pfnEngSrc_COM_ParseFile_t )\t\t\t( char *data, char *token );\ntypedef void\t\t\t\t\t\t(*pfnEngSrc_COM_FreeFile_t)\t\t\t\t( void *buffer );\ntypedef struct triangleapi_s *\t\tpTriAPI;\ntypedef struct efx_api_s *\t\t\tpEfxAPI;\ntypedef struct event_api_s *\t\tpEventAPI;\ntypedef struct demo_api_s *\t\t\tpDemoAPI;\ntypedef struct net_api_s *\t\t\tpNetAPI;\ntypedef struct IVoiceTweak_s *\t\tpVoiceTweak;\ntypedef int\t\t\t\t\t\t\t(*pfnEngSrc_IsSpectateOnly_t ) ( void );\ntypedef struct model_s *\t\t\t(*pfnEngSrc_LoadMapSprite_t )\t\t\t( const char *filename );\ntypedef void\t\t\t\t\t\t(*pfnEngSrc_COM_AddAppDirectoryToSearchPath_t ) ( const char *pszBaseDir, const char *appName );\ntypedef int\t\t\t\t\t\t\t(*pfnEngSrc_COM_ExpandFilename_t)\t\t\t\t ( const char *fileName, char *nameOutBuffer, int nameOutBufferSize );\ntypedef const char *\t\t\t\t(*pfnEngSrc_PlayerInfo_ValueForKey_t )( int playerNum, const char *key );\ntypedef void\t\t\t\t\t\t(*pfnEngSrc_PlayerInfo_SetValueForKey_t )( const char *key, const char *value );\ntypedef qboolean\t\t\t\t\t(*pfnEngSrc_GetPlayerUniqueID_t)(int iPlayer, char playerID[16]);\ntypedef int\t\t\t\t\t\t\t(*pfnEngSrc_GetTrackerIDForPlayer_t)(int playerSlot);\ntypedef int\t\t\t\t\t\t\t(*pfnEngSrc_GetPlayerForTrackerID_t)(int trackerID);\ntypedef int\t\t\t\t\t\t\t(*pfnEngSrc_pfnServerCmdUnreliable_t )( char *szCmdString );\ntypedef void\t\t\t\t\t\t(*pfnEngSrc_GetMousePos_t )(struct tagPOINT *ppt);\ntypedef void\t\t\t\t\t\t(*pfnEngSrc_SetMousePos_t )(int x, int y);\ntypedef void\t\t\t\t\t\t(*pfnEngSrc_SetMouseEnable_t)(qboolean fEnable);\ntypedef struct cvar_s *\t\t\t\t(*pfnEngSrc_GetFirstCVarPtr_t)();\ntypedef unsigned int\t\t\t\t(*pfnEngSrc_GetFirstCmdFunctionHandle_t)();\ntypedef unsigned int\t\t\t\t(*pfnEngSrc_GetNextCmdFunctionHandle_t)(unsigned int cmdhandle);\ntypedef const char *\t\t\t\t(*pfnEngSrc_GetCmdFunctionName_t)(unsigned int cmdhandle);\ntypedef float\t\t\t\t\t\t(*pfnEngSrc_GetClientOldTime_t)();\ntypedef float\t\t\t\t\t\t(*pfnEngSrc_GetServerGravityValue_t)();\ntypedef struct model_s\t*\t\t\t(*pfnEngSrc_GetModelByIndex_t)( int index );\ntypedef void\t\t\t\t\t\t(*pfnEngSrc_pfnSetFilterMode_t )( int mode );\ntypedef void\t\t\t\t\t\t(*pfnEngSrc_pfnSetFilterColor_t )( float r, float g, float b );\ntypedef void\t\t\t\t\t\t(*pfnEngSrc_pfnSetFilterBrightness_t )( float brightness );\ntypedef sequenceEntry_s*\t\t\t(*pfnEngSrc_pfnSequenceGet_t )( const char *fileName, const char* entryName );\ntypedef void\t\t\t\t\t\t(*pfnEngSrc_pfnSPR_DrawGeneric_t )( int frame, int x, int y, const struct rect_s *prc, int src, int dest, int w, int h );\ntypedef sentenceEntry_s*\t\t\t(*pfnEngSrc_pfnSequencePickSentence_t )( const char *sentenceName, int pickMethod, int* entryPicked );\n// draw a complete string\ntypedef int\t\t\t\t\t\t\t(*pfnEngSrc_pfnDrawString_t )\t\t( int x, int y, const char *str, int r, int g, int b );\ntypedef int\t\t\t\t\t\t\t(*pfnEngSrc_pfnDrawStringReverse_t )\t\t( int x, int y, const char *str, int r, int g, int b );\ntypedef const char *\t\t\t\t(*pfnEngSrc_LocalPlayerInfo_ValueForKey_t )( const char *key );\ntypedef int\t\t\t\t\t\t\t(*pfnEngSrc_pfnVGUI2DrawCharacter_t )\t\t( int x, int y, int ch, unsigned int font );\ntypedef int\t\t\t\t\t\t\t(*pfnEngSrc_pfnVGUI2DrawCharacterAdd_t )\t( int x, int y, int ch, int r, int g, int b, unsigned int font);\ntypedef unsigned int\t\t(*pfnEngSrc_COM_GetApproxWavePlayLength ) ( const char * filename);\ntypedef void *\t\t\t\t\t\t(*pfnEngSrc_pfnGetCareerUI_t)();\ntypedef void\t\t\t\t\t\t(*pfnEngSrc_Cvar_Set_t )\t\t\t( const char *cvar, const char *value );\ntypedef int\t\t\t\t\t\t\t(*pfnEngSrc_pfnIsPlayingCareerMatch_t)();\ntypedef double\t\t\t\t\t\t(*pfnEngSrc_GetAbsoluteTime_t) ( void );\ntypedef void\t\t\t\t\t\t(*pfnEngSrc_pfnProcessTutorMessageDecayBuffer_t)(int *buffer, int bufferLength);\ntypedef void\t\t\t\t\t\t(*pfnEngSrc_pfnConstructTutorMessageDecayBuffer_t)(int *buffer, int bufferLength);\ntypedef void\t\t\t\t\t\t(*pfnEngSrc_pfnResetTutorMessageDecayData_t)();\ntypedef void\t\t\t\t\t\t(*pfnEngSrc_pfnFillRGBABlend_t )\t\t\t( int x, int y, int width, int height, int r, int g, int b, int a );\ntypedef int\t\t\t\t\t\t(*pfnEngSrc_pfnGetAppID_t)\t\t\t( void );\ntypedef cmdalias_t*\t\t\t\t(*pfnEngSrc_pfnGetAliases_t)\t\t( void );\ntypedef void\t\t\t\t\t(*pfnEngSrc_pfnVguiWrap2_GetMouseDelta_t) ( int *x, int *y );\ntypedef int\t\t\t\t\t\t\t(*pfnEngSrc_pfnFilteredClientCmd_t) \t( char *szCmdString );\n\n// Pointers to the exported engine functions themselves\ntypedef struct cl_enginefuncs_s\n{\n\tpfnEngSrc_pfnSPR_Load_t\t\t\t\t\tpfnSPR_Load;\n\tpfnEngSrc_pfnSPR_Frames_t\t\t\t\tpfnSPR_Frames;\n\tpfnEngSrc_pfnSPR_Height_t\t\t\t\tpfnSPR_Height;\n\tpfnEngSrc_pfnSPR_Width_t\t\t\t\tpfnSPR_Width;\n\tpfnEngSrc_pfnSPR_Set_t\t\t\t\t\tpfnSPR_Set;\n\tpfnEngSrc_pfnSPR_Draw_t\t\t\t\t\tpfnSPR_Draw;\n\tpfnEngSrc_pfnSPR_DrawHoles_t\t\t\tpfnSPR_DrawHoles;\n\tpfnEngSrc_pfnSPR_DrawAdditive_t\t\t\tpfnSPR_DrawAdditive;\n\tpfnEngSrc_pfnSPR_EnableScissor_t\t\tpfnSPR_EnableScissor;\n\tpfnEngSrc_pfnSPR_DisableScissor_t\t\tpfnSPR_DisableScissor;\n\tpfnEngSrc_pfnSPR_GetList_t\t\t\t\tpfnSPR_GetList;\n\tpfnEngSrc_pfnFillRGBA_t\t\t\t\t\tpfnFillRGBA;\n\tpfnEngSrc_pfnGetScreenInfo_t\t\t\tpfnGetScreenInfo;\n\tpfnEngSrc_pfnSetCrosshair_t\t\t\t\tpfnSetCrosshair;\n\tpfnEngSrc_pfnRegisterVariable_t\t\t\tpfnRegisterVariable;\n\tpfnEngSrc_pfnGetCvarFloat_t\t\t\t\tpfnGetCvarFloat;\n\tpfnEngSrc_pfnGetCvarString_t\t\t\tpfnGetCvarString;\n\tpfnEngSrc_pfnAddCommand_t\t\t\t\tpfnAddCommand;\n\tpfnEngSrc_pfnHookUserMsg_t\t\t\t\tpfnHookUserMsg;\n\tpfnEngSrc_pfnServerCmd_t\t\t\t\tpfnServerCmd;\n\tpfnEngSrc_pfnClientCmd_t\t\t\t\tpfnClientCmd;\n\tpfnEngSrc_pfnGetPlayerInfo_t\t\t\tpfnGetPlayerInfo;\n\tpfnEngSrc_pfnPlaySoundByName_t\t\t\tpfnPlaySoundByName;\n\tpfnEngSrc_pfnPlaySoundByIndex_t\t\t\tpfnPlaySoundByIndex;\n\tpfnEngSrc_pfnAngleVectors_t\t\t\t\tpfnAngleVectors;\n\tpfnEngSrc_pfnTextMessageGet_t\t\t\tpfnTextMessageGet;\n\tpfnEngSrc_pfnDrawCharacter_t\t\t\tpfnDrawCharacter;\n\tpfnEngSrc_pfnDrawConsoleString_t\t\tpfnDrawConsoleString;\n\tpfnEngSrc_pfnDrawSetTextColor_t\t\t\tpfnDrawSetTextColor;\n\tpfnEngSrc_pfnDrawConsoleStringLen_t\t\tpfnDrawConsoleStringLen;\n\tpfnEngSrc_pfnConsolePrint_t\t\t\t\tpfnConsolePrint;\n\tpfnEngSrc_pfnCenterPrint_t\t\t\t\tpfnCenterPrint;\n\tpfnEngSrc_GetWindowCenterX_t\t\t\tGetWindowCenterX;\n\tpfnEngSrc_GetWindowCenterY_t\t\t\tGetWindowCenterY;\n\tpfnEngSrc_GetViewAngles_t\t\t\t\tGetViewAngles;\n\tpfnEngSrc_SetViewAngles_t\t\t\t\tSetViewAngles;\n\tpfnEngSrc_GetMaxClients_t\t\t\t\tGetMaxClients;\n\tpfnEngSrc_Cvar_SetValue_t\t\t\t\tCvar_SetValue;\n\tpfnEngSrc_Cmd_Argc_t\t\t\t\t\tCmd_Argc;\n\tpfnEngSrc_Cmd_Argv_t\t\t\t\t\tCmd_Argv;\n\tpfnEngSrc_Con_Printf_t\t\t\t\t\tCon_Printf;\n\tpfnEngSrc_Con_DPrintf_t\t\t\t\t\tCon_DPrintf;\n\tpfnEngSrc_Con_NPrintf_t\t\t\t\t\tCon_NPrintf;\n\tpfnEngSrc_Con_NXPrintf_t\t\t\t\tCon_NXPrintf;\n\tpfnEngSrc_PhysInfo_ValueForKey_t\t\tPhysInfo_ValueForKey;\n\tpfnEngSrc_ServerInfo_ValueForKey_t\t\tServerInfo_ValueForKey;\n\tpfnEngSrc_GetClientMaxspeed_t\t\t\tGetClientMaxspeed;\n\tpfnEngSrc_CheckParm_t\t\t\t\t\tCheckParm;\n\tpfnEngSrc_Key_Event_t\t\t\t\t\tKey_Event;\n\tpfnEngSrc_GetMousePosition_t\t\t\tGetMousePosition;\n\tpfnEngSrc_IsNoClipping_t\t\t\t\tIsNoClipping;\n\tpfnEngSrc_GetLocalPlayer_t\t\t\t\tGetLocalPlayer;\n\tpfnEngSrc_GetViewModel_t\t\t\t\tGetViewModel;\n\tpfnEngSrc_GetEntityByIndex_t\t\t\tGetEntityByIndex;\n\tpfnEngSrc_GetClientTime_t\t\t\t\tGetClientTime;\n\tpfnEngSrc_V_CalcShake_t\t\t\t\t\tV_CalcShake;\n\tpfnEngSrc_V_ApplyShake_t\t\t\t\tV_ApplyShake;\n\tpfnEngSrc_PM_PointContents_t\t\t\tPM_PointContents;\n\tpfnEngSrc_PM_WaterEntity_t\t\t\t\tPM_WaterEntity;\n\tpfnEngSrc_PM_TraceLine_t\t\t\t\tPM_TraceLine;\n\tpfnEngSrc_CL_LoadModel_t\t\t\t\tCL_LoadModel;\n\tpfnEngSrc_CL_CreateVisibleEntity_t\t\tCL_CreateVisibleEntity;\n\tpfnEngSrc_GetSpritePointer_t\t\t\tGetSpritePointer;\n\tpfnEngSrc_pfnPlaySoundByNameAtLocation_t\tpfnPlaySoundByNameAtLocation;\n\tpfnEngSrc_pfnPrecacheEvent_t\t\t\tpfnPrecacheEvent;\n\tpfnEngSrc_pfnPlaybackEvent_t\t\t\tpfnPlaybackEvent;\n\tpfnEngSrc_pfnWeaponAnim_t\t\t\t\tpfnWeaponAnim;\n\tpfnEngSrc_pfnRandomFloat_t\t\t\t\tpfnRandomFloat;\n\tpfnEngSrc_pfnRandomLong_t\t\t\t\tpfnRandomLong;\n\tpfnEngSrc_pfnHookEvent_t\t\t\t\tpfnHookEvent;\n\tpfnEngSrc_Con_IsVisible_t\t\t\t\tCon_IsVisible;\n\tpfnEngSrc_pfnGetGameDirectory_t\t\t\tpfnGetGameDirectory;\n\tpfnEngSrc_pfnGetCvarPointer_t\t\t\tpfnGetCvarPointer;\n\tpfnEngSrc_Key_LookupBinding_t\t\t\tKey_LookupBinding;\n\tpfnEngSrc_pfnGetLevelName_t\t\t\t\tpfnGetLevelName;\n\tpfnEngSrc_pfnGetScreenFade_t\t\t\tpfnGetScreenFade;\n\tpfnEngSrc_pfnSetScreenFade_t\t\t\tpfnSetScreenFade;\n\tpfnEngSrc_VGui_GetPanel_t\t\t\t\tVGui_GetPanel;\n\tpfnEngSrc_VGui_ViewportPaintBackground_t\tVGui_ViewportPaintBackground;\n\tpfnEngSrc_COM_LoadFile_t\t\t\t\tCOM_LoadFile;\n\tpfnEngSrc_COM_ParseFile_t\t\t\t\tCOM_ParseFile;\n\tpfnEngSrc_COM_FreeFile_t\t\t\t\tCOM_FreeFile;\n\tstruct triangleapi_s\t\t*pTriAPI;\n\tstruct efx_api_s\t\t\t*pEfxAPI;\n\tstruct event_api_s\t\t\t*pEventAPI;\n\tstruct demo_api_s\t\t\t*pDemoAPI;\n\tstruct net_api_s\t\t\t*pNetAPI;\n\tstruct IVoiceTweak_s\t\t*pVoiceTweak;\n\tpfnEngSrc_IsSpectateOnly_t\t\t\t\tIsSpectateOnly;\n\tpfnEngSrc_LoadMapSprite_t\t\t\t\tLoadMapSprite;\n\tpfnEngSrc_COM_AddAppDirectoryToSearchPath_t\t\tCOM_AddAppDirectoryToSearchPath;\n\tpfnEngSrc_COM_ExpandFilename_t\t\t\tCOM_ExpandFilename;\n\tpfnEngSrc_PlayerInfo_ValueForKey_t\t\tPlayerInfo_ValueForKey;\n\tpfnEngSrc_PlayerInfo_SetValueForKey_t\tPlayerInfo_SetValueForKey;\n\tpfnEngSrc_GetPlayerUniqueID_t\t\t\tGetPlayerUniqueID;\n\tpfnEngSrc_GetTrackerIDForPlayer_t\t\tGetTrackerIDForPlayer;\n\tpfnEngSrc_GetPlayerForTrackerID_t\t\tGetPlayerForTrackerID;\n\tpfnEngSrc_pfnServerCmdUnreliable_t\t\tpfnServerCmdUnreliable;\n\tpfnEngSrc_GetMousePos_t\t\t\t\t\tpfnGetMousePos;\n\tpfnEngSrc_SetMousePos_t\t\t\t\t\tpfnSetMousePos;\n\tpfnEngSrc_SetMouseEnable_t\t\t\t\tpfnSetMouseEnable;\n\tpfnEngSrc_GetFirstCVarPtr_t\t\t\t\tGetFirstCvarPtr;\n\tpfnEngSrc_GetFirstCmdFunctionHandle_t\tGetFirstCmdFunctionHandle;\n\tpfnEngSrc_GetNextCmdFunctionHandle_t\tGetNextCmdFunctionHandle;\n\tpfnEngSrc_GetCmdFunctionName_t\t\t\tGetCmdFunctionName;\n\tpfnEngSrc_GetClientOldTime_t\t\t\thudGetClientOldTime;\n\tpfnEngSrc_GetServerGravityValue_t\t\thudGetServerGravityValue;\n\tpfnEngSrc_GetModelByIndex_t\t\t\t\thudGetModelByIndex;\n\tpfnEngSrc_pfnSetFilterMode_t\t\t\tpfnSetFilterMode;\n\tpfnEngSrc_pfnSetFilterColor_t\t\t\tpfnSetFilterColor;\n\tpfnEngSrc_pfnSetFilterBrightness_t\t\tpfnSetFilterBrightness;\n\tpfnEngSrc_pfnSequenceGet_t\t\t\t\tpfnSequenceGet;\n\tpfnEngSrc_pfnSPR_DrawGeneric_t\t\t\tpfnSPR_DrawGeneric;\n\tpfnEngSrc_pfnSequencePickSentence_t\t\tpfnSequencePickSentence;\n\tpfnEngSrc_pfnDrawString_t\t\t\t\tpfnDrawString;\n\tpfnEngSrc_pfnDrawStringReverse_t\t\t\t\tpfnDrawStringReverse;\n\tpfnEngSrc_LocalPlayerInfo_ValueForKey_t\t\tLocalPlayerInfo_ValueForKey;\n\tpfnEngSrc_pfnVGUI2DrawCharacter_t\t\tpfnVGUI2DrawCharacter;\n\tpfnEngSrc_pfnVGUI2DrawCharacterAdd_t\tpfnVGUI2DrawCharacterAdd;\n\tpfnEngSrc_COM_GetApproxWavePlayLength\tCOM_GetApproxWavePlayLength;\n\tpfnEngSrc_pfnGetCareerUI_t\t\t\t\tpfnGetCareerUI;\n\tpfnEngSrc_Cvar_Set_t\t\t\t\t\tCvar_Set;\n\tpfnEngSrc_pfnIsPlayingCareerMatch_t\t\tpfnIsCareerMatch;\n\tpfnEngSrc_pfnPlaySoundVoiceByName_t\tpfnPlaySoundVoiceByName;\n\tpfnEngSrc_pfnPrimeMusicStream_t\t\tpfnPrimeMusicStream;\n\tpfnEngSrc_GetAbsoluteTime_t\t\t\t\tGetAbsoluteTime;\n\tpfnEngSrc_pfnProcessTutorMessageDecayBuffer_t\t\tpfnProcessTutorMessageDecayBuffer;\n\tpfnEngSrc_pfnConstructTutorMessageDecayBuffer_t\t\tpfnConstructTutorMessageDecayBuffer;\n\tpfnEngSrc_pfnResetTutorMessageDecayData_t\t\tpfnResetTutorMessageDecayData;\n\tpfnEngSrc_pfnPlaySoundByNameAtPitch_t\tpfnPlaySoundByNameAtPitch;\n\tpfnEngSrc_pfnFillRGBABlend_t\t\t\t\t\tpfnFillRGBABlend;\n\tpfnEngSrc_pfnGetAppID_t\t\t\t\t\tpfnGetAppID;\n\tpfnEngSrc_pfnGetAliases_t\t\t\t\tpfnGetAliasList;\n\tpfnEngSrc_pfnVguiWrap2_GetMouseDelta_t pfnVguiWrap2_GetMouseDelta;\n\tpfnEngSrc_pfnFilteredClientCmd_t\t\tpfnFilteredClientCmd;\n} cl_enginefunc_t;\n\n// Function type declarations for engine destination functions\ntypedef void\t(*pfnEngDst_pfnSPR_Load_t )\t\t\t\t( const char ** );\ntypedef void\t(*pfnEngDst_pfnSPR_Frames_t )\t\t\t( HSPRITE * );\ntypedef void\t(*pfnEngDst_pfnSPR_Height_t )\t\t\t( HSPRITE *, int * );\ntypedef void\t(*pfnEngDst_pfnSPR_Width_t )\t\t\t( HSPRITE *, int * );\ntypedef void\t(*pfnEngDst_pfnSPR_Set_t )\t\t\t\t( HSPRITE *, int *, int *, int * );\ntypedef void\t(*pfnEngDst_pfnSPR_Draw_t )\t\t\t\t( int *, int *, int *, const struct rect_s ** );\ntypedef void\t(*pfnEngDst_pfnSPR_DrawHoles_t )\t\t( int *, int *, int *, const struct rect_s ** );\ntypedef void\t(*pfnEngDst_pfnSPR_DrawAdditive_t )\t\t( int *, int *, int *, const struct rect_s ** );\ntypedef void\t(*pfnEngDst_pfnSPR_EnableScissor_t )\t( int *, int *, int *, int * );\ntypedef void\t(*pfnEngDst_pfnSPR_DisableScissor_t )\t( void );\ntypedef void\t(*pfnEngDst_pfnSPR_GetList_t )\t\t\t( char **, int ** );\ntypedef void\t(*pfnEngDst_pfnFillRGBA_t )\t\t\t\t( int *, int *, int *, int *, int *, int *, int *, int * );\ntypedef void\t(*pfnEngDst_pfnGetScreenInfo_t ) \t\t( struct SCREENINFO_s ** );\ntypedef void\t(*pfnEngDst_pfnSetCrosshair_t )\t\t\t( HSPRITE *, struct rect_s *, int *, int *, int * );\ntypedef void\t(*pfnEngDst_pfnRegisterVariable_t )\t\t( char **, char **, int * );\ntypedef void\t(*pfnEngDst_pfnGetCvarFloat_t )\t\t\t( char ** );\ntypedef void\t(*pfnEngDst_pfnGetCvarString_t )\t\t( char ** );\ntypedef void\t(*pfnEngDst_pfnAddCommand_t )\t\t\t( char **, void (**pfnEngDst_function)(void) );\ntypedef void\t(*pfnEngDst_pfnHookUserMsg_t )\t\t\t( char **, pfnUserMsgHook * );\ntypedef void\t(*pfnEngDst_pfnServerCmd_t )\t\t\t( char ** );\ntypedef void\t(*pfnEngDst_pfnClientCmd_t )\t\t\t( char ** );\ntypedef void\t(*pfnEngDst_pfnPrimeMusicStream_t )\t( char **, int *);\ntypedef void\t(*pfnEngDst_pfnGetPlayerInfo_t )\t\t( int *, struct hud_player_info_s ** );\ntypedef void\t(*pfnEngDst_pfnPlaySoundByName_t )\t\t( char **, float * );\ntypedef void\t(*pfnEngDst_pfnPlaySoundByNameAtPitch_t )\t( char **, float *, int * );\ntypedef void\t(*pfnEngDst_pfnPlaySoundVoiceByName_t )\t(char **, float * );\ntypedef void\t(*pfnEngDst_pfnPlaySoundByIndex_t )\t\t( int *, float * );\ntypedef void\t(*pfnEngDst_pfnAngleVectors_t )\t\t\t( const float * *, float * *, float * *, float * * );\ntypedef void\t(*pfnEngDst_pfnTextMessageGet_t )\t\t( const char ** );\ntypedef void\t(*pfnEngDst_pfnDrawCharacter_t )\t\t( int *, int *, int *, int *, int *, int * );\ntypedef void\t(*pfnEngDst_pfnDrawConsoleString_t )\t( int *, int *, char ** );\ntypedef void\t(*pfnEngDst_pfnDrawSetTextColor_t )\t\t( float *, float *, float * );\ntypedef void\t(*pfnEngDst_pfnDrawConsoleStringLen_t )\t(  const char **, int **, int ** );\ntypedef void\t(*pfnEngDst_pfnConsolePrint_t )\t\t\t( const char ** );\ntypedef void\t(*pfnEngDst_pfnCenterPrint_t )\t\t\t( const char ** );\ntypedef void\t(*pfnEngDst_GetWindowCenterX_t )\t\t( void );\ntypedef void\t(*pfnEngDst_GetWindowCenterY_t )\t\t( void );\ntypedef void\t(*pfnEngDst_GetViewAngles_t )\t\t\t( float ** );\ntypedef void\t(*pfnEngDst_SetViewAngles_t )\t\t\t( float ** );\ntypedef void\t(*pfnEngDst_GetMaxClients_t )\t\t\t( void );\ntypedef void\t(*pfnEngDst_Cvar_SetValue_t )\t\t\t( char **, float * );\ntypedef void    (*pfnEngDst_Cmd_Argc_t)\t\t\t\t\t(void);\t\ntypedef void\t(*pfnEngDst_Cmd_Argv_t )\t\t\t\t( int * );\ntypedef void\t(*pfnEngDst_Con_Printf_t )\t\t\t\t( char **);\ntypedef void\t(*pfnEngDst_Con_DPrintf_t )\t\t\t\t( char **);\ntypedef void\t(*pfnEngDst_Con_NPrintf_t )\t\t\t\t( int *, char ** );\ntypedef void\t(*pfnEngDst_Con_NXPrintf_t )\t\t\t( struct con_nprint_s **, char **);\ntypedef void\t(*pfnEngDst_PhysInfo_ValueForKey_t )\t( const char ** );\ntypedef void\t(*pfnEngDst_ServerInfo_ValueForKey_t )\t( const char ** );\ntypedef void\t(*pfnEngDst_GetClientMaxspeed_t )\t\t( void );\ntypedef void\t(*pfnEngDst_CheckParm_t )\t\t\t\t( char **, char *** );\ntypedef void\t(*pfnEngDst_Key_Event_t )\t\t\t\t( int *, int * );\ntypedef void\t(*pfnEngDst_GetMousePosition_t )\t\t( int **, int ** );\ntypedef void\t(*pfnEngDst_IsNoClipping_t )\t\t\t( void );\ntypedef void\t(*pfnEngDst_GetLocalPlayer_t )\t\t\t( void );\ntypedef void\t(*pfnEngDst_GetViewModel_t )\t\t\t( void );\ntypedef void\t(*pfnEngDst_GetEntityByIndex_t )\t\t( int * );\ntypedef void\t(*pfnEngDst_GetClientTime_t )\t\t\t( void );\ntypedef void\t(*pfnEngDst_V_CalcShake_t )\t\t\t\t( void );\ntypedef void\t(*pfnEngDst_V_ApplyShake_t )\t\t\t( float **, float **, float * );\ntypedef void\t(*pfnEngDst_PM_PointContents_t )\t\t( float **, int ** );\ntypedef void\t(*pfnEngDst_PM_WaterEntity_t )\t\t\t( float ** );\ntypedef void\t(*pfnEngDst_PM_TraceLine_t )\t\t\t( float **, float **, int *, int *, int * );\ntypedef void\t(*pfnEngDst_CL_LoadModel_t )\t\t\t( const char **, int ** );\ntypedef void\t(*pfnEngDst_CL_CreateVisibleEntity_t )\t( int *, struct cl_entity_s ** );\ntypedef void\t(*pfnEngDst_GetSpritePointer_t )\t\t( HSPRITE * );\ntypedef void\t(*pfnEngDst_pfnPlaySoundByNameAtLocation_t )\t( char **, float *, float ** );\ntypedef void\t(*pfnEngDst_pfnPrecacheEvent_t )\t\t( int *, const char* * );\ntypedef void\t(*pfnEngDst_pfnPlaybackEvent_t )\t\t( int *, const struct edict_s **, unsigned short *, float *, float **, float **, float *, float *, int *, int *, int *, int * );\ntypedef void\t(*pfnEngDst_pfnWeaponAnim_t )\t\t\t( int *, int * );\ntypedef void\t(*pfnEngDst_pfnRandomFloat_t )\t\t\t( float *, float * );\ntypedef void\t(*pfnEngDst_pfnRandomLong_t )\t\t\t( int32 *, int32 * );\ntypedef void\t(*pfnEngDst_pfnHookEvent_t )\t\t\t( char **, void ( **pfnEvent )( struct event_args_s *args ) );\ntypedef void\t(*pfnEngDst_Con_IsVisible_t)\t\t\t();\ntypedef void\t(*pfnEngDst_pfnGetGameDirectory_t )\t\t( void );\ntypedef void\t(*pfnEngDst_pfnGetCvarPointer_t )\t\t( const char ** );\ntypedef void\t(*pfnEngDst_Key_LookupBinding_t )\t\t( const char ** );\ntypedef void\t(*pfnEngDst_pfnGetLevelName_t )\t\t\t( void );\ntypedef void\t(*pfnEngDst_pfnGetScreenFade_t )\t\t( struct screenfade_s ** );\ntypedef void\t(*pfnEngDst_pfnSetScreenFade_t )\t\t( struct screenfade_s ** );\ntypedef void\t(*pfnEngDst_VGui_GetPanel_t )\t\t\t( );\ntypedef void\t(*pfnEngDst_VGui_ViewportPaintBackground_t ) (int **);\ntypedef void\t(*pfnEngDst_COM_LoadFile_t )\t\t\t( char **, int *, int ** );\ntypedef void\t(*pfnEngDst_COM_ParseFile_t )\t\t\t( char **, char ** );\ntypedef void\t(*pfnEngDst_COM_FreeFile_t)\t\t\t\t( void ** );\ntypedef void\t(*pfnEngDst_IsSpectateOnly_t )\t\t\t( void );\ntypedef void\t(*pfnEngDst_LoadMapSprite_t )\t\t\t( const char ** );\ntypedef void\t(*pfnEngDst_COM_AddAppDirectoryToSearchPath_t ) ( const char **, const char ** );\ntypedef void\t(*pfnEngDst_COM_ExpandFilename_t)\t\t( const char **, char **, int * );\ntypedef void\t(*pfnEngDst_PlayerInfo_ValueForKey_t )\t( int *, const char ** );\ntypedef void\t(*pfnEngDst_PlayerInfo_SetValueForKey_t )( const char **, const char ** );\ntypedef void\t(*pfnEngDst_GetPlayerUniqueID_t)\t\t(int *, char **);\ntypedef void\t(*pfnEngDst_GetTrackerIDForPlayer_t)\t(int *);\ntypedef void\t(*pfnEngDst_GetPlayerForTrackerID_t)\t(int *);\ntypedef void\t(*pfnEngDst_pfnServerCmdUnreliable_t )\t( char ** );\ntypedef void\t(*pfnEngDst_GetMousePos_t )\t\t\t\t(struct tagPOINT **);\ntypedef void\t(*pfnEngDst_SetMousePos_t )\t\t\t\t(int *, int *);\ntypedef void\t(*pfnEngDst_SetMouseEnable_t )\t\t\t(qboolean *);\ntypedef void\t(*pfnEngDst_pfnSetFilterMode_t)\t\t\t( int * );\ntypedef void\t(*pfnEngDst_pfnSetFilterColor_t)\t\t( float *, float *, float * );\ntypedef void\t(*pfnEngDst_pfnSetFilterBrightness_t)\t( float * );\ntypedef void\t(*pfnEngDst_pfnSequenceGet_t )\t\t\t( const char**, const char** );\ntypedef void\t(*pfnEngDst_pfnSPR_DrawGeneric_t )\t\t( int *, int *, int *, const struct rect_s **, int *, int *, int *, int * );\ntypedef void\t(*pfnEngDst_pfnSequencePickSentence_t )\t( const char**, int *, int ** );\ntypedef void\t(*pfnEngDst_pfnDrawString_t )\t\t\t( int *, int *, const char *, int *, int *, int * );\ntypedef void\t(*pfnEngDst_pfnDrawStringReverse_t )\t\t\t( int *, int *, const char *, int *, int *, int * );\ntypedef void\t(*pfnEngDst_LocalPlayerInfo_ValueForKey_t )( const char **);\ntypedef void\t(*pfnEngDst_pfnVGUI2DrawCharacter_t )\t\t( int *, int *, int *, unsigned int * );\ntypedef void\t(*pfnEngDst_pfnVGUI2DrawCharacterAdd_t )\t( int *, int *, int *, int *, int *, int *, unsigned int *);\ntypedef void\t(*pfnEngDst_pfnProcessTutorMessageDecayBuffer_t )(int **, int *);\ntypedef void\t(*pfnEngDst_pfnConstructTutorMessageDecayBuffer_t )(int **, int *);\ntypedef void\t(*pfnEngDst_pfnResetTutorMessageDecayData_t)();\ntypedef void\t(*pfnEngDst_pfnFillRGBABlend_t )\t\t\t\t( int *, int *, int *, int *, int *, int *, int *, int * );\ntypedef void\t(*pfnEngDst_pfnGetAppID_t )\t\t\t\t( void );\ntypedef void\t(*pfnEngDst_pfnGetAliases_t )\t\t\t\t( void );\ntypedef void\t(*pfnEngDst_pfnVguiWrap2_GetMouseDelta_t) ( int *x, int *y );\ntypedef void\t(*pfnEngDst_pfnFilteredClientCmd_t )\t( char ** );\n\n\n// Pointers to the engine destination functions\ntypedef struct\n{\n\tpfnEngDst_pfnSPR_Load_t\t\t\t\t\tpfnSPR_Load;\n\tpfnEngDst_pfnSPR_Frames_t\t\t\t\tpfnSPR_Frames;\n\tpfnEngDst_pfnSPR_Height_t\t\t\t\tpfnSPR_Height;\n\tpfnEngDst_pfnSPR_Width_t\t\t\t\tpfnSPR_Width;\n\tpfnEngDst_pfnSPR_Set_t\t\t\t\t\tpfnSPR_Set;\n\tpfnEngDst_pfnSPR_Draw_t\t\t\t\t\tpfnSPR_Draw;\n\tpfnEngDst_pfnSPR_DrawHoles_t\t\t\tpfnSPR_DrawHoles;\n\tpfnEngDst_pfnSPR_DrawAdditive_t\t\t\tpfnSPR_DrawAdditive;\n\tpfnEngDst_pfnSPR_EnableScissor_t\t\tpfnSPR_EnableScissor;\n\tpfnEngDst_pfnSPR_DisableScissor_t\t\tpfnSPR_DisableScissor;\n\tpfnEngDst_pfnSPR_GetList_t\t\t\t\tpfnSPR_GetList;\n\tpfnEngDst_pfnFillRGBA_t\t\t\t\t\tpfnFillRGBA;\n\tpfnEngDst_pfnGetScreenInfo_t\t\t\tpfnGetScreenInfo;\n\tpfnEngDst_pfnSetCrosshair_t\t\t\t\tpfnSetCrosshair;\n\tpfnEngDst_pfnRegisterVariable_t\t\t\tpfnRegisterVariable;\n\tpfnEngDst_pfnGetCvarFloat_t\t\t\t\tpfnGetCvarFloat;\n\tpfnEngDst_pfnGetCvarString_t\t\t\tpfnGetCvarString;\n\tpfnEngDst_pfnAddCommand_t\t\t\t\tpfnAddCommand;\n\tpfnEngDst_pfnHookUserMsg_t\t\t\t\tpfnHookUserMsg;\n\tpfnEngDst_pfnServerCmd_t\t\t\t\tpfnServerCmd;\n\tpfnEngDst_pfnClientCmd_t\t\t\t\tpfnClientCmd;\n\tpfnEngDst_pfnGetPlayerInfo_t\t\t\tpfnGetPlayerInfo;\n\tpfnEngDst_pfnPlaySoundByName_t\t\t\tpfnPlaySoundByName;\n\tpfnEngDst_pfnPlaySoundByIndex_t\t\t\tpfnPlaySoundByIndex;\n\tpfnEngDst_pfnAngleVectors_t\t\t\t\tpfnAngleVectors;\n\tpfnEngDst_pfnTextMessageGet_t\t\t\tpfnTextMessageGet;\n\tpfnEngDst_pfnDrawCharacter_t\t\t\tpfnDrawCharacter;\n\tpfnEngDst_pfnDrawConsoleString_t\t\tpfnDrawConsoleString;\n\tpfnEngDst_pfnDrawSetTextColor_t\t\t\tpfnDrawSetTextColor;\n\tpfnEngDst_pfnDrawConsoleStringLen_t\t\tpfnDrawConsoleStringLen;\n\tpfnEngDst_pfnConsolePrint_t\t\t\t\tpfnConsolePrint;\n\tpfnEngDst_pfnCenterPrint_t\t\t\t\tpfnCenterPrint;\n\tpfnEngDst_GetWindowCenterX_t\t\t\tGetWindowCenterX;\n\tpfnEngDst_GetWindowCenterY_t\t\t\tGetWindowCenterY;\n\tpfnEngDst_GetViewAngles_t\t\t\t\tGetViewAngles;\n\tpfnEngDst_SetViewAngles_t\t\t\t\tSetViewAngles;\n\tpfnEngDst_GetMaxClients_t\t\t\t\tGetMaxClients;\n\tpfnEngDst_Cvar_SetValue_t\t\t\t\tCvar_SetValue;\n\tpfnEngDst_Cmd_Argc_t\t\t\t\t\tCmd_Argc;\n\tpfnEngDst_Cmd_Argv_t\t\t\t\t\tCmd_Argv;\n\tpfnEngDst_Con_Printf_t\t\t\t\t\tCon_Printf;\n\tpfnEngDst_Con_DPrintf_t\t\t\t\t\tCon_DPrintf;\n\tpfnEngDst_Con_NPrintf_t\t\t\t\t\tCon_NPrintf;\n\tpfnEngDst_Con_NXPrintf_t\t\t\t\tCon_NXPrintf;\n\tpfnEngDst_PhysInfo_ValueForKey_t\t\tPhysInfo_ValueForKey;\n\tpfnEngDst_ServerInfo_ValueForKey_t\t\tServerInfo_ValueForKey;\n\tpfnEngDst_GetClientMaxspeed_t\t\t\tGetClientMaxspeed;\n\tpfnEngDst_CheckParm_t\t\t\t\t\tCheckParm;\n\tpfnEngDst_Key_Event_t\t\t\t\t\tKey_Event;\n\tpfnEngDst_GetMousePosition_t\t\t\tGetMousePosition;\n\tpfnEngDst_IsNoClipping_t\t\t\t\tIsNoClipping;\n\tpfnEngDst_GetLocalPlayer_t\t\t\t\tGetLocalPlayer;\n\tpfnEngDst_GetViewModel_t\t\t\t\tGetViewModel;\n\tpfnEngDst_GetEntityByIndex_t\t\t\tGetEntityByIndex;\n\tpfnEngDst_GetClientTime_t\t\t\t\tGetClientTime;\n\tpfnEngDst_V_CalcShake_t\t\t\t\t\tV_CalcShake;\n\tpfnEngDst_V_ApplyShake_t\t\t\t\tV_ApplyShake;\n\tpfnEngDst_PM_PointContents_t\t\t\tPM_PointContents;\n\tpfnEngDst_PM_WaterEntity_t\t\t\t\tPM_WaterEntity;\n\tpfnEngDst_PM_TraceLine_t\t\t\t\tPM_TraceLine;\n\tpfnEngDst_CL_LoadModel_t\t\t\t\tCL_LoadModel;\n\tpfnEngDst_CL_CreateVisibleEntity_t\t\tCL_CreateVisibleEntity;\n\tpfnEngDst_GetSpritePointer_t\t\t\tGetSpritePointer;\n\tpfnEngDst_pfnPlaySoundByNameAtLocation_t\tpfnPlaySoundByNameAtLocation;\n\tpfnEngDst_pfnPrecacheEvent_t\t\t\tpfnPrecacheEvent;\n\tpfnEngDst_pfnPlaybackEvent_t\t\t\tpfnPlaybackEvent;\n\tpfnEngDst_pfnWeaponAnim_t\t\t\t\tpfnWeaponAnim;\n\tpfnEngDst_pfnRandomFloat_t\t\t\t\tpfnRandomFloat;\n\tpfnEngDst_pfnRandomLong_t\t\t\t\tpfnRandomLong;\n\tpfnEngDst_pfnHookEvent_t\t\t\t\tpfnHookEvent;\n\tpfnEngDst_Con_IsVisible_t\t\t\t\tCon_IsVisible;\n\tpfnEngDst_pfnGetGameDirectory_t\t\t\tpfnGetGameDirectory;\n\tpfnEngDst_pfnGetCvarPointer_t\t\t\tpfnGetCvarPointer;\n\tpfnEngDst_Key_LookupBinding_t\t\t\tKey_LookupBinding;\n\tpfnEngDst_pfnGetLevelName_t\t\t\t\tpfnGetLevelName;\n\tpfnEngDst_pfnGetScreenFade_t\t\t\tpfnGetScreenFade;\n\tpfnEngDst_pfnSetScreenFade_t\t\t\tpfnSetScreenFade;\n\tpfnEngDst_VGui_GetPanel_t\t\t\t\tVGui_GetPanel;\n\tpfnEngDst_VGui_ViewportPaintBackground_t\tVGui_ViewportPaintBackground;\n\tpfnEngDst_COM_LoadFile_t\t\t\t\tCOM_LoadFile;\n\tpfnEngDst_COM_ParseFile_t\t\t\t\tCOM_ParseFile;\n\tpfnEngDst_COM_FreeFile_t\t\t\t\tCOM_FreeFile;\n\tstruct triangleapi_s\t\t*pTriAPI;\n\tstruct efx_api_s\t\t\t*pEfxAPI;\n\tstruct event_api_s\t\t\t*pEventAPI;\n\tstruct demo_api_s\t\t\t*pDemoAPI;\n\tstruct net_api_s\t\t\t*pNetAPI;\n\tstruct IVoiceTweak_s\t\t*pVoiceTweak;\n\tpfnEngDst_IsSpectateOnly_t\t\t\t\tIsSpectateOnly;\n\tpfnEngDst_LoadMapSprite_t\t\t\t\tLoadMapSprite;\n\tpfnEngDst_COM_AddAppDirectoryToSearchPath_t\t\tCOM_AddAppDirectoryToSearchPath;\n\tpfnEngDst_COM_ExpandFilename_t\t\t\tCOM_ExpandFilename;\n\tpfnEngDst_PlayerInfo_ValueForKey_t\t\tPlayerInfo_ValueForKey;\n\tpfnEngDst_PlayerInfo_SetValueForKey_t\tPlayerInfo_SetValueForKey;\n\tpfnEngDst_GetPlayerUniqueID_t\t\t\tGetPlayerUniqueID;\n\tpfnEngDst_GetTrackerIDForPlayer_t\t\tGetTrackerIDForPlayer;\n\tpfnEngDst_GetPlayerForTrackerID_t\t\tGetPlayerForTrackerID;\n\tpfnEngDst_pfnServerCmdUnreliable_t\t\tpfnServerCmdUnreliable;\n\tpfnEngDst_GetMousePos_t\t\t\t\t\tpfnGetMousePos;\n\tpfnEngDst_SetMousePos_t\t\t\t\t\tpfnSetMousePos;\n\tpfnEngDst_SetMouseEnable_t\t\t\t\tpfnSetMouseEnable;\n\tpfnEngDst_pfnSetFilterMode_t\t\t\tpfnSetFilterMode ;\n\tpfnEngDst_pfnSetFilterColor_t\t\t\tpfnSetFilterColor ;\n\tpfnEngDst_pfnSetFilterBrightness_t\t\tpfnSetFilterBrightness ;\n\tpfnEngDst_pfnSequenceGet_t\t\t\t\tpfnSequenceGet;\n\tpfnEngDst_pfnSPR_DrawGeneric_t\t\t\tpfnSPR_DrawGeneric;\n\tpfnEngDst_pfnSequencePickSentence_t\t\tpfnSequencePickSentence;\n\tpfnEngDst_pfnDrawString_t\t\t\t\tpfnDrawString;\n\tpfnEngDst_pfnDrawString_t\t\t\t\tpfnDrawStringReverse;\n\tpfnEngDst_LocalPlayerInfo_ValueForKey_t\tLocalPlayerInfo_ValueForKey;\n\tpfnEngDst_pfnVGUI2DrawCharacter_t\t\tpfnVGUI2DrawCharacter;\n\tpfnEngDst_pfnVGUI2DrawCharacterAdd_t\tpfnVGUI2DrawCharacterAdd;\n\tpfnEngDst_pfnPlaySoundVoiceByName_t\tpfnPlaySoundVoiceByName;\n\tpfnEngDst_pfnPrimeMusicStream_t\t\t\tpfnPrimeMusicStream;\n\tpfnEngDst_pfnProcessTutorMessageDecayBuffer_t\t\tpfnProcessTutorMessageDecayBuffer;\n\tpfnEngDst_pfnConstructTutorMessageDecayBuffer_t\t\tpfnConstructTutorMessageDecayBuffer;\n\tpfnEngDst_pfnResetTutorMessageDecayData_t\t\tpfnResetTutorMessageDecayData;\n\tpfnEngDst_pfnPlaySoundByNameAtPitch_t\tpfnPlaySoundByNameAtPitch;\n\tpfnEngDst_pfnFillRGBABlend_t\t\t\t\t\tpfnFillRGBABlend;\n\tpfnEngDst_pfnGetAppID_t\t\t\t\t\t\t\tpfnGetAppID;\n\tpfnEngDst_pfnGetAliases_t\t\t\t\tpfnGetAliasList;\n\tpfnEngDst_pfnVguiWrap2_GetMouseDelta_t\tpfnVguiWrap2_GetMouseDelta;\n\tpfnEngDst_pfnFilteredClientCmd_t\t\tpfnFilteredClientCmd;\n} cl_enginefunc_dst_t;\n\n\n// ********************************************************\n// Functions exposed by the engine to the module\n// ********************************************************\n\n// Functions for ModuleS\ntypedef void (*PFN_KICKPLAYER)(int nPlayerSlot, int nReason);\n\ntypedef struct modshelpers_s\n{\n\tPFN_KICKPLAYER m_pfnKickPlayer;\n\n\t// reserved for future expansion\n\tint m_nVoid1;\n\tint m_nVoid2;\n\tint m_nVoid3;\n\tint m_nVoid4;\n\tint m_nVoid5;\n\tint m_nVoid6;\n\tint m_nVoid7;\n\tint m_nVoid8;\n\tint m_nVoid9;\n} modshelpers_t;\n\n// Functions for moduleC\ntypedef struct modchelpers_s\n{\n\t// reserved for future expansion\n\tint m_nVoid0;\n\tint m_nVoid1;\n\tint m_nVoid2;\n\tint m_nVoid3;\n\tint m_nVoid4;\n\tint m_nVoid5;\n\tint m_nVoid6;\n\tint m_nVoid7;\n\tint m_nVoid8;\n\tint m_nVoid9;\n} modchelpers_t;\n\n\n// ********************************************************\n// Information about the engine\n// ********************************************************\ntypedef struct engdata_s\n{\n\tcl_enginefunc_t\t*pcl_enginefuncs;\t\t// functions exported by the engine\n\tcl_enginefunc_dst_t *pg_engdstAddrs;\t// destination handlers for engine exports\n\tcldll_func_t *pcl_funcs;\t\t\t\t// client exports\n\tcldll_func_dst_t *pg_cldstAddrs;\t\t// client export destination handlers\n\tstruct modfuncs_s *pg_modfuncs;\t\t\t// engine's pointer to module functions\n\tstruct cmd_function_s **pcmd_functions;\t// list of all registered commands\n\tvoid *pkeybindings;\t\t\t\t\t\t// all key bindings (not really a void *, but easier this way)\n\tvoid (*pfnConPrintf)(char *, ...);\t\t// dump to console\n\tstruct cvar_s **pcvar_vars;\t\t\t\t// pointer to head of cvar list\n\tstruct glwstate_t *pglwstate;\t\t\t// OpenGl information\n\tvoid *(*pfnSZ_GetSpace)(struct sizebuf_s *, int); // pointer to SZ_GetSpace\n\tstruct modfuncs_s *pmodfuncs;\t\t\t// &g_modfuncs\n\tvoid *pfnGetProcAddress;\t\t\t\t// &GetProcAddress\n\tvoid *pfnGetModuleHandle;\t\t\t\t// &GetModuleHandle\n\tstruct server_static_s *psvs;\t\t\t// &svs\n\tstruct client_static_s *pcls;\t\t\t// &cls\n\tvoid (*pfnSV_DropClient)(struct client_s *, qboolean, char *, ...);\t// pointer to SV_DropClient\n\tvoid (*pfnNetchan_Transmit)(struct netchan_s *, int, byte *);\t\t// pointer to Netchan_Transmit\n\tvoid (*pfnNET_SendPacket)(enum netsrc_s sock, int length, void *data, netadr_t to); // &NET_SendPacket\n\tstruct cvar_s *(*pfnCvarFindVar)(const char *pchName);\t\t\t\t// pointer to Cvar_FindVar\n\tint *phinstOpenGlEarly;\t\t\t\t\t// &g_hinstOpenGlEarly\n\n\t// Reserved for future expansion\n\tvoid *pVoid0;\t\t\t\t\t\t\t// reserved for future expan\n\tvoid *pVoid1;\t\t\t\t\t\t\t// reserved for future expan\n\tvoid *pVoid2;\t\t\t\t\t\t\t// reserved for future expan\n\tvoid *pVoid3;\t\t\t\t\t\t\t// reserved for future expan\n\tvoid *pVoid4;\t\t\t\t\t\t\t// reserved for future expan\n\tvoid *pVoid5;\t\t\t\t\t\t\t// reserved for future expan\n\tvoid *pVoid6;\t\t\t\t\t\t\t// reserved for future expan\n\tvoid *pVoid7;\t\t\t\t\t\t\t// reserved for future expan\n\tvoid *pVoid8;\t\t\t\t\t\t\t// reserved for future expan\n\tvoid *pVoid9;\t\t\t\t\t\t\t// reserved for future expan\n} engdata_t;\n\n\n// ********************************************************\n// Functions exposed by the security module\n// ********************************************************\ntypedef void (*PFN_LOADMOD)(char *pchModule);\ntypedef void (*PFN_CLOSEMOD)(void);\ntypedef int (*PFN_NCALL)(int ijump, int cnArg, ...);\n\ntypedef void (*PFN_GETCLDSTADDRS)(cldll_func_dst_t *pcldstAddrs);\ntypedef void (*PFN_GETENGDSTADDRS)(cl_enginefunc_dst_t *pengdstAddrs);\ntypedef void (*PFN_MODULELOADED)(void);\n\ntypedef void (*PFN_PROCESSOUTGOINGNET)(struct netchan_s *pchan, struct sizebuf_s *psizebuf);\ntypedef qboolean (*PFN_PROCESSINCOMINGNET)(struct netchan_s *pchan, struct sizebuf_s *psizebuf);\n\ntypedef void (*PFN_TEXTURELOAD)(char *pszName, int dxWidth, int dyHeight, char *pbData);\ntypedef void (*PFN_MODELLOAD)(struct model_s *pmodel, void *pvBuf);\n\ntypedef void (*PFN_FRAMEBEGIN)(void);\ntypedef void (*PFN_FRAMERENDER1)(void);\ntypedef void (*PFN_FRAMERENDER2)(void);\n\ntypedef void (*PFN_SETMODSHELPERS)(modshelpers_t *pmodshelpers);\ntypedef void (*PFN_SETMODCHELPERS)(modchelpers_t *pmodchelpers);\ntypedef void (*PFN_SETENGDATA)(engdata_t *pengdata);\n\ntypedef void (*PFN_CONNECTCLIENT)(int iPlayer);\ntypedef void (*PFN_RECORDIP)(unsigned int pnIP);\ntypedef void (*PFN_PLAYERSTATUS)(unsigned char *pbData, int cbData);\n\ntypedef void (*PFN_SETENGINEVERSION)(int nVersion);\n\n// typedef class CMachine *(*PFN_PCMACHINE)(void);\ntypedef int (*PFN_PCMACHINE)(void);\ntypedef void (*PFN_SETIP)(int ijump);\ntypedef void (*PFN_EXECUTE)(void);\n\ntypedef struct modfuncs_s\n{\n\t// Functions for the pcode interpreter\n\tPFN_LOADMOD m_pfnLoadMod;\n\tPFN_CLOSEMOD m_pfnCloseMod;\n\tPFN_NCALL m_pfnNCall;\n\n\t// API destination functions\n\tPFN_GETCLDSTADDRS m_pfnGetClDstAddrs;\n\tPFN_GETENGDSTADDRS m_pfnGetEngDstAddrs;\n\n\t// Miscellaneous functions\n\tPFN_MODULELOADED m_pfnModuleLoaded;     // Called right after the module is loaded\n\n\t// Functions for processing network traffic\n\tPFN_PROCESSOUTGOINGNET m_pfnProcessOutgoingNet;   // Every outgoing packet gets run through this\n\tPFN_PROCESSINCOMINGNET m_pfnProcessIncomingNet;   // Every incoming packet gets run through this\n\n\t// Resource functions\n\tPFN_TEXTURELOAD m_pfnTextureLoad;     // Called as each texture is loaded\n\tPFN_MODELLOAD m_pfnModelLoad;         // Called as each model is loaded\n\n\t// Functions called every frame\n\tPFN_FRAMEBEGIN m_pfnFrameBegin;       // Called at the beginning of each frame cycle\n\tPFN_FRAMERENDER1 m_pfnFrameRender1;   // Called at the beginning of the render loop\n\tPFN_FRAMERENDER2 m_pfnFrameRender2;   // Called at the end of the render loop\n\n\t// Module helper transfer\n\tPFN_SETMODSHELPERS m_pfnSetModSHelpers;\n\tPFN_SETMODCHELPERS m_pfnSetModCHelpers;\n\tPFN_SETENGDATA m_pfnSetEngData;\n\n\t// Which version of the module is this?\n\tint m_nVersion;\n\n\t// Miscellaneous game stuff\n\tPFN_CONNECTCLIENT m_pfnConnectClient;\t// Called whenever a new client connects\n\tPFN_RECORDIP m_pfnRecordIP;\t\t\t\t// Secure master has reported a new IP for us\n\tPFN_PLAYERSTATUS m_pfnPlayerStatus;\t\t// Called whenever we receive a PlayerStatus packet\n\n\t// Recent additions\n\tPFN_SETENGINEVERSION m_pfnSetEngineVersion;\t// 1 = patched engine\n\n\t// reserved for future expansion\n\tint m_nVoid2;\n\tint m_nVoid3;\n\tint m_nVoid4;\n\tint m_nVoid5;\n\tint m_nVoid6;\n\tint m_nVoid7;\n\tint m_nVoid8;\n\tint m_nVoid9;\n} modfuncs_t;\n\n\n#define k_nEngineVersion15Base\t\t0\n#define k_nEngineVersion15Patch\t\t1\n#define k_nEngineVersion16Base\t\t2\n#define k_nEngineVersion16Validated\t3\t\t// 1.6 engine with built-in validation\n\n\ntypedef struct validator_s\n{\n\tint m_nRandomizer;\t\t\t// Random number to be XOR'd into all subsequent fields\n\tint m_nSignature1;\t\t\t// First signature that identifies this structure\n\tint m_nSignature2;\t\t\t// Second signature\n\tint m_pbCode;\t\t\t\t// Beginning of the code block\n\tint m_cbCode;\t\t\t\t// Size of the code block\n\tint m_nChecksum;\t\t\t// Checksum of the code block\n\tint m_nSpecial;\t\t\t\t// For engine, 1 if hw.dll, 0 if sw.dll.  For client, pclfuncs checksum\n\tint m_nCompensator;\t\t\t// Keeps the checksum correct\n} validator_t;\n\n\n#define k_nChecksumCompensator 0x36a8f09c\t// Don't change this value: it's hardcorded in cdll_int.cpp, \n\n#define k_nModuleVersionCur 0x43210004\n\n\n#endif // __APIPROXY__\n"
  },
  {
    "path": "engine/Sequence.h",
    "content": "//---------------------------------------------------------------------------\n// \n//\t\tS c r i p t e d   S e q u e n c e s\n// \n//---------------------------------------------------------------------------\n#ifndef _INCLUDE_SEQUENCE_H_\n#define _INCLUDE_SEQUENCE_H_\n\n\n#ifndef _DEF_BYTE_\ntypedef unsigned char byte;\n#endif\n\n//---------------------------------------------------------------------------\n// client_textmessage_t\n//---------------------------------------------------------------------------\n\n#define CLIENT_TEXTMESAGE_S\ntypedef struct client_textmessage_s\n{\n\tint\t\teffect;\n\tbyte\tr1, g1, b1, a1;\t\t// 2 colors for effects\n\tbyte\tr2, g2, b2, a2;\n\tfloat\tx;\n\tfloat\ty;\n\tfloat\tfadein;\n\tfloat\tfadeout;\n\tfloat\tholdtime;\n\tfloat\tfxtime;\n\tconst char *pName;\n\tconst char *pMessage;\n} client_textmessage_t;\n\n//--------------------------------------------------------------------------\n// sequenceDefaultBits_e\n//\t\n// Enumerated list of possible modifiers for a command.  This enumeration\n// is used in a bitarray controlling what modifiers are specified for a command.\n//---------------------------------------------------------------------------\nenum sequenceModifierBits\n{\n\tSEQUENCE_MODIFIER_EFFECT_BIT\t\t= (1 << 1),\n\tSEQUENCE_MODIFIER_POSITION_BIT\t\t= (1 << 2),\n\tSEQUENCE_MODIFIER_COLOR_BIT\t\t\t= (1 << 3),\n\tSEQUENCE_MODIFIER_COLOR2_BIT\t\t= (1 << 4),\n\tSEQUENCE_MODIFIER_FADEIN_BIT\t\t= (1 << 5),\n\tSEQUENCE_MODIFIER_FADEOUT_BIT\t\t= (1 << 6),\n\tSEQUENCE_MODIFIER_HOLDTIME_BIT\t\t= (1 << 7),\n\tSEQUENCE_MODIFIER_FXTIME_BIT\t\t= (1 << 8),\n\tSEQUENCE_MODIFIER_SPEAKER_BIT\t\t= (1 << 9),\n\tSEQUENCE_MODIFIER_LISTENER_BIT\t\t= (1 << 10),\n\tSEQUENCE_MODIFIER_TEXTCHANNEL_BIT\t= (1 << 11),\n};\ntypedef enum sequenceModifierBits sequenceModifierBits_e ;\n\n\n//---------------------------------------------------------------------------\n// sequenceCommandEnum_e\n// \n// Enumerated sequence command types.\n//---------------------------------------------------------------------------\nenum sequenceCommandEnum_\n{\n\tSEQUENCE_COMMAND_ERROR = -1,\n\tSEQUENCE_COMMAND_PAUSE = 0,\n\tSEQUENCE_COMMAND_FIRETARGETS,\n\tSEQUENCE_COMMAND_KILLTARGETS,\n\tSEQUENCE_COMMAND_TEXT,\n\tSEQUENCE_COMMAND_SOUND,\n\tSEQUENCE_COMMAND_GOSUB,\n\tSEQUENCE_COMMAND_SENTENCE,\n\tSEQUENCE_COMMAND_REPEAT,\n\tSEQUENCE_COMMAND_SETDEFAULTS,\n\tSEQUENCE_COMMAND_MODIFIER,\n\tSEQUENCE_COMMAND_POSTMODIFIER,\n\tSEQUENCE_COMMAND_NOOP,\n\n\tSEQUENCE_MODIFIER_EFFECT,\n\tSEQUENCE_MODIFIER_POSITION,\n\tSEQUENCE_MODIFIER_COLOR,\n\tSEQUENCE_MODIFIER_COLOR2,\n\tSEQUENCE_MODIFIER_FADEIN,\n\tSEQUENCE_MODIFIER_FADEOUT,\n\tSEQUENCE_MODIFIER_HOLDTIME,\n\tSEQUENCE_MODIFIER_FXTIME,\n\tSEQUENCE_MODIFIER_SPEAKER,\n\tSEQUENCE_MODIFIER_LISTENER,\n\tSEQUENCE_MODIFIER_TEXTCHANNEL,\n};\ntypedef enum sequenceCommandEnum_ sequenceCommandEnum_e;\n\n\n//---------------------------------------------------------------------------\n// sequenceCommandType_e\n// \n// Typeerated sequence command types.\n//---------------------------------------------------------------------------\nenum sequenceCommandType_\n{\n\tSEQUENCE_TYPE_COMMAND,\n\tSEQUENCE_TYPE_MODIFIER,\n};\ntypedef enum sequenceCommandType_ sequenceCommandType_e;\n\n\n//---------------------------------------------------------------------------\n// sequenceCommandMapping_s\n// \n// A mapping of a command enumerated-value to its name.\n//---------------------------------------------------------------------------\ntypedef struct sequenceCommandMapping_ sequenceCommandMapping_s;\nstruct sequenceCommandMapping_\n{\n\tsequenceCommandEnum_e\tcommandEnum;\n\tconst char*\t\t\t\tcommandName;\n\tsequenceCommandType_e\tcommandType;\n};\n\n\n//---------------------------------------------------------------------------\n// sequenceCommandLine_s\n// \n// Structure representing a single command (usually 1 line) from a\n//\t.SEQ file entry.\n//---------------------------------------------------------------------------\ntypedef struct sequenceCommandLine_ sequenceCommandLine_s;\nstruct sequenceCommandLine_\n{\n\tint\t\t\t\t\t\tcommandType;\t\t// Specifies the type of command\n\tclient_textmessage_t\tclientMessage;\t\t// Text HUD message struct\n\tchar*\t\t\t\t\tspeakerName;\t\t// Targetname of speaking entity\n\tchar*\t\t\t\t\tlistenerName;\t\t// Targetname of entity being spoken to\n\tchar*\t\t\t\t\tsoundFileName;\t\t// Name of sound file to play\n\tchar*\t\t\t\t\tsentenceName;\t\t// Name of sentences.txt to play\n\tchar*\t\t\t\t\tfireTargetNames;\t// List of targetnames to fire\n\tchar*\t\t\t\t\tkillTargetNames;\t// List of targetnames to remove\n\tfloat\t\t\t\t\tdelay;\t\t\t\t// Seconds 'till next command\n\tint\t\t\t\t\t\trepeatCount;\t\t// If nonzero, reset execution pointer to top of block (N times, -1 = infinite)\n\tint\t\t\t\t\t\ttextChannel;\t\t// Display channel on which text message is sent\n\tint\t\t\t\t\t\tmodifierBitField;\t// Bit field to specify what clientmessage fields are valid\n\tsequenceCommandLine_s*\tnextCommandLine;\t// Next command (linked list)\n};\n\n\n//---------------------------------------------------------------------------\n// sequenceEntry_s\n// \n// Structure representing a single command (usually 1 line) from a\n//\t.SEQ file entry.\n//---------------------------------------------------------------------------\ntypedef struct sequenceEntry_ sequenceEntry_s;\nstruct sequenceEntry_\n{\n\tchar*\t\t\t\t\tfileName;\t\t// Name of sequence file without .SEQ extension\n\tchar*\t\t\t\t\tentryName;\t\t// Name of entry label in file\n\tsequenceCommandLine_s*\tfirstCommand;\t// Linked list of commands in entry\n\tsequenceEntry_s*\t\tnextEntry;\t\t// Next loaded entry\n\tqboolean\t\t\t\tisGlobal;\t\t// Is entry retained over level transitions?\n};\n\n\n\n//---------------------------------------------------------------------------\n// sentenceEntry_s\n// Structure representing a single sentence of a group from a .SEQ\n// file entry.  Sentences are identical to entries in sentences.txt, but\n// can be unique per level and are loaded/unloaded with the level.\n//---------------------------------------------------------------------------\ntypedef struct sentenceEntry_ sentenceEntry_s;\nstruct sentenceEntry_\n{\n\tchar*\t\t\t\t\tdata;\t\t\t// sentence data (ie \"We have hostiles\" )\n\tsentenceEntry_s*\t\tnextEntry;\t\t// Next loaded entry\n\tqboolean\t\t\t\tisGlobal;\t\t// Is entry retained over level transitions?\n\tunsigned int\t\t\tindex;\t\t\t// this entry's position in the file.\n};\n\n//--------------------------------------------------------------------------\n// sentenceGroupEntry_s\n// Structure representing a group of sentences found in a .SEQ file.\n// A sentence group is defined by all sentences with the same name, ignoring\n// the number at the end of the sentence name.  Groups enable a sentence\n// to be picked at random across a group.\n//--------------------------------------------------------------------------\ntypedef struct sentenceGroupEntry_ sentenceGroupEntry_s;\nstruct sentenceGroupEntry_\n{\n\tchar*\t\t\t\t\tgroupName;\t\t// name of the group (ie CT_ALERT )\n\tunsigned int\t\t\tnumSentences;\t// number of sentences in group\n\tsentenceEntry_s*\t\tfirstSentence;\t// head of linked list of sentences in group\n\tsentenceGroupEntry_s*\tnextEntry;\t\t// next loaded group\n};\n\n//---------------------------------------------------------------------------\n// Function declarations\n//---------------------------------------------------------------------------\nsequenceEntry_s* SequenceGet( const char* fileName, const char* entryName );\nvoid Sequence_ParseFile( const char* fileName, qboolean isGlobal );\nvoid Sequence_OnLevelLoad( const char* mapName );\nsentenceEntry_s* SequencePickSentence( const char *groupName, int pickMethod, int *picked );\n\n#endif /* _INCLUDE_SEQUENCE_H_ */\n"
  },
  {
    "path": "engine/anorms.h",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\t\n*\tThis product contains software technology licensed from Id \n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc. \n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n\n{-0.525731, 0.000000, 0.850651}, \n{-0.442863, 0.238856, 0.864188}, \n{-0.295242, 0.000000, 0.955423}, \n{-0.309017, 0.500000, 0.809017}, \n{-0.162460, 0.262866, 0.951056}, \n{0.000000, 0.000000, 1.000000}, \n{0.000000, 0.850651, 0.525731}, \n{-0.147621, 0.716567, 0.681718}, \n{0.147621, 0.716567, 0.681718}, \n{0.000000, 0.525731, 0.850651}, \n{0.309017, 0.500000, 0.809017}, \n{0.525731, 0.000000, 0.850651}, \n{0.295242, 0.000000, 0.955423}, \n{0.442863, 0.238856, 0.864188}, \n{0.162460, 0.262866, 0.951056}, \n{-0.681718, 0.147621, 0.716567}, \n{-0.809017, 0.309017, 0.500000}, \n{-0.587785, 0.425325, 0.688191}, \n{-0.850651, 0.525731, 0.000000}, \n{-0.864188, 0.442863, 0.238856}, \n{-0.716567, 0.681718, 0.147621}, \n{-0.688191, 0.587785, 0.425325}, \n{-0.500000, 0.809017, 0.309017}, \n{-0.238856, 0.864188, 0.442863}, \n{-0.425325, 0.688191, 0.587785}, \n{-0.716567, 0.681718, -0.147621}, \n{-0.500000, 0.809017, -0.309017}, \n{-0.525731, 0.850651, 0.000000}, \n{0.000000, 0.850651, -0.525731}, \n{-0.238856, 0.864188, -0.442863}, \n{0.000000, 0.955423, -0.295242}, \n{-0.262866, 0.951056, -0.162460}, \n{0.000000, 1.000000, 0.000000}, \n{0.000000, 0.955423, 0.295242}, \n{-0.262866, 0.951056, 0.162460}, \n{0.238856, 0.864188, 0.442863}, \n{0.262866, 0.951056, 0.162460}, \n{0.500000, 0.809017, 0.309017}, \n{0.238856, 0.864188, -0.442863}, \n{0.262866, 0.951056, -0.162460}, \n{0.500000, 0.809017, -0.309017}, \n{0.850651, 0.525731, 0.000000}, \n{0.716567, 0.681718, 0.147621}, \n{0.716567, 0.681718, -0.147621}, \n{0.525731, 0.850651, 0.000000}, \n{0.425325, 0.688191, 0.587785}, \n{0.864188, 0.442863, 0.238856}, \n{0.688191, 0.587785, 0.425325}, \n{0.809017, 0.309017, 0.500000}, \n{0.681718, 0.147621, 0.716567}, \n{0.587785, 0.425325, 0.688191}, \n{0.955423, 0.295242, 0.000000}, \n{1.000000, 0.000000, 0.000000}, \n{0.951056, 0.162460, 0.262866}, \n{0.850651, -0.525731, 0.000000}, \n{0.955423, -0.295242, 0.000000}, \n{0.864188, -0.442863, 0.238856}, \n{0.951056, -0.162460, 0.262866}, \n{0.809017, -0.309017, 0.500000}, \n{0.681718, -0.147621, 0.716567}, \n{0.850651, 0.000000, 0.525731}, \n{0.864188, 0.442863, -0.238856}, \n{0.809017, 0.309017, -0.500000}, \n{0.951056, 0.162460, -0.262866}, \n{0.525731, 0.000000, -0.850651}, \n{0.681718, 0.147621, -0.716567}, \n{0.681718, -0.147621, -0.716567}, \n{0.850651, 0.000000, -0.525731}, \n{0.809017, -0.309017, -0.500000}, \n{0.864188, -0.442863, -0.238856}, \n{0.951056, -0.162460, -0.262866}, \n{0.147621, 0.716567, -0.681718}, \n{0.309017, 0.500000, -0.809017}, \n{0.425325, 0.688191, -0.587785}, \n{0.442863, 0.238856, -0.864188}, \n{0.587785, 0.425325, -0.688191}, \n{0.688191, 0.587785, -0.425325}, \n{-0.147621, 0.716567, -0.681718}, \n{-0.309017, 0.500000, -0.809017}, \n{0.000000, 0.525731, -0.850651}, \n{-0.525731, 0.000000, -0.850651}, \n{-0.442863, 0.238856, -0.864188}, \n{-0.295242, 0.000000, -0.955423}, \n{-0.162460, 0.262866, -0.951056}, \n{0.000000, 0.000000, -1.000000}, \n{0.295242, 0.000000, -0.955423}, \n{0.162460, 0.262866, -0.951056}, \n{-0.442863, -0.238856, -0.864188}, \n{-0.309017, -0.500000, -0.809017}, \n{-0.162460, -0.262866, -0.951056}, \n{0.000000, -0.850651, -0.525731}, \n{-0.147621, -0.716567, -0.681718}, \n{0.147621, -0.716567, -0.681718}, \n{0.000000, -0.525731, -0.850651}, \n{0.309017, -0.500000, -0.809017}, \n{0.442863, -0.238856, -0.864188}, \n{0.162460, -0.262866, -0.951056}, \n{0.238856, -0.864188, -0.442863}, \n{0.500000, -0.809017, -0.309017}, \n{0.425325, -0.688191, -0.587785}, \n{0.716567, -0.681718, -0.147621}, \n{0.688191, -0.587785, -0.425325}, \n{0.587785, -0.425325, -0.688191}, \n{0.000000, -0.955423, -0.295242}, \n{0.000000, -1.000000, 0.000000}, \n{0.262866, -0.951056, -0.162460}, \n{0.000000, -0.850651, 0.525731}, \n{0.000000, -0.955423, 0.295242}, \n{0.238856, -0.864188, 0.442863}, \n{0.262866, -0.951056, 0.162460}, \n{0.500000, -0.809017, 0.309017}, \n{0.716567, -0.681718, 0.147621}, \n{0.525731, -0.850651, 0.000000}, \n{-0.238856, -0.864188, -0.442863}, \n{-0.500000, -0.809017, -0.309017}, \n{-0.262866, -0.951056, -0.162460}, \n{-0.850651, -0.525731, 0.000000}, \n{-0.716567, -0.681718, -0.147621}, \n{-0.716567, -0.681718, 0.147621}, \n{-0.525731, -0.850651, 0.000000}, \n{-0.500000, -0.809017, 0.309017}, \n{-0.238856, -0.864188, 0.442863}, \n{-0.262866, -0.951056, 0.162460}, \n{-0.864188, -0.442863, 0.238856}, \n{-0.809017, -0.309017, 0.500000}, \n{-0.688191, -0.587785, 0.425325}, \n{-0.681718, -0.147621, 0.716567}, \n{-0.442863, -0.238856, 0.864188}, \n{-0.587785, -0.425325, 0.688191}, \n{-0.309017, -0.500000, 0.809017}, \n{-0.147621, -0.716567, 0.681718}, \n{-0.425325, -0.688191, 0.587785}, \n{-0.162460, -0.262866, 0.951056}, \n{0.442863, -0.238856, 0.864188}, \n{0.162460, -0.262866, 0.951056}, \n{0.309017, -0.500000, 0.809017}, \n{0.147621, -0.716567, 0.681718}, \n{0.000000, -0.525731, 0.850651}, \n{0.425325, -0.688191, 0.587785}, \n{0.587785, -0.425325, 0.688191}, \n{0.688191, -0.587785, 0.425325}, \n{-0.955423, 0.295242, 0.000000}, \n{-0.951056, 0.162460, 0.262866}, \n{-1.000000, 0.000000, 0.000000}, \n{-0.850651, 0.000000, 0.525731}, \n{-0.955423, -0.295242, 0.000000}, \n{-0.951056, -0.162460, 0.262866}, \n{-0.864188, 0.442863, -0.238856}, \n{-0.951056, 0.162460, -0.262866}, \n{-0.809017, 0.309017, -0.500000}, \n{-0.864188, -0.442863, -0.238856}, \n{-0.951056, -0.162460, -0.262866}, \n{-0.809017, -0.309017, -0.500000}, \n{-0.681718, 0.147621, -0.716567}, \n{-0.681718, -0.147621, -0.716567}, \n{-0.850651, 0.000000, -0.525731}, \n{-0.688191, 0.587785, -0.425325}, \n{-0.587785, 0.425325, -0.688191}, \n{-0.425325, 0.688191, -0.587785}, \n{-0.425325, -0.688191, -0.587785}, \n{-0.587785, -0.425325, -0.688191}, \n{-0.688191, -0.587785, -0.425325}, \n"
  },
  {
    "path": "engine/archtypes.h",
    "content": "//\n// Word size dependent definitions\n// DAL 1/03\n//\n#ifndef ARCHTYPES_H\n#define ARCHTYPES_H\n\n#if defined(__x86_64__) || defined(_WIN64) || defined(__aarch64__) || defined(__powerpc64__)\n#define X64BITS\n#endif\n\n#if defined( _WIN32 ) && (! defined( __MINGW32__ ))\n\ntypedef __int16 int16;\ntypedef unsigned __int16 uint16;\ntypedef __int32 int32;\ntypedef unsigned __int32 uint32;\ntypedef __int64 int64;\ntypedef unsigned __int64 uint64;\n\n#ifdef X64BITS\ntypedef __int64 intp;\t\t\t\t// intp is an integer that can accomodate a pointer\ntypedef unsigned __int64 uintp;\t\t// (ie, sizeof(intp) >= sizeof(int) && sizeof(intp) >= sizeof(void *)\n#else\ntypedef __int32 intp;\ntypedef unsigned __int32 uintp;\n#endif\t// (ie, sizeof(intp) >= sizeof(int) && sizeof(intp) >= sizeof(void *)\n\n#else /* _WIN32 */\n\ntypedef short int16;\ntypedef unsigned short uint16;\ntypedef int int32;\ntypedef unsigned int uint32;\ntypedef long long int64;\ntypedef unsigned long long uint64;\n#ifdef X64BITS\ntypedef long long intp;\ntypedef unsigned long long uintp;\n#else\ntypedef int intp;\ntypedef unsigned int uintp;\n#endif\n\n#endif /* else _WIN32 */\n\n#endif /* ARCHTYPES_H */\n"
  },
  {
    "path": "engine/cdll_int.h",
    "content": "/***\n*\n*\tCopyright (c) 1999, Valve LLC. All rights reserved.\n*\t\n*\tThis product contains software technology licensed from Id \n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc. \n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n//\n//  cdll_int.h\n//\n// 4-23-98  \n// JOHN:  client dll interface declarations\n//\n\n#ifndef CDLL_INT_H\n#define CDLL_INT_H\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n#include \"const.h\"\n#include \"steam/steamtypes.h\"\n#include \"ref_params.h\"\n#include \"r_efx.h\"\n#include \"studio_event.h\"\n\n// this file is included by both the engine and the client-dll,\n// so make sure engine declarations aren't done twice\n\ntypedef int HSPRITE;\t// handle to a graphic\n\n#define SCRINFO_SCREENFLASH 1\n#define SCRINFO_STRETCHED\t2\n\ntypedef struct SCREENINFO_s\n{\n\tint\t\tiSize;\n\tint\t\tiWidth;\n\tint\t\tiHeight;\n\tint\t\tiFlags;\n\tint\t\tiCharHeight;\n\tshort\tcharWidths[256];\n} SCREENINFO;\n\n\ntypedef struct client_data_s\n{\n\t// fields that cannot be modified  (ie. have no effect if changed)\n\tvec3_t origin;\n\n\t// fields that can be changed by the cldll\n\tvec3_t viewangles;\n\tint\t\tiWeaponBits;\n//\tint\t\tiAccessoryBits;\n\tfloat\tfov;\t// field of view\n} client_data_t;\n\ntypedef struct client_sprite_s\n{\n\tchar szName[64];\n\tchar szSprite[64];\n\tint hspr;\n\tint iRes;\n\twrect_t rc;\n} client_sprite_t;\n\n\n\ntypedef struct hud_player_info_s\n{\n\tchar *name;\n\tshort ping;\n\tbyte thisplayer;  // TRUE if this is the calling player\n\n\tbyte spectator;\n\tbyte packetloss;\n\n\tchar *model;\n\tshort topcolor;\n\tshort bottomcolor;\n\n\tuint64 m_nSteamID;\n} hud_player_info_t;\n\n\n\ntypedef struct module_s\n{\n\tunsigned char\t\t\t\tucMD5Hash[16];\t// hash over code\n\tqboolean\t\t\t\t\tfLoaded;\t\t// true if successfully loaded\n} module_t;\n\n\n\n\t\n\t\t\n\n#ifndef IN_BUTTONS_H\n#include \"in_buttons.h\"\n#endif\n\n#define CLDLL_INTERFACE_VERSION\t\t7\n\nextern void LoadSecurityModuleFromDisk(char * pszDllName);\nextern void LoadSecurityModuleFromMemory( unsigned char * pCode, int nSize );\nextern void CloseSecurityModule();\n\n\nextern void ClientDLL_Init( void ); // from cdll_int.c\nextern void ClientDLL_Shutdown( void );\nextern void ClientDLL_HudInit( void );\nextern void ClientDLL_HudVidInit( void );\nextern void\tClientDLL_UpdateClientData( void );\nextern void ClientDLL_Frame( double time );\nextern void ClientDLL_HudRedraw( int intermission );\nextern void ClientDLL_MoveClient( struct playermove_s *ppmove );\nextern void ClientDLL_ClientMoveInit( struct playermove_s *ppmove );\nextern char ClientDLL_ClientTextureType( char *name );\n\nextern void ClientDLL_CreateMove( float frametime, struct usercmd_s *cmd, int active );\nextern void ClientDLL_ActivateMouse( void );\nextern void ClientDLL_DeactivateMouse( void );\nextern void ClientDLL_MouseEvent( int mstate );\nextern void ClientDLL_ClearStates( void );\nextern int ClientDLL_IsThirdPerson( void );\nextern void ClientDLL_GetCameraOffsets( float *ofs );\nextern int ClientDLL_GraphKeyDown( void );\nextern struct kbutton_s *ClientDLL_FindKey( const char *name );\nextern void ClientDLL_CAM_Think( void );\nextern void ClientDLL_IN_Accumulate( void );\nextern void ClientDLL_CalcRefdef( struct ref_params_s *pparams );\nextern int ClientDLL_AddEntity( int type, struct cl_entity_s *ent );\nextern void ClientDLL_CreateEntities( void );\n\nextern void ClientDLL_DrawNormalTriangles( void );\nextern void ClientDLL_DrawTransparentTriangles( void );\nextern void ClientDLL_StudioEvent( const struct mstudioevent_s *event, const struct cl_entity_s *entity );\nextern void ClientDLL_PostRunCmd( struct local_state_s *from, struct local_state_s *to, struct usercmd_s *cmd, int runfuncs, double time, unsigned int random_seed );\nextern void ClientDLL_TxferLocalOverrides( struct entity_state_s *state, const struct clientdata_s *client );\nextern void ClientDLL_ProcessPlayerState( struct entity_state_s *dst, const struct entity_state_s *src );\nextern void ClientDLL_TxferPredictionData ( struct entity_state_s *ps, const struct entity_state_s *pps, struct clientdata_s *pcd, const struct clientdata_s *ppcd, struct weapon_data_s *wd, const struct weapon_data_s *pwd );\nextern void ClientDLL_ReadDemoBuffer( int size, unsigned char *buffer );\nextern int ClientDLL_ConnectionlessPacket( const struct netadr_s *net_from, const char *args, char *response_buffer, int *response_buffer_size );\nextern int ClientDLL_GetHullBounds( int hullnumber, float *mins, float *maxs );\n\nextern void ClientDLL_VGui_ConsolePrint(const char* text);\n\nextern int ClientDLL_Key_Event( int down, int keynum, const char *pszCurrentBinding );\nextern void ClientDLL_TempEntUpdate( double ft, double ct, double grav, struct tempent_s **ppFreeTE, struct tempent_s **ppActiveTE, int ( *addTEntity )( struct cl_entity_s *pEntity ), void ( *playTESound )( struct tempent_s *pTemp, float damp ) );\nextern struct cl_entity_s *ClientDLL_GetUserEntity( int index );\nextern void ClientDLL_VoiceStatus(int entindex, qboolean bTalking);\nextern void ClientDLL_DirectorMessage( int iSize, void *pbuf );\nextern void ClientDLL_ChatInputPosition( int *x, int *y );\n\n//#include \"server.h\" // server_static_t define for apiproxy\n#include \"APIProxy.h\"\n\nextern cldll_func_t\tcl_funcs;\nextern cl_enginefunc_t cl_engsrcProxies;\nextern cl_enginefunc_dst_t g_engdstAddrs;\n\n// Module exports\nextern modfuncs_t g_modfuncs;\nextern module_t\tg_module;\n\n// Macros for exported engine funcs\n#define RecEngSPR_Load(a)\t\t\t\t\t(g_engdstAddrs.pfnSPR_Load(&a))\n#define RecEngSPR_Frames(a)\t\t\t\t\t(g_engdstAddrs.pfnSPR_Frames(&a))\n#define RecEngSPR_Height(a, b)\t\t\t\t(g_engdstAddrs.pfnSPR_Height(&a, &b))\n#define RecEngSPR_Width(a, b)\t\t\t\t(g_engdstAddrs.pfnSPR_Width(&a, &b))\n#define RecEngSPR_Set(a, b, c, d)\t\t\t(g_engdstAddrs.pfnSPR_Set(&a, &b, &c, &d))\n#define RecEngSPR_Draw(a, b, c, d)\t\t\t(g_engdstAddrs.pfnSPR_Draw(&a, &b, &c, &d))\n#define RecEngSPR_DrawHoles(a, b, c, d)\t\t(g_engdstAddrs.pfnSPR_DrawHoles(&a, &b, &c, &d))\n#define RecEngSPR_DrawAdditive(a, b, c, d)\t(g_engdstAddrs.pfnSPR_DrawAdditive(&a, &b, &c, &d))\n#define RecEngSPR_EnableScissor(a, b, c, d)\t(g_engdstAddrs.pfnSPR_EnableScissor(&a, &b, &c, &d))\n#define RecEngSPR_DisableScissor()\t\t\t(g_engdstAddrs.pfnSPR_DisableScissor())\n#define RecEngSPR_GetList(a, b)\t\t\t\t(g_engdstAddrs.pfnSPR_GetList(&a, &b))\n#define RecEngDraw_FillRGBA(a, b, c, d, e, f, g, h)\t\t(g_engdstAddrs.pfnFillRGBA(&a, &b, &c, &d, &e, &f, &g, &h))\n#define RecEnghudGetScreenInfo(a)\t\t\t(g_engdstAddrs.pfnGetScreenInfo(&a))\n#define RecEngSetCrosshair(a, b, c, d, e)\t(g_engdstAddrs.pfnSetCrosshair(&a, &b, &c, &d, &e))\n#define RecEnghudRegisterVariable(a, b, c)\t(g_engdstAddrs.pfnRegisterVariable(&a, &b, &c))\n#define RecEnghudGetCvarFloat(a)\t\t\t(g_engdstAddrs.pfnGetCvarFloat(&a))\n#define RecEnghudGetCvarString(a)\t\t\t(g_engdstAddrs.pfnGetCvarString(&a))\n#define RecEnghudAddCommand(a, b)\t\t\t(g_engdstAddrs.pfnAddCommand(&a, &b))\n#define RecEnghudHookUserMsg(a, b)\t\t\t(g_engdstAddrs.pfnHookUserMsg(&a, &b))\n#define RecEnghudServerCmd(a)\t\t\t\t(g_engdstAddrs.pfnServerCmd(&a))\n#define RecEnghudClientCmd(a)\t\t\t\t(g_engdstAddrs.pfnClientCmd(&a))\n#define RecEnghudFilteredClientCmd(a)\t\t(g_engdstAddrs.pfnFilteredClientCmd(&a))\n#define RecEngPrimeMusicStream(a, b)\t(g_engdstAddrs.pfnPrimeMusicStream(&a, &b))\n#define RecEnghudGetPlayerInfo(a, b)\t\t(g_engdstAddrs.pfnGetPlayerInfo(&a, &b))\n#define RecEnghudPlaySoundByName(a, b)\t\t(g_engdstAddrs.pfnPlaySoundByName(&a, &b))\n#define RecEnghudPlaySoundByNameAtPitch(a, b, c)\t(g_engdstAddrs.pfnPlaySoundByNameAtPitch(&a, &b, &c))\n#define RecEnghudPlaySoundVoiceByName(a, b)\t(g_engdstAddrs.pfnPlaySoundVoiceByName(&a, &b))\n#define RecEnghudPlaySoundByIndex(a, b)\t\t(g_engdstAddrs.pfnPlaySoundByIndex(&a, &b))\n#define RecEngAngleVectors(a, b, c, d)\t\t(g_engdstAddrs.pfnAngleVectors(&a, &b, &c, &d))\n#define RecEngTextMessageGet(a)\t\t\t\t(g_engdstAddrs.pfnTextMessageGet(&a))\n#define RecEngTextMessageDrawCharacter(a, b, c, d, e, f)\t(g_engdstAddrs.pfnDrawCharacter(&a, &b, &c, &d, &e, &f))\n#define RecEngDrawConsoleString(a, b, c)\t(g_engdstAddrs.pfnDrawConsoleString(&a, &b, &c))\n#define RecEngDrawSetTextColor(a, b, c)\t\t(g_engdstAddrs.pfnDrawSetTextColor(&a, &b, &c))\n#define RecEnghudDrawConsoleStringLen(a, b, c)\t(g_engdstAddrs.pfnDrawConsoleStringLen(&a, &b, &c))\n#define RecEnghudConsolePrint(a)\t\t\t(g_engdstAddrs.pfnConsolePrint(&a))\n#define RecEnghudCenterPrint(a)\t\t\t\t(g_engdstAddrs.pfnCenterPrint(&a))\n#define RecEnghudCenterX()\t\t\t\t\t(g_engdstAddrs.GetWindowCenterX())\n#define RecEnghudCenterY()\t\t\t\t\t(g_engdstAddrs.GetWindowCenterY())\n#define RecEnghudGetViewAngles(a)\t\t\t(g_engdstAddrs.GetViewAngles(&a))\n#define RecEnghudSetViewAngles(a)\t\t\t(g_engdstAddrs.SetViewAngles(&a))\n#define RecEnghudGetMaxClients()\t\t\t(g_engdstAddrs.GetMaxClients())\n#define RecEngCvar_SetValue(a, b)\t\t\t(g_engdstAddrs.Cvar_SetValue(&a, &b))\n#define RecEngCmd_Argc()\t\t\t\t\t(g_engdstAddrs.Cmd_Argc())\n#define RecEngCmd_Argv(a)\t\t\t\t\t(g_engdstAddrs.Cmd_Argv(&a))\n#define RecEngCon_Printf(a)\t\t\t\t\t(g_engdstAddrs.Con_Printf(&a))\n#define RecEngCon_DPrintf(a)\t\t\t\t(g_engdstAddrs.Con_DPrintf(&a))\n#define RecEngCon_NPrintf(a, b)\t\t\t\t(g_engdstAddrs.Con_NPrintf(&a, &b))\n#define RecEngCon_NXPrintf(a, b)\t\t\t(g_engdstAddrs.Con_NXPrintf(&a, &b))\n#define RecEnghudPhysInfo_ValueForKey(a)\t(g_engdstAddrs.PhysInfo_ValueForKey(&a))\n#define RecEnghudServerInfo_ValueForKey(a)\t(g_engdstAddrs.ServerInfo_ValueForKey(&a))\n#define RecEnghudGetClientMaxspeed()\t\t(g_engdstAddrs.GetClientMaxspeed())\n#define RecEnghudCheckParm(a, b)\t\t\t(g_engdstAddrs.CheckParm(&a, &b))\n#define RecEngKey_Event(a, b)\t\t\t\t(g_engdstAddrs.Key_Event(&a, &b))\n#define RecEnghudGetMousePosition(a, b)\t\t(g_engdstAddrs.GetMousePosition(&a, &b))\n#define RecEnghudIsNoClipping()\t\t\t\t(g_engdstAddrs.IsNoClipping())\n#define RecEnghudGetLocalPlayer()\t\t\t(g_engdstAddrs.GetLocalPlayer())\n#define RecEnghudGetViewModel()\t\t\t\t(g_engdstAddrs.GetViewModel())\n#define RecEnghudGetEntityByIndex(a)\t\t(g_engdstAddrs.GetEntityByIndex(&a))\n#define RecEnghudGetClientTime()\t\t\t(g_engdstAddrs.GetClientTime())\n#define RecEngV_CalcShake()\t\t\t\t\t(g_engdstAddrs.V_CalcShake())\n#define RecEngV_ApplyShake(a, b, c)\t\t\t(g_engdstAddrs.V_ApplyShake(&a, &b, &c))\n#define RecEngPM_PointContents(a, b)\t\t(g_engdstAddrs.PM_PointContents(&a, &b))\n#define RecEngPM_WaterEntity(a)\t\t\t\t(g_engdstAddrs.PM_WaterEntity(&a))\n#define RecEngPM_TraceLine(a, b, c, d, e)\t(g_engdstAddrs.PM_TraceLine(&a, &b, &c, &d, &e))\n#define RecEngCL_LoadModel(a, b)\t\t\t(g_engdstAddrs.CL_LoadModel(&a, &b))\n#define RecEngCL_CreateVisibleEntity(a, b)\t(g_engdstAddrs.CL_CreateVisibleEntity(&a, &b))\n#define RecEnghudGetSpritePointer(a)\t\t(g_engdstAddrs.GetSpritePointer(&a))\n#define RecEnghudPlaySoundByNameAtLocation(a, b, c)\t\t(g_engdstAddrs.pfnPlaySoundByNameAtLocation(&a, &b, &c))\n#define RecEnghudPrecacheEvent(a, b)\t\t(g_engdstAddrs.pfnPrecacheEvent(&a, &b))\n#define RecEnghudPlaybackEvent(a, b, c, d, e, f, g, h, i, j, k, l)\t(g_engdstAddrs.pfnPlaybackEvent(&a, &b, &c, &d, &e, &f, &g, &h, &i, &j, &k, &l))\n#define RecEnghudWeaponAnim(a, b)\t\t\t(g_engdstAddrs.pfnWeaponAnim(&a, &b))\n#define RecEngRandomFloat(a, b)\t\t\t\t(g_engdstAddrs.pfnRandomFloat(&a, &b))\n#define RecEngRandomLong(a, b)\t\t\t\t(g_engdstAddrs.pfnRandomLong(&a, &b))\n#define RecEngCL_HookEvent(a, b)\t\t\t(g_engdstAddrs.pfnHookEvent(&a, &b))\n#define RecEngCon_IsVisible()\t\t\t\t(g_engdstAddrs.Con_IsVisible())\n#define RecEnghudGetGameDir()\t\t\t\t(g_engdstAddrs.pfnGetGameDirectory())\n#define RecEngCvar_FindVar(a)\t\t\t\t(g_engdstAddrs.pfnGetCvarPointer(&a))\n#define RecEngKey_NameForBinding(a)\t\t\t(g_engdstAddrs.Key_LookupBinding(&a))\n#define RecEnghudGetLevelName()\t\t\t\t(g_engdstAddrs.pfnGetLevelName())\n#define RecEnghudGetScreenFade(a)\t\t\t(g_engdstAddrs.pfnGetScreenFade(&a))\n#define RecEnghudSetScreenFade(a)\t\t\t(g_engdstAddrs.pfnSetScreenFade(&a))\n#define RecEngVGuiWrap_GetPanel()\t\t\t(g_engdstAddrs.VGui_GetPanel())\n#define RecEngVGui_ViewportPaintBackground(a)\t(g_engdstAddrs.VGui_ViewportPaintBackground(&a))\n#define RecEngCOM_LoadFile(a, b, c)\t\t\t(g_engdstAddrs.COM_LoadFile(&a, &b, &c))\n#define RecEngCOM_ParseFile(a, b)\t\t\t(g_engdstAddrs.COM_ParseFile(&a, &b))\n#define RecEngCOM_FreeFile(a)\t\t\t\t(g_engdstAddrs.COM_FreeFile(&a))\n#define RecEngCL_IsSpectateOnly()\t\t\t(g_engdstAddrs.IsSpectateOnly())\n#define RecEngR_LoadMapSprite(a)\t\t\t(g_engdstAddrs.LoadMapSprite(&a))\n#define RecEngCOM_AddAppDirectoryToSearchPath(a, b)\t\t(g_engdstAddrs.COM_AddAppDirectoryToSearchPath(&a, &b))\n#define RecEngClientDLL_ExpandFileName(a, b, c)\t\t(g_engdstAddrs.COM_ExpandFilename(&a, &b, &c))\n#define RecEngPlayerInfo_ValueForKey(a, b)\t(g_engdstAddrs.PlayerInfo_ValueForKey(&a, &b))\n#define RecEngPlayerInfo_SetValueForKey(a, b)\t\t(g_engdstAddrs.PlayerInfo_SetValueForKey(&a, &b))\n#define RecEngGetPlayerUniqueID(a, b)\t\t(g_engdstAddrs.GetPlayerUniqueID(&a, &b))\n#define RecEngGetTrackerIDForPlayer(a)\t\t(g_engdstAddrs.GetTrackerIDForPlayer(&a))\n#define RecEngGetPlayerForTrackerID(a)\t\t(g_engdstAddrs.GetPlayerForTrackerID(&a))\n#define RecEnghudServerCmdUnreliable(a)\t\t(g_engdstAddrs.pfnServerCmdUnreliable(&a))\n#define RecEngGetMousePos(a)\t\t\t\t(g_engdstAddrs.pfnGetMousePos(&a))\n#define RecEngSetMousePos(a, b)\t\t\t\t(g_engdstAddrs.pfnSetMousePos(&a, &b))\n#define RecEngSetMouseEnable(a)\t\t\t\t(g_engdstAddrs.pfnSetMouseEnable(&a))\n#define RecEngSetFilterMode(a)\t\t\t\t(g_engdstAddrs.pfnSetFilterMode(&a))\n#define RecEngSetFilterColor(a,b,c)\t\t\t(g_engdstAddrs.pfnSetFilterColor(&a,&b,&c))\n#define RecEngSetFilterBrightness(a)\t\t(g_engdstAddrs.pfnSetFilterBrightness(&a))\n#define RecEngSequenceGet(a,b)\t\t\t\t(g_engdstAddrs.pfnSequenceGet(&a,&b))\n#define RecEngSPR_DrawGeneric(a,b,c,d,e,f,g,h)\t(g_engdstAddrs.pfnSPR_DrawGeneric(&a, &b, &c, &d, &e, &f, &g, &h))\n#define RecEngSequencePickSentence(a,b,c)\t(g_engdstAddrs.pfnSequencePickSentence(&a, &b, &c))\n#define RecEngLocalPlayerInfo_ValueForKey(a)\t(g_engdstAddrs.LocalPlayerInfo_ValueForKey(&a))\n#define RecEngProcessTutorMessageDecayBuffer(a, b)\t\t(g_engdstAddrs.pfnProcessTutorMessageDecayBuffer(&a, &b))\n#define RecEngConstructTutorMessageDecayBuffer(a, b)\t(g_engdstAddrs.pfnConstructTutorMessageDecayBuffer(&a, &b))\n#define RecEngResetTutorMessageDecayBuffer()\t\t(g_engdstAddrs.pfnResetTutorMessageDecayBuffer())\n#define RecEngDraw_FillRGBABlend(a, b, c, d, e, f, g, h)\t\t(g_engdstAddrs.pfnFillRGBABlend(&a, &b, &c, &d, &e, &f, &g, &h))\n\n// Dummy destination function for use when there's no security module\nextern void NullDst(void);\n\n// Use this to init an engdst structure to point to NullDst\n#define k_engdstNull \\\n{ \\\n\t(pfnEngDst_pfnSPR_Load_t)\t\t\t\t\t\tNullDst, \\\n\t(pfnEngDst_pfnSPR_Frames_t)\t\t\t\t\t\tNullDst, \\\n\t(pfnEngDst_pfnSPR_Height_t)\t\t\t\t\t\tNullDst, \\\n\t(pfnEngDst_pfnSPR_Width_t)\t\t\t\t\t\tNullDst, \\\n\t(pfnEngDst_pfnSPR_Set_t)\t\t\t\t\t\tNullDst, \\\n\t(pfnEngDst_pfnSPR_Draw_t)\t\t\t\t\t\tNullDst, \\\n\t(pfnEngDst_pfnSPR_DrawHoles_t)\t\t\t\t\tNullDst, \\\n\t(pfnEngDst_pfnSPR_DrawAdditive_t)\t\t\t\tNullDst, \\\n\t(pfnEngDst_pfnSPR_EnableScissor_t)\t\t\t\tNullDst, \\\n\t(pfnEngDst_pfnSPR_DisableScissor_t)\t\t\t\tNullDst, \\\n\t(pfnEngDst_pfnSPR_GetList_t)\t\t\t\t\tNullDst, \\\n\t(pfnEngDst_pfnFillRGBA_t)\t\t\t\t\t\tNullDst, \\\n\t(pfnEngDst_pfnGetScreenInfo_t)\t\t\t\t\tNullDst, \\\n\t(pfnEngDst_pfnSetCrosshair_t)\t\t\t\t\tNullDst, \\\n\t(pfnEngDst_pfnRegisterVariable_t)\t\t\t\tNullDst, \\\n\t(pfnEngDst_pfnGetCvarFloat_t)\t\t\t\t\tNullDst, \\\n\t(pfnEngDst_pfnGetCvarString_t)\t\t\t\t\tNullDst, \\\n\t(pfnEngDst_pfnAddCommand_t)\t\t\t\t\t\tNullDst, \\\n\t(pfnEngDst_pfnHookUserMsg_t)\t\t\t\t\tNullDst, \\\n\t(pfnEngDst_pfnServerCmd_t)\t\t\t\t\t\tNullDst, \\\n\t(pfnEngDst_pfnClientCmd_t)\t\t\t\t\t\tNullDst, \\\n\t(pfnEngDst_pfnGetPlayerInfo_t)\t\t\t\t\tNullDst, \\\n\t(pfnEngDst_pfnPlaySoundByName_t)\t\t\t\tNullDst, \\\n\t(pfnEngDst_pfnPlaySoundByIndex_t)\t\t\t\tNullDst, \\\n\t(pfnEngDst_pfnAngleVectors_t)\t\t\t\t\tNullDst, \\\n\t(pfnEngDst_pfnTextMessageGet_t)\t\t\t\t\tNullDst, \\\n\t(pfnEngDst_pfnDrawCharacter_t)\t\t\t\t\tNullDst, \\\n\t(pfnEngDst_pfnDrawConsoleString_t)\t\t\t\tNullDst, \\\n\t(pfnEngDst_pfnDrawSetTextColor_t)\t\t\t\tNullDst, \\\n\t(pfnEngDst_pfnDrawConsoleStringLen_t)\t\t\tNullDst, \\\n\t(pfnEngDst_pfnConsolePrint_t)\t\t\t\t\tNullDst, \\\n\t(pfnEngDst_pfnCenterPrint_t)\t\t\t\t\tNullDst, \\\n\t(pfnEngDst_GetWindowCenterX_t)\t\t\t\t\tNullDst, \\\n\t(pfnEngDst_GetWindowCenterY_t)\t\t\t\t\tNullDst, \\\n\t(pfnEngDst_GetViewAngles_t)\t\t\t\t\t\tNullDst, \\\n\t(pfnEngDst_SetViewAngles_t)\t\t\t\t\t\tNullDst, \\\n\t(pfnEngDst_GetMaxClients_t)\t\t\t\t\t\tNullDst, \\\n\t(pfnEngDst_Cvar_SetValue_t)\t\t\t\t\t\tNullDst, \\\n\t(pfnEngDst_Cmd_Argc_t)\t\t\t\t\t\t\tNullDst, \\\n\t(pfnEngDst_Cmd_Argv_t)\t\t\t\t\t\t\tNullDst, \\\n\t(pfnEngDst_Con_Printf_t)\t\t\t\t\t\tNullDst, \\\n\t(pfnEngDst_Con_DPrintf_t)\t\t\t\t\t\tNullDst, \\\n\t(pfnEngDst_Con_NPrintf_t)\t\t\t\t\t\tNullDst, \\\n\t(pfnEngDst_Con_NXPrintf_t)\t\t\t\t\t\tNullDst, \\\n\t(pfnEngDst_PhysInfo_ValueForKey_t)\t\t\t\tNullDst, \\\n\t(pfnEngDst_ServerInfo_ValueForKey_t)\t\t\tNullDst, \\\n\t(pfnEngDst_GetClientMaxspeed_t)\t\t\t\t\tNullDst, \\\n\t(pfnEngDst_CheckParm_t)\t\t\t\t\t\t\tNullDst, \\\n\t(pfnEngDst_Key_Event_t)\t\t\t\t\t\t\tNullDst, \\\n\t(pfnEngDst_GetMousePosition_t)\t\t\t\t\tNullDst, \\\n\t(pfnEngDst_IsNoClipping_t)\t\t\t\t\t\tNullDst, \\\n\t(pfnEngDst_GetLocalPlayer_t)\t\t\t\t\tNullDst, \\\n\t(pfnEngDst_GetViewModel_t)\t\t\t\t\t\tNullDst, \\\n\t(pfnEngDst_GetEntityByIndex_t)\t\t\t\t\tNullDst, \\\n\t(pfnEngDst_GetClientTime_t)\t\t\t\t\t\tNullDst, \\\n\t(pfnEngDst_V_CalcShake_t)\t\t\t\t\t\tNullDst, \\\n\t(pfnEngDst_V_ApplyShake_t)\t\t\t\t\t\tNullDst, \\\n\t(pfnEngDst_PM_PointContents_t)\t\t\t\t\tNullDst, \\\n\t(pfnEngDst_PM_WaterEntity_t)\t\t\t\t\tNullDst, \\\n\t(pfnEngDst_PM_TraceLine_t)\t\t\t\t\t\tNullDst, \\\n\t(pfnEngDst_CL_LoadModel_t)\t\t\t\t\t\tNullDst, \\\n\t(pfnEngDst_CL_CreateVisibleEntity_t)\t\t\tNullDst, \\\n\t(pfnEngDst_GetSpritePointer_t)\t\t\t\t\tNullDst, \\\n\t(pfnEngDst_pfnPlaySoundByNameAtLocation_t)\t\tNullDst, \\\n\t(pfnEngDst_pfnPrecacheEvent_t)\t\t\t\t\tNullDst, \\\n\t(pfnEngDst_pfnPlaybackEvent_t)\t\t\t\t\tNullDst, \\\n\t(pfnEngDst_pfnWeaponAnim_t)\t\t\t\t\t\tNullDst, \\\n\t(pfnEngDst_pfnRandomFloat_t)\t\t\t\t\tNullDst, \\\n\t(pfnEngDst_pfnRandomLong_t)\t\t\t\t\t\tNullDst, \\\n\t(pfnEngDst_pfnHookEvent_t)\t\t\t\t\t\tNullDst, \\\n\t(pfnEngDst_Con_IsVisible_t)\t\t\t\t\t\tNullDst, \\\n\t(pfnEngDst_pfnGetGameDirectory_t)\t\t\t\tNullDst, \\\n\t(pfnEngDst_pfnGetCvarPointer_t)\t\t\t\t\tNullDst, \\\n\t(pfnEngDst_Key_LookupBinding_t)\t\t\t\t\tNullDst, \\\n\t(pfnEngDst_pfnGetLevelName_t)\t\t\t\t\tNullDst, \\\n\t(pfnEngDst_pfnGetScreenFade_t)\t\t\t\t\tNullDst, \\\n\t(pfnEngDst_pfnSetScreenFade_t)\t\t\t\t\tNullDst, \\\n\t(pfnEngDst_VGui_GetPanel_t)\t\t\t\t\t\tNullDst, \\\n\t(pfnEngDst_VGui_ViewportPaintBackground_t)\t\tNullDst, \\\n\t(pfnEngDst_COM_LoadFile_t)\t\t\t\t\t\tNullDst, \\\n\t(pfnEngDst_COM_ParseFile_t)\t\t\t\t\t\tNullDst, \\\n\t(pfnEngDst_COM_FreeFile_t)\t\t\t\t\t\tNullDst, \\\n\tNULL, \\\n\tNULL, \\\n\tNULL, \\\n\tNULL, \\\n\tNULL, \\\n\tNULL, \\\n\t(pfnEngDst_IsSpectateOnly_t)\t\t\t\t\tNullDst, \\\n\t(pfnEngDst_LoadMapSprite_t)\t\t\t\t\t\tNullDst, \\\n\t(pfnEngDst_COM_AddAppDirectoryToSearchPath_t)\tNullDst, \\\n\t(pfnEngDst_COM_ExpandFilename_t)\t\t\t\tNullDst, \\\n\t(pfnEngDst_PlayerInfo_ValueForKey_t)\t\t\tNullDst, \\\n\t(pfnEngDst_PlayerInfo_SetValueForKey_t)\t\t\tNullDst, \\\n\t(pfnEngDst_GetPlayerUniqueID_t)\t\t\t\t\tNullDst, \\\n\t(pfnEngDst_GetTrackerIDForPlayer_t)\t\t\t\tNullDst, \\\n\t(pfnEngDst_GetPlayerForTrackerID_t)\t\t\t\tNullDst, \\\n\t(pfnEngDst_pfnServerCmdUnreliable_t)\t\t\tNullDst, \\\n\t(pfnEngDst_GetMousePos_t)\t\t\t\t\t\tNullDst, \\\n\t(pfnEngDst_SetMousePos_t)\t\t\t\t\t\tNullDst, \\\n\t(pfnEngDst_SetMouseEnable_t)\t\t\t\t\tNullDst, \\\n\t(pfnEngDst_pfnSetFilterMode_t)\t\t\t\t\tNullDst, \\\n\t(pfnEngDst_pfnSetFilterColor_t)\t\t\t\t\tNullDst, \\\n\t(pfnEngDst_pfnSetFilterBrightness_t)\t\t\tNullDst, \\\n\t(pfnEngDst_pfnSequenceGet_t)\t\t\t\t\tNullDst, \\\n\t(pfnEngDst_pfnSPR_DrawGeneric_t)\t\t\t\tNullDst, \\\n\t(pfnEngDst_pfnSequencePickSentence_t)\t\t\tNullDst, \\\n\t(pfnEngDst_pfnDrawString_t)\t\t\t\t\t\tNullDst, \\\n\t(pfnEngDst_pfnDrawStringReverse_t)\t\t\t\tNullDst, \\\n\t(pfnEngDst_LocalPlayerInfo_ValueForKey_t)\t\tNullDst, \\\n\t(pfnEngDst_pfnVGUI2DrawCharacter_t)\t\t\tNullDst, \\\n\t(pfnEngDst_pfnVGUI2DrawCharacterAdd_t)\tNullDst, \\\n\t(pfnEngDst_pfnPlaySoundVoiceByName_t)\t\tNullDst, \\\n\t(pfnEngDst_pfnPrimeMusicStream_t)\t\t\t\tNullDst, \\\n\t(pfnEngDst_pfnProcessTutorMessageDecayBuffer_t)\tNullDst, \\\n\t(pfnEngDst_pfnConstructTutorMessageDecayBuffer_t)\tNullDst, \\\n\t(pfnEngDst_pfnResetTutorMessageDecayData_t) NullDst, \\\n\t(pfnEngDst_pfnPlaySoundByNameAtPitch_t)\t\t\tNullDst, \\\n\t(pfnEngDst_pfnFillRGBABlend_t)\t\t\t\t\t\tNullDst, \\\n\t(pfnEngDst_pfnGetAppID_t)\t\t\t\t\t\tNullDst, \\\n\t(pfnEngDst_pfnGetAliases_t)\t\t\t\t\t\tNullDst, \\\n\t(pfnEngDst_pfnVguiWrap2_GetMouseDelta_t)\t\tNullDst, \\\n\t(pfnEngDst_pfnFilteredClientCmd_t)\t\t\t\tNullDst, \\\n};\n\n// Use this to init a cldll_func_dst structure to point to NullDst\n#define k_cldstNull \\\n{ \\\n\t(DST_INITIALIZE_FUNC)\t\t\t\tNullDst, \\\n\t(DST_HUD_INIT_FUNC)\t\t\t\t\tNullDst, \\\n\t(DST_HUD_VIDINIT_FUNC)\t\t\t\tNullDst, \\\n\t(DST_HUD_REDRAW_FUNC)\t\t\t\tNullDst, \\\n\t(DST_HUD_UPDATECLIENTDATA_FUNC)\t\tNullDst, \\\n\t(DST_HUD_RESET_FUNC)\t\t\t\tNullDst, \\\n\t(DST_HUD_CLIENTMOVE_FUNC)\t\t\tNullDst, \\\n\t(DST_HUD_CLIENTMOVEINIT_FUNC)\t\tNullDst, \\\n\t(DST_HUD_TEXTURETYPE_FUNC)\t\t\tNullDst, \\\n\t(DST_HUD_IN_ACTIVATEMOUSE_FUNC)\t\tNullDst, \\\n\t(DST_HUD_IN_DEACTIVATEMOUSE_FUNC)\tNullDst, \\\n\t(DST_HUD_IN_MOUSEEVENT_FUNC)\t\tNullDst, \\\n\t(DST_HUD_IN_CLEARSTATES_FUNC)\t\tNullDst, \\\n\t(DST_HUD_IN_ACCUMULATE_FUNC)\t\tNullDst, \\\n\t(DST_HUD_CL_CREATEMOVE_FUNC)\t\tNullDst, \\\n\t(DST_HUD_CL_ISTHIRDPERSON_FUNC)\t\tNullDst, \\\n\t(DST_HUD_CL_GETCAMERAOFFSETS_FUNC)\tNullDst, \\\n\t(DST_HUD_KB_FIND_FUNC)\t\t\t\tNullDst, \\\n\t(DST_HUD_CAMTHINK_FUNC)\t\t\t\tNullDst, \\\n\t(DST_HUD_CALCREF_FUNC)\t\t\t\tNullDst, \\\n\t(DST_HUD_ADDENTITY_FUNC)\t\t\tNullDst, \\\n\t(DST_HUD_CREATEENTITIES_FUNC)\t\tNullDst, \\\n\t(DST_HUD_DRAWNORMALTRIS_FUNC)\t\tNullDst, \\\n\t(DST_HUD_DRAWTRANSTRIS_FUNC)\t\tNullDst, \\\n\t(DST_HUD_STUDIOEVENT_FUNC)\t\t\tNullDst, \\\n\t(DST_HUD_POSTRUNCMD_FUNC)\t\t\tNullDst, \\\n\t(DST_HUD_SHUTDOWN_FUNC)\t\t\t\tNullDst, \\\n\t(DST_HUD_TXFERLOCALOVERRIDES_FUNC)\tNullDst, \\\n\t(DST_HUD_PROCESSPLAYERSTATE_FUNC)\tNullDst, \\\n\t(DST_HUD_TXFERPREDICTIONDATA_FUNC)\tNullDst, \\\n\t(DST_HUD_DEMOREAD_FUNC)\t\t\t\tNullDst, \\\n\t(DST_HUD_CONNECTIONLESS_FUNC)\t\tNullDst, \\\n\t(DST_HUD_GETHULLBOUNDS_FUNC)\t\tNullDst, \\\n\t(DST_HUD_FRAME_FUNC)\t\t\t\tNullDst, \\\n\t(DST_HUD_KEY_EVENT_FUNC)\t\t\tNullDst, \\\n\t(DST_HUD_TEMPENTUPDATE_FUNC)\t\tNullDst, \\\n\t(DST_HUD_GETUSERENTITY_FUNC)\t\tNullDst, \\\n\t(DST_HUD_VOICESTATUS_FUNC)\t\t\tNullDst, \\\n\t(DST_HUD_DIRECTORMESSAGE_FUNC)\t\tNullDst, \\\n\t(DST_HUD_STUDIO_INTERFACE_FUNC)\t\tNullDst, \\\n\t(DST_HUD_CHATINPUTPOSITION_FUNC)\tNullDst, \\\n\t(DST_HUD_GETPLAYERTEAM)\t\t\t\tNullDst, \\\n}\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif // CDLL_INT_H\n\t"
  },
  {
    "path": "engine/custom.h",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\t\n*\tThis product contains software technology licensed from Id \n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc. \n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n// Customization.h\n\n#ifndef CUSTOM_H\n#define CUSTOM_H\n#ifdef _WIN32\n#ifndef __MINGW32__\n#pragma once\n#endif /* not __MINGW32__ */\n#endif\n\n#include \"const.h\"\n\n#define MAX_QPATH 64    // Must match value in quakedefs.h\n\n/////////////////\n// Customization\n// passed to pfnPlayerCustomization\n// For automatic downloading.\ntypedef enum\n{\n\tt_sound = 0,\n\tt_skin,\n\tt_model,\n\tt_decal,\n\tt_generic,\n\tt_eventscript,\n\tt_world,\t\t// Fake type for world, is really t_model\n} resourcetype_t;\n\n\ntypedef struct\n{\n\tint\t\t\t\tsize;\n} _resourceinfo_t;\n\ntypedef struct resourceinfo_s\n{\n\t_resourceinfo_t info[ 8 ];\n} resourceinfo_t;\n\n#define RES_FATALIFMISSING (1<<0)   // Disconnect if we can't get this file.\n#define RES_WASMISSING     (1<<1)   // Do we have the file locally, did we get it ok?\n#define RES_CUSTOM         (1<<2)   // Is this resource one that corresponds to another player's customization\n\t\t\t\t\t\t\t\t    //  or is it a server startup resource.\n#define RES_REQUESTED\t   (1<<3)\t// Already requested a download of this one\n#define RES_PRECACHED\t   (1<<4)\t// Already precached\n\n#include \"crc.h\"\n\ntypedef struct resource_s\n{\n\tchar              szFileName[MAX_QPATH]; // File name to download/precache.\n\tresourcetype_t    type;                // t_sound, t_skin, t_model, t_decal.\n\tint               nIndex;              // For t_decals\n\tint               nDownloadSize;       // Size in Bytes if this must be downloaded.\n\tunsigned char     ucFlags;\n\n// For handling client to client resource propagation\n\tunsigned char     rgucMD5_hash[16];    // To determine if we already have it.\n\tunsigned char     playernum;           // Which player index this resource is associated with, if it's a custom resource.\n\n\tunsigned char\t  rguc_reserved[ 32 ]; // For future expansion\n\tstruct resource_s *pNext;              // Next in chain.\n\tstruct resource_s *pPrev;\n} resource_t;\n\ntypedef struct customization_s\n{\n\tqboolean bInUse;     // Is this customization in use;\n\tresource_t resource; // The resource_t for this customization\n\tqboolean bTranslated; // Has the raw data been translated into a useable format?  \n\t\t\t\t\t\t   //  (e.g., raw decal .wad make into texture_t *)\n\tint        nUserData1; // Customization specific data\n\tint        nUserData2; // Customization specific data\n\tvoid *pInfo;          // Buffer that holds the data structure that references the data (e.g., the cachewad_t)\n\tvoid *pBuffer;       // Buffer that holds the data for the customization (the raw .wad data)\n\tstruct customization_s *pNext; // Next in chain\n} customization_t;\n\n#define FCUST_FROMHPAK\t\t( 1<<0 )\n#define FCUST_WIPEDATA\t\t( 1<<1 )\n#define FCUST_IGNOREINIT\t( 1<<2 )\n\nvoid\t\tCOM_ClearCustomizationList( struct customization_s *pHead, qboolean bCleanDecals);\nqboolean\tCOM_CreateCustomization( struct customization_s *pListHead, struct resource_s *pResource, int playernumber, int flags, \n\t\t\t\tstruct customization_s **pCustomization, int *nLumps ); \nint\t\t\tCOM_SizeofResourceList ( struct resource_s *pList, struct resourceinfo_s *ri );\n\n#endif // CUSTOM_H\n"
  },
  {
    "path": "engine/customentity.h",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\t\n*\tThis product contains software technology licensed from Id \n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc. \n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n#ifndef CUSTOMENTITY_H\n#define CUSTOMENTITY_H\n\n// Custom Entities\n\n// Start/End Entity is encoded as 12 bits of entity index, and 4 bits of attachment (4:12)\n#define BEAMENT_ENTITY(x)\t\t((x)&0xFFF)\n#define BEAMENT_ATTACHMENT(x)\t(((x)>>12)&0xF)\n\n// Beam types, encoded as a byte\nenum \n{\n\tBEAM_POINTS = 0,\n\tBEAM_ENTPOINT,\n\tBEAM_ENTS,\n\tBEAM_HOSE,\n};\n\n#define BEAM_FSINE\t\t0x10\n#define BEAM_FSOLID\t\t0x20\n#define BEAM_FSHADEIN\t0x40\n#define BEAM_FSHADEOUT\t0x80\n\n#endif\t//CUSTOMENTITY_H\n"
  },
  {
    "path": "engine/edict.h",
    "content": "//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============\n//\n// Purpose: \n//\n// $NoKeywords: $\n//=============================================================================\n\n#if !defined EDICT_H\n#define EDICT_H\n#ifdef _WIN32\n#ifndef __MINGW32__\n#pragma once\n#endif /* not __MINGW32__ */\n#endif\n#define\tMAX_ENT_LEAFS\t48\n\n#include \"progdefs.h\"\n\nstruct edict_s\n{\n\tqboolean\tfree;\n\tint\t\t\tserialnumber;\n\tlink_t\t\tarea;\t\t\t\t// linked to a division node or leaf\n\t\n\tint\t\t\theadnode;\t\t\t// -1 to use normal leaf check\n\tint\t\t\tnum_leafs;\n\tshort\t\tleafnums[MAX_ENT_LEAFS];\n\n\tfloat\t\tfreetime;\t\t\t// sv.time when the object was freed\n\n\tvoid*\t\tpvPrivateData;\t\t// Alloced and freed by engine, used by DLLs\n\n\tentvars_t\tv;\t\t\t\t\t// C exported fields from progs\n\n\t// other fields from progs come immediately after\n};\n\n#endif\n"
  },
  {
    "path": "engine/eiface.h",
    "content": "/***\n*\n*\tCopyright (c) 1999, Valve LLC. All rights reserved.\n*\t\n*\tThis product contains software technology licensed from Id \n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc. \n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n#ifndef EIFACE_H\n#define EIFACE_H\n\n#include \"archtypes.h\"     // DAL\n\n#ifdef HLDEMO_BUILD\n#define INTERFACE_VERSION       001\n#else  // !HLDEMO_BUILD, i.e., regular version of HL\n#define INTERFACE_VERSION\t\t140\n#endif // !HLDEMO_BUILD\n\n#include <stdio.h>\n#include \"custom.h\"\n#include \"cvardef.h\"\n#include \"Sequence.h\"\n//\n// Defines entity interface between engine and DLLs.\n// This header file included by engine files and DLL files.\n//\n// Before including this header, DLLs must:\n//\t\tinclude progdefs.h\n// This is conveniently done for them in extdll.h\n//\n\ntypedef enum\n\t{\n\tat_notice,\n\tat_console,\t\t// same as at_notice, but forces a ConPrintf, not a message box\n\tat_aiconsole,\t// same as at_console, but only shown if developer level is 2!\n\tat_warning,\n\tat_error,\n\tat_logged\t\t// Server print to console ( only in multiplayer games ).\n\t} ALERT_TYPE;\n\n// 4-22-98  JOHN: added for use in pfnClientPrintf\ntypedef enum\n\t{\n\tprint_console,\n\tprint_center,\n\tprint_chat,\n\t} PRINT_TYPE;\n\n// For integrity checking of content on clients\ntypedef enum\n{\n\tforce_exactfile,\t\t\t\t\t// File on client must exactly match server's file\n\tforce_model_samebounds,\t\t\t\t// For model files only, the geometry must fit in the same bbox\n\tforce_model_specifybounds,\t\t\t// For model files only, the geometry must fit in the specified bbox\n\tforce_model_specifybounds_if_avail,\t// For Steam model files only, the geometry must fit in the specified bbox (if the file is available)\n} FORCE_TYPE;\n\n// Returned by TraceLine\ntypedef struct\n\t{\n\tint\t\tfAllSolid;\t\t\t// if true, plane is not valid\n\tint\t\tfStartSolid;\t\t// if true, the initial point was in a solid area\n\tint\t\tfInOpen;\n\tint\t\tfInWater;\n\tfloat\tflFraction;\t\t\t// time completed, 1.0 = didn't hit anything\n\tvec3_t\tvecEndPos;\t\t\t// final position\n\tfloat\tflPlaneDist;\n\tvec3_t\tvecPlaneNormal;\t\t// surface normal at impact\n\tedict_t\t*pHit;\t\t\t\t// entity the surface is on\n\tint\t\tiHitgroup;\t\t\t// 0 == generic, non zero is specific body part\n\t} TraceResult;\n\n// CD audio status\ntypedef struct \n{\n\tint\tfPlaying;// is sound playing right now?\n\tint\tfWasPlaying;// if not, CD is paused if WasPlaying is true.\n\tint\tfInitialized;\n\tint\tfEnabled;\n\tint\tfPlayLooping;\n\tfloat\tcdvolume;\n\t//BYTE \tremap[100];\n\tint\tfCDRom;\n\tint\tfPlayTrack;\n} CDStatus;\n\n#include \"../common/crc.h\"\n\n\n// Engine hands this to DLLs for functionality callbacks\ntypedef struct enginefuncs_s\n{\n\tint\t\t\t(*pfnPrecacheModel)\t\t\t(const char* s);\n\tint\t\t\t(*pfnPrecacheSound)\t\t\t(const char* s);\n\tvoid\t\t(*pfnSetModel)\t\t\t\t(edict_t *e, const char *m);\n\tint\t\t\t(*pfnModelIndex)\t\t\t(const char *m);\n\tint\t\t\t(*pfnModelFrames)\t\t\t(int modelIndex);\n\tvoid\t\t(*pfnSetSize)\t\t\t\t(edict_t *e, const float *rgflMin, const float *rgflMax);\n\tvoid\t\t(*pfnChangeLevel)\t\t\t(char* s1, char* s2);\n\tvoid\t\t(*pfnGetSpawnParms)\t\t\t(edict_t *ent);\n\tvoid\t\t(*pfnSaveSpawnParms)\t\t(edict_t *ent);\n\tfloat\t\t(*pfnVecToYaw)\t\t\t\t(const float *rgflVector);\n\tvoid\t\t(*pfnVecToAngles)\t\t\t(const float *rgflVectorIn, float *rgflVectorOut);\n\tvoid\t\t(*pfnMoveToOrigin)\t\t\t(edict_t *ent, const float *pflGoal, float dist, int iMoveType);\n\tvoid\t\t(*pfnChangeYaw)\t\t\t\t(edict_t* ent);\n\tvoid\t\t(*pfnChangePitch)\t\t\t(edict_t* ent);\n\tedict_t*\t(*pfnFindEntityByString)\t(edict_t *pEdictStartSearchAfter, const char *pszField, const char *pszValue);\n\tint\t\t\t(*pfnGetEntityIllum)\t\t(edict_t* pEnt);\n\tedict_t*\t(*pfnFindEntityInSphere)\t(edict_t *pEdictStartSearchAfter, const float *org, float rad);\n\tedict_t*\t(*pfnFindClientInPVS)\t\t(edict_t *pEdict);\n\tedict_t* (*pfnEntitiesInPVS)\t\t\t(edict_t *pplayer);\n\tvoid\t\t(*pfnMakeVectors)\t\t\t(const float *rgflVector);\n\tvoid\t\t(*pfnAngleVectors)\t\t\t(const float *rgflVector, float *forward, float *right, float *up);\n\tedict_t*\t(*pfnCreateEntity)\t\t\t(void);\n\tvoid\t\t(*pfnRemoveEntity)\t\t\t(edict_t* e);\n\tedict_t*\t(*pfnCreateNamedEntity)\t\t(int className);\n\tvoid\t\t(*pfnMakeStatic)\t\t\t(edict_t *ent);\n\tint\t\t\t(*pfnEntIsOnFloor)\t\t\t(edict_t *e);\n\tint\t\t\t(*pfnDropToFloor)\t\t\t(edict_t* e);\n\tint\t\t\t(*pfnWalkMove)\t\t\t\t(edict_t *ent, float yaw, float dist, int iMode);\n\tvoid\t\t(*pfnSetOrigin)\t\t\t\t(edict_t *e, const float *rgflOrigin);\n\tvoid\t\t(*pfnEmitSound)\t\t\t\t(edict_t *entity, int channel, const char *sample, /*int*/float volume, float attenuation, int fFlags, int pitch);\n\tvoid\t\t(*pfnEmitAmbientSound)\t\t(edict_t *entity, float *pos, const char *samp, float vol, float attenuation, int fFlags, int pitch);\n\tvoid\t\t(*pfnTraceLine)\t\t\t\t(const float *v1, const float *v2, int fNoMonsters, edict_t *pentToSkip, TraceResult *ptr);\n\tvoid\t\t(*pfnTraceToss)\t\t\t\t(edict_t* pent, edict_t* pentToIgnore, TraceResult *ptr);\n\tint\t\t\t(*pfnTraceMonsterHull)\t\t(edict_t *pEdict, const float *v1, const float *v2, int fNoMonsters, edict_t *pentToSkip, TraceResult *ptr);\n\tvoid\t\t(*pfnTraceHull)\t\t\t\t(const float *v1, const float *v2, int fNoMonsters, int hullNumber, edict_t *pentToSkip, TraceResult *ptr);\n\tvoid\t\t(*pfnTraceModel)\t\t\t(const float *v1, const float *v2, int hullNumber, edict_t *pent, TraceResult *ptr);\n\tconst char *(*pfnTraceTexture)\t\t\t(edict_t *pTextureEntity, const float *v1, const float *v2 );\n\tvoid\t\t(*pfnTraceSphere)\t\t\t(const float *v1, const float *v2, int fNoMonsters, float radius, edict_t *pentToSkip, TraceResult *ptr);\n\tvoid\t\t(*pfnGetAimVector)\t\t\t(edict_t* ent, float speed, float *rgflReturn);\n\tvoid\t\t(*pfnServerCommand)\t\t\t(char* str);\n\tvoid\t\t(*pfnServerExecute)\t\t\t(void);\n\tvoid\t\t(*pfnClientCommand)\t\t\t(edict_t* pEdict, char* szFmt, ...);\n\tvoid\t\t(*pfnParticleEffect)\t\t(const float *org, const float *dir, float color, float count);\n\tvoid\t\t(*pfnLightStyle)\t\t\t(int style, char* val);\n\tint\t\t\t(*pfnDecalIndex)\t\t\t(const char *name);\n\tint\t\t\t(*pfnPointContents)\t\t\t(const float *rgflVector);\n\tvoid\t\t(*pfnMessageBegin)\t\t\t(int msg_dest, int msg_type, const float *pOrigin, edict_t *ed);\n\tvoid\t\t(*pfnMessageEnd)\t\t\t(void);\n\tvoid\t\t(*pfnWriteByte)\t\t\t\t(int iValue);\n\tvoid\t\t(*pfnWriteChar)\t\t\t\t(int iValue);\n\tvoid\t\t(*pfnWriteShort)\t\t\t(int iValue);\n\tvoid\t\t(*pfnWriteLong)\t\t\t\t(int iValue);\n\tvoid\t\t(*pfnWriteAngle)\t\t\t(float flValue);\n\tvoid\t\t(*pfnWriteCoord)\t\t\t(float flValue);\n\tvoid\t\t(*pfnWriteString)\t\t\t(const char *sz);\n\tvoid\t\t(*pfnWriteEntity)\t\t\t(int iValue);\n\tvoid\t\t(*pfnCVarRegister)\t\t\t(cvar_t *pCvar);\n\tfloat\t\t(*pfnCVarGetFloat)\t\t\t(const char *szVarName);\n\tconst char*\t(*pfnCVarGetString)\t\t\t(const char *szVarName);\n\tvoid\t\t(*pfnCVarSetFloat)\t\t\t(const char *szVarName, float flValue);\n\tvoid\t\t(*pfnCVarSetString)\t\t\t(const char *szVarName, const char *szValue);\n\tvoid\t\t(*pfnAlertMessage)\t\t\t(ALERT_TYPE atype, const char *szFmt, ...);\n\tvoid\t\t(*pfnEngineFprintf)\t\t\t(void *pfile, const char *szFmt, ...);\n\tvoid*\t\t(*pfnPvAllocEntPrivateData)\t(edict_t *pEdict, int32 cb);\n\tvoid*\t\t(*pfnPvEntPrivateData)\t\t(edict_t *pEdict);\n\tvoid\t\t(*pfnFreeEntPrivateData)\t(edict_t *pEdict);\n\tconst char*\t(*pfnSzFromIndex)\t\t\t(int iString);\n\tint\t\t\t(*pfnAllocString)\t\t\t(const char *szValue);\n\tstruct entvars_s*\t(*pfnGetVarsOfEnt)\t\t\t(edict_t *pEdict);\n\tedict_t*\t(*pfnPEntityOfEntOffset)\t(int iEntOffset);\n\tint\t\t\t(*pfnEntOffsetOfPEntity)\t(const edict_t *pEdict);\n\tint\t\t\t(*pfnIndexOfEdict)\t\t\t(const edict_t *pEdict);\n\tedict_t*\t(*pfnPEntityOfEntIndex)\t\t(int iEntIndex);\n\tedict_t*\t(*pfnFindEntityByVars)\t\t(struct entvars_s* pvars);\n\tvoid*\t\t(*pfnGetModelPtr)\t\t\t(edict_t* pEdict);\n\tint\t\t\t(*pfnRegUserMsg)\t\t\t(const char *pszName, int iSize);\n\tvoid\t\t(*pfnAnimationAutomove)\t\t(const edict_t* pEdict, float flTime);\n\tvoid\t\t(*pfnGetBonePosition)\t\t(const edict_t* pEdict, int iBone, float *rgflOrigin, float *rgflAngles );\n\tuint32 (*pfnFunctionFromName)\t( const char *pName );\n\tconst char *(*pfnNameForFunction)\t\t( uint32 function );\n\tvoid\t\t(*pfnClientPrintf)\t\t\t( edict_t* pEdict, PRINT_TYPE ptype, const char *szMsg ); // JOHN: engine callbacks so game DLL can print messages to individual clients\n\tvoid\t\t(*pfnServerPrint)\t\t\t( const char *szMsg );\n\tconst char *(*pfnCmd_Args)\t\t\t\t( void );\t\t// these 3 added \n\tconst char *(*pfnCmd_Argv)\t\t\t\t( int argc );\t// so game DLL can easily \n\tint\t\t\t(*pfnCmd_Argc)\t\t\t\t( void );\t\t// access client 'cmd' strings\n\tvoid\t\t(*pfnGetAttachment)\t\t\t(const edict_t *pEdict, int iAttachment, float *rgflOrigin, float *rgflAngles );\n\tvoid\t\t(*pfnCRC32_Init)\t\t\t(CRC32_t *pulCRC);\n\tvoid        (*pfnCRC32_ProcessBuffer)   (CRC32_t *pulCRC, void *p, int len);\n\tvoid\t\t(*pfnCRC32_ProcessByte)     (CRC32_t *pulCRC, unsigned char ch);\n\tCRC32_t\t\t(*pfnCRC32_Final)\t\t\t(CRC32_t pulCRC);\n\tint32\t\t(*pfnRandomLong)\t\t\t(int32  lLow,  int32  lHigh);\n\tfloat\t\t(*pfnRandomFloat)\t\t\t(float flLow, float flHigh);\n\tvoid\t\t(*pfnSetView)\t\t\t\t(const edict_t *pClient, const edict_t *pViewent );\n\tfloat\t\t(*pfnTime)\t\t\t\t\t( void );\n\tvoid\t\t(*pfnCrosshairAngle)\t\t(const edict_t *pClient, float pitch, float yaw);\n\tbyte *      (*pfnLoadFileForMe)         (char *filename, int *pLength);\n\tvoid        (*pfnFreeFile)              (void *buffer);\n\tvoid        (*pfnEndSection)            (const char *pszSectionName); // trigger_endsection\n\tint \t\t(*pfnCompareFileTime)       (char *filename1, char *filename2, int *iCompare);\n\tvoid        (*pfnGetGameDir)            (char *szGetGameDir);\n\tvoid\t\t(*pfnCvar_RegisterVariable) (cvar_t *variable);\n\tvoid        (*pfnFadeClientVolume)      (const edict_t *pEdict, int fadePercent, int fadeOutSeconds, int holdTime, int fadeInSeconds);\n\tvoid        (*pfnSetClientMaxspeed)     (const edict_t *pEdict, float fNewMaxspeed);\n\tedict_t *\t(*pfnCreateFakeClient)\t\t(const char *netname);\t// returns NULL if fake client can't be created\n\tvoid\t\t(*pfnRunPlayerMove)\t\t\t(edict_t *fakeclient, const float *viewangles, float forwardmove, float sidemove, float upmove, unsigned short buttons, byte impulse, byte msec );\n\tint\t\t\t(*pfnNumberOfEntities)\t\t(void);\n\tchar*\t\t(*pfnGetInfoKeyBuffer)\t\t(edict_t *e);\t// passing in NULL gets the serverinfo\n\tchar*\t\t(*pfnInfoKeyValue)\t\t\t(char *infobuffer, char *key);\n\tvoid\t\t(*pfnSetKeyValue)\t\t\t(char *infobuffer, char *key, char *value);\n\tvoid\t\t(*pfnSetClientKeyValue)\t\t(int clientIndex, char *infobuffer, char *key, char *value);\n\tint\t\t\t(*pfnIsMapValid)\t\t\t(char *filename);\n\tvoid\t\t(*pfnStaticDecal)\t\t\t( const float *origin, int decalIndex, int entityIndex, int modelIndex );\n\tint\t\t\t(*pfnPrecacheGeneric)\t\t(char* s);\n\tint\t\t\t(*pfnGetPlayerUserId)\t\t(edict_t *e ); // returns the server assigned userid for this player.  useful for logging frags, etc.  returns -1 if the edict couldn't be found in the list of clients\n\tvoid\t\t(*pfnBuildSoundMsg)\t\t\t(edict_t *entity, int channel, const char *sample, /*int*/float volume, float attenuation, int fFlags, int pitch, int msg_dest, int msg_type, const float *pOrigin, edict_t *ed);\n\tint\t\t\t(*pfnIsDedicatedServer)\t\t(void);// is this a dedicated server?\n\tcvar_t\t\t*(*pfnCVarGetPointer)\t\t(const char *szVarName);\n\tunsigned int (*pfnGetPlayerWONId)\t\t(edict_t *e); // returns the server assigned WONid for this player.  useful for logging frags, etc.  returns -1 if the edict couldn't be found in the list of clients\n\n\t// YWB 8/1/99 TFF Physics additions\n\tvoid\t\t(*pfnInfo_RemoveKey)\t\t( char *s, const char *key );\n\tconst char *(*pfnGetPhysicsKeyValue)\t( const edict_t *pClient, const char *key );\n\tvoid\t\t(*pfnSetPhysicsKeyValue)\t( const edict_t *pClient, const char *key, const char *value );\n\tconst char *(*pfnGetPhysicsInfoString)\t( const edict_t *pClient );\n\tunsigned short (*pfnPrecacheEvent)\t\t( int type, const char*psz );\n\tvoid\t\t(*pfnPlaybackEvent)\t\t\t( int flags, const edict_t *pInvoker, unsigned short eventindex, float delay, float *origin, float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2 );\n\n\tunsigned char *(*pfnSetFatPVS)\t\t\t( float *org );\n\tunsigned char *(*pfnSetFatPAS)\t\t\t( float *org );\n\n\tint\t\t\t(*pfnCheckVisibility )\t\t( const edict_t *entity, unsigned char *pset );\n\n\tvoid\t\t(*pfnDeltaSetField)\t\t\t( struct delta_s *pFields, const char *fieldname );\n\tvoid\t\t(*pfnDeltaUnsetField)\t\t( struct delta_s *pFields, const char *fieldname );\n\tvoid\t\t(*pfnDeltaAddEncoder)\t\t( char *name, void (*conditionalencode)( struct delta_s *pFields, const unsigned char *from, const unsigned char *to ) );\n\tint\t\t\t(*pfnGetCurrentPlayer)\t\t( void );\n\tint\t\t\t(*pfnCanSkipPlayer)\t\t\t( const edict_t *player );\n\tint\t\t\t(*pfnDeltaFindField)\t\t( struct delta_s *pFields, const char *fieldname );\n\tvoid\t\t(*pfnDeltaSetFieldByIndex)\t( struct delta_s *pFields, int fieldNumber );\n\tvoid\t\t(*pfnDeltaUnsetFieldByIndex)( struct delta_s *pFields, int fieldNumber );\n\n\tvoid\t\t(*pfnSetGroupMask)\t\t\t( int mask, int op );\n\n\tint\t\t\t(*pfnCreateInstancedBaseline) ( int classname, struct entity_state_s *baseline );\n\tvoid\t\t(*pfnCvar_DirectSet)\t\t( struct cvar_s *var, char *value );\n\n\t// Forces the client and server to be running with the same version of the specified file\n\t//  ( e.g., a player model ).\n\t// Calling this has no effect in single player\n\tvoid\t\t(*pfnForceUnmodified)\t\t( FORCE_TYPE type, float *mins, float *maxs, const char *filename );\n\n\tvoid\t\t(*pfnGetPlayerStats)\t\t( const edict_t *pClient, int *ping, int *packet_loss );\n\n\tvoid\t\t(*pfnAddServerCommand)\t\t( char *cmd_name, void (*function) (void) );\n\n\t// For voice communications, set which clients hear eachother.\n\t// NOTE: these functions take player entity indices (starting at 1).\n\tqboolean\t(*pfnVoice_GetClientListening)(int iReceiver, int iSender);\n\tqboolean\t(*pfnVoice_SetClientListening)(int iReceiver, int iSender, qboolean bListen);\n\n\tconst char *(*pfnGetPlayerAuthId)\t\t( edict_t *e );\n\n\t// PSV: Added for CZ training map\n//\tconst char *(*pfnKeyNameForBinding)\t\t\t\t\t( const char* pBinding );\n\t\n\tsequenceEntry_s*\t(*pfnSequenceGet)\t\t\t\t( const char* fileName, const char* entryName );\n\tsentenceEntry_s*\t(*pfnSequencePickSentence)\t\t( const char* groupName, int pickMethod, int *picked );\n\n\t// LH: Give access to filesize via filesystem\n\tint\t\t\t(*pfnGetFileSize)\t\t\t\t\t\t( char *filename );\n\n\tunsigned int (*pfnGetApproxWavePlayLen)\t\t\t\t(const char *filepath);\n\t// MDC: Added for CZ career-mode\n\tint\t\t\t(*pfnIsCareerMatch)\t\t\t\t\t\t( void );\n\n\t// BGC: return the number of characters of the localized string referenced by using \"label\"\n\tint\t\t\t(*pfnGetLocalizedStringLength)\t\t\t(const char *label);\n\n\t// BGC: added to facilitate persistent storage of tutor message decay values for\n\t// different career game profiles.  Also needs to persist regardless of mp.dll being\n\t// destroyed and recreated.\n\tvoid\t\t(*pfnRegisterTutorMessageShown)\t\t\t(int mid);\n\tint\t\t\t(*pfnGetTimesTutorMessageShown)\t\t\t(int mid);\n\tvoid\t\t(*pfnProcessTutorMessageDecayBuffer)\t(int *buffer, int bufferLength);\n\tvoid\t\t(*pfnConstructTutorMessageDecayBuffer)\t(int *buffer, int bufferLength);\n\tvoid\t\t(*pfnResetTutorMessageDecayData)\t\t( void );\n\tvoid\t\t(*pfnQueryClientCvarValue)\t\t\t\t( const edict_t *player, const char *cvarName );\n\tvoid\t\t(*pfnQueryClientCvarValue2)\t\t\t\t( const edict_t *player, const char *cvarName, int requestID );\n\tint\t\t(*pfnEngCheckParm)\t\t\t\t\t( const char *pchCmdLineToken, char **pchNextVal );\n} enginefuncs_t;\n\n\n// ONLY ADD NEW FUNCTIONS TO THE END OF THIS STRUCT.  INTERFACE VERSION IS FROZEN AT 138\n\n// Passed to pfnKeyValue\ntypedef struct KeyValueData_s\n{\n\tchar\t*szClassName;\t// in: entity classname\n\tchar\t*szKeyName;\t\t// in: name of key\n\tchar\t*szValue;\t\t// in: value of key\n\tint32\tfHandled;\t\t// out: DLL sets to true if key-value pair was understood\n} KeyValueData;\n\n\ntypedef struct\n{\n\tchar\t\tmapName[ 32 ];\n\tchar\t\tlandmarkName[ 32 ];\n\tedict_t\t*pentLandmark;\n\tvec3_t\t\tvecLandmarkOrigin;\n} LEVELLIST;\n#define MAX_LEVEL_CONNECTIONS\t16\t\t// These are encoded in the lower 16bits of ENTITYTABLE->flags\n\ntypedef struct \n{\n\tint\t\t\tid;\t\t\t\t// Ordinal ID of this entity (used for entity <--> pointer conversions)\n\tedict_t\t*pent;\t\t\t// Pointer to the in-game entity\n\n\tint\t\t\tlocation;\t\t// Offset from the base data of this entity\n\tint\t\t\tsize;\t\t\t// Byte size of this entity's data\n\tint\t\t\tflags;\t\t\t// This could be a short -- bit mask of transitions that this entity is in the PVS of\n\tstring_t\tclassname;\t\t// entity class name\n\n} ENTITYTABLE;\n\n#define FENTTABLE_PLAYER\t\t0x80000000\n#define FENTTABLE_REMOVED\t\t0x40000000\n#define FENTTABLE_MOVEABLE\t\t0x20000000\n#define FENTTABLE_GLOBAL\t\t0x10000000\n\ntypedef struct saverestore_s SAVERESTOREDATA;\n\n#ifdef _WIN32\ntypedef \n#endif\nstruct saverestore_s\n{\n\tchar\t\t*pBaseData;\t\t// Start of all entity save data\n\tchar\t\t*pCurrentData;\t// Current buffer pointer for sequential access\n\tint\t\t\tsize;\t\t\t// Current data size\n\tint\t\t\tbufferSize;\t\t// Total space for data\n\tint\t\t\ttokenSize;\t\t// Size of the linear list of tokens\n\tint\t\t\ttokenCount;\t\t// Number of elements in the pTokens table\n\tchar\t\t**pTokens;\t\t// Hash table of entity strings (sparse)\n\tint\t\t\tcurrentIndex;\t// Holds a global entity table ID\n\tint\t\t\ttableCount;\t\t// Number of elements in the entity table\n\tint\t\t\tconnectionCount;// Number of elements in the levelList[]\n\tENTITYTABLE\t*pTable;\t\t// Array of ENTITYTABLE elements (1 for each entity)\n\tLEVELLIST\tlevelList[ MAX_LEVEL_CONNECTIONS ];\t\t// List of connections from this level\n\n\t// smooth transition\n\tint\t\t\tfUseLandmark;\n\tchar\t\tszLandmarkName[20];// landmark we'll spawn near in next level\n\tvec3_t\t\tvecLandmarkOffset;// for landmark transitions\n\tfloat\t\ttime;\n\tchar\t\tszCurrentMapName[32];\t// To check global entities\n\n} \n#ifdef _WIN32\nSAVERESTOREDATA \n#endif\n;\n\ntypedef enum _fieldtypes\n{\n\tFIELD_FLOAT = 0,\t\t// Any floating point value\n\tFIELD_STRING,\t\t\t// A string ID (return from ALLOC_STRING)\n\tFIELD_ENTITY,\t\t\t// An entity offset (EOFFSET)\n\tFIELD_CLASSPTR,\t\t\t// CBaseEntity *\n\tFIELD_EHANDLE,\t\t\t// Entity handle\n\tFIELD_EVARS,\t\t\t// EVARS *\n\tFIELD_EDICT,\t\t\t// edict_t *, or edict_t *  (same thing)\n\tFIELD_VECTOR,\t\t\t// Any vector\n\tFIELD_POSITION_VECTOR,\t// A world coordinate (these are fixed up across level transitions automagically)\n\tFIELD_POINTER,\t\t\t// Arbitrary data pointer... to be removed, use an array of FIELD_CHARACTER\n\tFIELD_INTEGER,\t\t\t// Any integer or enum\n\tFIELD_FUNCTION,\t\t\t// A class function pointer (Think, Use, etc)\n\tFIELD_BOOLEAN,\t\t\t// boolean, implemented as an int, I may use this as a hint for compression\n\tFIELD_SHORT,\t\t\t// 2 byte integer\n\tFIELD_CHARACTER,\t\t// a byte\n\tFIELD_TIME,\t\t\t\t// a floating point time (these are fixed up automatically too!)\n\tFIELD_MODELNAME,\t\t// Engine string that is a model name (needs precache)\n\tFIELD_SOUNDNAME,\t\t// Engine string that is a sound name (needs precache)\n\n\tFIELD_TYPECOUNT,\t\t// MUST BE LAST\n} FIELDTYPE;\n\n#ifndef offsetof\n#define offsetof(s,m)\t(size_t)&(((s *)0)->m)\n#endif\n\n#define _FIELD(type,name,fieldtype,count,flags)\t\t{ fieldtype, #name, offsetof(type, name), count, flags }\n#define DEFINE_FIELD(type,name,fieldtype)\t\t\t_FIELD(type, name, fieldtype, 1, 0)\n#define DEFINE_ARRAY(type,name,fieldtype,count)\t\t_FIELD(type, name, fieldtype, count, 0)\n#define DEFINE_ENTITY_FIELD(name,fieldtype)\t\t\t_FIELD(entvars_t, name, fieldtype, 1, 0 )\n#define DEFINE_ENTITY_GLOBAL_FIELD(name,fieldtype)\t_FIELD(entvars_t, name, fieldtype, 1, FTYPEDESC_GLOBAL )\n#define DEFINE_GLOBAL_FIELD(type,name,fieldtype)\t_FIELD(type, name, fieldtype, 1, FTYPEDESC_GLOBAL )\n\n\n#define FTYPEDESC_GLOBAL\t\t\t0x0001\t\t// This field is masked for global entity save/restore\n\ntypedef struct \n{\n\tFIELDTYPE\t\tfieldType;\n\tchar\t\t\t*fieldName;\n\tint\t\t\t\tfieldOffset;\n\tshort\t\t\tfieldSize;\n\tshort\t\t\tflags;\n} TYPEDESCRIPTION;\n\n#ifndef ARRAYSIZE\n#define ARRAYSIZE(p)\t\t(sizeof(p)/sizeof(p[0]))\n#endif\n\ntypedef struct \n{\n\t// Initialize/shutdown the game (one-time call after loading of game .dll )\n\tvoid\t\t\t(*pfnGameInit)\t\t\t( void );\t\t\t\t\n\tint\t\t\t\t(*pfnSpawn)\t\t\t\t( edict_t *pent );\n\tvoid\t\t\t(*pfnThink)\t\t\t\t( edict_t *pent );\n\tvoid\t\t\t(*pfnUse)\t\t\t\t( edict_t *pentUsed, edict_t *pentOther );\n\tvoid\t\t\t(*pfnTouch)\t\t\t\t( edict_t *pentTouched, edict_t *pentOther );\n\tvoid\t\t\t(*pfnBlocked)\t\t\t( edict_t *pentBlocked, edict_t *pentOther );\n\tvoid\t\t\t(*pfnKeyValue)\t\t\t( edict_t *pentKeyvalue, KeyValueData *pkvd );\n\tvoid\t\t\t(*pfnSave)\t\t\t\t( edict_t *pent, SAVERESTOREDATA *pSaveData );\n\tint \t\t\t(*pfnRestore)\t\t\t( edict_t *pent, SAVERESTOREDATA *pSaveData, int globalEntity );\n\tvoid\t\t\t(*pfnSetAbsBox)\t\t\t( edict_t *pent );\n\n\tvoid\t\t\t(*pfnSaveWriteFields)\t( SAVERESTOREDATA *, const char *, void *, TYPEDESCRIPTION *, int );\n\tvoid\t\t\t(*pfnSaveReadFields)\t( SAVERESTOREDATA *, const char *, void *, TYPEDESCRIPTION *, int );\n\n\tvoid\t\t\t(*pfnSaveGlobalState)\t\t( SAVERESTOREDATA * );\n\tvoid\t\t\t(*pfnRestoreGlobalState)\t( SAVERESTOREDATA * );\n\tvoid\t\t\t(*pfnResetGlobalState)\t\t( void );\n\n\tqboolean\t\t(*pfnClientConnect)\t\t( edict_t *pEntity, const char *pszName, const char *pszAddress, char szRejectReason[ 128 ] );\n\t\n\tvoid\t\t\t(*pfnClientDisconnect)\t( edict_t *pEntity );\n\tvoid\t\t\t(*pfnClientKill)\t\t( edict_t *pEntity );\n\tvoid\t\t\t(*pfnClientPutInServer)\t( edict_t *pEntity );\n\tvoid\t\t\t(*pfnClientCommand)\t\t( edict_t *pEntity );\n\tvoid\t\t\t(*pfnClientUserInfoChanged)( edict_t *pEntity, char *infobuffer );\n\n\tvoid\t\t\t(*pfnServerActivate)\t( edict_t *pEdictList, int edictCount, int clientMax );\n\tvoid\t\t\t(*pfnServerDeactivate)\t( void );\n\n\tvoid\t\t\t(*pfnPlayerPreThink)\t( edict_t *pEntity );\n\tvoid\t\t\t(*pfnPlayerPostThink)\t( edict_t *pEntity );\n\n\tvoid\t\t\t(*pfnStartFrame)\t\t( void );\n\tvoid\t\t\t(*pfnParmsNewLevel)\t\t( void );\n\tvoid\t\t\t(*pfnParmsChangeLevel)\t( void );\n\n\t // Returns string describing current .dll.  E.g., TeamFotrress 2, Half-Life\n\tconst char     *(*pfnGetGameDescription)( void );     \n\n\t// Notify dll about a player customization.\n\tvoid            (*pfnPlayerCustomization) ( edict_t *pEntity, customization_t *pCustom );  \n\n\t// Spectator funcs\n\tvoid\t\t\t(*pfnSpectatorConnect)\t\t( edict_t *pEntity );\n\tvoid\t\t\t(*pfnSpectatorDisconnect)\t( edict_t *pEntity );\n\tvoid\t\t\t(*pfnSpectatorThink)\t\t( edict_t *pEntity );\n\n\t// Notify game .dll that engine is going to shut down.  Allows mod authors to set a breakpoint.\n\tvoid\t\t\t(*pfnSys_Error)\t\t\t( const char *error_string );\n\n\tvoid\t\t\t(*pfnPM_Move) ( struct playermove_s *ppmove, qboolean server );\n\tvoid\t\t\t(*pfnPM_Init) ( struct playermove_s *ppmove );\n\tchar\t\t\t(*pfnPM_FindTextureType)( char *name );\n\tvoid\t\t\t(*pfnSetupVisibility)( struct edict_s *pViewEntity, struct edict_s *pClient, unsigned char **pvs, unsigned char **pas );\n\tvoid\t\t\t(*pfnUpdateClientData) ( const struct edict_s *ent, int sendweapons, struct clientdata_s *cd );\n\tint\t\t\t\t(*pfnAddToFullPack)( struct entity_state_s *state, int e, edict_t *ent, edict_t *host, int hostflags, int player, unsigned char *pSet );\n\tvoid\t\t\t(*pfnCreateBaseline) ( int player, int eindex, struct entity_state_s *baseline, struct edict_s *entity, int playermodelindex, vec3_t player_mins, vec3_t player_maxs );\n\tvoid\t\t\t(*pfnRegisterEncoders)\t( void );\n\tint\t\t\t\t(*pfnGetWeaponData)\t\t( struct edict_s *player, struct weapon_data_s *info );\n\n\tvoid\t\t\t(*pfnCmdStart)\t\t\t( const edict_t *player, const struct usercmd_s *cmd, unsigned int random_seed );\n\tvoid\t\t\t(*pfnCmdEnd)\t\t\t( const edict_t *player );\n\n\t// Return 1 if the packet is valid.  Set response_buffer_size if you want to send a response packet.  Incoming, it holds the max\n\t//  size of the response_buffer, so you must zero it out if you choose not to respond.\n\tint\t\t\t\t(*pfnConnectionlessPacket )\t( const struct netadr_s *net_from, const char *args, char *response_buffer, int *response_buffer_size );\n\n\t// Enumerates player hulls.  Returns 0 if the hull number doesn't exist, 1 otherwise\n\tint\t\t\t\t(*pfnGetHullBounds)\t( int hullnumber, float *mins, float *maxs );\n\n\t// Create baselines for certain \"unplaced\" items.\n\tvoid\t\t\t(*pfnCreateInstancedBaselines) ( void );\n\n\t// One of the pfnForceUnmodified files failed the consistency check for the specified player\n\t// Return 0 to allow the client to continue, 1 to force immediate disconnection ( with an optional disconnect message of up to 256 characters )\n\tint\t\t\t\t(*pfnInconsistentFile)( const struct edict_s *player, const char *filename, char *disconnect_message );\n\n\t// The game .dll should return 1 if lag compensation should be allowed ( could also just set\n\t//  the sv_unlag cvar.\n\t// Most games right now should return 0, until client-side weapon prediction code is written\n\t//  and tested for them.\n\tint\t\t\t\t(*pfnAllowLagCompensation)( void );\n} DLL_FUNCTIONS;\n\nextern DLL_FUNCTIONS\t\tgEntityInterface;\n\n// Current version.\n#define NEW_DLL_FUNCTIONS_VERSION\t1\n\ntypedef struct\n{\n\t// Called right before the object's memory is freed. \n\t// Calls its destructor.\n\tvoid\t\t\t(*pfnOnFreeEntPrivateData)(edict_t *pEnt);\n\tvoid\t\t\t(*pfnGameShutdown)(void);\n\tint\t\t\t\t(*pfnShouldCollide)( edict_t *pentTouched, edict_t *pentOther );\n\tvoid\t\t\t(*pfnCvarValue)( const edict_t *pEnt, const char *value );\n\tvoid\t\t\t(*pfnCvarValue2)( const edict_t *pEnt, int requestID, const char *cvarName, const char *value );\n} NEW_DLL_FUNCTIONS;\ntypedef int\t(*NEW_DLL_FUNCTIONS_FN)( NEW_DLL_FUNCTIONS *pFunctionTable, int *interfaceVersion );\n\n// Pointers will be null if the game DLL doesn't support this API.\nextern NEW_DLL_FUNCTIONS\tgNewDLLFunctions;\n\ntypedef int\t(*APIFUNCTION)( DLL_FUNCTIONS *pFunctionTable, int interfaceVersion );\ntypedef int\t(*APIFUNCTION2)( DLL_FUNCTIONS *pFunctionTable, int *interfaceVersion );\n\n#endif /* EIFACE_H */\n"
  },
  {
    "path": "engine/keydefs.h",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\n*\tThis product contains software technology licensed from Id\n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc.\n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n\n#ifndef KEYDEFS_H\n#define KEYDEFS_H\n\n//\n// these are the key numbers that should be passed to Key_Event\n//\n#define K_TAB\t\t9\n#define K_ENTER\t\t13\n#define K_ESCAPE\t27\n#define K_SPACE\t\t32\n#define K_SCROLLOCK\t70\n\n// normal keys should be passed as lowercased ascii\n\n#define K_BACKSPACE\t\t127\n#define K_UPARROW\t\t128\n#define K_DOWNARROW\t\t129\n#define K_LEFTARROW\t\t130\n#define K_RIGHTARROW\t131\n\n#define K_ALT\t\t132\n#define K_CTRL\t\t133\n#define K_SHIFT\t\t134\n#define K_F1\t\t135\n#define K_F2\t\t136\n#define K_F3\t\t137\n#define K_F4\t\t138\n#define K_F5\t\t139\n#define K_F6\t\t140\n#define K_F7\t\t141\n#define K_F8\t\t142\n#define K_F9\t\t143\n#define K_F10\t\t144\n#define K_F11\t\t145\n#define K_F12\t\t146\n#define K_INS\t\t147\n#define K_DEL\t\t148\n#define K_PGDN\t\t149\n#define K_PGUP\t\t150\n#define K_HOME\t\t151\n#define K_END\t\t152\n\n#define K_KP_HOME\t\t160\n#define K_KP_UPARROW\t161\n#define K_KP_PGUP\t\t162\n#define K_KP_LEFTARROW\t163\n#define K_KP_5\t\t\t164\n#define K_KP_RIGHTARROW\t165\n#define K_KP_END\t\t166\n#define K_KP_DOWNARROW\t167\n#define K_KP_PGDN\t\t168\n#define K_KP_ENTER\t\t169\n#define K_KP_INS   \t\t170\n#define K_KP_DEL\t\t171\n#define K_KP_SLASH\t\t172\n#define K_KP_MINUS\t\t173\n#define K_KP_PLUS\t\t174\n#define K_CAPSLOCK\t\t175\n#define K_KP_MUL\t\t176\n#define K_WIN\t\t\t177\n#define K_KP_NUMLOCK\t178\n\n//\n// joystick buttons\n//\n#define K_JOY1\t\t203 // LTRIGGER (L2)\n#define K_JOY2\t\t204 // RTRIGGER (R2)\n#define K_JOY3\t\t205\n#define K_JOY4\t\t206\n\n//\n// aux keys are for multi-buttoned joysticks to generate so they can use\n// the normal binding process\n//\n#define K_AUX1\t\t207\n#define K_A_BUTTON\tK_AUX1\n\n#define K_AUX2\t\t208\n#define K_B_BUTTON\tK_AUX2\n\n#define K_AUX3\t\t209\n#define K_X_BUTTON\tK_AUX3\n\n#define K_AUX4\t\t210\n#define K_Y_BUTTON\tK_AUX4\n\n#define K_AUX5\t\t211\n#define K_L1_BUTTON\tK_AUX5\n\n#define K_AUX6\t\t212\n#define K_R1_BUTTON K_AUX6\n\n#define K_AUX7\t\t  213\n#define K_BACK_BUTTON K_AUX7\n\n#define K_AUX8\t\t  214\n#define K_MODE_BUTTON K_AUX8\n\n#define K_AUX9\t\t   215\n#define K_START_BUTTON K_AUX9\n\n#define K_AUX10\t\t216\n#define K_LSTICK\tK_AUX10\n\n#define K_AUX11\t\t217\n#define K_RSTICK\tK_AUX11\n\n#define K_AUX12\t\t218\n#define K_L2_BUTTON\tK_AUX12\n\n#define K_AUX13\t\t219\n#define K_R2_BUTTON K_AUX13\n\n#define K_AUX14\t\t220\n#define K_C_BUTTON  K_AUX14\n\n#define K_AUX15\t\t221\n#define K_Z_BUTTON  K_AUX15\n\n#define K_AUX16\t\t222\n#define K_DPAD_UP  K_AUX16\n\n#define K_AUX17\t\t223\n#define K_DPAD_DOWN  K_AUX17\n\n#define K_AUX18\t\t224\n#define K_DPAD_LEFT  K_AUX18\n\n#define K_AUX19\t\t225\n#define K_DPAD_RIGHT  K_AUX19\n\n#define K_AUX20\t\t\t226\n#define K_AUX21\t\t\t227\n#define K_AUX22\t\t\t228\n#define K_AUX23\t\t\t229\n#define K_AUX24\t\t\t230\n#define K_AUX25\t\t\t231\n#define K_AUX26\t\t\t232\n#define K_AUX27\t\t\t233\n#define K_AUX28\t\t\t234\n#define K_AUX29\t\t\t235\n#define K_AUX30\t\t\t236\n#define K_AUX31\t\t\t237\n#define K_AUX32\t\t\t238\n#define K_MWHEELDOWN\t239\n#define K_MWHEELUP\t\t240\n\n#define K_PAUSE\t\t\t255\n\n//\n// mouse buttons generate virtual keys\n//\n#define K_MOUSE1\t\t241\n#define K_MOUSE2\t\t242\n#define K_MOUSE3\t\t243\n#define K_MOUSE4\t\t244\n#define K_MOUSE5\t\t245\n\n#endif//KEYDEFS_H\n"
  },
  {
    "path": "engine/menu_int.h",
    "content": "/*\nmenu_int.h - interface between engine and menu\nCopyright (C) 2010 Uncle Mike\n\nThis program is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\nGNU General Public License for more details.\n*/\n\n#ifndef MENU_INT_H\n#define MENU_INT_H\n\n#include \"cvardef.h\"\n#include \"gameinfo.h\"\n#include \"wrect.h\"\n\n// a macro for mainui_cpp, indicating that mainui should be compiled for\n// Xash3D 1.0 interface\n#define NEW_ENGINE_INTERFACE\n\ntypedef int\t\tHIMAGE;\t\t// handle to a graphic\n\n// flags for PIC_Load\n#define PIC_NEAREST\t\t(1<<0)\t\t// disable texfilter\n#define PIC_KEEP_SOURCE\t(1<<1)\t\t// some images keep source\n#define PIC_NOFLIP_TGA\t(1<<2)\t\t// Steam background completely ignore tga attribute 0x20\n#define PIC_EXPAND_SOURCE (1<<3)\t\t// don't keep as 8-bit source, expand to RGBA\n\n// flags for COM_ParseFileSafe\n#define PFILE_IGNOREBRACKET (1<<0)\n#define PFILE_HANDLECOLON   (1<<1)\n\ntypedef struct ui_globalvars_s\n{\n\tfloat\t\ttime;\t\t// unclamped host.realtime\n\tfloat\t\tframetime;\n\n\tint\t\tscrWidth;\t\t// actual values\n\tint\t\tscrHeight;\n\n\tint\t\tmaxClients;\n\tint\t\tdeveloper; // boolean, changed from allow_console to make mainui_cpp compile for both engines\n\tint\t\tdemoplayback;\n\tint\t\tdemorecording;\n\tchar\t\tdemoname[64];\t// name of currently playing demo\n\tchar\t\tmaptitle[64];\t// title of active map\n} ui_globalvars_t;\n\nstruct ref_viewpass_s;\n\ntypedef struct ui_enginefuncs_s\n{\n\t// image handlers\n\tHIMAGE\t(*pfnPIC_Load)( const char *szPicName, const byte *ucRawImage, int ulRawImageSize, int flags );\n\tvoid\t(*pfnPIC_Free)( const char *szPicName );\n\tint\t(*pfnPIC_Width)( HIMAGE hPic );\n\tint\t(*pfnPIC_Height)( HIMAGE hPic );\n\tvoid\t(*pfnPIC_Set)( HIMAGE hPic, int r, int g, int b, int a );\n\tvoid\t(*pfnPIC_Draw)( int x, int y, int width, int height, const wrect_t *prc );\n\tvoid\t(*pfnPIC_DrawHoles)( int x, int y, int width, int height, const wrect_t *prc );\n\tvoid\t(*pfnPIC_DrawTrans)( int x, int y, int width, int height, const wrect_t *prc );\n\tvoid\t(*pfnPIC_DrawAdditive)( int x, int y, int width, int height, const wrect_t *prc );\n\tvoid\t(*pfnPIC_EnableScissor)( int x, int y, int width, int height );\n\tvoid\t(*pfnPIC_DisableScissor)( void );\n\n\t// screen handlers\n\tvoid\t(*pfnFillRGBA)( int x, int y, int width, int height, int r, int g, int b, int a );\n\n\t// cvar handlers\n\tcvar_t*\t(*pfnRegisterVariable)( const char *szName, const char *szValue, int flags );\n\tfloat\t(*pfnGetCvarFloat)( const char *szName );\n\tconst char*\t(*pfnGetCvarString)( const char *szName );\n\tvoid\t(*pfnCvarSetString)( const char *szName, const char *szValue );\n\tvoid\t(*pfnCvarSetValue)( const char *szName, float flValue );\n\n\t// command handlers\n\tint\t(*pfnAddCommand)( const char *cmd_name, void (*function)(void) );\n\tvoid\t(*pfnClientCmd)( int execute_now, const char *szCmdString );\n\tvoid\t(*pfnDelCommand)( const char *cmd_name );\n\tint (*pfnCmdArgc)( void );\n\tconst char*\t(*pfnCmdArgv)( int argc );\n\tconst char*\t(*pfnCmd_Args)( void );\n\n\t// debug messages (in-menu shows only notify)\n\tvoid\t(*Con_Printf)( const char *fmt, ... ) _format( 1 );\n\tvoid\t(*Con_DPrintf)( const char *fmt, ... )  _format( 1 );\n\tvoid\t(*Con_NPrintf)( int pos, const char *fmt, ... )  _format( 2 );\n\tvoid\t(*Con_NXPrintf)( struct con_nprint_s *info, const char *fmt, ... ) _format( 2 );\n\n\t// sound handlers\n\tvoid\t(*pfnPlayLocalSound)( const char *szSound );\n\n\t// cinematic handlers\n\tvoid\t(*pfnDrawLogo)( const char *filename, float x, float y, float width, float height );\n\tint\t(*pfnGetLogoWidth)( void );\n\tint\t(*pfnGetLogoHeight)( void );\n\tfloat\t(*pfnGetLogoLength)( void );\t// cinematic duration in seconds\n\n\t// text message system\n\tvoid\t(*pfnDrawCharacter)( int x, int y, int width, int height, int ch, int ulRGBA, HIMAGE hFont );\n\tint\t(*pfnDrawConsoleString)( int x, int y, const char *string );\n\tvoid\t(*pfnDrawSetTextColor)( int r, int g, int b, int alpha );\n\tvoid\t(*pfnDrawConsoleStringLen)(  const char *string, int *length, int *height );\n\tvoid\t(*pfnSetConsoleDefaultColor)( int r, int g, int b ); // color must came from colors.lst\n\n\t// custom rendering (for playermodel preview)\n\tstruct cl_entity_s* (*pfnGetPlayerModel)( void );\t// for drawing playermodel previews\n\tvoid\t(*pfnSetModel)( struct cl_entity_s *ed, const char *path );\n\tvoid\t(*pfnClearScene)( void );\n\tvoid\t(*pfnRenderScene)( const struct ref_viewpass_s *rvp );\n\tint\t(*CL_CreateVisibleEntity)( int type, struct cl_entity_s *ent );\n\n\t// misc handlers\n\tvoid\t(*pfnHostError)( const char *szFmt, ... ) _format( 1 );\n\tint\t(*pfnFileExists)( const char *filename, int gamedironly );\n\tvoid\t(*pfnGetGameDir)( char *szGetGameDir );\n\n\t// gameinfo handlers\n\tint\t(*pfnCreateMapsList)( int fRefresh );\n\tint\t(*pfnClientInGame)( void );\n\tvoid\t(*pfnClientJoin)( const struct netadr_s adr );\n\n\t// parse txt files\n\tbyte*\t(*COM_LoadFile)( const char *filename, int *pLength );\n\tchar*\t(*COM_ParseFile)( char *data, char *token );\n\tvoid\t(*COM_FreeFile)( void *buffer );\n\n\t// keyfuncs\n\tvoid\t(*pfnKeyClearStates)( void );\t\t\t\t// call when menu open or close\n\tvoid\t(*pfnSetKeyDest)( int dest );\n\tconst char *(*pfnKeynumToString)( int keynum );\n\tconst char *(*pfnKeyGetBinding)( int keynum );\n\tvoid\t(*pfnKeySetBinding)( int keynum, const char *binding );\n\tint\t(*pfnKeyIsDown)( int keynum );\n\tint\t(*pfnKeyGetOverstrikeMode)( void );\n\tvoid\t(*pfnKeySetOverstrikeMode)( int fActive );\n\tvoid\t*(*pfnKeyGetState)( const char *name );\t\t\t// for mlook, klook etc\n\n\t// engine memory manager\n\tvoid*\t(*pfnMemAlloc)( size_t cb, const char *filename, const int fileline );\n\tvoid\t(*pfnMemFree)( void *mem, const char *filename, const int fileline );\n\n\t// collect info from engine\n\tint\t(*pfnGetGameInfo)( GAMEINFO *pgameinfo );\n\tGAMEINFO\t**(*pfnGetGamesList)( int *numGames );\t\t\t// collect info about all mods\n\tchar \t**(*pfnGetFilesList)( const char *pattern, int *numFiles, int gamedironly );\t// find in files\n\tint (*pfnGetSaveComment)( const char *savename, char *comment );\n\tint\t(*pfnGetDemoComment)( const char *demoname, char *comment );\n\tint\t(*pfnCheckGameDll)( void );\t\t\t\t// returns false if hl.dll is missed or invalid\n\tchar\t*(*pfnGetClipboardData)( void );\n\n\t// engine launcher\n\tvoid\t(*pfnShellExecute)( const char *name, const char *args, int closeEngine );\n\tvoid\t(*pfnWriteServerConfig)( const char *name );\n\tvoid\t(*pfnChangeInstance)( const char *newInstance, const char *szFinalMessage );\n\tvoid\t(*pfnPlayBackgroundTrack)( const char *introName, const char *loopName );\n\tvoid\t(*pfnHostEndGame)( const char *szFinalMessage );\n\n\t// menu interface is freezed at version 0.75\n\t// new functions starts here\n\tfloat\t(*pfnRandomFloat)( float flLow, float flHigh );\n\tint\t\t(*pfnRandomLong)( int lLow, int lHigh );\n\n\tvoid\t(*pfnSetCursor)( void *hCursor );\t\t\t// change cursor\n\tint\t(*pfnIsMapValid)( char *filename );\n\tvoid\t(*pfnProcessImage)( int texnum, float gamma, int topColor, int bottomColor );\n\tint\t(*pfnCompareFileTime)( const char *filename1, const char *filename2, int *iCompare );\n\n\tconst char *(*pfnGetModeString)( int vid_mode );\n\tint\t(*COM_SaveFile)( const char *filename, const void *data, int len );\n\tint\t(*COM_RemoveFile)( const char *filepath );\n} ui_enginefuncs_t;\n\ntypedef struct\n{\n\tint\t(*pfnVidInit)( void );\n\tvoid\t(*pfnInit)( void );\n\tvoid\t(*pfnShutdown)( void );\n\tvoid\t(*pfnRedraw)( float flTime );\n\tvoid\t(*pfnKeyEvent)( int key, int down );\n\tvoid\t(*pfnMouseMove)( int x, int y );\n\tvoid\t(*pfnSetActiveMenu)( int active );\n\tvoid\t(*pfnAddServerToList)( struct netadr_s adr, const char *info );\n\tvoid\t(*pfnGetCursorPos)( int *pos_x, int *pos_y );\n\tvoid\t(*pfnSetCursorPos)( int pos_x, int pos_y );\n\tvoid\t(*pfnShowCursor)( int show );\n\tvoid\t(*pfnCharEvent)( int key );\n\tint\t(*pfnMouseInRect)( void );\t// mouse entering\\leave game window\n\tint\t(*pfnIsVisible)( void );\n\tint\t(*pfnCreditsActive)( void );\t// unused\n\tvoid\t(*pfnFinalCredits)( void );\t// show credits + game end\n} UI_FUNCTIONS;\n\n#define MENU_EXTENDED_API_VERSION 1\n\ntypedef struct ui_extendedfuncs_s {\n\t// text functions, frozen\n\tvoid (*pfnEnableTextInput)( int enable );\n\tint (*pfnUtfProcessChar) ( int ch );\n\tint (*pfnUtfMoveLeft) ( char *str, int pos );\n\tint (*pfnUtfMoveRight) ( char *str, int pos, int length );\n\n\t// new engine extended api start here\n\t// returns 1 if there are more in list, otherwise 0\n\tint (*pfnGetRenderers)( unsigned int num, char *shortName, size_t size1, char *readableName, size_t size2 );\n\tdouble (*pfnDoubleTime)( void );\n\tchar *(*pfnParseFile)( char *data, char *buf, const int size, unsigned int flags, int *len );\n\n\t// network address funcs\n\tconst char *(*pfnAdrToString)( const struct netadr_s a );\n\tint (*pfnCompareAdr)( const void *a, const void *b ); // netadr_t\n} ui_extendedfuncs_t;\n\n// deprecated export from old engine\ntypedef void (*ADDTOUCHBUTTONTOLIST)( const char *name, const char *texture, const char *command, unsigned char *color, int flags );\n\ntypedef struct\n{\n\tADDTOUCHBUTTONTOLIST pfnAddTouchButtonToList;\n\tvoid (*pfnResetPing)( void );\n\tvoid (*pfnShowConnectionWarning)( void );\n\tvoid (*pfnShowUpdateDialog)( int preferStore );\n\tvoid (*pfnShowMessageBox)( const char *text );\n\tvoid (*pfnConnectionProgress_Disconnect)( void );\n\tvoid (*pfnConnectionProgress_Download)( const char *pszFileName, const char *pszServerName, int iCurrent, int iTotal, const char *comment );\n\tvoid (*pfnConnectionProgress_DownloadEnd)( void );\n\tvoid (*pfnConnectionProgress_Precache)( void );\n\tvoid (*pfnConnectionProgress_Connect)( const char *server ); // NULL for local server\n\tvoid (*pfnConnectionProgress_ChangeLevel)( void );\n\tvoid (*pfnConnectionProgress_ParseServerInfo)( const char *server );\n} UI_EXTENDED_FUNCTIONS;\n\ntypedef int (*MENUAPI)( UI_FUNCTIONS *pFunctionTable, ui_enginefuncs_t* engfuncs, ui_globalvars_t *pGlobals );\n\ntypedef int (*UIEXTENEDEDAPI)( int version, UI_EXTENDED_FUNCTIONS *pFunctionTable, ui_extendedfuncs_t *engfuncs );\n\n// deprecated interface from old engine\ntypedef int (*UITEXTAPI)( ui_extendedfuncs_t* engfuncs );\n\n#define PLATFORM_UPDATE_PAGE \"PlatformUpdatePage\"\n#define GENERIC_UPDATE_PAGE \"GenericUpdatePage\"\n\ntypedef void (*ADDTOUCHBUTTONTOLIST)( const char *name, const char *texture, const char *command, unsigned char *color, int flags );\n#endif//MENU_INT_H"
  },
  {
    "path": "engine/mobility_int.h",
    "content": "/*\nmobility_int.h - interface between engine and client for mobile platforms\nCopyright (C) 2015 a1batross\n\nThis program is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\nGNU General Public License for more details.\n*/\n\n#pragma once\n#ifndef MOBILITY_INT_H\n#define MOBILITY_INT_H\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n#define MOBILITY_API_VERSION 2\n#define MOBILITY_CLIENT_EXPORT \"HUD_MobilityInterface\"\n\n#define VIBRATE_NORMAL (1U << 0) // just vibrate for given \"life\"\n\n#define TOUCH_FL_HIDE\t\t\t(1U << 0)\n#define TOUCH_FL_NOEDIT\t\t\t(1U << 1)\n#define TOUCH_FL_CLIENT\t\t\t(1U << 2)\n#define TOUCH_FL_MP\t\t\t\t(1U << 3)\n#define TOUCH_FL_SP\t\t\t\t(1U << 4)\n#define TOUCH_FL_DEF_SHOW\t\t(1U << 5)\n#define TOUCH_FL_DEF_HIDE\t\t(1U << 6)\n#define TOUCH_FL_DRAW_ADDITIVE\t(1U << 7)\n#define TOUCH_FL_STROKE\t\t\t(1U << 8)\n#define TOUCH_FL_PRECISION\t\t(1U << 9)\n\ntypedef struct mobile_engfuncs_s\n{\n\t// indicates version of API. Should be equal to MOBILITY_API_VERSION\n\t// version changes when existing functions are changes\n\tint version;\n\n\t// vibration control\n\t// life -- time to vibrate in ms\n\tvoid (*pfnVibrate)( float life, char flags );\n\n\t// enable text input\n\tvoid (*pfnEnableTextInput)( int enable );\n\n\t// add temporaty button, edit will be disabled\n\tvoid (*pfnTouchAddClientButton)( const char *name, const char *texture, const char *command, float x1, float y1, float x2, float y2, unsigned char *color, int round, float aspect, int flags );\n\n\t// add button to defaults list. Will be loaded on config generation\n\tvoid (*pfnTouchAddDefaultButton)( const char *name, const char *texturefile, const char *command, float x1, float y1, float x2, float y2, unsigned char *color, int round, float aspect, int flags );\n\n\t// hide/show buttons by pattern\n\tvoid (*pfnTouchHideButtons)( const char *name, unsigned char hide );\n\n\t// remove button with given name\n\tvoid (*pfnTouchRemoveButton)( const char *name );\n\n\t// when enabled, only client buttons shown\n\tvoid (*pfnTouchSetClientOnly)( unsigned char state );\n\n\t// Clean defaults list\n\tvoid (*pfnTouchResetDefaultButtons)();\n\n\t// Draw scaled font for client\n\tint (*pfnDrawScaledCharacter)( int x, int y, int number, int r, int g, int b, float scale );\n\n\t// To be continued...\n} mobile_engfuncs_t;\n\n// function exported from client\n// returns 0 on no error otherwise error\ntypedef int (*pfnMobilityInterface)( mobile_engfuncs_t *gMobileEngfuncs );\n\n#ifdef __cplusplus\n}\n#endif\n#endif\n"
  },
  {
    "path": "engine/progdefs.h",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\t\n*\tThis product contains software technology licensed from Id \n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc. \n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n#ifndef PROGDEFS_H\n#define PROGDEFS_H\n#ifdef _WIN32\n#ifndef __MINGW32__\n#pragma once\n#endif /* not __MINGW32__ */\n#endif\n\ntypedef struct\n{\t\n\tfloat\t\ttime;\n\tfloat\t\tframetime;\n\tfloat\t\tforce_retouch;\n\tstring_t\tmapname;\n\tstring_t\tstartspot;\n\tfloat\t\tdeathmatch;\n\tfloat\t\tcoop;\n\tfloat\t\tteamplay;\n\tfloat\t\tserverflags;\n\tfloat\t\tfound_secrets;\n\tvec3_t\t\tv_forward;\n\tvec3_t\t\tv_up;\n\tvec3_t\t\tv_right;\n\tfloat\t\ttrace_allsolid;\n\tfloat\t\ttrace_startsolid;\n\tfloat\t\ttrace_fraction;\n\tvec3_t\t\ttrace_endpos;\n\tvec3_t\t\ttrace_plane_normal;\n\tfloat\t\ttrace_plane_dist;\n\tedict_t\t\t*trace_ent;\n\tfloat\t\ttrace_inopen;\n\tfloat\t\ttrace_inwater;\n\tint\t\t\ttrace_hitgroup;\n\tint\t\t\ttrace_flags;\n\tint\t\t\tmsg_entity;\n\tint\t\t\tcdAudioTrack;\n\tint\t\t\tmaxClients;\n\tint\t\t\tmaxEntities;\n\tconst char\t*pStringBase;\n\n\tvoid\t\t*pSaveData;\n\tvec3_t\t\tvecLandmarkOffset;\n} globalvars_t;\n\n\ntypedef struct entvars_s\n{\n\tstring_t\tclassname;\n\tstring_t\tglobalname;\n\n\tvec3_t\t\torigin;\n\tvec3_t\t\toldorigin;\n\tvec3_t\t\tvelocity;\n\tvec3_t\t\tbasevelocity;\n\tvec3_t      clbasevelocity;  // Base velocity that was passed in to server physics so \n\t\t\t\t\t\t\t     //  client can predict conveyors correctly.  Server zeroes it, so we need to store here, too.\n\tvec3_t\t\tmovedir;\n\n\tvec3_t\t\tangles;\t\t\t// Model angles\n\tvec3_t\t\tavelocity;\t\t// angle velocity (degrees per second)\n\tvec3_t\t\tpunchangle;\t\t// auto-decaying view angle adjustment\n\tvec3_t\t\tv_angle;\t\t// Viewing angle (player only)\n\n\t// For parametric entities\n\tvec3_t\t\tendpos;\n\tvec3_t\t\tstartpos;\n\tfloat\t\timpacttime;\n\tfloat\t\tstarttime;\n\n\tint\t\t\tfixangle;\t\t// 0:nothing, 1:force view angles, 2:add avelocity\n\tfloat\t\tidealpitch;\n\tfloat\t\tpitch_speed;\n\tfloat\t\tideal_yaw;\n\tfloat\t\tyaw_speed;\n\n\tint\t\t\tmodelindex;\n\tstring_t\tmodel;\n\n\tint\t\t\tviewmodel;\t\t// player's viewmodel\n\tint\t\t\tweaponmodel;\t// what other players see\n\t\n\tvec3_t\t\tabsmin;\t\t// BB max translated to world coord\n\tvec3_t\t\tabsmax;\t\t// BB max translated to world coord\n\tvec3_t\t\tmins;\t\t// local BB min\n\tvec3_t\t\tmaxs;\t\t// local BB max\n\tvec3_t\t\tsize;\t\t// maxs - mins\n\n\tfloat\t\tltime;\n\tfloat\t\tnextthink;\n\n\tint\t\t\tmovetype;\n\tint\t\t\tsolid;\n\n\tint\t\t\tskin;\t\t\t\n\tint\t\t\tbody;\t\t\t// sub-model selection for studiomodels\n\tint \t\teffects;\n\t\n\tfloat\t\tgravity;\t\t// % of \"normal\" gravity\n\tfloat\t\tfriction;\t\t// inverse elasticity of MOVETYPE_BOUNCE\n\t\n\tint\t\t\tlight_level;\n\n\tint\t\t\tsequence;\t\t// animation sequence\n\tint\t\t\tgaitsequence;\t// movement animation sequence for player (0 for none)\n\tfloat\t\tframe;\t\t\t// % playback position in animation sequences (0..255)\n\tfloat\t\tanimtime;\t\t// world time when frame was set\n\tfloat\t\tframerate;\t\t// animation playback rate (-8x to 8x)\n\tbyte\t\tcontroller[4];\t// bone controller setting (0..255)\n\tbyte\t\tblending[2];\t// blending amount between sub-sequences (0..255)\n\n\tfloat\t\tscale;\t\t\t// sprite rendering scale (0..255)\n\n\tint\t\t\trendermode;\n\tfloat\t\trenderamt;\n\tvec3_t\t\trendercolor;\n\tint\t\t\trenderfx;\n\n\tfloat\t\thealth;\n\tfloat\t\tfrags;\n\tint\t\t\tweapons;  // bit mask for available weapons\n\tfloat\t\ttakedamage;\n\n\tint\t\t\tdeadflag;\n\tvec3_t\t\tview_ofs;\t// eye position\n\n\tint\t\t\tbutton;\n\tint\t\t\timpulse;\n\n\tedict_t\t\t*chain;\t\t\t// Entity pointer when linked into a linked list\n\tedict_t\t\t*dmg_inflictor;\n\tedict_t\t\t*enemy;\n\tedict_t\t\t*aiment;\t\t// entity pointer when MOVETYPE_FOLLOW\n\tedict_t\t\t*owner;\n\tedict_t\t\t*groundentity;\n\n\tint\t\t\tspawnflags;\n\tint\t\t\tflags;\n\t\n\tint\t\t\tcolormap;\t\t// lowbyte topcolor, highbyte bottomcolor\n\tint\t\t\tteam;\n\n\tfloat\t\tmax_health;\n\tfloat\t\tteleport_time;\n\tfloat\t\tarmortype;\n\tfloat\t\tarmorvalue;\n\tint\t\t\twaterlevel;\n\tint\t\t\twatertype;\n\t\n\tstring_t\ttarget;\n\tstring_t\ttargetname;\n\tstring_t\tnetname;\n\tstring_t\tmessage;\n\n\tfloat\t\tdmg_take;\n\tfloat\t\tdmg_save;\n\tfloat\t\tdmg;\n\tfloat\t\tdmgtime;\n\t\n\tstring_t\tnoise;\n\tstring_t\tnoise1;\n\tstring_t\tnoise2;\n\tstring_t\tnoise3;\n\t\n\tfloat\t\tspeed;\n\tfloat\t\tair_finished;\n\tfloat\t\tpain_finished;\n\tfloat\t\tradsuit_finished;\n\t\n\tedict_t\t\t*pContainingEntity;\n\n\tint\t\t\tplayerclass;\n\tfloat\t\tmaxspeed;\n\n\tfloat\t\tfov;\n\tint\t\t\tweaponanim;\n\n\tint\t\t\tpushmsec;\n\n\tint\t\t\tbInDuck;\n\tint\t\t\tflTimeStepSound;\n\tint\t\t\tflSwimTime;\n\tint\t\t\tflDuckTime;\n\tint\t\t\tiStepLeft;\n\tfloat\t\tflFallVelocity;\n\n\tint\t\t\tgamestate;\n\n\tint\t\t\toldbuttons;\n\n\tint\t\t\tgroupinfo;\n\n\t// For mods\n\tint\t\t\tiuser1;\n\tint\t\t\tiuser2;\n\tint\t\t\tiuser3;\n\tint\t\t\tiuser4;\n\tfloat\t\tfuser1;\n\tfloat\t\tfuser2;\n\tfloat\t\tfuser3;\n\tfloat\t\tfuser4;\n\tvec3_t\t\tvuser1;\n\tvec3_t\t\tvuser2;\n\tvec3_t\t\tvuser3;\n\tvec3_t\t\tvuser4;\n\tedict_t\t\t*euser1;\n\tedict_t\t\t*euser2;\n\tedict_t\t\t*euser3;\n\tedict_t\t\t*euser4;\n} entvars_t;\n\n\n#endif // PROGDEFS_H\n"
  },
  {
    "path": "engine/progs.h",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\t\n*\tThis product contains software technology licensed from Id \n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc. \n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n#ifndef PROGS_H\n#define PROGS_H\n\n#include \"progdefs.h\"\n\n// 16 simultaneous events, max\n#define MAX_EVENT_QUEUE 64\n\n#define DEFAULT_EVENT_RESENDS 1\n\n#include \"event_flags.h\"\n\ntypedef struct event_info_s event_info_t;\n\n#include \"event_args.h\"\n\nstruct event_info_s\n{\n\tunsigned short index;\t\t\t  // 0 implies not in use\n\n\tshort packet_index;      // Use data from state info for entity in delta_packet .  -1 implies separate info based on event\n\t                         // parameter signature\n\tshort entity_index;      // The edict this event is associated with\n\n\tfloat fire_time;        // if non-zero, the time when the event should be fired ( fixed up on the client )\n\t\n\tevent_args_t args;\n\n// CLIENT ONLY\t\n\tint\t  flags;\t\t\t// Reliable or not, etc.\n\n};\n\ntypedef struct event_state_s event_state_t;\n\nstruct event_state_s\n{\n\tstruct event_info_s ei[ MAX_EVENT_QUEUE ];\n};\n\n#if !defined( ENTITY_STATEH )\n#include \"entity_state.h\"\n#endif\n\n#if !defined( EDICT_H )\n#include \"edict.h\"\n#endif\n\n#define\tSTRUCT_FROM_LINK(l,t,m) ((t *)((byte *)l - (int)&(((t *)0)->m)))\n#define\tEDICT_FROM_AREA(l) STRUCT_FROM_LINK(l,edict_t,area)\n\n//============================================================================\n\nextern\tchar\t\t\t*pr_strings;\nextern\tglobalvars_t\tgGlobalVariables;\n\n//============================================================================\n\nedict_t\t\t*ED_Alloc (void);\nvoid\t\tED_Free (edict_t *ed);\nvoid\t\tED_LoadFromFile (char *data);\n\nedict_t\t\t*EDICT_NUM(int n);\nint\t\t\tNUM_FOR_EDICT(const edict_t *e);\n\n#define PROG_TO_EDICT(e) ((edict_t *)((byte *)sv.edicts + e))\n\n#endif // PROGS_H\n"
  },
  {
    "path": "engine/shake.h",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\t\n*\tThis product contains software technology licensed from Id \n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc. \n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n#ifndef SHAKE_H\n#define SHAKE_H\n\n// Screen / View effects\n\n// screen shake\nextern int gmsgShake;\n\n// This structure is sent over the net to describe a screen shake event\ntypedef struct\n{\n\tunsigned short\tamplitude;\t\t// FIXED 4.12 amount of shake\n\tunsigned short \tduration;\t\t// FIXED 4.12 seconds duration\n\tunsigned short\tfrequency;\t\t// FIXED 8.8 noise frequency (low frequency is a jerk,high frequency is a rumble)\n} ScreenShake;\n\nextern void V_ApplyShake( float *origin, float *angles, float factor );\nextern void V_CalcShake( void );\nextern int V_ScreenShake( const char *pszName, int iSize, void *pbuf );\nextern int V_ScreenFade( const char *pszName, int iSize, void *pbuf );\n\n\n// Fade in/out\nextern int gmsgFade;\n\n#define FFADE_IN\t\t\t0x0000\t\t// Just here so we don't pass 0 into the function\n#define FFADE_OUT\t\t\t0x0001\t\t// Fade out (not in)\n#define FFADE_MODULATE\t\t0x0002\t\t// Modulate (don't blend)\n#define FFADE_STAYOUT\t\t0x0004\t\t// ignores the duration, stays faded out until new ScreenFade message received\n\n// This structure is sent over the net to describe a screen fade event\ntypedef struct\n{\n\tunsigned short \tduration;\t\t// FIXED 4.12 seconds duration\n\tunsigned short \tholdTime;\t\t// FIXED 4.12 seconds duration until reset (fade & hold)\n\tshort\t\t\tfadeFlags;\t\t// flags\n\tbyte\t\t\tr, g, b, a;\t\t// fade to color ( max alpha )\n} ScreenFade;\n\n#endif\t\t// SHAKE_H\n\n"
  },
  {
    "path": "engine/studio.h",
    "content": "/***\n*\n*\tCopyright (c) 1996-2002, Valve LLC. All rights reserved.\n*\t\n*\tThis product contains software technology licensed from Id \n*\tSoftware, Inc. (\"Id Technology\").  Id Technology (c) 1996 Id Software, Inc. \n*\tAll Rights Reserved.\n*\n*   Use, distribution, and modification of this source code and/or resulting\n*   object code is restricted to non-commercial enhancements to products from\n*   Valve LLC.  All other use, distribution, or modification is prohibited\n*   without written permission from Valve LLC.\n*\n****/\n\n\n\n\n#ifndef _STUDIO_H_\n#define _STUDIO_H_\n\n/*\n==============================================================================\n\nSTUDIO MODELS\n\nStudio models are position independent, so the cache manager can move them.\n==============================================================================\n*/\n\n\n#define MAXSTUDIOTRIANGLES\t20000\t// TODO: tune this\n#define MAXSTUDIOVERTS\t\t2048\t// TODO: tune this\n#define MAXSTUDIOSEQUENCES\t256\t\t// total animation sequences\n#define MAXSTUDIOSKINS\t\t100\t\t// total textures\n#define MAXSTUDIOSRCBONES\t512\t\t// bones allowed at source movement\n#define MAXSTUDIOBONES\t\t128\t\t// total bones actually used\n#define MAXSTUDIOMODELS\t\t32\t\t// sub-models per model\n#define MAXSTUDIOBODYPARTS\t32\n#define MAXSTUDIOGROUPS\t\t16\n#define MAXSTUDIOANIMATIONS\t512\t\t// per sequence\n#define MAXSTUDIOMESHES\t\t256\n#define MAXSTUDIOEVENTS\t\t1024\n#define MAXSTUDIOPIVOTS\t\t256\n#define MAXSTUDIOCONTROLLERS 8\n\ntypedef struct \n{\n\tint\t\t\t\t\tid;\n\tint\t\t\t\t\tversion;\n\n\tchar\t\t\t\tname[64];\n\tint\t\t\t\t\tlength;\n\n\tvec3_t\t\t\t\teyeposition;\t// ideal eye position\n\tvec3_t\t\t\t\tmin;\t\t\t// ideal movement hull size\n\tvec3_t\t\t\t\tmax;\t\t\t\n\n\tvec3_t\t\t\t\tbbmin;\t\t\t// clipping bounding box\n\tvec3_t\t\t\t\tbbmax;\t\t\n\n\tint\t\t\t\t\tflags;\n\n\tint\t\t\t\t\tnumbones;\t\t\t// bones\n\tint\t\t\t\t\tboneindex;\n\n\tint\t\t\t\t\tnumbonecontrollers;\t\t// bone controllers\n\tint\t\t\t\t\tbonecontrollerindex;\n\n\tint\t\t\t\t\tnumhitboxes;\t\t\t// complex bounding boxes\n\tint\t\t\t\t\thitboxindex;\t\t\t\n\t\n\tint\t\t\t\t\tnumseq;\t\t\t\t// animation sequences\n\tint\t\t\t\t\tseqindex;\n\n\tint\t\t\t\t\tnumseqgroups;\t\t// demand loaded sequences\n\tint\t\t\t\t\tseqgroupindex;\n\n\tint\t\t\t\t\tnumtextures;\t\t// raw textures\n\tint\t\t\t\t\ttextureindex;\n\tint\t\t\t\t\ttexturedataindex;\n\n\tint\t\t\t\t\tnumskinref;\t\t\t// replaceable textures\n\tint\t\t\t\t\tnumskinfamilies;\n\tint\t\t\t\t\tskinindex;\n\n\tint\t\t\t\t\tnumbodyparts;\t\t\n\tint\t\t\t\t\tbodypartindex;\n\n\tint\t\t\t\t\tnumattachments;\t\t// queryable attachable points\n\tint\t\t\t\t\tattachmentindex;\n\n\tint\t\t\t\t\tsoundtable;\n\tint\t\t\t\t\tsoundindex;\n\tint\t\t\t\t\tsoundgroups;\n\tint\t\t\t\t\tsoundgroupindex;\n\n\tint\t\t\t\t\tnumtransitions;\t\t// animation node to animation node transition graph\n\tint\t\t\t\t\ttransitionindex;\n} studiohdr_t;\n\n// header for demand loaded sequence group data\ntypedef struct \n{\n\tint\t\t\t\t\tid;\n\tint\t\t\t\t\tversion;\n\n\tchar\t\t\t\tname[64];\n\tint\t\t\t\t\tlength;\n} studioseqhdr_t;\n\n// bones\ntypedef struct \n{\n\tchar\t\t\t\tname[32];\t// bone name for symbolic links\n\tint\t\t \t\t\tparent;\t\t// parent bone\n\tint\t\t\t\t\tflags;\t\t// ??\n\tint\t\t\t\t\tbonecontroller[6];\t// bone controller index, -1 == none\n\tfloat\t\t\t\tvalue[6];\t// default DoF values\n\tfloat\t\t\t\tscale[6];   // scale for delta DoF values\n} mstudiobone_t;\n\n\n// bone controllers\ntypedef struct \n{\n\tint\t\t\t\t\tbone;\t// -1 == 0\n\tint\t\t\t\t\ttype;\t// X, Y, Z, XR, YR, ZR, M\n\tfloat\t\t\t\tstart;\n\tfloat\t\t\t\tend;\n\tint\t\t\t\t\trest;\t// byte index value at rest\n\tint\t\t\t\t\tindex;\t// 0-3 user set controller, 4 mouth\n} mstudiobonecontroller_t;\n\n// intersection boxes\ntypedef struct\n{\n\tint\t\t\t\t\tbone;\n\tint\t\t\t\t\tgroup;\t\t\t// intersection group\n\tvec3_t\t\t\t\tbbmin;\t\t// bounding box\n\tvec3_t\t\t\t\tbbmax;\t\t\n} mstudiobbox_t;\n\n#if !defined( CACHE_USER ) && !defined( QUAKEDEF_H )\n#define CACHE_USER\ntypedef struct cache_user_s\n{\n\tvoid *data;\n} cache_user_t;\n#endif\n\n// demand loaded sequence groups\ntypedef struct\n{\n\tchar\t\t\t\tlabel[32];\t// textual name\n\tchar\t\t\t\tname[64];\t// file name\n\tuint32_t\t\t\tunused1;\t// was \"cache\"  - index pointer\n\tuint32_t\t\t\tunused2;\t// was \"data\" -  hack for group 0\n} mstudioseqgroup_t;\n\n// sequence descriptions\ntypedef struct\n{\n\tchar\t\t\t\tlabel[32];\t// sequence label\n\n\tfloat\t\t\t\tfps;\t\t// frames per second\t\n\tint\t\t\t\t\tflags;\t\t// looping/non-looping flags\n\n\tint\t\t\t\t\tactivity;\n\tint\t\t\t\t\tactweight;\n\n\tint\t\t\t\t\tnumevents;\n\tint\t\t\t\t\teventindex;\n\n\tint\t\t\t\t\tnumframes;\t// number of frames per sequence\n\n\tint\t\t\t\t\tnumpivots;\t// number of foot pivots\n\tint\t\t\t\t\tpivotindex;\n\n\tint\t\t\t\t\tmotiontype;\t\n\tint\t\t\t\t\tmotionbone;\n\tvec3_t\t\t\t\tlinearmovement;\n\tint\t\t\t\t\tautomoveposindex;\n\tint\t\t\t\t\tautomoveangleindex;\n\n\tvec3_t\t\t\t\tbbmin;\t\t// per sequence bounding box\n\tvec3_t\t\t\t\tbbmax;\t\t\n\n\tint\t\t\t\t\tnumblends;\n\tint\t\t\t\t\tanimindex;\t\t// mstudioanim_t pointer relative to start of sequence group data\n\t\t\t\t\t\t\t\t\t\t// [blend][bone][X, Y, Z, XR, YR, ZR]\n\n\tint\t\t\t\t\tblendtype[2];\t// X, Y, Z, XR, YR, ZR\n\tfloat\t\t\t\tblendstart[2];\t// starting value\n\tfloat\t\t\t\tblendend[2];\t// ending value\n\tint\t\t\t\t\tblendparent;\n\n\tint\t\t\t\t\tseqgroup;\t\t// sequence group for demand loading\n\n\tint\t\t\t\t\tentrynode;\t\t// transition node at entry\n\tint\t\t\t\t\texitnode;\t\t// transition node at exit\n\tint\t\t\t\t\tnodeflags;\t\t// transition rules\n\t\n\tint\t\t\t\t\tnextseq;\t\t// auto advancing sequences\n} mstudioseqdesc_t;\n\n// events\n#include \"studio_event.h\"\n/*\ntypedef struct \n{\n\tint \t\t\t\tframe;\n\tint\t\t\t\t\tevent;\n\tint\t\t\t\t\ttype;\n\tchar\t\t\t\toptions[64];\n} mstudioevent_t;\n*/\n\n// pivots\ntypedef struct \n{\n\tvec3_t\t\t\t\torg;\t// pivot point\n\tint\t\t\t\t\tstart;\n\tint\t\t\t\t\tend;\n} mstudiopivot_t;\n\n// attachment\ntypedef struct \n{\n\tchar\t\t\t\tname[32];\n\tint\t\t\t\t\ttype;\n\tint\t\t\t\t\tbone;\n\tvec3_t\t\t\t\torg;\t// attachment point\n\tvec3_t\t\t\t\tvectors[3];\n} mstudioattachment_t;\n\ntypedef struct\n{\n\tunsigned short\toffset[6];\n} mstudioanim_t;\n\n// animation frames\ntypedef union \n{\n\tstruct {\n\t\tbyte\tvalid;\n\t\tbyte\ttotal;\n\t} num;\n\tshort\t\tvalue;\n} mstudioanimvalue_t;\n\n\n\n// body part index\ntypedef struct\n{\n\tchar\t\t\t\tname[64];\n\tint\t\t\t\t\tnummodels;\n\tint\t\t\t\t\tbase;\n\tint\t\t\t\t\tmodelindex; // index into models array\n} mstudiobodyparts_t;\n\n\n\n// skin info\ntypedef struct\n{\n\tchar\t\t\t\t\tname[64];\n\tint\t\t\t\t\t\tflags;\n\tint\t\t\t\t\t\twidth;\n\tint\t\t\t\t\t\theight;\n\tint\t\t\t\t\t\tindex;\n} mstudiotexture_t;\n\n\n// skin families\n// short\tindex[skinfamilies][skinref]\n\n// studio models\ntypedef struct\n{\n\tchar\t\t\t\tname[64];\n\n\tint\t\t\t\t\ttype;\n\n\tfloat\t\t\t\tboundingradius;\n\n\tint\t\t\t\t\tnummesh;\n\tint\t\t\t\t\tmeshindex;\n\n\tint\t\t\t\t\tnumverts;\t\t// number of unique vertices\n\tint\t\t\t\t\tvertinfoindex;\t// vertex bone info\n\tint\t\t\t\t\tvertindex;\t\t// vertex vec3_t\n\tint\t\t\t\t\tnumnorms;\t\t// number of unique surface normals\n\tint\t\t\t\t\tnorminfoindex;\t// normal bone info\n\tint\t\t\t\t\tnormindex;\t\t// normal vec3_t\n\n\tint\t\t\t\t\tnumgroups;\t\t// deformation groups\n\tint\t\t\t\t\tgroupindex;\n} mstudiomodel_t;\n\n\n// vec3_t\tboundingbox[model][bone][2];\t// complex intersection info\n\n\n// meshes\ntypedef struct \n{\n\tint\t\t\t\t\tnumtris;\n\tint\t\t\t\t\ttriindex;\n\tint\t\t\t\t\tskinref;\n\tint\t\t\t\t\tnumnorms;\t\t// per mesh normals\n\tint\t\t\t\t\tnormindex;\t\t// normal vec3_t\n} mstudiomesh_t;\n\n// triangles\n#if 0\ntypedef struct \n{\n\tshort\t\t\t\tvertindex;\t\t// index into vertex array\n\tshort\t\t\t\tnormindex;\t\t// index into normal array\n\tshort\t\t\t\ts,t;\t\t\t// s,t position on skin\n} mstudiotrivert_t;\n#endif\n\n// lighting options\n#define STUDIO_NF_FLATSHADE\t\t0x0001\n#define STUDIO_NF_CHROME\t\t0x0002\n#define STUDIO_NF_FULLBRIGHT\t0x0004\n\n// motion flags\n#define STUDIO_X\t\t0x0001\n#define STUDIO_Y\t\t0x0002\t\n#define STUDIO_Z\t\t0x0004\n#define STUDIO_XR\t\t0x0008\n#define STUDIO_YR\t\t0x0010\n#define STUDIO_ZR\t\t0x0020\n#define STUDIO_LX\t\t0x0040\n#define STUDIO_LY\t\t0x0080\n#define STUDIO_LZ\t\t0x0100\n#define STUDIO_AX\t\t0x0200\n#define STUDIO_AY\t\t0x0400\n#define STUDIO_AZ\t\t0x0800\n#define STUDIO_AXR\t\t0x1000\n#define STUDIO_AYR\t\t0x2000\n#define STUDIO_AZR\t\t0x4000\n#define STUDIO_TYPES\t0x7FFF\n#define STUDIO_RLOOP\t0x8000\t// controller that wraps shortest distance\n\n// sequence flags\n#define STUDIO_LOOPING\t0x0001\n\n// bone flags\n#define STUDIO_HAS_NORMALS\t0x0001\n#define STUDIO_HAS_VERTICES 0x0002\n#define STUDIO_HAS_BBOX\t\t0x0004\n#define STUDIO_HAS_CHROME\t0x0008\t// if any of the textures have chrome on them\n\n#define RAD_TO_STUDIO\t\t(32768.0/M_PI)\n#define STUDIO_TO_RAD\t\t(M_PI/32768.0)\n\n#endif\n"
  },
  {
    "path": "game_shared/bitvec.h",
    "content": "//========= Copyright (c) 1996-2002, Valve LLC, All rights reserved. ============\n//\n// Purpose: \n//\n// $NoKeywords: $\n//=============================================================================\n#if !defined(BITVEC_H)\n#define BITVEC_H\n\n#include <assert.h>\n#include <string.h>\n\nclass CBitVecAccessor\n{\npublic:\n\tCBitVecAccessor( unsigned long *pDWords, int iBit );\n\n\tvoid operator=( int val );\n\toperator unsigned long();\n\nprivate:\n\tunsigned long *m_pDWords;\n\tint m_iBit;\n};\n\n// CBitVec allows you to store a list of bits and do operations on them like they were \n// an atomic type.\ntemplate<int NUM_BITS>\nclass CBitVec\n{\npublic:\n\tCBitVec();\n\n\t// Set all values to the specified value (0 or 1..)\n\tvoid Init( int val = 0 );\n\n\t// Access the bits like an array.\n\tCBitVecAccessor\toperator[]( int i );\n\n\t// Operations on other bit vectors.\n\tCBitVec& operator=( CBitVec<NUM_BITS> const &other );\n\tbool operator==( CBitVec<NUM_BITS> const &other );\n\tbool operator!=( CBitVec<NUM_BITS> const &other );\n\n\t// Get underlying dword representations of the bits.\n\tint GetNumDWords();\n\tunsigned long GetDWord( int i );\n\tvoid SetDWord( int i, unsigned long val );\n\n\tint GetNumBits();\n\nprivate:\n\tenum\n\t{\n\t\tNUM_DWORDS = NUM_BITS / 32 + !!( NUM_BITS & 31 )\n\t};\n\tunsigned long m_DWords[NUM_DWORDS];\n};\n\n// ------------------------------------------------------------------------ //\n// CBitVecAccessor inlines.\n// ------------------------------------------------------------------------ //\ninline CBitVecAccessor::CBitVecAccessor(unsigned long *pDWords, int iBit)\n{\n\tm_pDWords = pDWords;\n\tm_iBit = iBit;\n}\n\ninline void CBitVecAccessor::operator=( int val )\n{\n\tif( val )\n\t\tm_pDWords[m_iBit >> 5] |= ( 1 << ( m_iBit & 31 ) );\n\telse\n\t\tm_pDWords[m_iBit >> 5] &= ~(unsigned long)( 1 << ( m_iBit & 31 ) );\n}\n\ninline CBitVecAccessor::operator unsigned long()\n{\n\treturn m_pDWords[m_iBit >> 5] & ( 1 << ( m_iBit & 31 ) );\n}\n\n// ------------------------------------------------------------------------ //\n// CBitVec inlines.\n// ------------------------------------------------------------------------ //\ntemplate<int NUM_BITS>\ninline int CBitVec<NUM_BITS>::GetNumBits()\n{\n\treturn NUM_BITS;\n}\n\ntemplate<int NUM_BITS>\ninline CBitVec<NUM_BITS>::CBitVec()\n{\n\tfor( int i = 0; i < NUM_DWORDS; i++ )\n\t\tm_DWords[i] = 0;\n}\n\ntemplate<int NUM_BITS>\ninline void CBitVec<NUM_BITS>::Init( int val )\n{\n\tfor( int i = 0; i < GetNumBits(); i++ )\n\t{\n\t\t( *this )[i] = val;\n\t}\n}\n\ntemplate<int NUM_BITS>\ninline CBitVec<NUM_BITS>& CBitVec<NUM_BITS>::operator=( CBitVec<NUM_BITS> const &other )\n{\n\tmemcpy( m_DWords, other.m_DWords, sizeof(m_DWords) );\n\treturn *this;\n}\n\ntemplate<int NUM_BITS>\ninline CBitVecAccessor CBitVec<NUM_BITS>::operator[]( int i )\t\n{\n\tassert( i >= 0 && i < GetNumBits() );\n\treturn CBitVecAccessor( m_DWords, i );\n}\n\ntemplate<int NUM_BITS>\ninline bool CBitVec<NUM_BITS>::operator==( CBitVec<NUM_BITS> const &other )\n{\n\tfor( int i = 0; i < NUM_DWORDS; i++ )\n\t\tif( m_DWords[i] != other.m_DWords[i] )\n\t\t\treturn false;\n\n\treturn true;\n}\n\ntemplate<int NUM_BITS>\ninline bool CBitVec<NUM_BITS>::operator!=( CBitVec<NUM_BITS> const &other )\n{\n\treturn !( *this == other );\n}\n\ntemplate<int NUM_BITS>\ninline int CBitVec<NUM_BITS>::GetNumDWords()\n{\n\treturn NUM_DWORDS;\n}\n\ntemplate<int NUM_BITS>\ninline unsigned long CBitVec<NUM_BITS>::GetDWord( int i )\n{\n\tassert( i >= 0 && i < NUM_DWORDS );\n\treturn m_DWords[i];\n}\n\ntemplate<int NUM_BITS>\ninline void CBitVec<NUM_BITS>::SetDWord( int i, unsigned long val )\n{\n\tassert( i >= 0 && i < NUM_DWORDS );\n\tm_DWords[i] = val;\n}\n#endif // BITVEC_H\n"
  },
  {
    "path": "game_shared/voice_banmgr.cpp",
    "content": "//========= Copyright (c) 1996-2002, Valve LLC, All rights reserved. ============\n//\n// Purpose: \n//\n// $NoKeywords: $\n//=============================================================================\n\n#include <string.h>\n#include <stdio.h>\n#include \"voice_banmgr.h\"\n\n#define BANMGR_FILEVERSION\t1\nchar const *g_pBanMgrFilename = \"voice_ban.dt\";\n\n// Hash a player ID to a byte.\nunsigned char HashPlayerID( char const playerID[16] )\n{\n\tunsigned char curHash = 0;\n\n\tfor( int i = 0; i < 16; i++ )\n\t\tcurHash += (unsigned char)playerID[i];\n\n\treturn curHash;\n}\n\nCVoiceBanMgr::CVoiceBanMgr()\n{\n\tClear();\n}\n\nCVoiceBanMgr::~CVoiceBanMgr()\n{\n\tTerm();\n}\n\nbool CVoiceBanMgr::Init( char const *pGameDir )\n{\n\tTerm();\n\n\tchar filename[512];\n\tsprintf( filename, \"%s/%s\", pGameDir, g_pBanMgrFilename );\n\n\t// Load in the squelch file.\n\tFILE *fp = fopen( filename, \"rb\" );\n\tif( fp )\n\t{\n\t\tint version;\n\t\tfread( &version, 1, sizeof(version), fp );\n\t\tif( version == BANMGR_FILEVERSION )\n\t\t{\n\t\t\tfseek( fp, 0, SEEK_END );\n\t\t\tint nIDs = ( ftell( fp ) - sizeof(version) ) / 16;\n\t\t\tfseek( fp, sizeof(version), SEEK_SET );\n\n\t\t\tfor( int i = 0; i < nIDs; i++ )\n\t\t\t{\n\t\t\t\tchar playerID[16];\n\n\t\t\t\tfread( playerID, 1, 16, fp );\n\t\t\t\tAddBannedPlayer( playerID );\n\t\t\t}\n\t\t}\n\n\t\tfclose( fp );\n\t}\n\n\treturn true;\n}\n\nvoid CVoiceBanMgr::Term()\n{\n\t// Free all the player structures.\n\tfor( int i = 0; i < 256; i++ )\n\t{\n\t\tBannedPlayer *pListHead = &m_PlayerHash[i];\n\t\tBannedPlayer *pNext;\n\n\t\tfor( BannedPlayer *pCur=pListHead->m_pNext; pCur != pListHead; pCur = pNext )\n\t\t{\n\t\t\tpNext = pCur->m_pNext;\n\t\t\tdelete pCur;\n\t\t}\n\t}\n\n\tClear();\n}\n\nvoid CVoiceBanMgr::SaveState(char const *pGameDir)\n{\n\t// Save the file out.\n\tchar filename[512];\n\n\tsprintf( filename, \"%s/%s\", pGameDir, g_pBanMgrFilename );\n\n\tFILE *fp = fopen( filename, \"wb\" );\n\tif( fp )\n\t{\n\t\tint version = BANMGR_FILEVERSION;\n\t\tfwrite( &version, 1, sizeof(version), fp );\n\n\t\tfor( int i = 0; i < 256; i++ )\n\t\t{\n\t\t\tBannedPlayer *pListHead = &m_PlayerHash[i];\n\t\t\tfor( BannedPlayer *pCur = pListHead->m_pNext; pCur != pListHead; pCur = pCur->m_pNext )\n\t\t\t{\n\t\t\t\tfwrite( pCur->m_PlayerID, 1, 16, fp );\n\t\t\t}\n\t\t}\n\n\t\tfclose( fp );\n\t}\n}\n\nbool CVoiceBanMgr::GetPlayerBan( char const playerID[16] )\n{\n\treturn !!InternalFindPlayerSquelch( playerID );\n}\n\nvoid CVoiceBanMgr::SetPlayerBan( char const playerID[16], bool bSquelch )\n{\n\tif( bSquelch )\n\t{\n\t\t// Is this guy already squelched?\n\t\tif( GetPlayerBan( playerID ) )\n\t\t\treturn;\n\n\t\tAddBannedPlayer( playerID );\n\t}\n\telse\n\t{\n\t\tBannedPlayer *pPlayer = InternalFindPlayerSquelch( playerID );\n\t\tif( pPlayer )\n\t\t{\n\t\t\tpPlayer->m_pPrev->m_pNext = pPlayer->m_pNext;\n\t\t\tpPlayer->m_pNext->m_pPrev = pPlayer->m_pPrev;\n\t\t\tdelete pPlayer;\n\t\t}\n\t}\n}\n\nvoid CVoiceBanMgr::ForEachBannedPlayer(void (*callback)( char id[16] ) )\n{\n\tfor( int i = 0; i < 256; i++ )\n\t{\n\t\tfor( BannedPlayer *pCur = m_PlayerHash[i].m_pNext; pCur != &m_PlayerHash[i]; pCur = pCur->m_pNext )\n\t\t{\n\t\t\tcallback( pCur->m_PlayerID );\n\t\t}\n\t}\n}\n\nvoid CVoiceBanMgr::Clear()\n{\n\t// Tie off the hash table entries.\n\tfor( int i = 0; i < 256; i++ )\n\t\tm_PlayerHash[i].m_pNext = m_PlayerHash[i].m_pPrev = &m_PlayerHash[i];\n}\n\nCVoiceBanMgr::BannedPlayer *CVoiceBanMgr::InternalFindPlayerSquelch( char const playerID[16] )\n{\n\tint index = HashPlayerID( playerID );\n\n\tBannedPlayer *pListHead = &m_PlayerHash[index];\n\tfor( BannedPlayer *pCur = pListHead->m_pNext; pCur != pListHead; pCur=pCur->m_pNext )\n\t{\n\t\tif( memcmp( playerID, pCur->m_PlayerID, 16 ) == 0 )\n\t\t\treturn pCur;\n\t}\n\n\treturn NULL;\n}\n\nCVoiceBanMgr::BannedPlayer* CVoiceBanMgr::AddBannedPlayer( char const playerID[16] )\n{\n\tBannedPlayer *pNew = new BannedPlayer;\n\tif( !pNew )\n\t\treturn NULL;\n\n\tint index = HashPlayerID( playerID );\n\n\tmemcpy( pNew->m_PlayerID, playerID, 16 );\n\tpNew->m_pNext = &m_PlayerHash[index];\n\tpNew->m_pPrev = m_PlayerHash[index].m_pPrev;\n\tpNew->m_pPrev->m_pNext = pNew->m_pNext->m_pPrev = pNew;\n\n\treturn pNew;\n}\n"
  },
  {
    "path": "game_shared/voice_banmgr.h",
    "content": "//========= Copyright (c) 1996-2002, Valve LLC, All rights reserved. ============\n//\n// Purpose: \n//\n// $NoKeywords: $\n//=============================================================================\n#pragma once\n#ifndef VOICE_BANMGR_H\n#define VOICE_BANMGR_H\n\n// This class manages the (persistent) list of squelched players.\nclass CVoiceBanMgr\n{\npublic:\n\t\t\tCVoiceBanMgr();\n\t\t\t~CVoiceBanMgr();\n\n\t// Init loads the list of squelched players from disk.\n\tbool\t\tInit( char const *pGameDir );\n\tvoid\t\tTerm();\n\n\t// Saves the state into voice_squelch.dt.\n\tvoid\t\tSaveState( char const *pGameDir );\n\n\tbool\t\tGetPlayerBan( char const playerID[16] );\n\tvoid\t\tSetPlayerBan( char const playerID[16], bool bSquelch );\n\n\t// Call your callback for each banned player.\n\tvoid\t\tForEachBannedPlayer( void (*callback)( char id[16] ) );\n\nprotected:\n\tclass BannedPlayer\n\t{\n\tpublic:\n\t\tchar\t\t m_PlayerID[16];\n\t\tBannedPlayer\t*m_pPrev, *m_pNext;\n\t};\n\n\tvoid\t\t Clear();\n\tBannedPlayer\t*InternalFindPlayerSquelch( char const playerID[16] );\n\tBannedPlayer\t*AddBannedPlayer( char const playerID[16] );\n\n\tBannedPlayer\tm_PlayerHash[256];\n};\n#endif // VOICE_BANMGR_H\n"
  },
  {
    "path": "game_shared/voice_common.h",
    "content": "//========= Copyright (c) 1996-2002, Valve LLC, All rights reserved. ============\n//\n// Purpose: \n//\n// $NoKeywords: $\n//=============================================================================\n#pragma once\n#ifndef VOICE_COMMON_H\n#define VOICE_COMMON_H\n\n#include \"bitvec.h\"\n\n#define VOICE_MAX_PLAYERS\t\t32\t// (todo: this should just be set to MAX_CLIENTS).\n#define VOICE_MAX_PLAYERS_DW\t\t((VOICE_MAX_PLAYERS / 32) + !!(VOICE_MAX_PLAYERS & 31))\n\ntypedef CBitVec<VOICE_MAX_PLAYERS> CPlayerBitVec;\n#endif // VOICE_COMMON_H\n"
  },
  {
    "path": "game_shared/voice_gamemgr.cpp",
    "content": "//========= Copyright (c) 1996-2002, Valve LLC, All rights reserved. ============\n//\n// Purpose: \n//\n// $NoKeywords: $\n//=============================================================================\n\n#include \"archtypes.h\"     // DAL\n#include \"voice_gamemgr.h\"\n#include <string.h>\n#include <assert.h>\n#include \"extdll.h\"\n#include \"util.h\"\n#include \"cbase.h\"\n#include \"player.h\"\n\n\n\n#define UPDATE_INTERVAL\t0.3\n\n\n// These are stored off as CVoiceGameMgr is created and deleted.\nCPlayerBitVec\tg_PlayerModEnable;\t\t// Set to 1 for each player if the player wants to use voice in this mod.\n\t\t\t\t\t\t\t\t\t\t// (If it's zero, then the server reports that the game rules are saying the\n\t\t\t\t\t\t\t\t\t\t// player can't hear anyone).\n\nCPlayerBitVec\tg_BanMasks[VOICE_MAX_PLAYERS];\t// Tells which players don't want to hear each other.\n\t\t\t\t\t\t\t\t\t\t\t\t// These are indexed as clients and each bit represents a client\n\t\t\t\t\t\t\t\t\t\t\t\t// (so player entity is bit+1).\n\nCPlayerBitVec\tg_SentGameRulesMasks[VOICE_MAX_PLAYERS];\t// These store the masks we last sent to each client so we can determine if\nCPlayerBitVec\tg_SentBanMasks[VOICE_MAX_PLAYERS];\t\t\t// we need to resend them.\nCPlayerBitVec\tg_bWantModEnable;\n\ncvar_t voice_serverdebug = {\"voice_serverdebug\", \"0\"};\n\n// Set game rules to allow all clients to talk to each other.\n// Muted players still can't talk to each other.\ncvar_t sv_alltalk = {\"sv_alltalk\", \"0\", FCVAR_SERVER};\n\n// ------------------------------------------------------------------------ //\n// Static helpers.\n// ------------------------------------------------------------------------ //\n\n// Find a player with a case-insensitive name search.\nstatic CBasePlayer* FindPlayerByName(const char *pTestName)\n{\n\tfor(int i=1; i <= gpGlobals->maxClients; i++)\n\t{\n\t\tedict_t *pEdict = g_engfuncs.pfnPEntityOfEntIndex(i);\n\t\tif(pEdict)\n\t\t{\n\t\t\tCBaseEntity *pEnt = CBaseEntity::Instance(pEdict);\n\t\t\tif(pEnt && pEnt->IsPlayer())\n\t\t\t{\t\t\t\n\t\t\t\tconst char *pNetName = STRING(pEnt->pev->netname);\n\t\t\t\tif(stricmp(pNetName, pTestName) == 0)\n\t\t\t\t{\n\t\t\t\t\treturn (CBasePlayer*)pEnt;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn NULL;\n}\n\nstatic void VoiceServerDebug( char const *pFmt, ... )\n{\n\tchar msg[4096];\n\tva_list marker;\n\n\tif( !voice_serverdebug.value )\n\t\treturn;\n\n\tva_start( marker, pFmt );\n\t_vsnprintf( msg, sizeof(msg), pFmt, marker );\n\tva_end( marker );\n\n\tALERT( at_console, \"%s\", msg );\n}\n\n\n\n// ------------------------------------------------------------------------ //\n// CVoiceGameMgr.\n// ------------------------------------------------------------------------ //\n\nCVoiceGameMgr::CVoiceGameMgr()\n{\n\tm_UpdateInterval = 0;\n\tm_nMaxPlayers = 0;\n}\n\n\nCVoiceGameMgr::~CVoiceGameMgr()\n{\n}\n\n\nbool CVoiceGameMgr::Init(\n\tIVoiceGameMgrHelper *pHelper,\n\tint maxClients)\n{\t\t  \n\tm_pHelper = pHelper;\n\tm_nMaxPlayers = VOICE_MAX_PLAYERS < maxClients ? VOICE_MAX_PLAYERS : maxClients;\n\tg_engfuncs.pfnPrecacheModel(\"sprites/voiceicon.spr\");\n\n\tm_msgPlayerVoiceMask = REG_USER_MSG( \"VoiceMask\", VOICE_MAX_PLAYERS_DW*4 * 2 );\n\tm_msgRequestState = REG_USER_MSG( \"ReqState\", 0 );\n\t\n\t// register voice_serverdebug if it hasn't been registered already\n\tif ( !CVAR_GET_POINTER( \"voice_serverdebug\" ) )\n\t\tCVAR_REGISTER( &voice_serverdebug );\n\n\tif( !CVAR_GET_POINTER( \"sv_alltalk\" ) )\n\t\tCVAR_REGISTER( &sv_alltalk );\n\n\treturn true;\n}\n\n\nvoid CVoiceGameMgr::SetHelper(IVoiceGameMgrHelper *pHelper)\n{\n\tm_pHelper = pHelper;\n}\n\n\nvoid CVoiceGameMgr::Update(double frametime)\n{\n\t// Only update periodically.\n\tm_UpdateInterval += frametime;\n\tif(m_UpdateInterval < UPDATE_INTERVAL)\n\t\treturn;\n\n\tUpdateMasks();\n}\n\n\nvoid CVoiceGameMgr::ClientConnected(edict_t *pEdict)\n{\n\tint index = ENTINDEX(pEdict) - 1;\n\t\n\t// Clear out everything we use for deltas on this guy.\n\tg_bWantModEnable[index] = true;\n\tg_SentGameRulesMasks[index].Init(0);\n\tg_SentBanMasks[index].Init(0);\n}\n\n// Called to determine if the Receiver has muted (blocked) the Sender\n// Returns true if the receiver has blocked the sender\nbool CVoiceGameMgr::PlayerHasBlockedPlayer(CBasePlayer *pReceiver, CBasePlayer *pSender)\n{\n\tint iReceiverIndex, iSenderIndex;\n\n\tif ( !pReceiver || !pSender )\n\t\treturn false;\n\n\tiReceiverIndex = pReceiver->entindex() - 1;\n\tiSenderIndex   = pSender->entindex() - 1;\n\n\tif ( iReceiverIndex < 0 || iReceiverIndex >= m_nMaxPlayers || iSenderIndex < 0 || iSenderIndex >= m_nMaxPlayers )\n\t\treturn false;\n\n\treturn ( g_BanMasks[iReceiverIndex][iSenderIndex] ? true : false );\n}\n\nbool CVoiceGameMgr::ClientCommand(CBasePlayer *pPlayer, const char *cmd)\n{\n\tint playerClientIndex = pPlayer->entindex() - 1;\n\tif(playerClientIndex < 0 || playerClientIndex >= m_nMaxPlayers)\n\t{\n\t\tVoiceServerDebug( \"CVoiceGameMgr::ClientCommand: cmd %s from invalid client (%d)\\n\", cmd, playerClientIndex );\n\t\treturn true;\n\t}\n\n\tbool bBan = stricmp(cmd, \"vban\") == 0;\n\tif(bBan && CMD_ARGC() >= 2)\n\t{\n\t\tfor(int i=1; i < CMD_ARGC(); i++)\n\t\t{\n\t\t\tuint32 mask = 0;\n\t\t\tsscanf(CMD_ARGV(i), \"%x\", &mask);\n\n\t\t\tif(i <= VOICE_MAX_PLAYERS_DW)\n\t\t\t{\n\t\t\t\tVoiceServerDebug( \"CVoiceGameMgr::ClientCommand: vban (0x%x) from %d\\n\", mask, playerClientIndex );\n\t\t\t\tg_BanMasks[playerClientIndex].SetDWord(i-1, mask);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tVoiceServerDebug( \"CVoiceGameMgr::ClientCommand: invalid index (%d)\\n\", i );\n\t\t\t}\n\t\t}\n\n\t\t// Force it to update the masks now.\n\t\t// UpdateMasks();\t\t\n\t\treturn true;\n\t}\n\telse if(stricmp(cmd, \"VModEnable\") == 0 && CMD_ARGC() >= 2)\n\t{\n\t\tVoiceServerDebug( \"CVoiceGameMgr::ClientCommand: VModEnable (%d)\\n\", !!atoi(CMD_ARGV(1)) );\n\t\tg_PlayerModEnable[playerClientIndex] = !!atoi(CMD_ARGV(1));\n\t\tg_bWantModEnable[playerClientIndex] = false;\n\t\t// UpdateMasks();\n\t\treturn true;\n\t}\n\telse\n\t{\n\t\treturn false;\n\t}\n}\n\n\nvoid CVoiceGameMgr::UpdateMasks()\n{\n\tm_UpdateInterval = 0;\n\n\tbool bAllTalk = !!(sv_alltalk.value);\n\n\tfor(int iClient=0; iClient < m_nMaxPlayers; iClient++)\n\t{\n\t\tCBaseEntity *pEnt = UTIL_PlayerByIndex(iClient+1);\n\t\tif(!pEnt || !pEnt->IsPlayer())\n\t\t\tcontinue;\n\n\t\t// Request the state of their \"VModEnable\" cvar.\n\t\tif(g_bWantModEnable[iClient])\n\t\t{\n\t\t\tMESSAGE_BEGIN(MSG_ONE, m_msgRequestState, NULL, pEnt->pev);\n\t\t\tMESSAGE_END();\n\t\t}\n\n\t\tCBasePlayer *pPlayer = (CBasePlayer*)pEnt;\n\n\t\tCPlayerBitVec gameRulesMask;\n\t\tif( g_PlayerModEnable[iClient] )\n\t\t{\n\t\t\t// Build a mask of who they can hear based on the game rules.\n\t\t\tfor(int iOtherClient=0; iOtherClient < m_nMaxPlayers; iOtherClient++)\n\t\t\t{\n\t\t\t\tCBaseEntity *pEnt = UTIL_PlayerByIndex(iOtherClient+1);\n\t\t\t\tif(pEnt && (bAllTalk || m_pHelper->CanPlayerHearPlayer(pPlayer, (CBasePlayer*)pEnt)) )\n\t\t\t\t{\n\t\t\t\t\tgameRulesMask[iOtherClient] = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// If this is different from what the client has, send an update. \n\t\tif(gameRulesMask != g_SentGameRulesMasks[iClient] || \n\t\t\tg_BanMasks[iClient] != g_SentBanMasks[iClient])\n\t\t{\n\t\t\tg_SentGameRulesMasks[iClient] = gameRulesMask;\n\t\t\tg_SentBanMasks[iClient] = g_BanMasks[iClient];\n\n\t\t\tMESSAGE_BEGIN(MSG_ONE, m_msgPlayerVoiceMask, NULL, pPlayer->pev);\n\t\t\t\tint dw;\n\t\t\t\tfor(dw=0; dw < VOICE_MAX_PLAYERS_DW; dw++)\n\t\t\t\t{\n\t\t\t\t\tWRITE_LONG(gameRulesMask.GetDWord(dw));\n\t\t\t\t\tWRITE_LONG(g_BanMasks[iClient].GetDWord(dw));\n\t\t\t\t}\n\t\t\tMESSAGE_END();\n\t\t}\n\n\t\t// Tell the engine.\n\t\tfor(int iOtherClient=0; iOtherClient < m_nMaxPlayers; iOtherClient++)\n\t\t{\n\t\t\tbool bCanHear = gameRulesMask[iOtherClient] && !g_BanMasks[iClient][iOtherClient];\n\t\t\tg_engfuncs.pfnVoice_SetClientListening(iClient+1, iOtherClient+1, bCanHear);\n\t\t}\n\t}\n}"
  },
  {
    "path": "game_shared/voice_gamemgr.h",
    "content": "//========= Copyright (c) 1996-2002, Valve LLC, All rights reserved. ============\n//\n// Purpose: \n//\n// $NoKeywords: $\n//=============================================================================\n#pragma once\n#ifndef VOICE_GAMEMGR_H\n#define VOICE_GAMEMGR_H\n\n#ifdef _WIN32\n#endif\n\n\n#include \"voice_common.h\"\n\n\nclass CGameRules;\nclass CBasePlayer;\n\n\nclass IVoiceGameMgrHelper\n{\npublic:\n\tvirtual\t\t\t\t~IVoiceGameMgrHelper() {}\n\n\t// Called each frame to determine which players are allowed to hear each other.\tThis overrides\n\t// whatever squelch settings players have.\n\tvirtual bool\t\tCanPlayerHearPlayer(CBasePlayer *pListener, CBasePlayer *pTalker) = 0;\n};\n\n\n// CVoiceGameMgr manages which clients can hear which other clients.\nclass CVoiceGameMgr\n{\npublic:\n\t\t\t\t\t\tCVoiceGameMgr();\n\tvirtual\t\t\t\t~CVoiceGameMgr();\n\t\n\tbool\t\t\t\tInit(\n\t\tIVoiceGameMgrHelper *m_pHelper,\n\t\tint maxClients\n\t\t);\n\n\tvoid\t\t\t\tSetHelper(IVoiceGameMgrHelper *pHelper);\n\n\t// Updates which players can hear which other players.\n\t// If gameplay mode is DM, then only players within the PVS can hear each other.\n\t// If gameplay mode is teamplay, then only players on the same team can hear each other.\n\t// Player masks are always applied.\n\tvoid\t\t\t\tUpdate(double frametime);\n\n\t// Called when a new client connects (unsquelches its entity for everyone).\n\tvoid\t\t\t\tClientConnected(struct edict_s *pEdict);\n\n\t// Called on ClientCommand. Checks for the squelch and unsquelch commands.\n\t// Returns true if it handled the command.\n\tbool\t\t\t\tClientCommand(CBasePlayer *pPlayer, const char *cmd);\n\n\t// Called to determine if the Receiver has muted (blocked) the Sender\n\t// Returns true if the receiver has blocked the sender\n\tbool\t\t\t\tPlayerHasBlockedPlayer(CBasePlayer *pReceiver, CBasePlayer *pSender);\n\n\nprivate:\n\n\t// Force it to update the client masks.\n\tvoid\t\t\t\tUpdateMasks();\n\n\n\tint\t\t\t\t\tm_msgPlayerVoiceMask;\n\tint\t\t\t\t\tm_msgRequestState;\n\n\tIVoiceGameMgrHelper\t*m_pHelper;\n\tint\t\t\t\t\tm_nMaxPlayers;\n\tdouble\t\t\t\tm_UpdateInterval;\t\t\t\t\t\t// How long since the last update.\n};\n\n\n#endif // VOICE_GAMEMGR_H"
  },
  {
    "path": "game_shared/voice_status.cpp",
    "content": "\n#include <stdio.h>\n#include <string.h>\n\n#include \"wrect.h\"\n#include \"cl_dll.h\"\n#include \"cl_util.h\"\n#include \"cl_entity.h\"\n#include \"const.h\"\n\n#include \"parsemsg.h\" // BEGIN_READ(), ...\n\n#include \"voice_status.h\"\n\n#pragma warning( disable : 4800 ) // disable forcing int to bool performance warning\n\nstatic CVoiceStatus *g_pInternalVoiceStatus = NULL;\n\n// ---------------------------------------------------------------------- //\n// The voice manager for the client.\n// ---------------------------------------------------------------------- //\nCVoiceStatus g_VoiceStatus;\n\nCVoiceStatus *GetClientVoice()\n{\n\treturn &g_VoiceStatus;\n}\n\nint __MsgFunc_VoiceMask( const char *pszName, int iSize, void *pbuf )\n{\n\tif ( g_pInternalVoiceStatus )\n\t\tg_pInternalVoiceStatus->HandleVoiceMaskMsg( iSize, pbuf );\n\n\treturn 1;\n}\n\nint __MsgFunc_ReqState( const char *pszName, int iSize, void *pbuf )\n{\n\tif ( g_pInternalVoiceStatus )\n\t\tg_pInternalVoiceStatus->HandleReqStateMsg( iSize, pbuf );\n\n\treturn 1;\n}\n\nint g_BannedPlayerPrintCount;\nvoid ForEachBannedPlayer( char id[16] )\n{\n\tchar str[256];\n\tsprintf( str, \"Ban %d: %2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x\\n\",\n\t         g_BannedPlayerPrintCount++,\n\t         id[0], id[1], id[2], id[3],\n\t         id[4], id[5], id[6], id[7],\n\t         id[8], id[9], id[10], id[11],\n\t         id[12], id[13], id[14], id[15] );\n#ifdef _WIN32\n\tstrupr( str );\n#endif\n\tgEngfuncs.pfnConsolePrint( str );\n}\n\nvoid ShowBannedCallback()\n{\n\tif ( g_pInternalVoiceStatus )\n\t{\n\t\tg_BannedPlayerPrintCount = 0;\n\t\tgEngfuncs.pfnConsolePrint( \"------- BANNED PLAYERS -------\\n\" );\n\t\tg_pInternalVoiceStatus->GetBanMgr()->ForEachBannedPlayer( ForEachBannedPlayer );\n\t\tgEngfuncs.pfnConsolePrint( \"------------------------------\\n\" );\n\t}\n}\n\nCVoiceStatus::CVoiceStatus()\n{\n\tm_bBanMgrInitialized = false;\n\tm_LastUpdateServerState = 0;\n\n\tm_bTalking = m_bServerAcked = false;\n\n\tm_bServerModEnable = -1;\n\n\tm_pchGameDir = NULL;\n}\n\nCVoiceStatus::~CVoiceStatus()\n{\n\tg_pInternalVoiceStatus = NULL;\n\n\tif ( m_pchGameDir )\n\t{\n\t\tif ( m_bBanMgrInitialized )\n\t\t{\n\t\t\tm_BanMgr.SaveState( m_pchGameDir );\n\t\t}\n\n\t\tfree( m_pchGameDir );\n\t}\n}\n\nvoid CVoiceStatus::Init( IVoiceStatusHelper *pHelper )\n{\n\t// Setup the voice_modenable cvar.\n\tgEngfuncs.pfnRegisterVariable( \"voice_modenable\", \"1\", FCVAR_ARCHIVE );\n\n\tgEngfuncs.pfnRegisterVariable( \"voice_clientdebug\", \"0\", 0 );\n\n\tgEngfuncs.pfnAddCommand( \"voice_showbanned\", ShowBannedCallback );\n\n\t// Cache the game directory for use when we shut down\n\tconst char *pchGameDirT = gEngfuncs.pfnGetGameDirectory();\n\tm_pchGameDir = (char *)malloc( strlen( pchGameDirT ) + 1 );\n\n\tif ( m_pchGameDir )\n\t{\n\t\tstrcpy( m_pchGameDir, pchGameDirT );\n\t}\n\n\tif ( m_pchGameDir )\n\t{\n\t\tm_BanMgr.Init( m_pchGameDir );\n\t\tm_bBanMgrInitialized = true;\n\t}\n\n\tassert( !g_pInternalVoiceStatus );\n\tg_pInternalVoiceStatus = this;\n\n\tm_bInSquelchMode = false;\n\n\tm_pHelper = pHelper;\n\n\tgEngfuncs.pfnHookUserMsg( \"VoiceMask\", __MsgFunc_VoiceMask );\n\tgEngfuncs.pfnHookUserMsg( \"ReqState\", __MsgFunc_ReqState );\n\n\tGetClientVoiceHud()->Init( pHelper, this );\n}\n\nvoid CVoiceStatus::Frame( double frametime )\n{\n\t// check server banned players once per second\n\tif ( gEngfuncs.GetClientTime() - m_LastUpdateServerState > 1 )\n\t{\n\t\tUpdateServerState( false );\n\t}\n}\n\nvoid CVoiceStatus::StartSquelchMode()\n{\n\tif ( m_bInSquelchMode )\n\t\treturn;\n\n\tm_bInSquelchMode = true;\n}\n\nvoid CVoiceStatus::StopSquelchMode()\n{\n\tm_bInSquelchMode = false;\n}\n\nbool CVoiceStatus::IsInSquelchMode()\n{\n\treturn m_bInSquelchMode;\n}\n\nvoid CVoiceStatus::UpdateServerState( bool bForce )\n{\n\t// Can't do anything when we're not in a level.\n\tchar const *pLevelName = gEngfuncs.pfnGetLevelName();\n\tif ( pLevelName[0] == 0 )\n\t{\n\t\tif ( gEngfuncs.pfnGetCvarFloat( \"voice_clientdebug\" ) )\n\t\t{\n\t\t\tgEngfuncs.pfnConsolePrint( \"CVoiceStatus::UpdateServerState: pLevelName[0]==0\\n\" );\n\t\t}\n\n\t\treturn;\n\t}\n\n\tint bCVarModEnable = !!gEngfuncs.pfnGetCvarFloat( \"voice_modenable\" );\n\tif ( bForce || m_bServerModEnable != bCVarModEnable )\n\t{\n\t\tm_bServerModEnable = bCVarModEnable;\n\n\t\tchar str[256];\n\t\tsprintf( str, \"VModEnable %d\", m_bServerModEnable );\n\t\tServerCmd( str );\n\n\t\tif ( gEngfuncs.pfnGetCvarFloat( \"voice_clientdebug\" ) )\n\t\t{\n\t\t\tchar msg[256];\n\t\t\tsprintf( msg, \"CVoiceStatus::UpdateServerState: Sending '%s'\\n\", str );\n\t\t\tgEngfuncs.pfnConsolePrint( msg );\n\t\t}\n\t}\n\n\tchar str[2048];\n\tsprintf( str, \"vban\" );\n\tbool bChange = false;\n\n\tfor ( uint32 dw = 0; dw < VOICE_MAX_PLAYERS_DW; dw++ )\n\t{\n\t\tuint32 serverBanMask = 0;\n\t\tuint32 banMask = 0;\n\n\t\tfor ( uint32 i = 0; i < 32; i++ )\n\t\t{\n\t\t\tchar playerID[16];\n\t\t\tif ( !gEngfuncs.GetPlayerUniqueID( i + 1, playerID ) )\n\t\t\t\tcontinue;\n\n\t\t\tif ( m_BanMgr.GetPlayerBan( playerID ) )\n\t\t\t\tbanMask |= 1 << i;\n\n\t\t\tif ( m_ServerBannedPlayers[dw * 32 + i] )\n\t\t\t\tserverBanMask |= 1 << i;\n\t\t}\n\n\t\tif ( serverBanMask != banMask )\n\t\t\tbChange = true;\n\n\t\t// Ok, the server needs to be updated.\n\t\tchar numStr[512];\n\t\tsprintf( numStr, \" %x\", banMask );\n\t\tstrcat( str, numStr );\n\t}\n\n\tif ( bChange || bForce )\n\t{\n\t\tif ( gEngfuncs.pfnGetCvarFloat( \"voice_clientdebug\" ) )\n\t\t{\n\t\t\tchar msg[256];\n\t\t\tsprintf( msg, \"CVoiceStatus::UpdateServerState: Sending '%s'\\n\", str );\n\t\t\tgEngfuncs.pfnConsolePrint( msg );\n\t\t}\n\n\t\tgEngfuncs.pfnServerCmdUnreliable( str ); // Tell the server..\n\t}\n\telse\n\t{\n\t\tif ( gEngfuncs.pfnGetCvarFloat( \"voice_clientdebug\" ) )\n\t\t{\n\t\t\tgEngfuncs.pfnConsolePrint( \"CVoiceStatus::UpdateServerState: no change\\n\" );\n\t\t}\n\t}\n\n\tm_LastUpdateServerState = gEngfuncs.GetClientTime();\n}\n\nint CVoiceStatus::GetSpeakerStatus( int iPlayer )\n{\n\tbool bTalking = static_cast<bool>( m_VoicePlayers[iPlayer] );\n\n\tchar playerID[16];\n\tqboolean id = gEngfuncs.GetPlayerUniqueID( iPlayer + 1, playerID );\n\tif ( !id )\n\t\treturn VOICE_NEVERSPOKEN;\n\n\tbool bBanned = m_BanMgr.GetPlayerBan( playerID );\n\tbool bNeverSpoken = !m_VoiceEnabledPlayers[iPlayer];\n\n\tif ( bBanned )\n\t{\n\t\treturn VOICE_BANNED;\n\t}\n\telse if ( bNeverSpoken )\n\t{\n\t\treturn VOICE_NEVERSPOKEN;\n\t}\n\telse if ( bTalking )\n\t{\n\t\treturn VOICE_TALKING;\n\t}\n\telse\n\t\treturn VOICE_NOTTALKING;\n}\n\nvoid CVoiceStatus::HandleVoiceMaskMsg( int iSize, void *pbuf )\n{\n\tBufferReader reader( pbuf, iSize );\n\n\tuint32 dw;\n\tfor ( dw = 0; dw < VOICE_MAX_PLAYERS_DW; dw++ )\n\t{\n\t\tm_AudiblePlayers.SetDWord( dw, (uint32)reader.ReadLong() );\n\t\tm_ServerBannedPlayers.SetDWord( dw, (uint32)reader.ReadLong() );\n\n\t\tif ( gEngfuncs.pfnGetCvarFloat( \"voice_clientdebug\" ) )\n\t\t{\n\t\t\tchar str[256];\n\t\t\tgEngfuncs.pfnConsolePrint( \"CVoiceStatus::HandleVoiceMaskMsg\\n\" );\n\n\t\t\tsprintf( str, \"    - m_AudiblePlayers[%d] = %lu\\n\", dw, m_AudiblePlayers.GetDWord( dw ) );\n\t\t\tgEngfuncs.pfnConsolePrint( str );\n\n\t\t\tsprintf( str, \"    - m_ServerBannedPlayers[%d] = %lu\\n\", dw, m_ServerBannedPlayers.GetDWord( dw ) );\n\t\t\tgEngfuncs.pfnConsolePrint( str );\n\t\t}\n\t}\n\n\tm_bServerModEnable = reader.ReadByte();\n}\n\nvoid CVoiceStatus::HandleReqStateMsg( int iSize, void *pbuf )\n{\n\tif ( gEngfuncs.pfnGetCvarFloat( \"voice_clientdebug\" ) )\n\t{\n\t\tgEngfuncs.pfnConsolePrint( \"CVoiceStatus::HandleReqStateMsg\\n\" );\n\t}\n\n\tUpdateServerState( true );\n}\n\nvoid CVoiceStatus::UpdateSpeakerStatus( int entindex, bool bTalking )\n{\n\tconst char *levelName = gEngfuncs.pfnGetLevelName();\n\n\tif ( levelName && levelName[0] )\n\t{\n\t\tif ( gEngfuncs.pfnGetCvarFloat( \"voice_clientdebug\" ) )\n\t\t{\n\t\t\tchar msg[256];\n\t\t\tsprintf( msg, \"CVoiceStatus::UpdateSpeakerStatus: ent %d talking = %d\\n\", entindex, bTalking );\n\t\t\tgEngfuncs.pfnConsolePrint( msg );\n\t\t}\n\n\t\t// Is it the local player talking?\n\t\tif ( entindex == -1 )\n\t\t{\n\t\t\tm_bTalking = bTalking;\n\t\t\tif ( bTalking )\n\t\t\t{\n\t\t\t\t// Enable voice for them automatically if they try to talk.\n\t\t\t\tgEngfuncs.pfnClientCmd( \"voice_modenable 1\" );\n\t\t\t}\n\t\t\tif ( !gEngfuncs.GetLocalPlayer() )\n\t\t\t{\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tint entindex = gEngfuncs.GetLocalPlayer()->index;\n\t\t\tGetClientVoiceHud()->UpdateSpeakerStatus( -2, bTalking );\n\n\t\t\tm_VoicePlayers[entindex - 1] = m_bTalking;\n\t\t\tm_VoiceEnabledPlayers[entindex - 1] = true;\n\t\t}\n\t\telse if ( entindex == -2 )\n\t\t{\n\t\t\tm_bServerAcked = bTalking;\n\t\t}\n\t\telse if ( entindex >= 0 && entindex <= VOICE_MAX_PLAYERS )\n\t\t{\n\t\t\tint iClient = entindex - 1;\n\t\t\tif ( iClient < 0 )\n\t\t\t\treturn;\n\n\t\t\tGetClientVoiceHud()->UpdateSpeakerStatus( entindex, bTalking );\n\n\t\t\tif ( bTalking )\n\t\t\t{\n\t\t\t\tm_VoicePlayers[iClient] = true;\n\t\t\t\tm_VoiceEnabledPlayers[iClient] = true;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tm_VoicePlayers[iClient] = false;\n\t\t\t}\n\t\t}\n\n\t\tGetClientVoiceHud()->RepositionLabels();\n\t}\n}\n\n//-----------------------------------------------------------------------------\n// Purpose: returns true if the target client has been banned\n// Input  : playerID -\n// Output : Returns true on success, false on failure.\n//-----------------------------------------------------------------------------\nbool CVoiceStatus::IsPlayerBlocked( int iPlayer )\n{\n\tchar playerID[16];\n\tif ( !gEngfuncs.GetPlayerUniqueID( iPlayer, playerID ) )\n\t\treturn false;\n\n\treturn m_BanMgr.GetPlayerBan( playerID );\n}\n\n//-----------------------------------------------------------------------------\n// Purpose: returns true if the player can't hear the other client due to game rules (eg. the other team)\n// Input  : playerID -\n// Output : Returns true on success, false on failure.\n//-----------------------------------------------------------------------------\nbool CVoiceStatus::IsPlayerAudible( int iPlayer )\n{\n\treturn !!m_AudiblePlayers[iPlayer - 1];\n}\n\n//-----------------------------------------------------------------------------\n// Purpose: blocks/unblocks the target client from being heard\n// Input  : playerID -\n// Output : Returns true on success, false on failure.\n//-----------------------------------------------------------------------------\nvoid CVoiceStatus::SetPlayerBlockedState( int iPlayer, bool blocked )\n{\n\tif ( gEngfuncs.pfnGetCvarFloat( \"voice_clientdebug\" ) )\n\t{\n\t\tgEngfuncs.pfnConsolePrint( \"CVoiceStatus::SetPlayerBlockedState part 1\\n\" );\n\t}\n\n\tchar playerID[16];\n\tif ( !gEngfuncs.GetPlayerUniqueID( iPlayer, playerID ) )\n\t\treturn;\n\n\tif ( gEngfuncs.pfnGetCvarFloat( \"voice_clientdebug\" ) )\n\t{\n\t\tgEngfuncs.pfnConsolePrint( \"CVoiceStatus::SetPlayerBlockedState part 2\\n\" );\n\t}\n\n\t// Squelch or (try to) unsquelch this player.\n\tif ( gEngfuncs.pfnGetCvarFloat( \"voice_clientdebug\" ) )\n\t{\n\t\tchar str[256];\n\t\tsprintf( str, \"CVoiceStatus::SetPlayerBlockedState: setting player %d ban to %d\\n\", iPlayer, !m_BanMgr.GetPlayerBan( playerID ) );\n\t\tgEngfuncs.pfnConsolePrint( str );\n\t}\n\n\tm_BanMgr.SetPlayerBan( playerID, blocked );\n\tUpdateServerState( false );\n}"
  },
  {
    "path": "game_shared/voice_status.h",
    "content": "//========= Copyright © 1996-2001, Valve LLC, All rights reserved. ============\n//\n// Purpose:\n//\n// $NoKeywords: $\n//=============================================================================\n\n#ifndef VOICE_STATUS_H\n#define VOICE_STATUS_H\n#pragma once\n\n#include \"voice_common.h\"\n#include \"voice_banmgr.h\"\n\n// This is provided by each mod to access data that may not be the same across mods.\nclass IVoiceStatusHelper\n{\npublic:\n\tvirtual ~IVoiceStatusHelper() { }\n\n\t// Get RGB color for voice status text about this player.\n\tvirtual void GetPlayerTextColor( int entindex, int color[3] ) = 0;\n\n\t// Return the height above the bottom that the voice ack icons should be drawn at.\n\tvirtual int GetAckIconHeight() = 0;\n\n\t// Return true if the voice manager is allowed to show speaker labels\n\t// (mods usually return false when the scoreboard is up).\n\tvirtual bool CanShowSpeakerLabels() = 0;\n\n\t// return a pre-translated string for the player's location.  Defaults to empty string for games without locations\n\tvirtual const char *GetPlayerLocation( int entindex ) { return \"\"; }\n};\n\nclass IVoiceStatus\n{\npublic:\n\t// returns the state of this player using the enum above\n\tvirtual int GetSpeakerStatus( int iPlayer ) = 0;\n\tvirtual bool IsTalking() = 0;\n\tvirtual bool ServerAcked() = 0;\n};\n\nclass IVoiceHud\n{\npublic:\n\tvirtual int Init( IVoiceStatusHelper *pHelper, IVoiceStatus *pStatus ) = 0;\n\n\t// ackPosition is the bottom position of where CVoiceStatus will draw the voice acknowledgement labels.\n\tvirtual int VidInit() = 0;\n\n\t// Call from the HUD_CreateEntities function so it can add sprites above player heads.\n\tvirtual void CreateEntities() = 0;\n\n\t// Sets a player's location (can be a #-prefixed string for localization).\n\tvirtual void UpdateLocation( int entindex, const char *location ) = 0;\n\n\tvirtual void UpdateSpeakerStatus( int entindex, bool bTalking ) = 0;\n\n\tvirtual void RepositionLabels() = 0;\n};\n\nclass CVoiceStatus : public IVoiceStatusHelper, public IVoiceStatus\n{\n\npublic:\n\tCVoiceStatus();\n\t~CVoiceStatus();\n\n\tvoid Init( IVoiceStatusHelper *pHelper );\n\n\t// Called when a player starts or stops talking.\n\t// entindex is -1 to represent the local client talking (before the data comes back from the server).\n\t// When the server acknowledges that the local client is talking, then entindex will be gEngfuncs.GetLocalPlayer().\n\t// entindex is -2 to represent the local client's voice being acked by the server.\n\tvoid UpdateSpeakerStatus( int entindex, bool bTalking );\n\n\t// returns the state of this player using the enum above\n\tint GetSpeakerStatus( int iPlayer );\n\n\t// Called when the server registers a change to who this client can hear.\n\tvoid HandleVoiceMaskMsg( int iSize, void *pbuf );\n\n\t// The server sends this message initially to tell the client to send their state.\n\tvoid HandleReqStateMsg( int iSize, void *pbuf );\n\n\tvoid Frame( double frametime );\n\n\t// When you enter squelch mode, pass in\n\tvoid StartSquelchMode();\n\tvoid StopSquelchMode();\n\tbool IsInSquelchMode();\n\n\t// returns true if the target client has been banned\n\t// playerIndex is of range 1..maxplayers\n\tbool IsPlayerBlocked( int iPlayerIndex );\n\n\t// returns false if the player can't hear the other client due to game rules (eg. the other team)\n\tbool IsPlayerAudible( int iPlayerIndex );\n\n\t// blocks the target client from being heard\n\tvoid SetPlayerBlockedState( int iPlayerIndex, bool blocked );\n\n\tvoid UpdateServerState( bool bForce );\n\n\tvirtual bool CanShowSpeakerLabels()\n\t{\n\t\treturn m_pHelper->CanShowSpeakerLabels();\n\t}\n\n\tvirtual void GetPlayerTextColor( int entindex, int color[3] )\n\t{\n\t\tm_pHelper->GetPlayerTextColor( entindex, color );\n\t}\n\n\tvirtual int GetAckIconHeight()\n\t{\n\t\treturn m_pHelper->GetAckIconHeight();\n\t}\n\n\tbool IsTalking()\n\t{\n\t\treturn m_bTalking;\n\t}\n\n\tbool ServerAcked()\n\t{\n\t\treturn m_bServerAcked;\n\t}\n\n\tCVoiceBanMgr *GetBanMgr() { return &m_BanMgr; }\n\n\tenum\n\t{\n\t\tVOICE_TALKING = 1, // start from one because ImageList's don't use pos 0\n\t\tVOICE_BANNED,\n\t\tVOICE_NEVERSPOKEN,\n\t\tVOICE_NOTTALKING,\n\t}; // various voice states\n\nprivate:\n\tfloat m_LastUpdateServerState; // Last time we called this function.\n\tint m_bServerModEnable;        // What we've sent to the server about our \"voice_modenable\" cvar.\n\n\tCPlayerBitVec m_VoicePlayers; // Who is currently talking. Indexed by client index.\n\n\t// This is the gamerules-defined list of players that you can hear. It is based on what teams people are on\n\t// and is totally separate from the ban list. Indexed by client index.\n\tCPlayerBitVec m_AudiblePlayers;\n\n\t// Players who have spoken at least once in the game so far\n\tCPlayerBitVec m_VoiceEnabledPlayers;\n\n\t// This is who the server THINKS we have banned (it can become incorrect when a new player arrives on the server).\n\t// It is checked periodically, and the server is told to squelch or unsquelch the appropriate players.\n\tCPlayerBitVec m_ServerBannedPlayers;\n\n\tIVoiceStatusHelper *m_pHelper; // Each mod provides an implementation of this.\n\n\t// Squelch mode stuff.\n\tbool m_bInSquelchMode;\n\n\tbool m_bTalking;     // Set to true when the client thinks it's talking.\n\tbool m_bServerAcked; // Set to true when the server knows the client is talking.\n\n\tCVoiceBanMgr m_BanMgr; // Tracks which users we have squelched and don't want to hear.\n\n\tbool m_bBanMgrInitialized;\n\n\t// Cache the game directory for use when we shut down\n\tchar *m_pchGameDir;\n};\n\nCVoiceStatus *GetClientVoice();\n\n// Get the (global) voice manager.\nIVoiceHud *GetClientVoiceHud();\n\n#endif // VOICE_STATUS_H"
  },
  {
    "path": "game_shared/voice_status_hud.cpp",
    "content": "//========= Copyright 1996-2001, Valve LLC, All rights reserved. ============\n//\n// Purpose:\n//\n// $NoKeywords: $\n//=============================================================================\n\n// There are hud.h's coming out of the woodwork so this ensures that we get the right one.\n#if defined( THREEWAVE ) || defined( DMC_BUILD )\n#include \"../dmc/cl_dll/hud.h\"\n#elif defined( CZERO )\n#include \"../czero/cl_dll/hud.h\"\n#elif defined( CSTRIKE )\n#include \"../cstrike/cl_dll/hud.h\"\n#elif defined( DOD )\n#include \"../dod/cl_dll/hud.h\"\n#elif defined( BLUESHIFT )\n#include \"../blueshift/cl_dll/hud.h\"\n#else\n#include \"../cl_dll/hud.h\"\n#endif\n\n#include \"cl_util.h\"\n#include <assert.h>\n#include <string.h>\n#include <stdio.h>\n#include \"parsemsg.h\"\n#include \"demo.h\"\n#include \"demo_api.h\"\n#include \"r_efx.h\"\n#include \"entity_types.h\"\n// #include \"shared_util.h\"\n\n#include \"voice_status.h\"\n#include \"voice_status_hud.h\"\n\n#include <vgui_parser.h>\n\n// using namespace vgui;\n\n// #include <vgui/IVGui.h>\n// #include <vgui/IImage.h>\n//\n// #include <vgui/ILocalize.h>\n\n#include \"utlstring.h\"\n\n#include \"triangleapi.h\"\n#include \"draw_util.h\"\n\nextern int cam_thirdperson;\n\n#define VOICE_MODEL_INTERVAL 0.3\n// #define SCOREBOARD_BLINK_FREQUENCY\t0.3\t// How often to blink the scoreboard icons.\n#define SQUELCHOSCILLATE_PER_SECOND 2.0f\n\nint g_VoiceLabelIcon;\n\n// ---------------------------------------------------------------------- //\n// The voice manager for the client.\n// ---------------------------------------------------------------------- //\nCVoiceStatusHud g_VoiceStatusHud;\n\nIVoiceHud *GetClientVoiceHud()\n{\n\treturn &g_VoiceStatusHud;\n}\n\n// ---------------------------------------------------------------------- //\n// CVoiceLabel.\n// ---------------------------------------------------------------------- //\nvoid CVoiceLabel::SetLocation( const char *location )\n{\n\tif ( !location || !*location )\n\t{\n\t\tif ( m_locationString )\n\t\t{\n\t\t\tdelete[] m_locationString;\n\t\t\tm_locationString = NULL;\n\t\t\tRebuildLabelText();\n\t\t}\n\t\treturn;\n\t}\n\n\t// const wchar_t *newLocation = vgui::localize()->Find( location );\n\tconst char *newLocation = Localize( location );\n\n\tif ( strcmp( newLocation, location ) != 0 )\n\t{\n\t\t// localized version\n\t\tif ( m_locationString && strcmp( newLocation, m_locationString ) )\n\t\t{\n\t\t\tdelete[] m_locationString;\n\t\t\tm_locationString = NULL;\n\t\t}\n\n\t\tif ( !m_locationString )\n\t\t{\n\t\t\t// m_locationString = CloneWString( newLocation );\n\t\t\tm_locationString = new char[strlen( newLocation ) + 1];\n\t\t\tstrcpy( m_locationString, newLocation );\n\t\t\tRebuildLabelText();\n\t\t}\n\t}\n\telse if ( location[0] == '#' )\n\t{\n\t\t// if the location is not localized and starts with #, clear the location\n\t\tif ( m_locationString )\n\t\t{\n\t\t\tdelete[] m_locationString;\n\t\t\tm_locationString = NULL;\n\t\t\tRebuildLabelText();\n\t\t}\n\t}\n\t/*\n\telse\n\t{\n\t    // just convert the ANSI version to Unicode\n\t    wchar_t *tmpBuf = new wchar_t[strlen( location ) + 1];\n\t    localize()->ConvertANSIToUnicode( location, tmpBuf, sizeof( tmpBuf ) );\n\n\t    if ( m_locationString && wcscmp( tmpBuf, m_locationString ) )\n\t    {\n\t        delete[] m_locationString;\n\t        m_locationString = NULL;\n\t    }\n\n\t    if ( !m_locationString )\n\t    {\n\t        m_locationString = CloneWString( tmpBuf );\n\t        RebuildLabelText();\n\t    }\n\n\t    delete[] tmpBuf;\n\t}\n\t*/\n}\n\nvoid CVoiceLabel::SetPlayerName( const char *name )\n{\n\tif ( m_playerName )\n\t{\n\t\tdelete[] m_playerName;\n\t\tm_playerName = NULL;\n\t}\n\n\tif ( name )\n\t{\n\t\t// m_playerName = CloneString( name );\n\t\tm_playerName = new char[strlen( name ) + 1];\n\t\tstrcpy( m_playerName, name );\n\t\t// m_playerName[sizeof( m_locationString ) - 1] = '\\0';\n\t}\n\n\tRebuildLabelText();\n}\n\nvoid CVoiceLabel::RebuildLabelText()\n{\n\tconst int BufLen = 512;\n\t// wchar_t buf[BufLen] = L\"\";\n\tchar buf[BufLen] = \"\";\n\tif ( m_playerName )\n\t{\n\t\t// wchar_t wsPlayer[BufLen] = L\"\";\n\n\t\t// localize()->ConvertANSIToUnicode( m_playerName, wsPlayer, sizeof( wsPlayer ) );\n\n\t\t// const wchar_t *formatStr = L\"%ls   \";\n\t\tconst char *locStr = Localize( \"#Voice_Location\" );\n\n\t\tif ( m_locationString )\n\t\t{\n\t\t\tif ( !strcmp( locStr, \"#Voice_Location\" ) )\n\t\t\t{\n\t\t\t\tsnprintf( buf, BufLen, \"%s @ %s   \", m_playerName, m_locationString );\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tconst char *tokens[2] = { m_playerName, m_locationString };\n\t\t\t\tint tokenIdx = 0;\n\n\t\t\t\tCUtlString result;\n\t\t\t\tfor ( const char *src = locStr; *src; )\n\t\t\t\t{\n\t\t\t\t\tif ( src[0] == '%' && src[1] == 's' && tokenIdx < 2 )\n\t\t\t\t\t{\n\t\t\t\t\t\tresult += tokens[tokenIdx++];\n\t\t\t\t\t\tsrc += 2;\n\t\t\t\t\t}\n\t\t\t\t\telse if ( src[0] == '%' && src[1] != '\\0' && src[2] == 's' && tokenIdx < 2 )\n\t\t\t\t\t{\n\t\t\t\t\t\tresult += tokens[tokenIdx++];\n\t\t\t\t\t\tsrc += 3;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tresult.AppendChar( *src++ );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tstrncpy( buf, result.String(), BufLen - 1 );\n\t\t\t\tbuf[BufLen - 1] = '\\0';\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tsnprintf( buf, BufLen, \"%s   \", m_playerName );\n\t\t}\n\t\t// _snwprintf( buf, BufLen, formatStr, wsPlayer, m_locationString );\n\t}\n\t// /m_pLabel->SetText( buf );\n\tstrncpy( m_buf, buf, sizeof( m_buf ) );\n\t// gEngfuncs.Con_DPrintf( \"CVoiceLabel::RebuildLabelText() - [%ls]\\n\", buf );\n}\n\n// ---------------------------------------------------------------------- //\n// CVoiceStatus.\n// ---------------------------------------------------------------------- //\n\nCVoiceStatusHud::CVoiceStatusHud()\n{\n}\n\nCVoiceStatusHud::~CVoiceStatusHud()\n{\n}\n\nint CVoiceStatusHud::Init( IVoiceStatusHelper *pHelper, IVoiceStatus *pStatus )\n{\n\tm_VoiceHeadModel = NULL;\n\n\tm_pHelper = pHelper;\n\tm_pStatus = pStatus;\n\n\tgHUD.AddHudElem( this );\n\tm_iFlags = HUD_ACTIVE;\n\n\t// m_pLocalPlayerTalkIcon = new vgui::ImagePanel( NULL, \"LocalPlayerIcon\" );\n\t// m_pLocalPlayerTalkIcon->SetParent( gViewPortInterface->GetViewPortPanel() );\n\t// m_pLocalPlayerTalkIcon->SetVisible( false );\n\t// m_pLocalPlayerTalkIcon->SetImage( scheme()->GetImage( \"gfx/vgui/icntlk_pl\", false ) );\n\tm_pLocalPlayerTalkIcon = gRenderAPI.GL_LoadTexture( \"gfx/vgui/icntlk_pl.tga\", NULL, 0, TF_NEAREST | TF_NOMIPMAP | TF_CLAMP );\n\tm_LocalPlayerTalkIconVisible = false;\n\n\tg_VoiceLabelIcon = gRenderAPI.GL_LoadTexture( \"gfx/vgui/speaker4.tga\", NULL, 0, TF_NEAREST | TF_NOMIPMAP | TF_CLAMP );\n\n\treturn 1;\n}\n\nint CVoiceStatusHud::VidInit()\n{\n\t// Figure out the voice head model height.\n\tm_VoiceHeadModelHeight = 45;\n\tchar *pFile = (char *)gEngfuncs.COM_LoadFile( \"scripts/voicemodel.txt\", 5, NULL );\n\tif ( pFile )\n\t{\n\t\tchar token[4096];\n\t\tgEngfuncs.COM_ParseFile( pFile, token );\n\t\tif ( token[0] >= '0' && token[0] <= '9' )\n\t\t{\n\t\t\tm_VoiceHeadModelHeight = (float)atof( token );\n\t\t}\n\n\t\tgEngfuncs.COM_FreeFile( pFile );\n\t}\n\n\tm_VoiceHeadModel = gEngfuncs.pfnSPR_Load( \"sprites/voiceicon.spr\" );\n\treturn TRUE;\n}\n\nvoid CVoiceStatusHud::CreateEntities()\n{\n\tif ( !m_VoiceHeadModel )\n\t\treturn;\n\n\tcl_entity_t *localPlayer = gEngfuncs.GetLocalPlayer();\n\n\tint iOutModel = 0;\n\tfor ( int i = 0; i < VOICE_MAX_PLAYERS; i++ )\n\t{\n\t\tif ( m_pStatus->GetSpeakerStatus( i ) != CVoiceStatus::VOICE_TALKING )\n\t\t{\n\t\t\tcontinue;\n\t\t}\n\n\t\tcl_entity_s *pClient = gEngfuncs.GetEntityByIndex( i + 1 );\n\n\t\t// Don't show an icon if the player is not in our PVS.\n\t\tif ( !pClient || pClient->curstate.messagenum < localPlayer->curstate.messagenum )\n\t\t\tcontinue;\n\n\t\t// Don't show an icon for dead or spectating players (ie: invisible entities).\n\t\tif ( pClient->curstate.effects & EF_NODRAW )\n\t\t\tcontinue;\n\n\t\t// Don't show an icon for the local player unless we're in thirdperson mode.\n\t\tif ( pClient == localPlayer && !cam_thirdperson )\n\t\t\tcontinue;\n\n\t\tcl_entity_s *pEnt = &m_VoiceHeadModels[iOutModel];\n\t\t++iOutModel;\n\n\t\tmemset( pEnt, 0, sizeof( *pEnt ) );\n\n\t\tpEnt->curstate.rendermode = kRenderTransAdd;\n\t\tpEnt->curstate.renderamt = 255;\n\t\tpEnt->baseline.renderamt = 255;\n\t\tpEnt->curstate.renderfx = kRenderFxNoDissipation;\n\t\tpEnt->curstate.framerate = 1;\n\t\tpEnt->curstate.frame = 0;\n\t\tpEnt->model = (struct model_s *)gEngfuncs.GetSpritePointer( m_VoiceHeadModel );\n\t\tpEnt->angles[0] = pEnt->angles[1] = pEnt->angles[2] = 0;\n\t\tpEnt->curstate.scale = 0.5f;\n\n\t\tpEnt->origin[0] = pEnt->origin[1] = 0;\n\t\tpEnt->origin[2] = 45;\n\n\t\tVectorAdd( pEnt->origin, pClient->origin, pEnt->origin );\n\n\t\t// Tell the engine.\n\t\tgEngfuncs.CL_CreateVisibleEntity( ET_NORMAL, pEnt );\n\t}\n}\n\nvoid CVoiceStatusHud::UpdateLocation( int entindex, const char *location )\n{\n\tint iClient = entindex - 1;\n\n\tif ( iClient < 0 )\n\t\treturn;\n\n\tCVoiceLabel *pLabel = FindVoiceLabel( iClient );\n\tif ( !pLabel )\n\t\treturn;\n\n\tpLabel->SetLocation( location );\n\n\tRepositionLabels();\n}\n\nCVoiceLabel *CVoiceStatusHud::FindVoiceLabel( int clientindex )\n{\n\tfor ( int i = 0; i < m_Labels.Count(); i++ )\n\t{\n\t\tif ( m_Labels[i]->GetClientIndex() == clientindex )\n\t\t\treturn m_Labels[i];\n\t}\n\n\treturn NULL;\n}\n\nCVoiceLabel *CVoiceStatusHud::GetFreeVoiceLabel()\n{\n\tCVoiceLabel *lab = FindVoiceLabel( -1 );\n\n\tif ( !lab )\n\t{\n\t\tlab = new CVoiceLabel();\n\t\tm_Labels.AddToTail( lab );\n\t}\n\n\treturn lab;\n}\n\nvoid CVoiceStatusHud::RepositionLabels()\n{\n\t// find starting position to draw from, along right-hand side of screen\n\tint y = ScreenHeight / 2;\n\n\t// Reposition active labels.\n\tfor ( int i = 0; i < m_Labels.Count(); i++ )\n\t{\n\t\tCVoiceLabel *pLabel = m_Labels[i];\n\n\t\tint textWide, textTall;\n\t\tpLabel->GetContentSize( textWide, textTall );\n\t\tpLabel->SetBounds( ScreenWidth - textWide - 8, y ); // if you adjust the x pos also play with VoiceVGUILabel in voice_status_hud.h\n\n\t\ty += textTall + 2;\n\t}\n}\n\nvoid CVoiceStatusHud::UpdateSpeakerStatus( int entindex, bool bTalking )\n{\n\tif ( entindex == -2 ) // this is the local player\n\t{\n\t\tif ( bTalking )\n\t\t{\n\t\t\t// int sizeX, sizeY;\n\t\t\t// IImage *image = m_pLocalPlayerTalkIcon->GetImage();\n\t\t\tint image = m_pLocalPlayerTalkIcon;\n\t\t\tif ( image )\n\t\t\t{\n\t\t\t\t// image->GetContentSize( sizeX, sizeY );\n\t\t\t\tm_LocalPlayerTalkIconXSize = (int)gRenderAPI.RenderGetParm( PARM_TEX_WIDTH, image );\n\t\t\t\tm_LocalPlayerTalkIconYSize = (int)gRenderAPI.RenderGetParm( PARM_TEX_HEIGHT, image );\n\n\t\t\t\t// int local_xPos = ScreenWidth - sizeX - 10;\n\t\t\t\t// int local_yPos = ScreenHeight - m_pHelper->GetAckIconHeight() - sizeY;\n\t\t\t\tint local_xPos = ScreenWidth - m_LocalPlayerTalkIconXSize - 10;\n\t\t\t\tint local_yPos = ScreenHeight - m_pHelper->GetAckIconHeight() - m_LocalPlayerTalkIconYSize;\n\t\t\t\t// m_pLocalPlayerTalkIcon->SetPos( local_xPos, local_yPos );\n\t\t\t\t// m_pLocalPlayerTalkIcon->SetVisible( true );\n\t\t\t\tm_LocalPlayerTalkIconXPos = local_xPos;\n\t\t\t\tm_LocalPlayerTalkIconYPos = local_yPos;\n\t\t\t\tm_LocalPlayerTalkIconVisible = true;\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\t// m_pLocalPlayerTalkIcon->SetVisible( false );\n\t\t\tm_LocalPlayerTalkIconVisible = false;\n\t\t}\n\t}\n\telse // a remote player, draw a label for them\n\t{\n\t\tif ( entindex >= 0 && entindex <= MAX_PLAYERS )\n\t\t{\n\t\t\tint iClient = entindex - 1;\n\t\t\tif ( iClient < 0 )\n\t\t\t\treturn;\n\n\t\t\tCVoiceLabel *pLabel = FindVoiceLabel( iClient );\n\t\t\tif ( bTalking )\n\t\t\t{\n\t\t\t\t// If we don't have a label for this guy yet, then create one.\n\t\t\t\tif ( !pLabel )\n\t\t\t\t{\n\t\t\t\t\tif ( pLabel = GetFreeVoiceLabel() )\n\t\t\t\t\t{\n\t\t\t\t\t\t// Get the name from the engine.\n\t\t\t\t\t\thud_player_info_t info;\n\t\t\t\t\t\tmemset( &info, 0, sizeof( info ) );\n\t\t\t\t\t\tgEngfuncs.pfnGetPlayerInfo( entindex, &info );\n\n\t\t\t\t\t\tint color[3];\n\t\t\t\t\t\tm_pHelper->GetPlayerTextColor( entindex, color );\n\n\t\t\t\t\t\t// pLabel->SetFgColor( Color(255, 255, 255, 255) );\n\t\t\t\t\t\t// pLabel->SetBgColor( Color(color[0], color[1], color[2], 180) );\n\t\t\t\t\t\tpLabel->SetFgColor( RGBA( { 255, 255, 255, 255 } ) );\n\t\t\t\t\t\tpLabel->SetBgColor( RGBA( { (unsigned char)color[0], (unsigned char)color[1], (unsigned char)color[2], 180 } ) );\n\t\t\t\t\t\tpLabel->SetPlayerName( info.name );\n\t\t\t\t\t\tpLabel->SetLocation( m_pHelper->GetPlayerLocation( entindex ) );\n\t\t\t\t\t\tpLabel->SetClientIndex( iClient );\n\t\t\t\t\t\tif ( m_pHelper )\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif ( m_pHelper->CanShowSpeakerLabels() )\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tpLabel->SetVisible( true );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tpLabel->SetVisible( true );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t// If we have a label for this guy, kill it.\n\t\t\t\tif ( pLabel )\n\t\t\t\t{\n\t\t\t\t\tpLabel->SetVisible( false );\n\t\t\t\t\tpLabel->SetClientIndex( -1 );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tRepositionLabels();\n}\n\nvoid CVoiceStatusHud::Shutdown( void )\n{\n\tgRenderAPI.GL_FreeTexture( m_pLocalPlayerTalkIcon );\n\tgRenderAPI.GL_FreeTexture( g_VoiceLabelIcon );\n}\n\nint CVoiceStatusHud::Draw( float flTime )\n{\n\tif ( m_LocalPlayerTalkIconVisible && m_pLocalPlayerTalkIcon )\n\t{\n\t\tgRenderAPI.GL_SelectTexture( 0 );\n\t\tgRenderAPI.GL_Bind( 0, m_pLocalPlayerTalkIcon );\n\t\tgEngfuncs.pTriAPI->RenderMode( kRenderTransTexture );\n\t\tgEngfuncs.pTriAPI->Color4f( 1.0f, 1.0f, 1.0f, 1.0f );\n\t\tDrawUtils::Draw2DQuad( m_LocalPlayerTalkIconXPos * gHUD.m_flScale,\n\t\t                       m_LocalPlayerTalkIconYPos * gHUD.m_flScale,\n\t\t                       ( m_LocalPlayerTalkIconXPos + m_LocalPlayerTalkIconXSize ) * gHUD.m_flScale,\n\t\t                       ( m_LocalPlayerTalkIconYPos + m_LocalPlayerTalkIconYSize ) * gHUD.m_flScale );\n\t}\n\n\tfor ( int i = 0; i < m_Labels.Count(); i++ )\n\t\tm_Labels[i]->Draw();\n\n\treturn 1;\n}"
  },
  {
    "path": "game_shared/voice_status_hud.h",
    "content": "//========= Copyright � 1996-2001, Valve LLC, All rights reserved. ============\n//\n// Purpose:\n//\n// $NoKeywords: $\n//=============================================================================\n\n#ifndef VOICE_STATUS_HUD_H\n#define VOICE_STATUS_HUD_H\n#pragma once\n\n#include <utlvector.h>\n// #include <vgui_controls/Panel.h>\n// #include <vgui_controls/Label.h>\n// #include <vgui_controls/ImagePanel.h>\n// #include <color.h>\n// #include <vgui/IScheme.h>\n// #include <vgui_controls/Controls.h>\n\n#ifdef CZERO\n#include \"vgui/hl_base/iviewport.h\"\n#else\n// #include <game_controls/iviewport.h>\n#endif\n\n#include \"voice_common.h\"\n#include \"cl_entity.h\"\n#include \"voice_banmgr.h\"\n#include \"draw_util.h\"\n#include \"triangleapi.h\"\n\nextern int g_VoiceLabelIcon;\n\n//-----------------------------------------------------------------------------\n// Purpose: a label which displays a name and a speaking icon\n//-----------------------------------------------------------------------------\nclass CVoiceLabel\n{\npublic:\n\tCVoiceLabel()\n\t{\n\t\t// m_pLabel = new VoiceVGUILabel( /*NULL,*/ \"VoiceLabel\", \"\" );\n\t\t// m_pLabel->SetParent( gViewPortInterface->GetViewPortPanel() );\n\t\t// m_pLabel->SetProportional(true);\n\t\t// m_pLabel->SetScheme(\"ClientScheme\");\n\t\t// vgui::SETUP_PANEL(m_pLabel);\n\t\tm_clientindex = -1; // -1 means unassigned\n\t\tm_locationString = NULL;\n\t\tm_playerName = NULL;\n\t}\n\n\t~CVoiceLabel()\n\t{\n\t\t// m_pLabel->MarkForDeletion();\n\t}\n\n\t// pass throughs for various label calls\n\tvoid SetFgColor( RGBA c ) { m_fgColor = c; }\n\tvoid SetBgColor( RGBA c ) { m_bgColor = c; }\n\tvoid SetVisible( bool state ) { m_visible = state; }\n\tbool GetVisible() { return m_visible; }\n\n\tvoid GetContentSize( int &wide, int &tall )\n\t{\n\t\t// m_pLabel->GetContentSize( wide, tall );\n\t\twide = DrawUtils::HudStringLen( m_buf );\n\n\t\ttall = gHUD.GetCharHeight();\n\n\t\tif ( tall < 32 )\n\t\t\ttall = 32;\n\n\t\twide += tall - 2;\n\t}\n\n\tvoid SetBounds( int x, int y )\n\t{\n\t\t// m_pLabel->SetPos( x, y );\n\t\tthis->x = x;\n\t\tthis->y = y;\n\t\t// int wide, tall;\n\t\t// m_pLabel->GetContentSize( wide, tall );\n\t\t// m_pLabel->SetSize( wide, tall );\n\t\tGetContentSize( wide, tall );\n\t}\n\n\tvoid Draw()\n\t{\n\t\tif ( !GetVisible() )\n\t\t\treturn;\n\n\t\tint offset = 1;\n\t\tint iconsize = tall - offset * 2;\n\n\t\tgEngfuncs.pfnFillRGBABlend( x, y, wide, tall, m_bgColor.r, m_bgColor.g, m_bgColor.b, m_bgColor.a );\n\n\t\tgRenderAPI.GL_SelectTexture( 0 );\n\t\tgRenderAPI.GL_Bind( 0, g_VoiceLabelIcon );\n\t\tgEngfuncs.pTriAPI->RenderMode( kRenderTransTexture );\n\t\tgEngfuncs.pTriAPI->Color4f( 1.0f, 1.0f, 1.0f, 1.0f );\n\t\tDrawUtils::Draw2DQuad( x * gHUD.m_flScale,\n\t\t                       ( y + offset ) * gHUD.m_flScale,\n\t\t                       ( x + iconsize ) * gHUD.m_flScale,\n\t\t                       ( y + iconsize + offset ) * gHUD.m_flScale );\n\n\t\tint textx = x + iconsize + offset;\n\t\tint texty = y + ( tall - gHUD.GetCharHeight() ) / 2;\n\t\tDrawUtils::DrawHudString( textx, texty, textx + wide, m_buf, m_fgColor.r, m_fgColor.g, m_fgColor.b );\n\t}\n\n\tvoid SetClientIndex( int in ) { m_clientindex = in; }\n\tint GetClientIndex() { return m_clientindex; }\n\n\tvoid SetLocation( const char *location );\n\tvoid SetPlayerName( const char *name );\n\nprivate:\n\t//-----------------------------------------------------------------------------\n\t// Purpose: inner class that overrides ApplySchemeSettings() for the label so an image can be loaded, also saves colors away\n\t//   so ApplySchemeSettings() doesn't override them\n\t//-----------------------------------------------------------------------------\n\t// class VoiceVGUILabel // : public vgui::Label\n\t// {\n\t// public:\n\t// \tVoiceVGUILabel( /* vgui::Panel *parent,*/ const char *name, const char *text ) /*: Label(parent, name, text)*/ { }\n\n\t// private:\n\t// VGUI2 overrides\n\t// virtual void ApplySchemeSettings(vgui::IScheme *pScheme)\n\t// {\n\t// \tLabel::ApplySchemeSettings(pScheme);\n\t// \tSetTextImageIndex(1);\n\t// \tSetImagePreOffset( 1, 2); // shift the text over a little\n\t// \t// you need to load the image here, after Label::ApplySchemeSettings()(as applysettings nulls out all existing images)\n\t// \tSetImageAtIndex( 0, vgui::scheme()->GetImage( \"gfx/vgui/speaker4\", false), 1 );\n\t// }\n\t// };\n\n\tvoid RebuildLabelText();\n\n\t// VoiceVGUILabel *m_pLabel; // the label with the user name and icon\n\tint m_clientindex;      // Client index of the speaker. -1 if this label isn't being used.\n\tchar *m_locationString; // localized location string.  NULL if the location is \"\".\n\tchar *m_playerName;\n\n\tRGBA m_fgColor;\n\tRGBA m_bgColor;\n\tbool m_visible;\n\n\tint x, y, wide, tall;\n\tchar m_buf[512];\n\tint iconwidth;\n};\n\n//-----------------------------------------------------------------------------\n// Purpose: Handles the displaying of labels on the hud and icons above players in game when they talk\n//-----------------------------------------------------------------------------\nclass CVoiceStatusHud : public IVoiceHud, public CHudBase\n{\npublic:\n\tCVoiceStatusHud();\n\tvirtual ~CVoiceStatusHud();\n\n\t// CHudBase overrides.\n\t// Initialize the cl_dll's voice manager.\n\tvirtual int Init( IVoiceStatusHelper *pHelper, IVoiceStatus *pStatus );\n\n\t// ackPosition is the bottom position of where CVoiceStatus will draw the voice acknowledgement labels.\n\tvirtual int VidInit();\n\n\t// Call from the HUD_CreateEntities function so it can add sprites above player heads.\n\tvoid CreateEntities();\n\n\tvoid UpdateLocation( int entindex, const char *location );\n\n\tvoid UpdateSpeakerStatus( int entindex, bool bTalking );\n\n\tCVoiceLabel *FindVoiceLabel( int clientindex ); // Find a CVoiceLabel representing the specified speaker.\n\t                                                // Returns NULL if none.\n\t                                                // entindex can be -1 if you want a currently-unused voice label.\n\tCVoiceLabel *GetFreeVoiceLabel();               // Get an unused voice label. Returns NULL if none.\n\tvoid RepositionLabels();\n\n\tvoid Shutdown( void );\n\tint Draw( float flTime );\n\nprivate:\n\tcl_entity_s m_VoiceHeadModels[VOICE_MAX_PLAYERS]; // These aren't necessarily in the order of players. They are just\n\t                                                  // a place for it to put data in during CreateEntities.\n\tHSPRITE m_VoiceHeadModel;                         // Voice head model (goes above players who are speaking).\n\tfloat m_VoiceHeadModelHeight;                     // Height above their head to place the model.\n\n\tIVoiceStatusHelper *m_pHelper;\n\tIVoiceStatus *m_pStatus;\n\n\t// Labels telling who is speaking.\n\tCUtlVector<CVoiceLabel *> m_Labels;\n\n\t// vgui::ImagePanel *m_pLocalPlayerTalkIcon;\n\tint m_pLocalPlayerTalkIcon;\n\n\tbool m_LocalPlayerTalkIconVisible;\n\tint m_LocalPlayerTalkIconXPos, m_LocalPlayerTalkIconYPos;\n\tint m_LocalPlayerTalkIconXSize, m_LocalPlayerTalkIconYSize;\n};\n\n#endif // VOICE_STATUS_HUD_H\n"
  },
  {
    "path": "pm_shared/pm_debug.cpp",
    "content": "#include \"mathlib.h\"\n#include \"const.h\"\n#include \"usercmd.h\"\n#include \"pm_defs.h\"\n#include \"pm_shared.h\"\n#include \"pm_movevars.h\"\n#include \"pm_debug.h\"\n\n#include <string.h>\n#undef vec3_t\n\n// Expand debugging BBOX particle hulls by this many units.\n#define BOX_GAP 0.0f\n\nint PM_boxpnt[6][4] =\n{\n\t{ 0, 4, 6, 2 }, // +X\n\t{ 0, 1, 5, 4 }, // +Y\n\t{ 0, 2, 3, 1 }, // +Z\n\t{ 7, 5, 1, 3 }, // -X\n\t{ 7, 3, 2, 6 }, // -Y\n\t{ 7, 6, 4, 5 }, // -Z\n};\n\nvoid PM_ShowClipBox()\n{\n#ifdef _DEBUG\n\tif (!pmove->runfuncs)\n\t\treturn;\n\n\t// More debugging, draw the particle bbox for player and for the entity we are looking directly at.\n\t// aslo prints entity info to the console overlay.\n\tif (!pmove->server)\n\t\treturn;\n\n\t// Draw entity in center of view\n\t// Also draws the normal to the clip plane that intersects our movement ray. Leaves a particle\n\t// trail at the intersection point.\n\tPM_ViewEntity();\n\n\t// Show our BBOX in particles.\n \t//PM_DrawBBox(pmove->player_mins[pmove->usehull], pmove->player_maxs[pmove->usehull], pmove->origin, 132, 0.1);\n/*\n\t{\n\t\tint i;\n\t\tfor (i = 0; i < pmove->numphysent; i++)\n\t\t{\n\t\t\tif (pmove->physents[ i ].info >= 1 && pmove->physents[ i ].info <= 4)\n\t\t\t{\n\t\t\t \tPM_DrawBBox(pmove->player_mins[pmove->usehull], pmove->player_maxs[pmove->usehull], pmove->physents[i].origin, 132, 0.1);\n\t\t\t}\n\t\t}\n\t}\n*/\n#endif // _DEBUG\n}\n\nvoid PM_ParticleLine(vec3_t start, vec3_t end, int pcolor, float life, float vert)\n{\n\tfloat linestep = 2.0f;\n\tfloat curdist;\n\tfloat len;\n\tvec3_t curpos;\n\tvec3_t diff;\n\tint i;\n\t// Determine distance;\n\n\tVectorSubtract(end, start, diff);\n\n\tlen = VectorNormalize(diff);\n\n\tcurdist = 0;\n\twhile (curdist <= len)\n\t{\n\t\tfor (i = 0; i < 3; ++i)\n\t\t\tcurpos[i] = start[i] + curdist * diff[i];\n\n\t\tpmove->PM_Particle(curpos, pcolor, life, 0, vert);\n\t\tcurdist += linestep;\n\t}\n}\n\nvoid PM_DrawRectangle(vec3_t tl, vec3_t bl, vec3_t tr, vec3_t br, int pcolor, float life)\n{\n\tPM_ParticleLine(tl, bl, pcolor, life, 0);\n\tPM_ParticleLine(bl, br, pcolor, life, 0);\n\tPM_ParticleLine(br, tr, pcolor, life, 0);\n\tPM_ParticleLine(tr, tl, pcolor, life, 0);\n}\n\nvoid PM_DrawPhysEntBBox(int num, int pcolor, float life)\n{\n\tphysent_t *pe;\n\tvec3_t org;\n\tint j;\n\tvec3_t tmp;\n\tvec3_t p[8];\n\tfloat gap = BOX_GAP;\n\tvec3_t modelmins, modelmaxs;\n\n\tif (num >= pmove->numphysent || num <= 0)\n\t\treturn;\n\n\tpe = &pmove->physents[num];\n\n\tif (pe->model)\n\t{\n\t\tVectorCopy(pe->origin, org);\n\n\t\tpmove->PM_GetModelBounds(pe->model, modelmins, modelmaxs);\n\t\tfor (j = 0; j < 8; ++j)\n\t\t{\n\t\t\ttmp[0] = (j & 1) ? modelmins[0] - gap : modelmaxs[0] + gap;\n\t\t\ttmp[1] = (j & 2) ? modelmins[1] - gap : modelmaxs[1] + gap;\n\t\t\ttmp[2] = (j & 4) ? modelmins[2] - gap : modelmaxs[2] + gap;\n\n\t\t\tVectorCopy(tmp, p[j]);\n\t\t}\n\n\t\t// If the bbox should be rotated, do that\n\t\tif (pe->angles[0] || pe->angles[1] || pe->angles[2])\n\t\t{\n\t\t\tvec3_t forward, right, up;\n\n\t\t\tAngleVectorsTranspose(pe->angles, forward, right, up);\n\t\t\tfor (j = 0; j < 8; ++j)\n\t\t\t{\n\t\t\t\tVectorCopy(p[j], tmp);\n\t\t\t\tp[j][0] = DotProduct(tmp, forward);\n\t\t\t\tp[j][1] = DotProduct(tmp, right);\n\t\t\t\tp[j][2] = DotProduct(tmp, up);\n\t\t\t}\n\t\t}\n\n\t\t// Offset by entity origin, if any.\n\t\tfor (j = 0; j < 8; ++j)\n\t\t\tVectorAdd(p[j], org, p[j]);\n\n\t\tfor (j = 0; j < 6; ++j)\n\t\t{\n\t\t\tPM_DrawRectangle(\n\t\t\t\tp[PM_boxpnt[j][1]],\n\t\t\t\tp[PM_boxpnt[j][0]],\n\t\t\t\tp[PM_boxpnt[j][2]],\n\t\t\t\tp[PM_boxpnt[j][3]],\n\t\t\t\tpcolor, life);\n\t\t}\n\t}\n\telse\n\t{\n\t\tfor (j = 0; j < 8; ++j)\n\t\t{\n\t\t\ttmp[0] = (j & 1) ? pe->mins[0] : pe->maxs[0];\n\t\t\ttmp[1] = (j & 2) ? pe->mins[1] : pe->maxs[1];\n\t\t\ttmp[2] = (j & 4) ? pe->mins[2] : pe->maxs[2];\n\n\t\t\tVectorAdd(tmp, pe->origin, tmp);\n\t\t\tVectorCopy(tmp, p[j]);\n\t\t}\n\n\t\tfor (j = 0; j < 6; ++j)\n\t\t{\n\t\t\tPM_DrawRectangle(\n\t\t\t\tp[PM_boxpnt[j][1]],\n\t\t\t\tp[PM_boxpnt[j][0]],\n\t\t\t\tp[PM_boxpnt[j][2]],\n\t\t\t\tp[PM_boxpnt[j][3]],\n\t\t\t\tpcolor, life);\n\t\t}\n\t}\n}\n\nvoid PM_DrawBBox(vec3_t mins, vec3_t maxs, vec3_t origin, int pcolor, float life)\n{\n\tint j;\n\n\tvec3_t tmp;\n\tvec3_t p[8];\n\tfloat gap = BOX_GAP;\n\n\tfor (j = 0; j < 8; ++j)\n\t{\n\t\ttmp[0] = (j & 1) ? mins[0] - gap : maxs[0] + gap;\n\t\ttmp[1] = (j & 2) ? mins[1] - gap : maxs[1] + gap;\n\t\ttmp[2] = (j & 4) ? mins[2] - gap : maxs[2] + gap;\n\n\t\tVectorAdd(tmp, origin, tmp);\n\t\tVectorCopy(tmp, p[j]);\n\t}\n\n\tfor (j = 0; j < 6; ++j)\n\t{\n\t\tPM_DrawRectangle(\n\t\t\tp[PM_boxpnt[j][1]],\n\t\t\tp[PM_boxpnt[j][0]],\n\t\t\tp[PM_boxpnt[j][2]],\n\t\t\tp[PM_boxpnt[j][3]],\n\t\t\tpcolor, life);\n\t}\n}\n\n// Shows a particle trail from player to entity in crosshair.\n// Shows particles at that entities bbox\n// Tries to shoot a ray out by about 128 units.\n\nvoid PM_ViewEntity()\n{\n\tvec3_t forward, right, up;\n\tfloat raydist = 256.0f;\n\tvec3_t origin;\n\tvec3_t end;\n\tint i;\n\tpmtrace_t trace;\n\tint pcolor = 77;\n\tfloat fup;\n\n#if 0\n\tif (!pm_showclip.value)\n\t\treturn;\n#endif\n\n\t// Determine movement angles\n\tAngleVectors(pmove->angles, forward, right, up);\n\n\tVectorCopy(pmove->origin, origin);\n\n\tfup = 0.5 * (pmove->player_mins[pmove->usehull][2] + pmove->player_maxs[pmove->usehull][2]);\n\tfup += pmove->view_ofs[2];\n\tfup -= 4;\n\n\tfor (i = 0; i < 3; i++)\n\t{\n\t\tend[i] = origin[i] + raydist * forward[i];\n\t}\n\n\ttrace = pmove->PM_PlayerTrace(origin, end, PM_STUDIO_BOX, -1);\n\n\t// Not the world\n\tif (trace.ent > 0)\n\t{\n\t\tpcolor = 111;\n\t\t// Draw the hull or bbox.\n\t\tPM_DrawPhysEntBBox(trace.ent, pcolor, 0.3f);\n\t}\n}\n"
  },
  {
    "path": "pm_shared/pm_debug.h",
    "content": "/*\n*\n*   This program is free software; you can redistribute it and/or modify it\n*   under the terms of the GNU General Public License as published by the\n*   Free Software Foundation; either version 2 of the License, or (at\n*   your option) any later version.\n*\n*   This program is distributed in the hope that it will be useful, but\n*   WITHOUT ANY WARRANTY; without even the implied warranty of\n*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n*   General Public License for more details.\n*\n*   You should have received a copy of the GNU General Public License\n*   along with this program; if not, write to the Free Software Foundation,\n*   Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\n*\n*   In addition, as a special exception, the author gives permission to\n*   link the code of this program with the Half-Life Game Engine (\"HL\n*   Engine\") and Modified Game Libraries (\"MODs\") developed by Valve,\n*   L.L.C (\"Valve\").  You must obey the GNU General Public License in all\n*   respects for all of the code used other than the HL Engine and MODs\n*   from Valve.  If you modify this file, you may extend this exception\n*   to your version of the file, but you are not obligated to do so.  If\n*   you do not wish to do so, delete this exception statement from your\n*   version.\n*\n*/\n\n#ifndef PM_DEBUG_H\n#define PM_DEBUG_H\n#ifdef _WIN32\n#pragma once\n#endif\n\nvoid PM_ShowClipBox();\nvoid PM_ParticleLine(vec3_t start, vec3_t end, int pcolor, float life, float vert);\nvoid PM_DrawRectangle(vec3_t tl, vec3_t bl, vec3_t tr, vec3_t br, int pcolor, float life);\nvoid PM_DrawPhysEntBBox(int num, int pcolor, float life);\nvoid PM_DrawBBox(vec3_t mins, vec3_t maxs, vec3_t origin, int pcolor, float life);\nvoid PM_ViewEntity();\n\n#endif // PM_DEBUG_H\n"
  },
  {
    "path": "pm_shared/pm_defs.h",
    "content": "/*\n*\n*   This program is free software; you can redistribute it and/or modify it\n*   under the terms of the GNU General Public License as published by the\n*   Free Software Foundation; either version 2 of the License, or (at\n*   your option) any later version.\n*\n*   This program is distributed in the hope that it will be useful, but\n*   WITHOUT ANY WARRANTY; without even the implied warranty of\n*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n*   General Public License for more details.\n*\n*   You should have received a copy of the GNU General Public License\n*   along with this program; if not, write to the Free Software Foundation,\n*   Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\n*\n*   In addition, as a special exception, the author gives permission to\n*   link the code of this program with the Half-Life Game Engine (\"HL\n*   Engine\") and Modified Game Libraries (\"MODs\") developed by Valve,\n*   L.L.C (\"Valve\").  You must obey the GNU General Public License in all\n*   respects for all of the code used other than the HL Engine and MODs\n*   from Valve.  If you modify this file, you may extend this exception\n*   to your version of the file, but you are not obligated to do so.  If\n*   you do not wish to do so, delete this exception statement from your\n*   version.\n*\n*/\n\n#ifndef PM_DEFS_H\n#define PM_DEFS_H\n#ifdef _WIN32\n#pragma once\n#endif\n\n#include \"pm_info.h\"\n#include \"pmtrace.h\"\n\n#ifndef USERCMD_H\n#include \"usercmd.h\"\n#endif\n\n#include \"const.h\"\n\n#define MAX_PHYSENTS 600 \t\t  \t\t// Must have room for all entities in the world.\n#define MAX_MOVEENTS 64\n#define MAX_CLIP_PLANES\t5\n\n#define PM_NORMAL\t\t\t\t0x00000000\n#define PM_STUDIO_IGNORE\t\t0x00000001\t// Skip studio models\n#define PM_STUDIO_BOX\t\t\t0x00000002\t// Use boxes for non-complex studio models (even in traceline)\n#define PM_GLASS_IGNORE\t\t\t0x00000004\t// Ignore entities with non-normal rendermode\n#define PM_WORLD_ONLY\t\t\t0x00000008\t// Only trace against the world\n\n#define PM_TRACELINE_PHYSENTSONLY\t0\n#define PM_TRACELINE_ANYVISIBLE\t\t1\n\ntypedef struct physent_s\n{\n\tchar name[32];\t\t\t\t\t// Name of model, or \"player\" or \"world\".\n\tint player;\n\tvec3_t origin;\t\t\t\t\t// Model's origin in world coordinates.\n\tstruct model_s *model;\t\t\t// only for bsp models\n\tstruct model_s *studiomodel;\t// SOLID_BBOX, but studio clip intersections.\n\tvec3_t mins, maxs;\t\t\t\t// only for non-bsp models\n\tint info;\t\t\t\t\t\t// For client or server to use to identify (index into edicts or cl_entities)\n\tvec3_t angles;\t\t\t\t\t// rotated entities need this info for hull testing to work.\n\n\tint solid;\t\t\t\t\t\t// Triggers and func_door type WATER brushes are SOLID_NOT\n\tint skin;\t\t\t\t\t\t// BSP Contents for such things like fun_door water brushes.\n\tint rendermode;\t\t\t\t\t// So we can ignore glass\n\n\tfloat frame;\n\tint sequence;\n\tbyte controller[4];\n\tbyte blending[2];\n\n\tint movetype;\n\tint takedamage;\n\tint blooddecal;\n\tint team;\n\tint classnumber;\n\n\tint iuser1;\n\tint iuser2;\n\tint iuser3;\n\tint iuser4;\n\tfloat fuser1;\n\tfloat fuser2;\n\tfloat fuser3;\n\tfloat fuser4;\n\tvec3_t vuser1;\n\tvec3_t vuser2;\n\tvec3_t vuser3;\n\tvec3_t vuser4;\n\n} physent_t;\n\ntypedef struct playermove_s\n{\n\tint player_index;\t\t\t\t// So we don't try to run the PM_CheckStuck nudging too quickly.\n\tqboolean server;\t\t\t\t// For debugging, are we running physics code on server side?\n\tqboolean multiplayer;\t\t\t// 1 == multiplayer server\n\tfloat time;\t\t\t\t\t\t// realtime on host, for reckoning duck timing\n\tfloat frametime;\t\t\t\t// Duration of this frame\n\tvec3_t forward, right, up;\t\t// Vectors for angles\n\tvec3_t origin;\t\t\t\t\t// Movement origin.\n\tvec3_t angles;\t\t\t\t\t// Movement view angles.\n\tvec3_t oldangles;\t\t\t\t// Angles before movement view angles were looked at.\n\tvec3_t velocity;\t\t\t\t// Current movement direction.\n\tvec3_t movedir;\t\t\t\t\t// For waterjumping, a forced forward velocity so we can fly over lip of ledge.\n\tvec3_t basevelocity;\t\t\t// Velocity of the conveyor we are standing, e.g.\n\tvec3_t view_ofs;\t\t\t\t// For ducking/dead\n\t\t\t\t\t\t\t\t\t// Our eye position.\n\tfloat flDuckTime;\t\t\t\t// Time we started duck\n\tqboolean bInDuck;\t\t\t\t// In process of ducking or ducked already?\n\tint flTimeStepSound;\t\t\t// For walking/falling\n\t\t\t\t\t\t\t\t\t// Next time we can play a step sound\n\tint iStepLeft;\n\tfloat flFallVelocity;\n\tvec3_t punchangle;\n\tfloat flSwimTime;\n\tfloat flNextPrimaryAttack;\n\tint effects;\t\t\t\t\t// MUZZLE FLASH, e.g.\n\tint flags;\t\t\t\t\t\t// FL_ONGROUND, FL_DUCKING, etc.\n\tint usehull;\t\t\t\t\t// 0 = regular player hull, 1 = ducked player hull, 2 = point hull\n\tfloat gravity;\t\t\t\t\t// Our current gravity and friction.\n\tfloat friction;\n\tint oldbuttons;\t\t\t\t\t// Buttons last usercmd\n\tfloat waterjumptime;\t\t\t// Amount of time left in jumping out of water cycle.\n\tqboolean dead;\t\t\t\t\t// Are we a dead player?\n\tint deadflag;\n\tint spectator;\t\t\t\t\t// Should we use spectator physics model?\n\tint movetype;\t\t\t\t\t// Our movement type, NOCLIP, WALK, FLY\n\tint onground;\t\t\t\t\t// -1 = in air, else pmove entity number\n\tint waterlevel;\n\tint watertype;\n\tint oldwaterlevel;\n\tchar sztexturename[256];\n\tchar chtexturetype;\n\tfloat maxspeed;\n\tfloat clientmaxspeed;\n\tint iuser1;\n\tint iuser2;\n\tint iuser3;\n\tint iuser4;\n\tfloat fuser1;\n\tfloat fuser2;\n\tfloat fuser3;\n\tfloat fuser4;\n\tvec3_t vuser1;\n\tvec3_t vuser2;\n\tvec3_t vuser3;\n\tvec3_t vuser4;\n\tint numphysent;\t\t\t\t\t\t// world state\n\t\t\t\t\t\t\t\t\t\t// Number of entities to clip against.\n\tphysent_t physents[MAX_PHYSENTS];\n\tint nummoveent;\t\t\t\t\t\t// Number of momvement entities (ladders)\n\tphysent_t moveents[MAX_MOVEENTS];\t// just a list of ladders\n\tint numvisent;\t\t\t\t\t\t// All things being rendered, for tracing against things you don't actually collide with\n\tphysent_t visents[MAX_PHYSENTS];\n\tusercmd_t cmd;\t\t\t\t\t\t// input to run through physics.\n\tint numtouch;\t\t\t\t\t\t// Trace results for objects we collided with.\n\tpmtrace_t touchindex[MAX_PHYSENTS];\n\tchar physinfo[MAX_PHYSINFO_STRING];\t// Physics info string\n\tstruct movevars_s *movevars;\n\tvec_t player_mins[4][3];\n\tvec_t player_maxs[4][3];\n\n\tconst char *(*PM_Info_ValueForKey)(const char *s, const char *key);\n\tvoid (*PM_Particle)(float *origin, int color, float life, int zpos, int zvel);\n\tint (*PM_TestPlayerPosition)(float *pos, pmtrace_t *ptrace);\n\tvoid (*Con_NPrintf)(int idx, char *fmt, ...);\n\tvoid (*Con_DPrintf)(const char *fmt, ...);\n\tvoid (*Con_Printf)(const char *fmt, ...);\n\tdouble (*Sys_FloatTime)();\n\tvoid (*PM_StuckTouch)(int hitent, pmtrace_t *ptraceresult);\n\tint (*PM_PointContents)(float *p, int *truecontents);\n\tint (*PM_TruePointContents)(float *p);\n\tint (*PM_HullPointContents)(struct hull_s *hull, int num, float *p);\n\tpmtrace_t (*PM_PlayerTrace)(float *start, float *end, int traceFlags, int ignore_pe);\n\tstruct pmtrace_s *(*PM_TraceLine)(float *start, float *end, int flags, int usehulll, int ignore_pe);\n\tint (*RandomLong)(int lLow, int lHigh);\n\tfloat (*RandomFloat)(float flLow, float flHigh);\n\tint (*PM_GetModelType)(struct model_s *mod);\n\tvoid (*PM_GetModelBounds)(struct model_s *mod, float *mins, float *maxs);\n\tvoid *(*PM_HullForBsp)(physent_t *pe, float *offset);\n\tfloat (*PM_TraceModel)(physent_t *pEnt, float *start, float *end, trace_t *trace);\n\tint (*COM_FileSize)(char *filename);\n\tbyte *(*COM_LoadFile)(const char *path, int usehunk, int *pLength);\n\tvoid (*COM_FreeFile)(void *buffer);\n\tchar *(*memfgets)(byte *pMemFile, int fileSize, int *pFilePos, char *pBuffer, int bufferSize);\n\tqboolean runfuncs;\n\tvoid (*PM_PlaySound)(int channel, const char *sample, float volume, float attenuation, int fFlags, int pitch);\n\tconst char *(*PM_TraceTexture)(int ground, float *vstart, float *vend);\n\tvoid (*PM_PlaybackEventFull)(int flags, int clientindex, unsigned short eventindex, float delay, float *origin, float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2);\n\n\tpmtrace_t (*PM_PlayerTraceEx)(float *start, float *end, int traceFlags, int (*pfnIgnore)(physent_t *pe));\n\tint (*PM_TestPlayerPositionEx)(float *pos, pmtrace_t *ptrace, int (*pfnIgnore)(physent_t *pe));\n\tstruct pmtrace_s *(*PM_TraceLineEx)(float *start, float *end, int flags, int usehulll, int (*pfnIgnore)(physent_t *pe));\n\n} playermove_t;\n\n#endif // PM_DEFS_H\n"
  },
  {
    "path": "pm_shared/pm_info.h",
    "content": "/*\n*\n*   This program is free software; you can redistribute it and/or modify it\n*   under the terms of the GNU General Public License as published by the\n*   Free Software Foundation; either version 2 of the License, or (at\n*   your option) any later version.\n*\n*   This program is distributed in the hope that it will be useful, but\n*   WITHOUT ANY WARRANTY; without even the implied warranty of\n*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n*   General Public License for more details.\n*\n*   You should have received a copy of the GNU General Public License\n*   along with this program; if not, write to the Free Software Foundation,\n*   Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\n*\n*   In addition, as a special exception, the author gives permission to\n*   link the code of this program with the Half-Life Game Engine (\"HL\n*   Engine\") and Modified Game Libraries (\"MODs\") developed by Valve,\n*   L.L.C (\"Valve\").  You must obey the GNU General Public License in all\n*   respects for all of the code used other than the HL Engine and MODs\n*   from Valve.  If you modify this file, you may extend this exception\n*   to your version of the file, but you are not obligated to do so.  If\n*   you do not wish to do so, delete this exception statement from your\n*   version.\n*\n*/\n\n#ifndef PM_INFO_H\n#define PM_INFO_H\n#ifdef _WIN32\n#pragma once\n#endif\n\n#define MAX_PHYSINFO_STRING 256\n\n#endif // PM_INFO_H\n"
  },
  {
    "path": "pm_shared/pm_materials.h",
    "content": "/*\n*\n*   This program is free software; you can redistribute it and/or modify it\n*   under the terms of the GNU General Public License as published by the\n*   Free Software Foundation; either version 2 of the License, or (at\n*   your option) any later version.\n*\n*   This program is distributed in the hope that it will be useful, but\n*   WITHOUT ANY WARRANTY; without even the implied warranty of\n*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n*   General Public License for more details.\n*\n*   You should have received a copy of the GNU General Public License\n*   along with this program; if not, write to the Free Software Foundation,\n*   Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\n*\n*   In addition, as a special exception, the author gives permission to\n*   link the code of this program with the Half-Life Game Engine (\"HL\n*   Engine\") and Modified Game Libraries (\"MODs\") developed by Valve,\n*   L.L.C (\"Valve\").  You must obey the GNU General Public License in all\n*   respects for all of the code used other than the HL Engine and MODs\n*   from Valve.  If you modify this file, you may extend this exception\n*   to your version of the file, but you are not obligated to do so.  If\n*   you do not wish to do so, delete this exception statement from your\n*   version.\n*\n*/\n\n#ifndef PM_MATERIALS_H\n#define PM_MATERIALS_H\n#ifdef _WIN32\n#pragma once\n#endif\n\n#define CTEXTURESMAX\t\t1024\t// max number of textures loaded\n#define CBTEXTURENAMEMAX\t17\t// only load first n chars of name\n\n#define CHAR_TEX_CONCRETE\t'C'\t// texture types\n#define CHAR_TEX_METAL\t\t'M'\n#define CHAR_TEX_DIRT\t\t'D'\n#define CHAR_TEX_VENT\t\t'V'\n#define CHAR_TEX_GRATE\t\t'G'\n#define CHAR_TEX_TILE\t\t'T'\n#define CHAR_TEX_SLOSH\t\t'S'\n#define CHAR_TEX_WOOD\t\t'W'\n#define CHAR_TEX_COMPUTER\t'P'\n#define CHAR_TEX_GRASS\t\t'X'\n#define CHAR_TEX_GLASS\t\t'Y'\n#define CHAR_TEX_FLESH\t\t'F'\n#define CHAR_TEX_SNOW\t\t'N'\n\n#endif // PM_MATERIALS_H\n"
  },
  {
    "path": "pm_shared/pm_math.cpp",
    "content": "#include \"mathlib.h\"\n#include \"const.h\"\n#include <math.h>\n/*\n* Globals initialization\n*/\nfloat vec3_origin[] = {0, 0, 0};\nint nanmask = 255<<23;\n\nfloat anglemod(float a)\n{\n\ta = (360.0 / 65536) * ((int)(a  *(65536 / 360.0)) & 65535);\n\treturn a;\n}\n\nvoid AngleVectors(const vec_t *angles, vec_t *forward, vec_t *right, vec_t *up)\n{\n\tfloat sr, sp, sy, cr, cp;\n\n\tfloat cy;\n\tfloat angle;\n\n\tangle = (float)(angles[YAW] * (M_PI * 2 / 360));\n\tsy = sin(angle);\n\tcy = cos(angle);\n\n\tangle = (float)(angles[PITCH] * (M_PI * 2 / 360));\n\tsp = sin(angle);\n\tcp = cos(angle);\n\n\tangle = (float)(angles[ROLL] * (M_PI * 2 / 360));\n\tsr = sin(angle);\n\tcr = cos(angle);\n\n\tif (forward)\n\t{\n\t\tforward[0] = cp * cy;\n\t\tforward[1] = cp * sy;\n\t\tforward[2] = -sp;\n\t}\n\tif (right)\n\t{\n\t\tright[0] = (-1 * sr * sp * cy + -1 * cr * -sy);\n\t\tright[1] = (-1 * sr * sp * sy + -1 * cr * cy);\n\t\tright[2] = -1 * sr * cp;\n\t}\n\tif (up)\n\t{\n\t\tup[0] = (cr * sp * cy + -sr * -sy);\n\t\tup[1] = (cr * sp * sy + -sr * cy);\n\t\tup[2] = cr * cp;\n\t}\n}\n\nvoid AngleVectorsTranspose(const vec_t *angles, vec_t *forward, vec_t *right, vec_t *up)\n{\n\tfloat angle;\n\tfloat sr, sp, sy, cr, cp, cy;\n\n\tangle = angles[YAW] * (M_PI * 2 / 360);\n\tsy = sin(angle);\n\tcy = cos(angle);\n\tangle = angles[PITCH] * (M_PI * 2 / 360);\n\tsp = sin(angle);\n\tcp = cos(angle);\n\tangle = angles[ROLL] * (M_PI * 2 / 360);\n\tsr = sin(angle);\n\tcr = cos(angle);\n\n\tif (forward)\n\t{\n\t\tforward[0] = cp * cy;\n\t\tforward[1] = (sr * sp * cy + cr * -sy);\n\t\tforward[2] = (cr * sp * cy + -sr * -sy);\n\t}\n\tif (right)\n\t{\n\t\tright[0] = cp * sy;\n\t\tright[1] = (sr * sp * sy + cr * cy);\n\t\tright[2] = (cr * sp * sy + -sr * cy);\n\t}\n\tif (up)\n\t{\n\t\tup[0] = -sp;\n\t\tup[1] = sr * cp;\n\t\tup[2] = cr * cp;\n\t}\n}\n\nvoid AngleMatrix(const vec_t *angles, float (*matrix)[4])\n{\n\tfloat angle;\n\tfloat  sr, sp, sy, cr, cp, cy;\n\n\tangle = (float)(angles[ROLL] * (M_PI * 2 / 360));\n\tsy = sin(angle);\n\tcy = cos(angle);\n\n\tangle = (float)(angles[YAW] * (M_PI * 2 / 360));\n\tsp = sin(angle);\n\tcp = cos(angle);\n\n\tangle = (float)(angles[PITCH] * (M_PI * 2 / 360));\n\tsr = sin(angle);\n\tcr = cos(angle);\n\n\tmatrix[0][0] = cr * cp;\n\tmatrix[1][0] = cr * sp;\n\tmatrix[2][0] = -sr;\n\n\tmatrix[0][1] = (sy * sr) * cp - cy * sp;\n\tmatrix[1][1] = (sy * sr) * sp + cy * cp;\n\tmatrix[2][1] = sy * cr;\n\n\tmatrix[0][2] = (cy * sr) * cp + sy * sp;\n\tmatrix[1][2] = (cy * sr) * sp - sy * cp;\n\tmatrix[2][2] = cy * cr;\n\n\tmatrix[0][3] = 0.0f;\n\tmatrix[1][3] = 0.0f;\n\tmatrix[2][3] = 0.0f;\n}\n\nvoid AngleIMatrix(const vec_t *angles, float (*matrix)[4])\n{\n\tfloat angle;\n\tfloat sr, sp, sy, cr, cp, cy;\n\n\tangle = angles[YAW] * (M_PI * 2 / 360);\n\tsy = sin(angle);\n\tcy = cos(angle);\n\tangle = angles[PITCH] * (M_PI * 2 / 360);\n\tsp = sin(angle);\n\tcp = cos(angle);\n\tangle = angles[ROLL] * (M_PI * 2 / 360);\n\tsr = sin(angle);\n\tcr = cos(angle);\n\n\t// matrix = (YAW * PITCH) * ROLL\n\tmatrix[0][0] = cp * cy;\n\tmatrix[0][1] = cp * sy;\n\tmatrix[0][2] = -sp;\n\tmatrix[1][0] = sr * sp * cy + cr * -sy;\n\tmatrix[1][1] = sr * sp * sy + cr * cy;\n\tmatrix[1][2] = sr * cp;\n\tmatrix[2][0] = (cr * sp * cy + -sr * -sy);\n\tmatrix[2][1] = (cr * sp * sy + -sr * cy);\n\tmatrix[2][2] = cr * cp;\n\tmatrix[0][3] = 0.0;\n\tmatrix[1][3] = 0.0;\n\tmatrix[2][3] = 0.0;\n}\n\nvoid NormalizeAngles(float *angles)\n{\n\tint i;\n\t// Normalize angles\n\tfor (i = 0; i < 3; ++i)\n\t{\n\t\tif (angles[i] > 180.0)\n\t\t{\n\t\t\tangles[i] -= 360.0;\n\t\t}\n\t\telse if (angles[i] < -180.0)\n\t\t{\n\t\t\tangles[i] += 360.0;\n\t\t}\n\t}\n}\n\n// Interpolate Euler angles.\n// FIXME:  Use Quaternions to avoid discontinuities\n// Frac is 0.0 to 1.0 (i.e., should probably be clamped, but doesn't have to be)\n\nvoid InterpolateAngles(float *start, float *end, float *output, float frac)\n{\n\tint i;\n\tfloat ang1, ang2;\n\tfloat d;\n\n\tNormalizeAngles(start);\n\tNormalizeAngles(end);\n\n\tfor (i = 0; i < 3; ++i)\n\t{\n\t\tang1 = start[i];\n\t\tang2 = end[i];\n\n\t\td = ang2 - ang1;\n\t\tif (d > 180)\n\t\t{\n\t\t\td -= 360;\n\t\t}\n\t\telse if (d < -180)\n\t\t{\n\t\t\td += 360;\n\t\t}\n\n\t\toutput[i] = ang1 + d * frac;\n\t}\n\n\tNormalizeAngles(output);\n}\n\nfloat AngleBetweenVectors(const vec_t *v1, const vec_t *v2)\n{\n\tfloat angle;\n\tfloat l1 = Length(v1);\n\tfloat l2 = Length(v2);\n\n\tif (!l1 || !l2)\n\t\treturn 0.0f;\n\n\tangle = acos(DotProduct(v1, v2)) / (l1 * l2);\n\tangle = (angle * 180.0f) / M_PI;\n\n\treturn angle;\n}\n\nvoid VectorTransform(const vec_t *in1, float (*in2)[4], vec_t *out)\n{\n\tout[0] = DotProduct(in1, in2[0]) + in2[0][3];\n\tout[1] = DotProduct(in1, in2[1]) + in2[1][3];\n\tout[2] = DotProduct(in1, in2[2]) + in2[2][3];\n}\n\nint VectorCompare(const vec_t *v1, const vec_t *v2)\n{\n\tint i;\n\tfor (i = 0; i < 3; ++i)\n\t{\n\t\tif (v1[i] != v2[i])\n\t\t\treturn 0;\n\t}\n\n\treturn 1;\n}\n\nvoid VectorMA(const vec_t *veca, float scale, const vec_t *vecb, vec_t *vecc)\n{\n\tvecc[0] = veca[0] + scale * vecb[0];\n\tvecc[1] = veca[1] + scale * vecb[1];\n\tvecc[2] = veca[2] + scale * vecb[2];\n}\n\nfloat _DotProduct(const vec_t *v1, const vec_t *v2)\n{\n\treturn v1[0] * v2[0] + v1[1] * v2[1] + v1[2] * v2[2];\n}\n\nvoid _VectorSubtract(vec_t *veca, vec_t *vecb, vec_t *out)\n{\n\tout[0] = veca[0] - vecb[0];\n\tout[1] = veca[1] - vecb[1];\n\tout[2] = veca[2] - vecb[2];\n}\n\nvoid _VectorAdd(vec_t *veca, vec_t *vecb, vec_t *out)\n{\n\tout[0] = veca[0] + vecb[0];\n\tout[1] = veca[1] + vecb[1];\n\tout[2] = veca[2] + vecb[2];\n}\n\nvoid _VectorCopy(vec_t *in, vec_t *out)\n{\n\tout[0] = in[0];\n\tout[1] = in[1];\n\tout[2] = in[2];\n}\n\nvoid CrossProduct(const vec_t *v1, const vec_t *v2, vec_t *cross)\n{\n\tcross[0] = v1[1] * v2[2] - v1[2] * v2[1];\n\tcross[1] = v1[2] * v2[0] - v1[0] * v2[2];\n\tcross[2] = v1[0] * v2[1] - v1[1] * v2[0];\n}\n\nfloat Length(const vec_t *v)\n{\n\tint i;\n\tfloat length = 0.0f;\n\n\tfor (i = 0; i < 3; ++i)\n\t\tlength += v[i] * v[i];\n\n\treturn sqrt(length);\n}\n\nfloat Distance(const vec_t *v1, const vec_t *v2)\n{\n\tvec_t d[3];\n\tVectorSubtract(v2, v1, d);\n\treturn Length(d);\n}\n\nfloat VectorNormalize(vec_t *v)\n{\n\tfloat length;\n\tfloat ilength;\n\n\tlength = sqrt((float)(v[0] * v[0] + v[1] * v[1] + v[2] * v[2]));\n\n\tif (length)\n\t{\n\t\tilength = 1.0 / length;\n\n\t\tv[0] *= ilength;\n\t\tv[1] *= ilength;\n\t\tv[2] *= ilength;\n\t}\n\n\treturn length;\n}\n\nvoid VectorInverse(vec_t *v)\n{\n\tv[0] = -v[0];\n\tv[1] = -v[1];\n\tv[2] = -v[2];\n}\n\nvoid VectorScale(const vec_t *in, vec_t scale, vec_t *out)\n{\n\tout[0] = scale * in[0];\n\tout[1] = scale * in[1];\n\tout[2] = scale * in[2];\n}\n\nint Q_log2(int val)\n{\n\tint answer = 0;\n\twhile (val >>= 1)\n\t\t++answer;\n\n\treturn answer;\n}\n\nvoid VectorMatrix(vec_t *forward, vec_t *right, vec_t *up)\n{\n\tvec_t tmp[3];\n\n\tif (forward[0] == 0 && forward[1] == 0)\n\t{\n\t\tright[0] = 1;\n\t\tright[1] = 0;\n\t\tright[2] = 0;\n\n\t\tup[0] = -forward[2];\n\t\tup[1] = 0;\n\t\tup[2] = 0;\n\t\treturn;\n\t}\n\n\ttmp[0] = 0;\n\ttmp[1] = 0;\n\ttmp[2] = 1.0f;\n\n\tCrossProduct(forward, tmp, right);\n\tVectorNormalize(right);\n\tCrossProduct(right, forward, up);\n\tVectorNormalize(up);\n}\n\nvoid VectorAngles(const vec_t *forward, vec_t *angles)\n{\n\tfloat tmp, yaw, pitch;\n\n\tif (forward[1] == 0 && forward[0] == 0)\n\t{\n\t\tyaw = 0;\n\t\tif (forward[2] > 0)\n\t\t\tpitch = 90;\n\t\telse\n\t\t\tpitch = 270;\n\t}\n\telse\n\t{\n\t\tyaw = (atan2(forward[1], forward[0]) * 180 / M_PI);\n\t\tif (yaw < 0)\n\t\t\tyaw += 360;\n\n\t\ttmp = sqrt (forward[0] * forward[0] + forward[1] * forward[1]);\n\t\tpitch = (atan2(forward[2], tmp) * 180 / M_PI);\n\t\tif (pitch < 0)\n\t\t\tpitch += 360;\n\t}\n\n\tangles[0] = pitch;\n\tangles[1] = yaw;\n\tangles[2] = 0;\n}\n"
  },
  {
    "path": "pm_shared/pm_math.h",
    "content": "/*\n*\n*   This program is free software; you can redistribute it and/or modify it\n*   under the terms of the GNU General Public License as published by the\n*   Free Software Foundation; either version 2 of the License, or (at\n*   your option) any later version.\n*\n*   This program is distributed in the hope that it will be useful, but\n*   WITHOUT ANY WARRANTY; without even the implied warranty of\n*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n*   General Public License for more details.\n*\n*   You should have received a copy of the GNU General Public License\n*   along with this program; if not, write to the Free Software Foundation,\n*   Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\n*\n*   In addition, as a special exception, the author gives permission to\n*   link the code of this program with the Half-Life Game Engine (\"HL\n*   Engine\") and Modified Game Libraries (\"MODs\") developed by Valve,\n*   L.L.C (\"Valve\").  You must obey the GNU General Public License in all\n*   respects for all of the code used other than the HL Engine and MODs\n*   from Valve.  If you modify this file, you may extend this exception\n*   to your version of the file, but you are not obligated to do so.  If\n*   you do not wish to do so, delete this exception statement from your\n*   version.\n*\n*/\n\n#ifndef PM_MATH_H\n#define PM_MATH_H\n#ifdef _WIN32\n#pragma once\n#endif\n\n#define PITCH\t0\t// up/down\n#define YAW\t1\t// left/right\n#define ROLL\t2\t// fall over\n\nextern float vec3_origin[3];\nextern int nanmask;\n\n#define IS_NAN(x)\t((*reinterpret_cast<int *>(&(x)) & nanmask) == nanmask)\n\nfloat anglemod(float a);\nvoid  AngleVectors(const vec_t *angles, vec_t *forward, vec_t *right, vec_t *up);\nvoid  AngleVectorsTranspose(const vec_t *angles, vec_t *forward, vec_t *right, vec_t *up);\nvoid  AngleMatrix(const vec_t *angles, float (*matrix)[4]);\nvoid  AngleIMatrix(const vec_t *angles, float (*matrix)[4]);\nvoid  NormalizeAngles(float *angles);\nvoid  InterpolateAngles(float *start, float *end, float *output, float frac);\nfloat AngleBetweenVectors(const vec_t *v1, const vec_t *v2);\nvoid VectorTransform(const vec_t *in1, float (*in2)[4], vec_t *out);\nint   VectorCompare(const vec_t *v1, const vec_t *v2);\nvoid  VectorMA(const vec_t *veca, float scale, const vec_t *vecb, vec_t *vecc);\n\nfloat _DotProduct(const vec_t *v1, const vec_t *v2);\nvoid  _VectorSubtract(vec_t *veca, vec_t *vecb, vec_t *out);\nvoid  _VectorAdd(vec_t *veca, vec_t *vecb, vec_t *out);\nvoid  _VectorCopy(vec_t *in, vec_t *out);\nvoid  CrossProduct(const vec_t *v1, const vec_t *v2, vec_t *cross);\n\nfloat Length(const vec_t *v);\nfloat Distance(const vec_t *v1, const vec_t *v2);\nfloat VectorNormalize(vec_t *v);\n\nvoid  VectorInverse(vec_t *v);\nvoid  VectorScale(const vec_t *in, vec_t scale, vec_t *out);\nint   Q_log2(int val);\nvoid  VectorMatrix(vec_t *forward, vec_t *right, vec_t *up);\nvoid  VectorAngles(const vec_t *forward, vec_t *angles);\n\n#endif // PM_MATH_H\n"
  },
  {
    "path": "pm_shared/pm_movevars.h",
    "content": "/*\n*\n*   This program is free software; you can redistribute it and/or modify it\n*   under the terms of the GNU General Public License as published by the\n*   Free Software Foundation; either version 2 of the License, or (at\n*   your option) any later version.\n*\n*   This program is distributed in the hope that it will be useful, but\n*   WITHOUT ANY WARRANTY; without even the implied warranty of\n*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n*   General Public License for more details.\n*\n*   You should have received a copy of the GNU General Public License\n*   along with this program; if not, write to the Free Software Foundation,\n*   Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\n*\n*   In addition, as a special exception, the author gives permission to\n*   link the code of this program with the Half-Life Game Engine (\"HL\n*   Engine\") and Modified Game Libraries (\"MODs\") developed by Valve,\n*   L.L.C (\"Valve\").  You must obey the GNU General Public License in all\n*   respects for all of the code used other than the HL Engine and MODs\n*   from Valve.  If you modify this file, you may extend this exception\n*   to your version of the file, but you are not obligated to do so.  If\n*   you do not wish to do so, delete this exception statement from your\n*   version.\n*\n*/\n\n#ifndef PM_MOVEVARS_H\n#define PM_MOVEVARS_H\n#ifdef _WIN32\n#pragma once\n#endif\n\ntypedef struct movevars_s\n{\n\tfloat gravity;\t\t\t// Gravity for map\n\tfloat stopspeed;\t\t// Deceleration when not moving\n\tfloat maxspeed;\t\t\t// Max allowed speed\n\tfloat spectatormaxspeed;\n\tfloat accelerate;\t\t// Acceleration factor\n\tfloat airaccelerate;\t\t// Same for when in open air\n\tfloat wateraccelerate;\t\t// Same for when in water\n\tfloat friction;\n\tfloat edgefriction;\t\t// Extra friction near dropofs\n\tfloat waterfriction;\t\t// Less in water\n\tfloat entgravity;\t\t// 1.0\n\tfloat bounce;\t\t\t// Wall bounce value. 1.0\n\tfloat stepsize;\t\t\t// sv_stepsize;\n\tfloat maxvelocity;\t\t// maximum server velocity.\n\tfloat zmax;\t\t\t// Max z-buffer range (for GL)\n\tfloat waveHeight;\t\t// Water wave height (for GL)\n\tqboolean footsteps;\t\t// Play footstep sounds\n\tchar skyName[32];\t\t// Name of the sky map\n\tfloat rollangle;\n\tfloat rollspeed;\n\tfloat skycolor_r;\t\t// Sky color\n\tfloat skycolor_g;\n\tfloat skycolor_b;\n\tfloat skyvec_x;\t\t\t// Sky vector\n\tfloat skyvec_y;\n\tfloat skyvec_z;\n\n} movevars_t;\n\n#endif // PM_MOVEVARS_H\n"
  },
  {
    "path": "pm_shared/pm_shared.cpp",
    "content": "#include <assert.h>\n#include \"mathlib.h\"\n#include \"const.h\"\n#include \"usercmd.h\"\n#include \"pm_defs.h\"\n#include \"pm_shared.h\"\n#include \"pm_movevars.h\"\n#include \"pm_materials.h\"\n#include \"pm_debug.h\"\n#include <stdio.h>\n#include <math.h>\n#include <string.h>\n#include <stdlib.h>\n#include <ctype.h>\n#include \"com_model.h\"\n\n#ifndef min\n#define min(a, b) ((a) < (b) ? (a) : (b))\n#endif\n\n#ifndef max\n#define max(a, b) ((a) > (b) ? (a) : (b))\n#endif\n\n#ifndef FALSE\n#define FALSE 0\n#endif\n\n#ifndef TRUE\n#define TRUE 1\n#endif\n\nconst int MAX_TEXTURES           = 1024; // max number of textures loaded\nconst int MAX_TEXTURENAME_LENGHT = 17;   // only load first n chars of name\nconst float HalfHumanHeight = 36.0f;\n\n#ifdef CLIENT_DLL\n\tint iJumpSpectator;\n\tfloat vJumpOrigin[3];\n\tfloat vJumpAngles[3];\n#endif\n\n#define REGAMEDLL_ADD\n#define REGAMEDLL_FIXES\n\n/*\n* Globals initialization\n*/\nint pm_shared_initialized = FALSE;\n\nvec3_t rgv3tStuckTable[54];\nint rgStuckLast[MAX_CLIENTS][2];\n\nint pm_gcTextures = 0;\nchar pm_grgszTextureName[MAX_TEXTURES][MAX_TEXTURENAME_LENGHT];\nchar pm_grgchTextureType[MAX_TEXTURES];\n\nplayermove_t *pmove = nullptr;\nint g_onladder = FALSE;\n\nvoid PM_SwapTextures(int i, int j)\n{\n\tchar chTemp;\n\tchar szTemp[MAX_TEXTURENAME_LENGHT];\n\n\tstrcpy(szTemp, pm_grgszTextureName[i]);\n\tchTemp = pm_grgchTextureType[i];\n\n\tstrcpy(pm_grgszTextureName[i], pm_grgszTextureName[j]);\n\tpm_grgchTextureType[i] = pm_grgchTextureType[j];\n\n\tstrcpy(pm_grgszTextureName[j], szTemp);\n\tpm_grgchTextureType[j] = chTemp;\n}\n\nqboolean PM_IsThereGrassTexture()\n{\n\tfor (int i = 0; i < pm_gcTextures; i++)\n\t{\n\t\tif (pm_grgchTextureType[i] == CHAR_TEX_GRASS)\n\t\t\treturn TRUE;\n\t}\n\n\treturn FALSE;\n}\n\nvoid PM_SortTextures()\n{\n\t// Bubble sort, yuck, but this only occurs at startup and it's only 512 elements...\n\tint i, j;\n\tfor (i = 0; i < pm_gcTextures; i++)\n\t{\n\t\tfor (j = i + 1; j < pm_gcTextures; j++)\n\t\t{\n\t\t\tif (stricmp(pm_grgszTextureName[i], pm_grgszTextureName[j]) > 0)\n\t\t\t{\n\t\t\t\t// Swap\n\t\t\t\tPM_SwapTextures(i, j);\n\t\t\t}\n\t\t}\n\t}\n}\n\nvoid PM_InitTextureTypes()\n{\n\tchar buffer[512];\n\tint i, j;\n\tbyte *pMemFile;\n\tint fileSize, filePos = 0;\n\tstatic bool bTextureTypeInit = false;\n\n\tif (bTextureTypeInit)\n\t\treturn;\n\n\tmemset(&(pm_grgszTextureName[0][0]), 0, sizeof(pm_grgszTextureName));\n\tmemset(pm_grgchTextureType, 0, sizeof(pm_grgchTextureType));\n\n\tpm_gcTextures = 0;\n\tmemset(buffer, 0, sizeof(buffer));\n\n\tpMemFile = pmove->COM_LoadFile(\"sound/materials.txt\", 5, &fileSize);\n\tif (!pMemFile)\n\t\treturn;\n\n\t// for each line in the file...\n\twhile (pmove->memfgets(pMemFile, fileSize, &filePos, buffer, sizeof(buffer) - 1) && (pm_gcTextures < MAX_TEXTURES))\n\t{\n\t\t// skip whitespace\n\t\ti = 0;\n\t\twhile (buffer[i] && isspace(buffer[i]))\n\t\t\ti++;\n\n\t\tif (!buffer[i])\n\t\t\tcontinue;\n\n\t\t// skip comment lines\n\t\tif (buffer[i] == '/' || !isalpha(buffer[i]))\n\t\t\tcontinue;\n\n\t\t// get texture type\n\t\tpm_grgchTextureType[pm_gcTextures] = toupper(buffer[i++]);\n\n\t\t// skip whitespace\n\t\twhile (buffer[i] && isspace(buffer[i]))\n\t\t\ti++;\n\n\t\tif (!buffer[i])\n\t\t\tcontinue;\n\n\t\t// get sentence name\n\t\tj = i;\n\t\twhile (buffer[j] && !isspace(buffer[j]))\n\t\t\tj++;\n\n\t\tif (!buffer[j])\n\t\t\tcontinue;\n\n\t\t// null-terminate name and save in sentences array\n\t\tj = min(j, MAX_TEXTURENAME_LENGHT - 1 + i);\n\t\tbuffer[j] = '\\0';\n\n\t\tstrcpy(&(pm_grgszTextureName[pm_gcTextures++][0]), &(buffer[i]));\n\t}\n\n\t// Must use engine to free since we are in a .dll\n\tpmove->COM_FreeFile(pMemFile);\n\n\tPM_SortTextures();\n\tbTextureTypeInit = true;\n}\n\nchar PM_FindTextureType(char *name)\n{\n\tint left, right, pivot;\n\tint val;\n#if 0 // Velaron: TODO commented out until the issue is resolved\n\tassert(pm_shared_initialized);\n#endif\n\tleft = 0;\n\tright = pm_gcTextures - 1;\n\n\twhile (left <= right)\n\t{\n\t\tpivot = (left + right) / 2;\n\n\t\tval = strnicmp(name, pm_grgszTextureName[pivot], MAX_TEXTURENAME_LENGHT - 1);\n\n\t\tif (val == 0)\n\t\t{\n\t\t\treturn pm_grgchTextureType[pivot];\n\t\t}\n\t\telse if (val > 0)\n\t\t{\n\t\t\tleft = pivot + 1;\n\t\t}\n\t\telse if (val < 0)\n\t\t{\n\t\t\tright = pivot - 1;\n\t\t}\n\t}\n\n\treturn CHAR_TEX_CONCRETE;\n}\n\nvoid PM_PlayStepSound(int step, float fvol)\n{\n\tstatic int iSkipStep = 0;\n\tint irand;\n\n\tpmove->iStepLeft = !pmove->iStepLeft;\n\n\tif (!pmove->runfuncs)\n\t{\n\t\treturn;\n\t}\n\n\tirand = pmove->RandomLong(0, 1) + (pmove->iStepLeft * 2);\n\n\t// FIXME mp_footsteps needs to be a movevar\n\tif (pmove->multiplayer && !pmove->movevars->footsteps)\n\t\treturn;\n\n\t// irand - 0,1 for right foot, 2,3 for left foot\n\t// used to alternate left and right foot\n\t// FIXME, move to player state\n\tswitch (step)\n\t{\n\tdefault:\n\tcase STEP_CONCRETE:\n\t\tswitch (irand)\n\t\t{\n\t\t// right foot\n\t\tcase 0: pmove->PM_PlaySound(CHAN_BODY, \"player/pl_step1.wav\", fvol, ATTN_NORM, 0, PITCH_NORM); break;\n\t\tcase 1: pmove->PM_PlaySound(CHAN_BODY, \"player/pl_step3.wav\", fvol, ATTN_NORM, 0, PITCH_NORM); break;\n\t\t// left foot\n\t\tcase 2: pmove->PM_PlaySound(CHAN_BODY, \"player/pl_step2.wav\", fvol, ATTN_NORM, 0, PITCH_NORM); break;\n\t\tcase 3: pmove->PM_PlaySound(CHAN_BODY, \"player/pl_step4.wav\", fvol, ATTN_NORM, 0, PITCH_NORM); break;\n\t\t}\n\t\tbreak;\n\tcase STEP_METAL:\n\t\tswitch (irand)\n\t\t{\n\t\t// right foot\n\t\tcase 0: pmove->PM_PlaySound(CHAN_BODY, \"player/pl_metal1.wav\", fvol, ATTN_NORM, 0, PITCH_NORM); break;\n\t\tcase 1: pmove->PM_PlaySound(CHAN_BODY, \"player/pl_metal3.wav\", fvol, ATTN_NORM, 0, PITCH_NORM); break;\n\t\t// left foot\n\t\tcase 2: pmove->PM_PlaySound(CHAN_BODY, \"player/pl_metal2.wav\", fvol, ATTN_NORM, 0, PITCH_NORM); break;\n\t\tcase 3: pmove->PM_PlaySound(CHAN_BODY, \"player/pl_metal4.wav\", fvol, ATTN_NORM, 0, PITCH_NORM); break;\n\t\t}\n\t\tbreak;\n\tcase STEP_DIRT:\n\t\tswitch (irand)\n\t\t{\n\t\t// right foot\n\t\tcase 0: pmove->PM_PlaySound(CHAN_BODY, \"player/pl_dirt1.wav\", fvol, ATTN_NORM, 0, PITCH_NORM); break;\n\t\tcase 1: pmove->PM_PlaySound(CHAN_BODY, \"player/pl_dirt3.wav\", fvol, ATTN_NORM, 0, PITCH_NORM); break;\n\t\t// left foot\n\t\tcase 2: pmove->PM_PlaySound(CHAN_BODY, \"player/pl_dirt2.wav\", fvol, ATTN_NORM, 0, PITCH_NORM); break;\n\t\tcase 3: pmove->PM_PlaySound(CHAN_BODY, \"player/pl_dirt4.wav\", fvol, ATTN_NORM, 0, PITCH_NORM); break;\n\t\t}\n\t\tbreak;\n\tcase STEP_VENT:\n\t\tswitch (irand)\n\t\t{\n\t\t// right foot\n\t\tcase 0: pmove->PM_PlaySound(CHAN_BODY, \"player/pl_duct1.wav\", fvol, ATTN_NORM, 0, PITCH_NORM); break;\n\t\tcase 1: pmove->PM_PlaySound(CHAN_BODY, \"player/pl_duct3.wav\", fvol, ATTN_NORM, 0, PITCH_NORM); break;\n\t\t// left foot\n\t\tcase 2: pmove->PM_PlaySound(CHAN_BODY, \"player/pl_duct2.wav\", fvol, ATTN_NORM, 0, PITCH_NORM); break;\n\t\tcase 3: pmove->PM_PlaySound(CHAN_BODY, \"player/pl_duct4.wav\", fvol, ATTN_NORM, 0, PITCH_NORM); break;\n\t\t}\n\t\tbreak;\n\tcase STEP_GRATE:\n\t\tswitch (irand)\n\t\t{\n\t\t// right foot\n\t\tcase 0: pmove->PM_PlaySound(CHAN_BODY, \"player/pl_grate1.wav\", fvol, ATTN_NORM, 0, PITCH_NORM); break;\n\t\tcase 1: pmove->PM_PlaySound(CHAN_BODY, \"player/pl_grate3.wav\", fvol, ATTN_NORM, 0, PITCH_NORM); break;\n\t\t// left foot\n\t\tcase 2: pmove->PM_PlaySound(CHAN_BODY, \"player/pl_grate2.wav\", fvol, ATTN_NORM, 0, PITCH_NORM); break;\n\t\tcase 3: pmove->PM_PlaySound(CHAN_BODY, \"player/pl_grate4.wav\", fvol, ATTN_NORM, 0, PITCH_NORM); break;\n\t\t}\n\t\tbreak;\n\tcase STEP_TILE:\n\t\tif (!pmove->RandomLong(0, 4))\n\t\t\tirand = 4;\n\n\t\tswitch (irand)\n\t\t{\n\t\t// right foot\n\t\tcase 0: pmove->PM_PlaySound(CHAN_BODY, \"player/pl_tile1.wav\", fvol, ATTN_NORM, 0, PITCH_NORM); break;\n\t\tcase 1: pmove->PM_PlaySound(CHAN_BODY, \"player/pl_tile3.wav\", fvol, ATTN_NORM, 0, PITCH_NORM); break;\n\t\t// left foot\n\t\tcase 2: pmove->PM_PlaySound(CHAN_BODY, \"player/pl_tile2.wav\", fvol, ATTN_NORM, 0, PITCH_NORM); break;\n\t\tcase 3: pmove->PM_PlaySound(CHAN_BODY, \"player/pl_tile4.wav\", fvol, ATTN_NORM, 0, PITCH_NORM); break;\n\t\tcase 4: pmove->PM_PlaySound(CHAN_BODY, \"player/pl_tile5.wav\", fvol, ATTN_NORM, 0, PITCH_NORM); break;\n\t\t}\n\t\tbreak;\n\tcase STEP_SLOSH:\n\t\tswitch (irand)\n\t\t{\n\t\t\t// right foot\n\t\t\tcase 0: pmove->PM_PlaySound(CHAN_BODY, \"player/pl_slosh1.wav\", fvol, ATTN_NORM, 0, PITCH_NORM); break;\n\t\t\tcase 1: pmove->PM_PlaySound(CHAN_BODY, \"player/pl_slosh3.wav\", fvol, ATTN_NORM, 0, PITCH_NORM); break;\n\t\t\t// left foot\n\t\t\tcase 2: pmove->PM_PlaySound(CHAN_BODY, \"player/pl_slosh2.wav\", fvol, ATTN_NORM, 0, PITCH_NORM); break;\n\t\t\tcase 3: pmove->PM_PlaySound(CHAN_BODY, \"player/pl_slosh4.wav\", fvol, ATTN_NORM, 0, PITCH_NORM); break;\n\t\t}\n\t\tbreak;\n\tcase STEP_WADE:\n\t\tif (iSkipStep == 0)\n\t\t{\n\t\t\tiSkipStep++;\n\t\t\tbreak;\n\t\t}\n\n\t\tif (iSkipStep++ == 3)\n\t\t{\n\t\t\tiSkipStep = 0;\n\t\t}\n\n\t\tswitch (irand)\n\t\t{\n\t\t// right foot\n\t\tcase 0: pmove->PM_PlaySound(CHAN_BODY, \"player/pl_wade1.wav\", fvol, ATTN_NORM, 0, PITCH_NORM); break;\n\t\tcase 1: pmove->PM_PlaySound(CHAN_BODY, \"player/pl_wade2.wav\", fvol, ATTN_NORM, 0, PITCH_NORM); break;\n\t\t// left foot\n\t\tcase 2: pmove->PM_PlaySound(CHAN_BODY, \"player/pl_wade3.wav\", fvol, ATTN_NORM, 0, PITCH_NORM); break;\n\t\tcase 3: pmove->PM_PlaySound(CHAN_BODY, \"player/pl_wade4.wav\", fvol, ATTN_NORM, 0, PITCH_NORM); break;\n\t\t}\n\n\t\tbreak;\n\tcase STEP_LADDER:\n\t\tswitch (irand)\n\t\t{\n\t\t// right foot\n\t\tcase 0: pmove->PM_PlaySound(CHAN_BODY, \"player/pl_ladder1.wav\", fvol, ATTN_NORM, 0, PITCH_NORM); break;\n\t\tcase 1: pmove->PM_PlaySound(CHAN_BODY, \"player/pl_ladder3.wav\", fvol, ATTN_NORM, 0, PITCH_NORM); break;\n\t\t// left foot\n\t\tcase 2: pmove->PM_PlaySound(CHAN_BODY, \"player/pl_ladder2.wav\", fvol, ATTN_NORM, 0, PITCH_NORM); break;\n\t\tcase 3: pmove->PM_PlaySound(CHAN_BODY, \"player/pl_ladder4.wav\", fvol, ATTN_NORM, 0, PITCH_NORM); break;\n\t\t}\n\t\tbreak;\n\tcase STEP_SNOW:\n\t\tswitch (irand)\n\t\t{\n\t\t// right foot\n\t\tcase 0: pmove->PM_PlaySound(CHAN_BODY, \"player/pl_snow1.wav\", fvol, ATTN_NORM, 0, PITCH_NORM); break;\n\t\tcase 1: pmove->PM_PlaySound(CHAN_BODY, \"player/pl_snow3.wav\", fvol, ATTN_NORM, 0, PITCH_NORM); break;\n\t\t// left foot\n\t\tcase 2: pmove->PM_PlaySound(CHAN_BODY, \"player/pl_snow2.wav\", fvol, ATTN_NORM, 0, PITCH_NORM); break;\n\t\tcase 3: pmove->PM_PlaySound(CHAN_BODY, \"player/pl_snow4.wav\", fvol, ATTN_NORM, 0, PITCH_NORM); break;\n\t\t}\n\t\tbreak;\n\t}\n}\n\nint PM_MapTextureTypeStepType(char chTextureType)\n{\n\tswitch (chTextureType)\n\t{\n\tdefault:\n\tcase CHAR_TEX_CONCRETE: return STEP_CONCRETE;\n\tcase CHAR_TEX_METAL:    return STEP_METAL;\n\tcase CHAR_TEX_DIRT:     return STEP_DIRT;\n\tcase CHAR_TEX_VENT:     return STEP_VENT;\n\tcase CHAR_TEX_GRATE:    return STEP_GRATE;\n\tcase CHAR_TEX_TILE:     return STEP_TILE;\n\tcase CHAR_TEX_SLOSH:    return STEP_SLOSH;\n\tcase CHAR_TEX_SNOW:     return STEP_SNOW;\n\t}\n}\n\nvoid PM_CatagorizeTextureType()\n{\n\tvec3_t start, end;\n\tconst char *pTextureName;\n\n\tVectorCopy(pmove->origin, start);\n\tVectorCopy(pmove->origin, end);\n\n\t// Straight down\n\tend[2] -= 64.0f;\n\n\t// Fill in default values, just in case.\n\tpmove->sztexturename[0] = '\\0';\n\tpmove->chtexturetype = CHAR_TEX_CONCRETE;\n\n\tpTextureName = pmove->PM_TraceTexture(pmove->onground, start, end);\n\n\tif (!pTextureName)\n\t\treturn;\n\n\t// strip leading '-0' or '+0~' or '{' or '!'\n\tif (*pTextureName == '-' || *pTextureName == '+')\n\t\tpTextureName += 2;\n\n\tif (*pTextureName == '{' || *pTextureName == '!' || *pTextureName == '~' || *pTextureName == ' ')\n\t\tpTextureName++;\n\n\tstrcpy(pmove->sztexturename, pTextureName);\n\tpmove->sztexturename[MAX_TEXTURENAME_LENGHT - 1] = '\\0';\n\n\t// get texture type\n\tpmove->chtexturetype = PM_FindTextureType(pmove->sztexturename);\n}\n\nvoid PM_UpdateStepSound()\n{\n\tfloat fvol;\n\tvec3_t knee;\n\tvec3_t feet;\n\tvec3_t center;\n\tfloat height;\n\tfloat speed;\n\tint fLadder;\n\tint step;\n\tint onground;\n\n\tif (pmove->flTimeStepSound > 0)\n\t\treturn;\n\n\tif (pmove->flags & FL_FROZEN)\n\t\treturn;\n\n\tspeed = Length(pmove->velocity);\n\n\tif (speed <= 150.0)\n\t{\n\t\tpmove->flTimeStepSound = 400;\n\t\treturn;\n\t}\n\n\t// determine if we are on a ladder\n\tfLadder = (pmove->movetype == MOVETYPE_FLY);\n\n\t// determine if we are not in air\n\tonground = (pmove->onground != -1);\n\n\t// If we're on a ladder or on the ground play step sound.\n\tif (fLadder || onground)\n\t{\n\t\tPM_CatagorizeTextureType();\n\n\t\tVectorCopy(pmove->origin, center);\n\t\tVectorCopy(pmove->origin, knee);\n\t\tVectorCopy(pmove->origin, feet);\n\n\t\theight = pmove->player_maxs[pmove->usehull][2] - pmove->player_mins[pmove->usehull][2];\n\n\t\tknee[2] = pmove->origin[2] - 0.3 * height;\n\t\tfeet[2] = pmove->origin[2] - 0.5 * height;\n\n\t\t// find out what we're stepping in or on...\n\t\tif (fLadder)\n\t\t{\n\t\t\tstep = STEP_LADDER;\n\t\t\tfvol = 0.35;\n\t\t\tpmove->flTimeStepSound = 350;\n\t\t}\n\t\telse if (pmove->PM_PointContents(knee, nullptr) == CONTENTS_WATER)\n\t\t{\n\t\t\tstep = STEP_WADE;\n\t\t\tfvol = 0.65;\n\t\t\tpmove->flTimeStepSound = 600;\n\t\t}\n\t\telse if (pmove->PM_PointContents(feet, nullptr) == CONTENTS_WATER)\n\t\t{\n\t\t\tstep = STEP_SLOSH;\n\t\t\tfvol = 0.5;\n\t\t\tpmove->flTimeStepSound = 300;\n\t\t}\n\t\telse\n\t\t{\n\t\t\t// find texture under player, if different from current texture,\n\t\t\t// get material type\n\t\t\tstep = PM_MapTextureTypeStepType(pmove->chtexturetype);\n\n\t\t\tswitch (pmove->chtexturetype)\n\t\t\t{\n\t\t\tdefault:\n\t\t\tcase CHAR_TEX_CONCRETE:\n\t\t\t\tfvol = 0.5;\n\t\t\t\tpmove->flTimeStepSound = 300;\n\t\t\t\tbreak;\n\t\t\tcase CHAR_TEX_METAL:\n\t\t\t\tfvol = 0.5;\n\t\t\t\tpmove->flTimeStepSound = 300;\n\t\t\t\tbreak;\n\t\t\tcase CHAR_TEX_DIRT:\n\t\t\t\tfvol = 0.55;\n\t\t\t\tpmove->flTimeStepSound = 300;\n\t\t\t\tbreak;\n\t\t\tcase CHAR_TEX_VENT:\n\t\t\t\tfvol = 0.7;\n\t\t\t\tpmove->flTimeStepSound = 300;\n\t\t\t\tbreak;\n\t\t\tcase CHAR_TEX_GRATE:\n\t\t\t\tfvol = 0.5;\n\t\t\t\tpmove->flTimeStepSound = 300;\n\t\t\t\tbreak;\n\t\t\tcase CHAR_TEX_TILE:\n\t\t\t\tfvol = 0.5;\n\t\t\t\tpmove->flTimeStepSound = 300;\n\t\t\t\tbreak;\n\t\t\tcase CHAR_TEX_SLOSH:\n\t\t\t\tfvol = 0.5;\n\t\t\t\tpmove->flTimeStepSound = 300;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tif ((pmove->flags & FL_DUCKING) || fLadder)\n\t\t{\n\t\t\t// slower step time if ducking\n\t\t\tpmove->flTimeStepSound += 100;\n\n\t\t\t// play the sound\n\t\t\t// 35% volume if ducking\n\t\t\tif ((pmove->flags & FL_DUCKING) && pmove->flDuckTime < 950.0)\n\t\t\t{\n\t\t\t\tfvol *= 0.35;\n\t\t\t}\n\t\t}\n\n\t\tPM_PlayStepSound(step, fvol);\n\t}\n}\n\n// Add's the trace result to touch list, if contact is not already in list.\nqboolean PM_AddToTouched(pmtrace_t tr, vec_t *impactvelocity)\n{\n\tint i;\n\tfor (i = 0; i < pmove->numtouch; i++)\n\t{\n\t\tif (pmove->touchindex[i].ent == tr.ent)\n\t\t\tbreak;\n\t}\n\n\t// Already in list.\n\tif (i != pmove->numtouch)\n\t{\n\t\treturn FALSE;\n\t}\n\n\tVectorCopy(impactvelocity, tr.deltavelocity);\n\n\tif (pmove->numtouch >= MAX_PHYSENTS)\n\t{\n\t\tpmove->Con_DPrintf(\"Too many entities were touched!\\n\");\n\t}\n\n\tpmove->touchindex[pmove->numtouch++] = tr;\n\treturn TRUE;\n}\n\nvoid PM_CheckVelocity()\n{\n\tint i;\n\n\t// bound velocity\n\tfor (i = 0; i < 3; i++)\n\t{\n\t\t// See if it's bogus.\n\t\tif (IS_NAN(pmove->velocity[i]))\n\t\t{\n\t\t\tpmove->Con_Printf(\"PM  Got a NaN velocity %i\\n\", i);\n\t\t\tpmove->velocity[i] = 0;\n\t\t}\n\n\t\tif (IS_NAN(pmove->origin[i]))\n\t\t{\n\t\t\tpmove->Con_Printf(\"PM  Got a NaN origin on %i\\n\", i);\n\t\t\tpmove->origin[i] = 0;\n\t\t}\n\n\t\t// Bound it.\n\t\tif (pmove->velocity[i] > pmove->movevars->maxvelocity)\n\t\t{\n\t\t\tpmove->Con_DPrintf(\"PM  Got a velocity too high on %i\\n\", i);\n\t\t\tpmove->velocity[i] = pmove->movevars->maxvelocity;\n\t\t}\n\t\telse if (pmove->velocity[i] < -pmove->movevars->maxvelocity)\n\t\t{\n\t\t\tpmove->Con_DPrintf(\"PM  Got a velocity too low on %i\\n\", i);\n\t\t\tpmove->velocity[i] = -pmove->movevars->maxvelocity;\n\t\t}\n\t}\n}\n\n// Slide off of the impacting object\n// returns the blocked flags:\n// 0x01 == floor\n// 0x02 == step / wall\nint PM_ClipVelocity(vec_t *in, vec_t *normal, vec_t *out, float overbounce)\n{\n\tfloat change;\n\tfloat angle;\n\tfloat backoff;\n\tint i, blocked;\n\n\tangle = normal[2];\n\n\t// Assume unblocked.\n\tblocked = 0x00;\n\n\t// If the plane that is blocking us has a positive z component, then assume it's a floor.\n\tif (angle > 0)\n\t{\n\t\tblocked |= 0x01;\n\t}\n\n\t// If the plane has no Z, it is vertical (wall/step)\n\tif (!angle)\n\t{\n\t\tblocked |= 0x02;\n\t}\n\n\t// Determine how far along plane to slide based on incoming direction.\n\t// Scale by overbounce factor.\n\tbackoff = DotProduct(in, normal) * overbounce;\n\n\tfor (i = 0; i < 3; i++)\n\t{\n\t\tchange = in[i] - normal[i] * backoff;\n\t\tout[i] = change;\n\n\t\t// If out velocity is too small, zero it out.\n\t\tif (out[i] > -STOP_EPSILON && out[i] < STOP_EPSILON)\n\t\t{\n\t\t\tout[i] = 0;\n\t\t}\n\t}\n\n\t// Return blocking flags.\n\treturn blocked;\n}\n\nvoid PM_AddCorrectGravity()\n{\n\tfloat ent_gravity;\n\n\tif (pmove->waterjumptime)\n\t\treturn;\n\n\tif (pmove->gravity != 0.0f)\n\t\tent_gravity = pmove->gravity;\n\telse\n\t\tent_gravity = 1.0f;\n\n\t// Add gravity so they'll be in the correct position during movement\n\t// yes, this 0.5 looks wrong, but it's not.\n\tpmove->velocity[2] -= (ent_gravity * pmove->movevars->gravity * 0.5f * pmove->frametime);\n\tpmove->velocity[2] += pmove->basevelocity[2] * pmove->frametime;\n\n\tpmove->basevelocity[2] = 0;\n\n\tPM_CheckVelocity();\n}\n\nvoid PM_FixupGravityVelocity()\n{\n\tfloat ent_gravity;\n\n\tif (pmove->waterjumptime)\n\t\treturn;\n\n\tif (pmove->gravity != 0.0)\n\t\tent_gravity = pmove->gravity;\n\telse\n\t\tent_gravity = 1.0;\n\n\t// Get the correct velocity for the end of the dt\n\tpmove->velocity[2] -= (pmove->movevars->gravity * pmove->frametime * ent_gravity * 0.5);\n\tPM_CheckVelocity();\n}\n\nint PM_FlyMove()\n{\n\tint bumpcount, numbumps;\n\tvec3_t dir;\n\tfloat d;\n\tint numplanes;\n\tvec3_t planes[MAX_CLIP_PLANES];\n\tvec3_t primal_velocity, original_velocity;\n\tvec3_t new_velocity;\n\tint i, j;\n\tpmtrace_t trace;\n\tvec3_t end;\n\tfloat time_left, allFraction;\n\tint blocked;\n\n\tnumbumps = 4;\t// Bump up to four times\n\tblocked = 0x00;\t// Assume not blocked\n\tnumplanes = 0;\t// and not sliding along any planes\n\n\tVectorCopy(pmove->velocity, original_velocity);\t\t// Store original velocity\n\tVectorCopy(pmove->velocity, primal_velocity);\n\n\tallFraction = 0;\n\ttime_left = pmove->frametime;\t\t\t\t// Total time for this movement operation.\n\n\tfor (bumpcount = 0; bumpcount < numbumps; bumpcount++)\n\t{\n\t\tif (!pmove->velocity[0] && !pmove->velocity[1] && !pmove->velocity[2])\n\t\t\tbreak;\n\n\t\t// Assume we can move all the way from the current origin to the\n\t\t// end point.\n\t\tfor (i = 0; i < 3; i++)\n\t\t{\n\t\t\tfloat flScale = time_left * pmove->velocity[i];\n\n\t\t\tend[i] = pmove->origin[i] + flScale;\n\t\t}\n\n\t\t// See if we can make it from origin to end point.\n\t\ttrace = pmove->PM_PlayerTrace(pmove->origin, end, PM_NORMAL, -1);\n\n\t\tallFraction += trace.fraction;\n\n\t\t// If we started in a solid object, or we were in solid space\n\t\t// the whole way, zero out our velocity and return that we\n\t\t// are blocked by floor and wall.\n\t\tif (trace.allsolid)\n\t\t{\n\t\t\t// entity is trapped in another solid\n\t\t\tVectorCopy(vec3_origin, pmove->velocity);\n\t\t\treturn 4;\n\t\t}\n\n\t\t// If we moved some portion of the total distance, then\n\t\t// copy the end position into the pmove->origin and\n\t\t// zero the plane counter.\n\t\tif (trace.fraction > 0.0f)\n\t\t{\n\t\t\t// actually covered some distance\n\t\t\tVectorCopy(trace.endpos, pmove->origin);\n\t\t\tVectorCopy(pmove->velocity, original_velocity);\n\n\t\t\tnumplanes = 0;\n\t\t}\n\n\t\t// If we covered the entire distance, we are done\n\t\t// and can return.\n\t\tif (trace.fraction == 1.0f)\n\t\t{\n\t\t\t// moved the entire distance\n\t\t\tbreak;\n\t\t}\n\n\t\t// Save entity that blocked us (since fraction was < 1.0)\n\t\t// for contact\n\t\t// Add it if it's not already in the list\n\t\tPM_AddToTouched(trace, pmove->velocity);\n\n\t\t// If the plane we hit has a high z component in the normal, then\n\t\t// it's probably a floor\n\t\tif (trace.plane.normal[2] > 0.7f)\n\t\t{\n\t\t\t// floor\n\t\t\tblocked |= 0x01;\n\t\t}\n\n\t\t// If the plane has a zero z component in the normal, then it's a\n\t\t// step or wall\n\t\tif (!trace.plane.normal[2])\n\t\t{\n\t\t\t// step / wall\n\t\t\tblocked |= 0x02;\n\t\t}\n\n\t\t// Reduce amount of pmove->frametime left by total time left * fraction\n\t\t// that we covered.\n\t\ttime_left -= time_left * trace.fraction;\n\n\t\t// Did we run out of planes to clip against?\n\t\tif (numplanes >= MAX_CLIP_PLANES)\n\t\t{\n\t\t\t// this shouldn't really happen\n\t\t\t// Stop our movement if so.\n\t\t\tVectorCopy(vec3_origin, pmove->velocity);\n\t\t\tbreak;\n\t\t}\n\n\t\t// Set up next clipping plane\n\t\tVectorCopy(trace.plane.normal, planes[numplanes]);\n\t\tnumplanes++;\n\n\t\t// modify original_velocity so it parallels all of the clip planes\n\t\t// relfect player velocity\n\t\tif (numplanes == 1 && pmove->movetype == MOVETYPE_WALK && (pmove->onground == -1 || pmove->friction != 1))\n\t\t{\n\t\t\tfor (i = 0; i < numplanes; i++)\n\t\t\t{\n\t\t\t\tif (planes[i][2] > 0.7f)\n\t\t\t\t{\n\t\t\t\t\t// floor or slope\n\t\t\t\t\tPM_ClipVelocity(original_velocity, planes[i], new_velocity, 1);\n\t\t\t\t\tVectorCopy(new_velocity, original_velocity);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\tPM_ClipVelocity(original_velocity, planes[i], new_velocity, 1.0 + pmove->movevars->bounce * (1.0 - pmove->friction));\n\t\t\t}\n\n\t\t\tVectorCopy(new_velocity, pmove->velocity);\n\t\t\tVectorCopy(new_velocity, original_velocity);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tfor (i = 0; i < numplanes; i++)\n\t\t\t{\n\t\t\t\tPM_ClipVelocity(original_velocity, planes[i], pmove->velocity, 1);\n\n\t\t\t\tfor (j = 0; j < numplanes; j++)\n\t\t\t\t{\n\t\t\t\t\tif (j != i && DotProduct(pmove->velocity, planes[j]) < 0)\n\t\t\t\t\t{\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (j == numplanes)\n\t\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tif (i == numplanes)\n\t\t\t{\n\t\t\t\tif (numplanes != 2)\n\t\t\t\t{\n\t\t\t\t\tVectorCopy(vec3_origin, pmove->velocity);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tCrossProduct(planes[0], planes[1], dir);\n\t\t\t\td = DotProduct(dir, pmove->velocity);\n\t\t\t\tVectorScale(dir, d, pmove->velocity);\n\t\t\t}\n\n\t\t\tif (DotProduct(pmove->velocity, primal_velocity) <= 0)\n\t\t\t{\n\t\t\t\tVectorCopy(vec3_origin, pmove->velocity);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\tif (allFraction == 0.0f)\n\t{\n\t\tVectorCopy(vec3_origin, pmove->velocity);\n\t}\n\n\treturn blocked;\n}\n\nvoid PM_Accelerate(vec_t *wishdir, float wishspeed, float accel)\n{\n\tint i;\n\tfloat addspeed;\n\n\tfloat currentspeed;\n\tfloat accelspeed;\n\n\t// Dead player's don't accelerate\n\tif (pmove->dead)\n\t\treturn;\n\n\t// If waterjumping, don't accelerate\n\tif (pmove->waterjumptime)\n\t\treturn;\n\n\t// See if we are changing direction a bit\n\tcurrentspeed = DotProduct(pmove->velocity, wishdir);\n\n\t// Reduce wishspeed by the amount of veer.\n\taddspeed = wishspeed - currentspeed;\n\n\t// If not going to add any speed, done.\n\tif (addspeed <= 0)\n\t\treturn;\n\n\t// Determine amount of accleration.\n\taccelspeed = accel * pmove->frametime * wishspeed * pmove->friction;\n\n\t// Cap at addspeed\n\tif (accelspeed > addspeed)\n\t\taccelspeed = addspeed;\n\n\t// Adjust velocity.\n\tfor (i = 0; i < 3; i++)\n\t{\n\t\tpmove->velocity[i] += accelspeed * wishdir[i];\n\t}\n}\n\n// Only used by players. Moves along the ground when player is a MOVETYPE_WALK.\nvoid PM_WalkMove()\n{\n\tint clip;\n\tint oldonground;\n\tint i;\n\n\tvec3_t wishvel;\n\tfloat spd;\n\tfloat fmove, smove;\n\tvec3_t wishdir;\n\tfloat wishspeed;\n\n\t//vec3_t start;\t// TODO: unused\n\tvec3_t dest;\n\tvec3_t original, originalvel;\n\tvec3_t down, downvel;\n\tfloat downdist, updist;\n\n\tpmtrace_t trace;\n\n\tif (pmove->fuser2 > 0.0)\n\t{\n\t\tfloat flRatio = (100 - pmove->fuser2 * 0.001 * 19) * 0.01;\n\n\t\tpmove->velocity[0] *= flRatio;\n\t\tpmove->velocity[1] *= flRatio;\n\t}\n\n\t// Copy movement amounts\n\tfmove = pmove->cmd.forwardmove;\n\tsmove = pmove->cmd.sidemove;\n\n\t// Zero out z components of movement vectors\n\tpmove->forward[2] = 0;\n\tpmove->right[2] = 0;\n\n\t// Normalize remainder of vectors.\n\tVectorNormalize(pmove->forward);\n\tVectorNormalize(pmove->right);\n\n\t// Determine x and y parts of velocity\n\tfor (i = 0; i < 2; i++)\n\t{\n\t\twishvel[i] = pmove->forward[i] * fmove + pmove->right[i] * smove;\n\t}\n\n\t// Zero out z part of velocity\n\twishvel[2] = 0;\n\n\t// Determine maginitude of speed of move\n\tVectorCopy(wishvel, wishdir);\n\twishspeed = VectorNormalize(wishdir);\n\n\t// Clamp to server defined max speed\n\tif (wishspeed > pmove->maxspeed)\n\t{\n\t\tVectorScale(wishvel, pmove->maxspeed / wishspeed, wishvel);\n\t\twishspeed = pmove->maxspeed;\n\t}\n\n\t// Set pmove velocity\n\tpmove->velocity[2] = 0;\n\tPM_Accelerate(wishdir, wishspeed, pmove->movevars->accelerate);\n\tpmove->velocity[2] = 0;\n\n\t// Add in any base velocity to the current velocity.\n\tVectorAdd(pmove->velocity, pmove->basevelocity, pmove->velocity);\n\n\tspd = Length(pmove->velocity);\n\n\tif (spd < 1.0)\n\t{\n\t\tVectorClear(pmove->velocity);\n\t\treturn;\n\t}\n\n\t// If we are not moving, do nothing\n\t//if (!pmove->velocity[0] && !pmove->velocity[1] && !pmove->velocity[2])\n\t//\treturn;\n\n\toldonground = pmove->onground;\n\n\t// first try just moving to the destination\n\tdest[0] = pmove->origin[0] + pmove->velocity[0] * pmove->frametime;\n\tdest[1] = pmove->origin[1] + pmove->velocity[1] * pmove->frametime;\n\tdest[2] = pmove->origin[2];\n\n\t// first try moving directly to the next spot\n\t// VectorCopy(dest, start);\n\n\ttrace = pmove->PM_PlayerTrace(pmove->origin, dest, PM_NORMAL, -1);\n\n\t// If we made it all the way, then copy trace end\n\t// as new player position.\n\tif (trace.fraction == 1.0f)\n\t{\n\t\tVectorCopy(trace.endpos, pmove->origin);\n\t\treturn;\n\t}\n\n\t// Don't walk up stairs if not on ground.\n\tif (oldonground == -1 && pmove->waterlevel == 0)\n\t{\n\t\treturn;\n\t}\n\n\t// If we are jumping out of water, don't do anything more.\n\tif (pmove->waterjumptime)\n\t\treturn;\n\n\t// Try sliding forward both on ground and up 16 pixels\n\t// take the move that goes farthest\n\n\t// Save out original pos &\n\tVectorCopy(pmove->origin, original);\n\n\t// velocity.\n\tVectorCopy(pmove->velocity, originalvel);\n\n\t// Slide move\n\tclip = PM_FlyMove();\n\n\t// Copy the results out\n\tVectorCopy(pmove->origin, down);\n\tVectorCopy(pmove->velocity, downvel);\n\n\t// Reset original values.\n\tVectorCopy(original, pmove->origin);\n\tVectorCopy(originalvel, pmove->velocity);\n\n\t// Start out up one stair height\n\tVectorCopy(pmove->origin, dest);\n\n\tdest[2] += pmove->movevars->stepsize;\n\n\ttrace = pmove->PM_PlayerTrace(pmove->origin, dest, PM_NORMAL, -1);\n\n\t// If we started okay and made it part of the way at least,\n\t// copy the results to the movement start position and then\n\t// run another move try.\n\tif (!trace.startsolid && !trace.allsolid)\n\t{\n\t\tVectorCopy(trace.endpos, pmove->origin);\n\t}\n\n\t// slide move the rest of the way.\n\tclip = PM_FlyMove();\n\n\t// Now try going back down from the end point\n\t//  press down the stepheight\n\tVectorCopy(pmove->origin, dest);\n\tdest[2] -= pmove->movevars->stepsize;\n\n\ttrace = pmove->PM_PlayerTrace(pmove->origin, dest, PM_NORMAL, -1);\n\n\t// If we are not on the ground any more then\n\t// use the original movement attempt\n\tif (trace.plane.normal[2] < 0.7f)\n\t\tgoto usedown;\n\n\t// If the trace ended up in empty space, copy the end\n\t// over to the origin.\n\tif (!trace.startsolid && !trace.allsolid)\n\t{\n\t\tVectorCopy(trace.endpos, pmove->origin);\n\t}\n\n\t// Copy this origion to up.\n\tVectorCopy(pmove->origin, pmove->up);\n\n\t// decide which one went farther\n\tdowndist = (down[0] - original[0]) * (down[0] - original[0]) + (down[1] - original[1]) * (down[1] - original[1]);\n\tupdist = (pmove->up[0] - original[0]) * (pmove->up[0] - original[0]) + (pmove->up[1] - original[1]) * (pmove->up[1] - original[1]);\n\n\tif (downdist > updist)\n\t{\nusedown:\n\t\tVectorCopy(down, pmove->origin);\n\t\tVectorCopy(downvel, pmove->velocity);\n\t}\n\telse\n\t{\n\t\t// copy z value from slide move\n\t\tpmove->velocity[2] = downvel[2];\n\t}\n}\n\n// Handles both ground friction and water friction\nvoid PM_Friction()\n{\n\tfloat *vel;\n\tfloat speed;\n\tfloat newspeed, control, friction, drop;\n\tvec3_t newvel;\n\n\t// If we are in water jump cycle, don't apply friction\n\tif (pmove->waterjumptime)\n\t\treturn;\n\n\t// Get velocity\n\tvel = pmove->velocity;\n\n\t// Calculate speed\n\tspeed =  sqrt(float(vel[0] * vel[0] + vel[1] * vel[1] + vel[2] * vel[2]));\n\n\t// If too slow, return\n\tif (speed < 0.1f)\n\t{\n\t\treturn;\n\t}\n\n\tdrop = 0;\n\n\t// apply ground friction\n\t// On an entity that is the ground\n\tif (pmove->onground != -1)\n\t{\n\t\tvec3_t start, stop;\n\t\tpmtrace_t trace;\n\n\t\tstart[0] = stop[0] = pmove->origin[0] + vel[0] / speed * 16;\n\t\tstart[1] = stop[1] = pmove->origin[1] + vel[1] / speed * 16;\n\t\tstart[2] = pmove->origin[2] + pmove->player_mins[pmove->usehull][2];\n\t\tstop[2] = start[2] - 34;\n\n\t\ttrace = pmove->PM_PlayerTrace(start, stop, PM_NORMAL, -1);\n\n\t\tif (trace.fraction == 1.0f)\n\t\t\tfriction = pmove->movevars->friction * pmove->movevars->edgefriction;\n\t\telse\n\t\t\tfriction = pmove->movevars->friction;\n\n\t\t// Grab friction value.\n\t\t//friction = pmove->movevars->friction;\n\n\t\t// player friction?\n\t\tfriction *= pmove->friction;\n\n\t\t// Bleed off some speed, but if we have less than the bleed\n\t\t// threshhold, bleed the theshold amount.\n\t\tcontrol = (speed < pmove->movevars->stopspeed) ? pmove->movevars->stopspeed : speed;\n\n\t\t// Add the amount to t'he drop amount.\n\t\tdrop += friction * (control * pmove->frametime);\n\t}\n\n\t// apply water friction\n\t//if (pmove->waterlevel)\n\t//{\n\t//\tdrop += speed * pmove->movevars->waterfriction * waterlevel * pmove->frametime;\n\t//}\n\n\t// scale the velocity\n\tnewspeed = speed - drop;\n\n\tif (newspeed < 0)\n\t{\n\t\tnewspeed = 0;\n\t}\n\n\t// Determine proportion of old speed we are using.\n\tnewspeed /= speed;\n\n\t// Adjust velocity according to proportion.\n\tnewvel[0] = vel[0] * newspeed;\n\tnewvel[1] = vel[1] * float(newspeed);\n\tnewvel[2] = vel[2] * float(newspeed);\n\n\tVectorCopy(newvel, pmove->velocity);\n}\n\nvoid PM_AirAccelerate(vec_t *wishdir, float wishspeed, float accel)\n{\n\tint i;\n\tfloat addspeed;\n\tfloat wishspd = wishspeed;\n\n\tfloat currentspeed;\n\tfloat accelspeed;\n\n\tif (pmove->dead || pmove->waterjumptime)\n\t\treturn;\n\n\t// Cap speed\n\tif (wishspd > 30)\n\t\twishspd = 30;\n\n\t// Determine veer amount\n\tcurrentspeed = DotProduct(pmove->velocity, wishdir);\n\n\t// See how much to add\n\taddspeed = wishspd - currentspeed;\n\n\t// If not adding any, done.\n\tif (addspeed <= 0)\n\t\treturn;\n\n\t// Determine acceleration speed after acceleration\n\taccelspeed = accel * wishspeed * pmove->frametime * pmove->friction;\n\n\t// Cap it\n\tif (accelspeed > addspeed)\n\t\taccelspeed = addspeed;\n\n\t// Adjust pmove vel.\n\tfor (i = 0; i < 3; i++)\n\t{\n\t\tpmove->velocity[i] += accelspeed * wishdir[i];\n\t}\n}\n\nvoid PM_WaterMove()\n{\n\tint i;\n\tvec3_t wishvel;\n\tvec3_t wishdir;\n\tvec3_t start, dest;\n\tvec3_t temp;\n\tpmtrace_t trace;\n\n\tfloat speed, accelspeed, wishspeed;\n\tfloat newspeed, addspeed;\n\n\t// user intentions\n\tfor (i = 0; i < 3; i++)\n\t{\n\t\twishvel[i] = (pmove->forward[i] * pmove->cmd.forwardmove) + (pmove->cmd.sidemove * pmove->right[i]);\n\t}\n\n\t// Sinking after no other movement occurs\n\tif (!pmove->cmd.forwardmove && !pmove->cmd.sidemove && !pmove->cmd.upmove)\n\t{\n\t\t// drift towards bottom\n\t\twishvel[2] -= 60.0f;\n\t}\n\telse\n\t{\n\t\t// Go straight up by upmove amount.\n\t\twishvel[2] += pmove->cmd.upmove;\n\t}\n\n\t// Copy it over and determine speed\n\tVectorCopy(wishvel, wishdir);\n\twishspeed = VectorNormalize(wishdir);\n\n\t// Cap speed.\n\tif (wishspeed > pmove->maxspeed)\n\t{\n\t\tVectorScale(wishvel, pmove->maxspeed / wishspeed, wishvel);\n\t\twishspeed = pmove->maxspeed;\n\t}\n\n\t// Slow us down a bit.\n\twishspeed *= 0.8;\n\tVectorAdd(pmove->velocity, pmove->basevelocity, pmove->velocity);\n\n\t// Water friction\n\tVectorCopy(pmove->velocity, temp);\n\tspeed = VectorNormalize(temp);\n\n\tif (speed)\n\t{\n\t\tnewspeed = speed - pmove->movevars->friction * pmove->friction * pmove->frametime * speed;\n\n\t\tif (newspeed < 0.0f)\n\t\t{\n\t\t\tnewspeed = 0.0f;\n\t\t}\n\n\t\tVectorScale(pmove->velocity, newspeed / speed, pmove->velocity);\n\t}\n\telse\n\t\tnewspeed = 0;\n\n\t// water acceleration\n\tif (float(wishspeed) < 0.1f)\n\t{\n\t\treturn;\n\t}\n\n\taddspeed = float(wishspeed) - newspeed;\n\n\tif (addspeed > 0.0f)\n\t{\n\t\tVectorNormalize(wishvel);\n\t\taccelspeed = pmove->movevars->accelerate * pmove->friction * pmove->frametime * float(wishspeed);\n\n\t\tif (accelspeed > addspeed)\n\t\t{\n\t\t\taccelspeed = addspeed;\n\t\t}\n\n\t\tfor (i = 0; i < 3; i++)\n\t\t{\n\t\t\tpmove->velocity[i] += accelspeed * wishvel[i];\n\t\t}\n\t}\n\n\t// Now move\n\t// assume it is a stair or a slope, so press down from stepheight above\n\tVectorMA(pmove->origin, pmove->frametime, pmove->velocity, dest);\n\tVectorCopy(dest, start);\n\n\tstart[2] += pmove->movevars->stepsize + 1;\n\ttrace = pmove->PM_PlayerTrace(start, dest, PM_NORMAL, -1);\n\n\t// FIXME: check steep slope?\n\tif (!trace.startsolid && !trace.allsolid)\n\t{\n\t\t// walked up the step, so just keep result and exit\n\t\tVectorCopy(trace.endpos, pmove->origin);\n\t\treturn;\n\t}\n\n\t// Try moving straight along out normal path.\n\tPM_FlyMove();\n}\n\nvoid PM_AirMove()\n{\n\tint i;\n\tvec3_t wishvel;\n\tfloat fmove, smove;\n\tvec3_t wishdir;\n\tfloat wishspeed;\n\n\t// Copy movement amounts\n\tfmove = pmove->cmd.forwardmove;\n\tsmove = pmove->cmd.sidemove;\n\n\t// Zero out z components of movement vectors\n\tpmove->forward[2] = 0;\n\tpmove->right[2] = 0;\n\n\t// Renormalize\n\tVectorNormalize(pmove->forward);\n\tVectorNormalize(pmove->right);\n\n\t// Determine x and y parts of velocity\n\tfor (i = 0; i < 2; i++)\n\t{\n\t\twishvel[i] = pmove->forward[i] * fmove + pmove->right[i] * smove;\n\t}\n\n\t// Zero out z part of velocity\n\twishvel[2] = 0;\n\n\t // Determine maginitude of speed of move\n\tVectorCopy(wishvel, wishdir);\n\twishspeed = VectorNormalize(wishdir);\n\n\t// Clamp to server defined max speed\n\tif (wishspeed > pmove->maxspeed)\n\t{\n\t\tVectorScale(wishvel, pmove->maxspeed/wishspeed, wishvel);\n\t\twishspeed = pmove->maxspeed;\n\t}\n\n\tPM_AirAccelerate(wishdir, wishspeed, pmove->movevars->airaccelerate);\n\n\t// Add in any base velocity to the current velocity.\n\tVectorAdd(pmove->velocity, pmove->basevelocity, pmove->velocity);\n\n\tPM_FlyMove();\n}\n\nqboolean PM_InWater()\n{\n\treturn (pmove->waterlevel > 1) ? TRUE : FALSE;\n}\n\n// Sets pmove->waterlevel and pmove->watertype values.\nqboolean PM_CheckWater()\n{\n#ifdef REGAMEDLL_FIXES\n\t// do not check for dead\n\tif (pmove->dead || pmove->deadflag != DEAD_NO)\n\t\treturn FALSE;\n#endif\n\n\tvec3_t point;\n\tint cont;\n\tint truecont;\n\tfloat height;\n\tfloat heightover2;\n\n\t// Pick a spot just above the players feet.\n\tpoint[0] = pmove->origin[0] + (pmove->player_mins[pmove->usehull][0] + pmove->player_maxs[pmove->usehull][0]) * 0.5f;\n\tpoint[1] = pmove->origin[1] + (pmove->player_mins[pmove->usehull][1] + pmove->player_maxs[pmove->usehull][1]) * 0.5f;\n\tpoint[2] = pmove->origin[2] + pmove->player_mins[pmove->usehull][2] + 1;\n\n\t// Assume that we are not in water at all.\n\tpmove->waterlevel = 0;\n\tpmove->watertype = CONTENTS_EMPTY;\n\n\t// Grab point contents.\n\tcont = pmove->PM_PointContents(point, &truecont);\n\n\t// Are we under water? (not solid and not empty?)\n\tif (cont <= CONTENTS_WATER && cont > CONTENTS_TRANSLUCENT)\n\t{\n\t\t// Set water type\n\t\tpmove->watertype = cont;\n\n\t\t// We are at least at level one\n\t\tpmove->waterlevel = 1;\n\n\t\theight = (pmove->player_mins[pmove->usehull][2] + pmove->player_maxs[pmove->usehull][2]);\n\t\theightover2 = height * 0.5;\n\n\t\t// Now check a point that is at the player hull midpoint.\n\t\tpoint[2] = pmove->origin[2] + heightover2;\n\t\tcont = pmove->PM_PointContents(point, nullptr);\n\n\t\t// If that point is also under water...\n\t\tif (cont <= CONTENTS_WATER && cont > CONTENTS_TRANSLUCENT)\n\t\t{\n\t\t\t// Set a higher water level.\n\t\t\tpmove->waterlevel = 2;\n\n\t\t\t// Now check the eye position.  (view_ofs is relative to the origin)\n\t\t\tpoint[2] = pmove->origin[2] + pmove->view_ofs[2];\n\n\t\t\tcont = pmove->PM_PointContents(point, nullptr);\n\t\t\tif (cont <= CONTENTS_WATER && cont > CONTENTS_TRANSLUCENT)\n\t\t\t{\n\t\t\t\t// In over our eyes\n\t\t\t\tpmove->waterlevel = 3;\n\t\t\t}\n\t\t}\n\n\t\t// Adjust velocity based on water current, if any.\n\t\tif ((truecont <= CONTENTS_CURRENT_0) && (truecont >= CONTENTS_CURRENT_DOWN))\n\t\t{\n\t\t\t// The deeper we are, the stronger the current.\n\t\t\tstatic vec3_t current_table[] =\n\t\t\t{\n\t\t\t\t{1, 0, 0}, {0, 1, 0}, {-1, 0, 0},\n\t\t\t\t{0, -1, 0}, {0, 0, 1}, {0, 0, -1}\n\t\t\t};\n\n\t\t\tVectorMA(pmove->basevelocity, 50.0 * pmove->waterlevel, current_table[CONTENTS_CURRENT_0 - truecont], pmove->basevelocity);\n\t\t}\n\t}\n\n\treturn (pmove->waterlevel > 1) ? TRUE : FALSE;\n}\n\nvoid PM_CategorizePosition()\n{\n\tvec3_t point;\n\tpmtrace_t tr;\n\n\t// if the player hull point one unit down is solid, the player\n\t// is on ground\n\n\t// see if standing on something solid\n\n\t// Doing this before we move may introduce a potential latency in water detection, but\n\t// doing it after can get us stuck on the bottom in water if the amount we move up\n\t// is less than the 1 pixel 'threshold' we're about to snap to.\tAlso, we'll call\n\t// this several times per frame, so we really need to avoid sticking to the bottom of\n\t// water on each call, and the converse case will correct itself if called twice.\n\tPM_CheckWater();\n\n\tpoint[0] = pmove->origin[0];\n\tpoint[1] = pmove->origin[1];\n\tpoint[2] = pmove->origin[2] - 2;\n\n\t// Shooting up really fast.  Definitely not on ground.\n\tif (pmove->velocity[2] > 180)\n\t{\n\t\tpmove->onground = -1;\n\t\treturn;\n\t}\n\n\t// Try and move down.\n\ttr = pmove->PM_PlayerTrace(pmove->origin, point, PM_NORMAL, -1);\n\n\t// If we hit a steep plane, we are not on ground\n\tif (tr.plane.normal[2] < 0.7f)\n\t{\n\t\t// too steep\n\t\tpmove->onground = -1;\n\t}\n\telse\n\t{\n\t\t// Otherwise, point to index of ent under us.\n\t\tpmove->onground = tr.ent;\n\t}\n\n\t// If we are on something...\n\tif (pmove->onground != -1)\n\t{\n\t\t// Then we are not in water jump sequence\n\t\tpmove->waterjumptime = 0;\n\n\t\t// If we could make the move, drop us down that 1 pixel\n\t\tif (pmove->waterlevel < 2 && !tr.startsolid && !tr.allsolid)\n\t\t{\n\t\t\tVectorCopy(tr.endpos, pmove->origin);\n\t\t}\n\t}\n\n\t// Standing on an entity other than the world\n\t// So signal that we are touching something.\n\tif (tr.ent > 0)\n\t{\n\t\tPM_AddToTouched(tr, pmove->velocity);\n\t}\n}\n\n// When a player is stuck, it's costly to try and unstick them\n// Grab a test offset for the player based on a passed in index\nint PM_GetRandomStuckOffsets(int nIndex, int server, vec_t *offset)\n{\n\t// Last time we did a full\n\tint idx;\n\tidx = rgStuckLast[nIndex][server]++;\n\n\tVectorCopy(rgv3tStuckTable[idx % 54], offset);\n\n\treturn (idx % 54);\n}\n\nvoid PM_ResetStuckOffsets(int nIndex, int server)\n{\n\trgStuckLast[nIndex][server] = 0;\n}\n\n// If pmove->origin is in a solid position,\n// try nudging slightly on all axis to\n// allow for the cut precision of the net coordinates\nqboolean PM_CheckStuck()\n{\n\tvec3_t base;\n\tvec3_t offset;\n\tvec3_t test;\n\tint hitent;\n\tint idx;\n\tfloat fTime;\n\tint i;\n\tpmtrace_t traceresult;\n\n\t// Last time we did a full\n\tstatic float rgStuckCheckTime[MAX_CLIENTS][2];\n\n\t// If position is okay, exit\n\thitent = pmove->PM_TestPlayerPosition(pmove->origin, &traceresult);\n\tif (hitent == -1)\n\t{\n\t\tPM_ResetStuckOffsets(pmove->player_index, pmove->server);\n\t\treturn FALSE;\n\t}\n\n\tVectorCopy(pmove->origin, base);\n\n\t// Deal with precision error in network.\n\tif (!pmove->server)\n\t{\n\t\t// World or BSP model\n\t\tif (hitent == 0 || pmove->physents[hitent].model)\n\t\t{\n\t\t\tint nReps = 0;\n\t\t\tPM_ResetStuckOffsets(pmove->player_index, pmove->server);\n\t\t\tdo\n\t\t\t{\n\t\t\t\ti = PM_GetRandomStuckOffsets(pmove->player_index, pmove->server, offset);\n\n\t\t\t\tVectorAdd(base, offset, test);\n\t\t\t\tif (pmove->PM_TestPlayerPosition(test, &traceresult) == -1)\n\t\t\t\t{\n\t\t\t\t\tPM_ResetStuckOffsets(pmove->player_index, pmove->server);\n\t\t\t\t\tVectorCopy(test, pmove->origin);\n\t\t\t\t\treturn FALSE;\n\t\t\t\t}\n\n\t\t\t\tnReps++;\n\t\t\t}\n\t\t\twhile (nReps < 54);\n\t\t}\n\t}\n\n\t// Only an issue on the client.\n\tif (pmove->server)\n\t\tidx = 0;\n\telse\n\t\tidx = 1;\n\n\tfTime = pmove->Sys_FloatTime();\n\n\t// Too soon?\n\tif (rgStuckCheckTime[pmove->player_index][idx] >= (fTime - PM_CHECKSTUCK_MINTIME))\n\t{\n\t\treturn TRUE;\n\t}\n\n\trgStuckCheckTime[pmove->player_index][idx] = fTime;\n\n\tpmove->PM_StuckTouch(hitent, &traceresult);\n\n\ti = PM_GetRandomStuckOffsets(pmove->player_index, pmove->server, offset);\n\n\tVectorAdd(base, offset, test);\n\tif ((hitent = pmove->PM_TestPlayerPosition(test, nullptr)) == -1)\n\t{\n\t\tPM_ResetStuckOffsets(pmove->player_index, pmove->server);\n\n\t\tif (i >= 27)\n\t\t{\n\t\t\tVectorCopy(test, pmove->origin);\n\t\t}\n\n\t\treturn FALSE;\n\t}\n\n\t// If player is flailing while stuck in another player (should never happen), then see\n\t//  if we can't \"unstick\" them forceably.\n\tif ((pmove->cmd.buttons & (IN_JUMP | IN_DUCK | IN_ATTACK)) && pmove->physents[hitent].player != 0)\n\t{\n\t\tfloat x, y, z;\n\t\tfloat xystep = 8.0;\n\t\tfloat zstep = 18.0;\n\t\tfloat xyminmax = xystep;\n\t\tfloat zminmax = 4 * zstep;\n\n\t\tfor (z = 0; z <= zminmax; z += zstep)\n\t\t{\n\t\t\tfor (x = -xyminmax; x <= xyminmax; x += xystep)\n\t\t\t{\n\t\t\t\tfor (y = -xyminmax; y <= xyminmax; y += xystep)\n\t\t\t\t{\n\t\t\t\t\tVectorCopy(base, test);\n\n\t\t\t\t\ttest[0] += x;\n\t\t\t\t\ttest[1] += y;\n\t\t\t\t\ttest[2] += z;\n\n\t\t\t\t\tif (pmove->PM_TestPlayerPosition(test, nullptr) == -1)\n\t\t\t\t\t{\n\t\t\t\t\t\tVectorCopy(test, pmove->origin);\n\t\t\t\t\t\treturn FALSE;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn TRUE;\n}\n\nvoid PM_SpectatorMove()\n{\n\tfloat speed, drop, friction;\n\tfloat control, newspeed;\n\tfloat currentspeed, addspeed;\n\tfloat accelspeed;\n\tint i;\n\tvec3_t wishvel;\n\tfloat fmove, smove;\n\tvec3_t wishdir;\n\tfloat wishspeed;\n\n\t// this routine keeps track of the spectators psoition\n\t// there a two different main move types : track player or moce freely (OBS_ROAMING)\n\t// doesn't need excate track position, only to generate PVS, so just copy\n\t// targets position and real view position is calculated on client (saves server CPU)\n\tif (pmove->iuser1 == OBS_ROAMING)\n\t{\n#ifdef CLIENT_DLL\n\t\tif (iJumpSpectator)\n\t\t{\n\t\t\tVectorCopy(vJumpOrigin, pmove->origin);\n\t\t\tVectorCopy(vJumpAngles, pmove->angles);\n\t\t\tVectorCopy(vec3_origin, pmove->velocity);\n\t\t\tiJumpSpectator = 0;\n\t\t\treturn;\n\t\t}\n#endif\n\t\t// Move around in normal spectator method\n\t\tspeed = Length (pmove->velocity);\n\n\t\tif (speed >= 1.0)\n\t\t{\n\t\t\tdrop = 0;\n\n\t\t\t// extra friction\n\t\t\tfriction = pmove->movevars->friction * 1.5;\n\t\t\tcontrol = speed < pmove->movevars->stopspeed ? pmove->movevars->stopspeed : speed;\n\t\t\tdrop += friction * (control * pmove->frametime);\n\n\t\t\t// scale the velocity\n\t\t\tnewspeed = speed - drop;\n\n\t\t\tif (newspeed < 0)\n\t\t\t{\n\t\t\t\tnewspeed = 0;\n\t\t\t}\n\t\t\tnewspeed /= speed;\n\n\t\t\tVectorScale(pmove->velocity, newspeed, pmove->velocity);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tVectorCopy(vec3_origin, pmove->velocity);\n\t\t}\n\n\t\t// accelerate\n\t\tfmove = pmove->cmd.forwardmove;\n\t\tsmove = pmove->cmd.sidemove;\n\n\t\tVectorNormalize(pmove->forward);\n\t\tVectorNormalize(pmove->right);\n\n\t\tfor (i = 0; i < 3; i++)\n\t\t{\n\t\t\twishvel[i] = pmove->forward[i] * fmove + pmove->right[i] * smove;\n\t\t}\n\n\t\twishvel[2] += pmove->cmd.upmove;\n\n\t\tVectorCopy(wishvel, wishdir);\n\t\twishspeed = VectorNormalize(wishdir);\n\n\t\t// clamp to server defined max speed\n\t\tif (wishspeed > pmove->movevars->spectatormaxspeed)\n\t\t{\n\t\t\tVectorScale(wishvel, pmove->movevars->spectatormaxspeed / wishspeed, wishvel);\n\t\t\twishspeed = pmove->movevars->spectatormaxspeed;\n\t\t}\n\n\t\tcurrentspeed = DotProduct(pmove->velocity, wishdir);\n\n\t\taddspeed = wishspeed - currentspeed;\n\t\tif (addspeed <= 0)\n\t\t{\n\t\t\treturn;\n\t\t}\n\n\t\taccelspeed = pmove->movevars->accelerate * pmove->frametime * wishspeed;\n\t\tif (accelspeed > addspeed)\n\t\t{\n\t\t\taccelspeed = addspeed;\n\t\t}\n\n\t\tfor (i = 0; i < 3; i++)\n\t\t{\n\t\t\tpmove->velocity[i] += accelspeed * wishdir[i];\n\t\t}\n\n\t\t// move\n\t\tVectorMA(pmove->origin, pmove->frametime, pmove->velocity, pmove->origin);\n\t}\n\telse\n\t{\n\t\t// all other modes just track some kind of target, so spectator PVS = target PVS\n\t\tint target;\n\n\t\t// no valid target ?\n\t\tif (pmove->iuser2 <= 0)\n\t\t\treturn;\n\n\t\t// Find the client this player's targeting\n\t\tfor (target = 0; target < pmove->numphysent; target++)\n\t\t{\n\t\t\tif (pmove->physents[target].info == pmove->iuser2)\n\t\t\t\tbreak;\n\t\t}\n\n\t\tif (target == pmove->numphysent)\n\t\t\treturn;\n\n\t\t// use targets position as own origin for PVS\n\t\tVectorCopy(pmove->physents[target].angles, pmove->angles);\n\t\tVectorCopy(pmove->physents[target].origin, pmove->origin);\n\n\t\t// no velocity\n\t\tVectorCopy(vec3_origin, pmove->velocity);\n\t}\n}\n\n// Use for ease-in, ease-out style interpolation (accel/decel)\n// Used by ducking code.\nfloat PM_SplineFraction(float value, float scale)\n{\n\tfloat valueSquared;\n\n\tvalue = scale * value;\n\tvalueSquared = value * value;\n\n\t// Nice little ease-in, ease-out spline-like curve\n\treturn 3 * valueSquared - 2 * valueSquared * value;\n}\n\nfloat PM_SimpleSpline(float value)\n{\n\tfloat valueSquared;\n\n\tvalueSquared = value * value;\n\n\treturn 3 * valueSquared - 2 * valueSquared * value;\n}\n\nvoid PM_FixPlayerCrouchStuck(int direction)\n{\n\tint hitent;\n\tint i;\n\tvec3_t test;\n\n\thitent = pmove->PM_TestPlayerPosition (pmove->origin, nullptr);\n\n\tif (hitent == -1)\n\t{\n\t\treturn;\n\t}\n\n\tVectorCopy(pmove->origin, test);\n\n\tfor (i = 0; i < HalfHumanHeight; i++)\n\t{\n\t\tpmove->origin[2] += direction;\n\t\thitent = pmove->PM_TestPlayerPosition(pmove->origin, nullptr);\n\n\t\tif (hitent == -1)\n\t\t{\n\t\t\treturn;\n\t\t}\n\t}\n\n\t// Failed\n\tVectorCopy(test, pmove->origin);\n}\n\nvoid PM_UnDuck()\n{\n\tpmtrace_t trace;\n\tvec3_t newOrigin;\n\n\tVectorCopy(pmove->origin, newOrigin);\n\n\tif (pmove->onground != -1)\n\t{\n#ifdef REGAMEDLL_FIXES\n\t\tvec3_t offset;\n\t\tVectorSubtract(pmove->player_mins[1], pmove->player_mins[0], offset);\n\t\tVectorAdd(newOrigin, offset, newOrigin);\n#else\n\t\tnewOrigin[2] += 18.0;\n#endif\n\t}\n\n\ttrace = pmove->PM_PlayerTrace(newOrigin, newOrigin, PM_NORMAL, -1);\n\tif (!trace.startsolid)\n\t{\n\t\tpmove->usehull = 0;\n\n\t\t// Oh, no, changing hulls stuck us into something, try unsticking downward first.\n\t\ttrace = pmove->PM_PlayerTrace(newOrigin, newOrigin, PM_NORMAL, -1);\n\n\t\tif (trace.startsolid)\n\t\t{\n\t\t\t// See if we are stuck?  If so, stay ducked with the duck hull until we have a clear spot\n\t\t\t// Con_Printf(\"unstick got stuck\\n\");\n\t\t\tpmove->usehull = 1;\n\t\t\treturn;\n\t\t}\n\n\t\tpmove->flags &= ~FL_DUCKING;\n\t\tpmove->bInDuck = FALSE;\n\t\tpmove->view_ofs[2] = PM_VEC_VIEW;\n\t\tpmove->flDuckTime = 0;\n\n\t\tpmove->flTimeStepSound -= 100;\n\n\t\tif (pmove->flTimeStepSound < 0)\n\t\t{\n\t\t\tpmove->flTimeStepSound = 0;\n\t\t}\n\n\t\tVectorCopy(newOrigin, pmove->origin);\n\n\t\t// Recatagorize position since ducking can change origin\n\t\tPM_CategorizePosition();\n\t}\n}\n\nvoid PM_Duck()\n{\n\tint buttonsChanged = (pmove->oldbuttons ^ pmove->cmd.buttons);\t// These buttons have changed this frame\n\tint nButtonPressed =  buttonsChanged & pmove->cmd.buttons;\t\t// The changed ones still down are \"pressed\"\n\n\tint duckchange = buttonsChanged & IN_DUCK ? 1 : 0;\n\tint duckpressed = nButtonPressed & IN_DUCK ? 1 : 0;\n\n\tif (pmove->cmd.buttons & IN_DUCK)\n\t{\n\t\tpmove->oldbuttons |= IN_DUCK;\n\t}\n\telse\n\t{\n\t\tpmove->oldbuttons &= ~IN_DUCK;\n\t}\n\n#ifdef REGAMEDLL_FIXES\n#define PLAYER_PREVENT_DUCK     (1 << 4)\n\t// Prevent ducking if the iuser3 variable is contain PLAYER_PREVENT_DUCK\n\tif ((pmove->iuser3 & PLAYER_PREVENT_DUCK) == PLAYER_PREVENT_DUCK)\n\t{\n\t\t// Try to unduck\n\t\tif (pmove->flags & FL_DUCKING)\n\t\t{\n\t\t\tPM_UnDuck();\n\t\t}\n\n\t\treturn;\n\t}\n#endif\n\n\tif (pmove->dead || (!(pmove->cmd.buttons & IN_DUCK) && !pmove->bInDuck && !(pmove->flags & FL_DUCKING)))\n\t{\n\t\treturn;\n\t}\n\n\tpmove->cmd.forwardmove *= PLAYER_DUCKING_MULTIPLIER;\n\tpmove->cmd.sidemove *= PLAYER_DUCKING_MULTIPLIER;\n\tpmove->cmd.upmove *= PLAYER_DUCKING_MULTIPLIER;\n\n\tif (pmove->cmd.buttons & IN_DUCK)\n\t{\n\t\tif ((nButtonPressed & IN_DUCK) && !(pmove->flags & FL_DUCKING))\n\t\t{\n\t\t\t// Use 1 second so super long jump will work\n\t\t\tpmove->flDuckTime = 1000;\n\t\t\tpmove->bInDuck = TRUE;\n\t\t}\n\n\t\tif (pmove->bInDuck)\n\t\t{\n\t\t\t// Finish ducking immediately if duck time is over or not on ground\n\t\t\tif (((pmove->flDuckTime / 1000.0) <= (1.0 - TIME_TO_DUCK)) || pmove->onground == -1)\n\t\t\t{\n\t\t\t\tpmove->usehull = 1;\n\t\t\t\tpmove->view_ofs[2] = PM_VEC_DUCK_VIEW;\n\t\t\t\tpmove->flags |= FL_DUCKING;\n\t\t\t\tpmove->bInDuck = FALSE;\n\n\t\t\t\t// HACKHACK - Fudge for collision bug - no time to fix this properly\n\t\t\t\tif (pmove->onground != -1)\n\t\t\t\t{\n#ifdef REGAMEDLL_FIXES\n\t\t\t\t\tvec3_t newOrigin;\n\t\t\t\t\tVectorSubtract(pmove->player_mins[1], pmove->player_mins[0], newOrigin);\n\t\t\t\t\tVectorSubtract(pmove->origin, newOrigin, pmove->origin);\n#else\n\t\t\t\t\tpmove->origin[2] = pmove->origin[2] - 18.0;\n#endif\n\n\t\t\t\t\t// See if we are stuck?\n\t\t\t\t\tPM_FixPlayerCrouchStuck(STUCK_MOVEUP);\n\n\t\t\t\t\t// Recatagorize position since ducking can change origin\n\t\t\t\t\tPM_CategorizePosition();\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tfloat duckFraction = PM_VEC_VIEW;\n\t\t\t\tfloat time = (1.0 - pmove->flDuckTime / 1000.0);\n\n\t\t\t\t// Calc parametric time\n\t\t\t\tif (time >= 0.0) {\n\t\t\t\t\tduckFraction = PM_SplineFraction(time, (1.0 / TIME_TO_DUCK));\n\t\t\t\t}\n\n#ifdef REGAMEDLL_FIXES\n\t\t\t\tfloat fMore = (pmove->player_mins[1][2] - pmove->player_mins[0][2]);\n#else\n\t\t\t\tfloat fMore = (PM_VEC_DUCK_HULL_MIN - PM_VEC_HULL_MIN);\n#endif\n\n\t\t\t\tpmove->view_ofs[2] = ((PM_VEC_DUCK_VIEW - fMore) * duckFraction) + (PM_VEC_VIEW * (1 - duckFraction));\n\t\t\t}\n\t\t}\n\t}\n\t// Try to unduck\n\telse\n\t{\n\t\tPM_UnDuck();\n\t}\n}\n\nvoid PM_LadderMove(physent_t *pLadder)\n{\n\tvec3_t ladderCenter;\n\ttrace_t trace;\n\tbool onFloor;\n\tvec3_t floor;\n\tvec3_t modelmins, modelmaxs;\n\n\tif (pmove->movetype == MOVETYPE_NOCLIP)\n\t\treturn;\n\n\tpmove->PM_GetModelBounds(pLadder->model, modelmins, modelmaxs);\n\n\tVectorAdd(modelmins, modelmaxs, ladderCenter);\n\tVectorScale(ladderCenter, 0.5, ladderCenter);\n\n\tpmove->movetype = MOVETYPE_FLY;\n\n\t// On ladder, convert movement to be relative to the ladder\n\tVectorCopy(pmove->origin, floor);\n\tfloor[2] += pmove->player_mins[pmove->usehull][2] - 1;\n\n\tif (pmove->PM_PointContents(floor, nullptr) == CONTENTS_SOLID)\n\t\tonFloor = true;\n\telse\n\t\tonFloor = false;\n\n\tpmove->gravity = 0;\n\tpmove->PM_TraceModel(pLadder, pmove->origin, ladderCenter, &trace);\n\n\tif (trace.fraction != 1.0f)\n\t{\n\t\tfloat forward = 0, right = 0;\n\t\tvec3_t vpn, v_right;\n\t\tfloat flSpeed = MAX_CLIMB_SPEED;\n\n\t\t// they shouldn't be able to move faster than their maxspeed\n\t\tif (flSpeed > pmove->maxspeed)\n\t\t{\n\t\t\tflSpeed = pmove->maxspeed;\n\t\t}\n\n\t\tAngleVectors(pmove->angles, vpn, v_right, nullptr);\n\n\t\tif (pmove->flags & FL_DUCKING)\n\t\t{\n\t\t\tflSpeed *= PLAYER_DUCKING_MULTIPLIER;\n\t\t}\n\n\t\tif (pmove->cmd.buttons & IN_BACK)\n\t\t{\n\t\t\tforward -= flSpeed;\n\t\t}\n\t\tif (pmove->cmd.buttons & IN_FORWARD)\n\t\t{\n\t\t\tforward += flSpeed;\n\t\t}\n\t\tif (pmove->cmd.buttons & IN_MOVELEFT)\n\t\t{\n\t\t\tright -= flSpeed;\n\t\t}\n\t\tif (pmove->cmd.buttons & IN_MOVERIGHT)\n\t\t{\n\t\t\tright += flSpeed;\n\t\t}\n\n\t\tif (pmove->cmd.buttons & IN_JUMP)\n\t\t{\n\t\t\tpmove->movetype = MOVETYPE_WALK;\n\t\t\tVectorScale(trace.plane.normal, 270, pmove->velocity);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif (forward != 0 || right != 0)\n\t\t\t{\n\t\t\t\tvec3_t velocity, perp, cross, lateral, tmp;\n\t\t\t\tfloat normal;\n\n\t\t\t\tVectorScale(vpn, forward, velocity);\n\t\t\t\tVectorMA(velocity, right, v_right, velocity);\n\n\t\t\t\tVectorClear(tmp);\n\t\t\t\ttmp[2] = 1;\n\n\t\t\t\tCrossProduct(tmp, trace.plane.normal, perp);\n\t\t\t\tVectorNormalize(perp);\n\n\t\t\t\t// decompose velocity into ladder plane\n\t\t\t\tnormal = DotProduct(velocity, trace.plane.normal);\n\t\t\t\t// This is the velocity into the face of the ladder\n\t\t\t\tVectorScale(trace.plane.normal, normal, cross);\n\n\t\t\t\t// This is the player's additional velocity\n\t\t\t\tVectorSubtract(velocity, cross, lateral);\n\n\t\t\t\t// This turns the velocity into the face of the ladder into velocity that\n\t\t\t\t// is roughly vertically perpendicular to the face of the ladder.\n\t\t\t\t// NOTE: It IS possible to face up and move down or face down and move up\n\t\t\t\t// because the velocity is a sum of the directional velocity and the converted\n\t\t\t\t// velocity through the face of the ladder - by design.\n\t\t\t\tCrossProduct(trace.plane.normal, perp, tmp);\n\t\t\t\tVectorMA(lateral, -normal, tmp, pmove->velocity);\n\n\t\t\t\t// On ground moving away from the ladder\n\t\t\t\tif (onFloor && normal > 0)\n\t\t\t\t{\n\t\t\t\t\tVectorMA(pmove->velocity, MAX_CLIMB_SPEED, trace.plane.normal, pmove->velocity);\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tVectorClear(pmove->velocity);\n\t\t\t}\n\t\t}\n\t}\n}\n\nphysent_t *PM_Ladder()\n{\n\tint i;\n\tphysent_t *pe;\n\thull_t *hull;\n\tint num;\n\tvec3_t test;\n\n\tfor (i = 0; i < pmove->nummoveent; i++)\n\t{\n\t\tpe = &pmove->moveents[i];\n\n\t\tif (pe->model && (modtype_t)pmove->PM_GetModelType(pe->model) == mod_brush && pe->skin == CONTENTS_LADDER)\n\t\t{\n\t\t\thull = (hull_t *)pmove->PM_HullForBsp(pe, test);\n\t\t\tnum = hull->firstclipnode;\n\n\t\t\t// Offset the test point appropriately for this hull.\n\t\t\tVectorSubtract(pmove->origin, test, test);\n\n\t\t\t// Test the player's hull for intersection with this model\n\t\t\tif (pmove->PM_HullPointContents(hull, num, test) == CONTENTS_EMPTY)\n\t\t\t{\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\treturn pe;\n\t\t}\n\t}\n\n\treturn nullptr;\n}\n\nvoid PM_WaterJump()\n{\n\tif (pmove->waterjumptime > 10000)\n\t{\n\t\tpmove->waterjumptime = 10000;\n\t}\n\n\tif (!pmove->waterjumptime)\n\t{\n\t\treturn;\n\t}\n\n\tpmove->waterjumptime -= pmove->cmd.msec;\n\n\tif (pmove->waterjumptime < 0 || !pmove->waterlevel)\n\t{\n\t\tpmove->waterjumptime = 0;\n\t\tpmove->flags &= ~FL_WATERJUMP;\n\t}\n\n\tpmove->velocity[0] = pmove->movedir[0];\n\tpmove->velocity[1] = pmove->movedir[1];\n}\n\nvoid PM_AddGravity()\n{\n\tfloat ent_gravity;\n\n\tif (pmove->gravity != 0.0f)\n\t\tent_gravity = pmove->gravity;\n\telse\n\t\tent_gravity = 1.0f;\n\n\tpmove->velocity[2] -= (ent_gravity * pmove->movevars->gravity * pmove->frametime);\n\tpmove->velocity[2] += pmove->basevelocity[2] * pmove->frametime;\n\n\tpmove->basevelocity[2] = 0;\n\tPM_CheckVelocity();\n}\n\n// Does not change the entities velocity at all\npmtrace_t PM_PushEntity(vec_t *push)\n{\n\tpmtrace_t trace;\n\tvec3_t end;\n\n\tVectorAdd(pmove->origin, push, end);\n\n\ttrace = pmove->PM_PlayerTrace(pmove->origin, end, PM_NORMAL, -1);\n\n\tVectorCopy(trace.endpos, pmove->origin);\n\n\t// So we can run impact function afterwards.\n\tif (trace.fraction < 1.0f && !trace.allsolid)\n\t{\n\t\tPM_AddToTouched(trace, pmove->velocity);\n\t}\n\n\treturn trace;\n}\n\nvoid PM_Physics_Toss()\n{\n\tpmtrace_t trace;\n\tvec3_t move;\n\tfloat backoff;\n\n\tPM_CheckWater();\n\n\tif (pmove->velocity[2] > 0)\n\t{\n\t\tpmove->onground = -1;\n\t}\n\n\t// If on ground and not moving, return.\n\tif (pmove->onground != -1)\n\t{\n\t\tif (VectorCompare(pmove->basevelocity, vec3_origin) && VectorCompare(pmove->velocity, vec3_origin))\n\t\t{\n\t\t\treturn;\n\t\t}\n\t}\n\n\tPM_CheckVelocity();\n\n\t// add gravity\n\tif (pmove->movetype != MOVETYPE_FLY && pmove->movetype != MOVETYPE_BOUNCEMISSILE && pmove->movetype != MOVETYPE_FLYMISSILE)\n\t{\n\t\tPM_AddGravity();\n\t}\n\n\t// move origin\n\t// Base velocity is not properly accounted for since this entity will move again after the bounce without\n\t// taking it into account\n\tVectorAdd(pmove->velocity, pmove->basevelocity, pmove->velocity);\n\n\tPM_CheckVelocity();\n\tVectorScale(pmove->velocity, pmove->frametime, move);\n\tVectorSubtract(pmove->velocity, pmove->basevelocity, pmove->velocity);\n\n\t// Should this clear basevelocity\n\ttrace = PM_PushEntity(move);\n\n\tPM_CheckVelocity();\n\n\tif (trace.allsolid)\n\t{\n\t\t// entity is trapped in another solid\n\t\tpmove->onground = trace.ent;\n\t\tVectorCopy(vec3_origin, pmove->velocity);\n\t\treturn;\n\t}\n\n\tif (trace.fraction == 1.0f)\n\t{\n\t\tPM_CheckWater();\n\t\treturn;\n\t}\n\n\tif (pmove->movetype == MOVETYPE_BOUNCE)\n\t{\n\t\tbackoff = 2.0f - pmove->friction;\n\t}\n\telse if (pmove->movetype == MOVETYPE_BOUNCEMISSILE)\n\t{\n\t\tbackoff = 2.0f;\n\t}\n\telse\n\t\tbackoff = 1.0f;\n\n\tPM_ClipVelocity(pmove->velocity, trace.plane.normal, pmove->velocity, backoff);\n\n\t// stop if on ground\n\tif (trace.plane.normal[2] > 0.7f)\n\t{\n\t\tfloat vel;\n\t\tvec3_t base;\n\n\t\tVectorClear(base);\n\t\tif (pmove->velocity[2] < pmove->movevars->gravity * pmove->frametime)\n\t\t{\n\t\t\t// we're rolling on the ground, add static friction.\n\t\t\tpmove->onground = trace.ent;\n\t\t\tpmove->velocity[2] = 0;\n\t\t}\n\n\t\tvel = DotProduct(pmove->velocity, pmove->velocity);\n\n\t\tif (vel < (30 * 30) || (pmove->movetype != MOVETYPE_BOUNCE && pmove->movetype != MOVETYPE_BOUNCEMISSILE))\n\t\t{\n\t\t\tpmove->onground = trace.ent;\n\t\t\tVectorCopy(vec3_origin, pmove->velocity);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tVectorScale(pmove->velocity, (1.0f - trace.fraction) * pmove->frametime * 0.9f, move);\n\t\t\ttrace = PM_PushEntity(move);\n\t\t}\n\n\t\tVectorSubtract(pmove->velocity, base, pmove->velocity);\n\t}\n\n\t// check for in water\n\tPM_CheckWater();\n}\n\nvoid PM_NoClip()\n{\n\tint i;\n\tvec3_t wishvel;\n\tfloat fmove, smove;\n\n\t// Copy movement amounts\n\tfmove = pmove->cmd.forwardmove;\n\tsmove = pmove->cmd.sidemove;\n\n\tVectorNormalize(pmove->forward);\n\tVectorNormalize(pmove->right);\n\n\t// Determine x and y parts of velocity\n\tfor (i = 0; i < 3; i++)\n\t{\n\t\twishvel[i] = pmove->forward[i] * fmove + pmove->right[i] * smove;\n\t}\n\n\twishvel[2] += pmove->cmd.upmove;\n\n\tVectorMA(pmove->origin, pmove->frametime, wishvel, pmove->origin);\n\n\t// Zero out the velocity so that we don't accumulate a huge downward velocity from\n\t// gravity, etc.\n\tVectorClear(pmove->velocity);\n}\n\n// Purpose: Corrects bunny jumping (where player initiates a bunny jump before other\n// movement logic runs, thus making onground == -1 thus making PM_Friction get skipped and\n// running PM_AirMove, which doesn't crop velocity to maxspeed like the ground / other\n// movement logic does.\nvoid PM_PreventMegaBunnyJumping()\n{\n\t// Current player speed\n\tfloat spd;\n\t// If we have to crop, apply this cropping fraction to velocity\n\tfloat fraction;\n\t// Speed at which bunny jumping is limited\n\tfloat maxscaledspeed;\n\n\tmaxscaledspeed = BUNNYJUMP_MAX_SPEED_FACTOR * pmove->maxspeed;\n\n\t// Don't divide by zero\n\tif (maxscaledspeed <= 0.0f)\n\t\treturn;\n\n\tspd = Length(pmove->velocity);\n\n\tif (spd <= maxscaledspeed)\n\t\treturn;\n\n\t// Returns the modifier for the velocity\n\tfraction = (maxscaledspeed / spd) * 0.8;\n\n\t// Crop it down!.\n\tVectorScale(pmove->velocity, fraction, pmove->velocity);\n}\n\nvoid PM_Jump()\n{\n\tif (pmove->dead)\n\t{\n\t\t// don't jump again until released\n\t\tpmove->oldbuttons |= IN_JUMP;\n\t\treturn;\n\t}\n\n\t// See if we are waterjumping.  If so, decrement count and return.\n\tif (pmove->waterjumptime != 0.0f)\n\t{\n\t\tpmove->waterjumptime -= pmove->cmd.msec;\n\n\t\tif (pmove->waterjumptime < 0)\n\t\t{\n\t\t\tpmove->waterjumptime = 0;\n\t\t}\n\n\t\treturn;\n\t}\n\n\t// If we are in the water most of the way...\n\tif (pmove->waterlevel >= 2)\n\t{\n\t\t// swimming, not jumping\n\t\tpmove->onground = -1;\n\n\t\t// We move up a certain amount\n\t\tif (pmove->watertype == CONTENTS_WATER)\n\t\t{\n\t\t\tpmove->velocity[2] = 100;\n\t\t}\n\t\telse if (pmove->watertype == CONTENTS_SLIME)\n\t\t{\n\t\t\tpmove->velocity[2] = 80;\n\t\t}\n\t\telse // LAVA\n\t\t\tpmove->velocity[2] = 50;\n\n\t\t// play swiming sound\n\t\tif (pmove->flSwimTime <= 0)\n\t\t{\n\t\t\t// Don't play sound again for 1 second\n\t\t\tpmove->flSwimTime = 1000.0f;\n\n\t\t\tswitch (pmove->RandomLong(0, 3))\n\t\t\t{\n\t\t\tcase 0: pmove->PM_PlaySound(CHAN_BODY, \"player/pl_wade1.wav\", VOL_NORM, ATTN_NORM, 0, PITCH_NORM); break;\n\t\t\tcase 1: pmove->PM_PlaySound(CHAN_BODY, \"player/pl_wade2.wav\", VOL_NORM, ATTN_NORM, 0, PITCH_NORM); break;\n\t\t\tcase 2: pmove->PM_PlaySound(CHAN_BODY, \"player/pl_wade3.wav\", VOL_NORM, ATTN_NORM, 0, PITCH_NORM); break;\n\t\t\tcase 3: pmove->PM_PlaySound(CHAN_BODY, \"player/pl_wade4.wav\", VOL_NORM, ATTN_NORM, 0, PITCH_NORM); break;\n\t\t\t}\n\t\t}\n\n\t\treturn;\n\t}\n\n\t// No more effect\n\t// in air, so no effect\n\tif (pmove->onground == -1)\n\t{\n\t\t// Flag that we jumped.\n\t\t// don't jump again until released\n\t\tpmove->oldbuttons |= IN_JUMP;\n\t\treturn;\n\t}\n\n\t// don't pogo stick\n\tif (pmove->oldbuttons & IN_JUMP)\n\t{\n\t\treturn;\n\t}\n\n\tif (pmove->bInDuck && (pmove->flags & FL_DUCKING))\n\t{\n\t\treturn;\n\t}\n\n\tPM_CatagorizeTextureType();\n\n\t// In the air now.\n\tpmove->onground = -1;\n\n\tPM_PreventMegaBunnyJumping();\n\n\tfloat fvel = Length(pmove->velocity);\n\tfloat fvol = 1.0f;\n\n\tif (fvel >= 150.0f)\n\t{\n\t\tPM_PlayStepSound(PM_MapTextureTypeStepType(pmove->chtexturetype), fvol);\n\t}\n\n#ifdef REGAMEDLL_ADD\n\t// See if user can super long jump?\n\tbool cansuperjump = (pmove->PM_Info_ValueForKey(pmove->physinfo, \"slj\")[0] == '1');\n\n\t// Acclerate upward\n\t// If we are ducking...\n\tif (pmove->bInDuck || (pmove->flags & FL_DUCKING))\n\t{\n\t\t// Adjust for super long jump module\n\t\t// UNDONE: note this should be based on forward angles, not current velocity.\n\t\tif (cansuperjump && (pmove->cmd.buttons & IN_DUCK) && pmove->flDuckTime > 0 && Length(pmove->velocity) > 50)\n\t\t{\n\t\t\tpmove->punchangle[0] = -5.0f;\n\n\t\t\tfor (int i  = 0; i < 2; i++)\n\t\t\t{\n\t\t\t\tpmove->velocity[i] = pmove->forward[i] * PLAYER_LONGJUMP_SPEED * 1.6f;\n\t\t\t}\n\n\t\t\tpmove->velocity[2] =  sqrt(2 * 800 * 56.0f);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tpmove->velocity[2] =  sqrt(2 * 800 * 45.0f);\n\t\t}\n\t}\n\telse\n#endif\n\t{\n\t\t// NOTE: don't do it in .f (float)\n\t\tpmove->velocity[2] =  sqrt(2.0 * 800.0f * 45.0f);\n\t}\n\n\tif (pmove->fuser2 > 0.0f)\n\t{\n\t\t// NOTE: don't do it in .f (float)\n\t\tfloat flRatio = (100.0 - pmove->fuser2 * 0.001 * 19.0) * 0.01;\n\t\tpmove->velocity[2] *= flRatio;\n\t}\n\n\tpmove->fuser2 = 1315.789429;\n\n\t// Decay it for simulation\n\tPM_FixupGravityVelocity();\n\n\t// Flag that we jumped.\n\t// don't jump again until released\n\tpmove->oldbuttons |= IN_JUMP;\n}\n\nvoid PM_CheckWaterJump()\n{\n\tvec3_t vecStart, vecEnd;\n\tvec3_t flatforward;\n\tvec3_t flatvelocity;\n\tfloat curspeed;\n\tpmtrace_t tr;\n\tint savehull;\n\n\t// Already water jumping.\n\tif (pmove->waterjumptime)\n\t\treturn;\n\n\t// Don't hop out if we just jumped in\n\tif (pmove->velocity[2] < -180)\n\t{\n\t\t// only hop out if we are moving up\n\t\treturn;\n\t}\n\n\t// See if we are backing up\n\tflatvelocity[0] = pmove->velocity[0];\n\tflatvelocity[1] = pmove->velocity[1];\n\tflatvelocity[2] = 0;\n\n\t// Must be moving\n\tcurspeed = VectorNormalize(flatvelocity);\n\n\t// see if near an edge\n\tflatforward[0] = pmove->forward[0];\n\tflatforward[1] = pmove->forward[1];\n\tflatforward[2] = 0;\n\tVectorNormalize(flatforward);\n\n\t// Are we backing into water from steps or something?  If so, don't pop forward\n\tif (curspeed != 0.0 && (DotProduct(flatvelocity, flatforward) < 0.0))\n\t{\n\t\treturn;\n\t}\n\n\tVectorCopy(pmove->origin, vecStart);\n\tvecStart[2] += WJ_HEIGHT;\n\n\tVectorMA(vecStart, 24, flatforward, vecEnd);\n\n\t// Trace, this trace should use the point sized collision hull\n\tsavehull = pmove->usehull;\n\tpmove->usehull = 2;\n\n\ttr = pmove->PM_PlayerTrace(vecStart, vecEnd, PM_NORMAL, -1);\n\n\t// Facing a near vertical wall?\n\tif (tr.fraction < 1.0f && fabs(float(tr.plane.normal[2])) < 0.1f)\n\t{\n\t\tvecStart[2] += pmove->player_maxs[savehull][2] - WJ_HEIGHT;\n\n\t\tVectorMA(vecStart, 24, flatforward, vecEnd);\n\t\tVectorMA(vec3_origin, -50, tr.plane.normal, pmove->movedir);\n\n\t\ttr = pmove->PM_PlayerTrace(vecStart, vecEnd, PM_NORMAL, -1);\n\n\t\tif (tr.fraction == 1.0f)\n\t\t{\n\t\t\tpmove->waterjumptime = 2000.0f;\n\t\t\tpmove->velocity[2] = 225.0f;\n\n\t\t\tpmove->oldbuttons |= IN_JUMP;\n\t\t\tpmove->flags |= FL_WATERJUMP;\n\t\t}\n\t}\n\n\t// Reset the collision hull\n\tpmove->usehull = savehull;\n}\n\nvoid PM_CheckFalling()\n{\n\tif (pmove->onground != -1 && !pmove->dead && pmove->flFallVelocity >= PM_PLAYER_FALL_PUNCH_THRESHHOLD)\n\t{\n\t\tfloat fvol = 0.5f;\n\n\t\tif (pmove->waterlevel <= 0)\n\t\t{\n\t\t\tif (pmove->flFallVelocity > PM_PLAYER_MAX_SAFE_FALL_SPEED)\n\t\t\t{\n\t\t\t\tfvol = 1.0f;\n\t\t\t}\n\t\t\telse if (pmove->flFallVelocity > PM_PLAYER_MAX_SAFE_FALL_SPEED / 2)\n\t\t\t{\n\t\t\t\tfvol = 0.85f;\n\t\t\t}\n\t\t\telse if (pmove->flFallVelocity < PM_PLAYER_MIN_BOUNCE_SPEED)\n\t\t\t{\n\t\t\t\tfvol = 0.0f;\n\t\t\t}\n\t\t}\n\n\t\tif (fvol > 0.0f)\n\t\t{\n\t\t\tPM_CatagorizeTextureType();\n\n\t\t\t// play step sound for current texture\n\t\t\tPM_PlayStepSound(PM_MapTextureTypeStepType(pmove->chtexturetype), fvol);\n\n\t\t\tpmove->flTimeStepSound = 300;\n\n\t\t\t// Knock the screen around a little bit, temporary effect\n\t\t\t// punch z axis\n\t\t\tpmove->punchangle[2] = pmove->flFallVelocity * 0.013;\n\n\t\t\tif (pmove->punchangle[0] > 8.0f)\n\t\t\t{\n\t\t\t\tpmove->punchangle[0] = 8.0f;\n\t\t\t}\n\t\t}\n\t}\n\n\tif (pmove->onground != -1)\n\t{\n\t\tpmove->flFallVelocity = 0;\n\t}\n}\n\nvoid PM_PlayWaterSounds()\n{\n\t// Did we enter or leave water?\n\tif (pmove->oldwaterlevel != 0)\n\t{\n\t\tif (pmove->waterlevel != 0)\n\t\t\treturn;\n\t}\n\telse\n\t{\n\t\tif (pmove->waterlevel == 0)\n\t\t\treturn;\n\t}\n\n\tswitch (pmove->RandomLong(0, 3))\n\t{\n\tcase 0: pmove->PM_PlaySound(CHAN_BODY, \"player/pl_wade1.wav\", VOL_NORM, ATTN_NORM, 0, PITCH_NORM); break;\n\tcase 1: pmove->PM_PlaySound(CHAN_BODY, \"player/pl_wade2.wav\", VOL_NORM, ATTN_NORM, 0, PITCH_NORM); break;\n\tcase 2: pmove->PM_PlaySound(CHAN_BODY, \"player/pl_wade3.wav\", VOL_NORM, ATTN_NORM, 0, PITCH_NORM); break;\n\tcase 3: pmove->PM_PlaySound(CHAN_BODY, \"player/pl_wade4.wav\", VOL_NORM, ATTN_NORM, 0, PITCH_NORM); break;\n\t}\n}\n\nfloat PM_CalcRoll(vec_t *angles, vec_t *velocity, float rollangle, float rollspeed)\n{\n\tfloat sign;\n\tfloat side;\n\tfloat value;\n\tvec3_t forward, right, up;\n\n\tAngleVectors(angles, forward, right, up);\n\n\tside = DotProduct(velocity, right);\n\tsign = side < 0 ? -1 : 1;\n\tside = fabs(side);\n\n\tvalue = rollangle;\n\n\tif (side < rollspeed)\n\t{\n\t\tside = side * value / rollspeed;\n\t}\n\telse\n\t{\n\t\tside = value;\n\t}\n\n\treturn side * sign;\n}\n\nvoid PM_DropPunchAngle(vec_t *punchangle)\n{\n\tfloat len;\n\n\tlen = VectorNormalize(punchangle);\n\tlen -= (10.0 + len * 0.5) * pmove->frametime;\n\tlen = max(len, 0.0f);\n\n\tVectorScale(punchangle, len, punchangle);\n}\n\nvoid PM_CheckParameters()\n{\n\tfloat spd;\n\tfloat maxspeed;\n\tvec3_t v_angle;\n\n\tspd =  sqrt(float(pmove->cmd.sidemove * pmove->cmd.sidemove + pmove->cmd.forwardmove * pmove->cmd.forwardmove + pmove->cmd.upmove * pmove->cmd.upmove));\n\n\tmaxspeed = pmove->clientmaxspeed;\n\n\tif (maxspeed != 0.0f)\n\t{\n\t\tpmove->maxspeed = min(maxspeed, float(pmove->maxspeed));\n\t}\n\n\tif (spd != 0.0f && spd > float(pmove->maxspeed))\n\t{\n\t\tfloat fRatio = pmove->maxspeed / spd;\n\n\t\tpmove->cmd.forwardmove *= fRatio;\n\t\tpmove->cmd.sidemove *= fRatio;\n\t\tpmove->cmd.upmove *= fRatio;\n\t}\n\n\tif ((pmove->flags & (FL_FROZEN | FL_ONTRAIN)) || pmove->dead)\n\t{\n\t\tpmove->cmd.forwardmove = 0;\n\t\tpmove->cmd.sidemove = 0;\n\t\tpmove->cmd.upmove = 0;\n\t}\n\n\tPM_DropPunchAngle(pmove->punchangle);\n\n\t// Take angles from command.\n\tif (!pmove->dead)\n\t{\n\t\tVectorCopy(pmove->cmd.viewangles, v_angle);\n\t\tVectorAdd(v_angle, pmove->punchangle, v_angle);\n\n\t\t// Set up view angles.\n\t\tpmove->angles[ROLL] = PM_CalcRoll(v_angle, pmove->velocity, pmove->movevars->rollangle, pmove->movevars->rollspeed) * 4;\n\t\tpmove->angles[PITCH] = v_angle[PITCH];\n\t\tpmove->angles[YAW] = v_angle[YAW];\n\t}\n\telse\n\t{\n\t\tVectorCopy(pmove->oldangles, pmove->angles);\n\t}\n\n\t// Set dead player view_offset\n\tif (pmove->dead)\n\t{\n\t\tif (pmove->bInDuck)\n\t\t{\n\t\t\tPM_UnDuck();\n\t\t\tpmove->bInDuck = FALSE;\n\t\t}\n\n\t\tpmove->view_ofs[2] = PM_DEAD_VIEWHEIGHT;\n\t}\n\n\t// Adjust client view angles to match values used on server.\n\tif (pmove->angles[YAW] > 180.0f)\n\t{\n\t\tpmove->angles[YAW] -= 360.0f;\n\t}\n}\n\nvoid PM_ReduceTimers()\n{\n\tif (pmove->flTimeStepSound > 0)\n\t{\n\t\tpmove->flTimeStepSound -= pmove->cmd.msec;\n\n\t\tif (pmove->flTimeStepSound < 0)\n\t\t{\n\t\t\tpmove->flTimeStepSound = 0;\n\t\t}\n\t}\n\n\tif (pmove->flDuckTime > 0)\n\t{\n\t\tpmove->flDuckTime -= pmove->cmd.msec;\n\n\t\tif (pmove->flDuckTime < 0)\n\t\t{\n\t\t\tpmove->flDuckTime = 0;\n\t\t}\n\t}\n\n\tif (pmove->flSwimTime > 0)\n\t{\n\t\tpmove->flSwimTime -= pmove->cmd.msec;\n\n\t\tif (pmove->flSwimTime < 0)\n\t\t{\n\t\t\tpmove->flSwimTime = 0;\n\t\t}\n\t}\n\n\tif (pmove->fuser2 > 0.0)\n\t{\n\t\tpmove->fuser2 -= pmove->cmd.msec;\n\n\t\tif (pmove->fuser2 < 0.0)\n\t\t{\n\t\t\tpmove->fuser2 = 0;\n\t\t}\n\t}\n}\n\nqboolean PM_ShouldDoSpectMode()\n{\n\treturn (pmove->iuser3 <= 0 || pmove->deadflag == DEAD_DEAD);\n}\n\n// Returns with origin, angles, and velocity modified in place.\n// Numtouch and touchindex[] will be set if any of the physents\n// were contacted during the move.\n\nvoid PM_PlayerMove(qboolean server)\n{\n\tphysent_t *pLadder = nullptr;\n\n\t// Are we running server code?\n\tpmove->server = server;\n\n\t// Adjust speeds etc.\n\tPM_CheckParameters();\n\n\t// Assume we don't touch anything\n\tpmove->numtouch = 0;\n\n\t// # of msec to apply movement\n\n\t//double v2 = (double)pmove->cmd.msec * 0.001;\n\tpmove->frametime = pmove->cmd.msec * 0.001;\n\n\tPM_ReduceTimers();\n\n\t// Convert view angles to vectors\n\tAngleVectors(pmove->angles, pmove->forward, pmove->right, pmove->up);\n\n\t//PM_ShowClipBox();\n\n\t// Special handling for spectator and observers. (iuser1 is set if the player's in observer mode)\n\tif ((pmove->spectator || pmove->iuser1 > 0) && PM_ShouldDoSpectMode())\n\t{\n\t\tPM_SpectatorMove();\n\t\tPM_CategorizePosition();\n\t\treturn;\n\t}\n\n\t// Always try and unstick us unless we are in NOCLIP mode\n\tif (pmove->movetype != MOVETYPE_NOCLIP && pmove->movetype != MOVETYPE_NONE)\n\t{\n\t\tif (PM_CheckStuck())\n\t\t{\n\t\t\t// Can't move, we're stuck\n\t\t\treturn;\n\t\t}\n\t}\n\n\t// Now that we are \"unstuck\", see where we are (waterlevel and type, pmove->onground).\n\tPM_CategorizePosition();\n\n\t// Store off the starting water level\n\tpmove->oldwaterlevel = pmove->waterlevel;\n\n\t// If we are not on ground, store off how fast we are moving down\n\tif (pmove->onground == -1)\n\t{\n\t\tpmove->flFallVelocity = -pmove->velocity[2];\n\t}\n\n\tg_onladder = FALSE;\n\n\t// Don't run ladder code if dead or on a train\n\tif (!pmove->dead && !(pmove->flags & FL_ONTRAIN))\n\t{\n\t\tpLadder = PM_Ladder();\n\n\t\tif (pLadder)\n\t\t{\n\t\t\tg_onladder = TRUE;\n\t\t}\n\t}\n\n\tPM_Duck();\n\tPM_UpdateStepSound();\n\n\t// Don't run ladder code if dead or on a train\n\tif (!pmove->dead && !(pmove->flags & FL_ONTRAIN))\n\t{\n\t\tif (pLadder)\n\t\t{\n\t\t\tPM_LadderMove(pLadder);\n\t\t}\n\t\telse if (pmove->movetype != MOVETYPE_WALK && pmove->movetype != MOVETYPE_NOCLIP)\n\t\t{\n\t\t\t// Clear ladder stuff unless player is noclipping\n\t\t\t// it will be set immediately again next frame if necessary\n\t\t\tpmove->movetype = MOVETYPE_WALK;\n\t\t}\n\t}\n\n\t// Handle movement\n\tswitch (pmove->movetype)\n\t{\n\tdefault:\n\t\tpmove->Con_DPrintf(\"Bogus pmove player movetype %i on (%i) 0=cl 1=sv\\n\", pmove->movetype, pmove->server);\n\t\tbreak;\n\n\tcase MOVETYPE_NONE:\n\t\tbreak;\n\n\tcase MOVETYPE_NOCLIP:\n\t\tPM_NoClip();\n\t\tbreak;\n\n\tcase MOVETYPE_TOSS:\n\tcase MOVETYPE_BOUNCE:\n\t\tPM_Physics_Toss();\n\t\tbreak;\n\n\tcase MOVETYPE_FLY:\n\t\tPM_CheckWater();\n\n\t\t// Was jump button pressed?\n\t\t// If so, set velocity to 270 away from ladder.  This is currently wrong.\n\t\t// Also, set MOVE_TYPE to walk, too.\n\t\tif (pmove->cmd.buttons & IN_JUMP)\n\t\t{\n\t\t\tif (!pLadder)\n\t\t\t{\n\t\t\t\tPM_Jump();\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tpmove->oldbuttons &= ~IN_JUMP;\n\t\t}\n\n\t\t// Perform the move accounting for any base velocity.\n\t\tVectorAdd(pmove->velocity, pmove->basevelocity, pmove->velocity);\n\t\tPM_FlyMove();\n\t\tVectorSubtract(pmove->velocity, pmove->basevelocity, pmove->velocity);\n\t\tbreak;\n\n\tcase MOVETYPE_WALK:\n\t\tif (!PM_InWater())\n\t\t{\n\t\t\tPM_AddCorrectGravity();\n\t\t}\n\n\t\t// If we are leaping out of the water, just update the counters.\n\t\tif (pmove->waterjumptime != 0.0f)\n\t\t{\n\t\t\tPM_WaterJump();\n\t\t\tPM_FlyMove();\n\n\t\t\t// Make sure waterlevel is set correctly\n\t\t\tPM_CheckWater();\n\t\t\treturn;\n\t\t}\n\n\t\t// If we are swimming in the water, see if we are nudging against a place we can jump up out\n\t\t//  of, and, if so, start out jump.  Otherwise, if we are not moving up, then reset jump timer to 0\n\t\tif (pmove->waterlevel >= 2)\n\t\t{\n\t\t\tif (pmove->waterlevel == 2)\n\t\t\t{\n\t\t\t\tPM_CheckWaterJump();\n\t\t\t}\n\n\t\t\t// If we are falling again, then we must not trying to jump out of water any more.\n\t\t\tif (pmove->velocity[2] < 0 && pmove->waterjumptime)\n\t\t\t{\n\t\t\t\tpmove->waterjumptime = 0;\n\t\t\t}\n\n\t\t\t// Was jump button pressed?\n\t\t\tif (pmove->cmd.buttons & IN_JUMP)\n\t\t\t{\n\t\t\t\tPM_Jump();\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tpmove->oldbuttons &= ~IN_JUMP;\n\t\t\t}\n\n\t\t\t// Perform regular water movement\n\t\t\tPM_WaterMove();\n\n\t\t\tVectorSubtract(pmove->velocity, pmove->basevelocity, pmove->velocity);\n\n\t\t\t// Get a final position\n\t\t\tPM_CategorizePosition();\n\t\t}\n\t\t// Not underwater\n\t\telse\n\t\t{\n\t\t\t// Was jump button pressed?\n\t\t\tif (pmove->cmd.buttons & IN_JUMP)\n\t\t\t{\n\t\t\t\tif (!pLadder)\n\t\t\t\t{\n\t\t\t\t\tPM_Jump();\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tpmove->oldbuttons &= ~IN_JUMP;\n\t\t\t}\n\n\t\t\t// Fricion is handled before we add in any base velocity. That way, if we are on a conveyor,\n\t\t\t// we don't slow when standing still, relative to the conveyor.\n\t\t\tif (pmove->onground != -1)\n\t\t\t{\n\t\t\t\tpmove->velocity[2] = 0;\n\t\t\t\tPM_Friction();\n\t\t\t}\n\n\t\t\t// Make sure velocity is valid.\n\t\t\tPM_CheckVelocity();\n\n\t\t\t// Are we on ground now\n\t\t\tif (pmove->onground != -1)\n\t\t\t{\n\t\t\t\tPM_WalkMove();\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t// Take into account movement when in air.\n\t\t\t\tPM_AirMove();\n\t\t\t}\n\n\t\t\t// Set final flags.\n\t\t\tPM_CategorizePosition();\n\n\t\t\t// Now pull the base velocity back out.\n\t\t\t// Base velocity is set if you are on a moving object, like\n\t\t\t// a conveyor (or maybe another monster?)\n\t\t\tVectorSubtract(pmove->velocity, pmove->basevelocity, pmove->velocity);\n\n\t\t\t// Make sure velocity is valid.\n\t\t\tPM_CheckVelocity();\n\n\t\t\t// Add any remaining gravitational component.\n\t\t\tif (!PM_InWater())\n\t\t\t{\n\t\t\t\tPM_FixupGravityVelocity();\n\t\t\t}\n\n\t\t\t// If we are on ground, no downward velocity.\n\t\t\tif (pmove->onground != -1)\n\t\t\t{\n\t\t\t\tpmove->velocity[2] = 0;\n\t\t\t}\n\n\t\t\t// See if we landed on the ground with enough force to play a landing sound.\n\t\t\tPM_CheckFalling();\n\t\t}\n\n\t\t// Did we enter or leave the water?\n\t\tPM_PlayWaterSounds();\n\t\tbreak;\n\t}\n}\n\nvoid PM_CreateStuckTable()\n{\n\tfloat x, y, z;\n\n\tint idx;\n\tint i;\n\tfloat zi[3];\n\n\tmemset(rgv3tStuckTable, 0, sizeof(rgv3tStuckTable));\n\n\tidx = 0;\n\n\t// Little Moves.\n\tx = 0;\n\ty = 0;\n\n\t// Z moves\n\tfor (z = -0.125; z <= 0.125; z += 0.125)\n\t{\n\t\trgv3tStuckTable[idx][0] = x;\n\t\trgv3tStuckTable[idx][1] = y;\n\t\trgv3tStuckTable[idx][2] = z;\n\n\t\tidx++;\n\t}\n\n\tx = 0;\n\tz = 0;\n\t// Y moves\n\tfor (y = -0.125; y <= 0.125; y += 0.125)\n\t{\n\t\trgv3tStuckTable[idx][0] = x;\n\t\trgv3tStuckTable[idx][1] = y;\n\t\trgv3tStuckTable[idx][2] = z;\n\n\t\tidx++;\n\t}\n\n\ty = 0;\n\tz = 0;\n\t// X moves\n\tfor (x = -0.125; x <= 0.125; x += 0.125)\n\t{\n\t\trgv3tStuckTable[idx][0] = x;\n\t\trgv3tStuckTable[idx][1] = y;\n\t\trgv3tStuckTable[idx][2] = z;\n\n\t\tidx++;\n\t}\n\n\t// Remaining multi axis nudges.\n\tfor (x = -0.125; x <= 0.125; x += 0.250)\n\t{\n\t\tfor (y = -0.125; y <= 0.125; y += 0.250)\n\t\t{\n\t\t\tfor (z = -0.125; z <= 0.125; z += 0.250)\n\t\t\t{\n\t\t\t\trgv3tStuckTable[idx][0] = x;\n\t\t\t\trgv3tStuckTable[idx][1] = y;\n\t\t\t\trgv3tStuckTable[idx][2] = z;\n\n\t\t\t\tidx++;\n\t\t\t}\n\t\t}\n\t}\n\n\t// Big Moves.\n\tx = 0;\n\ty = 0;\n\n\tzi[0] = 0.0f;\n\tzi[1] = 1.0f;\n\tzi[2] = 6.0f;\n\n\tfor (i = 0; i < 3; i++)\n\t{\n\t\t// Z moves\n\t\tz = zi[i];\n\n\t\trgv3tStuckTable[idx][0] = x;\n\t\trgv3tStuckTable[idx][1] = y;\n\t\trgv3tStuckTable[idx][2] = z;\n\n\t\tidx++;\n\t}\n\n\tx = 0;\n\tz = 0;\n\n\t// Y moves\n\tfor (y = -2.0f; y <= 2.0f; y += 2.0)\n\t{\n\t\trgv3tStuckTable[idx][0] = x;\n\t\trgv3tStuckTable[idx][1] = y;\n\t\trgv3tStuckTable[idx][2] = z;\n\n\t\tidx++;\n\t}\n\n\ty = 0;\n\tz = 0;\n\n\t// X moves\n\tfor (x = -2.0f; x <= 2.0f; x += 2.0f)\n\t{\n\t\trgv3tStuckTable[idx][0] = x;\n\t\trgv3tStuckTable[idx][1] = y;\n\t\trgv3tStuckTable[idx][2] = z;\n\n\t\tidx++;\n\t}\n\n\t// Remaining multi axis nudges.\n\tfor (i = 0; i < 3; i++)\n\t{\n\t\tz = zi[i];\n\n\t\tfor (x = -2.0f; x <= 2.0f; x += 2.0f)\n\t\t{\n\t\t\tfor (y = -2.0f; y <= 2.0f; y += 2.0)\n\t\t\t{\n\t\t\t\trgv3tStuckTable[idx][0] = x;\n\t\t\t\trgv3tStuckTable[idx][1] = y;\n\t\t\t\trgv3tStuckTable[idx][2] = z;\n\n\t\t\t\tidx++;\n\t\t\t}\n\t\t}\n\t}\n}\n\n// This module implements the shared player physics code between any particular game and\n// the engine. The same PM_Move routine is built into the game .dll and the client .dll and is\n// invoked by each side as appropriate. There should be no distinction, internally, between server\n// and client. This will ensure that prediction behaves appropriately.\n\nvoid PM_Move(playermove_t *ppmove, int server)\n{\n#if 0\n\tassert(pm_shared_initialized);\n#endif\n\tpmove = ppmove;\n\n\tPM_PlayerMove((server != 0) ? TRUE : FALSE);\n\n\tif (pmove->onground != -1)\n\t\tpmove->flags |= FL_ONGROUND;\n\telse\n\t\tpmove->flags &= ~FL_ONGROUND;\n\n\tif (!pmove->multiplayer && pmove->movetype == MOVETYPE_WALK)\n\t{\n\t\tpmove->friction = 1.0f;\n\t}\n}\n\nint PM_GetVisEntInfo(int ent)\n{\n\tif (ent >= 0 && ent <= pmove->numvisent)\n\t{\n\t\treturn pmove->visents[ent].info;\n\t}\n\n\treturn -1;\n}\n\nint PM_GetPhysEntInfo(int ent)\n{\n\tif (ent >= 0 && ent <= pmove->numphysent)\n\t{\n\t\treturn pmove->physents[ent].info;\n\t}\n\n\treturn -1;\n}\n\nvoid PM_Init( playermove_t *ppmove)\n{\n#if 0\n\tassert(!pm_shared_initialized);\n#endif\n\tpmove = ppmove;\n\n\tPM_CreateStuckTable();\n\tPM_InitTextureTypes();\n\n\tpm_shared_initialized = TRUE;\n}\n"
  },
  {
    "path": "pm_shared/pm_shared.h",
    "content": "/*\n*\n*   This program is free software; you can redistribute it and/or modify it\n*   under the terms of the GNU General Public License as published by the\n*   Free Software Foundation; either version 2 of the License, or (at\n*   your option) any later version.\n*\n*   This program is distributed in the hope that it will be useful, but\n*   WITHOUT ANY WARRANTY; without even the implied warranty of\n*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n*   General Public License for more details.\n*\n*   You should have received a copy of the GNU General Public License\n*   along with this program; if not, write to the Free Software Foundation,\n*   Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\n*\n*   In addition, as a special exception, the author gives permission to\n*   link the code of this program with the Half-Life Game Engine (\"HL\n*   Engine\") and Modified Game Libraries (\"MODs\") developed by Valve,\n*   L.L.C (\"Valve\").  You must obey the GNU General Public License in all\n*   respects for all of the code used other than the HL Engine and MODs\n*   from Valve.  If you modify this file, you may extend this exception\n*   to your version of the file, but you are not obligated to do so.  If\n*   you do not wish to do so, delete this exception statement from your\n*   version.\n*\n*/\n\n#ifndef PM_SHARED_H\n#define PM_SHARED_H\n#ifdef _WIN32\n#pragma once\n#endif\n\n#include \"pmtrace.h\"\n#include \"pm_defs.h\"\n\n#define MAX_CLIENTS\t\t\t32\n\n#define PM_DEAD_VIEWHEIGHT\t\t-8\n\n#define OBS_NONE\t\t\t0\n#define OBS_CHASE_LOCKED\t\t1\n#define OBS_CHASE_FREE\t\t\t2\n#define OBS_ROAMING\t\t\t3\n#define OBS_IN_EYE\t\t\t4\n#define OBS_MAP_FREE\t\t\t5\n#define OBS_MAP_CHASE\t\t\t6\n\n#define STEP_CONCRETE\t\t\t0\n#define STEP_METAL\t\t\t1\n#define STEP_DIRT\t\t\t2\n#define STEP_VENT\t\t\t3\n#define STEP_GRATE\t\t\t4\n#define STEP_TILE\t\t\t5\n#define STEP_SLOSH\t\t\t6\n#define STEP_WADE\t\t\t7\n#define STEP_LADDER\t\t\t8\n#define STEP_SNOW\t\t\t9\n\n#define WJ_HEIGHT\t\t\t\t8\n#define\tSTOP_EPSILON\t\t\t\t0.1\n#define MAX_CLIMB_SPEED\t\t\t\t200\n#define PLAYER_DUCKING_MULTIPLIER\t\t0.333\n#define PM_CHECKSTUCK_MINTIME\t\t\t0.05\t// Don't check again too quickly.\n\n#define PLAYER_LONGJUMP_SPEED\t\t\t350.0f\t// how fast we longjump\n\n// Ducking time\n#define TIME_TO_DUCK\t\t\t\t0.4\n#define STUCK_MOVEUP\t\t\t\t1\n\n#define PM_VEC_DUCK_HULL_MIN\t\t\t-18\n#define PM_VEC_HULL_MIN\t\t\t\t-36\n#define PM_VEC_DUCK_VIEW\t\t\t12\n#define PM_VEC_VIEW\t\t\t\t17\n\n#define PM_PLAYER_MAX_SAFE_FALL_SPEED\t\t580\t// approx 20 feet\n#define PM_PLAYER_MIN_BOUNCE_SPEED\t\t350\n#define PM_PLAYER_FALL_PUNCH_THRESHHOLD\t\t250\t// won't punch player's screen/make scrape noise unless player falling at least this fast.\n\n// Only allow bunny jumping up to 1.2x server / player maxspeed setting\n#define BUNNYJUMP_MAX_SPEED_FACTOR\t\t1.2f\n\nvoid PM_SwapTextures(int i, int j);\nint PM_IsThereGrassTexture();\nvoid PM_SortTextures();\nvoid PM_InitTextureTypes();\nchar PM_FindTextureType(char *name);\nvoid PM_PlayStepSound(int step, float fvol);\nint PM_MapTextureTypeStepType(char chTextureType);\nvoid PM_CatagorizeTextureType();\nvoid PM_UpdateStepSound();\nqboolean PM_AddToTouched(pmtrace_t tr, vec_t *impactvelocity);\nvoid PM_CheckVelocity();\nint PM_ClipVelocity(vec_t *in, vec_t *normal, vec_t *out, float overbounce);\nvoid PM_AddCorrectGravity();\nvoid PM_FixupGravityVelocity();\nint PM_FlyMove();\nvoid PM_Accelerate(vec_t *wishdir, float wishspeed, float accel);\nvoid PM_WalkMove();\nvoid PM_Friction();\nvoid PM_AirAccelerate(vec_t *wishdir, float wishspeed, float accel);\nvoid PM_WaterMove();\nvoid PM_AirMove();\nqboolean PM_InWater();\nqboolean PM_CheckWater();\nvoid PM_CatagorizePosition();\nint PM_GetRandomStuckOffsets(int nIndex, int server, vec_t *offset);\nvoid PM_ResetStuckOffsets(int nIndex, int server);\nint PM_CheckStuck();\nvoid PM_SpectatorMove();\nfloat PM_SplineFraction(float value, float scale);\nfloat PM_SimpleSpline(float value);\nvoid PM_FixPlayerCrouchStuck(int direction);\nvoid PM_Duck();\nvoid PM_LadderMove(physent_t *pLadder);\nphysent_t *PM_Ladder();\nvoid PM_WaterJump();\nvoid PM_AddGravity();\npmtrace_t PM_PushEntity(vec_t *push);\nvoid PM_Physics_Toss();\nvoid PM_NoClip();\nvoid PM_PreventMegaBunnyJumping();\nvoid PM_Jump();\nvoid PM_CheckWaterJump();\nvoid PM_CheckFalling();\nvoid PM_PlayWaterSounds();\nfloat PM_CalcRoll(vec_t *angles, vec_t *velocity, float rollangle, float rollspeed);\nvoid PM_DropPunchAngle(vec_t *punchangle);\nvoid PM_CheckParamters();\nvoid PM_ReduceTimers();\nqboolean PM_ShouldDoSpectMode();\nvoid PM_PlayerMove(qboolean server);\nvoid PM_CreateStuckTable();\nvoid PM_Move(playermove_t *ppmove, int server);\nint PM_GetVisEntInfo(int ent);\nint PM_GetPhysEntInfo(int ent);\nvoid PM_Init(playermove_t *ppmove);\n\nextern playermove_t *pmove;\n\n#endif // PM_SHARED_H\n"
  },
  {
    "path": "public/build.h",
    "content": "/*\nbuild.h - compile-time build information\n\nThis is free and unencumbered software released into the public domain.\n\nAnyone is free to copy, modify, publish, use, compile, sell, or\ndistribute this software, either in source code form or as a compiled\nbinary, for any purpose, commercial or non-commercial, and by any\nmeans.\n\nIn jurisdictions that recognize copyright laws, the author or authors\nof this software dedicate any and all copyright interest in the\nsoftware to the public domain. We make this dedication for the benefit\nof the public at large and to the detriment of our heirs and\nsuccessors. We intend this dedication to be an overt act of\nrelinquishment in perpetuity of all present and future rights to this\nsoftware under copyright law.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR\nOTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,\nARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\nOTHER DEALINGS IN THE SOFTWARE.\n\nFor more information, please refer to <http://unlicense.org/>\n*/\n#pragma once\n#ifndef BUILD_H\n#define BUILD_H\n\n/*\nAll XASH_* macros set by this header are guaranteed to have positive value\notherwise not defined.\n\nEvery macro is intended to be the unified interface for buildsystems that lack\nplatform & CPU detection, and a neat quick way for checks in platform code\nFor Q_build* macros, refer to buildenums.h\n\nAny new define must be undefined at first\nYou can generate #undef list below with this oneliner:\n  $ sed 's/\\t//g' build.h | grep '^#define XASH' | awk '{ print $2 }' | \\\n\t\tsort | uniq | awk '{ print \"#undef \" $1 }'\n\nThen you can use another oneliner to query all variables:\n  $ grep '^#undef XASH' build.h | awk '{ print $2 }'\n*/\n\n#undef XASH_64BIT\n#undef XASH_AMD64\n#undef XASH_ANDROID\n#undef XASH_APPLE\n#undef XASH_ARM\n#undef XASH_ARM_HARDFP\n#undef XASH_ARM_SOFTFP\n#undef XASH_ARMv4\n#undef XASH_ARMv5\n#undef XASH_ARMv6\n#undef XASH_ARMv7\n#undef XASH_ARMv8\n#undef XASH_BIG_ENDIAN\n#undef XASH_DOS4GW\n#undef XASH_E2K\n#undef XASH_EMSCRIPTEN\n#undef XASH_FREEBSD\n#undef XASH_HAIKU\n#undef XASH_IOS\n#undef XASH_IRIX\n#undef XASH_JS\n#undef XASH_LINUX\n#undef XASH_LITTLE_ENDIAN\n#undef XASH_MIPS\n#undef XASH_MOBILE_PLATFORM\n#undef XASH_NETBSD\n#undef XASH_OPENBSD\n#undef XASH_POSIX\n#undef XASH_PPC\n#undef XASH_RISCV\n#undef XASH_RISCV_DOUBLEFP\n#undef XASH_RISCV_SINGLEFP\n#undef XASH_RISCV_SOFTFP\n#undef XASH_SERENITY\n#undef XASH_SUNOS\n#undef XASH_TERMUX\n#undef XASH_WIN32\n#undef XASH_X86\n#undef XASH_NSWITCH\n#undef XASH_PSVITA\n#undef XASH_WASI\n#undef XASH_WASM\n\n//================================================================\n//\n//           PLATFORM DETECTION CODE\n//\n//================================================================\n#if defined _WIN32\n\t#define XASH_WIN32 1\n#elif defined __WATCOMC__ && defined __DOS__\n\t#define XASH_DOS4GW 1\n#else // POSIX compatible\n\t#define XASH_POSIX 1\n\t#if defined __linux__\n\t\t#if defined __ANDROID__\n\t\t\t#define XASH_ANDROID 1\n\t\t\t#if defined __TERMUX__\n\t\t\t\t#define XASH_TERMUX 1\n\t\t\t#endif\n\t\t#endif\n\t\t#define XASH_LINUX 1\n\t#elif defined __FreeBSD__\n\t\t#define XASH_FREEBSD 1\n\t#elif defined __NetBSD__\n\t\t#define XASH_NETBSD 1\n\t#elif defined __OpenBSD__\n\t\t#define XASH_OPENBSD 1\n\t#elif defined __HAIKU__\n\t\t#define XASH_HAIKU 1\n\t#elif defined __serenity__\n\t\t#define XASH_SERENITY 1\n\t#elif defined __sgi\n\t\t#define XASH_IRIX 1\n\t#elif defined __APPLE__\n\t\t#include <TargetConditionals.h>\n\t\t#define XASH_APPLE 1\n\t\t#if TARGET_OS_IOS\n\t\t\t#define XASH_IOS 1\n\t\t#endif // TARGET_OS_IOS\n\t#elif defined __SWITCH__\n\t\t#define XASH_NSWITCH 1\n\t#elif defined __vita__\n\t\t#define XASH_PSVITA 1\n\t#elif defined __wasi__\n\t\t#define XASH_WASI 1\n\t#elif defined __sun__\n\t\t#define XASH_SUNOS 1\n\t#elif defined __EMSCRIPTEN__\n\t\t#define XASH_EMSCRIPTEN 1\n\t#else\n\t\t#error\n\t#endif\n#endif\n\n// XASH_SAILFISH is special: SailfishOS by itself is a normal GNU/Linux platform\n// It doesn't make sense to split it to separate platform\n// but we still need XASH_MOBILE_PLATFORM for the engine.\n// So this macro is defined entirely in build-system: see main wscript\n// HLSDK/PrimeXT/other SDKs users note: you may ignore this macro\n#if ( XASH_ANDROID && !XASH_TERMUX ) || XASH_IOS || XASH_NSWITCH || XASH_PSVITA || XASH_SAILFISH\n\t#define XASH_MOBILE_PLATFORM 1\n#endif\n\n//================================================================\n//\n//           ENDIANNESS DEFINES\n//\n//================================================================\n\n#if !defined XASH_ENDIANNESS\n\t#if defined XASH_WIN32 || __LITTLE_ENDIAN__\n\t\t//!!! Probably all WinNT installations runs in little endian\n\t\t#define XASH_LITTLE_ENDIAN 1\n\t#elif __BIG_ENDIAN__\n\t\t#define XASH_BIG_ENDIAN 1\n\t#elif defined __BYTE_ORDER__ && defined __ORDER_BIG_ENDIAN__ && defined __ORDER_LITTLE_ENDIAN__ // some compilers define this\n\t\t#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__\n\t\t\t#define XASH_BIG_ENDIAN 1\n\t\t#elif __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__\n\t\t\t#define XASH_LITTLE_ENDIAN 1\n\t\t#endif\n\t#else\n\t\t#include <sys/param.h>\n\t\t#if __BYTE_ORDER == __BIG_ENDIAN\n\t\t\t#define XASH_BIG_ENDIAN 1\n\t\t#elif __BYTE_ORDER == __LITTLE_ENDIAN\n\t\t\t#define XASH_LITTLE_ENDIAN 1\n\t\t#endif\n\t#endif // !XASH_WIN32\n#endif\n\n//================================================================\n//\n//           CPU ARCHITECTURE DEFINES\n//\n//================================================================\n#if defined __x86_64__ || defined _M_X64\n\t#define XASH_64BIT 1\n\t#define XASH_AMD64 1\n#elif defined __i386__ || defined _X86_ || defined _M_IX86\n\t#define XASH_X86 1\n#elif defined __aarch64__ || defined _M_ARM64\n\t#define XASH_64BIT 1\n\t#define XASH_ARM   8\n#elif defined __mips__\n\t#define XASH_MIPS 1\n// commented out to avoid misdetection, modern Emscripten versions target WASM only\n//#elif defined __EMSCRIPTEN__\n//\t#define XASH_JS 1\n#elif defined __e2k__\n\t#define XASH_64BIT 1\n\t#define XASH_E2K 1\n#elif defined __PPC__ || defined __powerpc__\n\t#define XASH_PPC 1\n\t#if defined __PPC64__ || defined __powerpc64__\n\t\t#define XASH_64BIT 1\n\t#endif\n#elif defined _M_ARM // msvc\n\t#define XASH_ARM 7\n\t#define XASH_ARM_HARDFP 1\n#elif defined __arm__\n\t#if __ARM_ARCH == 8 || __ARM_ARCH_8__\n\t\t#define XASH_ARM 8\n\t#elif __ARM_ARCH == 7 || __ARM_ARCH_7__\n\t\t#define XASH_ARM 7\n\t#elif __ARM_ARCH == 6 || __ARM_ARCH_6__ || __ARM_ARCH_6J__\n\t\t#define XASH_ARM 6\n\t#elif __ARM_ARCH == 5 || __ARM_ARCH_5__\n\t\t#define XASH_ARM 5\n\t#elif __ARM_ARCH == 4 || __ARM_ARCH_4__\n\t\t#define XASH_ARM 4\n\t#else\n\t\t#error \"Unknown ARM\"\n\t#endif\n\n\t#if defined __SOFTFP__ || __ARM_PCS_VFP == 0\n\t\t#define XASH_ARM_SOFTFP 1\n\t#else // __SOFTFP__\n\t\t#define XASH_ARM_HARDFP 1\n\t#endif // __SOFTFP__\n#elif defined __riscv\n\t#define XASH_RISCV 1\n\n\t#if __riscv_xlen == 64\n\t\t#define XASH_64BIT 1\n\t#elif __riscv_xlen != 32\n\t\t#error \"Unknown RISC-V ABI\"\n\t#endif\n\n\t#if defined __riscv_float_abi_soft\n\t\t#define XASH_RISCV_SOFTFP 1\n\t#elif defined __riscv_float_abi_single\n\t\t#define XASH_RISCV_SINGLEFP 1\n\t#elif defined __riscv_float_abi_double\n\t\t#define XASH_RISCV_DOUBLEFP 1\n\t#else\n\t\t#error \"Unknown RISC-V float ABI\"\n\t#endif\n#elif defined __wasm__\n\t#if defined __wasm64__\n\t\t#define XASH_64BIT 1\n\t#endif\n\t#define XASH_WASM 1\n#else\n\t#error \"Place your architecture name here! If this is a mistake, try to fix conditions above and report a bug\"\n#endif\n\n#if !XASH_64BIT && ( defined( __LP64__ ) || defined( _LP64 ))\n#define XASH_64BIT 1\n#endif\n\n#if XASH_ARM == 8\n\t#define XASH_ARMv8 1\n#elif XASH_ARM == 7\n\t#define XASH_ARMv7 1\n#elif XASH_ARM == 6\n\t#define XASH_ARMv6 1\n#elif XASH_ARM == 5\n\t#define XASH_ARMv5 1\n#elif XASH_ARM == 4\n\t#define XASH_ARMv4 1\n#endif\n\n#endif // BUILD_H\n"
  },
  {
    "path": "public/cl_dll/IGameClientExports.h",
    "content": "//========= Copyright � 1996-2002, Valve LLC, All rights reserved. ============\n//\n// Purpose: \n//\n// $NoKeywords: $\n//=============================================================================\n\n#ifndef IGAMECLIENTEXPORTS_H\n#define IGAMECLIENTEXPORTS_H\n#ifdef _WIN32\n#pragma once\n#endif\n\n#include \"interface.h\"\n\n//-----------------------------------------------------------------------------\n// Purpose: Exports a set of functions for the GameUI interface to interact with the game client\n//-----------------------------------------------------------------------------\nclass IGameClientExports : public IBaseInterface\n{\npublic:\n\t// returns the name of the server the user is connected to, if any\n\tvirtual const char *GetServerHostName() = 0;\n\n\t// ingame voice manipulation\n\tvirtual bool IsPlayerGameVoiceMuted(int playerIndex) = 0;\n\tvirtual void MutePlayerGameVoice(int playerIndex) = 0;\n\tvirtual void UnmutePlayerGameVoice(int playerIndex) = 0;\n};\n\n#define GAMECLIENTEXPORTS_INTERFACE_VERSION \"GameClientExports001\"\n\n\n#endif // IGAMECLIENTEXPORTS_H\n"
  },
  {
    "path": "public/steam/steamtypes.h",
    "content": "//========= Copyright � 1996-2008, Valve LLC, All rights reserved. ============\n//\n// Purpose:\n//\n//=============================================================================\n\n#ifndef STEAMTYPES_H\n#define STEAMTYPES_H\n#ifdef _WIN32\n#pragma once\n#endif\n\n// Steam-specific types. Defined here so this header file can be included in other code bases.\n#if defined( __GNUC__ ) && !defined(POSIX)\n\t#if __GNUC__ < 4\n\t\t#error \"Steamworks requires GCC 4.X (4.2 or 4.4 have been tested)\"\n\t#endif\n\t#define POSIX 1\n#endif\n\n#if defined(__x86_64__) || defined(_WIN64) || defined(__aarch64__) || defined(__powerpc64__)\n#define X64BITS\n#endif\n\n// Make sure VALVE_BIG_ENDIAN gets set on PS3, may already be set previously in Valve internal code.\n#if !defined(VALVE_BIG_ENDIAN) && defined(_PS3)\n#define VALVE_BIG_ENDIAN\n#endif\n\ntypedef unsigned char uint8;\ntypedef signed char int8;\n\n#if defined( _WIN32 )\n\ntypedef __int16 int16;\ntypedef unsigned __int16 uint16;\ntypedef __int32 int32;\ntypedef unsigned __int32 uint32;\ntypedef __int64 int64;\ntypedef unsigned __int64 uint64;\n\n#ifdef X64BITS\ntypedef __int64 intp;\t\t\t\t// intp is an integer that can accomodate a pointer\ntypedef unsigned __int64 uintp;\t\t// (ie, sizeof(intp) >= sizeof(int) && sizeof(intp) >= sizeof(void *)\n#else\ntypedef __int32 intp;\ntypedef unsigned __int32 uintp;\n#endif\n\n#else // _WIN32\n\ntypedef short int16;\ntypedef unsigned short uint16;\ntypedef int int32;\ntypedef unsigned int uint32;\ntypedef long long int64;\ntypedef unsigned long long uint64;\n#ifdef X64BITS\ntypedef long long intp;\ntypedef unsigned long long uintp;\n#else\ntypedef int intp;\ntypedef unsigned int uintp;\n#endif\n\n#endif // else _WIN32\n\n#ifdef __cplusplus\nconst int k_cubSaltSize   = 8;\n#else\n#define k_cubSaltSize 8\n#endif\n\ntypedef\tuint8 Salt_t[ k_cubSaltSize ];\n\n//-----------------------------------------------------------------------------\n// GID (GlobalID) stuff\n// This is a globally unique identifier.  It's guaranteed to be unique across all\n// racks and servers for as long as a given universe persists.\n//-----------------------------------------------------------------------------\n// NOTE: for GID parsing/rendering and other utils, see gid.h\ntypedef uint64 GID_t;\n\n#ifdef __cplusplus\nconst GID_t k_GIDNil = 0xffffffffffffffffull;\n#else\n#define k_GIDNil 0xffffffffffffffffull;\n#endif\n\n// For convenience, we define a number of types that are just new names for GIDs\ntypedef GID_t JobID_t;\t\t\t// Each Job has a unique ID\ntypedef GID_t TxnID_t;\t\t\t// Each financial transaction has a unique ID\n\n#ifdef __cplusplus\nconst GID_t k_TxnIDNil = k_GIDNil;\nconst GID_t k_TxnIDUnknown = 0;\n#else\n#define k_TxnIDNil k_GIDNil;\n#define  k_TxnIDUnknown 0;\n#endif\n\n// this is baked into client messages and interfaces as an int, \n// make sure we never break this.\ntypedef uint32 PackageId_t;\n#ifdef __cplusplus\nconst PackageId_t k_uPackageIdFreeSub = 0x0;\nconst PackageId_t k_uPackageIdInvalid = 0xFFFFFFFF;\n#else\n#define k_uPackageIdFreeSub 0x0;\n#define k_uPackageIdInvalid 0xFFFFFFFF;\n#endif\n\n// this is baked into client messages and interfaces as an int, \n// make sure we never break this.\ntypedef uint32 AppId_t;\n#ifdef __cplusplus\nconst AppId_t k_uAppIdInvalid = 0x0;\n#else\n#define k_uAppIdInvalid 0x0;\n#endif\n\ntypedef uint64 AssetClassId_t;\n#ifdef __cplusplus\nconst AssetClassId_t k_ulAssetClassIdInvalid = 0x0;\n#else\n#define k_ulAssetClassIdInvalid 0x0;\n#endif\n\ntypedef uint32 PhysicalItemId_t;\n#ifdef __cplusplus\nconst PhysicalItemId_t k_uPhysicalItemIdInvalid = 0x0;\n#else\n#define k_uPhysicalItemIdInvalid 0x0;\n#endif\n\n\n// this is baked into client messages and interfaces as an int, \n// make sure we never break this.  AppIds and DepotIDs also presently\n// share the same namespace, but since we'd like to change that in the future\n// I've defined it seperately here.\ntypedef uint32 DepotId_t;\n#ifdef __cplusplus\nconst DepotId_t k_uDepotIdInvalid = 0x0;\n#else\n#define k_uDepotIdInvalid 0x0;\n#endif\n\n// RTime32\n// We use this 32 bit time representing real world time.\n// It offers 1 second resolution beginning on January 1, 1970 (Unix time)\ntypedef uint32 RTime32;\n\ntypedef uint32 CellID_t;\n#ifdef __cplusplus\nconst CellID_t k_uCellIDInvalid = 0xFFFFFFFF;\n#else\n#define k_uCellIDInvalid 0x0;\n#endif\n\n// handle to a Steam API call\ntypedef uint64 SteamAPICall_t;\n#ifdef __cplusplus\nconst SteamAPICall_t k_uAPICallInvalid = 0x0;\n#else\n#define k_uAPICallInvalid 0x0;\n#endif\n\ntypedef uint32 AccountID_t;\n\ntypedef uint32 PartnerId_t;\n#ifdef __cplusplus\nconst PartnerId_t k_uPartnerIdInvalid = 0;\n#else\n#define k_uPartnerIdInvalid 0x0;\n#endif\n\n#endif // STEAMTYPES_H\n"
  },
  {
    "path": "public/utflib.cpp",
    "content": "/*\nutflib.c - small unicode conversion library\nCopyright (C) 2024 Alibek Omarov\n\nThis program is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\nGNU General Public License for more details.\n*/\n#include \"utflib.h\"\n#include \"xash3d_types.h\"\n\nuint32_t Q_DecodeUTF8( utfstate_t *s, uint32_t in )\n{\n\t// get character length\n\tif( s->len == 0 )\n\t{\n\t\t// init state\n\t\ts->uc = 0;\n\n\t\t// expect ASCII symbols by default\n\t\tif( likely( in <= 0x7fu ))\n\t\t\treturn in;\n\n\t\t// invalid sequence\n\t\tif( unlikely( in >= 0xf8u ))\n\t\t\treturn 0;\n\n\t\ts->k = 0;\n\n\t\tif( in >= 0xf0u )\n\t\t{\n\t\t\ts->uc = in & 0x07u;\n\t\t\ts->len = 3;\n\t\t}\n\t\telse if( in >= 0xe0u )\n\t\t{\n\t\t\ts->uc = in & 0x0fu;\n\t\t\ts->len = 2;\n\t\t}\n\t\telse if( in >= 0xc0u )\n\t\t{\n\t\t\ts->uc = in & 0x1fu;\n\t\t\ts->len = 1;\n\t\t}\n\n\t\treturn 0;\n\t}\n\n\t// invalid sequence, reset\n\tif( unlikely( in > 0xbfu ))\n\t{\n\t\ts->len = 0;\n\t\treturn 0;\n\t}\n\n\ts->uc <<= 6;\n\ts->uc += in & 0x3fu;\n\ts->k++;\n\n\t// sequence complete, reset and return code point\n\tif( likely( s->k == s->len ))\n\t{\n\t\ts->len = 0;\n\t\treturn s->uc;\n\t}\n\n\t// feed more characters\n\treturn 0;\n}\n\nuint32_t Q_DecodeUTF16( utfstate_t *s, uint32_t in )\n{\n\t// get character length\n\tif( s->len == 0 )\n\t{\n\t\t// init state\n\t\ts->uc = 0;\n\n\t\t// expect simple case, after all decoding UTF-16 must be easy\n\t\tif( likely( in < 0xd800u || in > 0xdfffu ))\n\t\t\treturn in;\n\n\t\ts->uc = (( in - 0xd800u ) << 10 ) + 0x10000u;\n\t\ts->len = 1;\n\t\ts->k = 0;\n\n\t\treturn 0;\n\t}\n\n\t// invalid sequence, reset\n\tif( unlikely( in < 0xdc00u || in > 0xdfffu ))\n\t{\n\t\ts->len = 0;\n\t\treturn 0;\n\t}\n\n\ts->uc |= in - 0xdc00u;\n\ts->k++;\n\n\t// sequence complete, reset and return code point\n\tif( likely( s->k == s->len ))\n\t{\n\t\ts->len = 0;\n\t\treturn s->uc;\n\t}\n\n\t// feed more characters (should never happen with UTF-16)\n\treturn 0;\n}\n\nstatic size_t Q_CodepointLength( uint32_t ch )\n{\n\tif( ch <= 0x7fu )\n\t\treturn 1;\n\telse if( ch <= 0x7ffu )\n\t\treturn 2;\n\telse if( ch <= 0xffffu )\n\t\treturn 3;\n\n\treturn 4;\n}\n\nsize_t Q_EncodeUTF8( char dst[4], uint32_t ch )\n{\n\tswitch( Q_CodepointLength( ch ))\n\t{\n\tcase 1:\n\t\tdst[0] = ch;\n\t\treturn 1;\n\tcase 2:\n\t\tdst[0] = 0xc0u | (( ch >> 6 ) & 0x1fu );\n\t\tdst[1] = 0x80u | (( ch ) & 0x3fu );\n\t\treturn 2;\n\tcase 3:\n\t\tdst[0] = 0xe0u | (( ch >> 12 ) & 0x0fu );\n\t\tdst[1] = 0x80u | (( ch >> 6 ) & 0x3fu );\n\t\tdst[2] = 0x80u | (( ch ) & 0x3fu );\n\t\treturn 3;\n\t}\n\tdst[0] = 0xf0u | (( ch >> 18 ) & 0x07u );\n\tdst[1] = 0x80u | (( ch >> 12 ) & 0x3fu );\n\tdst[2] = 0x80u | (( ch >> 6 ) & 0x3fu );\n\tdst[3] = 0x80u | (( ch ) & 0x3fu );\n\treturn 4;\n}\n\nsize_t Q_UTF8Length( const char *s )\n{\n\tsize_t len = 0;\n\tutfstate_t state = { 0 };\n\n\tif( !s )\n\t\treturn 0;\n\n\tfor( ; *s; s++ )\n\t{\n\t\tuint32_t ch = Q_DecodeUTF8( &state, (uint32_t)*s );\n\n\t\tif( ch == 0 )\n\t\t\tcontinue;\n\n\t\tlen++;\n\t}\n\n\treturn len;\n}\n\nsize_t Q_UTF16ToUTF8( char *dst, size_t dstsize, const uint16_t *src, size_t srcsize )\n{\n\tutfstate_t state = { 0 };\n\tsize_t dsti = 0, srci;\n\n\tif( !dst || !src || !dstsize || !srcsize )\n\t\treturn 0;\n\n\tfor( srci = 0; srci < srcsize && src[srci]; srci++ )\n\t{\n\t\tuint32_t ch;\n\t\tsize_t len;\n\n\t\tch = Q_DecodeUTF16( &state, src[srci] );\n\n\t\tif( ch == 0 )\n\t\t\tcontinue;\n\n\t\tlen = Q_CodepointLength( ch );\n\n\t\tif( dsti + len + 1 > dstsize )\n\t\t\tbreak;\n\n\t\tdsti += Q_EncodeUTF8( &dst[dsti], ch );\n\t}\n\n\tdst[dsti] = 0;\n\n\treturn dsti;\n}\n\nstatic uint16_t table_cp1251[64] = {\n\t0x0402, 0x0403, 0x201A, 0x0453, 0x201E, 0x2026, 0x2020, 0x2021,\n\t0x20AC, 0x2030, 0x0409, 0x2039, 0x040A, 0x040C, 0x040B, 0x040F,\n\t0x0452, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014,\n\t0x007F, 0x2122, 0x0459, 0x203A, 0x045A, 0x045C, 0x045B, 0x045F,\n\t0x00A0, 0x040E, 0x045E, 0x0408, 0x00A4, 0x0490, 0x00A6, 0x00A7,\n\t0x0401, 0x00A9, 0x0404, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x0407,\n\t0x00B0, 0x00B1, 0x0406, 0x0456, 0x0491, 0x00B5, 0x00B6, 0x00B7,\n\t0x0451, 0x2116, 0x0454, 0x00BB, 0x0458, 0x0405, 0x0455, 0x0457\n};\n\nuint32_t Q_UnicodeToCP1251( uint32_t uc )\n{\n\tsize_t i;\n\n\tif( uc < 0x80 )\n\t\treturn uc;\n\n\tif( uc >= 0x0410 && uc <= 0x042F )\n\t\treturn uc - 0x410 + 0xC0;\n\n\tif( uc >= 0x0430 && uc <= 0x044F )\n\t\treturn uc - 0x430 + 0xE0;\n\n\tfor( i = 0; i < sizeof( table_cp1251 ) / sizeof( table_cp1251[0] ); i++ )\n\t{\n\t\tif( uc == (uint32_t)table_cp1251[i] )\n\t\t\treturn i + 0x80;\n\t}\n\n\treturn '?';\n}\n\nuint32_t Q_UnicodeToCP1252( uint32_t uc )\n{\n\t// this is NOT valid way to convert Unicode codepoint back to CP1252!!!\n\treturn uc < 0xFF ? uc : '?';\n}\n"
  },
  {
    "path": "public/utflib.h",
    "content": "/*\nutflib.h - small unicode conversion library\nCopyright (C) 2024 Alibek Omarov\n\nThis program is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\nGNU General Public License for more details.\n*/\n#ifndef UTFLIB_H\n#define UTFLIB_H\n\n#include STDINT_H\n#include <stddef.h>\n\ntypedef struct utfstate_s\n{\n\tuint32_t uc;\n\tuint8_t len;\n\tuint8_t k;\n} utfstate_t;\n\n// feed utf8 characters one by one\n// if it returns 0, feed more\n// utfstate_t must be zero initialized\nuint32_t Q_DecodeUTF8( utfstate_t *s, uint32_t ch );\nuint32_t Q_DecodeUTF16( utfstate_t *s, uint32_t ch );\nsize_t Q_EncodeUTF8( char dst[4], uint32_t ch );\n\nsize_t Q_UTF8Length( const char *s );\n\n// srcsize in byte pairs\nsize_t Q_UTF16ToUTF8( char *dst, size_t dstsize, const uint16_t *src, size_t srcsize );\n\n// function to convert Unicode codepoints into CP1251 or CP1252\nuint32_t Q_UnicodeToCP1251( uint32_t uc );\nuint32_t Q_UnicodeToCP1252( uint32_t uc );\n\n#endif // UTFLIB_H\n"
  },
  {
    "path": "scripts/pack_extras.py",
    "content": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nimport os\nimport sys\nimport zipfile\n\nout = sys.argv[1]\nsrc_dirs = sys.argv[2:]\n\nzip_file = zipfile.ZipFile(out, \"w\", compression=zipfile.ZIP_STORED)\n\nfor src in src_dirs:\n    for dirpath, dirnames, filenames in os.walk(src):\n        for filename in filenames:\n            file_path = os.path.join(dirpath, filename)\n            name = os.path.relpath(file_path, src)\n            zip_file.write(file_path, name)\n\nzip_file.close()"
  },
  {
    "path": "scripts/psvita_generate_configs.sh",
    "content": "#!/bin/bash\n\ntouch config.cfg\necho 'unbindall'                                     >> config.cfg\necho 'bind A_BUTTON \"+use\"'                          >> config.cfg\necho 'bind B_BUTTON \"+jump\"'                         >> config.cfg\necho 'bind X_BUTTON \"+reload\"'                       >> config.cfg\necho 'bind Y_BUTTON \"+duck\"'                         >> config.cfg\necho 'bind L1_BUTTON \"+attack2\"'                     >> config.cfg\necho 'bind R1_BUTTON \"+attack\"'                      >> config.cfg\necho 'bind START \"escape\"'                           >> config.cfg\necho 'bind DPAD_UP \"lastinv\"'                        >> config.cfg\necho 'bind DPAD_DOWN \"impulse 100\"'                  >> config.cfg\necho 'bind DPAD_LEFT \"invprev\"'                      >> config.cfg\necho 'bind DPAD_RIGHT \"invnext\"'                     >> config.cfg\necho 'bind BACK \"chooseteam\"'                        >> config.cfg\necho 'gl_vsync \"1\"'                                  >> config.cfg\necho 'sv_autosave \"0\"'                               >> config.cfg\necho 'touch_config_file \"touch_presets/psvita.cfg\"'  >> config.cfg\n\ntouch kb_def.lst\necho '\"A_BUTTON\"\t\t\"+use\"'                      >> kb_def.lst\necho '\"B_BUTTON\"\t\t\"+jump\"'                     >> kb_def.lst\necho '\"X_BUTTON\"\t\t\"+reload\"'                   >> kb_def.lst\necho '\"Y_BUTTON\"\t\t\"+duck\"'                     >> kb_def.lst\necho '\"L1_BUTTON\"\t\t\"+attack2\"'                  >> kb_def.lst\necho '\"R1_BUTTON\"\t\t\"+attack\"'                   >> kb_def.lst\necho '\"START\"\t\t\t\"escape\"'                    >> kb_def.lst\necho '\"DPAD_UP\"\t\t\t\"lastinv\"'                   >> kb_def.lst\necho '\"DPAD_DOWN\"\t\t\"impulse 100\"'               >> kb_def.lst\necho '\"DPAD_LEFT\"\t\t\"invprev\"'                   >> kb_def.lst\necho '\"DPAD_RIGHT\"\t\t\"invnext\"'                   >> kb_def.lst\necho '\"BACK\"\t\t\t\"chooseteam\"'                >> kb_def.lst\n\ntouch video.cfg\necho 'fullscreen \"1\"' >> video.cfg\necho 'width \"960\"'    >> video.cfg\necho 'height \"544\"'   >> video.cfg\necho 'r_refdll \"gl\"'  >> video.cfg\n\ntouch opengl.cfg\necho 'gl_nosort \"1\"'  >> opengl.cfg\n"
  },
  {
    "path": "scripts/psvita_sdk.sh",
    "content": "#!/bin/bash\n\ncd $GITHUB_WORKSPACE\n\nexport VITASDK=/usr/local/vitasdk\n\necho \"Downloading vitasdk...\"\ngit clone https://github.com/vitasdk/vdpm.git --depth=1 || exit 1\npushd vdpm\n./bootstrap-vitasdk.sh || exit 1\n./vdpm taihen || exit 1\n./vdpm kubridge || exit 1\n./vdpm zlib || exit 1\n./vdpm SceShaccCgExt || exit 1\n./vdpm vitaShaRK || exit 1\n./vdpm libmathneon || exit 1\npopd\n\necho \"Building vrtld...\"\ngit clone https://github.com/fgsfdsfgs/vita-rtld.git --depth=1 || exit 1\npushd vita-rtld || die\ncmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release || die_configure\ncmake --build build -- -j$JOBS || die\ncmake --install build || die\npopd\n"
  },
  {
    "path": "scripts/yapb_graph_dl.py",
    "content": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nfrom __future__ import print_function\n\nimport os\nimport sys\n\ntry:\n    from urllib import urlretrieve\n\n    URLError = IOError\nexcept ImportError:\n    from urllib.request import urlretrieve\n    from urllib.error import URLError\n    \n# banned for me :(\n# DATABASE_URL = \"https://yapb.jeefo.net/graph/\"\nDATABASE_URL = \"https://raw.githubusercontent.com/yapb/graph/master/graph/\"\nDEST_DIR = sys.argv[1]\nOFFICIAL_MAPS = [\n    \"as_oilrig\",\n    \"cs_747\",\n    \"cs_assault\",\n    \"cs_backalley\",\n    \"cs_estate\",\n    \"cs_havana\",\n    \"cs_italy\",\n    \"cs_militia\",\n    \"cs_office\",\n    \"cs_siege\",\n    \"de_airstrip\",\n    \"de_aztec\",\n    \"de_cbble\",\n    \"de_chateau\",\n    \"de_dust\",\n    \"de_dust2\",\n    \"de_inferno\",\n    \"de_nuke\",\n    \"de_piranesi\",\n    \"de_prodigy\",\n    \"de_storm\",\n    \"de_survivor\",\n    \"de_torn\",\n    \"de_train\",\n    \"de_vertigo\"\n]\n\nif not os.path.exists(DEST_DIR):\n    os.makedirs(DEST_DIR)\n\nfor graph_name in OFFICIAL_MAPS:\n    file_url = \"{}{}.graph\".format(DATABASE_URL, graph_name)\n    file_path = os.path.join(DEST_DIR, \"{}.graph\".format(graph_name))\n\n    try:\n        # don't download if it already exists\n        if not os.path.exists(file_path):\n            urlretrieve(file_url, file_path)\n            print(\"Downloaded: {}\".format(file_path))\n    except URLError:\n        print(\"Failed to download: {}\".format(file_url))\n        continue\n    except Exception as e:\n        print(\"Unknown error: {}\".format(e))\n        continue\n\nprint(\"YaPB Graphs have been downloaded for the maps specified in the list.\")\n"
  },
  {
    "path": "toolchains/i386-linux-gnu.cmake",
    "content": "set(CMAKE_SYSTEM_NAME Linux CACHE STRING \"\" FORCE)\nset(CMAKE_SYSTEM_PROCESSOR i386 CACHE STRING \"\" FORCE)\n\nset(CMAKE_C_FLAGS \"-m32\" CACHE STRING \"\" FORCE)\nset(CMAKE_CXX_FLAGS \"-m32\" CACHE STRING \"\" FORCE)\nset(CMAKE_EXE_LINKER_FLAGS \"-m32\" CACHE STRING \"\" FORCE)"
  }
]