diff --git a/.github/actions/setup-cache/action.yml b/.github/actions/setup-cache/action.yml new file mode 100644 index 0000000..7112bdb --- /dev/null +++ b/.github/actions/setup-cache/action.yml @@ -0,0 +1,27 @@ +name: Setup cache +description: Sets up sccache, CPM cache, etc. + +inputs: + host: + description: 'Host platform: win or linux' + required: true + target: + description: 'Target platform: win, linux' + required: true + +runs: + using: "composite" + steps: + - name: Setup sccache + uses: hendrikmuhs/ccache-action@v1.2.13 + with: + variant: sccache + key: ${{ inputs.target }}-v1 + + - name: Setup CPM Cache + uses: actions/cache@v4 + with: + path: cpm-cache + key: cpm-${{ inputs.target }}-v1-${{ hashFiles('**/CMakeLists.txt', '**/*.cmake') }} + restore-keys: | + cpm-${{ inputs.target }}-v1- \ No newline at end of file diff --git a/.github/actions/setup-ninja/action.yml b/.github/actions/setup-ninja/action.yml new file mode 100644 index 0000000..89de375 --- /dev/null +++ b/.github/actions/setup-ninja/action.yml @@ -0,0 +1,17 @@ +name: Setup Ninja +description: Sets up Ninja + +inputs: + host: + description: 'Host platform: win, mac or linux' + required: true + +runs: + using: "composite" + steps: + - name: Setup + shell: bash + run: | + curl -L https://github.com/ninja-build/ninja/releases/latest/download/ninja-${{ inputs.host }}.zip -o ninja.zip + 7z x ninja.zip -o"$GITHUB_WORKSPACE/ninja" + echo "$GITHUB_WORKSPACE/ninja" >> $GITHUB_PATH \ No newline at end of file diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..da5b4c2 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,362 @@ +name: Build Game + +on: + workflow_dispatch: + pull_request: + push: + branches: + - '**' # every branch + - '!no-build-**' # unless marked as no-build + +env: + # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) + BUILD_TYPE: Release + CPM_SOURCE_CACHE: ${{ github.workspace }}/cpm-cache + +permissions: + contents: write + +jobs: + build-windows: + name: Build Windows + runs-on: ubuntu-22.04 + + steps: + - uses: actions/checkout@v4 + + - name: Setup caches + uses: ./.github/actions/setup-cache + with: + host: linux + target: win + + - name: Setup Ninja + uses: ./.github/actions/setup-ninja + with: + host: linux + + - name: Download llvm-mingw + run: | + curl -L https://github.com/mstorsjo/llvm-mingw/releases/download/20260311/llvm-mingw-20260311-msvcrt-ubuntu-22.04-x86_64.tar.xz -o llvm-mingw.tar.xz + tar -xf llvm-mingw.tar.xz + mv llvm-mingw-* llvm-mingw + + - name: Create Build Environment + # Some projects don't allow in-source building, so create a separate build directory + # We'll use this as our working directory for all subsequent commands + run: cmake -E make_directory ${{github.workspace}}/build + + - name: Configure CMake + working-directory: ${{github.workspace}}/build + run: | + cmake $GITHUB_WORKSPACE \ + -G Ninja \ + -DCMAKE_SYSTEM_NAME=Windows \ + -DCMAKE_C_COMPILER=$GITHUB_WORKSPACE/llvm-mingw/bin/x86_64-w64-mingw32-clang \ + -DCMAKE_CXX_COMPILER=$GITHUB_WORKSPACE/llvm-mingw/bin/x86_64-w64-mingw32-clang++ \ + -DCMAKE_RC_COMPILER=$GITHUB_WORKSPACE/llvm-mingw/bin/x86_64-w64-mingw32-windres \ + -DALSOFT_BACKEND_PIPEWIRE=OFF \ + -DCMAKE_BUILD_TYPE=$BUILD_TYPE + + - name: Build + working-directory: ${{github.workspace}}/build + run: | + cmake --build . --config $BUILD_TYPE --target MinecraftPE --parallel + cmake --build . --config $BUILD_TYPE --target MinecraftPE-server --parallel + + - name: Upload Artifact + uses: actions/upload-artifact@v4 + with: + name: mcpe-windows + path: | + ${{github.workspace}}/build/MinecraftPE-server.exe + ${{github.workspace}}/build/MinecraftPE.exe + ${{github.workspace}}/build/libpng16.dll + ${{github.workspace}}/build/OpenAL32.dll + ${{github.workspace}}/build/libz.dll + + build-ios: + # credit to pengubow from deepfriedwaffles repo + name: Build iOS + runs-on: macos-latest + + steps: + - name: Checkout + uses: actions/checkout@main + + - name: Build + run: | + cd project/iosproj + xcodebuild -scheme minecraftpe -derivedDataPath build -destination 'generic/platform=iOS' CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO + mkdir -p Payload + cp -R build/Build/Products/Debug-iphoneos/minecraftpe.app Payload/ + zip -r minecraftpe.ipa Payload + rm -rf Payload + + - name: Upload artifact + uses: actions/upload-artifact@main + with: + name: minecraftpe-ios + path: project/iosproj/minecraftpe.ipa + + build-linux: + name: Build Linux + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Setup caches + uses: ./.github/actions/setup-cache + with: + host: linux + target: linux + + - name: Create Build Environment + # Some projects don't allow in-source building, so create a separate build directory + # We'll use this as our working directory for all subsequent commands + run: cmake -E make_directory ${{github.workspace}}/build + + - name: Setup Environment + run: | + sudo apt-get update -qq + sudo apt-get install gcc-multilib + sudo apt-get install -y --no-install-recommends build-essential libgl-dev libwayland-dev xorg-dev libxkbcommon-dev + + - name: Configure CMake + # Use a bash shell so we can use the same syntax for environment variable + # access regardless of the host operating system + shell: bash + working-directory: ${{github.workspace}}/build + run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE + + - name: Build + working-directory: ${{github.workspace}}/build + shell: bash + run: | + cmake --build . --config $BUILD_TYPE --target MinecraftPE --parallel + cmake --build . --config $BUILD_TYPE --target MinecraftPE-server --parallel + + - name: Upload Artifact + uses: actions/upload-artifact@v4 + with: + name: mcpe-linux + path: | + ${{github.workspace}}/build/MinecraftPE + ${{github.workspace}}/build/MinecraftPE-server + + build-android: # pray to god + name: Build Android (${{ matrix.abi }}) + runs-on: ubuntu-latest + + strategy: + # keep going with the other ABI if one fails so you at least get something useful + fail-fast: false + matrix: + abi: [ arm64-v8a, armeabi-v7a ] + + env: + ANDROID_SDK_ROOT: ${{ github.workspace }}/android-sdk + ANDROID_NDK_PATH: ${{ github.workspace }}/android-ndk-r14b + ANDROID_PLATFORM_API: 36 + ANDROID_BUILD_TOOLS_VERSION: 36.0.0 + ADB: /bin/true + # build.sh reads MATRIX_ABI to decide which ABI to build when no --abi flag is passed + MATRIX_ABI: ${{ matrix.abi }} + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Cache Android command-line tools + id: cache-android-tools + uses: actions/cache@v3 + with: + path: ${{ env.ANDROID_SDK_ROOT }} + key: android-cmdline-tools-v36 + + - name: Setup Android command line tools + if: steps.cache-android-tools.outputs.cache-hit != 'true' + run: | + if [ ! -d "$ANDROID_SDK_ROOT/cmdline-tools/latest" ]; then + mkdir -p "$ANDROID_SDK_ROOT/cmdline-tools" + curl -o cmdline-tools.zip -L "https://dl.google.com/android/repository/commandlinetools-linux-9477386_latest.zip" + unzip -q cmdline-tools.zip -d "$ANDROID_SDK_ROOT/cmdline-tools" + mv "$ANDROID_SDK_ROOT/cmdline-tools/cmdline-tools" "$ANDROID_SDK_ROOT/cmdline-tools/latest" + fi + yes | "$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager" --sdk_root="$ANDROID_SDK_ROOT" "platform-tools" "platforms;android-${ANDROID_PLATFORM_API}" "build-tools;${ANDROID_BUILD_TOOLS_VERSION}" + + + - name: Cache Android NDK r14b + id: cache-android-ndk + uses: actions/cache@v3 + with: + path: ${{ github.workspace }}/android-ndk-r14b + key: android-ndk-r14b + + - name: Install Android NDK r14b + if: steps.cache-android-ndk.outputs.cache-hit != 'true' + run: | + if [ ! -d "$ANDROID_NDK_PATH" ]; then + curl -L -o ndk.zip "https://dl.google.com/android/repository/android-ndk-r14b-linux-x86_64.zip" + unzip -q ndk.zip -d "$GITHUB_WORKSPACE" + fi + + - name: Install system prerequisites + run: | + sudo apt-get update -qq + sudo apt-get install -y --no-install-recommends wget unzip curl git python3 libncurses6 libtinfo6 + if ! ldconfig -p | grep -q "libncurses.so.5"; then + sudo ln -sf /lib/x86_64-linux-gnu/libncurses.so.6 /usr/lib/x86_64-linux-gnu/libncurses.so.5 || true + fi + if ! ldconfig -p | grep -q "libtinfo.so.5"; then + sudo ln -sf /lib/x86_64-linux-gnu/libtinfo.so.6 /usr/lib/x86_64-linux-gnu/libtinfo.so.5 || true + fi + + - name: Setup Java 25 + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: 25 + + - name: Run Android build script + run: | + chmod +x ./build.sh + ./build.sh + + - name: Upload APK + uses: actions/upload-artifact@v4 + with: + # artifact name is ABI-specific so both matrix legs can upload without clobbering each other + name: minecraftpe-apk-${{ matrix.abi }} + path: ${{ github.workspace }}/build-apk/minecraftpe-*-debug.apk + + build-web: + name: Build Web + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Setup caches + uses: ./.github/actions/setup-cache + with: + host: linux + target: linux + + - name: Setup Ninja + uses: ./.github/actions/setup-ninja + with: + host: linux + + - name: Setup emsdk + uses: mymindstorm/setup-emsdk@v14 + with: + version: 5.0.3 + actions-cache-folder: 'emsdk-cache' + + - name: Create Build Environment + # Some projects don't allow in-source building, so create a separate build directory + # We'll use this as our working directory for all subsequent commands + run: cmake -E make_directory ${{github.workspace}}/build + + - name: Configure CMake + # Use a bash shell so we can use the same syntax for environment variable + # access regardless of the host operating system + shell: bash + working-directory: ${{github.workspace}}/build + run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -G Ninja -DCMAKE_TOOLCHAIN_FILE="$GITHUB_WORKSPACE/emsdk-cache/emsdk-main/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake" + + - name: Build + working-directory: ${{github.workspace}}/build + run: cmake --build . --config $BUILD_TYPE --target MinecraftPE --parallel + + - name: Upload Artifact + uses: actions/upload-artifact@v4 + with: + name: mcpe-web + path: | + ${{github.workspace}}/build/MinecraftPE.js + ${{github.workspace}}/build/MinecraftPE.wasm + ${{github.workspace}}/build/MinecraftPE.data + + publish: + name: Publish + runs-on: ubuntu-latest + needs: [ build-windows, build-ios, build-linux, build-android, build-web ] + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Declare Version Variables + id: ref + run: | + echo "version=$(cat VERSION | xargs)" >> $GITHUB_OUTPUT + echo "hash=$(git rev-parse --short "$GITHUB_SHA")" >> $GITHUB_OUTPUT + + - name: Download Artifacts + uses: actions/download-artifact@v4 + + - name: Zip Windows Artifacts + uses: vimtor/action-zip@v1.2 + with: + files: mcpe-windows/MinecraftPE.exe mcpe-windows/libpng16.dll mcpe-windows/OpenAL32.dll mcpe-windows/libz.dll + dest: minecraftpe-${{ steps.ref.outputs.hash }}-windows.zip + + - name: Zip Windows Server Artifacts + uses: vimtor/action-zip@v1.2 + with: + files: mcpe-windows/MinecraftPE-server.exe + dest: minecraftpe-server-${{ steps.ref.outputs.hash }}-windows.zip + + - name: Zip Linux Artifacts + uses: vimtor/action-zip@v1.2 + with: + files: mcpe-linux/MinecraftPE + dest: minecraftpe-${{ steps.ref.outputs.hash }}-linux.zip + + - name: Zip Linux Server Artifacts + uses: vimtor/action-zip@v1.2 + with: + files: mcpe-linux/MinecraftPE-server + dest: minecraftpe-server-${{ steps.ref.outputs.hash }}-linux.zip + + - name: Rename Android Artifacts + run: | + mv minecraftpe-apk-arm64-v8a/minecraftpe-v8a-debug.apk minecraftpe-${{ steps.ref.outputs.hash }}-android-arm64-v8a.apk + mv minecraftpe-apk-armeabi-v7a/minecraftpe-v7a-debug.apk minecraftpe-${{ steps.ref.outputs.hash }}-android-armeabi-v7a.apk + + - name: Zip Web Artifact + uses: vimtor/action-zip@v1.2 + with: + files: mcpe-web/MinecraftPE.js mcpe-web/MinecraftPE.wasm mcpe-web/MinecraftPE.data misc/web/index.html + dest: minecraftpe-${{ steps.ref.outputs.hash }}-web.zip + + - name: Zip Data + uses: vimtor/action-zip@v1.2 + with: + files: data + recursive: false + dest: data.zip + + - name: Update Development Release + uses: andelf/nightly-release@main + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: dev + name: 'Development Release' + body: | + MinecraftPE development release for commit ${{ github.sha }}. + files: | + ./data.zip + ./minecraftpe-server-${{ steps.ref.outputs.hash }}.zip + ./minecraftpe-${{ steps.ref.outputs.hash }}-windows.zip + ./minecraftpe-server-${{ steps.ref.outputs.hash }}-windows.zip + ./minecraftpe-${{ steps.ref.outputs.hash }}-linux.zip + ./minecraftpe-${{ steps.ref.outputs.hash }}-android-arm64-v8a.apk + ./minecraftpe-${{ steps.ref.outputs.hash }}-android-armeabi-v7a.apk + ./minecraftpe-server-${{ steps.ref.outputs.hash }}-linux.zip + ./minecraftpe-${{ steps.ref.outputs.hash }}-android-arm64-v8a.zip + ./minecraftpe-${{ steps.ref.outputs.hash }}-android-armeabi-v7a.zip + ./minecraftpe-${{ steps.ref.outputs.hash }}-web.zip diff --git a/.gitignore b/.gitignore index e213499..5465697 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,202 @@ +# Build output build/ -linux-build/ -.cache/ \ No newline at end of file +out/ +bin/ +lib/ +build-apk/ +cmake-build-*/ +CMakeFiles/ +CMakeCache.txt +cmake_install.cmake +Makefile + +# Compiled object files +*.o +*.obj +*.a +*.lib +*.so +*.dylib +*.dll +*.exe +*.out + +# CMake generated +install_manifest.txt +compile_commands.json +CTestTestfile.cmake +_CPack_Packages/ +*.cbp + +# Visual Studio +*.sdf +*.suo +*.user +*.userosscache +*.sln.docstates +*.VC.db +*.VC.opendb +.vs/ +ipch/ +x64/ +x86/ +Debug/ +Release/ +RelWithDebInfo/ +MinSizeRel/ + +# Xcode +*.xcworkspace +xcuserdata/ +*.xccheckout +*.xcuserstate +*.moved-aside +DerivedData/ +*.hmap +*.ipa +*.dSYM.zip +*.dSYM + +# Android +*.apk +*.aab +*.ap_ +local.properties +.gradle/ +project/.gradle/ +project/android/bin/ +project/android/gen/ +project/android/obj/ +project/android_java/bin/ +project/android_java/gen/ +project/android_java/obj/ +project/android/libs/*.so + +# macOS +.DS_Store +.AppleDouble +.LSOverride +._* + +# Windows +Thumbs.db +ehthumbs.db +Desktop.ini +$RECYCLE.BIN/ + +# Linux +*~ +.nfs* + +# CLion / JetBrains +.idea/ +*.iml +*.ipr +*.iws + +# Eclipse CDT +.project +.cproject +.settings/ + +# Logs +*.log + +# Ninja +.ninja_deps +.ninja_log +build.ninja + +# VS Code +.vscode/ +*.code-workspace + +# Visual Studio additional +*.ncb +*.aps +*.pdb +*.ilk +*.exp +*.iobj +*.ipdb +*.tlog +*.lastbuildstate +*.pch +*.ipch +*.VC.db-shm +*.VC.db-wal +*.svclog +*.vcxproj.user + +# CMake generated project files +ALL_BUILD.vcxproj +ALL_BUILD.vcxproj.filters +INSTALL.vcxproj +INSTALL.vcxproj.filters +PACKAGE.vcxproj +PACKAGE.vcxproj.filters +ZERO_CHECK.vcxproj +ZERO_CHECK.vcxproj.filters +MinecraftPE.vcxproj +MinecraftPE.vcxproj.filters +MinecraftPE.sln +CPackConfig.cmake +CPackSourceConfig.cmake +cpm-package-lock.cmake +MinecraftPE.dir/ +_deps/ + +# Test / coverage +Testing/ +CTestResults/ +*.gcno +*.gcda +*.gcov +coverage/ +lcov.info + +# Precompiled headers +*.gch + +# Compiler / linker intermediates +*.map +*.res +*.d + +# Patch / diff leftovers +*.orig +*.rej +*.patch + +# Backup / temp +*.bak +*.swp +*.swo +*.tmp +*~.nib + +# Tags +tags +TAGS +.tags +ctags + +# macOS extra +.Spotlight-V100 +.Trashes +.fseventsd +Icon\r + +# Windows extra +*.lnk +[Dd]esktop.ini + +# User / local config +options.txt +local.cmake +games/ + +# Dependency cache +vcpkg_installed/ +.cache/ +conan/ diff --git a/CMakeLists.txt b/CMakeLists.txt index 0295136..b978db0 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,23 +5,99 @@ include(cmake/CPM.cmake) set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED TRUE) +set(CMAKE_POLICY_VERSION_MINIMUM 3.10) -if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") - set(CMAKE_CXX_FLAGS "-Wno-c++11-narrowing -Wno-invalid-source-encoding -Wno-reserved-user-defined-literal") +include(cmake/EnumOption.cmake) + +if(EMSCRIPTEN) + # When configuring web builds with "emcmake cmake -B build -S .", set PLATFORM to Web by default + set(PLATFORM Web CACHE STRING "Platform to build for.") endif() -CPMAddPackage("gh:madler/zlib@1.3.2") -CPMAddPackage( - NAME "libpng" - GIT_REPOSITORY "https://github.com/pnggroup/libpng.git" - GIT_TAG "v1.6.55" - OPTIONS - "ZLIB_ROOT ${zlib_SOURCE_DIR}" - "ZLIB_INCLUDE_DIRS ${zlib_SOURCE_DIR}" - "PNG_TOOLS OFF" - "PNG_TESTS OFF" - "BUILD_SHARED_LIBS ON" -) +enum_option(PLATFORM "Desktop;Web" "Platform to build for.") + +if(NOT EMSCRIPTEN) + find_package(Threads REQUIRED) +endif() +find_package(OpenSSL) + +if (${PLATFORM} STREQUAL "Desktop") + set(PLATFORM_CPP "PLATFORM_DESKTOP") + + if (MINGW) + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libstdc++ -static-libgcc") + endif() + + if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-c++11-narrowing -Wno-narrowing -Wno-invalid-source-encoding -Wno-reserved-user-defined-literal") + endif() + + if (WIN32) + add_definitions(-D_CRT_SECURE_NO_WARNINGS) + include_directories(misc/windows) + set(EXTRA_LIBS ws2_32 winhttp) + elseif(UNIX) + find_library(pthread NAMES pthread) + set(EXTRA_LIBS pthread m) + endif() + +elseif (${PLATFORM} STREQUAL "Web") + set(PLATFORM_CPP "PLATFORM_WEB") + set(EXTRA_LIBS "idbfs.js") +endif() + +# I totally shocked +if(${PLATFORM} MATCHES "Web") + set(PNG_LIB png) + set(AL_LIBTYPE "STATIC") + + add_library(zlib INTERFACE IMPORTED) + set_target_properties(zlib PROPERTIES + INTERFACE_LINK_OPTIONS "-sUSE_ZLIB=1" + ) + + add_library(png INTERFACE IMPORTED) + set_target_properties(png PROPERTIES + INTERFACE_COMPILE_OPTIONS "-sUSE_LIBPNG=1" + INTERFACE_LINK_OPTIONS "-sUSE_LIBPNG=1" + ) + + add_library(glfw INTERFACE IMPORTED) + set_target_properties(glfw PROPERTIES + INTERFACE_LINK_OPTIONS "-sUSE_GLFW=3" + ) +else() + set(PNG_LIB png_shared) + set(AL_LIBTYPE "SHARED") + + CPMAddPackage( + NAME "zlib" + GIT_REPOSITORY "https://github.com/madler/zlib" + GIT_TAG "v1.3.2" + ) + + CPMAddPackage( + NAME "libpng" + GIT_REPOSITORY "https://github.com/pnggroup/libpng.git" + GIT_TAG "v1.6.55" + OPTIONS + "ZLIB_ROOT ${zlib_SOURCE_DIR}" + "ZLIB_INCLUDE_DIRS ${zlib_SOURCE_DIR}" + "PNG_TOOLS OFF" + "PNG_TESTS OFF" + ) + + CPMAddPackage( + NAME "glfw" + GIT_REPOSITORY "https://github.com/glfw/glfw.git" + GIT_TAG "3.4" + EXCLUDE_FROM_ALL TRUE + OPTIONS + "GLFW_BUILD_EXAMPLES OFF" + "GLFW_BUILD_TESTS OFF" + "GLFW_BUILD_DOCS OFF" + ) +endif() CPMAddPackage( NAME "openal" @@ -31,21 +107,119 @@ CPMAddPackage( "ALSOFT_EXAMPLES OFF" "ALSOFT_TESTS OFF" "ALSOFT_UTILS OFF" - "BUILD_SHARED_LIBS ON" + "LIBTYPE ${AL_LIBTYPE}" + "ALSOFT_ENABLE_MODULES OFF" + "ALSOFT_STATIC_STDCXX ON" + "ALSOFT_STATIC_LIBGCC ON" ) -CPMAddPackage( - NAME "glfw" - GIT_REPOSITORY "https://github.com/glfw/glfw.git" - GIT_TAG "3.4" - OPTIONS - "GLFW_BUILD_EXAMPLES OFF" - "GLFW_BUILD_TESTS OFF" - "GLFW_BUILD_DOCS OFF" - "BUILD_SHARED_LIBS ON" -) +file(GLOB SERVER_SOURCES + "project/lib_projects/raknet/jni/RaknetSources/*.cpp" + "src/NinecraftApp.cpp" + "src/Performance.cpp" + "src/SharedConstants.cpp" -file(GLOB SOURCES + "src/client/IConfigListener.cpp" + "src/client/Minecraft.cpp" + "src/client/OptionStrings.cpp" + "src/client/Option.cpp" + "src/client/Options.cpp" + "src/client/OptionsFile.cpp" + "src/client/ServerProfiler.cpp" + + "src/client/gamemode/CreativeMode.cpp" + "src/client/gamemode/GameMode.cpp" + "src/client/gamemode/SurvivalMode.cpp" + + "src/client/player/LocalPlayer.cpp" + "src/client/player/RemotePlayer.cpp" + "src/client/player/input/KeyboardInput.cpp" + + "src/locale/I18n.cpp" + + "src/main.cpp" + "src/main_dedicated.cpp" + + "src/nbt/Tag.cpp" + + "src/network/ClientSideNetworkHandler.cpp" + "src/network/NetEventCallback.cpp" + "src/network/Packet.cpp" + "src/network/RakNetInstance.cpp" + "src/network/ServerSideNetworkHandler.cpp" + "src/network/command/CommandServer.cpp" + + "src/platform/CThread.cpp" + "src/platform/HttpClient.cpp" + "src/platform/time.cpp" + + "src/platform/input/Controller.cpp" + "src/platform/input/Keyboard.cpp" + "src/platform/input/Mouse.cpp" + "src/platform/input/Multitouch.cpp" + + "src/server/ArgumentsSettings.cpp" + "src/server/ServerLevel.cpp" + "src/server/ServerPlayer.cpp" + + "src/util/DataIO.cpp" + "src/util/Mth.cpp" + "src/util/PerfTimer.cpp" + "src/util/StringUtils.cpp" + "src/util/Color.cpp" + + "src/world/Direction.cpp" + + "src/world/entity/*.cpp" + + "src/world/entity/ai/control/MoveControl.cpp" + + "src/world/entity/animal/*.cpp" + + "src/world/entity/item/*.cpp" + + "src/world/entity/monster/*.cpp" + + "src/world/entity/player/Inventory.cpp" + "src/world/entity/player/Player.cpp" + + "src/world/entity/projectile/Arrow.cpp" + "src/world/entity/projectile/Throwable.cpp" + + "src/world/food/SimpleFoodData.cpp" + + "src/world/inventory/*.cpp" + "src/world/item/*.cpp" + "src/world/item/crafting/*.cpp" + "src/world/level/*.cpp" + + "src/world/level/biome/Biome.cpp" + "src/world/level/biome/BiomeSource.cpp" + + "src/world/level/chunk/LevelChunk.cpp" + + "src/world/level/dimension/Dimension.cpp" + + "src/world/level/dimension/FoliageColor.cpp" + "src/world/level/GrassColor.cpp" + + "src/world/level/levelgen/*.cpp" + "src/world/level/levelgen/feature/Feature.cpp" + "src/world/level/levelgen/synth/*.cpp" + + "src/world/level/material/Material.cpp" + + "src/world/level/pathfinder/Path.cpp" + + "src/world/level/storage/*.cpp" + "src/world/level/tile/*.cpp" + "src/world/level/tile/entity/*.cpp" + + "src/world/phys/HitResult.cpp" + "src/commands/*.cpp" +) + +file(GLOB CLIENT_SOURCES "src/client/*.cpp" "src/client/gamemode/*.cpp" @@ -89,6 +263,8 @@ file(GLOB SOURCES "src/util/**.cpp" + "src/util/Color.cpp" + "src/world/*.cpp" "src/world/phys/*.cpp" "src/world/entity/*.cpp" @@ -121,34 +297,36 @@ file(GLOB SOURCES "src/SharedConstants.cpp" "src/main.cpp" "src/NinecraftApp.cpp" + + "src/AppPlatform_glfw.cpp" + "src/main.cpp" + + "src/commands/*.cpp" ) -if(NOT DEFINED PLATFORM) - set(PLATFORM "PLATFORM_GLFW") +if (${PLATFORM} STREQUAL "Desktop") + list(APPEND CLIENT_SOURCES glad/src/glad.c) endif() +# Server +add_executable("${PROJECT_NAME}-server" ${SERVER_SOURCES}) -if(PLATFORM STREQUAL "PLATFORM_WIN32") - list(APPEND SOURCES "src/AppPlatform_win32.cpp") -endif() +target_compile_definitions("${PROJECT_NAME}-server" PUBLIC "STANDALONE_SERVER" "SERVER_PROFILER") -if(PLATFORM STREQUAL "PLATFORM_GLFW") - list(APPEND SOURCES "src/AppPlatform_glfw.cpp") -endif() - -add_executable(${PROJECT_NAME} - ${SOURCES} - "glad/src/glad.c" +target_include_directories("${PROJECT_NAME}-server" PUBLIC + "${CMAKE_SOURCE_DIR}/src/" + "project/lib_projects/raknet/jni/RaknetSources" ) -if(WIN32) - set(EXTRA_LIBS "ws2_32") - target_compile_definitions(${PROJECT_NAME} PUBLIC "_CRT_SECURE_NO_WARNINGS") +target_link_libraries("${PROJECT_NAME}-server" ${CMAKE_THREAD_LIBS_INIT} ${EXTRA_LIBS}) + +add_executable(${PROJECT_NAME} ${CLIENT_SOURCES}) + +if(WIN32) + target_sources(${PROJECT_NAME} PRIVATE data/images/pe.rc) endif() -if(PLATFORM STREQUAL "PLATFORM_WIN32" OR PLATFORM STREQUAL "PLATFORM_GLFW") - target_compile_definitions(${PROJECT_NAME} PUBLIC "PLATFORM_DESKTOP") -endif() +target_compile_definitions(${PROJECT_NAME} PUBLIC ${PLATFORM_CPP}) target_include_directories(${PROJECT_NAME} PUBLIC "${CMAKE_SOURCE_DIR}/glad/include/" @@ -158,20 +336,80 @@ target_include_directories(${PROJECT_NAME} PUBLIC "lib/include" ) -target_compile_definitions(${PROJECT_NAME} PUBLIC "OPENGL_ES" "NO_EGL" ${PLATFORM}) -target_link_libraries(${PROJECT_NAME} zlib png_shared alsoft.common OpenAL::OpenAL glfw ${EXTRA_LIBS}) +if(${PLATFORM} MATCHES "Web") + set(CMAKE_CXX_STANDARD 11) + # uuuh i hate it + set(EM_FLAGS "-pthread -sUSE_PTHREADS=1 -sUSE_LIBPNG=1 -sSHARED_MEMORY=1") + + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EM_FLAGS}") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EM_FLAGS}") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${EM_FLAGS} --preload-file ${CMAKE_SOURCE_DIR}/data@/data") -if (NOT UNIX) -add_custom_command( - TARGET ${PROJECT_NAME} - POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy_if_different $ $ - COMMAND_EXPAND_LISTS -) + target_compile_options(${PROJECT_NAME} PUBLIC + "-Os" + "-Wno-invalid-source-encoding" + "-Wno-narrowing" + "-Wno-deprecated-register" + "-Wno-reserved-user-defined-literal" + ) + + target_link_options(${PROJECT_NAME} PUBLIC + "-Os" + "-sALLOW_MEMORY_GROWTH=1" + "-sFORCE_FILESYSTEM=1" + "-sLEGACY_GL_EMULATION=1" + "-sGL_UNSAFE_OPTS=0" + "-sEMULATE_FUNCTION_POINTER_CASTS=1" + "-sALLOW_TABLE_GROWTH=1" + "-sEXPORTED_RUNTIME_METHODS=['FS','stringToUTF8','UTF8ToString','cwrap','ccall','HEAP8','HEAPU8','HEAP32','HEAPU32']" + "-sEXPORTED_FUNCTIONS=['_main']" + ) + + if (CMAKE_BUILD_TYPE STREQUAL "Debug") + message("DEBUG MODE") + + target_link_options(${PROJECT_NAME} PUBLIC + "-sASSERTIONS=2" + "-sSTACK_OVERFLOW_CHECK=2" + "-sSTACK_SIZE=5242880" + "-sGL_DEBUG=1" + ) + endif() + + target_compile_definitions(${PROJECT_NAME} PUBLIC "__EMSCRIPTEN__" "NO_SOUND" "NO_NETWORK") endif() -add_custom_command( - TARGET ${PROJECT_NAME} - POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_SOURCE_DIR}/data" $/data -) \ No newline at end of file +# Client +target_compile_definitions(${PROJECT_NAME} PUBLIC "OPENGL_ES" "NO_EGL" ${PLATFORM}) +target_link_libraries(${PROJECT_NAME} zlib ${PNG_LIB} OpenAL::OpenAL glfw ${EXTRA_LIBS}) + +if (OpenSSL_FOUND) + target_link_libraries(${PROJECT_NAME} OpenSSL::SSL OpenSSL::Crypto) + target_compile_definitions(${PROJECT_NAME} PUBLIC HTTPCLIENT_USE_OPENSSL) +endif() + +if (NOT UNIX) + add_custom_command( + TARGET ${PROJECT_NAME} + POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different $ $ + COMMAND_EXPAND_LISTS + ) +endif() + +if(NOT ${PLATFORM} MATCHES "Web") + add_custom_command( + TARGET ${PROJECT_NAME} + POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_SOURCE_DIR}/data" $/data + ) +else() + add_custom_command( + TARGET ${PROJECT_NAME} + POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_SOURCE_DIR}/misc/web/index.html" $ + ) +endif() + +message(STATUS "Compiling with the flags:") +message(STATUS " PLATFORM=" ${PLATFORM_CPP}) \ No newline at end of file diff --git a/README.md b/README.md index 66eb3eb..094ec25 100644 --- a/README.md +++ b/README.md @@ -1,21 +1,237 @@ # MinecraftPE +> [!Warning] +> [Github repository](https://github.com/Minecraft-PE-0-6-1/minecraft-pe-0.6.1-on-all) **isnt main**. All issues and pull requests should be send in [Gitea Repository](https://gitea.sffnetwork.ru/Kolyah35/minecraft-pe-0.6.1). -This is leaked source code of Minecraft PE 0.6.1 with my own impovements :sunglasses: +> [!Note] +> There is unofficial (not related to Kolyah35 and InviseDivine) discord server, where you can report bugs or send feedback https://discord.gg/udYrbNDfDH -First of all I made it build with CMake (w/o VS2012). Also I fixed some compile errors. And finally I ported it to GLFW to make it run on several platforms and remove binary dependencies. +Source code for **Minecraft Pocket Edition 0.6.1 alpha** with various fixes and improvements. -# TODO -- [x] Add platform GLFW -- [x] Compile for Linux -- [ ] Compile for android aarch64 -- [ ] Rewrite platform logic -- [x] Fix sound -- [ ] Do a server connection gui +This project aims to preserve and improve this early version of Minecraft PE. + +# Features +- Support for modern IOS and Android, Linux, Web +- Improved Dedicated Server (Windows build, anticheat, commands, etc) +- Features from Beta version of Minecraft (Grass tint, Beta sky, Smooth lighting, etc) and other tweaks + +# Screenshots +

+ +menu +settings +worlds +gameplay + +

# Build + ## CMake +### Linux +1. Install dependiences + +(Debian-like) + +``sudo apt install build-essential git cmake libgl-dev libwayland-dev xorg-dev libxkbcommon-dev`` + +(Arch-like) + +``sudo pacman -S base-devel git cmake libglvnd wayland xorg-server-devel xorgproto libxkbcommon`` + +2. Create build folder +``mkdir build && cd build`` + +3. Generate CMake cache and build the project ``` -mkdir build && cd build cmake .. -B . -make -j4 +cmake --build . ``` + +### Windows +1. Install [Visual studio Build Tools](https://aka.ms/vs/stable/vs_BuildTools.exe) and [CMake](https://github.com/Kitware/CMake/releases/download/v4.3.0-rc3/cmake-4.3.0-rc3-windows-x86_64.msi) + +2. Create build folder +``mkdir build && cd build`` + +3. Generate CMake cache and build the project +``` +cmake .. +cmake --build . +``` + +## Visual Studio + +1. Open the repository folder in **Visual Studio**. +2. Visual Studio will automatically detect the `CMakeLists.txt` file and generate the project configuration. +3. Set **MinecraftPE.exe** as the **target**. +4. Press **Run** (or F5) to build and launch the game. + +## Android +### Windows +1. Download **Android NDK r14b**: + http://dl.google.com/android/repository/android-ndk-r14b-windows-x86_64.zip + +2. Extract it to the root of your `C:` drive so the path becomes: + + ``` + C:\android-ndk-r14b + ``` +3. Install **Build tools 35** with [SDKManager](https://dl.google.com/android/repository/commandlinetools-win-15859902_latest.zip) (build-tools should be in AppData): + +```powershell +sdkmanager "build-tools;35.0.0" --sdk_root="%LocalAppData%\Android\Sdk" +sdkmanager "build-tools;android-36" --sdk_root="%LocalAppData%\Android\Sdk" +``` + +4. Run the build script: + +```powershell +# Full build (NDK + Java + APK + install) +.\build.ps1 + +# Skip C++ compilation (Java/assets changed only) +.\build.ps1 -NoCpp + +# Skip Java compilation (C++ changed only) +.\build.ps1 -NoJava + +# Only repackage + install (no compilation) +.\build.ps1 -NoBuild +``` + +### Linux +1. Download **Command line tools**: + https://developer.android.com/studio#command-line-tools-only + +2. Unzip it into a folder, e.g.: + + ```bash + mkdir -p "$HOME/Android/Sdk/" + unzip commandlinetools-linux-*.zip -d "$HOME/Android/Sdk/" + ``` + +3. Your structure should look like + + ```bash + $HOME/Android/Sdk/cmdline-tools/bin/sdkmanager + ``` + + > [!Note] + > `sdkmanager` expects the SDK to include a `cmdline-tools/latest/` folder. + > If you only have `cmdline-tools/bin`, create the required layout: + > + > ```bash + > mkdir -p "$HOME/Android/Sdk/cmdline-tools/latest" + > ln -snf ../bin "$HOME/Android/Sdk/cmdline-tools/latest/bin" + > ln -snf ../lib "$HOME/Android/Sdk/cmdline-tools/latest/lib" + > ln -snf ../source.properties "$HOME/Android/Sdk/cmdline-tools/latest/source.properties" + > ln -snf ../NOTICE.txt "$HOME/Android/Sdk/cmdline-tools/latest/NOTICE.txt" + > ``` + +4. Install the build tools (and platform) using `sdkmanager` + + ```bash + export ANDROID_SDK_ROOT="$HOME/Android/Sdk" + export PATH="$ANDROID_SDK_ROOT/cmdline-tools/latest/bin:$PATH" + + sdkmanager --install "platform-tools" "platforms;android-35" "build-tools;35.0.0" + ``` + + > [!Note] + > if you want build.sh to always find the SDK, + > Set ANDROID_SDK_ROOT in your shell config (~/.bashrc / ~/.profile / ~/.config/fish/config.fish), for example: + > + > ```bash + > export ANDROID_SDK_ROOT="$HOME/Android/Sdk" + > ``` + > + > Then restart your shell (or `source` the file) + +5. Verify the install + + ```bash + ls "$ANDROID_SDK_ROOT/build-tools" + ``` + + You should see a version folder like: + + ```bash + 35.0.0 + ``` + +6. Download **Android NDK r14b**: + https://dl.google.com/android/repository/android-ndk-r14b-linux-x86_64.zip + +7. Extract the archive to `/home/username/`, so that the final directory path is `/home/username/android-ndk-r14b/` + + > [!Warning] + > Make sure you don’t end up with a nested folder like `/home/username/android-ndk-r14b/android-ndk-r14b/`. + +8. Re run `build.sh` + +## Web +1. Download and install **emsdk**: https://emscripten.org/docs/getting_started/downloads.html + > [!Note] + > On arch linux you can use AUR: + > `yay -Sy emsdk` + +2. Configure and build project: + ``` + mkdir build && cd build + cmake .. -B . -G Ninja "-DCMAKE_TOOLCHAIN_FILE=$EMSDK/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake" + cmake --build . --target MinecraftPE + ``` + > [!Note] + > If you are using VSCode with CMake plugin, you can add Emscripten kit + > 1. Press Ctrl + Shift + P + > 2. Type `CMake: Edit User-Local CMake Kits` and hit Enter + > 3. Add this: + ```json + { + "name": "Emscripten", + "compilers": { + "C": "/usr/lib/emsdk/upstream/bin/clang", + "CXX": "/usr/lib/emsdk/upstream/bin/clang++" + }, + "toolchainFile": "/usr/lib/emsdk/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake" + } + ``` +3. Run game: + ``` + emrun --port 8080 . + ``` +## iOS +### Xcode +> [!Note] +> There's a precompiled IPA artifact in the GitHub mirror under Actions for those who either don't have Macs or don't want to build themself. But if you want to build youself, you'll need a Mac with Xcode. Download Xcode from the Mac App Store. + +### 1. Clone +Open your terminal and clone the repository +```bash +git clone https://gitea.sffempire.ru/Kolyah35/minecraft-pe-0.6.1.git +cd minecraft-pe-0.6.1 +``` +You can also build from the ios-support branch by checking out to it +``` +git checkout ios-support +``` + +### 2. Open in Xcode + +The project file is in `minecraft-pe-0.6.1/project/iosproj/minecraftpe.xcodeproj`. Open it. + +### 3. Configure Code Signing + +Before you can deploy to an iPhone, you must sign the app with your own Apple Developer account: + +1. Select the **minecraftpe** project in the left sidebar. +2. Go to **Signing & Capabilities**. +3. Change the **Bundle Identifier** to something unique (e.g., `com.yourname.mcpe`). +4. Select your **Team** from the dropdown menu. + +### 4. Build and Run + +1. Connect your iPhone via USB or LAN. +2. Select your device from the run destination menu at the top of Xcode. +3. Press **Cmd + R** (or the Play button). +4. **Note:** If you encounter a "Developer Mode" or "Untrusted Developer" error on your phone, go to **Settings > General > VPN & Device Management** to trust your certificate. diff --git a/build.ps1 b/build.ps1 new file mode 100644 index 0000000..9ef14e5 --- /dev/null +++ b/build.ps1 @@ -0,0 +1,305 @@ +# ============================================================ +# Usage: +# .\build.ps1 # full build (NDK + Java + APK + install) +# .\build.ps1 -NoCpp # skip NDK rebuild (Java/assets changed) +# .\build.ps1 -NoJava # skip Java recompile (C++ changed only) +# .\build.ps1 -NoBuild # repackage + install only (no recompile) +# .\build.ps1 -Clean # remove build output before building +# ============================================================ +param( + [switch]$NoCpp, + [switch]$NoJava, + [switch]$NoBuild, + [switch]$Clean +) + +Set-StrictMode -Version Latest +$ErrorActionPreference = "Stop" + +# ── Paths ──────────────────────────────────────────────────── +$repo = $PSScriptRoot +$apkbuild = "C:\apkbuild" +$ndk = "C:\android-ndk-r14b" +$sdkTools = "$env:LOCALAPPDATA\Android\Sdk\build-tools\35.0.0" +$androidJar = "$env:LOCALAPPDATA\Android\Sdk\platforms\android-36\android.jar" +$adb = "$env:LOCALAPPDATA\Android\Sdk\platform-tools\adb.exe" +$keystore = "$apkbuild\debug.keystore" +$pkg = "com.mojang.minecraftpe" + +# Auto-detect keytool from JAVA_HOME, then from common install locations +$keytool = if ($env:JAVA_HOME) { "$env:JAVA_HOME\bin\keytool.exe" } else { + $found = Get-ChildItem "C:\Program Files\Java","C:\Program Files\Eclipse Adoptium" ` + -Filter keytool.exe -Recurse -ErrorAction SilentlyContinue | + Sort-Object FullName -Descending | Select-Object -First 1 -ExpandProperty FullName + if (-not $found) { throw "keytool not found. Set JAVA_HOME or install a JDK." } + $found +} + +$jniDir = "$repo\project\android\jni" +$libSrc = "$repo\project\android\libs\arm64-v8a\libminecraftpe.so" +$libDst = "$apkbuild\lib\arm64-v8a\libminecraftpe.so" +$manifest = "$repo\project\android_java\AndroidManifest.xml" +$res = "$repo\project\android_java\res" +$javaSrc = "$repo\project\android_java\src" +$stubsDir = "$apkbuild\stubs" +$rJava = "$apkbuild\gen\R.java" +$classesDir = "$apkbuild\classes" +$dexOut = "$apkbuild\classes.dex" +$dataDir = "$repo\data" + +$unsigned = "$apkbuild\minecraftpe-unsigned.apk" +$aligned = "$apkbuild\minecraftpe-aligned.apk" +$signed = "$apkbuild\minecraftpe-debug.apk" + +Add-Type -Assembly "System.IO.Compression.FileSystem" + +function Write-Step([string]$msg) { Write-Host "`n==> $msg" -ForegroundColor Cyan } +function Assert-ExitCode([string]$step) { + if ($LASTEXITCODE -ne 0) { Write-Host "FAILED: $step (exit $LASTEXITCODE)" -ForegroundColor Red; exit 1 } +} +function New-Dir([string]$path) { New-Item $path -ItemType Directory -Force | Out-Null } +function Write-Stub([string]$rel, [string]$content) { + $full = "$stubsDir\$rel" + New-Dir (Split-Path $full -Parent) + if (-not (Test-Path $full)) { [System.IO.File]::WriteAllText($full, $content); Write-Host " stub: $rel" } +} + +# ── 0. Clean (optional) ─────────────────────────────────────── +if ($Clean) { + Write-Step "Cleaning build output" + Remove-Item -Recurse -Force $apkbuild -ErrorAction SilentlyContinue +} + +# ── 1. Bootstrap ───────────────────────────────────────────── +Write-Step "Bootstrap" + +New-Dir $apkbuild +New-Dir "$apkbuild\lib\arm64-v8a" +New-Dir "$apkbuild\gen" +New-Dir $stubsDir + +if (-not (Test-Path $keystore)) { + Write-Host " generating debug.keystore..." + $eap = $ErrorActionPreference; $ErrorActionPreference = "Continue" + & $keytool -genkeypair ` + -keystore $keystore -storepass android -keypass android ` + -alias androiddebugkey -keyalg RSA -keysize 2048 -validity 10000 ` + -dname "CN=Android Debug,O=Android,C=US" 2>&1 | Out-Null + $ErrorActionPreference = $eap + Assert-ExitCode "keytool" + Write-Host " keystore created" +} else { Write-Host " keystore OK" } + +Write-Stub "com\mojang\android\StringValue.java" "package com.mojang.android;`npublic interface StringValue { String getStringValue(); }`n" + +Write-Stub "com\mojang\android\licensing\LicenseCodes.java" "package com.mojang.android.licensing;`npublic class LicenseCodes { public static final int LICENSE_OK = 0; }`n" + +Write-Stub "com\mojang\android\EditTextAscii.java" @" +package com.mojang.android; +import android.content.Context; +import android.text.Editable; +import android.text.TextWatcher; +import android.util.AttributeSet; +import android.widget.EditText; +public class EditTextAscii extends EditText implements TextWatcher { + public EditTextAscii(Context c) { super(c); addTextChangedListener(this); } + public EditTextAscii(Context c, AttributeSet a) { super(c,a); addTextChangedListener(this); } + public EditTextAscii(Context c, AttributeSet a, int d) { super(c,a,d); addTextChangedListener(this); } + @Override public void onTextChanged(CharSequence s,int st,int b,int co){} + public void beforeTextChanged(CharSequence s,int st,int co,int aft){} + public void afterTextChanged(Editable e){ + String s=e.toString(),san=sanitize(s); + if(!s.equals(san))e.replace(0,e.length(),san); + } + static public String sanitize(String s){ + StringBuilder sb=new StringBuilder(); + for(int i=0;iSurvival?Survival:i); + int id=_type==Survival?R.string.gamemode_survival_summary:R.string.gamemode_creative_summary; + String desc=getContext().getString(id); + View v=getRootView().findViewById(R.id.labelGameModeDesc); + if(desc!=null&&v instanceof TextView)((TextView)v).setText(desc); + } + public String getStringValue(){return new String[]{"creative","survival"}[_type];} + static public String getStringForType(int i){int c=iSurvival?Survival:i);return new String[]{"creative","survival"}[c];} +} +"@ + +Write-Host " stubs OK" + +# ── 1. NDK build ───────────────────────────────────────────── +if (-not $NoCpp -and -not $NoBuild) { + Write-Step "NDK build (arm64-v8a)" + # NDK r14b on Windows hits the 32K CreateProcess limit with long paths. + # Work around it by building through a short junction C:\m -> repo root. + # Use forward slashes in the build paths to prevent the NDK toolchain from stripping backslashes. + $junctionBase = "C:/m" + if (-not (Test-Path "C:\m")) { + & cmd.exe /c "mklink /J `"C:\m`" `"$repo`"" | Out-Null + } + Push-Location "$junctionBase/project/android/jni" + $env:NDK_MODULE_PATH = "$junctionBase/project/lib_projects" + # run ndk-build and stream output directly to the console + $ndkCmd = Join-Path $ndk 'ndk-build.cmd' + $ndkArgs = "NDK_PROJECT_PATH=`"$junctionBase/project/android`" APP_BUILD_SCRIPT=`"$junctionBase/project/android/jni/Android.mk`"" + + $proc = Start-Process -FilePath $ndkCmd -ArgumentList $ndkArgs -NoNewWindow -Wait -PassThru + Pop-Location + if ($proc.ExitCode -ne 0) { + Write-Host "ndk-build failed (exit $($proc.ExitCode))" -ForegroundColor Red + exit 1 + } + Copy-Item $libSrc $libDst -Force + Write-Host " .so -> $libDst" +} + +# ── 2. Java compile ────────────────────────────────────────── +if (-not $NoJava -and -not $NoBuild) { + Write-Step "Java compile" + + New-Dir (Split-Path $rJava -Parent) + & "$sdkTools\aapt.exe" package -f -M $manifest -S $res -I $androidJar -J "$apkbuild\gen" -F "$apkbuild\_rgen.apk" + Assert-ExitCode "aapt R.java" + Remove-Item "$apkbuild\_rgen.apk" -ea SilentlyContinue + + $srcs = @( + Get-ChildItem $javaSrc -Recurse -Filter "*.java" | Select-Object -Exp FullName + Get-ChildItem $stubsDir -Recurse -Filter "*.java" | Select-Object -Exp FullName + $rJava + ) + + Remove-Item $classesDir -Recurse -Force -ea SilentlyContinue + New-Dir $classesDir + + & javac --release 8 -cp $androidJar -d $classesDir @srcs + if ($LASTEXITCODE -ne 0) { Write-Host 'javac failed' -ForegroundColor Red; exit 1 } + Write-Host " javac OK" + + $classFiles = Get-ChildItem $classesDir -Recurse -Filter "*.class" | Select-Object -Exp FullName + & "$sdkTools\d8.bat" --min-api 21 --output $apkbuild $classFiles + Assert-ExitCode "d8" + Write-Host " d8 -> $dexOut" +} + +# ── 3. Package APK ─────────────────────────────────────────── +Write-Step "Package APK" +Remove-Item $unsigned,$aligned,$signed -ea SilentlyContinue + +& "$sdkTools\aapt.exe" package -f -M $manifest -S $res -I $androidJar -F $unsigned +Assert-ExitCode "aapt package" + +$zip = [System.IO.Compression.ZipFile]::Open($unsigned, 'Update') +try { + [System.IO.Compression.ZipFileExtensions]::CreateEntryFromFile($zip,$dexOut,"classes.dex",[System.IO.Compression.CompressionLevel]::Fastest)|Out-Null + [System.IO.Compression.ZipFileExtensions]::CreateEntryFromFile($zip,$libDst,"lib/arm64-v8a/libminecraftpe.so",[System.IO.Compression.CompressionLevel]::NoCompression)|Out-Null + Get-ChildItem $dataDir -Recurse -File | ForEach-Object { + $rel=$_.FullName.Substring("$dataDir\".Length).Replace('\','/') + [System.IO.Compression.ZipFileExtensions]::CreateEntryFromFile($zip,$_.FullName,"assets/$rel",[System.IO.Compression.CompressionLevel]::NoCompression)|Out-Null + } +} finally { $zip.Dispose() } +Write-Host " APK assembled" + +& "$sdkTools\zipalign.exe" -p 4 $unsigned $aligned; Assert-ExitCode "zipalign" +& "$sdkTools\apksigner.bat" sign --ks $keystore --ks-pass pass:android --key-pass pass:android --out $signed $aligned; Assert-ExitCode "apksigner" +Write-Host " signed -> $signed" + +# ── 4. Install ─────────────────────────────────────────────── +Write-Step "Install" +& $adb shell am force-stop $pkg +& $adb uninstall $pkg 2>$null +& $adb install --no-incremental $signed +Assert-ExitCode "adb install" + +Write-Host "`nDone." -ForegroundColor Green \ No newline at end of file diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..1a8797f --- /dev/null +++ b/build.sh @@ -0,0 +1,455 @@ +#!/usr/bin/env bash +# ============================================================ +# Usage: +# ./build.sh # full build (NDK + Java + APK + install) +# ./build.sh --no-cpp # skip NDK rebuild (Java/assets changed) +# ./build.sh --no-java # skip Java recompile (C++ changed only) +# ./build.sh --no-build # repackage + install only (no recompile) +# +# ABI targeting: +# ./build.sh --abi arm64-v8a # build for arm64 only (default) +# ./build.sh --abi armeabi-v7a # build for ARMv7 only +# ./build.sh --abi all # build for both ABIs (fat APK) +# ============================================================ + +# lets be strict cuz we are safe like that +# *thanos snap* +set -euo pipefail +IFS=$'\n\t' + +######################################## +# configuration +######################################## +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +REPO_ROOT="$SCRIPT_DIR" + +# build output directory (similar to apkbuild in the PS script) +# maybe doing this in build.ps1 would be cleaner, than putting the apkbuild in C: +BUILD_DIR="$REPO_ROOT/build-apk" + +# default Android/NDK/SDK paths (can be overridden by env vars) +ANDROID_NDK_PATH="${ANDROID_NDK_PATH:-$HOME/android-ndk-r14b}" +ANDROID_SDK_ROOT="${ANDROID_SDK_ROOT:-${ANDROID_HOME:-$HOME/Android/Sdk}}" +ANDROID_BUILD_TOOLS_VERSION="${ANDROID_BUILD_TOOLS_VERSION:-}" +ANDROID_PLATFORM_API="${ANDROID_PLATFORM_API:-}" + +# ABI selection: can be set via --abi flag or MATRIX_ABI env var. +# Supported values: arm64-v8a, armeabi-v7a, all +# MATRIX_ABI takes precedence over the default but is overridden by --abi on the CLI. +TARGET_ABI="${MATRIX_ABI:-arm64-v8a}" + +function fail() { + echo "ERROR: $1" >&2 + exit 1 +} + +function find_build_tools_dir() { + if [[ -n "$ANDROID_BUILD_TOOLS_VERSION" ]]; then + local candidate="$ANDROID_SDK_ROOT/build-tools/$ANDROID_BUILD_TOOLS_VERSION" + [[ -d "$candidate" ]] && echo "$candidate" && return + fi + + if [[ ! -d "$ANDROID_SDK_ROOT/build-tools" ]]; then + fail "Android build-tools not found under $ANDROID_SDK_ROOT/build-tools. Set ANDROID_SDK_ROOT or install Android SDK build-tools." + fi + + # picking the highest build tools version because its the easiest way rn + # i guess if it breaks then fuck you + local best + best=$(ls -1 "$ANDROID_SDK_ROOT/build-tools" | sort -V | tail -n 1) + [[ -n "$best" && -d "$ANDROID_SDK_ROOT/build-tools/$best" ]] || \ + fail "No Android build-tools versions found under $ANDROID_SDK_ROOT/build-tools." + echo "$ANDROID_SDK_ROOT/build-tools/$best" +} + +function find_android_platform_dir() { + if [[ -n "$ANDROID_PLATFORM_API" ]]; then + local candidate="$ANDROID_SDK_ROOT/platforms/android-$ANDROID_PLATFORM_API" + [[ -d "$candidate" ]] && echo "$candidate" && return + fi + + if [[ ! -d "$ANDROID_SDK_ROOT/platforms" ]]; then + fail "Android platforms not found under $ANDROID_SDK_ROOT/platforms. Install an Android platform." + fi + + # pick the highest api level installed for now + # ideally we should be able to build to any api level, but lets keep it simple for now and + # just pick the highest one available + local best + best=$(ls -1 "$ANDROID_SDK_ROOT/platforms" | grep -E '^android-[0-9]+' | sed 's/android-//' | sort -n | tail -n 1) + [[ -n "$best" ]] || fail "No Android platforms found under $ANDROID_SDK_ROOT/platforms." + echo "$ANDROID_SDK_ROOT/platforms/android-$best" +} + +ANDROID_BUILD_TOOLS_DIR="$(find_build_tools_dir)" +ANDROID_PLATFORM_DIR="$(find_android_platform_dir)" + +KEYSTORE_FILE="$BUILD_DIR/debug.keystore" +PACKAGE_NAME="com.mojang.minecraftpe" + +# android tool binaries +AAPT="$ANDROID_BUILD_TOOLS_DIR/aapt" +ZIPALIGN="$ANDROID_BUILD_TOOLS_DIR/zipalign" +APKSIGNER="$ANDROID_BUILD_TOOLS_DIR/apksigner" +DEX_TOOL="$ANDROID_BUILD_TOOLS_DIR/d8" +ADB="${ADB:-$ANDROID_SDK_ROOT/platform-tools/adb}" + +# java tool binaries +JAVA_HOME_DEFAULT="${JAVA_HOME:-}" # may be empty + +# prefer javac from the jdk; +# on some systems /usr/lib/jvm/default points to a JRE only. +# If javac is missing, try to locate a JDK installation. +JAVAC_CMD="" +if command -v javac >/dev/null 2>&1; then + JAVAC_CMD="$(command -v javac)" +elif [[ -n "$JAVA_HOME_DEFAULT" && -x "$JAVA_HOME_DEFAULT/bin/javac" ]]; then + JAVAC_CMD="$JAVA_HOME_DEFAULT/bin/javac" +elif [[ -x "/usr/lib/jvm/java-8-openjdk/bin/javac" ]]; then + JAVAC_CMD="/usr/lib/jvm/java-8-openjdk/bin/javac" +elif [[ -x "/usr/lib/jvm/default/bin/javac" ]]; then + JAVAC_CMD="/usr/lib/jvm/default/bin/javac" +fi + +if [[ -z "$JAVAC_CMD" ]]; then + fail "javac not found; install a JDK and ensure javac is on PATH" +fi + +KEYTOOL="" # will be detected later + +# swource directories +JNI_DIR="$REPO_ROOT/project/android/jni" +JAVA_SRC_DIR="$REPO_ROOT/project/android_java/src" +ANDROID_MANIFEST="$REPO_ROOT/project/android_java/AndroidManifest.xml" +ANDROID_RES_DIR="$REPO_ROOT/project/android_java/res" +DATA_DIR="$REPO_ROOT/data" + +# output files: APK names are derived after argument parsing once TARGET_ABI is final. +# see the "resolve APK output filenames" block below. +APK_UNSIGNED="" +APK_ALIGNED="" +APK_SIGNED="" +DEX_OUTPUT="$BUILD_DIR/classes.dex" + +# flags parsed from CLI args +NO_CPP=false +NO_JAVA=false +NO_BUILD=false + +######################################## +# helpers +######################################## +function usage() { + cat <] + +Options: + --no-cpp Skip the NDK (C++) build step + --no-java Skip the Java build step + --no-build Skip the compile steps; just package + install + --abi Target ABI: arm64-v8a (default), armeabi-v7a, or all + Can also be set via MATRIX_ABI env var for CI matrix builds. +EOF + exit 1 +} + +function log_step() { + echo -e "\n==> $1" +} + +function fail() { + echo "ERROR: $1" >&2 + exit 1 +} + +function require_cmd() { + if ! command -v "$1" >/dev/null 2>&1; then + fail "$1 not found; install it (e.g. 'sudo pacman -S $1')" + fi +} + +# ensure required tools are available early +require_cmd zip +require_cmd unzip + +function ensure_dir() { + mkdir -p "$1" +} + +function find_keytool() { + # first try JAVA_HOME if set + if [[ -n "$JAVA_HOME_DEFAULT" && -x "$JAVA_HOME_DEFAULT/bin/keytool" ]]; then + echo "$JAVA_HOME_DEFAULT/bin/keytool" + return + fi + + # try common install locations + if [[ -n "${JAVA_HOME:-}" && -x "${JAVA_HOME}/bin/keytool" ]]; then + echo "${JAVA_HOME}/bin/keytool" + return + fi + + if command -v keytool >/dev/null 2>&1; then + command -v keytool + return + fi + + fail "keytool not found. Set JAVA_HOME or install a JDK." +} + +function write_stub_file() { + local rel_path="$1" + local content="$2" + local full_path="$BUILD_DIR/stubs/$rel_path" + + ensure_dir "$(dirname "$full_path")" + if [[ ! -f "$full_path" ]]; then + echo -e "$content" > "$full_path" + echo " stub: $rel_path" + fi +} + +function build_ndk_abi() { + local abi="$1" + + # armeabi-v7a needs a few extra NDK flags to get hardware FPU support + # without APP_ABI the default would be whatever Android.mk says, so we + # always pass it explicitly so the same Android.mk works for both targets + local -a extra_flags=( "APP_ABI=$abi" ) + if [[ "$abi" == "armeabi-v7a" ]]; then + # enable hardware FPU + NEON like the old Minecraft ARMv7 builds used to + extra_flags+=( "APP_ARM_MODE=arm" "APP_ARM_NEON=true" ) + fi + + echo " ndk-build for $abi..." + if ! "$ANDROID_NDK_PATH/ndk-build" \ + NDK_PROJECT_PATH="$REPO_ROOT/project/android" \ + APP_BUILD_SCRIPT="$JNI_DIR/Android.mk" \ + "${extra_flags[@]}" \ + 2>&1 | tee "$BUILD_DIR/ndk-build-${abi}.log"; then + echo "NDK build failed for $abi. See $BUILD_DIR/ndk-build-${abi}.log" >&2 + exit 1 + fi + + ensure_dir "$BUILD_DIR/lib/$abi" + cp -v "$REPO_ROOT/project/android/libs/$abi/libminecraftpe.so" "$BUILD_DIR/lib/$abi/" + echo " .so -> $BUILD_DIR/lib/$abi/libminecraftpe.so" +} + +######################################## +# argument parsing +######################################## +while [[ $# -gt 0 ]]; do + case "$1" in + --no-cpp) NO_CPP=true ;; + --no-java) NO_JAVA=true ;; + --no-build) NO_BUILD=true ;; + --abi) + shift + [[ $# -gt 0 ]] || fail "--abi requires a value (arm64-v8a, armeabi-v7a, all)" + TARGET_ABI="$1" + ;; + -h|--help) usage ;; + *) + echo "Unknown option: $1" >&2 + usage + ;; + esac + shift +done + +# validate the ABI value now that all args are parsed +case "$TARGET_ABI" in + arm64-v8a|armeabi-v7a|all) ;; + *) fail "Unknown ABI '$TARGET_ABI'. Supported values: arm64-v8a, armeabi-v7a, all" ;; +esac + +echo " TARGET_ABI=$TARGET_ABI" + +# resolve APK output filenames now that TARGET_ABI is final. +# arm64-v8a -> minecraftpe-v8a-debug.apk +# armeabi-v7a -> minecraftpe-v7a-debug.apk +# all -> minecraftpe-all-debug.apk (fat APK containing both ABIs) +case "$TARGET_ABI" in + arm64-v8a) APK_SUFFIX="v8a" ;; + armeabi-v7a) APK_SUFFIX="v7a" ;; + *) APK_SUFFIX="$TARGET_ABI" ;; +esac +APK_UNSIGNED="$BUILD_DIR/minecraftpe-${APK_SUFFIX}-unsigned.apk" +APK_ALIGNED="$BUILD_DIR/minecraftpe-${APK_SUFFIX}-aligned.apk" +APK_SIGNED="$BUILD_DIR/minecraftpe-${APK_SUFFIX}-debug.apk" + +######################################## +# validate required tools +######################################## +KEYTOOL="$(find_keytool)" + +if [[ ! -x "$AAPT" ]]; then + fail "aapt not found at $AAPT" +fi + +if [[ ! -x "$ZIPALIGN" ]]; then + fail "zipalign not found at $ZIPALIGN" +fi + +if [[ ! -x "$APKSIGNER" ]]; then + fail "apksigner not found at $APKSIGNER" +fi + +if [[ ! -x "$DEX_TOOL" ]]; then + fail "d8 not found at $DEX_TOOL" +fi + +if [[ ! -x "$ADB" ]]; then + fail "adb not found at $ADB" +fi + +######################################## +# bootstrap +######################################## +log_step "Bootstrap" + +ensure_dir "$BUILD_DIR" +ensure_dir "$BUILD_DIR/lib/arm64-v8a" +ensure_dir "$BUILD_DIR/lib/armeabi-v7a" +ensure_dir "$BUILD_DIR/gen" +ensure_dir "$BUILD_DIR/stubs" + +# create a debug keystore if it doesn't exist +if [[ ! -f "$KEYSTORE_FILE" ]]; then + echo " generating debug.keystore..." + "$KEYTOOL" -genkeypair \ + -keystore "$KEYSTORE_FILE" -storepass android -keypass android \ + -alias androiddebugkey -keyalg RSA -keysize 2048 -validity 10000 \ + -dname "CN=Android Debug,O=Android,C=US" >/dev/null 2>&1 + echo " keystore created" +else + echo " keystore OK" +fi + +# why dont we just include the stubs lol +write_stub_file "com/mojang/android/StringValue.java" "package com.mojang.android;\npublic interface StringValue { String getStringValue(); }\n" + +write_stub_file "com/mojang/android/licensing/LicenseCodes.java" "package com.mojang.android.licensing;\npublic class LicenseCodes { public static final int LICENSE_OK = 0; }\n" + +write_stub_file "com/mojang/android/EditTextAscii.java" "package com.mojang.android;\nimport android.content.Context;\nimport android.text.Editable;\nimport android.text.TextWatcher;\nimport android.util.AttributeSet;\nimport android.widget.EditText;\npublic class EditTextAscii extends EditText implements TextWatcher {\n public EditTextAscii(Context c) { super(c); addTextChangedListener(this); }\n public EditTextAscii(Context c, AttributeSet a) { super(c,a); addTextChangedListener(this); }\n public EditTextAscii(Context c, AttributeSet a, int d) { super(c,a,d); addTextChangedListener(this); }\n @Override public void onTextChanged(CharSequence s,int st,int b,int co){}\n public void beforeTextChanged(CharSequence s,int st,int co,int aft){}\n public void afterTextChanged(Editable e){\n String s=e.toString(),san=sanitize(s);\n if(!s.equals(san))e.replace(0,e.length(),san);\n }\n static public String sanitize(String s){\n StringBuilder sb=new StringBuilder();\n for(int i=0;iSurvival?Survival:i);\n int id=_type==Survival?R.string.gamemode_survival_summary:R.string.gamemode_creative_summary;\n String desc=getContext().getString(id);\n View v=getRootView().findViewById(R.id.labelGameModeDesc);\n if(desc!=null&&v instanceof TextView)((TextView)v).setText(desc);\n }\n public String getStringValue(){return new String[]{\"creative\",\"survival\"}[_type];}\n static public String getStringForType(int i){int c=iSurvival?Survival:i);return new String[]{\"creative\",\"survival\"}[c];}\n}\n" + +echo " stubs OK" + +######################################## +# ndk build +######################################## +if [[ "$NO_CPP" == false && "$NO_BUILD" == false ]]; then + log_step "NDK build ($TARGET_ABI)" + + # the original windows build script used a junction to avoid long paths here + # on linux, path lengths are *usually* fine, but we still keep things simple + pushd "$JNI_DIR" >/dev/null + + export NDK_MODULE_PATH="$REPO_ROOT/project/lib_projects" + + # build each requested ABI by delegating to build_ndk_abi() + if [[ "$TARGET_ABI" == "all" ]]; then + build_ndk_abi "arm64-v8a" + build_ndk_abi "armeabi-v7a" + else + build_ndk_abi "$TARGET_ABI" + fi + + popd >/dev/null +fi + +######################################## +# java compile +######################################## +if [[ "$NO_JAVA" == false && "$NO_BUILD" == false ]]; then + log_step "Java compile" + + ensure_dir "$(dirname "$BUILD_DIR/gen/R.java")" + + # generate R.java + "$AAPT" package -f -M "$ANDROID_MANIFEST" -S "$ANDROID_RES_DIR" -I "$ANDROID_PLATFORM_DIR/android.jar" -J "$BUILD_DIR/gen" -F "$BUILD_DIR/_rgen.apk" + rm -f "$BUILD_DIR/_rgen.apk" + + # collect all source files (project + stubs + generated R.java) + JAVA_SOURCES=( + $(find "$JAVA_SRC_DIR" -name "*.java" -print) + $(find "$BUILD_DIR/stubs" -name "*.java" -print) + "$BUILD_DIR/gen/R.java" + ) + + rm -rf "$BUILD_DIR/classes" + ensure_dir "$BUILD_DIR/classes" + + # Some JDK versions (<=8) don't support --release. + JAVAC_ARGS=(--release 8) + if "$JAVAC_CMD" -version 2>&1 | grep -qE '^javac 1\.'; then + JAVAC_ARGS=(-source 1.8 -target 1.8) + fi + + "$JAVAC_CMD" "${JAVAC_ARGS[@]}" -cp "$ANDROID_PLATFORM_DIR/android.jar" -d "$BUILD_DIR/classes" "${JAVA_SOURCES[@]}" + echo " javac OK" + + # convert class files into dex + JAVA_CLASS_FILES=( $(find "$BUILD_DIR/classes" -name "*.class" -print) ) + "$DEX_TOOL" --min-api 21 --output "$BUILD_DIR" "${JAVA_CLASS_FILES[@]}" + echo " d8 -> $DEX_OUTPUT" +fi + +######################################## +# package apk +######################################## +log_step "Package APK" + +rm -f "$APK_UNSIGNED" "$APK_ALIGNED" "$APK_SIGNED" + +"$AAPT" package -f -M "$ANDROID_MANIFEST" -S "$ANDROID_RES_DIR" -I "$ANDROID_PLATFORM_DIR/android.jar" -F "$APK_UNSIGNED" + +# add classes.dex and native library/libraries into apk. +# when building for "all" we pack both ABIs into the same APK so Android can +# pick the right one at install time (fat APK). for a single-ABI build we +# only include the one .so that was actually compiled. +pushd "$BUILD_DIR" >/dev/null +zip -q "$APK_UNSIGNED" "classes.dex" +if [[ "$TARGET_ABI" == "all" ]]; then + zip -q "$APK_UNSIGNED" "lib/arm64-v8a/libminecraftpe.so" + zip -q "$APK_UNSIGNED" "lib/armeabi-v7a/libminecraftpe.so" +else + zip -q "$APK_UNSIGNED" "lib/$TARGET_ABI/libminecraftpe.so" +fi +popd >/dev/null + +# add assets from data/ directory into the apk under assets/ +TMP_ASSETS_DIR="$(mktemp -d)" +mkdir -p "$TMP_ASSETS_DIR/assets" +cp -r "$DATA_DIR/." "$TMP_ASSETS_DIR/assets/" +pushd "$TMP_ASSETS_DIR" >/dev/null +zip -q -r "$APK_UNSIGNED" assets +popd >/dev/null +rm -rf "$TMP_ASSETS_DIR" + +"$ZIPALIGN" -p 4 "$APK_UNSIGNED" "$APK_ALIGNED" +"$APKSIGNER" sign --ks "$KEYSTORE_FILE" --ks-pass pass:android --key-pass pass:android --out "$APK_SIGNED" "$APK_ALIGNED" + +echo " signed -> $APK_SIGNED" + +######################################## +# install +######################################## +log_step "Install" + +"$ADB" shell am force-stop "$PACKAGE_NAME" || true +"$ADB" uninstall "$PACKAGE_NAME" || true +"$ADB" install --no-incremental "$APK_SIGNED" + +echo -e "\nDone. Enjoy MCPE 0.6.1 on your device!" \ No newline at end of file diff --git a/cmake/EnumOption.cmake b/cmake/EnumOption.cmake new file mode 100644 index 0000000..e8de5e6 --- /dev/null +++ b/cmake/EnumOption.cmake @@ -0,0 +1,9 @@ +macro(enum_option var values description) + set(${var}_VALUES ${values}) + list(GET ${var}_VALUES 0 default) + set(${var} "${default}" CACHE STRING "${description}") + set_property(CACHE ${var} PROPERTY STRINGS ${${var}_VALUES}) + if (NOT ";${${var}_VALUES};" MATCHES ";${${var}};") + message(FATAL_ERROR "Unknown value ${${var}}. Only -D${var}=${${var}_VALUES} allowed.") + endif() +endmacro() \ No newline at end of file diff --git a/data/images/gui/gui.png b/data/images/gui/gui.png index 0ae80b9..db8f7bd 100755 Binary files a/data/images/gui/gui.png and b/data/images/gui/gui.png differ diff --git a/data/images/gui/logo/github.png b/data/images/gui/logo/github.png new file mode 100644 index 0000000..4562916 Binary files /dev/null and b/data/images/gui/logo/github.png differ diff --git a/data/images/misc/foliagecolor.png b/data/images/misc/foliagecolor.png new file mode 100644 index 0000000..81673ca Binary files /dev/null and b/data/images/misc/foliagecolor.png differ diff --git a/data/images/misc/grasscolor.png b/data/images/misc/grasscolor.png new file mode 100644 index 0000000..a6d9c20 Binary files /dev/null and b/data/images/misc/grasscolor.png differ diff --git a/data/images/misc/shadow.png b/data/images/misc/shadow.png new file mode 100644 index 0000000..06d999b Binary files /dev/null and b/data/images/misc/shadow.png differ diff --git a/data/images/misc/vignette.png b/data/images/misc/vignette.png new file mode 100644 index 0000000..f236acb Binary files /dev/null and b/data/images/misc/vignette.png differ diff --git a/data/images/misc/water.png b/data/images/misc/water.png new file mode 100644 index 0000000..8b92f9b Binary files /dev/null and b/data/images/misc/water.png differ diff --git a/data/images/mob/char.png b/data/images/mob/char.png index 7cfa08a..d507d75 100755 Binary files a/data/images/mob/char.png and b/data/images/mob/char.png differ diff --git a/data/images/pe.ico b/data/images/pe.ico new file mode 100644 index 0000000..b0e657b Binary files /dev/null and b/data/images/pe.ico differ diff --git a/data/images/pe.rc b/data/images/pe.rc new file mode 100644 index 0000000..331c4ed --- /dev/null +++ b/data/images/pe.rc @@ -0,0 +1 @@ +IDI_ICON1 ICON "pe.ico" \ No newline at end of file diff --git a/data/images/terrain.png b/data/images/terrain.png index f14bbed..7991d0a 100755 Binary files a/data/images/terrain.png and b/data/images/terrain.png differ diff --git a/data/images/terrain/moon.png b/data/images/terrain/moon.png new file mode 100644 index 0000000..61cebbc Binary files /dev/null and b/data/images/terrain/moon.png differ diff --git a/data/images/terrain/sun.png b/data/images/terrain/sun.png new file mode 100644 index 0000000..d343344 Binary files /dev/null and b/data/images/terrain/sun.png differ diff --git a/data/lang/en_US.lang b/data/lang/en_US.lang index 8f2aea8..567a52b 100755 --- a/data/lang/en_US.lang +++ b/data/lang/en_US.lang @@ -144,6 +144,44 @@ options.fov.max=Quake Pro options.gamma=Brightness options.gamma.min=Moody options.gamma.max=Bright +options.group.mojang=Login +options.group.general=General +options.group.game=Game +options.group.controls=Controls +options.group.graphics=Graphics +options.group.tweaks=Tweaks +options.allowSprint=Allow sprint +options.barOnTop=HUD above inventory +options.rpiCursor=Show Raspberry PI cursor +options.foliagetint=Foliage Tinting +options.javaHud=Beta Java hotbar tweaks +options.blockOutline=Block Outline Selection +options.fogType=Fog/Sky Color +options.fogType.vanilla=Vanilla +options.fogType.java=Beta Java +options.fogType.unused=Unused + +options.debugStyle=Debug Menu Style +options.debugStyle.javaBeta=Java Beta +options.debugStyle.custom=Custom + +options.beautifulSky=Beautiful Skies + +options.useVignette=Vignette Overlay + +options.tintedSide=Tint Grass Sides + +options.betaSky=Java Beta Sky + +options.restoredAnims=Restored Animations + +options.normalLighting=Java Beta/Normals Shading + +options.isJoyTouchArea=Use Split Controls + +options.autoJump=Auto Jump +options.thirdperson=Third Person +options.servervisible=Server Visible options.sensitivity=Sensitivity options.sensitivity.min=*yawn* options.sensitivity.max=HYPERSPEED!!! @@ -156,6 +194,8 @@ options.viewBobbing=View Bobbing options.ao=Smooth Lighting options.anaglyph=3D Anaglyph options.framerateLimit=Performance +options.limitFramerate=Limit Framerate +options.vsync=VSync options.difficulty=Difficulty options.difficulty.peaceful=Peaceful options.difficulty.easy=Easy @@ -168,8 +208,10 @@ options.graphics.fast=Fast options.guiScale=GUI Scale options.guiScale.auto=Auto options.guiScale.small=Small -options.guiScale.normal=Normal +options.guiScale.medium=Medium options.guiScale.large=Large +options.guiScale.larger=Larger +options.guiScale.largest=Largest options.advancedOpengl=Advanced OpenGL options.renderClouds=Clouds options.farWarning1=A 64 bit Java installation is recommended @@ -178,6 +220,21 @@ options.particles=Particles options.particles.all=All options.particles.decreased=Decreased options.particles.minimal=Minimal +options.username=Username +options.smoothCamera=Smooth camera +options.destroyVibration=Destroy vibration +options.isLeftHanded=Left handed +options.useTouchscreen=Use touchscreen +options.fancyGraphics=Fancy graphics +options.renderDebug=Debug render +options.anaglyph3d=3D anaglyph + +options.windowScale =Window Scaling + +options.menuStyle =Menu Style +options.menuStyle.pocket =Pocket Edition +options.menuStyle.xperia =Xperia/Pi +options.menuStyle.java =Java Beta performance.max=Max FPS performance.balanced=Balanced @@ -185,21 +242,21 @@ performance.powersaver=Power saver controls.title=Controls -key.forward=Forward -key.left=Left -key.back=Back -key.right=Right -key.jump=Jump -key.inventory=Inventory -key.drop=Drop -key.chat=Chat -key.fog=Toggle Fog -key.sneak=Sneak -key.playerlist=List Players -key.attack=Attack -key.use=Use Item -key.pickItem=Pick Block -key.mouseButton=Button %1$s +options.key.forward=Forward +options.key.left=Left +options.key.back=Back +options.key.right=Right +options.key.jump=Jump +options.key.inventory=Inventory +options.key.drop=Drop +options.key.chat=Chat +options.key.fog=Toggle Fog +options.key.sneak=Sneak +options.key.playerlist=List Players +options.key.attack=Attack +options.key.use=Use Item +options.key.pickItem=Pick Block +options.key.mouseButton=Button %1$s texturePack.openFolder=Open texture pack folder texturePack.title=Select Texture Pack @@ -963,5 +1020,5 @@ desc.netherbrickitem=Used to form blocks of Nether bricks. desc.netherquartz=Quartz from the Nether, used to create Blocks of Quartz. desc.quartzblock=Decorative block, used to create other kinds of Quartz blocks. desc.stonecutter=For crafting stoneblocks. -desc.seedsmelon=Allows for more melons. +desc.seeds_melon=Allows for more melons. desc.tile.melon=Can be cut up and eaten. diff --git a/glad/include/KHR/khrplatform.h b/glad/include/KHR/khrplatform.h old mode 100755 new mode 100644 diff --git a/glad/include/glad/glad.h b/glad/include/glad/glad.h old mode 100755 new mode 100644 index c730089..0d23167 --- a/glad/include/glad/glad.h +++ b/glad/include/glad/glad.h @@ -1,23 +1,23 @@ /* - OpenGL ES loader generated by glad 0.1.36 on Sun Mar 1 23:53:39 2026. + OpenGL loader generated by glad 0.1.36 on Sun Mar 15 18:19:37 2026. Language/Generator: C/C++ Specification: gl - APIs: gles1=1.0 + APIs: gl=2.1 Profile: compatibility Extensions: - GL_OES_EGL_image, - GL_OES_EGL_image_external + GL_EXT_EGL_image_storage, + GL_EXT_EGL_sync Loader: True Local files: False Omit khrplatform: False Reproducible: False Commandline: - --profile="compatibility" --api="gles1=1.0" --generator="c" --spec="gl" --extensions="GL_OES_EGL_image,GL_OES_EGL_image_external" + --profile="compatibility" --api="gl=2.1" --generator="c" --spec="gl" --extensions="GL_EXT_EGL_image_storage,GL_EXT_EGL_sync" Online: - https://glad.dav1d.de/#profile=compatibility&language=c&specification=gl&loader=on&api=gles1%3D1.0&extensions=GL_OES_EGL_image&extensions=GL_OES_EGL_image_external + https://glad.dav1d.de/#profile=compatibility&language=c&specification=gl&loader=on&api=gl%3D2.1&extensions=GL_EXT_EGL_image_storage&extensions=GL_EXT_EGL_sync */ @@ -25,7 +25,7 @@ #define __glad_h_ #ifdef __gl_h_ -#error OpenGL ES 1 header already included, remove this include, glad already provides it +#error OpenGL header already included, remove this include, glad already provides it #endif #define __gl_h_ @@ -82,7 +82,10 @@ typedef void* (* GLADloadproc)(const char *name); #endif GLAPI struct gladGLversionStruct GLVersion; -GLAPI int gladLoadGLES1Loader(GLADloadproc); + +GLAPI int gladLoadGL(void); + +GLAPI int gladLoadGLLoader(GLADloadproc); #include typedef unsigned int GLenum; @@ -131,9 +134,6 @@ typedef void (APIENTRY *GLDEBUGPROCAMD)(GLuint id,GLenum category,GLenum severit typedef unsigned short GLhalfNV; typedef GLintptr GLvdpauSurfaceNV; typedef void (APIENTRY *GLVULKANPROCNV)(void); -#define GL_VERSION_ES_CL_1_0 1 -#define GL_VERSION_ES_CM_1_1 1 -#define GL_VERSION_ES_CL_1_1 1 #define GL_DEPTH_BUFFER_BIT 0x00000100 #define GL_STENCIL_BUFFER_BIT 0x00000400 #define GL_COLOR_BUFFER_BIT 0x00004000 @@ -146,6 +146,7 @@ typedef void (APIENTRY *GLVULKANPROCNV)(void); #define GL_TRIANGLES 0x0004 #define GL_TRIANGLE_STRIP 0x0005 #define GL_TRIANGLE_FAN 0x0006 +#define GL_QUADS 0x0007 #define GL_NEVER 0x0200 #define GL_LESS 0x0201 #define GL_EQUAL 0x0202 @@ -165,75 +166,41 @@ typedef void (APIENTRY *GLVULKANPROCNV)(void); #define GL_DST_COLOR 0x0306 #define GL_ONE_MINUS_DST_COLOR 0x0307 #define GL_SRC_ALPHA_SATURATE 0x0308 -#define GL_CLIP_PLANE0 0x3000 -#define GL_CLIP_PLANE1 0x3001 -#define GL_CLIP_PLANE2 0x3002 -#define GL_CLIP_PLANE3 0x3003 -#define GL_CLIP_PLANE4 0x3004 -#define GL_CLIP_PLANE5 0x3005 +#define GL_NONE 0 +#define GL_FRONT_LEFT 0x0400 +#define GL_FRONT_RIGHT 0x0401 +#define GL_BACK_LEFT 0x0402 +#define GL_BACK_RIGHT 0x0403 #define GL_FRONT 0x0404 #define GL_BACK 0x0405 +#define GL_LEFT 0x0406 +#define GL_RIGHT 0x0407 #define GL_FRONT_AND_BACK 0x0408 -#define GL_FOG 0x0B60 -#define GL_LIGHTING 0x0B50 -#define GL_TEXTURE_2D 0x0DE1 -#define GL_CULL_FACE 0x0B44 -#define GL_ALPHA_TEST 0x0BC0 -#define GL_BLEND 0x0BE2 -#define GL_COLOR_LOGIC_OP 0x0BF2 -#define GL_DITHER 0x0BD0 -#define GL_STENCIL_TEST 0x0B90 -#define GL_DEPTH_TEST 0x0B71 -#define GL_POINT_SMOOTH 0x0B10 -#define GL_LINE_SMOOTH 0x0B20 -#define GL_SCISSOR_TEST 0x0C11 -#define GL_COLOR_MATERIAL 0x0B57 -#define GL_NORMALIZE 0x0BA1 -#define GL_RESCALE_NORMAL 0x803A -#define GL_VERTEX_ARRAY 0x8074 -#define GL_NORMAL_ARRAY 0x8075 -#define GL_COLOR_ARRAY 0x8076 -#define GL_TEXTURE_COORD_ARRAY 0x8078 -#define GL_MULTISAMPLE 0x809D -#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E -#define GL_SAMPLE_ALPHA_TO_ONE 0x809F -#define GL_SAMPLE_COVERAGE 0x80A0 #define GL_NO_ERROR 0 #define GL_INVALID_ENUM 0x0500 #define GL_INVALID_VALUE 0x0501 #define GL_INVALID_OPERATION 0x0502 -#define GL_STACK_OVERFLOW 0x0503 -#define GL_STACK_UNDERFLOW 0x0504 #define GL_OUT_OF_MEMORY 0x0505 -#define GL_EXP 0x0800 -#define GL_EXP2 0x0801 -#define GL_FOG_DENSITY 0x0B62 -#define GL_FOG_START 0x0B63 -#define GL_FOG_END 0x0B64 -#define GL_FOG_MODE 0x0B65 -#define GL_FOG_COLOR 0x0B66 #define GL_CW 0x0900 #define GL_CCW 0x0901 -#define GL_CURRENT_COLOR 0x0B00 -#define GL_CURRENT_NORMAL 0x0B02 -#define GL_CURRENT_TEXTURE_COORDS 0x0B03 #define GL_POINT_SIZE 0x0B11 -#define GL_POINT_SIZE_MIN 0x8126 -#define GL_POINT_SIZE_MAX 0x8127 -#define GL_POINT_FADE_THRESHOLD_SIZE 0x8128 -#define GL_POINT_DISTANCE_ATTENUATION 0x8129 -#define GL_SMOOTH_POINT_SIZE_RANGE 0x0B12 +#define GL_POINT_SIZE_RANGE 0x0B12 +#define GL_POINT_SIZE_GRANULARITY 0x0B13 +#define GL_LINE_SMOOTH 0x0B20 #define GL_LINE_WIDTH 0x0B21 -#define GL_SMOOTH_LINE_WIDTH_RANGE 0x0B22 -#define GL_ALIASED_POINT_SIZE_RANGE 0x846D -#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E +#define GL_LINE_WIDTH_RANGE 0x0B22 +#define GL_LINE_WIDTH_GRANULARITY 0x0B23 +#define GL_POLYGON_MODE 0x0B40 +#define GL_POLYGON_SMOOTH 0x0B41 +#define GL_CULL_FACE 0x0B44 #define GL_CULL_FACE_MODE 0x0B45 #define GL_FRONT_FACE 0x0B46 -#define GL_SHADE_MODEL 0x0B54 #define GL_DEPTH_RANGE 0x0B70 +#define GL_DEPTH_TEST 0x0B71 #define GL_DEPTH_WRITEMASK 0x0B72 #define GL_DEPTH_CLEAR_VALUE 0x0B73 #define GL_DEPTH_FUNC 0x0B74 +#define GL_STENCIL_TEST 0x0B90 #define GL_STENCIL_CLEAR_VALUE 0x0B91 #define GL_STENCIL_FUNC 0x0B92 #define GL_STENCIL_VALUE_MASK 0x0B93 @@ -242,88 +209,54 @@ typedef void (APIENTRY *GLVULKANPROCNV)(void); #define GL_STENCIL_PASS_DEPTH_PASS 0x0B96 #define GL_STENCIL_REF 0x0B97 #define GL_STENCIL_WRITEMASK 0x0B98 -#define GL_MATRIX_MODE 0x0BA0 #define GL_VIEWPORT 0x0BA2 -#define GL_MODELVIEW_STACK_DEPTH 0x0BA3 -#define GL_PROJECTION_STACK_DEPTH 0x0BA4 -#define GL_TEXTURE_STACK_DEPTH 0x0BA5 -#define GL_MODELVIEW_MATRIX 0x0BA6 -#define GL_PROJECTION_MATRIX 0x0BA7 -#define GL_TEXTURE_MATRIX 0x0BA8 -#define GL_ALPHA_TEST_FUNC 0x0BC1 -#define GL_ALPHA_TEST_REF 0x0BC2 +#define GL_DITHER 0x0BD0 #define GL_BLEND_DST 0x0BE0 #define GL_BLEND_SRC 0x0BE1 +#define GL_BLEND 0x0BE2 #define GL_LOGIC_OP_MODE 0x0BF0 +#define GL_DRAW_BUFFER 0x0C01 +#define GL_READ_BUFFER 0x0C02 #define GL_SCISSOR_BOX 0x0C10 +#define GL_SCISSOR_TEST 0x0C11 #define GL_COLOR_CLEAR_VALUE 0x0C22 #define GL_COLOR_WRITEMASK 0x0C23 -#define GL_MAX_LIGHTS 0x0D31 -#define GL_MAX_CLIP_PLANES 0x0D32 +#define GL_DOUBLEBUFFER 0x0C32 +#define GL_STEREO 0x0C33 +#define GL_LINE_SMOOTH_HINT 0x0C52 +#define GL_POLYGON_SMOOTH_HINT 0x0C53 +#define GL_UNPACK_SWAP_BYTES 0x0CF0 +#define GL_UNPACK_LSB_FIRST 0x0CF1 +#define GL_UNPACK_ROW_LENGTH 0x0CF2 +#define GL_UNPACK_SKIP_ROWS 0x0CF3 +#define GL_UNPACK_SKIP_PIXELS 0x0CF4 +#define GL_UNPACK_ALIGNMENT 0x0CF5 +#define GL_PACK_SWAP_BYTES 0x0D00 +#define GL_PACK_LSB_FIRST 0x0D01 +#define GL_PACK_ROW_LENGTH 0x0D02 +#define GL_PACK_SKIP_ROWS 0x0D03 +#define GL_PACK_SKIP_PIXELS 0x0D04 +#define GL_PACK_ALIGNMENT 0x0D05 #define GL_MAX_TEXTURE_SIZE 0x0D33 -#define GL_MAX_MODELVIEW_STACK_DEPTH 0x0D36 -#define GL_MAX_PROJECTION_STACK_DEPTH 0x0D38 -#define GL_MAX_TEXTURE_STACK_DEPTH 0x0D39 #define GL_MAX_VIEWPORT_DIMS 0x0D3A -#define GL_MAX_TEXTURE_UNITS 0x84E2 #define GL_SUBPIXEL_BITS 0x0D50 -#define GL_RED_BITS 0x0D52 -#define GL_GREEN_BITS 0x0D53 -#define GL_BLUE_BITS 0x0D54 -#define GL_ALPHA_BITS 0x0D55 -#define GL_DEPTH_BITS 0x0D56 -#define GL_STENCIL_BITS 0x0D57 -#define GL_POLYGON_OFFSET_UNITS 0x2A00 -#define GL_POLYGON_OFFSET_FILL 0x8037 -#define GL_POLYGON_OFFSET_FACTOR 0x8038 -#define GL_TEXTURE_BINDING_2D 0x8069 -#define GL_VERTEX_ARRAY_SIZE 0x807A -#define GL_VERTEX_ARRAY_TYPE 0x807B -#define GL_VERTEX_ARRAY_STRIDE 0x807C -#define GL_NORMAL_ARRAY_TYPE 0x807E -#define GL_NORMAL_ARRAY_STRIDE 0x807F -#define GL_COLOR_ARRAY_SIZE 0x8081 -#define GL_COLOR_ARRAY_TYPE 0x8082 -#define GL_COLOR_ARRAY_STRIDE 0x8083 -#define GL_TEXTURE_COORD_ARRAY_SIZE 0x8088 -#define GL_TEXTURE_COORD_ARRAY_TYPE 0x8089 -#define GL_TEXTURE_COORD_ARRAY_STRIDE 0x808A -#define GL_VERTEX_ARRAY_POINTER 0x808E -#define GL_NORMAL_ARRAY_POINTER 0x808F -#define GL_COLOR_ARRAY_POINTER 0x8090 -#define GL_TEXTURE_COORD_ARRAY_POINTER 0x8092 -#define GL_SAMPLE_BUFFERS 0x80A8 -#define GL_SAMPLES 0x80A9 -#define GL_SAMPLE_COVERAGE_VALUE 0x80AA -#define GL_SAMPLE_COVERAGE_INVERT 0x80AB -#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2 -#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3 +#define GL_TEXTURE_1D 0x0DE0 +#define GL_TEXTURE_2D 0x0DE1 +#define GL_TEXTURE_WIDTH 0x1000 +#define GL_TEXTURE_HEIGHT 0x1001 +#define GL_TEXTURE_BORDER_COLOR 0x1004 #define GL_DONT_CARE 0x1100 #define GL_FASTEST 0x1101 #define GL_NICEST 0x1102 -#define GL_PERSPECTIVE_CORRECTION_HINT 0x0C50 -#define GL_POINT_SMOOTH_HINT 0x0C51 -#define GL_LINE_SMOOTH_HINT 0x0C52 -#define GL_FOG_HINT 0x0C54 -#define GL_GENERATE_MIPMAP_HINT 0x8192 -#define GL_LIGHT_MODEL_AMBIENT 0x0B53 -#define GL_LIGHT_MODEL_TWO_SIDE 0x0B52 -#define GL_AMBIENT 0x1200 -#define GL_DIFFUSE 0x1201 -#define GL_SPECULAR 0x1202 -#define GL_POSITION 0x1203 -#define GL_SPOT_DIRECTION 0x1204 -#define GL_SPOT_EXPONENT 0x1205 -#define GL_SPOT_CUTOFF 0x1206 -#define GL_CONSTANT_ATTENUATION 0x1207 -#define GL_LINEAR_ATTENUATION 0x1208 -#define GL_QUADRATIC_ATTENUATION 0x1209 #define GL_BYTE 0x1400 #define GL_UNSIGNED_BYTE 0x1401 #define GL_SHORT 0x1402 #define GL_UNSIGNED_SHORT 0x1403 +#define GL_INT 0x1404 +#define GL_UNSIGNED_INT 0x1405 #define GL_FLOAT 0x1406 -#define GL_FIXED 0x140C +#define GL_STACK_OVERFLOW 0x0503 +#define GL_STACK_UNDERFLOW 0x0504 #define GL_CLEAR 0x1500 #define GL_AND 0x1501 #define GL_AND_REVERSE 0x1502 @@ -340,24 +273,21 @@ typedef void (APIENTRY *GLVULKANPROCNV)(void); #define GL_OR_INVERTED 0x150D #define GL_NAND 0x150E #define GL_SET 0x150F -#define GL_EMISSION 0x1600 -#define GL_SHININESS 0x1601 -#define GL_AMBIENT_AND_DIFFUSE 0x1602 -#define GL_MODELVIEW 0x1700 -#define GL_PROJECTION 0x1701 #define GL_TEXTURE 0x1702 +#define GL_COLOR 0x1800 +#define GL_DEPTH 0x1801 +#define GL_STENCIL 0x1802 +#define GL_STENCIL_INDEX 0x1901 +#define GL_DEPTH_COMPONENT 0x1902 +#define GL_RED 0x1903 +#define GL_GREEN 0x1904 +#define GL_BLUE 0x1905 #define GL_ALPHA 0x1906 #define GL_RGB 0x1907 #define GL_RGBA 0x1908 -#define GL_LUMINANCE 0x1909 -#define GL_LUMINANCE_ALPHA 0x190A -#define GL_UNPACK_ALIGNMENT 0x0CF5 -#define GL_PACK_ALIGNMENT 0x0D05 -#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033 -#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034 -#define GL_UNSIGNED_SHORT_5_6_5 0x8363 -#define GL_FLAT 0x1D00 -#define GL_SMOOTH 0x1D01 +#define GL_POINT 0x1B00 +#define GL_LINE 0x1B01 +#define GL_FILL 0x1B02 #define GL_KEEP 0x1E00 #define GL_REPLACE 0x1E01 #define GL_INCR 0x1E02 @@ -366,12 +296,6 @@ typedef void (APIENTRY *GLVULKANPROCNV)(void); #define GL_RENDERER 0x1F01 #define GL_VERSION 0x1F02 #define GL_EXTENSIONS 0x1F03 -#define GL_MODULATE 0x2100 -#define GL_DECAL 0x2101 -#define GL_ADD 0x0104 -#define GL_TEXTURE_ENV_MODE 0x2200 -#define GL_TEXTURE_ENV_COLOR 0x2201 -#define GL_TEXTURE_ENV 0x2300 #define GL_NEAREST 0x2600 #define GL_LINEAR 0x2601 #define GL_NEAREST_MIPMAP_NEAREST 0x2700 @@ -382,7 +306,403 @@ typedef void (APIENTRY *GLVULKANPROCNV)(void); #define GL_TEXTURE_MIN_FILTER 0x2801 #define GL_TEXTURE_WRAP_S 0x2802 #define GL_TEXTURE_WRAP_T 0x2803 -#define GL_GENERATE_MIPMAP 0x8191 +#define GL_REPEAT 0x2901 +#define GL_CURRENT_BIT 0x00000001 +#define GL_POINT_BIT 0x00000002 +#define GL_LINE_BIT 0x00000004 +#define GL_POLYGON_BIT 0x00000008 +#define GL_POLYGON_STIPPLE_BIT 0x00000010 +#define GL_PIXEL_MODE_BIT 0x00000020 +#define GL_LIGHTING_BIT 0x00000040 +#define GL_FOG_BIT 0x00000080 +#define GL_ACCUM_BUFFER_BIT 0x00000200 +#define GL_VIEWPORT_BIT 0x00000800 +#define GL_TRANSFORM_BIT 0x00001000 +#define GL_ENABLE_BIT 0x00002000 +#define GL_HINT_BIT 0x00008000 +#define GL_EVAL_BIT 0x00010000 +#define GL_LIST_BIT 0x00020000 +#define GL_TEXTURE_BIT 0x00040000 +#define GL_SCISSOR_BIT 0x00080000 +#define GL_ALL_ATTRIB_BITS 0xFFFFFFFF +#define GL_QUAD_STRIP 0x0008 +#define GL_POLYGON 0x0009 +#define GL_ACCUM 0x0100 +#define GL_LOAD 0x0101 +#define GL_RETURN 0x0102 +#define GL_MULT 0x0103 +#define GL_ADD 0x0104 +#define GL_AUX0 0x0409 +#define GL_AUX1 0x040A +#define GL_AUX2 0x040B +#define GL_AUX3 0x040C +#define GL_2D 0x0600 +#define GL_3D 0x0601 +#define GL_3D_COLOR 0x0602 +#define GL_3D_COLOR_TEXTURE 0x0603 +#define GL_4D_COLOR_TEXTURE 0x0604 +#define GL_PASS_THROUGH_TOKEN 0x0700 +#define GL_POINT_TOKEN 0x0701 +#define GL_LINE_TOKEN 0x0702 +#define GL_POLYGON_TOKEN 0x0703 +#define GL_BITMAP_TOKEN 0x0704 +#define GL_DRAW_PIXEL_TOKEN 0x0705 +#define GL_COPY_PIXEL_TOKEN 0x0706 +#define GL_LINE_RESET_TOKEN 0x0707 +#define GL_EXP 0x0800 +#define GL_EXP2 0x0801 +#define GL_COEFF 0x0A00 +#define GL_ORDER 0x0A01 +#define GL_DOMAIN 0x0A02 +#define GL_PIXEL_MAP_I_TO_I 0x0C70 +#define GL_PIXEL_MAP_S_TO_S 0x0C71 +#define GL_PIXEL_MAP_I_TO_R 0x0C72 +#define GL_PIXEL_MAP_I_TO_G 0x0C73 +#define GL_PIXEL_MAP_I_TO_B 0x0C74 +#define GL_PIXEL_MAP_I_TO_A 0x0C75 +#define GL_PIXEL_MAP_R_TO_R 0x0C76 +#define GL_PIXEL_MAP_G_TO_G 0x0C77 +#define GL_PIXEL_MAP_B_TO_B 0x0C78 +#define GL_PIXEL_MAP_A_TO_A 0x0C79 +#define GL_CURRENT_COLOR 0x0B00 +#define GL_CURRENT_INDEX 0x0B01 +#define GL_CURRENT_NORMAL 0x0B02 +#define GL_CURRENT_TEXTURE_COORDS 0x0B03 +#define GL_CURRENT_RASTER_COLOR 0x0B04 +#define GL_CURRENT_RASTER_INDEX 0x0B05 +#define GL_CURRENT_RASTER_TEXTURE_COORDS 0x0B06 +#define GL_CURRENT_RASTER_POSITION 0x0B07 +#define GL_CURRENT_RASTER_POSITION_VALID 0x0B08 +#define GL_CURRENT_RASTER_DISTANCE 0x0B09 +#define GL_POINT_SMOOTH 0x0B10 +#define GL_LINE_STIPPLE 0x0B24 +#define GL_LINE_STIPPLE_PATTERN 0x0B25 +#define GL_LINE_STIPPLE_REPEAT 0x0B26 +#define GL_LIST_MODE 0x0B30 +#define GL_MAX_LIST_NESTING 0x0B31 +#define GL_LIST_BASE 0x0B32 +#define GL_LIST_INDEX 0x0B33 +#define GL_POLYGON_STIPPLE 0x0B42 +#define GL_EDGE_FLAG 0x0B43 +#define GL_LIGHTING 0x0B50 +#define GL_LIGHT_MODEL_LOCAL_VIEWER 0x0B51 +#define GL_LIGHT_MODEL_TWO_SIDE 0x0B52 +#define GL_LIGHT_MODEL_AMBIENT 0x0B53 +#define GL_SHADE_MODEL 0x0B54 +#define GL_COLOR_MATERIAL_FACE 0x0B55 +#define GL_COLOR_MATERIAL_PARAMETER 0x0B56 +#define GL_COLOR_MATERIAL 0x0B57 +#define GL_FOG 0x0B60 +#define GL_FOG_INDEX 0x0B61 +#define GL_FOG_DENSITY 0x0B62 +#define GL_FOG_START 0x0B63 +#define GL_FOG_END 0x0B64 +#define GL_FOG_MODE 0x0B65 +#define GL_FOG_COLOR 0x0B66 +#define GL_ACCUM_CLEAR_VALUE 0x0B80 +#define GL_MATRIX_MODE 0x0BA0 +#define GL_NORMALIZE 0x0BA1 +#define GL_MODELVIEW_STACK_DEPTH 0x0BA3 +#define GL_PROJECTION_STACK_DEPTH 0x0BA4 +#define GL_TEXTURE_STACK_DEPTH 0x0BA5 +#define GL_MODELVIEW_MATRIX 0x0BA6 +#define GL_PROJECTION_MATRIX 0x0BA7 +#define GL_TEXTURE_MATRIX 0x0BA8 +#define GL_ATTRIB_STACK_DEPTH 0x0BB0 +#define GL_ALPHA_TEST 0x0BC0 +#define GL_ALPHA_TEST_FUNC 0x0BC1 +#define GL_ALPHA_TEST_REF 0x0BC2 +#define GL_LOGIC_OP 0x0BF1 +#define GL_AUX_BUFFERS 0x0C00 +#define GL_INDEX_CLEAR_VALUE 0x0C20 +#define GL_INDEX_WRITEMASK 0x0C21 +#define GL_INDEX_MODE 0x0C30 +#define GL_RGBA_MODE 0x0C31 +#define GL_RENDER_MODE 0x0C40 +#define GL_PERSPECTIVE_CORRECTION_HINT 0x0C50 +#define GL_POINT_SMOOTH_HINT 0x0C51 +#define GL_FOG_HINT 0x0C54 +#define GL_TEXTURE_GEN_S 0x0C60 +#define GL_TEXTURE_GEN_T 0x0C61 +#define GL_TEXTURE_GEN_R 0x0C62 +#define GL_TEXTURE_GEN_Q 0x0C63 +#define GL_PIXEL_MAP_I_TO_I_SIZE 0x0CB0 +#define GL_PIXEL_MAP_S_TO_S_SIZE 0x0CB1 +#define GL_PIXEL_MAP_I_TO_R_SIZE 0x0CB2 +#define GL_PIXEL_MAP_I_TO_G_SIZE 0x0CB3 +#define GL_PIXEL_MAP_I_TO_B_SIZE 0x0CB4 +#define GL_PIXEL_MAP_I_TO_A_SIZE 0x0CB5 +#define GL_PIXEL_MAP_R_TO_R_SIZE 0x0CB6 +#define GL_PIXEL_MAP_G_TO_G_SIZE 0x0CB7 +#define GL_PIXEL_MAP_B_TO_B_SIZE 0x0CB8 +#define GL_PIXEL_MAP_A_TO_A_SIZE 0x0CB9 +#define GL_MAP_COLOR 0x0D10 +#define GL_MAP_STENCIL 0x0D11 +#define GL_INDEX_SHIFT 0x0D12 +#define GL_INDEX_OFFSET 0x0D13 +#define GL_RED_SCALE 0x0D14 +#define GL_RED_BIAS 0x0D15 +#define GL_ZOOM_X 0x0D16 +#define GL_ZOOM_Y 0x0D17 +#define GL_GREEN_SCALE 0x0D18 +#define GL_GREEN_BIAS 0x0D19 +#define GL_BLUE_SCALE 0x0D1A +#define GL_BLUE_BIAS 0x0D1B +#define GL_ALPHA_SCALE 0x0D1C +#define GL_ALPHA_BIAS 0x0D1D +#define GL_DEPTH_SCALE 0x0D1E +#define GL_DEPTH_BIAS 0x0D1F +#define GL_MAX_EVAL_ORDER 0x0D30 +#define GL_MAX_LIGHTS 0x0D31 +#define GL_MAX_CLIP_PLANES 0x0D32 +#define GL_MAX_PIXEL_MAP_TABLE 0x0D34 +#define GL_MAX_ATTRIB_STACK_DEPTH 0x0D35 +#define GL_MAX_MODELVIEW_STACK_DEPTH 0x0D36 +#define GL_MAX_NAME_STACK_DEPTH 0x0D37 +#define GL_MAX_PROJECTION_STACK_DEPTH 0x0D38 +#define GL_MAX_TEXTURE_STACK_DEPTH 0x0D39 +#define GL_INDEX_BITS 0x0D51 +#define GL_RED_BITS 0x0D52 +#define GL_GREEN_BITS 0x0D53 +#define GL_BLUE_BITS 0x0D54 +#define GL_ALPHA_BITS 0x0D55 +#define GL_DEPTH_BITS 0x0D56 +#define GL_STENCIL_BITS 0x0D57 +#define GL_ACCUM_RED_BITS 0x0D58 +#define GL_ACCUM_GREEN_BITS 0x0D59 +#define GL_ACCUM_BLUE_BITS 0x0D5A +#define GL_ACCUM_ALPHA_BITS 0x0D5B +#define GL_NAME_STACK_DEPTH 0x0D70 +#define GL_AUTO_NORMAL 0x0D80 +#define GL_MAP1_COLOR_4 0x0D90 +#define GL_MAP1_INDEX 0x0D91 +#define GL_MAP1_NORMAL 0x0D92 +#define GL_MAP1_TEXTURE_COORD_1 0x0D93 +#define GL_MAP1_TEXTURE_COORD_2 0x0D94 +#define GL_MAP1_TEXTURE_COORD_3 0x0D95 +#define GL_MAP1_TEXTURE_COORD_4 0x0D96 +#define GL_MAP1_VERTEX_3 0x0D97 +#define GL_MAP1_VERTEX_4 0x0D98 +#define GL_MAP2_COLOR_4 0x0DB0 +#define GL_MAP2_INDEX 0x0DB1 +#define GL_MAP2_NORMAL 0x0DB2 +#define GL_MAP2_TEXTURE_COORD_1 0x0DB3 +#define GL_MAP2_TEXTURE_COORD_2 0x0DB4 +#define GL_MAP2_TEXTURE_COORD_3 0x0DB5 +#define GL_MAP2_TEXTURE_COORD_4 0x0DB6 +#define GL_MAP2_VERTEX_3 0x0DB7 +#define GL_MAP2_VERTEX_4 0x0DB8 +#define GL_MAP1_GRID_DOMAIN 0x0DD0 +#define GL_MAP1_GRID_SEGMENTS 0x0DD1 +#define GL_MAP2_GRID_DOMAIN 0x0DD2 +#define GL_MAP2_GRID_SEGMENTS 0x0DD3 +#define GL_TEXTURE_COMPONENTS 0x1003 +#define GL_TEXTURE_BORDER 0x1005 +#define GL_AMBIENT 0x1200 +#define GL_DIFFUSE 0x1201 +#define GL_SPECULAR 0x1202 +#define GL_POSITION 0x1203 +#define GL_SPOT_DIRECTION 0x1204 +#define GL_SPOT_EXPONENT 0x1205 +#define GL_SPOT_CUTOFF 0x1206 +#define GL_CONSTANT_ATTENUATION 0x1207 +#define GL_LINEAR_ATTENUATION 0x1208 +#define GL_QUADRATIC_ATTENUATION 0x1209 +#define GL_COMPILE 0x1300 +#define GL_COMPILE_AND_EXECUTE 0x1301 +#define GL_2_BYTES 0x1407 +#define GL_3_BYTES 0x1408 +#define GL_4_BYTES 0x1409 +#define GL_EMISSION 0x1600 +#define GL_SHININESS 0x1601 +#define GL_AMBIENT_AND_DIFFUSE 0x1602 +#define GL_COLOR_INDEXES 0x1603 +#define GL_MODELVIEW 0x1700 +#define GL_PROJECTION 0x1701 +#define GL_COLOR_INDEX 0x1900 +#define GL_LUMINANCE 0x1909 +#define GL_LUMINANCE_ALPHA 0x190A +#define GL_BITMAP 0x1A00 +#define GL_RENDER 0x1C00 +#define GL_FEEDBACK 0x1C01 +#define GL_SELECT 0x1C02 +#define GL_FLAT 0x1D00 +#define GL_SMOOTH 0x1D01 +#define GL_S 0x2000 +#define GL_T 0x2001 +#define GL_R 0x2002 +#define GL_Q 0x2003 +#define GL_MODULATE 0x2100 +#define GL_DECAL 0x2101 +#define GL_TEXTURE_ENV_MODE 0x2200 +#define GL_TEXTURE_ENV_COLOR 0x2201 +#define GL_TEXTURE_ENV 0x2300 +#define GL_EYE_LINEAR 0x2400 +#define GL_OBJECT_LINEAR 0x2401 +#define GL_SPHERE_MAP 0x2402 +#define GL_TEXTURE_GEN_MODE 0x2500 +#define GL_OBJECT_PLANE 0x2501 +#define GL_EYE_PLANE 0x2502 +#define GL_CLAMP 0x2900 +#define GL_CLIP_PLANE0 0x3000 +#define GL_CLIP_PLANE1 0x3001 +#define GL_CLIP_PLANE2 0x3002 +#define GL_CLIP_PLANE3 0x3003 +#define GL_CLIP_PLANE4 0x3004 +#define GL_CLIP_PLANE5 0x3005 +#define GL_LIGHT0 0x4000 +#define GL_LIGHT1 0x4001 +#define GL_LIGHT2 0x4002 +#define GL_LIGHT3 0x4003 +#define GL_LIGHT4 0x4004 +#define GL_LIGHT5 0x4005 +#define GL_LIGHT6 0x4006 +#define GL_LIGHT7 0x4007 +#define GL_COLOR_LOGIC_OP 0x0BF2 +#define GL_POLYGON_OFFSET_UNITS 0x2A00 +#define GL_POLYGON_OFFSET_POINT 0x2A01 +#define GL_POLYGON_OFFSET_LINE 0x2A02 +#define GL_POLYGON_OFFSET_FILL 0x8037 +#define GL_POLYGON_OFFSET_FACTOR 0x8038 +#define GL_TEXTURE_BINDING_1D 0x8068 +#define GL_TEXTURE_BINDING_2D 0x8069 +#define GL_TEXTURE_INTERNAL_FORMAT 0x1003 +#define GL_TEXTURE_RED_SIZE 0x805C +#define GL_TEXTURE_GREEN_SIZE 0x805D +#define GL_TEXTURE_BLUE_SIZE 0x805E +#define GL_TEXTURE_ALPHA_SIZE 0x805F +#define GL_DOUBLE 0x140A +#define GL_PROXY_TEXTURE_1D 0x8063 +#define GL_PROXY_TEXTURE_2D 0x8064 +#define GL_R3_G3_B2 0x2A10 +#define GL_RGB4 0x804F +#define GL_RGB5 0x8050 +#define GL_RGB8 0x8051 +#define GL_RGB10 0x8052 +#define GL_RGB12 0x8053 +#define GL_RGB16 0x8054 +#define GL_RGBA2 0x8055 +#define GL_RGBA4 0x8056 +#define GL_RGB5_A1 0x8057 +#define GL_RGBA8 0x8058 +#define GL_RGB10_A2 0x8059 +#define GL_RGBA12 0x805A +#define GL_RGBA16 0x805B +#define GL_CLIENT_PIXEL_STORE_BIT 0x00000001 +#define GL_CLIENT_VERTEX_ARRAY_BIT 0x00000002 +#define GL_CLIENT_ALL_ATTRIB_BITS 0xFFFFFFFF +#define GL_VERTEX_ARRAY_POINTER 0x808E +#define GL_NORMAL_ARRAY_POINTER 0x808F +#define GL_COLOR_ARRAY_POINTER 0x8090 +#define GL_INDEX_ARRAY_POINTER 0x8091 +#define GL_TEXTURE_COORD_ARRAY_POINTER 0x8092 +#define GL_EDGE_FLAG_ARRAY_POINTER 0x8093 +#define GL_FEEDBACK_BUFFER_POINTER 0x0DF0 +#define GL_SELECTION_BUFFER_POINTER 0x0DF3 +#define GL_CLIENT_ATTRIB_STACK_DEPTH 0x0BB1 +#define GL_INDEX_LOGIC_OP 0x0BF1 +#define GL_MAX_CLIENT_ATTRIB_STACK_DEPTH 0x0D3B +#define GL_FEEDBACK_BUFFER_SIZE 0x0DF1 +#define GL_FEEDBACK_BUFFER_TYPE 0x0DF2 +#define GL_SELECTION_BUFFER_SIZE 0x0DF4 +#define GL_VERTEX_ARRAY 0x8074 +#define GL_NORMAL_ARRAY 0x8075 +#define GL_COLOR_ARRAY 0x8076 +#define GL_INDEX_ARRAY 0x8077 +#define GL_TEXTURE_COORD_ARRAY 0x8078 +#define GL_EDGE_FLAG_ARRAY 0x8079 +#define GL_VERTEX_ARRAY_SIZE 0x807A +#define GL_VERTEX_ARRAY_TYPE 0x807B +#define GL_VERTEX_ARRAY_STRIDE 0x807C +#define GL_NORMAL_ARRAY_TYPE 0x807E +#define GL_NORMAL_ARRAY_STRIDE 0x807F +#define GL_COLOR_ARRAY_SIZE 0x8081 +#define GL_COLOR_ARRAY_TYPE 0x8082 +#define GL_COLOR_ARRAY_STRIDE 0x8083 +#define GL_INDEX_ARRAY_TYPE 0x8085 +#define GL_INDEX_ARRAY_STRIDE 0x8086 +#define GL_TEXTURE_COORD_ARRAY_SIZE 0x8088 +#define GL_TEXTURE_COORD_ARRAY_TYPE 0x8089 +#define GL_TEXTURE_COORD_ARRAY_STRIDE 0x808A +#define GL_EDGE_FLAG_ARRAY_STRIDE 0x808C +#define GL_TEXTURE_LUMINANCE_SIZE 0x8060 +#define GL_TEXTURE_INTENSITY_SIZE 0x8061 +#define GL_TEXTURE_PRIORITY 0x8066 +#define GL_TEXTURE_RESIDENT 0x8067 +#define GL_ALPHA4 0x803B +#define GL_ALPHA8 0x803C +#define GL_ALPHA12 0x803D +#define GL_ALPHA16 0x803E +#define GL_LUMINANCE4 0x803F +#define GL_LUMINANCE8 0x8040 +#define GL_LUMINANCE12 0x8041 +#define GL_LUMINANCE16 0x8042 +#define GL_LUMINANCE4_ALPHA4 0x8043 +#define GL_LUMINANCE6_ALPHA2 0x8044 +#define GL_LUMINANCE8_ALPHA8 0x8045 +#define GL_LUMINANCE12_ALPHA4 0x8046 +#define GL_LUMINANCE12_ALPHA12 0x8047 +#define GL_LUMINANCE16_ALPHA16 0x8048 +#define GL_INTENSITY 0x8049 +#define GL_INTENSITY4 0x804A +#define GL_INTENSITY8 0x804B +#define GL_INTENSITY12 0x804C +#define GL_INTENSITY16 0x804D +#define GL_V2F 0x2A20 +#define GL_V3F 0x2A21 +#define GL_C4UB_V2F 0x2A22 +#define GL_C4UB_V3F 0x2A23 +#define GL_C3F_V3F 0x2A24 +#define GL_N3F_V3F 0x2A25 +#define GL_C4F_N3F_V3F 0x2A26 +#define GL_T2F_V3F 0x2A27 +#define GL_T4F_V4F 0x2A28 +#define GL_T2F_C4UB_V3F 0x2A29 +#define GL_T2F_C3F_V3F 0x2A2A +#define GL_T2F_N3F_V3F 0x2A2B +#define GL_T2F_C4F_N3F_V3F 0x2A2C +#define GL_T4F_C4F_N3F_V4F 0x2A2D +#define GL_UNSIGNED_BYTE_3_3_2 0x8032 +#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033 +#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034 +#define GL_UNSIGNED_INT_8_8_8_8 0x8035 +#define GL_UNSIGNED_INT_10_10_10_2 0x8036 +#define GL_TEXTURE_BINDING_3D 0x806A +#define GL_PACK_SKIP_IMAGES 0x806B +#define GL_PACK_IMAGE_HEIGHT 0x806C +#define GL_UNPACK_SKIP_IMAGES 0x806D +#define GL_UNPACK_IMAGE_HEIGHT 0x806E +#define GL_TEXTURE_3D 0x806F +#define GL_PROXY_TEXTURE_3D 0x8070 +#define GL_TEXTURE_DEPTH 0x8071 +#define GL_TEXTURE_WRAP_R 0x8072 +#define GL_MAX_3D_TEXTURE_SIZE 0x8073 +#define GL_UNSIGNED_BYTE_2_3_3_REV 0x8362 +#define GL_UNSIGNED_SHORT_5_6_5 0x8363 +#define GL_UNSIGNED_SHORT_5_6_5_REV 0x8364 +#define GL_UNSIGNED_SHORT_4_4_4_4_REV 0x8365 +#define GL_UNSIGNED_SHORT_1_5_5_5_REV 0x8366 +#define GL_UNSIGNED_INT_8_8_8_8_REV 0x8367 +#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368 +#define GL_BGR 0x80E0 +#define GL_BGRA 0x80E1 +#define GL_MAX_ELEMENTS_VERTICES 0x80E8 +#define GL_MAX_ELEMENTS_INDICES 0x80E9 +#define GL_CLAMP_TO_EDGE 0x812F +#define GL_TEXTURE_MIN_LOD 0x813A +#define GL_TEXTURE_MAX_LOD 0x813B +#define GL_TEXTURE_BASE_LEVEL 0x813C +#define GL_TEXTURE_MAX_LEVEL 0x813D +#define GL_SMOOTH_POINT_SIZE_RANGE 0x0B12 +#define GL_SMOOTH_POINT_SIZE_GRANULARITY 0x0B13 +#define GL_SMOOTH_LINE_WIDTH_RANGE 0x0B22 +#define GL_SMOOTH_LINE_WIDTH_GRANULARITY 0x0B23 +#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E +#define GL_RESCALE_NORMAL 0x803A +#define GL_LIGHT_MODEL_COLOR_CONTROL 0x81F8 +#define GL_SINGLE_COLOR 0x81F9 +#define GL_SEPARATE_SPECULAR_COLOR 0x81FA +#define GL_ALIASED_POINT_SIZE_RANGE 0x846D #define GL_TEXTURE0 0x84C0 #define GL_TEXTURE1 0x84C1 #define GL_TEXTURE2 0x84C2 @@ -416,507 +736,1974 @@ typedef void (APIENTRY *GLVULKANPROCNV)(void); #define GL_TEXTURE30 0x84DE #define GL_TEXTURE31 0x84DF #define GL_ACTIVE_TEXTURE 0x84E0 +#define GL_MULTISAMPLE 0x809D +#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E +#define GL_SAMPLE_ALPHA_TO_ONE 0x809F +#define GL_SAMPLE_COVERAGE 0x80A0 +#define GL_SAMPLE_BUFFERS 0x80A8 +#define GL_SAMPLES 0x80A9 +#define GL_SAMPLE_COVERAGE_VALUE 0x80AA +#define GL_SAMPLE_COVERAGE_INVERT 0x80AB +#define GL_TEXTURE_CUBE_MAP 0x8513 +#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A +#define GL_PROXY_TEXTURE_CUBE_MAP 0x851B +#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C +#define GL_COMPRESSED_RGB 0x84ED +#define GL_COMPRESSED_RGBA 0x84EE +#define GL_TEXTURE_COMPRESSION_HINT 0x84EF +#define GL_TEXTURE_COMPRESSED_IMAGE_SIZE 0x86A0 +#define GL_TEXTURE_COMPRESSED 0x86A1 +#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2 +#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3 +#define GL_CLAMP_TO_BORDER 0x812D #define GL_CLIENT_ACTIVE_TEXTURE 0x84E1 -#define GL_REPEAT 0x2901 -#define GL_CLAMP_TO_EDGE 0x812F -#define GL_LIGHT0 0x4000 -#define GL_LIGHT1 0x4001 -#define GL_LIGHT2 0x4002 -#define GL_LIGHT3 0x4003 -#define GL_LIGHT4 0x4004 -#define GL_LIGHT5 0x4005 -#define GL_LIGHT6 0x4006 -#define GL_LIGHT7 0x4007 -#define GL_ARRAY_BUFFER 0x8892 -#define GL_ELEMENT_ARRAY_BUFFER 0x8893 -#define GL_ARRAY_BUFFER_BINDING 0x8894 -#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895 -#define GL_VERTEX_ARRAY_BUFFER_BINDING 0x8896 -#define GL_NORMAL_ARRAY_BUFFER_BINDING 0x8897 -#define GL_COLOR_ARRAY_BUFFER_BINDING 0x8898 -#define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING 0x889A -#define GL_STATIC_DRAW 0x88E4 -#define GL_DYNAMIC_DRAW 0x88E8 -#define GL_BUFFER_SIZE 0x8764 -#define GL_BUFFER_USAGE 0x8765 -#define GL_SUBTRACT 0x84E7 +#define GL_MAX_TEXTURE_UNITS 0x84E2 +#define GL_TRANSPOSE_MODELVIEW_MATRIX 0x84E3 +#define GL_TRANSPOSE_PROJECTION_MATRIX 0x84E4 +#define GL_TRANSPOSE_TEXTURE_MATRIX 0x84E5 +#define GL_TRANSPOSE_COLOR_MATRIX 0x84E6 +#define GL_MULTISAMPLE_BIT 0x20000000 +#define GL_NORMAL_MAP 0x8511 +#define GL_REFLECTION_MAP 0x8512 +#define GL_COMPRESSED_ALPHA 0x84E9 +#define GL_COMPRESSED_LUMINANCE 0x84EA +#define GL_COMPRESSED_LUMINANCE_ALPHA 0x84EB +#define GL_COMPRESSED_INTENSITY 0x84EC #define GL_COMBINE 0x8570 #define GL_COMBINE_RGB 0x8571 #define GL_COMBINE_ALPHA 0x8572 -#define GL_RGB_SCALE 0x8573 -#define GL_ADD_SIGNED 0x8574 -#define GL_INTERPOLATE 0x8575 -#define GL_CONSTANT 0x8576 -#define GL_PRIMARY_COLOR 0x8577 -#define GL_PREVIOUS 0x8578 +#define GL_SOURCE0_RGB 0x8580 +#define GL_SOURCE1_RGB 0x8581 +#define GL_SOURCE2_RGB 0x8582 +#define GL_SOURCE0_ALPHA 0x8588 +#define GL_SOURCE1_ALPHA 0x8589 +#define GL_SOURCE2_ALPHA 0x858A #define GL_OPERAND0_RGB 0x8590 #define GL_OPERAND1_RGB 0x8591 #define GL_OPERAND2_RGB 0x8592 #define GL_OPERAND0_ALPHA 0x8598 #define GL_OPERAND1_ALPHA 0x8599 #define GL_OPERAND2_ALPHA 0x859A -#define GL_ALPHA_SCALE 0x0D1C +#define GL_RGB_SCALE 0x8573 +#define GL_ADD_SIGNED 0x8574 +#define GL_INTERPOLATE 0x8575 +#define GL_SUBTRACT 0x84E7 +#define GL_CONSTANT 0x8576 +#define GL_PRIMARY_COLOR 0x8577 +#define GL_PREVIOUS 0x8578 +#define GL_DOT3_RGB 0x86AE +#define GL_DOT3_RGBA 0x86AF +#define GL_BLEND_DST_RGB 0x80C8 +#define GL_BLEND_SRC_RGB 0x80C9 +#define GL_BLEND_DST_ALPHA 0x80CA +#define GL_BLEND_SRC_ALPHA 0x80CB +#define GL_POINT_FADE_THRESHOLD_SIZE 0x8128 +#define GL_DEPTH_COMPONENT16 0x81A5 +#define GL_DEPTH_COMPONENT24 0x81A6 +#define GL_DEPTH_COMPONENT32 0x81A7 +#define GL_MIRRORED_REPEAT 0x8370 +#define GL_MAX_TEXTURE_LOD_BIAS 0x84FD +#define GL_TEXTURE_LOD_BIAS 0x8501 +#define GL_INCR_WRAP 0x8507 +#define GL_DECR_WRAP 0x8508 +#define GL_TEXTURE_DEPTH_SIZE 0x884A +#define GL_TEXTURE_COMPARE_MODE 0x884C +#define GL_TEXTURE_COMPARE_FUNC 0x884D +#define GL_POINT_SIZE_MIN 0x8126 +#define GL_POINT_SIZE_MAX 0x8127 +#define GL_POINT_DISTANCE_ATTENUATION 0x8129 +#define GL_GENERATE_MIPMAP 0x8191 +#define GL_GENERATE_MIPMAP_HINT 0x8192 +#define GL_FOG_COORDINATE_SOURCE 0x8450 +#define GL_FOG_COORDINATE 0x8451 +#define GL_FRAGMENT_DEPTH 0x8452 +#define GL_CURRENT_FOG_COORDINATE 0x8453 +#define GL_FOG_COORDINATE_ARRAY_TYPE 0x8454 +#define GL_FOG_COORDINATE_ARRAY_STRIDE 0x8455 +#define GL_FOG_COORDINATE_ARRAY_POINTER 0x8456 +#define GL_FOG_COORDINATE_ARRAY 0x8457 +#define GL_COLOR_SUM 0x8458 +#define GL_CURRENT_SECONDARY_COLOR 0x8459 +#define GL_SECONDARY_COLOR_ARRAY_SIZE 0x845A +#define GL_SECONDARY_COLOR_ARRAY_TYPE 0x845B +#define GL_SECONDARY_COLOR_ARRAY_STRIDE 0x845C +#define GL_SECONDARY_COLOR_ARRAY_POINTER 0x845D +#define GL_SECONDARY_COLOR_ARRAY 0x845E +#define GL_TEXTURE_FILTER_CONTROL 0x8500 +#define GL_DEPTH_TEXTURE_MODE 0x884B +#define GL_COMPARE_R_TO_TEXTURE 0x884E +#define GL_BLEND_COLOR 0x8005 +#define GL_BLEND_EQUATION 0x8009 +#define GL_CONSTANT_COLOR 0x8001 +#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002 +#define GL_CONSTANT_ALPHA 0x8003 +#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004 +#define GL_FUNC_ADD 0x8006 +#define GL_FUNC_REVERSE_SUBTRACT 0x800B +#define GL_FUNC_SUBTRACT 0x800A +#define GL_MIN 0x8007 +#define GL_MAX 0x8008 +#define GL_BUFFER_SIZE 0x8764 +#define GL_BUFFER_USAGE 0x8765 +#define GL_QUERY_COUNTER_BITS 0x8864 +#define GL_CURRENT_QUERY 0x8865 +#define GL_QUERY_RESULT 0x8866 +#define GL_QUERY_RESULT_AVAILABLE 0x8867 +#define GL_ARRAY_BUFFER 0x8892 +#define GL_ELEMENT_ARRAY_BUFFER 0x8893 +#define GL_ARRAY_BUFFER_BINDING 0x8894 +#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895 +#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F +#define GL_READ_ONLY 0x88B8 +#define GL_WRITE_ONLY 0x88B9 +#define GL_READ_WRITE 0x88BA +#define GL_BUFFER_ACCESS 0x88BB +#define GL_BUFFER_MAPPED 0x88BC +#define GL_BUFFER_MAP_POINTER 0x88BD +#define GL_STREAM_DRAW 0x88E0 +#define GL_STREAM_READ 0x88E1 +#define GL_STREAM_COPY 0x88E2 +#define GL_STATIC_DRAW 0x88E4 +#define GL_STATIC_READ 0x88E5 +#define GL_STATIC_COPY 0x88E6 +#define GL_DYNAMIC_DRAW 0x88E8 +#define GL_DYNAMIC_READ 0x88E9 +#define GL_DYNAMIC_COPY 0x88EA +#define GL_SAMPLES_PASSED 0x8914 +#define GL_SRC1_ALPHA 0x8589 +#define GL_VERTEX_ARRAY_BUFFER_BINDING 0x8896 +#define GL_NORMAL_ARRAY_BUFFER_BINDING 0x8897 +#define GL_COLOR_ARRAY_BUFFER_BINDING 0x8898 +#define GL_INDEX_ARRAY_BUFFER_BINDING 0x8899 +#define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING 0x889A +#define GL_EDGE_FLAG_ARRAY_BUFFER_BINDING 0x889B +#define GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING 0x889C +#define GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING 0x889D +#define GL_WEIGHT_ARRAY_BUFFER_BINDING 0x889E +#define GL_FOG_COORD_SRC 0x8450 +#define GL_FOG_COORD 0x8451 +#define GL_CURRENT_FOG_COORD 0x8453 +#define GL_FOG_COORD_ARRAY_TYPE 0x8454 +#define GL_FOG_COORD_ARRAY_STRIDE 0x8455 +#define GL_FOG_COORD_ARRAY_POINTER 0x8456 +#define GL_FOG_COORD_ARRAY 0x8457 +#define GL_FOG_COORD_ARRAY_BUFFER_BINDING 0x889D #define GL_SRC0_RGB 0x8580 #define GL_SRC1_RGB 0x8581 #define GL_SRC2_RGB 0x8582 #define GL_SRC0_ALPHA 0x8588 -#define GL_SRC1_ALPHA 0x8589 #define GL_SRC2_ALPHA 0x858A -#define GL_DOT3_RGB 0x86AE -#define GL_DOT3_RGBA 0x86AF -#ifndef GL_VERSION_ES_CM_1_0 -#define GL_VERSION_ES_CM_1_0 1 -GLAPI int GLAD_GL_VERSION_ES_CM_1_0; -typedef void (APIENTRYP PFNGLALPHAFUNCPROC)(GLenum func, GLfloat ref); -GLAPI PFNGLALPHAFUNCPROC glad_glAlphaFunc; -#define glAlphaFunc glad_glAlphaFunc -typedef void (APIENTRYP PFNGLCLEARCOLORPROC)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); -GLAPI PFNGLCLEARCOLORPROC glad_glClearColor; -#define glClearColor glad_glClearColor -typedef void (APIENTRYP PFNGLCLEARDEPTHFPROC)(GLfloat d); -GLAPI PFNGLCLEARDEPTHFPROC glad_glClearDepthf; -#define glClearDepthf glad_glClearDepthf -typedef void (APIENTRYP PFNGLCLIPPLANEFPROC)(GLenum p, const GLfloat *eqn); -GLAPI PFNGLCLIPPLANEFPROC glad_glClipPlanef; -#define glClipPlanef glad_glClipPlanef -typedef void (APIENTRYP PFNGLCOLOR4FPROC)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); -GLAPI PFNGLCOLOR4FPROC glad_glColor4f; -#define glColor4f glad_glColor4f -typedef void (APIENTRYP PFNGLDEPTHRANGEFPROC)(GLfloat n, GLfloat f); -GLAPI PFNGLDEPTHRANGEFPROC glad_glDepthRangef; -#define glDepthRangef glad_glDepthRangef -typedef void (APIENTRYP PFNGLFOGFPROC)(GLenum pname, GLfloat param); -GLAPI PFNGLFOGFPROC glad_glFogf; -#define glFogf glad_glFogf -typedef void (APIENTRYP PFNGLFOGFVPROC)(GLenum pname, const GLfloat *params); -GLAPI PFNGLFOGFVPROC glad_glFogfv; -#define glFogfv glad_glFogfv -typedef void (APIENTRYP PFNGLFRUSTUMFPROC)(GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f); -GLAPI PFNGLFRUSTUMFPROC glad_glFrustumf; -#define glFrustumf glad_glFrustumf -typedef void (APIENTRYP PFNGLGETCLIPPLANEFPROC)(GLenum plane, GLfloat *equation); -GLAPI PFNGLGETCLIPPLANEFPROC glad_glGetClipPlanef; -#define glGetClipPlanef glad_glGetClipPlanef -typedef void (APIENTRYP PFNGLGETFLOATVPROC)(GLenum pname, GLfloat *data); -GLAPI PFNGLGETFLOATVPROC glad_glGetFloatv; -#define glGetFloatv glad_glGetFloatv -typedef void (APIENTRYP PFNGLGETLIGHTFVPROC)(GLenum light, GLenum pname, GLfloat *params); -GLAPI PFNGLGETLIGHTFVPROC glad_glGetLightfv; -#define glGetLightfv glad_glGetLightfv -typedef void (APIENTRYP PFNGLGETMATERIALFVPROC)(GLenum face, GLenum pname, GLfloat *params); -GLAPI PFNGLGETMATERIALFVPROC glad_glGetMaterialfv; -#define glGetMaterialfv glad_glGetMaterialfv -typedef void (APIENTRYP PFNGLGETTEXENVFVPROC)(GLenum target, GLenum pname, GLfloat *params); -GLAPI PFNGLGETTEXENVFVPROC glad_glGetTexEnvfv; -#define glGetTexEnvfv glad_glGetTexEnvfv -typedef void (APIENTRYP PFNGLGETTEXPARAMETERFVPROC)(GLenum target, GLenum pname, GLfloat *params); -GLAPI PFNGLGETTEXPARAMETERFVPROC glad_glGetTexParameterfv; -#define glGetTexParameterfv glad_glGetTexParameterfv -typedef void (APIENTRYP PFNGLLIGHTMODELFPROC)(GLenum pname, GLfloat param); -GLAPI PFNGLLIGHTMODELFPROC glad_glLightModelf; -#define glLightModelf glad_glLightModelf -typedef void (APIENTRYP PFNGLLIGHTMODELFVPROC)(GLenum pname, const GLfloat *params); -GLAPI PFNGLLIGHTMODELFVPROC glad_glLightModelfv; -#define glLightModelfv glad_glLightModelfv -typedef void (APIENTRYP PFNGLLIGHTFPROC)(GLenum light, GLenum pname, GLfloat param); -GLAPI PFNGLLIGHTFPROC glad_glLightf; -#define glLightf glad_glLightf -typedef void (APIENTRYP PFNGLLIGHTFVPROC)(GLenum light, GLenum pname, const GLfloat *params); -GLAPI PFNGLLIGHTFVPROC glad_glLightfv; -#define glLightfv glad_glLightfv +#define GL_BLEND_EQUATION_RGB 0x8009 +#define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622 +#define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623 +#define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624 +#define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625 +#define GL_CURRENT_VERTEX_ATTRIB 0x8626 +#define GL_VERTEX_PROGRAM_POINT_SIZE 0x8642 +#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645 +#define GL_STENCIL_BACK_FUNC 0x8800 +#define GL_STENCIL_BACK_FAIL 0x8801 +#define GL_STENCIL_BACK_PASS_DEPTH_FAIL 0x8802 +#define GL_STENCIL_BACK_PASS_DEPTH_PASS 0x8803 +#define GL_MAX_DRAW_BUFFERS 0x8824 +#define GL_DRAW_BUFFER0 0x8825 +#define GL_DRAW_BUFFER1 0x8826 +#define GL_DRAW_BUFFER2 0x8827 +#define GL_DRAW_BUFFER3 0x8828 +#define GL_DRAW_BUFFER4 0x8829 +#define GL_DRAW_BUFFER5 0x882A +#define GL_DRAW_BUFFER6 0x882B +#define GL_DRAW_BUFFER7 0x882C +#define GL_DRAW_BUFFER8 0x882D +#define GL_DRAW_BUFFER9 0x882E +#define GL_DRAW_BUFFER10 0x882F +#define GL_DRAW_BUFFER11 0x8830 +#define GL_DRAW_BUFFER12 0x8831 +#define GL_DRAW_BUFFER13 0x8832 +#define GL_DRAW_BUFFER14 0x8833 +#define GL_DRAW_BUFFER15 0x8834 +#define GL_BLEND_EQUATION_ALPHA 0x883D +#define GL_MAX_VERTEX_ATTRIBS 0x8869 +#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A +#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872 +#define GL_FRAGMENT_SHADER 0x8B30 +#define GL_VERTEX_SHADER 0x8B31 +#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS 0x8B49 +#define GL_MAX_VERTEX_UNIFORM_COMPONENTS 0x8B4A +#define GL_MAX_VARYING_FLOATS 0x8B4B +#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C +#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D +#define GL_SHADER_TYPE 0x8B4F +#define GL_FLOAT_VEC2 0x8B50 +#define GL_FLOAT_VEC3 0x8B51 +#define GL_FLOAT_VEC4 0x8B52 +#define GL_INT_VEC2 0x8B53 +#define GL_INT_VEC3 0x8B54 +#define GL_INT_VEC4 0x8B55 +#define GL_BOOL 0x8B56 +#define GL_BOOL_VEC2 0x8B57 +#define GL_BOOL_VEC3 0x8B58 +#define GL_BOOL_VEC4 0x8B59 +#define GL_FLOAT_MAT2 0x8B5A +#define GL_FLOAT_MAT3 0x8B5B +#define GL_FLOAT_MAT4 0x8B5C +#define GL_SAMPLER_1D 0x8B5D +#define GL_SAMPLER_2D 0x8B5E +#define GL_SAMPLER_3D 0x8B5F +#define GL_SAMPLER_CUBE 0x8B60 +#define GL_SAMPLER_1D_SHADOW 0x8B61 +#define GL_SAMPLER_2D_SHADOW 0x8B62 +#define GL_DELETE_STATUS 0x8B80 +#define GL_COMPILE_STATUS 0x8B81 +#define GL_LINK_STATUS 0x8B82 +#define GL_VALIDATE_STATUS 0x8B83 +#define GL_INFO_LOG_LENGTH 0x8B84 +#define GL_ATTACHED_SHADERS 0x8B85 +#define GL_ACTIVE_UNIFORMS 0x8B86 +#define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87 +#define GL_SHADER_SOURCE_LENGTH 0x8B88 +#define GL_ACTIVE_ATTRIBUTES 0x8B89 +#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A +#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT 0x8B8B +#define GL_SHADING_LANGUAGE_VERSION 0x8B8C +#define GL_CURRENT_PROGRAM 0x8B8D +#define GL_POINT_SPRITE_COORD_ORIGIN 0x8CA0 +#define GL_LOWER_LEFT 0x8CA1 +#define GL_UPPER_LEFT 0x8CA2 +#define GL_STENCIL_BACK_REF 0x8CA3 +#define GL_STENCIL_BACK_VALUE_MASK 0x8CA4 +#define GL_STENCIL_BACK_WRITEMASK 0x8CA5 +#define GL_VERTEX_PROGRAM_TWO_SIDE 0x8643 +#define GL_POINT_SPRITE 0x8861 +#define GL_COORD_REPLACE 0x8862 +#define GL_MAX_TEXTURE_COORDS 0x8871 +#define GL_PIXEL_PACK_BUFFER 0x88EB +#define GL_PIXEL_UNPACK_BUFFER 0x88EC +#define GL_PIXEL_PACK_BUFFER_BINDING 0x88ED +#define GL_PIXEL_UNPACK_BUFFER_BINDING 0x88EF +#define GL_FLOAT_MAT2x3 0x8B65 +#define GL_FLOAT_MAT2x4 0x8B66 +#define GL_FLOAT_MAT3x2 0x8B67 +#define GL_FLOAT_MAT3x4 0x8B68 +#define GL_FLOAT_MAT4x2 0x8B69 +#define GL_FLOAT_MAT4x3 0x8B6A +#define GL_SRGB 0x8C40 +#define GL_SRGB8 0x8C41 +#define GL_SRGB_ALPHA 0x8C42 +#define GL_SRGB8_ALPHA8 0x8C43 +#define GL_COMPRESSED_SRGB 0x8C48 +#define GL_COMPRESSED_SRGB_ALPHA 0x8C49 +#define GL_CURRENT_RASTER_SECONDARY_COLOR 0x845F +#define GL_SLUMINANCE_ALPHA 0x8C44 +#define GL_SLUMINANCE8_ALPHA8 0x8C45 +#define GL_SLUMINANCE 0x8C46 +#define GL_SLUMINANCE8 0x8C47 +#define GL_COMPRESSED_SLUMINANCE 0x8C4A +#define GL_COMPRESSED_SLUMINANCE_ALPHA 0x8C4B +#ifndef GL_VERSION_1_0 +#define GL_VERSION_1_0 1 +GLAPI int GLAD_GL_VERSION_1_0; +typedef void (APIENTRYP PFNGLCULLFACEPROC)(GLenum mode); +GLAPI PFNGLCULLFACEPROC glad_glCullFace; +#define glCullFace glad_glCullFace +typedef void (APIENTRYP PFNGLFRONTFACEPROC)(GLenum mode); +GLAPI PFNGLFRONTFACEPROC glad_glFrontFace; +#define glFrontFace glad_glFrontFace +typedef void (APIENTRYP PFNGLHINTPROC)(GLenum target, GLenum mode); +GLAPI PFNGLHINTPROC glad_glHint; +#define glHint glad_glHint typedef void (APIENTRYP PFNGLLINEWIDTHPROC)(GLfloat width); GLAPI PFNGLLINEWIDTHPROC glad_glLineWidth; #define glLineWidth glad_glLineWidth -typedef void (APIENTRYP PFNGLLOADMATRIXFPROC)(const GLfloat *m); -GLAPI PFNGLLOADMATRIXFPROC glad_glLoadMatrixf; -#define glLoadMatrixf glad_glLoadMatrixf -typedef void (APIENTRYP PFNGLMATERIALFPROC)(GLenum face, GLenum pname, GLfloat param); -GLAPI PFNGLMATERIALFPROC glad_glMaterialf; -#define glMaterialf glad_glMaterialf -typedef void (APIENTRYP PFNGLMATERIALFVPROC)(GLenum face, GLenum pname, const GLfloat *params); -GLAPI PFNGLMATERIALFVPROC glad_glMaterialfv; -#define glMaterialfv glad_glMaterialfv -typedef void (APIENTRYP PFNGLMULTMATRIXFPROC)(const GLfloat *m); -GLAPI PFNGLMULTMATRIXFPROC glad_glMultMatrixf; -#define glMultMatrixf glad_glMultMatrixf -typedef void (APIENTRYP PFNGLMULTITEXCOORD4FPROC)(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); -GLAPI PFNGLMULTITEXCOORD4FPROC glad_glMultiTexCoord4f; -#define glMultiTexCoord4f glad_glMultiTexCoord4f -typedef void (APIENTRYP PFNGLNORMAL3FPROC)(GLfloat nx, GLfloat ny, GLfloat nz); -GLAPI PFNGLNORMAL3FPROC glad_glNormal3f; -#define glNormal3f glad_glNormal3f -typedef void (APIENTRYP PFNGLORTHOFPROC)(GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f); -GLAPI PFNGLORTHOFPROC glad_glOrthof; -#define glOrthof glad_glOrthof -typedef void (APIENTRYP PFNGLPOINTPARAMETERFPROC)(GLenum pname, GLfloat param); -GLAPI PFNGLPOINTPARAMETERFPROC glad_glPointParameterf; -#define glPointParameterf glad_glPointParameterf -typedef void (APIENTRYP PFNGLPOINTPARAMETERFVPROC)(GLenum pname, const GLfloat *params); -GLAPI PFNGLPOINTPARAMETERFVPROC glad_glPointParameterfv; -#define glPointParameterfv glad_glPointParameterfv typedef void (APIENTRYP PFNGLPOINTSIZEPROC)(GLfloat size); GLAPI PFNGLPOINTSIZEPROC glad_glPointSize; #define glPointSize glad_glPointSize -typedef void (APIENTRYP PFNGLPOLYGONOFFSETPROC)(GLfloat factor, GLfloat units); -GLAPI PFNGLPOLYGONOFFSETPROC glad_glPolygonOffset; -#define glPolygonOffset glad_glPolygonOffset -typedef void (APIENTRYP PFNGLROTATEFPROC)(GLfloat angle, GLfloat x, GLfloat y, GLfloat z); -GLAPI PFNGLROTATEFPROC glad_glRotatef; -#define glRotatef glad_glRotatef -typedef void (APIENTRYP PFNGLSCALEFPROC)(GLfloat x, GLfloat y, GLfloat z); -GLAPI PFNGLSCALEFPROC glad_glScalef; -#define glScalef glad_glScalef -typedef void (APIENTRYP PFNGLTEXENVFPROC)(GLenum target, GLenum pname, GLfloat param); -GLAPI PFNGLTEXENVFPROC glad_glTexEnvf; -#define glTexEnvf glad_glTexEnvf -typedef void (APIENTRYP PFNGLTEXENVFVPROC)(GLenum target, GLenum pname, const GLfloat *params); -GLAPI PFNGLTEXENVFVPROC glad_glTexEnvfv; -#define glTexEnvfv glad_glTexEnvfv +typedef void (APIENTRYP PFNGLPOLYGONMODEPROC)(GLenum face, GLenum mode); +GLAPI PFNGLPOLYGONMODEPROC glad_glPolygonMode; +#define glPolygonMode glad_glPolygonMode +typedef void (APIENTRYP PFNGLSCISSORPROC)(GLint x, GLint y, GLsizei width, GLsizei height); +GLAPI PFNGLSCISSORPROC glad_glScissor; +#define glScissor glad_glScissor typedef void (APIENTRYP PFNGLTEXPARAMETERFPROC)(GLenum target, GLenum pname, GLfloat param); GLAPI PFNGLTEXPARAMETERFPROC glad_glTexParameterf; #define glTexParameterf glad_glTexParameterf typedef void (APIENTRYP PFNGLTEXPARAMETERFVPROC)(GLenum target, GLenum pname, const GLfloat *params); GLAPI PFNGLTEXPARAMETERFVPROC glad_glTexParameterfv; #define glTexParameterfv glad_glTexParameterfv -typedef void (APIENTRYP PFNGLTRANSLATEFPROC)(GLfloat x, GLfloat y, GLfloat z); -GLAPI PFNGLTRANSLATEFPROC glad_glTranslatef; -#define glTranslatef glad_glTranslatef -typedef void (APIENTRYP PFNGLACTIVETEXTUREPROC)(GLenum texture); -GLAPI PFNGLACTIVETEXTUREPROC glad_glActiveTexture; -#define glActiveTexture glad_glActiveTexture -typedef void (APIENTRYP PFNGLALPHAFUNCXPROC)(GLenum func, GLfixed ref); -GLAPI PFNGLALPHAFUNCXPROC glad_glAlphaFuncx; -#define glAlphaFuncx glad_glAlphaFuncx -typedef void (APIENTRYP PFNGLBINDBUFFERPROC)(GLenum target, GLuint buffer); -GLAPI PFNGLBINDBUFFERPROC glad_glBindBuffer; -#define glBindBuffer glad_glBindBuffer -typedef void (APIENTRYP PFNGLBINDTEXTUREPROC)(GLenum target, GLuint texture); -GLAPI PFNGLBINDTEXTUREPROC glad_glBindTexture; -#define glBindTexture glad_glBindTexture -typedef void (APIENTRYP PFNGLBLENDFUNCPROC)(GLenum sfactor, GLenum dfactor); -GLAPI PFNGLBLENDFUNCPROC glad_glBlendFunc; -#define glBlendFunc glad_glBlendFunc -typedef void (APIENTRYP PFNGLBUFFERDATAPROC)(GLenum target, GLsizeiptr size, const void *data, GLenum usage); -GLAPI PFNGLBUFFERDATAPROC glad_glBufferData; -#define glBufferData glad_glBufferData -typedef void (APIENTRYP PFNGLBUFFERSUBDATAPROC)(GLenum target, GLintptr offset, GLsizeiptr size, const void *data); -GLAPI PFNGLBUFFERSUBDATAPROC glad_glBufferSubData; -#define glBufferSubData glad_glBufferSubData +typedef void (APIENTRYP PFNGLTEXPARAMETERIPROC)(GLenum target, GLenum pname, GLint param); +GLAPI PFNGLTEXPARAMETERIPROC glad_glTexParameteri; +#define glTexParameteri glad_glTexParameteri +typedef void (APIENTRYP PFNGLTEXPARAMETERIVPROC)(GLenum target, GLenum pname, const GLint *params); +GLAPI PFNGLTEXPARAMETERIVPROC glad_glTexParameteriv; +#define glTexParameteriv glad_glTexParameteriv +typedef void (APIENTRYP PFNGLTEXIMAGE1DPROC)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const void *pixels); +GLAPI PFNGLTEXIMAGE1DPROC glad_glTexImage1D; +#define glTexImage1D glad_glTexImage1D +typedef void (APIENTRYP PFNGLTEXIMAGE2DPROC)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels); +GLAPI PFNGLTEXIMAGE2DPROC glad_glTexImage2D; +#define glTexImage2D glad_glTexImage2D +typedef void (APIENTRYP PFNGLDRAWBUFFERPROC)(GLenum buf); +GLAPI PFNGLDRAWBUFFERPROC glad_glDrawBuffer; +#define glDrawBuffer glad_glDrawBuffer typedef void (APIENTRYP PFNGLCLEARPROC)(GLbitfield mask); GLAPI PFNGLCLEARPROC glad_glClear; #define glClear glad_glClear -typedef void (APIENTRYP PFNGLCLEARCOLORXPROC)(GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha); -GLAPI PFNGLCLEARCOLORXPROC glad_glClearColorx; -#define glClearColorx glad_glClearColorx -typedef void (APIENTRYP PFNGLCLEARDEPTHXPROC)(GLfixed depth); -GLAPI PFNGLCLEARDEPTHXPROC glad_glClearDepthx; -#define glClearDepthx glad_glClearDepthx +typedef void (APIENTRYP PFNGLCLEARCOLORPROC)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); +GLAPI PFNGLCLEARCOLORPROC glad_glClearColor; +#define glClearColor glad_glClearColor typedef void (APIENTRYP PFNGLCLEARSTENCILPROC)(GLint s); GLAPI PFNGLCLEARSTENCILPROC glad_glClearStencil; #define glClearStencil glad_glClearStencil -typedef void (APIENTRYP PFNGLCLIENTACTIVETEXTUREPROC)(GLenum texture); -GLAPI PFNGLCLIENTACTIVETEXTUREPROC glad_glClientActiveTexture; -#define glClientActiveTexture glad_glClientActiveTexture -typedef void (APIENTRYP PFNGLCLIPPLANEXPROC)(GLenum plane, const GLfixed *equation); -GLAPI PFNGLCLIPPLANEXPROC glad_glClipPlanex; -#define glClipPlanex glad_glClipPlanex -typedef void (APIENTRYP PFNGLCOLOR4UBPROC)(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha); -GLAPI PFNGLCOLOR4UBPROC glad_glColor4ub; -#define glColor4ub glad_glColor4ub -typedef void (APIENTRYP PFNGLCOLOR4XPROC)(GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha); -GLAPI PFNGLCOLOR4XPROC glad_glColor4x; -#define glColor4x glad_glColor4x +typedef void (APIENTRYP PFNGLCLEARDEPTHPROC)(GLdouble depth); +GLAPI PFNGLCLEARDEPTHPROC glad_glClearDepth; +#define glClearDepth glad_glClearDepth +typedef void (APIENTRYP PFNGLSTENCILMASKPROC)(GLuint mask); +GLAPI PFNGLSTENCILMASKPROC glad_glStencilMask; +#define glStencilMask glad_glStencilMask typedef void (APIENTRYP PFNGLCOLORMASKPROC)(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); GLAPI PFNGLCOLORMASKPROC glad_glColorMask; #define glColorMask glad_glColorMask -typedef void (APIENTRYP PFNGLCOLORPOINTERPROC)(GLint size, GLenum type, GLsizei stride, const void *pointer); -GLAPI PFNGLCOLORPOINTERPROC glad_glColorPointer; -#define glColorPointer glad_glColorPointer -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DPROC)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data); -GLAPI PFNGLCOMPRESSEDTEXIMAGE2DPROC glad_glCompressedTexImage2D; -#define glCompressedTexImage2D glad_glCompressedTexImage2D -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data); -GLAPI PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC glad_glCompressedTexSubImage2D; -#define glCompressedTexSubImage2D glad_glCompressedTexSubImage2D -typedef void (APIENTRYP PFNGLCOPYTEXIMAGE2DPROC)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); -GLAPI PFNGLCOPYTEXIMAGE2DPROC glad_glCopyTexImage2D; -#define glCopyTexImage2D glad_glCopyTexImage2D -typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE2DPROC)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); -GLAPI PFNGLCOPYTEXSUBIMAGE2DPROC glad_glCopyTexSubImage2D; -#define glCopyTexSubImage2D glad_glCopyTexSubImage2D -typedef void (APIENTRYP PFNGLCULLFACEPROC)(GLenum mode); -GLAPI PFNGLCULLFACEPROC glad_glCullFace; -#define glCullFace glad_glCullFace -typedef void (APIENTRYP PFNGLDELETEBUFFERSPROC)(GLsizei n, const GLuint *buffers); -GLAPI PFNGLDELETEBUFFERSPROC glad_glDeleteBuffers; -#define glDeleteBuffers glad_glDeleteBuffers -typedef void (APIENTRYP PFNGLDELETETEXTURESPROC)(GLsizei n, const GLuint *textures); -GLAPI PFNGLDELETETEXTURESPROC glad_glDeleteTextures; -#define glDeleteTextures glad_glDeleteTextures -typedef void (APIENTRYP PFNGLDEPTHFUNCPROC)(GLenum func); -GLAPI PFNGLDEPTHFUNCPROC glad_glDepthFunc; -#define glDepthFunc glad_glDepthFunc typedef void (APIENTRYP PFNGLDEPTHMASKPROC)(GLboolean flag); GLAPI PFNGLDEPTHMASKPROC glad_glDepthMask; #define glDepthMask glad_glDepthMask -typedef void (APIENTRYP PFNGLDEPTHRANGEXPROC)(GLfixed n, GLfixed f); -GLAPI PFNGLDEPTHRANGEXPROC glad_glDepthRangex; -#define glDepthRangex glad_glDepthRangex typedef void (APIENTRYP PFNGLDISABLEPROC)(GLenum cap); GLAPI PFNGLDISABLEPROC glad_glDisable; #define glDisable glad_glDisable -typedef void (APIENTRYP PFNGLDISABLECLIENTSTATEPROC)(GLenum array); -GLAPI PFNGLDISABLECLIENTSTATEPROC glad_glDisableClientState; -#define glDisableClientState glad_glDisableClientState -typedef void (APIENTRYP PFNGLDRAWARRAYSPROC)(GLenum mode, GLint first, GLsizei count); -GLAPI PFNGLDRAWARRAYSPROC glad_glDrawArrays; -#define glDrawArrays glad_glDrawArrays -typedef void (APIENTRYP PFNGLDRAWELEMENTSPROC)(GLenum mode, GLsizei count, GLenum type, const void *indices); -GLAPI PFNGLDRAWELEMENTSPROC glad_glDrawElements; -#define glDrawElements glad_glDrawElements typedef void (APIENTRYP PFNGLENABLEPROC)(GLenum cap); GLAPI PFNGLENABLEPROC glad_glEnable; #define glEnable glad_glEnable -typedef void (APIENTRYP PFNGLENABLECLIENTSTATEPROC)(GLenum array); -GLAPI PFNGLENABLECLIENTSTATEPROC glad_glEnableClientState; -#define glEnableClientState glad_glEnableClientState typedef void (APIENTRYP PFNGLFINISHPROC)(void); GLAPI PFNGLFINISHPROC glad_glFinish; #define glFinish glad_glFinish typedef void (APIENTRYP PFNGLFLUSHPROC)(void); GLAPI PFNGLFLUSHPROC glad_glFlush; #define glFlush glad_glFlush -typedef void (APIENTRYP PFNGLFOGXPROC)(GLenum pname, GLfixed param); -GLAPI PFNGLFOGXPROC glad_glFogx; -#define glFogx glad_glFogx -typedef void (APIENTRYP PFNGLFOGXVPROC)(GLenum pname, const GLfixed *param); -GLAPI PFNGLFOGXVPROC glad_glFogxv; -#define glFogxv glad_glFogxv -typedef void (APIENTRYP PFNGLFRONTFACEPROC)(GLenum mode); -GLAPI PFNGLFRONTFACEPROC glad_glFrontFace; -#define glFrontFace glad_glFrontFace -typedef void (APIENTRYP PFNGLFRUSTUMXPROC)(GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, GLfixed f); -GLAPI PFNGLFRUSTUMXPROC glad_glFrustumx; -#define glFrustumx glad_glFrustumx -typedef void (APIENTRYP PFNGLGETBOOLEANVPROC)(GLenum pname, GLboolean *data); -GLAPI PFNGLGETBOOLEANVPROC glad_glGetBooleanv; -#define glGetBooleanv glad_glGetBooleanv -typedef void (APIENTRYP PFNGLGETBUFFERPARAMETERIVPROC)(GLenum target, GLenum pname, GLint *params); -GLAPI PFNGLGETBUFFERPARAMETERIVPROC glad_glGetBufferParameteriv; -#define glGetBufferParameteriv glad_glGetBufferParameteriv -typedef void (APIENTRYP PFNGLGETCLIPPLANEXPROC)(GLenum plane, GLfixed *equation); -GLAPI PFNGLGETCLIPPLANEXPROC glad_glGetClipPlanex; -#define glGetClipPlanex glad_glGetClipPlanex -typedef void (APIENTRYP PFNGLGENBUFFERSPROC)(GLsizei n, GLuint *buffers); -GLAPI PFNGLGENBUFFERSPROC glad_glGenBuffers; -#define glGenBuffers glad_glGenBuffers -typedef void (APIENTRYP PFNGLGENTEXTURESPROC)(GLsizei n, GLuint *textures); -GLAPI PFNGLGENTEXTURESPROC glad_glGenTextures; -#define glGenTextures glad_glGenTextures -typedef GLenum (APIENTRYP PFNGLGETERRORPROC)(void); -GLAPI PFNGLGETERRORPROC glad_glGetError; -#define glGetError glad_glGetError -typedef void (APIENTRYP PFNGLGETFIXEDVPROC)(GLenum pname, GLfixed *params); -GLAPI PFNGLGETFIXEDVPROC glad_glGetFixedv; -#define glGetFixedv glad_glGetFixedv -typedef void (APIENTRYP PFNGLGETINTEGERVPROC)(GLenum pname, GLint *data); -GLAPI PFNGLGETINTEGERVPROC glad_glGetIntegerv; -#define glGetIntegerv glad_glGetIntegerv -typedef void (APIENTRYP PFNGLGETLIGHTXVPROC)(GLenum light, GLenum pname, GLfixed *params); -GLAPI PFNGLGETLIGHTXVPROC glad_glGetLightxv; -#define glGetLightxv glad_glGetLightxv -typedef void (APIENTRYP PFNGLGETMATERIALXVPROC)(GLenum face, GLenum pname, GLfixed *params); -GLAPI PFNGLGETMATERIALXVPROC glad_glGetMaterialxv; -#define glGetMaterialxv glad_glGetMaterialxv -typedef void (APIENTRYP PFNGLGETPOINTERVPROC)(GLenum pname, void **params); -GLAPI PFNGLGETPOINTERVPROC glad_glGetPointerv; -#define glGetPointerv glad_glGetPointerv -typedef const GLubyte * (APIENTRYP PFNGLGETSTRINGPROC)(GLenum name); -GLAPI PFNGLGETSTRINGPROC glad_glGetString; -#define glGetString glad_glGetString -typedef void (APIENTRYP PFNGLGETTEXENVIVPROC)(GLenum target, GLenum pname, GLint *params); -GLAPI PFNGLGETTEXENVIVPROC glad_glGetTexEnviv; -#define glGetTexEnviv glad_glGetTexEnviv -typedef void (APIENTRYP PFNGLGETTEXENVXVPROC)(GLenum target, GLenum pname, GLfixed *params); -GLAPI PFNGLGETTEXENVXVPROC glad_glGetTexEnvxv; -#define glGetTexEnvxv glad_glGetTexEnvxv -typedef void (APIENTRYP PFNGLGETTEXPARAMETERIVPROC)(GLenum target, GLenum pname, GLint *params); -GLAPI PFNGLGETTEXPARAMETERIVPROC glad_glGetTexParameteriv; -#define glGetTexParameteriv glad_glGetTexParameteriv -typedef void (APIENTRYP PFNGLGETTEXPARAMETERXVPROC)(GLenum target, GLenum pname, GLfixed *params); -GLAPI PFNGLGETTEXPARAMETERXVPROC glad_glGetTexParameterxv; -#define glGetTexParameterxv glad_glGetTexParameterxv -typedef void (APIENTRYP PFNGLHINTPROC)(GLenum target, GLenum mode); -GLAPI PFNGLHINTPROC glad_glHint; -#define glHint glad_glHint -typedef GLboolean (APIENTRYP PFNGLISBUFFERPROC)(GLuint buffer); -GLAPI PFNGLISBUFFERPROC glad_glIsBuffer; -#define glIsBuffer glad_glIsBuffer -typedef GLboolean (APIENTRYP PFNGLISENABLEDPROC)(GLenum cap); -GLAPI PFNGLISENABLEDPROC glad_glIsEnabled; -#define glIsEnabled glad_glIsEnabled -typedef GLboolean (APIENTRYP PFNGLISTEXTUREPROC)(GLuint texture); -GLAPI PFNGLISTEXTUREPROC glad_glIsTexture; -#define glIsTexture glad_glIsTexture -typedef void (APIENTRYP PFNGLLIGHTMODELXPROC)(GLenum pname, GLfixed param); -GLAPI PFNGLLIGHTMODELXPROC glad_glLightModelx; -#define glLightModelx glad_glLightModelx -typedef void (APIENTRYP PFNGLLIGHTMODELXVPROC)(GLenum pname, const GLfixed *param); -GLAPI PFNGLLIGHTMODELXVPROC glad_glLightModelxv; -#define glLightModelxv glad_glLightModelxv -typedef void (APIENTRYP PFNGLLIGHTXPROC)(GLenum light, GLenum pname, GLfixed param); -GLAPI PFNGLLIGHTXPROC glad_glLightx; -#define glLightx glad_glLightx -typedef void (APIENTRYP PFNGLLIGHTXVPROC)(GLenum light, GLenum pname, const GLfixed *params); -GLAPI PFNGLLIGHTXVPROC glad_glLightxv; -#define glLightxv glad_glLightxv -typedef void (APIENTRYP PFNGLLINEWIDTHXPROC)(GLfixed width); -GLAPI PFNGLLINEWIDTHXPROC glad_glLineWidthx; -#define glLineWidthx glad_glLineWidthx -typedef void (APIENTRYP PFNGLLOADIDENTITYPROC)(void); -GLAPI PFNGLLOADIDENTITYPROC glad_glLoadIdentity; -#define glLoadIdentity glad_glLoadIdentity -typedef void (APIENTRYP PFNGLLOADMATRIXXPROC)(const GLfixed *m); -GLAPI PFNGLLOADMATRIXXPROC glad_glLoadMatrixx; -#define glLoadMatrixx glad_glLoadMatrixx +typedef void (APIENTRYP PFNGLBLENDFUNCPROC)(GLenum sfactor, GLenum dfactor); +GLAPI PFNGLBLENDFUNCPROC glad_glBlendFunc; +#define glBlendFunc glad_glBlendFunc typedef void (APIENTRYP PFNGLLOGICOPPROC)(GLenum opcode); GLAPI PFNGLLOGICOPPROC glad_glLogicOp; #define glLogicOp glad_glLogicOp -typedef void (APIENTRYP PFNGLMATERIALXPROC)(GLenum face, GLenum pname, GLfixed param); -GLAPI PFNGLMATERIALXPROC glad_glMaterialx; -#define glMaterialx glad_glMaterialx -typedef void (APIENTRYP PFNGLMATERIALXVPROC)(GLenum face, GLenum pname, const GLfixed *param); -GLAPI PFNGLMATERIALXVPROC glad_glMaterialxv; -#define glMaterialxv glad_glMaterialxv -typedef void (APIENTRYP PFNGLMATRIXMODEPROC)(GLenum mode); -GLAPI PFNGLMATRIXMODEPROC glad_glMatrixMode; -#define glMatrixMode glad_glMatrixMode -typedef void (APIENTRYP PFNGLMULTMATRIXXPROC)(const GLfixed *m); -GLAPI PFNGLMULTMATRIXXPROC glad_glMultMatrixx; -#define glMultMatrixx glad_glMultMatrixx -typedef void (APIENTRYP PFNGLMULTITEXCOORD4XPROC)(GLenum texture, GLfixed s, GLfixed t, GLfixed r, GLfixed q); -GLAPI PFNGLMULTITEXCOORD4XPROC glad_glMultiTexCoord4x; -#define glMultiTexCoord4x glad_glMultiTexCoord4x -typedef void (APIENTRYP PFNGLNORMAL3XPROC)(GLfixed nx, GLfixed ny, GLfixed nz); -GLAPI PFNGLNORMAL3XPROC glad_glNormal3x; -#define glNormal3x glad_glNormal3x -typedef void (APIENTRYP PFNGLNORMALPOINTERPROC)(GLenum type, GLsizei stride, const void *pointer); -GLAPI PFNGLNORMALPOINTERPROC glad_glNormalPointer; -#define glNormalPointer glad_glNormalPointer -typedef void (APIENTRYP PFNGLORTHOXPROC)(GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, GLfixed f); -GLAPI PFNGLORTHOXPROC glad_glOrthox; -#define glOrthox glad_glOrthox +typedef void (APIENTRYP PFNGLSTENCILFUNCPROC)(GLenum func, GLint ref, GLuint mask); +GLAPI PFNGLSTENCILFUNCPROC glad_glStencilFunc; +#define glStencilFunc glad_glStencilFunc +typedef void (APIENTRYP PFNGLSTENCILOPPROC)(GLenum fail, GLenum zfail, GLenum zpass); +GLAPI PFNGLSTENCILOPPROC glad_glStencilOp; +#define glStencilOp glad_glStencilOp +typedef void (APIENTRYP PFNGLDEPTHFUNCPROC)(GLenum func); +GLAPI PFNGLDEPTHFUNCPROC glad_glDepthFunc; +#define glDepthFunc glad_glDepthFunc +typedef void (APIENTRYP PFNGLPIXELSTOREFPROC)(GLenum pname, GLfloat param); +GLAPI PFNGLPIXELSTOREFPROC glad_glPixelStoref; +#define glPixelStoref glad_glPixelStoref typedef void (APIENTRYP PFNGLPIXELSTOREIPROC)(GLenum pname, GLint param); GLAPI PFNGLPIXELSTOREIPROC glad_glPixelStorei; #define glPixelStorei glad_glPixelStorei -typedef void (APIENTRYP PFNGLPOINTPARAMETERXPROC)(GLenum pname, GLfixed param); -GLAPI PFNGLPOINTPARAMETERXPROC glad_glPointParameterx; -#define glPointParameterx glad_glPointParameterx -typedef void (APIENTRYP PFNGLPOINTPARAMETERXVPROC)(GLenum pname, const GLfixed *params); -GLAPI PFNGLPOINTPARAMETERXVPROC glad_glPointParameterxv; -#define glPointParameterxv glad_glPointParameterxv -typedef void (APIENTRYP PFNGLPOINTSIZEXPROC)(GLfixed size); -GLAPI PFNGLPOINTSIZEXPROC glad_glPointSizex; -#define glPointSizex glad_glPointSizex -typedef void (APIENTRYP PFNGLPOLYGONOFFSETXPROC)(GLfixed factor, GLfixed units); -GLAPI PFNGLPOLYGONOFFSETXPROC glad_glPolygonOffsetx; -#define glPolygonOffsetx glad_glPolygonOffsetx +typedef void (APIENTRYP PFNGLREADBUFFERPROC)(GLenum src); +GLAPI PFNGLREADBUFFERPROC glad_glReadBuffer; +#define glReadBuffer glad_glReadBuffer +typedef void (APIENTRYP PFNGLREADPIXELSPROC)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels); +GLAPI PFNGLREADPIXELSPROC glad_glReadPixels; +#define glReadPixels glad_glReadPixels +typedef void (APIENTRYP PFNGLGETBOOLEANVPROC)(GLenum pname, GLboolean *data); +GLAPI PFNGLGETBOOLEANVPROC glad_glGetBooleanv; +#define glGetBooleanv glad_glGetBooleanv +typedef void (APIENTRYP PFNGLGETDOUBLEVPROC)(GLenum pname, GLdouble *data); +GLAPI PFNGLGETDOUBLEVPROC glad_glGetDoublev; +#define glGetDoublev glad_glGetDoublev +typedef GLenum (APIENTRYP PFNGLGETERRORPROC)(void); +GLAPI PFNGLGETERRORPROC glad_glGetError; +#define glGetError glad_glGetError +typedef void (APIENTRYP PFNGLGETFLOATVPROC)(GLenum pname, GLfloat *data); +GLAPI PFNGLGETFLOATVPROC glad_glGetFloatv; +#define glGetFloatv glad_glGetFloatv +typedef void (APIENTRYP PFNGLGETINTEGERVPROC)(GLenum pname, GLint *data); +GLAPI PFNGLGETINTEGERVPROC glad_glGetIntegerv; +#define glGetIntegerv glad_glGetIntegerv +typedef const GLubyte * (APIENTRYP PFNGLGETSTRINGPROC)(GLenum name); +GLAPI PFNGLGETSTRINGPROC glad_glGetString; +#define glGetString glad_glGetString +typedef void (APIENTRYP PFNGLGETTEXIMAGEPROC)(GLenum target, GLint level, GLenum format, GLenum type, void *pixels); +GLAPI PFNGLGETTEXIMAGEPROC glad_glGetTexImage; +#define glGetTexImage glad_glGetTexImage +typedef void (APIENTRYP PFNGLGETTEXPARAMETERFVPROC)(GLenum target, GLenum pname, GLfloat *params); +GLAPI PFNGLGETTEXPARAMETERFVPROC glad_glGetTexParameterfv; +#define glGetTexParameterfv glad_glGetTexParameterfv +typedef void (APIENTRYP PFNGLGETTEXPARAMETERIVPROC)(GLenum target, GLenum pname, GLint *params); +GLAPI PFNGLGETTEXPARAMETERIVPROC glad_glGetTexParameteriv; +#define glGetTexParameteriv glad_glGetTexParameteriv +typedef void (APIENTRYP PFNGLGETTEXLEVELPARAMETERFVPROC)(GLenum target, GLint level, GLenum pname, GLfloat *params); +GLAPI PFNGLGETTEXLEVELPARAMETERFVPROC glad_glGetTexLevelParameterfv; +#define glGetTexLevelParameterfv glad_glGetTexLevelParameterfv +typedef void (APIENTRYP PFNGLGETTEXLEVELPARAMETERIVPROC)(GLenum target, GLint level, GLenum pname, GLint *params); +GLAPI PFNGLGETTEXLEVELPARAMETERIVPROC glad_glGetTexLevelParameteriv; +#define glGetTexLevelParameteriv glad_glGetTexLevelParameteriv +typedef GLboolean (APIENTRYP PFNGLISENABLEDPROC)(GLenum cap); +GLAPI PFNGLISENABLEDPROC glad_glIsEnabled; +#define glIsEnabled glad_glIsEnabled +typedef void (APIENTRYP PFNGLDEPTHRANGEPROC)(GLdouble n, GLdouble f); +GLAPI PFNGLDEPTHRANGEPROC glad_glDepthRange; +#define glDepthRange glad_glDepthRange +typedef void (APIENTRYP PFNGLVIEWPORTPROC)(GLint x, GLint y, GLsizei width, GLsizei height); +GLAPI PFNGLVIEWPORTPROC glad_glViewport; +#define glViewport glad_glViewport +typedef void (APIENTRYP PFNGLNEWLISTPROC)(GLuint list, GLenum mode); +GLAPI PFNGLNEWLISTPROC glad_glNewList; +#define glNewList glad_glNewList +typedef void (APIENTRYP PFNGLENDLISTPROC)(void); +GLAPI PFNGLENDLISTPROC glad_glEndList; +#define glEndList glad_glEndList +typedef void (APIENTRYP PFNGLCALLLISTPROC)(GLuint list); +GLAPI PFNGLCALLLISTPROC glad_glCallList; +#define glCallList glad_glCallList +typedef void (APIENTRYP PFNGLCALLLISTSPROC)(GLsizei n, GLenum type, const void *lists); +GLAPI PFNGLCALLLISTSPROC glad_glCallLists; +#define glCallLists glad_glCallLists +typedef void (APIENTRYP PFNGLDELETELISTSPROC)(GLuint list, GLsizei range); +GLAPI PFNGLDELETELISTSPROC glad_glDeleteLists; +#define glDeleteLists glad_glDeleteLists +typedef GLuint (APIENTRYP PFNGLGENLISTSPROC)(GLsizei range); +GLAPI PFNGLGENLISTSPROC glad_glGenLists; +#define glGenLists glad_glGenLists +typedef void (APIENTRYP PFNGLLISTBASEPROC)(GLuint base); +GLAPI PFNGLLISTBASEPROC glad_glListBase; +#define glListBase glad_glListBase +typedef void (APIENTRYP PFNGLBEGINPROC)(GLenum mode); +GLAPI PFNGLBEGINPROC glad_glBegin; +#define glBegin glad_glBegin +typedef void (APIENTRYP PFNGLBITMAPPROC)(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap); +GLAPI PFNGLBITMAPPROC glad_glBitmap; +#define glBitmap glad_glBitmap +typedef void (APIENTRYP PFNGLCOLOR3BPROC)(GLbyte red, GLbyte green, GLbyte blue); +GLAPI PFNGLCOLOR3BPROC glad_glColor3b; +#define glColor3b glad_glColor3b +typedef void (APIENTRYP PFNGLCOLOR3BVPROC)(const GLbyte *v); +GLAPI PFNGLCOLOR3BVPROC glad_glColor3bv; +#define glColor3bv glad_glColor3bv +typedef void (APIENTRYP PFNGLCOLOR3DPROC)(GLdouble red, GLdouble green, GLdouble blue); +GLAPI PFNGLCOLOR3DPROC glad_glColor3d; +#define glColor3d glad_glColor3d +typedef void (APIENTRYP PFNGLCOLOR3DVPROC)(const GLdouble *v); +GLAPI PFNGLCOLOR3DVPROC glad_glColor3dv; +#define glColor3dv glad_glColor3dv +typedef void (APIENTRYP PFNGLCOLOR3FPROC)(GLfloat red, GLfloat green, GLfloat blue); +GLAPI PFNGLCOLOR3FPROC glad_glColor3f; +#define glColor3f glad_glColor3f +typedef void (APIENTRYP PFNGLCOLOR3FVPROC)(const GLfloat *v); +GLAPI PFNGLCOLOR3FVPROC glad_glColor3fv; +#define glColor3fv glad_glColor3fv +typedef void (APIENTRYP PFNGLCOLOR3IPROC)(GLint red, GLint green, GLint blue); +GLAPI PFNGLCOLOR3IPROC glad_glColor3i; +#define glColor3i glad_glColor3i +typedef void (APIENTRYP PFNGLCOLOR3IVPROC)(const GLint *v); +GLAPI PFNGLCOLOR3IVPROC glad_glColor3iv; +#define glColor3iv glad_glColor3iv +typedef void (APIENTRYP PFNGLCOLOR3SPROC)(GLshort red, GLshort green, GLshort blue); +GLAPI PFNGLCOLOR3SPROC glad_glColor3s; +#define glColor3s glad_glColor3s +typedef void (APIENTRYP PFNGLCOLOR3SVPROC)(const GLshort *v); +GLAPI PFNGLCOLOR3SVPROC glad_glColor3sv; +#define glColor3sv glad_glColor3sv +typedef void (APIENTRYP PFNGLCOLOR3UBPROC)(GLubyte red, GLubyte green, GLubyte blue); +GLAPI PFNGLCOLOR3UBPROC glad_glColor3ub; +#define glColor3ub glad_glColor3ub +typedef void (APIENTRYP PFNGLCOLOR3UBVPROC)(const GLubyte *v); +GLAPI PFNGLCOLOR3UBVPROC glad_glColor3ubv; +#define glColor3ubv glad_glColor3ubv +typedef void (APIENTRYP PFNGLCOLOR3UIPROC)(GLuint red, GLuint green, GLuint blue); +GLAPI PFNGLCOLOR3UIPROC glad_glColor3ui; +#define glColor3ui glad_glColor3ui +typedef void (APIENTRYP PFNGLCOLOR3UIVPROC)(const GLuint *v); +GLAPI PFNGLCOLOR3UIVPROC glad_glColor3uiv; +#define glColor3uiv glad_glColor3uiv +typedef void (APIENTRYP PFNGLCOLOR3USPROC)(GLushort red, GLushort green, GLushort blue); +GLAPI PFNGLCOLOR3USPROC glad_glColor3us; +#define glColor3us glad_glColor3us +typedef void (APIENTRYP PFNGLCOLOR3USVPROC)(const GLushort *v); +GLAPI PFNGLCOLOR3USVPROC glad_glColor3usv; +#define glColor3usv glad_glColor3usv +typedef void (APIENTRYP PFNGLCOLOR4BPROC)(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha); +GLAPI PFNGLCOLOR4BPROC glad_glColor4b; +#define glColor4b glad_glColor4b +typedef void (APIENTRYP PFNGLCOLOR4BVPROC)(const GLbyte *v); +GLAPI PFNGLCOLOR4BVPROC glad_glColor4bv; +#define glColor4bv glad_glColor4bv +typedef void (APIENTRYP PFNGLCOLOR4DPROC)(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha); +GLAPI PFNGLCOLOR4DPROC glad_glColor4d; +#define glColor4d glad_glColor4d +typedef void (APIENTRYP PFNGLCOLOR4DVPROC)(const GLdouble *v); +GLAPI PFNGLCOLOR4DVPROC glad_glColor4dv; +#define glColor4dv glad_glColor4dv +typedef void (APIENTRYP PFNGLCOLOR4FPROC)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); +GLAPI PFNGLCOLOR4FPROC glad_glColor4f; +#define glColor4f glad_glColor4f +typedef void (APIENTRYP PFNGLCOLOR4FVPROC)(const GLfloat *v); +GLAPI PFNGLCOLOR4FVPROC glad_glColor4fv; +#define glColor4fv glad_glColor4fv +typedef void (APIENTRYP PFNGLCOLOR4IPROC)(GLint red, GLint green, GLint blue, GLint alpha); +GLAPI PFNGLCOLOR4IPROC glad_glColor4i; +#define glColor4i glad_glColor4i +typedef void (APIENTRYP PFNGLCOLOR4IVPROC)(const GLint *v); +GLAPI PFNGLCOLOR4IVPROC glad_glColor4iv; +#define glColor4iv glad_glColor4iv +typedef void (APIENTRYP PFNGLCOLOR4SPROC)(GLshort red, GLshort green, GLshort blue, GLshort alpha); +GLAPI PFNGLCOLOR4SPROC glad_glColor4s; +#define glColor4s glad_glColor4s +typedef void (APIENTRYP PFNGLCOLOR4SVPROC)(const GLshort *v); +GLAPI PFNGLCOLOR4SVPROC glad_glColor4sv; +#define glColor4sv glad_glColor4sv +typedef void (APIENTRYP PFNGLCOLOR4UBPROC)(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha); +GLAPI PFNGLCOLOR4UBPROC glad_glColor4ub; +#define glColor4ub glad_glColor4ub +typedef void (APIENTRYP PFNGLCOLOR4UBVPROC)(const GLubyte *v); +GLAPI PFNGLCOLOR4UBVPROC glad_glColor4ubv; +#define glColor4ubv glad_glColor4ubv +typedef void (APIENTRYP PFNGLCOLOR4UIPROC)(GLuint red, GLuint green, GLuint blue, GLuint alpha); +GLAPI PFNGLCOLOR4UIPROC glad_glColor4ui; +#define glColor4ui glad_glColor4ui +typedef void (APIENTRYP PFNGLCOLOR4UIVPROC)(const GLuint *v); +GLAPI PFNGLCOLOR4UIVPROC glad_glColor4uiv; +#define glColor4uiv glad_glColor4uiv +typedef void (APIENTRYP PFNGLCOLOR4USPROC)(GLushort red, GLushort green, GLushort blue, GLushort alpha); +GLAPI PFNGLCOLOR4USPROC glad_glColor4us; +#define glColor4us glad_glColor4us +typedef void (APIENTRYP PFNGLCOLOR4USVPROC)(const GLushort *v); +GLAPI PFNGLCOLOR4USVPROC glad_glColor4usv; +#define glColor4usv glad_glColor4usv +typedef void (APIENTRYP PFNGLEDGEFLAGPROC)(GLboolean flag); +GLAPI PFNGLEDGEFLAGPROC glad_glEdgeFlag; +#define glEdgeFlag glad_glEdgeFlag +typedef void (APIENTRYP PFNGLEDGEFLAGVPROC)(const GLboolean *flag); +GLAPI PFNGLEDGEFLAGVPROC glad_glEdgeFlagv; +#define glEdgeFlagv glad_glEdgeFlagv +typedef void (APIENTRYP PFNGLENDPROC)(void); +GLAPI PFNGLENDPROC glad_glEnd; +#define glEnd glad_glEnd +typedef void (APIENTRYP PFNGLINDEXDPROC)(GLdouble c); +GLAPI PFNGLINDEXDPROC glad_glIndexd; +#define glIndexd glad_glIndexd +typedef void (APIENTRYP PFNGLINDEXDVPROC)(const GLdouble *c); +GLAPI PFNGLINDEXDVPROC glad_glIndexdv; +#define glIndexdv glad_glIndexdv +typedef void (APIENTRYP PFNGLINDEXFPROC)(GLfloat c); +GLAPI PFNGLINDEXFPROC glad_glIndexf; +#define glIndexf glad_glIndexf +typedef void (APIENTRYP PFNGLINDEXFVPROC)(const GLfloat *c); +GLAPI PFNGLINDEXFVPROC glad_glIndexfv; +#define glIndexfv glad_glIndexfv +typedef void (APIENTRYP PFNGLINDEXIPROC)(GLint c); +GLAPI PFNGLINDEXIPROC glad_glIndexi; +#define glIndexi glad_glIndexi +typedef void (APIENTRYP PFNGLINDEXIVPROC)(const GLint *c); +GLAPI PFNGLINDEXIVPROC glad_glIndexiv; +#define glIndexiv glad_glIndexiv +typedef void (APIENTRYP PFNGLINDEXSPROC)(GLshort c); +GLAPI PFNGLINDEXSPROC glad_glIndexs; +#define glIndexs glad_glIndexs +typedef void (APIENTRYP PFNGLINDEXSVPROC)(const GLshort *c); +GLAPI PFNGLINDEXSVPROC glad_glIndexsv; +#define glIndexsv glad_glIndexsv +typedef void (APIENTRYP PFNGLNORMAL3BPROC)(GLbyte nx, GLbyte ny, GLbyte nz); +GLAPI PFNGLNORMAL3BPROC glad_glNormal3b; +#define glNormal3b glad_glNormal3b +typedef void (APIENTRYP PFNGLNORMAL3BVPROC)(const GLbyte *v); +GLAPI PFNGLNORMAL3BVPROC glad_glNormal3bv; +#define glNormal3bv glad_glNormal3bv +typedef void (APIENTRYP PFNGLNORMAL3DPROC)(GLdouble nx, GLdouble ny, GLdouble nz); +GLAPI PFNGLNORMAL3DPROC glad_glNormal3d; +#define glNormal3d glad_glNormal3d +typedef void (APIENTRYP PFNGLNORMAL3DVPROC)(const GLdouble *v); +GLAPI PFNGLNORMAL3DVPROC glad_glNormal3dv; +#define glNormal3dv glad_glNormal3dv +typedef void (APIENTRYP PFNGLNORMAL3FPROC)(GLfloat nx, GLfloat ny, GLfloat nz); +GLAPI PFNGLNORMAL3FPROC glad_glNormal3f; +#define glNormal3f glad_glNormal3f +typedef void (APIENTRYP PFNGLNORMAL3FVPROC)(const GLfloat *v); +GLAPI PFNGLNORMAL3FVPROC glad_glNormal3fv; +#define glNormal3fv glad_glNormal3fv +typedef void (APIENTRYP PFNGLNORMAL3IPROC)(GLint nx, GLint ny, GLint nz); +GLAPI PFNGLNORMAL3IPROC glad_glNormal3i; +#define glNormal3i glad_glNormal3i +typedef void (APIENTRYP PFNGLNORMAL3IVPROC)(const GLint *v); +GLAPI PFNGLNORMAL3IVPROC glad_glNormal3iv; +#define glNormal3iv glad_glNormal3iv +typedef void (APIENTRYP PFNGLNORMAL3SPROC)(GLshort nx, GLshort ny, GLshort nz); +GLAPI PFNGLNORMAL3SPROC glad_glNormal3s; +#define glNormal3s glad_glNormal3s +typedef void (APIENTRYP PFNGLNORMAL3SVPROC)(const GLshort *v); +GLAPI PFNGLNORMAL3SVPROC glad_glNormal3sv; +#define glNormal3sv glad_glNormal3sv +typedef void (APIENTRYP PFNGLRASTERPOS2DPROC)(GLdouble x, GLdouble y); +GLAPI PFNGLRASTERPOS2DPROC glad_glRasterPos2d; +#define glRasterPos2d glad_glRasterPos2d +typedef void (APIENTRYP PFNGLRASTERPOS2DVPROC)(const GLdouble *v); +GLAPI PFNGLRASTERPOS2DVPROC glad_glRasterPos2dv; +#define glRasterPos2dv glad_glRasterPos2dv +typedef void (APIENTRYP PFNGLRASTERPOS2FPROC)(GLfloat x, GLfloat y); +GLAPI PFNGLRASTERPOS2FPROC glad_glRasterPos2f; +#define glRasterPos2f glad_glRasterPos2f +typedef void (APIENTRYP PFNGLRASTERPOS2FVPROC)(const GLfloat *v); +GLAPI PFNGLRASTERPOS2FVPROC glad_glRasterPos2fv; +#define glRasterPos2fv glad_glRasterPos2fv +typedef void (APIENTRYP PFNGLRASTERPOS2IPROC)(GLint x, GLint y); +GLAPI PFNGLRASTERPOS2IPROC glad_glRasterPos2i; +#define glRasterPos2i glad_glRasterPos2i +typedef void (APIENTRYP PFNGLRASTERPOS2IVPROC)(const GLint *v); +GLAPI PFNGLRASTERPOS2IVPROC glad_glRasterPos2iv; +#define glRasterPos2iv glad_glRasterPos2iv +typedef void (APIENTRYP PFNGLRASTERPOS2SPROC)(GLshort x, GLshort y); +GLAPI PFNGLRASTERPOS2SPROC glad_glRasterPos2s; +#define glRasterPos2s glad_glRasterPos2s +typedef void (APIENTRYP PFNGLRASTERPOS2SVPROC)(const GLshort *v); +GLAPI PFNGLRASTERPOS2SVPROC glad_glRasterPos2sv; +#define glRasterPos2sv glad_glRasterPos2sv +typedef void (APIENTRYP PFNGLRASTERPOS3DPROC)(GLdouble x, GLdouble y, GLdouble z); +GLAPI PFNGLRASTERPOS3DPROC glad_glRasterPos3d; +#define glRasterPos3d glad_glRasterPos3d +typedef void (APIENTRYP PFNGLRASTERPOS3DVPROC)(const GLdouble *v); +GLAPI PFNGLRASTERPOS3DVPROC glad_glRasterPos3dv; +#define glRasterPos3dv glad_glRasterPos3dv +typedef void (APIENTRYP PFNGLRASTERPOS3FPROC)(GLfloat x, GLfloat y, GLfloat z); +GLAPI PFNGLRASTERPOS3FPROC glad_glRasterPos3f; +#define glRasterPos3f glad_glRasterPos3f +typedef void (APIENTRYP PFNGLRASTERPOS3FVPROC)(const GLfloat *v); +GLAPI PFNGLRASTERPOS3FVPROC glad_glRasterPos3fv; +#define glRasterPos3fv glad_glRasterPos3fv +typedef void (APIENTRYP PFNGLRASTERPOS3IPROC)(GLint x, GLint y, GLint z); +GLAPI PFNGLRASTERPOS3IPROC glad_glRasterPos3i; +#define glRasterPos3i glad_glRasterPos3i +typedef void (APIENTRYP PFNGLRASTERPOS3IVPROC)(const GLint *v); +GLAPI PFNGLRASTERPOS3IVPROC glad_glRasterPos3iv; +#define glRasterPos3iv glad_glRasterPos3iv +typedef void (APIENTRYP PFNGLRASTERPOS3SPROC)(GLshort x, GLshort y, GLshort z); +GLAPI PFNGLRASTERPOS3SPROC glad_glRasterPos3s; +#define glRasterPos3s glad_glRasterPos3s +typedef void (APIENTRYP PFNGLRASTERPOS3SVPROC)(const GLshort *v); +GLAPI PFNGLRASTERPOS3SVPROC glad_glRasterPos3sv; +#define glRasterPos3sv glad_glRasterPos3sv +typedef void (APIENTRYP PFNGLRASTERPOS4DPROC)(GLdouble x, GLdouble y, GLdouble z, GLdouble w); +GLAPI PFNGLRASTERPOS4DPROC glad_glRasterPos4d; +#define glRasterPos4d glad_glRasterPos4d +typedef void (APIENTRYP PFNGLRASTERPOS4DVPROC)(const GLdouble *v); +GLAPI PFNGLRASTERPOS4DVPROC glad_glRasterPos4dv; +#define glRasterPos4dv glad_glRasterPos4dv +typedef void (APIENTRYP PFNGLRASTERPOS4FPROC)(GLfloat x, GLfloat y, GLfloat z, GLfloat w); +GLAPI PFNGLRASTERPOS4FPROC glad_glRasterPos4f; +#define glRasterPos4f glad_glRasterPos4f +typedef void (APIENTRYP PFNGLRASTERPOS4FVPROC)(const GLfloat *v); +GLAPI PFNGLRASTERPOS4FVPROC glad_glRasterPos4fv; +#define glRasterPos4fv glad_glRasterPos4fv +typedef void (APIENTRYP PFNGLRASTERPOS4IPROC)(GLint x, GLint y, GLint z, GLint w); +GLAPI PFNGLRASTERPOS4IPROC glad_glRasterPos4i; +#define glRasterPos4i glad_glRasterPos4i +typedef void (APIENTRYP PFNGLRASTERPOS4IVPROC)(const GLint *v); +GLAPI PFNGLRASTERPOS4IVPROC glad_glRasterPos4iv; +#define glRasterPos4iv glad_glRasterPos4iv +typedef void (APIENTRYP PFNGLRASTERPOS4SPROC)(GLshort x, GLshort y, GLshort z, GLshort w); +GLAPI PFNGLRASTERPOS4SPROC glad_glRasterPos4s; +#define glRasterPos4s glad_glRasterPos4s +typedef void (APIENTRYP PFNGLRASTERPOS4SVPROC)(const GLshort *v); +GLAPI PFNGLRASTERPOS4SVPROC glad_glRasterPos4sv; +#define glRasterPos4sv glad_glRasterPos4sv +typedef void (APIENTRYP PFNGLRECTDPROC)(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2); +GLAPI PFNGLRECTDPROC glad_glRectd; +#define glRectd glad_glRectd +typedef void (APIENTRYP PFNGLRECTDVPROC)(const GLdouble *v1, const GLdouble *v2); +GLAPI PFNGLRECTDVPROC glad_glRectdv; +#define glRectdv glad_glRectdv +typedef void (APIENTRYP PFNGLRECTFPROC)(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2); +GLAPI PFNGLRECTFPROC glad_glRectf; +#define glRectf glad_glRectf +typedef void (APIENTRYP PFNGLRECTFVPROC)(const GLfloat *v1, const GLfloat *v2); +GLAPI PFNGLRECTFVPROC glad_glRectfv; +#define glRectfv glad_glRectfv +typedef void (APIENTRYP PFNGLRECTIPROC)(GLint x1, GLint y1, GLint x2, GLint y2); +GLAPI PFNGLRECTIPROC glad_glRecti; +#define glRecti glad_glRecti +typedef void (APIENTRYP PFNGLRECTIVPROC)(const GLint *v1, const GLint *v2); +GLAPI PFNGLRECTIVPROC glad_glRectiv; +#define glRectiv glad_glRectiv +typedef void (APIENTRYP PFNGLRECTSPROC)(GLshort x1, GLshort y1, GLshort x2, GLshort y2); +GLAPI PFNGLRECTSPROC glad_glRects; +#define glRects glad_glRects +typedef void (APIENTRYP PFNGLRECTSVPROC)(const GLshort *v1, const GLshort *v2); +GLAPI PFNGLRECTSVPROC glad_glRectsv; +#define glRectsv glad_glRectsv +typedef void (APIENTRYP PFNGLTEXCOORD1DPROC)(GLdouble s); +GLAPI PFNGLTEXCOORD1DPROC glad_glTexCoord1d; +#define glTexCoord1d glad_glTexCoord1d +typedef void (APIENTRYP PFNGLTEXCOORD1DVPROC)(const GLdouble *v); +GLAPI PFNGLTEXCOORD1DVPROC glad_glTexCoord1dv; +#define glTexCoord1dv glad_glTexCoord1dv +typedef void (APIENTRYP PFNGLTEXCOORD1FPROC)(GLfloat s); +GLAPI PFNGLTEXCOORD1FPROC glad_glTexCoord1f; +#define glTexCoord1f glad_glTexCoord1f +typedef void (APIENTRYP PFNGLTEXCOORD1FVPROC)(const GLfloat *v); +GLAPI PFNGLTEXCOORD1FVPROC glad_glTexCoord1fv; +#define glTexCoord1fv glad_glTexCoord1fv +typedef void (APIENTRYP PFNGLTEXCOORD1IPROC)(GLint s); +GLAPI PFNGLTEXCOORD1IPROC glad_glTexCoord1i; +#define glTexCoord1i glad_glTexCoord1i +typedef void (APIENTRYP PFNGLTEXCOORD1IVPROC)(const GLint *v); +GLAPI PFNGLTEXCOORD1IVPROC glad_glTexCoord1iv; +#define glTexCoord1iv glad_glTexCoord1iv +typedef void (APIENTRYP PFNGLTEXCOORD1SPROC)(GLshort s); +GLAPI PFNGLTEXCOORD1SPROC glad_glTexCoord1s; +#define glTexCoord1s glad_glTexCoord1s +typedef void (APIENTRYP PFNGLTEXCOORD1SVPROC)(const GLshort *v); +GLAPI PFNGLTEXCOORD1SVPROC glad_glTexCoord1sv; +#define glTexCoord1sv glad_glTexCoord1sv +typedef void (APIENTRYP PFNGLTEXCOORD2DPROC)(GLdouble s, GLdouble t); +GLAPI PFNGLTEXCOORD2DPROC glad_glTexCoord2d; +#define glTexCoord2d glad_glTexCoord2d +typedef void (APIENTRYP PFNGLTEXCOORD2DVPROC)(const GLdouble *v); +GLAPI PFNGLTEXCOORD2DVPROC glad_glTexCoord2dv; +#define glTexCoord2dv glad_glTexCoord2dv +typedef void (APIENTRYP PFNGLTEXCOORD2FPROC)(GLfloat s, GLfloat t); +GLAPI PFNGLTEXCOORD2FPROC glad_glTexCoord2f; +#define glTexCoord2f glad_glTexCoord2f +typedef void (APIENTRYP PFNGLTEXCOORD2FVPROC)(const GLfloat *v); +GLAPI PFNGLTEXCOORD2FVPROC glad_glTexCoord2fv; +#define glTexCoord2fv glad_glTexCoord2fv +typedef void (APIENTRYP PFNGLTEXCOORD2IPROC)(GLint s, GLint t); +GLAPI PFNGLTEXCOORD2IPROC glad_glTexCoord2i; +#define glTexCoord2i glad_glTexCoord2i +typedef void (APIENTRYP PFNGLTEXCOORD2IVPROC)(const GLint *v); +GLAPI PFNGLTEXCOORD2IVPROC glad_glTexCoord2iv; +#define glTexCoord2iv glad_glTexCoord2iv +typedef void (APIENTRYP PFNGLTEXCOORD2SPROC)(GLshort s, GLshort t); +GLAPI PFNGLTEXCOORD2SPROC glad_glTexCoord2s; +#define glTexCoord2s glad_glTexCoord2s +typedef void (APIENTRYP PFNGLTEXCOORD2SVPROC)(const GLshort *v); +GLAPI PFNGLTEXCOORD2SVPROC glad_glTexCoord2sv; +#define glTexCoord2sv glad_glTexCoord2sv +typedef void (APIENTRYP PFNGLTEXCOORD3DPROC)(GLdouble s, GLdouble t, GLdouble r); +GLAPI PFNGLTEXCOORD3DPROC glad_glTexCoord3d; +#define glTexCoord3d glad_glTexCoord3d +typedef void (APIENTRYP PFNGLTEXCOORD3DVPROC)(const GLdouble *v); +GLAPI PFNGLTEXCOORD3DVPROC glad_glTexCoord3dv; +#define glTexCoord3dv glad_glTexCoord3dv +typedef void (APIENTRYP PFNGLTEXCOORD3FPROC)(GLfloat s, GLfloat t, GLfloat r); +GLAPI PFNGLTEXCOORD3FPROC glad_glTexCoord3f; +#define glTexCoord3f glad_glTexCoord3f +typedef void (APIENTRYP PFNGLTEXCOORD3FVPROC)(const GLfloat *v); +GLAPI PFNGLTEXCOORD3FVPROC glad_glTexCoord3fv; +#define glTexCoord3fv glad_glTexCoord3fv +typedef void (APIENTRYP PFNGLTEXCOORD3IPROC)(GLint s, GLint t, GLint r); +GLAPI PFNGLTEXCOORD3IPROC glad_glTexCoord3i; +#define glTexCoord3i glad_glTexCoord3i +typedef void (APIENTRYP PFNGLTEXCOORD3IVPROC)(const GLint *v); +GLAPI PFNGLTEXCOORD3IVPROC glad_glTexCoord3iv; +#define glTexCoord3iv glad_glTexCoord3iv +typedef void (APIENTRYP PFNGLTEXCOORD3SPROC)(GLshort s, GLshort t, GLshort r); +GLAPI PFNGLTEXCOORD3SPROC glad_glTexCoord3s; +#define glTexCoord3s glad_glTexCoord3s +typedef void (APIENTRYP PFNGLTEXCOORD3SVPROC)(const GLshort *v); +GLAPI PFNGLTEXCOORD3SVPROC glad_glTexCoord3sv; +#define glTexCoord3sv glad_glTexCoord3sv +typedef void (APIENTRYP PFNGLTEXCOORD4DPROC)(GLdouble s, GLdouble t, GLdouble r, GLdouble q); +GLAPI PFNGLTEXCOORD4DPROC glad_glTexCoord4d; +#define glTexCoord4d glad_glTexCoord4d +typedef void (APIENTRYP PFNGLTEXCOORD4DVPROC)(const GLdouble *v); +GLAPI PFNGLTEXCOORD4DVPROC glad_glTexCoord4dv; +#define glTexCoord4dv glad_glTexCoord4dv +typedef void (APIENTRYP PFNGLTEXCOORD4FPROC)(GLfloat s, GLfloat t, GLfloat r, GLfloat q); +GLAPI PFNGLTEXCOORD4FPROC glad_glTexCoord4f; +#define glTexCoord4f glad_glTexCoord4f +typedef void (APIENTRYP PFNGLTEXCOORD4FVPROC)(const GLfloat *v); +GLAPI PFNGLTEXCOORD4FVPROC glad_glTexCoord4fv; +#define glTexCoord4fv glad_glTexCoord4fv +typedef void (APIENTRYP PFNGLTEXCOORD4IPROC)(GLint s, GLint t, GLint r, GLint q); +GLAPI PFNGLTEXCOORD4IPROC glad_glTexCoord4i; +#define glTexCoord4i glad_glTexCoord4i +typedef void (APIENTRYP PFNGLTEXCOORD4IVPROC)(const GLint *v); +GLAPI PFNGLTEXCOORD4IVPROC glad_glTexCoord4iv; +#define glTexCoord4iv glad_glTexCoord4iv +typedef void (APIENTRYP PFNGLTEXCOORD4SPROC)(GLshort s, GLshort t, GLshort r, GLshort q); +GLAPI PFNGLTEXCOORD4SPROC glad_glTexCoord4s; +#define glTexCoord4s glad_glTexCoord4s +typedef void (APIENTRYP PFNGLTEXCOORD4SVPROC)(const GLshort *v); +GLAPI PFNGLTEXCOORD4SVPROC glad_glTexCoord4sv; +#define glTexCoord4sv glad_glTexCoord4sv +typedef void (APIENTRYP PFNGLVERTEX2DPROC)(GLdouble x, GLdouble y); +GLAPI PFNGLVERTEX2DPROC glad_glVertex2d; +#define glVertex2d glad_glVertex2d +typedef void (APIENTRYP PFNGLVERTEX2DVPROC)(const GLdouble *v); +GLAPI PFNGLVERTEX2DVPROC glad_glVertex2dv; +#define glVertex2dv glad_glVertex2dv +typedef void (APIENTRYP PFNGLVERTEX2FPROC)(GLfloat x, GLfloat y); +GLAPI PFNGLVERTEX2FPROC glad_glVertex2f; +#define glVertex2f glad_glVertex2f +typedef void (APIENTRYP PFNGLVERTEX2FVPROC)(const GLfloat *v); +GLAPI PFNGLVERTEX2FVPROC glad_glVertex2fv; +#define glVertex2fv glad_glVertex2fv +typedef void (APIENTRYP PFNGLVERTEX2IPROC)(GLint x, GLint y); +GLAPI PFNGLVERTEX2IPROC glad_glVertex2i; +#define glVertex2i glad_glVertex2i +typedef void (APIENTRYP PFNGLVERTEX2IVPROC)(const GLint *v); +GLAPI PFNGLVERTEX2IVPROC glad_glVertex2iv; +#define glVertex2iv glad_glVertex2iv +typedef void (APIENTRYP PFNGLVERTEX2SPROC)(GLshort x, GLshort y); +GLAPI PFNGLVERTEX2SPROC glad_glVertex2s; +#define glVertex2s glad_glVertex2s +typedef void (APIENTRYP PFNGLVERTEX2SVPROC)(const GLshort *v); +GLAPI PFNGLVERTEX2SVPROC glad_glVertex2sv; +#define glVertex2sv glad_glVertex2sv +typedef void (APIENTRYP PFNGLVERTEX3DPROC)(GLdouble x, GLdouble y, GLdouble z); +GLAPI PFNGLVERTEX3DPROC glad_glVertex3d; +#define glVertex3d glad_glVertex3d +typedef void (APIENTRYP PFNGLVERTEX3DVPROC)(const GLdouble *v); +GLAPI PFNGLVERTEX3DVPROC glad_glVertex3dv; +#define glVertex3dv glad_glVertex3dv +typedef void (APIENTRYP PFNGLVERTEX3FPROC)(GLfloat x, GLfloat y, GLfloat z); +GLAPI PFNGLVERTEX3FPROC glad_glVertex3f; +#define glVertex3f glad_glVertex3f +typedef void (APIENTRYP PFNGLVERTEX3FVPROC)(const GLfloat *v); +GLAPI PFNGLVERTEX3FVPROC glad_glVertex3fv; +#define glVertex3fv glad_glVertex3fv +typedef void (APIENTRYP PFNGLVERTEX3IPROC)(GLint x, GLint y, GLint z); +GLAPI PFNGLVERTEX3IPROC glad_glVertex3i; +#define glVertex3i glad_glVertex3i +typedef void (APIENTRYP PFNGLVERTEX3IVPROC)(const GLint *v); +GLAPI PFNGLVERTEX3IVPROC glad_glVertex3iv; +#define glVertex3iv glad_glVertex3iv +typedef void (APIENTRYP PFNGLVERTEX3SPROC)(GLshort x, GLshort y, GLshort z); +GLAPI PFNGLVERTEX3SPROC glad_glVertex3s; +#define glVertex3s glad_glVertex3s +typedef void (APIENTRYP PFNGLVERTEX3SVPROC)(const GLshort *v); +GLAPI PFNGLVERTEX3SVPROC glad_glVertex3sv; +#define glVertex3sv glad_glVertex3sv +typedef void (APIENTRYP PFNGLVERTEX4DPROC)(GLdouble x, GLdouble y, GLdouble z, GLdouble w); +GLAPI PFNGLVERTEX4DPROC glad_glVertex4d; +#define glVertex4d glad_glVertex4d +typedef void (APIENTRYP PFNGLVERTEX4DVPROC)(const GLdouble *v); +GLAPI PFNGLVERTEX4DVPROC glad_glVertex4dv; +#define glVertex4dv glad_glVertex4dv +typedef void (APIENTRYP PFNGLVERTEX4FPROC)(GLfloat x, GLfloat y, GLfloat z, GLfloat w); +GLAPI PFNGLVERTEX4FPROC glad_glVertex4f; +#define glVertex4f glad_glVertex4f +typedef void (APIENTRYP PFNGLVERTEX4FVPROC)(const GLfloat *v); +GLAPI PFNGLVERTEX4FVPROC glad_glVertex4fv; +#define glVertex4fv glad_glVertex4fv +typedef void (APIENTRYP PFNGLVERTEX4IPROC)(GLint x, GLint y, GLint z, GLint w); +GLAPI PFNGLVERTEX4IPROC glad_glVertex4i; +#define glVertex4i glad_glVertex4i +typedef void (APIENTRYP PFNGLVERTEX4IVPROC)(const GLint *v); +GLAPI PFNGLVERTEX4IVPROC glad_glVertex4iv; +#define glVertex4iv glad_glVertex4iv +typedef void (APIENTRYP PFNGLVERTEX4SPROC)(GLshort x, GLshort y, GLshort z, GLshort w); +GLAPI PFNGLVERTEX4SPROC glad_glVertex4s; +#define glVertex4s glad_glVertex4s +typedef void (APIENTRYP PFNGLVERTEX4SVPROC)(const GLshort *v); +GLAPI PFNGLVERTEX4SVPROC glad_glVertex4sv; +#define glVertex4sv glad_glVertex4sv +typedef void (APIENTRYP PFNGLCLIPPLANEPROC)(GLenum plane, const GLdouble *equation); +GLAPI PFNGLCLIPPLANEPROC glad_glClipPlane; +#define glClipPlane glad_glClipPlane +typedef void (APIENTRYP PFNGLCOLORMATERIALPROC)(GLenum face, GLenum mode); +GLAPI PFNGLCOLORMATERIALPROC glad_glColorMaterial; +#define glColorMaterial glad_glColorMaterial +typedef void (APIENTRYP PFNGLFOGFPROC)(GLenum pname, GLfloat param); +GLAPI PFNGLFOGFPROC glad_glFogf; +#define glFogf glad_glFogf +typedef void (APIENTRYP PFNGLFOGFVPROC)(GLenum pname, const GLfloat *params); +GLAPI PFNGLFOGFVPROC glad_glFogfv; +#define glFogfv glad_glFogfv +typedef void (APIENTRYP PFNGLFOGIPROC)(GLenum pname, GLint param); +GLAPI PFNGLFOGIPROC glad_glFogi; +#define glFogi glad_glFogi +typedef void (APIENTRYP PFNGLFOGIVPROC)(GLenum pname, const GLint *params); +GLAPI PFNGLFOGIVPROC glad_glFogiv; +#define glFogiv glad_glFogiv +typedef void (APIENTRYP PFNGLLIGHTFPROC)(GLenum light, GLenum pname, GLfloat param); +GLAPI PFNGLLIGHTFPROC glad_glLightf; +#define glLightf glad_glLightf +typedef void (APIENTRYP PFNGLLIGHTFVPROC)(GLenum light, GLenum pname, const GLfloat *params); +GLAPI PFNGLLIGHTFVPROC glad_glLightfv; +#define glLightfv glad_glLightfv +typedef void (APIENTRYP PFNGLLIGHTIPROC)(GLenum light, GLenum pname, GLint param); +GLAPI PFNGLLIGHTIPROC glad_glLighti; +#define glLighti glad_glLighti +typedef void (APIENTRYP PFNGLLIGHTIVPROC)(GLenum light, GLenum pname, const GLint *params); +GLAPI PFNGLLIGHTIVPROC glad_glLightiv; +#define glLightiv glad_glLightiv +typedef void (APIENTRYP PFNGLLIGHTMODELFPROC)(GLenum pname, GLfloat param); +GLAPI PFNGLLIGHTMODELFPROC glad_glLightModelf; +#define glLightModelf glad_glLightModelf +typedef void (APIENTRYP PFNGLLIGHTMODELFVPROC)(GLenum pname, const GLfloat *params); +GLAPI PFNGLLIGHTMODELFVPROC glad_glLightModelfv; +#define glLightModelfv glad_glLightModelfv +typedef void (APIENTRYP PFNGLLIGHTMODELIPROC)(GLenum pname, GLint param); +GLAPI PFNGLLIGHTMODELIPROC glad_glLightModeli; +#define glLightModeli glad_glLightModeli +typedef void (APIENTRYP PFNGLLIGHTMODELIVPROC)(GLenum pname, const GLint *params); +GLAPI PFNGLLIGHTMODELIVPROC glad_glLightModeliv; +#define glLightModeliv glad_glLightModeliv +typedef void (APIENTRYP PFNGLLINESTIPPLEPROC)(GLint factor, GLushort pattern); +GLAPI PFNGLLINESTIPPLEPROC glad_glLineStipple; +#define glLineStipple glad_glLineStipple +typedef void (APIENTRYP PFNGLMATERIALFPROC)(GLenum face, GLenum pname, GLfloat param); +GLAPI PFNGLMATERIALFPROC glad_glMaterialf; +#define glMaterialf glad_glMaterialf +typedef void (APIENTRYP PFNGLMATERIALFVPROC)(GLenum face, GLenum pname, const GLfloat *params); +GLAPI PFNGLMATERIALFVPROC glad_glMaterialfv; +#define glMaterialfv glad_glMaterialfv +typedef void (APIENTRYP PFNGLMATERIALIPROC)(GLenum face, GLenum pname, GLint param); +GLAPI PFNGLMATERIALIPROC glad_glMateriali; +#define glMateriali glad_glMateriali +typedef void (APIENTRYP PFNGLMATERIALIVPROC)(GLenum face, GLenum pname, const GLint *params); +GLAPI PFNGLMATERIALIVPROC glad_glMaterialiv; +#define glMaterialiv glad_glMaterialiv +typedef void (APIENTRYP PFNGLPOLYGONSTIPPLEPROC)(const GLubyte *mask); +GLAPI PFNGLPOLYGONSTIPPLEPROC glad_glPolygonStipple; +#define glPolygonStipple glad_glPolygonStipple +typedef void (APIENTRYP PFNGLSHADEMODELPROC)(GLenum mode); +GLAPI PFNGLSHADEMODELPROC glad_glShadeModel; +#define glShadeModel glad_glShadeModel +typedef void (APIENTRYP PFNGLTEXENVFPROC)(GLenum target, GLenum pname, GLfloat param); +GLAPI PFNGLTEXENVFPROC glad_glTexEnvf; +#define glTexEnvf glad_glTexEnvf +typedef void (APIENTRYP PFNGLTEXENVFVPROC)(GLenum target, GLenum pname, const GLfloat *params); +GLAPI PFNGLTEXENVFVPROC glad_glTexEnvfv; +#define glTexEnvfv glad_glTexEnvfv +typedef void (APIENTRYP PFNGLTEXENVIPROC)(GLenum target, GLenum pname, GLint param); +GLAPI PFNGLTEXENVIPROC glad_glTexEnvi; +#define glTexEnvi glad_glTexEnvi +typedef void (APIENTRYP PFNGLTEXENVIVPROC)(GLenum target, GLenum pname, const GLint *params); +GLAPI PFNGLTEXENVIVPROC glad_glTexEnviv; +#define glTexEnviv glad_glTexEnviv +typedef void (APIENTRYP PFNGLTEXGENDPROC)(GLenum coord, GLenum pname, GLdouble param); +GLAPI PFNGLTEXGENDPROC glad_glTexGend; +#define glTexGend glad_glTexGend +typedef void (APIENTRYP PFNGLTEXGENDVPROC)(GLenum coord, GLenum pname, const GLdouble *params); +GLAPI PFNGLTEXGENDVPROC glad_glTexGendv; +#define glTexGendv glad_glTexGendv +typedef void (APIENTRYP PFNGLTEXGENFPROC)(GLenum coord, GLenum pname, GLfloat param); +GLAPI PFNGLTEXGENFPROC glad_glTexGenf; +#define glTexGenf glad_glTexGenf +typedef void (APIENTRYP PFNGLTEXGENFVPROC)(GLenum coord, GLenum pname, const GLfloat *params); +GLAPI PFNGLTEXGENFVPROC glad_glTexGenfv; +#define glTexGenfv glad_glTexGenfv +typedef void (APIENTRYP PFNGLTEXGENIPROC)(GLenum coord, GLenum pname, GLint param); +GLAPI PFNGLTEXGENIPROC glad_glTexGeni; +#define glTexGeni glad_glTexGeni +typedef void (APIENTRYP PFNGLTEXGENIVPROC)(GLenum coord, GLenum pname, const GLint *params); +GLAPI PFNGLTEXGENIVPROC glad_glTexGeniv; +#define glTexGeniv glad_glTexGeniv +typedef void (APIENTRYP PFNGLFEEDBACKBUFFERPROC)(GLsizei size, GLenum type, GLfloat *buffer); +GLAPI PFNGLFEEDBACKBUFFERPROC glad_glFeedbackBuffer; +#define glFeedbackBuffer glad_glFeedbackBuffer +typedef void (APIENTRYP PFNGLSELECTBUFFERPROC)(GLsizei size, GLuint *buffer); +GLAPI PFNGLSELECTBUFFERPROC glad_glSelectBuffer; +#define glSelectBuffer glad_glSelectBuffer +typedef GLint (APIENTRYP PFNGLRENDERMODEPROC)(GLenum mode); +GLAPI PFNGLRENDERMODEPROC glad_glRenderMode; +#define glRenderMode glad_glRenderMode +typedef void (APIENTRYP PFNGLINITNAMESPROC)(void); +GLAPI PFNGLINITNAMESPROC glad_glInitNames; +#define glInitNames glad_glInitNames +typedef void (APIENTRYP PFNGLLOADNAMEPROC)(GLuint name); +GLAPI PFNGLLOADNAMEPROC glad_glLoadName; +#define glLoadName glad_glLoadName +typedef void (APIENTRYP PFNGLPASSTHROUGHPROC)(GLfloat token); +GLAPI PFNGLPASSTHROUGHPROC glad_glPassThrough; +#define glPassThrough glad_glPassThrough +typedef void (APIENTRYP PFNGLPOPNAMEPROC)(void); +GLAPI PFNGLPOPNAMEPROC glad_glPopName; +#define glPopName glad_glPopName +typedef void (APIENTRYP PFNGLPUSHNAMEPROC)(GLuint name); +GLAPI PFNGLPUSHNAMEPROC glad_glPushName; +#define glPushName glad_glPushName +typedef void (APIENTRYP PFNGLCLEARACCUMPROC)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); +GLAPI PFNGLCLEARACCUMPROC glad_glClearAccum; +#define glClearAccum glad_glClearAccum +typedef void (APIENTRYP PFNGLCLEARINDEXPROC)(GLfloat c); +GLAPI PFNGLCLEARINDEXPROC glad_glClearIndex; +#define glClearIndex glad_glClearIndex +typedef void (APIENTRYP PFNGLINDEXMASKPROC)(GLuint mask); +GLAPI PFNGLINDEXMASKPROC glad_glIndexMask; +#define glIndexMask glad_glIndexMask +typedef void (APIENTRYP PFNGLACCUMPROC)(GLenum op, GLfloat value); +GLAPI PFNGLACCUMPROC glad_glAccum; +#define glAccum glad_glAccum +typedef void (APIENTRYP PFNGLPOPATTRIBPROC)(void); +GLAPI PFNGLPOPATTRIBPROC glad_glPopAttrib; +#define glPopAttrib glad_glPopAttrib +typedef void (APIENTRYP PFNGLPUSHATTRIBPROC)(GLbitfield mask); +GLAPI PFNGLPUSHATTRIBPROC glad_glPushAttrib; +#define glPushAttrib glad_glPushAttrib +typedef void (APIENTRYP PFNGLMAP1DPROC)(GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points); +GLAPI PFNGLMAP1DPROC glad_glMap1d; +#define glMap1d glad_glMap1d +typedef void (APIENTRYP PFNGLMAP1FPROC)(GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points); +GLAPI PFNGLMAP1FPROC glad_glMap1f; +#define glMap1f glad_glMap1f +typedef void (APIENTRYP PFNGLMAP2DPROC)(GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points); +GLAPI PFNGLMAP2DPROC glad_glMap2d; +#define glMap2d glad_glMap2d +typedef void (APIENTRYP PFNGLMAP2FPROC)(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points); +GLAPI PFNGLMAP2FPROC glad_glMap2f; +#define glMap2f glad_glMap2f +typedef void (APIENTRYP PFNGLMAPGRID1DPROC)(GLint un, GLdouble u1, GLdouble u2); +GLAPI PFNGLMAPGRID1DPROC glad_glMapGrid1d; +#define glMapGrid1d glad_glMapGrid1d +typedef void (APIENTRYP PFNGLMAPGRID1FPROC)(GLint un, GLfloat u1, GLfloat u2); +GLAPI PFNGLMAPGRID1FPROC glad_glMapGrid1f; +#define glMapGrid1f glad_glMapGrid1f +typedef void (APIENTRYP PFNGLMAPGRID2DPROC)(GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2); +GLAPI PFNGLMAPGRID2DPROC glad_glMapGrid2d; +#define glMapGrid2d glad_glMapGrid2d +typedef void (APIENTRYP PFNGLMAPGRID2FPROC)(GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2); +GLAPI PFNGLMAPGRID2FPROC glad_glMapGrid2f; +#define glMapGrid2f glad_glMapGrid2f +typedef void (APIENTRYP PFNGLEVALCOORD1DPROC)(GLdouble u); +GLAPI PFNGLEVALCOORD1DPROC glad_glEvalCoord1d; +#define glEvalCoord1d glad_glEvalCoord1d +typedef void (APIENTRYP PFNGLEVALCOORD1DVPROC)(const GLdouble *u); +GLAPI PFNGLEVALCOORD1DVPROC glad_glEvalCoord1dv; +#define glEvalCoord1dv glad_glEvalCoord1dv +typedef void (APIENTRYP PFNGLEVALCOORD1FPROC)(GLfloat u); +GLAPI PFNGLEVALCOORD1FPROC glad_glEvalCoord1f; +#define glEvalCoord1f glad_glEvalCoord1f +typedef void (APIENTRYP PFNGLEVALCOORD1FVPROC)(const GLfloat *u); +GLAPI PFNGLEVALCOORD1FVPROC glad_glEvalCoord1fv; +#define glEvalCoord1fv glad_glEvalCoord1fv +typedef void (APIENTRYP PFNGLEVALCOORD2DPROC)(GLdouble u, GLdouble v); +GLAPI PFNGLEVALCOORD2DPROC glad_glEvalCoord2d; +#define glEvalCoord2d glad_glEvalCoord2d +typedef void (APIENTRYP PFNGLEVALCOORD2DVPROC)(const GLdouble *u); +GLAPI PFNGLEVALCOORD2DVPROC glad_glEvalCoord2dv; +#define glEvalCoord2dv glad_glEvalCoord2dv +typedef void (APIENTRYP PFNGLEVALCOORD2FPROC)(GLfloat u, GLfloat v); +GLAPI PFNGLEVALCOORD2FPROC glad_glEvalCoord2f; +#define glEvalCoord2f glad_glEvalCoord2f +typedef void (APIENTRYP PFNGLEVALCOORD2FVPROC)(const GLfloat *u); +GLAPI PFNGLEVALCOORD2FVPROC glad_glEvalCoord2fv; +#define glEvalCoord2fv glad_glEvalCoord2fv +typedef void (APIENTRYP PFNGLEVALMESH1PROC)(GLenum mode, GLint i1, GLint i2); +GLAPI PFNGLEVALMESH1PROC glad_glEvalMesh1; +#define glEvalMesh1 glad_glEvalMesh1 +typedef void (APIENTRYP PFNGLEVALPOINT1PROC)(GLint i); +GLAPI PFNGLEVALPOINT1PROC glad_glEvalPoint1; +#define glEvalPoint1 glad_glEvalPoint1 +typedef void (APIENTRYP PFNGLEVALMESH2PROC)(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2); +GLAPI PFNGLEVALMESH2PROC glad_glEvalMesh2; +#define glEvalMesh2 glad_glEvalMesh2 +typedef void (APIENTRYP PFNGLEVALPOINT2PROC)(GLint i, GLint j); +GLAPI PFNGLEVALPOINT2PROC glad_glEvalPoint2; +#define glEvalPoint2 glad_glEvalPoint2 +typedef void (APIENTRYP PFNGLALPHAFUNCPROC)(GLenum func, GLfloat ref); +GLAPI PFNGLALPHAFUNCPROC glad_glAlphaFunc; +#define glAlphaFunc glad_glAlphaFunc +typedef void (APIENTRYP PFNGLPIXELZOOMPROC)(GLfloat xfactor, GLfloat yfactor); +GLAPI PFNGLPIXELZOOMPROC glad_glPixelZoom; +#define glPixelZoom glad_glPixelZoom +typedef void (APIENTRYP PFNGLPIXELTRANSFERFPROC)(GLenum pname, GLfloat param); +GLAPI PFNGLPIXELTRANSFERFPROC glad_glPixelTransferf; +#define glPixelTransferf glad_glPixelTransferf +typedef void (APIENTRYP PFNGLPIXELTRANSFERIPROC)(GLenum pname, GLint param); +GLAPI PFNGLPIXELTRANSFERIPROC glad_glPixelTransferi; +#define glPixelTransferi glad_glPixelTransferi +typedef void (APIENTRYP PFNGLPIXELMAPFVPROC)(GLenum map, GLsizei mapsize, const GLfloat *values); +GLAPI PFNGLPIXELMAPFVPROC glad_glPixelMapfv; +#define glPixelMapfv glad_glPixelMapfv +typedef void (APIENTRYP PFNGLPIXELMAPUIVPROC)(GLenum map, GLsizei mapsize, const GLuint *values); +GLAPI PFNGLPIXELMAPUIVPROC glad_glPixelMapuiv; +#define glPixelMapuiv glad_glPixelMapuiv +typedef void (APIENTRYP PFNGLPIXELMAPUSVPROC)(GLenum map, GLsizei mapsize, const GLushort *values); +GLAPI PFNGLPIXELMAPUSVPROC glad_glPixelMapusv; +#define glPixelMapusv glad_glPixelMapusv +typedef void (APIENTRYP PFNGLCOPYPIXELSPROC)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type); +GLAPI PFNGLCOPYPIXELSPROC glad_glCopyPixels; +#define glCopyPixels glad_glCopyPixels +typedef void (APIENTRYP PFNGLDRAWPIXELSPROC)(GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels); +GLAPI PFNGLDRAWPIXELSPROC glad_glDrawPixels; +#define glDrawPixels glad_glDrawPixels +typedef void (APIENTRYP PFNGLGETCLIPPLANEPROC)(GLenum plane, GLdouble *equation); +GLAPI PFNGLGETCLIPPLANEPROC glad_glGetClipPlane; +#define glGetClipPlane glad_glGetClipPlane +typedef void (APIENTRYP PFNGLGETLIGHTFVPROC)(GLenum light, GLenum pname, GLfloat *params); +GLAPI PFNGLGETLIGHTFVPROC glad_glGetLightfv; +#define glGetLightfv glad_glGetLightfv +typedef void (APIENTRYP PFNGLGETLIGHTIVPROC)(GLenum light, GLenum pname, GLint *params); +GLAPI PFNGLGETLIGHTIVPROC glad_glGetLightiv; +#define glGetLightiv glad_glGetLightiv +typedef void (APIENTRYP PFNGLGETMAPDVPROC)(GLenum target, GLenum query, GLdouble *v); +GLAPI PFNGLGETMAPDVPROC glad_glGetMapdv; +#define glGetMapdv glad_glGetMapdv +typedef void (APIENTRYP PFNGLGETMAPFVPROC)(GLenum target, GLenum query, GLfloat *v); +GLAPI PFNGLGETMAPFVPROC glad_glGetMapfv; +#define glGetMapfv glad_glGetMapfv +typedef void (APIENTRYP PFNGLGETMAPIVPROC)(GLenum target, GLenum query, GLint *v); +GLAPI PFNGLGETMAPIVPROC glad_glGetMapiv; +#define glGetMapiv glad_glGetMapiv +typedef void (APIENTRYP PFNGLGETMATERIALFVPROC)(GLenum face, GLenum pname, GLfloat *params); +GLAPI PFNGLGETMATERIALFVPROC glad_glGetMaterialfv; +#define glGetMaterialfv glad_glGetMaterialfv +typedef void (APIENTRYP PFNGLGETMATERIALIVPROC)(GLenum face, GLenum pname, GLint *params); +GLAPI PFNGLGETMATERIALIVPROC glad_glGetMaterialiv; +#define glGetMaterialiv glad_glGetMaterialiv +typedef void (APIENTRYP PFNGLGETPIXELMAPFVPROC)(GLenum map, GLfloat *values); +GLAPI PFNGLGETPIXELMAPFVPROC glad_glGetPixelMapfv; +#define glGetPixelMapfv glad_glGetPixelMapfv +typedef void (APIENTRYP PFNGLGETPIXELMAPUIVPROC)(GLenum map, GLuint *values); +GLAPI PFNGLGETPIXELMAPUIVPROC glad_glGetPixelMapuiv; +#define glGetPixelMapuiv glad_glGetPixelMapuiv +typedef void (APIENTRYP PFNGLGETPIXELMAPUSVPROC)(GLenum map, GLushort *values); +GLAPI PFNGLGETPIXELMAPUSVPROC glad_glGetPixelMapusv; +#define glGetPixelMapusv glad_glGetPixelMapusv +typedef void (APIENTRYP PFNGLGETPOLYGONSTIPPLEPROC)(GLubyte *mask); +GLAPI PFNGLGETPOLYGONSTIPPLEPROC glad_glGetPolygonStipple; +#define glGetPolygonStipple glad_glGetPolygonStipple +typedef void (APIENTRYP PFNGLGETTEXENVFVPROC)(GLenum target, GLenum pname, GLfloat *params); +GLAPI PFNGLGETTEXENVFVPROC glad_glGetTexEnvfv; +#define glGetTexEnvfv glad_glGetTexEnvfv +typedef void (APIENTRYP PFNGLGETTEXENVIVPROC)(GLenum target, GLenum pname, GLint *params); +GLAPI PFNGLGETTEXENVIVPROC glad_glGetTexEnviv; +#define glGetTexEnviv glad_glGetTexEnviv +typedef void (APIENTRYP PFNGLGETTEXGENDVPROC)(GLenum coord, GLenum pname, GLdouble *params); +GLAPI PFNGLGETTEXGENDVPROC glad_glGetTexGendv; +#define glGetTexGendv glad_glGetTexGendv +typedef void (APIENTRYP PFNGLGETTEXGENFVPROC)(GLenum coord, GLenum pname, GLfloat *params); +GLAPI PFNGLGETTEXGENFVPROC glad_glGetTexGenfv; +#define glGetTexGenfv glad_glGetTexGenfv +typedef void (APIENTRYP PFNGLGETTEXGENIVPROC)(GLenum coord, GLenum pname, GLint *params); +GLAPI PFNGLGETTEXGENIVPROC glad_glGetTexGeniv; +#define glGetTexGeniv glad_glGetTexGeniv +typedef GLboolean (APIENTRYP PFNGLISLISTPROC)(GLuint list); +GLAPI PFNGLISLISTPROC glad_glIsList; +#define glIsList glad_glIsList +typedef void (APIENTRYP PFNGLFRUSTUMPROC)(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar); +GLAPI PFNGLFRUSTUMPROC glad_glFrustum; +#define glFrustum glad_glFrustum +typedef void (APIENTRYP PFNGLLOADIDENTITYPROC)(void); +GLAPI PFNGLLOADIDENTITYPROC glad_glLoadIdentity; +#define glLoadIdentity glad_glLoadIdentity +typedef void (APIENTRYP PFNGLLOADMATRIXFPROC)(const GLfloat *m); +GLAPI PFNGLLOADMATRIXFPROC glad_glLoadMatrixf; +#define glLoadMatrixf glad_glLoadMatrixf +typedef void (APIENTRYP PFNGLLOADMATRIXDPROC)(const GLdouble *m); +GLAPI PFNGLLOADMATRIXDPROC glad_glLoadMatrixd; +#define glLoadMatrixd glad_glLoadMatrixd +typedef void (APIENTRYP PFNGLMATRIXMODEPROC)(GLenum mode); +GLAPI PFNGLMATRIXMODEPROC glad_glMatrixMode; +#define glMatrixMode glad_glMatrixMode +typedef void (APIENTRYP PFNGLMULTMATRIXFPROC)(const GLfloat *m); +GLAPI PFNGLMULTMATRIXFPROC glad_glMultMatrixf; +#define glMultMatrixf glad_glMultMatrixf +typedef void (APIENTRYP PFNGLMULTMATRIXDPROC)(const GLdouble *m); +GLAPI PFNGLMULTMATRIXDPROC glad_glMultMatrixd; +#define glMultMatrixd glad_glMultMatrixd +typedef void (APIENTRYP PFNGLORTHOPROC)(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar); +GLAPI PFNGLORTHOPROC glad_glOrtho; +#define glOrtho glad_glOrtho typedef void (APIENTRYP PFNGLPOPMATRIXPROC)(void); GLAPI PFNGLPOPMATRIXPROC glad_glPopMatrix; #define glPopMatrix glad_glPopMatrix typedef void (APIENTRYP PFNGLPUSHMATRIXPROC)(void); GLAPI PFNGLPUSHMATRIXPROC glad_glPushMatrix; #define glPushMatrix glad_glPushMatrix -typedef void (APIENTRYP PFNGLREADPIXELSPROC)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels); -GLAPI PFNGLREADPIXELSPROC glad_glReadPixels; -#define glReadPixels glad_glReadPixels -typedef void (APIENTRYP PFNGLROTATEXPROC)(GLfixed angle, GLfixed x, GLfixed y, GLfixed z); -GLAPI PFNGLROTATEXPROC glad_glRotatex; -#define glRotatex glad_glRotatex -typedef void (APIENTRYP PFNGLSAMPLECOVERAGEPROC)(GLfloat value, GLboolean invert); -GLAPI PFNGLSAMPLECOVERAGEPROC glad_glSampleCoverage; -#define glSampleCoverage glad_glSampleCoverage -typedef void (APIENTRYP PFNGLSAMPLECOVERAGEXPROC)(GLclampx value, GLboolean invert); -GLAPI PFNGLSAMPLECOVERAGEXPROC glad_glSampleCoveragex; -#define glSampleCoveragex glad_glSampleCoveragex -typedef void (APIENTRYP PFNGLSCALEXPROC)(GLfixed x, GLfixed y, GLfixed z); -GLAPI PFNGLSCALEXPROC glad_glScalex; -#define glScalex glad_glScalex -typedef void (APIENTRYP PFNGLSCISSORPROC)(GLint x, GLint y, GLsizei width, GLsizei height); -GLAPI PFNGLSCISSORPROC glad_glScissor; -#define glScissor glad_glScissor -typedef void (APIENTRYP PFNGLSHADEMODELPROC)(GLenum mode); -GLAPI PFNGLSHADEMODELPROC glad_glShadeModel; -#define glShadeModel glad_glShadeModel -typedef void (APIENTRYP PFNGLSTENCILFUNCPROC)(GLenum func, GLint ref, GLuint mask); -GLAPI PFNGLSTENCILFUNCPROC glad_glStencilFunc; -#define glStencilFunc glad_glStencilFunc -typedef void (APIENTRYP PFNGLSTENCILMASKPROC)(GLuint mask); -GLAPI PFNGLSTENCILMASKPROC glad_glStencilMask; -#define glStencilMask glad_glStencilMask -typedef void (APIENTRYP PFNGLSTENCILOPPROC)(GLenum fail, GLenum zfail, GLenum zpass); -GLAPI PFNGLSTENCILOPPROC glad_glStencilOp; -#define glStencilOp glad_glStencilOp -typedef void (APIENTRYP PFNGLTEXCOORDPOINTERPROC)(GLint size, GLenum type, GLsizei stride, const void *pointer); -GLAPI PFNGLTEXCOORDPOINTERPROC glad_glTexCoordPointer; -#define glTexCoordPointer glad_glTexCoordPointer -typedef void (APIENTRYP PFNGLTEXENVIPROC)(GLenum target, GLenum pname, GLint param); -GLAPI PFNGLTEXENVIPROC glad_glTexEnvi; -#define glTexEnvi glad_glTexEnvi -typedef void (APIENTRYP PFNGLTEXENVXPROC)(GLenum target, GLenum pname, GLfixed param); -GLAPI PFNGLTEXENVXPROC glad_glTexEnvx; -#define glTexEnvx glad_glTexEnvx -typedef void (APIENTRYP PFNGLTEXENVIVPROC)(GLenum target, GLenum pname, const GLint *params); -GLAPI PFNGLTEXENVIVPROC glad_glTexEnviv; -#define glTexEnviv glad_glTexEnviv -typedef void (APIENTRYP PFNGLTEXENVXVPROC)(GLenum target, GLenum pname, const GLfixed *params); -GLAPI PFNGLTEXENVXVPROC glad_glTexEnvxv; -#define glTexEnvxv glad_glTexEnvxv -typedef void (APIENTRYP PFNGLTEXIMAGE2DPROC)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels); -GLAPI PFNGLTEXIMAGE2DPROC glad_glTexImage2D; -#define glTexImage2D glad_glTexImage2D -typedef void (APIENTRYP PFNGLTEXPARAMETERIPROC)(GLenum target, GLenum pname, GLint param); -GLAPI PFNGLTEXPARAMETERIPROC glad_glTexParameteri; -#define glTexParameteri glad_glTexParameteri -typedef void (APIENTRYP PFNGLTEXPARAMETERXPROC)(GLenum target, GLenum pname, GLfixed param); -GLAPI PFNGLTEXPARAMETERXPROC glad_glTexParameterx; -#define glTexParameterx glad_glTexParameterx -typedef void (APIENTRYP PFNGLTEXPARAMETERIVPROC)(GLenum target, GLenum pname, const GLint *params); -GLAPI PFNGLTEXPARAMETERIVPROC glad_glTexParameteriv; -#define glTexParameteriv glad_glTexParameteriv -typedef void (APIENTRYP PFNGLTEXPARAMETERXVPROC)(GLenum target, GLenum pname, const GLfixed *params); -GLAPI PFNGLTEXPARAMETERXVPROC glad_glTexParameterxv; -#define glTexParameterxv glad_glTexParameterxv +typedef void (APIENTRYP PFNGLROTATEDPROC)(GLdouble angle, GLdouble x, GLdouble y, GLdouble z); +GLAPI PFNGLROTATEDPROC glad_glRotated; +#define glRotated glad_glRotated +typedef void (APIENTRYP PFNGLROTATEFPROC)(GLfloat angle, GLfloat x, GLfloat y, GLfloat z); +GLAPI PFNGLROTATEFPROC glad_glRotatef; +#define glRotatef glad_glRotatef +typedef void (APIENTRYP PFNGLSCALEDPROC)(GLdouble x, GLdouble y, GLdouble z); +GLAPI PFNGLSCALEDPROC glad_glScaled; +#define glScaled glad_glScaled +typedef void (APIENTRYP PFNGLSCALEFPROC)(GLfloat x, GLfloat y, GLfloat z); +GLAPI PFNGLSCALEFPROC glad_glScalef; +#define glScalef glad_glScalef +typedef void (APIENTRYP PFNGLTRANSLATEDPROC)(GLdouble x, GLdouble y, GLdouble z); +GLAPI PFNGLTRANSLATEDPROC glad_glTranslated; +#define glTranslated glad_glTranslated +typedef void (APIENTRYP PFNGLTRANSLATEFPROC)(GLfloat x, GLfloat y, GLfloat z); +GLAPI PFNGLTRANSLATEFPROC glad_glTranslatef; +#define glTranslatef glad_glTranslatef +#endif +#ifndef GL_VERSION_1_1 +#define GL_VERSION_1_1 1 +GLAPI int GLAD_GL_VERSION_1_1; +typedef void (APIENTRYP PFNGLDRAWARRAYSPROC)(GLenum mode, GLint first, GLsizei count); +GLAPI PFNGLDRAWARRAYSPROC glad_glDrawArrays; +#define glDrawArrays glad_glDrawArrays +typedef void (APIENTRYP PFNGLDRAWELEMENTSPROC)(GLenum mode, GLsizei count, GLenum type, const void *indices); +GLAPI PFNGLDRAWELEMENTSPROC glad_glDrawElements; +#define glDrawElements glad_glDrawElements +typedef void (APIENTRYP PFNGLGETPOINTERVPROC)(GLenum pname, void **params); +GLAPI PFNGLGETPOINTERVPROC glad_glGetPointerv; +#define glGetPointerv glad_glGetPointerv +typedef void (APIENTRYP PFNGLPOLYGONOFFSETPROC)(GLfloat factor, GLfloat units); +GLAPI PFNGLPOLYGONOFFSETPROC glad_glPolygonOffset; +#define glPolygonOffset glad_glPolygonOffset +typedef void (APIENTRYP PFNGLCOPYTEXIMAGE1DPROC)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border); +GLAPI PFNGLCOPYTEXIMAGE1DPROC glad_glCopyTexImage1D; +#define glCopyTexImage1D glad_glCopyTexImage1D +typedef void (APIENTRYP PFNGLCOPYTEXIMAGE2DPROC)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); +GLAPI PFNGLCOPYTEXIMAGE2DPROC glad_glCopyTexImage2D; +#define glCopyTexImage2D glad_glCopyTexImage2D +typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE1DPROC)(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); +GLAPI PFNGLCOPYTEXSUBIMAGE1DPROC glad_glCopyTexSubImage1D; +#define glCopyTexSubImage1D glad_glCopyTexSubImage1D +typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE2DPROC)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); +GLAPI PFNGLCOPYTEXSUBIMAGE2DPROC glad_glCopyTexSubImage2D; +#define glCopyTexSubImage2D glad_glCopyTexSubImage2D +typedef void (APIENTRYP PFNGLTEXSUBIMAGE1DPROC)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels); +GLAPI PFNGLTEXSUBIMAGE1DPROC glad_glTexSubImage1D; +#define glTexSubImage1D glad_glTexSubImage1D typedef void (APIENTRYP PFNGLTEXSUBIMAGE2DPROC)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels); GLAPI PFNGLTEXSUBIMAGE2DPROC glad_glTexSubImage2D; #define glTexSubImage2D glad_glTexSubImage2D -typedef void (APIENTRYP PFNGLTRANSLATEXPROC)(GLfixed x, GLfixed y, GLfixed z); -GLAPI PFNGLTRANSLATEXPROC glad_glTranslatex; -#define glTranslatex glad_glTranslatex +typedef void (APIENTRYP PFNGLBINDTEXTUREPROC)(GLenum target, GLuint texture); +GLAPI PFNGLBINDTEXTUREPROC glad_glBindTexture; +#define glBindTexture glad_glBindTexture +typedef void (APIENTRYP PFNGLDELETETEXTURESPROC)(GLsizei n, const GLuint *textures); +GLAPI PFNGLDELETETEXTURESPROC glad_glDeleteTextures; +#define glDeleteTextures glad_glDeleteTextures +typedef void (APIENTRYP PFNGLGENTEXTURESPROC)(GLsizei n, GLuint *textures); +GLAPI PFNGLGENTEXTURESPROC glad_glGenTextures; +#define glGenTextures glad_glGenTextures +typedef GLboolean (APIENTRYP PFNGLISTEXTUREPROC)(GLuint texture); +GLAPI PFNGLISTEXTUREPROC glad_glIsTexture; +#define glIsTexture glad_glIsTexture +typedef void (APIENTRYP PFNGLARRAYELEMENTPROC)(GLint i); +GLAPI PFNGLARRAYELEMENTPROC glad_glArrayElement; +#define glArrayElement glad_glArrayElement +typedef void (APIENTRYP PFNGLCOLORPOINTERPROC)(GLint size, GLenum type, GLsizei stride, const void *pointer); +GLAPI PFNGLCOLORPOINTERPROC glad_glColorPointer; +#define glColorPointer glad_glColorPointer +typedef void (APIENTRYP PFNGLDISABLECLIENTSTATEPROC)(GLenum array); +GLAPI PFNGLDISABLECLIENTSTATEPROC glad_glDisableClientState; +#define glDisableClientState glad_glDisableClientState +typedef void (APIENTRYP PFNGLEDGEFLAGPOINTERPROC)(GLsizei stride, const void *pointer); +GLAPI PFNGLEDGEFLAGPOINTERPROC glad_glEdgeFlagPointer; +#define glEdgeFlagPointer glad_glEdgeFlagPointer +typedef void (APIENTRYP PFNGLENABLECLIENTSTATEPROC)(GLenum array); +GLAPI PFNGLENABLECLIENTSTATEPROC glad_glEnableClientState; +#define glEnableClientState glad_glEnableClientState +typedef void (APIENTRYP PFNGLINDEXPOINTERPROC)(GLenum type, GLsizei stride, const void *pointer); +GLAPI PFNGLINDEXPOINTERPROC glad_glIndexPointer; +#define glIndexPointer glad_glIndexPointer +typedef void (APIENTRYP PFNGLINTERLEAVEDARRAYSPROC)(GLenum format, GLsizei stride, const void *pointer); +GLAPI PFNGLINTERLEAVEDARRAYSPROC glad_glInterleavedArrays; +#define glInterleavedArrays glad_glInterleavedArrays +typedef void (APIENTRYP PFNGLNORMALPOINTERPROC)(GLenum type, GLsizei stride, const void *pointer); +GLAPI PFNGLNORMALPOINTERPROC glad_glNormalPointer; +#define glNormalPointer glad_glNormalPointer +typedef void (APIENTRYP PFNGLTEXCOORDPOINTERPROC)(GLint size, GLenum type, GLsizei stride, const void *pointer); +GLAPI PFNGLTEXCOORDPOINTERPROC glad_glTexCoordPointer; +#define glTexCoordPointer glad_glTexCoordPointer typedef void (APIENTRYP PFNGLVERTEXPOINTERPROC)(GLint size, GLenum type, GLsizei stride, const void *pointer); GLAPI PFNGLVERTEXPOINTERPROC glad_glVertexPointer; #define glVertexPointer glad_glVertexPointer -typedef void (APIENTRYP PFNGLVIEWPORTPROC)(GLint x, GLint y, GLsizei width, GLsizei height); -GLAPI PFNGLVIEWPORTPROC glad_glViewport; -#define glViewport glad_glViewport +typedef GLboolean (APIENTRYP PFNGLARETEXTURESRESIDENTPROC)(GLsizei n, const GLuint *textures, GLboolean *residences); +GLAPI PFNGLARETEXTURESRESIDENTPROC glad_glAreTexturesResident; +#define glAreTexturesResident glad_glAreTexturesResident +typedef void (APIENTRYP PFNGLPRIORITIZETEXTURESPROC)(GLsizei n, const GLuint *textures, const GLfloat *priorities); +GLAPI PFNGLPRIORITIZETEXTURESPROC glad_glPrioritizeTextures; +#define glPrioritizeTextures glad_glPrioritizeTextures +typedef void (APIENTRYP PFNGLINDEXUBPROC)(GLubyte c); +GLAPI PFNGLINDEXUBPROC glad_glIndexub; +#define glIndexub glad_glIndexub +typedef void (APIENTRYP PFNGLINDEXUBVPROC)(const GLubyte *c); +GLAPI PFNGLINDEXUBVPROC glad_glIndexubv; +#define glIndexubv glad_glIndexubv +typedef void (APIENTRYP PFNGLPOPCLIENTATTRIBPROC)(void); +GLAPI PFNGLPOPCLIENTATTRIBPROC glad_glPopClientAttrib; +#define glPopClientAttrib glad_glPopClientAttrib +typedef void (APIENTRYP PFNGLPUSHCLIENTATTRIBPROC)(GLbitfield mask); +GLAPI PFNGLPUSHCLIENTATTRIBPROC glad_glPushClientAttrib; +#define glPushClientAttrib glad_glPushClientAttrib #endif -#define GL_TEXTURE_EXTERNAL_OES 0x8D65 -#define GL_TEXTURE_BINDING_EXTERNAL_OES 0x8D67 -#define GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES 0x8D68 -#define GL_SAMPLER_EXTERNAL_OES 0x8D66 -#ifndef GL_OES_EGL_image -#define GL_OES_EGL_image 1 -GLAPI int GLAD_GL_OES_EGL_image; -typedef void (APIENTRYP PFNGLEGLIMAGETARGETTEXTURE2DOESPROC)(GLenum target, GLeglImageOES image); -GLAPI PFNGLEGLIMAGETARGETTEXTURE2DOESPROC glad_glEGLImageTargetTexture2DOES; -#define glEGLImageTargetTexture2DOES glad_glEGLImageTargetTexture2DOES -typedef void (APIENTRYP PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC)(GLenum target, GLeglImageOES image); -GLAPI PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC glad_glEGLImageTargetRenderbufferStorageOES; -#define glEGLImageTargetRenderbufferStorageOES glad_glEGLImageTargetRenderbufferStorageOES +#ifndef GL_VERSION_1_2 +#define GL_VERSION_1_2 1 +GLAPI int GLAD_GL_VERSION_1_2; +typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSPROC)(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices); +GLAPI PFNGLDRAWRANGEELEMENTSPROC glad_glDrawRangeElements; +#define glDrawRangeElements glad_glDrawRangeElements +typedef void (APIENTRYP PFNGLTEXIMAGE3DPROC)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels); +GLAPI PFNGLTEXIMAGE3DPROC glad_glTexImage3D; +#define glTexImage3D glad_glTexImage3D +typedef void (APIENTRYP PFNGLTEXSUBIMAGE3DPROC)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels); +GLAPI PFNGLTEXSUBIMAGE3DPROC glad_glTexSubImage3D; +#define glTexSubImage3D glad_glTexSubImage3D +typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE3DPROC)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); +GLAPI PFNGLCOPYTEXSUBIMAGE3DPROC glad_glCopyTexSubImage3D; +#define glCopyTexSubImage3D glad_glCopyTexSubImage3D #endif -#ifndef GL_OES_EGL_image_external -#define GL_OES_EGL_image_external 1 -GLAPI int GLAD_GL_OES_EGL_image_external; +#ifndef GL_VERSION_1_3 +#define GL_VERSION_1_3 1 +GLAPI int GLAD_GL_VERSION_1_3; +typedef void (APIENTRYP PFNGLACTIVETEXTUREPROC)(GLenum texture); +GLAPI PFNGLACTIVETEXTUREPROC glad_glActiveTexture; +#define glActiveTexture glad_glActiveTexture +typedef void (APIENTRYP PFNGLSAMPLECOVERAGEPROC)(GLfloat value, GLboolean invert); +GLAPI PFNGLSAMPLECOVERAGEPROC glad_glSampleCoverage; +#define glSampleCoverage glad_glSampleCoverage +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DPROC)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data); +GLAPI PFNGLCOMPRESSEDTEXIMAGE3DPROC glad_glCompressedTexImage3D; +#define glCompressedTexImage3D glad_glCompressedTexImage3D +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DPROC)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data); +GLAPI PFNGLCOMPRESSEDTEXIMAGE2DPROC glad_glCompressedTexImage2D; +#define glCompressedTexImage2D glad_glCompressedTexImage2D +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE1DPROC)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void *data); +GLAPI PFNGLCOMPRESSEDTEXIMAGE1DPROC glad_glCompressedTexImage1D; +#define glCompressedTexImage1D glad_glCompressedTexImage1D +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data); +GLAPI PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC glad_glCompressedTexSubImage3D; +#define glCompressedTexSubImage3D glad_glCompressedTexSubImage3D +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data); +GLAPI PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC glad_glCompressedTexSubImage2D; +#define glCompressedTexSubImage2D glad_glCompressedTexSubImage2D +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *data); +GLAPI PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC glad_glCompressedTexSubImage1D; +#define glCompressedTexSubImage1D glad_glCompressedTexSubImage1D +typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXIMAGEPROC)(GLenum target, GLint level, void *img); +GLAPI PFNGLGETCOMPRESSEDTEXIMAGEPROC glad_glGetCompressedTexImage; +#define glGetCompressedTexImage glad_glGetCompressedTexImage +typedef void (APIENTRYP PFNGLCLIENTACTIVETEXTUREPROC)(GLenum texture); +GLAPI PFNGLCLIENTACTIVETEXTUREPROC glad_glClientActiveTexture; +#define glClientActiveTexture glad_glClientActiveTexture +typedef void (APIENTRYP PFNGLMULTITEXCOORD1DPROC)(GLenum target, GLdouble s); +GLAPI PFNGLMULTITEXCOORD1DPROC glad_glMultiTexCoord1d; +#define glMultiTexCoord1d glad_glMultiTexCoord1d +typedef void (APIENTRYP PFNGLMULTITEXCOORD1DVPROC)(GLenum target, const GLdouble *v); +GLAPI PFNGLMULTITEXCOORD1DVPROC glad_glMultiTexCoord1dv; +#define glMultiTexCoord1dv glad_glMultiTexCoord1dv +typedef void (APIENTRYP PFNGLMULTITEXCOORD1FPROC)(GLenum target, GLfloat s); +GLAPI PFNGLMULTITEXCOORD1FPROC glad_glMultiTexCoord1f; +#define glMultiTexCoord1f glad_glMultiTexCoord1f +typedef void (APIENTRYP PFNGLMULTITEXCOORD1FVPROC)(GLenum target, const GLfloat *v); +GLAPI PFNGLMULTITEXCOORD1FVPROC glad_glMultiTexCoord1fv; +#define glMultiTexCoord1fv glad_glMultiTexCoord1fv +typedef void (APIENTRYP PFNGLMULTITEXCOORD1IPROC)(GLenum target, GLint s); +GLAPI PFNGLMULTITEXCOORD1IPROC glad_glMultiTexCoord1i; +#define glMultiTexCoord1i glad_glMultiTexCoord1i +typedef void (APIENTRYP PFNGLMULTITEXCOORD1IVPROC)(GLenum target, const GLint *v); +GLAPI PFNGLMULTITEXCOORD1IVPROC glad_glMultiTexCoord1iv; +#define glMultiTexCoord1iv glad_glMultiTexCoord1iv +typedef void (APIENTRYP PFNGLMULTITEXCOORD1SPROC)(GLenum target, GLshort s); +GLAPI PFNGLMULTITEXCOORD1SPROC glad_glMultiTexCoord1s; +#define glMultiTexCoord1s glad_glMultiTexCoord1s +typedef void (APIENTRYP PFNGLMULTITEXCOORD1SVPROC)(GLenum target, const GLshort *v); +GLAPI PFNGLMULTITEXCOORD1SVPROC glad_glMultiTexCoord1sv; +#define glMultiTexCoord1sv glad_glMultiTexCoord1sv +typedef void (APIENTRYP PFNGLMULTITEXCOORD2DPROC)(GLenum target, GLdouble s, GLdouble t); +GLAPI PFNGLMULTITEXCOORD2DPROC glad_glMultiTexCoord2d; +#define glMultiTexCoord2d glad_glMultiTexCoord2d +typedef void (APIENTRYP PFNGLMULTITEXCOORD2DVPROC)(GLenum target, const GLdouble *v); +GLAPI PFNGLMULTITEXCOORD2DVPROC glad_glMultiTexCoord2dv; +#define glMultiTexCoord2dv glad_glMultiTexCoord2dv +typedef void (APIENTRYP PFNGLMULTITEXCOORD2FPROC)(GLenum target, GLfloat s, GLfloat t); +GLAPI PFNGLMULTITEXCOORD2FPROC glad_glMultiTexCoord2f; +#define glMultiTexCoord2f glad_glMultiTexCoord2f +typedef void (APIENTRYP PFNGLMULTITEXCOORD2FVPROC)(GLenum target, const GLfloat *v); +GLAPI PFNGLMULTITEXCOORD2FVPROC glad_glMultiTexCoord2fv; +#define glMultiTexCoord2fv glad_glMultiTexCoord2fv +typedef void (APIENTRYP PFNGLMULTITEXCOORD2IPROC)(GLenum target, GLint s, GLint t); +GLAPI PFNGLMULTITEXCOORD2IPROC glad_glMultiTexCoord2i; +#define glMultiTexCoord2i glad_glMultiTexCoord2i +typedef void (APIENTRYP PFNGLMULTITEXCOORD2IVPROC)(GLenum target, const GLint *v); +GLAPI PFNGLMULTITEXCOORD2IVPROC glad_glMultiTexCoord2iv; +#define glMultiTexCoord2iv glad_glMultiTexCoord2iv +typedef void (APIENTRYP PFNGLMULTITEXCOORD2SPROC)(GLenum target, GLshort s, GLshort t); +GLAPI PFNGLMULTITEXCOORD2SPROC glad_glMultiTexCoord2s; +#define glMultiTexCoord2s glad_glMultiTexCoord2s +typedef void (APIENTRYP PFNGLMULTITEXCOORD2SVPROC)(GLenum target, const GLshort *v); +GLAPI PFNGLMULTITEXCOORD2SVPROC glad_glMultiTexCoord2sv; +#define glMultiTexCoord2sv glad_glMultiTexCoord2sv +typedef void (APIENTRYP PFNGLMULTITEXCOORD3DPROC)(GLenum target, GLdouble s, GLdouble t, GLdouble r); +GLAPI PFNGLMULTITEXCOORD3DPROC glad_glMultiTexCoord3d; +#define glMultiTexCoord3d glad_glMultiTexCoord3d +typedef void (APIENTRYP PFNGLMULTITEXCOORD3DVPROC)(GLenum target, const GLdouble *v); +GLAPI PFNGLMULTITEXCOORD3DVPROC glad_glMultiTexCoord3dv; +#define glMultiTexCoord3dv glad_glMultiTexCoord3dv +typedef void (APIENTRYP PFNGLMULTITEXCOORD3FPROC)(GLenum target, GLfloat s, GLfloat t, GLfloat r); +GLAPI PFNGLMULTITEXCOORD3FPROC glad_glMultiTexCoord3f; +#define glMultiTexCoord3f glad_glMultiTexCoord3f +typedef void (APIENTRYP PFNGLMULTITEXCOORD3FVPROC)(GLenum target, const GLfloat *v); +GLAPI PFNGLMULTITEXCOORD3FVPROC glad_glMultiTexCoord3fv; +#define glMultiTexCoord3fv glad_glMultiTexCoord3fv +typedef void (APIENTRYP PFNGLMULTITEXCOORD3IPROC)(GLenum target, GLint s, GLint t, GLint r); +GLAPI PFNGLMULTITEXCOORD3IPROC glad_glMultiTexCoord3i; +#define glMultiTexCoord3i glad_glMultiTexCoord3i +typedef void (APIENTRYP PFNGLMULTITEXCOORD3IVPROC)(GLenum target, const GLint *v); +GLAPI PFNGLMULTITEXCOORD3IVPROC glad_glMultiTexCoord3iv; +#define glMultiTexCoord3iv glad_glMultiTexCoord3iv +typedef void (APIENTRYP PFNGLMULTITEXCOORD3SPROC)(GLenum target, GLshort s, GLshort t, GLshort r); +GLAPI PFNGLMULTITEXCOORD3SPROC glad_glMultiTexCoord3s; +#define glMultiTexCoord3s glad_glMultiTexCoord3s +typedef void (APIENTRYP PFNGLMULTITEXCOORD3SVPROC)(GLenum target, const GLshort *v); +GLAPI PFNGLMULTITEXCOORD3SVPROC glad_glMultiTexCoord3sv; +#define glMultiTexCoord3sv glad_glMultiTexCoord3sv +typedef void (APIENTRYP PFNGLMULTITEXCOORD4DPROC)(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); +GLAPI PFNGLMULTITEXCOORD4DPROC glad_glMultiTexCoord4d; +#define glMultiTexCoord4d glad_glMultiTexCoord4d +typedef void (APIENTRYP PFNGLMULTITEXCOORD4DVPROC)(GLenum target, const GLdouble *v); +GLAPI PFNGLMULTITEXCOORD4DVPROC glad_glMultiTexCoord4dv; +#define glMultiTexCoord4dv glad_glMultiTexCoord4dv +typedef void (APIENTRYP PFNGLMULTITEXCOORD4FPROC)(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); +GLAPI PFNGLMULTITEXCOORD4FPROC glad_glMultiTexCoord4f; +#define glMultiTexCoord4f glad_glMultiTexCoord4f +typedef void (APIENTRYP PFNGLMULTITEXCOORD4FVPROC)(GLenum target, const GLfloat *v); +GLAPI PFNGLMULTITEXCOORD4FVPROC glad_glMultiTexCoord4fv; +#define glMultiTexCoord4fv glad_glMultiTexCoord4fv +typedef void (APIENTRYP PFNGLMULTITEXCOORD4IPROC)(GLenum target, GLint s, GLint t, GLint r, GLint q); +GLAPI PFNGLMULTITEXCOORD4IPROC glad_glMultiTexCoord4i; +#define glMultiTexCoord4i glad_glMultiTexCoord4i +typedef void (APIENTRYP PFNGLMULTITEXCOORD4IVPROC)(GLenum target, const GLint *v); +GLAPI PFNGLMULTITEXCOORD4IVPROC glad_glMultiTexCoord4iv; +#define glMultiTexCoord4iv glad_glMultiTexCoord4iv +typedef void (APIENTRYP PFNGLMULTITEXCOORD4SPROC)(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); +GLAPI PFNGLMULTITEXCOORD4SPROC glad_glMultiTexCoord4s; +#define glMultiTexCoord4s glad_glMultiTexCoord4s +typedef void (APIENTRYP PFNGLMULTITEXCOORD4SVPROC)(GLenum target, const GLshort *v); +GLAPI PFNGLMULTITEXCOORD4SVPROC glad_glMultiTexCoord4sv; +#define glMultiTexCoord4sv glad_glMultiTexCoord4sv +typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXFPROC)(const GLfloat *m); +GLAPI PFNGLLOADTRANSPOSEMATRIXFPROC glad_glLoadTransposeMatrixf; +#define glLoadTransposeMatrixf glad_glLoadTransposeMatrixf +typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXDPROC)(const GLdouble *m); +GLAPI PFNGLLOADTRANSPOSEMATRIXDPROC glad_glLoadTransposeMatrixd; +#define glLoadTransposeMatrixd glad_glLoadTransposeMatrixd +typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXFPROC)(const GLfloat *m); +GLAPI PFNGLMULTTRANSPOSEMATRIXFPROC glad_glMultTransposeMatrixf; +#define glMultTransposeMatrixf glad_glMultTransposeMatrixf +typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXDPROC)(const GLdouble *m); +GLAPI PFNGLMULTTRANSPOSEMATRIXDPROC glad_glMultTransposeMatrixd; +#define glMultTransposeMatrixd glad_glMultTransposeMatrixd +#endif +#ifndef GL_VERSION_1_4 +#define GL_VERSION_1_4 1 +GLAPI int GLAD_GL_VERSION_1_4; +typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEPROC)(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); +GLAPI PFNGLBLENDFUNCSEPARATEPROC glad_glBlendFuncSeparate; +#define glBlendFuncSeparate glad_glBlendFuncSeparate +typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSPROC)(GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount); +GLAPI PFNGLMULTIDRAWARRAYSPROC glad_glMultiDrawArrays; +#define glMultiDrawArrays glad_glMultiDrawArrays +typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSPROC)(GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei drawcount); +GLAPI PFNGLMULTIDRAWELEMENTSPROC glad_glMultiDrawElements; +#define glMultiDrawElements glad_glMultiDrawElements +typedef void (APIENTRYP PFNGLPOINTPARAMETERFPROC)(GLenum pname, GLfloat param); +GLAPI PFNGLPOINTPARAMETERFPROC glad_glPointParameterf; +#define glPointParameterf glad_glPointParameterf +typedef void (APIENTRYP PFNGLPOINTPARAMETERFVPROC)(GLenum pname, const GLfloat *params); +GLAPI PFNGLPOINTPARAMETERFVPROC glad_glPointParameterfv; +#define glPointParameterfv glad_glPointParameterfv +typedef void (APIENTRYP PFNGLPOINTPARAMETERIPROC)(GLenum pname, GLint param); +GLAPI PFNGLPOINTPARAMETERIPROC glad_glPointParameteri; +#define glPointParameteri glad_glPointParameteri +typedef void (APIENTRYP PFNGLPOINTPARAMETERIVPROC)(GLenum pname, const GLint *params); +GLAPI PFNGLPOINTPARAMETERIVPROC glad_glPointParameteriv; +#define glPointParameteriv glad_glPointParameteriv +typedef void (APIENTRYP PFNGLFOGCOORDFPROC)(GLfloat coord); +GLAPI PFNGLFOGCOORDFPROC glad_glFogCoordf; +#define glFogCoordf glad_glFogCoordf +typedef void (APIENTRYP PFNGLFOGCOORDFVPROC)(const GLfloat *coord); +GLAPI PFNGLFOGCOORDFVPROC glad_glFogCoordfv; +#define glFogCoordfv glad_glFogCoordfv +typedef void (APIENTRYP PFNGLFOGCOORDDPROC)(GLdouble coord); +GLAPI PFNGLFOGCOORDDPROC glad_glFogCoordd; +#define glFogCoordd glad_glFogCoordd +typedef void (APIENTRYP PFNGLFOGCOORDDVPROC)(const GLdouble *coord); +GLAPI PFNGLFOGCOORDDVPROC glad_glFogCoorddv; +#define glFogCoorddv glad_glFogCoorddv +typedef void (APIENTRYP PFNGLFOGCOORDPOINTERPROC)(GLenum type, GLsizei stride, const void *pointer); +GLAPI PFNGLFOGCOORDPOINTERPROC glad_glFogCoordPointer; +#define glFogCoordPointer glad_glFogCoordPointer +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3BPROC)(GLbyte red, GLbyte green, GLbyte blue); +GLAPI PFNGLSECONDARYCOLOR3BPROC glad_glSecondaryColor3b; +#define glSecondaryColor3b glad_glSecondaryColor3b +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3BVPROC)(const GLbyte *v); +GLAPI PFNGLSECONDARYCOLOR3BVPROC glad_glSecondaryColor3bv; +#define glSecondaryColor3bv glad_glSecondaryColor3bv +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3DPROC)(GLdouble red, GLdouble green, GLdouble blue); +GLAPI PFNGLSECONDARYCOLOR3DPROC glad_glSecondaryColor3d; +#define glSecondaryColor3d glad_glSecondaryColor3d +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3DVPROC)(const GLdouble *v); +GLAPI PFNGLSECONDARYCOLOR3DVPROC glad_glSecondaryColor3dv; +#define glSecondaryColor3dv glad_glSecondaryColor3dv +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3FPROC)(GLfloat red, GLfloat green, GLfloat blue); +GLAPI PFNGLSECONDARYCOLOR3FPROC glad_glSecondaryColor3f; +#define glSecondaryColor3f glad_glSecondaryColor3f +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3FVPROC)(const GLfloat *v); +GLAPI PFNGLSECONDARYCOLOR3FVPROC glad_glSecondaryColor3fv; +#define glSecondaryColor3fv glad_glSecondaryColor3fv +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3IPROC)(GLint red, GLint green, GLint blue); +GLAPI PFNGLSECONDARYCOLOR3IPROC glad_glSecondaryColor3i; +#define glSecondaryColor3i glad_glSecondaryColor3i +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3IVPROC)(const GLint *v); +GLAPI PFNGLSECONDARYCOLOR3IVPROC glad_glSecondaryColor3iv; +#define glSecondaryColor3iv glad_glSecondaryColor3iv +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3SPROC)(GLshort red, GLshort green, GLshort blue); +GLAPI PFNGLSECONDARYCOLOR3SPROC glad_glSecondaryColor3s; +#define glSecondaryColor3s glad_glSecondaryColor3s +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3SVPROC)(const GLshort *v); +GLAPI PFNGLSECONDARYCOLOR3SVPROC glad_glSecondaryColor3sv; +#define glSecondaryColor3sv glad_glSecondaryColor3sv +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UBPROC)(GLubyte red, GLubyte green, GLubyte blue); +GLAPI PFNGLSECONDARYCOLOR3UBPROC glad_glSecondaryColor3ub; +#define glSecondaryColor3ub glad_glSecondaryColor3ub +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UBVPROC)(const GLubyte *v); +GLAPI PFNGLSECONDARYCOLOR3UBVPROC glad_glSecondaryColor3ubv; +#define glSecondaryColor3ubv glad_glSecondaryColor3ubv +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UIPROC)(GLuint red, GLuint green, GLuint blue); +GLAPI PFNGLSECONDARYCOLOR3UIPROC glad_glSecondaryColor3ui; +#define glSecondaryColor3ui glad_glSecondaryColor3ui +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UIVPROC)(const GLuint *v); +GLAPI PFNGLSECONDARYCOLOR3UIVPROC glad_glSecondaryColor3uiv; +#define glSecondaryColor3uiv glad_glSecondaryColor3uiv +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3USPROC)(GLushort red, GLushort green, GLushort blue); +GLAPI PFNGLSECONDARYCOLOR3USPROC glad_glSecondaryColor3us; +#define glSecondaryColor3us glad_glSecondaryColor3us +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3USVPROC)(const GLushort *v); +GLAPI PFNGLSECONDARYCOLOR3USVPROC glad_glSecondaryColor3usv; +#define glSecondaryColor3usv glad_glSecondaryColor3usv +typedef void (APIENTRYP PFNGLSECONDARYCOLORPOINTERPROC)(GLint size, GLenum type, GLsizei stride, const void *pointer); +GLAPI PFNGLSECONDARYCOLORPOINTERPROC glad_glSecondaryColorPointer; +#define glSecondaryColorPointer glad_glSecondaryColorPointer +typedef void (APIENTRYP PFNGLWINDOWPOS2DPROC)(GLdouble x, GLdouble y); +GLAPI PFNGLWINDOWPOS2DPROC glad_glWindowPos2d; +#define glWindowPos2d glad_glWindowPos2d +typedef void (APIENTRYP PFNGLWINDOWPOS2DVPROC)(const GLdouble *v); +GLAPI PFNGLWINDOWPOS2DVPROC glad_glWindowPos2dv; +#define glWindowPos2dv glad_glWindowPos2dv +typedef void (APIENTRYP PFNGLWINDOWPOS2FPROC)(GLfloat x, GLfloat y); +GLAPI PFNGLWINDOWPOS2FPROC glad_glWindowPos2f; +#define glWindowPos2f glad_glWindowPos2f +typedef void (APIENTRYP PFNGLWINDOWPOS2FVPROC)(const GLfloat *v); +GLAPI PFNGLWINDOWPOS2FVPROC glad_glWindowPos2fv; +#define glWindowPos2fv glad_glWindowPos2fv +typedef void (APIENTRYP PFNGLWINDOWPOS2IPROC)(GLint x, GLint y); +GLAPI PFNGLWINDOWPOS2IPROC glad_glWindowPos2i; +#define glWindowPos2i glad_glWindowPos2i +typedef void (APIENTRYP PFNGLWINDOWPOS2IVPROC)(const GLint *v); +GLAPI PFNGLWINDOWPOS2IVPROC glad_glWindowPos2iv; +#define glWindowPos2iv glad_glWindowPos2iv +typedef void (APIENTRYP PFNGLWINDOWPOS2SPROC)(GLshort x, GLshort y); +GLAPI PFNGLWINDOWPOS2SPROC glad_glWindowPos2s; +#define glWindowPos2s glad_glWindowPos2s +typedef void (APIENTRYP PFNGLWINDOWPOS2SVPROC)(const GLshort *v); +GLAPI PFNGLWINDOWPOS2SVPROC glad_glWindowPos2sv; +#define glWindowPos2sv glad_glWindowPos2sv +typedef void (APIENTRYP PFNGLWINDOWPOS3DPROC)(GLdouble x, GLdouble y, GLdouble z); +GLAPI PFNGLWINDOWPOS3DPROC glad_glWindowPos3d; +#define glWindowPos3d glad_glWindowPos3d +typedef void (APIENTRYP PFNGLWINDOWPOS3DVPROC)(const GLdouble *v); +GLAPI PFNGLWINDOWPOS3DVPROC glad_glWindowPos3dv; +#define glWindowPos3dv glad_glWindowPos3dv +typedef void (APIENTRYP PFNGLWINDOWPOS3FPROC)(GLfloat x, GLfloat y, GLfloat z); +GLAPI PFNGLWINDOWPOS3FPROC glad_glWindowPos3f; +#define glWindowPos3f glad_glWindowPos3f +typedef void (APIENTRYP PFNGLWINDOWPOS3FVPROC)(const GLfloat *v); +GLAPI PFNGLWINDOWPOS3FVPROC glad_glWindowPos3fv; +#define glWindowPos3fv glad_glWindowPos3fv +typedef void (APIENTRYP PFNGLWINDOWPOS3IPROC)(GLint x, GLint y, GLint z); +GLAPI PFNGLWINDOWPOS3IPROC glad_glWindowPos3i; +#define glWindowPos3i glad_glWindowPos3i +typedef void (APIENTRYP PFNGLWINDOWPOS3IVPROC)(const GLint *v); +GLAPI PFNGLWINDOWPOS3IVPROC glad_glWindowPos3iv; +#define glWindowPos3iv glad_glWindowPos3iv +typedef void (APIENTRYP PFNGLWINDOWPOS3SPROC)(GLshort x, GLshort y, GLshort z); +GLAPI PFNGLWINDOWPOS3SPROC glad_glWindowPos3s; +#define glWindowPos3s glad_glWindowPos3s +typedef void (APIENTRYP PFNGLWINDOWPOS3SVPROC)(const GLshort *v); +GLAPI PFNGLWINDOWPOS3SVPROC glad_glWindowPos3sv; +#define glWindowPos3sv glad_glWindowPos3sv +typedef void (APIENTRYP PFNGLBLENDCOLORPROC)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); +GLAPI PFNGLBLENDCOLORPROC glad_glBlendColor; +#define glBlendColor glad_glBlendColor +typedef void (APIENTRYP PFNGLBLENDEQUATIONPROC)(GLenum mode); +GLAPI PFNGLBLENDEQUATIONPROC glad_glBlendEquation; +#define glBlendEquation glad_glBlendEquation +#endif +#ifndef GL_VERSION_1_5 +#define GL_VERSION_1_5 1 +GLAPI int GLAD_GL_VERSION_1_5; +typedef void (APIENTRYP PFNGLGENQUERIESPROC)(GLsizei n, GLuint *ids); +GLAPI PFNGLGENQUERIESPROC glad_glGenQueries; +#define glGenQueries glad_glGenQueries +typedef void (APIENTRYP PFNGLDELETEQUERIESPROC)(GLsizei n, const GLuint *ids); +GLAPI PFNGLDELETEQUERIESPROC glad_glDeleteQueries; +#define glDeleteQueries glad_glDeleteQueries +typedef GLboolean (APIENTRYP PFNGLISQUERYPROC)(GLuint id); +GLAPI PFNGLISQUERYPROC glad_glIsQuery; +#define glIsQuery glad_glIsQuery +typedef void (APIENTRYP PFNGLBEGINQUERYPROC)(GLenum target, GLuint id); +GLAPI PFNGLBEGINQUERYPROC glad_glBeginQuery; +#define glBeginQuery glad_glBeginQuery +typedef void (APIENTRYP PFNGLENDQUERYPROC)(GLenum target); +GLAPI PFNGLENDQUERYPROC glad_glEndQuery; +#define glEndQuery glad_glEndQuery +typedef void (APIENTRYP PFNGLGETQUERYIVPROC)(GLenum target, GLenum pname, GLint *params); +GLAPI PFNGLGETQUERYIVPROC glad_glGetQueryiv; +#define glGetQueryiv glad_glGetQueryiv +typedef void (APIENTRYP PFNGLGETQUERYOBJECTIVPROC)(GLuint id, GLenum pname, GLint *params); +GLAPI PFNGLGETQUERYOBJECTIVPROC glad_glGetQueryObjectiv; +#define glGetQueryObjectiv glad_glGetQueryObjectiv +typedef void (APIENTRYP PFNGLGETQUERYOBJECTUIVPROC)(GLuint id, GLenum pname, GLuint *params); +GLAPI PFNGLGETQUERYOBJECTUIVPROC glad_glGetQueryObjectuiv; +#define glGetQueryObjectuiv glad_glGetQueryObjectuiv +typedef void (APIENTRYP PFNGLBINDBUFFERPROC)(GLenum target, GLuint buffer); +GLAPI PFNGLBINDBUFFERPROC glad_glBindBuffer; +#define glBindBuffer glad_glBindBuffer +typedef void (APIENTRYP PFNGLDELETEBUFFERSPROC)(GLsizei n, const GLuint *buffers); +GLAPI PFNGLDELETEBUFFERSPROC glad_glDeleteBuffers; +#define glDeleteBuffers glad_glDeleteBuffers +typedef void (APIENTRYP PFNGLGENBUFFERSPROC)(GLsizei n, GLuint *buffers); +GLAPI PFNGLGENBUFFERSPROC glad_glGenBuffers; +#define glGenBuffers glad_glGenBuffers +typedef GLboolean (APIENTRYP PFNGLISBUFFERPROC)(GLuint buffer); +GLAPI PFNGLISBUFFERPROC glad_glIsBuffer; +#define glIsBuffer glad_glIsBuffer +typedef void (APIENTRYP PFNGLBUFFERDATAPROC)(GLenum target, GLsizeiptr size, const void *data, GLenum usage); +GLAPI PFNGLBUFFERDATAPROC glad_glBufferData; +#define glBufferData glad_glBufferData +typedef void (APIENTRYP PFNGLBUFFERSUBDATAPROC)(GLenum target, GLintptr offset, GLsizeiptr size, const void *data); +GLAPI PFNGLBUFFERSUBDATAPROC glad_glBufferSubData; +#define glBufferSubData glad_glBufferSubData +typedef void (APIENTRYP PFNGLGETBUFFERSUBDATAPROC)(GLenum target, GLintptr offset, GLsizeiptr size, void *data); +GLAPI PFNGLGETBUFFERSUBDATAPROC glad_glGetBufferSubData; +#define glGetBufferSubData glad_glGetBufferSubData +typedef void * (APIENTRYP PFNGLMAPBUFFERPROC)(GLenum target, GLenum access); +GLAPI PFNGLMAPBUFFERPROC glad_glMapBuffer; +#define glMapBuffer glad_glMapBuffer +typedef GLboolean (APIENTRYP PFNGLUNMAPBUFFERPROC)(GLenum target); +GLAPI PFNGLUNMAPBUFFERPROC glad_glUnmapBuffer; +#define glUnmapBuffer glad_glUnmapBuffer +typedef void (APIENTRYP PFNGLGETBUFFERPARAMETERIVPROC)(GLenum target, GLenum pname, GLint *params); +GLAPI PFNGLGETBUFFERPARAMETERIVPROC glad_glGetBufferParameteriv; +#define glGetBufferParameteriv glad_glGetBufferParameteriv +typedef void (APIENTRYP PFNGLGETBUFFERPOINTERVPROC)(GLenum target, GLenum pname, void **params); +GLAPI PFNGLGETBUFFERPOINTERVPROC glad_glGetBufferPointerv; +#define glGetBufferPointerv glad_glGetBufferPointerv +#endif +#ifndef GL_VERSION_2_0 +#define GL_VERSION_2_0 1 +GLAPI int GLAD_GL_VERSION_2_0; +typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEPROC)(GLenum modeRGB, GLenum modeAlpha); +GLAPI PFNGLBLENDEQUATIONSEPARATEPROC glad_glBlendEquationSeparate; +#define glBlendEquationSeparate glad_glBlendEquationSeparate +typedef void (APIENTRYP PFNGLDRAWBUFFERSPROC)(GLsizei n, const GLenum *bufs); +GLAPI PFNGLDRAWBUFFERSPROC glad_glDrawBuffers; +#define glDrawBuffers glad_glDrawBuffers +typedef void (APIENTRYP PFNGLSTENCILOPSEPARATEPROC)(GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass); +GLAPI PFNGLSTENCILOPSEPARATEPROC glad_glStencilOpSeparate; +#define glStencilOpSeparate glad_glStencilOpSeparate +typedef void (APIENTRYP PFNGLSTENCILFUNCSEPARATEPROC)(GLenum face, GLenum func, GLint ref, GLuint mask); +GLAPI PFNGLSTENCILFUNCSEPARATEPROC glad_glStencilFuncSeparate; +#define glStencilFuncSeparate glad_glStencilFuncSeparate +typedef void (APIENTRYP PFNGLSTENCILMASKSEPARATEPROC)(GLenum face, GLuint mask); +GLAPI PFNGLSTENCILMASKSEPARATEPROC glad_glStencilMaskSeparate; +#define glStencilMaskSeparate glad_glStencilMaskSeparate +typedef void (APIENTRYP PFNGLATTACHSHADERPROC)(GLuint program, GLuint shader); +GLAPI PFNGLATTACHSHADERPROC glad_glAttachShader; +#define glAttachShader glad_glAttachShader +typedef void (APIENTRYP PFNGLBINDATTRIBLOCATIONPROC)(GLuint program, GLuint index, const GLchar *name); +GLAPI PFNGLBINDATTRIBLOCATIONPROC glad_glBindAttribLocation; +#define glBindAttribLocation glad_glBindAttribLocation +typedef void (APIENTRYP PFNGLCOMPILESHADERPROC)(GLuint shader); +GLAPI PFNGLCOMPILESHADERPROC glad_glCompileShader; +#define glCompileShader glad_glCompileShader +typedef GLuint (APIENTRYP PFNGLCREATEPROGRAMPROC)(void); +GLAPI PFNGLCREATEPROGRAMPROC glad_glCreateProgram; +#define glCreateProgram glad_glCreateProgram +typedef GLuint (APIENTRYP PFNGLCREATESHADERPROC)(GLenum type); +GLAPI PFNGLCREATESHADERPROC glad_glCreateShader; +#define glCreateShader glad_glCreateShader +typedef void (APIENTRYP PFNGLDELETEPROGRAMPROC)(GLuint program); +GLAPI PFNGLDELETEPROGRAMPROC glad_glDeleteProgram; +#define glDeleteProgram glad_glDeleteProgram +typedef void (APIENTRYP PFNGLDELETESHADERPROC)(GLuint shader); +GLAPI PFNGLDELETESHADERPROC glad_glDeleteShader; +#define glDeleteShader glad_glDeleteShader +typedef void (APIENTRYP PFNGLDETACHSHADERPROC)(GLuint program, GLuint shader); +GLAPI PFNGLDETACHSHADERPROC glad_glDetachShader; +#define glDetachShader glad_glDetachShader +typedef void (APIENTRYP PFNGLDISABLEVERTEXATTRIBARRAYPROC)(GLuint index); +GLAPI PFNGLDISABLEVERTEXATTRIBARRAYPROC glad_glDisableVertexAttribArray; +#define glDisableVertexAttribArray glad_glDisableVertexAttribArray +typedef void (APIENTRYP PFNGLENABLEVERTEXATTRIBARRAYPROC)(GLuint index); +GLAPI PFNGLENABLEVERTEXATTRIBARRAYPROC glad_glEnableVertexAttribArray; +#define glEnableVertexAttribArray glad_glEnableVertexAttribArray +typedef void (APIENTRYP PFNGLGETACTIVEATTRIBPROC)(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); +GLAPI PFNGLGETACTIVEATTRIBPROC glad_glGetActiveAttrib; +#define glGetActiveAttrib glad_glGetActiveAttrib +typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMPROC)(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); +GLAPI PFNGLGETACTIVEUNIFORMPROC glad_glGetActiveUniform; +#define glGetActiveUniform glad_glGetActiveUniform +typedef void (APIENTRYP PFNGLGETATTACHEDSHADERSPROC)(GLuint program, GLsizei maxCount, GLsizei *count, GLuint *shaders); +GLAPI PFNGLGETATTACHEDSHADERSPROC glad_glGetAttachedShaders; +#define glGetAttachedShaders glad_glGetAttachedShaders +typedef GLint (APIENTRYP PFNGLGETATTRIBLOCATIONPROC)(GLuint program, const GLchar *name); +GLAPI PFNGLGETATTRIBLOCATIONPROC glad_glGetAttribLocation; +#define glGetAttribLocation glad_glGetAttribLocation +typedef void (APIENTRYP PFNGLGETPROGRAMIVPROC)(GLuint program, GLenum pname, GLint *params); +GLAPI PFNGLGETPROGRAMIVPROC glad_glGetProgramiv; +#define glGetProgramiv glad_glGetProgramiv +typedef void (APIENTRYP PFNGLGETPROGRAMINFOLOGPROC)(GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +GLAPI PFNGLGETPROGRAMINFOLOGPROC glad_glGetProgramInfoLog; +#define glGetProgramInfoLog glad_glGetProgramInfoLog +typedef void (APIENTRYP PFNGLGETSHADERIVPROC)(GLuint shader, GLenum pname, GLint *params); +GLAPI PFNGLGETSHADERIVPROC glad_glGetShaderiv; +#define glGetShaderiv glad_glGetShaderiv +typedef void (APIENTRYP PFNGLGETSHADERINFOLOGPROC)(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +GLAPI PFNGLGETSHADERINFOLOGPROC glad_glGetShaderInfoLog; +#define glGetShaderInfoLog glad_glGetShaderInfoLog +typedef void (APIENTRYP PFNGLGETSHADERSOURCEPROC)(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source); +GLAPI PFNGLGETSHADERSOURCEPROC glad_glGetShaderSource; +#define glGetShaderSource glad_glGetShaderSource +typedef GLint (APIENTRYP PFNGLGETUNIFORMLOCATIONPROC)(GLuint program, const GLchar *name); +GLAPI PFNGLGETUNIFORMLOCATIONPROC glad_glGetUniformLocation; +#define glGetUniformLocation glad_glGetUniformLocation +typedef void (APIENTRYP PFNGLGETUNIFORMFVPROC)(GLuint program, GLint location, GLfloat *params); +GLAPI PFNGLGETUNIFORMFVPROC glad_glGetUniformfv; +#define glGetUniformfv glad_glGetUniformfv +typedef void (APIENTRYP PFNGLGETUNIFORMIVPROC)(GLuint program, GLint location, GLint *params); +GLAPI PFNGLGETUNIFORMIVPROC glad_glGetUniformiv; +#define glGetUniformiv glad_glGetUniformiv +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBDVPROC)(GLuint index, GLenum pname, GLdouble *params); +GLAPI PFNGLGETVERTEXATTRIBDVPROC glad_glGetVertexAttribdv; +#define glGetVertexAttribdv glad_glGetVertexAttribdv +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBFVPROC)(GLuint index, GLenum pname, GLfloat *params); +GLAPI PFNGLGETVERTEXATTRIBFVPROC glad_glGetVertexAttribfv; +#define glGetVertexAttribfv glad_glGetVertexAttribfv +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIVPROC)(GLuint index, GLenum pname, GLint *params); +GLAPI PFNGLGETVERTEXATTRIBIVPROC glad_glGetVertexAttribiv; +#define glGetVertexAttribiv glad_glGetVertexAttribiv +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVPROC)(GLuint index, GLenum pname, void **pointer); +GLAPI PFNGLGETVERTEXATTRIBPOINTERVPROC glad_glGetVertexAttribPointerv; +#define glGetVertexAttribPointerv glad_glGetVertexAttribPointerv +typedef GLboolean (APIENTRYP PFNGLISPROGRAMPROC)(GLuint program); +GLAPI PFNGLISPROGRAMPROC glad_glIsProgram; +#define glIsProgram glad_glIsProgram +typedef GLboolean (APIENTRYP PFNGLISSHADERPROC)(GLuint shader); +GLAPI PFNGLISSHADERPROC glad_glIsShader; +#define glIsShader glad_glIsShader +typedef void (APIENTRYP PFNGLLINKPROGRAMPROC)(GLuint program); +GLAPI PFNGLLINKPROGRAMPROC glad_glLinkProgram; +#define glLinkProgram glad_glLinkProgram +typedef void (APIENTRYP PFNGLSHADERSOURCEPROC)(GLuint shader, GLsizei count, const GLchar *const*string, const GLint *length); +GLAPI PFNGLSHADERSOURCEPROC glad_glShaderSource; +#define glShaderSource glad_glShaderSource +typedef void (APIENTRYP PFNGLUSEPROGRAMPROC)(GLuint program); +GLAPI PFNGLUSEPROGRAMPROC glad_glUseProgram; +#define glUseProgram glad_glUseProgram +typedef void (APIENTRYP PFNGLUNIFORM1FPROC)(GLint location, GLfloat v0); +GLAPI PFNGLUNIFORM1FPROC glad_glUniform1f; +#define glUniform1f glad_glUniform1f +typedef void (APIENTRYP PFNGLUNIFORM2FPROC)(GLint location, GLfloat v0, GLfloat v1); +GLAPI PFNGLUNIFORM2FPROC glad_glUniform2f; +#define glUniform2f glad_glUniform2f +typedef void (APIENTRYP PFNGLUNIFORM3FPROC)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2); +GLAPI PFNGLUNIFORM3FPROC glad_glUniform3f; +#define glUniform3f glad_glUniform3f +typedef void (APIENTRYP PFNGLUNIFORM4FPROC)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); +GLAPI PFNGLUNIFORM4FPROC glad_glUniform4f; +#define glUniform4f glad_glUniform4f +typedef void (APIENTRYP PFNGLUNIFORM1IPROC)(GLint location, GLint v0); +GLAPI PFNGLUNIFORM1IPROC glad_glUniform1i; +#define glUniform1i glad_glUniform1i +typedef void (APIENTRYP PFNGLUNIFORM2IPROC)(GLint location, GLint v0, GLint v1); +GLAPI PFNGLUNIFORM2IPROC glad_glUniform2i; +#define glUniform2i glad_glUniform2i +typedef void (APIENTRYP PFNGLUNIFORM3IPROC)(GLint location, GLint v0, GLint v1, GLint v2); +GLAPI PFNGLUNIFORM3IPROC glad_glUniform3i; +#define glUniform3i glad_glUniform3i +typedef void (APIENTRYP PFNGLUNIFORM4IPROC)(GLint location, GLint v0, GLint v1, GLint v2, GLint v3); +GLAPI PFNGLUNIFORM4IPROC glad_glUniform4i; +#define glUniform4i glad_glUniform4i +typedef void (APIENTRYP PFNGLUNIFORM1FVPROC)(GLint location, GLsizei count, const GLfloat *value); +GLAPI PFNGLUNIFORM1FVPROC glad_glUniform1fv; +#define glUniform1fv glad_glUniform1fv +typedef void (APIENTRYP PFNGLUNIFORM2FVPROC)(GLint location, GLsizei count, const GLfloat *value); +GLAPI PFNGLUNIFORM2FVPROC glad_glUniform2fv; +#define glUniform2fv glad_glUniform2fv +typedef void (APIENTRYP PFNGLUNIFORM3FVPROC)(GLint location, GLsizei count, const GLfloat *value); +GLAPI PFNGLUNIFORM3FVPROC glad_glUniform3fv; +#define glUniform3fv glad_glUniform3fv +typedef void (APIENTRYP PFNGLUNIFORM4FVPROC)(GLint location, GLsizei count, const GLfloat *value); +GLAPI PFNGLUNIFORM4FVPROC glad_glUniform4fv; +#define glUniform4fv glad_glUniform4fv +typedef void (APIENTRYP PFNGLUNIFORM1IVPROC)(GLint location, GLsizei count, const GLint *value); +GLAPI PFNGLUNIFORM1IVPROC glad_glUniform1iv; +#define glUniform1iv glad_glUniform1iv +typedef void (APIENTRYP PFNGLUNIFORM2IVPROC)(GLint location, GLsizei count, const GLint *value); +GLAPI PFNGLUNIFORM2IVPROC glad_glUniform2iv; +#define glUniform2iv glad_glUniform2iv +typedef void (APIENTRYP PFNGLUNIFORM3IVPROC)(GLint location, GLsizei count, const GLint *value); +GLAPI PFNGLUNIFORM3IVPROC glad_glUniform3iv; +#define glUniform3iv glad_glUniform3iv +typedef void (APIENTRYP PFNGLUNIFORM4IVPROC)(GLint location, GLsizei count, const GLint *value); +GLAPI PFNGLUNIFORM4IVPROC glad_glUniform4iv; +#define glUniform4iv glad_glUniform4iv +typedef void (APIENTRYP PFNGLUNIFORMMATRIX2FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI PFNGLUNIFORMMATRIX2FVPROC glad_glUniformMatrix2fv; +#define glUniformMatrix2fv glad_glUniformMatrix2fv +typedef void (APIENTRYP PFNGLUNIFORMMATRIX3FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI PFNGLUNIFORMMATRIX3FVPROC glad_glUniformMatrix3fv; +#define glUniformMatrix3fv glad_glUniformMatrix3fv +typedef void (APIENTRYP PFNGLUNIFORMMATRIX4FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI PFNGLUNIFORMMATRIX4FVPROC glad_glUniformMatrix4fv; +#define glUniformMatrix4fv glad_glUniformMatrix4fv +typedef void (APIENTRYP PFNGLVALIDATEPROGRAMPROC)(GLuint program); +GLAPI PFNGLVALIDATEPROGRAMPROC glad_glValidateProgram; +#define glValidateProgram glad_glValidateProgram +typedef void (APIENTRYP PFNGLVERTEXATTRIB1DPROC)(GLuint index, GLdouble x); +GLAPI PFNGLVERTEXATTRIB1DPROC glad_glVertexAttrib1d; +#define glVertexAttrib1d glad_glVertexAttrib1d +typedef void (APIENTRYP PFNGLVERTEXATTRIB1DVPROC)(GLuint index, const GLdouble *v); +GLAPI PFNGLVERTEXATTRIB1DVPROC glad_glVertexAttrib1dv; +#define glVertexAttrib1dv glad_glVertexAttrib1dv +typedef void (APIENTRYP PFNGLVERTEXATTRIB1FPROC)(GLuint index, GLfloat x); +GLAPI PFNGLVERTEXATTRIB1FPROC glad_glVertexAttrib1f; +#define glVertexAttrib1f glad_glVertexAttrib1f +typedef void (APIENTRYP PFNGLVERTEXATTRIB1FVPROC)(GLuint index, const GLfloat *v); +GLAPI PFNGLVERTEXATTRIB1FVPROC glad_glVertexAttrib1fv; +#define glVertexAttrib1fv glad_glVertexAttrib1fv +typedef void (APIENTRYP PFNGLVERTEXATTRIB1SPROC)(GLuint index, GLshort x); +GLAPI PFNGLVERTEXATTRIB1SPROC glad_glVertexAttrib1s; +#define glVertexAttrib1s glad_glVertexAttrib1s +typedef void (APIENTRYP PFNGLVERTEXATTRIB1SVPROC)(GLuint index, const GLshort *v); +GLAPI PFNGLVERTEXATTRIB1SVPROC glad_glVertexAttrib1sv; +#define glVertexAttrib1sv glad_glVertexAttrib1sv +typedef void (APIENTRYP PFNGLVERTEXATTRIB2DPROC)(GLuint index, GLdouble x, GLdouble y); +GLAPI PFNGLVERTEXATTRIB2DPROC glad_glVertexAttrib2d; +#define glVertexAttrib2d glad_glVertexAttrib2d +typedef void (APIENTRYP PFNGLVERTEXATTRIB2DVPROC)(GLuint index, const GLdouble *v); +GLAPI PFNGLVERTEXATTRIB2DVPROC glad_glVertexAttrib2dv; +#define glVertexAttrib2dv glad_glVertexAttrib2dv +typedef void (APIENTRYP PFNGLVERTEXATTRIB2FPROC)(GLuint index, GLfloat x, GLfloat y); +GLAPI PFNGLVERTEXATTRIB2FPROC glad_glVertexAttrib2f; +#define glVertexAttrib2f glad_glVertexAttrib2f +typedef void (APIENTRYP PFNGLVERTEXATTRIB2FVPROC)(GLuint index, const GLfloat *v); +GLAPI PFNGLVERTEXATTRIB2FVPROC glad_glVertexAttrib2fv; +#define glVertexAttrib2fv glad_glVertexAttrib2fv +typedef void (APIENTRYP PFNGLVERTEXATTRIB2SPROC)(GLuint index, GLshort x, GLshort y); +GLAPI PFNGLVERTEXATTRIB2SPROC glad_glVertexAttrib2s; +#define glVertexAttrib2s glad_glVertexAttrib2s +typedef void (APIENTRYP PFNGLVERTEXATTRIB2SVPROC)(GLuint index, const GLshort *v); +GLAPI PFNGLVERTEXATTRIB2SVPROC glad_glVertexAttrib2sv; +#define glVertexAttrib2sv glad_glVertexAttrib2sv +typedef void (APIENTRYP PFNGLVERTEXATTRIB3DPROC)(GLuint index, GLdouble x, GLdouble y, GLdouble z); +GLAPI PFNGLVERTEXATTRIB3DPROC glad_glVertexAttrib3d; +#define glVertexAttrib3d glad_glVertexAttrib3d +typedef void (APIENTRYP PFNGLVERTEXATTRIB3DVPROC)(GLuint index, const GLdouble *v); +GLAPI PFNGLVERTEXATTRIB3DVPROC glad_glVertexAttrib3dv; +#define glVertexAttrib3dv glad_glVertexAttrib3dv +typedef void (APIENTRYP PFNGLVERTEXATTRIB3FPROC)(GLuint index, GLfloat x, GLfloat y, GLfloat z); +GLAPI PFNGLVERTEXATTRIB3FPROC glad_glVertexAttrib3f; +#define glVertexAttrib3f glad_glVertexAttrib3f +typedef void (APIENTRYP PFNGLVERTEXATTRIB3FVPROC)(GLuint index, const GLfloat *v); +GLAPI PFNGLVERTEXATTRIB3FVPROC glad_glVertexAttrib3fv; +#define glVertexAttrib3fv glad_glVertexAttrib3fv +typedef void (APIENTRYP PFNGLVERTEXATTRIB3SPROC)(GLuint index, GLshort x, GLshort y, GLshort z); +GLAPI PFNGLVERTEXATTRIB3SPROC glad_glVertexAttrib3s; +#define glVertexAttrib3s glad_glVertexAttrib3s +typedef void (APIENTRYP PFNGLVERTEXATTRIB3SVPROC)(GLuint index, const GLshort *v); +GLAPI PFNGLVERTEXATTRIB3SVPROC glad_glVertexAttrib3sv; +#define glVertexAttrib3sv glad_glVertexAttrib3sv +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NBVPROC)(GLuint index, const GLbyte *v); +GLAPI PFNGLVERTEXATTRIB4NBVPROC glad_glVertexAttrib4Nbv; +#define glVertexAttrib4Nbv glad_glVertexAttrib4Nbv +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NIVPROC)(GLuint index, const GLint *v); +GLAPI PFNGLVERTEXATTRIB4NIVPROC glad_glVertexAttrib4Niv; +#define glVertexAttrib4Niv glad_glVertexAttrib4Niv +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NSVPROC)(GLuint index, const GLshort *v); +GLAPI PFNGLVERTEXATTRIB4NSVPROC glad_glVertexAttrib4Nsv; +#define glVertexAttrib4Nsv glad_glVertexAttrib4Nsv +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBPROC)(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); +GLAPI PFNGLVERTEXATTRIB4NUBPROC glad_glVertexAttrib4Nub; +#define glVertexAttrib4Nub glad_glVertexAttrib4Nub +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBVPROC)(GLuint index, const GLubyte *v); +GLAPI PFNGLVERTEXATTRIB4NUBVPROC glad_glVertexAttrib4Nubv; +#define glVertexAttrib4Nubv glad_glVertexAttrib4Nubv +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUIVPROC)(GLuint index, const GLuint *v); +GLAPI PFNGLVERTEXATTRIB4NUIVPROC glad_glVertexAttrib4Nuiv; +#define glVertexAttrib4Nuiv glad_glVertexAttrib4Nuiv +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUSVPROC)(GLuint index, const GLushort *v); +GLAPI PFNGLVERTEXATTRIB4NUSVPROC glad_glVertexAttrib4Nusv; +#define glVertexAttrib4Nusv glad_glVertexAttrib4Nusv +typedef void (APIENTRYP PFNGLVERTEXATTRIB4BVPROC)(GLuint index, const GLbyte *v); +GLAPI PFNGLVERTEXATTRIB4BVPROC glad_glVertexAttrib4bv; +#define glVertexAttrib4bv glad_glVertexAttrib4bv +typedef void (APIENTRYP PFNGLVERTEXATTRIB4DPROC)(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +GLAPI PFNGLVERTEXATTRIB4DPROC glad_glVertexAttrib4d; +#define glVertexAttrib4d glad_glVertexAttrib4d +typedef void (APIENTRYP PFNGLVERTEXATTRIB4DVPROC)(GLuint index, const GLdouble *v); +GLAPI PFNGLVERTEXATTRIB4DVPROC glad_glVertexAttrib4dv; +#define glVertexAttrib4dv glad_glVertexAttrib4dv +typedef void (APIENTRYP PFNGLVERTEXATTRIB4FPROC)(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +GLAPI PFNGLVERTEXATTRIB4FPROC glad_glVertexAttrib4f; +#define glVertexAttrib4f glad_glVertexAttrib4f +typedef void (APIENTRYP PFNGLVERTEXATTRIB4FVPROC)(GLuint index, const GLfloat *v); +GLAPI PFNGLVERTEXATTRIB4FVPROC glad_glVertexAttrib4fv; +#define glVertexAttrib4fv glad_glVertexAttrib4fv +typedef void (APIENTRYP PFNGLVERTEXATTRIB4IVPROC)(GLuint index, const GLint *v); +GLAPI PFNGLVERTEXATTRIB4IVPROC glad_glVertexAttrib4iv; +#define glVertexAttrib4iv glad_glVertexAttrib4iv +typedef void (APIENTRYP PFNGLVERTEXATTRIB4SPROC)(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); +GLAPI PFNGLVERTEXATTRIB4SPROC glad_glVertexAttrib4s; +#define glVertexAttrib4s glad_glVertexAttrib4s +typedef void (APIENTRYP PFNGLVERTEXATTRIB4SVPROC)(GLuint index, const GLshort *v); +GLAPI PFNGLVERTEXATTRIB4SVPROC glad_glVertexAttrib4sv; +#define glVertexAttrib4sv glad_glVertexAttrib4sv +typedef void (APIENTRYP PFNGLVERTEXATTRIB4UBVPROC)(GLuint index, const GLubyte *v); +GLAPI PFNGLVERTEXATTRIB4UBVPROC glad_glVertexAttrib4ubv; +#define glVertexAttrib4ubv glad_glVertexAttrib4ubv +typedef void (APIENTRYP PFNGLVERTEXATTRIB4UIVPROC)(GLuint index, const GLuint *v); +GLAPI PFNGLVERTEXATTRIB4UIVPROC glad_glVertexAttrib4uiv; +#define glVertexAttrib4uiv glad_glVertexAttrib4uiv +typedef void (APIENTRYP PFNGLVERTEXATTRIB4USVPROC)(GLuint index, const GLushort *v); +GLAPI PFNGLVERTEXATTRIB4USVPROC glad_glVertexAttrib4usv; +#define glVertexAttrib4usv glad_glVertexAttrib4usv +typedef void (APIENTRYP PFNGLVERTEXATTRIBPOINTERPROC)(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer); +GLAPI PFNGLVERTEXATTRIBPOINTERPROC glad_glVertexAttribPointer; +#define glVertexAttribPointer glad_glVertexAttribPointer +#endif +#ifndef GL_VERSION_2_1 +#define GL_VERSION_2_1 1 +GLAPI int GLAD_GL_VERSION_2_1; +typedef void (APIENTRYP PFNGLUNIFORMMATRIX2X3FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI PFNGLUNIFORMMATRIX2X3FVPROC glad_glUniformMatrix2x3fv; +#define glUniformMatrix2x3fv glad_glUniformMatrix2x3fv +typedef void (APIENTRYP PFNGLUNIFORMMATRIX3X2FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI PFNGLUNIFORMMATRIX3X2FVPROC glad_glUniformMatrix3x2fv; +#define glUniformMatrix3x2fv glad_glUniformMatrix3x2fv +typedef void (APIENTRYP PFNGLUNIFORMMATRIX2X4FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI PFNGLUNIFORMMATRIX2X4FVPROC glad_glUniformMatrix2x4fv; +#define glUniformMatrix2x4fv glad_glUniformMatrix2x4fv +typedef void (APIENTRYP PFNGLUNIFORMMATRIX4X2FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI PFNGLUNIFORMMATRIX4X2FVPROC glad_glUniformMatrix4x2fv; +#define glUniformMatrix4x2fv glad_glUniformMatrix4x2fv +typedef void (APIENTRYP PFNGLUNIFORMMATRIX3X4FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI PFNGLUNIFORMMATRIX3X4FVPROC glad_glUniformMatrix3x4fv; +#define glUniformMatrix3x4fv glad_glUniformMatrix3x4fv +typedef void (APIENTRYP PFNGLUNIFORMMATRIX4X3FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI PFNGLUNIFORMMATRIX4X3FVPROC glad_glUniformMatrix4x3fv; +#define glUniformMatrix4x3fv glad_glUniformMatrix4x3fv +#endif +#ifndef GL_EXT_EGL_image_storage +#define GL_EXT_EGL_image_storage 1 +GLAPI int GLAD_GL_EXT_EGL_image_storage; +typedef void (APIENTRYP PFNGLEGLIMAGETARGETTEXSTORAGEEXTPROC)(GLenum target, GLeglImageOES image, const GLint* attrib_list); +GLAPI PFNGLEGLIMAGETARGETTEXSTORAGEEXTPROC glad_glEGLImageTargetTexStorageEXT; +#define glEGLImageTargetTexStorageEXT glad_glEGLImageTargetTexStorageEXT +typedef void (APIENTRYP PFNGLEGLIMAGETARGETTEXTURESTORAGEEXTPROC)(GLuint texture, GLeglImageOES image, const GLint* attrib_list); +GLAPI PFNGLEGLIMAGETARGETTEXTURESTORAGEEXTPROC glad_glEGLImageTargetTextureStorageEXT; +#define glEGLImageTargetTextureStorageEXT glad_glEGLImageTargetTextureStorageEXT +#endif +#ifndef GL_EXT_EGL_sync +#define GL_EXT_EGL_sync 1 +GLAPI int GLAD_GL_EXT_EGL_sync; #endif #ifdef __cplusplus diff --git a/glad/src/glad.c b/glad/src/glad.c old mode 100755 new mode 100644 index e307636..d977ee1 --- a/glad/src/glad.c +++ b/glad/src/glad.c @@ -1,23 +1,23 @@ /* - OpenGL ES loader generated by glad 0.1.36 on Sun Mar 1 23:53:39 2026. + OpenGL loader generated by glad 0.1.36 on Sun Mar 15 18:19:37 2026. Language/Generator: C/C++ Specification: gl - APIs: gles1=1.0 + APIs: gl=2.1 Profile: compatibility Extensions: - GL_OES_EGL_image, - GL_OES_EGL_image_external + GL_EXT_EGL_image_storage, + GL_EXT_EGL_sync Loader: True Local files: False Omit khrplatform: False Reproducible: False Commandline: - --profile="compatibility" --api="gles1=1.0" --generator="c" --spec="gl" --extensions="GL_OES_EGL_image,GL_OES_EGL_image_external" + --profile="compatibility" --api="gl=2.1" --generator="c" --spec="gl" --extensions="GL_EXT_EGL_image_storage,GL_EXT_EGL_sync" Online: - https://glad.dav1d.de/#profile=compatibility&language=c&specification=gl&loader=on&api=gles1%3D1.0&extensions=GL_OES_EGL_image&extensions=GL_OES_EGL_image_external + https://glad.dav1d.de/#profile=compatibility&language=c&specification=gl&loader=on&api=gl%3D2.1&extensions=GL_EXT_EGL_image_storage&extensions=GL_EXT_EGL_sync */ #include @@ -25,6 +25,138 @@ #include #include +static void* get_proc(const char *namez); + +#if defined(_WIN32) || defined(__CYGWIN__) +#ifndef _WINDOWS_ +#undef APIENTRY +#endif +#include +static HMODULE libGL; + +typedef void* (APIENTRYP PFNWGLGETPROCADDRESSPROC_PRIVATE)(const char*); +static PFNWGLGETPROCADDRESSPROC_PRIVATE gladGetProcAddressPtr; + +#ifdef _MSC_VER +#ifdef __has_include + #if __has_include() + #define HAVE_WINAPIFAMILY 1 + #endif +#elif _MSC_VER >= 1700 && !_USING_V110_SDK71_ + #define HAVE_WINAPIFAMILY 1 +#endif +#endif + +#ifdef HAVE_WINAPIFAMILY + #include + #if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) && WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) + #define IS_UWP 1 + #endif +#endif + +static +int open_gl(void) { +#ifndef IS_UWP + libGL = LoadLibraryW(L"opengl32.dll"); + if(libGL != NULL) { + void (* tmp)(void); + tmp = (void(*)(void)) GetProcAddress(libGL, "wglGetProcAddress"); + gladGetProcAddressPtr = (PFNWGLGETPROCADDRESSPROC_PRIVATE) tmp; + return gladGetProcAddressPtr != NULL; + } +#endif + + return 0; +} + +static +void close_gl(void) { + if(libGL != NULL) { + FreeLibrary((HMODULE) libGL); + libGL = NULL; + } +} +#else +#include +static void* libGL; + +#if !defined(__APPLE__) && !defined(__HAIKU__) +typedef void* (APIENTRYP PFNGLXGETPROCADDRESSPROC_PRIVATE)(const char*); +static PFNGLXGETPROCADDRESSPROC_PRIVATE gladGetProcAddressPtr; +#endif + +static +int open_gl(void) { +#ifdef __APPLE__ + static const char *NAMES[] = { + "../Frameworks/OpenGL.framework/OpenGL", + "/Library/Frameworks/OpenGL.framework/OpenGL", + "/System/Library/Frameworks/OpenGL.framework/OpenGL", + "/System/Library/Frameworks/OpenGL.framework/Versions/Current/OpenGL" + }; +#else + static const char *NAMES[] = {"libGL.so.1", "libGL.so"}; +#endif + + unsigned int index = 0; + for(index = 0; index < (sizeof(NAMES) / sizeof(NAMES[0])); index++) { + libGL = dlopen(NAMES[index], RTLD_NOW | RTLD_GLOBAL); + + if(libGL != NULL) { +#if defined(__APPLE__) || defined(__HAIKU__) + return 1; +#else + gladGetProcAddressPtr = (PFNGLXGETPROCADDRESSPROC_PRIVATE)dlsym(libGL, + "glXGetProcAddressARB"); + return gladGetProcAddressPtr != NULL; +#endif + } + } + + return 0; +} + +static +void close_gl(void) { + if(libGL != NULL) { + dlclose(libGL); + libGL = NULL; + } +} +#endif + +static +void* get_proc(const char *namez) { + void* result = NULL; + if(libGL == NULL) return NULL; + +#if !defined(__APPLE__) && !defined(__HAIKU__) + if(gladGetProcAddressPtr != NULL) { + result = gladGetProcAddressPtr(namez); + } +#endif + if(result == NULL) { +#if defined(_WIN32) || defined(__CYGWIN__) + result = (void*)GetProcAddress((HMODULE) libGL, namez); +#else + result = dlsym(libGL, namez); +#endif + } + + return result; +} + +int gladLoadGL(void) { + int status = 0; + + if(open_gl()) { + status = gladLoadGLLoader(&get_proc); + close_gl(); + } + + return status; +} + struct gladGLversionStruct GLVersion = { 0, 0 }; #if defined(GL_ES_VERSION_3_0) || defined(GL_VERSION_3_0) @@ -124,320 +256,1158 @@ static int has_ext(const char *ext) { return 0; } -int GLAD_GL_VERSION_ES_CM_1_0 = 0; +int GLAD_GL_VERSION_1_0 = 0; +int GLAD_GL_VERSION_1_1 = 0; +int GLAD_GL_VERSION_1_2 = 0; +int GLAD_GL_VERSION_1_3 = 0; +int GLAD_GL_VERSION_1_4 = 0; +int GLAD_GL_VERSION_1_5 = 0; +int GLAD_GL_VERSION_2_0 = 0; +int GLAD_GL_VERSION_2_1 = 0; +PFNGLACCUMPROC glad_glAccum = NULL; PFNGLACTIVETEXTUREPROC glad_glActiveTexture = NULL; PFNGLALPHAFUNCPROC glad_glAlphaFunc = NULL; -PFNGLALPHAFUNCXPROC glad_glAlphaFuncx = NULL; +PFNGLARETEXTURESRESIDENTPROC glad_glAreTexturesResident = NULL; +PFNGLARRAYELEMENTPROC glad_glArrayElement = NULL; +PFNGLATTACHSHADERPROC glad_glAttachShader = NULL; +PFNGLBEGINPROC glad_glBegin = NULL; +PFNGLBEGINQUERYPROC glad_glBeginQuery = NULL; +PFNGLBINDATTRIBLOCATIONPROC glad_glBindAttribLocation = NULL; PFNGLBINDBUFFERPROC glad_glBindBuffer = NULL; PFNGLBINDTEXTUREPROC glad_glBindTexture = NULL; +PFNGLBITMAPPROC glad_glBitmap = NULL; +PFNGLBLENDCOLORPROC glad_glBlendColor = NULL; +PFNGLBLENDEQUATIONPROC glad_glBlendEquation = NULL; +PFNGLBLENDEQUATIONSEPARATEPROC glad_glBlendEquationSeparate = NULL; PFNGLBLENDFUNCPROC glad_glBlendFunc = NULL; +PFNGLBLENDFUNCSEPARATEPROC glad_glBlendFuncSeparate = NULL; PFNGLBUFFERDATAPROC glad_glBufferData = NULL; PFNGLBUFFERSUBDATAPROC glad_glBufferSubData = NULL; +PFNGLCALLLISTPROC glad_glCallList = NULL; +PFNGLCALLLISTSPROC glad_glCallLists = NULL; PFNGLCLEARPROC glad_glClear = NULL; +PFNGLCLEARACCUMPROC glad_glClearAccum = NULL; PFNGLCLEARCOLORPROC glad_glClearColor = NULL; -PFNGLCLEARCOLORXPROC glad_glClearColorx = NULL; -PFNGLCLEARDEPTHFPROC glad_glClearDepthf = NULL; -PFNGLCLEARDEPTHXPROC glad_glClearDepthx = NULL; +PFNGLCLEARDEPTHPROC glad_glClearDepth = NULL; +PFNGLCLEARINDEXPROC glad_glClearIndex = NULL; PFNGLCLEARSTENCILPROC glad_glClearStencil = NULL; PFNGLCLIENTACTIVETEXTUREPROC glad_glClientActiveTexture = NULL; -PFNGLCLIPPLANEFPROC glad_glClipPlanef = NULL; -PFNGLCLIPPLANEXPROC glad_glClipPlanex = NULL; +PFNGLCLIPPLANEPROC glad_glClipPlane = NULL; +PFNGLCOLOR3BPROC glad_glColor3b = NULL; +PFNGLCOLOR3BVPROC glad_glColor3bv = NULL; +PFNGLCOLOR3DPROC glad_glColor3d = NULL; +PFNGLCOLOR3DVPROC glad_glColor3dv = NULL; +PFNGLCOLOR3FPROC glad_glColor3f = NULL; +PFNGLCOLOR3FVPROC glad_glColor3fv = NULL; +PFNGLCOLOR3IPROC glad_glColor3i = NULL; +PFNGLCOLOR3IVPROC glad_glColor3iv = NULL; +PFNGLCOLOR3SPROC glad_glColor3s = NULL; +PFNGLCOLOR3SVPROC glad_glColor3sv = NULL; +PFNGLCOLOR3UBPROC glad_glColor3ub = NULL; +PFNGLCOLOR3UBVPROC glad_glColor3ubv = NULL; +PFNGLCOLOR3UIPROC glad_glColor3ui = NULL; +PFNGLCOLOR3UIVPROC glad_glColor3uiv = NULL; +PFNGLCOLOR3USPROC glad_glColor3us = NULL; +PFNGLCOLOR3USVPROC glad_glColor3usv = NULL; +PFNGLCOLOR4BPROC glad_glColor4b = NULL; +PFNGLCOLOR4BVPROC glad_glColor4bv = NULL; +PFNGLCOLOR4DPROC glad_glColor4d = NULL; +PFNGLCOLOR4DVPROC glad_glColor4dv = NULL; PFNGLCOLOR4FPROC glad_glColor4f = NULL; +PFNGLCOLOR4FVPROC glad_glColor4fv = NULL; +PFNGLCOLOR4IPROC glad_glColor4i = NULL; +PFNGLCOLOR4IVPROC glad_glColor4iv = NULL; +PFNGLCOLOR4SPROC glad_glColor4s = NULL; +PFNGLCOLOR4SVPROC glad_glColor4sv = NULL; PFNGLCOLOR4UBPROC glad_glColor4ub = NULL; -PFNGLCOLOR4XPROC glad_glColor4x = NULL; +PFNGLCOLOR4UBVPROC glad_glColor4ubv = NULL; +PFNGLCOLOR4UIPROC glad_glColor4ui = NULL; +PFNGLCOLOR4UIVPROC glad_glColor4uiv = NULL; +PFNGLCOLOR4USPROC glad_glColor4us = NULL; +PFNGLCOLOR4USVPROC glad_glColor4usv = NULL; PFNGLCOLORMASKPROC glad_glColorMask = NULL; +PFNGLCOLORMATERIALPROC glad_glColorMaterial = NULL; PFNGLCOLORPOINTERPROC glad_glColorPointer = NULL; +PFNGLCOMPILESHADERPROC glad_glCompileShader = NULL; +PFNGLCOMPRESSEDTEXIMAGE1DPROC glad_glCompressedTexImage1D = NULL; PFNGLCOMPRESSEDTEXIMAGE2DPROC glad_glCompressedTexImage2D = NULL; +PFNGLCOMPRESSEDTEXIMAGE3DPROC glad_glCompressedTexImage3D = NULL; +PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC glad_glCompressedTexSubImage1D = NULL; PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC glad_glCompressedTexSubImage2D = NULL; +PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC glad_glCompressedTexSubImage3D = NULL; +PFNGLCOPYPIXELSPROC glad_glCopyPixels = NULL; +PFNGLCOPYTEXIMAGE1DPROC glad_glCopyTexImage1D = NULL; PFNGLCOPYTEXIMAGE2DPROC glad_glCopyTexImage2D = NULL; +PFNGLCOPYTEXSUBIMAGE1DPROC glad_glCopyTexSubImage1D = NULL; PFNGLCOPYTEXSUBIMAGE2DPROC glad_glCopyTexSubImage2D = NULL; +PFNGLCOPYTEXSUBIMAGE3DPROC glad_glCopyTexSubImage3D = NULL; +PFNGLCREATEPROGRAMPROC glad_glCreateProgram = NULL; +PFNGLCREATESHADERPROC glad_glCreateShader = NULL; PFNGLCULLFACEPROC glad_glCullFace = NULL; PFNGLDELETEBUFFERSPROC glad_glDeleteBuffers = NULL; +PFNGLDELETELISTSPROC glad_glDeleteLists = NULL; +PFNGLDELETEPROGRAMPROC glad_glDeleteProgram = NULL; +PFNGLDELETEQUERIESPROC glad_glDeleteQueries = NULL; +PFNGLDELETESHADERPROC glad_glDeleteShader = NULL; PFNGLDELETETEXTURESPROC glad_glDeleteTextures = NULL; PFNGLDEPTHFUNCPROC glad_glDepthFunc = NULL; PFNGLDEPTHMASKPROC glad_glDepthMask = NULL; -PFNGLDEPTHRANGEFPROC glad_glDepthRangef = NULL; -PFNGLDEPTHRANGEXPROC glad_glDepthRangex = NULL; +PFNGLDEPTHRANGEPROC glad_glDepthRange = NULL; +PFNGLDETACHSHADERPROC glad_glDetachShader = NULL; PFNGLDISABLEPROC glad_glDisable = NULL; PFNGLDISABLECLIENTSTATEPROC glad_glDisableClientState = NULL; +PFNGLDISABLEVERTEXATTRIBARRAYPROC glad_glDisableVertexAttribArray = NULL; PFNGLDRAWARRAYSPROC glad_glDrawArrays = NULL; +PFNGLDRAWBUFFERPROC glad_glDrawBuffer = NULL; +PFNGLDRAWBUFFERSPROC glad_glDrawBuffers = NULL; PFNGLDRAWELEMENTSPROC glad_glDrawElements = NULL; +PFNGLDRAWPIXELSPROC glad_glDrawPixels = NULL; +PFNGLDRAWRANGEELEMENTSPROC glad_glDrawRangeElements = NULL; +PFNGLEDGEFLAGPROC glad_glEdgeFlag = NULL; +PFNGLEDGEFLAGPOINTERPROC glad_glEdgeFlagPointer = NULL; +PFNGLEDGEFLAGVPROC glad_glEdgeFlagv = NULL; PFNGLENABLEPROC glad_glEnable = NULL; PFNGLENABLECLIENTSTATEPROC glad_glEnableClientState = NULL; +PFNGLENABLEVERTEXATTRIBARRAYPROC glad_glEnableVertexAttribArray = NULL; +PFNGLENDPROC glad_glEnd = NULL; +PFNGLENDLISTPROC glad_glEndList = NULL; +PFNGLENDQUERYPROC glad_glEndQuery = NULL; +PFNGLEVALCOORD1DPROC glad_glEvalCoord1d = NULL; +PFNGLEVALCOORD1DVPROC glad_glEvalCoord1dv = NULL; +PFNGLEVALCOORD1FPROC glad_glEvalCoord1f = NULL; +PFNGLEVALCOORD1FVPROC glad_glEvalCoord1fv = NULL; +PFNGLEVALCOORD2DPROC glad_glEvalCoord2d = NULL; +PFNGLEVALCOORD2DVPROC glad_glEvalCoord2dv = NULL; +PFNGLEVALCOORD2FPROC glad_glEvalCoord2f = NULL; +PFNGLEVALCOORD2FVPROC glad_glEvalCoord2fv = NULL; +PFNGLEVALMESH1PROC glad_glEvalMesh1 = NULL; +PFNGLEVALMESH2PROC glad_glEvalMesh2 = NULL; +PFNGLEVALPOINT1PROC glad_glEvalPoint1 = NULL; +PFNGLEVALPOINT2PROC glad_glEvalPoint2 = NULL; +PFNGLFEEDBACKBUFFERPROC glad_glFeedbackBuffer = NULL; PFNGLFINISHPROC glad_glFinish = NULL; PFNGLFLUSHPROC glad_glFlush = NULL; +PFNGLFOGCOORDPOINTERPROC glad_glFogCoordPointer = NULL; +PFNGLFOGCOORDDPROC glad_glFogCoordd = NULL; +PFNGLFOGCOORDDVPROC glad_glFogCoorddv = NULL; +PFNGLFOGCOORDFPROC glad_glFogCoordf = NULL; +PFNGLFOGCOORDFVPROC glad_glFogCoordfv = NULL; PFNGLFOGFPROC glad_glFogf = NULL; PFNGLFOGFVPROC glad_glFogfv = NULL; -PFNGLFOGXPROC glad_glFogx = NULL; -PFNGLFOGXVPROC glad_glFogxv = NULL; +PFNGLFOGIPROC glad_glFogi = NULL; +PFNGLFOGIVPROC glad_glFogiv = NULL; PFNGLFRONTFACEPROC glad_glFrontFace = NULL; -PFNGLFRUSTUMFPROC glad_glFrustumf = NULL; -PFNGLFRUSTUMXPROC glad_glFrustumx = NULL; +PFNGLFRUSTUMPROC glad_glFrustum = NULL; PFNGLGENBUFFERSPROC glad_glGenBuffers = NULL; +PFNGLGENLISTSPROC glad_glGenLists = NULL; +PFNGLGENQUERIESPROC glad_glGenQueries = NULL; PFNGLGENTEXTURESPROC glad_glGenTextures = NULL; +PFNGLGETACTIVEATTRIBPROC glad_glGetActiveAttrib = NULL; +PFNGLGETACTIVEUNIFORMPROC glad_glGetActiveUniform = NULL; +PFNGLGETATTACHEDSHADERSPROC glad_glGetAttachedShaders = NULL; +PFNGLGETATTRIBLOCATIONPROC glad_glGetAttribLocation = NULL; PFNGLGETBOOLEANVPROC glad_glGetBooleanv = NULL; PFNGLGETBUFFERPARAMETERIVPROC glad_glGetBufferParameteriv = NULL; -PFNGLGETCLIPPLANEFPROC glad_glGetClipPlanef = NULL; -PFNGLGETCLIPPLANEXPROC glad_glGetClipPlanex = NULL; +PFNGLGETBUFFERPOINTERVPROC glad_glGetBufferPointerv = NULL; +PFNGLGETBUFFERSUBDATAPROC glad_glGetBufferSubData = NULL; +PFNGLGETCLIPPLANEPROC glad_glGetClipPlane = NULL; +PFNGLGETCOMPRESSEDTEXIMAGEPROC glad_glGetCompressedTexImage = NULL; +PFNGLGETDOUBLEVPROC glad_glGetDoublev = NULL; PFNGLGETERRORPROC glad_glGetError = NULL; -PFNGLGETFIXEDVPROC glad_glGetFixedv = NULL; PFNGLGETFLOATVPROC glad_glGetFloatv = NULL; PFNGLGETINTEGERVPROC glad_glGetIntegerv = NULL; PFNGLGETLIGHTFVPROC glad_glGetLightfv = NULL; -PFNGLGETLIGHTXVPROC glad_glGetLightxv = NULL; +PFNGLGETLIGHTIVPROC glad_glGetLightiv = NULL; +PFNGLGETMAPDVPROC glad_glGetMapdv = NULL; +PFNGLGETMAPFVPROC glad_glGetMapfv = NULL; +PFNGLGETMAPIVPROC glad_glGetMapiv = NULL; PFNGLGETMATERIALFVPROC glad_glGetMaterialfv = NULL; -PFNGLGETMATERIALXVPROC glad_glGetMaterialxv = NULL; +PFNGLGETMATERIALIVPROC glad_glGetMaterialiv = NULL; +PFNGLGETPIXELMAPFVPROC glad_glGetPixelMapfv = NULL; +PFNGLGETPIXELMAPUIVPROC glad_glGetPixelMapuiv = NULL; +PFNGLGETPIXELMAPUSVPROC glad_glGetPixelMapusv = NULL; PFNGLGETPOINTERVPROC glad_glGetPointerv = NULL; +PFNGLGETPOLYGONSTIPPLEPROC glad_glGetPolygonStipple = NULL; +PFNGLGETPROGRAMINFOLOGPROC glad_glGetProgramInfoLog = NULL; +PFNGLGETPROGRAMIVPROC glad_glGetProgramiv = NULL; +PFNGLGETQUERYOBJECTIVPROC glad_glGetQueryObjectiv = NULL; +PFNGLGETQUERYOBJECTUIVPROC glad_glGetQueryObjectuiv = NULL; +PFNGLGETQUERYIVPROC glad_glGetQueryiv = NULL; +PFNGLGETSHADERINFOLOGPROC glad_glGetShaderInfoLog = NULL; +PFNGLGETSHADERSOURCEPROC glad_glGetShaderSource = NULL; +PFNGLGETSHADERIVPROC glad_glGetShaderiv = NULL; PFNGLGETSTRINGPROC glad_glGetString = NULL; PFNGLGETTEXENVFVPROC glad_glGetTexEnvfv = NULL; PFNGLGETTEXENVIVPROC glad_glGetTexEnviv = NULL; -PFNGLGETTEXENVXVPROC glad_glGetTexEnvxv = NULL; +PFNGLGETTEXGENDVPROC glad_glGetTexGendv = NULL; +PFNGLGETTEXGENFVPROC glad_glGetTexGenfv = NULL; +PFNGLGETTEXGENIVPROC glad_glGetTexGeniv = NULL; +PFNGLGETTEXIMAGEPROC glad_glGetTexImage = NULL; +PFNGLGETTEXLEVELPARAMETERFVPROC glad_glGetTexLevelParameterfv = NULL; +PFNGLGETTEXLEVELPARAMETERIVPROC glad_glGetTexLevelParameteriv = NULL; PFNGLGETTEXPARAMETERFVPROC glad_glGetTexParameterfv = NULL; PFNGLGETTEXPARAMETERIVPROC glad_glGetTexParameteriv = NULL; -PFNGLGETTEXPARAMETERXVPROC glad_glGetTexParameterxv = NULL; +PFNGLGETUNIFORMLOCATIONPROC glad_glGetUniformLocation = NULL; +PFNGLGETUNIFORMFVPROC glad_glGetUniformfv = NULL; +PFNGLGETUNIFORMIVPROC glad_glGetUniformiv = NULL; +PFNGLGETVERTEXATTRIBPOINTERVPROC glad_glGetVertexAttribPointerv = NULL; +PFNGLGETVERTEXATTRIBDVPROC glad_glGetVertexAttribdv = NULL; +PFNGLGETVERTEXATTRIBFVPROC glad_glGetVertexAttribfv = NULL; +PFNGLGETVERTEXATTRIBIVPROC glad_glGetVertexAttribiv = NULL; PFNGLHINTPROC glad_glHint = NULL; +PFNGLINDEXMASKPROC glad_glIndexMask = NULL; +PFNGLINDEXPOINTERPROC glad_glIndexPointer = NULL; +PFNGLINDEXDPROC glad_glIndexd = NULL; +PFNGLINDEXDVPROC glad_glIndexdv = NULL; +PFNGLINDEXFPROC glad_glIndexf = NULL; +PFNGLINDEXFVPROC glad_glIndexfv = NULL; +PFNGLINDEXIPROC glad_glIndexi = NULL; +PFNGLINDEXIVPROC glad_glIndexiv = NULL; +PFNGLINDEXSPROC glad_glIndexs = NULL; +PFNGLINDEXSVPROC glad_glIndexsv = NULL; +PFNGLINDEXUBPROC glad_glIndexub = NULL; +PFNGLINDEXUBVPROC glad_glIndexubv = NULL; +PFNGLINITNAMESPROC glad_glInitNames = NULL; +PFNGLINTERLEAVEDARRAYSPROC glad_glInterleavedArrays = NULL; PFNGLISBUFFERPROC glad_glIsBuffer = NULL; PFNGLISENABLEDPROC glad_glIsEnabled = NULL; +PFNGLISLISTPROC glad_glIsList = NULL; +PFNGLISPROGRAMPROC glad_glIsProgram = NULL; +PFNGLISQUERYPROC glad_glIsQuery = NULL; +PFNGLISSHADERPROC glad_glIsShader = NULL; PFNGLISTEXTUREPROC glad_glIsTexture = NULL; PFNGLLIGHTMODELFPROC glad_glLightModelf = NULL; PFNGLLIGHTMODELFVPROC glad_glLightModelfv = NULL; -PFNGLLIGHTMODELXPROC glad_glLightModelx = NULL; -PFNGLLIGHTMODELXVPROC glad_glLightModelxv = NULL; +PFNGLLIGHTMODELIPROC glad_glLightModeli = NULL; +PFNGLLIGHTMODELIVPROC glad_glLightModeliv = NULL; PFNGLLIGHTFPROC glad_glLightf = NULL; PFNGLLIGHTFVPROC glad_glLightfv = NULL; -PFNGLLIGHTXPROC glad_glLightx = NULL; -PFNGLLIGHTXVPROC glad_glLightxv = NULL; +PFNGLLIGHTIPROC glad_glLighti = NULL; +PFNGLLIGHTIVPROC glad_glLightiv = NULL; +PFNGLLINESTIPPLEPROC glad_glLineStipple = NULL; PFNGLLINEWIDTHPROC glad_glLineWidth = NULL; -PFNGLLINEWIDTHXPROC glad_glLineWidthx = NULL; +PFNGLLINKPROGRAMPROC glad_glLinkProgram = NULL; +PFNGLLISTBASEPROC glad_glListBase = NULL; PFNGLLOADIDENTITYPROC glad_glLoadIdentity = NULL; +PFNGLLOADMATRIXDPROC glad_glLoadMatrixd = NULL; PFNGLLOADMATRIXFPROC glad_glLoadMatrixf = NULL; -PFNGLLOADMATRIXXPROC glad_glLoadMatrixx = NULL; +PFNGLLOADNAMEPROC glad_glLoadName = NULL; +PFNGLLOADTRANSPOSEMATRIXDPROC glad_glLoadTransposeMatrixd = NULL; +PFNGLLOADTRANSPOSEMATRIXFPROC glad_glLoadTransposeMatrixf = NULL; PFNGLLOGICOPPROC glad_glLogicOp = NULL; +PFNGLMAP1DPROC glad_glMap1d = NULL; +PFNGLMAP1FPROC glad_glMap1f = NULL; +PFNGLMAP2DPROC glad_glMap2d = NULL; +PFNGLMAP2FPROC glad_glMap2f = NULL; +PFNGLMAPBUFFERPROC glad_glMapBuffer = NULL; +PFNGLMAPGRID1DPROC glad_glMapGrid1d = NULL; +PFNGLMAPGRID1FPROC glad_glMapGrid1f = NULL; +PFNGLMAPGRID2DPROC glad_glMapGrid2d = NULL; +PFNGLMAPGRID2FPROC glad_glMapGrid2f = NULL; PFNGLMATERIALFPROC glad_glMaterialf = NULL; PFNGLMATERIALFVPROC glad_glMaterialfv = NULL; -PFNGLMATERIALXPROC glad_glMaterialx = NULL; -PFNGLMATERIALXVPROC glad_glMaterialxv = NULL; +PFNGLMATERIALIPROC glad_glMateriali = NULL; +PFNGLMATERIALIVPROC glad_glMaterialiv = NULL; PFNGLMATRIXMODEPROC glad_glMatrixMode = NULL; +PFNGLMULTMATRIXDPROC glad_glMultMatrixd = NULL; PFNGLMULTMATRIXFPROC glad_glMultMatrixf = NULL; -PFNGLMULTMATRIXXPROC glad_glMultMatrixx = NULL; +PFNGLMULTTRANSPOSEMATRIXDPROC glad_glMultTransposeMatrixd = NULL; +PFNGLMULTTRANSPOSEMATRIXFPROC glad_glMultTransposeMatrixf = NULL; +PFNGLMULTIDRAWARRAYSPROC glad_glMultiDrawArrays = NULL; +PFNGLMULTIDRAWELEMENTSPROC glad_glMultiDrawElements = NULL; +PFNGLMULTITEXCOORD1DPROC glad_glMultiTexCoord1d = NULL; +PFNGLMULTITEXCOORD1DVPROC glad_glMultiTexCoord1dv = NULL; +PFNGLMULTITEXCOORD1FPROC glad_glMultiTexCoord1f = NULL; +PFNGLMULTITEXCOORD1FVPROC glad_glMultiTexCoord1fv = NULL; +PFNGLMULTITEXCOORD1IPROC glad_glMultiTexCoord1i = NULL; +PFNGLMULTITEXCOORD1IVPROC glad_glMultiTexCoord1iv = NULL; +PFNGLMULTITEXCOORD1SPROC glad_glMultiTexCoord1s = NULL; +PFNGLMULTITEXCOORD1SVPROC glad_glMultiTexCoord1sv = NULL; +PFNGLMULTITEXCOORD2DPROC glad_glMultiTexCoord2d = NULL; +PFNGLMULTITEXCOORD2DVPROC glad_glMultiTexCoord2dv = NULL; +PFNGLMULTITEXCOORD2FPROC glad_glMultiTexCoord2f = NULL; +PFNGLMULTITEXCOORD2FVPROC glad_glMultiTexCoord2fv = NULL; +PFNGLMULTITEXCOORD2IPROC glad_glMultiTexCoord2i = NULL; +PFNGLMULTITEXCOORD2IVPROC glad_glMultiTexCoord2iv = NULL; +PFNGLMULTITEXCOORD2SPROC glad_glMultiTexCoord2s = NULL; +PFNGLMULTITEXCOORD2SVPROC glad_glMultiTexCoord2sv = NULL; +PFNGLMULTITEXCOORD3DPROC glad_glMultiTexCoord3d = NULL; +PFNGLMULTITEXCOORD3DVPROC glad_glMultiTexCoord3dv = NULL; +PFNGLMULTITEXCOORD3FPROC glad_glMultiTexCoord3f = NULL; +PFNGLMULTITEXCOORD3FVPROC glad_glMultiTexCoord3fv = NULL; +PFNGLMULTITEXCOORD3IPROC glad_glMultiTexCoord3i = NULL; +PFNGLMULTITEXCOORD3IVPROC glad_glMultiTexCoord3iv = NULL; +PFNGLMULTITEXCOORD3SPROC glad_glMultiTexCoord3s = NULL; +PFNGLMULTITEXCOORD3SVPROC glad_glMultiTexCoord3sv = NULL; +PFNGLMULTITEXCOORD4DPROC glad_glMultiTexCoord4d = NULL; +PFNGLMULTITEXCOORD4DVPROC glad_glMultiTexCoord4dv = NULL; PFNGLMULTITEXCOORD4FPROC glad_glMultiTexCoord4f = NULL; -PFNGLMULTITEXCOORD4XPROC glad_glMultiTexCoord4x = NULL; +PFNGLMULTITEXCOORD4FVPROC glad_glMultiTexCoord4fv = NULL; +PFNGLMULTITEXCOORD4IPROC glad_glMultiTexCoord4i = NULL; +PFNGLMULTITEXCOORD4IVPROC glad_glMultiTexCoord4iv = NULL; +PFNGLMULTITEXCOORD4SPROC glad_glMultiTexCoord4s = NULL; +PFNGLMULTITEXCOORD4SVPROC glad_glMultiTexCoord4sv = NULL; +PFNGLNEWLISTPROC glad_glNewList = NULL; +PFNGLNORMAL3BPROC glad_glNormal3b = NULL; +PFNGLNORMAL3BVPROC glad_glNormal3bv = NULL; +PFNGLNORMAL3DPROC glad_glNormal3d = NULL; +PFNGLNORMAL3DVPROC glad_glNormal3dv = NULL; PFNGLNORMAL3FPROC glad_glNormal3f = NULL; -PFNGLNORMAL3XPROC glad_glNormal3x = NULL; +PFNGLNORMAL3FVPROC glad_glNormal3fv = NULL; +PFNGLNORMAL3IPROC glad_glNormal3i = NULL; +PFNGLNORMAL3IVPROC glad_glNormal3iv = NULL; +PFNGLNORMAL3SPROC glad_glNormal3s = NULL; +PFNGLNORMAL3SVPROC glad_glNormal3sv = NULL; PFNGLNORMALPOINTERPROC glad_glNormalPointer = NULL; -PFNGLORTHOFPROC glad_glOrthof = NULL; -PFNGLORTHOXPROC glad_glOrthox = NULL; +PFNGLORTHOPROC glad_glOrtho = NULL; +PFNGLPASSTHROUGHPROC glad_glPassThrough = NULL; +PFNGLPIXELMAPFVPROC glad_glPixelMapfv = NULL; +PFNGLPIXELMAPUIVPROC glad_glPixelMapuiv = NULL; +PFNGLPIXELMAPUSVPROC glad_glPixelMapusv = NULL; +PFNGLPIXELSTOREFPROC glad_glPixelStoref = NULL; PFNGLPIXELSTOREIPROC glad_glPixelStorei = NULL; +PFNGLPIXELTRANSFERFPROC glad_glPixelTransferf = NULL; +PFNGLPIXELTRANSFERIPROC glad_glPixelTransferi = NULL; +PFNGLPIXELZOOMPROC glad_glPixelZoom = NULL; PFNGLPOINTPARAMETERFPROC glad_glPointParameterf = NULL; PFNGLPOINTPARAMETERFVPROC glad_glPointParameterfv = NULL; -PFNGLPOINTPARAMETERXPROC glad_glPointParameterx = NULL; -PFNGLPOINTPARAMETERXVPROC glad_glPointParameterxv = NULL; +PFNGLPOINTPARAMETERIPROC glad_glPointParameteri = NULL; +PFNGLPOINTPARAMETERIVPROC glad_glPointParameteriv = NULL; PFNGLPOINTSIZEPROC glad_glPointSize = NULL; -PFNGLPOINTSIZEXPROC glad_glPointSizex = NULL; +PFNGLPOLYGONMODEPROC glad_glPolygonMode = NULL; PFNGLPOLYGONOFFSETPROC glad_glPolygonOffset = NULL; -PFNGLPOLYGONOFFSETXPROC glad_glPolygonOffsetx = NULL; +PFNGLPOLYGONSTIPPLEPROC glad_glPolygonStipple = NULL; +PFNGLPOPATTRIBPROC glad_glPopAttrib = NULL; +PFNGLPOPCLIENTATTRIBPROC glad_glPopClientAttrib = NULL; PFNGLPOPMATRIXPROC glad_glPopMatrix = NULL; +PFNGLPOPNAMEPROC glad_glPopName = NULL; +PFNGLPRIORITIZETEXTURESPROC glad_glPrioritizeTextures = NULL; +PFNGLPUSHATTRIBPROC glad_glPushAttrib = NULL; +PFNGLPUSHCLIENTATTRIBPROC glad_glPushClientAttrib = NULL; PFNGLPUSHMATRIXPROC glad_glPushMatrix = NULL; +PFNGLPUSHNAMEPROC glad_glPushName = NULL; +PFNGLRASTERPOS2DPROC glad_glRasterPos2d = NULL; +PFNGLRASTERPOS2DVPROC glad_glRasterPos2dv = NULL; +PFNGLRASTERPOS2FPROC glad_glRasterPos2f = NULL; +PFNGLRASTERPOS2FVPROC glad_glRasterPos2fv = NULL; +PFNGLRASTERPOS2IPROC glad_glRasterPos2i = NULL; +PFNGLRASTERPOS2IVPROC glad_glRasterPos2iv = NULL; +PFNGLRASTERPOS2SPROC glad_glRasterPos2s = NULL; +PFNGLRASTERPOS2SVPROC glad_glRasterPos2sv = NULL; +PFNGLRASTERPOS3DPROC glad_glRasterPos3d = NULL; +PFNGLRASTERPOS3DVPROC glad_glRasterPos3dv = NULL; +PFNGLRASTERPOS3FPROC glad_glRasterPos3f = NULL; +PFNGLRASTERPOS3FVPROC glad_glRasterPos3fv = NULL; +PFNGLRASTERPOS3IPROC glad_glRasterPos3i = NULL; +PFNGLRASTERPOS3IVPROC glad_glRasterPos3iv = NULL; +PFNGLRASTERPOS3SPROC glad_glRasterPos3s = NULL; +PFNGLRASTERPOS3SVPROC glad_glRasterPos3sv = NULL; +PFNGLRASTERPOS4DPROC glad_glRasterPos4d = NULL; +PFNGLRASTERPOS4DVPROC glad_glRasterPos4dv = NULL; +PFNGLRASTERPOS4FPROC glad_glRasterPos4f = NULL; +PFNGLRASTERPOS4FVPROC glad_glRasterPos4fv = NULL; +PFNGLRASTERPOS4IPROC glad_glRasterPos4i = NULL; +PFNGLRASTERPOS4IVPROC glad_glRasterPos4iv = NULL; +PFNGLRASTERPOS4SPROC glad_glRasterPos4s = NULL; +PFNGLRASTERPOS4SVPROC glad_glRasterPos4sv = NULL; +PFNGLREADBUFFERPROC glad_glReadBuffer = NULL; PFNGLREADPIXELSPROC glad_glReadPixels = NULL; +PFNGLRECTDPROC glad_glRectd = NULL; +PFNGLRECTDVPROC glad_glRectdv = NULL; +PFNGLRECTFPROC glad_glRectf = NULL; +PFNGLRECTFVPROC glad_glRectfv = NULL; +PFNGLRECTIPROC glad_glRecti = NULL; +PFNGLRECTIVPROC glad_glRectiv = NULL; +PFNGLRECTSPROC glad_glRects = NULL; +PFNGLRECTSVPROC glad_glRectsv = NULL; +PFNGLRENDERMODEPROC glad_glRenderMode = NULL; +PFNGLROTATEDPROC glad_glRotated = NULL; PFNGLROTATEFPROC glad_glRotatef = NULL; -PFNGLROTATEXPROC glad_glRotatex = NULL; PFNGLSAMPLECOVERAGEPROC glad_glSampleCoverage = NULL; -PFNGLSAMPLECOVERAGEXPROC glad_glSampleCoveragex = NULL; +PFNGLSCALEDPROC glad_glScaled = NULL; PFNGLSCALEFPROC glad_glScalef = NULL; -PFNGLSCALEXPROC glad_glScalex = NULL; PFNGLSCISSORPROC glad_glScissor = NULL; +PFNGLSECONDARYCOLOR3BPROC glad_glSecondaryColor3b = NULL; +PFNGLSECONDARYCOLOR3BVPROC glad_glSecondaryColor3bv = NULL; +PFNGLSECONDARYCOLOR3DPROC glad_glSecondaryColor3d = NULL; +PFNGLSECONDARYCOLOR3DVPROC glad_glSecondaryColor3dv = NULL; +PFNGLSECONDARYCOLOR3FPROC glad_glSecondaryColor3f = NULL; +PFNGLSECONDARYCOLOR3FVPROC glad_glSecondaryColor3fv = NULL; +PFNGLSECONDARYCOLOR3IPROC glad_glSecondaryColor3i = NULL; +PFNGLSECONDARYCOLOR3IVPROC glad_glSecondaryColor3iv = NULL; +PFNGLSECONDARYCOLOR3SPROC glad_glSecondaryColor3s = NULL; +PFNGLSECONDARYCOLOR3SVPROC glad_glSecondaryColor3sv = NULL; +PFNGLSECONDARYCOLOR3UBPROC glad_glSecondaryColor3ub = NULL; +PFNGLSECONDARYCOLOR3UBVPROC glad_glSecondaryColor3ubv = NULL; +PFNGLSECONDARYCOLOR3UIPROC glad_glSecondaryColor3ui = NULL; +PFNGLSECONDARYCOLOR3UIVPROC glad_glSecondaryColor3uiv = NULL; +PFNGLSECONDARYCOLOR3USPROC glad_glSecondaryColor3us = NULL; +PFNGLSECONDARYCOLOR3USVPROC glad_glSecondaryColor3usv = NULL; +PFNGLSECONDARYCOLORPOINTERPROC glad_glSecondaryColorPointer = NULL; +PFNGLSELECTBUFFERPROC glad_glSelectBuffer = NULL; PFNGLSHADEMODELPROC glad_glShadeModel = NULL; +PFNGLSHADERSOURCEPROC glad_glShaderSource = NULL; PFNGLSTENCILFUNCPROC glad_glStencilFunc = NULL; +PFNGLSTENCILFUNCSEPARATEPROC glad_glStencilFuncSeparate = NULL; PFNGLSTENCILMASKPROC glad_glStencilMask = NULL; +PFNGLSTENCILMASKSEPARATEPROC glad_glStencilMaskSeparate = NULL; PFNGLSTENCILOPPROC glad_glStencilOp = NULL; +PFNGLSTENCILOPSEPARATEPROC glad_glStencilOpSeparate = NULL; +PFNGLTEXCOORD1DPROC glad_glTexCoord1d = NULL; +PFNGLTEXCOORD1DVPROC glad_glTexCoord1dv = NULL; +PFNGLTEXCOORD1FPROC glad_glTexCoord1f = NULL; +PFNGLTEXCOORD1FVPROC glad_glTexCoord1fv = NULL; +PFNGLTEXCOORD1IPROC glad_glTexCoord1i = NULL; +PFNGLTEXCOORD1IVPROC glad_glTexCoord1iv = NULL; +PFNGLTEXCOORD1SPROC glad_glTexCoord1s = NULL; +PFNGLTEXCOORD1SVPROC glad_glTexCoord1sv = NULL; +PFNGLTEXCOORD2DPROC glad_glTexCoord2d = NULL; +PFNGLTEXCOORD2DVPROC glad_glTexCoord2dv = NULL; +PFNGLTEXCOORD2FPROC glad_glTexCoord2f = NULL; +PFNGLTEXCOORD2FVPROC glad_glTexCoord2fv = NULL; +PFNGLTEXCOORD2IPROC glad_glTexCoord2i = NULL; +PFNGLTEXCOORD2IVPROC glad_glTexCoord2iv = NULL; +PFNGLTEXCOORD2SPROC glad_glTexCoord2s = NULL; +PFNGLTEXCOORD2SVPROC glad_glTexCoord2sv = NULL; +PFNGLTEXCOORD3DPROC glad_glTexCoord3d = NULL; +PFNGLTEXCOORD3DVPROC glad_glTexCoord3dv = NULL; +PFNGLTEXCOORD3FPROC glad_glTexCoord3f = NULL; +PFNGLTEXCOORD3FVPROC glad_glTexCoord3fv = NULL; +PFNGLTEXCOORD3IPROC glad_glTexCoord3i = NULL; +PFNGLTEXCOORD3IVPROC glad_glTexCoord3iv = NULL; +PFNGLTEXCOORD3SPROC glad_glTexCoord3s = NULL; +PFNGLTEXCOORD3SVPROC glad_glTexCoord3sv = NULL; +PFNGLTEXCOORD4DPROC glad_glTexCoord4d = NULL; +PFNGLTEXCOORD4DVPROC glad_glTexCoord4dv = NULL; +PFNGLTEXCOORD4FPROC glad_glTexCoord4f = NULL; +PFNGLTEXCOORD4FVPROC glad_glTexCoord4fv = NULL; +PFNGLTEXCOORD4IPROC glad_glTexCoord4i = NULL; +PFNGLTEXCOORD4IVPROC glad_glTexCoord4iv = NULL; +PFNGLTEXCOORD4SPROC glad_glTexCoord4s = NULL; +PFNGLTEXCOORD4SVPROC glad_glTexCoord4sv = NULL; PFNGLTEXCOORDPOINTERPROC glad_glTexCoordPointer = NULL; PFNGLTEXENVFPROC glad_glTexEnvf = NULL; PFNGLTEXENVFVPROC glad_glTexEnvfv = NULL; PFNGLTEXENVIPROC glad_glTexEnvi = NULL; PFNGLTEXENVIVPROC glad_glTexEnviv = NULL; -PFNGLTEXENVXPROC glad_glTexEnvx = NULL; -PFNGLTEXENVXVPROC glad_glTexEnvxv = NULL; +PFNGLTEXGENDPROC glad_glTexGend = NULL; +PFNGLTEXGENDVPROC glad_glTexGendv = NULL; +PFNGLTEXGENFPROC glad_glTexGenf = NULL; +PFNGLTEXGENFVPROC glad_glTexGenfv = NULL; +PFNGLTEXGENIPROC glad_glTexGeni = NULL; +PFNGLTEXGENIVPROC glad_glTexGeniv = NULL; +PFNGLTEXIMAGE1DPROC glad_glTexImage1D = NULL; PFNGLTEXIMAGE2DPROC glad_glTexImage2D = NULL; +PFNGLTEXIMAGE3DPROC glad_glTexImage3D = NULL; PFNGLTEXPARAMETERFPROC glad_glTexParameterf = NULL; PFNGLTEXPARAMETERFVPROC glad_glTexParameterfv = NULL; PFNGLTEXPARAMETERIPROC glad_glTexParameteri = NULL; PFNGLTEXPARAMETERIVPROC glad_glTexParameteriv = NULL; -PFNGLTEXPARAMETERXPROC glad_glTexParameterx = NULL; -PFNGLTEXPARAMETERXVPROC glad_glTexParameterxv = NULL; +PFNGLTEXSUBIMAGE1DPROC glad_glTexSubImage1D = NULL; PFNGLTEXSUBIMAGE2DPROC glad_glTexSubImage2D = NULL; +PFNGLTEXSUBIMAGE3DPROC glad_glTexSubImage3D = NULL; +PFNGLTRANSLATEDPROC glad_glTranslated = NULL; PFNGLTRANSLATEFPROC glad_glTranslatef = NULL; -PFNGLTRANSLATEXPROC glad_glTranslatex = NULL; +PFNGLUNIFORM1FPROC glad_glUniform1f = NULL; +PFNGLUNIFORM1FVPROC glad_glUniform1fv = NULL; +PFNGLUNIFORM1IPROC glad_glUniform1i = NULL; +PFNGLUNIFORM1IVPROC glad_glUniform1iv = NULL; +PFNGLUNIFORM2FPROC glad_glUniform2f = NULL; +PFNGLUNIFORM2FVPROC glad_glUniform2fv = NULL; +PFNGLUNIFORM2IPROC glad_glUniform2i = NULL; +PFNGLUNIFORM2IVPROC glad_glUniform2iv = NULL; +PFNGLUNIFORM3FPROC glad_glUniform3f = NULL; +PFNGLUNIFORM3FVPROC glad_glUniform3fv = NULL; +PFNGLUNIFORM3IPROC glad_glUniform3i = NULL; +PFNGLUNIFORM3IVPROC glad_glUniform3iv = NULL; +PFNGLUNIFORM4FPROC glad_glUniform4f = NULL; +PFNGLUNIFORM4FVPROC glad_glUniform4fv = NULL; +PFNGLUNIFORM4IPROC glad_glUniform4i = NULL; +PFNGLUNIFORM4IVPROC glad_glUniform4iv = NULL; +PFNGLUNIFORMMATRIX2FVPROC glad_glUniformMatrix2fv = NULL; +PFNGLUNIFORMMATRIX2X3FVPROC glad_glUniformMatrix2x3fv = NULL; +PFNGLUNIFORMMATRIX2X4FVPROC glad_glUniformMatrix2x4fv = NULL; +PFNGLUNIFORMMATRIX3FVPROC glad_glUniformMatrix3fv = NULL; +PFNGLUNIFORMMATRIX3X2FVPROC glad_glUniformMatrix3x2fv = NULL; +PFNGLUNIFORMMATRIX3X4FVPROC glad_glUniformMatrix3x4fv = NULL; +PFNGLUNIFORMMATRIX4FVPROC glad_glUniformMatrix4fv = NULL; +PFNGLUNIFORMMATRIX4X2FVPROC glad_glUniformMatrix4x2fv = NULL; +PFNGLUNIFORMMATRIX4X3FVPROC glad_glUniformMatrix4x3fv = NULL; +PFNGLUNMAPBUFFERPROC glad_glUnmapBuffer = NULL; +PFNGLUSEPROGRAMPROC glad_glUseProgram = NULL; +PFNGLVALIDATEPROGRAMPROC glad_glValidateProgram = NULL; +PFNGLVERTEX2DPROC glad_glVertex2d = NULL; +PFNGLVERTEX2DVPROC glad_glVertex2dv = NULL; +PFNGLVERTEX2FPROC glad_glVertex2f = NULL; +PFNGLVERTEX2FVPROC glad_glVertex2fv = NULL; +PFNGLVERTEX2IPROC glad_glVertex2i = NULL; +PFNGLVERTEX2IVPROC glad_glVertex2iv = NULL; +PFNGLVERTEX2SPROC glad_glVertex2s = NULL; +PFNGLVERTEX2SVPROC glad_glVertex2sv = NULL; +PFNGLVERTEX3DPROC glad_glVertex3d = NULL; +PFNGLVERTEX3DVPROC glad_glVertex3dv = NULL; +PFNGLVERTEX3FPROC glad_glVertex3f = NULL; +PFNGLVERTEX3FVPROC glad_glVertex3fv = NULL; +PFNGLVERTEX3IPROC glad_glVertex3i = NULL; +PFNGLVERTEX3IVPROC glad_glVertex3iv = NULL; +PFNGLVERTEX3SPROC glad_glVertex3s = NULL; +PFNGLVERTEX3SVPROC glad_glVertex3sv = NULL; +PFNGLVERTEX4DPROC glad_glVertex4d = NULL; +PFNGLVERTEX4DVPROC glad_glVertex4dv = NULL; +PFNGLVERTEX4FPROC glad_glVertex4f = NULL; +PFNGLVERTEX4FVPROC glad_glVertex4fv = NULL; +PFNGLVERTEX4IPROC glad_glVertex4i = NULL; +PFNGLVERTEX4IVPROC glad_glVertex4iv = NULL; +PFNGLVERTEX4SPROC glad_glVertex4s = NULL; +PFNGLVERTEX4SVPROC glad_glVertex4sv = NULL; +PFNGLVERTEXATTRIB1DPROC glad_glVertexAttrib1d = NULL; +PFNGLVERTEXATTRIB1DVPROC glad_glVertexAttrib1dv = NULL; +PFNGLVERTEXATTRIB1FPROC glad_glVertexAttrib1f = NULL; +PFNGLVERTEXATTRIB1FVPROC glad_glVertexAttrib1fv = NULL; +PFNGLVERTEXATTRIB1SPROC glad_glVertexAttrib1s = NULL; +PFNGLVERTEXATTRIB1SVPROC glad_glVertexAttrib1sv = NULL; +PFNGLVERTEXATTRIB2DPROC glad_glVertexAttrib2d = NULL; +PFNGLVERTEXATTRIB2DVPROC glad_glVertexAttrib2dv = NULL; +PFNGLVERTEXATTRIB2FPROC glad_glVertexAttrib2f = NULL; +PFNGLVERTEXATTRIB2FVPROC glad_glVertexAttrib2fv = NULL; +PFNGLVERTEXATTRIB2SPROC glad_glVertexAttrib2s = NULL; +PFNGLVERTEXATTRIB2SVPROC glad_glVertexAttrib2sv = NULL; +PFNGLVERTEXATTRIB3DPROC glad_glVertexAttrib3d = NULL; +PFNGLVERTEXATTRIB3DVPROC glad_glVertexAttrib3dv = NULL; +PFNGLVERTEXATTRIB3FPROC glad_glVertexAttrib3f = NULL; +PFNGLVERTEXATTRIB3FVPROC glad_glVertexAttrib3fv = NULL; +PFNGLVERTEXATTRIB3SPROC glad_glVertexAttrib3s = NULL; +PFNGLVERTEXATTRIB3SVPROC glad_glVertexAttrib3sv = NULL; +PFNGLVERTEXATTRIB4NBVPROC glad_glVertexAttrib4Nbv = NULL; +PFNGLVERTEXATTRIB4NIVPROC glad_glVertexAttrib4Niv = NULL; +PFNGLVERTEXATTRIB4NSVPROC glad_glVertexAttrib4Nsv = NULL; +PFNGLVERTEXATTRIB4NUBPROC glad_glVertexAttrib4Nub = NULL; +PFNGLVERTEXATTRIB4NUBVPROC glad_glVertexAttrib4Nubv = NULL; +PFNGLVERTEXATTRIB4NUIVPROC glad_glVertexAttrib4Nuiv = NULL; +PFNGLVERTEXATTRIB4NUSVPROC glad_glVertexAttrib4Nusv = NULL; +PFNGLVERTEXATTRIB4BVPROC glad_glVertexAttrib4bv = NULL; +PFNGLVERTEXATTRIB4DPROC glad_glVertexAttrib4d = NULL; +PFNGLVERTEXATTRIB4DVPROC glad_glVertexAttrib4dv = NULL; +PFNGLVERTEXATTRIB4FPROC glad_glVertexAttrib4f = NULL; +PFNGLVERTEXATTRIB4FVPROC glad_glVertexAttrib4fv = NULL; +PFNGLVERTEXATTRIB4IVPROC glad_glVertexAttrib4iv = NULL; +PFNGLVERTEXATTRIB4SPROC glad_glVertexAttrib4s = NULL; +PFNGLVERTEXATTRIB4SVPROC glad_glVertexAttrib4sv = NULL; +PFNGLVERTEXATTRIB4UBVPROC glad_glVertexAttrib4ubv = NULL; +PFNGLVERTEXATTRIB4UIVPROC glad_glVertexAttrib4uiv = NULL; +PFNGLVERTEXATTRIB4USVPROC glad_glVertexAttrib4usv = NULL; +PFNGLVERTEXATTRIBPOINTERPROC glad_glVertexAttribPointer = NULL; PFNGLVERTEXPOINTERPROC glad_glVertexPointer = NULL; PFNGLVIEWPORTPROC glad_glViewport = NULL; -int GLAD_GL_OES_EGL_image = 0; -int GLAD_GL_OES_EGL_image_external = 0; -PFNGLEGLIMAGETARGETTEXTURE2DOESPROC glad_glEGLImageTargetTexture2DOES = NULL; -PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC glad_glEGLImageTargetRenderbufferStorageOES = NULL; -static void load_GL_VERSION_ES_CM_1_0(GLADloadproc load) { - if(!GLAD_GL_VERSION_ES_CM_1_0) return; - glad_glAlphaFunc = (PFNGLALPHAFUNCPROC)load("glAlphaFunc"); - glad_glClearColor = (PFNGLCLEARCOLORPROC)load("glClearColor"); - glad_glClearDepthf = (PFNGLCLEARDEPTHFPROC)load("glClearDepthf"); - glad_glClipPlanef = (PFNGLCLIPPLANEFPROC)load("glClipPlanef"); - glad_glColor4f = (PFNGLCOLOR4FPROC)load("glColor4f"); - glad_glDepthRangef = (PFNGLDEPTHRANGEFPROC)load("glDepthRangef"); - glad_glFogf = (PFNGLFOGFPROC)load("glFogf"); - glad_glFogfv = (PFNGLFOGFVPROC)load("glFogfv"); - glad_glFrustumf = (PFNGLFRUSTUMFPROC)load("glFrustumf"); - glad_glGetClipPlanef = (PFNGLGETCLIPPLANEFPROC)load("glGetClipPlanef"); - glad_glGetFloatv = (PFNGLGETFLOATVPROC)load("glGetFloatv"); - glad_glGetLightfv = (PFNGLGETLIGHTFVPROC)load("glGetLightfv"); - glad_glGetMaterialfv = (PFNGLGETMATERIALFVPROC)load("glGetMaterialfv"); - glad_glGetTexEnvfv = (PFNGLGETTEXENVFVPROC)load("glGetTexEnvfv"); - glad_glGetTexParameterfv = (PFNGLGETTEXPARAMETERFVPROC)load("glGetTexParameterfv"); - glad_glLightModelf = (PFNGLLIGHTMODELFPROC)load("glLightModelf"); - glad_glLightModelfv = (PFNGLLIGHTMODELFVPROC)load("glLightModelfv"); - glad_glLightf = (PFNGLLIGHTFPROC)load("glLightf"); - glad_glLightfv = (PFNGLLIGHTFVPROC)load("glLightfv"); +PFNGLWINDOWPOS2DPROC glad_glWindowPos2d = NULL; +PFNGLWINDOWPOS2DVPROC glad_glWindowPos2dv = NULL; +PFNGLWINDOWPOS2FPROC glad_glWindowPos2f = NULL; +PFNGLWINDOWPOS2FVPROC glad_glWindowPos2fv = NULL; +PFNGLWINDOWPOS2IPROC glad_glWindowPos2i = NULL; +PFNGLWINDOWPOS2IVPROC glad_glWindowPos2iv = NULL; +PFNGLWINDOWPOS2SPROC glad_glWindowPos2s = NULL; +PFNGLWINDOWPOS2SVPROC glad_glWindowPos2sv = NULL; +PFNGLWINDOWPOS3DPROC glad_glWindowPos3d = NULL; +PFNGLWINDOWPOS3DVPROC glad_glWindowPos3dv = NULL; +PFNGLWINDOWPOS3FPROC glad_glWindowPos3f = NULL; +PFNGLWINDOWPOS3FVPROC glad_glWindowPos3fv = NULL; +PFNGLWINDOWPOS3IPROC glad_glWindowPos3i = NULL; +PFNGLWINDOWPOS3IVPROC glad_glWindowPos3iv = NULL; +PFNGLWINDOWPOS3SPROC glad_glWindowPos3s = NULL; +PFNGLWINDOWPOS3SVPROC glad_glWindowPos3sv = NULL; +int GLAD_GL_EXT_EGL_image_storage = 0; +int GLAD_GL_EXT_EGL_sync = 0; +PFNGLEGLIMAGETARGETTEXSTORAGEEXTPROC glad_glEGLImageTargetTexStorageEXT = NULL; +PFNGLEGLIMAGETARGETTEXTURESTORAGEEXTPROC glad_glEGLImageTargetTextureStorageEXT = NULL; +static void load_GL_VERSION_1_0(GLADloadproc load) { + if(!GLAD_GL_VERSION_1_0) return; + glad_glCullFace = (PFNGLCULLFACEPROC)load("glCullFace"); + glad_glFrontFace = (PFNGLFRONTFACEPROC)load("glFrontFace"); + glad_glHint = (PFNGLHINTPROC)load("glHint"); glad_glLineWidth = (PFNGLLINEWIDTHPROC)load("glLineWidth"); - glad_glLoadMatrixf = (PFNGLLOADMATRIXFPROC)load("glLoadMatrixf"); - glad_glMaterialf = (PFNGLMATERIALFPROC)load("glMaterialf"); - glad_glMaterialfv = (PFNGLMATERIALFVPROC)load("glMaterialfv"); - glad_glMultMatrixf = (PFNGLMULTMATRIXFPROC)load("glMultMatrixf"); - glad_glMultiTexCoord4f = (PFNGLMULTITEXCOORD4FPROC)load("glMultiTexCoord4f"); - glad_glNormal3f = (PFNGLNORMAL3FPROC)load("glNormal3f"); - glad_glOrthof = (PFNGLORTHOFPROC)load("glOrthof"); - glad_glPointParameterf = (PFNGLPOINTPARAMETERFPROC)load("glPointParameterf"); - glad_glPointParameterfv = (PFNGLPOINTPARAMETERFVPROC)load("glPointParameterfv"); glad_glPointSize = (PFNGLPOINTSIZEPROC)load("glPointSize"); - glad_glPolygonOffset = (PFNGLPOLYGONOFFSETPROC)load("glPolygonOffset"); - glad_glRotatef = (PFNGLROTATEFPROC)load("glRotatef"); - glad_glScalef = (PFNGLSCALEFPROC)load("glScalef"); - glad_glTexEnvf = (PFNGLTEXENVFPROC)load("glTexEnvf"); - glad_glTexEnvfv = (PFNGLTEXENVFVPROC)load("glTexEnvfv"); + glad_glPolygonMode = (PFNGLPOLYGONMODEPROC)load("glPolygonMode"); + glad_glScissor = (PFNGLSCISSORPROC)load("glScissor"); glad_glTexParameterf = (PFNGLTEXPARAMETERFPROC)load("glTexParameterf"); glad_glTexParameterfv = (PFNGLTEXPARAMETERFVPROC)load("glTexParameterfv"); - glad_glTranslatef = (PFNGLTRANSLATEFPROC)load("glTranslatef"); - glad_glActiveTexture = (PFNGLACTIVETEXTUREPROC)load("glActiveTexture"); - glad_glAlphaFuncx = (PFNGLALPHAFUNCXPROC)load("glAlphaFuncx"); - glad_glBindBuffer = (PFNGLBINDBUFFERPROC)load("glBindBuffer"); - glad_glBindTexture = (PFNGLBINDTEXTUREPROC)load("glBindTexture"); - glad_glBlendFunc = (PFNGLBLENDFUNCPROC)load("glBlendFunc"); - glad_glBufferData = (PFNGLBUFFERDATAPROC)load("glBufferData"); - glad_glBufferSubData = (PFNGLBUFFERSUBDATAPROC)load("glBufferSubData"); + glad_glTexParameteri = (PFNGLTEXPARAMETERIPROC)load("glTexParameteri"); + glad_glTexParameteriv = (PFNGLTEXPARAMETERIVPROC)load("glTexParameteriv"); + glad_glTexImage1D = (PFNGLTEXIMAGE1DPROC)load("glTexImage1D"); + glad_glTexImage2D = (PFNGLTEXIMAGE2DPROC)load("glTexImage2D"); + glad_glDrawBuffer = (PFNGLDRAWBUFFERPROC)load("glDrawBuffer"); glad_glClear = (PFNGLCLEARPROC)load("glClear"); - glad_glClearColorx = (PFNGLCLEARCOLORXPROC)load("glClearColorx"); - glad_glClearDepthx = (PFNGLCLEARDEPTHXPROC)load("glClearDepthx"); + glad_glClearColor = (PFNGLCLEARCOLORPROC)load("glClearColor"); glad_glClearStencil = (PFNGLCLEARSTENCILPROC)load("glClearStencil"); - glad_glClientActiveTexture = (PFNGLCLIENTACTIVETEXTUREPROC)load("glClientActiveTexture"); - glad_glClipPlanex = (PFNGLCLIPPLANEXPROC)load("glClipPlanex"); - glad_glColor4ub = (PFNGLCOLOR4UBPROC)load("glColor4ub"); - glad_glColor4x = (PFNGLCOLOR4XPROC)load("glColor4x"); + glad_glClearDepth = (PFNGLCLEARDEPTHPROC)load("glClearDepth"); + glad_glStencilMask = (PFNGLSTENCILMASKPROC)load("glStencilMask"); glad_glColorMask = (PFNGLCOLORMASKPROC)load("glColorMask"); - glad_glColorPointer = (PFNGLCOLORPOINTERPROC)load("glColorPointer"); - glad_glCompressedTexImage2D = (PFNGLCOMPRESSEDTEXIMAGE2DPROC)load("glCompressedTexImage2D"); - glad_glCompressedTexSubImage2D = (PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC)load("glCompressedTexSubImage2D"); - glad_glCopyTexImage2D = (PFNGLCOPYTEXIMAGE2DPROC)load("glCopyTexImage2D"); - glad_glCopyTexSubImage2D = (PFNGLCOPYTEXSUBIMAGE2DPROC)load("glCopyTexSubImage2D"); - glad_glCullFace = (PFNGLCULLFACEPROC)load("glCullFace"); - glad_glDeleteBuffers = (PFNGLDELETEBUFFERSPROC)load("glDeleteBuffers"); - glad_glDeleteTextures = (PFNGLDELETETEXTURESPROC)load("glDeleteTextures"); - glad_glDepthFunc = (PFNGLDEPTHFUNCPROC)load("glDepthFunc"); glad_glDepthMask = (PFNGLDEPTHMASKPROC)load("glDepthMask"); - glad_glDepthRangex = (PFNGLDEPTHRANGEXPROC)load("glDepthRangex"); glad_glDisable = (PFNGLDISABLEPROC)load("glDisable"); - glad_glDisableClientState = (PFNGLDISABLECLIENTSTATEPROC)load("glDisableClientState"); - glad_glDrawArrays = (PFNGLDRAWARRAYSPROC)load("glDrawArrays"); - glad_glDrawElements = (PFNGLDRAWELEMENTSPROC)load("glDrawElements"); glad_glEnable = (PFNGLENABLEPROC)load("glEnable"); - glad_glEnableClientState = (PFNGLENABLECLIENTSTATEPROC)load("glEnableClientState"); glad_glFinish = (PFNGLFINISHPROC)load("glFinish"); glad_glFlush = (PFNGLFLUSHPROC)load("glFlush"); - glad_glFogx = (PFNGLFOGXPROC)load("glFogx"); - glad_glFogxv = (PFNGLFOGXVPROC)load("glFogxv"); - glad_glFrontFace = (PFNGLFRONTFACEPROC)load("glFrontFace"); - glad_glFrustumx = (PFNGLFRUSTUMXPROC)load("glFrustumx"); - glad_glGetBooleanv = (PFNGLGETBOOLEANVPROC)load("glGetBooleanv"); - glad_glGetBufferParameteriv = (PFNGLGETBUFFERPARAMETERIVPROC)load("glGetBufferParameteriv"); - glad_glGetClipPlanex = (PFNGLGETCLIPPLANEXPROC)load("glGetClipPlanex"); - glad_glGenBuffers = (PFNGLGENBUFFERSPROC)load("glGenBuffers"); - glad_glGenTextures = (PFNGLGENTEXTURESPROC)load("glGenTextures"); - glad_glGetError = (PFNGLGETERRORPROC)load("glGetError"); - glad_glGetFixedv = (PFNGLGETFIXEDVPROC)load("glGetFixedv"); - glad_glGetIntegerv = (PFNGLGETINTEGERVPROC)load("glGetIntegerv"); - glad_glGetLightxv = (PFNGLGETLIGHTXVPROC)load("glGetLightxv"); - glad_glGetMaterialxv = (PFNGLGETMATERIALXVPROC)load("glGetMaterialxv"); - glad_glGetPointerv = (PFNGLGETPOINTERVPROC)load("glGetPointerv"); - glad_glGetString = (PFNGLGETSTRINGPROC)load("glGetString"); - glad_glGetTexEnviv = (PFNGLGETTEXENVIVPROC)load("glGetTexEnviv"); - glad_glGetTexEnvxv = (PFNGLGETTEXENVXVPROC)load("glGetTexEnvxv"); - glad_glGetTexParameteriv = (PFNGLGETTEXPARAMETERIVPROC)load("glGetTexParameteriv"); - glad_glGetTexParameterxv = (PFNGLGETTEXPARAMETERXVPROC)load("glGetTexParameterxv"); - glad_glHint = (PFNGLHINTPROC)load("glHint"); - glad_glIsBuffer = (PFNGLISBUFFERPROC)load("glIsBuffer"); - glad_glIsEnabled = (PFNGLISENABLEDPROC)load("glIsEnabled"); - glad_glIsTexture = (PFNGLISTEXTUREPROC)load("glIsTexture"); - glad_glLightModelx = (PFNGLLIGHTMODELXPROC)load("glLightModelx"); - glad_glLightModelxv = (PFNGLLIGHTMODELXVPROC)load("glLightModelxv"); - glad_glLightx = (PFNGLLIGHTXPROC)load("glLightx"); - glad_glLightxv = (PFNGLLIGHTXVPROC)load("glLightxv"); - glad_glLineWidthx = (PFNGLLINEWIDTHXPROC)load("glLineWidthx"); - glad_glLoadIdentity = (PFNGLLOADIDENTITYPROC)load("glLoadIdentity"); - glad_glLoadMatrixx = (PFNGLLOADMATRIXXPROC)load("glLoadMatrixx"); + glad_glBlendFunc = (PFNGLBLENDFUNCPROC)load("glBlendFunc"); glad_glLogicOp = (PFNGLLOGICOPPROC)load("glLogicOp"); - glad_glMaterialx = (PFNGLMATERIALXPROC)load("glMaterialx"); - glad_glMaterialxv = (PFNGLMATERIALXVPROC)load("glMaterialxv"); - glad_glMatrixMode = (PFNGLMATRIXMODEPROC)load("glMatrixMode"); - glad_glMultMatrixx = (PFNGLMULTMATRIXXPROC)load("glMultMatrixx"); - glad_glMultiTexCoord4x = (PFNGLMULTITEXCOORD4XPROC)load("glMultiTexCoord4x"); - glad_glNormal3x = (PFNGLNORMAL3XPROC)load("glNormal3x"); - glad_glNormalPointer = (PFNGLNORMALPOINTERPROC)load("glNormalPointer"); - glad_glOrthox = (PFNGLORTHOXPROC)load("glOrthox"); + glad_glStencilFunc = (PFNGLSTENCILFUNCPROC)load("glStencilFunc"); + glad_glStencilOp = (PFNGLSTENCILOPPROC)load("glStencilOp"); + glad_glDepthFunc = (PFNGLDEPTHFUNCPROC)load("glDepthFunc"); + glad_glPixelStoref = (PFNGLPIXELSTOREFPROC)load("glPixelStoref"); glad_glPixelStorei = (PFNGLPIXELSTOREIPROC)load("glPixelStorei"); - glad_glPointParameterx = (PFNGLPOINTPARAMETERXPROC)load("glPointParameterx"); - glad_glPointParameterxv = (PFNGLPOINTPARAMETERXVPROC)load("glPointParameterxv"); - glad_glPointSizex = (PFNGLPOINTSIZEXPROC)load("glPointSizex"); - glad_glPolygonOffsetx = (PFNGLPOLYGONOFFSETXPROC)load("glPolygonOffsetx"); + glad_glReadBuffer = (PFNGLREADBUFFERPROC)load("glReadBuffer"); + glad_glReadPixels = (PFNGLREADPIXELSPROC)load("glReadPixels"); + glad_glGetBooleanv = (PFNGLGETBOOLEANVPROC)load("glGetBooleanv"); + glad_glGetDoublev = (PFNGLGETDOUBLEVPROC)load("glGetDoublev"); + glad_glGetError = (PFNGLGETERRORPROC)load("glGetError"); + glad_glGetFloatv = (PFNGLGETFLOATVPROC)load("glGetFloatv"); + glad_glGetIntegerv = (PFNGLGETINTEGERVPROC)load("glGetIntegerv"); + glad_glGetString = (PFNGLGETSTRINGPROC)load("glGetString"); + glad_glGetTexImage = (PFNGLGETTEXIMAGEPROC)load("glGetTexImage"); + glad_glGetTexParameterfv = (PFNGLGETTEXPARAMETERFVPROC)load("glGetTexParameterfv"); + glad_glGetTexParameteriv = (PFNGLGETTEXPARAMETERIVPROC)load("glGetTexParameteriv"); + glad_glGetTexLevelParameterfv = (PFNGLGETTEXLEVELPARAMETERFVPROC)load("glGetTexLevelParameterfv"); + glad_glGetTexLevelParameteriv = (PFNGLGETTEXLEVELPARAMETERIVPROC)load("glGetTexLevelParameteriv"); + glad_glIsEnabled = (PFNGLISENABLEDPROC)load("glIsEnabled"); + glad_glDepthRange = (PFNGLDEPTHRANGEPROC)load("glDepthRange"); + glad_glViewport = (PFNGLVIEWPORTPROC)load("glViewport"); + glad_glNewList = (PFNGLNEWLISTPROC)load("glNewList"); + glad_glEndList = (PFNGLENDLISTPROC)load("glEndList"); + glad_glCallList = (PFNGLCALLLISTPROC)load("glCallList"); + glad_glCallLists = (PFNGLCALLLISTSPROC)load("glCallLists"); + glad_glDeleteLists = (PFNGLDELETELISTSPROC)load("glDeleteLists"); + glad_glGenLists = (PFNGLGENLISTSPROC)load("glGenLists"); + glad_glListBase = (PFNGLLISTBASEPROC)load("glListBase"); + glad_glBegin = (PFNGLBEGINPROC)load("glBegin"); + glad_glBitmap = (PFNGLBITMAPPROC)load("glBitmap"); + glad_glColor3b = (PFNGLCOLOR3BPROC)load("glColor3b"); + glad_glColor3bv = (PFNGLCOLOR3BVPROC)load("glColor3bv"); + glad_glColor3d = (PFNGLCOLOR3DPROC)load("glColor3d"); + glad_glColor3dv = (PFNGLCOLOR3DVPROC)load("glColor3dv"); + glad_glColor3f = (PFNGLCOLOR3FPROC)load("glColor3f"); + glad_glColor3fv = (PFNGLCOLOR3FVPROC)load("glColor3fv"); + glad_glColor3i = (PFNGLCOLOR3IPROC)load("glColor3i"); + glad_glColor3iv = (PFNGLCOLOR3IVPROC)load("glColor3iv"); + glad_glColor3s = (PFNGLCOLOR3SPROC)load("glColor3s"); + glad_glColor3sv = (PFNGLCOLOR3SVPROC)load("glColor3sv"); + glad_glColor3ub = (PFNGLCOLOR3UBPROC)load("glColor3ub"); + glad_glColor3ubv = (PFNGLCOLOR3UBVPROC)load("glColor3ubv"); + glad_glColor3ui = (PFNGLCOLOR3UIPROC)load("glColor3ui"); + glad_glColor3uiv = (PFNGLCOLOR3UIVPROC)load("glColor3uiv"); + glad_glColor3us = (PFNGLCOLOR3USPROC)load("glColor3us"); + glad_glColor3usv = (PFNGLCOLOR3USVPROC)load("glColor3usv"); + glad_glColor4b = (PFNGLCOLOR4BPROC)load("glColor4b"); + glad_glColor4bv = (PFNGLCOLOR4BVPROC)load("glColor4bv"); + glad_glColor4d = (PFNGLCOLOR4DPROC)load("glColor4d"); + glad_glColor4dv = (PFNGLCOLOR4DVPROC)load("glColor4dv"); + glad_glColor4f = (PFNGLCOLOR4FPROC)load("glColor4f"); + glad_glColor4fv = (PFNGLCOLOR4FVPROC)load("glColor4fv"); + glad_glColor4i = (PFNGLCOLOR4IPROC)load("glColor4i"); + glad_glColor4iv = (PFNGLCOLOR4IVPROC)load("glColor4iv"); + glad_glColor4s = (PFNGLCOLOR4SPROC)load("glColor4s"); + glad_glColor4sv = (PFNGLCOLOR4SVPROC)load("glColor4sv"); + glad_glColor4ub = (PFNGLCOLOR4UBPROC)load("glColor4ub"); + glad_glColor4ubv = (PFNGLCOLOR4UBVPROC)load("glColor4ubv"); + glad_glColor4ui = (PFNGLCOLOR4UIPROC)load("glColor4ui"); + glad_glColor4uiv = (PFNGLCOLOR4UIVPROC)load("glColor4uiv"); + glad_glColor4us = (PFNGLCOLOR4USPROC)load("glColor4us"); + glad_glColor4usv = (PFNGLCOLOR4USVPROC)load("glColor4usv"); + glad_glEdgeFlag = (PFNGLEDGEFLAGPROC)load("glEdgeFlag"); + glad_glEdgeFlagv = (PFNGLEDGEFLAGVPROC)load("glEdgeFlagv"); + glad_glEnd = (PFNGLENDPROC)load("glEnd"); + glad_glIndexd = (PFNGLINDEXDPROC)load("glIndexd"); + glad_glIndexdv = (PFNGLINDEXDVPROC)load("glIndexdv"); + glad_glIndexf = (PFNGLINDEXFPROC)load("glIndexf"); + glad_glIndexfv = (PFNGLINDEXFVPROC)load("glIndexfv"); + glad_glIndexi = (PFNGLINDEXIPROC)load("glIndexi"); + glad_glIndexiv = (PFNGLINDEXIVPROC)load("glIndexiv"); + glad_glIndexs = (PFNGLINDEXSPROC)load("glIndexs"); + glad_glIndexsv = (PFNGLINDEXSVPROC)load("glIndexsv"); + glad_glNormal3b = (PFNGLNORMAL3BPROC)load("glNormal3b"); + glad_glNormal3bv = (PFNGLNORMAL3BVPROC)load("glNormal3bv"); + glad_glNormal3d = (PFNGLNORMAL3DPROC)load("glNormal3d"); + glad_glNormal3dv = (PFNGLNORMAL3DVPROC)load("glNormal3dv"); + glad_glNormal3f = (PFNGLNORMAL3FPROC)load("glNormal3f"); + glad_glNormal3fv = (PFNGLNORMAL3FVPROC)load("glNormal3fv"); + glad_glNormal3i = (PFNGLNORMAL3IPROC)load("glNormal3i"); + glad_glNormal3iv = (PFNGLNORMAL3IVPROC)load("glNormal3iv"); + glad_glNormal3s = (PFNGLNORMAL3SPROC)load("glNormal3s"); + glad_glNormal3sv = (PFNGLNORMAL3SVPROC)load("glNormal3sv"); + glad_glRasterPos2d = (PFNGLRASTERPOS2DPROC)load("glRasterPos2d"); + glad_glRasterPos2dv = (PFNGLRASTERPOS2DVPROC)load("glRasterPos2dv"); + glad_glRasterPos2f = (PFNGLRASTERPOS2FPROC)load("glRasterPos2f"); + glad_glRasterPos2fv = (PFNGLRASTERPOS2FVPROC)load("glRasterPos2fv"); + glad_glRasterPos2i = (PFNGLRASTERPOS2IPROC)load("glRasterPos2i"); + glad_glRasterPos2iv = (PFNGLRASTERPOS2IVPROC)load("glRasterPos2iv"); + glad_glRasterPos2s = (PFNGLRASTERPOS2SPROC)load("glRasterPos2s"); + glad_glRasterPos2sv = (PFNGLRASTERPOS2SVPROC)load("glRasterPos2sv"); + glad_glRasterPos3d = (PFNGLRASTERPOS3DPROC)load("glRasterPos3d"); + glad_glRasterPos3dv = (PFNGLRASTERPOS3DVPROC)load("glRasterPos3dv"); + glad_glRasterPos3f = (PFNGLRASTERPOS3FPROC)load("glRasterPos3f"); + glad_glRasterPos3fv = (PFNGLRASTERPOS3FVPROC)load("glRasterPos3fv"); + glad_glRasterPos3i = (PFNGLRASTERPOS3IPROC)load("glRasterPos3i"); + glad_glRasterPos3iv = (PFNGLRASTERPOS3IVPROC)load("glRasterPos3iv"); + glad_glRasterPos3s = (PFNGLRASTERPOS3SPROC)load("glRasterPos3s"); + glad_glRasterPos3sv = (PFNGLRASTERPOS3SVPROC)load("glRasterPos3sv"); + glad_glRasterPos4d = (PFNGLRASTERPOS4DPROC)load("glRasterPos4d"); + glad_glRasterPos4dv = (PFNGLRASTERPOS4DVPROC)load("glRasterPos4dv"); + glad_glRasterPos4f = (PFNGLRASTERPOS4FPROC)load("glRasterPos4f"); + glad_glRasterPos4fv = (PFNGLRASTERPOS4FVPROC)load("glRasterPos4fv"); + glad_glRasterPos4i = (PFNGLRASTERPOS4IPROC)load("glRasterPos4i"); + glad_glRasterPos4iv = (PFNGLRASTERPOS4IVPROC)load("glRasterPos4iv"); + glad_glRasterPos4s = (PFNGLRASTERPOS4SPROC)load("glRasterPos4s"); + glad_glRasterPos4sv = (PFNGLRASTERPOS4SVPROC)load("glRasterPos4sv"); + glad_glRectd = (PFNGLRECTDPROC)load("glRectd"); + glad_glRectdv = (PFNGLRECTDVPROC)load("glRectdv"); + glad_glRectf = (PFNGLRECTFPROC)load("glRectf"); + glad_glRectfv = (PFNGLRECTFVPROC)load("glRectfv"); + glad_glRecti = (PFNGLRECTIPROC)load("glRecti"); + glad_glRectiv = (PFNGLRECTIVPROC)load("glRectiv"); + glad_glRects = (PFNGLRECTSPROC)load("glRects"); + glad_glRectsv = (PFNGLRECTSVPROC)load("glRectsv"); + glad_glTexCoord1d = (PFNGLTEXCOORD1DPROC)load("glTexCoord1d"); + glad_glTexCoord1dv = (PFNGLTEXCOORD1DVPROC)load("glTexCoord1dv"); + glad_glTexCoord1f = (PFNGLTEXCOORD1FPROC)load("glTexCoord1f"); + glad_glTexCoord1fv = (PFNGLTEXCOORD1FVPROC)load("glTexCoord1fv"); + glad_glTexCoord1i = (PFNGLTEXCOORD1IPROC)load("glTexCoord1i"); + glad_glTexCoord1iv = (PFNGLTEXCOORD1IVPROC)load("glTexCoord1iv"); + glad_glTexCoord1s = (PFNGLTEXCOORD1SPROC)load("glTexCoord1s"); + glad_glTexCoord1sv = (PFNGLTEXCOORD1SVPROC)load("glTexCoord1sv"); + glad_glTexCoord2d = (PFNGLTEXCOORD2DPROC)load("glTexCoord2d"); + glad_glTexCoord2dv = (PFNGLTEXCOORD2DVPROC)load("glTexCoord2dv"); + glad_glTexCoord2f = (PFNGLTEXCOORD2FPROC)load("glTexCoord2f"); + glad_glTexCoord2fv = (PFNGLTEXCOORD2FVPROC)load("glTexCoord2fv"); + glad_glTexCoord2i = (PFNGLTEXCOORD2IPROC)load("glTexCoord2i"); + glad_glTexCoord2iv = (PFNGLTEXCOORD2IVPROC)load("glTexCoord2iv"); + glad_glTexCoord2s = (PFNGLTEXCOORD2SPROC)load("glTexCoord2s"); + glad_glTexCoord2sv = (PFNGLTEXCOORD2SVPROC)load("glTexCoord2sv"); + glad_glTexCoord3d = (PFNGLTEXCOORD3DPROC)load("glTexCoord3d"); + glad_glTexCoord3dv = (PFNGLTEXCOORD3DVPROC)load("glTexCoord3dv"); + glad_glTexCoord3f = (PFNGLTEXCOORD3FPROC)load("glTexCoord3f"); + glad_glTexCoord3fv = (PFNGLTEXCOORD3FVPROC)load("glTexCoord3fv"); + glad_glTexCoord3i = (PFNGLTEXCOORD3IPROC)load("glTexCoord3i"); + glad_glTexCoord3iv = (PFNGLTEXCOORD3IVPROC)load("glTexCoord3iv"); + glad_glTexCoord3s = (PFNGLTEXCOORD3SPROC)load("glTexCoord3s"); + glad_glTexCoord3sv = (PFNGLTEXCOORD3SVPROC)load("glTexCoord3sv"); + glad_glTexCoord4d = (PFNGLTEXCOORD4DPROC)load("glTexCoord4d"); + glad_glTexCoord4dv = (PFNGLTEXCOORD4DVPROC)load("glTexCoord4dv"); + glad_glTexCoord4f = (PFNGLTEXCOORD4FPROC)load("glTexCoord4f"); + glad_glTexCoord4fv = (PFNGLTEXCOORD4FVPROC)load("glTexCoord4fv"); + glad_glTexCoord4i = (PFNGLTEXCOORD4IPROC)load("glTexCoord4i"); + glad_glTexCoord4iv = (PFNGLTEXCOORD4IVPROC)load("glTexCoord4iv"); + glad_glTexCoord4s = (PFNGLTEXCOORD4SPROC)load("glTexCoord4s"); + glad_glTexCoord4sv = (PFNGLTEXCOORD4SVPROC)load("glTexCoord4sv"); + glad_glVertex2d = (PFNGLVERTEX2DPROC)load("glVertex2d"); + glad_glVertex2dv = (PFNGLVERTEX2DVPROC)load("glVertex2dv"); + glad_glVertex2f = (PFNGLVERTEX2FPROC)load("glVertex2f"); + glad_glVertex2fv = (PFNGLVERTEX2FVPROC)load("glVertex2fv"); + glad_glVertex2i = (PFNGLVERTEX2IPROC)load("glVertex2i"); + glad_glVertex2iv = (PFNGLVERTEX2IVPROC)load("glVertex2iv"); + glad_glVertex2s = (PFNGLVERTEX2SPROC)load("glVertex2s"); + glad_glVertex2sv = (PFNGLVERTEX2SVPROC)load("glVertex2sv"); + glad_glVertex3d = (PFNGLVERTEX3DPROC)load("glVertex3d"); + glad_glVertex3dv = (PFNGLVERTEX3DVPROC)load("glVertex3dv"); + glad_glVertex3f = (PFNGLVERTEX3FPROC)load("glVertex3f"); + glad_glVertex3fv = (PFNGLVERTEX3FVPROC)load("glVertex3fv"); + glad_glVertex3i = (PFNGLVERTEX3IPROC)load("glVertex3i"); + glad_glVertex3iv = (PFNGLVERTEX3IVPROC)load("glVertex3iv"); + glad_glVertex3s = (PFNGLVERTEX3SPROC)load("glVertex3s"); + glad_glVertex3sv = (PFNGLVERTEX3SVPROC)load("glVertex3sv"); + glad_glVertex4d = (PFNGLVERTEX4DPROC)load("glVertex4d"); + glad_glVertex4dv = (PFNGLVERTEX4DVPROC)load("glVertex4dv"); + glad_glVertex4f = (PFNGLVERTEX4FPROC)load("glVertex4f"); + glad_glVertex4fv = (PFNGLVERTEX4FVPROC)load("glVertex4fv"); + glad_glVertex4i = (PFNGLVERTEX4IPROC)load("glVertex4i"); + glad_glVertex4iv = (PFNGLVERTEX4IVPROC)load("glVertex4iv"); + glad_glVertex4s = (PFNGLVERTEX4SPROC)load("glVertex4s"); + glad_glVertex4sv = (PFNGLVERTEX4SVPROC)load("glVertex4sv"); + glad_glClipPlane = (PFNGLCLIPPLANEPROC)load("glClipPlane"); + glad_glColorMaterial = (PFNGLCOLORMATERIALPROC)load("glColorMaterial"); + glad_glFogf = (PFNGLFOGFPROC)load("glFogf"); + glad_glFogfv = (PFNGLFOGFVPROC)load("glFogfv"); + glad_glFogi = (PFNGLFOGIPROC)load("glFogi"); + glad_glFogiv = (PFNGLFOGIVPROC)load("glFogiv"); + glad_glLightf = (PFNGLLIGHTFPROC)load("glLightf"); + glad_glLightfv = (PFNGLLIGHTFVPROC)load("glLightfv"); + glad_glLighti = (PFNGLLIGHTIPROC)load("glLighti"); + glad_glLightiv = (PFNGLLIGHTIVPROC)load("glLightiv"); + glad_glLightModelf = (PFNGLLIGHTMODELFPROC)load("glLightModelf"); + glad_glLightModelfv = (PFNGLLIGHTMODELFVPROC)load("glLightModelfv"); + glad_glLightModeli = (PFNGLLIGHTMODELIPROC)load("glLightModeli"); + glad_glLightModeliv = (PFNGLLIGHTMODELIVPROC)load("glLightModeliv"); + glad_glLineStipple = (PFNGLLINESTIPPLEPROC)load("glLineStipple"); + glad_glMaterialf = (PFNGLMATERIALFPROC)load("glMaterialf"); + glad_glMaterialfv = (PFNGLMATERIALFVPROC)load("glMaterialfv"); + glad_glMateriali = (PFNGLMATERIALIPROC)load("glMateriali"); + glad_glMaterialiv = (PFNGLMATERIALIVPROC)load("glMaterialiv"); + glad_glPolygonStipple = (PFNGLPOLYGONSTIPPLEPROC)load("glPolygonStipple"); + glad_glShadeModel = (PFNGLSHADEMODELPROC)load("glShadeModel"); + glad_glTexEnvf = (PFNGLTEXENVFPROC)load("glTexEnvf"); + glad_glTexEnvfv = (PFNGLTEXENVFVPROC)load("glTexEnvfv"); + glad_glTexEnvi = (PFNGLTEXENVIPROC)load("glTexEnvi"); + glad_glTexEnviv = (PFNGLTEXENVIVPROC)load("glTexEnviv"); + glad_glTexGend = (PFNGLTEXGENDPROC)load("glTexGend"); + glad_glTexGendv = (PFNGLTEXGENDVPROC)load("glTexGendv"); + glad_glTexGenf = (PFNGLTEXGENFPROC)load("glTexGenf"); + glad_glTexGenfv = (PFNGLTEXGENFVPROC)load("glTexGenfv"); + glad_glTexGeni = (PFNGLTEXGENIPROC)load("glTexGeni"); + glad_glTexGeniv = (PFNGLTEXGENIVPROC)load("glTexGeniv"); + glad_glFeedbackBuffer = (PFNGLFEEDBACKBUFFERPROC)load("glFeedbackBuffer"); + glad_glSelectBuffer = (PFNGLSELECTBUFFERPROC)load("glSelectBuffer"); + glad_glRenderMode = (PFNGLRENDERMODEPROC)load("glRenderMode"); + glad_glInitNames = (PFNGLINITNAMESPROC)load("glInitNames"); + glad_glLoadName = (PFNGLLOADNAMEPROC)load("glLoadName"); + glad_glPassThrough = (PFNGLPASSTHROUGHPROC)load("glPassThrough"); + glad_glPopName = (PFNGLPOPNAMEPROC)load("glPopName"); + glad_glPushName = (PFNGLPUSHNAMEPROC)load("glPushName"); + glad_glClearAccum = (PFNGLCLEARACCUMPROC)load("glClearAccum"); + glad_glClearIndex = (PFNGLCLEARINDEXPROC)load("glClearIndex"); + glad_glIndexMask = (PFNGLINDEXMASKPROC)load("glIndexMask"); + glad_glAccum = (PFNGLACCUMPROC)load("glAccum"); + glad_glPopAttrib = (PFNGLPOPATTRIBPROC)load("glPopAttrib"); + glad_glPushAttrib = (PFNGLPUSHATTRIBPROC)load("glPushAttrib"); + glad_glMap1d = (PFNGLMAP1DPROC)load("glMap1d"); + glad_glMap1f = (PFNGLMAP1FPROC)load("glMap1f"); + glad_glMap2d = (PFNGLMAP2DPROC)load("glMap2d"); + glad_glMap2f = (PFNGLMAP2FPROC)load("glMap2f"); + glad_glMapGrid1d = (PFNGLMAPGRID1DPROC)load("glMapGrid1d"); + glad_glMapGrid1f = (PFNGLMAPGRID1FPROC)load("glMapGrid1f"); + glad_glMapGrid2d = (PFNGLMAPGRID2DPROC)load("glMapGrid2d"); + glad_glMapGrid2f = (PFNGLMAPGRID2FPROC)load("glMapGrid2f"); + glad_glEvalCoord1d = (PFNGLEVALCOORD1DPROC)load("glEvalCoord1d"); + glad_glEvalCoord1dv = (PFNGLEVALCOORD1DVPROC)load("glEvalCoord1dv"); + glad_glEvalCoord1f = (PFNGLEVALCOORD1FPROC)load("glEvalCoord1f"); + glad_glEvalCoord1fv = (PFNGLEVALCOORD1FVPROC)load("glEvalCoord1fv"); + glad_glEvalCoord2d = (PFNGLEVALCOORD2DPROC)load("glEvalCoord2d"); + glad_glEvalCoord2dv = (PFNGLEVALCOORD2DVPROC)load("glEvalCoord2dv"); + glad_glEvalCoord2f = (PFNGLEVALCOORD2FPROC)load("glEvalCoord2f"); + glad_glEvalCoord2fv = (PFNGLEVALCOORD2FVPROC)load("glEvalCoord2fv"); + glad_glEvalMesh1 = (PFNGLEVALMESH1PROC)load("glEvalMesh1"); + glad_glEvalPoint1 = (PFNGLEVALPOINT1PROC)load("glEvalPoint1"); + glad_glEvalMesh2 = (PFNGLEVALMESH2PROC)load("glEvalMesh2"); + glad_glEvalPoint2 = (PFNGLEVALPOINT2PROC)load("glEvalPoint2"); + glad_glAlphaFunc = (PFNGLALPHAFUNCPROC)load("glAlphaFunc"); + glad_glPixelZoom = (PFNGLPIXELZOOMPROC)load("glPixelZoom"); + glad_glPixelTransferf = (PFNGLPIXELTRANSFERFPROC)load("glPixelTransferf"); + glad_glPixelTransferi = (PFNGLPIXELTRANSFERIPROC)load("glPixelTransferi"); + glad_glPixelMapfv = (PFNGLPIXELMAPFVPROC)load("glPixelMapfv"); + glad_glPixelMapuiv = (PFNGLPIXELMAPUIVPROC)load("glPixelMapuiv"); + glad_glPixelMapusv = (PFNGLPIXELMAPUSVPROC)load("glPixelMapusv"); + glad_glCopyPixels = (PFNGLCOPYPIXELSPROC)load("glCopyPixels"); + glad_glDrawPixels = (PFNGLDRAWPIXELSPROC)load("glDrawPixels"); + glad_glGetClipPlane = (PFNGLGETCLIPPLANEPROC)load("glGetClipPlane"); + glad_glGetLightfv = (PFNGLGETLIGHTFVPROC)load("glGetLightfv"); + glad_glGetLightiv = (PFNGLGETLIGHTIVPROC)load("glGetLightiv"); + glad_glGetMapdv = (PFNGLGETMAPDVPROC)load("glGetMapdv"); + glad_glGetMapfv = (PFNGLGETMAPFVPROC)load("glGetMapfv"); + glad_glGetMapiv = (PFNGLGETMAPIVPROC)load("glGetMapiv"); + glad_glGetMaterialfv = (PFNGLGETMATERIALFVPROC)load("glGetMaterialfv"); + glad_glGetMaterialiv = (PFNGLGETMATERIALIVPROC)load("glGetMaterialiv"); + glad_glGetPixelMapfv = (PFNGLGETPIXELMAPFVPROC)load("glGetPixelMapfv"); + glad_glGetPixelMapuiv = (PFNGLGETPIXELMAPUIVPROC)load("glGetPixelMapuiv"); + glad_glGetPixelMapusv = (PFNGLGETPIXELMAPUSVPROC)load("glGetPixelMapusv"); + glad_glGetPolygonStipple = (PFNGLGETPOLYGONSTIPPLEPROC)load("glGetPolygonStipple"); + glad_glGetTexEnvfv = (PFNGLGETTEXENVFVPROC)load("glGetTexEnvfv"); + glad_glGetTexEnviv = (PFNGLGETTEXENVIVPROC)load("glGetTexEnviv"); + glad_glGetTexGendv = (PFNGLGETTEXGENDVPROC)load("glGetTexGendv"); + glad_glGetTexGenfv = (PFNGLGETTEXGENFVPROC)load("glGetTexGenfv"); + glad_glGetTexGeniv = (PFNGLGETTEXGENIVPROC)load("glGetTexGeniv"); + glad_glIsList = (PFNGLISLISTPROC)load("glIsList"); + glad_glFrustum = (PFNGLFRUSTUMPROC)load("glFrustum"); + glad_glLoadIdentity = (PFNGLLOADIDENTITYPROC)load("glLoadIdentity"); + glad_glLoadMatrixf = (PFNGLLOADMATRIXFPROC)load("glLoadMatrixf"); + glad_glLoadMatrixd = (PFNGLLOADMATRIXDPROC)load("glLoadMatrixd"); + glad_glMatrixMode = (PFNGLMATRIXMODEPROC)load("glMatrixMode"); + glad_glMultMatrixf = (PFNGLMULTMATRIXFPROC)load("glMultMatrixf"); + glad_glMultMatrixd = (PFNGLMULTMATRIXDPROC)load("glMultMatrixd"); + glad_glOrtho = (PFNGLORTHOPROC)load("glOrtho"); glad_glPopMatrix = (PFNGLPOPMATRIXPROC)load("glPopMatrix"); glad_glPushMatrix = (PFNGLPUSHMATRIXPROC)load("glPushMatrix"); - glad_glReadPixels = (PFNGLREADPIXELSPROC)load("glReadPixels"); - glad_glRotatex = (PFNGLROTATEXPROC)load("glRotatex"); - glad_glSampleCoverage = (PFNGLSAMPLECOVERAGEPROC)load("glSampleCoverage"); - glad_glSampleCoveragex = (PFNGLSAMPLECOVERAGEXPROC)load("glSampleCoveragex"); - glad_glScalex = (PFNGLSCALEXPROC)load("glScalex"); - glad_glScissor = (PFNGLSCISSORPROC)load("glScissor"); - glad_glShadeModel = (PFNGLSHADEMODELPROC)load("glShadeModel"); - glad_glStencilFunc = (PFNGLSTENCILFUNCPROC)load("glStencilFunc"); - glad_glStencilMask = (PFNGLSTENCILMASKPROC)load("glStencilMask"); - glad_glStencilOp = (PFNGLSTENCILOPPROC)load("glStencilOp"); - glad_glTexCoordPointer = (PFNGLTEXCOORDPOINTERPROC)load("glTexCoordPointer"); - glad_glTexEnvi = (PFNGLTEXENVIPROC)load("glTexEnvi"); - glad_glTexEnvx = (PFNGLTEXENVXPROC)load("glTexEnvx"); - glad_glTexEnviv = (PFNGLTEXENVIVPROC)load("glTexEnviv"); - glad_glTexEnvxv = (PFNGLTEXENVXVPROC)load("glTexEnvxv"); - glad_glTexImage2D = (PFNGLTEXIMAGE2DPROC)load("glTexImage2D"); - glad_glTexParameteri = (PFNGLTEXPARAMETERIPROC)load("glTexParameteri"); - glad_glTexParameterx = (PFNGLTEXPARAMETERXPROC)load("glTexParameterx"); - glad_glTexParameteriv = (PFNGLTEXPARAMETERIVPROC)load("glTexParameteriv"); - glad_glTexParameterxv = (PFNGLTEXPARAMETERXVPROC)load("glTexParameterxv"); + glad_glRotated = (PFNGLROTATEDPROC)load("glRotated"); + glad_glRotatef = (PFNGLROTATEFPROC)load("glRotatef"); + glad_glScaled = (PFNGLSCALEDPROC)load("glScaled"); + glad_glScalef = (PFNGLSCALEFPROC)load("glScalef"); + glad_glTranslated = (PFNGLTRANSLATEDPROC)load("glTranslated"); + glad_glTranslatef = (PFNGLTRANSLATEFPROC)load("glTranslatef"); +} +static void load_GL_VERSION_1_1(GLADloadproc load) { + if(!GLAD_GL_VERSION_1_1) return; + glad_glDrawArrays = (PFNGLDRAWARRAYSPROC)load("glDrawArrays"); + glad_glDrawElements = (PFNGLDRAWELEMENTSPROC)load("glDrawElements"); + glad_glGetPointerv = (PFNGLGETPOINTERVPROC)load("glGetPointerv"); + glad_glPolygonOffset = (PFNGLPOLYGONOFFSETPROC)load("glPolygonOffset"); + glad_glCopyTexImage1D = (PFNGLCOPYTEXIMAGE1DPROC)load("glCopyTexImage1D"); + glad_glCopyTexImage2D = (PFNGLCOPYTEXIMAGE2DPROC)load("glCopyTexImage2D"); + glad_glCopyTexSubImage1D = (PFNGLCOPYTEXSUBIMAGE1DPROC)load("glCopyTexSubImage1D"); + glad_glCopyTexSubImage2D = (PFNGLCOPYTEXSUBIMAGE2DPROC)load("glCopyTexSubImage2D"); + glad_glTexSubImage1D = (PFNGLTEXSUBIMAGE1DPROC)load("glTexSubImage1D"); glad_glTexSubImage2D = (PFNGLTEXSUBIMAGE2DPROC)load("glTexSubImage2D"); - glad_glTranslatex = (PFNGLTRANSLATEXPROC)load("glTranslatex"); + glad_glBindTexture = (PFNGLBINDTEXTUREPROC)load("glBindTexture"); + glad_glDeleteTextures = (PFNGLDELETETEXTURESPROC)load("glDeleteTextures"); + glad_glGenTextures = (PFNGLGENTEXTURESPROC)load("glGenTextures"); + glad_glIsTexture = (PFNGLISTEXTUREPROC)load("glIsTexture"); + glad_glArrayElement = (PFNGLARRAYELEMENTPROC)load("glArrayElement"); + glad_glColorPointer = (PFNGLCOLORPOINTERPROC)load("glColorPointer"); + glad_glDisableClientState = (PFNGLDISABLECLIENTSTATEPROC)load("glDisableClientState"); + glad_glEdgeFlagPointer = (PFNGLEDGEFLAGPOINTERPROC)load("glEdgeFlagPointer"); + glad_glEnableClientState = (PFNGLENABLECLIENTSTATEPROC)load("glEnableClientState"); + glad_glIndexPointer = (PFNGLINDEXPOINTERPROC)load("glIndexPointer"); + glad_glInterleavedArrays = (PFNGLINTERLEAVEDARRAYSPROC)load("glInterleavedArrays"); + glad_glNormalPointer = (PFNGLNORMALPOINTERPROC)load("glNormalPointer"); + glad_glTexCoordPointer = (PFNGLTEXCOORDPOINTERPROC)load("glTexCoordPointer"); glad_glVertexPointer = (PFNGLVERTEXPOINTERPROC)load("glVertexPointer"); - glad_glViewport = (PFNGLVIEWPORTPROC)load("glViewport"); + glad_glAreTexturesResident = (PFNGLARETEXTURESRESIDENTPROC)load("glAreTexturesResident"); + glad_glPrioritizeTextures = (PFNGLPRIORITIZETEXTURESPROC)load("glPrioritizeTextures"); + glad_glIndexub = (PFNGLINDEXUBPROC)load("glIndexub"); + glad_glIndexubv = (PFNGLINDEXUBVPROC)load("glIndexubv"); + glad_glPopClientAttrib = (PFNGLPOPCLIENTATTRIBPROC)load("glPopClientAttrib"); + glad_glPushClientAttrib = (PFNGLPUSHCLIENTATTRIBPROC)load("glPushClientAttrib"); } -static void load_GL_OES_EGL_image(GLADloadproc load) { - if(!GLAD_GL_OES_EGL_image) return; - glad_glEGLImageTargetTexture2DOES = (PFNGLEGLIMAGETARGETTEXTURE2DOESPROC)load("glEGLImageTargetTexture2DOES"); - glad_glEGLImageTargetRenderbufferStorageOES = (PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC)load("glEGLImageTargetRenderbufferStorageOES"); +static void load_GL_VERSION_1_2(GLADloadproc load) { + if(!GLAD_GL_VERSION_1_2) return; + glad_glDrawRangeElements = (PFNGLDRAWRANGEELEMENTSPROC)load("glDrawRangeElements"); + glad_glTexImage3D = (PFNGLTEXIMAGE3DPROC)load("glTexImage3D"); + glad_glTexSubImage3D = (PFNGLTEXSUBIMAGE3DPROC)load("glTexSubImage3D"); + glad_glCopyTexSubImage3D = (PFNGLCOPYTEXSUBIMAGE3DPROC)load("glCopyTexSubImage3D"); } -static void load_GL_OES_EGL_image_external(GLADloadproc load) { - if(!GLAD_GL_OES_EGL_image_external) return; - glad_glEGLImageTargetTexture2DOES = (PFNGLEGLIMAGETARGETTEXTURE2DOESPROC)load("glEGLImageTargetTexture2DOES"); +static void load_GL_VERSION_1_3(GLADloadproc load) { + if(!GLAD_GL_VERSION_1_3) return; + glad_glActiveTexture = (PFNGLACTIVETEXTUREPROC)load("glActiveTexture"); + glad_glSampleCoverage = (PFNGLSAMPLECOVERAGEPROC)load("glSampleCoverage"); + glad_glCompressedTexImage3D = (PFNGLCOMPRESSEDTEXIMAGE3DPROC)load("glCompressedTexImage3D"); + glad_glCompressedTexImage2D = (PFNGLCOMPRESSEDTEXIMAGE2DPROC)load("glCompressedTexImage2D"); + glad_glCompressedTexImage1D = (PFNGLCOMPRESSEDTEXIMAGE1DPROC)load("glCompressedTexImage1D"); + glad_glCompressedTexSubImage3D = (PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC)load("glCompressedTexSubImage3D"); + glad_glCompressedTexSubImage2D = (PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC)load("glCompressedTexSubImage2D"); + glad_glCompressedTexSubImage1D = (PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC)load("glCompressedTexSubImage1D"); + glad_glGetCompressedTexImage = (PFNGLGETCOMPRESSEDTEXIMAGEPROC)load("glGetCompressedTexImage"); + glad_glClientActiveTexture = (PFNGLCLIENTACTIVETEXTUREPROC)load("glClientActiveTexture"); + glad_glMultiTexCoord1d = (PFNGLMULTITEXCOORD1DPROC)load("glMultiTexCoord1d"); + glad_glMultiTexCoord1dv = (PFNGLMULTITEXCOORD1DVPROC)load("glMultiTexCoord1dv"); + glad_glMultiTexCoord1f = (PFNGLMULTITEXCOORD1FPROC)load("glMultiTexCoord1f"); + glad_glMultiTexCoord1fv = (PFNGLMULTITEXCOORD1FVPROC)load("glMultiTexCoord1fv"); + glad_glMultiTexCoord1i = (PFNGLMULTITEXCOORD1IPROC)load("glMultiTexCoord1i"); + glad_glMultiTexCoord1iv = (PFNGLMULTITEXCOORD1IVPROC)load("glMultiTexCoord1iv"); + glad_glMultiTexCoord1s = (PFNGLMULTITEXCOORD1SPROC)load("glMultiTexCoord1s"); + glad_glMultiTexCoord1sv = (PFNGLMULTITEXCOORD1SVPROC)load("glMultiTexCoord1sv"); + glad_glMultiTexCoord2d = (PFNGLMULTITEXCOORD2DPROC)load("glMultiTexCoord2d"); + glad_glMultiTexCoord2dv = (PFNGLMULTITEXCOORD2DVPROC)load("glMultiTexCoord2dv"); + glad_glMultiTexCoord2f = (PFNGLMULTITEXCOORD2FPROC)load("glMultiTexCoord2f"); + glad_glMultiTexCoord2fv = (PFNGLMULTITEXCOORD2FVPROC)load("glMultiTexCoord2fv"); + glad_glMultiTexCoord2i = (PFNGLMULTITEXCOORD2IPROC)load("glMultiTexCoord2i"); + glad_glMultiTexCoord2iv = (PFNGLMULTITEXCOORD2IVPROC)load("glMultiTexCoord2iv"); + glad_glMultiTexCoord2s = (PFNGLMULTITEXCOORD2SPROC)load("glMultiTexCoord2s"); + glad_glMultiTexCoord2sv = (PFNGLMULTITEXCOORD2SVPROC)load("glMultiTexCoord2sv"); + glad_glMultiTexCoord3d = (PFNGLMULTITEXCOORD3DPROC)load("glMultiTexCoord3d"); + glad_glMultiTexCoord3dv = (PFNGLMULTITEXCOORD3DVPROC)load("glMultiTexCoord3dv"); + glad_glMultiTexCoord3f = (PFNGLMULTITEXCOORD3FPROC)load("glMultiTexCoord3f"); + glad_glMultiTexCoord3fv = (PFNGLMULTITEXCOORD3FVPROC)load("glMultiTexCoord3fv"); + glad_glMultiTexCoord3i = (PFNGLMULTITEXCOORD3IPROC)load("glMultiTexCoord3i"); + glad_glMultiTexCoord3iv = (PFNGLMULTITEXCOORD3IVPROC)load("glMultiTexCoord3iv"); + glad_glMultiTexCoord3s = (PFNGLMULTITEXCOORD3SPROC)load("glMultiTexCoord3s"); + glad_glMultiTexCoord3sv = (PFNGLMULTITEXCOORD3SVPROC)load("glMultiTexCoord3sv"); + glad_glMultiTexCoord4d = (PFNGLMULTITEXCOORD4DPROC)load("glMultiTexCoord4d"); + glad_glMultiTexCoord4dv = (PFNGLMULTITEXCOORD4DVPROC)load("glMultiTexCoord4dv"); + glad_glMultiTexCoord4f = (PFNGLMULTITEXCOORD4FPROC)load("glMultiTexCoord4f"); + glad_glMultiTexCoord4fv = (PFNGLMULTITEXCOORD4FVPROC)load("glMultiTexCoord4fv"); + glad_glMultiTexCoord4i = (PFNGLMULTITEXCOORD4IPROC)load("glMultiTexCoord4i"); + glad_glMultiTexCoord4iv = (PFNGLMULTITEXCOORD4IVPROC)load("glMultiTexCoord4iv"); + glad_glMultiTexCoord4s = (PFNGLMULTITEXCOORD4SPROC)load("glMultiTexCoord4s"); + glad_glMultiTexCoord4sv = (PFNGLMULTITEXCOORD4SVPROC)load("glMultiTexCoord4sv"); + glad_glLoadTransposeMatrixf = (PFNGLLOADTRANSPOSEMATRIXFPROC)load("glLoadTransposeMatrixf"); + glad_glLoadTransposeMatrixd = (PFNGLLOADTRANSPOSEMATRIXDPROC)load("glLoadTransposeMatrixd"); + glad_glMultTransposeMatrixf = (PFNGLMULTTRANSPOSEMATRIXFPROC)load("glMultTransposeMatrixf"); + glad_glMultTransposeMatrixd = (PFNGLMULTTRANSPOSEMATRIXDPROC)load("glMultTransposeMatrixd"); } -static int find_extensionsGLES1(void) { +static void load_GL_VERSION_1_4(GLADloadproc load) { + if(!GLAD_GL_VERSION_1_4) return; + glad_glBlendFuncSeparate = (PFNGLBLENDFUNCSEPARATEPROC)load("glBlendFuncSeparate"); + glad_glMultiDrawArrays = (PFNGLMULTIDRAWARRAYSPROC)load("glMultiDrawArrays"); + glad_glMultiDrawElements = (PFNGLMULTIDRAWELEMENTSPROC)load("glMultiDrawElements"); + glad_glPointParameterf = (PFNGLPOINTPARAMETERFPROC)load("glPointParameterf"); + glad_glPointParameterfv = (PFNGLPOINTPARAMETERFVPROC)load("glPointParameterfv"); + glad_glPointParameteri = (PFNGLPOINTPARAMETERIPROC)load("glPointParameteri"); + glad_glPointParameteriv = (PFNGLPOINTPARAMETERIVPROC)load("glPointParameteriv"); + glad_glFogCoordf = (PFNGLFOGCOORDFPROC)load("glFogCoordf"); + glad_glFogCoordfv = (PFNGLFOGCOORDFVPROC)load("glFogCoordfv"); + glad_glFogCoordd = (PFNGLFOGCOORDDPROC)load("glFogCoordd"); + glad_glFogCoorddv = (PFNGLFOGCOORDDVPROC)load("glFogCoorddv"); + glad_glFogCoordPointer = (PFNGLFOGCOORDPOINTERPROC)load("glFogCoordPointer"); + glad_glSecondaryColor3b = (PFNGLSECONDARYCOLOR3BPROC)load("glSecondaryColor3b"); + glad_glSecondaryColor3bv = (PFNGLSECONDARYCOLOR3BVPROC)load("glSecondaryColor3bv"); + glad_glSecondaryColor3d = (PFNGLSECONDARYCOLOR3DPROC)load("glSecondaryColor3d"); + glad_glSecondaryColor3dv = (PFNGLSECONDARYCOLOR3DVPROC)load("glSecondaryColor3dv"); + glad_glSecondaryColor3f = (PFNGLSECONDARYCOLOR3FPROC)load("glSecondaryColor3f"); + glad_glSecondaryColor3fv = (PFNGLSECONDARYCOLOR3FVPROC)load("glSecondaryColor3fv"); + glad_glSecondaryColor3i = (PFNGLSECONDARYCOLOR3IPROC)load("glSecondaryColor3i"); + glad_glSecondaryColor3iv = (PFNGLSECONDARYCOLOR3IVPROC)load("glSecondaryColor3iv"); + glad_glSecondaryColor3s = (PFNGLSECONDARYCOLOR3SPROC)load("glSecondaryColor3s"); + glad_glSecondaryColor3sv = (PFNGLSECONDARYCOLOR3SVPROC)load("glSecondaryColor3sv"); + glad_glSecondaryColor3ub = (PFNGLSECONDARYCOLOR3UBPROC)load("glSecondaryColor3ub"); + glad_glSecondaryColor3ubv = (PFNGLSECONDARYCOLOR3UBVPROC)load("glSecondaryColor3ubv"); + glad_glSecondaryColor3ui = (PFNGLSECONDARYCOLOR3UIPROC)load("glSecondaryColor3ui"); + glad_glSecondaryColor3uiv = (PFNGLSECONDARYCOLOR3UIVPROC)load("glSecondaryColor3uiv"); + glad_glSecondaryColor3us = (PFNGLSECONDARYCOLOR3USPROC)load("glSecondaryColor3us"); + glad_glSecondaryColor3usv = (PFNGLSECONDARYCOLOR3USVPROC)load("glSecondaryColor3usv"); + glad_glSecondaryColorPointer = (PFNGLSECONDARYCOLORPOINTERPROC)load("glSecondaryColorPointer"); + glad_glWindowPos2d = (PFNGLWINDOWPOS2DPROC)load("glWindowPos2d"); + glad_glWindowPos2dv = (PFNGLWINDOWPOS2DVPROC)load("glWindowPos2dv"); + glad_glWindowPos2f = (PFNGLWINDOWPOS2FPROC)load("glWindowPos2f"); + glad_glWindowPos2fv = (PFNGLWINDOWPOS2FVPROC)load("glWindowPos2fv"); + glad_glWindowPos2i = (PFNGLWINDOWPOS2IPROC)load("glWindowPos2i"); + glad_glWindowPos2iv = (PFNGLWINDOWPOS2IVPROC)load("glWindowPos2iv"); + glad_glWindowPos2s = (PFNGLWINDOWPOS2SPROC)load("glWindowPos2s"); + glad_glWindowPos2sv = (PFNGLWINDOWPOS2SVPROC)load("glWindowPos2sv"); + glad_glWindowPos3d = (PFNGLWINDOWPOS3DPROC)load("glWindowPos3d"); + glad_glWindowPos3dv = (PFNGLWINDOWPOS3DVPROC)load("glWindowPos3dv"); + glad_glWindowPos3f = (PFNGLWINDOWPOS3FPROC)load("glWindowPos3f"); + glad_glWindowPos3fv = (PFNGLWINDOWPOS3FVPROC)load("glWindowPos3fv"); + glad_glWindowPos3i = (PFNGLWINDOWPOS3IPROC)load("glWindowPos3i"); + glad_glWindowPos3iv = (PFNGLWINDOWPOS3IVPROC)load("glWindowPos3iv"); + glad_glWindowPos3s = (PFNGLWINDOWPOS3SPROC)load("glWindowPos3s"); + glad_glWindowPos3sv = (PFNGLWINDOWPOS3SVPROC)load("glWindowPos3sv"); + glad_glBlendColor = (PFNGLBLENDCOLORPROC)load("glBlendColor"); + glad_glBlendEquation = (PFNGLBLENDEQUATIONPROC)load("glBlendEquation"); +} +static void load_GL_VERSION_1_5(GLADloadproc load) { + if(!GLAD_GL_VERSION_1_5) return; + glad_glGenQueries = (PFNGLGENQUERIESPROC)load("glGenQueries"); + glad_glDeleteQueries = (PFNGLDELETEQUERIESPROC)load("glDeleteQueries"); + glad_glIsQuery = (PFNGLISQUERYPROC)load("glIsQuery"); + glad_glBeginQuery = (PFNGLBEGINQUERYPROC)load("glBeginQuery"); + glad_glEndQuery = (PFNGLENDQUERYPROC)load("glEndQuery"); + glad_glGetQueryiv = (PFNGLGETQUERYIVPROC)load("glGetQueryiv"); + glad_glGetQueryObjectiv = (PFNGLGETQUERYOBJECTIVPROC)load("glGetQueryObjectiv"); + glad_glGetQueryObjectuiv = (PFNGLGETQUERYOBJECTUIVPROC)load("glGetQueryObjectuiv"); + glad_glBindBuffer = (PFNGLBINDBUFFERPROC)load("glBindBuffer"); + glad_glDeleteBuffers = (PFNGLDELETEBUFFERSPROC)load("glDeleteBuffers"); + glad_glGenBuffers = (PFNGLGENBUFFERSPROC)load("glGenBuffers"); + glad_glIsBuffer = (PFNGLISBUFFERPROC)load("glIsBuffer"); + glad_glBufferData = (PFNGLBUFFERDATAPROC)load("glBufferData"); + glad_glBufferSubData = (PFNGLBUFFERSUBDATAPROC)load("glBufferSubData"); + glad_glGetBufferSubData = (PFNGLGETBUFFERSUBDATAPROC)load("glGetBufferSubData"); + glad_glMapBuffer = (PFNGLMAPBUFFERPROC)load("glMapBuffer"); + glad_glUnmapBuffer = (PFNGLUNMAPBUFFERPROC)load("glUnmapBuffer"); + glad_glGetBufferParameteriv = (PFNGLGETBUFFERPARAMETERIVPROC)load("glGetBufferParameteriv"); + glad_glGetBufferPointerv = (PFNGLGETBUFFERPOINTERVPROC)load("glGetBufferPointerv"); +} +static void load_GL_VERSION_2_0(GLADloadproc load) { + if(!GLAD_GL_VERSION_2_0) return; + glad_glBlendEquationSeparate = (PFNGLBLENDEQUATIONSEPARATEPROC)load("glBlendEquationSeparate"); + glad_glDrawBuffers = (PFNGLDRAWBUFFERSPROC)load("glDrawBuffers"); + glad_glStencilOpSeparate = (PFNGLSTENCILOPSEPARATEPROC)load("glStencilOpSeparate"); + glad_glStencilFuncSeparate = (PFNGLSTENCILFUNCSEPARATEPROC)load("glStencilFuncSeparate"); + glad_glStencilMaskSeparate = (PFNGLSTENCILMASKSEPARATEPROC)load("glStencilMaskSeparate"); + glad_glAttachShader = (PFNGLATTACHSHADERPROC)load("glAttachShader"); + glad_glBindAttribLocation = (PFNGLBINDATTRIBLOCATIONPROC)load("glBindAttribLocation"); + glad_glCompileShader = (PFNGLCOMPILESHADERPROC)load("glCompileShader"); + glad_glCreateProgram = (PFNGLCREATEPROGRAMPROC)load("glCreateProgram"); + glad_glCreateShader = (PFNGLCREATESHADERPROC)load("glCreateShader"); + glad_glDeleteProgram = (PFNGLDELETEPROGRAMPROC)load("glDeleteProgram"); + glad_glDeleteShader = (PFNGLDELETESHADERPROC)load("glDeleteShader"); + glad_glDetachShader = (PFNGLDETACHSHADERPROC)load("glDetachShader"); + glad_glDisableVertexAttribArray = (PFNGLDISABLEVERTEXATTRIBARRAYPROC)load("glDisableVertexAttribArray"); + glad_glEnableVertexAttribArray = (PFNGLENABLEVERTEXATTRIBARRAYPROC)load("glEnableVertexAttribArray"); + glad_glGetActiveAttrib = (PFNGLGETACTIVEATTRIBPROC)load("glGetActiveAttrib"); + glad_glGetActiveUniform = (PFNGLGETACTIVEUNIFORMPROC)load("glGetActiveUniform"); + glad_glGetAttachedShaders = (PFNGLGETATTACHEDSHADERSPROC)load("glGetAttachedShaders"); + glad_glGetAttribLocation = (PFNGLGETATTRIBLOCATIONPROC)load("glGetAttribLocation"); + glad_glGetProgramiv = (PFNGLGETPROGRAMIVPROC)load("glGetProgramiv"); + glad_glGetProgramInfoLog = (PFNGLGETPROGRAMINFOLOGPROC)load("glGetProgramInfoLog"); + glad_glGetShaderiv = (PFNGLGETSHADERIVPROC)load("glGetShaderiv"); + glad_glGetShaderInfoLog = (PFNGLGETSHADERINFOLOGPROC)load("glGetShaderInfoLog"); + glad_glGetShaderSource = (PFNGLGETSHADERSOURCEPROC)load("glGetShaderSource"); + glad_glGetUniformLocation = (PFNGLGETUNIFORMLOCATIONPROC)load("glGetUniformLocation"); + glad_glGetUniformfv = (PFNGLGETUNIFORMFVPROC)load("glGetUniformfv"); + glad_glGetUniformiv = (PFNGLGETUNIFORMIVPROC)load("glGetUniformiv"); + glad_glGetVertexAttribdv = (PFNGLGETVERTEXATTRIBDVPROC)load("glGetVertexAttribdv"); + glad_glGetVertexAttribfv = (PFNGLGETVERTEXATTRIBFVPROC)load("glGetVertexAttribfv"); + glad_glGetVertexAttribiv = (PFNGLGETVERTEXATTRIBIVPROC)load("glGetVertexAttribiv"); + glad_glGetVertexAttribPointerv = (PFNGLGETVERTEXATTRIBPOINTERVPROC)load("glGetVertexAttribPointerv"); + glad_glIsProgram = (PFNGLISPROGRAMPROC)load("glIsProgram"); + glad_glIsShader = (PFNGLISSHADERPROC)load("glIsShader"); + glad_glLinkProgram = (PFNGLLINKPROGRAMPROC)load("glLinkProgram"); + glad_glShaderSource = (PFNGLSHADERSOURCEPROC)load("glShaderSource"); + glad_glUseProgram = (PFNGLUSEPROGRAMPROC)load("glUseProgram"); + glad_glUniform1f = (PFNGLUNIFORM1FPROC)load("glUniform1f"); + glad_glUniform2f = (PFNGLUNIFORM2FPROC)load("glUniform2f"); + glad_glUniform3f = (PFNGLUNIFORM3FPROC)load("glUniform3f"); + glad_glUniform4f = (PFNGLUNIFORM4FPROC)load("glUniform4f"); + glad_glUniform1i = (PFNGLUNIFORM1IPROC)load("glUniform1i"); + glad_glUniform2i = (PFNGLUNIFORM2IPROC)load("glUniform2i"); + glad_glUniform3i = (PFNGLUNIFORM3IPROC)load("glUniform3i"); + glad_glUniform4i = (PFNGLUNIFORM4IPROC)load("glUniform4i"); + glad_glUniform1fv = (PFNGLUNIFORM1FVPROC)load("glUniform1fv"); + glad_glUniform2fv = (PFNGLUNIFORM2FVPROC)load("glUniform2fv"); + glad_glUniform3fv = (PFNGLUNIFORM3FVPROC)load("glUniform3fv"); + glad_glUniform4fv = (PFNGLUNIFORM4FVPROC)load("glUniform4fv"); + glad_glUniform1iv = (PFNGLUNIFORM1IVPROC)load("glUniform1iv"); + glad_glUniform2iv = (PFNGLUNIFORM2IVPROC)load("glUniform2iv"); + glad_glUniform3iv = (PFNGLUNIFORM3IVPROC)load("glUniform3iv"); + glad_glUniform4iv = (PFNGLUNIFORM4IVPROC)load("glUniform4iv"); + glad_glUniformMatrix2fv = (PFNGLUNIFORMMATRIX2FVPROC)load("glUniformMatrix2fv"); + glad_glUniformMatrix3fv = (PFNGLUNIFORMMATRIX3FVPROC)load("glUniformMatrix3fv"); + glad_glUniformMatrix4fv = (PFNGLUNIFORMMATRIX4FVPROC)load("glUniformMatrix4fv"); + glad_glValidateProgram = (PFNGLVALIDATEPROGRAMPROC)load("glValidateProgram"); + glad_glVertexAttrib1d = (PFNGLVERTEXATTRIB1DPROC)load("glVertexAttrib1d"); + glad_glVertexAttrib1dv = (PFNGLVERTEXATTRIB1DVPROC)load("glVertexAttrib1dv"); + glad_glVertexAttrib1f = (PFNGLVERTEXATTRIB1FPROC)load("glVertexAttrib1f"); + glad_glVertexAttrib1fv = (PFNGLVERTEXATTRIB1FVPROC)load("glVertexAttrib1fv"); + glad_glVertexAttrib1s = (PFNGLVERTEXATTRIB1SPROC)load("glVertexAttrib1s"); + glad_glVertexAttrib1sv = (PFNGLVERTEXATTRIB1SVPROC)load("glVertexAttrib1sv"); + glad_glVertexAttrib2d = (PFNGLVERTEXATTRIB2DPROC)load("glVertexAttrib2d"); + glad_glVertexAttrib2dv = (PFNGLVERTEXATTRIB2DVPROC)load("glVertexAttrib2dv"); + glad_glVertexAttrib2f = (PFNGLVERTEXATTRIB2FPROC)load("glVertexAttrib2f"); + glad_glVertexAttrib2fv = (PFNGLVERTEXATTRIB2FVPROC)load("glVertexAttrib2fv"); + glad_glVertexAttrib2s = (PFNGLVERTEXATTRIB2SPROC)load("glVertexAttrib2s"); + glad_glVertexAttrib2sv = (PFNGLVERTEXATTRIB2SVPROC)load("glVertexAttrib2sv"); + glad_glVertexAttrib3d = (PFNGLVERTEXATTRIB3DPROC)load("glVertexAttrib3d"); + glad_glVertexAttrib3dv = (PFNGLVERTEXATTRIB3DVPROC)load("glVertexAttrib3dv"); + glad_glVertexAttrib3f = (PFNGLVERTEXATTRIB3FPROC)load("glVertexAttrib3f"); + glad_glVertexAttrib3fv = (PFNGLVERTEXATTRIB3FVPROC)load("glVertexAttrib3fv"); + glad_glVertexAttrib3s = (PFNGLVERTEXATTRIB3SPROC)load("glVertexAttrib3s"); + glad_glVertexAttrib3sv = (PFNGLVERTEXATTRIB3SVPROC)load("glVertexAttrib3sv"); + glad_glVertexAttrib4Nbv = (PFNGLVERTEXATTRIB4NBVPROC)load("glVertexAttrib4Nbv"); + glad_glVertexAttrib4Niv = (PFNGLVERTEXATTRIB4NIVPROC)load("glVertexAttrib4Niv"); + glad_glVertexAttrib4Nsv = (PFNGLVERTEXATTRIB4NSVPROC)load("glVertexAttrib4Nsv"); + glad_glVertexAttrib4Nub = (PFNGLVERTEXATTRIB4NUBPROC)load("glVertexAttrib4Nub"); + glad_glVertexAttrib4Nubv = (PFNGLVERTEXATTRIB4NUBVPROC)load("glVertexAttrib4Nubv"); + glad_glVertexAttrib4Nuiv = (PFNGLVERTEXATTRIB4NUIVPROC)load("glVertexAttrib4Nuiv"); + glad_glVertexAttrib4Nusv = (PFNGLVERTEXATTRIB4NUSVPROC)load("glVertexAttrib4Nusv"); + glad_glVertexAttrib4bv = (PFNGLVERTEXATTRIB4BVPROC)load("glVertexAttrib4bv"); + glad_glVertexAttrib4d = (PFNGLVERTEXATTRIB4DPROC)load("glVertexAttrib4d"); + glad_glVertexAttrib4dv = (PFNGLVERTEXATTRIB4DVPROC)load("glVertexAttrib4dv"); + glad_glVertexAttrib4f = (PFNGLVERTEXATTRIB4FPROC)load("glVertexAttrib4f"); + glad_glVertexAttrib4fv = (PFNGLVERTEXATTRIB4FVPROC)load("glVertexAttrib4fv"); + glad_glVertexAttrib4iv = (PFNGLVERTEXATTRIB4IVPROC)load("glVertexAttrib4iv"); + glad_glVertexAttrib4s = (PFNGLVERTEXATTRIB4SPROC)load("glVertexAttrib4s"); + glad_glVertexAttrib4sv = (PFNGLVERTEXATTRIB4SVPROC)load("glVertexAttrib4sv"); + glad_glVertexAttrib4ubv = (PFNGLVERTEXATTRIB4UBVPROC)load("glVertexAttrib4ubv"); + glad_glVertexAttrib4uiv = (PFNGLVERTEXATTRIB4UIVPROC)load("glVertexAttrib4uiv"); + glad_glVertexAttrib4usv = (PFNGLVERTEXATTRIB4USVPROC)load("glVertexAttrib4usv"); + glad_glVertexAttribPointer = (PFNGLVERTEXATTRIBPOINTERPROC)load("glVertexAttribPointer"); +} +static void load_GL_VERSION_2_1(GLADloadproc load) { + if(!GLAD_GL_VERSION_2_1) return; + glad_glUniformMatrix2x3fv = (PFNGLUNIFORMMATRIX2X3FVPROC)load("glUniformMatrix2x3fv"); + glad_glUniformMatrix3x2fv = (PFNGLUNIFORMMATRIX3X2FVPROC)load("glUniformMatrix3x2fv"); + glad_glUniformMatrix2x4fv = (PFNGLUNIFORMMATRIX2X4FVPROC)load("glUniformMatrix2x4fv"); + glad_glUniformMatrix4x2fv = (PFNGLUNIFORMMATRIX4X2FVPROC)load("glUniformMatrix4x2fv"); + glad_glUniformMatrix3x4fv = (PFNGLUNIFORMMATRIX3X4FVPROC)load("glUniformMatrix3x4fv"); + glad_glUniformMatrix4x3fv = (PFNGLUNIFORMMATRIX4X3FVPROC)load("glUniformMatrix4x3fv"); +} +static void load_GL_EXT_EGL_image_storage(GLADloadproc load) { + if(!GLAD_GL_EXT_EGL_image_storage) return; + glad_glEGLImageTargetTexStorageEXT = (PFNGLEGLIMAGETARGETTEXSTORAGEEXTPROC)load("glEGLImageTargetTexStorageEXT"); + glad_glEGLImageTargetTextureStorageEXT = (PFNGLEGLIMAGETARGETTEXTURESTORAGEEXTPROC)load("glEGLImageTargetTextureStorageEXT"); +} +static int find_extensionsGL(void) { if (!get_exts()) return 0; - GLAD_GL_OES_EGL_image = has_ext("GL_OES_EGL_image"); - GLAD_GL_OES_EGL_image_external = has_ext("GL_OES_EGL_image_external"); + GLAD_GL_EXT_EGL_image_storage = has_ext("GL_EXT_EGL_image_storage"); + GLAD_GL_EXT_EGL_sync = has_ext("GL_EXT_EGL_sync"); free_exts(); return 1; } -static void find_coreGLES1(void) { +static void find_coreGL(void) { /* Thank you @elmindreda * https://github.com/elmindreda/greg/blob/master/templates/greg.c.in#L176 @@ -473,24 +1443,37 @@ static void find_coreGLES1(void) { GLVersion.major = major; GLVersion.minor = minor; max_loaded_major = major; max_loaded_minor = minor; - GLAD_GL_VERSION_ES_CM_1_0 = (major == 1 && minor >= 0) || major > 1; - if (GLVersion.major > 1 || (GLVersion.major >= 1 && GLVersion.minor >= 0)) { - max_loaded_major = 1; - max_loaded_minor = 0; + GLAD_GL_VERSION_1_0 = (major == 1 && minor >= 0) || major > 1; + GLAD_GL_VERSION_1_1 = (major == 1 && minor >= 1) || major > 1; + GLAD_GL_VERSION_1_2 = (major == 1 && minor >= 2) || major > 1; + GLAD_GL_VERSION_1_3 = (major == 1 && minor >= 3) || major > 1; + GLAD_GL_VERSION_1_4 = (major == 1 && minor >= 4) || major > 1; + GLAD_GL_VERSION_1_5 = (major == 1 && minor >= 5) || major > 1; + GLAD_GL_VERSION_2_0 = (major == 2 && minor >= 0) || major > 2; + GLAD_GL_VERSION_2_1 = (major == 2 && minor >= 1) || major > 2; + if (GLVersion.major > 2 || (GLVersion.major >= 2 && GLVersion.minor >= 1)) { + max_loaded_major = 2; + max_loaded_minor = 1; } } -int gladLoadGLES1Loader(GLADloadproc load) { +int gladLoadGLLoader(GLADloadproc load) { GLVersion.major = 0; GLVersion.minor = 0; glGetString = (PFNGLGETSTRINGPROC)load("glGetString"); if(glGetString == NULL) return 0; if(glGetString(GL_VERSION) == NULL) return 0; - find_coreGLES1(); - load_GL_VERSION_ES_CM_1_0(load); + find_coreGL(); + load_GL_VERSION_1_0(load); + load_GL_VERSION_1_1(load); + load_GL_VERSION_1_2(load); + load_GL_VERSION_1_3(load); + load_GL_VERSION_1_4(load); + load_GL_VERSION_1_5(load); + load_GL_VERSION_2_0(load); + load_GL_VERSION_2_1(load); - if (!find_extensionsGLES1()) return 0; - load_GL_OES_EGL_image(load); - load_GL_OES_EGL_image_external(load); + if (!find_extensionsGL()) return 0; + load_GL_EXT_EGL_image_storage(load); return GLVersion.major != 0 || GLVersion.minor != 0; } diff --git a/misc/web/index.html b/misc/web/index.html new file mode 100644 index 0000000..6eb328d --- /dev/null +++ b/misc/web/index.html @@ -0,0 +1,46 @@ + + + + + MCPE 0.6.1 + + + + + + + + + + + \ No newline at end of file diff --git a/project/android/AndroidManifest.xml b/project/android/AndroidManifest.xml index 925261c..7cb9435 100755 --- a/project/android/AndroidManifest.xml +++ b/project/android/AndroidManifest.xml @@ -1,46 +1,46 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/project/android/assets/lang/en_US.lang b/project/android/assets/lang/en_US.lang index 8f2aea8..83c1066 100755 --- a/project/android/assets/lang/en_US.lang +++ b/project/android/assets/lang/en_US.lang @@ -168,8 +168,10 @@ options.graphics.fast=Fast options.guiScale=GUI Scale options.guiScale.auto=Auto options.guiScale.small=Small -options.guiScale.normal=Normal +options.guiScale.medium=Medium options.guiScale.large=Large +options.guiScale.larger=Larger +options.guiScale.largest=Largest options.advancedOpengl=Advanced OpenGL options.renderClouds=Clouds options.farWarning1=A 64 bit Java installation is recommended @@ -963,5 +965,5 @@ desc.netherbrickitem=Used to form blocks of Nether bricks. desc.netherquartz=Quartz from the Nether, used to create Blocks of Quartz. desc.quartzblock=Decorative block, used to create other kinds of Quartz blocks. desc.stonecutter=For crafting stoneblocks. -desc.seedsmelon=Allows for more melons. +desc.seeds_melon=Allows for more melons. desc.tile.melon=Can be cut up and eaten. diff --git a/project/android/jni/Android.mk b/project/android/jni/Android.mk index 41e57f5..2ff71e7 100755 --- a/project/android/jni/Android.mk +++ b/project/android/jni/Android.mk @@ -1,10 +1,12 @@ LOCAL_PATH := $(call my-dir) +# Convert Windows backslashes to forward slashes so NDK toolchain doesn’t treat them as escapes. +LOCAL_PATH := $(subst \,/,$(LOCAL_PATH)) include $(CLEAR_VARS) LOCAL_MODULE := minecraftpe LOCAL_SRC_FILES := ../../../src/main.cpp \ - ../../../src/main_android.cpp \ + ../../../src/main_android_java.cpp \ ../../../src/platform/audio/SoundSystemSL.cpp \ ../../../src/platform/input/Controller.cpp \ ../../../src/platform/input/Keyboard.cpp \ @@ -12,6 +14,7 @@ LOCAL_SRC_FILES := ../../../src/main.cpp \ ../../../src/platform/input/Multitouch.cpp \ ../../../src/platform/time.cpp \ ../../../src/platform/CThread.cpp \ + ../../../src/platform/HttpClient.cpp \ ../../../src/NinecraftApp.cpp \ ../../../src/Performance.cpp \ ../../../src/SharedConstants.cpp \ @@ -21,6 +24,7 @@ LOCAL_SRC_FILES := ../../../src/main.cpp \ ../../../src/client/Options.cpp \ ../../../src/client/OptionsFile.cpp \ ../../../src/client/OptionStrings.cpp \ +../../../src/client/Option.cpp \ ../../../src/client/gamemode/GameMode.cpp \ ../../../src/client/gamemode/CreativeMode.cpp \ ../../../src/client/gamemode/SurvivalMode.cpp \ @@ -34,13 +38,14 @@ LOCAL_SRC_FILES := ../../../src/main.cpp \ ../../../src/client/gui/components/NinePatch.cpp \ ../../../src/client/gui/components/OptionsGroup.cpp \ ../../../src/client/gui/components/OptionsItem.cpp \ -../../../src/client/gui/components/OptionsPane.cpp \ +../../../src/client/gui/components/KeyOption.cpp \ +../../../src/client/gui/components/TextOption.cpp \ ../../../src/client/gui/components/RolledSelectionListH.cpp \ ../../../src/client/gui/components/RolledSelectionListV.cpp \ ../../../src/client/gui/components/ScrolledSelectionList.cpp \ ../../../src/client/gui/components/ScrollingPane.cpp \ ../../../src/client/gui/components/Slider.cpp \ -../../../src/client/gui/components/SmallButton.cpp \ +../../../src/client/gui/components/TextBox.cpp \ ../../../src/client/gui/Font.cpp \ ../../../src/client/gui/Gui.cpp \ ../../../src/client/gui/GuiComponent.cpp \ @@ -48,6 +53,10 @@ LOCAL_SRC_FILES := ../../../src/main.cpp \ ../../../src/client/gui/screens/ScreenChooser.cpp \ ../../../src/client/gui/screens/ArmorScreen.cpp \ ../../../src/client/gui/screens/ChatScreen.cpp \ +../../../src/client/gui/screens/ChooseLevelScreen.cpp \ +../../../src/client/gui/screens/SimpleChooseLevelScreen.cpp \ +../../../src/client/gui/screens/ConsoleScreen.cpp \ +../../../src/client/gui/screens/UsernameScreen.cpp \ ../../../src/client/gui/screens/ConfirmScreen.cpp \ ../../../src/client/gui/screens/ChestScreen.cpp \ ../../../src/client/gui/screens/DeathScreen.cpp \ @@ -56,12 +65,14 @@ LOCAL_SRC_FILES := ../../../src/main.cpp \ ../../../src/client/gui/screens/IngameBlockSelectionScreen.cpp \ ../../../src/client/gui/screens/JoinGameScreen.cpp \ ../../../src/client/gui/screens/OptionsScreen.cpp \ -../../../src/client/gui/screens/PauseScreen.cpp \ + ../../../src/client/gui/screens/CreditsScreen.cpp \ + ../../../src/client/gui/screens/PauseScreen.cpp \ ../../../src/client/gui/screens/ProgressScreen.cpp \ ../../../src/client/gui/screens/RenameMPLevelScreen.cpp \ ../../../src/client/gui/screens/SelectWorldScreen.cpp \ ../../../src/client/gui/screens/StartMenuScreen.cpp \ ../../../src/client/gui/screens/TextEditScreen.cpp \ +../../../src/client/gui/screens/JoinByIPScreen.cpp \ ../../../src/client/gui/screens/touch/TouchIngameBlockSelectionScreen.cpp \ ../../../src/client/gui/screens/touch/TouchJoinGameScreen.cpp \ ../../../src/client/gui/screens/touch/TouchSelectWorldScreen.cpp \ @@ -87,6 +98,7 @@ LOCAL_SRC_FILES := ../../../src/main.cpp \ ../../../src/client/player/RemotePlayer.cpp \ ../../../src/client/player/input/KeyboardInput.cpp \ ../../../src/client/player/input/touchscreen/TouchscreenInput.cpp \ +../../../src/client/renderer/Lighting.cpp \ ../../../src/client/renderer/Chunk.cpp \ ../../../src/client/renderer/EntityTileRenderer.cpp \ ../../../src/client/renderer/GameRenderer.cpp \ @@ -98,6 +110,7 @@ LOCAL_SRC_FILES := ../../../src/main.cpp \ ../../../src/client/renderer/Textures.cpp \ ../../../src/client/renderer/TileRenderer.cpp \ ../../../src/client/renderer/gles.cpp \ +../../../src/world/level/LevelConstants.cpp \ ../../../src/client/renderer/culling/Frustum.cpp \ ../../../src/client/renderer/entity/ArrowRenderer.cpp \ ../../../src/client/renderer/entity/ChickenRenderer.cpp \ @@ -128,6 +141,12 @@ LOCAL_SRC_FILES := ../../../src/main.cpp \ ../../../src/network/Packet.cpp \ ../../../src/network/RakNetInstance.cpp \ ../../../src/network/ServerSideNetworkHandler.cpp \ +../../../src/commands/Command.cpp \ +../../../src/commands/CommandHelp.cpp \ +../../../src/commands/CommandKick.cpp \ +../../../src/commands/CommandBan.cpp \ +../../../src/commands/CommandManager.cpp \ +../../../src/commands/CommandOp.cpp \ ../../../src/server/ServerLevel.cpp \ ../../../src/server/ServerPlayer.cpp \ ../../../src/util/DataIO.cpp \ @@ -135,6 +154,7 @@ LOCAL_SRC_FILES := ../../../src/main.cpp \ ../../../src/util/StringUtils.cpp \ ../../../src/util/PerfTimer.cpp \ ../../../src/util/PerfRenderer.cpp \ +../../../src/util/Color.cpp \ ../../../src/world/Direction.cpp \ ../../../src/world/entity/AgableMob.cpp \ ../../../src/world/entity/Entity.cpp \ @@ -198,6 +218,8 @@ LOCAL_SRC_FILES := ../../../src/main.cpp \ ../../../src/world/level/MobSpawner.cpp \ ../../../src/world/level/Region.cpp \ ../../../src/world/level/TickNextTickData.cpp \ +../../../src/world/level/FoliageColor.cpp \ +../../../src/world/level/GrassColor.cpp \ ../../../src/world/level/biome/Biome.cpp \ ../../../src/world/level/biome/BiomeSource.cpp \ ../../../src/world/level/chunk/LevelChunk.cpp \ @@ -245,7 +267,10 @@ LOCAL_SRC_FILES := ../../../src/main.cpp \ ../../../src/world/level/tile/entity/FurnaceTileEntity.cpp \ ../../../src/world/phys/HitResult.cpp -LOCAL_CFLAGS := -Wno-psabi $(LOCAL_CFLAGS) +LOCAL_CFLAGS := -DPLATFORM_ANDROID -DPRE_ANDROID23 -Wno-narrowing $(LOCAL_CFLAGS) +LOCAL_CPPFLAGS := -std=c++14 -frtti +LOCAL_CPPFLAGS += -frtti +LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../../src #LOCAL_CFLAGS := -DANDROID_PUBLISH -DDEMO_MODE $(LOCAL_CFLAGS) #LOCAL_CFLAGS := -DANDROID_PUBLISH $(LOCAL_CFLAGS) diff --git a/project/android/jni/Application.mk b/project/android/jni/Application.mk index 4d20cc6..b3d73ad 100755 --- a/project/android/jni/Application.mk +++ b/project/android/jni/Application.mk @@ -1,5 +1,7 @@ -APP_PLATFORM := android-9 -APP_STL := stlport_static +APP_PLATFORM := android-19 +APP_STL := gnustl_static APP_OPTIM := release -APP_ABI := armeabi-v7a +APP_ABI := arm64-v8a +APP_SHORT_COMMANDS := true +APP_CPPFLAGS += -frtti -fexceptions #APP_ABI := armeabi-v7a x86 diff --git a/project/android/src/com/mojang/minecraftpe/MainActivity.java b/project/android/src/com/mojang/minecraftpe/MainActivity.java index 95f33f7..7b1e3ae 100755 --- a/project/android/src/com/mojang/minecraftpe/MainActivity.java +++ b/project/android/src/com/mojang/minecraftpe/MainActivity.java @@ -468,17 +468,16 @@ public class MainActivity extends NativeActivity { _userInputStatus = 1; InputMethodManager inputManager = (InputMethodManager)getSystemService("input_method"); - boolean result = inputManager.showSoftInput(this.getCurrentFocus(), InputMethodManager.SHOW_IMPLICIT); - } - - protected void onStart() { - //System.out.println("onStart"); - super.onStart(); - } - - protected void onResume() { - //System.out.println("onResume"); - super.onResume(); + View focused = this.getCurrentFocus(); + if (focused != null) { + boolean result = inputManager.showSoftInput(focused, InputMethodManager.SHOW_IMPLICIT); + } else { + // fallback: try to show using decor view token + View decor = getWindow().getDecorView(); + if (decor != null) { + inputManager.showSoftInput(decor, InputMethodManager.SHOW_IMPLICIT); + } + } } protected void onPause() { diff --git a/project/android_java/AndroidManifest.xml b/project/android_java/AndroidManifest.xml index 5860076..042a27c 100755 --- a/project/android_java/AndroidManifest.xml +++ b/project/android_java/AndroidManifest.xml @@ -1,44 +1,74 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/project/android_java/assets/lang/en_US.lang b/project/android_java/assets/lang/en_US.lang index 95ebf79..8713541 100755 --- a/project/android_java/assets/lang/en_US.lang +++ b/project/android_java/assets/lang/en_US.lang @@ -168,8 +168,10 @@ options.graphics.fast=Fast options.guiScale=GUI Scale options.guiScale.auto=Auto options.guiScale.small=Small -options.guiScale.normal=Normal +options.guiScale.medium=Medium options.guiScale.large=Large +options.guiScale.larger=Larger +options.guiScale.largest=Largest options.advancedOpengl=Advanced OpenGL options.renderClouds=Clouds options.farWarning1=A 64 bit Java installation is recommended diff --git a/project/android_java/jni/Android.mk b/project/android_java/jni/Android.mk index 04720a6..8e3ae22 100755 --- a/project/android_java/jni/Android.mk +++ b/project/android_java/jni/Android.mk @@ -75,6 +75,7 @@ LOCAL_SRC_FILES := ../../../src/main.cpp \ ../../../src/client/player/RemotePlayer.cpp \ ../../../src/client/player/input/KeyboardInput.cpp \ ../../../src/client/player/input/touchscreen/TouchscreenInput.cpp \ +../../../src/client/renderer/Lighting.cpp \ ../../../src/client/renderer/Chunk.cpp \ ../../../src/client/renderer/EntityTileRenderer.cpp \ ../../../src/client/renderer/GameRenderer.cpp \ @@ -122,6 +123,7 @@ LOCAL_SRC_FILES := ../../../src/main.cpp \ ../../../src/util/StringUtils.cpp \ ../../../src/util/PerfTimer.cpp \ ../../../src/util/PerfRenderer.cpp \ +../../../src/util/Color.cpp \ ../../../src/world/Direction.cpp \ ../../../src/world/entity/AgableMob.cpp \ ../../../src/world/entity/Entity.cpp \ @@ -183,6 +185,8 @@ LOCAL_SRC_FILES := ../../../src/main.cpp \ ../../../src/world/level/MobSpawner.cpp \ ../../../src/world/level/Region.cpp \ ../../../src/world/level/TickNextTickData.cpp \ +../../../src/world/level/FoliageColor.cpp \ +../../../src/world/level/GrassColor.cpp \ ../../../src/world/level/biome/Biome.cpp \ ../../../src/world/level/biome/BiomeSource.cpp \ ../../../src/world/level/chunk/LevelChunk.cpp \ @@ -228,6 +232,7 @@ LOCAL_SRC_FILES := ../../../src/main.cpp \ ../../../src/world/level/tile/entity/TileEntity.cpp \ ../../../src/world/level/tile/entity/FurnaceTileEntity.cpp \ ../../../src/world/phys/HitResult.cpp +../../../src/world/level/LevelConstants.cpp LOCAL_CFLAGS := -Wno-psabi $(LOCAL_CFLAGS) diff --git a/project/android_java/jni/Application.mk b/project/android_java/jni/Application.mk index 6c92946..a64d8b9 100755 --- a/project/android_java/jni/Application.mk +++ b/project/android_java/jni/Application.mk @@ -1,4 +1,4 @@ -APP_PLATFORM := android-9 +APP_PLATFORM := android-19 APP_STL := gnustl_static APP_OPTIM := release APP_ABI := armeabi-v7a \ No newline at end of file diff --git a/project/android_java/res/raw/burp1.ogg b/project/android_java/res/raw/burp1.ogg new file mode 100644 index 0000000..5ad3f57 Binary files /dev/null and b/project/android_java/res/raw/burp1.ogg differ diff --git a/project/android_java/src/com/mojang/minecraftpe/MainActivity.java b/project/android_java/src/com/mojang/minecraftpe/MainActivity.java index 200274c..6dc9e26 100755 --- a/project/android_java/src/com/mojang/minecraftpe/MainActivity.java +++ b/project/android_java/src/com/mojang/minecraftpe/MainActivity.java @@ -31,6 +31,8 @@ import android.content.Intent; import android.content.SharedPreferences; import android.content.res.AssetManager; import android.graphics.Bitmap; +import android.content.pm.PackageManager; +import android.os.Build; import android.graphics.Bitmap.CompressFormat; import android.graphics.BitmapFactory; import android.media.AudioManager; @@ -40,7 +42,6 @@ import android.os.Vibrator; import android.preference.PreferenceManager; import android.util.DisplayMetrics; import android.util.Log; -import android.view.Display; import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.MotionEvent; @@ -55,9 +56,13 @@ import com.mojang.minecraftpe.sound.SoundPlayer; public class MainActivity extends Activity { /** Called when the activity is first created. */ - + private static final int PERMISSION_REQUEST_CODE = 123; + private GLView _glView; + private boolean _nativeInitialized = false; public float invScale = 1.0f;// / 1.5f; + private int _screenWidth = 0; + private int _screenHeight = 0; Vector _touchEvents = new Vector(); Vector _keyEvents = new Vector(); @@ -67,53 +72,103 @@ public class MainActivity extends Activity { setVolumeControlStream(AudioManager.STREAM_MUSIC); super.onCreate(savedInstanceState); nativeRegisterThis(); - - nativeOnCreate(); + + // Cache screen dimensions once to avoid re-entrant getDisplayMetrics() callbacks + android.util.DisplayMetrics _dm = getResources().getDisplayMetrics(); + _screenWidth = Math.max(_dm.widthPixels, _dm.heightPixels); + _screenHeight = Math.min(_dm.widthPixels, _dm.heightPixels); _glView = new GLView(getApplication(), this); //_glView.setEGLConfigChooser(8, 8, 8, 8, 16, 0); + _glView.setEGLConfigChooser(true); //_glView - -// _glView.setEGLConfigChooser( -// new GLSurfaceView.EGLConfigChooser() { -// -// @Override -// public EGLConfig chooseConfig(EGL10 egl, EGLDisplay display) { -// // TODO Auto-generated method stub -// -// // Specify a configuration for our opengl session -// // and grab the first configuration that matches is -// int[] configSpec = { -// EGL10.EGL_DEPTH_SIZE, 24, -// EGL10.EGL_NONE -// }; -// EGLConfig[] configs = new EGLConfig[1]; -// int[] num_config = new int[1]; -// egl.eglChooseConfig(display, configSpec, configs, 1, num_config); -// EGLConfig config = configs[0]; -// return config; -// -// //return null; -// } -// } ); _glView.commit(); - setContentView(_glView); - - _soundPlayer = new SoundPlayer(this, AudioManager.STREAM_MUSIC); + setContentView(_glView); + + _soundPlayer = new SoundPlayer(this, AudioManager.STREAM_MUSIC); + + checkAndRequestPermissions(); + initNative(); + } + + private void initNative() { + if (_nativeInitialized) { + return; + } + _nativeInitialized = true; + nativeOnCreate(_screenWidth, _screenHeight); + } + + // request dangerous permissions at runtime if necessary + private boolean checkAndRequestPermissions() { + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) { + return true; + } + + boolean writeGranted = checkSelfPermission(android.Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED; + boolean readGranted = checkSelfPermission(android.Manifest.permission.READ_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED; + + if (writeGranted && readGranted) { + return true; + } + + requestPermissions(new String[] { + android.Manifest.permission.WRITE_EXTERNAL_STORAGE, + android.Manifest.permission.READ_EXTERNAL_STORAGE + }, PERMISSION_REQUEST_CODE); + + return false; + } + + @Override + public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) { + if (requestCode == PERMISSION_REQUEST_CODE) { + boolean granted = true; + for (int r : grantResults) { + if (r != PackageManager.PERMISSION_GRANTED) { + granted = false; + break; + } + } + if (granted) { + initNative(); + } else { + // We can still run using app-specific external files in scoped-storage, + // so allow startup while warning the user. + initNative(); + new AlertDialog.Builder(this) + .setTitle("Storage permission recommended") + .setMessage("MinecraftPE can still run with app-private storage, but public external save/load may require permission.") + .setPositiveButton("OK", null) + .setCancelable(true) + .show(); + } + } + super.onRequestPermissionsResult(requestCode, permissions, grantResults); + } + + // method required by native code to detect touchscreen support + public boolean supportsTouchscreen() { + return true; // all devices using this build are touch-capable } - public boolean isTouchscreen() { return true; } static public boolean isXperiaPlay() { return false; } static private boolean _isPowerVr = false; public void setIsPowerVR(boolean status) { MainActivity._isPowerVr = status; } static public boolean isPowerVR() { return _isPowerVr; } + @SuppressWarnings("deprecation") public void vibrate(int milliSeconds) { - Vibrator v = (Vibrator)this.getSystemService(VIBRATOR_SERVICE); - v.vibrate(milliSeconds); + Vibrator v = (Vibrator) getSystemService(VIBRATOR_SERVICE); + if (android.os.Build.VERSION.SDK_INT >= 26) { + v.vibrate(android.os.VibrationEffect.createOneShot(milliSeconds, + android.os.VibrationEffect.DEFAULT_AMPLITUDE)); + } else { + v.vibrate(milliSeconds); + } } private void createAlertDialog(boolean hasOkButton, boolean hasCancelButton, boolean preventBackKey) { @@ -144,9 +199,16 @@ public class MainActivity extends Activity { @Override public void onWindowFocusChanged(boolean hasFocus) { - // TODO Auto-generated method stub - //System.out.println("Focus has changed. Has Focus? " + hasFocus); super.onWindowFocusChanged(hasFocus); + if (hasFocus) { + getWindow().getDecorView().setSystemUiVisibility( + View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY + | View.SYSTEM_UI_FLAG_FULLSCREEN + | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION + | View.SYSTEM_UI_FLAG_LAYOUT_STABLE + | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN + | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION); + } } @Override @@ -184,9 +246,12 @@ public class MainActivity extends Activity { return; } - if (event.getAction() == KeyEvent.ACTION_DOWN) + if (event.getAction() == KeyEvent.ACTION_DOWN) { nativeOnKeyDown(keyCode); - else if (event.getAction() == KeyEvent.ACTION_UP) + int unicodeChar = event.getUnicodeChar(event.getMetaState()); + if (unicodeChar > 0) + nativeTextChar(unicodeChar); + } else if (event.getAction() == KeyEvent.ACTION_UP) nativeOnKeyUp(keyCode); } @@ -347,22 +412,15 @@ public class MainActivity extends Activity { } public int getScreenWidth() { - Display display = ((WindowManager)this.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay(); - int out = Math.max(display.getWidth(), display.getHeight()); - //System.out.println("getwidth: " + out); - return out; + return _screenWidth; } public int getScreenHeight() { - Display display = ((WindowManager)this.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay(); - int out = Math.min(display.getWidth(), display.getHeight()); - //System.out.println("getheight: " + out); - return out; + return _screenHeight; } public float getPixelsPerMillimeter() { - DisplayMetrics metrics = new DisplayMetrics(); - getWindowManager().getDefaultDisplay().getMetrics(metrics); + android.util.DisplayMetrics metrics = getResources().getDisplayMetrics(); return (metrics.xdpi + metrics.ydpi) * 0.5f / 25.4f; } @@ -465,8 +523,8 @@ public class MainActivity extends Activity { MainActivity.this.mDialog.show(); MainActivity.this.mDialog.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); - MainActivity.this.mDialog.getWindow().setLayout(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT); - //MainActivity.this.getWindow().setLayout(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT); + MainActivity.this.mDialog.getWindow().setLayout(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); + //MainActivity.this.getWindow().setLayout(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); } }); } @@ -516,6 +574,20 @@ public class MainActivity extends Activity { public void buyGame() {} + public int getKeyFromKeyCode(int keyCode, int metaState, int deviceId) { + android.view.KeyCharacterMap kcm = android.view.KeyCharacterMap.load(deviceId); + return kcm.get(keyCode, metaState); + } + + public void openURL(String url) { + try { + Intent intent = new Intent(Intent.ACTION_VIEW, android.net.Uri.parse(url)); + startActivity(intent); + } catch (Exception e) { + e.printStackTrace(); + } + } + public String getPlatformStringVar(int id) { if (id == 0) return android.os.Build.MODEL; return null; @@ -604,10 +676,11 @@ public class MainActivity extends Activity { // native void nativeRegisterThis(); native void nativeUnregisterThis(); - native static void nativeOnCreate(); + native static void nativeOnCreate(int screenWidth, int screenHeight); native static void nativeOnDestroy(); native static void nativeOnKeyDown(int key); native static void nativeOnKeyUp(int key); + native static void nativeTextChar(int unicodeChar); native static boolean nativeHandleBack(boolean isDown); native static void nativeMouseDown(int pointerId, int buttonId, float x, float y); native static void nativeMouseUp(int pointerId, int buttonId, float x, float y); diff --git a/project/android_java/src/com/mojang/minecraftpe/sound/SoundPlayer.java b/project/android_java/src/com/mojang/minecraftpe/sound/SoundPlayer.java index f3686c7..e36fa83 100755 --- a/project/android_java/src/com/mojang/minecraftpe/sound/SoundPlayer.java +++ b/project/android_java/src/com/mojang/minecraftpe/sound/SoundPlayer.java @@ -129,6 +129,7 @@ public class SoundPlayer new SoundId(R.raw.eat1, "random.eat"), new SoundId(R.raw.eat2, "random.eat"), new SoundId(R.raw.eat3, "random.eat"), + new SoundId(R.raw.burp1, "random.burp"), new SoundId(R.raw.fuse, "random.fuse"), new SoundId(R.raw.zpig1, "mob.zombiepig.zpig"), diff --git a/project/dedicated_server/CMakeLists.txt b/project/dedicated_server/CMakeLists.txt index fd4c363..a2bf40b 100755 --- a/project/dedicated_server/CMakeLists.txt +++ b/project/dedicated_server/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.7) +cmake_minimum_required(VERSION 3.5.0) find_package (Threads) include_directories("${PROJECT_SOURCE_DIR}/../lib_projects/raknet/jni/RaknetSources") add_subdirectory("${PROJECT_SOURCE_DIR}/../lib_projects/raknet/jni" "${CMAKE_CURRENT_BINARY_DIR}/raknet") @@ -19,6 +19,7 @@ set(CompileFiles ../../src/main.cpp ../../src/client/IConfigListener.cpp ../../src/client/Minecraft.cpp ../../src/client/Options.cpp +../../src/client/Option.cpp ../../src/client/OptionsFile.cpp ../../src/client/OptionStrings.cpp ../../src/client/gamemode/GameMode.cpp @@ -151,6 +152,9 @@ set(CompileFiles ../../src/main.cpp ../../src/world/level/tile/entity/TileEntity.cpp ../../src/world/level/tile/entity/FurnaceTileEntity.cpp ../../src/world/phys/HitResult.cpp) -message(${CMAKE_LIBRARY_ARCHITECTURE}) + add_executable(mcpe_server ${CompileFiles}) -target_link_libraries(mcpe_server raknet ${CMAKE_THREAD_LIBS_INIT}) \ No newline at end of file +target_link_libraries(mcpe_server raknet ${CMAKE_THREAD_LIBS_INIT}) +target_include_directories(mcpe_server PUBLIC + "../../src/" +) diff --git a/project/iosproj/Launch Screen.storyboard b/project/iosproj/Launch Screen.storyboard new file mode 100644 index 0000000..4ee7abe --- /dev/null +++ b/project/iosproj/Launch Screen.storyboard @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/project/iosproj/minecraftpe.xcodeproj/project.pbxproj b/project/iosproj/minecraftpe.xcodeproj/project.pbxproj index b4f42b6..57b12b7 100755 --- a/project/iosproj/minecraftpe.xcodeproj/project.pbxproj +++ b/project/iosproj/minecraftpe.xcodeproj/project.pbxproj @@ -41,13 +41,14 @@ 042A91AE16B17517007ABBC6 /* GuiElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 042A91A316B17517007ABBC6 /* GuiElement.cpp */; }; 042A91AF16B17517007ABBC6 /* NinePatch.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 042A91A516B17517007ABBC6 /* NinePatch.cpp */; }; 042A91B016B17517007ABBC6 /* OptionsGroup.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 042A91A716B17517007ABBC6 /* OptionsGroup.cpp */; }; - 042A91B116B17517007ABBC6 /* OptionsPane.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 042A91A916B17517007ABBC6 /* OptionsPane.cpp */; }; 042A91B216B17517007ABBC6 /* TextBox.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 042A91AB16B17517007ABBC6 /* TextBox.cpp */; }; 044129071682FF9600B70EE6 /* MouseHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 044129061682FF9600B70EE6 /* MouseHandler.cpp */; }; 9D293CE716071C08000305C8 /* CreateNewWorld_iphone.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9D293CE616071C08000305C8 /* CreateNewWorld_iphone.xib */; }; 9D293CE816071C08000305C8 /* CreateNewWorld_iphone.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9D293CE616071C08000305C8 /* CreateNewWorld_iphone.xib */; }; 9D293CEB160720D6000305C8 /* worldname_iphone5_3.png in Resources */ = {isa = PBXBuildFile; fileRef = 9D293CEA160720D6000305C8 /* worldname_iphone5_3.png */; }; 9D293CEC160720D6000305C8 /* worldname_iphone5_3.png in Resources */ = {isa = PBXBuildFile; fileRef = 9D293CEA160720D6000305C8 /* worldname_iphone5_3.png */; }; + BEEF202614CFF670005F0002 /* Lighting.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BEEF202614CFF670005F0001 /* Lighting.cpp */; }; + BEEF202614CFF670005F0003 /* Lighting.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BEEF202614CFF670005F0001 /* Lighting.cpp */; }; D506D3E2161288BD0099FA65 /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 9D959AFF16036BEE00E23A6F /* Default-568h@2x.png */; }; D51DC73614581D4E00E3D761 /* itemframe.png in Resources */ = {isa = PBXBuildFile; fileRef = D51DC73514581D4E00E3D761 /* itemframe.png */; }; D51DC74314592B8B00E3D761 /* PVRTexture.m in Sources */ = {isa = PBXBuildFile; fileRef = D51DC74214592B8A00E3D761 /* PVRTexture.m */; }; @@ -1147,6 +1148,52 @@ D5F3B7DD14548E7900D25470 /* IASKPSToggleSwitchSpecifierViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = D5F3B7C814548E7900D25470 /* IASKPSToggleSwitchSpecifierViewCell.xib */; }; D5F3B7DE14548E7900D25470 /* IASKSpecifierValuesView.xib in Resources */ = {isa = PBXBuildFile; fileRef = D5F3B7C914548E7900D25470 /* IASKSpecifierValuesView.xib */; }; D5F3B7E51454930400D25470 /* InAppSettings.bundle in Resources */ = {isa = PBXBuildFile; fileRef = D5F3B7E41454930400D25470 /* InAppSettings.bundle */; }; + F912B8CF2F6C3D5200BC60DF /* TextBox.h in Sources */ = {isa = PBXBuildFile; fileRef = 042A91AC16B17517007ABBC6 /* TextBox.h */; }; + F99D341F2F736AA100DC153E /* HttpClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F99D341E2F736AA100DC153E /* HttpClient.cpp */; }; + F99D34202F736AA100DC153E /* HttpClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F99D341E2F736AA100DC153E /* HttpClient.cpp */; }; + F99D34232F736AD400DC153E /* TextOption.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F99D34222F736AD400DC153E /* TextOption.cpp */; }; + F99D34242F736AD400DC153E /* TextOption.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F99D34222F736AD400DC153E /* TextOption.cpp */; }; + F99D34272F736AFB00DC153E /* OptionsFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F99D34262F736AFB00DC153E /* OptionsFile.cpp */; }; + F99D34282F736AFB00DC153E /* OptionsFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F99D34262F736AFB00DC153E /* OptionsFile.cpp */; }; + F99D342B2F736B6F00DC153E /* OptionsItem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F99D342A2F736B6F00DC153E /* OptionsItem.cpp */; }; + F99D342C2F736B6F00DC153E /* OptionsItem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F99D342A2F736B6F00DC153E /* OptionsItem.cpp */; }; + F99D342F2F736BAD00DC153E /* ConsoleScreen.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F99D342E2F736BAD00DC153E /* ConsoleScreen.cpp */; }; + F99D34302F736BAD00DC153E /* ConsoleScreen.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F99D342E2F736BAD00DC153E /* ConsoleScreen.cpp */; }; + F99D34332F736BDA00DC153E /* CreditsScreen.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F99D34322F736BDA00DC153E /* CreditsScreen.cpp */; }; + F99D34342F736BDA00DC153E /* CreditsScreen.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F99D34322F736BDA00DC153E /* CreditsScreen.cpp */; }; + F99D34372F736C1000DC153E /* JoinByIPScreen.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F99D34362F736C1000DC153E /* JoinByIPScreen.cpp */; }; + F99D34382F736C1000DC153E /* JoinByIPScreen.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F99D34362F736C1000DC153E /* JoinByIPScreen.cpp */; }; + F99D343B2F736C3B00DC153E /* UsernameScreen.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F99D343A2F736C3B00DC153E /* UsernameScreen.cpp */; }; + F99D343C2F736C3B00DC153E /* UsernameScreen.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F99D343A2F736C3B00DC153E /* UsernameScreen.cpp */; }; + F99D343F2F736C8400DC153E /* GuiElementContainer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F99D343E2F736C8400DC153E /* GuiElementContainer.cpp */; }; + F99D34402F736C8400DC153E /* GuiElementContainer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F99D343E2F736C8400DC153E /* GuiElementContainer.cpp */; }; + F99D34432F736F9400DC153E /* Option.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F99D34422F736F9400DC153E /* Option.cpp */; }; + F99D34442F736F9400DC153E /* Option.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F99D34422F736F9400DC153E /* Option.cpp */; }; + F99D34472F736FE800DC153E /* KeyOption.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F99D34462F736FE800DC153E /* KeyOption.cpp */; }; + F99D34482F736FE800DC153E /* KeyOption.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F99D34462F736FE800DC153E /* KeyOption.cpp */; }; + F99D344B2F7370CF00DC153E /* Slider.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F99D344A2F7370CF00DC153E /* Slider.cpp */; }; + F99D344C2F7370CF00DC153E /* Slider.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F99D344A2F7370CF00DC153E /* Slider.cpp */; }; + F99D344E2F7372A100DC153E /* Launch Screen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F99D344D2F7372A100DC153E /* Launch Screen.storyboard */; }; + F99D344F2F7372A100DC153E /* Launch Screen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F99D344D2F7372A100DC153E /* Launch Screen.storyboard */; }; + F99F0FA92F84369F00F2B29A /* GrassColor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F99F0FA82F84369F00F2B29A /* GrassColor.cpp */; }; + F99F0FAA2F84369F00F2B29A /* GrassColor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F99F0FA82F84369F00F2B29A /* GrassColor.cpp */; }; + F99F0FAC2F8436CE00F2B29A /* FoliageColor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F99F0FAB2F8436CE00F2B29A /* FoliageColor.cpp */; }; + F99F0FAD2F8436CE00F2B29A /* FoliageColor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F99F0FAB2F8436CE00F2B29A /* FoliageColor.cpp */; }; + F99F0FAF2F8436EB00F2B29A /* Color.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F99F0FAE2F8436EB00F2B29A /* Color.cpp */; }; + F99F0FB02F8436EB00F2B29A /* Color.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F99F0FAE2F8436EB00F2B29A /* Color.cpp */; }; + F9E5A772300E7A8700164066 /* LevelConstants.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F9E5A771300E7A8700164066 /* LevelConstants.cpp */; }; + F9E5A775300E7AB700164066 /* CommandManager.hpp in Sources */ = {isa = PBXBuildFile; fileRef = F9E5A773300E7AB700164066 /* CommandManager.hpp */; }; + F9E5A776300E7AB700164066 /* CommandManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F9E5A774300E7AB700164066 /* CommandManager.cpp */; }; + F9E5A779300E7AD500164066 /* CommandBan.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F9E5A777300E7AD500164066 /* CommandBan.cpp */; }; + F9E5A77A300E7AD500164066 /* CommandBan.hpp in Sources */ = {isa = PBXBuildFile; fileRef = F9E5A778300E7AD500164066 /* CommandBan.hpp */; }; + F9E5A77D300E7AF400164066 /* CommandHelp.hpp in Sources */ = {isa = PBXBuildFile; fileRef = F9E5A77B300E7AF400164066 /* CommandHelp.hpp */; }; + F9E5A77E300E7AF400164066 /* CommandHelp.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F9E5A77C300E7AF400164066 /* CommandHelp.cpp */; }; + F9E5A783300E7B0B00164066 /* CommandKick.hpp in Sources */ = {isa = PBXBuildFile; fileRef = F9E5A77F300E7B0A00164066 /* CommandKick.hpp */; }; + F9E5A784300E7B0B00164066 /* CommandOp.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F9E5A780300E7B0A00164066 /* CommandOp.cpp */; }; + F9E5A785300E7B0B00164066 /* CommandKick.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F9E5A781300E7B0B00164066 /* CommandKick.cpp */; }; + F9E5A786300E7B0B00164066 /* CommandOp.hpp in Sources */ = {isa = PBXBuildFile; fileRef = F9E5A782300E7B0B00164066 /* CommandOp.hpp */; }; + F9E5A789300E7B3400164066 /* Command.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F9E5A787300E7B3400164066 /* Command.cpp */; }; + F9E5A78A300E7B3400164066 /* Command.hpp in Sources */ = {isa = PBXBuildFile; fileRef = F9E5A788300E7B3400164066 /* Command.hpp */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -1208,14 +1255,13 @@ 042A91A616B17517007ABBC6 /* NinePatch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NinePatch.h; sourceTree = ""; }; 042A91A716B17517007ABBC6 /* OptionsGroup.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OptionsGroup.cpp; sourceTree = ""; }; 042A91A816B17517007ABBC6 /* OptionsGroup.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OptionsGroup.h; sourceTree = ""; }; - 042A91A916B17517007ABBC6 /* OptionsPane.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OptionsPane.cpp; sourceTree = ""; }; - 042A91AA16B17517007ABBC6 /* OptionsPane.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OptionsPane.h; sourceTree = ""; }; 042A91AB16B17517007ABBC6 /* TextBox.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TextBox.cpp; sourceTree = ""; }; - 042A91AC16B17517007ABBC6 /* TextBox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextBox.h; sourceTree = ""; }; + 042A91AC16B17517007ABBC6 /* TextBox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TextBox.h; path = ../../src/client/gui/components/TextBox.h; sourceTree = SOURCE_ROOT; }; 044129061682FF9600B70EE6 /* MouseHandler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MouseHandler.cpp; sourceTree = ""; }; 9D293CE616071C08000305C8 /* CreateNewWorld_iphone.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = CreateNewWorld_iphone.xib; path = minecraftpe/dialogs/CreateNewWorld_iphone.xib; sourceTree = ""; }; 9D293CEA160720D6000305C8 /* worldname_iphone5_3.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = worldname_iphone5_3.png; sourceTree = ""; }; 9D959AFF16036BEE00E23A6F /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = ""; }; + BEEF202614CFF670005F0001 /* Lighting.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Lighting.cpp; sourceTree = ""; }; D51A8B01146A200000E5D720 /* minecraftpedemo-info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "minecraftpedemo-info.plist"; sourceTree = ""; }; D51DC73514581D4E00E3D761 /* itemframe.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = itemframe.png; sourceTree = ""; }; D51DC74114592B8A00E3D761 /* PVRTexture.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PVRTexture.h; sourceTree = ""; }; @@ -2017,7 +2063,7 @@ D5B50D6914CFF66F005F7284 /* Multitouch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Multitouch.h; sourceTree = ""; }; D5B50D6A14CFF66F005F7284 /* log.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = log.h; sourceTree = ""; }; D5B50D6B14CFF66F005F7284 /* time.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = time.cpp; sourceTree = ""; }; - D5B50D6C14CFF66F005F7284 /* time.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = time.h; sourceTree = ""; }; + D5B50D6C14CFF66F005F7284 /* time.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 4; path = time.h; sourceTree = ""; }; D5B50E5614CFF66F005F7284 /* SharedConstants.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SharedConstants.h; sourceTree = ""; }; D5B50E5714CFF66F005F7284 /* terrain_4444.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = terrain_4444.h; sourceTree = ""; }; D5B50E5814CFF66F005F7284 /* terrain_5551.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = terrain_5551.h; sourceTree = ""; }; @@ -2408,6 +2454,47 @@ D5F3B7C814548E7900D25470 /* IASKPSToggleSwitchSpecifierViewCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = IASKPSToggleSwitchSpecifierViewCell.xib; sourceTree = ""; }; D5F3B7C914548E7900D25470 /* IASKSpecifierValuesView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = IASKSpecifierValuesView.xib; sourceTree = ""; }; D5F3B7E41454930400D25470 /* InAppSettings.bundle */ = {isa = PBXFileReference; explicitFileType = "wrapper.installer-pkg"; path = InAppSettings.bundle; sourceTree = ""; }; + F99D341D2F736AA100DC153E /* HttpClient.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = HttpClient.h; path = ../../src/platform/HttpClient.h; sourceTree = ""; }; + F99D341E2F736AA100DC153E /* HttpClient.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = HttpClient.cpp; path = ../../src/platform/HttpClient.cpp; sourceTree = ""; }; + F99D34212F736AD400DC153E /* TextOption.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = TextOption.h; path = ../../src/client/gui/components/TextOption.h; sourceTree = ""; }; + F99D34222F736AD400DC153E /* TextOption.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = TextOption.cpp; path = ../../src/client/gui/components/TextOption.cpp; sourceTree = ""; }; + F99D34252F736AFB00DC153E /* OptionsFile.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = OptionsFile.h; path = ../../src/client/OptionsFile.h; sourceTree = ""; }; + F99D34262F736AFB00DC153E /* OptionsFile.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = OptionsFile.cpp; path = ../../src/client/OptionsFile.cpp; sourceTree = ""; }; + F99D34292F736B6F00DC153E /* OptionsItem.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = OptionsItem.h; path = ../../src/client/gui/components/OptionsItem.h; sourceTree = ""; }; + F99D342A2F736B6F00DC153E /* OptionsItem.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = OptionsItem.cpp; path = ../../src/client/gui/components/OptionsItem.cpp; sourceTree = ""; }; + F99D342D2F736BAD00DC153E /* ConsoleScreen.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = ConsoleScreen.h; path = ../../src/client/gui/screens/ConsoleScreen.h; sourceTree = ""; }; + F99D342E2F736BAD00DC153E /* ConsoleScreen.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = ConsoleScreen.cpp; path = ../../src/client/gui/screens/ConsoleScreen.cpp; sourceTree = ""; }; + F99D34312F736BDA00DC153E /* CreditsScreen.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = CreditsScreen.h; path = ../../src/client/gui/screens/CreditsScreen.h; sourceTree = ""; }; + F99D34322F736BDA00DC153E /* CreditsScreen.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = CreditsScreen.cpp; path = ../../src/client/gui/screens/CreditsScreen.cpp; sourceTree = ""; }; + F99D34352F736C1000DC153E /* JoinByIPScreen.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = JoinByIPScreen.h; path = ../../src/client/gui/screens/JoinByIPScreen.h; sourceTree = ""; }; + F99D34362F736C1000DC153E /* JoinByIPScreen.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = JoinByIPScreen.cpp; path = ../../src/client/gui/screens/JoinByIPScreen.cpp; sourceTree = ""; }; + F99D34392F736C3B00DC153E /* UsernameScreen.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = UsernameScreen.h; path = ../../src/client/gui/screens/UsernameScreen.h; sourceTree = ""; }; + F99D343A2F736C3B00DC153E /* UsernameScreen.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = UsernameScreen.cpp; path = ../../src/client/gui/screens/UsernameScreen.cpp; sourceTree = ""; }; + F99D343D2F736C8400DC153E /* GuiElementContainer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = GuiElementContainer.h; path = ../../src/client/gui/components/GuiElementContainer.h; sourceTree = ""; }; + F99D343E2F736C8400DC153E /* GuiElementContainer.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = GuiElementContainer.cpp; path = ../../src/client/gui/components/GuiElementContainer.cpp; sourceTree = ""; }; + F99D34412F736F9400DC153E /* Option.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = Option.h; path = ../../src/client/Option.h; sourceTree = ""; }; + F99D34422F736F9400DC153E /* Option.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = Option.cpp; path = ../../src/client/Option.cpp; sourceTree = ""; }; + F99D34452F736FE800DC153E /* KeyOption.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = KeyOption.h; path = ../../src/client/gui/components/KeyOption.h; sourceTree = ""; }; + F99D34462F736FE800DC153E /* KeyOption.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = KeyOption.cpp; path = ../../src/client/gui/components/KeyOption.cpp; sourceTree = ""; }; + F99D34492F7370CF00DC153E /* Slider.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = Slider.h; path = ../../src/client/gui/components/Slider.h; sourceTree = ""; }; + F99D344A2F7370CF00DC153E /* Slider.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = Slider.cpp; path = ../../src/client/gui/components/Slider.cpp; sourceTree = ""; }; + F99D344D2F7372A100DC153E /* Launch Screen.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = "Launch Screen.storyboard"; sourceTree = ""; }; + F99F0FA82F84369F00F2B29A /* GrassColor.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = GrassColor.cpp; sourceTree = ""; }; + F99F0FAB2F8436CE00F2B29A /* FoliageColor.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = FoliageColor.cpp; sourceTree = ""; }; + F99F0FAE2F8436EB00F2B29A /* Color.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = Color.cpp; sourceTree = ""; }; + F9E5A771300E7A8700164066 /* LevelConstants.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = LevelConstants.cpp; path = ../../src/world/level/LevelConstants.cpp; sourceTree = ""; }; + F9E5A773300E7AB700164066 /* CommandManager.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; name = CommandManager.hpp; path = ../../src/commands/CommandManager.hpp; sourceTree = ""; }; + F9E5A774300E7AB700164066 /* CommandManager.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = CommandManager.cpp; path = ../../src/commands/CommandManager.cpp; sourceTree = ""; }; + F9E5A777300E7AD500164066 /* CommandBan.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = CommandBan.cpp; path = ../../src/commands/CommandBan.cpp; sourceTree = ""; }; + F9E5A778300E7AD500164066 /* CommandBan.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; name = CommandBan.hpp; path = ../../src/commands/CommandBan.hpp; sourceTree = ""; }; + F9E5A77B300E7AF400164066 /* CommandHelp.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; name = CommandHelp.hpp; path = ../../src/commands/CommandHelp.hpp; sourceTree = ""; }; + F9E5A77C300E7AF400164066 /* CommandHelp.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = CommandHelp.cpp; path = ../../src/commands/CommandHelp.cpp; sourceTree = ""; }; + F9E5A77F300E7B0A00164066 /* CommandKick.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; name = CommandKick.hpp; path = ../../src/commands/CommandKick.hpp; sourceTree = ""; }; + F9E5A780300E7B0A00164066 /* CommandOp.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = CommandOp.cpp; path = ../../src/commands/CommandOp.cpp; sourceTree = ""; }; + F9E5A781300E7B0B00164066 /* CommandKick.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = CommandKick.cpp; path = ../../src/commands/CommandKick.cpp; sourceTree = ""; }; + F9E5A782300E7B0B00164066 /* CommandOp.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; name = CommandOp.hpp; path = ../../src/commands/CommandOp.hpp; sourceTree = ""; }; + F9E5A787300E7B3400164066 /* Command.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = Command.cpp; path = ../../src/commands/Command.cpp; sourceTree = ""; }; + F9E5A788300E7B3400164066 /* Command.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; name = Command.hpp; path = ../../src/commands/Command.hpp; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -3226,8 +3313,6 @@ 042A91A616B17517007ABBC6 /* NinePatch.h */, 042A91A716B17517007ABBC6 /* OptionsGroup.cpp */, 042A91A816B17517007ABBC6 /* OptionsGroup.h */, - 042A91A916B17517007ABBC6 /* OptionsPane.cpp */, - 042A91AA16B17517007ABBC6 /* OptionsPane.h */, 042A91AB16B17517007ABBC6 /* TextBox.cpp */, 042A91AC16B17517007ABBC6 /* TextBox.h */, D5B50C2814CFF66F005F7284 /* Button.cpp */, @@ -3477,6 +3562,7 @@ D5B50CF114CFF66F005F7284 /* TileRenderer.cpp */, D5B50CF214CFF66F005F7284 /* TileRenderer.h */, D5B50CF314CFF66F005F7284 /* VertecDecl.h */, + BEEF202614CFF670005F0001 /* Lighting.cpp */, ); path = renderer; sourceTree = ""; @@ -3714,6 +3800,7 @@ D5B50E6914CFF66F005F7284 /* StringUtils.cpp */, D5B50E6A14CFF66F005F7284 /* StringUtils.h */, D5B50E6B14CFF66F005F7284 /* WeighedRandom.h */, + F99F0FAE2F8436EB00F2B29A /* Color.cpp */, ); path = util; sourceTree = ""; @@ -3978,6 +4065,8 @@ D5B50F3714CFF66F005F7284 /* TickNextTickData.h */, D5B50F3814CFF66F005F7284 /* tile */, D5B50F6814CFF66F005F7284 /* TilePos.h */, + F99F0FA82F84369F00F2B29A /* GrassColor.cpp */, + F99F0FAB2F8436CE00F2B29A /* FoliageColor.cpp */, ); path = level; sourceTree = ""; @@ -4256,6 +4345,20 @@ D5CF9C37144C225000E4244F = { isa = PBXGroup; children = ( + F9E5A788300E7B3400164066 /* Command.hpp */, + F9E5A787300E7B3400164066 /* Command.cpp */, + F9E5A77F300E7B0A00164066 /* CommandKick.hpp */, + F9E5A781300E7B0B00164066 /* CommandKick.cpp */, + F9E5A782300E7B0B00164066 /* CommandOp.hpp */, + F9E5A780300E7B0A00164066 /* CommandOp.cpp */, + F9E5A77B300E7AF400164066 /* CommandHelp.hpp */, + F9E5A77C300E7AF400164066 /* CommandHelp.cpp */, + F9E5A778300E7AD500164066 /* CommandBan.hpp */, + F9E5A777300E7AD500164066 /* CommandBan.cpp */, + F9E5A773300E7AB700164066 /* CommandManager.hpp */, + F9E5A774300E7AB700164066 /* CommandManager.cpp */, + F9E5A771300E7A8700164066 /* LevelConstants.cpp */, + F99D344D2F7372A100DC153E /* Launch Screen.storyboard */, D5E1BA9A1451C8A0007DCC4F /* Default@2x.png */, 9D959AFF16036BEE00E23A6F /* Default-568h@2x.png */, D5F07744145EF79B00EC30FB /* Default-Landscape~ipad.png */, @@ -4267,6 +4370,30 @@ D5CF9C45144C225000E4244F /* Frameworks */, D5CF9C43144C225000E4244F /* Products */, D5B50C1614CFF66F005F7284 /* src */, + F99D341D2F736AA100DC153E /* HttpClient.h */, + F99D341E2F736AA100DC153E /* HttpClient.cpp */, + F99D34212F736AD400DC153E /* TextOption.h */, + F99D34222F736AD400DC153E /* TextOption.cpp */, + F99D34252F736AFB00DC153E /* OptionsFile.h */, + F99D34262F736AFB00DC153E /* OptionsFile.cpp */, + F99D34292F736B6F00DC153E /* OptionsItem.h */, + F99D342A2F736B6F00DC153E /* OptionsItem.cpp */, + F99D342D2F736BAD00DC153E /* ConsoleScreen.h */, + F99D342E2F736BAD00DC153E /* ConsoleScreen.cpp */, + F99D34312F736BDA00DC153E /* CreditsScreen.h */, + F99D34322F736BDA00DC153E /* CreditsScreen.cpp */, + F99D34352F736C1000DC153E /* JoinByIPScreen.h */, + F99D34362F736C1000DC153E /* JoinByIPScreen.cpp */, + F99D34392F736C3B00DC153E /* UsernameScreen.h */, + F99D343A2F736C3B00DC153E /* UsernameScreen.cpp */, + F99D343D2F736C8400DC153E /* GuiElementContainer.h */, + F99D343E2F736C8400DC153E /* GuiElementContainer.cpp */, + F99D34412F736F9400DC153E /* Option.h */, + F99D34422F736F9400DC153E /* Option.cpp */, + F99D34452F736FE800DC153E /* KeyOption.h */, + F99D34462F736FE800DC153E /* KeyOption.cpp */, + F99D34492F7370CF00DC153E /* Slider.h */, + F99D344A2F7370CF00DC153E /* Slider.cpp */, ); sourceTree = ""; }; @@ -4527,10 +4654,16 @@ isa = PBXProject; attributes = { LastUpgradeCheck = 0420; + TargetAttributes = { + D5CF9C41144C225000E4244F = { + DevelopmentTeam = PZUVNW8F2U; + ProvisioningStyle = Automatic; + }; + }; }; buildConfigurationList = D5CF9C3C144C225000E4244F /* Build configuration list for PBXProject "minecraftpe" */; compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; + developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( en, @@ -4599,6 +4732,7 @@ D5B50A5614CFF492005F7284 /* pig.png in Resources */, D5B50A5814CFF492005F7284 /* sheep_fur.png in Resources */, D5B50A5A14CFF492005F7284 /* sheep.png in Resources */, + F99D344F2F7372A100DC153E /* Launch Screen.storyboard in Resources */, D5B50A5C14CFF492005F7284 /* skeleton.png in Resources */, D5B50A5E14CFF492005F7284 /* spider.png in Resources */, D5B50A6014CFF492005F7284 /* zombie.png in Resources */, @@ -4935,6 +5069,7 @@ D5ACF26F15C03DBF00E21C22 /* sand2.m4a in Resources */, D5ACF27115C03DBF00E21C22 /* sand3.m4a in Resources */, D5ACF27315C03DBF00E21C22 /* sand4.m4a in Resources */, + F99D344E2F7372A100DC153E /* Launch Screen.storyboard in Resources */, D5ACF27515C03DBF00E21C22 /* snow1.m4a in Resources */, D5ACF27715C03DBF00E21C22 /* snow2.m4a in Resources */, D5ACF27915C03DBF00E21C22 /* snow3.m4a in Resources */, @@ -5011,18 +5146,22 @@ D58BB544146A0B910002C9F5 /* IASKSettingsStore.m in Sources */, D58BB545146A0B910002C9F5 /* IASKSettingsStoreFile.m in Sources */, D58BB546146A0B910002C9F5 /* IASKSettingsStoreUserDefaults.m in Sources */, + F99D34232F736AD400DC153E /* TextOption.cpp in Sources */, D58BB547146A0B910002C9F5 /* IASKSpecifier.m in Sources */, D58BB548146A0B910002C9F5 /* IASKPSSliderSpecifierViewCell.m in Sources */, D58BB549146A0B910002C9F5 /* IASKPSTextFieldSpecifierViewCell.m in Sources */, D58BB54A146A0B910002C9F5 /* IASKPSTitleValueSpecifierViewCell.m in Sources */, D58BB54B146A0B910002C9F5 /* IASKPSToggleSwitchSpecifierViewCell.m in Sources */, + F99D343B2F736C3B00DC153E /* UsernameScreen.cpp in Sources */, D58BB54C146A0B910002C9F5 /* IASKSlider.m in Sources */, D58BB54D146A0B910002C9F5 /* IASKSwitch.m in Sources */, + F99D34302F736BAD00DC153E /* ConsoleScreen.cpp in Sources */, D58BB54E146A0B910002C9F5 /* IASKTextField.m in Sources */, D58BB550146A0B910002C9F5 /* PVRTexture.m in Sources */, D5D43CC9146AF4B4002ED842 /* RenameMPWorldViewController.mm in Sources */, D5B50F7014CFF670005F7284 /* AppPlatform_iOS.mm in Sources */, D5B50F7414CFF670005F7284 /* CreativeMode.cpp in Sources */, + F99D34432F736F9400DC153E /* Option.cpp in Sources */, D5B50F7614CFF670005F7284 /* GameMode.cpp in Sources */, D5B50F7814CFF670005F7284 /* Button.cpp in Sources */, D5B50F7A14CFF670005F7284 /* ImageButton.cpp in Sources */, @@ -5067,6 +5206,7 @@ D5B50FC814CFF670005F7284 /* KeyboardInput.cpp in Sources */, D5B50FCA14CFF670005F7284 /* TouchscreenInput.cpp in Sources */, D5B50FCC14CFF670005F7284 /* LocalPlayer.cpp in Sources */, + F99D34482F736FE800DC153E /* KeyOption.cpp in Sources */, D5B50FCE14CFF670005F7284 /* Chunk.cpp in Sources */, D5B50FD014CFF670005F7284 /* Frustum.cpp in Sources */, D5B50FD214CFF670005F7284 /* ChickenRenderer.cpp in Sources */, @@ -5109,6 +5249,7 @@ D5B5111014CFF670005F7284 /* Mth.cpp in Sources */, D5B5111214CFF670005F7284 /* PerfRenderer.cpp in Sources */, D5B5111414CFF670005F7284 /* PerfTimer.cpp in Sources */, + F99F0FA92F84369F00F2B29A /* GrassColor.cpp in Sources */, D5B5111614CFF670005F7284 /* StringUtils.cpp in Sources */, D5B5111814CFF670005F7284 /* Direction.cpp in Sources */, D5B5111A14CFF670005F7284 /* Animal.cpp in Sources */, @@ -5125,17 +5266,21 @@ D5B5113014CFF670005F7284 /* TripodCamera.cpp in Sources */, D5B5113214CFF670005F7284 /* Mob.cpp in Sources */, D5B5113414CFF670005F7284 /* MobCategory.cpp in Sources */, + F99D34282F736AFB00DC153E /* OptionsFile.cpp in Sources */, D5B5113814CFF670005F7284 /* PathFinderMob.cpp in Sources */, D5B5113A14CFF670005F7284 /* Inventory.cpp in Sources */, D5B5113C14CFF670005F7284 /* Player.cpp in Sources */, + F99F0FB02F8436EB00F2B29A /* Color.cpp in Sources */, D5B5113E14CFF670005F7284 /* Arrow.cpp in Sources */, D5B5114014CFF670005F7284 /* Recipes.cpp in Sources */, D5B5114214CFF670005F7284 /* ToolRecipes.cpp in Sources */, D5B5114414CFF670005F7284 /* WeaponRecipes.cpp in Sources */, D5B5114614CFF670005F7284 /* HatchetItem.cpp in Sources */, D5B5114814CFF670005F7284 /* Item.cpp in Sources */, + F99F0FAC2F8436CE00F2B29A /* FoliageColor.cpp in Sources */, D5B5114A14CFF670005F7284 /* ItemInstance.cpp in Sources */, D5B5114C14CFF670005F7284 /* PickaxeItem.cpp in Sources */, + F99D344B2F7370CF00DC153E /* Slider.cpp in Sources */, D5B5114E14CFF670005F7284 /* ShovelItem.cpp in Sources */, D5B5115014CFF670005F7284 /* Biome.cpp in Sources */, D5B5115214CFF670005F7284 /* BiomeSource.cpp in Sources */, @@ -5186,6 +5331,7 @@ D5251DBA1538192700FC82C8 /* CloudServer.cpp in Sources */, D5251DBE1538192700FC82C8 /* CommandParserInterface.cpp in Sources */, D5251DC01538192700FC82C8 /* ConnectionGraph2.cpp in Sources */, + F99D34402F736C8400DC153E /* GuiElementContainer.cpp in Sources */, D5251DC21538192700FC82C8 /* ConsoleServer.cpp in Sources */, D5251DC41538192700FC82C8 /* DataCompressor.cpp in Sources */, D5251DC61538192700FC82C8 /* DirectoryDeltaTransfer.cpp in Sources */, @@ -5210,6 +5356,8 @@ D5251DEC1538192700FC82C8 /* HTTPConnection.cpp in Sources */, D5251DEE1538192700FC82C8 /* IncrementalReadInterface.cpp in Sources */, D5251DF01538192700FC82C8 /* Itoa.cpp in Sources */, + F99D34202F736AA100DC153E /* HttpClient.cpp in Sources */, + F99D34382F736C1000DC153E /* JoinByIPScreen.cpp in Sources */, D5251DF21538192700FC82C8 /* LinuxStrings.cpp in Sources */, D5251DF41538192700FC82C8 /* LocklessTypes.cpp in Sources */, D5251DF61538192700FC82C8 /* LogCommandParser.cpp in Sources */, @@ -5238,6 +5386,7 @@ D5251E2A1538192700FC82C8 /* RakSleep.cpp in Sources */, D5251E2C1538192700FC82C8 /* RakString.cpp in Sources */, D5251E2E1538192700FC82C8 /* RakThread.cpp in Sources */, + F99D34332F736BDA00DC153E /* CreditsScreen.cpp in Sources */, D5251E301538192700FC82C8 /* RakWString.cpp in Sources */, D5251E321538192700FC82C8 /* Rand.cpp in Sources */, D5251E341538192700FC82C8 /* rdlmalloc.cpp in Sources */, @@ -5280,6 +5429,7 @@ D5951EEB159349100043A12A /* TileEntity.cpp in Sources */, D5951EEF159349680043A12A /* FurnaceScreen.cpp in Sources */, D5951EF215934A2D0043A12A /* Feature.cpp in Sources */, + F99D342C2F736B6F00DC153E /* OptionsItem.cpp in Sources */, D5951EF815934AC50043A12A /* BaseContainerMenu.cpp in Sources */, D5951EFA15934AC50043A12A /* FurnaceMenu.cpp in Sources */, D5D381F315A1A1CF00B6C50E /* FillingContainer.cpp in Sources */, @@ -5332,6 +5482,7 @@ D5D8C4C41639341100FD35F0 /* Motive.cpp in Sources */, D5D8C4C8163934BB00FD35F0 /* HangingEntityItem.cpp in Sources */, D5D8C4CC1639362F00FD35F0 /* NetherReactorPattern.cpp in Sources */, + BEEF202614CFF670005F0002 /* Lighting.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -5339,8 +5490,23 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + F9E5A789300E7B3400164066 /* Command.cpp in Sources */, + F9E5A78A300E7B3400164066 /* Command.hpp in Sources */, + F9E5A783300E7B0B00164066 /* CommandKick.hpp in Sources */, + F9E5A784300E7B0B00164066 /* CommandOp.cpp in Sources */, + F9E5A785300E7B0B00164066 /* CommandKick.cpp in Sources */, + F9E5A786300E7B0B00164066 /* CommandOp.hpp in Sources */, + F9E5A77D300E7AF400164066 /* CommandHelp.hpp in Sources */, + F9E5A77E300E7AF400164066 /* CommandHelp.cpp in Sources */, + F9E5A779300E7AD500164066 /* CommandBan.cpp in Sources */, + F9E5A77A300E7AD500164066 /* CommandBan.hpp in Sources */, + F9E5A775300E7AB700164066 /* CommandManager.hpp in Sources */, + F9E5A776300E7AB700164066 /* CommandManager.cpp in Sources */, + F9E5A772300E7A8700164066 /* LevelConstants.cpp in Sources */, + F912B8CF2F6C3D5200BC60DF /* TextBox.h in Sources */, D5CF9C57144C225000E4244F /* main.mm in Sources */, D5CF9C5B144C225000E4244F /* minecraftpeAppDelegate.mm in Sources */, + F99D343C2F736C3B00DC153E /* UsernameScreen.cpp in Sources */, D5CF9C65144C225000E4244F /* EAGLView.m in Sources */, D5CFA01D144C453900E4244F /* minecraftpeViewController.mm in Sources */, D5A55E4914500EDE00A7571B /* CreateNewWorldViewController.mm in Sources */, @@ -5354,6 +5520,7 @@ D5F3B7D014548E7900D25470 /* IASKSettingsStoreUserDefaults.m in Sources */, D5F3B7D114548E7900D25470 /* IASKSpecifier.m in Sources */, D5F3B7D214548E7900D25470 /* IASKPSSliderSpecifierViewCell.m in Sources */, + F99D34472F736FE800DC153E /* KeyOption.cpp in Sources */, D5F3B7D314548E7900D25470 /* IASKPSTextFieldSpecifierViewCell.m in Sources */, D5F3B7D414548E7900D25470 /* IASKPSTitleValueSpecifierViewCell.m in Sources */, D5F3B7D514548E7900D25470 /* IASKPSToggleSwitchSpecifierViewCell.m in Sources */, @@ -5433,6 +5600,7 @@ D5B5102F14CFF670005F7284 /* main.cpp in Sources */, D5B5103514CFF670005F7284 /* Tag.cpp in Sources */, D5B5103714CFF670005F7284 /* ClientSideNetworkHandler.cpp in Sources */, + F99F0FAF2F8436EB00F2B29A /* Color.cpp in Sources */, D5B5103914CFF670005F7284 /* NetEventCallback.cpp in Sources */, D5B5103B14CFF670005F7284 /* Packet.cpp in Sources */, D5B5103D14CFF670005F7284 /* RakNetInstance.cpp in Sources */, @@ -5453,6 +5621,7 @@ D5B5111514CFF670005F7284 /* StringUtils.cpp in Sources */, D5B5111714CFF670005F7284 /* Direction.cpp in Sources */, D5B5111914CFF670005F7284 /* Animal.cpp in Sources */, + F99F0FAD2F8436CE00F2B29A /* FoliageColor.cpp in Sources */, D5B5111B14CFF670005F7284 /* Chicken.cpp in Sources */, D5B5111D14CFF670005F7284 /* Cow.cpp in Sources */, D5B5111F14CFF670005F7284 /* Pig.cpp in Sources */, @@ -5465,11 +5634,13 @@ D5B5112D14CFF670005F7284 /* PrimedTnt.cpp in Sources */, D5B5112F14CFF670005F7284 /* TripodCamera.cpp in Sources */, D5B5113114CFF670005F7284 /* Mob.cpp in Sources */, + F99D34442F736F9400DC153E /* Option.cpp in Sources */, D5B5113314CFF670005F7284 /* MobCategory.cpp in Sources */, D5B5113714CFF670005F7284 /* PathFinderMob.cpp in Sources */, D5B5113914CFF670005F7284 /* Inventory.cpp in Sources */, D5B5113B14CFF670005F7284 /* Player.cpp in Sources */, D5B5113D14CFF670005F7284 /* Arrow.cpp in Sources */, + F99D343F2F736C8400DC153E /* GuiElementContainer.cpp in Sources */, D5B5113F14CFF670005F7284 /* Recipes.cpp in Sources */, D5B5114114CFF670005F7284 /* ToolRecipes.cpp in Sources */, D5B5114314CFF670005F7284 /* WeaponRecipes.cpp in Sources */, @@ -5501,16 +5672,19 @@ D5B5117714CFF670005F7284 /* ExternalFileLevelStorageSource.cpp in Sources */, D5B5117914CFF670005F7284 /* RegionFile.cpp in Sources */, D5B5117B14CFF670005F7284 /* TickNextTickData.cpp in Sources */, + F99F0FAA2F84369F00F2B29A /* GrassColor.cpp in Sources */, D5B5117D14CFF670005F7284 /* DoorTile.cpp in Sources */, D5B5118114CFF670005F7284 /* StoneSlabTile.cpp in Sources */, D5B5118314CFF670005F7284 /* Tile.cpp in Sources */, D5B5118514CFF670005F7284 /* HitResult.cpp in Sources */, D5B5118B14D03342005F7284 /* SynchedEntityData.cpp in Sources */, D5B5118E14DEA27F005F7284 /* DeathScreen.cpp in Sources */, + F99D34242F736AD400DC153E /* TextOption.cpp in Sources */, D5B5119114DEA2B7005F7284 /* LevelData.cpp in Sources */, D5B5119414DEA2EF005F7284 /* DyePowderItem.cpp in Sources */, D584926D14FD234400741128 /* SharedConstants.cpp in Sources */, D584927314FD236700741128 /* MoveControl.cpp in Sources */, + F99D344C2F7370CF00DC153E /* Slider.cpp in Sources */, D584928614FD240D00741128 /* IConfigListener.cpp in Sources */, D584928914FD2FAF00741128 /* Path.cpp in Sources */, D5B86281153810BD00F3238A /* I18n.cpp in Sources */, @@ -5562,6 +5736,7 @@ D5251E011538192700FC82C8 /* NatTypeDetectionServer.cpp in Sources */, D5251E031538192700FC82C8 /* NetworkIDManager.cpp in Sources */, D5251E051538192700FC82C8 /* NetworkIDObject.cpp in Sources */, + F99D34372F736C1000DC153E /* JoinByIPScreen.cpp in Sources */, D5251E071538192700FC82C8 /* PacketConsoleLogger.cpp in Sources */, D5251E091538192700FC82C8 /* PacketFileLogger.cpp in Sources */, D5251E0B1538192700FC82C8 /* PacketizedTCP.cpp in Sources */, @@ -5591,11 +5766,13 @@ D5251E411538192700FC82C8 /* SendToThread.cpp in Sources */, D5251E431538192700FC82C8 /* SHA1.cpp in Sources */, D5251E451538192700FC82C8 /* SignaledEvent.cpp in Sources */, + F99D34342F736BDA00DC153E /* CreditsScreen.cpp in Sources */, D5251E471538192700FC82C8 /* SimpleMutex.cpp in Sources */, D5251E491538192700FC82C8 /* SocketLayer.cpp in Sources */, D5251E4B1538192700FC82C8 /* StringCompressor.cpp in Sources */, D5251E4D1538192700FC82C8 /* StringTable.cpp in Sources */, D5251E4F1538192700FC82C8 /* SuperFastHash.cpp in Sources */, + F99D342B2F736B6F00DC153E /* OptionsItem.cpp in Sources */, D5251E511538192700FC82C8 /* TableSerializer.cpp in Sources */, D5251E531538192700FC82C8 /* TCPInterface.cpp in Sources */, D5251E551538192700FC82C8 /* TeamBalancer.cpp in Sources */, @@ -5618,6 +5795,7 @@ D5951EDD159348C50043A12A /* ItemPane.cpp in Sources */, D5951EE3159349000043A12A /* FurnaceTile.cpp in Sources */, D5951EE8159349100043A12A /* FurnaceTileEntity.cpp in Sources */, + F99D342F2F736BAD00DC153E /* ConsoleScreen.cpp in Sources */, D5951EEA159349100043A12A /* TileEntity.cpp in Sources */, D5951EEE159349680043A12A /* FurnaceScreen.cpp in Sources */, D5951EF115934A2D0043A12A /* Feature.cpp in Sources */, @@ -5654,6 +5832,7 @@ D544941E15D13F45005FA9B0 /* PlayerRenderer.cpp in Sources */, D544942215D13F5E005FA9B0 /* RemotePlayer.cpp in Sources */, D5B17ED515E226F50056E751 /* Throwable.cpp in Sources */, + F99D341F2F736AA100DC153E /* HttpClient.cpp in Sources */, D5B17ED915E2273F0056E751 /* SurvivalMode.cpp in Sources */, D5B17EDD15E227670056E751 /* TrapDoorTile.cpp in Sources */, D5B17EE115E260910056E751 /* MoveFolder.mm in Sources */, @@ -5689,6 +5868,7 @@ 0400453A16A4125C003EB6FA /* FallingTileRenderer.cpp in Sources */, 0413970716A82E1E008A9F1A /* ArmorItem.cpp in Sources */, 0413970D16A82E6B008A9F1A /* CraftingFilters.cpp in Sources */, + F99D34272F736AFB00DC153E /* OptionsFile.cpp in Sources */, 0413970E16A82E6B008A9F1A /* StonecutterScreen.cpp in Sources */, 0413971116A82E7B008A9F1A /* ArmorScreen.cpp in Sources */, 0413971516A82EB9008A9F1A /* ArmorRecipes.cpp in Sources */, @@ -5697,8 +5877,8 @@ 042A91AE16B17517007ABBC6 /* GuiElement.cpp in Sources */, 042A91AF16B17517007ABBC6 /* NinePatch.cpp in Sources */, 042A91B016B17517007ABBC6 /* OptionsGroup.cpp in Sources */, - 042A91B116B17517007ABBC6 /* OptionsPane.cpp in Sources */, 042A91B216B17517007ABBC6 /* TextBox.cpp in Sources */, + BEEF202614CFF670005F0003 /* Lighting.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -5735,25 +5915,29 @@ D50BE20815EE05B8008AA75E /* Ad-Hoc */ = { isa = XCBuildConfiguration; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - ARCHS = "$(ARCHS_UNIVERSAL_IPHONE_OS)"; + ALWAYS_SEARCH_USER_PATHS = YES; + ARCHS = "$(ARCHS_STANDARD)"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution: Mojang AB"; COPY_PHASE_STRIP = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_PREPROCESSOR_DEFINITIONS = PUBLISH; - GCC_VERSION = com.apple.compilers.llvmgcc42; + GCC_VERSION = ""; GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES; GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_HIDDEN_VIRTUAL_FUNCTIONS = NO; GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 4.3; + HEADER_SEARCH_PATHS = "$(SRCROOT)/../../src"; + IPHONEOS_DEPLOYMENT_TARGET = 12; + ONLY_ACTIVE_ARCH = YES; OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; "PROVISIONING_PROFILE[sdk=iphoneos*]" = "C93D3524-5C6F-466E-B12B-833663B7EAE0"; RUN_CLANG_STATIC_ANALYZER = NO; - SDKROOT = iphoneos6.0; + SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; + USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/../../src"; + USE_HEADERMAP = NO; VALIDATE_PRODUCT = YES; }; name = "Ad-Hoc"; @@ -5765,15 +5949,26 @@ GCC_PREFIX_HEADER = "minecraftpe/minecraftpe-Prefix.pch"; GCC_PREPROCESSOR_DEFINITIONS = ""; "GCC_THUMB_SUPPORT[arch=armv7]" = NO; - GCC_VERSION = com.apple.compilers.llvmgcc42; + GCC_VERSION = ""; GCC_WARN_ABOUT_MISSING_PROTOTYPES = NO; - HEADER_SEARCH_PATHS = ""; + HEADER_SEARCH_PATHS = ( + "$(SRCROOT)/../../src", + "$(SRCROOT)/../../src/client/gui/components", + "$(SRCROOT)/../../src/world", + "$(SRCROOT)/../../src/platform/input", + "$(SRCROOT)/../../project/lib_projects/InAppSettingsKit/Views", + ); INFOPLIST_FILE = "minecraftpe/minecraftpe-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 4.3; + INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.games"; + IPHONEOS_DEPLOYMENT_TARGET = 12; + ONLY_ACTIVE_ARCH = YES; + PRODUCT_BUNDLE_IDENTIFIER = "com.mojang.mcpe-arm64"; PRODUCT_NAME = "$(TARGET_NAME)"; RUN_CLANG_STATIC_ANALYZER = NO; - SDKROOT = iphoneos6.0; - VALID_ARCHS = "i386 armv6 armv7"; + SDKROOT = iphoneos; + SYSTEM_HEADER_SEARCH_PATHS = "$(SRCROOT)/../../src $(SRCROOT)/../../src/client/gui/components $(SRCROOT)/../../src/world $(SRCROOT)/../../src/platform/input $(SRCROOT)/../../project/lib_projects/InAppSettingsKit/Views"; + USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/../../src $(SRCROOT)/../lib_projects/InAppSettingsKit/Models $(SRCROOT)/../../src/client/gui/components $(SRCROOT)/../../src/world $(SRCROOT)/../../src/platform/input $(SRCROOT)/../../project/lib_projects/InAppSettingsKit/Views"; + USE_HEADERMAP = NO; WRAPPER_EXTENSION = app; }; name = "Ad-Hoc"; @@ -5846,24 +6041,28 @@ D5A20ADB146AAD9C00A52FEC /* AppStore */ = { isa = XCBuildConfiguration; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - ARCHS = "$(ARCHS_UNIVERSAL_IPHONE_OS)"; + ALWAYS_SEARCH_USER_PATHS = YES; + ARCHS = "$(ARCHS_STANDARD)"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution: Mojang AB"; COPY_PHASE_STRIP = YES; GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_VERSION = com.apple.compilers.llvmgcc42; + GCC_VERSION = ""; GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES; GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_HIDDEN_VIRTUAL_FUNCTIONS = NO; GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 4.3; + HEADER_SEARCH_PATHS = "$(SRCROOT)/../../src"; + IPHONEOS_DEPLOYMENT_TARGET = 12; + ONLY_ACTIVE_ARCH = YES; OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; "PROVISIONING_PROFILE[sdk=iphoneos*]" = "64BA8967-1A9A-4980-972C-42E75AD5E023"; RUN_CLANG_STATIC_ANALYZER = NO; - SDKROOT = iphoneos6.0; + SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; + USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/../../src"; + USE_HEADERMAP = NO; VALIDATE_PRODUCT = YES; }; name = AppStore; @@ -5876,11 +6075,19 @@ GCC_PREFIX_HEADER = "minecraftpe/minecraftpe-Prefix.pch"; GCC_PREPROCESSOR_DEFINITIONS = PUBLISH; "GCC_THUMB_SUPPORT[arch=armv7]" = NO; - GCC_VERSION = com.apple.compilers.llvmgcc42; + GCC_VERSION = ""; GCC_WARN_ABOUT_MISSING_PROTOTYPES = NO; - HEADER_SEARCH_PATHS = ""; + HEADER_SEARCH_PATHS = ( + "$(SRCROOT)/../../src", + "$(SRCROOT)/../../src/client/gui/components", + "$(SRCROOT)/../../src/world", + "$(SRCROOT)/../../src/platform/input", + "$(SRCROOT)/../../project/lib_projects/InAppSettingsKit/Views", + ); INFOPLIST_FILE = "minecraftpe/minecraftpe-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 4.3; + INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.games"; + IPHONEOS_DEPLOYMENT_TARGET = 12; + ONLY_ACTIVE_ARCH = YES; OTHER_CFLAGS = ( "-DNS_BLOCK_ASSERTIONS=1", "-DANDROID_PUBLISH", @@ -5888,8 +6095,10 @@ PRODUCT_NAME = "$(TARGET_NAME)"; "PROVISIONING_PROFILE[sdk=iphoneos*]" = "1B194957-98CF-49B7-A0E7-76692B4B722D"; RUN_CLANG_STATIC_ANALYZER = NO; - SDKROOT = iphoneos6.0; - VALID_ARCHS = "i386 armv6 armv7"; + SDKROOT = iphoneos; + SYSTEM_HEADER_SEARCH_PATHS = "$(SRCROOT)/../../src $(SRCROOT)/../../src/client/gui/components $(SRCROOT)/../../src/world $(SRCROOT)/../../src/platform/input $(SRCROOT)/../../project/lib_projects/InAppSettingsKit/Views"; + USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/../../src $(SRCROOT)/../lib_projects/InAppSettingsKit/Models $(SRCROOT)/../../src/client/gui/components $(SRCROOT)/../../src/world $(SRCROOT)/../../src/platform/input $(SRCROOT)/../../project/lib_projects/InAppSettingsKit/Views"; + USE_HEADERMAP = NO; WRAPPER_EXTENSION = app; }; name = AppStore; @@ -5922,8 +6131,8 @@ D5CF9C6C144C225000E4244F /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - ARCHS = "$(ARCHS_UNIVERSAL_IPHONE_OS)"; + ALWAYS_SEARCH_USER_PATHS = YES; + ARCHS = "$(ARCHS_STANDARD)"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; GCC_C_LANGUAGE_STANDARD = gnu99; @@ -5935,41 +6144,50 @@ "$(inherited)", ); GCC_SYMBOLS_PRIVATE_EXTERN = NO; - GCC_VERSION = com.apple.compilers.llvmgcc42; + GCC_VERSION = ""; GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES; GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_HIDDEN_VIRTUAL_FUNCTIONS = NO; GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 4.3; + HEADER_SEARCH_PATHS = "$(SRCROOT)/../../src"; + IPHONEOS_DEPLOYMENT_TARGET = 12; + ONLY_ACTIVE_ARCH = YES; RUN_CLANG_STATIC_ANALYZER = NO; - SDKROOT = iphoneos6.0; + SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; + USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/../../src"; + USE_HEADERMAP = NO; + VALIDATE_PRODUCT = YES; }; name = Debug; }; D5CF9C6D144C225000E4244F /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - ARCHS = "$(ARCHS_UNIVERSAL_IPHONE_OS)"; + ALWAYS_SEARCH_USER_PATHS = YES; + ARCHS = "$(ARCHS_STANDARD)"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_PREPROCESSOR_DEFINITIONS = PUBLISH; - GCC_VERSION = com.apple.compilers.llvmgcc42; + GCC_VERSION = ""; GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES; GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_HIDDEN_VIRTUAL_FUNCTIONS = NO; GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 4.3; + HEADER_SEARCH_PATHS = "$(SRCROOT)/../../src"; + IPHONEOS_DEPLOYMENT_TARGET = 12; + ONLY_ACTIVE_ARCH = YES; OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; RUN_CLANG_STATIC_ANALYZER = NO; - SDKROOT = iphoneos6.0; + SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; + USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/../../src"; + USE_HEADERMAP = NO; VALIDATE_PRODUCT = YES; }; name = Release; @@ -5977,19 +6195,34 @@ D5CF9C6F144C225000E4244F /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + CODE_SIGN_IDENTITY = "Apple Development"; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = PZUVNW8F2U; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "minecraftpe/minecraftpe-Prefix.pch"; GCC_PREPROCESSOR_DEFINITIONS = "DEBUG=1"; "GCC_THUMB_SUPPORT[arch=armv7]" = NO; - GCC_VERSION = com.apple.compilers.llvmgcc42; + GCC_VERSION = ""; GCC_WARN_ABOUT_MISSING_PROTOTYPES = NO; - HEADER_SEARCH_PATHS = ""; + HEADER_SEARCH_PATHS = ( + "$(SRCROOT)/../../src", + "$(SRCROOT)/../../src/client/gui/components", + "$(SRCROOT)/../../src/world", + "$(SRCROOT)/../../src/platform/input", + "$(SRCROOT)/../../project/lib_projects/InAppSettingsKit/Views", + ); INFOPLIST_FILE = "minecraftpe/minecraftpe-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 4.3; + INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.games"; + IPHONEOS_DEPLOYMENT_TARGET = 12; + ONLY_ACTIVE_ARCH = YES; + PRODUCT_BUNDLE_IDENTIFIER = "com.mojang.mcpe-arm64"; PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = ""; RUN_CLANG_STATIC_ANALYZER = NO; - SDKROOT = iphoneos6.0; - VALID_ARCHS = "i386 armv6 armv7"; + SDKROOT = iphoneos; + SYSTEM_HEADER_SEARCH_PATHS = "$(SRCROOT)/../../src $(SRCROOT)/../../src/client/gui/components $(SRCROOT)/../../src/world $(SRCROOT)/../../src/platform/input $(SRCROOT)/../../project/lib_projects/InAppSettingsKit/Views"; + USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/../../src $(SRCROOT)/../lib_projects/InAppSettingsKit/Models $(SRCROOT)/../../src/client/gui/components $(SRCROOT)/../../src/world $(SRCROOT)/../../src/platform/input $(SRCROOT)/../../project/lib_projects/InAppSettingsKit/Views"; + USE_HEADERMAP = NO; WRAPPER_EXTENSION = app; }; name = Debug; @@ -5997,19 +6230,34 @@ D5CF9C70144C225000E4244F /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + CODE_SIGN_IDENTITY = "Apple Development"; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = PZUVNW8F2U; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "minecraftpe/minecraftpe-Prefix.pch"; GCC_PREPROCESSOR_DEFINITIONS = ""; "GCC_THUMB_SUPPORT[arch=armv7]" = NO; - GCC_VERSION = com.apple.compilers.llvmgcc42; + GCC_VERSION = ""; GCC_WARN_ABOUT_MISSING_PROTOTYPES = NO; - HEADER_SEARCH_PATHS = ""; + HEADER_SEARCH_PATHS = ( + "$(SRCROOT)/../../src", + "$(SRCROOT)/../../src/client/gui/components", + "$(SRCROOT)/../../src/world", + "$(SRCROOT)/../../src/platform/input", + "$(SRCROOT)/../../project/lib_projects/InAppSettingsKit/Views", + ); INFOPLIST_FILE = "minecraftpe/minecraftpe-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 4.3; + INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.games"; + IPHONEOS_DEPLOYMENT_TARGET = 12; + ONLY_ACTIVE_ARCH = YES; + PRODUCT_BUNDLE_IDENTIFIER = "com.mojang.mcpe-arm64"; PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = ""; RUN_CLANG_STATIC_ANALYZER = NO; - SDKROOT = iphoneos6.0; - VALID_ARCHS = "i386 armv6 armv7"; + SDKROOT = iphoneos; + SYSTEM_HEADER_SEARCH_PATHS = "$(SRCROOT)/../../src $(SRCROOT)/../../src/client/gui/components $(SRCROOT)/../../src/world $(SRCROOT)/../../src/platform/input $(SRCROOT)/../../project/lib_projects/InAppSettingsKit/Views"; + USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/../../src $(SRCROOT)/../lib_projects/InAppSettingsKit/Models $(SRCROOT)/../../src/client/gui/components $(SRCROOT)/../../src/world $(SRCROOT)/../../src/platform/input $(SRCROOT)/../../project/lib_projects/InAppSettingsKit/Views"; + USE_HEADERMAP = NO; WRAPPER_EXTENSION = app; }; name = Release; diff --git a/project/iosproj/minecraftpe/minecraftpe-Info.plist b/project/iosproj/minecraftpe/minecraftpe-Info.plist index 30bd23f..b0ae914 100755 --- a/project/iosproj/minecraftpe/minecraftpe-Info.plist +++ b/project/iosproj/minecraftpe/minecraftpe-Info.plist @@ -37,7 +37,7 @@ CFBundleIdentifier - com.mojang.${PRODUCT_NAME:rfc1034identifier} + $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName @@ -58,6 +58,8 @@ minecraft.ttf + UILaunchStoryboardName + Launch Screen UIPrerenderedIcon UIRequiresPersistentWiFi diff --git a/project/lib_projects/raknet/jni/Android.mk b/project/lib_projects/raknet/jni/Android.mk index 4be2d71..f50b99a 100755 --- a/project/lib_projects/raknet/jni/Android.mk +++ b/project/lib_projects/raknet/jni/Android.mk @@ -4,10 +4,11 @@ include $(CLEAR_VARS) LOCAL_MODULE := RakNet -MY_PREFIX := $(LOCAL_PATH)/RakNetSources/ +MY_PREFIX := $(LOCAL_PATH)/RaknetSources/ MY_SOURCES := $(wildcard $(MY_PREFIX)*.cpp) -LOCAL_SRC_FILES += $(MY_SOURCES:$(MY_PREFIX)%=RakNetSources/%) +LOCAL_SRC_FILES += $(MY_SOURCES:$(MY_PREFIX)%=RaknetSources/%) LOCAL_CFLAGS := -Wno-psabi $(LOCAL_CFLAGS) +LOCAL_CPPFLAGS += -frtti include $(BUILD_STATIC_LIBRARY) diff --git a/project/lib_projects/raknet/jni/RaknetSources/FileList.cpp b/project/lib_projects/raknet/jni/RaknetSources/FileList.cpp index f4345c2..0825ca0 100755 --- a/project/lib_projects/raknet/jni/RaknetSources/FileList.cpp +++ b/project/lib_projects/raknet/jni/RaknetSources/FileList.cpp @@ -5,13 +5,13 @@ #include // RAKNET_DEBUG_PRINTF #include "RakAssert.h" #if defined(ANDROID) -#include +// not needed and unavailable on arm64 #elif defined(_WIN32) || defined(__CYGWIN__) #include -#elif !defined ( __APPLE__ ) && !defined ( __APPLE_CC__ ) && !defined ( __PPC__ ) && !defined ( __FreeBSD__ ) && !defined ( __S3E__ ) -#include +// #elif !defined ( __APPLE__ ) && !defined ( __APPLE_CC__ ) && !defined ( __PPC__ ) && !defined ( __FreeBSD__ ) && !defined ( __S3E__ ) +// #include #endif diff --git a/project/lib_projects/raknet/jni/RaknetSources/GetTime.cpp b/project/lib_projects/raknet/jni/RaknetSources/GetTime.cpp index 4f868f8..effd244 100755 --- a/project/lib_projects/raknet/jni/RaknetSources/GetTime.cpp +++ b/project/lib_projects/raknet/jni/RaknetSources/GetTime.cpp @@ -140,7 +140,7 @@ RakNet::TimeUS GetTimeUS_Windows( void ) #if _MSC_VER >= 1400 && defined (_M_X64) GetProcessAffinityMask(mProc, (PDWORD_PTR)&mProcMask, (PDWORD_PTR)&mSysMask); #else - GetProcessAffinityMask(mProc, &mProcMask, &mSysMask); + GetProcessAffinityMask(mProc, (PDWORD_PTR)&mProcMask, (PDWORD_PTR)&mSysMask); #endif mThread = GetCurrentThread(); diff --git a/project/lib_projects/raknet/jni/RaknetSources/RakPeer.cpp b/project/lib_projects/raknet/jni/RaknetSources/RakPeer.cpp index 698374e..a24a2b5 100755 --- a/project/lib_projects/raknet/jni/RaknetSources/RakPeer.cpp +++ b/project/lib_projects/raknet/jni/RaknetSources/RakPeer.cpp @@ -124,7 +124,7 @@ static const unsigned int MAX_OFFLINE_DATA_LENGTH=400; // I set this because I l #pragma warning(disable:4309) // 'initializing' : truncation of constant value #endif // Make sure highest bit is 0, so isValid in DatagramHeaderFormat is false -static const char OFFLINE_MESSAGE_DATA_ID[16]={0x00,0xFF,0xFF,0x00,0xFE,0xFE,0xFE,0xFE,0xFD,0xFD,0xFD,0xFD,0x12,0x34,0x56,0x78}; +static const unsigned char OFFLINE_MESSAGE_DATA_ID[16]={0x00,0xFF,0xFF,0x00,0xFE,0xFE,0xFE,0xFE,0xFD,0xFD,0xFD,0xFD,0x12,0x34,0x56,0x78}; struct PacketFollowedByData { diff --git a/project/lib_projects/raknet/jni/RaknetSources/WindowsIncludes.h b/project/lib_projects/raknet/jni/RaknetSources/WindowsIncludes.h index 7e504dc..828614c 100755 --- a/project/lib_projects/raknet/jni/RaknetSources/WindowsIncludes.h +++ b/project/lib_projects/raknet/jni/RaknetSources/WindowsIncludes.h @@ -1,8 +1,8 @@ #if defined(X360__) #elif defined (_WIN32) -#include +#include #include -#include +#include // Must always include Winsock2.h before windows.h // or else: diff --git a/src/AppPlatform.h b/src/AppPlatform.h index 60d5d96..d52118a 100755 --- a/src/AppPlatform.h +++ b/src/AppPlatform.h @@ -71,8 +71,11 @@ public: virtual void saveScreenshot(const std::string& filename, int glWidth, int glHeight) {} virtual TextureData loadTexture(const std::string& filename_, bool textureFolder) { return TextureData(); } + virtual TextureData loadTextureFromMemory(const unsigned char* data, size_t size) { return TextureData(); } virtual void playSound(const std::string& fn, float volume, float pitch) {} + + virtual void hideCursor(bool hide) {} virtual void showDialog(int dialogId) {} virtual void createUserInput() {} @@ -96,9 +99,6 @@ public: virtual std::string getDateString(int s) { return ""; } //virtual void createUserInputScreen(const char* types) {} - virtual int checkLicense() { return 0; } - virtual bool hasBuyButtonWhenInvalidLicense() { return false; } - virtual void uploadPlatformDependentData(int id, void* data) {} virtual BinaryBlob readAssetFile(const std::string& filename) { return BinaryBlob(); } virtual void _tick() {} @@ -117,7 +117,7 @@ public: virtual bool isSuperFast() = 0; #endif - virtual void buyGame() {} + virtual void openURL(const std::string& url) {} virtual void finish() {} diff --git a/src/AppPlatform_android.h b/src/AppPlatform_android.h index 54304dd..9f3a7cf 100755 --- a/src/AppPlatform_android.h +++ b/src/AppPlatform_android.h @@ -68,9 +68,6 @@ public: _methodGetDateString(0), - _methodCheckLicense(0), - _methodHasBuyButton(0), - _methodBuyGame(0), _methodVibrate(0), _methodSupportsTouchscreen(0), _methodSetIsPowerVR(0), @@ -104,6 +101,7 @@ public: int getScreenWidth() { return _screenWidth; } int getScreenHeight() { return _screenHeight; } + void setScreenDimensions(int w, int h) { _screenWidth = w; _screenHeight = h; } // Note, this has to be called from the main thread (e.g. do it from JNI_onLoad) // Somewhere between calling this, and calling the AppPlatform methods, @@ -146,10 +144,6 @@ public: _methodGetDateString = env->GetMethodID( _activityClass, "getDateString", "(I)Ljava/lang/String;"); - _methodCheckLicense = env->GetMethodID( _activityClass, "checkLicense", "()I"); - _methodHasBuyButton = env->GetMethodID( _activityClass, "hasBuyButtonWhenInvalidLicense", "()Z"); - _methodBuyGame = env->GetMethodID( _activityClass, "buyGame", "()V"); - _methodVibrate = env->GetMethodID( _activityClass, "vibrate", "(I)V"); _methodSupportsTouchscreen = env->GetMethodID( _activityClass, "supportsTouchscreen", "()Z"); _methodSetIsPowerVR = env->GetMethodID( _activityClass, "setIsPowerVR", "(Z)V"); @@ -157,6 +151,8 @@ public: _methodGetPixelsPerMillimeter = env->GetMethodID( _activityClass, "getPixelsPerMillimeter", "()F"); _methodGetPlatformStringVar = env->GetMethodID( _activityClass, "getPlatformStringVar", "(I)Ljava/lang/String;"); + // custom helper to launch external URLs + _methodOpenURL = env->GetMethodID(_activityClass, "openURL", "(Ljava/lang/String;)V"); _classWindow = (jclass)env->NewGlobalRef(env->FindClass("android/view/Window")); _classContext = (jclass)env->NewGlobalRef(env->FindClass("android/content/Context")); @@ -192,14 +188,22 @@ public: // be rewritten later on anyway int initConsts() { + LOGI("initConsts: start\n"); JVMAttacher ta(_vm); JNIEnv* env = ta.getEnv(); + LOGI("initConsts: getting method IDs\n"); jmethodID fWidth = env->GetMethodID( _activityClass, "getScreenWidth", "()I"); + LOGI("initConsts: got fWidth=%p\n", fWidth); jmethodID fHeight = env->GetMethodID( _activityClass, "getScreenHeight", "()I"); + LOGI("initConsts: got fHeight=%p, calling getScreenWidth\n", fHeight); _screenWidth = env->CallIntMethod(instance, fWidth); + LOGI("initConsts: screenWidth=%d, calling getScreenHeight\n", _screenWidth); _screenHeight = env->CallIntMethod(instance, fHeight); + LOGI("initConsts: screenHeight=%d, done\n", _screenHeight); + + return 1; } void tick() { @@ -376,8 +380,9 @@ public: JVMAttacher ta(_vm); JNIEnv* env = ta.getEnv(); + std::string path = textureFolder ? "images/" + filename : filename; jintArray arr = (jintArray)env->CallObjectMethod( - instance, _getImageData, env->NewStringUTF(filename.c_str())); + instance, _getImageData, env->NewStringUTF(path.c_str())); if (!arr) return TextureData(); @@ -464,37 +469,15 @@ public: env->ReleaseStringUTFChars(stringVar, str); return out; } - - int checkLicense() { - if (!_isInited) return -2; - if (!_methodCheckLicense) return -2; - - JVMAttacher ta(_vm); - JNIEnv* env = ta.getEnv(); - - return env->CallIntMethod(instance, _methodCheckLicense); - } - - bool hasBuyButtonWhenInvalidLicense() { - if (!_isInited) return false; - if (!_methodHasBuyButton) return false; - - JVMAttacher ta(_vm); - JNIEnv* env = ta.getEnv(); - - return JNI_TRUE == env->CallBooleanMethod(instance, _methodHasBuyButton); - } - - void buyGame() { - if (!_isInited) return; - if (!_methodBuyGame) return; - - JVMAttacher ta(_vm); - JNIEnv* env = ta.getEnv(); - - env->CallVoidMethod(instance, _methodBuyGame); - } - + // Opens a webpage using an Android intent. Called from native code. + virtual void openURL(const std::string& url) { + if (!_isInited || !_methodOpenURL) return; + JVMAttacher ta(_vm); + JNIEnv* env = ta.getEnv(); + jstring jurl = env->NewStringUTF(url.c_str()); + env->CallVoidMethod(instance, _methodOpenURL, jurl); + env->DeleteLocalRef(jurl); + } virtual void finish() { if (!_isInited) return; if (!_methodFinish) return; @@ -555,7 +538,7 @@ public: static __inline bool isSquare(int n) { int L = n & 0xf; - if ((1 << L) & 0x213 == 0) return false; + if (((1 << L) & 0x213) == 0) return false; int t = (int) sqrt((double) n) + 0.5; return t*t == n; @@ -636,10 +619,6 @@ private: jmethodID _methodGetDateString; - jmethodID _methodCheckLicense; - jmethodID _methodHasBuyButton; - jmethodID _methodBuyGame; - jmethodID _getScreenWidth; jmethodID _getScreenHeight; jmethodID _methodGetPixelsPerMillimeter; @@ -649,6 +628,7 @@ private: jmethodID _methodIsNetworkEnabled; jmethodID _methodGetPlatformStringVar; + jmethodID _methodOpenURL; // new JNI method for launching browser jclass _classWindow; jclass _classContext; diff --git a/src/AppPlatform_glfw.cpp b/src/AppPlatform_glfw.cpp old mode 100755 new mode 100644 diff --git a/src/AppPlatform_glfw.h b/src/AppPlatform_glfw.h index a9c5b3e..d996860 100755 --- a/src/AppPlatform_glfw.h +++ b/src/AppPlatform_glfw.h @@ -3,6 +3,8 @@ #include "AppPlatform.h" #include "platform/log.h" +#include "platform/HttpClient.h" +#include "platform/PngLoader.h" #include "client/renderer/gles.h" #include "world/level/storage/FolderMethods.h" #include @@ -10,6 +12,17 @@ #include #include #include +#include +#include "util/StringUtils.h" + +#ifdef _WIN32 +#include +#include +#endif + +#ifdef __EMSCRIPTEN__ + #include +#endif static void png_funcReadFile(png_structp pngPtr, png_bytep data, png_size_t length) { ((std::istream*)png_get_io_ptr(pngPtr))->read((char*)data, length); @@ -22,7 +35,7 @@ public: { } - BinaryBlob readAssetFile(const std::string& filename) { + BinaryBlob readAssetFile(const std::string& filename) override { FILE* fp = fopen(("data/" + filename).c_str(), "r"); if (!fp) return BinaryBlob(); @@ -39,7 +52,7 @@ public: return blob; } - void saveScreenshot(const std::string& filename, int glWidth, int glHeight) { + void saveScreenshot(const std::string& filename, int glWidth, int glHeight) override { //@todo } @@ -47,83 +60,96 @@ public: return (p & 0xff00ff00) | ((p >> 16) & 0xff) | ((p << 16) & 0xff0000); } - TextureData loadTexture(const std::string& filename_, bool textureFolder) + TextureData loadTexture(const std::string& filename_, bool textureFolder) override { + // Support fetching PNG textures via HTTP/HTTPS (for skins, etc) + if (Util::startsWith(filename_, "http://") || Util::startsWith(filename_, "https://")) { + std::vector body; + if (HttpClient::download(filename_, body) && !body.empty()) { + return loadTextureFromMemory(body.data(), body.size()); + } + return TextureData(); + } + TextureData out; std::string filename = textureFolder? "data/images/" + filename_ - : filename_; + : filename_; std::ifstream source(filename.c_str(), std::ios::binary); - if (source) { - png_structp pngPtr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); - - if (!pngPtr) - return out; - - png_infop infoPtr = png_create_info_struct(pngPtr); - - if (!infoPtr) { - png_destroy_read_struct(&pngPtr, NULL, NULL); - return out; - } - - // Hack to get around the broken libpng for windows - png_set_read_fn(pngPtr,(void*)&source, png_funcReadFile); - - png_read_info(pngPtr, infoPtr); - - // Set up the texdata properties - out.w = png_get_image_width(pngPtr, infoPtr); - out.h = png_get_image_height(pngPtr, infoPtr); - - png_bytep* rowPtrs = new png_bytep[out.h]; - out.data = new unsigned char[4 * out.w * out.h]; - out.memoryHandledExternally = false; - - int rowStrideBytes = 4 * out.w; - for (int i = 0; i < out.h; i++) { - rowPtrs[i] = (png_bytep)&out.data[i*rowStrideBytes]; - } - png_read_image(pngPtr, rowPtrs); - - // Teardown and return - png_destroy_read_struct(&pngPtr, &infoPtr,(png_infopp)0); - delete[] (png_bytep)rowPtrs; - source.close(); - - return out; - } - else - { + if (!source) { LOGI("Couldn't find file: %s\n", filename.c_str()); return out; } + + std::vector fileData((std::istreambuf_iterator(source)), std::istreambuf_iterator()); + source.close(); + + if (fileData.empty()) { + LOGI("Couldn't read file: %s\n", filename.c_str()); + return out; + } + + return loadTextureFromMemory(fileData.data(), fileData.size()); } - std::string getDateString(int s) { - std::stringstream ss; - ss << s << " s (UTC)"; - return ss.str(); + TextureData loadTextureFromMemory(const unsigned char* data, size_t size) override { + return loadPngFromMemory(data, size); } - virtual int checkLicense() { - static int _z = 0;//20; - _z--; - if (_z < 0) return 0; - //if (_z < 0) return 107; - return -2; + virtual std::string getDateString(int s) override { + time_t tm = s; + + char mbstr[100]; + std::strftime(mbstr, sizeof(mbstr), "%F %T", std::localtime(&tm)); + + return std::string(mbstr); } - virtual int getScreenWidth() { return 854; }; - virtual int getScreenHeight() { return 480; }; + virtual int getScreenWidth() override { + #ifdef __EMSCRIPTEN__ + int w, h; + emscripten_get_canvas_element_size("canvas", &w, &h); - virtual float getPixelsPerMillimeter(); + return w; + #endif - virtual bool supportsTouchscreen() { return true; } - virtual bool hasBuyButtonWhenInvalidLicense() { return false; } + return 854; + }; + + virtual int getScreenHeight() override { + #ifdef __EMSCRIPTEN__ + int w, h; + emscripten_get_canvas_element_size("canvas", &w, &h); + + return h; + #endif + + return 480; + }; + + virtual float getPixelsPerMillimeter() override; + + virtual bool supportsTouchscreen() override { return false; /* glfw supports only mouse and keyboard */ } + + virtual void hideCursor(bool hide) override { + int isHide = hide ? GLFW_CURSOR_NORMAL : GLFW_CURSOR_HIDDEN; + glfwSetInputMode(window, GLFW_CURSOR, isHide); + } + + virtual void openURL(const std::string& url) override { +#ifdef _WIN32 + ShellExecuteA(NULL, "open", url.c_str(), NULL, NULL, SW_SHOWNORMAL); +#elif __linux__ + std::string command = "xdg-open " + url; + system(command.c_str()); +#elif __EMSCRIPTEN__ + emscripten_run_script(std::string("window.open('" + url + "', '_blank')").c_str()); +#endif + } + + GLFWwindow* window; private: }; - #endif /*APPPLATFORM_GLFW_H__*/ diff --git a/src/AppPlatform_iOS.h b/src/AppPlatform_iOS.h index b43817e..a2206b6 100755 --- a/src/AppPlatform_iOS.h +++ b/src/AppPlatform_iOS.h @@ -41,17 +41,6 @@ public: std::string getDateString(int s); - virtual int checkLicense() { - return 0; - static int _z = 20; - _z--; - if (_z < 0) return 0; - //if (_z < 0) return 107; - return -2; - } - - virtual void buyGame(); - virtual int getScreenWidth(); virtual int getScreenHeight(); virtual float getPixelsPerMillimeter(); @@ -63,11 +52,10 @@ public: virtual StringVector getOptionStrings(); - virtual bool isPowerVR() { return false; } + virtual bool isPowerVR(); virtual bool isSuperFast(); virtual void showKeyboard(); virtual void hideKeyboard(); - virtual void isPowerVR(); private: std::string _basePath; diff --git a/src/AppPlatform_iOS.mm b/src/AppPlatform_iOS.mm index 696539c..a98fc76 100755 --- a/src/AppPlatform_iOS.mm +++ b/src/AppPlatform_iOS.mm @@ -175,10 +175,6 @@ BinaryBlob AppPlatform_iOS::readAssetFile(const std::string& filename_) { return BinaryBlob(bytes, numBytes); } -void AppPlatform_iOS::buyGame() { - [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://phobos.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=479516143&mt=8"]]; -} - std::string AppPlatform_iOS::getDateString(int s) { NSDate* date = [NSDate dateWithTimeIntervalSince1970:s]; @@ -279,8 +275,10 @@ void AppPlatform_iOS::hideKeyboard() { [_viewController hideKeyboard]; super::hideKeyboard(); } -void AppPlatform_iOS::isPowerVR() { + +// this was originally void but i changed it to bool because void cant return values +bool AppPlatform_iOS::isPowerVR() { const char* s = (const char*)glGetString(GL_RENDERER); if (!s) return false; return strstr(s, "SGX") != NULL; -} \ No newline at end of file +} diff --git a/src/AppPlatform_win32.cpp b/src/AppPlatform_win32.cpp index 13df325..f193e7c 100755 --- a/src/AppPlatform_win32.cpp +++ b/src/AppPlatform_win32.cpp @@ -14,4 +14,3 @@ float AppPlatform_win32::getPixelsPerMillimeter() { } bool AppPlatform_win32::supportsTouchscreen() { return true; } -bool AppPlatform_win32::hasBuyButtonWhenInvalidLicense() { return true; } diff --git a/src/AppPlatform_win32.h b/src/AppPlatform_win32.h index 8faca4a..c3623b3 100755 --- a/src/AppPlatform_win32.h +++ b/src/AppPlatform_win32.h @@ -3,12 +3,17 @@ #include "AppPlatform.h" #include "platform/log.h" +#include "platform/HttpClient.h" +#include "platform/PngLoader.h" #include "client/renderer/gles.h" #include "world/level/storage/FolderMethods.h" +#include "util/StringUtils.h" #include #include #include #include +#include +#include static void png_funcReadFile(png_structp pngPtr, png_bytep data, png_size_t length) { ((std::istream*)png_get_io_ptr(pngPtr))->read((char*)data, length); @@ -48,10 +53,19 @@ public: TextureData loadTexture(const std::string& filename_, bool textureFolder) { + // Support fetching PNG textures via HTTP/HTTPS (for skins, etc). + if (Util::startsWith(filename_, "http://") || Util::startsWith(filename_, "https://")) { + std::vector body; + if (HttpClient::download(filename_, body) && !body.empty()) { + return loadTextureFromMemory(body.data(), body.size()); + } + return TextureData(); + } + TextureData out; std::string filename = textureFolder? "data/images/" + filename_ - : filename_; + : filename_; std::ifstream source(filename.c_str(), std::ios::binary); if (source) { @@ -100,18 +114,15 @@ public: } } - std::string getDateString(int s) { - std::stringstream ss; - ss << s << " s (UTC)"; - return ss.str(); + TextureData loadTextureFromMemory(const unsigned char* data, size_t size) override { + return loadPngFromMemory(data, size); } + time_t tm = s; - virtual int checkLicense() { - static int _z = 0;//20; - _z--; - if (_z < 0) return 0; - //if (_z < 0) return 107; - return -2; + char mbstr[100]; + std::strftime(mbstr, sizeof(mbstr), "%F %T", std::localtime(&tm)); + + return std::string(mbstr); } virtual int getScreenWidth(); @@ -120,7 +131,10 @@ public: virtual float getPixelsPerMillimeter(); virtual bool supportsTouchscreen(); - virtual bool hasBuyButtonWhenInvalidLicense(); + + virtual void openURL(const std::string& url) { + ShellExecuteA(NULL, "open", url.c_str(), NULL, NULL, SW_SHOWNORMAL); + } private: }; diff --git a/src/NinecraftApp.cpp b/src/NinecraftApp.cpp index cdc24d8..60e9fee 100755 --- a/src/NinecraftApp.cpp +++ b/src/NinecraftApp.cpp @@ -18,6 +18,7 @@ //#include "world/level/storage/FolderMethods.h" #ifndef STANDALONE_SERVER #include "client/gui/screens/StartMenuScreen.h" +#include "client/gui/screens/UsernameScreen.h" #endif #include "client/player/LocalPlayer.h" #ifndef STANDALONE_SERVER @@ -98,6 +99,9 @@ void NinecraftApp::init() I18n::loadLanguage(platform(), "en_US"); #endif + if (!externalStoragePath.empty()) { + options.setOptionsFilePath(externalStoragePath); + } Minecraft::init(); #if !defined(DEMO_MODE) && !defined(APPLE_DEMO_PROMOTION) && !defined(NO_STORAGE) @@ -110,8 +114,12 @@ void NinecraftApp::init() #ifndef STANDALONE_SERVER LOGI("This: %p\n", this); screenChooser.setScreen(SCREEN_STARTMENU); + + if (options.getBooleanValue(OPTIONS_FIRST_LAUNCH)) { + options.toggle(OPTIONS_FIRST_LAUNCH); + setScreen(new UsernameScreen()); + } #else - user->name = "Server"; hostMultiplayer(); #endif } @@ -128,7 +136,7 @@ void NinecraftApp::teardown() Recipes ::teardownRecipes(); TileEntity::teardownTileEntities(); #endif -#ifdef WIN32 +#if defined(WIN32) && !defined(STANDALONE_SERVER) ItemRenderer::teardown_static(); if (EntityTileRenderer::instance != NULL) { delete EntityTileRenderer::instance; @@ -240,8 +248,9 @@ void NinecraftApp::initGLStates() glCullFace(GL_BACK); glEnable2(GL_TEXTURE_2D); +#ifndef _EMSCRIPTEN_ glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST); - +#endif // Both updates isPowerVR flag in java and returns if the graphics chip is PowerVR SGX or not _powerVr = platform()->isPowerVR(); #ifdef __APPLE__ diff --git a/src/SharedConstants.cpp b/src/SharedConstants.cpp index 676cc0b..ee64aa9 100755 --- a/src/SharedConstants.cpp +++ b/src/SharedConstants.cpp @@ -4,7 +4,12 @@ namespace Common { std::string getGameVersionString(const std::string& versionSuffix /* = "" */) { - return std::string("v0.6.1") + versionSuffix + " alpha"; + std::string result = std::string("v0.1.0 (forked from v0.6.1 alpha)") + versionSuffix; + // append 64-bit port marker only on Android 64‑bit targets + #if defined(ANDROID) && (defined(__aarch64__) || defined(__x86_64__)) + result += " (64-bit)"; + #endif + return result; } }; diff --git a/src/client/KeyMapping.h b/src/client/KeyMapping.h old mode 100755 new mode 100644 diff --git a/src/client/Minecraft.cpp b/src/client/Minecraft.cpp index 0ead6b6..ded2191 100755 --- a/src/client/Minecraft.cpp +++ b/src/client/Minecraft.cpp @@ -1,95 +1,52 @@ #include "Minecraft.h" +#include "Options.h" +#include "client/Options.h" #include "client/player/input/IBuildInput.h" +#include "commands/CommandManager.hpp" +#include "platform/input/Keyboard.h" +#include "world/item/Item.h" +#include "world/item/ItemInstance.h" +#include +#include + #if defined(APPLE_DEMO_PROMOTION) - #define NO_NETWORK +#define NO_NETWORK #endif #if defined(RPI) - #define CREATORMODE +#define CREATORMODE #endif - #include "../network/RakNetInstance.h" #include "../network/ClientSideNetworkHandler.h" #include "../network/ServerSideNetworkHandler.h" //#include "../network/Packet.h" #include "../world/entity/player/Inventory.h" -#include "../world/level/chunk/ChunkCache.h" #include "../world/level/tile/Tile.h" #include "../world/level/storage/LevelStorageSource.h" #include "../world/level/storage/LevelStorage.h" #include "player/input/KeyboardInput.h" +#include "player/input/ControllerTurnInput.h" +#include "player/input/XperiaPlayInput.h" +#include "world/level/chunk/ChunkSource.h" + #ifndef STANDALONE_SERVER #include "player/input/touchscreen/TouchInputHolder.h" -#endif -#include "player/LocalPlayer.h" -#include "gamemode/CreativeMode.h" -#include "gamemode/SurvivalMode.h" -#include "player/LocalPlayer.h" -#ifndef STANDALONE_SERVER #include "particle/ParticleEngine.h" #include "gui/Screen.h" #include "gui/Font.h" #include "gui/screens/RenameMPLevelScreen.h" +#include "gui/screens/ConsoleScreen.h" +#include "gui/screens/ChatScreen.h" #include "sound/SoundEngine.h" -#endif -#include "../platform/CThread.h" -#include "../platform/input/Mouse.h" -#include "../AppPlatform.h" -#include "../Performance.h" -#include "../LicenseCodes.h" -#include "../util/PerfTimer.h" -#include "../util/PerfRenderer.h" -#include "player/input/MouseBuildInput.h" - -#include "../world/Facing.h" - -#include "../network/packet/PlaceBlockPacket.h" - -#include "player/input/IInputHolder.h" -#ifndef STANDALONE_SERVER #include "player/input/touchscreen/TouchscreenInput.h" - -#include "player/input/ControllerTurnInput.h" -#include "player/input/XperiaPlayInput.h" - -#endif - -#include "player/input/MouseTurnInput.h" -#include "../world/entity/MobFactory.h" -#include "../world/level/MobSpawner.h" -#include "../util/Mth.h" -#include "../network/packet/InteractPacket.h" -#ifndef STANDALONE_SERVER +#include "renderer/Chunk.h" #include "gui/screens/PrerenderTilesScreen.h" #include "renderer/Textures.h" #include "gui/screens/DeathScreen.h" -#endif - -#include "../network/packet/RespawnPacket.h" -#include "IConfigListener.h" -#include "../world/entity/MobCategory.h" -#ifndef STANDALONE_SERVER #include "gui/screens/FurnaceScreen.h" -#endif -#include "../world/Difficulty.h" -#include "../server/ServerLevel.h" -#ifdef CREATORMODE -#include "../server/CreatorLevel.h" -#endif -#include "../network/packet/AdventureSettingsPacket.h" -#include "../network/packet/SetSpawnPositionPacket.h" -#include "../network/command/CommandServer.h" -#include "gamemode/CreatorMode.h" -#ifndef STANDALONE_SERVER #include "gui/screens/ArmorScreen.h" -#endif -#include "../world/level/levelgen/synth/ImprovedNoise.h" -#ifndef STANDALONE_SERVER #include "renderer/tileentity/TileEntityRenderDispatcher.h" -#endif - -#ifndef STANDALONE_SERVER #include "renderer/ptexture/DynamicTexture.h" #include "renderer/GameRenderer.h" #include "renderer/ItemInHandRenderer.h" @@ -99,13 +56,55 @@ #include "gui/Font.h" #include "gui/screens/RenameMPLevelScreen.h" #include "sound/SoundEngine.h" +#endif // STANDALONE_SERVER + +#include "player/LocalPlayer.h" +#include "gamemode/CreativeMode.h" +#include "gamemode/SurvivalMode.h" +#include "player/LocalPlayer.h" +#include "../platform/CThread.h" +#include "../platform/input/Mouse.h" +#include "../AppPlatform.h" +#include "../LicenseCodes.h" +#include "../util/PerfTimer.h" +#include "../util/PerfRenderer.h" +#include "player/input/MouseBuildInput.h" + +#include "player/input/IInputHolder.h" + +#include "player/input/MouseTurnInput.h" +#include "../world/entity/MobFactory.h" +#include "../world/level/MobSpawner.h" +#include "../util/Mth.h" +#include "../network/packet/InteractPacket.h" +#include "../network/packet/RespawnPacket.h" +#include "../network/packet/AdventureSettingsPacket.h" +#include "../network/packet/SetSpawnPositionPacket.h" +#include "IConfigListener.h" +#include "../world/entity/MobCategory.h" +#include "../world/Difficulty.h" +#include "../server/ServerLevel.h" + +#ifdef CREATORMODE +#include "../server/CreatorLevel.h" #endif +#include "../network/command/CommandServer.h" +#include "gamemode/CreatorMode.h" + + +#ifndef STANDALONE_SERVER +#include "../world/level/GrassColor.h" +#include "renderer/LevelRenderer.h" +#include "particle/ParticleEngine.h" +#endif +#include "../world/level/Level.h" + static void checkGlError(const char* tag) { #ifdef GLDEBUG while (1) { - const int errCode = glGetError(); - if (errCode == GL_NO_ERROR) break; + const int errCode = glGetError(); + if (errCode == GL_NO_ERROR) break; LOGE("################\nOpenGL-error @ %s : #%d\n", tag, errCode); } @@ -123,13 +122,12 @@ const char* Minecraft::progressMessages[] = { int Minecraft::customDebugId = Minecraft::CDI_NONE; #if defined(_MSC_VER) - #pragma warning( disable : 4355 ) // 'this' pointer in initialization list which is perfectly legal +#pragma warning( disable : 4355 ) // 'this' pointer in initialization list which is perfectly legal #endif bool Minecraft::useAmbientOcclusion = false; -Minecraft::Minecraft() -: user(NULL), +Minecraft::Minecraft() : level(NULL), player(NULL), cameraTargetPlayer(NULL), @@ -182,17 +180,18 @@ Minecraft::Minecraft() width(1), height(1), //_respawnPlayerTicks(-1), #ifdef __APPLE__ - _isSuperFast(false), + _isSuperFast(false), #endif _powerVr(false), commandPort(4711), reserved_d1(0),reserved_d2(0), - reserved_f1(0),reserved_f2(0) + reserved_f1(0),reserved_f2(0), options(this), + m_commandManager() { -//#ifdef ANDROID + //#ifdef ANDROID #if defined(NO_NETWORK) - raknetInstance = new IRakNetInstance(); + raknetInstance = new IRakNetInstance(); #else raknetInstance = new RakNetInstance(); #endif @@ -234,7 +233,6 @@ Minecraft::~Minecraft() } //delete player; - delete user; delete inputHolder; delete storageSource; @@ -269,11 +267,12 @@ void Minecraft::selectLevel( const std::string& levelId, const std::string& leve void Minecraft::setLevel(Level* level, const std::string& message /* ="" */, LocalPlayer* forceInsertPlayer /* = NULL */) { cameraTargetPlayer = NULL; - LOGI("Seed is %ld\n", level->getSeed()); if (level != NULL) { + LOGI("Seed is %ld\n", level->getSeed()); + level->raknetInstance = raknetInstance; - gameMode->initLevel(level); + gameMode->initLevel(level); if (!player && forceInsertPlayer) { @@ -288,8 +287,13 @@ void Minecraft::setLevel(Level* level, const std::string& message /* ="" */, Loc } } this->level = level; + // So uhhh + std::string op = options.getStringValue(OPTIONS_USERNAME); + std::transform(op.begin(), op.end(), op.begin(), ::tolower); + + level->ops.emplace(op); _hasSignaledGeneratingLevelFinished = false; -#ifdef STANDALONE_SERVER +#if defined(STANDALONE_SERVER) || defined(PLATFORM_WEB) const bool threadedLevelCreation = false; #else const bool threadedLevelCreation = true; @@ -304,19 +308,19 @@ void Minecraft::setLevel(Level* level, const std::string& message /* ="" */, Loc // Non-threaded generateLevel("Currently not used", level); } - } else { - player = NULL; - } + } else { + player = NULL; + } - this->lastTickTime = 0; + this->lastTickTime = 0; this->_running = true; } void Minecraft::leaveGame(bool renameLevel /*=false*/) { - if (isGeneratingLevel || !_hasSignaledGeneratingLevelFinished) - return; - + if (isGeneratingLevel || !_hasSignaledGeneratingLevelFinished) + return; + isGeneratingLevel = false; bool saveLevel = level && (!level->isClientSide || renameLevel); @@ -349,6 +353,7 @@ void Minecraft::leaveGame(bool renameLevel /*=false*/) _running = false; #ifndef STANDALONE_SERVER + gui.clearMessages(); if (renameLevel) { setScreen(new RenameMPLevelScreen(LevelStorageSource::TempLevelId)); } @@ -370,29 +375,29 @@ void Minecraft::prepareLevel(const std::string& title) { if (!level->isNew()) level->setUpdateLights(false); - int Max = CHUNK_CACHE_WIDTH * CHUNK_CACHE_WIDTH; + int Max = LevelConstants::CHUNK_CACHE_WIDTH * LevelConstants::CHUNK_CACHE_WIDTH; int pp = 0; - for (int x = 8; x < (CHUNK_CACHE_WIDTH * CHUNK_WIDTH); x += CHUNK_WIDTH) { - for (int z = 8; z < (CHUNK_CACHE_WIDTH * CHUNK_WIDTH); z += CHUNK_WIDTH) { + for (int x = 8; x < (LevelConstants::CHUNK_CACHE_WIDTH * LevelConstants::CHUNK_WIDTH); x += LevelConstants::CHUNK_WIDTH) { + for (int z = 8; z < (LevelConstants::CHUNK_CACHE_WIDTH * LevelConstants::CHUNK_WIDTH); z += LevelConstants::CHUNK_WIDTH) { progressStagePercentage = 100 * pp++ / Max; //printf("level generation progress %d\n", progressStagePercentage); B.start(); - level->getTile(x, 64, z); + level->getTile(x, 64, z); B.stop(); L.start(); if (level->isNew()) while (level->updateLights()) ; L.stop(); - } - } + } + } A.stop(); level->setUpdateLights(true); C.start(); - for (int x = 0; x < CHUNK_CACHE_WIDTH; x++) + for (int x = 0; x < LevelConstants::CHUNK_CACHE_WIDTH; x++) { - for (int z = 0; z < CHUNK_CACHE_WIDTH; z++) + for (int z = 0; z < LevelConstants::CHUNK_CACHE_WIDTH; z++) { LevelChunk* chunk = level->getChunk(x, z); if (chunk && !chunk->createdFromSave) @@ -449,20 +454,21 @@ void Minecraft::update() { // } //} - if (pause && level != NULL) { - float lastA = timer.a; - timer.advanceTime(); - timer.a = lastA; - } else { + // If we're paused (local world / invisible server), freeze gameplay and + // networking and only keep UI responsive. + bool freezeGame = pause; + + if (!freezeGame) { timer.advanceTime(); } - if (raknetInstance) { + if (raknetInstance && !freezeGame) { raknetInstance->runEvents(netCallback); } TIMER_PUSH("tick"); - int toTick = timer.ticks; + int toTick = freezeGame ? 1 : timer.ticks; + if (!freezeGame) timer.ticks = 0; for (int i = 0; i < toTick; ++i, ++ticks) tick(i, toTick-1); @@ -472,33 +478,33 @@ void Minecraft::update() { } TIMER_POP(); - #ifndef STANDALONE_SERVER - if (gameMode != NULL) gameMode->render(timer.a); - TIMER_PUSH("sound"); - soundEngine->update(player, timer.a); - TIMER_POP_PUSH("render"); - gameRenderer->render(timer.a); - TIMER_POP(); - #else +#ifndef STANDALONE_SERVER + if (gameMode != NULL) gameMode->render(timer.a); + TIMER_PUSH("sound"); + soundEngine->update(player, timer.a); + TIMER_POP_PUSH("render"); + gameRenderer->render(timer.a); + TIMER_POP(); +#else CThread::sleep(1); - #endif +#endif #ifndef STANDALONE_SERVER Multitouch::resetThisUpdate(); #endif - TIMER_POP(); + #ifndef STANDALONE_SERVER + TIMER_POP(); checkGlError("Update finished"); - if (options.renderDebug) { + if (options.getBooleanValue(OPTIONS_RENDER_DEBUG)) { + //#ifndef PLATFORM_DESKTOP if (!PerfTimer::enabled) { PerfTimer::reset(); PerfTimer::enabled = true; } - - //TIMER_PUSH("debugfps"); _perfRenderer->renderFpsMeter(1); checkGlError("render debug"); - //TIMER_POP(); + //#endif } else { PerfTimer::enabled = false; } @@ -510,7 +516,7 @@ void Minecraft::tick(int nTick, int maxTick) { if (missTime > 0) missTime--; #ifndef STANDALONE_SERVER if (!screen && player) { - if (player->health <= 0) { + if (player->hasDied()) { setScreen(new DeathScreen()); } } @@ -558,14 +564,14 @@ void Minecraft::tick(int nTick, int maxTick) { TIMER_POP_PUSH("levelRenderer"); levelRenderer->tick(); #endif - level->difficulty = options.difficulty; + level->difficulty = options.getIntValue(OPTIONS_DIFFICULTY); if (level->isClientSide) level->difficulty = Difficulty::EASY; TIMER_POP_PUSH("level"); level->tickEntities(); level->tick(); #ifndef STANDALONE_SERVER - TIMER_POP_PUSH("animateTick"); + TIMER_POP_PUSH("animateTick"); if (player) { level->animateTick(Mth::floor(player->x), Mth::floor(player->y), Mth::floor(player->z)); } @@ -575,20 +581,22 @@ void Minecraft::tick(int nTick, int maxTick) { #ifndef STANDALONE_SERVER textures->loadAndBindTexture("terrain.png"); if (!pause && !(screen && !screen->renderGameBehind())) { - #if !defined(RPI) - #ifdef __APPLE__ - if (isSuperFast()) - #endif - { +#if !defined(RPI) +#ifdef __APPLE__ + if (isSuperFast()) +#endif + { if (nTick == maxTick) { TIMER_POP_PUSH("textures"); textures->tick(true); } - } - #endif + } +#endif } TIMER_POP_PUSH("particles"); - particleEngine->tick(); + if (!pause) { + particleEngine->tick(); + } if (screen) { screenMutex = true; screen->tick(); @@ -645,45 +653,46 @@ void Minecraft::tickInput() { while (Mouse::next()) { //if (Mouse::getButtonState(MouseAction::ACTION_LEFT)) // LOGI("mouse-down-at: %d, %d\n", Mouse::getX(), Mouse::getY()); - int passedTime = getTimeMs() - lastTickTime; - if (passedTime > 200) continue; // @note: As long Mouse::clear CLEARS the whole buffer, it's safe to break here + int passedTime = getTimeMs() - lastTickTime; + if (passedTime > 200) continue; // @note: As long Mouse::clear CLEARS the whole buffer, it's safe to break here // But since it might be rewritten anyway (and hopefully there aren't a lot of messages, we just continue. const MouseAction& e = Mouse::getEvent(); -#ifdef RPI // If clicked when not having focus, get focus @keyboard - if (!mouseGrabbed) { + if (!useTouchscreen() && !mouseGrabbed) { if (!screen && e.data == MouseAction::DATA_DOWN) { grabMouse(); } } -#endif if (allowGuiClicks && e.action == MouseAction::ACTION_LEFT && e.data == MouseAction::DATA_DOWN) { gui.handleClick(MouseAction::ACTION_LEFT, Mouse::getX(), Mouse::getY()); } if (e.action == MouseAction::ACTION_WHEEL) { - Inventory* v = player->inventory; + // If chat/console is open, use the wheel to scroll through chat history. + if (screen && (dynamic_cast(screen) || dynamic_cast(screen))) { + gui.scrollChat(e.dy); + } else { + Inventory* v = player->inventory; - int numSlots = gui.getNumSlots(); -#ifndef PLATFORM_DESKTOP - numSlots--; -#endif + int numSlots = gui.getNumSlots(); + if (!useTouchscreen()) numSlots--; - int slot = (v->selected - e.dy + numSlots) % numSlots; - v->selectSlot(slot); + int slot = (v->selected - e.dy + numSlots) % numSlots; + v->selectSlot(slot); + } } /* if (mouseDiggable && options.useMouseForDigging) { - if (Mouse::getEventButton() == MouseAction::ACTION_LEFT && Mouse::getEventButtonState()) { - handleMouseClick(MouseAction::ACTION_LEFT); - lastClickTick = ticks; - } - if (Mouse::getEventButton() == MouseAction::ACTION_RIGHT && Mouse::getEventButtonState()) { - handleMouseClick(MouseAction::ACTION_RIGHT); - lastClickTick = ticks; - } + if (Mouse::getEventButton() == MouseAction::ACTION_LEFT && Mouse::getEventButtonState()) { + handleMouseClick(MouseAction::ACTION_LEFT); + lastClickTick = ticks; + } + if (Mouse::getEventButton() == MouseAction::ACTION_RIGHT && Mouse::getEventButtonState()) { + handleMouseClick(MouseAction::ACTION_RIGHT); + lastClickTick = ticks; + } } */ } @@ -697,213 +706,241 @@ void Minecraft::tickInput() { if (isPressed) { gui.handleKeyPressed(key); - #if defined(WIN32) || defined(RPI) || defined (PLATFORM_DESKTOP)//|| defined(_DEBUG) || defined(DEBUG) - if (key >= '0' && key <= '9') { - int digit = key - '0'; - int slot = digit - 1; + if (key >= '0' && key <= '9') { + int digit = key - '0'; + int slot = digit - 1; - if (slot >= 0 && slot < gui.getNumSlots()) - player->inventory->selectSlot(slot); + if (slot >= 0 && slot < gui.getNumSlots()) + player->inventory->selectSlot(slot); - #if defined(WIN32) - if (digit >= 1 && GetAsyncKeyState(VK_CONTROL) < 0) { - // Set adventure settings here! - AdventureSettingsPacket p(level->adventureSettings); - p.toggle((AdventureSettingsPacket::Flags)(1 << slot)); - p.fillIn(level->adventureSettings); - raknetInstance->send(p); - } - if (digit == 0) { - Pos pos((int)player->x, (int)player->y-1, (int)player->z); - SetSpawnPositionPacket p(pos); - raknetInstance->send(p); - } - #endif +#if defined(WIN32) + if (digit >= 1 && GetAsyncKeyState(VK_CONTROL) < 0) { + // Set adventure settings here! + AdventureSettingsPacket p(level->adventureSettings); + p.toggle((AdventureSettingsPacket::Flags)(1 << slot)); + p.fillIn(level->adventureSettings); + raknetInstance->send(p); } - #endif - #if defined(PLATFORM_DESKTOP) - if (key == Keyboard::KEY_E) { - screenChooser.setScreen(SCREEN_BLOCKSELECTION); + if (digit == 0) { + Pos pos((int)player->x, (int)player->y-1, (int)player->z); + SetSpawnPositionPacket p(pos); + raknetInstance->send(p); } - if (!screen && key == Keyboard::KEY_O || key == 250) { - releaseMouse(); - } - - if (key == Keyboard::KEY_F5) { - options.thirdPersonView = !options.thirdPersonView; - /* - ImprovedNoise noise; - for (int i = 0; i < 16; ++i) - printf("%d\t%f\n", i, noise.grad2(i, 3, 8)); - */ - } - - // Change distance - if (key == Keyboard::KEY_F) - options.viewDistance = (options.viewDistance + 1) % 4; - #endif - #if defined(WIN32) - if (key == Keyboard::KEY_F) { - options.isFlying = !options.isFlying; - player->noPhysics = options.isFlying; - } - - // if (key == Keyboard::KEY_T) { - // options.thirdPersonView = !options.thirdPersonView; - // /* - // ImprovedNoise noise; - // for (int i = 0; i < 16; ++i) - // printf("%d\t%f\n", i, noise.grad2(i, 3, 8)); - // */ - // } - - if (key == Keyboard::KEY_O) { - useAmbientOcclusion = !useAmbientOcclusion; - options.ambientOcclusion = useAmbientOcclusion; - levelRenderer->allChanged(); - } - - if (key == Keyboard::KEY_L) - options.viewDistance = (options.viewDistance + 1) % 4; - - if (key == Keyboard::KEY_U) { - onGraphicsReset(); - player->heal(100); - } - - if (key == Keyboard::KEY_B || key == 108) // Toggle the game mode - setIsCreativeMode(!isCreativeMode()); - - if (key == Keyboard::KEY_P) // Step forward in time - level->setTime( level->getTime() + 1000); - - if (key == Keyboard::KEY_G) { - setScreen(new ArmorScreen()); - /* - std::vector& boxs = level->getCubes(NULL, AABB(128.1f, 73, 128.1f, 128.9f, 74.9f, 128.9f)); - LOGI("boxes: %d\n", (int)boxs.size()); - */ - } - - if (key == Keyboard::KEY_Y) { - textures->reloadAll(); - player->hurtTo(2); - } - if (key == Keyboard::KEY_Z || key == 108) { - for (int i = 0; i < 1; ++i) { - Mob* mob = NULL; - int forceId = 0;//MobTypes::Sheep; - - int types[] = { - MobTypes::Sheep, - MobTypes::Pig, - MobTypes::Chicken, - MobTypes::Cow, - }; - - int mobType = (forceId > 0)? forceId : types[Mth::random(sizeof(types) / sizeof(int))]; - mob = MobFactory::CreateMob(mobType, level); - - //((Animal*)mob)->setAge(-1000); - float dx = 4 - 8 * Mth::random() + 4 * Mth::sin(Mth::DEGRAD * player->yRot); - float dz = 4 - 8 * Mth::random() + 4 * Mth::cos(Mth::DEGRAD * player->yRot); - if (mob && !MobSpawner::addMob(level, mob, player->x + dx, player->y, player->z + dz, Mth::random()*360, 0, true)) - delete mob; - } - } - - if (key == Keyboard::KEY_X) { - const EntityList& entities = level->getAllEntities(); - for (int i = entities.size()-1; i >= 0; --i) { - Entity* e = entities[i]; - if (!e->isPlayer()) - level->removeEntity(e); - } - } - - if (key == Keyboard::KEY_C /*|| key == 4*/) { - player->inventory->clearInventoryWithDefault(); - // @todo: Add saving here for benchmarking - } - if (key == Keyboard::KEY_H) { - setScreen( new PrerenderTilesScreen() ); - } - - if (key == Keyboard::KEY_O) { - for (int i = Inventory::MAX_SELECTION_SIZE; i < player->inventory->getContainerSize(); ++i) - if (player->inventory->getItem(i)) - player->inventory->dropSlot(i, false); - } - if (key == Keyboard::KEY_F3) { - options.renderDebug = !options.renderDebug; - } - if (key == Keyboard::KEY_M) { - options.difficulty = (options.difficulty == Difficulty::PEACEFUL)? - Difficulty::NORMAL : Difficulty::PEACEFUL; - //setIsCreativeMode( !isCreativeMode() ); - } - - if (options.renderDebug) { - if (key >= '0' && key <= '9') { - _perfRenderer->debugFpsMeterKeyPress(key - '0'); - } - } - #endif - - #ifndef PLATFORM_DESKTOP - if (key == 82) - pauseGame(false); - #else - if (key == Keyboard::KEY_ESCAPE) - pauseGame(false); - #endif - - #ifndef OPENGL_ES - if (key == Keyboard::KEY_P) { - static bool isWireFrame = false; - isWireFrame = !isWireFrame; - glPolygonMode(GL_FRONT, isWireFrame? GL_LINE : GL_FILL); - //glPolygonMode(GL_BACK, isWireFrame? GL_LINE : GL_FILL); - } - #endif - } - #ifdef WIN32 - if (key == Keyboard::KEY_M) { - for (int i = 0; i < 5 * SharedConstants::TicksPerSecond; ++i) - level->tick(); +#endif } - #endif + + if (key == Keyboard::KEY_LEFT_CTRL) { + player->setSprinting(true); + } + + if (key == Keyboard::KEY_E) { + screenChooser.setScreen(SCREEN_BLOCKSELECTION); + } + + if (!screen && key == Keyboard::KEY_T && level) { + setScreen(new ConsoleScreen()); + } + + if (key == Keyboard::KEY_F3) { + options.toggle(OPTIONS_RENDER_DEBUG); + } + + // TODO: replace it with client /give command :face_vomiting: + // if (key == Keyboard::KEY_F4) { + // player->inventory->add(new ItemInstance(Tile::redBrick)); + // player->inventory->add(new ItemInstance(Item::ironIngot, 64)); + // player->inventory->add(new ItemInstance(Item::ironIngot, 34)); + // player->inventory->add(new ItemInstance(Tile::stonecutterBench)); + // player->inventory->add(new ItemInstance(Tile::workBench)); + // player->inventory->add(new ItemInstance(Tile::furnace)); + // player->inventory->add(new ItemInstance(Tile::wood, 54)); + // player->inventory->add(new ItemInstance(Item::stick, 14)); + // player->inventory->add(new ItemInstance(Item::coal, 31)); + // player->inventory->add(new ItemInstance(Tile::sand, 6)); + + // } + + if (key == Keyboard::KEY_F5) { + options.toggle(OPTIONS_THIRD_PERSON_VIEW); + /* + ImprovedNoise noise; + for (int i = 0; i < 16; ++i) + printf("%d\t%f\n", i, noise.grad2(i, 3, 8)); + */ + } + + if (!screen && key == Keyboard::KEY_O || key == 250) { + releaseMouse(); + } + + if (key == Keyboard::KEY_F) { + int dst = options.getIntValue(OPTIONS_VIEW_DISTANCE); + options.set(OPTIONS_VIEW_DISTANCE, (dst + 1) % 4); + } + +#ifdef CHEATS + if (key == Keyboard::KEY_U) { + onGraphicsReset(); + player->heal(100); + } + + if (key == Keyboard::KEY_B || key == 108) // Toggle the game mode + setIsCreativeMode(!isCreativeMode()); + + if (key == Keyboard::KEY_P) // Step forward in time + level->setTime( level->getTime() + 1000); + + if (key == Keyboard::KEY_G) { + setScreen(new ArmorScreen()); + /* + std::vector& boxs = level->getCubes(NULL, AABB(128.1f, 73, 128.1f, 128.9f, 74.9f, 128.9f)); + LOGI("boxes: %d\n", (int)boxs.size()); + */ + } + + if (key == Keyboard::KEY_Y) { + textures->reloadAll(); + player->hurtTo(2); + } + if (key == Keyboard::KEY_Z || key == 108) { + for (int i = 0; i < 1; ++i) { + Mob* mob = NULL; + int forceId = 0;//MobTypes::Sheep; + + int types[] = { + MobTypes::Sheep, + MobTypes::Pig, + MobTypes::Chicken, + MobTypes::Cow, + }; + + int mobType = (forceId > 0)? forceId : types[Mth::random(sizeof(types) / sizeof(int))]; + mob = MobFactory::CreateMob(mobType, level); + + //((Animal*)mob)->setAge(-1000); + float dx = 4 - 8 * Mth::random() + 4 * Mth::sin(Mth::DEGRAD * player->yRot); + float dz = 4 - 8 * Mth::random() + 4 * Mth::cos(Mth::DEGRAD * player->yRot); + if (mob && !MobSpawner::addMob(level, mob, player->x + dx, player->y, player->z + dz, Mth::random()*360, 0, true)) + delete mob; + } + } + + if (key == Keyboard::KEY_X) { + const EntityList& entities = level->getAllEntities(); + for (int i = entities.size()-1; i >= 0; --i) { + Entity* e = entities[i]; + if (!e->isPlayer()) + level->removeEntity(e); + } + } + + if (key == Keyboard::KEY_C /*|| key == 4*/) { + player->inventory->clearInventoryWithDefault(); + // @todo: Add saving here for benchmarking + } + if (key == Keyboard::KEY_H) { + setScreen( new PrerenderTilesScreen() ); + } + + if (key == Keyboard::KEY_O) { + for (int i = Inventory::MAX_SELECTION_SIZE; i < player->inventory->getContainerSize(); ++i) + if (player->inventory->getItem(i)) + player->inventory->dropSlot(i, false); + } + if (key == Keyboard::KEY_M) { + Difficulty difficulty = (Difficulty)options.getIntValue(OPTIONS_DIFFICULTY); + options.set(OPTIONS_DIFFICULTY, (difficulty == Difficulty::PEACEFUL)? + Difficulty::NORMAL : Difficulty::PEACEFUL); + //setIsCreativeMode( !isCreativeMode() ); + } + + if (options.getBooleanValue(OPTIONS_RENDER_DEBUG)) { + if (key >= '0' && key <= '9') { + _perfRenderer->debugFpsMeterKeyPress(key - '0'); + } + } +#endif + + if (options.getBooleanValue(OPTIONS_RENDER_DEBUG)) { + if (key >= '0' && key <= '9') { + _perfRenderer->debugFpsMeterKeyPress(key - '0'); + } + } + + if (key == Keyboard::KEY_ESCAPE) + pauseGame(false); + +#ifdef PLATFORM_DESKTOP + if (key == Keyboard::KEY_P) { + static bool isWireFrame = false; + isWireFrame = !isWireFrame; + glPolygonMode(GL_FRONT, isWireFrame? GL_LINE : GL_FILL); + //glPolygonMode(GL_BACK, isWireFrame? GL_LINE : GL_FILL); + } +#endif + } +#ifdef WIN32 + if (key == Keyboard::KEY_M) { + for (int i = 0; i < 5 * SharedConstants::TicksPerSecond; ++i) + level->tick(); + } + +#endif } TIMER_POP_PUSH("handlemouse"); - + static bool prevMouseDownLeft = false; - // Destroy and attack is on same button - if (Mouse::isButtonDown(MouseAction::ACTION_LEFT)) { - auto baiFlags = BuildActionIntention::BAI_REMOVE | BuildActionIntention::BAI_ATTACK; + if (!useTouchscreen()) { + if (Mouse::getButtonState(MouseAction::ACTION_LEFT) == 0) { + gameMode->stopDestroyBlock(); + } - if (!prevMouseDownLeft) baiFlags |= BuildActionIntention::BAI_FIRSTREMOVE; - - BuildActionIntention bai(baiFlags); - handleBuildAction(&bai); + if (!Mouse::isButtonDown(MouseAction::ACTION_RIGHT)) { + gameMode->releaseUsingItem(player); + } } - prevMouseDownLeft = Mouse::isButtonDown(MouseAction::ACTION_LEFT); - - static int buildHoldTicks = 0; + if (useTouchscreen()) { + // Touch: gesture recognizer classifies the action type (turn/destroy/build) + BuildActionIntention bai; - // Build and use/interact is on same button - // USPESHNO spizheno - if (Mouse::isButtonDown(MouseAction::ACTION_RIGHT)) { - if (buildHoldTicks >= 5) buildHoldTicks = 0; - - if (++buildHoldTicks == 1) { - BuildActionIntention bai(BuildActionIntention::BAI_BUILD | BuildActionIntention::BAI_INTERACT); + if (inputHolder && inputHolder->getBuildInput()->tickBuild(player, &bai)) { handleBuildAction(&bai); + } else { + gameMode->stopDestroyBlock(); + if (player && player->isUsingItem()) { + gameMode->releaseUsingItem(player); + } } } else { - buildHoldTicks = 0; + // Desktop: left mouse = destroy/attack + if (Mouse::isButtonDown(MouseAction::ACTION_LEFT)) { + auto baiFlags = BuildActionIntention::BAI_REMOVE | BuildActionIntention::BAI_ATTACK; + + if (!prevMouseDownLeft) baiFlags |= BuildActionIntention::BAI_FIRSTREMOVE; + + BuildActionIntention bai(baiFlags); + handleBuildAction(&bai); + } + + prevMouseDownLeft = Mouse::isButtonDown(MouseAction::ACTION_LEFT); + + // Build and use/interact is on same button + // USPESHNO spizheno + static int buildHoldTicks = 0; + if (Mouse::isButtonDown(MouseAction::ACTION_RIGHT)) { + if (buildHoldTicks >= 5) buildHoldTicks = 0; + + if (++buildHoldTicks == 1) { + BuildActionIntention bai(BuildActionIntention::BAI_BUILD | BuildActionIntention::BAI_INTERACT); + handleBuildAction(&bai); + } + } else { + buildHoldTicks = 0; + gameMode->releaseUsingItem(player); + } } lastTickTime = getTimeMs(); @@ -928,35 +965,35 @@ void Minecraft::handleBuildAction(BuildActionIntention* action) { } if(player->isUsingItem()) return; - bool mayUse = true; + bool mayUse = true; if (!hitResult.isHit()) { if (action->isRemove() && !gameMode->isCreativeType()) { missTime = 10; } - } else if (hitResult.type == ENTITY) { - if (action->isAttack()) { + } else if (hitResult.type == ENTITY) { + if (action->isAttack()) { player->swing(); //LOGI("attacking!\n"); InteractPacket packet(InteractPacket::Attack, player->entityId, hitResult.entity->entityId); raknetInstance->send(packet); - gameMode->attack(player, hitResult.entity); + gameMode->attack(player, hitResult.entity); } else if (action->isInteract()) { if (hitResult.entity->interactPreventDefault()) mayUse = false; //LOGI("interacting!\n"); InteractPacket packet(InteractPacket::Interact, player->entityId, hitResult.entity->entityId); raknetInstance->send(packet); - gameMode->interact(player, hitResult.entity); - } - } else if (hitResult.type == TILE) { + gameMode->interact(player, hitResult.entity); + } + } else if (hitResult.type == TILE) { int x = hitResult.x; - int y = hitResult.y; - int z = hitResult.z; - int face = hitResult.f; + int y = hitResult.y; + int z = hitResult.z; + int face = hitResult.f; int oldTileId = level->getTile(x, y, z); - Tile* oldTile = Tile::tiles[oldTileId]; + Tile* oldTile = Tile::tiles[oldTileId]; //bool tryDestroyBlock = false; @@ -965,8 +1002,8 @@ void Minecraft::handleBuildAction(BuildActionIntention* action) { return; //LOGI("tile: %s - %d, %d, %d. b: %f - %f\n", oldTile->getDescriptionId().c_str(), x, y, z, oldTile->getBrightness(level, x, y, z), oldTile->getBrightness(level, x, y+1, z)); - level->extinguishFire(x, y, z, hitResult.f); - + level->extinguishFire(x, y, z, hitResult.f); + if (action->isFirstRemove()) { gameMode->startDestroyBlock(x, y, z, hitResult.f); } else { @@ -975,16 +1012,16 @@ void Minecraft::handleBuildAction(BuildActionIntention* action) { particleEngine->crack(x, y, z, hitResult.f); player->swing(); - } + } else { ItemInstance* item = player->inventory->getSelected(); - if (gameMode->useItemOn(player, level, item, x, y, z, face, hitResult.pos)) { - mayUse = false; - player->swing(); - #ifdef RPI - } else if (item && item->id == ((Item*)Item::sword_iron)->id) { - player->swing(); - #endif + if (gameMode->useItemOn(player, level, item, x, y, z, face, hitResult.pos)) { + mayUse = false; + player->swing(); +#ifdef RPI + } else if (item && item->id == ((Item*)Item::sword_iron)->id) { + player->swing(); +#endif } if (item && item->count <= 0) { player->inventory->clearSlot(player->inventory->selected); @@ -1010,7 +1047,7 @@ void Minecraft::handleBuildAction(BuildActionIntention* action) { bool Minecraft::isOnlineClient() { - return (level != NULL && level->isClientSide); + return (level != NULL && level->isClientSide); } bool Minecraft::isOnline() @@ -1019,6 +1056,17 @@ bool Minecraft::isOnline() } void Minecraft::pauseGame(bool isBackPaused) { + // Only freeze gameplay when running a local server and it is not accepting + // incoming connections (invisible server), which includes typical single- + // player/lobby mode. If the server is visible, the game should keep ticking. + bool canFreeze = false; + if (raknetInstance && raknetInstance->isServer() && netCallback) { + ServerSideNetworkHandler* ss = (ServerSideNetworkHandler*) netCallback; + if (!ss->allowsIncomingConnections()) + canFreeze = true; + } + pause = canFreeze; + #ifndef STANDALONE_SERVER if (screen != NULL) return; screenChooser.setScreen(isBackPaused? SCREEN_PAUSEPREV : SCREEN_PAUSE); @@ -1066,11 +1114,13 @@ void Minecraft::setScreen( Screen* screen ) if (screen->isInGameScreen() && level) { level->saveLevelData(); - level->saveGame(); - } + level->saveGame(); + } //noRender = false; } else { + // Closing a screen and returning to the game should unpause. + pause = false; grabMouse(); } #endif @@ -1101,34 +1151,61 @@ void Minecraft::releaseMouse() } bool Minecraft::useTouchscreen() { -#ifdef RPI +#if defined(TARGET_OS_IPHONE) + return true; +#elif defined(RPI) return false; #endif - return options.useTouchScreen || !_supportsNonTouchscreen; + return options.getBooleanValue(OPTIONS_USE_TOUCHSCREEN) && !_supportsNonTouchscreen; } bool Minecraft::supportNonTouchScreen() { return _supportsNonTouchscreen; } void Minecraft::init() { - options.minecraft = this; - options.initDefaultValues(); + LevelChunk::ChunkBlockCount = LevelConstants::CHUNK_BLOCK_COUNT; #ifndef STANDALONE_SERVER checkGlError("Init enter"); _supportsNonTouchscreen = !platform()->supportsTouchscreen(); - LOGI("IS TOUCHSCREEN? %d\n", options.useTouchScreen); + LOGI("IS TOUCHSCREEN? %d\n", options.getBooleanValue(OPTIONS_USE_TOUCHSCREEN)); textures = new Textures(&options, platform()); textures->addDynamicTexture(new WaterTexture()); textures->addDynamicTexture(new WaterSideTexture()); + textures->addDynamicTexture(new LavaTexture()); + textures->addDynamicTexture(new LavaSideTexture()); + textures->addDynamicTexture(new FireTexture(0)); + textures->addDynamicTexture(new FireTexture(1)); gui.texturesLoaded(textures); levelRenderer = new LevelRenderer(this); gameRenderer = new GameRenderer(this); particleEngine = new ParticleEngine(level, textures); + // 4j's code for reference + // FoliageColor::init(textures->loadTexturePixels(L"misc/foliagecolor.png")); + + + // my code + TextureId foliageId = (textures->loadTexture("misc/foliagecolor.png")); // loading the uh png for foliage color + int* foliagePixels = textures->loadTexturePixels(foliageId, "misc/foliagecolor.png"); + // now i can finally initialize foliage color, probably not the best way to handle this but i cant be arsed rn + FoliageColor::init(foliagePixels); + + TextureId grassId = (textures->loadTexture("misc/grasscolor.png")); // loading the uh png for foliage color + int* grassPixels = textures->loadTexturePixels(grassId, "misc/grasscolor.png"); + GrassColor::init(grassPixels); + + bool tint = options.getBooleanValue(OPTIONS_FOLIAGE_TINT); // finally, toggleable foliage color + FoliageColor::setUseTint(tint); + GrassColor::setUseTint(tint); + + bool sideTint = options.getBooleanValue(OPTIONS_TINTED_SIDE); + TileRenderer::setUseTint(sideTint); + + // Platform specific initialization here font = new Font(&options, "font/default8.png", textures); @@ -1137,51 +1214,90 @@ void Minecraft::init() checkGlError("Init complete"); #endif - user = new User("TestUser", ""); + options.load(); + setIsCreativeMode(false); // false means it's Survival Mode reloadOptions(); - } void Minecraft::setSize(int w, int h) { #ifndef STANDALONE_SERVER - transformResolution(&w, &h); + transformResolution(&w, &h); width = w; height = h; + int screenWidth; + int screenHeight; + //#ifdef PLATFORM_DESKTOP + if (options.getBooleanValue(OPTIONS_WINDOW_SCALE)){ // scales with resolution using a formula instead of having hardcoded if checks + int guiScale = options.getIntValue(OPTIONS_GUI_SCALE); + if (guiScale == 0) { + guiScale = 1000; + } - if (width >= 1000) { - #ifdef __APPLE__ - Gui::GuiScale = (width > 2000)? 8.0f : 4.0f; - #else - Gui::GuiScale = 4.0f; - #endif - } - else if (width >= 800) { + // determine gui scale, optionally overriding auto + + + Gui::GuiScale = (float)Mth::Min(guiScale, Mth::Max(1, Mth::Min(width / 320, height / 240))); + + + + } else { + + + int guiScale = options.getIntValue(OPTIONS_GUI_SCALE); + + // determine gui scale, optionally overriding auto + if (guiScale != 0) { + // manual selection: 1->small, 2->medium, 3->large, 4->larger, 5->largest + switch (guiScale) { + case 1: Gui::GuiScale = 2.0f; break; + case 2: Gui::GuiScale = 3.0f; break; + case 3: Gui::GuiScale = 4.0f; break; + case 4: Gui::GuiScale = 5.0f; break; + case 5: Gui::GuiScale = 6.0f; break; + default: Gui::GuiScale = 1.0f; break; // auto + } + } else { + // auto compute from resolution + if (width >= 1000) { #ifdef __APPLE__ - Gui::GuiScale = 4.0f; + Gui::GuiScale = (width > 2000)? 8.0f : 4.0f; #else - Gui::GuiScale = 3.0f; + Gui::GuiScale = 4.0f; #endif - } - else if (width >= 400) - Gui::GuiScale = 2.0f; - else - Gui::GuiScale = 1.0f; + } + else if (width >= 800) { +#ifdef __APPLE__ + Gui::GuiScale = 4.0f; +#else + Gui::GuiScale = 3.0f; +#endif + } + else if (width >= 400) + Gui::GuiScale = 2.0f; + else + Gui::GuiScale = 1.0f; + } + + + + // if (platform()) { + // float pixelsPerMillimeter = options.getProgressValue(&Option::PIXELS_PER_MILLIMETER); + // pixelCalc.setPixelsPerMillimeter(pixelsPerMillimeter); + // pixelCalcUi.setPixelsPerMillimeter(pixelsPerMillimeter * Gui::InvGuiScale); + // } + + } + Gui::InvGuiScale = 1.0f / Gui::GuiScale; - int screenWidth = (int)(width * Gui::InvGuiScale); - int screenHeight = (int)(height * Gui::InvGuiScale); - - if (platform()) { - float pixelsPerMillimeter = options.getProgressValue(&Options::Option::PIXELS_PER_MILLIMETER); - pixelCalc.setPixelsPerMillimeter(pixelsPerMillimeter); - pixelCalcUi.setPixelsPerMillimeter(pixelsPerMillimeter * Gui::InvGuiScale); - } + screenWidth = (int)(width * Gui::InvGuiScale); + screenHeight = (int)(height * Gui::InvGuiScale); Config config = createConfig(this); gui.onConfigChanged(config); - + if (screen) screen->setSize(screenWidth, screenHeight); @@ -1198,42 +1314,42 @@ void Minecraft::setSize(int w, int h) { } void Minecraft::reloadOptions() { - options.update(); options.save(); - bool wasTouchscreen = options.useTouchScreen; - options.useTouchScreen = useTouchscreen(); + bool wasTouchscreen = options.getBooleanValue(OPTIONS_USE_TOUCHSCREEN); + options.set(OPTIONS_USE_TOUCHSCREEN, useTouchscreen()); options.save(); - if ((wasTouchscreen != options.useTouchScreen) || (inputHolder == 0)) + if ((wasTouchscreen != useTouchscreen()) || (inputHolder == 0)) _reloadInput(); - user->name = options.username; + // user->name = options.username; LOGI("Reloading-options\n"); - // @todo @fix Android and iOS behaves a bit differently when leaving - // an options screen (Android recreates OpenGL surface) - setSize(width, height); + // @todo @fix Android and iOS behaves a bit differently when leaving + // an options screen (Android recreates OpenGL surface) + setSize(width, height); } void Minecraft::_reloadInput() { #ifndef STANDALONE_SERVER delete inputHolder; - if (useTouchscreen() && !PLATFORM_DESKTOP) { + const bool useTouchHolder = useTouchscreen(); + if (useTouchHolder) { inputHolder = new TouchInputHolder(this, &options); } else { - #if defined(ANDROID) || defined(__APPLE__) - inputHolder = new CustomInputHolder( - new XperiaPlayInput(&options), - new ControllerTurnInput(2, ControllerTurnInput::MODE_DELTA), - new IBuildInput()); - #else - inputHolder = new CustomInputHolder( - new KeyboardInput(&options), - new MouseTurnInput(MouseTurnInput::MODE_DELTA, width/2, height/2), - new MouseBuildInput()); - #endif +#if defined(ANDROID) || defined(__APPLE__) + inputHolder = new CustomInputHolder( + new XperiaPlayInput(&options), + new ControllerTurnInput(2, ControllerTurnInput::MODE_DELTA), + new IBuildInput()); +#else + inputHolder = new CustomInputHolder( + new KeyboardInput(&options), + new MouseTurnInput(MouseTurnInput::MODE_DELTA, width/2, height/2), + new MouseBuildInput()); +#endif } mouseHandler.setTurnInput(inputHolder->getTurnInput()); @@ -1272,19 +1388,41 @@ bool Minecraft::joinMultiplayer( const PingedCompatibleServer& server ) return false; } +bool Minecraft::joinMultiplayerFromString( const std::string& server ) +{ + std::string ip = ""; + std::string port = "19132"; + + size_t pos = server.find(":"); + + if (pos != std::string::npos) { + ip = server.substr(0, pos); + port = server.substr(pos + 1); + } else { + ip = server; + } + + if (isLookingForMultiplayer && netCallback) { + isLookingForMultiplayer = false; + int portNum = atoi(port.c_str()); + return raknetInstance->connect(ip.c_str(), portNum); + } + return false; +} + void Minecraft::hostMultiplayer(int port) { - // Tear down last instance - raknetInstance->disconnect(); - delete netCallback; - netCallback = NULL; + // Tear down last instance + raknetInstance->disconnect(); + delete netCallback; + netCallback = NULL; #if !defined(NO_NETWORK) netCallback = new ServerSideNetworkHandler(this, raknetInstance); - #ifdef STANDALONE_SERVER - raknetInstance->host(user->name, port, 16); - #else - raknetInstance->host(user->name, port); - #endif +#ifdef STANDALONE_SERVER + raknetInstance->host("Server", port, 16); +#else + raknetInstance->host(options.getStringValue(OPTIONS_USERNAME), port); +#endif #endif } @@ -1338,10 +1476,18 @@ void Minecraft::_levelGenerated() player->resetPos(false); } + if (level && level->dimension) { + + level->dimension->FogType = options.getIntValue(OPTIONS_FOG_TYPE); + } + + this->cameraTargetPlayer = player; + std::string serverName = options.getStringValue(OPTIONS_USERNAME) + " - " + level->getLevelData()->levelName; + if (raknetInstance->isServer()) - raknetInstance->announceServer(user->name); + raknetInstance->announceServer(serverName); if (netCallback) { netCallback->levelGenerated(level); @@ -1361,6 +1507,34 @@ void Minecraft::_levelGenerated() _hasSignaledGeneratingLevelFinished = true; } +std::string Minecraft::gatherStats1() { +#ifndef STANDALONE_SERVER + return levelRenderer->gatherStats1(); +#endif + return "Blank"; +} + +std::string Minecraft::gatherStats2() { +#ifndef STANDALONE_SERVER + return levelRenderer->gatherStats2(); +#endif + return "Blank"; +} + +std::string Minecraft::gatherStats3() { +#ifndef STANDALONE_SERVER + return ("P: " + particleEngine->countParticles() + ". T: " + (level->gatherStats())); +#endif + return "Blank"; +} + +std::string Minecraft::gatherStats4() { + return level->gatherChunkSourceStats(); +} + + + + Player* Minecraft::respawnPlayer(int playerId) { for (unsigned int i = 0; i < level->players.size(); ++i) { if (level->players[i]->entityId == playerId) { @@ -1408,7 +1582,7 @@ void Minecraft::onGraphicsReset() { #ifndef STANDALONE_SERVER textures->clear(); - + font->onGraphicsReset(); gui.onGraphicsReset(); @@ -1439,20 +1613,20 @@ LevelStorageSource* Minecraft::getLevelSource() return storageSource; } -int Minecraft::getLicenseId() { - if (!LicenseCodes::isReady(_licenseId)) - _licenseId = platform()->checkLicense(); - return _licenseId; -} +// int Minecraft::getLicenseId() { +// if (!LicenseCodes::isReady(_licenseId)) +// _licenseId = platform()->checkLicense(); +// return _licenseId; +// } void Minecraft::audioEngineOn() { #ifndef STANDALONE_SERVER - soundEngine->enable(true); + soundEngine->enable(true); #endif } void Minecraft::audioEngineOff() { #ifndef STANDALONE_SERVER - soundEngine->enable(false); + soundEngine->enable(false); #endif } @@ -1513,22 +1687,35 @@ ICreator* Minecraft::getCreator() #endif } -void Minecraft::optionUpdated( const Options::Option* option, bool value ) { - if(netCallback != NULL && option == &Options::Option::SERVER_VISIBLE) { +void Minecraft::optionUpdated(OptionId option, bool value ) { + if(netCallback != NULL && option == OPTIONS_SERVER_VISIBLE) { ServerSideNetworkHandler* ss = (ServerSideNetworkHandler*) netCallback; ss->allowIncomingConnections(value); + } else if (option == OPTIONS_USE_TOUCHSCREEN) { + _reloadInput(); } } -void Minecraft::optionUpdated( const Options::Option* option, float value ) { +void Minecraft::optionUpdated(OptionId option, float value ) { + // #ifndef STANDALONE_SERVER + // if(option == OPTIONS_PIXELS_PER_MILLIMETER) { + // pixelCalcUi.setPixelsPerMillimeter(value * Gui::InvGuiScale); + // pixelCalc.setPixelsPerMillimeter(value); + // } + // #endif +} + +void Minecraft::optionUpdated(OptionId option, int value ) { + if(option == OPTIONS_GUI_SCALE) { + // reapply screen scaling using current window size + setSize(width, height); + } +} + +void Minecraft::addMessage(const std::string& msg) { #ifndef STANDALONE_SERVER - if(option == &Options::Option::PIXELS_PER_MILLIMETER) { - pixelCalcUi.setPixelsPerMillimeter(value * Gui::InvGuiScale); - pixelCalc.setPixelsPerMillimeter(value); - } + gui.addMessage(msg); +#else + LOGI("%s \n", msg.c_str()); #endif -} - -void Minecraft::optionUpdated( const Options::Option* option, int value ) { - -} +} \ No newline at end of file diff --git a/src/client/Minecraft.h b/src/client/Minecraft.h index 792183e..f1d966f 100755 --- a/src/client/Minecraft.h +++ b/src/client/Minecraft.h @@ -2,19 +2,18 @@ #define NET_MINECRAFT_CLIENT__Minecraft_H__ #include "Options.h" +#include "commands/CommandManager.hpp" #ifndef STANDALONE_SERVER #include "MouseHandler.h" -#endif -#include "Timer.h" -#include "player/input/ITurnInput.h" -#ifndef STANDALONE_SERVER #include "gui/Gui.h" #include "gui/screens/ScreenChooser.h" #endif + +#include "Timer.h" + //#include "../network/RakNetInstance.h" #include "../world/phys/HitResult.h" -class User; class Level; class LocalPlayer; class IInputHolder; @@ -80,6 +79,7 @@ public: void locateMultiplayer(); void cancelLocateMultiplayer(); bool joinMultiplayer(const PingedCompatibleServer& server); + bool joinMultiplayerFromString(const std::string& server); void hostMultiplayer(int port=19132); Player* respawnPlayer(int playerId); void respawnPlayer(); @@ -88,6 +88,14 @@ public: void update(); + std::string gatherStats1(); + + std::string gatherStats2(); + + std::string gatherStats4(); + + std::string gatherStats3(); + void tick(int nTick, int maxTick); void tickInput(); @@ -109,22 +117,29 @@ public: void onGraphicsReset(); bool isLevelGenerated(); - int getLicenseId(); + void handleMouseDown(int button, bool down); + void audioEngineOn(); void audioEngineOff(); bool isPowerVR() { return _powerVr; } bool isKindleFire(int kindleVersion); bool transformResolution(int* w, int* h); - void optionUpdated(const Options::Option* option, bool value); - void optionUpdated(const Options::Option* option, float value); - void optionUpdated(const Options::Option* option, int value); + void optionUpdated(OptionId option, bool value); + void optionUpdated(OptionId option, float value); + void optionUpdated(OptionId option, int value); + + int getTicks() { return ticks; } + + void addMessage(const std::string& msg); #ifdef __APPLE__ bool _isSuperFast; bool isSuperFast() { return _isSuperFast; } #endif + CommandManager& commandManager() { return m_commandManager; } + protected: void _levelGenerated(); @@ -166,7 +181,6 @@ public: int lastTickTime; float ticksSinceLastUpdate; - User* user; Level* level; LocalPlayer* player; @@ -198,7 +212,8 @@ public: std::string externalCacheStoragePath; protected: Timer timer; - // @note @attn @warn: this is dangerous as fuck! + + // @note @attn @warn: this is dangerous as fuck! volatile bool isGeneratingLevel; bool _hasSignaledGeneratingLevelFinished; @@ -222,9 +237,12 @@ private: bool _isCreativeMode; //int _respawnPlayerTicks; Player* _pendingRemovePlayer; // @attn @todo @fix: remove this shait and fix the respawn behaviour + // shit* lmao PerfRenderer* _perfRenderer; CommandServer* _commandServer; + + CommandManager m_commandManager; }; #endif /*NET_MINECRAFT_CLIENT__Minecraft_H__*/ diff --git a/src/client/MouseHandler.cpp b/src/client/MouseHandler.cpp index 7855e41..d77e28b 100755 --- a/src/client/MouseHandler.cpp +++ b/src/client/MouseHandler.cpp @@ -5,7 +5,7 @@ #include #endif -#ifdef PLATFORM_GLFW +#if defined(PLATFORM_DESKTOP) || defined(PLATFORM_WEB) #include #endif @@ -34,7 +34,7 @@ void MouseHandler::grab() { SDL_ShowCursor(0); #endif -#ifdef PLATFORM_GLFW +#if defined(PLATFORM_DESKTOP) || defined(PLATFORM_WEB) glfwSetInputMode(glfwGetCurrentContext(), GLFW_CURSOR, GLFW_CURSOR_DISABLED); #endif } @@ -46,7 +46,7 @@ void MouseHandler::release() { SDL_ShowCursor(1); #endif -#ifdef PLATFORM_GLFW +#if defined(PLATFORM_DESKTOP) || defined(PLATFORM_WEB) glfwSetInputMode(glfwGetCurrentContext(), GLFW_CURSOR, GLFW_CURSOR_NORMAL); #endif } diff --git a/src/client/Option.cpp b/src/client/Option.cpp new file mode 100644 index 0000000..5b8c422 --- /dev/null +++ b/src/client/Option.cpp @@ -0,0 +1,52 @@ +#include "Option.h" +#include +#include + +Option::~Option() {} + +bool Option::parse_bool_like(const std::string& value, bool& out) { + if (value == "true" || value == "YES") { + out = true; + return true; + } + + if (value == "false" || value == "NO") { + out = false; + return true; + } + + return false; +} + +bool OptionFloat::parse(const std::string& value) { + bool b; + + if (parse_bool_like(value, b)) { + m_value = b ? 1.f : 0.f; + return true; + } + + return sscanf(value.c_str(), "%f", &m_value) == 1; +} +bool OptionInt::parse(const std::string& value) { + bool b; + if (parse_bool_like(value, b)) { + m_value = b ? 1 : 0; + return true; + } + + return sscanf(value.c_str(), "%d", &m_value) == 1; +} +bool OptionBool::parse(const std::string& value) { + if (value == "0") { + m_value = false; + return true; + } + + if (value == "1") { + m_value = true; + return true; + } + + return parse_bool_like(value, m_value); +} \ No newline at end of file diff --git a/src/client/Option.h b/src/client/Option.h new file mode 100644 index 0000000..7c813c1 --- /dev/null +++ b/src/client/Option.h @@ -0,0 +1,107 @@ +#pragma once +#include +#include +#include +/* +template +struct is_option_type : std::false_type {}; + +template<> struct is_option_type : std::true_type {}; +template<> struct is_option_type : std::true_type {}; +template<> struct is_option_type : std::true_type {}; +template<> struct is_option_type : std::true_type {}; + +template +struct is_min_max_option : std::false_type {}; + +template<> struct is_min_max_option : std::true_type {}; +template<> struct is_min_max_option : std::true_type {}; +*/ + +class Option { +public: + Option(const std::string& key) : m_key("options." + key) {} + virtual ~Option(); + + const std::string& getStringId() { return m_key; } + + virtual bool parse(const std::string& value) { return false; } + virtual std::string serialize() { return m_key + ":"; } + +protected: + std::string m_key; + + template + std::string serialize_value(const T& value) const { + std::ostringstream ss; + ss << m_key << ":" << value; + return ss.str(); + } + + bool parse_bool_like(const std::string& value, bool& out); +}; + +class OptionFloat : public Option { +public: + OptionFloat(const std::string& key, float value = 0.f, float min = 0.f, float max = 1.f) : + Option(key), m_value(value), m_min(min), m_max(max) {} + + float get() { return m_value; } + void set(float value) { m_value = Mth::clamp(value, m_min, m_max); } + + float getMin() { return m_min; } + float getMax() { return m_max; } + + virtual bool parse(const std::string& value); + virtual std::string serialize() { return serialize_value(m_value); } + +private: + float m_value, m_min, m_max; +}; + +class OptionInt : public Option { +public: + OptionInt(const std::string& key, int value = 0, int min = -999999, int max = 999999) : + Option(key), m_value(value), m_min(min), m_max(max) {} + + int get() { return m_value; } + void set(int value) { m_value = Mth::clamp(value, m_min, m_max); } + + int getMin() { return m_min; } + int getMax() { return m_max; } + + virtual bool parse(const std::string& value); + virtual std::string serialize() { return serialize_value(m_value); } + +private: + int m_value, m_min, m_max; +}; + +class OptionBool : public Option { +public: + OptionBool(const std::string& key, bool value = false) : Option(key), m_value(value) {} + + bool get() { return m_value; } + void set(int value) { m_value = value; } + void toggle() { m_value = !m_value; } + + virtual bool parse(const std::string& value); + virtual std::string serialize() { return serialize_value(m_value); } + +private: + bool m_value; +}; + +class OptionString : public Option { +public: + OptionString(const std::string& key, const std::string& str = "") : Option(key), m_value(str) {} + + const std::string& get() { return m_value; } + void set(const std::string& value) { m_value = value; } + + virtual bool parse(const std::string& value) { m_value = value; return true; } + virtual std::string serialize() { return m_key + ":" + m_value; } + +private: + std::string m_value; +}; diff --git a/src/client/OptionStrings.cpp b/src/client/OptionStrings.cpp index ba068d7..b856d17 100755 --- a/src/client/OptionStrings.cpp +++ b/src/client/OptionStrings.cpp @@ -5,12 +5,20 @@ const char* OptionStrings::Multiplayer_ServerVisible = "mp_server_visible_defa const char* OptionStrings::Graphics_Fancy = "gfx_fancygraphics"; const char* OptionStrings::Graphics_LowQuality = "gfx_lowquality"; +const char* OptionStrings::Graphics_Vsync = "gfx_vsync"; +const char* OptionStrings::Graphics_GUIScale = "gfx_guiscale"; +const char* OptionStrings::Graphics_SmoothLightning = "gfx_smoothlightning"; +const char* OptionStrings::Graphics_Anaglyph = "gfx_anaglyph"; +const char* OptionStrings::Graphics_ViewBobbing = "gfx_viewbobbing"; const char* OptionStrings::Controls_Sensitivity = "ctrl_sensitivity"; const char* OptionStrings::Controls_InvertMouse = "ctrl_invertmouse"; const char* OptionStrings::Controls_UseTouchScreen = "ctrl_usetouchscreen"; const char* OptionStrings::Controls_UseTouchJoypad = "ctrl_usetouchjoypad"; const char* OptionStrings::Controls_IsLefthanded = "ctrl_islefthanded"; +// why it isnt ctrl_feedback_vibration? i dont want touch it because compatibility with older versions const char* OptionStrings::Controls_FeedbackVibration = "feedback_vibration"; +const char* OptionStrings::Controls_AutoJump = "ctrl_autojump"; const char* OptionStrings::Game_DifficultyLevel = "game_difficulty"; + diff --git a/src/client/OptionStrings.h b/src/client/OptionStrings.h index d536fa0..3f4e839 100755 --- a/src/client/OptionStrings.h +++ b/src/client/OptionStrings.h @@ -8,15 +8,29 @@ public: static const char* Graphics_Fancy; static const char* Graphics_LowQuality; - + static const char* Graphics_GUIScale; + static const char* Graphics_Vsync; + static const char* Graphics_SmoothLightning; + static const char* Graphics_Anaglyph; + static const char* Graphics_ViewBobbing; + static const char* Controls_Sensitivity; static const char* Controls_InvertMouse; static const char* Controls_UseTouchScreen; static const char* Controls_UseTouchJoypad; static const char* Controls_IsLefthanded; static const char* Controls_FeedbackVibration; + static const char* Controls_AutoJump; + + static const char* Audio_Music; + static const char* Audio_Sound; + static const char* Game_DifficultyLevel; + + static const char* Tweaks_Sprint; + static const char* Tweaks_BarOnTop; + }; #endif /*NET_MINECRAFT_CLIENT__OptionsStrings_H__*/ diff --git a/src/client/Options.cpp b/src/client/Options.cpp index 0866c5e..c67f68d 100755 --- a/src/client/Options.cpp +++ b/src/client/Options.cpp @@ -4,458 +4,343 @@ #include "../platform/log.h" #include "../world/Difficulty.h" #include -#include -/*static*/ + +#include + bool Options::debugGl = false; -void Options::initDefaultValues() { - difficulty = Difficulty::NORMAL; - hideGui = false; - thirdPersonView = false; - renderDebug = false; - isFlying = false; - smoothCamera = true; - fixedCamera = false; - flySpeed = 1; - cameraSpeed = 1; - guiScale = 0; +// OPTIONS TABLE - useMouseForDigging = false; - destroyVibration = true; - isLeftHanded = false; +OptionInt difficulty("difficulty", Difficulty::NORMAL, 0, Difficulty::COUNT); +OptionBool hidegui("hidegui", false); +OptionBool thirdPersonView("thirdperson", false); +OptionBool renderDebug("renderDebug", false); +OptionBool smoothCamera("smoothCamera", false); +OptionBool fixedCamera("fixedCamera", false); +OptionBool isFlying("isflying", false); +OptionBool barOnTop("barOnTop", false); +OptionBool allowSprint("allowSprint", true); +OptionBool rpiCursor("rpiCursor", false); +OptionBool autoJump("autoJump", true); - isJoyTouchArea = false; - music = 1; - sound = 1; - sensitivity = 0.5f; - invertYMouse = false; - viewDistance = 2; - bobView = true; - anaglyph3d = false; - limitFramerate = false; - fancyGraphics = true;//false; - ambientOcclusion = false; - if(minecraft->supportNonTouchScreen()) - useTouchScreen = false; - else - useTouchScreen = true; - pixelsPerMillimeter = minecraft->platform()->getPixelsPerMillimeter(); - //useMouseForDigging = true; +OptionFloat flySpeed("flySpeed", 1.f); +OptionFloat cameraSpeed("cameraSpeed", 1.f); - //skin = "Default"; - username = "Steve"; - serverVisible = true; +OptionInt guiScale("guiScale", 0, 0, 5); - keyUp = KeyMapping("key.forward", Keyboard::KEY_W); - keyLeft = KeyMapping("key.left", Keyboard::KEY_A); - keyDown = KeyMapping("key.back", Keyboard::KEY_S); - keyRight = KeyMapping("key.right", Keyboard::KEY_D); - keyJump = KeyMapping("key.jump", Keyboard::KEY_SPACE); - keyBuild = KeyMapping("key.inventory", Keyboard::KEY_E); - keySneak = KeyMapping("key.sneak", Keyboard::KEY_LSHIFT); -#ifndef RPI - // keyCraft = KeyMapping("key.crafting", Keyboard::KEY_Q); - keyDrop = KeyMapping("key.drop", Keyboard::KEY_Q); - keyChat = KeyMapping("key.chat", Keyboard::KEY_T); - keyFog = KeyMapping("key.fog", Keyboard::KEY_F); - keyDestroy=KeyMapping("key.destroy", 88); // @todo @fix - keyUse = KeyMapping("key.use", Keyboard::KEY_U); +OptionString skin("skin", "Default"); + +#ifdef RPI +OptionString username("username", "StevePi"); +#else +OptionString username("username", "Steve"); #endif - //const int Unused = 99999; - keyMenuNext = KeyMapping("key.menu.next", 40); - keyMenuPrevious = KeyMapping("key.menu.previous", 38); - keyMenuOk = KeyMapping("key.menu.ok", 13); - keyMenuCancel = KeyMapping("key.menu.cancel", 8); +OptionBool destroyVibration("destroyVibration", true); +OptionBool isLeftHanded("isLeftHanded", false); +OptionBool isJoyTouchArea("isJoyTouchArea", false); - int k = 0; - keyMappings[k++] = &keyUp; - keyMappings[k++] = &keyLeft; - keyMappings[k++] = &keyDown; - keyMappings[k++] = &keyRight; - keyMappings[k++] = &keyJump; - keyMappings[k++] = &keySneak; - keyMappings[k++] = &keyDrop; - keyMappings[k++] = &keyBuild; - keyMappings[k++] = &keyChat; - keyMappings[k++] = &keyFog; - keyMappings[k++] = &keyDestroy; - keyMappings[k++] = &keyUse; +OptionFloat musicVolume("music", 1.f, MUSIC_MIN_VALUE, MUSIC_MAX_VALUE); +OptionFloat soundVolume("sound", 1.f, SOUND_MIN_VALUE, SOUND_MAX_VALUE); - keyMappings[k++] = &keyMenuNext; - keyMappings[k++] = &keyMenuPrevious; - keyMappings[k++] = &keyMenuOk; - keyMappings[k++] = &keyMenuCancel; +OptionFloat sensitivityOpt("sensitivity", 0.5f, SENSITIVITY_MIN_VALUE, SENSITIVITY_MAX_VALUE); -// "Polymorphism" at it's worst. At least it's better to have it here -// for now, then to have it spread all around the game code (even if -// it would be slightly better performance with it inlined. Should -// probably create separate subclasses (or read from file). @fix @todo. -#if defined(ANDROID) || defined(__APPLE__) || defined(RPI) - viewDistance = 2; - thirdPersonView = false; - useMouseForDigging = false; - fancyGraphics = false; +OptionBool invertYMouse("invertMouse", false); +OptionInt viewDistance("renderDistance", 2, 0, 4); - //renderDebug = true; - #if !defined(RPI) - keyUp.key = 19; - keyDown.key = 20; - keyLeft.key = 21; - keyRight.key = 22; - keyJump.key = 23; - keyUse.key = 103; - keyDestroy.key = 102; - keyCraft.key = 109; +OptionBool anaglyph3d("anaglyph3d", false); +OptionBool limitFramerate("limitFramerate", false); +OptionBool vsync("vsync", true); +OptionBool fancyGraphics("fancyGraphics", true); +OptionBool viewBobbing("viewBobbing", true); +OptionBool ambientOcclusion("ao", true); - keyMenuNext.key = 20; - keyMenuPrevious.key = 19; - keyMenuOk.key = 23; - keyMenuCancel.key = 4; +OptionBool useNormalLighting("normalLighting", true); + +OptionBool beautifulSky("beautifulSky", true); + +OptionBool useVignette("useVignette", true); + +OptionBool useTouchscreen("useTouchscreen", true); + +OptionBool serverVisible("servervisible", true); +OptionBool foliageTint("foliagetint", false); +OptionInt fogType("fogType", 0, 0, 2); + +OptionBool javaHud("javaHud", false); + +OptionBool betaSky("betaSky", false); +OptionBool tintedSide("tintedSide", false); +OptionBool blockOutline("blockOutline", false); + +OptionBool restoredAnims("restoredAnims", true); + +OptionInt debugStyle("debugStyle", 0, 0, 1); + +OptionInt menuStyle("menuStyle",0, 0, 2); + +OptionBool windowScale("windowScale", false); + +OptionInt keyForward("key.forward", Keyboard::KEY_W); +OptionInt keyLeft("key.left", Keyboard::KEY_A); +OptionInt keyBack("key.back", Keyboard::KEY_S); +OptionInt keyRight("key.right", Keyboard::KEY_D); +OptionInt keyJump("key.jump", Keyboard::KEY_SPACE); +OptionInt keyInventory("key.inventory", Keyboard::KEY_E); +OptionInt keySneak("key.sneak", Keyboard::KEY_LSHIFT); +OptionInt keyDrop("key.drop", Keyboard::KEY_Q); +OptionInt keyChat("key.chat", Keyboard::KEY_T); +OptionInt keyFog("key.fog", Keyboard::KEY_F); +OptionInt keyUse("key.use", Keyboard::KEY_U); + +// TODO: make human readable keycodes here +OptionInt keyMenuNext("key.menu.next", 40); +OptionInt keyMenuPrev("key.menu.previous", 38); +OptionInt keyMenuOk("key.menu.ok", 13); +OptionInt keyMenuCancel("key.menu.cancel", 8); + +OptionBool firstLaunch("firstLaunch", true); + +OptionString lastIp("lastip"); + +void Options::initTable() { + m_options[OPTIONS_DIFFICULTY] = &difficulty; + m_options[OPTIONS_HIDEGUI] = &hidegui; + m_options[OPTIONS_THIRD_PERSON_VIEW] = &thirdPersonView; + m_options[OPTIONS_RENDER_DEBUG] = &renderDebug; + m_options[OPTIONS_SMOOTH_CAMERA] = &smoothCamera; + m_options[OPTIONS_FIXED_CAMERA] = &fixedCamera; + m_options[OPTIONS_IS_FLYING] = &isFlying; + + m_options[OPTIONS_FLY_SPEED] = &flySpeed; + m_options[OPTIONS_CAMERA_SPEED] = &cameraSpeed; + + m_options[OPTIONS_GUI_SCALE] = &guiScale; + + m_options[OPTIONS_DESTROY_VIBRATION] = &destroyVibration; + + m_options[OPTIONS_IS_LEFT_HANDED] = &isLeftHanded; + m_options[OPTIONS_IS_JOY_TOUCH_AREA] = &isJoyTouchArea; + + m_options[OPTIONS_MUSIC_VOLUME] = &musicVolume; + m_options[OPTIONS_SOUND_VOLUME] = &soundVolume; + + #if defined(PLATFORM_DESKTOP) || defined(RPI) + float sensitivity = sensitivityOpt.get(); + sensitivity *= 0.4f; + sensitivityOpt.set(sensitivity); #endif -#endif -#if defined(PLATFORM_DESKTOP) || defined(RPI) - sensitivity *= 0.4f; -#endif -#if defined(RPI) - username = "StevePi"; - useMouseForDigging = true; -#endif + + + m_options[OPTIONS_GUI_SCALE] = &guiScale; + m_options[OPTIONS_WINDOW_SCALE] = &windowScale; + + m_options[OPTIONS_SKIN] = &skin; + m_options[OPTIONS_USERNAME] = &username; + + m_options[OPTIONS_DESTROY_VIBRATION] = &destroyVibration; + m_options[OPTIONS_IS_LEFT_HANDED] = &isLeftHanded; + + m_options[OPTIONS_MUSIC_VOLUME] = &musicVolume; + m_options[OPTIONS_SOUND_VOLUME] = &soundVolume; + + m_options[OPTIONS_SENSITIVITY] = &sensitivityOpt; + + m_options[OPTIONS_INVERT_Y_MOUSE] = &invertYMouse; + m_options[OPTIONS_VIEW_DISTANCE] = &viewDistance; + + m_options[OPTIONS_ANAGLYPH_3D] = &anaglyph3d; + m_options[OPTIONS_LIMIT_FRAMERATE] = &limitFramerate; + m_options[OPTIONS_VSYNC] = &vsync; + m_options[OPTIONS_FANCY_GRAPHICS] = &fancyGraphics; + m_options[OPTIONS_VIEW_BOBBING] = &viewBobbing; + m_options[OPTIONS_AMBIENT_OCCLUSION] = &ambientOcclusion; + + m_options[OPTIONS_USE_TOUCHSCREEN] = &useTouchscreen; + + m_options[OPTIONS_BLOCK_OUTLINE] = &blockOutline; + + m_options[OPTIONS_VIGNETTE] = &useVignette; + + m_options[OPTIONS_BEAUTIFUL_SKY] = &beautifulSky; + + m_options[OPTIONS_NORMAL_LIGHTING] = &useNormalLighting; + + m_options[OPTIONS_RESTORED_ANIMS] = &restoredAnims; + + m_options[OPTIONS_SERVER_VISIBLE] = &serverVisible; + + m_options[OPTIONS_MENU_STYLE] = &menuStyle; + + m_options[OPTIONS_KEY_FORWARD] = &keyForward; + m_options[OPTIONS_KEY_LEFT] = &keyLeft; + m_options[OPTIONS_KEY_BACK] = &keyBack; + m_options[OPTIONS_KEY_RIGHT] = &keyRight; + m_options[OPTIONS_KEY_JUMP] = &keyJump; + m_options[OPTIONS_KEY_INVENTORY] = &keyInventory; + m_options[OPTIONS_KEY_SNEAK] = &keySneak; + m_options[OPTIONS_KEY_DROP] = &keyDrop; + m_options[OPTIONS_KEY_CHAT] = &keyChat; + m_options[OPTIONS_KEY_FOG] = &keyFog; + m_options[OPTIONS_KEY_USE] = &keyUse; + + m_options[OPTIONS_KEY_MENU_NEXT] = &keyMenuNext; + m_options[OPTIONS_KEY_MENU_PREV] = &keyMenuPrev; + m_options[OPTIONS_KEY_MENU_OK] = &keyMenuOk; + m_options[OPTIONS_KEY_MENU_CANCEL] = &keyMenuCancel; + + m_options[OPTIONS_FIRST_LAUNCH] = &firstLaunch; + + m_options[OPTIONS_BAR_ON_TOP] = &barOnTop; + m_options[OPTIONS_ALLOW_SPRINT] = &allowSprint; + m_options[OPTIONS_RPI_CURSOR] = &rpiCursor; + m_options[OPTIONS_FOLIAGE_TINT] = &foliageTint; + // more options yay + m_options[OPTIONS_FOG_TYPE] = &fogType; + + m_options[OPTIONS_DEBUG_STYLE] = &debugStyle; + + m_options[OPTIONS_BETA_SKY] = &betaSky; + m_options[OPTIONS_TINTED_SIDE] = &tintedSide; + m_options[OPTIONS_JAVA_HUD] = &javaHud; + + m_options[OPTIONS_AUTOJUMP] = &autoJump; + m_options[OPTIONS_LAST_IP] = &lastIp; } -const Options::Option - Options::Option::MUSIC (0, "options.music", true, false), - Options::Option::SOUND (1, "options.sound", true, false), - Options::Option::INVERT_MOUSE (2, "options.invertMouse", false, true), - Options::Option::SENSITIVITY (3, "options.sensitivity", true, false), - Options::Option::RENDER_DISTANCE (4, "options.renderDistance",false, false), - Options::Option::VIEW_BOBBING (5, "options.viewBobbing", false, true), - Options::Option::ANAGLYPH (6, "options.anaglyph", false, true), - Options::Option::LIMIT_FRAMERATE (7, "options.limitFramerate",false, true), - Options::Option::DIFFICULTY (8, "options.difficulty", false, false), - Options::Option::GRAPHICS (9, "options.graphics", false, false), - Options::Option::AMBIENT_OCCLUSION (10, "options.ao", false, true), - Options::Option::GUI_SCALE (11, "options.guiScale", false, false), - Options::Option::THIRD_PERSON (12, "options.thirdperson", false, true), - Options::Option::HIDE_GUI (13, "options.hidegui", false, true), - Options::Option::SERVER_VISIBLE (14, "options.servervisible", false, true), - Options::Option::LEFT_HANDED (15, "options.lefthanded", false, true), - Options::Option::USE_TOUCHSCREEN (16, "options.usetouchscreen", false, true), - Options::Option::USE_TOUCH_JOYPAD (17, "options.usetouchpad", false, true), - Options::Option::DESTROY_VIBRATION (18, "options.destroyvibration", false, true), - Options::Option::PIXELS_PER_MILLIMETER(19, "options.pixelspermilimeter", true, false); +void Options::set(OptionId key, const std::string& value) { + auto option = opt(key); -/* private */ -const float Options::SOUND_MIN_VALUE = 0.0f; -const float Options::SOUND_MAX_VALUE = 1.0f; -const float Options::MUSIC_MIN_VALUE = 0.0f; -const float Options::MUSIC_MAX_VALUE = 1.0f; -const float Options::SENSITIVITY_MIN_VALUE = 0.0f; -const float Options::SENSITIVITY_MAX_VALUE = 1.0f; -const float Options::PIXELS_PER_MILLIMETER_MIN_VALUE = 3.0f; -const float Options::PIXELS_PER_MILLIMETER_MAX_VALUE = 4.0f; -const int DIFFICULY_LEVELS[] = { - Difficulty::PEACEFUL, - Difficulty::NORMAL -}; + if (option) { + option->set(value); + notifyOptionUpdate(key, value); + } +} -/*private*/ -const char* Options::RENDER_DISTANCE_NAMES[] = { - "options.renderDistance.far", - "options.renderDistance.normal", - "options.renderDistance.short", - "options.renderDistance.tiny" -}; +void Options::set(OptionId key, float value) { + auto option = opt(key); -/*private*/ -const char* Options::DIFFICULTY_NAMES[] = { - "options.difficulty.peaceful", - "options.difficulty.easy", - "options.difficulty.normal", - "options.difficulty.hard" -}; + if (option) { + option->set(value); + notifyOptionUpdate(key, value); + } +} -/*private*/ -const char* Options::GUI_SCALE[] = { - "options.guiScale.auto", - "options.guiScale.small", - "options.guiScale.normal", - "options.guiScale.large" -}; +void Options::set(OptionId key, int value) { + auto option = opt(key); -void Options::update() -{ - viewDistance = 2; + if (option) { + option->set(value); + notifyOptionUpdate(key, value); + } +} + +void Options::toggle(OptionId key) { + auto option = opt(key); + + if (option) { + option->toggle(); + notifyOptionUpdate(key, option->get()); + } +} + +void Options::load() { StringVector optionStrings = optionsFile.getOptionStrings(); - for (unsigned int i = 0; i < optionStrings.size(); i += 2) { + + for (auto i = 0; i < optionStrings.size(); i += 2) { const std::string& key = optionStrings[i]; const std::string& value = optionStrings[i+1]; - //LOGI("reading key: %s (%s)\n", key.c_str(), value.c_str()); + // FIXME: woah this is so slow + auto opt = std::find_if(m_options.begin(), m_options.end(), [&](auto& it) { + return it != nullptr && it->getStringId() == key; + }); + + if (opt == m_options.end()) continue; + + (*opt)->parse(value); +/* + // //LOGI("reading key: %s (%s)\n", key.c_str(), value.c_str()); - // Multiplayer - if (key == OptionStrings::Multiplayer_Username) username = value; - if (key == OptionStrings::Multiplayer_ServerVisible) readBool(value, serverVisible); + // // Multiplayer + // // if (key == OptionStrings::Multiplayer_Username) username = value; + // if (key == OptionStrings::Multiplayer_ServerVisible) { + // m_options[OPTIONS_SERVER_VISIBLE] = readBool(value); + // } - // Controls - if (key == OptionStrings::Controls_Sensitivity) { - float sens; - if (readFloat(value, sens)) { - // sens is in range [0,1] with default/center at 0.5 (for aesthetics) - // We wanna map it to something like [0.3, 0.9] BUT keep 0.5 @ ~0.5... - sensitivity = 0.3f + std::pow(1.1f * sens, 1.3f) * 0.42f; - } - } - if (key == OptionStrings::Controls_InvertMouse) { - readBool(value, invertYMouse); - } - if (key == OptionStrings::Controls_IsLefthanded) { - readBool(value, isLeftHanded); - } - if (key == OptionStrings::Controls_UseTouchJoypad) { - readBool(value, isJoyTouchArea); - if (!minecraft->useTouchscreen()) - isJoyTouchArea = false; - } + // // Controls + // if (key == OptionStrings::Controls_Sensitivity) { + // float sens = readFloat(value); - // Feedback - if (key == OptionStrings::Controls_FeedbackVibration) - readBool(value, destroyVibration); + // // sens is in range [0,1] with default/center at 0.5 (for aesthetics) + // // We wanna map it to something like [0.3, 0.9] BUT keep 0.5 @ ~0.5... + // m_options[OPTIONS_SENSITIVITY] = 0.3f + std::pow(1.1f * sens, 1.3f) * 0.42f; + // } - // Graphics - if (key == OptionStrings::Graphics_Fancy) { - readBool(value, fancyGraphics); - } - if (key == OptionStrings::Graphics_LowQuality) { - bool isLow; - readBool(value, isLow); - if (isLow) { - viewDistance = 3; - fancyGraphics = false; - } - } - // Game - if (key == OptionStrings::Game_DifficultyLevel) { - readInt(value, difficulty); - // Only support peaceful and normal right now - if (difficulty != Difficulty::PEACEFUL && difficulty != Difficulty::NORMAL) - difficulty = Difficulty::NORMAL; - } + // if (key == OptionStrings::Controls_InvertMouse) { + // m_options[OPTIONS_INVERT_Y_MOUSE] = readBool(value); + // } + + // if (key == OptionStrings::Controls_IsLefthanded) { + // m_options[OPTIONS_IS_LEFT_HANDED] = readBool(value); + // } + + // if (key == OptionStrings::Controls_UseTouchJoypad) { + // m_options[OPTIONS_IS_JOY_TOUCH_AREA] = readBool(value) && minecraft->useTouchscreen(); + // } + + // // Feedback + // if (key == OptionStrings::Controls_FeedbackVibration) { + // m_options[OPTIONS_DESTROY_VIBRATION] = readBool(value); + // } + + // // Graphics + // if (key == OptionStrings::Graphics_Fancy) { + // m_options[OPTIONS_FANCY_GRAPHICS] = readBool(value); + // } + + // // Graphics extras + // if (key == OptionStrings::Graphics_Vsync) { + // m_options[OPTIONS_VSYNC] = readBool(value); + // } + + // if (key == OptionStrings::Graphics_GUIScale) { + // m_options[OPTIONS_GUI_SCALE] = readInt(value) % 5; + // } + + // // Game + // if (key == OptionStrings::Game_DifficultyLevel) { + // readInt(value, difficulty); + // // Only support peaceful and normal right now + // if (difficulty != Difficulty::PEACEFUL && difficulty != Difficulty::NORMAL) + // difficulty = Difficulty::NORMAL; + // }*/ } - -#ifdef __APPLE__ -// if (minecraft->isSuperFast()) { -// viewDistance = (viewDistance>0)? --viewDistance : 0; -// } -// LOGI("Is this card super fast?: %d\n", viewDistance); -#endif - - //LOGI("Lefty is: %d\n", isLeftHanded); } -void Options::load() -{ - int a = 0; - //try { - // if (!optionsFile.exists()) return; - // BufferedReader br = /*new*/ BufferedReader(/*new*/ FileReader(optionsFile)); - // std::string line = ""; - // while ((line = br.readLine()) != NULL) { - // std::string[] cmds = line.split(":"); - // if (cmds[0].equals("music")) music = readFloat(cmds[1]); - // if (cmds[0].equals("sound")) sound = readFloat(cmds[1]); - // if (cmds[0].equals("mouseSensitivity")) sensitivity = readFloat(cmds[1]); - // if (cmds[0].equals("invertYMouse")) invertYMouse = cmds[1].equals("true"); - // if (cmds[0].equals("viewDistance")) viewDistance = Integer.parseInt(cmds[1]); - // if (cmds[0].equals("guiScale")) guiScale = Integer.parseInt(cmds[1]); - // if (cmds[0].equals("bobView")) bobView = cmds[1].equals("true"); - // if (cmds[0].equals("anaglyph3d")) anaglyph3d = cmds[1].equals("true"); - // if (cmds[0].equals("limitFramerate")) limitFramerate = cmds[1].equals("true"); - // if (cmds[0].equals("difficulty")) difficulty = Integer.parseInt(cmds[1]); - // if (cmds[0].equals("fancyGraphics")) fancyGraphics = cmds[1].equals("true"); - // if (cmds[0].equals("ao")) ambientOcclusion = cmds[1].equals("true"); - // if (cmds[0].equals("skin")) skin = cmds[1]; - // if (cmds[0].equals("lastServer") && cmds.length >= 2) lastMpIp = cmds[1]; - - // for (int i = 0; i < keyMappings.length; i++) { - // if (cmds[0].equals("key_" + keyMappings[i].name)) { - // keyMappings[i].key = Integer.parseInt(cmds[1]); - // } - // } - // } - // br.close(); - //} catch (Exception e) { - // System.out.println("Failed to load options"); - // e.printStackTrace(); - //} -} - -void Options::save() -{ +void Options::save() { StringVector stringVec; - // Game - addOptionToSaveOutput(stringVec, OptionStrings::Multiplayer_ServerVisible, serverVisible); - addOptionToSaveOutput(stringVec, OptionStrings::Game_DifficultyLevel, difficulty); + + for (auto& it : m_options) { + if (it) stringVec.push_back(it->serialize()); + } - // Input - addOptionToSaveOutput(stringVec, OptionStrings::Controls_InvertMouse, invertYMouse); - addOptionToSaveOutput(stringVec, OptionStrings::Controls_Sensitivity, sensitivity); - addOptionToSaveOutput(stringVec, OptionStrings::Controls_IsLefthanded, isLeftHanded); - addOptionToSaveOutput(stringVec, OptionStrings::Controls_UseTouchScreen, useTouchScreen); - addOptionToSaveOutput(stringVec, OptionStrings::Controls_UseTouchJoypad, isJoyTouchArea); - addOptionToSaveOutput(stringVec, OptionStrings::Controls_FeedbackVibration, destroyVibration); -// -// static const Option MUSIC; -// static const Option SOUND; -// static const Option INVERT_MOUSE; -// static const Option SENSITIVITY; -// static const Option RENDER_DISTANCE; -// static const Option VIEW_BOBBING; -// static const Option ANAGLYPH; -// static const Option LIMIT_FRAMERATE; -// static const Option DIFFICULTY; -// static const Option GRAPHICS; -// static const Option AMBIENT_OCCLUSION; -// static const Option GUI_SCALE; -// -// static const Option THIRD_PERSON; -// static const Option HIDE_GUI; - //try { - // PrintWriter pw = /*new*/ PrintWriter(/*new*/ FileWriter(optionsFile)); - - // pw.println("music:" + music); - // pw.println("sound:" + sound); - // pw.println("invertYMouse:" + invertYMouse); - // pw.println("mouseSensitivity:" + sensitivity); - // pw.println("viewDistance:" + viewDistance); - // pw.println("guiScale:" + guiScale); - // pw.println("bobView:" + bobView); - // pw.println("anaglyph3d:" + anaglyph3d); - // pw.println("limitFramerate:" + limitFramerate); - // pw.println("difficulty:" + difficulty); - // pw.println("fancyGraphics:" + fancyGraphics); - // pw.println("ao:" + ambientOcclusion); - // pw.println("skin:" + skin); - // pw.println("lastServer:" + lastMpIp); - - // for (int i = 0; i < keyMappings.length; i++) { - // pw.println("key_" + keyMappings[i].name + ":" + keyMappings[i].key); - // } - - // pw.close(); - //} catch (Exception e) { - // System.out.println("Failed to save options"); - // e.printStackTrace(); - //} -} -void Options::addOptionToSaveOutput(StringVector& stringVector, std::string name, bool boolValue) { - std::stringstream ss; - ss << name << ":" << boolValue; - stringVector.push_back(ss.str()); -} -void Options::addOptionToSaveOutput(StringVector& stringVector, std::string name, float floatValue) { - std::stringstream ss; - ss << name << ":" << floatValue; - stringVector.push_back(ss.str()); -} -void Options::addOptionToSaveOutput(StringVector& stringVector, std::string name, int intValue) { - std::stringstream ss; - ss << name << ":" << intValue; - stringVector.push_back(ss.str()); + optionsFile.save(stringVec); } -std::string Options::getMessage( const Option* item ) -{ - return "Options::getMessage - Not implemented"; - - //Language language = Language.getInstance(); - //std::string caption = language.getElement(item.getCaptionId()) + ": "; - - //if (item.isProgress()) { - // float progressValue = getProgressValue(item); - - // if (item == Option.SENSITIVITY) { - // if (progressValue == 0) { - // return caption + language.getElement("options.sensitivity.min"); - // } - // if (progressValue == 1) { - // return caption + language.getElement("options.sensitivity.max"); - // } - // return caption + (int) (progressValue * 200) + "%"; - // } else { - // if (progressValue == 0) { - // return caption + language.getElement("options.off"); - // } - // return caption + (int) (progressValue * 100) + "%"; - // } - //} else if (item.isBoolean()) { - - // bool booleanValue = getBooleanValue(item); - // if (booleanValue) { - // return caption + language.getElement("options.on"); - // } - // return caption + language.getElement("options.off"); - //} else if (item == Option.RENDER_DISTANCE) { - // return caption + language.getElement(RENDER_DISTANCE_NAMES[viewDistance]); - //} else if (item == Option.DIFFICULTY) { - // return caption + language.getElement(DIFFICULTY_NAMES[difficulty]); - //} else if (item == Option.GUI_SCALE) { - // return caption + language.getElement(GUI_SCALE[guiScale]); - //} else if (item == Option.GRAPHICS) { - // if (fancyGraphics) { - // return caption + language.getElement("options.graphics.fancy"); - // } - // return caption + language.getElement("options.graphics.fast"); - //} - - //return caption; +void Options::setOptionsFilePath(const std::string& path) { + optionsFile.setOptionsPath(path + "/options.txt"); } -/*static*/ -bool Options::readFloat(const std::string& string, float& value) { - if (string == "true" || string == "YES") { value = 1; return true; } - if (string == "false" || string == "NO") { value = 0; return true; } -#ifdef _WIN32 - if (sscanf_s(string.c_str(), "%f", &value)) - return true; -#else - if (sscanf(string.c_str(), "%f", &value)) - return true; -#endif - return false; +void Options::notifyOptionUpdate(OptionId key, bool value) { + minecraft->optionUpdated(key, value); } -/*static*/ -bool Options::readInt(const std::string& string, int& value) { - if (string == "true" || string == "YES") { value = 1; return true; } - if (string == "false" || string == "NO") { value = 0; return true; } -#ifdef _WIN32 - if (sscanf_s(string.c_str(), "%d", &value)) - return true; -#else - if (sscanf(string.c_str(), "%d", &value)) - return true; -#endif - return false; +void Options::notifyOptionUpdate(OptionId key, float value) { + minecraft->optionUpdated(key, value); } -/*static*/ -bool Options::readBool(const std::string& string, bool& value) { - std::string s = Util::stringTrim(string); - if (string == "true" || string == "1" || string == "YES") { value = true; return true; } - if (string == "false" || string == "0" || string == "NO") { value = false; return true; } - return false; -} - -void Options::notifyOptionUpdate( const Option* option, bool value ) { - minecraft->optionUpdated(option, value); -} - -void Options::notifyOptionUpdate( const Option* option, float value ) { - minecraft->optionUpdated(option, value); -} - -void Options::notifyOptionUpdate( const Option* option, int value ) { - minecraft->optionUpdated(option, value); +void Options::notifyOptionUpdate(OptionId key, int value) { + minecraft->optionUpdated(key, value); } diff --git a/src/client/Options.h b/src/client/Options.h index 4420ba7..c33c93b 100755 --- a/src/client/Options.h +++ b/src/client/Options.h @@ -1,16 +1,107 @@ #ifndef NET_MINECRAFT_CLIENT__Options_H__ #define NET_MINECRAFT_CLIENT__Options_H__ +#define SOUND_MIN_VALUE 0.0f +#define SOUND_MAX_VALUE 1.0f +#define MUSIC_MIN_VALUE 0.0f +#define MUSIC_MAX_VALUE 1.0f +#define SENSITIVITY_MIN_VALUE 0.0f +#define SENSITIVITY_MAX_VALUE 1.0f +#define PIXELS_PER_MILLIMETER_MIN_VALUE 3.0f +#define PIXELS_PER_MILLIMETER_MAX_VALUE 4.0f + //package net.minecraft.client; //#include "locale/Language.h" #include #include -#include "KeyMapping.h" #include "../platform/input/Keyboard.h" #include "../util/StringUtils.h" #include "OptionsFile.h" +#include "Option.h" +#include + +enum OptionId { + // General + OPTIONS_DIFFICULTY, + OPTIONS_HIDEGUI, + OPTIONS_THIRD_PERSON_VIEW, + OPTIONS_GUI_SCALE, + OPTIONS_DESTROY_VIBRATION, + OPTIONS_MUSIC_VOLUME, + OPTIONS_SOUND_VOLUME, + OPTIONS_SKIN, + OPTIONS_USERNAME, + OPTIONS_SERVER_VISIBLE, + OPTIONS_BAR_ON_TOP, + OPTIONS_ALLOW_SPRINT, + OPTIONS_AUTOJUMP, + OPTIONS_WINDOW_SCALE, + + // Graphics + OPTIONS_RENDER_DEBUG, + OPTIONS_SMOOTH_CAMERA, + OPTIONS_FIXED_CAMERA, + OPTIONS_VIEW_DISTANCE, + OPTIONS_VIEW_BOBBING, + OPTIONS_AMBIENT_OCCLUSION, + OPTIONS_ANAGLYPH_3D, + OPTIONS_LIMIT_FRAMERATE, + OPTIONS_VSYNC, + OPTIONS_FANCY_GRAPHICS, + OPTIONS_NORMAL_LIGHTING, + + + // Cheats / debug + OPTIONS_FLY_SPEED, + OPTIONS_CAMERA_SPEED, + OPTIONS_IS_FLYING, + + // Control + OPTIONS_BLOCK_OUTLINE, + OPTIONS_USE_MOUSE_FOR_DIGGING, + OPTIONS_IS_LEFT_HANDED, + OPTIONS_IS_JOY_TOUCH_AREA, + OPTIONS_SENSITIVITY, + OPTIONS_INVERT_Y_MOUSE, + OPTIONS_USE_TOUCHSCREEN, + + OPTIONS_KEY_FORWARD, + OPTIONS_KEY_LEFT, + OPTIONS_KEY_BACK, + OPTIONS_KEY_RIGHT, + OPTIONS_KEY_JUMP, + OPTIONS_KEY_INVENTORY, + OPTIONS_KEY_SNEAK, + OPTIONS_KEY_DROP, + OPTIONS_KEY_CHAT, + OPTIONS_KEY_FOG, + OPTIONS_KEY_USE, + + OPTIONS_KEY_MENU_NEXT, + OPTIONS_KEY_MENU_PREV, + OPTIONS_KEY_MENU_OK, + OPTIONS_KEY_MENU_CANCEL, + + OPTIONS_FIRST_LAUNCH, + OPTIONS_LAST_IP, + + OPTIONS_RPI_CURSOR, + OPTIONS_FOLIAGE_TINT, + OPTIONS_FOG_TYPE, + OPTIONS_JAVA_HUD, + OPTIONS_RESTORED_ANIMS, + OPTIONS_TINTED_SIDE, + OPTIONS_BETA_SKY, + OPTIONS_BEAUTIFUL_SKY, + OPTIONS_VIGNETTE, + OPTIONS_DEBUG_STYLE, + OPTIONS_COMPLETE_LIGHTING, + OPTIONS_MENU_STYLE, + // Should be last! + OPTIONS_COUNT +}; class Minecraft; typedef std::vector StringVector; @@ -18,311 +109,78 @@ typedef std::vector StringVector; class Options { public: - class Option - { - const bool _isProgress; - const bool _isBoolean; - const std::string _captionId; - const int _ordinal; + // deepfriedwaffles: for iOS, was getting compile errors saying: No member named 'sound' in 'Options' and No member named 'music' in 'Options' so I floated them here. 1.0f means full volume out of the box, but if everything is too loud, you might want to try adjusting this + float sound = 1.0f; + float music = 1.0f; + + static bool debugGl; - public: - static const Option MUSIC; - static const Option SOUND; - static const Option INVERT_MOUSE; - static const Option SENSITIVITY; - static const Option RENDER_DISTANCE; - static const Option VIEW_BOBBING; - static const Option ANAGLYPH; - static const Option LIMIT_FRAMERATE; - static const Option DIFFICULTY; - static const Option GRAPHICS; - static const Option AMBIENT_OCCLUSION; - static const Option GUI_SCALE; - - static const Option THIRD_PERSON; - static const Option HIDE_GUI; - static const Option SERVER_VISIBLE; - static const Option LEFT_HANDED; - static const Option USE_TOUCHSCREEN; - static const Option USE_TOUCH_JOYPAD; - static const Option DESTROY_VIBRATION; - - static const Option PIXELS_PER_MILLIMETER; - - /* - static Option* getItem(int id) { - for (Option item : Option.values()) { - if (item.getId() == id) { - return item; - } - } - return NULL; - } - */ - - Option(int ordinal, const std::string& captionId, bool hasProgress, bool isBoolean) - : _captionId(captionId), - _isProgress(hasProgress), - _isBoolean(isBoolean), - _ordinal(ordinal) - {} - - bool isProgress() const { - return _isProgress; - } - - bool isBoolean() const { - return _isBoolean; - } - - bool isInt() const { - return (!_isBoolean && !_isProgress); - } - - int getId() { - return _ordinal; - } - - std::string getCaptionId() const { - return _captionId; - } - }; - -private: - static const float SOUND_MIN_VALUE; - static const float SOUND_MAX_VALUE; - static const float MUSIC_MIN_VALUE; - static const float MUSIC_MAX_VALUE; - static const float SENSITIVITY_MIN_VALUE; - static const float SENSITIVITY_MAX_VALUE; - static const float PIXELS_PER_MILLIMETER_MIN_VALUE; - static const float PIXELS_PER_MILLIMETER_MAX_VALUE; - static const char* RENDER_DISTANCE_NAMES[]; - static const char* DIFFICULTY_NAMES[]; - static const char* GUI_SCALE[]; - static const int DIFFICULY_LEVELS[]; -public: - static bool debugGl; - - float music; - float sound; - //note: sensitivity is transformed in Options::update - float sensitivity; - bool invertYMouse; - int viewDistance; - bool bobView; - bool anaglyph3d; - bool limitFramerate; - bool fancyGraphics; - bool ambientOcclusion; - bool useMouseForDigging; - bool isLeftHanded; - bool destroyVibration; - //std::string skin; - - KeyMapping keyUp; - KeyMapping keyLeft; - KeyMapping keyDown; - KeyMapping keyRight; - KeyMapping keyJump; - KeyMapping keyBuild; - KeyMapping keyDrop; - KeyMapping keyChat; - KeyMapping keyFog; - KeyMapping keySneak; - KeyMapping keyCraft; - KeyMapping keyDestroy; - KeyMapping keyUse; - - KeyMapping keyMenuNext; - KeyMapping keyMenuPrevious; - KeyMapping keyMenuOk; - KeyMapping keyMenuCancel; - - KeyMapping* keyMappings[16]; - - /*protected*/ Minecraft* minecraft; - ///*private*/ File optionsFile; - - int difficulty; - bool hideGui; - bool thirdPersonView; - bool renderDebug; - - bool isFlying; - bool smoothCamera; - bool fixedCamera; - float flySpeed; - float cameraSpeed; - int guiScale; - std::string username; - - bool serverVisible; - bool isJoyTouchArea; - bool useTouchScreen; - float pixelsPerMillimeter; - Options(Minecraft* minecraft, const std::string& workingDirectory) - : minecraft(minecraft) - { - //optionsFile = /*new*/ File(workingDirectory, "options.txt"); - initDefaultValues(); - - load(); + Options(Minecraft* minecraft, const std::string& workingDirectory = "") + : minecraft(minecraft) { + // elements werent initialized so i was getting a garbage pointer and a crash + m_options.fill(nullptr); + initTable(); + // load() is deferred to init() where path is configured correctly } - Options() - : minecraft(NULL) - { - - } + void initTable(); - void initDefaultValues(); - - std::string getKeyDescription(int i) { - //Language language = Language.getInstance(); - //return language.getElement(keyMappings[i].name); - return "Options::getKeyDescription not implemented"; + int getIntValue(OptionId key) { + auto option = opt(key); + return (option)? option->get() : 0; } - std::string getKeyMessage(int i) { - //return Keyboard.getKeyName(keyMappings[i].key); - return "Options::getKeyMessage not implemented"; + std::string getStringValue(OptionId key) { + auto option = opt(key); + return (option)? option->get() : ""; } - void setKey(int i, int key) { - keyMappings[i]->key = key; - save(); + float getProgressValue(OptionId key) { + auto option = opt(key); + return (option)? option->get() : 0.f; } - void set(const Option* item, float value) { - if (item == &Option::MUSIC) { - music = value; - //minecraft.soundEngine.updateOptions(); - } else if (item == &Option::SOUND) { - sound = value; - //minecraft.soundEngine.updateOptions(); - } else if (item == &Option::SENSITIVITY) { - sensitivity = value; - } else if (item == &Option::PIXELS_PER_MILLIMETER) { - pixelsPerMillimeter = value; - } - notifyOptionUpdate(item, value); - } - void set(const Option* item, int value) { - if(item == &Option::DIFFICULTY) { - difficulty = value; - } - notifyOptionUpdate(item, value); - } - - void toggle(const Option* option, int dir) { - if (option == &Option::INVERT_MOUSE) invertYMouse = !invertYMouse; - if (option == &Option::RENDER_DISTANCE) viewDistance = (viewDistance + dir) & 3; - if (option == &Option::GUI_SCALE) guiScale = (guiScale + dir) & 3; - if (option == &Option::VIEW_BOBBING) bobView = !bobView; - if (option == &Option::THIRD_PERSON) thirdPersonView = !thirdPersonView; - if (option == &Option::HIDE_GUI) hideGui = !hideGui; - if (option == &Option::SERVER_VISIBLE) serverVisible = !serverVisible; - if (option == &Option::LEFT_HANDED) isLeftHanded = !isLeftHanded; - if (option == &Option::USE_TOUCHSCREEN) useTouchScreen = !useTouchScreen; - if (option == &Option::USE_TOUCH_JOYPAD) isJoyTouchArea = !isJoyTouchArea; - if (option == &Option::DESTROY_VIBRATION) destroyVibration = !destroyVibration; - if (option == &Option::ANAGLYPH) { - anaglyph3d = !anaglyph3d; - //minecraft->textures.reloadAll(); - } - if (option == &Option::LIMIT_FRAMERATE) limitFramerate = !limitFramerate; - if (option == &Option::DIFFICULTY) difficulty = (difficulty + dir) & 3; - if (option == &Option::GRAPHICS) { - fancyGraphics = !fancyGraphics; - //minecraft->levelRenderer.allChanged(); - } - if (option == &Option::AMBIENT_OCCLUSION) { - ambientOcclusion = !ambientOcclusion; - //minecraft->levelRenderer.allChanged(); - } - notifyOptionUpdate(option, getBooleanValue(option)); - save(); + bool getBooleanValue(OptionId key) { + auto option = opt(key); + return (option)? option->get() : false; } - int getIntValue(const Option* item) { - if(item == &Option::DIFFICULTY) return difficulty; - return 0; - } - - float getProgressValue(const Option* item) { - if (item == &Option::MUSIC) return music; - if (item == &Option::SOUND) return sound; - if (item == &Option::SENSITIVITY) return sensitivity; - if (item == &Option::PIXELS_PER_MILLIMETER) return pixelsPerMillimeter; - return 0; + float getProgrssMin(OptionId key) { + auto option = opt(key); + return (option)? option->getMin() : 0.f; } - bool getBooleanValue(const Option* item) { - if (item == &Option::INVERT_MOUSE) - return invertYMouse; - if (item == &Option::VIEW_BOBBING) - return bobView; - if (item == &Option::ANAGLYPH) - return anaglyph3d; - if (item == &Option::LIMIT_FRAMERATE) - return limitFramerate; - if (item == &Option::AMBIENT_OCCLUSION) - return ambientOcclusion; - if (item == &Option::THIRD_PERSON) - return thirdPersonView; - if (item == &Option::HIDE_GUI) - return hideGui; - if (item == &Option::THIRD_PERSON) - return thirdPersonView; - if (item == &Option::SERVER_VISIBLE) - return serverVisible; - if (item == &Option::LEFT_HANDED) - return isLeftHanded; - if (item == &Option::USE_TOUCHSCREEN) - return useTouchScreen; - if (item == &Option::USE_TOUCH_JOYPAD) - return isJoyTouchArea; - if (item == &Option::DESTROY_VIBRATION) - return destroyVibration; - return false; - } + float getProgrssMax(OptionId key) { + auto option = opt(key); + return (option)? option->getMax() : 0.f; + } - float getProgrssMin(const Option* item) { - if (item == &Option::MUSIC) return MUSIC_MIN_VALUE; - if (item == &Option::SOUND) return SOUND_MIN_VALUE; - if (item == &Option::SENSITIVITY) return SENSITIVITY_MIN_VALUE; - if (item == &Option::PIXELS_PER_MILLIMETER) return PIXELS_PER_MILLIMETER_MIN_VALUE; - return 0; - } + Option* getOpt(OptionId id) { return m_options[id]; } - float getProgrssMax(const Option* item) { - if (item == &Option::MUSIC) return MUSIC_MAX_VALUE; - if (item == &Option::SOUND) return SOUND_MAX_VALUE; - if (item == &Option::SENSITIVITY) return SENSITIVITY_MAX_VALUE; - if (item == &Option::PIXELS_PER_MILLIMETER) return PIXELS_PER_MILLIMETER_MAX_VALUE; - return 1.0f; - } - - std::string getMessage(const Option* item); - - void update(); void load(); void save(); - void addOptionToSaveOutput(StringVector& stringVector, std::string name, bool boolValue); - void addOptionToSaveOutput(StringVector& stringVector, std::string name, float floatValue); - void addOptionToSaveOutput(StringVector& stringVector, std::string name, int intValue); - void notifyOptionUpdate(const Option* option, bool value); - void notifyOptionUpdate(const Option* option, float value); - void notifyOptionUpdate(const Option* option, int value); -private: - static bool readFloat(const std::string& string, float& value); - static bool readInt(const std::string& string, int& value); - static bool readBool(const std::string& string, bool& value); + void set(OptionId key, int value); + void set(OptionId key, float value); + void set(OptionId key, const std::string& value); + void setOptionsFilePath(const std::string& path); + void toggle(OptionId key); + + void notifyOptionUpdate(OptionId key, bool value); + void notifyOptionUpdate(OptionId key, float value); + void notifyOptionUpdate(OptionId key, int value); + void notifyOptionUpdate(OptionId key, const std::string& value) {} private: + template + T* opt(OptionId key) { + if (m_options[key] == nullptr) return nullptr; + return dynamic_cast(m_options[key]); + } + + std::array m_options; OptionsFile optionsFile; - + + Minecraft* minecraft; }; #endif /*NET_MINECRAFT_CLIENT__Options_H__*/ diff --git a/src/client/OptionsFile.cpp b/src/client/OptionsFile.cpp index 49375a0..ef2a0dc 100755 --- a/src/client/OptionsFile.cpp +++ b/src/client/OptionsFile.cpp @@ -1,37 +1,98 @@ #include "OptionsFile.h" #include #include +#include +#include + +#if defined(_WIN32) + #include +#else + #include + #include +#endif OptionsFile::OptionsFile() { #ifdef __APPLE__ settingsPath = "./Documents/options.txt"; #elif defined(ANDROID) settingsPath = "options.txt"; +#elif defined(__EMSCRIPTEN__) + settingsPath = "/games/com.mojang/options.txt"; #else settingsPath = "options.txt"; #endif } -void OptionsFile::save(const StringVector& settings) { - FILE* pFile = fopen(settingsPath.c_str(), "w"); - if(pFile != NULL) { - for(StringVector::const_iterator it = settings.begin(); it != settings.end(); ++it) { - fprintf(pFile, "%s\n", it->c_str()); - } - fclose(pFile); - } +void OptionsFile::setOptionsPath(const std::string& path) { + settingsPath = path; } +std::string OptionsFile::getOptionsPath() const { + return settingsPath; +} +void OptionsFile::save(const StringVector& settings) { + FILE* pFile = fopen(settingsPath.c_str(), "w"); + + if (!pFile && errno == ENOENT) { + std::string dir = settingsPath; + size_t fpos = dir.find_last_of("/\\"); + if (fpos != std::string::npos) { + dir.resize(fpos); + + std::string toCreate; + for (size_t i = 0; i <= dir.size(); ++i) { + if (i == dir.size() || dir[i] == '/' || dir[i] == '\\') { + if (!toCreate.empty()) { +#if defined(_WIN32) + _mkdir(toCreate.c_str()); +#else + mkdir(toCreate.c_str(), 0755); +#endif + } + } + if (i < dir.size()) + toCreate.push_back(dir[i]); + } + } + + pFile = fopen(settingsPath.c_str(), "w"); + } + + if (!pFile) { + LOGI("OptionsFile::save failed: %s", strerror(errno)); + return; + } + + for (const auto& s : settings) { + fprintf(pFile, "%s\n", s.c_str()); + } + + fclose(pFile); +} + + StringVector OptionsFile::getOptionStrings() { StringVector returnVector; - FILE* pFile = fopen(settingsPath.c_str(), "w"); + FILE* pFile = fopen(settingsPath.c_str(), "r"); if(pFile != NULL) { char lineBuff[128]; while(fgets(lineBuff, sizeof lineBuff, pFile)) { - if(strlen(lineBuff) > 2) - returnVector.push_back(std::string(lineBuff)); + // Strip trailing newline + size_t len = strlen(lineBuff); + while(len > 0 && (lineBuff[len-1] == '\n' || lineBuff[len-1] == '\r')) + lineBuff[--len] = '\0'; + if(len < 3) continue; + // Split "key:value" into two separate entries to match update() pairing + char* colon = strchr(lineBuff, ':'); + if(colon) { + returnVector.push_back(std::string(lineBuff, colon - lineBuff)); + returnVector.push_back(std::string(colon + 1)); + } } fclose(pFile); + } else { + if (errno != ENOENT) + LOGI("OptionsFile::getOptionStrings failed to open '%s' for reading: %s", settingsPath.c_str(), strerror(errno)); } return returnVector; } diff --git a/src/client/OptionsFile.h b/src/client/OptionsFile.h index 942af75..b2464a0 100755 --- a/src/client/OptionsFile.h +++ b/src/client/OptionsFile.h @@ -11,7 +11,9 @@ public: OptionsFile(); void save(const StringVector& settings); StringVector getOptionStrings(); - + void setOptionsPath(const std::string& path); + std::string getOptionsPath() const; + private: std::string settingsPath; }; diff --git a/src/client/User.h b/src/client/User.h deleted file mode 100755 index ebbb2d0..0000000 --- a/src/client/User.h +++ /dev/null @@ -1,62 +0,0 @@ -#ifndef NET_MINECRAFT_CLIENT__User_H__ -#define NET_MINECRAFT_CLIENT__User_H__ - -//package net.minecraft.client; - -#include "../world/level/tile/Tile.h" - -class User -{ -public: - //static List allowedTiles = /*new*/ ArrayList(); - - //static { - // allowedTiles.push_back(Tile::rock); - // allowedTiles.push_back(Tile::stoneBrick); - // allowedTiles.push_back(Tile::redBrick); - // allowedTiles.push_back(Tile::dirt); - // allowedTiles.push_back(Tile::wood); - // allowedTiles.push_back(Tile::treeTrunk); - // allowedTiles.push_back(Tile::leaves); - // allowedTiles.push_back(Tile::torch); - // allowedTiles.push_back(Tile::stoneSlabHalf); - - // allowedTiles.push_back(Tile::glass); - // allowedTiles.push_back(Tile::mossStone); - // allowedTiles.push_back(Tile::sapling); - // allowedTiles.push_back(Tile::flower); - // allowedTiles.push_back(Tile::rose); - // allowedTiles.push_back(Tile::mushroom1); - // allowedTiles.push_back(Tile::mushroom2); - // allowedTiles.push_back(Tile::sand); - // allowedTiles.push_back(Tile::gravel); - // allowedTiles.push_back(Tile::sponge); - - // allowedTiles.push_back(Tile::cloth); - // allowedTiles.push_back(Tile::coalOre); - // allowedTiles.push_back(Tile::ironOre); - // allowedTiles.push_back(Tile::goldOre); - // allowedTiles.push_back(Tile::ironBlock); - // allowedTiles.push_back(Tile::goldBlock); - // allowedTiles.push_back(Tile::bookshelf); - // allowedTiles.push_back(Tile::tnt); - // allowedTiles.push_back(Tile::obsidian); - - // // System.out.println(allowedTiles.size()); - //} - - static bool isTileAllowed(const Tile& tile) { - return true; - } - - std::string name; - std::string sessionId; - //std::string mpPassword; - - User(const std::string& name, const std::string& sessionId) { - this->name = name; - this->sessionId = sessionId; - } -}; - -#endif /*NET_MINECRAFT_CLIENT__User_H__*/ diff --git a/src/client/gamemode/CreativeMode.cpp b/src/client/gamemode/CreativeMode.cpp index 43a1b16..c33cf8d 100755 --- a/src/client/gamemode/CreativeMode.cpp +++ b/src/client/gamemode/CreativeMode.cpp @@ -1,72 +1,56 @@ -#include "CreativeMode.h" -#include "../Minecraft.h" -#ifndef STANDALONE_SERVER -#include "../particle/ParticleEngine.h" -#endif -#include "../player/LocalPlayer.h" -#ifndef STANDALONE_SERVER -#include "../renderer/LevelRenderer.h" -#include "../sound/SoundEngine.h" -#endif -#include "../../world/level/Level.h" -//#include "../../network/Packet.h" -#include "../../network/packet/RemoveBlockPacket.h" -#include "../../world/entity/player/Abilities.h" - -static const int DestructionTickDelay = 10; - -CreativeMode::CreativeMode(Minecraft* minecraft) -: super(minecraft) -{ -} - -void CreativeMode::startDestroyBlock(int x, int y, int z, int face) { - if(minecraft->player->getCarriedItem() != NULL && minecraft->player->getCarriedItem()->id == Item::bow->id) - return; - - creativeDestroyBlock(x, y, z, face); - destroyDelay = DestructionTickDelay; -} - -void CreativeMode::creativeDestroyBlock(int x, int y, int z, int face) { - //if (! - minecraft->level->extinguishFire(x, y, z, face) - //{ - ; - destroyBlock(x, y, z, face); - //} -} - -void CreativeMode::continueDestroyBlock(int x, int y, int z, int face) { - destroyDelay--; - if (destroyDelay <= 0) { - destroyDelay = DestructionTickDelay; - creativeDestroyBlock(x, y, z, face); - } -} - -void CreativeMode::stopDestroyBlock() { -} - -void CreativeMode::initAbilities( Abilities& abilities ) { - abilities.mayfly = true; - abilities.instabuild = true; - abilities.invulnerable = true; -} - -bool CreativeMode::isCreativeType() { - return true; -} - -void CreativeMode::releaseUsingItem( Player* player ) { - if(player->getCarriedItem() != NULL) { - int oldItemId = player->getCarriedItem()->id; - int oldAux = player->getAuxData(); - super::releaseUsingItem(player); - if(player->getCarriedItem() != NULL && player->getCarriedItem()->id == oldItemId) { - player->getCarriedItem()->setAuxValue(oldAux); - } - } else { - super::releaseUsingItem(player); - } -} +#include "CreativeMode.h" +#include "../Minecraft.h" +#ifndef STANDALONE_SERVER +#include "../particle/ParticleEngine.h" +#endif +#include "../player/LocalPlayer.h" +#ifndef STANDALONE_SERVER +#include "../renderer/LevelRenderer.h" +#include "../sound/SoundEngine.h" +#endif +#include "../../world/level/Level.h" +//#include "../../network/Packet.h" +#include "../../network/packet/RemoveBlockPacket.h" +#include "../../world/entity/player/Abilities.h" + +static const int DestructionTickDelay = 5; + +CreativeMode::CreativeMode(Minecraft* minecraft) +: super(minecraft) +{ +} + +void CreativeMode::startDestroyBlock(int x, int y, int z, int face) { + if(minecraft->player->getCarriedItem() != NULL && minecraft->player->getCarriedItem()->id == Item::bow->id) + return; + + creativeDestroyBlock(x, y, z, face); + destroyDelay = DestructionTickDelay; +} + +void CreativeMode::creativeDestroyBlock(int x, int y, int z, int face) { + minecraft->level->extinguishFire(x, y, z, face); + destroyBlock(x, y, z, face); +} + +void CreativeMode::continueDestroyBlock(int x, int y, int z, int face) { + destroyDelay--; + if (destroyDelay <= 0) { + destroyDelay = DestructionTickDelay; + creativeDestroyBlock(x, y, z, face); + } +} + +void CreativeMode::stopDestroyBlock() { + destroyDelay = 0; +} + +void CreativeMode::initAbilities( Abilities& abilities ) { + abilities.mayfly = true; + abilities.instabuild = true; + abilities.invulnerable = true; +} + +bool CreativeMode::isCreativeType() { + return true; +} diff --git a/src/client/gamemode/CreativeMode.h b/src/client/gamemode/CreativeMode.h index b418111..61f7d1b 100755 --- a/src/client/gamemode/CreativeMode.h +++ b/src/client/gamemode/CreativeMode.h @@ -1,27 +1,26 @@ -#ifndef NET_MINECRAFT_CLIENT_GAMEMODE__CreativeMode_H__ -#define NET_MINECRAFT_CLIENT_GAMEMODE__CreativeMode_H__ - -//package net.minecraft.client.gamemode; - -#include "GameMode.h" - -class CreativeMode: public GameMode -{ - typedef GameMode super; -public: - CreativeMode(Minecraft* minecraft); - - void startDestroyBlock(int x, int y, int z, int face); - void continueDestroyBlock(int x, int y, int z, int face); - void stopDestroyBlock(); - - bool isCreativeType(); - - void initAbilities(Abilities& abilities); - - void releaseUsingItem(Player* player); -private: - void creativeDestroyBlock(int x, int y, int z, int face); -}; - -#endif /*NET_MINECRAFT_CLIENT_GAMEMODE__CreativeMode_H__*/ +#ifndef NET_MINECRAFT_CLIENT_GAMEMODE__CreativeMode_H__ +#define NET_MINECRAFT_CLIENT_GAMEMODE__CreativeMode_H__ + +//package net.minecraft.client.gamemode; + +#include "GameMode.h" + +class CreativeMode: public GameMode +{ + typedef GameMode super; +public: + CreativeMode(Minecraft* minecraft); + + void startDestroyBlock(int x, int y, int z, int face); + void continueDestroyBlock(int x, int y, int z, int face); + void stopDestroyBlock(); + + bool isCreativeType(); + + void initAbilities(Abilities& abilities); + +private: + void creativeDestroyBlock(int x, int y, int z, int face); +}; + +#endif /*NET_MINECRAFT_CLIENT_GAMEMODE__CreativeMode_H__*/ diff --git a/src/client/gamemode/CreatorMode.cpp b/src/client/gamemode/CreatorMode.cpp index ae1ffd2..c33d0f5 100755 --- a/src/client/gamemode/CreatorMode.cpp +++ b/src/client/gamemode/CreatorMode.cpp @@ -1,118 +1,102 @@ -#include "CreatorMode.h" -#include "../Minecraft.h" -#include "../particle/ParticleEngine.h" -#include "../player/LocalPlayer.h" -#include "../renderer/LevelRenderer.h" -#include "../sound/SoundEngine.h" -#include "../../world/level/Level.h" -//#include "../../network/Packet.h" -#include "../../network/packet/RemoveBlockPacket.h" -#include "../../world/entity/player/Abilities.h" - -static const int DestructionTickDelay = 10; - -class Creator: public ICreator { - //virtual void getEvents(); - -public: - Creator(/*int eventLifeTime*/) - : _tileEvents(32), - _tickId(0) - { - } - - void setTick(int tick) { - _tickId = tick; - } - - EventList& getTileEvents() { return _tileEvents; } - - void addevent_blockUse(int entityId, int x, int y, int z, int face) { - TileEvent t = { - entityId, - x,y,z, - face - }; - _tileEvents.add(t, _tickId); - } - -private: - EventList _tileEvents; - int _tickId; -}; - -CreatorMode::CreatorMode(Minecraft* minecraft) -: super(minecraft) -{ - _creator = new Creator(); -} - -CreatorMode::~CreatorMode() { - delete _creator; -} - -void CreatorMode::startDestroyBlock(int x, int y, int z, int face) { - if(minecraft->player->getCarriedItem() != NULL && minecraft->player->getCarriedItem()->id == Item::bow->id) - return; - - CreatorDestroyBlock(x, y, z, face); - destroyDelay = DestructionTickDelay; -} - -void CreatorMode::CreatorDestroyBlock(int x, int y, int z, int face) { - //if (! - minecraft->level->extinguishFire(x, y, z, face) - //{ - ; - destroyBlock(x, y, z, face); - //} -} - -void CreatorMode::continueDestroyBlock(int x, int y, int z, int face) { - destroyDelay--; - if (destroyDelay <= 0) { - destroyDelay = DestructionTickDelay; - CreatorDestroyBlock(x, y, z, face); - } -} - -bool CreatorMode::useItemOn( Player* player, Level* level, ItemInstance* item, int x, int y, int z, int face, const Vec3& hit ) { - if (item && item->id == ((Item*)Item::sword_iron)->id) - _creator->addevent_blockUse(player->entityId, x, y, z, face); - return super::useItemOn(player, level, item, x, y, z, face, hit); -} - -void CreatorMode::stopDestroyBlock() { -} - -void CreatorMode::initAbilities( Abilities& abilities ) { - abilities.mayfly = true; - abilities.instabuild = true; - abilities.invulnerable = true; -} - -bool CreatorMode::isCreativeType() { - return true; -} - -void CreatorMode::releaseUsingItem( Player* player ) { - if(player->getCarriedItem() != NULL) { - int oldItemId = player->getCarriedItem()->id; - int oldAux = player->getAuxData(); - super::releaseUsingItem(player); - if(player->getCarriedItem() != NULL && player->getCarriedItem()->id == oldItemId) { - player->getCarriedItem()->setAuxValue(oldAux); - } - } else { - super::releaseUsingItem(player); - } -} - -ICreator* CreatorMode::getCreator() { - return _creator; -} - -void CreatorMode::tick() { - _creator->setTick(minecraft->level->getTime()); - super::tick(); -} +#include "CreatorMode.h" +#include "../Minecraft.h" +#include "../particle/ParticleEngine.h" +#include "../player/LocalPlayer.h" +#include "../renderer/LevelRenderer.h" +#include "../sound/SoundEngine.h" +#include "../../world/level/Level.h" +//#include "../../network/Packet.h" +#include "../../network/packet/RemoveBlockPacket.h" +#include "../../world/entity/player/Abilities.h" + +static const int DestructionTickDelay = 5; + +class Creator: public ICreator { + //virtual void getEvents(); + +public: + Creator(/*int eventLifeTime*/) + : _tileEvents(32), + _tickId(0) + { + } + + void setTick(int tick) { + _tickId = tick; + } + + EventList& getTileEvents() { return _tileEvents; } + + void addevent_blockUse(int entityId, int x, int y, int z, int face) { + TileEvent t = { + entityId, + x,y,z, + face + }; + _tileEvents.add(t, _tickId); + } + +private: + EventList _tileEvents; + int _tickId; +}; + +CreatorMode::CreatorMode(Minecraft* minecraft) +: super(minecraft) +{ + _creator = new Creator(); +} + +CreatorMode::~CreatorMode() { + delete _creator; +} + +void CreatorMode::startDestroyBlock(int x, int y, int z, int face) { + if(minecraft->player->getCarriedItem() != NULL && minecraft->player->getCarriedItem()->id == Item::bow->id) + return; + + CreatorDestroyBlock(x, y, z, face); + destroyDelay = DestructionTickDelay; +} + +void CreatorMode::CreatorDestroyBlock(int x, int y, int z, int face) { + minecraft->level->extinguishFire(x, y, z, face); + destroyBlock(x, y, z, face); +} + +void CreatorMode::continueDestroyBlock(int x, int y, int z, int face) { + destroyDelay--; + if (destroyDelay <= 0) { + destroyDelay = DestructionTickDelay; + CreatorDestroyBlock(x, y, z, face); + } +} + +bool CreatorMode::useItemOn( Player* player, Level* level, ItemInstance* item, int x, int y, int z, int face, const Vec3& hit ) { + if (item && item->id == ((Item*)Item::sword_iron)->id) + _creator->addevent_blockUse(player->entityId, x, y, z, face); + return super::useItemOn(player, level, item, x, y, z, face, hit); +} + +void CreatorMode::stopDestroyBlock() { + destroyDelay = 0; +} + +void CreatorMode::initAbilities( Abilities& abilities ) { + abilities.mayfly = true; + abilities.instabuild = true; + abilities.invulnerable = true; +} + +bool CreatorMode::isCreativeType() { + return true; +} + +ICreator* CreatorMode::getCreator() { + return _creator; +} + +void CreatorMode::tick() { + _creator->setTick(minecraft->level->getTime()); + super::tick(); +} diff --git a/src/client/gamemode/CreatorMode.h b/src/client/gamemode/CreatorMode.h index a74fe52..8e0ece7 100755 --- a/src/client/gamemode/CreatorMode.h +++ b/src/client/gamemode/CreatorMode.h @@ -1,61 +1,61 @@ -#ifndef NET_MINECRAFT_CLIENT_GAMEMODE__CreatorMode_H__ -#define NET_MINECRAFT_CLIENT_GAMEMODE__CreatorMode_H__ - -//package net.minecraft.client.gamemode; - -#include "GameMode.h" -#include "../../world/PosTranslator.h" - -class ICreator { -public: - virtual ~ICreator() {} - - struct TileEvent { - int entityId; - int x, y, z; - int face; - - void write(std::stringstream& ss, IPosTranslator& t) const { - int xx = x, yy = y, zz = z; - t.to(xx, yy, zz); - ss << xx << "," << yy << "," << zz << "," << face << "," << entityId; - } - }; - - template - class EventList { - public: - EventList(int size) { - _events.reserve(size); - _maxSize = (int)size; - clear(); - } - void clear() { - _index = -1; - _size = 0; - } - void add(const T& item, int tick) { - if (_size < _maxSize) { - _events.push_back(Item()); - ++_size; - } - Item& e = _events[_nextIndex()]; - e.item = item; - e.timestamp = tick; - } - int size() const { - return _size; - } - - const T& operator[](int i) const { - return _events[_getIndex(i)].item; - } - - T& operator[](int i) { - return _events[_getIndex(i)].item; - } - - void write(std::stringstream& ss, IPosTranslator& t, int minTimetamp) const { +#ifndef NET_MINECRAFT_CLIENT_GAMEMODE__CreatorMode_H__ +#define NET_MINECRAFT_CLIENT_GAMEMODE__CreatorMode_H__ + +//package net.minecraft.client.gamemode; + +#include "GameMode.h" +#include "../../world/PosTranslator.h" + +class ICreator { +public: + virtual ~ICreator() {} + + struct TileEvent { + int entityId; + int x, y, z; + int face; + + void write(std::stringstream& ss, IPosTranslator& t) const { + int xx = x, yy = y, zz = z; + t.to(xx, yy, zz); + ss << xx << "," << yy << "," << zz << "," << face << "," << entityId; + } + }; + + template + class EventList { + public: + EventList(int size) { + _events.reserve(size); + _maxSize = (int)size; + clear(); + } + void clear() { + _index = -1; + _size = 0; + } + void add(const T& item, int tick) { + if (_size < _maxSize) { + _events.push_back(Item()); + ++_size; + } + Item& e = _events[_nextIndex()]; + e.item = item; + e.timestamp = tick; + } + int size() const { + return _size; + } + + const T& operator[](int i) const { + return _events[_getIndex(i)].item; + } + + T& operator[](int i) { + return _events[_getIndex(i)].item; + } + + void write(std::stringstream& ss, IPosTranslator& t, int minTimetamp) const { int i = _getFirstNewerIndex(minTimetamp); if (i < 0) return; @@ -66,63 +66,62 @@ public: ss << "|"; if (++i == _size) i = 0; } - } - - private: - int _getIndex(int i) const { return (1 + _index + i) % _size; } - int _nextIndex() { - if (++_index == _size) _index = 0; - return _index; - } - - int _getFirstNewerIndex(int timestamp) const { - for (int i = _index + 1, j = 0; j < _size; ++i, ++j) { - if (i == _size) i = 0; - if (_events[i].timestamp >= timestamp) return i; - } - return -1; - } - struct Item { - int timestamp; - T item; - }; - - int _index; - int _size; - int _maxSize; - std::vector _events; - }; - - virtual EventList& getTileEvents() = 0; -}; - -class Creator; - -class CreatorMode: public GameMode -{ - typedef GameMode super; -public: - CreatorMode(Minecraft* minecraft); - ~CreatorMode(); - - void startDestroyBlock(int x, int y, int z, int face); - void continueDestroyBlock(int x, int y, int z, int face); - void stopDestroyBlock(); - - bool useItemOn(Player* player, Level* level, ItemInstance* item, int x, int y, int z, int face, const Vec3& hit); - - void tick(); - ICreator* getCreator(); - - bool isCreativeType(); - - void initAbilities(Abilities& abilities); - - void releaseUsingItem(Player* player); -private: - void CreatorDestroyBlock(int x, int y, int z, int face); - - Creator* _creator; -}; - -#endif /*NET_MINECRAFT_CLIENT_GAMEMODE__CreatorMode_H__*/ + } + + private: + int _getIndex(int i) const { return (1 + _index + i) % _size; } + int _nextIndex() { + if (++_index == _size) _index = 0; + return _index; + } + + int _getFirstNewerIndex(int timestamp) const { + for (int i = _index + 1, j = 0; j < _size; ++i, ++j) { + if (i == _size) i = 0; + if (_events[i].timestamp >= timestamp) return i; + } + return -1; + } + struct Item { + int timestamp; + T item; + }; + + int _index; + int _size; + int _maxSize; + std::vector _events; + }; + + virtual EventList& getTileEvents() = 0; +}; + +class Creator; + +class CreatorMode: public GameMode +{ + typedef GameMode super; +public: + CreatorMode(Minecraft* minecraft); + ~CreatorMode(); + + void startDestroyBlock(int x, int y, int z, int face); + void continueDestroyBlock(int x, int y, int z, int face); + void stopDestroyBlock(); + + bool useItemOn(Player* player, Level* level, ItemInstance* item, int x, int y, int z, int face, const Vec3& hit); + + void tick(); + ICreator* getCreator(); + + bool isCreativeType(); + + void initAbilities(Abilities& abilities); + +private: + void CreatorDestroyBlock(int x, int y, int z, int face); + + Creator* _creator; +}; + +#endif /*NET_MINECRAFT_CLIENT_GAMEMODE__CreatorMode_H__*/ diff --git a/src/client/gamemode/GameMode.cpp b/src/client/gamemode/GameMode.cpp index 7535f35..8009d64 100755 --- a/src/client/gamemode/GameMode.cpp +++ b/src/client/gamemode/GameMode.cpp @@ -1,173 +1,179 @@ -#include "GameMode.h" -#include "../Minecraft.h" -#include "../../network/packet/UseItemPacket.h" -#include "../../network/packet/PlayerActionPacket.h" -#include "../../world/level/Level.h" -#include "../../world/item/ItemInstance.h" -#include "../player/LocalPlayer.h" -#ifndef STANDALONE_SERVER -#include "../sound/SoundEngine.h" -#include "../particle/ParticleEngine.h" -#endif -#include "../../network/RakNetInstance.h" -#include "../../network/packet/RemoveBlockPacket.h" -#ifndef STANDALONE_SERVER -#include "../renderer/LevelRenderer.h" -#endif -#include "../../world/level/material/Material.h" - -GameMode::GameMode( Minecraft* minecraft) -: minecraft(minecraft), - destroyProgress(0), - oDestroyProgress(0), - destroyTicks(0), - destroyDelay(0) -{ -} - -/*virtual*/ -Player* GameMode::createPlayer(Level* level) { - return new LocalPlayer(minecraft, level, minecraft->user, level->dimension->id, isCreativeType()); -} - -/*virtual*/ -void GameMode::interact(Player* player, Entity* entity) { - player->interact(entity); -} - -/*virtual*/ -void GameMode::attack(Player* player, Entity* entity) { - if (minecraft->level->adventureSettings.noPvP && entity->isPlayer()) - return; - if (minecraft->level->adventureSettings.noPvM && entity->isMob()) - return; - player->attack(entity); -} - -/* virtual */ -void GameMode::startDestroyBlock( int x, int y, int z, int face ) { - if(minecraft->player->getCarriedItem() != NULL && minecraft->player->getCarriedItem()->id == Item::bow->id) - return; - destroyBlock(x, y, z, face); -} - -/*virtual*/ -bool GameMode::destroyBlock(int x, int y, int z, int face) { - Level* level = minecraft->level; - Tile* oldTile = Tile::tiles[level->getTile(x, y, z)]; - if (!oldTile) - return false; - - if (level->adventureSettings.immutableWorld) { - if (oldTile != (Tile*)Tile::leaves - && oldTile->material != Material::plant) { - return false; - } - } -#ifndef STANDALONE_SERVER - minecraft->particleEngine->destroy(x, y, z); -#endif - int data = level->getData(x, y, z); - bool changed = level->setTile(x, y, z, 0); - if (changed) { -#ifndef STANDALONE_SERVER - minecraft->soundEngine->play(oldTile->soundType->getBreakSound(), x + 0.5f, y + 0.5f, z + 0.5f, (oldTile->soundType->getVolume() + 1) / 2, oldTile->soundType->getPitch() * 0.8f); -#endif - oldTile->destroy(level, x, y, z, data); - if (minecraft->options.destroyVibration) minecraft->platform()->vibrate(24); - - if (minecraft->isOnline()) { - RemoveBlockPacket packet(minecraft->player, x, y, z); - minecraft->raknetInstance->send(packet); - } - } - return changed; -} -/*virtual*/ -bool GameMode::useItemOn(Player* player, Level* level, ItemInstance* item, int x, int y, int z, int face, const Vec3& hit) { - float clickX = hit.x - x; - float clickY = hit.y - y; - float clickZ = hit.z - z; - item = player->inventory->getSelected(); - if(level->isClientSide) { - UseItemPacket packet(x, y, z, face, item, player->entityId, clickX, clickY, clickZ); - minecraft->raknetInstance->send(packet); - } - int t = level->getTile(x, y, z); - if (t == Tile::invisible_bedrock->id) return false; - if (t > 0 && Tile::tiles[t]->use(level, x, y, z, player)) - return true; - - if (item == NULL) return false; - if(isCreativeType()) { - int aux = item->getAuxValue(); - int count = item->count; - bool success = item->useOn(player, level, x, y, z, face, clickX, clickY, clickZ); - item->setAuxValue(aux); - item->count = count; - return success; - } else { - return item->useOn(player, level, x, y, z, face, clickX, clickY, clickZ); - } -} - -bool GameMode::useItem( Player* player, Level* level, ItemInstance* item ) { - int oldCount = item->count; - - ItemInstance* itemInstance = item->use(level, player); - if(level->isClientSide) { - UseItemPacket packet(item, player->entityId, player->aimDirection); - minecraft->raknetInstance->send(packet); - } - if (itemInstance != item || (itemInstance != NULL && itemInstance->count != oldCount)) { - //player.inventory.items[player.inventory.selected] = itemInstance; - //if (itemInstance.count == 0) { - // player.inventory.items[player.inventory.selected] = NULL; - //} - return true; - } - return false; -} - -ItemInstance* GameMode::handleInventoryMouseClick( int containerId, int slotNum, int buttonNum, Player* player ) { - //return player.containerMenu.clicked(slotNum, buttonNum, player); - return NULL; -} - -void GameMode::handleCloseInventory( int containerId, Player* player ) { - //player.containerMenu.removed(player); - //player.containerMenu = player.inventoryMenu; -} - -float GameMode::getPickRange() { - return 5.0f; -} - -void GameMode::initPlayer( Player* player ) { - initAbilities(player->abilities); -} - -void GameMode::releaseUsingItem(Player* player){ - if(minecraft->level->isClientSide) { - PlayerActionPacket packet(PlayerActionPacket::RELEASE_USE_ITEM, 0, 0, 0, 0, player->entityId); - minecraft->raknetInstance->send(packet); - } - player->releaseUsingItem(); -} - -void GameMode::tick() { - oDestroyProgress = destroyProgress; -} - -void GameMode::render( float a ) { -#ifndef STANDALONE_SERVER - if (destroyProgress <= 0) { - minecraft->gui.progress = 0; - minecraft->levelRenderer->destroyProgress = 0; - } else { - float dp = oDestroyProgress + (destroyProgress - oDestroyProgress) * a; - minecraft->gui.progress = dp; - minecraft->levelRenderer->destroyProgress = dp; - } -#endif -} +#include "GameMode.h" +#include "../Minecraft.h" +#include "../../network/packet/UseItemPacket.h" +#include "../../network/packet/PlayerActionPacket.h" +#include "../../world/level/Level.h" +#include "../../world/item/ItemInstance.h" +#include "../player/LocalPlayer.h" +#include "client/Options.h" +#ifndef STANDALONE_SERVER +#include "../sound/SoundEngine.h" +#include "../particle/ParticleEngine.h" +#endif +#include "../../network/RakNetInstance.h" +#include "../../network/packet/RemoveBlockPacket.h" +#ifndef STANDALONE_SERVER +#include "../renderer/LevelRenderer.h" +#endif +#include "../../world/level/material/Material.h" + +GameMode::GameMode( Minecraft* minecraft) +: minecraft(minecraft), + destroyProgress(0), + oDestroyProgress(0), + destroyTicks(0), + destroyDelay(0) +{ +} + +/*virtual*/ +Player* GameMode::createPlayer(Level* level) { + return new LocalPlayer(minecraft, level, minecraft->options.getStringValue(OPTIONS_USERNAME), level->dimension->id, isCreativeType()); +} + +/*virtual*/ +void GameMode::interact(Player* player, Entity* entity) { + player->interact(entity); +} + +/*virtual*/ +void GameMode::attack(Player* player, Entity* entity) { + if (minecraft->level->adventureSettings.noPvP && entity->isPlayer()) + return; + if (minecraft->level->adventureSettings.noPvM && entity->isMob()) + return; + player->attack(entity); +} + +/* virtual */ +void GameMode::startDestroyBlock( int x, int y, int z, int face ) { + if(minecraft->player->getCarriedItem() != NULL && minecraft->player->getCarriedItem()->id == Item::bow->id) + return; + destroyBlock(x, y, z, face); +} + +/*virtual*/ +bool GameMode::destroyBlock(int x, int y, int z, int face) { + Level* level = minecraft->level; + Tile* oldTile = Tile::tiles[level->getTile(x, y, z)]; + if (!oldTile) + return false; + + if (level->adventureSettings.immutableWorld) { + if (oldTile != (Tile*)Tile::leaves + && oldTile->material != Material::plant) { + return false; + } + } +#ifndef STANDALONE_SERVER + minecraft->particleEngine->destroy(x, y, z); +#endif + int data = level->getData(x, y, z); + bool changed = level->setTile(x, y, z, 0); + if (changed) { +#ifndef STANDALONE_SERVER + minecraft->soundEngine->play(oldTile->soundType->getBreakSound(), x + 0.5f, y + 0.5f, z + 0.5f, (oldTile->soundType->getVolume() + 1) / 2, oldTile->soundType->getPitch() * 0.8f); +#endif + oldTile->destroy(level, x, y, z, data); + if (minecraft->options.getBooleanValue(OPTIONS_DESTROY_VIBRATION)) minecraft->platform()->vibrate(24); + + if (minecraft->isOnline()) { + RemoveBlockPacket packet(minecraft->player, x, y, z); + minecraft->raknetInstance->send(packet); + } + } + return changed; +} +/*virtual*/ +bool GameMode::useItemOn(Player* player, Level* level, ItemInstance* item, int x, int y, int z, int face, const Vec3& hit) { + float clickX = hit.x - x; + float clickY = hit.y - y; + float clickZ = hit.z - z; + if (level->isClientSide) { + LOGI("%f %f %f \n", player->x, player->y, player->z); + + item = player->inventory->getSelected(); + UseItemPacket packet(x, y, z, face, item, player->entityId, clickX, clickY, clickZ, player->x, player->y, player->z, + player->bb.x0, player->bb.y0, player->bb.z0, player->bb.x1, player->bb.y1, player->bb.z1); + + minecraft->raknetInstance->send(packet); + } + int t = level->getTile(x, y, z); + if (t == Tile::invisible_bedrock->id) return false; + if (t > 0 && Tile::tiles[t]->use(level, x, y, z, player)) + return true; + + if (item == NULL) return false; + if (isCreativeType()) { + int aux = item->getAuxValue(); + int count = item->count; + bool success = item->useOn(player, level, x, y, z, face, clickX, clickY, clickZ); + item->setAuxValue(aux); + item->count = count; + return success; + } else { + return item->useOn(player, level, x, y, z, face, clickX, clickY, clickZ); + } +} + +bool GameMode::useItem( Player* player, Level* level, ItemInstance* item ) { + int oldCount = item->count; + + ItemInstance* itemInstance = item->use(level, player); + if(level->isClientSide) { + UseItemPacket packet(item, player->entityId, player->aimDirection, player->x, player->y, player->z, + player->bb.x0, player->bb.y0, player->bb.z0, player->bb.x1, player->bb.y1, player->bb.z1); + minecraft->raknetInstance->send(packet); + } + if (itemInstance != item || (itemInstance != NULL && itemInstance->count != oldCount)) { + //player.inventory.items[player.inventory.selected] = itemInstance; + //if (itemInstance.count == 0) { + // player.inventory.items[player.inventory.selected] = NULL; + //} + return true; + } + return false; +} + +ItemInstance* GameMode::handleInventoryMouseClick( int containerId, int slotNum, int buttonNum, Player* player ) { + //return player.containerMenu.clicked(slotNum, buttonNum, player); + return NULL; +} + +void GameMode::handleCloseInventory( int containerId, Player* player ) { + //player.containerMenu.removed(player); + //player.containerMenu = player.inventoryMenu; +} + +float GameMode::getPickRange() { + return 5.0f; +} + +void GameMode::initPlayer( Player* player ) { + initAbilities(player->abilities); +} + +void GameMode::releaseUsingItem(Player* player){ + if (minecraft->level->isClientSide && player->isUsingItem()) { + PlayerActionPacket packet(PlayerActionPacket::RELEASE_USE_ITEM, 0, 0, 0, 0, player->entityId); + minecraft->raknetInstance->send(packet); + } + player->releaseUsingItem(); +} + +void GameMode::tick() { + oDestroyProgress = destroyProgress; +} + +void GameMode::render( float a ) { +#ifndef STANDALONE_SERVER + if (destroyProgress <= 0) { + minecraft->gui.progress = 0; + minecraft->levelRenderer->destroyProgress = 0; + } else { + float dp = oDestroyProgress + (destroyProgress - oDestroyProgress) * a; + minecraft->gui.progress = dp; + minecraft->levelRenderer->destroyProgress = dp; + } +#endif +} diff --git a/src/client/gamemode/SurvivalMode.cpp b/src/client/gamemode/SurvivalMode.cpp index ac49fda..c53c198 100755 --- a/src/client/gamemode/SurvivalMode.cpp +++ b/src/client/gamemode/SurvivalMode.cpp @@ -68,6 +68,7 @@ bool SurvivalMode::destroyBlock( int x, int y, int z, int face ) { minecraft->player->inventory->clearSlot(minecraft->player->inventory->selected); } } + if (changed && couldDestroy) { ItemInstance instance(t, 1, data); Tile::tiles[t]->playerDestroy(minecraft->level, minecraft->player, x, y, z, data); diff --git a/src/client/gui/Font.cpp b/src/client/gui/Font.cpp index 48efbf7..3f88fc6 100755 --- a/src/client/gui/Font.cpp +++ b/src/client/gui/Font.cpp @@ -186,7 +186,7 @@ void Font::draw( const std::string& str, float x, float y, int color, bool darke glPushMatrix2(); glTranslatef2((GLfloat)x, (GLfloat)y, 0.0f); for (unsigned int i = 0; i < str.length(); i++) { - while (str.length() > i + 1 && str[i] == '§') { + while (str.length() > i + 1 && str[i] == '\xa7') { int cc = hex.find((char)tolower(str[i + 1])); if (cc < 0 || cc > 15) cc = 15; lists[index++] = listPos + 256 + cc + (darken ? 16 : 0); @@ -235,7 +235,7 @@ int Font::width( const std::string& str ) int len = 0; for (unsigned int i = 0; i < str.length(); i++) { - if (str[i] == '§') { + if (str[i] == '\xa7') { i++; } else { //int ch = SharedConstants.acceptableLetters.indexOf(str.charAt(i)); @@ -274,7 +274,7 @@ std::string Font::sanitize( const std::string& str ) int j = 0; for (unsigned int i = 0; i < str.length(); i++) { - if (str[i] == '§') { + if (str[i] == '\xa7') { i++; //} else if (SharedConstants.acceptableLetters.indexOf(str.charAt(i)) >= 0) { } else { diff --git a/src/client/gui/Gui.cpp b/src/client/gui/Gui.cpp index 8e17ede..9026abc 100755 --- a/src/client/gui/Gui.cpp +++ b/src/client/gui/Gui.cpp @@ -1,9 +1,13 @@ #include "Gui.h" #include "Font.h" #include "client/Options.h" +#include "platform/input/Keyboard.h" #include "screens/IngameBlockSelectionScreen.h" +#include "screens/ChatScreen.h" +#include "screens/ConsoleScreen.h" #include "../Minecraft.h" #include "../player/LocalPlayer.h" +#include "../renderer/Chunk.h" #include "../renderer/Tesselator.h" #include "../renderer/TileRenderer.h" #include "../renderer/LevelRenderer.h" @@ -21,6 +25,10 @@ #include "../../platform/input/Mouse.h" #include "../../world/level/Level.h" #include "../../world/PosTranslator.h" +#include "../../platform/time.h" +#include +#include +#include float Gui::InvGuiScale = 1.0f / 3.0f; float Gui::GuiScale = 1.0f / Gui::InvGuiScale; @@ -29,11 +37,12 @@ const float Gui::DropTicks = 40.0f; //#include Gui::Gui(Minecraft* minecraft) -: minecraft(minecraft), + : minecraft(minecraft), tickCount(0), progress(0), overlayMessageTime(0), animateOverlayMessageColor(false), + chatScrollOffset(0), tbr(1), _inventoryNeedsUpdate(true), _flashSlotId(-1), @@ -43,7 +52,8 @@ Gui::Gui(Minecraft* minecraft) _currentDropTicks(-1), _currentDropSlot(-1), MAX_MESSAGE_WIDTH(240), - itemNameOverlayTime(2) + itemNameOverlayTime(2), + _openInventorySlot(minecraft->useTouchscreen()) { glGenBuffers2(1, &_inventoryRc.vboId); glGenBuffers2(1, &rcFeedbackInner.vboId); @@ -67,11 +77,8 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) { //minecraft->gameRenderer->setupGuiScreen(); Font* font = minecraft->font; -#ifdef PLATFORM_DESKTOP - const bool isTouchInterface = false; -#else const bool isTouchInterface = minecraft->useTouchscreen(); -#endif + const int screenWidth = (int)(minecraft->width * InvGuiScale); const int screenHeight = (int)(minecraft->height * InvGuiScale); blitOffset = -90; @@ -80,21 +87,29 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) { glColor4f2(1, 1, 1, 1); // H: 4 - // T: 7 - // L: 6 - // F: 3 + // T: 7 + // L: 6 + // F: 3 int ySlot = screenHeight - 16 - 3; - if (minecraft->gameMode->canHurtPlayer()) { - minecraft->textures->loadAndBindTexture("gui/icons.png"); - Tesselator& t = Tesselator::instance; - t.beginOverride(); - t.colorABGR(0xffffffff); - renderHearts(); - renderBubbles(); - t.endOverrideAndDraw(); + if (!minecraft->options.getBooleanValue(OPTIONS_HIDEGUI)) { + if (minecraft->gameMode->canHurtPlayer()) { + minecraft->textures->loadAndBindTexture("gui/icons.png"); + Tesselator& t = Tesselator::instance; + t.beginOverride(); + t.colorABGR(0xffffffff); + renderHearts(); + renderBubbles(); + t.endOverrideAndDraw(); + } } + // viginette has been fixed, was due to gl_blend not being enabled, my bad + if (minecraft->options.getBooleanValue(OPTIONS_FANCY_GRAPHICS) && minecraft->options.getBooleanValue(OPTIONS_VIGNETTE)){ + renderVignette(this->minecraft->player->getBrightness(a), screenWidth, screenHeight); + } + // shredder end + if(minecraft->player->getSleepTimer() > 0) { glDisable(GL_DEPTH_TEST); glDisable(GL_ALPHA_TEST); @@ -104,21 +119,42 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) { glEnable(GL_ALPHA_TEST); glEnable(GL_DEPTH_TEST); } + if (!minecraft->options.getBooleanValue(OPTIONS_HIDEGUI)) { + renderToolBar(a, ySlot, screenWidth); - renderToolBar(a, ySlot, screenWidth); + // font->drawShadow("Minecraft - Pocket Edition ", 2, 2, 0xffffffff); +// font->drawShadow("This is a demo, not the finished product", 2, 10 + 2, 0xffffffff); - glEnable(GL_BLEND); - unsigned int max = 10; - bool isChatting = false; - renderChatMessages(screenHeight, max, isChatting, font); + glEnable(GL_BLEND); + bool isChatting = (minecraft->screen && (dynamic_cast(minecraft->screen) || dynamic_cast(minecraft->screen))); + unsigned int max = 10; + if (isChatting) { + int lineHeight = 9; + max = (screenHeight - 48) / lineHeight; + if (max < 1) max = 1; + int maxScroll = (int)guiMessages.size() - (int)max; + if (maxScroll < 0) maxScroll = 0; + if (chatScrollOffset > maxScroll) chatScrollOffset = maxScroll; + } else { + chatScrollOffset = 0; + } + renderChatMessages(screenHeight, max, isChatting, font); #if !defined(RPI) - renderOnSelectItemNameText(screenWidth, font, ySlot); + renderOnSelectItemNameText(screenWidth, font, ySlot); #endif #if defined(RPI) - renderDebugInfo(); + renderDebugInfo(); #endif - glDisable(GL_BLEND); + if (Keyboard::isKeyDown(Keyboard::KEY_TAB)) { + renderPlayerList(font, screenWidth, screenHeight); + } + + if (minecraft->options.getBooleanValue(OPTIONS_RENDER_DEBUG)) + renderDebugInfo(); + } + + glDisable(GL_BLEND); glEnable2(GL_ALPHA_TEST); } @@ -157,7 +193,7 @@ void Gui::getSlotPos(int slot, int& posX, int& posY) { int screenWidth = (int)(minecraft->width * InvGuiScale); int screenHeight = (int)(minecraft->height * InvGuiScale); posX = screenWidth / 2 - getNumSlots() * 10 + slot * 20, - posY = screenHeight - 22; + posY = screenHeight - 22; } RectangleArea Gui::getRectangleArea(int extendSide) { @@ -170,7 +206,7 @@ RectangleArea Gui::getRectangleArea(int extendSide) { return RectangleArea(0, (float)minecraft->height-pHeight, pCenterX+pHalfWidth+2, (float)minecraft->height); if (extendSide > 0) return RectangleArea(pCenterX-pHalfWidth, (float)minecraft->height-pHeight, (float)minecraft->width, (float)minecraft->height); - + return RectangleArea(pCenterX-pHalfWidth, (float)minecraft->height-pHeight, pCenterX+pHalfWidth+2, (float)minecraft->height); } @@ -178,46 +214,84 @@ void Gui::handleClick(int button, int x, int y) { if (button != MouseAction::ACTION_LEFT) return; int slot = getSlotIdAt(x, y); - if (slot != -1) - { -#ifndef PLATFORM_DESKTOP - if (slot == (getNumSlots()-1)) - { + if (slot != -1) { + if (_openInventorySlot && slot == (getNumSlots()-1)) { minecraft->screenChooser.setScreen(SCREEN_BLOCKSELECTION); - } - else -#endif - { + } else { minecraft->player->inventory->selectSlot(slot); itemNameOverlayTime = 0; } } } -void Gui::handleKeyPressed(int key) -{ - if (key == 99) + void Gui::handleKeyPressed(int key) { - if (minecraft->player->inventory->selected > 0) + bool isChatting = (minecraft->screen && (dynamic_cast(minecraft->screen) || dynamic_cast(minecraft->screen))); + if (isChatting) { + // Allow scrolling the chat history with the mouse/keyboard when chat is open + if (key == 38) { // VK_UP + scrollChat(1); + return; + } else if (key == 40) { // VK_DOWN + scrollChat(-1); + return; + } else if (key == 33) { // VK_PRIOR (Page Up) + // Scroll by a page + int screenHeight = (int)(minecraft->height * InvGuiScale); + int maxVisible = (screenHeight - 48) / 9; + scrollChat(maxVisible); + return; + } else if (key == 34) { // VK_NEXT (Page Down) + int screenHeight = (int)(minecraft->height * InvGuiScale); + int maxVisible = (screenHeight - 48) / 9; + scrollChat(-maxVisible); + return; + } + } + + if (key == Keyboard::KEY_F1) { + minecraft->options.toggle(OPTIONS_HIDEGUI); + } + + if (key == 99) { - minecraft->player->inventory->selected--; + if (minecraft->player->inventory->selected > 0) + { + minecraft->player->inventory->selected--; + } + } + else if (key == 4) + { + if (minecraft->player->inventory->selected < (getNumSlots() - 2)) + { + minecraft->player->inventory->selected++; + } + } + else if (key == 100) + { + minecraft->screenChooser.setScreen(SCREEN_BLOCKSELECTION); + } + else if (key == minecraft->options.getIntValue(OPTIONS_KEY_DROP)) + { + minecraft->player->inventory->dropSlot(minecraft->player->inventory->selected, false); } } - else if (key == 4) - { - if (minecraft->player->inventory->selected < (getNumSlots() - 2)) - { - minecraft->player->inventory->selected++; - } - } - else if (key == 100) - { - minecraft->screenChooser.setScreen(SCREEN_BLOCKSELECTION); - } - else if (key == minecraft->options.keyDrop.key) - { - minecraft->player->inventory->dropSlot(minecraft->player->inventory->selected, false); - } + +void Gui::scrollChat(int delta) { + if (delta == 0) + return; + + int screenHeight = (int)(minecraft->height * InvGuiScale); + int maxVisible = (screenHeight - 48) / 9; + if (maxVisible <= 0) + return; + + int maxScroll = (int)guiMessages.size() - maxVisible; + if (maxScroll < 0) maxScroll = 0; + int desired = chatScrollOffset + delta; + if (desired < 0) desired = 0; + if (desired > maxScroll) desired = maxScroll; + chatScrollOffset = desired; } void Gui::tick() { @@ -226,11 +300,11 @@ void Gui::tick() { if(itemNameOverlayTime < 2) itemNameOverlayTime += 1.0f / SharedConstants::TicksPerSecond; for (unsigned int i = 0; i < guiMessages.size(); i++) { - guiMessages.at(i).ticks++; + guiMessages.at(i).ticks++; } - if (!minecraft->isCreativeMode()) - tickItemDrop(); + if (!minecraft->isCreativeMode()) + tickItemDrop(); } void Gui::addMessage(const std::string& _string) { @@ -250,9 +324,22 @@ void Gui::addMessage(const std::string& _string) { message.message = string; message.ticks = 0; guiMessages.insert(guiMessages.begin(), message); - while (guiMessages.size() > 30) { + + // Keep a larger history so users can scroll through the full chat + const unsigned int MaxHistoryLines = 200; + while (guiMessages.size() > MaxHistoryLines) { guiMessages.pop_back(); } + + // If the user has scrolled up, keep their window fixed (new messages shift older ones down) + if (chatScrollOffset > 0) { + chatScrollOffset++; + } +} + +void Gui::clearMessages() { + guiMessages.clear(); + chatScrollOffset = 0; } void Gui::setNowPlaying(const std::string& string) { @@ -264,9 +351,11 @@ void Gui::setNowPlaying(const std::string& string) { void Gui::displayClientMessage(const std::string& messageId) { //Language language = Language.getInstance(); //std::string languageString = language.getElement(messageId); - addMessage(std::string("Client message: ") + messageId); + addMessage(messageId); } + +// @todo - shredder: Function seems to be completely fine and ported over from java beta, but renders opaque??? need to investigate void Gui::renderVignette(float br, int w, int h) { br = 1 - br; if (br < 0) br = 0; @@ -275,9 +364,13 @@ void Gui::renderVignette(float br, int w, int h) { glDisable(GL_DEPTH_TEST); glDepthMask(false); + glEnable(GL_BLEND); glBlendFunc2(GL_ZERO, GL_ONE_MINUS_SRC_COLOR); glColor4f2(tbr, tbr, tbr, 1); + minecraft->textures->loadAndBindTexture("misc/vignette.png"); + glTexParameteri2(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri2(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); Tesselator& t = Tesselator::instance; t.begin(); @@ -288,6 +381,7 @@ void Gui::renderVignette(float br, int w, int h) { t.draw(); glDepthMask(true); glEnable(GL_DEPTH_TEST); + glDisable(GL_BLEND); glColor4f2(1, 1, 1, 1); glBlendFunc2(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); } @@ -330,7 +424,7 @@ void Gui::inventoryUpdated() { } void Gui::onGraphicsReset() { - inventoryUpdated(); + inventoryUpdated(); } void Gui::texturesLoaded( Textures* textures ) { @@ -345,9 +439,9 @@ void Gui::onConfigChanged( const Config& c ) { // Create outer feedback circle // #ifdef ANDROID - const float mm = 12; + const float mm = 50; //20 #else - const float mm = 12; + const float mm = 50; //20 #endif const float maxRadius = minecraft->pixelCalcUi.millimetersToPixels(mm); const float radius = Mth::Min(80.0f/2, maxRadius); @@ -397,7 +491,7 @@ void Gui::onConfigChanged( const Config& c ) { if (c.minecraft->useTouchscreen()) { // I'll bump this up to 6. int num = 6; // without "..." dots - if (!c.minecraft->options.isJoyTouchArea && c.width > 480) { + if (!c.minecraft->options.getBooleanValue(OPTIONS_IS_JOY_TOUCH_AREA) && c.width > 480) { while (num < Inventory::MAX_SELECTION_SIZE - 1) { int x0, x1, y; getSlotPos(0, x0, y); @@ -452,11 +546,7 @@ void Gui::tickItemDrop() static bool isCurrentlyActive = false; isCurrentlyActive = false; - int slots = getNumSlots(); - -#ifndef PLATFORM_DESKTOP - slots--; -#endif + int slots = getNumSlots() - _openInventorySlot; if (Mouse::isButtonDown(MouseAction::ACTION_LEFT)) { int slot = getSlotIdAt(Mouse::getX(), Mouse::getY()); @@ -511,12 +601,14 @@ void Gui::renderProgressIndicator( const bool isTouchInterface, const int screen ItemInstance* currentItem = minecraft->player->inventory->getSelected(); bool bowEquipped = currentItem != NULL ? currentItem->getItem() == Item::bow : false; bool itemInUse = currentItem != NULL ? currentItem->getItem() == minecraft->player->getUseItem()->getItem() : false; - if (!isTouchInterface || minecraft->options.isJoyTouchArea || (bowEquipped && itemInUse)) { - minecraft->textures->loadAndBindTexture("gui/icons.png"); - glEnable(GL_BLEND); - glBlendFunc2(GL_ONE_MINUS_DST_COLOR, GL_ONE_MINUS_SRC_COLOR); - blit(screenWidth/2 - 8, screenHeight/2 - 8, 0, 0, 16, 16); - glDisable(GL_BLEND); + if ((!isTouchInterface || minecraft->options.getBooleanValue(OPTIONS_IS_JOY_TOUCH_AREA) + || (bowEquipped && itemInUse)) && !minecraft->options.getBooleanValue(OPTIONS_HIDEGUI)) + { + minecraft->textures->loadAndBindTexture("gui/icons.png"); + glEnable(GL_BLEND); + glBlendFunc2(GL_ONE_MINUS_DST_COLOR, GL_ONE_MINUS_SRC_COLOR); + blit(screenWidth/2 - 8, screenHeight/2 - 8, 0, 0, 16, 16); + glDisable(GL_BLEND); } else if(!bowEquipped) { const float tprogress = minecraft->gameMode->destroyProgress; const float alpha = Mth::clamp(minecraft->inputHolder->alpha, 0.0f, 1.0f); @@ -535,7 +627,7 @@ void Gui::renderProgressIndicator( const bool isTouchInterface, const int screen const float x = InvGuiScale * minecraft->inputHolder->mousex; const float y = InvGuiScale * minecraft->inputHolder->mousey; glTranslatef2(x, y, 0); - drawArrayVT(rcFeedbackOuter.vboId, rcFeedbackOuter.vertexCount, 24); + drawArrayVT(rcFeedbackOuter.vboId, rcFeedbackOuter.vertexCount, 36); glTranslatef2(-x, -y, 0); glEnable2(GL_TEXTURE_2D); @@ -556,12 +648,12 @@ void Gui::renderProgressIndicator( const bool isTouchInterface, const int screen const float y = InvGuiScale * minecraft->inputHolder->mousey; glPushMatrix2(); glTranslatef2(x, y, 0); - drawArrayVT(rcFeedbackOuter.vboId, rcFeedbackOuter.vertexCount, 24); + drawArrayVT(rcFeedbackOuter.vboId, rcFeedbackOuter.vertexCount, 36); glScalef2(0.5f + progress, 0.5f + progress, 1); //glDisable2(GL_CULL_FACE); glColor4f2(1, 1, 1, 1); glBlendFunc2(GL_ONE_MINUS_DST_COLOR, GL_ONE_MINUS_SRC_COLOR); - drawArrayVT(rcFeedbackInner.vboId, rcFeedbackInner.vertexCount, 24, GL_TRIANGLE_FAN); + drawArrayVT(rcFeedbackInner.vboId, rcFeedbackInner.vertexCount, 36, GL_TRIANGLE_FAN); glPopMatrix2(); glDisable(GL_BLEND); @@ -580,18 +672,21 @@ void Gui::renderHearts() { int oh = minecraft->player->lastHealth; random.setSeed(tickCount * 312871); - int xx = 2;//screenWidth / 2 - getNumSlots() * 10; + int screenWidth = (int)(minecraft->width * InvGuiScale); + int screenHeight = (int)(minecraft->height * InvGuiScale); + + int xx = (minecraft->options.getBooleanValue(OPTIONS_BAR_ON_TOP)) ? screenWidth / 2 - getNumSlots() * 10 - 1 : 2; int armor = minecraft->player->getArmorValue(); for (int i = 0; i < Player::MAX_HEALTH / 2; i++) { - int yo = 2; + int yo = (minecraft->options.getBooleanValue(OPTIONS_BAR_ON_TOP)) ? screenHeight - 32 : 2; int ip2 = i + i + 1; if (armor > 0) { - int xo = xx + 80 + i * 8 + 4; - if (ip2 < armor) blit(xo, yo, 16 + 2 * 9, 9 * 1, 9, 9); - else if (ip2 == armor) blit(xo, yo, 16 + 4 * 9, 9 * 1, 9, 9); - else if (ip2 > armor) blit(xo, yo, 16 + 0 * 9, 9 * 1, 9, 9); + int xo = xx + 80 + i * 8 + 4; + if (ip2 < armor) blit(xo, yo, 16 + 2 * 9, 9 * 1, 9, 9); + else if (ip2 == armor) blit(xo, yo, 16 + 4 * 9, 9 * 1, 9, 9); + else if (ip2 > armor) blit(xo, yo, 16 + 0 * 9, 9 * 1, 9, 9); } int bg = 0; @@ -612,11 +707,15 @@ void Gui::renderHearts() { void Gui::renderBubbles() { if (minecraft->player->isUnderLiquid(Material::water)) { - int yo = 12; + int screenWidth = (int)(minecraft->width * InvGuiScale); + int screenHeight = (int)(minecraft->height * InvGuiScale); + + int xx = (minecraft->options.getBooleanValue(OPTIONS_BAR_ON_TOP)) ? screenWidth / 2 - getNumSlots() * 10 - 1 : 2; + int yo = (minecraft->options.getBooleanValue(OPTIONS_BAR_ON_TOP)) ? screenHeight - 42 : 12; int count = (int) std::ceil((minecraft->player->airSupply - 2) * 10.0f / Player::TOTAL_AIR_SUPPLY); int extra = (int) std::ceil((minecraft->player->airSupply) * 10.0f / Player::TOTAL_AIR_SUPPLY) - count; for (int i = 0; i < count + extra; i++) { - int xo = i * 8 + 2; + int xo = i * 8 + xx; if (i < count) blit(xo, yo, 16, 9 * 2, 9, 9); else blit(xo, yo, 16 + 9, 9 * 2, 9, 9); } @@ -632,18 +731,237 @@ void Gui::onLevelGenerated() { } void Gui::renderDebugInfo() { - static char buf[256]; - float xx = minecraft->player->x; - float yy = minecraft->player->y - minecraft->player->heightOffset; - float zz = minecraft->player->z; - posTranslator.to(xx, yy, zz); - sprintf(buf, "pos: %3.1f, %3.1f, %3.1f\n", xx, yy, zz); + // FPS counter (updates once per second) + static int fps = 0; + static int fpsLastTime = 0; + static int fpsFrames = 0; + static int displayChunkUpdates = 0; + float now = getTimeS(); + fpsFrames++; + if (now - fpsLastTime >= 1) { + fps = fpsFrames / (now - fpsLastTime); + + displayChunkUpdates = Chunk::updates; + + // 3. RESET the actual game counter to 0 for the next second + Chunk::updates = 0; + + fpsFrames = 0; + fpsLastTime = now; + } + + LocalPlayer* p = minecraft->player; + Level* lvl = minecraft->level; + + // Position + float px = p->x, py = p->y - p->heightOffset, pz = p->z; + int bx = (int)floorf(px), by = (int)floorf(py), bz = (int)floorf(pz); + int cx = bx >> 4, cz = bz >> 4; + + // Facing direction + float yMod = fmodf(p->yRot, 360.0f); + if (yMod < 0) yMod += 360.0f; + const char* facing; + const char* axis; + if (yMod < 45 || yMod >= 315) { facing = "South"; axis = "+Z"; } + else if (yMod < 135) { facing = "West"; axis = "-X"; } + else if (yMod < 225) { facing = "North"; axis = "-Z"; } + else { facing = "East"; axis = "+X"; } + + // Biome + const char* biomeName = "unknown"; + if (lvl) { + Biome* biome = lvl->getBiome(bx, bz); + if (biome) biomeName = biome->name.c_str(); + } + + // Time + long worldTime = lvl ? lvl->getTime() : 0; + long dayTime = worldTime % Level::TICKS_PER_DAY; + long day = worldTime / Level::TICKS_PER_DAY; + long seed = lvl ? lvl->getSeed() : 0; + + // Block looking at + std::string CurrentTile = "Air"; + if (minecraft->hitResult.type == TILE) { + int LookingX = minecraft->hitResult.x; + int LookingY = minecraft->hitResult.y; + int LookingZ = minecraft->hitResult.z; + + int tileID = minecraft->level->getTile(LookingX, LookingY, LookingZ); + if (tileID > 0 && tileID < 256){ + Tile* LookingTile = Tile::tiles[tileID]; + if (LookingTile != NULL) { + CurrentTile = LookingTile->getDescriptionId(); + } else { + CurrentTile = "Unknown Tile"; + } + } else { + CurrentTile = "Air"; + } + } + // Build lines (NULL entry = blank gap) + Font* font = minecraft->font; + + // @todo - add our own debug screen as an option alongside the restored java one, why does renderdebug have to be so jank - shredder + + // if java beta's restored debug menu is enabled + if (minecraft->options.getIntValue(OPTIONS_DEBUG_STYLE) == 0){ + + char buf[128]; + + sprintf(buf, "Minecraft - Pocket Edition (%d fps, %d chunk updates)", (int)fps, displayChunkUpdates); + font->drawShadow(buf, 2, 2, 0xffffff); + + font->drawShadow(minecraft->gatherStats1(), 2, 12, 0xFFFFFF); + font->drawShadow(minecraft->gatherStats2(), 2, 22, 0xFFFFFF); + font->drawShadow(minecraft->gatherStats3(), 2, 32, 0xFFFFFF); + font->drawShadow(minecraft->gatherStats4(), 2, 42, 0xFFFFFF); + + sprintf(buf, "x: %.8f", minecraft->player->x); + drawString(font, buf, 2, 64, 0xE0E0E0); + + sprintf(buf, "y: %.8f", minecraft->player->y); + drawString(font, buf, 2, 72, 0xE0E0E0); + + sprintf(buf, "z: %.8f", minecraft->player->z); + drawString(font, buf, 2, 80, 0xE0E0E0); + + sprintf(buf, "f: %d",Mth::floor(minecraft->player->yRot * 4.0f / 360.0f + 0.5) & 0x3); + drawString(font, buf, 2, 88, 0xE0E0E0); + + sprintf(buf, "Seed: %.ld", lvl->getSeed()); + drawString(font, buf, 2, 104, 0xE0E0E0); + + sprintf(buf, "Dimension: %d (%s)", lvl->dimension->id, lvl->dimension->getDimension().c_str()); + drawString(font, buf, 2, 114, 0xE0E0E0); + + sprintf(buf, "Biome: %s", biomeName); + drawString(font, buf, 2, 124, 0xE0E0E0); + + sprintf(buf, "Looking at: %s", CurrentTile.c_str()); + drawString(font, buf, 2, 134, 0xE0E0E0); + } + else if (minecraft->options.getIntValue(OPTIONS_DEBUG_STYLE) == 1){ + + + static char ln[8][96]; + sprintf(ln[0], "Minecraft PE 0.6.1 alpha (mcpe64)"); + sprintf(ln[1], "%.1f fps", fps); + ln[2][0] = '\0'; // blank separator + sprintf(ln[3], "XYZ: %.3f / %.3f / %.3f", px, py, pz); + sprintf(ln[4], "Block: %d %d %d Chunk: %d %d", bx, by, bz, cx, cz); + sprintf(ln[5], "Facing: %s (%s) (%.1f / %.1f)", facing, axis, p->yRot, p->xRot); + sprintf(ln[6], "Biome: %s", biomeName); + sprintf(ln[7], "Day %ld Time: %ld Seed: %ld", day, dayTime, seed); + + const int N = 8; + const float LH = (float)Font::DefaultLineHeight; // 10 font-pixels + const float MGN = 2.0f; // left/top margin in font-pixels + const float PAD = 2.0f; // horizontal padding for background +// Font* font = minecraft->font; + + // 1) Draw semi-transparent background boxes behind each line + for (int i = 0; i < N; i++) { + if (ln[i][0] == '\0') continue; + float w = (float)font->width(ln[i]); + float x0 = MGN - PAD; + float y0 = MGN + i * LH - 1.0f; + float x1 = MGN + w + PAD; + float y1 = MGN + (i + 1) * LH - 1.0f; + fill(x0, y0, x1, y1, 0x90000000); + } + + // 2) Draw text (no extra scale — font coords are in GUI units, same as fill) Tesselator& t = Tesselator::instance; t.beginOverride(); - t.scale2d(InvGuiScale, InvGuiScale); - minecraft->font->draw(buf, 2, 2, 0xffffff); - t.resetScale(); + for (int i = 0; i < N; i++) { + if (ln[i][0] == '\0') continue; + float y = MGN + i * LH; + int col = (i == 0) ? 0xffFFFF55 : 0xffffffff; // title yellow, rest white + font->draw(ln[i], MGN, y, col); + } t.endOverrideAndDraw(); + } +} + +void Gui::renderPlayerList(Font* font, int screenWidth, int screenHeight) { + // only show when in game, no other screen + // if (!minecraft->level) return; + + // only show the overlay while connected to a multiplayer server + Level* level = minecraft->level; + if (!level) return; + if (!level->isClientSide) return; + + std::vector playerNames; + playerNames.reserve(level->players.size()); + + for (Player* player : level->players) { + if (!player) continue; + playerNames.push_back(player->name); + } + + // is this check needed? if there are no players, the box won't render at all since height will be 0, + // but maybe we want to skip rendering entirely in that case + // if (playerNames.empty()) + // return; + + std::sort(playerNames.begin(), playerNames.end()); + + float maxNameWidth = 0.0f; + // find the longest name so we can size the box accordingly + for (const std::string& name : playerNames) { + float nameWidth = font->width(name); + if (nameWidth > maxNameWidth) + maxNameWidth = nameWidth; + } + + // player count title + std::ostringstream titleStream; + titleStream << "Players (" << playerNames.size() << ")"; + std::string titleText = titleStream.str(); + float titleWidth = font->width(titleText); + + if (titleWidth > maxNameWidth) + maxNameWidth = titleWidth; + + const float padding = 4.0f; + const float lineHeight = (float)Font::DefaultLineHeight; + + const float boxWidth = maxNameWidth + padding * 2; + const float boxHeight = (playerNames.size() + 1) * lineHeight + padding * 2; + + const float boxLeft = (screenWidth - boxWidth) / 2.0f; + const float boxTop = 10.0f; + const float boxRight = boxLeft + boxWidth; + const float boxBottom = boxTop + boxHeight; + + fill(boxLeft, boxTop, boxRight, boxBottom, 0x90000000); + + float titleX = (screenWidth - titleWidth) / 2.0f; + float titleY = boxTop + padding; + + // scale the text down slightly + // i think the gl scaling is the best for this + // oh my god this looks really bad OH GOD + //const float textScale = 0.8f; + //const float invTextScale = 1.0f / textScale; + //glPushMatrix2(); + //glScalef2(textScale, textScale, 1); + + // draw title + //font->draw(titleText, titleX * invTextScale, titleY * invTextScale, 0xFFFFFFFF); + font->draw(titleText, titleX, titleY, 0xFFFFFFFF); + + // draw player names + // we should add ping icons here eventually, but for now just show names + float currentY = boxTop + padding + lineHeight; + for (const std::string& name : playerNames) { + font->draw(name, (boxLeft + padding), currentY, 0xFFDDDDDD); + currentY += lineHeight; + } + //glPopMatrix2(); } void Gui::renderSleepAnimation( const int screenWidth, const int screenHeight ) { @@ -676,6 +994,70 @@ void Gui::renderOnSelectItemNameText( const int screenWidth, Font* font, int ySl } } + + +// helper structure used by drawColoredString +struct ColorSegment { + std::string text; + uint32_t color; +}; + +// parse [tag] and [/tag] markers; tags may contain a color name (gold, green, etc.) +static void parseColorTags(const std::string& in, std::vector& out) { + uint32_t curColor = 0xffffff; + size_t pos = 0; + while (pos < in.size()) { + size_t open = in.find('[', pos); + if (open == std::string::npos) { + out.push_back({in.substr(pos), curColor}); + break; + } + if (open > pos) { + out.push_back({in.substr(pos, open - pos), curColor}); + } + size_t close = in.find(']', open); + if (close == std::string::npos) { + out.push_back({in.substr(open), curColor}); + break; + } + std::string tag = in.substr(open + 1, close - open - 1); + if (!tag.empty() && tag[0] == '/') { + curColor = 0xffffff; + } else { + std::string lower; + lower.resize(tag.size()); + std::transform(tag.begin(), tag.end(), lower.begin(), ::tolower); + if (lower.find("gold") != std::string::npos) curColor = 0xffd700; + else if (lower.find("green") != std::string::npos) curColor = 0x00ff00; + else if (lower.find("yellow") != std::string::npos) curColor = 0xffff00; + else if (lower.find("red") != std::string::npos) curColor = 0xff0000; + else if (lower.find("blue") != std::string::npos) curColor = 0x0000ff; + } + pos = close + 1; + } +} + +void Gui::drawColoredString(Font* font, const std::string& text, float x, float y, int alpha) { + std::vector segs; + parseColorTags(text, segs); + float cx = x; + for (auto &s : segs) { + int color = s.color + (alpha << 24); + font->drawShadow(s.text, cx, y, color); + cx += font->width(s.text); + } +} + +float Gui::getColoredWidth(Font* font, const std::string& text) { + std::vector segs; + parseColorTags(text, segs); + float w = 0; + for (auto &s : segs) { + w += font->width(s.text); + } + return w; +} + void Gui::renderChatMessages( const int screenHeight, unsigned int max, bool isChatting, Font* font ) { // if (minecraft.screen instanceof ChatScreen) { // max = 20; @@ -691,9 +1073,16 @@ void Gui::renderChatMessages( const int screenHeight, unsigned int max, bool isC // // glScalef2(1.0f / ssc.scale, 1.0f / ssc.scale, 1); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); int baseY = screenHeight - 48; - for (unsigned int i = 0; i < guiMessages.size() && i < max; i++) { - if (guiMessages.at(i).ticks < 20 * 10 || isChatting) { - float t = guiMessages.at(i).ticks / (20 * 10.0f); + int start = chatScrollOffset; + if (start < 0) start = 0; + for (unsigned int i = 0; i < max; i++) { + unsigned int msgIdx = (unsigned int)start + i; + if (msgIdx >= guiMessages.size()) + break; + + GuiMessage& message = guiMessages.at(msgIdx); + if (message.ticks < 20 * 10 || isChatting) { + float t = message.ticks / (20 * 10.0f); t = 1 - t; t = t * 10; if (t < 0) t = 0; @@ -705,18 +1094,28 @@ void Gui::renderChatMessages( const int screenHeight, unsigned int max, bool isC if (alpha > 0) { const float x = 2; const float y = (float)(baseY - i * 9); - std::string msg = guiMessages.at(i).message; + std::string msg = message.message; this->fill(x, y - 1, x + MAX_MESSAGE_WIDTH, y + 8, (alpha / 2) << 24); glEnable(GL_BLEND); - font->drawShadow(msg, x, y, 0xffffff + (alpha << 24)); + // special-case join/leave announcements + int baseColor = 0xffffff; + if (msg.find(" joined the game") != std::string::npos || + msg.find(" left the game") != std::string::npos) { + baseColor = 0xffff00; // yellow + } + // replace previous logic; allow full colour tags now + Gui::drawColoredString(font, msg, x, y, alpha); } } } } void Gui::renderToolBar( float a, int ySlot, const int screenWidth ) { - glColor4f2(1, 1, 1, .5); + glColor4f2(1, 1, 1, 1); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + minecraft->textures->loadAndBindTexture("gui/gui.png"); Inventory* inventory = minecraft->player->inventory; @@ -763,13 +1162,7 @@ void Gui::renderToolBar( float a, int ySlot, const int screenWidth ) { float x = baseItemX; - int slots = getNumSlots(); - - // TODO: if using touchscreen - -#ifndef PLATFORM_DESKTOP - slots--; -#endif + int slots = getNumSlots() - _openInventorySlot; for (int i = 0; i < slots; i++) { renderSlot(i, (int)x, ySlot, a); @@ -777,9 +1170,10 @@ void Gui::renderToolBar( float a, int ySlot, const int screenWidth ) { } _inventoryNeedsUpdate = false; -#ifndef PLATFORM_DESKTOP - blit(screenWidth / 2 + 10 * getNumSlots() - 20 + 4, ySlot + 6, 242, 252, 14, 4, 14, 4); -#endif + + if (_openInventorySlot) { + blit(screenWidth / 2 + 10 * getNumSlots() - 20 + 4, ySlot + 6, 242, 252, 14, 4, 14, 4); + } minecraft->textures->loadAndBindTexture("gui/gui_blocks.png"); t.endOverrideAndDraw(); @@ -802,22 +1196,41 @@ void Gui::renderToolBar( float a, int ySlot, const int screenWidth ) { // Draw count //Tesselator& t = Tesselator::instance; - glPushMatrix2(); - glScalef2(InvGuiScale + InvGuiScale, InvGuiScale + InvGuiScale, 1); + const float k = 0.5f * GuiScale; - - t.beginOverride(); - if (minecraft->gameMode->isSurvivalType()) { - x = baseItemX; - for (int i = 0; i < slots; i++) { - ItemInstance* item = minecraft->player->inventory->getItem(i); - if (item && item->count >= 0) - renderSlotText(item, k*x, k*ySlot + 1, true, true); - x += 20; + if (minecraft->options.getBooleanValue(OPTIONS_JAVA_HUD)) // if true enables the java beta item count size and color and calls the java items decorations + { + t.beginOverride(); + if (minecraft->gameMode->isSurvivalType()) { + x = baseItemX; + for (int i = 0; i < slots; i++) { + ItemInstance* item = minecraft->player->inventory->getItem(i); + if (item && item->count >= 0) + ItemRenderer::renderGuiItemDecorations(minecraft->font, minecraft->textures, minecraft->player->inventory->getItem(i), x, (float)ySlot); + x += 20; + } } + minecraft->textures->loadAndBindTexture("font/default8.png"); + t.endOverrideAndDraw(); + } + else { // otherwise uses the normal pocket edition one + glPushMatrix2(); + glScalef2(InvGuiScale + InvGuiScale, InvGuiScale + InvGuiScale, 1); + t.beginOverride(); + if (minecraft->gameMode->isSurvivalType()) { + x = baseItemX; + for (int i = 0; i < slots; i++) { + ItemInstance* item = minecraft->player->inventory->getItem(i); + if (item && item->count >= 0) + renderSlotText(item, k*x, k*ySlot, true, true); + x += 20; + } + } + + minecraft->textures->loadAndBindTexture("font/default8.png"); + t.endOverrideAndDraw(); + + glPopMatrix2(); } - minecraft->textures->loadAndBindTexture("font/default8.png"); - t.endOverrideAndDraw(); - glPopMatrix2(); } diff --git a/src/client/gui/Gui.h b/src/client/gui/Gui.h index b1f4293..1335035 100755 --- a/src/client/gui/Gui.h +++ b/src/client/gui/Gui.h @@ -39,6 +39,7 @@ public: void handleClick(int button, int x, int y); void handleKeyPressed( int key ); + void scrollChat(int delta); void tick(); void render(float a, bool mouseFree, int xMouse, int yMouse); @@ -47,6 +48,12 @@ public: void renderChatMessages( const int screenHeight, unsigned int max, bool isChatting, Font* font ); + // draw a string containing simple [color]...[/color] tags; color names are matched + // case-insensitively and default to white. alpha is applied to each segment. + // draw tagged string (ignores simple [color]…[/color] tags) + static void drawColoredString(Font* font, const std::string& text, float x, float y, int alpha); + static float getColoredWidth(Font* font, const std::string& text); + void renderOnSelectItemNameText( const int screenWidth, Font* font, int ySlot ); void renderSleepAnimation( const int screenWidth, const int screenHeight ); @@ -54,10 +61,12 @@ public: void renderBubbles(); void renderHearts(); void renderDebugInfo(); + void renderPlayerList(Font* font, int screenWidth, int screenHeight); void renderProgressIndicator( const bool isTouchInterface, const int screenWidth, const int screenHeight, float a ); void addMessage(const std::string& string); + void clearMessages(); void postError(int errCode); void onGraphicsReset(); @@ -90,6 +99,7 @@ private: int MAX_MESSAGE_WIDTH; //ItemRenderer itemRenderer; GuiMessageList guiMessages; + int chatScrollOffset; Random random; Minecraft* minecraft; @@ -117,6 +127,8 @@ private: static const float DropTicks; float _currentDropTicks; int _currentDropSlot; + + bool _openInventorySlot; }; #endif /*NET_MINECRAFT_CLIENT_GUI__Gui_H__*/ diff --git a/src/client/gui/Screen.cpp b/src/client/gui/Screen.cpp index d92ef58..1a19efb 100755 --- a/src/client/gui/Screen.cpp +++ b/src/client/gui/Screen.cpp @@ -25,6 +25,12 @@ void Screen::render( int xm, int ym, float a ) Button* button = buttons[i]; button->render(minecraft, xm, ym); } + + // render any text boxes after buttons + for (unsigned int i = 0; i < textBoxes.size(); i++) { + TextBox* textbox = textBoxes[i]; + textbox->render(minecraft, xm, ym); + } } void Screen::init( Minecraft* minecraft, int width, int height ) @@ -55,6 +61,12 @@ bool Screen::handleBackEvent( bool isDown ) return false; } +void Screen::tick() { + for (auto& textbox : textBoxes) { + textbox->tick(minecraft); + } +} + void Screen::updateEvents() { if (passEvents) @@ -72,6 +84,14 @@ void Screen::updateEvents() void Screen::mouseEvent() { const MouseAction& e = Mouse::getEvent(); + // forward wheel events to subclasses + if (e.action == MouseAction::ACTION_WHEEL) { + int xm = e.x * width / minecraft->width; + int ym = e.y * height / minecraft->height - 1; + mouseWheel(e.dx, e.dy, xm, ym); + return; + } + if (!e.isButton()) return; @@ -96,10 +116,12 @@ void Screen::keyboardEvent() keyPressed(Keyboard::getEventKey()); } } + void Screen::keyboardTextEvent() { - keyboardNewChar(Keyboard::getChar()); + charPressed(Keyboard::getChar()); } + void Screen::renderBackground() { renderBackground(0); @@ -157,20 +179,28 @@ void Screen::keyPressed( int eventKey ) minecraft->setScreen(NULL); //minecraft->grabMouse(); } + + // pass key events to any text boxes first + for (auto& textbox : textBoxes) { + textbox->keyPressed(minecraft, eventKey); + } + +#ifdef TABBING if (minecraft->useTouchscreen()) return; + // "Tabbing" the buttons (walking with keys) const int tabButtonCount = tabButtons.size(); if (!tabButtonCount) return; Options& o = minecraft->options; - if (eventKey == o.keyMenuNext.key) + if (eventKey == o.getIntValue(OPTIONS_KEY_MENU_NEXT)) if (++tabButtonIndex == tabButtonCount) tabButtonIndex = 0; - if (eventKey == o.keyMenuPrevious.key) + if (eventKey == o.getIntValue(OPTIONS_KEY_MENU_PREV)) if (--tabButtonIndex == -1) tabButtonIndex = tabButtonCount-1; - if (eventKey == o.keyMenuOk.key) { + if (eventKey == o.getIntValue(OPTIONS_KEY_MENU_OK)) { Button* button = tabButtons[tabButtonIndex]; if (button->active) { minecraft->soundEngine->playUI("random.click", 1, 1); @@ -179,15 +209,24 @@ void Screen::keyPressed( int eventKey ) } updateTabButtonSelection(); +#endif +} + +void Screen::charPressed(char inputChar) { + for (auto& textbox : textBoxes) { + textbox->charPressed(minecraft, inputChar); + } } void Screen::updateTabButtonSelection() { +#ifdef TABBING if (minecraft->useTouchscreen()) return; for (unsigned int i = 0; i < tabButtons.size(); ++i) tabButtons[i]->selected = (i == tabButtonIndex); +#endif } void Screen::mouseClicked( int x, int y, int buttonNum ) @@ -210,6 +249,11 @@ void Screen::mouseClicked( int x, int y, int buttonNum ) } } } + + // let textboxes see the click regardless + for (auto& textbox : textBoxes) { + textbox->mouseClicked(minecraft, x, y, buttonNum); + } } void Screen::mouseReleased( int x, int y, int buttonNum ) diff --git a/src/client/gui/Screen.h b/src/client/gui/Screen.h index eebe588..16b551a 100755 --- a/src/client/gui/Screen.h +++ b/src/client/gui/Screen.h @@ -31,7 +31,7 @@ public: virtual void keyboardTextEvent(); virtual bool handleBackEvent(bool isDown); - virtual void tick() {} + virtual void tick(); virtual void removed() {} @@ -57,8 +57,11 @@ protected: virtual void mouseClicked(int x, int y, int buttonNum); virtual void mouseReleased(int x, int y, int buttonNum); + // mouse wheel movement (dx/dy are wheel deltas, xm/ym are GUI coords) + virtual void mouseWheel(int dx, int dy, int xm, int ym) {} + virtual void keyPressed(int eventKey); - virtual void keyboardNewChar(char inputChar) {} + virtual void charPressed(char inputChar); public: int width; int height; diff --git a/src/client/gui/components/Button.cpp b/src/client/gui/components/Button.cpp index e03ae37..39022a7 100755 --- a/src/client/gui/components/Button.cpp +++ b/src/client/gui/components/Button.cpp @@ -95,7 +95,7 @@ void Button::renderBg( Minecraft* minecraft, int xm, int ym ) } bool Button::hovered(Minecraft* minecraft, int xm , int ym) { - return minecraft->useTouchscreen()? (_currentlyDown && isInside(xm, ym)) : false; + return minecraft->useTouchscreen()? (_currentlyDown && isInside(xm, ym)) : isInside(xm, ym); } bool Button::isInside( int xm, int ym ) { @@ -143,7 +143,8 @@ TButton::TButton( int id, int x, int y, int w, int h, const std::string& msg ) void TButton::renderBg( Minecraft* minecraft, int xm, int ym ) { - bool hovered = active && (minecraft->useTouchscreen()? (_currentlyDown && xm >= x && ym >= y && xm < x + width && ym < y + height) : false); + bool hovered = active && (minecraft->useTouchscreen()? (_currentlyDown && xm >= x && ym >= y && xm < x + width && ym < y + height) : isInside(xm, ym)); + // bool hovered = active && (_currentlyDown && isInside(xm, ym)); minecraft->textures->loadAndBindTexture("gui/touchgui.png"); diff --git a/src/client/gui/components/GuiElement.h b/src/client/gui/components/GuiElement.h index d54a371..f0a0a33 100755 --- a/src/client/gui/components/GuiElement.h +++ b/src/client/gui/components/GuiElement.h @@ -9,13 +9,20 @@ class GuiElement : public GuiComponent { public: GuiElement(bool active=false, bool visible=true, int x = 0, int y = 0, int width=24, int height=24); virtual ~GuiElement() {} - virtual void tick(Minecraft* minecraft) {} + + virtual void tick(Minecraft* minecraft) {} virtual void render(Minecraft* minecraft, int xm, int ym) { } virtual void setupPositions() {} + virtual void mouseClicked(Minecraft* minecraft, int x, int y, int buttonNum) {} virtual void mouseReleased(Minecraft* minecraft, int x, int y, int buttonNum) {} + virtual void keyPressed(Minecraft* minecraft, int key) {} + virtual void charPressed(Minecraft* minecraft, char key) {} + virtual bool pointInside(int x, int y); + void setVisible(bool visible); + bool active; bool visible; int x; diff --git a/src/client/gui/components/GuiElementContainer.cpp b/src/client/gui/components/GuiElementContainer.cpp index b9ea085..377538a 100755 --- a/src/client/gui/components/GuiElementContainer.cpp +++ b/src/client/gui/components/GuiElementContainer.cpp @@ -35,6 +35,17 @@ void GuiElementContainer::removeChild( GuiElement* element ) { children.erase(it); } +bool GuiElementContainer::containsPointInChildren(int x, int y) const { + for (auto it = children.begin(); it != children.end(); ++it) { + GuiElement* child = *it; + if (child == NULL || !child->visible) continue; + if (child->pointInside(x, y)) return true; + const GuiElementContainer* container = dynamic_cast(child); + if (container != NULL && container->containsPointInChildren(x, y)) return true; + } + return false; +} + void GuiElementContainer::tick( Minecraft* minecraft ) { for(std::vector::iterator it = children.begin(); it != children.end(); ++it) { (*it)->tick(minecraft); @@ -52,3 +63,15 @@ void GuiElementContainer::mouseReleased( Minecraft* minecraft, int x, int y, int (*it)->mouseReleased(minecraft, x, y, buttonNum); } } + +void GuiElementContainer::keyPressed(Minecraft* minecraft, int key) { + for(std::vector::iterator it = children.begin(); it != children.end(); ++it) { + (*it)->keyPressed(minecraft, key); + } +} + +void GuiElementContainer::charPressed(Minecraft* minecraft, char key) { + for(std::vector::iterator it = children.begin(); it != children.end(); ++it) { + (*it)->charPressed(minecraft, key); + } +} \ No newline at end of file diff --git a/src/client/gui/components/GuiElementContainer.h b/src/client/gui/components/GuiElementContainer.h index 3b20bae..06df761 100755 --- a/src/client/gui/components/GuiElementContainer.h +++ b/src/client/gui/components/GuiElementContainer.h @@ -5,20 +5,22 @@ class Tesselator; class Minecraft; -class GuiElementContainer : public GuiElement { -public: - GuiElementContainer(bool active=false, bool visible=true, int x = 0, int y = 0, int width=24, int height=24); - virtual ~GuiElementContainer(); - virtual void render(Minecraft* minecraft, int xm, int ym); - virtual void setupPositions(); - virtual void addChild(GuiElement* element); - virtual void removeChild(GuiElement* element); - - virtual void tick( Minecraft* minecraft ); +class GuiElementContainer : public GuiElement { +public: + GuiElementContainer(bool active=false, bool visible=true, int x = 0, int y = 0, int width=24, int height=24); + virtual ~GuiElementContainer(); + virtual void render(Minecraft* minecraft, int xm, int ym); + virtual void setupPositions(); + virtual void addChild(GuiElement* element); + virtual void removeChild(GuiElement* element); + bool containsPointInChildren(int x, int y) const; + + virtual void tick( Minecraft* minecraft ); virtual void mouseClicked( Minecraft* minecraft, int x, int y, int buttonNum ); - virtual void mouseReleased( Minecraft* minecraft, int x, int y, int buttonNum ); + virtual void keyPressed(Minecraft* minecraft, int key); + virtual void charPressed(Minecraft* minecraft, char key); protected: std::vector children; diff --git a/src/client/gui/components/ImageButton.cpp b/src/client/gui/components/ImageButton.cpp index ce01534..3d95acc 100755 --- a/src/client/gui/components/ImageButton.cpp +++ b/src/client/gui/components/ImageButton.cpp @@ -4,6 +4,7 @@ #include "../../../platform/log.h" #include "../../../util/Mth.h" #include "../../renderer/Textures.h" +#include ImageButton::ImageButton(int id, const std::string& msg) @@ -41,7 +42,7 @@ void ImageButton::render(Minecraft* minecraft, int xm, int ym) { //minecraft->textures->loadAndBindTexture("gui/gui.png"); glColor4f2(1, 1, 1, 1); - bool hovered = active && (minecraft->useTouchscreen()? (_currentlyDown && xm >= x && ym >= y && xm < x + width && ym < y + height) : false); + bool hovered = active && (minecraft->useTouchscreen()? (_currentlyDown && xm >= x && ym >= y && xm < x + width && ym < y + height) : isInside(xm, ym)); bool IsSecondImage = isSecondImage(hovered); //printf("ButtonId: %d - Hovered? %d (cause: %d, %d, %d, %d, <> %d, %d)\n", id, hovered, x, y, x+w, y+h, xm, ym); @@ -112,43 +113,17 @@ void ImageButton::render(Minecraft* minecraft, int xm, int ym) { // // A toggleable Button // -OptionButton::OptionButton(const Options::Option* option) -: _option(option), - _isFloat(false), - super(ButtonId, "") -{ -} - -OptionButton::OptionButton(const Options::Option* option, float onValue, float offValue) -: _option(option), - _isFloat(true), - _onValue(onValue), - _offValue(offValue), - super(ButtonId, "") -{ -} - -bool OptionButton::isSecondImage(bool hovered) { - return _secondImage; -} +OptionButton::OptionButton(OptionId option) : m_optId(option), super(ButtonId, "") {} void OptionButton::toggle(Options* options) { - if (_isFloat) { - options->set(_option, (Mth::abs(_current - _onValue) < 0.01f) ? _offValue : _onValue); - } else { - options->toggle(_option, 1); - } + options->toggle(m_optId); + // Update graphics here updateImage(options); } void OptionButton::updateImage(Options* options) { - if (_isFloat) { - _current = options->getProgressValue(_option); - _secondImage = Mth::abs(_current - _onValue) < 0.01f; - } else { - _secondImage = options->getBooleanValue(_option); - } + _secondImage = options->getBooleanValue(m_optId); } void OptionButton::mouseClicked( Minecraft* minecraft, int x, int y, int buttonNum ) { diff --git a/src/client/gui/components/ImageButton.h b/src/client/gui/components/ImageButton.h index f14c25f..a1bd777 100755 --- a/src/client/gui/components/ImageButton.h +++ b/src/client/gui/components/ImageButton.h @@ -77,28 +77,20 @@ class OptionButton: public ImageButton { typedef ImageButton super; public: - OptionButton(const Options::Option* option); - OptionButton(const Options::Option* option, float onValue, float offValue); + OptionButton(OptionId optId); void toggle(Options* options); void updateImage(Options* options); static const int ButtonId = 9999999; protected: - bool isSecondImage(bool hovered); + bool isSecondImage(bool hovered) { return _secondImage; } virtual void mouseClicked( Minecraft* minecraft, int x, int y, int buttonNum ); private: - - const Options::Option* _option; + OptionId m_optId; bool _secondImage; - - // If not float, it's considered to be a boolean value - bool _isFloat; - float _onValue; - float _offValue; - float _current; }; diff --git a/src/client/gui/components/KeyOption.cpp b/src/client/gui/components/KeyOption.cpp new file mode 100644 index 0000000..36b4c7f --- /dev/null +++ b/src/client/gui/components/KeyOption.cpp @@ -0,0 +1,22 @@ +#include "KeyOption.h" +#include + +KeyOption::KeyOption(Minecraft* minecraft, OptionId optId) + : Touch::TButton((int)optId, Keyboard::getKeyName(minecraft->options.getIntValue(optId))) {} + + +void KeyOption::mouseClicked(Minecraft* minecraft, int x, int y, int buttonNum) { + selected = isInside(x, y); + msg = (selected)? "..." : Keyboard::getKeyName(minecraft->options.getIntValue((OptionId)id)); +} + +void KeyOption::keyPressed(Minecraft* minecraft, int key) { + if (!selected) return; + + if (key != Keyboard::KEY_ESCAPE) { + minecraft->options.set((OptionId)id, key); + } + + selected = false; + msg = Keyboard::getKeyName(minecraft->options.getIntValue((OptionId)id)); +} \ No newline at end of file diff --git a/src/client/gui/components/KeyOption.h b/src/client/gui/components/KeyOption.h new file mode 100644 index 0000000..fabdc7a --- /dev/null +++ b/src/client/gui/components/KeyOption.h @@ -0,0 +1,14 @@ +#pragma once +#include "Button.h" +#include + +class KeyOption : public Touch::TButton { +public: + KeyOption(Minecraft* minecraft, OptionId optId); + + virtual void mouseClicked(Minecraft* minecraft, int x, int y, int buttonNum); + virtual void released(int mx, int my) {} + virtual void keyPressed(Minecraft* minecraft, int key); +protected: + bool m_captureMode; +}; \ No newline at end of file diff --git a/src/client/gui/components/LargeImageButton.cpp b/src/client/gui/components/LargeImageButton.cpp index 673d983..db1f599 100755 --- a/src/client/gui/components/LargeImageButton.cpp +++ b/src/client/gui/components/LargeImageButton.cpp @@ -33,7 +33,7 @@ void LargeImageButton::render(Minecraft* minecraft, int xm, int ym) { //minecraft->textures->loadAndBindTexture("gui/gui.png"); glColor4f2(1, 1, 1, 1); - bool hovered = active && (minecraft->useTouchscreen()? (_currentlyDown && xm >= x && ym >= y && xm < x + width && ym < y + height) : false); + bool hovered = active && (minecraft->useTouchscreen()? (_currentlyDown && xm >= x && ym >= y && xm < x + width && ym < y + height) : isInside(xm, ym)); //printf("ButtonId: %d - Hovered? %d (cause: %d, %d, %d, %d, <> %d, %d)\n", id, hovered, x, y, x+w, y+h, xm, ym); //int yImage = getYImage(hovered || selected); diff --git a/src/client/gui/components/OptionsGroup.cpp b/src/client/gui/components/OptionsGroup.cpp index 7cd1a3a..d4dd161 100755 --- a/src/client/gui/components/OptionsGroup.cpp +++ b/src/client/gui/components/OptionsGroup.cpp @@ -1,68 +1,219 @@ -#include "OptionsGroup.h" -#include "../../Minecraft.h" -#include "ImageButton.h" -#include "OptionsItem.h" -#include "Slider.h" -#include "../../../locale/I18n.h" -OptionsGroup::OptionsGroup( std::string labelID ) { - label = I18n::get(labelID); -} - -void OptionsGroup::setupPositions() { - // First we write the header and then we add the items - int curY = y + 10; - for(std::vector::iterator it = children.begin(); it != children.end(); ++it) { - (*it)->width = width - 5; - - (*it)->y = curY; - (*it)->x = x + 10; - (*it)->setupPositions(); - curY += (*it)->height + 3; - } - height = curY; -} - -void OptionsGroup::render( Minecraft* minecraft, int xm, int ym ) { - minecraft->font->draw(label, (float)x + 2, (float)y, 0xffffffff, false); - super::render(minecraft, xm, ym); -} - -OptionsGroup& OptionsGroup::addOptionItem( const Options::Option* option, Minecraft* minecraft ) { - if(option->isBoolean()) - createToggle(option, minecraft); - else if(option->isProgress()) - createProgressSlider(option, minecraft); - else if(option->isInt()) - createStepSlider(option, minecraft); - return *this; -} - -void OptionsGroup::createToggle( const Options::Option* option, Minecraft* minecraft ) { - ImageDef def; - def.setSrc(IntRectangle(160, 206, 39, 20)); - def.name = "gui/touchgui.png"; - def.width = 39 * 0.7f; - def.height = 20 * 0.7f; - OptionButton* element = new OptionButton(option); - element->setImageDef(def, true); - std::string itemLabel = I18n::get(option->getCaptionId()); - OptionsItem* item = new OptionsItem(itemLabel, element); - addChild(item); - setupPositions(); -} - -void OptionsGroup::createProgressSlider( const Options::Option* option, Minecraft* minecraft ) { - Slider* element = new Slider(minecraft, - option, - minecraft->options.getProgrssMin(option), - minecraft->options.getProgrssMax(option)); - element->width = 100; - element->height = 20; - OptionsItem* item = new OptionsItem(label, element); - addChild(item); - setupPositions(); -} - -void OptionsGroup::createStepSlider( const Options::Option* option, Minecraft* minecraft ) { - -} +#include "OptionsGroup.h" +#include "../../Minecraft.h" +#include "ImageButton.h" +#include "OptionsItem.h" +#include "Slider.h" +#include "../../../locale/I18n.h" +#include "TextOption.h" +#include "KeyOption.h" +#include +#include "../Gui.h" +#include "../Screen.h" +#include "../../../platform/input/Mouse.h" +#include "../../../util/Mth.h" + +OptionsGroup::OptionsGroup( std::string labelID ) { + label = I18n::get(labelID); +} + +void OptionsGroup::setupPositions() { + const int labelHeight = 18; + const int bottomPadding = 36; + const float requestedScroll = scrollOffsetY; + const int scrollOffset = (int)requestedScroll; + int curY = y + labelHeight - scrollOffset; + const int contentStartY = y + labelHeight; + + // First we write the header and then we add the items + for(auto it = children.begin(); it != children.end(); ++it) { + (*it)->width = width - 5; + + (*it)->y = curY; + (*it)->x = x + 10; + (*it)->setupPositions(); + curY += (*it)->height + 3; + } + curY += bottomPadding; + contentHeight = std::max(0, curY - contentStartY + scrollOffset); + maxScrollOffsetY = std::max(0, contentHeight - (height - labelHeight)); + const float clampedScroll = Mth::clamp(requestedScroll, 0.0f, maxScrollOffsetY); + if (clampedScroll != requestedScroll) { + scrollOffsetY = clampedScroll; + setupPositions(); + } +} + +void OptionsGroup::render( Minecraft* minecraft, int xm, int ym ) { + float padX = 10.0f; + float padY = 5.0f; + const int labelHeight = 18; + + minecraft->font->draw(label, (float)x + padX, (float)y + padY, 0xffffffff, false); + + glEnable2(GL_SCISSOR_TEST); + glScissor( + Gui::GuiScale * x, + minecraft->height - Gui::GuiScale * (y + height), + Gui::GuiScale * width, + Gui::GuiScale * (height - labelHeight) + ); + + super::render(minecraft, xm, ym); + glDisable2(GL_SCISSOR_TEST); +} + +void OptionsGroup::tick(Minecraft* minecraft) { + int xm = Mouse::getX(); + int ym = Mouse::getY(); + if (minecraft->screen != NULL) { + minecraft->screen->toGUICoordinate(xm, ym); + } + + bool leftDown = Mouse::isButtonDown(MouseAction::ACTION_LEFT); + + if (trackingScrollGesture && leftDown) { + int dy = ym - lastDragY; + int dx = xm - dragStartX; + if (!scrollingGesture) { + int totalDx = xm - dragStartX; + int totalDy = ym - dragStartY; + if (std::abs(totalDx) >= ScrollStartThreshold || std::abs(totalDy) >= ScrollStartThreshold) { + if (std::abs(totalDy) >= std::abs(totalDx)) { + scrollingGesture = true; + } else if (!touchDispatched) { + super::mouseClicked(minecraft, touchStartX, touchStartY, MouseAction::ACTION_LEFT); + touchDispatched = true; + } + } + } + if (scrollingGesture && dy != 0) { + scrollByPixels((float)dy); + } + lastDragY = ym; + } + super::tick(minecraft); +} + +void OptionsGroup::mouseClicked(Minecraft* minecraft, int x, int y, int buttonNum) { + trackingScrollGesture = false; + scrollingGesture = false; + touchDispatched = false; + + if (buttonNum == MouseAction::ACTION_LEFT && pointInside(x, y)) { + trackingScrollGesture = true; + dragStartX = x; + dragStartY = y; + lastDragY = y; + touchStartX = x; + touchStartY = y; + return; + } + + super::mouseClicked(minecraft, x, y, buttonNum); +} + +void OptionsGroup::mouseReleased(Minecraft* minecraft, int x, int y, int buttonNum) { + bool wasScrolling = scrollingGesture; + bool wasTracking = trackingScrollGesture; + trackingScrollGesture = false; + scrollingGesture = false; + if (buttonNum == MouseAction::ACTION_LEFT && wasTracking && !touchDispatched && pointInside(touchStartX, touchStartY)) { + super::mouseClicked(minecraft, touchStartX, touchStartY, buttonNum); + touchDispatched = true; + } + + if (!wasScrolling) { + super::mouseReleased(minecraft, x, y, buttonNum); + } +} + +void OptionsGroup::scrollByPixels(float deltaY) { + if (deltaY == 0.0f || maxScrollOffsetY <= 0.0f) return; + + scrollOffsetY = Mth::clamp(scrollOffsetY - deltaY, 0.0f, maxScrollOffsetY); + setupPositions(); +} + +bool OptionsGroup::isScrollingGestureActive() const { + return trackingScrollGesture || scrollingGesture; +} + +OptionsGroup& OptionsGroup::addOptionItem(OptionId optId, Minecraft* minecraft ) { + auto option = minecraft->options.getOpt(optId); + + if (option == nullptr) return *this; + + // TODO: do a options key class to check it faster via dynamic_cast + if (option->getStringId().find("options.key") != std::string::npos) createKey(optId, minecraft); + else if (dynamic_cast(option)) createToggle(optId, minecraft); + else if (dynamic_cast(option)) createProgressSlider(optId, minecraft); + else if (dynamic_cast(option)) createStepSlider(optId, minecraft); + else if (dynamic_cast(option)) createTextbox(optId, minecraft); + + return *this; +} + +// TODO: wrap this copypaste shit into templates + +void OptionsGroup::createToggle(OptionId optId, Minecraft* minecraft ) { + ImageDef def; + + def.setSrc(IntRectangle(160, 206, 39, 20)); + def.name = "gui/touchgui.png"; + def.width = 39 * 0.7f; + def.height = 20 * 0.7f; + + OptionButton* element = new OptionButton(optId); + element->setImageDef(def, true); + element->updateImage(&minecraft->options); + + std::string itemLabel = I18n::get(minecraft->options.getOpt(optId)->getStringId()); + + OptionsItem* item = new OptionsItem(optId, itemLabel, element); + + addChild(item); + setupPositions(); +} + +void OptionsGroup::createProgressSlider(OptionId optId, Minecraft* minecraft ) { + Slider* element = new SliderFloat(minecraft, optId); + element->width = 100; + element->height = 20; + + std::string itemLabel = I18n::get(minecraft->options.getOpt(optId)->getStringId()); + OptionsItem* item = new OptionsItem(optId, itemLabel, element); + addChild(item); + setupPositions(); +} + +void OptionsGroup::createStepSlider(OptionId optId, Minecraft* minecraft ) { + Slider* element = new SliderInt(minecraft, optId); + element->width = 100; + element->height = 20; + std::string itemLabel = I18n::get(minecraft->options.getOpt(optId)->getStringId()); + OptionsItem* item = new OptionsItem(optId, itemLabel, element); + addChild(item); + setupPositions(); +} + +void OptionsGroup::createTextbox(OptionId optId, Minecraft* minecraft) { + TextBox* element = new TextOption(minecraft, optId); + element->width = 100; + element->height = 20; + + std::string itemLabel = I18n::get(minecraft->options.getOpt(optId)->getStringId()); + OptionsItem* item = new OptionsItem(optId, itemLabel, element); + addChild(item); + setupPositions(); +} + +void OptionsGroup::createKey(OptionId optId, Minecraft* minecraft) { + KeyOption* element = new KeyOption(minecraft, optId); + element->width = 50; + element->height = 20; + + std::string itemLabel = I18n::get(minecraft->options.getOpt(optId)->getStringId()); + OptionsItem* item = new OptionsItem(optId, itemLabel, element); + addChild(item); + setupPositions(); +} diff --git a/src/client/gui/components/OptionsGroup.h b/src/client/gui/components/OptionsGroup.h index 5fbe0c0..bb284fa 100755 --- a/src/client/gui/components/OptionsGroup.h +++ b/src/client/gui/components/OptionsGroup.h @@ -1,27 +1,49 @@ -#ifndef NET_MINECRAFT_CLIENT_GUI_COMPONENTS__OptionsGroup_H__ -#define NET_MINECRAFT_CLIENT_GUI_COMPONENTS__OptionsGroup_H__ - -//package net.minecraft.client.gui; - -#include -#include "GuiElementContainer.h" -#include "../../Options.h" - -class Font; -class Minecraft; - -class OptionsGroup: public GuiElementContainer { - typedef GuiElementContainer super; -public: - OptionsGroup(std::string labelID); - virtual void setupPositions(); - virtual void render(Minecraft* minecraft, int xm, int ym); - virtual OptionsGroup& addOptionItem(const Options::Option* option, Minecraft* minecraft); -protected: - virtual void createToggle(const Options::Option* option, Minecraft* minecraft); - virtual void createProgressSlider(const Options::Option* option, Minecraft* minecraft); - virtual void createStepSlider(const Options::Option* option, Minecraft* minecraft); - std::string label; -}; - -#endif /*NET_MINECRAFT_CLIENT_GUI_COMPONENTS__OptionsGroup_H__*/ +#ifndef NET_MINECRAFT_CLIENT_GUI_COMPONENTS__OptionsGroup_H__ +#define NET_MINECRAFT_CLIENT_GUI_COMPONENTS__OptionsGroup_H__ + +//package net.minecraft.client.gui; + +#include +#include "GuiElementContainer.h" +#include "ScrollingPane.h" +#include "../../Options.h" + +class Font; +class Minecraft; + +class OptionsGroup: public GuiElementContainer { + typedef GuiElementContainer super; +public: + OptionsGroup(std::string labelID); + virtual void setupPositions(); + virtual void render(Minecraft* minecraft, int xm, int ym); + virtual void tick(Minecraft* minecraft); + virtual void mouseClicked(Minecraft* minecraft, int x, int y, int buttonNum); + virtual void mouseReleased(Minecraft* minecraft, int x, int y, int buttonNum); + OptionsGroup& addOptionItem(OptionId optId, Minecraft* minecraft); + void scrollByPixels(float deltaY); + bool isScrollingGestureActive() const; +protected: + + void createToggle(OptionId optId, Minecraft* minecraft); + void createProgressSlider(OptionId optId, Minecraft* minecraft); + void createStepSlider(OptionId optId, Minecraft* minecraft); + void createTextbox(OptionId optId, Minecraft* minecraft); + void createKey(OptionId optId, Minecraft* minecraft); + + std::string label; + int contentHeight = 0; + float scrollOffsetY = 0.f; + float maxScrollOffsetY = 0.f; + bool trackingScrollGesture = false; + bool scrollingGesture = false; + bool touchDispatched = false; + int dragStartX = 0; + int dragStartY = 0; + int lastDragY = 0; + int touchStartX = 0; + int touchStartY = 0; + static const int ScrollStartThreshold = 5; +}; + +#endif /*NET_MINECRAFT_CLIENT_GUI_COMPONENTS__OptionsGroup_H__*/ diff --git a/src/client/gui/components/OptionsItem.cpp b/src/client/gui/components/OptionsItem.cpp index 39049e6..93eccb8 100755 --- a/src/client/gui/components/OptionsItem.cpp +++ b/src/client/gui/components/OptionsItem.cpp @@ -1,9 +1,11 @@ #include "OptionsItem.h" #include "../../Minecraft.h" +#include "../../../locale/I18n.h" #include "../../../util/Mth.h" -OptionsItem::OptionsItem( std::string label, GuiElement* element ) +OptionsItem::OptionsItem( OptionId optionId, std::string label, GuiElement* element ) : GuiElementContainer(false, true, 0, 0, 24, 12), - label(label) { + m_optionId(optionId), + m_label(label) { addChild(element); } @@ -19,6 +21,64 @@ void OptionsItem::setupPositions() { void OptionsItem::render( Minecraft* minecraft, int xm, int ym ) { int yOffset = (height - 8) / 2; - minecraft->font->draw(label, (float)x, (float)y + yOffset, 0x909090, false); + std::string text = m_label; + if (m_optionId == OPTIONS_GUI_SCALE) { + int value = minecraft->options.getIntValue(OPTIONS_GUI_SCALE); + std::string scaleText; + switch (value) { + case 0: scaleText = I18n::get("options.guiScale.auto"); break; + case 1: scaleText = I18n::get("options.guiScale.small"); break; + case 2: scaleText = I18n::get("options.guiScale.medium"); break; + case 3: scaleText = I18n::get("options.guiScale.large"); break; + case 4: scaleText = I18n::get("options.guiScale.larger"); break; + case 5: scaleText = I18n::get("options.guiScale.largest"); break; + default: scaleText = I18n::get("options.guiScale.auto"); break; + } + text += ": " + scaleText; + } + if (m_optionId == OPTIONS_FOG_TYPE) { + int value = minecraft->options.getIntValue(OPTIONS_FOG_TYPE); + std::string scaleText; + switch (value) { + case 0: scaleText = I18n::get("options.fogType.vanilla"); break; + case 1: scaleText = I18n::get("options.fogType.java"); break; + case 2: scaleText = I18n::get("options.fogType.unused"); break; + } + text += ": " + scaleText; + } + if (m_optionId == OPTIONS_DEBUG_STYLE) { + int value = minecraft->options.getIntValue(OPTIONS_DEBUG_STYLE); + std::string scaleText; + switch (value) { + case 0: scaleText = I18n::get("options.debugStyle.javaBeta"); break; + case 1: scaleText = I18n::get("options.debugStyle.custom"); break; + case 2: scaleText = I18n::get("options.fogType.unused"); break; + } + text += ": " + scaleText; + } + if (m_optionId == OPTIONS_MENU_STYLE) { + int value = minecraft->options.getIntValue(OPTIONS_MENU_STYLE); + std::string scaleText; + switch (value) { + case 0: scaleText = I18n::get("options.menuStyle.pocket"); break; + case 1: scaleText = I18n::get("options.menuStyle.xperia"); break; + case 2: scaleText = I18n::get("options.menuStyle.java"); break; + } + text += ": " + scaleText; + } + if (m_optionId == OPTIONS_VIEW_DISTANCE) { + int value = minecraft->options.getIntValue(OPTIONS_VIEW_DISTANCE); + std::string scaleText; + switch (value) { + case 0: scaleText = I18n::get("options.renderDistance.far"); break; + case 1: scaleText = I18n::get("options.renderDistance.normal"); break; + case 2: scaleText = I18n::get("options.renderDistance.short"); break; + case 3: scaleText = I18n::get("options.renderDistance.tiny"); break; + default: scaleText = "Debug"; break; + } + text += ": " + scaleText; + } + + minecraft->font->draw(text, (float)x, (float)y + yOffset, 0x909090, false); super::render(minecraft, xm, ym); } \ No newline at end of file diff --git a/src/client/gui/components/OptionsItem.h b/src/client/gui/components/OptionsItem.h index 82b8614..5add1ef 100755 --- a/src/client/gui/components/OptionsItem.h +++ b/src/client/gui/components/OptionsItem.h @@ -15,12 +15,13 @@ class OptionsItem: public GuiElementContainer { typedef GuiElementContainer super; public: - OptionsItem(std::string label, GuiElement* element); + OptionsItem(OptionId optionId, std::string label, GuiElement* element); virtual void render(Minecraft* minecraft, int xm, int ym); void setupPositions(); private: - std::string label; + OptionId m_optionId; + std::string m_label; }; #endif /*NET_MINECRAFT_CLIENT_GUI_COMPONENTS__OptionsItem_H__*/ diff --git a/src/client/gui/components/OptionsPane.cpp b/src/client/gui/components/OptionsPane.cpp old mode 100755 new mode 100644 index f00f5f0..217a8b2 --- a/src/client/gui/components/OptionsPane.cpp +++ b/src/client/gui/components/OptionsPane.cpp @@ -4,6 +4,7 @@ #include "ImageButton.h" #include "Slider.h" #include "../../Minecraft.h" +#include "client/Options.h" OptionsPane::OptionsPane() { @@ -28,37 +29,36 @@ OptionsGroup& OptionsPane::createOptionsGroup( std::string label ) { return *newGroup; } -void OptionsPane::createToggle( unsigned int group, std::string label, const Options::Option* option ) { -// if(group > children.size()) return; -// ImageDef def; -// def.setSrc(IntRectangle(160, 206, 39, 20)); -// def.name = "gui/touchgui.png"; -// def.width = 39 * 0.7f; -// def.height = 20 * 0.7f; -// OptionButton* element = new OptionButton(option); -// element->setImageDef(def, true); -// OptionsItem* item = new OptionsItem(label, element); -// ((OptionsGroup*)children[group])->addChild(item); -// setupPositions(); +void OptionsPane::createToggle( unsigned int group, std::string label, OptionId option ) { + if(group > children.size()) return; + ImageDef def; + def.setSrc(IntRectangle(160, 206, 39, 20)); + def.name = "gui/touchgui.png"; + def.width = 39 * 0.7f; + def.height = 20 * 0.7f; + OptionButton* element = new OptionButton(option); + element->setImageDef(def, true); + OptionsItem* item = new OptionsItem(option, label, element); + ((OptionsGroup*)children[group])->addChild(item); + setupPositions(); } -void OptionsPane::createProgressSlider( Minecraft* minecraft, unsigned int group, std::string label, const Options::Option* option, float progressMin/*=1.0f*/, float progressMax/*=1.0f */ ) { -// if(group > children.size()) return; -// Slider* element = new Slider(minecraft, option, progressMin, progressMax); -// element->width = 100; -// element->height = 20; -// OptionsItem* item = new OptionsItem(label, element); -// ((OptionsGroup*)children[group])->addChild(item); -// setupPositions(); +void OptionsPane::createProgressSlider( Minecraft* minecraft, unsigned int group, std::string label, OptionId option, float progressMin/*=1.0f*/, float progressMax/*=1.0f */ ) { + if(group > children.size()) return; + Slider* element = new SliderFloat(minecraft, option); + element->width = 100; + element->height = 20; + OptionsItem* item = new OptionsItem(option, label, element); + ((OptionsGroup*)children[group])->addChild(item); + setupPositions(); } -void OptionsPane::createStepSlider( Minecraft* minecraft, unsigned int group, std::string label, const Options::Option* option, const std::vector& stepVec ) { -// if(group > children.size()) return; -// Slider* element = new Slider(minecraft, option, stepVec); -// element->width = 100; -// element->height = 20; -// sliders.push_back(element); -// OptionsItem* item = new OptionsItem(label, element); -// ((OptionsGroup*)children[group])->addChild(item); -// setupPositions(); -} \ No newline at end of file +void OptionsPane::createStepSlider( Minecraft* minecraft, unsigned int group, std::string label, OptionId option, const std::vector& stepVec ) { + if(group > children.size()) return; + Slider* element = new SliderInt(minecraft, option); + element->width = 100; + element->height = 20; + OptionsItem* item = new OptionsItem(option, label, element); + ((OptionsGroup*)children[group])->addChild(item); + setupPositions(); +} diff --git a/src/client/gui/components/OptionsPane.h b/src/client/gui/components/OptionsPane.h old mode 100755 new mode 100644 index 5eb9652..e6f7607 --- a/src/client/gui/components/OptionsPane.h +++ b/src/client/gui/components/OptionsPane.h @@ -21,9 +21,9 @@ class OptionsPane: public GuiElementContainer public: OptionsPane(); OptionsGroup& createOptionsGroup( std::string label ); - void createToggle( unsigned int group, std::string label, const Options::Option* option ); - void createProgressSlider(Minecraft* minecraft, unsigned int group, std::string label, const Options::Option* option, float progressMin=1.0f, float progressMax=1.0f ); - void createStepSlider(Minecraft* minecraft, unsigned int group, std::string label, const Options::Option* option, const std::vector& stepVec ); + void createToggle( unsigned int group, std::string label, OptionId option ); + void createProgressSlider(Minecraft* minecraft, unsigned int group, std::string label, OptionId option, float progressMin=1.0f, float progressMax=1.0f ); + void createStepSlider(Minecraft* minecraft, unsigned int group, std::string label, OptionId option, const std::vector& stepVec ); void setupPositions(); }; diff --git a/src/client/gui/components/ScrollingPane.cpp b/src/client/gui/components/ScrollingPane.cpp index 78c0187..79dd11c 100755 --- a/src/client/gui/components/ScrollingPane.cpp +++ b/src/client/gui/components/ScrollingPane.cpp @@ -20,6 +20,9 @@ static const float kMinimumTrackingForDrag = 5; static const float kMinIndicatorLength = 34.0f / 3; static const float PKScrollIndicatorEndSize = 3; static const float PKScrollIndicatorThickness = 7.0f /3; +static const float kWheelOverscrollMax = 80.0f; +static const float kWheelOverscrollDamping = 0.6f; +static const float kWheelOverscrollRestoreAlpha = 0.18f; ScrollingPane::ScrollingPane( int optionFlags, @@ -70,13 +73,19 @@ ScrollingPane::ScrollingPane( } //LOGI("%d, %d :: %d\n", bbox.w, itemBbox.w, this->columns); - rows = 1 + (numItems-1) / this->columns, + rows = 1 + (numItems-1) / this->columns; /* if (columns * itemBbox.w <= bbox.w) flags |= SF_LockX; if (rows * itemBbox.h <= bbox.h) flags |= SF_LockY; */ + // initialize content bounds immediately + adjustContentSize(); + minPoint.set((float)(this->size.w - this->adjustedContentSize.w), (float)(this->size.h - this->adjustedContentSize.h), 0); + this->snapContentOffsetToBounds(false); + + dragDeltas.reserve(128); te_moved = 0; @@ -114,6 +123,34 @@ void ScrollingPane::tick() { updateScrollFade(vScroll); updateScrollFade(hScroll); } + + if (isNotSet(SF_HardLimits) && !Mouse::isButtonDown(MouseAction::ACTION_LEFT) && !dragging && !tracking && !decelerating) { + float targetX = _contentOffset.x; + float targetY = _contentOffset.y; + bool corrected = false; + + if (targetX > 0.0f) { + targetX = Mth::lerp(targetX, 0.0f, kWheelOverscrollRestoreAlpha); + corrected = true; + } else if (targetX < minPoint.x) { + targetX = Mth::lerp(targetX, minPoint.x, kWheelOverscrollRestoreAlpha); + corrected = true; + } + + if (targetY > 0.0f) { + targetY = Mth::lerp(targetY, 0.0f, kWheelOverscrollRestoreAlpha); + corrected = true; + } else if (targetY < minPoint.y) { + targetY = Mth::lerp(targetY, minPoint.y, kWheelOverscrollRestoreAlpha); + corrected = true; + } + + if (corrected) { + if (Mth::abs(targetX - _contentOffset.x) < 0.25f) targetX = (targetX > 0.0f ? 0.0f : (targetX < minPoint.x ? minPoint.x : targetX)); + if (Mth::abs(targetY - _contentOffset.y) < 0.25f) targetY = (targetY > 0.0f ? 0.0f : (targetY < minPoint.y ? minPoint.y : targetY)); + setContentOffset(Vec3(targetX, targetY, 0)); + } + } } bool ScrollingPane::getGridItemFor_slow(int itemIndex, GridItem& out) { @@ -167,22 +204,23 @@ void ScrollingPane::render( int xm, int ym, float alpha ) { const float bxx = bbox.x - (fpx /*+ dx*alpha*/) + (nw.xf - nw.x); const float byy = bbox.y - (fpy /*+ dy*alpha*/) + (nw.yf - nw.y); - for (int y = nw.y; y <= se.y; ++y) - for (int x = nw.x; x <= se.x; ++x) { - int id = y * columns + x; - if (y <0 || id < 0 || id >= numItems) continue; // @todo: break rather - if (isNotSet(SF_WrapX) && (x < 0 || x >= columns)) continue; // @todo: break rather - GridItem item; //@todo: v- Does not support SF_Wrapping - item.id = id; - item.xf = bxx + x * itemBbox.w; - item.yf = byy + y * itemBbox.h; - item.x = (int)item.xf; - item.y = (int)item.yf; - //LOGI("i: %d (%.1f, %.1f)\t", id, item.xf, item.yf); - if (isSet(SF_MultiSelect)) item.selected = selected[id]; - else item.selected = (id == selectedId); + for (int y = nw.y; y <= se.y; ++y) { + for (int x = nw.x; x <= se.x; ++x) { + int id = y * columns + x; + if (y <0 || id < 0 || id >= numItems) continue; // @todo: break rather + if (isNotSet(SF_WrapX) && (x < 0 || x >= columns)) continue; // @todo: break rather + GridItem item; //@todo: v- Does not support SF_Wrapping + item.id = id; + item.xf = bxx + x * itemBbox.w; + item.yf = byy + y * itemBbox.h; + item.x = (int)item.xf; + item.y = (int)item.yf; + //LOGI("i: %d (%.1f, %.1f)\t", id, item.xf, item.yf); + if (isSet(SF_MultiSelect)) item.selected = selected[id]; + else item.selected = (id == selectedId); - itemsToRender.push_back(item); + itemsToRender.push_back(item); + } } renderBatch(itemsToRender, alpha); @@ -548,6 +586,42 @@ void ScrollingPane::stepThroughDecelerationAnimation(bool noAnimation) { } } +void ScrollingPane::scrollBy(float dx, float dy) { + // compute target content offset from wheel delta (in screen-space w/ opposite sign) + float targetX = _contentOffset.x - dx; + float targetY = _contentOffset.y - dy; + + if (isSet(SF_LockX)) targetX = _contentOffset.x; + if (isSet(SF_LockY)) targetY = _contentOffset.y; + + if (isSet(SF_HardLimits)) { + targetX = Mth::clamp(targetX, minPoint.x, 0.0f); + targetY = Mth::clamp(targetY, minPoint.y, 0.0f); + } else { + if (targetX > 0.0f) { + float overshoot = targetX; + overshoot = Mth::Min(overshoot, kWheelOverscrollMax); + targetX = overshoot * kWheelOverscrollDamping; + } else if (targetX < minPoint.x) { + float overshoot = targetX - minPoint.x; + overshoot = Mth::Max(overshoot, -kWheelOverscrollMax); + targetX = minPoint.x + overshoot * kWheelOverscrollDamping; + } + + if (targetY > 0.0f) { + float overshoot = targetY; + overshoot = Mth::Min(overshoot, kWheelOverscrollMax); + targetY = overshoot * kWheelOverscrollDamping; + } else if (targetY < minPoint.y) { + float overshoot = targetY - minPoint.y; + overshoot = Mth::Max(overshoot, -kWheelOverscrollMax); + targetY = minPoint.y + overshoot * kWheelOverscrollDamping; + } + } + + setContentOffset(Vec3(targetX, targetY, 0)); +} + void ScrollingPane::setContentOffset(float x, float y) { this->setContentOffsetWithAnimation(Vec3(x, y, 0), false); } diff --git a/src/client/gui/components/ScrollingPane.h b/src/client/gui/components/ScrollingPane.h index ff31e7c..0a2c321 100755 --- a/src/client/gui/components/ScrollingPane.h +++ b/src/client/gui/components/ScrollingPane.h @@ -51,6 +51,10 @@ public: void tick(); void render(int xm, int ym, float alpha); + // scroll the content by the given amount (dx horizontal, dy vertical) + // positive values move content downward/rightward + void scrollBy(float dx, float dy); + bool getGridItemFor_slow(int itemIndex, GridItem& out); void setSelected(int id, bool selected); diff --git a/src/client/gui/components/Slider.cpp b/src/client/gui/components/Slider.cpp index 2b978df..27a3b36 100755 --- a/src/client/gui/components/Slider.cpp +++ b/src/client/gui/components/Slider.cpp @@ -2,38 +2,12 @@ #include "../../Minecraft.h" #include "../../renderer/Textures.h" #include "../Screen.h" +#include "../../../locale/I18n.h" #include "../../../util/Mth.h" #include #include -Slider::Slider(Minecraft* minecraft, const Options::Option* option, float progressMin, float progressMax) -: sliderType(SliderProgress), mouseDownOnElement(false), option(option), numSteps(0), progressMin(progressMin), progressMax(progressMax) { - if(option != NULL) { - percentage = (minecraft->options.getProgressValue(option) - progressMin) / (progressMax - progressMin); - } -} -Slider::Slider(Minecraft* minecraft, const Options::Option* option, const std::vector& stepVec ) -: sliderType(SliderStep), - curStepValue(0), - curStep(0), - sliderSteps(stepVec), - mouseDownOnElement(false), - option(option), - percentage(0), - progressMin(0.0f), - progressMax(1.0) { - assert(stepVec.size() > 1); - numSteps = sliderSteps.size(); - if(option != NULL) { - curStepValue; - int curStep; - curStepValue = minecraft->options.getIntValue(option); - std::vector::iterator currentItem = std::find(sliderSteps.begin(), sliderSteps.end(), curStepValue); - if(currentItem != sliderSteps.end()) { - curStep = currentItem - sliderSteps.begin(); - } - } -} +Slider::Slider(OptionId optId) : m_mouseDownOnElement(false), m_optId(optId), m_numSteps(0) {} void Slider::render( Minecraft* minecraft, int xm, int ym ) { int xSliderStart = x + 5; @@ -45,56 +19,76 @@ void Slider::render( Minecraft* minecraft, int xm, int ym ) { int barWidth = xSliderEnd - xSliderStart; //fill(x, y + 8, x + (int)(width * percentage), y + height, 0xffff00ff); fill(xSliderStart, ySliderStart, xSliderEnd, ySliderEnd, 0xff606060); - if(sliderType == SliderStep) { - int stepDistance = barWidth / (numSteps -1); - for(int a = 0; a <= numSteps - 1; ++a) { + + if (m_numSteps > 2) { + int stepDistance = barWidth / (m_numSteps-1); + for(int a = 0; a < m_numSteps; ++a) { int renderSliderStepPosX = xSliderStart + a * stepDistance + 1; fill(renderSliderStepPosX - 1, ySliderStart - 2, renderSliderStepPosX + 1, ySliderEnd + 2, 0xff606060); } } + minecraft->textures->loadAndBindTexture("gui/touchgui.png"); - blit(xSliderStart + (int)(percentage * barWidth) - handleSizeX / 2, y, 226, 126, handleSizeX, handleSizeY, handleSizeX, handleSizeY); + blit(xSliderStart + (int)(m_percentage * barWidth) - handleSizeX / 2, y, 226, 126, handleSizeX, handleSizeY, handleSizeX, handleSizeY); } void Slider::mouseClicked( Minecraft* minecraft, int x, int y, int buttonNum ) { if(pointInside(x, y)) { - mouseDownOnElement = true; + m_mouseDownOnElement = true; } } void Slider::mouseReleased( Minecraft* minecraft, int x, int y, int buttonNum ) { - mouseDownOnElement = false; - if(sliderType == SliderStep) { - curStep = Mth::floor((percentage * (numSteps-1) + 0.5f)); - curStepValue = sliderSteps[Mth::Min(curStep, numSteps-1)]; - percentage = float(curStep) / (numSteps - 1); - setOption(minecraft); - } -} + m_mouseDownOnElement = false; +} void Slider::tick(Minecraft* minecraft) { if(minecraft->screen != NULL) { int xm = Mouse::getX(); int ym = Mouse::getY(); + minecraft->screen->toGUICoordinate(xm, ym); - if(mouseDownOnElement) { - percentage = float(xm - x) / float(width); - percentage = Mth::clamp(percentage, 0.0f, 1.0f); - setOption(minecraft); + + if(m_mouseDownOnElement) { + m_percentage = float(xm - x) / float(width); + m_percentage = Mth::clamp(m_percentage, 0.0f, 1.0f); } } } -void Slider::setOption( Minecraft* minecraft ) { - if(option != NULL) { - if(sliderType == SliderStep) { - if(minecraft->options.getIntValue(option) != curStepValue) { - minecraft->options.set(option, curStepValue); - } - } else { - if(minecraft->options.getProgressValue(option) != percentage * (progressMax - progressMin) + progressMin) { - minecraft->options.set(option, percentage * (progressMax - progressMin) + progressMin); - } - } +SliderFloat::SliderFloat(Minecraft* minecraft, OptionId option) +: Slider(option), m_option(dynamic_cast(minecraft->options.getOpt(option))) +{ + m_percentage = Mth::clamp((m_option->get() - m_option->getMin()) / (m_option->getMax() - m_option->getMin()), 0.f, 1.f); +} + +SliderInt::SliderInt(Minecraft* minecraft, OptionId option) +: Slider(option), m_option(dynamic_cast(minecraft->options.getOpt(option))) +{ + m_numSteps = m_option->getMax() - m_option->getMin() + 1; + m_percentage = float(m_option->get() - m_option->getMin()) / (m_numSteps-1); +} + +void SliderInt::render( Minecraft* minecraft, int xm, int ym ) { + Slider::render(minecraft, xm, ym); +} + +void SliderInt::mouseReleased( Minecraft* minecraft, int x, int y, int buttonNum ) { + Slider::mouseReleased(minecraft, x, y, buttonNum); + + if (pointInside(x, y)) { + int curStep = int(m_percentage * (m_numSteps-1) + 0.5f); + curStep = Mth::clamp(curStep + m_option->getMin(), m_option->getMin(), m_option->getMax()); + m_percentage = float(curStep - m_option->getMin()) / (m_numSteps-1); + + minecraft->options.set(m_optId, curStep); } } + +void SliderFloat::mouseReleased( Minecraft* minecraft, int x, int y, int buttonNum ) { + Slider::mouseReleased(minecraft, x, y, buttonNum); + + if (pointInside(x, y)) { + minecraft->options.set(m_optId, m_percentage * (m_option->getMax() - m_option->getMin()) + m_option->getMin()); + } +} \ No newline at end of file diff --git a/src/client/gui/components/Slider.h b/src/client/gui/components/Slider.h index d51b507..8168741 100755 --- a/src/client/gui/components/Slider.h +++ b/src/client/gui/components/Slider.h @@ -3,38 +3,45 @@ #include "GuiElement.h" #include "../../../client/Options.h" -enum SliderType { - SliderProgress, // Sets slider between {0..1} - SliderStep // Uses the closest step -}; + class Slider : public GuiElement { typedef GuiElement super; public: - // Creates a progress slider with no steps - Slider(Minecraft* minecraft, const Options::Option* option, float progressMin, float progressMax); - Slider(Minecraft* minecraft, const Options::Option* option, const std::vector& stepVec); virtual void render( Minecraft* minecraft, int xm, int ym ); - virtual void mouseClicked( Minecraft* minecraft, int x, int y, int buttonNum ); - virtual void mouseReleased( Minecraft* minecraft, int x, int y, int buttonNum ); - virtual void tick(Minecraft* minecraft); - -private: - virtual void setOption(Minecraft* minecraft); -private: - SliderType sliderType; - std::vector sliderSteps; - bool mouseDownOnElement; - float percentage; - int curStepValue; - int curStep; - int numSteps; - float progressMin; - float progressMax; - const Options::Option* option; +protected: + Slider(OptionId optId); + + OptionId m_optId; + + bool m_mouseDownOnElement; + float m_percentage; + int m_numSteps; +}; + +class SliderFloat : public Slider { +public: + SliderFloat(Minecraft* minecraft, OptionId option); + + virtual void mouseReleased( Minecraft* minecraft, int x, int y, int buttonNum ) override; + +protected: + OptionFloat* m_option; +}; + + +class SliderInt : public Slider { +public: + SliderInt(Minecraft* minecraft, OptionId option); + + virtual void render( Minecraft* minecraft, int xm, int ym ) override; + virtual void mouseReleased( Minecraft* minecraft, int x, int y, int buttonNum ) override; + +protected: + OptionInt* m_option; }; #endif /*NET_MINECRAFT_CLIENT_GUI_COMPONENTS__Slider_H__*/ diff --git a/src/client/gui/components/SmallButton.cpp b/src/client/gui/components/SmallButton.cpp old mode 100755 new mode 100644 index e2ebfaa..e154736 --- a/src/client/gui/components/SmallButton.cpp +++ b/src/client/gui/components/SmallButton.cpp @@ -12,13 +12,13 @@ SmallButton::SmallButton( int id, int x, int y, int width, int height, const std { } -SmallButton::SmallButton( int id, int x, int y, Options::Option* item, const std::string& msg ) +SmallButton::SmallButton( int id, int x, int y, Option* item, const std::string& msg ) : super(id, x, y, 150, 20, msg), option(item) { } -Options::Option* SmallButton::getOption() +Option* SmallButton::getOption() { return option; } diff --git a/src/client/gui/components/SmallButton.h b/src/client/gui/components/SmallButton.h old mode 100755 new mode 100644 index 05ae378..2fd6372 --- a/src/client/gui/components/SmallButton.h +++ b/src/client/gui/components/SmallButton.h @@ -13,11 +13,11 @@ class SmallButton: public Button public: SmallButton(int id, int x, int y, const std::string& msg); SmallButton(int id, int x, int y, int width, int height, const std::string& msg); - SmallButton(int id, int x, int y, Options::Option* item, const std::string& msg); + SmallButton(int id, int x, int y, Option* item, const std::string& msg); - Options::Option* getOption(); + Option* getOption(); private: - Options::Option* option; + Option* option; }; #endif /*NET_MINECRAFT_CLIENT_GUI_COMPONENTS__SmallButton_H__*/ diff --git a/src/client/gui/components/TextBox.cpp b/src/client/gui/components/TextBox.cpp index 17c77ba..16bf8a6 100755 --- a/src/client/gui/components/TextBox.cpp +++ b/src/client/gui/components/TextBox.cpp @@ -1,37 +1,102 @@ #include "TextBox.h" +#include "../Gui.h" #include "../../Minecraft.h" #include "../../../AppPlatform.h" -TextBox::TextBox( int id, const std::string& msg ) - : id(0), w(0), h(0), x(0), y(0), text(msg), focused(false) { +#include "../../../platform/input/Mouse.h" +// delegate constructors +TextBox::TextBox(int id, const std::string& msg) + : TextBox(id, 0, 0, msg) +{ } -TextBox::TextBox( int id, int x, int y, const std::string& msg ) - : id(id), w(0), h(0), x(x), y(y), text(msg), focused(false) { - +TextBox::TextBox(int id, int x, int y, const std::string& msg) + : TextBox(id, x, y, 24, Font::DefaultLineHeight + 4, msg) +{ } -TextBox::TextBox( int id, int x, int y, int w, int h, const std::string& msg ) - : id(id), w(w), h(h), x(x), y(y), text(msg) { - +TextBox::TextBox(int id, int x, int y, int w, int h, const std::string& msg) + : GuiElement(true, true, x, y, w, h), + id(id), hint(msg), focused(false), blink(false), blinkTicks(0) +{ } void TextBox::setFocus(Minecraft* minecraft) { - if(!focused) { - minecraft->platform()->showKeyboard(); - focused = true; - } + if (!focused) { + minecraft->platform()->showKeyboard(); + focused = true; + blinkTicks = 0; + blink = false; + } } bool TextBox::loseFocus(Minecraft* minecraft) { - if(focused) { - minecraft->platform()->showKeyboard(); - focused = false; - return true; - } - return false; + if (focused) { + minecraft->platform()->hideKeyboard(); + focused = false; + return true; + } + return false; } -void TextBox::render( Minecraft* minecraft, int xm, int ym ) { - +void TextBox::mouseClicked(Minecraft* minecraft, int x, int y, int buttonNum) { + if (buttonNum == MouseAction::ACTION_LEFT) { + if (pointInside(x, y)) { + setFocus(minecraft); + } else { + loseFocus(minecraft); + } + } +} + +void TextBox::charPressed(Minecraft* minecraft, char c) { + if (focused && c >= 32 && c < 127 && (int)text.size() < 256) { + text.push_back(c); + } +} + +void TextBox::keyPressed(Minecraft* minecraft, int key) { + if (focused && key == Keyboard::KEY_BACKSPACE && !text.empty()) { + text.pop_back(); + } +} + +void TextBox::tick(Minecraft* minecraft) { + blinkTicks++; + if (blinkTicks >= 5) { + blink = !blink; + blinkTicks = 0; + } +} + +void TextBox::render(Minecraft* minecraft, int xm, int ym) { + // textbox like in beta 1.7.3 + // change appearance when focused so the user can tell it's active + // active background darker gray with a subtle border + uint32_t bgColor = focused ? 0xffa0a0a0 : 0xffa0a0a0; + uint32_t borderColor = focused ? 0xff000000 : 0xff000000; + fill(x, y, x + width, y + height, bgColor); + fill(x + 1, y + 1, x + width - 1, y + height - 1, borderColor); + + glEnable2(GL_SCISSOR_TEST); + glScissor( + Gui::GuiScale * (x + 2), + minecraft->height - Gui::GuiScale * (y + height - 2), + Gui::GuiScale * (width - 2), + Gui::GuiScale * (height - 2) + ); + + int _y = y + (height - Font::DefaultLineHeight) / 2; + + if (text.empty() && !focused) { + drawString(minecraft->font, hint, x + 2, _y, 0xff5e5e5e); + } + + if (focused && blink) text.push_back('_'); + + drawString(minecraft->font, text, x + 2, _y, 0xffffffff); + + if (focused && blink) text.pop_back(); + + glDisable2(GL_SCISSOR_TEST); } diff --git a/src/client/gui/components/TextBox.h b/src/client/gui/components/TextBox.h index 4de6182..34ea5a7 100755 --- a/src/client/gui/components/TextBox.h +++ b/src/client/gui/components/TextBox.h @@ -4,31 +4,41 @@ //package net.minecraft.client.gui; #include -#include "../GuiComponent.h" +#include "GuiElement.h" #include "../../Options.h" +#include "../../../platform/input/Mouse.h" +#include "../../../platform/input/Keyboard.h" class Font; class Minecraft; -class TextBox: public GuiComponent +class TextBox: public GuiElement { public: TextBox(int id, const std::string& msg); - TextBox(int id, int x, int y, const std::string& msg); - TextBox(int id, int x, int y, int w, int h, const std::string& msg); + TextBox(int id, int x, int y, const std::string& msg); + TextBox(int id, int x, int y, int w, int h, const std::string& msg); + + virtual void mouseClicked(Minecraft* minecraft, int x, int y, int buttonNum); virtual void setFocus(Minecraft* minecraft); virtual bool loseFocus(Minecraft* minecraft); - virtual void render(Minecraft* minecraft, int xm, int ym); + virtual void render(Minecraft* minecraft, int xm, int ym); + + virtual void keyPressed(Minecraft* minecraft, int key); + virtual void charPressed(Minecraft* minecraft, char c); + virtual void tick(Minecraft* minecraft); public: - int w, h; - int x, y; - + std::string hint; std::string text; int id; + + int blinkTicks; + bool focused; + bool blink; }; #endif /*NET_MINECRAFT_CLIENT_GUI_COMPONENTS__TextBox_H__*/ diff --git a/src/client/gui/components/TextOption.cpp b/src/client/gui/components/TextOption.cpp new file mode 100644 index 0000000..83b8535 --- /dev/null +++ b/src/client/gui/components/TextOption.cpp @@ -0,0 +1,17 @@ +#include "TextOption.h" +#include + +TextOption::TextOption(Minecraft* minecraft, OptionId optId) + : TextBox((int)optId, minecraft->options.getOpt(optId)->getStringId()) +{ + text = minecraft->options.getStringValue(optId); +} + +bool TextOption::loseFocus(Minecraft* minecraft) { + if (TextBox::loseFocus(minecraft)) { + minecraft->options.set((OptionId)id, text); + return true; + } + + return false; +} \ No newline at end of file diff --git a/src/client/gui/components/TextOption.h b/src/client/gui/components/TextOption.h new file mode 100644 index 0000000..89c545c --- /dev/null +++ b/src/client/gui/components/TextOption.h @@ -0,0 +1,10 @@ +#pragma once +#include "TextBox.h" +#include + +class TextOption : public TextBox { +public: + TextOption(Minecraft* minecraft, OptionId optId); + + virtual bool loseFocus(Minecraft* minecraft); +}; \ No newline at end of file diff --git a/src/client/gui/screens/BuyGameScreen.h b/src/client/gui/screens/BuyGameScreen.h old mode 100755 new mode 100644 diff --git a/src/client/gui/screens/ChestScreen.cpp b/src/client/gui/screens/ChestScreen.cpp index c9383c9..8a7b81e 100755 --- a/src/client/gui/screens/ChestScreen.cpp +++ b/src/client/gui/screens/ChestScreen.cpp @@ -329,7 +329,10 @@ bool ChestScreen::handleAddItem(FillingContainer* from, FillingContainer* to, in added = (takenItem.count != wantedCount); if (added) { - item->count -= (wantedCount - takenItem.count); + if (!minecraft->isCreativeMode()) { + item->count -= (wantedCount - takenItem.count); + } + std::vector changed; std::vector items = getItems(toPane); differ.getDiff(items, changed); diff --git a/src/client/gui/screens/ConfirmScreen.cpp b/src/client/gui/screens/ConfirmScreen.cpp index ce911c6..2529549 100755 --- a/src/client/gui/screens/ConfirmScreen.cpp +++ b/src/client/gui/screens/ConfirmScreen.cpp @@ -31,7 +31,7 @@ ConfirmScreen::~ConfirmScreen() { void ConfirmScreen::init() { - if (minecraft->useTouchscreen()) { + if (/* minecraft->useTouchscreen() */ true) { yesButton = new Touch::TButton(0, 0, 0, yesButtonText), noButton = new Touch::TButton(1, 0, 0, noButtonText); } else { diff --git a/src/client/gui/screens/ConfirmScreen.h b/src/client/gui/screens/ConfirmScreen.h index 07f40b3..0fedbe9 100755 --- a/src/client/gui/screens/ConfirmScreen.h +++ b/src/client/gui/screens/ConfirmScreen.h @@ -4,7 +4,6 @@ //package net.minecraft.client.gui; #include "../Screen.h" -#include "../components/SmallButton.h" #include class ConfirmScreen: public Screen diff --git a/src/client/gui/screens/ConsoleScreen.cpp b/src/client/gui/screens/ConsoleScreen.cpp new file mode 100644 index 0000000..9d3e874 --- /dev/null +++ b/src/client/gui/screens/ConsoleScreen.cpp @@ -0,0 +1,120 @@ +#include "ConsoleScreen.h" +#include "../Gui.h" +#include "../../Minecraft.h" +#include "../../player/LocalPlayer.h" +#include "../../../platform/input/Keyboard.h" +#include "../../../world/level/Level.h" +#include "../../../network/RakNetInstance.h" +#include "../../../network/ServerSideNetworkHandler.h" +#include "../../../network/packet/MessagePacket.h" +#include "../../../platform/log.h" +#include "util/StringUtils.h" + +#include +#include +#include + +ConsoleScreen::ConsoleScreen() +: _input(""), + _cursorBlink(0) +{ +} + +void ConsoleScreen::init() +{ +} + +void ConsoleScreen::tick() +{ + _cursorBlink++; +} + +bool ConsoleScreen::handleBackEvent(bool /*isDown*/) +{ + minecraft->setScreen(NULL); + return true; +} + +void ConsoleScreen::keyPressed(int eventKey) +{ + if (eventKey == Keyboard::KEY_ESCAPE) { + minecraft->setScreen(NULL); + } else if (eventKey == Keyboard::KEY_RETURN) { + execute(); + } else if (eventKey == Keyboard::KEY_BACKSPACE) { + if (!_input.empty()) + _input.erase(_input.size() - 1, 1); + } else { + super::keyPressed(eventKey); + } +} + +void ConsoleScreen::charPressed(char inputChar) +{ + if (inputChar >= 32 && inputChar < 127) + _input += inputChar; +} + +void ConsoleScreen::execute() +{ + if (!minecraft->level) return; + + if (_input.empty()) { + return minecraft->setScreen(NULL); + } + + if (minecraft->netCallback && !minecraft->raknetInstance->isServer()) { + MessagePacket packet(_input.c_str()); + minecraft->raknetInstance->send(packet); + } else if (_input[0] == '/') { + _input = Util::stringTrim(_input.substr(1)); + + std::istringstream iss( + minecraft->commandManager().execute(*minecraft, *minecraft->player, _input) + ); + + for (std::string line; std::getline(iss, line);) { + minecraft->gui.addMessage(line); + } + } + else { + if (minecraft->raknetInstance->isServer()) { + MessagePacket packet(_input.c_str()); + minecraft->raknetInstance->send(packet); + } + + minecraft->gui.addMessage("<" + minecraft->player->name + "> " + _input); + } + + minecraft->setScreen(NULL); +} + +// --------------------------------------------------------------------------- +// render +// --------------------------------------------------------------------------- +void ConsoleScreen::render(int /*xm*/, int /*ym*/, float /*a*/) +{ + // Dim the game world slightly + fillGradient(0, 0, width, height, 0x00000000, 0x40000000); + + const int boxH = 12; + const int boxY = height - boxH - 2; + const int boxX0 = 2; + const int boxX1 = width - 2; + + // Input box background + fill(boxX0, boxY, boxX1, boxY + boxH, 0xc0000000); + // Border + fill(boxX0, boxY, boxX1, boxY + 1, 0xff808080); + fill(boxX0, boxY + boxH - 1, boxX1, boxY + boxH, 0xff808080); + fill(boxX0, boxY, boxX0 + 1, boxY + boxH, 0xff808080); + fill(boxX1 - 1, boxY, boxX1, boxY + boxH, 0xff808080); + + // Input text + blinking cursor + std::string displayed = _input; + if ((_cursorBlink / 10) % 2 == 0) + displayed += '_'; + + // Placeholder hint when empty + font->drawShadow(displayed, (float)(boxX0 + 2), (float)(boxY + 2), 0xffffffff); +} diff --git a/src/client/gui/screens/ConsoleScreen.h b/src/client/gui/screens/ConsoleScreen.h new file mode 100644 index 0000000..f0c1fd5 --- /dev/null +++ b/src/client/gui/screens/ConsoleScreen.h @@ -0,0 +1,33 @@ +#ifndef NET_MINECRAFT_CLIENT_GUI_SCREENS__ConsoleScreen_H__ +#define NET_MINECRAFT_CLIENT_GUI_SCREENS__ConsoleScreen_H__ + +#include "../Screen.h" +#include + +class ConsoleScreen: public Screen +{ + typedef Screen super; +public: + ConsoleScreen(); + virtual ~ConsoleScreen() {} + + void init(); + void render(int xm, int ym, float a); + void tick(); + + virtual bool renderGameBehind() { return true; } + virtual bool isInGameScreen() { return true; } + virtual bool isPauseScreen() { return false; } + + virtual void keyPressed(int eventKey); + virtual void charPressed(char inputChar); + virtual bool handleBackEvent(bool isDown); + +private: + void execute(); + + std::string _input; + int _cursorBlink; // tick counter for cursor blink +}; + +#endif /*NET_MINECRAFT_CLIENT_GUI_SCREENS__ConsoleScreen_H__*/ diff --git a/src/client/gui/screens/CreditsScreen.cpp b/src/client/gui/screens/CreditsScreen.cpp new file mode 100644 index 0000000..f0820af --- /dev/null +++ b/src/client/gui/screens/CreditsScreen.cpp @@ -0,0 +1,132 @@ +#include "CreditsScreen.h" +#include "StartMenuScreen.h" +#include "OptionsScreen.h" +#include "../../Minecraft.h" +#include "../components/Button.h" +#include "../components/ImageButton.h" +#include "platform/input/Mouse.h" + +CreditsScreen::CreditsScreen() +: bHeader(NULL), btnBack(NULL) +{} +CreditsScreen::~CreditsScreen() { + if (bHeader) delete bHeader; + if (btnBack) delete btnBack; +} + +void CreditsScreen::init() { + bHeader = new Touch::THeader(0, "Credits"); + btnBack = new ImageButton(1, ""); + { + ImageDef def; + def.name = "gui/touchgui.png"; + def.width = 34; + def.height = 26; + def.setSrc(IntRectangle(150, 0, (int)def.width, (int)def.height)); + btnBack->setImageDef(def, true); + } + buttons.push_back(bHeader); + buttons.push_back(btnBack); + + // TODO: rewrite it + // prepare text lines + _lines.clear(); + _lines.push_back("Minecraft: Pocket Edition"); + _lines.push_back("Original game by Mojang"); + _lines.push_back(""); + _lines.push_back("Programmers:"); + _lines.push_back("mschiller890"); + _lines.push_back("InviseDivine"); + _lines.push_back("Kolyah35"); + _lines.push_back("karson"); + _lines.push_back("deepfriedwaffles"); + _lines.push_back("EpikIzCool"); + _lines.push_back("fileshredder"); + _lines.push_back(""); + // avoid color tags around the URL so it isn't mangled by the parser please + _lines.push_back("Join our Discord server: https://discord.gg/c58YesBxve"); + _scrollSpeed = 0.5f; + _scrollY = height; // start below screen +} + +void CreditsScreen::setupPositions() { + int buttonHeight = btnBack->height; + btnBack->x = width - btnBack->width; + btnBack->y = 0; + if (bHeader) { + bHeader->x = 0; + bHeader->y = 0; + bHeader->width = width - btnBack->width; + bHeader->height = btnBack->height; + } + + // reset scroll starting position when screen size changes + _scrollY = height; +} + +void CreditsScreen::tick() { + // move text upward + _scrollY -= _scrollSpeed; + // if text has scrolled off the top, restart + float totalHeight = _lines.size() * (minecraft->font->lineHeight + 8); + if (_scrollY + totalHeight < 0) { + _scrollY = height; + } + + if (Mouse::isButtonDown(MouseAction::ACTION_LEFT)) { + _scrollSpeed = 1.5f; + } else { + _scrollSpeed = 0.5f; + } +} + +void CreditsScreen::render(int xm, int ym, float a) { + renderBackground(); + int w = width; + Font* font = minecraft->font; + float y = _scrollY; + const float lineHeight = font->lineHeight + 8; + for (size_t i = 0; i < _lines.size(); ++i) { + const std::string& line = _lines[i]; + // use color-tag-aware drawing, centre by total width + float lineWidth = Gui::getColoredWidth(font, line); + Gui::drawColoredString(font, line, w/2 - lineWidth/2, (int)y, 255); + // underline hyperlink lines manually + if (line.find("http") != std::string::npos || line.find("discord.gg") != std::string::npos) { + float x0 = w/2 - lineWidth/2; + float y0 = y + font->lineHeight - 1; + this->fill(x0, y0, x0 + lineWidth, y0 + 1, 0xffffffff); + } + y += lineHeight; + } + + super::render(xm, ym, a); +} + +void CreditsScreen::buttonClicked(Button* button) { + if (button->id == 1) { + minecraft->setScreen(new OptionsScreen()); + } +} + +void CreditsScreen::mouseClicked(int x, int y, int buttonNum) { + // map click to a line in the scrolling text + const float lineHeight = minecraft->font->lineHeight + 8; + for (size_t i = 0; i < _lines.size(); ++i) { + float lineY = _scrollY + i * lineHeight; + if (y >= lineY && y < lineY + lineHeight) { + const std::string& line = _lines[i]; + size_t start = line.find("http"); + if (start == std::string::npos) + start = line.find("discord.gg"); + if (start != std::string::npos) { + // extract until space + size_t end = line.find(' ', start); + std::string url = line.substr(start, (end == std::string::npos) ? std::string::npos : end - start); + minecraft->platform()->openURL(url); + return; + } + } + } + super::mouseClicked(x, y, buttonNum); +} diff --git a/src/client/gui/screens/CreditsScreen.h b/src/client/gui/screens/CreditsScreen.h new file mode 100644 index 0000000..961b8d3 --- /dev/null +++ b/src/client/gui/screens/CreditsScreen.h @@ -0,0 +1,32 @@ +#ifndef NET_MINECRAFT_CLIENT_GUI_SCREENS__CreditsScreen_H__ +#define NET_MINECRAFT_CLIENT_GUI_SCREENS__CreditsScreen_H__ + +#include "../Screen.h" +#include "../components/Button.h" + +class ImageButton; + +#include +#include + +class CreditsScreen: public Screen { +public: + typedef Screen super; + CreditsScreen(); + virtual ~CreditsScreen(); + void init(); + void setupPositions(); + virtual void tick(); + void render(int xm, int ym, float a); + void buttonClicked(Button* button); + virtual void mouseClicked(int x, int y, int buttonNum); +private: + Touch::THeader* bHeader; + ImageButton* btnBack; + + std::vector _lines; + float _scrollY; + float _scrollSpeed; +}; + +#endif /* NET_MINECRAFT_CLIENT_GUI_SCREENS__CreditsScreen_H__ */ diff --git a/src/client/gui/screens/DeathScreen.cpp b/src/client/gui/screens/DeathScreen.cpp index a5685dc..0d881a1 100755 --- a/src/client/gui/screens/DeathScreen.cpp +++ b/src/client/gui/screens/DeathScreen.cpp @@ -23,12 +23,15 @@ DeathScreen::~DeathScreen() void DeathScreen::init() { - if (minecraft->useTouchscreen()) { + if (minecraft->options.getIntValue(OPTIONS_MENU_STYLE) == 0) { bRespawn = new Touch::TButton(1, "Respawn!"); bTitle = new Touch::TButton(2, "Main menu"); - } else { + } else if (minecraft->options.getIntValue(OPTIONS_MENU_STYLE) == 1) { bRespawn = new Button(1, "Respawn!"); bTitle = new Button(2, "Main menu"); + } else { + bRespawn = new Button(1, 0, 0, 200, 20, "Respawn"); + bTitle = new Button(2, 0, 0, 200, 20, "Title menu"); } buttons.push_back(bRespawn); buttons.push_back(bTitle); @@ -39,13 +42,23 @@ void DeathScreen::init() void DeathScreen::setupPositions() { - bRespawn->width = bTitle->width = width / 4; +if (minecraft->options.getIntValue(OPTIONS_MENU_STYLE) == 2){ + bRespawn->width = 200; + bTitle->width = 200; + int centerX = (width / 2) - (bRespawn->width / 2); + bRespawn->x = centerX; + bTitle->x = centerX; + + bRespawn->y = (height / 2); + bTitle->y = bRespawn->y + 24; +} else { + bRespawn->width = bTitle->width = width / 4; bRespawn->y = bTitle->y = height / 2; bRespawn->x = width/2 - bRespawn->width - 10; bTitle->x = width/2 + 10; - - LOGI("xyz: %d, %d (%d, %d)\n", bTitle->x, bTitle->y, width, height); +} +// LOGI("xyz: %d, %d (%d, %d)\n", bTitle->x, bTitle->y, width, height); } void DeathScreen::tick() { @@ -56,10 +69,20 @@ void DeathScreen::render( int xm, int ym, float a ) { fillGradient(0, 0, width, height, 0x60500000, 0xa0803030); +if (minecraft->options.getIntValue(OPTIONS_MENU_STYLE) == 2){ glPushMatrix2(); glScalef2(2, 2, 2); - drawCenteredString(font, "You died!", width / 2 / 2, height / 8, 0xffffff); + drawCenteredString(font, I18n::get("deathScreen.title.hardcore"), width / 4, height / 8, 0xffffff); glPopMatrix2(); + std::stringstream ss; + ss << "Score: &e" << minecraft->player->getScore(); + drawCenteredString(font, ss.str(), width / 2, (height / 4) + 32, 0xffffff); +} else { + glPushMatrix2(); + glScalef2(2, 2, 2); + drawCenteredString(font, I18n::get("deathScreen.title"), width / 4, height / 8, 0xffffff); + glPopMatrix2(); +} if (_tick >= WAIT_TICKS) Screen::render(xm, ym, a); diff --git a/src/client/gui/screens/DisconnectionScreen.h b/src/client/gui/screens/DisconnectionScreen.h index 12c62ec..f32530f 100755 --- a/src/client/gui/screens/DisconnectionScreen.h +++ b/src/client/gui/screens/DisconnectionScreen.h @@ -21,7 +21,7 @@ public: } void init() { - if (minecraft->useTouchscreen()) + if (/* minecraft->useTouchscreen() */ true) _back = new Touch::TButton(1, "Ok"); else _back = new Button(1, "Ok"); diff --git a/src/client/gui/screens/FurnaceScreen.cpp b/src/client/gui/screens/FurnaceScreen.cpp index 58d6df2..eb9861f 100755 --- a/src/client/gui/screens/FurnaceScreen.cpp +++ b/src/client/gui/screens/FurnaceScreen.cpp @@ -500,6 +500,8 @@ ItemInstance FurnaceScreen::moveOver(const ItemInstance* item, int maxCount) { setIfNotSet(doRecreatePane, newSize != oldSize); return removed; } + + return ItemInstance(); } diff --git a/src/client/gui/screens/InBedScreen.cpp b/src/client/gui/screens/InBedScreen.cpp index ef6dd95..3adadc7 100755 --- a/src/client/gui/screens/InBedScreen.cpp +++ b/src/client/gui/screens/InBedScreen.cpp @@ -17,7 +17,7 @@ InBedScreen::~InBedScreen() { } void InBedScreen::init() { - if (minecraft->useTouchscreen()) { + if (/* minecraft->useTouchscreen() */ true) { bWakeUp = new Touch::TButton(1, "Leave Bed"); } else { bWakeUp = new Button(1, "Leave Bed"); diff --git a/src/client/gui/screens/IngameBlockSelectionScreen.cpp b/src/client/gui/screens/IngameBlockSelectionScreen.cpp index bc6fc64..1eab145 100755 --- a/src/client/gui/screens/IngameBlockSelectionScreen.cpp +++ b/src/client/gui/screens/IngameBlockSelectionScreen.cpp @@ -1,5 +1,6 @@ #include "IngameBlockSelectionScreen.h" #include "../../renderer/TileRenderer.h" +#include "../../renderer/Lighting.h" #include "../../player/LocalPlayer.h" #include "../../renderer/gles.h" #include "../../Minecraft.h" @@ -11,6 +12,7 @@ #include "../../renderer/Textures.h" #include "../../gamemode/GameMode.h" #include "ArmorScreen.h" +#include "crafting/WorkbenchScreen.h" #include "../components/Button.h" #if defined(__APPLE__) @@ -26,7 +28,8 @@ IngameBlockSelectionScreen::IngameBlockSelectionScreen() InventoryRows(1), InventoryCols(1), InventorySize(1), - bArmor(1, "Armor") + bArmor(1, "Armor"), + bCrafting(1, "Crafting") { } @@ -41,6 +44,19 @@ void IngameBlockSelectionScreen::init() (float)getSlotPosY(0) - 4, (float)getSlotPosX(InventoryCols) + 4, (float)getSlotPosY(InventoryRows) + 4); + + if (!minecraft->isCreativeMode()) { + bArmor.width = 42; + bCrafting.width = 42; + + bArmor.x = 0; + bArmor.y = height - bArmor.height; + + bCrafting.x = 0; + bCrafting.y = height - bCrafting.height - 30; + buttons.push_back(&bArmor); + buttons.push_back(&bCrafting); + } ItemInstance* selected = inventory->getSelected(); if (!selected || selected->isNull()) { @@ -57,13 +73,6 @@ void IngameBlockSelectionScreen::init() } if (!isAllowed(selectedItem)) selectedItem = 0; - - if (!minecraft->isCreativeMode()) { - bArmor.width = 42; - bArmor.x = 0; - bArmor.y = height - bArmor.height; - buttons.push_back(&bArmor); - } } void IngameBlockSelectionScreen::removed() @@ -80,10 +89,10 @@ void IngameBlockSelectionScreen::renderSlots() blitOffset = -90; - //glEnable2(GL_RESCALE_NORMAL); + glEnable2(GL_RESCALE_NORMAL); //glPushMatrix2(); //glRotatef2(180, 1, 0, 0); - //Lighting::turnOn(); + Lighting::turnOn(minecraft); //glPopMatrix2(); minecraft->textures->loadAndBindTexture("gui/gui.png"); @@ -122,8 +131,8 @@ void IngameBlockSelectionScreen::renderSlots() //w.stop(); //w.printEvery(1000, "render-blocksel"); - //glDisable2(GL_RESCALE_NORMAL); - //Lighting::turnOn(); + glDisable2(GL_RESCALE_NORMAL); + Lighting::turnOff(); } int IngameBlockSelectionScreen::getSlotPosX(int slotX) { @@ -169,19 +178,19 @@ void IngameBlockSelectionScreen::keyPressed(int eventKey) int tmpSelectedSlot = selectedItem; Options& o = minecraft->options; - if (eventKey == o.keyLeft.key && selX > 0) + if (eventKey == o.getIntValue(OPTIONS_KEY_LEFT) && selX > 0) { tmpSelectedSlot -= 1; } - else if (eventKey == o.keyRight.key && selX < (InventoryCols - 1)) + else if (eventKey == o.getIntValue(OPTIONS_KEY_RIGHT) && selX < (InventoryCols - 1)) { tmpSelectedSlot += 1; } - else if (eventKey == o.keyDown.key && selY < (InventoryRows - 1)) + else if (eventKey == o.getIntValue(OPTIONS_KEY_BACK) && selY < (InventoryRows - 1)) { tmpSelectedSlot += InventoryCols; } - else if (eventKey == o.keyUp.key && selY > 0) + else if (eventKey == o.getIntValue(OPTIONS_KEY_FORWARD) && selY > 0) { tmpSelectedSlot -= InventoryCols; } @@ -189,19 +198,38 @@ void IngameBlockSelectionScreen::keyPressed(int eventKey) if (isAllowed(tmpSelectedSlot)) selectedItem = tmpSelectedSlot; - if (eventKey == o.keyMenuOk.key) + if (eventKey == o.getIntValue(OPTIONS_KEY_MENU_OK)) selectSlotAndClose(); #ifdef RPI - if (eventKey == o.keyMenuCancel.key + if (eventKey == o.getIntValue(OPTIONS_KEY_MENU_CANCEL) || eventKey == Keyboard::KEY_ESCAPE) minecraft->setScreen(NULL); #else - if (eventKey == o.keyMenuCancel.key) + if (eventKey == o.getIntValue(OPTIONS_KEY_MENU_CANCEL)) minecraft->setScreen(NULL); #endif } +//------------------------------------------------------------------------------ +// wheel support for creative inventory; scroll moves selection vertically +void IngameBlockSelectionScreen::mouseWheel(int dx, int dy, int xm, int ym) +{ + if (dy == 0) return; + // just move selection up/down one row; desktop UI doesn't have a pane + int cols = InventoryCols; + int maxIndex = InventorySize - 1; + int idx = selectedItem; + if (dy > 0) { + // wheel up -> previous row + if (idx >= cols) idx -= cols; + } else { + // wheel down -> next row + if (idx + cols <= maxIndex) idx += cols; + } + selectedItem = idx; +} + int IngameBlockSelectionScreen::getSelectedSlot(int x, int y) { int left = width / 2 - InventoryCols * 10; @@ -229,7 +257,7 @@ void IngameBlockSelectionScreen::mouseClicked(int x, int y, int buttonNum) //minecraft->soundEngine->playUI("random.click", 1, 1); } else { _pendingQuit = !_area.isInside((float)x, (float)y) - && !bArmor.isInside(x, y); + && !bArmor.isInside(x, y) && !bCrafting.isInside(x, y); } } if (!_pendingQuit) @@ -318,5 +346,8 @@ void IngameBlockSelectionScreen::buttonClicked( Button* button ) if (button == &bArmor) { minecraft->setScreen(new ArmorScreen()); } + if (button == &bCrafting) { + minecraft->setScreen(new WorkbenchScreen(Recipe::SIZE_2X2)); + } super::buttonClicked(button); } diff --git a/src/client/gui/screens/IngameBlockSelectionScreen.h b/src/client/gui/screens/IngameBlockSelectionScreen.h index df8bacf..6a0c4b9 100755 --- a/src/client/gui/screens/IngameBlockSelectionScreen.h +++ b/src/client/gui/screens/IngameBlockSelectionScreen.h @@ -12,18 +12,21 @@ public: IngameBlockSelectionScreen(); virtual ~IngameBlockSelectionScreen() {} - virtual void init(); - virtual void removed(); + virtual void init() override; + virtual void removed() override; - void render(int xm, int ym, float a); + void render(int xm, int ym, float a) override; protected: - virtual void mouseClicked(int x, int y, int buttonNum); - virtual void mouseReleased(int x, int y, int buttonNum); + virtual void mouseClicked(int x, int y, int buttonNum) override; + virtual void mouseReleased(int x, int y, int buttonNum) override; - virtual void buttonClicked(Button* button); + virtual void buttonClicked(Button* button) override; - virtual void keyPressed(int eventKey); + // wheel input for creative inventory scrolling + virtual void mouseWheel(int dx, int dy, int xm, int ym) override; + + virtual void keyPressed(int eventKey) override; private: void renderSlots(); void renderSlot(int slot, int x, int y, float a); @@ -49,6 +52,7 @@ private: bool _pendingQuit; Button bArmor; + Button bCrafting; RectangleArea _area; }; diff --git a/src/client/gui/screens/InvalidLicenseScreen.h b/src/client/gui/screens/InvalidLicenseScreen.h old mode 100755 new mode 100644 diff --git a/src/client/gui/screens/JoinByIPScreen.cpp b/src/client/gui/screens/JoinByIPScreen.cpp new file mode 100644 index 0000000..47cd44a --- /dev/null +++ b/src/client/gui/screens/JoinByIPScreen.cpp @@ -0,0 +1,124 @@ +#include "JoinByIPScreen.h" + +#include "JoinGameScreen.h" +#include "StartMenuScreen.h" +#include "ProgressScreen.h" +#include "../Font.h" +#include "../../../network/RakNetInstance.h" +#include "client/Options.h" +#include "client/gui/Screen.h" +#include "client/gui/components/TextBox.h" +#include "network/ClientSideNetworkHandler.h" + +JoinByIPScreen::JoinByIPScreen() : + tIP(0, "Server IP"), + bHeader(1, "Join on server"), + bJoin( 2, "Join Game"), + bBack( 3, "") +{ + bJoin.active = false; + //gamesList->yInertia = 0.5f; +} + +JoinByIPScreen::~JoinByIPScreen() +{ +} + +void JoinByIPScreen::buttonClicked(Button* button) +{ + if (button->id == bJoin.id) + { + minecraft->isLookingForMultiplayer = true; + minecraft->netCallback = new ClientSideNetworkHandler(minecraft, minecraft->raknetInstance); + + minecraft->joinMultiplayerFromString(tIP.text); + { + minecraft->options.set(OPTIONS_LAST_IP, tIP.text); + bJoin.active = false; + bBack.active = false; + minecraft->setScreen(new ProgressScreen()); + } + } + if (button->id == bBack.id) + { + minecraft->cancelLocateMultiplayer(); + minecraft->screenChooser.setScreen(SCREEN_STARTMENU); + } +} + +bool JoinByIPScreen::handleBackEvent(bool isDown) +{ + if (!isDown) + { + minecraft->screenChooser.setScreen(SCREEN_STARTMENU); + } + return true; +} + +void JoinByIPScreen::tick() +{ + Screen::tick(); + bJoin.active = !tIP.text.empty(); +} + +void JoinByIPScreen::init() +{ + ImageDef def; + def.name = "gui/touchgui.png"; + def.width = 34; + def.height = 26; + + def.setSrc(IntRectangle(150, 0, (int)def.width, (int)def.height)); + bBack.setImageDef(def, true); + + buttons.push_back(&bJoin); + buttons.push_back(&bBack); + buttons.push_back(&bHeader); + + textBoxes.push_back(&tIP); +#ifdef ANDROID + tabButtons.push_back(&bJoin); + tabButtons.push_back(&bBack); + tabButtons.push_back(&bHeader); +#endif + + tIP.text = minecraft->options.getStringValue(OPTIONS_LAST_IP); +} + +void JoinByIPScreen::setupPositions() { + int tIpDiff = 40; + + bJoin.y = height * 2 / 3; + bBack.y = 0; + bHeader.y = 0; + + // Center buttons + //bJoin.x = width / 2 - 4 - bJoin.w; + bBack.x = width - bBack.width;//width / 2 + 4; + + bJoin.x = (width - bJoin.width) / 2; + + bHeader.x = 0; + bHeader.width = width - bBack.width; + + tIP.width = bJoin.width + tIpDiff; + tIP.height = 16; + tIP.x = bJoin.x - tIpDiff / 2; + tIP.y = ((height - bJoin.height) / 2) - tIP.height - 4; +} + +void JoinByIPScreen::render( int xm, int ym, float a ) +{ + renderBackground(); + Screen::render(xm, ym, a); +} + +void JoinByIPScreen::keyPressed(int eventKey) +{ + if (eventKey == Keyboard::KEY_ESCAPE) { + minecraft->screenChooser.setScreen(SCREEN_STARTMENU); + return; + } + // let base class handle navigation and text box keys + Screen::keyPressed(eventKey); +} \ No newline at end of file diff --git a/src/client/gui/screens/JoinByIPScreen.h b/src/client/gui/screens/JoinByIPScreen.h new file mode 100644 index 0000000..7333b39 --- /dev/null +++ b/src/client/gui/screens/JoinByIPScreen.h @@ -0,0 +1,28 @@ + +#include "../Screen.h" +#include "../components/Button.h" +#include "../../Minecraft.h" +#include "../components/ImageButton.h" +#include "../components/TextBox.h" + +class JoinByIPScreen: public Screen +{ +public: + JoinByIPScreen(); + virtual ~JoinByIPScreen(); + + void init(); + void setupPositions(); + + virtual void tick(); + void render(int xm, int ym, float a); + + virtual void keyPressed(int eventKey); + void buttonClicked(Button* button); + virtual bool handleBackEvent(bool isDown); +private: + TextBox tIP; + Touch::THeader bHeader; + Touch::TButton bJoin; + ImageButton bBack; +}; diff --git a/src/client/gui/screens/JoinGameScreen.h b/src/client/gui/screens/JoinGameScreen.h index f4d5cbc..4c6fc20 100755 --- a/src/client/gui/screens/JoinGameScreen.h +++ b/src/client/gui/screens/JoinGameScreen.h @@ -3,7 +3,6 @@ #include "../Screen.h" #include "../components/Button.h" -#include "../components/SmallButton.h" #include "../components/ScrolledSelectionList.h" #include "../../Minecraft.h" #include "../../../network/RakNetInstance.h" diff --git a/src/client/gui/screens/OptionsScreen.cpp b/src/client/gui/screens/OptionsScreen.cpp index a20d800..bdccde0 100755 --- a/src/client/gui/screens/OptionsScreen.cpp +++ b/src/client/gui/screens/OptionsScreen.cpp @@ -1,46 +1,61 @@ #include "OptionsScreen.h" #include "StartMenuScreen.h" +#include "UsernameScreen.h" #include "DialogDefinitions.h" #include "../../Minecraft.h" #include "../../../AppPlatform.h" +#include "CreditsScreen.h" -#include "../components/OptionsPane.h" #include "../components/ImageButton.h" #include "../components/OptionsGroup.h" +#include "platform/input/Keyboard.h" + OptionsScreen::OptionsScreen() -: btnClose(NULL), - bHeader(NULL), - selectedCategory(0) { + : btnClose(NULL), + bHeader(NULL), + btnCredits(NULL), + selectedCategory(0) { } OptionsScreen::~OptionsScreen() { - if(btnClose != NULL) { + if (btnClose != NULL) { delete btnClose; btnClose = NULL; } - if(bHeader != NULL) { - delete bHeader, + + if (bHeader != NULL) { + delete bHeader; bHeader = NULL; } - for(std::vector::iterator it = categoryButtons.begin(); it != categoryButtons.end(); ++it) { - if(*it != NULL) { - delete *it; + + if (btnCredits != NULL) { + delete btnCredits; + btnCredits = NULL; + } + + for (std::vector::iterator it = categoryButtons.begin(); it != categoryButtons.end(); ++it) { + if (*it != NULL) { + delete* it; *it = NULL; } } - for(std::vector::iterator it = optionPanes.begin(); it != optionPanes.end(); ++it) { - if(*it != NULL) { - delete *it; + + for (std::vector::iterator it = optionPanes.begin(); it != optionPanes.end(); ++it) { + if (*it != NULL) { + delete* it; *it = NULL; } } + categoryButtons.clear(); } void OptionsScreen::init() { bHeader = new Touch::THeader(0, "Options"); + btnClose = new ImageButton(1, ""); + ImageDef def; def.name = "gui/touchgui.png"; def.width = 34; @@ -49,133 +64,232 @@ void OptionsScreen::init() { def.setSrc(IntRectangle(150, 0, (int)def.width, (int)def.height)); btnClose->setImageDef(def, true); - categoryButtons.push_back(new Touch::TButton(2, "Login")); + categoryButtons.push_back(new Touch::TButton(2, "General")); categoryButtons.push_back(new Touch::TButton(3, "Game")); categoryButtons.push_back(new Touch::TButton(4, "Controls")); categoryButtons.push_back(new Touch::TButton(5, "Graphics")); + categoryButtons.push_back(new Touch::TButton(6, "Tweaks")); + + btnCredits = new Touch::TButton(11, "Credits"); + buttons.push_back(bHeader); buttons.push_back(btnClose); - for(std::vector::iterator it = categoryButtons.begin(); it != categoryButtons.end(); ++it) { + buttons.push_back(btnCredits); + + for (std::vector::iterator it = categoryButtons.begin(); it != categoryButtons.end(); ++it) { buttons.push_back(*it); tabButtons.push_back(*it); } - generateOptionScreens(); + generateOptionScreens(); + // start with first category selected + selectCategory(0); } + void OptionsScreen::setupPositions() { int buttonHeight = btnClose->height; + btnClose->x = width - btnClose->width; btnClose->y = 0; + int offsetNum = 1; - for(std::vector::iterator it = categoryButtons.begin(); it != categoryButtons.end(); ++it) { + + for (std::vector::iterator it = categoryButtons.begin(); it != categoryButtons.end(); ++it) { + (*it)->x = 0; (*it)->y = offsetNum * buttonHeight; (*it)->selected = false; + offsetNum++; } + bHeader->x = 0; bHeader->y = 0; bHeader->width = width - btnClose->width; bHeader->height = btnClose->height; - for(std::vector::iterator it = optionPanes.begin(); it != optionPanes.end(); ++it) { - if(categoryButtons.size() > 0 && categoryButtons[0] != NULL) { + + // Credits button (bottom-right) + if (btnCredits != NULL) { + btnCredits->x = width - btnCredits->width; + btnCredits->y = height - btnCredits->height; + } + + for (std::vector::iterator it = optionPanes.begin(); it != optionPanes.end(); ++it) { + + if (categoryButtons.size() > 0 && categoryButtons[0] != NULL) { + (*it)->x = categoryButtons[0]->width; (*it)->y = bHeader->height; (*it)->width = width - categoryButtons[0]->width; + (*it)->height = height - bHeader->height; + (*it)->setupPositions(); } } - selectCategory(0); + + // don't override user selection on resize } -void OptionsScreen::render( int xm, int ym, float a ) { + +void OptionsScreen::render(int xm, int ym, float a) { renderBackground(); - super::render(xm, ym, a); + int xmm = xm * width / minecraft->width; int ymm = ym * height / minecraft->height - 1; - if(currentOptionPane != NULL) - currentOptionPane->render(minecraft, xmm, ymm); + + if (currentOptionsGroup != NULL) + currentOptionsGroup->render(minecraft, xmm, ymm); + + super::render(xm, ym, a); } -void OptionsScreen::removed() -{ +void OptionsScreen::removed() { } -void OptionsScreen::buttonClicked( Button* button ) { - if(button == btnClose) { - minecraft->reloadOptions(); - minecraft->screenChooser.setScreen(SCREEN_STARTMENU); - } else if(button->id > 1 && button->id < 7) { - // This is a category button + +void OptionsScreen::buttonClicked(Button* button) { + if (button == btnClose) { + minecraft->options.save(); + if (minecraft->screen != NULL) { + minecraft->setScreen(NULL); + } else { + minecraft->screenChooser.setScreen(SCREEN_STARTMENU); + } + } + else if (button->id > 1 && button->id < 7) { int categoryButton = button->id - categoryButtons[0]->id; selectCategory(categoryButton); } + else if (button == btnCredits) { + minecraft->setScreen(new CreditsScreen()); + } } -void OptionsScreen::selectCategory( int index ) { +void OptionsScreen::selectCategory(int index) { int currentIndex = 0; - for(std::vector::iterator it = categoryButtons.begin(); it != categoryButtons.end(); ++it) { - if(index == currentIndex) { + + for (std::vector::iterator it = categoryButtons.begin(); it != categoryButtons.end(); ++it) { + + if (index == currentIndex) (*it)->selected = true; - } else { + else (*it)->selected = false; - } + currentIndex++; } - if(index < (int)optionPanes.size()) - currentOptionPane = optionPanes[index]; + + if (index < (int)optionPanes.size()) + currentOptionsGroup = optionPanes[index]; } void OptionsScreen::generateOptionScreens() { - optionPanes.push_back(new OptionsPane()); - optionPanes.push_back(new OptionsPane()); - optionPanes.push_back(new OptionsPane()); - optionPanes.push_back(new OptionsPane()); - // Mojang Pane - optionPanes[0]->createOptionsGroup("options.group.mojang") - //.addOptionItem(&Options::Option::THIRD_PERSON, minecraft); - .addOptionItem(&Options::Option::SENSITIVITY, minecraft); -// int mojangGroup = optionPanes[0]->createOptionsGroup("Mojang"); -// static const int arr[] = {5,4,3,15}; -// std::vector vec (arr, arr + sizeof(arr) / sizeof(arr[0]) ); -// optionPanes[0]->createStepSlider(minecraft, mojangGroup, "This works?", &Options::Option::DIFFICULTY, vec); -// -// // Game Pane -// int gameGroup = optionPanes[1]->createOptionsGroup("Game"); -// optionPanes[1]->createToggle(gameGroup, "Third person camera", &Options::Option::THIRD_PERSON); -// optionPanes[1]->createToggle(gameGroup, "Server visible", &Options::Option::SERVER_VISIBLE); -// -// // Input Pane -// int controlsGroup = optionPanes[2]->createOptionsGroup("Controls"); -// optionPanes[2]->createToggle(controlsGroup, "Invert X-axis", &Options::Option::INVERT_MOUSE); -// optionPanes[2]->createToggle(controlsGroup, "Lefty", &Options::Option::LEFT_HANDED); -// optionPanes[2]->createToggle(controlsGroup, "Use touch screen", &Options::Option::USE_TOUCHSCREEN); -// optionPanes[2]->createToggle(controlsGroup, "Split touch controls", &Options::Option::USE_TOUCH_JOYPAD); -// int feedBackGroup = optionPanes[2]->createOptionsGroup("Feedback"); -// optionPanes[2]->createToggle(feedBackGroup, "Vibrate on destroy", &Options::Option::DESTROY_VIBRATION); -// -// int graphicsGroup = optionPanes[3]->createOptionsGroup("Graphics"); -// optionPanes[3]->createProgressSlider(minecraft, graphicsGroup, "Gui Scale", &Options::Option::PIXELS_PER_MILLIMETER, 3, 4); -// optionPanes[3]->createToggle(graphicsGroup, "Fancy Graphics", &Options::Option::INVERT_MOUSE); -// optionPanes[3]->createToggle(graphicsGroup, "Fancy Skies", &Options::Option::INVERT_MOUSE); -// optionPanes[3]->createToggle(graphicsGroup, "Animated water", &Options::Option::INVERT_MOUSE); -// int experimentalGraphicsGroup = optionPanes[3]->createOptionsGroup("Experimental graphics"); -// optionPanes[3]->createToggle(experimentalGraphicsGroup, "Soft shadows", &Options::Option::INVERT_MOUSE); + // how the fuck it works + + optionPanes.push_back(new OptionsGroup("options.group.general")); + optionPanes.push_back(new OptionsGroup("options.group.game")); + optionPanes.push_back(new OptionsGroup("options.group.controls")); + optionPanes.push_back(new OptionsGroup("options.group.graphics")); + optionPanes.push_back(new OptionsGroup("options.group.tweaks")); + + // General Pane + optionPanes[0]->addOptionItem(OPTIONS_USERNAME, minecraft) + .addOptionItem(OPTIONS_SENSITIVITY, minecraft); + + // Game Pane + optionPanes[1]->addOptionItem(OPTIONS_DIFFICULTY, minecraft) + .addOptionItem(OPTIONS_SERVER_VISIBLE, minecraft) + .addOptionItem(OPTIONS_THIRD_PERSON_VIEW, minecraft) + .addOptionItem(OPTIONS_WINDOW_SCALE, minecraft) + .addOptionItem(OPTIONS_GUI_SCALE, minecraft) + .addOptionItem(OPTIONS_SENSITIVITY, minecraft) + .addOptionItem(OPTIONS_MUSIC_VOLUME, minecraft) + .addOptionItem(OPTIONS_SOUND_VOLUME, minecraft) + .addOptionItem(OPTIONS_SMOOTH_CAMERA, minecraft) + .addOptionItem(OPTIONS_DESTROY_VIBRATION, minecraft) + .addOptionItem(OPTIONS_IS_LEFT_HANDED, minecraft); + + // // Controls Pane + optionPanes[2]->addOptionItem(OPTIONS_INVERT_Y_MOUSE, minecraft) + .addOptionItem(OPTIONS_USE_TOUCHSCREEN, minecraft) + .addOptionItem(OPTIONS_AUTOJUMP, minecraft) + .addOptionItem(OPTIONS_BLOCK_OUTLINE, minecraft) + .addOptionItem(OPTIONS_IS_JOY_TOUCH_AREA, minecraft); + + for (int i = OPTIONS_KEY_FORWARD; i <= OPTIONS_KEY_USE; i++) { + optionPanes[2]->addOptionItem((OptionId)i, minecraft); + } + + // // Graphics Pane + optionPanes[3]->addOptionItem(OPTIONS_FANCY_GRAPHICS, minecraft) + // .addOptionItem(&Option::VIEW_BOBBING, minecraft) + // .addOptionItem(&Option::AMBIENT_OCCLUSION, minecraft) + // .addOptionItem(&Option::ANAGLYPH, minecraft) + .addOptionItem(OPTIONS_LIMIT_FRAMERATE, minecraft) + .addOptionItem(OPTIONS_VSYNC, minecraft) + .addOptionItem(OPTIONS_VIEW_DISTANCE, minecraft) + .addOptionItem(OPTIONS_RENDER_DEBUG, minecraft) + .addOptionItem(OPTIONS_ANAGLYPH_3D, minecraft) + .addOptionItem(OPTIONS_VIEW_BOBBING, minecraft) + .addOptionItem(OPTIONS_AMBIENT_OCCLUSION, minecraft) + .addOptionItem(OPTIONS_NORMAL_LIGHTING, minecraft) + .addOptionItem(OPTIONS_BEAUTIFUL_SKY, minecraft) + .addOptionItem(OPTIONS_VIGNETTE, minecraft); + + optionPanes[4]->addOptionItem(OPTIONS_ALLOW_SPRINT, minecraft) + .addOptionItem(OPTIONS_BAR_ON_TOP, minecraft) + .addOptionItem(OPTIONS_MENU_STYLE, minecraft) + .addOptionItem(OPTIONS_RPI_CURSOR, minecraft) +#ifndef __APPLE__ + .addOptionItem(OPTIONS_FOLIAGE_TINT, minecraft) + .addOptionItem(OPTIONS_TINTED_SIDE, minecraft) +#endif + .addOptionItem(OPTIONS_JAVA_HUD, minecraft) + .addOptionItem(OPTIONS_FOG_TYPE, minecraft) + .addOptionItem(OPTIONS_BETA_SKY, minecraft) + .addOptionItem(OPTIONS_RESTORED_ANIMS, minecraft) + .addOptionItem(OPTIONS_DEBUG_STYLE, minecraft); + } -void OptionsScreen::mouseClicked( int x, int y, int buttonNum ) { - if(currentOptionPane != NULL) - currentOptionPane->mouseClicked(minecraft, x, y, buttonNum); +void OptionsScreen::mouseClicked(int x, int y, int buttonNum) { + if (currentOptionsGroup != NULL) + currentOptionsGroup->mouseClicked(minecraft, x, y, buttonNum); + super::mouseClicked(x, y, buttonNum); } -void OptionsScreen::mouseReleased( int x, int y, int buttonNum ) { - if(currentOptionPane != NULL) - currentOptionPane->mouseReleased(minecraft, x, y, buttonNum); +void OptionsScreen::mouseReleased(int x, int y, int buttonNum) { + if (currentOptionsGroup != NULL) + currentOptionsGroup->mouseReleased(minecraft, x, y, buttonNum); + super::mouseReleased(x, y, buttonNum); } -void OptionsScreen::tick() { - if(currentOptionPane != NULL) - currentOptionPane->tick(minecraft); - super::tick(); +void OptionsScreen::mouseWheel(int dx, int dy, int xm, int ym) { + if (currentOptionsGroup != NULL && currentOptionsGroup->pointInside(xm, ym) && dy != 0) { + currentOptionsGroup->scrollByPixels((float)dy * 18.0f); + } } + +void OptionsScreen::keyPressed(int eventKey) { + if (currentOptionsGroup != NULL) + currentOptionsGroup->keyPressed(minecraft, eventKey); + if (eventKey == Keyboard::KEY_ESCAPE) + minecraft->options.save(); + + super::keyPressed(eventKey); +} + +void OptionsScreen::charPressed(char inputChar) { + if (currentOptionsGroup != NULL) + currentOptionsGroup->charPressed(minecraft, inputChar); + + super::keyPressed(inputChar); +} + +void OptionsScreen::tick() { + + if (currentOptionsGroup != NULL) + currentOptionsGroup->tick(minecraft); + + super::tick(); +} \ No newline at end of file diff --git a/src/client/gui/screens/OptionsScreen.h b/src/client/gui/screens/OptionsScreen.h index 95c1d98..dd1e73e 100755 --- a/src/client/gui/screens/OptionsScreen.h +++ b/src/client/gui/screens/OptionsScreen.h @@ -3,6 +3,7 @@ #include "../Screen.h" #include "../components/Button.h" +#include "../components/OptionsGroup.h" class ImageButton; class OptionsPane; @@ -10,29 +11,40 @@ class OptionsPane; class OptionsScreen: public Screen { typedef Screen super; - void init(); + void init(); void generateOptionScreens(); public: OptionsScreen(); ~OptionsScreen(); + void setupPositions(); - void buttonClicked( Button* button ); + void buttonClicked(Button* button); void render(int xm, int ym, float a); void removed(); void selectCategory(int index); - virtual void mouseClicked( int x, int y, int buttonNum ); - virtual void mouseReleased( int x, int y, int buttonNum ); + virtual void mouseClicked(int x, int y, int buttonNum); + virtual void mouseReleased(int x, int y, int buttonNum); + virtual void mouseWheel(int dx, int dy, int xm, int ym); + virtual void keyPressed(int eventKey); + virtual void charPressed(char inputChar); + virtual void tick(); + private: Touch::THeader* bHeader; ImageButton* btnClose; + + Button* btnCredits; // <-- ADD THIS + std::vector categoryButtons; - std::vector optionPanes; - OptionsPane* currentOptionPane; + std::vector optionPanes; + + OptionsGroup* currentOptionsGroup; + int selectedCategory; }; -#endif /*NET_MINECRAFT_CLIENT_GUI_SCREENS__OptionsScreen_H__*/ +#endif /*NET_MINECRAFT_CLIENT_GUI_SCREENS__OptionsScreen_H__*/ \ No newline at end of file diff --git a/src/client/gui/screens/PauseScreen.cpp b/src/client/gui/screens/PauseScreen.cpp index ca3d4d6..64b611e 100755 --- a/src/client/gui/screens/PauseScreen.cpp +++ b/src/client/gui/screens/PauseScreen.cpp @@ -5,19 +5,23 @@ #include "../../../util/Mth.h" #include "../../../network/RakNetInstance.h" #include "../../../network/ServerSideNetworkHandler.h" +#include "client/Options.h" +#include "client/gui/components/Button.h" +#include "client/gui/screens/OptionsScreen.h" PauseScreen::PauseScreen(bool wasBackPaused) -: saveStep(0), + : saveStep(0), visibleTime(0), bContinue(0), bQuit(0), + bOptions(0), bQuitAndSaveLocally(0), bServerVisibility(0), -// bThirdPerson(0), + // bThirdPerson(0), wasBackPaused(wasBackPaused), - bSound(&Options::Option::SOUND, 1, 0), - bThirdPerson(&Options::Option::THIRD_PERSON), - bHideGui(&Options::Option::HIDE_GUI) + // bSound(OPTIONS_SOUND_VOLUME, 1, 0), + bThirdPerson(OPTIONS_THIRD_PERSON_VIEW), + bHideGui(OPTIONS_HIDEGUI) { ImageDef def; def.setSrc(IntRectangle(160, 144, 39, 31)); @@ -27,10 +31,10 @@ PauseScreen::PauseScreen(bool wasBackPaused) def.width = defSrc.w * 0.666667f; def.height = defSrc.h * 0.666667f; - bSound.setImageDef(def, true); + // bSound.setImageDef(def, true); defSrc.y += defSrc.h; bThirdPerson.setImageDef(def, true); - bHideGui.setImageDef(def, true); + bHideGui.setImageDef(def, true); //void setImageDef(ImageDef& imageDef, bool setButtonSize); } @@ -39,38 +43,48 @@ PauseScreen::~PauseScreen() { delete bQuit; delete bQuitAndSaveLocally; delete bServerVisibility; -// delete bThirdPerson; + delete bOptions; + // delete bThirdPerson; } void PauseScreen::init() { - if (minecraft->useTouchscreen()) { + if (minecraft->options.getIntValue(OPTIONS_MENU_STYLE) == 0) { bContinue = new Touch::TButton(1, "Back to game"); + bOptions = new Touch::TButton(5, "Options"); bQuit = new Touch::TButton(2, "Quit to title"); bQuitAndSaveLocally = new Touch::TButton(3, "Quit and copy map"); bServerVisibility = new Touch::TButton(4, ""); -// bThirdPerson = new Touch::TButton(5, "Toggle 3:rd person view"); - } else { + // bThirdPerson = new Touch::TButton(5, "Toggle 3:rd person view"); + } else if (minecraft->options.getIntValue(OPTIONS_MENU_STYLE) == 1) { bContinue = new Button(1, "Back to game"); + bOptions = new Button(5, "Options"); bQuit = new Button(2, "Quit to title"); bQuitAndSaveLocally = new Button(3, "Quit and copy map"); bServerVisibility = new Button(4, ""); -// bThirdPerson = new Button(5, "Toggle 3:rd person view"); + // bThirdPerson = new Button(5, "Toggle 3:rd person view"); + } else { + bContinue = new Button(1, 0, 0, 200, 20, "Back to game"); + bServerVisibility = new Button(4, 0, 0, 200, 20, ""); + bOptions = new Button(5, 0, 0, 200, 20, "Options..."); + bQuit = new Button(2, 0, 0, 200, 20, "Save and quit to title"); + bQuitAndSaveLocally = new Button(3, 0, 0, 200, 20, "Copy and quit map"); + // bThirdPerson = new Button(5, "Toggle 3:rd person view"); } buttons.push_back(bContinue); buttons.push_back(bQuit); - - bSound.updateImage(&minecraft->options); + buttons.push_back(bOptions); + // bSound.updateImage(&minecraft->options); bThirdPerson.updateImage(&minecraft->options); bHideGui.updateImage(&minecraft->options); - buttons.push_back(&bSound); + // buttons.push_back(&bSound); buttons.push_back(&bThirdPerson); - //buttons.push_back(&bHideGui); + //buttons.push_back(&bHideGui); // If Back wasn't pressed, set up additional items (more than Quit to menu // and Back to game) here - - #if !defined(APPLE_DEMO_PROMOTION) && !defined(RPI) + +#if !defined(APPLE_DEMO_PROMOTION) && !defined(RPI) if (true || !wasBackPaused) { if (minecraft->raknetInstance) { if (minecraft->raknetInstance->isServer()) { @@ -78,17 +92,17 @@ void PauseScreen::init() { buttons.push_back(bServerVisibility); } else { - #if !defined(DEMO_MODE) - buttons.push_back(bQuitAndSaveLocally); - #endif +#if !defined(DEMO_MODE) + buttons.push_back(bQuitAndSaveLocally); +#endif } } } - #endif -// buttons.push_back(bThirdPerson); +#endif + // buttons.push_back(bThirdPerson); for (unsigned int i = 0; i < buttons.size(); ++i) { - if (buttons[i] == &bSound) continue; + // if (buttons[i] == &bSound) continue; if (buttons[i] == &bThirdPerson) continue; if (buttons[i] == &bHideGui) continue; tabButtons.push_back(buttons[i]); @@ -96,29 +110,53 @@ void PauseScreen::init() { } void PauseScreen::setupPositions() { - saveStep = 0; + saveStep = 0; int yBase = 16; + if (minecraft->options.getIntValue(OPTIONS_MENU_STYLE) == 2){ + yBase = 50; - bContinue->width = bQuit->width = /*bThirdPerson->w =*/ 160; - bQuitAndSaveLocally->width = bServerVisibility->width = 160; + bContinue->width = bOptions->width = bQuit->width = /*bThirdPerson->w =*/ 200; + bQuitAndSaveLocally->width = bServerVisibility->width = 200; - bContinue->x = (width - bContinue->width) / 2; - bContinue->y = yBase + 32 * 1; + bContinue->x = (width - bContinue->width) / 2; + bContinue->y = yBase + 24 * 1; - bQuit->x = (width - bQuit->width) / 2; - bQuit->y = yBase + 32 * 2; + bQuitAndSaveLocally->x = bServerVisibility->x = (width - bQuitAndSaveLocally->width) / 2; + bQuitAndSaveLocally->y = bServerVisibility->y = yBase + 24 * 2; + + bOptions->x = (width - bOptions->width) / 2; + bOptions->y = yBase + 24 * 3 + 24; + + bQuit->x = (width - bQuit->width) / 2; + bQuit->y = yBase + 24 * 4 + 24; + + } else { + bContinue->width = bOptions->width = bQuit->width = /*bThirdPerson->w =*/ 160; + bQuitAndSaveLocally->width = bServerVisibility->width = 160; + + bContinue->x = (width - bContinue->width) / 2; + bContinue->y = yBase + 32 * 1; + + bOptions->x = (width - bOptions->width) / 2; + bOptions->y = yBase + 32 * 2; + + bQuit->x = (width - bQuit->width) / 2; + bQuit->y = yBase + 32 * 3; #if APPLE_DEMO_PROMOTION - bQuit->y += 16; + bQuit->y += 16; #endif - - bQuitAndSaveLocally->x = bServerVisibility->x = (width - bQuitAndSaveLocally->width) / 2; - bQuitAndSaveLocally->y = bServerVisibility->y = yBase + 32 * 3; - bSound.y = bThirdPerson.y = 8; - bSound.x = 4; - bThirdPerson.x = bSound.x + 4 + bSound.width; - bHideGui.x = bThirdPerson.x + 4 + bThirdPerson.width; + bQuitAndSaveLocally->x = bServerVisibility->x = (width - bQuitAndSaveLocally->width) / 2; + bQuitAndSaveLocally->y = bServerVisibility->y = yBase + 32 * 4; + } + + + + // bSound.y = bThirdPerson.y = 8; + // bSound.x = 4; + // bThirdPerson.x = bSound.x + 4 + bSound.width; + // bHideGui.x = bThirdPerson.x + 4 + bThirdPerson.width; //bThirdPerson->x = (width - bThirdPerson->w) / 2; //bThirdPerson->y = yBase + 32 * 4; @@ -151,13 +189,15 @@ void PauseScreen::buttonClicked(Button* button) { minecraft->setScreen(NULL); //minecraft->grabMouse(); } - if (button->id == bQuit->id) { + if (button->id == bQuit->id) { minecraft->leaveGame(); - } + } if (button->id == bQuitAndSaveLocally->id) { minecraft->leaveGame(true); } - + if (button->id == bOptions->id) { + minecraft->setScreen(new OptionsScreen()); + } if (button->id == bServerVisibility->id) { if (minecraft->raknetInstance && minecraft->netCallback && minecraft->raknetInstance->isServer()) { ServerSideNetworkHandler* ss = (ServerSideNetworkHandler*) minecraft->netCallback; @@ -185,5 +225,5 @@ void PauseScreen::updateServerVisibilityText() ServerSideNetworkHandler* ss = (ServerSideNetworkHandler*) minecraft->netCallback; bServerVisibility->msg = ss->allowsIncomingConnections()? "Server is visible" - : "Server is invisible"; + : "Server is invisible"; } diff --git a/src/client/gui/screens/PauseScreen.h b/src/client/gui/screens/PauseScreen.h index 1df9dbf..4098511 100755 --- a/src/client/gui/screens/PauseScreen.h +++ b/src/client/gui/screens/PauseScreen.h @@ -33,9 +33,11 @@ private: Button* bQuit; Button* bQuitAndSaveLocally; Button* bServerVisibility; -// Button* bThirdPerson; + Button* bOptions; - OptionButton bSound; + // Button* bThirdPerson; + + // OptionButton bSound; OptionButton bThirdPerson; OptionButton bHideGui; }; diff --git a/src/client/gui/screens/ProgressScreen.h b/src/client/gui/screens/ProgressScreen.h index 263e346..762d4fa 100755 --- a/src/client/gui/screens/ProgressScreen.h +++ b/src/client/gui/screens/ProgressScreen.h @@ -11,6 +11,8 @@ public: void render(int xm, int ym, float a); bool isInGameScreen(); + virtual void keyPressed(int eventKey) {} + void tick(); private: int ticks; diff --git a/src/client/gui/screens/ScreenChooser.cpp b/src/client/gui/screens/ScreenChooser.cpp index 63d0da1..86dbdf5 100755 --- a/src/client/gui/screens/ScreenChooser.cpp +++ b/src/client/gui/screens/ScreenChooser.cpp @@ -4,7 +4,9 @@ #include "JoinGameScreen.h" #include "PauseScreen.h" #include "RenameMPLevelScreen.h" +#include "ConsoleScreen.h" #include "IngameBlockSelectionScreen.h" +#include "JoinByIPScreen.h" #include "touch/TouchStartMenuScreen.h" #include "touch/TouchSelectWorldScreen.h" #include "touch/TouchJoinGameScreen.h" @@ -12,19 +14,23 @@ #include "../../Minecraft.h" +#include "UsernameScreen.h" + Screen* ScreenChooser::createScreen( ScreenId id ) { Screen* screen = NULL; - if (_mc->useTouchscreen()) { + // :sob: + if (_mc->options.getIntValue(OPTIONS_MENU_STYLE) == 0) { switch (id) { - case SCREEN_STARTMENU: screen = new Touch::StartMenuScreen(); break; - case SCREEN_SELECTWORLD:screen = new Touch::SelectWorldScreen();break; - case SCREEN_JOINGAME: screen = new Touch::JoinGameScreen(); break; - case SCREEN_PAUSE: screen = new PauseScreen(false); break; - case SCREEN_PAUSEPREV: screen = new PauseScreen(true); break; - case SCREEN_BLOCKSELECTION: screen = new Touch::IngameBlockSelectionScreen(); break; - + case SCREEN_STARTMENU: screen = new Touch::StartMenuScreen(); break; + case SCREEN_SELECTWORLD: screen = new Touch::SelectWorldScreen();break; + case SCREEN_JOINGAME: screen = new Touch::JoinGameScreen(); break; + case SCREEN_PAUSE: screen = new PauseScreen(false); break; + case SCREEN_PAUSEPREV: screen = new PauseScreen(true); break; + case SCREEN_BLOCKSELECTION: screen = new Touch::IngameBlockSelectionScreen(); break; + case SCREEN_JOINBYIP: screen = new JoinByIPScreen(); break; + case SCREEN_CONSOLE: screen = new ConsoleScreen(); break; case SCREEN_NONE: default: // Do nothing @@ -32,13 +38,14 @@ Screen* ScreenChooser::createScreen( ScreenId id ) } } else { switch (id) { - case SCREEN_STARTMENU: screen = new StartMenuScreen(); break; - case SCREEN_SELECTWORLD:screen = new SelectWorldScreen();break; - case SCREEN_JOINGAME: screen = new JoinGameScreen(); break; - case SCREEN_PAUSE: screen = new PauseScreen(false); break; - case SCREEN_PAUSEPREV: screen = new PauseScreen(true); break; - case SCREEN_BLOCKSELECTION: screen = new IngameBlockSelectionScreen(); break; - + case SCREEN_STARTMENU: screen = new StartMenuScreen(); break; + case SCREEN_SELECTWORLD: screen = new SelectWorldScreen();break; + case SCREEN_JOINGAME: screen = new JoinGameScreen(); break; + case SCREEN_PAUSE: screen = new PauseScreen(false); break; + case SCREEN_PAUSEPREV: screen = new PauseScreen(true); break; + case SCREEN_BLOCKSELECTION: screen = new IngameBlockSelectionScreen(); break; + case SCREEN_JOINBYIP: screen = new JoinByIPScreen(); break; + case SCREEN_CONSOLE: screen = new ConsoleScreen(); break; case SCREEN_NONE: default: // Do nothing diff --git a/src/client/gui/screens/ScreenChooser.h b/src/client/gui/screens/ScreenChooser.h index 0979ade..21d19e5 100755 --- a/src/client/gui/screens/ScreenChooser.h +++ b/src/client/gui/screens/ScreenChooser.h @@ -8,7 +8,9 @@ enum ScreenId { SCREEN_PAUSE, SCREEN_PAUSEPREV, SCREEN_SELECTWORLD, - SCREEN_BLOCKSELECTION + SCREEN_BLOCKSELECTION, + SCREEN_JOINBYIP, + SCREEN_CONSOLE }; class Screen; diff --git a/src/client/gui/screens/SelectWorldScreen.cpp b/src/client/gui/screens/SelectWorldScreen.cpp index ec92cfa..596ea1a 100755 --- a/src/client/gui/screens/SelectWorldScreen.cpp +++ b/src/client/gui/screens/SelectWorldScreen.cpp @@ -230,7 +230,6 @@ SelectWorldScreen::SelectWorldScreen() bBack (3, "Back"), bWorldView(4, ""), worldsList(NULL), - _state(_STATE_DEFAULT), _hasStartedLevel(false) { bDelete.active = false; @@ -244,17 +243,11 @@ SelectWorldScreen::~SelectWorldScreen() void SelectWorldScreen::buttonClicked(Button* button) { if (button->id == bCreate.id) { - //minecraft->setScreen( new CreateWorldScreen() ); - //minecraft->locateMultiplayer(); - //minecraft->setScreen(new JoinGameScreen()); - - //minecraft->hostMultiplayer(); - //minecraft->setScreen(new ProgressScreen()); - - if (_state == _STATE_DEFAULT && !_hasStartedLevel) { - minecraft->platform()->createUserInput(DialogDefinitions::DIALOG_CREATE_NEW_WORLD); - _state = _STATE_CREATEWORLD; - } + // open in-game world-creation screen instead of using platform dialog + if (!_hasStartedLevel) { + std::string name = getUniqueLevelName("world"); + minecraft->setScreen(new SimpleChooseLevelScreen(name)); + } } if (button->id == bDelete.id) { if (isIndexValid(worldsList->selectedItem)) { @@ -294,70 +287,6 @@ static char ILLEGAL_FILE_CHARACTERS[] = { void SelectWorldScreen::tick() { - if (_state == _STATE_CREATEWORLD) { - #if defined(RPI) - std::string levelId = getUniqueLevelName("world"); - LevelSettings settings(getEpochTimeS(), GameType::Creative); - minecraft->selectLevel(levelId, levelId, settings); - minecraft->hostMultiplayer(); - minecraft->setScreen(new ProgressScreen()); - _hasStartedLevel = true; - #elif defined(WIN32) - std::string name = getUniqueLevelName("perf"); - minecraft->setScreen(new SimpleChooseLevelScreen(name)); - #else - int status = minecraft->platform()->getUserInputStatus(); - if (status > -1) { - if (status == 1) { - StringVector sv = minecraft->platform()->getUserInput(); - - // Read the level name. - // 1) Trim name 2) Remove all bad chars 3) Append '-' chars 'til the name is unique - std::string levelName = Util::stringTrim(sv[0]); - std::string levelId = levelName; - - for (int i = 0; i < sizeof(ILLEGAL_FILE_CHARACTERS) / sizeof(char); ++i) - levelId = Util::stringReplace(levelId, std::string(1, ILLEGAL_FILE_CHARACTERS[i]), ""); - if ((int)levelId.length() == 0) { - levelId = "no_name"; - } - levelId = getUniqueLevelName(levelId); - - // Read the seed - int seed = getEpochTimeS(); - if (sv.size() >= 2) { - std::string seedString = Util::stringTrim(sv[1]); - if (seedString.length() > 0) { - int tmpSeed; - // Try to read it as an integer - if (sscanf(seedString.c_str(), "%d", &tmpSeed) > 0) { - seed = tmpSeed; - } // Hash the "seed" - else { - seed = Util::hashCode(seedString); - } - } - } - // Read the game mode - bool isCreative = true; - if (sv.size() >= 3 && sv[2] == "survival") - isCreative = false; - - // Start a new level with the given name and seed - LevelSettings settings(seed, isCreative? GameType::Creative : GameType::Survival); - LOGI("Creating a level with id '%s', name '%s' and seed '%d'\n", levelId.c_str(), levelName.c_str(), seed); - minecraft->selectLevel(levelId, levelName, settings); - minecraft->hostMultiplayer(); - minecraft->setScreen(new ProgressScreen()); - _hasStartedLevel = true; - } - _state = _STATE_DEFAULT; - } - #endif - - return; - } - worldsList->tick(); if (worldsList->hasPickedLevel) { @@ -427,7 +356,7 @@ void SelectWorldScreen::render( int xm, int ym, float a ) worldsList->setComponentSelected(bWorldView.selected); // #ifdef PLATFORM_DESKTOP - // We should add scrolling with mouse wheel but currently i dont know how to implement it + // desktop: render the list normally (mouse wheel handled separately below) if (_mouseHasBeenUp) worldsList->render(xm, ym, a); else { @@ -483,12 +412,34 @@ std::string SelectWorldScreen::getUniqueLevelName( const std::string& level ) bool SelectWorldScreen::isInGameScreen() { return true; } +void SelectWorldScreen::mouseWheel(int dx, int dy, int xm, int ym) +{ + if (!worldsList) + return; + if (dy == 0) + return; + int num = worldsList->getNumberOfItems(); + int idx = worldsList->selectedItem; + if (dy > 0) { + if (idx > 0) { + idx--; + worldsList->stepLeft(); + } + } else { + if (idx < num - 1) { + idx++; + worldsList->stepRight(); + } + } + worldsList->selectedItem = idx; +} + void SelectWorldScreen::keyPressed( int eventKey ) { if (bWorldView.selected) { - if (eventKey == minecraft->options.keyLeft.key) + if (eventKey == minecraft->options.getIntValue(OPTIONS_KEY_RIGHT)) worldsList->stepLeft(); - if (eventKey == minecraft->options.keyRight.key) + if (eventKey == minecraft->options.getIntValue(OPTIONS_KEY_LEFT)) worldsList->stepRight(); } diff --git a/src/client/gui/screens/SelectWorldScreen.h b/src/client/gui/screens/SelectWorldScreen.h index a4eaf35..12c6c7e 100755 --- a/src/client/gui/screens/SelectWorldScreen.h +++ b/src/client/gui/screens/SelectWorldScreen.h @@ -4,7 +4,6 @@ #include "../Screen.h" #include "../TweenData.h" #include "../components/Button.h" -#include "../components/SmallButton.h" #include "../components/RolledSelectionListH.h" #include "../../Minecraft.h" #include "../../../world/level/storage/LevelStorageSource.h" @@ -90,6 +89,9 @@ public: void render(int xm, int ym, float a); + // mouse wheel scroll (new in desktop implementation) + virtual void mouseWheel(int dx, int dy, int xm, int ym); + bool isInGameScreen(); private: void loadLevelSource(); @@ -104,9 +106,6 @@ private: bool _mouseHasBeenUp; bool _hasStartedLevel; - int _state; - static const int _STATE_DEFAULT = 0; - static const int _STATE_CREATEWORLD = 1; //LevelStorageSource* levels; }; diff --git a/src/client/gui/screens/SimpleChooseLevelScreen.cpp b/src/client/gui/screens/SimpleChooseLevelScreen.cpp index a9deb36..37f5c72 100755 --- a/src/client/gui/screens/SimpleChooseLevelScreen.cpp +++ b/src/client/gui/screens/SimpleChooseLevelScreen.cpp @@ -2,96 +2,260 @@ #include "ProgressScreen.h" #include "ScreenChooser.h" #include "../components/Button.h" +#include "../components/ImageButton.h" #include "../../Minecraft.h" #include "../../../world/level/LevelSettings.h" #include "../../../platform/time.h" +#include "../../../platform/input/Keyboard.h" +#include "../../../platform/log.h" +#include SimpleChooseLevelScreen::SimpleChooseLevelScreen(const std::string& levelName) -: bCreative(0), - bSurvival(0), - bBack(0), - levelName(levelName), - hasChosen(false) +: bHeader(nullptr), + bGamemode(nullptr), + bCheats(nullptr), + bBack(nullptr), + bCreate(nullptr), + levelName(levelName), + hasChosen(false), + gamemode(GameType::Survival), + cheatsEnabled(false), + tLevelName(0, "World name"), + tSeed(1, "World seed") { } SimpleChooseLevelScreen::~SimpleChooseLevelScreen() { - delete bCreative; - delete bSurvival; - delete bBack; + if (bHeader) delete bHeader; + delete bGamemode; + delete bCheats; + delete bBack; + delete bCreate; } void SimpleChooseLevelScreen::init() { - if (minecraft->useTouchscreen()) { - bCreative = new Touch::TButton(1, "Creative mode"); - bSurvival = new Touch::TButton(2, "Survival mode"); - bBack = new Touch::TButton(3, "Back"); - } else { - bCreative = new Button(1, "Creative mode"); - bSurvival = new Button(2, "Survival mode"); - bBack = new Button(3, "Back"); - } - buttons.push_back(bCreative); - buttons.push_back(bSurvival); - buttons.push_back(bBack); + // make sure the base class loads the existing level list; the + // derived screen uses ChooseLevelScreen::getUniqueLevelName(), which + // depends on `levels` being populated. omitting this used to result + // in duplicate IDs ("creating the second world would load the + // first") when the name already existed. + ChooseLevelScreen::init(); - tabButtons.push_back(bCreative); - tabButtons.push_back(bSurvival); - tabButtons.push_back(bBack); + tLevelName.text = I18n::get("selectWorld.newWorld"); + + // header + close button + bHeader = new Touch::THeader(0, I18n::get("selectWorld.create")); + // create the back/X button as ImageButton like CreditsScreen + bBack = new ImageButton(2, ""); + { + ImageDef def; + def.name = "gui/touchgui.png"; + def.width = 34; + def.height = 26; + def.setSrc(IntRectangle(150, 0, (int)def.width, (int)def.height)); + bBack->setImageDef(def, true); + } + if (minecraft->options.getIntValue(OPTIONS_MENU_STYLE) != 2) { + bGamemode = new Touch::TButton(1, I18n::get("selectWorld.gameMode.survival")); + bCheats = new Touch::TButton(4, "Cheats: Off"); + bCreate = new Touch::TButton(3, I18n::get("selectWorld.create")); + } else { + bGamemode = new Button(1, I18n::get("selectWorld.gameMode.survival")); + bCheats = new Button(4, "Cheats: Off"); + bCreate = new Button(3, I18n::get("Create")); + } + + buttons.push_back(bHeader); + buttons.push_back(bBack); + buttons.push_back(bGamemode); + buttons.push_back(bCheats); + buttons.push_back(bCreate); + + tabButtons.push_back(bGamemode); + tabButtons.push_back(bCheats); + tabButtons.push_back(bBack); + tabButtons.push_back(bCreate); + + textBoxes.push_back(&tLevelName); + textBoxes.push_back(&tSeed); } void SimpleChooseLevelScreen::setupPositions() { - bCreative->width = bSurvival->width = bBack->width = 120; - bCreative->x = (width - bCreative->width) / 2; - bCreative->y = height/3 - 40; - bSurvival->x = (width - bSurvival->width) / 2; - bSurvival->y = 2*height/3 - 40; - bBack->x = bSurvival->x + bSurvival->width - bBack->width; - bBack->y = height - 40; + int buttonHeight = bBack->height; + + // position back button in upper-right + bBack->x = width - bBack->width; + bBack->y = 0; + + // header occupies remaining top bar + if (bHeader) { + bHeader->x = 0; + bHeader->y = 0; + bHeader->width = width - bBack->width; + bHeader->height = buttonHeight; + } + + // layout the form elements below the header + int centerX = width / 2; + const int padding = 5; + + tLevelName.width = tSeed.width = 200; + tLevelName.x = centerX - tLevelName.width / 2; + tLevelName.y = buttonHeight + 20; + + tSeed.x = tLevelName.x; + tSeed.y = tLevelName.y + 30; + + const int buttonWidth = 120; + const int buttonSpacing = 10; + const int totalButtonWidth = buttonWidth * 2 + buttonSpacing; + + bGamemode->width = buttonWidth; + bCheats->width = buttonWidth; + + bGamemode->x = centerX - totalButtonWidth / 2; + bCheats->x = bGamemode->x + buttonWidth + buttonSpacing; + + // compute vertical centre for buttons in remaining space + { + int bottomPad = 20; + int availTop = buttonHeight + 20 + 30 + 10; // just below seed + int availBottom = height - bottomPad - bCreate->height - 10; // leave some gap before create + int availHeight = availBottom - availTop; + if (availHeight < 0) availHeight = 0; + int y = availTop + (availHeight - bGamemode->height) / 2; + bGamemode->y = y; + bCheats->y = y; + } + + bCreate->width = 100; + bCreate->x = centerX - bCreate->width / 2; + int bottomPadding = 20; + bCreate->y = height - bottomPadding - bCreate->height; +} + +void SimpleChooseLevelScreen::tick() +{ + // let any textboxes handle their own blinking/input + for (auto* tb : textBoxes) + tb->tick(minecraft); } void SimpleChooseLevelScreen::render( int xm, int ym, float a ) { - renderDirtBackground(0); + renderDirtBackground(0); glEnable2(GL_BLEND); - drawCenteredString(minecraft->font, "Mobs, health and gather resources", width/2, bSurvival->y + bSurvival->height + 4, 0xffcccccc); - drawCenteredString(minecraft->font, "Unlimited resources and flying", width/2, bCreative->y + bCreative->height + 4, 0xffcccccc); + const char* modeDesc = NULL; + if (gamemode == GameType::Survival) { + modeDesc = "Mobs, health and gather resources"; + } else if (gamemode == GameType::Creative) { + modeDesc = "Unlimited resources and flying"; + } + if (modeDesc) { + drawCenteredString(minecraft->font, modeDesc, width / 2, bGamemode->y + bGamemode->height + 4, 0xffcccccc); + } - Screen::render(xm, ym, a); + drawString(minecraft->font, "World name:", tLevelName.x, tLevelName.y - Font::DefaultLineHeight - 2, 0xffcccccc); + drawString(minecraft->font, "World seed:", tSeed.x, tSeed.y - Font::DefaultLineHeight - 2, 0xffcccccc); + + Screen::render(xm, ym, a); glDisable2(GL_BLEND); } +// mouse clicks should also manage textbox focus explicitly +void SimpleChooseLevelScreen::mouseClicked(int x, int y, int buttonNum) +{ + if (buttonNum == MouseAction::ACTION_LEFT) { + // determine if the click landed on either textbox or its label above + int lvlTop = tLevelName.y - (Font::DefaultLineHeight + 4); + int lvlBottom = tLevelName.y + tLevelName.height; + int lvlLeft = tLevelName.x; + int lvlRight = tLevelName.x + tLevelName.width; + bool clickedLevel = x >= lvlLeft && x < lvlRight && y >= lvlTop && y < lvlBottom; + + int seedTop = tSeed.y - (Font::DefaultLineHeight + 4); + int seedBottom = tSeed.y + tSeed.height; + int seedLeft = tSeed.x; + int seedRight = tSeed.x + tSeed.width; + bool clickedSeed = x >= seedLeft && x < seedRight && y >= seedTop && y < seedBottom; + + if (clickedLevel) { + LOGI("SimpleChooseLevelScreen: level textbox clicked (%d,%d)\n", x, y); + tLevelName.setFocus(minecraft); + tSeed.loseFocus(minecraft); + } else if (clickedSeed) { + LOGI("SimpleChooseLevelScreen: seed textbox clicked (%d,%d)\n", x, y); + tSeed.setFocus(minecraft); + tLevelName.loseFocus(minecraft); + } else { + // click outside both fields -> blur both + tLevelName.loseFocus(minecraft); + tSeed.loseFocus(minecraft); + } + } + + // allow normal button and textbox handling too + Screen::mouseClicked(x, y, buttonNum); +} + void SimpleChooseLevelScreen::buttonClicked( Button* button ) { - if (button == bBack) { - minecraft->screenChooser.setScreen(SCREEN_STARTMENU); - return; - } - if (hasChosen) - return; + if (hasChosen) + return; - int gameType; + if (button == bGamemode) { + gamemode ^= 1; + bGamemode->msg = (gamemode == GameType::Survival) ? "Survival mode" : "Creative mode"; + return; + } - if (button == bCreative) - gameType = GameType::Creative; + if (button == bCheats) { + cheatsEnabled = !cheatsEnabled; + bCheats->msg = cheatsEnabled ? "Cheats: On" : "Cheats: Off"; + return; + } - if (button == bSurvival) - gameType = GameType::Survival; + if (button == bCreate && !tLevelName.text.empty()) { + int seed = getEpochTimeS(); + if (!tSeed.text.empty()) { + std::string seedString = Util::stringTrim(tSeed.text); + int tmpSeed; + if (sscanf(seedString.c_str(), "%d", &tmpSeed) > 0) { + seed = tmpSeed; + } else { + seed = Util::hashCode(seedString); + } + } + std::string levelId = getUniqueLevelName(tLevelName.text); + LevelSettings settings(seed, gamemode, cheatsEnabled); + minecraft->selectLevel(levelId, levelId, settings); + minecraft->hostMultiplayer(); + minecraft->setScreen(new ProgressScreen()); + hasChosen = true; + return; + } - std::string levelId = getUniqueLevelName(levelName); - LevelSettings settings(getEpochTimeS(), gameType); - minecraft->selectLevel(levelId, levelId, settings); - minecraft->hostMultiplayer(); - minecraft->setScreen(new ProgressScreen()); - hasChosen = true; + if (button == bBack) { + minecraft->screenChooser.setScreen(SCREEN_STARTMENU); + } +} + +void SimpleChooseLevelScreen::keyPressed(int eventKey) +{ + if (eventKey == Keyboard::KEY_ESCAPE) { + minecraft->screenChooser.setScreen(SCREEN_STARTMENU); + return; + } + // let base class handle navigation and text box keys + Screen::keyPressed(eventKey); } bool SimpleChooseLevelScreen::handleBackEvent(bool isDown) { if (!isDown) minecraft->screenChooser.setScreen(SCREEN_STARTMENU); - return true; + return true; } diff --git a/src/client/gui/screens/SimpleChooseLevelScreen.h b/src/client/gui/screens/SimpleChooseLevelScreen.h index 12e24a3..1c88d06 100755 --- a/src/client/gui/screens/SimpleChooseLevelScreen.h +++ b/src/client/gui/screens/SimpleChooseLevelScreen.h @@ -2,7 +2,10 @@ #define NET_MINECRAFT_CLIENT_GUI_SCREENS__DemoChooseLevelScreen_H__ #include "ChooseLevelScreen.h" +#include "../components/TextBox.h" +#include "../components/Button.h" // for Touch::THeader class Button; +class ImageButton; class SimpleChooseLevelScreen: public ChooseLevelScreen { @@ -12,21 +15,30 @@ public: virtual ~SimpleChooseLevelScreen(); void init(); - void setupPositions(); + void tick(); void render(int xm, int ym, float a); void buttonClicked(Button* button); bool handleBackEvent(bool isDown); + virtual void keyPressed(int eventKey); + virtual void mouseClicked(int x, int y, int buttonNum); private: - Button* bCreative; - Button* bSurvival; - Button* bBack; + Touch::THeader* bHeader; + Button* bGamemode; + Button* bCheats; + ImageButton* bBack; + Button* bCreate; bool hasChosen; std::string levelName; + int gamemode; + bool cheatsEnabled; + + TextBox tLevelName; + TextBox tSeed; }; #endif /*NET_MINECRAFT_CLIENT_GUI_SCREENS__DemoChooseLevelScreen_H__*/ diff --git a/src/client/gui/screens/StartMenuScreen.cpp b/src/client/gui/screens/StartMenuScreen.cpp index a216ad9..27f25ec 100755 --- a/src/client/gui/screens/StartMenuScreen.cpp +++ b/src/client/gui/screens/StartMenuScreen.cpp @@ -1,17 +1,16 @@ #include "StartMenuScreen.h" +#include "UsernameScreen.h" #include "SelectWorldScreen.h" #include "ProgressScreen.h" #include "JoinGameScreen.h" #include "OptionsScreen.h" #include "PauseScreen.h" -#include "InvalidLicenseScreen.h" #include "PrerenderTilesScreen.h" // test button -//#include "BuyGameScreen.h" +#include "../components/ImageButton.h" #include "../../../util/Mth.h" #include "../Font.h" -#include "../components/SmallButton.h" #include "../components/ScrolledSelectionList.h" #include "../../Minecraft.h" @@ -24,44 +23,72 @@ // Some kind of default settings, might be overridden in ::init StartMenuScreen::StartMenuScreen() -: bHost( 2, 0, 0, 160, 24, "Start Game"), - bJoin( 3, 0, 0, 160, 24, "Join Game"), - bOptions( 4, 0, 0, 78, 22, "Options"), - bBuy( 5, 0, 0, 78, 22, "Buy"), - bTest( 999, 0, 0, 78, 22, "Create") { } StartMenuScreen::~StartMenuScreen() { + delete bHost; + delete bJoin; + delete bOptions; + delete bQuit; } void StartMenuScreen::init() { - buttons.push_back(&bHost); - buttons.push_back(&bJoin); - //buttons.push_back(&bTest); + if (minecraft->options.getIntValue(OPTIONS_MENU_STYLE) == 2){ + bHost = new Button( 2, 0, 0, 200, 20, "Singleplayer"); + bJoin = new Button( 3, 0, 0, 200, 20, "Multiplayer"); + bOptions = new Button( 4, 0, 0, 200, 20, "Options..."); + bQuit = new Button( 5, 0, 0, 200, 20, "Ouit Game"); + } else { + bHost = new Button( 2, 0, 0, 160, 24, "Start Game"); + bJoin = new Button( 3, 0, 0, 160, 24, "Join Game"); + bOptions = new Button( 4, 0, 0, 160, 24, "Options"); + bQuit = new Button( 5, 0, 0, 160, 24, "Ouit Game"); + } + bJoin->active = bHost->active = bOptions->active = true; - tabButtons.push_back(&bHost); - tabButtons.push_back(&bJoin); + if (minecraft->options.getStringValue(OPTIONS_USERNAME).empty()) { + return; // tick() will redirect to UsernameScreen + } + + buttons.push_back(bHost); + buttons.push_back(bJoin); + //buttons.push_back(&bTest); + buttons.push_back(bQuit); + + tabButtons.push_back(bHost); + tabButtons.push_back(bJoin); + tabButtons.push_back(bQuit); #ifndef RPI - buttons.push_back(&bOptions); - tabButtons.push_back(&bOptions); + buttons.push_back(bOptions); + tabButtons.push_back(bOptions); #endif - #ifdef DEMO_MODE - buttons.push_back(&bBuy); - tabButtons.push_back(&bBuy); - #endif + //// add quit button (top right X icon) – match OptionsScreen style + //{ + // ImageDef def; + // def.name = "gui/touchgui.png"; + // def.width = 34; + // def.height = 26; + // def.setSrc(IntRectangle(150, 0, (int)def.width, (int)def.height)); + // bQuit.setImageDef(def, true); + // bQuit.scaleWhenPressed = false; + // buttons.push_back(&bQuit); + // // don't include in tab navigation + //} copyright = "\xffMojang AB";//. Do not distribute!"; - #ifdef PRE_ANDROID23 - std::string versionString = Common::getGameVersionString("j"); - #else - std::string versionString = Common::getGameVersionString(); - #endif + // always show base version string, suffix was previously added for Android builds + std::string versionString = Common::getGameVersionString(); + + std::string _username = minecraft->options.getStringValue(OPTIONS_USERNAME); + if (_username.empty()) _username = "unknown"; + + username = "Username: " + _username; #ifdef DEMO_MODE #ifdef __APPLE__ @@ -76,42 +103,41 @@ void StartMenuScreen::init() version = versionString; #endif #endif - - bJoin.active = bHost.active = bOptions.active = false; } void StartMenuScreen::setupPositions() { - int yBase = height / 2 + 25; + if (minecraft->options.getIntValue(OPTIONS_MENU_STYLE) == 2){ + int yBase = (height / 2) - 20; - //#ifdef ANDROID - bHost.y = yBase - 28; -#ifdef RPI - bJoin.y = yBase + 4; -#else - bJoin.y = yBase; -#endif - - bOptions.y = yBase + 28 + 2; - bTest.y = bBuy.y = bOptions.y; - //#endif + bHost->y = yBase; + bJoin->y = bHost->y + 24; + bOptions->y = bJoin->y + 24; + bQuit->y = bOptions->y + 24; + } else { + int yBase = height / 2; + bHost->y = yBase; + bJoin->y = bHost->y + 24 + 4; + bOptions->y = bJoin->y + 24 + 4; + bQuit->y = bOptions->y + 24 + 4; + } // Center buttons - bHost.x = (width - bHost.width) / 2; - bJoin.x = (width - bJoin.width) / 2; - bOptions.x = (width - bJoin.width) / 2; - bTest.x = bBuy.x = bOptions.x + bOptions.width + 4; + bHost->x = (width - bHost->width) / 2; + bJoin->x = (width - bJoin->width) / 2; + bOptions->x = (width - bOptions->width) / 2; + bQuit->x = (width - bQuit->width) / 2; - copyrightPosX = width - minecraft->font->width(copyright) - 1; - versionPosX = (width - minecraft->font->width(version)) / 2;// - minecraft->font->width(version) - 2; + //// position quit icon at top-right (use image-defined size) + //bQuit.x = width - bQuit.width; + //bQuit.y = 0; } void StartMenuScreen::tick() { - _updateLicense(); } void StartMenuScreen::buttonClicked(Button* button) { - if (button->id == bHost.id) + if (button->id == bHost->id) { #if defined(DEMO_MODE) || defined(APPLE_DEMO_PROMOTION) minecraft->setScreen( new SimpleChooseLevelScreen("_DemoLevel") ); @@ -119,24 +145,18 @@ void StartMenuScreen::buttonClicked(Button* button) { minecraft->screenChooser.setScreen(SCREEN_SELECTWORLD); #endif } - if (button->id == bJoin.id) + if (button->id == bJoin->id) { minecraft->locateMultiplayer(); minecraft->screenChooser.setScreen(SCREEN_JOINGAME); } - if (button->id == bOptions.id) + if (button->id == bOptions->id) { minecraft->setScreen(new OptionsScreen()); } - if (button->id == bTest.id) + if (button->id == bQuit->id) { - //minecraft->setScreen(new PauseScreen()); - //minecraft->setScreen(new PrerenderTilesScreen()); - } - if (button->id == bBuy.id) - { - minecraft->platform()->buyGame(); - //minecraft->setScreen(new BuyGameScreen()); + minecraft->quit(); } } @@ -146,6 +166,9 @@ void StartMenuScreen::render( int xm, int ym, float a ) { renderBackground(); + // Show current username in the top-left corner + drawString(font, username, 2, 2, 0xffffffff); + #if defined(RPI) TextureId id = minecraft->textures->loadTexture("gui/pi_title.png"); #else @@ -157,7 +180,7 @@ void StartMenuScreen::render( int xm, int ym, float a ) minecraft->textures->bind(id); const float x = (float)width / 2; - const float y = 4; + const float y = height/16; //const float scale = Mth::Min( const float wh = Mth::Min((float)width/2.0f, (float)data->w / 2); const float scale = 2.0f * wh / (float)data->w; @@ -179,27 +202,35 @@ void StartMenuScreen::render( int xm, int ym, float a ) blit(0, height - 12, 0, 0, 43, 12, 256, 72+72); #endif - drawString(font, version, versionPosX, 62, /*50,*/ 0xffcccccc);//0x666666); - drawString(font, copyright, copyrightPosX, height - 10, 0xffffff); + drawString(font, version, width - font->width(version) - 2, height - 10, 0xffcccccc);//0x666666); + drawString(font, copyright, 2, height - 20, 0xffffff); + glEnable2(GL_BLEND); + glBlendFunc2(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glColor4f2(1, 1, 1, 1); + if (Textures::isTextureIdValid(minecraft->textures->loadAndBindTexture("gui/logo/github.png"))) + blit(2, height - 10, 0, 0, 8, 8, 256, 256); + { + std::string txt = "Kolyah35/minecraft-pe-0.6.1"; + float wtxt = font->width(txt); + Gui::drawColoredString(font, txt, 12, height - 10, 255); + // underline link + float y0 = height - 10 + font->lineHeight - 1; + this->fill(12, (int)y0, 12 + (int)wtxt, (int)(y0 + 1), 0xffffffff); + } + Screen::render(xm, ym, a); } -void StartMenuScreen::_updateLicense() -{ - int id = minecraft->getLicenseId(); - if (LicenseCodes::isReady(id)) - { - if (LicenseCodes::isOk(id)) - bJoin.active = bHost.active = bOptions.active = true; - else - { - bool hasBuyButton = minecraft->platform()->hasBuyButtonWhenInvalidLicense(); - minecraft->setScreen(new InvalidLicenseScreen(id, hasBuyButton)); - } - } else { - bJoin.active = bHost.active = bOptions.active = false; - } +void StartMenuScreen::mouseClicked(int x, int y, int buttonNum) { + const int logoX = 2; + const int logoW = 8 + 2 + font->width("Kolyah35/minecraft-pe-0.6.1"); + const int logoY = height - 10; + const int logoH = 10; + if (x >= logoX && x <= logoX + logoW && y >= logoY && y <= logoY + logoH) + minecraft->platform()->openURL("https://gitea.sffempire.ru/Kolyah35/minecraft-pe-0.6.1"); + else + Screen::mouseClicked(x, y, buttonNum); } bool StartMenuScreen::handleBackEvent( bool isDown ) { diff --git a/src/client/gui/screens/StartMenuScreen.h b/src/client/gui/screens/StartMenuScreen.h index 8d46c58..9ff3c8b 100755 --- a/src/client/gui/screens/StartMenuScreen.h +++ b/src/client/gui/screens/StartMenuScreen.h @@ -3,6 +3,7 @@ #include "../Screen.h" #include "../components/Button.h" +#include "../components/ImageButton.h" class StartMenuScreen: public Screen { @@ -17,22 +18,23 @@ public: void render(int xm, int ym, float a); void buttonClicked(Button* button); + virtual void mouseClicked(int x, int y, int buttonNum); bool handleBackEvent(bool isDown); bool isInGameScreen(); private: - void _updateLicense(); - Button bHost; - Button bJoin; - Button bOptions; - Button bTest; - Button bBuy; + Button* bHost; + Button* bJoin; + Button* bOptions; + Button* bQuit; std::string copyright; int copyrightPosX; std::string version; int versionPosX; + + std::string username; }; #endif /*NET_MINECRAFT_CLIENT_GUI_SCREENS__StartMenuScreen_H__*/ diff --git a/src/client/gui/screens/TextEditScreen.cpp b/src/client/gui/screens/TextEditScreen.cpp index 115db91..1159e67 100755 --- a/src/client/gui/screens/TextEditScreen.cpp +++ b/src/client/gui/screens/TextEditScreen.cpp @@ -132,7 +132,7 @@ void TextEditScreen::keyPressed( int eventKey ) { } } -void TextEditScreen::keyboardNewChar( char inputChar ) { +void TextEditScreen::charPressed( char inputChar ) { std::string fullstring = sign->messages[line] + inputChar; if(fullstring.length() < 16) { sign->messages[line] = fullstring; diff --git a/src/client/gui/screens/TextEditScreen.h b/src/client/gui/screens/TextEditScreen.h index 2ba7c4b..2fea9fc 100755 --- a/src/client/gui/screens/TextEditScreen.h +++ b/src/client/gui/screens/TextEditScreen.h @@ -20,7 +20,7 @@ public: void render(int xm, int ym, float a); virtual void lostFocus(); virtual void keyPressed(int eventKey); - virtual void keyboardNewChar(char inputChar); + virtual void charPressed(char inputChar); void setupPositions(); void buttonClicked(Button* button); protected: diff --git a/src/client/gui/screens/UsernameScreen.cpp b/src/client/gui/screens/UsernameScreen.cpp new file mode 100644 index 0000000..cb05cf6 --- /dev/null +++ b/src/client/gui/screens/UsernameScreen.cpp @@ -0,0 +1,102 @@ +#include "UsernameScreen.h" +#include "StartMenuScreen.h" +#include "../../Minecraft.h" +#include "../Font.h" +#include "../components/Button.h" +#include "../../../platform/input/Keyboard.h" +#include "../../../AppPlatform.h" + +UsernameScreen::UsernameScreen() +: _btnDone(0, "Done"), + tUsername(0, "Username"), + _cursorBlink(0) +{ +} + +UsernameScreen::~UsernameScreen() +{ +} + +void UsernameScreen::init() +{ + _input = ""; + _btnDone.active = false; // disabled until name typed + buttons.push_back(&_btnDone); + tabButtons.push_back(&_btnDone); + textBoxes.push_back(&tUsername); + setupPositions(); +} + +void UsernameScreen::setupPositions() +{ + int cx = width / 2; + int cy = height / 2; + + // Make the done button match the touch-style option tabs + _btnDone.width = 66; + _btnDone.height = 26; + _btnDone.x = cx - (_btnDone.width / 2); + _btnDone.y = cy + 52; + + tUsername.width = 120; + tUsername.height = 20; + tUsername.x = (width - tUsername.width) / 2; + tUsername.y = _btnDone.y - 60; +} + +void UsernameScreen::tick() +{ + for (auto* tb : textBoxes) + tb->tick(minecraft); +} + +void UsernameScreen::keyPressed(int eventKey) +{ + if (eventKey == Keyboard::KEY_RETURN) { + if (!tUsername.text.empty()) + buttonClicked(&_btnDone); + } + + // deliberately do NOT call super::keyPressed — that would close the screen on Escape + Screen::keyPressed(eventKey); + + // enable the Done button only when there is some text (and ensure it updates after backspace) + _btnDone.active = !tUsername.text.empty(); +} + +void UsernameScreen::removed() +{ + minecraft->platform()->hideKeyboard(); +} + +void UsernameScreen::buttonClicked(Button* button) +{ + if (button == &_btnDone && !tUsername.text.empty()) { + minecraft->options.set(OPTIONS_USERNAME, tUsername.text); + minecraft->options.save(); + minecraft->setScreen(NULL); // goes to StartMenuScreen + } +} + +void UsernameScreen::render(int xm, int ym, float a) +{ + // Dark dirt background + renderBackground(); + + int cx = width / 2; + int cy = height / 2; + + // Title + drawCenteredString(font, "Enter your username", cx, cy - 70, 0xffffffff); + + // Subtitle + drawCenteredString(font, "Please choose a username so others can easily", cx, cy - 52, 0xffaaaaaa); + drawCenteredString(font, "identify you in chat. Don't worry, you can", cx, cy - 40, 0xffaaaaaa); + drawCenteredString(font, "change it anytime.", cx, cy - 28, 0xffaaaaaa); + + // // Hint below box + // drawCenteredString(font, "Max 16 characters", cx, cy + 20, 0xff808080); + + // Buttons (Done) + super::render(xm, ym, a); +} diff --git a/src/client/gui/screens/UsernameScreen.h b/src/client/gui/screens/UsernameScreen.h new file mode 100644 index 0000000..592998f --- /dev/null +++ b/src/client/gui/screens/UsernameScreen.h @@ -0,0 +1,38 @@ +#ifndef NET_MINECRAFT_CLIENT_GUI_SCREENS__UsernameScreen_H__ +#define NET_MINECRAFT_CLIENT_GUI_SCREENS__UsernameScreen_H__ + +#include "../Screen.h" +#include "../components/Button.h" +// this is cursed lol +#include "../../../client/gui/components/TextBox.h" +#include + +class UsernameScreen : public Screen +{ + typedef Screen super; +public: + UsernameScreen(); + virtual ~UsernameScreen(); + + void init() override; + virtual void setupPositions() override; + void render(int xm, int ym, float a) override; + void tick() override; + + virtual bool isPauseScreen() override { return false; } + + virtual void keyPressed(int eventKey) override; + virtual bool handleBackEvent(bool isDown) override { return true; } // block back/escape + virtual void removed() override; + +protected: + virtual void buttonClicked(Button* button) override; + +private: + Touch::TButton _btnDone; + TextBox tUsername; + std::string _input; + int _cursorBlink; +}; + +#endif /*NET_MINECRAFT_CLIENT_GUI_SCREENS__UsernameScreen_H__*/ diff --git a/src/client/gui/screens/crafting/PaneCraftingScreen.cpp b/src/client/gui/screens/crafting/PaneCraftingScreen.cpp index 0e39082..6d6e407 100755 --- a/src/client/gui/screens/crafting/PaneCraftingScreen.cpp +++ b/src/client/gui/screens/crafting/PaneCraftingScreen.cpp @@ -16,7 +16,12 @@ #include "../../../../world/level/Level.h" #include "../../../../world/item/DyePowderItem.h" #include "../../../../world/item/crafting/Recipe.h" +#include "network/RakNetInstance.h" +#include "network/packet/WantCreatePacket.h" #include "platform/input/Keyboard.h" +#include +#include +#include static NinePatchLayer* guiPaneFrame = NULL; @@ -41,7 +46,7 @@ public: //fill(x+1, y+1, x+w-1, y+h-1, 0xff999999); bool hovered = active && (minecraft->useTouchscreen()? - (_currentlyDown && xm >= x && ym >= y && xm < x + width && ym < y + height) : false); + (_currentlyDown && xm >= x && ym >= y && xm < x + width && ym < y + height) : isInside(xm, ym)); if (hovered || *selectedPtr == this) statePressed->draw(Tesselator::instance, (float)x, (float)y); @@ -193,6 +198,26 @@ void PaneCraftingScreen::setupPositions() { } void PaneCraftingScreen::tick() { + if (minecraft->isOnline()) { + // TODO: Make better algorithm + static std::map oldMap = {}; + std::map newMap = {}; + + for (int i = Inventory::MAX_SELECTION_SIZE; i < minecraft->player->inventory->getContainerSize(); ++i) { + auto itm = minecraft->player->inventory->getItem(i); + + if (itm != NULL) { + newMap[itm->id] += itm->count; + } + } + + if (oldMap != newMap) { + oldMap = newMap; + newMap = {}; + recheckRecipes(); + } + } + if (pane) pane->tick(); } @@ -439,25 +464,29 @@ void PaneCraftingScreen::craftSelectedItem() ItemInstance resultItem = currentItem->item; if (minecraft->player) { + if (minecraft->isOnline()) { + WantCreatePacket packet(minecraft->player->entityId, resultItem.count, resultItem.getAuxValue(), resultItem.id); + minecraft->raknetInstance->send(packet); + } // Remove all items required for the recipe and ... for (unsigned int i = 0; i < currentItem->neededItems.size(); ++i) { CItem::ReqItem& req = currentItem->neededItems[i]; - // If the recipe allows any aux-value as ingredients, first deplete - // aux == 0 from inventory. Since I'm not sure if this always is - // correct, let's only do it for ingredient sandstone for now. - ItemInstance toRemove = req.item; + // If the recipe allows any aux-value as ingredients, first deplete + // aux == 0 from inventory. Since I'm not sure if this always is + // correct, let's only do it for ingredient sandstone for now. + ItemInstance toRemove = req.item; - if (Tile::sandStone->id == req.item.id - && Recipe::ANY_AUX_VALUE == req.item.getAuxValue()) { - toRemove.setAuxValue(0); - toRemove.count = minecraft->player->inventory->removeResource(toRemove, true); - toRemove.setAuxValue(Recipe::ANY_AUX_VALUE); - } + if (Tile::sandStone->id == req.item.id + && Recipe::ANY_AUX_VALUE == req.item.getAuxValue()) { + toRemove.setAuxValue(0); + toRemove.count = minecraft->player->inventory->removeResource(toRemove, true); + toRemove.setAuxValue(Recipe::ANY_AUX_VALUE); + } - if (toRemove.count > 0) { - minecraft->player->inventory->removeResource(toRemove); - } + if (toRemove.count > 0) { + minecraft->player->inventory->removeResource(toRemove); + } } // ... add the new one! (in this order, to fill empty slots better) // if it doesn't fit, throw it on the ground! @@ -547,7 +576,7 @@ void CraftButton::renderBg(Minecraft* minecraft, int xm, int ym) { //fill(x+1, y+1, x+w-1, y+h-1, 0xff999999); bool hovered = active && (minecraft->useTouchscreen()? - (_currentlyDown && xm >= x && ym >= y && xm < x + width && ym < y + height) : false); + (_currentlyDown && xm >= x && ym >= y && xm < x + width && ym < y + height) : isInside(xm, ym)); if (hovered || selected) bgSelected->draw(Tesselator::instance, (float)x, (float)y); diff --git a/src/client/gui/screens/touch/TouchIngameBlockSelectionScreen.cpp b/src/client/gui/screens/touch/TouchIngameBlockSelectionScreen.cpp index db0b3ef..1749984 100755 --- a/src/client/gui/screens/touch/TouchIngameBlockSelectionScreen.cpp +++ b/src/client/gui/screens/touch/TouchIngameBlockSelectionScreen.cpp @@ -1,268 +1,293 @@ -#include "TouchIngameBlockSelectionScreen.h" -#include "../crafting/WorkbenchScreen.h" -#include "../../Screen.h" -#include "../../components/ImageButton.h" -#include "../../components/InventoryPane.h" -#include "../../../gamemode/GameMode.h" -#include "../../../renderer/TileRenderer.h" -#include "../../../player/LocalPlayer.h" -#include "../../../renderer/gles.h" -#include "../../../renderer/entity/ItemRenderer.h" -#include "../../../renderer/Tesselator.h" -#include "../../../renderer/Textures.h" -#include "../../../Minecraft.h" -#include "../../../sound/SoundEngine.h" -#include "../../../../world/entity/player/Inventory.h" -#include "../../../../platform/input/Mouse.h" -#include "../../../../util/Mth.h" -#include "../../../../world/item/ItemInstance.h" -#include "../../../../world/entity/player/Player.h" -#include "../../../../world/item/crafting/Recipe.h" -#include "../../../player/input/touchscreen/TouchAreaModel.h" -#include "../ArmorScreen.h" - -namespace Touch { - -#if defined(__APPLE__) - static const std::string demoVersionString("Not available in the Lite version"); -#else - static const std::string demoVersionString("Not available in the demo version"); -#endif - -#ifdef __APPLE__ - static const float BorderPixels = 4; - #ifdef DEMO_MODE - static const float BlockPixels = 22; - #else - static const float BlockPixels = 22; - #endif -#else - static const float BorderPixels = 4; - static const float BlockPixels = 24; -#endif - -static const int ItemSize = (int)(BlockPixels + 2*BorderPixels); - -static const int Bx = 10; // Border Frame width -static const int By = 6; // Border Frame height - -// -// Block selection screen -// -IngameBlockSelectionScreen::IngameBlockSelectionScreen() -: selectedItem(0), - _blockList(NULL), - _pendingClose(false), - bArmor (4, "Armor"), - bDone (3, ""), - //bDone (3, "Done"), - bMenu (2, "Menu"), - bCraft (1, "Craft"), - bHeader (0, "Select blocks") -{ -} - -IngameBlockSelectionScreen::~IngameBlockSelectionScreen() -{ - delete _blockList; -} - -void IngameBlockSelectionScreen::init() -{ - Inventory* inventory = minecraft->player->inventory; - - //const int itemWidth = 2 * BorderPixels + - - int maxWidth = width - Bx - Bx; - InventoryColumns = maxWidth / ItemSize; - const int realWidth = InventoryColumns * ItemSize; - const int realBx = (width - realWidth) / 2; - - IntRectangle rect(realBx, -#ifdef __APPLE__ - 24 + By - ((width==240)?1:0), realWidth, ((width==240)?1:0) + height-By-By-20-24); -#else - 24 + By, realWidth, height-By-By-20-24); -#endif - - _blockList = new InventoryPane(this, minecraft, rect, width, BorderPixels, inventory->getContainerSize() - Inventory::MAX_SELECTION_SIZE, ItemSize, (int)BorderPixels); - _blockList->fillMarginX = realBx; - - //for (int i = 0; i < inventory->getContainerSize(); ++i) - //LOGI("> %d - %s\n", i, inventory->getItem(i)? inventory->getItem(i)->getDescriptionId().c_str() : "<-->\n"); - - InventorySize = inventory->getContainerSize(); - InventoryRows = 1 + (InventorySize-1) / InventoryColumns; - - // - // Buttons - // - ImageDef def; - def.name = "gui/spritesheet.png"; - def.x = 0; - def.y = 1; - def.width = def.height = 18; - def.setSrc(IntRectangle(60, 0, 18, 18)); - bDone.setImageDef(def, true); - bDone.width = bDone.height = 19; - - bDone.scaleWhenPressed = false; - - buttons.push_back(&bHeader); - buttons.push_back(&bDone); - if (!minecraft->isCreativeMode()) { - buttons.push_back(&bCraft); - buttons.push_back(&bArmor); - } -} - -void IngameBlockSelectionScreen::setupPositions() { - bHeader.y = bDone.y = bCraft.y = 0; - bDone.x = width - bDone.width; - bCraft.x = 0;//width - bDone.w - bCraft.w; - bCraft.width = bArmor.width = 48; - bArmor.x = bCraft.width; - - if (minecraft->isCreativeMode()) { - bHeader.x = 0; - bHeader.width = width;// - bDone.w; - bHeader.xText = width/2; // Center of the screen - } else { - bHeader.x = bCraft.width + bArmor.width; - bHeader.width = width - bCraft.width - bArmor.width;// - bDone.w; - bHeader.xText = bHeader.x + (bHeader.width - bDone.width) /2; - } - - clippingArea.x = 0; - clippingArea.w = minecraft->width; - clippingArea.y = 0; - clippingArea.h = (int)(Gui::GuiScale * 24); -} - -void IngameBlockSelectionScreen::removed() -{ - minecraft->gui.inventoryUpdated(); -} - -int IngameBlockSelectionScreen::getSlotPosX(int slotX) { - // @todo: Number of columns - return width / 2 - InventoryColumns * 10 + slotX * 20 + 2; -} - -int IngameBlockSelectionScreen::getSlotPosY(int slotY) { - return height - 16 - 3 - 22 * 2 - 22 * slotY; -} - -void IngameBlockSelectionScreen::mouseClicked(int x, int y, int buttonNum) { - _pendingClose = _blockList->_clickArea->isInside((float)x, (float)y); - if (!_pendingClose) - super::mouseClicked(x, y, buttonNum); -} - -void IngameBlockSelectionScreen::mouseReleased(int x, int y, int buttonNum) { - if (_pendingClose && _blockList->_clickArea->isInside((float)x, (float)y)) - minecraft->setScreen(NULL); - else - super::mouseReleased(x, y, buttonNum); -} - -bool IngameBlockSelectionScreen::addItem(const InventoryPane* pane, int itemId) -{ - Inventory* inventory = minecraft->player->inventory; - itemId += Inventory::MAX_SELECTION_SIZE; - - if (!inventory->getItem(itemId)) - return false; - - inventory->moveToSelectionSlot(0, itemId, true); - - inventory->selectSlot(0); -#ifdef __APPLE__ - minecraft->soundEngine->playUI("random.pop", 0.3f, 0.3f);//1.0f + 0.2f*(Mth::random()-Mth::random())); -#else - minecraft->soundEngine->playUI("random.pop2", 1.0f, 0.3f);//1.0f + 0.2f*(Mth::random()-Mth::random())); -#endif - - // Flash the selected gui item - minecraft->gui.flashSlot(inventory->selected); - return true; -} - -void IngameBlockSelectionScreen::tick() -{ - _blockList->tick(); - super::tick(); -} - -void IngameBlockSelectionScreen::render( int xm, int ym, float a ) -{ - glDisable2(GL_DEPTH_TEST); - glEnable2(GL_BLEND); - - Screen::render(xm, ym, a); - _blockList->render(xm, ym, a); - - // render frame - IntRectangle& bbox = _blockList->rect; - Tesselator::instance.colorABGR(0xffffffff); - minecraft->textures->loadAndBindTexture("gui/itemframe.png"); - glEnable2(GL_BLEND); - glColor4f2(1, 1, 1, 1); - glBlendFunc2(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - blit(0, bbox.y-By, 0, 0, width, bbox.h+By+By, 215, 256); // why bbox.h + 1*B? - glDisable2(GL_BLEND); - - glEnable2(GL_DEPTH_TEST); -} - -void IngameBlockSelectionScreen::renderDemoOverlay() { -#ifdef DEMO_MODE - fill( getSlotPosX(0) - 3, getSlotPosY(1) - 3, - getSlotPosX(9) - 3, getSlotPosY(-1) - 3, 0xa0 << 24); - - const int centerX = (getSlotPosX(4) + getSlotPosX(5)) / 2; - const int centerY = (getSlotPosY(0) + getSlotPosY(1)) / 2 + 5; - drawCenteredString(minecraft->font, demoVersionString, centerX, centerY, 0xffffffff); -#endif /*DEMO_MODE*/ -} - -void IngameBlockSelectionScreen::buttonClicked(Button* button) { - if (button->id == bDone.id) - minecraft->setScreen(NULL); - - if (button->id == bMenu.id) - minecraft->screenChooser.setScreen(SCREEN_PAUSE); - - if (button->id == bCraft.id) - minecraft->setScreen(new WorkbenchScreen(Recipe::SIZE_2X2)); - - if (button == &bArmor) - minecraft->setScreen(new ArmorScreen()); -} - -bool IngameBlockSelectionScreen::isAllowed( int slot ) -{ - if (slot < 0 || slot >= minecraft->player->inventory->getContainerSize()) - return false; - -#ifdef DEMO_MODE - if (slot >= (minecraft->isCreativeMode()? 28 : 27)) return false; -#endif - return true; -} - -bool IngameBlockSelectionScreen::hasClippingArea( IntRectangle& out ) -{ - out = clippingArea; - return true; -} - -std::vector IngameBlockSelectionScreen::getItems( const InventoryPane* forPane ) -{ - std::vector out; - for (int i = Inventory::MAX_SELECTION_SIZE; i < minecraft->player->inventory->getContainerSize(); ++i) - out.push_back(minecraft->player->inventory->getItem(i)); - return out; -} - -} +#include "TouchIngameBlockSelectionScreen.h" +#include "../crafting/WorkbenchScreen.h" +#include "../../Screen.h" +#include "../../components/ImageButton.h" +#include "../../components/InventoryPane.h" +#include "../../../gamemode/GameMode.h" +#include "../../../renderer/TileRenderer.h" +#include "../../../player/LocalPlayer.h" +#include "../../../renderer/gles.h" +#include "../../../renderer/entity/ItemRenderer.h" +#include "../../../renderer/Tesselator.h" +#include "../../../renderer/Textures.h" +#include "../../../Minecraft.h" +#include "../../../sound/SoundEngine.h" +#include "../../../../world/entity/player/Inventory.h" +#include "../../../../platform/input/Mouse.h" +#include "../../../../util/Mth.h" +#include "../../../../world/item/ItemInstance.h" +#include "../../../../world/entity/player/Player.h" +#include "../../../../world/item/crafting/Recipe.h" +#include "../../../player/input/touchscreen/TouchAreaModel.h" +#include "../ArmorScreen.h" + +namespace Touch { + +#if defined(__APPLE__) + static const std::string demoVersionString("Not available in the Lite version"); +#else + static const std::string demoVersionString("Not available in the demo version"); +#endif + +#ifdef __APPLE__ + static const float BorderPixels = 4; + #ifdef DEMO_MODE + static const float BlockPixels = 22; + #else + static const float BlockPixels = 22; + #endif +#else + static const float BorderPixels = 4; + static const float BlockPixels = 24; +#endif + +static const int ItemSize = (int)(BlockPixels + 2*BorderPixels); + +static const int Bx = 10; // Border Frame width +static const int By = 6; // Border Frame height + +// +// Block selection screen +// +IngameBlockSelectionScreen::IngameBlockSelectionScreen() +: selectedItem(0), + _blockList(NULL), + _pendingClose(false), + bArmor (4, "Armor"), + bDone (3, ""), + //bDone (3, "Done"), + bMenu (2, "Menu"), + bCraft (1, "Craft"), + bHeader (0, "Select blocks") +{ +} + +IngameBlockSelectionScreen::~IngameBlockSelectionScreen() +{ + delete _blockList; +} + +void IngameBlockSelectionScreen::init() +{ + Inventory* inventory = minecraft->player->inventory; + + //const int itemWidth = 2 * BorderPixels + + + int maxWidth = width - Bx - Bx; + InventoryColumns = maxWidth / ItemSize; + const int realWidth = InventoryColumns * ItemSize; + const int realBx = (width - realWidth) / 2; + + IntRectangle rect(realBx, +#ifdef __APPLE__ + 24 + By - ((width==240)?1:0), realWidth, ((width==240)?1:0) + height-By-By-20-24); +#else + 24 + By, realWidth, height-By-By-20-24); +#endif + + _blockList = new InventoryPane(this, minecraft, rect, width, BorderPixels, inventory->getContainerSize() - Inventory::MAX_SELECTION_SIZE, ItemSize, (int)BorderPixels); + _blockList->fillMarginX = realBx; + + //for (int i = 0; i < inventory->getContainerSize(); ++i) + //LOGI("> %d - %s\n", i, inventory->getItem(i)? inventory->getItem(i)->getDescriptionId().c_str() : "<-->\n"); + + // Grid indices are 0..N-1 for main inventory only; slots 0..MAX_SELECTION_SIZE-1 are hotbar links. + InventorySize = inventory->getContainerSize() - Inventory::MAX_SELECTION_SIZE; + InventoryRows = 1 + (InventorySize-1) / InventoryColumns; + + // + // Buttons + // + ImageDef def; + def.name = "gui/spritesheet.png"; + def.x = 0; + def.y = 1; + def.width = def.height = 18; + def.setSrc(IntRectangle(60, 0, 18, 18)); + bDone.setImageDef(def, true); + bDone.width = bDone.height = 19; + + bDone.scaleWhenPressed = false; + + buttons.push_back(&bHeader); + buttons.push_back(&bDone); + if (!minecraft->isCreativeMode()) { + buttons.push_back(&bCraft); + buttons.push_back(&bArmor); + } +} + +void IngameBlockSelectionScreen::setupPositions() { + bHeader.y = bDone.y = bCraft.y = 0; + bDone.x = width - bDone.width; + bCraft.x = 0;//width - bDone.w - bCraft.w; + bCraft.width = bArmor.width = 48; + bArmor.x = bCraft.width; + + if (minecraft->isCreativeMode()) { + bHeader.x = 0; + bHeader.width = width;// - bDone.w; + bHeader.xText = width/2; // Center of the screen + } else { + bHeader.x = bCraft.width + bArmor.width; + bHeader.width = width - bCraft.width - bArmor.width;// - bDone.w; + bHeader.xText = bHeader.x + (bHeader.width - bDone.width) /2; + } + + clippingArea.x = 0; + clippingArea.w = minecraft->width; + clippingArea.y = 0; + clippingArea.h = (int)(Gui::GuiScale * 24); +} + +void IngameBlockSelectionScreen::removed() +{ + minecraft->gui.inventoryUpdated(); +} + +int IngameBlockSelectionScreen::getSlotPosX(int slotX) { + // @todo: Number of columns + return width / 2 - InventoryColumns * 10 + slotX * 20 + 2; +} + +int IngameBlockSelectionScreen::getSlotPosY(int slotY) { + return height - 16 - 3 - 22 * 2 - 22 * slotY; +} + +int IngameBlockSelectionScreen::getSlotHeight() { + // same as non-touch implementation + return 22; +} + +void IngameBlockSelectionScreen::mouseClicked(int x, int y, int buttonNum) { + _pendingClose = _blockList->_clickArea->isInside((float)x, (float)y); + if (!_pendingClose) + super::mouseClicked(x, y, buttonNum); +} + +void IngameBlockSelectionScreen::mouseReleased(int x, int y, int buttonNum) { + if (_pendingClose && _blockList->_clickArea->isInside((float)x, (float)y)) + minecraft->setScreen(NULL); + else + super::mouseReleased(x, y, buttonNum); +} + +void IngameBlockSelectionScreen::mouseWheel(int dx, int dy, int xm, int ym) +{ + if (dy == 0) return; + if (_blockList) { + float amount = -dy * getSlotHeight(); + _blockList->scrollBy(0, amount); + } + int cols = InventoryColumns; + int maxIndex = InventorySize - 1; + int idx = selectedItem; + if (dy > 0) { + if (idx >= cols) idx -= cols; + } else { + if (idx + cols <= maxIndex) idx += cols; + } + selectedItem = idx; +} + +bool IngameBlockSelectionScreen::addItem(const InventoryPane* pane, int itemId) +{ + Inventory* inventory = minecraft->player->inventory; + itemId += Inventory::MAX_SELECTION_SIZE; + + if (!inventory->getItem(itemId)) + return false; + + inventory->moveToSelectionSlot(0, itemId, true); + + inventory->selectSlot(0); +#ifdef __APPLE__ + minecraft->soundEngine->playUI("random.pop", 0.3f, 0.3f);//1.0f + 0.2f*(Mth::random()-Mth::random())); +#else + minecraft->soundEngine->playUI("random.pop2", 1.0f, 0.3f);//1.0f + 0.2f*(Mth::random()-Mth::random())); +#endif + + // Flash the selected gui item + minecraft->gui.flashSlot(inventory->selected); + return true; +} + +void IngameBlockSelectionScreen::tick() +{ + _blockList->tick(); + super::tick(); +} + +void IngameBlockSelectionScreen::render( int xm, int ym, float a ) +{ + glDisable2(GL_DEPTH_TEST); + glEnable2(GL_BLEND); + + Screen::render(xm, ym, a); + _blockList->render(xm, ym, a); + + // render frame + IntRectangle& bbox = _blockList->rect; + Tesselator::instance.colorABGR(0xffffffff); + minecraft->textures->loadAndBindTexture("gui/itemframe.png"); + glEnable2(GL_BLEND); + glColor4f2(1, 1, 1, 1); + glBlendFunc2(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + blit(0, bbox.y-By, 0, 0, width, bbox.h+By+By, 215, 256); // why bbox.h + 1*B? + glDisable2(GL_BLEND); + + glEnable2(GL_DEPTH_TEST); +} + +void IngameBlockSelectionScreen::renderDemoOverlay() { +#ifdef DEMO_MODE + fill( getSlotPosX(0) - 3, getSlotPosY(1) - 3, + getSlotPosX(9) - 3, getSlotPosY(-1) - 3, 0xa0 << 24); + + const int centerX = (getSlotPosX(4) + getSlotPosX(5)) / 2; + const int centerY = (getSlotPosY(0) + getSlotPosY(1)) / 2 + 5; + drawCenteredString(minecraft->font, demoVersionString, centerX, centerY, 0xffffffff); +#endif /*DEMO_MODE*/ +} + +void IngameBlockSelectionScreen::buttonClicked(Button* button) { + if (button->id == bDone.id) + minecraft->setScreen(NULL); + + if (button->id == bMenu.id) + minecraft->screenChooser.setScreen(SCREEN_PAUSE); + + if (button->id == bCraft.id) + minecraft->setScreen(new WorkbenchScreen(Recipe::SIZE_2X2)); + + if (button == &bArmor) + minecraft->setScreen(new ArmorScreen()); +} + +bool IngameBlockSelectionScreen::isAllowed( int slot ) +{ + const int gridCount = minecraft->player->inventory->getContainerSize() - Inventory::MAX_SELECTION_SIZE; + if (slot < 0 || slot >= gridCount) + return false; + +#ifdef DEMO_MODE + if (slot >= (minecraft->isCreativeMode()? 28 : 27)) return false; +#endif + return true; +} + +bool IngameBlockSelectionScreen::hasClippingArea( IntRectangle& out ) +{ + out = clippingArea; + return true; +} + +std::vector IngameBlockSelectionScreen::getItems( const InventoryPane* forPane ) +{ + std::vector out; + for (int i = Inventory::MAX_SELECTION_SIZE; i < minecraft->player->inventory->getContainerSize(); ++i) + out.push_back(minecraft->player->inventory->getItem(i)); + return out; +} + +} diff --git a/src/client/gui/screens/touch/TouchIngameBlockSelectionScreen.h b/src/client/gui/screens/touch/TouchIngameBlockSelectionScreen.h index 1bfa25b..ee8cbb1 100755 --- a/src/client/gui/screens/touch/TouchIngameBlockSelectionScreen.h +++ b/src/client/gui/screens/touch/TouchIngameBlockSelectionScreen.h @@ -21,30 +21,34 @@ public: IngameBlockSelectionScreen(); virtual ~IngameBlockSelectionScreen(); - virtual void init(); - virtual void setupPositions(); - virtual void removed(); + virtual void init() override; + virtual void setupPositions() override; + virtual void removed() override; - void tick(); - void render(int xm, int ym, float a); + void tick() override; + void render(int xm, int ym, float a) override; - bool hasClippingArea(IntRectangle& out); + bool hasClippingArea(IntRectangle& out) override; // IInventoryPaneCallback - bool addItem(const InventoryPane* pane, int itemId); - bool isAllowed(int slot); - std::vector getItems(const InventoryPane* forPane); + bool addItem(const InventoryPane* pane, int itemId) override; + bool isAllowed(int slot) override; + std::vector getItems(const InventoryPane* forPane) override; - void buttonClicked(Button* button); + void buttonClicked(Button* button) override; protected: - virtual void mouseClicked(int x, int y, int buttonNum); - virtual void mouseReleased(int x, int y, int buttonNum); + virtual void mouseClicked(int x, int y, int buttonNum) override; + virtual void mouseReleased(int x, int y, int buttonNum) override; + + // also support wheel scrolling + virtual void mouseWheel(int dx, int dy, int xm, int ym) override; private: void renderDemoOverlay(); //int getLinearSlotId(int x, int y); int getSlotPosX(int slotX); int getSlotPosY(int slotY); + int getSlotHeight(); private: int selectedItem; diff --git a/src/client/gui/screens/touch/TouchJoinGameScreen.cpp b/src/client/gui/screens/touch/TouchJoinGameScreen.cpp index 8c8a955..f8ad00a 100755 --- a/src/client/gui/screens/touch/TouchJoinGameScreen.cpp +++ b/src/client/gui/screens/touch/TouchJoinGameScreen.cpp @@ -64,6 +64,7 @@ void AvailableGamesList::renderItem( int i, int x, int y, int h, Tesselator& t ) JoinGameScreen::JoinGameScreen() : bJoin( 2, "Join Game"), bBack( 3, "Back"), + bJoinByIp(4, "Join By IP"), bHeader(0, ""), gamesList(NULL) { @@ -80,6 +81,7 @@ void JoinGameScreen::init() { //buttons.push_back(&bJoin); buttons.push_back(&bBack); + buttons.push_back(&bJoinByIp); buttons.push_back(&bHeader); minecraft->raknetInstance->clearServerList(); @@ -88,6 +90,7 @@ void JoinGameScreen::init() #ifdef ANDROID //tabButtons.push_back(&bJoin); tabButtons.push_back(&bBack); + tabButtons.push_back(&bJoinByIp); #endif } @@ -95,16 +98,18 @@ void JoinGameScreen::setupPositions() { //int yBase = height - 26; //#ifdef ANDROID - bJoin.y = 0; - bBack.y = 0; - bHeader.y = 0; + bJoin.y = 0; + bBack.y = 0; + bJoinByIp.y = 0; + bHeader.y = 0; //#endif // Center buttons //bJoin.x = width / 2 - 4 - bJoin.w; bBack.x = 0;//width / 2 + 4; - bHeader.x = bBack.width; - bHeader.width = width - bHeader.x; + bJoinByIp.x = width - bJoinByIp.width;; + bHeader.x = bJoinByIp.width; + bHeader.width = width - (bBack.width + bJoinByIp.width); } void JoinGameScreen::buttonClicked(Button* button) @@ -124,6 +129,11 @@ void JoinGameScreen::buttonClicked(Button* button) //minecraft->locateMultiplayer(); //minecraft->setScreen(new JoinGameScreen()); } + if(button->id == bJoinByIp.id) { + minecraft->cancelLocateMultiplayer(); + minecraft->screenChooser.setScreen(SCREEN_JOINBYIP); + } + if (button->id == bBack.id) { minecraft->cancelLocateMultiplayer(); diff --git a/src/client/gui/screens/touch/TouchJoinGameScreen.h b/src/client/gui/screens/touch/TouchJoinGameScreen.h index fa0debb..2205bf6 100755 --- a/src/client/gui/screens/touch/TouchJoinGameScreen.h +++ b/src/client/gui/screens/touch/TouchJoinGameScreen.h @@ -3,7 +3,6 @@ #include "../../Screen.h" #include "../../components/Button.h" -#include "../../components/SmallButton.h" #include "../../components/RolledSelectionListV.h" #include "../../../Minecraft.h" #include "../../../../platform/input/Multitouch.h" @@ -65,6 +64,7 @@ public: private: Button bJoin; TButton bBack; + TButton bJoinByIp; THeader bHeader; AvailableGamesList* gamesList; }; diff --git a/src/client/gui/screens/touch/TouchSelectWorldScreen.cpp b/src/client/gui/screens/touch/TouchSelectWorldScreen.cpp index 4ebf5fd..0ed793d 100755 --- a/src/client/gui/screens/touch/TouchSelectWorldScreen.cpp +++ b/src/client/gui/screens/touch/TouchSelectWorldScreen.cpp @@ -283,8 +283,7 @@ SelectWorldScreen::SelectWorldScreen() bHeader (0, "Select world"), bWorldView(4, ""), worldsList(NULL), - _hasStartedLevel(false), - _state(_STATE_DEFAULT) + _hasStartedLevel(false) { bDelete.active = false; @@ -349,9 +348,9 @@ void SelectWorldScreen::setupPositions() { void SelectWorldScreen::buttonClicked(Button* button) { if (button->id == bCreate.id) { - if (_state == _STATE_DEFAULT && !_hasStartedLevel) { - minecraft->platform()->createUserInput(DialogDefinitions::DIALOG_CREATE_NEW_WORLD); - _state = _STATE_CREATEWORLD; + if (!_hasStartedLevel) { + std::string name = getUniqueLevelName("World"); + minecraft->setScreen(new SimpleChooseLevelScreen(name)); } } if (button->id == bDelete.id) { @@ -390,11 +389,32 @@ static char ILLEGAL_FILE_CHARACTERS[] = { '/', '\n', '\r', '\t', '\0', '\f', '`', '?', '*', '\\', '<', '>', '|', '\"', ':' }; +void SelectWorldScreen::mouseWheel(int dx, int dy, int xm, int ym) +{ + if (!worldsList) return; + if (dy == 0) return; + int num = worldsList->getNumberOfItems(); + int idx = worldsList->selectedItem; + if (dy > 0) { + if (idx > 0) { + idx--; + worldsList->stepLeft(); + } + } else { + if (idx < num - 1) { + idx++; + worldsList->stepRight(); + } + } + worldsList->selectedItem = idx; +} + void SelectWorldScreen::tick() { +#if 0 if (_state == _STATE_CREATEWORLD) { #if defined(RPI) - std::string levelId = getUniqueLevelName("perf"); + std::string levelId = getUniqueLevelName("World"); //int seed = Util::hashCode("/r/Minecraft"); LevelSettings settings(getEpochTimeS(), GameType::Creative); minecraft->selectLevel(levelId, levelId, settings); @@ -402,7 +422,7 @@ void SelectWorldScreen::tick() minecraft->setScreen(new ProgressScreen()); _hasStartedLevel = true; #elif defined(PLATFORM_DESKTOP) - std::string name = getUniqueLevelName("perf"); + std::string name = getUniqueLevelName("World"); minecraft->setScreen(new SimpleChooseLevelScreen(name)); #else int status = minecraft->platform()->getUserInputStatus(); @@ -461,14 +481,15 @@ void SelectWorldScreen::tick() worldsList->hasPickedLevel = false; return; } +#endif worldsList->tick(); if (worldsList->hasPickedLevel) { if (worldsList->pickedIndex == worldsList->levels.size()) { worldsList->hasPickedLevel = false; - minecraft->platform()->createUserInput(DialogDefinitions::DIALOG_CREATE_NEW_WORLD); - _state = _STATE_CREATEWORLD; + std::string name = getUniqueLevelName("World"); + minecraft->setScreen(new SimpleChooseLevelScreen(name)); } else { minecraft->selectLevel(worldsList->pickedLevel.id, worldsList->pickedLevel.name, LevelSettings::None()); minecraft->hostMultiplayer(); @@ -551,9 +572,9 @@ bool SelectWorldScreen::isInGameScreen() { return true; } void SelectWorldScreen::keyPressed( int eventKey ) { if (bWorldView.selected) { - if (eventKey == minecraft->options.keyLeft.key) + if (eventKey == minecraft->options.getIntValue(OPTIONS_KEY_LEFT)) worldsList->stepLeft(); - if (eventKey == minecraft->options.keyRight.key) + if (eventKey == minecraft->options.getIntValue(OPTIONS_KEY_RIGHT)) worldsList->stepRight(); } diff --git a/src/client/gui/screens/touch/TouchSelectWorldScreen.h b/src/client/gui/screens/touch/TouchSelectWorldScreen.h index b187f2f..525116b 100755 --- a/src/client/gui/screens/touch/TouchSelectWorldScreen.h +++ b/src/client/gui/screens/touch/TouchSelectWorldScreen.h @@ -86,18 +86,21 @@ public: SelectWorldScreen(); virtual ~SelectWorldScreen(); - virtual void init(); - virtual void setupPositions(); + virtual void init() override; + virtual void setupPositions() override; - virtual void tick(); - virtual void render(int xm, int ym, float a); + virtual void tick() override; + virtual void render(int xm, int ym, float a) override; virtual bool isIndexValid(int index); - virtual bool handleBackEvent(bool isDown); - virtual void buttonClicked(Button* button); - virtual void keyPressed(int eventKey); + virtual bool handleBackEvent(bool isDown) override; + virtual void buttonClicked(Button* button) override; + virtual void keyPressed(int eventKey) override; - bool isInGameScreen(); + // support for mouse wheel when desktop code uses touch variant + virtual void mouseWheel(int dx, int dy, int xm, int ym) override; + + bool isInGameScreen() override; private: void loadLevelSource(); std::string getUniqueLevelName(const std::string& level); @@ -112,9 +115,6 @@ private: bool _mouseHasBeenUp; bool _hasStartedLevel; - int _state; - static const int _STATE_DEFAULT = 0; - static const int _STATE_CREATEWORLD = 1; //LevelStorageSource* levels; }; }; diff --git a/src/client/gui/screens/touch/TouchStartMenuScreen.cpp b/src/client/gui/screens/touch/TouchStartMenuScreen.cpp index 9adad35..c80300e 100755 --- a/src/client/gui/screens/touch/TouchStartMenuScreen.cpp +++ b/src/client/gui/screens/touch/TouchStartMenuScreen.cpp @@ -2,11 +2,8 @@ #include "../ProgressScreen.h" #include "../OptionsScreen.h" #include "../PauseScreen.h" -#include "../InvalidLicenseScreen.h" -//#include "BuyGameScreen.h" #include "../../Font.h" -#include "../../components/SmallButton.h" #include "../../components/ScrolledSelectionList.h" #include "../../components/GuiElement.h" @@ -22,62 +19,6 @@ #include "../DialogDefinitions.h" #include "../SimpleChooseLevelScreen.h" -// -// Buy Button implementation -// -BuyButton::BuyButton(int id) -: super(id, "") -{ - ImageDef def; - // Setup the source rectangle - def.setSrc(IntRectangle(64, 182, 190, 55)); - def.width = 75;//rc.w / 3; - def.height = 75 * (55.0f / 190.0f);//rc.h / 3; - def.name = "gui/gui.png"; - - setImageDef(def, true); -} - -void BuyButton::render(Minecraft* minecraft, int xm, int ym) { - glColor4f2(1, 1, 1, 1); - bool hovered = active && (minecraft->useTouchscreen()? (xm >= x && ym >= y && xm < x + width && ym < y + height) : false); - renderBg(minecraft, xm, ym); - TextureId texId = (_imageDef.name.length() > 0)? minecraft->textures->loadAndBindTexture(_imageDef.name) : Textures::InvalidId; - if ( Textures::isTextureIdValid(texId) ) { - const ImageDef& d = _imageDef; - Tesselator& t = Tesselator::instance; - - t.begin(); - if (!active) t.color(0xff808080); - else if (hovered||selected) t.color(0xffcccccc); - //else t.color(0xffe0e0e0); - else t.color(0xffffffff); - - float hx = ((float) d.width) * 0.5f; - float hy = ((float) d.height) * 0.5f; - const float cx = ((float)x+d.x) + hx; - const float cy = ((float)y+d.y) + hy; - if (hovered) { - hx *= 0.95f; - hy *= 0.95f; - } - - const TextureData* td = minecraft->textures->getTemporaryTextureData(texId); - const IntRectangle* src = _imageDef.getSrc(); - if (td != NULL && src != NULL) { - float u0 = (src->x) / (float)td->w; - float u1 = (src->x+src->w) / (float)td->w; - float v0 = (src->y) / (float)td->h; - float v1 = (src->y+src->h) / (float)td->h; - t.vertexUV(cx-hx, cy-hy, blitOffset, u0, v0); - t.vertexUV(cx-hx, cy+hy, blitOffset, u0, v1); - t.vertexUV(cx+hx, cy+hy, blitOffset, u1, v1); - t.vertexUV(cx+hx, cy-hy, blitOffset, u1, v0); - } - t.draw(); - } -} - namespace Touch { // @@ -89,8 +30,7 @@ StartMenuScreen::StartMenuScreen() : bHost( 2, "Start Game"), bJoin( 3, "Join Game"), bOptions( 4, "Options"), - bBuy( 5), - bTest( 9, "Create") + bQuit( 5, "") { ImageDef def; bJoin.width = 75; @@ -118,8 +58,18 @@ void StartMenuScreen::init() buttons.push_back(&bHost); buttons.push_back(&bJoin); buttons.push_back(&bOptions); - - //buttons.push_back(&bTest); + + // add quit icon (same look as options header) + { + ImageDef def; + def.name = "gui/touchgui.png"; + def.width = 34; + def.height = 26; + def.setSrc(IntRectangle(150, 0, (int)def.width, (int)def.height)); + bQuit.setImageDef(def, true); + bQuit.scaleWhenPressed = false; + buttons.push_back(&bQuit); + } tabButtons.push_back(&bHost); tabButtons.push_back(&bJoin); @@ -132,11 +82,13 @@ void StartMenuScreen::init() copyright = "\xffMojang AB";//. Do not distribute!"; - #ifdef PRE_ANDROID23 - std::string versionString = Common::getGameVersionString("j"); - #else - std::string versionString = Common::getGameVersionString(); - #endif + // always show base version string + std::string versionString = Common::getGameVersionString(); + + std::string _username = minecraft->options.getStringValue(OPTIONS_USERNAME); + if (_username.empty()) _username = "unknown"; + + username = "Username: " + _username; #ifdef DEMO_MODE #ifdef __APPLE__ @@ -152,7 +104,7 @@ void StartMenuScreen::init() version = versionString + " (Demo)"; #endif - bJoin.active = bHost.active = bOptions.active = false; + bJoin.active = bHost.active = bOptions.active = true; } void StartMenuScreen::setupPositions() { @@ -166,37 +118,21 @@ void StartMenuScreen::setupPositions() { bOptions.y = yBase; //#endif - //bTest.x = 0; //width - bTest.w; - //bTest.y = height - bTest.h; - // Center buttons bJoin.x = 0*buttonWidth + (int)(1*spacing); bHost.x = 1*buttonWidth + (int)(2*spacing); bOptions.x = 2*buttonWidth + (int)(3*spacing); - //bBuy.y = bOptions.y - bBuy.h - 6; - //bBuy.x = bOptions.x + bOptions.w - bBuy.w; - - bBuy.y = height - bBuy.height - 3; - bBuy.x = (width - bBuy.width) / 2; - bTest.x = 4; - bTest.y = height - bTest.height - 4; + // quit icon top-right (use size assigned in init) + bQuit.x = width - bQuit.width; + bQuit.y = 0; copyrightPosX = width - minecraft->font->width(copyright) - 1; versionPosX = (width - minecraft->font->width(version)) / 2;// - minecraft->font->width(version) - 2; } -void StartMenuScreen::tick() { - _updateLicense(); -} - void StartMenuScreen::buttonClicked(::Button* button) { - //if (button->id == bTest.id) { - // minecraft->selectLevel("Broken", "Broken", 1317199248); - // minecraft->hostMultiplayer(); - // minecraft->setScreen(new ProgressScreen()); - //} if (button->id == bHost.id) { #if defined(DEMO_MODE) || defined(APPLE_DEMO_PROMOTION) @@ -218,10 +154,9 @@ void StartMenuScreen::buttonClicked(::Button* button) { { minecraft->setScreen(new OptionsScreen()); } - if (button->id == bBuy.id) + if (button == &bQuit) { - minecraft->platform()->buyGame(); - //minecraft->setScreen(new BuyGameScreen()); + minecraft->quit(); } } @@ -230,6 +165,9 @@ bool StartMenuScreen::isInGameScreen() { return false; } void StartMenuScreen::render( int xm, int ym, float a ) { renderBackground(); + + // Show current username in the top-left corner + drawString(font, username, 2, 2, 0xffffffff); glEnable2(GL_BLEND); @@ -261,27 +199,26 @@ void StartMenuScreen::render( int xm, int ym, float a ) drawString(font, version, versionPosX, (int)(y+h)+2, /*50,*/ 0xffcccccc);//0x666666); drawString(font, copyright, copyrightPosX, height - 10, 0xffffff); + glColor4f2(1, 1, 1, 1); + if (Textures::isTextureIdValid(minecraft->textures->loadAndBindTexture("gui/logo/github.png"))) + blit(2, height - 10, 0, 0, 8, 8, 256, 256); + drawString(font, "Kolyah35/minecraft-pe-0.6.1", 12, height - 10, 0xffcccccc); //patch->draw(t, 0, 20); } Screen::render(xm, ym, a); glDisable2(GL_BLEND); } -void StartMenuScreen::_updateLicense() -{ - int id = minecraft->getLicenseId(); - if (LicenseCodes::isReady(id)) - { - if (LicenseCodes::isOk(id)) - bJoin.active = bHost.active = bOptions.active = true; - else - { - bool hasBuyButton = minecraft->platform()->hasBuyButtonWhenInvalidLicense(); - minecraft->setScreen(new InvalidLicenseScreen(id, hasBuyButton)); - } - } else { - bJoin.active = bHost.active = bOptions.active = false; - } + +void StartMenuScreen::mouseClicked(int x, int y, int buttonNum) { + const int logoX = 2; + const int logoW = 8 + 2 + font->width("Kolyah35/minecraft-pe-0.6.1"); + const int logoY = height - 10; + const int logoH = 10; + if (x >= logoX && x <= logoX + logoW && y >= logoY && y <= logoY + logoH) + minecraft->platform()->openURL("https://gitea.sffempire.ru/Kolyah35/minecraft-pe-0.6.1"); + else + Screen::mouseClicked(x, y, buttonNum); } bool StartMenuScreen::handleBackEvent( bool isDown ) { @@ -289,4 +226,5 @@ bool StartMenuScreen::handleBackEvent( bool isDown ) { return true; } -}; +} // namespace Touch + diff --git a/src/client/gui/screens/touch/TouchStartMenuScreen.h b/src/client/gui/screens/touch/TouchStartMenuScreen.h index 7f45545..b4c8755 100755 --- a/src/client/gui/screens/touch/TouchStartMenuScreen.h +++ b/src/client/gui/screens/touch/TouchStartMenuScreen.h @@ -3,15 +3,8 @@ #include "../../Screen.h" #include "../../components/LargeImageButton.h" - - -class BuyButton: public ImageButton { - typedef ImageButton super; -public: - BuyButton(int id); - void render(Minecraft* minecraft, int xm, int ym); -}; - +#include "../../components/ImageButton.h" +#include "../../components/TextBox.h" namespace Touch { @@ -23,27 +16,27 @@ public: void init(); void setupPositions(); - - void tick(); + void render(int xm, int ym, float a); void buttonClicked(Button* button); + virtual void mouseClicked(int x, int y, int buttonNum); bool handleBackEvent(bool isDown); bool isInGameScreen(); private: - void _updateLicense(); LargeImageButton bHost; LargeImageButton bJoin; LargeImageButton bOptions; - TButton bTest; - BuyButton bBuy; + ImageButton bQuit; // X close icon std::string copyright; int copyrightPosX; std::string version; int versionPosX; + + std::string username; }; }; diff --git a/src/client/model/HumanoidModel.cpp b/src/client/model/HumanoidModel.cpp index 985019c..e6515ea 100755 --- a/src/client/model/HumanoidModel.cpp +++ b/src/client/model/HumanoidModel.cpp @@ -4,34 +4,48 @@ #include "../../world/entity/player/Player.h" #include "../../world/entity/player/Inventory.h" -HumanoidModel::HumanoidModel( float g /*= 0*/, float yOffset /*= 0*/ ) -: holdingLeftHand(false), +HumanoidModel::HumanoidModel( float g /*= 0*/, float yOffset /*= 0*/, int texW /*= 64*/, int texH /*= 32*/ ) +: holdingLeftHand(false), holdingRightHand(false), sneaking(false), bowAndArrow(false), head(0, 0), + hair(32, 0), //ear (24, 0), - //hair(32, 0), body(16, 16), arm0(24 + 16, 16), arm1(24 + 16, 16), leg0(0, 16), leg1(0, 16) { + texWidth = texW; + texHeight = texH; + + // texWidth = 64; + // texHeight = 32; + head.setModel(this); + hair.setModel(this); body.setModel(this); arm0.setModel(this); arm1.setModel(this); leg0.setModel(this); leg1.setModel(this); + // If the texture is 64x64, use the modern skin layout for arms/legs and add overlay layers. + bool modernSkin = (texWidth == 64 && texHeight == 64); + if (modernSkin) { + // Left arm and left leg are located in the bottom half of a 64x64 skin. + arm1.texOffs(32, 48); + leg1.texOffs(16, 48); + } + head.addBox(-4, -8, -4, 8, 8, 8, g); // Head head.setPos(0, 0 + yOffset, 0); - //ear.addBox(-3, -6, -1, 6, 6, 1, g); // Ear + hair.addBox(-4, -8, -4, 8, 8, 8, g + 0.5f); // Outer head layer (hat) + hair.setPos(0, 0 + yOffset, 0); - //hair.addBox(-4, -8, -4, 8, 8, 8, g + 0.5f); // Head - // hair.setPos(0, 0 + yOffset, 0); body.addBox(-4, 0, -2, 8, 12, 4, g); // Body body.setPos(0, 0 + yOffset, 0); @@ -49,6 +63,24 @@ HumanoidModel::HumanoidModel( float g /*= 0*/, float yOffset /*= 0*/ ) leg1.mirror = true; leg1.addBox(-2, 0, -2, 4, 12, 4, g); // Leg1 leg1.setPos(2, 12 + yOffset, 0); + + if (modernSkin) { + // Overlay layers for 64x64 skins (same geometry, different texture regions) + body.texOffs(16, 32); + body.addBox(-4, 0, -2, 8, 12, 4, g + 0.5f); + + arm0.texOffs(40, 32); + arm0.addBox(-3, -2, -2, 4, 12, 4, g + 0.5f); + + arm1.texOffs(48, 48); + arm1.addBox(-1, -2, -2, 4, 12, 4, g + 0.5f); + + leg0.texOffs(0, 32); + leg0.addBox(-2, 0, -2, 4, 12, 4, g + 0.5f); + + leg1.texOffs(0, 48); + leg1.addBox(-2, 0, -2, 4, 12, 4, g + 0.5f); + } } void HumanoidModel::render(Entity* e, float time, float r, float bob, float yRot, float xRot, float scale ) @@ -68,14 +100,24 @@ void HumanoidModel::render(Entity* e, float time, float r, float bob, float yRot setupAnim(time, r, bob, yRot, xRot, scale); + // Sync overlay with head rotation/position + + hair.xRot = head.xRot; + hair.yRot = head.yRot; + hair.zRot = head.zRot; + hair.y = head.y; + + head.render(scale); + + hair.render(scale); + body.render(scale); arm0.render(scale); arm1.render(scale); leg0.render(scale); leg1.render(scale); bowAndArrow = false; - //hair.render(scale); } void HumanoidModel::render( HumanoidModel* model, float scale ) @@ -83,8 +125,12 @@ void HumanoidModel::render( HumanoidModel* model, float scale ) head.yRot = model->head.yRot; head.y = model->head.y; head.xRot = model->head.xRot; - //hair.yRot = head.yRot; - //hair.xRot = head.xRot; + + hair.yRot = head.yRot; + hair.xRot = head.xRot; + hair.zRot = head.zRot; + hair.y = head.y; + arm0.xRot = model->arm0.xRot; arm0.zRot = model->arm0.zRot; @@ -96,12 +142,14 @@ void HumanoidModel::render( HumanoidModel* model, float scale ) leg1.xRot = model->leg1.xRot; head.render(scale); + if (texWidth == 64 && texHeight == 64) { + hair.render(scale); + } body.render(scale); arm0.render(scale); arm1.render(scale); leg0.render(scale); leg1.render(scale); - //hair.render(scale); } void HumanoidModel::renderHorrible( float time, float r, float bob, float yRot, float xRot, float scale ) @@ -227,7 +275,7 @@ void HumanoidModel::onGraphicsReset() arm1.onGraphicsReset(); leg0.onGraphicsReset(); leg1.onGraphicsReset(); - //hair.onGraphicsReset(); + hair.onGraphicsReset(); } //void renderHair(float scale) { diff --git a/src/client/model/HumanoidModel.h b/src/client/model/HumanoidModel.h index 14dc60e..d97a7be 100755 --- a/src/client/model/HumanoidModel.h +++ b/src/client/model/HumanoidModel.h @@ -9,7 +9,7 @@ class ItemInstance; class HumanoidModel: public Model { public: - HumanoidModel(float g = 0, float yOffset = 0); +HumanoidModel(float g = 0, float yOffset = 0, int texW = 64, int texH = 32); void setupAnim(float time, float r, float bob, float yRot, float xRot, float scale); @@ -18,7 +18,7 @@ public: void renderHorrible(float time, float r, float bob, float yRot, float xRot, float scale); void onGraphicsReset(); - ModelPart head, /*hair,*/ body, arm0, arm1, leg0, leg1;//, ear; + ModelPart head, hair, body, arm0, arm1, leg0, leg1;//, ear; bool holdingLeftHand; bool holdingRightHand; bool sneaking; diff --git a/src/client/model/geom/Cube.cpp b/src/client/model/geom/Cube.cpp index e1da77d..bb3c030 100755 --- a/src/client/model/geom/Cube.cpp +++ b/src/client/model/geom/Cube.cpp @@ -50,12 +50,12 @@ Cube::Cube(ModelPart* modelPart, int xTexOffs, int yTexOffs, float x0, float y0, VertexPT* l2 = ++ptr; VertexPT* l3 = ++ptr; - polygons[0] = PolygonQuad(l1, u1, u2, l2, xTexOffs + d + w, yTexOffs + d, xTexOffs + d + w + d, yTexOffs + d + h); // Right - polygons[1] = PolygonQuad(u0, l0, l3, u3, xTexOffs + 0, yTexOffs + d, xTexOffs + d, yTexOffs + d + h); // Left - polygons[2] = PolygonQuad(l1, l0, u0, u1, xTexOffs + d, yTexOffs + 0, xTexOffs + d + w, yTexOffs + d); // Up - polygons[3] = PolygonQuad(u2, u3, l3, l2, xTexOffs + d + w, yTexOffs + d, xTexOffs + d + w + w, yTexOffs); // Down - polygons[4] = PolygonQuad(u1, u0, u3, u2, xTexOffs + d, yTexOffs + d, xTexOffs + d + w, yTexOffs + d + h); // Front - polygons[5] = PolygonQuad(l0, l1, l2, l3, xTexOffs + d + w + d, yTexOffs + d, xTexOffs + d + w + d + w, yTexOffs + d + h); // Back + polygons[0] = PolygonQuad(l1, u1, u2, l2, xTexOffs + d + w, yTexOffs + d, xTexOffs + d + w + d, yTexOffs + d + h, modelPart->xTexSize, modelPart->yTexSize); // Right + polygons[1] = PolygonQuad(u0, l0, l3, u3, xTexOffs + 0, yTexOffs + d, xTexOffs + d, yTexOffs + d + h, modelPart->xTexSize, modelPart->yTexSize); // Left + polygons[2] = PolygonQuad(l1, l0, u0, u1, xTexOffs + d, yTexOffs + 0, xTexOffs + d + w, yTexOffs + d, modelPart->xTexSize, modelPart->yTexSize); // Up + polygons[3] = PolygonQuad(u2, u3, l3, l2, xTexOffs + d + w, yTexOffs + d, xTexOffs + d + w + w, yTexOffs, modelPart->xTexSize, modelPart->yTexSize); // Down + polygons[4] = PolygonQuad(u1, u0, u3, u2, xTexOffs + d, yTexOffs + d, xTexOffs + d + w, yTexOffs + d + h, modelPart->xTexSize, modelPart->yTexSize); // Front + polygons[5] = PolygonQuad(l0, l1, l2, l3, xTexOffs + d + w + d, yTexOffs + d, xTexOffs + d + w + d + w, yTexOffs + d + h, modelPart->xTexSize, modelPart->yTexSize); // Back if (modelPart->mirror) { for (int i = 0; i < 6; i++) diff --git a/src/client/model/geom/ModelPart.cpp b/src/client/model/geom/ModelPart.cpp index 7fa8f70..d0bc00d 100755 --- a/src/client/model/geom/ModelPart.cpp +++ b/src/client/model/geom/ModelPart.cpp @@ -203,7 +203,7 @@ void ModelPart::compile( float scale ) void ModelPart::draw() { #ifdef OPENGL_ES - drawArrayVT_NoState(vboId, cubes.size() * 2 * 3 * 6, 24); + drawArrayVTN_NoState(vboId, cubes.size() * 2 * 3 * 6, 36); #else glCallList(list); #endif diff --git a/src/client/model/geom/Polygon.cpp b/src/client/model/geom/Polygon.cpp index db531f2..b826f39 100755 --- a/src/client/model/geom/Polygon.cpp +++ b/src/client/model/geom/Polygon.cpp @@ -12,15 +12,15 @@ PolygonQuad::PolygonQuad(VertexPT* v0, VertexPT* v1, VertexPT* v2, VertexPT* v3) } PolygonQuad::PolygonQuad( VertexPT* v0, VertexPT* v1, VertexPT* v2, VertexPT* v3, - int uu0, int vv0, int uu1, int vv1) -: _flipNormal(false) + int uu0, int vv0, int uu1, int vv1, float texW, float texH) +: _flipNormal(false) { - const float us = -0.002f / 64.0f;//0.1f / 64.0f; - const float vs = -0.002f / 32.0f;//0.1f / 32.0f; - vertices[0] = v0->remap(uu1 / 64.0f - us, vv0 / 32.0f + vs); - vertices[1] = v1->remap(uu0 / 64.0f + us, vv0 / 32.0f + vs); - vertices[2] = v2->remap(uu0 / 64.0f + us, vv1 / 32.0f - vs); - vertices[3] = v3->remap(uu1 / 64.0f - us, vv1 / 32.0f - vs); + const float us = -0.002f / texW; + const float vs = -0.002f / texH; + vertices[0] = v0->remap(uu1 / texW - us, vv0 / texH + vs); + vertices[1] = v1->remap(uu0 / texW + us, vv0 / texH + vs); + vertices[2] = v2->remap(uu0 / texW + us, vv1 / texH - vs); + vertices[3] = v3->remap(uu1 / texW - us, vv1 / texH - vs); } PolygonQuad::PolygonQuad( VertexPT* v0, VertexPT* v1, VertexPT* v2, VertexPT* v3, @@ -43,6 +43,18 @@ void PolygonQuad::mirror() { } void PolygonQuad::render(Tesselator& t, float scale, int vboId /* = -1 */) { + Vec3 v0 = vertices[0].pos - vertices[1].pos; + Vec3 v1 = vertices[2].pos - vertices[1].pos; + Vec3 n = v1.cross(v0).normalized(); + if (_flipNormal == true) + { + t.normal(-n.x , -n.y , -n.z ); + } + else + { + t.normal(n.x , n.y , n.z ); + } + for (int i = 0; i < 4; i++) { VertexPT& v = vertices[i]; t.vertexUV(v.pos.x * scale, v.pos.y * scale, v.pos.z * scale, v.u, v.v); diff --git a/src/client/model/geom/Polygon.h b/src/client/model/geom/Polygon.h index 875b0a6..7731f9c 100755 --- a/src/client/model/geom/Polygon.h +++ b/src/client/model/geom/Polygon.h @@ -11,7 +11,7 @@ class PolygonQuad public: PolygonQuad() {} PolygonQuad(VertexPT*,VertexPT*,VertexPT*,VertexPT*); - PolygonQuad(VertexPT*,VertexPT*,VertexPT*,VertexPT*, int u0, int v0, int u1, int v1); + PolygonQuad(VertexPT*,VertexPT*,VertexPT*,VertexPT*, int u0, int v0, int u1, int v1, float texW = 64.0f, float texH = 32.0f); PolygonQuad(VertexPT*,VertexPT*,VertexPT*,VertexPT*, float u0, float v0, float u1, float v1); void mirror(); diff --git a/src/client/player/LocalPlayer.cpp b/src/client/player/LocalPlayer.cpp index 995d52c..29ccf44 100755 --- a/src/client/player/LocalPlayer.cpp +++ b/src/client/player/LocalPlayer.cpp @@ -18,6 +18,23 @@ #include "../../network/packet/SendInventoryPacket.h" #include "../../network/packet/EntityEventPacket.h" #include "../../network/packet/PlayerActionPacket.h" +#include +#include +#include "../../platform/log.h" +#include "../../platform/HttpClient.h" +#include "../../platform/CThread.h" +#include "../../util/StringUtils.h" +#include "client/Options.h" + +#if defined(_WIN32) +#include +#include +#else +#include +#include +#include +#endif + #ifndef STANDALONE_SERVER #include "../gui/Screen.h" #include "../gui/screens/FurnaceScreen.h" @@ -32,6 +49,289 @@ #include "../../world/item/ArmorItem.h" #include "../../network/packet/PlayerArmorEquipmentPacket.h" +namespace { +#ifndef STANDALONE_SERVER + +static bool isBase64(unsigned char c) { + return (std::isalnum(c) || (c == '+') || (c == '/')); +} + +static std::string base64Decode(const std::string& encoded) { + static const std::string base64Chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + std::string out; + int in_len = (int)encoded.size(); + int i = 0; + int in_ = 0; + unsigned char char_array_4[4], char_array_3[3]; + + while (in_len-- && (encoded[in_] != '=') && isBase64(encoded[in_])) { + char_array_4[i++] = encoded[in_]; in_++; + if (i == 4) { + for (i = 0; i < 4; i++) + char_array_4[i] = (unsigned char)base64Chars.find(char_array_4[i]); + + char_array_3[0] = (char_array_4[0] << 2) + ((char_array_4[1] & 0x30) >> 4); + char_array_3[1] = ((char_array_4[1] & 0xf) << 4) + ((char_array_4[2] & 0x3c) >> 2); + char_array_3[2] = ((char_array_4[2] & 0x3) << 6) + char_array_4[3]; + + for (i = 0; i < 3; i++) + out += char_array_3[i]; + i = 0; + } + } + + if (i) { + for (int j = i; j < 4; j++) + char_array_4[j] = 0; + for (int j = 0; j < 4; j++) + char_array_4[j] = (unsigned char)base64Chars.find(char_array_4[j]); + + char_array_3[0] = (char_array_4[0] << 2) + ((char_array_4[1] & 0x30) >> 4); + char_array_3[1] = ((char_array_4[1] & 0xf) << 4) + ((char_array_4[2] & 0x3c) >> 2); + char_array_3[2] = ((char_array_4[2] & 0x3) << 6) + char_array_4[3]; + + for (int j = 0; (j < i - 1); j++) + out += char_array_3[j]; + } + return out; +} + +static std::string extractJsonString(const std::string& json, const std::string& key) { + std::string search = "\"" + key + "\""; + size_t pos = json.find(search); + if (pos == std::string::npos) return ""; + pos = json.find(':', pos + search.size()); + if (pos == std::string::npos) return ""; + pos++; + while (pos < json.size() && std::isspace((unsigned char)json[pos])) pos++; + if (pos >= json.size() || json[pos] != '"') return ""; + pos++; + size_t end = json.find('"', pos); + if (end == std::string::npos) return ""; + return json.substr(pos, end - pos); +} + +static std::string getTextureUrlForUsername(const std::string& username, const std::string& textureKey) { + if (username.empty()) { + LOGI("[%s] username empty\n", textureKey.c_str()); + return ""; + } + + LOGI("[%s] resolving UUID for user '%s'...\n", textureKey.c_str(), username.c_str()); + std::vector body; + std::string apiUrl = "http://api.mojang.com/users/profiles/minecraft/" + username; + if (!HttpClient::download(apiUrl, body)) { + LOGW("[%s] failed to download UUID for %s\n", textureKey.c_str(), username.c_str()); + return ""; + } + + std::string response(body.begin(), body.end()); + std::string uuid = extractJsonString(response, "id"); + if (uuid.empty()) { + LOGW("[%s] no UUID found in Mojang response for %s\n", textureKey.c_str(), username.c_str()); + return ""; + } + + LOGI("[%s] UUID=%s for user %s\n", textureKey.c_str(), uuid.c_str(), username.c_str()); + + std::string profileUrl = "http://sessionserver.mojang.com/session/minecraft/profile/" + uuid; + if (!HttpClient::download(profileUrl, body)) { + LOGW("[%s] failed to download profile for UUID %s\n", textureKey.c_str(), uuid.c_str()); + return ""; + } + + response.assign(body.begin(), body.end()); + std::string encoded = extractJsonString(response, "value"); + if (encoded.empty()) { + LOGW("[%s] no value field in profile response for UUID %s\n", textureKey.c_str(), uuid.c_str()); + return ""; + } + + std::string decoded = base64Decode(encoded); + + std::string searchKey = "\"" + textureKey + "\""; + size_t texturePos = decoded.find(searchKey); + if (texturePos == std::string::npos) { + LOGW("[%s] no %s entry in decoded profile for UUID %s\n", textureKey.c_str(), textureKey.c_str(), uuid.c_str()); + return ""; + } + size_t urlPos = decoded.find("\"url\"", texturePos); + if (urlPos == std::string::npos) { + LOGW("[%s] no url field under %s for UUID %s\n", textureKey.c_str(), textureKey.c_str(), uuid.c_str()); + return ""; + } + + // extract the URL value from the substring starting at urlPos + std::string urlFragment = decoded.substr(urlPos); + std::string textureUrl = extractJsonString(urlFragment, "url"); + if (textureUrl.empty()) { + LOGW("[%s] failed to parse %s URL for UUID %s\n", textureKey.c_str(), textureKey.c_str(), uuid.c_str()); + return ""; + } + + LOGI("[%s] %s URL for %s: %s\n", textureKey.c_str(), textureKey.c_str(), username.c_str(), textureUrl.c_str()); + return textureUrl; +} + +static std::string getSkinUrlForUsername(const std::string& username) { + return getTextureUrlForUsername(username, "SKIN"); +} + +static std::string getCapeUrlForUsername(const std::string& username) { + return getTextureUrlForUsername(username, "CAPE"); +} + +#endif + +static bool ensureDirectoryExists(const std::string& path) { +#if defined(_WIN32) + return _mkdir(path.c_str()) == 0 || errno == EEXIST; +#else + struct stat st; + if (stat(path.c_str(), &st) == 0 && S_ISDIR(st.st_mode)) + return true; + + std::string subPath; + size_t i = 0; + while (i < path.length()) { + i = path.find_first_of("/\\", i); + if (i == std::string::npos) { + subPath = path; + } else { + subPath = path.substr(0, i); + } + + if (!subPath.empty()) { + if (stat(subPath.c_str(), &st) != 0) { + if (mkdir(subPath.c_str(), 0755) != 0 && errno != EEXIST) + return false; + } else if (!S_ISDIR(st.st_mode)) { + return false; + } + } + + if (i == std::string::npos) + break; + i += 1; + } + + if (stat(path.c_str(), &st) == 0 && S_ISDIR(st.st_mode)) + return true; + return mkdir(path.c_str(), 0755) == 0 || errno == EEXIST; +#endif +} + +static bool fileExists(const std::string& path) { + struct stat st; + if (stat(path.c_str(), &st) != 0) + return false; + +#if defined(_WIN32) + return (st.st_mode & _S_IFREG) != 0; +#else + return S_ISREG(st.st_mode); +#endif +} + +#ifndef STANDALONE_SERVER + +static void* fetchSkinForPlayer(void* param) { + LocalPlayer* player = (LocalPlayer*)param; + if (!player) return NULL; + + LOGI("[Skin] starting skin download for %s\n", player->name.c_str()); + + const std::string cacheDir = "data/images/skins"; + if (!ensureDirectoryExists(cacheDir)) { + LOGW("[Skin] failed to create cache directory %s\n", cacheDir.c_str()); + } + + std::string cacheFile = cacheDir + "/" + player->name + ".png"; + if (fileExists(cacheFile)) { + LOGI("[Skin] using cached skin for %s\n", player->name.c_str()); + player->setTextureName("skins/" + player->name + ".png"); + return NULL; + } + + std::string skinUrl = getSkinUrlForUsername(player->name); + if (skinUrl.empty()) { + LOGW("[Skin] skin URL lookup failed for %s\n", player->name.c_str()); + player->setTextureName("mob/char.png"); + return NULL; + } + + LOGI("[Skin] downloading skin from %s\n", skinUrl.c_str()); + std::vector skinData; + if (!HttpClient::download(skinUrl, skinData) || skinData.empty()) { + LOGW("[Skin] download failed for %s\n", skinUrl.c_str()); + player->setTextureName("mob/char.png"); + return NULL; + } + + // Save to cache + FILE* fp = fopen(cacheFile.c_str(), "wb"); + if (fp) { + fwrite(skinData.data(), 1, skinData.size(), fp); + fclose(fp); + LOGI("[Skin] cached skin to %s\n", cacheFile.c_str()); + + player->setTextureName("skins/" + player->name + ".png"); + } else { + LOGW("[Skin] failed to write skin cache %s\n", cacheFile.c_str()); + player->setTextureName("mob/char.png"); + } + + return NULL; +} + +static void* fetchCapeForPlayer(void* param) { + LocalPlayer* player = (LocalPlayer*)param; + if (!player) return NULL; + + LOGI("[Cape] starting cape download for %s\n", player->name.c_str()); + + const std::string cacheDir = "data/images/capes"; + if (!ensureDirectoryExists(cacheDir)) { + LOGW("[Cape] failed to create cache directory %s\n", cacheDir.c_str()); + } + + std::string cacheFile = cacheDir + "/" + player->name + ".png"; + if (fileExists(cacheFile)) { + LOGI("[Cape] using cached cape for %s\n", player->name.c_str()); + player->setCapeTextureName("capes/" + player->name + ".png"); + return NULL; + } + + std::string capeUrl = getCapeUrlForUsername(player->name); + if (capeUrl.empty()) { + LOGW("[Cape] cape URL lookup failed for %s\n", player->name.c_str()); + return NULL; + } + + LOGI("[Cape] downloading cape from %s\n", capeUrl.c_str()); + std::vector capeData; + if (!HttpClient::download(capeUrl, capeData) || capeData.empty()) { + LOGW("[Cape] download failed for %s\n", capeUrl.c_str()); + return NULL; + } + + // Save to cache + FILE* fp = fopen(cacheFile.c_str(), "wb"); + if (fp) { + fwrite(capeData.data(), 1, capeData.size(), fp); + fclose(fp); + LOGI("[Cape] cached cape to %s\n", cacheFile.c_str()); + + player->setCapeTextureName("capes/" + player->name + ".png"); + } else { + LOGW("[Cape] failed to write cape cache %s\n", cacheFile.c_str()); + } + + return NULL; +} + +#endif + //@note: doesn't work completely, since it doesn't care about stairs rotation static bool isJumpable(int tileId) { return tileId != Tile::fence->id @@ -43,23 +343,39 @@ static bool isJumpable(int tileId) { && (Tile::tiles[tileId] != NULL && Tile::tiles[tileId]->getRenderShape() != Tile::SHAPE_STAIRS); } -LocalPlayer::LocalPlayer(Minecraft* minecraft, Level* level, User* user, int dimension, bool isCreative) +} // anonymous namespace + +LocalPlayer::LocalPlayer(Minecraft* minecraft, Level* level, const std::string& username, int dimension, bool isCreative) : Player(level, isCreative), minecraft(minecraft), input(NULL), sentInventoryItemId(-1), sentInventoryItemData(-1), autoJumpEnabled(true), - armorTypeHash(0) + armorTypeHash(0), + sprinting(false), + sprintDoubleTapTimer(0), + prevForwardHeld(false), + xBob(0.0f), + yBob(0.0f), + xBobO(0.0f), + yBobO(0.0f) { this->dimension = dimension; _init(); +#ifndef STANDALONE_SERVER - if (user != NULL) { - if (user->name.length() > 0) - //customTextureUrl = "http://s3.amazonaws.com/MinecraftSkins/" + user.name + ".png"; - this->name = user->name; + if (minecraft->options.getStringValue(OPTIONS_USERNAME).size() != 0) { + textureName = "mob/char.png"; + + this->name = minecraft->options.getStringValue(OPTIONS_USERNAME); + printf("test \n"); + // Fetch user skin and cape from Mojang servers in the background (avoids blocking the main thread) + // TODO: Fix this memory leak + new CThread(fetchSkinForPlayer, this); + new CThread(fetchCapeForPlayer, this); } +#endif } LocalPlayer::~LocalPlayer() { @@ -69,22 +385,30 @@ LocalPlayer::~LocalPlayer() { /*private*/ void LocalPlayer::calculateFlight(float xa, float ya, float za) { + float flySpeed = minecraft->options.getProgressValue(OPTIONS_FLY_SPEED); + float sensivity = minecraft->options.getProgressValue(OPTIONS_SENSITIVITY); - xa = xa * minecraft->options.flySpeed; + xa = xa * flySpeed; ya = 0; - za = za * minecraft->options.flySpeed; + za = za * flySpeed; + + if (sprinting) { + float sprintBoost = getWalkingSpeedModifier(); // 1.3x + xa *= sprintBoost; + za *= sprintBoost; + } #ifdef ANDROID - if (Keyboard::isKeyDown(103)) ya = .2f * minecraft->options.flySpeed; - if (Keyboard::isKeyDown(102)) ya = -.2f * minecraft->options.flySpeed; + if (Keyboard::isKeyDown(103)) ya = .2f * flySpeed; + if (Keyboard::isKeyDown(102)) ya = -.2f * flySpeed; #else - if (Keyboard::isKeyDown(Keyboard::KEY_E)) ya = .2f * minecraft->options.flySpeed; - if (Keyboard::isKeyDown(Keyboard::KEY_Q)) ya = -.2f * minecraft->options.flySpeed; + if (Keyboard::isKeyDown(Keyboard::KEY_E)) ya = .2f * flySpeed; + if (Keyboard::isKeyDown(Keyboard::KEY_Q)) ya = -.2f * flySpeed; #endif - flyX = 10 * smoothFlyX.getNewDeltaValue(xa, .35f * minecraft->options.sensitivity); - flyY = 10 * smoothFlyY.getNewDeltaValue(ya, .35f * minecraft->options.sensitivity); - flyZ = 10 * smoothFlyZ.getNewDeltaValue(za, .35f * minecraft->options.sensitivity); + flyX = 10 * smoothFlyX.getNewDeltaValue(xa, .35f * sensivity); + flyY = 10 * smoothFlyY.getNewDeltaValue(ya, .35f * sensivity); + flyZ = 10 * smoothFlyZ.getNewDeltaValue(za, .35f * sensivity); } bool LocalPlayer::isSolidTile(int x, int y, int z) { @@ -136,7 +460,7 @@ void LocalPlayer::tick() { { sentInventoryItemId = newItemId; sentInventoryItemData = newItemData; - PlayerEquipmentPacket packet(entityId, newItemId, newItemData); + PlayerEquipmentPacket packet(entityId, newItemId, newItemData, inventory->selected, inventory->getSlot(newItemId, newItemData)); minecraft->raknetInstance->send(packet); } } @@ -149,7 +473,7 @@ void LocalPlayer::tick() { printf("armor %d: %d\n", i, a->getAuxValue()); } -/**/ +*/ updateArmorTypeHash(); #ifndef STANDALONE_SERVER @@ -176,6 +500,25 @@ void LocalPlayer::aiStep() { if (!screenCovering) input->tick(this); + // Sprint: detect W double-tap + { + bool forwardHeld = (input->ya > 0); + if (forwardHeld && !prevForwardHeld && minecraft->options.getBooleanValue(OPTIONS_ALLOW_SPRINT)) { + // leading edge of W press + if (sprintDoubleTapTimer > 0) + sprinting = true; + else + sprintDoubleTapTimer = 7; + } + if (!forwardHeld) { + sprinting = false; + } + if (sprintDoubleTapTimer > 0) sprintDoubleTapTimer--; + prevForwardHeld = forwardHeld; + } + if (input->sneaking) + sprinting = false; + if (input->sneaking) { if (ySlideOffset < 0.2f) ySlideOffset = 0.2f; } @@ -211,6 +554,10 @@ void LocalPlayer::aiStep() { //if (onGround && abilities.flying) // abilities.flying = false; + yBobO = yBob; + xBobO = xBob; + xBob += (xRot - xBob) * 0.5; + yBob += (yRot - yBob) * 0.5; if (interpolateOnly()) updateAi(); @@ -229,7 +576,7 @@ void LocalPlayer::closeContainer() { //@Override void LocalPlayer::move(float xa, float ya, float za) { //@note: why is this == minecraft->player needed? - if (this == minecraft->player && minecraft->options.isFlying) { + if (this == minecraft->player && minecraft->options.getBooleanValue(OPTIONS_IS_FLYING)) { noPhysics = true; float tmp = walkDist; // update calculateFlight((float) xa, (float) ya, (float) za); @@ -249,7 +596,7 @@ void LocalPlayer::move(float xa, float ya, float za) { float newX = x, newZ = z; - if (autoJumpTime <= 0 && autoJumpEnabled) + if (autoJumpTime <= 0 && minecraft->options.getBooleanValue(OPTIONS_AUTOJUMP)) { // auto-jump when crossing the middle of a tile, and the tile in the front is blocked bool jump = false; @@ -296,6 +643,10 @@ void LocalPlayer::releaseAllKeys() if (input) input->releaseAllKeys(); } +float LocalPlayer::getWalkingSpeedModifier() { + return sprinting ? 1.3f : 1.0f; +} + float LocalPlayer::getFieldOfViewModifier() { float targetFov = 1.0f; if(abilities.flying) targetFov *= 1.1f; @@ -423,22 +774,19 @@ void LocalPlayer::startCrafting(int x, int y, int z, int tableSize) { void LocalPlayer::startStonecutting(int x, int y, int z) { #ifndef STANDALONE_SERVER - if (!minecraft->isCreativeMode()) - minecraft->setScreen( new StonecutterScreen() ); + minecraft->setScreen( new StonecutterScreen() ); #endif } void LocalPlayer::openFurnace( FurnaceTileEntity* e ) { #ifndef STANDALONE_SERVER - if (!minecraft->isCreativeMode()) - minecraft->setScreen( new FurnaceScreen(this, e) ); + minecraft->setScreen( new FurnaceScreen(this, e) ); #endif } void LocalPlayer::openContainer( ChestTileEntity* container ) { #ifndef STANDALONE_SERVER - if (!minecraft->isCreativeMode()) - minecraft->setScreen( new ChestScreen(this, container) ); + minecraft->setScreen( new ChestScreen(this, container) ); #endif } diff --git a/src/client/player/LocalPlayer.h b/src/client/player/LocalPlayer.h index e7b1fb4..aa0b956 100755 --- a/src/client/player/LocalPlayer.h +++ b/src/client/player/LocalPlayer.h @@ -4,8 +4,6 @@ //package net.minecraft.client.player; #include "input/IMoveInput.h" -#include "../User.h" -#include "../../platform/input/Keyboard.h" #include "../../util/SmoothFloat.h" #include "../../world/entity/player/Player.h" @@ -17,13 +15,17 @@ class LocalPlayer: public Player { typedef Player super; public: - LocalPlayer(Minecraft* minecraft, Level* level, User* user, int dimension, bool isCreative); + LocalPlayer(Minecraft* minecraft, Level* level, const std::string& username, int dimension, bool isCreative); ~LocalPlayer(); void _init(); virtual void reset(); void tick(); + + float yBob, xBob; // shredder added from b1.8/4j for the hand swaying animation + float yBobO, xBobO; // shredder added from b1.8/4j for the hand swaying animation + void move(float xa, float ya, float za); void aiStep(); @@ -70,6 +72,7 @@ public: void swing(); virtual void openTextEdit( TileEntity* tileEntity ); + virtual float getWalkingSpeedModifier(); private: void calculateFlight(float xa, float ya, float za); bool isSolidTile(int x, int y, int z); @@ -99,6 +102,13 @@ private: int sentInventoryItemData; int armorTypeHash; + + // sprinting + bool sprinting; + int sprintDoubleTapTimer; + bool prevForwardHeld; +public: + void setSprinting(bool sprint) { sprinting = sprint; } }; #endif /*NET_MINECRAFT_CLIENT_PLAYER__LocalPlayer_H__*/ diff --git a/src/client/player/input/KeyboardInput.cpp b/src/client/player/input/KeyboardInput.cpp index 597884a..b84fe75 100755 --- a/src/client/player/input/KeyboardInput.cpp +++ b/src/client/player/input/KeyboardInput.cpp @@ -12,14 +12,12 @@ KeyboardInput::KeyboardInput( Options* options ) void KeyboardInput::setKey( int key, bool state ) { int id = -1; - if (key == options->keyUp.key) id = KEY_UP; - if (key == options->keyDown.key) id = KEY_DOWN; - if (key == options->keyLeft.key) id = KEY_LEFT; - if (key == options->keyRight.key) id = KEY_RIGHT; - if (key == options->keyJump.key) id = KEY_JUMP; - if (key == options->keySneak.key) id = KEY_SNEAK; - if (key == options->keyCraft.key) id = KEY_CRAFT; - //printf("key: %d\n", id); + if (key == options->getIntValue(OPTIONS_KEY_FORWARD)) id = KEY_UP; + if (key == options->getIntValue(OPTIONS_KEY_BACK)) id = KEY_DOWN; + if (key == options->getIntValue(OPTIONS_KEY_LEFT)) id = KEY_LEFT; + if (key == options->getIntValue(OPTIONS_KEY_RIGHT)) id = KEY_RIGHT; + if (key == options->getIntValue(OPTIONS_KEY_JUMP)) id = KEY_JUMP; + if (key == options->getIntValue(OPTIONS_KEY_SNEAK)) id = KEY_SNEAK; if (id >= 0) { keys[id] = state; } @@ -52,10 +50,8 @@ void KeyboardInput::tick( Player* player ) ya *= 0.3f; } - #ifdef RPI - wantUp = jumping; - wantDown = sneaking; - #endif + wantUp = jumping; + wantDown = sneaking; if (keys[KEY_CRAFT]) player->startCrafting((int)player->x, (int)player->y, (int)player->z, Recipe::SIZE_2X2); diff --git a/src/client/player/input/XperiaPlayInput.h b/src/client/player/input/XperiaPlayInput.h index 196dda0..0b3afc5 100755 --- a/src/client/player/input/XperiaPlayInput.h +++ b/src/client/player/input/XperiaPlayInput.h @@ -4,6 +4,8 @@ //package net.minecraft.client.player; #include "KeyboardInput.h" +#include "platform/input/Controller.h" +#include "world/entity/player/Player.h" // @note: This is just copy-pasted from KeyboardInput right now. class XperiaPlayInput: public KeyboardInput diff --git a/src/client/player/input/touchscreen/TouchInputHolder.h b/src/client/player/input/touchscreen/TouchInputHolder.h index 9ed2647..afda575 100755 --- a/src/client/player/input/touchscreen/TouchInputHolder.h +++ b/src/client/player/input/touchscreen/TouchInputHolder.h @@ -89,7 +89,7 @@ public: } virtual void onConfigChanged(const Config& c) { - if (false && _options->isJoyTouchArea) { + if (false && _options->getBooleanValue(OPTIONS_IS_JOY_TOUCH_AREA)) { int touchWidth = c.width - (int)inventoryArea._x1; if (touchWidth > (int)c.minecraft->pixelCalc.millimetersToPixels(60)) touchWidth = (int)c.minecraft->pixelCalc.millimetersToPixels(60); @@ -293,7 +293,7 @@ public: } void render(float alpha) { - if (_options->isJoyTouchArea) { + if (_options->getBooleanValue(OPTIONS_IS_JOY_TOUCH_AREA)) { fill( (int) (Gui::InvGuiScale * joyTouchArea._x0), (int) (Gui::InvGuiScale * joyTouchArea._y0), (int) (Gui::InvGuiScale * joyTouchArea._x1), @@ -426,11 +426,9 @@ public: virtual void onConfigChanged(const Config& c) { _move.onConfigChanged(c); _turnBuild.moveArea = _move.getRectangleArea(); -#ifdef __APPLE__ _turnBuild.pauseArea = _move.getPauseRectangleArea(); -#endif - _turnBuild.inventoryArea = _mc->gui.getRectangleArea( _mc->options.isLeftHanded? 1 : -1 ); - _turnBuild.setSensitivity(c.options->isJoyTouchArea? 1.8f : 1.0f); + _turnBuild.inventoryArea = _mc->gui.getRectangleArea( _mc->options.getBooleanValue(OPTIONS_IS_LEFT_HANDED)? 1 : -1 ); + _turnBuild.setSensitivity(c.options->getBooleanValue(OPTIONS_IS_JOY_TOUCH_AREA)? 1.8f : 1.0f); ((ITurnInput*)&_turnBuild)->onConfigChanged(c); } diff --git a/src/client/player/input/touchscreen/TouchscreenInput.cpp b/src/client/player/input/touchscreen/TouchscreenInput.cpp index 7d58b1c..37cb6d8 100755 --- a/src/client/player/input/touchscreen/TouchscreenInput.cpp +++ b/src/client/player/input/touchscreen/TouchscreenInput.cpp @@ -9,7 +9,10 @@ #include "../../../../platform/log.h" #include "../../../renderer/Textures.h" #include "../../../sound/SoundEngine.h" +#include "client/gui/screens/ScreenChooser.h" + +// ARGHHHHHH WHY NOT FUCKING ENUM static const int AREA_DPAD_FIRST = 100; static const int AREA_DPAD_N = 100; static const int AREA_DPAD_S = 101; @@ -17,6 +20,7 @@ static const int AREA_DPAD_W = 102; static const int AREA_DPAD_E = 103; static const int AREA_DPAD_C = 104; static const int AREA_PAUSE = 105; +static const int AREA_CHAT = 106; static int cPressed = 0; static int cReleased = 0; @@ -126,15 +130,15 @@ void TouchscreenInput_TestFps::onConfigChanged(const Config& c) { // If too large (like playing on Tablet) PixelCalc& pc = _minecraft->pixelCalc; - if (pc.pixelsToMillimeters(Bw) > 14) { - Bw = Bh = pc.millimetersToPixels(14); + if (pc.pixelsToMillimeters(Bw) > 200) { //14 + Bw = Bh = pc.millimetersToPixels(200); //14 } // temp data float xx; float yy; const float BaseY = -8 + h - 3.0f * Bh; - const float BaseX = _options->isLeftHanded? -8 + w - 3 * Bw + const float BaseX = _options->getBooleanValue(OPTIONS_IS_LEFT_HANDED)? -8 + w - 3 * Bw : 8 + 0; // Setup the bounding rectangle _boundingRectangle = RectangleArea(BaseX, BaseY, BaseX + 3 * Bw, BaseY + 3 * Bh); @@ -158,34 +162,40 @@ void TouchscreenInput_TestFps::onConfigChanged(const Config& c) { xx = BaseX + 2 * Bw; yy = BaseY + Bh; _model.addArea(AREA_DPAD_E, aRight = new RectangleArea(xx, yy, xx+Bw, yy+Bh)); -#ifdef __APPLE__ float maxPixels = _minecraft->pixelCalc.millimetersToPixels(10); - float btnSize = Mth::Min(18 * Gui::GuiScale, maxPixels); - _model.addArea(AREA_PAUSE, aPause = new RectangleArea(w - 4 - btnSize, - 4, - w - 4, - 4 + btnSize)); -#endif /* __APPLE__ */ + // float btnSize = Mth::Min(18 * Gui::GuiScale, maxPixels); + float btnSize = pc.millimetersToPixels(18 * Gui::GuiScale); + _model.addArea(AREA_PAUSE, aPause = new RectangleArea(w - 4 - btnSize, 4, w - 4, 4 + btnSize)); + _model.addArea(AREA_CHAT, aChat = new RectangleArea(w - 8 - btnSize * 2, 4, w - 8 - btnSize, 4 + btnSize)); //rebuild(); } -void TouchscreenInput_TestFps::setKey( int key, bool state ) +void TouchscreenInput_TestFps::setKey(int key, bool state) { #ifdef WIN32 - //LOGI("key: %d, %d\n", key, state); + //LOGI("key: %d, %d\n", key, state); int id = -1; - if (key == _options->keyUp.key) id = KEY_UP; - if (key == _options->keyDown.key) id = KEY_DOWN; - if (key == _options->keyLeft.key) id = KEY_LEFT; - if (key == _options->keyRight.key) id = KEY_RIGHT; - if (key == _options->keyJump.key) id = KEY_JUMP; - if (key == _options->keySneak.key) id = KEY_SNEAK; - if (key == _options->keyCraft.key) id = KEY_CRAFT; - if (id >= 0) { - _keys[id] = state; - } + // theres no keyUp etc??? + //if (key == _options->keyUp.key) id = KEY_UP; + //if (key == _options->keyDown.key) id = KEY_DOWN; + //if (key == _options->keyLeft.key) id = KEY_LEFT; + //if (key == _options->keyRight.key) id = KEY_RIGHT; + //if (key == _options->keyJump.key) id = KEY_JUMP; + //if (key == _options->keySneak.key) id = KEY_SNEAK; + //if (key == _options->keyCraft.key) id = KEY_CRAFT; + //if (id >= 0) { + // _keys[id] = state; + //} + + if (key == _options->getIntValue(OPTIONS_KEY_FORWARD)) id = KEY_UP; + if (key == _options->getIntValue(OPTIONS_KEY_BACK)) id = KEY_DOWN; + if (key == _options->getIntValue(OPTIONS_KEY_LEFT)) id = KEY_LEFT; + if (key == _options->getIntValue(OPTIONS_KEY_RIGHT)) id = KEY_RIGHT; + if (key == _options->getIntValue(OPTIONS_KEY_JUMP)) id = KEY_JUMP; + if (key == _options->getIntValue(OPTIONS_KEY_SNEAK)) id = KEY_SNEAK; + //if (key == _options->getIntValue(OPTIONS_KEY_CRAFT)) id = KEY_CRAFT; #endif } @@ -300,14 +310,20 @@ void TouchscreenInput_TestFps::tick( Player* player ) setButton = true; xa -= 1; } -#ifdef __APPLE__ else if (areaId == AREA_PAUSE) { if (Multitouch::isReleased(p)) { _minecraft->soundEngine->playUI("random.click", 1, 1); _minecraft->screenChooser.setScreen(SCREEN_PAUSE); } } -#endif /*__APPLE__*/ + else if (areaId == AREA_CHAT) { + if (Multitouch::isReleased(p)) { + _minecraft->soundEngine->playUI("random.click", 1, 1); + _minecraft->screenChooser.setScreen(SCREEN_CONSOLE); + _minecraft->platform()->showKeyboard(); + } + } + _buttons[areaId - AREA_DPAD_FIRST] = setButton; } @@ -418,7 +434,7 @@ const RectangleArea& TouchscreenInput_TestFps::getPauseRectangleArea() } void TouchscreenInput_TestFps::rebuild() { - if (_options->hideGui) + if (_options->getBooleanValue(OPTIONS_HIDEGUI)) return; Tesselator& t = Tesselator::instance; @@ -490,15 +506,14 @@ void TouchscreenInput_TestFps::rebuild() { drawRectangleArea(t, aJump, imageU + imageSize * 4, imageV, (float)imageSize); } - -#ifdef __APPLE__ if (!_minecraft->screen) { - if (isButtonDown(AREA_PAUSE)) t.colorABGR(cPressedPause); - else t.colorABGR(cReleasedPause); + t.colorABGR(0xFFFFFFFF); + // if (isButtonDown(AREA_PAUSE)) t.colorABGR(cPressedPause); + // else t.colorABGR(cReleasedPause); drawRectangleArea(t, aPause, 200, 64, 18.0f); + drawRectangleArea(t, aChat, 200, 82, 18.0f); } -#endif /*__APPLE__*/ //t.end(true, _bufferId); //return; diff --git a/src/client/player/input/touchscreen/TouchscreenInput.h b/src/client/player/input/touchscreen/TouchscreenInput.h index 19cfa1a..515f0d8 100755 --- a/src/client/player/input/touchscreen/TouchscreenInput.h +++ b/src/client/player/input/touchscreen/TouchscreenInput.h @@ -61,6 +61,7 @@ private: RectangleArea* aUp; RectangleArea* aDown; RectangleArea* aPause; + RectangleArea* aChat; //RectangleArea* aUpJump; RectangleArea* aJump; RectangleArea* aUpLeft; diff --git a/src/client/renderer/Chunk.cpp b/src/client/renderer/Chunk.cpp index ca6cb37..527508a 100755 --- a/src/client/renderer/Chunk.cpp +++ b/src/client/renderer/Chunk.cpp @@ -7,6 +7,10 @@ #include "../../world/level/Region.h" #include "../../world/level/chunk/LevelChunk.h" #include "../../util/Mth.h" + +#include "../../world/level/biome/BiomeSource.h" + +#include "../../world/level/Level.h" //#include "../../platform/time.h" /*static*/ int Chunk::updates = 0; @@ -137,12 +141,6 @@ void Chunk::rebuild() Tile* tile = Tile::tiles[tileId]; int renderLayer = tile->getRenderLayer(); -// if (renderLayer == l) -// rendered |= tileRenderer.tesselateInWorld(tile, x, y, z); -// else { -// _layerChunks[_layerChunkCount[renderLayer]++] = cindex; -// } - if (renderLayer > l) { renderNextLayer = true; doRenderLayer[renderLayer] = true; @@ -265,4 +263,4 @@ void Chunk::resetUpdates() { updates = 0; //swRebuild.reset(); -} +} \ No newline at end of file diff --git a/src/client/renderer/GameRenderer.cpp b/src/client/renderer/GameRenderer.cpp index 0b8e74e..3ea22a0 100755 --- a/src/client/renderer/GameRenderer.cpp +++ b/src/client/renderer/GameRenderer.cpp @@ -1,6 +1,7 @@ #include "GameRenderer.h" +#include "client/Options.h" #include "gles.h" - +#include "Lighting.h" #include "../../util/PerfTimer.h" #include "LevelRenderer.h" @@ -31,7 +32,7 @@ static int _shTicks = -1; GameRenderer::GameRenderer( Minecraft* mc ) -: mc(mc), + : mc(mc), renderDistance(0), _tick(0), _lastTickT(0), @@ -89,32 +90,42 @@ void renderCursor(float x, float y, Minecraft* minecraft) { /*private*/ void GameRenderer::setupCamera(float a, int eye) { - renderDistance = (float) (16 * 16 >> (mc->options.viewDistance)); + renderDistance = (float) (16 * 16 >> (mc->options.getIntValue(OPTIONS_VIEW_DISTANCE))); #if defined(ANDROID) - if (mc->isPowerVR() && mc->options.viewDistance <= 2) + if (mc->isPowerVR() && mc->options.getIntValue(OPTIONS_VIEW_DISTANCE) <= 2) renderDistance *= 0.8f; #endif glMatrixMode(GL_PROJECTION); - glLoadIdentity2(); + glLoadIdentity2(); - float stereoScale = 0.07f; - if (mc->options.anaglyph3d) glTranslatef2(-(eye * 2 - 1) * stereoScale, 0, 0); - if (zoom != 1) { - glTranslatef2((float) zoom_x, (float) -zoom_y, 0); - glScalef2(zoom, zoom, 1); - gluPerspective(_setupCameraFov = getFov(a, true), mc->width / (float) mc->height, 0.05f, renderDistance); - } else { - gluPerspective(_setupCameraFov = getFov(a, true), mc->width / (float) mc->height, 0.05f, renderDistance); - } + float stereoScale = 0.07f; + if (mc->options.getBooleanValue(OPTIONS_ANAGLYPH_3D)) glTranslatef2(-(eye * 2 - 1) * stereoScale, 0, 0); + if (mc->options.getBooleanValue(OPTIONS_BETA_SKY)){ + if (zoom != 1) { + glTranslatef2((float) zoom_x, (float) -zoom_y, 0); + glScalef2(zoom, zoom, 1); + gluPerspective(_setupCameraFov = getFov(a, true), mc->width / (float) mc->height, 0.05f, renderDistance * 2.0f); + } else { + gluPerspective(_setupCameraFov = getFov(a, true), mc->width / (float) mc->height, 0.05f, renderDistance * 2.0f); + } + } else { + if (zoom != 1) { + glTranslatef2((float) zoom_x, (float) -zoom_y, 0); + glScalef2(zoom, zoom, 1); + gluPerspective(_setupCameraFov = getFov(a, true), mc->width / (float) mc->height, 0.05f, renderDistance); + } else { + gluPerspective(_setupCameraFov = getFov(a, true), mc->width / (float) mc->height, 0.05f, renderDistance); + } + } - glMatrixMode(GL_MODELVIEW); - glLoadIdentity2(); - if (mc->options.anaglyph3d) glTranslatef2((eye * 2 - 1) * 0.10f, 0, 0); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity2(); + if (mc->options.getBooleanValue(OPTIONS_ANAGLYPH_3D)) glTranslatef2((eye * 2 - 1) * 0.10f, 0, 0); + + bobHurt(a); + if (mc->options.getBooleanValue(OPTIONS_VIEW_BOBBING)) bobView(a); - bobHurt(a); - if (mc->options.bobView) bobView(a); - moveCameraToPlayer(a); } @@ -124,13 +135,13 @@ extern int _t_keepPic; void GameRenderer::render(float a) { TIMER_PUSH("mouse"); if (mc->player && mc->mouseGrabbed) { - mc->mouseHandler.poll(); - //printf("Controller.x,y : %f,%f\n", Controller::getX(0), Controller::getY(0)); + mc->mouseHandler.poll(); + //printf("Controller.x,y : %f,%f\n", Controller::getX(0), Controller::getY(0)); - float ss = mc->options.sensitivity * 0.6f + 0.2f; - float sens = (ss * ss * ss) * 8; - float xo = mc->mouseHandler.xd * sens * 4.f; - float yo = mc->mouseHandler.yd * sens * 4.f; + float ss = mc->options.getProgressValue(OPTIONS_SENSITIVITY) * 0.6f + 0.2f; + float sens = (ss * ss * ss) * 8; + float xo = mc->mouseHandler.xd * sens * 4.f; + float yo = mc->mouseHandler.yd * sens * 4.f; const float now = _tick + a; float deltaT = now - _lastTickT; @@ -140,20 +151,20 @@ void GameRenderer::render(float a) { _rotX += xo; _rotY += yo; - int yAxis = -1; - if (mc->options.invertYMouse) yAxis = 1; + int yAxis = -1; + if (mc->options.getBooleanValue(OPTIONS_INVERT_Y_MOUSE)) yAxis = 1; bool screenCovering = mc->screen && !mc->screen->passEvents; if (!screenCovering) { mc->player->turn(deltaT * _rotXlast, deltaT * _rotYlast * yAxis); } - } + } int xMouse = (int)(Mouse::getX() * Gui::InvGuiScale); int yMouse = (int)(Mouse::getY() * Gui::InvGuiScale); -#ifndef PLATFORM_DESKTOP - if (mc->useTouchscreen()) { + + if (mc->useTouchscreen()) { const int pid = Multitouch::getFirstActivePointerIdExThisUpdate(); if (pid >= 0) { xMouse = (int)(Multitouch::getX(pid) * Gui::InvGuiScale); @@ -163,7 +174,6 @@ void GameRenderer::render(float a) { yMouse = -9999; } } -#endif TIMER_POP(); bool hasClearedColorBuffer = false; @@ -173,33 +183,33 @@ void GameRenderer::render(float a) { TIMER_PUSH("level"); if (_t_keepPic < 0) { - if (!(mc->screen && !mc->screen->renderGameBehind())) { + if (!(mc->screen && !mc->screen->renderGameBehind())) { - if (mc->screen && mc->screen->hasClippingArea(screenScissorArea)) - useScreenScissor = true; + if (mc->screen && mc->screen->hasClippingArea(screenScissorArea)) + useScreenScissor = true; - renderLevel(a); - hasClearedColorBuffer = true; + renderLevel(a); + hasClearedColorBuffer = true; - if (!mc->options.hideGui) { - TIMER_POP_PUSH("gui"); - setupGuiScreen(false); - hasSetupGuiScreen = true; - mc->gui.render(a, mc->screen != NULL, xMouse, yMouse); - } - }} + if (!mc->options.getBooleanValue(OPTIONS_HIDEGUI)) { + TIMER_POP_PUSH("gui"); + setupGuiScreen(false); + hasSetupGuiScreen = true; + mc->gui.render(a, mc->screen != NULL, xMouse, yMouse); + } + }} TIMER_POP(); } else { - glViewport(0, 0, mc->width, mc->height); - glMatrixMode(GL_PROJECTION); - glLoadIdentity2(); - glMatrixMode(GL_MODELVIEW); - glLoadIdentity2(); - setupGuiScreen(true); + glViewport(0, 0, mc->width, mc->height); + glMatrixMode(GL_PROJECTION); + glLoadIdentity2(); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity2(); + setupGuiScreen(true); hasSetupGuiScreen = true; hasClearedColorBuffer = true; - } + } //@todo if (!hasSetupGuiScreen) setupGuiScreen(!hasClearedColorBuffer); @@ -209,24 +219,26 @@ void GameRenderer::render(float a) { if (mc->player->input) mc->player->input->render(a); } - if (mc->screen != NULL) { + if (mc->screen != NULL) { if (useScreenScissor) glDisable2(GL_SCISSOR_TEST); mc->screen->render(xMouse, yMouse, a); -#ifdef RPI - renderCursor(xMouse, yMouse, mc); -#endif + + mc->platform()->hideCursor(!mc->options.getBooleanValue(OPTIONS_RPI_CURSOR)); + if (mc->options.getBooleanValue(OPTIONS_RPI_CURSOR)) + renderCursor(xMouse, yMouse, mc); + // Screen might have been removed, so check it again if (mc->screen && !mc->screen->isInGameScreen()) sleepMs(15); - } + } } /*public*/ void GameRenderer::renderLevel(float a) { - if (mc->cameraTargetPlayer == NULL) { + if (mc->cameraTargetPlayer == NULL) { if (mc->player) { mc->cameraTargetPlayer = mc->player; @@ -235,156 +247,179 @@ void GameRenderer::renderLevel(float a) { { return; } - } + } TIMER_PUSH("pick"); - pick(a); + pick(a); - Mob* cameraEntity = mc->cameraTargetPlayer; - LevelRenderer* levelRenderer = mc->levelRenderer; - ParticleEngine* particleEngine = mc->particleEngine; - float xOff = cameraEntity->xOld + (cameraEntity->x - cameraEntity->xOld) * a; - float yOff = cameraEntity->yOld + (cameraEntity->y - cameraEntity->yOld) * a; - float zOff = cameraEntity->zOld + (cameraEntity->z - cameraEntity->zOld) * a; + Mob* cameraEntity = mc->cameraTargetPlayer; + LevelRenderer* levelRenderer = mc->levelRenderer; + ParticleEngine* particleEngine = mc->particleEngine; + float xOff = cameraEntity->xOld + (cameraEntity->x - cameraEntity->xOld) * a; + float yOff = cameraEntity->yOld + (cameraEntity->y - cameraEntity->yOld) * a; + float zOff = cameraEntity->zOld + (cameraEntity->z - cameraEntity->zOld) * a; - for (int i = 0; i < 2; i++) { - if (mc->options.anaglyph3d) { - if (i == 0) glColorMask(false, true, true, false); - else glColorMask(true, false, false, false); - } + for (int i = 0; i < 2; i++) { + if (mc->options.getBooleanValue(OPTIONS_ANAGLYPH_3D)) { + if (i == 0) glColorMask(false, true, true, false); + else glColorMask(true, false, false, false); + } TIMER_POP_PUSH("clear"); glViewport(0, 0, mc->width, mc->height); setupClearColor(a); - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - glEnable2(GL_CULL_FACE); + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + glEnable2(GL_CULL_FACE); TIMER_POP_PUSH("camera"); - setupCamera(a, i); + setupCamera(a, i); saveMatrices(); if (useScreenScissor) { glEnable2(GL_SCISSOR_TEST); glScissor( screenScissorArea.x, screenScissorArea.y, - screenScissorArea.w, screenScissorArea.h); + screenScissorArea.w, screenScissorArea.h); } - -// if(mc->options.fancyGraphics) { -// setupFog(-1); -// TIMER_POP_PUSH("sky"); -// glFogf(GL_FOG_START, renderDistance * 0.2f); -// glFogf(GL_FOG_END, renderDistance *0.75); -// levelRenderer->renderSky(a); -// glFogf(GL_FOG_START, renderDistance * 0.6f); -// glFogf(GL_FOG_END, renderDistance); -// } - glEnable2(GL_FOG); - setupFog(1); - if (mc->options.ambientOcclusion) { - glShadeModel2(GL_SMOOTH); + + + if (mc->options.getBooleanValue(OPTIONS_AMBIENT_OCCLUSION)) { + glShadeModel2(GL_SMOOTH); } - + TIMER_POP_PUSH("frustrum"); FrustumCuller frustum; - frustum.prepare(xOff, yOff, zOff); + frustum.prepare(xOff, yOff, zOff); TIMER_POP_PUSH("culling"); - mc->levelRenderer->cull(&frustum, a); - mc->levelRenderer->updateDirtyChunks(cameraEntity, false); + mc->levelRenderer->cull(&frustum, a); + mc->levelRenderer->updateDirtyChunks(cameraEntity, false); + // this sky rendering code below was originally before the frustrum and culling stuff but sunset color breaks for some reason in that place, so i moved i after those two - shredder +// if(mc->options.getBooleanValue(OPTIONS_FANCY_GRAPHICS)) { + setupFog(-1); + TIMER_POP_PUSH("sky"); + // @TODO - EXTREME JANK BELOW, it works but i have to do heavy cleanup here, also to test if the glfogf commands even affect fog in anyway. + if(mc->options.getBooleanValue(OPTIONS_BETA_SKY) && (mc->options.getIntValue(OPTIONS_VIEW_DISTANCE) < 2)){ + levelRenderer->renderSky(a); // how java renders the sky instead of how pe doing prepareandrenderclouds. + } else if (!mc->options.getBooleanValue(OPTIONS_BETA_SKY)){ + glFogf(GL_FOG_START, renderDistance * 0.2f); + glFogf(GL_FOG_END, renderDistance *0.75); - if(mc->options.fancyGraphics) { + glFogf(GL_FOG_START, renderDistance * 0.6f); + glFogf(GL_FOG_END, renderDistance); + } +// } + glEnable2(GL_FOG); + setupFog(1); + // MCPE renders clouds using this, but this method breaks 3d clouds and also breaks 2d clouds transparency viewed from above, add as a Legacy Sky or Fast Sky option. - shredder + if(!mc->options.getBooleanValue(OPTIONS_BETA_SKY)){ + if(mc->options.getBooleanValue(OPTIONS_FANCY_GRAPHICS)) { prepareAndRenderClouds(levelRenderer, a); } + } - setupFog(0); - glEnable2(GL_FOG); + setupFog(0); + glEnable2(GL_FOG); mc->textures->loadAndBindTexture("terrain.png"); - glDisable2(GL_ALPHA_TEST); - glDisable2(GL_BLEND); - glEnable2(GL_CULL_FACE); - TIMER_POP_PUSH("terrain-0"); - levelRenderer->render(cameraEntity, 0, a); + Lighting::turnOff(); - TIMER_POP_PUSH("terrain-1"); - glEnable2(GL_ALPHA_TEST); - levelRenderer->render(cameraEntity, 1, a); - - glShadeModel2(GL_FLAT); - TIMER_POP_PUSH("entities"); - mc->levelRenderer->renderEntities(cameraEntity->getPos(a), &frustum, a); -// setupFog(0); - TIMER_POP_PUSH("particles"); - particleEngine->render(cameraEntity, a); +// glDisable2(GL_ALPHA_TEST); // vanilla pe disables alpha test here, i renable it so grass side textures dont become opaque - shredder + glEnable2(GL_ALPHA_TEST); // glDisable2(GL_BLEND); - glBlendFunc2(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - setupFog(0); - glEnable2(GL_BLEND); - glDisable2(GL_CULL_FACE); - glDepthMask(GL_FALSE); - glDisable2(GL_ALPHA_TEST); + glEnable2(GL_CULL_FACE); + TIMER_POP_PUSH("terrain-0"); + levelRenderer->render(cameraEntity, 0, a); + + TIMER_POP_PUSH("terrain-1"); + glEnable2(GL_ALPHA_TEST); + levelRenderer->render(cameraEntity, 1, a); + + glShadeModel2(GL_FLAT); + Lighting::turnOn(mc); + TIMER_POP_PUSH("entities"); + mc->levelRenderer->renderEntities(cameraEntity->getPos(a), &frustum, a); + // setupFog(0); + TIMER_POP_PUSH("particles"); + particleEngine->render(cameraEntity, a); + Lighting::turnOff(); + glDisable2(GL_BLEND); + glBlendFunc2(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + Lighting::turnOff(); + setupFog(0); + glEnable2(GL_BLEND); + glDisable2(GL_CULL_FACE); + glDepthMask(GL_FALSE); // @TODO commenting this out fixes Ice transparency and clouds are no longer visilbe underwater like normal beta - shredder + glDisable2(GL_ALPHA_TEST); mc->textures->loadAndBindTexture("terrain.png"); - //if (mc->options.fancyGraphics) { - // glColorMask(false, false, false, false); - // int visibleWaterChunks = levelRenderer->render(cameraEntity, 1, a); - // glColorMask(true, true, true, true); - // if (mc->options.anaglyph3d) { - // if (i == 0) glColorMask(false, true, true, false); - // else glColorMask(true, false, false, false); - // } - // if (visibleWaterChunks > 0) { - // levelRenderer->renderSameAsLast(1, a); - // } - //} else + // @TODO - below is a commented out double render system that fixes ice transparency, but probs harm performance, add it as an option - shredder + + //if (mc->options.fancyGraphics) { + // glColorMask(false, false, false, false); + // int visibleWaterChunks = levelRenderer->render(cameraEntity, 1, a); + // glColorMask(true, true, true, true); + // if (mc->options.anaglyph3d) { + // if (i == 0) glColorMask(false, true, true, false); + // else glColorMask(true, false, false, false); + // } + // if (visibleWaterChunks > 0) { + // levelRenderer->renderSameAsLast(1, a); + // } + //} else { //glDepthRangef(0.1f, 1.0f); //glDepthMask(GL_FALSE); TIMER_POP_PUSH("terrain-water"); glEnable2(GL_DEPTH_TEST); - levelRenderer->render(cameraEntity, 2, a); + levelRenderer->render(cameraEntity, 2, a); //glDepthRangef(0, 1); - } - + } + glDepthMask(GL_TRUE); - glEnable2(GL_CULL_FACE); - glDisable2(GL_BLEND); - glEnable2(GL_ALPHA_TEST); + glEnable2(GL_CULL_FACE); + glDisable2(GL_BLEND); + glEnable2(GL_ALPHA_TEST); if (/*!Minecraft::FLYBY_MODE &&*/ zoom == 1 && cameraEntity->isPlayer()) { if (mc->hitResult.isHit() && !cameraEntity->isUnderLiquid(Material::water)) { TIMER_POP_PUSH("select"); Player* player = (Player*) cameraEntity; - if (mc->useTouchscreen()) { - levelRenderer->renderHitSelect(player, mc->hitResult, 0, NULL, a); //player.inventory->getSelected(), a); + // if (mc->useTouchscreen()) { + if (mc->options.getBooleanValue(OPTIONS_BLOCK_OUTLINE)){ + levelRenderer->renderHitOutline(player, mc->hitResult, 0, NULL, a); //player.inventory->getSelected(), a); // java block outline one + } else { + levelRenderer->renderHitSelect(player, mc->hitResult, 0, NULL, a); //player.inventory->getSelected(), a); // normal pe one - shredder } levelRenderer->renderHit(player, mc->hitResult, 0, NULL, a);//player->inventory.getSelected(), a); } } glDisable2(GL_FOG); -// -// setupFog(0); -// glEnable2(GL_FOG); -//// levelRenderer->renderClouds(a); -// glDisable2(GL_FOG); - setupFog(1); + // Normally this is commented out, but this is how java does it and should fix both 2d/3d clouds, a + if(mc->options.getBooleanValue(OPTIONS_BETA_SKY)){ + setupFog(0); + glEnable2(GL_FOG); + levelRenderer->renderClouds(a); + glDisable2(GL_FOG); + } + // SHREDDER END + setupFog(1); - if (zoom == 1) { + if (zoom == 1 && !mc->options.getBooleanValue(OPTIONS_HIDEGUI)) { TIMER_POP_PUSH("hand"); - glClear(GL_DEPTH_BUFFER_BIT); - renderItemInHand(a, i); - } + glClear(GL_DEPTH_BUFFER_BIT); + renderItemInHand(a, i); + } - if (!mc->options.anaglyph3d) { + if (!mc->options.getBooleanValue(OPTIONS_ANAGLYPH_3D)) { TIMER_POP(); - return; - } - } - glColorMask(true, true, true, false); + return; + } + } + glColorMask(true, true, true, false); TIMER_POP(); } @@ -398,40 +433,40 @@ void GameRenderer::tickFov() { /*private*/ float GameRenderer::getFov(float a, bool applyEffects) { - Mob* player = mc->cameraTargetPlayer; - float fov = 70; + Mob* player = mc->cameraTargetPlayer; + float fov = 70; if (applyEffects) fov *= this->oFov + (this->fov - this->oFov) * a; - if (player->isUnderLiquid(Material::water)) fov = 60; - if (player->health <= 0) { - float duration = player->deathTime + a; + if (player->isUnderLiquid(Material::water)) fov = 60; + if (player->hasDied()) { + float duration = player->deathTime + a; - fov /= ((1 - 500 / (duration + 500)) * 2.0f + 1); - } - return fov + fovOffsetO + (fovOffset - fovOffsetO) * a; + fov /= ((1 - 500 / (duration + 500)) * 2.0f + 1); + } + return fov + fovOffsetO + (fovOffset - fovOffsetO) * a; } /*private*/ void GameRenderer::moveCameraToPlayer(float a) { - Entity* player = mc->cameraTargetPlayer; + Entity* player = mc->cameraTargetPlayer; - float heightOffset = player->heightOffset - 1.62f; + float heightOffset = player->heightOffset - 1.62f; - float x = player->xo + (player->x - player->xo) * a; - float y = player->yo + (player->y - player->yo) * a - heightOffset; + float x = player->xo + (player->x - player->xo) * a; + float y = player->yo + (player->y - player->yo) * a - heightOffset; //printf("camera y: %f\n", y); - float z = player->zo + (player->z - player->zo) * a; + float z = player->zo + (player->z - player->zo) * a; //printf("rot: %f %f\n", cameraRollO, cameraRoll); - glRotatef2(cameraRollO + (cameraRoll - cameraRollO) * a, 0, 0, 1); + glRotatef2(cameraRollO + (cameraRoll - cameraRollO) * a, 0, 0, 1); //LOGI("player. alive, removed: %d, %d\n", player->isAlive(), player->removed); if(player->isPlayer() && ((Player*)player)->isSleeping()) { heightOffset += 1.0; glTranslatef(0.0f, 0.3f, 0); - if (!mc->options.fixedCamera) { + if (!mc->options.getBooleanValue(OPTIONS_FIXED_CAMERA)) { int t = mc->level->getTile(Mth::floor(player->x), Mth::floor(player->y), Mth::floor(player->z)); if (t == Tile::bed->id) { int data = mc->level->getData(Mth::floor(player->x), Mth::floor(player->y), Mth::floor(player->z)); @@ -442,285 +477,283 @@ void GameRenderer::moveCameraToPlayer(float a) { glRotatef(player->yRotO + (player->yRot - player->yRotO) * a + 180, 0, -1, 0); glRotatef(player->xRotO + (player->xRot - player->xRotO) * a, -1, 0, 0); } - } else if (mc->options.thirdPersonView/* || (player->isPlayer() && !player->isAlive())*/) { - float cameraDist = thirdDistanceO + (thirdDistance - thirdDistanceO) * a; + } else if (mc->options.getBooleanValue(OPTIONS_THIRD_PERSON_VIEW)/* || (player->isPlayer() && !player->isAlive())*/) { + float cameraDist = thirdDistanceO + (thirdDistance - thirdDistanceO) * a; - if (mc->options.fixedCamera) { + if (mc->options.getBooleanValue(OPTIONS_FIXED_CAMERA)) { - float rotationY = thirdRotationO + (thirdRotation - thirdRotationO) * a; - float xRot = thirdTiltO + (thirdTilt - thirdTiltO) * a; + float rotationY = thirdRotationO + (thirdRotation - thirdRotationO) * a; + float xRot = thirdTiltO + (thirdTilt - thirdTiltO) * a; - glTranslatef2(0, 0, (float) -cameraDist); - glRotatef2(xRot, 1, 0, 0); - glRotatef2(rotationY, 0, 1, 0); - } else { - float yRot = player->yRot; - float xRot = player->xRot/* + 180.0f*/; - float xd = -Mth::sin(yRot / 180 * Mth::PI) * Mth::cos(xRot / 180 * Mth::PI) * cameraDist; - float zd = Mth::cos(yRot / 180 * Mth::PI) * Mth::cos(xRot / 180 * Mth::PI) * cameraDist; - float yd = -Mth::sin(xRot / 180 * Mth::PI) * cameraDist; + glTranslatef2(0, 0, (float) -cameraDist); + glRotatef2(xRot, 1, 0, 0); + glRotatef2(rotationY, 0, 1, 0); + } else { + float yRot = player->yRot; + float xRot = player->xRot/* + 180.0f*/; + float xd = -Mth::sin(yRot / 180 * Mth::PI) * Mth::cos(xRot / 180 * Mth::PI) * cameraDist; + float zd = Mth::cos(yRot / 180 * Mth::PI) * Mth::cos(xRot / 180 * Mth::PI) * cameraDist; + float yd = -Mth::sin(xRot / 180 * Mth::PI) * cameraDist; - for (int i = 0; i < 8; i++) { - float xo = (float)((i & 1) * 2 - 1); - float yo = (float)(((i >> 1) & 1) * 2 - 1); - float zo = (float)(((i >> 2) & 1) * 2 - 1); + for (int i = 0; i < 8; i++) { + float xo = (float)((i & 1) * 2 - 1); + float yo = (float)(((i >> 1) & 1) * 2 - 1); + float zo = (float)(((i >> 2) & 1) * 2 - 1); - xo *= 0.1f; - yo *= 0.1f; - zo *= 0.1f; + xo *= 0.1f; + yo *= 0.1f; + zo *= 0.1f; - HitResult hr = mc->level->clip(Vec3(x + xo, y + yo, z + zo), Vec3(x - xd + xo + zo, y - yd + yo, z - zd + zo)); // newTemp + HitResult hr = mc->level->clip(Vec3(x + xo, y + yo, z + zo), Vec3(x - xd + xo + zo, y - yd + yo, z - zd + zo)); // newTemp if (hr.type != NO_HIT) { - float dist = hr.pos.distanceTo(Vec3(x, y, z)); // newTemp - if (dist < cameraDist) cameraDist = dist; - } - } + float dist = hr.pos.distanceTo(Vec3(x, y, z)); // newTemp + if (dist < cameraDist) cameraDist = dist; + } + } //glRotatef2(180, 0, 1, 0); glRotatef2(player->xRot - xRot, 1, 0, 0); - glRotatef2(player->yRot - yRot, 0, 1, 0); - glTranslatef2(0, 0, (float) -cameraDist); - glRotatef2(yRot - player->yRot, 0, 1, 0); - glRotatef2(xRot - player->xRot, 1, 0, 0); - } - } else { - glTranslatef2(0, 0, -0.1f); - } + glRotatef2(player->yRot - yRot, 0, 1, 0); + glTranslatef2(0, 0, (float) -cameraDist); + glRotatef2(yRot - player->yRot, 0, 1, 0); + glRotatef2(xRot - player->xRot, 1, 0, 0); + } + } else { + glTranslatef2(0, 0, -0.1f); + } - if (!mc->options.fixedCamera) { - glRotatef2(player->xRotO + (player->xRot - player->xRotO) * a, 1.0f, 0.0f, 0.0f); - glRotatef2(player->yRotO + (player->yRot - player->yRotO) * a + 180, 0, 1, 0); + if (!mc->options.getBooleanValue(OPTIONS_FIXED_CAMERA)) { + glRotatef2(player->xRotO + (player->xRot - player->xRotO) * a, 1.0f, 0.0f, 0.0f); + glRotatef2(player->yRotO + (player->yRot - player->yRotO) * a + 180, 0, 1, 0); //if (_t_keepPic > 0) } - glTranslatef2(0, heightOffset, 0); + glTranslatef2(0, heightOffset, 0); } /*private*/ void GameRenderer::bobHurt(float a) { - Mob* player = mc->cameraTargetPlayer; + Mob* player = mc->cameraTargetPlayer; - float hurt = player->hurtTime - a; + float hurt = player->hurtTime - a; - if (player->health <= 0) { - float duration = player->deathTime + a; - glRotatef2(40 - (40 * 200) / (duration + 200), 0, 0, 1); - } + if (player->hasDied()) { + float duration = player->deathTime + a; + glRotatef2(40 - (40 * 200) / (duration + 200), 0, 0, 1); + } - if (player->hurtTime <= 0) return; + if (player->hurtTime <= 0) return; hurt /= player->hurtDuration; - hurt = (float) Mth::sin(hurt * hurt * hurt * hurt * Mth::PI); + hurt = (float) Mth::sin(hurt * hurt * hurt * hurt * Mth::PI); - float rr = player->hurtDir; + float rr = player->hurtDir; - glRotatef2(-rr, 0, 1, 0); - glRotatef2(-hurt * 14, 0, 0, 1); - glRotatef2(+rr, 0, 1, 0); + glRotatef2(-rr, 0, 1, 0); + glRotatef2(-hurt * 14, 0, 0, 1); + glRotatef2(+rr, 0, 1, 0); } /*private*/ void GameRenderer::bobView(float a) { - //if (mc->options.thirdPersonView) return; + //if (mc->options.thirdPersonView) return; if (!(mc->cameraTargetPlayer->isPlayer())) { - return; - } - Player* player = (Player*) mc->cameraTargetPlayer; + return; + } + Player* player = (Player*) mc->cameraTargetPlayer; - float wda = player->walkDist - player->walkDistO; - float b = -(player->walkDist + wda * a); - float bob = player->oBob + (player->bob - player->oBob) * a; - float tilt = player->oTilt + (player->tilt - player->oTilt) * a; - glTranslatef2((float) Mth::sin(b * Mth::PI) * bob * 0.5f, -(float) std::abs(Mth::cos(b * Mth::PI) * bob), 0); - glRotatef2((float) Mth::sin(b * Mth::PI) * bob * 3, 0, 0, 1); - glRotatef2((float) std::abs(Mth::cos(b * Mth::PI - 0.2f) * bob) * 5, 1, 0, 0); - glRotatef2((float) tilt, 1, 0, 0); + float wda = player->walkDist - player->walkDistO; + float b = -(player->walkDist + wda * a); + float bob = player->oBob + (player->bob - player->oBob) * a; + float tilt = player->oTilt + (player->tilt - player->oTilt) * a; + glTranslatef2((float) Mth::sin(b * Mth::PI) * bob * 0.5f, -(float) std::abs(Mth::cos(b * Mth::PI) * bob), 0); + glRotatef2((float) Mth::sin(b * Mth::PI) * bob * 3, 0, 0, 1); + glRotatef2((float) std::abs(Mth::cos(b * Mth::PI - 0.2f) * bob) * 5, 1, 0, 0); + glRotatef2((float) tilt, 1, 0, 0); } /*private*/ void GameRenderer::setupFog(int i) { - Mob* player = mc->cameraTargetPlayer; + Mob* player = mc->cameraTargetPlayer; float fogBuffer[4] = {fr, fg, fb, 1}; - glFogfv(GL_FOG_COLOR, (GLfloat*)fogBuffer); - glColor4f2(1, 1, 1, 1); + glFogfv(GL_FOG_COLOR, (GLfloat*)fogBuffer); + glColor4f2(1, 1, 1, 1); - if (player->isUnderLiquid(Material::water)) { - glFogx(GL_FOG_MODE, GL_EXP); - glFogf(GL_FOG_DENSITY, 0.1f); // was 0.06 + if (player->isUnderLiquid(Material::water)) { + glFogx(GL_FOG_MODE, GL_EXP); + glFogf(GL_FOG_DENSITY, 0.1f); // was 0.06 -// float rr = 0.4f; -// float gg = 0.4f; -// float bb = 0.9f; -// -// if (mc->options.anaglyph3d) { -// float rrr = (rr * 30 + gg * 59 + bb * 11) / 100; -// float ggg = (rr * 30 + gg * 70) / (100); -// float bbb = (rr * 30 + bb * 70) / (100); -// -// rr = rrr; -// gg = ggg; -// bb = bbb; -// } - } else if (player->isUnderLiquid(Material::lava)) { - glFogx(GL_FOG_MODE, GL_EXP); - glFogf(GL_FOG_DENSITY, 2.f); // was 0.06 -// float rr = 0.4f; -// float gg = 0.3f; -// float bb = 0.3f; -// -// if (mc->options.anaglyph3d) { -// float rrr = (rr * 30 + gg * 59 + bb * 11) / 100; -// float ggg = (rr * 30 + gg * 70) / (100); -// float bbb = (rr * 30 + bb * 70) / (100); -// -// rr = rrr; -// gg = ggg; -// bb = bbb; -// } - } else { - glFogx(GL_FOG_MODE, GL_LINEAR); - glFogf(GL_FOG_START, renderDistance * 0.6f); - glFogf(GL_FOG_END, renderDistance); - if (i < 0) { - glFogf(GL_FOG_START, 0); - glFogf(GL_FOG_END, renderDistance * 1.0f); - } + // float rr = 0.4f; + // float gg = 0.4f; + // float bb = 0.9f; + // + // if (mc->options.anaglyph3d) { + // float rrr = (rr * 30 + gg * 59 + bb * 11) / 100; + // float ggg = (rr * 30 + gg * 70) / (100); + // float bbb = (rr * 30 + bb * 70) / (100); + // + // rr = rrr; + // gg = ggg; + // bb = bbb; + // } + } else if (player->isUnderLiquid(Material::lava)) { + glFogx(GL_FOG_MODE, GL_EXP); + glFogf(GL_FOG_DENSITY, 2.f); // was 0.06 + // float rr = 0.4f; + // float gg = 0.3f; + // float bb = 0.3f; + // + // if (mc->options.anaglyph3d) { + // float rrr = (rr * 30 + gg * 59 + bb * 11) / 100; + // float ggg = (rr * 30 + gg * 70) / (100); + // float bbb = (rr * 30 + bb * 70) / (100); + // + // rr = rrr; + // gg = ggg; + // bb = bbb; + // } + } else { + glFogx(GL_FOG_MODE, GL_LINEAR); + glFogf(GL_FOG_START, renderDistance * 0.6f); + glFogf(GL_FOG_END, renderDistance); + if (i < 0) { + glFogf(GL_FOG_START, 0); + glFogf(GL_FOG_END, renderDistance * 1.0f); + } - if (mc->level->dimension->foggy) { - glFogf(GL_FOG_START, 0); - } - } + if (mc->level->dimension->foggy) { + glFogf(GL_FOG_START, 0); + } + } - glEnable2(GL_COLOR_MATERIAL); - //glColorMaterial(GL_FRONT, GL_AMBIENT); + glEnable2(GL_COLOR_MATERIAL); + //glColorMaterial(GL_FRONT, GL_AMBIENT); } void GameRenderer::updateAllChunks() { - mc->levelRenderer->updateDirtyChunks(mc->cameraTargetPlayer, true); + mc->levelRenderer->updateDirtyChunks(mc->cameraTargetPlayer, true); } bool GameRenderer::updateFreeformPickDirection(float a, Vec3& outDir) { - if (!mc->inputHolder->allowPicking()) { - _shTicks = 1; - return false; - } + if (!mc->inputHolder->allowPicking()) { + _shTicks = 1; + return false; + } - Vec3 c = mc->cameraTargetPlayer->getPos(a); + Vec3 c = mc->cameraTargetPlayer->getPos(a); - bool firstPerson = !mc->options.thirdPersonView; - const float PickingDistance = firstPerson? 6.0f : 12.0f; + bool firstPerson = !mc->options.getBooleanValue(OPTIONS_THIRD_PERSON_VIEW); + const float PickingDistance = firstPerson? 6.0f : 12.0f; - _shTicks = -1; + _shTicks = -1; - int vp[4] = {0, 0, mc->width, mc->height}; - float pt[3]; - float x = mc->inputHolder->mousex; - float y = mc->height - mc->inputHolder->mousey; + int vp[4] = {0, 0, mc->width, mc->height}; + float pt[3]; + float x = mc->inputHolder->mousex; + float y = mc->height - mc->inputHolder->mousey; - //sw.start(); + //sw.start(); - if (!glhUnProjectf(x, y, 1, lastModelMatrix, lastProjMatrix, vp, pt)) { - return false; - } - Vec3 p1(pt[0] + c.x, pt[1] + c.y, pt[2] + c.z); + if (!glhUnProjectf(x, y, 1, lastModelMatrix, lastProjMatrix, vp, pt)) { + return false; + } + Vec3 p1(pt[0] + c.x, pt[1] + c.y, pt[2] + c.z); - glhUnProjectf(x, y, 0, lastModelMatrix, lastProjMatrix, vp, pt); - Vec3 p0(pt[0] + c.x, pt[1] + c.y, pt[2] + c.z); + glhUnProjectf(x, y, 0, lastModelMatrix, lastProjMatrix, vp, pt); + Vec3 p0(pt[0] + c.x, pt[1] + c.y, pt[2] + c.z); - outDir = (p1 - p0).normalized(); - p1 = p0 + outDir * PickingDistance; + outDir = (p1 - p0).normalized(); + p1 = p0 + outDir * PickingDistance; - //sw.stop(); - //sw.printEvery(30, "unproject "); + //sw.stop(); + //sw.printEvery(30, "unproject "); - const HitResult& hit = mc->hitResult = mc->level->clip(p0, p1, false); + const HitResult& hit = mc->hitResult = mc->level->clip(p0, p1, false); - // If in 3rd person view - verify that the hit target is within range - if (!firstPerson && hit.isHit()) { - const float MaxSqrDist = PickingDistance*PickingDistance; - if (mc->cameraTargetPlayer->distanceToSqr((float)hit.x, (float)hit.y, (float)hit.z) > MaxSqrDist) - mc->hitResult.type = NO_HIT; - } - return true; + // If in 3rd person view - verify that the hit target is within range + if (!firstPerson && hit.isHit()) { + const float MaxSqrDist = PickingDistance*PickingDistance; + if (mc->cameraTargetPlayer->distanceToSqr((float)hit.x, (float)hit.y, (float)hit.z) > MaxSqrDist) + mc->hitResult.type = NO_HIT; + } + return true; } /*public*/ void GameRenderer::pick(float a) { if (mc->level == NULL) return; - if (mc->cameraTargetPlayer == NULL) return; + if (mc->cameraTargetPlayer == NULL) return; if (!mc->cameraTargetPlayer->isAlive()) return; - float range = mc->gameMode->getPickRange(); - bool isPicking = true; -#ifndef PLATFORM_DESKTOP - bool freeform = mc->useTouchscreen() && !mc->options.isJoyTouchArea; -#else - bool freeform = false; -#endif - if (freeform) { - isPicking = updateFreeformPickDirection(a, pickDirection); - } else { - mc->hitResult = mc->cameraTargetPlayer->pick(range, a); - pickDirection = mc->cameraTargetPlayer->getViewVector(a); - } + float range = mc->gameMode->getPickRange(); + bool isPicking = true; - Vec3 from = mc->cameraTargetPlayer->getPos(a); - float dist = range; + bool freeform = mc->useTouchscreen() && !mc->options.getBooleanValue(OPTIONS_IS_JOY_TOUCH_AREA); + + if (freeform) { + isPicking = updateFreeformPickDirection(a, pickDirection); + } else { + mc->hitResult = mc->cameraTargetPlayer->pick(range, a); + pickDirection = mc->cameraTargetPlayer->getViewVector(a); + } + + Vec3 from = mc->cameraTargetPlayer->getPos(a); + float dist = range; if (mc->hitResult.isHit()) { - dist = mc->hitResult.pos.distanceTo(from); - } + dist = mc->hitResult.pos.distanceTo(from); + } if (mc->gameMode->isCreativeType()) { - /*dist =*/ range = 12; - } else { - if (dist > 3) dist = 3; - range = dist; - } + /*dist =*/ range = 12; + } else { + if (dist > 3) dist = 3; + range = dist; + } - Vec3 pv = (pickDirection * range); - Vec3 to = from + pv; - mc->cameraTargetPlayer->aimDirection = pickDirection; + Vec3 pv = (pickDirection * range); + Vec3 to = from + pv; + mc->cameraTargetPlayer->aimDirection = pickDirection; - Entity* hovered = NULL; - const float g = 1; - AABB aabb = mc->cameraTargetPlayer->bb.expand(pv.x, pv.y, pv.z).grow(g, g, g); + Entity* hovered = NULL; + const float g = 1; + AABB aabb = mc->cameraTargetPlayer->bb.expand(pv.x, pv.y, pv.z).grow(g, g, g); EntityList& objects = mc->level->getEntities(mc->cameraTargetPlayer, aabb); - float nearest = 0; - for (unsigned int i = 0; i < objects.size(); i++) { - Entity* e = objects[i]; - if (!e->isPickable()) continue; + float nearest = 0; + for (unsigned int i = 0; i < objects.size(); i++) { + Entity* e = objects[i]; + if (!e->isPickable()) continue; - float rr = e->getPickRadius(); - AABB bb = e->bb.grow(rr, rr, rr); - HitResult p = bb.clip(from, to); + float rr = e->getPickRadius(); + AABB bb = e->bb.grow(rr, rr, rr); + HitResult p = bb.clip(from, to); //printf("Clip Hitresult %d (%d)\n", p.type, p.isHit()); - if (bb.contains(from)) { - //@todo: hovered = e; break; ? - if (nearest >= 0) { - hovered = e; - nearest = 0; - } + if (bb.contains(from)) { + //@todo: hovered = e; break; ? + if (nearest >= 0) { + hovered = e; + nearest = 0; + } } else if (p.isHit()) { - float dd = from.distanceTo(p.pos); - if (dd < nearest || nearest == 0) { - hovered = e; - nearest = dd; - } - } - } + float dd = from.distanceTo(p.pos); + if (dd < nearest || nearest == 0) { + hovered = e; + nearest = dd; + } + } + } - if (hovered != NULL) { + if (hovered != NULL) { if(nearest < dist) { mc->hitResult = HitResult(hovered); } - } + } else if (isPicking && !mc->hitResult.isHit()) { // if we don't have a hit result, attempt to hit the edge of the block we are standing on // (this is an pocket edition simplification to help building floors) - //LOGI("hovered : %d (%f)\n", mc->hitResult.type, viewVec.y); + //LOGI("hovered : %d (%f)\n", mc->hitResult.type, viewVec.y); if (pickDirection.y < -.7f) { // looking down by more than roughly 45 degrees, fetch a hit to the block standing on Vec3 to = from.add(0, -2.0f, 0); @@ -731,9 +764,9 @@ void GameRenderer::pick(float a) { mc->hitResult.indirectHit = true; // change face (not up) if (std::abs(pickDirection.x) > std::abs(pickDirection.z)) { - mc->hitResult.f = (pickDirection.x < 0)? 4 : 5; + mc->hitResult.f = (pickDirection.x < 0)? 4 : 5; } else { - mc->hitResult.f = (pickDirection.z < 0)? 2 : 3; + mc->hitResult.f = (pickDirection.z < 0)? 2 : 3; } } } @@ -756,93 +789,93 @@ void GameRenderer::tick(int nTick, int maxTick) { //LOGI("x: %f\n", _rotX); - if (nTick == maxTick) { - const float tickMult = 1.0f / (float)(1 + maxTick); - _rotXlast = 0.4f * std::pow(std::abs(_rotX), 1.2f) * tickMult; - if (_rotX < 0) _rotXlast = -_rotXlast; + if (nTick == maxTick) { + const float tickMult = 1.0f / (float)(1 + maxTick); + _rotXlast = 0.4f * std::pow(std::abs(_rotX), 1.2f) * tickMult; + if (_rotX < 0) _rotXlast = -_rotXlast; - _rotYlast = 0.4f * std::pow(std::abs(_rotY), 1.2f) * tickMult; - if (_rotY < 0) _rotYlast = -_rotYlast; + _rotYlast = 0.4f * std::pow(std::abs(_rotY), 1.2f) * tickMult; + if (_rotY < 0) _rotYlast = -_rotYlast; - _rotX = 0; - _rotY = 0; - } + _rotX = 0; + _rotY = 0; + } - fogBrO = fogBr; - thirdDistanceO = thirdDistance; - thirdRotationO = thirdRotation; - thirdTiltO = thirdTilt; - fovOffsetO = fovOffset; - cameraRollO = cameraRoll; + fogBrO = fogBr; + thirdDistanceO = thirdDistance; + thirdRotationO = thirdRotation; + thirdTiltO = thirdTilt; + fovOffsetO = fovOffset; + cameraRollO = cameraRoll; - if (mc->cameraTargetPlayer == NULL) { - mc->cameraTargetPlayer = mc->player; - } + if (mc->cameraTargetPlayer == NULL) { + mc->cameraTargetPlayer = mc->player; + } tickFov(); - float brr = mc->level->getBrightness( Mth::floor(mc->cameraTargetPlayer->x), - Mth::floor(mc->cameraTargetPlayer->y), - Mth::floor(mc->cameraTargetPlayer->z)); + float brr = mc->level->getBrightness( Mth::floor(mc->cameraTargetPlayer->x), + Mth::floor(mc->cameraTargetPlayer->y), + Mth::floor(mc->cameraTargetPlayer->z)); - float whiteness = (3 - mc->options.viewDistance) / 3.0f; - float fogBrT = brr * (1 - whiteness) + whiteness; - fogBr += (fogBrT - fogBr) * 0.1f; + float whiteness = (3 - mc->options.getIntValue(OPTIONS_VIEW_DISTANCE)) / 3.0f; + float fogBrT = brr * (1 - whiteness) + whiteness; + fogBr += (fogBrT - fogBr) * 0.1f; - _tick++; + _tick++; - itemInHandRenderer->tick(); -// if (mc->isRaining) tickRain(); + itemInHandRenderer->tick(); + // if (mc->isRaining) tickRain(); } /*private*/ void GameRenderer::setupClearColor(float a) { - Level* level = mc->level; - Mob* player = mc->cameraTargetPlayer; + Level* level = mc->level; + Mob* player = mc->cameraTargetPlayer; - float whiteness = 1.0f / (4 - mc->options.viewDistance); - whiteness = 1 - (float) pow(whiteness, 0.25f); + float whiteness = 1.0f / (4 - mc->options.getIntValue(OPTIONS_VIEW_DISTANCE)); + whiteness = 1 - (float) pow(whiteness, 0.25f); - Vec3 skyColor = level->getSkyColor(mc->cameraTargetPlayer, a); - float sr = (float) skyColor.x; - float sg = (float) skyColor.y; - float sb = (float) skyColor.z; + Vec3 skyColor = level->getSkyColor(mc->cameraTargetPlayer, a); + float sr = (float) skyColor.x; + float sg = (float) skyColor.y; + float sb = (float) skyColor.z; - Vec3 fogColor = level->getFogColor(a); - fr = (float) fogColor.x; - fg = (float) fogColor.y; - fb = (float) fogColor.z; + Vec3 fogColor = level->getFogColor(a); + fr = (float) fogColor.x; + fg = (float) fogColor.y; + fb = (float) fogColor.z; - fr += (sr - fr) * whiteness; - fg += (sg - fg) * whiteness; - fb += (sb - fb) * whiteness; + fr += (sr - fr) * whiteness; + fg += (sg - fg) * whiteness; + fb += (sb - fb) * whiteness; - if (player->isUnderLiquid(Material::water)) { - fr = 0.02f; - fg = 0.02f; - fb = 0.2f; - } else if (player->isUnderLiquid(Material::lava)) { - fr = 0.6f; - fg = 0.1f; - fb = 0.00f; - } + if (player->isUnderLiquid(Material::water)) { + fr = 0.02f; + fg = 0.02f; + fb = 0.2f; + } else if (player->isUnderLiquid(Material::lava)) { + fr = 0.6f; + fg = 0.1f; + fb = 0.00f; + } - float brr = fogBrO + (fogBr - fogBrO) * a; - fr *= brr; - fg *= brr; - fb *= brr; + float brr = fogBrO + (fogBr - fogBrO) * a; + fr *= brr; + fg *= brr; + fb *= brr; - if (mc->options.anaglyph3d) { - float frr = (fr * 30 + fg * 59 + fb * 11) / 100; - float fgg = (fr * 30 + fg * 70) / (100); - float fbb = (fr * 30 + fb * 70) / (100); + if (mc->options.getBooleanValue(OPTIONS_ANAGLYPH_3D)) { + float frr = (fr * 30 + fg * 59 + fb * 11) / 100; + float fgg = (fr * 30 + fg * 70) / (100); + float fbb = (fr * 30 + fb * 70) / (100); - fr = frr; - fg = fgg; - fb = fbb; - } + fr = frr; + fg = fgg; + fb = fbb; + } - glClearColor(fr, fg, fb, 1.0f); + glClearColor(fr, fg, fb, 1.0f); } void GameRenderer::zoomRegion( float zoom, float xa, float ya ) @@ -864,7 +897,7 @@ void GameRenderer::setupGuiScreen( bool clearColorBuffer ) // Setup GUI render mode GLbitfield clearBits = clearColorBuffer? - GL_DEPTH_BUFFER_BIT|GL_COLOR_BUFFER_BIT + GL_DEPTH_BUFFER_BIT|GL_COLOR_BUFFER_BIT : GL_DEPTH_BUFFER_BIT; glClear(clearBits); glMatrixMode(GL_PROJECTION); @@ -877,15 +910,15 @@ void GameRenderer::setupGuiScreen( bool clearColorBuffer ) /*private*/ void GameRenderer::renderItemInHand(float a, int eye) { - glLoadIdentity2(); - if (mc->options.anaglyph3d) glTranslatef2((eye * 2 - 1) * 0.10f, 0, 0); + glLoadIdentity2(); + if (mc->options.getBooleanValue(OPTIONS_ANAGLYPH_3D)) glTranslatef2((eye * 2 - 1) * 0.10f, 0, 0); - glPushMatrix2(); - bobHurt(a); - if (mc->options.bobView) bobView(a); + glPushMatrix2(); + bobHurt(a); + if (mc->options.getBooleanValue(OPTIONS_VIEW_BOBBING)) bobView(a); - if (!mc->options.thirdPersonView && (mc->cameraTargetPlayer->isPlayer() && !((Player*)mc->cameraTargetPlayer)->isSleeping())) { - if (!mc->options.hideGui) { + if (!mc->options.getBooleanValue(OPTIONS_THIRD_PERSON_VIEW) && (mc->cameraTargetPlayer->isPlayer() && !((Player*)mc->cameraTargetPlayer)->isSleeping())) { + if (!mc->options.getBooleanValue(OPTIONS_HIDEGUI)) { float fov = getFov(a, false); if (fov != _setupCameraFov) { glMatrixMode(GL_PROJECTION); @@ -893,16 +926,16 @@ void GameRenderer::renderItemInHand(float a, int eye) { gluPerspective(fov, mc->width / (float) mc->height, 0.05f, renderDistance); glMatrixMode(GL_MODELVIEW); } - itemInHandRenderer->render(a); - } - } + itemInHandRenderer->render(a); + } + } - glPopMatrix2(); - if (!mc->options.thirdPersonView && (mc->cameraTargetPlayer->isPlayer() && !((Player*)mc->cameraTargetPlayer)->isSleeping())) { - itemInHandRenderer->renderScreenEffect(a); - bobHurt(a); - } - if (mc->options.bobView) bobView(a); + glPopMatrix2(); + if (!mc->options.getBooleanValue(OPTIONS_THIRD_PERSON_VIEW) && (mc->cameraTargetPlayer->isPlayer() && !((Player*)mc->cameraTargetPlayer)->isSleeping())) { + itemInHandRenderer->renderScreenEffect(a); + bobHurt(a); + } + if (mc->options.getBooleanValue(OPTIONS_VIEW_BOBBING)) bobView(a); } void GameRenderer::onGraphicsReset() @@ -912,9 +945,9 @@ void GameRenderer::onGraphicsReset() void GameRenderer::saveMatrices() { - #if defined(RPI) - return; - #endif +#if defined(RPI) + return; +#endif static bool saved = false; //if (saved) return; diff --git a/src/client/renderer/ItemInHandRenderer.cpp b/src/client/renderer/ItemInHandRenderer.cpp index e63fd96..eb2be2b 100755 --- a/src/client/renderer/ItemInHandRenderer.cpp +++ b/src/client/renderer/ItemInHandRenderer.cpp @@ -21,11 +21,12 @@ #include "../../world/item/BowItem.h" #include "../../world/level/tile/LeafTile.h" #include "entity/HumanoidMobRenderer.h" +#include "Lighting.h" //static StopwatchHandler handler; ItemInHandRenderer::ItemInHandRenderer( Minecraft* mc ) -: mc(mc), + : mc(mc), lastSlot(-1), height(0), oHeight(0), @@ -49,21 +50,47 @@ ItemInHandRenderer::ItemInHandRenderer( Minecraft* mc ) void ItemInHandRenderer::tick() { oHeight = height; - item.id = 0; + //item.id = 0; ItemInstance* itemInHand = mc->player->inventory->getSelected(); - if (itemInHand && itemInHand->count > 0) { - item.id = itemInHand->id; - item.setAuxValue(itemInHand->getAuxValue()); + bool sameItem = (itemInHand && item.id == itemInHand->id && item.getAuxValue() == itemInHand->getAuxValue()); + + + + if (mc->options.getBooleanValue(OPTIONS_RESTORED_ANIMS)) // if enabled, restores and fixes item switching animation + { + if (!itemInHand && item.id == 0) sameItem = true; + float max = 0.4f; + float tHeight = sameItem ? 1 : 0; + float dd = tHeight - height; + if (dd < -max) dd = -max; + if (dd > max) dd = max; + + height += dd; + + if (height < 0.1){ + if (itemInHand && itemInHand->count > 0) { + item.id = itemInHand->id; + item.setAuxValue(itemInHand->getAuxValue()); + } else { + item.id = 0; + } + } + } else // otherwise use vanilla broken behaviour where it instantly switches items/blocks + { + if (itemInHand && itemInHand->count > 0) { + item.id = itemInHand->id; + item.setAuxValue(itemInHand->getAuxValue()); + } + + float max = 0.4f; + float tHeight = 1;//matches ? 1 : 0; + float dd = tHeight - height; + if (dd < -max) dd = -max; + if (dd > max) dd = max; + + height += dd; } - - float max = 0.4f; - float tHeight = 1;//matches ? 1 : 0; - float dd = tHeight - height; - if (dd < -max) dd = -max; - if (dd > max) dd = max; - - height += dd; } void ItemInHandRenderer::renderItem(Mob* mob, ItemInstance* item ) @@ -92,7 +119,7 @@ void ItemInHandRenderer::renderItem(Mob* mob, ItemInstance* item ) if(mob != NULL) { itemIcon = mob->getItemInHandIcon(item, 0); } - + bool reTesselate(false); if(itemIcon != lastIconRendered && lastItemRendered == itemId) reTesselate = true; @@ -139,9 +166,9 @@ void ItemInHandRenderer::renderItem(Mob* mob, ItemInstance* item ) float v1 = (vp * 16 + 15.99f) / 256.0f; float r = 1.0f; -// float xo = 0.0f; -// float yo = 0.3f; -/* + // float xo = 0.0f; + // float yo = 0.3f; + /* //glEnable2(GL_RESCALE_NORMAL); glTranslatef2(-xo, -yo, 0); float s = 1.5f; @@ -150,19 +177,28 @@ void ItemInHandRenderer::renderItem(Mob* mob, ItemInstance* item ) glRotatef2(50, 0, 1, 0); glRotatef2(45 + 290, 0, 0, 1); glTranslatef2(-15 / 16.0f, -1 / 16.0f, 0); -*/ + */ float dd = 1 / 16.0f; + float col = 1.0f; + float br = mc->player->getBrightness(0); + + t.color(col*br,col*br,col*br,1.0f); + t.normal(0.0f, 0.0f, 1.0f); t.vertexUV(0, 0, 0, u0, v1); t.vertexUV(r, 0, 0, u1, v1); t.vertexUV(r, 1, 0, u1, v0); t.vertexUV(0, 1, 0, u0, v0); + t.normal(0.0f, 0.0f, -1.0f); t.vertexUV(0, 1, 0 - dd, u0, v0); t.vertexUV(r, 1, 0 - dd, u1, v0); t.vertexUV(r, 0, 0 - dd, u1, v1); t.vertexUV(0, 0, 0 - dd, u0, v1); + col = 0.8f; + t.color(col*br,col*br,col*br,1.0f); + t.normal(-1.0f, 0.0f, 0.0f); for (int i = 0; i < 16; i++) { float p = i / 16.0f; float uu = u0 + (u1 - u0) * p - 0.5f / 256.0f; @@ -172,6 +208,7 @@ void ItemInHandRenderer::renderItem(Mob* mob, ItemInstance* item ) t.vertexUV(xx, 1, 0, uu, v0); t.vertexUV(xx, 1, 0 - dd, uu, v0); } + t.normal(1.0f, 0.0f, 0.0f); for (int i = 0; i < 16; i++) { float p = i / 16.0f; float uu = u0 + (u1 - u0) * p - 0.5f / 256.0f; @@ -181,6 +218,10 @@ void ItemInHandRenderer::renderItem(Mob* mob, ItemInstance* item ) t.vertexUV(xx, 0, 0, uu, v1); t.vertexUV(xx, 0, 0 - dd, uu, v1); } + + col = 0.6f; + t.color(col*br,col*br,col*br,1.0f); + t.normal(0.0f, 1.0f, 0.0f); for (int i = 0; i < 16; i++) { float p = i / 16.0f; float vv = v1 + (v0 - v1) * p - 0.5f / 256.0f; @@ -190,6 +231,7 @@ void ItemInHandRenderer::renderItem(Mob* mob, ItemInstance* item ) t.vertexUV(r, yy, 0 - dd, u1, vv); t.vertexUV(0, yy, 0 - dd, u0, vv); } + t.normal(0.0f, -1.0f, 0.0f); for (int i = 0; i < 16; i++) { float p = i / 16.0f; float vv = v1 + (v0 - v1) * p - 0.5f / 256.0f; @@ -219,7 +261,7 @@ void ItemInHandRenderer::renderItem(Mob* mob, ItemInstance* item ) } mc->textures->loadAndBindTexture(renderObject.texture); - drawArrayVT_NoState(renderObject.chunk.vboId, renderObject.chunk.vertexCount); + drawArrayVTN_NoState(renderObject.chunk.vboId, renderObject.chunk.vertexCount); if (renderObject.isFlat) glPopMatrix2(); } @@ -227,6 +269,7 @@ void ItemInHandRenderer::renderItem(Mob* mob, ItemInstance* item ) //handler.printEvery(100); } + void ItemInHandRenderer::render( float a ) { //return; @@ -237,12 +280,26 @@ void ItemInHandRenderer::render( float a ) float h = oHeight + (height - oHeight) * a; Player* player = mc->player; // if (selectedTile==NULL) return; + LocalPlayer* localPlayer = (LocalPlayer*)(player); + + float xr = player->xRotO + (player->xRot - player->xRotO) * a; // shredder added for hand swaying glPushMatrix2(); glRotatef2(player->xRotO + (player->xRot - player->xRotO) * a, 1, 0, 0); glRotatef2(player->yRotO + (player->yRot - player->yRotO) * a, 0, 1, 0); + glEnable(GL_RESCALE_NORMAL); + Lighting::turnOn(mc); glPopMatrix2(); + if (localPlayer) { // shredder added, basically does the hand swaying animation from b1.8 + float xrr = localPlayer->xBobO + (localPlayer->xBob - localPlayer->xBobO) * a; + float yrr = localPlayer->yBobO + (localPlayer->yBob - localPlayer->yBobO) * a; + // 4J - was using player->xRot and yRot directly here rather than interpolating between old & current with a + float yr = player->yRotO + (player->yRot - player->yRotO) * a; + glRotatef((xr - xrr) * 0.1f, 1, 0, 0); + glRotatef((yr - yrr) * 0.1f, 0, 1, 0); + } + float br = mc->level->getBrightness(Mth::floor(player->x), Mth::floor(player->y), Mth::floor(player->z)); ItemInstance* item;// = selectedItem; @@ -293,7 +350,7 @@ void ItemInHandRenderer::render( float a ) glTranslatef2(0.7f * d, -0.65f * d - (1 - h) * 0.6f, -0.9f * d); glRotatef2(45, 0, 1, 0); - //glEnable2(GL_RESCALE_NORMAL); + glEnable2(GL_RESCALE_NORMAL); glRotatef2(-swing3 * 20, 0, 1, 0); glRotatef2(-swing2 * 20, 0, 0, 1); glRotatef2(-swing2 * 80, 1, 0, 0); @@ -330,7 +387,9 @@ void ItemInHandRenderer::render( float a ) } glEnableClientState2(GL_VERTEX_ARRAY); glEnableClientState2(GL_TEXTURE_COORD_ARRAY); + glEnableClientState2(GL_NORMAL_ARRAY); renderItem(player, item); + glDisableClientState2(GL_NORMAL_ARRAY); glDisableClientState2(GL_VERTEX_ARRAY); glDisableClientState2(GL_TEXTURE_COORD_ARRAY); glPopMatrix2(); @@ -349,14 +408,15 @@ void ItemInHandRenderer::render( float a ) glTranslatef2(0.8f * d, -0.75f * d - (1 - h) * 0.6f, -0.9f * d); glRotatef2(45, 0, 1, 0); - //glEnable2(GL_RESCALE_NORMAL); +// glEnable2(GL_RESCALE_NORMAL); + glEnable(GL_NORMALIZE); glRotatef2(swing2 * 70, 0, 1, 0); glRotatef2(-swing3 * 20, 0, 0, 1); // glRotatef2(-swing2 * 80, 1, 0, 0); - mc->textures->loadAndBindTexture("mob/char.png"); + mc->textures->loadAndBindTexture(player->getTexture()); glTranslatef2(-1.0f, +3.6f, +3.5f); - glRotatef2(120, 0, 0, 1); + glRotatef2(120, 0, 0, 1); glRotatef2(180 + 20, 1, 0, 0); glRotatef2(-90 - 45, 0, 1, 0); glScalef2(1.5f / 24.0f * 16, 1.5f / 24.0f * 16, 1.5f / 24.0f * 16); @@ -364,13 +424,15 @@ void ItemInHandRenderer::render( float a ) EntityRenderer* er = EntityRenderDispatcher::getInstance()->getRenderer(mc->player); HumanoidMobRenderer* playerRenderer = (HumanoidMobRenderer*) er; + EntityRenderDispatcher::getInstance()->setModernSkin((Entity*)(player)); + float ss = 1; glScalef2(ss, ss, ss); playerRenderer->renderHand(); glPopMatrix2(); } - //glDisable2(GL_RESCALE_NORMAL); - //Lighting.turnOff(); + glDisable2(GL_RESCALE_NORMAL); + Lighting::turnOff(); //w.stop(); } @@ -395,10 +457,10 @@ void ItemInHandRenderer::renderScreenEffect( float a ) } } - // if (mc->player->isUnderLiquid(Material::water)) { - //mc->textures->loadAndBindTexture("misc/water.png"); - // renderWater(a); - // } + if (mc->player->isUnderLiquid(Material::water)) { + mc->textures->loadAndBindTexture("misc/water.png"); + renderWater(a); + } glEnable2(GL_ALPHA_TEST); } diff --git a/src/client/renderer/LevelRenderer.cpp b/src/client/renderer/LevelRenderer.cpp index 2ccc821..1ce3ffd 100755 --- a/src/client/renderer/LevelRenderer.cpp +++ b/src/client/renderer/LevelRenderer.cpp @@ -25,6 +25,9 @@ #include "../../client/player/LocalPlayer.h" +#include "../../world/level/GrassColor.h" +#include "Lighting.h" + #ifdef GFX_SMALLER_CHUNKS /* static */ const int LevelRenderer::CHUNK_SIZE = 8; #else @@ -32,7 +35,7 @@ #endif LevelRenderer::LevelRenderer( Minecraft* mc) -: mc(mc), + : mc(mc), textures(mc->textures), level(NULL), cullStep(0), @@ -47,6 +50,7 @@ LevelRenderer::LevelRenderer( Minecraft* mc) xMaxChunk(0), yMaxChunk(0), zMaxChunk(0), lastViewDistance(-1), + lastFogType(-1), noEntityRenderFrames(2), totalEntities(0), @@ -65,7 +69,7 @@ LevelRenderer::LevelRenderer( Minecraft* mc) destroyProgress(0) { #ifdef OPENGL_ES - int maxChunksWidth = 2 * LEVEL_WIDTH / CHUNK_SIZE + 1; + int maxChunksWidth = 2 * LevelConstants::LEVEL_WIDTH / CHUNK_SIZE + 1; numListsOrBuffers = maxChunksWidth * maxChunksWidth * (128/CHUNK_SIZE) * 3; chunkBuffers = new GLuint[numListsOrBuffers]; glGenBuffers2(numListsOrBuffers, chunkBuffers); @@ -73,6 +77,9 @@ LevelRenderer::LevelRenderer( Minecraft* mc) //for (int i = 0; i < numListsOrBuffers; ++i) printf("bufId %d: %d\t", i, chunkBuffers[i]); glGenBuffers2(1, &skyBuffer); + glGenBuffers2(1, &voidBuffer); + glGenBuffers2(1, &starBuffer); + generateStars(); generateSky(); #else int maxChunksWidth = 1024 / CHUNK_SIZE; @@ -91,6 +98,8 @@ LevelRenderer::~LevelRenderer() #ifdef OPENGL_ES glDeleteBuffers(numListsOrBuffers, chunkBuffers); glDeleteBuffers(1, &skyBuffer); + glDeleteBuffers(1, &voidBuffer); + glDeleteBuffers(1, &starBuffer); delete[] chunkBuffers; #else glDeleteLists(numListsOrBuffers, chunkLists); @@ -118,6 +127,25 @@ void LevelRenderer::generateSky() { } t.end(true, skyBuffer); + + yy = (float) (-16); + t.begin(); + + // pretty much the same thing as the sky one above except uses inverted values to generate the void plane. + + voidVertexCount = 0; + for (int xx = -s * d; xx <= s * d; xx += s) { + for (int zz = -s * d; zz <= s * d; zz += s) { + t.vertex((float) xx + 0, yy, (float) zz + s); + t.vertex((float)(xx + s), yy, (float) zz + s); + t.vertex((float)(xx + s), yy, (float)(zz + 0)); + t.vertex((float) xx + 0, yy, (float)(zz + 0)); + //LOGI("x, z: %d, %d\n", xx, zz); + voidVertexCount += 4; + } + } + + t.end(true, voidBuffer); //LOGI("skyvertexcount: %d\n", skyVertexCount); //glEndList(); } @@ -149,18 +177,33 @@ void LevelRenderer::allChanged() { deleteChunks(); - Tile::leaves->setFancy(mc->options.fancyGraphics); - Tile::leaves_carried->setFancy(mc->options.fancyGraphics); - lastViewDistance = mc->options.viewDistance; + bool fancy = mc->options.getBooleanValue(OPTIONS_FANCY_GRAPHICS); + + Tile::leaves->setFancy(fancy); + Tile::leaves_carried->setFancy(fancy); + lastViewDistance = mc->options.getIntValue(OPTIONS_VIEW_DISTANCE); + + lastFogType = mc->options.getIntValue(OPTIONS_FOG_TYPE); + +#ifndef __APPLE__ + bool tint = mc->options.getBooleanValue(OPTIONS_FOLIAGE_TINT); + bool sideTint = mc->options.getBooleanValue(OPTIONS_TINTED_SIDE); +#else + bool tint = false, sideTint = false; +#endif + FoliageColor::setUseTint(tint); + GrassColor::setUseTint(tint); + TileRenderer::setUseTint(sideTint); + int dist = (512 >> 3) << (3 - lastViewDistance); if (lastViewDistance <= 2 && mc->isPowerVR()) dist = (int)((float)dist * 0.8f); LOGI("last: %d, power: %d\n", lastViewDistance, mc->isPowerVR()); - #if defined(RPI) - dist *= 0.6f; - #endif +#if defined(RPI) + dist *= 0.6f; +#endif if (dist > 400) dist = 400; /* @@ -225,17 +268,17 @@ void LevelRenderer::allChanged() void LevelRenderer::deleteChunks() { for (int z = 0; z < zChunks; ++z) - for (int y = 0; y < yChunks; ++y) - for (int x = 0; x < xChunks; ++x) { - int c = getLinearCoord(x, y, z); - delete chunks[c]; - } + for (int y = 0; y < yChunks; ++y) + for (int x = 0; x < xChunks; ++x) { + int c = getLinearCoord(x, y, z); + delete chunks[c]; + } - delete[] chunks; - chunks = NULL; + delete[] chunks; + chunks = NULL; - delete[] sortedChunks; - sortedChunks = NULL; + delete[] sortedChunks; + sortedChunks = NULL; } void LevelRenderer::resortChunks( int xc, int yc, int zc ) @@ -295,10 +338,52 @@ void LevelRenderer::resortChunks( int xc, int yc, int zc ) int LevelRenderer::render( Mob* player, int layer, float alpha ) { - if (mc->options.viewDistance != lastViewDistance) { + if (mc->options.getIntValue(OPTIONS_VIEW_DISTANCE) != lastViewDistance) { allChanged(); } + int currentFogType = mc->options.getIntValue(OPTIONS_FOG_TYPE); + if (currentFogType != lastFogType) { + lastFogType = currentFogType; + + if (level && level->dimension) { + level->dimension->FogType = currentFogType; // use new fog stuff + } + + allChanged(); + } + bool SmoothLightState = mc->options.getBooleanValue(OPTIONS_AMBIENT_OCCLUSION); + if (SmoothLightState != mc->useAmbientOcclusion){ + mc->useAmbientOcclusion = SmoothLightState; + allChanged(); + } + + + bool tint = mc->options.getBooleanValue(OPTIONS_FOLIAGE_TINT); + if (tint != LastTint) { + LastTint = tint; + + + FoliageColor::setUseTint(tint); + GrassColor::setUseTint(tint); + + allChanged(); + } + + + bool sideTint = mc->options.getBooleanValue(OPTIONS_TINTED_SIDE); + + if (sideTint != LastSideTint) { + LastSideTint = sideTint; + + + TileRenderer::setUseTint(sideTint); + + allChanged(); + } + + + TIMER_PUSH("sortchunks"); for (int i = 0; i < 10; i++) { chunkFixOffs = (chunkFixOffs + 1) % chunksLength; @@ -334,7 +419,7 @@ int LevelRenderer::render( Mob* player, int layer, float alpha ) } int count = 0; - if (occlusionCheck && !mc->options.anaglyph3d && layer == 0) { + if (occlusionCheck && !mc->options.getBooleanValue(OPTIONS_ANAGLYPH_3D) && layer == 0) { int from = 0; int to = 16; //checkQueryResults(from, to); @@ -486,15 +571,15 @@ void LevelRenderer::render(const AABB& b) const { Tesselator& t = Tesselator::instance; - glColor4f2(1, 1, 1, 1); + // glColor4f2(1, 1, 1, 1); - textures->loadAndBindTexture("terrain.png"); + // textures->loadAndBindTexture("terrain.png"); // uh need to check java - shredder //t.begin(); - t.color(255, 255, 255, 255); - - t.offset(((Mob*)mc->player)->getPos(0).negated()); + // t.color(255, 255, 255, 255); // again not needed, for some reason the vanilla source code tints it... white? maybe this was used for something else in MCPE's dev at one point? - shredder + // t.offset(((Mob*)mc->player)->getPos(0).negated()); // why does this even exist normally, it just makes the thing... not render + glLineWidth(2.0f); // make it more thick - shredder t.begin(GL_LINE_STRIP); t.vertex(b.x0, b.y0, b.z0); t.vertex(b.x1, b.y0, b.z0); @@ -567,11 +652,11 @@ int LevelRenderer::renderChunks( int from, int to, int layer, float alpha ) for (unsigned int i = 0; i < _renderChunks.size(); ++i) { Chunk* chunk = _renderChunks[i]; - #ifdef USE_VBO - renderList.addR(chunk->getRenderChunk(layer)); - #else - renderList.add(chunk->getList(layer)); - #endif +#ifdef USE_VBO + renderList.addR(chunk->getRenderChunk(layer)); +#else + renderList.add(chunk->getList(layer)); +#endif renderList.next(); } @@ -722,20 +807,20 @@ bool LevelRenderer::updateDirtyChunks( Mob* player, bool force ) Chunk* chunk = dirtyChunks[cursor]; if (chunk != NULL) { bool remove = false; - for (int i = 0; i < count && !remove; i++) - if (chunk == toAdd[i]) { - remove = true; - } - - if (!remove) { - //if (chunk == toAdd[0] || chunk == toAdd[1] || chunk == toAdd[2]) { - // ; // this chunk was rendered and should be removed - //} else { - if (target != cursor) { - dirtyChunks[target] = chunk; + for (int i = 0; i < count && !remove; i++) + if (chunk == toAdd[i]) { + remove = true; + } + + if (!remove) { + //if (chunk == toAdd[0] || chunk == toAdd[1] || chunk == toAdd[2]) { + // ; // this chunk was rendered and should be removed + //} else { + if (target != cursor) { + dirtyChunks[target] = chunk; + } + target++; } - target++; - } } cursor++; } @@ -909,23 +994,23 @@ bool entityRenderPredicate(const Entity* a, const Entity* b) { } void LevelRenderer::renderEntities(Vec3 cam, Culler* culler, float a) { - if (noEntityRenderFrames > 0) { - noEntityRenderFrames--; - return; - } + if (noEntityRenderFrames > 0) { + noEntityRenderFrames--; + return; + } TIMER_PUSH("prepare"); - TileEntityRenderDispatcher::getInstance()->prepare(level, textures, mc->font, mc->cameraTargetPlayer, a); - EntityRenderDispatcher::getInstance()->prepare(level, mc->font, mc->cameraTargetPlayer, &mc->options, a); + TileEntityRenderDispatcher::getInstance()->prepare(level, textures, mc->font, mc->cameraTargetPlayer, a); + EntityRenderDispatcher::getInstance()->prepare(level, mc->font, mc->cameraTargetPlayer, &mc->options, a); - totalEntities = 0; - renderedEntities = 0; - culledEntities = 0; + totalEntities = 0; + renderedEntities = 0; + culledEntities = 0; Entity* player = mc->cameraTargetPlayer; - EntityRenderDispatcher::xOff = TileEntityRenderDispatcher::xOff = (player->xOld + (player->x - player->xOld) * a); - EntityRenderDispatcher::yOff = TileEntityRenderDispatcher::yOff = (player->yOld + (player->y - player->yOld) * a); - EntityRenderDispatcher::zOff = TileEntityRenderDispatcher::zOff = (player->zOld + (player->z - player->zOld) * a); + EntityRenderDispatcher::xOff = TileEntityRenderDispatcher::xOff = (player->xOld + (player->x - player->xOld) * a); + EntityRenderDispatcher::yOff = TileEntityRenderDispatcher::yOff = (player->yOld + (player->y - player->yOld) * a); + EntityRenderDispatcher::zOff = TileEntityRenderDispatcher::zOff = (player->zOld + (player->z - player->zOld) * a); glEnableClientState2(GL_VERTEX_ARRAY); glEnableClientState2(GL_TEXTURE_COORD_ARRAY); @@ -938,10 +1023,12 @@ void LevelRenderer::renderEntities(Vec3 cam, Culler* culler, float a) { for (int i = 0; i < totalEntities; i++) { Entity* entity = entities[i]; + bool thirdPerson = mc->options.getBooleanValue(OPTIONS_THIRD_PERSON_VIEW); + if (entity->shouldRender(cam) && culler->isVisible(entity->bb)) { - if (entity == mc->cameraTargetPlayer && mc->options.thirdPersonView == 0 && mc->cameraTargetPlayer->isPlayer() && !((Player*)mc->cameraTargetPlayer)->isSleeping()) continue; - if (entity == mc->cameraTargetPlayer && !mc->options.thirdPersonView) + if (entity == mc->cameraTargetPlayer && thirdPerson == 0 && mc->cameraTargetPlayer->isPlayer() && !((Player*)mc->cameraTargetPlayer)->isSleeping()) continue; + if (entity == mc->cameraTargetPlayer && !thirdPerson) continue; if (!level->hasChunkAt(Mth::floor(entity->x), Mth::floor(entity->y), Mth::floor(entity->z))) continue; @@ -962,10 +1049,10 @@ void LevelRenderer::renderEntities(Vec3 cam, Culler* culler, float a) { delete[] toRender; } - TIMER_POP_PUSH("tileentities"); - for (unsigned int i = 0; i < level->tileEntities.size(); i++) { - TileEntityRenderDispatcher::getInstance()->render(level->tileEntities[i], a); - } + TIMER_POP_PUSH("tileentities"); + for (unsigned int i = 0; i < level->tileEntities.size(); i++) { + TileEntityRenderDispatcher::getInstance()->render(level->tileEntities[i], a); + } glDisableClientState2(GL_VERTEX_ARRAY); glDisableClientState2(GL_TEXTURE_COORD_ARRAY); @@ -976,50 +1063,209 @@ void LevelRenderer::renderEntities(Vec3 cam, Culler* culler, float a) { std::string LevelRenderer::gatherStats1() { std::stringstream ss; ss << "C: " << renderedChunks << "/" << totalChunks << ". F: " << offscreenChunks << ", O: " << occludedChunks << ", E: " << emptyChunks << "\n"; - return ss.str(); + return ss.str(); } // -// /*public*/ std::string gatherStats2() { -// return "E: " + renderedEntities + "/" + totalEntities + ". B: " + culledEntities + ", I: " + ((totalEntities - culledEntities) - renderedEntities); -// } + std::string LevelRenderer::gatherStats2() { + std::stringstream ss; + ss << "E: "<< renderedEntities << "/" << totalEntities << ". B: " << culledEntities << ", I: " << (totalEntities - culledEntities) - renderedEntities <<"\n"; + return ss.str(); + } // // int[] toRender = new int[50000]; // IntBuffer resultBuffer = MemoryTracker.createIntBuffer(64); + void LevelRenderer::generateStars() { + // ported from java beta again, + // converted the doubles into floats to be consistent, shouldnt affect much - shredder + + Random random = Random(10842L); + Tesselator& t = Tesselator::instance; + t.begin(); + starVertexCount = 0; + + for (int i = 0; i < 1500; i++) { + float d = random.nextFloat() * 2.0F - 1.0F; + float e = random.nextFloat() * 2.0F - 1.0F; + float f = random.nextFloat() * 2.0F - 1.0F; + float g = 0.25F + random.nextFloat() * 0.25F; + float h = d * d + e * e + f * f; + if (h < 1.0 && h > 0.01) { + h = 1.0 / Mth::sqrt(h); + d *= h; + e *= h; + f *= h; + float j = d * 100.0; + float k = e * 100.0; + float l = f * 100.0; + float m = Mth::atan2(d, f); + float n = Mth::sin(m); + float o = Mth::cos(m); + float p = Mth::atan2(Mth::sqrt(d * d + f * f), e); + float q = Mth::sin(p); + float r = Mth::cos(p); + float s = random.nextDouble() * Mth::PI * 2.0; + float t2 = Mth::sin(s); + float u = Mth::cos(s); + + for (int v = 0; v < 4; v++) { + float w = 0.0; + float x = ((v & 2) - 1) * g; + float y = ((v + 1 & 2) - 1) * g; + float aa = x * u - y * t2; + float ab = y * u + x * t2; + float ad = aa * q + w * r; + float ae = w * q - aa * r; + float af = ae * n - ab * o; + float ah = ab * n + ae * o; + t.vertex(j + af, k + ad, l + ah); + } + starVertexCount += 4; + } + } + + t.end(true, starBuffer); + } void LevelRenderer::renderSky(float alpha) { - if (mc->level->dimension->foggy) return; + if (mc->level->dimension->foggy) return; - glDisable2(GL_TEXTURE_2D); - Vec3 sc = level->getSkyColor(mc->cameraTargetPlayer, alpha); - float sr = (float) sc.x; - float sg = (float) sc.y; - float sb = (float) sc.z;// + 0.5f; + glDisable2(GL_TEXTURE_2D); + Vec3 sc = level->getSkyColor(mc->cameraTargetPlayer, alpha); + float sr = (float) sc.x; + float sg = (float) sc.y; + float sb = (float) sc.z;// + 0.5f; - if (mc->options.anaglyph3d) { - float srr = (sr * 30.0f + sg * 59.0f + sb * 11.0f) / 100.0f; - float sgg = (sr * 30.0f + sg * 70.0f) / (100.0f); - float sbb = (sr * 30.0f + sb * 70.0f) / (100.0f); + if (mc->options.getBooleanValue(OPTIONS_ANAGLYPH_3D)) { + float srr = (sr * 30.0f + sg * 59.0f + sb * 11.0f) / 100.0f; + float sgg = (sr * 30.0f + sg * 70.0f) / (100.0f); + float sbb = (sr * 30.0f + sb * 70.0f) / (100.0f); - sr = srr; - sg = sgg; - sb = sbb; - } - glColor4f2(sr, sg, Mth::Min(1.0f, sb), 1); + sr = srr; + sg = sgg; + sb = sbb; + } + glColor4f2(sr, sg, Mth::Min(1.0f, sb), 1); - //Tesselator& t = Tesselator::instance; - - glEnable2(GL_FOG); - glColor4f2(sr, sg, sb, 1.0f); + Tesselator& t = Tesselator::instance; + // @TODO shredder - should not enable or disable depth mask if using legacy sky because mcpe sky rendering is awful and will render clouds above terrain + if(mc->options.getBooleanValue(OPTIONS_BETA_SKY)){ + glDepthMask(false); + } + glEnable2(GL_FOG); + glColor4f2(sr, sg, sb, 1.0f); #ifdef OPENGL_ES drawArrayVT(skyBuffer, skyVertexCount); #endif - glEnable2(GL_TEXTURE_2D); + glDisable(GL_FOG); + glDisable(GL_ALPHA_TEST); + + // re ported this again from beta 1.6.6, thanks to the mcpe 0.1 decomp team's code for some bit of help about the void layer - shredder + + // Sunrise + if (mc->options.getBooleanValue(OPTIONS_BEAUTIFUL_SKY)) { + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + Lighting::turnOff(); + float* c = level->dimension->getSunriseColor(level->getTimeOfDay(alpha), alpha); + if (c != nullptr) + { + glDisable(GL_TEXTURE_2D); +// glShadeModel(GL_SMOOTH); // + + glPushMatrix(); + glRotatef(90.0f, 1.0f, 0.0f, 0.0f); + glRotatef(level->getTimeOfDay(alpha) > 0.5f ? 180 : 0, 0.0f, 0.0f, 1.0f); + t.begin(GL_TRIANGLE_FAN); + t.color(c[0], c[1], c[2], c[3]); + t.vertex(0.0f, 100.0f, 0.0f); + t.color(c[0], c[1], c[2], 0.0f); + + int steps = 16; + for (int i = 0; i <= steps; i++) + { + float a = i * 3.1415927f * 2.0f / steps; + float sin = Mth::sin(a); + float cos = Mth::cos(a); + t.vertex((sin * 120.0f), (cos * 120.0f), (-cos * 40.0f * c[3])); + } + + t.draw(); + glPopMatrix(); +// glShadeModel(GL_FLAT); // + } + + // gets the time of day and rotates the sun and moon png based on the time + glEnable(GL_TEXTURE_2D); + glBlendFunc(GL_SRC_ALPHA, GL_ONE); + glPushMatrix(); + + glColor4f(1.0f, 1.0f, 1.0f, 1.0f); + glTranslatef(sc.x, sc.y, sc.z); + glRotatef(0.0f, 0.0f, 0.0f, 1.0f); + glRotatef(level->getTimeOfDay(alpha) * 360.0f, 1.0f, 0.0f, 0.0f); + + float ss = 30.0f; + + + textures->loadAndBindTexture("terrain/sun.png"); + t.begin(); + t.vertexUV(-ss, 100.0f, -ss, 0.0f, 0.0f); + t.vertexUV(ss, 100.0f, -ss, 1.0f, 0.0f); + t.vertexUV(ss, 100.0f, ss, 1.0f, 1.0f); + t.vertexUV(-ss, 100.0f, ss, 0.0f, 1.0f); + t.draw(); + + ss = 20.0f; + textures->loadAndBindTexture("terrain/moon.png"); + t.begin(); + t.vertexUV(-ss, -100.0f, ss, 1.0f, 1.0f); + t.vertexUV(ss, -100.0f, ss, 0.0f, 1.0f); + t.vertexUV(ss, -100.0f, -ss, 0.0f, 0.0f); + t.vertexUV(-ss, -100.0f, -ss, 1.0f, 0.0f); + t.draw(); + + + glDisable(GL_TEXTURE_2D); + + float a = level->getStarBrightness(alpha); + if (a > 0.0f) + { + glColor4f(a, a, a, a); + drawArrayVT(starBuffer, starVertexCount); + } + } + + + glColor4f(1.0f, 1.0f, 1.0f, 1.0f); + glDisable(GL_BLEND); + glEnable(GL_ALPHA_TEST); + glEnable(GL_FOG); + glPopMatrix(); + + // ported over void plane (the blue bottom plane seen in java) because pocket edition lacks it @TODO test if it's buggy - shredder + +// glColor3f(sc.x * 0.2f + 0.04f, sc.y * 0.2f + 0.04f, sc.z * 0.6f + 0.1f); + glColor4f(sc.x * 0.2f + 0.04f, sc.y * 0.2f + 0.04f, sc.z * 0.6f + 0.1f, 1.0f); + glDisable(GL_TEXTURE_2D); + if(mc->options.getBooleanValue(OPTIONS_BETA_SKY)){ + drawArrayVT(voidBuffer, voidVertexCount); + } + glEnable(GL_TEXTURE_2D); + + // @TODO shredder - should not enable or disable depth mask if using legacy sky because mcpe sky rendering is awful and will render clouds above terrain + if(mc->options.getBooleanValue(OPTIONS_BETA_SKY)){ + glDepthMask(true); + } } void LevelRenderer::renderClouds( float alpha ) { //if (!mc->level->dimension->isNaturalDimension()) return; + if (mc->options.getBooleanValue(OPTIONS_FANCY_GRAPHICS) && mc->options.getBooleanValue(OPTIONS_BETA_SKY)){ + renderAdvancedClouds(alpha); + return; + } glEnable2(GL_TEXTURE_2D); glDisable(GL_CULL_FACE); float yOffs = (float) (mc->player->yOld + (mc->player->y - mc->player->yOld) * alpha); @@ -1029,7 +1275,7 @@ void LevelRenderer::renderClouds( float alpha ) { //glBindTexture(GL_TEXTURE_2D, texturesloadTexture("/environment/clouds.png")); textures->loadAndBindTexture("environment/clouds.png"); - + glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); @@ -1068,109 +1314,246 @@ void LevelRenderer::renderClouds( float alpha ) { glEnable(GL_CULL_FACE); } +void LevelRenderer::renderAdvancedClouds(float alpha) { + + // ported from java beta, tesselation code for the 3d clouds, renders broken if mcpe sky rendering option is used - shredder + + glDisable(GL_CULL_FACE); + + float px = mc->player->xOld + (mc->player->x - mc->player->xOld) * alpha; + float py = mc->player->yOld + (mc->player->y - mc->player->yOld) * alpha; + float pz = mc->player->zOld + (mc->player->z - mc->player->zOld) * alpha; + + Tesselator& t = Tesselator::instance; + float ss = 12.0f; + float h = 4.0f; + + float cloudTime = (float)ticks + alpha; + + float xo = (px + cloudTime * 0.03f) / ss; + float zo = pz / ss + 0.33f; + + float yy = 108.0f - py + 0.33f; + + int xWraps = Mth::floor(xo / 2048.0); + int zWraps = Mth::floor(zo / 2048.0); + xo -= xWraps * 2048; + zo -= zWraps * 2048; + + textures->loadAndBindTexture("environment/clouds.png"); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + + Vec3 cc = level->getCloudColor(alpha); + float cr = cc.x; + float cg = cc.y; + float cb = cc.z; + + float uvScale = 1.0f / 256.0f; + float uo = (float)Mth::floor(xo) * uvScale; + float vo = (float)Mth::floor(zo) * uvScale; + + float xOffs = (float)(xo - Mth::floor(xo)); + float zOffs = (float)(zo - Mth::floor(zo)); + + int D = 8; + int radius = 3; + float e = 1.0f / 1024.0f; + + glPushMatrix(); + glScalef(ss, 1.0f, ss); + + for (int pass = 0; pass < 2; pass++) { + + if (pass == 0) glColorMask(false, false, false, false); + else glColorMask(true, true, true, true); + + for (int xPos = -radius + 1; xPos <= radius; xPos++) { + for (int zPos = -radius + 1; zPos <= radius; zPos++) { + t.begin(); + float xx = (float)(xPos * D); + float zz = (float)(zPos * D); + float xp = xx - xOffs; + float zp = zz - zOffs; + + + if (yy > -h - 1.0f) { + t.color(cr * 0.7f, cg * 0.7f, cb * 0.7f, 0.8f); + t.normal(0.0f, -1.0f, 0.0f); + t.vertexUV(xp + 0, yy + 0, zp + D, (xx + 0) * uvScale + uo, (zz + D) * uvScale + vo); + t.vertexUV(xp + D, yy + 0, zp + D, (xx + D) * uvScale + uo, (zz + D) * uvScale + vo); + t.vertexUV(xp + D, yy + 0, zp + 0, (xx + D) * uvScale + uo, (zz + 0) * uvScale + vo); + t.vertexUV(xp + 0, yy + 0, zp + 0, (xx + 0) * uvScale + uo, (zz + 0) * uvScale + vo); + } + + + if (yy <= h + 1.0f) { + t.color(cr, cg, cb, 0.8f); + t.normal(0.0f, 1.0f, 0.0f); + t.vertexUV(xp + 0, yy + h - e, zp + D, (xx + 0) * uvScale + uo, (zz + D) * uvScale + vo); + t.vertexUV(xp + D, yy + h - e, zp + D, (xx + D) * uvScale + uo, (zz + D) * uvScale + vo); + t.vertexUV(xp + D, yy + h - e, zp + 0, (xx + D) * uvScale + uo, (zz + 0) * uvScale + vo); + t.vertexUV(xp + 0, yy + h - e, zp + 0, (xx + 0) * uvScale + uo, (zz + 0) * uvScale + vo); + } + + t.color(cr * 0.9f, cg * 0.9f, cb * 0.9f, 0.8f); + + + if (xPos > -1) { + t.normal(-1.0f, 0.0f, 0.0f); + for (int i = 0; i < D; i++) { + t.vertexUV(xp + i + 0, yy + 0, zp + D, (xx + i + 0.5f) * uvScale + uo, (zz + D) * uvScale + vo); + t.vertexUV(xp + i + 0, yy + h, zp + D, (xx + i + 0.5f) * uvScale + uo, (zz + D) * uvScale + vo); + t.vertexUV(xp + i + 0, yy + h, zp + 0, (xx + i + 0.5f) * uvScale + uo, (zz + 0) * uvScale + vo); + t.vertexUV(xp + i + 0, yy + 0, zp + 0, (xx + i + 0.5f) * uvScale + uo, (zz + 0) * uvScale + vo); + } + } + if (xPos <= 1) { + t.normal(1.0f, 0.0f, 0.0f); + for (int i = 0; i < D; i++) { + t.vertexUV(xp + i + 1 - e, yy + 0, zp + D, (xx + i + 0.5f) * uvScale + uo, (zz + D) * uvScale + vo); + t.vertexUV(xp + i + 1 - e, yy + h, zp + D, (xx + i + 0.5f) * uvScale + uo, (zz + D) * uvScale + vo); + t.vertexUV(xp + i + 1 - e, yy + h, zp + 0, (xx + i + 0.5f) * uvScale + uo, (zz + 0) * uvScale + vo); + t.vertexUV(xp + i + 1 - e, yy + 0, zp + 0, (xx + i + 0.5f) * uvScale + uo, (zz + 0) * uvScale + vo); + } + } + + t.color(cr * 0.8f, cg * 0.8f, cb * 0.8f, 0.8f); + + + if (zPos > -1) { + t.normal(0.0f, 0.0f, -1.0f); + for (int i = 0; i < D; i++) { + t.vertexUV(xp + 0, yy + h, zp + i + 0, (xx + 0) * uvScale + uo, (zz + i + 0.5f) * uvScale + vo); + t.vertexUV(xp + D, yy + h, zp + i + 0, (xx + D) * uvScale + uo, (zz + i + 0.5f) * uvScale + vo); + t.vertexUV(xp + D, yy + 0, zp + i + 0, (xx + D) * uvScale + uo, (zz + i + 0.5f) * uvScale + vo); + t.vertexUV(xp + 0, yy + 0, zp + i + 0, (xx + 0) * uvScale + uo, (zz + i + 0.5f) * uvScale + vo); + } + } + if (zPos <= 1) { + t.normal(0.0f, 0.0f, 1.0f); + for (int i = 0; i < D; i++) { + t.vertexUV(xp + 0, yy + h, zp + i + 1 - e, (xx + 0) * uvScale + uo, (zz + i + 0.5f) * uvScale + vo); + t.vertexUV(xp + D, yy + h, zp + i + 1 - e, (xx + D) * uvScale + uo, (zz + i + 0.5f) * uvScale + vo); + t.vertexUV(xp + D, yy + 0, zp + i + 1 - e, (xx + D) * uvScale + uo, (zz + i + 0.5f) * uvScale + vo); + t.vertexUV(xp + 0, yy + 0, zp + i + 1 - e, (xx + 0) * uvScale + uo, (zz + i + 0.5f) * uvScale + vo); + } + } + t.endOverrideAndDraw(); + } + } + } + + glPopMatrix(); + glColor4f(1.0f, 1.0f, 1.0f, 1.0f); + glDisable(GL_BLEND); + glEnable(GL_CULL_FACE); +} + void LevelRenderer::playSound(const std::string& name, float x, float y, float z, float volume, float pitch) { // @todo: deny sounds here if sound is off (rather than waiting 'til SoundEngine) float dd = 16; if (volume > 1) dd *= volume; - if (mc->cameraTargetPlayer->distanceToSqr(x, y, z) < dd * dd) { + if (mc->cameraTargetPlayer != NULL && mc->cameraTargetPlayer->distanceToSqr(x, y, z) < dd * dd) { mc->soundEngine->play(name, x, y, z, volume, pitch); } } void LevelRenderer::addParticle(const std::string& name, float x, float y, float z, float xa, float ya, float za, int data) { + if (mc->cameraTargetPlayer != NULL) { + float xd = mc->cameraTargetPlayer->x - x; + float yd = mc->cameraTargetPlayer->y - y; + float zd = mc->cameraTargetPlayer->z - z; + float distanceSquared = xd * xd + yd * yd + zd * zd; - float xd = mc->cameraTargetPlayer->x - x; - float yd = mc->cameraTargetPlayer->y - y; - float zd = mc->cameraTargetPlayer->z - z; - float distanceSquared = xd * xd + yd * yd + zd * zd; + //Particle* p = NULL; + //if (name == "hugeexplosion") p = new HugeExplosionSeedParticle(level, x, y, z, xa, ya, za); + //else if (name == "largeexplode") p = new HugeExplosionParticle(textures, level, x, y, z, xa, ya, za); - //Particle* p = NULL; - //if (name == "hugeexplosion") p = new HugeExplosionSeedParticle(level, x, y, z, xa, ya, za); - //else if (name == "largeexplode") p = new HugeExplosionParticle(textures, level, x, y, z, xa, ya, za); + //if (p) { + // if (distanceSquared < 32 * 32) { + // mc->particleEngine->add(p); + // } else { delete p; } + // return; + //} - //if (p) { - // if (distanceSquared < 32 * 32) { - // mc->particleEngine->add(p); - // } else { delete p; } - // return; - //} + const float particleDistance = 16; + if (distanceSquared > particleDistance * particleDistance) return; - const float particleDistance = 16; - if (distanceSquared > particleDistance * particleDistance) return; + //static Stopwatch sw; + //sw.start(); - //static Stopwatch sw; - //sw.start(); + if (name == "bubble") mc->particleEngine->add(new BubbleParticle(level, x, y, z, xa, ya, za)); + else if (name == "crit") mc->particleEngine->add(new CritParticle2(level, x, y, z, xa, ya, za)); + else if (name == "smoke") mc->particleEngine->add(new SmokeParticle(level, x, y, z, xa, ya, za)); + //else if (name == "note") mc->particleEngine->add(new NoteParticle(level, x, y, z, xa, ya, za)); + else if (name == "explode") mc->particleEngine->add(new ExplodeParticle(level, x, y, z, xa, ya, za)); + else if (name == "flame") mc->particleEngine->add(new FlameParticle(level, x, y, z, xa, ya, za)); + else if (name == "lava") mc->particleEngine->add(new LavaParticle(level, x, y, z)); + //else if (name == "splash") mc->particleEngine->add(new SplashParticle(level, x, y, z, xa, ya, za)); + else if (name == "largesmoke") mc->particleEngine->add(new SmokeParticle(level, x, y, z, xa, ya, za, 2.5f)); + else if (name == "reddust") mc->particleEngine->add(new RedDustParticle(level, x, y, z, xa, ya, za)); + else if (name == "iconcrack") mc->particleEngine->add(new BreakingItemParticle(level, x, y, z, xa, ya, za, Item::items[data])); + else if (name == "snowballpoof") mc->particleEngine->add(new BreakingItemParticle(level, x, y, z, Item::snowBall)); + //else if (name == "snowballpoof") mc->particleEngine->add(new BreakingItemParticle(level, x, y, z, Item::snowBall)); + //else if (name == "slime") mc->particleEngine->add(new BreakingItemParticle(level, x, y, z, Item::slimeBall)); + //else if (name == "heart") mc->particleEngine->add(new HeartParticle(level, x, y, z, xa, ya, za)); - if (name == "bubble") mc->particleEngine->add(new BubbleParticle(level, x, y, z, xa, ya, za)); - else if (name == "crit") mc->particleEngine->add(new CritParticle2(level, x, y, z, xa, ya, za)); - else if (name == "smoke") mc->particleEngine->add(new SmokeParticle(level, x, y, z, xa, ya, za)); - //else if (name == "note") mc->particleEngine->add(new NoteParticle(level, x, y, z, xa, ya, za)); - else if (name == "explode") mc->particleEngine->add(new ExplodeParticle(level, x, y, z, xa, ya, za)); - else if (name == "flame") mc->particleEngine->add(new FlameParticle(level, x, y, z, xa, ya, za)); - else if (name == "lava") mc->particleEngine->add(new LavaParticle(level, x, y, z)); - //else if (name == "splash") mc->particleEngine->add(new SplashParticle(level, x, y, z, xa, ya, za)); - else if (name == "largesmoke") mc->particleEngine->add(new SmokeParticle(level, x, y, z, xa, ya, za, 2.5f)); - else if (name == "reddust") mc->particleEngine->add(new RedDustParticle(level, x, y, z, xa, ya, za)); - else if (name == "iconcrack") mc->particleEngine->add(new BreakingItemParticle(level, x, y, z, xa, ya, za, Item::items[data])); - else if (name == "snowballpoof") mc->particleEngine->add(new BreakingItemParticle(level, x, y, z, Item::snowBall)); - //else if (name == "snowballpoof") mc->particleEngine->add(new BreakingItemParticle(level, x, y, z, Item::snowBall)); - //else if (name == "slime") mc->particleEngine->add(new BreakingItemParticle(level, x, y, z, Item::slimeBall)); - //else if (name == "heart") mc->particleEngine->add(new HeartParticle(level, x, y, z, xa, ya, za)); - - //sw.stop(); - //sw.printEvery(50, "add-particle-string"); + //sw.stop(); + //sw.printEvery(50, "add-particle-string"); + } } /* void LevelRenderer::addParticle(ParticleType::Id name, float x, float y, float z, float xa, float ya, float za, int data) { - float xd = mc->cameraTargetPlayer->x - x; - float yd = mc->cameraTargetPlayer->y - y; - float zd = mc->cameraTargetPlayer->z - z; +float xd = mc->cameraTargetPlayer->x - x; +float yd = mc->cameraTargetPlayer->y - y; +float zd = mc->cameraTargetPlayer->z - z; - const float particleDistance = 16; - if (xd * xd + yd * yd + zd * zd > particleDistance * particleDistance) return; +const float particleDistance = 16; +if (xd * xd + yd * yd + zd * zd > particleDistance * particleDistance) return; - //static Stopwatch sw; - //sw.start(); +//static Stopwatch sw; +//sw.start(); - //Particle* p = NULL; +//Particle* p = NULL; - if (name == ParticleType::bubble) mc->particleEngine->add( new BubbleParticle(level, x, y, z, xa, ya, za) ); - else if (name == ParticleType::crit) mc->particleEngine->add(new CritParticle2(level, x, y, z, xa, ya, za) ); - else if (name == ParticleType::smoke) mc->particleEngine->add(new SmokeParticle(level, x, y, z, xa, ya, za) ); - else if (name == ParticleType::explode) mc->particleEngine->add( new ExplodeParticle(level, x, y, z, xa, ya, za) ); - else if (name == ParticleType::flame) mc->particleEngine->add( new FlameParticle(level, x, y, z, xa, ya, za) ); - else if (name == ParticleType::lava) mc->particleEngine->add( new LavaParticle(level, x, y, z) ); - else if (name == ParticleType::largesmoke) mc->particleEngine->add( new SmokeParticle(level, x, y, z, xa, ya, za, 2.5f) ); - else if (name == ParticleType::reddust) mc->particleEngine->add( new RedDustParticle(level, x, y, z, xa, ya, za) ); - else if (name == ParticleType::iconcrack) mc->particleEngine->add( new BreakingItemParticle(level, x, y, z, xa, ya, za, Item::items[data]) ); +if (name == ParticleType::bubble) mc->particleEngine->add( new BubbleParticle(level, x, y, z, xa, ya, za) ); +else if (name == ParticleType::crit) mc->particleEngine->add(new CritParticle2(level, x, y, z, xa, ya, za) ); +else if (name == ParticleType::smoke) mc->particleEngine->add(new SmokeParticle(level, x, y, z, xa, ya, za) ); +else if (name == ParticleType::explode) mc->particleEngine->add( new ExplodeParticle(level, x, y, z, xa, ya, za) ); +else if (name == ParticleType::flame) mc->particleEngine->add( new FlameParticle(level, x, y, z, xa, ya, za) ); +else if (name == ParticleType::lava) mc->particleEngine->add( new LavaParticle(level, x, y, z) ); +else if (name == ParticleType::largesmoke) mc->particleEngine->add( new SmokeParticle(level, x, y, z, xa, ya, za, 2.5f) ); +else if (name == ParticleType::reddust) mc->particleEngine->add( new RedDustParticle(level, x, y, z, xa, ya, za) ); +else if (name == ParticleType::iconcrack) mc->particleEngine->add( new BreakingItemParticle(level, x, y, z, xa, ya, za, Item::items[data]) ); - //switch (name) { - // case ParticleType::bubble: p = new BubbleParticle(level, x, y, z, xa, ya, za); break; - // case ParticleType::crit: p = new CritParticle2(level, x, y, z, xa, ya, za); break; - // case ParticleType::smoke: p = new SmokeParticle(level, x, y, z, xa, ya, za); break; - // //case ParticleType::note: p = new NoteParticle(level, x, y, z, xa, ya, za); break; - // case ParticleType::explode: p = new ExplodeParticle(level, x, y, z, xa, ya, za); break; - // case ParticleType::flame: p = new FlameParticle(level, x, y, z, xa, ya, za); break; - // case ParticleType::lava: p = new LavaParticle(level, x, y, z); break; - // //case ParticleType::splash: p = new SplashParticle(level, x, y, z, xa, ya, za); break; - // case ParticleType::largesmoke: p = new SmokeParticle(level, x, y, z, xa, ya, za, 2.5f); break; - // case ParticleType::reddust: p = new RedDustParticle(level, x, y, z, xa, ya, za); break; - // case ParticleType::iconcrack: p = new BreakingItemParticle(level, x, y, z, xa, ya, za, Item::items[data]); break; - // //case ParticleType::snowballpoof: p = new BreakingItemParticle(level, x, y, z, Item::snowBall); break; - // //case ParticleType::slime: p = new BreakingItemParticle(level, x, y, z, Item::slimeBall); break; - // //case ParticleType::heart: p = new HeartParticle(level, x, y, z, xa, ya, za); break; - // default: - // LOGW("Couldn't find particle of type: %d\n", name); - // break; - //} - //if (p) { - // mc->particleEngine->add(p); - //} +//switch (name) { +// case ParticleType::bubble: p = new BubbleParticle(level, x, y, z, xa, ya, za); break; +// case ParticleType::crit: p = new CritParticle2(level, x, y, z, xa, ya, za); break; +// case ParticleType::smoke: p = new SmokeParticle(level, x, y, z, xa, ya, za); break; +// //case ParticleType::note: p = new NoteParticle(level, x, y, z, xa, ya, za); break; +// case ParticleType::explode: p = new ExplodeParticle(level, x, y, z, xa, ya, za); break; +// case ParticleType::flame: p = new FlameParticle(level, x, y, z, xa, ya, za); break; +// case ParticleType::lava: p = new LavaParticle(level, x, y, z); break; +// //case ParticleType::splash: p = new SplashParticle(level, x, y, z, xa, ya, za); break; +// case ParticleType::largesmoke: p = new SmokeParticle(level, x, y, z, xa, ya, za, 2.5f); break; +// case ParticleType::reddust: p = new RedDustParticle(level, x, y, z, xa, ya, za); break; +// case ParticleType::iconcrack: p = new BreakingItemParticle(level, x, y, z, xa, ya, za, Item::items[data]); break; +// //case ParticleType::snowballpoof: p = new BreakingItemParticle(level, x, y, z, Item::snowBall); break; +// //case ParticleType::slime: p = new BreakingItemParticle(level, x, y, z, Item::slimeBall); break; +// //case ParticleType::heart: p = new HeartParticle(level, x, y, z, xa, ya, za); break; +// default: +// LOGW("Couldn't find particle of type: %d\n", name); +// break; +//} +//if (p) { +// mc->particleEngine->add(p); +//} - //sw.stop(); - //sw.printEvery(50, "add-particle-enum"); +//sw.stop(); +//sw.printEvery(50, "add-particle-enum"); } */ @@ -1188,7 +1571,7 @@ void LevelRenderer::renderHitSelect( Player* player, const HitResult& h, int mod glEnable2(GL_DEPTH_TEST); textures->loadAndBindTexture("terrain.png"); - + int tileId = level->getTile(h.x, h.y, h.z); Tile* tile = tileId > 0 ? Tile::tiles[tileId] : NULL; glDisable2(GL_ALPHA_TEST); @@ -1230,6 +1613,7 @@ void LevelRenderer::renderHitSelect( Player* player, const HitResult& h, int mod void LevelRenderer::onGraphicsReset() { + generateStars(); generateSky(); // Get new buffers @@ -1258,20 +1642,20 @@ void LevelRenderer::takePicture( TripodCamera* cam, Entity* entity ) { // Push old values Mob* oldCameraEntity = mc->cameraTargetPlayer; - bool hideGui = mc->options.hideGui; - bool thirdPerson = mc->options.thirdPersonView; + bool hideGui = mc->options.getBooleanValue(OPTIONS_HIDEGUI); + bool thirdPerson = mc->options.getBooleanValue(OPTIONS_THIRD_PERSON_VIEW); // @huge @attn: This is highly illegal, super temp! mc->cameraTargetPlayer = (Mob*)cam; - mc->options.hideGui = true; - mc->options.thirdPersonView = false; + mc->options.set(OPTIONS_HIDEGUI, true); + mc->options.set(OPTIONS_THIRD_PERSON_VIEW, false); mc->gameRenderer->renderLevel(0); // Pop values back mc->cameraTargetPlayer = oldCameraEntity; - mc->options.hideGui = hideGui; - mc->options.thirdPersonView = thirdPerson; + mc->options.set(OPTIONS_HIDEGUI, hideGui); + mc->options.set(OPTIONS_THIRD_PERSON_VIEW, thirdPerson); _t_keepPic = -1; @@ -1285,11 +1669,11 @@ void LevelRenderer::takePicture( TripodCamera* cam, Entity* entity ) void LevelRenderer::levelEvent(Player* player, int type, int x, int y, int z, int data) { switch (type) { case LevelEvent::SOUND_OPEN_DOOR: - if (Mth::random() < 0.5f) { - level->playSound(x + 0.5f, y + 0.5f, z + 0.5f, "random.door_open", 1, level->random.nextFloat() * 0.1f + 0.9f); - } else { - level->playSound(x + 0.5f, y + 0.5f, z + 0.5f, "random.door_close", 1, level->random.nextFloat() * 0.1f + 0.9f); - } - break; + if (Mth::random() < 0.5f) { + level->playSound(x + 0.5f, y + 0.5f, z + 0.5f, "random.door_open", 1, level->random.nextFloat() * 0.1f + 0.9f); + } else { + level->playSound(x + 0.5f, y + 0.5f, z + 0.5f, "random.door_close", 1, level->random.nextFloat() * 0.1f + 0.9f); + } + break; } } diff --git a/src/client/renderer/LevelRenderer.h b/src/client/renderer/LevelRenderer.h index df43de1..ba39bfe 100755 --- a/src/client/renderer/LevelRenderer.h +++ b/src/client/renderer/LevelRenderer.h @@ -43,7 +43,9 @@ public: void renderDebug(const AABB& b, float a) const; void renderSky(float alpha); + void generateStars(); void renderClouds(float alpha); + void renderAdvancedClouds(float alpha); void renderEntities(Vec3 cam, Culler* culler, float a); void renderSameAsLast(int layer, float alpha); void renderHit(Player* player, const HitResult& h, int mode, /*ItemInstance*/void* inventoryItem, float a); @@ -67,6 +69,7 @@ public: void levelEvent(Player* source, int type, int x, int y, int z, int data); std::string gatherStats1(); + std::string gatherStats2(); void render(const AABB& b) const; void onGraphicsReset(); @@ -113,6 +116,12 @@ private: bool occlusionCheck; int lastViewDistance; + // shredder added again... + int lastFogType; + + bool LastTint; + bool LastSideTint; + int ticks; int starList, skyList, darkList; @@ -121,6 +130,12 @@ private: GLuint skyBuffer; int skyVertexCount; + GLuint voidBuffer; + int voidVertexCount; + + GLuint starBuffer; + int starVertexCount; + // /*public*/ std::vector renderableTileEntities; Textures* textures; // /*private*/ TileRenderer tileRenderer; diff --git a/src/client/renderer/Lighting.cpp b/src/client/renderer/Lighting.cpp new file mode 100644 index 0000000..db0d93e --- /dev/null +++ b/src/client/renderer/Lighting.cpp @@ -0,0 +1,49 @@ +#include "Lighting.h" +#include "gles.h" +#include "../Minecraft.h" + +void Lighting::turnOff() { + glDisable(GL_LIGHTING); + glDisable(GL_LIGHT0); + glDisable(GL_LIGHT1); + glDisable(GL_COLOR_MATERIAL); +} + +void Lighting::turnOn(Minecraft* minecraft) { + if (!minecraft->options.getBooleanValue(OPTIONS_NORMAL_LIGHTING)){ // if normal lighting is false, then just dont use the lighting system at all like in vanilla - shredder + turnOff(); + return; + } + glEnable(GL_NORMALIZE); + // if normal lighting is true then enable GLES/OpenGL states to setup lighting + glEnable(GL_LIGHTING); + glEnable(GL_LIGHT0); + glEnable(GL_LIGHT1); + glEnable(GL_COLOR_MATERIAL); + // glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE); + + constexpr float a = 0.4f; + constexpr float d = 0.6f; + constexpr float s = 0.0f; + + + //Vec3 l = world::phys::Vec3{0.2, 1.0, -0.7}.normalize(); + constexpr float lightmodel_ambient[] = {a, a, a, 1.0f}; + constexpr float diffuse[] = {d, d, d, 1.0f}; + constexpr float ambient[] = {0.0f, 0.0f, 0.0f, 1.0f}; + constexpr float specular[] = {s, s, s, 1.0f}; + + constexpr float pos0[] = {(float)(0.16169041989141428), (float)(0.8084520874101966), (float)(-0.5659164515496377), 0.0f}; + glLightfv(GL_LIGHT0, GL_POSITION, pos0); + glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse); + glLightfv(GL_LIGHT0, GL_AMBIENT, ambient); + glLightfv(GL_LIGHT0, GL_SPECULAR, specular); + + constexpr float pos1[] = {(float)(-0.16169041989141428), (float)(0.8084520874101966), (float)(0.5659164515496377), 0.0f}; + glLightfv(GL_LIGHT1, GL_POSITION, pos1); + glLightfv(GL_LIGHT1, GL_DIFFUSE, diffuse); + glLightfv(GL_LIGHT1, GL_AMBIENT, ambient); + glLightfv(GL_LIGHT1, GL_SPECULAR, specular); + glShadeModel(GL_FLAT); + glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lightmodel_ambient); +} diff --git a/src/client/renderer/Lighting.h b/src/client/renderer/Lighting.h new file mode 100644 index 0000000..8dc5610 --- /dev/null +++ b/src/client/renderer/Lighting.h @@ -0,0 +1,12 @@ +#ifndef NET_MINECRAFT_CLIENT_RENDERER__Lighting_H__ +#define NET_MINECRAFT_CLIENT_RENDERER__Lighting_H__ + +class Minecraft; +class Lighting +{ +public: + static void turnOff(); + static void turnOn(Minecraft* minecraft); + +}; +#endif /*NET_MINECRAFT_CLIENT_RENDERER__Lighting_H__*/ \ No newline at end of file diff --git a/src/client/renderer/Tesselator.cpp b/src/client/renderer/Tesselator.cpp index 2fe36e1..e2a9fa8 100755 --- a/src/client/renderer/Tesselator.cpp +++ b/src/client/renderer/Tesselator.cpp @@ -8,7 +8,7 @@ Tesselator Tesselator::instance(sizeof(GLfloat) * MAX_FLOATS); // max size in by const int VertexSizeBytes = sizeof(VERTEX); Tesselator::Tesselator( int size ) -: size(size), + : size(size), vertices(0), u(0), v(0), _color(0), @@ -20,7 +20,7 @@ Tesselator::Tesselator( int size ) _noColor(false), mode(0), xo(0), yo(0), zo(0), - _normal(0), + _nx(0), _ny(0), _nz(0), _sx(1), _sy(1), tesselating(false), @@ -79,6 +79,9 @@ RenderChunk Tesselator::end( bool useMine, int bufferId ) const int o_vertices = vertices; if (vertices > 0) { + if (p <= 0 || p > maxVertices) { clear(); return RenderChunk(); } + int bytes = p * sizeof(VERTEX); + if (bytes <= 0) return RenderChunk(); if (++vboId >= vboCounts) vboId = 0; @@ -92,9 +95,9 @@ RenderChunk Tesselator::end( bool useMine, int bufferId ) bufferId = vboIds[vboId]; #endif int access = GL_STATIC_DRAW;//(accessMode==ACCESS_DYNAMIC) ? GL_DYNAMIC_DRAW : GL_STATIC_DRAW; - int bytes = p * sizeof(VERTEX); glBindBuffer2(GL_ARRAY_BUFFER, bufferId); glBufferData2(GL_ARRAY_BUFFER, bytes, _varray, access); // GL_STREAM_DRAW + totalSize += bytes; #ifndef USE_VBO @@ -109,7 +112,7 @@ RenderChunk Tesselator::end( bool useMine, int bufferId ) glEnableClientState2(GL_COLOR_ARRAY); } if (hasNormal) { - glNormalPointer(GL_BYTE, VertexSizeBytes, (GLvoid*) (6 * 4)); + glNormalPointer(GL_FLOAT, VertexSizeBytes, (GLvoid*) (6 * 4)); glEnableClientState2(GL_NORMAL_ARRAY); } glVertexPointer2(3, GL_FLOAT, VertexSizeBytes, 0); @@ -264,6 +267,7 @@ void Tesselator::vertex( float x, float y, float z ) for (int i = 0; i < 2; i++) { const int offs = 3 - i; + if (p - offs < 0 || p >= maxVertices) { clear(); return; } VERTEX& src = _varray[p - offs]; VERTEX& dst = _varray[p]; @@ -274,9 +278,11 @@ void Tesselator::vertex( float x, float y, float z ) if (hasColor) { dst.color = src.color; } - //if (hasNormal) { - // dst.normal = src.normal; - //} + if (hasNormal) { + dst.nx = src.nx; + dst.ny = src.ny; + dst.nz = src.nz; + } dst.x = src.x; dst.y = src.y; @@ -287,6 +293,7 @@ void Tesselator::vertex( float x, float y, float z ) } } + if (p < 0 || p >= maxVertices) { clear(); return; } VERTEX& vertex = _varray[p]; if (hasTexture) { @@ -296,9 +303,11 @@ void Tesselator::vertex( float x, float y, float z ) if (hasColor) { vertex.color = _color; } - //if (hasNormal) { - // vertex.normal = _normal; - //} + if (hasNormal) { + vertex.nx = _nx; + vertex.ny = _ny; + vertex.nz = _nz; + } vertex.x = _sx * (x + xo); vertex.y = _sy * (y + yo); @@ -327,18 +336,22 @@ void Tesselator::setAccessMode(int mode) void Tesselator::normal( float x, float y, float z ) { - static int _warn_t = 0; - if ((++_warn_t & 32767) == 1) - LOGI("WARNING: Can't use normals (Tesselator::normal)\n"); - return; + //static int _warn_t = 0; + //if ((++_warn_t & 32767) == 1) + // LOGI("WARNING: Can't use normals (Tesselator::normal)\n"); + //return; if (!tesselating) printf("But.."); hasNormal = true; - char xx = (char) (x * 128); - char yy = (char) (y * 127); - char zz = (char) (z * 127); + //char xx = (char) (x * 128); + //char yy = (char) (y * 127); + //char zz = (char) (z * 127); - _normal = xx | (yy << 8) | (zz << 16); + //_normal = xx | (yy << 8) | (zz << 16); + // trying a new thing hopefully works + this->_nx = x; + this->_ny = y; + this->_nz = z; } void Tesselator::offset( float xo, float yo, float zo ) { @@ -377,13 +390,15 @@ void Tesselator::draw() tesselating = false; if (vertices > 0) { + if (p <= 0 || p > maxVertices) { clear(); return; } + int bytes = p * sizeof(VERTEX); + if (bytes <= 0) { clear(); return; } if (++vboId >= vboCounts) vboId = 0; int bufferId = vboIds[vboId]; - + int access = GL_DYNAMIC_DRAW;//(accessMode==ACCESS_DYNAMIC) ? GL_DYNAMIC_DRAW : GL_STATIC_DRAW; - int bytes = p * sizeof(VERTEX); glBindBuffer2(GL_ARRAY_BUFFER, bufferId); glBufferData2(GL_ARRAY_BUFFER, bytes, _varray, access); // GL_STREAM_DRAW @@ -397,10 +412,10 @@ void Tesselator::draw() //glColorPointer2(4, GL_UNSIGNED_BYTE, VertexSizeBytes, (GLvoid*) &_varray->color); glEnableClientState2(GL_COLOR_ARRAY); } - //if (hasNormal) { - // glNormalPointer(GL_BYTE, VertexSizeBytes, (GLvoid*) (6 * 4)); - // glEnableClientState2(GL_NORMAL_ARRAY); - //} + if (hasNormal) { + glNormalPointer(GL_FLOAT, VertexSizeBytes, (GLvoid*) (6 * 4)); + glEnableClientState2(GL_NORMAL_ARRAY); + } //glVertexPointer2(3, GL_FLOAT, VertexSizeBytes, (GLvoid*)&_varray); glVertexPointer2(3, GL_FLOAT, VertexSizeBytes, 0); glEnableClientState2(GL_VERTEX_ARRAY); @@ -414,7 +429,7 @@ void Tesselator::draw() glDisableClientState2(GL_VERTEX_ARRAY); if (hasTexture) glDisableClientState2(GL_TEXTURE_COORD_ARRAY); if (hasColor) glDisableClientState2(GL_COLOR_ARRAY); - //if (hasNormal) glDisableClientState2(GL_NORMAL_ARRAY); + if (hasNormal) glDisableClientState2(GL_NORMAL_ARRAY); } clear(); diff --git a/src/client/renderer/Tesselator.h b/src/client/renderer/Tesselator.h index 85bad5f..1f0192b 100755 --- a/src/client/renderer/Tesselator.h +++ b/src/client/renderer/Tesselator.h @@ -10,7 +10,7 @@ extern const int VertexSizeBytes; -typedef VertexDeclPTC VERTEX; +typedef VertexDeclPTCN VERTEX; typedef std::map IntGLMap; @@ -98,7 +98,9 @@ private: float xo, yo, zo; float u, v; unsigned int _color; - int _normal; +// int _normal; // trying a new thing + float _nx, _ny, _nz; + float _sx, _sy; bool hasColor; diff --git a/src/client/renderer/TextureData.h b/src/client/renderer/TextureData.h index ea2a6e8..2c97797 100755 --- a/src/client/renderer/TextureData.h +++ b/src/client/renderer/TextureData.h @@ -16,7 +16,7 @@ typedef struct TextureData { TextureData() : w(0), h(0), - data(NULL), + data(nullptr), numBytes(0), transparent(true), memoryHandledExternally(false), diff --git a/src/client/renderer/Textures.cpp b/src/client/renderer/Textures.cpp index 6be65b9..b4b1676 100755 --- a/src/client/renderer/Textures.cpp +++ b/src/client/renderer/Textures.cpp @@ -5,6 +5,7 @@ #include "../Options.h" #include "../../platform/time.h" #include "../../AppPlatform.h" +#include "../../util/StringUtils.h" /*static*/ int Textures::textureChanges = 0; /*static*/ bool Textures::MIPMAP = false; @@ -64,7 +65,8 @@ TextureId Textures::loadTexture( const std::string& resourceName, bool inTexture if (it != idMap.end()) return it->second; - TextureData texdata = platform->loadTexture(resourceName, inTextureFolder); + bool isUrl = Util::startsWith(resourceName, "http://") || Util::startsWith(resourceName, "https://"); + TextureData texdata = platform->loadTexture(resourceName, isUrl ? false : inTextureFolder); if (texdata.data) return assignTexture(resourceName, texdata); else if (texdata.identifier != InvalidId) { @@ -247,6 +249,37 @@ int Textures::crispBlend( int c0, int c1 ) return (a << 24) | (r << 16) | (g << 8) | b; } +// shredder here, moved the code from minecraft.cpp bcus that isnt the right place +// had to implement this because i couldn't find a similar function in the code to do this +int* Textures::loadTexturePixels(TextureId texId, const std::string& resourceName){ + + const TextureData* texture = getTemporaryTextureData(texId); // storing raw pixels + + int size = texture->w * texture->h; // gets the size of our funny lil guy + int* pixels = new int[size]; // memory leaks be galore + unsigned char* raw = texture->data; // storing raw data into our beloved variable + for (int i = 0; i < (texture->w * texture->h); i++){ + // my head hurts i hate working with this + + + // uh since each pixel stores r g b a, aka the color channels which are each one byte, we multiply them by 4 to move from one pixel to another + + int r = raw[i * 4 + 0]; // gets us the first channel aka red + int g = raw[i * 4 + 1]; // gets us the second channel green + int b = raw[i * 4 + 2]; // gets us the third channel blue + int a = raw[i * 4 + 3]; // gets us the alpha channel + + // woohoo pixels uh should have been seperated into their colors now hopefully + + // r g b a + // ugh we now got to turn it into the AA RR GGBB format aak 0xAARRGGBB + // b gets 0 - 7 (8 bits), g gets 7 - 15 (8 bits), r gets 16 - 23 (8 bits), alpha gets the last ones 24 - 31 (8 bits), + pixels[i] = (a << 24) | (r << 16) | (g << 8) | (b); // shuld combine them into one 32 bit int unless i did something dumb + } + return pixels; // your meal has been prepared john colors +} + + ///*public*/ int loadHttpTexture(std::string url, std::string backup) { // HttpTexture texture = httpTextures.get(url); // if (texture != NULL) { diff --git a/src/client/renderer/Textures.h b/src/client/renderer/Textures.h index f5e2113..f4ab36e 100755 --- a/src/client/renderer/Textures.h +++ b/src/client/renderer/Textures.h @@ -44,6 +44,8 @@ public: TextureId assignTexture(const std::string& resourceName, const TextureData& img); const TextureData* getTemporaryTextureData(TextureId id); + int* loadTexturePixels(TextureId texId, const std::string& resourceName); + void tick(bool uploadToGraphicsCard); void clear(); diff --git a/src/client/renderer/TileRenderer.cpp b/src/client/renderer/TileRenderer.cpp index 16c6bf7..e61334c 100755 --- a/src/client/renderer/TileRenderer.cpp +++ b/src/client/renderer/TileRenderer.cpp @@ -1,4 +1,5 @@ #include "TileRenderer.h" +#include "Chunk.h" #include "../Minecraft.h" #include "Tesselator.h" @@ -12,13 +13,16 @@ #include "../../world/level/tile/BedTile.h" #include "../../world/level/tile/StemTile.h" #include "../../world/level/tile/StairTile.h" +#include "../../world/level/tile/FireTile.h" #include "../../world/Direction.h" #include "../../world/Facing.h" #include "tileentity/TileEntityRenderer.h" #include "EntityTileRenderer.h" -TileRenderer::TileRenderer( LevelSource* level /* = NULL */ ) -: level(level), +bool TileRenderer::sideTinting = false; + +TileRenderer::TileRenderer(LevelSource* level /* = NULL */ ) + : level(level), fixedTexture(-1), xFlipTexture(false), noCulling(false), @@ -56,6 +60,12 @@ bool TileRenderer::tesselateBlockInWorld( Tile* tt, int x, int y, int z, float r float c2 = 0.8f; float c3 = 0.6f; + // added these to get biome color and save it before its overriden - shredder + float biomeR = r; + float biomeG = g; + float biomeB = b; + + float r11 = c11 * r; float g11 = c11 * g; float b11 = c11 * b; @@ -98,6 +108,10 @@ bool TileRenderer::tesselateBlockInWorld( Tile* tt, int x, int y, int z, float r if (tt->zz0 > 0) br = centerBrightness; t.color(r2 * br, g2 * br, b2 * br); renderNorth(tt, xf, yf, zf, tt->getTexture(level, x, y, z, 2)); + if ((tt->getTexture(level, x, y, z, 2) == 3) && sideTinting) { // checking if the texture from terrain.png is the normal grass side texture + t.color(c2 * br * biomeR, c2 * br * biomeG, c2 * br * biomeB); + renderNorth(tt, xf, yf, zf, 38); // rendering an extra face over the side of the cube that is a grayscale grass fringe tinted by t.color using biome colors, kinda inefficient + } changed = true; } @@ -106,6 +120,10 @@ bool TileRenderer::tesselateBlockInWorld( Tile* tt, int x, int y, int z, float r if (tt->zz1 < 1) br = centerBrightness; t.color(r2 * br, g2 * br, b2 * br); renderSouth(tt, xf, yf, zf, tt->getTexture(level, x, y, z, 3)); + if ((tt->getTexture(level, x, y, z, 3) == 3) && sideTinting){ // checking if the texture from terrain.png is the normal grass side texture + t.color(c2 * br * biomeR, c2 * br * biomeG, c2 * br * biomeB); + renderSouth(tt, xf, yf, zf, 38); // rendering an extra face over the side of the cube that is a grayscale grass fringe tinted by t.color using biome colors, kinda inefficient + } changed = true; } @@ -114,6 +132,10 @@ bool TileRenderer::tesselateBlockInWorld( Tile* tt, int x, int y, int z, float r if (tt->xx0 > 0) br = centerBrightness; t.color(r3 * br, g3 * br, b3 * br); renderWest(tt, xf, yf, zf, tt->getTexture(level, x, y, z, 4)); + if ((tt->getTexture(level, x, y, z, 4) == 3) && sideTinting) { // checking if the texture from terrain.png is the normal grass side texture + t.color(c2 * br * biomeR, c2 * br * biomeG, c2 * br * biomeB); + renderWest(tt, xf, yf, zf, 38); // rendering an extra face over the side of the cube that is a grayscale grass fringe tinted by t.color using biome colors, kinda inefficient + } changed = true; } @@ -122,12 +144,17 @@ bool TileRenderer::tesselateBlockInWorld( Tile* tt, int x, int y, int z, float r if (tt->xx1 < 1) br = centerBrightness; t.color(r3 * br, g3 * br, b3 * br); renderEast(tt, xf, yf, zf, tt->getTexture(level, x, y, z, 5)); + if ((tt->getTexture(level, x, y, z, 5) == 3) && sideTinting) { // checking if the texture from terrain.png is the normal grass side texture + t.color(c2 * br * biomeR, c2 * br * biomeG, c2 * br * biomeB); + renderEast(tt, xf, yf, zf, 38); // rendering an extra face over the side of the cube that is a grayscale grass fringe tinted by t.color using biome colors, kinda inefficient + } changed = true; } return changed; } + void TileRenderer::tesselateInWorld( Tile* tile, int x, int y, int z, int fixedTexture ) { this->fixedTexture = fixedTexture; @@ -144,38 +171,38 @@ bool TileRenderer::tesselateInWorld( Tile* tt, int x, int y, int z ) return tesselateBlockInWorld(tt, x, y, z); } else if (shape == Tile::SHAPE_WATER) { return tesselateWaterInWorld(tt, x, y, z); - } else if (shape == Tile::SHAPE_CACTUS) { - return tesselateCactusInWorld(tt, x, y, z); + } else if (shape == Tile::SHAPE_CACTUS) { + return tesselateCactusInWorld(tt, x, y, z); } else if (shape == Tile::SHAPE_CROSS_TEXTURE) { return tesselateCrossInWorld(tt, x, y, z); } else if(shape == Tile::SHAPE_STEM) { return tesselateStemInWorld(tt, x, y, z); } else if (shape == Tile::SHAPE_ROWS) { - return tesselateRowInWorld(tt, x, y, z); + return tesselateRowInWorld(tt, x, y, z); } else if (shape == Tile::SHAPE_TORCH) { return tesselateTorchInWorld(tt, x, y, z); - //} else if (shape == Tile::SHAPE_FIRE) { - // return tesselateFireInWorld(tt, x, y, z); - //} else if (shape == Tile::SHAPE_RED_DUST) { - // return tesselateDustInWorld(tt, x, y, z); + } else if (shape == Tile::SHAPE_FIRE) { + return tesselateFireInWorld(tt, x, y, z); + //} else if (shape == Tile::SHAPE_RED_DUST) { + // return tesselateDustInWorld(tt, x, y, z); } else if (shape == Tile::SHAPE_LADDER) { return tesselateLadderInWorld(tt, x, y, z); } else if (shape == Tile::SHAPE_DOOR) { return tesselateDoorInWorld(tt, x, y, z); - //} else if (shape == Tile::SHAPE_RAIL) { - // return tesselateRailInWorld(tt, x, y, z); + //} else if (shape == Tile::SHAPE_RAIL) { + // return tesselateRailInWorld(tt, x, y, z); } else if (shape == Tile::SHAPE_STAIRS) { return tesselateStairsInWorld((StairTile*)tt, x, y, z); - } else if (shape == Tile::SHAPE_FENCE) { - return tesselateFenceInWorld((FenceTile*)tt, x, y, z); + } else if (shape == Tile::SHAPE_FENCE) { + return tesselateFenceInWorld((FenceTile*)tt, x, y, z); } else if (shape == Tile::SHAPE_FENCE_GATE) { return tesselateFenceGateInWorld((FenceGateTile*) tt, x, y, z); - //} else if (shape == Tile::SHAPE_LEVER) { - // return tesselateLeverInWorld(tt, x, y, z); - //} else if (shape == Tile::SHAPE_BED) { - // return tesselateBedInWorld(tt, x, y, z); - //} else if (shape == Tile::SHAPE_DIODE) { - // return tesselateDiodeInWorld(tt, x, y, z); + //} else if (shape == Tile::SHAPE_LEVER) { + // return tesselateLeverInWorld(tt, x, y, z); + //} else if (shape == Tile::SHAPE_BED) { + // return tesselateBedInWorld(tt, x, y, z); + //} else if (shape == Tile::SHAPE_DIODE) { + // return tesselateDiodeInWorld(tt, x, y, z); } else if (shape == Tile::SHAPE_IRON_FENCE) { return tesselateThinFenceInWorld((ThinFenceTile*) tt, x, y, z); } else if(shape == Tile::SHAPE_BED) { @@ -219,6 +246,278 @@ bool TileRenderer::tesselateTorchInWorld( Tile* tt, int x, int y, int z ) return true; } +bool TileRenderer::tesselateFireInWorld( Tile* tt, int x, int y, int z ) +{ + // fire transparency has been fixed - shredder + + Tesselator& t = Tesselator::instance; + + int tex = tt->getTexture(0); + + if (fixedTexture >= 0) tex = fixedTexture; + + float br = tt->getBrightness( level, x, y, z ); + t.color( br, br, br ); + + int xt = ((tex & 0xf) << 4); + int yt = tex & 0xf0; + + float u0 = (xt) / 256.0f; + float u1 = (xt + 15.99f) / 256.0f; + float v0 = (yt) / 256.0f; + float v1 = (yt + 15.99f) / 256.0f; + float h = 1.4f; + + if ( level->isSolidBlockingTile( x, y - 1, z ) || Tile::fire->canBurn( level, x, y - 1, z ) ) + { + float x0 = x + 0.5f + 0.2f; + float x1 = x + 0.5f - 0.2f; + float z0 = z + 0.5f + 0.2f; + float z1 = z + 0.5f - 0.2f; + + float x0_ = x + 0.5f - 0.3f; + float x1_ = x + 0.5f + 0.3f; + float z0_ = z + 0.5f - 0.3f; + float z1_ = z + 0.5f + 0.3f; + + t.vertexUV( ( float )( x0_ ), ( float )( y + h ), ( float )( z + 1 ), ( float )( u1 ), ( float )( v0 ) ); + t.vertexUV( ( float )( x0 ), ( float )( y + 0 ), ( float )( z + 1 ), ( float )( u1 ), ( float )( v1 ) ); + t.vertexUV( ( float )( x0 ), ( float )( y + 0 ), ( float )( z + 0 ), ( float )( u0 ), ( float )( v1 ) ); + t.vertexUV( ( float )( x0_ ), ( float )( y + h ), ( float )( z + 0 ), ( float )( u0 ), ( float )( v0 ) ); + + t.vertexUV( ( float )( x1_ ), ( float )( y + h ), ( float )( z + 0 ), ( float )( u1 ), ( float )( v0 ) ); + t.vertexUV( ( float )( x1 ), ( float )( y + 0 ), ( float )( z + 0 ), ( float )( u1 ), ( float )( v1 ) ); + t.vertexUV( ( float )( x1 ), ( float )( y + 0 ), ( float )( z + 1 ), ( float )( u0 ), ( float )( v1 ) ); + t.vertexUV( ( float )( x1_ ), ( float )( y + h ), ( float )( z + 1 ), ( float )( u0 ), ( float )( v0 ) ); + + + + u0 = (xt) / 256.0f; + u1 = (xt + 15.99f) / 256.0f; + v0 = (yt) / 256.0f; + v1 = (yt + 15.99f) / 256.0f; + + t.vertexUV( ( float )( x + 1 ), ( float )( y + h ), ( float )( z1_ ), ( float )( u1 ), ( float )( v0 ) ); + t.vertexUV( ( float )( x + 1 ), ( float )( y + 0 ), ( float )( z1 ), ( float )( u1 ), ( float )( v1 ) ); + t.vertexUV( ( float )( x + 0 ), ( float )( y + 0 ), ( float )( z1 ), ( float )( u0 ), ( float )( v1 ) ); + t.vertexUV( ( float )( x + 0 ), ( float )( y + h ), ( float )( z1_ ), ( float )( u0 ), ( float )( v0 ) ); + + t.vertexUV( ( float )( x + 0 ), ( float )( y + h ), ( float )( z0_ ), ( float )( u1 ), ( float )( v0 ) ); + t.vertexUV( ( float )( x + 0 ), ( float )( y + 0 ), ( float )( z0 ), ( float )( u1 ), ( float )( v1 ) ); + t.vertexUV( ( float )( x + 1 ), ( float )( y + 0 ), ( float )( z0 ), ( float )( u0 ), ( float )( v1 ) ); + t.vertexUV( ( float )( x + 1 ), ( float )( y + h ), ( float )( z0_ ), ( float )( u0 ), ( float )( v0 ) ); + + x0 = x + 0.5f - 0.5f; + x1 = x + 0.5f + 0.5f; + z0 = z + 0.5f - 0.5f; + z1 = z + 0.5f + 0.5f; + + x0_ = x + 0.5f - 0.4f; + x1_ = x + 0.5f + 0.4f; + z0_ = z + 0.5f - 0.4f; + z1_ = z + 0.5f + 0.4f; + + t.vertexUV( ( float )( x0_ ), ( float )( y + h ), ( float )( z + 0 ), ( float )( u0 ), ( float )( v0 ) ); + t.vertexUV( ( float )( x0 ), ( float )( y + 0 ), ( float )( z + 0 ), ( float )( u0 ), ( float )( v1 ) ); + t.vertexUV( ( float )( x0 ), ( float )( y + 0 ), ( float )( z + 1 ), ( float )( u1 ), ( float )( v1 ) ); + t.vertexUV( ( float )( x0_ ), ( float )( y + h ), ( float )( z + 1 ), ( float )( u1 ), ( float )( v0 ) ); + + t.vertexUV( ( float )( x1_ ), ( float )( y + h ), ( float )( z + 1 ), ( float )( u0 ), ( float )( v0 ) ); + t.vertexUV( ( float )( x1 ), ( float )( y + 0 ), ( float )( z + 1 ), ( float )( u0 ), ( float )( v1 ) ); + t.vertexUV( ( float )( x1 ), ( float )( y + 0 ), ( float )( z + 0 ), ( float )( u1 ), ( float )( v1 ) ); + t.vertexUV( ( float )( x1_ ), ( float )( y + h ), ( float )( z + 0 ), ( float )( u1 ), ( float )( v0 ) ); + + + u0 = (xt) / 256.0f; + u1 = (xt + 15.99f) / 256.0f; + v0 = (yt) / 256.0f; + v1 = (yt + 15.99f) / 256.0f; + + t.vertexUV( ( float )( x + 0 ), ( float )( y + h ), ( float )( z1_ ), ( float )( u0 ), ( float )( v0 ) ); + t.vertexUV( ( float )( x + 0 ), ( float )( y + 0 ), ( float )( z1 ), ( float )( u0 ), ( float )( v1 ) ); + t.vertexUV( ( float )( x + 1 ), ( float )( y + 0 ), ( float )( z1 ), ( float )( u1 ), ( float )( v1 ) ); + t.vertexUV( ( float )( x + 1 ), ( float )( y + h ), ( float )( z1_ ), ( float )( u1 ), ( float )( v0 ) ); + + t.vertexUV( ( float )( x + 1 ), ( float )( y + h ), ( float )( z0_ ), ( float )( u0 ), ( float )( v0 ) ); + t.vertexUV( ( float )( x + 1 ), ( float )( y + 0 ), ( float )( z0 ), ( float )( u0 ), ( float )( v1 ) ); + t.vertexUV( ( float )( x + 0 ), ( float )( y + 0 ), ( float )( z0 ), ( float )( u1 ), ( float )( v1 ) ); + t.vertexUV( ( float )( x + 0 ), ( float )( y + h ), ( float )( z0_ ), ( float )( u1 ), ( float )( v0 ) ); + } + else + { + float r = 0.2f; + float yo = 1 / 16.0f; + if ( ( ( x + y + z ) & 1 ) == 1 ) + { + u0 = (xt) / 256.0f; + u1 = (xt + 15.99f) / 256.0f; + v0 = (yt) / 256.0f; + v1 = (yt + 15.99f) / 256.0f; + } + if ( ( ( x / 2 + y / 2 + z / 2 ) & 1 ) == 1 ) + { + float tmp = u1; + u1 = u0; + u0 = tmp; + } + if ( Tile::fire->canBurn( level, x - 1, y, z ) ) + { + t.vertexUV( ( float )( x + r ), ( float )( y + h + yo ), ( float )( z + + 1.0f ), ( float )( u1 ), ( float )( v0 ) ); + t.vertexUV( ( float )( x + 0.0f ), ( float )( y + 0.0f + yo ), ( float )( z + + 1.0f ), ( float )( u1 ), ( float )( v1 ) ); + t.vertexUV( ( float )( x + 0.0f ), ( float )( y + 0.0f + yo ), ( float )( z + + 0.0f ), ( float )( u0 ), ( float )( v1 ) ); + t.vertexUV( ( float )( x + r ), ( float )( y + h + yo ), ( float )( z + + 0.0f ), ( float )( u0 ), ( float )( v0 ) ); + + t.vertexUV( ( float )( x + r ), ( float )( y + h + yo ), ( float )( z + + 0.0f ), ( float )( u0 ), ( float )( v0 ) ); + t.vertexUV( ( float )( x + 0.0f ), ( float )( y + 0.0f + yo ), ( float )( z + + 0.0f ), ( float )( u0 ), ( float )( v1 ) ); + t.vertexUV( ( float )( x + 0.0f ), ( float )( y + 0.0f + yo ), ( float )( z + + 1.0f ), ( float )( u1 ), ( float )( v1 ) ); + t.vertexUV( ( float )( x + r ), ( float )( y + h + yo ), ( float )( z + + 1.0f ), ( float )( u1 ), ( float )( v0 ) ); + } + if ( Tile::fire->canBurn( level, x + 1, y, z ) ) + { + t.vertexUV( ( float )( x + 1 - r ), ( float )( y + h + yo ), ( float )( z + + 0.0f ), ( float )( u0 ), ( float )( v0 ) ); + t.vertexUV( ( float )( x + 1 - 0 ), ( float )( y + 0 + yo ), ( float )( z + + 0.0f ), ( float )( u0 ), ( float )( v1 ) ); + t.vertexUV( ( float )( x + 1 - 0 ), ( float )( y + 0 + yo ), ( float )( z + + 1.0f ), ( float )( u1 ), ( float )( v1 ) ); + t.vertexUV( ( float )( x + 1 - r ), ( float )( y + h + yo ), ( float )( z + + 1.0f ), ( float )( u1 ), ( float )( v0 ) ); + + t.vertexUV( ( float )( x + 1.0f - r ), ( float )( y + h + yo ), ( float )( z + + 1.0f ), ( float )( u1 ), ( float )( v0 ) ); + t.vertexUV( ( float )( x + 1.0f - 0.0f ), ( float )( y + 0.0f + yo ), ( float )( z + + 1.0f ), ( float )( u1 ), ( float )( v1 ) ); + t.vertexUV( ( float )( x + 1.0f - 0 ), ( float )( y + 0.0f + yo ), ( float )( z + + 0.0f ), ( float )( u0 ), ( float )( v1 ) ); + t.vertexUV( ( float )( x + 1.0f - r ), ( float )( y + h + yo ), ( float )( z + + 0.0f ), ( float )( u0 ), ( float )( v0 ) ); + } + if ( Tile::fire->canBurn( level, x, y, z - 1 ) ) + { + t.vertexUV( ( float )( x + 0.0f ), ( float )( y + h + yo ), ( float )( z + + r ), ( float )( u1 ), ( float )( v0 ) ); + t.vertexUV( ( float )( x + 0.0f ), ( float )( y + 0.0f + yo ), ( float )( z + + 0.0f ), ( float )( u1 ), ( float )( v1 ) ); + t.vertexUV( ( float )( x + 1.0f ), ( float )( y + 0.0f + yo ), ( float )( z + + 0.0f ), ( float )( u0 ), ( float )( v1 ) ); + t.vertexUV( ( float )( x + 1.0f ), ( float )( y + h + yo ), ( float )( z + + r ), ( float )( u0 ), ( float )( v0 ) ); + + t.vertexUV( ( float )( x + 1.0f ), ( float )( y + h + yo ), ( float )( z + + r ), ( float )( u0 ), ( float )( v0 ) ); + t.vertexUV( ( float )( x + 1.0f ), ( float )( y + 0.0f + yo ), ( float )( z + + 0.0f ), ( float )( u0 ), ( float )( v1 ) ); + t.vertexUV( ( float )( x + 0.0f ), ( float )( y + 0.0f + yo ), ( float )( z + + 0.0f ), ( float )( u1 ), ( float )( v1 ) ); + t.vertexUV( ( float )( x + 0.0f ), ( float )( y + h + yo ), ( float )( z + + r ), ( float )( u1 ), ( float )( v0 ) ); + } + if ( Tile::fire->canBurn( level, x, y, z + 1 ) ) + { + t.vertexUV( ( float )( x + 1.0f ), ( float )( y + h + yo ), ( float )( z + 1.0f - + r ), ( float )( u0 ), ( float )( v0 ) ); + t.vertexUV( ( float )( x + 1.0f ), ( float )( y + 0.0f + yo ), ( float )( z + 1.0f - + 0.0f ), ( float )( u0 ), ( float )( v1 ) ); + t.vertexUV( ( float )( x + 0.0f ), ( float )( y + 0.0f + yo ), ( float )( z + 1.0f - + 0.0f ), ( float )( u1 ), ( float )( v1 ) ); + t.vertexUV( ( float )( x + 0.0f ), ( float )( y + h + yo ), ( float )( z + 1.0f - + r ), ( float )( u1 ), ( float )( v0 ) ); + + t.vertexUV( ( float )( x + 0.0f ), ( float )( y + h + yo ), ( float )( z + 1.0f - + r ), ( float )( u1 ), ( float )( v0 ) ); + t.vertexUV( ( float )( x + 0.0f ), ( float )( y + 0.0f + yo ), ( float )( z + 1.0f - + 0.0f ), ( float )( u1 ), ( float )( v1 ) ); + t.vertexUV( ( float )( x + 1.0f ), ( float )( y + 0.0f + yo ), ( float )( z + 1.0f - + 0.0f ), ( float )( u0 ), ( float )( v1 ) ); + t.vertexUV( ( float )( x + 1.0f ), ( float )( y + h + yo ), ( float )( z + 1.0f - + r ), ( float )( u0 ), ( float )( v0 ) ); + } + if ( Tile::fire->canBurn( level, x, y + 1.0f, z ) ) + { + double x0 = x + 0.5f + 0.5f; + double x1 = x + 0.5f - 0.5f; + double z0 = z + 0.5f + 0.5f; + double z1 = z + 0.5f - 0.5f; + + double x0_ = x + 0.5f - 0.5f; + double x1_ = x + 0.5f + 0.5f; + double z0_ = z + 0.5f - 0.5f; + double z1_ = z + 0.5f + 0.5f; + + u0 = (xt) / 256.0f; + u1 = (xt + 15.99f) / 256.0f; + v0 = (yt) / 256.0f; + v1 = (yt + 15.99f) / 256.0f; + + y += 1; + h = -0.2f; + + if ( ( ( x + y + z ) & 1 ) == 0 ) + { + t.vertexUV( ( float )( x0_ ), ( float )( y + h ), ( float )( z + + 0 ), ( float )( u1 ), ( float )( v0 ) ); + t.vertexUV( ( float )( x0 ), ( float )( y + 0 ), ( float )( z + + 0 ), ( float )( u1 ), ( float )( v1 ) ); + t.vertexUV( ( float )( x0 ), ( float )( y + 0 ), ( float )( z + + 1 ), ( float )( u0 ), ( float )( v1 ) ); + t.vertexUV( ( float )( x0_ ), ( float )( y + h ), ( float )( z + + 1 ), ( float )( u0 ), ( float )( v0 ) ); + + u0 = (xt) / 256.0f; + u1 = (xt + 15.99f) / 256.0f; + v0 = (yt) / 256.0f; + v1 = (yt + 15.99f) / 256.0f; + + t.vertexUV( ( float )( x1_ ), ( float )( y + h ), ( float )( z + + 1.0f ), ( float )( u1 ), ( float )( v0 ) ); + t.vertexUV( ( float )( x1 ), ( float )( y + 0.0f ), ( float )( z + + 1.0f ), ( float )( u1 ), ( float )( v1 ) ); + t.vertexUV( ( float )( x1 ), ( float )( y + 0.0f ), ( float )( z + + 0 ), ( float )( u0 ), ( float )( v1 ) ); + t.vertexUV( ( float )( x1_ ), ( float )( y + h ), ( float )( z + + 0 ), ( float )( u0 ), ( float )( v0 ) ); + } + else + { + t.vertexUV( ( float )( x + 0.0f ), ( float )( y + + h ), ( float )( z1_ ), ( float )( u1 ), ( float )( v0 ) ); + t.vertexUV( ( float )( x + 0.0f ), ( float )( y + + 0.0f ), ( float )( z1 ), ( float )( u1 ), ( float )( v1 ) ); + t.vertexUV( ( float )( x + 1.0f ), ( float )( y + + 0.0f ), ( float )( z1 ), ( float )( u0 ), ( float )( v1 ) ); + t.vertexUV( ( float )( x + 1.0f ), ( float )( y + + h ), ( float )( z1_ ), ( float )( u0 ), ( float )( v0 ) ); + + u0 = (xt) / 256.0f; + u1 = (xt + 15.99f) / 256.0f; + v0 = (yt) / 256.0f; + v1 = (yt + 15.99f) / 256.0f; + + t.vertexUV( ( float )( x + 1.0f ), ( float )( y + + h ), ( float )( z0_ ), ( float )( u1 ), ( float )( v0 ) ); + t.vertexUV( ( float )( x + 1.0f ), ( float )( y + + 0.0f ), ( float )( z0 ), ( float )( u1 ), ( float )( v1 ) ); + t.vertexUV( ( float )( x + 0.0f ), ( float )( y + + 0.0f ), ( float )( z0 ), ( float )( u0 ), ( float )( v1 ) ); + t.vertexUV( ( float )( x + 0.0f ), ( float )( y + + h ), ( float )( z0_ ), ( float )( u0 ), ( float )( v0 ) ); + } + } + } + + return true; + +} + + bool TileRenderer::tesselateLadderInWorld( Tile* tt, int x, int y, int z ) { Tesselator& t = Tesselator::instance; @@ -682,46 +981,46 @@ float TileRenderer::getWaterHeight( int x, int y, int z, const Material* m ) } void TileRenderer::renderBlock(Tile* tt, LevelSource* level, int x, int y, int z) { - float c10 = 0.5f; - float c11 = 1; - float c2 = 0.8f; - float c3 = 0.6f; + float c10 = 0.5f; + float c11 = 1; + float c2 = 0.8f; + float c3 = 0.6f; - Tesselator& t = Tesselator::instance; - t.begin(); + Tesselator& t = Tesselator::instance; + t.begin(); - float center = tt->getBrightness(level, x, y, z); - float br = tt->getBrightness(level, x, y - 1, z); - if (br < center) br = center; + float center = tt->getBrightness(level, x, y, z); + float br = tt->getBrightness(level, x, y - 1, z); + if (br < center) br = center; - t.color(c10 * br, c10 * br, c10 * br); - renderFaceDown(tt, -0.5f, -0.5f, -0.5f, tt->getTexture(0)); + t.color(c10 * br, c10 * br, c10 * br); + renderFaceDown(tt, -0.5f, -0.5f, -0.5f, tt->getTexture(0)); - br = tt->getBrightness(level, x, y + 1, z); - if (br < center) br = center; - t.color(c11 * br, c11 * br, c11 * br); - renderFaceUp(tt, -0.5f, -0.5f, -0.5f, tt->getTexture(1)); + br = tt->getBrightness(level, x, y + 1, z); + if (br < center) br = center; + t.color(c11 * br, c11 * br, c11 * br); + renderFaceUp(tt, -0.5f, -0.5f, -0.5f, tt->getTexture(1)); - br = tt->getBrightness(level, x, y, z - 1); - if (br < center) br = center; - t.color(c2 * br, c2 * br, c2 * br); - renderNorth(tt, -0.5f, -0.5f, -0.5f, tt->getTexture(2)); + br = tt->getBrightness(level, x, y, z - 1); + if (br < center) br = center; + t.color(c2 * br, c2 * br, c2 * br); + renderNorth(tt, -0.5f, -0.5f, -0.5f, tt->getTexture(2)); - br = tt->getBrightness(level, x, y, z + 1); - if (br < center) br = center; - t.color(c2 * br, c2 * br, c2 * br); - renderSouth(tt, -0.5f, -0.5f, -0.5f, tt->getTexture(3)); + br = tt->getBrightness(level, x, y, z + 1); + if (br < center) br = center; + t.color(c2 * br, c2 * br, c2 * br); + renderSouth(tt, -0.5f, -0.5f, -0.5f, tt->getTexture(3)); - br = tt->getBrightness(level, x - 1, y, z); - if (br < center) br = center; - t.color(c3 * br, c3 * br, c3 * br); - renderWest(tt, -0.5f, -0.5f, -0.5f, tt->getTexture(4)); + br = tt->getBrightness(level, x - 1, y, z); + if (br < center) br = center; + t.color(c3 * br, c3 * br, c3 * br); + renderWest(tt, -0.5f, -0.5f, -0.5f, tt->getTexture(4)); - br = tt->getBrightness(level, x + 1, y, z); - if (br < center) br = center; - t.color(c3 * br, c3 * br, c3 * br); - renderEast(tt, -0.5f, -0.5f, -0.5f, tt->getTexture(5)); - t.draw(); + br = tt->getBrightness(level, x + 1, y, z); + if (br < center) br = center; + t.color(c3 * br, c3 * br, c3 * br); + renderEast(tt, -0.5f, -0.5f, -0.5f, tt->getTexture(5)); + t.draw(); } bool TileRenderer::tesselateBlockInWorldWithAmbienceOcclusion( Tile* tt, int pX, int pY, int pZ, float pBaseRed, float pBaseGreen, float pBaseBlue ) @@ -921,6 +1220,15 @@ bool TileRenderer::tesselateBlockInWorldWithAmbienceOcclusion( Tile* tt, int pX, c4g *= ll4; c4b *= ll4; renderNorth(tt, (float) pX, (float) pY, (float) pZ, tt->getTexture(level, pX, pY, pZ, 2)); + if (tt->getTexture(level, pX, pY, pZ, 2) == 3 && sideTinting) + { + c1r *= pBaseRed; c1g *= pBaseGreen; c1b *= pBaseBlue; + c2r *= pBaseRed; c2g *= pBaseGreen; c2b *= pBaseBlue; + c3r *= pBaseRed; c3g *= pBaseGreen; c3b *= pBaseBlue; + c4r *= pBaseRed; c4g *= pBaseGreen; c4b *= pBaseBlue; + + renderNorth(tt, (float) pX, (float) pY, (float) pZ, 38); + } i = true; } if ((noCulling) || (tt->shouldRenderFace(level, pX, pY, pZ + 1, 3))) { @@ -974,6 +1282,15 @@ bool TileRenderer::tesselateBlockInWorldWithAmbienceOcclusion( Tile* tt, int pX, c4g *= ll4; c4b *= ll4; renderSouth(tt, (float) pX, (float) pY, (float) pZ, tt->getTexture(level, pX, pY, pZ, 3)); + if (tt->getTexture(level, pX, pY, pZ, 3) == 3 && sideTinting) + { + c1r *= pBaseRed; c1g *= pBaseGreen; c1b *= pBaseBlue; + c2r *= pBaseRed; c2g *= pBaseGreen; c2b *= pBaseBlue; + c3r *= pBaseRed; c3g *= pBaseGreen; c3b *= pBaseBlue; + c4r *= pBaseRed; c4g *= pBaseGreen; c4b *= pBaseBlue; + + renderSouth(tt, (float) pX, (float) pY, (float) pZ, 38); + } i = true; } if ((noCulling) || (tt->shouldRenderFace(level, pX - 1, pY, pZ, 4))) { @@ -1026,6 +1343,15 @@ bool TileRenderer::tesselateBlockInWorldWithAmbienceOcclusion( Tile* tt, int pX, c4g *= ll4; c4b *= ll4; renderWest(tt, (float) pX, (float) pY, (float) pZ, tt->getTexture(level, pX, pY, pZ, 4)); + if (tt->getTexture(level, pX, pY, pZ, 4) == 3 && sideTinting) + { + c1r *= pBaseRed; c1g *= pBaseGreen; c1b *= pBaseBlue; + c2r *= pBaseRed; c2g *= pBaseGreen; c2b *= pBaseBlue; + c3r *= pBaseRed; c3g *= pBaseGreen; c3b *= pBaseBlue; + c4r *= pBaseRed; c4g *= pBaseGreen; c4b *= pBaseBlue; + + renderWest(tt, (float) pX, (float) pY, (float) pZ, 38); + } i = true; } if ((noCulling) || (tt->shouldRenderFace(level, pX + 1, pY, pZ, 5))) { @@ -1079,6 +1405,15 @@ bool TileRenderer::tesselateBlockInWorldWithAmbienceOcclusion( Tile* tt, int pX, c4b *= ll4; renderEast(tt, (float) pX, (float) pY, (float) pZ, tt->getTexture(level, pX, pY, pZ, 5)); + if (tt->getTexture(level, pX, pY, pZ, 5) == 3 && sideTinting) + { + c1r *= pBaseRed; c1g *= pBaseGreen; c1b *= pBaseBlue; + c2r *= pBaseRed; c2g *= pBaseGreen; c2b *= pBaseBlue; + c3r *= pBaseRed; c3g *= pBaseGreen; c3b *= pBaseBlue; + c4r *= pBaseRed; c4g *= pBaseGreen; c4b *= pBaseBlue; + + renderEast(tt, (float) pX, (float) pY, (float) pZ, 38); + } i = true; } applyAmbienceOcclusion = false; @@ -1086,124 +1421,124 @@ bool TileRenderer::tesselateBlockInWorldWithAmbienceOcclusion( Tile* tt, int pX, } bool TileRenderer::tesselateCactusInWorld(Tile* tt, int x, int y, int z) { - int col = tt->getColor(level, x, y, z); - float r = ((col >> 16) & 0xff) / 255.0f; - float g = ((col >> 8) & 0xff) / 255.0f; - float b = ((col) & 0xff) / 255.0f; - return tesselateCactusInWorld(tt, x, y, z, r, g, b); + int col = tt->getColor(level, x, y, z); + float r = ((col >> 16) & 0xff) / 255.0f; + float g = ((col >> 8) & 0xff) / 255.0f; + float b = ((col) & 0xff) / 255.0f; + return tesselateCactusInWorld(tt, x, y, z, r, g, b); } bool TileRenderer::tesselateCactusInWorld(Tile* tt, int x, int y, int z, float r, float g, float b) { - Tesselator& t = Tesselator::instance; + Tesselator& t = Tesselator::instance; - bool changed = false; - float c10 = 0.5f; - float c11 = 1; - float c2 = 0.8f; - float c3 = 0.6f; + bool changed = false; + float c10 = 0.5f; + float c11 = 1; + float c2 = 0.8f; + float c3 = 0.6f; - float r10 = c10 * r; - float r11 = c11 * r; - float r2 = c2 * r; - float r3 = c3 * r; + float r10 = c10 * r; + float r11 = c11 * r; + float r2 = c2 * r; + float r3 = c3 * r; - float g10 = c10 * g; - float g11 = c11 * g; - float g2 = c2 * g; - float g3 = c3 * g; + float g10 = c10 * g; + float g11 = c11 * g; + float g2 = c2 * g; + float g3 = c3 * g; - float b10 = c10 * b; - float b11 = c11 * b; - float b2 = c2 * b; - float b3 = c3 * b; + float b10 = c10 * b; + float b11 = c11 * b; + float b2 = c2 * b; + float b3 = c3 * b; - float s = 1 / 16.0f; + float s = 1 / 16.0f; const float X = (float)x; const float Y = (float)y; const float Z = (float)z; - float centerBrightness = tt->getBrightness(level, x, y, z); + float centerBrightness = tt->getBrightness(level, x, y, z); - if (noCulling || tt->shouldRenderFace(level, x, y - 1, z, 0)) { - float br = tt->getBrightness(level, x, y - 1, z); - // if (Tile::lightEmission[tt->id] > br*Level.MAX_BRIGHTNESS) br = -// Tile::lightEmission[tt->id]/Level.MAX_BRIGHTNESS; - t.color(r10 * br, g10 * br, b10 * br); - renderFaceDown(tt, X, Y, Z, tt->getTexture(level, x, y, z, 0)); - changed = true; - } + if (noCulling || tt->shouldRenderFace(level, x, y - 1, z, 0)) { + float br = tt->getBrightness(level, x, y - 1, z); + // if (Tile::lightEmission[tt->id] > br*Level.MAX_BRIGHTNESS) br = + // Tile::lightEmission[tt->id]/Level.MAX_BRIGHTNESS; + t.color(r10 * br, g10 * br, b10 * br); + renderFaceDown(tt, X, Y, Z, tt->getTexture(level, x, y, z, 0)); + changed = true; + } - if (noCulling || tt->shouldRenderFace(level, x, y + 1, z, 1)) { - float br = tt->getBrightness(level, x, y + 1, z); - if (tt->yy1 != 1 && !tt->material->isLiquid()) br = centerBrightness; - // if (Tile::lightEmission[tt->id] > br*Level.MAX_BRIGHTNESS) br = -// Tile::lightEmission[tt->id]/Level.MAX_BRIGHTNESS; - t.color(r11 * br, g11 * br, b11 * br); - renderFaceUp(tt, X, Y, Z, tt->getTexture(level, x, y, z, 1)); - changed = true; - } + if (noCulling || tt->shouldRenderFace(level, x, y + 1, z, 1)) { + float br = tt->getBrightness(level, x, y + 1, z); + if (tt->yy1 != 1 && !tt->material->isLiquid()) br = centerBrightness; + // if (Tile::lightEmission[tt->id] > br*Level.MAX_BRIGHTNESS) br = + // Tile::lightEmission[tt->id]/Level.MAX_BRIGHTNESS; + t.color(r11 * br, g11 * br, b11 * br); + renderFaceUp(tt, X, Y, Z, tt->getTexture(level, x, y, z, 1)); + changed = true; + } - if (noCulling || tt->shouldRenderFace(level, x, y, z - 1, 2)) { - float br = tt->getBrightness(level, x, y, z - 1); - if (tt->zz0 > 0) br = centerBrightness; - // if (Tile::lightEmission[tt->id] > br*Level.MAX_BRIGHTNESS) br = -// Tile::lightEmission[tt->id]/Level.MAX_BRIGHTNESS; - t.color(r2 * br, g2 * br, b2 * br); - t.addOffset(0, 0, s); - renderNorth(tt, X, Y, Z, tt->getTexture(level, x, y, z, 2)); - t.addOffset(0, 0, -s); - changed = true; - } + if (noCulling || tt->shouldRenderFace(level, x, y, z - 1, 2)) { + float br = tt->getBrightness(level, x, y, z - 1); + if (tt->zz0 > 0) br = centerBrightness; + // if (Tile::lightEmission[tt->id] > br*Level.MAX_BRIGHTNESS) br = + // Tile::lightEmission[tt->id]/Level.MAX_BRIGHTNESS; + t.color(r2 * br, g2 * br, b2 * br); + t.addOffset(0, 0, s); + renderNorth(tt, X, Y, Z, tt->getTexture(level, x, y, z, 2)); + t.addOffset(0, 0, -s); + changed = true; + } - if (noCulling || tt->shouldRenderFace(level, x, y, z + 1, 3)) { - float br = tt->getBrightness(level, x, y, z + 1); - if (tt->zz1 < 1) br = centerBrightness; - // if (Tile::lightEmission[tt->id] > br*Level.MAX_BRIGHTNESS) br = -// Tile::lightEmission[tt->id]/Level.MAX_BRIGHTNESS; - t.color(r2 * br, g2 * br, b2 * br); - t.addOffset(0, 0, -s); - renderSouth(tt, X, Y, Z, tt->getTexture(level, x, y, z, 3)); - t.addOffset(0, 0, s); - changed = true; - } + if (noCulling || tt->shouldRenderFace(level, x, y, z + 1, 3)) { + float br = tt->getBrightness(level, x, y, z + 1); + if (tt->zz1 < 1) br = centerBrightness; + // if (Tile::lightEmission[tt->id] > br*Level.MAX_BRIGHTNESS) br = + // Tile::lightEmission[tt->id]/Level.MAX_BRIGHTNESS; + t.color(r2 * br, g2 * br, b2 * br); + t.addOffset(0, 0, -s); + renderSouth(tt, X, Y, Z, tt->getTexture(level, x, y, z, 3)); + t.addOffset(0, 0, s); + changed = true; + } - if (noCulling || tt->shouldRenderFace(level, x - 1, y, z, 4)) { - float br = tt->getBrightness(level, x - 1, y, z); - if (tt->xx0 > 0) br = centerBrightness; - // if (Tile::lightEmission[tt->id] > br*Level.MAX_BRIGHTNESS) br = -// Tile::lightEmission[tt->id]/Level.MAX_BRIGHTNESS; - t.color(r3 * br, g3 * br, b3 * br); - t.addOffset(s, 0, 0); - renderWest(tt, X, Y, Z, tt->getTexture(level, x, y, z, 4)); - t.addOffset(-s, 0, 0); - changed = true; - } + if (noCulling || tt->shouldRenderFace(level, x - 1, y, z, 4)) { + float br = tt->getBrightness(level, x - 1, y, z); + if (tt->xx0 > 0) br = centerBrightness; + // if (Tile::lightEmission[tt->id] > br*Level.MAX_BRIGHTNESS) br = + // Tile::lightEmission[tt->id]/Level.MAX_BRIGHTNESS; + t.color(r3 * br, g3 * br, b3 * br); + t.addOffset(s, 0, 0); + renderWest(tt, X, Y, Z, tt->getTexture(level, x, y, z, 4)); + t.addOffset(-s, 0, 0); + changed = true; + } - if (noCulling || tt->shouldRenderFace(level, x + 1, y, z, 5)) { - float br = tt->getBrightness(level, x + 1, y, z); - if (tt->xx1 < 1) br = centerBrightness; - // if (Tile::lightEmission[tt->id] > br*Level.MAX_BRIGHTNESS) br = -// Tile::lightEmission[tt->id]/Level.MAX_BRIGHTNESS; - t.color(r3 * br, g3 * br, b3 * br); - t.addOffset(-s, 0, 0); - renderEast(tt, X, Y, Z, tt->getTexture(level, x, y, z, 5)); - t.addOffset(s, 0, 0); - changed = true; - } + if (noCulling || tt->shouldRenderFace(level, x + 1, y, z, 5)) { + float br = tt->getBrightness(level, x + 1, y, z); + if (tt->xx1 < 1) br = centerBrightness; + // if (Tile::lightEmission[tt->id] > br*Level.MAX_BRIGHTNESS) br = + // Tile::lightEmission[tt->id]/Level.MAX_BRIGHTNESS; + t.color(r3 * br, g3 * br, b3 * br); + t.addOffset(-s, 0, 0); + renderEast(tt, X, Y, Z, tt->getTexture(level, x, y, z, 5)); + t.addOffset(s, 0, 0); + changed = true; + } - return changed; + return changed; } bool TileRenderer::tesselateFenceInWorld(FenceTile* tt, int x, int y, int z) { - bool changed = true; + bool changed = true; - float a = 6 / 16.0f; - float b = 10 / 16.0f; - tt->setShape(a, 0, a, b, 1, b); - tesselateBlockInWorld(tt, x, y, z); + float a = 6 / 16.0f; + float b = 10 / 16.0f; + tt->setShape(a, 0, a, b, 1, b); + tesselateBlockInWorld(tt, x, y, z); - bool vertical = false; - bool horizontal = false; + bool vertical = false; + bool horizontal = false; bool l = tt->connectsTo(level, x - 1, y, z); bool r = tt->connectsTo(level, x + 1, y, z); @@ -1211,42 +1546,42 @@ bool TileRenderer::tesselateFenceInWorld(FenceTile* tt, int x, int y, int z) { bool d = tt->connectsTo(level, x, y, z + 1); if (l || r) vertical = true; - if (u || d) horizontal = true; + if (u || d) horizontal = true; - if (!vertical && !horizontal) vertical = true; + if (!vertical && !horizontal) vertical = true; - a = 7 / 16.0f; - b = 9 / 16.0f; - float h0 = 12 / 16.0f; - float h1 = 15 / 16.0f; + a = 7 / 16.0f; + b = 9 / 16.0f; + float h0 = 12 / 16.0f; + float h1 = 15 / 16.0f; - float x0 = l ? 0 : a; - float x1 = r ? 1 : b; - float z0 = u ? 0 : a; - float z1 = d ? 1 : b; + float x0 = l ? 0 : a; + float x1 = r ? 1 : b; + float z0 = u ? 0 : a; + float z1 = d ? 1 : b; - if (vertical) { - tt->setShape(x0, h0, a, x1, h1, b); - tesselateBlockInWorld(tt, x, y, z); - } - if (horizontal) { - tt->setShape(a, h0, z0, b, h1, z1); - tesselateBlockInWorld(tt, x, y, z); - } + if (vertical) { + tt->setShape(x0, h0, a, x1, h1, b); + tesselateBlockInWorld(tt, x, y, z); + } + if (horizontal) { + tt->setShape(a, h0, z0, b, h1, z1); + tesselateBlockInWorld(tt, x, y, z); + } - h0 = 6 / 16.0f; - h1 = 9 / 16.0f; - if (vertical) { - tt->setShape(x0, h0, a, x1, h1, b); - tesselateBlockInWorld(tt, x, y, z); - } - if (horizontal) { - tt->setShape(a, h0, z0, b, h1, z1); - tesselateBlockInWorld(tt, x, y, z); - } + h0 = 6 / 16.0f; + h1 = 9 / 16.0f; + if (vertical) { + tt->setShape(x0, h0, a, x1, h1, b); + tesselateBlockInWorld(tt, x, y, z); + } + if (horizontal) { + tt->setShape(a, h0, z0, b, h1, z1); + tesselateBlockInWorld(tt, x, y, z); + } - tt->setShape(0, 0, 0, 1, 1, 1); - return changed; + tt->setShape(0, 0, 0, 1, 1, 1); + return changed; } bool TileRenderer::tesselateFenceGateInWorld(FenceGateTile* tt, int x, int y, int z) { @@ -2033,29 +2368,53 @@ void TileRenderer::renderTile( Tile* tile, int data ) { Tesselator& t = Tesselator::instance; - t.color(0xff, 0xff, 0xff); + t.color(0xff, 0xff, 0xff); // i disabled this, this is normally enabled in normal mcpe see if this fits OPTION_NORMAL_LIGHTING - shredder int shape = tile->getRenderShape(); if (shape == Tile::SHAPE_BLOCK) { tile->updateDefaultShape(); t.addOffset(-0.5f, -0.5f, -0.5f); t.begin(); + + t.normal(0.0f, -1.0f, 0.0f);// most normal calls in this file has been added me since they existed in java - shredder + renderFaceDown(tile, 0, 0, 0, tile->getTexture(0, data)); + + t.normal(0.0f, 1.0f, 0.0f); + renderFaceUp(tile, 0, 0, 0, tile->getTexture(1, data)); + + t.normal(0.0f, 0.0f, -1.0f); + renderNorth(tile, 0, 0, 0, tile->getTexture(2, data)); + + t.normal(0.0f, 0.0f, 1.0f); + renderSouth(tile, 0, 0, 0, tile->getTexture(3, data)); + + t.normal(-1.0f, 0.0f, 0.0f); + renderWest(tile, 0, 0, 0, tile->getTexture(4, data)); + + t.normal(1.0f, 0.0f, 0.0f); + renderEast(tile, 0, 0, 0, tile->getTexture(5, data)); t.draw(); t.addOffset(0.5f, 0.5f, 0.5f); - } else if (shape == Tile::SHAPE_CROSS_TEXTURE) { + } else if (shape == Tile::SHAPE_CROSS_TEXTURE) { // uhh java has this but is this even ever used??? - shredder t.begin(); + + t.normal(0.0f, -1.0f, 0.0f); + tesselateCrossTexture(tile, data, -0.5f, -0.5f, -0.5f); t.draw(); } else if(shape == Tile::SHAPE_STEM) { t.begin(); + + t.normal(0.0f, -1.0f, 0.0f); + tile->updateDefaultShape(); tesselateStemTexture(tile, data, tile->yy1, -0.5f, -0.5f, -0.5f); t.draw(); @@ -2064,92 +2423,149 @@ void TileRenderer::renderTile( Tile* tile, int data ) t.offset(-0.5f, -0.5f, -0.5f); float s = 1 / 16.0f; t.begin(); + + t.normal(0.0f, -1.0f, 0.0f); + renderFaceDown(tile, 0, 0, 0, tile->getTexture(0)); + + t.normal(0.0f, 1.0f, 0.0f); + renderFaceUp(tile, 0, 0, 0, tile->getTexture(1)); + + t.normal(0.0f, 0.0f, -1.0f); + t.addOffset(0, 0, s); + + renderNorth(tile, 0, 0, 0, tile->getTexture(2)); + + t.normal(0.0f, 0.0f, 1.0f); + t.addOffset(0, 0, -s); t.addOffset(0, 0, -s); + + + renderSouth(tile, 0, 0, 0, tile->getTexture(3)); + + t.normal(-1.0f, 0.0f, 0.0f); + t.addOffset(0, 0, s); t.addOffset(s, 0, 0); renderWest(tile, 0, 0, 0, tile->getTexture(4)); + + t.normal(1.0f, 0.0f, 0.0f); + t.addOffset(-s, 0, 0); t.addOffset(-s, 0, 0); renderEast(tile, 0, 0, 0, tile->getTexture(5)); t.addOffset(s, 0, 0); t.draw(); t.offset(0, 0, 0);//0.5f, 0.5f, 0.5f); - } else if (shape == Tile::SHAPE_ROWS) { - t.begin(); - t.normal(0, -1, 0); - tesselateRowTexture(tile, data, -0.5f, -0.5f, -0.5f); + } else if (shape == Tile::SHAPE_ROWS) { + t.begin(); + t.normal(0, -1, 0); + tesselateRowTexture(tile, data, -0.5f, -0.5f, -0.5f); //} else if (shape == Tile::SHAPE_TORCH) { //// t.begin(); //// t.normal(0, -1, 0); - //// tesselateTorch(tile, -0.5f, -0.5f, -0.5f, 0, 0); + /// tesselateTorch(tile, -0.5f, -0.5f, -0.5f, 0, 0); //// t.end(); - } else if (shape == Tile::SHAPE_ENTITYTILE_ANIMATED) { - EntityTileRenderer::instance->render(tile, data, 1.0f); - //glEnable(GL_RESCALE_NORMAL); - } else if (shape == Tile::SHAPE_STAIRS) { - t.addOffset(-0.5f, -0.5f, -0.5f); - t.begin(); - for (int i = 0; i < 2; i++) { - if (i == 0) tile->setShape(0, 0, 0, 1, 1, 0.5f); - if (i == 1) tile->setShape(0, 0, 0.5f, 1, 0.5f, 1); + } else if (shape == Tile::SHAPE_ENTITYTILE_ANIMATED) { + EntityTileRenderer::instance->render(tile, data, 1.0f); + //glEnable(GL_RESCALE_NORMAL); + } else if (shape == Tile::SHAPE_STAIRS) { + t.addOffset(-0.5f, -0.5f, -0.5f); + t.begin(); + for (int i = 0; i < 2; i++) { + if (i == 0) tile->setShape(0, 0, 0, 1, 1, 0.5f); + if (i == 1) tile->setShape(0, 0, 0.5f, 1, 0.5f, 1); - renderFaceDown(tile, 0, 0, 0, tile->getTexture(0)); - renderFaceUp(tile, 0, 0, 0, tile->getTexture(1)); - renderNorth(tile, 0, 0, 0, tile->getTexture(2)); - renderSouth(tile, 0, 0, 0, tile->getTexture(3)); - renderWest(tile, 0, 0, 0, tile->getTexture(4)); - renderEast(tile, 0, 0, 0, tile->getTexture(5)); - } - t.draw(); - t.addOffset(0.5f, 0.5f, 0.5f); + + t.normal(0.0f, -1.0f, 0.0f); + renderFaceDown(tile, 0, 0, 0, tile->getTexture(0)); + + t.normal(0.0f, 1.0f, 0.0f); + renderFaceUp(tile, 0, 0, 0, tile->getTexture(1)); + + t.normal(0.0f, 0.0f, -1.0f); + renderNorth(tile, 0, 0, 0, tile->getTexture(2)); + + t.normal(0.0f, 0.0f, 1.0f); + renderSouth(tile, 0, 0, 0, tile->getTexture(3)); + + t.normal(-1.0f, 0.0f, 0.0f); + renderWest(tile, 0, 0, 0, tile->getTexture(4)); + + t.normal(1.0f, 0.0f, 0.0f); + renderEast(tile, 0, 0, 0, tile->getTexture(5)); } - else if (shape == Tile::SHAPE_FENCE) { - t.addOffset(-0.5f, -0.5f, -0.5f); - t.begin(); - for (int i = 0; i < 4; i++) { - float w = 2 / 16.0f; - if (i == 0) tile->setShape(0.5f - w, 0, 0, 0.5f + w, 1, w * 2); - if (i == 1) tile->setShape(0.5f - w, 0, 1 - w * 2, 0.5f + w, 1, 1); - w = 1 / 16.0f; - if (i == 2) tile->setShape(0.5f - w, 1 - w * 3, -w * 2, 0.5f + w, 1 - w, 1 + w * 2); - if (i == 3) tile->setShape(0.5f - w, 0.5f - w * 3, -w * 2, 0.5f + w, 0.5f - w, 1 + w * 2); + t.draw(); + t.addOffset(0.5f, 0.5f, 0.5f); + } + else if (shape == Tile::SHAPE_FENCE) { + t.addOffset(-0.5f, -0.5f, -0.5f); + t.begin(); + for (int i = 0; i < 4; i++) { + float w = 2 / 16.0f; + if (i == 0) tile->setShape(0.5f - w, 0, 0, 0.5f + w, 1, w * 2); + if (i == 1) tile->setShape(0.5f - w, 0, 1 - w * 2, 0.5f + w, 1, 1); + w = 1 / 16.0f; + if (i == 2) tile->setShape(0.5f - w, 1 - w * 3, -w * 2, 0.5f + w, 1 - w, 1 + w * 2); + if (i == 3) tile->setShape(0.5f - w, 0.5f - w * 3, -w * 2, 0.5f + w, 0.5f - w, 1 + w * 2); - renderFaceDown(tile, 0, 0, 0, tile->getTexture(0)); - renderFaceUp(tile, 0, 0, 0, tile->getTexture(1)); - renderNorth(tile, 0, 0, 0, tile->getTexture(2)); - renderSouth(tile, 0, 0, 0, tile->getTexture(3)); - renderWest(tile, 0, 0, 0, tile->getTexture(4)); - renderEast(tile, 0, 0, 0, tile->getTexture(5)); - } - t.draw(); - t.addOffset(0.5f, 0.5f, 0.5f); - tile->setShape(0, 0, 0, 1, 1, 1); - } else if (shape == Tile::SHAPE_FENCE_GATE) { - t.addOffset(-0.5f, -0.5f, -0.5f); - t.begin(); - for (int i = 0; i < 3; i++) { - float w = 1 / 16.0f; - if (i == 0) tile->setShape(0.5f - w, .3f, 0, 0.5f + w, 1, w * 2); - if (i == 1) tile->setShape(0.5f - w, .3f, 1 - w * 2, 0.5f + w, 1, 1); - if (i == 2) tile->setShape(0.5f - w, .5f, w * 2, 0.5f + w, 1 - w, 1 - w * 2); + t.normal(0.0f, -1.0f, 0.0f); + renderFaceDown(tile, 0, 0, 0, tile->getTexture(0)); - renderFaceUp(tile, 0, 0, 0, tile->getTexture(0)); - renderFaceDown(tile, 0, 0, 0, tile->getTexture(1)); - renderNorth(tile, 0, 0, 0, tile->getTexture(2)); - renderSouth(tile, 0, 0, 0, tile->getTexture(3)); - renderWest(tile, 0, 0, 0, tile->getTexture(4)); - renderEast(tile, 0, 0, 0, tile->getTexture(5)); - } - t.draw(); - t.addOffset(0.5f, 0.5f, 0.5f); - tile->setShape(0, 0, 0, 1, 1, 1); + t.normal(0.0f, 1.0f, 0.0f); + renderFaceUp(tile, 0, 0, 0, tile->getTexture(1)); + + t.normal(0.0f, 0.0f, -1.0f); + renderNorth(tile, 0, 0, 0, tile->getTexture(2)); + + t.normal(0.0f, 0.0f, 1.0f); + renderSouth(tile, 0, 0, 0, tile->getTexture(3)); + + t.normal(-1.0f, 0.0f, 0.0f); + renderWest(tile, 0, 0, 0, tile->getTexture(4)); + + t.normal(1.0f, 0.0f, 0.0f); + renderEast(tile, 0, 0, 0, tile->getTexture(5)); } + t.draw(); + t.addOffset(0.5f, 0.5f, 0.5f); + tile->setShape(0, 0, 0, 1, 1, 1); + } else if (shape == Tile::SHAPE_FENCE_GATE) { + t.addOffset(-0.5f, -0.5f, -0.5f); + t.begin(); + for (int i = 0; i < 3; i++) { + float w = 1 / 16.0f; + if (i == 0) tile->setShape(0.5f - w, .3f, 0, 0.5f + w, 1, w * 2); + if (i == 1) tile->setShape(0.5f - w, .3f, 1 - w * 2, 0.5f + w, 1, 1); + if (i == 2) tile->setShape(0.5f - w, .5f, w * 2, 0.5f + w, 1 - w, 1 - w * 2); + + t.normal(0.0f, -1.0f, 0.0f); + renderFaceDown(tile, 0, 0, 0, tile->getTexture(0)); + + t.normal(0.0f, 1.0f, 0.0f); + renderFaceUp(tile, 0, 0, 0, tile->getTexture(1)); + + t.normal(0.0f, 0.0f, -1.0f); + renderNorth(tile, 0, 0, 0, tile->getTexture(2)); + + t.normal(0.0f, 0.0f, 1.0f); + renderSouth(tile, 0, 0, 0, tile->getTexture(3)); + + t.normal(-1.0f, 0.0f, 0.0f); + renderWest(tile, 0, 0, 0, tile->getTexture(4)); + + t.normal(1.0f, 0.0f, 0.0f); + renderEast(tile, 0, 0, 0, tile->getTexture(5)); + } + t.draw(); + t.addOffset(0.5f, 0.5f, 0.5f); + tile->setShape(0, 0, 0, 1, 1, 1); + } } @@ -2193,7 +2609,7 @@ void TileRenderer::renderGuiTile( Tile* tile, int data ) } else if (shape == Tile::SHAPE_CROSS_TEXTURE) { t.begin(); - //t.normal(0, -1, 0); + t.normal(0, -1, 0); tesselateCrossTexture(tile, data, -0.5f, -0.5f, -0.5f); //t.end(); t.draw(); diff --git a/src/client/renderer/TileRenderer.h b/src/client/renderer/TileRenderer.h index 02420dd..c463abf 100755 --- a/src/client/renderer/TileRenderer.h +++ b/src/client/renderer/TileRenderer.h @@ -10,6 +10,7 @@ class ThinFenceTile; class StairTile; class LevelSource; class Material; +class Minecraft; class TileRenderer { @@ -34,6 +35,8 @@ public: bool tesselateFenceGateInWorld(FenceGateTile* tt, int x, int y, int z); bool tesselateBedInWorld(Tile *tt, int x, int y, int z); bool tesselateRowInWorld(Tile* tt, int x, int y, int z); + bool tesselateFireInWorld(Tile* tt, int x, int y, int z); + void tesselateTorch(Tile* tt, float x, float y, float z, float xxa, float zza); void tesselateCrossTexture(Tile* tt, int data, float x, float y, float z); @@ -58,6 +61,10 @@ public: void renderTile(Tile* tile, int data); void renderGuiTile(Tile* tile, int data); + static void setUseTint(bool value) { + sideTinting = value; + } + static bool canRender(int renderShape); private: float getWaterHeight(int x, int y, int z, const Material* m); @@ -66,6 +73,7 @@ private: int fixedTexture; bool xFlipTexture; bool noCulling; + static bool sideTinting; bool applyAmbienceOcclusion; float ll000, llx00, ll0y0, ll00z, llX00, ll0Y0, ll00Z; diff --git a/src/client/renderer/VertecDecl.h b/src/client/renderer/VertecDecl.h index 8abc1d3..cd48104 100755 --- a/src/client/renderer/VertecDecl.h +++ b/src/client/renderer/VertecDecl.h @@ -14,7 +14,8 @@ typedef struct VertexDeclPTCN GLfloat x, y, z; GLfloat u, v; GLuint color; - GLuint normal; +// GLuint normal; // trying a new thing + GLfloat nx, ny, nz; } VertexDeclPTCN; diff --git a/src/client/renderer/entity/EntityRenderDispatcher.cpp b/src/client/renderer/entity/EntityRenderDispatcher.cpp index 6c0e72e..9381b89 100755 --- a/src/client/renderer/entity/EntityRenderDispatcher.cpp +++ b/src/client/renderer/entity/EntityRenderDispatcher.cpp @@ -40,18 +40,18 @@ EntityRenderDispatcher::EntityRenderDispatcher() { //@note: The Models (model/armor) will be deleted by resp. MobRenderer assign( ER_ITEM_RENDERER, new ItemRenderer()); - assign( ER_HUMANOID_RENDERER, new HumanoidMobRenderer(new HumanoidModel(), 0)); - assign( ER_PIG_RENDERER, new PigRenderer(new PigModel(), NULL/*new PigModel(0.5f)*/, 0)); - assign( ER_COW_RENDERER, new MobRenderer(new CowModel(), 0)); - assign( ER_CHICKEN_RENDERER, new ChickenRenderer( new ChickenModel(), 0)); - assign( ER_SHEEP_RENDERER, new SheepRenderer(new SheepModel(), new SheepFurModel(), 0)); + assign( ER_HUMANOID_RENDERER, new HumanoidMobRenderer(new HumanoidModel(), 0.5)); + assign( ER_PIG_RENDERER, new PigRenderer(new PigModel(0.5), NULL/*new PigModel(0.5f)*/, 0.7)); + assign( ER_COW_RENDERER, new MobRenderer(new CowModel(), 0.7)); + assign( ER_CHICKEN_RENDERER, new ChickenRenderer( new ChickenModel(), 0.3)); + assign( ER_SHEEP_RENDERER, new SheepRenderer(new SheepModel(), new SheepFurModel(), 0.7)); assign( ER_SKELETON_RENDERER, new HumanoidMobRenderer(new SkeletonModel(), 0.5f)); assign( ER_ZOMBIE_RENDERER, new HumanoidMobRenderer(new ZombieModel(), 0.5f)); assign( ER_CREEPER_RENDERER, new CreeperRenderer()); assign( ER_SPIDER_RENDERER, new SpiderRenderer()); assign( ER_TNT_RENDERER, new TntRenderer()); assign( ER_ARROW_RENDERER, new ArrowRenderer()); - assign( ER_PLAYER_RENDERER, new PlayerRenderer(new HumanoidModel(), 0)); + assign( ER_PLAYER_RENDERER, new PlayerRenderer(new HumanoidModel(0, 0, 64, 64), 0.5)); assign( ER_THROWNEGG_RENDERER, new ItemSpriteRenderer(Item::egg->getIcon(0))); assign( ER_SNOWBALL_RENDERER, new ItemSpriteRenderer(Item::snowBall->getIcon(0))); assign( ER_PAINTING_RENDERER, new PaintingRenderer()); @@ -133,10 +133,15 @@ void EntityRenderDispatcher::render( Entity* entity, float x, float y, float z, EntityRenderer* renderer = getRenderer(entity); if (renderer != NULL) { renderer->render(entity, x, y, z, rot, a); - //renderer->postRender(entity, x, y, z, rot, a); + renderer->postRender(entity, x, y, z, rot, a); } } +void EntityRenderDispatcher::setModernSkin(Entity* player) { + PlayerRenderer* rend = (PlayerRenderer*)(getRenderer(player)); + rend->setModernSkin((Mob*)player); +} + EntityRenderer* EntityRenderDispatcher::getRenderer( Entity* entity ) { EntityRendererId rendererId = entity->entityRendererId; diff --git a/src/client/renderer/entity/EntityRenderDispatcher.h b/src/client/renderer/entity/EntityRenderDispatcher.h index 06c4eac..180b4ef 100755 --- a/src/client/renderer/entity/EntityRenderDispatcher.h +++ b/src/client/renderer/entity/EntityRenderDispatcher.h @@ -45,6 +45,8 @@ public: Font* getFont(); void onGraphicsReset(); + + void setModernSkin(Entity* player); private: void assign(EntityRendererId id, EntityRenderer* renderer); public: diff --git a/src/client/renderer/entity/EntityRenderer.cpp b/src/client/renderer/entity/EntityRenderer.cpp index 641581b..691ddfb 100755 --- a/src/client/renderer/entity/EntityRenderer.cpp +++ b/src/client/renderer/entity/EntityRenderer.cpp @@ -5,11 +5,18 @@ #include "../gles.h" #include "../../../world/phys/AABB.h" #include "EntityRenderDispatcher.h" +#include "../../../util/Mth.h" +#include "../../../world/level/Level.h" +#include "../../../world/level/tile/Tile.h" +#include "../../Minecraft.h" +#include "../../Option.h" + +#include "../Lighting.h" EntityRenderDispatcher* EntityRenderer::entityRenderDispatcher = NULL; EntityRenderer::EntityRenderer() -: shadowRadius(0), + : shadowRadius(0), shadowStrength(1.0f) {} @@ -36,37 +43,37 @@ void EntityRenderer::render(const AABB& bb, float xo, float yo, float zo) { glColor4f2(1, 1, 1, 1); t.begin(); t.offset(xo, yo, zo); - //t.normal(0, 0, -1); + t.normal(0, 0, -1); t.vertex(bb.x0, bb.y1, bb.z0); t.vertex(bb.x1, bb.y1, bb.z0); t.vertex(bb.x1, bb.y0, bb.z0); t.vertex(bb.x0, bb.y0, bb.z0); - //t.normal(0, 0, 1); + t.normal(0, 0, 1); t.vertex(bb.x0, bb.y0, bb.z1); t.vertex(bb.x1, bb.y0, bb.z1); t.vertex(bb.x1, bb.y1, bb.z1); t.vertex(bb.x0, bb.y1, bb.z1); - //t.normal(0, -1, 0); + t.normal(0, -1, 0); t.vertex(bb.x0, bb.y0, bb.z0); t.vertex(bb.x1, bb.y0, bb.z0); t.vertex(bb.x1, bb.y0, bb.z1); t.vertex(bb.x0, bb.y0, bb.z1); - //t.normal(0, 1, 0); + t.normal(0, 1, 0); t.vertex(bb.x0, bb.y1, bb.z1); t.vertex(bb.x1, bb.y1, bb.z1); t.vertex(bb.x1, bb.y1, bb.z0); t.vertex(bb.x0, bb.y1, bb.z0); - //t.normal(-1, 0, 0); + t.normal(-1, 0, 0); t.vertex(bb.x0, bb.y0, bb.z1); t.vertex(bb.x0, bb.y1, bb.z1); t.vertex(bb.x0, bb.y1, bb.z0); t.vertex(bb.x0, bb.y0, bb.z0); - //t.normal(1, 0, 0); + t.normal(1, 0, 0); t.vertex(bb.x1, bb.y0, bb.z0); t.vertex(bb.x1, bb.y1, bb.z0); t.vertex(bb.x1, bb.y1, bb.z1); @@ -116,134 +123,215 @@ Font* EntityRenderer::getFont() { return entityRenderDispatcher->getFont(); } -//void postRender(Entity entity, float x, float y, float z, float rot, float a) { -// if (entityRenderDispatcher.options.fancyGraphics && shadowRadius > 0) { -// float dist = entityRenderDispatcher.distanceToSqr(entity.x, entity.y, entity.z); -// float pow = (float) ((1 - dist / (16.0f * 16.0f)) * shadowStrength); -// if (pow > 0) { -// renderShadow(entity, x, y, z, pow, a); -// } -// } -// if (entity.isOnFire()) renderFlame(entity, x, y, z, a); -//} +void EntityRenderer::postRender(Entity* entity, float x, float y, float z, float rot, float a) { + if (/*entityRenderDispatcher.options.fancyGraphics &&*/entityRenderDispatcher->minecraft->options.getBooleanValue(OPTIONS_FANCY_GRAPHICS) && shadowRadius > 0) { + float dist = entityRenderDispatcher->distanceToSqr(entity->x, entity->y, entity->z); + float pow = (float) ((1 - dist / (16.0f * 16.0f)) * shadowStrength); + if (pow > 0) { + renderShadow(entity, x, y, z, pow, a); + } + } + if (entity->isOnFire()) renderFlame(entity, x, y, z, a); +} +// duplicate renderflame below is the pre b1.6.6 way flame rendered on player and mobs, probs gonna make it an option. - shredder +/* +void EntityRenderer::renderFlame(Entity* e, float x, float y, float z, float a) { + glDisable(GL_LIGHTING); + int tex = ((Tile*)Tile::fire)->tex; -//void renderFlame(Entity e, float x, float y, float z, float a) { -// glDisable2(GL_LIGHTING); -// int tex = Tile.fire.tex; + int xt = (tex & 0xf) << 4; + int yt = tex & 0xf0; -// int xt = (tex & 0xf) << 4; -// int yt = tex & 0xf0; + float u0 = (xt) / 256.0f; + float u1 = (xt + 15.99f) / 256.0f; + float v0 = (yt) / 256.0f; + float v1 = (yt + 15.99f) / 256.0f; -// float u0 = (xt) / 256.0f; -// float u1 = (xt + 15.99f) / 256.0f; -// float v0 = (yt) / 256.0f; -// float v1 = (yt + 15.99f) / 256.0f; + glPushMatrix2(); + glTranslatef2((float) x, (float) y, (float) z); -// glPushMatrix2(); -// glTranslatef2((float) x, (float) y, (float) z); + float s = e->bbWidth * 1.4f; + glScalef2(s, s, s); + bindTexture("terrain.png"); + Tesselator& t = Tesselator::instance; -// float s = e.bbWidth * 1.4f; -// glScalef2(s, s, s); -// bindTexture("terrain.png"); -// Tesselator t = Tesselator.instance; + float r = 1.0f; + float xo = 0.5f; + float yo = 0.0f; -// float r = 1.0f; -// float xo = 0.5f; -// float yo = 0.0f; + float h = e->bbHeight / e->bbWidth; -// float h = e.bbHeight / e.bbWidth; + glRotatef2(-entityRenderDispatcher->playerRotY, 0, 1, 0); + glTranslatef2(0, 0, -0.4f + ((int) h) * 0.02f); + glColor4f2(1, 1, 1, 1); + // glRotatef2(-playerRotX, 1, 0, 0); + t.begin(); + while (h > 0) { + t.vertexUV(r - xo, 0 - yo, 0, u1, v1); + t.vertexUV(0 - xo, 0 - yo, 0, u0, v1); + t.vertexUV(0 - xo, 1.4f - yo, 0, u0, v0); + t.vertexUV(r - xo, 1.4f - yo, 0, u1, v0); + h -= 1; + yo -= 1; + r *= 0.9f; + glTranslatef2(0, 0, -0.04f); + } + t.draw(); + glPopMatrix2(); + glEnable2(GL_LIGHTING); +} +*/ +// new renderflame ported from b1.6.6, fixes player height offset and also uses the newer style - shredder +void EntityRenderer::renderFlame(Entity* e, float x, float y, float z, float a) { + glDisable(GL_LIGHTING); + int tex = ((Tile*)Tile::fire)->tex; -// glRotatef2(-entityRenderDispatcher.playerRotY, 0, 1, 0); -// glTranslatef2(0, 0, -0.4f + ((int) h) * 0.02f); -// glColor4f2(1, 1, 1, 1); -// // glRotatef2(-playerRotX, 1, 0, 0); -// t.begin(); -// while (h > 0) { -// t.vertexUV(r - xo, 0 - yo, 0, u1, v1); -// t.vertexUV(0 - xo, 0 - yo, 0, u0, v1); -// t.vertexUV(0 - xo, 1.4f - yo, 0, u0, v0); -// t.vertexUV(r - xo, 1.4f - yo, 0, u1, v0); -// h -= 1; -// yo -= 1; -// r *= 0.9f; -// glTranslatef2(0, 0, -0.04f); -// } -// t.end(); -// glPopMatrix2(); -// glEnable2(GL_LIGHTING); -//} + int xt = (tex & 0xf) << 4; + int yt = tex & 0xf0; -//void renderShadow(Entity e, float x, float y, float z, float pow, float a) { -// glEnable2(GL_BLEND); -// glBlendFunc2(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + float u0 = (xt) / 256.0f; + float u1 = (xt + 15.99f) / 256.0f; + float v0 = (yt) / 256.0f; + float v1 = (yt + 15.99f) / 256.0f; -// Textures textures = entityRenderDispatcher.textures; -// textures.bind(textures.loadTexture("%clamp%/misc/shadow.png")); + glPushMatrix2(); + glTranslatef2((float) x, (float) y, (float) z); -// Level level = getLevel(); + float s = e->bbWidth * 1.4f; + glScalef2(s, s, s); + bindTexture("terrain.png"); + Tesselator& t = Tesselator::instance; -// glDepthMask(false); -// float r = shadowRadius; + float r = 0.5f; + float xo = 0.0f; -// float ex = e.xOld + (e.x - e.xOld) * a; -// float ey = e.yOld + (e.y - e.yOld) * a + e.getShadowHeightOffs(); -// float ez = e.zOld + (e.z - e.zOld) * a; + float h = e->bbHeight / s; + float yo = (float)(e->y - e->bb.y0) / s; -// int x0 = Mth.floor(ex - r); -// int x1 = Mth.floor(ex + r); -// int y0 = Mth.floor(ey - r); -// int y1 = Mth.floor(ey); -// int z0 = Mth.floor(ez - r); -// int z1 = Mth.floor(ez + r); + glRotatef2(-entityRenderDispatcher->playerRotY, 0, 1, 0); + glTranslatef2(0, 0, -0.3f + ((int) h) * 0.02f); + glColor4f2(1, 1, 1, 1); + + float zo = 0.0f; + int cycle_counter = 0; -// float xo = x - ex; -// float yo = y - ey; -// float zo = z - ez; + t.begin(); + while (h > 0.0f) { + float current_u0 = u0; + float current_u1 = u1; + float current_v0 = v0; + float current_v1 = v1; -// Tesselator tt = Tesselator.instance; -// tt.begin(); -// for (int xt = x0; xt <= x1; xt++) -// for (int yt = y0; yt <= y1; yt++) -// for (int zt = z0; zt <= z1; zt++) { -// int t = level.getTile(xt, yt - 1, zt); -// if (t > 0 && level.getRawBrightness(xt, yt, zt) > 3) { -// renderTileShadow(Tile.tiles[t], x, y + e.getShadowHeightOffs(), z, xt, yt, zt, pow, r, xo, yo + e.getShadowHeightOffs(), zo); -// } -// } -// tt.end(); + if (cycle_counter % 2 != 0) { + current_v0 = (yt + 16) / 256.0f; + current_v1 = (yt + 16 + 15.99f) / 256.0f; + } -// glColor4f2(1, 1, 1, 1); -// glDisable2(GL_BLEND); -// glDepthMask(true); -//} + if ((cycle_counter / 2) % 2 == 0) { + float tmp = current_u1; + current_u1 = current_u0; + current_u0 = tmp; + } -//Level* getLevel() { -// return entityRenderDispatcher.level; -//} + t.vertexUV(r - xo, 0.0f - yo, zo, current_u1, current_v1); + t.vertexUV(-r - xo, 0.0f - yo, zo, current_u0, current_v1); + t.vertexUV(-r - xo, 1.4f - yo, zo, current_u0, current_v0); + t.vertexUV(r - xo, 1.4f - yo, zo, current_u1, current_v0); + + h -= 0.45f; + yo -= 0.45f; + r *= 0.9f; + zo += 0.03f; + cycle_counter++; + } + t.draw(); + + glPopMatrix2(); + glEnable2(GL_LIGHTING); +} -//void renderTileShadow(Tile tt, float x, float y, float z, int xt, int yt, int zt, float pow, float r, float xo, float yo, float zo) { -// Tesselator t = Tesselator.instance; -// if (!tt.isCubeShaped()) return; +void EntityRenderer::renderShadow(Entity* e, float x, float y, float z, float pow, float a) { // + glEnable2(GL_BLEND); + glBlendFunc2(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); -// float a = ((pow - (y - (yt + yo)) / 2) * 0.5f) * getLevel().getBrightness(xt, yt, zt); -// if (a < 0) return; -// if (a > 1) a = 1; -// t.color(1, 1, 1, (float) a); -// // glColor4f2(1, 1, 1, (float) a); + //Textures* textures = entityRenderDispatcher->textures; + //textures->bind(textures->loadTexture("%clamp%/environment/shadow.png")); + Textures* textures = entityRenderDispatcher->textures; + textures->loadAndBindTexture("misc/shadow.png"); + + + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); -// float x0 = xt + tt.xx0 + xo; -// float x1 = xt + tt.xx1 + xo; -// float y0 = yt + tt.yy0 + yo + 1.0 / 64.0f; -// float z0 = zt + tt.zz0 + zo; -// float z1 = zt + tt.zz1 + zo; -// float u0 = (float) ((x - (x0)) / 2 / r + 0.5f); -// float u1 = (float) ((x - (x1)) / 2 / r + 0.5f); -// float v0 = (float) ((z - (z0)) / 2 / r + 0.5f); -// float v1 = (float) ((z - (z1)) / 2 / r + 0.5f); -// t.vertexUV(x0, y0, z0, u0, v0); -// t.vertexUV(x0, y0, z1, u0, v1); -// t.vertexUV(x1, y0, z1, u1, v1); -// t.vertexUV(x1, y0, z0, u1, v0); -//} + Level* level = getLevel(); + + glDepthMask(false); + float r = shadowRadius; + + float ex = e->xOld + (e->x - e->xOld) * a; + float ey = e->yOld + (e->y - e->yOld) * a + e->getShadowHeightOffs(); + float ez = e->zOld + (e->z - e->zOld) * a; + + int x0 = Mth::floor(ex - r); + int x1 = Mth::floor(ex + r); + int y0 = Mth::floor(ey - r); + int y1 = Mth::floor(ey); + int z0 = Mth::floor(ez - r); + int z1 = Mth::floor(ez + r); + + float xo = x - ex; + float yo = y - ey; + float zo = z - ez; + + Tesselator& tt = Tesselator::instance; + tt.begin(); + for (int xt = x0; xt <= x1; xt++) + for (int yt = y0; yt <= y1; yt++) + for (int zt = z0; zt <= z1; zt++) { + int t = level->getTile(xt, yt - 1, zt); + if (t > 0 && level->getRawBrightness(xt, yt, zt) > 3) { + renderTileShadow(Tile::tiles[t], x, y + e->getShadowHeightOffs(), z, xt, yt, zt, pow, r, xo, yo + e->getShadowHeightOffs(), zo); + } + } + tt.draw(); + + glColor4f2(1, 1, 1, 1); + // tt.color(1.f, 1.f, 1.f, 1.f); + glDisable2(GL_BLEND); + glDepthMask(true); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); +} + +Level* EntityRenderer::getLevel() { + return entityRenderDispatcher->level; +} + +void EntityRenderer::renderTileShadow(Tile* tt, float x, float y, float z, int xt, int yt, int zt, float pow, float r, float xo, float yo, float zo) { + Tesselator& t = Tesselator::instance; + if (!tt->isCubeShaped()) return; + + float a = ((pow - (y - (yt + yo)) / 2) * 0.5f) * getLevel()->getBrightness(xt, yt, zt); + if (a < 0) return; + if (a > 1) a = 1; + // t.color(1.f, 1.f, 1.f, (float) a); + glColor4f2(1, 1, 1, (float) a); + + float x0 = xt + tt->xx0 + xo; + float x1 = xt + tt->xx1 + xo; + float y0 = yt + tt->yy0 + yo + 1.0 / 64.0f; + float z0 = zt + tt->zz0 + zo; + float z1 = zt + tt->zz1 + zo; + + float u0 = (float) ((x - (x0)) / 2 / r + 0.5f); + float u1 = (float) ((x - (x1)) / 2 / r + 0.5f); + float v0 = (float) ((z - (z0)) / 2 / r + 0.5f); + float v1 = (float) ((z - (z1)) / 2 / r + 0.5f); + + t.vertexUV(x0, y0, z0, u0, v0); + t.vertexUV(x0, y0, z1, u0, v1); + t.vertexUV(x1, y0, z1, u1, v1); + t.vertexUV(x1, y0, z0, u1, v0); +} diff --git a/src/client/renderer/entity/EntityRenderer.h b/src/client/renderer/entity/EntityRenderer.h index 318f7f2..699c82d 100755 --- a/src/client/renderer/entity/EntityRenderer.h +++ b/src/client/renderer/entity/EntityRenderer.h @@ -12,6 +12,8 @@ class EntityRenderDispatcher; class Entity; class AABB; class Font; +class Tile; +class Level; class EntityRenderer { @@ -24,6 +26,11 @@ public: virtual void render(Entity* entity, float x, float y, float z, float rot, float a) = 0; static void render(const AABB& bb, float xo, float yo, float zo); static void renderFlat(const AABB& bb); + void renderShadow(Entity* e, float x, float y, float z, float pow, float a); + void renderTileShadow(Tile* tt, float x, float y, float z, int xt, int yt, int zt, float pow, float r, float xo, float yo, float zo); + void renderFlame(Entity* e, float x, float y, float z, float a); + void postRender(Entity* entity, float x, float y, float z, float rot, float a); + Level* getLevel(); Font* getFont(); diff --git a/src/client/renderer/entity/HumanoidMobRenderer.cpp b/src/client/renderer/entity/HumanoidMobRenderer.cpp index b9efe21..0922767 100755 --- a/src/client/renderer/entity/HumanoidMobRenderer.cpp +++ b/src/client/renderer/entity/HumanoidMobRenderer.cpp @@ -2,6 +2,7 @@ #include "EntityRenderDispatcher.h" #include "../ItemInHandRenderer.h" #include "../TileRenderer.h" +#include "../Tesselator.h" #include "../../model/HumanoidModel.h" #include "../../../world/level/tile/Tile.h" #include "../../../world/entity/player/Player.h" @@ -12,7 +13,9 @@ HumanoidMobRenderer::HumanoidMobRenderer(HumanoidModel* humanoidModel, float shadow) : super(humanoidModel, shadow), - humanoidModel(humanoidModel) + humanoidModel(humanoidModel), + lastCapeXRot(0), + lastCapeZRot(0) { } @@ -68,6 +71,143 @@ void HumanoidMobRenderer::additionalRendering(Mob* mob, float a) { entityRenderDispatcher->itemInHandRenderer->renderItem(mob, item); glPopMatrix2(); } + + // Render player cape if available +{ + Player* player = Player::asPlayer(mob); + if (player) { + const std::string capeTex = player->getCapeTexture(); + if (!capeTex.empty()) { + + bindTexture(capeTex); + + glPushMatrix2(); + + // Attach to player body + humanoidModel->body.translateTo(1 / 16.0f); + + // Convert model units (pixels) to world units + glScalef2(1.0f / 16.0f, 1.0f / 16.0f, 1.0f / 16.0f); + + // Position cape slightly down and behind the shoulders + glTranslatef2(0.0f, 1.0f, 2.0f); + + // Java-like cape physics (interpolated inertia + body motion) + float pt = a; + + double capeX = player->getCapePrevX() + (player->getCapeX() - player->getCapePrevX()) * pt; + double capeY = player->getCapePrevY() + (player->getCapeY() - player->getCapePrevY()) * pt; + double capeZ = player->getCapePrevZ() + (player->getCapeZ() - player->getCapePrevZ()) * pt; + + double px = player->xo + (player->x - player->xo) * pt; + double py = player->yo + (player->y - player->yo) * pt; + double pz = player->zo + (player->z - player->zo) * pt; + + double dx = capeX - px; + double dy = capeY - py; + double dz = capeZ - pz; + + float bodyYaw = player->yBodyRotO + (player->yBodyRot - player->yBodyRotO) * pt; + + float rad = bodyYaw * Mth::PI / 180.0f; + double sinYaw = Mth::sin(rad); + double cosYaw = -Mth::cos(rad); + + float forward = (float)(dx * sinYaw + dz * cosYaw) * 100.0f; + float sideways = (float)(dx * cosYaw - dz * sinYaw) * 100.0f; + if (forward < 0.0f) forward = 0.0f; + + float lift = (float)dy * 10.0f; + if (lift < -6.0f) lift = -6.0f; + if (lift > 32.0f) lift = 32.0f; + + float walk = + Mth::sin((player->walkAnimPos + player->walkAnimSpeed) * 6.0f) * + 32.0f * + player->walkAnimSpeed; + + float capeXRot = 6.0f + forward / 2.0f + lift + walk; + float capeZRot = sideways / 2.0f; + + // Smooth out jitter by lerping from the previous frame + const float smooth = 0.3f; + capeXRot = lastCapeXRot + (capeXRot - lastCapeXRot) * smooth; + capeZRot = lastCapeZRot + (capeZRot - lastCapeZRot) * smooth; + + lastCapeXRot = capeXRot; + lastCapeZRot = capeZRot; + + glRotatef2(capeXRot, 1.0f, 0.0f, 0.0f); + glRotatef2(capeZRot, 0.0f, 0.0f, 1.0f); + + Tesselator& t = Tesselator::instance; + t.begin(); + + // UV coordinates (64x32 skin layout) + const float u0 = 1.0f / 64.0f; + const float u1 = 11.0f / 64.0f; + const float u2 = 12.0f / 64.0f; + const float u3 = 22.0f / 64.0f; + + const float uL0 = 0.0f / 64.0f; + const float uL1 = 1.0f / 64.0f; + + const float uR0 = 11.0f / 64.0f; + const float uR1 = 12.0f / 64.0f; + + const float v0 = 0.0f / 32.0f; + const float v1 = 1.0f / 32.0f; + + const float vTop = 1.0f / 32.0f; + const float vBottom = 17.0f / 32.0f; + + // Cape size (10x16x1 pixels) + const float halfW = 5.0f; + const float height = 16.0f; + const float depth = 1.0f; + + // Front + t.tex(u2, vTop); t.vertex(-halfW, 0.0f, 0.0f); + t.tex(u3, vTop); t.vertex(halfW, 0.0f, 0.0f); + t.tex(u3, vBottom); t.vertex(halfW, height, 0.0f); + t.tex(u2, vBottom); t.vertex(-halfW, height, 0.0f); + + // Back + t.tex(u0, vTop); t.vertex(halfW, 0.0f, depth); + t.tex(u1, vTop); t.vertex(-halfW, 0.0f, depth); + t.tex(u1, vBottom); t.vertex(-halfW, height, depth); + t.tex(u0, vBottom); t.vertex(halfW, height, depth); + + // Left + t.tex(uL0, vTop); t.vertex(-halfW, 0.0f, depth); + t.tex(uL1, vTop); t.vertex(-halfW, 0.0f, 0.0f); + t.tex(uL1, vBottom); t.vertex(-halfW, height, 0.0f); + t.tex(uL0, vBottom); t.vertex(-halfW, height, depth); + + // Right + t.tex(uR0, vTop); t.vertex(halfW, 0.0f, 0.0f); + t.tex(uR1, vTop); t.vertex(halfW, 0.0f, depth); + t.tex(uR1, vBottom); t.vertex(halfW, height, depth); + t.tex(uR0, vBottom); t.vertex(halfW, height, 0.0f); + + // Top + t.tex(u0, v0); t.vertex(-halfW, 0.0f, depth); + t.tex(u1, v0); t.vertex(halfW, 0.0f, depth); + t.tex(u1, v1); t.vertex(halfW, 0.0f, 0.0f); + t.tex(u0, v1); t.vertex(-halfW, 0.0f, 0.0f); + + // Bottom + t.tex(u2, v0); t.vertex(halfW, height, 0.0f); + t.tex(u3, v0); t.vertex(-halfW, height, 0.0f); + t.tex(u3, v1); t.vertex(-halfW, height, depth); + t.tex(u2, v1); t.vertex(halfW, height, depth); + + t.draw(); + + glPopMatrix2(); + } + } +} } void HumanoidMobRenderer::render( Entity* mob_, float x, float y, float z, float rot, float a ) { diff --git a/src/client/renderer/entity/HumanoidMobRenderer.h b/src/client/renderer/entity/HumanoidMobRenderer.h index 59c6b0c..a78ade8 100755 --- a/src/client/renderer/entity/HumanoidMobRenderer.h +++ b/src/client/renderer/entity/HumanoidMobRenderer.h @@ -19,8 +19,13 @@ public: protected: void additionalRendering(Mob* mob, float a); -private: HumanoidModel* humanoidModel; + + // Last rotation values for cape smoothing (reduces jitter) + float lastCapeXRot; + float lastCapeZRot; +private: + // i guess ill keep this just in case seomthing breaks }; #endif /*NET_MINECRAFT_CLIENT_RENDERER_ENTITY__HumanoidMobRenderer_H__*/ diff --git a/src/client/renderer/entity/ItemRenderer.cpp b/src/client/renderer/entity/ItemRenderer.cpp index 15e63d1..4c48a3b 100755 --- a/src/client/renderer/entity/ItemRenderer.cpp +++ b/src/client/renderer/entity/ItemRenderer.cpp @@ -45,7 +45,7 @@ void ItemRenderer::render(Entity* itemEntity_, float x, float y, float z, float else if (item->count > 1) count = 2; glTranslatef2((float) x, (float) y + bob, (float) z); - //glEnable2(GL_RESCALE_NORMAL); + glEnable2(GL_RESCALE_NORMAL); if (item->id < 256 && TileRenderer::canRender(Tile::tiles[item->id]->getRenderShape())) { glRotatef2(spin, 0, 1, 0); @@ -107,7 +107,7 @@ void ItemRenderer::render(Entity* itemEntity_, float x, float y, float z, float } glRotatef2(180 - entityRenderDispatcher->playerRotY, 0, 1, 0); t.begin(); - //t.normal(0, 1, 0); + t.normal(0, 1, 0); t.vertexUV(0 - xo, 0 - yo, 0, u0, v1); t.vertexUV(r - xo, 0 - yo, 0, u1, v1); t.vertexUV(r - xo, 1 - yo, 0, u1, v0); @@ -118,7 +118,7 @@ void ItemRenderer::render(Entity* itemEntity_, float x, float y, float z, float glPopMatrix2(); } } - //glDisable2(GL_RESCALE_NORMAL); + glDisable2(GL_RESCALE_NORMAL); glPopMatrix2(); } @@ -189,9 +189,9 @@ void ItemRenderer::renderGuiItem(Font* font, Textures* textures, const ItemInsta // it we're batching for saving the // buffer, this will fail miserably t.endOverrideAndDraw(); - glDisable2(GL_TEXTURE_2D); - fillRect(t, x, y, w, h, 0xff0000); - glEnable2(GL_TEXTURE_2D); + // glDisable2(GL_TEXTURE_2D); + // fillRect(t, x, y, w, h, 0xff0000); + // glEnable2(GL_TEXTURE_2D); renderGuiItemCorrect(font, textures, item, int(x), int(y)); t.beginOverride(); } @@ -226,7 +226,42 @@ void ItemRenderer::renderGuiItem(Font* font, Textures* textures, const ItemInsta t.draw(); } -void ItemRenderer::renderGuiItemDecorations(const ItemInstance* item, float x, float y) { + +void ItemRenderer::renderGuiItemDecorations(Font* font, Textures* textures, ItemInstance* item, int x, int y){ // this is normally unused in the header but i ported it from java beta - shredder + if (item != NULL) { + if (item->count > 1) { + char buf[16]; + sprintf(buf, "%d", item->count); + std::string countStr = buf; + // glDisable(GL_LIGHTING); + // glDisable(GL_DEPTH_TEST); + font->drawShadow(countStr, x + 19 - 2 - font->width(countStr), + y + 6 + 3, 0xFFFFFF); + // glEnable(GL_LIGHTING); + // glEnable(GL_DEPTH_TEST); + } + if (item->isDamaged()) { + float p = std::floor(13.5f - (float) item->getDamageValue() * 13.0f / (float) item->getMaxDamage() + 0.5); + int cc = (int) std::floor(255.5f - (float) item->getDamageValue() * 255.0f / (float) item->getMaxDamage() + 0.5); + // glDisable(GL_LIGHTING); + // glDisable(GL_DEPTH_TEST); + // glDisable(GL_TEXTURE_2D); + // auto var8 = ::net::minecraft::client::renderer::Tesselator::instance(); + Tesselator& t = Tesselator::instance; + int ca = ((255 - cc)<< 16 | (cc << 8)); + int cb = (((255 - cc) / 4) << 16 | 16128); + fillRect(t, x + 2, y + 13, 13, 2, 0); + fillRect(t, x + 2, y + 13, 12, 1, cb); + fillRect(t, x + 2, y + 13, p, 1, ca); + // glEnable(GL_TEXTURE_2D); + // glEnable(GL_LIGHTING); + // glEnable(GL_DEPTH_TEST); + glColor4f(1.0f, 1.0f, 1.0f, 1.0f); + } + } +} + +void ItemRenderer::renderGuiItemDecorations(const ItemInstance* item, float x, float y) { // nothing changed here this is the normal pocket edition one. if (!item) return; if (item->count > 0 && item->isDamaged()) { float p = std::floor(13.5f - (float) item->getDamageValue() * 13.0f / (float) item->getMaxDamage()); diff --git a/src/client/renderer/entity/ItemRenderer.h b/src/client/renderer/entity/ItemRenderer.h index 9fb88f6..a104dc7 100755 --- a/src/client/renderer/entity/ItemRenderer.h +++ b/src/client/renderer/entity/ItemRenderer.h @@ -22,7 +22,7 @@ public: static void renderGuiItem(Font* font, Textures* textures, const ItemInstance* item, float x, float y, bool fancy); static void renderGuiItem(Font* font, Textures* textures, const ItemInstance* item, float x, float y, float w, float h, bool fancy); static void renderGuiItemCorrect(Font* font, Textures* textures, const ItemInstance* item, int x, int y); - //void renderGuiItemDecorations(Font* font, Textures* textures, ItemInstance* item, int x, int y); + static void renderGuiItemDecorations(Font* font, Textures* textures, ItemInstance* item, int x, int y); static void renderGuiItemDecorations(const ItemInstance* item, float x, float y); static void blit(float x, float y, float sx, float sy, float w, float h); diff --git a/src/client/renderer/entity/MobRenderer.cpp b/src/client/renderer/entity/MobRenderer.cpp index 51ccee9..f3a9661 100755 --- a/src/client/renderer/entity/MobRenderer.cpp +++ b/src/client/renderer/entity/MobRenderer.cpp @@ -135,7 +135,7 @@ void MobRenderer::render(Entity* e, float x, float y, float z, float rot, float //glEnable2(GL_DEPTH_TEST); glPopMatrix2(); - + postRender(mob, x, y, z, rot, a); renderName(mob, x, y, z); } @@ -187,10 +187,12 @@ void MobRenderer::scale(Mob* mob, float a) { } void MobRenderer::renderName(Mob* mob, float x, float y, float z) { - /* + std::stringstream ss; ss << mob->entityId; + if (entityRenderDispatcher->minecraft->options.getBooleanValue(OPTIONS_RENDER_DEBUG)) { renderNameTag(mob, ss.str(), x, y, z, 64); - */ + } + } void MobRenderer::renderNameTag(Mob* mob, const std::string& name, float x, float y, float z, int maxDist) { @@ -205,13 +207,19 @@ void MobRenderer::renderNameTag(Mob* mob, const std::string& name, float x, floa float s = 1 / 60.0f * size; glPushMatrix2(); - glTranslatef2((float) x + 0, (float) y + 1.0f /*2.3f*/, (float) z); + if (mob->isPlayer()){ + glTranslatef2((float) x + 0, (float) y + 1.0f, (float) z); + } else { + glTranslatef2((float) x + 0, (float) y + 2.3f, (float) z); + } glRotatef2(-entityRenderDispatcher->playerRotY, 0, 1, 0); glRotatef2(entityRenderDispatcher->playerRotX, 1, 0, 0); glScalef2(-s, -s, s); + glDisable(GL_LIGHTING); + glDepthMask(false); glDisable2(GL_DEPTH_TEST); glEnable2(GL_BLEND); @@ -235,6 +243,7 @@ void MobRenderer::renderNameTag(Mob* mob, const std::string& name, float x, floa glDepthMask(true); font->draw(name, (float) fnameWidth, 0, 0xffffffff); + glEnable(GL_LIGHTING); glDisable2(GL_BLEND); glColor4f2(1, 1, 1, 1); glPopMatrix2(); diff --git a/src/client/renderer/entity/MobRenderer.h b/src/client/renderer/entity/MobRenderer.h index 3f22618..fee7786 100755 --- a/src/client/renderer/entity/MobRenderer.h +++ b/src/client/renderer/entity/MobRenderer.h @@ -43,8 +43,8 @@ public: protected: void setArmor(Model* armor); Model* getArmor(); + Model* model; // allows derived renderers to swap models dynamically for skin formats private: - Model* model; Model* armor; }; diff --git a/src/client/renderer/entity/PaintingRenderer.cpp b/src/client/renderer/entity/PaintingRenderer.cpp index 1513e95..6c8bf0d 100755 --- a/src/client/renderer/entity/PaintingRenderer.cpp +++ b/src/client/renderer/entity/PaintingRenderer.cpp @@ -9,7 +9,7 @@ void PaintingRenderer::render( Entity* entity, float x, float y, float z, float glPushMatrix(); glTranslatef(float(x), float(y), float(z)); glRotatef(rot, 0, 1.0f, 0); - //glEnable(GL_RESCALE_NORMAL); + glEnable(GL_RESCALE_NORMAL); bindTexture("art/kz.png"); Painting* painting = (Painting*)entity; const Motive* motive = painting->motive; @@ -17,7 +17,7 @@ void PaintingRenderer::render( Entity* entity, float x, float y, float z, float float s = 1.0f / 16.0f; glScalef(s, s, s); renderPainting(painting, motive->w, motive->h, motive->uo, motive->vo, a); - //glDisable(GL_RESCALE_NORMAL); + glDisable(GL_RESCALE_NORMAL); glPopMatrix(); } diff --git a/src/client/renderer/entity/PlayerRenderer.cpp b/src/client/renderer/entity/PlayerRenderer.cpp index 590cbc8..93685fd 100755 --- a/src/client/renderer/entity/PlayerRenderer.cpp +++ b/src/client/renderer/entity/PlayerRenderer.cpp @@ -1,5 +1,6 @@ #include "PlayerRenderer.h" #include "EntityRenderDispatcher.h" +#include "../Textures.h" #include "../../../world/entity/player/Player.h" #include "../../../world/level/Level.h" #include "../../../world/item/ArmorItem.h" @@ -14,12 +15,22 @@ static const std::string armorFilenames[10] = { PlayerRenderer::PlayerRenderer( HumanoidModel* humanoidModel, float shadow ) : super(humanoidModel, shadow), - armorParts1(new HumanoidModel(1.0f)), - armorParts2(new HumanoidModel(0.5f)) + playerModel64(humanoidModel), + playerModel32(new HumanoidModel(0, 0, 64, 32)), + armorParts1(new HumanoidModel(1.0f, 0, 64, 32)), + armorParts2(new HumanoidModel(0.5f, 0, 64, 32)) { + // default to legacy skin path until we know the exact texture size + model = playerModel32; + humanoidModel = playerModel32; } PlayerRenderer::~PlayerRenderer() { + // prevent MobRenderer destructor from deleting model pointers we manage manually + model = nullptr; + + delete playerModel32; + delete playerModel64; delete armorParts1; delete armorParts2; } @@ -43,6 +54,15 @@ void PlayerRenderer::setupRotations( Entity* mob, float bob, float bodyRot, floa super::setupRotations(mob, bob, bodyRot, a); } +bool PlayerRenderer::isModernPlayerSkin(Mob* mob) { + const std::string texName = mob->getTexture(); + TextureId texId = entityRenderDispatcher->textures->loadTexture(texName); + if (!Textures::isTextureIdValid(texId)) + return false; + const TextureData* texData = entityRenderDispatcher->textures->getTemporaryTextureData(texId); + return texData && texData->w == 64 && texData->h == 64; +} + void PlayerRenderer::renderName( Mob* mob, float x, float y, float z ){ //@todo: figure out how to handle HideGUI if (mob != entityRenderDispatcher->cameraEntity && mob->level->adventureSettings.showNameTags) { @@ -50,6 +70,25 @@ void PlayerRenderer::renderName( Mob* mob, float x, float y, float z ){ } } +// @note fix player skin system +void PlayerRenderer::setModernSkin(Mob* mob) { + HumanoidModel* desired = isModernPlayerSkin(mob) ? playerModel64 : playerModel32; + if (model != desired || humanoidModel != desired) { + model = desired; + humanoidModel = desired; + } +} + +void PlayerRenderer::render(Entity* mob_, float x, float y, float z, float rot, float a) { + Mob* mob = (Mob*) mob_; + setModernSkin(mob); + /* LOGI("[PlayerRenderer] %s: skin=%s, modelTex=%dx%d, desired=%s\n", + ((Player*)mob)->name.c_str(), mob->getTexture().c_str(), + humanoidModel->texWidth, humanoidModel->texHeight, + (desired == playerModel64 ? "64" : "32")); */ + HumanoidMobRenderer::render(mob_, x, y, z, rot, a); +} + int PlayerRenderer::prepareArmor(Mob* mob, int layer, float a) { Player* player = (Player*) mob; @@ -80,8 +119,11 @@ int PlayerRenderer::prepareArmor(Mob* mob, int layer, float a) { } void PlayerRenderer::onGraphicsReset() { - super::onGraphicsReset(); + if (playerModel32) playerModel32->onGraphicsReset(); + if (playerModel64) playerModel64->onGraphicsReset(); if (armorParts1) armorParts1->onGraphicsReset(); if (armorParts2) armorParts2->onGraphicsReset(); + + super::onGraphicsReset(); } diff --git a/src/client/renderer/entity/PlayerRenderer.h b/src/client/renderer/entity/PlayerRenderer.h index f370607..1105c4b 100755 --- a/src/client/renderer/entity/PlayerRenderer.h +++ b/src/client/renderer/entity/PlayerRenderer.h @@ -11,13 +11,19 @@ public: ~PlayerRenderer(); virtual int prepareArmor(Mob* mob, int layer, float a); + bool isModernPlayerSkin(Mob* mob); + virtual void render(Entity* mob, float x, float y, float z, float rot, float a); virtual void setupPosition(Entity* mob, float x, float y, float z); virtual void setupRotations(Entity* mob, float bob, float bodyRot, float a); virtual void renderName(Mob* mob, float x, float y, float z); virtual void onGraphicsReset(); + + void setModernSkin(Mob* mob); private: + HumanoidModel* playerModel32; + HumanoidModel* playerModel64; HumanoidModel* armorParts1; HumanoidModel* armorParts2; }; diff --git a/src/client/renderer/gles.cpp b/src/client/renderer/gles.cpp index f29fbc2..df44d20 100755 --- a/src/client/renderer/gles.cpp +++ b/src/client/renderer/gles.cpp @@ -47,9 +47,13 @@ void glInit() } void anGenBuffers(GLsizei n, GLuint* buffers) { - static GLuint k = 1; - for (int i = 0; i < n; ++i) - buffers[i] = ++k; +#ifdef __EMSCRIPTEN__ + glGenBuffers(n, buffers); +#else + static GLuint k = 1; + for (int i = 0; i < n; ++i) + buffers[i] = ++k; +#endif } #ifdef USE_VBO @@ -111,6 +115,41 @@ void drawArrayVTC_NoState(int bufferId, int vertices, int vertexSize /* = 24 */) } #endif +void drawArrayVTN(int bufferId, int vertices, int vertexSize /* = 24 */) { + //if (Options::debugGl) LOGI("drawArray\n"); + //LOGI("draw-vtc: %d, %d, %d\n", bufferId, vertices, vertexSize); + glEnableClientState2(GL_VERTEX_ARRAY); + glEnableClientState2(GL_TEXTURE_COORD_ARRAY); + //glEnableClientState2(GL_COLOR_ARRAY); + glEnableClientState2(GL_NORMAL_ARRAY); + + glBindBuffer2(GL_ARRAY_BUFFER, bufferId); + + glVertexPointer2( 3, GL_FLOAT, vertexSize, 0); + glTexCoordPointer2(2, GL_FLOAT, vertexSize, (GLvoid*) (3 * 4)); + //glColorPointer2(4, GL_UNSIGNED_BYTE, vertexSize, (GLvoid*) (5*4)); + glNormalPointer(GL_FLOAT, vertexSize, (GLvoid*) (6 * 4)); + + glDrawArrays2(GL_TRIANGLES, 0, vertices); + + glDisableClientState2(GL_VERTEX_ARRAY); + glDisableClientState2(GL_TEXTURE_COORD_ARRAY); + //glDisableClientState2(GL_COLOR_ARRAY); + glDisableClientState2(GL_NORMAL_ARRAY); +} + +#ifndef drawArrayVTN_NoState +void drawArrayVTCN_NoState(int bufferId, int vertices, int vertexSize /* = 24 */) { + glBindBuffer2(GL_ARRAY_BUFFER, bufferId); + + glVertexPointer2( 3, GL_FLOAT, vertexSize, 0); + glTexCoordPointer2(2, GL_FLOAT, vertexSize, (GLvoid*) (3 * 4)); + //glColorPointer2(4, GL_UNSIGNED_BYTE, vertexSize, (GLvoid*) (5*4)); + glNormalPointer(GL_FLOAT, vertexSize, (GLvoid*) (6 * 4)); + + glDrawArrays2(GL_TRIANGLES, 0, vertices); +} +#endif #endif diff --git a/src/client/renderer/gles.h b/src/client/renderer/gles.h index 993b2c6..a82c35c 100755 --- a/src/client/renderer/gles.h +++ b/src/client/renderer/gles.h @@ -4,36 +4,46 @@ #include "../../platform/log.h" #include "../Options.h" +#if defined(__APPLE__) + #define GLES_SILENCE_DEPRECATION +#endif + // Android should always run OPENGL_ES #if defined(ANDROID) || defined(__APPLE__) || defined(RPI) #define OPENGL_ES #endif - +#define GLES_SILENCE_DEPRECATION // Other systems might run it, if they #define OPENGL_ES -#if defined(OPENGL_ES) // || defined(ANDROID) +// #if defined(OPENGL_ES) // || defined(ANDROID) #define USE_VBO #define GL_QUADS 0x0007 #if defined(__APPLE__) - #import - #import + #import + #import + #elif defined(ANDROID) || defined(__EMSCRIPTEN__) + #import + #import #else #include - #if defined(ANDROID) - #include - #endif - #endif -#else - // Uglyness to fix redeclaration issues - #ifdef WIN32 - #include - #include - #endif - #include - #include - #define glFogx(a,b) glFogi(a,b) - #define glOrthof(a,b,c,d,e,f) glOrtho(a,b,c,d,e,f) -#endif + // https://github.com/programmer1o1/MinecraftPE-v0.6.1/blob/main/handheld/src/client/renderer/gles.h#L135-L138 + #define glFogx(a,b) glFogi(a,b) + #define glOrthof(a,b,c,d,e,f) glOrtho(a,b,c,d,e,f) + #define glClearDepthf(x) glClearDepth(x) + #define glDepthRangef(a,b) glDepthRange(a,b) + #endif +// #else +// // Uglyness to fix redeclaration issues +// #ifdef WIN32 +// #include +// #include +// #endif +// #include +// #include + +// #define glFogx(a,b) glFogi(a,b) +// #define glOrthof(a,b,c,d,e,f) glOrtho(a,b,c,d,e,f) +// #endif #define GLERRDEBUG 1 @@ -49,13 +59,18 @@ void anGenBuffers(GLsizei n, GLuint* buffer); #ifdef USE_VBO #define drawArrayVT_NoState drawArrayVT #define drawArrayVTC_NoState drawArrayVTC -void drawArrayVT(int bufferId, int vertices, int vertexSize = 24, unsigned int mode = GL_TRIANGLES); +#define drawArrayVTN_NoState drawArrayVTN +void drawArrayVT(int bufferId, int vertices, int vertexSize = 36, unsigned int mode = GL_TRIANGLES); #ifndef drawArrayVT_NoState -//void drawArrayVT_NoState(int bufferId, int vertices, int vertexSize = 24); +//void drawArrayVT_NoState(int bufferId, int vertices, int vertexSize = 36); #endif -void drawArrayVTC(int bufferId, int vertices, int vertexSize = 24); +void drawArrayVTC(int bufferId, int vertices, int vertexSize = 36); #ifndef drawArrayVTC_NoState -void drawArrayVTC_NoState(int bufferId, int vertices, int vertexSize = 24); +void drawArrayVTC_NoState(int bufferId, int vertices, int vertexSize = 36); +#endif +void drawArrayVTN(int bufferId, int vertices, int vertexSize = 36); +#ifndef drawArrayVTN_NoState +void drawArrayVTCN_NoState(int bufferId, int vertices, int vertexSize = 36); #endif #endif @@ -108,6 +123,7 @@ int glhUnProjectf( float winx, float winy, float winz, #define glVertexPointer2 glVertexPointer #define glColorPointer2 glColorPointer #define glTexCoordPointer2 glTexCoordPointer + #define glNormalPointer2 glNormalPointer #define glEnableClientState2 glEnableClientState #define glDisableClientState2 glDisableClientState #define glDrawArrays2 glDrawArrays @@ -131,7 +147,7 @@ int glhUnProjectf( float winx, float winy, float winz, // // Extensions // -#ifdef WIN32 +#ifdef WIN32 #define glGetProcAddress(a) wglGetProcAddress(a) #else #define glGetProcAddress(a) (void*(0)) diff --git a/src/client/renderer/ptexture/DynamicTexture.cpp b/src/client/renderer/ptexture/DynamicTexture.cpp index e3b7b47..0af8757 100755 --- a/src/client/renderer/ptexture/DynamicTexture.cpp +++ b/src/client/renderer/ptexture/DynamicTexture.cpp @@ -9,7 +9,7 @@ // DynamicTexture // DynamicTexture::DynamicTexture(int tex_) -: tex(tex_), + : tex(tex_), replicate(1) { memset(pixels, 0, 16*16*4); @@ -29,8 +29,8 @@ void DynamicTexture::bindTexture(Textures* tex) { /* WaterTexture::WaterTexture() : super(Tile::water->tex), - _tick(0), - _frame(0) +_tick(0), +_frame(0) { } @@ -39,7 +39,7 @@ void WaterTexture::tick() { */ WaterTexture::WaterTexture() -: super(Tile::water->tex), + : super(Tile::water->tex), _tick(0), _frame(0) { @@ -76,55 +76,55 @@ void WaterTexture::tick() next[x + y * 16] = pow / 3.3f + heat[x + y * 16] * 0.8f; } - for (int x = 0; x < 16; x++) - for (int y = 0; y < 16; y++) { - heat[x + y * 16] += heata[x + y * 16] * 0.05f; + for (int x = 0; x < 16; x++) + for (int y = 0; y < 16; y++) { + heat[x + y * 16] += heata[x + y * 16] * 0.05f; - if (heat[x + y * 16] < 0) heat[x + y * 16] = 0; - heata[x + y * 16] -= 0.1f; - if (Mth::random() < 0.05f) { - heata[x + y * 16] = 0.5f; + if (heat[x + y * 16] < 0) heat[x + y * 16] = 0; + heata[x + y * 16] -= 0.1f; + if (Mth::random() < 0.05f) { + heata[x + y * 16] = 0.5f; + } } - } - float* tmp = next; - next = current; - current = tmp; + float* tmp = next; + next = current; + current = tmp; - for (int i = 0; i < 256; i++) { - float pow = current[i]; - if (pow > 1) pow = 1; - if (pow < 0) pow = 0; + for (int i = 0; i < 256; i++) { + float pow = current[i]; + if (pow > 1) pow = 1; + if (pow < 0) pow = 0; - float pp = pow * pow; + float pp = pow * pow; - int r = (int) (32 + pp * 32); - int g = (int) (50 + pp * 64); - int b = (int) (255); - int a = (int) (146 + pp * 50); + int r = (int) (32 + pp * 32); + int g = (int) (50 + pp * 64); + int b = (int) (255); + int a = (int) (146 + pp * 50); - //if (anaglyph3d) { - // int rr = (r * 30 + g * 59 + b * 11) / 100; - // int gg = (r * 30 + g * 70) / (100); - // int bb = (r * 30 + b * 70) / (100); + //if (anaglyph3d) { + // int rr = (r * 30 + g * 59 + b * 11) / 100; + // int gg = (r * 30 + g * 70) / (100); + // int bb = (r * 30 + b * 70) / (100); - // r = rr; - // g = gg; - // b = bb; - //} + // r = rr; + // g = gg; + // b = bb; + //} - pixels[i * 4 + 0] = r; - pixels[i * 4 + 1] = g; - pixels[i * 4 + 2] = b; - pixels[i * 4 + 3] = a; - } + pixels[i * 4 + 0] = r; + pixels[i * 4 + 1] = g; + pixels[i * 4 + 2] = b; + pixels[i * 4 + 3] = a; + } } // // WaterSideTexture // WaterSideTexture::WaterSideTexture() -: super(Tile::water->tex + 1), + : super(Tile::water->tex + 1), _tick(0), _frame(0), _tickCount(0) @@ -164,45 +164,321 @@ void WaterSideTexture::tick() { next[x + y * 16] = pow / 3.2f + heat[x + y * 16] * 0.8f; } + for (int x = 0; x < 16; x++) + for (int y = 0; y < 16; y++) { + heat[x + y * 16] += heata[x + y * 16] * 0.05f; + + if (heat[x + y * 16] < 0) heat[x + y * 16] = 0; + heata[x + y * 16] -= 0.3f; + if (Mth::random() < 0.2) { + heata[x + y * 16] = 0.5f; + } + } + float* tmp = next; + next = current; + current = tmp; + + for (int i = 0; i < 256; i++) { + float pow = current[(i - _tickCount * 16) & 255]; + if (pow > 1) pow = 1; + if (pow < 0) pow = 0; + + float pp = pow * pow; + + int r = (int) (32 + pp * 32); + int g = (int) (50 + pp * 64); + int b = (int) (255); + int a = (int) (146 + pp * 50); + + //if (anaglyph3d) { + // int rr = (r * 30 + g * 59 + b * 11) / 100; + // int gg = (r * 30 + g * 70) / (100); + // int bb = (r * 30 + b * 70) / (100); + + // r = rr; + // g = gg; + // b = bb; + //} + + pixels[i * 4 + 0] = r; + pixels[i * 4 + 1] = g; + pixels[i * 4 + 2] = b; + pixels[i * 4 + 3] = a; + } +} + +/// +/// Lava Texture +/// + +LavaTexture::LavaTexture() + : super(Tile::lava->tex), + _tick(0), + _frame(0) +{ + current = new float[16*16]; + next = new float[16*16]; + heat = new float[16*16]; + heata = new float[16*16]; + + for (int i = 0; i < 256; ++i) { + current[i] = 0; + next[i] = 0; + heat[i] = 0; + heata[i] = 0; + } +} + +LavaTexture::~LavaTexture() { + delete[] current; + delete[] next; + delete[] heat; + delete[] heata; +} + +void LavaTexture::tick() +{ for (int x = 0; x < 16; x++) for (int y = 0; y < 16; y++) { - heat[x + y * 16] += heata[x + y * 16] * 0.05f; - - if (heat[x + y * 16] < 0) heat[x + y * 16] = 0; - heata[x + y * 16] -= 0.3f; - if (Mth::random() < 0.2) { - heata[x + y * 16] = 0.5f; + float pow = 0; + int xxo = (int)(Mth::sin((float)(y) * (float)(Mth::PI) * 2.0f / 16.0f) * 1.2f); + int yyo = (int)(Mth::sin((float)(x) * (float)(Mth::PI) * 2.0f / 16.0f) * 1.2f); + for (int xx = x - 1; xx <= x + 1; xx++) { + for (int yy = y - 1; yy <= y + 1; yy++) { + int xi = xx + xxo & 15; + int yi = yy + yyo & 15; + pow += current[xi + yi * 16]; + } + } + next[x + y * 16] = pow / 10.0f + (heat[(x + 0 & 15) + (y + 0 & 15) * 16] + heat[(x + 1 & 15) + (y + 0 & 15) * 16] + heat[(x + 1 & 15) + (y + 1 & 15) * 16] + heat[(x + 0 & 15) + (y + 1 & 15) * 16]) / 4.0f * 0.8f; + heat[x + y * 16] = heat[x + y * 16] + heata[x + y * 16] * 0.01f; + if (heat[x + y * 16] < 0.0f) { + heat[x + y * 16] = 0.0f; + } + heata[x + y * 16] = heata[x + y * 16] - 0.06f; + if (Mth::random() < 0.005) { + heata[x + y * 16] = 1.5f; } } + + + float* tmp = next; + next = current; + current = tmp; + + for (int i = 0; i < 256; i++) { + float pow = current[i] * 2.0f; + if (pow > 1) pow = 1; + if (pow < 0) pow = 0; + + float pp = pow * pow; + + int r = (int) (pow * 100.0f + 155.0f); + int g = (int) (pp * 255.0f); + int b = (int) (pp * pp * 128.0f); + + //if (anaglyph3d) { + // int rr = (r * 30 + g * 59 + b * 11) / 100; + // int gg = (r * 30 + g * 70) / (100); + // int bb = (r * 30 + b * 70) / (100); + + // r = rr; + // g = gg; + // b = bb; + //} + + pixels[i * 4 + 0] = r; + pixels[i * 4 + 1] = g; + pixels[i * 4 + 2] = b; + pixels[i * 4 + 3] = -1; + } +} + +/// +/// Lava Side Texture +/// + +LavaSideTexture::LavaSideTexture() + : super(Tile::lava->tex + 1), + _tick(0), + _frame(0), + _tickCount(0) +{ + replicate = 2; + + current = new float[16*16]; + next = new float[16*16]; + heat = new float[16*16]; + heata = new float[16*16]; + + for (int i = 0; i < 256; ++i) { + current[i] = 0; + next[i] = 0; + heat[i] = 0; + heata[i] = 0; + } +} + +LavaSideTexture::~LavaSideTexture() { + delete[] current; + delete[] next; + delete[] heat; + delete[] heata; +} + +void LavaSideTexture::tick() { + ++_tickCount; + for (int x = 0; x < 16; x++) + for (int y = 0; y < 16; y++) { + float pow = 0; + int yl = (int)(Mth::sin((float)(y) * (float)(Mth::PI)* 2.0f / 16.0f) * 1.2f); // var2 is y + int xl = (int)(Mth::sin((float)(x) * (float)(Mth::PI)* 2.0f / 16.0f) * 1.2f); // var1 is x + for (int yy = x - 1; yy <= x + 1; yy++) { + for (int xx = y - 1; xx <= y + 1; xx++) { + int xi = (yy + yl) & 15; // var8 + int yi = (xx + xl) & 15; //var9 + pow += current[xi + yi * 16]; + } + } + next[x + y * 16] = + next[x + y * 16] = + pow / 10.0f + ( + heat[(x + 0 & 15) + (y + 0 & 15) * + 16] + heat[ + (x + 1 & 15) + (y + 0 & 15) * 16] + heat[(x + 1 & 15) + (y + 1 & 15) * + 16] + heat[ + (x + 0 & 15) + (y + 1 & 15) * 16]) / 4.0f + * 0.8f; + heat[x + y * 16] = heat[x + y * 16] + heata[x + y * 16] * 0.01f; + + if (heat[x + y * 16] < 0.0f) { + heat[x + y * 16] = 0.0f; + } + heata[x + y * 16] = heata[x + y * 16] - 0.06f; + + if (Mth::random() < 0.005) { + heata[x + y * 16] = 1.5f; + } + } + float* tmp = next; + next = current; + current = tmp; + + for (int i = 0; i < 256; i++) { + float pow = current[(i - _tickCount / 3 * 16) & 255] * 2.0f; + if (pow > 1) pow = 1; + if (pow < 0) pow = 0; + + float pp = pow * pow; + + int r = (int) (pow * 100.0f + 155.0f); + int g = (int) (pow * pow * 255.0f); + int b = (int) (pow * pow * pow * pow * 128.0f); +// int a = (int) (146 + pp * 50); + + //if (anaglyph3d) { + // int rr = (r * 30 + g * 59 + b * 11) / 100; + // int gg = (r * 30 + g * 70) / (100); + // int bb = (r * 30 + b * 70) / (100); + + // r = rr; + // g = gg; + // b = bb; + //} + + pixels[i * 4 + 0] = r; + pixels[i * 4 + 1] = g; + pixels[i * 4 + 2] = b; + pixels[i * 4 + 3] = -1; + } +} + +FireTexture::FireTexture(int id) + : super(((Tile*)Tile::fire)->tex + id * 16), + _tick(0), + _frame(0) +{ + current = new float[16*20]; + next = new float[16*20]; + heat = new float[16*20]; + heata = new float[16*20]; + + for (int i = 0; i < 256; ++i) { + current[i] = 0; + next[i] = 0; + heat[i] = 0; + heata[i] = 0; + } +} + +FireTexture::~FireTexture() { + delete[] current; + delete[] next; + delete[] heat; + delete[] heata; +} + + +// oh boy time to implement fire textures, i am so fucked - shredder + +void FireTexture::tick() { + // loop generates fire texture on the empty texture grid, hopefully shouldnt be too taxing on older hardware - shredder + for (int x = 0; x < 16; x++) { + for (int y = 0; y < 20; y++) { + int count = 18; + float pow = this->current[x + (y + 1) % 20 * 16] * (float)(count); + for (int xx = x - 1; xx <= x + 1; xx++) { + for (int yy = y; yy <= y + 1; yy++) { + if (xx >= 0 && yy >= 0 && xx < 16 && yy < 20) { + pow += this->current[xx + yy * 16]; + } + count++; + } + } + this->next[x + y * 16] = pow / (float(count) * 1.06f); + if (y >= 19) { + this->next[x + y * 16] = float(Mth::random() * Mth::random() * Mth::random() * 4.0 + Mth::random() * 0.1f + 0.2f); + } + } + } + + // hopefully this doesn't cause any mysterious issues - shredder float* tmp = next; next = current; current = tmp; for (int i = 0; i < 256; i++) { - float pow = current[(i - _tickCount * 16) & 255]; - if (pow > 1) pow = 1; - if (pow < 0) pow = 0; + float pow = this->current[i] * 1.8f; + if (pow > 1.0f) { + pow = 1.0f; + } + if (pow < 0.0f) { + pow = 0.0f; + } - float pp = pow * pow; - int r = (int) (32 + pp * 32); - int g = (int) (50 + pp * 64); - int b = (int) (255); - int a = (int) (146 + pp * 50); + int r = (int) (pow * 155.0f + 100.0f); + int g = (int)(pow * pow * 255.0f); + int b = (int)(pow * pow * pow * pow * pow * pow * pow * pow * pow * pow * 255.0f); + int a = 255; + if (pow < 0.5f) { + a = 0; + } - //if (anaglyph3d) { - // int rr = (r * 30 + g * 59 + b * 11) / 100; - // int gg = (r * 30 + g * 70) / (100); - // int bb = (r * 30 + b * 70) / (100); - - // r = rr; - // g = gg; - // b = bb; + // @TODO: cant be arsed rn to implement the anaglyph3d check would be nice to check if it does - shredder + //if (this->anaglyph3d) { + // float rr = (r * 30 + g * 59 + b * 11) / 100; + // float gg = (r * 30 + g * 70) / 100; + // float bb = (r * 30 + b * 70) / 100; + // r = rr; + // g = gg; + // b = bb; //} pixels[i * 4 + 0] = r; pixels[i * 4 + 1] = g; pixels[i * 4 + 2] = b; pixels[i * 4 + 3] = a; + } -} +} \ No newline at end of file diff --git a/src/client/renderer/ptexture/DynamicTexture.h b/src/client/renderer/ptexture/DynamicTexture.h index c95b3d7..a38f086 100755 --- a/src/client/renderer/ptexture/DynamicTexture.h +++ b/src/client/renderer/ptexture/DynamicTexture.h @@ -56,4 +56,59 @@ public: void tick(); }; +class LavaTexture: public DynamicTexture +{ + typedef DynamicTexture super; + int _tick; + int _frame; + + float* current; + float* next; + float* heat; + float* heata; + +public: + LavaTexture(); + ~LavaTexture(); + + void tick(); +}; + +class LavaSideTexture: public DynamicTexture +{ + typedef DynamicTexture super; + int _tick; + int _frame; + int _tickCount; + + float* current; + float* next; + float* heat; + float* heata; + +public: + LavaSideTexture(); + ~LavaSideTexture(); + + void tick(); +}; + + +class FireTexture: public DynamicTexture +{ + typedef DynamicTexture super; + int _tick; + int _frame; + + float* current; + float* next; + float* heat; + float* heata; + +public: + FireTexture(int id); + ~FireTexture(); + + void tick(); +}; #endif /*NET_MINECRAFT_CLIENT_RENDERER_PTEXTURE__DynamicTexture_H__*/ diff --git a/src/client/sound/Sound.cpp b/src/client/sound/Sound.cpp index ff5442a..1b1c6b5 100755 --- a/src/client/sound/Sound.cpp +++ b/src/client/sound/Sound.cpp @@ -111,6 +111,7 @@ #include "data/eat1.pcm" #include "data/eat2.pcm" #include "data/eat3.pcm" +#include "data/burp1.pcm" #include "data/fuse.pcm" SoundDesc SA_cloth1((char*)PCM_cloth1); @@ -221,6 +222,7 @@ SoundDesc SA_creeperdeath((char*)PCM_creeperdeath); SoundDesc SA_eat1((char*)PCM_eat1); SoundDesc SA_eat2((char*)PCM_eat2); SoundDesc SA_eat3((char*)PCM_eat3); +SoundDesc SA_burp1((char*)PCM_burp1); SoundDesc SA_fuse((char*)PCM_fuse); #endif /*!PRE_ANDROID23 && !__APPLE__*/ diff --git a/src/client/sound/Sound.h b/src/client/sound/Sound.h index 5665c2f..46ee97b 100755 --- a/src/client/sound/Sound.h +++ b/src/client/sound/Sound.h @@ -43,6 +43,7 @@ public: void destroy() const { if (isValid()) { + delete buffer; buffer = 0; } } @@ -60,7 +61,7 @@ private: mutable char* buffer; }; -#if !defined(PRE_ANDROID23) && !defined(__APPLE__) && !defined(RPI) +#if !defined(PRE_ANDROID23) && !defined(__APPLE__) && !defined(RPI) extern SoundDesc SA_cloth1; extern SoundDesc SA_cloth2; @@ -171,6 +172,7 @@ extern SoundDesc SA_creeperdeath; extern SoundDesc SA_eat1; extern SoundDesc SA_eat2; extern SoundDesc SA_eat3; +extern SoundDesc SA_burp1; extern SoundDesc SA_fuse; #endif /*!PRE_ANDROID23 && !__APPLE__*/ diff --git a/src/client/sound/SoundEngine.cpp b/src/client/sound/SoundEngine.cpp index e4bb471..2f847fb 100755 --- a/src/client/sound/SoundEngine.cpp +++ b/src/client/sound/SoundEngine.cpp @@ -26,7 +26,10 @@ void SoundEngine::init( Minecraft* mc, Options* options ) this->mc = mc; this->options = options; - if (/*!loaded && */(options == NULL || (options->sound != 0 || options->music != 0))) { + if (/*!loaded && */(options == NULL || + (options->getProgressValue(OPTIONS_SOUND_VOLUME) != 0.f || + options->getProgressValue(OPTIONS_MUSIC_VOLUME) != 0.f))) + { loadLibrary(); } @@ -141,6 +144,7 @@ void SoundEngine::init( Minecraft* mc, Options* options ) sounds.add("random.eat", SA_eat1); sounds.add("random.eat", SA_eat2); sounds.add("random.eat", SA_eat3); + sounds.add("random.burp", SA_burp1); sounds.add("random.fuse", SA_fuse); #endif @@ -165,7 +169,7 @@ void SoundEngine::destroy() void SoundEngine::update( Mob* player, float a ) { - if (/*!loaded || */options->sound == 0) return; + if (/*!loaded || */options->getProgressValue(OPTIONS_SOUND_VOLUME) == 0) return; if (player == NULL) return; _x = player->xo + (player->x - player->xo) * a; @@ -190,20 +194,20 @@ float SoundEngine::_getVolumeMult( float x, float y, float z ) #if defined(PRE_ANDROID23) void SoundEngine::play(const std::string& name, float x, float y, float z, float volume, float pitch) { //volume *= (2.0f * _getVolumeMult(x, y, z)) - if ((volume *= options->sound) <= 0) return; + if ((volume *= options->getProgressValue(OPTIONS_SOUND_VOLUME)) <= 0) return; volume *= _getVolumeMult(x, y, z); mc->platform()->playSound(name, volume, pitch); } void SoundEngine::playUI(const std::string& name, float volume, float pitch) { - if ((volume *= options->sound) <= 0) return; + if ((volume *= options->getProgressValue(OPTIONS_SOUND_VOLUME)) <= 0) return; //volume *= 2.0f; mc->platform()->playSound(name, volume, pitch); } #elif defined(__APPLE__) void SoundEngine::play(const std::string& name, float x, float y, float z, float volume, float pitch) { - if ((volume *= options->sound) <= 0) return; + if ((volume *= options->getProgressValue(OPTIONS_SOUND_VOLUME)) <= 0) return; volume = Mth::clamp(volume, 0.0f, 1.0f); @@ -213,10 +217,10 @@ void SoundEngine::play(const std::string& name, float x, float y, float z, float } } void SoundEngine::playUI(const std::string& name, float volume, float pitch) { - if ((volume *= options->sound) <= 0) return; + if ((volume *= options->getProgressValue(OPTIONS_SOUND_VOLUME)) <= 0) return; volume = Mth::clamp(volume, 0.0f, 1.0f); - if (/*!loaded || */options->sound == 0 || volume <= 0) return; + if (/*!loaded || */options->getProgressValue(OPTIONS_SOUND_VOLUME) == 0 || volume <= 0) return; SoundDesc sound; if (sounds.get(name, sound)) { @@ -228,20 +232,23 @@ void SoundEngine::play(const std::string& name, float x, float y, float z, float void SoundEngine::playUI(const std::string& name, float volume, float pitch) {} #else void SoundEngine::play(const std::string& name, float x, float y, float z, float volume, float pitch) { - if ((volume *= options->sound) <= 0) return; + if ((volume *= options->getProgressValue(OPTIONS_SOUND_VOLUME)) <= 0) return; - volume = Mth::clamp(volume, 0.0f, 1.0f); + volume = Mth::clamp( volume * _getVolumeMult(x, y, z), 0.0f, 1.0f); + if (/*!loaded || */options->getProgressValue(OPTIONS_SOUND_VOLUME) == 0 || volume <= 0) return; SoundDesc sound; if (sounds.get(name, sound)) { + float dist = SOUND_DISTANCE; + if (volume > 1) dist *= volume; soundSystem.playAt(sound, x-_x, y-_y, z-_z, volume, pitch); } } void SoundEngine::playUI(const std::string& name, float volume, float pitch) { - if ((volume *= options->sound) <= 0) return; + if ((volume *= options->getProgressValue(OPTIONS_SOUND_VOLUME)) <= 0) return; volume = Mth::clamp(volume, 0.0f, 1.0f); - if (/*!loaded || */options->sound == 0 || volume <= 0) return; + if (/*!loaded || */options->getProgressValue(OPTIONS_SOUND_VOLUME) == 0 || volume <= 0) return; SoundDesc sound; if (sounds.get(name, sound)) { diff --git a/src/client/sound/SoundEngine.h b/src/client/sound/SoundEngine.h index 1a59497..bf3d131 100755 --- a/src/client/sound/SoundEngine.h +++ b/src/client/sound/SoundEngine.h @@ -1,68 +1,68 @@ -#ifndef NET_MINECRAFT_CLIENT_SOUND__SoundEngine_H__ -#define NET_MINECRAFT_CLIENT_SOUND__SoundEngine_H__ - -//package net.minecraft.client.sound; - -#if defined(ANDROID) && !defined(PRE_ANDROID23) - #include "../../platform/audio/SoundSystemSL.h" -#elif defined(__APPLE__) || defined (PLATFORM_DESKTOP) - #include "../../platform/audio/SoundSystemAL.h" -#else - #include "../../platform/audio/SoundSystem.h" -#endif -#include "SoundRepository.h" -#include "../../util/Random.h" - -class Minecraft; -class Mob; -class Options; - -class SoundEngine -{ - static const int SOUND_DISTANCE = 16; - - #if defined(ANDROID) && !defined(PRE_ANDROID23) && !defined(RPI) - SoundSystemSL soundSystem; - #elif defined(__APPLE__) || defined (PLATFORM_DESKTOP) - SoundSystemAL soundSystem; - #else - SoundSystem soundSystem; - #endif - - Options* options; - int idCounter; - //static bool loaded; - Random random; - //int noMusicDelay = random.nextInt(20 * 60 * 10); - float _x; - float _y; - float _z; - float _yRot; - float _invMaxDistance; - -public: - SoundEngine(float maxDistance); - - ~SoundEngine(); - - void init(Minecraft* mc, Options* options); - void destroy(); - - void enable(bool status); - - void updateOptions(); - void update(Mob* player, float a); - - void play(const std::string& name, float x, float y, float z, float volume, float pitch); - void playUI(const std::string& name, float volume, float pitch); - - float _getVolumeMult(float x, float y, float z); -private: - void loadLibrary() {} - SoundDesc _pp(const std::string& fn); - - SoundRepository sounds; - Minecraft* mc; -}; - -#endif /*NET_MINECRAFT_CLIENT_SOUND__SoundEngine_H__*/ +#ifndef NET_MINECRAFT_CLIENT_SOUND__SoundEngine_H__ +#define NET_MINECRAFT_CLIENT_SOUND__SoundEngine_H__ + +//package net.minecraft.client.sound; + +#if defined(ANDROID) && !defined(PRE_ANDROID23) + #include "../../platform/audio/SoundSystemSL.h" +#elif (defined(__APPLE__) || defined(PLATFORM_DESKTOP)) && !defined(NO_SOUND) + #include "../../platform/audio/SoundSystemAL.h" +#else + #include "../../platform/audio/SoundSystem.h" +#endif +#include "SoundRepository.h" +#include "../../util/Random.h" + +class Minecraft; +class Mob; +class Options; + +class SoundEngine +{ + static const int SOUND_DISTANCE = 16; + + #if defined(ANDROID) && !defined(PRE_ANDROID23) && !defined(RPI) + SoundSystemSL soundSystem; + #elif (defined(__APPLE__) || defined(PLATFORM_DESKTOP)) && !defined(NO_SOUND) + SoundSystemAL soundSystem; + #else + SoundSystem soundSystem; + #endif + + Options* options; + int idCounter; + //static bool loaded; + Random random; + //int noMusicDelay = random.nextInt(20 * 60 * 10); + float _x; + float _y; + float _z; + float _yRot; + float _invMaxDistance; + +public: + SoundEngine(float maxDistance); + + ~SoundEngine(); + + void init(Minecraft* mc, Options* options); + void destroy(); + + void enable(bool status); + + void updateOptions(); + void update(Mob* player, float a); + + void play(const std::string& name, float x, float y, float z, float volume, float pitch); + void playUI(const std::string& name, float volume, float pitch); + + float _getVolumeMult(float x, float y, float z); +private: + void loadLibrary() {} + SoundDesc _pp(const std::string& fn); + + SoundRepository sounds; + Minecraft* mc; +}; + +#endif /*NET_MINECRAFT_CLIENT_SOUND__SoundEngine_H__*/ diff --git a/src/client/sound/SoundEngine.mm b/src/client/sound/SoundEngine.mm index c135d15..db9af18 100755 --- a/src/client/sound/SoundEngine.mm +++ b/src/client/sound/SoundEngine.mm @@ -227,6 +227,7 @@ void SoundEngine::init( Minecraft* mc, Options* options ) sounds.add( "random.eat", _pp("eat1")); sounds.add( "random.eat", _pp("eat2")); sounds.add( "random.eat", _pp("eat3")); + sounds.add( "random.burp", _pp("burp1")); sounds.add( "random.fuse", _pp("fuse")); sounds.add( "step.cloth", _pp("cloth1")); diff --git a/src/client/sound/data/burp1.pcm b/src/client/sound/data/burp1.pcm new file mode 100644 index 0000000..62c6a02 --- /dev/null +++ b/src/client/sound/data/burp1.pcm @@ -0,0 +1,2413 @@ +unsigned char PCM_burp1[28924] = { +0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x44, 0xac, 0x00, 0x00, 0x76, 0x38, 0x00, 0x00, + 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xff, 0xff, 0xfe, 0xff, 0xfe, 0xff, 0xff, 0xff, 0x01, 0x00, 0x02, 0x00, + 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, + 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, + 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, + 0xfe, 0xff, 0xfe, 0xff, 0x00, 0x00, 0x02, 0x00, 0x03, 0x00, 0x02, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x01, 0x00, + 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xfe, 0xff, 0xfe, 0xff, + 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, + 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xfd, 0xff, 0xfe, 0xff, 0xfe, 0xff, + 0xfe, 0xff, 0xfe, 0xff, 0xfd, 0xff, 0xfd, 0xff, 0xfe, 0xff, 0xff, 0xff, + 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xfe, 0xff, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, + 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, + 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x03, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, + 0xfe, 0xff, 0xff, 0xff, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, + 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, + 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x02, 0x00, 0x03, 0x00, 0x03, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x02, 0x00, 0x01, 0x00, + 0x01, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, + 0xff, 0xff, 0xfe, 0xff, 0xfd, 0xff, 0xfc, 0xff, 0xfc, 0xff, 0xfc, 0xff, + 0xfe, 0xff, 0xfe, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0xff, 0xff, + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, + 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x01, 0x00, 0x02, 0x00, + 0x02, 0x00, 0x02, 0x00, 0x01, 0x00, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff, + 0x01, 0x00, 0x03, 0x00, 0x03, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, + 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0xff, 0xff, 0xfc, 0xff, 0xfd, 0xff, + 0xff, 0xff, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x02, 0x00, 0x04, 0x00, + 0x05, 0x00, 0x03, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, + 0x02, 0x00, 0x01, 0x00, 0x01, 0x00, 0x04, 0x00, 0x06, 0x00, 0x07, 0x00, + 0x09, 0x00, 0x09, 0x00, 0x07, 0x00, 0x07, 0x00, 0x07, 0x00, 0x06, 0x00, + 0x06, 0x00, 0x08, 0x00, 0x0c, 0x00, 0x0d, 0x00, 0x0d, 0x00, 0x0c, 0x00, + 0x0b, 0x00, 0x0d, 0x00, 0x0e, 0x00, 0x0d, 0x00, 0x0b, 0x00, 0x09, 0x00, + 0x07, 0x00, 0x08, 0x00, 0x08, 0x00, 0x07, 0x00, 0x07, 0x00, 0x09, 0x00, + 0x08, 0x00, 0x07, 0x00, 0x06, 0x00, 0x05, 0x00, 0x03, 0x00, 0x00, 0x00, + 0xfe, 0xff, 0xfe, 0xff, 0xfe, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xfd, 0xff, + 0xfc, 0xff, 0xfc, 0xff, 0xfd, 0xff, 0x01, 0x00, 0x03, 0x00, 0x02, 0x00, + 0x01, 0x00, 0x01, 0x00, 0x03, 0x00, 0x07, 0x00, 0x0b, 0x00, 0x0b, 0x00, + 0x0a, 0x00, 0x0c, 0x00, 0x0e, 0x00, 0x0d, 0x00, 0x0d, 0x00, 0x0b, 0x00, + 0x0a, 0x00, 0x0b, 0x00, 0x0c, 0x00, 0x0b, 0x00, 0x0b, 0x00, 0x09, 0x00, + 0x07, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x05, 0x00, + 0x03, 0x00, 0x03, 0x00, 0x03, 0x00, 0x04, 0x00, 0x06, 0x00, 0x07, 0x00, + 0x07, 0x00, 0x06, 0x00, 0x02, 0x00, 0x00, 0x00, 0xfd, 0xff, 0xfa, 0xff, + 0xf9, 0xff, 0xf7, 0xff, 0xf3, 0xff, 0xef, 0xff, 0xec, 0xff, 0xeb, 0xff, + 0xed, 0xff, 0xed, 0xff, 0xed, 0xff, 0xed, 0xff, 0xef, 0xff, 0xf1, 0xff, + 0xf3, 0xff, 0xf7, 0xff, 0xf9, 0xff, 0xfa, 0xff, 0xfd, 0xff, 0xff, 0xff, + 0x01, 0x00, 0x04, 0x00, 0x05, 0x00, 0x04, 0x00, 0x04, 0x00, 0x03, 0x00, + 0x04, 0x00, 0x07, 0x00, 0x08, 0x00, 0x08, 0x00, 0x05, 0x00, 0x02, 0x00, + 0x01, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0xfb, 0xff, 0xf5, 0xff, + 0xf4, 0xff, 0xf5, 0xff, 0xf6, 0xff, 0xf7, 0xff, 0xf4, 0xff, 0xf0, 0xff, + 0xed, 0xff, 0xec, 0xff, 0xec, 0xff, 0xed, 0xff, 0xef, 0xff, 0xf0, 0xff, + 0xf0, 0xff, 0xf1, 0xff, 0xf2, 0xff, 0xf3, 0xff, 0xf4, 0xff, 0xf4, 0xff, + 0xf3, 0xff, 0xf2, 0xff, 0xf2, 0xff, 0xf1, 0xff, 0xee, 0xff, 0xea, 0xff, + 0xe8, 0xff, 0xe7, 0xff, 0xe3, 0xff, 0xdf, 0xff, 0xdc, 0xff, 0xd6, 0xff, + 0xd2, 0xff, 0xd2, 0xff, 0xd4, 0xff, 0xd7, 0xff, 0xd9, 0xff, 0xdc, 0xff, + 0xe0, 0xff, 0xe3, 0xff, 0xe5, 0xff, 0xe9, 0xff, 0xef, 0xff, 0xf2, 0xff, + 0xf3, 0xff, 0xf2, 0xff, 0xf0, 0xff, 0xed, 0xff, 0xec, 0xff, 0xee, 0xff, + 0xee, 0xff, 0xe9, 0xff, 0xe1, 0xff, 0xdb, 0xff, 0xd9, 0xff, 0xd9, 0xff, + 0xda, 0xff, 0xdd, 0xff, 0xe2, 0xff, 0xe6, 0xff, 0xe8, 0xff, 0xe6, 0xff, + 0xe2, 0xff, 0xe4, 0xff, 0xe8, 0xff, 0xee, 0xff, 0xf2, 0xff, 0xf6, 0xff, + 0xfa, 0xff, 0xfd, 0xff, 0x00, 0x00, 0x04, 0x00, 0x07, 0x00, 0x0b, 0x00, + 0x0d, 0x00, 0x0c, 0x00, 0x0a, 0x00, 0x0b, 0x00, 0x0d, 0x00, 0x0e, 0x00, + 0x10, 0x00, 0x15, 0x00, 0x19, 0x00, 0x18, 0x00, 0x13, 0x00, 0x0e, 0x00, + 0x09, 0x00, 0x06, 0x00, 0x07, 0x00, 0x0b, 0x00, 0x0d, 0x00, 0x0c, 0x00, + 0x07, 0x00, 0x05, 0x00, 0x08, 0x00, 0x0e, 0x00, 0x15, 0x00, 0x1a, 0x00, + 0x1c, 0x00, 0x1a, 0x00, 0x15, 0x00, 0x12, 0x00, 0x12, 0x00, 0x13, 0x00, + 0x0f, 0x00, 0x07, 0x00, 0x00, 0x00, 0xff, 0xff, 0x04, 0x00, 0x07, 0x00, + 0x07, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x0d, 0x00, + 0x09, 0x00, 0xff, 0xff, 0xf9, 0xff, 0xfb, 0xff, 0xff, 0xff, 0x02, 0x00, + 0x00, 0x00, 0xfe, 0xff, 0x02, 0x00, 0x08, 0x00, 0x0b, 0x00, 0x04, 0x00, + 0xf8, 0xff, 0xf1, 0xff, 0xf5, 0xff, 0x02, 0x00, 0x0c, 0x00, 0x0c, 0x00, + 0x06, 0x00, 0x04, 0x00, 0x05, 0x00, 0x05, 0x00, 0x01, 0x00, 0xfb, 0xff, + 0xfa, 0xff, 0xfd, 0xff, 0xfd, 0xff, 0xfc, 0xff, 0xff, 0xff, 0x00, 0x00, + 0xfc, 0xff, 0xfa, 0xff, 0xfa, 0xff, 0xf9, 0xff, 0xfa, 0xff, 0x00, 0x00, + 0x07, 0x00, 0x0a, 0x00, 0x09, 0x00, 0x09, 0x00, 0x0c, 0x00, 0x11, 0x00, + 0x15, 0x00, 0x13, 0x00, 0x0d, 0x00, 0x07, 0x00, 0x05, 0x00, 0x05, 0x00, + 0x04, 0x00, 0x04, 0x00, 0x06, 0x00, 0x09, 0x00, 0x0d, 0x00, 0x10, 0x00, + 0x10, 0x00, 0x11, 0x00, 0x14, 0x00, 0x17, 0x00, 0x17, 0x00, 0x15, 0x00, + 0x12, 0x00, 0x12, 0x00, 0x15, 0x00, 0x17, 0x00, 0x15, 0x00, 0x12, 0x00, + 0x11, 0x00, 0x17, 0x00, 0x1f, 0x00, 0x1f, 0x00, 0x15, 0x00, 0x09, 0x00, + 0x04, 0x00, 0x08, 0x00, 0x12, 0x00, 0x1e, 0x00, 0x23, 0x00, 0x24, 0x00, + 0x21, 0x00, 0x18, 0x00, 0x0f, 0x00, 0x0f, 0x00, 0x17, 0x00, 0x1e, 0x00, + 0x24, 0x00, 0x29, 0x00, 0x29, 0x00, 0x23, 0x00, 0x1e, 0x00, 0x20, 0x00, + 0x25, 0x00, 0x27, 0x00, 0x26, 0x00, 0x23, 0x00, 0x20, 0x00, 0x1f, 0x00, + 0x22, 0x00, 0x23, 0x00, 0x1f, 0x00, 0x1a, 0x00, 0x17, 0x00, 0x11, 0x00, + 0x0a, 0x00, 0x08, 0x00, 0x09, 0x00, 0x0b, 0x00, 0x0a, 0x00, 0x03, 0x00, + 0xfd, 0xff, 0xfe, 0xff, 0x03, 0x00, 0x04, 0x00, 0x02, 0x00, 0x01, 0x00, + 0x02, 0x00, 0x03, 0x00, 0x06, 0x00, 0x07, 0x00, 0x04, 0x00, 0xff, 0xff, + 0xfe, 0xff, 0xfc, 0xff, 0xf8, 0xff, 0xf6, 0xff, 0xf8, 0xff, 0xf8, 0xff, + 0xf5, 0xff, 0xf4, 0xff, 0xf5, 0xff, 0xf1, 0xff, 0xe8, 0xff, 0xe2, 0xff, + 0xe2, 0xff, 0xe8, 0xff, 0xf1, 0xff, 0xf8, 0xff, 0xfc, 0xff, 0x00, 0x00, + 0x04, 0x00, 0x06, 0x00, 0x09, 0x00, 0x0d, 0x00, 0x0d, 0x00, 0x09, 0x00, + 0x06, 0x00, 0x07, 0x00, 0x0a, 0x00, 0x0b, 0x00, 0x0a, 0x00, 0x06, 0x00, + 0x02, 0x00, 0xff, 0xff, 0xfe, 0xff, 0xfd, 0xff, 0xfb, 0xff, 0xf6, 0xff, + 0xf1, 0xff, 0xed, 0xff, 0xe7, 0xff, 0xe0, 0xff, 0xdd, 0xff, 0xe0, 0xff, + 0xe4, 0xff, 0xe3, 0xff, 0xe3, 0xff, 0xe8, 0xff, 0xf2, 0xff, 0xf8, 0xff, + 0xf8, 0xff, 0xf5, 0xff, 0xf5, 0xff, 0xfc, 0xff, 0x07, 0x00, 0x11, 0x00, + 0x13, 0x00, 0x15, 0x00, 0x1b, 0x00, 0x24, 0x00, 0x29, 0x00, 0x28, 0x00, + 0x23, 0x00, 0x1f, 0x00, 0x1f, 0x00, 0x1e, 0x00, 0x1a, 0x00, 0x19, 0x00, + 0x19, 0x00, 0x10, 0x00, 0xff, 0xff, 0xeb, 0xff, 0xdd, 0xff, 0xda, 0xff, + 0xdb, 0xff, 0xdc, 0xff, 0xde, 0xff, 0xe1, 0xff, 0xdd, 0xff, 0xd1, 0xff, + 0xca, 0xff, 0xcf, 0xff, 0xd7, 0xff, 0xdf, 0xff, 0xe7, 0xff, 0xee, 0xff, + 0xf0, 0xff, 0xed, 0xff, 0xe7, 0xff, 0xe4, 0xff, 0xe4, 0xff, 0xe3, 0xff, + 0xe1, 0xff, 0xdf, 0xff, 0xde, 0xff, 0xde, 0xff, 0xde, 0xff, 0xdb, 0xff, + 0xd4, 0xff, 0xcd, 0xff, 0xc7, 0xff, 0xc8, 0xff, 0xce, 0xff, 0xd1, 0xff, + 0xd2, 0xff, 0xd3, 0xff, 0xd8, 0xff, 0xe1, 0xff, 0xea, 0xff, 0xf0, 0xff, + 0xf3, 0xff, 0xf9, 0xff, 0x04, 0x00, 0x0b, 0x00, 0x09, 0x00, 0xfd, 0xff, + 0xec, 0xff, 0xde, 0xff, 0xd6, 0xff, 0xd2, 0xff, 0xd1, 0xff, 0xd3, 0xff, + 0xd1, 0xff, 0xce, 0xff, 0xce, 0xff, 0xce, 0xff, 0xd0, 0xff, 0xdc, 0xff, + 0xf0, 0xff, 0xfe, 0xff, 0x05, 0x00, 0x10, 0x00, 0x21, 0x00, 0x37, 0x00, + 0x4c, 0x00, 0x54, 0x00, 0x4a, 0x00, 0x3c, 0x00, 0x39, 0x00, 0x3f, 0x00, + 0x41, 0x00, 0x3a, 0x00, 0x2d, 0x00, 0x21, 0x00, 0x18, 0x00, 0x0f, 0x00, + 0x02, 0x00, 0xf3, 0xff, 0xe4, 0xff, 0xdb, 0xff, 0xe1, 0xff, 0xf5, 0xff, + 0x12, 0x00, 0x2a, 0x00, 0x33, 0x00, 0x2f, 0x00, 0x27, 0x00, 0x1e, 0x00, + 0x10, 0x00, 0x01, 0x00, 0xfd, 0xff, 0x00, 0x00, 0xfc, 0xff, 0xf0, 0xff, + 0xee, 0xff, 0x03, 0x00, 0x1e, 0x00, 0x2f, 0x00, 0x36, 0x00, 0x39, 0x00, + 0x36, 0x00, 0x2d, 0x00, 0x25, 0x00, 0x1f, 0x00, 0x14, 0x00, 0x07, 0x00, + 0xf8, 0xff, 0xef, 0xff, 0xf2, 0xff, 0xf9, 0xff, 0xfa, 0xff, 0xfa, 0xff, + 0xf9, 0xff, 0xec, 0xff, 0xda, 0xff, 0xd5, 0xff, 0xe1, 0xff, 0xf1, 0xff, + 0xf8, 0xff, 0xfa, 0xff, 0x06, 0x00, 0x1b, 0x00, 0x27, 0x00, 0x1c, 0x00, + 0x07, 0x00, 0xf7, 0xff, 0xea, 0xff, 0xdb, 0xff, 0xcd, 0xff, 0xc7, 0xff, + 0xc9, 0xff, 0xd1, 0xff, 0xd2, 0xff, 0xc5, 0xff, 0xa3, 0xff, 0x75, 0xff, + 0x59, 0xff, 0x68, 0xff, 0x99, 0xff, 0xcf, 0xff, 0xe8, 0xff, 0xdf, 0xff, + 0xcf, 0xff, 0xcc, 0xff, 0xd0, 0xff, 0xd3, 0xff, 0xd5, 0xff, 0xd4, 0xff, + 0xcc, 0xff, 0xb4, 0xff, 0x8f, 0xff, 0x70, 0xff, 0x6d, 0xff, 0x7d, 0xff, + 0x7f, 0xff, 0x53, 0xff, 0xf9, 0xfe, 0x8d, 0xfe, 0x2e, 0xfe, 0xec, 0xfd, + 0xbf, 0xfd, 0x8c, 0xfd, 0x42, 0xfd, 0xda, 0xfc, 0x47, 0xfc, 0x8c, 0xfb, + 0xc7, 0xfa, 0xff, 0xf9, 0x2e, 0xf9, 0x89, 0xf8, 0x66, 0xf8, 0xd6, 0xf8, + 0xc5, 0xf9, 0x38, 0xfb, 0x13, 0xfd, 0x18, 0xff, 0x2e, 0x01, 0x48, 0x03, + 0xf8, 0x04, 0x9d, 0x05, 0xe7, 0x04, 0x49, 0x03, 0xc2, 0x01, 0xea, 0x00, + 0x9c, 0x00, 0xb3, 0x00, 0x3f, 0x01, 0xea, 0x01, 0x21, 0x02, 0xaf, 0x01, + 0xaa, 0x00, 0x63, 0xff, 0x95, 0xfe, 0x18, 0xff, 0x01, 0x01, 0x89, 0x03, + 0xd7, 0x05, 0x9d, 0x07, 0xd1, 0x08, 0x31, 0x09, 0x93, 0x08, 0x82, 0x07, + 0xc7, 0x06, 0xad, 0x06, 0x28, 0x07, 0x0f, 0x08, 0xee, 0x08, 0x3e, 0x09, + 0xe4, 0x08, 0x05, 0x08, 0xd2, 0x06, 0xaf, 0x05, 0x22, 0x05, 0x58, 0x05, + 0x03, 0x06, 0xaf, 0x06, 0xf8, 0x06, 0x89, 0x06, 0x26, 0x05, 0xeb, 0x02, + 0x64, 0x00, 0x40, 0xfe, 0xd8, 0xfc, 0x2e, 0xfc, 0x37, 0xfc, 0xd2, 0xfc, + 0xa9, 0xfd, 0x68, 0xfe, 0xcf, 0xfe, 0x9b, 0xfe, 0xc4, 0xfd, 0xc1, 0xfc, + 0x30, 0xfc, 0x4d, 0xfc, 0xd2, 0xfc, 0x23, 0xfd, 0xa3, 0xfc, 0x08, 0xfb, + 0x7c, 0xf8, 0x63, 0xf5, 0x49, 0xf2, 0xc9, 0xef, 0x38, 0xee, 0x91, 0xed, + 0xbe, 0xed, 0x9b, 0xee, 0xcb, 0xef, 0xec, 0xf0, 0xbf, 0xf1, 0x21, 0xf2, + 0x1d, 0xf2, 0xef, 0xf1, 0xca, 0xf1, 0xda, 0xf1, 0x56, 0xf2, 0x54, 0xf3, + 0xa5, 0xf4, 0x1d, 0xf6, 0xad, 0xf7, 0x2f, 0xf9, 0x79, 0xfa, 0x97, 0xfb, + 0x95, 0xfc, 0x52, 0xfd, 0xc1, 0xfd, 0x1b, 0xfe, 0x9e, 0xfe, 0x56, 0xff, + 0x15, 0x00, 0xb7, 0x00, 0x90, 0x01, 0x1e, 0x03, 0x36, 0x05, 0xf8, 0x06, + 0xc0, 0x07, 0xa5, 0x07, 0x10, 0x07, 0x68, 0x06, 0x2c, 0x06, 0xdc, 0x06, + 0x97, 0x08, 0x35, 0x0b, 0x66, 0x0e, 0x75, 0x11, 0x7f, 0x13, 0x3b, 0x14, + 0x33, 0x14, 0xe9, 0x13, 0x34, 0x13, 0xca, 0x11, 0x08, 0x10, 0xa7, 0x0e, + 0x00, 0x0e, 0x10, 0x0e, 0xa1, 0x0e, 0x20, 0x0f, 0xf1, 0x0e, 0x20, 0x0e, + 0x3a, 0x0d, 0x92, 0x0c, 0x2d, 0x0c, 0x2d, 0x0c, 0xb0, 0x0c, 0x5b, 0x0d, + 0x9d, 0x0d, 0x4e, 0x0d, 0x7d, 0x0c, 0x22, 0x0b, 0x75, 0x09, 0xfa, 0x07, + 0xfd, 0x06, 0x51, 0x06, 0xb1, 0x05, 0x19, 0x05, 0xb7, 0x04, 0x85, 0x04, + 0x37, 0x04, 0xbd, 0x03, 0x59, 0x03, 0xff, 0x02, 0x46, 0x02, 0x13, 0x01, + 0xa7, 0xff, 0x24, 0xfe, 0xb7, 0xfc, 0xc0, 0xfb, 0x54, 0xfb, 0x1f, 0xfb, + 0xe4, 0xfa, 0xcc, 0xfa, 0xf6, 0xfa, 0x1f, 0xfb, 0xf2, 0xfa, 0x6e, 0xfa, + 0xdd, 0xf9, 0x9e, 0xf9, 0xf0, 0xf9, 0xcc, 0xfa, 0xf4, 0xfb, 0x42, 0xfd, + 0xd6, 0xfe, 0xc2, 0x00, 0x85, 0x02, 0x59, 0x03, 0x03, 0x03, 0xec, 0x01, + 0xa1, 0x00, 0xa6, 0xff, 0x74, 0xff, 0x35, 0x00, 0xb2, 0x01, 0x99, 0x03, + 0x89, 0x05, 0x11, 0x07, 0x0b, 0x08, 0xa5, 0x08, 0xdf, 0x08, 0xa4, 0x08, + 0x42, 0x08, 0x20, 0x08, 0x65, 0x08, 0x1e, 0x09, 0x30, 0x0a, 0x48, 0x0b, + 0x0f, 0x0c, 0x2e, 0x0c, 0x72, 0x0b, 0x2e, 0x0a, 0xf6, 0x08, 0x1a, 0x08, + 0x93, 0x07, 0x2f, 0x07, 0xd2, 0x06, 0x9b, 0x06, 0xaf, 0x06, 0xf2, 0x06, + 0xff, 0x06, 0x63, 0x06, 0x15, 0x05, 0x8d, 0x03, 0x5a, 0x02, 0xc3, 0x01, + 0x7f, 0x01, 0xee, 0x00, 0xf8, 0xff, 0x0c, 0xff, 0x51, 0xfe, 0x89, 0xfd, + 0x8b, 0xfc, 0x60, 0xfb, 0x25, 0xfa, 0x0d, 0xf9, 0x39, 0xf8, 0xaf, 0xf7, + 0xa9, 0xf7, 0x70, 0xf8, 0xcf, 0xf9, 0xf6, 0xfa, 0x24, 0xfb, 0x2c, 0xfa, + 0x43, 0xf8, 0x9c, 0xf5, 0x77, 0xf2, 0x8e, 0xef, 0xdb, 0xed, 0xd0, 0xed, + 0x32, 0xef, 0x78, 0xf1, 0xcc, 0xf3, 0x4b, 0xf5, 0xaf, 0xf5, 0x39, 0xf5, + 0x08, 0xf4, 0x1f, 0xf2, 0x07, 0xf0, 0xc6, 0xee, 0xfb, 0xee, 0x49, 0xf0, + 0xe5, 0xf1, 0x58, 0xf3, 0x83, 0xf4, 0x32, 0xf5, 0x22, 0xf5, 0x89, 0xf4, + 0xef, 0xf3, 0x63, 0xf3, 0x87, 0xf2, 0x7f, 0xf1, 0x07, 0xf1, 0x90, 0xf1, + 0x01, 0xf3, 0x1f, 0xf5, 0x7d, 0xf7, 0x65, 0xf9, 0x7d, 0xfa, 0x10, 0xfb, + 0x48, 0xfb, 0xf5, 0xfa, 0x45, 0xfa, 0xde, 0xf9, 0x10, 0xfa, 0x79, 0xfa, + 0x7b, 0xfa, 0x33, 0xfa, 0x7e, 0xfa, 0xb8, 0xfb, 0x35, 0xfd, 0x4f, 0xfe, + 0xfd, 0xfe, 0x87, 0xff, 0x33, 0x00, 0xe8, 0x00, 0x0f, 0x01, 0x37, 0x00, + 0xb2, 0xfe, 0x39, 0xfd, 0x03, 0xfc, 0xa4, 0xfa, 0x1f, 0xf9, 0x56, 0xf8, + 0xde, 0xf8, 0x10, 0xfa, 0xfc, 0xfa, 0x80, 0xfb, 0xd7, 0xfb, 0xd0, 0xfb, + 0x31, 0xfb, 0x28, 0xfa, 0xd8, 0xf8, 0x29, 0xf7, 0x65, 0xf5, 0x3b, 0xf4, + 0xd4, 0xf3, 0xb2, 0xf3, 0xc4, 0xf3, 0xa7, 0xf4, 0x6f, 0xf6, 0x5b, 0xf8, + 0x97, 0xf9, 0x4d, 0xf9, 0xda, 0xf6, 0xfc, 0xf2, 0x94, 0xef, 0xab, 0xed, + 0xc8, 0xec, 0x4a, 0xec, 0x65, 0xec, 0x9b, 0xed, 0xdf, 0xef, 0x67, 0xf2, + 0x30, 0xf4, 0xa4, 0xf4, 0xe9, 0xf3, 0x8f, 0xf2, 0x28, 0xf1, 0x14, 0xf0, + 0x6f, 0xef, 0x77, 0xef, 0xb6, 0xf0, 0x26, 0xf3, 0xcb, 0xf5, 0xa5, 0xf7, + 0x79, 0xf8, 0x68, 0xf8, 0x86, 0xf7, 0x19, 0xf6, 0xd8, 0xf4, 0x78, 0xf4, + 0x21, 0xf5, 0xa2, 0xf6, 0xa9, 0xf8, 0x83, 0xfa, 0x88, 0xfb, 0xf5, 0xfb, + 0x90, 0xfc, 0x92, 0xfd, 0xd5, 0xfe, 0x47, 0x00, 0x88, 0x01, 0x17, 0x02, + 0x53, 0x02, 0xf4, 0x02, 0xaa, 0x03, 0xd5, 0x03, 0xc4, 0x03, 0xcc, 0x03, + 0x99, 0x03, 0x4c, 0x03, 0x99, 0x03, 0x9f, 0x04, 0xed, 0x05, 0x3a, 0x07, + 0x71, 0x08, 0x77, 0x09, 0x41, 0x0a, 0xd4, 0x0a, 0x22, 0x0b, 0x0a, 0x0b, + 0xab, 0x0a, 0x61, 0x0a, 0x05, 0x0a, 0xf0, 0x08, 0x59, 0x07, 0x99, 0x06, + 0x59, 0x07, 0xe0, 0x08, 0x61, 0x0a, 0x33, 0x0b, 0x5b, 0x0a, 0xbf, 0x07, + 0xe5, 0x04, 0x16, 0x03, 0x19, 0x02, 0x9e, 0x01, 0x4c, 0x02, 0x4f, 0x04, + 0x7e, 0x06, 0xe4, 0x07, 0xc5, 0x08, 0x45, 0x09, 0xae, 0x08, 0xb5, 0x06, + 0x04, 0x04, 0x5d, 0x01, 0x41, 0xff, 0x1a, 0xfe, 0x12, 0xfe, 0xb6, 0xfe, + 0x46, 0xff, 0x6a, 0xff, 0x55, 0xff, 0x1b, 0xff, 0x6c, 0xfe, 0x29, 0xfd, + 0xd8, 0xfb, 0x27, 0xfb, 0x19, 0xfb, 0x4c, 0xfb, 0x00, 0xfc, 0xb0, 0xfd, + 0xa7, 0xff, 0x61, 0x00, 0x82, 0xff, 0x45, 0xfe, 0xc6, 0xfd, 0xe2, 0xfd, + 0x2c, 0xfe, 0xe2, 0xfe, 0x43, 0x00, 0xe7, 0x01, 0x4f, 0x03, 0x74, 0x04, + 0x47, 0x05, 0x38, 0x05, 0x06, 0x04, 0xb9, 0x02, 0xb4, 0x02, 0x28, 0x04, + 0x55, 0x06, 0xb1, 0x08, 0xcf, 0x0a, 0x01, 0x0c, 0x0e, 0x0c, 0xa9, 0x0b, + 0x74, 0x0b, 0x63, 0x0b, 0x61, 0x0b, 0xa1, 0x0b, 0x3a, 0x0c, 0x23, 0x0d, + 0x11, 0x0e, 0x6d, 0x0e, 0x4f, 0x0e, 0xb7, 0x0e, 0xed, 0x0f, 0xfb, 0x10, + 0x50, 0x11, 0x79, 0x11, 0xfa, 0x11, 0x8f, 0x12, 0x8e, 0x12, 0xa5, 0x11, + 0x44, 0x10, 0x37, 0x0f, 0xab, 0x0e, 0x46, 0x0e, 0x1d, 0x0e, 0x8e, 0x0e, + 0x69, 0x0f, 0xdd, 0x0f, 0xfc, 0x0e, 0xa6, 0x0c, 0xee, 0x09, 0xf1, 0x07, + 0xea, 0x06, 0x0a, 0x07, 0xca, 0x08, 0xae, 0x0b, 0x00, 0x0e, 0x9e, 0x0e, + 0x14, 0x0e, 0x47, 0x0d, 0x26, 0x0c, 0x9b, 0x0a, 0x30, 0x09, 0xee, 0x07, + 0x57, 0x06, 0xd7, 0x04, 0x7b, 0x04, 0x53, 0x05, 0x58, 0x06, 0xa8, 0x06, + 0x16, 0x06, 0xbc, 0x04, 0xd6, 0x02, 0x18, 0x01, 0x46, 0x00, 0x65, 0x00, + 0xf4, 0x00, 0xbd, 0x01, 0xc3, 0x02, 0xb9, 0x03, 0x1c, 0x04, 0xb2, 0x03, + 0xa9, 0x02, 0x8c, 0x01, 0x17, 0x01, 0xb3, 0x01, 0x20, 0x03, 0xb9, 0x04, + 0xf7, 0x05, 0xa2, 0x06, 0xa9, 0x06, 0xf5, 0x05, 0x9f, 0x04, 0x2b, 0x03, + 0x3c, 0x02, 0x2b, 0x02, 0x04, 0x03, 0x9b, 0x04, 0x86, 0x06, 0x2f, 0x08, + 0x0d, 0x09, 0xb5, 0x08, 0x1c, 0x07, 0x3d, 0x05, 0xc2, 0x04, 0x23, 0x06, + 0x58, 0x08, 0xa0, 0x0a, 0xce, 0x0c, 0x43, 0x0e, 0x8b, 0x0e, 0x09, 0x0e, + 0x1d, 0x0d, 0xcb, 0x0b, 0x88, 0x0a, 0x1d, 0x0a, 0xcf, 0x0a, 0x2e, 0x0c, + 0xa2, 0x0d, 0xcc, 0x0e, 0x71, 0x0f, 0x57, 0x0f, 0x8a, 0x0e, 0x8d, 0x0d, + 0xbe, 0x0c, 0xed, 0x0b, 0x2a, 0x0b, 0x15, 0x0b, 0xa4, 0x0b, 0xee, 0x0b, + 0x85, 0x0b, 0xb6, 0x0a, 0xa7, 0x09, 0x29, 0x08, 0x6e, 0x06, 0x58, 0x05, + 0xa8, 0x05, 0x0a, 0x07, 0x95, 0x08, 0x8f, 0x09, 0x89, 0x09, 0xa1, 0x08, + 0x9d, 0x07, 0xd8, 0x06, 0xa8, 0x05, 0x89, 0x03, 0x45, 0x01, 0x4c, 0x00, + 0x0e, 0x01, 0x6f, 0x02, 0xfc, 0x02, 0x13, 0x02, 0x2e, 0x00, 0x72, 0xfe, + 0x88, 0xfd, 0x01, 0xfd, 0x7b, 0xfc, 0xbb, 0xfc, 0x78, 0xfe, 0xb7, 0x00, + 0xac, 0x01, 0xb8, 0x00, 0x9e, 0xfe, 0x4c, 0xfc, 0x6e, 0xfa, 0xbb, 0xf9, + 0x7a, 0xfa, 0xd0, 0xfb, 0x99, 0xfc, 0xc4, 0xfc, 0xaf, 0xfc, 0x08, 0xfc, + 0xa1, 0xfa, 0x47, 0xf9, 0xe2, 0xf8, 0xb3, 0xf9, 0x77, 0xfb, 0x94, 0xfd, + 0x55, 0xff, 0x36, 0x00, 0x1d, 0x00, 0x4b, 0xff, 0xf1, 0xfd, 0x09, 0xfc, + 0xf0, 0xf9, 0xb3, 0xf8, 0x64, 0xf9, 0xe7, 0xfb, 0xc6, 0xfe, 0xd2, 0x00, + 0x20, 0x02, 0xc1, 0x02, 0x49, 0x02, 0xff, 0x00, 0x84, 0xff, 0xe0, 0xfd, + 0x8a, 0xfc, 0xb7, 0xfc, 0x3c, 0xfe, 0x59, 0xff, 0x7b, 0xff, 0xbd, 0xff, + 0x67, 0x00, 0x92, 0x00, 0x3a, 0x00, 0x32, 0x00, 0x9b, 0x00, 0x08, 0x01, + 0x3f, 0x01, 0xe9, 0x00, 0xbe, 0xff, 0x65, 0xfe, 0xf5, 0xfd, 0x70, 0xfe, + 0xfd, 0xfe, 0x57, 0xff, 0xc2, 0xff, 0x19, 0x00, 0x0a, 0x00, 0x8c, 0xff, + 0x87, 0xfe, 0xdf, 0xfc, 0x1b, 0xfb, 0x28, 0xfa, 0x11, 0xfa, 0xde, 0xf9, + 0x4a, 0xf9, 0x33, 0xf9, 0xda, 0xf9, 0x54, 0xfa, 0x2f, 0xfa, 0xc7, 0xf9, + 0x01, 0xf9, 0x6a, 0xf7, 0x8b, 0xf5, 0x7a, 0xf4, 0x42, 0xf4, 0x19, 0xf4, + 0xcb, 0xf3, 0xb1, 0xf3, 0xc6, 0xf3, 0xcc, 0xf3, 0xe7, 0xf3, 0x5d, 0xf4, + 0x1f, 0xf5, 0xf2, 0xf5, 0xb4, 0xf6, 0xd1, 0xf6, 0x7f, 0xf5, 0x18, 0xf3, + 0x00, 0xf1, 0xcc, 0xef, 0xe1, 0xee, 0xe3, 0xed, 0x7d, 0xed, 0x92, 0xee, + 0xe2, 0xf0, 0x0d, 0xf3, 0x39, 0xf4, 0xc9, 0xf4, 0x5c, 0xf5, 0xff, 0xf5, + 0x3b, 0xf6, 0x80, 0xf5, 0xd4, 0xf3, 0x39, 0xf2, 0xe6, 0xf1, 0x02, 0xf3, + 0xba, 0xf4, 0xa4, 0xf6, 0xe5, 0xf8, 0xbd, 0xfa, 0xcc, 0xfa, 0x11, 0xf9, + 0x07, 0xf7, 0xe7, 0xf5, 0x27, 0xf6, 0xd3, 0xf7, 0xfc, 0xf9, 0xf4, 0xfa, + 0x69, 0xfa, 0xce, 0xf9, 0xea, 0xf9, 0xf8, 0xf9, 0x93, 0xf9, 0xab, 0xf9, + 0x1a, 0xfb, 0x31, 0xfd, 0x2e, 0xfe, 0x4f, 0xfd, 0xa4, 0xfb, 0x74, 0xfa, + 0xdd, 0xf9, 0x5b, 0xf9, 0xa7, 0xf8, 0x05, 0xf8, 0x64, 0xf8, 0x69, 0xfa, + 0x1f, 0xfd, 0xd9, 0xfe, 0x24, 0xff, 0x81, 0xfe, 0x17, 0xfd, 0x09, 0xfb, + 0xc8, 0xf8, 0x83, 0xf6, 0xa9, 0xf4, 0x4d, 0xf4, 0xca, 0xf5, 0x00, 0xf8, + 0xa5, 0xf9, 0x4e, 0xfa, 0x07, 0xfa, 0xe0, 0xf8, 0x31, 0xf7, 0xa7, 0xf5, + 0xb0, 0xf4, 0x37, 0xf4, 0xf3, 0xf3, 0xaa, 0xf3, 0x4d, 0xf3, 0xfe, 0xf2, + 0xfd, 0xf2, 0x8b, 0xf3, 0x97, 0xf4, 0x96, 0xf5, 0x0e, 0xf6, 0xc0, 0xf5, + 0xb5, 0xf4, 0xb0, 0xf3, 0x69, 0xf3, 0x5e, 0xf3, 0xce, 0xf2, 0x0a, 0xf2, + 0xad, 0xf1, 0xd6, 0xf1, 0x73, 0xf2, 0x2a, 0xf3, 0x7c, 0xf3, 0x9c, 0xf3, + 0x4e, 0xf4, 0x9f, 0xf5, 0x7f, 0xf6, 0xed, 0xf5, 0x57, 0xf4, 0x3c, 0xf3, + 0x79, 0xf3, 0x8d, 0xf4, 0xa8, 0xf5, 0x89, 0xf6, 0x41, 0xf7, 0xe4, 0xf7, + 0x77, 0xf8, 0xce, 0xf8, 0xf3, 0xf8, 0x64, 0xf9, 0x50, 0xfa, 0x10, 0xfb, + 0xdf, 0xfa, 0x03, 0xfa, 0xcd, 0xf9, 0x3a, 0xfb, 0xbf, 0xfd, 0xd5, 0xff, + 0x4d, 0x00, 0x24, 0xff, 0x80, 0xfd, 0xa0, 0xfc, 0xf3, 0xfc, 0x5f, 0xfe, + 0x7d, 0x00, 0x76, 0x02, 0x65, 0x03, 0xcf, 0x02, 0xc9, 0x00, 0x21, 0xfe, + 0xed, 0xfb, 0xb7, 0xfa, 0x9d, 0xfa, 0xd5, 0xfb, 0x49, 0xfe, 0x01, 0x01, + 0xc8, 0x02, 0x44, 0x03, 0xb9, 0x02, 0x41, 0x01, 0x11, 0xff, 0x06, 0xfd, + 0xeb, 0xfb, 0xaa, 0xfb, 0xf6, 0xfb, 0xf0, 0xfc, 0x5f, 0xfe, 0x70, 0xff, + 0xff, 0xff, 0x8e, 0x00, 0xac, 0x00, 0x55, 0xff, 0xc1, 0xfc, 0x29, 0xfa, + 0x64, 0xf8, 0x7f, 0xf7, 0x25, 0xf7, 0x51, 0xf7, 0x70, 0xf8, 0x7d, 0xfa, + 0x61, 0xfc, 0xdd, 0xfc, 0x01, 0xfc, 0x19, 0xfb, 0xe8, 0xfa, 0xe5, 0xfa, + 0x80, 0xfa, 0xf9, 0xf9, 0x92, 0xf9, 0x2f, 0xf9, 0xc6, 0xf8, 0x72, 0xf8, + 0x3e, 0xf8, 0x69, 0xf8, 0x90, 0xf9, 0xf7, 0xfb, 0xb2, 0xfe, 0x39, 0x00, + 0x0e, 0x00, 0x20, 0xff, 0x55, 0xfe, 0x8f, 0xfd, 0x7a, 0xfc, 0x56, 0xfb, + 0xb4, 0xfa, 0xee, 0xfa, 0xef, 0xfb, 0x54, 0xfd, 0xaf, 0xfe, 0x98, 0xff, + 0xf5, 0xff, 0x3e, 0x00, 0xd6, 0x00, 0x5e, 0x01, 0x7b, 0x01, 0x97, 0x01, + 0x49, 0x02, 0x74, 0x03, 0x4a, 0x04, 0x54, 0x04, 0x34, 0x04, 0xaa, 0x04, + 0xa1, 0x05, 0xcb, 0x06, 0xfc, 0x07, 0xed, 0x08, 0x72, 0x09, 0x6d, 0x09, + 0x65, 0x08, 0x1e, 0x06, 0x6e, 0x03, 0xc4, 0x01, 0xe6, 0x01, 0x82, 0x03, + 0xc8, 0x05, 0xf7, 0x07, 0x54, 0x09, 0x84, 0x09, 0x08, 0x09, 0x9d, 0x08, + 0x46, 0x08, 0xb3, 0x07, 0x1c, 0x07, 0xdf, 0x06, 0xe3, 0x06, 0x06, 0x07, + 0x7b, 0x07, 0x42, 0x08, 0xd8, 0x08, 0xa0, 0x08, 0x97, 0x07, 0xab, 0x06, + 0xd9, 0x06, 0xd8, 0x07, 0x57, 0x08, 0x86, 0x07, 0xb0, 0x05, 0x87, 0x03, + 0x99, 0x01, 0x58, 0x00, 0x10, 0x00, 0xcc, 0x00, 0x50, 0x02, 0x12, 0x04, + 0x5a, 0x05, 0xc3, 0x05, 0x72, 0x05, 0xbc, 0x04, 0xf9, 0x03, 0x7a, 0x03, + 0x51, 0x03, 0x49, 0x03, 0x22, 0x03, 0xd3, 0x02, 0xbd, 0x02, 0x5f, 0x03, + 0x7e, 0x04, 0x09, 0x05, 0x5d, 0x04, 0x2a, 0x03, 0x63, 0x02, 0xed, 0x01, + 0x3c, 0x01, 0x79, 0x00, 0x2e, 0x00, 0x91, 0x00, 0x91, 0x01, 0x06, 0x03, + 0xa9, 0x04, 0xec, 0x05, 0x36, 0x06, 0x9f, 0x05, 0xf3, 0x04, 0x9d, 0x04, + 0x93, 0x04, 0x20, 0x05, 0x75, 0x06, 0xc8, 0x07, 0x02, 0x08, 0x0f, 0x07, + 0xb4, 0x05, 0x99, 0x04, 0x2a, 0x04, 0xd4, 0x04, 0x8e, 0x06, 0x82, 0x08, + 0xce, 0x09, 0x5a, 0x0a, 0x7b, 0x0a, 0x1e, 0x0a, 0x1e, 0x09, 0x22, 0x08, + 0xf1, 0x07, 0x39, 0x08, 0x22, 0x08, 0xca, 0x07, 0x14, 0x08, 0x22, 0x09, + 0x00, 0x0a, 0xdd, 0x09, 0xf1, 0x08, 0x02, 0x08, 0xce, 0x07, 0xcd, 0x08, + 0xc7, 0x0a, 0xda, 0x0c, 0x58, 0x0e, 0x1e, 0x0f, 0x0f, 0x0f, 0x03, 0x0e, + 0x33, 0x0c, 0x22, 0x0a, 0x3f, 0x08, 0x0f, 0x07, 0x02, 0x07, 0xcf, 0x07, + 0xb4, 0x08, 0x86, 0x09, 0x83, 0x0a, 0x21, 0x0b, 0x4c, 0x0a, 0xf9, 0x07, + 0x7a, 0x05, 0x22, 0x04, 0x40, 0x04, 0x64, 0x05, 0x03, 0x07, 0xbc, 0x08, + 0x43, 0x0a, 0x3d, 0x0b, 0x46, 0x0b, 0x35, 0x0a, 0x6e, 0x08, 0xd7, 0x06, + 0x23, 0x06, 0x3f, 0x06, 0xc3, 0x06, 0x47, 0x07, 0x31, 0x07, 0x56, 0x06, + 0x69, 0x05, 0xf4, 0x04, 0xc3, 0x04, 0x8c, 0x04, 0x39, 0x04, 0xfa, 0x03, + 0x3d, 0x04, 0xe2, 0x04, 0x2a, 0x05, 0xe6, 0x04, 0x66, 0x04, 0x95, 0x03, + 0x8b, 0x02, 0x0b, 0x02, 0x7a, 0x02, 0x74, 0x03, 0xa6, 0x04, 0xe4, 0x05, + 0xb4, 0x06, 0xbe, 0x06, 0x3b, 0x06, 0x6d, 0x05, 0x66, 0x04, 0x92, 0x03, + 0x8e, 0x03, 0x42, 0x04, 0x08, 0x05, 0x9b, 0x05, 0x0a, 0x06, 0x34, 0x06, + 0x09, 0x06, 0xb2, 0x05, 0x2d, 0x05, 0x7e, 0x04, 0x04, 0x04, 0x0a, 0x04, + 0x95, 0x04, 0x77, 0x05, 0x18, 0x06, 0xc2, 0x05, 0x77, 0x04, 0x37, 0x03, + 0x2e, 0x03, 0x79, 0x04, 0x10, 0x06, 0x45, 0x07, 0x56, 0x08, 0x1b, 0x09, + 0xd2, 0x08, 0x95, 0x07, 0x76, 0x06, 0x19, 0x06, 0x38, 0x06, 0x3a, 0x06, + 0xb9, 0x05, 0xe6, 0x04, 0x95, 0x04, 0x74, 0x05, 0x42, 0x07, 0xe7, 0x08, + 0x54, 0x09, 0x60, 0x08, 0xc3, 0x06, 0x29, 0x05, 0xc7, 0x03, 0xfe, 0x02, + 0x33, 0x03, 0xd1, 0x03, 0xdc, 0x03, 0x60, 0x03, 0xea, 0x02, 0x29, 0x02, + 0xe9, 0x00, 0x6b, 0x00, 0xb3, 0x01, 0xbd, 0x03, 0x27, 0x05, 0xf4, 0x05, + 0x4a, 0x06, 0xc3, 0x05, 0x99, 0x04, 0x89, 0x03, 0x9b, 0x02, 0x8e, 0x01, + 0xd6, 0x00, 0x02, 0x01, 0xcb, 0x01, 0x7a, 0x02, 0x96, 0x02, 0xd8, 0x01, + 0x21, 0x00, 0xfa, 0xfd, 0x72, 0xfc, 0xe0, 0xfb, 0xba, 0xfb, 0x19, 0xfc, + 0xc3, 0xfd, 0x3d, 0x00, 0xc9, 0x01, 0xda, 0x01, 0x9c, 0x01, 0xd7, 0x01, + 0x16, 0x02, 0xf8, 0x01, 0xc8, 0x01, 0xc4, 0x01, 0xd5, 0x01, 0xe8, 0x01, + 0xd3, 0x01, 0x33, 0x01, 0xfd, 0xff, 0xd3, 0xfe, 0x45, 0xfe, 0x1b, 0xfe, + 0xc5, 0xfd, 0x52, 0xfd, 0x61, 0xfd, 0x09, 0xfe, 0xa4, 0xfe, 0x17, 0xff, + 0xdc, 0xff, 0x75, 0x00, 0xa8, 0xff, 0x8f, 0xfd, 0xc7, 0xfb, 0x42, 0xfb, + 0x74, 0xfb, 0xe4, 0xfb, 0xf5, 0xfc, 0xc1, 0xfe, 0x59, 0x00, 0xbb, 0x00, + 0xe5, 0xff, 0xac, 0xfe, 0xc7, 0xfd, 0x68, 0xfd, 0xc1, 0xfd, 0xf4, 0xfe, + 0x47, 0x00, 0xb0, 0x00, 0x67, 0x00, 0x3d, 0x00, 0xe8, 0xff, 0xca, 0xfe, + 0x6a, 0xfd, 0x98, 0xfc, 0x46, 0xfc, 0x18, 0xfc, 0xe9, 0xfb, 0x9b, 0xfb, + 0x6f, 0xfb, 0xa6, 0xfb, 0x6a, 0xfb, 0xc6, 0xf9, 0xdd, 0xf7, 0xe3, 0xf7, + 0x09, 0xfa, 0x8d, 0xfc, 0x60, 0xfe, 0xc8, 0xff, 0x05, 0x01, 0xb5, 0x01, + 0x6a, 0x01, 0x48, 0x00, 0xcb, 0xfe, 0x42, 0xfd, 0xe4, 0xfb, 0x13, 0xfb, + 0x0e, 0xfb, 0xc9, 0xfb, 0xce, 0xfc, 0xf9, 0xfc, 0xbb, 0xfb, 0x4a, 0xfa, + 0xae, 0xf9, 0x3f, 0xf9, 0xd0, 0xf8, 0x71, 0xf9, 0x11, 0xfb, 0x90, 0xfc, + 0xd6, 0xfd, 0x1a, 0xff, 0x8c, 0xff, 0xa0, 0xfe, 0x38, 0xfd, 0x6e, 0xfc, + 0x59, 0xfc, 0x6d, 0xfc, 0x6e, 0xfc, 0x91, 0xfc, 0xfa, 0xfc, 0x81, 0xfd, + 0xe3, 0xfd, 0xce, 0xfd, 0x2c, 0xfd, 0x79, 0xfc, 0x3d, 0xfc, 0x3d, 0xfc, + 0xf8, 0xfb, 0xab, 0xfb, 0x07, 0xfc, 0xf9, 0xfc, 0x8c, 0xfd, 0x2a, 0xfd, + 0x3f, 0xfc, 0x5c, 0xfb, 0x69, 0xfa, 0x1d, 0xf9, 0xb3, 0xf7, 0xe1, 0xf6, + 0x3c, 0xf7, 0xb9, 0xf8, 0xae, 0xfa, 0x6e, 0xfc, 0xba, 0xfd, 0x5a, 0xfe, + 0xe9, 0xfd, 0xbb, 0xfc, 0x02, 0xfc, 0x23, 0xfc, 0x47, 0xfc, 0x1b, 0xfc, + 0x42, 0xfc, 0xb3, 0xfc, 0x9a, 0xfc, 0xe3, 0xfb, 0x25, 0xfb, 0x71, 0xfa, + 0x9e, 0xf9, 0x27, 0xf9, 0xb9, 0xf9, 0x43, 0xfb, 0xb0, 0xfc, 0xc4, 0xfc, + 0x6e, 0xfb, 0xca, 0xf9, 0xa1, 0xf8, 0xdf, 0xf7, 0x66, 0xf7, 0x7e, 0xf7, + 0x81, 0xf8, 0x83, 0xfa, 0xe2, 0xfc, 0x65, 0xfe, 0x22, 0xfe, 0x43, 0xfc, + 0xe9, 0xf9, 0x42, 0xf8, 0x87, 0xf7, 0x5f, 0xf7, 0x0d, 0xf8, 0xe1, 0xf9, + 0x2e, 0xfc, 0x0d, 0xfe, 0x2e, 0xff, 0x3d, 0xff, 0xe5, 0xfd, 0xa6, 0xfb, + 0x8e, 0xf9, 0x3d, 0xf8, 0xb9, 0xf7, 0x05, 0xf8, 0x3c, 0xf9, 0xe0, 0xfa, + 0xc1, 0xfb, 0x61, 0xfb, 0x7a, 0xfa, 0xce, 0xf9, 0xa5, 0xf9, 0x36, 0xfa, + 0x4d, 0xfb, 0x47, 0xfc, 0xff, 0xfc, 0xbd, 0xfd, 0x75, 0xfe, 0xf9, 0xfe, + 0x4f, 0xff, 0x38, 0xff, 0x5b, 0xfe, 0x2d, 0xfd, 0xd0, 0xfc, 0xa4, 0xfd, + 0xb0, 0xfe, 0xbf, 0xfe, 0xbd, 0xfd, 0x99, 0xfc, 0xfd, 0xfb, 0x86, 0xfb, + 0xb1, 0xfa, 0xec, 0xf9, 0xf0, 0xf9, 0x77, 0xfa, 0xcd, 0xfa, 0x16, 0xfb, + 0xf7, 0xfb, 0x66, 0xfd, 0xe9, 0xfe, 0x66, 0x00, 0xc5, 0x01, 0x38, 0x02, + 0xe9, 0x00, 0x32, 0xfe, 0x78, 0xfb, 0xde, 0xf9, 0x8a, 0xf9, 0x09, 0xfa, + 0x33, 0xfb, 0x0d, 0xfd, 0xdd, 0xfe, 0x7e, 0xff, 0xe5, 0xfe, 0x17, 0xfe, + 0x9e, 0xfd, 0x42, 0xfd, 0xc2, 0xfc, 0x0c, 0xfc, 0x57, 0xfb, 0x32, 0xfb, + 0xbd, 0xfb, 0x49, 0xfc, 0x5d, 0xfc, 0x58, 0xfc, 0xac, 0xfc, 0x12, 0xfd, + 0xf8, 0xfc, 0x61, 0xfc, 0xd8, 0xfb, 0x99, 0xfb, 0x64, 0xfb, 0x3b, 0xfb, + 0xa1, 0xfb, 0xa3, 0xfc, 0x93, 0xfd, 0x1a, 0xfe, 0x8f, 0xfe, 0x1c, 0xff, + 0x85, 0xff, 0xa0, 0xff, 0x6a, 0xff, 0xf0, 0xfe, 0x2e, 0xfe, 0xf9, 0xfc, + 0xa7, 0xfb, 0x4e, 0xfb, 0x31, 0xfc, 0xe6, 0xfc, 0x59, 0xfc, 0x62, 0xfb, + 0x4f, 0xfb, 0x3c, 0xfc, 0x7d, 0xfd, 0xaa, 0xfe, 0x80, 0xff, 0x92, 0xff, + 0xe6, 0xfe, 0x51, 0xfe, 0x70, 0xfe, 0x0b, 0xff, 0xe4, 0xff, 0xfe, 0x00, + 0xff, 0x01, 0x98, 0x02, 0xf5, 0x02, 0xf0, 0x02, 0x0f, 0x02, 0xd5, 0x00, + 0x74, 0x00, 0x2a, 0x01, 0x39, 0x02, 0x0e, 0x03, 0x76, 0x03, 0x46, 0x03, + 0x9d, 0x02, 0xf6, 0x01, 0x83, 0x01, 0xf3, 0x00, 0x1c, 0x00, 0x84, 0xff, + 0xd2, 0xff, 0xc1, 0x00, 0x75, 0x01, 0xbf, 0x01, 0xff, 0x01, 0x29, 0x02, + 0x07, 0x02, 0xe5, 0x01, 0x26, 0x02, 0xd5, 0x02, 0xe8, 0x03, 0x0b, 0x05, + 0x7e, 0x05, 0x1f, 0x05, 0xbd, 0x04, 0xb9, 0x04, 0x56, 0x04, 0x11, 0x03, + 0x69, 0x01, 0xe7, 0xff, 0xa0, 0xfe, 0xfb, 0xfd, 0x87, 0xfe, 0xec, 0xff, + 0x2d, 0x01, 0xd2, 0x01, 0xe1, 0x01, 0x54, 0x01, 0x68, 0x00, 0xd2, 0xff, + 0xf9, 0xff, 0x55, 0x00, 0x54, 0x00, 0x5d, 0x00, 0x10, 0x01, 0xff, 0x01, + 0x47, 0x02, 0xd2, 0x01, 0x1f, 0x01, 0x76, 0x00, 0x08, 0x00, 0xd9, 0xff, + 0x5e, 0xff, 0x5a, 0xfe, 0xbf, 0xfd, 0x2c, 0xfe, 0x9a, 0xfe, 0x35, 0xfe, + 0xf7, 0xfd, 0xb5, 0xfe, 0x8f, 0xff, 0xcc, 0xff, 0x11, 0x00, 0xc8, 0x00, + 0x39, 0x01, 0xc6, 0x00, 0xc6, 0xff, 0xfa, 0xfe, 0xc3, 0xfe, 0x26, 0xff, + 0x0e, 0x00, 0x0d, 0x01, 0x66, 0x01, 0xfb, 0x00, 0x4f, 0x00, 0xa4, 0xff, + 0x25, 0xff, 0x4e, 0xff, 0x39, 0x00, 0x74, 0x01, 0x99, 0x02, 0x2c, 0x03, + 0xcd, 0x02, 0xea, 0x01, 0x13, 0x01, 0x4b, 0x00, 0xf0, 0xff, 0xa9, 0x00, + 0x13, 0x02, 0x2d, 0x03, 0xad, 0x03, 0x8f, 0x03, 0x90, 0x02, 0x0b, 0x01, + 0x12, 0x00, 0x2e, 0x00, 0xeb, 0x00, 0xb6, 0x01, 0x9d, 0x02, 0xf3, 0x03, + 0x5d, 0x05, 0xe1, 0x05, 0x3a, 0x05, 0x3b, 0x04, 0x9d, 0x03, 0x36, 0x03, + 0xbb, 0x02, 0x80, 0x02, 0xf4, 0x02, 0x96, 0x03, 0x45, 0x03, 0xdf, 0x01, + 0x90, 0x00, 0x2f, 0x00, 0x61, 0x00, 0x9e, 0x00, 0x0a, 0x01, 0x1d, 0x02, + 0xab, 0x03, 0x88, 0x04, 0xf1, 0x03, 0xb0, 0x02, 0x89, 0x01, 0xf1, 0xff, + 0xeb, 0xfd, 0x0f, 0xfd, 0x1e, 0xfe, 0xbb, 0xff, 0x94, 0x00, 0xee, 0x00, + 0x73, 0x01, 0xcf, 0x01, 0x52, 0x01, 0x38, 0x00, 0x4b, 0xff, 0x8a, 0xfe, + 0x91, 0xfd, 0xe7, 0xfc, 0x4b, 0xfd, 0x39, 0xfe, 0x98, 0xfe, 0x4f, 0xfe, + 0x11, 0xfe, 0x25, 0xfe, 0x54, 0xfe, 0x7c, 0xfe, 0xac, 0xfe, 0xe8, 0xfe, + 0x34, 0xff, 0x4b, 0xff, 0x9b, 0xfe, 0x18, 0xfd, 0x9c, 0xfb, 0xc6, 0xfa, + 0x68, 0xfa, 0x79, 0xfa, 0x70, 0xfb, 0x6a, 0xfd, 0xa9, 0xff, 0x36, 0x01, + 0xac, 0x01, 0x47, 0x01, 0x41, 0x00, 0xc1, 0xfe, 0x50, 0xfd, 0x88, 0xfc, + 0x57, 0xfc, 0x53, 0xfc, 0x8d, 0xfc, 0x73, 0xfd, 0xef, 0xfe, 0x23, 0x00, + 0x16, 0x00, 0x9f, 0xfe, 0x83, 0xfc, 0xb7, 0xfa, 0xe2, 0xf9, 0x56, 0xfa, + 0xf8, 0xfb, 0x3c, 0xfe, 0x6e, 0x00, 0xda, 0x01, 0xee, 0x01, 0xb3, 0x00, + 0x00, 0xff, 0xe1, 0xfd, 0xf0, 0xfd, 0x05, 0xff, 0x2d, 0x00, 0x6c, 0x00, + 0xda, 0xff, 0x32, 0xff, 0xb4, 0xfe, 0x52, 0xfe, 0x2b, 0xfe, 0x34, 0xfe, + 0x5a, 0xfe, 0xf2, 0xfe, 0x15, 0x00, 0x39, 0x01, 0x08, 0x02, 0x72, 0x02, + 0xeb, 0x01, 0xeb, 0xff, 0x07, 0xfd, 0x98, 0xfa, 0xba, 0xf9, 0xeb, 0xfa, + 0xc0, 0xfd, 0xba, 0x00, 0x55, 0x02, 0x5f, 0x02, 0x9c, 0x01, 0x9e, 0x00, + 0x71, 0xff, 0x14, 0xfe, 0xd7, 0xfc, 0x3e, 0xfc, 0x58, 0xfc, 0xae, 0xfc, + 0x13, 0xfd, 0xb2, 0xfd, 0x3f, 0xfe, 0x2f, 0xfe, 0xa9, 0xfd, 0x51, 0xfd, + 0x9b, 0xfd, 0x91, 0xfe, 0xb9, 0xff, 0x66, 0x00, 0x55, 0x00, 0x9b, 0xff, + 0x3e, 0xfe, 0x70, 0xfc, 0xe0, 0xfa, 0x4c, 0xfa, 0xf6, 0xfa, 0x77, 0xfc, + 0x02, 0xfe, 0x0f, 0xff, 0xb8, 0xff, 0x4b, 0x00, 0xdd, 0x00, 0x57, 0x01, + 0x85, 0x01, 0x23, 0x01, 0x48, 0x00, 0x75, 0xff, 0xfa, 0xfe, 0xc5, 0xfe, + 0xd3, 0xfe, 0x34, 0xff, 0x97, 0xff, 0x8b, 0xff, 0x14, 0xff, 0x91, 0xfe, + 0x53, 0xfe, 0xa8, 0xfe, 0xb6, 0xff, 0xf5, 0x00, 0xa2, 0x01, 0xc4, 0x01, + 0xee, 0x01, 0x23, 0x02, 0xe9, 0x01, 0x2b, 0x01, 0x53, 0x00, 0xcc, 0xff, + 0xab, 0xff, 0xb0, 0xff, 0xb5, 0xff, 0x04, 0x00, 0xdb, 0x00, 0xec, 0x01, + 0x9d, 0x02, 0xa6, 0x02, 0x49, 0x02, 0xfc, 0x01, 0xf1, 0x01, 0x27, 0x02, + 0xec, 0x02, 0x8f, 0x04, 0x89, 0x06, 0xbd, 0x07, 0x7e, 0x07, 0xe6, 0x05, + 0x9f, 0x03, 0x7d, 0x01, 0x04, 0x00, 0x4a, 0xff, 0x58, 0xff, 0x56, 0x00, + 0x2b, 0x02, 0x4f, 0x04, 0x1b, 0x06, 0xe1, 0x06, 0x31, 0x06, 0x96, 0x04, + 0x48, 0x03, 0xb5, 0x02, 0x4b, 0x02, 0xce, 0x01, 0x93, 0x01, 0xb3, 0x01, + 0xe6, 0x01, 0xd3, 0x01, 0x48, 0x01, 0xa4, 0x00, 0x86, 0x00, 0xe4, 0x00, + 0x3d, 0x01, 0x7a, 0x01, 0xca, 0x01, 0x30, 0x02, 0x98, 0x02, 0xe0, 0x02, + 0xd6, 0x02, 0x49, 0x02, 0x11, 0x01, 0x75, 0xff, 0x50, 0xfe, 0x1b, 0xfe, + 0x52, 0xfe, 0x95, 0xfe, 0x55, 0xff, 0xa9, 0x00, 0xae, 0x01, 0x96, 0x01, + 0x8f, 0x00, 0x68, 0xff, 0xd5, 0xfe, 0x09, 0xff, 0xe2, 0xff, 0x35, 0x01, + 0xc7, 0x02, 0x22, 0x04, 0xda, 0x04, 0xbf, 0x04, 0xe5, 0x03, 0xb3, 0x02, + 0xaf, 0x01, 0xf9, 0x00, 0x44, 0x00, 0x8d, 0xff, 0x70, 0xff, 0x5f, 0x00, + 0xdd, 0x01, 0x10, 0x03, 0xa2, 0x03, 0x9e, 0x03, 0x08, 0x03, 0x45, 0x02, + 0x06, 0x02, 0x5f, 0x02, 0xdc, 0x02, 0x61, 0x03, 0xd9, 0x03, 0x7c, 0x03, + 0xc8, 0x01, 0xdc, 0xff, 0x81, 0xff, 0x08, 0x01, 0x3e, 0x03, 0x19, 0x05, + 0x52, 0x06, 0xca, 0x06, 0x74, 0x06, 0xba, 0x05, 0x19, 0x05, 0xa1, 0x04, + 0x5f, 0x04, 0xb0, 0x04, 0x83, 0x05, 0x1c, 0x06, 0x36, 0x06, 0x78, 0x06, + 0x1c, 0x07, 0x33, 0x07, 0x00, 0x06, 0x0f, 0x04, 0x69, 0x02, 0x7c, 0x01, + 0x39, 0x01, 0x9e, 0x01, 0xb7, 0x02, 0x22, 0x04, 0x1d, 0x05, 0x3e, 0x05, + 0xdd, 0x04, 0x79, 0x04, 0x2d, 0x04, 0xcf, 0x03, 0x30, 0x03, 0x5f, 0x02, + 0xa1, 0x01, 0x18, 0x01, 0xb4, 0x00, 0x8a, 0x00, 0xad, 0x00, 0xe5, 0x00, + 0xf8, 0x00, 0x03, 0x01, 0x3b, 0x01, 0xb7, 0x01, 0x77, 0x02, 0x67, 0x03, + 0x09, 0x04, 0x7e, 0x03, 0x82, 0x01, 0x49, 0xff, 0x57, 0xfe, 0xb5, 0xfe, + 0x51, 0xff, 0x92, 0xff, 0x9b, 0xff, 0xa0, 0xff, 0xbc, 0xff, 0xee, 0xff, + 0xf7, 0xff, 0xbb, 0xff, 0x8b, 0xff, 0xd2, 0xff, 0x93, 0x00, 0x6e, 0x01, + 0x10, 0x02, 0x8d, 0x02, 0x01, 0x03, 0x15, 0x03, 0x7e, 0x02, 0x88, 0x01, + 0xa6, 0x00, 0x02, 0x00, 0xb9, 0xff, 0xdb, 0xff, 0x30, 0x00, 0x53, 0x00, + 0x1d, 0x00, 0xd3, 0xff, 0xcc, 0xff, 0xe3, 0xff, 0xc2, 0xff, 0x8a, 0xff, + 0x72, 0xff, 0x3d, 0xff, 0xb1, 0xfe, 0x1d, 0xfe, 0xea, 0xfd, 0x26, 0xfe, + 0xc3, 0xfe, 0xaf, 0xff, 0xa4, 0x00, 0x45, 0x01, 0x96, 0x01, 0x07, 0x02, + 0xe5, 0x02, 0xe3, 0x03, 0x5e, 0x04, 0x0b, 0x04, 0x3e, 0x03, 0x88, 0x02, + 0x1a, 0x02, 0x97, 0x01, 0xb9, 0x00, 0xf7, 0xff, 0x0b, 0x00, 0xf9, 0x00, + 0x0d, 0x02, 0xe5, 0x02, 0xdd, 0x03, 0xed, 0x04, 0x1d, 0x05, 0x02, 0x04, + 0x82, 0x02, 0x7d, 0x01, 0x05, 0x01, 0xfe, 0x00, 0x4a, 0x01, 0x93, 0x01, + 0xb6, 0x01, 0x04, 0x02, 0x97, 0x02, 0x03, 0x03, 0xf7, 0x02, 0xb5, 0x02, + 0xab, 0x02, 0xee, 0x02, 0x51, 0x03, 0x9c, 0x03, 0x97, 0x03, 0x1f, 0x03, + 0x43, 0x02, 0x39, 0x01, 0x2e, 0x00, 0x6b, 0xff, 0x49, 0xff, 0xb2, 0xff, + 0x1b, 0x00, 0x13, 0x00, 0xb5, 0xff, 0x79, 0xff, 0xb3, 0xff, 0x3a, 0x00, + 0xac, 0x00, 0xcb, 0x00, 0x86, 0x00, 0xfc, 0xff, 0x53, 0xff, 0x84, 0xfe, + 0x9b, 0xfd, 0x1f, 0xfd, 0xc3, 0xfd, 0xac, 0xff, 0x18, 0x02, 0xd1, 0x03, + 0xf5, 0x03, 0x76, 0x02, 0x45, 0x00, 0xd8, 0xfe, 0x04, 0xff, 0x5f, 0x00, + 0xd5, 0x01, 0x82, 0x02, 0x23, 0x02, 0xd8, 0x00, 0xd1, 0xfe, 0xc7, 0xfc, + 0x00, 0xfc, 0x0e, 0xfd, 0x29, 0xff, 0x35, 0x01, 0x9b, 0x02, 0x5e, 0x03, + 0xe9, 0x03, 0x3e, 0x04, 0x9b, 0x03, 0xad, 0x01, 0x65, 0xff, 0x15, 0xfe, + 0x73, 0xfe, 0x7e, 0x00, 0x7c, 0x03, 0x1e, 0x06, 0x24, 0x07, 0x39, 0x06, + 0x29, 0x04, 0x5b, 0x02, 0x15, 0x02, 0x9d, 0x03, 0xd1, 0x05, 0x48, 0x07, + 0xae, 0x07, 0x67, 0x07, 0xa5, 0x06, 0x9d, 0x05, 0xe5, 0x04, 0x45, 0x05, + 0x0d, 0x07, 0xac, 0x09, 0x1d, 0x0c, 0x67, 0x0d, 0xfa, 0x0c, 0x77, 0x0b, + 0x88, 0x0a, 0x29, 0x0b, 0x25, 0x0d, 0xf0, 0x0f, 0xb2, 0x12, 0x2e, 0x14, + 0x97, 0x13, 0xed, 0x10, 0xb5, 0x0c, 0xcc, 0x07, 0xf8, 0x02, 0x5a, 0xfe, + 0x05, 0xfa, 0xd4, 0xf6, 0x75, 0xf5, 0x3f, 0xf5, 0x4e, 0xf5, 0x00, 0xf6, + 0x03, 0xf8, 0xaf, 0xfa, 0x13, 0xfc, 0x79, 0xfa, 0xae, 0xf5, 0xeb, 0xee, + 0x07, 0xe8, 0xcd, 0xe2, 0x3f, 0xe0, 0x32, 0xe0, 0xaf, 0xe1, 0xb7, 0xe3, + 0xbb, 0xe5, 0x79, 0xe7, 0x53, 0xe8, 0x61, 0xe7, 0xde, 0xe4, 0xc7, 0xe2, + 0x1d, 0xe3, 0x48, 0xe6, 0x1c, 0xeb, 0x5e, 0xef, 0x9c, 0xf1, 0x97, 0xf2, + 0xd7, 0xf1, 0xea, 0xeb, 0x91, 0xe0, 0xea, 0xd4, 0xe6, 0xcc, 0xc3, 0xca, + 0x63, 0xd2, 0xef, 0xe2, 0x2f, 0xf3, 0xe9, 0xfc, 0xe9, 0x03, 0xff, 0x0a, + 0x6b, 0x0b, 0x10, 0xff, 0xad, 0xeb, 0x9d, 0xdc, 0x7a, 0xd8, 0x93, 0xe1, + 0xf1, 0xf6, 0x26, 0x10, 0x85, 0x20, 0xea, 0x21, 0xac, 0x17, 0x65, 0x07, + 0xc1, 0xf4, 0x4a, 0xe5, 0x5d, 0xe1, 0xb1, 0xeb, 0xab, 0xfc, 0x9e, 0x0b, + 0xa9, 0x16, 0x83, 0x1c, 0xf7, 0x18, 0xa3, 0x0d, 0x05, 0x03, 0x6a, 0xfd, + 0x16, 0xfc, 0x36, 0x01, 0x3e, 0x0e, 0x7b, 0x1c, 0x33, 0x23, 0xd0, 0x21, + 0x55, 0x1d, 0xe8, 0x16, 0x15, 0x0c, 0xa2, 0xff, 0x07, 0xfa, 0xf0, 0xff, + 0x75, 0x0e, 0x5b, 0x20, 0x35, 0x31, 0x96, 0x3a, 0x23, 0x35, 0xe1, 0x21, + 0x2a, 0x0c, 0x88, 0xfc, 0x39, 0xf2, 0x95, 0xed, 0x2c, 0xf3, 0x5c, 0x00, + 0x54, 0x0b, 0x7b, 0x11, 0x6e, 0x17, 0x07, 0x1a, 0x27, 0x10, 0x4f, 0xfc, + 0x0c, 0xec, 0xe2, 0xe6, 0x3c, 0xeb, 0x1e, 0xf7, 0x3d, 0x07, 0xf6, 0x12, + 0x74, 0x13, 0x37, 0x0b, 0x4a, 0x01, 0x28, 0xf9, 0x85, 0xf3, 0xec, 0xf2, + 0x04, 0xf9, 0x39, 0x00, 0x5c, 0x00, 0x23, 0xfa, 0xea, 0xf3, 0xed, 0xec, + 0xaf, 0xe1, 0x21, 0xd8, 0x23, 0xd8, 0x1c, 0xdf, 0x13, 0xe7, 0xe8, 0xf0, + 0xa0, 0xfd, 0xa2, 0x05, 0x89, 0x00, 0x91, 0xf1, 0x4e, 0xe3, 0x90, 0xdb, + 0x88, 0xdb, 0xa0, 0xe3, 0xd2, 0xef, 0xff, 0xf8, 0x52, 0xfd, 0xc5, 0xff, + 0x4c, 0x00, 0xb4, 0xfb, 0x91, 0xf3, 0x6f, 0xf0, 0xd8, 0xf7, 0x24, 0x03, + 0xc1, 0x06, 0xf6, 0x00, 0xa6, 0xf9, 0x19, 0xf6, 0x5f, 0xf6, 0x10, 0xfb, + 0x12, 0x03, 0x46, 0x08, 0xeb, 0x06, 0x80, 0x02, 0x43, 0xff, 0x38, 0xfe, + 0xc0, 0x00, 0x56, 0x08, 0xc4, 0x11, 0x8b, 0x16, 0x2d, 0x14, 0x82, 0x0e, + 0x06, 0x0b, 0x4e, 0x0c, 0xe8, 0x11, 0x62, 0x1a, 0x0b, 0x23, 0x16, 0x27, + 0x6e, 0x24, 0xb3, 0x1f, 0xc0, 0x1c, 0x53, 0x18, 0xcf, 0x0f, 0x51, 0x08, + 0x1c, 0x08, 0xb6, 0x0e, 0x38, 0x17, 0x1d, 0x1e, 0xe9, 0x20, 0x7e, 0x1c, + 0x93, 0x11, 0xe0, 0x06, 0x2a, 0x02, 0x44, 0x03, 0xb4, 0x07, 0x54, 0x0e, + 0xd6, 0x15, 0x8b, 0x1a, 0xbc, 0x18, 0x82, 0x11, 0xea, 0x09, 0x2b, 0x05, + 0x71, 0x03, 0x5b, 0x04, 0x99, 0x06, 0x4f, 0x08, 0x19, 0x0a, 0x36, 0x0d, + 0xd0, 0x0e, 0x3f, 0x0b, 0x3a, 0x04, 0xa4, 0xfd, 0xe5, 0xf7, 0x76, 0xf2, + 0xa7, 0xef, 0x6d, 0xf2, 0x51, 0xfa, 0x85, 0x02, 0x83, 0x05, 0x7c, 0x01, + 0x14, 0xf8, 0x43, 0xec, 0xc5, 0xe2, 0xc7, 0xe0, 0x98, 0xe7, 0x3d, 0xf3, + 0xd9, 0xfd, 0x70, 0x03, 0xa7, 0x02, 0x16, 0xfc, 0xaf, 0xf2, 0x43, 0xeb, + 0x39, 0xe9, 0x22, 0xec, 0x77, 0xf1, 0xaf, 0xf7, 0xfd, 0xfd, 0x50, 0x02, + 0x2a, 0x02, 0x3a, 0xfd, 0xb8, 0xf5, 0xf2, 0xee, 0x5d, 0xeb, 0x31, 0xeb, + 0x58, 0xed, 0x6d, 0xf1, 0x7f, 0xf7, 0x70, 0xfe, 0xcc, 0x03, 0x7a, 0x05, + 0xa5, 0x03, 0x38, 0x00, 0xa6, 0xfc, 0xbf, 0xf9, 0x3d, 0xf9, 0xe0, 0xfc, + 0xbe, 0x03, 0x60, 0x0a, 0xd7, 0x0d, 0xd3, 0x0d, 0x14, 0x0c, 0x3d, 0x0a, + 0x77, 0x08, 0xf0, 0x06, 0x24, 0x07, 0xe4, 0x09, 0xe1, 0x0d, 0x59, 0x11, + 0x13, 0x13, 0x27, 0x12, 0xec, 0x0e, 0x52, 0x0b, 0xf6, 0x08, 0xf2, 0x07, + 0x11, 0x08, 0xb6, 0x09, 0x78, 0x0c, 0x8f, 0x0e, 0xf6, 0x0e, 0x69, 0x0e, + 0x9d, 0x0d, 0x7c, 0x0c, 0xfe, 0x0a, 0xfc, 0x08, 0x4b, 0x06, 0x4b, 0x04, + 0x47, 0x05, 0x40, 0x09, 0xb4, 0x0d, 0x9e, 0x10, 0x3f, 0x11, 0x07, 0x0f, + 0x11, 0x0a, 0xbc, 0x03, 0x0e, 0xfe, 0xed, 0xfa, 0xf7, 0xfa, 0xed, 0xfc, + 0x33, 0xff, 0x15, 0x01, 0xe1, 0x01, 0xa1, 0x00, 0x6a, 0xfd, 0x80, 0xf9, + 0x09, 0xf6, 0xdc, 0xf3, 0xc8, 0xf3, 0x6d, 0xf5, 0xa1, 0xf6, 0xc0, 0xf5, + 0xf0, 0xf3, 0xa2, 0xf3, 0x4c, 0xf5, 0x09, 0xf7, 0x24, 0xf7, 0x80, 0xf5, + 0xf2, 0xf2, 0xe7, 0xf0, 0xe0, 0xf0, 0xb6, 0xf2, 0x4e, 0xf4, 0xe3, 0xf3, + 0xd4, 0xf1, 0xf8, 0xef, 0xa6, 0xef, 0xb3, 0xf0, 0x11, 0xf2, 0xb5, 0xf2, + 0x4a, 0xf2, 0xa5, 0xf1, 0xd5, 0xf1, 0x77, 0xf2, 0x51, 0xf2, 0x86, 0xf1, + 0x88, 0xf1, 0xec, 0xf2, 0x81, 0xf4, 0xee, 0xf4, 0x89, 0xf4, 0xee, 0xf4, + 0xbb, 0xf6, 0xc8, 0xf8, 0x35, 0xfa, 0x94, 0xfb, 0x57, 0xfd, 0x01, 0xff, + 0x43, 0x00, 0x1b, 0x01, 0x28, 0x01, 0x4b, 0x00, 0x39, 0xff, 0x94, 0xfe, + 0x62, 0xfe, 0xde, 0xfe, 0x88, 0x00, 0xf2, 0x02, 0xab, 0x04, 0xb3, 0x04, + 0x08, 0x03, 0x3c, 0x00, 0xaa, 0xfd, 0x2b, 0xfd, 0x68, 0xff, 0x4a, 0x03, + 0x29, 0x07, 0xc7, 0x09, 0x6a, 0x0a, 0x3b, 0x09, 0x4f, 0x07, 0xa7, 0x05, + 0x67, 0x04, 0x39, 0x03, 0x1e, 0x02, 0xd1, 0x01, 0x57, 0x03, 0xbe, 0x06, + 0xa2, 0x0a, 0x1e, 0x0d, 0xd3, 0x0c, 0x79, 0x09, 0x66, 0x04, 0x2e, 0x00, + 0x97, 0xfe, 0x21, 0xff, 0x34, 0x00, 0x1f, 0x01, 0xdd, 0x01, 0xd2, 0x01, + 0x56, 0x00, 0xf9, 0xfd, 0xe4, 0xfb, 0x6c, 0xfa, 0x30, 0xf9, 0x20, 0xf8, + 0x99, 0xf7, 0xca, 0xf7, 0x86, 0xf8, 0x5f, 0xf9, 0xd2, 0xf9, 0x9d, 0xf9, + 0xc5, 0xf8, 0x56, 0xf7, 0x92, 0xf5, 0x44, 0xf4, 0x48, 0xf4, 0x8e, 0xf5, + 0xf1, 0xf6, 0x65, 0xf7, 0xe6, 0xf6, 0xba, 0xf5, 0x9b, 0xf3, 0x6f, 0xf0, + 0x3d, 0xed, 0x87, 0xeb, 0xdb, 0xeb, 0xa2, 0xed, 0x29, 0xf0, 0x1e, 0xf3, + 0xfa, 0xf5, 0xa3, 0xf7, 0x2b, 0xf7, 0xb1, 0xf4, 0x47, 0xf1, 0x58, 0xee, + 0x28, 0xed, 0x47, 0xee, 0x40, 0xf1, 0x0d, 0xf5, 0xb5, 0xf8, 0x69, 0xfb, + 0x7f, 0xfc, 0xd0, 0xfb, 0xf4, 0xf9, 0xe1, 0xf7, 0x4f, 0xf6, 0xa7, 0xf5, + 0x38, 0xf6, 0x11, 0xf8, 0xd1, 0xfa, 0xdf, 0xfd, 0x8a, 0x00, 0x04, 0x02, + 0xb2, 0x01, 0xcf, 0xff, 0x7e, 0xfd, 0x1d, 0xfc, 0x77, 0xfc, 0x87, 0xfe, + 0xb7, 0x01, 0xff, 0x04, 0x07, 0x07, 0xf3, 0x06, 0x33, 0x05, 0xfe, 0x02, + 0x62, 0x01, 0x32, 0x01, 0x02, 0x03, 0x7d, 0x06, 0x4f, 0x0a, 0x13, 0x0d, + 0x01, 0x0e, 0xfc, 0x0c, 0x72, 0x0a, 0x3b, 0x07, 0x73, 0x04, 0x0c, 0x03, + 0x36, 0x03, 0x74, 0x04, 0x56, 0x06, 0x72, 0x08, 0xdc, 0x09, 0xb3, 0x09, + 0x37, 0x08, 0x7d, 0x06, 0x1c, 0x05, 0xd1, 0x03, 0x56, 0x02, 0x0e, 0x01, + 0xa6, 0x00, 0x42, 0x01, 0x4d, 0x02, 0x09, 0x03, 0x21, 0x03, 0xa6, 0x02, + 0xca, 0x01, 0xa0, 0x00, 0x3e, 0xff, 0x07, 0xfe, 0x8c, 0xfd, 0xe2, 0xfd, + 0x85, 0xfe, 0xec, 0xfe, 0xf2, 0xfe, 0x8c, 0xfe, 0x8e, 0xfd, 0x04, 0xfc, + 0x8b, 0xfa, 0xd1, 0xf9, 0xd2, 0xf9, 0x1a, 0xfa, 0x7f, 0xfa, 0xf0, 0xfa, + 0x0a, 0xfb, 0x83, 0xfa, 0xa7, 0xf9, 0xef, 0xf8, 0x7d, 0xf8, 0x2c, 0xf8, + 0xde, 0xf7, 0xa2, 0xf7, 0xb7, 0xf7, 0x46, 0xf8, 0x3f, 0xf9, 0x6b, 0xfa, + 0x5e, 0xfb, 0xbc, 0xfb, 0xbc, 0xfb, 0xe7, 0xfb, 0x49, 0xfc, 0x96, 0xfc, + 0xcd, 0xfc, 0x0e, 0xfd, 0x35, 0xfd, 0x36, 0xfd, 0x52, 0xfd, 0xb5, 0xfd, + 0x51, 0xfe, 0x10, 0xff, 0xcf, 0xff, 0x5e, 0x00, 0xaf, 0x00, 0xdf, 0x00, + 0x10, 0x01, 0x55, 0x01, 0xa6, 0x01, 0xf2, 0x01, 0x4c, 0x02, 0xf2, 0x02, + 0x00, 0x04, 0x27, 0x05, 0xe3, 0x05, 0xef, 0x05, 0x91, 0x05, 0x66, 0x05, + 0xcc, 0x05, 0x9f, 0x06, 0x8b, 0x07, 0x75, 0x08, 0x4b, 0x09, 0xb1, 0x09, + 0x5f, 0x09, 0xb1, 0x08, 0x46, 0x08, 0x4c, 0x08, 0x94, 0x08, 0x08, 0x09, + 0x93, 0x09, 0x09, 0x0a, 0x46, 0x0a, 0x1a, 0x0a, 0x48, 0x09, 0xee, 0x07, + 0x92, 0x06, 0xa7, 0x05, 0x5b, 0x05, 0xbf, 0x05, 0xad, 0x06, 0xbc, 0x07, + 0x96, 0x08, 0xfd, 0x08, 0xb4, 0x08, 0xd1, 0x07, 0xba, 0x06, 0x99, 0x05, + 0x66, 0x04, 0x71, 0x03, 0x15, 0x03, 0x3b, 0x03, 0x8a, 0x03, 0xc2, 0x03, + 0xae, 0x03, 0x3d, 0x03, 0xad, 0x02, 0x30, 0x02, 0xa5, 0x01, 0xde, 0x00, + 0x1b, 0x00, 0xe4, 0xff, 0x61, 0x00, 0x05, 0x01, 0x25, 0x01, 0x9a, 0x00, + 0xb0, 0xff, 0xd7, 0xfe, 0x63, 0xfe, 0x72, 0xfe, 0xf4, 0xfe, 0xb7, 0xff, + 0x56, 0x00, 0x78, 0x00, 0x31, 0x00, 0xca, 0xff, 0x2c, 0xff, 0x1c, 0xfe, + 0xe1, 0xfc, 0x34, 0xfc, 0x99, 0xfc, 0xfb, 0xfd, 0xbd, 0xff, 0x2c, 0x01, + 0xd4, 0x01, 0x77, 0x01, 0x05, 0x00, 0xf4, 0xfd, 0x51, 0xfc, 0x18, 0xfc, + 0x6c, 0xfd, 0x85, 0xff, 0x65, 0x01, 0x89, 0x02, 0xf8, 0x02, 0xf3, 0x02, + 0xc6, 0x02, 0x96, 0x02, 0x42, 0x02, 0xd5, 0x01, 0xde, 0x01, 0xcf, 0x02, + 0x58, 0x04, 0xf5, 0x05, 0x6b, 0x07, 0x69, 0x08, 0x80, 0x08, 0xba, 0x07, + 0xbd, 0x06, 0x40, 0x06, 0x92, 0x06, 0x8f, 0x07, 0xd8, 0x08, 0xf5, 0x09, + 0x6d, 0x0a, 0x09, 0x0a, 0x17, 0x09, 0x32, 0x08, 0xd1, 0x07, 0x0a, 0x08, + 0xc7, 0x08, 0xe3, 0x09, 0x02, 0x0b, 0xc1, 0x0b, 0xff, 0x0b, 0xd9, 0x0b, + 0x5c, 0x0b, 0x73, 0x0a, 0x56, 0x09, 0x9f, 0x08, 0xad, 0x08, 0x53, 0x09, + 0x45, 0x0a, 0x42, 0x0b, 0xd2, 0x0b, 0x7e, 0x0b, 0x5d, 0x0a, 0x20, 0x09, + 0x5d, 0x08, 0x1f, 0x08, 0x13, 0x08, 0xd3, 0x07, 0x3f, 0x07, 0x8f, 0x06, + 0x16, 0x06, 0x16, 0x06, 0x8e, 0x06, 0x07, 0x07, 0xe9, 0x06, 0x06, 0x06, + 0xb8, 0x04, 0x78, 0x03, 0x83, 0x02, 0xef, 0x01, 0xdf, 0x01, 0x42, 0x02, + 0xab, 0x02, 0xc5, 0x02, 0x8d, 0x02, 0x13, 0x02, 0x47, 0x01, 0x4c, 0x00, + 0xa5, 0xff, 0x8f, 0xff, 0x99, 0xff, 0x36, 0xff, 0x5f, 0xfe, 0x8f, 0xfd, + 0x4c, 0xfd, 0x98, 0xfd, 0xee, 0xfd, 0xd4, 0xfd, 0x52, 0xfd, 0xd6, 0xfc, + 0xb4, 0xfc, 0xdf, 0xfc, 0x13, 0xfd, 0x24, 0xfd, 0x1b, 0xfd, 0x0f, 0xfd, + 0x08, 0xfd, 0x19, 0xfd, 0x4f, 0xfd, 0x92, 0xfd, 0xea, 0xfd, 0x7c, 0xfe, + 0x34, 0xff, 0xd8, 0xff, 0x39, 0x00, 0x34, 0x00, 0xde, 0xff, 0x81, 0xff, + 0x3c, 0xff, 0x07, 0xff, 0x09, 0xff, 0x9a, 0xff, 0xc2, 0x00, 0xfd, 0x01, + 0xbc, 0x02, 0xe3, 0x02, 0xd9, 0x02, 0x14, 0x03, 0x87, 0x03, 0xd1, 0x03, + 0x00, 0x04, 0x84, 0x04, 0x5a, 0x05, 0xf7, 0x05, 0x1a, 0x06, 0x08, 0x06, + 0xf4, 0x05, 0xda, 0x05, 0xf8, 0x05, 0x9a, 0x06, 0x63, 0x07, 0xa4, 0x07, + 0x2a, 0x07, 0x5d, 0x06, 0xa8, 0x05, 0x49, 0x05, 0x72, 0x05, 0x28, 0x06, + 0x11, 0x07, 0xbe, 0x07, 0xea, 0x07, 0x99, 0x07, 0x19, 0x07, 0xab, 0x06, + 0x3a, 0x06, 0xa5, 0x05, 0x04, 0x05, 0x81, 0x04, 0x4a, 0x04, 0x85, 0x04, + 0x02, 0x05, 0x27, 0x05, 0x81, 0x04, 0x4f, 0x03, 0x3c, 0x02, 0xaf, 0x01, + 0x86, 0x01, 0x72, 0x01, 0x4f, 0x01, 0x04, 0x01, 0x71, 0x00, 0x8e, 0xff, + 0x81, 0xfe, 0x81, 0xfd, 0xbe, 0xfc, 0x61, 0xfc, 0x7b, 0xfc, 0xef, 0xfc, + 0x5f, 0xfd, 0x54, 0xfd, 0xa0, 0xfc, 0x80, 0xfb, 0x57, 0xfa, 0x6d, 0xf9, + 0xf5, 0xf8, 0x0f, 0xf9, 0x85, 0xf9, 0xe5, 0xf9, 0x0a, 0xfa, 0x2e, 0xfa, + 0x47, 0xfa, 0xff, 0xf9, 0x56, 0xf9, 0xb5, 0xf8, 0x68, 0xf8, 0x6f, 0xf8, + 0xab, 0xf8, 0x0c, 0xf9, 0x83, 0xf9, 0xfc, 0xf9, 0x5a, 0xfa, 0x8d, 0xfa, + 0xa6, 0xfa, 0xd2, 0xfa, 0x31, 0xfb, 0xaa, 0xfb, 0x13, 0xfc, 0x62, 0xfc, + 0xa3, 0xfc, 0xec, 0xfc, 0x3f, 0xfd, 0x82, 0xfd, 0x94, 0xfd, 0x81, 0xfd, + 0x86, 0xfd, 0xcb, 0xfd, 0x4f, 0xfe, 0x21, 0xff, 0x3b, 0x00, 0x44, 0x01, + 0xcd, 0x01, 0xca, 0x01, 0x8f, 0x01, 0x67, 0x01, 0x6d, 0x01, 0xbf, 0x01, + 0x8c, 0x02, 0xca, 0x03, 0x0a, 0x05, 0xb1, 0x05, 0x8e, 0x05, 0xfa, 0x04, + 0x56, 0x04, 0xc3, 0x03, 0x60, 0x03, 0x52, 0x03, 0xaa, 0x03, 0x4d, 0x04, + 0xe3, 0x04, 0x0b, 0x05, 0x9c, 0x04, 0xcd, 0x03, 0x2c, 0x03, 0x09, 0x03, + 0x27, 0x03, 0x1b, 0x03, 0xd3, 0x02, 0x84, 0x02, 0x4e, 0x02, 0x18, 0x02, + 0xcc, 0x01, 0x64, 0x01, 0xd3, 0x00, 0x22, 0x00, 0x7c, 0xff, 0x2c, 0xff, + 0x53, 0xff, 0x90, 0xff, 0x51, 0xff, 0x84, 0xfe, 0x99, 0xfd, 0xfa, 0xfc, + 0x86, 0xfc, 0xc4, 0xfb, 0x9f, 0xfa, 0x8d, 0xf9, 0x07, 0xf9, 0x15, 0xf9, + 0x5d, 0xf9, 0x8e, 0xf9, 0x7e, 0xf9, 0x06, 0xf9, 0x32, 0xf8, 0x4d, 0xf7, + 0x7f, 0xf6, 0xb4, 0xf5, 0x0d, 0xf5, 0xee, 0xf4, 0x63, 0xf5, 0xdf, 0xf5, + 0xea, 0xf5, 0xbc, 0xf5, 0xd7, 0xf5, 0x5d, 0xf6, 0x00, 0xf7, 0x47, 0xf7, + 0x03, 0xf7, 0x71, 0xf6, 0xee, 0xf5, 0xb8, 0xf5, 0xd2, 0xf5, 0x0d, 0xf6, + 0x39, 0xf6, 0x49, 0xf6, 0x71, 0xf6, 0xdd, 0xf6, 0x5f, 0xf7, 0xae, 0xf7, + 0xc0, 0xf7, 0xcc, 0xf7, 0x32, 0xf8, 0x21, 0xf9, 0x34, 0xfa, 0xc6, 0xfa, + 0xa5, 0xfa, 0x47, 0xfa, 0x28, 0xfa, 0x35, 0xfa, 0x3f, 0xfa, 0x7d, 0xfa, + 0x2f, 0xfb, 0x3c, 0xfc, 0x4f, 0xfd, 0x27, 0xfe, 0xb8, 0xfe, 0x0e, 0xff, + 0x2c, 0xff, 0x37, 0xff, 0x7d, 0xff, 0x1c, 0x00, 0xc6, 0x00, 0x08, 0x01, + 0xd7, 0x00, 0x9b, 0x00, 0xae, 0x00, 0x17, 0x01, 0x83, 0x01, 0x96, 0x01, + 0x4f, 0x01, 0xe3, 0x00, 0x85, 0x00, 0x59, 0x00, 0x6a, 0x00, 0xcd, 0x00, + 0x91, 0x01, 0x7d, 0x02, 0x21, 0x03, 0x38, 0x03, 0xdf, 0x02, 0x6b, 0x02, + 0x05, 0x02, 0x93, 0x01, 0x02, 0x01, 0x66, 0x00, 0xf8, 0xff, 0xee, 0xff, + 0x38, 0x00, 0x7d, 0x00, 0x65, 0x00, 0xda, 0xff, 0x15, 0xff, 0x67, 0xfe, + 0x04, 0xfe, 0xe5, 0xfd, 0xc2, 0xfd, 0x67, 0xfd, 0xf6, 0xfc, 0x91, 0xfc, + 0x10, 0xfc, 0x57, 0xfb, 0x94, 0xfa, 0x14, 0xfa, 0xde, 0xf9, 0xb1, 0xf9, + 0x5c, 0xf9, 0xe6, 0xf8, 0x94, 0xf8, 0xa9, 0xf8, 0xfe, 0xf8, 0x2f, 0xf9, + 0x06, 0xf9, 0x8e, 0xf8, 0xfa, 0xf7, 0x77, 0xf7, 0x12, 0xf7, 0xd8, 0xf6, + 0xd1, 0xf6, 0xea, 0xf6, 0x1a, 0xf7, 0x71, 0xf7, 0xed, 0xf7, 0x62, 0xf8, + 0x8d, 0xf8, 0x5c, 0xf8, 0x08, 0xf8, 0xdb, 0xf7, 0xf7, 0xf7, 0x42, 0xf8, + 0x8b, 0xf8, 0xc6, 0xf8, 0x10, 0xf9, 0x75, 0xf9, 0xd4, 0xf9, 0xfe, 0xf9, + 0x14, 0xfa, 0x7d, 0xfa, 0x79, 0xfb, 0xe6, 0xfc, 0x50, 0xfe, 0x3e, 0xff, + 0x87, 0xff, 0x46, 0xff, 0xcc, 0xfe, 0x8c, 0xfe, 0xb2, 0xfe, 0x0a, 0xff, + 0x7a, 0xff, 0x29, 0x00, 0x26, 0x01, 0x24, 0x02, 0xc9, 0x02, 0x15, 0x03, + 0x41, 0x03, 0x7a, 0x03, 0xdb, 0x03, 0x58, 0x04, 0xb3, 0x04, 0xcf, 0x04, + 0xe2, 0x04, 0x0e, 0x05, 0x17, 0x05, 0xd2, 0x04, 0x79, 0x04, 0x5f, 0x04, + 0xa8, 0x04, 0x60, 0x05, 0x54, 0x06, 0x1e, 0x07, 0x7e, 0x07, 0x8c, 0x07, + 0x6f, 0x07, 0x12, 0x07, 0x57, 0x06, 0x7e, 0x05, 0xfe, 0x04, 0x18, 0x05, + 0xa3, 0x05, 0x32, 0x06, 0x79, 0x06, 0x7d, 0x06, 0x35, 0x06, 0x6b, 0x05, + 0x18, 0x04, 0x9f, 0x02, 0x81, 0x01, 0xf6, 0x00, 0xd7, 0x00, 0xed, 0x00, + 0x2b, 0x01, 0x9b, 0x01, 0x25, 0x02, 0x6a, 0x02, 0x04, 0x02, 0xf9, 0x00, + 0xc9, 0xff, 0xe3, 0xfe, 0x5c, 0xfe, 0x39, 0xfe, 0x74, 0xfe, 0xca, 0xfe, + 0xef, 0xfe, 0xd4, 0xfe, 0x73, 0xfe, 0xcc, 0xfd, 0x0d, 0xfd, 0x75, 0xfc, + 0x18, 0xfc, 0xf2, 0xfb, 0x08, 0xfc, 0x4b, 0xfc, 0x75, 0xfc, 0x49, 0xfc, + 0xd8, 0xfb, 0x4f, 0xfb, 0xc1, 0xfa, 0x4c, 0xfa, 0x2b, 0xfa, 0x67, 0xfa, + 0xd8, 0xfa, 0x63, 0xfb, 0xf2, 0xfb, 0x4d, 0xfc, 0x5c, 0xfc, 0x53, 0xfc, + 0x73, 0xfc, 0xba, 0xfc, 0x00, 0xfd, 0x40, 0xfd, 0x8f, 0xfd, 0xf0, 0xfd, + 0x67, 0xfe, 0x21, 0xff, 0x29, 0x00, 0x36, 0x01, 0xca, 0x01, 0x94, 0x01, + 0xb9, 0x00, 0xb9, 0xff, 0x0b, 0xff, 0xe0, 0xfe, 0x2d, 0xff, 0xd3, 0xff, + 0xb8, 0x00, 0xab, 0x01, 0x64, 0x02, 0xb4, 0x02, 0xb6, 0x02, 0xbb, 0x02, + 0xf2, 0x02, 0x40, 0x03, 0x7e, 0x03, 0xc5, 0x03, 0x4e, 0x04, 0x17, 0x05, + 0xe5, 0x05, 0x89, 0x06, 0xe0, 0x06, 0xc1, 0x06, 0x3b, 0x06, 0x9c, 0x05, + 0x31, 0x05, 0x1f, 0x05, 0x66, 0x05, 0xd5, 0x05, 0x2a, 0x06, 0x54, 0x06, + 0x7b, 0x06, 0x9f, 0x06, 0x77, 0x06, 0xdc, 0x05, 0xf9, 0x04, 0x06, 0x04, + 0x3a, 0x03, 0xf2, 0x02, 0x56, 0x03, 0xf7, 0x03, 0x3a, 0x04, 0x06, 0x04, + 0xb3, 0x03, 0x7e, 0x03, 0x6b, 0x03, 0x8c, 0x03, 0xe7, 0x03, 0x2c, 0x04, + 0xed, 0x03, 0x20, 0x03, 0x24, 0x02, 0x5d, 0x01, 0x03, 0x01, 0x29, 0x01, + 0x9d, 0x01, 0xf0, 0x01, 0xd7, 0x01, 0x66, 0x01, 0xd4, 0x00, 0x3e, 0x00, + 0xbc, 0xff, 0x64, 0xff, 0x18, 0xff, 0xa8, 0xfe, 0x26, 0xfe, 0xda, 0xfd, + 0xdb, 0xfd, 0x03, 0xfe, 0x2f, 0xfe, 0x49, 0xfe, 0x29, 0xfe, 0xce, 0xfd, + 0x95, 0xfd, 0xf8, 0xfd, 0xe5, 0xfe, 0xc0, 0xff, 0x0e, 0x00, 0xd2, 0xff, + 0x2d, 0xff, 0x37, 0xfe, 0x50, 0xfd, 0x0d, 0xfd, 0x85, 0xfd, 0x46, 0xfe, + 0xff, 0xfe, 0xb0, 0xff, 0x39, 0x00, 0x71, 0x00, 0x60, 0x00, 0x07, 0x00, + 0x39, 0xff, 0x20, 0xfe, 0x73, 0xfd, 0xc7, 0xfd, 0x03, 0xff, 0xb3, 0x00, + 0x4f, 0x02, 0x3d, 0x03, 0x21, 0x03, 0x43, 0x02, 0x54, 0x01, 0xca, 0x00, + 0xba, 0x00, 0x28, 0x01, 0x0c, 0x02, 0x17, 0x03, 0xce, 0x03, 0x0e, 0x04, + 0x29, 0x04, 0x62, 0x04, 0x95, 0x04, 0x9a, 0x04, 0x91, 0x04, 0xa4, 0x04, + 0xd2, 0x04, 0x11, 0x05, 0x52, 0x05, 0x56, 0x05, 0xe4, 0x04, 0x1c, 0x04, + 0x5b, 0x03, 0xf3, 0x02, 0x16, 0x03, 0xcf, 0x03, 0xdf, 0x04, 0xd4, 0x05, + 0x46, 0x06, 0x05, 0x06, 0x1c, 0x05, 0xe1, 0x03, 0xef, 0x02, 0xcc, 0x02, + 0x6c, 0x03, 0x35, 0x04, 0x93, 0x04, 0x71, 0x04, 0x09, 0x04, 0x84, 0x03, + 0xfe, 0x02, 0x9b, 0x02, 0x5f, 0x02, 0x2c, 0x02, 0xf9, 0x01, 0xd8, 0x01, + 0xb4, 0x01, 0x65, 0x01, 0xee, 0x00, 0x67, 0x00, 0xdc, 0xff, 0x6f, 0xff, + 0x5d, 0xff, 0xb0, 0xff, 0x1c, 0x00, 0x51, 0x00, 0x33, 0x00, 0xd1, 0xff, + 0x5e, 0xff, 0x12, 0xff, 0xfc, 0xfe, 0xf1, 0xfe, 0xd1, 0xfe, 0xa7, 0xfe, + 0x8f, 0xfe, 0x89, 0xfe, 0x82, 0xfe, 0x78, 0xfe, 0x74, 0xfe, 0x5f, 0xfe, + 0x14, 0xfe, 0x94, 0xfd, 0x11, 0xfd, 0xac, 0xfc, 0x67, 0xfc, 0x4b, 0xfc, + 0x6d, 0xfc, 0xbe, 0xfc, 0x11, 0xfd, 0x4a, 0xfd, 0x64, 0xfd, 0x58, 0xfd, + 0x3b, 0xfd, 0x3f, 0xfd, 0x8b, 0xfd, 0x03, 0xfe, 0x64, 0xfe, 0x84, 0xfe, + 0x7b, 0xfe, 0x86, 0xfe, 0xd3, 0xfe, 0x60, 0xff, 0x11, 0x00, 0xbf, 0x00, + 0x33, 0x01, 0x3c, 0x01, 0xdf, 0x00, 0x63, 0x00, 0x18, 0x00, 0x19, 0x00, + 0x52, 0x00, 0x9d, 0x00, 0xdd, 0x00, 0xfc, 0x00, 0xed, 0x00, 0xbe, 0x00, + 0x9c, 0x00, 0xad, 0x00, 0xe5, 0x00, 0x2f, 0x01, 0x99, 0x01, 0x2a, 0x02, + 0xc2, 0x02, 0x32, 0x03, 0x67, 0x03, 0x60, 0x03, 0x27, 0x03, 0xe2, 0x02, + 0xdc, 0x02, 0x3b, 0x03, 0xd7, 0x03, 0x59, 0x04, 0x87, 0x04, 0x63, 0x04, + 0x0d, 0x04, 0xa3, 0x03, 0x39, 0x03, 0xd7, 0x02, 0x7c, 0x02, 0x34, 0x02, + 0x19, 0x02, 0x1f, 0x02, 0x00, 0x02, 0x91, 0x01, 0x01, 0x01, 0x93, 0x00, + 0x55, 0x00, 0x2e, 0x00, 0x1a, 0x00, 0x26, 0x00, 0x46, 0x00, 0x5e, 0x00, + 0x5b, 0x00, 0x3e, 0x00, 0x17, 0x00, 0xf3, 0xff, 0xc4, 0xff, 0x6c, 0xff, + 0xf3, 0xfe, 0x99, 0xfe, 0x93, 0xfe, 0xc1, 0xfe, 0xca, 0xfe, 0x81, 0xfe, + 0x07, 0xfe, 0x90, 0xfd, 0x30, 0xfd, 0xe6, 0xfc, 0xa2, 0xfc, 0x46, 0xfc, + 0xcf, 0xfb, 0x77, 0xfb, 0x70, 0xfb, 0xa4, 0xfb, 0xd6, 0xfb, 0x00, 0xfc, + 0x3f, 0xfc, 0x85, 0xfc, 0x9f, 0xfc, 0x7b, 0xfc, 0x2c, 0xfc, 0xce, 0xfb, + 0x84, 0xfb, 0x88, 0xfb, 0xfd, 0xfb, 0xbb, 0xfc, 0x71, 0xfd, 0xea, 0xfd, + 0x0f, 0xfe, 0xd5, 0xfd, 0x4d, 0xfd, 0xbf, 0xfc, 0x6d, 0xfc, 0x5b, 0xfc, + 0x69, 0xfc, 0x8e, 0xfc, 0xd4, 0xfc, 0x24, 0xfd, 0x51, 0xfd, 0x48, 0xfd, + 0x24, 0xfd, 0x17, 0xfd, 0x46, 0xfd, 0xb9, 0xfd, 0x58, 0xfe, 0x09, 0xff, + 0xb1, 0xff, 0x22, 0x00, 0x2e, 0x00, 0xdf, 0xff, 0x87, 0xff, 0x64, 0xff, + 0x76, 0xff, 0xb1, 0xff, 0x36, 0x00, 0x20, 0x01, 0x38, 0x02, 0x10, 0x03, + 0x5f, 0x03, 0x28, 0x03, 0x95, 0x02, 0xcb, 0x01, 0xf0, 0x00, 0x3f, 0x00, + 0xec, 0xff, 0x02, 0x00, 0x61, 0x00, 0xde, 0x00, 0x4c, 0x01, 0x88, 0x01, + 0x88, 0x01, 0x69, 0x01, 0x59, 0x01, 0x78, 0x01, 0xb6, 0x01, 0xda, 0x01, + 0xc5, 0x01, 0x9a, 0x01, 0x86, 0x01, 0x85, 0x01, 0x79, 0x01, 0x62, 0x01, + 0x5a, 0x01, 0x69, 0x01, 0x7c, 0x01, 0x7b, 0x01, 0x65, 0x01, 0x57, 0x01, + 0x62, 0x01, 0x65, 0x01, 0x2d, 0x01, 0xad, 0x00, 0x08, 0x00, 0x6b, 0xff, + 0xff, 0xfe, 0xdc, 0xfe, 0xf0, 0xfe, 0x13, 0xff, 0x29, 0xff, 0x27, 0xff, + 0xff, 0xfe, 0xb5, 0xfe, 0x6f, 0xfe, 0x53, 0xfe, 0x75, 0xfe, 0xcc, 0xfe, + 0x39, 0xff, 0x82, 0xff, 0x83, 0xff, 0x4b, 0xff, 0x15, 0xff, 0x0b, 0xff, + 0x1a, 0xff, 0x1c, 0xff, 0x0b, 0xff, 0x0d, 0xff, 0x3b, 0xff, 0x81, 0xff, + 0xab, 0xff, 0x82, 0xff, 0x00, 0xff, 0x69, 0xfe, 0x17, 0xfe, 0x21, 0xfe, + 0x63, 0xfe, 0xc8, 0xfe, 0x3e, 0xff, 0x9a, 0xff, 0xc0, 0xff, 0xd3, 0xff, + 0x03, 0x00, 0x4f, 0x00, 0x99, 0x00, 0xd2, 0x00, 0xf4, 0x00, 0x04, 0x01, + 0x1d, 0x01, 0x53, 0x01, 0x9a, 0x01, 0xd0, 0x01, 0xd3, 0x01, 0x93, 0x01, + 0x2b, 0x01, 0xd9, 0x00, 0xc6, 0x00, 0xf2, 0x00, 0x4f, 0x01, 0xd4, 0x01, + 0x63, 0x02, 0xc7, 0x02, 0xca, 0x02, 0x49, 0x02, 0x65, 0x01, 0x93, 0x00, + 0x56, 0x00, 0xd5, 0x00, 0xc8, 0x01, 0xb8, 0x02, 0x4b, 0x03, 0x6a, 0x03, + 0x32, 0x03, 0xd4, 0x02, 0x7c, 0x02, 0x53, 0x02, 0x63, 0x02, 0x94, 0x02, + 0xdb, 0x02, 0x3f, 0x03, 0xb3, 0x03, 0xf8, 0x03, 0xd3, 0x03, 0x49, 0x03, + 0x96, 0x02, 0x04, 0x02, 0xb6, 0x01, 0xa3, 0x01, 0xb2, 0x01, 0xd1, 0x01, + 0xd7, 0x01, 0x96, 0x01, 0x17, 0x01, 0x99, 0x00, 0x4a, 0x00, 0x2a, 0x00, + 0x1c, 0x00, 0x0e, 0x00, 0x03, 0x00, 0x1d, 0x00, 0x76, 0x00, 0xf6, 0x00, + 0x69, 0x01, 0xa2, 0x01, 0x83, 0x01, 0x00, 0x01, 0x45, 0x00, 0xa5, 0xff, + 0x50, 0xff, 0x53, 0xff, 0xae, 0xff, 0x49, 0x00, 0xd5, 0x00, 0xf0, 0x00, + 0x6e, 0x00, 0x74, 0xff, 0x6f, 0xfe, 0xd5, 0xfd, 0xd0, 0xfd, 0x2d, 0xfe, + 0x9f, 0xfe, 0xee, 0xfe, 0x04, 0xff, 0xe8, 0xfe, 0xae, 0xfe, 0x68, 0xfe, + 0x31, 0xfe, 0x34, 0xfe, 0x75, 0xfe, 0xc4, 0xfe, 0xef, 0xfe, 0xf5, 0xfe, + 0xec, 0xfe, 0xdb, 0xfe, 0xc5, 0xfe, 0xa8, 0xfe, 0x88, 0xfe, 0x86, 0xfe, + 0xc7, 0xfe, 0x35, 0xff, 0x8c, 0xff, 0xa2, 0xff, 0x85, 0xff, 0x55, 0xff, + 0x30, 0xff, 0x1c, 0xff, 0x08, 0xff, 0xe3, 0xfe, 0xbb, 0xfe, 0xb2, 0xfe, + 0xeb, 0xfe, 0x69, 0xff, 0x08, 0x00, 0x8e, 0x00, 0xd8, 0x00, 0xe9, 0x00, + 0xdd, 0x00, 0xcd, 0x00, 0xbd, 0x00, 0xa1, 0x00, 0x90, 0x00, 0xa8, 0x00, + 0xd5, 0x00, 0xf3, 0x00, 0x15, 0x01, 0x58, 0x01, 0x9e, 0x01, 0xb0, 0x01, + 0x8f, 0x01, 0x5b, 0x01, 0x13, 0x01, 0xba, 0x00, 0x6d, 0x00, 0x30, 0x00, + 0xf0, 0xff, 0xba, 0xff, 0xa7, 0xff, 0xae, 0xff, 0xc9, 0xff, 0x1c, 0x00, + 0xaf, 0x00, 0x41, 0x01, 0x89, 0x01, 0x62, 0x01, 0xc9, 0x00, 0xde, 0xff, + 0xf1, 0xfe, 0x5c, 0xfe, 0x56, 0xfe, 0xdb, 0xfe, 0xa7, 0xff, 0x63, 0x00, + 0xca, 0x00, 0xc1, 0x00, 0x52, 0x00, 0xa0, 0xff, 0xda, 0xfe, 0x24, 0xfe, + 0x9f, 0xfd, 0x68, 0xfd, 0x8c, 0xfd, 0xe8, 0xfd, 0x36, 0xfe, 0x47, 0xfe, + 0x12, 0xfe, 0xa9, 0xfd, 0x3f, 0xfd, 0x1c, 0xfd, 0x4e, 0xfd, 0x9c, 0xfd, + 0xd5, 0xfd, 0xfe, 0xfd, 0x1d, 0xfe, 0x10, 0xfe, 0xb5, 0xfd, 0x28, 0xfd, + 0xa8, 0xfc, 0x5c, 0xfc, 0x53, 0xfc, 0xb0, 0xfc, 0x77, 0xfd, 0x52, 0xfe, + 0xd3, 0xfe, 0xd1, 0xfe, 0x58, 0xfe, 0x76, 0xfd, 0x53, 0xfc, 0x48, 0xfb, + 0xaf, 0xfa, 0xab, 0xfa, 0x2e, 0xfb, 0x10, 0xfc, 0x11, 0xfd, 0xe4, 0xfd, + 0x60, 0xfe, 0x83, 0xfe, 0x5d, 0xfe, 0x13, 0xfe, 0xe5, 0xfd, 0xf7, 0xfd, + 0x34, 0xfe, 0x77, 0xfe, 0xb9, 0xfe, 0xfd, 0xfe, 0x39, 0xff, 0x52, 0xff, + 0x48, 0xff, 0x37, 0xff, 0x39, 0xff, 0x58, 0xff, 0xac, 0xff, 0x27, 0x00, + 0x7a, 0x00, 0x64, 0x00, 0x03, 0x00, 0x96, 0xff, 0x2c, 0xff, 0xc2, 0xfe, + 0x66, 0xfe, 0x3a, 0xfe, 0x59, 0xfe, 0xd9, 0xfe, 0xa9, 0xff, 0x83, 0x00, + 0xfe, 0x00, 0xec, 0x00, 0x78, 0x00, 0xdc, 0xff, 0x3c, 0xff, 0xc9, 0xfe, + 0xc1, 0xfe, 0x34, 0xff, 0xec, 0xff, 0x9e, 0x00, 0x12, 0x01, 0x3d, 0x01, + 0x28, 0x01, 0xde, 0x00, 0x86, 0x00, 0x53, 0x00, 0x48, 0x00, 0x32, 0x00, + 0xff, 0xff, 0xc4, 0xff, 0x73, 0xff, 0xeb, 0xfe, 0x29, 0xfe, 0x5a, 0xfd, + 0xbd, 0xfc, 0x7d, 0xfc, 0xa7, 0xfc, 0x1d, 0xfd, 0x92, 0xfd, 0xdc, 0xfd, + 0x16, 0xfe, 0x3f, 0xfe, 0x21, 0xfe, 0xc5, 0xfd, 0x87, 0xfd, 0xae, 0xfd, + 0x32, 0xfe, 0xed, 0xfe, 0xac, 0xff, 0x4f, 0x00, 0xc8, 0x00, 0x05, 0x01, + 0xec, 0x00, 0x7c, 0x00, 0xc0, 0xff, 0xe5, 0xfe, 0x47, 0xfe, 0x25, 0xfe, + 0x5b, 0xfe, 0xa6, 0xfe, 0xdf, 0xfe, 0xd2, 0xfe, 0x5a, 0xfe, 0x99, 0xfd, + 0xb3, 0xfc, 0xbf, 0xfb, 0xf9, 0xfa, 0x92, 0xfa, 0x9d, 0xfa, 0x5b, 0xfb, + 0x16, 0xfd, 0x97, 0xff, 0x22, 0x02, 0x2d, 0x04, 0xaa, 0x05, 0x8e, 0x06, + 0xc1, 0x06, 0x75, 0x06, 0xe1, 0x05, 0xfc, 0x04, 0xdd, 0x03, 0x07, 0x03, + 0xcf, 0x02, 0xf7, 0x02, 0x0f, 0x03, 0xb2, 0x02, 0x82, 0x01, 0x68, 0xff, + 0xbd, 0xfc, 0x29, 0xfa, 0x4d, 0xf8, 0x93, 0xf7, 0x15, 0xf8, 0x97, 0xf9, + 0xa5, 0xfb, 0xd7, 0xfd, 0x05, 0x00, 0x2c, 0x02, 0xf4, 0x03, 0xe0, 0x04, + 0x21, 0x05, 0x83, 0x05, 0x99, 0x06, 0x56, 0x08, 0x02, 0x0a, 0xa1, 0x0a, + 0x76, 0x09, 0x53, 0x06, 0xb3, 0x01, 0xe2, 0xfc, 0x8a, 0xf9, 0x8f, 0xf8, + 0xac, 0xf9, 0x4b, 0xfc, 0xa2, 0xff, 0x52, 0x02, 0x2c, 0x03, 0x58, 0x02, + 0xe3, 0x00, 0x50, 0xff, 0x8b, 0xfd, 0xdc, 0xfb, 0xbc, 0xfa, 0x3b, 0xfa, + 0x64, 0xfa, 0x5a, 0xfb, 0xf0, 0xfc, 0xb9, 0xfe, 0x69, 0x00, 0xd2, 0x01, + 0x9b, 0x02, 0xaa, 0x02, 0x6f, 0x02, 0x53, 0x02, 0x8c, 0x02, 0x34, 0x03, + 0xf2, 0x03, 0x43, 0x04, 0x0c, 0x04, 0x85, 0x03, 0x14, 0x03, 0xd6, 0x02, + 0x63, 0x02, 0x98, 0x01, 0x9a, 0x00, 0x1c, 0xff, 0xec, 0xfc, 0xd8, 0xfa, + 0x09, 0xfa, 0x88, 0xfa, 0x58, 0xfb, 0x1f, 0xfc, 0x6a, 0xfd, 0x79, 0xff, + 0x1a, 0x02, 0x25, 0x05, 0x6b, 0x08, 0x87, 0x0b, 0xd3, 0x0d, 0xd5, 0x0e, + 0x83, 0x0e, 0xc0, 0x0c, 0xa5, 0x09, 0x12, 0x06, 0x21, 0x03, 0x9a, 0x01, + 0xd3, 0x01, 0x66, 0x03, 0x56, 0x05, 0xca, 0x06, 0x8e, 0x07, 0xce, 0x07, + 0xae, 0x07, 0x5f, 0x07, 0x1a, 0x07, 0xdd, 0x06, 0x54, 0x06, 0x2f, 0x05, + 0xe0, 0x03, 0x58, 0x03, 0xb7, 0x03, 0x5f, 0x04, 0x03, 0x05, 0xb4, 0x05, + 0x87, 0x06, 0x82, 0x07, 0xa6, 0x08, 0xca, 0x09, 0xab, 0x0a, 0x33, 0x0b, + 0x38, 0x0b, 0x94, 0x0a, 0xbb, 0x09, 0x2f, 0x09, 0xe8, 0x08, 0x98, 0x08, + 0xcb, 0x07, 0x74, 0x06, 0x3c, 0x05, 0x78, 0x04, 0xe6, 0x03, 0x3f, 0x03, + 0x58, 0x02, 0x0b, 0x01, 0x88, 0xff, 0x43, 0xfe, 0x55, 0xfd, 0x88, 0xfc, + 0x21, 0xfc, 0xb5, 0xfc, 0x44, 0xfe, 0xef, 0xff, 0xb2, 0x00, 0x68, 0x00, + 0xa5, 0xff, 0x15, 0xff, 0x2f, 0xff, 0xc3, 0xff, 0x05, 0x00, 0x4a, 0xff, + 0xd2, 0xfd, 0x9f, 0xfc, 0x0b, 0xfc, 0xa9, 0xfb, 0x5b, 0xfb, 0x07, 0xfb, + 0x96, 0xfa, 0x62, 0xfa, 0xac, 0xfa, 0x64, 0xfb, 0x58, 0xfc, 0x13, 0xfd, + 0x36, 0xfd, 0x97, 0xfc, 0x3f, 0xfb, 0xc6, 0xf9, 0xf6, 0xf8, 0xf5, 0xf8, + 0x71, 0xf9, 0x79, 0xfa, 0x1d, 0xfc, 0x80, 0xfd, 0x20, 0xfe, 0xd4, 0xfe, + 0x55, 0x00, 0x46, 0x02, 0xba, 0x03, 0x37, 0x04, 0x23, 0x04, 0x3c, 0x04, + 0x28, 0x05, 0xe6, 0x06, 0xa5, 0x08, 0xe3, 0x09, 0x00, 0x0b, 0xd4, 0x0c, + 0x24, 0x0f, 0xf1, 0x0f, 0x70, 0x0e, 0x06, 0x0c, 0xb5, 0x09, 0xa6, 0x07, + 0xf3, 0x05, 0x40, 0x05, 0xba, 0x06, 0x33, 0x0a, 0x0e, 0x0e, 0x7e, 0x10, + 0x63, 0x10, 0x78, 0x0e, 0x2d, 0x0a, 0xcc, 0xff, 0x3b, 0xf0, 0x2e, 0xe4, + 0xdb, 0xe1, 0x50, 0xe5, 0x2f, 0xe8, 0xc3, 0xea, 0x84, 0xed, 0x74, 0xeb, + 0xb5, 0xe3, 0x52, 0xdc, 0x9d, 0xd8, 0x73, 0xd8, 0x7d, 0xdd, 0x3a, 0xe8, + 0x50, 0xf3, 0x8a, 0xf7, 0xc2, 0xf2, 0x87, 0xe8, 0xcd, 0xde, 0x82, 0xda, + 0x6d, 0xdc, 0x71, 0xe1, 0x25, 0xe5, 0x6b, 0xe4, 0xe3, 0xdf, 0x1b, 0xda, + 0x23, 0xd4, 0x5d, 0xcf, 0xd6, 0xce, 0x8d, 0xd2, 0x9a, 0xd5, 0xe6, 0xd5, + 0xfa, 0xd7, 0xa4, 0xdd, 0x42, 0xe2, 0x8a, 0xe3, 0x6c, 0xe3, 0x76, 0xe2, + 0x75, 0xe0, 0xe6, 0xde, 0xa1, 0xde, 0x1f, 0xdf, 0x2a, 0xe1, 0x67, 0xe5, + 0x9e, 0xe9, 0xdf, 0xeb, 0x41, 0xec, 0x99, 0xeb, 0x0e, 0xed, 0x1b, 0xf3, + 0x89, 0xfa, 0xb2, 0xfe, 0x2e, 0xff, 0x1b, 0xfe, 0x50, 0xfc, 0xaa, 0xf9, + 0x7c, 0xf8, 0xcc, 0xfb, 0x14, 0x02, 0x4c, 0x07, 0xa3, 0x09, 0x0d, 0x09, + 0x55, 0x06, 0x00, 0x04, 0x09, 0x05, 0x85, 0x09, 0xe8, 0x0e, 0xe5, 0x13, + 0xa0, 0x18, 0x62, 0x1c, 0x5a, 0x1e, 0xe5, 0x1e, 0xa9, 0x1e, 0x97, 0x1d, + 0x94, 0x1c, 0xc4, 0x1e, 0x28, 0x24, 0xf8, 0x25, 0x10, 0x20, 0x2f, 0x18, + 0x49, 0x14, 0xf8, 0x11, 0x7a, 0x0e, 0xe0, 0x0d, 0xc3, 0x12, 0xd0, 0x17, + 0x81, 0x18, 0xa7, 0x17, 0x3a, 0x18, 0x21, 0x18, 0xa9, 0x15, 0xec, 0x12, + 0xab, 0x11, 0x27, 0x11, 0x1c, 0x11, 0xc5, 0x12, 0xda, 0x15, 0xa9, 0x17, + 0x8f, 0x16, 0xa6, 0x13, 0xec, 0x0f, 0xc1, 0x0b, 0x14, 0x09, 0x39, 0x09, + 0x20, 0x0a, 0xd9, 0x09, 0x8b, 0x09, 0xa9, 0x09, 0x74, 0x07, 0x9b, 0x01, + 0xaa, 0xfb, 0xb4, 0xf9, 0x36, 0xfb, 0x5f, 0xfc, 0xfb, 0xfa, 0x36, 0xf8, + 0x0e, 0xf5, 0x99, 0xf0, 0x2b, 0xec, 0x71, 0xeb, 0x30, 0xee, 0x58, 0xf0, + 0x80, 0xf0, 0xca, 0xf0, 0xac, 0xf2, 0xab, 0xf5, 0xa1, 0xf8, 0x00, 0xfa, + 0xeb, 0xf8, 0x32, 0xf7, 0x4a, 0xf7, 0x0a, 0xf9, 0x3f, 0xfb, 0xa6, 0xfd, + 0x5a, 0xff, 0xb6, 0xfe, 0xed, 0xfb, 0x6e, 0xf9, 0xe9, 0xf8, 0xc4, 0xf9, + 0x35, 0xfb, 0x0e, 0xfd, 0x6b, 0xfe, 0xbb, 0xfe, 0xd9, 0xfe, 0x8d, 0xff, + 0xd4, 0x00, 0xcb, 0x02, 0xc4, 0x05, 0x71, 0x09, 0xab, 0x0c, 0x9d, 0x0e, + 0x75, 0x0f, 0x86, 0x0f, 0x02, 0x0f, 0xe6, 0x0e, 0x96, 0x10, 0xef, 0x13, + 0xf7, 0x16, 0x7c, 0x18, 0xbf, 0x19, 0xf4, 0x1b, 0x1f, 0x1e, 0x2f, 0x1f, + 0x8b, 0x1f, 0x95, 0x1f, 0x53, 0x1f, 0x63, 0x1f, 0x3d, 0x20, 0x58, 0x21, + 0xdd, 0x21, 0x90, 0x21, 0xcd, 0x20, 0x28, 0x20, 0x7f, 0x20, 0x42, 0x22, + 0xf7, 0x23, 0xab, 0x23, 0xb2, 0x21, 0xd7, 0x1f, 0xdb, 0x1e, 0x76, 0x1e, + 0x9d, 0x1e, 0x79, 0x1f, 0x7e, 0x20, 0x24, 0x21, 0xa9, 0x21, 0xd1, 0x21, + 0xea, 0x20, 0xf5, 0x1e, 0xf6, 0x1b, 0x15, 0x18, 0xcc, 0x14, 0x5c, 0x13, + 0x1c, 0x13, 0xc4, 0x12, 0xfa, 0x11, 0xab, 0x10, 0x28, 0x0e, 0xa0, 0x0a, + 0xe8, 0x07, 0xfb, 0x06, 0xc3, 0x06, 0x52, 0x06, 0xeb, 0x05, 0xc5, 0x05, + 0x3f, 0x05, 0xa4, 0x03, 0x31, 0x01, 0xa7, 0xfe, 0x59, 0xfc, 0x6f, 0xfa, + 0x4b, 0xf9, 0x2b, 0xf9, 0x83, 0xf9, 0x18, 0xf9, 0x87, 0xf7, 0xc4, 0xf5, + 0x5d, 0xf4, 0xe1, 0xf2, 0x36, 0xf1, 0xec, 0xef, 0x7f, 0xef, 0x0b, 0xf0, + 0x24, 0xf1, 0xd9, 0xf1, 0x76, 0xf1, 0x07, 0xf0, 0x19, 0xee, 0x82, 0xec, + 0x37, 0xec, 0x8d, 0xed, 0xb0, 0xef, 0x4d, 0xf1, 0xe9, 0xf1, 0x64, 0xf2, + 0xc6, 0xf3, 0x03, 0xf6, 0x49, 0xf8, 0xf4, 0xf9, 0xe9, 0xfa, 0x50, 0xfb, + 0x61, 0xfb, 0x93, 0xfb, 0x48, 0xfc, 0x41, 0xfd, 0xd5, 0xfd, 0xdd, 0xfd, + 0x0c, 0xfe, 0xfa, 0xfe, 0x22, 0x00, 0xc0, 0x00, 0xe4, 0x00, 0xc4, 0x00, + 0x52, 0x00, 0xff, 0xff, 0xa9, 0x00, 0x6b, 0x02, 0x54, 0x04, 0xf2, 0x05, + 0xee, 0x07, 0x5e, 0x0a, 0x2f, 0x0c, 0xf1, 0x0c, 0x62, 0x0d, 0x04, 0x0e, + 0x9c, 0x0e, 0x19, 0x0f, 0xd3, 0x0f, 0x95, 0x10, 0x8b, 0x10, 0x90, 0x0f, + 0x84, 0x0e, 0x40, 0x0e, 0xd7, 0x0e, 0xb4, 0x0f, 0x01, 0x10, 0x53, 0x0f, + 0x0c, 0x0e, 0xd6, 0x0c, 0xbb, 0x0b, 0x4b, 0x0a, 0x92, 0x08, 0x15, 0x07, + 0xec, 0x05, 0xc9, 0x04, 0xf4, 0x03, 0x15, 0x04, 0xc8, 0x04, 0xcf, 0x04, + 0xfc, 0x03, 0x83, 0x03, 0xde, 0x03, 0x11, 0x04, 0x72, 0x03, 0x5a, 0x02, + 0x09, 0x01, 0x92, 0xff, 0x79, 0xfe, 0x2e, 0xfe, 0x56, 0xfe, 0x2f, 0xfe, + 0x50, 0xfd, 0xdf, 0xfb, 0x1b, 0xfa, 0x20, 0xf8, 0x08, 0xf6, 0xac, 0xf3, + 0xce, 0xf0, 0xe0, 0xed, 0xcf, 0xeb, 0xe6, 0xea, 0xb1, 0xea, 0xbf, 0xea, + 0xc1, 0xea, 0x6c, 0xea, 0xcf, 0xe9, 0x6e, 0xe9, 0x9a, 0xe9, 0x29, 0xea, + 0xbe, 0xea, 0x1a, 0xeb, 0x45, 0xeb, 0x5d, 0xeb, 0x50, 0xeb, 0x20, 0xeb, + 0x07, 0xeb, 0x14, 0xeb, 0x47, 0xeb, 0xd2, 0xeb, 0xb5, 0xec, 0x77, 0xed, + 0xa7, 0xed, 0x54, 0xed, 0xe9, 0xec, 0xa3, 0xec, 0x72, 0xec, 0x4e, 0xec, + 0x41, 0xec, 0x23, 0xec, 0xfc, 0xeb, 0x78, 0xec, 0x0d, 0xee, 0x13, 0xf0, + 0x8b, 0xf1, 0x4a, 0xf2, 0x93, 0xf2, 0x7a, 0xf2, 0x69, 0xf2, 0x3b, 0xf3, + 0x27, 0xf5, 0x5c, 0xf7, 0x32, 0xf9, 0xe1, 0xfa, 0xb2, 0xfc, 0x65, 0xfe, + 0xcf, 0xff, 0x1c, 0x01, 0x3d, 0x02, 0xd8, 0x02, 0xf6, 0x02, 0x08, 0x03, + 0x34, 0x03, 0x49, 0x03, 0x47, 0x03, 0x61, 0x03, 0x95, 0x03, 0xbb, 0x03, + 0xda, 0x03, 0xfe, 0x03, 0x0d, 0x04, 0x0c, 0x04, 0x35, 0x04, 0x82, 0x04, + 0xb6, 0x04, 0xc7, 0x04, 0xe5, 0x04, 0x21, 0x05, 0x66, 0x05, 0xa6, 0x05, + 0xdf, 0x05, 0xec, 0x05, 0x99, 0x05, 0xff, 0x04, 0x86, 0x04, 0x6d, 0x04, + 0x90, 0x04, 0x99, 0x04, 0x3e, 0x04, 0x71, 0x03, 0x60, 0x02, 0x31, 0x01, + 0xf5, 0xff, 0xed, 0xfe, 0x3d, 0xfe, 0x8b, 0xfd, 0x84, 0xfc, 0x51, 0xfb, + 0x2a, 0xfa, 0xf8, 0xf8, 0xa5, 0xf7, 0x3d, 0xf6, 0xc6, 0xf4, 0x59, 0xf3, + 0x32, 0xf2, 0x72, 0xf1, 0xf9, 0xf0, 0x9f, 0xf0, 0x73, 0xf0, 0x77, 0xf0, + 0x65, 0xf0, 0x0b, 0xf0, 0xa9, 0xef, 0x63, 0xef, 0xdd, 0xee, 0xf1, 0xed, + 0x1f, 0xed, 0xde, 0xec, 0xf6, 0xec, 0xeb, 0xec, 0xa4, 0xec, 0x5b, 0xec, + 0x21, 0xec, 0xd7, 0xeb, 0x99, 0xeb, 0xbf, 0xeb, 0x33, 0xec, 0x76, 0xec, + 0x5d, 0xec, 0x53, 0xec, 0xc1, 0xec, 0x84, 0xed, 0x14, 0xee, 0x36, 0xee, + 0x3b, 0xee, 0x8f, 0xee, 0x4c, 0xef, 0x5f, 0xf0, 0xb6, 0xf1, 0x27, 0xf3, + 0x63, 0xf4, 0x3f, 0xf5, 0xe4, 0xf5, 0xa5, 0xf6, 0x98, 0xf7, 0x86, 0xf8, + 0x51, 0xf9, 0x33, 0xfa, 0x70, 0xfb, 0xfd, 0xfc, 0x80, 0xfe, 0xa6, 0xff, + 0x6e, 0x00, 0x08, 0x01, 0x89, 0x01, 0xef, 0x01, 0x4f, 0x02, 0xb7, 0x02, + 0x12, 0x03, 0x53, 0x03, 0x9a, 0x03, 0x0d, 0x04, 0x8f, 0x04, 0xdc, 0x04, + 0xe6, 0x04, 0xee, 0x04, 0x33, 0x05, 0xc0, 0x05, 0x7a, 0x06, 0x37, 0x07, + 0xd5, 0x07, 0x42, 0x08, 0x71, 0x08, 0x65, 0x08, 0x61, 0x08, 0xb4, 0x08, + 0x53, 0x09, 0xe5, 0x09, 0x33, 0x0a, 0x4d, 0x0a, 0x4b, 0x0a, 0x28, 0x0a, + 0xe6, 0x09, 0x9f, 0x09, 0x48, 0x09, 0xab, 0x08, 0xbf, 0x07, 0xbe, 0x06, + 0xba, 0x05, 0xa0, 0x04, 0xab, 0x03, 0x30, 0x03, 0x04, 0x03, 0x9a, 0x02, + 0xba, 0x01, 0x90, 0x00, 0x4d, 0xff, 0x1d, 0xfe, 0x49, 0xfd, 0xf3, 0xfc, + 0xc5, 0xfc, 0x58, 0xfc, 0xab, 0xfb, 0xf7, 0xfa, 0x56, 0xfa, 0xd9, 0xf9, + 0xa8, 0xf9, 0xb8, 0xf9, 0xac, 0xf9, 0x34, 0xf9, 0x64, 0xf8, 0x92, 0xf7, + 0x09, 0xf7, 0xda, 0xf6, 0xd7, 0xf6, 0xb2, 0xf6, 0x3b, 0xf6, 0x98, 0xf5, + 0x0e, 0xf5, 0xac, 0xf4, 0x58, 0xf4, 0x1a, 0xf4, 0x0a, 0xf4, 0x12, 0xf4, + 0x15, 0xf4, 0x16, 0xf4, 0x02, 0xf4, 0xac, 0xf3, 0x30, 0xf3, 0xff, 0xf2, + 0x6b, 0xf3, 0x64, 0xf4, 0xaf, 0xf5, 0x01, 0xf7, 0x0b, 0xf8, 0xb5, 0xf8, + 0x3c, 0xf9, 0xdc, 0xf9, 0x9d, 0xfa, 0x72, 0xfb, 0x46, 0xfc, 0x08, 0xfd, + 0xb8, 0xfd, 0x5f, 0xfe, 0xf2, 0xfe, 0x71, 0xff, 0xf3, 0xff, 0x75, 0x00, + 0xe7, 0x00, 0x61, 0x01, 0xfc, 0x01, 0x96, 0x02, 0x15, 0x03, 0x9f, 0x03, + 0x44, 0x04, 0xcc, 0x04, 0x31, 0x05, 0xc3, 0x05, 0xb2, 0x06, 0xd4, 0x07, + 0xe7, 0x08, 0xc6, 0x09, 0x67, 0x0a, 0xe4, 0x0a, 0x6d, 0x0b, 0x10, 0x0c, + 0xbc, 0x0c, 0x61, 0x0d, 0xee, 0x0d, 0x4c, 0x0e, 0x6d, 0x0e, 0x58, 0x0e, + 0x24, 0x0e, 0xf4, 0x0d, 0xdf, 0x0d, 0xe1, 0x0d, 0xe7, 0x0d, 0xe0, 0x0d, + 0xa9, 0x0d, 0x32, 0x0d, 0xa4, 0x0c, 0x27, 0x0c, 0xab, 0x0b, 0x1d, 0x0b, + 0x9a, 0x0a, 0x36, 0x0a, 0xd2, 0x09, 0x60, 0x09, 0x02, 0x09, 0xc6, 0x08, + 0x95, 0x08, 0x59, 0x08, 0xfe, 0x07, 0x79, 0x07, 0xef, 0x06, 0x9a, 0x06, + 0x83, 0x06, 0x65, 0x06, 0xfc, 0x05, 0x40, 0x05, 0x59, 0x04, 0x6d, 0x03, + 0x99, 0x02, 0xfb, 0x01, 0xa4, 0x01, 0x67, 0x01, 0xf8, 0x00, 0x46, 0x00, + 0x7f, 0xff, 0xd1, 0xfe, 0x4b, 0xfe, 0xf8, 0xfd, 0xce, 0xfd, 0x9f, 0xfd, + 0x3e, 0xfd, 0xa3, 0xfc, 0xe8, 0xfb, 0x39, 0xfb, 0xc8, 0xfa, 0xb1, 0xfa, + 0xe9, 0xfa, 0x49, 0xfb, 0xa8, 0xfb, 0xee, 0xfb, 0x22, 0xfc, 0x60, 0xfc, + 0xb0, 0xfc, 0x09, 0xfd, 0x63, 0xfd, 0xb8, 0xfd, 0xf5, 0xfd, 0x14, 0xfe, + 0x3d, 0xfe, 0xa6, 0xfe, 0x48, 0xff, 0xcf, 0xff, 0xfd, 0xff, 0xea, 0xff, + 0xd0, 0xff, 0xd7, 0xff, 0x2b, 0x00, 0xf7, 0x00, 0x10, 0x02, 0xff, 0x02, + 0x6e, 0x03, 0x6b, 0x03, 0x3c, 0x03, 0x3e, 0x03, 0xc3, 0x03, 0xd3, 0x04, + 0x21, 0x06, 0x5a, 0x07, 0x4e, 0x08, 0xe4, 0x08, 0x2e, 0x09, 0x69, 0x09, + 0xc4, 0x09, 0x49, 0x0a, 0xf2, 0x0a, 0xa2, 0x0b, 0x1e, 0x0c, 0x5f, 0x0c, + 0xa7, 0x0c, 0x13, 0x0d, 0x73, 0x0d, 0xb2, 0x0d, 0xee, 0x0d, 0x11, 0x0e, + 0xd9, 0x0d, 0x4f, 0x0d, 0xd5, 0x0c, 0xad, 0x0c, 0xce, 0x0c, 0x18, 0x0d, + 0x6f, 0x0d, 0xb1, 0x0d, 0xc9, 0x0d, 0xbe, 0x0d, 0xad, 0x0d, 0xb1, 0x0d, + 0xc4, 0x0d, 0xba, 0x0d, 0x60, 0x0d, 0xae, 0x0c, 0xde, 0x0b, 0x48, 0x0b, + 0x10, 0x0b, 0x11, 0x0b, 0x1b, 0x0b, 0x1d, 0x0b, 0xe7, 0x0a, 0x2d, 0x0a, + 0xfb, 0x08, 0xca, 0x07, 0xed, 0x06, 0x4c, 0x06, 0xcd, 0x05, 0x70, 0x05, + 0x13, 0x05, 0x84, 0x04, 0xd8, 0x03, 0x51, 0x03, 0x07, 0x03, 0xdf, 0x02, + 0xb9, 0x02, 0x82, 0x02, 0x38, 0x02, 0xd4, 0x01, 0x42, 0x01, 0x77, 0x00, + 0xa9, 0xff, 0x22, 0xff, 0xf6, 0xfe, 0x02, 0xff, 0x21, 0xff, 0x35, 0xff, + 0x25, 0xff, 0xf2, 0xfe, 0xb9, 0xfe, 0x8c, 0xfe, 0x65, 0xfe, 0x3b, 0xfe, + 0x0d, 0xfe, 0xe1, 0xfd, 0xc3, 0xfd, 0xb9, 0xfd, 0xc0, 0xfd, 0xc9, 0xfd, + 0xd7, 0xfd, 0xfd, 0xfd, 0x38, 0xfe, 0x53, 0xfe, 0x29, 0xfe, 0xe9, 0xfd, + 0xd1, 0xfd, 0xd5, 0xfd, 0xc7, 0xfd, 0xb8, 0xfd, 0xd4, 0xfd, 0x26, 0xfe, + 0xa3, 0xfe, 0x44, 0xff, 0xfa, 0xff, 0xc0, 0x00, 0xa1, 0x01, 0x78, 0x02, + 0xed, 0x02, 0xf2, 0x02, 0xf3, 0x02, 0x53, 0x03, 0x0d, 0x04, 0xf0, 0x04, + 0xd9, 0x05, 0xa4, 0x06, 0x31, 0x07, 0x7f, 0x07, 0x9c, 0x07, 0x91, 0x07, + 0x76, 0x07, 0x65, 0x07, 0x6c, 0x07, 0x84, 0x07, 0x9f, 0x07, 0x97, 0x07, + 0x57, 0x07, 0xfb, 0x06, 0xb6, 0x06, 0xa5, 0x06, 0xc3, 0x06, 0x08, 0x07, + 0x6c, 0x07, 0xed, 0x07, 0x76, 0x08, 0xd4, 0x08, 0xe1, 0x08, 0xb8, 0x08, + 0x81, 0x08, 0x40, 0x08, 0x07, 0x08, 0x0e, 0x08, 0x4f, 0x08, 0x76, 0x08, + 0x56, 0x08, 0x14, 0x08, 0xc7, 0x07, 0x5c, 0x07, 0xcf, 0x06, 0x36, 0x06, + 0xa3, 0x05, 0x22, 0x05, 0xb2, 0x04, 0x43, 0x04, 0xd6, 0x03, 0x7e, 0x03, + 0x30, 0x03, 0xcd, 0x02, 0x60, 0x02, 0x07, 0x02, 0xbf, 0x01, 0x69, 0x01, + 0xf7, 0x00, 0x71, 0x00, 0xef, 0xff, 0x9b, 0xff, 0x87, 0xff, 0x99, 0xff, + 0xb0, 0xff, 0xb5, 0xff, 0x83, 0xff, 0x00, 0xff, 0x4d, 0xfe, 0xac, 0xfd, + 0x32, 0xfd, 0xcb, 0xfc, 0x7a, 0xfc, 0x4c, 0xfc, 0x22, 0xfc, 0xc8, 0xfb, + 0x2c, 0xfb, 0x71, 0xfa, 0xe1, 0xf9, 0xbb, 0xf9, 0xe4, 0xf9, 0x05, 0xfa, + 0xf8, 0xf9, 0xda, 0xf9, 0xc5, 0xf9, 0xc9, 0xf9, 0xfc, 0xf9, 0x5e, 0xfa, + 0xcf, 0xfa, 0x41, 0xfb, 0xa5, 0xfb, 0xd5, 0xfb, 0xc0, 0xfb, 0x9c, 0xfb, + 0xa5, 0xfb, 0xde, 0xfb, 0x2b, 0xfc, 0x7b, 0xfc, 0xc8, 0xfc, 0x09, 0xfd, + 0x29, 0xfd, 0x11, 0xfd, 0xca, 0xfc, 0x83, 0xfc, 0x67, 0xfc, 0x7f, 0xfc, + 0xc4, 0xfc, 0x33, 0xfd, 0xbe, 0xfd, 0x41, 0xfe, 0x91, 0xfe, 0xb4, 0xfe, + 0xdf, 0xfe, 0x42, 0xff, 0xde, 0xff, 0x98, 0x00, 0x5a, 0x01, 0x06, 0x02, + 0x80, 0x02, 0xbe, 0x02, 0xc4, 0x02, 0x9b, 0x02, 0x51, 0x02, 0xfc, 0x01, + 0xa2, 0x01, 0x44, 0x01, 0xeb, 0x00, 0xb2, 0x00, 0xa6, 0x00, 0xbd, 0x00, + 0xea, 0x00, 0x28, 0x01, 0x4e, 0x01, 0x1a, 0x01, 0x84, 0x00, 0xdd, 0xff, + 0x77, 0xff, 0x63, 0xff, 0xa2, 0xff, 0x2b, 0x00, 0xc8, 0x00, 0x36, 0x01, + 0x68, 0x01, 0x78, 0x01, 0x75, 0x01, 0x67, 0x01, 0x5b, 0x01, 0x4f, 0x01, + 0x17, 0x01, 0x9f, 0x00, 0x24, 0x00, 0xf6, 0xff, 0x1a, 0x00, 0x5e, 0x00, + 0xa2, 0x00, 0xc4, 0x00, 0x87, 0x00, 0xd6, 0xff, 0x04, 0xff, 0x6f, 0xfe, + 0x2d, 0xfe, 0x19, 0xfe, 0x08, 0xfe, 0xd6, 0xfd, 0x7e, 0xfd, 0x19, 0xfd, + 0xba, 0xfc, 0x77, 0xfc, 0x8b, 0xfc, 0x25, 0xfd, 0x33, 0xfe, 0x7c, 0xff, + 0xcb, 0x00, 0xf1, 0x01, 0xd3, 0x02, 0x7b, 0x03, 0x07, 0x04, 0x7e, 0x04, + 0xd3, 0x04, 0xff, 0x04, 0x0e, 0x05, 0x16, 0x05, 0x0a, 0x05, 0xae, 0x04, + 0xbc, 0x03, 0x18, 0x02, 0xd4, 0xff, 0x22, 0xfd, 0x43, 0xfa, 0x8f, 0xf7, + 0x68, 0xf5, 0x05, 0xf4, 0x5b, 0xf3, 0x32, 0xf3, 0x59, 0xf3, 0xd8, 0xf3, + 0xf8, 0xf4, 0xf1, 0xf6, 0x91, 0xf9, 0x6f, 0xfc, 0x4d, 0xff, 0xdc, 0x01, + 0x60, 0x03, 0x16, 0x03, 0xfb, 0x00, 0xb0, 0xfd, 0xc2, 0xf9, 0x65, 0xf5, + 0xe2, 0xf0, 0xe1, 0xec, 0xf3, 0xe9, 0x03, 0xe8, 0xa6, 0xe6, 0xdb, 0xe5, + 0x09, 0xe6, 0x5a, 0xe7, 0x97, 0xe9, 0x64, 0xec, 0x51, 0xef, 0xde, 0xf1, + 0xcd, 0xf3, 0x1d, 0xf5, 0xb1, 0xf5, 0x4c, 0xf5, 0xfb, 0xf3, 0x3d, 0xf2, + 0xae, 0xf0, 0x95, 0xef, 0xe1, 0xee, 0x93, 0xee, 0xf4, 0xee, 0x37, 0xf0, + 0x16, 0xf2, 0x09, 0xf4, 0xc9, 0xf5, 0x6a, 0xf7, 0xec, 0xf8, 0xf7, 0xf9, + 0x4c, 0xfa, 0x1c, 0xfa, 0xa4, 0xf9, 0xcb, 0xf8, 0x87, 0xf7, 0x1e, 0xf6, + 0xc5, 0xf4, 0x76, 0xf3, 0x65, 0xf2, 0x1a, 0xf2, 0xe0, 0xf2, 0x84, 0xf4, + 0xb9, 0xf6, 0x6c, 0xf9, 0x96, 0xfc, 0xf6, 0xff, 0x32, 0x03, 0x15, 0x06, + 0x85, 0x08, 0x65, 0x0a, 0x97, 0x0b, 0x15, 0x0c, 0xda, 0x0b, 0x04, 0x0b, + 0xdc, 0x09, 0x9d, 0x08, 0x52, 0x07, 0x0c, 0x06, 0xe9, 0x04, 0x05, 0x04, + 0x6e, 0x03, 0x26, 0x03, 0x27, 0x03, 0x76, 0x03, 0x07, 0x04, 0x95, 0x04, + 0xe8, 0x04, 0x0a, 0x05, 0x10, 0x05, 0xee, 0x04, 0xba, 0x04, 0xb3, 0x04, + 0xf6, 0x04, 0x73, 0x05, 0x1a, 0x06, 0xcf, 0x06, 0x53, 0x07, 0x6e, 0x07, + 0x2d, 0x07, 0xe7, 0x06, 0xd1, 0x06, 0xc2, 0x06, 0x89, 0x06, 0x45, 0x06, + 0x15, 0x06, 0xce, 0x05, 0x3a, 0x05, 0x4a, 0x04, 0xfc, 0x02, 0x5f, 0x01, + 0xa3, 0xff, 0xf0, 0xfd, 0x72, 0xfc, 0x79, 0xfb, 0x21, 0xfb, 0x00, 0xfb, + 0x98, 0xfa, 0xe7, 0xf9, 0x31, 0xf9, 0x81, 0xf8, 0xcd, 0xf7, 0x50, 0xf7, + 0x66, 0xf7, 0x1f, 0xf8, 0x1f, 0xf9, 0x01, 0xfa, 0xa1, 0xfa, 0x19, 0xfb, + 0x83, 0xfb, 0xdc, 0xfb, 0x0a, 0xfc, 0xf5, 0xfb, 0xa1, 0xfb, 0x23, 0xfb, + 0x9e, 0xfa, 0x3d, 0xfa, 0x15, 0xfa, 0x06, 0xfa, 0xec, 0xf9, 0xb3, 0xf9, + 0x4a, 0xf9, 0xba, 0xf8, 0x5c, 0xf8, 0xa2, 0xf8, 0x96, 0xf9, 0xca, 0xfa, + 0xcb, 0xfb, 0x6f, 0xfc, 0xbe, 0xfc, 0xbd, 0xfc, 0x6c, 0xfc, 0xd8, 0xfb, + 0x15, 0xfb, 0x34, 0xfa, 0x50, 0xf9, 0x99, 0xf8, 0x54, 0xf8, 0xbf, 0xf8, + 0xd2, 0xf9, 0x23, 0xfb, 0x3f, 0xfc, 0x27, 0xfd, 0x14, 0xfe, 0xf4, 0xfe, + 0x90, 0xff, 0xf3, 0xff, 0x50, 0x00, 0x9a, 0x00, 0x8d, 0x00, 0xfc, 0xff, + 0x02, 0xff, 0x0c, 0xfe, 0x9d, 0xfd, 0xed, 0xfd, 0xcd, 0xfe, 0x0b, 0x00, + 0x94, 0x01, 0x08, 0x03, 0xb5, 0x03, 0x7b, 0x03, 0x3b, 0x03, 0xd6, 0x03, + 0x2a, 0x05, 0x8a, 0x06, 0xae, 0x07, 0xb3, 0x08, 0xb1, 0x09, 0x9b, 0x0a, + 0x41, 0x0b, 0x6a, 0x0b, 0x0e, 0x0b, 0x57, 0x0a, 0x62, 0x09, 0x52, 0x08, + 0x75, 0x07, 0x02, 0x07, 0xdb, 0x06, 0xa9, 0x06, 0x40, 0x06, 0xd8, 0x05, + 0xc1, 0x05, 0xe5, 0x05, 0x00, 0x06, 0x3d, 0x06, 0xe2, 0x06, 0xac, 0x07, + 0x37, 0x08, 0x7b, 0x08, 0x5a, 0x08, 0x7c, 0x07, 0x0d, 0x06, 0xb4, 0x04, + 0xb7, 0x03, 0xfb, 0x02, 0x92, 0x02, 0x83, 0x02, 0x7b, 0x02, 0x44, 0x02, + 0x1e, 0x02, 0x49, 0x02, 0x90, 0x02, 0x88, 0x02, 0x10, 0x02, 0x5e, 0x01, + 0xaf, 0x00, 0x2a, 0x00, 0xda, 0xff, 0x9d, 0xff, 0x2f, 0xff, 0x6e, 0xfe, + 0x88, 0xfd, 0xbd, 0xfc, 0x10, 0xfc, 0x79, 0xfb, 0x20, 0xfb, 0x29, 0xfb, + 0x84, 0xfb, 0x22, 0xfc, 0x01, 0xfd, 0xef, 0xfd, 0x8d, 0xfe, 0xc9, 0xfe, + 0xf4, 0xfe, 0x3f, 0xff, 0x74, 0xff, 0x50, 0xff, 0xd8, 0xfe, 0x3a, 0xfe, + 0xab, 0xfd, 0x4d, 0xfd, 0x0e, 0xfd, 0xd8, 0xfc, 0xbe, 0xfc, 0xc8, 0xfc, + 0xd5, 0xfc, 0xe0, 0xfc, 0x18, 0xfd, 0x8b, 0xfd, 0x03, 0xfe, 0x3f, 0xfe, + 0x27, 0xfe, 0xf2, 0xfd, 0xfa, 0xfd, 0x68, 0xfe, 0xf4, 0xfe, 0x38, 0xff, + 0x36, 0xff, 0x4c, 0xff, 0xa5, 0xff, 0x09, 0x00, 0x40, 0x00, 0x56, 0x00, + 0x7f, 0x00, 0xe2, 0x00, 0x86, 0x01, 0x51, 0x02, 0x1a, 0x03, 0xd6, 0x03, + 0x7d, 0x04, 0xdf, 0x04, 0xfe, 0x04, 0x35, 0x05, 0x9b, 0x05, 0xd5, 0x05, + 0xc8, 0x05, 0xc9, 0x05, 0x05, 0x06, 0x4f, 0x06, 0x83, 0x06, 0xb1, 0x06, + 0x04, 0x07, 0xa1, 0x07, 0x7f, 0x08, 0x5e, 0x09, 0x0c, 0x0a, 0x85, 0x0a, + 0xc8, 0x0a, 0xd5, 0x0a, 0xc2, 0x0a, 0xa3, 0x0a, 0x6e, 0x0a, 0x09, 0x0a, + 0x5e, 0x09, 0x8f, 0x08, 0xf4, 0x07, 0xae, 0x07, 0x92, 0x07, 0x89, 0x07, + 0x8e, 0x07, 0x69, 0x07, 0xe5, 0x06, 0x20, 0x06, 0x63, 0x05, 0xc6, 0x04, + 0x3e, 0x04, 0xce, 0x03, 0x8e, 0x03, 0x80, 0x03, 0x8d, 0x03, 0xa4, 0x03, + 0xcd, 0x03, 0x09, 0x04, 0x25, 0x04, 0xee, 0x03, 0x87, 0x03, 0x32, 0x03, + 0xf7, 0x02, 0xbb, 0x02, 0x68, 0x02, 0xf7, 0x01, 0x7e, 0x01, 0x0c, 0x01, + 0x94, 0x00, 0x22, 0x00, 0xd2, 0xff, 0x9a, 0xff, 0x56, 0xff, 0xfb, 0xfe, + 0x82, 0xfe, 0xda, 0xfd, 0xf1, 0xfc, 0xdb, 0xfb, 0xcd, 0xfa, 0xd7, 0xf9, + 0xe4, 0xf8, 0x2f, 0xf8, 0x15, 0xf8, 0x78, 0xf8, 0xf6, 0xf8, 0x6f, 0xf9, + 0xbf, 0xf9, 0xbb, 0xf9, 0xa7, 0xf9, 0xf1, 0xf9, 0x81, 0xfa, 0xfe, 0xfa, + 0x68, 0xfb, 0xe7, 0xfb, 0x6d, 0xfc, 0xd6, 0xfc, 0x03, 0xfd, 0xe3, 0xfc, + 0x8f, 0xfc, 0x4b, 0xfc, 0x3c, 0xfc, 0x45, 0xfc, 0x3a, 0xfc, 0x0d, 0xfc, + 0xd0, 0xfb, 0xac, 0xfb, 0xd9, 0xfb, 0x5c, 0xfc, 0xfd, 0xfc, 0x90, 0xfd, + 0x1c, 0xfe, 0x8f, 0xfe, 0xc0, 0xfe, 0xe3, 0xfe, 0x67, 0xff, 0x3d, 0x00, + 0xdb, 0x00, 0x0c, 0x01, 0x05, 0x01, 0xf7, 0x00, 0x16, 0x01, 0x98, 0x01, + 0x54, 0x02, 0xfc, 0x02, 0x85, 0x03, 0xf3, 0x03, 0x14, 0x04, 0xc0, 0x03, + 0x14, 0x03, 0x60, 0x02, 0xd6, 0x01, 0x60, 0x01, 0x1b, 0x01, 0x7d, 0x01, + 0x8c, 0x02, 0x7a, 0x03, 0x93, 0x03, 0x26, 0x03, 0xfb, 0x02, 0x29, 0x03, + 0x21, 0x03, 0xb3, 0x02, 0x75, 0x02, 0xe3, 0x02, 0xb9, 0x03, 0x48, 0x04, + 0x20, 0x04, 0x45, 0x03, 0x0e, 0x02, 0xdf, 0x00, 0xe8, 0xff, 0x28, 0xff, + 0xa6, 0xfe, 0x7d, 0xfe, 0xad, 0xfe, 0x03, 0xff, 0x1a, 0xff, 0xaf, 0xfe, + 0xfe, 0xfd, 0x80, 0xfd, 0x45, 0xfd, 0xe7, 0xfc, 0x31, 0xfc, 0x7c, 0xfb, + 0x41, 0xfb, 0x7e, 0xfb, 0xc9, 0xfb, 0xd4, 0xfb, 0x8b, 0xfb, 0x11, 0xfb, + 0xbc, 0xfa, 0xb4, 0xfa, 0xd1, 0xfa, 0xef, 0xfa, 0x26, 0xfb, 0x8c, 0xfb, + 0x03, 0xfc, 0x46, 0xfc, 0x27, 0xfc, 0xbf, 0xfb, 0x57, 0xfb, 0x1e, 0xfb, + 0x06, 0xfb, 0xf3, 0xfa, 0xeb, 0xfa, 0xef, 0xfa, 0xdc, 0xfa, 0xa0, 0xfa, + 0x42, 0xfa, 0xa0, 0xf9, 0x9d, 0xf8, 0x7e, 0xf7, 0xaf, 0xf6, 0x5a, 0xf6, + 0x62, 0xf6, 0xa7, 0xf6, 0x29, 0xf7, 0xf5, 0xf7, 0x07, 0xf9, 0x3b, 0xfa, + 0x56, 0xfb, 0x57, 0xfc, 0x78, 0xfd, 0x9a, 0xfe, 0x33, 0xff, 0x13, 0xff, + 0xb1, 0xfe, 0xa3, 0xfe, 0x30, 0xff, 0x3f, 0x00, 0x7d, 0x01, 0x8d, 0x02, + 0x10, 0x03, 0xc8, 0x02, 0xea, 0x01, 0x04, 0x01, 0x72, 0x00, 0x2c, 0x00, + 0x16, 0x00, 0x26, 0x00, 0x3b, 0x00, 0x1f, 0x00, 0xcd, 0xff, 0x81, 0xff, + 0x81, 0xff, 0xe4, 0xff, 0x7b, 0x00, 0x1f, 0x01, 0xff, 0x01, 0x46, 0x03, + 0xa1, 0x04, 0x9f, 0x05, 0x24, 0x06, 0x4f, 0x06, 0x46, 0x06, 0x3d, 0x06, + 0x69, 0x06, 0xed, 0x06, 0xad, 0x07, 0x54, 0x08, 0x91, 0x08, 0x4e, 0x08, + 0x99, 0x07, 0x80, 0x06, 0x36, 0x05, 0x18, 0x04, 0x71, 0x03, 0x47, 0x03, + 0x7e, 0x03, 0xf4, 0x03, 0x5d, 0x04, 0x59, 0x04, 0xde, 0x03, 0x3c, 0x03, + 0xaa, 0x02, 0x19, 0x02, 0x8c, 0x01, 0x4c, 0x01, 0x84, 0x01, 0x17, 0x02, + 0xd8, 0x02, 0x99, 0x03, 0x1d, 0x04, 0x3c, 0x04, 0x02, 0x04, 0x99, 0x03, + 0x1e, 0x03, 0x92, 0x02, 0xfa, 0x01, 0x84, 0x01, 0x5f, 0x01, 0x5f, 0x01, + 0x1b, 0x01, 0x65, 0x00, 0x69, 0xff, 0x7a, 0xfe, 0xcd, 0xfd, 0x63, 0xfd, + 0x34, 0xfd, 0x53, 0xfd, 0xb4, 0xfd, 0xfb, 0xfd, 0xd9, 0xfd, 0x64, 0xfd, + 0xdc, 0xfc, 0x67, 0xfc, 0x13, 0xfc, 0xf7, 0xfb, 0x2f, 0xfc, 0xd3, 0xfc, + 0xc6, 0xfd, 0xbd, 0xfe, 0x7d, 0xff, 0xe2, 0xff, 0xc4, 0xff, 0x27, 0xff, + 0x5d, 0xfe, 0xb4, 0xfd, 0x3f, 0xfd, 0x06, 0xfd, 0x27, 0xfd, 0xa0, 0xfd, + 0x3e, 0xfe, 0xc2, 0xfe, 0x0c, 0xff, 0x0e, 0xff, 0xb7, 0xfe, 0x05, 0xfe, + 0x3a, 0xfd, 0xd6, 0xfc, 0x24, 0xfd, 0xe1, 0xfd, 0x93, 0xfe, 0x10, 0xff, + 0x7d, 0xff, 0xec, 0xff, 0x33, 0x00, 0x3c, 0x00, 0x33, 0x00, 0x4e, 0x00, + 0x8f, 0x00, 0xe9, 0x00, 0x66, 0x01, 0x01, 0x02, 0x91, 0x02, 0xdd, 0x02, + 0xc9, 0x02, 0x6b, 0x02, 0x13, 0x02, 0x0f, 0x02, 0x66, 0x02, 0xf3, 0x02, + 0x90, 0x03, 0x0d, 0x04, 0x41, 0x04, 0x3c, 0x04, 0x2e, 0x04, 0x05, 0x04, + 0x97, 0x03, 0x13, 0x03, 0xe2, 0x02, 0x19, 0x03, 0x6e, 0x03, 0xa7, 0x03, + 0xb2, 0x03, 0x6a, 0x03, 0xac, 0x02, 0xaf, 0x01, 0xe7, 0x00, 0x7c, 0x00, + 0x48, 0x00, 0x43, 0x00, 0x87, 0x00, 0x03, 0x01, 0x7e, 0x01, 0xd4, 0x01, + 0xff, 0x01, 0xee, 0x01, 0x8c, 0x01, 0xee, 0x00, 0x62, 0x00, 0x30, 0x00, + 0x5d, 0x00, 0xc6, 0x00, 0x44, 0x01, 0xa0, 0x01, 0x9f, 0x01, 0x47, 0x01, + 0xd8, 0x00, 0x7a, 0x00, 0x21, 0x00, 0xb3, 0xff, 0x36, 0xff, 0xd7, 0xfe, + 0xad, 0xfe, 0xa1, 0xfe, 0x9e, 0xfe, 0xa2, 0xfe, 0x91, 0xfe, 0x41, 0xfe, + 0xb9, 0xfd, 0x27, 0xfd, 0xb9, 0xfc, 0x96, 0xfc, 0xbe, 0xfc, 0x06, 0xfd, + 0x52, 0xfd, 0x93, 0xfd, 0xa4, 0xfd, 0x75, 0xfd, 0x40, 0xfd, 0x4e, 0xfd, + 0xb5, 0xfd, 0x5e, 0xfe, 0x18, 0xff, 0xb9, 0xff, 0x3a, 0x00, 0x9c, 0x00, + 0xcd, 0x00, 0xd3, 0x00, 0xb6, 0x00, 0x69, 0x00, 0xff, 0xff, 0xc2, 0xff, + 0xcc, 0xff, 0xdc, 0xff, 0xbf, 0xff, 0x85, 0xff, 0x4e, 0xff, 0x2e, 0xff, + 0x2e, 0xff, 0x2c, 0xff, 0x08, 0xff, 0xf3, 0xfe, 0x2d, 0xff, 0x91, 0xff, + 0xcf, 0xff, 0x03, 0x00, 0x6e, 0x00, 0xf1, 0x00, 0x55, 0x01, 0xb8, 0x01, + 0x38, 0x02, 0xc5, 0x02, 0x57, 0x03, 0xdc, 0x03, 0x2b, 0x04, 0x47, 0x04, + 0x67, 0x04, 0x8a, 0x04, 0x7b, 0x04, 0x2d, 0x04, 0xbe, 0x03, 0x43, 0x03, + 0xc8, 0x02, 0x50, 0x02, 0xe2, 0x01, 0x97, 0x01, 0x7c, 0x01, 0x86, 0x01, + 0xac, 0x01, 0xed, 0x01, 0x31, 0x02, 0x60, 0x02, 0x73, 0x02, 0x67, 0x02, + 0x4c, 0x02, 0x56, 0x02, 0xae, 0x02, 0x3d, 0x03, 0xca, 0x03, 0x34, 0x04, + 0x7d, 0x04, 0xa1, 0x04, 0x86, 0x04, 0x2d, 0x04, 0xc3, 0x03, 0x76, 0x03, + 0x54, 0x03, 0x46, 0x03, 0x29, 0x03, 0xfc, 0x02, 0xcd, 0x02, 0x87, 0x02, + 0x17, 0x02, 0x97, 0x01, 0x26, 0x01, 0xbf, 0x00, 0x68, 0x00, 0x31, 0x00, + 0x0a, 0x00, 0xf3, 0xff, 0x09, 0x00, 0x41, 0x00, 0x65, 0x00, 0x68, 0x00, + 0x5a, 0x00, 0x42, 0x00, 0x38, 0x00, 0x5c, 0x00, 0xa3, 0x00, 0xef, 0x00, + 0x25, 0x01, 0x29, 0x01, 0xed, 0x00, 0x80, 0x00, 0x00, 0x00, 0x95, 0xff, + 0x60, 0xff, 0x6a, 0xff, 0xa4, 0xff, 0xf1, 0xff, 0x24, 0x00, 0x1e, 0x00, + 0xdd, 0xff, 0x59, 0xff, 0x99, 0xfe, 0xe1, 0xfd, 0x67, 0xfd, 0x12, 0xfd, + 0xcd, 0xfc, 0xbe, 0xfc, 0x03, 0xfd, 0x7a, 0xfd, 0xe4, 0xfd, 0x17, 0xfe, + 0x1d, 0xfe, 0x1c, 0xfe, 0x17, 0xfe, 0x0c, 0xfe, 0x22, 0xfe, 0x78, 0xfe, + 0xf9, 0xfe, 0x80, 0xff, 0xf5, 0xff, 0x38, 0x00, 0x28, 0x00, 0xc0, 0xff, + 0x32, 0xff, 0xc7, 0xfe, 0x8d, 0xfe, 0x4e, 0xfe, 0x04, 0xfe, 0xe9, 0xfd, + 0x09, 0xfe, 0x2d, 0xfe, 0x37, 0xfe, 0x2e, 0xfe, 0x0c, 0xfe, 0xcc, 0xfd, + 0x95, 0xfd, 0x9b, 0xfd, 0xef, 0xfd, 0x60, 0xfe, 0xa9, 0xfe, 0xb4, 0xfe, + 0x8c, 0xfe, 0x3c, 0xfe, 0xd4, 0xfd, 0x8e, 0xfd, 0xab, 0xfd, 0x2f, 0xfe, + 0xe5, 0xfe, 0x9d, 0xff, 0x3e, 0x00, 0x99, 0x00, 0x86, 0x00, 0x23, 0x00, + 0xc0, 0xff, 0x84, 0xff, 0x69, 0xff, 0x6b, 0xff, 0x7a, 0xff, 0x77, 0xff, + 0x5e, 0xff, 0x45, 0xff, 0x2e, 0xff, 0x19, 0xff, 0x0f, 0xff, 0x03, 0xff, + 0xde, 0xfe, 0xa0, 0xfe, 0x65, 0xfe, 0x55, 0xfe, 0x87, 0xfe, 0xdc, 0xfe, + 0x25, 0xff, 0x59, 0xff, 0x7f, 0xff, 0x88, 0xff, 0x7a, 0xff, 0x86, 0xff, + 0xbc, 0xff, 0xfc, 0xff, 0x2a, 0x00, 0x3a, 0x00, 0x22, 0x00, 0xed, 0xff, + 0xba, 0xff, 0x9b, 0xff, 0x87, 0xff, 0x73, 0xff, 0x66, 0xff, 0x75, 0xff, + 0xb8, 0xff, 0x2d, 0x00, 0xa3, 0x00, 0xe3, 0x00, 0xe1, 0x00, 0xa3, 0x00, + 0x31, 0x00, 0xa4, 0xff, 0x2a, 0xff, 0xed, 0xfe, 0xf9, 0xfe, 0x30, 0xff, + 0x5c, 0xff, 0x6d, 0xff, 0x8e, 0xff, 0xcd, 0xff, 0xf6, 0xff, 0xde, 0xff, + 0x97, 0xff, 0x43, 0xff, 0xf6, 0xfe, 0xd4, 0xfe, 0x00, 0xff, 0x75, 0xff, + 0x02, 0x00, 0x70, 0x00, 0x92, 0x00, 0x5d, 0x00, 0xe5, 0xff, 0x59, 0xff, + 0xf0, 0xfe, 0xcd, 0xfe, 0xd5, 0xfe, 0xd1, 0xfe, 0xbc, 0xfe, 0xb1, 0xfe, + 0xb0, 0xfe, 0xae, 0xfe, 0xc6, 0xfe, 0x13, 0xff, 0x86, 0xff, 0xfe, 0xff, + 0x4e, 0x00, 0x53, 0x00, 0x28, 0x00, 0x0e, 0x00, 0x0a, 0x00, 0xef, 0xff, + 0xb6, 0xff, 0x7e, 0xff, 0x50, 0xff, 0x25, 0xff, 0xfe, 0xfe, 0xd1, 0xfe, + 0xa1, 0xfe, 0x8c, 0xfe, 0x91, 0xfe, 0x84, 0xfe, 0x54, 0xfe, 0x23, 0xfe, + 0xf5, 0xfd, 0xb8, 0xfd, 0x8b, 0xfd, 0xaa, 0xfd, 0x0d, 0xfe, 0x7b, 0xfe, + 0xd0, 0xfe, 0x0d, 0xff, 0x35, 0xff, 0x4d, 0xff, 0x5e, 0xff, 0x61, 0xff, + 0x54, 0xff, 0x5a, 0xff, 0x89, 0xff, 0xce, 0xff, 0x0e, 0x00, 0x49, 0x00, + 0x7d, 0x00, 0x97, 0x00, 0x8b, 0x00, 0x5f, 0x00, 0x12, 0x00, 0xa1, 0xff, + 0x1e, 0xff, 0xa0, 0xfe, 0x3b, 0xfe, 0x05, 0xfe, 0x08, 0xfe, 0x2c, 0xfe, + 0x45, 0xfe, 0x52, 0xfe, 0x75, 0xfe, 0xba, 0xfe, 0x09, 0xff, 0x4c, 0xff, + 0x7d, 0xff, 0x98, 0xff, 0xa3, 0xff, 0xa7, 0xff, 0xa3, 0xff, 0xad, 0xff, + 0xea, 0xff, 0x55, 0x00, 0xb7, 0x00, 0xeb, 0x00, 0xf8, 0x00, 0xfa, 0x00, + 0x08, 0x01, 0x18, 0x01, 0x02, 0x01, 0xbf, 0x00, 0x71, 0x00, 0x34, 0x00, + 0xfe, 0xff, 0xcf, 0xff, 0xb8, 0xff, 0xc1, 0xff, 0xe4, 0xff, 0x12, 0x00, + 0x1e, 0x00, 0xf1, 0xff, 0xab, 0xff, 0x80, 0xff, 0x77, 0xff, 0x85, 0xff, + 0xa5, 0xff, 0xd0, 0xff, 0x09, 0x00, 0x56, 0x00, 0xa1, 0x00, 0xcc, 0x00, + 0xe8, 0x00, 0x0e, 0x01, 0x2b, 0x01, 0x21, 0x01, 0x06, 0x01, 0xfe, 0x00, + 0x0d, 0x01, 0x28, 0x01, 0x48, 0x01, 0x5a, 0x01, 0x3f, 0x01, 0x01, 0x01, + 0xcc, 0x00, 0xb1, 0x00, 0x93, 0x00, 0x5d, 0x00, 0x24, 0x00, 0x06, 0x00, + 0xfd, 0xff, 0xe0, 0xff, 0x96, 0xff, 0x32, 0xff, 0xdc, 0xfe, 0xaf, 0xfe, + 0xbd, 0xfe, 0x12, 0xff, 0x90, 0xff, 0xf8, 0xff, 0x1b, 0x00, 0x02, 0x00, + 0xe4, 0xff, 0xe8, 0xff, 0xef, 0xff, 0xdd, 0xff, 0xbd, 0xff, 0x9f, 0xff, + 0x7d, 0xff, 0x5b, 0xff, 0x41, 0xff, 0x3d, 0xff, 0x5f, 0xff, 0x96, 0xff, + 0xb1, 0xff, 0xa3, 0xff, 0x90, 0xff, 0x99, 0xff, 0xb3, 0xff, 0xb4, 0xff, + 0x85, 0xff, 0x48, 0xff, 0x39, 0xff, 0x5d, 0xff, 0x81, 0xff, 0x84, 0xff, + 0x8c, 0xff, 0xc7, 0xff, 0x22, 0x00, 0x68, 0x00, 0x90, 0x00, 0xa8, 0x00, + 0xab, 0x00, 0x8c, 0x00, 0x50, 0x00, 0x12, 0x00, 0xf3, 0xff, 0xf2, 0xff, + 0xe7, 0xff, 0xa9, 0xff, 0x4a, 0xff, 0x11, 0xff, 0x29, 0xff, 0x79, 0xff, + 0xbe, 0xff, 0xd7, 0xff, 0xde, 0xff, 0xe9, 0xff, 0xdb, 0xff, 0xa7, 0xff, + 0x85, 0xff, 0x9d, 0xff, 0xd3, 0xff, 0x0a, 0x00, 0x4f, 0x00, 0xb3, 0x00, + 0x20, 0x01, 0x6a, 0x01, 0x88, 0x01, 0xa8, 0x01, 0xe6, 0x01, 0x14, 0x02, + 0x05, 0x02, 0xdd, 0x01, 0xb6, 0x01, 0x71, 0x01, 0x0b, 0x01, 0xa5, 0x00, + 0x45, 0x00, 0xe2, 0xff, 0x94, 0xff, 0x69, 0xff, 0x64, 0xff, 0x80, 0xff, + 0x9f, 0xff, 0xa9, 0xff, 0xa4, 0xff, 0x97, 0xff, 0x76, 0xff, 0x43, 0xff, + 0x12, 0xff, 0xf8, 0xfe, 0xf9, 0xfe, 0x05, 0xff, 0x21, 0xff, 0x5b, 0xff, + 0x95, 0xff, 0xb9, 0xff, 0xe2, 0xff, 0x20, 0x00, 0x5d, 0x00, 0x81, 0x00, + 0x73, 0x00, 0x2e, 0x00, 0xca, 0xff, 0x58, 0xff, 0xe6, 0xfe, 0x95, 0xfe, + 0x62, 0xfe, 0x28, 0xfe, 0xea, 0xfd, 0xc5, 0xfd, 0xb3, 0xfd, 0xa8, 0xfd, + 0xb0, 0xfd, 0xd4, 0xfd, 0x06, 0xfe, 0x22, 0xfe, 0x1c, 0xfe, 0x12, 0xfe, + 0x26, 0xfe, 0x45, 0xfe, 0x58, 0xfe, 0x6d, 0xfe, 0x8e, 0xfe, 0xae, 0xfe, + 0xce, 0xfe, 0xf7, 0xfe, 0x20, 0xff, 0x31, 0xff, 0x35, 0xff, 0x4a, 0xff, + 0x6e, 0xff, 0x8c, 0xff, 0xa7, 0xff, 0xc1, 0xff, 0xd7, 0xff, 0xe1, 0xff, + 0xd8, 0xff, 0xd1, 0xff, 0xe3, 0xff, 0xf8, 0xff, 0xfe, 0xff, 0x0c, 0x00, + 0x1b, 0x00, 0x0d, 0x00, 0xf3, 0xff, 0xee, 0xff, 0x12, 0x00, 0x51, 0x00, + 0x82, 0x00, 0x96, 0x00, 0xa5, 0x00, 0xcb, 0x00, 0x09, 0x01, 0x4c, 0x01, + 0x79, 0x01, 0x88, 0x01, 0xa7, 0x01, 0x0e, 0x02, 0x84, 0x02, 0xb2, 0x02, + 0xae, 0x02, 0xbd, 0x02, 0xd4, 0x02, 0xad, 0x02, 0x30, 0x02, 0xb4, 0x01, + 0x88, 0x01, 0x68, 0x01, 0x0a, 0x01, 0xbe, 0x00, 0xd1, 0x00, 0xfe, 0x00, + 0xdf, 0x00, 0x95, 0x00, 0x93, 0x00, 0xcb, 0x00, 0xbe, 0x00, 0x56, 0x00, + 0xf9, 0xff, 0xfe, 0xff, 0x3c, 0x00, 0x20, 0x00, 0x72, 0xff, 0xc4, 0xfe, + 0xc6, 0xfe, 0x48, 0xff, 0x63, 0xff, 0xc6, 0xfe, 0x40, 0xfe, 0x55, 0xfe, + 0x77, 0xfe, 0x20, 0xfe, 0xa1, 0xfd, 0x76, 0xfd, 0x70, 0xfd, 0x10, 0xfd, + 0x6e, 0xfc, 0x17, 0xfc, 0x1d, 0xfc, 0x20, 0xfc, 0x15, 0xfc, 0x4d, 0xfc, + 0xc0, 0xfc, 0xcf, 0xfc, 0x40, 0xfc, 0xd7, 0xfb, 0x2b, 0xfc, 0xb3, 0xfc, + 0xbf, 0xfc, 0x68, 0xfc, 0x1a, 0xfc, 0xfe, 0xfb, 0x20, 0xfc, 0x98, 0xfc, + 0x1e, 0xfd, 0x27, 0xfd, 0xb0, 0xfc, 0x4b, 0xfc, 0x33, 0xfc, 0x00, 0xfc, + 0x91, 0xfb, 0x84, 0xfb, 0x61, 0xfc, 0xdd, 0xfd, 0x5e, 0xff, 0x99, 0x00, + 0x85, 0x01, 0x19, 0x02, 0x5f, 0x02, 0xab, 0x02, 0x49, 0x03, 0x22, 0x04, + 0x08, 0x05, 0xc7, 0x05, 0x0d, 0x06, 0xfd, 0x05, 0x0d, 0x06, 0x32, 0x06, + 0x50, 0x06, 0xc3, 0x06, 0x97, 0x07, 0x40, 0x08, 0x69, 0x08, 0x3c, 0x08, + 0xf5, 0x07, 0xa4, 0x07, 0x54, 0x07, 0x07, 0x07, 0xc3, 0x06, 0xb4, 0x06, + 0x3c, 0x07, 0x96, 0x08, 0x65, 0x0a, 0x01, 0x0c, 0x34, 0x0d, 0x2c, 0x0e, + 0xee, 0x0e, 0x64, 0x0f, 0x91, 0x0f, 0xa1, 0x0f, 0xda, 0x0f, 0x31, 0x10, + 0x34, 0x10, 0x84, 0x0f, 0x16, 0x0e, 0x68, 0x0c, 0x36, 0x0b, 0xa4, 0x0a, + 0x4d, 0x0a, 0xdd, 0x09, 0x59, 0x09, 0x69, 0x09, 0x84, 0x0a, 0x6f, 0x0b, + 0x8b, 0x0a, 0x70, 0x08, 0x31, 0x07, 0x72, 0x07, 0x19, 0x08, 0xa4, 0x08, + 0xfa, 0x09, 0xc0, 0x0c, 0x59, 0x10, 0x57, 0x13, 0x30, 0x14, 0x5d, 0x12, + 0xf6, 0x0e, 0x3d, 0x0b, 0x37, 0x07, 0xdc, 0x02, 0xa4, 0xff, 0x29, 0xff, + 0xe5, 0x00, 0xf3, 0x02, 0x87, 0x04, 0x1d, 0x06, 0xcb, 0x07, 0xeb, 0x08, + 0x71, 0x09, 0xee, 0x09, 0x4e, 0x0a, 0x44, 0x0a, 0xed, 0x09, 0xfd, 0x08, + 0x47, 0x07, 0xba, 0x05, 0xfc, 0x04, 0xc8, 0x04, 0x34, 0x05, 0x7f, 0x06, + 0xf1, 0x07, 0x8f, 0x08, 0x03, 0x09, 0x01, 0x0b, 0x24, 0x0e, 0x6c, 0x10, + 0xd3, 0x11, 0x29, 0x14, 0x28, 0x19, 0xce, 0x21, 0xd9, 0x2c, 0x31, 0x37, + 0xb0, 0x3d, 0xff, 0x3c, 0x7c, 0x33, 0xd9, 0x20, 0xc0, 0x02, 0x31, 0xdd, + 0x63, 0xc1, 0x5e, 0xba, 0xe3, 0xbb, 0x14, 0xb5, 0x85, 0xa9, 0x6d, 0xab, + 0x94, 0xc1, 0xc8, 0xdb, 0x29, 0xe7, 0x09, 0xe9, 0x3c, 0xf7, 0xf8, 0x15, + 0x69, 0x2f, 0x27, 0x31, 0x28, 0x21, 0x5c, 0x11, 0x82, 0x0c, 0x8e, 0x0f, + 0x86, 0x0d, 0x07, 0xff, 0xb4, 0xee, 0x74, 0xeb, 0x5f, 0xf2, 0xbd, 0xf2, + 0x27, 0xe4, 0xa0, 0xd0, 0xdc, 0xc9, 0x0a, 0xd4, 0xcd, 0xdb, 0x82, 0xcc, + 0x05, 0xb0, 0x1b, 0xa4, 0x49, 0xb1, 0x60, 0xc3, 0xbf, 0xc8, 0xaf, 0xc5, + 0x4b, 0xc8, 0x7a, 0xd3, 0x88, 0xdd, 0xfc, 0xe0, 0xe9, 0xe1, 0x35, 0xe5, + 0x79, 0xee, 0x3b, 0xfd, 0x89, 0x07, 0x50, 0x06, 0x07, 0x03, 0xdc, 0x08, + 0x93, 0x12, 0xe3, 0x15, 0xdc, 0x13, 0x1b, 0x11, 0x93, 0x0b, 0xf9, 0x00, + 0x7d, 0xf2, 0x51, 0xe1, 0xa4, 0xd0, 0x65, 0xc4, 0xff, 0xbb, 0xe3, 0xb5, + 0x20, 0xb3, 0xa6, 0xb4, 0xbc, 0xba, 0x79, 0xc5, 0xb1, 0xd5, 0x68, 0xec, + 0x55, 0x03, 0xd1, 0x0f, 0x02, 0x14, 0xce, 0x1b, 0x00, 0x28, 0xdb, 0x2e, + 0x9a, 0x2c, 0x43, 0x26, 0x33, 0x21, 0xab, 0x1d, 0x36, 0x18, 0xfa, 0x0f, + 0xe9, 0x09, 0xcb, 0x0a, 0x12, 0x0f, 0xc4, 0x0d, 0x6e, 0x05, 0x6d, 0xff, + 0xbf, 0x01, 0x4d, 0x05, 0x74, 0x00, 0xd9, 0xf4, 0x07, 0xec, 0xe3, 0xe9, + 0xc6, 0xe9, 0x8f, 0xe8, 0x7c, 0xe9, 0x48, 0xef, 0x18, 0xf8, 0x47, 0x01, + 0x64, 0x09, 0x48, 0x0f, 0x64, 0x13, 0xa1, 0x17, 0xde, 0x1b, 0xe9, 0x1d, + 0xfa, 0x1d, 0x58, 0x1f, 0xa6, 0x23, 0xe1, 0x28, 0xcc, 0x2b, 0xa3, 0x29, + 0x3b, 0x22, 0xdf, 0x19, 0x0c, 0x14, 0x74, 0x0d, 0xdd, 0x01, 0xc8, 0xf4, + 0xec, 0xec, 0x76, 0xea, 0x09, 0xe8, 0xd5, 0xe2, 0x36, 0xdd, 0x61, 0xdb, + 0x67, 0xdf, 0x96, 0xe6, 0x6d, 0xec, 0x42, 0xf1, 0x95, 0xf8, 0x8e, 0x01, + 0x60, 0x08, 0xeb, 0x0b, 0x5e, 0x0c, 0x97, 0x09, 0xf0, 0x05, 0x0e, 0x05, + 0x7b, 0x06, 0x16, 0x06, 0xa0, 0x02, 0xcc, 0xff, 0x1a, 0x00, 0xd4, 0x00, + 0xb8, 0xfe, 0xda, 0xfa, 0x59, 0xf8, 0xf4, 0xf7, 0xbc, 0xf7, 0x8f, 0xf5, + 0x28, 0xf1, 0xa3, 0xec, 0x8b, 0xea, 0x9e, 0xea, 0xef, 0xe9, 0x36, 0xe7, + 0xd2, 0xe4, 0xe5, 0xe5, 0xdd, 0xea, 0xa7, 0xf0, 0xfa, 0xf3, 0xbc, 0xf5, + 0x3a, 0xf9, 0x4e, 0xfe, 0x99, 0x01, 0x20, 0x02, 0xa5, 0x02, 0x55, 0x05, + 0xda, 0x08, 0xf0, 0x0a, 0xd3, 0x0b, 0xd9, 0x0c, 0xb0, 0x0d, 0xe1, 0x0d, + 0x38, 0x0e, 0x60, 0x0e, 0xc6, 0x0c, 0xee, 0x09, 0xef, 0x07, 0x21, 0x07, + 0x53, 0x06, 0xdb, 0x04, 0x12, 0x03, 0x6e, 0x02, 0x14, 0x04, 0x7a, 0x06, + 0x70, 0x07, 0x0f, 0x08, 0xe7, 0x0a, 0x7f, 0x0f, 0xe6, 0x12, 0x93, 0x13, + 0xd3, 0x12, 0x9a, 0x12, 0xd4, 0x12, 0x21, 0x12, 0xe3, 0x10, 0xcf, 0x10, + 0x0e, 0x12, 0xc6, 0x13, 0x58, 0x16, 0x84, 0x1a, 0x81, 0x1f, 0xa8, 0x23, + 0x4b, 0x26, 0xad, 0x27, 0x98, 0x27, 0xbd, 0x25, 0x41, 0x23, 0xac, 0x21, + 0x90, 0x20, 0xfd, 0x1d, 0x0d, 0x19, 0x15, 0x13, 0x4b, 0x0e, 0x22, 0x0b, + 0xd9, 0x07, 0xd6, 0x03, 0x79, 0x01, 0x3d, 0x02, 0xb4, 0x03, 0x83, 0x03, + 0xf7, 0x02, 0x16, 0x04, 0xc6, 0x06, 0x02, 0x0a, 0xd4, 0x0c, 0xbe, 0x0e, + 0xbd, 0x10, 0x49, 0x14, 0xd4, 0x18, 0xcf, 0x1b, 0x78, 0x1b, 0xff, 0x18, + 0xbc, 0x16, 0xdc, 0x14, 0xd6, 0x11, 0x33, 0x0d, 0x54, 0x08, 0x30, 0x05, + 0x59, 0x04, 0xfe, 0x03, 0x03, 0x02, 0x4c, 0xfe, 0xdb, 0xf9, 0x48, 0xf5, + 0xf1, 0xf0, 0x1d, 0xed, 0x08, 0xea, 0x5c, 0xe8, 0x7f, 0xe8, 0x6d, 0xe9, + 0x04, 0xea, 0xb2, 0xea, 0xa6, 0xec, 0xb2, 0xf0, 0xf5, 0xf6, 0x14, 0xfe, + 0xbc, 0x03, 0x5c, 0x07, 0xba, 0x0a, 0xf8, 0x0e, 0x6a, 0x12, 0x0d, 0x12, + 0x39, 0x0d, 0x11, 0x07, 0x91, 0x02, 0x96, 0xfe, 0x96, 0xf8, 0x8a, 0xf1, + 0xaf, 0xec, 0xb4, 0xea, 0x00, 0xe9, 0x8d, 0xe5, 0x7f, 0xe1, 0x49, 0xdf, + 0xa9, 0xdf, 0xdb, 0xe1, 0x71, 0xe5, 0x2b, 0xea, 0x72, 0xef, 0x5b, 0xf5, + 0x5c, 0xfc, 0x1d, 0x03, 0x5c, 0x07, 0xa6, 0x09, 0x0c, 0x0d, 0x33, 0x12, + 0x1e, 0x16, 0x74, 0x16, 0x5a, 0x14, 0x7b, 0x12, 0xc7, 0x11, 0x91, 0x10, + 0x03, 0x0d, 0xfd, 0x07, 0x07, 0x04, 0xc6, 0x01, 0x6e, 0xff, 0xd6, 0xfb, + 0x75, 0xf8, 0x5c, 0xf7, 0x49, 0xf8, 0xfc, 0xf8, 0xfc, 0xf7, 0x7e, 0xf6, + 0x72, 0xf7, 0x06, 0xfc, 0xc0, 0x01, 0xec, 0x05, 0x46, 0x09, 0xe6, 0x0d, + 0x9b, 0x13, 0x8d, 0x18, 0xd2, 0x1b, 0xdc, 0x1d, 0x88, 0x1f, 0x49, 0x21, + 0x89, 0x22, 0x11, 0x22, 0xaf, 0x1f, 0xaf, 0x1c, 0xd2, 0x19, 0x1c, 0x16, + 0x70, 0x10, 0x6a, 0x09, 0x03, 0x03, 0x6b, 0xfe, 0xc2, 0xfa, 0xcd, 0xf6, + 0x45, 0xf3, 0xe4, 0xf1, 0xfd, 0xf2, 0x8b, 0xf5, 0xa2, 0xf8, 0xd1, 0xfb, + 0x2d, 0xff, 0x2a, 0x03, 0xc0, 0x07, 0x02, 0x0c, 0x38, 0x0f, 0xc0, 0x11, + 0xe8, 0x13, 0xbc, 0x14, 0x32, 0x13, 0xd9, 0x0f, 0x87, 0x0c, 0x6b, 0x0a, + 0x90, 0x08, 0x1b, 0x05, 0x1a, 0x00, 0x84, 0xfb, 0x33, 0xf8, 0x0e, 0xf5, + 0x42, 0xf1, 0x87, 0xed, 0xe0, 0xea, 0x4e, 0xe9, 0x55, 0xe8, 0x01, 0xe8, + 0x85, 0xe8, 0x95, 0xe9, 0xea, 0xea, 0x81, 0xec, 0x2c, 0xee, 0xcf, 0xef, + 0xd0, 0xf1, 0x68, 0xf4, 0xfa, 0xf6, 0xd5, 0xf8, 0x3b, 0xfa, 0xb0, 0xfb, + 0xd8, 0xfc, 0x25, 0xfd, 0xd7, 0xfc, 0x44, 0xfc, 0x2e, 0xfb, 0x54, 0xf9, + 0xeb, 0xf6, 0x61, 0xf4, 0xdc, 0xf1, 0x26, 0xef, 0x38, 0xec, 0x5b, 0xe9, + 0xb6, 0xe6, 0x6c, 0xe4, 0x08, 0xe3, 0xf8, 0xe2, 0xec, 0xe3, 0x80, 0xe5, + 0x11, 0xe8, 0xed, 0xeb, 0x18, 0xf0, 0x2a, 0xf3, 0x2c, 0xf5, 0x6c, 0xf7, + 0x69, 0xfa, 0x1a, 0xfd, 0x7e, 0xfe, 0x0b, 0xff, 0xbd, 0xff, 0xae, 0x00, + 0x45, 0x01, 0x1a, 0x01, 0x57, 0x00, 0xb1, 0xff, 0x7c, 0xff, 0x1b, 0xff, + 0x1c, 0xfe, 0xc7, 0xfc, 0x5f, 0xfb, 0x19, 0xfa, 0x3b, 0xf9, 0x69, 0xf8, + 0x3d, 0xf7, 0x6c, 0xf6, 0xf8, 0xf6, 0xc6, 0xf8, 0x09, 0xfb, 0x4f, 0xfd, + 0x88, 0xff, 0x7e, 0x01, 0xf2, 0x02, 0xed, 0x03, 0x88, 0x04, 0xc1, 0x04, + 0xcb, 0x04, 0x21, 0x05, 0xf8, 0x05, 0x12, 0x07, 0x16, 0x08, 0x06, 0x09, + 0xf8, 0x09, 0xad, 0x0a, 0xf3, 0x0a, 0xd0, 0x0a, 0xf7, 0x09, 0x28, 0x08, + 0x01, 0x06, 0x34, 0x04, 0x73, 0x02, 0x53, 0x00, 0x3f, 0xfe, 0xd8, 0xfc, + 0x2b, 0xfc, 0x03, 0xfc, 0x60, 0xfc, 0x55, 0xfd, 0xbb, 0xfe, 0x2f, 0x00, + 0x45, 0x01, 0xcb, 0x01, 0xb8, 0x01, 0x0b, 0x01, 0x0c, 0x00, 0x66, 0xff, + 0x89, 0xff, 0x24, 0x00, 0x8c, 0x00, 0x84, 0x00, 0x82, 0x00, 0xd2, 0x00, + 0xf2, 0x00, 0x7c, 0x00, 0xbc, 0xff, 0xb1, 0xfe, 0xeb, 0xfc, 0x8b, 0xfa, + 0x1a, 0xf8, 0xcf, 0xf5, 0xb7, 0xf3, 0x0a, 0xf2, 0x15, 0xf1, 0xce, 0xf0, + 0xcb, 0xf0, 0xc2, 0xf0, 0xf0, 0xf0, 0xba, 0xf1, 0x1a, 0xf3, 0x7b, 0xf4, + 0x59, 0xf5, 0x02, 0xf6, 0xe5, 0xf6, 0x8a, 0xf7, 0x4d, 0xf7, 0xaf, 0xf6, + 0xd2, 0xf6, 0xf9, 0xf7, 0x59, 0xf9, 0x3c, 0xfa, 0xb3, 0xfa, 0x09, 0xfb, + 0x33, 0xfb, 0xe9, 0xfa, 0x06, 0xfa, 0xca, 0xf8, 0x93, 0xf7, 0x31, 0xf6, + 0x3f, 0xf4, 0x19, 0xf2, 0x9a, 0xf0, 0x29, 0xf0, 0x9a, 0xf0, 0x8f, 0xf1, + 0xbf, 0xf2, 0x1b, 0xf4, 0xe3, 0xf5, 0x5f, 0xf8, 0x60, 0xfb, 0x2c, 0xfe, + 0x59, 0x00, 0x43, 0x02, 0x21, 0x04, 0x4e, 0x05, 0x44, 0x05, 0xac, 0x04, + 0x6d, 0x04, 0x71, 0x04, 0x27, 0x04, 0x75, 0x03, 0x88, 0x02, 0xb8, 0x01, + 0x87, 0x01, 0xd0, 0x01, 0xbf, 0x01, 0x3a, 0x01, 0x0d, 0x01, 0x87, 0x01, + 0x06, 0x02, 0xf3, 0x01, 0x7f, 0x01, 0x55, 0x01, 0xcc, 0x01, 0x7b, 0x02, + 0xc6, 0x02, 0xde, 0x02, 0xb6, 0x03, 0xa7, 0x05, 0xcf, 0x07, 0x4c, 0x09, + 0x38, 0x0a, 0xff, 0x0a, 0xad, 0x0b, 0x22, 0x0c, 0x6a, 0x0c, 0x87, 0x0c, + 0x3d, 0x0c, 0x7e, 0x0b, 0x9c, 0x0a, 0x96, 0x09, 0x1c, 0x08, 0x65, 0x06, + 0xf0, 0x04, 0xb0, 0x03, 0x72, 0x02, 0x5f, 0x01, 0x8e, 0x00, 0xd4, 0xff, + 0x2c, 0xff, 0xc4, 0xfe, 0xbd, 0xfe, 0x17, 0xff, 0xf0, 0xff, 0x6e, 0x01, + 0x36, 0x03, 0x98, 0x04, 0x6b, 0x05, 0x1f, 0x06, 0xf9, 0x06, 0x9c, 0x07, + 0x56, 0x07, 0x0a, 0x06, 0x9f, 0x04, 0xb0, 0x03, 0x9a, 0x02, 0xed, 0x00, + 0x88, 0xff, 0x15, 0xff, 0xc7, 0xfe, 0xe2, 0xfd, 0xe9, 0xfc, 0x4f, 0xfc, + 0x93, 0xfb, 0x4a, 0xfa, 0xe9, 0xf8, 0x04, 0xf8, 0x7e, 0xf7, 0xda, 0xf6, + 0x3c, 0xf6, 0x6f, 0xf6, 0x9e, 0xf7, 0xf4, 0xf8, 0xce, 0xf9, 0x5e, 0xfa, + 0x02, 0xfb, 0xb2, 0xfb, 0x1b, 0xfc, 0x03, 0xfc, 0x95, 0xfb, 0xf3, 0xfa, + 0x1a, 0xfa, 0x4f, 0xf9, 0xe6, 0xf8, 0xa9, 0xf8, 0x38, 0xf8, 0xca, 0xf7, + 0xbf, 0xf7, 0xe3, 0xf7, 0xd5, 0xf7, 0xd5, 0xf7, 0x25, 0xf8, 0x54, 0xf8, + 0x00, 0xf8, 0x82, 0xf7, 0x3c, 0xf7, 0x26, 0xf7, 0x55, 0xf7, 0x23, 0xf8, + 0x82, 0xf9, 0xc7, 0xfa, 0xa4, 0xfb, 0xd4, 0xfc, 0xc6, 0xfe, 0xa5, 0x00, + 0xbd, 0x01, 0x5d, 0x02, 0xb9, 0x02, 0x8c, 0x02, 0x0b, 0x02, 0xb3, 0x01, + 0x8f, 0x01, 0x7e, 0x01, 0x7e, 0x01, 0x6d, 0x01, 0x35, 0x01, 0x08, 0x01, + 0xef, 0x00, 0xe3, 0x00, 0x4b, 0x01, 0x4c, 0x02, 0x1d, 0x03, 0x2d, 0x03, + 0x15, 0x03, 0x9a, 0x03, 0x9e, 0x04, 0xa2, 0x05, 0xa7, 0x06, 0xef, 0x07, + 0x49, 0x09, 0x53, 0x0a, 0x1b, 0x0b, 0xa4, 0x0b, 0xa2, 0x0b, 0x7c, 0x0b, + 0x0e, 0x0c, 0x02, 0x0d, 0x04, 0x0d, 0xaa, 0x0b, 0xf9, 0x09, 0xf8, 0x08, + 0x8d, 0x08, 0x01, 0x08, 0x1b, 0x07, 0x19, 0x06, 0x11, 0x05, 0x14, 0x04, + 0x8d, 0x03, 0xf4, 0x03, 0x34, 0x05, 0x89, 0x06, 0x40, 0x07, 0x93, 0x07, + 0x23, 0x08, 0xcc, 0x08, 0xf9, 0x08, 0xe5, 0x08, 0x50, 0x09, 0x1b, 0x0a, + 0x85, 0x0a, 0x39, 0x0a, 0x5c, 0x09, 0x29, 0x08, 0x05, 0x07, 0x26, 0x06, + 0x4d, 0x05, 0x43, 0x04, 0x13, 0x03, 0xb4, 0x01, 0x29, 0x00, 0xab, 0xfe, + 0x64, 0xfd, 0x6e, 0xfc, 0xe5, 0xfb, 0xa9, 0xfb, 0x77, 0xfb, 0x6c, 0xfb, + 0xd0, 0xfb, 0x86, 0xfc, 0x41, 0xfd, 0x0a, 0xfe, 0xfe, 0xfe, 0xf1, 0xff, + 0x9a, 0x00, 0xd3, 0x00, 0xba, 0x00, 0xd6, 0x00, 0x7e, 0x01, 0x50, 0x02, + 0xcc, 0x02, 0xe2, 0x02, 0x83, 0x02, 0x9b, 0x01, 0x78, 0x00, 0x4d, 0xff, + 0xbf, 0xfd, 0xb5, 0xfb, 0xcb, 0xf9, 0x61, 0xf8, 0x30, 0xf7, 0x23, 0xf6, + 0xb8, 0xf5, 0x39, 0xf6, 0x48, 0xf7, 0x35, 0xf8, 0xba, 0xf8, 0x66, 0xf9, + 0xf1, 0xfa, 0x13, 0xfd, 0xca, 0xfe, 0xbe, 0xff, 0x92, 0x00, 0xcf, 0x01, + 0x37, 0x03, 0x3c, 0x04, 0xe4, 0x04, 0xb1, 0x05, 0xa5, 0x06, 0x34, 0x07, + 0x12, 0x07, 0x63, 0x06, 0x65, 0x05, 0x58, 0x04, 0x73, 0x03, 0xb4, 0x02, + 0x05, 0x02, 0x6d, 0x01, 0xe0, 0x00, 0x39, 0x00, 0xa6, 0xff, 0x99, 0xff, + 0x0e, 0x00, 0x5a, 0x00, 0x29, 0x00, 0x34, 0x00, 0x3d, 0x01, 0xd4, 0x02, + 0xf9, 0x03, 0xaf, 0x04, 0xd6, 0x05, 0xbe, 0x07, 0xb8, 0x09, 0x06, 0x0b, + 0xbe, 0x0b, 0x7c, 0x0c, 0x8a, 0x0d, 0x8e, 0x0e, 0xf5, 0x0e, 0x6b, 0x0e, + 0x1e, 0x0d, 0xae, 0x0b, 0x95, 0x0a, 0x99, 0x09, 0x3f, 0x08, 0x80, 0x06, + 0xcd, 0x04, 0x77, 0x03, 0x4d, 0x02, 0x18, 0x01, 0x4f, 0x00, 0x97, 0x00, + 0x99, 0x01, 0x35, 0x02, 0x15, 0x02, 0x2d, 0x02, 0x39, 0x03, 0x9b, 0x04, + 0x5d, 0x05, 0x94, 0x05, 0x01, 0x06, 0xcb, 0x06, 0x6d, 0x07, 0x7b, 0x07, + 0x17, 0x07, 0xc4, 0x06, 0xee, 0x06, 0x70, 0x07, 0xa5, 0x07, 0x20, 0x07, + 0x35, 0x06, 0x7c, 0x05, 0xde, 0x04, 0xb4, 0x03, 0xbd, 0x01, 0x6d, 0xff, + 0x4c, 0xfd, 0x9e, 0xfb, 0x87, 0xfa, 0x05, 0xfa, 0xe9, 0xf9, 0x09, 0xfa, + 0x50, 0xfa, 0xcc, 0xfa, 0xae, 0xfb, 0xfb, 0xfc, 0x5c, 0xfe, 0x7e, 0xff, + 0x5e, 0x00, 0x10, 0x01, 0x7a, 0x01, 0x7e, 0x01, 0x46, 0x01, 0x2f, 0x01, + 0x52, 0x01, 0x69, 0x01, 0x2e, 0x01, 0xbd, 0x00, 0x72, 0x00, 0x68, 0x00, + 0x32, 0x00, 0x73, 0xff, 0x72, 0xfe, 0xb9, 0xfd, 0x57, 0xfd, 0xdd, 0xfc, + 0xdf, 0xfb, 0x7d, 0xfa, 0x5c, 0xf9, 0xef, 0xf8, 0xf4, 0xf8, 0xe7, 0xf8, + 0xd5, 0xf8, 0x6e, 0xf9, 0x31, 0xfb, 0x8d, 0xfd, 0x5e, 0xff, 0x65, 0x00, + 0x62, 0x01, 0xc2, 0x02, 0x0c, 0x04, 0xb6, 0x04, 0xcb, 0x04, 0xdd, 0x04, + 0x5c, 0x05, 0xef, 0x05, 0xe2, 0x05, 0x4a, 0x05, 0xbd, 0x04, 0x39, 0x04, + 0x5f, 0x03, 0x51, 0x02, 0x55, 0x01, 0x3c, 0x00, 0xd2, 0xfe, 0x5a, 0xfd, + 0x2b, 0xfc, 0x3b, 0xfb, 0x9b, 0xfa, 0xc3, 0xfa, 0xc5, 0xfb, 0x0f, 0xfd, + 0x6d, 0xfe, 0x4a, 0x00, 0xab, 0x02, 0xe6, 0x04, 0x80, 0x06, 0xa5, 0x07, + 0xca, 0x08, 0x03, 0x0a, 0xd6, 0x0a, 0xc1, 0x0a, 0xd5, 0x09, 0xa0, 0x08, + 0xa2, 0x07, 0xdd, 0x06, 0x15, 0x06, 0x32, 0x05, 0x46, 0x04, 0x59, 0x03, + 0x6e, 0x02, 0x87, 0x01, 0x99, 0x00, 0x95, 0xff, 0xb1, 0xfe, 0x72, 0xfe, + 0xef, 0xfe, 0x72, 0xff, 0x70, 0xff, 0x58, 0xff, 0xe0, 0xff, 0x09, 0x01, + 0x5f, 0x02, 0x7c, 0x03, 0x25, 0x04, 0x77, 0x04, 0xc9, 0x04, 0x09, 0x05, + 0xc6, 0x04, 0x0f, 0x04, 0x71, 0x03, 0x04, 0x03, 0x71, 0x02, 0xaa, 0x01, + 0xdb, 0x00, 0x12, 0x00, 0x60, 0xff, 0xf5, 0xfe, 0xc0, 0xfe, 0x53, 0xfe, + 0x7c, 0xfd, 0x95, 0xfc, 0xd4, 0xfb, 0x02, 0xfb, 0x19, 0xfa, 0x83, 0xf9, + 0x83, 0xf9, 0x15, 0xfa, 0xf8, 0xfa, 0xc7, 0xfb, 0x7a, 0xfc, 0x73, 0xfd, + 0xc9, 0xfe, 0x10, 0x00, 0xdb, 0x00, 0xfc, 0x00, 0x8f, 0x00, 0xef, 0xff, + 0x77, 0xff, 0x34, 0xff, 0xd9, 0xfe, 0x27, 0xfe, 0x74, 0xfd, 0x4e, 0xfd, + 0xa7, 0xfd, 0xe4, 0xfd, 0xa8, 0xfd, 0x12, 0xfd, 0x5f, 0xfc, 0xae, 0xfb, + 0xdd, 0xfa, 0xa7, 0xf9, 0x2b, 0xf8, 0x0a, 0xf7, 0x9f, 0xf6, 0xa9, 0xf6, + 0xf7, 0xf6, 0xa5, 0xf7, 0xac, 0xf8, 0xdd, 0xf9, 0x13, 0xfb, 0x20, 0xfc, + 0xdb, 0xfc, 0x62, 0xfd, 0xe6, 0xfd, 0x4a, 0xfe, 0x51, 0xfe, 0x2b, 0xfe, + 0x54, 0xfe, 0xc8, 0xfe, 0x0b, 0xff, 0x20, 0xff, 0x9d, 0xff, 0xab, 0x00, + 0x8f, 0x01, 0x6d, 0x01, 0x4c, 0x00, 0xf1, 0xfe, 0xc4, 0xfd, 0x79, 0xfc, + 0xc6, 0xfa, 0xf0, 0xf8, 0x8c, 0xf7, 0xeb, 0xf6, 0xdc, 0xf6, 0x11, 0xf7, + 0x9a, 0xf7, 0xad, 0xf8, 0x37, 0xfa, 0xe0, 0xfb, 0x4e, 0xfd, 0x4b, 0xfe, + 0xe2, 0xfe, 0x8b, 0xff, 0xad, 0x00, 0xdc, 0x01, 0x3c, 0x02, 0xea, 0x01, + 0xdf, 0x01, 0x67, 0x02, 0xcb, 0x02, 0xb2, 0x02, 0xad, 0x02, 0x1d, 0x03, + 0x7f, 0x03, 0x47, 0x03, 0x93, 0x02, 0xb3, 0x01, 0xc8, 0x00, 0xc1, 0xff, + 0x5a, 0xfe, 0xaa, 0xfc, 0x5b, 0xfb, 0xbf, 0xfa, 0x71, 0xfa, 0x2d, 0xfa, + 0x30, 0xfa, 0xb0, 0xfa, 0x9f, 0xfb, 0xc6, 0xfc, 0xe6, 0xfd, 0xd3, 0xfe, + 0x83, 0xff, 0x13, 0x00, 0xb2, 0x00, 0x5a, 0x01, 0xdb, 0x01, 0x40, 0x02, + 0xcc, 0x02, 0x76, 0x03, 0xdd, 0x03, 0xc7, 0x03, 0x6d, 0x03, 0x3d, 0x03, + 0x4d, 0x03, 0x31, 0x03, 0x89, 0x02, 0x7f, 0x01, 0x60, 0x00, 0x34, 0xff, + 0x04, 0xfe, 0xf3, 0xfc, 0x41, 0xfc, 0x47, 0xfc, 0xed, 0xfc, 0x83, 0xfd, + 0xb3, 0xfd, 0xdb, 0xfd, 0x45, 0xfe, 0xea, 0xfe, 0xa1, 0xff, 0x09, 0x00, + 0xe7, 0xff, 0x93, 0xff, 0x58, 0xff, 0xff, 0xfe, 0x5e, 0xfe, 0xbd, 0xfd, + 0x93, 0xfd, 0x07, 0xfe, 0x9f, 0xfe, 0xaf, 0xfe, 0x0d, 0xfe, 0x14, 0xfd, + 0x22, 0xfc, 0x75, 0xfb, 0x2b, 0xfb, 0x26, 0xfb, 0x22, 0xfb, 0x07, 0xfb, + 0xed, 0xfa, 0xee, 0xfa, 0x3a, 0xfb, 0xfe, 0xfb, 0xfe, 0xfc, 0xb0, 0xfd, + 0xe4, 0xfd, 0xdc, 0xfd, 0xce, 0xfd, 0xbe, 0xfd, 0xa4, 0xfd, 0x77, 0xfd, + 0x20, 0xfd, 0x8f, 0xfc, 0xca, 0xfb, 0x0a, 0xfb, 0xab, 0xfa, 0xc6, 0xfa, + 0x01, 0xfb, 0x00, 0xfb, 0xa8, 0xfa, 0xee, 0xf9, 0xf9, 0xf8, 0x2f, 0xf8, + 0xbf, 0xf7, 0x8e, 0xf7, 0xaa, 0xf7, 0x39, 0xf8, 0x2f, 0xf9, 0x6e, 0xfa, + 0xd5, 0xfb, 0x3b, 0xfd, 0x8b, 0xfe, 0xbd, 0xff, 0xbd, 0x00, 0x6e, 0x01, + 0xc0, 0x01, 0xc8, 0x01, 0xb5, 0x01, 0x95, 0x01, 0x51, 0x01, 0xf4, 0x00, + 0x9d, 0x00, 0x5e, 0x00, 0x45, 0x00, 0x42, 0x00, 0x44, 0x00, 0x5a, 0x00, + 0x67, 0x00, 0x06, 0x00, 0x13, 0xff, 0x00, 0xfe, 0x5f, 0xfd, 0x5b, 0xfd, + 0xb2, 0xfd, 0x26, 0xfe, 0xf7, 0xfe, 0x71, 0x00, 0x24, 0x02, 0x49, 0x03, + 0xca, 0x03, 0x2f, 0x04, 0xc3, 0x04, 0x65, 0x05, 0xca, 0x05, 0xc1, 0x05, + 0x6a, 0x05, 0x1d, 0x05, 0xfd, 0x04, 0xfe, 0x04, 0x23, 0x05, 0x6e, 0x05, + 0xd9, 0x05, 0x5e, 0x06, 0xcf, 0x06, 0xe8, 0x06, 0x8e, 0x06, 0xdb, 0x05, + 0x1f, 0x05, 0x8d, 0x04, 0xd3, 0x03, 0xa1, 0x02, 0x72, 0x01, 0x0b, 0x01, + 0x63, 0x01, 0xc8, 0x01, 0xf3, 0x01, 0x53, 0x02, 0x2e, 0x03, 0x14, 0x04, + 0x75, 0x04, 0x49, 0x04, 0xec, 0x03, 0x9d, 0x03, 0x56, 0x03, 0xf2, 0x02, + 0x69, 0x02, 0xca, 0x01, 0x42, 0x01, 0x09, 0x01, 0x29, 0x01, 0x5d, 0x01, + 0x5a, 0x01, 0x24, 0x01, 0xe4, 0x00, 0x94, 0x00, 0x08, 0x00, 0x43, 0xff, + 0x6f, 0xfe, 0xa6, 0xfd, 0xed, 0xfc, 0x3c, 0xfc, 0x97, 0xfb, 0x1b, 0xfb, + 0xb4, 0xfa, 0x28, 0xfa, 0xa2, 0xf9, 0x8e, 0xf9, 0xfc, 0xf9, 0xaf, 0xfa, + 0x73, 0xfb, 0x0d, 0xfc, 0x4f, 0xfc, 0x49, 0xfc, 0x13, 0xfc, 0x9a, 0xfb, + 0xf1, 0xfa, 0x61, 0xfa, 0x13, 0xfa, 0xdc, 0xf9, 0x8b, 0xf9, 0x3a, 0xf9, + 0x3a, 0xf9, 0xba, 0xf9, 0x82, 0xfa, 0x20, 0xfb, 0x74, 0xfb, 0xc0, 0xfb, + 0x34, 0xfc, 0xbe, 0xfc, 0x33, 0xfd, 0x75, 0xfd, 0x79, 0xfd, 0x67, 0xfd, + 0x81, 0xfd, 0xc8, 0xfd, 0xf7, 0xfd, 0xf3, 0xfd, 0xf1, 0xfd, 0x1f, 0xfe, + 0x87, 0xfe, 0x26, 0xff, 0xce, 0xff, 0x3c, 0x00, 0x5b, 0x00, 0x3d, 0x00, + 0x0c, 0x00, 0xdd, 0xff, 0x8e, 0xff, 0x18, 0xff, 0xcb, 0xfe, 0xbd, 0xfe, + 0xa7, 0xfe, 0x73, 0xfe, 0x5f, 0xfe, 0x9b, 0xfe, 0x2a, 0xff, 0xf1, 0xff, + 0xd7, 0x00, 0xe8, 0x01, 0x24, 0x03, 0x53, 0x04, 0x4a, 0x05, 0x02, 0x06, + 0x5e, 0x06, 0x48, 0x06, 0xe6, 0x05, 0x6f, 0x05, 0xf5, 0x04, 0x66, 0x04, + 0xad, 0x03, 0xdb, 0x02, 0x23, 0x02, 0x92, 0x01, 0x0f, 0x01, 0xaa, 0x00, + 0x87, 0x00, 0xa4, 0x00, 0xe8, 0x00, 0x39, 0x01, 0x97, 0x01, 0x12, 0x02, + 0x9e, 0x02, 0x11, 0x03, 0x60, 0x03, 0x89, 0x03, 0x8f, 0x03, 0xa1, 0x03, + 0xd6, 0x03, 0xe6, 0x03, 0xa2, 0x03, 0x3a, 0x03, 0xd5, 0x02, 0x74, 0x02, + 0x1c, 0x02, 0xb6, 0x01, 0x1b, 0x01, 0x5c, 0x00, 0xbb, 0xff, 0x49, 0xff, + 0xda, 0xfe, 0x62, 0xfe, 0x0f, 0xfe, 0xec, 0xfd, 0xa8, 0xfd, 0x11, 0xfd, + 0x79, 0xfc, 0x3b, 0xfc, 0x3a, 0xfc, 0x32, 0xfc, 0x32, 0xfc, 0x6a, 0xfc, + 0xd2, 0xfc, 0x43, 0xfd, 0xaf, 0xfd, 0x15, 0xfe, 0x5b, 0xfe, 0x64, 0xfe, + 0x37, 0xfe, 0xff, 0xfd, 0xd9, 0xfd, 0xc9, 0xfd, 0xbb, 0xfd, 0xaf, 0xfd, + 0xa4, 0xfd, 0x70, 0xfd, 0xf2, 0xfc, 0x61, 0xfc, 0x00, 0xfc, 0xb1, 0xfb, + 0x40, 0xfb, 0xd5, 0xfa, 0xbf, 0xfa, 0xfb, 0xfa, 0x39, 0xfb, 0x61, 0xfb, + 0xac, 0xfb, 0x31, 0xfc, 0xcb, 0xfc, 0x6d, 0xfd, 0x25, 0xfe, 0xd5, 0xfe, + 0x46, 0xff, 0x73, 0xff, 0x6b, 0xff, 0x2a, 0xff, 0xd5, 0xfe, 0xa6, 0xfe, + 0x8e, 0xfe, 0x63, 0xfe, 0x3a, 0xfe, 0x3a, 0xfe, 0x5f, 0xfe, 0x9d, 0xfe, + 0xf3, 0xfe, 0x56, 0xff, 0xb6, 0xff, 0x10, 0x00, 0x60, 0x00, 0xa8, 0x00, + 0xe0, 0x00, 0x02, 0x01, 0x33, 0x01, 0xa0, 0x01, 0x37, 0x02, 0xb0, 0x02, + 0xdd, 0x02, 0xd6, 0x02, 0xd1, 0x02, 0xe9, 0x02, 0x14, 0x03, 0x43, 0x03, + 0x79, 0x03, 0xbd, 0x03, 0x07, 0x04, 0x53, 0x04, 0x96, 0x04, 0xac, 0x04, + 0x87, 0x04, 0x48, 0x04, 0x1b, 0x04, 0x19, 0x04, 0x37, 0x04, 0x4e, 0x04, + 0x4f, 0x04, 0x41, 0x04, 0x0f, 0x04, 0xb0, 0x03, 0x45, 0x03, 0xed, 0x02, + 0xba, 0x02, 0xc0, 0x02, 0xfc, 0x02, 0x6e, 0x03, 0x1d, 0x04, 0xe3, 0x04, + 0x94, 0x05, 0x2b, 0x06, 0x94, 0x06, 0xa8, 0x06, 0x66, 0x06, 0xe2, 0x05, + 0x0f, 0x05, 0xed, 0x03, 0xa6, 0x02, 0x6c, 0x01, 0x71, 0x00, 0xd3, 0xff, + 0x75, 0xff, 0x35, 0xff, 0x35, 0xff, 0xa0, 0xff, 0x61, 0x00, 0x44, 0x01, + 0x11, 0x02, 0x94, 0x02, 0xcf, 0x02, 0xe5, 0x02, 0xd2, 0x02, 0x70, 0x02, + 0xad, 0x01, 0xbf, 0x00, 0x21, 0x00, 0x26, 0x00, 0x87, 0x00, 0xc7, 0x00, + 0xcf, 0x00, 0xe0, 0x00, 0x20, 0x01, 0x7e, 0x01, 0xe4, 0x01, 0x40, 0x02, + 0x62, 0x02, 0x0e, 0x02, 0x4f, 0x01, 0x77, 0x00, 0xd9, 0xff, 0x83, 0xff, + 0x5c, 0xff, 0x5d, 0xff, 0x88, 0xff, 0xae, 0xff, 0xa7, 0xff, 0x92, 0xff, + 0xa8, 0xff, 0xf0, 0xff, 0x3f, 0x00, 0x7a, 0x00, 0xa5, 0x00, 0xc6, 0x00, + 0xd9, 0x00, 0xf0, 0x00, 0x28, 0x01, 0x69, 0x01, 0x8e, 0x01, 0xb3, 0x01, + 0x17, 0x02, 0xa9, 0x02, 0x01, 0x03, 0xe8, 0x02, 0x8f, 0x02, 0x3c, 0x02, + 0x02, 0x02, 0xc4, 0x01, 0x6c, 0x01, 0x0d, 0x01, 0xc8, 0x00, 0xbb, 0x00, + 0x10, 0x01, 0xbd, 0x01, 0x60, 0x02, 0xc1, 0x02, 0x20, 0x03, 0xbe, 0x03, + 0x61, 0x04, 0x8a, 0x04, 0x27, 0x04, 0xbb, 0x03, 0x9e, 0x03, 0x95, 0x03, + 0x73, 0x03, 0x5b, 0x03, 0x5a, 0x03, 0x65, 0x03, 0x96, 0x03, 0xe7, 0x03, + 0x1c, 0x04, 0x27, 0x04, 0x39, 0x04, 0x52, 0x04, 0x3d, 0x04, 0xf2, 0x03, + 0x99, 0x03, 0x4a, 0x03, 0x14, 0x03, 0x18, 0x03, 0x5e, 0x03, 0xb3, 0x03, + 0xf4, 0x03, 0x4b, 0x04, 0xf1, 0x04, 0xb8, 0x05, 0x34, 0x06, 0x3b, 0x06, + 0x03, 0x06, 0xc8, 0x05, 0x86, 0x05, 0x14, 0x05, 0x73, 0x04, 0xd8, 0x03, + 0x6d, 0x03, 0x31, 0x03, 0x1e, 0x03, 0x24, 0x03, 0x0f, 0x03, 0xbc, 0x02, + 0x47, 0x02, 0xdc, 0x01, 0x65, 0x01, 0xbf, 0x00, 0x1a, 0x00, 0xda, 0xff, + 0x17, 0x00, 0x8a, 0x00, 0xf0, 0x00, 0x4f, 0x01, 0xcf, 0x01, 0x6d, 0x02, + 0x0d, 0x03, 0x94, 0x03, 0xd3, 0x03, 0xa5, 0x03, 0x2f, 0x03, 0xb6, 0x02, + 0x51, 0x02, 0xe8, 0x01, 0x5f, 0x01, 0xcb, 0x00, 0x59, 0x00, 0x17, 0x00, + 0xdc, 0xff, 0x7e, 0xff, 0x10, 0xff, 0xcc, 0xfe, 0xac, 0xfe, 0x4a, 0xfe, + 0x7a, 0xfd, 0xa8, 0xfc, 0x4d, 0xfc, 0x5e, 0xfc, 0x9c, 0xfc, 0xf0, 0xfc, + 0x59, 0xfd, 0xce, 0xfd, 0x52, 0xfe, 0xe5, 0xfe, 0x66, 0xff, 0xbb, 0xff, + 0xe5, 0xff, 0xf1, 0xff, 0xec, 0xff, 0xd7, 0xff, 0x97, 0xff, 0x36, 0xff, + 0xe2, 0xfe, 0xab, 0xfe, 0x7e, 0xfe, 0x51, 0xfe, 0x31, 0xfe, 0x35, 0xfe, + 0x48, 0xfe, 0x2c, 0xfe, 0xd1, 0xfd, 0x67, 0xfd, 0x0b, 0xfd, 0xb3, 0xfc, + 0x62, 0xfc, 0x30, 0xfc, 0x18, 0xfc, 0xfd, 0xfb, 0xe7, 0xfb, 0x04, 0xfc, + 0x5e, 0xfc, 0xdf, 0xfc, 0x78, 0xfd, 0x1a, 0xfe, 0xc5, 0xfe, 0x79, 0xff, + 0x19, 0x00, 0xa2, 0x00, 0x2f, 0x01, 0x92, 0x01, 0x8b, 0x01, 0x3b, 0x01, + 0xe5, 0x00, 0x82, 0x00, 0xee, 0xff, 0x1f, 0xff, 0x4a, 0xfe, 0xcd, 0xfd, + 0xba, 0xfd, 0xc2, 0xfd, 0xb9, 0xfd, 0xb6, 0xfd, 0xc1, 0xfd, 0xd6, 0xfd, + 0x06, 0xfe, 0x51, 0xfe, 0xa9, 0xfe, 0x0c, 0xff, 0x75, 0xff, 0xc7, 0xff, + 0xee, 0xff, 0xf1, 0xff, 0xeb, 0xff, 0xfe, 0xff, 0x29, 0x00, 0x3b, 0x00, + 0x1c, 0x00, 0xe5, 0xff, 0xb8, 0xff, 0xa9, 0xff, 0xbb, 0xff, 0xdc, 0xff, + 0x04, 0x00, 0x36, 0x00, 0x63, 0x00, 0x78, 0x00, 0x7c, 0x00, 0x7d, 0x00, + 0x67, 0x00, 0x1f, 0x00, 0xb8, 0xff, 0x64, 0xff, 0x30, 0xff, 0x02, 0xff, + 0xbf, 0xfe, 0x60, 0xfe, 0xec, 0xfd, 0x71, 0xfd, 0xf2, 0xfc, 0x89, 0xfc, + 0x66, 0xfc, 0x99, 0xfc, 0x12, 0xfd, 0xa7, 0xfd, 0x20, 0xfe, 0x6a, 0xfe, + 0xa9, 0xfe, 0xf0, 0xfe, 0x25, 0xff, 0x1f, 0xff, 0xc7, 0xfe, 0x37, 0xfe, + 0xc1, 0xfd, 0x97, 0xfd, 0x95, 0xfd, 0x7a, 0xfd, 0x44, 0xfd, 0x19, 0xfd, + 0x0d, 0xfd, 0x23, 0xfd, 0x56, 0xfd, 0x93, 0xfd, 0xc5, 0xfd, 0xdc, 0xfd, + 0xc3, 0xfd, 0x68, 0xfd, 0xd8, 0xfc, 0x4a, 0xfc, 0xf6, 0xfb, 0xd8, 0xfb, + 0xb9, 0xfb, 0x83, 0xfb, 0x5a, 0xfb, 0x75, 0xfb, 0xdb, 0xfb, 0x47, 0xfc, + 0x81, 0xfc, 0xa6, 0xfc, 0xe7, 0xfc, 0x45, 0xfd, 0x9b, 0xfd, 0xbb, 0xfd, + 0x98, 0xfd, 0x5e, 0xfd, 0x4f, 0xfd, 0x84, 0xfd, 0xd1, 0xfd, 0xee, 0xfd, + 0xc6, 0xfd, 0x99, 0xfd, 0x9a, 0xfd, 0xc3, 0xfd, 0xe9, 0xfd, 0xdd, 0xfd, + 0x99, 0xfd, 0x4c, 0xfd, 0x12, 0xfd, 0xed, 0xfc, 0xf3, 0xfc, 0x2c, 0xfd, + 0x87, 0xfd, 0xf9, 0xfd, 0x80, 0xfe, 0x08, 0xff, 0x93, 0xff, 0x2a, 0x00, + 0xb3, 0x00, 0x06, 0x01, 0x13, 0x01, 0xe5, 0x00, 0x87, 0x00, 0x0f, 0x00, + 0xa5, 0xff, 0x6f, 0xff, 0x71, 0xff, 0x84, 0xff, 0x75, 0xff, 0x40, 0xff, + 0x11, 0xff, 0x0a, 0xff, 0x17, 0xff, 0x25, 0xff, 0x48, 0xff, 0x7e, 0xff, + 0xaf, 0xff, 0xcd, 0xff, 0xd3, 0xff, 0xb3, 0xff, 0x76, 0xff, 0x44, 0xff, + 0x42, 0xff, 0x77, 0xff, 0xc2, 0xff, 0x09, 0x00, 0x4f, 0x00, 0x9a, 0x00, + 0xd9, 0x00, 0xf0, 0x00, 0xce, 0x00, 0x87, 0x00, 0x55, 0x00, 0x53, 0x00, + 0x4d, 0x00, 0x04, 0x00, 0x7d, 0xff, 0x0f, 0xff, 0x0d, 0xff, 0x70, 0xff, + 0xe5, 0xff, 0x23, 0x00, 0x2b, 0x00, 0x29, 0x00, 0x23, 0x00, 0xf7, 0xff, + 0x99, 0xff, 0x1e, 0xff, 0xa3, 0xfe, 0x50, 0xfe, 0x32, 0xfe, 0x2d, 0xfe, + 0x26, 0xfe, 0x40, 0xfe, 0xae, 0xfe, 0x5e, 0xff, 0xf8, 0xff, 0x48, 0x00, + 0x6e, 0x00, 0x90, 0x00, 0x8e, 0x00, 0x40, 0x00, 0xbe, 0xff, 0x42, 0xff, + 0xf4, 0xfe, 0xda, 0xfe, 0xe6, 0xfe, 0xfe, 0xfe, 0x0c, 0xff, 0x20, 0xff, + 0x4e, 0xff, 0x82, 0xff, 0x89, 0xff, 0x4a, 0xff, 0xed, 0xfe, 0xb8, 0xfe, + 0xbb, 0xfe, 0xc9, 0xfe, 0xbc, 0xfe, 0x9d, 0xfe, 0x86, 0xfe, 0x7f, 0xfe, + 0x81, 0xfe, 0x85, 0xfe, 0x89, 0xfe, 0x9c, 0xfe, 0xc8, 0xfe, 0xfb, 0xfe, + 0x01, 0xff, 0xba, 0xfe, 0x60, 0xfe, 0x58, 0xfe, 0xc0, 0xfe, 0x55, 0xff, + 0xe5, 0xff, 0x84, 0x00, 0x4b, 0x01, 0x21, 0x02, 0xd4, 0x02, 0x3d, 0x03, + 0x3d, 0x03, 0xbf, 0x02, 0xeb, 0x01, 0x0f, 0x01, 0x5c, 0x00, 0xd2, 0xff, + 0x66, 0xff, 0x17, 0xff, 0xee, 0xfe, 0xf8, 0xfe, 0x27, 0xff, 0x6a, 0xff, + 0xae, 0xff, 0xd5, 0xff, 0xcb, 0xff, 0x9d, 0xff, 0x69, 0xff, 0x53, 0xff, + 0x6f, 0xff, 0xb0, 0xff, 0x02, 0x00, 0x62, 0x00, 0xb7, 0x00, 0xf1, 0x00, + 0x36, 0x01, 0xb7, 0x01, 0x6a, 0x02, 0xfd, 0x02, 0x1b, 0x03, 0xd6, 0x02, + 0x91, 0x02, 0x63, 0x02, 0x1f, 0x02, 0xbe, 0x01, 0x57, 0x01, 0xf5, 0x00, + 0xa0, 0x00, 0x57, 0x00, 0x0b, 0x00, 0xb4, 0xff, 0x48, 0xff, 0xc1, 0xfe, + 0x3c, 0xfe, 0xe1, 0xfd, 0xb8, 0xfd, 0xb9, 0xfd, 0xe6, 0xfd, 0x42, 0xfe, + 0xcd, 0xfe, 0x8a, 0xff, 0x58, 0x00, 0x06, 0x01, 0x97, 0x01, 0x47, 0x02, + 0x23, 0x03, 0xdc, 0x03, 0x15, 0x04, 0xd3, 0x03, 0x82, 0x03, 0x6d, 0x03, + 0x5b, 0x03, 0x00, 0x03, 0x78, 0x02, 0x04, 0x02, 0xb3, 0x01, 0x66, 0x01, + 0xf0, 0x00, 0x53, 0x00, 0xc6, 0xff, 0x6b, 0xff, 0x30, 0xff, 0xfe, 0xfe, + 0xc0, 0xfe, 0x79, 0xfe, 0x62, 0xfe, 0xa1, 0xfe, 0x10, 0xff, 0x7a, 0xff, + 0xd1, 0xff, 0x21, 0x00, 0x77, 0x00, 0xd6, 0x00, 0x2b, 0x01, 0x63, 0x01, + 0x86, 0x01, 0xbd, 0x01, 0x23, 0x02, 0xa3, 0x02, 0xfa, 0x02, 0xfb, 0x02, + 0xc2, 0x02, 0x88, 0x02, 0x54, 0x02, 0xf3, 0x01, 0x48, 0x01, 0x7e, 0x00, + 0xdd, 0xff, 0x7d, 0xff, 0x3d, 0xff, 0xe4, 0xfe, 0x62, 0xfe, 0xe9, 0xfd, + 0xc0, 0xfd, 0xf3, 0xfd, 0x4d, 0xfe, 0x9a, 0xfe, 0xe4, 0xfe, 0x61, 0xff, + 0x1c, 0x00, 0xd4, 0x00, 0x44, 0x01, 0x77, 0x01, 0xb4, 0x01, 0x1b, 0x02, + 0x80, 0x02, 0xb2, 0x02, 0xbf, 0x02, 0xc0, 0x02, 0xb0, 0x02, 0x7b, 0x02, + 0x0e, 0x02, 0x70, 0x01, 0xdc, 0x00, 0x83, 0x00, 0x50, 0x00, 0x06, 0x00, + 0x90, 0xff, 0x07, 0xff, 0x92, 0xfe, 0x48, 0xfe, 0x2a, 0xfe, 0x26, 0xfe, + 0x32, 0xfe, 0x5a, 0xfe, 0xb1, 0xfe, 0x3a, 0xff, 0xf2, 0xff, 0xc1, 0x00, + 0x87, 0x01, 0x38, 0x02, 0xd0, 0x02, 0x4b, 0x03, 0x9f, 0x03, 0xc1, 0x03, + 0xb3, 0x03, 0x9b, 0x03, 0x8f, 0x03, 0x80, 0x03, 0x62, 0x03, 0x30, 0x03, + 0xdf, 0x02, 0x68, 0x02, 0xdd, 0x01, 0x5c, 0x01, 0xf9, 0x00, 0x9e, 0x00, + 0x38, 0x00, 0xe8, 0xff, 0xd0, 0xff, 0xdb, 0xff, 0xf8, 0xff, 0x31, 0x00, + 0x7a, 0x00, 0xb9, 0x00, 0xf3, 0x00, 0x47, 0x01, 0xcb, 0x01, 0x73, 0x02, + 0x0f, 0x03, 0x76, 0x03, 0xa9, 0x03, 0xc0, 0x03, 0xc1, 0x03, 0xa3, 0x03, + 0x6a, 0x03, 0x1f, 0x03, 0xc6, 0x02, 0x5c, 0x02, 0xde, 0x01, 0x5e, 0x01, + 0xf0, 0x00, 0x87, 0x00, 0x12, 0x00, 0x9e, 0xff, 0x44, 0xff, 0x0b, 0xff, + 0xe6, 0xfe, 0xbb, 0xfe, 0x7a, 0xfe, 0x44, 0xfe, 0x54, 0xfe, 0xad, 0xfe, + 0x25, 0xff, 0xa1, 0xff, 0x19, 0x00, 0x7a, 0x00, 0xc0, 0x00, 0xf3, 0x00, + 0x06, 0x01, 0xf2, 0x00, 0xc6, 0x00, 0x83, 0x00, 0x1c, 0x00, 0x99, 0xff, + 0x1c, 0xff, 0xba, 0xfe, 0x6c, 0xfe, 0x24, 0xfe, 0xe3, 0xfd, 0xb5, 0xfd, + 0x81, 0xfd, 0x1d, 0xfd, 0x8f, 0xfc, 0x1c, 0xfc, 0xf6, 0xfb, 0x0c, 0xfc, + 0x33, 0xfc, 0x5d, 0xfc, 0xaa, 0xfc, 0x40, 0xfd, 0xfe, 0xfd, 0x93, 0xfe, + 0xf6, 0xfe, 0x5a, 0xff, 0xbd, 0xff, 0xfe, 0xff, 0x14, 0x00, 0xfd, 0xff, + 0xc3, 0xff, 0x7c, 0xff, 0x35, 0xff, 0x01, 0xff, 0xee, 0xfe, 0xe6, 0xfe, + 0xd6, 0xfe, 0xcb, 0xfe, 0xb2, 0xfe, 0x6c, 0xfe, 0x1a, 0xfe, 0xfa, 0xfd, + 0x10, 0xfe, 0x29, 0xfe, 0x26, 0xfe, 0x06, 0xfe, 0xdc, 0xfd, 0xc7, 0xfd, + 0xe5, 0xfd, 0x45, 0xfe, 0xda, 0xfe, 0x87, 0xff, 0x37, 0x00, 0xde, 0x00, + 0x60, 0x01, 0x9b, 0x01, 0x94, 0x01, 0x77, 0x01, 0x59, 0x01, 0x2d, 0x01, + 0xe9, 0x00, 0xa0, 0x00, 0x6f, 0x00, 0x5b, 0x00, 0x4e, 0x00, 0x3a, 0x00, + 0x1b, 0x00, 0xe4, 0xff, 0x9d, 0xff, 0x5f, 0xff, 0x32, 0xff, 0xf9, 0xfe, + 0x9a, 0xfe, 0x28, 0xfe, 0xda, 0xfd, 0xd1, 0xfd, 0xf7, 0xfd, 0x2b, 0xfe, + 0x6d, 0xfe, 0xce, 0xfe, 0x4b, 0xff, 0xbd, 0xff, 0x09, 0x00, 0x49, 0x00, + 0x9e, 0x00, 0xeb, 0x00, 0x05, 0x01, 0xfc, 0x00, 0xf3, 0x00, 0xe3, 0x00, + 0xc6, 0x00, 0xae, 0x00, 0xa4, 0x00, 0x91, 0x00, 0x62, 0x00, 0x21, 0x00, + 0xef, 0xff, 0xcc, 0xff, 0x8d, 0xff, 0x1d, 0xff, 0x97, 0xfe, 0x22, 0xfe, + 0xd7, 0xfd, 0xac, 0xfd, 0x8e, 0xfd, 0x8e, 0xfd, 0xce, 0xfd, 0x55, 0xfe, + 0x0d, 0xff, 0xc9, 0xff, 0x54, 0x00, 0xaa, 0x00, 0xf0, 0x00, 0x2e, 0x01, + 0x47, 0x01, 0x32, 0x01, 0x0d, 0x01, 0xe5, 0x00, 0xa7, 0x00, 0x4f, 0x00, + 0xf6, 0xff, 0xb3, 0xff, 0xa0, 0xff, 0xc7, 0xff, 0x0e, 0x00, 0x55, 0x00, + 0xa1, 0x00, 0xf6, 0x00, 0x31, 0x01, 0x24, 0x01, 0xd0, 0x00, 0x76, 0x00, + 0x52, 0x00, 0x63, 0x00, 0x7c, 0x00, 0x80, 0x00, 0x81, 0x00, 0xa1, 0x00, + 0xdb, 0x00, 0x16, 0x01, 0x4c, 0x01, 0x84, 0x01, 0xc4, 0x01, 0xff, 0x01, + 0x15, 0x02, 0x03, 0x02, 0xf7, 0x01, 0x15, 0x02, 0x49, 0x02, 0x78, 0x02, + 0x8e, 0x02, 0x87, 0x02, 0x75, 0x02, 0x62, 0x02, 0x3f, 0x02, 0x06, 0x02, + 0xbe, 0x01, 0x64, 0x01, 0xf2, 0x00, 0x75, 0x00, 0x0f, 0x00, 0xd6, 0xff, + 0xb3, 0xff, 0x83, 0xff, 0x47, 0xff, 0x28, 0xff, 0x37, 0xff, 0x43, 0xff, + 0x13, 0xff, 0xaf, 0xfe, 0x4d, 0xfe, 0x18, 0xfe, 0x02, 0xfe, 0xd4, 0xfd, + 0x82, 0xfd, 0x46, 0xfd, 0x47, 0xfd, 0x7d, 0xfd, 0xcb, 0xfd, 0x05, 0xfe, + 0x05, 0xfe, 0xd2, 0xfd, 0x9d, 0xfd, 0x91, 0xfd, 0xab, 0xfd, 0xcb, 0xfd, + 0xe5, 0xfd, 0x02, 0xfe, 0x13, 0xfe, 0xf4, 0xfd, 0xb1, 0xfd, 0x7e, 0xfd, + 0x5e, 0xfd, 0x2e, 0xfd, 0xe4, 0xfc, 0x8c, 0xfc, 0x31, 0xfc, 0xee, 0xfb, + 0xe8, 0xfb, 0x22, 0xfc, 0x7b, 0xfc, 0xbf, 0xfc, 0xdc, 0xfc, 0xff, 0xfc, + 0x5e, 0xfd, 0xe4, 0xfd, 0x39, 0xfe, 0x2f, 0xfe, 0xfd, 0xfd, 0xf2, 0xfd, + 0x1a, 0xfe, 0x4f, 0xfe, 0x6d, 0xfe, 0x61, 0xfe, 0x37, 0xfe, 0x12, 0xfe, + 0xff, 0xfd, 0xff, 0xfd, 0x18, 0xfe, 0x42, 0xfe, 0x6d, 0xfe, 0x90, 0xfe, + 0x99, 0xfe, 0x74, 0xfe, 0x31, 0xfe, 0xf6, 0xfd, 0xc6, 0xfd, 0x90, 0xfd, + 0x55, 0xfd, 0x30, 0xfd, 0x35, 0xfd, 0x5c, 0xfd, 0x8d, 0xfd, 0xba, 0xfd, + 0xf6, 0xfd, 0x58, 0xfe, 0xc1, 0xfe, 0xf9, 0xfe, 0xff, 0xfe, 0xfa, 0xfe, + 0x04, 0xff, 0x1b, 0xff, 0x26, 0xff, 0x18, 0xff, 0x11, 0xff, 0x36, 0xff, + 0x88, 0xff, 0xf7, 0xff, 0x5f, 0x00, 0x9f, 0x00, 0xb2, 0x00, 0x9f, 0x00, + 0x6a, 0x00, 0x2c, 0x00, 0x04, 0x00, 0xf8, 0xff, 0xfa, 0xff, 0xf8, 0xff, + 0xec, 0xff, 0xec, 0xff, 0x07, 0x00, 0x12, 0x00, 0xd7, 0xff, 0x6f, 0xff, + 0x24, 0xff, 0x14, 0xff, 0x2b, 0xff, 0x55, 0xff, 0x91, 0xff, 0xda, 0xff, + 0x16, 0x00, 0x32, 0x00, 0x3d, 0x00, 0x4e, 0x00, 0x71, 0x00, 0x9f, 0x00, + 0xce, 0x00, 0xe8, 0x00, 0xd7, 0x00, 0xa0, 0x00, 0x6c, 0x00, 0x51, 0x00, + 0x4b, 0x00, 0x50, 0x00, 0x54, 0x00, 0x52, 0x00, 0x54, 0x00, 0x5e, 0x00, + 0x6c, 0x00, 0x72, 0x00, 0x58, 0x00, 0x0b, 0x00, 0xa2, 0xff, 0x5a, 0xff, + 0x4b, 0xff, 0x51, 0xff, 0x51, 0xff, 0x69, 0xff, 0xc3, 0xff, 0x46, 0x00, + 0x9f, 0x00, 0xa6, 0x00, 0x8b, 0x00, 0x96, 0x00, 0xd5, 0x00, 0x1b, 0x01, + 0x2e, 0x01, 0x0e, 0x01, 0xe9, 0x00, 0xbe, 0x00, 0x71, 0x00, 0x18, 0x00, + 0xe8, 0xff, 0xec, 0xff, 0x05, 0x00, 0x15, 0x00, 0x0d, 0x00, 0xe3, 0xff, + 0x9f, 0xff, 0x5e, 0xff, 0x26, 0xff, 0xdc, 0xfe, 0x88, 0xfe, 0x4d, 0xfe, + 0x49, 0xfe, 0x72, 0xfe, 0xb1, 0xfe, 0x06, 0xff, 0x7b, 0xff, 0x05, 0x00, + 0x9a, 0x00, 0x2e, 0x01, 0xa2, 0x01, 0xde, 0x01, 0xef, 0x01, 0xf5, 0x01, + 0xfc, 0x01, 0xf2, 0x01, 0xd5, 0x01, 0xb4, 0x01, 0x91, 0x01, 0x66, 0x01, + 0x34, 0x01, 0xff, 0x00, 0xd1, 0x00, 0xad, 0x00, 0x86, 0x00, 0x62, 0x00, + 0x4d, 0x00, 0x45, 0x00, 0x3a, 0x00, 0x2e, 0x00, 0x2f, 0x00, 0x49, 0x00, + 0x83, 0x00, 0xe1, 0x00, 0x68, 0x01, 0x1b, 0x02, 0xdd, 0x02, 0x80, 0x03, + 0xfe, 0x03, 0x71, 0x04, 0xce, 0x04, 0xf8, 0x04, 0xf5, 0x04, 0xdc, 0x04, + 0xaf, 0x04, 0x68, 0x04, 0x13, 0x04, 0xcc, 0x03, 0xa3, 0x03, 0x8e, 0x03, + 0x6a, 0x03, 0x25, 0x03, 0xde, 0x02, 0xc1, 0x02, 0xca, 0x02, 0xdc, 0x02, + 0xe8, 0x02, 0xe6, 0x02, 0xd4, 0x02, 0xc1, 0x02, 0xc4, 0x02, 0xeb, 0x02, + 0x30, 0x03, 0x88, 0x03, 0xe9, 0x03, 0x49, 0x04, 0xa1, 0x04, 0xf0, 0x04, + 0x27, 0x05, 0x37, 0x05, 0x28, 0x05, 0x04, 0x05, 0xba, 0x04, 0x44, 0x04, + 0xce, 0x03, 0x82, 0x03, 0x64, 0x03, 0x63, 0x03, 0x64, 0x03, 0x5a, 0x03, + 0x45, 0x03, 0x21, 0x03, 0xed, 0x02, 0xb1, 0x02, 0x7b, 0x02, 0x5b, 0x02, + 0x58, 0x02, 0x6b, 0x02, 0x84, 0x02, 0x8c, 0x02, 0x84, 0x02, 0x96, 0x02, + 0xc4, 0x02, 0xd9, 0x02, 0xb5, 0x02, 0x79, 0x02, 0x4b, 0x02, 0x2d, 0x02, + 0x0c, 0x02, 0xde, 0x01, 0xac, 0x01, 0x7a, 0x01, 0x43, 0x01, 0x03, 0x01, + 0xb7, 0x00, 0x6e, 0x00, 0x32, 0x00, 0xfc, 0xff, 0xbe, 0xff, 0x75, 0xff, + 0x2c, 0xff, 0xeb, 0xfe, 0xbb, 0xfe, 0xa9, 0xfe, 0xb6, 0xfe, 0xcd, 0xfe, + 0xe0, 0xfe, 0xf9, 0xfe, 0x16, 0xff, 0x2d, 0xff, 0x3b, 0xff, 0x49, 0xff, + 0x53, 0xff, 0x51, 0xff, 0x51, 0xff, 0x59, 0xff, 0x48, 0xff, 0x06, 0xff, + 0xa6, 0xfe, 0x42, 0xfe, 0xf8, 0xfd, 0xe0, 0xfd, 0xe9, 0xfd, 0xf1, 0xfd, + 0xee, 0xfd, 0xeb, 0xfd, 0xfb, 0xfd, 0x22, 0xfe, 0x4d, 0xfe, 0x72, 0xfe, + 0x9a, 0xfe, 0xc1, 0xfe, 0xe4, 0xfe, 0x12, 0xff, 0x51, 0xff, 0x93, 0xff, + 0xd2, 0xff, 0x14, 0x00, 0x52, 0x00, 0x70, 0x00, 0x69, 0x00, 0x5e, 0x00, + 0x63, 0x00, 0x62, 0x00, 0x4d, 0x00, 0x2b, 0x00, 0x0e, 0x00, 0x03, 0x00, + 0x01, 0x00, 0xe9, 0xff, 0xaf, 0xff, 0x6e, 0xff, 0x48, 0xff, 0x49, 0xff, + 0x6b, 0xff, 0x9d, 0xff, 0xc9, 0xff, 0xd9, 0xff, 0xd0, 0xff, 0xc2, 0xff, + 0xca, 0xff, 0xfc, 0xff, 0x53, 0x00, 0xbc, 0x00, 0x21, 0x01, 0x73, 0x01, + 0xb0, 0x01, 0xdb, 0x01, 0xf2, 0x01, 0xf4, 0x01, 0xd7, 0x01, 0x89, 0x01, + 0x18, 0x01, 0xbb, 0x00, 0x90, 0x00, 0x77, 0x00, 0x53, 0x00, 0x23, 0x00, + 0xf7, 0xff, 0xf1, 0xff, 0x25, 0x00, 0x63, 0x00, 0x70, 0x00, 0x58, 0x00, + 0x45, 0x00, 0x3a, 0x00, 0x16, 0x00, 0xce, 0xff, 0x8e, 0xff, 0x6b, 0xff, + 0x3a, 0xff, 0xe8, 0xfe, 0xa3, 0xfe, 0x95, 0xfe, 0xc0, 0xfe, 0x0e, 0xff, + 0x63, 0xff, 0xa1, 0xff, 0xab, 0xff, 0x8b, 0xff, 0x66, 0xff, 0x46, 0xff, + 0x18, 0xff, 0xd0, 0xfe, 0x83, 0xfe, 0x48, 0xfe, 0x14, 0xfe, 0xd3, 0xfd, + 0x92, 0xfd, 0x60, 0xfd, 0x37, 0xfd, 0x10, 0xfd, 0xef, 0xfc, 0xdf, 0xfc, + 0xee, 0xfc, 0x18, 0xfd, 0x3c, 0xfd, 0x3e, 0xfd, 0x30, 0xfd, 0x34, 0xfd, + 0x43, 0xfd, 0x4f, 0xfd, 0x60, 0xfd, 0x7e, 0xfd, 0xab, 0xfd, 0xdc, 0xfd, + 0xf8, 0xfd, 0xf6, 0xfd, 0xe2, 0xfd, 0xb8, 0xfd, 0x7a, 0xfd, 0x4d, 0xfd, + 0x4b, 0xfd, 0x68, 0xfd, 0x8e, 0xfd, 0xb6, 0xfd, 0xd8, 0xfd, 0xe9, 0xfd, + 0xe6, 0xfd, 0xd8, 0xfd, 0xd7, 0xfd, 0x04, 0xfe, 0x54, 0xfe, 0x8f, 0xfe, + 0x8e, 0xfe, 0x6a, 0xfe, 0x54, 0xfe, 0x5a, 0xfe, 0x59, 0xfe, 0x3c, 0xfe, + 0x19, 0xfe, 0x25, 0xfe, 0x75, 0xfe, 0xe4, 0xfe, 0x3c, 0xff, 0x71, 0xff, + 0x95, 0xff, 0xbd, 0xff, 0xe5, 0xff, 0x0a, 0x00, 0x3d, 0x00, 0x89, 0x00, + 0xd1, 0x00, 0xec, 0x00, 0xbe, 0x00, 0x4a, 0x00, 0xc4, 0xff, 0x74, 0xff, + 0x72, 0xff, 0x8b, 0xff, 0x87, 0xff, 0x78, 0xff, 0x8b, 0xff, 0xbe, 0xff, + 0x08, 0x00, 0x5b, 0x00, 0xa1, 0x00, 0xe7, 0x00, 0x41, 0x01, 0x93, 0x01, + 0xb6, 0x01, 0xa5, 0x01, 0x7d, 0x01, 0x61, 0x01, 0x4f, 0x01, 0x2f, 0x01, + 0xfb, 0x00, 0xd0, 0x00, 0xc5, 0x00, 0xc3, 0x00, 0xb4, 0x00, 0xa6, 0x00, + 0x9e, 0x00, 0x8d, 0x00, 0x73, 0x00, 0x52, 0x00, 0x2f, 0x00, 0x17, 0x00, + 0x0e, 0x00, 0x0a, 0x00, 0xff, 0xff, 0xe9, 0xff, 0xcb, 0xff, 0xb0, 0xff, + 0xaf, 0xff, 0xd0, 0xff, 0xf7, 0xff, 0x0a, 0x00, 0x07, 0x00, 0xf8, 0xff, + 0xf3, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x20, 0x00, 0x31, 0x00, 0x42, 0x00, + 0x5e, 0x00, 0x8e, 0x00, 0xcc, 0x00, 0x00, 0x01, 0x13, 0x01, 0x0a, 0x01, + 0xf5, 0x00, 0xdd, 0x00, 0xd1, 0x00, 0xd9, 0x00, 0xe1, 0x00, 0xdd, 0x00, + 0xc8, 0x00, 0xa4, 0x00, 0x85, 0x00, 0x74, 0x00, 0x63, 0x00, 0x4b, 0x00, + 0x27, 0x00, 0x00, 0x00, 0xe7, 0xff, 0xec, 0xff, 0x0f, 0x00, 0x35, 0x00, + 0x47, 0x00, 0x4b, 0x00, 0x48, 0x00, 0x34, 0x00, 0x02, 0x00, 0xb2, 0xff, + 0x46, 0xff, 0xcf, 0xfe, 0x5b, 0xfe, 0xe8, 0xfd, 0x7b, 0xfd, 0x2f, 0xfd, + 0x13, 0xfd, 0x20, 0xfd, 0x46, 0xfd, 0x6f, 0xfd, 0x73, 0xfd, 0x46, 0xfd, + 0xf9, 0xfc, 0x95, 0xfc, 0x2f, 0xfc, 0xe8, 0xfb, 0xcd, 0xfb, 0xe5, 0xfb, + 0x2f, 0xfc, 0x97, 0xfc, 0x13, 0xfd, 0x9d, 0xfd, 0x22, 0xfe, 0x88, 0xfe, + 0xc2, 0xfe, 0xba, 0xfe, 0x78, 0xfe, 0x33, 0xfe, 0x1d, 0xfe, 0x2f, 0xfe, + 0x4f, 0xfe, 0x6f, 0xfe, 0x8e, 0xfe, 0xb4, 0xfe, 0xd8, 0xfe, 0xe8, 0xfe, + 0xec, 0xfe, 0xf4, 0xfe, 0xf7, 0xfe, 0xdc, 0xfe, 0x91, 0xfe, 0x2f, 0xfe, + 0xe5, 0xfd, 0xd4, 0xfd, 0x0d, 0xfe, 0x7e, 0xfe, 0xe2, 0xfe, 0x10, 0xff, + 0x23, 0xff, 0x3a, 0xff, 0x55, 0xff, 0x64, 0xff, 0x59, 0xff, 0x3d, 0xff, + 0x2e, 0xff, 0x30, 0xff, 0x2f, 0xff, 0x26, 0xff, 0x26, 0xff, 0x3e, 0xff, + 0x6e, 0xff, 0xa5, 0xff, 0xc7, 0xff, 0xc8, 0xff, 0xae, 0xff, 0x79, 0xff, + 0x34, 0xff, 0xf2, 0xfe, 0xbf, 0xfe, 0xa1, 0xfe, 0x98, 0xfe, 0x92, 0xfe, + 0x85, 0xfe, 0x82, 0xfe, 0x9d, 0xfe, 0xdc, 0xfe, 0x28, 0xff, 0x6b, 0xff, + 0xa5, 0xff, 0xd7, 0xff, 0xf0, 0xff, 0xe6, 0xff, 0xc5, 0xff, 0xa3, 0xff, + 0x96, 0xff, 0xb2, 0xff, 0xef, 0xff, 0x24, 0x00, 0x48, 0x00, 0x7b, 0x00, + 0xcb, 0x00, 0x21, 0x01, 0x5a, 0x01, 0x64, 0x01, 0x4a, 0x01, 0x1a, 0x01, + 0xd8, 0x00, 0x92, 0x00, 0x58, 0x00, 0x39, 0x00, 0x3b, 0x00, 0x50, 0x00, + 0x5e, 0x00, 0x62, 0x00, 0x66, 0x00, 0x56, 0x00, 0x32, 0x00, 0x31, 0x00, + 0x79, 0x00, 0xc4, 0x00, 0xbf, 0x00, 0x6f, 0x00, 0x16, 0x00, 0xeb, 0xff, + 0xf8, 0xff, 0xfe, 0xff, 0xc8, 0xff, 0x97, 0xff, 0xcb, 0xff, 0x40, 0x00, + 0x85, 0x00, 0x80, 0x00, 0x66, 0x00, 0x49, 0x00, 0x04, 0x00, 0x9e, 0xff, + 0x5c, 0xff, 0x5d, 0xff, 0x71, 0xff, 0x6f, 0xff, 0x5d, 0xff, 0x4e, 0xff, + 0x45, 0xff, 0x3b, 0xff, 0x34, 0xff, 0x3b, 0xff, 0x58, 0xff, 0x98, 0xff, + 0xf2, 0xff, 0x3e, 0x00, 0x5d, 0x00, 0x4c, 0x00, 0x0f, 0x00, 0xd6, 0xff, + 0xe4, 0xff, 0x3c, 0x00, 0x9c, 0x00, 0xd0, 0x00, 0xda, 0x00, 0xce, 0x00, + 0xae, 0x00, 0x7e, 0x00, 0x58, 0x00, 0x3a, 0x00, 0xff, 0xff, 0x99, 0xff, + 0x2c, 0xff, 0xda, 0xfe, 0xb6, 0xfe, 0xcf, 0xfe, 0x22, 0xff, 0x81, 0xff, + 0xc3, 0xff, 0xed, 0xff, 0x12, 0x00, 0x46, 0x00, 0x99, 0x00, 0xf4, 0x00, + 0x34, 0x01, 0x5a, 0x01, 0x85, 0x01, 0xbb, 0x01, 0xe7, 0x01, 0x06, 0x02, + 0x27, 0x02, 0x35, 0x02, 0x14, 0x02, 0xe5, 0x01, 0xdb, 0x01, 0xed, 0x01, + 0xf0, 0x01, 0xbf, 0x01, 0x5c, 0x01, 0xf3, 0x00, 0xae, 0x00, 0x86, 0x00, + 0x5f, 0x00, 0x3b, 0x00, 0x26, 0x00, 0x20, 0x00, 0x2f, 0x00, 0x53, 0x00, + 0x7f, 0x00, 0xb7, 0x00, 0x06, 0x01, 0x66, 0x01, 0xc1, 0x01, 0x0a, 0x02, + 0x4a, 0x02, 0x98, 0x02, 0xfa, 0x02, 0x63, 0x03, 0xbc, 0x03, 0xe8, 0x03, + 0xe2, 0x03, 0xba, 0x03, 0x76, 0x03, 0x21, 0x03, 0xd0, 0x02, 0x88, 0x02, + 0x41, 0x02, 0xed, 0x01, 0x85, 0x01, 0x1d, 0x01, 0xd0, 0x00, 0x9d, 0x00, + 0x6e, 0x00, 0x42, 0x00, 0x38, 0x00, 0x5d, 0x00, 0xa1, 0x00, 0xf4, 0x00, + 0x4e, 0x01, 0xa9, 0x01, 0x0c, 0x02, 0x6e, 0x02, 0xb3, 0x02, 0xd4, 0x02, + 0xf1, 0x02, 0x23, 0x03, 0x68, 0x03, 0xac, 0x03, 0xdc, 0x03, 0xe7, 0x03, + 0xc9, 0x03, 0x7d, 0x03, 0xff, 0x02, 0x68, 0x02, 0xe0, 0x01, 0x7a, 0x01, + 0x2a, 0x01, 0xe9, 0x00, 0xbc, 0x00, 0x99, 0x00, 0x6f, 0x00, 0x4a, 0x00, + 0x34, 0x00, 0x22, 0x00, 0x12, 0x00, 0x23, 0x00, 0x64, 0x00, 0xb7, 0x00, + 0xf1, 0x00, 0x10, 0x01, 0x33, 0x01, 0x63, 0x01, 0x8b, 0x01, 0xac, 0x01, + 0xd9, 0x01, 0x12, 0x02, 0x38, 0x02, 0x36, 0x02, 0x16, 0x02, 0xef, 0x01, + 0xbe, 0x01, 0x7a, 0x01, 0x23, 0x01, 0xd0, 0x00, 0x8e, 0x00, 0x4c, 0x00, + 0x00, 0x00, 0xbb, 0xff, 0x83, 0xff, 0x4c, 0xff, 0x17, 0xff, 0xe7, 0xfe, + 0xc1, 0xfe, 0xac, 0xfe, 0xad, 0xfe, 0xc7, 0xfe, 0xed, 0xfe, 0x1b, 0xff, + 0x65, 0xff, 0xca, 0xff, 0x27, 0x00, 0x6f, 0x00, 0xac, 0x00, 0xe2, 0x00, + 0x07, 0x01, 0x11, 0x01, 0x02, 0x01, 0xee, 0x00, 0xd2, 0x00, 0x94, 0x00, + 0x3a, 0x00, 0xfa, 0xff, 0xea, 0xff, 0xf4, 0xff, 0xf6, 0xff, 0xd1, 0xff, + 0x92, 0xff, 0x67, 0xff, 0x5c, 0xff, 0x5e, 0xff, 0x5e, 0xff, 0x54, 0xff, + 0x4a, 0xff, 0x53, 0xff, 0x6e, 0xff, 0x8e, 0xff, 0xa7, 0xff, 0xb2, 0xff, + 0xb6, 0xff, 0xc8, 0xff, 0xf2, 0xff, 0x30, 0x00, 0x77, 0x00, 0xb1, 0x00, + 0xd0, 0x00, 0xdf, 0x00, 0xed, 0x00, 0xfe, 0x00, 0x11, 0x01, 0x1c, 0x01, + 0x14, 0x01, 0xf8, 0x00, 0xd7, 0x00, 0xbc, 0x00, 0xaa, 0x00, 0xa0, 0x00, + 0x8f, 0x00, 0x6b, 0x00, 0x2d, 0x00, 0xdf, 0xff, 0x9f, 0xff, 0x81, 0xff, + 0x7d, 0xff, 0x85, 0xff, 0x8c, 0xff, 0x95, 0xff, 0xbe, 0xff, 0x0c, 0x00, + 0x5c, 0x00, 0x97, 0x00, 0xb9, 0x00, 0xc1, 0x00, 0xc2, 0x00, 0xd4, 0x00, + 0xe5, 0x00, 0xe0, 0x00, 0xd9, 0x00, 0xe8, 0x00, 0x11, 0x01, 0x3d, 0x01, + 0x4f, 0x01, 0x4d, 0x01, 0x4d, 0x01, 0x46, 0x01, 0x29, 0x01, 0xfc, 0x00, + 0xd0, 0x00, 0xb0, 0x00, 0x90, 0x00, 0x5d, 0x00, 0x1f, 0x00, 0xef, 0xff, + 0xd8, 0xff, 0xd4, 0xff, 0xd3, 0xff, 0xd0, 0xff, 0xd5, 0xff, 0xe1, 0xff, + 0xe3, 0xff, 0xdf, 0xff, 0xe6, 0xff, 0x00, 0x00, 0x17, 0x00, 0x15, 0x00, + 0x08, 0x00, 0x08, 0x00, 0x03, 0x00, 0xe6, 0xff, 0xbb, 0xff, 0x9e, 0xff, + 0xa5, 0xff, 0xd4, 0xff, 0x0d, 0x00, 0x18, 0x00, 0xcd, 0xff, 0x38, 0xff, + 0x91, 0xfe, 0x06, 0xfe, 0xa6, 0xfd, 0x67, 0xfd, 0x46, 0xfd, 0x49, 0xfd, + 0x60, 0xfd, 0x78, 0xfd, 0x8c, 0xfd, 0x99, 0xfd, 0x92, 0xfd, 0x6e, 0xfd, + 0x3b, 0xfd, 0x1b, 0xfd, 0x22, 0xfd, 0x4c, 0xfd, 0x86, 0xfd, 0xc2, 0xfd, + 0xf0, 0xfd, 0x09, 0xfe, 0x18, 0xfe, 0x30, 0xfe, 0x44, 0xfe, 0x44, 0xfe, + 0x2b, 0xfe, 0x01, 0xfe, 0xdd, 0xfd, 0xd5, 0xfd, 0xe4, 0xfd, 0xea, 0xfd, + 0xd0, 0xfd, 0x97, 0xfd, 0x52, 0xfd, 0x1a, 0xfd, 0x02, 0xfd, 0x1e, 0xfd, + 0x6c, 0xfd, 0xcb, 0xfd, 0x0b, 0xfe, 0x1e, 0xfe, 0x27, 0xfe, 0x32, 0xfe, + 0x33, 0xfe, 0x31, 0xfe, 0x43, 0xfe, 0x6c, 0xfe, 0xb7, 0xfe, 0x1a, 0xff, + 0x73, 0xff, 0xa8, 0xff, 0xbc, 0xff, 0xb3, 0xff, 0x95, 0xff, 0x6e, 0xff, + 0x4b, 0xff, 0x30, 0xff, 0x13, 0xff, 0xe4, 0xfe, 0xa6, 0xfe, 0x66, 0xfe, + 0x38, 0xfe, 0x31, 0xfe, 0x54, 0xfe, 0x82, 0xfe, 0x8c, 0xfe, 0x70, 0xfe, + 0x69, 0xfe, 0xa8, 0xfe, 0x1a, 0xff, 0x82, 0xff, 0xcd, 0xff, 0x13, 0x00, + 0x5e, 0x00, 0xa1, 0x00, 0xd3, 0x00, 0xf7, 0x00, 0x13, 0x01, 0x26, 0x01, + 0x2c, 0x01, 0x32, 0x01, 0x3c, 0x01, 0x41, 0x01, 0x3b, 0x01, 0x24, 0x01, + 0xf4, 0x00, 0xad, 0x00, 0x5f, 0x00, 0x19, 0x00, 0xdd, 0xff, 0xb7, 0xff, + 0xb0, 0xff, 0xb2, 0xff, 0xa5, 0xff, 0x9c, 0xff, 0xad, 0xff, 0xdd, 0xff, + 0x18, 0x00, 0x42, 0x00, 0x5c, 0x00, 0x7e, 0x00, 0xb0, 0x00, 0xe5, 0x00, + 0x0a, 0x01, 0x1f, 0x01, 0x33, 0x01, 0x46, 0x01, 0x46, 0x01, 0x28, 0x01, + 0xef, 0x00, 0xa9, 0x00, 0x6a, 0x00, 0x3f, 0x00, 0x2e, 0x00, 0x24, 0x00, + 0x12, 0x00, 0xff, 0xff, 0xf0, 0xff, 0xd5, 0xff, 0xa8, 0xff, 0x7f, 0xff, + 0x6a, 0xff, 0x6c, 0xff, 0x7c, 0xff, 0x95, 0xff, 0xaa, 0xff, 0xb2, 0xff, + 0xb8, 0xff, 0xd0, 0xff, 0xf6, 0xff, 0x18, 0x00, 0x2b, 0x00, 0x39, 0x00, + 0x41, 0x00, 0x33, 0x00, 0x0a, 0x00, 0xd7, 0xff, 0xbc, 0xff, 0xd4, 0xff, + 0x11, 0x00, 0x45, 0x00, 0x50, 0x00, 0x38, 0x00, 0x23, 0x00, 0x22, 0x00, + 0x26, 0x00, 0x19, 0x00, 0xf3, 0xff, 0xc2, 0xff, 0x93, 0xff, 0x63, 0xff, + 0x3f, 0xff, 0x4b, 0xff, 0x8d, 0xff, 0xe2, 0xff, 0x27, 0x00, 0x4c, 0x00, + 0x61, 0x00, 0x76, 0x00, 0x8d, 0x00, 0xa0, 0x00, 0xa3, 0x00, 0x8d, 0x00, + 0x63, 0x00, 0x3f, 0x00, 0x31, 0x00, 0x30, 0x00, 0x2d, 0x00, 0x25, 0x00, + 0x1e, 0x00, 0x1e, 0x00, 0x21, 0x00, 0x25, 0x00, 0x1f, 0x00, 0x05, 0x00, + 0xe0, 0xff, 0xcc, 0xff, 0xdf, 0xff, 0x07, 0x00, 0x32, 0x00, 0x5d, 0x00, + 0x95, 0x00, 0xe5, 0x00, 0x3d, 0x01, 0x75, 0x01, 0x7a, 0x01, 0x55, 0x01, + 0x1a, 0x01, 0xdf, 0x00, 0xc0, 0x00, 0xc3, 0x00, 0xcb, 0x00, 0xc2, 0x00, + 0xac, 0x00, 0x9d, 0x00, 0xad, 0x00, 0xd5, 0x00, 0xfd, 0x00, 0x17, 0x01, + 0x20, 0x01, 0x0b, 0x01, 0xda, 0x00, 0x9f, 0x00, 0x80, 0x00, 0x92, 0x00, + 0xbb, 0x00, 0xd4, 0x00, 0xd4, 0x00, 0xbd, 0x00, 0xa1, 0x00, 0x8f, 0x00, + 0x88, 0x00, 0x8d, 0x00, 0x9a, 0x00, 0xa2, 0x00, 0x9f, 0x00, 0x9c, 0x00, + 0xa4, 0x00, 0xb7, 0x00, 0xc8, 0x00, 0xcf, 0x00, 0xd0, 0x00, 0xd1, 0x00, + 0xcd, 0x00, 0xb8, 0x00, 0x9e, 0x00, 0x9a, 0x00, 0xac, 0x00, 0xbf, 0x00, + 0xc7, 0x00, 0xbf, 0x00, 0xb1, 0x00, 0xaa, 0x00, 0xaa, 0x00, 0xa6, 0x00, + 0x97, 0x00, 0x78, 0x00, 0x59, 0x00, 0x57, 0x00, 0x6f, 0x00, 0x7a, 0x00, + 0x63, 0x00, 0x45, 0x00, 0x39, 0x00, 0x3c, 0x00, 0x48, 0x00, 0x56, 0x00, + 0x51, 0x00, 0x2d, 0x00, 0xfc, 0xff, 0xdb, 0xff, 0xd4, 0xff, 0xd2, 0xff, + 0xc0, 0xff, 0x93, 0xff, 0x4b, 0xff, 0x06, 0xff, 0xec, 0xfe, 0xfd, 0xfe, + 0x1d, 0xff, 0x33, 0xff, 0x32, 0xff, 0x1b, 0xff, 0xf2, 0xfe, 0xc1, 0xfe, + 0x9f, 0xfe, 0x96, 0xfe, 0xa1, 0xfe, 0xbc, 0xfe, 0xe1, 0xfe, 0x0d, 0xff, + 0x3f, 0xff, 0x71, 0xff, 0x9d, 0xff, 0xba, 0xff, 0xb9, 0xff, 0xa3, 0xff, + 0x86, 0xff, 0x60, 0xff, 0x2b, 0xff, 0xf5, 0xfe, 0xcc, 0xfe, 0xad, 0xfe, + 0x99, 0xfe, 0x91, 0xfe, 0x8f, 0xfe, 0x88, 0xfe, 0x7f, 0xfe, 0x7e, 0xfe, + 0x90, 0xfe, 0xb7, 0xfe, 0xea, 0xfe, 0x1d, 0xff, 0x42, 0xff, 0x58, 0xff, + 0x65, 0xff, 0x73, 0xff, 0x87, 0xff, 0xa5, 0xff, 0xc9, 0xff, 0xeb, 0xff, + 0x0a, 0x00, 0x26, 0x00, 0x2c, 0x00, 0x13, 0x00, 0xed, 0xff, 0xbf, 0xff, + 0x87, 0xff, 0x61, 0xff, 0x61, 0xff, 0x6f, 0xff, 0x72, 0xff, 0x60, 0xff, + 0x3e, 0xff, 0x1d, 0xff, 0x05, 0xff, 0xf4, 0xfe, 0xec, 0xfe, 0xf2, 0xfe, + 0x0b, 0xff, 0x40, 0xff, 0x89, 0xff, 0xc7, 0xff, 0xde, 0xff, 0xe4, 0xff, + 0x1f, 0x00, 0xa5, 0x00, 0x36, 0x01, 0x94, 0x01, 0xc1, 0x01, 0xc5, 0x01, + 0x8b, 0x01, 0x17, 0x01, 0xa7, 0x00, 0x73, 0x00, 0x70, 0x00, 0x7c, 0x00, + 0x82, 0x00, 0x70, 0x00, 0x3f, 0x00, 0xf4, 0xff, 0xa7, 0xff, 0x77, 0xff, + 0x73, 0xff, 0x99, 0xff, 0xd4, 0xff, 0xff, 0xff, 0x09, 0x00, 0xfd, 0xff, + 0xeb, 0xff, 0xe1, 0xff, 0xe6, 0xff, 0x00, 0x00, 0x3b, 0x00, 0x94, 0x00, + 0xe9, 0x00, 0x24, 0x01, 0x46, 0x01, 0x58, 0x01, 0x5e, 0x01, 0x53, 0x01, + 0x38, 0x01, 0x15, 0x01, 0xeb, 0x00, 0xb8, 0x00, 0x81, 0x00, 0x4b, 0x00, + 0x16, 0x00, 0xe6, 0xff, 0xbe, 0xff, 0x96, 0xff, 0x64, 0xff, 0x37, 0xff, + 0x1f, 0xff, 0x15, 0xff, 0x0e, 0xff, 0x0b, 0xff, 0x18, 0xff, 0x33, 0xff, + 0x4d, 0xff, 0x6c, 0xff, 0xa5, 0xff, 0xf1, 0xff, 0x34, 0x00, 0x63, 0x00, + 0x7d, 0x00, 0x8e, 0x00, 0xad, 0x00, 0xd5, 0x00, 0xed, 0x00, 0xea, 0x00, + 0xc8, 0x00, 0x90, 0x00, 0x53, 0x00, 0x19, 0x00, 0xee, 0xff, 0xe1, 0xff, + 0xe5, 0xff, 0xde, 0xff, 0xcd, 0xff, 0xc3, 0xff, 0xc1, 0xff, 0xc1, 0xff, + 0xba, 0xff, 0xa9, 0xff, 0x9a, 0xff, 0x91, 0xff, 0x89, 0xff, 0x7c, 0xff, + 0x74, 0xff, 0x7f, 0xff, 0x9b, 0xff, 0xbd, 0xff, 0xe6, 0xff, 0x12, 0x00, + 0x33, 0x00, 0x37, 0x00, 0x16, 0x00, 0xdb, 0xff, 0x9f, 0xff, 0x73, 0xff, + 0x5b, 0xff, 0x52, 0xff, 0x52, 0xff, 0x59, 0xff, 0x64, 0xff, 0x64, 0xff, + 0x50, 0xff, 0x23, 0xff, 0xec, 0xfe, 0xc6, 0xfe, 0xb5, 0xfe, 0xae, 0xfe, + 0xa4, 0xfe, 0x92, 0xfe, 0x85, 0xfe, 0x82, 0xfe, 0x84, 0xfe, 0x94, 0xfe, + 0xb9, 0xfe, 0xe7, 0xfe, 0x1e, 0xff, 0x5c, 0xff, 0x96, 0xff, 0xd0, 0xff, + 0x11, 0x00, 0x56, 0x00, 0x89, 0x00, 0x99, 0x00, 0x8a, 0x00, 0x62, 0x00, + 0x25, 0x00, 0xea, 0xff, 0xcc, 0xff, 0xcd, 0xff, 0xe6, 0xff, 0x0c, 0x00, + 0x2f, 0x00, 0x46, 0x00, 0x46, 0x00, 0x20, 0x00, 0xd6, 0xff, 0x7f, 0xff, + 0x38, 0xff, 0x0c, 0xff, 0xf7, 0xfe, 0x01, 0xff, 0x34, 0xff, 0x77, 0xff, + 0xaf, 0xff, 0xe0, 0xff, 0x11, 0x00, 0x35, 0x00, 0x45, 0x00, 0x4a, 0x00, + 0x4e, 0x00, 0x5b, 0x00, 0x7e, 0x00, 0x97, 0x00, 0x8d, 0x00, 0x83, 0x00, + 0x8e, 0x00, 0x7f, 0x00, 0x40, 0x00, 0x03, 0x00, 0xf1, 0xff, 0xf1, 0xff, + 0xd2, 0xff, 0x93, 0xff, 0x56, 0xff, 0x33, 0xff, 0x30, 0xff, 0x49, 0xff, + 0x70, 0xff, 0x88, 0xff, 0x7e, 0xff, 0x56, 0xff, 0x21, 0xff, 0xf5, 0xfe, + 0xea, 0xfe, 0x05, 0xff, 0x2c, 0xff, 0x54, 0xff, 0x93, 0xff, 0xf4, 0xff, + 0x64, 0x00, 0xd4, 0x00, 0x23, 0x01, 0x13, 0x01, 0x90, 0x00, 0xe0, 0xff, + 0x5f, 0xff, 0x30, 0xff, 0x4f, 0xff, 0xb1, 0xff, 0x43, 0x00, 0xca, 0x00, + 0x00, 0x01, 0xcb, 0x00, 0x4a, 0x00, 0xac, 0xff, 0x1e, 0xff, 0xdc, 0xfe, + 0x1d, 0xff, 0xc6, 0xff, 0x7a, 0x00, 0xe8, 0x00, 0xec, 0x00, 0x98, 0x00, + 0x2b, 0x00, 0xdd, 0xff, 0xd3, 0xff, 0x13, 0x00, 0x7c, 0x00, 0xe1, 0x00, + 0x29, 0x01, 0x45, 0x01, 0x40, 0x01, 0x31, 0x01, 0x23, 0x01, 0x1c, 0x01, + 0x21, 0x01, 0x22, 0x01, 0x1a, 0x01, 0x0a, 0x01, 0xfb, 0x00, 0xf9, 0x00, + 0x01, 0x01, 0xf5, 0x00, 0xcc, 0x00, 0xa3, 0x00, 0x90, 0x00, 0x83, 0x00, + 0x69, 0x00, 0x49, 0x00, 0x2f, 0x00, 0x29, 0x00, 0x46, 0x00, 0x80, 0x00, + 0xb8, 0x00, 0xcf, 0x00, 0xc6, 0x00, 0xc3, 0x00, 0xda, 0x00, 0xf0, 0x00, + 0xf4, 0x00, 0xf3, 0x00, 0xfa, 0x00, 0x06, 0x01, 0x00, 0x01, 0xdc, 0x00, + 0xb3, 0x00, 0x9c, 0x00, 0x9a, 0x00, 0xaa, 0x00, 0xc3, 0x00, 0xcb, 0x00, + 0xbd, 0x00, 0xa5, 0x00, 0x85, 0x00, 0x5a, 0x00, 0x2e, 0x00, 0x13, 0x00, + 0x15, 0x00, 0x30, 0x00, 0x5c, 0x00, 0x8b, 0x00, 0xb4, 0x00, 0xcb, 0x00, + 0xc3, 0x00, 0x92, 0x00, 0x4b, 0x00, 0x14, 0x00, 0x0d, 0x00, 0x31, 0x00, + 0x5c, 0x00, 0x71, 0x00, 0x6b, 0x00, 0x50, 0x00, 0x2c, 0x00, 0x10, 0x00, + 0x09, 0x00, 0x22, 0x00, 0x53, 0x00, 0x84, 0x00, 0x9e, 0x00, 0x99, 0x00, + 0x85, 0x00, 0x7a, 0x00, 0x83, 0x00, 0x90, 0x00, 0x97, 0x00, 0xa1, 0x00, + 0xad, 0x00, 0xa9, 0x00, 0x96, 0x00, 0x88, 0x00, 0x93, 0x00, 0xb7, 0x00, + 0xd4, 0x00, 0xd1, 0x00, 0xb2, 0x00, 0x8b, 0x00, 0x67, 0x00, 0x4f, 0x00, + 0x47, 0x00, 0x47, 0x00, 0x3f, 0x00, 0x2b, 0x00, 0x18, 0x00, 0x16, 0x00, + 0x24, 0x00, 0x39, 0x00, 0x61, 0x00, 0xa6, 0x00, 0xf4, 0x00, 0x37, 0x01, + 0x6a, 0x01, 0x8b, 0x01, 0xa1, 0x01, 0xaa, 0x01, 0x99, 0x01, 0x77, 0x01, + 0x64, 0x01, 0x6f, 0x01, 0x88, 0x01, 0x91, 0x01, 0x7d, 0x01, 0x51, 0x01, + 0x0f, 0x01, 0xc9, 0x00, 0x92, 0x00, 0x6c, 0x00, 0x50, 0x00, 0x36, 0x00, + 0x1a, 0x00, 0x0b, 0x00, 0x11, 0x00, 0x24, 0x00, 0x47, 0x00, 0x7f, 0x00, + 0xb5, 0x00, 0xd0, 0x00, 0xd4, 0x00, 0xdb, 0x00, 0xf0, 0x00, 0x11, 0x01, + 0x3d, 0x01, 0x61, 0x01, 0x6a, 0x01, 0x5a, 0x01, 0x3b, 0x01, 0x12, 0x01, + 0xdd, 0x00, 0x9c, 0x00, 0x6b, 0x00, 0x55, 0x00, 0x3e, 0x00, 0x20, 0x00, + 0x15, 0x00, 0x1d, 0x00, 0x1e, 0x00, 0x0b, 0x00, 0xf2, 0xff, 0xec, 0xff, + 0x01, 0x00, 0x19, 0x00, 0x15, 0x00, 0xf6, 0xff, 0xdc, 0xff, 0xda, 0xff, + 0xe7, 0xff, 0xfe, 0xff, 0x20, 0x00, 0x44, 0x00, 0x5f, 0x00, 0x6c, 0x00, + 0x67, 0x00, 0x56, 0x00, 0x4b, 0x00, 0x50, 0x00, 0x5e, 0x00, 0x5d, 0x00, + 0x49, 0x00, 0x2e, 0x00, 0x0f, 0x00, 0xde, 0xff, 0xa3, 0xff, 0x70, 0xff, + 0x47, 0xff, 0x21, 0xff, 0x0a, 0xff, 0x08, 0xff, 0x0d, 0xff, 0x0d, 0xff, + 0x0b, 0xff, 0x14, 0xff, 0x29, 0xff, 0x42, 0xff, 0x57, 0xff, 0x68, 0xff, + 0x76, 0xff, 0x8c, 0xff, 0xa5, 0xff, 0xb2, 0xff, 0xae, 0xff, 0x99, 0xff, + 0x7a, 0xff, 0x60, 0xff, 0x59, 0xff, 0x63, 0xff, 0x71, 0xff, 0x74, 0xff, + 0x6b, 0xff, 0x59, 0xff, 0x45, 0xff, 0x3a, 0xff, 0x3e, 0xff, 0x4d, 0xff, + 0x58, 0xff, 0x50, 0xff, 0x39, 0xff, 0x24, 0xff, 0x1f, 0xff, 0x28, 0xff, + 0x2d, 0xff, 0x23, 0xff, 0x15, 0xff, 0x10, 0xff, 0x1e, 0xff, 0x46, 0xff, + 0x80, 0xff, 0xb9, 0xff, 0xee, 0xff, 0x17, 0x00, 0x1c, 0x00, 0xf2, 0xff, + 0xbc, 0xff, 0xb1, 0xff, 0xe5, 0xff, 0x34, 0x00, 0x68, 0x00, 0x65, 0x00, + 0x3d, 0x00, 0x08, 0x00, 0xcb, 0xff, 0x8c, 0xff, 0x66, 0xff, 0x68, 0xff, + 0x91, 0xff, 0xc6, 0xff, 0xd5, 0xff, 0xa8, 0xff, 0x57, 0xff, 0x0a, 0xff, + 0xdf, 0xfe, 0xdd, 0xfe, 0x0d, 0xff, 0x73, 0xff, 0xea, 0xff, 0x34, 0x00, + 0x38, 0x00, 0x0a, 0x00, 0xd8, 0xff, 0xc5, 0xff, 0xd5, 0xff, 0xf1, 0xff, + 0x0b, 0x00, 0x1d, 0x00, 0x2d, 0x00, 0x40, 0x00, 0x60, 0x00, 0x8d, 0x00, + 0xb3, 0x00, 0xb7, 0x00, 0x8e, 0x00, 0x49, 0x00, 0x06, 0x00, 0xd1, 0xff, + 0xaa, 0xff, 0x92, 0xff, 0x85, 0xff, 0x7f, 0xff, 0x7b, 0xff, 0x75, 0xff, + 0x67, 0xff, 0x4d, 0xff, 0x35, 0xff, 0x32, 0xff, 0x4a, 0xff, 0x77, 0xff, + 0xae, 0xff, 0xd8, 0xff, 0xe6, 0xff, 0xdd, 0xff, 0xc5, 0xff, 0xa4, 0xff, + 0x8e, 0xff, 0x90, 0xff, 0xa6, 0xff, 0xcf, 0xff, 0x01, 0x00, 0x21, 0x00, + 0x1f, 0x00, 0xfe, 0xff, 0xc6, 0xff, 0x77, 0xff, 0x26, 0xff, 0xf4, 0xfe, + 0xf5, 0xfe, 0x18, 0xff, 0x39, 0xff, 0x43, 0xff, 0x30, 0xff, 0x06, 0xff, + 0xd4, 0xfe, 0xaa, 0xfe, 0x8c, 0xfe, 0x7b, 0xfe, 0x74, 0xfe, 0x77, 0xfe, + 0x89, 0xfe, 0xa2, 0xfe, 0xb2, 0xfe, 0xb3, 0xfe, 0xaa, 0xfe, 0xac, 0xfe, + 0xc8, 0xfe, 0xfd, 0xfe, 0x37, 0xff, 0x6b, 0xff, 0x92, 0xff, 0xac, 0xff, + 0xb0, 0xff, 0x94, 0xff, 0x56, 0xff, 0x0a, 0xff, 0xc4, 0xfe, 0x8f, 0xfe, + 0x75, 0xfe, 0x74, 0xfe, 0x82, 0xfe, 0x92, 0xfe, 0x9f, 0xfe, 0xa7, 0xfe, + 0xb5, 0xfe, 0xd5, 0xfe, 0x03, 0xff, 0x37, 0xff, 0x67, 0xff, 0x8b, 0xff, + 0xa8, 0xff, 0xc6, 0xff, 0xe6, 0xff, 0xfd, 0xff, 0x02, 0x00, 0x06, 0x00, + 0x1b, 0x00, 0x39, 0x00, 0x55, 0x00, 0x75, 0x00, 0x92, 0x00, 0x99, 0x00, + 0x85, 0x00, 0x62, 0x00, 0x3a, 0x00, 0x19, 0x00, 0x08, 0x00, 0x04, 0x00, + 0x02, 0x00, 0x04, 0x00, 0x12, 0x00, 0x28, 0x00, 0x3c, 0x00, 0x48, 0x00, + 0x4c, 0x00, 0x49, 0x00, 0x3d, 0x00, 0x2a, 0x00, 0x0c, 0x00, 0xe1, 0xff, + 0xbb, 0xff, 0xb1, 0xff, 0xc1, 0xff, 0xe2, 0xff, 0x12, 0x00, 0x43, 0x00, + 0x66, 0x00, 0x7c, 0x00, 0x87, 0x00, 0x8c, 0x00, 0x91, 0x00, 0x98, 0x00, + 0x95, 0x00, 0x7f, 0x00, 0x63, 0x00, 0x50, 0x00, 0x46, 0x00, 0x3f, 0x00, + 0x41, 0x00, 0x52, 0x00, 0x6b, 0x00, 0x7e, 0x00, 0x8d, 0x00, 0x95, 0x00, + 0x8e, 0x00, 0x82, 0x00, 0x7f, 0x00, 0x81, 0x00, 0x7f, 0x00, 0x77, 0x00, + 0x63, 0x00, 0x44, 0x00, 0x2b, 0x00, 0x24, 0x00, 0x27, 0x00, 0x1f, 0x00, + 0x09, 0x00, 0xfb, 0xff, 0x03, 0x00, 0x18, 0x00, 0x2d, 0x00, 0x38, 0x00, + 0x37, 0x00, 0x28, 0x00, 0x0b, 0x00, 0xe9, 0xff, 0xd3, 0xff, 0xcf, 0xff, + 0xd4, 0xff, 0xd3, 0xff, 0xc9, 0xff, 0xb7, 0xff, 0xa8, 0xff, 0xa1, 0xff, + 0xa3, 0xff, 0xae, 0xff, 0xc4, 0xff, 0xdf, 0xff, 0xf9, 0xff, 0x0a, 0x00, + 0x0a, 0x00, 0x04, 0x00, 0xfc, 0xff, 0xeb, 0xff, 0xce, 0xff, 0xb3, 0xff, + 0xa0, 0xff, 0x96, 0xff, 0x99, 0xff, 0xb3, 0xff, 0xdb, 0xff, 0xf3, 0xff, + 0xf0, 0xff, 0xe0, 0xff, 0xcf, 0xff, 0xc4, 0xff, 0xcc, 0xff, 0xeb, 0xff, + 0x18, 0x00, 0x3d, 0x00, 0x45, 0x00, 0x36, 0x00, 0x2f, 0x00, 0x3e, 0x00, + 0x58, 0x00, 0x6d, 0x00, 0x7c, 0x00, 0x87, 0x00, 0x93, 0x00, 0xae, 0x00, + 0xd3, 0x00, 0xf7, 0x00, 0x14, 0x01, 0x25, 0x01, 0x22, 0x01, 0x09, 0x01, + 0xe3, 0x00, 0xc2, 0x00, 0xa8, 0x00, 0x91, 0x00, 0x7a, 0x00, 0x65, 0x00, + 0x4e, 0x00, 0x37, 0x00, 0x27, 0x00, 0x25, 0x00, 0x2d, 0x00, 0x34, 0x00, + 0x3c, 0x00, 0x4d, 0x00, 0x6b, 0x00, 0x8f, 0x00, 0xa8, 0x00, 0xb1, 0x00, + 0xb1, 0x00, 0xb1, 0x00, 0xb2, 0x00, 0xbc, 0x00, 0xdc, 0x00, 0x0d, 0x01, + 0x36, 0x01, 0x47, 0x01, 0x46, 0x01, 0x3a, 0x01, 0x24, 0x01, 0x00, 0x01, + 0xce, 0x00, 0x9c, 0x00, 0x79, 0x00, 0x6c, 0x00, 0x6f, 0x00, 0x71, 0x00, + 0x65, 0x00, 0x50, 0x00, 0x41, 0x00, 0x49, 0x00, 0x6a, 0x00, 0x8d, 0x00, + 0x9c, 0x00, 0x9a, 0x00, 0x98, 0x00, 0xa1, 0x00, 0xb3, 0x00, 0xc2, 0x00, + 0xc6, 0x00, 0xbc, 0x00, 0xa8, 0x00, 0x8d, 0x00, 0x74, 0x00, 0x64, 0x00, + 0x59, 0x00, 0x4d, 0x00, 0x44, 0x00, 0x40, 0x00, 0x3d, 0x00, 0x36, 0x00, + 0x32, 0x00, 0x2a, 0x00, 0x11, 0x00, 0xe8, 0xff, 0xc1, 0xff, 0xa4, 0xff, + 0x88, 0xff, 0x6d, 0xff, 0x5a, 0xff, 0x52, 0xff, 0x4c, 0xff, 0x42, 0xff, + 0x3a, 0xff, 0x3f, 0xff, 0x56, 0xff, 0x72, 0xff, 0x8b, 0xff, 0xa3, 0xff, + 0xc4, 0xff, 0xe9, 0xff, 0x05, 0x00, 0x10, 0x00, 0x0d, 0x00, 0x04, 0x00, + 0x00, 0x00, 0xff, 0xff, 0xfc, 0xff, 0xf7, 0xff, 0xee, 0xff, 0xdf, 0xff, + 0xc6, 0xff, 0xae, 0xff, 0xa0, 0xff, 0x97, 0xff, 0x8a, 0xff, 0x80, 0xff, + 0x85, 0xff, 0x93, 0xff, 0x9d, 0xff, 0xa5, 0xff, 0xb1, 0xff, 0xb9, 0xff, + 0xb3, 0xff, 0xa4, 0xff, 0x9a, 0xff, 0x9d, 0xff, 0xa4, 0xff, 0xa8, 0xff, + 0xb0, 0xff, 0xc3, 0xff, 0xe9, 0xff, 0x1d, 0x00, 0x47, 0x00, 0x51, 0x00, + 0x3e, 0x00, 0x1c, 0x00, 0xfb, 0xff, 0xe8, 0xff, 0xeb, 0xff, 0xfc, 0xff, + 0x13, 0x00, 0x2d, 0x00, 0x47, 0x00, 0x5b, 0x00, 0x66, 0x00, 0x69, 0x00, + 0x63, 0x00, 0x5b, 0x00, 0x59, 0x00, 0x5e, 0x00, 0x5f, 0x00, 0x55, 0x00, + 0x48, 0x00, 0x43, 0x00, 0x4a, 0x00, 0x56, 0x00, 0x65, 0x00, 0x7d, 0x00, + 0xa4, 0x00, 0xd0, 0x00, 0xf5, 0x00, 0x08, 0x01, 0x04, 0x01, 0xf0, 0x00, + 0xd4, 0x00, 0xb9, 0x00, 0x9a, 0x00, 0x6f, 0x00, 0x3c, 0x00, 0x0c, 0x00, + 0xe6, 0xff, 0xcd, 0xff, 0xc2, 0xff, 0xc3, 0xff, 0xc5, 0xff, 0xc1, 0xff, + 0xbe, 0xff, 0xc4, 0xff, 0xd1, 0xff, 0xde, 0xff, 0xe1, 0xff, 0xd8, 0xff, + 0xca, 0xff, 0xc5, 0xff, 0xcf, 0xff, 0xe5, 0xff, 0x02, 0x00, 0x25, 0x00, + 0x46, 0x00, 0x59, 0x00, 0x61, 0x00, 0x65, 0x00, 0x5f, 0x00, 0x44, 0x00, + 0x16, 0x00, 0xe4, 0xff, 0xb9, 0xff, 0x92, 0xff, 0x6e, 0xff, 0x52, 0xff, + 0x3d, 0xff, 0x35, 0xff, 0x3e, 0xff, 0x59, 0xff, 0x78, 0xff, 0x8d, 0xff, + 0x98, 0xff, 0x9a, 0xff, 0x8c, 0xff, 0x6c, 0xff, 0x46, 0xff, 0x2a, 0xff, + 0x1d, 0xff, 0x1d, 0xff, 0x29, 0xff, 0x3f, 0xff, 0x55, 0xff, 0x60, 0xff, + 0x5c, 0xff, 0x48, 0xff, 0x2a, 0xff, 0x11, 0xff, 0x09, 0xff, 0x16, 0xff, + 0x2c, 0xff, 0x37, 0xff, 0x30, 0xff, 0x23, 0xff, 0x2a, 0xff, 0x48, 0xff, + 0x68, 0xff, 0x7b, 0xff, 0x80, 0xff, 0x78, 0xff, 0x6a, 0xff, 0x63, 0xff, + 0x68, 0xff, 0x70, 0xff, 0x74, 0xff, 0x76, 0xff, 0x70, 0xff, 0x5a, 0xff, + 0x3c, 0xff, 0x23, 0xff, 0x15, 0xff, 0x16, 0xff, 0x22, 0xff, 0x2a, 0xff, + 0x2d, 0xff, 0x3b, 0xff, 0x5d, 0xff, 0x85, 0xff, 0x9c, 0xff, 0x96, 0xff, + 0x75, 0xff, 0x48, 0xff, 0x26, 0xff, 0x25, 0xff, 0x4a, 0xff, 0x8a, 0xff, + 0xcb, 0xff, 0xf2, 0xff, 0xfa, 0xff, 0xf2, 0xff, 0xe8, 0xff, 0xe2, 0xff, + 0xdb, 0xff, 0xcc, 0xff, 0xb6, 0xff, 0x9f, 0xff, 0x89, 0xff, 0x73, 0xff, + 0x64, 0xff, 0x64, 0xff, 0x71, 0xff, 0x85, 0xff, 0x9b, 0xff, 0xaf, 0xff, + 0xbc, 0xff, 0xc2, 0xff, 0xc2, 0xff, 0xb8, 0xff, 0xa2, 0xff, 0x8c, 0xff, + 0x7e, 0xff, 0x79, 0xff, 0x7e, 0xff, 0x91, 0xff, 0xab, 0xff, 0xc1, 0xff, + 0xd0, 0xff, 0xdf, 0xff, 0xee, 0xff, 0xfa, 0xff, 0xfd, 0xff, 0xfd, 0xff, + 0x02, 0x00, 0x06, 0x00, 0xfe, 0xff, 0xe4, 0xff, 0xc1, 0xff, 0xa2, 0xff, + 0x92, 0xff, 0x8d, 0xff, 0x88, 0xff, 0x81, 0xff, 0x89, 0xff, 0xa8, 0xff, + 0xcf, 0xff, 0xe7, 0xff, 0xe8, 0xff, 0xdc, 0xff, 0xcf, 0xff, 0xc8, 0xff, + 0xc0, 0xff, 0xae, 0xff, 0x95, 0xff, 0x80, 0xff, 0x75, 0xff, 0x7a, 0xff, + 0x98, 0xff, 0xce, 0xff, 0x04, 0x00, 0x25, 0x00, 0x30, 0x00, 0x2a, 0x00, + 0x19, 0x00, 0x07, 0x00, 0xfe, 0xff, 0xfd, 0xff, 0xfa, 0xff, 0xf4, 0xff, + 0xf2, 0xff, 0xfb, 0xff, 0x0b, 0x00, 0x17, 0x00, 0x1e, 0x00, 0x23, 0x00, + 0x29, 0x00, 0x31, 0x00, 0x41, 0x00, 0x55, 0x00, 0x61, 0x00, 0x5c, 0x00, + 0x49, 0x00, 0x35, 0x00, 0x2c, 0x00, 0x33, 0x00, 0x43, 0x00, 0x4f, 0x00, + 0x54, 0x00, 0x55, 0x00, 0x55, 0x00, 0x57, 0x00, 0x5b, 0x00, 0x5b, 0x00, + 0x53, 0x00, 0x46, 0x00, 0x39, 0x00, 0x29, 0x00, 0x18, 0x00, 0x0f, 0x00, + 0x14, 0x00, 0x24, 0x00, 0x39, 0x00, 0x4c, 0x00, 0x5d, 0x00, 0x72, 0x00, + 0x8c, 0x00, 0x9f, 0x00, 0xa0, 0x00, 0x93, 0x00, 0x86, 0x00, 0x82, 0x00, + 0x81, 0x00, 0x80, 0x00, 0x7b, 0x00, 0x6f, 0x00, 0x5b, 0x00, 0x4c, 0x00, + 0x55, 0x00, 0x6f, 0x00, 0x80, 0x00, 0x7d, 0x00, 0x72, 0x00, 0x71, 0x00, + 0x72, 0x00, 0x6e, 0x00, 0x64, 0x00, 0x5e, 0x00, 0x60, 0x00, 0x69, 0x00, + 0x7b, 0x00, 0x9a, 0x00, 0xc6, 0x00, 0xee, 0x00, 0x03, 0x01, 0x08, 0x01, + 0x09, 0x01, 0x07, 0x01, 0x00, 0x01, 0xee, 0x00, 0xd0, 0x00, 0xaf, 0x00, + 0x93, 0x00, 0x81, 0x00, 0x72, 0x00, 0x65, 0x00, 0x5f, 0x00, 0x5d, 0x00, + 0x56, 0x00, 0x4d, 0x00, 0x48, 0x00, 0x49, 0x00, 0x51, 0x00, 0x60, 0x00, + 0x76, 0x00, 0x92, 0x00, 0xb1, 0x00, 0xd0, 0x00, 0xed, 0x00, 0x05, 0x01, + 0x1a, 0x01, 0x2a, 0x01, 0x35, 0x01, 0x3d, 0x01, 0x3d, 0x01, 0x34, 0x01, + 0x21, 0x01, 0x07, 0x01, 0xe8, 0x00, 0xc9, 0x00, 0xac, 0x00, 0x8f, 0x00, + 0x73, 0x00, 0x5c, 0x00, 0x48, 0x00, 0x38, 0x00, 0x30, 0x00, 0x35, 0x00, + 0x3c, 0x00, 0x3f, 0x00, 0x3c, 0x00, 0x2f, 0x00, 0x16, 0x00, 0x01, 0x00, + 0xf9, 0xff, 0xf7, 0xff, 0xee, 0xff, 0xe3, 0xff, 0xe2, 0xff, 0xf4, 0xff, + 0x19, 0x00, 0x43, 0x00, 0x64, 0x00, 0x76, 0x00, 0x87, 0x00, 0x9c, 0x00, + 0xa7, 0x00, 0xa1, 0x00, 0x93, 0x00, 0x87, 0x00, 0x74, 0x00, 0x55, 0x00, + 0x2f, 0x00, 0x0c, 0x00, 0xf1, 0xff, 0xd9, 0xff, 0xbe, 0xff, 0x9b, 0xff, + 0x78, 0xff, 0x5f, 0xff, 0x55, 0xff, 0x54, 0xff, 0x5e, 0xff, 0x70, 0xff, + 0x84, 0xff, 0x9b, 0xff, 0xb9, 0xff, 0xd9, 0xff, 0xf5, 0xff, 0x10, 0x00, + 0x31, 0x00, 0x54, 0x00, 0x75, 0x00, 0x97, 0x00, 0xaf, 0x00, 0xb1, 0x00, + 0x9c, 0x00, 0x7a, 0x00, 0x59, 0x00, 0x3a, 0x00, 0x1f, 0x00, 0x08, 0x00, + 0xf4, 0xff, 0xe4, 0xff, 0xd9, 0xff, 0xd2, 0xff, 0xd6, 0xff, 0xe5, 0xff, + 0xef, 0xff, 0xeb, 0xff, 0xe0, 0xff, 0xda, 0xff, 0xd5, 0xff, 0xce, 0xff, + 0xc8, 0xff, 0xc8, 0xff, 0xd2, 0xff, 0xec, 0xff, 0x16, 0x00, 0x45, 0x00, + 0x6e, 0x00, 0x8d, 0x00, 0x9b, 0x00, 0x95, 0x00, 0x7b, 0x00, 0x55, 0x00, + 0x2c, 0x00, 0x08, 0x00, 0xee, 0xff, 0xdf, 0xff, 0xdb, 0xff, 0xdd, 0xff, + 0xdd, 0xff, 0xdb, 0xff, 0xda, 0xff, 0xe1, 0xff, 0xf0, 0xff, 0xfd, 0xff, + 0x02, 0x00, 0x01, 0x00, 0x06, 0x00, 0x16, 0x00, 0x2c, 0x00, 0x43, 0x00, + 0x5b, 0x00, 0x72, 0x00, 0x82, 0x00, 0x8a, 0x00, 0x89, 0x00, 0x87, 0x00, + 0x88, 0x00, 0x88, 0x00, 0x7d, 0x00, 0x67, 0x00, 0x50, 0x00, 0x38, 0x00, + 0x1e, 0x00, 0x09, 0x00, 0x01, 0x00, 0xff, 0xff, 0xf9, 0xff, 0xed, 0xff, + 0xdd, 0xff, 0xc9, 0xff, 0xb7, 0xff, 0xab, 0xff, 0xa1, 0xff, 0x9a, 0xff, + 0xa2, 0xff, 0xbc, 0xff, 0xdc, 0xff, 0xf9, 0xff, 0x14, 0x00, 0x31, 0x00, + 0x4f, 0x00, 0x63, 0x00, 0x6b, 0x00, 0x68, 0x00, 0x5f, 0x00, 0x55, 0x00, + 0x50, 0x00, 0x49, 0x00, 0x30, 0x00, 0x0b, 0x00, 0xee, 0xff, 0xdd, 0xff, + 0xca, 0xff, 0xaf, 0xff, 0x94, 0xff, 0x7c, 0xff, 0x66, 0xff, 0x5b, 0xff, + 0x60, 0xff, 0x6d, 0xff, 0x77, 0xff, 0x82, 0xff, 0x93, 0xff, 0xa8, 0xff, + 0xc0, 0xff, 0xd8, 0xff, 0xe6, 0xff, 0xed, 0xff, 0xfb, 0xff, 0x1d, 0x00, + 0x47, 0x00, 0x69, 0x00, 0x78, 0x00, 0x78, 0x00, 0x75, 0x00, 0x71, 0x00, + 0x67, 0x00, 0x61, 0x00, 0x68, 0x00, 0x6d, 0x00, 0x5d, 0x00, 0x3e, 0x00, + 0x27, 0x00, 0x17, 0x00, 0x00, 0x00, 0xde, 0xff, 0xbf, 0xff, 0xb1, 0xff, + 0xb7, 0xff, 0xc2, 0xff, 0xc8, 0xff, 0xca, 0xff, 0xd2, 0xff, 0xe1, 0xff, + 0xf4, 0xff, 0x04, 0x00, 0x10, 0x00, 0x19, 0x00, 0x25, 0x00, 0x39, 0x00, + 0x50, 0x00, 0x61, 0x00, 0x6c, 0x00, 0x75, 0x00, 0x78, 0x00, 0x71, 0x00, + 0x61, 0x00, 0x52, 0x00, 0x43, 0x00, 0x2c, 0x00, 0x10, 0x00, 0xfa, 0xff, + 0xef, 0xff, 0xe7, 0xff, 0xe4, 0xff, 0xef, 0xff, 0x03, 0x00, 0x11, 0x00, + 0x14, 0x00, 0x0f, 0x00, 0x09, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, + 0x20, 0x00, 0x3a, 0x00, 0x56, 0x00, 0x73, 0x00, 0x8c, 0x00, 0x93, 0x00, + 0x83, 0x00, 0x65, 0x00, 0x4b, 0x00, 0x3e, 0x00, 0x35, 0x00, 0x26, 0x00, + 0x12, 0x00, 0x00, 0x00, 0xf4, 0xff, 0xec, 0xff, 0xe8, 0xff, 0xe3, 0xff, + 0xd5, 0xff, 0xb7, 0xff, 0x92, 0xff, 0x72, 0xff, 0x5d, 0xff, 0x4d, 0xff, + 0x40, 0xff, 0x37, 0xff, 0x32, 0xff, 0x33, 0xff, 0x40, 0xff, 0x5f, 0xff, + 0x8d, 0xff, 0xc3, 0xff, 0xf8, 0xff, 0x1b, 0x00, 0x28, 0x00, 0x2d, 0x00, + 0x34, 0x00, 0x39, 0x00, 0x35, 0x00, 0x2d, 0x00, 0x22, 0x00, 0x15, 0x00, + 0x0a, 0x00, 0x02, 0x00, 0x01, 0x00, 0x07, 0x00, 0x11, 0x00, 0x13, 0x00, + 0x06, 0x00, 0xec, 0xff, 0xcb, 0xff, 0xa4, 0xff, 0x7e, 0xff, 0x61, 0xff, + 0x50, 0xff, 0x4a, 0xff, 0x51, 0xff, 0x67, 0xff, 0x86, 0xff, 0x9f, 0xff, + 0xa9, 0xff, 0xa6, 0xff, 0xa6, 0xff, 0xac, 0xff, 0xb0, 0xff, 0xaf, 0xff, + 0xb6, 0xff, 0xc5, 0xff, 0xcc, 0xff, 0xc4, 0xff, 0xbe, 0xff, 0xc4, 0xff, + 0xcc, 0xff, 0xcf, 0xff, 0xca, 0xff, 0xbd, 0xff, 0xa9, 0xff, 0x96, 0xff, + 0x89, 0xff, 0x7d, 0xff, 0x6a, 0xff, 0x4e, 0xff, 0x31, 0xff, 0x1f, 0xff, + 0x1e, 0xff, 0x30, 0xff, 0x47, 0xff, 0x59, 0xff, 0x68, 0xff, 0x82, 0xff, + 0xab, 0xff, 0xd2, 0xff, 0xeb, 0xff, 0xfa, 0xff, 0x07, 0x00, 0x11, 0x00, + 0x17, 0x00, 0x1a, 0x00, 0x1a, 0x00, 0x15, 0x00, 0x0d, 0x00, 0xff, 0xff, + 0xe8, 0xff, 0xce, 0xff, 0xbb, 0xff, 0xb1, 0xff, 0xab, 0xff, 0xa3, 0xff, + 0x97, 0xff, 0x8b, 0xff, 0x81, 0xff, 0x7a, 0xff, 0x72, 0xff, 0x68, 0xff, + 0x63, 0xff, 0x68, 0xff, 0x77, 0xff, 0x86, 0xff, 0x94, 0xff, 0xa2, 0xff, + 0xb2, 0xff, 0xc4, 0xff, 0xd6, 0xff, 0xe5, 0xff, 0xef, 0xff, 0xf5, 0xff, + 0xf7, 0xff, 0xf6, 0xff, 0xf5, 0xff, 0xf4, 0xff, 0xed, 0xff, 0xde, 0xff, + 0xcd, 0xff, 0xc2, 0xff, 0xba, 0xff, 0xb0, 0xff, 0xa4, 0xff, 0x97, 0xff, + 0x86, 0xff, 0x70, 0xff, 0x5f, 0xff, 0x5d, 0xff, 0x69, 0xff, 0x78, 0xff, + 0x82, 0xff, 0x84, 0xff, 0x84, 0xff, 0x83, 0xff, 0x81, 0xff, 0x7b, 0xff, + 0x74, 0xff, 0x74, 0xff, 0x7d, 0xff, 0x87, 0xff, 0x8d, 0xff, 0x92, 0xff, + 0x93, 0xff, 0x8c, 0xff, 0x84, 0xff, 0x84, 0xff, 0x8c, 0xff, 0x91, 0xff, + 0x92, 0xff, 0x92, 0xff, 0x8f, 0xff, 0x8a, 0xff, 0x85, 0xff, 0x84, 0xff, + 0x7d, 0xff, 0x6e, 0xff, 0x5e, 0xff, 0x56, 0xff, 0x55, 0xff, 0x58, 0xff, + 0x5c, 0xff, 0x65, 0xff, 0x70, 0xff, 0x7b, 0xff, 0x86, 0xff, 0x93, 0xff, + 0xa5, 0xff, 0xb8, 0xff, 0xc4, 0xff, 0xc4, 0xff, 0xc5, 0xff, 0xd0, 0xff, + 0xde, 0xff, 0xe4, 0xff, 0xec, 0xff, 0xfb, 0xff, 0x00, 0x00, 0xee, 0xff, + 0xdd, 0xff, 0xe0, 0xff, 0xe4, 0xff, 0xd1, 0xff, 0xbb, 0xff, 0xbb, 0xff, + 0xc6, 0xff, 0xc5, 0xff, 0xc0, 0xff, 0xc6, 0xff, 0xcd, 0xff, 0xc5, 0xff, + 0xb6, 0xff, 0xb1, 0xff, 0xb9, 0xff, 0xcc, 0xff, 0xe6, 0xff, 0xff, 0xff, + 0x11, 0x00, 0x1e, 0x00, 0x2c, 0x00, 0x39, 0x00, 0x3e, 0x00, 0x39, 0x00, + 0x2f, 0x00, 0x25, 0x00, 0x17, 0x00, 0x02, 0x00, 0xed, 0xff, 0xe2, 0xff, + 0xe6, 0xff, 0xf1, 0xff, 0xfd, 0xff, 0x07, 0x00, 0x0c, 0x00, 0x0e, 0x00, + 0x11, 0x00, 0x17, 0x00, 0x1b, 0x00, 0x13, 0x00, 0x07, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x11, 0x00, 0x25, 0x00, 0x39, 0x00, 0x49, 0x00, 0x54, 0x00, + 0x57, 0x00, 0x54, 0x00, 0x4e, 0x00, 0x48, 0x00, 0x3f, 0x00, 0x2f, 0x00, + 0x1a, 0x00, 0x05, 0x00, 0xf2, 0xff, 0xdf, 0xff, 0xcd, 0xff, 0xbd, 0xff, + 0xb0, 0xff, 0xaa, 0xff, 0xad, 0xff, 0xba, 0xff, 0xca, 0xff, 0xda, 0xff, + 0xe4, 0xff, 0xe4, 0xff, 0xd9, 0xff, 0xcc, 0xff, 0xca, 0xff, 0xd7, 0xff, + 0xed, 0xff, 0x01, 0x00, 0x0c, 0x00, 0x10, 0x00, 0x19, 0x00, 0x2b, 0x00, + 0x3e, 0x00, 0x46, 0x00, 0x42, 0x00, 0x39, 0x00, 0x31, 0x00, 0x26, 0x00, + 0x16, 0x00, 0x05, 0x00, 0xfc, 0xff, 0xfd, 0xff, 0x02, 0x00, 0xfe, 0xff, + 0xf1, 0xff, 0xe4, 0xff, 0xde, 0xff, 0xde, 0xff, 0xe3, 0xff, 0xeb, 0xff, + 0xf6, 0xff, 0x05, 0x00, 0x19, 0x00, 0x2d, 0x00, 0x39, 0x00, 0x3e, 0x00, + 0x45, 0x00, 0x54, 0x00, 0x66, 0x00, 0x74, 0x00, 0x80, 0x00, 0x87, 0x00, + 0x85, 0x00, 0x7a, 0x00, 0x72, 0x00, 0x73, 0x00, 0x75, 0x00, 0x70, 0x00, + 0x66, 0x00, 0x59, 0x00, 0x4a, 0x00, 0x3d, 0x00, 0x33, 0x00, 0x2c, 0x00, + 0x28, 0x00, 0x24, 0x00, 0x1c, 0x00, 0x0d, 0x00, 0xfd, 0xff, 0xf5, 0xff, + 0xf9, 0xff, 0x09, 0x00, 0x24, 0x00, 0x45, 0x00, 0x65, 0x00, 0x7b, 0x00, + 0x86, 0x00, 0x8a, 0x00, 0x91, 0x00, 0x99, 0x00, 0x98, 0x00, 0x8a, 0x00, + 0x7a, 0x00, 0x75, 0x00, 0x7b, 0x00, 0x80, 0x00, 0x78, 0x00, 0x66, 0x00, + 0x53, 0x00, 0x41, 0x00, 0x2d, 0x00, 0x16, 0x00, 0x02, 0x00, 0xf8, 0xff, + 0xf4, 0xff, 0xee, 0xff, 0xe5, 0xff, 0xdf, 0xff, 0xe3, 0xff, 0xee, 0xff, + 0xfc, 0xff, 0x0a, 0x00, 0x18, 0x00, 0x27, 0x00, 0x39, 0x00, 0x4d, 0x00, + 0x5d, 0x00, 0x68, 0x00, 0x70, 0x00, 0x79, 0x00, 0x7f, 0x00, 0x7f, 0x00, + 0x7f, 0x00, 0x7e, 0x00, 0x79, 0x00, 0x71, 0x00, 0x6d, 0x00, 0x69, 0x00, + 0x5c, 0x00, 0x48, 0x00, 0x36, 0x00, 0x27, 0x00, 0x1b, 0x00, 0x13, 0x00, + 0x0d, 0x00, 0x05, 0x00, 0xfa, 0xff, 0xee, 0xff, 0xe6, 0xff, 0xe3, 0xff, + 0xeb, 0xff, 0x00, 0x00, 0x1e, 0x00, 0x39, 0x00, 0x49, 0x00, 0x4c, 0x00, + 0x4d, 0x00, 0x50, 0x00, 0x57, 0x00, 0x5e, 0x00, 0x62, 0x00, 0x5f, 0x00, + 0x5a, 0x00, 0x56, 0x00, 0x53, 0x00, 0x4f, 0x00, 0x49, 0x00, 0x44, 0x00, + 0x3d, 0x00, 0x32, 0x00, 0x25, 0x00, 0x1a, 0x00, 0x12, 0x00, 0x08, 0x00, + 0xfb, 0xff, 0xf2, 0xff, 0xee, 0xff, 0xee, 0xff, 0xec, 0xff, 0xed, 0xff, + 0xf9, 0xff, 0x0f, 0x00, 0x26, 0x00, 0x39, 0x00, 0x4a, 0x00, 0x5c, 0x00, + 0x6f, 0x00, 0x80, 0x00, 0x86, 0x00, 0x81, 0x00, 0x78, 0x00, 0x76, 0x00, + 0x7b, 0x00, 0x81, 0x00, 0x80, 0x00, 0x74, 0x00, 0x61, 0x00, 0x54, 0x00, + 0x53, 0x00, 0x55, 0x00, 0x4d, 0x00, 0x3d, 0x00, 0x29, 0x00, 0x15, 0x00, + 0xff, 0xff, 0xeb, 0xff, 0xe0, 0xff, 0xe3, 0xff, 0xef, 0xff, 0xf9, 0xff, + 0xfa, 0xff, 0xf9, 0xff, 0x00, 0x00, 0x10, 0x00, 0x22, 0x00, 0x2f, 0x00, + 0x39, 0x00, 0x41, 0x00, 0x48, 0x00, 0x4b, 0x00, 0x4e, 0x00, 0x55, 0x00, + 0x5c, 0x00, 0x5e, 0x00, 0x5b, 0x00, 0x58, 0x00, 0x52, 0x00, 0x46, 0x00, + 0x34, 0x00, 0x24, 0x00, 0x19, 0x00, 0x0c, 0x00, 0xfd, 0xff, 0xee, 0xff, + 0xe7, 0xff, 0xe8, 0xff, 0xed, 0xff, 0xee, 0xff, 0xea, 0xff, 0xec, 0xff, + 0xf8, 0xff, 0x07, 0x00, 0x11, 0x00, 0x17, 0x00, 0x18, 0x00, 0x16, 0x00, + 0x15, 0x00, 0x1a, 0x00, 0x21, 0x00, 0x26, 0x00, 0x2b, 0x00, 0x32, 0x00, + 0x39, 0x00, 0x3d, 0x00, 0x41, 0x00, 0x46, 0x00, 0x45, 0x00, 0x3c, 0x00, + 0x2b, 0x00, 0x18, 0x00, 0x05, 0x00, 0xf0, 0xff, 0xde, 0xff, 0xd4, 0xff, + 0xd5, 0xff, 0xda, 0xff, 0xdc, 0xff, 0xdd, 0xff, 0xe1, 0xff, 0xe8, 0xff, + 0xf2, 0xff, 0x02, 0x00, 0x15, 0x00, 0x26, 0x00, 0x2e, 0x00, 0x2f, 0x00, + 0x2a, 0x00, 0x24, 0x00, 0x21, 0x00, 0x22, 0x00, 0x26, 0x00, 0x2d, 0x00, + 0x34, 0x00, 0x38, 0x00, 0x3a, 0x00, 0x3a, 0x00, 0x37, 0x00, 0x32, 0x00, + 0x2c, 0x00, 0x27, 0x00, 0x23, 0x00, 0x21, 0x00, 0x1f, 0x00, 0x1c, 0x00, + 0x15, 0x00, 0x09, 0x00, 0xfb, 0xff, 0xec, 0xff, 0xe2, 0xff, 0xdf, 0xff, + 0xe0, 0xff, 0xe2, 0xff, 0xe6, 0xff, 0xe8, 0xff, 0xe7, 0xff, 0xe2, 0xff, + 0xde, 0xff, 0xde, 0xff, 0xdf, 0xff, 0xdc, 0xff, 0xd8, 0xff, 0xd7, 0xff, + 0xdc, 0xff, 0xe7, 0xff, 0xf2, 0xff, 0xf9, 0xff, 0xfb, 0xff, 0xfb, 0xff, + 0xfe, 0xff, 0xfe, 0xff, 0xf8, 0xff, 0xf0, 0xff, 0xeb, 0xff, 0xea, 0xff, + 0xea, 0xff, 0xeb, 0xff, 0xeb, 0xff, 0xe8, 0xff, 0xe0, 0xff, 0xd9, 0xff, + 0xd7, 0xff, 0xdb, 0xff, 0xe4, 0xff, 0xef, 0xff, 0xf8, 0xff, 0xf8, 0xff, + 0xf1, 0xff, 0xeb, 0xff, 0xeb, 0xff, 0xef, 0xff, 0xf4, 0xff, 0xf8, 0xff, + 0xf7, 0xff, 0xee, 0xff, 0xe4, 0xff, 0xe0, 0xff, 0xe4, 0xff, 0xe9, 0xff, + 0xea, 0xff, 0xec, 0xff, 0xf2, 0xff, 0xf9, 0xff, 0xf8, 0xff, 0xef, 0xff, + 0xe4, 0xff, 0xdb, 0xff, 0xd4, 0xff, 0xcf, 0xff, 0xcc, 0xff, 0xc9, 0xff, + 0xc4, 0xff, 0xc0, 0xff, 0xc3, 0xff, 0xcb, 0xff, 0xd5, 0xff, 0xe2, 0xff, + 0xf0, 0xff, 0x00, 0x00, 0x0f, 0x00, 0x17, 0x00, 0x17, 0x00, 0x13, 0x00, + 0x0c, 0x00, 0x01, 0x00, 0xf2, 0xff, 0xe7, 0xff, 0xde, 0xff, 0xd3, 0xff, + 0xc6, 0xff, 0xbd, 0xff, 0xb8, 0xff, 0xb6, 0xff, 0xb6, 0xff, 0xb8, 0xff, + 0xb8, 0xff, 0xb6, 0xff, 0xb4, 0xff, 0xb3, 0xff, 0xb2, 0xff, 0xb1, 0xff, + 0xb4, 0xff, 0xbb, 0xff, 0xc3, 0xff, 0xcd, 0xff, 0xdc, 0xff, 0xea, 0xff, + 0xf1, 0xff, 0xf6, 0xff, 0x01, 0x00, 0x0e, 0x00, 0x0e, 0x00, 0xfb, 0xff, + 0xdc, 0xff, 0xbe, 0xff, 0xae, 0xff, 0xaa, 0xff, 0xaa, 0xff, 0xa9, 0xff, + 0xab, 0xff, 0xae, 0xff, 0xad, 0xff, 0xab, 0xff, 0xac, 0xff, 0xaf, 0xff, + 0xb1, 0xff, 0xb3, 0xff, 0xb6, 0xff, 0xb8, 0xff, 0xb8, 0xff, 0xbb, 0xff, + 0xc6, 0xff, 0xd4, 0xff, 0xe1, 0xff, 0xec, 0xff, 0xf8, 0xff, 0x03, 0x00, + 0x08, 0x00, 0x08, 0x00, 0x02, 0x00, 0xf8, 0xff, 0xed, 0xff, 0xe4, 0xff, + 0xdd, 0xff, 0xd6, 0xff, 0xce, 0xff, 0xca, 0xff, 0xcb, 0xff, 0xc9, 0xff, + 0xbe, 0xff, 0xb1, 0xff, 0xaa, 0xff, 0xa9, 0xff, 0xa8, 0xff, 0xaa, 0xff, + 0xb0, 0xff, 0xb6, 0xff, 0xbb, 0xff, 0xc2, 0xff, 0xcd, 0xff, 0xdc, 0xff, + 0xec, 0xff, 0xfc, 0xff, 0x05, 0x00, 0x07, 0x00, 0x03, 0x00, 0x00, 0x00, + 0xff, 0xff, 0xfe, 0xff, 0xfd, 0xff, 0x02, 0x00, 0x07, 0x00, 0x06, 0x00, + 0xfb, 0xff, 0xea, 0xff, 0xd8, 0xff, 0xca, 0xff, 0xc5, 0xff, 0xc3, 0xff, + 0xc1, 0xff, 0xbf, 0xff, 0xbd, 0xff, 0xbc, 0xff, 0xbe, 0xff, 0xc3, 0xff, + 0xce, 0xff, 0xd8, 0xff, 0xe1, 0xff, 0xe7, 0xff, 0xea, 0xff, 0xee, 0xff, + 0xf5, 0xff, 0xfe, 0xff, 0x02, 0x00, 0x03, 0x00, 0x05, 0x00, 0x09, 0x00, + 0x0c, 0x00, 0x0a, 0x00, 0x06, 0x00, 0x05, 0x00, 0x04, 0x00, 0x01, 0x00, + 0xfe, 0xff, 0xff, 0xff, 0x03, 0x00, 0x04, 0x00, 0x01, 0x00, 0xff, 0xff, + 0xfd, 0xff, 0xfc, 0xff, 0xfc, 0xff, 0xfe, 0xff, 0xff, 0xff, 0xfd, 0xff, + 0xf4, 0xff, 0xe8, 0xff, 0xe0, 0xff, 0xde, 0xff, 0xdf, 0xff, 0xe2, 0xff, + 0xe4, 0xff, 0xe3, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe6, 0xff, 0xf2, 0xff, + 0xfe, 0xff, 0x07, 0x00, 0x0e, 0x00, 0x12, 0x00, 0x16, 0x00, 0x1a, 0x00, + 0x1c, 0x00, 0x16, 0x00, 0x0a, 0x00, 0xfb, 0xff, 0xf2, 0xff, 0xf4, 0xff, + 0xfa, 0xff, 0xfb, 0xff, 0xf5, 0xff, 0xef, 0xff, 0xeb, 0xff, 0xe8, 0xff, + 0xe6, 0xff, 0xe4, 0xff, 0xe4, 0xff, 0xe3, 0xff, 0xe3, 0xff, 0xe7, 0xff, + 0xeb, 0xff, 0xeb, 0xff, 0xe7, 0xff, 0xeb, 0xff, 0xf7, 0xff, 0x04, 0x00, + 0x0b, 0x00, 0x0e, 0x00, 0x0d, 0x00, 0x08, 0x00, 0x03, 0x00, 0x03, 0x00, + 0x04, 0x00, 0x03, 0x00, 0x02, 0x00, 0x05, 0x00, 0x0a, 0x00, 0x0c, 0x00, + 0x10, 0x00, 0x18, 0x00, 0x20, 0x00, 0x25, 0x00, 0x27, 0x00, 0x28, 0x00, + 0x26, 0x00, 0x21, 0x00, 0x1c, 0x00, 0x19, 0x00, 0x16, 0x00, 0x0d, 0x00, + 0x02, 0x00, 0xf9, 0xff, 0xf6, 0xff, 0xf9, 0xff, 0xff, 0xff, 0x06, 0x00, + 0x09, 0x00, 0x0a, 0x00, 0x0f, 0x00, 0x16, 0x00, 0x18, 0x00, 0x10, 0x00, + 0x06, 0x00, 0x02, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x15, 0x00, 0x1d, 0x00, + 0x1f, 0x00, 0x1d, 0x00, 0x1e, 0x00, 0x22, 0x00, 0x27, 0x00, 0x2b, 0x00, + 0x2e, 0x00, 0x2d, 0x00, 0x26, 0x00, 0x1a, 0x00, 0x0d, 0x00, 0x03, 0x00, + 0xfe, 0xff, 0xfc, 0xff, 0xfa, 0xff, 0xf9, 0xff, 0xf9, 0xff, 0xfa, 0xff, + 0xfa, 0xff, 0xfa, 0xff, 0xfa, 0xff, 0xf8, 0xff, 0xf2, 0xff, 0xee, 0xff, + 0xf1, 0xff, 0xfc, 0xff, 0x03, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, + 0x0b, 0x00, 0x18, 0x00, 0x29, 0x00, 0x39, 0x00, 0x40, 0x00, 0x3c, 0x00, + 0x34, 0x00, 0x2e, 0x00, 0x2a, 0x00, 0x26, 0x00, 0x23, 0x00, 0x1f, 0x00, + 0x18, 0x00, 0x0d, 0x00, 0xfe, 0xff, 0xf3, 0xff, 0xf2, 0xff, 0xf7, 0xff, + 0xfc, 0xff, 0xfd, 0xff, 0xfd, 0xff, 0xfd, 0xff, 0x00, 0x00, 0x06, 0x00, + 0x0d, 0x00, 0x0f, 0x00, 0x0f, 0x00, 0x16, 0x00, 0x23, 0x00, 0x31, 0x00, + 0x37, 0x00, 0x35, 0x00, 0x2f, 0x00, 0x2b, 0x00, 0x2f, 0x00, 0x35, 0x00, + 0x37, 0x00, 0x34, 0x00, 0x2d, 0x00, 0x22, 0x00, 0x13, 0x00, 0x07, 0x00, + 0x03, 0x00, 0x06, 0x00, 0x0a, 0x00, 0x07, 0x00, 0x03, 0x00, 0x02, 0x00, + 0x06, 0x00, 0x0b, 0x00, 0x11, 0x00, 0x15, 0x00, 0x16, 0x00, 0x16, 0x00, + 0x18, 0x00, 0x1e, 0x00, 0x25, 0x00, 0x2c, 0x00, 0x31, 0x00, 0x35, 0x00, + 0x38, 0x00, 0x3d, 0x00, 0x43, 0x00, 0x48, 0x00, 0x4b, 0x00, 0x4c, 0x00, + 0x4d, 0x00, 0x4e, 0x00, 0x4c, 0x00, 0x45, 0x00, 0x3c, 0x00, 0x32, 0x00, + 0x27, 0x00, 0x1d, 0x00, 0x17, 0x00, 0x16, 0x00, 0x17, 0x00, 0x15, 0x00, + 0x12, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x15, 0x00, 0x1e, 0x00, + 0x2b, 0x00, 0x39, 0x00, 0x44, 0x00, 0x4b, 0x00, 0x4b, 0x00, 0x47, 0x00, + 0x3d, 0x00, 0x31, 0x00, 0x26, 0x00, 0x20, 0x00, 0x1e, 0x00, 0x1d, 0x00, + 0x18, 0x00, 0x0f, 0x00, 0x04, 0x00, 0xfc, 0xff, 0xf6, 0xff, 0xf2, 0xff, + 0xf1, 0xff, 0xf5, 0xff, 0xfd, 0xff, 0x06, 0x00, 0x0a, 0x00, 0x06, 0x00, + 0xfe, 0xff, 0xf8, 0xff, 0xf7, 0xff, 0xfc, 0xff, 0x01, 0x00, 0x03, 0x00, + 0x01, 0x00, 0xfd, 0xff, 0xfa, 0xff, 0xfc, 0xff, 0x02, 0x00, 0x08, 0x00, + 0x0a, 0x00, 0x0b, 0x00, 0x0b, 0x00, 0x06, 0x00, 0xfa, 0xff, 0xed, 0xff, + 0xe6, 0xff, 0xe5, 0xff, 0xe5, 0xff, 0xe3, 0xff, 0xdd, 0xff, 0xd6, 0xff, + 0xd2, 0xff, 0xd5, 0xff, 0xdc, 0xff, 0xe1, 0xff, 0xe5, 0xff, 0xe8, 0xff, + 0xeb, 0xff, 0xeb, 0xff, 0xe7, 0xff, 0xe4, 0xff, 0xe5, 0xff, 0xe7, 0xff, + 0xe8, 0xff, 0xea, 0xff, 0xec, 0xff, 0xec, 0xff, 0xea, 0xff, 0xe9, 0xff, + 0xe8, 0xff, 0xe8, 0xff, 0xe9, 0xff, 0xeb, 0xff, 0xe9, 0xff, 0xe6, 0xff, + 0xe5, 0xff, 0xe8, 0xff, 0xeb, 0xff, 0xec, 0xff, 0xea, 0xff, 0xe7, 0xff, + 0xe6, 0xff, 0xec, 0xff, 0xf4, 0xff, 0xf7, 0xff, 0xf5, 0xff, 0xf0, 0xff, + 0xea, 0xff, 0xe5, 0xff, 0xe3, 0xff, 0xe4, 0xff, 0xe5, 0xff, 0xe5, 0xff, + 0xe6, 0xff, 0xe9, 0xff, 0xec, 0xff, 0xec, 0xff, 0xe9, 0xff, 0xe6, 0xff, + 0xe7, 0xff, 0xec, 0xff, 0xf1, 0xff, 0xf2, 0xff, 0xee, 0xff, 0xe6, 0xff, + 0xde, 0xff, 0xd8, 0xff, 0xd5, 0xff, 0xd5, 0xff, 0xd7, 0xff, 0xd7, 0xff, + 0xd1, 0xff, 0xc7, 0xff, 0xc0, 0xff, 0xbe, 0xff, 0xbf, 0xff, 0xbe, 0xff, + 0xbe, 0xff, 0xbd, 0xff, 0xbc, 0xff, 0xb9, 0xff, 0xb4, 0xff, 0xb2, 0xff, + 0xb5, 0xff, 0xc0, 0xff, 0xcf, 0xff, 0xde, 0xff, 0xe8, 0xff, 0xeb, 0xff, + 0xe7, 0xff, 0xe5, 0xff, 0xe9, 0xff, 0xf0, 0xff, 0xf5, 0xff, 0xf7, 0xff, + 0xf5, 0xff, 0xee, 0xff, 0xe5, 0xff, 0xdf, 0xff, 0xdc, 0xff, 0xda, 0xff, + 0xd9, 0xff, 0xd8, 0xff, 0xd5, 0xff, 0xcf, 0xff, 0xc9, 0xff, 0xc7, 0xff, + 0xc9, 0xff, 0xcd, 0xff, 0xd4, 0xff, 0xdb, 0xff, 0xe2, 0xff, 0xe7, 0xff, + 0xec, 0xff, 0xf4, 0xff, 0xfe, 0xff, 0x08, 0x00, 0x10, 0x00, 0x16, 0x00, + 0x19, 0x00, 0x1a, 0x00, 0x19, 0x00, 0x14, 0x00, 0x0a, 0x00, 0x02, 0x00, + 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xfc, 0xff, 0xf9, 0xff, 0xf6, 0xff, + 0xf3, 0xff, 0xf4, 0xff, 0xf9, 0xff, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, + 0xfc, 0xff, 0xfc, 0xff, 0x00, 0x00, 0x07, 0x00, 0x10, 0x00, 0x18, 0x00, + 0x1d, 0x00, 0x22, 0x00, 0x24, 0x00, 0x26, 0x00, 0x29, 0x00, 0x2d, 0x00, + 0x30, 0x00, 0x2f, 0x00, 0x2d, 0x00, 0x2d, 0x00, 0x2a, 0x00, 0x24, 0x00, + 0x1f, 0x00, 0x1b, 0x00, 0x16, 0x00, 0x0e, 0x00, 0x06, 0x00, 0xff, 0xff, + 0xfa, 0xff, 0xf6, 0xff, 0xf2, 0xff, 0xef, 0xff, 0xec, 0xff, 0xeb, 0xff, + 0xea, 0xff, 0xed, 0xff, 0xf7, 0xff, 0x06, 0x00, 0x15, 0x00, 0x1e, 0x00, + 0x26, 0x00, 0x2f, 0x00, 0x34, 0x00, 0x33, 0x00, 0x30, 0x00, 0x2d, 0x00, + 0x29, 0x00, 0x23, 0x00, 0x1d, 0x00, 0x15, 0x00, 0x0c, 0x00, 0x05, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xf8, 0xff, 0xf4, 0xff, 0xf0, 0xff, 0xec, 0xff, + 0xee, 0xff, 0xf5, 0xff, 0xfd, 0xff, 0x00, 0x00, 0x02, 0x00, 0x06, 0x00, + 0x0c, 0x00, 0x14, 0x00, 0x1d, 0x00, 0x25, 0x00, 0x2b, 0x00, 0x31, 0x00, + 0x3a, 0x00, 0x43, 0x00, 0x48, 0x00, 0x4a, 0x00, 0x47, 0x00, 0x40, 0x00, + 0x39, 0x00, 0x36, 0x00, 0x34, 0x00, 0x2e, 0x00, 0x22, 0x00, 0x15, 0x00, + 0x07, 0x00, 0xfc, 0xff, 0xf5, 0xff, 0xf4, 0xff, 0xf7, 0xff, 0xfc, 0xff, + 0xfe, 0xff, 0xfe, 0xff, 0xfd, 0xff, 0xfc, 0xff, 0xfc, 0xff, 0x00, 0x00, + 0x0c, 0x00, 0x18, 0x00, 0x20, 0x00, 0x24, 0x00, 0x25, 0x00, 0x23, 0x00, + 0x21, 0x00, 0x23, 0x00, 0x28, 0x00, 0x2b, 0x00, 0x2a, 0x00, 0x24, 0x00, + 0x1e, 0x00, 0x17, 0x00, 0x10, 0x00, 0x0a, 0x00, 0x08, 0x00, 0x09, 0x00, + 0x09, 0x00, 0x06, 0x00, 0x02, 0x00, 0xfd, 0xff, 0xf8, 0xff, 0xf7, 0xff, + 0x00, 0x00, 0x0a, 0x00, 0x0d, 0x00, 0x0f, 0x00, 0x13, 0x00, 0x10, 0x00, + 0xff, 0xff, 0xf0, 0xff, 0xf2, 0xff, 0xfe, 0xff, 0x09, 0x00, 0x15, 0x00, + 0x1f, 0x00, 0x1f, 0x00, 0x17, 0x00, 0x13, 0x00, 0x13, 0x00, 0x10, 0x00, + 0x0c, 0x00, 0x0c, 0x00, 0x0a, 0x00, 0x04, 0x00, 0xff, 0xff, 0xfb, 0xff, + 0xf6, 0xff, 0xf0, 0xff, 0xef, 0xff, 0xf5, 0xff, 0xfd, 0xff, 0x02, 0x00, + 0x03, 0x00, 0x00, 0x00, 0xfb, 0xff, 0xf6, 0xff, 0xf6, 0xff, 0xfc, 0xff, + 0x03, 0x00, 0x0a, 0x00, 0x0e, 0x00, 0x11, 0x00, 0x11, 0x00, 0x0e, 0x00, + 0x0b, 0x00, 0x0c, 0x00, 0x11, 0x00, 0x14, 0x00, 0x11, 0x00, 0x0b, 0x00, + 0x07, 0x00, 0x06, 0x00, 0x06, 0x00, 0x05, 0x00, 0x04, 0x00, 0x03, 0x00, + 0x04, 0x00, 0x08, 0x00, 0x0f, 0x00, 0x17, 0x00, 0x1b, 0x00, 0x19, 0x00, + 0x14, 0x00, 0x0f, 0x00, 0x0a, 0x00, 0x07, 0x00, 0x06, 0x00, 0x06, 0x00, + 0x04, 0x00, 0x02, 0x00, 0x05, 0x00, 0x0c, 0x00, 0x0f, 0x00, 0x10, 0x00, + 0x0f, 0x00, 0x0d, 0x00, 0x07, 0x00, 0x01, 0x00, 0xff, 0xff, 0xfc, 0xff, + 0xf7, 0xff, 0xf5, 0xff, 0xf6, 0xff, 0xf7, 0xff, 0xfa, 0xff, 0xfd, 0xff, + 0xfe, 0xff, 0xfe, 0xff, 0xff, 0xff, 0x02, 0x00, 0x04, 0x00, 0x05, 0x00, + 0x06, 0x00, 0x07, 0x00, 0x08, 0x00, 0x08, 0x00, 0x09, 0x00, 0x09, 0x00, + 0x06, 0x00, 0x04, 0x00, 0x04, 0x00, 0x06, 0x00, 0x09, 0x00, 0x0b, 0x00, + 0x0b, 0x00, 0x09, 0x00, 0x07, 0x00, 0x07, 0x00, 0x08, 0x00, 0x08, 0x00, + 0x06, 0x00, 0x02, 0x00, 0xfc, 0xff, 0xf4, 0xff, 0xee, 0xff, 0xea, 0xff, + 0xe9, 0xff, 0xeb, 0xff, 0xf1, 0xff, 0xfc, 0xff, 0x07, 0x00, 0x0e, 0x00, + 0x0f, 0x00, 0x0a, 0x00, 0x02, 0x00, 0xfc, 0xff, 0xf8, 0xff, 0xf3, 0xff, + 0xf1, 0xff, 0xf4, 0xff, 0xfa, 0xff, 0x01, 0x00, 0x07, 0x00, 0x0c, 0x00, + 0x0e, 0x00, 0x0b, 0x00, 0x08, 0x00, 0x07, 0x00, 0x07, 0x00, 0x07, 0x00, + 0x05, 0x00, 0x03, 0x00, 0x02, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x06, 0x00, 0x07, 0x00, 0x07, 0x00, + 0x07, 0x00, 0x07, 0x00, 0x06, 0x00, 0x05, 0x00, 0x03, 0x00, 0xff, 0xff, + 0xfb, 0xff, 0xf9, 0xff, 0xf9, 0xff, 0xf8, 0xff, 0xf7, 0xff, 0xf9, 0xff, + 0xfa, 0xff, 0xfa, 0xff, 0xf9, 0xff, 0xf7, 0xff, 0xf4, 0xff, 0xf4, 0xff, + 0xf7, 0xff, 0xfc, 0xff, 0x01, 0x00, 0x03, 0x00, 0x03, 0x00, 0x03, 0x00, + 0x03, 0x00, 0x01, 0x00, 0xfd, 0xff, 0xf9, 0xff, 0xf7, 0xff, 0xf7, 0xff, + 0xf8, 0xff, 0xfb, 0xff, 0x00, 0x00, 0x07, 0x00, 0x0c, 0x00, 0x0f, 0x00, + 0x11, 0x00, 0x10, 0x00, 0x0c, 0x00, 0x07, 0x00, 0x04, 0x00, 0x02, 0x00, + 0xfe, 0xff, 0xfb, 0xff, 0xfb, 0xff, 0xfc, 0xff, 0xfc, 0xff, 0xfd, 0xff, + 0x00, 0x00, 0x01, 0x00, 0xff, 0xff, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, + 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff, + 0x04, 0x00, 0x09, 0x00, 0x0c, 0x00, 0x0e, 0x00, 0x0d, 0x00, 0x0a, 0x00, + 0x05, 0x00, 0x04, 0x00, 0x07, 0x00, 0x0a, 0x00, 0x0a, 0x00, 0x06, 0x00, + 0x02, 0x00, 0xfe, 0xff, 0xfe, 0xff, 0x00, 0x00, 0x03, 0x00, 0x05, 0x00, + 0x04, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xfd, 0xff, 0xfc, 0xff, 0xfa, 0xff, + 0xfb, 0xff, 0x00, 0x00, 0x02, 0x00, 0x02, 0x00, 0x05, 0x00, 0x09, 0x00, + 0x0a, 0x00, 0x07, 0x00, 0x04, 0x00, 0x04, 0x00, 0x06, 0x00, 0x0a, 0x00, + 0x0c, 0x00, 0x0b, 0x00, 0x08, 0x00, 0x04, 0x00, 0xff, 0xff, 0xfb, 0xff, + 0xfa, 0xff, 0xfa, 0xff, 0xfa, 0xff, 0xf9, 0xff, 0xfb, 0xff, 0xfc, 0xff, + 0xfb, 0xff, 0xf9, 0xff, 0xf5, 0xff, 0xf2, 0xff, 0xf2, 0xff, 0xf3, 0xff, + 0xf6, 0xff, 0xf9, 0xff, 0xfb, 0xff, 0xfc, 0xff, 0xfb, 0xff, 0xfa, 0xff, + 0xf8, 0xff, 0xf6, 0xff, 0xf6, 0xff, 0xf7, 0xff, 0xf6, 0xff, 0xf3, 0xff, + 0xf3, 0xff, 0xf2, 0xff, 0xf0, 0xff, 0xed, 0xff, 0xe9, 0xff, 0xe7, 0xff, + 0xe6, 0xff, 0xe7, 0xff, 0xea, 0xff, 0xed, 0xff, 0xee, 0xff, 0xed, 0xff, + 0xe9, 0xff, 0xe5, 0xff, 0xe3, 0xff, 0xe4, 0xff, 0xe6, 0xff, 0xe8, 0xff, + 0xe8, 0xff, 0xe6, 0xff, 0xe3, 0xff, 0xe2, 0xff, 0xe3, 0xff, 0xe6, 0xff, + 0xe8, 0xff, 0xe7, 0xff, 0xe5, 0xff, 0xe2, 0xff, 0xdf, 0xff, 0xdb, 0xff, + 0xd9, 0xff, 0xdc, 0xff, 0xe0, 0xff, 0xe1, 0xff, 0xe0, 0xff, 0xdd, 0xff, + 0xdb, 0xff, 0xdd, 0xff, 0xe0, 0xff, 0xe6, 0xff, 0xeb, 0xff, 0xef, 0xff, + 0xf1, 0xff, 0xf1, 0xff, 0xf2, 0xff, 0xf4, 0xff, 0xf3, 0xff, 0xf0, 0xff, + 0xec, 0xff, 0xe7, 0xff, 0xe4, 0xff, 0xe4, 0xff, 0xe6, 0xff, 0xe9, 0xff, + 0xeb, 0xff, 0xee, 0xff, 0xef, 0xff, 0xef, 0xff, 0xf0, 0xff, 0xf1, 0xff, + 0xf2, 0xff, 0xf3, 0xff, 0xf6, 0xff, 0xf8, 0xff, 0xf9, 0xff, 0xf9, 0xff, + 0xfa, 0xff, 0xfc, 0xff, 0x00, 0x00, 0x03, 0x00, 0x04, 0x00, 0x05, 0x00, + 0x05, 0x00, 0x02, 0x00, 0xfe, 0xff, 0xfc, 0xff, 0xfd, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xfd, 0xff, 0xfd, 0xff, 0xfe, 0xff, 0x01, 0x00, 0x03, 0x00, + 0x05, 0x00, 0x06, 0x00, 0x03, 0x00, 0xfe, 0xff, 0xf9, 0xff, 0xf6, 0xff, + 0xf3, 0xff, 0xf1, 0xff, 0xf0, 0xff, 0xf1, 0xff, 0xf5, 0xff, 0xfa, 0xff, + 0xff, 0xff, 0x03, 0x00, 0x05, 0x00, 0x04, 0x00, 0x04, 0x00, 0x06, 0x00, + 0x08, 0x00, 0x08, 0x00, 0x06, 0x00, 0x04, 0x00, 0x03, 0x00, 0x01, 0x00, + 0xfd, 0xff, 0xf8, 0xff, 0xf4, 0xff, 0xf3, 0xff, 0xf5, 0xff, 0xf9, 0xff, + 0xfd, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xf9, 0xff, 0xf4, 0xff, 0xf3, 0xff, + 0xf6, 0xff, 0xfa, 0xff, 0xfd, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, + 0xfe, 0xff, 0xfe, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xfb, 0xff, 0xf8, 0xff, + 0xf5, 0xff, 0xf3, 0xff, 0xf3, 0xff, 0xf3, 0xff, 0xf3, 0xff, 0xf3, 0xff, + 0xf4, 0xff, 0xf5, 0xff, 0xf8, 0xff, 0xfa, 0xff, 0xfb, 0xff, 0xfb, 0xff, + 0xfa, 0xff, 0xf9, 0xff, 0xfa, 0xff, 0xfe, 0xff, 0x03, 0x00, 0x08, 0x00, + 0x0c, 0x00, 0x0f, 0x00, 0x11, 0x00, 0x12, 0x00, 0x13, 0x00, 0x15, 0x00, + 0x17, 0x00, 0x18, 0x00, 0x17, 0x00, 0x16, 0x00, 0x15, 0x00, 0x14, 0x00, + 0x12, 0x00, 0x10, 0x00, 0x0e, 0x00, 0x0d, 0x00, 0x0e, 0x00, 0x0e, 0x00, + 0x0d, 0x00, 0x0c, 0x00, 0x0c, 0x00, 0x0f, 0x00, 0x13, 0x00, 0x16, 0x00, + 0x18, 0x00, 0x19, 0x00, 0x1a, 0x00, 0x1c, 0x00, 0x1c, 0x00, 0x1b, 0x00, + 0x17, 0x00, 0x14, 0x00, 0x13, 0x00, 0x15, 0x00, 0x18, 0x00, 0x1a, 0x00, + 0x19, 0x00, 0x16, 0x00, 0x15, 0x00, 0x15, 0x00, 0x17, 0x00, 0x19, 0x00, + 0x18, 0x00, 0x15, 0x00, 0x11, 0x00, 0x0c, 0x00, 0x08, 0x00, 0x08, 0x00, + 0x0a, 0x00, 0x0b, 0x00, 0x0a, 0x00, 0x0a, 0x00, 0x09, 0x00, 0x09, 0x00, + 0x09, 0x00, 0x09, 0x00, 0x0b, 0x00, 0x0b, 0x00, 0x0c, 0x00, 0x0c, 0x00, + 0x0b, 0x00, 0x09, 0x00, 0x09, 0x00, 0x0b, 0x00, 0x0e, 0x00, 0x0f, 0x00, + 0x0d, 0x00, 0x0a, 0x00, 0x07, 0x00, 0x04, 0x00, 0x05, 0x00, 0x0a, 0x00, + 0x0e, 0x00, 0x0f, 0x00, 0x0c, 0x00, 0x09, 0x00, 0x08, 0x00, 0x09, 0x00, + 0x0a, 0x00, 0x0c, 0x00, 0x0e, 0x00, 0x0e, 0x00, 0x0b, 0x00, 0x08, 0x00, + 0x07, 0x00, 0x07, 0x00, 0x06, 0x00, 0x05, 0x00, 0x05, 0x00, 0x04, 0x00, + 0x01, 0x00, 0xff, 0xff, 0xfd, 0xff, 0xfd, 0xff, 0x00, 0x00, 0x05, 0x00, + 0x0c, 0x00, 0x10, 0x00, 0x11, 0x00, 0x11, 0x00, 0x0f, 0x00, 0x0c, 0x00, + 0x0b, 0x00, 0x0e, 0x00, 0x12, 0x00, 0x16, 0x00, 0x15, 0x00, 0x12, 0x00, + 0x0e, 0x00, 0x0b, 0x00, 0x0a, 0x00, 0x0b, 0x00, 0x0b, 0x00, 0x0a, 0x00, + 0x08, 0x00, 0x05, 0x00, 0x04, 0x00, 0x04, 0x00, 0x04, 0x00, 0x04, 0x00, + 0x05, 0x00, 0x06, 0x00, 0x07, 0x00, 0x07, 0x00, 0x09, 0x00, 0x0b, 0x00, + 0x0f, 0x00, 0x12, 0x00, 0x15, 0x00, 0x16, 0x00, 0x14, 0x00, 0x11, 0x00, + 0x0d, 0x00, 0x0b, 0x00, 0x09, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, + 0x07, 0x00, 0x07, 0x00, 0x05, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, + 0x04, 0x00, 0x04, 0x00, 0x04, 0x00, 0x02, 0x00, 0x01, 0x00, 0xff, 0xff, + 0xfe, 0xff, 0xff, 0xff, 0x01, 0x00, 0x04, 0x00, 0x08, 0x00, 0x0c, 0x00, + 0x0f, 0x00, 0x11, 0x00, 0x11, 0x00, 0x12, 0x00, 0x12, 0x00, 0x11, 0x00, + 0x0f, 0x00, 0x0b, 0x00, 0x09, 0x00, 0x08, 0x00, 0x08, 0x00, 0x09, 0x00, + 0x0b, 0x00, 0x0a, 0x00, 0x09, 0x00, 0x07, 0x00, 0x04, 0x00, 0x04, 0x00, + 0x03, 0x00, 0x02, 0x00, 0x03, 0x00, 0x03, 0x00, 0x02, 0x00, 0x02, 0x00, + 0x04, 0x00, 0x07, 0x00, 0x0c, 0x00, 0x0f, 0x00, 0x11, 0x00, 0x12, 0x00, + 0x11, 0x00, 0x10, 0x00, 0x11, 0x00, 0x12, 0x00, 0x14, 0x00, 0x14, 0x00, + 0x12, 0x00, 0x0f, 0x00, 0x0d, 0x00, 0x0b, 0x00, 0x0b, 0x00, 0x0b, 0x00, + 0x0c, 0x00, 0x0d, 0x00, 0x0c, 0x00, 0x0a, 0x00, 0x07, 0x00, 0x04, 0x00, + 0x03, 0x00, 0x04, 0x00, 0x05, 0x00, 0x05, 0x00, 0x04, 0x00, 0x03, 0x00, + 0x04, 0x00, 0x04, 0x00, 0x03, 0x00, 0x04, 0x00, 0x07, 0x00, 0x0a, 0x00, + 0x0c, 0x00, 0x0d, 0x00, 0x0e, 0x00, 0x10, 0x00, 0x10, 0x00, 0x0e, 0x00, + 0x0d, 0x00, 0x0a, 0x00, 0x09, 0x00, 0x08, 0x00, 0x06, 0x00, 0x03, 0x00, + 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 0x00, 0x00, 0x02, 0x00, 0x03, 0x00, + 0x03, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x03, 0x00, + 0x05, 0x00, 0x07, 0x00, 0x09, 0x00, 0x0b, 0x00, 0x0c, 0x00, 0x0e, 0x00, + 0x0e, 0x00, 0x0e, 0x00, 0x0e, 0x00, 0x0e, 0x00, 0x0f, 0x00, 0x0f, 0x00, + 0x0c, 0x00, 0x08, 0x00, 0x04, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xfd, 0xff, + 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xfe, 0xff, 0xfd, 0xff, + 0xfd, 0xff, 0xfe, 0xff, 0xff, 0xff, 0x01, 0x00, 0x01, 0x00, 0x02, 0x00, + 0x03, 0x00, 0x06, 0x00, 0x08, 0x00, 0x09, 0x00, 0x0a, 0x00, 0x0a, 0x00, + 0x0b, 0x00, 0x0c, 0x00, 0x0c, 0x00, 0x0b, 0x00, 0x09, 0x00, 0x08, 0x00, + 0x07, 0x00, 0x06, 0x00, 0x06, 0x00, 0x07, 0x00, 0x07, 0x00, 0x07, 0x00, + 0x05, 0x00, 0x02, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x01, 0x00, + 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, + 0x02, 0x00, 0x02, 0x00, 0x03, 0x00, 0x06, 0x00, 0x08, 0x00, 0x09, 0x00, + 0x09, 0x00, 0x09, 0x00, 0x09, 0x00, 0x09, 0x00, 0x09, 0x00, 0x09, 0x00, + 0x07, 0x00, 0x05, 0x00, 0x03, 0x00, 0x01, 0x00, 0x00, 0x00, 0xfe, 0xff, + 0xfc, 0xff, 0xfc, 0xff, 0xfa, 0xff, 0xfa, 0xff, 0xfb, 0xff, 0xfb, 0xff, + 0xfc, 0xff, 0xfd, 0xff, 0xfd, 0xff, 0xfe, 0xff, 0xff, 0xff, 0x00, 0x00, + 0x01, 0x00, 0x01, 0x00, 0x02, 0x00, 0x03, 0x00, 0x04, 0x00, 0x05, 0x00, + 0x05, 0x00, 0x05, 0x00, 0x04, 0x00, 0x04, 0x00, 0x04, 0x00, 0x04, 0x00, + 0x04, 0x00, 0x03, 0x00, 0x02, 0x00, 0x00, 0x00, 0xff, 0xff, 0xfe, 0xff, + 0xfd, 0xff, 0xfd, 0xff, 0xfd, 0xff, 0xfc, 0xff, 0xfc, 0xff, 0xfd, 0xff, + 0xfe, 0xff, 0x00, 0x00, 0x02, 0x00, 0x03, 0x00, 0x02, 0x00, 0x01, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x04, 0x00, 0x04, 0x00, + 0x03, 0x00, 0x03, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x01, 0x00, + 0x00, 0x00, 0xff, 0xff, 0xfd, 0xff, 0xfc, 0xff, 0xfc, 0xff, 0xfb, 0xff, + 0xfb, 0xff, 0xfb, 0xff, 0xfa, 0xff, 0xfa, 0xff, 0xf9, 0xff, 0xf7, 0xff, + 0xf6, 0xff, 0xf4, 0xff, 0xf4, 0xff, 0xf6, 0xff, 0xf7, 0xff, 0xf8, 0xff, + 0xf9, 0xff, 0xf9, 0xff, 0xf8, 0xff, 0xf8, 0xff, 0xf7, 0xff, 0xf7, 0xff, + 0xf9, 0xff, 0xfa, 0xff, 0xfa, 0xff, 0xf9, 0xff, 0xf5, 0xff, 0xf3, 0xff, + 0xf4, 0xff, 0xf4, 0xff, 0xf4, 0xff, 0xf2, 0xff, 0xf0, 0xff, 0xf0, 0xff, + 0xef, 0xff, 0xee, 0xff, 0xef, 0xff, 0xf0, 0xff, 0xf1, 0xff, 0xf1, 0xff, + 0xf0, 0xff, 0xf0, 0xff, 0xf1, 0xff, 0xf0, 0xff, 0xf0, 0xff, 0xf0, 0xff, + 0xf1, 0xff, 0xf1, 0xff, 0xf0, 0xff, 0xee, 0xff, 0xee, 0xff, 0xee, 0xff, + 0xed, 0xff, 0xec, 0xff, 0xeb, 0xff, 0xea, 0xff, 0xe9, 0xff, 0xe7, 0xff, + 0xe7, 0xff, 0xe8, 0xff, 0xe8, 0xff, 0xe8, 0xff, 0xe9, 0xff, 0xe9, 0xff, + 0xea, 0xff, 0xea, 0xff, 0xe9, 0xff, 0xe9, 0xff, 0xe8, 0xff, 0xe8, 0xff, + 0xe8, 0xff, 0xe8, 0xff, 0xe8, 0xff, 0xe8, 0xff, 0xe7, 0xff, 0xe7, 0xff, + 0xea, 0xff, 0xeb, 0xff, 0xec, 0xff, 0xec, 0xff, 0xec, 0xff, 0xec, 0xff, + 0xeb, 0xff, 0xe8, 0xff, 0xe8, 0xff, 0xe8, 0xff, 0xe7, 0xff, 0xe6, 0xff, + 0xe6, 0xff, 0xe6, 0xff, 0xe7, 0xff, 0xe7, 0xff, 0xe9, 0xff, 0xec, 0xff, + 0xee, 0xff, 0xee, 0xff, 0xed, 0xff, 0xec, 0xff, 0xec, 0xff, 0xee, 0xff, + 0xf0, 0xff, 0xf2, 0xff, 0xf3, 0xff, 0xf3, 0xff, 0xf2, 0xff, 0xf1, 0xff, + 0xf1, 0xff, 0xf2, 0xff, 0xf3, 0xff, 0xf3, 0xff, 0xf2, 0xff, 0xf1, 0xff, + 0xf0, 0xff, 0xef, 0xff, 0xef, 0xff, 0xef, 0xff, 0xef, 0xff, 0xef, 0xff, + 0xf0, 0xff, 0xf1, 0xff, 0xf0, 0xff, 0xef, 0xff, 0xef, 0xff, 0xef, 0xff, + 0xef, 0xff, 0xf0, 0xff, 0xf0, 0xff, 0xf1, 0xff, 0xf1, 0xff, 0xf1, 0xff, + 0xf2, 0xff, 0xf2, 0xff, 0xf3, 0xff, 0xf3, 0xff, 0xf3, 0xff, 0xf3, 0xff, + 0xf5, 0xff, 0xf5, 0xff, 0xf5, 0xff, 0xf5, 0xff, 0xf5, 0xff, 0xf6, 0xff, + 0xf5, 0xff, 0xf4, 0xff, 0xf4, 0xff, 0xf3, 0xff, 0xf3, 0xff, 0xf3, 0xff, + 0xf3, 0xff, 0xf2, 0xff, 0xf3, 0xff, 0xf3, 0xff, 0xf4, 0xff, 0xf4, 0xff, + 0xf2, 0xff, 0xf1, 0xff, 0xf1, 0xff, 0xf1, 0xff, 0xf3, 0xff, 0xf5, 0xff, + 0xf5, 0xff, 0xf7, 0xff, 0xf8, 0xff, 0xf6, 0xff, 0xf4, 0xff, 0xf3, 0xff, + 0xf2, 0xff, 0xf2, 0xff, 0xf3, 0xff, 0xf3, 0xff, 0xf5, 0xff, 0xf7, 0xff, + 0xf7, 0xff, 0xf8, 0xff, 0xf8, 0xff, 0xf7, 0xff, 0xf7, 0xff, 0xf8, 0xff, + 0xf9, 0xff, 0xfa, 0xff, 0xf9, 0xff, 0xf9, 0xff, 0xfa, 0xff, 0xfa, 0xff, + 0xfa, 0xff, 0xfa, 0xff, 0xfb, 0xff, 0xfc, 0xff, 0xfc, 0xff, 0xfc, 0xff, + 0xfb, 0xff, 0xfb, 0xff, 0xfb, 0xff, 0xfb, 0xff, 0xfc, 0xff, 0xfc, 0xff, + 0xfd, 0xff, 0xfc, 0xff, 0xfc, 0xff, 0xfb, 0xff, 0xfb, 0xff, 0xfb, 0xff, + 0xfb, 0xff, 0xfb, 0xff, 0xfc, 0xff, 0xfd, 0xff, 0xfd, 0xff, 0xfd, 0xff, + 0xfd, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x02, 0x00, + 0x02, 0x00, 0x03, 0x00, 0x03, 0x00, 0x02, 0x00, 0x03, 0x00, 0x03, 0x00, + 0x03, 0x00, 0x03, 0x00, 0x03, 0x00, 0x03, 0x00, 0x02, 0x00, 0x02, 0x00, + 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x03, 0x00, 0x03, 0x00, + 0x04, 0x00, 0x05, 0x00, 0x05, 0x00, 0x05, 0x00, 0x04, 0x00, 0x03, 0x00, + 0x02, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x05, 0x00, 0x06, 0x00, + 0x06, 0x00, 0x05, 0x00, 0x05, 0x00, 0x05, 0x00, 0x05, 0x00, 0x06, 0x00, + 0x07, 0x00, 0x07, 0x00, 0x06, 0x00, 0x06, 0x00, 0x07, 0x00, 0x06, 0x00, + 0x05, 0x00, 0x04, 0x00, 0x04, 0x00, 0x04, 0x00, 0x04, 0x00, 0x04, 0x00, + 0x03, 0x00, 0x03, 0x00, 0x03, 0x00, 0x03, 0x00, 0x04, 0x00, 0x05, 0x00, + 0x07, 0x00, 0x08, 0x00, 0x08, 0x00, 0x07, 0x00, 0x07, 0x00, 0x08, 0x00, + 0x09, 0x00, 0x0a, 0x00, 0x0a, 0x00, 0x0a, 0x00, 0x0b, 0x00, 0x0a, 0x00, + 0x09, 0x00, 0x0a, 0x00, 0x0a, 0x00, 0x0b, 0x00, 0x0c, 0x00, 0x0c, 0x00, + 0x0c, 0x00, 0x0c, 0x00, 0x0a, 0x00, 0x08, 0x00, 0x08, 0x00, 0x09, 0x00, + 0x0a, 0x00, 0x0b, 0x00, 0x0b, 0x00, 0x0d, 0x00, 0x0d, 0x00, 0x0d, 0x00, + 0x0d, 0x00, 0x0d, 0x00, 0x0c, 0x00, 0x0d, 0x00, 0x0d, 0x00, 0x0d, 0x00, + 0x0e, 0x00, 0x0e, 0x00, 0x0e, 0x00, 0x0e, 0x00, 0x0f, 0x00, 0x10, 0x00, + 0x0f, 0x00, 0x0e, 0x00, 0x0d, 0x00, 0x0d, 0x00, 0x0e, 0x00, 0x0e, 0x00, + 0x0d, 0x00, 0x0d, 0x00, 0x0d, 0x00, 0x0e, 0x00, 0x0e, 0x00, 0x0d, 0x00, + 0x0d, 0x00, 0x0e, 0x00, 0x0f, 0x00, 0x10, 0x00, 0x11, 0x00, 0x12, 0x00, + 0x12, 0x00, 0x11, 0x00, 0x11, 0x00, 0x11, 0x00, 0x11, 0x00, 0x10, 0x00, + 0x11, 0x00, 0x11, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x0f, 0x00, + 0x0f, 0x00, 0x0f, 0x00, 0x0e, 0x00, 0x0e, 0x00, 0x0e, 0x00, 0x0e, 0x00, + 0x0f, 0x00, 0x0e, 0x00, 0x0d, 0x00, 0x0d, 0x00, 0x0d, 0x00, 0x0d, 0x00, + 0x0d, 0x00, 0x0d, 0x00, 0x0d, 0x00, 0x0e, 0x00, 0x0e, 0x00, 0x0e, 0x00, + 0x0f, 0x00, 0x0e, 0x00, 0x0e, 0x00, 0x0f, 0x00, 0x10, 0x00, 0x11, 0x00, + 0x12, 0x00, 0x12, 0x00, 0x11, 0x00, 0x0f, 0x00, 0x0e, 0x00, 0x0e, 0x00, + 0x0e, 0x00, 0x0e, 0x00, 0x0f, 0x00, 0x0f, 0x00, 0x0e, 0x00, 0x0e, 0x00, + 0x0e, 0x00, 0x0e, 0x00, 0x0e, 0x00, 0x0d, 0x00, 0x0c, 0x00, 0x0d, 0x00, + 0x0d, 0x00, 0x0d, 0x00, 0x0d, 0x00, 0x0d, 0x00, 0x0d, 0x00, 0x0e, 0x00, + 0x0d, 0x00, 0x0c, 0x00, 0x0b, 0x00, 0x0c, 0x00, 0x0c, 0x00, 0x0b, 0x00, + 0x0c, 0x00, 0x0c, 0x00, 0x0d, 0x00, 0x0d, 0x00, 0x0d, 0x00, 0x0c, 0x00, + 0x0b, 0x00, 0x09, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, + 0x09, 0x00, 0x09, 0x00, 0x07, 0x00, 0x06, 0x00, 0x05, 0x00, 0x06, 0x00, + 0x06, 0x00, 0x06, 0x00, 0x07, 0x00, 0x08, 0x00, 0x07, 0x00, 0x06, 0x00, + 0x06, 0x00, 0x05, 0x00, 0x06, 0x00, 0x07, 0x00, 0x09, 0x00, 0x0a, 0x00, + 0x0a, 0x00, 0x09, 0x00, 0x08, 0x00, 0x07, 0x00, 0x05, 0x00, 0x05, 0x00, + 0x05, 0x00, 0x05, 0x00, 0x06, 0x00, 0x05, 0x00, 0x05, 0x00, 0x05, 0x00, + 0x03, 0x00, 0x03, 0x00, 0x03, 0x00, 0x03, 0x00, 0x03, 0x00, 0x03, 0x00, + 0x03, 0x00, 0x04, 0x00, 0x06, 0x00, 0x06, 0x00, 0x05, 0x00, 0x05, 0x00, + 0x05, 0x00, 0x04, 0x00, 0x04, 0x00, 0x04, 0x00, 0x04, 0x00, 0x04, 0x00, + 0x04, 0x00, 0x05, 0x00, 0x04, 0x00, 0x04, 0x00, 0x04, 0x00, 0x04, 0x00, + 0x04, 0x00, 0x03, 0x00, 0x02, 0x00, 0x02, 0x00, 0x03, 0x00, 0x03, 0x00, + 0x04, 0x00, 0x04, 0x00, 0x03, 0x00, 0x02, 0x00, 0x02, 0x00, 0x01, 0x00, + 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x02, 0x00, 0x03, 0x00, 0x04, 0x00, + 0x04, 0x00, 0x03, 0x00, 0x03, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, + 0x01, 0x00, 0x01, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x01, 0x00, + 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x02, 0x00, + 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, + 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, + 0xfe, 0xff, 0xfe, 0xff, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, + 0xfe, 0xff, 0xfe, 0xff, 0xfe, 0xff, 0xfd, 0xff, 0xfd, 0xff, 0xfd, 0xff, + 0xfd, 0xff, 0xfd, 0xff, 0xfe, 0xff, 0xfe, 0xff, 0xfe, 0xff, 0xfd, 0xff, + 0xfe, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xfc, 0xff, 0xfc, 0xff, 0xfc, 0xff, + 0xfb, 0xff, 0xfb, 0xff, 0xfa, 0xff, 0xfa, 0xff, 0xfa, 0xff, 0xfa, 0xff, + 0xfa, 0xff, 0xfb, 0xff, 0xfa, 0xff, 0xfa, 0xff, 0xf9, 0xff, 0xf8, 0xff, + 0xf9, 0xff, 0xfa, 0xff, 0xfa, 0xff, 0xfb, 0xff, 0xfc, 0xff, 0xfc, 0xff, + 0xfc, 0xff, 0xfc, 0xff, 0xfb, 0xff, 0xfa, 0xff, 0xfb, 0xff, 0xfb, 0xff, + 0xfa, 0xff, 0xfa, 0xff, 0xfa, 0xff, 0xfa, 0xff, 0xfa, 0xff, 0xfa, 0xff, + 0xfa, 0xff, 0xfb, 0xff, 0xfb, 0xff, 0xfa, 0xff, 0xf9, 0xff, 0xfa, 0xff, + 0xf9, 0xff, 0xf8, 0xff, 0xf7, 0xff, 0xf8, 0xff, 0xf9, 0xff, 0xf9, 0xff, + 0xf9, 0xff, 0xfa, 0xff, 0xfa, 0xff, 0xfa, 0xff, 0xfa, 0xff, 0xfa, 0xff, + 0xfb, 0xff, 0xfb, 0xff, 0xfb, 0xff, 0xfb, 0xff, 0xfb, 0xff, 0xfb, 0xff, + 0xfb, 0xff, 0xfb, 0xff, 0xfa, 0xff, 0xfa, 0xff, 0xfa, 0xff, 0xfa, 0xff, + 0xfa, 0xff, 0xf9, 0xff, 0xf9, 0xff, 0xf8, 0xff, 0xf7, 0xff, 0xf7, 0xff, + 0xf8, 0xff, 0xf8, 0xff, 0xf9, 0xff, 0xfa, 0xff, 0xfa, 0xff, 0xf9, 0xff, + 0xfa, 0xff, 0xfa, 0xff, 0xfa, 0xff, 0xf9, 0xff, 0xf9, 0xff, 0xf9, 0xff, + 0xfa, 0xff, 0xfa, 0xff, 0xfb, 0xff, 0xfb, 0xff, 0xfa, 0xff, 0xfa, 0xff, + 0xfb, 0xff, 0xfc, 0xff, 0xfb, 0xff, 0xfa, 0xff, 0xf9, 0xff, 0xf9, 0xff, + 0xf9, 0xff, 0xf8, 0xff, 0xf8, 0xff, 0xf8, 0xff, 0xf9, 0xff, 0xf9, 0xff, + 0xf9, 0xff, 0xf9, 0xff, 0xf9, 0xff, 0xf9, 0xff, 0xf9, 0xff, 0xf8, 0xff, + 0xf9, 0xff, 0xf9, 0xff, 0xfa, 0xff, 0xfb, 0xff, 0xfb, 0xff, 0xfb, 0xff, + 0xfc, 0xff, 0xfc, 0xff, 0xfb, 0xff, 0xfb, 0xff, 0xfb, 0xff, 0xfb, 0xff, + 0xfb, 0xff, 0xfb, 0xff, 0xfb, 0xff, 0xfa, 0xff, 0xfa, 0xff, 0xfa, 0xff, + 0xfa, 0xff, 0xfa, 0xff, 0xfa, 0xff, 0xfa, 0xff, 0xf9, 0xff, 0xf9, 0xff, + 0xfa, 0xff, 0xfb, 0xff, 0xfb, 0xff, 0xfa, 0xff, 0xfa, 0xff, 0xfa, 0xff, + 0xfb, 0xff, 0xfb, 0xff, 0xfb, 0xff, 0xfb, 0xff, 0xfb, 0xff, 0xfc, 0xff, + 0xfc, 0xff, 0xfc, 0xff, 0xfb, 0xff, 0xfb, 0xff, 0xfb, 0xff, 0xfb, 0xff, + 0xfb, 0xff, 0xfb, 0xff, 0xfb, 0xff, 0xfb, 0xff, 0xfb, 0xff, 0xfb, 0xff, + 0xfa, 0xff, 0xfa, 0xff, 0xfb, 0xff, 0xfb, 0xff, 0xfb, 0xff, 0xfb, 0xff, + 0xfc, 0xff, 0xfb, 0xff, 0xfb, 0xff, 0xfb, 0xff, 0xfc, 0xff, 0xfb, 0xff, + 0xfb, 0xff, 0xfa, 0xff, 0xfa, 0xff, 0xfb, 0xff, 0xfb, 0xff, 0xfc, 0xff, + 0xfd, 0xff, 0xfd, 0xff, 0xfc, 0xff, 0xfc, 0xff, 0xfc, 0xff, 0xfc, 0xff, + 0xfb, 0xff, 0xfb, 0xff, 0xfc, 0xff, 0xfc, 0xff, 0xfc, 0xff, 0xfc, 0xff, + 0xfc, 0xff, 0xfc, 0xff, 0xfb, 0xff, 0xfb, 0xff, 0xfb, 0xff, 0xfb, 0xff, + 0xfb, 0xff, 0xfb, 0xff, 0xfc, 0xff, 0xfd, 0xff, 0xfc, 0xff, 0xfc, 0xff, + 0xfc, 0xff, 0xfc, 0xff, 0xfc, 0xff, 0xfc, 0xff, 0xfc, 0xff, 0xfc, 0xff, + 0xfc, 0xff, 0xfc, 0xff, 0xfd, 0xff, 0xfe, 0xff, 0xfd, 0xff, 0xfd, 0xff, + 0xfd, 0xff, 0xfd, 0xff, 0xfc, 0xff, 0xfc, 0xff, 0xfd, 0xff, 0xfd, 0xff, + 0xfe, 0xff, 0xfe, 0xff, 0xfe, 0xff, 0xfe, 0xff, 0xfd, 0xff, 0xfc, 0xff, + 0xfc, 0xff, 0xfd, 0xff, 0xfd, 0xff, 0xfd, 0xff, 0xfd, 0xff, 0xfc, 0xff, + 0xfd, 0xff, 0xfe, 0xff, 0xfd, 0xff, 0xfd, 0xff, 0xfd, 0xff, 0xfd, 0xff, + 0xfd, 0xff, 0xfe, 0xff, 0xfe, 0xff, 0xfd, 0xff, 0xfd, 0xff, 0xfe, 0xff +}; + diff --git a/src/commands/Command.cpp b/src/commands/Command.cpp new file mode 100644 index 0000000..187267c --- /dev/null +++ b/src/commands/Command.cpp @@ -0,0 +1,10 @@ +#include "Command.hpp" +#include "world/level/Level.h" +#include + +bool Command::isPlayerOp(Minecraft& mc, Player& player) { + std::string nicknameLower = player.name; + std::transform(nicknameLower.begin(), nicknameLower.end(), nicknameLower.begin(), ::tolower); + + return mc.level->ops.find(nicknameLower) != mc.level->ops.end(); +} \ No newline at end of file diff --git a/src/commands/Command.hpp b/src/commands/Command.hpp new file mode 100644 index 0000000..e19ad45 --- /dev/null +++ b/src/commands/Command.hpp @@ -0,0 +1,21 @@ +#pragma once +#include +#include + +class Minecraft; +class Player; + +class Command { +public: + const std::string& getName() { return m_name; } + + bool isPlayerOp(Minecraft& mc, Player& player); + + virtual std::string execute(Minecraft& mc, Player& player, const std::vector& args) = 0; + virtual std::string help(Minecraft& mc) = 0; + +protected: + Command(const std::string& name) : m_name(name) {} + + const std::string m_name; +}; \ No newline at end of file diff --git a/src/commands/CommandBan.cpp b/src/commands/CommandBan.cpp new file mode 100644 index 0000000..3877d95 --- /dev/null +++ b/src/commands/CommandBan.cpp @@ -0,0 +1,52 @@ +#include "CommandBan.hpp" +#include "commands/Command.hpp" +#include "network/RakNetInstance.h" +#include "raknet/RakPeerInterface.h" +#include "world/level/Level.h" +#include +#include + +CommandBan::CommandBan() : Command("ban") {} + +std::string CommandBan::execute(Minecraft& mc, Player& player, const std::vector& args) { + if (!isPlayerOp(mc, player)) { + return "You aren't enough priveleged to run this command"; + } + + if (args.empty()) { + return help(mc); + } + + std::string nicknameLower = args[0]; + std::transform(nicknameLower.begin(), nicknameLower.end(), nicknameLower.begin(), ::tolower); + + auto it = std::find_if(mc.level->players.begin(), mc.level->players.end(), [args, nicknameLower] (auto& it) -> bool { + std::string lower = it->name; + std::transform(lower.begin(), lower.end(), lower.begin(), ::tolower); + + return lower == nicknameLower; + }); + + if (*it == (Player*)mc.player) { + return "ban: you can't ban urself lol"; + } + + if (it != mc.level->players.end()) { + mc.level->removePlayer(*it); + (*it)->remove(); + mc.raknetInstance->getPeer()->CloseConnection((*it)->owner, true); + } else { + for (auto& banned : mc.level->bannedPlayers) { + if (nicknameLower == banned) { + return args[0] + "already banned!"; + } + } + } + + mc.level->bannedPlayers.insert(nicknameLower); + return "ban: successfully banned player " + args[0]; +} + +std::string CommandBan::help(Minecraft& mc) { + return "Usage: /ban "; +} \ No newline at end of file diff --git a/src/commands/CommandBan.hpp b/src/commands/CommandBan.hpp new file mode 100644 index 0000000..b688800 --- /dev/null +++ b/src/commands/CommandBan.hpp @@ -0,0 +1,9 @@ +#include "Command.hpp" + +class CommandBan : public Command { +public: + CommandBan(); + + std::string execute(Minecraft& mc, Player& player, const std::vector& args); + std::string help(Minecraft& mc); +}; \ No newline at end of file diff --git a/src/commands/CommandGimmieItems.cpp b/src/commands/CommandGimmieItems.cpp new file mode 100644 index 0000000..9a7f542 --- /dev/null +++ b/src/commands/CommandGimmieItems.cpp @@ -0,0 +1,33 @@ +#include "CommandGimmieItems.hpp" +#include +#include +#include + +CommandGimmieItems::CommandGimmieItems() : Command("gimmieitems") {} + +std::string CommandGimmieItems::execute(Minecraft& mc, Player& player, const std::vector& args) { + if (mc.level != nullptr) { + if (mc.level->getLevelData()->getAllowCheats()) { + player.inventory->add(new ItemInstance(Item::ironIngot, 64)); + player.inventory->add(new ItemInstance(Item::ironIngot, 34)); + player.inventory->add(new ItemInstance(Tile::stonecutterBench)); + player.inventory->add(new ItemInstance(Tile::workBench)); + player.inventory->add(new ItemInstance(Tile::furnace)); + player.inventory->add(new ItemInstance(Tile::wood, 54)); + player.inventory->add(new ItemInstance(Item::stick, 14)); + player.inventory->add(new ItemInstance(Item::coal, 31)); + player.inventory->add(new ItemInstance(Tile::sand, 6)); + player.inventory->add(new ItemInstance(Item::dye_powder, 23, DyePowderItem::PURPLE)); + + return "Grant debug items. Have fun!"; + } else { + return "Cheats are not allowed!"; + } + } + + return "World not loaded"; +} + +std::string CommandGimmieItems::help(Minecraft& mc) { + return "Usage: /gimmieitems"; +} \ No newline at end of file diff --git a/src/commands/CommandGimmieItems.hpp b/src/commands/CommandGimmieItems.hpp new file mode 100644 index 0000000..d3fa66e --- /dev/null +++ b/src/commands/CommandGimmieItems.hpp @@ -0,0 +1,9 @@ +#include "Command.hpp" + +class CommandGimmieItems : public Command { +public: + CommandGimmieItems(); + + std::string execute(Minecraft& mc, Player& player, const std::vector& args); + std::string help(Minecraft& mc); +}; \ No newline at end of file diff --git a/src/commands/CommandHelp.cpp b/src/commands/CommandHelp.cpp new file mode 100644 index 0000000..9f09da4 --- /dev/null +++ b/src/commands/CommandHelp.cpp @@ -0,0 +1,35 @@ +#include "CommandHelp.hpp" +#include "commands/Command.hpp" +#include "CommandManager.hpp" +#include +#include + +CommandHelp::CommandHelp() : Command("help") {} + +std::string CommandHelp::execute(Minecraft& mc, Player& player, const std::vector& args) { + if (args.empty()) { + auto cmds = mc.commandManager().getListAllCommands(); + + std::ostringstream output; + + output << "List of all commands:" << std::endl; + + for (auto& cmd : cmds) { + output << " - " + cmd << std::endl;; + } + + return output.str(); + } + + Command* cmd = mc.commandManager().getCommand(args[0]); + + if (cmd != nullptr) { + return cmd->help(mc); + } + + return "help: command " + args[0] + " not found"; +} + +std::string CommandHelp::help(Minecraft& mc) { + return "Usage: /help "; +} \ No newline at end of file diff --git a/src/commands/CommandHelp.hpp b/src/commands/CommandHelp.hpp new file mode 100644 index 0000000..4c2349a --- /dev/null +++ b/src/commands/CommandHelp.hpp @@ -0,0 +1,9 @@ +#include "Command.hpp" + +class CommandHelp : public Command { +public: + CommandHelp(); + + std::string execute(Minecraft& mc, Player& player, const std::vector& args); + std::string help(Minecraft& mc); +}; \ No newline at end of file diff --git a/src/commands/CommandKick.cpp b/src/commands/CommandKick.cpp new file mode 100644 index 0000000..b876d9a --- /dev/null +++ b/src/commands/CommandKick.cpp @@ -0,0 +1,46 @@ +#include "CommandKick.hpp" +#include "commands/Command.hpp" +#include "network/RakNetInstance.h" +#include "raknet/RakPeerInterface.h" +#include "world/level/Level.h" +#include +#include + +CommandKick::CommandKick() : Command("kick") {} + +std::string CommandKick::execute(Minecraft& mc, Player& player, const std::vector& args) { + if (!isPlayerOp(mc, player)) { + return "You aren't enough priveleged to run this command"; + } + + if (args.empty()) { + return help(mc); + } + + std::string nicknameLower = args[0]; + std::transform(nicknameLower.begin(), nicknameLower.end(), nicknameLower.begin(), ::tolower); + + auto it = std::find_if(mc.level->players.begin(), mc.level->players.end(), [args, nicknameLower] (auto& it) -> bool { + std::string lower = it->name; + std::transform(lower.begin(), lower.end(), lower.begin(), ::tolower); + + return lower == nicknameLower; + }); + + if (it == mc.level->players.end()) { + return "kick: can't find player with name " + args[0]; + } + + if (*it == (Player*)mc.player) { + return "kick: you can't kick urself lol"; + } + + mc.level->removePlayer(*it); + (*it)->remove(); + mc.raknetInstance->getPeer()->CloseConnection((*it)->owner, true); + return "kick: successfully kicked player " + args[0]; +} + +std::string CommandKick::help(Minecraft& mc) { + return "Usage: /kick "; +} \ No newline at end of file diff --git a/src/commands/CommandKick.hpp b/src/commands/CommandKick.hpp new file mode 100644 index 0000000..5b94819 --- /dev/null +++ b/src/commands/CommandKick.hpp @@ -0,0 +1,9 @@ +#include "Command.hpp" + +class CommandKick : public Command { +public: + CommandKick(); + + std::string execute(Minecraft& mc, Player& player, const std::vector& args); + std::string help(Minecraft& mc); +}; \ No newline at end of file diff --git a/src/commands/CommandManager.cpp b/src/commands/CommandManager.cpp new file mode 100644 index 0000000..16b331c --- /dev/null +++ b/src/commands/CommandManager.cpp @@ -0,0 +1,70 @@ +#include "CommandManager.hpp" +#include +#include +#include +#include "client/Minecraft.h" +#include "commands/Command.hpp" +#include "commands/CommandHelp.hpp" +#include "commands/CommandKick.hpp" +#include "commands/CommandOp.hpp" +#include "commands/CommandBan.hpp" +#include "commands/CommandGimmieItems.hpp" +#include "network/packet/ChatPacket.h" +#include "network/RakNetInstance.h" +#include "world/level/Level.h" + +CommandManager::CommandManager() { + registerAllCommands(); +} + +void CommandManager::registerAllCommands() { + m_commands.push_back(new CommandHelp()); + m_commands.push_back(new CommandKick()); + m_commands.push_back(new CommandOp()); + m_commands.push_back(new CommandBan()); + // m_commands.push_back(new CommandGimmieItems()); +} + +std::vector CommandManager::getListAllCommands() { + std::vector ret; + + for (auto& cmd : m_commands) { + ret.push_back(cmd->getName()); + } + + return ret; +} + +std::string CommandManager::execute(Minecraft& mc, Player& player, const std::string& input) { + std::istringstream ss(input); + std::string cmd; + + ss >> cmd; + + auto it = std::find_if(m_commands.begin(), m_commands.end(), [cmd](auto& it) -> bool { + return it->getName() == cmd; + }); + + if (it == m_commands.end()) { + return "Command /" + cmd + " not found"; + } + + std::vector args; + + std::string tok; + while (ss >> tok) args.push_back(tok); + + return (*it)->execute(mc, player, args); +} + +Command* CommandManager::getCommand(const std::string& name) { + auto it = std::find_if(m_commands.begin(), m_commands.end(), [name](auto& it) -> bool { + return it->getName() == name; + }); + + if (it == m_commands.end()) { + return *it; + } + + return nullptr; +} \ No newline at end of file diff --git a/src/commands/CommandManager.hpp b/src/commands/CommandManager.hpp new file mode 100644 index 0000000..c33b363 --- /dev/null +++ b/src/commands/CommandManager.hpp @@ -0,0 +1,21 @@ +#pragma once +#include +#include + +#include "Command.hpp" + +class CommandManager { +public: + CommandManager(); + + std::vector getListAllCommands(); + + std::string execute(Minecraft& mc, Player& player, const std::string& input); + + Command* getCommand(const std::string& name); + +private: + void registerAllCommands(); + + std::vector m_commands; +}; \ No newline at end of file diff --git a/src/commands/CommandOp.cpp b/src/commands/CommandOp.cpp new file mode 100644 index 0000000..7fc2c30 --- /dev/null +++ b/src/commands/CommandOp.cpp @@ -0,0 +1,31 @@ +#include "CommandOp.hpp" +#include "commands/Command.hpp" +#include "world/level/Level.h" +#include +#include + +CommandOp::CommandOp() : Command("op") {} + +std::string CommandOp::execute(Minecraft& mc, Player& player, const std::vector& args) { + if (!isPlayerOp(mc, player)) { + return "You aren't enough priveleged to run this command"; + } + + if (args.empty()) { + return help(mc); + } + + std::string nicknameLower = args[0]; + std::transform(nicknameLower.begin(), nicknameLower.end(), nicknameLower.begin(), ::tolower); + + if (mc.level->ops.find(nicknameLower) != mc.level->ops.end()) { + return "op: player " + args[0] + " already opped"; + } + + mc.level->ops.emplace(nicknameLower); + return "op: successfully opped player " + args[0]; +} + +std::string CommandOp::help(Minecraft& mc) { + return "Usage: /op "; +} \ No newline at end of file diff --git a/src/commands/CommandOp.hpp b/src/commands/CommandOp.hpp new file mode 100644 index 0000000..e91eea9 --- /dev/null +++ b/src/commands/CommandOp.hpp @@ -0,0 +1,9 @@ +#include "Command.hpp" + +class CommandOp : public Command { +public: + CommandOp(); + + std::string execute(Minecraft& mc, Player& player, const std::vector& args); + std::string help(Minecraft& mc); +}; \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp index de00f66..885f4bc 100755 --- a/src/main.cpp +++ b/src/main.cpp @@ -22,12 +22,12 @@ #include "NinecraftApp.h" #define MAIN_CLASS NinecraftApp -#ifdef PLATFORM_WINDOWS - #include "main_win32.h" -#endif +// #ifdef PLATFORM_WINDOWS +// #include "main_win32.h" +// #endif -#ifdef PLATFORM_GLFW +#if defined(PLATFORM_DESKTOP) || defined(PLATFORM_WEB) #include "main_glfw.h" #endif diff --git a/src/main_android.cpp b/src/main_android.cpp index db75547..dc47f35 100755 --- a/src/main_android.cpp +++ b/src/main_android.cpp @@ -1,5 +1,6 @@ #include "App.h" #include "AppPlatform_android.h" +#include // Horrible, I know. / A #ifndef MAIN_CLASS @@ -24,12 +25,33 @@ static void setupExternalPath(struct android_app* state, MAIN_CLASS* app) { LOGI("Environment exists"); } - jclass clazz = env->FindClass("android/os/Environment"); - jmethodID method = env->GetStaticMethodID(clazz, "getExternalStorageDirectory", "()Ljava/io/File;"); - if (env->ExceptionOccurred()) { - env->ExceptionDescribe(); + // try appspecific external directory first + jobject activity = state->activity->clazz; + jclass activityClass = env->GetObjectClass(activity); + jmethodID getExternalFilesDir = env->GetMethodID(activityClass, "getExternalFilesDir", "(Ljava/lang/String;)Ljava/io/File;"); + + jobject file = NULL; + if (getExternalFilesDir != NULL) { + file = env->CallObjectMethod(activity, getExternalFilesDir, NULL); + } + + if (file == NULL) { + // Fallback to the legacy shared storage directory + jclass clazz = env->FindClass("android/os/Environment"); + jmethodID method = env->GetStaticMethodID(clazz, "getExternalStorageDirectory", "()Ljava/io/File;"); + if (env->ExceptionOccurred()) { + env->ExceptionDescribe(); + env->ExceptionClear(); + } + file = env->CallStaticObjectMethod(clazz, method); + } + + if (!file) { + LOGI("Failed to get external storage file object, using current working dir"); + app->externalStoragePath = "."; + app->externalCacheStoragePath = "."; + return; } - jobject file = env->CallStaticObjectMethod(clazz, method); jclass fileClass = env->GetObjectClass(file); jmethodID fileMethod = env->GetMethodID(fileClass, "getAbsolutePath", "()Ljava/lang/String;"); @@ -37,8 +59,16 @@ static void setupExternalPath(struct android_app* state, MAIN_CLASS* app) const char* str = env->GetStringUTFChars((jstring) pathString, NULL); app->externalStoragePath = str; - app->externalCacheStoragePath = str; - LOGI(str); + app->externalCacheStoragePath = str; + LOGI("%s", str); + + // ensure the process working directory is set to a writable location + // on Android the default cwd may be '/' which isn't writable. By chdir'ing + // to the external storage path we make relative fopen calls (e.g. "options.txt") + // succeed and persist across launches, fixing the "options never save" bug. + if (chdir(str) != 0) { + LOGI("chdir to %s failed: %s", str, strerror(errno)); + } env->ReleaseStringUTFChars((jstring)pathString, str); diff --git a/src/main_android.h b/src/main_android.h index 4ab1285..e31102c 100755 --- a/src/main_android.h +++ b/src/main_android.h @@ -25,7 +25,7 @@ #include "platform/input/Mouse.h" #include "platform/input/Multitouch.h" -#include "EGLConfigPrinter.h" +#include "EglConfigPrinter.h" const int BroadcastPort = 9991; diff --git a/src/main_android_java.cpp b/src/main_android_java.cpp index 2de0001..d407ba7 100755 --- a/src/main_android_java.cpp +++ b/src/main_android_java.cpp @@ -1,8 +1,13 @@ #include "App.h" #include "AppPlatform_android.h" +// JNI keycode constants +#include + //#include "main_android_java.h" #include "platform/input/Multitouch.h" +#include +#include // Horrible, I know. / A #ifndef MAIN_CLASS @@ -25,12 +30,33 @@ static void setupExternalPath(JNIEnv* env, MAIN_CLASS* app) { LOGI("Environment exists"); } - jclass clazz = env->FindClass("android/os/Environment"); - jmethodID method = env->GetStaticMethodID(clazz, "getExternalStorageDirectory", "()Ljava/io/File;"); - if (env->ExceptionOccurred()) { - env->ExceptionDescribe(); + // try appspecific external directory first + jobject activity = g_pActivity; + jclass activityClass = env->GetObjectClass(activity); + jmethodID getExternalFilesDir = env->GetMethodID(activityClass, "getExternalFilesDir", "(Ljava/lang/String;)Ljava/io/File;"); + + jobject file = NULL; + if (getExternalFilesDir != NULL) { + file = env->CallObjectMethod(activity, getExternalFilesDir, NULL); + } + + if (file == NULL) { + // Fallback to the legacy shared storage directory + jclass clazz = env->FindClass("android/os/Environment"); + jmethodID method = env->GetStaticMethodID(clazz, "getExternalStorageDirectory", "()Ljava/io/File;"); + if (env->ExceptionOccurred()) { + env->ExceptionDescribe(); + env->ExceptionClear(); + } + file = env->CallStaticObjectMethod(clazz, method); + } + + if (!file) { + LOGI("Failed to get external storage file object, using current working dir"); + app->externalStoragePath = "."; + app->externalCacheStoragePath = "."; + return; } - jobject file = env->CallStaticObjectMethod(clazz, method); jclass fileClass = env->GetObjectClass(file); jmethodID fileMethod = env->GetMethodID(fileClass, "getAbsolutePath", "()Ljava/lang/String;"); @@ -38,8 +64,13 @@ static void setupExternalPath(JNIEnv* env, MAIN_CLASS* app) const char* str = env->GetStringUTFChars((jstring) pathString, NULL); app->externalStoragePath = str; - app->externalCacheStoragePath = str; - LOGI(str); + app->externalCacheStoragePath = str; + LOGI("%s", str); + + // same fix as the native entry point: make sure cwd is writable + if (chdir(str) != 0) { + LOGI("chdir to %s failed: %s", str, strerror(errno)); + } env->ReleaseStringUTFChars((jstring)pathString, str); } @@ -57,6 +88,7 @@ static void pointerMove(int pointerId, int x, int y) { static App* gApp = 0; static AppContext gContext; +static bool g_inNativeOnCreate = false; extern "C" { JNIEXPORT jint JNICALL @@ -81,40 +113,59 @@ Java_com_mojang_minecraftpe_MainActivity_nativeUnregisterThis(JNIEnv* env, jobje } JNIEXPORT void JNICALL -Java_com_mojang_minecraftpe_MainActivity_nativeOnCreate(JNIEnv* env) { - LOGI("@nativeOnCreate\n"); +Java_com_mojang_minecraftpe_MainActivity_nativeOnCreate(JNIEnv* env, jobject thiz, jint screenWidth, jint screenHeight) { + LOGI("@nativeOnCreate w=%d h=%d\n", (int)screenWidth, (int)screenHeight); + g_inNativeOnCreate = true; appPlatform.instance = g_pActivity; - appPlatform.initConsts(); + appPlatform.setScreenDimensions((int)screenWidth, (int)screenHeight); + LOGI("nativeOnCreate: screen set, no initConsts needed\n"); gContext.doRender = false; gContext.platform = &appPlatform; + LOGI("nativeOnCreate: creating gApp\n"); gApp = new MAIN_CLASS(); + LOGI("nativeOnCreate: gApp=%p\n", gApp); setupExternalPath(env, (MAIN_CLASS*)gApp); + if (env->ExceptionOccurred()) { + LOGI("nativeOnCreate: exception after setupExternalPath!\n"); + env->ExceptionDescribe(); + env->ExceptionClear(); + } + LOGI("nativeOnCreate: done\n"); + g_inNativeOnCreate = false; //gApp->init(gContext); } +static int s_surfaceCreatedCount = 0; + JNIEXPORT void JNICALL Java_com_mojang_minecraftpe_GLRenderer_nativeOnSurfaceCreated(JNIEnv* env) { - LOGI("@nativeOnSurfaceCreated\n"); + s_surfaceCreatedCount++; + if (g_inNativeOnCreate) { + // Skip re-entrant surface callbacks that fire during nativeOnCreate + return; + } + LOGI("@nativeOnSurfaceCreated #%d tid=%d\n", s_surfaceCreatedCount, (int)gettid()); if (gApp) { -// gApp->setSize( gContext.platform->getScreenWidth(), -// gContext.platform->getScreenHeight(), -// gContext.platform->isTouchscreen()); - // Don't call onGraphicsReset the first time - if (gApp->isInited()) + if (gApp->isInited()) { + LOGI("nativeOnSurfaceCreated: calling onGraphicsReset\n"); gApp->onGraphicsReset(gContext); + } - if (!gApp->isInited()) + if (!gApp->isInited()) { + LOGI("nativeOnSurfaceCreated: calling init\n"); gApp->init(gContext); + LOGI("nativeOnSurfaceCreated: init done, isInited=%d\n", (int)gApp->isInited()); + } } } JNIEXPORT void JNICALL Java_com_mojang_minecraftpe_GLRenderer_nativeOnSurfaceChanged(JNIEnv* env, jclass cls, jint w, jint h) { - LOGI("@nativeOnSurfaceChanged: %p\n", pthread_self()); + LOGI("@nativeOnSurfaceChanged: %lu\n", (unsigned long)pthread_self()); if (gApp) { gApp->setSize(w, h); @@ -153,15 +204,47 @@ Java_com_mojang_minecraftpe_GLRenderer_nativeUpdate(JNIEnv* env) { // // Keyboard events // +// helper to convert Android keycodes to our internal Keyboard constants +static int androidKeyToInternal(int androidKey) { + switch(androidKey) { + case AKEYCODE_DEL: return Keyboard::KEY_BACKSPACE; + case AKEYCODE_ENTER: + case AKEYCODE_NUMPAD_ENTER: + return Keyboard::KEY_RETURN; + // letters are delivered via nativeTextChar so no need to map here + default: + return androidKey; // fall back to raw code + } +} + JNIEXPORT void JNICALL Java_com_mojang_minecraftpe_MainActivity_nativeOnKeyDown(JNIEnv* env, jclass cls, jint keyCode) { LOGI("@nativeOnKeyDown: %d\n", keyCode); - Keyboard::feed(keyCode, true); + + // @rewrite + + if (keyCode != AKEYCODE_1) { + int mapped = androidKeyToInternal(keyCode); + Keyboard::feed(mapped, true); + } +} +JNIEXPORT void JNICALL +Java_com_mojang_minecraftpe_MainActivity_nativeTextChar(JNIEnv* env, jclass cls, jint unicodeChar) { + LOGI("@nativeTextChar: %d '%c'", unicodeChar, (char)unicodeChar); + // soft-keyboards may send a backspace as a character code + // Kolyah35: i dont believe :v + /*if (unicodeChar == 8) { + Keyboard::feed(Keyboard::KEY_BACKSPACE, true); + Keyboard::feed(Keyboard::KEY_BACKSPACE, false); + } else*/ if (unicodeChar > 0 && unicodeChar < 128) { + Keyboard::feedText((char)unicodeChar); + } } JNIEXPORT void JNICALL Java_com_mojang_minecraftpe_MainActivity_nativeOnKeyUp(JNIEnv* env, jclass cls, jint keyCode) { LOGI("@nativeOnKeyUp: %d\n", (int)keyCode); - Keyboard::feed(keyCode, false); + int mapped = androidKeyToInternal(keyCode); + Keyboard::feed(mapped, false); } JNIEXPORT jboolean JNICALL diff --git a/src/main_android_java.h b/src/main_android_java.h index 3c33244..89f8bb0 100755 --- a/src/main_android_java.h +++ b/src/main_android_java.h @@ -23,7 +23,7 @@ #include "platform/input/Mouse.h" #include "platform/input/Controller.h" -#include "EGLConfigPrinter.h" +#include "EglConfigPrinter.h" const int BroadcastPort = 9991; diff --git a/src/main_dedicated.cpp b/src/main_dedicated.cpp index 2d6eb33..5e27cd3 100755 --- a/src/main_dedicated.cpp +++ b/src/main_dedicated.cpp @@ -1,16 +1,20 @@ +#include #include #include "NinecraftApp.h" #include "AppPlatform.h" #include #include #include +#ifdef __linux__ #include +#endif #include "world/level/LevelSettings.h" #include "world/level/Level.h" #include "server/ArgumentsSettings.h" #include "platform/time.h" #include "SharedConstants.h" +#include "world/level/LevelConstants.h" #define MAIN_CLASS NinecraftApp static App* g_app = 0; @@ -27,49 +31,214 @@ void signal_callback_handler(int signum) { } } -int main(int numArguments, char* pszArgs[]) { - ArgumentsSettings aSettings(numArguments, pszArgs); - if(aSettings.getShowHelp()) { - ArgumentsSettings defaultSettings(0, NULL); - printf("Minecraft Pockect Edition Server %s\n", Common::getGameVersionString("").c_str()); - printf("-------------------------------------------------------\n"); - printf("--cachepath - Path to where the server can store temp stuff (not sure if this is used) [default: \"%s\"]\n", defaultSettings.getCachePath().c_str()); - printf("--externalpath - The path to the place where the server should store the levels. [default: \"%s\"]\n", defaultSettings.getExternalPath().c_str()); - printf("--levelname - The name of the server [default: \"%s\"]\n", defaultSettings.getLevelName().c_str()); - printf("--leveldir - The name of the server [default: \"%s\"]\n", defaultSettings.getLevelDir().c_str()); - printf("--help - Shows this message.\n"); - printf("--port - The port to run the server on. [default: %d]\n", defaultSettings.getPort()); - printf("--serverkey - The key that the server should use for API calls. [default: \"%s\"]\n", defaultSettings.getServerKey().c_str()); - printf("-------------------------------------------------------\n"); - return 0; +std::string findStringInConfig(std::string line, std::string config) { + auto valuePos = config.find(line); + + if (line.empty()) { + throw std::runtime_error("Key cannot be empty"); + } + + if (valuePos == std::string::npos) { + throw std::runtime_error("Cannot find value"); + } + + std::string valueStr = ""; + + valuePos += 1 + line.size(); + + while (true) { + auto sym = config.at(valuePos); + + if (sym == '\n') { + break; + } + + if (valuePos == config.size()) { + throw std::runtime_error("Cannot find end of the line"); + } + + valueStr += sym; + valuePos++; + } + + return valueStr; +} + + +int main(int numArguments, char* pszArgs[]) { + std::ifstream serverProperties("server.properties"); + + int port = 0; + int gamemode = 0; + int worldSize = 0; + + std::string levelDir = ""; + std::string cachePath = ""; + std::string externalPath = ""; + std::string levelName = ""; + + if (serverProperties.is_open()) { + std::string propString; + std::string line; + + while (std::getline(serverProperties, line)) { + propString += line; + propString += "\n"; + } + + if (propString.empty()) { + throw std::runtime_error("Config cannot be empty"); + } + + port = std::stoi(findStringInConfig("port", propString)); + worldSize = std::stoi(findStringInConfig("world-size", propString)); + + if (worldSize < 16 || worldSize > 32) { + throw std::runtime_error("Incorrect world size."); + } + + LevelConstants::CHUNK_CACHE_WIDTH = worldSize; + LevelConstants::LEVEL_WIDTH = LevelConstants::CHUNK_CACHE_WIDTH * LevelConstants::CHUNK_WIDTH; + LevelConstants::LEVEL_DEPTH = LevelConstants::CHUNK_CACHE_WIDTH * LevelConstants::CHUNK_DEPTH; + + cachePath = findStringInConfig("level-cachepath", propString); + externalPath = findStringInConfig("level-externalpath", propString); + levelName = findStringInConfig("level-name", propString); + levelDir = findStringInConfig("level-dir", propString); + + std::string gamemodeStr = findStringInConfig("gamemode", propString); + + if (gamemodeStr == "survival") { + gamemode = GameType::Survival; + } else if (gamemodeStr == "creative") { + gamemode = GameType::Creative; + } else { + gamemode = GameType::Survival; + } + + printf("%d %s %s %d %d\n", port, cachePath.c_str(), externalPath.c_str(), gamemode, LevelConstants::CHUNK_CACHE_WIDTH); + } else { + std::ofstream defaultProperties("server.properties"); + + if (defaultProperties.is_open()) { + ArgumentsSettings defaultSettings(0, NULL); + + std::stringstream buffer; + + buffer << "// MCPE Server properties" << std::endl; + buffer << "port=" << defaultSettings.getPort() << std::endl; + buffer << "level-dir=" << defaultSettings.getLevelDir() << std::endl; + buffer << "level-cachepath=" << defaultSettings.getCachePath() << std::endl; + buffer << "level-externalpath=" << defaultSettings.getExternalPath() << std::endl; + buffer << "gamemode=survival" << std::endl; + buffer << "level-name=" << defaultSettings.getLevelName() << std::endl; + buffer << "world-size=16" << std::endl; + + defaultProperties << buffer.str(); + + printf("%s \n", buffer.str().c_str()); + + printf("Edit a config file first!\n"); + + defaultProperties.close(); + exit(0); + } else { + throw std::runtime_error("Cannot create default config."); + } } - printf("Level Name: %s\n", aSettings.getLevelName().c_str()); + + printf("Level Name: %s\n", levelName.c_str()); + AppContext appContext; appContext.platform = new AppPlatform(); App* app = new MAIN_CLASS(); signal(SIGINT, signal_callback_handler); g_app = app; - ((MAIN_CLASS*)g_app)->externalStoragePath = aSettings.getExternalPath(); - ((MAIN_CLASS*)g_app)->externalCacheStoragePath = aSettings.getCachePath(); + ((MAIN_CLASS*)g_app)->externalStoragePath = externalPath; + ((MAIN_CLASS*)g_app)->externalCacheStoragePath = cachePath; g_app->init(appContext); - LevelSettings settings(getEpochTimeS(), GameType::Creative); + LevelSettings settings(getEpochTimeS(), gamemode); float startTime = getTimeS(); - ((MAIN_CLASS*)g_app)->selectLevel(aSettings.getLevelDir(), aSettings.getLevelName(), settings); - ((MAIN_CLASS*)g_app)->hostMultiplayer(aSettings.getPort()); + ((MAIN_CLASS*)g_app)->selectLevel(levelDir, levelName, settings); + ((MAIN_CLASS*)g_app)->hostMultiplayer(port); + + // Reading ops + std::ifstream ops("ops.txt"); + + if (ops.is_open()) { + std::string line; + + while (std::getline(ops, line)) { + if (!line.empty()) { + ((MAIN_CLASS*)g_app)->level->ops.insert(line); + } + } + } else { + std::ofstream opsDefault("ops.txt"); + + if (!opsDefault.is_open()) { + throw std::runtime_error("Cannot create ops list."); + } + } + + // Reading banned ppl + std::ifstream banned("banned-players.txt"); + + if (banned.is_open()) { + std::string line; + + while (std::getline(banned, line)) { + if (!line.empty()) { + ((MAIN_CLASS*)g_app)->level->bannedPlayers.insert(line); + } + } + } else { + std::ofstream bannedPlayers("banned-players.txt"); + + if (!bannedPlayers.is_open()) { + throw std::runtime_error("Cannot create banned players list."); + } + } std::cout << "Level has been generated in " << getTimeS() - startTime << std::endl; ((MAIN_CLASS*)g_app)->level->saveLevelData(); std::cout << "Level has been saved!" << std::endl; + while(!app->wantToQuit()) { app->update(); //pthread_yield(); - sleep(20); + sleepMs(20); } + + std::ofstream opsWrite("ops.txt"); + + if (opsWrite.is_open()) { + for (auto& op : ((MAIN_CLASS*)g_app)->level->ops) { + opsWrite << op << std::endl; + } + opsWrite.close(); + } else { + throw std::runtime_error("Cannot open ops list."); + } + + std::ofstream bannedWrite("banned-players.txt"); + + if (bannedWrite.is_open()) { + for (auto& banned : ((MAIN_CLASS*)g_app)->level->bannedPlayers) { + bannedWrite << banned << std::endl; + } + bannedWrite.close(); + } else { + throw std::runtime_error("Cannot open banned players list."); + } + ((MAIN_CLASS*)g_app)->level->saveLevelData(); + delete app; appContext.platform->finish(); delete appContext.platform; + std::cout << "Quit correctly" << std::endl; return g_exitCode; } \ No newline at end of file diff --git a/src/main_glfw.h b/src/main_glfw.h index 25ea2c5..042c9fb 100755 --- a/src/main_glfw.h +++ b/src/main_glfw.h @@ -2,17 +2,20 @@ #define MAIN_GLFW_H__ #include "App.h" -#include "GLFW/glfw3.h" +#include "client/renderer/entity/PlayerRenderer.h" #include "client/renderer/gles.h" -#include "SharedConstants.h" +#include "GLFW/glfw3.h" #include +#include +#include #include "platform/input/Keyboard.h" #include "platform/input/Mouse.h" #include "platform/input/Multitouch.h" -#include "util/Mth.h" #include "AppPlatform_glfw.h" - +#ifdef __EMSCRIPTEN__ +#include +#endif static App* g_app = 0; int transformKey(int glfwkey) { @@ -22,9 +25,11 @@ int transformKey(int glfwkey) { switch (glfwkey) { case GLFW_KEY_ESCAPE: return Keyboard::KEY_ESCAPE; + case GLFW_KEY_TAB: return Keyboard::KEY_TAB; case GLFW_KEY_BACKSPACE: return Keyboard::KEY_BACKSPACE; case GLFW_KEY_LEFT_SHIFT: return Keyboard::KEY_LSHIFT; case GLFW_KEY_ENTER: return Keyboard::KEY_RETURN; + case GLFW_KEY_LEFT_CONTROL: return Keyboard::KEY_LEFT_CTRL; default: return glfwkey; } } @@ -32,6 +37,20 @@ int transformKey(int glfwkey) { void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods) { if(action == GLFW_REPEAT) return; + if (key == GLFW_KEY_F11 && action == GLFW_PRESS) { + GLFWmonitor* monitor = glfwGetWindowMonitor(window); + if (monitor) { + // Currently fullscreen → go windowed + glfwSetWindowMonitor(window, NULL, 80, 80, 854, 480, 0); + } else { + // Currently windowed → go fullscreen on primary monitor + GLFWmonitor* primary = glfwGetPrimaryMonitor(); + const GLFWvidmode* mode = glfwGetVideoMode(primary); + glfwSetWindowMonitor(window, primary, 0, 0, mode->width, mode->height, mode->refreshRate); + } + return; + } + Keyboard::feed(transformKey(key), action); } @@ -94,12 +113,41 @@ void error_callback(int error, const char* desc) { printf("Error: %s\n", desc); } + +void loop() { + using clock = std::chrono::steady_clock; + auto frameStart = clock::now(); + + g_app->update(); + + glfwSwapBuffers(((AppPlatform_glfw*)g_app->platform())->window); + glfwPollEvents(); + + glfwSwapInterval(((MAIN_CLASS*)g_app)->options.getBooleanValue(OPTIONS_VSYNC) ? 1 : 0); + if(((MAIN_CLASS*)g_app)->options.getBooleanValue(OPTIONS_LIMIT_FRAMERATE)) { + auto frameEnd = clock::now(); + auto elapsed = std::chrono::duration_cast(frameEnd - frameStart); + auto target = std::chrono::microseconds(33333); // ~30 fps + if(elapsed < target) + std::this_thread::sleep_for(target - elapsed); + } +} + int main(void) { AppContext appContext; #ifndef STANDALONE_SERVER // Platform init. appContext.platform = new AppPlatform_glfw(); +#if defined(__EMSCRIPTEN__) + EM_ASM( + FS.mkdir('/games'); + FS.mkdir('/games/com.mojang'); + FS.mkdir('/games/com.mojang/minecraftWorlds'); + FS.mount(IDBFS, {}, '/games'); + FS.syncfs(true, function (err) {}); + ); +#endif glfwSetErrorCallback(error_callback); @@ -108,26 +156,36 @@ int main(void) { } glfwWindowHint(GLFW_CONTEXT_CREATION_API, GLFW_NATIVE_CONTEXT_API); +#ifndef __EMSCRIPTEN__ glfwWindowHint(GLFW_CLIENT_API, GLFW_OPENGL_API); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 2); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 1); +#else + glfwWindowHint(GLFW_CLIENT_API, GLFW_OPENGL_ES_API); + glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 1); + glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0); +#endif - GLFWwindow* window = glfwCreateWindow(appContext.platform->getScreenWidth(), appContext.platform->getScreenHeight(), "main", NULL, NULL); + AppPlatform_glfw* platform = (AppPlatform_glfw*)appContext.platform; + + platform->window = glfwCreateWindow(appContext.platform->getScreenWidth(), appContext.platform->getScreenHeight(), "Minecraft PE 0.6.1", NULL, NULL); - if (window == NULL) { + if (platform->window == NULL) { return 1; } - glfwSetKeyCallback(window, key_callback); - glfwSetCharCallback(window, character_callback); - glfwSetCursorPosCallback(window, cursor_position_callback); - glfwSetMouseButtonCallback(window, mouse_button_callback); - glfwSetScrollCallback(window, scroll_callback); - glfwSetWindowSizeCallback(window, window_size_callback); + glfwSetKeyCallback(platform->window, key_callback); + glfwSetCharCallback(platform->window, character_callback); + glfwSetCursorPosCallback(platform->window, cursor_position_callback); + glfwSetMouseButtonCallback(platform->window, mouse_button_callback); + glfwSetScrollCallback(platform->window, scroll_callback); + glfwSetWindowSizeCallback(platform->window, window_size_callback); - glfwMakeContextCurrent(window); - gladLoadGLES1Loader((GLADloadproc)glfwGetProcAddress); - glfwSwapInterval(1); + glfwMakeContextCurrent(platform->window); + #ifndef __EMSCRIPTEN__ + gladLoadGLLoader((GLADloadproc)glfwGetProcAddress); + glfwSwapInterval(0); + #endif #endif App* app = new MAIN_CLASS(); @@ -138,25 +196,26 @@ int main(void) { g_app->init(appContext); g_app->setSize(appContext.platform->getScreenWidth(), appContext.platform->getScreenHeight()); +#ifdef __EMSCRIPTEN__ + emscripten_set_main_loop(loop, 0, 1); +#else // Main event loop - while(!glfwWindowShouldClose(window) && !app->wantToQuit()) { - app->update(); - - glfwSwapBuffers(window); - glfwPollEvents(); + while(!glfwWindowShouldClose(platform->window) && !app->wantToQuit()) { + loop(); } +#endif delete app; +#ifndef STANDALONE_SERVER + // Exit. + glfwDestroyWindow(platform->window); + glfwTerminate(); +#endif + appContext.platform->finish(); delete appContext.platform; - -#ifndef STANDALONE_SERVER - // Exit. - glfwDestroyWindow(window); - glfwTerminate(); -#endif return 0; } diff --git a/src/main_win32.h b/src/main_win32.h index 931ae64..69d0165 100755 --- a/src/main_win32.h +++ b/src/main_win32.h @@ -14,7 +14,7 @@ #include #include -#include +#include #include #include "SharedConstants.h" @@ -113,6 +113,14 @@ LRESULT WINAPI windowProc ( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam ) Multitouch::feed(0, 0, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), 0); break; } + case WM_MOUSEWHEEL: { + // wheel delta is multiples of WHEEL_DELTA (120); convert to +/-1 + int delta = GET_WHEEL_DELTA_WPARAM(wParam) / WHEEL_DELTA; + short x = GET_X_LPARAM(lParam); + short y = GET_Y_LPARAM(lParam); + Mouse::feed(MouseAction::ACTION_WHEEL, 0, x, y, 0, delta); + break; + } default: if (uMsg == WM_NCDESTROY) g_running = false; else { diff --git a/src/network/ClientSideNetworkHandler.cpp b/src/network/ClientSideNetworkHandler.cpp index a5bc1b0..e2b8150 100755 --- a/src/network/ClientSideNetworkHandler.cpp +++ b/src/network/ClientSideNetworkHandler.cpp @@ -1,5 +1,7 @@ #include "ClientSideNetworkHandler.h" +#include "client/Options.h" +#include "network/packet/LoginStatusPacket.h" #include "packet/PacketInclude.h" #include "RakNetInstance.h" #include "../world/level/chunk/ChunkSource.h" @@ -9,6 +11,9 @@ #include "../world/entity/player/Inventory.h" #include "../client/Minecraft.h" #include "../client/gamemode/GameMode.h" +#include "world/item/ItemInstance.h" +#include "world/level/LevelConstants.h" +#include #ifndef STANDALONE_SERVER #include "../client/gui/screens/DisconnectionScreen.h" #endif @@ -41,6 +46,9 @@ ClientSideNetworkHandler::ClientSideNetworkHandler(Minecraft* minecraft, IRakNet requestNextChunkPosition(0), requestNextChunkIndex(0) { + NumRequestChunks = LevelConstants::CHUNK_CACHE_WIDTH * LevelConstants::CHUNK_CACHE_WIDTH; + requestNextChunkIndexList.resize(NumRequestChunks); + chunksLoaded.resize(NumRequestChunks); rakPeer = raknetInstance->getPeer(); } @@ -58,7 +66,7 @@ void ClientSideNetworkHandler::requestNextChunk() //LOGI("requesting chunks @ (%d, %d)\n", chunk.x, chunk.y); - //raknetInstance->send(new RequestChunkPacket(requestNextChunkPosition % CHUNK_CACHE_WIDTH, requestNextChunkPosition / CHUNK_CACHE_WIDTH)); + //raknetInstance->send(new RequestChunkPacket(requestNextChunkPosition % LevelConstants::CHUNK_CACHE_WIDTH, requestNextChunkPosition / LevelConstants::CHUNK_CACHE_WIDTH)); requestNextChunkIndex++; requestNextChunkPosition++; } @@ -66,16 +74,16 @@ void ClientSideNetworkHandler::requestNextChunk() bool ClientSideNetworkHandler::areAllChunksLoaded() { - return (requestNextChunkPosition >= (CHUNK_CACHE_WIDTH * CHUNK_CACHE_WIDTH)); + return (requestNextChunkPosition >= (LevelConstants::CHUNK_CACHE_WIDTH * LevelConstants::CHUNK_CACHE_WIDTH)); } bool ClientSideNetworkHandler::isChunkLoaded(int x, int z) { - if (x < 0 || x >= CHUNK_CACHE_WIDTH || z < 0 || z >= CHUNK_CACHE_WIDTH) { + if (x < 0 || x >= LevelConstants::CHUNK_CACHE_WIDTH || z < 0 || z >= LevelConstants::CHUNK_CACHE_WIDTH) { LOGE("Error: Tried to request chunk (%d, %d)\n", x, z); return true; } - return chunksLoaded[x * CHUNK_CACHE_WIDTH + z]; + return chunksLoaded[x * LevelConstants::CHUNK_CACHE_WIDTH + z]; //return areAllChunksLoaded(); } @@ -85,7 +93,7 @@ void ClientSideNetworkHandler::onConnect(const RakNet::RakNetGUID& hostGuid) serverGuid = hostGuid; clearChunksLoaded(); - LoginPacket packet(minecraft->user->name.c_str(), SharedConstants::NetworkProtocolVersion); + LoginPacket packet(minecraft->options.getStringValue(OPTIONS_USERNAME).c_str(), SharedConstants::NetworkProtocolVersion, true); raknetInstance->send(packet); } @@ -96,6 +104,11 @@ void ClientSideNetworkHandler::onUnableToConnect() void ClientSideNetworkHandler::onDisconnect(const RakNet::RakNetGUID& guid) { + LevelConstants::CHUNK_CACHE_WIDTH = 16; + LevelConstants::LEVEL_WIDTH = LevelConstants::CHUNK_CACHE_WIDTH * LevelConstants::CHUNK_WIDTH; + LevelConstants::LEVEL_DEPTH = LevelConstants::CHUNK_CACHE_WIDTH * LevelConstants::CHUNK_DEPTH; + + // TODO: Good disconnecting LOGI("onDisconnect\n"); if (level) { @@ -108,9 +121,13 @@ void ClientSideNetworkHandler::onDisconnect(const RakNet::RakNetGUID& guid) } } } -#ifndef STANDALONE_SERVER - minecraft->gui.addMessage("Disconnected from server"); -#endif + minecraft->leaveGame(); +// minecraft->setLevel(NULL); +// #ifndef STANDALONE_SERVER +// minecraft->gui.addMessage("Disconnected from server"); +// // TODO: screen with error +// minecraft->screenChooser.setScreen(SCREEN_STARTMENU); +// #endif } void ClientSideNetworkHandler::handle(const RakNet::RakNetGUID& source, LoginStatusPacket* packet) { @@ -129,6 +146,18 @@ void ClientSideNetworkHandler::handle(const RakNet::RakNetGUID& source, LoginSta LOGI("Disconnect! Server is outdated!\n"); #ifndef STANDALONE_SERVER minecraft->setScreen(new DisconnectionScreen("Could not connect: Outdated server!")); +#endif + } + if (packet->status == LoginStatus::Failed_TakenNickname) { + LOGI("Disconnect! Nickname is taken!\n"); +#ifndef STANDALONE_SERVER + minecraft->setScreen(new DisconnectionScreen("Could not connect: Nickname is taken!")); +#endif + } + if (packet->status == LoginStatus::Failed_Banned) { + LOGI("Disconnect! You're banned from this server!\n"); +#ifndef STANDALONE_SERVER + minecraft->setScreen(new DisconnectionScreen("Could not connect: You're banned from this server!")); #endif } } @@ -145,6 +174,19 @@ void ClientSideNetworkHandler::handle(const RakNet::RakNetGUID& source, StartGam } #endif + // @todo @note i think its trash + // we can put it directly to selectLevel? + if (packet->chunkCacheWidth != 0) { + printf("lol \n"); + LevelConstants::CHUNK_CACHE_WIDTH = packet->chunkCacheWidth; + LevelConstants::LEVEL_WIDTH = LevelConstants::CHUNK_CACHE_WIDTH * LevelConstants::CHUNK_WIDTH; + LevelConstants::LEVEL_DEPTH = LevelConstants::CHUNK_CACHE_WIDTH * LevelConstants::CHUNK_DEPTH; + LevelChunk::ChunkBlockCount = LevelConstants::CHUNK_BLOCK_COUNT; + } + NumRequestChunks = LevelConstants::CHUNK_CACHE_WIDTH * LevelConstants::CHUNK_CACHE_WIDTH; + requestNextChunkIndexList.resize(NumRequestChunks); + chunksLoaded.resize(NumRequestChunks); + const std::string& levelId = LevelStorageSource::TempLevelId; LevelStorageSource* storageSource = minecraft->getLevelSource(); storageSource->deleteLevel(levelId); @@ -157,7 +199,7 @@ void ClientSideNetworkHandler::handle(const RakNet::RakNetGUID& source, StartGam level->isClientSide = true; bool isCreative = (packet->gameType == GameType::Creative); - LocalPlayer* player = new LocalPlayer(minecraft, level, minecraft->user, level->dimension->id, isCreative); + LocalPlayer* player = new LocalPlayer(minecraft, level, minecraft->options.getStringValue(OPTIONS_USERNAME), level->dimension->id, isCreative); player->owner = rakPeer->GetMyGUID(); player->entityId = packet->entityId; player->moveTo(packet->x, packet->y, packet->z, player->yRot, player->xRot); @@ -181,7 +223,7 @@ void ClientSideNetworkHandler::handle(const RakNet::RakNetGUID& source, SetTimeP if (!level) return; - LOGI("SetTimePacket\n"); + // LOGI("SetTimePacket\n"); level->setTime(packet->time); } @@ -237,7 +279,7 @@ void ClientSideNetworkHandler::handle( const RakNet::RakNetGUID& source, AddPain } void ClientSideNetworkHandler::handle(const RakNet::RakNetGUID& source, AddMobPacket* packet) { - LOGI("AddMobPacket (%p)\n", level); + // LOGI("AddMobPacket (%p)\n", level); if (!level) { LOGW("Trying to add a mob with no level!\n"); @@ -323,7 +365,7 @@ void ClientSideNetworkHandler::handle(const RakNet::RakNetGUID& source, RemoveEn if (!level) return; Entity* entity = level->getEntity(packet->entityId); - LOGI("RemoveEntityPacket %p %p, %d\n", entity, minecraft->player, entity?(int)(entity->isPlayer()): -1); + // LOGI("RemoveEntityPacket %p %p, %d\n", entity, minecraft->player, entity?(int)(entity->isPlayer()): -1); if (!entity) return; level->removeEntity(entity); @@ -343,6 +385,7 @@ void ClientSideNetworkHandler::handle(const RakNet::RakNetGUID& source, AddItemE } void ClientSideNetworkHandler::handle(const RakNet::RakNetGUID& source, TakeItemEntityPacket* packet) { + // printf("TakeItemEntityPacket \n"); if (!level) return; Entity* e = level->getEntity(packet->itemId); @@ -385,6 +428,54 @@ void ClientSideNetworkHandler::handle(const RakNet::RakNetGUID& source, MovePlay } } +void ClientSideNetworkHandler::handle(const RakNet::RakNetGUID& source, SendInventoryPacket* packet) { + if (!level) return; + + if (packet->entityId == minecraft->player->entityId) { + auto items = packet->items; + + minecraft->player->inventory->replace(items); + + for (int i = 0; i < packet->linkedSlot.size(); i++) { + minecraft->player->inventory->linkSlot(i, packet->linkedSlot[i].inventorySlot, true); + LOGI("%i -> %i\n", packet->linkedSlot[i].inventorySlot, i); + } + } +} + +void ClientSideNetworkHandler::handle(const RakNet::RakNetGUID& source, TakeItemPacket* packet) { + if (!level) return; + + LOGI("TakeItemPacket\n"); + + ItemInstance* item = new ItemInstance(); + + item->count = packet->count; + item->id = packet->itemId; + item->setAuxValue(packet->auxValue); + + // if (minecraft->player->entityId == packet->playerId) { + if (!minecraft->player->inventory->add(item)) { + minecraft->player->drop(new ItemInstance(*item), false); + } + // } +} + +void ClientSideNetworkHandler::handle(const RakNet::RakNetGUID& source, RemoveItemPacket* packet) { + // Idk how it works... + if (!level) return; + + ItemInstance item; + + item.count = packet->count; + item.id = packet->itemId; + item.setAuxValue(packet->auxValue); + + // if (minecraft->player->entityId == packet->playerId) { + minecraft->player->inventory->removeResource(item); + // } +} + void ClientSideNetworkHandler::handle(const RakNet::RakNetGUID& source, MoveEntityPacket* packet) { if (!level) @@ -474,19 +565,19 @@ void ClientSideNetworkHandler::handle(const RakNet::RakNetGUID& source, ChunkDat //unsigned char* blockIds = chunk->getBlockData(); DataLayer& blockData = chunk->data; - const int setSize = LEVEL_HEIGHT / 8; - const int setShift = 4; // power of LEVEL_HEIGHT / 8 + const int setSize = LevelConstants::LEVEL_HEIGHT / 8; + const int setShift = 4; // power of LevelConstants::LEVEL_HEIGHT / 8 bool recalcHeight = false; - int x0 = 16, x1 = 0, z0 = 16, z1 = 0, y0 = LEVEL_HEIGHT, y1 = 0; + int x0 = 16, x1 = 0, z0 = 16, z1 = 0, y0 = LevelConstants::LEVEL_HEIGHT, y1 = 0; int rx = packet->x << 4; int rz = packet->z << 4; - unsigned char readBlockBuffer[setSize]; - unsigned char readDataBuffer[setSize / 2]; + unsigned char* readBlockBuffer = new unsigned char[setSize]; + unsigned char* readDataBuffer = new unsigned char[setSize / 2]; - for (int i = 0; i < CHUNK_COLUMNS; i++) + for (int i = 0; i < LevelConstants::CHUNK_COLUMNS; i++) { unsigned char updateBits = 0; packet->chunkData.Read(updateBits); @@ -495,8 +586,8 @@ void ClientSideNetworkHandler::handle(const RakNet::RakNetGUID& source, ChunkDat { recalcHeight = true; - int colX = (i % CHUNK_WIDTH); - int colZ = (i / CHUNK_WIDTH); + int colX = (i % LevelConstants::CHUNK_WIDTH); + int colZ = (i / LevelConstants::CHUNK_WIDTH); int colDataPosition = colX << 11 | colZ << 7; for (int set = 0; set < 8; set++) @@ -530,30 +621,33 @@ void ClientSideNetworkHandler::handle(const RakNet::RakNetGUID& source, ChunkDat { y0 = ((1 << set) << setShift); } - if (((1 << set) << setShift) + (LEVEL_HEIGHT / 8) - 1 > y1) + if (((1 << set) << setShift) + (LevelConstants::LEVEL_HEIGHT / 8) - 1 > y1) { - y1 = ((1 << set) << setShift) + (LEVEL_HEIGHT / 8) - 1; + y1 = ((1 << set) << setShift) + (LevelConstants::LEVEL_HEIGHT / 8) - 1; } } - if ((i % CHUNK_WIDTH) < x0) + if ((i % LevelConstants::CHUNK_WIDTH) < x0) { - x0 = (i % CHUNK_WIDTH); + x0 = (i % LevelConstants::CHUNK_WIDTH); } - if ((i % CHUNK_WIDTH) > x1) + if ((i % LevelConstants::CHUNK_WIDTH) > x1) { - x1 = (i % CHUNK_WIDTH); + x1 = (i % LevelConstants::CHUNK_WIDTH); } - if ((i / CHUNK_WIDTH) < z0) + if ((i / LevelConstants::CHUNK_WIDTH) < z0) { - z0 = (i / CHUNK_WIDTH); + z0 = (i / LevelConstants::CHUNK_WIDTH); } - if ((i / CHUNK_WIDTH) > z1) + if ((i / LevelConstants::CHUNK_WIDTH) > z1) { - z1 = (i / CHUNK_WIDTH); + z1 = (i / LevelConstants::CHUNK_WIDTH); } } } + delete[] readBlockBuffer; + delete[] readDataBuffer; + if (recalcHeight) { // chunk->recalcHeightmap(); @@ -578,7 +672,7 @@ void ClientSideNetworkHandler::handle(const RakNet::RakNetGUID& source, ChunkDat //chunk->terrainPopulated = true; chunk->unsaved = false; - chunksLoaded[packet->x * CHUNK_CACHE_WIDTH + packet->z] = true; + chunksLoaded[packet->x * LevelConstants::CHUNK_CACHE_WIDTH + packet->z] = true; if (areAllChunksLoaded()) { @@ -626,18 +720,18 @@ void ClientSideNetworkHandler::arrangeRequestChunkOrder() { clearChunksLoaded(); // Default sort is around center of the world - int cx = CHUNK_CACHE_WIDTH / 2; - int cz = CHUNK_CACHE_WIDTH / 2; + int cx = LevelConstants::CHUNK_CACHE_WIDTH / 2; + int cz = LevelConstants::CHUNK_CACHE_WIDTH / 2; // If player exists, let's sort around him Player* p = minecraft? minecraft->player : NULL; if (p) { - cx = Mth::floor(p->x / (float)CHUNK_WIDTH); - cz = Mth::floor(p->z / (float)CHUNK_DEPTH); + cx = Mth::floor(p->x / (float)LevelConstants::CHUNK_WIDTH); + cz = Mth::floor(p->z / (float)LevelConstants::CHUNK_DEPTH); } _ChunkSorter sorter(cx, cz); - std::sort(requestNextChunkIndexList, requestNextChunkIndexList + NumRequestChunks, sorter); + std::sort(requestNextChunkIndexList.begin(), requestNextChunkIndexList.end(), sorter); } void ClientSideNetworkHandler::levelGenerated(Level* level) @@ -727,7 +821,7 @@ void ClientSideNetworkHandler::handle(const RakNet::RakNetGUID& source, SetEntit if (!level) return; - LOGI("SetEntityDataPacket\n"); + // LOGI("SetEntityDataPacket\n"); Entity* e = level->getEntity(packet->id); if (e) { @@ -781,6 +875,10 @@ void ClientSideNetworkHandler::handle(const RakNet::RakNetGUID& source, AnimateP } } +void ClientSideNetworkHandler::handle(const RakNet::RakNetGUID& source, WantCreatePacket* packet) +{ +} + void ClientSideNetworkHandler::handle(const RakNet::RakNetGUID& source, UseItemPacket* packet) { } @@ -790,6 +888,7 @@ void ClientSideNetworkHandler::handle(const RakNet::RakNetGUID& source, SetHealt if (!level || !minecraft->player) return; + printf("SetHealthPacket \n"); minecraft->player->hurtTo(packet->health); } @@ -885,7 +984,11 @@ void ClientSideNetworkHandler::handle(const RakNet::RakNetGUID& source, Containe void ClientSideNetworkHandler::handle( const RakNet::RakNetGUID& source, ChatPacket* packet ) { #ifndef STANDALONE_SERVER - minecraft->gui.displayClientMessage(packet->message); + // minecraft->gui.displayClientMessage(packet->message); + std::istringstream iss(packet->message); + for (std::string line; std::getline(iss, line); ) { + minecraft->gui.addMessage(line); + } #endif } @@ -918,8 +1021,8 @@ void ClientSideNetworkHandler::clearChunksLoaded() { // Init the chunk positions for (int i = 0; i < NumRequestChunks; ++i) { - requestNextChunkIndexList[i].x = i/CHUNK_WIDTH; - requestNextChunkIndexList[i].y = i%CHUNK_WIDTH; + requestNextChunkIndexList[i].x = i / LevelConstants::CHUNK_WIDTH; + requestNextChunkIndexList[i].y = i % LevelConstants::CHUNK_WIDTH; chunksLoaded[i] = false; } } diff --git a/src/network/ClientSideNetworkHandler.h b/src/network/ClientSideNetworkHandler.h index 1505ec7..57e0d81 100755 --- a/src/network/ClientSideNetworkHandler.h +++ b/src/network/ClientSideNetworkHandler.h @@ -77,6 +77,11 @@ public: virtual void handle(const RakNet::RakNetGUID& source, ChatPacket* packet); virtual void handle(const RakNet::RakNetGUID& source, AdventureSettingsPacket* packet); virtual void handle(const RakNet::RakNetGUID& source, SignUpdatePacket* packet); + virtual void handle(const RakNet::RakNetGUID& source, RemoveItemPacket* packet); + virtual void handle(const RakNet::RakNetGUID& source, TakeItemPacket* packet); + virtual void handle(const RakNet::RakNetGUID& source, WantCreatePacket* packet); + virtual void handle(const RakNet::RakNetGUID& source, SendInventoryPacket* packet); + private: void requestNextChunk(); @@ -97,11 +102,11 @@ private: BlockUpdateList bufferedBlockUpdates; int requestNextChunkPosition; - static const int NumRequestChunks = CHUNK_CACHE_WIDTH * CHUNK_CACHE_WIDTH; + int NumRequestChunks; int requestNextChunkIndex; - IntPair requestNextChunkIndexList[NumRequestChunks]; - bool chunksLoaded[NumRequestChunks]; + std::vector requestNextChunkIndexList; + std::vector chunksLoaded; }; #endif diff --git a/src/network/NATPunchHandler.cpp b/src/network/NATPunchHandler.cpp deleted file mode 100755 index 35108b0..0000000 --- a/src/network/NATPunchHandler.cpp +++ /dev/null @@ -1,33 +0,0 @@ -#include "NATPunchHandler.h" -#include "../raknet/TCPInterface.h" -#include "../raknet/HTTPConnection.h" -#include "PHPDirectoryServer2.h" - -using namespace RakNet; -NATPuchHandler::NATPuchHandler() { - tcpInterface = new TCPInterface; -} -NATPuchHandler::~NATPuchHandler() { - delete tcpInterface; -} - -void NATPuchHandler::initialize() { - tcpInterface->Start(0, 64); -} - -void NATPuchHandler::registerToGameList(const RakNet::RakString& serverName, int port) { - HTTPConnection httpConnection; - httpConnection.Init(tcpInterface, "johanbernhardsson.se"); - PHPDirectoryServer2 directoryServer; - directoryServer.Init(&httpConnection, "/DirectoryServer.php"); - directoryServer.UploadTable("", serverName, port, true); -} - -void NATPuchHandler::removeFromGameList() { - -} - -void NATPuchHandler::close() { - -} - diff --git a/src/network/NATPunchHandler.h b/src/network/NATPunchHandler.h deleted file mode 100755 index 0246c0d..0000000 --- a/src/network/NATPunchHandler.h +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef _MINECRAFT_NETWORK_NATPUNCHHANDLER_H_ -#define _MINECRAFT_NETWORK_NATPUNCHHANDLER_H_ -#include "../raknet/TCPInterface.h" -#include "../raknet/RakString.h" -class NATPuchHandler { -public: - enum NATPuchHandlerStatus { - NATPuchInitilized = 0, - NATPuchFetchingServerList = 1, - NATPuchConnecting = 2, - NATPuchConnected = 3, - NATPuchDissconnected = 4 - }; - NATPuchHandler(); - ~NATPuchHandler(); - void initialize(); - void registerToGameList(const RakNet::RakString& serverName, int port); - void removeFromGameList(); - void close(); -private: - RakNet::TCPInterface *tcpInterface; -}; - -#endif /* _MINECRAFT_NETWORK_NATPUNCHHANDLER_H_ */ diff --git a/src/network/NetEventCallback.h b/src/network/NetEventCallback.h index 53e5fa4..db3e22b 100755 --- a/src/network/NetEventCallback.h +++ b/src/network/NetEventCallback.h @@ -18,6 +18,8 @@ class RemovePlayerPacket; class RemoveEntityPacket; class MoveEntityPacket; //class TeleportEntityPacket; +class RemoveItemPacket; +class TakeItemPacket; class MovePlayerPacket; class PlaceBlockPacket; class RemoveBlockPacket; @@ -48,6 +50,7 @@ class ContainerClosePacket; class ContainerSetSlotPacket; class ContainerSetDataPacket; class ContainerSetContentPacket; +class WantCreatePacket; class ChatPacket; class SignUpdatePacket; class Minecraft; @@ -119,6 +122,9 @@ public: virtual void handle(const RakNet::RakNetGUID& source, SignUpdatePacket* packet) {} virtual void handle(const RakNet::RakNetGUID& source, AdventureSettingsPacket* packet) {} virtual void handle(const RakNet::RakNetGUID& source, AnimatePacket* packet) {} + virtual void handle(const RakNet::RakNetGUID& source, RemoveItemPacket* packet) {} + virtual void handle(const RakNet::RakNetGUID& source, TakeItemPacket* packet) {} + virtual void handle(const RakNet::RakNetGUID& source, WantCreatePacket* packet) {} // // Common implementation for Client and Server diff --git a/src/network/Packet.cpp b/src/network/Packet.cpp index ca1b328..d060356 100755 --- a/src/network/Packet.cpp +++ b/src/network/Packet.cpp @@ -2,6 +2,7 @@ #include "Packet.h" #include "../world/level/chunk/LevelChunk.h" +#include "network/packet/TakeItemPacket.h" #include "packet/PacketInclude.h" Packet::Packet() @@ -41,10 +42,16 @@ Packet* MinecraftPackets::createPacket(int id) case PACKET_ADDITEMENTITY: packet = new AddItemEntityPacket(); break; + case PACKET_REMOVEITEM: + packet = new RemoveItemPacket(); + break; + case PACKET_TAKEITEM: + packet = new TakeItemPacket(); + break; case PACKET_TAKEITEMENTITY: packet = new TakeItemEntityPacket(); break; - case PACKET_ADDMOB: + case PACKET_ADDMOB: packet = new AddMobPacket(); break; case PACKET_ADDPLAYER: @@ -68,6 +75,9 @@ Packet* MinecraftPackets::createPacket(int id) case PACKET_RESPAWN: packet = new RespawnPacket(); break; + case PACKET_WANTCREATEITEM: + packet = new WantCreatePacket(); + break; case PACKET_REMOVEENTITY: packet = new RemoveEntityPacket(); break; diff --git a/src/network/Packet.h b/src/network/Packet.h index e872219..3525bd4 100755 --- a/src/network/Packet.h +++ b/src/network/Packet.h @@ -33,7 +33,10 @@ enum MinecraftPacketIds PACKET_REMOVEENTITY, PACKET_ADDITEMENTITY, PACKET_TAKEITEMENTITY, - + PACKET_TAKEITEM, + PACKET_REMOVEITEM, + PACKET_WANTCREATEITEM, + PACKET_MOVEENTITY, PACKET_MOVEENTITY_POS, PACKET_MOVEENTITY_ROT, diff --git a/src/network/RakNetInstance.cpp b/src/network/RakNetInstance.cpp index 75a2814..d5e3ad0 100755 --- a/src/network/RakNetInstance.cpp +++ b/src/network/RakNetInstance.cpp @@ -200,7 +200,7 @@ void RakNetInstance::runEvents(NetEventCallback* callback) case ID_DISCONNECTION_NOTIFICATION: case ID_CONNECTION_LOST: callback->onDisconnect(currentEvent->guid); - break; + return; case ID_UNCONNECTED_PONG: { RakNet::TimeMS time; diff --git a/src/network/ServerSideNetworkHandler.cpp b/src/network/ServerSideNetworkHandler.cpp index 986fdc9..7863e37 100755 --- a/src/network/ServerSideNetworkHandler.cpp +++ b/src/network/ServerSideNetworkHandler.cpp @@ -5,6 +5,16 @@ #include "../world/entity/player/Inventory.h" #include "../world/Container.h" #include "../world/inventory/BaseContainerMenu.h" +#include "network/packet/ChatPacket.h" +#include "network/packet/ContainerSetSlotPacket.h" +#include "network/packet/LoginStatusPacket.h" +#include "network/packet/MovePlayerPacket.h" +#include "network/packet/RemoveBlockPacket.h" +#include "network/packet/SendInventoryPacket.h" +#include "network/packet/UpdateBlockPacket.h" +#include "network/packet/RemoveItemPacket.h" +#include "network/packet/TakeItemPacket.h" +#include "network/packet/WantCreatePacket.h" #include "packet/PacketInclude.h" #include "RakNetInstance.h" @@ -13,6 +23,17 @@ #include "../client/gamemode/GameMode.h" #include "../raknet/RakPeerInterface.h" #include "../raknet/PacketPriority.h" +#include "platform/log.h" +#include "util/Mth.h" +#include "util/StringUtils.h" +#include "world/item/ItemInstance.h" +#include "world/level/LevelConstants.h" +#include "world/level/storage/LevelStorage.h" +#include "world/phys/Vec3.h" +#include "world/item/crafting/Recipe.h" +#include "world/item/crafting/Recipes.h" +#include +#include #ifndef STANDALONE_SERVER #include "../client/sound/SoundEngine.h" #endif @@ -53,11 +74,11 @@ void ServerSideNetworkHandler::tileChanged(int x, int y, int z) Packet* ServerSideNetworkHandler::getAddPacketFromEntity( Entity* entity ) { if (entity->isMob() && !entity->isPlayer()) { //@fix: This code is duplicated. See if it can be unified. - if (minecraft->player) { + // if (minecraft->player) { // I guess this should always be true, but it crashed somewhere in this // function once and I only see this one as a potential problem return new AddMobPacket((Mob*)entity); - } + // } } else if (entity->isPlayer()) { @@ -134,6 +155,39 @@ void ServerSideNetworkHandler::displayGameMessage(const std::string& message) raknetInstance->send(packet); } +void ServerSideNetworkHandler::handle(const RakNet::RakNetGUID& source, MessagePacket* packet) +{ + auto player = getPlayer(source); + + if (player == nullptr) return; // @todo maybe kick? + std::string msg = packet->message.C_String(); + + if (msg[0] == '/') { + // This is a command + + ChatPacket resp(minecraft->commandManager().execute(*minecraft, *player, Util::stringTrim(msg.substr(1)))); + return sendPrivate(resp, source); + } + + displayGameMessage("<" + player->name + "> " + msg); +} + +void ServerSideNetworkHandler::handle(const RakNet::RakNetGUID& source, ChatPacket* packet) +{ + auto player = getPlayer(source); + + if (player == nullptr) return; // @todo maybe kick? + + if (packet->message[0] == '/') { + // This is a command + + ChatPacket resp(minecraft->commandManager().execute(*minecraft, *player, Util::stringTrim(packet->message.substr(1)))); + return sendPrivate(resp, source); + } + + displayGameMessage("<" + player->name + "> " + packet->message); +} + void ServerSideNetworkHandler::onNewClient(const RakNet::RakNetGUID& clientGuid) { LOGI("onNewClient, client guid: %s\n", clientGuid.ToString()); @@ -151,6 +205,8 @@ void ServerSideNetworkHandler::onDisconnect(const RakNet::RakNetGUID& guid) if (player->owner == guid) { + minecraft->level->getLevelStorage()->savePlayer(*player); + std::string message = player->name; message += " disconnected from the game"; displayGameMessage(message); @@ -174,15 +230,39 @@ void ServerSideNetworkHandler::handle(const RakNet::RakNetGUID& source, LoginPac if (!_allowIncoming) return; LOGI("LoginPacket\n"); - + int loginStatus = LoginStatus::Success; // // Bad/incompatible client version // bool oldClient = packet->clientNetworkVersion < SharedConstants::NetworkProtocolLowestSupportedVersion; bool oldServer = packet->clientNetworkLowestSupportedVersion > SharedConstants::NetworkProtocolVersion; - if (oldClient || oldServer) - loginStatus = oldClient? LoginStatus::Failed_ClientOld : LoginStatus::Failed_ServerOld; + if (oldClient || oldServer || !packet->newProto) + loginStatus = oldClient || !packet->newProto? LoginStatus::Failed_ClientOld : LoginStatus::Failed_ServerOld; + + std::string nicknameLower = packet->clientName.C_String(); + std::transform(nicknameLower.begin(), nicknameLower.end(), nicknameLower.begin(), ::tolower); + + printf("%s lower \n", nicknameLower.c_str()); + for (int i = 0; i < level->players.size(); i++) { + ServerPlayer* player = (ServerPlayer*) level->players.at(i); + + std::string clientLower = player->name; + std::transform(clientLower.begin(), clientLower.end(), clientLower.begin(), ::tolower); + + // @todo to lower case + if (nicknameLower == clientLower) { + loginStatus = packet->newProto ? LoginStatus::Failed_TakenNickname : LoginStatus::Failed_ClientOld; + break; + } + } + + for (auto& banned : level->bannedPlayers) { + if (nicknameLower == banned) { + loginStatus = packet->newProto ? LoginStatus::Failed_Banned : LoginStatus::Failed_ClientOld; + break; + } + } RakNet::BitStream bitStream; LoginStatusPacket(loginStatus).write(&bitStream); @@ -194,13 +274,16 @@ void ServerSideNetworkHandler::handle(const RakNet::RakNetGUID& source, LoginPac // // Valid client version // - Player* newPlayer = new ServerPlayer(minecraft, level); - + + Player* newPlayer = new ServerPlayer(minecraft, level, packet->newProto); + minecraft->gameMode->initAbilities(newPlayer->abilities); newPlayer->owner = source; newPlayer->name = packet->clientName.C_String(); _pendingPlayers.push_back(newPlayer); + LOGI("Adding new player... isCreative: %i\n", minecraft->isCreativeMode()); + // Reset the player so he doesn't spawn inside blocks while (newPlayer->y > 0) { newPlayer->setPos(newPlayer->x, newPlayer->y, newPlayer->z); @@ -223,7 +306,8 @@ void ServerSideNetworkHandler::handle(const RakNet::RakNetGUID& source, LoginPac level->getLevelData()->getGeneratorVersion(), gameType, newPlayer->entityId, - newPlayer->x, newPlayer->y - newPlayer->heightOffset, newPlayer->z + newPlayer->x, newPlayer->y - newPlayer->heightOffset, newPlayer->z, + LevelConstants::CHUNK_CACHE_WIDTH ).write(&bitStream); rakPeer->Send(&bitStream, HIGH_PRIORITY, RELIABLE_ORDERED, 0, source, false); @@ -239,6 +323,8 @@ void ServerSideNetworkHandler::handle(const RakNet::RakNetGUID& source, ReadyPac if (packet->type == ReadyPacket::READY_REQUESTEDCHUNKS) onReady_RequestedChunks(source); + + LOGI("Ready player two ready ready player two!!\n "); } void ServerSideNetworkHandler::onReady_ClientGeneration(const RakNet::RakNetGUID& source) @@ -256,6 +342,11 @@ void ServerSideNetworkHandler::onReady_ClientGeneration(const RakNet::RakNetGUID SetTimePacket(level->getTime()).write(&bitStream); rakPeer->Send(&bitStream, HIGH_PRIORITY, RELIABLE_ORDERED, 0, source, false); + // send adventure settings (includes showNameTags, etc.) + bitStream.Reset(); + AdventureSettingsPacket(level->adventureSettings).write(&bitStream); + rakPeer->Send(&bitStream, HIGH_PRIORITY, RELIABLE_ORDERED, 0, source, false); + // send all pre-existing players to the new player const PlayerList& players = level->players; for (unsigned int i = 0; i < players.size(); i++) { @@ -291,6 +382,36 @@ void ServerSideNetworkHandler::onReady_ClientGeneration(const RakNet::RakNetGUID } } + if (!minecraft->level->getLevelStorage()->loadPlayer(*newPlayer)) { + LOGW("Failed to load %s data\n", newPlayer->name.c_str()); + } + + // Credits to EpikIzCool + bitStream.Reset(); + MovePlayerPacket mv(newPlayer->entityId, newPlayer->x, newPlayer->y - newPlayer->heightOffset, + newPlayer->z, newPlayer->xRot, newPlayer->yRot); + mv.write(&bitStream); + + rakPeer->Send(&bitStream, HIGH_PRIORITY, RELIABLE_ORDERED, 0, source, false); + + bitStream.Reset(); + SetHealthPacket hp(newPlayer->health); + hp.write(&bitStream); + + rakPeer->Send(&bitStream, HIGH_PRIORITY, RELIABLE_ORDERED, 0, source, false); + + if (newPlayer->hasRespawnPosition()) { + bitStream.Reset(); + SetSpawnPositionPacket sp(newPlayer->getRespawnPosition()); + sp.write(&bitStream); + rakPeer->Send(&bitStream, HIGH_PRIORITY, RELIABLE_ORDERED, 0, source, false); + } + + bitStream.Reset(); + SendInventoryPacket(newPlayer, false).write(&bitStream); + rakPeer->Send(&bitStream, HIGH_PRIORITY, RELIABLE_ORDERED, 0, source, false); + + // Additional packets // * set spawn /* @@ -328,15 +449,32 @@ void ServerSideNetworkHandler::onReady_RequestedChunks(const RakNet::RakNetGUID& void ServerSideNetworkHandler::handle(const RakNet::RakNetGUID& source, MovePlayerPacket* packet) { if (!level) return; + + // LOGI("MovePlayerPacket\n"); + if (Entity* entity = level->getEntity(packet->entityId)) { + ServerPlayer* player = (ServerPlayer*) getPlayer(source); - //LOGI("MovePlayerPacket\n"); - if (Entity* entity = level->getEntity(packet->entityId)) - { - entity->xd = entity->yd = entity->zd = 0; + // int timeElapsed = minecraft->getTicks() - player->getLastMoveTicks(); + + // if (timeElapsed > 0) { + // float dist = player->distanceTo(packet->x, player->y, packet->z); + // float speed = dist / (minecraft->getTicks() - player->getLastMoveTicks()); + // player->setLastMoveTicks(minecraft->getTicks()); + + // float maxSpeed = (minecraft->isCreativeMode()) ? 1.65f : 1.f; + + // if (speed > maxSpeed) { + // MovePlayerPacket refuse(player->entityId, player->x, player->y, player->z, player->xRot, player->yRot); + // return raknetInstance->send(refuse); + // } + // } + + entity->xd = entity->yd = entity->zd = 0; entity->lerpTo(packet->x, packet->y, packet->z, packet->yRot, packet->xRot, 3); - + // broadcast this packet to other clients redistributePacket(packet, source); + } } @@ -358,12 +496,29 @@ void ServerSideNetworkHandler::handle(const RakNet::RakNetGUID& source, RemoveBl if (oldTile != NULL && changed) { level->playSound(x + 0.5f, y + 0.5f, z + 0.5f, oldTile->soundType->getBreakSound(), (oldTile->soundType->getVolume() + 1) / 2, oldTile->soundType->getPitch() * 0.8f); - if (minecraft->gameMode->isSurvivalType() && player->canDestroy(oldTile)) - //oldTile->spawnResources(level, x, y, z, data, 1); //@todo + if (minecraft->gameMode->isSurvivalType() && player->canDestroy(oldTile)) { + // From SurvivalMode.cpp + // Why tf i have to copy this shit from SurvivalMode class + // Why SurvivalMode class locked to LOCAL MINECRAFT PLAYER :sob: :sob: :sob: :sob: :sob: :sob: :sob: :sob: + // @fix @warn @ahtung @alert + ItemInstance* item = player->inventory->getSelected(); + if (item != NULL) { + item->mineBlock(oldTile->id, x, y, z); + if (item->count == 0) { + //item->snap(minecraft->player); + player->inventory->clearSlot(player->inventory->selected); + } + } + + // oldTile->spawnResources(level, x, y, z, data, 1); //@todo oldTile->playerDestroy(level, player, x, y, z, data); + } + oldTile->destroy(level, x, y, z, data); } + + LOGI("Remove block [%i, %i, %i]\n", packet->x, packet->y, packet->z); } void ServerSideNetworkHandler::handle(const RakNet::RakNetGUID& source, RequestChunkPacket* packet) @@ -393,6 +548,8 @@ void ServerSideNetworkHandler::handle(const RakNet::RakNetGUID& source, RequestC raknetInstance->send(source, p); } } + + // LOGI("Requested chunk [%i, %i]\n", packet->x, packet->z); } void ServerSideNetworkHandler::levelGenerated( Level* level ) @@ -405,7 +562,7 @@ void ServerSideNetworkHandler::levelGenerated( Level* level ) level->addListener(this); #ifndef STANDALONE_SERVER - allowIncomingConnections(minecraft->options.serverVisible); + allowIncomingConnections(minecraft->options.getBooleanValue(OPTIONS_SERVER_VISIBLE)); #else allowIncomingConnections(true); #endif @@ -419,23 +576,31 @@ void ServerSideNetworkHandler::handle(const RakNet::RakNetGUID& source, PlayerEq if (!player) return; if (rakPeer->GetMyGUID() == player->owner) return; + LOGI("Equip item: id %i aux %i\n", packet->itemId, packet->itemAuxValue); + // override the player's inventory - //int slot = player->inventory->getSlot(packet->itemId, packet->itemAuxValue); - int slot = Inventory::MAX_SELECTION_SIZE; - if (slot >= 0) { - if (packet->itemId == 0) { - player->inventory->clearSlot(slot); - } else { - // @note: 128 is an ugly hack for depletable items. - // @todo: fix - ItemInstance newItem(packet->itemId, 128, packet->itemAuxValue); - player->inventory->replaceSlot(slot, &newItem); - } - player->inventory->moveToSelectedSlot(slot, true); - redistributePacket(packet, source); - } else { - LOGW("Warning: Remote player doesn't have his thing, Odd!\n"); + int slot = player->inventory->getSlot(packet->itemId, packet->itemAuxValue); + + if (slot >= 0 && slot != packet->inventorySlot && packet->itemId != 0) { + LOGW("PlayerEquipmentPacket: Item in player inventory but slots doesn't match!"); + packet->inventorySlot = slot; } + + if (slot < 0 && packet->itemId != 0) { + LOGW("PlayerEquipmentPacket: Remote player doesn't have his thing (or crafted it)!\n"); + + SendInventoryPacket newInventory (player, false); + raknetInstance->send(newInventory); + + return; + } + + player->inventory->selectSlot(packet->selectedSlot); + player->inventory->linkSlot(packet->selectedSlot, packet->inventorySlot, true); + + player->inventory->print(); + + redistributePacket(packet, source); } void ServerSideNetworkHandler::handle(const RakNet::RakNetGUID& source, PlayerArmorEquipmentPacket* packet) { @@ -445,6 +610,8 @@ void ServerSideNetworkHandler::handle(const RakNet::RakNetGUID& source, PlayerAr if (!player) return; if (rakPeer->GetMyGUID() == player->owner) return; + // LOGI("Equip armor: %i %i %i %i\n", packet->head, packet->torso, packet->legs, packet->feet); + packet->fillIn(player); redistributePacket(packet, source); } @@ -456,6 +623,8 @@ void ServerSideNetworkHandler::handle(const RakNet::RakNetGUID& source, Interact Entity* entity = level->getEntity(packet->targetId); if (src && entity && src->isPlayer()) { + LOGI("Interact: source %i target %i\n", packet->sourceId, packet->targetId); + Player* player = (Player*) src; if (InteractPacket::Attack == packet->action) { player->swing(); @@ -496,14 +665,75 @@ void ServerSideNetworkHandler::handle(const RakNet::RakNetGUID& source, AnimateP } redistributePacket(packet, source); } +void ServerSideNetworkHandler::handle(const RakNet::RakNetGUID& source, WantCreatePacket* packet) { + LOGI("WantCreatePacket\n"); + Entity* entity = level->getEntity(packet->playerId); + + if (entity && entity->isPlayer()) { + Player* p = (Player*)entity; + + auto playerInv = p->inventory; + + ItemInstance wantCreate; + + wantCreate.id = packet->itemId; + wantCreate.count = packet->count; + wantCreate.setAuxValue(packet->auxValue); + + Recipe* recipe = Recipes::getInstance()->getRecipeFor(wantCreate); + + std::vector items = recipe->getItemPack().getItemInstances(); + + std::vector checkForExists = {}; + + for (int i = Inventory::MAX_SELECTION_SIZE; i < p->inventory->getContainerSize(); ++i) { + auto itm = p->inventory->getItem(i); + + if (itm != NULL) { + for (int y = 0; y < items.size(); y++) { + auto itmRecipe = items.at(y); + + if (itmRecipe.id == itm->id && itm->count >= itmRecipe.count) { + checkForExists.push_back(itm->id); + } + } + } + } + + if (checkForExists.empty()) { + return; + } + + for (int i = 0; i < items.size(); i++) { + auto item = items.at(i); + + auto it = std::find(checkForExists.begin(), checkForExists.end(), item.id); + + if (it == checkForExists.end() && checkForExists.size() > 1) { + return; + } + } + + for (int i = 0; i < items.size(); i++) { + p->inventory->removeResource(ItemInstance(items.at(i).id, items.at(i).count, items.at(i).getAuxValue())); + } + // TakeItemPacket itemAdd(p->entityId, wantCreate.count, wantCreate.getAuxValue(), wantCreate.id); + // raknetInstance->send(source, itemAdd); + + p->inventory->add(new ItemInstance(wantCreate.id, wantCreate.count, wantCreate.getAuxValue())); + } +} void ServerSideNetworkHandler::handle(const RakNet::RakNetGUID& source, UseItemPacket* packet) { if (!level) return; - LOGI("UseItemPacket\n"); + LOGI("UseItemPacket: id %i data %i\n", packet->itemId, packet->itemData); Entity* entity = level->getEntity(packet->entityId); + if (entity && entity->isPlayer()) { + LOGI("%f %f %f \n", entity->x, entity->y, entity->z); + Player* player = (Player*) entity; int x = packet->x, y = packet->y, z = packet->z; Tile* t = Tile::tiles[level->getTile(x, y, z)]; @@ -512,7 +742,41 @@ void ServerSideNetworkHandler::handle(const RakNet::RakNetGUID& source, UseItemP if (t && t->use(level, x, y, z, player)) return; if (packet->item.isNull()) return; - ItemInstance* item = &packet->item; + ItemInstance* packetItem = &packet->item; + + int slot = player->inventory->getSlot(packet->itemId, packet->itemData); + + if (slot < 0) { + LOGW("UseItemPacket: Player doesn't have this item!\n"); + + auto pos = Vec3(packet->x, packet->y, packet->z); + + if (ItemInstance::isBlock(packetItem)) { + LOGI("UseItemPacket: This is even block!!!\n"); + + pos.x += packet->clickX; + pos.y += packet->clickY; + pos.z += packet->clickZ; + } + + UpdateBlockPacket refuse(pos.x, pos.y, pos.z, level->getTile(pos.x, pos.y, pos.z), level->getData(pos.x, pos.y, pos.z)); + raknetInstance->send(refuse); + + return; + } + + ItemInstance* item = player->inventory->getItem(slot); + player->x = packet->playerX; + player->y = packet->playerY; + player->z = packet->playerZ; + + player->bb.x0 = packet->playerX0; + player->bb.y0 = packet->playerY0; + player->bb.z0 = packet->playerZ0; + + player->bb.x1 = packet->playerX1; + player->bb.y1 = packet->playerY1; + player->bb.z1 = packet->playerZ1; if(packet->face == 255) { // Special case: x,y,z means direction-of-action @@ -523,6 +787,10 @@ void ServerSideNetworkHandler::handle(const RakNet::RakNetGUID& source, UseItemP minecraft->gameMode->useItemOn(player, level, item, packet->x, packet->y, packet->z, packet->face, Vec3(packet->clickX + packet->x, packet->clickY + packet->y, packet->clickZ + packet->z)); } + + if (item && item->count <= 0) { + player->inventory->clearSlot(slot); + } //LOGW("Use Item not working! Out of synch?\n"); @@ -534,6 +802,8 @@ void ServerSideNetworkHandler::handle(const RakNet::RakNetGUID& source, UseItemP void ServerSideNetworkHandler::handle(const RakNet::RakNetGUID& source, EntityEventPacket* packet) { if (!level) return; + LOGI("EntityEventPacket: id %i\n", packet->eventId); + if (Entity* e = level->getEntity(packet->entityId)) e->handleEntityEvent(packet->eventId); } @@ -567,6 +837,11 @@ void ServerSideNetworkHandler::handle( const RakNet::RakNetGUID& source, SendInv { if (!level) return; + LOGI("SendInventoryPacket:\n"); + for (int i = 0; i < packet->numItems; i++) { + LOGI("\t %i: %s (%i)\n", i, packet->items.at(i).getName().c_str(), packet->items.at(i).count); + } + Entity* entity = level->getEntity(packet->entityId); if (entity && entity->isPlayer()) { Player* p = (Player*)entity; @@ -582,15 +857,27 @@ void ServerSideNetworkHandler::handle( const RakNet::RakNetGUID& source, DropIte { if (!level) return; + LOGI("DropItemPacket\n"); + Entity* entity = level->getEntity(packet->entityId); if (entity && entity->isPlayer()) { Player* p = (Player*)entity; - p->drop(new ItemInstance(packet->item), packet->dropType != 0); + // p->drop(new ItemInstance(packet->item), packet->dropType != 0); + + int slot = p->inventory->getSlot(packet->item.id, packet->item.getAuxValue()); + + if (slot < 0) { + LOGW("DropItemPacket: player doesn't have these items!\n"); + return; + } + + p->inventory->dropSlot(slot, false, packet->dropType != 0); } } void ServerSideNetworkHandler::handle(const RakNet::RakNetGUID& source, ContainerClosePacket* packet) { if (!level) return; + LOGI("ContainerClosePacket\n"); Player* p = findPlayer(level, &source); if (!p) return; @@ -602,6 +889,16 @@ void ServerSideNetworkHandler::handle(const RakNet::RakNetGUID& source, Containe void ServerSideNetworkHandler::handle(const RakNet::RakNetGUID& source, ContainerSetSlotPacket* packet) { if (!level) return; + const char* type = "unknown"; + + switch (packet->setType) { + case ContainerSetSlotPacket::SETTYPE_ADD: type = "add"; break; + case ContainerSetSlotPacket::SETTYPE_SET: type = "set"; break; + case ContainerSetSlotPacket::SETTYPE_TAKE: type = "take"; break; + }; + + LOGI("ContainerSetSlot: slot %i item %s type %s\n", packet->slot, packet->item.getName().c_str(), type); + Player* p = findPlayer(level, &source); if (!p) return; @@ -609,11 +906,79 @@ void ServerSideNetworkHandler::handle(const RakNet::RakNetGUID& source, Containe LOGW("User has no container!\n"); return; } - if (p->containerMenu->containerId != packet->containerId) - { + + if (p->containerMenu->containerId != packet->containerId) { LOGW("Wrong container id: %d vs %d\n", p->containerMenu->containerId, packet->containerId); return; } + + if (packet->item.count > 64) { + LOGW("ContainerSetSlotPacket: player tried to put more than 64"); + return; + } + + auto contItems = p->containerMenu->getItems(); + + // find same item in player inventory (used not in all cases) + int invSlot = p->inventory->getSlot(packet->item.id, packet->item.getAuxValue()); + auto invItem = p->inventory->getItem(invSlot); + + if (contItems.at(packet->slot).id == 0 && packet->item.id != 0) { + LOGI("ContainerSetSlotPacket: player tried to put items to slot %i\n", packet->slot); + + if (invSlot < 0) { + LOGW("ContainerSetSlotPacket: player doesn't have this item\n"); + return; + } + + if (invItem->count < packet->item.count) { + LOGW("ContainerSetSlotPacket: player tried to put more than he have\n"); + packet->item.count = invItem->count; + } + + invItem->count -= packet->item.count; + + if (invItem->count <= 0) { + p->inventory->removeItem(invItem); + } + } else if(contItems.at(packet->slot).id == packet->item.id) { + int deltaItem = packet->item.count - contItems.at(packet->slot).count; + + if (deltaItem > 0) { + LOGI("ContainerSetSlotPacket: player tried to add %i items to slot %i\n", deltaItem, packet->slot); + + auto invItem = p->inventory->getItem(invSlot); + + if (invSlot < 0) { + LOGW("ContainerSetSlotPacket: player doesn't have this item\n"); + return; + } + + if (invItem->count < deltaItem) { + LOGW("ContainerSetSlotPacket: player tried to put more than he have"); + packet->item.count -= (deltaItem - invItem->count); + deltaItem = invItem->count; + } + + invItem->count -= deltaItem; + + if (invItem->count <= 0) { + p->inventory->removeItem(invItem); + } + } else if (deltaItem < 0) { + LOGW("ContainerSetSlotPacket: player tried to take %i items from slot %i\n", -deltaItem, packet->slot); + p->inventory->add(new ItemInstance(packet->item.getItem(), -deltaItem, contItems.at(packet->slot).getAuxValue())); + } + } else if(contItems.at(packet->slot).id && !packet->item.id) { + LOGI("ContainerSetSlotPacket: player tried to take all items from slot %i\n", packet->slot); + packet->item.count = 0; + packet->item.setAuxValue(0); + + p->inventory->add(new ItemInstance(contItems.at(packet->slot).getItem(), contItems.at(packet->slot).count, contItems.at(packet->slot).getAuxValue())); + } else { + LOGW("ContainerSetSlotPacket: illegal container operation in slot %i\n", packet->slot); + return; + } if (ContainerType::FURNACE == p->containerMenu->containerType) { //LOGI("Server:Setting slot %d: %s\n", packet->slot, packet->item.toString().c_str()); @@ -625,6 +990,8 @@ void ServerSideNetworkHandler::handle(const RakNet::RakNetGUID& source, Containe p->containerMenu->setSlot(packet->slot, &packet->item); //p->containerMenu->setSlot(packet->slot, packet->item.isNull()? NULL : &packet->item); } + + p->inventory->print(); } void ServerSideNetworkHandler::handle( const RakNet::RakNetGUID& source, SetHealthPacket* packet ) @@ -647,6 +1014,8 @@ void ServerSideNetworkHandler::handle( const RakNet::RakNetGUID& source, SignUpd if (!level) return; + LOGI("SignUpdate: [%i, %i, %i]\n", packet->x, packet->y, packet->z); + TileEntity* te = level->getTileEntity(packet->x, packet->y, packet->z); if (TileEntity::isType(te, TileEntityType::Sign)) { SignTileEntity* ste = (SignTileEntity*) te; @@ -662,7 +1031,7 @@ void ServerSideNetworkHandler::handle( const RakNet::RakNetGUID& source, SignUpd void ServerSideNetworkHandler::allowIncomingConnections( bool doAllow ) { if (doAllow) { - raknetInstance->announceServer(minecraft->options.username); + raknetInstance->announceServer(minecraft->options.getStringValue(OPTIONS_USERNAME)); } else { raknetInstance->announceServer(""); } @@ -703,3 +1072,9 @@ Player* ServerSideNetworkHandler::getPlayer( const RakNet::RakNetGUID& source ) if (source == level->players[i]->owner) return level->players[i]; return NULL; } + +void ServerSideNetworkHandler::sendPrivate(Packet& packet, const RakNet::RakNetGUID& source) { + RakNet::BitStream bitStream; + packet.write(&bitStream); + rakPeer->Send(&bitStream, HIGH_PRIORITY, RELIABLE_ORDERED, 0, source, false); +} \ No newline at end of file diff --git a/src/network/ServerSideNetworkHandler.h b/src/network/ServerSideNetworkHandler.h index 574b2f2..c1cb632 100755 --- a/src/network/ServerSideNetworkHandler.h +++ b/src/network/ServerSideNetworkHandler.h @@ -57,18 +57,29 @@ public: virtual void handle(const RakNet::RakNetGUID& source, ContainerSetSlotPacket* packet); virtual void handle(const RakNet::RakNetGUID& source, ContainerClosePacket* packet); virtual void handle(const RakNet::RakNetGUID& source, SignUpdatePacket* packet); + virtual void handle(const RakNet::RakNetGUID& source, ChatPacket* packet); + virtual void handle(const RakNet::RakNetGUID& source, MessagePacket* packet); + virtual void handle(const RakNet::RakNetGUID& source, WantCreatePacket* packet); + bool allowsIncomingConnections() { return _allowIncoming; } void allowIncomingConnections(bool doAllow); Player* popPendingPlayer(const RakNet::RakNetGUID& source); -private: - void redistributePacket(Packet* packet, const RakNet::RakNetGUID& fromPlayer); void displayGameMessage(const std::string& message); +private: + /** + * @brief Send packet to all players + */ + void redistributePacket(Packet* packet, const RakNet::RakNetGUID& fromPlayer); + + /** + * @brief Send packer private with GUID + */ + void sendPrivate(Packet& packet, const RakNet::RakNetGUID& source); Player* getPlayer(const RakNet::RakNetGUID& source); -private: Minecraft* minecraft; Level* level; diff --git a/src/network/command/CommandServer.cpp b/src/network/command/CommandServer.cpp index 14417c2..3bcbbc1 100755 --- a/src/network/command/CommandServer.cpp +++ b/src/network/command/CommandServer.cpp @@ -92,7 +92,7 @@ static std::string ToStringOk(const T& a, const T& b, const T& c) { std::stringstream ss; ss << a << "," << b << "," << c << "\n"; return ss.str(); -} +} static bool inRange(int c, int lowInclusive, int highInclusive) { return c >= lowInclusive && c <= highInclusive; @@ -236,9 +236,9 @@ std::string CommandServer::parse(ConnectedClient& client, const std::string& s) if (x0 < 0) x0 = 0; if (y0 < 0) y0 = 0; if (z0 < 0) z0 = 0; - if (x1 >= LEVEL_WIDTH ) x1 = LEVEL_WIDTH - 1; - if (y1 >= LEVEL_HEIGHT) y1 = LEVEL_HEIGHT - 1; - if (z1 >= LEVEL_DEPTH ) z1 = LEVEL_DEPTH - 1; + if (x1 >= LevelConstants::LEVEL_WIDTH ) x1 = LevelConstants::LEVEL_WIDTH - 1; + if (y1 >= LevelConstants::LEVEL_HEIGHT) y1 = LevelConstants::LEVEL_HEIGHT - 1; + if (z1 >= LevelConstants::LEVEL_DEPTH ) z1 = LevelConstants::LEVEL_DEPTH - 1; for (int y = y0; y <= y1; ++y) for (int z = z0; z <= z1; ++z) @@ -456,7 +456,7 @@ std::string CommandServer::parse(ConnectedClient& client, const std::string& s) sw.start(); // Save a cuboid around the player - const int CSize = CHUNK_CACHE_WIDTH; + const int CSize = LevelConstants::CHUNK_CACHE_WIDTH; int cx = (int)e->x / CSize; int cz = (int)e->z / CSize; @@ -504,7 +504,7 @@ bool CommandServer::handleCheckpoint(bool doRestore ) { const int cz = restorePos.z; const int y0 = restorePos.y; const int y1 = y0 + RestoreHeight; - const int CSize = CHUNK_CACHE_WIDTH; + const int CSize = LevelConstants::CHUNK_CACHE_WIDTH; const int numChunkBytes = RestoreHeight * CSize * CSize * 20 / 8; if (!restoreBuffer) { diff --git a/src/network/command/CommandServer.h b/src/network/command/CommandServer.h index ff80ee2..e2aa4bb 100755 --- a/src/network/command/CommandServer.h +++ b/src/network/command/CommandServer.h @@ -5,7 +5,7 @@ #include #ifdef WIN32 - #include + #include #else #include #include diff --git a/src/network/packet/ChunkDataPacket.h b/src/network/packet/ChunkDataPacket.h index 51f1719..b272685 100755 --- a/src/network/packet/ChunkDataPacket.h +++ b/src/network/packet/ChunkDataPacket.h @@ -33,18 +33,18 @@ public: unsigned char* blockIds = chunk->getBlockData(); DataLayer& blockData = chunk->data; - const int setSize = LEVEL_HEIGHT / 8; - const int setShift = 4; // power of LEVEL_HEIGHT / 8 + const int setSize = LevelConstants::LEVEL_HEIGHT / 8; + const int setShift = 4; // power of LevelConstants::LEVEL_HEIGHT / 8 chunkData.Reset(); - for (int i = 0; i < CHUNK_COLUMNS; i++) + for (int i = 0; i < LevelConstants::CHUNK_COLUMNS; i++) { unsigned char updateBits = chunk->updateMap[i]; chunkData.Write(updateBits); if (updateBits > 0) { - int colDataPosition = (i % CHUNK_WIDTH) << 11 | (i / CHUNK_WIDTH) << 7; + int colDataPosition = (i % LevelConstants::CHUNK_WIDTH) << 11 | (i / LevelConstants::CHUNK_WIDTH) << 7; for (int set = 0; set < 8; set++) { diff --git a/src/network/packet/LoginPacket.h b/src/network/packet/LoginPacket.h index b44a44a..50caee3 100755 --- a/src/network/packet/LoginPacket.h +++ b/src/network/packet/LoginPacket.h @@ -9,17 +9,20 @@ public: RakNet::RakString clientName; int clientNetworkVersion; int clientNetworkLowestSupportedVersion; + bool newProto; LoginPacket() : clientNetworkVersion(-1), - clientNetworkLowestSupportedVersion(-1) + clientNetworkLowestSupportedVersion(-1), + newProto(false) { } - LoginPacket(const RakNet::RakString& clientName, int clientVersion) + LoginPacket(const RakNet::RakString& clientName, int clientVersion, bool newProto) : clientName(clientName), clientNetworkVersion(clientVersion), - clientNetworkLowestSupportedVersion(clientVersion) + clientNetworkLowestSupportedVersion(clientVersion), + newProto(newProto) { } @@ -29,6 +32,7 @@ public: bitStream->Write(clientName); bitStream->Write(clientNetworkVersion); bitStream->Write(clientNetworkLowestSupportedVersion); + bitStream->Write(newProto); } void read(RakNet::BitStream* bitStream) @@ -39,6 +43,11 @@ public: if (bitStream->GetNumberOfUnreadBits() > 0) { bitStream->Read(clientNetworkVersion); bitStream->Read(clientNetworkLowestSupportedVersion); + + // Checking for new proto + if (bitStream->GetNumberOfUnreadBits() > 0) { + bitStream->Read(newProto); + } } } diff --git a/src/network/packet/LoginStatusPacket.h b/src/network/packet/LoginStatusPacket.h index b194f8f..e2e0957 100755 --- a/src/network/packet/LoginStatusPacket.h +++ b/src/network/packet/LoginStatusPacket.h @@ -3,10 +3,13 @@ #include "../Packet.h" +// wtf why not enum namespace LoginStatus { const int Success = 0; const int Failed_ClientOld = 1; const int Failed_ServerOld = 2; + const int Failed_TakenNickname = 3; + const int Failed_Banned = 4; } class LoginStatusPacket : public Packet { diff --git a/src/network/packet/PacketInclude.h b/src/network/packet/PacketInclude.h index 09aeae8..ff884d2 100755 --- a/src/network/packet/PacketInclude.h +++ b/src/network/packet/PacketInclude.h @@ -50,5 +50,7 @@ #include "TileEventPacket.h" #include "UpdateBlockPacket.h" #include "UseItemPacket.h" - +#include "RemoveItemPacket.h" +#include "WantCreatePacket.h" +#include "TakeItemPacket.h" #endif /*NET_MINECRAFT_NETWORK_PACKET__PacketInclude_H__*/ diff --git a/src/network/packet/PlayerEquipmentPacket.h b/src/network/packet/PlayerEquipmentPacket.h index 5dfb315..b49974c 100755 --- a/src/network/packet/PlayerEquipmentPacket.h +++ b/src/network/packet/PlayerEquipmentPacket.h @@ -9,15 +9,19 @@ public: int entityId; unsigned short itemId; unsigned short itemAuxValue; + unsigned char selectedSlot; + unsigned char inventorySlot; PlayerEquipmentPacket() { } - PlayerEquipmentPacket(int entityId, int itemId, int data) + PlayerEquipmentPacket(int entityId, int itemId, int data, int selSlot, int invSlot) : entityId(entityId), itemId(itemId), - itemAuxValue(data) + itemAuxValue(data), + selectedSlot(selSlot), + inventorySlot(invSlot) { } @@ -28,6 +32,8 @@ public: bitStream->Write(entityId); bitStream->Write(itemId); bitStream->Write(itemAuxValue); + bitStream->Write(selectedSlot); + bitStream->Write(inventorySlot); } void read(RakNet::BitStream* bitStream) @@ -35,6 +41,8 @@ public: bitStream->Read(entityId); bitStream->Read(itemId); bitStream->Read(itemAuxValue); + bitStream->Read(selectedSlot); + bitStream->Read(inventorySlot); } void handle(const RakNet::RakNetGUID& source, NetEventCallback* callback) diff --git a/src/network/packet/RemoveItemPacket.h b/src/network/packet/RemoveItemPacket.h new file mode 100644 index 0000000..f4a1d0a --- /dev/null +++ b/src/network/packet/RemoveItemPacket.h @@ -0,0 +1,54 @@ +#ifndef NET_MINECRAFT_NETWORK_PACKET__RemoveItemPacket_H__ +#define NET_MINECRAFT_NETWORK_PACKET__RemoveItemPacket_H__ + +//package net.minecraft.network.packet; + +#include "../Packet.h" + +class RemoveItemPacket: public Packet +{ +public: + RemoveItemPacket() { + } + + RemoveItemPacket(int playerId, int count, int auxValue, int itemId) + : + playerId(playerId), + count(count), + auxValue(auxValue), + itemId(itemId) + { + } + + void write(RakNet::BitStream* bitStream) + { + bitStream->Write((RakNet::MessageID)(ID_USER_PACKET_ENUM + PACKET_REMOVEITEM)); + bitStream->Write(itemId); + bitStream->Write(count); + bitStream->Write(auxValue); + + bitStream->Write(playerId); + } + + void read(RakNet::BitStream* bitStream) + { + bitStream->Read(itemId); + bitStream->Read(count); + bitStream->Read(auxValue); + + bitStream->Read(playerId); + } + + void handle(const RakNet::RakNetGUID& source, NetEventCallback* callback) + { + callback->handle(source, (RemoveItemPacket*)this); + } + + int playerId; + + int itemId; + int count; + int auxValue; +}; + +#endif /*NET_MINECRAFT_NETWORK_PACKET__RemoveItemPacket_H__*/ diff --git a/src/network/packet/SendInventoryPacket.h b/src/network/packet/SendInventoryPacket.h index 65d12f4..b744b58 100755 --- a/src/network/packet/SendInventoryPacket.h +++ b/src/network/packet/SendInventoryPacket.h @@ -2,13 +2,14 @@ #define NET_MINECRAFT_NETWORK_PACKET__SendInventoryPacket_H__ #include "../Packet.h" +#include "world/entity/player/Inventory.h" +#include "world/inventory/FillingContainer.h" +#include class SendInventoryPacket: public Packet { public: - SendInventoryPacket() - { - } + SendInventoryPacket() {} SendInventoryPacket(Player* player, bool dropItems) : entityId(player->entityId), @@ -21,10 +22,15 @@ public: ItemInstance* item = inv->getItem(i); items.push_back(item? *item : ItemInstance()); } + for (int i = 0; i < NumArmorItems; ++i) { ItemInstance* item = player->getArmor(i); items.push_back(item? *item : ItemInstance()); } + + for (int i = 0; i < inv->numLinkedSlots; ++i) { + linkedSlot[i] = inv->linkedSlots[i]; + } } void write(RakNet::BitStream* bitStream) @@ -39,6 +45,13 @@ public: // Armor for (int i = 0; i < NumArmorItems; ++i) PacketUtil::writeItemInstance(items[i + numItems], bitStream); + + int lSlots = Inventory::MAX_SELECTION_SIZE; + + // Linked slots + bitStream->Write(lSlots); + for (int i = 0; i < lSlots; ++i) + bitStream->Write(linkedSlot[i]); } void read(RakNet::BitStream* bitStream) @@ -50,6 +63,12 @@ public: // Inventory, Armor for (int i = 0; i < numItems + NumArmorItems; ++i) items.push_back(PacketUtil::readItemInstance(bitStream)); + + // Linked slots + int lSlots = 0; + bitStream->Read(lSlots); + for (int i = 0; i < lSlots; ++i) + bitStream->Read(linkedSlot[i]); } void handle(const RakNet::RakNetGUID& source, NetEventCallback* callback) @@ -62,6 +81,8 @@ public: short numItems; unsigned char extra; + std::array linkedSlot; + static const int ExtraDrop = 1; static const int NumArmorItems = 4; }; diff --git a/src/network/packet/SetTimePacket.h b/src/network/packet/SetTimePacket.h index 082d05e..e2fb484 100755 --- a/src/network/packet/SetTimePacket.h +++ b/src/network/packet/SetTimePacket.h @@ -4,6 +4,7 @@ //package net.minecraft.network.packet; #include "../Packet.h" +#include class SetTimePacket: public Packet { public: @@ -11,7 +12,7 @@ public: } SetTimePacket(long time) - : time(time) + : time((int32_t)time) {} void write(RakNet::BitStream* bitStream) @@ -30,7 +31,7 @@ public: callback->handle(source, (SetTimePacket*)this); } - long time; + int32_t time; }; #endif /*NET_MINECRAFT_NETWORK_PACKET__SetTimePacket_H__*/ diff --git a/src/network/packet/StartGamePacket.h b/src/network/packet/StartGamePacket.h index 31f6a78..f2ce50f 100755 --- a/src/network/packet/StartGamePacket.h +++ b/src/network/packet/StartGamePacket.h @@ -2,29 +2,33 @@ #define NET_MINECRAFT_NETWORK_PACKET__StartGamePacket_H__ #include "../Packet.h" +#include "world/level/LevelConstants.h" +#include class StartGamePacket : public Packet { public: - long levelSeed; + int32_t levelSeed; int levelGeneratorVersion; int gameType; int entityId; float x, y, z; + int chunkCacheWidth = 0; StartGamePacket() { } - StartGamePacket(long seed, int levelGeneratorVersion, int gameType, int entityId, float x, float y, float z) - : levelSeed(seed), + StartGamePacket(long seed, int levelGeneratorVersion, int gameType, int entityId, float x, float y, float z, int chunkCacheWidth) + : levelSeed((int32_t)seed), levelGeneratorVersion(levelGeneratorVersion), gameType(gameType), entityId(entityId), x(x), y(y), - z(z) + z(z), + chunkCacheWidth(chunkCacheWidth) { } @@ -39,6 +43,7 @@ public: bitStream->Write(x); bitStream->Write(y); bitStream->Write(z); + bitStream->Write(LevelConstants::CHUNK_CACHE_WIDTH); } void read(RakNet::BitStream* bitStream) @@ -50,6 +55,10 @@ public: bitStream->Read(x); bitStream->Read(y); bitStream->Read(z); + + if (bitStream->GetNumberOfUnreadBits() > 0) { + bitStream->Read(chunkCacheWidth); + } } void handle(const RakNet::RakNetGUID& source, NetEventCallback* callback) diff --git a/src/network/packet/TakeItemPacket.h b/src/network/packet/TakeItemPacket.h new file mode 100644 index 0000000..17eee0f --- /dev/null +++ b/src/network/packet/TakeItemPacket.h @@ -0,0 +1,54 @@ +#ifndef NET_MINECRAFT_NETWORK_PACKET__TakeItemPacket_H__ +#define NET_MINECRAFT_NETWORK_PACKET__TakeItemPacket_H__ + +//package net.minecraft.network.packet; + +#include "../Packet.h" + +class TakeItemPacket: public Packet +{ +public: + TakeItemPacket() { + } + + TakeItemPacket(int playerId, int count, int auxValue, int itemId) + : + playerId(playerId), + count(count), + auxValue(auxValue), + itemId(itemId) + { + } + + void write(RakNet::BitStream* bitStream) + { + bitStream->Write((RakNet::MessageID)(ID_USER_PACKET_ENUM + PACKET_TAKEITEM)); + bitStream->Write(itemId); + bitStream->Write(count); + bitStream->Write(auxValue); + + bitStream->Write(playerId); + } + + void read(RakNet::BitStream* bitStream) + { + bitStream->Read(itemId); + bitStream->Read(count); + bitStream->Read(auxValue); + + bitStream->Read(playerId); + } + + void handle(const RakNet::RakNetGUID& source, NetEventCallback* callback) + { + callback->handle(source, (TakeItemPacket*)this); + } + + int playerId; + + int itemId; + int count; + int auxValue; +}; + +#endif /*NET_MINECRAFT_NETWORK_PACKET__TakeItemPacket_H__*/ diff --git a/src/network/packet/UseItemPacket.h b/src/network/packet/UseItemPacket.h index e1583de..3f67c41 100755 --- a/src/network/packet/UseItemPacket.h +++ b/src/network/packet/UseItemPacket.h @@ -16,10 +16,14 @@ public: short itemId; unsigned char itemData; ItemInstance item; + float playerX, playerY, playerZ; + float playerX0, playerY0, playerZ0; + float playerX1, playerY1, playerZ1; UseItemPacket() {} - UseItemPacket(int x, int y, int z, int face, const ItemInstance* item, int entityId, float clickX, float clickY, float clickZ) + UseItemPacket(int x, int y, int z, int face, const ItemInstance* item, int entityId, float clickX, float clickY, float clickZ, + float plrX, float plrY, float plrZ, float plrX0, float plrY0, float plrZ0, float plrX1, float plrY1, float plrZ1) : x(x), y(y), z(z), @@ -29,17 +33,36 @@ public: entityId(entityId), clickX(clickX), clickY(clickY), - clickZ(clickZ) + clickZ(clickZ), + playerX(plrX), + playerY(plrY), + playerZ(plrZ), + playerX0(plrX0), + playerY0(plrY0), + playerZ0(plrZ0), + playerX1(plrX1), + playerY1(plrY1), + playerZ1(plrZ1) {} - UseItemPacket(const ItemInstance* item, int entityId, const Vec3& aim) + UseItemPacket(const ItemInstance* item, int entityId, const Vec3& aim, float plrX, float plrY, float plrZ, + float plrX0, float plrY0, float plrZ0, float plrX1, float plrY1, float plrZ1) : face(255), itemId(item? item->id : 0), itemData(item? item->getAuxValue() : 0), entityId(entityId), x((int)(aim.x * 32768.0f)), y((int)(aim.y * 32768.0f)), - z((int)(aim.z * 32768.0f)) + z((int)(aim.z * 32768.0f)), + playerX(plrX), + playerY(plrY), + playerZ(plrZ), + playerX0(plrX0), + playerY0(plrY0), + playerZ0(plrZ0), + playerX1(plrX1), + playerY1(plrY1), + playerZ1(plrZ1) { } @@ -57,6 +80,15 @@ public: bitStream->Write(clickX); bitStream->Write(clickY); bitStream->Write(clickZ); + bitStream->Write(playerX); + bitStream->Write(playerY); + bitStream->Write(playerZ); + bitStream->Write(playerX0); + bitStream->Write(playerY0); + bitStream->Write(playerZ0); + bitStream->Write(playerX1); + bitStream->Write(playerY1); + bitStream->Write(playerZ1); } void read(RakNet::BitStream* bitStream) @@ -74,7 +106,15 @@ public: item.id = itemId; item.setAuxValue(itemData); item.count = (itemId == 0 && itemData == 0)? 0 : 1; - + bitStream->Read(playerX); + bitStream->Read(playerY); + bitStream->Read(playerZ); + bitStream->Read(playerX0); + bitStream->Read(playerY0); + bitStream->Read(playerZ0); + bitStream->Read(playerX1); + bitStream->Read(playerY1); + bitStream->Read(playerZ1); } void handle(const RakNet::RakNetGUID& source, NetEventCallback* callback) diff --git a/src/network/packet/WantCreatePacket.h b/src/network/packet/WantCreatePacket.h new file mode 100644 index 0000000..48873c5 --- /dev/null +++ b/src/network/packet/WantCreatePacket.h @@ -0,0 +1,54 @@ +#ifndef NET_MINECRAFT_NETWORK_PACKET__WantCreatePacket_H__ +#define NET_MINECRAFT_NETWORK_PACKET__WantCreatePacket_H__ + +//package net.minecraft.network.packet; + +#include "../Packet.h" + +class WantCreatePacket: public Packet +{ +public: + WantCreatePacket() { + } + + WantCreatePacket(int playerId, int count, int auxValue, int itemId) + : + playerId(playerId), + count(count), + auxValue(auxValue), + itemId(itemId) + { + } + + void write(RakNet::BitStream* bitStream) + { + bitStream->Write((RakNet::MessageID)(ID_USER_PACKET_ENUM + PACKET_WANTCREATEITEM)); + bitStream->Write(itemId); + bitStream->Write(count); + bitStream->Write(auxValue); + + bitStream->Write(playerId); + } + + void read(RakNet::BitStream* bitStream) + { + bitStream->Read(itemId); + bitStream->Read(count); + bitStream->Read(auxValue); + + bitStream->Read(playerId); + } + + void handle(const RakNet::RakNetGUID& source, NetEventCallback* callback) + { + callback->handle(source, (WantCreatePacket*)this); + } + + int playerId; + + int itemId; + int count; + int auxValue; +}; + +#endif /*NET_MINECRAFT_NETWORK_PACKET__WantCreatePacket_H__*/ diff --git a/src/platform/CThread.cpp b/src/platform/CThread.cpp index 604dbdb..e136198 100755 --- a/src/platform/CThread.cpp +++ b/src/platform/CThread.cpp @@ -25,7 +25,7 @@ &m_threadID // pointer to receive thread ID ); #endif - #if defined(__linux__) || defined(ANDROID) || defined(__APPLE__) || defined(POSIX) + #if defined(__linux__) || defined(ANDROID) || defined(__APPLE__) || defined(POSIX) || defined(__EMSCRIPTEN__) mp_threadFunc = (pthread_fn)threadFunc; pthread_attr_init(&m_attributes); @@ -64,7 +64,8 @@ TerminateThread(m_threadHandle, 0); #endif #if defined(LINUX) || defined(ANDROID) || defined(__APPLE__) || defined(POSIX) - pthread_join(m_thread, NULL); + // Thread was created detached; pthread_join on a detached thread is undefined + // and causes SIGABRT when the pthread_t is no longer valid. pthread_attr_destroy(&m_attributes); #endif } diff --git a/src/platform/CThread.h b/src/platform/CThread.h index 3e2c975..c608e92 100755 --- a/src/platform/CThread.h +++ b/src/platform/CThread.h @@ -13,7 +13,7 @@ typedef void *( * pthread_fn )( void * ); -#if defined(__linux__) || defined(ANDROID) || defined(__APPLE__) || defined(POSIX) +#if defined(__linux__) || defined(ANDROID) || defined(__APPLE__) || defined(POSIX) || defined(__EMSCRIPTEN__) #include #include @@ -38,7 +38,7 @@ typedef void *( * pthread_fn )( void * ); DWORD m_threadID; HANDLE m_threadHandle; #endif - #if defined(__linux__) || defined(ANDROID) || defined(__APPLE__) || defined(POSIX) + #if defined(__linux__) || defined(ANDROID) || defined(__APPLE__) || defined(POSIX) || defined(__EMSCRIPTEN__) pthread_fn mp_threadFunc; pthread_t m_thread; pthread_attr_t m_attributes; diff --git a/src/platform/HttpClient.cpp b/src/platform/HttpClient.cpp new file mode 100644 index 0000000..9f58a41 --- /dev/null +++ b/src/platform/HttpClient.cpp @@ -0,0 +1,552 @@ +#include "HttpClient.h" +#include "log.h" + +#include +#include +#include +#include +#include +#include + +#if defined(_WIN32) +#ifndef NOMINMAX +#define NOMINMAX +#endif +#include +#include +#include +#pragma comment(lib, "ws2_32.lib") +#pragma comment(lib, "winhttp.lib") +#else +#include +#include +#include +#include +#include + +// if cmake detected opensll, we define HTTPCLIENT_USE_OPENSSL and include the openssl headers +// most linux distros should have openssl right +#if defined(HTTPCLIENT_USE_OPENSSL) +#include +#include +#endif +#endif + +namespace { +bool stringStartsWith(const std::string& str, const std::string& prefix) { + return str.size() >= prefix.size() && std::equal(prefix.begin(), prefix.end(), str.begin()); +} + +bool parseUrl(const std::string& url, std::string& schemeOut, std::string& hostOut, int& portOut, std::string& pathOut); + +// forward declarations for helper functions used by https implementation +bool resolveAndConnect(const std::string& host, int port, int& outSocket); +bool extractStatusCode(const std::string& headers, int& outStatus); + +#if defined(_WIN32) + +// download an https url using windows winhttp +// this is only used on windows because the rest of the code is a simple raw tcp http client +bool downloadHttpsWinHttp(const std::string& url, std::vector& outputBody) { + // gotta start clear + outputBody.clear(); + + std::string scheme; + std::string host; + std::string path; + int port = 0; + + // split into scheme/host/port/path + if (!parseUrl(url, scheme, host, port, path)) { + return false; + } + + // creating an http session + HINTERNET session = WinHttpOpen(L"MinecraftPE/0.6.1", WINHTTP_ACCESS_TYPE_DEFAULT_PROXY, WINHTTP_NO_PROXY_NAME, WINHTTP_NO_PROXY_BYPASS, 0); + if (!session) { + return false; + } + HINTERNET connectHandle = WinHttpConnect(session, std::wstring(host.begin(), host.end()).c_str(), port, 0); + if (!connectHandle) { + WinHttpCloseHandle(session); + return false; + } + + HINTERNET requestHandle = WinHttpOpenRequest( + connectHandle, + L"GET", + std::wstring(path.begin(), path.end()).c_str(), + NULL, + WINHTTP_NO_REFERER, + WINHTTP_DEFAULT_ACCEPT_TYPES, + WINHTTP_FLAG_SECURE + ); + + if (!requestHandle) { + WinHttpCloseHandle(connectHandle); + WinHttpCloseHandle(session); + return false; + } + + DWORD redirectPolicy = WINHTTP_OPTION_REDIRECT_POLICY_ALWAYS; + WinHttpSetOption(requestHandle, WINHTTP_OPTION_REDIRECT_POLICY, &redirectPolicy, sizeof(redirectPolicy)); + + BOOL sendResult = WinHttpSendRequest(requestHandle, WINHTTP_NO_ADDITIONAL_HEADERS, 0, WINHTTP_NO_REQUEST_DATA, 0, 0, 0); + if (!sendResult) { + WinHttpCloseHandle(requestHandle); + WinHttpCloseHandle(connectHandle); + WinHttpCloseHandle(session); + return false; + } + + BOOL receiveResult = WinHttpReceiveResponse(requestHandle, NULL); + if (!receiveResult) { + WinHttpCloseHandle(requestHandle); + WinHttpCloseHandle(connectHandle); + WinHttpCloseHandle(session); + return false; + } + + DWORD bytesAvailable = 0; + while (WinHttpQueryDataAvailable(requestHandle, &bytesAvailable) && bytesAvailable > 0) { + std::vector buffer(bytesAvailable); + DWORD bytesRead = 0; + if (!WinHttpReadData(requestHandle, buffer.data(), bytesAvailable, &bytesRead) || bytesRead == 0) + break; + outputBody.insert(outputBody.end(), buffer.begin(), buffer.begin() + bytesRead); + } + + WinHttpCloseHandle(requestHandle); + WinHttpCloseHandle(connectHandle); + WinHttpCloseHandle(session); + + return !outputBody.empty(); +} + +#endif + +#if defined(HTTPCLIENT_USE_OPENSSL) && !defined(_WIN32) +bool downloadHttpsOpenSSL(const std::string& url, std::vector& outputBody) { + outputBody.clear(); + + std::string scheme; + std::string host; + std::string path; + int port = 0; + + // split into scheme/host/port/path + if (!parseUrl(url, scheme, host, port, path)) { + return false; + } + + int socketFd = -1; + if (!resolveAndConnect(host, port, socketFd)) { + return false; + } + + SSL_library_init(); + SSL_load_error_strings(); + OpenSSL_add_all_algorithms(); + + SSL_CTX* ctx = SSL_CTX_new(TLS_client_method()); + if (!ctx) { + close(socketFd); + return false; + } + + // do not validate certificates we donst ship ca roots. + SSL_CTX_set_verify(ctx, SSL_VERIFY_NONE, nullptr); + + SSL* ssl = SSL_new(ctx); + if (!ssl) { + SSL_CTX_free(ctx); + close(socketFd); + return false; + } + + SSL_set_fd(ssl, socketFd); + SSL_set_tlsext_host_name(ssl, host.c_str()); + + if (SSL_connect(ssl) != 1) { + SSL_free(ssl); + SSL_CTX_free(ctx); + close(socketFd); + return false; + } + + std::string httpRequest; + httpRequest += "GET "; + httpRequest += path; + httpRequest += " HTTP/1.1\r\n"; + httpRequest += "Host: "; + httpRequest += host; + httpRequest += "\r\n"; + httpRequest += "User-Agent: MinecraftPE\r\n"; + httpRequest += "Connection: close\r\n"; + httpRequest += "\r\n"; + + if (SSL_write(ssl, httpRequest.data(), (int)httpRequest.size()) <= 0) { + SSL_shutdown(ssl); + SSL_free(ssl); + SSL_CTX_free(ctx); + close(socketFd); + return false; + } + + std::vector rawResponse; + + const int BUFFER_SIZE = 4096; + unsigned char buffer[BUFFER_SIZE]; + while (true) { + int bytesRead = SSL_read(ssl, buffer, BUFFER_SIZE); + if (bytesRead <= 0) + break; + rawResponse.insert(rawResponse.end(), buffer, buffer + bytesRead); + } + + SSL_shutdown(ssl); + SSL_free(ssl); + SSL_CTX_free(ctx); + close(socketFd); + + if (rawResponse.empty()) { + return false; + } + + const std::string headerDelimiter = "\r\n\r\n"; + auto headerEndIt = std::search(rawResponse.begin(), rawResponse.end(), headerDelimiter.begin(), headerDelimiter.end()); + if (headerEndIt == rawResponse.end()) { + return false; + } + + size_t headerLength = headerEndIt - rawResponse.begin(); + std::string headers(reinterpret_cast(rawResponse.data()), headerLength); + size_t bodyStartIndex = headerLength + headerDelimiter.size(); + + int statusCode = 0; + if (!extractStatusCode(headers, statusCode)) { + return false; + } + + if (statusCode != 200) { + std::string bodySnippet; + size_t len = rawResponse.size() < 1024 ? rawResponse.size() : 1024; + bodySnippet.assign(rawResponse.begin(), rawResponse.begin() + len); + LOGW("[HttpClient] HTTP status %d for %s\n", statusCode, url.c_str()); + LOGW("[HttpClient] Headers:\n%s\n", headers.c_str()); + LOGW("[HttpClient] Body (up to 1024 bytes):\n%s\n", bodySnippet.c_str()); + return false; + } + + outputBody.assign(rawResponse.begin() + bodyStartIndex, rawResponse.end()); + return true; +} +#endif + +std::string toLower(const std::string& input) { + std::string output = input; + std::transform(output.begin(), output.end(), output.begin(), ::tolower); + return output; +} + +bool parseUrl(const std::string& url, std::string& schemeOut, std::string& hostOut, int& portOut, std::string& pathOut) { + schemeOut.clear(); + hostOut.clear(); + pathOut.clear(); + portOut = 0; + + size_t schemeSep = url.find("://"); + if (schemeSep == std::string::npos) { + return false; + } + + schemeOut = toLower(url.substr(0, schemeSep)); + size_t hostStart = schemeSep + 3; + + // split host/port from the path + size_t pathStart = url.find('/', hostStart); + std::string hostPort; + if (pathStart == std::string::npos) { + // no path part, so just use / as the default + hostPort = url.substr(hostStart); + pathOut = "/"; + } else { + hostPort = url.substr(hostStart, pathStart - hostStart); + pathOut = url.substr(pathStart); + } + + // if the host includes a ":port", split it out + size_t portSep = hostPort.find(':'); + if (portSep != std::string::npos) { + hostOut = hostPort.substr(0, portSep); + portOut = atoi(hostPort.c_str() + portSep + 1); + } else { + hostOut = hostPort; + } + + // fill in default ports for known schemes + if (schemeOut == "http") { + if (portOut == 0) portOut = 80; + } else if (schemeOut == "https") { + if (portOut == 0) portOut = 443; + } + + // return success only if we got at a scheme and host + return !hostOut.empty() && !schemeOut.empty(); +} + +// read all available data from a tcp socket until the connection is closed +// data is appended to outData +bool readAll(int socketFd, std::vector& outData) { + const int BUFFER_SIZE = 4096; + unsigned char buffer[BUFFER_SIZE]; + + while (true) { + int bytesRead = recv(socketFd, (char*)buffer, BUFFER_SIZE, 0); + if (bytesRead <= 0) + break; + outData.insert(outData.end(), buffer, buffer + bytesRead); + } + + return true; +} + +// resolve a hostname and connect a tcp socket to the given host:port +// on windows this also makes sure winsock is initialized +// if successful, outSocket will contain a connected socket descriptor +bool resolveAndConnect(const std::string& host, int port, int& outSocket) { +#if defined(_WIN32) + static bool wsaStarted = false; + if (!wsaStarted) { + WSADATA wsaData; + WSAStartup(MAKEWORD(2, 2), &wsaData); + wsaStarted = true; + } +#endif + + struct addrinfo hints; + struct addrinfo* result = NULL; + + memset(&hints, 0, sizeof(hints)); + hints.ai_family = AF_UNSPEC; // ipv4 ipv6 + hints.ai_socktype = SOCK_STREAM; // tcp + + // getaddrinfo expects strings for port and host + std::ostringstream portStream; + portStream << port; + const std::string portString = portStream.str(); + + if (getaddrinfo(host.c_str(), portString.c_str(), &hints, &result) != 0) { + return false; + } + + int socketFd = -1; + + // try each resolved address until we successfully connect + for (struct addrinfo* addr = result; addr != NULL; addr = addr->ai_next) { + socketFd = socket(addr->ai_family, addr->ai_socktype, addr->ai_protocol); + if (socketFd < 0) { + continue; + } + + if (connect(socketFd, addr->ai_addr, (int)addr->ai_addrlen) == 0) { + // connected! yay! + break; + } + + // failed to connect, try next +#if defined(_WIN32) + closesocket(socketFd); +#else + close(socketFd); +#endif + socketFd = -1; + } + + freeaddrinfo(result); + + if (socketFd < 0) { + return false; + } + + outSocket = socketFd; + return true; +} + +std::string getHeaderValue(const std::string& headers, const std::string& key) { + std::string headersLower = toLower(headers); + std::string keyLower = toLower(key); + + size_t pos = headersLower.find(keyLower); + if (pos == std::string::npos) { + return ""; + } + + size_t colonPos = headersLower.find(':', pos + keyLower.size()); + if (colonPos == std::string::npos) { + return ""; + } + + size_t valueStart = colonPos + 1; + while (valueStart < headersLower.size() && (headersLower[valueStart] == ' ' || headersLower[valueStart] == '\t')) { + valueStart++; + } + + size_t valueEnd = headersLower.find('\r', valueStart); + if (valueEnd == std::string::npos) { + valueEnd = headersLower.find('\n', valueStart); + } + if (valueEnd == std::string::npos) { + valueEnd = headersLower.size(); + } + + return headers.substr(valueStart, valueEnd - valueStart); +} + +// wxtract the http status code from the first response line (foex example "HTTP/1.1 200 OK") +// returns false on malformed responses. +bool extractStatusCode(const std::string& headers, int& outStatus) { + size_t firstSpace = headers.find(' '); + if (firstSpace == std::string::npos) { + return false; + } + + size_t secondSpace = headers.find(' ', firstSpace + 1); + if (secondSpace == std::string::npos) { + return false; + } + + std::string code = headers.substr(firstSpace + 1, secondSpace - firstSpace - 1); + outStatus = atoi(code.c_str()); + return true; +} + +} // anonymous namespace + +namespace HttpClient { + +bool download(const std::string& url, std::vector& outBody) { + outBody.clear(); + + // keep a copy of the current url so we can follow redirects + std::string urlToDownload = url; + + // follow up to 3 redirects (301/302/307/308) + // if a redirect is encountered we loop again with the new loaction url + for (int redirectCount = 0; redirectCount < 3; ++redirectCount) { + std::string urlScheme; + std::string urlHost; + std::string urlPath; + int urlPort = 0; + + // parse the url into its components so we can open a socket/start an https request + if (!parseUrl(urlToDownload, urlScheme, urlHost, urlPort, urlPath)) { + LOGW("[HttpClient] parseUrl failed for '%s'\n", urlToDownload.c_str()); + return false; + } + + // for https we delegate to winhttp on windows, since this simple client + // only supports plain http over raw sockets + if (urlScheme == "https") { +#if defined(_WIN32) + LOGI("[HttpClient] using WinHTTP for HTTPS URL %s\n", urlToDownload.c_str()); + return downloadHttpsWinHttp(urlToDownload, outBody); +#elif defined(HTTPCLIENT_USE_OPENSSL) + LOGI("[HttpClient] using OpenSSL for HTTPS URL %s\n", urlToDownload.c_str()); + return downloadHttpsOpenSSL(urlToDownload, outBody); +#else + LOGW("[HttpClient] HTTPS not supported on this platform: %s\n", urlToDownload.c_str()); + return false; +#endif + } + + // we only support plain http for all non-windows platforms for nw + if (urlScheme != "http") { + LOGW("[HttpClient] unsupported scheme '%s' for URL '%s'\n", urlScheme.c_str(), urlToDownload.c_str()); + return false; + } + + int socketFd = -1; + if (!resolveAndConnect(urlHost, urlPort, socketFd)) { + LOGW("[HttpClient] resolve/connect failed for %s:%d\n", urlHost.c_str(), urlPort); + return false; + } + + std::string httpRequest; + httpRequest += "GET "; + httpRequest += urlPath; + httpRequest += " HTTP/1.1\r\n"; + httpRequest += "Host: "; + httpRequest += urlHost; + httpRequest += "\r\n"; + httpRequest += "User-Agent: MinecraftPE\r\n"; + httpRequest += "Connection: close\r\n"; + httpRequest += "\r\n"; + + send(socketFd, httpRequest.c_str(), (int)httpRequest.size(), 0); + + std::vector rawResponse; + readAll(socketFd, rawResponse); + +#if defined(_WIN32) + closesocket(socketFd); +#else + close(socketFd); +#endif + + if (rawResponse.empty()) { + LOGW("[HttpClient] no response data from %s\n", urlToDownload.c_str()); + return false; + } + + // find the end of the headers (\r\n\r\n) so we can split headers and body + const std::string headerDelimiter = "\r\n\r\n"; + auto headerEndIt = std::search(rawResponse.begin(), rawResponse.end(), headerDelimiter.begin(), headerDelimiter.end()); + if (headerEndIt == rawResponse.end()) { + // we didn't find the end of headers :( + return false; + } + + // extract the header block as a string so we can inspect it + size_t headerLength = headerEndIt - rawResponse.begin(); + std::string headers(reinterpret_cast(rawResponse.data()), headerLength); + size_t bodyStartIndex = headerLength + headerDelimiter.size(); + + int statusCode = 0; + if (!extractStatusCode(headers, statusCode)) { + return false; + } + + if (statusCode == 301 || statusCode == 302 || statusCode == 307 || statusCode == 308) { + std::string location = getHeaderValue(headers, "Location"); + if (location.empty()) { + LOGW("[HttpClient] redirect without Location header for %s\n", urlToDownload.c_str()); + return false; + } + LOGI("[HttpClient] redirect %s -> %s\n", urlToDownload.c_str(), location.c_str()); + urlToDownload = location; + continue; + } + + if (statusCode != 200) { + // if we got any status other than 200 OK, log what happened + std::string bodySnippet; + if (!outBody.empty()) { + size_t len = outBody.size() < 1024 ? outBody.size() : 1024; + bodySnippet.assign(outBody.begin(), outBody.begin() + len); + } + LOGW("[HttpClient] HTTP status %d for %s\n", statusCode, urlToDownload.c_str()); + LOGW("[HttpClient] Headers:\n%s\n", headers.c_str()); + LOGW("[HttpClient] Body (up to 1024 bytes):\n%s\n", bodySnippet.c_str()); + return false; + } + + // everything looks good! copy just the body bytes (after the headers) into outBody. + outBody.assign(rawResponse.begin() + bodyStartIndex, rawResponse.end()); + return true; + } + + return false; +} + +} // namespace HttpClient diff --git a/src/platform/HttpClient.h b/src/platform/HttpClient.h new file mode 100644 index 0000000..68f3c96 --- /dev/null +++ b/src/platform/HttpClient.h @@ -0,0 +1,13 @@ +#ifndef HTTPCLIENT_H__ +#define HTTPCLIENT_H__ + +#include +#include + +namespace HttpClient { + +bool download(const std::string& url, std::vector& outBody); + +} // namespace HttpClient + +#endif /* HTTPCLIENT_H__ */ diff --git a/src/platform/PngLoader.cpp b/src/platform/PngLoader.cpp new file mode 100644 index 0000000..bbe7bb3 --- /dev/null +++ b/src/platform/PngLoader.cpp @@ -0,0 +1,98 @@ +#include "PngLoader.h" + +#include +#include + +struct MemoryReader { + const unsigned char* data; + size_t size; + size_t pos; +}; + +static void pngMemoryRead(png_structp pngPtr, png_bytep outBytes, png_size_t byteCountToRead) { +#ifndef STANDALONE_SERVER + MemoryReader* reader = (MemoryReader*)png_get_io_ptr(pngPtr); + if (!reader) + return; + + if (reader->pos + byteCountToRead > reader->size) { + png_error(pngPtr, "Read past end of buffer"); + return; + } + + memcpy(outBytes, reader->data + reader->pos, byteCountToRead); + reader->pos += byteCountToRead; +#endif +} + +TextureData loadPngFromMemory(const unsigned char* data, size_t size) { + TextureData out; +#ifndef STANDALONE_SERVER + if (!data || size == 0) return out; + + png_structp pngPtr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); + if (!pngPtr) return out; + + png_infop infoPtr = png_create_info_struct(pngPtr); + if (!infoPtr) { + png_destroy_read_struct(&pngPtr, NULL, NULL); + return out; + } + + if (setjmp(png_jmpbuf(pngPtr))) { + png_destroy_read_struct(&pngPtr, &infoPtr, NULL); + return out; + } + + MemoryReader reader; + reader.data = data; + reader.size = size; + reader.pos = 0; + + png_set_read_fn(pngPtr, &reader, pngMemoryRead); + png_read_info(pngPtr, infoPtr); + + // Convert any color type to 8-bit RGBA + if (png_get_color_type(pngPtr, infoPtr) == PNG_COLOR_TYPE_PALETTE) + png_set_palette_to_rgb(pngPtr); + if (png_get_color_type(pngPtr, infoPtr) == PNG_COLOR_TYPE_GRAY && png_get_bit_depth(pngPtr, infoPtr) < 8) + png_set_expand_gray_1_2_4_to_8(pngPtr); + if (png_get_valid(pngPtr, infoPtr, PNG_INFO_tRNS)) + png_set_tRNS_to_alpha(pngPtr); + if (png_get_bit_depth(pngPtr, infoPtr) == 16) + png_set_strip_16(pngPtr); + + // Ensure we always have RGBA (4 bytes per pixel) + // Only add alpha if the image lacks it (e.g., RGB skin files). + png_set_gray_to_rgb(pngPtr); + + // Handle interlaced PNGs properly + int number_passes = png_set_interlace_handling(pngPtr); + + png_read_update_info(pngPtr, infoPtr); + + int colorType = png_get_color_type(pngPtr, infoPtr); + if (colorType == PNG_COLOR_TYPE_RGB) { + png_set_filler(pngPtr, 0xFF, PNG_FILLER_AFTER); + } + + out.w = png_get_image_width(pngPtr, infoPtr); + out.h = png_get_image_height(pngPtr, infoPtr); + + png_bytep* rowPtrs = new png_bytep[out.h]; + out.data = new unsigned char[4 * out.w * out.h]; + out.memoryHandledExternally = false; + + int rowStrideBytes = 4 * out.w; + for (int i = 0; i < out.h; i++) { + rowPtrs[i] = (png_bytep)&out.data[i*rowStrideBytes]; + } + + png_read_image(pngPtr, rowPtrs); + + png_destroy_read_struct(&pngPtr, &infoPtr, NULL); + delete[] rowPtrs; +#endif + + return out; +} diff --git a/src/platform/PngLoader.h b/src/platform/PngLoader.h new file mode 100644 index 0000000..cc1d0a4 --- /dev/null +++ b/src/platform/PngLoader.h @@ -0,0 +1,12 @@ +#ifndef PNGLOADER_H__ +#define PNGLOADER_H__ + +#include "../client/renderer/TextureData.h" + +#include + +/// Decode a PNG (from memory) into a TextureData. +/// Returns an empty TextureData on failure. +TextureData loadPngFromMemory(const unsigned char* data, size_t size); + +#endif // PNGLOADER_H__ diff --git a/src/platform/audio/SoundSystemAL.cpp b/src/platform/audio/SoundSystemAL.cpp index 707ebe2..3000608 100755 --- a/src/platform/audio/SoundSystemAL.cpp +++ b/src/platform/audio/SoundSystemAL.cpp @@ -10,13 +10,10 @@ static const char* errIdString = 0; void checkError() { + ALenum err = alGetError(); + if(err == AL_NO_ERROR) return; - while (1) { - ALenum err = alGetError(); - if(err == AL_NO_ERROR) return; - - LOGI("### SoundSystemAL error: %d ####: %s\n", err, errIdString==0?"(none)":errIdString); - } + LOGI("### SoundSystemAL error: %d ####: %s\n", err, errIdString==0?"(none)":errIdString); } //typedef ALvoid AL_APIENTRY (*alBufferDataStaticProcPtr) (const ALint bid, ALenum format, ALvoid *data, ALsizei size, ALsizei freq); @@ -140,7 +137,7 @@ void SoundSystemAL::playAt( const SoundDesc& sound, float x, float y, float z, f { if (pitch < 0.01f) pitch = 1; - LOGI("playing sound '%s' with volume/pitch: %f, %f @ %f, %f, %f\n", sound.name.c_str(), volume, pitch, x, y, z); + //LOGI("playing sound '%s' with volume/pitch: %f, %f @ %f, %f, %f\n", sound.name.c_str(), volume, pitch, x, y, z); ALuint bufferID; if (!getBufferId(sound, &bufferID)) { @@ -151,7 +148,7 @@ void SoundSystemAL::playAt( const SoundDesc& sound, float x, float y, float z, f } errIdString = "Get buffer"; checkError(); - LOGI("playing sound %d - '%s' with volume/pitch: %f, %f @ %f, %f, %f\n", bufferID, sound.name.c_str(), volume, pitch, x, y, z); + //LOGI("playing sound %d - '%s' with volume/pitch: %f, %f @ %f, %f, %f\n", bufferID, sound.name.c_str(), volume, pitch, x, y, z); int sourceIndex; errIdString = "Get free index"; @@ -232,12 +229,12 @@ bool SoundSystemAL::getBufferId(const SoundDesc& sound, ALuint* buf) { : (sound.channels==2? AL_FORMAT_STEREO8 : AL_FORMAT_MONO8); alBufferData(bufferID, format, sound.frames, sound.size, sound.frameRate); - LOGI("Creating %d (%p) from sound: '%s'\n", bufferID, sound.frames, sound.name.c_str()); + //LOGI("Creating %d (%p) from sound: '%s'\n", bufferID, sound.frames, sound.name.c_str()); errIdString = "Buffer data"; - LOGI("Creating buffer with data: %d (%d), %p, %d, %d\n", format, sound.byteWidth, sound.frames, sound.size, sound.frameRate); + //LOGI("Creating buffer with data: %d (%d), %p, %d, %d\n", format, sound.byteWidth, sound.frames, sound.size, sound.frameRate); checkError(); - LOGI("Sound ch: %d, fmt: %d, frames: %p, len: %f, fr: %d, sz: %d, numfr: %d\n", sound.channels, format, sound.frames, sound.length(), sound.frameRate, sound.size, sound.numFrames); + //LOGI("Sound ch: %d, fmt: %d, frames: %p, len: %f, fr: %d, sz: %d, numfr: %d\n", sound.channels, format, sound.frames, sound.length(), sound.frameRate, sound.size, sound.numFrames); Buffer buffer; @@ -248,6 +245,10 @@ bool SoundSystemAL::getBufferId(const SoundDesc& sound, ALuint* buf) { _buffers.push_back(buffer); // @huge @attn @note @fix: The original data is free'd + // On PLATFORM_DESKTOP the PCM data lives in static arrays (not heap), + // so calling delete[] on them causes a debug-heap __debugbreak crash. +#if !defined(PLATFORM_DESKTOP) sound.destroy(); +#endif return true; } diff --git a/src/platform/audio/SoundSystemAL.h b/src/platform/audio/SoundSystemAL.h index ca0ac7f..a7c225f 100755 --- a/src/platform/audio/SoundSystemAL.h +++ b/src/platform/audio/SoundSystemAL.h @@ -3,8 +3,14 @@ #include "SoundSystem.h" -#include -#include +// If audio breaks for other platforms, this is probably why. Here, I'm just calling where Apple's OpenAL headers live (they arent in just "AL" +#if defined(__APPLE__) + #include + #include +#else + #include + #include +#endif #include #include diff --git a/src/platform/audio/SoundSystemSL.cpp b/src/platform/audio/SoundSystemSL.cpp index 0bc8629..15b4d7c 100755 --- a/src/platform/audio/SoundSystemSL.cpp +++ b/src/platform/audio/SoundSystemSL.cpp @@ -91,7 +91,7 @@ void SoundSystemSL::setListenerPos( float x, float y, float z ) return; } - SLVec3D pos = {1000.0f * x, 1000.0f * y, 1000.0f * z}; + SLVec3D pos = {(SLint32)(1000.0f * x), (SLint32)(1000.0f * y), (SLint32)(1000.0f * z)}; SLresult res = (*listener)->SetLocationCartesian(listener, &pos); checkErr(res); } @@ -115,10 +115,10 @@ void SoundSystemSL::playAt( const SoundDesc& sound, float x, float y, float z, f SLDataLocator_AndroidSimpleBufferQueue uri = {SL_DATALOCATOR_ANDROIDSIMPLEBUFFERQUEUE, 2}; SLDataFormat_PCM mime = { SL_DATAFORMAT_PCM, - sound.channels, - sound.frameRate * 1000, - sound.byteWidth << 3, - sound.byteWidth << 3, + (SLuint32)sound.channels, + (SLuint32)(sound.frameRate * 1000), + (SLuint32)(sound.byteWidth << 3), + (SLuint32)(sound.byteWidth << 3), sound.channels==1? SL_SPEAKER_FRONT_CENTER : SL_SPEAKER_FRONT_LEFT | SL_SPEAKER_FRONT_RIGHT, SL_BYTEORDER_LITTLEENDIAN diff --git a/src/platform/input/Keyboard.cpp b/src/platform/input/Keyboard.cpp index 78ead92..3f9f0df 100755 --- a/src/platform/input/Keyboard.cpp +++ b/src/platform/input/Keyboard.cpp @@ -1,20 +1,59 @@ #include "Keyboard.h" -/* -const int KeyboardAction::KEYUP = 0; -const int KeyboardAction::KEYDOWN = 1; -*/ +int Keyboard::_states[256] = {0}; -int - Keyboard::_states[256] = {0}; +std::vector Keyboard::_inputs; +std::vector Keyboard::_inputText; -std::vector - Keyboard::_inputs; -std::vector - Keyboard::_inputText; +int Keyboard::_index = -1; -int - Keyboard::_index = -1; +int Keyboard::_textIndex = -1; -int - Keyboard::_textIndex = -1; \ No newline at end of file +const char* Keyboard::getKeyName(int key) { + switch (key) { + case KEY_A: return "A"; + case KEY_B: return "B"; + case KEY_C: return "C"; + case KEY_D: return "D"; + case KEY_E: return "E"; + case KEY_F: return "F"; + case KEY_G: return "G"; + case KEY_H: return "H"; + case KEY_I: return "I"; + case KEY_J: return "J"; + case KEY_K: return "K"; + case KEY_L: return "L"; + case KEY_M: return "M"; + case KEY_N: return "N"; + case KEY_O: return "O"; + case KEY_P: return "P"; + case KEY_Q: return "Q"; + case KEY_R: return "R"; + case KEY_S: return "S"; + case KEY_T: return "T"; + case KEY_U: return "U"; + case KEY_V: return "V"; + case KEY_W: return "W"; + case KEY_X: return "X"; + case KEY_Y: return "Y"; + case KEY_Z: return "Z"; + case KEY_BACKSPACE: return "Backspace"; + case KEY_RETURN: return "Return"; + case KEY_F1: return "F1"; + case KEY_F2: return "F2"; + case KEY_F3: return "F3"; + case KEY_F4: return "F4"; + case KEY_F5: return "F5"; + case KEY_F6: return "F6"; + case KEY_F7: return "F7"; + case KEY_F8: return "F8"; + case KEY_F9: return "F9"; + case KEY_F10: return "F10"; + case KEY_F11: return "F11"; + case KEY_F12: return "F12"; + case KEY_ESCAPE: return "Esc"; + case KEY_SPACE: return "Space"; + case KEY_LSHIFT: return "Left Shift"; + default: return "Unknown"; + } +} \ No newline at end of file diff --git a/src/platform/input/Keyboard.h b/src/platform/input/Keyboard.h index aaf7a89..91868a0 100755 --- a/src/platform/input/Keyboard.h +++ b/src/platform/input/Keyboard.h @@ -56,6 +56,7 @@ public: static const int KEY_Z = 90; static const int KEY_BACKSPACE = 8; + static const int KEY_TAB = 9; static const int KEY_RETURN = 13; static const int KEY_F1 = 112; @@ -71,9 +72,11 @@ public: static const int KEY_F11 = 122; static const int KEY_F12 = 123; + static const int KEY_ESCAPE = 27; static const int KEY_SPACE = 32; static const int KEY_LSHIFT = 10; + static const int KEY_LEFT_CTRL = 232; static bool isKeyDown(int keyCode) { return _states[keyCode] == KeyboardAction::KEYDOWN; @@ -125,6 +128,8 @@ public: static char getChar() { return _inputText[_textIndex]; } + + static const char* getKeyName(int key); private: static int _index; static int _textIndex; diff --git a/src/raknet/FileList.cpp b/src/raknet/FileList.cpp index f4345c2..db6890a 100755 --- a/src/raknet/FileList.cpp +++ b/src/raknet/FileList.cpp @@ -10,8 +10,8 @@ #include -#elif !defined ( __APPLE__ ) && !defined ( __APPLE_CC__ ) && !defined ( __PPC__ ) && !defined ( __FreeBSD__ ) && !defined ( __S3E__ ) -#include +// #elif !defined ( __APPLE__ ) && !defined ( __APPLE_CC__ ) && !defined ( __PPC__ ) && !defined ( __FreeBSD__ ) && !defined ( __S3E__ ) +// #include #endif diff --git a/src/raknet/GetTime.cpp b/src/raknet/GetTime.cpp index 4f868f8..ce7451c 100755 --- a/src/raknet/GetTime.cpp +++ b/src/raknet/GetTime.cpp @@ -140,7 +140,9 @@ RakNet::TimeUS GetTimeUS_Windows( void ) #if _MSC_VER >= 1400 && defined (_M_X64) GetProcessAffinityMask(mProc, (PDWORD_PTR)&mProcMask, (PDWORD_PTR)&mSysMask); #else +#ifndef __MINGW32__ GetProcessAffinityMask(mProc, &mProcMask, &mSysMask); +#endif #endif mThread = GetCurrentThread(); diff --git a/src/raknet/RakPeer.cpp b/src/raknet/RakPeer.cpp index 698374e..a24a2b5 100755 --- a/src/raknet/RakPeer.cpp +++ b/src/raknet/RakPeer.cpp @@ -124,7 +124,7 @@ static const unsigned int MAX_OFFLINE_DATA_LENGTH=400; // I set this because I l #pragma warning(disable:4309) // 'initializing' : truncation of constant value #endif // Make sure highest bit is 0, so isValid in DatagramHeaderFormat is false -static const char OFFLINE_MESSAGE_DATA_ID[16]={0x00,0xFF,0xFF,0x00,0xFE,0xFE,0xFE,0xFE,0xFD,0xFD,0xFD,0xFD,0x12,0x34,0x56,0x78}; +static const unsigned char OFFLINE_MESSAGE_DATA_ID[16]={0x00,0xFF,0xFF,0x00,0xFE,0xFE,0xFE,0xFE,0xFD,0xFD,0xFD,0xFD,0x12,0x34,0x56,0x78}; struct PacketFollowedByData { diff --git a/src/raknet/WindowsIncludes.h b/src/raknet/WindowsIncludes.h index 7e504dc..828614c 100755 --- a/src/raknet/WindowsIncludes.h +++ b/src/raknet/WindowsIncludes.h @@ -1,8 +1,8 @@ #if defined(X360__) #elif defined (_WIN32) -#include +#include #include -#include +#include // Must always include Winsock2.h before windows.h // or else: diff --git a/src/server/ArgumentsSettings.cpp b/src/server/ArgumentsSettings.cpp index 88bcd51..d41633c 100755 --- a/src/server/ArgumentsSettings.cpp +++ b/src/server/ArgumentsSettings.cpp @@ -17,6 +17,11 @@ ArgumentsSettings::ArgumentsSettings(int numArguments, char** arguments) levelName = std::string(arguments[a+1]); a++; // Skip the next argument since it's part of this one. } + } else if(strcmp(arguments[a], "--gamemode") == 0) { + if(a + 1 < numArguments) { + gamemode = std::string(arguments[a+1]); + a++; // Skip the next argument since it's part of this one. + } } else if(strcmp(arguments[a], "--leveldir") == 0) { if(a + 1 < numArguments) { levelDir = std::string(arguments[a+1]); @@ -51,6 +56,9 @@ std::string ArgumentsSettings::getServerKey() { std::string ArgumentsSettings::getCachePath() { return cachePath; } +std::string ArgumentsSettings::getGamemode() { + return gamemode; +} std::string ArgumentsSettings::getLevelDir() { return levelDir; } diff --git a/src/server/ArgumentsSettings.h b/src/server/ArgumentsSettings.h index 0dcd781..2861b48 100755 --- a/src/server/ArgumentsSettings.h +++ b/src/server/ArgumentsSettings.h @@ -4,20 +4,27 @@ class ArgumentsSettings { public: ArgumentsSettings(int numArguments, char** arguments); + std::string getExternalPath(); std::string getLevelName(); std::string getServerKey(); std::string getCachePath(); std::string getLevelDir(); + std::string getGamemode(); + bool getShowHelp(); + int getPort(); private: std::string cachePath; std::string externalPath; std::string levelName; + std::string gamemode; std::string levelDir; std::string serverKey; + bool showHelp; + int port; }; diff --git a/src/server/ServerLevel.cpp b/src/server/ServerLevel.cpp index e57d6b8..d65ee86 100755 --- a/src/server/ServerLevel.cpp +++ b/src/server/ServerLevel.cpp @@ -12,16 +12,19 @@ ServerLevel::ServerLevel(LevelStorage* levelStorage, const std::string& levelNam void ServerLevel::updateSleepingPlayerList() { bool allPlayersWasSleeping = allPlayersAreSleeping; allPlayersAreSleeping = !players.empty(); - for(PlayerList::iterator it = players.begin(); it != players.end(); ++it) { + + for (PlayerList::iterator it = players.begin(); it != players.end(); ++it) { Player* player = *it; - if(!player->isSleeping()) { + + if (!player->isSleeping()) { allPlayersAreSleeping = false; break; } } - if(!allPlayersWasSleeping && allPlayersAreSleeping) { + if (!allPlayersWasSleeping && allPlayersAreSleeping) { levelEvent(NULL, LevelEvent::ALL_PLAYERS_SLEEPING, 0, 0, 0, 0); - for(PlayerList::iterator it = players.begin(); it != players.end(); ++it) { + + for (PlayerList::iterator it = players.begin(); it != players.end(); ++it) { (*it)->setAllPlayersSleeping(); } } @@ -29,23 +32,26 @@ void ServerLevel::updateSleepingPlayerList() { void ServerLevel::awakenAllPlayers() { allPlayersAreSleeping = false; - for(PlayerList::iterator it = players.begin(); it != players.end(); ++it) { + + for (PlayerList::iterator it = players.begin(); it != players.end(); ++it) { Player* player = *it; - if(player->isSleeping()) { + + if (player->isSleeping()) { player->stopSleepInBed(false, false, true); player->health = Player::MAX_HEALTH; player->lastHealth = Player::MAX_HEALTH; } } + SetHealthPacket packet(Player::MAX_HEALTH); raknetInstance->send(packet); } bool ServerLevel::allPlayersSleeping() { - if(allPlayersAreSleeping && !isClientSide) { + if (allPlayersAreSleeping && !isClientSide) { // all players are sleeping, but have they slept long enough? - for(PlayerList::iterator it = players.begin(); it != players.end(); ++it) { - if(!(*it)->isSleepingLongEnough()) { + for (PlayerList::iterator it = players.begin(); it != players.end(); ++it) { + if (!(*it)->isSleepingLongEnough()) { return false; } } @@ -55,13 +61,17 @@ bool ServerLevel::allPlayersSleeping() { return false; } -void ServerLevel::tick(){ +void ServerLevel::tick() { super::tick(); - if(allPlayersSleeping()) { + + if (allPlayersSleeping()) { long newTime = levelData.getTime() + TICKS_PER_DAY; + levelData.setTime(newTime - (newTime % TICKS_PER_DAY)); + SetTimePacket packet(levelData.getTime()); raknetInstance->send(packet); + awakenAllPlayers(); } } diff --git a/src/server/ServerPlayer.cpp b/src/server/ServerPlayer.cpp index cc9a3a2..9f4f1dc 100755 --- a/src/server/ServerPlayer.cpp +++ b/src/server/ServerPlayer.cpp @@ -19,14 +19,17 @@ #include "../network/packet/AnimatePacket.h" #include "../world/level/tile/entity/ChestTileEntity.h" #include "../network/packet/HurtArmorPacket.h" +#include "network/packet/SendInventoryPacket.h" +#include "world/entity/player/Inventory.h" -ServerPlayer::ServerPlayer( Minecraft* minecraft, Level* level ) +ServerPlayer::ServerPlayer( Minecraft* minecraft, Level* level, bool proto) : super(level, minecraft->isCreativeMode()), _mc(minecraft), - _sentHealth(-999), - _containerCounter(0) + _prevHealth(-999), + _containerCounter(0), + isNewProto(proto) { - hasFakeInventory = true; + // hasFakeInventory = true; footSize = 0; } @@ -58,8 +61,8 @@ void ServerPlayer::tick() { if (containerMenu) containerMenu->broadcastChanges(); - if (health != _sentHealth) { - _sentHealth = health; + if (health != _prevHealth) { + _prevHealth = health; SetHealthPacket packet(health); _mc->raknetInstance->send(owner, packet); } @@ -67,7 +70,16 @@ void ServerPlayer::tick() { void ServerPlayer::take( Entity* e, int orgCount ) { TakeItemEntityPacket packet(e->entityId, entityId); + // SendInventoryPacket packet(this, false); _mc->raknetInstance->send(packet); + printf("TakeItemEntityPacket \n"); + + LOGI("Inventory:\n"); + for (int i = 0; i < inventory->numLinkedSlots; i++) { + auto item = inventory->getItem(i); + if (item) + LOGI("\t %i: %s (%i)\n", i, item->getName().c_str(), item->count); + } super::take(e, orgCount); } @@ -118,20 +130,20 @@ bool ServerPlayer::hasResource( int id ) { void ServerPlayer::setContainerData( BaseContainerMenu* menu, int id, int value ) { ContainerSetDataPacket p(menu->containerId, id, value); _mc->raknetInstance->send(owner, p); - //LOGI("Setting container data for id %d: %d\n", id, value); + LOGI("Setting container data for id %d: %d\n", id, value); } void ServerPlayer::slotChanged( BaseContainerMenu* menu, int slot, const ItemInstance& item, bool isResultSlot ) { if (isResultSlot) return; ContainerSetSlotPacket p(menu->containerId, slot, item); _mc->raknetInstance->send(owner, p); - //LOGI("Slot %d changed\n", slot); + LOGI("Slot %d changed\n", slot); } void ServerPlayer::refreshContainer( BaseContainerMenu* menu, const std::vector& items ) { ContainerSetContentPacket p(menu->containerId, menu->getItems()); _mc->raknetInstance->send(owner, p); - //LOGI("Refreshing container with %d items\n", items.size()); + LOGI("Refreshing container with %zu items\n", items.size()); } void ServerPlayer::nextContainerCounter() { @@ -163,3 +175,12 @@ void ServerPlayer::displayClientMessage( const std::string& messageId ) { ChatPacket package(messageId); _mc->raknetInstance->send(owner, package); } + +void ServerPlayer::causeFallDamage(float distance) { + int dmg = (int) ceil((distance - 3)); + if (dmg > 0) { + SetHealthPacket packet(SetHealthPacket::HEALTH_MODIFY_OFFSET + dmg); + _mc->raknetInstance->send(owner, packet); + } + super::causeFallDamage(distance); +} \ No newline at end of file diff --git a/src/server/ServerPlayer.h b/src/server/ServerPlayer.h index 48fb02e..c578025 100755 --- a/src/server/ServerPlayer.h +++ b/src/server/ServerPlayer.h @@ -15,7 +15,7 @@ class ServerPlayer: public Player, { typedef Player super; public: - ServerPlayer(Minecraft* minecraft, Level* level); + ServerPlayer(Minecraft* minecraft, Level* level, bool proto); ~ServerPlayer(); @@ -43,13 +43,29 @@ public: virtual void stopSleepInBed(bool forcefulWakeUp, bool updateLevelList, bool saveRespawnPoint); void completeUsingItem(); + + void setLastMoveTicks(int lastMoveTicks) { this->lastMoveTicks = lastMoveTicks; } + int getLastMoveTicks() { return lastMoveTicks; } + + void setTicksInAir(int ticksInAir) { this->ticksInAir = ticksInAir; } + int getTicksInAir() { return ticksInAir; } + + void setNewProto(bool proto) { isNewProto = proto; } + bool getProto() { return isNewProto; } + + virtual void causeFallDamage(float distance); private: void nextContainerCounter(); void setContainerMenu( BaseContainerMenu* menu ); Minecraft* _mc; - int _sentHealth; + int _prevHealth; int _containerCounter; + + int lastMoveTicks = 0; + int ticksInAir = 0; + + bool isNewProto = false; }; #endif /*ServerPlayer_H__*/ diff --git a/src/util/Color.cpp b/src/util/Color.cpp new file mode 100644 index 0000000..4cc9fba --- /dev/null +++ b/src/util/Color.cpp @@ -0,0 +1,98 @@ +#include "Mth.h" + +#include "Color.h" +#include + +//Creates an opaque sRGB color with the specified red, green, and blue values in the range (0.0 - 1.0). +//Alpha is defaulted to 1.0. The actual color used in rendering depends on finding the best match given the color space +//available for a particular output device. +//Parameters: +//r - the red component +//g - the green component +//b - the blue component +//Throws: +//IllegalArgumentException - if r, g or b are outside of the range 0.0 to 1.0, inclusive +Color::Color( float r, float g, float b) +{ + assert( r >= 0.0f && r <= 1.0f ); + assert( g >= 0.0f && g <= 1.0f ); + assert( b >= 0.0f && b <= 1.0f ); + + //argb + colour = ( (0xFF<<24) | ( (int)(r*255)<<16 ) | ( (int)(g*255)<<8 ) | ( (int)(b*255) ) ); +} + +Color::Color( int r, int g, int b) +{ + colour = ( (0xFF<<24) | ( (r&0xff)<<16 ) | ( (g&0xff)<<8 ) | ( (b&0xff) ) ); +} + + +//Creates a Color object based on the specified values for the HSB color model. +//The s and b components should be floating-point values between zero and one (numbers in the range 0.0-1.0). +//The h component can be any floating-point number. The floor of this number is subtracted from it to create a fraction between 0 and 1. +//This fractional number is then multiplied by 360 to produce the hue angle in the HSB color model. +// +//Parameters: +//h - the hue component +//s - the saturation of the color +//b - the brightness of the color +//Returns: +//a Color object with the specified hue, saturation, and brightness. +Color Color::getHSBColor(float hue, float saturation, float brightness) +{ + int r = 0, g = 0, b = 0; + if (saturation == 0) + { + r = g = b = (int) (brightness * 255.0f + 0.5f); + } + else + { + float h = (hue - (float)Mth::floor(hue)) * 6.0f; + float f = h - (float)Mth::floor(h); + float p = brightness * (1.0f - saturation); + float q = brightness * (1.0f - saturation * f); + float t = brightness * (1.0f - (saturation * (1.0f - f))); + switch ((int) h) + { + case 0: + r = (int) (brightness * 255.0f + 0.5f); + g = (int) (t * 255.0f + 0.5f); + b = (int) (p * 255.0f + 0.5f); + break; + case 1: + r = (int) (q * 255.0f + 0.5f); + g = (int) (brightness * 255.0f + 0.5f); + b = (int) (p * 255.0f + 0.5f); + break; + case 2: + r = (int) (p * 255.0f + 0.5f); + g = (int) (brightness * 255.0f + 0.5f); + b = (int) (t * 255.0f + 0.5f); + break; + case 3: + r = (int) (p * 255.0f + 0.5f); + g = (int) (q * 255.0f + 0.5f); + b = (int) (brightness * 255.0f + 0.5f); + break; + case 4: + r = (int) (t * 255.0f + 0.5f); + g = (int) (p * 255.0f + 0.5f); + b = (int) (brightness * 255.0f + 0.5f); + break; + case 5: + r = (int) (brightness * 255.0f + 0.5f); + g = (int) (p * 255.0f + 0.5f); + b = (int) (q * 255.0f + 0.5f); + break; + } + } + + + return Color( r, g, b ); +} + +int Color::getRGB() +{ + return colour; +} \ No newline at end of file diff --git a/src/util/Color.h b/src/util/Color.h new file mode 100644 index 0000000..a9d31ec --- /dev/null +++ b/src/util/Color.h @@ -0,0 +1,15 @@ +#pragma once + +class Color +{ +private: + int colour; + +public: + //Creates an opaque sRGB color with the specified red, green, and blue values in the range (0.0 - 1.0). + Color( float r, float g, float b); + Color( int r, int g, int b); + + static Color getHSBColor(float h, float s, float b); + int getRGB(); +}; \ No newline at end of file diff --git a/src/util/Mth.cpp b/src/util/Mth.cpp index d19eef6..566f3cf 100755 --- a/src/util/Mth.cpp +++ b/src/util/Mth.cpp @@ -9,11 +9,6 @@ static Random _rand; namespace Mth { - const float PI = 3.1415926535897932384626433832795028841971f; // exactly! - const float TWO_PI = 2.0f * PI; // exactly! - const float DEGRAD = PI / 180.0f; - const float RADDEG = 180.0f / PI; - static float _sin[65536]; static const float _sinScale = 65536.0f / (2.0f * PI); diff --git a/src/util/Mth.h b/src/util/Mth.h index 9ec045e..55ce7d6 100755 --- a/src/util/Mth.h +++ b/src/util/Mth.h @@ -6,11 +6,10 @@ #include namespace Mth { - - extern const float PI; - extern const float TWO_PI; - extern const float RADDEG; - extern const float DEGRAD; + constexpr float PI = 3.1415926535897932384626433832795028841971f; // exactly! + constexpr float TWO_PI = 2.0f * PI; // exactly! + constexpr float DEGRAD = PI / 180.0f; + const float RADDEG = 180.0f / PI; void initMth(); diff --git a/src/util/PerfRenderer.cpp b/src/util/PerfRenderer.cpp index 34f818a..0ae24d0 100755 --- a/src/util/PerfRenderer.cpp +++ b/src/util/PerfRenderer.cpp @@ -75,7 +75,7 @@ void PerfRenderer::renderFpsMeter( float tickTime ) glDisable2(GL_TEXTURE_2D); Tesselator& t = Tesselator::instance; - t.begin(GL_TRIANGLES); + t.begin(GL_QUADS); int hh1 = (int) (usPer60Fps / 200); float count = (float)frameTimes.size(); t.color(0x20000000); @@ -117,7 +117,8 @@ void PerfRenderer::renderFpsMeter( float tickTime ) t.color(0xff000000 + cc * 256); } - float time = 10 * 1000 * frameTimes[i] / 200; +// float time = 10 * 1000 * frameTimes[i] / 200; + float time = frameTimes[i] * 4000.0f; float time2 = 10 * 1000 * tickTimes[i] / 200; t.vertex(i + 0.5f, _mc->height - time + 0.5f, 0); @@ -210,12 +211,12 @@ void PerfRenderer::renderFpsMeter( float tickTime ) msg << result.name; float xx = (float)(x - r); float yy = (float)(y + r/2 + i * 8 + 20); - _font->drawShadow(msg.str(), xx, yy, result.getColor()); + _font->drawShadow(msg.str(), xx + 10 + 10, yy, result.getColor()); std::string msg2 = toPercentString(result.percentage); //LOGI("name: %s: perc: %f == %s @ %d, %d\n", msg.str().c_str(), result.percentage, msg2.c_str(), xx, yy); - _font->drawShadow(msg2, xx - 50 - _font->width(msg2), yy, result.getColor()); + _font->drawShadow(msg2, xx + 10 + 10 - _font->width(msg2), yy, result.getColor()); msg2 = toPercentString(result.globalPercentage); - _font->drawShadow(msg2, xx - _font->width(msg2), yy, result.getColor()); + _font->drawShadow(msg2, xx + 10 + 10 - _font->width(msg2), yy, result.getColor()); } } diff --git a/src/util/PerfTimer.h b/src/util/PerfTimer.h index ba96b08..f4ed974 100755 --- a/src/util/PerfTimer.h +++ b/src/util/PerfTimer.h @@ -6,15 +6,21 @@ #include "StringUtils.h" //package util; -#ifdef PROFILER +//#ifdef PROFILER #define TIMER_PUSH(x) PerfTimer::push(x) #define TIMER_POP() PerfTimer::pop() #define TIMER_POP_PUSH(x) PerfTimer::popPush(x) -#else - #define TIMER_PUSH(x) ((void*)0) - #define TIMER_POP() ((void*)0) - #define TIMER_POP_PUSH(x) ((void*)0) -#endif +// #elif defined(SERVER_PROFILER) +// #include "ServerProfiler.h" + +// #define TIMER_PUSH(x) ServerProfiler::push(x) +// #define TIMER_POP() ServerProfiler::pop() +// #define TIMER_POP_PUSH(x) ServerProfiler::popPush(x) +//#else +// #define TIMER_PUSH(x) ((void*)0) +// #define TIMER_POP() ((void*)0) +// #define TIMER_POP_PUSH(x) ((void*)0) +//#endif class PerfTimer { diff --git a/src/util/ServerProfiler.cpp b/src/util/ServerProfiler.cpp new file mode 100644 index 0000000..0fa3755 --- /dev/null +++ b/src/util/ServerProfiler.cpp @@ -0,0 +1,4 @@ +// #include "ServerProfiler.h" + +// std::stack ServerProfiler::stack; +// std::unordered_map ServerProfiler::times; diff --git a/src/util/ServerProfiler.h b/src/util/ServerProfiler.h new file mode 100644 index 0000000..ab49fa9 --- /dev/null +++ b/src/util/ServerProfiler.h @@ -0,0 +1,43 @@ +// #pragma once + +// #include +// #include +// #include +// #include +// #include +// #include + +// namespace ServerProfiler { +// using clock = std::chrono::high_resolution_clock; + +// struct Entry { +// std::string name; +// clock::time_point start; +// }; + +// static std::stack stack; +// static std::unordered_map times; + +// inline void push(const std::string& name) { +// stack.push({name, clock::now()}); +// } + +// inline void pop() { +// auto end = clock::now(); +// auto e = stack.top(); +// stack.pop(); + +// double dt = std::chrono::duration(end - e.start).count(); +// times[e.name] += dt; +// } + +// inline void popPush(const std::string& name) { +// pop(); push(name); +// } + +// inline void report() { +// for (auto& it : times) { +// std::cout << "[PROFILER] " << it.first << ": " << it.second << std::endl; +// } +// } +// }; \ No newline at end of file diff --git a/src/world/Difficulty.h b/src/world/Difficulty.h index 8961834..a437eeb 100755 --- a/src/world/Difficulty.h +++ b/src/world/Difficulty.h @@ -3,12 +3,13 @@ //package net.minecraft.world; -class Difficulty { -public: - static const int PEACEFUL = 0; - static const int EASY = 1; - static const int NORMAL = 2; - static const int HARD = 3; +enum Difficulty { + PEACEFUL = 0, + EASY = 1, + NORMAL = 2, + HARD = 3, + + COUNT }; #endif /*NET_MINECRAFT_WORLD__Difficulty_H__*/ diff --git a/src/world/entity/Entity.cpp b/src/world/entity/Entity.cpp index bfccad7..47ac1d8 100755 --- a/src/world/entity/Entity.cpp +++ b/src/world/entity/Entity.cpp @@ -465,6 +465,15 @@ void Entity::tick() baseTick(); } +void Entity::setOnFire(int numberOfSeconds) +{ + int newValue = numberOfSeconds * 20; + if (onFire < newValue) + { + onFire = newValue; + } +} + void Entity::baseTick() { TIMER_PUSH("entityBaseTick"); @@ -871,8 +880,8 @@ bool Entity::load( CompoundTag* tag ) // Add a small padding if standing next to the world edges const float padding = bbWidth * 0.5f + 0.001f; - xx = Mth::clamp(xx, padding, (float)LEVEL_WIDTH - padding); - zz = Mth::clamp(zz, padding, (float)LEVEL_DEPTH - padding); + xx = Mth::clamp(xx, padding, (float)LevelConstants::LEVEL_WIDTH - padding); + zz = Mth::clamp(zz, padding, (float)LevelConstants::LEVEL_DEPTH - padding); xo = xOld = x = xx; yo = yOld = y = yy; diff --git a/src/world/entity/Entity.h b/src/world/entity/Entity.h index 23c229f..be6c4d9 100755 --- a/src/world/entity/Entity.h +++ b/src/world/entity/Entity.h @@ -89,6 +89,8 @@ public: virtual bool isAlive(); virtual bool isOnFire(); + virtual void setOnFire(int numberOfSeconds); + virtual bool isPlayer(); virtual bool isCreativeModeAllowed(); @@ -129,6 +131,7 @@ public: virtual bool isHangingEntity(); virtual int getAuxData(); + virtual void checkFallDamage(float ya, bool onGround); protected: virtual void setRot(float yRot, float xRot); @@ -137,7 +140,6 @@ protected: virtual void resetPos(bool clearMore); virtual void outOfWorld(); - virtual void checkFallDamage(float ya, bool onGround); virtual void causeFallDamage(float fallDamage2); virtual void markHurt(); diff --git a/src/world/entity/Mob.cpp b/src/world/entity/Mob.cpp index 8e7fec6..726f444 100755 --- a/src/world/entity/Mob.cpp +++ b/src/world/entity/Mob.cpp @@ -29,6 +29,7 @@ Mob::Mob(Level* level) invulnerableDuration(20), //hasHair(false), textureName("mob/char.png"), + capeTextureName(""), allowAlpha(true), modelName(""), bobStrength(1), @@ -82,6 +83,15 @@ Mob::Mob(Level* level) yRot = (float) (Mth::random() * Mth::PI * 2); this->footSize = 0.5f; + + // Initialize cape inertia positions + xCape = x; + yCape = y; + zCape = z; + + xc = xCape; + yc = yCape; + zc = zCape; } Mob::~Mob() { @@ -110,6 +120,21 @@ std::string Mob::getTexture() return textureName; } +void Mob::setTextureName(const std::string& name) +{ + textureName = name; +} + +std::string Mob::getCapeTexture() +{ + return capeTextureName; +} + +void Mob::setCapeTextureName(const std::string& name) +{ + capeTextureName = name; +} + bool Mob::isPickable() { return !removed; @@ -144,7 +169,9 @@ void Mob::playAmbientSound() level->playSound(this, ambient, getSoundVolume(), getVoicePitch()); } } - +bool Mob::isOnFire() { + return onFire > 0 || getSharedFlag(SharedFlagsInformation::FLAG_ONFIRE); +} void Mob::baseTick() { oAttackAnim = attackAnim; @@ -152,6 +179,18 @@ void Mob::baseTick() TIMER_PUSH("mobBaseTick"); +// @TODO - check if this section i added to make fire render in mp doesnt break crap - shredder + if (!level->isClientSide) { + // Server side: Tell the client if this mob/player is still burning + setSharedFlag(SharedFlagsInformation::FLAG_ONFIRE, onFire > 0); + } else { + // Client side: If the server flag says we aren't on fire, extinguish local visual timer + if (!getSharedFlag(SharedFlagsInformation::FLAG_ONFIRE)) { + onFire = 0; + } + } +// todo ends here + if (((ambientSoundTime++ & 15) == 0) && random.nextInt(2000) < ambientSoundTime) { ambientSoundTime = -getAmbientSoundInterval(); playAmbientSound(); @@ -185,7 +224,7 @@ void Mob::baseTick() if (hurtTime > 0) hurtTime--; if (invulnerableTime > 0) invulnerableTime--; - if (health <= 0) { + if (this->hasDied()) { deathTime++; if (deathTime > SharedConstants::TicksPerSecond) { beforeRemove(); @@ -269,6 +308,10 @@ void Mob::superTick() void Mob::tick() { + xc = xCape; + yc = yCape; + zc = zCape; + super::tick(); if (arrowCount > 0) { @@ -373,6 +416,18 @@ void Mob::tick() while (xRot - xRotO >= 180) xRotO += 360; animStep += walkSpeed; + + // Reduce jitter by using a smaller interpolation factor (more lag, smoother motion) + double dxCape = x - xCape; + double dyCape = y - yCape; + double dzCape = z - zCape; + + const double interp = 0.15; // small value for smoother cape motion + const double interpY = 0.12; // extra smoothing on vertical movement + + xCape += dxCape * interp; + yCape += dyCape * interpY; + zCape += dzCape * interp; } void Mob::setSize( float w, float h ) @@ -382,7 +437,8 @@ void Mob::setSize( float w, float h ) void Mob::heal( int heal ) { - if (health <= 0) return; + if (this->hasDied()) return; + health += heal; if (health > 20) health = 20; invulnerableTime = invulnerableDuration / 2; @@ -392,7 +448,8 @@ bool Mob::hurt( Entity* source, int dmg ) { if (level->isClientSide) return false; noActionTime = 0; - if (health <= 0) return false; + + if (this->hasDied()) return false; this->walkAnimSpeed = 1.5f; @@ -430,7 +487,7 @@ bool Mob::hurt( Entity* source, int dmg ) } } - if (health <= 0) { + if (this->hasDied()) { if (sound) level->playSound(this, getDeathSound(), getSoundVolume(), getVoicePitch()); die(source); } else { @@ -688,7 +745,6 @@ bool Mob::isWaterMob() void Mob::aiStep() { //@todo? 30 lines of code here in java version - TIMER_PUSH("ai"); if (isImmobile()) { jumping = false; @@ -838,7 +894,7 @@ void Mob::newServerAiStep() { bool Mob::isImmobile() { - return health <= 0; + return this->hasDied(); } void Mob::jumpFromGround() diff --git a/src/world/entity/Mob.h b/src/world/entity/Mob.h index f9c901f..40ee980 100755 --- a/src/world/entity/Mob.h +++ b/src/world/entity/Mob.h @@ -42,10 +42,17 @@ public: virtual void spawnAnim(); virtual std::string getTexture(); + virtual void setTextureName(const std::string& name); - virtual bool isAlive(); + // Optional player cape texture (non-null on clients when available) + virtual std::string getCapeTexture(); + virtual void setCapeTextureName(const std::string& name); + + virtual bool isAlive(); virtual bool isPickable(); virtual bool isPushable(); + + virtual bool isOnFire(); virtual bool isShootable(); MoveControl* getMoveControl(); @@ -120,6 +127,8 @@ public: virtual ItemInstance* getCarriedItem() {return NULL;} virtual int getUseItemDuration() {return 0;} virtual void swing(); + + inline bool hasDied() { return health <= 0; } protected: virtual void causeFallDamage(float distance); @@ -212,7 +221,25 @@ protected: float walkingSpeed; float flyingSpeed; + // Cape inertia positions + double xCape, yCape, zCape; + double xc, yc, zc; + +public: + void setxxa(float xxa) { this->xxa = xxa; } + void setyya(float yya) { this->yya = yya; } + + // Cape position accessors (for renderers) + double getCapeX() const { return xCape; } + double getCapeY() const { return yCape; } + double getCapeZ() const { return zCape; } + + double getCapePrevX() const { return xc; } + double getCapePrevY() const { return yc; } + double getCapePrevZ() const { return zc; } + std::string textureName; + std::string capeTextureName; std::string modelName; int deathScore; float oRun, run; diff --git a/src/world/entity/animal/Chicken.cpp b/src/world/entity/animal/Chicken.cpp index df331e3..cc25555 100755 --- a/src/world/entity/animal/Chicken.cpp +++ b/src/world/entity/animal/Chicken.cpp @@ -51,13 +51,13 @@ void Chicken::aiStep() flap += flapping * 2; //@todo - //if (!isBaby()) { - // if (!level->isClientSide && --eggTime <= 0) { - // level->playSound(this, "mob.chickenplop", 1.0f, (random.nextFloat() - random.nextFloat()) * 0.2f + 1.0f); - // spawnAtLocation(Item::egg->id, 1); - // eggTime = random.nextInt(SharedConstants::TicksPerSecond * 60 * 5) + SharedConstants::TicksPerSecond * 60 * 5; - // } - //} + if (!isBaby()) { + if (!level->isClientSide && --eggTime <= 0) { + level->playSound(this, "mob.chickenplop", 1.0f, (random.nextFloat() - random.nextFloat()) * 0.2f + 1.0f); + spawnAtLocation(Item::egg->id, 1); + eggTime = random.nextInt(SharedConstants::TicksPerSecond * 60 * 5) + SharedConstants::TicksPerSecond * 60 * 5; + } + } } void Chicken::addAdditonalSaveData( CompoundTag* tag ) @@ -102,8 +102,8 @@ void Chicken::dropDeathLoot( /*bool wasKilledByPlayer, int playerBonusLevel*/ ) spawnAtLocation(Item::feather->id, 1); } //// and some meat - //if (isOnFire()) spawnAtLocation(Item::chicken_cooked->id, 1); //@fire - //else + if (isOnFire()) spawnAtLocation(Item::chicken_cooked->id, 1); //@fire + else spawnAtLocation(Item::chicken_raw->id, 1); } diff --git a/src/world/entity/animal/Cow.cpp b/src/world/entity/animal/Cow.cpp index 49df047..a08d39e 100755 --- a/src/world/entity/animal/Cow.cpp +++ b/src/world/entity/animal/Cow.cpp @@ -66,11 +66,11 @@ void Cow::dropDeathLoot( /*bool wasKilledByPlayer, int playerBonusLevel*/ ) { // and some meat count = random.nextInt(3) + 1; for (int i = 0; i < count; i++) { - // if (isOnFire()) { //@fire - // spawnAtLocation(Item::beef_cooked->id, 1); - // } else { + if (isOnFire()) { //@fire + spawnAtLocation(Item::beef_cooked->id, 1); + } else { spawnAtLocation(Item::beef_raw->id, 1); - // } + } } } diff --git a/src/world/entity/animal/Pig.cpp b/src/world/entity/animal/Pig.cpp index b6eb4c0..4c18b01 100755 --- a/src/world/entity/animal/Pig.cpp +++ b/src/world/entity/animal/Pig.cpp @@ -54,8 +54,8 @@ std::string Pig::getDeathSound() int Pig::getDeathLoot() { //@fire - //if (isOnFire()) - // return Item::porkChop_cooked->id; + if (isOnFire()) + return Item::porkChop_cooked->id; return Item::porkChop_raw->id; } diff --git a/src/world/entity/animal/Sheep.cpp b/src/world/entity/animal/Sheep.cpp index 9039fa1..5229434 100755 --- a/src/world/entity/animal/Sheep.cpp +++ b/src/world/entity/animal/Sheep.cpp @@ -1,5 +1,6 @@ #include "Sheep.h" #include "../../item/DyePowderItem.h" +#include "../../level/tile/TallGrass.h" #include "../../level/tile/LevelEvent.h" const float Sheep::COLOR[][3] = { @@ -198,7 +199,7 @@ void Sheep::updateAi() int yy = Mth::floor(y); int zz = Mth::floor(z); - if (/*(level->getTile(xx, yy, zz) == Tile::tallgrass->id && level->getData(xx, yy, zz) == TallGrass::TALL_GRASS) || */ level->getTile(xx, yy - 1, zz) == ((Tile*)Tile::grass)->id) { + if ((level->getTile(xx, yy, zz) == Tile::tallgrass->id && level->getData(xx, yy, zz) == TallGrass::TALL_GRASS) || level->getTile(xx, yy - 1, zz) == ((Tile*)Tile::grass)->id) { eatAnimationTick = EAT_ANIMATION_TICKS; level->broadcastEntityEvent(this, EntityEvent::EAT_GRASS); } @@ -208,11 +209,11 @@ void Sheep::updateAi() int zz = Mth::floor(z); bool ate = false; - /* if (level->getTile(xx, yy, zz) == Tile::tallgrass->id) { - level->levelEvent(LevelEvent::PARTICLES_DESTROY_BLOCK, xx, yy, zz, Tile::tallgrass->id + TallGrass::TALL_GRASS * 256); + if (level->getTile(xx, yy, zz) == Tile::tallgrass->id) { + level->levelEvent(NULL, LevelEvent::PARTICLES_DESTROY_BLOCK, xx, yy, zz, Tile::tallgrass->id + TallGrass::TALL_GRASS * 256); level->setTile(xx, yy, zz, 0); ate = true; - } else */if (level->getTile(xx, yy - 1, zz) == ((Tile*)Tile::grass)->id) { + } else if (level->getTile(xx, yy - 1, zz) == ((Tile*)Tile::grass)->id) { level->levelEvent(NULL, LevelEvent::PARTICLES_DESTROY_BLOCK, xx, yy - 1, zz, ((Tile*)Tile::grass)->id); level->setTile(xx, yy - 1, zz, Tile::dirt->id); ate = true; diff --git a/src/world/entity/monster/Skeleton.cpp b/src/world/entity/monster/Skeleton.cpp index 497944c..e8a8709 100755 --- a/src/world/entity/monster/Skeleton.cpp +++ b/src/world/entity/monster/Skeleton.cpp @@ -19,7 +19,7 @@ void Skeleton::aiStep() { float br = getBrightness(1); if (br > 0.5f) { if (level->canSeeSky(Mth::floor(x), Mth::floor(y), Mth::floor(z)) && random.nextFloat() * 3.5f < (br - 0.4f)) { - hurt(NULL, 1); + // hurt(NULL, 1); // no use anymore since i restored setOnFire - shredder for (int i = 0; i < 5; ++i) { float xa = (2.0f * random.nextFloat() - 1.0f) * (2.0f * random.nextFloat() - 1.0f) * 0.02f; @@ -27,7 +27,7 @@ void Skeleton::aiStep() { float za = (2.0f * random.nextFloat() - 1.0f) * (2.0f * random.nextFloat() - 1.0f) * 0.02f; level->addParticle(PARTICLETYPE(explode), x + random.nextFloat() * bbWidth * 2 - bbWidth, y + random.nextFloat() * bbHeight, z + random.nextFloat() * bbWidth * 2 - bbWidth, xa, ya, za); } - //setOnFire(8); //@todo + setOnFire(8); //@todo } } } diff --git a/src/world/entity/monster/Zombie.cpp b/src/world/entity/monster/Zombie.cpp index 5846375..3654382 100755 --- a/src/world/entity/monster/Zombie.cpp +++ b/src/world/entity/monster/Zombie.cpp @@ -55,7 +55,7 @@ void Zombie::aiStep() { float br = getBrightness(1); if (br > 0.5f) { if (level->canSeeSky(Mth::floor(x), Mth::floor(y), Mth::floor(z)) && random.nextFloat() * 3.5f < (br - 0.4f)) { - hurt(NULL, 1); + // hurt(NULL, 1); // no use anymore since i restored setOnFire - shredder for (int i = 0; i < 5; ++i) { float xa = (2.0f * random.nextFloat() - 1.0f) * (2.0f * random.nextFloat() - 1.0f) * 0.02f; @@ -63,7 +63,7 @@ void Zombie::aiStep() { float za = (2.0f * random.nextFloat() - 1.0f) * (2.0f * random.nextFloat() - 1.0f) * 0.02f; level->addParticle(PARTICLETYPE(explode), x + random.nextFloat() * bbWidth * 2 - bbWidth, y + random.nextFloat() * bbHeight, z + random.nextFloat() * bbWidth * 2 - bbWidth, xa, ya, za); } - //setOnFire(8); //@todo + setOnFire(8); //@todo } } } diff --git a/src/world/entity/player/Inventory.cpp b/src/world/entity/player/Inventory.cpp index 35a7263..00f16a2 100755 --- a/src/world/entity/player/Inventory.cpp +++ b/src/world/entity/player/Inventory.cpp @@ -245,6 +245,7 @@ void Inventory::setupDefault() { addItem(new ItemInstance(Item::seeds_melon)); addItem(new ItemInstance(Item::dye_powder, 1, DyePowderItem::WHITE)); addItem(new ItemInstance(Item::hoe_iron)); + addItem(new ItemInstance(Item::flintAndSteel)); #ifdef RPI Sel[0] = addItem(new ItemInstance(Item::sword_iron)); #else @@ -255,16 +256,16 @@ void Inventory::setupDefault() { } else { #if defined(WIN32) // Survival - addItem(new ItemInstance(Item::ironIngot, 64)); - addItem(new ItemInstance(Item::ironIngot, 34)); - addItem(new ItemInstance(Tile::stonecutterBench)); - addItem(new ItemInstance(Tile::workBench)); - addItem(new ItemInstance(Tile::furnace)); - addItem(new ItemInstance(Tile::wood, 54)); - addItem(new ItemInstance(Item::stick, 14)); - addItem(new ItemInstance(Item::coal, 31)); - addItem(new ItemInstance(Tile::sand, 6)); - addItem(new ItemInstance(Item::dye_powder, 23, DyePowderItem::PURPLE)); + // addItem(new ItemInstance(Item::ironIngot, 64)); + // addItem(new ItemInstance(Item::ironIngot, 34)); + // addItem(new ItemInstance(Tile::stonecutterBench)); + // addItem(new ItemInstance(Tile::workBench)); + // addItem(new ItemInstance(Tile::furnace)); + // addItem(new ItemInstance(Tile::wood, 54)); + // addItem(new ItemInstance(Item::stick, 14)); + // addItem(new ItemInstance(Item::coal, 31)); + // addItem(new ItemInstance(Tile::sand, 6)); + // addItem(new ItemInstance(Item::dye_powder, 23, DyePowderItem::PURPLE)); #endif } #endif @@ -357,3 +358,12 @@ bool Inventory::removeItem( const ItemInstance* samePtr ) { } return false; } + +void Inventory::print() { + LOGI("%s's Inventory:\n", player->name.c_str()); + + for (int i = 0; i < numTotalSlots; i++) { + auto item = getItem(i); + if (item) LOGI("\t %i: %s (%i) %s\n", i, item->getName().c_str(), item->count, (player->inventory->getLinked(i))? "(Linked)" : ""); + } +} \ No newline at end of file diff --git a/src/world/entity/player/Inventory.h b/src/world/entity/player/Inventory.h index 3e8696e..e1ad435 100755 --- a/src/world/entity/player/Inventory.h +++ b/src/world/entity/player/Inventory.h @@ -45,6 +45,8 @@ public: int getAttackDamage(Entity* entity); float getDestroySpeed(Tile* tile); bool canDestroy(Tile* tile); + + void print(); private: void setupDefault(); public: diff --git a/src/world/entity/player/Player.cpp b/src/world/entity/player/Player.cpp index e287acf..a5fcb26 100755 --- a/src/world/entity/player/Player.cpp +++ b/src/world/entity/player/Player.cpp @@ -216,6 +216,7 @@ bool Player::checkBed() { return (level->getTile(bedPosition.x, bedPosition.y, bedPosition.z) == Tile::bed->id); } + void Player::tick() { bool shouldSleep = entityData.getFlag(DATA_PLAYER_FLAGS_ID, PLAYER_SLEEP_FLAG); if(shouldSleep != isSleeping()) { @@ -246,11 +247,24 @@ void Player::tick() { } super::tick(); + if (!level->isClientSide) { + // @TODO - Awful Hack Start, MCPE 0.6 doesn't deal damage with fire to players for some reason on mp, so we force it here to do it, need a better way honestly - shredder + if (level->containsFireTile(this->bb)) { + hurt(NULL, 1); + + if (!isInWater()) { + if (onFire <= 0) { + onFire = 20 * 15; + } + } + } + // Awful hack ends here + foodData.tick(this); - // if (containerMenu != NULL && !containerMenu->stillValid(this)) { - // closeContainer(); - // } + // if (containerMenu != NULL && !containerMenu->stillValid(this)) { + // closeContainer(); + // } } } @@ -376,7 +390,7 @@ void Player::travel(float xa, float ya) { /*protected*/ bool Player::isImmobile() { - return health <= 0 || isSleeping(); + return hasDied() || isSleeping(); } /*protected*/ @@ -433,8 +447,8 @@ void Player::aiStep() { float tBob = (float) Mth::sqrt(xd * xd + zd * zd); float tTilt = (float) Mth::atan(-yd * 0.2f) * 15.f; if (tBob > 0.1f) tBob = 0.1f; - if (!onGround || health <= 0) tBob = 0; - if (onGround || health <= 0) tTilt = 0; + if (!onGround || hasDied()) tBob = 0; + if (onGround || hasDied()) tTilt = 0; bob += (tBob - bob) * 0.4f; tilt += (tTilt - tilt) * 0.8f; @@ -504,14 +518,6 @@ bool Player::isCreativeModeAllowed() { return true; } -//void Player::drop() { -// //drop(inventory.removeItem(inventory.selected, 1), false); -//} - -void Player::drop(ItemInstance* item) { - drop(item, false); -} - void Player::drop(ItemInstance* item, bool randomly) { if (item == NULL || item->isNull()) return; @@ -545,11 +551,6 @@ void Player::drop(ItemInstance* item, bool randomly) { thrownItem->zd += Mth::sin(dir) * pow; } - reallyDrop(thrownItem); -} - -/*protected*/ -void Player::reallyDrop(ItemEntity* thrownItem) { level->addEntity(thrownItem); } @@ -666,7 +667,7 @@ bool Player::hurt(Entity* source, int dmg) { if (abilities.invulnerable) return false; noActionTime = 0; - if (health <= 0) return false; + if (hasDied()) return false; if(isSleeping() && !level->isClientSide) { stopSleepInBed(true, true, false); } diff --git a/src/world/entity/player/Player.h b/src/world/entity/player/Player.h index 0fb7dae..6f69b01 100755 --- a/src/world/entity/player/Player.h +++ b/src/world/entity/player/Player.h @@ -91,10 +91,7 @@ public: void handleEntityEvent(char id); virtual void take(Entity* e, int orgCount); - //void drop(); - virtual void drop(ItemInstance* item); - virtual void drop(ItemInstance* item, bool randomly); - void reallyDrop(ItemEntity* thrownItem); + virtual void drop(ItemInstance* item, bool randomly = false); bool canDestroy(Tile* tile); float getDestroySpeed(Tile* tile); diff --git a/src/world/inventory/FillingContainer.cpp b/src/world/inventory/FillingContainer.cpp index 10028b0..e4fcd5d 100755 --- a/src/world/inventory/FillingContainer.cpp +++ b/src/world/inventory/FillingContainer.cpp @@ -141,6 +141,11 @@ bool FillingContainer::add( ItemInstance* item ) // // silently destroy the item when having a full inventory // item->count = 0; // return true; + + LOGI("Inventory:\n"); + for (int i = 0; i < numTotalSlots; i++) { + LOGI("\t %i: %s (%i)\n", i, items.at(i)->getName().c_str(), items.at(i)->count); + } } return false; diff --git a/src/world/item/DyePowderItem.cpp b/src/world/item/DyePowderItem.cpp index 11c7964..2252c9d 100755 --- a/src/world/item/DyePowderItem.cpp +++ b/src/world/item/DyePowderItem.cpp @@ -10,6 +10,7 @@ #include "../level/tile/ClothTile.h" #include "../level/tile/CropTile.h" #include "../level/tile/StemTile.h" +#include "../level/tile/TallGrass.h" const std::string DyePowderItem::COLOR_DESCS[] = { "black", "red", "green", "brown", "blue", "purple", "cyan", "silver", "gray", "pink", "lime", "yellow", "lightBlue", "magenta", "orange", "white" @@ -91,9 +92,9 @@ bool DyePowderItem::useOn( ItemInstance* itemInstance, Player* player, Level* le continue; if (level->getTile(xx, yy, zz) == 0) { - /*if (random.nextInt(10) != 0) { - level->setTileAndData(xx, yy, zz, Tile::tallgrass.id, TallGrass.TALL_GRASS); - } else*/ if (random.nextInt(3) != 0) { + if (random.nextInt(10) != 0) { + level->setTileAndData(xx, yy, zz, Tile::tallgrass->id, TallGrass::TALL_GRASS); + } else if (random.nextInt(3) != 0) { level->setTile(xx, yy, zz, Tile::flower->id); } else { level->setTile(xx, yy, zz, Tile::rose->id); diff --git a/src/world/item/FlintAndSteelItem.h b/src/world/item/FlintAndSteelItem.h index 45458e7..701fc96 100755 --- a/src/world/item/FlintAndSteelItem.h +++ b/src/world/item/FlintAndSteelItem.h @@ -19,7 +19,7 @@ public: setMaxDamage(64); } - /* + bool useOn(ItemInstance* instance, Player* player, Level* level, int x, int y, int z, int face, float clickX, float clickY, float clickZ) { if (face == 0) y--; if (face == 1) y++; @@ -30,14 +30,14 @@ public: int targetType = level->getTile(x, y, z); if (targetType == 0) { - level->playSound(x + 0.5, y + 0.5, z + 0.5, "fire.ignite", 1, sharedRandom.nextFloat() * 0.4f + 0.8f); - level->setTile(x, y, z, Tile::fire->id); + level->playSound(x + 0.5, y + 0.5, z + 0.5, "fire.ignite", 1, random.nextFloat() * 0.4f + 0.8f); + level->setTile(x, y, z, ((Tile*)Tile::fire)->id); } instance->hurt(1); return true; } - */ + }; #endif /*NET_MINECRAFT_WORLD_ITEM__FlintAndSteelItem_H__*/ diff --git a/src/world/item/Item.cpp b/src/world/item/Item.cpp index 1430743..9f27efa 100755 --- a/src/world/item/Item.cpp +++ b/src/world/item/Item.cpp @@ -274,7 +274,7 @@ void Item::initItems() { //Item::diode = (new TilePlanterItem(100, Tile::diode_off))->setIcon(6, 5)->setCategory(ItemCategory::Mechanisms)->setDescriptionId("diode"); Item::shears = (ShearsItem*)(new ShearsItem(103))->setIcon(13, 5)->setCategory(ItemCategory::Tools)->setDescriptionId("shears"); Item::melon = (new FoodItem(104, 2, false))->setIcon(13, 6)->setCategory(ItemCategory::FoodArmor)->setDescriptionId("melon"); - Item::seeds_melon = (new SeedItem(106, Tile::melonStem->id, Tile::farmland->id))->setIcon(14, 3)->setCategory(ItemCategory::FoodArmor)->setDescriptionId("seedsMelon"); + Item::seeds_melon = (new SeedItem(106, Tile::melonStem->id, Tile::farmland->id))->setIcon(14, 3)->setCategory(ItemCategory::FoodArmor)->setDescriptionId("seeds_melon"); Item::beef_raw = (new FoodItem(107, 3, /*FoodConstants.FOOD_SATURATION_LOW,*/ true))->setIcon(9, 6)->setCategory(ItemCategory::FoodArmor)->setDescriptionId("beefRaw"); Item::beef_cooked = (new FoodItem(108, 8, /*FoodConstants.FOOD_SATURATION_GOOD,*/ true))->setIcon(10, 6)->setCategory(ItemCategory::FoodArmor)->setDescriptionId("beefCooked"); Item::chicken_raw = (new FoodItem(109, 2, /*FoodConstants.FOOD_SATURATION_LOW,*/ true))->setIcon(9, 7)->setCategory(ItemCategory::FoodArmor)->setDescriptionId("chickenRaw"); diff --git a/src/world/item/ItemInstance.cpp b/src/world/item/ItemInstance.cpp index 9d7d03f..d52d9f1 100755 --- a/src/world/item/ItemInstance.cpp +++ b/src/world/item/ItemInstance.cpp @@ -290,3 +290,7 @@ bool ItemInstance::isArmorItem( const ItemInstance* instance ) { return item->isArmor(); } + +bool ItemInstance::isBlock(const ItemInstance* instance) { + return instance->id < 256; +} \ No newline at end of file diff --git a/src/world/item/ItemInstance.h b/src/world/item/ItemInstance.h index b65a97d..9b1926d 100755 --- a/src/world/item/ItemInstance.h +++ b/src/world/item/ItemInstance.h @@ -81,6 +81,8 @@ public: static bool isArmorItem(const ItemInstance* instance); + static bool isBlock(const ItemInstance* instance); + /** * Checks if this item is the same item as the other one, disregarding the * 'count' value. diff --git a/src/world/item/ShearsItem.h b/src/world/item/ShearsItem.h index d73b2f5..30d4d57 100755 --- a/src/world/item/ShearsItem.h +++ b/src/world/item/ShearsItem.h @@ -22,7 +22,7 @@ public: /*@Override*/ bool mineBlock(ItemInstance* itemInstance, int tile, int x, int y, int z/*, Mob* owner*/) { - if (tile == ((Tile*)Tile::leaves)->id || tile == Tile::web->id /*|| tile == Tile::tallgrass->id || tile == Tile::vine->id*/) { + if (tile == ((Tile*)Tile::leaves)->id || tile == Tile::web->id || tile == Tile::tallgrass->id /*|| tile == Tile::vine->id*/) { itemInstance->hurt(1);//, owner); return true; } diff --git a/src/world/item/TileItem.h b/src/world/item/TileItem.h index c75084e..08bd1d0 100755 --- a/src/world/item/TileItem.h +++ b/src/world/item/TileItem.h @@ -61,7 +61,7 @@ public: if (level->setTileAndData(x, y, z, tileId, data)) { Tile::tiles[tileId]->setPlacedBy(level, x, y, z, player); level->playSound(x + 0.5f, y + 0.5f, z + 0.5f, tile->soundType->getStepSound(), (tile->soundType->getVolume() + 1) / 2, tile->soundType->getPitch() * 0.8f); - + printf("%f %f %f \n", player->x, player->y, player->z); /* PlaceBlockPacket packet(player->entityId, x, y, z, face, tileId, instance->getAuxValue()); //LOGI("Place block at @ %d, %d, %d\n", x, y, z); diff --git a/src/world/level/FoliageColor.cpp b/src/world/level/FoliageColor.cpp new file mode 100644 index 0000000..018cd1f --- /dev/null +++ b/src/world/level/FoliageColor.cpp @@ -0,0 +1,13 @@ +#include "FoliageColor.h" + +// TODO: Probably move all the stuff from the header into here so it's a bit cleaner +bool FoliageColor::useTint = true; + +int FoliageColor::get(float temp, float rain) { + rain *= temp; + int x = (int) ((1 - temp) * 255); + int y = (int) ((1 - rain) * 255); + return pixels[y << 8 | x]; +} + +int* FoliageColor::pixels = nullptr; \ No newline at end of file diff --git a/src/world/level/FoliageColor.h b/src/world/level/FoliageColor.h index 6d7d024..4d1a446 100755 --- a/src/world/level/FoliageColor.h +++ b/src/world/level/FoliageColor.h @@ -6,31 +6,49 @@ class FoliageColor { public: -// static void init(int[] pixels) { -// FoliageColor::pixels = pixels; -// } -// -// static int get(float temp, float rain) { -// rain *= temp; -// int x = (int) ((1 - temp) * 255); -// int y = (int) ((1 - rain) * 255); -// return pixels[y << 8 | x]; -// } + static bool useTint; - static int getEvergreenColor() { - return 0x619961; - } + static void setUseTint(bool value) { + useTint = value; + } + /* + Shredder here, Ive converted the unused commented out code into their correct syntax, though if i did something incorrectly feel free to take reference from the + commented out code + */ - static int getBirchColor() { - return 0x80a755; - } + // static void init(int[] pixels) { + // FoliageColor::pixels = pixels; + // } + // + // static int get(float temp, float rain) { + // rain *= temp; + // int x = (int) ((1 - temp) * 255); + // int y = (int) ((1 - rain) * 255); + // return pixels[y << 8 | x]; + // } - static int getDefaultColor() { - return 0x48b518; - } + + static void init(int* p) { + pixels = p; + } + + static int get(float temp, float rain); + + static int getEvergreenColor() { + return 0x619961; + } + + static int getBirchColor() { + return 0x80a755; + } + + static int getDefaultColor() { + return 0x48b518; + } private: - //static int pixels[256*256]; + // static int pixels[256*256]; + static int* pixels; }; #endif /*NET_MINECRAFT_WORLD_LEVEL__FoliageColor_H__*/ diff --git a/src/world/level/GrassColor.cpp b/src/world/level/GrassColor.cpp new file mode 100644 index 0000000..eb05bd4 --- /dev/null +++ b/src/world/level/GrassColor.cpp @@ -0,0 +1,13 @@ +#include "GrassColor.h" + +// TODO: Probably move all the stuff from the header into here so it's a bit cleaner +bool GrassColor::useTint = true; + +int GrassColor::get(float temp, float rain) { + rain *= temp; + int x = (int) ((1 - temp) * 255); + int y = (int) ((1 - rain) * 255); + return pixels[y << 8 | x]; +} + +int* GrassColor::pixels = nullptr; \ No newline at end of file diff --git a/src/world/level/GrassColor.h b/src/world/level/GrassColor.h new file mode 100644 index 0000000..08903c7 --- /dev/null +++ b/src/world/level/GrassColor.h @@ -0,0 +1,42 @@ +#ifndef NET_MINECRAFT_WORLD_LEVEL__GrassColor_H__ +#define NET_MINECRAFT_WORLD_LEVEL__GrassColor_H__ + +//package net.minecraft.world.level; + +class GrassColor +{ +public: + static bool useTint; + + static void setUseTint(bool value) { + useTint = value; + } +/* +Shredder here, Ive converted the unused commented out code into their correct syntax, though if i did something incorrectly feel free to take reference from the +commented out code +*/ + +// static void init(int[] pixels) { +// GrassColor::pixels = pixels; +// } +// +// static int get(float temp, float rain) { +// rain *= temp; +// int x = (int) ((1 - temp) * 255); +// int y = (int) ((1 - rain) * 255); +// return pixels[y << 8 | x]; +// } + + + static void init(int* p) { + pixels = p; + } + + static int get(float temp, float rain); + +private: + // static int pixels[256*256]; + static int* pixels; +}; + +#endif /*NET_MINECRAFT_WORLD_LEVEL__GrassColor_H__*/ diff --git a/src/world/level/Level.cpp b/src/world/level/Level.cpp index 6367dd9..522bad1 100755 --- a/src/world/level/Level.cpp +++ b/src/world/level/Level.cpp @@ -29,8 +29,11 @@ #include "../Difficulty.h" #include "../../network/packet/ExplodePacket.h" +const int Level::DEPTH = LevelConstants::LEVEL_HEIGHT; +const int Level::SEA_LEVEL = Level::DEPTH / 2 - 1; + Level::Level(LevelStorage* levelStorage, const std::string& levelName, const LevelSettings& settings, int generatorVersion, Dimension* fixedDimension /* = NULL */) -: levelStorage(levelStorage), + : levelStorage(levelStorage), isClientSide(false), isFindingSpawn(false), noNeighborUpdate(false), @@ -52,7 +55,7 @@ Level::Level(LevelStorage* levelStorage, const std::string& levelName, const Lev allPlayersAreSleeping(false), _nightMode(false) { - _init(levelName, settings, generatorVersion, fixedDimension); + _init(levelName, settings, generatorVersion, fixedDimension); } Level::~Level() { @@ -85,14 +88,14 @@ void Level::_init(const std::string& levelName, const LevelSettings& settings, i isGeneratingTerrain = false; LevelData* preparedData = levelStorage->prepareLevel(this); - _isNew = (preparedData == NULL); + _isNew = (preparedData == NULL); - if (preparedData == NULL) { - levelData = LevelData(settings, levelName, generatorVersion); - } else { + if (preparedData == NULL) { + levelData = LevelData(settings, levelName, generatorVersion); + } else { levelData = *preparedData; - levelData.setLevelName(levelName); - } + levelData.setLevelName(levelName); + } if (fixedDimension != NULL) { dimension = fixedDimension; @@ -100,12 +103,12 @@ void Level::_init(const std::string& levelName, const LevelSettings& settings, i dimension = DimensionFactory::createDefaultDimension( &levelData ); } - dimension->init(this); - _chunkSource = createChunkSource(); + dimension->init(this); + _chunkSource = createChunkSource(); _pathFinder = new PathFinder(); _nightMode = false; - updateSkyBrightness(); + updateSkyBrightness(); } /*protected*/ @@ -121,63 +124,63 @@ ChunkSource* Level::createChunkSource() { /*public*/ bool Level::checkAndHandleWater(const AABB& box, const Material* material, Entity* e) { - int x0 = Mth::floor(box.x0); - int x1 = Mth::floor(box.x1 + 1); + int x0 = Mth::floor(box.x0); + int x1 = Mth::floor(box.x1 + 1); - int y0 = Mth::floor(box.y0); - int y1 = Mth::floor(box.y1 + 1); + int y0 = Mth::floor(box.y0); + int y1 = Mth::floor(box.y1 + 1); - int z0 = Mth::floor(box.z0); - int z1 = Mth::floor(box.z1 + 1); + int z0 = Mth::floor(box.z0); + int z1 = Mth::floor(box.z1 + 1); - if (!hasChunksAt(x0, y0, z0, x1, y1, z1)) { - return false; - } + if (!hasChunksAt(x0, y0, z0, x1, y1, z1)) { + return false; + } - bool ok = false; - Vec3 current(0,0,0); - for (int x = x0; x < x1; x++) - for (int y = y0; y < y1; y++) - for (int z = z0; z < z1; z++) { - Tile* tile = Tile::tiles[getTile(x, y, z)]; - if (tile != NULL && tile->material == material) { - float yt0 = y + 1 - LiquidTile::getHeight(getData(x, y, z)); - if (y1 >= yt0) { - ok = true; - tile->handleEntityInside(this, x, y, z, e, current); - } - } - } - float len = current.length(); - if (len > 0) { - const float pow = 0.004f / len; - e->xd += current.x * pow; - e->yd += current.y * pow; - e->zd += current.z * pow; - } - return ok; + bool ok = false; + Vec3 current(0,0,0); + for (int x = x0; x < x1; x++) + for (int y = y0; y < y1; y++) + for (int z = z0; z < z1; z++) { + Tile* tile = Tile::tiles[getTile(x, y, z)]; + if (tile != NULL && tile->material == material) { + float yt0 = y + 1 - LiquidTile::getHeight(getData(x, y, z)); + if (y1 >= yt0) { + ok = true; + tile->handleEntityInside(this, x, y, z, e, current); + } + } + } + float len = current.length(); + if (len > 0) { + const float pow = 0.004f / len; + e->xd += current.x * pow; + e->yd += current.y * pow; + e->zd += current.z * pow; + } + return ok; } /*public*/ Player* Level::getNearestPlayer(Entity* source, float maxDist) { - return getNearestPlayer(source->x, source->y, source->z, maxDist); + return getNearestPlayer(source->x, source->y, source->z, maxDist); } /*public*/ Player* Level::getNearestPlayer(float x, float y, float z, float maxDist) { - float maxDistSqr = maxDist * maxDist; + float maxDistSqr = maxDist * maxDist; float best = -1; - Player* result = NULL; - for (unsigned int i = 0; i < players.size(); i++) { - Player* p = players[i]; + Player* result = NULL; + for (unsigned int i = 0; i < players.size(); i++) { + Player* p = players[i]; if (p->removed) continue; float dist = p->distanceToSqr(x, y, z); - if ((maxDist < 0 || dist < maxDistSqr) && (best == -1 || dist < best)) { - best = dist; - result = p; - } - } - return result; + if ((maxDist < 0 || dist < maxDistSqr) && (best == -1 || dist < best)) { + best = dist; + result = p; + } + } + return result; } /*public*/ @@ -189,7 +192,7 @@ void Level::tick() { _mobSpawnTick = 0; TIMER_PUSH("mobSpawner"); MobSpawner::tick(this, _spawnEnemies && difficulty > Difficulty::PEACEFUL, - _spawnFriendlies && (levelData.getTime() % 400) < MobSpawnInterval); + _spawnFriendlies && (levelData.getTime() % 400) < MobSpawnInterval); TIMER_POP(); } } @@ -231,7 +234,7 @@ void Level::tick() { tickPendingTicks(false); TIMER_POP_PUSH("tickTiles"); - tickTiles(); + tickTiles(); TIMER_POP_PUSH("sendEntityData"); for (unsigned int i = 0; i < entities.size(); ++i) { @@ -255,7 +258,7 @@ void Level::tick() { /*protected*/ void Level::tickTiles() { - _chunksToPoll.clear(); + _chunksToPoll.clear(); static const int pollChunkOffsets[] = { -1,-4, 0,-4, 1,-4, -2,-3, -1,-3, 0,-3, 1,-3, 2,-3, -3,-2, @@ -270,126 +273,126 @@ void Level::tickTiles() { TIMER_PUSH("buildList"); //static Stopwatch w; //w.start(); - for (size_t i = 0; i < players.size(); i++) { - Player* player = players[i]; - int xx = Mth::floor(player->x / 16); - int zz = Mth::floor(player->z / 16); + for (size_t i = 0; i < players.size(); i++) { + Player* player = players[i]; + int xx = Mth::floor(player->x / 16); + int zz = Mth::floor(player->z / 16); for (int i = 0; i < pollChunkOffsetsSize; i += 2) { const int xp = xx + pollChunkOffsets[i]; const int zp = zz + pollChunkOffsets[i+1]; - if (xp >= 0 && xp < CHUNK_CACHE_WIDTH && - zp >= 0 && zp < CHUNK_CACHE_WIDTH) + if (xp >= 0 && xp < LevelConstants::CHUNK_CACHE_WIDTH && + zp >= 0 && zp < LevelConstants::CHUNK_CACHE_WIDTH) _chunksToPoll.insert(ChunkPos(xp, zp)); } - } + } TIMER_POP(); - //if (delayUntilNextMoodSound > 0) delayUntilNextMoodSound--; + //if (delayUntilNextMoodSound > 0) delayUntilNextMoodSound--; TIMER_PUSH("loop"); - for (ChunkPosSet::iterator it = _chunksToPoll.begin(); it != _chunksToPoll.end(); ++it) { + for (ChunkPosSet::iterator it = _chunksToPoll.begin(); it != _chunksToPoll.end(); ++it) { const ChunkPos& cp = *it; - int xo = cp.x * 16; - int zo = cp.z * 16; - // LevelSource region = new Region(this, xo, 0, zo, xo + 16, 128, zo + 16); + int xo = cp.x * 16; + int zo = cp.z * 16; + // LevelSource region = new Region(this, xo, 0, zo, xo + 16, 128, zo + 16); TIMER_PUSH("getChunk"); - LevelChunk* lc = this->getChunk(cp.x, cp.z); + LevelChunk* lc = this->getChunk(cp.x, cp.z); TIMER_POP_PUSH("tickChunk"); //lc->tick(); - //if (delayUntilNextMoodSound == 0) { - // randValue = randValue * 3 + addend; - // int val = (randValue >> 2); - // int x = (val & 15); - // int z = ((val >> 8) & 15); - // int y = ((val >> 16) & 127); + //if (delayUntilNextMoodSound == 0) { + // randValue = randValue * 3 + addend; + // int val = (randValue >> 2); + // int x = (val & 15); + // int z = ((val >> 8) & 15); + // int y = ((val >> 16) & 127); - // int id = lc->getTile(x, y, z); - // x += xo; - // z += zo; - // if (id == 0 && getRawBrightness(x, y, z) <= random.nextInt(8) && getBrightness(LightLayer::Sky, x, y, z) <= 0) { - // Player* player = getNearestPlayer(x + 0.5, y + 0.5, z + 0.5, 8); - // if (player != NULL && player.distanceToSqr(x + 0.5, y + 0.5, z + 0.5) > 2 * 2) { - // //this.playSound(x + 0.5, y + 0.5, z + 0.5, "ambient.cave.cave", 0.7f, 0.8f + random.nextFloat() * 0.2f); - // delayUntilNextMoodSound = random.nextInt(20 * 60 * 10) + 20 * 60 * 5; - // } - // } - //} + // int id = lc->getTile(x, y, z); + // x += xo; + // z += zo; + // if (id == 0 && getRawBrightness(x, y, z) <= random.nextInt(8) && getBrightness(LightLayer::Sky, x, y, z) <= 0) { + // Player* player = getNearestPlayer(x + 0.5, y + 0.5, z + 0.5, 8); + // if (player != NULL && player.distanceToSqr(x + 0.5, y + 0.5, z + 0.5) > 2 * 2) { + // //this.playSound(x + 0.5, y + 0.5, z + 0.5, "ambient.cave.cave", 0.7f, 0.8f + random.nextFloat() * 0.2f); + // delayUntilNextMoodSound = random.nextInt(20 * 60 * 10) + 20 * 60 * 5; + // } + // } + //} TIMER_POP_PUSH("tickTiles"); - for (int i = 0; i < 20; i++) { //@todo: CHUNK_TILE_TICK_COUNT - _randValue = _randValue * 3 + _addend; - int val = (_randValue >> 2); - int x = (val & 15); - int z = ((val >> 8) & 15); - int y = ((val >> 16) & 127); + for (int i = 0; i < 20; i++) { //@todo: CHUNK_TILE_TICK_COUNT + _randValue = _randValue * 3 + _addend; + int val = (_randValue >> 2); + int x = (val & 15); + int z = ((val >> 8) & 15); + int y = ((val >> 16) & 127); - int id = lc->getTile(x, y, z); - if (Tile::shouldTick[id]) { - Tile::tiles[id]->tick(this, x + xo, y, z + zo, &random); - } - } + int id = lc->getTile(x, y, z); + if (Tile::shouldTick[id]) { + Tile::tiles[id]->tick(this, x + xo, y, z + zo, &random); + } + } TIMER_POP(); - } + } TIMER_POP(); //w.stop(); //w.printEvery(30, "ticktiles"); } bool Level::tickPendingTicks(bool force) { - int count = _tickNextTickSet.size(); - if (count > MAX_TICK_TILES_PER_TICK) count = MAX_TICK_TILES_PER_TICK; - for (int i = 0; i < count; i++) { + int count = _tickNextTickSet.size(); + if (count > MAX_TICK_TILES_PER_TICK) count = MAX_TICK_TILES_PER_TICK; + for (int i = 0; i < count; i++) { TickDataSet::iterator td = _tickNextTickSet.begin(); - if (!force && td->delay > levelData.getTime()) { - break; - } + if (!force && td->delay > levelData.getTime()) { + break; + } int r = 8; - if (hasChunksAt(td->x - r, td->y - r, td->z - r, td->x + r, td->y + r, td->z + r)) { - int id = getTile(td->x, td->y, td->z); - if (id == td->tileId && id > 0) { - Tile::tiles[id]->tick(this, td->x, td->y, td->z, &random); - } - } - _tickNextTickSet.erase(td); - } - return _tickNextTickSet.size() != 0; + if (hasChunksAt(td->x - r, td->y - r, td->z - r, td->x + r, td->y + r, td->z + r)) { + int id = getTile(td->x, td->y, td->z); + if (id == td->tileId && id > 0) { + Tile::tiles[id]->tick(this, td->x, td->y, td->z, &random); + } + } + _tickNextTickSet.erase(td); + } + return _tickNextTickSet.size() != 0; } /*public*/ void Level::loadPlayer(Player* player, bool doAddPlayer /*= true*/) { if (player) { CompoundTag* loadedPlayerTag = levelData.getLoadedPlayerTag(); - if (loadedPlayerTag != NULL) { - player->load(loadedPlayerTag); - levelData.setLoadedPlayerTag(NULL); - } else { + if (loadedPlayerTag != NULL) { + player->load(loadedPlayerTag); + levelData.setLoadedPlayerTag(NULL); + } else { levelData.setLoadedPlayerTo(player); } if (doAddPlayer) addEntity(player); } - //} catch (Exception e) { - // e.printStackTrace(); - //} + //} catch (Exception e) { + // e.printStackTrace(); + //} } bool Level::findPath(Path* path, Entity* from, Entity* to, float maxDist, bool canOpenDoors, bool avoidWater) { - TIMER_PUSH("pathfind"); + TIMER_PUSH("pathfind"); int x = Mth::floor(from->x); - int y = Mth::floor(from->y); - int z = Mth::floor(from->z); + int y = Mth::floor(from->y); + int z = Mth::floor(from->z); - int r = (int) (maxDist + 16); - int x1 = x - r; - int y1 = y - r; - int z1 = z - r; - int x2 = x + r; - int y2 = y + r; - int z2 = z + r; + int r = (int) (maxDist + 16); + int x1 = x - r; + int y1 = y - r; + int z1 = z - r; + int x2 = x + r; + int y2 = y + r; + int z2 = z + r; //LOGI("trying to move! 1: %ld\n", levelData.getTime()); - Region region(this, x1, y1, z1, x2, y2, z2); + Region region(this, x1, y1, z1, x2, y2, z2); _pathFinder->setLevelSource(®ion); _pathFinder->canOpenDoors = canOpenDoors; _pathFinder->avoidWater = avoidWater; @@ -399,24 +402,24 @@ bool Level::findPath(Path* path, Entity* from, Entity* to, float maxDist, bool c } bool Level::findPath(Path* path, Entity* from, int xBest, int yBest, int zBest, float maxDist, bool canOpenDoors, bool avoidWater) { - TIMER_PUSH("pathfind"); + TIMER_PUSH("pathfind"); int x = Mth::floor(from->x); - int y = Mth::floor(from->y); - int z = Mth::floor(from->z); + int y = Mth::floor(from->y); + int z = Mth::floor(from->z); - int r = (int) (maxDist + 8); - int x1 = x - r; - int y1 = y - r; - int z1 = z - r; - int x2 = x + r; - int y2 = y + r; - int z2 = z + r; - Region region(this, x1, y1, z1, x2, y2, z2); + int r = (int) (maxDist + 8); + int x1 = x - r; + int y1 = y - r; + int z1 = z - r; + int x2 = x + r; + int y2 = y + r; + int z2 = z + r; + Region region(this, x1, y1, z1, x2, y2, z2); //LOGI("trying to move! 2: %ld\n", levelData.getTime()); _pathFinder->setLevelSource(®ion); _pathFinder->canOpenDoors = canOpenDoors; _pathFinder->avoidWater = avoidWater; - _pathFinder->findPath(path, from, xBest, yBest, zBest, maxDist); + _pathFinder->findPath(path, from, xBest, yBest, zBest, maxDist); TIMER_POP(); return true; } @@ -428,17 +431,17 @@ bool Level::findPath(Path* path, Entity* from, int xBest, int yBest, int zBest, /*protected*/ void Level::setInitialSpawn() { isFindingSpawn = true; - int xSpawn = CHUNK_CACHE_WIDTH * CHUNK_WIDTH / 2; // (Level.MAX_LEVEL_SIZE - 100) * 0; + int xSpawn = LevelConstants::CHUNK_CACHE_WIDTH * LevelConstants::CHUNK_WIDTH / 2; // (Level.MAX_LEVEL_SIZE - 100) * 0; int ySpawn = 64; - int zSpawn = CHUNK_CACHE_WIDTH * CHUNK_DEPTH / 2; // (Level.MAX_LEVEL_SIZE - 100) * 0; + int zSpawn = LevelConstants::CHUNK_CACHE_WIDTH * LevelConstants::CHUNK_DEPTH / 2; // (Level.MAX_LEVEL_SIZE - 100) * 0; while (!dimension->isValidSpawn(xSpawn, zSpawn)) { xSpawn += random.nextInt(32) - random.nextInt(32); zSpawn += random.nextInt(32) - random.nextInt(32); if (xSpawn < 4) xSpawn += 32; - if (xSpawn >= LEVEL_WIDTH-4) xSpawn -= 32; + if (xSpawn >= LevelConstants::LEVEL_WIDTH-4) xSpawn -= 32; if (zSpawn < 4) zSpawn += 32; - if (zSpawn >= LEVEL_DEPTH-4) zSpawn -= 32; + if (zSpawn >= LevelConstants::LEVEL_DEPTH-4) zSpawn -= 32; } levelData.setSpawn(xSpawn, ySpawn, zSpawn); isFindingSpawn = false; @@ -446,38 +449,38 @@ void Level::setInitialSpawn() { /*public*/ void Level::validateSpawn() { - if (levelData.getYSpawn() <= 0) { - levelData.setYSpawn(64); - } - int xSpawn = levelData.getXSpawn(); - int zSpawn = levelData.getZSpawn(); - while (getTopTile(xSpawn, zSpawn) == 0 || getTopTile(xSpawn, zSpawn) == Tile::invisible_bedrock->id) { - xSpawn += random.nextInt(8) - random.nextInt(8); - zSpawn += random.nextInt(8) - random.nextInt(8); + if (levelData.getYSpawn() <= 0) { + levelData.setYSpawn(64); + } + int xSpawn = levelData.getXSpawn(); + int zSpawn = levelData.getZSpawn(); + while (getTopTile(xSpawn, zSpawn) == 0 || getTopTile(xSpawn, zSpawn) == Tile::invisible_bedrock->id) { + xSpawn += random.nextInt(8) - random.nextInt(8); + zSpawn += random.nextInt(8) - random.nextInt(8); if (xSpawn < 4) xSpawn += 8; - if (xSpawn >= LEVEL_WIDTH-4) xSpawn -= 8; + if (xSpawn >= LevelConstants::LEVEL_WIDTH-4) xSpawn -= 8; if (zSpawn < 4) zSpawn += 8; - if (zSpawn >= LEVEL_DEPTH-4) zSpawn -= 8; + if (zSpawn >= LevelConstants::LEVEL_DEPTH-4) zSpawn -= 8; } levelData.setXSpawn(xSpawn); levelData.setZSpawn(zSpawn); } int Level::getTopTile(int x, int z) { - int y = 63; - while (!isEmptyTile(x, y + 1, z)) { - y++; - } - return getTile(x, y, z); + int y = 63; + while (!isEmptyTile(x, y + 1, z)) { + y++; + } + return getTile(x, y, z); } int Level::getTopTileY(int x, int z) { - int y = 63; - while (!isEmptyTile(x, y + 1, z)) { - y++; - } - return y; + int y = 63; + while (!isEmptyTile(x, y + 1, z)) { + y++; + } + return y; } // // void clearLoadedPlayerData() { @@ -513,101 +516,101 @@ void Level::saveLevelData() { //} int Level::getTile(int x, int y, int z) { - //if (x < -MAX_LEVEL_SIZE || z < -MAX_LEVEL_SIZE || x >= MAX_LEVEL_SIZE || z > MAX_LEVEL_SIZE) { - // return 0; - //} - if (y < 0) return 0; - if (y >= DEPTH) return 0; + //if (x < -MAX_LEVEL_SIZE || z < -MAX_LEVEL_SIZE || x >= MAX_LEVEL_SIZE || z > MAX_LEVEL_SIZE) { + // return 0; + //} + if (y < 0) return 0; + if (y >= DEPTH) return 0; //if (z == 128) { // int a = 0; //} //LOGI("%d ", z); - return getChunk(x >> 4, z >> 4)->getTile(x & 15, y, z & 15); + return getChunk(x >> 4, z >> 4)->getTile(x & 15, y, z & 15); } bool Level::isEmptyTile(int x, int y, int z) { - return getTile(x, y, z) == 0; + return getTile(x, y, z) == 0; } bool Level::hasChunkAt(int x, int y, int z) { - if (y < 0 || y >= Level::DEPTH) return false; - return hasChunk(x >> 4, z >> 4); + if (y < 0 || y >= Level::DEPTH) return false; + return hasChunk(x >> 4, z >> 4); } bool Level::hasChunksAt(int x, int y, int z, int r) { - return hasChunksAt(x - r, y - r, z - r, x + r, y + r, z + r); + return hasChunksAt(x - r, y - r, z - r, x + r, y + r, z + r); } bool Level::hasChunksAt(int x0, int y0, int z0, int x1, int y1, int z1) { - if (y1 < 0 || y0 >= Level::DEPTH) return false; + if (y1 < 0 || y0 >= Level::DEPTH) return false; - x0 >>= 4; - z0 >>= 4; - x1 >>= 4; - z1 >>= 4; + x0 >>= 4; + z0 >>= 4; + x1 >>= 4; + z1 >>= 4; - for (int x = x0; x <= x1; x++) - for (int z = z0; z <= z1; z++) - if (!hasChunk(x, z)) return false; + for (int x = x0; x <= x1; x++) + for (int z = z0; z <= z1; z++) + if (!hasChunk(x, z)) return false; - return true; + return true; } bool Level::hasChunk(int x, int z) { - return _chunkSource->hasChunk(x, z); + return _chunkSource->hasChunk(x, z); } LevelChunk* Level::getChunkAt(int x, int z) { - return getChunk(x >> 4, z >> 4); + return getChunk(x >> 4, z >> 4); } LevelChunk* Level::getChunk(int x, int z) { - return _chunkSource->getChunk(x, z); + return _chunkSource->getChunk(x, z); } bool Level::setTileAndDataNoUpdate(int x, int y, int z, int tile, int data) { - //if (x < -MAX_LEVEL_SIZE || z < -MAX_LEVEL_SIZE || x >= MAX_LEVEL_SIZE || z > MAX_LEVEL_SIZE) { - // return false; - //} - if (y < 0) return false; - if (y >= DEPTH) return false; - LevelChunk* c = getChunk(x >> 4, z >> 4); - return c->setTileAndData(x & 15, y, z & 15, tile, data); + //if (x < -MAX_LEVEL_SIZE || z < -MAX_LEVEL_SIZE || x >= MAX_LEVEL_SIZE || z > MAX_LEVEL_SIZE) { + // return false; + //} + if (y < 0) return false; + if (y >= DEPTH) return false; + LevelChunk* c = getChunk(x >> 4, z >> 4); + return c->setTileAndData(x & 15, y, z & 15, tile, data); } bool Level::setTileNoUpdate(int x, int y, int z, int tile) { - //if (x < -MAX_LEVEL_SIZE || z < -MAX_LEVEL_SIZE || x >= MAX_LEVEL_SIZE || z > MAX_LEVEL_SIZE) { - // return false; - //} - if (y < 0) return false; - if (y >= DEPTH) return false; - LevelChunk* c = getChunk(x >> 4, z >> 4); - return c->setTile(x & 15, y, z & 15, tile); + //if (x < -MAX_LEVEL_SIZE || z < -MAX_LEVEL_SIZE || x >= MAX_LEVEL_SIZE || z > MAX_LEVEL_SIZE) { + // return false; + //} + if (y < 0) return false; + if (y >= DEPTH) return false; + LevelChunk* c = getChunk(x >> 4, z >> 4); + return c->setTile(x & 15, y, z & 15, tile); } const Material* Level::getMaterial(int x, int y, int z) { - int t = getTile(x, y, z); - if (t == 0) return Material::air; - return Tile::tiles[t]->material; + int t = getTile(x, y, z); + if (t == 0) return Material::air; + return Tile::tiles[t]->material; } int Level::getData(int x, int y, int z) { - //if (x < -MAX_LEVEL_SIZE || z < -MAX_LEVEL_SIZE || x >= MAX_LEVEL_SIZE || z > MAX_LEVEL_SIZE) { - // return 0; - //} - if (y < 0) return 0; - if (y >= DEPTH) return 0; - LevelChunk* c = getChunk(x >> 4, z >> 4); - x &= 15; - z &= 15; - return c->getData(x, y, z); + //if (x < -MAX_LEVEL_SIZE || z < -MAX_LEVEL_SIZE || x >= MAX_LEVEL_SIZE || z > MAX_LEVEL_SIZE) { + // return 0; + //} + if (y < 0) return 0; + if (y >= DEPTH) return 0; + LevelChunk* c = getChunk(x >> 4, z >> 4); + x &= 15; + z &= 15; + return c->getData(x, y, z); } void Level::setData(int x, int y, int z, int data) { //// @newway //if (setDataNoUpdate(x, y, z, data)) { - // int t = getTile(x, y, z); + // int t = getTile(x, y, z); // if (Tile::sendTileData[t]) { // tileUpdated(x, y, z, t); // } else { @@ -616,20 +619,20 @@ void Level::setData(int x, int y, int z, int data) { //} // @oldway - if (setDataNoUpdate(x, y, z, data)) { - tileUpdated(x, y, z, getTile(x, y, z)); - } + if (setDataNoUpdate(x, y, z, data)) { + tileUpdated(x, y, z, getTile(x, y, z)); + } } bool Level::setDataNoUpdate(int x, int y, int z, int data) { - //if (x < -MAX_LEVEL_SIZE || z < -MAX_LEVEL_SIZE || x >= MAX_LEVEL_SIZE || z > MAX_LEVEL_SIZE) { - // return false; - //} - if (y < 0) return false; - if (y >= DEPTH) return false; - LevelChunk* c = getChunk(x >> 4, z >> 4); - x &= 15; - z &= 15; + //if (x < -MAX_LEVEL_SIZE || z < -MAX_LEVEL_SIZE || x >= MAX_LEVEL_SIZE || z > MAX_LEVEL_SIZE) { + // return false; + //} + if (y < 0) return false; + if (y >= DEPTH) return false; + LevelChunk* c = getChunk(x >> 4, z >> 4); + x &= 15; + z &= 15; //return c->setData(x, y, z, data); @@ -641,148 +644,148 @@ bool Level::setDataNoUpdate(int x, int y, int z, int data) { } bool Level::setTile(int x, int y, int z, int tile) { - if (setTileNoUpdate(x, y, z, tile)) { + if (setTileNoUpdate(x, y, z, tile)) { //printf("TILE UPDATED %d, %d, %d\n", x, y, z); - tileUpdated(x, y, z, tile); - return true; - } - return false; + tileUpdated(x, y, z, tile); + return true; + } + return false; } bool Level::setTileAndData(int x, int y, int z, int tile, int data) { - if (setTileAndDataNoUpdate(x, y, z, tile, data)) { - tileUpdated(x, y, z, tile); - return true; - } - return false; + if (setTileAndDataNoUpdate(x, y, z, tile, data)) { + tileUpdated(x, y, z, tile); + return true; + } + return false; } void Level::sendTileUpdated(int x, int y, int z) { - for (unsigned int i = 0; i < _listeners.size(); i++) { - _listeners[i]->tileChanged(x, y, z); - } + for (unsigned int i = 0; i < _listeners.size(); i++) { + _listeners[i]->tileChanged(x, y, z); + } } /*protected*/ void Level::tileUpdated(int x, int y, int z, int tile) { - sendTileUpdated(x, y, z); - this->updateNeighborsAt(x, y, z, tile); + sendTileUpdated(x, y, z); + this->updateNeighborsAt(x, y, z, tile); } void Level::lightColumnChanged(int x, int z, int y0, int y1) { - if (y0 > y1) { - int tmp = y1; - y1 = y0; - y0 = tmp; - } - setTilesDirty(x, y0, z, x, y1, z); + if (y0 > y1) { + int tmp = y1; + y1 = y0; + y0 = tmp; + } + setTilesDirty(x, y0, z, x, y1, z); } void Level::setTileDirty(int x, int y, int z) { - for (unsigned int i = 0; i < _listeners.size(); i++) { - _listeners[i]->setTilesDirty(x, y, z, x, y, z); - } + for (unsigned int i = 0; i < _listeners.size(); i++) { + _listeners[i]->setTilesDirty(x, y, z, x, y, z); + } } void Level::setTilesDirty(int x0, int y0, int z0, int x1, int y1, int z1) { - for (unsigned int i = 0; i < _listeners.size(); i++) { - _listeners[i]->setTilesDirty(x0, y0, z0, x1, y1, z1); - } + for (unsigned int i = 0; i < _listeners.size(); i++) { + _listeners[i]->setTilesDirty(x0, y0, z0, x1, y1, z1); + } } void Level::swap(int x1, int y1, int z1, int x2, int y2, int z2) { - int t1 = getTile(x1, y1, z1); - int d1 = getData(x1, y1, z1); - int t2 = getTile(x2, y2, z2); - int d2 = getData(x2, y2, z2); + int t1 = getTile(x1, y1, z1); + int d1 = getData(x1, y1, z1); + int t2 = getTile(x2, y2, z2); + int d2 = getData(x2, y2, z2); - setTileAndDataNoUpdate(x1, y1, z1, t2, d2); - setTileAndDataNoUpdate(x2, y2, z2, t1, d1); + setTileAndDataNoUpdate(x1, y1, z1, t2, d2); + setTileAndDataNoUpdate(x2, y2, z2, t1, d1); - updateNeighborsAt(x1, y1, z1, t2); - updateNeighborsAt(x2, y2, z2, t1); + updateNeighborsAt(x1, y1, z1, t2); + updateNeighborsAt(x2, y2, z2, t1); } void Level::updateNeighborsAt(int x, int y, int z, int tile) { - neighborChanged(x - 1, y, z, tile); - neighborChanged(x + 1, y, z, tile); - neighborChanged(x, y - 1, z, tile); - neighborChanged(x, y + 1, z, tile); - neighborChanged(x, y, z - 1, tile); - neighborChanged(x, y, z + 1, tile); + neighborChanged(x - 1, y, z, tile); + neighborChanged(x + 1, y, z, tile); + neighborChanged(x, y - 1, z, tile); + neighborChanged(x, y + 1, z, tile); + neighborChanged(x, y, z - 1, tile); + neighborChanged(x, y, z + 1, tile); } /*private*/ void Level::neighborChanged(int x, int y, int z, int type) { - if (noNeighborUpdate || isClientSide) return; - Tile* tile = Tile::tiles[getTile(x, y, z)]; - if (tile != NULL) tile->neighborChanged(this, x, y, z, type); + if (noNeighborUpdate || isClientSide) return; + Tile* tile = Tile::tiles[getTile(x, y, z)]; + if (tile != NULL) tile->neighborChanged(this, x, y, z, type); } bool Level::canSeeSky(int x, int y, int z) { - return getChunk(x >> 4, z >> 4)->isSkyLit(x & 15, y, z & 15); + return getChunk(x >> 4, z >> 4)->isSkyLit(x & 15, y, z & 15); } int Level::getRawBrightness(int x, int y, int z) { - return getRawBrightness(x, y, z, true); + return getRawBrightness(x, y, z, true); } int Level::getRawBrightness(int x, int y, int z, bool propagate) { - //if (x < -MAX_LEVEL_SIZE || z < -MAX_LEVEL_SIZE || x >= MAX_LEVEL_SIZE || z > MAX_LEVEL_SIZE) { - // return MAX_BRIGHTNESS; - //} + //if (x < -MAX_LEVEL_SIZE || z < -MAX_LEVEL_SIZE || x >= MAX_LEVEL_SIZE || z > MAX_LEVEL_SIZE) { + // return MAX_BRIGHTNESS; + //} - if (propagate) { - int id = getTile(x, y, z); - if (id == Tile::stoneSlabHalf->id || id == Tile::farmland->id) { - int br = getRawBrightness(x, y + 1, z, false); - int br1 = getRawBrightness(x + 1, y, z, false); - int br2 = getRawBrightness(x - 1, y, z, false); - int br3 = getRawBrightness(x, y, z + 1, false); - int br4 = getRawBrightness(x, y, z - 1, false); - if (br1 > br) br = br1; - if (br2 > br) br = br2; - if (br3 > br) br = br3; - if (br4 > br) br = br4; - return br; - } - } + if (propagate) { + int id = getTile(x, y, z); + if (id == Tile::stoneSlabHalf->id || id == Tile::farmland->id) { + int br = getRawBrightness(x, y + 1, z, false); + int br1 = getRawBrightness(x + 1, y, z, false); + int br2 = getRawBrightness(x - 1, y, z, false); + int br3 = getRawBrightness(x, y, z + 1, false); + int br4 = getRawBrightness(x, y, z - 1, false); + if (br1 > br) br = br1; + if (br2 > br) br = br2; + if (br3 > br) br = br3; + if (br4 > br) br = br4; + return br; + } + } - if (y < 0) return 0; - if (y >= DEPTH) { - int br = MAX_BRIGHTNESS - skyDarken; - if (br < 0) br = 0; - return br; - } + if (y < 0) return 0; + if (y >= DEPTH) { + int br = MAX_BRIGHTNESS - skyDarken; + if (br < 0) br = 0; + return br; + } - LevelChunk* c = getChunk(x >> 4, z >> 4); - x &= 15; - z &= 15; - return c->getRawBrightness(x, y, z, skyDarken); + LevelChunk* c = getChunk(x >> 4, z >> 4); + x &= 15; + z &= 15; + return c->getRawBrightness(x, y, z, skyDarken); } bool Level::isSkyLit(int x, int y, int z) { - //if (x < -MAX_LEVEL_SIZE || z < -MAX_LEVEL_SIZE || x >= MAX_LEVEL_SIZE || z > MAX_LEVEL_SIZE) { - // return false; - //} - if (y < 0) return false; - if (y >= DEPTH) return true; - if (!hasChunk(x >> 4, z >> 4)) return false; + //if (x < -MAX_LEVEL_SIZE || z < -MAX_LEVEL_SIZE || x >= MAX_LEVEL_SIZE || z > MAX_LEVEL_SIZE) { + // return false; + //} + if (y < 0) return false; + if (y >= DEPTH) return true; + if (!hasChunk(x >> 4, z >> 4)) return false; - LevelChunk* c = getChunk(x >> 4, z >> 4); - x &= 15; - z &= 15; + LevelChunk* c = getChunk(x >> 4, z >> 4); + x &= 15; + z &= 15; return c->isSkyLit(x, y, z); } int Level::getHeightmap(int x, int z) { - //if (x < -MAX_LEVEL_SIZE || z < -MAX_LEVEL_SIZE || x >= MAX_LEVEL_SIZE || z > MAX_LEVEL_SIZE) { - // return 0; - //} - if (!hasChunk(x >> 4, z >> 4)) return 0; + //if (x < -MAX_LEVEL_SIZE || z < -MAX_LEVEL_SIZE || x >= MAX_LEVEL_SIZE || z > MAX_LEVEL_SIZE) { + // return 0; + //} + if (!hasChunk(x >> 4, z >> 4)) return 0; - LevelChunk* c = getChunk(x >> 4, z >> 4); - return c->getHeightmap(x & 15, z & 15); + LevelChunk* c = getChunk(x >> 4, z >> 4); + return c->getHeightmap(x & 15, z & 15); } BiomeSource* Level::getBiomeSource() { @@ -793,45 +796,45 @@ Biome* Level::getBiome( int x, int z ) { } void Level::updateLightIfOtherThan(const LightLayer& layer, int x, int y, int z, int expected) { - if (dimension->hasCeiling && (&layer) == &LightLayer::Sky) return; + if (dimension->hasCeiling && (&layer) == &LightLayer::Sky) return; - if (!hasChunkAt(x, y, z)) return; + if (!hasChunkAt(x, y, z)) return; - if (&layer == &LightLayer::Sky) { - if (isSkyLit(x, y, z)) expected = 15; - } else if (&layer == &LightLayer::Block) { - int t = getTile(x, y, z); - if (Tile::lightEmission[t] > expected) expected = Tile::lightEmission[t]; - } + if (&layer == &LightLayer::Sky) { + if (isSkyLit(x, y, z)) expected = 15; + } else if (&layer == &LightLayer::Block) { + int t = getTile(x, y, z); + if (Tile::lightEmission[t] > expected) expected = Tile::lightEmission[t]; + } - if (getBrightness(layer, x, y, z) != expected) { - updateLight(layer, x, y, z, x, y, z); - } + if (getBrightness(layer, x, y, z) != expected) { + updateLight(layer, x, y, z, x, y, z); + } } int Level::getBrightness(const LightLayer& layer, int x, int y, int z) { - if (y < 0 || y >= DEPTH/* || x < -MAX_LEVEL_SIZE || z < -MAX_LEVEL_SIZE || x >= MAX_LEVEL_SIZE || z > MAX_LEVEL_SIZE*/) { - return layer.surrounding; - } - int xc = x >> 4; - int zc = z >> 4; - if (!hasChunk(xc, zc)) return 0; - LevelChunk* c = getChunk(xc, zc); - return c->getBrightness(layer, x & 15, y, z & 15); + if (y < 0 || y >= DEPTH/* || x < -MAX_LEVEL_SIZE || z < -MAX_LEVEL_SIZE || x >= MAX_LEVEL_SIZE || z > MAX_LEVEL_SIZE*/) { + return layer.surrounding; + } + int xc = x >> 4; + int zc = z >> 4; + if (!hasChunk(xc, zc)) return 0; + LevelChunk* c = getChunk(xc, zc); + return c->getBrightness(layer, x & 15, y, z & 15); } void Level::setBrightness(const LightLayer& layer, int x, int y, int z, int brightness) { - //if (x < -MAX_LEVEL_SIZE || z < -MAX_LEVEL_SIZE || x >= MAX_LEVEL_SIZE || z > MAX_LEVEL_SIZE) { - // return; - //} - if (y < 0) return; - if (y >= DEPTH) return; - if (!hasChunk(x >> 4, z >> 4)) return; - LevelChunk* c = getChunk(x >> 4, z >> 4); - c->setBrightness(layer, x & 15, y, z & 15, brightness); - for (unsigned int i = 0; i < _listeners.size(); i++) { - _listeners[i]->tileBrightnessChanged(x, y, z); - } + //if (x < -MAX_LEVEL_SIZE || z < -MAX_LEVEL_SIZE || x >= MAX_LEVEL_SIZE || z > MAX_LEVEL_SIZE) { + // return; + //} + if (y < 0) return; + if (y >= DEPTH) return; + if (!hasChunk(x >> 4, z >> 4)) return; + LevelChunk* c = getChunk(x >> 4, z >> 4); + c->setBrightness(layer, x & 15, y, z & 15, brightness); + for (unsigned int i = 0; i < _listeners.size(); i++) { + _listeners[i]->tileBrightnessChanged(x, y, z); + } } float Level::getBrightness(int x, int y, int z) { @@ -839,7 +842,7 @@ float Level::getBrightness(int x, int y, int z) { } bool Level::isDay() { - return this->skyDarken < 4; + return this->skyDarken < 4; } //HitResult Level::clip(const Vec3& a, const Vec3& b) { @@ -847,128 +850,128 @@ bool Level::isDay() { //} HitResult Level::clip(const Vec3& A, const Vec3& b, bool liquid /*= false*/, bool solidOnly /*= false*/) { - static Stopwatch sw; - //sw.printEvery(1000, "clip"); - SwStartStopper w(sw); + static Stopwatch sw; + //sw.printEvery(1000, "clip"); + SwStartStopper w(sw); - if (A.x != A.x || A.y != A.y || A.z != A.z) return HitResult(); //@kludge This is actually a way to do it + if (A.x != A.x || A.y != A.y || A.z != A.z) return HitResult(); //@kludge This is actually a way to do it if (b.x != b.x || b.y != b.y || b.z != b.z) return HitResult(); Vec3 a(A); - int xTile1 = Mth::floor(b.x); - int yTile1 = Mth::floor(b.y); - int zTile1 = Mth::floor(b.z); + int xTile1 = Mth::floor(b.x); + int yTile1 = Mth::floor(b.y); + int zTile1 = Mth::floor(b.z); - int xTile0 = Mth::floor(a.x); - int yTile0 = Mth::floor(a.y); - int zTile0 = Mth::floor(a.z); + int xTile0 = Mth::floor(a.x); + int yTile0 = Mth::floor(a.y); + int zTile0 = Mth::floor(a.z); - int maxIterations = 200; - while (maxIterations-- >= 0) { + int maxIterations = 200; + while (maxIterations-- >= 0) { if (a.x != a.x || a.y != a.y || a.z != a.z) return HitResult(); - if (xTile0 == xTile1 && yTile0 == yTile1 && zTile0 == zTile1) + if (xTile0 == xTile1 && yTile0 == yTile1 && zTile0 == zTile1) return HitResult(); - float xClip = 999; - float yClip = 999; - float zClip = 999; + float xClip = 999; + float yClip = 999; + float zClip = 999; - if (xTile1 > xTile0) xClip = xTile0 + 1.000f; - if (xTile1 < xTile0) xClip = xTile0 + 0.000f; + if (xTile1 > xTile0) xClip = xTile0 + 1.000f; + if (xTile1 < xTile0) xClip = xTile0 + 0.000f; - if (yTile1 > yTile0) yClip = yTile0 + 1.000f; - if (yTile1 < yTile0) yClip = yTile0 + 0.000f; + if (yTile1 > yTile0) yClip = yTile0 + 1.000f; + if (yTile1 < yTile0) yClip = yTile0 + 0.000f; - if (zTile1 > zTile0) zClip = zTile0 + 1.000f; - if (zTile1 < zTile0) zClip = zTile0 + 0.000f; + if (zTile1 > zTile0) zClip = zTile0 + 1.000f; + if (zTile1 < zTile0) zClip = zTile0 + 0.000f; - float xDist = 999; - float yDist = 999; - float zDist = 999; + float xDist = 999; + float yDist = 999; + float zDist = 999; - float xd = b.x - a.x; - float yd = b.y - a.y; - float zd = b.z - a.z; + float xd = b.x - a.x; + float yd = b.y - a.y; + float zd = b.z - a.z; - if (xClip != 999) xDist = (xClip - a.x) / xd; - if (yClip != 999) yDist = (yClip - a.y) / yd; - if (zClip != 999) zDist = (zClip - a.z) / zd; + if (xClip != 999) xDist = (xClip - a.x) / xd; + if (yClip != 999) yDist = (yClip - a.y) / yd; + if (zClip != 999) zDist = (zClip - a.z) / zd; - int face = 0; - if (xDist < yDist && xDist < zDist) { - if (xTile1 > xTile0) face = 4; - else face = 5; + int face = 0; + if (xDist < yDist && xDist < zDist) { + if (xTile1 > xTile0) face = 4; + else face = 5; - a.x = xClip; - a.y += yd * xDist; - a.z += zd * xDist; - } else if (yDist < zDist) { - if (yTile1 > yTile0) face = 0; - else face = 1; + a.x = xClip; + a.y += yd * xDist; + a.z += zd * xDist; + } else if (yDist < zDist) { + if (yTile1 > yTile0) face = 0; + else face = 1; - a.x += xd * yDist; - a.y = yClip; - a.z += zd * yDist; - } else { - if (zTile1 > zTile0) face = 2; - else face = 3; + a.x += xd * yDist; + a.y = yClip; + a.z += zd * yDist; + } else { + if (zTile1 > zTile0) face = 2; + else face = 3; - a.x += xd * zDist; - a.y += yd * zDist; - a.z = zClip; - } + a.x += xd * zDist; + a.y += yd * zDist; + a.z = zClip; + } - Vec3 tPos(a.x, a.y, a.z); - xTile0 = (int) (tPos.x = (float)Mth::floor(a.x)); - if (face == 5) { - xTile0--; - tPos.x++; - } - yTile0 = (int) (tPos.y = (float)Mth::floor(a.y)); - if (face == 1) { - yTile0--; - tPos.y++; - } - zTile0 = (int) (tPos.z = (float)Mth::floor(a.z)); - if (face == 3) { - zTile0--; - tPos.z++; - } + Vec3 tPos(a.x, a.y, a.z); + xTile0 = (int) (tPos.x = (float)Mth::floor(a.x)); + if (face == 5) { + xTile0--; + tPos.x++; + } + yTile0 = (int) (tPos.y = (float)Mth::floor(a.y)); + if (face == 1) { + yTile0--; + tPos.y++; + } + zTile0 = (int) (tPos.z = (float)Mth::floor(a.z)); + if (face == 3) { + zTile0--; + tPos.z++; + } - int t = getTile(xTile0, yTile0, zTile0); - int data = getData(xTile0, yTile0, zTile0); - Tile* tile = Tile::tiles[t]; + int t = getTile(xTile0, yTile0, zTile0); + int data = getData(xTile0, yTile0, zTile0); + Tile* tile = Tile::tiles[t]; if (solidOnly && tile != NULL && tile->getAABB(this, xTile0, yTile0, zTile0) == NULL) { // No collision } else if (t > 0 && tile->mayPick(data, liquid)) { - if(xTile0 >= 0 && zTile0 >= 0 && xTile0 < LEVEL_WIDTH && zTile0 < LEVEL_WIDTH) { + if(xTile0 >= 0 && zTile0 >= 0 && xTile0 < LevelConstants::LEVEL_WIDTH && zTile0 < LevelConstants::LEVEL_WIDTH) { HitResult r = tile->clip(this, xTile0, yTile0, zTile0, a, b); if (r.isHit()) return r; } - } - } - return HitResult(); + } + } + return HitResult(); } void Level::playSound(Entity* entity, const std::string& name, float volume, float pitch) { - for (unsigned int i = 0; i < _listeners.size(); i++) { - _listeners[i]->playSound(name, entity->x, entity->y - entity->heightOffset, entity->z, volume, pitch); - } + for (unsigned int i = 0; i < _listeners.size(); i++) { + _listeners[i]->playSound(name, entity->x, entity->y - entity->heightOffset, entity->z, volume, pitch); + } } void Level::playSound(float x, float y, float z, const std::string& name, float volume, float pitch) { - for (unsigned int i = 0; i < _listeners.size(); i++) { - _listeners[i]->playSound(name, x, y, z, volume, pitch); - } + for (unsigned int i = 0; i < _listeners.size(); i++) { + _listeners[i]->playSound(name, x, y, z, volume, pitch); + } } void Level::levelEvent(Player* source, int type, int x, int y, int z, int data) { - for (unsigned int i = 0; i < _listeners.size(); i++) { - _listeners[i]->levelEvent(source, type, x, y, z, data); - } + for (unsigned int i = 0; i < _listeners.size(); i++) { + _listeners[i]->levelEvent(source, type, x, y, z, data); + } } void Level::tileEvent(int x, int y, int z, int b0, int b1) { @@ -993,7 +996,7 @@ void Level::tileEvent(int x, int y, int z, int b0, int b1) { void Level::addParticle(const std::string& id, float x, float y, float z, float xd, float yd, float zd, int data /* = 0 */) { for (unsigned int i = 0; i < _listeners.size(); i++) - _listeners[i]->addParticle(id, x, y, z, xd, yd, zd, data); + _listeners[i]->addParticle(id, x, y, z, xd, yd, zd, data); } void Level::addParticle(ParticleType::Id id, float x, float y, float z, float xd, float yd, float zd, int data /* = 0 */) { @@ -1006,13 +1009,13 @@ bool Level::addEntity(Entity* e) { if (prev) removeEntity(prev); - int xc = Mth::floor(e->x / 16.f); - int zc = Mth::floor(e->z / 16.f); + int xc = Mth::floor(e->x / 16.f); + int zc = Mth::floor(e->z / 16.f); - //bool forced = false; - //if (e->isPlayer()) { - // forced = true; - //} + //bool forced = false; + //if (e->isPlayer()) { + // forced = true; + //} bool forced = true; if (forced/* || hasChunk(xc, zc)*/) { @@ -1034,10 +1037,10 @@ Entity* Level::getEntity(int entityId) // TODO: Lookup map /*for (unsigned int i = 0; i < entities.size(); i++) { - if (entities[i]->entityId == entityId) - { - return entities[i]; - } + if (entities[i]->entityId == entityId) + { + return entities[i]; + } } return NULL;*/ EntityMap::const_iterator cit = entityIdLookup.find(entityId); @@ -1046,16 +1049,16 @@ Entity* Level::getEntity(int entityId) /*protected*/ void Level::entityAdded(Entity* e) { - for (unsigned int i = 0; i < _listeners.size(); i++) { - _listeners[i]->entityAdded(e); - } + for (unsigned int i = 0; i < _listeners.size(); i++) { + _listeners[i]->entityAdded(e); + } } /*protected*/ void Level::entityRemoved(Entity* e) { - for (unsigned int j = 0; j < _listeners.size(); j++) { - _listeners[j]->entityRemoved(e); - } + for (unsigned int j = 0; j < _listeners.size(); j++) { + _listeners[j]->entityRemoved(e); + } } Mob* Level::getMob(int entityId) @@ -1065,10 +1068,10 @@ Mob* Level::getMob(int entityId) } void Level::removeEntity(Entity* e) { - e->remove(); + e->remove(); if (e->isPlayer() && e->reallyRemoveIfPlayer) { Util::remove(players, (Player*) e); - } + } } void Level::tileEntityChanged(int x, int y, int z, TileEntity* te) { @@ -1099,16 +1102,16 @@ void Level::tileEntityChanged(int x, int y, int z, TileEntity* te) { Biome::MobSpawnerData Level::getRandomMobSpawnAt(const MobCategory& mobCategory, int x, int y, int z) { Biome::MobList mobList = _chunkSource->getMobsAt(mobCategory, x, y, z); - if (mobList.empty()) return Biome::MobSpawnerData(); + if (mobList.empty()) return Biome::MobSpawnerData(); Biome::MobSpawnerData* data = (Biome::MobSpawnerData*) WeighedRandom::getRandomItem(&random, mobList); if (!data) return Biome::MobSpawnerData(); - return *data; + return *data; } void Level::addListener(LevelListener* listener) { - _listeners.push_back(listener); + _listeners.push_back(listener); } void Level::removeListener(LevelListener* listener) { @@ -1119,76 +1122,99 @@ void Level::removeListener(LevelListener* listener) { std::vector& Level::getCubes(const Entity* source, const AABB& box_) { //@attn: check the AABB* new/delete stuff boxes.clear(); const AABB* box = &box_; - int x0 = Mth::floor(box->x0); - int x1 = Mth::floor(box->x1 + 1); - int y0 = Mth::floor(box->y0); - int y1 = Mth::floor(box->y1 + 1); - int z0 = Mth::floor(box->z0); - int z1 = Mth::floor(box->z1 + 1); + int x0 = Mth::floor(box->x0); + int x1 = Mth::floor(box->x1 + 1); + int y0 = Mth::floor(box->y0); + int y1 = Mth::floor(box->y1 + 1); + int z0 = Mth::floor(box->z0); + int z1 = Mth::floor(box->z1 + 1); - for (int x = x0; x < x1; x++) - for (int z = z0; z < z1; z++) { - if (hasChunkAt(x, Level::DEPTH / 2, z)) { - for (int y = y0 - 1; y < y1; y++) { - Tile* tile = Tile::tiles[getTile(x, y, z)]; - if (tile != NULL) { - tile->addAABBs(this, x, y, z, box, boxes); - } - } - } + for (int x = x0; x < x1; x++) + for (int z = z0; z < z1; z++) { + if (hasChunkAt(x, Level::DEPTH / 2, z)) { + for (int y = y0 - 1; y < y1; y++) { + Tile* tile = Tile::tiles[getTile(x, y, z)]; + if (tile != NULL) { + tile->addAABBs(this, x, y, z, box, boxes); + } + } + } else { //int breakPoint = 0; } - } - /* - float r = 0.25; - List ee = getEntities(source, box.grow(r, r, r)); - for (int i = 0; i < ee.size(); i++) { - AABB collideBox = ee.get(i).getCollideBox(); - if (collideBox != NULL && collideBox.intersects(box)) { - boxes.add(collideBox); - } + } + /* + float r = 0.25; + List ee = getEntities(source, box.grow(r, r, r)); + for (int i = 0; i < ee.size(); i++) { + AABB collideBox = ee.get(i).getCollideBox(); + if (collideBox != NULL && collideBox.intersects(box)) { + boxes.add(collideBox); + } - collideBox = source.getCollideAgainstBox(ee.get(i)); - if (collideBox != NULL && collideBox.intersects(box)) { - boxes.add(collideBox); - } - } - */ + collideBox = source.getCollideAgainstBox(ee.get(i)); + if (collideBox != NULL && collideBox.intersects(box)) { + boxes.add(collideBox); + } + } + */ - return boxes; + return boxes; } int Level::getSkyDarken(float a) { - float td = getTimeOfDay(a); + float td = getTimeOfDay(a); - float br = 1 - (Mth::cos(td * Mth::PI * 2) * 2 + 0.5f); - if (br < 0.0f) br = 0.0f; - if (br > 0.80f) br = 0.80f; //@note; was 1.0f - return ((int) (br * 11)); + float br = 1 - (Mth::cos(td * Mth::PI * 2) * 2 + 0.5f); + if (br < 0.0f) br = 0.0f; + if (dimension->FogType == 1) // @TODO - probably make this not dependent on dimension type honestly - shredder + { + if (br > 1.0f) br = 1.0f; //@ uses the normal javasky color ramp when java sky type is choosen, + } else + { + if (br > 0.8f) br = 0.8f; //@note; was 1.0f + } + return ((int) (br * 11)); } Vec3 Level::getSkyColor(Entity* source, float a) { - float td = getTimeOfDay(a); + float td = getTimeOfDay(a); float br = Mth::cos(td * Mth::PI * 2) * 2 + 0.5f; - if (br < 0.0f) br = 0.0f; - if (br > 0.75f) br = 0.75f; //@note; was 1.0f + if (br < 0.0f) br = 0.0f; + if (dimension->FogType == 1) // @TODO - probably make this not dependent on dimension type honestly - shredder + { + if (br > 1.0f) br = 1.0f; //@ uses the normal javasky color ramp when java sky type is choosen, + } else + { + if (br > 0.8f) br = 0.8f; //@note; was 1.0f + } -// int xx = Mth::floor(source->x); -// int zz = Mth::floor(source->z); -// float temp = 0.5;//(float) getBiomeSource().getTemperature(xx, zz); - int skyColor = 0x3070ff;//getBiomeSource().getBiome(xx, zz).getSkyColor(temp); - float r = ((skyColor >> 16) & 0xff) / 255.0f; - float g = ((skyColor >> 8) & 0xff) / 255.0f; - float b = ((skyColor) & 0xff) / 255.0f; - r *= br; - g *= br; - b *= br; + int xx = Mth::floor(source->x); + int zz = Mth::floor(source->z); + // float temp = 0.5;//(float) getBiomeSource().getTemperature(xx, zz); // unused in normal pe too, just hardcoded temp values for some reason. + float temp = (float) getBiomeSource()->getTemperature(xx, zz); + int skyColor; + if (dimension->FogType == 1){ // 1 is java styled fog which should use temperatures! + skyColor = getBiomeSource()->getBiome(xx, zz)->getSkyColor(temp); + } + else { // otherwise default to the normal pocket edition skycolor - return Vec3(r, g, b); + skyColor = 0x3070ff; + } + + // int skyColor = 0x3070ff;//getBiomeSource().getBiome(xx, zz).getSkyColor(temp); // This is the vanilla way, add it as OPTION_SKY - shredder + + float r = ((skyColor >> 16) & 0xff) / 255.0f; + float g = ((skyColor >> 8) & 0xff) / 255.0f; + float b = ((skyColor) & 0xff) / 255.0f; + r *= br; + g *= br; + b *= br; + + return Vec3(r, g, b); } Vec3 Level::getCloudColor( float a ) { @@ -1238,8 +1264,8 @@ float Level::getTimeOfDay(float a) { } float Level::getSunAngle(float a) { - float td = getTimeOfDay(a); - return td * Mth::PI * 2; + float td = getTimeOfDay(a); + return td * Mth::PI * 2; } //Vec3 Level::getCloudColor(float a) { @@ -1261,70 +1287,70 @@ float Level::getSunAngle(float a) { //} Vec3 Level::getFogColor(float a) { - float td = getTimeOfDay(a); - return dimension->getFogColor(td, a); + float td = getTimeOfDay(a); + return dimension->getFogColor(td, a); } int Level::getTopSolidBlock(int x, int z) { - LevelChunk* levelChunk = getChunkAt(x, z); + LevelChunk* levelChunk = getChunkAt(x, z); - int y = Level::DEPTH - 1; + int y = Level::DEPTH - 1; - while (getMaterial(x, y, z)->blocksMotion() && y > 0) { - y--; - } + while (getMaterial(x, y, z)->blocksMotion() && y > 0) { + y--; + } - x &= 15; - z &= 15; + x &= 15; + z &= 15; - while (y > 0) { - int t = levelChunk->getTile(x, y, z); - if (t == 0 /*|| !(Tile::tiles[t]->material->blocksMotion() || Tile::tiles[t]->material->isLiquid())*/ + while (y > 0) { + int t = levelChunk->getTile(x, y, z); + if (t == 0 /*|| !(Tile::tiles[t]->material->blocksMotion() || Tile::tiles[t]->material->isLiquid())*/ || !(Tile::tiles[t]->material->blocksMotion()) || Tile::tiles[t]->material == Material::leaves) { - y--; - } else { - return y + 1; - } - } - return -1; + y--; + } else { + return y + 1; + } + } + return -1; } int Level::getLightDepth(int x, int z) { - return getChunkAt(x, z)->getHeightmap(x & 15, z & 15); + return getChunkAt(x, z)->getHeightmap(x & 15, z & 15); } float Level::getStarBrightness(float a) { - float td = getTimeOfDay(a); + float td = getTimeOfDay(a); - float br = 1 - (Mth::cos(td * Mth::PI * 2) * 2 + 0.75f); - if (br < 0.f) br = 0; - if (br > 1.f) br = 1; + float br = 1 - (Mth::cos(td * Mth::PI * 2) * 2 + 0.75f); + if (br < 0.f) br = 0; + if (br > 1.f) br = 1; - return br * br * 0.5f; + return br * br * 0.5f; } void Level::addToTickNextTick(int x, int y, int z, int tileId, int tickDelay) { TickNextTickData td(x, y, z, tileId); - int r = 8; - if (instaTick) { - if (hasChunksAt(td.x - r, td.y - r, td.z - r, td.x + r, td.y + r, td.z + r)) { - int id = getTile(td.x, td.y, td.z); - if (id == td.tileId && id > 0) { - Tile::tiles[id]->tick(this, td.x, td.y, td.z, &random); - } - } - return; - } + int r = 8; + if (instaTick) { + if (hasChunksAt(td.x - r, td.y - r, td.z - r, td.x + r, td.y + r, td.z + r)) { + int id = getTile(td.x, td.y, td.z); + if (id == td.tileId && id > 0) { + Tile::tiles[id]->tick(this, td.x, td.y, td.z, &random); + } + } + return; + } - if (hasChunksAt(x - r, y - r, z - r, x + r, y + r, z + r)) { - if (tileId > 0) { - td.setDelay(tickDelay + levelData.getTime()); - } + if (hasChunksAt(x - r, y - r, z - r, x + r, y + r, z + r)) { + if (tileId > 0) { + td.setDelay(tickDelay + levelData.getTime()); + } if (_tickNextTickSet.find(td) == _tickNextTickSet.end()) { _tickNextTickSet.insert(td); - } - } + } + } } void Level::tickEntities() { @@ -1332,52 +1358,52 @@ void Level::tickEntities() { TIMER_PUSH("remove"); //Util::removeAll(entities, _entitiesToRemove); - // for (int j = 0; j < (int)_entitiesToRemove.size(); j++) { - // Entity* e = _entitiesToRemove[j]; - // int xc = e->xChunk; - // int zc = e->zChunk; - // if (e->inChunk && hasChunk(xc, zc)) { - // getChunk(xc, zc)->removeEntity(e); - // } - // } - // for (int j = 0; j < (int)_entitiesToRemove.size(); j++) { - // entityRemoved(_entitiesToRemove[j]); + // for (int j = 0; j < (int)_entitiesToRemove.size(); j++) { + // Entity* e = _entitiesToRemove[j]; + // int xc = e->xChunk; + // int zc = e->zChunk; + // if (e->inChunk && hasChunk(xc, zc)) { + // getChunk(xc, zc)->removeEntity(e); + // } + // } + // for (int j = 0; j < (int)_entitiesToRemove.size(); j++) { + // entityRemoved(_entitiesToRemove[j]); // //LOGI("a1 &e@delt: %p", _entitiesToRemove[j]); // delete _entitiesToRemove[j]; // //LOGI("a2"); - // } - // _entitiesToRemove.clear(); + // } + // _entitiesToRemove.clear(); EntityList pendingRemovedEntities; std::vector zombies; TIMER_POP_PUSH("regular"); - for (unsigned int i = 0; i < entities.size(); i++) { - Entity* e = entities[i]; + for (unsigned int i = 0; i < entities.size(); i++) { + Entity* e = entities[i]; - if (!e->removed) { - tick(e); + if (!e->removed) { + tick(e); if (e->getEntityTypeId() == MobTypes::Zombie) { zombies.push_back((Zombie*)e); ((Zombie*)e)->setUseNewAi(false); // @note: this is set under } - } + } TIMER_PUSH("remove"); - if (e->removed && (!e->isPlayer() || e->reallyRemoveIfPlayer)) { - int xc = e->xChunk; - int zc = e->zChunk; - if (e->inChunk && hasChunk(xc, zc)) { - getChunk(xc, zc)->removeEntity(e); - } + if (e->removed && (!e->isPlayer() || e->reallyRemoveIfPlayer)) { + int xc = e->xChunk; + int zc = e->zChunk; + if (e->inChunk && hasChunk(xc, zc)) { + getChunk(xc, zc)->removeEntity(e); + } entityIdLookup.erase(e->entityId); entities.erase(entities.begin() + (i--)); - entityRemoved(e); + entityRemoved(e); pendingRemovedEntities.push_back(e); - } + } TIMER_POP(); - } - + } + TIMER_POP_PUSH("remove"); for (unsigned int i = 0; i < pendingRemovedEntities.size(); ++i) { Entity* e = pendingRemovedEntities[i]; @@ -1498,51 +1524,51 @@ void Level::setZombieAi(std::vector& zombies) { } void Level::tick(Entity* e) { - tick(e, true); + tick(e, true); } void Level::tick(Entity* e, bool actual) { - int xc = Mth::floor(e->x); - int zc = Mth::floor(e->z); - int r = 32; - if (actual && !hasChunksAt(xc - r, 0, zc - r, xc + r, 128, zc + r)) { - return; - } + int xc = Mth::floor(e->x); + int zc = Mth::floor(e->z); + int r = 32; + if (actual && !hasChunksAt(xc - r, 0, zc - r, xc + r, 128, zc + r)) { + return; + } - e->xOld = e->x; - e->yOld = e->y; - e->zOld = e->z; - e->yRotO = e->yRot; - e->xRotO = e->xRot; + e->xOld = e->x; + e->yOld = e->y; + e->zOld = e->z; + e->yRotO = e->yRot; + e->xRotO = e->xRot; - if (actual && e->inChunk) { - e->tick(); - } + if (actual && e->inChunk) { + e->tick(); + } TIMER_PUSH("chunkCheck"); - // SANITY!! + // SANITY!! if (e->x != e->x) e->x = e->xOld; // @note: checking for NaN, not sure about Infinite if (e->y != e->y) e->y = e->yOld; if (e->z != e->z) e->z = e->zOld; if (e->xRot != e->xRot) e->xRot = e->xRotO; if (e->yRot != e->yRot) e->yRot = e->yRotO; - int xcn = Mth::floor(e->x / 16.0f); - int ycn = Mth::floor(e->y / 16.0f); - int zcn = Mth::floor(e->z / 16.0f); + int xcn = Mth::floor(e->x / 16.0f); + int ycn = Mth::floor(e->y / 16.0f); + int zcn = Mth::floor(e->z / 16.0f); - if (!e->inChunk || (e->xChunk != xcn || e->yChunk != ycn || e->zChunk != zcn)) { - if (e->inChunk && hasChunk(e->xChunk, e->zChunk)) { - getChunk(e->xChunk, e->zChunk)->removeEntity(e, e->yChunk); - } + if (!e->inChunk || (e->xChunk != xcn || e->yChunk != ycn || e->zChunk != zcn)) { + if (e->inChunk && hasChunk(e->xChunk, e->zChunk)) { + getChunk(e->xChunk, e->zChunk)->removeEntity(e, e->yChunk); + } - if (hasChunk(xcn, zcn)) { - e->inChunk = true; - getChunk(xcn, zcn)->addEntity(e); - } else { - e->inChunk = false; - } - } + if (hasChunk(xcn, zcn)) { + e->inChunk = true; + getChunk(xcn, zcn)->addEntity(e); + } else { + e->inChunk = false; + } + } TIMER_POP(); // Save player info every n:th second @@ -1554,109 +1580,109 @@ void Level::tick(Entity* e, bool actual) { } bool Level::isUnobstructed(const AABB& aabb) { - EntityList& entities = getEntities(NULL, aabb); - for (unsigned int i = 0; i < entities.size(); i++) { - Entity* e = entities[i]; - if (!e->removed && e->blocksBuilding) return false; - } - return true; + EntityList& entities = getEntities(NULL, aabb); + for (unsigned int i = 0; i < entities.size(); i++) { + Entity* e = entities[i]; + if (!e->removed && e->blocksBuilding) return false; + } + return true; } bool Level::containsAnyLiquid(const AABB& box) { - int x0 = Mth::floor(box.x0); - int x1 = Mth::floor(box.x1 + 1); - int y0 = Mth::floor(box.y0); - int y1 = Mth::floor(box.y1 + 1); - int z0 = Mth::floor(box.z0); - int z1 = Mth::floor(box.z1 + 1); + int x0 = Mth::floor(box.x0); + int x1 = Mth::floor(box.x1 + 1); + int y0 = Mth::floor(box.y0); + int y1 = Mth::floor(box.y1 + 1); + int z0 = Mth::floor(box.z0); + int z1 = Mth::floor(box.z1 + 1); - if (box.x0 < 0) x0--; - if (box.y0 < 0) y0--; - if (box.z0 < 0) z0--; + if (box.x0 < 0) x0--; + if (box.y0 < 0) y0--; + if (box.z0 < 0) z0--; - for (int x = x0; x < x1; x++) - for (int y = y0; y < y1; y++) - for (int z = z0; z < z1; z++) { - Tile* tile = Tile::tiles[getTile(x, y, z)]; - if (tile != NULL && tile->material->isLiquid()) { - return true; - } - } - return false; + for (int x = x0; x < x1; x++) + for (int y = y0; y < y1; y++) + for (int z = z0; z < z1; z++) { + Tile* tile = Tile::tiles[getTile(x, y, z)]; + if (tile != NULL && tile->material->isLiquid()) { + return true; + } + } + return false; } bool Level::containsFireTile(const AABB& box) { - int x0 = Mth::floor(box.x0); - int x1 = Mth::floor(box.x1 + 1); - int y0 = Mth::floor(box.y0); - int y1 = Mth::floor(box.y1 + 1); - int z0 = Mth::floor(box.z0); - int z1 = Mth::floor(box.z1 + 1); + int x0 = Mth::floor(box.x0); + int x1 = Mth::floor(box.x1 + 1); + int y0 = Mth::floor(box.y0); + int y1 = Mth::floor(box.y1 + 1); + int z0 = Mth::floor(box.z0); + int z1 = Mth::floor(box.z1 + 1); - if (hasChunksAt(x0, y0, z0, x1, y1, z1)) { - for (int x = x0; x < x1; x++) - for (int y = y0; y < y1; y++) - for (int z = z0; z < z1; z++) { - int t = getTile(x, y, z); + if (hasChunksAt(x0, y0, z0, x1, y1, z1)) { + for (int x = x0; x < x1; x++) + for (int y = y0; y < y1; y++) + for (int z = z0; z < z1; z++) { + int t = getTile(x, y, z); - if (/*t == ((Tile*)(Tile::fire))->id - ||*/ t == Tile::lava->id - || t == Tile::calmLava->id) { - return true; + if (t == ((Tile*)(Tile::fire))->id + || t == Tile::lava->id + || t == Tile::calmLava->id) { + return true; } - } - } - return false; + } + } + return false; } bool Level::containsMaterial(const AABB& box, const Material* material) { - int x0 = Mth::floor(box.x0); - int x1 = Mth::floor(box.x1 + 1); - int y0 = Mth::floor(box.y0); - int y1 = Mth::floor(box.y1 + 1); - int z0 = Mth::floor(box.z0); - int z1 = Mth::floor(box.z1 + 1); + int x0 = Mth::floor(box.x0); + int x1 = Mth::floor(box.x1 + 1); + int y0 = Mth::floor(box.y0); + int y1 = Mth::floor(box.y1 + 1); + int z0 = Mth::floor(box.z0); + int z1 = Mth::floor(box.z1 + 1); - for (int x = x0; x < x1; x++) - for (int y = y0; y < y1; y++) - for (int z = z0; z < z1; z++) { - Tile* tile = Tile::tiles[getTile(x, y, z)]; - if (tile != NULL && tile->material == material) { - return true; - } - } - return false; + for (int x = x0; x < x1; x++) + for (int y = y0; y < y1; y++) + for (int z = z0; z < z1; z++) { + Tile* tile = Tile::tiles[getTile(x, y, z)]; + if (tile != NULL && tile->material == material) { + return true; + } + } + return false; } bool Level::containsLiquid(const AABB& box, const Material* material) { - int x0 = Mth::floor(box.x0); - int x1 = Mth::floor(box.x1 + 1); - int y0 = Mth::floor(box.y0); - int y1 = Mth::floor(box.y1 + 1); - int z0 = Mth::floor(box.z0); - int z1 = Mth::floor(box.z1 + 1); + int x0 = Mth::floor(box.x0); + int x1 = Mth::floor(box.x1 + 1); + int y0 = Mth::floor(box.y0); + int y1 = Mth::floor(box.y1 + 1); + int z0 = Mth::floor(box.z0); + int z1 = Mth::floor(box.z1 + 1); - for (int x = x0; x < x1; x++) - for (int y = y0; y < y1; y++) - for (int z = z0; z < z1; z++) { - Tile* tile = Tile::tiles[getTile(x, y, z)]; - if (tile != NULL && tile->material == material) { - int data = getData(x, y, z); - float yh1 = (float)(y + 1); - if (data < 8) { - yh1 = (float)y + 1.0f - (float)data / 8.0f; - } - if (yh1 >= box.y0) { - return true; - } - } - } - return false; + for (int x = x0; x < x1; x++) + for (int y = y0; y < y1; y++) + for (int z = z0; z < z1; z++) { + Tile* tile = Tile::tiles[getTile(x, y, z)]; + if (tile != NULL && tile->material == material) { + int data = getData(x, y, z); + float yh1 = (float)(y + 1); + if (data < 8) { + yh1 = (float)y + 1.0f - (float)data / 8.0f; + } + if (yh1 >= box.y0) { + return true; + } + } + } + return false; } /* in java, this returns an Explosion */ void Level::explode(Entity* source, float x, float y, float z, float r) { - explode(source, x, y, z, r, false); + explode(source, x, y, z, r, false); } /* in java, this returns an Explosion */ @@ -1672,29 +1698,29 @@ void Level::explode(Entity* source, float x, float y, float z, float r, bool fir } float Level::getSeenPercent(const Vec3& center, const AABB& bb) { - float xs = 1.0f / ((bb.x1 - bb.x0) * 2 + 1); - float ys = 1.0f / ((bb.y1 - bb.y0) * 2 + 1); - float zs = 1.0f / ((bb.z1 - bb.z0) * 2 + 1); - int hits = 0; - int count = 0; - for (float xx = 0; xx <= 1; xx += xs) - for (float yy = 0; yy <= 1; yy += ys) - for (float zz = 0; zz <= 1; zz += zs) { - float x = bb.x0 + (bb.x1 - bb.x0) * xx; - float y = bb.y0 + (bb.y1 - bb.y0) * yy; - float z = bb.z0 + (bb.z1 - bb.z0) * zz; + float xs = 1.0f / ((bb.x1 - bb.x0) * 2 + 1); + float ys = 1.0f / ((bb.y1 - bb.y0) * 2 + 1); + float zs = 1.0f / ((bb.z1 - bb.z0) * 2 + 1); + int hits = 0; + int count = 0; + for (float xx = 0; xx <= 1; xx += xs) + for (float yy = 0; yy <= 1; yy += ys) + for (float zz = 0; zz <= 1; zz += zs) { + float x = bb.x0 + (bb.x1 - bb.x0) * xx; + float y = bb.y0 + (bb.y1 - bb.y0) * yy; + float z = bb.z0 + (bb.z1 - bb.z0) * zz; if (!clip(Vec3(x, y, z), center).isHit()) hits++; - count++; - } + count++; + } - return hits / (float) count; + return hits / (float) count; } bool Level::isSolidBlockingTile(int x, int y, int z) { - Tile* tile = Tile::tiles[getTile(x, y, z)]; - if (tile == NULL) return false; - return tile->material->isSolidBlocking() && tile->isCubeShaped(); + Tile* tile = Tile::tiles[getTile(x, y, z)]; + if (tile == NULL) return false; + return tile->material->isSolidBlocking() && tile->isCubeShaped(); } bool Level::isSolidRenderTile(int x, int y, int z) { @@ -1705,26 +1731,28 @@ bool Level::isSolidRenderTile(int x, int y, int z) { void Level::extinguishFire(int x, int y, int z, int face) { switch (face) { - case Facing::DOWN : y--; break; - case Facing::UP : y++; break; - case Facing::NORTH: z--; break; - case Facing::SOUTH: z++; break; - case Facing::WEST : x--; break; - case Facing::EAST : x++; break; + case Facing::DOWN : y--; break; + case Facing::UP : y++; break; + case Facing::NORTH: z--; break; + case Facing::SOUTH: z++; break; + case Facing::WEST : x--; break; + case Facing::EAST : x++; break; } - if (getTile(x, y, z) == ((Tile*)Tile::fire)->id) { - //playSound(x + 0.5f, y + 0.5f, z + 0.5f, "random.fizz", 0.5f, 2.6f + (random.nextFloat() - random.nextFloat()) * 0.8f); - setTile(x, y, z, 0); - } + if (getTile(x, y, z) == ((Tile*)Tile::fire)->id) { + //playSound(x + 0.5f, y + 0.5f, z + 0.5f, "random.fizz", 0.5f, 2.6f + (random.nextFloat() - random.nextFloat()) * 0.8f); + setTile(x, y, z, 0); + } } -// String gatherStats() { -// return "All: " + this.entities.size(); -// } -// -// String gatherChunkSourceStats() { -// return chunkSource.gatherStats(); -// } + std::string Level::gatherStats() { + std::stringstream ss; + ss << "All: " << entities.size(); + return ss.str(); + } + + std::string Level::gatherChunkSourceStats() { + return _chunkSource->gatherStats(); + } // TileEntity* Level::getTileEntity(int x, int y, int z) { LevelChunk* lc = getChunk(x >> 4, z >> 4); @@ -1783,37 +1811,37 @@ void Level::removeTileEntity(int x, int y, int z) { // int Level::getLightsToUpdate() { - return _lightUpdates.size(); + return _lightUpdates.size(); } bool Level::updateLights() { - if (_maxRecurse >= 50) { - return false; - } + if (_maxRecurse >= 50) { + return false; + } //static int _MaxSize = 0; - _maxRecurse++; - //try { - int max = 500; - while ((int)_lightUpdates.size() > 0) { - if (--max <= 0) - { - _maxRecurse--; - return true; - } - LightUpdate l = _lightUpdates.back(); - _lightUpdates.pop_back(); - l.update(this); - //if ((int)_lightUpdates.size() > _MaxSize) - //{ - // LOGI("MAX_updsize_light: %d (%d)\n", _lightUpdates.size(), _MaxSize); - // _MaxSize = _lightUpdates.size(); - //} - } - _maxRecurse--; - return false; - //} finally { - //maxRecurse--; - //} + _maxRecurse++; + //try { + int max = 500; + while ((int)_lightUpdates.size() > 0) { + if (--max <= 0) + { + _maxRecurse--; + return true; + } + LightUpdate l = _lightUpdates.back(); + _lightUpdates.pop_back(); + l.update(this); + //if ((int)_lightUpdates.size() > _MaxSize) + //{ + // LOGI("MAX_updsize_light: %d (%d)\n", _lightUpdates.size(), _MaxSize); + // _MaxSize = _lightUpdates.size(); + //} + } + _maxRecurse--; + return false; + //} finally { + //maxRecurse--; + //} } void Level::setUpdateLights(bool doUpdate) { @@ -1821,96 +1849,96 @@ void Level::setUpdateLights(bool doUpdate) { } void Level::updateLight(const LightLayer& layer, int x0, int y0, int z0, int x1, int y1, int z1) { - updateLight(layer, x0, y0, z0, x1, y1, z1, true); + updateLight(layer, x0, y0, z0, x1, y1, z1, true); } static int maxLoop = 0; void Level::updateLight(const LightLayer& layer, int x0, int y0, int z0, int x1, int y1, int z1, bool join) { - if ((dimension->hasCeiling && &layer == &LightLayer::Sky) || !_updateLights) return; + if ((dimension->hasCeiling && &layer == &LightLayer::Sky) || !_updateLights) return; - maxLoop++; + maxLoop++; //if (x0 < -5 || z0 < -5) LOGI("x, z: %d, %d\n", x0, z0); - if (maxLoop == 50) { - maxLoop--; - return; - } - int xm = (x1 + x0) / 2; - int zm = (z1 + z0) / 2; - if (!hasChunkAt(xm, Level::DEPTH / 2, zm)) { - maxLoop--; - return; - } - if (getChunkAt(xm, zm)->isEmpty()) + if (maxLoop == 50) { + maxLoop--; + return; + } + int xm = (x1 + x0) / 2; + int zm = (z1 + z0) / 2; + if (!hasChunkAt(xm, Level::DEPTH / 2, zm)) { + maxLoop--; + return; + } + if (getChunkAt(xm, zm)->isEmpty()) { maxLoop--; return; } - int count = _lightUpdates.size(); - if (join) { - int toCheck = 5; - if (toCheck > count) toCheck = count; - for (int i = 0; i < toCheck; i++) { - LightUpdate& last = _lightUpdates[_lightUpdates.size() - i - 1]; - if (last.layer == &layer && last.expandToContain(x0, y0, z0, x1, y1, z1)) { - maxLoop--; - return; - } - } - } - _lightUpdates.push_back(LightUpdate(layer, x0, y0, z0, x1, y1, z1)); - int max = 1000000; - if ((int)_lightUpdates.size() > max) { - LOGI("More than %d updates, aborting lighting updates\n", max); - _lightUpdates.clear(); - } - maxLoop--; + int count = _lightUpdates.size(); + if (join) { + int toCheck = 5; + if (toCheck > count) toCheck = count; + for (int i = 0; i < toCheck; i++) { + LightUpdate& last = _lightUpdates[_lightUpdates.size() - i - 1]; + if (last.layer == &layer && last.expandToContain(x0, y0, z0, x1, y1, z1)) { + maxLoop--; + return; + } + } + } + _lightUpdates.push_back(LightUpdate(layer, x0, y0, z0, x1, y1, z1)); + int max = 1000000; + if ((int)_lightUpdates.size() > max) { + LOGI("More than %d updates, aborting lighting updates\n", max); + _lightUpdates.clear(); + } + maxLoop--; } // // // int xxo, yyo, zzo; // bool Level::updateSkyBrightness() { - int newDark = this->getSkyDarken(1); - if (newDark != skyDarken) { - skyDarken = newDark; + int newDark = this->getSkyDarken(1); + if (newDark != skyDarken) { + skyDarken = newDark; return true; - } + } return false; } void Level::setSpawnSettings(bool spawnEnemies, bool spawnFriendlies) { - //this->spawnEnemies = spawnEnemies; - //this->spawnFriendlies = spawnFriendlies; + //this->spawnEnemies = spawnEnemies; + //this->spawnFriendlies = spawnFriendlies; } void Level::animateTick(int xt, int yt, int zt) { - int r = 16; - Random animateRandom; + int r = 16; + Random animateRandom; - for (int i = 0; i < 100; i++) { - int x = xt + random.nextInt(r) - random.nextInt(r); - int y = yt + random.nextInt(r) - random.nextInt(r); - int z = zt + random.nextInt(r) - random.nextInt(r); - int t = getTile(x, y, z); - if (t > 0) { - Tile::tiles[t]->animateTick(this, x, y, z, &animateRandom); - } - } + for (int i = 0; i < 100; i++) { + int x = xt + random.nextInt(r) - random.nextInt(r); + int y = yt + random.nextInt(r) - random.nextInt(r); + int z = zt + random.nextInt(r) - random.nextInt(r); + int t = getTile(x, y, z); + if (t > 0) { + Tile::tiles[t]->animateTick(this, x, y, z, &animateRandom); + } + } } EntityList& Level::getEntities(Entity* except, const AABB& bb) { - _es.clear(); - int xc0 = Mth::floor((bb.x0 - 2) / 16); - int xc1 = Mth::floor((bb.x1 + 2) / 16); - int zc0 = Mth::floor((bb.z0 - 2) / 16); - int zc1 = Mth::floor((bb.z1 + 2) / 16); - for (int xc = xc0; xc <= xc1; xc++) - for (int zc = zc0; zc <= zc1; zc++) { - if (hasChunk(xc, zc)) { - getChunk(xc, zc)->getEntities(except, bb, _es); - } - } - return _es; + _es.clear(); + int xc0 = Mth::floor((bb.x0 - 2) / 16); + int xc1 = Mth::floor((bb.x1 + 2) / 16); + int zc0 = Mth::floor((bb.z0 - 2) / 16); + int zc1 = Mth::floor((bb.z1 + 2) / 16); + for (int xc = xc0; xc <= xc1; xc++) + for (int zc = zc0; zc <= zc1; zc++) { + if (hasChunk(xc, zc)) { + getChunk(xc, zc)->getEntities(except, bb, _es); + } + } + return _es; } // List getEntitiesOfClass(Class baseClass, AABB bb) { @@ -1929,7 +1957,7 @@ EntityList& Level::getEntities(Entity* except, const AABB& bb) { // } const EntityList& Level::getAllEntities() { - return entities; + return entities; } // int countInstanceOf(Class clas) { @@ -1943,10 +1971,10 @@ const EntityList& Level::getAllEntities() { // /* void Level::addEntities(const EntityList& list) { - entities.insert(entities.end(), list.begin(), list.end()); - for (int j = 0; j < (int)list.size(); j++) { - entityAdded(list[j]); - } +entities.insert(entities.end(), list.begin(), list.end()); +for (int j = 0; j < (int)list.size(); j++) { +entityAdded(list[j]); +} } */ @@ -1955,65 +1983,65 @@ void Level::addEntities(const EntityList& list) { //} void Level::prepare() { - while (_chunkSource->tick()) - ; + while (_chunkSource->tick()) + ; } -bool Level::mayPlace(int tileId, int x, int y, int z, bool ignoreEntities,unsigned char face) { +bool Level::mayPlace(int tileId, int x, int y, int z, bool ignoreEntities,unsigned char face) { int targetType = getTile(x, y, z); const Tile* targetTile = Tile::tiles[targetType]; Tile* tile = Tile::tiles[tileId]; - AABB* aabb = tile->getAABB(this, x, y, z); - if (ignoreEntities) aabb = NULL; - if (aabb != NULL && !isUnobstructed(*aabb)) return false; - if (targetTile == Tile::water || targetTile == Tile::calmWater || targetTile == Tile::lava || targetTile == Tile::calmLava || targetTile == (Tile*)(Tile::fire) || targetTile == Tile::topSnow) targetTile = NULL; - if (tileId > 0 && targetTile == NULL) { - if (tile->mayPlace(this, x, y, z, face)) { - return true; - } - } + AABB* aabb = tile->getAABB(this, x, y, z); + if (ignoreEntities) aabb = NULL; + if (aabb != NULL && !isUnobstructed(*aabb)) return false; + if (targetTile == Tile::water || targetTile == Tile::calmWater || targetTile == Tile::lava || targetTile == Tile::calmLava || targetTile == (Tile*)(Tile::fire) || targetTile == Tile::topSnow) targetTile = NULL; + if (tileId > 0 && targetTile == NULL) { + if (tile->mayPlace(this, x, y, z, face)) { + return true; + } + } - return false; + return false; } int Level::getSeaLevel() { - return SEA_LEVEL; + return SEA_LEVEL; } bool Level::getDirectSignal(int x, int y, int z, int dir) { - int t = getTile(x, y, z); - if (t == 0) return false; - return Tile::tiles[t]->getDirectSignal(this, x, y, z, dir); + int t = getTile(x, y, z); + if (t == 0) return false; + return Tile::tiles[t]->getDirectSignal(this, x, y, z, dir); } bool Level::hasDirectSignal(int x, int y, int z) { - if (getDirectSignal(x, y - 1, z, 0)) return true; - if (getDirectSignal(x, y + 1, z, 1)) return true; - if (getDirectSignal(x, y, z - 1, 2)) return true; - if (getDirectSignal(x, y, z + 1, 3)) return true; - if (getDirectSignal(x - 1, y, z, 4)) return true; - if (getDirectSignal(x + 1, y, z, 5)) return true; - return false; + if (getDirectSignal(x, y - 1, z, 0)) return true; + if (getDirectSignal(x, y + 1, z, 1)) return true; + if (getDirectSignal(x, y, z - 1, 2)) return true; + if (getDirectSignal(x, y, z + 1, 3)) return true; + if (getDirectSignal(x - 1, y, z, 4)) return true; + if (getDirectSignal(x + 1, y, z, 5)) return true; + return false; } bool Level::getSignal(int x, int y, int z, int dir) { - if (isSolidBlockingTile(x, y, z)) { - return hasDirectSignal(x, y, z); - } - int t = getTile(x, y, z); - if (t == 0) return false; - return Tile::tiles[t]->getSignal(this, x, y, z, dir); + if (isSolidBlockingTile(x, y, z)) { + return hasDirectSignal(x, y, z); + } + int t = getTile(x, y, z); + if (t == 0) return false; + return Tile::tiles[t]->getSignal(this, x, y, z, dir); } bool Level::hasNeighborSignal(int x, int y, int z) { - if (getSignal(x, y - 1, z, 0)) return true; - if (getSignal(x, y + 1, z, 1)) return true; - if (getSignal(x, y, z - 1, 2)) return true; - if (getSignal(x, y, z + 1, 3)) return true; - if (getSignal(x - 1, y, z, 4)) return true; - if (getSignal(x + 1, y, z, 5)) return true; - return false; + if (getSignal(x, y - 1, z, 0)) return true; + if (getSignal(x, y + 1, z, 1)) return true; + if (getSignal(x, y, z - 1, 2)) return true; + if (getSignal(x, y, z + 1, 3)) return true; + if (getSignal(x - 1, y, z, 4)) return true; + if (getSignal(x + 1, y, z, 5)) return true; + return false; } // void checkSession() { @@ -2021,44 +2049,44 @@ bool Level::hasNeighborSignal(int x, int y, int z) { // } // void Level::setTime(long time) { - this->levelData.setTime(time); + this->levelData.setTime(time); } long Level::getSeed() { - return levelData.getSeed(); + return levelData.getSeed(); } long Level::getTime() { - return levelData.getTime(); + return levelData.getTime(); } Pos Level::getSharedSpawnPos() { - return Pos(levelData.getXSpawn(), levelData.getYSpawn(), levelData.getZSpawn()); + return Pos(levelData.getXSpawn(), levelData.getYSpawn(), levelData.getZSpawn()); } void Level::setSpawnPos(Pos spawnPos) { - levelData.setSpawn(spawnPos.x, spawnPos.y, spawnPos.z); + levelData.setSpawn(spawnPos.x, spawnPos.y, spawnPos.z); } /* void Level::ensureAdded(Entity* entity) { - int xc = Mth::floor(entity->x / 16); - int zc = Mth::floor(entity->z / 16); - int r = 2; - for (int x = xc - r; x <= xc + r; x++) { - for (int z = zc - r; z <= zc + r; z++) { - this->getChunk(x, z); - } - } +int xc = Mth::floor(entity->x / 16); +int zc = Mth::floor(entity->z / 16); +int r = 2; +for (int x = xc - r; x <= xc + r; x++) { +for (int z = zc - r; z <= zc + r; z++) { +this->getChunk(x, z); +} +} - if (std::find(entities.begin(), entities.end(), entity) == entities.end()) { - entities.push_back(entity); - } +if (std::find(entities.begin(), entities.end(), entity) == entities.end()) { +entities.push_back(entity); +} } */ bool Level::mayInteract(Player* player, int xt, int yt, int zt) { - return true; + return true; } void Level::broadcastEntityEvent(Entity* e, char eventId) { @@ -2070,40 +2098,40 @@ void Level::broadcastEntityEvent(Entity* e, char eventId) { /* void Level::removeAllPendingEntityRemovals() { - //Util::removeAll(entities, _entitiesToRemove); - // //entities.removeAll(entitiesToRemove); - // for (int j = 0; j < (int)_entitiesToRemove.size(); j++) { - // Entity* e = _entitiesToRemove[j]; - // int xc = e->xChunk; - // int zc = e->zChunk; - // if (e->inChunk && hasChunk(xc, zc)) { - // getChunk(xc, zc)->removeEntity(e); - // } - // } +//Util::removeAll(entities, _entitiesToRemove); +// //entities.removeAll(entitiesToRemove); +// for (int j = 0; j < (int)_entitiesToRemove.size(); j++) { +// Entity* e = _entitiesToRemove[j]; +// int xc = e->xChunk; +// int zc = e->zChunk; +// if (e->inChunk && hasChunk(xc, zc)) { +// getChunk(xc, zc)->removeEntity(e); +// } +// } - // for (unsigned int j = 0; j < _entitiesToRemove.size(); j++) { - // entityRemoved(_entitiesToRemove[j]); - // } - // _entitiesToRemove.clear(); +// for (unsigned int j = 0; j < _entitiesToRemove.size(); j++) { +// entityRemoved(_entitiesToRemove[j]); +// } +// _entitiesToRemove.clear(); - for (unsigned int i = 0; i < entities.size(); i++) { - Entity* e = entities[i]; +for (unsigned int i = 0; i < entities.size(); i++) { +Entity* e = entities[i]; - if (e->removed) { - int xc = e->xChunk; - int zc = e->zChunk; - if (e->inChunk && hasChunk(xc, zc)) { - getChunk(xc, zc)->removeEntity(e); - } - entities.erase( entities.begin() + (i--) ); - entityRemoved(e); - } - } +if (e->removed) { +int xc = e->xChunk; +int zc = e->zChunk; +if (e->inChunk && hasChunk(xc, zc)) { +getChunk(xc, zc)->removeEntity(e); +} +entities.erase( entities.begin() + (i--) ); +entityRemoved(e); +} +} } */ ChunkSource* Level::getChunkSource() { - return _chunkSource; + return _chunkSource; } // void tileEvent(int x, int y, int z, int b0, int b1) { @@ -2112,11 +2140,11 @@ ChunkSource* Level::getChunkSource() { // } LevelStorage* Level::getLevelStorage() { - return levelStorage; + return levelStorage; } LevelData* Level::getLevelData() { - return &levelData; + return &levelData; } void Level::takePicture( TripodCamera* cam, Entity* e ) @@ -2138,7 +2166,7 @@ int Level::getEntitiesOfType( int entityType, const AABB& bb, EntityList& list ) getChunk(xc, zc)->getEntitiesOfType(entityType, bb, list); } } - return list.size() - count; + return list.size() - count; } int Level::getEntitiesOfClass( int type, const AABB& bb, EntityList& list ) { @@ -2208,9 +2236,9 @@ void Level::updateSkyDarken() void Level::removePlayer( Player* player ) { for (unsigned int i = 0; i < players.size(); ++i) - if (players[i] == player) { - players.erase( players.begin() + i ); - } + if (players[i] == player) { + players.erase( players.begin() + i ); + } } int Level::isNightMode() { @@ -2222,20 +2250,20 @@ void Level::setNightMode( bool isNightMode ) { } bool Level::inRange( int x, int y, int z ) { - return x >= 0 && x < LEVEL_WIDTH - && y >= 0 && y < LEVEL_HEIGHT - && z >= 0 && z < LEVEL_DEPTH; + return x >= 0 && x < LevelConstants::LEVEL_WIDTH + && y >= 0 && y < LevelConstants::LEVEL_HEIGHT + && z >= 0 && z < LevelConstants::LEVEL_DEPTH; } // // AdventureSettings // AdventureSettings::AdventureSettings() -: doTickTime(true), + : doTickTime(true), noPvP(false), noPvM(false), noMvP(false), immutableWorld(false), - showNameTags(false) + showNameTags(true) { } diff --git a/src/world/level/Level.h b/src/world/level/Level.h index fb76474..e9b9294 100755 --- a/src/world/level/Level.h +++ b/src/world/level/Level.h @@ -67,8 +67,8 @@ class Level: public LevelSource public: static const int MAX_LEVEL_SIZE = 32000000; - static const short DEPTH = LEVEL_HEIGHT; - static const short SEA_LEVEL = DEPTH / 2 - 1; + static const int DEPTH; + static const int SEA_LEVEL; static const int MAX_BRIGHTNESS = 15; static const int TICKS_PER_DAY = SharedConstants::TicksPerSecond * 60 * 16;// SharedConstants::TicksPerSecond * 60 * 12; // ORG:20*60*20 @@ -202,6 +202,9 @@ public: bool checkAndHandleWater(const AABB& box, const Material* material, Entity* e); void extinguishFire(int x, int y, int z, int face); + std::string gatherStats(); + std::string gatherChunkSourceStats(); + //void addEntities(const EntityList& list); //void removeEntities(const EntityList& list); //void ensureAdded(Entity* entity); @@ -307,6 +310,9 @@ public: Dimension* dimension; IRakNetInstance* raknetInstance; Random random; + + std::set ops; + std::set bannedPlayers; protected: bool isFindingSpawn; diff --git a/src/world/level/LevelConstants.cpp b/src/world/level/LevelConstants.cpp new file mode 100644 index 0000000..6a36246 --- /dev/null +++ b/src/world/level/LevelConstants.cpp @@ -0,0 +1,10 @@ +#include "LevelConstants.h" + +int LevelConstants::LEVEL_HEIGHT = 128; +int LevelConstants::CHUNK_CACHE_WIDTH = 16; // in chunks +int LevelConstants::CHUNK_WIDTH = 16; // in blocks +int LevelConstants::CHUNK_DEPTH = 16; +int LevelConstants::LEVEL_WIDTH = LevelConstants::CHUNK_CACHE_WIDTH * CHUNK_WIDTH; +int LevelConstants::LEVEL_DEPTH = LevelConstants::CHUNK_CACHE_WIDTH * CHUNK_DEPTH; +int LevelConstants::CHUNK_COLUMNS = LevelConstants::CHUNK_WIDTH * LevelConstants::CHUNK_DEPTH; +int LevelConstants::CHUNK_BLOCK_COUNT = LevelConstants::CHUNK_COLUMNS * LevelConstants::LEVEL_HEIGHT; \ No newline at end of file diff --git a/src/world/level/LevelConstants.h b/src/world/level/LevelConstants.h index 4d6865b..ed77861 100755 --- a/src/world/level/LevelConstants.h +++ b/src/world/level/LevelConstants.h @@ -1,14 +1,14 @@ -#ifndef _MINECRAFT_WORLD_LEVELCONSTANTS_H_ -#define _MINECRAFT_WORLD_LEVELCONSTANTS_H_ +#pragma once - -const int LEVEL_HEIGHT = 128; -const int CHUNK_CACHE_WIDTH = 16; // in chunks -const int CHUNK_WIDTH = 16; // in blocks -const int CHUNK_DEPTH = 16; -const int LEVEL_WIDTH = CHUNK_CACHE_WIDTH * CHUNK_WIDTH; -const int LEVEL_DEPTH = CHUNK_CACHE_WIDTH * CHUNK_DEPTH; -const int CHUNK_COLUMNS = CHUNK_WIDTH * CHUNK_DEPTH; -const int CHUNK_BLOCK_COUNT = CHUNK_COLUMNS * LEVEL_HEIGHT; - -#endif +class LevelConstants { +public: + static int CHUNK_CACHE_WIDTH; // in chunks + static int LEVEL_WIDTH; + static int LEVEL_DEPTH; + static int LEVEL_HEIGHT; + + static int CHUNK_WIDTH; // in blocks + static int CHUNK_DEPTH; + static int CHUNK_COLUMNS; + static int CHUNK_BLOCK_COUNT; +}; \ No newline at end of file diff --git a/src/world/level/LevelSettings.h b/src/world/level/LevelSettings.h index efb8fa9..98cdde3 100755 --- a/src/world/level/LevelSettings.h +++ b/src/world/level/LevelSettings.h @@ -14,13 +14,14 @@ namespace GameType { class LevelSettings { public: - LevelSettings(long seed, int gameType) + LevelSettings(long seed, int gameType, bool allowCheats = false) : seed(seed), - gameType(gameType) + gameType(gameType), + allowCheats(allowCheats) { } static LevelSettings None() { - return LevelSettings(-1,-1); + return LevelSettings(-1,-1,false); } long getSeed() const { @@ -31,6 +32,10 @@ public: return gameType; } + bool getAllowCheats() const { + return allowCheats; + } + // // Those two should actually not be here // @todo: Move out when we add LevelSettings.cpp :p @@ -53,6 +58,7 @@ public: private: const long seed; const int gameType; + const bool allowCheats; }; #endif /*NET_MINECRAFT_WORLD_LEVEL__LevelSettings_H__*/ diff --git a/src/world/level/LevelSource.h b/src/world/level/LevelSource.h index 5dc5896..a130ec1 100755 --- a/src/world/level/LevelSource.h +++ b/src/world/level/LevelSource.h @@ -3,8 +3,9 @@ //package net.minecraft.world.level; -/* + class BiomeSource; +/* class TileEntity; */ class Material; @@ -29,7 +30,7 @@ public: virtual bool isSolidRenderTile(int x, int i, int z) = 0; virtual bool isSolidBlockingTile(int x, int i, int z) = 0; - //virtual BiomeSource* getBiomeSource() = 0; + virtual BiomeSource* getBiomeSource() = 0; virtual Biome* getBiome(int x, int z) = 0; }; diff --git a/src/world/level/Region.cpp b/src/world/level/Region.cpp index c501912..c2104b3 100755 --- a/src/world/level/Region.cpp +++ b/src/world/level/Region.cpp @@ -4,6 +4,7 @@ #include "tile/Tile.h" #include "Level.h" + Region::Region(Level* level, int x1, int y1, int z1, int x2, int y2, int z2) { this->level = level; @@ -135,6 +136,6 @@ Biome* Region::getBiome( int x, int z ) { return level->getBiome(x, z); } -//BiomeSource getBiomeSource() { -// return level.getBiomeSource(); -//} +BiomeSource* Region::getBiomeSource() { + return level->getBiomeSource(); +} diff --git a/src/world/level/Region.h b/src/world/level/Region.h index b4c3e58..d699099 100755 --- a/src/world/level/Region.h +++ b/src/world/level/Region.h @@ -5,6 +5,7 @@ #include "LevelSource.h" + class Level; class Material; class LevelChunk; @@ -27,6 +28,7 @@ public: int getData(int x, int y, int z); const Material* getMaterial(int x, int y, int z); Biome* getBiome(int x, int z); + BiomeSource* getBiomeSource() override; private: int xc1, zc1; LevelChunk*** chunks; diff --git a/src/world/level/biome/Biome.cpp b/src/world/level/biome/Biome.cpp index d0a842a..4c09842 100755 --- a/src/world/level/biome/Biome.cpp +++ b/src/world/level/biome/Biome.cpp @@ -2,11 +2,15 @@ #include "../levelgen/feature/TreeFeature.h" #include "../levelgen/feature/TallgrassFeature.h" +#include "../levelgen/feature/BasicTree.h" #include "../../entity/EntityTypes.h" #include "../../entity/MobCategory.h" #include "../../level/tile/TallGrass.h" +#include "../../../util/Color.h" +#include "../GrassColor.h" + Biome* Biome::rainForest = NULL; Biome* Biome::swampland = NULL; Biome* Biome::seasonalForest = NULL; @@ -140,7 +144,7 @@ void Biome::teardownBiomes() { Feature* Biome::getTreeFeature( Random* random ) { if (random->nextInt(10) == 0) { - //return /*new*/ BasicTree(); + // return new BasicTree(false); // temporarily disabled } return new TreeFeature(false); } @@ -148,6 +152,9 @@ Feature* Biome::getGrassFeature( Random* random ) { return new TallgrassFeature(Tile::tallgrass->id, TallGrass::TALL_GRASS); } + + + Biome* Biome::getBiome( float temperature, float downfall ) { int a = (int) (temperature * 63); @@ -204,11 +211,31 @@ float Biome::adjustDepth( float depth ) int Biome::getSkyColor( float temp ) { -// temp /= 3.f; -// if (temp < -1) temp = -1; -// if (temp > 1) temp = 1; - return 0x80808080; - //return Color.getHSBColor(224 / 360.0f - temp * 0.05f, 0.50f + temp * 0.1f, 1.0f).getRGB(); + temp /= 3.f; + if (temp < -1) temp = -1; + if (temp > 1) temp = 1; +// return 0x80808080;This is the vanilla way, add it as OPTION_SKY or leave it like this bcus this function literally never gets used anyways if level has vanilla sky color - shredder + return Color::getHSBColor(224 / 360.0f - temp * 0.05f, 0.50f + temp * 0.1f, 1.0f).getRGB(); +} + +float Biome::getDownfall() +{ + return downfall; +} + + +float Biome::getTemperature() +{ + return temperature; +} + + +int Biome::getGrassColor() +{ + float temp = Mth::clamp(getTemperature(), 0.0f, 1.0f); + float rain = Mth::clamp(getDownfall(), 0.0f, 1.0f); + + return GrassColor::get(temp, rain); } Biome::MobList& Biome::getMobs(const MobCategory& category) diff --git a/src/world/level/biome/Biome.h b/src/world/level/biome/Biome.h index 48a49d5..af44be4 100755 --- a/src/world/level/biome/Biome.h +++ b/src/world/level/biome/Biome.h @@ -78,7 +78,13 @@ public: virtual float adjustScale(float scale); virtual float adjustDepth(float depth); + + virtual int getSkyColor(float temp); + virtual int getGrassColor(); + + virtual float getDownfall(); + virtual float getTemperature(); virtual MobList& getMobs(const MobCategory& category); virtual float getCreatureProbability(); @@ -88,6 +94,8 @@ public: char topMaterial; char material; int leafColor; + float temperature; + float downfall; private: static Biome* map[64*64]; }; diff --git a/src/world/level/biome/BiomeSource.cpp b/src/world/level/biome/BiomeSource.cpp index ab7c3a4..395b5a9 100755 --- a/src/world/level/biome/BiomeSource.cpp +++ b/src/world/level/biome/BiomeSource.cpp @@ -69,11 +69,11 @@ Biome* BiomeSource::getBiome( int x, int z ) return getBiomeBlock(x, z, 1, 1)[0]; } -//float BiomeSource::getTemperature( int x, int z ) -//{ -// temperatures = temperatureMap->getRegion(temperatures, x, z, 1, 1, tempScale, tempScale, 0.5f); -// return temperatures[0]; -//} +float BiomeSource::getTemperature( int x, int z ) +{ + temperatures = temperatureMap->getRegion(temperatures, x, z, 1, 1, tempScale, tempScale, 0.5f); + return temperatures[0]; +} Biome** BiomeSource::getBiomeBlock( int x, int z, int w, int h ) { @@ -123,7 +123,7 @@ Biome** BiomeSource::getBiomeBlock( Biome** biomes__, int x, int z, int w, int h return biomes; } -float* BiomeSource::getTemperatureBlock( /*float* temperatures__, */int x, int z, int w, int h ) +float* BiomeSource::getTemperatureBlock( float* temperatures__, int x, int z, int w, int h ) { //LOGI("gTempBlock: 1\n"); //const int size = w * h; @@ -164,8 +164,8 @@ float* BiomeSource::getTemperatureBlock( /*float* temperatures__, */int x, int z return temperatures; } -//float* BiomeSource::getDownfallBlock( /*float* downfalls__,*/ int x, int z, int w, int h ) -//{ +float* BiomeSource::getDownfallBlock( float* downfalls__, int x, int z, int w, int h ) +{ // //const int size = w * h; // //if (lenDownfalls < size) { // // delete[] downfalls; @@ -173,6 +173,6 @@ float* BiomeSource::getTemperatureBlock( /*float* temperatures__, */int x, int z // // lenDownfalls = size; // //} // -// downfalls = downfallMap->getRegion(downfalls, x, z, w, w, downfallScale, downfallScale, 0.5f); -// return downfalls; -//} + downfalls = downfallMap->getRegion(downfalls, x, z, w, w, downfallScale, downfallScale, 0.5f); + return downfalls; +} diff --git a/src/world/level/biome/BiomeSource.h b/src/world/level/biome/BiomeSource.h index fb540c1..25a3e5f 100755 --- a/src/world/level/biome/BiomeSource.h +++ b/src/world/level/biome/BiomeSource.h @@ -31,13 +31,13 @@ public: virtual Biome* getBiome(const ChunkPos& chunk); virtual Biome* getBiome(int x, int z); - //virtual float getTemperature(int x, int z); + virtual float getTemperature(int x, int z); // Note: The arrays returned here are temporary in the meaning that their // contents might change in the future. If you need to SAVE the // values, do a shallow copy to an array of your own. - virtual float* getTemperatureBlock(/*float* temperatures, */ int x, int z, int w, int h); - //virtual float* getDownfallBlock(/*float* downfalls, */int x, int z, int w, int h); + virtual float* getTemperatureBlock(float* temperatures, int x, int z, int w, int h); + virtual float* getDownfallBlock(float* downfalls, int x, int z, int w, int h); virtual Biome** getBiomeBlock(int x, int z, int w, int h); private: diff --git a/src/world/level/biome/ForestBiome.h b/src/world/level/biome/ForestBiome.h index dbc38e5..b28d49d 100755 --- a/src/world/level/biome/ForestBiome.h +++ b/src/world/level/biome/ForestBiome.h @@ -6,6 +6,7 @@ #include "Biome.h" #include "../levelgen/feature/TreeFeature.h" #include "../levelgen/feature/BirchFeature.h" +#include "../levelgen/feature/BasicTree.h" class ForestBiome: public Biome { @@ -15,7 +16,7 @@ public: return new BirchFeature(); } if (random->nextInt(3) == 0) { - //return new BasicTree(); + // return new BasicTree(false); // temporarily disabled } return new TreeFeature(false); } diff --git a/src/world/level/biome/RainforestBiome.h b/src/world/level/biome/RainforestBiome.h index 153ed61..ac94272 100755 --- a/src/world/level/biome/RainforestBiome.h +++ b/src/world/level/biome/RainforestBiome.h @@ -6,13 +6,14 @@ #include "Biome.h" #include "../../../util/Random.h" #include "../levelgen/feature/TreeFeature.h" +#include "../levelgen/feature/BasicTree.h" class RainforestBiome: public Biome { public: Feature* getTreeFeature(Random* random) { if (random->nextInt(3) == 0) { - //return new BasicTree(); + // return new BasicTree(false); // temporarily disabled } return new TreeFeature(false); } diff --git a/src/world/level/chunk/ChunkCache.h b/src/world/level/chunk/ChunkCache.h index b1b16fe..fbb2d77 100755 --- a/src/world/level/chunk/ChunkCache.h +++ b/src/world/level/chunk/ChunkCache.h @@ -10,7 +10,7 @@ #include "../LevelConstants.h" class ChunkCache: public ChunkSource { - //static const int CHUNK_CACHE_WIDTH = CHUNK_CACHE_WIDTH; // WAS 32; + //static const int LevelConstants::CHUNK_CACHE_WIDTH = LevelConstants::CHUNK_CACHE_WIDTH; // WAS 32; static const int MAX_SAVES = 2; public: ChunkCache(Level* level_, ChunkStorage* storage_, ChunkSource* source_) @@ -24,14 +24,17 @@ public: isChunkCache = true; //emptyChunk = new EmptyLevelChunk(level_, emptyChunkBlocks, 0, 0); emptyChunk = new EmptyLevelChunk(level_, NULL, 0, 0); - memset(chunks, 0, sizeof(LevelChunk*) * CHUNK_CACHE_WIDTH * CHUNK_CACHE_WIDTH); + + chunks = new LevelChunk *[LevelConstants::CHUNK_CACHE_WIDTH * LevelConstants::CHUNK_CACHE_WIDTH]; + memset(chunks, 0, sizeof(LevelChunk*) * LevelConstants::CHUNK_CACHE_WIDTH * LevelConstants::CHUNK_CACHE_WIDTH); + LOGI("Chunks allocated."); } ~ChunkCache() { delete source; delete emptyChunk; - for (int i = 0; i < CHUNK_CACHE_WIDTH * CHUNK_CACHE_WIDTH; i++) + for (int i = 0; i < LevelConstants::CHUNK_CACHE_WIDTH * LevelConstants::CHUNK_CACHE_WIDTH; i++) { if (chunks[i]) { @@ -42,7 +45,7 @@ public: } bool fits(int x, int z) { - return (x >= 0 && z >= 0 && x < CHUNK_CACHE_WIDTH && z < CHUNK_CACHE_WIDTH); + return (x >= 0 && z >= 0 && x < LevelConstants::CHUNK_CACHE_WIDTH && z < LevelConstants::CHUNK_CACHE_WIDTH); } bool hasChunk(int x, int z) { @@ -52,9 +55,9 @@ public: if (x == xLast && z == zLast && last != NULL) { return true; } - int xs = x & (CHUNK_CACHE_WIDTH - 1); - int zs = z & (CHUNK_CACHE_WIDTH - 1); - int slot = xs + zs * CHUNK_CACHE_WIDTH; + int xs = x & (LevelConstants::CHUNK_CACHE_WIDTH - 1); + int zs = z & (LevelConstants::CHUNK_CACHE_WIDTH - 1); + int slot = xs + zs * LevelConstants::CHUNK_CACHE_WIDTH; return chunks[slot] != NULL && (chunks[slot] == emptyChunk || chunks[slot]->isAt(x, z)); } @@ -71,9 +74,9 @@ public: } if (!fits(x, z)) return emptyChunk; //if (!level->isFindingSpawn && !fits(x, z)) return emptyChunk; - int xs = x & (CHUNK_CACHE_WIDTH - 1); - int zs = z & (CHUNK_CACHE_WIDTH - 1); - int slot = xs + zs * CHUNK_CACHE_WIDTH; + int xs = x & (LevelConstants::CHUNK_CACHE_WIDTH - 1); + int zs = z & (LevelConstants::CHUNK_CACHE_WIDTH - 1); + int slot = xs + zs * LevelConstants::CHUNK_CACHE_WIDTH; if (!hasChunk(x, z)) { if (chunks[slot] != NULL) { chunks[slot]->unload(); @@ -193,14 +196,17 @@ public: } std::string gatherStats() { - return "ChunkCache: 1024"; + // return "ChunkCache: 1024"; + std::stringstream ss; + ss << "ChunkCache: " << LevelConstants::CHUNK_CACHE_WIDTH * LevelConstants::CHUNK_CACHE_WIDTH; + return ss.str(); } void saveAll(bool onlyUnsaved) { if (storage != NULL) { std::vector chunks; - for (int z = 0; z < CHUNK_CACHE_WIDTH; ++z) - for (int x = 0; x < CHUNK_CACHE_WIDTH; ++x) { + for (int z = 0; z < LevelConstants::CHUNK_CACHE_WIDTH; ++z) + for (int x = 0; x < LevelConstants::CHUNK_CACHE_WIDTH; ++x) { LevelChunk* chunk = level->getChunk(x, z); if (!onlyUnsaved || chunk->shouldSave(false)) chunks.push_back( chunk ); @@ -211,7 +217,7 @@ public: private: LevelChunk* load(int x, int z) { if (storage == NULL) return emptyChunk; - if (x < 0 || x >= CHUNK_CACHE_WIDTH || z < 0 || z >= CHUNK_CACHE_WIDTH) + if (x < 0 || x >= LevelConstants::CHUNK_CACHE_WIDTH || z < 0 || z >= LevelConstants::CHUNK_CACHE_WIDTH) { return emptyChunk; } @@ -254,7 +260,7 @@ private: LevelChunk* emptyChunk; ChunkSource* source; ChunkStorage* storage; - LevelChunk* chunks[CHUNK_CACHE_WIDTH * CHUNK_CACHE_WIDTH]; + LevelChunk** chunks; Level* level; LevelChunk* last; diff --git a/src/world/level/chunk/LevelChunk.cpp b/src/world/level/chunk/LevelChunk.cpp index bb373fb..fd61715 100755 --- a/src/world/level/chunk/LevelChunk.cpp +++ b/src/world/level/chunk/LevelChunk.cpp @@ -12,13 +12,14 @@ /*static*/ bool LevelChunk::touchedSky = false; +int LevelChunk::ChunkBlockCount; LevelChunk::LevelChunk( Level* level, int x, int z ) : level(level), x(x), z(z), - xt(x * CHUNK_WIDTH), - zt(z * CHUNK_DEPTH) + xt(x * LevelConstants::CHUNK_WIDTH), + zt(z * LevelConstants::CHUNK_DEPTH) { init(); } @@ -27,8 +28,8 @@ LevelChunk::LevelChunk( Level* level, unsigned char* blocks, int x, int z ) : level(level), x(x), z(z), - xt(x * CHUNK_WIDTH), - zt(z * CHUNK_DEPTH), + xt(x * LevelConstants::CHUNK_WIDTH), + zt(z * LevelConstants::CHUNK_DEPTH), blocks(blocks), data(ChunkBlockCount), skyLight(ChunkBlockCount), @@ -45,6 +46,9 @@ LevelChunk::~LevelChunk() void LevelChunk::init() { + heightmap = new char[LevelConstants::CHUNK_COLUMNS]; + updateMap = new unsigned char[LevelConstants::CHUNK_COLUMNS]; + terrainPopulated = false; dontSave = false; unsaved = false; @@ -262,14 +266,14 @@ void LevelChunk::recalcHeight(int x, int yStart, int z) { /*public*/ void LevelChunk::skyBrightnessChanged() { -// int x0 = xt; -// int y0 = this->minHeight - 16; -// int z0 = zt; -// int x1 = xt + 16; -// int y1 = Level::DEPTH - 1; -// int z1 = zt + 16; + int x0 = xt; + int y0 = this->minHeight - 16; + int z0 = zt; + int x1 = xt + 16; + int y1 = Level::DEPTH - 1; + int z1 = zt + 16; - //level->setTilesDirty(x0, y0, z0, x1, y1, z1); + level->setTilesDirty(x0, y0, z0, x1, y1, z1); } /*public*/ diff --git a/src/world/level/chunk/LevelChunk.h b/src/world/level/chunk/LevelChunk.h index 5735744..8fe7281 100755 --- a/src/world/level/chunk/LevelChunk.h +++ b/src/world/level/chunk/LevelChunk.h @@ -106,9 +106,9 @@ private: void recalcHeight(int x, int yStart, int z); public: static bool touchedSky; - static const int ChunkBlockCount = CHUNK_BLOCK_COUNT; - static const int ChunkSize = ChunkBlockCount; - static const int UpdateMapBitShift = 4; // power of (LEVEL_HEIGHT / 8) == 16 + static int ChunkBlockCount; + const int ChunkSize = ChunkBlockCount; + static const int UpdateMapBitShift = 4; // power of (LevelConstants::LEVEL_HEIGHT / 8) == 16 int blocksLength; // ? needed or not? (i.e. are all chunks the same size?) @@ -118,12 +118,12 @@ public: DataLayer skyLight; DataLayer blockLight; - char heightmap[CHUNK_COLUMNS]; - unsigned char updateMap[CHUNK_COLUMNS]; // marks regions within block columns that have been modified + char* heightmap; // [LevelConstants::CHUNK_COLUMNS] + unsigned char* updateMap; // marks regions within block columns that have been modified [LevelConstants::CHUNK_COLUMNS] int minHeight; - const int x, z; - const int xt, zt; + int x, z; + int xt, zt; bool terrainPopulated; bool unsaved; diff --git a/src/world/level/dimension/Dimension.cpp b/src/world/level/dimension/Dimension.cpp index 1345c07..19a0eae 100755 --- a/src/world/level/dimension/Dimension.cpp +++ b/src/world/level/dimension/Dimension.cpp @@ -15,7 +15,8 @@ Dimension::Dimension() ultraWarm(false), hasCeiling(false), biomeSource(NULL), - id(0) + id(0), + fogColor(0x80daff) { } @@ -93,6 +94,18 @@ float* Dimension::getSunriseColor( float td, float a ) Vec3 Dimension::getFogColor( float td, float a ) { + if (FogType == 1) + { + fogColor = 0xc0d8ff; // 1 returns java beta styled fog color. + } + else if (FogType == 2) + { + fogColor = 0x406fe5; // 2 returns some type of unused fog color IDK what this one was used for possibly early pe?? + } + else // otherwise as default we return the mcpe fog color + { + fogColor = 0x80daff; + } float br = Mth::cos(td * Mth::PI * 2) * 2 + 0.5f; if (br < 0.0f) br = 0.0f; if (br > 1.0f) br = 1.0f; @@ -104,7 +117,8 @@ Vec3 Dimension::getFogColor( float td, float a ) g *= br * 0.94f + 0.06f; b *= br * 0.91f + 0.09f; return Vec3(r, g, b); - //return Vec3(0.752941f, 0.847059f, 1); + + // } bool Dimension::mayRespawn() @@ -119,22 +133,29 @@ Dimension* Dimension::getNew( int id ) return NULL; } +std::string Dimension::getDimension(){ + int currentID = this->id; + if (currentID == Dimension::NORMAL) return "Overworld"; + if (currentID == Dimension::NORMAL_DAYCYCLE) return "Overworld"; + return "Unknown"; +} + // // DimensionFactory // #include "../storage/LevelData.h" -Dimension* DimensionFactory::createDefaultDimension(LevelData* data ) -{ - int dimensionId = Dimension::NORMAL; + Dimension* DimensionFactory::createDefaultDimension(LevelData* data ) + { + int dimensionId = Dimension::NORMAL; - switch(data->getGameType()) { - case GameType::Survival: dimensionId = Dimension::NORMAL_DAYCYCLE; - break; - case GameType::Creative: - default: - dimensionId = Dimension::NORMAL; - break; - } + switch(data->getGameType()) { + case GameType::Survival: dimensionId = Dimension::NORMAL_DAYCYCLE; + break; + case GameType::Creative: + default: + dimensionId = Dimension::NORMAL; + break; + } return Dimension::getNew(dimensionId); } diff --git a/src/world/level/dimension/Dimension.h b/src/world/level/dimension/Dimension.h index e77dbe3..5600426 100755 --- a/src/world/level/dimension/Dimension.h +++ b/src/world/level/dimension/Dimension.h @@ -49,8 +49,11 @@ public: bool hasCeiling; float brightnessRamp[16];//Level::MAX_BRIGHTNESS + 1]; int id; + std::string getDimension(); + // shredder added + int FogType; // lets us choose between what fog we want ig protected: - static const long fogColor = 0x80daff;//0x406fe5;//0xc0d8ff; + long fogColor; //= 0x80daff;//0x406fe5;//0xc0d8ff; float sunriseCol[4]; }; diff --git a/src/world/level/dimension/NormalDayCycleDimension.h b/src/world/level/dimension/NormalDayCycleDimension.h index 8e44a1a..321b10a 100755 --- a/src/world/level/dimension/NormalDayCycleDimension.h +++ b/src/world/level/dimension/NormalDayCycleDimension.h @@ -9,6 +9,7 @@ class NormalDayCycleDimension: public Dimension { public: + float getTimeOfDay(long time, float a) { int dayStep = (int) (time % Level::TICKS_PER_DAY); float td = (dayStep + a) / Level::TICKS_PER_DAY - 0.25f; @@ -20,6 +21,18 @@ public: } Vec3 getFogColor( float td, float a ) { + if (FogType == 1) + { + fogColor = 0xc0d8ff; // 1 returns java beta styled fog color. + } + else if (FogType == 2) + { + fogColor = 0x406fe5; // 2 returns some type of unused fog color IDK what this one was used for possibly early pe?? + } + else // otherwise as default we return the mcpe fog color + { + fogColor = 0x80daff; + } float br = cos(td * Mth::PI * 2) * 2 + 0.5f; if (br < 0) br = 0; if (br > 1.f) br = 1.f; @@ -35,7 +48,7 @@ public: return Vec3(r, g, b); } - + }; #endif /*NET_MINECRAFT_WORLD_LEVEL_DIMENSION__NormalDayCycleDimension_H__*/ diff --git a/src/world/level/levelgen/CanyonFeature.cpp b/src/world/level/levelgen/CanyonFeature.cpp index f7d9ca3..63f61d2 100755 --- a/src/world/level/levelgen/CanyonFeature.cpp +++ b/src/world/level/levelgen/CanyonFeature.cpp @@ -1,4 +1,4 @@ -#if 0 + #include "CanyonFeature.h" @@ -138,7 +138,7 @@ void CanyonFeature::addTunnel( int xOffs, int zOffs, unsigned char* blocks, floa } } -void CanyonFeature::addFeature( Level level, int x, int z, int xOffs, int zOffs, char* blocks ) +void CanyonFeature::addFeature(Level* level, int x, int z, int xOffs, int zOffs, unsigned char* blocks, int blocksSize) { if (random.nextInt(15) != 0) return; @@ -151,6 +151,7 @@ void CanyonFeature::addFeature( Level level, int x, int z, int xOffs, int zOffs, float thickness = (random.nextFloat() * 2 + random.nextFloat()) + 1; addTunnel(xOffs, zOffs, blocks, xCave, yCave, zCave, thickness, yRot, xRot, 0, 0, 5.0); + } /* //private @@ -165,4 +166,4 @@ void CanyonFeature::addFeature( Level level, int x, int z, int xOffs, int zOffs, for (int z = zOffs - r; z <= zOffs + r; z++) { random.setSeed((x * xScale + z * zScale) ^ level.seed);*/ -#endif + diff --git a/src/world/level/levelgen/CanyonFeature.h b/src/world/level/levelgen/CanyonFeature.h index bd60c71..6b264a5 100755 --- a/src/world/level/levelgen/CanyonFeature.h +++ b/src/world/level/levelgen/CanyonFeature.h @@ -1,7 +1,7 @@ #ifndef NET_MINECRAFT_WORLD_LEVEL_LEVELGEN__CanyonFeature_H__ #define NET_MINECRAFT_WORLD_LEVEL_LEVELGEN__CanyonFeature_H__ -#if 0 + //package net.minecraft.world.level.levelgen; @@ -11,9 +11,13 @@ class CanyonFeature: public LargeFeature { /*protected*/ void addTunnel(int xOffs, int zOffs, unsigned char* blocks, float xCave, float yCave, float zCave, float thickness, float yRot, float xRot, int step, int dist, float yScale); + /*protected*/ - void addFeature(Level level, int x, int z, int xOffs, int zOffs, char* blocks); + void addFeature(Level* level, int x, int z, int xOffs, int zOffs, unsigned char* blocks, int blocksSize); + + + }; -#endif + #endif /*NET_MINECRAFT_WORLD_LEVEL_LEVELGEN__CanyonFeature_H__*/ diff --git a/src/world/level/levelgen/RandomLevelSource.cpp b/src/world/level/levelgen/RandomLevelSource.cpp index 2164f9e..dbaa87b 100755 --- a/src/world/level/levelgen/RandomLevelSource.cpp +++ b/src/world/level/levelgen/RandomLevelSource.cpp @@ -11,13 +11,14 @@ #include "../tile/Tile.h" #include "../tile/HeavyTile.h" #include "../../../util/Random.h" +#include "../../level/tile/TallGrass.h" const float RandomLevelSource::SNOW_CUTOFF = 0.5f; const float RandomLevelSource::SNOW_SCALE = 0.3f; static const int MAX_BUFFER_SIZE = 1024; RandomLevelSource::RandomLevelSource(Level* level, long seed, int version, bool spawnMobs) -: random(seed), + : random(seed), level(level), lperlinNoise1(&random, 16), lperlinNoise2(&random, 16), @@ -32,8 +33,8 @@ RandomLevelSource::RandomLevelSource(Level* level, long seed, int version, bool //biomes(NULL) { for (int i=0; i<32; ++i) - for (int j=0; j<32; ++j) - waterDepths[i][j] = 0; + for (int j=0; j<32; ++j) + waterDepths[i][j] = 0; buffer = new float[MAX_BUFFER_SIZE]; @@ -64,46 +65,46 @@ RandomLevelSource::~RandomLevelSource() { /*public*/ void RandomLevelSource::prepareHeights(int xOffs, int zOffs, unsigned char* blocks, /*Biome*/void* biomes, float* temperatures) { - int xChunks = 16 / CHUNK_WIDTH; + int xChunks = 16 / LevelConstants::CHUNK_WIDTH; int waterHeight = Level::DEPTH - 64; - int xSize = xChunks + 1; - int ySize = 128 / CHUNK_HEIGHT + 1; - int zSize = xChunks + 1; - buffer = getHeights(buffer, xOffs * xChunks, 0, zOffs * xChunks, xSize, ySize, zSize); + int xSize = xChunks + 1; + int ySize = 128 / CHUNK_HEIGHT + 1; + int zSize = xChunks + 1; + buffer = getHeights(buffer, xOffs * xChunks, 0, zOffs * xChunks, xSize, ySize, zSize); - for (int xc = 0; xc < xChunks; xc++) { - for (int zc = 0; zc < xChunks; zc++) { - for (int yc = 0; yc < 128 / CHUNK_HEIGHT; yc++) { - float yStep = 1 / (float) CHUNK_HEIGHT; - float s0 = buffer[((xc + 0) * zSize + (zc + 0)) * ySize + (yc + 0)]; - float s1 = buffer[((xc + 0) * zSize + (zc + 1)) * ySize + (yc + 0)]; - float s2 = buffer[((xc + 1) * zSize + (zc + 0)) * ySize + (yc + 0)]; - float s3 = buffer[((xc + 1) * zSize + (zc + 1)) * ySize + (yc + 0)]; + for (int xc = 0; xc < xChunks; xc++) { + for (int zc = 0; zc < xChunks; zc++) { + for (int yc = 0; yc < 128 / CHUNK_HEIGHT; yc++) { + float yStep = 1 / (float) CHUNK_HEIGHT; + float s0 = buffer[((xc + 0) * zSize + (zc + 0)) * ySize + (yc + 0)]; + float s1 = buffer[((xc + 0) * zSize + (zc + 1)) * ySize + (yc + 0)]; + float s2 = buffer[((xc + 1) * zSize + (zc + 0)) * ySize + (yc + 0)]; + float s3 = buffer[((xc + 1) * zSize + (zc + 1)) * ySize + (yc + 0)]; - float s0a = (buffer[((xc + 0) * zSize + (zc + 0)) * ySize + (yc + 1)] - s0) * yStep; - float s1a = (buffer[((xc + 0) * zSize + (zc + 1)) * ySize + (yc + 1)] - s1) * yStep; - float s2a = (buffer[((xc + 1) * zSize + (zc + 0)) * ySize + (yc + 1)] - s2) * yStep; - float s3a = (buffer[((xc + 1) * zSize + (zc + 1)) * ySize + (yc + 1)] - s3) * yStep; + float s0a = (buffer[((xc + 0) * zSize + (zc + 0)) * ySize + (yc + 1)] - s0) * yStep; + float s1a = (buffer[((xc + 0) * zSize + (zc + 1)) * ySize + (yc + 1)] - s1) * yStep; + float s2a = (buffer[((xc + 1) * zSize + (zc + 0)) * ySize + (yc + 1)] - s2) * yStep; + float s3a = (buffer[((xc + 1) * zSize + (zc + 1)) * ySize + (yc + 1)] - s3) * yStep; for (int y = 0; y < CHUNK_HEIGHT; y++) { - float xStep = 1 / (float) CHUNK_WIDTH; + float xStep = 1 / (float) LevelConstants::CHUNK_WIDTH; - float _s0 = s0; - float _s1 = s1; - float _s0a = (s2 - s0) * xStep; - float _s1a = (s3 - s1) * xStep; + float _s0 = s0; + float _s1 = s1; + float _s0a = (s2 - s0) * xStep; + float _s1a = (s3 - s1) * xStep; - for (int x = 0; x < CHUNK_WIDTH; x++) { - int offs = (x + xc * CHUNK_WIDTH) << 11 | (0 + zc * CHUNK_WIDTH) << 7 | (yc * CHUNK_HEIGHT + y); + for (int x = 0; x < LevelConstants::CHUNK_WIDTH; x++) { + int offs = (x + xc * LevelConstants::CHUNK_WIDTH) << 11 | (0 + zc * LevelConstants::CHUNK_WIDTH) << 7 | (yc * CHUNK_HEIGHT + y); int step = 1 << 7; - float zStep = 1 / (float) CHUNK_WIDTH; + float zStep = 1 / (float) LevelConstants::CHUNK_WIDTH; float val = _s0; float vala = (_s1 - _s0) * zStep; - for (int z = 0; z < CHUNK_WIDTH; z++) { -// + (zc * CHUNK_WIDTH + z)]; - float temp = temperatures[(xc * CHUNK_WIDTH + x) * 16 + (zc * CHUNK_WIDTH + z)]; + for (int z = 0; z < LevelConstants::CHUNK_WIDTH; z++) { +// + (zc * LevelConstants::CHUNK_WIDTH + z)]; + float temp = temperatures[(xc * LevelConstants::CHUNK_WIDTH + x) * 16 + (zc * LevelConstants::CHUNK_WIDTH + z)]; int tileId = 0; if (yc * CHUNK_HEIGHT + y < waterHeight) { if (temp < SNOW_CUTOFF && yc * CHUNK_HEIGHT + y >= waterHeight - 1) { @@ -117,101 +118,101 @@ void RandomLevelSource::prepareHeights(int xOffs, int zOffs, unsigned char* bloc } else { } - blocks[offs] = (unsigned char) tileId; - offs += step; - val += vala; - } - _s0 += _s0a; - _s1 += _s1a; - } + blocks[offs] = (unsigned char) tileId; + offs += step; + val += vala; + } + _s0 += _s0a; + _s1 += _s1a; + } - s0 += s0a; - s1 += s1a; - s2 += s2a; - s3 += s3a; - } - } - } - } + s0 += s0a; + s1 += s1a; + s2 += s2a; + s3 += s3a; + } + } + } + } } void RandomLevelSource::buildSurfaces(int xOffs, int zOffs, unsigned char* blocks, Biome** biomes) { - int waterHeight = Level::DEPTH - 64; + int waterHeight = Level::DEPTH - 64; - float s = 1 / 32.0f; - perlinNoise2.getRegion(sandBuffer, (float)(xOffs * 16), (float)(zOffs * 16), 0, 16, 16, 1, s, s, 1); - perlinNoise2.getRegion(gravelBuffer, (float)(xOffs * 16), 109.01340f, (float)(zOffs * 16), 16, 1, 16, s, 1, s); - perlinNoise3.getRegion(depthBuffer, (float)(xOffs * 16), (float)(zOffs * 16), 0, 16, 16, 1, s * 2, s * 2, s * 2); + float s = 1 / 32.0f; + perlinNoise2.getRegion(sandBuffer, (float)(xOffs * 16), (float)(zOffs * 16), 0, 16, 16, 1, s, s, 1); + perlinNoise2.getRegion(gravelBuffer, (float)(xOffs * 16), 109.01340f, (float)(zOffs * 16), 16, 1, 16, s, 1, s); + perlinNoise3.getRegion(depthBuffer, (float)(xOffs * 16), (float)(zOffs * 16), 0, 16, 16, 1, s * 2, s * 2, s * 2); - for (int x = 0; x < 16; x++) { - for (int z = 0; z < 16; z++) { + for (int x = 0; x < 16; x++) { + for (int z = 0; z < 16; z++) { float temp = 1; // @todo: read temp from BiomeSource - Biome* b = biomes[x + z * 16]; - bool sand = (sandBuffer[x + z * 16] + random.nextFloat() * 0.2f) > 0; - bool gravel = (gravelBuffer[x + z * 16] + random.nextFloat() * 0.2f) > 3; - int runDepth = (int) (depthBuffer[x + z * 16] / 3 + 3 + random.nextFloat() * 0.25f); + Biome* b = biomes[x + z * 16]; + bool sand = (sandBuffer[x + z * 16] + random.nextFloat() * 0.2f) > 0; + bool gravel = (gravelBuffer[x + z * 16] + random.nextFloat() * 0.2f) > 3; + int runDepth = (int) (depthBuffer[x + z * 16] / 3 + 3 + random.nextFloat() * 0.25f); - int run = -1; + int run = -1; char top = b->topMaterial; - char material = b->material; + char material = b->material; - for (int y = 127; y >= 0; y--) { - int offs = (z * 16 + x) * 128 + y; + for (int y = 127; y >= 0; y--) { + int offs = (z * 16 + x) * 128 + y; - if (y <= 0 + random.nextInt(5)) { - blocks[offs] = (char) Tile::unbreakable->id; - } else { - int old = blocks[offs]; + if (y <= 0 + random.nextInt(5)) { + blocks[offs] = (char) Tile::unbreakable->id; + } else { + int old = blocks[offs]; - if (old == 0) { - run = -1; - } else if (old == Tile::rock->id) { - if (run == -1) { - if (runDepth <= 0) { - top = 0; - material = (char) Tile::rock->id; - } else if (y >= waterHeight - 4 && y <= waterHeight + 1) { - top = b->topMaterial; + if (old == 0) { + run = -1; + } else if (old == Tile::rock->id) { + if (run == -1) { + if (runDepth <= 0) { + top = 0; + material = (char) Tile::rock->id; + } else if (y >= waterHeight - 4 && y <= waterHeight + 1) { + top = b->topMaterial; material = b->material; - + //@attn: ? - if (gravel) { + if (gravel) { top = 0; material = (char) Tile::gravel->id; } - if (sand) { + if (sand) { top = (char) Tile::sand->id; material = (char) Tile::sand->id; } - } + } - if (y < waterHeight && top == 0) { + if (y < waterHeight && top == 0) { if (temp < 0.15f) top = (char) Tile::ice->id; else top = (char) Tile::calmWater->id; } - run = runDepth; - if (y >= waterHeight - 1) blocks[offs] = top; - else blocks[offs] = material; - } else if (run > 0) { - run--; - blocks[offs] = material; + run = runDepth; + if (y >= waterHeight - 1) blocks[offs] = top; + else blocks[offs] = material; + } else if (run > 0) { + run--; + blocks[offs] = material; - // place a few sandstone blocks beneath sand - // runs - if (run == 0 && material == Tile::sand->id) { - run = random.nextInt(4); - material = (char) Tile::sandStone->id; - } - } - } - } - } - } - } + // place a few sandstone blocks beneath sand + // runs + if (run == 0 && material == Tile::sand->id) { + run = random.nextInt(4); + material = (char) Tile::sandStone->id; + } + } + } + } + } + } + } } @@ -220,269 +221,320 @@ void RandomLevelSource::postProcess(ChunkSource* parent, int xt, int zt) { level->isGeneratingTerrain = true; - HeavyTile::instaFall = true; - int xo = xt * 16; - int zo = zt * 16; + HeavyTile::instaFall = true; + int xo = xt * 16; + int zo = zt * 16; - Biome* biome = level->getBiomeSource()->getBiome(xo + 16, zo + 16); - // Biome* biome = Biome::forest; + Biome* biome = level->getBiomeSource()->getBiome(xo + 16, zo + 16); +// Biome* biome = Biome::forest; - random.setSeed(level->getSeed()); - int xScale = random.nextInt() / 2 * 2 + 1; - int zScale = random.nextInt() / 2 * 2 + 1; - random.setSeed(((xt * xScale) + (zt * zScale)) ^ level->getSeed()); + random.setSeed(level->getSeed()); + int xScale = random.nextInt() / 2 * 2 + 1; + int zScale = random.nextInt() / 2 * 2 + 1; + random.setSeed(((xt * xScale) + (zt * zScale)) ^ level->getSeed()); + + + // @todo - add generation options to enable or disable extra features like lava lakes or water lakes as they affect seed parity with the original vanilla game - shredder // //@todo: hide those chunks if they are aren't visible -// if (random.nextInt(4) == 0) { -// int x = xo + random.nextInt(16) + 8; -// int y = random.nextInt(128); -// int z = zo + random.nextInt(16) + 8; -// LakeFeature feature(Tile::calmWater->id); -// feature.place(level, &random, x, y, z); -// LOGI("Adding underground lake @ (%d,%d,%d)\n", x, y, z); -// } + if (random.nextInt(4) == 0) { + int x = xo + random.nextInt(16) + 8; + int y = random.nextInt(128); + int z = zo + random.nextInt(16) + 8; + LakeFeature feature(Tile::calmWater->id); + feature.place(level, &random, x, y, z); + // LOGI("Adding underground lake @ (%d,%d,%d)\n", x, y, z); + } ////@todo: hide those chunks if they are aren't visible - // if (random.nextInt(8) == 0) { - // int x = xo + random.nextInt(16) + 8; - // int y = random.nextInt(random.nextInt(120) + 8); - // int z = zo + random.nextInt(16) + 8; - // if (y < 64 || random.nextInt(10) == 0) { - // LakeFeature feature(Tile::calmLava->id); - // feature.place(level, &random, x, y, z); - // } - // } + if (random.nextInt(8) == 0) { + int x = xo + random.nextInt(16) + 8; + int y = random.nextInt(random.nextInt(120) + 8); + int z = zo + random.nextInt(16) + 8; + if (y < 64 || random.nextInt(10) == 0) { + LakeFeature feature(Tile::calmLava->id); + feature.place(level, &random, x, y, z); + } + } static float totalTime = 0; const float st = getTimeS(); - //for (int i = 0; i < 8; i++) { - // int x = xo + random.nextInt(16) + 8; - // int y = random.nextInt(128); - // int z = zo + random.nextInt(16) + 8; - // MonsterRoomFeature().place(level, random, x, y, z); - //} + //for (int i = 0; i < 8; i++) { + // int x = xo + random.nextInt(16) + 8; + // int y = random.nextInt(128); + // int z = zo + random.nextInt(16) + 8; + // MonsterRoomFeature().place(level, random, x, y, z); + //} - for (int i = 0; i < 10; i++) { - int x = xo + random.nextInt(16); - int y = random.nextInt(128); - int z = zo + random.nextInt(16); - ClayFeature feature(32); + for (int i = 0; i < 10; i++) { + int x = xo + random.nextInt(16); + int y = random.nextInt(128); + int z = zo + random.nextInt(16); + ClayFeature feature(32); feature.place(level, &random, x, y, z); - } + } - for (int i = 0; i < 20; i++) { - int x = xo + random.nextInt(16); - int y = random.nextInt(128); - int z = zo + random.nextInt(16); - OreFeature feature(Tile::dirt->id, 32); + for (int i = 0; i < 20; i++) { + int x = xo + random.nextInt(16); + int y = random.nextInt(128); + int z = zo + random.nextInt(16); + OreFeature feature(Tile::dirt->id, 32); feature.place(level, &random, x, y, z); - } + } - for (int i = 0; i < 10; i++) { - int x = xo + random.nextInt(16); - int y = random.nextInt(128); - int z = zo + random.nextInt(16); - OreFeature feature(Tile::gravel->id, 32); + for (int i = 0; i < 10; i++) { + int x = xo + random.nextInt(16); + int y = random.nextInt(128); + int z = zo + random.nextInt(16); + OreFeature feature(Tile::gravel->id, 32); feature.place(level, &random, x, y, z); - } + } - for (int i = 0; i < 20; i++) { - int x = xo + random.nextInt(16); - int y = random.nextInt(128); - int z = zo + random.nextInt(16); - OreFeature feature(Tile::coalOre->id, 16); + // @todo - add generation options to enable or disable adjusted ore spawn rates as they affect seed parity with the original vanilla game - shredder + + // Coal: common, wide Y range, moderate vein size + for (int i = 0; i < 16; i++) { + int x = xo + random.nextInt(16); + int y = random.nextInt(128); + int z = zo + random.nextInt(16); + OreFeature feature(Tile::coalOre->id, 14); feature.place(level, &random, x, y, z); - } + } - for (int i = 0; i < 20; i++) { - int x = xo + random.nextInt(16); - int y = random.nextInt(64); - int z = zo + random.nextInt(16); - OreFeature feature(Tile::ironOre->id, 8); + // Iron: common, limited to upper underground + for (int i = 0; i < 14; i++) { + int x = xo + random.nextInt(16); + int y = random.nextInt(64); + int z = zo + random.nextInt(16); + OreFeature feature(Tile::ironOre->id, 10); feature.place(level, &random, x, y, z); - } + } - for (int i = 0; i < 2; i++) { - int x = xo + random.nextInt(16); - int y = random.nextInt(32); - int z = zo + random.nextInt(16); - OreFeature feature(Tile::goldOre->id, 8); + // Gold: rarer and deeper + for (int i = 0; i < 2; i++) { + int x = xo + random.nextInt(16); + int y = random.nextInt(32); + int z = zo + random.nextInt(16); + OreFeature feature(Tile::goldOre->id, 9); feature.place(level, &random, x, y, z); - } + } - for (int i = 0; i < 8; i++) { - int x = xo + random.nextInt(16); - int y = random.nextInt(16); - int z = zo + random.nextInt(16); - OreFeature feature(Tile::redStoneOre->id, 7); + // Redstone: somewhat common at low depths + for (int i = 0; i < 6; i++) { + int x = xo + random.nextInt(16); + int y = random.nextInt(16); + int z = zo + random.nextInt(16); + OreFeature feature(Tile::redStoneOre->id, 8); feature.place(level, &random, x, y, z); - } + } - for (int i = 0; i < 1; i++) { - int x = xo + random.nextInt(16); - int y = random.nextInt(16); - int z = zo + random.nextInt(16); - OreFeature feature(Tile::emeraldOre->id, 7); + // Emerald (diamond-equivalent): still rare but slightly more than vanilla + for (int i = 0; i < 3; i++) { + int x = xo + random.nextInt(16); + int y = random.nextInt(16); + int z = zo + random.nextInt(16); + OreFeature feature(Tile::emeraldOre->id, 6); feature.place(level, &random, x, y, z); - } + } - // lapis ore - for (int i = 0; i < 1; i++) { - int x = xo + random.nextInt(16); - int y = random.nextInt(16) + random.nextInt(16); - int z = zo + random.nextInt(16); - OreFeature feature(Tile::lapisOre->id, 6); + // Lapis: rare and not in very high Y + for (int i = 0; i < 1; i++) { + int x = xo + random.nextInt(16); + int y = random.nextInt(16) + random.nextInt(16); + int z = zo + random.nextInt(16); + OreFeature feature(Tile::lapisOre->id, 6); feature.place(level, &random, x, y, z); - } + } - const float ss = 0.5f; - int oFor = (int) ((forestNoise.getValue(xo * ss, zo * ss) / 8 + random.nextFloat() * 4 + 4) / 3); - int forests = 0;//1; (java: 0) - if (random.nextInt(10) == 0) forests += 1; + const float ss = 0.5f; + int oFor = (int) ((forestNoise.getValue(xo * ss, zo * ss) / 8 + random.nextFloat() * 4 + 4) / 3); + int forests = 0;//1; (java: 0) + if (random.nextInt(10) == 0) forests += 1; - if (biome == Biome::forest) forests += oFor + 2; // + 5 - if (biome == Biome::rainForest) forests += oFor + 2; //+ 5 - if (biome == Biome::seasonalForest) forests += oFor + 1; // 2 - if (biome == Biome::taiga) { + if (biome == Biome::forest) forests += oFor + 2; // + 5 + if (biome == Biome::rainForest) forests += oFor + 2; //+ 5 + if (biome == Biome::seasonalForest) forests += oFor + 1; // 2 + if (biome == Biome::taiga) { forests += oFor + 1; // + 5 //LOGI("Biome is taiga!\n"); } - if (biome == Biome::desert) forests -= 20; - if (biome == Biome::tundra) forests -= 20; - if (biome == Biome::plains) forests -= 20; + if (biome == Biome::desert) forests -= 20; + if (biome == Biome::tundra) forests -= 20; + if (biome == Biome::plains) forests -= 20; - for (int i = 0; i < forests; i++) { - int x = xo + random.nextInt(16) + 8; - int z = zo + random.nextInt(16) + 8; + for (int i = 0; i < forests; i++) { + int x = xo + random.nextInt(16) + 8; + int z = zo + random.nextInt(16) + 8; int y = level->getHeightmap(x, z); - Feature* tree = biome->getTreeFeature(&random); + Feature* tree = biome->getTreeFeature(&random); if (tree) { - tree->init(1, 1, 1); - tree->place(level, &random, x, y, z); + tree->init(1, 1, 1); + tree->place(level, &random, x, y, z); delete tree; } //printf("placing tree at %d, %d, %d\n", x, y, z); - } + } + // for (int i = 0; i < forests; i++) { + // int x = xo + random.nextInt(16) + 8; + // int z = zo + random.nextInt(16) + 8; + //int y = level->getHeightmap(x, z); + // Feature* tree = biome->getBasicTreeFeature(&random); + //if (tree) { + // tree->init(1, 1, 1); + // tree->place(level, &random, x, y, z); + // delete tree; + //} + ////printf("placing tree at %d, %d, %d\n", x, y, z); + // } - for (int i = 0; i < 2; i++) { - int x = xo + random.nextInt(16) + 8; - int y = random.nextInt(128); - int z = zo + random.nextInt(16) + 8; - FlowerFeature feature(Tile::flower->id); - feature.place(level, &random, x, y, z); - } - - if (random.nextInt(2) == 0) { - int x = xo + random.nextInt(16) + 8; - int y = random.nextInt(128); - int z = zo + random.nextInt(16) + 8; - FlowerFeature feature(Tile::rose->id); - feature.place(level, &random, x, y, z); - } - - if (random.nextInt(4) == 0) { - int x = xo + random.nextInt(16) + 8; - int y = random.nextInt(128); - int z = zo + random.nextInt(16) + 8; - FlowerFeature feature(Tile::mushroom1->id); - feature.place(level, &random, x, y, z); - } - - if (random.nextInt(8) == 0) { - int x = xo + random.nextInt(16) + 8; - int y = random.nextInt(128); - int z = zo + random.nextInt(16) + 8; - FlowerFeature feature(Tile::mushroom2->id); - feature.place(level, &random, x, y, z); - } - /*int grassCount = 1; - for (int i = 0; i < grassCount; i++) { + for (int i = 0; i < 2; i++) { int x = xo + random.nextInt(16) + 8; - int y = random.nextInt(Level::genDepth); + int y = random.nextInt(128); int z = zo + random.nextInt(16) + 8; - Feature* grassFeature = biome->getGrassFeature(&random); - if (grassFeature) { - grassFeature->place(level, &random, x, y, z); - delete grassFeature; - } - }*/ - for (int i = 0; i < 10; i++) { - int x = xo + random.nextInt(16) + 8; - int y = random.nextInt(128); - int z = zo + random.nextInt(16) + 8; - ReedsFeature feature; + FlowerFeature feature(Tile::flower->id); feature.place(level, &random, x, y, z); - } - + } - //if (random.nextInt(32) == 0) { - // int x = xo + random.nextInt(16) + 8; - // int y = random.nextInt(128); - // int z = zo + random.nextInt(16) + 8; - // PumpkinFeature().place(level, random, x, y, z); - //} - - int cacti = 0; - if (biome == Biome::desert) cacti += 5; - - for (int i = 0; i < cacti; i++) { - int x = xo + random.nextInt(16) + 8; - int y = random.nextInt(128); - int z = zo + random.nextInt(16) + 8; - CactusFeature feature; - //LOGI("Tried creating a cactus at %d, %d, %d\n", x, y, z); - feature.place(level, &random, x, y, z); - } - - for (int i = 0; i < 50; i++) { - int x = xo + random.nextInt(16) + 8; - int y = random.nextInt(random.nextInt(120) + 8); - int z = zo + random.nextInt(16) + 8; - SpringFeature feature(Tile::water->id); + if (random.nextInt(2) == 0) { + int x = xo + random.nextInt(16) + 8; + int y = random.nextInt(128); + int z = zo + random.nextInt(16) + 8; + FlowerFeature feature(Tile::rose->id); feature.place(level, &random, x, y, z); + } + + if (random.nextInt(4) == 0) { + int x = xo + random.nextInt(16) + 8; + int y = random.nextInt(128); + int z = zo + random.nextInt(16) + 8; + FlowerFeature feature(Tile::mushroom1->id); + feature.place(level, &random, x, y, z); + } + + if (random.nextInt(8) == 0) { + int x = xo + random.nextInt(16) + 8; + int y = random.nextInt(128); + int z = zo + random.nextInt(16) + 8; + FlowerFeature feature(Tile::mushroom2->id); + feature.place(level, &random, x, y, z); + } + // normally unused in mcpe but how its supposed to do it + //int grassCount = 1; + //for (int i = 0; i < grassCount; i++) { + //int x = xo + random.nextInt(16) + 8; + //int y = random.nextInt(Level::genDepth); + //int z = zo + random.nextInt(16) + 8; + //Feature* grassFeature = biome->getGrassFeature(&random); + //if (grassFeature) { + //grassFeature->place(level, &random, x, y, z); + //delete grassFeature; + //} + //} + + // reworked code from above to generate ferns and shrubs to just like in beta java +int grassCount = 0; + +if (biome == Biome::forest) { grassCount = 2; } +else if (biome == Biome::rainForest) { grassCount = 10; } +else if (biome == Biome::seasonalForest) { grassCount = 2; } +else if (biome == Biome::taiga) { grassCount = 1; } +else if (biome == Biome::plains) { grassCount = 10; } + +for (int i = 0; i < grassCount; i++) { + int grassMetadata = TallGrass::TALL_GRASS; + + + if (biome == Biome::rainForest && random.nextInt(3) != 0) { + grassMetadata = TallGrass::FERN; } - for (int i = 0; i < 20; i++) { - int x = xo + random.nextInt(16) + 8; - int y = random.nextInt(random.nextInt(random.nextInt(112) + 8) + 8); - int z = zo + random.nextInt(16) + 8; - SpringFeature feature(Tile::lava->id); + int x = xo + random.nextInt(16) + 8; + + int z = zo + random.nextInt(16) + 8; + int y = level->getHeightmap(x, z); + + TallgrassFeature grassFeature(Tile::tallgrass->id, grassMetadata); + grassFeature.place(level, &random, x, y, z); +} + + + for (int i = 0; i < 10; i++) { + int x = xo + random.nextInt(16) + 8; + int y = random.nextInt(128); + int z = zo + random.nextInt(16) + 8; + ReedsFeature feature; feature.place(level, &random, x, y, z); - } + } + + + //if (random.nextInt(32) == 0) { + // int x = xo + random.nextInt(16) + 8; + // int y = random.nextInt(128); + // int z = zo + random.nextInt(16) + 8; + // PumpkinFeature().place(level, random, x, y, z); + //} + + int cacti = 0; + if (biome == Biome::desert) cacti += 5; + + for (int i = 0; i < cacti; i++) { + int x = xo + random.nextInt(16) + 8; + int y = random.nextInt(128); + int z = zo + random.nextInt(16) + 8; + CactusFeature feature; + //LOGI("Tried creating a cactus at %d, %d, %d\n", x, y, z); + feature.place(level, &random, x, y, z); + } + + for (int i = 0; i < 50; i++) { + int x = xo + random.nextInt(16) + 8; + int y = random.nextInt(random.nextInt(120) + 8); + int z = zo + random.nextInt(16) + 8; + SpringFeature feature(Tile::water->id); + feature.place(level, &random, x, y, z); + } + + for (int i = 0; i < 20; i++) { + int x = xo + random.nextInt(16) + 8; + int y = random.nextInt(random.nextInt(random.nextInt(112) + 8) + 8); + int z = zo + random.nextInt(16) + 8; + SpringFeature feature(Tile::lava->id); + feature.place(level, &random, x, y, z); + } if (spawnMobs && !level->isClientSide) MobSpawner::postProcessSpawnMobs(level, biome, xo + 8, zo + 8, 16, 16, &random); //LOGI("Reading temp: 1\n"); - float* temperatures = level->getBiomeSource()->getTemperatureBlock(/*NULL,*/ xo + 8, zo + 8, 16, 16); - for (int x = xo + 8; x < xo + 8 + 16; x++) - for (int z = zo + 8; z < zo + 8 + 16; z++) { - int xp = x - (xo + 8); - int zp = z - (zo + 8); - int y = level->getTopSolidBlock(x, z); - float temp = temperatures[xp * 16 + zp] - (y - 64) / 64.0f * SNOW_SCALE; - if (temp < SNOW_CUTOFF) { - if (y > 0 && y < 128 && level->isEmptyTile(x, y, z) && level->getMaterial(x, y - 1, z)->blocksMotion()) { - if (level->getMaterial(x, y - 1, z) != Material::ice) level->setTile(x, y, z, Tile::topSnow->id); - } - } - } - //LOGI("Reading temp: 0 END\n"); + float* temperatures = level->getBiomeSource()->getTemperatureBlock(NULL, xo + 8, zo + 8, 16, 16); + for (int x = xo + 8; x < xo + 8 + 16; x++) + for (int z = zo + 8; z < zo + 8 + 16; z++) { + int xp = x - (xo + 8); + int zp = z - (zo + 8); + int y = level->getTopSolidBlock(x, z); + float temp = temperatures[xp * 16 + zp] - (y - 64) / 64.0f * SNOW_SCALE; + if (temp < SNOW_CUTOFF) { + if (y > 0 && y < 128 && level->isEmptyTile(x, y, z) && level->getMaterial(x, y - 1, z)->blocksMotion()) { + if (level->getMaterial(x, y - 1, z) != Material::ice) level->setTile(x, y, z, Tile::topSnow->id); + } + } + } + //LOGI("Reading temp: 0 END\n"); - const float et = getTimeS(); - totalTime += (et-st); + const float et = getTimeS(); + totalTime += (et-st); - //printf("Time to place features: %f. Total %f\n", et - st, totalTime); + //printf("Time to place features: %f. Total %f\n", et - st, totalTime); - HeavyTile::instaFall = false; + HeavyTile::instaFall = false; - level->isGeneratingTerrain = false; + level->isGeneratingTerrain = false; } LevelChunk* RandomLevelSource::create(int x, int z) { - return getChunk(x, z); + return getChunk(x, z); } LevelChunk* RandomLevelSource::getChunk(int xOffs, int zOffs) { @@ -493,21 +545,23 @@ LevelChunk* RandomLevelSource::getChunk(int xOffs, int zOffs) { if (it != chunkMap.end()) return it->second; - random.setSeed((long)(xOffs * 341872712l + zOffs * 132899541l)); //@fix + random.setSeed((long)(xOffs * 341872712l + zOffs * 132899541l)); //@fix - unsigned char* blocks = new unsigned char[LevelChunk::ChunkBlockCount]; - LevelChunk* levelChunk = new LevelChunk(level, blocks, xOffs, zOffs); + unsigned char* blocks = new unsigned char[LevelChunk::ChunkBlockCount]; + LevelChunk* levelChunk = new LevelChunk(level, blocks, xOffs, zOffs); chunkMap.insert(std::make_pair(hashedPos, levelChunk)); Biome** biomes = level->getBiomeSource()->getBiomeBlock(/*biomes, */xOffs * 16, zOffs * 16, 16, 16); - float* temperatures = level->getBiomeSource()->temperatures; - prepareHeights(xOffs, zOffs, blocks, 0, temperatures);//biomes, temperatures); - buildSurfaces(xOffs, zOffs, blocks, biomes); + float* temperatures = level->getBiomeSource()->temperatures; + prepareHeights(xOffs, zOffs, blocks, 0, temperatures);//biomes, temperatures); + buildSurfaces(xOffs, zOffs, blocks, biomes); - //caveFeature.apply(this, level, xOffs, zOffs, blocks, LevelChunk::ChunkBlockCount); - levelChunk->recalcHeightmap(); + // Carve caves into the chunk + caveFeature.apply(this, level, xOffs, zOffs, blocks, LevelChunk::ChunkBlockCount); + canyonFeature.apply(this, level, xOffs, zOffs, blocks, LevelChunk::ChunkBlockCount); + levelChunk->recalcHeightmap(); - return levelChunk; + return levelChunk; } /*private*/ @@ -517,138 +571,138 @@ float* RandomLevelSource::getHeights(float* buffer, int x, int y, int z, int xSi LOGI("RandomLevelSource::getHeights: TOO LARGE BUFFER REQUESTED: %d (max %d)\n", size, MAX_BUFFER_SIZE); } - float s = 1 * 684.412f; - float hs = 1 * 684.412f; + float s = 1 * 684.412f; + float hs = 1 * 684.412f; - float* temperatures = level->getBiomeSource()->temperatures; - float* downfalls = level->getBiomeSource()->downfalls; - sr = scaleNoise.getRegion(sr, x, z, xSize, zSize, 1.121f, 1.121f, 0.5f); - dr = depthNoise.getRegion(dr, x, z, xSize, zSize, 200.0f, 200.0f, 0.5f); + float* temperatures = level->getBiomeSource()->temperatures; + float* downfalls = level->getBiomeSource()->downfalls; + sr = scaleNoise.getRegion(sr, x, z, xSize, zSize, 1.121f, 1.121f, 0.5f); + dr = depthNoise.getRegion(dr, x, z, xSize, zSize, 200.0f, 200.0f, 0.5f); - pnr = perlinNoise1.getRegion(pnr, (float)x, (float)y, (float)z, xSize, ySize, zSize, s / 80.0f, hs / 160.0f, s / 80.0f); - ar = lperlinNoise1.getRegion(ar, (float)x, (float)y, (float)z, xSize, ySize, zSize, s, hs, s); - br = lperlinNoise2.getRegion(br, (float)x, (float)y, (float)z, xSize, ySize, zSize, s, hs, s); + pnr = perlinNoise1.getRegion(pnr, (float)x, (float)y, (float)z, xSize, ySize, zSize, s / 80.0f, hs / 160.0f, s / 80.0f); + ar = lperlinNoise1.getRegion(ar, (float)x, (float)y, (float)z, xSize, ySize, zSize, s, hs, s); + br = lperlinNoise2.getRegion(br, (float)x, (float)y, (float)z, xSize, ySize, zSize, s, hs, s); - int p = 0; - int pp = 0; + int p = 0; + int pp = 0; - int wScale = 16 / xSize; - for (int xx = 0; xx < xSize; xx++) { - int xp = xx * wScale + wScale / 2; + int wScale = 16 / xSize; + for (int xx = 0; xx < xSize; xx++) { + int xp = xx * wScale + wScale / 2; - for (int zz = 0; zz < zSize; zz++) { - int zp = zz * wScale + wScale / 2; - float temperature = temperatures[xp * 16 + zp]; - float downfall = downfalls[xp * 16 + zp] * temperature; - float dd = 1 - downfall; - dd = dd * dd; - dd = dd * dd; - dd = 1 - dd; + for (int zz = 0; zz < zSize; zz++) { + int zp = zz * wScale + wScale / 2; + float temperature = temperatures[xp * 16 + zp]; + float downfall = downfalls[xp * 16 + zp] * temperature; + float dd = 1 - downfall; + dd = dd * dd; + dd = dd * dd; + dd = 1 - dd; - float scale = ((sr[pp] + 256.0f) / 512); - scale *= dd; - if (scale > 1) scale = 1; + float scale = ((sr[pp] + 256.0f) / 512); + scale *= dd; + if (scale > 1) scale = 1; - float depth = (dr[pp] / 8000.0f); - if (depth < 0) depth = -depth * 0.3f; - depth = depth * 3.0f - 2.0f; + float depth = (dr[pp] / 8000.0f); + if (depth < 0) depth = -depth * 0.3f; + depth = depth * 3.0f - 2.0f; - if (depth < 0) { - depth = depth / 2; - if (depth < -1) depth = -1; - depth = depth / 1.4f; - depth /= 2; - scale = 0; - } else { - if (depth > 1) depth = 1; - depth = depth / 8; - } + if (depth < 0) { + depth = depth / 2; + if (depth < -1) depth = -1; + depth = depth / 1.4f; + depth /= 2; + scale = 0; + } else { + if (depth > 1) depth = 1; + depth = depth / 8; + } - if (scale < 0) scale = 0; - scale = (scale) + 0.5f; - depth = depth * ySize / 16; + if (scale < 0) scale = 0; + scale = (scale) + 0.5f; + depth = depth * ySize / 16; - float yCenter = ySize / 2.0f + depth * 4; + float yCenter = ySize / 2.0f + depth * 4; - pp++; + pp++; - for (int yy = 0; yy < ySize; yy++) { - float val = 0; + for (int yy = 0; yy < ySize; yy++) { + float val = 0; - float yOffs = (yy - (yCenter)) * 12 / scale; - if (yOffs < 0) yOffs *= 4; + float yOffs = (yy - (yCenter)) * 12 / scale; + if (yOffs < 0) yOffs *= 4; - float bb = ar[p] / 512; - float cc = br[p] / 512; + float bb = ar[p] / 512; + float cc = br[p] / 512; - float v = (pnr[p] / 10 + 1) / 2; - if (v < 0) val = bb; - else if (v > 1) val = cc; - else val = bb + (cc - bb) * v; - val -= yOffs; + float v = (pnr[p] / 10 + 1) / 2; + if (v < 0) val = bb; + else if (v > 1) val = cc; + else val = bb + (cc - bb) * v; + val -= yOffs; - if (yy > ySize - 4) { - float slide = (yy - (ySize - 4)) / (4 - 1.0f); - val = val * (1 - slide) + -10 * slide; - } + if (yy > ySize - 4) { + float slide = (yy - (ySize - 4)) / (4 - 1.0f); + val = val * (1 - slide) + -10 * slide; + } - buffer[p] = val; - p++; - } - } - } - return buffer; + buffer[p] = val; + p++; + } + } + } + return buffer; } /*private*/ void RandomLevelSource::calcWaterDepths(ChunkSource* parent, int xt, int zt) { - int xo = xt * 16; - int zo = zt * 16; - for (int x = 0; x < 16; x++) { - int y = level->getSeaLevel(); - for (int z = 0; z < 16; z++) { - int xp = xo + x + 7; - int zp = zo + z + 7; - int h = level->getHeightmap(xp, zp); - if (h <= 0) { - if (level->getHeightmap(xp - 1, zp) > 0 || level->getHeightmap(xp + 1, zp) > 0 || level->getHeightmap(xp, zp - 1) > 0 || level->getHeightmap(xp, zp + 1) > 0) { - bool hadWater = false; - if (hadWater || (level->getTile(xp - 1, y, zp) == Tile::calmWater->id && level->getData(xp - 1, y, zp) < 7)) hadWater = true; - if (hadWater || (level->getTile(xp + 1, y, zp) == Tile::calmWater->id && level->getData(xp + 1, y, zp) < 7)) hadWater = true; - if (hadWater || (level->getTile(xp, y, zp - 1) == Tile::calmWater->id && level->getData(xp, y, zp - 1) < 7)) hadWater = true; - if (hadWater || (level->getTile(xp, y, zp + 1) == Tile::calmWater->id && level->getData(xp, y, zp + 1) < 7)) hadWater = true; - if (hadWater) { - for (int x2 = -5; x2 <= 5; x2++) { - for (int z2 = -5; z2 <= 5; z2++) { - int d = (x2 > 0 ? x2 : -x2) + (z2 > 0 ? z2 : -z2); + int xo = xt * 16; + int zo = zt * 16; + for (int x = 0; x < 16; x++) { + int y = level->getSeaLevel(); + for (int z = 0; z < 16; z++) { + int xp = xo + x + 7; + int zp = zo + z + 7; + int h = level->getHeightmap(xp, zp); + if (h <= 0) { + if (level->getHeightmap(xp - 1, zp) > 0 || level->getHeightmap(xp + 1, zp) > 0 || level->getHeightmap(xp, zp - 1) > 0 || level->getHeightmap(xp, zp + 1) > 0) { + bool hadWater = false; + if (hadWater || (level->getTile(xp - 1, y, zp) == Tile::calmWater->id && level->getData(xp - 1, y, zp) < 7)) hadWater = true; + if (hadWater || (level->getTile(xp + 1, y, zp) == Tile::calmWater->id && level->getData(xp + 1, y, zp) < 7)) hadWater = true; + if (hadWater || (level->getTile(xp, y, zp - 1) == Tile::calmWater->id && level->getData(xp, y, zp - 1) < 7)) hadWater = true; + if (hadWater || (level->getTile(xp, y, zp + 1) == Tile::calmWater->id && level->getData(xp, y, zp + 1) < 7)) hadWater = true; + if (hadWater) { + for (int x2 = -5; x2 <= 5; x2++) { + for (int z2 = -5; z2 <= 5; z2++) { + int d = (x2 > 0 ? x2 : -x2) + (z2 > 0 ? z2 : -z2); - if (d <= 5) { - d = 6 - d; - if (level->getTile(xp + x2, y, zp + z2) == Tile::calmWater->id) { - int od = level->getData(xp + x2, y, zp + z2); - if (od < 7 && od < d) { - level->setData(xp + x2, y, zp + z2, d); - } - } - } - } - } - if (hadWater) { - level->setTileAndDataNoUpdate(xp, y, zp, Tile::calmWater->id, 7); - for (int y2 = 0; y2 < y; y2++) { - level->setTileAndDataNoUpdate(xp, y2, zp, Tile::calmWater->id, 8); - } - } - } - } - } - } - } + if (d <= 5) { + d = 6 - d; + if (level->getTile(xp + x2, y, zp + z2) == Tile::calmWater->id) { + int od = level->getData(xp + x2, y, zp + z2); + if (od < 7 && od < d) { + level->setData(xp + x2, y, zp + z2, d); + } + } + } + } + } + if (hadWater) { + level->setTileAndDataNoUpdate(xp, y, zp, Tile::calmWater->id, 7); + for (int y2 = 0; y2 < y; y2++) { + level->setTileAndDataNoUpdate(xp, y2, zp, Tile::calmWater->id, 8); + } + } + } + } + } + } + } } bool RandomLevelSource::hasChunk(int x, int y) { - //return x >= 0 && x < 16 && y >= 0 && y < 16; + //return x >= 0 && x < 16 && y >= 0 && y < 16; return true; } @@ -669,18 +723,18 @@ std::string RandomLevelSource::gatherStats() { //} Biome::MobList RandomLevelSource::getMobsAt(const MobCategory& mobCategory, int x, int y, int z) { - BiomeSource* biomeSource = level->getBiomeSource(); - if (biomeSource == NULL) { - return Biome::MobList(); - } -// static Stopwatch sw; sw.start(); - Biome* biome = biomeSource->getBiome(x, z); -// sw.stop(); -// sw.printEvery(10, "getBiome::"); - if (biome == NULL) { - return Biome::MobList(); - } - return biome->getMobs(mobCategory); + BiomeSource* biomeSource = level->getBiomeSource(); + if (biomeSource == NULL) { + return Biome::MobList(); + } + // static Stopwatch sw; sw.start(); + Biome* biome = biomeSource->getBiome(x, z); + // sw.stop(); + // sw.printEvery(10, "getBiome::"); + if (biome == NULL) { + return Biome::MobList(); + } + return biome->getMobs(mobCategory); } diff --git a/src/world/level/levelgen/RandomLevelSource.h b/src/world/level/levelgen/RandomLevelSource.h index 7082990..e8b88e4 100755 --- a/src/world/level/levelgen/RandomLevelSource.h +++ b/src/world/level/levelgen/RandomLevelSource.h @@ -25,6 +25,7 @@ class LevelChunk; #include "../chunk/ChunkSource.h" #include "LargeCaveFeature.h" +#include "CanyonFeature.h" #include "synth/PerlinNoise.h" #include "../../../SharedConstants.h" @@ -63,6 +64,7 @@ private: public: //Biome** biomes; LargeCaveFeature caveFeature; + CanyonFeature canyonFeature; int waterDepths[16+16][16+16]; private: ChunkMap chunkMap; @@ -92,6 +94,7 @@ private: float* fi; float* fis; ///*private*/ float[] temperatures; + float* temperatures; // normally unused like above, but restored this maybe might come handy - shredder }; class PerformanceTestChunkSource : public ChunkSource diff --git a/src/world/level/levelgen/feature/BasicTree.h b/src/world/level/levelgen/feature/BasicTree.h new file mode 100644 index 0000000..16c15ca --- /dev/null +++ b/src/world/level/levelgen/feature/BasicTree.h @@ -0,0 +1,448 @@ +#ifndef NET_MINECRAFT_WORLD_LEVEL_LEVELGEN_FEATURE__BasicTree_H__ +#define NET_MINECRAFT_WORLD_LEVEL_LEVELGEN_FEATURE__BasicTree_H__ + +//package net.minecraft.world.level.levelgen.feature; + +#include "Feature.h" + +#include "../../../../util/Random.h" +#include "../../Level.h" + +#include "../../tile/TreeTile.h" + +class Level; + +class BasicTree : public Feature +{ + typedef Feature super; +private: + + + + unsigned char axisConversionArray[6]; + Random *rnd; + Level *thisLevel; + int origin[3]; + int height; + int trunkHeight; + float trunkHeightScale; + float branchDensity; + float branchSlope; + float widthScale; + float foliageDensity; + int trunkWidth; + int heightVariance; + int foliageHeight; + int **foliageCoords; + int foliageCoordsLength; + void prepare(){ + trunkHeight = (int) (height * trunkHeightScale); + if (trunkHeight >= height) trunkHeight = height - 1; + int clustersPerY = (int) (1.382f + pow(foliageDensity * height / 13.0, 2)); + if (clustersPerY < 1) clustersPerY = 1; + int **tempFoliageCoords = new int *[clustersPerY * height]; + for( int i = 0; i < clustersPerY * height; i++ ) + { + tempFoliageCoords[i] = new int[4]; + } + int y = origin[1] + height - foliageHeight; + int clusterCount = 1; + int trunkTop = origin[1] + trunkHeight; + int relativeY = y - origin[1]; + + tempFoliageCoords[0][0] = origin[0]; + tempFoliageCoords[0][1] = y; + tempFoliageCoords[0][2] = origin[2]; + tempFoliageCoords[0][3] = trunkTop; + y--; + + while (relativeY >= 0) + { + int num = 0; + + float shapefac = treeShape(relativeY); + if (shapefac < 0) + { + y--; + relativeY--; + continue; + } + + float originOffset = 0.5f; + while (num < clustersPerY) + { + float radius = widthScale * (shapefac * (rnd->nextFloat() + 0.328f)); + float angle = rnd->nextFloat() * 2.0f * 3.14159f; + int x = Mth::floor(radius * sin(angle) + origin[0] + originOffset); + int z = Mth::floor(radius * cos(angle) + origin[2] + originOffset); + int checkStart[] = { x, y, z }; + int checkEnd[] = { x, y + foliageHeight, z }; + if (checkLine(checkStart, checkEnd) == -1) { + int checkBranchBase[] = { origin[0], origin[1], origin[2] }; + float distance = sqrt(pow(abs(origin[0] - checkStart[0]), 2.0f) + pow(abs(origin[2] - checkStart[2]), 2.0f)); + float branchHeight = distance * branchSlope; + if ((checkStart[1] - branchHeight) > trunkTop) + { + checkBranchBase[1] = trunkTop; + } + else + { + checkBranchBase[1] = (int) (checkStart[1] - branchHeight); + } + if (checkLine(checkBranchBase, checkStart) == -1) + { + tempFoliageCoords[clusterCount][0] = x; + tempFoliageCoords[clusterCount][1] = y; + tempFoliageCoords[clusterCount][2] = z; + tempFoliageCoords[clusterCount][3] = checkBranchBase[1]; + clusterCount++; + } + } + num++; + } + y--; + relativeY--; + } + + foliageCoordsLength = clusterCount; + foliageCoords = tempFoliageCoords; + + for( int i = clusterCount; i < clustersPerY * height; i++ ) + { + delete [] tempFoliageCoords[i]; + tempFoliageCoords[i] = NULL; + } + + + } + + void crossection(int x, int y, int z, float radius, unsigned char direction, int material) + { + + int rad = (int) (radius + 0.618); + unsigned char secidx1 = axisConversionArray[direction]; + unsigned char secidx2 = axisConversionArray[direction + 3]; + int center[] = { x, y, z }; + int position[] = { 0, 0, 0 }; + int offset1 = -rad; + int offset2 = -rad; + int thismat; + position[direction] = center[direction]; + while (offset1 <= rad) + { + position[secidx1] = center[secidx1] + offset1; + offset2 = -rad; + while (offset2 <= rad) + { + float off1 = (float)offset1 + 0.5f; + float off2 = (float)offset2 + 0.5f; + float thisdistance = (off1 * off1) + (off2 * off2); + if (thisdistance > radius * radius) + { + offset2++; + continue; + } + position[secidx2] = center[secidx2] + offset2; + + thismat = thisLevel->getTile(position[0], position[1], position[2]); + + if (!((thismat == 0) || (thismat == Tile::leaves->id))) + { + offset2++; + continue; + } + + placeBlock(thisLevel, position[0], position[1], position[2], material, 0); + + offset2++; + } + offset1++; + } + + } + float treeShape(int y){ + if (y < (((float) height) * 0.3f)) return (float) -1.618f; + float radius = ((float) height) / ((float) 2.0f); + float adjacent = (((float) height) / ((float) 2.0f)) - y; + float distance; + if (adjacent == 0) distance = radius; + else if (abs(adjacent) >= radius) distance = (float) 0.0f; + else distance = (float) sqrt(pow(abs(radius), 2) - pow(abs(adjacent), 2)); + distance *= (float) 0.5f; + return distance; + } + float foliageShape(int y){ + if ((y < 0) || (y >= foliageHeight)) return (float) -1; + else if ((y == 0) || (y == (foliageHeight - 1))) return (float) 2; + else return (float) 3; + } + void foliageCluster(int x, int y, int z){ + + int topy = y + foliageHeight; + int cury = topy - 1; + float radius; + while (cury >= y) + { + radius = foliageShape(cury - y); + crossection(x, cury, z, radius, (unsigned char) 1, Tile::leaves->id); + cury--; + } + + } + void limb(int *start, int *end, int material) + { + int delta[] = { 0, 0, 0 }; + unsigned char idx = 0; + unsigned char primidx = 0; + while (idx < 3) + { + delta[idx] = end[idx] - start[idx]; + if (abs(delta[idx]) > abs(delta[primidx])) + { + primidx = idx; + } + idx++; + } + if (delta[primidx] == 0) return; + unsigned char secidx1 = axisConversionArray[primidx]; + unsigned char secidx2 = axisConversionArray[primidx + 3]; + char primsign; + if (delta[primidx] > 0) primsign = 1; + else primsign = -1; + float secfac1 = ((float) delta[secidx1]) / ((float) delta[primidx]); + float secfac2 = ((float) delta[secidx2]) / ((float) delta[primidx]); + int coordinate[] = { 0, 0, 0 }; + int primoffset = 0; + int endoffset = delta[primidx] + primsign; + while (primoffset != endoffset) + { + coordinate[primidx] = Mth::floor(start[primidx] + primoffset + 0.5); + coordinate[secidx1] = Mth::floor(start[secidx1] + (primoffset * secfac1) + 0.5); + coordinate[secidx2] = Mth::floor(start[secidx2] + (primoffset * secfac2) + 0.5); + + int dir = 0; + int xdiff = abs(coordinate[0] - start[0]); + int zdiff = abs(coordinate[2] - start[2]); + int maxdiff = (std::max)(xdiff, zdiff); + + if (maxdiff > 0) + { + if (xdiff == maxdiff) + { + dir = 0; + } + else if (zdiff == maxdiff) + { + dir = 0; + } + } + placeBlock(thisLevel, coordinate[0], coordinate[1], coordinate[2], material, dir); + primoffset += primsign; + } + } + void makeFoliage(){ + int idx = 0; + int finish = foliageCoordsLength; + while (idx < finish) + { + int x = foliageCoords[idx][0]; + int y = foliageCoords[idx][1]; + int z = foliageCoords[idx][2]; + foliageCluster(x, y, z); + idx++; + } + } + bool trimBranches(int localY){ + if (localY < (height * 0.2)) return false; + else return true; + } + void makeTrunk(){ + int x = origin[0]; + int startY = origin[1]; + int topY = origin[1] + trunkHeight; + int z = origin[2]; + int startCoord[] = { x, startY, z }; + int endCoord[] = { x, topY, z }; + limb(startCoord, endCoord, Tile::treeTrunk->id); + if (trunkWidth == 2) + { + startCoord[0] += 1; + endCoord[0] += 1; + limb(startCoord, endCoord, Tile::treeTrunk->id); + startCoord[2] += 1; + endCoord[2] += 1; + limb(startCoord, endCoord, Tile::treeTrunk->id); + startCoord[0] += -1; + endCoord[0] += -1; + limb(startCoord, endCoord, Tile::treeTrunk->id); + } + } + void makeBranches(){ + int idx = 0; + int finish = foliageCoordsLength; + int baseCoord[] = { origin[0], origin[1], origin[2] }; + while (idx < finish) + { + int *coordValues = foliageCoords[idx]; + int endCoord[] = { coordValues[0], coordValues[1], coordValues[2] }; + baseCoord[1] = coordValues[3]; + int localY = baseCoord[1] - origin[1]; + if (trimBranches(localY)) + { + limb(baseCoord, endCoord, Tile::treeTrunk->id); + } + idx++; + } + } + int checkLine(int *start, int *end){ + + int delta[] = { 0, 0, 0 }; + unsigned char idx = 0; + unsigned char primidx = 0; + while (idx < 3) + { + delta[idx] = end[idx] - start[idx]; + if (abs(delta[idx]) > abs(delta[primidx])) + { + primidx = idx; + } + idx++; + } + if (delta[primidx] == 0) return -1; + unsigned char secidx1 = axisConversionArray[primidx]; + unsigned char secidx2 = axisConversionArray[primidx + 3]; + char primsign; + if (delta[primidx] > 0) primsign = 1; + else primsign = -1; + float secfac1 = ((float) delta[secidx1]) / ((float) delta[primidx]); + float secfac2 = ((float) delta[secidx2]) / ((float) delta[primidx]); + int coordinate[] = { 0, 0, 0 }; + int primoffset = 0; + int endoffset = delta[primidx] + primsign; + int thismat; + while (primoffset != endoffset) + { + coordinate[primidx] = start[primidx] + primoffset; + coordinate[secidx1] = Mth::floor(start[secidx1] + (primoffset * secfac1)); + coordinate[secidx2] = Mth::floor(start[secidx2] + (primoffset * secfac2)); + thismat = thisLevel->getTile(coordinate[0], coordinate[1], coordinate[2]); + if (!((thismat == 0) || (thismat == Tile::leaves->id))) + { + + break; + } + primoffset += primsign; + } + + if (primoffset == endoffset) + { + return -1; + } + + else + { + return abs(primoffset); + } + } + bool checkLocation(){ + + int startPosition[] = { origin[0], origin[1], origin[2] }; + int endPosition[] = { origin[0], origin[1] + height - 1, origin[2] }; + + + int baseMaterial = thisLevel->getTile(origin[0], origin[1] - 1, origin[2]); + if (!((baseMaterial == 2) || (baseMaterial == 3))) + { + return false; + } + int allowedHeight = checkLine(startPosition, endPosition); + if (allowedHeight == -1) + { + return true; + } + + else if (allowedHeight < 6) + { + return false; + } + else + { + height = allowedHeight; + return true; + } + } + +public: + BasicTree(bool doUpdate){ + axisConversionArray[0] = 2; + axisConversionArray[1] = 0; + axisConversionArray[2] = 0; + axisConversionArray[3] = 1; + axisConversionArray[4] = 2; + axisConversionArray[5] = 1; + rnd = new Random(); + origin[0] = 0; + origin[1] = 0; + origin[2] = 0; + height = 0; + trunkHeight = 0; + trunkHeightScale = 0.618; + branchDensity = 1.0; + branchSlope = 0.381; + widthScale = 1.0; + foliageDensity = 1.0; + trunkWidth = 1; + heightVariance = 12; + foliageHeight = 4; + foliageCoords = NULL; + foliageCoordsLength = 0; + } + virtual ~BasicTree(){ + delete rnd; + + for( int i = 0; i < foliageCoordsLength; i++ ) + { + delete [] foliageCoords[i]; + } + delete [] foliageCoords; + } + + virtual void init(float heightInit, float widthInit, float foliageDensityInit){ + + heightVariance = (int) (heightInit * 12); + if (heightInit > 0.5) foliageHeight = 5; + widthScale = widthInit; + foliageDensity = foliageDensityInit; + } + virtual bool place(Level *level, Random *random, int x, int y, int z){ + + thisLevel = level; + int seed = random->nextLong(); + rnd->setSeed(seed); + origin[0] = x; + origin[1] = y; + origin[2] = z; + if (height == 0) + { + height = 5 + rnd->nextInt(heightVariance); + } + if (!(checkLocation())) + { + + return false; + } + + + + prepare(); + + makeFoliage(); + + makeTrunk(); + + makeBranches(); + + return true; + } +}; +#endif /*NET_MINECRAFT_WORLD_LEVEL_LEVELGEN_FEATURE__BasicTree_H__*/ \ No newline at end of file diff --git a/src/world/level/levelgen/feature/FeatureInclude.h b/src/world/level/levelgen/feature/FeatureInclude.h index 940db75..81aa39a 100755 --- a/src/world/level/levelgen/feature/FeatureInclude.h +++ b/src/world/level/levelgen/feature/FeatureInclude.h @@ -10,5 +10,6 @@ #include "OreFeature.h" #include "ReedsFeature.h" #include "SpringFeature.h" +#include "TallgrassFeature.h" #endif /*FEATURE_INCLUDE__H__*/ diff --git a/src/world/level/storage/ExternalFileLevelStorage.cpp b/src/world/level/storage/ExternalFileLevelStorage.cpp index 2291302..93ee9f1 100755 --- a/src/world/level/storage/ExternalFileLevelStorage.cpp +++ b/src/world/level/storage/ExternalFileLevelStorage.cpp @@ -1,3 +1,6 @@ +#include +#include +#include #if !defined(DEMO_MODE) && !defined(APPLE_DEMO_PROMOTION) #include "LevelData.h" @@ -7,6 +10,7 @@ #include "../chunk/LevelChunk.h" #include "../Level.h" #include "../LevelConstants.h" +#include "platform/log.h" #include "../tile/TreeTile.h" #include "../../entity/EntityFactory.h" #include "../../../nbt/NbtIo.h" @@ -87,6 +91,9 @@ ExternalFileLevelStorage::ExternalFileLevelStorage(const std::string& levelId, c { createFolderIfNotExists(levelPath.c_str()); + std::string playerFolder = levelPath + "/players"; + createFolderIfNotExists(playerFolder.c_str()); + std::string datFileName = levelPath + "/" + fnLevelDat; std::string levelFileName = levelPath + "/" + fnPlayerDat; loadedLevelData = new LevelData(); @@ -112,6 +119,7 @@ void ExternalFileLevelStorage::saveLevelData(LevelData& levelData, std::vector

* players ) { + // @todo: completely rewrite std::string directory = levelPath + "/"; std::string tmpFile = directory + fnLevelDatNew; std::string datFile = directory + fnLevelDat; @@ -140,6 +148,67 @@ void ExternalFileLevelStorage::saveLevelData( const std::string& levelPath, Leve // Remove the temporary save, if the rename didn't do it remove(tmpFile.c_str()); + + // Save players + // fuck mojang for that + if (!players || players->empty()) { + return; + } + + for (auto& player : *players) { + if (player != NULL) { + savePlayer(*player, directory); + } + } +} + +void ExternalFileLevelStorage::savePlayer(Player& player, const std::string& worldDir) { + std::string playerPath = worldDir + "/players/" + player.name + ".dat"; + + LOGI("Saving player %s to %s...\n", player.name.c_str(), playerPath.c_str()); + + RakNet::BitStream data; + RakDataOutput buf(data); + CompoundTag playerTag; + player.saveWithoutId(&playerTag); + + NbtIo::write(&playerTag, &buf); + + std::ofstream file(playerPath, std::ios::out | std::ios::binary); + file.write((const char*)data.GetData(), (size_t)data.GetNumberOfBytesUsed()); +} + +bool ExternalFileLevelStorage::loadPlayer(Player& player, const std::string& worldDir) { + std::string playerPath = worldDir + "/players/" + player.name + ".dat"; + + LOGI("Loading player %s from %s...\n", player.name.c_str(), playerPath.c_str()); + + std::ifstream file(playerPath, std::ios::in | std::ios::binary); + if (!file.is_open()) { + return false; + } + + std::vector data((std::istreambuf_iterator(file)), std::istreambuf_iterator()); + + RakNet::BitStream bitStream(data.data(), data.size(), false); + RakDataInput stream(bitStream); + + CompoundTag* tag = NbtIo::read(&stream); + if (tag) { + player.load(tag); + tag->deleteChildren(); + delete tag; + } + + return true; +} + +void ExternalFileLevelStorage::savePlayer(Player& player) { + ExternalFileLevelStorage::savePlayer(player, levelPath); +} + +bool ExternalFileLevelStorage::loadPlayer(Player& player) { + return ExternalFileLevelStorage::loadPlayer(player, levelPath); } LevelData* ExternalFileLevelStorage::prepareLevel(Level* _level) @@ -274,8 +343,8 @@ bool ExternalFileLevelStorage::readPlayerData(const std::string& filename, Level Vec3& pos = dest.playerData.pos; if (pos.x < 0.5f) pos.x = 0.5f; if (pos.z < 0.5f) pos.z = 0.5f; - if (pos.x > (LEVEL_WIDTH - 0.5f)) pos.x = LEVEL_WIDTH - 0.5f; - if (pos.z > (LEVEL_DEPTH - 0.5f)) pos.z = LEVEL_DEPTH - 0.5f; + if (pos.x > (LevelConstants::LEVEL_WIDTH - 0.5f)) pos.x = LevelConstants::LEVEL_WIDTH - 0.5f; + if (pos.z > (LevelConstants::LEVEL_DEPTH - 0.5f)) pos.z = LevelConstants::LEVEL_DEPTH - 0.5f; if (pos.y < 0) pos.y = 64; dest.playerDataVersion = version; @@ -289,17 +358,18 @@ bool ExternalFileLevelStorage::readPlayerData(const std::string& filename, Level void ExternalFileLevelStorage::tick() { tickCount++; - if ((tickCount % 50) == 0 && level) - { + if ((tickCount % 1000) == 0 && level) { + LOGI("Saving level...\n"); + // look for chunks that needs to be saved - for (int z = 0; z < CHUNK_CACHE_WIDTH; z++) + for (int z = 0; z < LevelConstants::CHUNK_CACHE_WIDTH; z++) { - for (int x = 0; x < CHUNK_CACHE_WIDTH; x++) + for (int x = 0; x < LevelConstants::CHUNK_CACHE_WIDTH; x++) { LevelChunk* chunk = level->getChunk(x, z); if (chunk && chunk->unsaved) { - int pos = x + z * CHUNK_CACHE_WIDTH; + int pos = x + z * LevelConstants::CHUNK_CACHE_WIDTH; UnsavedChunkList::iterator prev = unsavedChunkList.begin(); for ( ; prev != unsavedChunkList.end(); ++prev) { @@ -345,13 +415,13 @@ void ExternalFileLevelStorage::save(Level* level, LevelChunk* levelChunk) // Write chunk RakNet::BitStream chunkData; - chunkData.Write((const char*)levelChunk->getBlockData(), CHUNK_BLOCK_COUNT); - chunkData.Write((const char*)levelChunk->data.data, CHUNK_BLOCK_COUNT / 2); + chunkData.Write((const char*)levelChunk->getBlockData(), LevelConstants::CHUNK_BLOCK_COUNT); + chunkData.Write((const char*)levelChunk->data.data, LevelConstants::CHUNK_BLOCK_COUNT / 2); - chunkData.Write((const char*)levelChunk->skyLight.data, CHUNK_BLOCK_COUNT / 2); - chunkData.Write((const char*)levelChunk->blockLight.data, CHUNK_BLOCK_COUNT / 2); + chunkData.Write((const char*)levelChunk->skyLight.data, LevelConstants::CHUNK_BLOCK_COUNT / 2); + chunkData.Write((const char*)levelChunk->blockLight.data, LevelConstants::CHUNK_BLOCK_COUNT / 2); - chunkData.Write((const char*)levelChunk->updateMap, CHUNK_COLUMNS); + chunkData.Write((const char*)levelChunk->updateMap, LevelConstants::CHUNK_COLUMNS); regionFile->writeChunk(levelChunk->x, levelChunk->z, chunkData); @@ -383,16 +453,16 @@ LevelChunk* ExternalFileLevelStorage::load(Level* level, int x, int z) chunkData->ResetReadPointer(); - unsigned char* blockIds = new unsigned char[CHUNK_BLOCK_COUNT]; - chunkData->Read((char*)blockIds, CHUNK_BLOCK_COUNT); + unsigned char* blockIds = new unsigned char[LevelConstants::CHUNK_BLOCK_COUNT]; + chunkData->Read((char*)blockIds, LevelConstants::CHUNK_BLOCK_COUNT); LevelChunk* levelChunk = new LevelChunk(level, blockIds, x, z); - chunkData->Read((char*)levelChunk->data.data, CHUNK_BLOCK_COUNT / 2); + chunkData->Read((char*)levelChunk->data.data, LevelConstants::CHUNK_BLOCK_COUNT / 2); if (loadedStorageVersion >= ChunkVersion_Light) { - chunkData->Read((char*)levelChunk->skyLight.data, CHUNK_BLOCK_COUNT / 2); - chunkData->Read((char*)levelChunk->blockLight.data, CHUNK_BLOCK_COUNT / 2); + chunkData->Read((char*)levelChunk->skyLight.data, LevelConstants::CHUNK_BLOCK_COUNT / 2); + chunkData->Read((char*)levelChunk->blockLight.data, LevelConstants::CHUNK_BLOCK_COUNT / 2); } - chunkData->Read((char*)levelChunk->updateMap, CHUNK_COLUMNS); + chunkData->Read((char*)levelChunk->updateMap, LevelConstants::CHUNK_COLUMNS); // This will be difficult to maintain.. Storage version could be per chunk // too (but probably better to just read all -> write all, so that all // chunks got same version anyway) @@ -415,7 +485,7 @@ LevelChunk* ExternalFileLevelStorage::load(Level* level, int x, int z) //bool dbg = (x == 7 && z == 9); //int t = 0; - //for (int i = 0; i < CHUNK_COLUMNS; ++i) { + //for (int i = 0; i < LevelConstants::CHUNK_COLUMNS; ++i) { // char bits = levelChunk->updateMap[i]; // t += (bits != 0); // int xx = x * 16 + i%16; diff --git a/src/world/level/storage/ExternalFileLevelStorage.h b/src/world/level/storage/ExternalFileLevelStorage.h index b7dd960..9aad448 100755 --- a/src/world/level/storage/ExternalFileLevelStorage.h +++ b/src/world/level/storage/ExternalFileLevelStorage.h @@ -67,6 +67,19 @@ public: void saveGame(Level* level); void saveAll(Level* level, std::vector& levelChunks); + /** + * @brief Save player to /player/.dat file + */ + static void savePlayer(Player& player, const std::string& worldDir); + + /** + * @brief Load player from /player/.dat file + */ + static bool loadPlayer(Player& player, const std::string& worldDir); + + virtual void savePlayer(Player& player); + virtual bool loadPlayer(Player& player); + virtual void tick(); virtual void flush() {} private: diff --git a/src/world/level/storage/LevelData.cpp b/src/world/level/storage/LevelData.cpp index c40e5d3..4cafdf9 100755 --- a/src/world/level/storage/LevelData.cpp +++ b/src/world/level/storage/LevelData.cpp @@ -12,8 +12,8 @@ LevelData::LevelData() dimension(Dimension::NORMAL), playerDataVersion(-1), storageVersion(0), - gameType(GameType::Default), - loadedPlayerTag(NULL) + gameType(GameType::Default), spawnMobs(false), + allowCheats(false), loadedPlayerTag(NULL) { //LOGI("ctor 1: %p\n", this); spawnMobs = (gameType == GameType::Survival); @@ -21,8 +21,7 @@ LevelData::LevelData() LevelData::LevelData( const LevelSettings& settings, const std::string& levelName, int generatorVersion /*= -1*/ ) : seed(settings.getSeed()), - gameType(settings.getGameType()), - levelName(levelName), + gameType(settings.getGameType()), allowCheats(settings.getAllowCheats()), levelName(levelName), xSpawn(128), ySpawn(64), zSpawn(128), @@ -62,6 +61,7 @@ LevelData::LevelData( const LevelData& rhs ) playerDataVersion(rhs.playerDataVersion), generatorVersion(rhs.generatorVersion), spawnMobs(rhs.spawnMobs), + allowCheats(rhs.allowCheats), loadedPlayerTag(NULL), playerData(rhs.playerData) { @@ -84,6 +84,7 @@ LevelData& LevelData::operator=( const LevelData& rhs ) time = rhs.time; dimension = rhs.dimension; spawnMobs = rhs.spawnMobs; + allowCheats = rhs.allowCheats; playerData = rhs.playerData; playerDataVersion = rhs.playerDataVersion; generatorVersion = rhs.generatorVersion; @@ -161,6 +162,7 @@ void LevelData::setTagData( CompoundTag* tag, CompoundTag* playerTag ) if (!tag) return; tag->putLong("RandomSeed", seed); tag->putInt("GameType", gameType); + tag->putBoolean("AllowCommands", allowCheats); tag->putInt("SpawnX", xSpawn); tag->putInt("SpawnY", ySpawn); tag->putInt("SpawnZ", zSpawn); @@ -181,6 +183,7 @@ void LevelData::getTagData( const CompoundTag* tag ) if (!tag) return; seed = (long)tag->getLong("RandomSeed"); gameType = tag->getInt("GameType"); + allowCheats = tag->getBoolean("AllowCommands"); xSpawn = tag->getInt("SpawnX"); ySpawn = tag->getInt("SpawnY"); zSpawn = tag->getInt("SpawnZ"); @@ -362,3 +365,13 @@ void LevelData::setSpawnMobs( bool doSpawn ) { spawnMobs = doSpawn; } + +bool LevelData::getAllowCheats() const +{ + return allowCheats; +} + +void LevelData::setAllowCheats( bool allow ) +{ + allowCheats = allow; +} diff --git a/src/world/level/storage/LevelData.h b/src/world/level/storage/LevelData.h index 3bf69db..c3f0a79 100755 --- a/src/world/level/storage/LevelData.h +++ b/src/world/level/storage/LevelData.h @@ -72,6 +72,9 @@ public: bool getSpawnMobs() const; void setSpawnMobs(bool doSpawn); + bool getAllowCheats() const; + void setAllowCheats(bool allow); + public: PlayerData playerData; int playerDataVersion; @@ -89,6 +92,7 @@ private: int gameType; int storageVersion; bool spawnMobs; + bool allowCheats; //@note: This version is never written or loaded to disk. The only purpose // is to use it in the level generator on server and clients. int generatorVersion; diff --git a/src/world/level/storage/LevelStorage.h b/src/world/level/storage/LevelStorage.h index 84c0f62..d3098d2 100755 --- a/src/world/level/storage/LevelStorage.h +++ b/src/world/level/storage/LevelStorage.h @@ -32,6 +32,9 @@ public: virtual void saveGame(Level* level) {} virtual void loadEntities(Level* level, LevelChunk* levelChunk) {} + virtual void savePlayer(Player& player) = 0; + virtual bool loadPlayer(Player& player) = 0; + //void checkSession() throws LevelConflictException; //PlayerIO getPlayerIO(); }; diff --git a/src/world/level/tile/DoorTile.cpp b/src/world/level/tile/DoorTile.cpp index 6b6e962..203e424 100755 --- a/src/world/level/tile/DoorTile.cpp +++ b/src/world/level/tile/DoorTile.cpp @@ -3,6 +3,7 @@ #include "../Level.h" #include "../../item/Item.h" #include "../../entity/player/Player.h" +#include "world/level/LevelSettings.h" DoorTile::DoorTile(int id, const Material* material) : super(id, material) @@ -150,7 +151,7 @@ void DoorTile::setOpen(Level* level, int x, int y, int z, bool shouldOpen) { void DoorTile::neighborChanged(Level* level, int x, int y, int z, int type) { int data = level->getData(x, y, z); - if ((data & UPPER_BIT) == 0) { + if ((data & C_IS_UPPER_MASK) == 0) { bool spawn = false; if (level->getTile(x, y + 1, z) != id) { level->setTile(x, y, z, 0); @@ -164,8 +165,9 @@ void DoorTile::neighborChanged(Level* level, int x, int y, int z, int type) { } } if (spawn) { - if (!level->isClientSide) { - spawnResources(level, x, y, z, data, 0); + if (!level->isClientSide && level->getLevelData()->getGameType() != GameType::Creative) { + // use default chance (1.0) so the drop always occurs + spawnResources(level, x, y, z, data); } } else { bool signal = level->hasNeighborSignal(x, y, z) || level->hasNeighborSignal(x, y + 1, z); @@ -174,13 +176,12 @@ void DoorTile::neighborChanged(Level* level, int x, int y, int z, int type) { } } } else { + // upper half: removal should not drop a second door. the + // lower half neighbour handler takes care of spawning the item + // whenever the door is broken from either end. if (level->getTile(x, y - 1, z) != id) { level->setTile(x, y, z, 0); - if(material == Material::metal) { - popResource(level, x, y, z, ItemInstance(Item::door_iron)); - } else { - popResource(level, x, y, z, ItemInstance(Item::door_wood)); - } + // no resource spawn here } if (type > 0 && type != id) { neighborChanged(level, x, y - 1, z, type); @@ -189,7 +190,11 @@ void DoorTile::neighborChanged(Level* level, int x, int y, int z, int type) { } int DoorTile::getResource(int data, Random* random) { - if ((data & 8) != 0) return 0; + // only the lower half should return a resource ID; the upper half + // itself never drops anything and playerDestroy suppresses spawning + // from the top. This prevents duplicate drops if the bottom half is + // mined. + if ((data & C_IS_UPPER_MASK) != 0) return 0; if (material == Material::metal) return Item::door_iron->id; return Item::door_wood->id; } @@ -199,6 +204,14 @@ HitResult DoorTile::clip(Level* level, int xt, int yt, int zt, const Vec3& a, co return super::clip(level, xt, yt, zt, a, b); } +// override to prevent double-dropping when top half is directly mined +void DoorTile::playerDestroy(Level* level, Player* player, int x, int y, int z, int data) { + if ((data & C_IS_UPPER_MASK) == 0) { + // only let the lower half handle the actual spawning + super::playerDestroy(level, player, x, y, z, data); + } +} + int DoorTile::getDir(LevelSource* level, int x, int y, int z) { return getCompositeData(level, x, y, z) & C_DIR_MASK; } @@ -213,7 +226,7 @@ bool DoorTile::mayPlace(Level* level, int x, int y, int z, unsigned char face) { int DoorTile::getCompositeData( LevelSource* level, int x, int y, int z ) { int data = level->getData(x, y, z); - bool isUpper = (data & UPPER_BIT) != 0; + bool isUpper = (data & C_IS_UPPER_MASK) != 0; int lowerData; int upperData; if (isUpper) { diff --git a/src/world/level/tile/DoorTile.h b/src/world/level/tile/DoorTile.h index 98020e2..bd585e5 100755 --- a/src/world/level/tile/DoorTile.h +++ b/src/world/level/tile/DoorTile.h @@ -17,7 +17,6 @@ class DoorTile: public Tile { typedef Tile super; public: - static const int UPPER_BIT = 8; static const int C_DIR_MASK = 3; static const int C_OPEN_MASK = 4; static const int C_LOWER_DATA_MASK = 7; @@ -25,35 +24,38 @@ public: static const int C_RIGHT_HINGE_MASK = 16; DoorTile(int id, const Material* material); - int getTexture(LevelSource* level, int x, int y, int z, int face); + int getTexture(LevelSource* level, int x, int y, int z, int face) override; bool blocksLight(); - bool isSolidRender(); - bool isCubeShaped(); - int getRenderShape(); - int getRenderLayer(); + bool isSolidRender() override; + bool isCubeShaped() override; + int getRenderShape() override; + int getRenderLayer() override; - AABB getTileAABB(Level* level, int x, int y, int z); - AABB* getAABB(Level* level, int x, int y, int z); + AABB getTileAABB(Level* level, int x, int y, int z) override; + AABB* getAABB(Level* level, int x, int y, int z) override; - void updateShape(LevelSource* level, int x, int y, int z); + void updateShape(LevelSource* level, int x, int y, int z) override; void setShape(int compositeData); - void attack(Level* level, int x, int y, int z, Player* player); - bool use(Level* level, int x, int y, int z, Player* player); + void attack(Level* level, int x, int y, int z, Player* player) override; + bool use(Level* level, int x, int y, int z, Player* player) override; void setOpen(Level* level, int x, int y, int z, bool shouldOpen); static bool isOpen(LevelSource* level, int x, int y, int z); - void neighborChanged(Level* level, int x, int y, int z, int type); + void neighborChanged(Level* level, int x, int y, int z, int type) override; - int getResource(int data, Random* random); + int getResource(int data, Random* random) override; - HitResult clip(Level* level, int xt, int yt, int zt, const Vec3& a, const Vec3& b); + // override to avoid duplicate drops when upper half is mined directly + void playerDestroy(Level* level, Player* player, int x, int y, int z, int data) override; + + HitResult clip(Level* level, int xt, int yt, int zt, const Vec3& a, const Vec3& b) override; int getDir(LevelSource* level, int x, int y, int z); - bool mayPlace(Level* level, int x, int y, int z, unsigned char face); + bool mayPlace(Level* level, int x, int y, int z, unsigned char face) override; static int getCompositeData(LevelSource* level, int x, int y, int z); }; diff --git a/src/world/level/tile/FireTile.h b/src/world/level/tile/FireTile.h index fb815c4..577db4b 100755 --- a/src/world/level/tile/FireTile.h +++ b/src/world/level/tile/FireTile.h @@ -38,7 +38,7 @@ public: setFlammable(Tile::tnt->id, FLAME_MEDIUM, BURN_INSTANT); setFlammable(Tile::cloth->id, FLAME_EASY, BURN_EASY); - //setTicking(true); //@fire + setTicking(true); //@fire } AABB* getAABB(Level* level, int x, int y, int z) { @@ -70,9 +70,9 @@ public: } void tick(Level* level, int x, int y, int z, Random* random) { - return; //@fire + - bool infiniBurn = false;//level->getTile(x, y - 1, z) == Tile::hellRock->id; + bool infiniBurn = level->getTile(x, y - 1, z) == Tile::netherrack->id; int age = level->getData(x, y, z); if (age < 15) { @@ -131,6 +131,10 @@ public: return false; } + int getRenderLayer() { + return Tile::RENDERLAYER_ALPHATEST; + } + bool canBurn(LevelSource* level, int x, int y, int z) { return flameOdds[level->getTile(x, y, z)] > 0; } @@ -148,7 +152,6 @@ public: } void neighborChanged(Level* level, int x, int y, int z, int type) { - return; //@fire if (!level->isSolidBlockingTile(x, y - 1, z) && !isValidFireLocation(level, x, y, z)) { level->setTile(x, y, z, 0); return; @@ -156,7 +159,6 @@ public: } void onPlace(Level* level, int x, int y, int z) { - return; //@fire if (!level->isSolidBlockingTile(x, y - 1, z) && !isValidFireLocation(level, x, y, z)) { level->setTile(x, y, z, 0); return; @@ -169,7 +171,6 @@ public: } void ignite(Level* level, int x, int y, int z) { - return; //@fire bool lit = false; if (!lit) lit = tryIgnite(level, x, y + 1, z); @@ -184,11 +185,10 @@ public: } void animateTick(Level* level, int x, int y, int z, Random* random) { - return; //@fire - //if (random.nextInt(24) == 0) { - // level->playSound(x + 0.5f, y + 0.5f, z + 0.5f, "fire.fire", 1 + random.nextFloat(), random.nextFloat() * 0.7f + 0.3f); - //} + if (random->nextInt(24) == 0) { + level->playSound(x + 0.5f, y + 0.5f, z + 0.5f, "fire.fire", 1 + random->nextFloat(), random->nextFloat() * 0.7f + 0.3f); + } if (level->isSolidBlockingTile(x, y - 1, z) || Tile::fire->canBurn(level, x, y - 1, z)) { for (int i = 0; i < 3; i++) { @@ -248,7 +248,6 @@ private: } void checkBurn(Level* level, int x, int y, int z, int chance, Random* random) { - return; //@fire int odds = burnOdds[level->getTile(x, y, z)]; if (random->nextInt(chance) < odds) { @@ -265,7 +264,6 @@ private: } bool isValidFireLocation(Level* level, int x, int y, int z) { - return false; //@fire if (canBurn(level, x + 1, y, z)) return true; if (canBurn(level, x - 1, y, z)) return true; @@ -278,7 +276,6 @@ private: } int getFireOdds(Level* level, int x, int y, int z) { - return 0; //@fire int odds = 0; if (!level->isEmptyTile(x, y, z)) return 0; @@ -294,7 +291,6 @@ private: } bool tryIgnite(Level* level, int x, int y, int z) { - return false; //@fire int t = level->getTile(x, y, z); if (t == Tile::fire->id) return true; diff --git a/src/world/level/tile/GrassTile.cpp b/src/world/level/tile/GrassTile.cpp index 7a293ea..1828966 100755 --- a/src/world/level/tile/GrassTile.cpp +++ b/src/world/level/tile/GrassTile.cpp @@ -1,6 +1,11 @@ #include "GrassTile.h" #include "../material/Material.h" #include "../../entity/item/ItemEntity.h" +#include "../GrassColor.h" +#include "../Level.h" +#include "../LevelSource.h" +#include "../biome/BiomeSource.h" +#include "../../../client/Minecraft.h" GrassTile::GrassTile(int id) : super(id, Material::dirt) @@ -24,11 +29,18 @@ int GrassTile::getTexture( int face, int data ) { } int GrassTile::getColor( LevelSource* level, int x, int y, int z ) { - //level.getBiomeSource().getBiomeBlock(x, z, 1, 1); - //float temp = level.getBiomeSource().temperatures[0]; - //float rain = level.getBiomeSource().downfalls[0]; - return 0x339933;//GrassColor.get(temp, rain); + if(!GrassColor::useTint){ + return 0x339933; + } + + level->getBiomeSource()->getBiomeBlock(x, z, 1, 1); + float temp = level->getBiomeSource()->temperatures[0]; + float rain = level->getBiomeSource()->downfalls[0]; + +// return 0x339933;//GrassColor.get(temp, rain); // we need to hook this up with OPTION_FOLIAGE_TINT + + return GrassColor::get(temp, rain); } void GrassTile::tick( Level* level, int x, int y, int z, Random* random ) { diff --git a/src/world/level/tile/GrassTile.h b/src/world/level/tile/GrassTile.h index bc62825..c97db84 100755 --- a/src/world/level/tile/GrassTile.h +++ b/src/world/level/tile/GrassTile.h @@ -14,6 +14,7 @@ class GrassTile: public Tile { typedef Tile super; public: + static const int MIN_BRIGHTNESS = 4; GrassTile(int id); diff --git a/src/world/level/tile/LeafTile.h b/src/world/level/tile/LeafTile.h index e1102ca..6095d12 100755 --- a/src/world/level/tile/LeafTile.h +++ b/src/world/level/tile/LeafTile.h @@ -9,6 +9,8 @@ #include "../../item/Item.h" #include "../../item/ItemInstance.h" #include "../FoliageColor.h" +#include "../LevelSource.h" +#include "../biome/BiomeSource.h" class Entity; @@ -54,8 +56,17 @@ public: if (data == BIRCH_LEAF) { return FoliageColor::getBirchColor(); } + if (!FoliageColor::useTint){ + return FoliageColor::getDefaultColor(); + } - return FoliageColor::getDefaultColor(); + + // return FoliageColor::getDefaultColor(); we need to hook this up with OPTION_FOLIAGE_TINT + level->getBiomeSource()->getBiomeBlock(x, z, 1, 1); + float temperature = level->getBiomeSource()->temperatures[0]; + float rainfall = level->getBiomeSource()->downfalls[0]; + return FoliageColor::get(temperature, rainfall); + } void onRemove(Level* level, int x, int y, int z) { diff --git a/src/world/level/tile/Mushroom.cpp b/src/world/level/tile/Mushroom.cpp index 6de05ce..2992405 100755 --- a/src/world/level/tile/Mushroom.cpp +++ b/src/world/level/tile/Mushroom.cpp @@ -47,7 +47,7 @@ bool Mushroom::mayPlaceOn( int tile ) { } bool Mushroom::canSurvive( Level* level, int x, int y, int z ) { - if (y < 0 || y >= LEVEL_HEIGHT/*Level::maxBuildHeight*/) + if (y < 0 || y >= LevelConstants::LEVEL_HEIGHT/*Level::maxBuildHeight*/) return false; int below = level->getTile(x, y - 1, z); diff --git a/src/world/level/tile/NetherReactor.cpp b/src/world/level/tile/NetherReactor.cpp index 04404eb..00849b9 100755 --- a/src/world/level/tile/NetherReactor.cpp +++ b/src/world/level/tile/NetherReactor.cpp @@ -53,7 +53,7 @@ bool NetherReactor::canSpawnStartNetherReactor( Level* level, int x, int y, int if(!allPlayersCloseToReactor(level, x, y, z)) { player->displayClientMessage("All players need to be close to the reactor."); return false; - } else if(y > LEVEL_HEIGHT - 28) { + } else if(y > LevelConstants::LEVEL_HEIGHT - 28) { player->displayClientMessage("The nether reactor needs to be built lower down."); return false; } else if(y < 2) { diff --git a/src/world/level/tile/NetherReactorPattern.cpp b/src/world/level/tile/NetherReactorPattern.cpp index 8181e41..51958f4 100755 --- a/src/world/level/tile/NetherReactorPattern.cpp +++ b/src/world/level/tile/NetherReactorPattern.cpp @@ -6,23 +6,24 @@ NetherReactorPattern::NetherReactorPattern( ) { const int netherCoreId = Tile::netherReactor->id; const unsigned int types[3][3][3] = { - // Level 0 + // Changing all of these values to be unsigned is needed to get the nether reactor pattern to compile. In the past having them be normal ints was fine but the c++ convention has changed + // Level 0 { - {goldId, stoneId, goldId}, - {stoneId, stoneId, stoneId}, - {goldId, stoneId, goldId} + {static_cast(goldId), static_cast(stoneId), static_cast(goldId)}, + {static_cast(stoneId), static_cast(stoneId), static_cast(stoneId)}, + {static_cast(goldId), static_cast(stoneId), static_cast(goldId)} }, // Level 1 { - {stoneId, 0, stoneId}, - {0, netherCoreId, 0}, - {stoneId, 0, stoneId} + {static_cast(stoneId), 0, static_cast(stoneId)}, + {0, static_cast(netherCoreId), 0}, + {static_cast(stoneId), 0, static_cast(stoneId)} }, // Level 2 { - {0, stoneId, 0}, - {stoneId, stoneId, stoneId}, - {0, stoneId, 0} + {0, static_cast(stoneId), 0}, + {static_cast(stoneId), static_cast(stoneId), static_cast(stoneId)}, + {0, static_cast(stoneId), 0} } }; for(int setLevel = 0; setLevel <= 2; ++setLevel) { diff --git a/src/world/level/tile/Sapling.h b/src/world/level/tile/Sapling.h index d6fae0e..6f697f4 100755 --- a/src/world/level/tile/Sapling.h +++ b/src/world/level/tile/Sapling.h @@ -8,6 +8,7 @@ #include "../levelgen/feature/SpruceFeature.h" #include "../levelgen/feature/BirchFeature.h" #include "../levelgen/feature/TreeFeature.h" +#include "../levelgen/feature/BasicTree.h" class Sapling: public Bush { @@ -90,9 +91,9 @@ public: // f = new TreeFeature(true, 4 + random.nextInt(7), TreeTile::JUNGLE_TRUNK, LeafTile::JUNGLE_LEAF, false); // } } else { - //if (random->nextInt(10) == 0) { - // f = new BasicTree(true); - //} else + if (random->nextInt(10) == 0) { +// f = new BasicTree(true); // temporarily disabled + } else f = new TreeFeature(true); } diff --git a/src/world/level/tile/TallGrass.cpp b/src/world/level/tile/TallGrass.cpp index 7a0350c..497279e 100755 --- a/src/world/level/tile/TallGrass.cpp +++ b/src/world/level/tile/TallGrass.cpp @@ -1,8 +1,12 @@ #include "TallGrass.h" #include "../FoliageColor.h" +#include "../GrassColor.h" #include "../../entity/player/Player.h" #include "../../item/Item.h" #include "../../item/ShearsItem.h" +#include "../Level.h" +#include "../LevelSource.h" +#include "../biome/BiomeSource.h" TallGrass::TallGrass( int id, int tex ) : super(id, tex, Material::replaceable_plant) { float ss = 0.4f; @@ -17,21 +21,42 @@ int TallGrass::getTexture( int face, int data ) { } int TallGrass::getColor() { - /*double temp = 0.5; - double rain = 1.0; - return GrassColor.get(temp, rain);*/ + //double temp = 0.5; + //double rain = 1.0; + // converted to float for consistency - shredder + float temp = 0.5; + float rain = 1.0; + if (GrassColor::useTint){ + return GrassColor::get(temp, rain); + } return 0x339933; } int TallGrass::getColor( int auxData ) { - if(auxData == DEAD_SHRUB) return 0xffffffff; + if(auxData == DEAD_SHRUB); + if (!FoliageColor::useTint && auxData == DEAD_SHRUB){ + return 0xffffff; + } return FoliageColor::getDefaultColor(); } int TallGrass::getColor( LevelSource* level, int x, int y, int z ) { int d = level->getData(x, y, z); - if (d == DEAD_SHRUB) return 0xffffff; + if (d == DEAD_SHRUB); //return 0xffffff; // i removed this to make it accurate to beta 1.6.6 instead of early java release versions + level->getBiomeSource()->getBiomeBlock(x, z, 1, 1); + float temp = level->getBiomeSource()->temperatures[0]; // shredder added + float rain = level->getBiomeSource()->downfalls != nullptr ? level->getBiomeSource()->downfalls[0] : 0; // shredder added + if (!GrassColor::useTint && d == DEAD_SHRUB){ + return 0xffffff; + } + if (GrassColor::useTint){ + return GrassColor::get(temp, rain); + } + // @TODO port this function from beta 1.6.6 probably, for now im using biomesource to tint it directly above - shredder + //if (GrassColor::useTint){ + //return level->getBiome(x, z)->getGrassColor(); + //} return 0x339933;//level->getBiome(x, z)->getGrassColor(); } diff --git a/src/world/level/tile/Tile.cpp b/src/world/level/tile/Tile.cpp index a5acf7a..6736bc7 100755 --- a/src/world/level/tile/Tile.cpp +++ b/src/world/level/tile/Tile.cpp @@ -22,6 +22,7 @@ #include "../../item/StoneSlabTileItem.h" #include "../../item/SaplingTileItem.h" #include "../../item/ItemCategory.h" +#include "world/level/LevelConstants.h" const int Tile::RENDERLAYER_OPAQUE = 0; const int Tile::RENDERLAYER_ALPHATEST = 1; @@ -512,10 +513,15 @@ bool Tile::shouldRenderFace( LevelSource* level, int x, int y, int z, int face ) { if (face == 0 && y == -1) return false; // For fixed size worlds //@todo: external constants rather than magic numbers + // @fixme @ahtung temp fix + + auto xz = LevelConstants::CHUNK_CACHE_WIDTH == 16 ? 256 : + LevelConstants::CHUNK_CACHE_WIDTH * LevelConstants::CHUNK_CACHE_WIDTH / (LevelConstants::CHUNK_CACHE_WIDTH * LevelConstants::CHUNK_CACHE_WIDTH / 256 / 2); + if (face == 2 && z == -1) return false; - if (face == 3 && z == 256) return false; + if (face == 3 && z == xz) return false; if (face == 4 && x == -1) return false; - if (face == 5 && x == 256) return false; + if (face == 5 && x == xz) return false; // Common if (face == 0 && yy0 > 0) return true; if (face == 1 && yy1 < 1) return true; diff --git a/src/world/level/tile/entity/NetherReactorTileEntity.cpp b/src/world/level/tile/entity/NetherReactorTileEntity.cpp index 64c91fb..5b4728a 100755 --- a/src/world/level/tile/entity/NetherReactorTileEntity.cpp +++ b/src/world/level/tile/entity/NetherReactorTileEntity.cpp @@ -130,7 +130,7 @@ Vec3 NetherReactorTileEntity::getSpawnPosition( float minDistance, float varible void NetherReactorTileEntity::spawnEnemy() { Mob* mob = MobFactory::CreateMob(MobTypes::PigZombie, level); Vec3 enemyPosition = getSpawnPosition(3, 4, -1); - while(enemyPosition.x < 0 || enemyPosition.z < 0 || enemyPosition.x >= LEVEL_WIDTH || enemyPosition.z >= LEVEL_DEPTH) { + while(enemyPosition.x < 0 || enemyPosition.z < 0 || enemyPosition.x >= LevelConstants::LEVEL_WIDTH || enemyPosition.z >= LevelConstants::LEVEL_DEPTH) { enemyPosition = getSpawnPosition(3, 4, -1); } MobSpawner::addMob(level, mob, enemyPosition.x, enemyPosition.y, enemyPosition.z, 0, 0, true); @@ -140,7 +140,7 @@ void NetherReactorTileEntity::spawnEnemy() { void NetherReactorTileEntity::spawnItem() { Vec3 itemPosition= getSpawnPosition(3, 4, -1); - while(itemPosition.x < 0 || itemPosition.z < 0 || itemPosition.x >= LEVEL_WIDTH || itemPosition.z >= LEVEL_DEPTH) { + while(itemPosition.x < 0 || itemPosition.z < 0 || itemPosition.x >= LevelConstants::LEVEL_WIDTH || itemPosition.z >= LevelConstants::LEVEL_DEPTH) { itemPosition = getSpawnPosition(3, 4, -1); } ItemEntity* item = new ItemEntity(level, itemPosition.x, itemPosition.y, itemPosition.z, getSpawnItem()); @@ -177,14 +177,14 @@ ItemInstance NetherReactorTileEntity::GetLowOddsSpawnItem() { Item::painting, Item::door_wood }; - int itemIndex = level->random.nextInt(sizeof(items) / 4); + int itemIndex = level->random.nextInt(sizeof(items) / sizeof(Item*)); Item* itemToSpawn = items[itemIndex]; return ItemInstance(itemToSpawn); } else { static Tile* tiles[] = { Tile::bookshelf }; - int tileIndex = level->random.nextInt(sizeof(tiles) / 4); + int tileIndex = level->random.nextInt(sizeof(tiles) / sizeof(Tile*)); Tile* tileToSpawn = tiles[tileIndex]; return ItemInstance(tileToSpawn); }