diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c5e081e..da5b4c2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -18,7 +18,7 @@ permissions: jobs: build-windows: - name: Windows Build + name: Build Windows runs-on: ubuntu-22.04 steps: @@ -60,21 +60,47 @@ jobs: - name: Build working-directory: ${{github.workspace}}/build - run: cmake --build . --config $BUILD_TYPE --target MinecraftPE --parallel + 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/glfw3.dll ${{github.workspace}}/build/libpng16.dll ${{github.workspace}}/build/OpenAL32.dll - ${{github.workspace}}/build/z.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: Linux Build + name: Build Linux runs-on: ubuntu-latest steps: @@ -120,7 +146,7 @@ jobs: ${{github.workspace}}/build/MinecraftPE-server build-android: # pray to god - name: Build Android APK (${{ matrix.abi }}) + name: Build Android (${{ matrix.abi }}) runs-on: ubuntu-latest strategy: @@ -193,16 +219,6 @@ jobs: distribution: temurin java-version: 25 - - name: Validate environment - run: | - echo "ANDROID_SDK_ROOT=$ANDROID_SDK_ROOT" - echo "ANDROID_NDK_PATH=$ANDROID_NDK_PATH" - echo "JAVA_HOME=$JAVA_HOME" - echo "MATRIX_ABI=$MATRIX_ABI" - $ANDROID_SDK_ROOT/platform-tools/adb version || true - java -version - javac -version - - name: Run Android build script run: | chmod +x ./build.sh @@ -215,11 +231,59 @@ jobs: 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-linux, build-android ] - if: github.ref == 'refs/heads/main' + needs: [ build-windows, build-ios, build-linux, build-android, build-web ] steps: - name: Checkout uses: actions/checkout@v4 @@ -236,32 +300,44 @@ jobs: - name: Zip Windows Artifacts uses: vimtor/action-zip@v1.2 with: - files: data mcpe-windows/MinecraftPE.exe mcpe-windows/glfw3.dll mcpe-windows/libpng16.dll mcpe-windows/OpenAL32.dll mcpe-windows/z.dll + 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: data mcpe-linux/MinecraftPE + 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 }}.zip + dest: minecraftpe-server-${{ steps.ref.outputs.hash }}-linux.zip - - name: Zip Android arm64-v8a Artifact + - 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: minecraftpe-apk-arm64-v8a/minecraftpe-v8a-debug.apk - dest: minecraftpe-${{ steps.ref.outputs.hash }}-android-arm64-v8a.zip + 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 Android armeabi-v7a Artifact + - name: Zip Data uses: vimtor/action-zip@v1.2 with: - files: minecraftpe-apk-armeabi-v7a/minecraftpe-v7a-debug.apk - dest: minecraftpe-${{ steps.ref.outputs.hash }}-android-armeabi-v7a.zip + files: data + recursive: false + dest: data.zip - name: Update Development Release uses: andelf/nightly-release@main @@ -273,8 +349,14 @@ jobs: body: | MinecraftPE development release for commit ${{ github.sha }}. files: | - ./minecraftpe-${{ steps.ref.outputs.hash }}-windows.zip - ./minecraftpe-${{ steps.ref.outputs.hash }}-linux.zip + ./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 \ No newline at end of file + ./minecraftpe-${{ steps.ref.outputs.hash }}-android-armeabi-v7a.zip + ./minecraftpe-${{ steps.ref.outputs.hash }}-web.zip diff --git a/CMakeLists.txt b/CMakeLists.txt index cdf558a..b978db0 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,10 +7,6 @@ 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-narrowing -Wno-invalid-source-encoding -Wno-reserved-user-defined-literal") -endif() - include(cmake/EnumOption.cmake) if(EMSCRIPTEN) @@ -20,12 +16,22 @@ endif() enum_option(PLATFORM "Desktop;Web" "Platform to build for.") -find_package(Threads REQUIRED) +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) @@ -52,6 +58,7 @@ if(${PLATFORM} MATCHES "Web") add_library(png INTERFACE IMPORTED) set_target_properties(png PROPERTIES + INTERFACE_COMPILE_OPTIONS "-sUSE_LIBPNG=1" INTERFACE_LINK_OPTIONS "-sUSE_LIBPNG=1" ) @@ -102,9 +109,10 @@ CPMAddPackage( "ALSOFT_UTILS OFF" "LIBTYPE ${AL_LIBTYPE}" "ALSOFT_ENABLE_MODULES OFF" + "ALSOFT_STATIC_STDCXX ON" + "ALSOFT_STATIC_LIBGCC ON" ) -# TODO: Clear this paths with * file(GLOB SERVER_SOURCES "project/lib_projects/raknet/jni/RaknetSources/*.cpp" "src/NinecraftApp.cpp" @@ -143,7 +151,6 @@ file(GLOB SERVER_SOURCES "src/platform/CThread.cpp" "src/platform/HttpClient.cpp" - "src/platform/PngLoader.cpp" "src/platform/time.cpp" "src/platform/input/Controller.cpp" @@ -159,6 +166,7 @@ file(GLOB SERVER_SOURCES "src/util/Mth.cpp" "src/util/PerfTimer.cpp" "src/util/StringUtils.cpp" + "src/util/Color.cpp" "src/world/Direction.cpp" @@ -192,6 +200,9 @@ file(GLOB SERVER_SOURCES "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" @@ -205,6 +216,7 @@ file(GLOB SERVER_SOURCES "src/world/level/tile/entity/*.cpp" "src/world/phys/HitResult.cpp" + "src/commands/*.cpp" ) file(GLOB CLIENT_SOURCES @@ -251,6 +263,8 @@ file(GLOB CLIENT_SOURCES "src/util/**.cpp" + "src/util/Color.cpp" + "src/world/*.cpp" "src/world/phys/*.cpp" "src/world/entity/*.cpp" @@ -286,6 +300,8 @@ file(GLOB CLIENT_SOURCES "src/AppPlatform_glfw.cpp" "src/main.cpp" + + "src/commands/*.cpp" ) if (${PLATFORM} STREQUAL "Desktop") @@ -293,21 +309,23 @@ if (${PLATFORM} STREQUAL "Desktop") endif() # Server -if(UNIX) - add_executable("${PROJECT_NAME}-server" ${SERVER_SOURCES}) +add_executable("${PROJECT_NAME}-server" ${SERVER_SOURCES}) - target_compile_definitions("${PROJECT_NAME}-server" PUBLIC "STANDALONE_SERVER" "SERVER_PROFILER") +target_compile_definitions("${PROJECT_NAME}-server" PUBLIC "STANDALONE_SERVER" "SERVER_PROFILER") - target_include_directories("${PROJECT_NAME}-server" PUBLIC - "${CMAKE_SOURCE_DIR}/src/" - "project/lib_projects/raknet/jni/RaknetSources" - ) +target_include_directories("${PROJECT_NAME}-server" PUBLIC + "${CMAKE_SOURCE_DIR}/src/" + "project/lib_projects/raknet/jni/RaknetSources" +) - target_link_libraries("${PROJECT_NAME}-server" ${CMAKE_THREAD_LIBS_INIT}) -endif() +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() + target_compile_definitions(${PROJECT_NAME} PUBLIC ${PLATFORM_CPP}) target_include_directories(${PROJECT_NAME} PUBLIC @@ -321,11 +339,11 @@ target_include_directories(${PROJECT_NAME} PUBLIC if(${PLATFORM} MATCHES "Web") set(CMAKE_CXX_STANDARD 11) # uuuh i hate it - set(EM_FLAGS "-pthread -sUSE_PTHREADS=1 -sSHARED_MEMORY=1") + 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 -sPROXY_TO_PTHREAD") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${EM_FLAGS} --preload-file ${CMAKE_SOURCE_DIR}/data@/data") target_compile_options(${PROJECT_NAME} PUBLIC "-Os" diff --git a/README.md b/README.md index ec0b870..094ec25 100644 --- a/README.md +++ b/README.md @@ -1,31 +1,28 @@ # MinecraftPE > [!Warning] -> Github repository **isnt main**. All issues and pull requests should be send in [Gitea Repository](https://gitea.sffempire.ru/Kolyah35/minecraft-pe-0.6.1). +> [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). -> [!Important] -> We have a discord server, where you can report bugs or send feedback https://discord.gg/c58YesBxve +> [!Note] +> There is unofficial (not related to Kolyah35 and InviseDivine) discord server, where you can report bugs or send feedback https://discord.gg/udYrbNDfDH Source code for **Minecraft Pocket Edition 0.6.1 alpha** with various fixes and improvements. This project aims to preserve and improve this early version of Minecraft PE. -# TODO / Roadmap -- [x] Add platform GLFW -- [x] Compile for Linux -- [x] Compile for android aarch64 - - [x] Touch control improvements - - [ ] Screen fixes -- [ ] Rewrite platform logic -- [x] Fix sound -- [x] Do a server connection GUI -- [ ] Controller support -- [x] Minecraft server hosting -- [x] Screen fixess -- [x] Fix fog -- [x] Add sprinting -- [x] Chat (semi working) and commands -- [x] Implementing options -- [x] Better F3 +# 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 @@ -79,8 +76,14 @@ cmake --build . ``` 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): -3. Run the build script: +```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) @@ -154,7 +157,6 @@ cmake --build . ```bash 35.0.0 - 33.0.2 ``` 6. Download **Android NDK r14b**: @@ -197,4 +199,39 @@ cmake --build . 3. Run game: ``` emrun --port 8080 . - ``` \ No newline at end of file + ``` +## 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/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/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/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 d4b83d5..567a52b 100755 --- a/data/lang/en_US.lang +++ b/data/lang/en_US.lang @@ -153,7 +153,33 @@ options.group.tweaks=Tweaks options.allowSprint=Allow sprint options.barOnTop=HUD above inventory options.rpiCursor=Show Raspberry PI cursor -options.autojump=Auto Jump +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 @@ -203,6 +229,12 @@ 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 @@ -988,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/misc/web/index.html b/misc/web/index.html index 108e109..6eb328d 100644 --- a/misc/web/index.html +++ b/misc/web/index.html @@ -1,143 +1,46 @@ - - - - - - Emscripten-Generated Code - + + - - - -
-
emscripten
-
Downloading...
-
- -
-
- -
-
-
- Resize canvas - Lock/hide mouse pointer -     - -
+ -
- -
- - var Module = { - print(...args) { - // These replacements are necessary if you render to raw HTML - //text = text.replace(/&/g, "&"); - //text = text.replace(//g, ">"); - //text = text.replace('\n', '
', 'g'); - console.log(...args); - if (outputElement) { - var text = args.join(' '); - outputElement.value += text + "\n"; - outputElement.scrollTop = outputElement.scrollHeight; // focus on bottom - } - }, - canvas: canvasElement, - setStatus: setStatus, - totalDependencies: 0, - monitorRunDependencies(left) { - this.totalDependencies = Math.max(this.totalDependencies, left); - setStatus(left ? 'Preparing... (' + (this.totalDependencies-left) + '/' + this.totalDependencies + ')' : 'All downloads complete.'); - } - }; - setStatus('Downloading...'); - window.onerror = () => { - setStatus('Exception thrown, see JavaScript console'); - spinnerElement.style.display = 'none'; - setStatus = (text) => { - if (text) console.error('[post-exception status] ' + text); - }; - }; - - - + + \ No newline at end of file diff --git a/project/android/assets/lang/en_US.lang b/project/android/assets/lang/en_US.lang index fedae1c..83c1066 100755 --- a/project/android/assets/lang/en_US.lang +++ b/project/android/assets/lang/en_US.lang @@ -965,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 9bff609..2ff71e7 100755 --- a/project/android/jni/Android.mk +++ b/project/android/jni/Android.mk @@ -98,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 \ @@ -109,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 \ @@ -139,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 \ @@ -146,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 \ @@ -209,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 \ 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/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/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/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/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/src/AppPlatform_glfw.h b/src/AppPlatform_glfw.h index 0e2e505..d996860 100755 --- a/src/AppPlatform_glfw.h +++ b/src/AppPlatform_glfw.h @@ -20,6 +20,10 @@ #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); } @@ -102,12 +106,31 @@ public: return std::string(mbstr); } - virtual int getScreenWidth() override { return 854; }; - virtual int getScreenHeight() override { return 480; }; + virtual int getScreenWidth() override { + #ifdef __EMSCRIPTEN__ + int w, h; + emscripten_get_canvas_element_size("canvas", &w, &h); + + return w; + #endif + + 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 true; } + 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; @@ -120,6 +143,8 @@ public: #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 } diff --git a/src/AppPlatform_iOS.h b/src/AppPlatform_iOS.h index 55a786d..a2206b6 100755 --- a/src/AppPlatform_iOS.h +++ b/src/AppPlatform_iOS.h @@ -52,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 68f0d12..a98fc76 100755 --- a/src/AppPlatform_iOS.mm +++ b/src/AppPlatform_iOS.mm @@ -275,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/NinecraftApp.cpp b/src/NinecraftApp.cpp index d2feea6..60e9fee 100755 --- a/src/NinecraftApp.cpp +++ b/src/NinecraftApp.cpp @@ -136,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; diff --git a/src/SharedConstants.cpp b/src/SharedConstants.cpp index 4a31175..ee64aa9 100755 --- a/src/SharedConstants.cpp +++ b/src/SharedConstants.cpp @@ -4,12 +4,11 @@ namespace Common { std::string getGameVersionString(const std::string& versionSuffix /* = "" */) { - std::string result = std::string("v0.6.1") + versionSuffix; + 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 port)"; + result += " (64-bit)"; #endif - result += " alpha"; return result; } diff --git a/src/client/KeyMapping.h b/src/client/KeyMapping.h new file mode 100644 index 0000000..06740c8 --- /dev/null +++ b/src/client/KeyMapping.h @@ -0,0 +1,21 @@ +#ifndef NET_MINECRAFT_CLIENT__KeyMapping_H__ +#define NET_MINECRAFT_CLIENT__KeyMapping_H__ + +//package net.minecraft.client; +#include + +class KeyMapping +{ +public: + std::string name; + int key; + + KeyMapping() {} + + KeyMapping(const std::string& name_, int key_) + : name(name_), + key(key_) + {} +}; + +#endif /*NET_MINECRAFT_CLIENT__KeyMapping_H__*/ diff --git a/src/client/Minecraft.cpp b/src/client/Minecraft.cpp index 5b03708..ded2191 100755 --- a/src/client/Minecraft.cpp +++ b/src/client/Minecraft.cpp @@ -1,18 +1,21 @@ #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" @@ -89,11 +92,19 @@ #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); } @@ -111,7 +122,7 @@ 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; @@ -169,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), options(this) + 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 @@ -255,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) { @@ -274,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; @@ -290,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); @@ -357,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) @@ -460,32 +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.getBooleanValue(OPTIONS_RENDER_DEBUG)) { -#ifndef PLATFORM_DESKTOP + //#ifndef PLATFORM_DESKTOP if (!PerfTimer::enabled) { PerfTimer::reset(); PerfTimer::enabled = true; } _perfRenderer->renderFpsMeter(1); checkGlError("render debug"); -#endif + //#endif } else { PerfTimer::enabled = false; } @@ -497,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()); } } @@ -552,7 +571,7 @@ void Minecraft::tick(int nTick, int maxTick) { 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)); } @@ -562,17 +581,17 @@ 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"); if (!pause) { @@ -634,19 +653,17 @@ 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()); @@ -660,9 +677,7 @@ void Minecraft::tickInput() { Inventory* v = player->inventory; int numSlots = gui.getNumSlots(); -#ifndef PLATFORM_DESKTOP - numSlots--; -#endif + if (!useTouchscreen()) numSlots--; int slot = (v->selected - e.dy + numSlots) % numSlots; v->selectSlot(slot); @@ -670,14 +685,14 @@ void Minecraft::tickInput() { } /* 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; + } } */ } @@ -691,186 +706,213 @@ 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_LEFT_CTRL) { - player->setSprinting(true); + if (digit == 0) { + Pos pos((int)player->x, (int)player->y-1, (int)player->z); + SetSpawnPositionPacket p(pos); + raknetInstance->send(p); } - - 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); - } - - 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 - #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; - if (Mouse::getButtonState(MouseAction::ACTION_LEFT) == 0) { - gameMode->stopDestroyBlock(); + if (!useTouchscreen()) { + if (Mouse::getButtonState(MouseAction::ACTION_LEFT) == 0) { + gameMode->stopDestroyBlock(); + } + + if (!Mouse::isButtonDown(MouseAction::ACTION_RIGHT)) { + gameMode->releaseUsingItem(player); + } } if (useTouchscreen()) { // Touch: gesture recognizer classifies the action type (turn/destroy/build) BuildActionIntention bai; + if (inputHolder && inputHolder->getBuildInput()->tickBuild(player, &bai)) { handleBuildAction(&bai); + } else { + gameMode->stopDestroyBlock(); + if (player && player->isUsingItem()) { + gameMode->releaseUsingItem(player); + } } } else { // Desktop: left mouse = destroy/attack @@ -923,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; @@ -960,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 { @@ -970,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); @@ -1005,7 +1047,7 @@ void Minecraft::handleBuildAction(BuildActionIntention* action) { bool Minecraft::isOnlineClient() { - return (level != NULL && level->isClientSide); + return (level != NULL && level->isClientSide); } bool Minecraft::isOnline() @@ -1072,8 +1114,8 @@ void Minecraft::setScreen( Screen* screen ) if (screen->isInGameScreen() && level) { level->saveLevelData(); - level->saveGame(); - } + level->saveGame(); + } //noRender = false; } else { @@ -1109,16 +1151,19 @@ void Minecraft::releaseMouse() } bool Minecraft::useTouchscreen() { -#ifdef RPI +#if defined(TARGET_OS_IPHONE) + return true; +#elif defined(RPI) return false; #endif - return options.getBooleanValue(OPTIONS_USE_TOUCHSCREEN) || !_supportsNonTouchscreen; + return options.getBooleanValue(OPTIONS_USE_TOUCHSCREEN) && !_supportsNonTouchscreen; } bool Minecraft::supportNonTouchScreen() { return _supportsNonTouchscreen; } void Minecraft::init() { + LevelChunk::ChunkBlockCount = LevelConstants::CHUNK_BLOCK_COUNT; #ifndef STANDALONE_SERVER checkGlError("Init enter"); @@ -1129,12 +1174,38 @@ void Minecraft::init() 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); @@ -1151,59 +1222,82 @@ void Minecraft::init() void Minecraft::setSize(int w, int h) { #ifndef STANDALONE_SERVER - transformResolution(&w, &h); + transformResolution(&w, &h); width = w; height = h; - - 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 + 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; } + + // determine gui scale, optionally overriding auto + + + Gui::GuiScale = (float)Mth::Min(guiScale, Mth::Max(1, Mth::Min(width / 320, height / 240))); + + + } else { - // auto compute from resolution - if (width >= 1000) { - #ifdef __APPLE__ - Gui::GuiScale = (width > 2000)? 8.0f : 4.0f; - #else - Gui::GuiScale = 4.0f; - #endif - } - else if (width >= 800) { + + + 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); - // } + Gui::InvGuiScale = 1.0f / Gui::GuiScale; + screenWidth = (int)(width * Gui::InvGuiScale); + screenHeight = (int)(height * Gui::InvGuiScale); Config config = createConfig(this); gui.onConfigChanged(config); - + if (screen) screen->setSize(screenWidth, screenHeight); @@ -1228,39 +1322,34 @@ void Minecraft::reloadOptions() { if ((wasTouchscreen != useTouchscreen()) || (inputHolder == 0)) _reloadInput(); - // TODO: // 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; -#ifdef PLATFORM_DESKTOP - const bool useTouchHolder = false; -#else const bool useTouchHolder = useTouchscreen(); -#endif 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()); @@ -1303,7 +1392,7 @@ bool Minecraft::joinMultiplayerFromString( const std::string& server ) { std::string ip = ""; std::string port = "19132"; - + size_t pos = server.find(":"); if (pos != std::string::npos) { @@ -1312,12 +1401,9 @@ bool Minecraft::joinMultiplayerFromString( const std::string& server ) } else { ip = server; } - - printf("%s \n", port.c_str()); if (isLookingForMultiplayer && netCallback) { isLookingForMultiplayer = false; - printf("test"); int portNum = atoi(port.c_str()); return raknetInstance->connect(ip.c_str(), portNum); } @@ -1325,18 +1411,18 @@ bool Minecraft::joinMultiplayerFromString( const std::string& server ) } 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("Server", port, 16); - #else - raknetInstance->host(options.getStringValue(OPTIONS_USERNAME), port); - #endif +#ifdef STANDALONE_SERVER + raknetInstance->host("Server", port, 16); +#else + raknetInstance->host(options.getStringValue(OPTIONS_USERNAME), port); +#endif #endif } @@ -1390,6 +1476,12 @@ 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; @@ -1415,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) { @@ -1462,7 +1582,7 @@ void Minecraft::onGraphicsReset() { #ifndef STANDALONE_SERVER textures->clear(); - + font->onGraphicsReset(); gui.onGraphicsReset(); @@ -1501,12 +1621,12 @@ LevelStorageSource* Minecraft::getLevelSource() 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 } @@ -1571,21 +1691,31 @@ 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(OptionId option, float value ) { -// #ifndef STANDALONE_SERVER -// if(option == OPTIONS_PIXELS_PER_MILLIMETER) { -// pixelCalcUi.setPixelsPerMillimeter(value * Gui::InvGuiScale); -// pixelCalc.setPixelsPerMillimeter(value); -// } -// #endif + // #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); - } + 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 + gui.addMessage(msg); +#else + LOGI("%s \n", msg.c_str()); +#endif +} \ No newline at end of file diff --git a/src/client/Minecraft.h b/src/client/Minecraft.h index cd9dcce..f1d966f 100755 --- a/src/client/Minecraft.h +++ b/src/client/Minecraft.h @@ -2,6 +2,7 @@ #define NET_MINECRAFT_CLIENT__Minecraft_H__ #include "Options.h" +#include "commands/CommandManager.hpp" #ifndef STANDALONE_SERVER #include "MouseHandler.h" #include "gui/Gui.h" @@ -87,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,6 +118,8 @@ public: bool isLevelGenerated(); + void handleMouseDown(int button, bool down); + void audioEngineOn(); void audioEngineOff(); @@ -118,11 +129,17 @@ public: 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(); @@ -195,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; @@ -219,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 d122950..d77e28b 100755 --- a/src/client/MouseHandler.cpp +++ b/src/client/MouseHandler.cpp @@ -5,7 +5,7 @@ #include #endif -#ifdef PLATFORM_DESKTOP +#if defined(PLATFORM_DESKTOP) || defined(PLATFORM_WEB) #include #endif @@ -34,7 +34,7 @@ void MouseHandler::grab() { SDL_ShowCursor(0); #endif -#ifdef PLATFORM_DESKTOP +#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_DESKTOP +#if defined(PLATFORM_DESKTOP) || defined(PLATFORM_WEB) glfwSetInputMode(glfwGetCurrentContext(), GLFW_CURSOR, GLFW_CURSOR_NORMAL); #endif } diff --git a/src/client/Option.h b/src/client/Option.h index cc6547a..7c813c1 100644 --- a/src/client/Option.h +++ b/src/client/Option.h @@ -104,4 +104,4 @@ public: private: std::string m_value; -}; \ No newline at end of file +}; diff --git a/src/client/Options.cpp b/src/client/Options.cpp index 2cacca0..c67f68d 100755 --- a/src/client/Options.cpp +++ b/src/client/Options.cpp @@ -54,11 +54,33 @@ OptionBool limitFramerate("limitFramerate", false); OptionBool vsync("vsync", true); OptionBool fancyGraphics("fancyGraphics", true); OptionBool viewBobbing("viewBobbing", true); -OptionBool ambientOcclusion("ao", false); +OptionBool ambientOcclusion("ao", true); + +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); @@ -112,6 +134,7 @@ void Options::initTable() { m_options[OPTIONS_GUI_SCALE] = &guiScale; + m_options[OPTIONS_WINDOW_SCALE] = &windowScale; m_options[OPTIONS_SKIN] = &skin; m_options[OPTIONS_USERNAME] = &username; @@ -136,8 +159,20 @@ void Options::initTable() { 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; @@ -160,6 +195,15 @@ void Options::initTable() { 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; diff --git a/src/client/Options.h b/src/client/Options.h index f5a4393..c33c93b 100755 --- a/src/client/Options.h +++ b/src/client/Options.h @@ -37,6 +37,7 @@ enum OptionId { OPTIONS_BAR_ON_TOP, OPTIONS_ALLOW_SPRINT, OPTIONS_AUTOJUMP, + OPTIONS_WINDOW_SCALE, // Graphics OPTIONS_RENDER_DEBUG, @@ -49,6 +50,8 @@ enum OptionId { OPTIONS_LIMIT_FRAMERATE, OPTIONS_VSYNC, OPTIONS_FANCY_GRAPHICS, + OPTIONS_NORMAL_LIGHTING, + // Cheats / debug OPTIONS_FLY_SPEED, @@ -56,6 +59,7 @@ enum OptionId { OPTIONS_IS_FLYING, // Control + OPTIONS_BLOCK_OUTLINE, OPTIONS_USE_MOUSE_FOR_DIGGING, OPTIONS_IS_LEFT_HANDED, OPTIONS_IS_JOY_TOUCH_AREA, @@ -84,6 +88,17 @@ enum OptionId { 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 }; @@ -94,6 +109,10 @@ typedef std::vector StringVector; class Options { public: + // 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; Options(Minecraft* minecraft, const std::string& workingDirectory = "") diff --git a/src/client/OptionsFile.cpp b/src/client/OptionsFile.cpp index 4601429..ef2a0dc 100755 --- a/src/client/OptionsFile.cpp +++ b/src/client/OptionsFile.cpp @@ -16,6 +16,8 @@ OptionsFile::OptionsFile() { settingsPath = "./Documents/options.txt"; #elif defined(ANDROID) settingsPath = "options.txt"; +#elif defined(__EMSCRIPTEN__) + settingsPath = "/games/com.mojang/options.txt"; #else settingsPath = "options.txt"; #endif diff --git a/src/client/gamemode/CreativeMode.cpp b/src/client/gamemode/CreativeMode.cpp index 8be511a..c33cf8d 100755 --- a/src/client/gamemode/CreativeMode.cpp +++ b/src/client/gamemode/CreativeMode.cpp @@ -1,69 +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 = 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; -} - -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 e06d624..c33d0f5 100755 --- a/src/client/gamemode/CreatorMode.cpp +++ b/src/client/gamemode/CreatorMode.cpp @@ -1,115 +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 = 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; -} - -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 292165a..8009d64 100755 --- a/src/client/gamemode/GameMode.cpp +++ b/src/client/gamemode/GameMode.cpp @@ -1,174 +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" -#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; - 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/Gui.cpp b/src/client/gui/Gui.cpp index cf1ab58..9026abc 100755 --- a/src/client/gui/Gui.cpp +++ b/src/client/gui/Gui.cpp @@ -7,6 +7,7 @@ #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" @@ -36,7 +37,7 @@ const float Gui::DropTicks = 40.0f; //#include Gui::Gui(Minecraft* minecraft) -: minecraft(minecraft), + : minecraft(minecraft), tickCount(0), progress(0), overlayMessageTime(0), @@ -51,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); @@ -75,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; @@ -88,9 +87,9 @@ 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->options.getBooleanValue(OPTIONS_HIDEGUI)) { @@ -105,6 +104,12 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) { } } + // 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); @@ -115,38 +120,41 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) { glEnable(GL_DEPTH_TEST); } if (!minecraft->options.getBooleanValue(OPTIONS_HIDEGUI)) { - renderToolBar(a, ySlot, screenWidth); + renderToolBar(a, ySlot, screenWidth); - 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); + // 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); + 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 - if (Keyboard::isKeyDown(Keyboard::KEY_TAB)) { - renderPlayerList(font, screenWidth, screenHeight); + if (Keyboard::isKeyDown(Keyboard::KEY_TAB)) { + renderPlayerList(font, screenWidth, screenHeight); + } + + if (minecraft->options.getBooleanValue(OPTIONS_RENDER_DEBUG)) + renderDebugInfo(); } - if (minecraft->options.getBooleanValue(OPTIONS_RENDER_DEBUG)) - renderDebugInfo(); - } - - glDisable(GL_BLEND); + glDisable(GL_BLEND); glEnable2(GL_ALPHA_TEST); } @@ -185,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) { @@ -198,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); } @@ -206,74 +214,68 @@ 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) -{ - 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; + void Gui::handleKeyPressed(int key) + { + 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) - { - if (minecraft->player->inventory->selected > 0) + 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.getIntValue(OPTIONS_KEY_DROP)) - { - minecraft->player->inventory->dropSlot(minecraft->player->inventory->selected, false); - } -} void Gui::scrollChat(int delta) { if (delta == 0) @@ -298,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) { @@ -349,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; @@ -360,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(); @@ -373,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); } @@ -415,7 +424,7 @@ void Gui::inventoryUpdated() { } void Gui::onGraphicsReset() { - inventoryUpdated(); + inventoryUpdated(); } void Gui::texturesLoaded( Textures* textures ) { @@ -537,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()); @@ -597,12 +602,13 @@ void Gui::renderProgressIndicator( const bool isTouchInterface, const int screen bool bowEquipped = currentItem != NULL ? currentItem->getItem() == Item::bow : false; bool itemInUse = currentItem != NULL ? currentItem->getItem() == minecraft->player->getUseItem()->getItem() : false; 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); + || (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); @@ -621,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); @@ -642,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); @@ -677,10 +683,10 @@ void Gui::renderHearts() { 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; @@ -703,7 +709,7 @@ void Gui::renderBubbles() { if (minecraft->player->isUnderLiquid(Material::water)) { 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); @@ -726,13 +732,20 @@ void Gui::onLevelGenerated() { void Gui::renderDebugInfo() { // FPS counter (updates once per second) - static float fps = 0.0f; - static float fpsLastTime = 0.0f; + static int fps = 0; + static int fpsLastTime = 0; static int fpsFrames = 0; + static int displayChunkUpdates = 0; float now = getTimeS(); fpsFrames++; - if (now - fpsLastTime >= 1.0f) { + 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; } @@ -742,7 +755,6 @@ void Gui::renderDebugInfo() { // Position float px = p->x, py = p->y - p->heightOffset, pz = p->z; - posTranslator.to(px, py, pz); int bx = (int)floorf(px), by = (int)floorf(py), bz = (int)floorf(pz); int cx = bx >> 4, cz = bz >> 4; @@ -769,7 +781,70 @@ void Gui::renderDebugInfo() { 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); @@ -784,8 +859,8 @@ void Gui::renderDebugInfo() { 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; - +// 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; @@ -807,6 +882,7 @@ void Gui::renderDebugInfo() { font->draw(ln[i], MGN, y, col); } t.endOverrideAndDraw(); + } } void Gui::renderPlayerList(Font* font, int screenWidth, int screenHeight) { @@ -922,64 +998,64 @@ void Gui::renderOnSelectItemNameText( const int screenWidth, Font* font, int ySl // helper structure used by drawColoredString struct ColorSegment { - std::string text; - uint32_t color; + 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; - } + 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); - } + 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; + 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 ) { @@ -1023,20 +1099,23 @@ void Gui::renderChatMessages( const int screenHeight, unsigned int max, bool isC glEnable(GL_BLEND); // 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); + 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; @@ -1083,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); @@ -1097,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(); @@ -1122,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 1c36f83..1335035 100755 --- a/src/client/gui/Gui.h +++ b/src/client/gui/Gui.h @@ -127,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 ae39036..1a19efb 100755 --- a/src/client/gui/Screen.cpp +++ b/src/client/gui/Screen.cpp @@ -61,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) @@ -110,10 +116,12 @@ void Screen::keyboardEvent() keyPressed(Keyboard::getEventKey()); } } + void Screen::keyboardTextEvent() { charPressed(Keyboard::getChar()); } + void Screen::renderBackground() { renderBackground(0); @@ -177,9 +185,11 @@ void Screen::keyPressed( int eventKey ) textbox->keyPressed(minecraft, eventKey); } +#ifdef TABBING if (minecraft->useTouchscreen()) return; + // "Tabbing" the buttons (walking with keys) const int tabButtonCount = tabButtons.size(); if (!tabButtonCount) @@ -199,6 +209,7 @@ void Screen::keyPressed( int eventKey ) } updateTabButtonSelection(); +#endif } void Screen::charPressed(char inputChar) { @@ -209,11 +220,13 @@ void Screen::charPressed(char 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 ) diff --git a/src/client/gui/Screen.h b/src/client/gui/Screen.h index be44d5c..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() {} 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/GuiElementContainer.cpp b/src/client/gui/components/GuiElementContainer.cpp index 9cfbb09..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); diff --git a/src/client/gui/components/GuiElementContainer.h b/src/client/gui/components/GuiElementContainer.h index d20f9d3..06df761 100755 --- a/src/client/gui/components/GuiElementContainer.h +++ b/src/client/gui/components/GuiElementContainer.h @@ -5,16 +5,17 @@ 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 ); diff --git a/src/client/gui/components/ImageButton.cpp b/src/client/gui/components/ImageButton.cpp index 1c7a57a..3d95acc 100755 --- a/src/client/gui/components/ImageButton.cpp +++ b/src/client/gui/components/ImageButton.cpp @@ -42,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); 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 54212d5..d4dd161 100755 --- a/src/client/gui/components/OptionsGroup.cpp +++ b/src/client/gui/components/OptionsGroup.cpp @@ -1,115 +1,219 @@ -#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" - -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 + 18; - 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 ) { - float padX = 10.0f; - float padY = 5.0f; - - minecraft->font->draw(label, (float)x + padX, (float)y + padY, 0xffffffff, false); - - super::render(minecraft, xm, ym); -} - -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(); -} \ No newline at end of file +#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 24d28bd..bb284fa 100755 --- a/src/client/gui/components/OptionsGroup.h +++ b/src/client/gui/components/OptionsGroup.h @@ -1,32 +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 "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); - OptionsGroup& addOptionItem(OptionId optId, Minecraft* minecraft); -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; -}; - -#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 1ee48e3..93eccb8 100755 --- a/src/client/gui/components/OptionsItem.cpp +++ b/src/client/gui/components/OptionsItem.cpp @@ -36,6 +36,48 @@ void OptionsItem::render( Minecraft* minecraft, int xm, int ym ) { } 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); diff --git a/src/client/gui/components/OptionsPane.cpp b/src/client/gui/components/OptionsPane.cpp new file mode 100644 index 0000000..217a8b2 --- /dev/null +++ b/src/client/gui/components/OptionsPane.cpp @@ -0,0 +1,64 @@ +#include "OptionsPane.h" +#include "OptionsGroup.h" +#include "OptionsItem.h" +#include "ImageButton.h" +#include "Slider.h" +#include "../../Minecraft.h" +#include "client/Options.h" + +OptionsPane::OptionsPane() { + +} + +void OptionsPane::setupPositions() { + int currentHeight = y + 1; + for(std::vector::iterator it = children.begin(); it != children.end(); ++it ) { + (*it)->width = width; + (*it)->y = currentHeight; + (*it)->x = x; + currentHeight += (*it)->height + 1; + } + height = currentHeight; + super::setupPositions(); +} + +OptionsGroup& OptionsPane::createOptionsGroup( std::string label ) { + OptionsGroup* newGroup = new OptionsGroup(label); + children.push_back(newGroup); + // create and return a new group index + return *newGroup; +} + +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, 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, 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 new file mode 100644 index 0000000..e6f7607 --- /dev/null +++ b/src/client/gui/components/OptionsPane.h @@ -0,0 +1,30 @@ +#ifndef ITEMPANE_H__ +#define ITEMPANE_H__ + +#include +#include +#include "GuiElementContainer.h" +#include "../../../world/item/ItemInstance.h" +#include "../../../client/Options.h" +class Font; +class Textures; +class NinePatchLayer; +class ItemPane; +class OptionButton; +class Button; +class OptionsGroup; +class Slider; +class Minecraft; +class OptionsPane: public GuiElementContainer +{ + typedef GuiElementContainer super; +public: + OptionsPane(); + OptionsGroup& createOptionsGroup( std::string label ); + 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(); +}; + +#endif /*ITEMPANE_H__*/ diff --git a/src/client/gui/components/ScrollingPane.cpp b/src/client/gui/components/ScrollingPane.cpp index 6ee7744..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); @@ -549,11 +587,39 @@ void ScrollingPane::stepThroughDecelerationAnimation(bool noAnimation) { } void ScrollingPane::scrollBy(float dx, float dy) { - // adjust the translation offsets fpx/fpy by the requested amount - float nfpx = fpx + dx; - float nfpy = fpy + dy; - // convert back to content offset (fpx = -contentOffset.x) - setContentOffset(Vec3(-nfpx, -nfpy, 0)); + // 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) { diff --git a/src/client/gui/components/Slider.h b/src/client/gui/components/Slider.h index 73c009a..8168741 100755 --- a/src/client/gui/components/Slider.h +++ b/src/client/gui/components/Slider.h @@ -3,7 +3,6 @@ #include "GuiElement.h" #include "../../../client/Options.h" -#include class Slider : public GuiElement { typedef GuiElement super; diff --git a/src/client/gui/components/SmallButton.cpp b/src/client/gui/components/SmallButton.cpp new file mode 100644 index 0000000..e154736 --- /dev/null +++ b/src/client/gui/components/SmallButton.cpp @@ -0,0 +1,24 @@ +#include "SmallButton.h" + +SmallButton::SmallButton( int id, int x, int y, const std::string& msg ) +: super(id, x, y, 150, 20, msg), + option(NULL) +{ +} + +SmallButton::SmallButton( int id, int x, int y, int width, int height, const std::string& msg ) +: super(id, x, y, width, height, msg), + option(NULL) +{ +} + +SmallButton::SmallButton( int id, int x, int y, Option* item, const std::string& msg ) +: super(id, x, y, 150, 20, msg), + option(item) +{ +} + +Option* SmallButton::getOption() +{ + return option; +} diff --git a/src/client/gui/components/SmallButton.h b/src/client/gui/components/SmallButton.h new file mode 100644 index 0000000..2fd6372 --- /dev/null +++ b/src/client/gui/components/SmallButton.h @@ -0,0 +1,23 @@ +#ifndef NET_MINECRAFT_CLIENT_GUI_COMPONENTS__SmallButton_H__ +#define NET_MINECRAFT_CLIENT_GUI_COMPONENTS__SmallButton_H__ + +//package net.minecraft.client.gui; + +#include +#include "Button.h" +#include "../../Options.h" + +class SmallButton: public Button +{ + typedef Button super; +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, Option* item, const std::string& msg); + + Option* getOption(); +private: + Option* option; +}; + +#endif /*NET_MINECRAFT_CLIENT_GUI_COMPONENTS__SmallButton_H__*/ diff --git a/src/client/gui/screens/BuyGameScreen.h b/src/client/gui/screens/BuyGameScreen.h new file mode 100644 index 0000000..228cdba --- /dev/null +++ b/src/client/gui/screens/BuyGameScreen.h @@ -0,0 +1,26 @@ +#ifndef NET_MINECRAFT_CLIENT_GUI_SCREENS__BuyGameScreen_H__ +#define NET_MINECRAFT_CLIENT_GUI_SCREENS__BuyGameScreen_H__ + +#include "../Screen.h" +#include "../components/Button.h" + +class BuyGameScreen: public Screen +{ +public: + BuyGameScreen() {} + virtual ~BuyGameScreen() {} + + void init(); + + void render(int xm, int ym, float a); + + void buttonClicked(Button* button) { + //if (button->id == bQuit.id) + } + +private: + //Button bQuit; + //Button bBuyGame; +}; + +#endif /*NET_MINECRAFT_CLIENT_GUI_SCREENS__BuyGameScreen_H__*/ 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/ConsoleScreen.cpp b/src/client/gui/screens/ConsoleScreen.cpp index 939cb74..9d3e874 100644 --- a/src/client/gui/screens/ConsoleScreen.cpp +++ b/src/client/gui/screens/ConsoleScreen.cpp @@ -6,8 +6,9 @@ #include "../../../world/level/Level.h" #include "../../../network/RakNetInstance.h" #include "../../../network/ServerSideNetworkHandler.h" -#include "../../../network/packet/ChatPacket.h" +#include "../../../network/packet/MessagePacket.h" #include "../../../platform/log.h" +#include "util/StringUtils.h" #include #include @@ -54,141 +55,40 @@ void ConsoleScreen::charPressed(char inputChar) _input += inputChar; } -// --------------------------------------------------------------------------- -// execute: run _input as a command, print result, close screen -// --------------------------------------------------------------------------- void ConsoleScreen::execute() { + if (!minecraft->level) return; + if (_input.empty()) { - minecraft->setScreen(NULL); - return; + return minecraft->setScreen(NULL); } - if (_input[0] == '/') { - // Command - std::string result = processCommand(_input); - if (!result.empty()) - minecraft->gui.addMessage(result); - } else { - // Chat message: message - std::string msg = std::string("<") + minecraft->player->name + "> " + _input; - if (minecraft->netCallback && minecraft->raknetInstance->isServer()) { - // Hosting a LAN game: displayGameMessage shows locally + broadcasts MessagePacket to clients - static_cast(minecraft->netCallback)->displayGameMessage(msg); - } else if (minecraft->netCallback) { - // Connected client: send ChatPacket to server; server echoes it back as MessagePacket - ChatPacket chatPkt(msg); - minecraft->raknetInstance->send(chatPkt); - } else { - // Singleplayer: show locally only - minecraft->gui.addMessage(msg); + 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); } -// --------------------------------------------------------------------------- -// processCommand -// --------------------------------------------------------------------------- -static std::string trim(const std::string& s) { - size_t a = s.find_first_not_of(" \t"); - if (a == std::string::npos) return ""; - size_t b = s.find_last_not_of(" \t"); - return s.substr(a, b - a + 1); -} - -std::string ConsoleScreen::processCommand(const std::string& raw) -{ - // strip leading '/' - std::string line = raw; - if (!line.empty() && line[0] == '/') line = line.substr(1); - line = trim(line); - - // tokenise - std::vector args; - { - std::istringstream ss(line); - std::string tok; - while (ss >> tok) args.push_back(tok); - } - - if (args.empty()) return ""; - - Level* level = minecraft->level; - if (!level) return "No level loaded."; - - // ----------------------------------------------------------------------- - // /time ... - // ----------------------------------------------------------------------- - if (args[0] == "time") { - if (args.size() < 2) - return "Usage: /time ..."; - - const std::string& sub = args[1]; - - // -- time add ----------------------------------------------- - if (sub == "add") { - if (args.size() < 3) return "Usage: /time add "; - long delta = std::atol(args[2].c_str()); - long newTime = level->getTime() + delta; - level->setTime(newTime); - std::ostringstream out; - out << "Set the time to " << (newTime % Level::TICKS_PER_DAY); - return out.str(); - } - - // -- time set ----------------------- - if (sub == "set") { - if (args.size() < 3) return "Usage: /time set "; - const std::string& val = args[2]; - - long t = -1; - if (val == "day") t = 1000; - else if (val == "noon") t = 6000; - else if (val == "night") t = 13000; - else if (val == "midnight") t = 18000; - else { - // numeric — accept positive integers only - bool numeric = true; - for (char c : val) - if (!std::isdigit((unsigned char)c)) { numeric = false; break; } - if (!numeric) return std::string("Unknown value: ") + val; - t = std::atol(val.c_str()); - } - - // Preserve the total day count so only the time-of-day changes - long dayCount = level->getTime() / Level::TICKS_PER_DAY; - long newTime = dayCount * Level::TICKS_PER_DAY + (t % Level::TICKS_PER_DAY); - level->setTime(newTime); - std::ostringstream out; - out << "Set the time to " << t; - return out.str(); - } - - // -- time query ------------------------------ - if (sub == "query") { - if (args.size() < 3) return "Usage: /time query "; - const std::string& what = args[2]; - - long total = level->getTime(); - long daytime = total % Level::TICKS_PER_DAY; - long day = total / Level::TICKS_PER_DAY; - - std::ostringstream out; - if (what == "daytime") { out << "The time of day is " << daytime; } - else if (what == "gametime") { out << "The game time is " << total; } - else if (what == "day") { out << "The day is " << day; } - else return std::string("Unknown query: ") + what; - return out.str(); - } - - return "Unknown sub-command. Usage: /time ..."; - } - - return std::string("Unknown command: /") + args[0]; -} - // --------------------------------------------------------------------------- // render // --------------------------------------------------------------------------- diff --git a/src/client/gui/screens/ConsoleScreen.h b/src/client/gui/screens/ConsoleScreen.h index e0074b9..f0c1fd5 100644 --- a/src/client/gui/screens/ConsoleScreen.h +++ b/src/client/gui/screens/ConsoleScreen.h @@ -25,7 +25,6 @@ public: private: void execute(); - std::string processCommand(const std::string& cmd); std::string _input; int _cursorBlink; // tick counter for cursor blink diff --git a/src/client/gui/screens/CreditsScreen.cpp b/src/client/gui/screens/CreditsScreen.cpp index 56f13ac..f0820af 100644 --- a/src/client/gui/screens/CreditsScreen.cpp +++ b/src/client/gui/screens/CreditsScreen.cpp @@ -28,6 +28,7 @@ void CreditsScreen::init() { buttons.push_back(bHeader); buttons.push_back(btnBack); + // TODO: rewrite it // prepare text lines _lines.clear(); _lines.push_back("Minecraft: Pocket Edition"); @@ -39,6 +40,8 @@ void CreditsScreen::init() { _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"); 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 863b1f8..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) { @@ -248,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) @@ -337,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 affd6af..6a0c4b9 100755 --- a/src/client/gui/screens/IngameBlockSelectionScreen.h +++ b/src/client/gui/screens/IngameBlockSelectionScreen.h @@ -52,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 new file mode 100644 index 0000000..2801521 --- /dev/null +++ b/src/client/gui/screens/InvalidLicenseScreen.h @@ -0,0 +1,107 @@ +#ifndef NET_MINECRAFT_CLIENT_GUI_SCREENS__InvalidLicenseScreen_H__ +#define NET_MINECRAFT_CLIENT_GUI_SCREENS__InvalidLicenseScreen_H__ + +#include "../Screen.h" +#include "../components/Button.h" +#include "../../Minecraft.h" +#include "../../../LicenseCodes.h" + +class InvalidLicenseScreen: public Screen +{ +public: + InvalidLicenseScreen(int id, bool hasBuyButton) + : _id(id), + _hasBuyButton(hasBuyButton), + _baseY(0), + bOk(0), + bBuy(0) + { + } + + virtual ~InvalidLicenseScreen() { + delete bOk; + delete bBuy; + } + + void init() { + if (minecraft->useTouchscreen()) { + bOk = new Touch::TButton(1, "Ok"); + bBuy = new Touch::TButton(2, "Buy"); + } else { + bOk = new Button(1, "Ok"); + bBuy = new Button(2, "Buy"); + } + + if (_hasBuyButton) + bOk->msg = "Quit"; + + if (!LicenseCodes::isOk(_id)) { + char buf[20] = {0}; + sprintf(buf, "%d", _id); + + desc1 = "License verification failed (error "; + desc1 += buf; + desc1 += ")"; + desc2 = "Try again later."; + hint = "You need to be connected to the internet\n"; + hint += "once while you start the game."; + } + + buttons.push_back(bOk); + tabButtons.push_back(bOk); + + if (_hasBuyButton) { + buttons.push_back(bBuy); + tabButtons.push_back(bBuy); + } + } + + void setupPositions() { + _baseY = height/5 + 6; + //if (_hasBuyButton) + _baseY -= 24; + + bOk->width = bBuy->width = 200; + bOk->x = bBuy->x = (width - bOk->width) / 2; + bBuy->y = _baseY + 84; + bOk->y = bBuy->y + bBuy->height + 4; + + if (!_hasBuyButton) + bOk->y -= 24; + } + + void tick() {} + + //void keyPressed(int eventKey) {} + + void render(int xm, int ym, float a) { + renderDirtBackground(0); + drawCenteredString(minecraft->font, desc1, width/2, _baseY, 0xffffff); + drawCenteredString(minecraft->font, desc2, width/2, _baseY + 24, 0xffffff); + + drawCenteredString(minecraft->font, hint, width/2, _baseY + 60, 0xffffff); + + Screen::render(xm, ym, a); + } + + void buttonClicked(Button* button) { + if (button->id == bOk->id) { + minecraft->quit(); + } + if (button->id == bBuy->id) { + minecraft->platform()->buyGame(); + } + }; +private: + int _id; + std::string desc1; + std::string desc2; + std::string hint; + + Button* bOk; + Button* bBuy; + bool _hasBuyButton; + int _baseY; +}; + +#endif /*NET_MINECRAFT_CLIENT_GUI_SCREENS__InvalidLicenseScreen_H__*/ diff --git a/src/client/gui/screens/JoinByIPScreen.h b/src/client/gui/screens/JoinByIPScreen.h index 5ee2b16..7333b39 100644 --- a/src/client/gui/screens/JoinByIPScreen.h +++ b/src/client/gui/screens/JoinByIPScreen.h @@ -2,8 +2,8 @@ #include "../Screen.h" #include "../components/Button.h" #include "../../Minecraft.h" -#include "client/gui/components/ImageButton.h" -#include "client/gui/components/TextBox.h" +#include "../components/ImageButton.h" +#include "../components/TextBox.h" class JoinByIPScreen: public Screen { @@ -25,4 +25,4 @@ private: Touch::THeader bHeader; Touch::TButton bJoin; ImageButton bBack; -}; \ No newline at end of file +}; diff --git a/src/client/gui/screens/OptionsScreen.cpp b/src/client/gui/screens/OptionsScreen.cpp index adeb5be..bdccde0 100755 --- a/src/client/gui/screens/OptionsScreen.cpp +++ b/src/client/gui/screens/OptionsScreen.cpp @@ -19,7 +19,6 @@ OptionsScreen::OptionsScreen() } OptionsScreen::~OptionsScreen() { - if (btnClose != NULL) { delete btnClose; btnClose = NULL; @@ -53,7 +52,6 @@ OptionsScreen::~OptionsScreen() { } void OptionsScreen::init() { - bHeader = new Touch::THeader(0, "Options"); btnClose = new ImageButton(1, ""); @@ -89,7 +87,6 @@ void OptionsScreen::init() { } void OptionsScreen::setupPositions() { - int buttonHeight = btnClose->height; btnClose->x = width - btnClose->width; @@ -124,6 +121,7 @@ void OptionsScreen::setupPositions() { (*it)->x = categoryButtons[0]->width; (*it)->y = bHeader->height; (*it)->width = width - categoryButtons[0]->width; + (*it)->height = height - bHeader->height; (*it)->setupPositions(); } @@ -134,7 +132,6 @@ void OptionsScreen::setupPositions() { void OptionsScreen::render(int xm, int ym, float a) { - renderBackground(); int xmm = xm * width / minecraft->width; @@ -142,7 +139,7 @@ void OptionsScreen::render(int xm, int ym, float a) { if (currentOptionsGroup != NULL) currentOptionsGroup->render(minecraft, xmm, ymm); - + super::render(xm, ym, a); } @@ -150,10 +147,13 @@ void OptionsScreen::removed() { } void OptionsScreen::buttonClicked(Button* button) { - if (button == btnClose) { minecraft->options.save(); - minecraft->screenChooser.setScreen(SCREEN_STARTMENU); + 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; @@ -165,7 +165,6 @@ void OptionsScreen::buttonClicked(Button* button) { } void OptionsScreen::selectCategory(int index) { - int currentIndex = 0; for (std::vector::iterator it = categoryButtons.begin(); it != categoryButtons.end(); ++it) { @@ -199,6 +198,7 @@ void OptionsScreen::generateOptionScreens() { 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) @@ -209,7 +209,10 @@ void OptionsScreen::generateOptionScreens() { // // Controls Pane optionPanes[2]->addOptionItem(OPTIONS_INVERT_Y_MOUSE, minecraft) - .addOptionItem(OPTIONS_USE_TOUCHSCREEN, 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); @@ -217,20 +220,37 @@ void OptionsScreen::generateOptionScreens() { // // 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_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_RPI_CURSOR, 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 (currentOptionsGroup != NULL) currentOptionsGroup->mouseClicked(minecraft, x, y, buttonNum); @@ -238,19 +258,24 @@ void OptionsScreen::mouseClicked(int x, int y, int 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::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); } diff --git a/src/client/gui/screens/OptionsScreen.h b/src/client/gui/screens/OptionsScreen.h index b02c7b8..dd1e73e 100755 --- a/src/client/gui/screens/OptionsScreen.h +++ b/src/client/gui/screens/OptionsScreen.h @@ -27,6 +27,7 @@ public: 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); diff --git a/src/client/gui/screens/PauseScreen.cpp b/src/client/gui/screens/PauseScreen.cpp index aac6f21..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_SOUND_VOLUME, 1, 0), bThirdPerson(OPTIONS_THIRD_PERSON_VIEW), - bHideGui(OPTIONS_HIDEGUI) + bHideGui(OPTIONS_HIDEGUI) { ImageDef def; def.setSrc(IntRectangle(160, 144, 39, 31)); @@ -30,7 +34,7 @@ PauseScreen::PauseScreen(bool wasBackPaused) // 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); - + buttons.push_back(bOptions); // bSound.updateImage(&minecraft->options); bThirdPerson.updateImage(&minecraft->options); bHideGui.updateImage(&minecraft->options); // 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,14 +92,14 @@ 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; @@ -96,24 +110,48 @@ 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; + + bQuitAndSaveLocally->x = bServerVisibility->x = (width - bQuitAndSaveLocally->width) / 2; + bQuitAndSaveLocally->y = bServerVisibility->y = yBase + 32 * 4; + } + + // bSound.y = bThirdPerson.y = 8; // bSound.x = 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 6f6a078..4098511 100755 --- a/src/client/gui/screens/PauseScreen.h +++ b/src/client/gui/screens/PauseScreen.h @@ -33,7 +33,9 @@ private: Button* bQuit; Button* bQuitAndSaveLocally; Button* bServerVisibility; -// Button* bThirdPerson; + Button* bOptions; + + // Button* bThirdPerson; // OptionButton bSound; OptionButton bThirdPerson; 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 9f45e3c..86dbdf5 100755 --- a/src/client/gui/screens/ScreenChooser.cpp +++ b/src/client/gui/screens/ScreenChooser.cpp @@ -14,14 +14,14 @@ #include "../../Minecraft.h" -#include +#include "UsernameScreen.h" Screen* ScreenChooser::createScreen( ScreenId id ) { Screen* screen = NULL; // :sob: - if (_mc->useTouchscreen()) { + 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; diff --git a/src/client/gui/screens/SimpleChooseLevelScreen.cpp b/src/client/gui/screens/SimpleChooseLevelScreen.cpp index f839725..37f5c72 100755 --- a/src/client/gui/screens/SimpleChooseLevelScreen.cpp +++ b/src/client/gui/screens/SimpleChooseLevelScreen.cpp @@ -8,13 +8,14 @@ #include "../../../platform/time.h" #include "../../../platform/input/Keyboard.h" #include "../../../platform/log.h" +#include SimpleChooseLevelScreen::SimpleChooseLevelScreen(const std::string& levelName) -: bHeader(0), - bGamemode(0), - bCheats(0), - bBack(0), - bCreate(0), +: bHeader(nullptr), + bGamemode(nullptr), + bCheats(nullptr), + bBack(nullptr), + bCreate(nullptr), levelName(levelName), hasChosen(false), gamemode(GameType::Survival), @@ -42,10 +43,10 @@ void SimpleChooseLevelScreen::init() // first") when the name already existed. ChooseLevelScreen::init(); - tLevelName.text = "New world"; + tLevelName.text = I18n::get("selectWorld.newWorld"); // header + close button - bHeader = new Touch::THeader(0, "Create World"); + bHeader = new Touch::THeader(0, I18n::get("selectWorld.create")); // create the back/X button as ImageButton like CreditsScreen bBack = new ImageButton(2, ""); { @@ -56,14 +57,14 @@ void SimpleChooseLevelScreen::init() def.setSrc(IntRectangle(150, 0, (int)def.width, (int)def.height)); bBack->setImageDef(def, true); } - if (minecraft->useTouchscreen()) { - bGamemode = new Touch::TButton(1, "Survival mode"); + 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, "Create"); + bCreate = new Touch::TButton(3, I18n::get("selectWorld.create")); } else { - bGamemode = new Button(1, "Survival mode"); + bGamemode = new Button(1, I18n::get("selectWorld.gameMode.survival")); bCheats = new Button(4, "Cheats: Off"); - bCreate = new Button(3, "Create"); + bCreate = new Button(3, I18n::get("Create")); } buttons.push_back(bHeader); diff --git a/src/client/gui/screens/StartMenuScreen.cpp b/src/client/gui/screens/StartMenuScreen.cpp index 3fede7e..27f25ec 100755 --- a/src/client/gui/screens/StartMenuScreen.cpp +++ b/src/client/gui/screens/StartMenuScreen.cpp @@ -23,49 +23,62 @@ // 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, 160, 24, "Options"), - bQuit( 5, "") { } StartMenuScreen::~StartMenuScreen() { + delete bHost; + delete bJoin; + delete bOptions; + delete bQuit; } void StartMenuScreen::init() { - bJoin.active = bHost.active = bOptions.active = true; + 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; if (minecraft->options.getStringValue(OPTIONS_USERNAME).empty()) { return; // tick() will redirect to UsernameScreen } - buttons.push_back(&bHost); - buttons.push_back(&bJoin); + 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(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 - // 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 - } + //// 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!"; @@ -93,20 +106,30 @@ void StartMenuScreen::init() } void StartMenuScreen::setupPositions() { - int yBase = height / 2; + if (minecraft->options.getIntValue(OPTIONS_MENU_STYLE) == 2){ + int yBase = (height / 2) - 20; - bHost.y = yBase; - bJoin.y = bHost.y + 24 + 4; - bOptions.y = bJoin.y + 24 + 4; + 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 - bOptions.width) / 2; + bHost->x = (width - bHost->width) / 2; + bJoin->x = (width - bJoin->width) / 2; + bOptions->x = (width - bOptions->width) / 2; + bQuit->x = (width - bQuit->width) / 2; - // position quit icon at top-right (use image-defined size) - bQuit.x = width - bQuit.width; - bQuit.y = 0; + //// position quit icon at top-right (use image-defined size) + //bQuit.x = width - bQuit.width; + //bQuit.y = 0; } void StartMenuScreen::tick() { @@ -114,7 +137,7 @@ void StartMenuScreen::tick() { 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") ); @@ -122,16 +145,16 @@ 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 == &bQuit) + if (button->id == bQuit->id) { minecraft->quit(); } diff --git a/src/client/gui/screens/StartMenuScreen.h b/src/client/gui/screens/StartMenuScreen.h index e2801fe..9ff3c8b 100755 --- a/src/client/gui/screens/StartMenuScreen.h +++ b/src/client/gui/screens/StartMenuScreen.h @@ -23,10 +23,10 @@ public: bool isInGameScreen(); private: - Button bHost; - Button bJoin; - Button bOptions; - ImageButton bQuit; // X button in top-right corner + Button* bHost; + Button* bJoin; + Button* bOptions; + Button* bQuit; std::string copyright; int copyrightPosX; diff --git a/src/client/gui/screens/UsernameScreen.cpp b/src/client/gui/screens/UsernameScreen.cpp index 82f4bca..cb05cf6 100644 --- a/src/client/gui/screens/UsernameScreen.cpp +++ b/src/client/gui/screens/UsernameScreen.cpp @@ -35,8 +35,8 @@ void UsernameScreen::setupPositions() // Make the done button match the touch-style option tabs _btnDone.width = 66; _btnDone.height = 26; - _btnDone.x = (width - _btnDone.width) / 2; - _btnDone.y = height / 2 + 52; + _btnDone.x = cx - (_btnDone.width / 2); + _btnDone.y = cy + 52; tUsername.width = 120; tUsername.height = 20; diff --git a/src/client/gui/screens/UsernameScreen.h b/src/client/gui/screens/UsernameScreen.h index c1d750e..592998f 100644 --- a/src/client/gui/screens/UsernameScreen.h +++ b/src/client/gui/screens/UsernameScreen.h @@ -3,7 +3,8 @@ #include "../Screen.h" #include "../components/Button.h" -#include "client/gui/components/TextBox.h" +// this is cursed lol +#include "../../../client/gui/components/TextBox.h" #include class UsernameScreen : public Screen 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 d88025d..1749984 100755 --- a/src/client/gui/screens/touch/TouchIngameBlockSelectionScreen.cpp +++ b/src/client/gui/screens/touch/TouchIngameBlockSelectionScreen.cpp @@ -1,291 +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; -} - -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 ) -{ - 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/model/HumanoidModel.cpp b/src/client/model/HumanoidModel.cpp index 5a64657..e6515ea 100755 --- a/src/client/model/HumanoidModel.cpp +++ b/src/client/model/HumanoidModel.cpp @@ -21,6 +21,9 @@ HumanoidModel::HumanoidModel( float g /*= 0*/, float yOffset /*= 0*/, int texW / texWidth = texW; texHeight = texH; + // texWidth = 64; + // texHeight = 32; + head.setModel(this); hair.setModel(this); body.setModel(this); @@ -40,10 +43,9 @@ HumanoidModel::HumanoidModel( float g /*= 0*/, float yOffset /*= 0*/, int texW / head.addBox(-4, -8, -4, 8, 8, 8, g); // Head head.setPos(0, 0 + yOffset, 0); - if (modernSkin) { - 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); // Outer head layer (hat) + hair.setPos(0, 0 + yOffset, 0); + body.addBox(-4, 0, -2, 8, 12, 4, g); // Body body.setPos(0, 0 + yOffset, 0); @@ -99,17 +101,17 @@ 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 - if (texWidth == 64 && texHeight == 64) { - hair.xRot = head.xRot; - hair.yRot = head.yRot; - hair.zRot = head.zRot; - hair.y = head.y; - } + + hair.xRot = head.xRot; + hair.yRot = head.yRot; + hair.zRot = head.zRot; + hair.y = head.y; + head.render(scale); - if (texWidth == 64 && texHeight == 64) { - hair.render(scale); - } + + hair.render(scale); + body.render(scale); arm0.render(scale); arm1.render(scale); @@ -123,12 +125,12 @@ void HumanoidModel::render( HumanoidModel* model, float scale ) head.yRot = model->head.yRot; head.y = model->head.y; head.xRot = model->head.xRot; - if (texWidth == 64 && texHeight == 64) { - hair.yRot = head.yRot; - hair.xRot = head.xRot; - hair.zRot = head.zRot; - hair.y = head.y; - } + + 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; @@ -273,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/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 bfb1467..b826f39 100755 --- a/src/client/model/geom/Polygon.cpp +++ b/src/client/model/geom/Polygon.cpp @@ -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/player/LocalPlayer.cpp b/src/client/player/LocalPlayer.cpp index 1113468..29ccf44 100755 --- a/src/client/player/LocalPlayer.cpp +++ b/src/client/player/LocalPlayer.cpp @@ -355,7 +355,11 @@ LocalPlayer::LocalPlayer(Minecraft* minecraft, Level* level, const std::string& armorTypeHash(0), sprinting(false), sprintDoubleTapTimer(0), - prevForwardHeld(false) + prevForwardHeld(false), + xBob(0.0f), + yBob(0.0f), + xBobO(0.0f), + yBobO(0.0f) { this->dimension = dimension; _init(); @@ -388,6 +392,12 @@ void LocalPlayer::calculateFlight(float xa, float ya, float za) { ya = 0; za = za * flySpeed; + if (sprinting) { + float sprintBoost = getWalkingSpeedModifier(); // 1.3x + xa *= sprintBoost; + za *= sprintBoost; + } + #ifdef ANDROID if (Keyboard::isKeyDown(103)) ya = .2f * flySpeed; if (Keyboard::isKeyDown(102)) ya = -.2f * flySpeed; @@ -450,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); } } @@ -506,7 +516,7 @@ void LocalPlayer::aiStep() { if (sprintDoubleTapTimer > 0) sprintDoubleTapTimer--; prevForwardHeld = forwardHeld; } - if (input->sneaking || abilities.flying) + if (input->sneaking) sprinting = false; if (input->sneaking) { @@ -544,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(); @@ -760,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 e027624..aa0b956 100755 --- a/src/client/player/LocalPlayer.h +++ b/src/client/player/LocalPlayer.h @@ -22,6 +22,10 @@ public: 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(); diff --git a/src/client/player/input/KeyboardInput.cpp b/src/client/player/input/KeyboardInput.cpp index 674838d..b84fe75 100755 --- a/src/client/player/input/KeyboardInput.cpp +++ b/src/client/player/input/KeyboardInput.cpp @@ -50,10 +50,8 @@ void KeyboardInput::tick( Player* player ) ya *= 0.3f; } - #if defined(RPI) || defined(PLATFORM_DESKTOP) - 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/touchscreen/TouchscreenInput.cpp b/src/client/player/input/touchscreen/TouchscreenInput.cpp index 41474f3..37cb6d8 100755 --- a/src/client/player/input/touchscreen/TouchscreenInput.cpp +++ b/src/client/player/input/touchscreen/TouchscreenInput.cpp @@ -164,7 +164,7 @@ void TouchscreenInput_TestFps::onConfigChanged(const Config& c) { float maxPixels = _minecraft->pixelCalc.millimetersToPixels(10); // float btnSize = Mth::Min(18 * Gui::GuiScale, maxPixels); - float btnSize = pc.millimetersToPixels(50); + 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)); @@ -320,6 +320,7 @@ void TouchscreenInput_TestFps::tick( Player* player ) if (Multitouch::isReleased(p)) { _minecraft->soundEngine->playUI("random.click", 1, 1); _minecraft->screenChooser.setScreen(SCREEN_CONSOLE); + _minecraft->platform()->showKeyboard(); } } diff --git a/src/client/renderer/Chunk.cpp b/src/client/renderer/Chunk.cpp index 13ac27c..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; @@ -259,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 ca9d388..3ea22a0 100755 --- a/src/client/renderer/GameRenderer.cpp +++ b/src/client/renderer/GameRenderer.cpp @@ -1,7 +1,7 @@ #include "GameRenderer.h" #include "client/Options.h" #include "gles.h" - +#include "Lighting.h" #include "../../util/PerfTimer.h" #include "LevelRenderer.h" @@ -32,7 +32,7 @@ static int _shTicks = -1; GameRenderer::GameRenderer( Minecraft* mc ) -: mc(mc), + : mc(mc), renderDistance(0), _tick(0), _lastTickT(0), @@ -90,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.getIntValue(OPTIONS_VIEW_DISTANCE))); + renderDistance = (float) (16 * 16 >> (mc->options.getIntValue(OPTIONS_VIEW_DISTANCE))); #if defined(ANDROID) - if (mc->isPowerVR() && mc->options.getIntValue(OPTIONS_VIEW_DISTANCE) <= 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.getBooleanValue(OPTIONS_ANAGLYPH_3D)) 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.getBooleanValue(OPTIONS_ANAGLYPH_3D)) 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.getBooleanValue(OPTIONS_VIEW_BOBBING)) bobView(a); - moveCameraToPlayer(a); } @@ -125,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.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; + 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; @@ -141,20 +151,20 @@ void GameRenderer::render(float a) { _rotX += xo; _rotY += yo; - int yAxis = -1; - if (mc->options.getBooleanValue(OPTIONS_INVERT_Y_MOUSE)) 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); @@ -164,7 +174,6 @@ void GameRenderer::render(float a) { yMouse = -9999; } } -#endif TIMER_POP(); bool hasClearedColorBuffer = false; @@ -174,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.getBooleanValue(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); @@ -210,26 +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); - 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); - } + 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; @@ -238,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.getBooleanValue(OPTIONS_ANAGLYPH_3D)) { - 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.getBooleanValue(OPTIONS_FANCY_GRAPHICS)) { - 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.getBooleanValue(OPTIONS_AMBIENT_OCCLUSION)) { - 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.getBooleanValue(OPTIONS_FANCY_GRAPHICS)) { + 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 && !mc->options.getBooleanValue(OPTIONS_HIDEGUI)) { + 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.getBooleanValue(OPTIONS_ANAGLYPH_3D)) { + if (!mc->options.getBooleanValue(OPTIONS_ANAGLYPH_3D)) { TIMER_POP(); - return; - } - } - glColorMask(true, true, true, false); + return; + } + } + glColorMask(true, true, true, false); TIMER_POP(); } @@ -401,34 +433,34 @@ 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()) { @@ -446,284 +478,282 @@ void GameRenderer::moveCameraToPlayer(float a) { glRotatef(player->xRotO + (player->xRot - player->xRotO) * a, -1, 0, 0); } } else if (mc->options.getBooleanValue(OPTIONS_THIRD_PERSON_VIEW)/* || (player->isPlayer() && !player->isAlive())*/) { - float cameraDist = thirdDistanceO + (thirdDistance - thirdDistanceO) * a; + float cameraDist = thirdDistanceO + (thirdDistance - thirdDistanceO) * a; - if (mc->options.getBooleanValue(OPTIONS_FIXED_CAMERA)) { + 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.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 (!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.getBooleanValue(OPTIONS_THIRD_PERSON_VIEW); - 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.getBooleanValue(OPTIONS_IS_JOY_TOUCH_AREA); -#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); @@ -734,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; } } } @@ -759,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.getIntValue(OPTIONS_VIEW_DISTANCE)) / 3.0f; - float fogBrT = brr * (1 - whiteness) + whiteness; - fogBr += (fogBrT - fogBr) * 0.1f; + 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.getIntValue(OPTIONS_VIEW_DISTANCE)); - 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.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); + 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 ) @@ -867,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); @@ -880,15 +910,15 @@ void GameRenderer::setupGuiScreen( bool clearColorBuffer ) /*private*/ void GameRenderer::renderItemInHand(float a, int eye) { - glLoadIdentity2(); - if (mc->options.getBooleanValue(OPTIONS_ANAGLYPH_3D)) 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.getBooleanValue(OPTIONS_VIEW_BOBBING)) bobView(a); + glPushMatrix2(); + bobHurt(a); + if (mc->options.getBooleanValue(OPTIONS_VIEW_BOBBING)) bobView(a); - if (!mc->options.getBooleanValue(OPTIONS_THIRD_PERSON_VIEW) && (mc->cameraTargetPlayer->isPlayer() && !((Player*)mc->cameraTargetPlayer)->isSleeping())) { - if (!mc->options.getBooleanValue(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); @@ -896,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.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); + 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() @@ -915,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 f279a9c..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(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 3520732..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(); } @@ -155,14 +183,27 @@ void LevelRenderer::allChanged() 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; /* @@ -227,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 ) @@ -301,6 +342,48 @@ int LevelRenderer::render( Mob* player, int layer, float alpha ) 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; @@ -488,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); @@ -569,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(); } @@ -724,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++; } @@ -911,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); @@ -966,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); @@ -980,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.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); + 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); @@ -1033,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); @@ -1072,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"); } */ @@ -1192,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); @@ -1234,6 +1613,7 @@ void LevelRenderer::renderHitSelect( Player* player, const HitResult& h, int mod void LevelRenderer::onGraphicsReset() { + generateStars(); generateSky(); // Get new buffers @@ -1289,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 dedaca3..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), @@ -97,9 +97,9 @@ RenderChunk Tesselator::end( bool useMine, int bufferId ) int access = GL_STATIC_DRAW;//(accessMode==ACCESS_DYNAMIC) ? GL_DYNAMIC_DRAW : GL_STATIC_DRAW; glBindBuffer2(GL_ARRAY_BUFFER, bufferId); glBufferData2(GL_ARRAY_BUFFER, bytes, _varray, access); // GL_STREAM_DRAW - + totalSize += bytes; - + #ifndef USE_VBO // 0 1 2 3 4 5 6 7 // x y z u v c @@ -112,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); @@ -278,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; @@ -301,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); @@ -332,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 ) { @@ -389,7 +397,7 @@ void Tesselator::draw() vboId = 0; int bufferId = vboIds[vboId]; - + int access = GL_DYNAMIC_DRAW;//(accessMode==ACCESS_DYNAMIC) ? GL_DYNAMIC_DRAW : GL_STATIC_DRAW; glBindBuffer2(GL_ARRAY_BUFFER, bufferId); glBufferData2(GL_ARRAY_BUFFER, bytes, _varray, access); // GL_STREAM_DRAW @@ -404,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); @@ -421,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/Textures.cpp b/src/client/renderer/Textures.cpp index 9fce411..b4b1676 100755 --- a/src/client/renderer/Textures.cpp +++ b/src/client/renderer/Textures.cpp @@ -249,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 a98e82b..e61334c 100755 --- a/src/client/renderer/TileRenderer.cpp +++ b/src/client/renderer/TileRenderer.cpp @@ -13,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), @@ -57,6 +60,11 @@ 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; @@ -100,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; } @@ -108,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; } @@ -116,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; } @@ -124,6 +144,10 @@ 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; } @@ -147,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) { @@ -222,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; @@ -685,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 ) @@ -924,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))) { @@ -977,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))) { @@ -1029,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))) { @@ -1082,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; @@ -1089,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); @@ -1214,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) { @@ -2036,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(); @@ -2067,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); + } } @@ -2196,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 a3148fc..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, 0, 64, 64), 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/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/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 6a773f0..93685fd 100755 --- a/src/client/renderer/entity/PlayerRenderer.cpp +++ b/src/client/renderer/entity/PlayerRenderer.cpp @@ -17,8 +17,8 @@ PlayerRenderer::PlayerRenderer( HumanoidModel* humanoidModel, float shadow ) : super(humanoidModel, shadow), playerModel64(humanoidModel), playerModel32(new HumanoidModel(0, 0, 64, 32)), - armorParts1(new HumanoidModel(1.0f, 0, 64, 64)), - armorParts2(new HumanoidModel(0.5f, 0, 64, 64)) + 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; @@ -70,17 +70,22 @@ void PlayerRenderer::renderName( Mob* mob, float x, float y, float z ){ } } -void PlayerRenderer::render(Entity* mob_, float x, float y, float z, float rot, float a) { - Mob* mob = (Mob*) mob_; +// @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; } - // 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")); +} + +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); } diff --git a/src/client/renderer/entity/PlayerRenderer.h b/src/client/renderer/entity/PlayerRenderer.h index d4b25e2..1105c4b 100755 --- a/src/client/renderer/entity/PlayerRenderer.h +++ b/src/client/renderer/entity/PlayerRenderer.h @@ -19,6 +19,8 @@ public: virtual void renderName(Mob* mob, float x, float y, float z); virtual void onGraphicsReset(); + + void setModernSkin(Mob* mob); private: HumanoidModel* playerModel32; HumanoidModel* playerModel64; diff --git a/src/client/renderer/gles.cpp b/src/client/renderer/gles.cpp index 04ae3d3..df44d20 100755 --- a/src/client/renderer/gles.cpp +++ b/src/client/renderer/gles.cpp @@ -115,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 7b7e4fd..a82c35c 100755 --- a/src/client/renderer/gles.h +++ b/src/client/renderer/gles.h @@ -4,21 +4,25 @@ #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) #define USE_VBO #define GL_QUADS 0x0007 #if defined(__APPLE__) - #import - #import + #import + #import #elif defined(ANDROID) || defined(__EMSCRIPTEN__) - #include - #include + #import + #import #else #include @@ -55,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 @@ -114,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 @@ -137,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 62f3db0..46ee97b 100755 --- a/src/client/sound/Sound.h +++ b/src/client/sound/Sound.h @@ -172,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 0af6d43..2f847fb 100755 --- a/src/client/sound/SoundEngine.cpp +++ b/src/client/sound/SoundEngine.cpp @@ -144,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 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_android_java.cpp b/src/main_android_java.cpp index c89ae03..d407ba7 100755 --- a/src/main_android_java.cpp +++ b/src/main_android_java.cpp @@ -220,16 +220,23 @@ static int androidKeyToInternal(int androidKey) { JNIEXPORT void JNICALL Java_com_mojang_minecraftpe_MainActivity_nativeOnKeyDown(JNIEnv* env, jclass cls, jint keyCode) { LOGI("@nativeOnKeyDown: %d\n", keyCode); - int mapped = androidKeyToInternal(keyCode); - Keyboard::feed(mapped, 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 - if (unicodeChar == 8) { + // 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) { + } else*/ if (unicodeChar > 0 && unicodeChar < 128) { Keyboard::feedText((char)unicodeChar); } } diff --git a/src/main_dedicated.cpp b/src/main_dedicated.cpp index 8aa14cb..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,36 +31,175 @@ 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(); @@ -67,7 +210,31 @@ int main(int numArguments, char* pszArgs[]) { //pthread_yield(); 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; diff --git a/src/main_glfw.h b/src/main_glfw.h index 2b5bb97..042c9fb 100755 --- a/src/main_glfw.h +++ b/src/main_glfw.h @@ -139,12 +139,14 @@ int main(void) { #ifndef STANDALONE_SERVER // Platform init. appContext.platform = new AppPlatform_glfw(); -#if defined(DEBUG) && defined(__EMSCRIPTEN__) - EM_ASM({ - console.log(FS.readdir("/")); - console.log(FS.readdir("/data")); - console.log(FS.readdir("/data/images")); - }); +#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); diff --git a/src/network/ClientSideNetworkHandler.cpp b/src/network/ClientSideNetworkHandler.cpp index d754b47..e2b8150 100755 --- a/src/network/ClientSideNetworkHandler.cpp +++ b/src/network/ClientSideNetworkHandler.cpp @@ -1,6 +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" @@ -10,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 @@ -42,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(); } @@ -59,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++; } @@ -67,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(); } @@ -86,7 +93,7 @@ void ClientSideNetworkHandler::onConnect(const RakNet::RakNetGUID& hostGuid) serverGuid = hostGuid; clearChunksLoaded(); - LoginPacket packet(minecraft->options.getStringValue(OPTIONS_USERNAME).c_str(), SharedConstants::NetworkProtocolVersion); + LoginPacket packet(minecraft->options.getStringValue(OPTIONS_USERNAME).c_str(), SharedConstants::NetworkProtocolVersion, true); raknetInstance->send(packet); } @@ -97,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) { @@ -109,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) { @@ -130,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 } } @@ -146,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); @@ -182,7 +223,7 @@ void ClientSideNetworkHandler::handle(const RakNet::RakNetGUID& source, SetTimeP if (!level) return; - LOGI("SetTimePacket\n"); + // LOGI("SetTimePacket\n"); level->setTime(packet->time); } @@ -238,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"); @@ -324,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); @@ -344,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); @@ -386,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) @@ -475,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); @@ -496,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++) @@ -531,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(); @@ -579,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()) { @@ -627,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) @@ -728,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) { @@ -782,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) { } @@ -791,6 +888,7 @@ void ClientSideNetworkHandler::handle(const RakNet::RakNetGUID& source, SetHealt if (!level || !minecraft->player) return; + printf("SetHealthPacket \n"); minecraft->player->hurtTo(packet->health); } @@ -886,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 } @@ -919,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 7736908..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,9 +155,37 @@ 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) { - displayGameMessage(packet->message); + 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) @@ -156,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); @@ -179,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); @@ -199,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); @@ -228,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); @@ -244,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) @@ -301,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 /* @@ -338,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); + } } @@ -368,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) @@ -403,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 ) @@ -429,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) { @@ -455,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); } @@ -466,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(); @@ -506,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)]; @@ -522,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 @@ -533,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"); @@ -544,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); } @@ -577,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; @@ -592,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; @@ -612,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; @@ -619,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()); @@ -635,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 ) @@ -657,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; @@ -713,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 51531cf..c1cb632 100755 --- a/src/network/ServerSideNetworkHandler.h +++ b/src/network/ServerSideNetworkHandler.h @@ -58,7 +58,10 @@ public: 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); @@ -70,6 +73,12 @@ 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); Minecraft* minecraft; 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/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/StartGamePacket.h b/src/network/packet/StartGamePacket.h index 24adead..f2ce50f 100755 --- a/src/network/packet/StartGamePacket.h +++ b/src/network/packet/StartGamePacket.h @@ -2,6 +2,7 @@ #define NET_MINECRAFT_NETWORK_PACKET__StartGamePacket_H__ #include "../Packet.h" +#include "world/level/LevelConstants.h" #include class StartGamePacket : public Packet @@ -14,18 +15,20 @@ public: 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) + 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) { } @@ -40,6 +43,7 @@ public: bitStream->Write(x); bitStream->Write(y); bitStream->Write(z); + bitStream->Write(LevelConstants::CHUNK_CACHE_WIDTH); } void read(RakNet::BitStream* bitStream) @@ -51,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/audio/SoundSystemAL.cpp b/src/platform/audio/SoundSystemAL.cpp index 7ea7289..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); 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/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 ad3b4a9..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), _prevHealth(-999), - _containerCounter(0) + _containerCounter(0), + isNewProto(proto) { - hasFakeInventory = true; + // hasFakeInventory = true; footSize = 0; } @@ -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 de20661..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,6 +43,17 @@ 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 ); @@ -50,6 +61,11 @@ private: Minecraft* _mc; 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/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 53cf3cd..f4ed974 100755 --- a/src/util/PerfTimer.h +++ b/src/util/PerfTimer.h @@ -6,7 +6,7 @@ #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) @@ -16,11 +16,11 @@ // #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 +//#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/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 cc784f0..726f444 100755 --- a/src/world/entity/Mob.cpp +++ b/src/world/entity/Mob.cpp @@ -169,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; @@ -177,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(); @@ -210,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(); @@ -423,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; @@ -433,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; @@ -471,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 { @@ -729,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; @@ -879,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 7e90196..40ee980 100755 --- a/src/world/entity/Mob.h +++ b/src/world/entity/Mob.h @@ -52,6 +52,7 @@ public: virtual bool isPickable(); virtual bool isPushable(); + virtual bool isOnFire(); virtual bool isShootable(); MoveControl* getMoveControl(); @@ -126,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); @@ -223,6 +226,9 @@ protected: 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; } 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 5a46535..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 @@ -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 96255eb..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,16 +2250,16 @@ 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), 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/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 7ef40e3..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,274 +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); - } + } - // 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); - } + // @todo - add generation options to enable or disable adjusted ore spawn rates as they affect seed parity with the original vanilla game - shredder - // 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); - } + // 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); + } - // 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); - } + // 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); + } - // 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); - } + // 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); + } - // 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); - } + // 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); + } - // 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); - } + // 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); + } - 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; + // 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); + } - 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) { + 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) { 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) { @@ -498,22 +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); // Carve caves into the chunk caveFeature.apply(this, level, xOffs, zOffs, blocks, LevelChunk::ChunkBlockCount); - levelChunk->recalcHeightmap(); + canyonFeature.apply(this, level, xOffs, zOffs, blocks, LevelChunk::ChunkBlockCount); + levelChunk->recalcHeightmap(); - return levelChunk; + return levelChunk; } /*private*/ @@ -523,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; } @@ -675,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 91bcf45..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" @@ -88,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(); @@ -113,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; @@ -141,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) @@ -275,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; @@ -294,14 +362,14 @@ void ExternalFileLevelStorage::tick() 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) { @@ -347,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); @@ -385,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) @@ -417,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/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 7aea82f..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,7 +165,7 @@ void DoorTile::neighborChanged(Level* level, int x, int y, int z, int type) { } } if (spawn) { - if (!level->isClientSide) { + if (!level->isClientSide && level->getLevelData()->getGameType() != GameType::Creative) { // use default chance (1.0) so the drop always occurs spawnResources(level, x, y, z, data); } @@ -193,7 +194,7 @@ int DoorTile::getResource(int data, Random* random) { // itself never drops anything and playerDestroy suppresses spawning // from the top. This prevents duplicate drops if the bottom half is // mined. - if ((data & UPPER_BIT) != 0) return 0; + if ((data & C_IS_UPPER_MASK) != 0) return 0; if (material == Material::metal) return Item::door_iron->id; return Item::door_wood->id; } @@ -205,7 +206,7 @@ HitResult DoorTile::clip(Level* level, int xt, int yt, int zt, const Vec3& a, co // 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 & UPPER_BIT) == 0) { + if ((data & C_IS_UPPER_MASK) == 0) { // only let the lower half handle the actual spawning super::playerDestroy(level, player, x, y, z, data); } @@ -225,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 250d274..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; 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 f55c12d..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());