Compare commits
19 Commits
main
...
8615e8ae9f
| Author | SHA1 | Date | |
|---|---|---|---|
| 8615e8ae9f | |||
| d88e57f0aa | |||
|
|
958eaab5c4 | ||
|
|
c4934cb19b | ||
| 8f05d4269b | |||
| 8c5f98b60b | |||
| d8961ef83f | |||
| 0099ed531d | |||
| 3158f603e2 | |||
| dc5f5d1977 | |||
| 71a8a099ea | |||
| d075fb42a2 | |||
| 95f4703516 | |||
| 5c1aa7fdaa | |||
| bceac853da | |||
| b0d8027295 | |||
| b4aa4a220c | |||
| e22e1014f4 | |||
| b4553eb39b |
31
.github/workflows/build.yml
vendored
@@ -216,6 +216,16 @@ jobs:
|
|||||||
distribution: temurin
|
distribution: temurin
|
||||||
java-version: 25
|
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
|
- name: Run Android build script
|
||||||
run: |
|
run: |
|
||||||
chmod +x ./build.sh
|
chmod +x ./build.sh
|
||||||
@@ -312,10 +322,17 @@ jobs:
|
|||||||
files: mcpe-linux/MinecraftPE-server
|
files: mcpe-linux/MinecraftPE-server
|
||||||
dest: minecraftpe-server-${{ steps.ref.outputs.hash }}.zip
|
dest: minecraftpe-server-${{ steps.ref.outputs.hash }}.zip
|
||||||
|
|
||||||
- name: Rename Android Artifacts
|
- name: Zip Android arm64-v8a Artifact
|
||||||
run: |
|
uses: vimtor/action-zip@v1.2
|
||||||
mv minecraftpe-apk-arm64-v8a/minecraftpe-v8a-debug.apk minecraftpe-${{ steps.ref.outputs.hash }}-android-arm64-v8a.apk
|
with:
|
||||||
mv minecraftpe-apk-armeabi-v7a/minecraftpe-v7a-debug.apk minecraftpe-${{ steps.ref.outputs.hash }}-android-armeabi-v7a.apk
|
files: minecraftpe-apk-arm64-v8a/minecraftpe-v8a-debug.apk
|
||||||
|
dest: minecraftpe-${{ steps.ref.outputs.hash }}-android-arm64-v8a.zip
|
||||||
|
|
||||||
|
- name: Zip Android armeabi-v7a Artifact
|
||||||
|
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
|
||||||
|
|
||||||
- name: Zip Web Artifact
|
- name: Zip Web Artifact
|
||||||
uses: vimtor/action-zip@v1.2
|
uses: vimtor/action-zip@v1.2
|
||||||
@@ -341,9 +358,9 @@ jobs:
|
|||||||
MinecraftPE development release for commit ${{ github.sha }}.
|
MinecraftPE development release for commit ${{ github.sha }}.
|
||||||
files: |
|
files: |
|
||||||
./data.zip
|
./data.zip
|
||||||
./minecraftpe-server-${{ steps.ref.outputs.hash }}.zip
|
|
||||||
./minecraftpe-${{ steps.ref.outputs.hash }}-windows.zip
|
./minecraftpe-${{ steps.ref.outputs.hash }}-windows.zip
|
||||||
./minecraftpe-${{ steps.ref.outputs.hash }}-linux.zip
|
./minecraftpe-${{ steps.ref.outputs.hash }}-linux.zip
|
||||||
./minecraftpe-${{ steps.ref.outputs.hash }}-android-arm64-v8a.apk
|
./minecraftpe-server-${{ steps.ref.outputs.hash }}.zip
|
||||||
./minecraftpe-${{ steps.ref.outputs.hash }}-android-armeabi-v7a.apk
|
./minecraftpe-${{ steps.ref.outputs.hash }}-android-arm64-v8a.zip
|
||||||
|
./minecraftpe-${{ steps.ref.outputs.hash }}-android-armeabi-v7a.zip
|
||||||
./minecraftpe-${{ steps.ref.outputs.hash }}-web.zip
|
./minecraftpe-${{ steps.ref.outputs.hash }}-web.zip
|
||||||
|
|||||||
@@ -166,7 +166,6 @@ file(GLOB SERVER_SOURCES
|
|||||||
"src/util/Mth.cpp"
|
"src/util/Mth.cpp"
|
||||||
"src/util/PerfTimer.cpp"
|
"src/util/PerfTimer.cpp"
|
||||||
"src/util/StringUtils.cpp"
|
"src/util/StringUtils.cpp"
|
||||||
"src/util/Color.cpp"
|
|
||||||
|
|
||||||
"src/world/Direction.cpp"
|
"src/world/Direction.cpp"
|
||||||
|
|
||||||
@@ -200,9 +199,6 @@ file(GLOB SERVER_SOURCES
|
|||||||
|
|
||||||
"src/world/level/dimension/Dimension.cpp"
|
"src/world/level/dimension/Dimension.cpp"
|
||||||
|
|
||||||
"src/world/level/dimension/FoliageColor.cpp"
|
|
||||||
"src/world/level/GrassColor.cpp"
|
|
||||||
|
|
||||||
"src/world/level/levelgen/*.cpp"
|
"src/world/level/levelgen/*.cpp"
|
||||||
"src/world/level/levelgen/feature/Feature.cpp"
|
"src/world/level/levelgen/feature/Feature.cpp"
|
||||||
"src/world/level/levelgen/synth/*.cpp"
|
"src/world/level/levelgen/synth/*.cpp"
|
||||||
@@ -262,8 +258,6 @@ file(GLOB CLIENT_SOURCES
|
|||||||
|
|
||||||
"src/util/**.cpp"
|
"src/util/**.cpp"
|
||||||
|
|
||||||
"src/util/Color.cpp"
|
|
||||||
|
|
||||||
"src/world/*.cpp"
|
"src/world/*.cpp"
|
||||||
"src/world/phys/*.cpp"
|
"src/world/phys/*.cpp"
|
||||||
"src/world/entity/*.cpp"
|
"src/world/entity/*.cpp"
|
||||||
@@ -312,7 +306,6 @@ if(UNIX)
|
|||||||
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
|
target_include_directories("${PROJECT_NAME}-server" PUBLIC
|
||||||
"${CMAKE_SOURCE_DIR}/glad/include/"
|
|
||||||
"${CMAKE_SOURCE_DIR}/src/"
|
"${CMAKE_SOURCE_DIR}/src/"
|
||||||
"project/lib_projects/raknet/jni/RaknetSources"
|
"project/lib_projects/raknet/jni/RaknetSources"
|
||||||
)
|
)
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
|
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 25 KiB |
|
Before Width: | Height: | Size: 868 B |
|
Before Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 306 B |
|
Before Width: | Height: | Size: 910 B |
|
Before Width: | Height: | Size: 799 B |
@@ -153,32 +153,7 @@ options.group.tweaks=Tweaks
|
|||||||
options.allowSprint=Allow sprint
|
options.allowSprint=Allow sprint
|
||||||
options.barOnTop=HUD above inventory
|
options.barOnTop=HUD above inventory
|
||||||
options.rpiCursor=Show Raspberry PI cursor
|
options.rpiCursor=Show Raspberry PI cursor
|
||||||
options.foliagetint=Foliage Tinting
|
options.foliageTint=Tint Grass and Leaves
|
||||||
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.autoJump=Auto Jump
|
||||||
options.thirdperson=Third Person
|
options.thirdperson=Third Person
|
||||||
options.servervisible=Server Visible
|
options.servervisible=Server Visible
|
||||||
@@ -229,12 +204,6 @@ options.fancyGraphics=Fancy graphics
|
|||||||
options.renderDebug=Debug render
|
options.renderDebug=Debug render
|
||||||
options.anaglyph3d=3D anaglyph
|
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.max=Max FPS
|
||||||
performance.balanced=Balanced
|
performance.balanced=Balanced
|
||||||
|
|||||||
@@ -98,7 +98,6 @@ LOCAL_SRC_FILES := ../../../src/main.cpp \
|
|||||||
../../../src/client/player/RemotePlayer.cpp \
|
../../../src/client/player/RemotePlayer.cpp \
|
||||||
../../../src/client/player/input/KeyboardInput.cpp \
|
../../../src/client/player/input/KeyboardInput.cpp \
|
||||||
../../../src/client/player/input/touchscreen/TouchscreenInput.cpp \
|
../../../src/client/player/input/touchscreen/TouchscreenInput.cpp \
|
||||||
../../../src/client/renderer/Lighting.cpp \
|
|
||||||
../../../src/client/renderer/Chunk.cpp \
|
../../../src/client/renderer/Chunk.cpp \
|
||||||
../../../src/client/renderer/EntityTileRenderer.cpp \
|
../../../src/client/renderer/EntityTileRenderer.cpp \
|
||||||
../../../src/client/renderer/GameRenderer.cpp \
|
../../../src/client/renderer/GameRenderer.cpp \
|
||||||
@@ -147,7 +146,6 @@ LOCAL_SRC_FILES := ../../../src/main.cpp \
|
|||||||
../../../src/util/StringUtils.cpp \
|
../../../src/util/StringUtils.cpp \
|
||||||
../../../src/util/PerfTimer.cpp \
|
../../../src/util/PerfTimer.cpp \
|
||||||
../../../src/util/PerfRenderer.cpp \
|
../../../src/util/PerfRenderer.cpp \
|
||||||
../../../src/util/Color.cpp \
|
|
||||||
../../../src/world/Direction.cpp \
|
../../../src/world/Direction.cpp \
|
||||||
../../../src/world/entity/AgableMob.cpp \
|
../../../src/world/entity/AgableMob.cpp \
|
||||||
../../../src/world/entity/Entity.cpp \
|
../../../src/world/entity/Entity.cpp \
|
||||||
|
|||||||
@@ -75,7 +75,6 @@ LOCAL_SRC_FILES := ../../../src/main.cpp \
|
|||||||
../../../src/client/player/RemotePlayer.cpp \
|
../../../src/client/player/RemotePlayer.cpp \
|
||||||
../../../src/client/player/input/KeyboardInput.cpp \
|
../../../src/client/player/input/KeyboardInput.cpp \
|
||||||
../../../src/client/player/input/touchscreen/TouchscreenInput.cpp \
|
../../../src/client/player/input/touchscreen/TouchscreenInput.cpp \
|
||||||
../../../src/client/renderer/Lighting.cpp \
|
|
||||||
../../../src/client/renderer/Chunk.cpp \
|
../../../src/client/renderer/Chunk.cpp \
|
||||||
../../../src/client/renderer/EntityTileRenderer.cpp \
|
../../../src/client/renderer/EntityTileRenderer.cpp \
|
||||||
../../../src/client/renderer/GameRenderer.cpp \
|
../../../src/client/renderer/GameRenderer.cpp \
|
||||||
@@ -123,7 +122,6 @@ LOCAL_SRC_FILES := ../../../src/main.cpp \
|
|||||||
../../../src/util/StringUtils.cpp \
|
../../../src/util/StringUtils.cpp \
|
||||||
../../../src/util/PerfTimer.cpp \
|
../../../src/util/PerfTimer.cpp \
|
||||||
../../../src/util/PerfRenderer.cpp \
|
../../../src/util/PerfRenderer.cpp \
|
||||||
../../../src/util/Color.cpp \
|
|
||||||
../../../src/world/Direction.cpp \
|
../../../src/world/Direction.cpp \
|
||||||
../../../src/world/entity/AgableMob.cpp \
|
../../../src/world/entity/AgableMob.cpp \
|
||||||
../../../src/world/entity/Entity.cpp \
|
../../../src/world/entity/Entity.cpp \
|
||||||
|
|||||||
@@ -129,7 +129,6 @@ public class SoundPlayer
|
|||||||
new SoundId(R.raw.eat1, "random.eat"),
|
new SoundId(R.raw.eat1, "random.eat"),
|
||||||
new SoundId(R.raw.eat2, "random.eat"),
|
new SoundId(R.raw.eat2, "random.eat"),
|
||||||
new SoundId(R.raw.eat3, "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.fuse, "random.fuse"),
|
||||||
|
|
||||||
new SoundId(R.raw.zpig1, "mob.zombiepig.zpig"),
|
new SoundId(R.raw.zpig1, "mob.zombiepig.zpig"),
|
||||||
|
|||||||
@@ -1173,14 +1173,6 @@
|
|||||||
F99D344C2F7370CF00DC153E /* 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 */; };
|
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 */; };
|
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 */; };
|
|
||||||
BEEF202614CFF670005F0002 /* Lighting.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BEEF202614CFF670005F0001 /* Lighting.cpp */; };
|
|
||||||
BEEF202614CFF670005F0003 /* Lighting.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BEEF202614CFF670005F0001 /* Lighting.cpp */; };
|
|
||||||
/* End PBXBuildFile section */
|
/* End PBXBuildFile section */
|
||||||
|
|
||||||
/* Begin PBXFileReference section */
|
/* Begin PBXFileReference section */
|
||||||
@@ -2443,8 +2435,8 @@
|
|||||||
F99D341D2F736AA100DC153E /* HttpClient.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = HttpClient.h; path = ../../src/platform/HttpClient.h; sourceTree = "<group>"; };
|
F99D341D2F736AA100DC153E /* HttpClient.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = HttpClient.h; path = ../../src/platform/HttpClient.h; sourceTree = "<group>"; };
|
||||||
F99D341E2F736AA100DC153E /* HttpClient.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = HttpClient.cpp; path = ../../src/platform/HttpClient.cpp; sourceTree = "<group>"; };
|
F99D341E2F736AA100DC153E /* HttpClient.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = HttpClient.cpp; path = ../../src/platform/HttpClient.cpp; sourceTree = "<group>"; };
|
||||||
F99D34212F736AD400DC153E /* TextOption.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = TextOption.h; path = ../../src/client/gui/components/TextOption.h; sourceTree = "<group>"; };
|
F99D34212F736AD400DC153E /* TextOption.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = TextOption.h; path = ../../src/client/gui/components/TextOption.h; sourceTree = "<group>"; };
|
||||||
F99D34222F736AD400DC153E /* TextOption.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = TextOption.cpp; path = ../../src/client/gui/components/TextOption.cpp; sourceTree = "<unknown>"; };
|
F99D34222F736AD400DC153E /* TextOption.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = TextOption.cpp; path = ../../src/client/gui/components/TextOption.cpp; };
|
||||||
F99D34252F736AFB00DC153E /* OptionsFile.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = OptionsFile.h; path = ../../src/client/OptionsFile.h; sourceTree = "<group>"; };
|
F99D34252F736AFB00DC153E /* OptionsFile.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = OptionsFile.h; path = ../../src/client/OptionsFile.h; sourceTree = "<group>"; sourceTree = "<group>"; };
|
||||||
F99D34262F736AFB00DC153E /* OptionsFile.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = OptionsFile.cpp; path = ../../src/client/OptionsFile.cpp; sourceTree = "<group>"; };
|
F99D34262F736AFB00DC153E /* OptionsFile.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = OptionsFile.cpp; path = ../../src/client/OptionsFile.cpp; sourceTree = "<group>"; };
|
||||||
F99D34292F736B6F00DC153E /* OptionsItem.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = OptionsItem.h; path = ../../src/client/gui/components/OptionsItem.h; sourceTree = "<group>"; };
|
F99D34292F736B6F00DC153E /* OptionsItem.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = OptionsItem.h; path = ../../src/client/gui/components/OptionsItem.h; sourceTree = "<group>"; };
|
||||||
F99D342A2F736B6F00DC153E /* OptionsItem.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = OptionsItem.cpp; path = ../../src/client/gui/components/OptionsItem.cpp; sourceTree = "<group>"; };
|
F99D342A2F736B6F00DC153E /* OptionsItem.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = OptionsItem.cpp; path = ../../src/client/gui/components/OptionsItem.cpp; sourceTree = "<group>"; };
|
||||||
@@ -2465,10 +2457,6 @@
|
|||||||
F99D34492F7370CF00DC153E /* Slider.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = Slider.h; path = ../../src/client/gui/components/Slider.h; sourceTree = "<group>"; };
|
F99D34492F7370CF00DC153E /* Slider.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = Slider.h; path = ../../src/client/gui/components/Slider.h; sourceTree = "<group>"; };
|
||||||
F99D344A2F7370CF00DC153E /* Slider.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = Slider.cpp; path = ../../src/client/gui/components/Slider.cpp; sourceTree = "<group>"; };
|
F99D344A2F7370CF00DC153E /* Slider.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = Slider.cpp; path = ../../src/client/gui/components/Slider.cpp; sourceTree = "<group>"; };
|
||||||
F99D344D2F7372A100DC153E /* Launch Screen.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = "Launch Screen.storyboard"; sourceTree = "<group>"; };
|
F99D344D2F7372A100DC153E /* Launch Screen.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = "Launch Screen.storyboard"; sourceTree = "<group>"; };
|
||||||
F99F0FA82F84369F00F2B29A /* GrassColor.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = GrassColor.cpp; sourceTree = "<group>"; };
|
|
||||||
F99F0FAB2F8436CE00F2B29A /* FoliageColor.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = FoliageColor.cpp; sourceTree = "<group>"; };
|
|
||||||
F99F0FAE2F8436EB00F2B29A /* Color.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = Color.cpp; sourceTree = "<group>"; };
|
|
||||||
BEEF202614CFF670005F0001 /* Lighting.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Lighting.cpp; path = Lighting.cpp; sourceTree = "<group>"; };
|
|
||||||
/* End PBXFileReference section */
|
/* End PBXFileReference section */
|
||||||
|
|
||||||
/* Begin PBXFrameworksBuildPhase section */
|
/* Begin PBXFrameworksBuildPhase section */
|
||||||
@@ -3536,7 +3524,6 @@
|
|||||||
D5B50CF114CFF66F005F7284 /* TileRenderer.cpp */,
|
D5B50CF114CFF66F005F7284 /* TileRenderer.cpp */,
|
||||||
D5B50CF214CFF66F005F7284 /* TileRenderer.h */,
|
D5B50CF214CFF66F005F7284 /* TileRenderer.h */,
|
||||||
D5B50CF314CFF66F005F7284 /* VertecDecl.h */,
|
D5B50CF314CFF66F005F7284 /* VertecDecl.h */,
|
||||||
BEEF202614CFF670005F0001 /* Lighting.cpp */,
|
|
||||||
);
|
);
|
||||||
path = renderer;
|
path = renderer;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@@ -3774,7 +3761,6 @@
|
|||||||
D5B50E6914CFF66F005F7284 /* StringUtils.cpp */,
|
D5B50E6914CFF66F005F7284 /* StringUtils.cpp */,
|
||||||
D5B50E6A14CFF66F005F7284 /* StringUtils.h */,
|
D5B50E6A14CFF66F005F7284 /* StringUtils.h */,
|
||||||
D5B50E6B14CFF66F005F7284 /* WeighedRandom.h */,
|
D5B50E6B14CFF66F005F7284 /* WeighedRandom.h */,
|
||||||
F99F0FAE2F8436EB00F2B29A /* Color.cpp */,
|
|
||||||
);
|
);
|
||||||
path = util;
|
path = util;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@@ -4039,8 +4025,6 @@
|
|||||||
D5B50F3714CFF66F005F7284 /* TickNextTickData.h */,
|
D5B50F3714CFF66F005F7284 /* TickNextTickData.h */,
|
||||||
D5B50F3814CFF66F005F7284 /* tile */,
|
D5B50F3814CFF66F005F7284 /* tile */,
|
||||||
D5B50F6814CFF66F005F7284 /* TilePos.h */,
|
D5B50F6814CFF66F005F7284 /* TilePos.h */,
|
||||||
F99F0FA82F84369F00F2B29A /* GrassColor.cpp */,
|
|
||||||
F99F0FAB2F8436CE00F2B29A /* FoliageColor.cpp */,
|
|
||||||
);
|
);
|
||||||
path = level;
|
path = level;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@@ -5210,7 +5194,6 @@
|
|||||||
D5B5111014CFF670005F7284 /* Mth.cpp in Sources */,
|
D5B5111014CFF670005F7284 /* Mth.cpp in Sources */,
|
||||||
D5B5111214CFF670005F7284 /* PerfRenderer.cpp in Sources */,
|
D5B5111214CFF670005F7284 /* PerfRenderer.cpp in Sources */,
|
||||||
D5B5111414CFF670005F7284 /* PerfTimer.cpp in Sources */,
|
D5B5111414CFF670005F7284 /* PerfTimer.cpp in Sources */,
|
||||||
F99F0FA92F84369F00F2B29A /* GrassColor.cpp in Sources */,
|
|
||||||
D5B5111614CFF670005F7284 /* StringUtils.cpp in Sources */,
|
D5B5111614CFF670005F7284 /* StringUtils.cpp in Sources */,
|
||||||
D5B5111814CFF670005F7284 /* Direction.cpp in Sources */,
|
D5B5111814CFF670005F7284 /* Direction.cpp in Sources */,
|
||||||
D5B5111A14CFF670005F7284 /* Animal.cpp in Sources */,
|
D5B5111A14CFF670005F7284 /* Animal.cpp in Sources */,
|
||||||
@@ -5231,14 +5214,12 @@
|
|||||||
D5B5113814CFF670005F7284 /* PathFinderMob.cpp in Sources */,
|
D5B5113814CFF670005F7284 /* PathFinderMob.cpp in Sources */,
|
||||||
D5B5113A14CFF670005F7284 /* Inventory.cpp in Sources */,
|
D5B5113A14CFF670005F7284 /* Inventory.cpp in Sources */,
|
||||||
D5B5113C14CFF670005F7284 /* Player.cpp in Sources */,
|
D5B5113C14CFF670005F7284 /* Player.cpp in Sources */,
|
||||||
F99F0FB02F8436EB00F2B29A /* Color.cpp in Sources */,
|
|
||||||
D5B5113E14CFF670005F7284 /* Arrow.cpp in Sources */,
|
D5B5113E14CFF670005F7284 /* Arrow.cpp in Sources */,
|
||||||
D5B5114014CFF670005F7284 /* Recipes.cpp in Sources */,
|
D5B5114014CFF670005F7284 /* Recipes.cpp in Sources */,
|
||||||
D5B5114214CFF670005F7284 /* ToolRecipes.cpp in Sources */,
|
D5B5114214CFF670005F7284 /* ToolRecipes.cpp in Sources */,
|
||||||
D5B5114414CFF670005F7284 /* WeaponRecipes.cpp in Sources */,
|
D5B5114414CFF670005F7284 /* WeaponRecipes.cpp in Sources */,
|
||||||
D5B5114614CFF670005F7284 /* HatchetItem.cpp in Sources */,
|
D5B5114614CFF670005F7284 /* HatchetItem.cpp in Sources */,
|
||||||
D5B5114814CFF670005F7284 /* Item.cpp in Sources */,
|
D5B5114814CFF670005F7284 /* Item.cpp in Sources */,
|
||||||
F99F0FAC2F8436CE00F2B29A /* FoliageColor.cpp in Sources */,
|
|
||||||
D5B5114A14CFF670005F7284 /* ItemInstance.cpp in Sources */,
|
D5B5114A14CFF670005F7284 /* ItemInstance.cpp in Sources */,
|
||||||
D5B5114C14CFF670005F7284 /* PickaxeItem.cpp in Sources */,
|
D5B5114C14CFF670005F7284 /* PickaxeItem.cpp in Sources */,
|
||||||
F99D344B2F7370CF00DC153E /* Slider.cpp in Sources */,
|
F99D344B2F7370CF00DC153E /* Slider.cpp in Sources */,
|
||||||
@@ -5443,7 +5424,6 @@
|
|||||||
D5D8C4C41639341100FD35F0 /* Motive.cpp in Sources */,
|
D5D8C4C41639341100FD35F0 /* Motive.cpp in Sources */,
|
||||||
D5D8C4C8163934BB00FD35F0 /* HangingEntityItem.cpp in Sources */,
|
D5D8C4C8163934BB00FD35F0 /* HangingEntityItem.cpp in Sources */,
|
||||||
D5D8C4CC1639362F00FD35F0 /* NetherReactorPattern.cpp in Sources */,
|
D5D8C4CC1639362F00FD35F0 /* NetherReactorPattern.cpp in Sources */,
|
||||||
BEEF202614CFF670005F0002 /* Lighting.cpp in Sources */,
|
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
@@ -5548,7 +5528,6 @@
|
|||||||
D5B5102F14CFF670005F7284 /* main.cpp in Sources */,
|
D5B5102F14CFF670005F7284 /* main.cpp in Sources */,
|
||||||
D5B5103514CFF670005F7284 /* Tag.cpp in Sources */,
|
D5B5103514CFF670005F7284 /* Tag.cpp in Sources */,
|
||||||
D5B5103714CFF670005F7284 /* ClientSideNetworkHandler.cpp in Sources */,
|
D5B5103714CFF670005F7284 /* ClientSideNetworkHandler.cpp in Sources */,
|
||||||
F99F0FAF2F8436EB00F2B29A /* Color.cpp in Sources */,
|
|
||||||
D5B5103914CFF670005F7284 /* NetEventCallback.cpp in Sources */,
|
D5B5103914CFF670005F7284 /* NetEventCallback.cpp in Sources */,
|
||||||
D5B5103B14CFF670005F7284 /* Packet.cpp in Sources */,
|
D5B5103B14CFF670005F7284 /* Packet.cpp in Sources */,
|
||||||
D5B5103D14CFF670005F7284 /* RakNetInstance.cpp in Sources */,
|
D5B5103D14CFF670005F7284 /* RakNetInstance.cpp in Sources */,
|
||||||
@@ -5569,7 +5548,6 @@
|
|||||||
D5B5111514CFF670005F7284 /* StringUtils.cpp in Sources */,
|
D5B5111514CFF670005F7284 /* StringUtils.cpp in Sources */,
|
||||||
D5B5111714CFF670005F7284 /* Direction.cpp in Sources */,
|
D5B5111714CFF670005F7284 /* Direction.cpp in Sources */,
|
||||||
D5B5111914CFF670005F7284 /* Animal.cpp in Sources */,
|
D5B5111914CFF670005F7284 /* Animal.cpp in Sources */,
|
||||||
F99F0FAD2F8436CE00F2B29A /* FoliageColor.cpp in Sources */,
|
|
||||||
D5B5111B14CFF670005F7284 /* Chicken.cpp in Sources */,
|
D5B5111B14CFF670005F7284 /* Chicken.cpp in Sources */,
|
||||||
D5B5111D14CFF670005F7284 /* Cow.cpp in Sources */,
|
D5B5111D14CFF670005F7284 /* Cow.cpp in Sources */,
|
||||||
D5B5111F14CFF670005F7284 /* Pig.cpp in Sources */,
|
D5B5111F14CFF670005F7284 /* Pig.cpp in Sources */,
|
||||||
@@ -5620,7 +5598,6 @@
|
|||||||
D5B5117714CFF670005F7284 /* ExternalFileLevelStorageSource.cpp in Sources */,
|
D5B5117714CFF670005F7284 /* ExternalFileLevelStorageSource.cpp in Sources */,
|
||||||
D5B5117914CFF670005F7284 /* RegionFile.cpp in Sources */,
|
D5B5117914CFF670005F7284 /* RegionFile.cpp in Sources */,
|
||||||
D5B5117B14CFF670005F7284 /* TickNextTickData.cpp in Sources */,
|
D5B5117B14CFF670005F7284 /* TickNextTickData.cpp in Sources */,
|
||||||
F99F0FAA2F84369F00F2B29A /* GrassColor.cpp in Sources */,
|
|
||||||
D5B5117D14CFF670005F7284 /* DoorTile.cpp in Sources */,
|
D5B5117D14CFF670005F7284 /* DoorTile.cpp in Sources */,
|
||||||
D5B5118114CFF670005F7284 /* StoneSlabTile.cpp in Sources */,
|
D5B5118114CFF670005F7284 /* StoneSlabTile.cpp in Sources */,
|
||||||
D5B5118314CFF670005F7284 /* Tile.cpp in Sources */,
|
D5B5118314CFF670005F7284 /* Tile.cpp in Sources */,
|
||||||
@@ -5826,7 +5803,6 @@
|
|||||||
042A91AF16B17517007ABBC6 /* NinePatch.cpp in Sources */,
|
042A91AF16B17517007ABBC6 /* NinePatch.cpp in Sources */,
|
||||||
042A91B016B17517007ABBC6 /* OptionsGroup.cpp in Sources */,
|
042A91B016B17517007ABBC6 /* OptionsGroup.cpp in Sources */,
|
||||||
042A91B216B17517007ABBC6 /* TextBox.cpp in Sources */,
|
042A91B216B17517007ABBC6 /* TextBox.cpp in Sources */,
|
||||||
BEEF202614CFF670005F0003 /* Lighting.cpp in Sources */,
|
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
@@ -5877,7 +5853,7 @@
|
|||||||
GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES;
|
GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES;
|
||||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||||
HEADER_SEARCH_PATHS = "$(SRCROOT)/../../src";
|
HEADER_SEARCH_PATHS = "$(SRCROOT)/../../src";
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 12;
|
IPHONEOS_DEPLOYMENT_TARGET = 14;
|
||||||
ONLY_ACTIVE_ARCH = YES;
|
ONLY_ACTIVE_ARCH = YES;
|
||||||
OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
|
OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
|
||||||
"PROVISIONING_PROFILE[sdk=iphoneos*]" = "C93D3524-5C6F-466E-B12B-833663B7EAE0";
|
"PROVISIONING_PROFILE[sdk=iphoneos*]" = "C93D3524-5C6F-466E-B12B-833663B7EAE0";
|
||||||
@@ -5908,7 +5884,7 @@
|
|||||||
);
|
);
|
||||||
INFOPLIST_FILE = "minecraftpe/minecraftpe-Info.plist";
|
INFOPLIST_FILE = "minecraftpe/minecraftpe-Info.plist";
|
||||||
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.games";
|
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.games";
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 12;
|
IPHONEOS_DEPLOYMENT_TARGET = 14;
|
||||||
ONLY_ACTIVE_ARCH = YES;
|
ONLY_ACTIVE_ARCH = YES;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = "com.mojang.mcpe-arm64";
|
PRODUCT_BUNDLE_IDENTIFIER = "com.mojang.mcpe-arm64";
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
@@ -6002,7 +5978,7 @@
|
|||||||
GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES;
|
GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES;
|
||||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||||
HEADER_SEARCH_PATHS = "$(SRCROOT)/../../src";
|
HEADER_SEARCH_PATHS = "$(SRCROOT)/../../src";
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 12;
|
IPHONEOS_DEPLOYMENT_TARGET = 14;
|
||||||
ONLY_ACTIVE_ARCH = YES;
|
ONLY_ACTIVE_ARCH = YES;
|
||||||
OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
|
OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
|
||||||
"PROVISIONING_PROFILE[sdk=iphoneos*]" = "64BA8967-1A9A-4980-972C-42E75AD5E023";
|
"PROVISIONING_PROFILE[sdk=iphoneos*]" = "64BA8967-1A9A-4980-972C-42E75AD5E023";
|
||||||
@@ -6034,7 +6010,7 @@
|
|||||||
);
|
);
|
||||||
INFOPLIST_FILE = "minecraftpe/minecraftpe-Info.plist";
|
INFOPLIST_FILE = "minecraftpe/minecraftpe-Info.plist";
|
||||||
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.games";
|
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.games";
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 12;
|
IPHONEOS_DEPLOYMENT_TARGET = 14;
|
||||||
ONLY_ACTIVE_ARCH = YES;
|
ONLY_ACTIVE_ARCH = YES;
|
||||||
OTHER_CFLAGS = (
|
OTHER_CFLAGS = (
|
||||||
"-DNS_BLOCK_ASSERTIONS=1",
|
"-DNS_BLOCK_ASSERTIONS=1",
|
||||||
@@ -6100,7 +6076,7 @@
|
|||||||
GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES;
|
GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES;
|
||||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||||
HEADER_SEARCH_PATHS = "$(SRCROOT)/../../src";
|
HEADER_SEARCH_PATHS = "$(SRCROOT)/../../src";
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 12;
|
IPHONEOS_DEPLOYMENT_TARGET = 14;
|
||||||
ONLY_ACTIVE_ARCH = YES;
|
ONLY_ACTIVE_ARCH = YES;
|
||||||
RUN_CLANG_STATIC_ANALYZER = NO;
|
RUN_CLANG_STATIC_ANALYZER = NO;
|
||||||
SDKROOT = iphoneos;
|
SDKROOT = iphoneos;
|
||||||
@@ -6128,7 +6104,7 @@
|
|||||||
GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES;
|
GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES;
|
||||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||||
HEADER_SEARCH_PATHS = "$(SRCROOT)/../../src";
|
HEADER_SEARCH_PATHS = "$(SRCROOT)/../../src";
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 12;
|
IPHONEOS_DEPLOYMENT_TARGET = 14;
|
||||||
ONLY_ACTIVE_ARCH = YES;
|
ONLY_ACTIVE_ARCH = YES;
|
||||||
OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
|
OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
|
||||||
RUN_CLANG_STATIC_ANALYZER = NO;
|
RUN_CLANG_STATIC_ANALYZER = NO;
|
||||||
@@ -6161,7 +6137,7 @@
|
|||||||
);
|
);
|
||||||
INFOPLIST_FILE = "minecraftpe/minecraftpe-Info.plist";
|
INFOPLIST_FILE = "minecraftpe/minecraftpe-Info.plist";
|
||||||
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.games";
|
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.games";
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 12;
|
IPHONEOS_DEPLOYMENT_TARGET = 14;
|
||||||
ONLY_ACTIVE_ARCH = YES;
|
ONLY_ACTIVE_ARCH = YES;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = "com.mojang.mcpe-arm64";
|
PRODUCT_BUNDLE_IDENTIFIER = "com.mojang.mcpe-arm64";
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
@@ -6196,7 +6172,7 @@
|
|||||||
);
|
);
|
||||||
INFOPLIST_FILE = "minecraftpe/minecraftpe-Info.plist";
|
INFOPLIST_FILE = "minecraftpe/minecraftpe-Info.plist";
|
||||||
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.games";
|
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.games";
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 12;
|
IPHONEOS_DEPLOYMENT_TARGET = 14;
|
||||||
ONLY_ACTIVE_ARCH = YES;
|
ONLY_ACTIVE_ARCH = YES;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = "com.mojang.mcpe-arm64";
|
PRODUCT_BUNDLE_IDENTIFIER = "com.mojang.mcpe-arm64";
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
|
|||||||
@@ -8,13 +8,12 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
|
||||||
|
|
||||||
#if defined(APPLE_DEMO_PROMOTION)
|
#if defined(APPLE_DEMO_PROMOTION)
|
||||||
#define NO_NETWORK
|
#define NO_NETWORK
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(RPI)
|
#if defined(RPI)
|
||||||
#define CREATORMODE
|
#define CREATORMODE
|
||||||
#endif
|
#endif
|
||||||
#include "../network/RakNetInstance.h"
|
#include "../network/RakNetInstance.h"
|
||||||
#include "../network/ClientSideNetworkHandler.h"
|
#include "../network/ClientSideNetworkHandler.h"
|
||||||
@@ -92,9 +91,6 @@
|
|||||||
#include "gamemode/CreatorMode.h"
|
#include "gamemode/CreatorMode.h"
|
||||||
|
|
||||||
#include "../world/level/GrassColor.h"
|
#include "../world/level/GrassColor.h"
|
||||||
#include "renderer/LevelRenderer.h"
|
|
||||||
#include "particle/ParticleEngine.h"
|
|
||||||
#include "../world/level/Level.h"
|
|
||||||
static void checkGlError(const char* tag) {
|
static void checkGlError(const char* tag) {
|
||||||
#ifdef GLDEBUG
|
#ifdef GLDEBUG
|
||||||
while (1) {
|
while (1) {
|
||||||
@@ -117,7 +113,7 @@ const char* Minecraft::progressMessages[] = {
|
|||||||
int Minecraft::customDebugId = Minecraft::CDI_NONE;
|
int Minecraft::customDebugId = Minecraft::CDI_NONE;
|
||||||
|
|
||||||
#if defined(_MSC_VER)
|
#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
|
#endif
|
||||||
|
|
||||||
bool Minecraft::useAmbientOcclusion = false;
|
bool Minecraft::useAmbientOcclusion = false;
|
||||||
@@ -182,7 +178,7 @@ Minecraft::Minecraft() :
|
|||||||
reserved_d1(0),reserved_d2(0),
|
reserved_d1(0),reserved_d2(0),
|
||||||
reserved_f1(0),reserved_f2(0), options(this)
|
reserved_f1(0),reserved_f2(0), options(this)
|
||||||
{
|
{
|
||||||
//#ifdef ANDROID
|
//#ifdef ANDROID
|
||||||
|
|
||||||
#if defined(NO_NETWORK)
|
#if defined(NO_NETWORK)
|
||||||
raknetInstance = new IRakNetInstance();
|
raknetInstance = new IRakNetInstance();
|
||||||
@@ -466,33 +462,32 @@ void Minecraft::update() {
|
|||||||
}
|
}
|
||||||
TIMER_POP();
|
TIMER_POP();
|
||||||
|
|
||||||
#ifndef STANDALONE_SERVER
|
#ifndef STANDALONE_SERVER
|
||||||
if (gameMode != NULL) gameMode->render(timer.a);
|
if (gameMode != NULL) gameMode->render(timer.a);
|
||||||
TIMER_PUSH("sound");
|
TIMER_PUSH("sound");
|
||||||
soundEngine->update(player, timer.a);
|
soundEngine->update(player, timer.a);
|
||||||
TIMER_POP_PUSH("render");
|
TIMER_POP_PUSH("render");
|
||||||
gameRenderer->render(timer.a);
|
gameRenderer->render(timer.a);
|
||||||
TIMER_POP();
|
TIMER_POP();
|
||||||
#else
|
#else
|
||||||
CThread::sleep(1);
|
CThread::sleep(1);
|
||||||
#endif
|
#endif
|
||||||
#ifndef STANDALONE_SERVER
|
#ifndef STANDALONE_SERVER
|
||||||
Multitouch::resetThisUpdate();
|
Multitouch::resetThisUpdate();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef STANDALONE_SERVER
|
|
||||||
TIMER_POP();
|
TIMER_POP();
|
||||||
|
#ifndef STANDALONE_SERVER
|
||||||
checkGlError("Update finished");
|
checkGlError("Update finished");
|
||||||
|
|
||||||
if (options.getBooleanValue(OPTIONS_RENDER_DEBUG)) {
|
if (options.getBooleanValue(OPTIONS_RENDER_DEBUG)) {
|
||||||
//#ifndef PLATFORM_DESKTOP
|
#ifndef PLATFORM_DESKTOP
|
||||||
if (!PerfTimer::enabled) {
|
if (!PerfTimer::enabled) {
|
||||||
PerfTimer::reset();
|
PerfTimer::reset();
|
||||||
PerfTimer::enabled = true;
|
PerfTimer::enabled = true;
|
||||||
}
|
}
|
||||||
_perfRenderer->renderFpsMeter(1);
|
_perfRenderer->renderFpsMeter(1);
|
||||||
checkGlError("render debug");
|
checkGlError("render debug");
|
||||||
//#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
PerfTimer::enabled = false;
|
PerfTimer::enabled = false;
|
||||||
}
|
}
|
||||||
@@ -569,17 +564,17 @@ void Minecraft::tick(int nTick, int maxTick) {
|
|||||||
#ifndef STANDALONE_SERVER
|
#ifndef STANDALONE_SERVER
|
||||||
textures->loadAndBindTexture("terrain.png");
|
textures->loadAndBindTexture("terrain.png");
|
||||||
if (!pause && !(screen && !screen->renderGameBehind())) {
|
if (!pause && !(screen && !screen->renderGameBehind())) {
|
||||||
#if !defined(RPI)
|
#if !defined(RPI)
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
if (isSuperFast())
|
if (isSuperFast())
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
if (nTick == maxTick) {
|
if (nTick == maxTick) {
|
||||||
TIMER_POP_PUSH("textures");
|
TIMER_POP_PUSH("textures");
|
||||||
textures->tick(true);
|
textures->tick(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
TIMER_POP_PUSH("particles");
|
TIMER_POP_PUSH("particles");
|
||||||
if (!pause) {
|
if (!pause) {
|
||||||
@@ -701,7 +696,7 @@ void Minecraft::tickInput() {
|
|||||||
if (slot >= 0 && slot < gui.getNumSlots())
|
if (slot >= 0 && slot < gui.getNumSlots())
|
||||||
player->inventory->selectSlot(slot);
|
player->inventory->selectSlot(slot);
|
||||||
|
|
||||||
#if defined(WIN32)
|
#if defined(WIN32)
|
||||||
if (digit >= 1 && GetAsyncKeyState(VK_CONTROL) < 0) {
|
if (digit >= 1 && GetAsyncKeyState(VK_CONTROL) < 0) {
|
||||||
// Set adventure settings here!
|
// Set adventure settings here!
|
||||||
AdventureSettingsPacket p(level->adventureSettings);
|
AdventureSettingsPacket p(level->adventureSettings);
|
||||||
@@ -714,7 +709,7 @@ void Minecraft::tickInput() {
|
|||||||
SetSpawnPositionPacket p(pos);
|
SetSpawnPositionPacket p(pos);
|
||||||
raknetInstance->send(p);
|
raknetInstance->send(p);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (key == Keyboard::KEY_LEFT_CTRL) {
|
if (key == Keyboard::KEY_LEFT_CTRL) {
|
||||||
@@ -750,8 +745,7 @@ void Minecraft::tickInput() {
|
|||||||
int dst = options.getIntValue(OPTIONS_VIEW_DISTANCE);
|
int dst = options.getIntValue(OPTIONS_VIEW_DISTANCE);
|
||||||
options.set(OPTIONS_VIEW_DISTANCE, (dst + 1) % 4);
|
options.set(OPTIONS_VIEW_DISTANCE, (dst + 1) % 4);
|
||||||
}
|
}
|
||||||
|
#ifdef CHEATS
|
||||||
#ifdef CHEATS
|
|
||||||
if (key == Keyboard::KEY_U) {
|
if (key == Keyboard::KEY_U) {
|
||||||
onGraphicsReset();
|
onGraphicsReset();
|
||||||
player->heal(100);
|
player->heal(100);
|
||||||
@@ -832,40 +826,32 @@ void Minecraft::tickInput() {
|
|||||||
_perfRenderer->debugFpsMeterKeyPress(key - '0');
|
_perfRenderer->debugFpsMeterKeyPress(key - '0');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (options.getBooleanValue(OPTIONS_RENDER_DEBUG)) {
|
|
||||||
if (key >= '0' && key <= '9') {
|
|
||||||
_perfRenderer->debugFpsMeterKeyPress(key - '0');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (key == Keyboard::KEY_ESCAPE)
|
if (key == Keyboard::KEY_ESCAPE)
|
||||||
pauseGame(false);
|
pauseGame(false);
|
||||||
|
|
||||||
#ifdef PLATFORM_DESKTOP
|
#ifndef OPENGL_ES
|
||||||
if (key == Keyboard::KEY_P) {
|
if (key == Keyboard::KEY_P) {
|
||||||
static bool isWireFrame = false;
|
static bool isWireFrame = false;
|
||||||
isWireFrame = !isWireFrame;
|
isWireFrame = !isWireFrame;
|
||||||
glPolygonMode(GL_FRONT, isWireFrame? GL_LINE : GL_FILL);
|
glPolygonMode(GL_FRONT, isWireFrame? GL_LINE : GL_FILL);
|
||||||
//glPolygonMode(GL_BACK, isWireFrame? GL_LINE : GL_FILL);
|
//glPolygonMode(GL_BACK, isWireFrame? GL_LINE : GL_FILL);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
if (key == Keyboard::KEY_M) {
|
if (key == Keyboard::KEY_M) {
|
||||||
for (int i = 0; i < 5 * SharedConstants::TicksPerSecond; ++i)
|
for (int i = 0; i < 5 * SharedConstants::TicksPerSecond; ++i)
|
||||||
level->tick();
|
level->tick();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TIMER_POP_PUSH("handlemouse");
|
TIMER_POP_PUSH("handlemouse");
|
||||||
|
|
||||||
static bool prevMouseDownLeft = false;
|
static bool prevMouseDownLeft = false;
|
||||||
|
|
||||||
if (!useTouchscreen()) {
|
|
||||||
if (Mouse::getButtonState(MouseAction::ACTION_LEFT) == 0) {
|
if (Mouse::getButtonState(MouseAction::ACTION_LEFT) == 0) {
|
||||||
gameMode->stopDestroyBlock();
|
gameMode->stopDestroyBlock();
|
||||||
}
|
}
|
||||||
@@ -873,7 +859,6 @@ void Minecraft::tickInput() {
|
|||||||
if (!Mouse::isButtonDown(MouseAction::ACTION_RIGHT)) {
|
if (!Mouse::isButtonDown(MouseAction::ACTION_RIGHT)) {
|
||||||
gameMode->releaseUsingItem(player);
|
gameMode->releaseUsingItem(player);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (useTouchscreen()) {
|
if (useTouchscreen()) {
|
||||||
// Touch: gesture recognizer classifies the action type (turn/destroy/build)
|
// Touch: gesture recognizer classifies the action type (turn/destroy/build)
|
||||||
@@ -883,9 +868,6 @@ void Minecraft::tickInput() {
|
|||||||
handleBuildAction(&bai);
|
handleBuildAction(&bai);
|
||||||
} else {
|
} else {
|
||||||
gameMode->stopDestroyBlock();
|
gameMode->stopDestroyBlock();
|
||||||
if (player && player->isUsingItem()) {
|
|
||||||
gameMode->releaseUsingItem(player);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Desktop: left mouse = destroy/attack
|
// Desktop: left mouse = destroy/attack
|
||||||
@@ -991,10 +973,10 @@ void Minecraft::handleBuildAction(BuildActionIntention* action) {
|
|||||||
if (gameMode->useItemOn(player, level, item, x, y, z, face, hitResult.pos)) {
|
if (gameMode->useItemOn(player, level, item, x, y, z, face, hitResult.pos)) {
|
||||||
mayUse = false;
|
mayUse = false;
|
||||||
player->swing();
|
player->swing();
|
||||||
#ifdef RPI
|
#ifdef RPI
|
||||||
} else if (item && item->id == ((Item*)Item::sword_iron)->id) {
|
} else if (item && item->id == ((Item*)Item::sword_iron)->id) {
|
||||||
player->swing();
|
player->swing();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
if (item && item->count <= 0) {
|
if (item && item->count <= 0) {
|
||||||
player->inventory->clearSlot(player->inventory->selected);
|
player->inventory->clearSlot(player->inventory->selected);
|
||||||
@@ -1124,9 +1106,9 @@ void Minecraft::releaseMouse()
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool Minecraft::useTouchscreen() {
|
bool Minecraft::useTouchscreen() {
|
||||||
#if defined(TARGET_OS_IPHONE)
|
#if TARGET_OS_IPHONE
|
||||||
return true;
|
return true;
|
||||||
#elif defined(RPI)
|
#elif RPI
|
||||||
return false;
|
return false;
|
||||||
#endif
|
#endif
|
||||||
return options.getBooleanValue(OPTIONS_USE_TOUCHSCREEN) && !_supportsNonTouchscreen;
|
return options.getBooleanValue(OPTIONS_USE_TOUCHSCREEN) && !_supportsNonTouchscreen;
|
||||||
@@ -1146,10 +1128,7 @@ void Minecraft::init()
|
|||||||
textures = new Textures(&options, platform());
|
textures = new Textures(&options, platform());
|
||||||
textures->addDynamicTexture(new WaterTexture());
|
textures->addDynamicTexture(new WaterTexture());
|
||||||
textures->addDynamicTexture(new WaterSideTexture());
|
textures->addDynamicTexture(new WaterSideTexture());
|
||||||
textures->addDynamicTexture(new LavaTexture());
|
textures->addDynamicTexture(new FireTexture());
|
||||||
textures->addDynamicTexture(new LavaSideTexture());
|
|
||||||
textures->addDynamicTexture(new FireTexture(0));
|
|
||||||
textures->addDynamicTexture(new FireTexture(1));
|
|
||||||
gui.texturesLoaded(textures);
|
gui.texturesLoaded(textures);
|
||||||
|
|
||||||
levelRenderer = new LevelRenderer(this);
|
levelRenderer = new LevelRenderer(this);
|
||||||
@@ -1157,27 +1136,23 @@ void Minecraft::init()
|
|||||||
particleEngine = new ParticleEngine(level, textures);
|
particleEngine = new ParticleEngine(level, textures);
|
||||||
|
|
||||||
// 4j's code for reference
|
// 4j's code for reference
|
||||||
// FoliageColor::init(textures->loadTexturePixels(L"misc/foliagecolor.png"));
|
// FoliageColor::init(textures->loadTexturePixels(L"misc/foliagecolor.png"));
|
||||||
|
|
||||||
|
|
||||||
// my code
|
// my code
|
||||||
TextureId foliageId = (textures->loadTexture("misc/foliagecolor.png")); // loading the uh png for foliage color
|
TextureId foliageId = (textures->loadTexture("environment/foliagecolor.png")); // loading the uh png for foliage color
|
||||||
int* foliagePixels = textures->loadTexturePixels(foliageId, "misc/foliagecolor.png");
|
int* foliagePixels = textures->loadTexturePixels(foliageId, "environment/foliagecolor.png");
|
||||||
// now i can finally initialize foliage color, probably not the best way to handle this but i cant be arsed rn
|
// now i can finally initialize foliage color, probably not the best way to handle this but i cant be arsed rn
|
||||||
FoliageColor::init(foliagePixels);
|
FoliageColor::init(foliagePixels);
|
||||||
|
|
||||||
TextureId grassId = (textures->loadTexture("misc/grasscolor.png")); // loading the uh png for foliage color
|
TextureId grassId = (textures->loadTexture("environment/grasscolor.png")); // loading the uh png for foliage color
|
||||||
int* grassPixels = textures->loadTexturePixels(grassId, "misc/grasscolor.png");
|
int* grassPixels = textures->loadTexturePixels(grassId, "environment/grasscolor.png");
|
||||||
GrassColor::init(grassPixels);
|
GrassColor::init(grassPixels);
|
||||||
|
|
||||||
bool tint = options.getBooleanValue(OPTIONS_FOLIAGE_TINT); // finally, toggleable foliage color
|
bool tint = options.getBooleanValue(OPTIONS_FOLIAGE_TINT); // finally, toggleable foliage color
|
||||||
FoliageColor::setUseTint(tint);
|
FoliageColor::setUseTint(tint);
|
||||||
GrassColor::setUseTint(tint);
|
GrassColor::setUseTint(tint);
|
||||||
|
|
||||||
bool sideTint = options.getBooleanValue(OPTIONS_TINTED_SIDE);
|
|
||||||
TileRenderer::setUseTint(sideTint);
|
|
||||||
|
|
||||||
|
|
||||||
// Platform specific initialization here
|
// Platform specific initialization here
|
||||||
font = new Font(&options, "font/default8.png", textures);
|
font = new Font(&options, "font/default8.png", textures);
|
||||||
|
|
||||||
@@ -1198,24 +1173,6 @@ void Minecraft::setSize(int w, int h) {
|
|||||||
|
|
||||||
width = w;
|
width = w;
|
||||||
height = h;
|
height = h;
|
||||||
int screenWidth;
|
|
||||||
int screenHeight;
|
|
||||||
//#ifdef PLATFORM_DESKTOP
|
|
||||||
if (options.getBooleanValue(OPTIONS_WINDOW_SCALE)){ // scales with resolution using a formula instead of having hardcoded if checks
|
|
||||||
int guiScale = options.getIntValue(OPTIONS_GUI_SCALE);
|
|
||||||
if (guiScale == 0) {
|
|
||||||
guiScale = 1000;
|
|
||||||
}
|
|
||||||
|
|
||||||
// determine gui scale, optionally overriding auto
|
|
||||||
|
|
||||||
|
|
||||||
Gui::GuiScale = (float)Mth::Min(guiScale, Mth::Max(1, Mth::Min(width / 320, height / 240)));
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
|
|
||||||
int guiScale = options.getIntValue(OPTIONS_GUI_SCALE);
|
int guiScale = options.getIntValue(OPTIONS_GUI_SCALE);
|
||||||
|
|
||||||
@@ -1233,11 +1190,11 @@ void Minecraft::setSize(int w, int h) {
|
|||||||
} else {
|
} else {
|
||||||
// auto compute from resolution
|
// auto compute from resolution
|
||||||
if (width >= 1000) {
|
if (width >= 1000) {
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
Gui::GuiScale = (width > 2000)? 8.0f : 4.0f;
|
Gui::GuiScale = (width > 2000)? 8.0f : 4.0f;
|
||||||
#else
|
#else
|
||||||
Gui::GuiScale = 4.0f;
|
Gui::GuiScale = 4.0f;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else if (width >= 800) {
|
else if (width >= 800) {
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
@@ -1252,7 +1209,9 @@ void Minecraft::setSize(int w, int h) {
|
|||||||
Gui::GuiScale = 1.0f;
|
Gui::GuiScale = 1.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Gui::InvGuiScale = 1.0f / Gui::GuiScale;
|
||||||
|
int screenWidth = (int)(width * Gui::InvGuiScale);
|
||||||
|
int screenHeight = (int)(height * Gui::InvGuiScale);
|
||||||
|
|
||||||
// if (platform()) {
|
// if (platform()) {
|
||||||
// float pixelsPerMillimeter = options.getProgressValue(&Option::PIXELS_PER_MILLIMETER);
|
// float pixelsPerMillimeter = options.getProgressValue(&Option::PIXELS_PER_MILLIMETER);
|
||||||
@@ -1260,13 +1219,6 @@ void Minecraft::setSize(int w, int h) {
|
|||||||
// pixelCalcUi.setPixelsPerMillimeter(pixelsPerMillimeter * Gui::InvGuiScale);
|
// 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);
|
Config config = createConfig(this);
|
||||||
gui.onConfigChanged(config);
|
gui.onConfigChanged(config);
|
||||||
|
|
||||||
@@ -1311,17 +1263,17 @@ void Minecraft::_reloadInput() {
|
|||||||
if (useTouchHolder) {
|
if (useTouchHolder) {
|
||||||
inputHolder = new TouchInputHolder(this, &options);
|
inputHolder = new TouchInputHolder(this, &options);
|
||||||
} else {
|
} else {
|
||||||
#if defined(ANDROID) || defined(__APPLE__)
|
#if defined(ANDROID) || defined(__APPLE__)
|
||||||
inputHolder = new CustomInputHolder(
|
inputHolder = new CustomInputHolder(
|
||||||
new XperiaPlayInput(&options),
|
new XperiaPlayInput(&options),
|
||||||
new ControllerTurnInput(2, ControllerTurnInput::MODE_DELTA),
|
new ControllerTurnInput(2, ControllerTurnInput::MODE_DELTA),
|
||||||
new IBuildInput());
|
new IBuildInput());
|
||||||
#else
|
#else
|
||||||
inputHolder = new CustomInputHolder(
|
inputHolder = new CustomInputHolder(
|
||||||
new KeyboardInput(&options),
|
new KeyboardInput(&options),
|
||||||
new MouseTurnInput(MouseTurnInput::MODE_DELTA, width/2, height/2),
|
new MouseTurnInput(MouseTurnInput::MODE_DELTA, width/2, height/2),
|
||||||
new MouseBuildInput());
|
new MouseBuildInput());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
mouseHandler.setTurnInput(inputHolder->getTurnInput());
|
mouseHandler.setTurnInput(inputHolder->getTurnInput());
|
||||||
@@ -1393,11 +1345,11 @@ void Minecraft::hostMultiplayer(int port) {
|
|||||||
|
|
||||||
#if !defined(NO_NETWORK)
|
#if !defined(NO_NETWORK)
|
||||||
netCallback = new ServerSideNetworkHandler(this, raknetInstance);
|
netCallback = new ServerSideNetworkHandler(this, raknetInstance);
|
||||||
#ifdef STANDALONE_SERVER
|
#ifdef STANDALONE_SERVER
|
||||||
raknetInstance->host("Server", port, 16);
|
raknetInstance->host("Server", port, 16);
|
||||||
#else
|
#else
|
||||||
raknetInstance->host(options.getStringValue(OPTIONS_USERNAME), port);
|
raknetInstance->host(options.getStringValue(OPTIONS_USERNAME), port);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1451,12 +1403,6 @@ void Minecraft::_levelGenerated()
|
|||||||
player->resetPos(false);
|
player->resetPos(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (level && level->dimension) {
|
|
||||||
|
|
||||||
level->dimension->FogType = options.getIntValue(OPTIONS_FOG_TYPE);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
this->cameraTargetPlayer = player;
|
this->cameraTargetPlayer = player;
|
||||||
|
|
||||||
std::string serverName = options.getStringValue(OPTIONS_USERNAME) + " - " + level->getLevelData()->levelName;
|
std::string serverName = options.getStringValue(OPTIONS_USERNAME) + " - " + level->getLevelData()->levelName;
|
||||||
@@ -1482,34 +1428,6 @@ void Minecraft::_levelGenerated()
|
|||||||
_hasSignaledGeneratingLevelFinished = true;
|
_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) {
|
Player* Minecraft::respawnPlayer(int playerId) {
|
||||||
for (unsigned int i = 0; i < level->players.size(); ++i) {
|
for (unsigned int i = 0; i < level->players.size(); ++i) {
|
||||||
if (level->players[i]->entityId == playerId) {
|
if (level->players[i]->entityId == playerId) {
|
||||||
@@ -1672,12 +1590,12 @@ void Minecraft::optionUpdated(OptionId option, bool value ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Minecraft::optionUpdated(OptionId option, float value ) {
|
void Minecraft::optionUpdated(OptionId option, float value ) {
|
||||||
// #ifndef STANDALONE_SERVER
|
// #ifndef STANDALONE_SERVER
|
||||||
// if(option == OPTIONS_PIXELS_PER_MILLIMETER) {
|
// if(option == OPTIONS_PIXELS_PER_MILLIMETER) {
|
||||||
// pixelCalcUi.setPixelsPerMillimeter(value * Gui::InvGuiScale);
|
// pixelCalcUi.setPixelsPerMillimeter(value * Gui::InvGuiScale);
|
||||||
// pixelCalc.setPixelsPerMillimeter(value);
|
// pixelCalc.setPixelsPerMillimeter(value);
|
||||||
// }
|
// }
|
||||||
// #endif
|
// #endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void Minecraft::optionUpdated(OptionId option, int value ) {
|
void Minecraft::optionUpdated(OptionId option, int value ) {
|
||||||
|
|||||||
@@ -87,14 +87,6 @@ public:
|
|||||||
|
|
||||||
void update();
|
void update();
|
||||||
|
|
||||||
std::string gatherStats1();
|
|
||||||
|
|
||||||
std::string gatherStats2();
|
|
||||||
|
|
||||||
std::string gatherStats4();
|
|
||||||
|
|
||||||
std::string gatherStats3();
|
|
||||||
|
|
||||||
void tick(int nTick, int maxTick);
|
void tick(int nTick, int maxTick);
|
||||||
void tickInput();
|
void tickInput();
|
||||||
|
|
||||||
|
|||||||
@@ -54,37 +54,13 @@ OptionBool limitFramerate("limitFramerate", false);
|
|||||||
OptionBool vsync("vsync", true);
|
OptionBool vsync("vsync", true);
|
||||||
OptionBool fancyGraphics("fancyGraphics", true);
|
OptionBool fancyGraphics("fancyGraphics", true);
|
||||||
OptionBool viewBobbing("viewBobbing", true);
|
OptionBool viewBobbing("viewBobbing", true);
|
||||||
OptionBool ambientOcclusion("ao", true);
|
OptionBool ambientOcclusion("ao", false);
|
||||||
|
|
||||||
OptionBool useNormalLighting("normalLighting", true);
|
|
||||||
|
|
||||||
OptionBool beautifulSky("beautifulSky", true);
|
|
||||||
|
|
||||||
OptionBool useVignette("useVignette", true);
|
|
||||||
|
|
||||||
OptionBool useTouchscreen("useTouchscreen", true);
|
OptionBool useTouchscreen("useTouchscreen", true);
|
||||||
|
|
||||||
OptionBool serverVisible("servervisible", true);
|
OptionBool serverVisible("servervisible", true);
|
||||||
|
|
||||||
OptionBool foliageTint("foliagetint", 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 keyForward("key.forward", Keyboard::KEY_W);
|
||||||
OptionInt keyLeft("key.left", Keyboard::KEY_A);
|
OptionInt keyLeft("key.left", Keyboard::KEY_A);
|
||||||
@@ -138,7 +114,6 @@ void Options::initTable() {
|
|||||||
|
|
||||||
|
|
||||||
m_options[OPTIONS_GUI_SCALE] = &guiScale;
|
m_options[OPTIONS_GUI_SCALE] = &guiScale;
|
||||||
m_options[OPTIONS_WINDOW_SCALE] = &windowScale;
|
|
||||||
|
|
||||||
m_options[OPTIONS_SKIN] = &skin;
|
m_options[OPTIONS_SKIN] = &skin;
|
||||||
m_options[OPTIONS_USERNAME] = &username;
|
m_options[OPTIONS_USERNAME] = &username;
|
||||||
@@ -163,20 +138,10 @@ void Options::initTable() {
|
|||||||
|
|
||||||
m_options[OPTIONS_USE_TOUCHSCREEN] = &useTouchscreen;
|
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_SERVER_VISIBLE] = &serverVisible;
|
||||||
|
|
||||||
m_options[OPTIONS_MENU_STYLE] = &menuStyle;
|
|
||||||
|
|
||||||
m_options[OPTIONS_KEY_FORWARD] = &keyForward;
|
m_options[OPTIONS_KEY_FORWARD] = &keyForward;
|
||||||
m_options[OPTIONS_KEY_LEFT] = &keyLeft;
|
m_options[OPTIONS_KEY_LEFT] = &keyLeft;
|
||||||
m_options[OPTIONS_KEY_BACK] = &keyBack;
|
m_options[OPTIONS_KEY_BACK] = &keyBack;
|
||||||
@@ -201,17 +166,6 @@ void Options::initTable() {
|
|||||||
m_options[OPTIONS_RPI_CURSOR] = &rpiCursor;
|
m_options[OPTIONS_RPI_CURSOR] = &rpiCursor;
|
||||||
m_options[OPTIONS_FOLIAGE_TINT] = &foliageTint;
|
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_AUTOJUMP] = &autoJump;
|
||||||
m_options[OPTIONS_LAST_IP] = &lastIp;
|
m_options[OPTIONS_LAST_IP] = &lastIp;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,7 +37,6 @@ enum OptionId {
|
|||||||
OPTIONS_BAR_ON_TOP,
|
OPTIONS_BAR_ON_TOP,
|
||||||
OPTIONS_ALLOW_SPRINT,
|
OPTIONS_ALLOW_SPRINT,
|
||||||
OPTIONS_AUTOJUMP,
|
OPTIONS_AUTOJUMP,
|
||||||
OPTIONS_WINDOW_SCALE,
|
|
||||||
|
|
||||||
// Graphics
|
// Graphics
|
||||||
OPTIONS_RENDER_DEBUG,
|
OPTIONS_RENDER_DEBUG,
|
||||||
@@ -50,8 +49,6 @@ enum OptionId {
|
|||||||
OPTIONS_LIMIT_FRAMERATE,
|
OPTIONS_LIMIT_FRAMERATE,
|
||||||
OPTIONS_VSYNC,
|
OPTIONS_VSYNC,
|
||||||
OPTIONS_FANCY_GRAPHICS,
|
OPTIONS_FANCY_GRAPHICS,
|
||||||
OPTIONS_NORMAL_LIGHTING,
|
|
||||||
|
|
||||||
|
|
||||||
// Cheats / debug
|
// Cheats / debug
|
||||||
OPTIONS_FLY_SPEED,
|
OPTIONS_FLY_SPEED,
|
||||||
@@ -59,7 +56,6 @@ enum OptionId {
|
|||||||
OPTIONS_IS_FLYING,
|
OPTIONS_IS_FLYING,
|
||||||
|
|
||||||
// Control
|
// Control
|
||||||
OPTIONS_BLOCK_OUTLINE,
|
|
||||||
OPTIONS_USE_MOUSE_FOR_DIGGING,
|
OPTIONS_USE_MOUSE_FOR_DIGGING,
|
||||||
OPTIONS_IS_LEFT_HANDED,
|
OPTIONS_IS_LEFT_HANDED,
|
||||||
OPTIONS_IS_JOY_TOUCH_AREA,
|
OPTIONS_IS_JOY_TOUCH_AREA,
|
||||||
@@ -89,16 +85,6 @@ enum OptionId {
|
|||||||
|
|
||||||
OPTIONS_RPI_CURSOR,
|
OPTIONS_RPI_CURSOR,
|
||||||
OPTIONS_FOLIAGE_TINT,
|
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!
|
// Should be last!
|
||||||
OPTIONS_COUNT
|
OPTIONS_COUNT
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
#include "screens/ConsoleScreen.h"
|
#include "screens/ConsoleScreen.h"
|
||||||
#include "../Minecraft.h"
|
#include "../Minecraft.h"
|
||||||
#include "../player/LocalPlayer.h"
|
#include "../player/LocalPlayer.h"
|
||||||
#include "../renderer/Chunk.h"
|
|
||||||
#include "../renderer/Tesselator.h"
|
#include "../renderer/Tesselator.h"
|
||||||
#include "../renderer/TileRenderer.h"
|
#include "../renderer/TileRenderer.h"
|
||||||
#include "../renderer/LevelRenderer.h"
|
#include "../renderer/LevelRenderer.h"
|
||||||
@@ -37,7 +36,7 @@ const float Gui::DropTicks = 40.0f;
|
|||||||
//#include <android/log.h>
|
//#include <android/log.h>
|
||||||
|
|
||||||
Gui::Gui(Minecraft* minecraft)
|
Gui::Gui(Minecraft* minecraft)
|
||||||
: minecraft(minecraft),
|
: minecraft(minecraft),
|
||||||
tickCount(0),
|
tickCount(0),
|
||||||
progress(0),
|
progress(0),
|
||||||
overlayMessageTime(0),
|
overlayMessageTime(0),
|
||||||
@@ -104,12 +103,6 @@ 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) {
|
if(minecraft->player->getSleepTimer() > 0) {
|
||||||
glDisable(GL_DEPTH_TEST);
|
glDisable(GL_DEPTH_TEST);
|
||||||
glDisable(GL_ALPHA_TEST);
|
glDisable(GL_ALPHA_TEST);
|
||||||
@@ -122,9 +115,6 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) {
|
|||||||
if (!minecraft->options.getBooleanValue(OPTIONS_HIDEGUI)) {
|
if (!minecraft->options.getBooleanValue(OPTIONS_HIDEGUI)) {
|
||||||
renderToolBar(a, ySlot, screenWidth);
|
renderToolBar(a, ySlot, screenWidth);
|
||||||
|
|
||||||
// font->drawShadow("Minecraft - Pocket Edition ", 2, 2, 0xffffffff);
|
|
||||||
// font->drawShadow("This is a demo, not the finished product", 2, 10 + 2, 0xffffffff);
|
|
||||||
|
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
bool isChatting = (minecraft->screen && (dynamic_cast<ChatScreen*>(minecraft->screen) || dynamic_cast<ConsoleScreen*>(minecraft->screen)));
|
bool isChatting = (minecraft->screen && (dynamic_cast<ChatScreen*>(minecraft->screen) || dynamic_cast<ConsoleScreen*>(minecraft->screen)));
|
||||||
unsigned int max = 10;
|
unsigned int max = 10;
|
||||||
@@ -224,8 +214,8 @@ void Gui::handleClick(int button, int x, int y) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Gui::handleKeyPressed(int key)
|
void Gui::handleKeyPressed(int key)
|
||||||
{
|
{
|
||||||
bool isChatting = (minecraft->screen && (dynamic_cast<ChatScreen*>(minecraft->screen) || dynamic_cast<ConsoleScreen*>(minecraft->screen)));
|
bool isChatting = (minecraft->screen && (dynamic_cast<ChatScreen*>(minecraft->screen) || dynamic_cast<ConsoleScreen*>(minecraft->screen)));
|
||||||
if (isChatting) {
|
if (isChatting) {
|
||||||
// Allow scrolling the chat history with the mouse/keyboard when chat is open
|
// Allow scrolling the chat history with the mouse/keyboard when chat is open
|
||||||
@@ -275,7 +265,7 @@ void Gui::handleClick(int button, int x, int y) {
|
|||||||
{
|
{
|
||||||
minecraft->player->inventory->dropSlot(minecraft->player->inventory->selected, false);
|
minecraft->player->inventory->dropSlot(minecraft->player->inventory->selected, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Gui::scrollChat(int delta) {
|
void Gui::scrollChat(int delta) {
|
||||||
if (delta == 0)
|
if (delta == 0)
|
||||||
@@ -354,8 +344,6 @@ void Gui::displayClientMessage(const std::string& messageId) {
|
|||||||
addMessage(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) {
|
void Gui::renderVignette(float br, int w, int h) {
|
||||||
br = 1 - br;
|
br = 1 - br;
|
||||||
if (br < 0) br = 0;
|
if (br < 0) br = 0;
|
||||||
@@ -364,13 +352,9 @@ void Gui::renderVignette(float br, int w, int h) {
|
|||||||
|
|
||||||
glDisable(GL_DEPTH_TEST);
|
glDisable(GL_DEPTH_TEST);
|
||||||
glDepthMask(false);
|
glDepthMask(false);
|
||||||
glEnable(GL_BLEND);
|
|
||||||
glBlendFunc2(GL_ZERO, GL_ONE_MINUS_SRC_COLOR);
|
glBlendFunc2(GL_ZERO, GL_ONE_MINUS_SRC_COLOR);
|
||||||
glColor4f2(tbr, tbr, tbr, 1);
|
glColor4f2(tbr, tbr, tbr, 1);
|
||||||
|
|
||||||
minecraft->textures->loadAndBindTexture("misc/vignette.png");
|
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;
|
Tesselator& t = Tesselator::instance;
|
||||||
t.begin();
|
t.begin();
|
||||||
@@ -381,7 +365,6 @@ void Gui::renderVignette(float br, int w, int h) {
|
|||||||
t.draw();
|
t.draw();
|
||||||
glDepthMask(true);
|
glDepthMask(true);
|
||||||
glEnable(GL_DEPTH_TEST);
|
glEnable(GL_DEPTH_TEST);
|
||||||
glDisable(GL_BLEND);
|
|
||||||
glColor4f2(1, 1, 1, 1);
|
glColor4f2(1, 1, 1, 1);
|
||||||
glBlendFunc2(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc2(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
}
|
}
|
||||||
@@ -602,8 +585,7 @@ void Gui::renderProgressIndicator( const bool isTouchInterface, const int screen
|
|||||||
bool bowEquipped = currentItem != NULL ? currentItem->getItem() == Item::bow : false;
|
bool bowEquipped = currentItem != NULL ? currentItem->getItem() == Item::bow : false;
|
||||||
bool itemInUse = currentItem != NULL ? currentItem->getItem() == minecraft->player->getUseItem()->getItem() : false;
|
bool itemInUse = currentItem != NULL ? currentItem->getItem() == minecraft->player->getUseItem()->getItem() : false;
|
||||||
if ((!isTouchInterface || minecraft->options.getBooleanValue(OPTIONS_IS_JOY_TOUCH_AREA)
|
if ((!isTouchInterface || minecraft->options.getBooleanValue(OPTIONS_IS_JOY_TOUCH_AREA)
|
||||||
|| (bowEquipped && itemInUse)) && !minecraft->options.getBooleanValue(OPTIONS_HIDEGUI))
|
|| (bowEquipped && itemInUse)) && !minecraft->options.getBooleanValue(OPTIONS_HIDEGUI)) {
|
||||||
{
|
|
||||||
minecraft->textures->loadAndBindTexture("gui/icons.png");
|
minecraft->textures->loadAndBindTexture("gui/icons.png");
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
glBlendFunc2(GL_ONE_MINUS_DST_COLOR, GL_ONE_MINUS_SRC_COLOR);
|
glBlendFunc2(GL_ONE_MINUS_DST_COLOR, GL_ONE_MINUS_SRC_COLOR);
|
||||||
@@ -627,7 +609,7 @@ void Gui::renderProgressIndicator( const bool isTouchInterface, const int screen
|
|||||||
const float x = InvGuiScale * minecraft->inputHolder->mousex;
|
const float x = InvGuiScale * minecraft->inputHolder->mousex;
|
||||||
const float y = InvGuiScale * minecraft->inputHolder->mousey;
|
const float y = InvGuiScale * minecraft->inputHolder->mousey;
|
||||||
glTranslatef2(x, y, 0);
|
glTranslatef2(x, y, 0);
|
||||||
drawArrayVT(rcFeedbackOuter.vboId, rcFeedbackOuter.vertexCount, 36);
|
drawArrayVT(rcFeedbackOuter.vboId, rcFeedbackOuter.vertexCount, 24);
|
||||||
glTranslatef2(-x, -y, 0);
|
glTranslatef2(-x, -y, 0);
|
||||||
|
|
||||||
glEnable2(GL_TEXTURE_2D);
|
glEnable2(GL_TEXTURE_2D);
|
||||||
@@ -648,12 +630,12 @@ void Gui::renderProgressIndicator( const bool isTouchInterface, const int screen
|
|||||||
const float y = InvGuiScale * minecraft->inputHolder->mousey;
|
const float y = InvGuiScale * minecraft->inputHolder->mousey;
|
||||||
glPushMatrix2();
|
glPushMatrix2();
|
||||||
glTranslatef2(x, y, 0);
|
glTranslatef2(x, y, 0);
|
||||||
drawArrayVT(rcFeedbackOuter.vboId, rcFeedbackOuter.vertexCount, 36);
|
drawArrayVT(rcFeedbackOuter.vboId, rcFeedbackOuter.vertexCount, 24);
|
||||||
glScalef2(0.5f + progress, 0.5f + progress, 1);
|
glScalef2(0.5f + progress, 0.5f + progress, 1);
|
||||||
//glDisable2(GL_CULL_FACE);
|
//glDisable2(GL_CULL_FACE);
|
||||||
glColor4f2(1, 1, 1, 1);
|
glColor4f2(1, 1, 1, 1);
|
||||||
glBlendFunc2(GL_ONE_MINUS_DST_COLOR, GL_ONE_MINUS_SRC_COLOR);
|
glBlendFunc2(GL_ONE_MINUS_DST_COLOR, GL_ONE_MINUS_SRC_COLOR);
|
||||||
drawArrayVT(rcFeedbackInner.vboId, rcFeedbackInner.vertexCount, 36, GL_TRIANGLE_FAN);
|
drawArrayVT(rcFeedbackInner.vboId, rcFeedbackInner.vertexCount, 24, GL_TRIANGLE_FAN);
|
||||||
glPopMatrix2();
|
glPopMatrix2();
|
||||||
|
|
||||||
glDisable(GL_BLEND);
|
glDisable(GL_BLEND);
|
||||||
@@ -732,20 +714,13 @@ void Gui::onLevelGenerated() {
|
|||||||
|
|
||||||
void Gui::renderDebugInfo() {
|
void Gui::renderDebugInfo() {
|
||||||
// FPS counter (updates once per second)
|
// FPS counter (updates once per second)
|
||||||
static int fps = 0;
|
static float fps = 0.0f;
|
||||||
static int fpsLastTime = 0;
|
static float fpsLastTime = 0.0f;
|
||||||
static int fpsFrames = 0;
|
static int fpsFrames = 0;
|
||||||
static int displayChunkUpdates = 0;
|
|
||||||
float now = getTimeS();
|
float now = getTimeS();
|
||||||
fpsFrames++;
|
fpsFrames++;
|
||||||
if (now - fpsLastTime >= 1) {
|
if (now - fpsLastTime >= 1.0f) {
|
||||||
fps = fpsFrames / (now - fpsLastTime);
|
fps = fpsFrames / (now - fpsLastTime);
|
||||||
|
|
||||||
displayChunkUpdates = Chunk::updates;
|
|
||||||
|
|
||||||
// 3. RESET the actual game counter to 0 for the next second
|
|
||||||
Chunk::updates = 0;
|
|
||||||
|
|
||||||
fpsFrames = 0;
|
fpsFrames = 0;
|
||||||
fpsLastTime = now;
|
fpsLastTime = now;
|
||||||
}
|
}
|
||||||
@@ -782,70 +757,7 @@ void Gui::renderDebugInfo() {
|
|||||||
long day = worldTime / Level::TICKS_PER_DAY;
|
long day = worldTime / Level::TICKS_PER_DAY;
|
||||||
long seed = lvl ? lvl->getSeed() : 0;
|
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)
|
// 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];
|
static char ln[8][96];
|
||||||
sprintf(ln[0], "Minecraft PE 0.6.1 alpha (mcpe64)");
|
sprintf(ln[0], "Minecraft PE 0.6.1 alpha (mcpe64)");
|
||||||
sprintf(ln[1], "%.1f fps", fps);
|
sprintf(ln[1], "%.1f fps", fps);
|
||||||
@@ -860,7 +772,7 @@ void Gui::renderDebugInfo() {
|
|||||||
const float LH = (float)Font::DefaultLineHeight; // 10 font-pixels
|
const float LH = (float)Font::DefaultLineHeight; // 10 font-pixels
|
||||||
const float MGN = 2.0f; // left/top margin in font-pixels
|
const float MGN = 2.0f; // left/top margin in font-pixels
|
||||||
const float PAD = 2.0f; // horizontal padding for background
|
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
|
// 1) Draw semi-transparent background boxes behind each line
|
||||||
for (int i = 0; i < N; i++) {
|
for (int i = 0; i < N; i++) {
|
||||||
@@ -883,7 +795,6 @@ void Gui::renderDebugInfo() {
|
|||||||
font->draw(ln[i], MGN, y, col);
|
font->draw(ln[i], MGN, y, col);
|
||||||
}
|
}
|
||||||
t.endOverrideAndDraw();
|
t.endOverrideAndDraw();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Gui::renderPlayerList(Font* font, int screenWidth, int screenHeight) {
|
void Gui::renderPlayerList(Font* font, int screenWidth, int screenHeight) {
|
||||||
@@ -1113,10 +1024,7 @@ void Gui::renderChatMessages( const int screenHeight, unsigned int max, bool isC
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Gui::renderToolBar( float a, int ySlot, const int screenWidth ) {
|
void Gui::renderToolBar( float a, int ySlot, const int screenWidth ) {
|
||||||
glColor4f2(1, 1, 1, 1);
|
glColor4f2(1, 1, 1, .5);
|
||||||
glEnable(GL_BLEND);
|
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
|
||||||
|
|
||||||
minecraft->textures->loadAndBindTexture("gui/gui.png");
|
minecraft->textures->loadAndBindTexture("gui/gui.png");
|
||||||
|
|
||||||
Inventory* inventory = minecraft->player->inventory;
|
Inventory* inventory = minecraft->player->inventory;
|
||||||
@@ -1197,41 +1105,22 @@ void Gui::renderToolBar( float a, int ySlot, const int screenWidth ) {
|
|||||||
|
|
||||||
// Draw count
|
// Draw count
|
||||||
//Tesselator& t = Tesselator::instance;
|
//Tesselator& t = Tesselator::instance;
|
||||||
|
|
||||||
const float k = 0.5f * GuiScale;
|
|
||||||
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();
|
glPushMatrix2();
|
||||||
glScalef2(InvGuiScale + InvGuiScale, InvGuiScale + InvGuiScale, 1);
|
glScalef2(InvGuiScale + InvGuiScale, InvGuiScale + InvGuiScale, 1);
|
||||||
|
const float k = 0.5f * GuiScale;
|
||||||
|
|
||||||
t.beginOverride();
|
t.beginOverride();
|
||||||
if (minecraft->gameMode->isSurvivalType()) {
|
if (minecraft->gameMode->isSurvivalType()) {
|
||||||
x = baseItemX;
|
x = baseItemX;
|
||||||
for (int i = 0; i < slots; i++) {
|
for (int i = 0; i < slots; i++) {
|
||||||
ItemInstance* item = minecraft->player->inventory->getItem(i);
|
ItemInstance* item = minecraft->player->inventory->getItem(i);
|
||||||
if (item && item->count >= 0)
|
if (item && item->count >= 0)
|
||||||
renderSlotText(item, k*x, k*ySlot, true, true);
|
renderSlotText(item, k*x, k*ySlot + 1, true, true);
|
||||||
x += 20;
|
x += 20;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
minecraft->textures->loadAndBindTexture("font/default8.png");
|
minecraft->textures->loadAndBindTexture("font/default8.png");
|
||||||
t.endOverrideAndDraw();
|
t.endOverrideAndDraw();
|
||||||
|
|
||||||
glPopMatrix2();
|
glPopMatrix2();
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,48 +36,6 @@ void OptionsItem::render( Minecraft* minecraft, int xm, int ym ) {
|
|||||||
}
|
}
|
||||||
text += ": " + scaleText;
|
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);
|
minecraft->font->draw(text, (float)x, (float)y + yOffset, 0x909090, false);
|
||||||
super::render(minecraft, xm, ym);
|
super::render(minecraft, xm, ym);
|
||||||
|
|||||||
@@ -41,7 +41,6 @@ void CreditsScreen::init() {
|
|||||||
_lines.push_back("karson");
|
_lines.push_back("karson");
|
||||||
_lines.push_back("deepfriedwaffles");
|
_lines.push_back("deepfriedwaffles");
|
||||||
_lines.push_back("EpikIzCool");
|
_lines.push_back("EpikIzCool");
|
||||||
_lines.push_back("fileshredder");
|
|
||||||
_lines.push_back("");
|
_lines.push_back("");
|
||||||
// avoid color tags around the URL so it isn't mangled by the parser please
|
// 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");
|
_lines.push_back("Join our Discord server: https://discord.gg/c58YesBxve");
|
||||||
|
|||||||
@@ -23,15 +23,12 @@ DeathScreen::~DeathScreen()
|
|||||||
|
|
||||||
void DeathScreen::init()
|
void DeathScreen::init()
|
||||||
{
|
{
|
||||||
if (minecraft->options.getIntValue(OPTIONS_MENU_STYLE) == 0) {
|
if (/* minecraft->useTouchscreen() */ true) {
|
||||||
bRespawn = new Touch::TButton(1, "Respawn!");
|
bRespawn = new Touch::TButton(1, "Respawn!");
|
||||||
bTitle = new Touch::TButton(2, "Main menu");
|
bTitle = new Touch::TButton(2, "Main menu");
|
||||||
} else if (minecraft->options.getIntValue(OPTIONS_MENU_STYLE) == 1) {
|
} else {
|
||||||
bRespawn = new Button(1, "Respawn!");
|
bRespawn = new Button(1, "Respawn!");
|
||||||
bTitle = new Button(2, "Main menu");
|
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(bRespawn);
|
||||||
buttons.push_back(bTitle);
|
buttons.push_back(bTitle);
|
||||||
@@ -42,23 +39,13 @@ void DeathScreen::init()
|
|||||||
|
|
||||||
void DeathScreen::setupPositions()
|
void DeathScreen::setupPositions()
|
||||||
{
|
{
|
||||||
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->width = bTitle->width = width / 4;
|
||||||
|
|
||||||
bRespawn->y = bTitle->y = height / 2;
|
bRespawn->y = bTitle->y = height / 2;
|
||||||
bRespawn->x = width/2 - bRespawn->width - 10;
|
bRespawn->x = width/2 - bRespawn->width - 10;
|
||||||
bTitle->x = width/2 + 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() {
|
void DeathScreen::tick() {
|
||||||
@@ -69,20 +56,10 @@ void DeathScreen::render( int xm, int ym, float a )
|
|||||||
{
|
{
|
||||||
fillGradient(0, 0, width, height, 0x60500000, 0xa0803030);
|
fillGradient(0, 0, width, height, 0x60500000, 0xa0803030);
|
||||||
|
|
||||||
if (minecraft->options.getIntValue(OPTIONS_MENU_STYLE) == 2){
|
|
||||||
glPushMatrix2();
|
|
||||||
glScalef2(2, 2, 2);
|
|
||||||
drawCenteredString(font, "Game over!", width / 2 / 2, 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();
|
glPushMatrix2();
|
||||||
glScalef2(2, 2, 2);
|
glScalef2(2, 2, 2);
|
||||||
drawCenteredString(font, "You died!", width / 2 / 2, height / 8, 0xffffff);
|
drawCenteredString(font, "You died!", width / 2 / 2, height / 8, 0xffffff);
|
||||||
glPopMatrix2();
|
glPopMatrix2();
|
||||||
}
|
|
||||||
|
|
||||||
if (_tick >= WAIT_TICKS)
|
if (_tick >= WAIT_TICKS)
|
||||||
Screen::render(xm, ym, a);
|
Screen::render(xm, ym, a);
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
#include "IngameBlockSelectionScreen.h"
|
#include "IngameBlockSelectionScreen.h"
|
||||||
#include "../../renderer/TileRenderer.h"
|
#include "../../renderer/TileRenderer.h"
|
||||||
#include "../../renderer/Lighting.h"
|
|
||||||
#include "../../player/LocalPlayer.h"
|
#include "../../player/LocalPlayer.h"
|
||||||
#include "../../renderer/gles.h"
|
#include "../../renderer/gles.h"
|
||||||
#include "../../Minecraft.h"
|
#include "../../Minecraft.h"
|
||||||
@@ -12,7 +11,6 @@
|
|||||||
#include "../../renderer/Textures.h"
|
#include "../../renderer/Textures.h"
|
||||||
#include "../../gamemode/GameMode.h"
|
#include "../../gamemode/GameMode.h"
|
||||||
#include "ArmorScreen.h"
|
#include "ArmorScreen.h"
|
||||||
#include "crafting/WorkbenchScreen.h"
|
|
||||||
#include "../components/Button.h"
|
#include "../components/Button.h"
|
||||||
|
|
||||||
#if defined(__APPLE__)
|
#if defined(__APPLE__)
|
||||||
@@ -28,8 +26,7 @@ IngameBlockSelectionScreen::IngameBlockSelectionScreen()
|
|||||||
InventoryRows(1),
|
InventoryRows(1),
|
||||||
InventoryCols(1),
|
InventoryCols(1),
|
||||||
InventorySize(1),
|
InventorySize(1),
|
||||||
bArmor(1, "Armor"),
|
bArmor(1, "Armor")
|
||||||
bCrafting(1, "Crafting")
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -45,19 +42,6 @@ void IngameBlockSelectionScreen::init()
|
|||||||
(float)getSlotPosX(InventoryCols) + 4,
|
(float)getSlotPosX(InventoryCols) + 4,
|
||||||
(float)getSlotPosY(InventoryRows) + 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();
|
ItemInstance* selected = inventory->getSelected();
|
||||||
if (!selected || selected->isNull()) {
|
if (!selected || selected->isNull()) {
|
||||||
selectedItem = 0;
|
selectedItem = 0;
|
||||||
@@ -73,6 +57,13 @@ void IngameBlockSelectionScreen::init()
|
|||||||
}
|
}
|
||||||
if (!isAllowed(selectedItem))
|
if (!isAllowed(selectedItem))
|
||||||
selectedItem = 0;
|
selectedItem = 0;
|
||||||
|
|
||||||
|
if (!minecraft->isCreativeMode()) {
|
||||||
|
bArmor.width = 42;
|
||||||
|
bArmor.x = 0;
|
||||||
|
bArmor.y = height - bArmor.height;
|
||||||
|
buttons.push_back(&bArmor);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void IngameBlockSelectionScreen::removed()
|
void IngameBlockSelectionScreen::removed()
|
||||||
@@ -89,10 +80,10 @@ void IngameBlockSelectionScreen::renderSlots()
|
|||||||
|
|
||||||
blitOffset = -90;
|
blitOffset = -90;
|
||||||
|
|
||||||
glEnable2(GL_RESCALE_NORMAL);
|
//glEnable2(GL_RESCALE_NORMAL);
|
||||||
//glPushMatrix2();
|
//glPushMatrix2();
|
||||||
//glRotatef2(180, 1, 0, 0);
|
//glRotatef2(180, 1, 0, 0);
|
||||||
Lighting::turnOn(minecraft);
|
//Lighting::turnOn();
|
||||||
//glPopMatrix2();
|
//glPopMatrix2();
|
||||||
|
|
||||||
minecraft->textures->loadAndBindTexture("gui/gui.png");
|
minecraft->textures->loadAndBindTexture("gui/gui.png");
|
||||||
@@ -131,8 +122,8 @@ void IngameBlockSelectionScreen::renderSlots()
|
|||||||
//w.stop();
|
//w.stop();
|
||||||
//w.printEvery(1000, "render-blocksel");
|
//w.printEvery(1000, "render-blocksel");
|
||||||
|
|
||||||
glDisable2(GL_RESCALE_NORMAL);
|
//glDisable2(GL_RESCALE_NORMAL);
|
||||||
Lighting::turnOff();
|
//Lighting::turnOn();
|
||||||
}
|
}
|
||||||
|
|
||||||
int IngameBlockSelectionScreen::getSlotPosX(int slotX) {
|
int IngameBlockSelectionScreen::getSlotPosX(int slotX) {
|
||||||
@@ -257,7 +248,7 @@ void IngameBlockSelectionScreen::mouseClicked(int x, int y, int buttonNum)
|
|||||||
//minecraft->soundEngine->playUI("random.click", 1, 1);
|
//minecraft->soundEngine->playUI("random.click", 1, 1);
|
||||||
} else {
|
} else {
|
||||||
_pendingQuit = !_area.isInside((float)x, (float)y)
|
_pendingQuit = !_area.isInside((float)x, (float)y)
|
||||||
&& !bArmor.isInside(x, y) && !bCrafting.isInside(x, y);
|
&& !bArmor.isInside(x, y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!_pendingQuit)
|
if (!_pendingQuit)
|
||||||
@@ -346,8 +337,5 @@ void IngameBlockSelectionScreen::buttonClicked( Button* button )
|
|||||||
if (button == &bArmor) {
|
if (button == &bArmor) {
|
||||||
minecraft->setScreen(new ArmorScreen());
|
minecraft->setScreen(new ArmorScreen());
|
||||||
}
|
}
|
||||||
if (button == &bCrafting) {
|
|
||||||
minecraft->setScreen(new WorkbenchScreen(Recipe::SIZE_2X2));
|
|
||||||
}
|
|
||||||
super::buttonClicked(button);
|
super::buttonClicked(button);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,7 +52,6 @@ private:
|
|||||||
bool _pendingQuit;
|
bool _pendingQuit;
|
||||||
|
|
||||||
Button bArmor;
|
Button bArmor;
|
||||||
Button bCrafting;
|
|
||||||
|
|
||||||
RectangleArea _area;
|
RectangleArea _area;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -197,7 +197,6 @@ void OptionsScreen::generateOptionScreens() {
|
|||||||
optionPanes[1]->addOptionItem(OPTIONS_DIFFICULTY, minecraft)
|
optionPanes[1]->addOptionItem(OPTIONS_DIFFICULTY, minecraft)
|
||||||
.addOptionItem(OPTIONS_SERVER_VISIBLE, minecraft)
|
.addOptionItem(OPTIONS_SERVER_VISIBLE, minecraft)
|
||||||
.addOptionItem(OPTIONS_THIRD_PERSON_VIEW, minecraft)
|
.addOptionItem(OPTIONS_THIRD_PERSON_VIEW, minecraft)
|
||||||
.addOptionItem(OPTIONS_WINDOW_SCALE, minecraft)
|
|
||||||
.addOptionItem(OPTIONS_GUI_SCALE, minecraft)
|
.addOptionItem(OPTIONS_GUI_SCALE, minecraft)
|
||||||
.addOptionItem(OPTIONS_SENSITIVITY, minecraft)
|
.addOptionItem(OPTIONS_SENSITIVITY, minecraft)
|
||||||
.addOptionItem(OPTIONS_MUSIC_VOLUME, minecraft)
|
.addOptionItem(OPTIONS_MUSIC_VOLUME, minecraft)
|
||||||
@@ -209,9 +208,7 @@ void OptionsScreen::generateOptionScreens() {
|
|||||||
// // Controls Pane
|
// // Controls Pane
|
||||||
optionPanes[2]->addOptionItem(OPTIONS_INVERT_Y_MOUSE, minecraft)
|
optionPanes[2]->addOptionItem(OPTIONS_INVERT_Y_MOUSE, minecraft)
|
||||||
.addOptionItem(OPTIONS_USE_TOUCHSCREEN, minecraft)
|
.addOptionItem(OPTIONS_USE_TOUCHSCREEN, minecraft)
|
||||||
.addOptionItem(OPTIONS_AUTOJUMP, 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++) {
|
for (int i = OPTIONS_KEY_FORWARD; i <= OPTIONS_KEY_USE; i++) {
|
||||||
optionPanes[2]->addOptionItem((OptionId)i, minecraft);
|
optionPanes[2]->addOptionItem((OptionId)i, minecraft);
|
||||||
@@ -224,27 +221,15 @@ void OptionsScreen::generateOptionScreens() {
|
|||||||
// .addOptionItem(&Option::ANAGLYPH, minecraft)
|
// .addOptionItem(&Option::ANAGLYPH, minecraft)
|
||||||
.addOptionItem(OPTIONS_LIMIT_FRAMERATE, minecraft)
|
.addOptionItem(OPTIONS_LIMIT_FRAMERATE, minecraft)
|
||||||
.addOptionItem(OPTIONS_VSYNC, minecraft)
|
.addOptionItem(OPTIONS_VSYNC, minecraft)
|
||||||
.addOptionItem(OPTIONS_VIEW_DISTANCE, minecraft)
|
|
||||||
.addOptionItem(OPTIONS_RENDER_DEBUG, minecraft)
|
.addOptionItem(OPTIONS_RENDER_DEBUG, minecraft)
|
||||||
.addOptionItem(OPTIONS_ANAGLYPH_3D, minecraft)
|
.addOptionItem(OPTIONS_ANAGLYPH_3D, minecraft)
|
||||||
.addOptionItem(OPTIONS_VIEW_BOBBING, 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)
|
optionPanes[4]->addOptionItem(OPTIONS_ALLOW_SPRINT, minecraft)
|
||||||
.addOptionItem(OPTIONS_BAR_ON_TOP, minecraft)
|
.addOptionItem(OPTIONS_BAR_ON_TOP, minecraft)
|
||||||
.addOptionItem(OPTIONS_MENU_STYLE, minecraft)
|
|
||||||
.addOptionItem(OPTIONS_RPI_CURSOR, minecraft)
|
.addOptionItem(OPTIONS_RPI_CURSOR, minecraft)
|
||||||
.addOptionItem(OPTIONS_FOLIAGE_TINT, minecraft)
|
.addOptionItem(OPTIONS_FOLIAGE_TINT, minecraft);
|
||||||
.addOptionItem(OPTIONS_TINTED_SIDE, minecraft)
|
|
||||||
.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) {
|
void OptionsScreen::mouseClicked(int x, int y, int buttonNum) {
|
||||||
|
|||||||
@@ -10,14 +10,14 @@
|
|||||||
#include "client/gui/screens/OptionsScreen.h"
|
#include "client/gui/screens/OptionsScreen.h"
|
||||||
|
|
||||||
PauseScreen::PauseScreen(bool wasBackPaused)
|
PauseScreen::PauseScreen(bool wasBackPaused)
|
||||||
: saveStep(0),
|
: saveStep(0),
|
||||||
visibleTime(0),
|
visibleTime(0),
|
||||||
bContinue(0),
|
bContinue(0),
|
||||||
bQuit(0),
|
bQuit(0),
|
||||||
bOptions(0),
|
bOptions(0),
|
||||||
bQuitAndSaveLocally(0),
|
bQuitAndSaveLocally(0),
|
||||||
bServerVisibility(0),
|
bServerVisibility(0),
|
||||||
// bThirdPerson(0),
|
// bThirdPerson(0),
|
||||||
wasBackPaused(wasBackPaused),
|
wasBackPaused(wasBackPaused),
|
||||||
// bSound(OPTIONS_SOUND_VOLUME, 1, 0),
|
// bSound(OPTIONS_SOUND_VOLUME, 1, 0),
|
||||||
bThirdPerson(OPTIONS_THIRD_PERSON_VIEW),
|
bThirdPerson(OPTIONS_THIRD_PERSON_VIEW),
|
||||||
@@ -44,31 +44,24 @@ PauseScreen::~PauseScreen() {
|
|||||||
delete bQuitAndSaveLocally;
|
delete bQuitAndSaveLocally;
|
||||||
delete bServerVisibility;
|
delete bServerVisibility;
|
||||||
delete bOptions;
|
delete bOptions;
|
||||||
// delete bThirdPerson;
|
// delete bThirdPerson;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PauseScreen::init() {
|
void PauseScreen::init() {
|
||||||
if (minecraft->options.getIntValue(OPTIONS_MENU_STYLE) == 0) {
|
if (/* minecraft->useTouchscreen() */ true) {
|
||||||
bContinue = new Touch::TButton(1, "Back to game");
|
bContinue = new Touch::TButton(1, "Back to game");
|
||||||
bOptions = new Touch::TButton(5, "Options");
|
bOptions = new Touch::TButton(5, "Options");
|
||||||
bQuit = new Touch::TButton(2, "Quit to title");
|
bQuit = new Touch::TButton(2, "Quit to title");
|
||||||
bQuitAndSaveLocally = new Touch::TButton(3, "Quit and copy map");
|
bQuitAndSaveLocally = new Touch::TButton(3, "Quit and copy map");
|
||||||
bServerVisibility = new Touch::TButton(4, "");
|
bServerVisibility = new Touch::TButton(4, "");
|
||||||
// bThirdPerson = new Touch::TButton(5, "Toggle 3:rd person view");
|
// bThirdPerson = new Touch::TButton(5, "Toggle 3:rd person view");
|
||||||
} else if (minecraft->options.getIntValue(OPTIONS_MENU_STYLE) == 1) {
|
} else {
|
||||||
bContinue = new Button(1, "Back to game");
|
bContinue = new Button(1, "Back to game");
|
||||||
bOptions = new Button(5, "Options");
|
bOptions = new Button(5, "Options");
|
||||||
bQuit = new Button(2, "Quit to title");
|
bQuit = new Button(2, "Quit to title");
|
||||||
bQuitAndSaveLocally = new Button(3, "Quit and copy map");
|
bQuitAndSaveLocally = new Button(3, "Quit and copy map");
|
||||||
bServerVisibility = new Button(4, "");
|
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(bContinue);
|
||||||
@@ -84,7 +77,7 @@ void PauseScreen::init() {
|
|||||||
// If Back wasn't pressed, set up additional items (more than Quit to menu
|
// If Back wasn't pressed, set up additional items (more than Quit to menu
|
||||||
// and Back to game) here
|
// and Back to game) here
|
||||||
|
|
||||||
#if !defined(APPLE_DEMO_PROMOTION) && !defined(RPI)
|
#if !defined(APPLE_DEMO_PROMOTION) && !defined(RPI)
|
||||||
if (true || !wasBackPaused) {
|
if (true || !wasBackPaused) {
|
||||||
if (minecraft->raknetInstance) {
|
if (minecraft->raknetInstance) {
|
||||||
if (minecraft->raknetInstance->isServer()) {
|
if (minecraft->raknetInstance->isServer()) {
|
||||||
@@ -92,14 +85,14 @@ void PauseScreen::init() {
|
|||||||
buttons.push_back(bServerVisibility);
|
buttons.push_back(bServerVisibility);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
#if !defined(DEMO_MODE)
|
#if !defined(DEMO_MODE)
|
||||||
buttons.push_back(bQuitAndSaveLocally);
|
buttons.push_back(bQuitAndSaveLocally);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
// buttons.push_back(bThirdPerson);
|
// buttons.push_back(bThirdPerson);
|
||||||
|
|
||||||
for (unsigned int i = 0; i < buttons.size(); ++i) {
|
for (unsigned int i = 0; i < buttons.size(); ++i) {
|
||||||
// if (buttons[i] == &bSound) continue;
|
// if (buttons[i] == &bSound) continue;
|
||||||
@@ -112,25 +105,7 @@ void PauseScreen::init() {
|
|||||||
void PauseScreen::setupPositions() {
|
void PauseScreen::setupPositions() {
|
||||||
saveStep = 0;
|
saveStep = 0;
|
||||||
int yBase = 16;
|
int yBase = 16;
|
||||||
if (minecraft->options.getIntValue(OPTIONS_MENU_STYLE) == 2){
|
|
||||||
yBase = 50;
|
|
||||||
|
|
||||||
bContinue->width = bOptions->width = bQuit->width = /*bThirdPerson->w =*/ 200;
|
|
||||||
bQuitAndSaveLocally->width = bServerVisibility->width = 200;
|
|
||||||
|
|
||||||
bContinue->x = (width - bContinue->width) / 2;
|
|
||||||
bContinue->y = yBase + 24 * 1;
|
|
||||||
|
|
||||||
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;
|
bContinue->width = bOptions->width = bQuit->width = /*bThirdPerson->w =*/ 160;
|
||||||
bQuitAndSaveLocally->width = bServerVisibility->width = 160;
|
bQuitAndSaveLocally->width = bServerVisibility->width = 160;
|
||||||
|
|
||||||
@@ -149,9 +124,6 @@ void PauseScreen::setupPositions() {
|
|||||||
|
|
||||||
bQuitAndSaveLocally->x = bServerVisibility->x = (width - bQuitAndSaveLocally->width) / 2;
|
bQuitAndSaveLocally->x = bServerVisibility->x = (width - bQuitAndSaveLocally->width) / 2;
|
||||||
bQuitAndSaveLocally->y = bServerVisibility->y = yBase + 32 * 4;
|
bQuitAndSaveLocally->y = bServerVisibility->y = yBase + 32 * 4;
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// bSound.y = bThirdPerson.y = 8;
|
// bSound.y = bThirdPerson.y = 8;
|
||||||
// bSound.x = 4;
|
// bSound.x = 4;
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ Screen* ScreenChooser::createScreen( ScreenId id )
|
|||||||
Screen* screen = NULL;
|
Screen* screen = NULL;
|
||||||
|
|
||||||
// :sob:
|
// :sob:
|
||||||
if (_mc->options.getIntValue(OPTIONS_MENU_STYLE) == 0) {
|
if (/* _mc->useTouchscreen() */ true) {
|
||||||
switch (id) {
|
switch (id) {
|
||||||
case SCREEN_STARTMENU: screen = new Touch::StartMenuScreen(); break;
|
case SCREEN_STARTMENU: screen = new Touch::StartMenuScreen(); break;
|
||||||
case SCREEN_SELECTWORLD: screen = new Touch::SelectWorldScreen();break;
|
case SCREEN_SELECTWORLD: screen = new Touch::SelectWorldScreen();break;
|
||||||
|
|||||||
@@ -23,62 +23,49 @@
|
|||||||
|
|
||||||
// Some kind of default settings, might be overridden in ::init
|
// Some kind of default settings, might be overridden in ::init
|
||||||
StartMenuScreen::StartMenuScreen()
|
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()
|
StartMenuScreen::~StartMenuScreen()
|
||||||
{
|
{
|
||||||
delete bHost;
|
|
||||||
delete bJoin;
|
|
||||||
delete bOptions;
|
|
||||||
delete bQuit;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void StartMenuScreen::init()
|
void StartMenuScreen::init()
|
||||||
{
|
{
|
||||||
if (minecraft->options.getIntValue(OPTIONS_MENU_STYLE) == 2){
|
bJoin.active = bHost.active = bOptions.active = true;
|
||||||
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()) {
|
if (minecraft->options.getStringValue(OPTIONS_USERNAME).empty()) {
|
||||||
return; // tick() will redirect to UsernameScreen
|
return; // tick() will redirect to UsernameScreen
|
||||||
}
|
}
|
||||||
|
|
||||||
buttons.push_back(bHost);
|
buttons.push_back(&bHost);
|
||||||
buttons.push_back(bJoin);
|
buttons.push_back(&bJoin);
|
||||||
//buttons.push_back(&bTest);
|
//buttons.push_back(&bTest);
|
||||||
buttons.push_back(bQuit);
|
|
||||||
|
|
||||||
tabButtons.push_back(bHost);
|
tabButtons.push_back(&bHost);
|
||||||
tabButtons.push_back(bJoin);
|
tabButtons.push_back(&bJoin);
|
||||||
tabButtons.push_back(bQuit);
|
|
||||||
|
|
||||||
#ifndef RPI
|
#ifndef RPI
|
||||||
buttons.push_back(bOptions);
|
buttons.push_back(&bOptions);
|
||||||
tabButtons.push_back(bOptions);
|
tabButtons.push_back(&bOptions);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//// add quit button (top right X icon) – match OptionsScreen style
|
// add quit button (top right X icon) – match OptionsScreen style
|
||||||
//{
|
{
|
||||||
// ImageDef def;
|
ImageDef def;
|
||||||
// def.name = "gui/touchgui.png";
|
def.name = "gui/touchgui.png";
|
||||||
// def.width = 34;
|
def.width = 34;
|
||||||
// def.height = 26;
|
def.height = 26;
|
||||||
// def.setSrc(IntRectangle(150, 0, (int)def.width, (int)def.height));
|
def.setSrc(IntRectangle(150, 0, (int)def.width, (int)def.height));
|
||||||
// bQuit.setImageDef(def, true);
|
bQuit.setImageDef(def, true);
|
||||||
// bQuit.scaleWhenPressed = false;
|
bQuit.scaleWhenPressed = false;
|
||||||
// buttons.push_back(&bQuit);
|
buttons.push_back(&bQuit);
|
||||||
// // don't include in tab navigation
|
// don't include in tab navigation
|
||||||
//}
|
}
|
||||||
|
|
||||||
copyright = "\xffMojang AB";//. Do not distribute!";
|
copyright = "\xffMojang AB";//. Do not distribute!";
|
||||||
|
|
||||||
@@ -106,30 +93,20 @@ void StartMenuScreen::init()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void StartMenuScreen::setupPositions() {
|
void StartMenuScreen::setupPositions() {
|
||||||
if (minecraft->options.getIntValue(OPTIONS_MENU_STYLE) == 2){
|
|
||||||
int yBase = (height / 2) - 20;
|
|
||||||
|
|
||||||
bHost->y = yBase;
|
|
||||||
bJoin->y = bHost->y + 24;
|
|
||||||
bOptions->y = bJoin->y + 24;
|
|
||||||
bQuit->y = bOptions->y + 24;
|
|
||||||
} else {
|
|
||||||
int yBase = height / 2;
|
int yBase = height / 2;
|
||||||
bHost->y = yBase;
|
|
||||||
bJoin->y = bHost->y + 24 + 4;
|
bHost.y = yBase;
|
||||||
bOptions->y = bJoin->y + 24 + 4;
|
bJoin.y = bHost.y + 24 + 4;
|
||||||
bQuit->y = bOptions->y + 24 + 4;
|
bOptions.y = bJoin.y + 24 + 4;
|
||||||
}
|
|
||||||
|
|
||||||
// Center buttons
|
// Center buttons
|
||||||
bHost->x = (width - bHost->width) / 2;
|
bHost.x = (width - bHost.width) / 2;
|
||||||
bJoin->x = (width - bJoin->width) / 2;
|
bJoin.x = (width - bJoin.width) / 2;
|
||||||
bOptions->x = (width - bOptions->width) / 2;
|
bOptions.x = (width - bOptions.width) / 2;
|
||||||
bQuit->x = (width - bQuit->width) / 2;
|
|
||||||
|
|
||||||
//// position quit icon at top-right (use image-defined size)
|
// position quit icon at top-right (use image-defined size)
|
||||||
//bQuit.x = width - bQuit.width;
|
bQuit.x = width - bQuit.width;
|
||||||
//bQuit.y = 0;
|
bQuit.y = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void StartMenuScreen::tick() {
|
void StartMenuScreen::tick() {
|
||||||
@@ -137,7 +114,7 @@ void StartMenuScreen::tick() {
|
|||||||
|
|
||||||
void StartMenuScreen::buttonClicked(Button* button) {
|
void StartMenuScreen::buttonClicked(Button* button) {
|
||||||
|
|
||||||
if (button->id == bHost->id)
|
if (button->id == bHost.id)
|
||||||
{
|
{
|
||||||
#if defined(DEMO_MODE) || defined(APPLE_DEMO_PROMOTION)
|
#if defined(DEMO_MODE) || defined(APPLE_DEMO_PROMOTION)
|
||||||
minecraft->setScreen( new SimpleChooseLevelScreen("_DemoLevel") );
|
minecraft->setScreen( new SimpleChooseLevelScreen("_DemoLevel") );
|
||||||
@@ -145,16 +122,16 @@ void StartMenuScreen::buttonClicked(Button* button) {
|
|||||||
minecraft->screenChooser.setScreen(SCREEN_SELECTWORLD);
|
minecraft->screenChooser.setScreen(SCREEN_SELECTWORLD);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
if (button->id == bJoin->id)
|
if (button->id == bJoin.id)
|
||||||
{
|
{
|
||||||
minecraft->locateMultiplayer();
|
minecraft->locateMultiplayer();
|
||||||
minecraft->screenChooser.setScreen(SCREEN_JOINGAME);
|
minecraft->screenChooser.setScreen(SCREEN_JOINGAME);
|
||||||
}
|
}
|
||||||
if (button->id == bOptions->id)
|
if (button->id == bOptions.id)
|
||||||
{
|
{
|
||||||
minecraft->setScreen(new OptionsScreen());
|
minecraft->setScreen(new OptionsScreen());
|
||||||
}
|
}
|
||||||
if (button->id == bQuit->id)
|
if (button == &bQuit)
|
||||||
{
|
{
|
||||||
minecraft->quit();
|
minecraft->quit();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,10 +23,10 @@ public:
|
|||||||
bool isInGameScreen();
|
bool isInGameScreen();
|
||||||
private:
|
private:
|
||||||
|
|
||||||
Button* bHost;
|
Button bHost;
|
||||||
Button* bJoin;
|
Button bJoin;
|
||||||
Button* bOptions;
|
Button bOptions;
|
||||||
Button* bQuit;
|
ImageButton bQuit; // X button in top-right corner
|
||||||
|
|
||||||
std::string copyright;
|
std::string copyright;
|
||||||
int copyrightPosX;
|
int copyrightPosX;
|
||||||
|
|||||||
@@ -40,9 +40,10 @@ HumanoidModel::HumanoidModel( float g /*= 0*/, float yOffset /*= 0*/, int texW /
|
|||||||
head.addBox(-4, -8, -4, 8, 8, 8, g); // Head
|
head.addBox(-4, -8, -4, 8, 8, 8, g); // Head
|
||||||
head.setPos(0, 0 + yOffset, 0);
|
head.setPos(0, 0 + yOffset, 0);
|
||||||
|
|
||||||
|
if (modernSkin) {
|
||||||
hair.addBox(-4, -8, -4, 8, 8, 8, g + 0.5f); // Outer head layer (hat)
|
hair.addBox(-4, -8, -4, 8, 8, 8, g + 0.5f); // Outer head layer (hat)
|
||||||
hair.setPos(0, 0 + yOffset, 0);
|
hair.setPos(0, 0 + yOffset, 0);
|
||||||
|
}
|
||||||
|
|
||||||
body.addBox(-4, 0, -2, 8, 12, 4, g); // Body
|
body.addBox(-4, 0, -2, 8, 12, 4, g); // Body
|
||||||
body.setPos(0, 0 + yOffset, 0);
|
body.setPos(0, 0 + yOffset, 0);
|
||||||
@@ -98,17 +99,17 @@ void HumanoidModel::render(Entity* e, float time, float r, float bob, float yRot
|
|||||||
setupAnim(time, r, bob, yRot, xRot, scale);
|
setupAnim(time, r, bob, yRot, xRot, scale);
|
||||||
|
|
||||||
// Sync overlay with head rotation/position
|
// Sync overlay with head rotation/position
|
||||||
|
if (texWidth == 64 && texHeight == 64) {
|
||||||
hair.xRot = head.xRot;
|
hair.xRot = head.xRot;
|
||||||
hair.yRot = head.yRot;
|
hair.yRot = head.yRot;
|
||||||
hair.zRot = head.zRot;
|
hair.zRot = head.zRot;
|
||||||
hair.y = head.y;
|
hair.y = head.y;
|
||||||
|
}
|
||||||
|
|
||||||
head.render(scale);
|
head.render(scale);
|
||||||
|
if (texWidth == 64 && texHeight == 64) {
|
||||||
hair.render(scale);
|
hair.render(scale);
|
||||||
|
}
|
||||||
body.render(scale);
|
body.render(scale);
|
||||||
arm0.render(scale);
|
arm0.render(scale);
|
||||||
arm1.render(scale);
|
arm1.render(scale);
|
||||||
@@ -122,12 +123,12 @@ void HumanoidModel::render( HumanoidModel* model, float scale )
|
|||||||
head.yRot = model->head.yRot;
|
head.yRot = model->head.yRot;
|
||||||
head.y = model->head.y;
|
head.y = model->head.y;
|
||||||
head.xRot = model->head.xRot;
|
head.xRot = model->head.xRot;
|
||||||
|
if (texWidth == 64 && texHeight == 64) {
|
||||||
hair.yRot = head.yRot;
|
hair.yRot = head.yRot;
|
||||||
hair.xRot = head.xRot;
|
hair.xRot = head.xRot;
|
||||||
hair.zRot = head.zRot;
|
hair.zRot = head.zRot;
|
||||||
hair.y = head.y;
|
hair.y = head.y;
|
||||||
|
}
|
||||||
|
|
||||||
arm0.xRot = model->arm0.xRot;
|
arm0.xRot = model->arm0.xRot;
|
||||||
arm0.zRot = model->arm0.zRot;
|
arm0.zRot = model->arm0.zRot;
|
||||||
@@ -272,7 +273,7 @@ void HumanoidModel::onGraphicsReset()
|
|||||||
arm1.onGraphicsReset();
|
arm1.onGraphicsReset();
|
||||||
leg0.onGraphicsReset();
|
leg0.onGraphicsReset();
|
||||||
leg1.onGraphicsReset();
|
leg1.onGraphicsReset();
|
||||||
hair.onGraphicsReset();
|
//hair.onGraphicsReset();
|
||||||
}
|
}
|
||||||
|
|
||||||
//void renderHair(float scale) {
|
//void renderHair(float scale) {
|
||||||
|
|||||||
@@ -203,7 +203,7 @@ void ModelPart::compile( float scale )
|
|||||||
void ModelPart::draw()
|
void ModelPart::draw()
|
||||||
{
|
{
|
||||||
#ifdef OPENGL_ES
|
#ifdef OPENGL_ES
|
||||||
drawArrayVTN_NoState(vboId, cubes.size() * 2 * 3 * 6, 36);
|
drawArrayVT_NoState(vboId, cubes.size() * 2 * 3 * 6, 24);
|
||||||
#else
|
#else
|
||||||
glCallList(list);
|
glCallList(list);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -43,18 +43,6 @@ void PolygonQuad::mirror() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void PolygonQuad::render(Tesselator& t, float scale, int vboId /* = -1 */) {
|
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++) {
|
for (int i = 0; i < 4; i++) {
|
||||||
VertexPT& v = vertices[i];
|
VertexPT& v = vertices[i];
|
||||||
t.vertexUV(v.pos.x * scale, v.pos.y * scale, v.pos.z * scale, v.u, v.v);
|
t.vertexUV(v.pos.x * scale, v.pos.y * scale, v.pos.z * scale, v.u, v.v);
|
||||||
|
|||||||
@@ -355,11 +355,7 @@ LocalPlayer::LocalPlayer(Minecraft* minecraft, Level* level, const std::string&
|
|||||||
armorTypeHash(0),
|
armorTypeHash(0),
|
||||||
sprinting(false),
|
sprinting(false),
|
||||||
sprintDoubleTapTimer(0),
|
sprintDoubleTapTimer(0),
|
||||||
prevForwardHeld(false),
|
prevForwardHeld(false)
|
||||||
xBob(0.0f),
|
|
||||||
yBob(0.0f),
|
|
||||||
xBobO(0.0f),
|
|
||||||
yBobO(0.0f)
|
|
||||||
{
|
{
|
||||||
this->dimension = dimension;
|
this->dimension = dimension;
|
||||||
_init();
|
_init();
|
||||||
@@ -554,10 +550,6 @@ void LocalPlayer::aiStep() {
|
|||||||
|
|
||||||
//if (onGround && abilities.flying)
|
//if (onGround && abilities.flying)
|
||||||
// abilities.flying = false;
|
// abilities.flying = false;
|
||||||
yBobO = yBob;
|
|
||||||
xBobO = xBob;
|
|
||||||
xBob += (xRot - xBob) * 0.5;
|
|
||||||
yBob += (yRot - yBob) * 0.5;
|
|
||||||
|
|
||||||
if (interpolateOnly())
|
if (interpolateOnly())
|
||||||
updateAi();
|
updateAi();
|
||||||
|
|||||||
@@ -22,10 +22,6 @@ public:
|
|||||||
virtual void reset();
|
virtual void reset();
|
||||||
|
|
||||||
void tick();
|
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 move(float xa, float ya, float za);
|
||||||
|
|
||||||
void aiStep();
|
void aiStep();
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#include "GameRenderer.h"
|
#include "GameRenderer.h"
|
||||||
#include "client/Options.h"
|
#include "client/Options.h"
|
||||||
#include "gles.h"
|
#include "gles.h"
|
||||||
#include "Lighting.h"
|
|
||||||
#include "../../util/PerfTimer.h"
|
#include "../../util/PerfTimer.h"
|
||||||
|
|
||||||
#include "LevelRenderer.h"
|
#include "LevelRenderer.h"
|
||||||
@@ -32,7 +32,7 @@
|
|||||||
static int _shTicks = -1;
|
static int _shTicks = -1;
|
||||||
|
|
||||||
GameRenderer::GameRenderer( Minecraft* mc )
|
GameRenderer::GameRenderer( Minecraft* mc )
|
||||||
: mc(mc),
|
: mc(mc),
|
||||||
renderDistance(0),
|
renderDistance(0),
|
||||||
_tick(0),
|
_tick(0),
|
||||||
_lastTickT(0),
|
_lastTickT(0),
|
||||||
@@ -101,15 +101,6 @@ void GameRenderer::setupCamera(float a, int eye) {
|
|||||||
|
|
||||||
float stereoScale = 0.07f;
|
float stereoScale = 0.07f;
|
||||||
if (mc->options.getBooleanValue(OPTIONS_ANAGLYPH_3D)) glTranslatef2(-(eye * 2 - 1) * stereoScale, 0, 0);
|
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) {
|
if (zoom != 1) {
|
||||||
glTranslatef2((float) zoom_x, (float) -zoom_y, 0);
|
glTranslatef2((float) zoom_x, (float) -zoom_y, 0);
|
||||||
glScalef2(zoom, zoom, 1);
|
glScalef2(zoom, zoom, 1);
|
||||||
@@ -117,7 +108,6 @@ void GameRenderer::setupCamera(float a, int eye) {
|
|||||||
} else {
|
} else {
|
||||||
gluPerspective(_setupCameraFov = getFov(a, true), mc->width / (float) mc->height, 0.05f, renderDistance);
|
gluPerspective(_setupCameraFov = getFov(a, true), mc->width / (float) mc->height, 0.05f, renderDistance);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
glMatrixMode(GL_MODELVIEW);
|
glMatrixMode(GL_MODELVIEW);
|
||||||
glLoadIdentity2();
|
glLoadIdentity2();
|
||||||
@@ -282,7 +272,17 @@ void GameRenderer::renderLevel(float a) {
|
|||||||
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)) {
|
if (mc->options.getBooleanValue(OPTIONS_AMBIENT_OCCLUSION)) {
|
||||||
glShadeModel2(GL_SMOOTH);
|
glShadeModel2(GL_SMOOTH);
|
||||||
@@ -295,39 +295,16 @@ void GameRenderer::renderLevel(float a) {
|
|||||||
TIMER_POP_PUSH("culling");
|
TIMER_POP_PUSH("culling");
|
||||||
mc->levelRenderer->cull(&frustum, a);
|
mc->levelRenderer->cull(&frustum, a);
|
||||||
mc->levelRenderer->updateDirtyChunks(cameraEntity, false);
|
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);
|
|
||||||
|
|
||||||
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)) {
|
if(mc->options.getBooleanValue(OPTIONS_FANCY_GRAPHICS)) {
|
||||||
prepareAndRenderClouds(levelRenderer, a);
|
prepareAndRenderClouds(levelRenderer, a);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
setupFog(0);
|
setupFog(0);
|
||||||
glEnable2(GL_FOG);
|
glEnable2(GL_FOG);
|
||||||
|
|
||||||
mc->textures->loadAndBindTexture("terrain.png");
|
mc->textures->loadAndBindTexture("terrain.png");
|
||||||
Lighting::turnOff();
|
glDisable2(GL_ALPHA_TEST);
|
||||||
|
|
||||||
// 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);
|
glDisable2(GL_BLEND);
|
||||||
glEnable2(GL_CULL_FACE);
|
glEnable2(GL_CULL_FACE);
|
||||||
TIMER_POP_PUSH("terrain-0");
|
TIMER_POP_PUSH("terrain-0");
|
||||||
@@ -338,24 +315,20 @@ void GameRenderer::renderLevel(float a) {
|
|||||||
levelRenderer->render(cameraEntity, 1, a);
|
levelRenderer->render(cameraEntity, 1, a);
|
||||||
|
|
||||||
glShadeModel2(GL_FLAT);
|
glShadeModel2(GL_FLAT);
|
||||||
Lighting::turnOn(mc);
|
|
||||||
TIMER_POP_PUSH("entities");
|
TIMER_POP_PUSH("entities");
|
||||||
mc->levelRenderer->renderEntities(cameraEntity->getPos(a), &frustum, a);
|
mc->levelRenderer->renderEntities(cameraEntity->getPos(a), &frustum, a);
|
||||||
// setupFog(0);
|
// setupFog(0);
|
||||||
TIMER_POP_PUSH("particles");
|
TIMER_POP_PUSH("particles");
|
||||||
particleEngine->render(cameraEntity, a);
|
particleEngine->render(cameraEntity, a);
|
||||||
Lighting::turnOff();
|
|
||||||
glDisable2(GL_BLEND);
|
glDisable2(GL_BLEND);
|
||||||
glBlendFunc2(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc2(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
Lighting::turnOff();
|
|
||||||
setupFog(0);
|
setupFog(0);
|
||||||
glEnable2(GL_BLEND);
|
glEnable2(GL_BLEND);
|
||||||
glDisable2(GL_CULL_FACE);
|
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
|
glDepthMask(GL_FALSE);
|
||||||
glDisable2(GL_ALPHA_TEST);
|
glDisable2(GL_ALPHA_TEST);
|
||||||
mc->textures->loadAndBindTexture("terrain.png");
|
mc->textures->loadAndBindTexture("terrain.png");
|
||||||
// @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) {
|
//if (mc->options.fancyGraphics) {
|
||||||
// glColorMask(false, false, false, false);
|
// glColorMask(false, false, false, false);
|
||||||
// int visibleWaterChunks = levelRenderer->render(cameraEntity, 1, a);
|
// int visibleWaterChunks = levelRenderer->render(cameraEntity, 1, a);
|
||||||
@@ -388,24 +361,18 @@ void GameRenderer::renderLevel(float a) {
|
|||||||
TIMER_POP_PUSH("select");
|
TIMER_POP_PUSH("select");
|
||||||
Player* player = (Player*) cameraEntity;
|
Player* player = (Player*) cameraEntity;
|
||||||
// if (mc->useTouchscreen()) {
|
// if (mc->useTouchscreen()) {
|
||||||
if (mc->options.getBooleanValue(OPTIONS_BLOCK_OUTLINE)){
|
levelRenderer->renderHitSelect(player, mc->hitResult, 0, NULL, a); //player.inventory->getSelected(), a);
|
||||||
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);
|
levelRenderer->renderHit(player, mc->hitResult, 0, NULL, a);//player->inventory.getSelected(), a);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
glDisable2(GL_FOG);
|
glDisable2(GL_FOG);
|
||||||
// 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);
|
||||||
setupFog(0);
|
// glEnable2(GL_FOG);
|
||||||
glEnable2(GL_FOG);
|
//// levelRenderer->renderClouds(a);
|
||||||
levelRenderer->renderClouds(a);
|
// glDisable2(GL_FOG);
|
||||||
glDisable2(GL_FOG);
|
|
||||||
}
|
|
||||||
// SHREDDER END
|
|
||||||
setupFog(1);
|
setupFog(1);
|
||||||
|
|
||||||
if (zoom == 1 && !mc->options.getBooleanValue(OPTIONS_HIDEGUI)) {
|
if (zoom == 1 && !mc->options.getBooleanValue(OPTIONS_HIDEGUI)) {
|
||||||
@@ -584,35 +551,35 @@ void GameRenderer::setupFog(int i) {
|
|||||||
glFogx(GL_FOG_MODE, GL_EXP);
|
glFogx(GL_FOG_MODE, GL_EXP);
|
||||||
glFogf(GL_FOG_DENSITY, 0.1f); // was 0.06
|
glFogf(GL_FOG_DENSITY, 0.1f); // was 0.06
|
||||||
|
|
||||||
// float rr = 0.4f;
|
// float rr = 0.4f;
|
||||||
// float gg = 0.4f;
|
// float gg = 0.4f;
|
||||||
// float bb = 0.9f;
|
// float bb = 0.9f;
|
||||||
//
|
//
|
||||||
// if (mc->options.anaglyph3d) {
|
// if (mc->options.anaglyph3d) {
|
||||||
// float rrr = (rr * 30 + gg * 59 + bb * 11) / 100;
|
// float rrr = (rr * 30 + gg * 59 + bb * 11) / 100;
|
||||||
// float ggg = (rr * 30 + gg * 70) / (100);
|
// float ggg = (rr * 30 + gg * 70) / (100);
|
||||||
// float bbb = (rr * 30 + bb * 70) / (100);
|
// float bbb = (rr * 30 + bb * 70) / (100);
|
||||||
//
|
//
|
||||||
// rr = rrr;
|
// rr = rrr;
|
||||||
// gg = ggg;
|
// gg = ggg;
|
||||||
// bb = bbb;
|
// bb = bbb;
|
||||||
// }
|
// }
|
||||||
} else if (player->isUnderLiquid(Material::lava)) {
|
} else if (player->isUnderLiquid(Material::lava)) {
|
||||||
glFogx(GL_FOG_MODE, GL_EXP);
|
glFogx(GL_FOG_MODE, GL_EXP);
|
||||||
glFogf(GL_FOG_DENSITY, 2.f); // was 0.06
|
glFogf(GL_FOG_DENSITY, 2.f); // was 0.06
|
||||||
// float rr = 0.4f;
|
// float rr = 0.4f;
|
||||||
// float gg = 0.3f;
|
// float gg = 0.3f;
|
||||||
// float bb = 0.3f;
|
// float bb = 0.3f;
|
||||||
//
|
//
|
||||||
// if (mc->options.anaglyph3d) {
|
// if (mc->options.anaglyph3d) {
|
||||||
// float rrr = (rr * 30 + gg * 59 + bb * 11) / 100;
|
// float rrr = (rr * 30 + gg * 59 + bb * 11) / 100;
|
||||||
// float ggg = (rr * 30 + gg * 70) / (100);
|
// float ggg = (rr * 30 + gg * 70) / (100);
|
||||||
// float bbb = (rr * 30 + bb * 70) / (100);
|
// float bbb = (rr * 30 + bb * 70) / (100);
|
||||||
//
|
//
|
||||||
// rr = rrr;
|
// rr = rrr;
|
||||||
// gg = ggg;
|
// gg = ggg;
|
||||||
// bb = bbb;
|
// bb = bbb;
|
||||||
// }
|
// }
|
||||||
} else {
|
} else {
|
||||||
glFogx(GL_FOG_MODE, GL_LINEAR);
|
glFogx(GL_FOG_MODE, GL_LINEAR);
|
||||||
glFogf(GL_FOG_START, renderDistance * 0.6f);
|
glFogf(GL_FOG_START, renderDistance * 0.6f);
|
||||||
@@ -690,7 +657,7 @@ void GameRenderer::pick(float a) {
|
|||||||
float range = mc->gameMode->getPickRange();
|
float range = mc->gameMode->getPickRange();
|
||||||
bool isPicking = true;
|
bool isPicking = true;
|
||||||
|
|
||||||
bool freeform = mc->useTouchscreen() && !mc->options.getBooleanValue(OPTIONS_IS_JOY_TOUCH_AREA);
|
bool freeform = mc->useTouchscreen(); //&& !mc->options.getBooleanValue(OPTIONS_IS_JOY_TOUCH_AREA);
|
||||||
|
|
||||||
if (freeform) {
|
if (freeform) {
|
||||||
isPicking = updateFreeformPickDirection(a, pickDirection);
|
isPicking = updateFreeformPickDirection(a, pickDirection);
|
||||||
@@ -825,7 +792,7 @@ void GameRenderer::tick(int nTick, int maxTick) {
|
|||||||
_tick++;
|
_tick++;
|
||||||
|
|
||||||
itemInHandRenderer->tick();
|
itemInHandRenderer->tick();
|
||||||
// if (mc->isRaining) tickRain();
|
// if (mc->isRaining) tickRain();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*private*/
|
/*private*/
|
||||||
@@ -945,9 +912,9 @@ void GameRenderer::onGraphicsReset()
|
|||||||
|
|
||||||
void GameRenderer::saveMatrices()
|
void GameRenderer::saveMatrices()
|
||||||
{
|
{
|
||||||
#if defined(RPI)
|
#if defined(RPI)
|
||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static bool saved = false;
|
static bool saved = false;
|
||||||
//if (saved) return;
|
//if (saved) return;
|
||||||
|
|||||||
@@ -21,12 +21,11 @@
|
|||||||
#include "../../world/item/BowItem.h"
|
#include "../../world/item/BowItem.h"
|
||||||
#include "../../world/level/tile/LeafTile.h"
|
#include "../../world/level/tile/LeafTile.h"
|
||||||
#include "entity/HumanoidMobRenderer.h"
|
#include "entity/HumanoidMobRenderer.h"
|
||||||
#include "Lighting.h"
|
|
||||||
|
|
||||||
//static StopwatchHandler handler;
|
//static StopwatchHandler handler;
|
||||||
|
|
||||||
ItemInHandRenderer::ItemInHandRenderer( Minecraft* mc )
|
ItemInHandRenderer::ItemInHandRenderer( Minecraft* mc )
|
||||||
: mc(mc),
|
: mc(mc),
|
||||||
lastSlot(-1),
|
lastSlot(-1),
|
||||||
height(0),
|
height(0),
|
||||||
oHeight(0),
|
oHeight(0),
|
||||||
@@ -50,34 +49,9 @@ ItemInHandRenderer::ItemInHandRenderer( Minecraft* mc )
|
|||||||
void ItemInHandRenderer::tick()
|
void ItemInHandRenderer::tick()
|
||||||
{
|
{
|
||||||
oHeight = height;
|
oHeight = height;
|
||||||
//item.id = 0;
|
item.id = 0;
|
||||||
|
|
||||||
ItemInstance* itemInHand = mc->player->inventory->getSelected();
|
ItemInstance* itemInHand = mc->player->inventory->getSelected();
|
||||||
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) {
|
if (itemInHand && itemInHand->count > 0) {
|
||||||
item.id = itemInHand->id;
|
item.id = itemInHand->id;
|
||||||
item.setAuxValue(itemInHand->getAuxValue());
|
item.setAuxValue(itemInHand->getAuxValue());
|
||||||
@@ -90,7 +64,6 @@ void ItemInHandRenderer::tick()
|
|||||||
if (dd > max) dd = max;
|
if (dd > max) dd = max;
|
||||||
|
|
||||||
height += dd;
|
height += dd;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ItemInHandRenderer::renderItem(Mob* mob, ItemInstance* item )
|
void ItemInHandRenderer::renderItem(Mob* mob, ItemInstance* item )
|
||||||
@@ -166,9 +139,9 @@ void ItemInHandRenderer::renderItem(Mob* mob, ItemInstance* item )
|
|||||||
float v1 = (vp * 16 + 15.99f) / 256.0f;
|
float v1 = (vp * 16 + 15.99f) / 256.0f;
|
||||||
|
|
||||||
float r = 1.0f;
|
float r = 1.0f;
|
||||||
// float xo = 0.0f;
|
// float xo = 0.0f;
|
||||||
// float yo = 0.3f;
|
// float yo = 0.3f;
|
||||||
/*
|
/*
|
||||||
//glEnable2(GL_RESCALE_NORMAL);
|
//glEnable2(GL_RESCALE_NORMAL);
|
||||||
glTranslatef2(-xo, -yo, 0);
|
glTranslatef2(-xo, -yo, 0);
|
||||||
float s = 1.5f;
|
float s = 1.5f;
|
||||||
@@ -177,28 +150,19 @@ void ItemInHandRenderer::renderItem(Mob* mob, ItemInstance* item )
|
|||||||
glRotatef2(50, 0, 1, 0);
|
glRotatef2(50, 0, 1, 0);
|
||||||
glRotatef2(45 + 290, 0, 0, 1);
|
glRotatef2(45 + 290, 0, 0, 1);
|
||||||
glTranslatef2(-15 / 16.0f, -1 / 16.0f, 0);
|
glTranslatef2(-15 / 16.0f, -1 / 16.0f, 0);
|
||||||
*/
|
*/
|
||||||
float dd = 1 / 16.0f;
|
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(0, 0, 0, u0, v1);
|
||||||
t.vertexUV(r, 0, 0, u1, v1);
|
t.vertexUV(r, 0, 0, u1, v1);
|
||||||
t.vertexUV(r, 1, 0, u1, v0);
|
t.vertexUV(r, 1, 0, u1, v0);
|
||||||
t.vertexUV(0, 1, 0, u0, 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(0, 1, 0 - dd, u0, v0);
|
||||||
t.vertexUV(r, 1, 0 - dd, u1, v0);
|
t.vertexUV(r, 1, 0 - dd, u1, v0);
|
||||||
t.vertexUV(r, 0, 0 - dd, u1, v1);
|
t.vertexUV(r, 0, 0 - dd, u1, v1);
|
||||||
t.vertexUV(0, 0, 0 - dd, u0, 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++) {
|
for (int i = 0; i < 16; i++) {
|
||||||
float p = i / 16.0f;
|
float p = i / 16.0f;
|
||||||
float uu = u0 + (u1 - u0) * p - 0.5f / 256.0f;
|
float uu = u0 + (u1 - u0) * p - 0.5f / 256.0f;
|
||||||
@@ -208,7 +172,6 @@ void ItemInHandRenderer::renderItem(Mob* mob, ItemInstance* item )
|
|||||||
t.vertexUV(xx, 1, 0, uu, v0);
|
t.vertexUV(xx, 1, 0, uu, v0);
|
||||||
t.vertexUV(xx, 1, 0 - dd, 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++) {
|
for (int i = 0; i < 16; i++) {
|
||||||
float p = i / 16.0f;
|
float p = i / 16.0f;
|
||||||
float uu = u0 + (u1 - u0) * p - 0.5f / 256.0f;
|
float uu = u0 + (u1 - u0) * p - 0.5f / 256.0f;
|
||||||
@@ -218,10 +181,6 @@ void ItemInHandRenderer::renderItem(Mob* mob, ItemInstance* item )
|
|||||||
t.vertexUV(xx, 0, 0, uu, v1);
|
t.vertexUV(xx, 0, 0, uu, v1);
|
||||||
t.vertexUV(xx, 0, 0 - dd, 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++) {
|
for (int i = 0; i < 16; i++) {
|
||||||
float p = i / 16.0f;
|
float p = i / 16.0f;
|
||||||
float vv = v1 + (v0 - v1) * p - 0.5f / 256.0f;
|
float vv = v1 + (v0 - v1) * p - 0.5f / 256.0f;
|
||||||
@@ -231,7 +190,6 @@ void ItemInHandRenderer::renderItem(Mob* mob, ItemInstance* item )
|
|||||||
t.vertexUV(r, yy, 0 - dd, u1, vv);
|
t.vertexUV(r, yy, 0 - dd, u1, vv);
|
||||||
t.vertexUV(0, yy, 0 - dd, u0, vv);
|
t.vertexUV(0, yy, 0 - dd, u0, vv);
|
||||||
}
|
}
|
||||||
t.normal(0.0f, -1.0f, 0.0f);
|
|
||||||
for (int i = 0; i < 16; i++) {
|
for (int i = 0; i < 16; i++) {
|
||||||
float p = i / 16.0f;
|
float p = i / 16.0f;
|
||||||
float vv = v1 + (v0 - v1) * p - 0.5f / 256.0f;
|
float vv = v1 + (v0 - v1) * p - 0.5f / 256.0f;
|
||||||
@@ -261,7 +219,7 @@ void ItemInHandRenderer::renderItem(Mob* mob, ItemInstance* item )
|
|||||||
}
|
}
|
||||||
mc->textures->loadAndBindTexture(renderObject.texture);
|
mc->textures->loadAndBindTexture(renderObject.texture);
|
||||||
|
|
||||||
drawArrayVTN_NoState(renderObject.chunk.vboId, renderObject.chunk.vertexCount);
|
drawArrayVT_NoState(renderObject.chunk.vboId, renderObject.chunk.vertexCount);
|
||||||
if (renderObject.isFlat)
|
if (renderObject.isFlat)
|
||||||
glPopMatrix2();
|
glPopMatrix2();
|
||||||
}
|
}
|
||||||
@@ -269,7 +227,6 @@ void ItemInHandRenderer::renderItem(Mob* mob, ItemInstance* item )
|
|||||||
//handler.printEvery(100);
|
//handler.printEvery(100);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ItemInHandRenderer::render( float a )
|
void ItemInHandRenderer::render( float a )
|
||||||
{
|
{
|
||||||
//return;
|
//return;
|
||||||
@@ -280,27 +237,12 @@ void ItemInHandRenderer::render( float a )
|
|||||||
float h = oHeight + (height - oHeight) * a;
|
float h = oHeight + (height - oHeight) * a;
|
||||||
Player* player = mc->player;
|
Player* player = mc->player;
|
||||||
// if (selectedTile==NULL) return;
|
// if (selectedTile==NULL) return;
|
||||||
LocalPlayer* localPlayer = (LocalPlayer*)(player);
|
|
||||||
|
|
||||||
float xr = player->xRotO + (player->xRot - player->xRotO) * a; // shredder added for hand swaying
|
|
||||||
|
|
||||||
glPushMatrix2();
|
glPushMatrix2();
|
||||||
glRotatef2(player->xRotO + (player->xRot - player->xRotO) * a, 1, 0, 0);
|
glRotatef2(player->xRotO + (player->xRot - player->xRotO) * a, 1, 0, 0);
|
||||||
glRotatef2(player->yRotO + (player->yRot - player->yRotO) * a, 0, 1, 0);
|
glRotatef2(player->yRotO + (player->yRot - player->yRotO) * a, 0, 1, 0);
|
||||||
glEnable(GL_RESCALE_NORMAL);
|
|
||||||
Lighting::turnOn(mc);
|
|
||||||
glPopMatrix2();
|
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));
|
float br = mc->level->getBrightness(Mth::floor(player->x), Mth::floor(player->y), Mth::floor(player->z));
|
||||||
|
|
||||||
ItemInstance* item;// = selectedItem;
|
ItemInstance* item;// = selectedItem;
|
||||||
@@ -351,7 +293,7 @@ void ItemInHandRenderer::render( float a )
|
|||||||
glTranslatef2(0.7f * d, -0.65f * d - (1 - h) * 0.6f, -0.9f * d);
|
glTranslatef2(0.7f * d, -0.65f * d - (1 - h) * 0.6f, -0.9f * d);
|
||||||
|
|
||||||
glRotatef2(45, 0, 1, 0);
|
glRotatef2(45, 0, 1, 0);
|
||||||
glEnable2(GL_RESCALE_NORMAL);
|
//glEnable2(GL_RESCALE_NORMAL);
|
||||||
glRotatef2(-swing3 * 20, 0, 1, 0);
|
glRotatef2(-swing3 * 20, 0, 1, 0);
|
||||||
glRotatef2(-swing2 * 20, 0, 0, 1);
|
glRotatef2(-swing2 * 20, 0, 0, 1);
|
||||||
glRotatef2(-swing2 * 80, 1, 0, 0);
|
glRotatef2(-swing2 * 80, 1, 0, 0);
|
||||||
@@ -388,9 +330,7 @@ void ItemInHandRenderer::render( float a )
|
|||||||
}
|
}
|
||||||
glEnableClientState2(GL_VERTEX_ARRAY);
|
glEnableClientState2(GL_VERTEX_ARRAY);
|
||||||
glEnableClientState2(GL_TEXTURE_COORD_ARRAY);
|
glEnableClientState2(GL_TEXTURE_COORD_ARRAY);
|
||||||
glEnableClientState2(GL_NORMAL_ARRAY);
|
|
||||||
renderItem(player, item);
|
renderItem(player, item);
|
||||||
glDisableClientState2(GL_NORMAL_ARRAY);
|
|
||||||
glDisableClientState2(GL_VERTEX_ARRAY);
|
glDisableClientState2(GL_VERTEX_ARRAY);
|
||||||
glDisableClientState2(GL_TEXTURE_COORD_ARRAY);
|
glDisableClientState2(GL_TEXTURE_COORD_ARRAY);
|
||||||
glPopMatrix2();
|
glPopMatrix2();
|
||||||
@@ -409,8 +349,7 @@ void ItemInHandRenderer::render( float a )
|
|||||||
glTranslatef2(0.8f * d, -0.75f * d - (1 - h) * 0.6f, -0.9f * d);
|
glTranslatef2(0.8f * d, -0.75f * d - (1 - h) * 0.6f, -0.9f * d);
|
||||||
|
|
||||||
glRotatef2(45, 0, 1, 0);
|
glRotatef2(45, 0, 1, 0);
|
||||||
// glEnable2(GL_RESCALE_NORMAL);
|
//glEnable2(GL_RESCALE_NORMAL);
|
||||||
glEnable(GL_NORMALIZE);
|
|
||||||
glRotatef2(swing2 * 70, 0, 1, 0);
|
glRotatef2(swing2 * 70, 0, 1, 0);
|
||||||
glRotatef2(-swing3 * 20, 0, 0, 1);
|
glRotatef2(-swing3 * 20, 0, 0, 1);
|
||||||
// glRotatef2(-swing2 * 80, 1, 0, 0);
|
// glRotatef2(-swing2 * 80, 1, 0, 0);
|
||||||
@@ -430,8 +369,8 @@ void ItemInHandRenderer::render( float a )
|
|||||||
playerRenderer->renderHand();
|
playerRenderer->renderHand();
|
||||||
glPopMatrix2();
|
glPopMatrix2();
|
||||||
}
|
}
|
||||||
glDisable2(GL_RESCALE_NORMAL);
|
//glDisable2(GL_RESCALE_NORMAL);
|
||||||
Lighting::turnOff();
|
//Lighting.turnOff();
|
||||||
//w.stop();
|
//w.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -456,10 +395,10 @@ void ItemInHandRenderer::renderScreenEffect( float a )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mc->player->isUnderLiquid(Material::water)) {
|
// if (mc->player->isUnderLiquid(Material::water)) {
|
||||||
mc->textures->loadAndBindTexture("misc/water.png");
|
//mc->textures->loadAndBindTexture("misc/water.png");
|
||||||
renderWater(a);
|
// renderWater(a);
|
||||||
}
|
// }
|
||||||
glEnable2(GL_ALPHA_TEST);
|
glEnable2(GL_ALPHA_TEST);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,6 @@
|
|||||||
#include "../../client/player/LocalPlayer.h"
|
#include "../../client/player/LocalPlayer.h"
|
||||||
|
|
||||||
#include "../../world/level/GrassColor.h"
|
#include "../../world/level/GrassColor.h"
|
||||||
#include "Lighting.h"
|
|
||||||
|
|
||||||
#ifdef GFX_SMALLER_CHUNKS
|
#ifdef GFX_SMALLER_CHUNKS
|
||||||
/* static */ const int LevelRenderer::CHUNK_SIZE = 8;
|
/* static */ const int LevelRenderer::CHUNK_SIZE = 8;
|
||||||
@@ -35,7 +34,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
LevelRenderer::LevelRenderer( Minecraft* mc)
|
LevelRenderer::LevelRenderer( Minecraft* mc)
|
||||||
: mc(mc),
|
: mc(mc),
|
||||||
textures(mc->textures),
|
textures(mc->textures),
|
||||||
level(NULL),
|
level(NULL),
|
||||||
cullStep(0),
|
cullStep(0),
|
||||||
@@ -50,7 +49,6 @@ LevelRenderer::LevelRenderer( Minecraft* mc)
|
|||||||
xMaxChunk(0), yMaxChunk(0), zMaxChunk(0),
|
xMaxChunk(0), yMaxChunk(0), zMaxChunk(0),
|
||||||
|
|
||||||
lastViewDistance(-1),
|
lastViewDistance(-1),
|
||||||
lastFogType(-1),
|
|
||||||
|
|
||||||
noEntityRenderFrames(2),
|
noEntityRenderFrames(2),
|
||||||
totalEntities(0),
|
totalEntities(0),
|
||||||
@@ -77,9 +75,6 @@ LevelRenderer::LevelRenderer( Minecraft* mc)
|
|||||||
//for (int i = 0; i < numListsOrBuffers; ++i) printf("bufId %d: %d\t", i, chunkBuffers[i]);
|
//for (int i = 0; i < numListsOrBuffers; ++i) printf("bufId %d: %d\t", i, chunkBuffers[i]);
|
||||||
|
|
||||||
glGenBuffers2(1, &skyBuffer);
|
glGenBuffers2(1, &skyBuffer);
|
||||||
glGenBuffers2(1, &voidBuffer);
|
|
||||||
glGenBuffers2(1, &starBuffer);
|
|
||||||
generateStars();
|
|
||||||
generateSky();
|
generateSky();
|
||||||
#else
|
#else
|
||||||
int maxChunksWidth = 1024 / CHUNK_SIZE;
|
int maxChunksWidth = 1024 / CHUNK_SIZE;
|
||||||
@@ -98,8 +93,6 @@ LevelRenderer::~LevelRenderer()
|
|||||||
#ifdef OPENGL_ES
|
#ifdef OPENGL_ES
|
||||||
glDeleteBuffers(numListsOrBuffers, chunkBuffers);
|
glDeleteBuffers(numListsOrBuffers, chunkBuffers);
|
||||||
glDeleteBuffers(1, &skyBuffer);
|
glDeleteBuffers(1, &skyBuffer);
|
||||||
glDeleteBuffers(1, &voidBuffer);
|
|
||||||
glDeleteBuffers(1, &starBuffer);
|
|
||||||
delete[] chunkBuffers;
|
delete[] chunkBuffers;
|
||||||
#else
|
#else
|
||||||
glDeleteLists(numListsOrBuffers, chunkLists);
|
glDeleteLists(numListsOrBuffers, chunkLists);
|
||||||
@@ -127,25 +120,6 @@ void LevelRenderer::generateSky() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
t.end(true, skyBuffer);
|
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);
|
//LOGI("skyvertexcount: %d\n", skyVertexCount);
|
||||||
//glEndList();
|
//glEndList();
|
||||||
}
|
}
|
||||||
@@ -171,6 +145,10 @@ void LevelRenderer::setLevel( Level* level )
|
|||||||
level->addListener(this);
|
level->addListener(this);
|
||||||
allChanged();
|
allChanged();
|
||||||
}
|
}
|
||||||
|
if (mc->options.getBooleanValue(OPTIONS_AMBIENT_OCCLUSION)) {
|
||||||
|
mc->useAmbientOcclusion = !mc->useAmbientOcclusion;
|
||||||
|
allChanged();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LevelRenderer::allChanged()
|
void LevelRenderer::allChanged()
|
||||||
@@ -183,24 +161,19 @@ void LevelRenderer::allChanged()
|
|||||||
Tile::leaves_carried->setFancy(fancy);
|
Tile::leaves_carried->setFancy(fancy);
|
||||||
lastViewDistance = mc->options.getIntValue(OPTIONS_VIEW_DISTANCE);
|
lastViewDistance = mc->options.getIntValue(OPTIONS_VIEW_DISTANCE);
|
||||||
|
|
||||||
lastFogType = mc->options.getIntValue(OPTIONS_FOG_TYPE);
|
|
||||||
|
|
||||||
bool tint = mc->options.getBooleanValue(OPTIONS_FOLIAGE_TINT);
|
bool tint = mc->options.getBooleanValue(OPTIONS_FOLIAGE_TINT);
|
||||||
FoliageColor::setUseTint(tint);
|
FoliageColor::setUseTint(tint);
|
||||||
GrassColor::setUseTint(tint);
|
GrassColor::setUseTint(tint);
|
||||||
|
|
||||||
bool sideTint = mc->options.getBooleanValue(OPTIONS_TINTED_SIDE);
|
|
||||||
TileRenderer::setUseTint(sideTint);
|
|
||||||
|
|
||||||
|
|
||||||
int dist = (512 >> 3) << (3 - lastViewDistance);
|
int dist = (512 >> 3) << (3 - lastViewDistance);
|
||||||
if (lastViewDistance <= 2 && mc->isPowerVR())
|
if (lastViewDistance <= 2 && mc->isPowerVR())
|
||||||
dist = (int)((float)dist * 0.8f);
|
dist = (int)((float)dist * 0.8f);
|
||||||
LOGI("last: %d, power: %d\n", lastViewDistance, mc->isPowerVR());
|
LOGI("last: %d, power: %d\n", lastViewDistance, mc->isPowerVR());
|
||||||
|
|
||||||
#if defined(RPI)
|
#if defined(RPI)
|
||||||
dist *= 0.6f;
|
dist *= 0.6f;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (dist > 400) dist = 400;
|
if (dist > 400) dist = 400;
|
||||||
/*
|
/*
|
||||||
@@ -339,48 +312,6 @@ int LevelRenderer::render( Mob* player, int layer, float alpha )
|
|||||||
allChanged();
|
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");
|
TIMER_PUSH("sortchunks");
|
||||||
for (int i = 0; i < 10; i++) {
|
for (int i = 0; i < 10; i++) {
|
||||||
chunkFixOffs = (chunkFixOffs + 1) % chunksLength;
|
chunkFixOffs = (chunkFixOffs + 1) % chunksLength;
|
||||||
@@ -568,15 +499,15 @@ void LevelRenderer::render(const AABB& b) const
|
|||||||
{
|
{
|
||||||
Tesselator& t = Tesselator::instance;
|
Tesselator& t = Tesselator::instance;
|
||||||
|
|
||||||
// glColor4f2(1, 1, 1, 1);
|
glColor4f2(1, 1, 1, 1);
|
||||||
|
|
||||||
// textures->loadAndBindTexture("terrain.png"); // uh need to check java - shredder
|
textures->loadAndBindTexture("terrain.png");
|
||||||
|
|
||||||
//t.begin();
|
//t.begin();
|
||||||
// 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.color(255, 255, 255, 255);
|
||||||
|
|
||||||
|
t.offset(((Mob*)mc->player)->getPos(0).negated());
|
||||||
|
|
||||||
// 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.begin(GL_LINE_STRIP);
|
||||||
t.vertex(b.x0, b.y0, b.z0);
|
t.vertex(b.x0, b.y0, b.z0);
|
||||||
t.vertex(b.x1, b.y0, b.z0);
|
t.vertex(b.x1, b.y0, b.z0);
|
||||||
@@ -649,11 +580,11 @@ int LevelRenderer::renderChunks( int from, int to, int layer, float alpha )
|
|||||||
|
|
||||||
for (unsigned int i = 0; i < _renderChunks.size(); ++i) {
|
for (unsigned int i = 0; i < _renderChunks.size(); ++i) {
|
||||||
Chunk* chunk = _renderChunks[i];
|
Chunk* chunk = _renderChunks[i];
|
||||||
#ifdef USE_VBO
|
#ifdef USE_VBO
|
||||||
renderList.addR(chunk->getRenderChunk(layer));
|
renderList.addR(chunk->getRenderChunk(layer));
|
||||||
#else
|
#else
|
||||||
renderList.add(chunk->getList(layer));
|
renderList.add(chunk->getList(layer));
|
||||||
#endif
|
#endif
|
||||||
renderList.next();
|
renderList.next();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1064,66 +995,13 @@ std::string LevelRenderer::gatherStats1() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
std::string LevelRenderer::gatherStats2() {
|
// /*public*/ std::string gatherStats2() {
|
||||||
std::stringstream ss;
|
// return "E: " + renderedEntities + "/" + totalEntities + ". B: " + culledEntities + ", I: " + ((totalEntities - culledEntities) - renderedEntities);
|
||||||
ss << "E: "<< renderedEntities << "/" << totalEntities << ". B: " << culledEntities << ", I: " << (totalEntities - culledEntities) - renderedEntities <<"\n";
|
// }
|
||||||
return ss.str();
|
|
||||||
}
|
|
||||||
//
|
//
|
||||||
// int[] toRender = new int[50000];
|
// int[] toRender = new int[50000];
|
||||||
// IntBuffer resultBuffer = MemoryTracker.createIntBuffer(64);
|
// 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) {
|
void LevelRenderer::renderSky(float alpha) {
|
||||||
if (mc->level->dimension->foggy) return;
|
if (mc->level->dimension->foggy) return;
|
||||||
|
|
||||||
@@ -1144,125 +1022,19 @@ void LevelRenderer::renderSky(float alpha) {
|
|||||||
}
|
}
|
||||||
glColor4f2(sr, sg, Mth::Min(1.0f, sb), 1);
|
glColor4f2(sr, sg, Mth::Min(1.0f, sb), 1);
|
||||||
|
|
||||||
Tesselator& t = Tesselator::instance;
|
//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);
|
glEnable2(GL_FOG);
|
||||||
glColor4f2(sr, sg, sb, 1.0f);
|
glColor4f2(sr, sg, sb, 1.0f);
|
||||||
|
|
||||||
#ifdef OPENGL_ES
|
#ifdef OPENGL_ES
|
||||||
drawArrayVT(skyBuffer, skyVertexCount);
|
drawArrayVT(skyBuffer, skyVertexCount);
|
||||||
#endif
|
#endif
|
||||||
glDisable(GL_FOG);
|
glEnable2(GL_TEXTURE_2D);
|
||||||
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 ) {
|
void LevelRenderer::renderClouds( float alpha ) {
|
||||||
//if (!mc->level->dimension->isNaturalDimension()) return;
|
//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);
|
glEnable2(GL_TEXTURE_2D);
|
||||||
glDisable(GL_CULL_FACE);
|
glDisable(GL_CULL_FACE);
|
||||||
float yOffs = (float) (mc->player->yOld + (mc->player->y - mc->player->yOld) * alpha);
|
float yOffs = (float) (mc->player->yOld + (mc->player->y - mc->player->yOld) * alpha);
|
||||||
@@ -1311,142 +1083,6 @@ void LevelRenderer::renderClouds( float alpha ) {
|
|||||||
glEnable(GL_CULL_FACE);
|
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) {
|
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)
|
// @todo: deny sounds here if sound is off (rather than waiting 'til SoundEngine)
|
||||||
float dd = 16;
|
float dd = 16;
|
||||||
@@ -1503,53 +1139,53 @@ void LevelRenderer::addParticle(const std::string& name, float x, float y, float
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
void LevelRenderer::addParticle(ParticleType::Id name, float x, float y, float z, float xa, float ya, float za, int data) {
|
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 xd = mc->cameraTargetPlayer->x - x;
|
||||||
float yd = mc->cameraTargetPlayer->y - y;
|
float yd = mc->cameraTargetPlayer->y - y;
|
||||||
float zd = mc->cameraTargetPlayer->z - z;
|
float zd = mc->cameraTargetPlayer->z - z;
|
||||||
|
|
||||||
const float particleDistance = 16;
|
const float particleDistance = 16;
|
||||||
if (xd * xd + yd * yd + zd * zd > particleDistance * particleDistance) return;
|
if (xd * xd + yd * yd + zd * zd > particleDistance * particleDistance) return;
|
||||||
|
|
||||||
//static Stopwatch sw;
|
//static Stopwatch sw;
|
||||||
//sw.start();
|
//sw.start();
|
||||||
|
|
||||||
//Particle* p = NULL;
|
//Particle* p = NULL;
|
||||||
|
|
||||||
if (name == ParticleType::bubble) mc->particleEngine->add( new BubbleParticle(level, x, y, z, xa, ya, za) );
|
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::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::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::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::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::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::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::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]) );
|
else if (name == ParticleType::iconcrack) mc->particleEngine->add( new BreakingItemParticle(level, x, y, z, xa, ya, za, Item::items[data]) );
|
||||||
|
|
||||||
//switch (name) {
|
//switch (name) {
|
||||||
// case ParticleType::bubble: p = new BubbleParticle(level, x, y, z, xa, ya, za); break;
|
// 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::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::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::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::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::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::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::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::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::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::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::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::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;
|
// //case ParticleType::heart: p = new HeartParticle(level, x, y, z, xa, ya, za); break;
|
||||||
// default:
|
// default:
|
||||||
// LOGW("Couldn't find particle of type: %d\n", name);
|
// LOGW("Couldn't find particle of type: %d\n", name);
|
||||||
// break;
|
// break;
|
||||||
//}
|
//}
|
||||||
//if (p) {
|
//if (p) {
|
||||||
// mc->particleEngine->add(p);
|
// mc->particleEngine->add(p);
|
||||||
//}
|
//}
|
||||||
|
|
||||||
//sw.stop();
|
//sw.stop();
|
||||||
//sw.printEvery(50, "add-particle-enum");
|
//sw.printEvery(50, "add-particle-enum");
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -1609,7 +1245,6 @@ void LevelRenderer::renderHitSelect( Player* player, const HitResult& h, int mod
|
|||||||
|
|
||||||
void LevelRenderer::onGraphicsReset()
|
void LevelRenderer::onGraphicsReset()
|
||||||
{
|
{
|
||||||
generateStars();
|
|
||||||
generateSky();
|
generateSky();
|
||||||
|
|
||||||
// Get new buffers
|
// Get new buffers
|
||||||
|
|||||||
@@ -43,9 +43,7 @@ public:
|
|||||||
void renderDebug(const AABB& b, float a) const;
|
void renderDebug(const AABB& b, float a) const;
|
||||||
|
|
||||||
void renderSky(float alpha);
|
void renderSky(float alpha);
|
||||||
void generateStars();
|
|
||||||
void renderClouds(float alpha);
|
void renderClouds(float alpha);
|
||||||
void renderAdvancedClouds(float alpha);
|
|
||||||
void renderEntities(Vec3 cam, Culler* culler, float a);
|
void renderEntities(Vec3 cam, Culler* culler, float a);
|
||||||
void renderSameAsLast(int layer, float alpha);
|
void renderSameAsLast(int layer, float alpha);
|
||||||
void renderHit(Player* player, const HitResult& h, int mode, /*ItemInstance*/void* inventoryItem, float a);
|
void renderHit(Player* player, const HitResult& h, int mode, /*ItemInstance*/void* inventoryItem, float a);
|
||||||
@@ -69,7 +67,6 @@ public:
|
|||||||
void levelEvent(Player* source, int type, int x, int y, int z, int data);
|
void levelEvent(Player* source, int type, int x, int y, int z, int data);
|
||||||
|
|
||||||
std::string gatherStats1();
|
std::string gatherStats1();
|
||||||
std::string gatherStats2();
|
|
||||||
|
|
||||||
void render(const AABB& b) const;
|
void render(const AABB& b) const;
|
||||||
void onGraphicsReset();
|
void onGraphicsReset();
|
||||||
@@ -116,12 +113,6 @@ private:
|
|||||||
bool occlusionCheck;
|
bool occlusionCheck;
|
||||||
int lastViewDistance;
|
int lastViewDistance;
|
||||||
|
|
||||||
// shredder added again...
|
|
||||||
int lastFogType;
|
|
||||||
|
|
||||||
bool LastTint;
|
|
||||||
bool LastSideTint;
|
|
||||||
|
|
||||||
int ticks;
|
int ticks;
|
||||||
int starList, skyList, darkList;
|
int starList, skyList, darkList;
|
||||||
|
|
||||||
@@ -130,12 +121,6 @@ private:
|
|||||||
GLuint skyBuffer;
|
GLuint skyBuffer;
|
||||||
int skyVertexCount;
|
int skyVertexCount;
|
||||||
|
|
||||||
GLuint voidBuffer;
|
|
||||||
int voidVertexCount;
|
|
||||||
|
|
||||||
GLuint starBuffer;
|
|
||||||
int starVertexCount;
|
|
||||||
|
|
||||||
// /*public*/ std::vector<TileEntity*> renderableTileEntities;
|
// /*public*/ std::vector<TileEntity*> renderableTileEntities;
|
||||||
Textures* textures;
|
Textures* textures;
|
||||||
// /*private*/ TileRenderer tileRenderer;
|
// /*private*/ TileRenderer tileRenderer;
|
||||||
|
|||||||
@@ -1,49 +0,0 @@
|
|||||||
#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);
|
|
||||||
}
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
#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__*/
|
|
||||||
@@ -8,7 +8,7 @@ Tesselator Tesselator::instance(sizeof(GLfloat) * MAX_FLOATS); // max size in by
|
|||||||
const int VertexSizeBytes = sizeof(VERTEX);
|
const int VertexSizeBytes = sizeof(VERTEX);
|
||||||
|
|
||||||
Tesselator::Tesselator( int size )
|
Tesselator::Tesselator( int size )
|
||||||
: size(size),
|
: size(size),
|
||||||
vertices(0),
|
vertices(0),
|
||||||
u(0), v(0),
|
u(0), v(0),
|
||||||
_color(0),
|
_color(0),
|
||||||
@@ -20,7 +20,7 @@ Tesselator::Tesselator( int size )
|
|||||||
_noColor(false),
|
_noColor(false),
|
||||||
mode(0),
|
mode(0),
|
||||||
xo(0), yo(0), zo(0),
|
xo(0), yo(0), zo(0),
|
||||||
_nx(0), _ny(0), _nz(0),
|
_normal(0),
|
||||||
_sx(1), _sy(1),
|
_sx(1), _sy(1),
|
||||||
|
|
||||||
tesselating(false),
|
tesselating(false),
|
||||||
@@ -112,7 +112,7 @@ RenderChunk Tesselator::end( bool useMine, int bufferId )
|
|||||||
glEnableClientState2(GL_COLOR_ARRAY);
|
glEnableClientState2(GL_COLOR_ARRAY);
|
||||||
}
|
}
|
||||||
if (hasNormal) {
|
if (hasNormal) {
|
||||||
glNormalPointer(GL_FLOAT, VertexSizeBytes, (GLvoid*) (6 * 4));
|
glNormalPointer(GL_BYTE, VertexSizeBytes, (GLvoid*) (6 * 4));
|
||||||
glEnableClientState2(GL_NORMAL_ARRAY);
|
glEnableClientState2(GL_NORMAL_ARRAY);
|
||||||
}
|
}
|
||||||
glVertexPointer2(3, GL_FLOAT, VertexSizeBytes, 0);
|
glVertexPointer2(3, GL_FLOAT, VertexSizeBytes, 0);
|
||||||
@@ -278,11 +278,9 @@ void Tesselator::vertex( float x, float y, float z )
|
|||||||
if (hasColor) {
|
if (hasColor) {
|
||||||
dst.color = src.color;
|
dst.color = src.color;
|
||||||
}
|
}
|
||||||
if (hasNormal) {
|
//if (hasNormal) {
|
||||||
dst.nx = src.nx;
|
// dst.normal = src.normal;
|
||||||
dst.ny = src.ny;
|
//}
|
||||||
dst.nz = src.nz;
|
|
||||||
}
|
|
||||||
|
|
||||||
dst.x = src.x;
|
dst.x = src.x;
|
||||||
dst.y = src.y;
|
dst.y = src.y;
|
||||||
@@ -303,11 +301,9 @@ void Tesselator::vertex( float x, float y, float z )
|
|||||||
if (hasColor) {
|
if (hasColor) {
|
||||||
vertex.color = _color;
|
vertex.color = _color;
|
||||||
}
|
}
|
||||||
if (hasNormal) {
|
//if (hasNormal) {
|
||||||
vertex.nx = _nx;
|
// vertex.normal = _normal;
|
||||||
vertex.ny = _ny;
|
//}
|
||||||
vertex.nz = _nz;
|
|
||||||
}
|
|
||||||
|
|
||||||
vertex.x = _sx * (x + xo);
|
vertex.x = _sx * (x + xo);
|
||||||
vertex.y = _sy * (y + yo);
|
vertex.y = _sy * (y + yo);
|
||||||
@@ -336,22 +332,18 @@ void Tesselator::setAccessMode(int mode)
|
|||||||
|
|
||||||
void Tesselator::normal( float x, float y, float z )
|
void Tesselator::normal( float x, float y, float z )
|
||||||
{
|
{
|
||||||
//static int _warn_t = 0;
|
static int _warn_t = 0;
|
||||||
//if ((++_warn_t & 32767) == 1)
|
if ((++_warn_t & 32767) == 1)
|
||||||
// LOGI("WARNING: Can't use normals (Tesselator::normal)\n");
|
LOGI("WARNING: Can't use normals (Tesselator::normal)\n");
|
||||||
//return;
|
return;
|
||||||
|
|
||||||
if (!tesselating) printf("But..");
|
if (!tesselating) printf("But..");
|
||||||
hasNormal = true;
|
hasNormal = true;
|
||||||
//char xx = (char) (x * 128);
|
char xx = (char) (x * 128);
|
||||||
//char yy = (char) (y * 127);
|
char yy = (char) (y * 127);
|
||||||
//char zz = (char) (z * 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 ) {
|
void Tesselator::offset( float xo, float yo, float zo ) {
|
||||||
@@ -412,10 +404,10 @@ void Tesselator::draw()
|
|||||||
//glColorPointer2(4, GL_UNSIGNED_BYTE, VertexSizeBytes, (GLvoid*) &_varray->color);
|
//glColorPointer2(4, GL_UNSIGNED_BYTE, VertexSizeBytes, (GLvoid*) &_varray->color);
|
||||||
glEnableClientState2(GL_COLOR_ARRAY);
|
glEnableClientState2(GL_COLOR_ARRAY);
|
||||||
}
|
}
|
||||||
if (hasNormal) {
|
//if (hasNormal) {
|
||||||
glNormalPointer(GL_FLOAT, VertexSizeBytes, (GLvoid*) (6 * 4));
|
// glNormalPointer(GL_BYTE, VertexSizeBytes, (GLvoid*) (6 * 4));
|
||||||
glEnableClientState2(GL_NORMAL_ARRAY);
|
// glEnableClientState2(GL_NORMAL_ARRAY);
|
||||||
}
|
//}
|
||||||
//glVertexPointer2(3, GL_FLOAT, VertexSizeBytes, (GLvoid*)&_varray);
|
//glVertexPointer2(3, GL_FLOAT, VertexSizeBytes, (GLvoid*)&_varray);
|
||||||
glVertexPointer2(3, GL_FLOAT, VertexSizeBytes, 0);
|
glVertexPointer2(3, GL_FLOAT, VertexSizeBytes, 0);
|
||||||
glEnableClientState2(GL_VERTEX_ARRAY);
|
glEnableClientState2(GL_VERTEX_ARRAY);
|
||||||
@@ -429,7 +421,7 @@ void Tesselator::draw()
|
|||||||
glDisableClientState2(GL_VERTEX_ARRAY);
|
glDisableClientState2(GL_VERTEX_ARRAY);
|
||||||
if (hasTexture) glDisableClientState2(GL_TEXTURE_COORD_ARRAY);
|
if (hasTexture) glDisableClientState2(GL_TEXTURE_COORD_ARRAY);
|
||||||
if (hasColor) glDisableClientState2(GL_COLOR_ARRAY);
|
if (hasColor) glDisableClientState2(GL_COLOR_ARRAY);
|
||||||
if (hasNormal) glDisableClientState2(GL_NORMAL_ARRAY);
|
//if (hasNormal) glDisableClientState2(GL_NORMAL_ARRAY);
|
||||||
}
|
}
|
||||||
|
|
||||||
clear();
|
clear();
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
extern const int VertexSizeBytes;
|
extern const int VertexSizeBytes;
|
||||||
|
|
||||||
typedef VertexDeclPTCN VERTEX;
|
typedef VertexDeclPTC VERTEX;
|
||||||
typedef std::map<GLuint, GLsizei> IntGLMap;
|
typedef std::map<GLuint, GLsizei> IntGLMap;
|
||||||
|
|
||||||
|
|
||||||
@@ -98,9 +98,7 @@ private:
|
|||||||
float xo, yo, zo;
|
float xo, yo, zo;
|
||||||
float u, v;
|
float u, v;
|
||||||
unsigned int _color;
|
unsigned int _color;
|
||||||
// int _normal; // trying a new thing
|
int _normal;
|
||||||
float _nx, _ny, _nz;
|
|
||||||
|
|
||||||
float _sx, _sy;
|
float _sx, _sy;
|
||||||
|
|
||||||
bool hasColor;
|
bool hasColor;
|
||||||
|
|||||||
@@ -19,10 +19,8 @@
|
|||||||
#include "tileentity/TileEntityRenderer.h"
|
#include "tileentity/TileEntityRenderer.h"
|
||||||
#include "EntityTileRenderer.h"
|
#include "EntityTileRenderer.h"
|
||||||
|
|
||||||
bool TileRenderer::sideTinting = false;
|
TileRenderer::TileRenderer( LevelSource* level /* = NULL */ )
|
||||||
|
: level(level),
|
||||||
TileRenderer::TileRenderer(LevelSource* level /* = NULL */ )
|
|
||||||
: level(level),
|
|
||||||
fixedTexture(-1),
|
fixedTexture(-1),
|
||||||
xFlipTexture(false),
|
xFlipTexture(false),
|
||||||
noCulling(false),
|
noCulling(false),
|
||||||
@@ -60,11 +58,6 @@ bool TileRenderer::tesselateBlockInWorld( Tile* tt, int x, int y, int z, float r
|
|||||||
float c2 = 0.8f;
|
float c2 = 0.8f;
|
||||||
float c3 = 0.6f;
|
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 r11 = c11 * r;
|
||||||
float g11 = c11 * g;
|
float g11 = c11 * g;
|
||||||
@@ -108,10 +101,6 @@ bool TileRenderer::tesselateBlockInWorld( Tile* tt, int x, int y, int z, float r
|
|||||||
if (tt->zz0 > 0) br = centerBrightness;
|
if (tt->zz0 > 0) br = centerBrightness;
|
||||||
t.color(r2 * br, g2 * br, b2 * br);
|
t.color(r2 * br, g2 * br, b2 * br);
|
||||||
renderNorth(tt, xf, yf, zf, tt->getTexture(level, x, y, z, 2));
|
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;
|
changed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -120,10 +109,6 @@ bool TileRenderer::tesselateBlockInWorld( Tile* tt, int x, int y, int z, float r
|
|||||||
if (tt->zz1 < 1) br = centerBrightness;
|
if (tt->zz1 < 1) br = centerBrightness;
|
||||||
t.color(r2 * br, g2 * br, b2 * br);
|
t.color(r2 * br, g2 * br, b2 * br);
|
||||||
renderSouth(tt, xf, yf, zf, tt->getTexture(level, x, y, z, 3));
|
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;
|
changed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -132,10 +117,6 @@ bool TileRenderer::tesselateBlockInWorld( Tile* tt, int x, int y, int z, float r
|
|||||||
if (tt->xx0 > 0) br = centerBrightness;
|
if (tt->xx0 > 0) br = centerBrightness;
|
||||||
t.color(r3 * br, g3 * br, b3 * br);
|
t.color(r3 * br, g3 * br, b3 * br);
|
||||||
renderWest(tt, xf, yf, zf, tt->getTexture(level, x, y, z, 4));
|
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;
|
changed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -144,10 +125,6 @@ bool TileRenderer::tesselateBlockInWorld( Tile* tt, int x, int y, int z, float r
|
|||||||
if (tt->xx1 < 1) br = centerBrightness;
|
if (tt->xx1 < 1) br = centerBrightness;
|
||||||
t.color(r3 * br, g3 * br, b3 * br);
|
t.color(r3 * br, g3 * br, b3 * br);
|
||||||
renderEast(tt, xf, yf, zf, tt->getTexture(level, x, y, z, 5));
|
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;
|
changed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -248,7 +225,7 @@ bool TileRenderer::tesselateTorchInWorld( Tile* tt, int x, int y, int z )
|
|||||||
|
|
||||||
bool TileRenderer::tesselateFireInWorld( Tile* tt, int x, int y, int z )
|
bool TileRenderer::tesselateFireInWorld( Tile* tt, int x, int y, int z )
|
||||||
{
|
{
|
||||||
// fire transparency has been fixed - shredder
|
// @todo: fire alpha transparency seems to be scuffed, also it seems i might have messed up the second layer while porting from lce/java , need to look into it - shredder
|
||||||
|
|
||||||
Tesselator& t = Tesselator::instance;
|
Tesselator& t = Tesselator::instance;
|
||||||
|
|
||||||
@@ -1220,15 +1197,6 @@ bool TileRenderer::tesselateBlockInWorldWithAmbienceOcclusion( Tile* tt, int pX,
|
|||||||
c4g *= ll4;
|
c4g *= ll4;
|
||||||
c4b *= ll4;
|
c4b *= ll4;
|
||||||
renderNorth(tt, (float) pX, (float) pY, (float) pZ, tt->getTexture(level, pX, pY, pZ, 2));
|
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;
|
i = true;
|
||||||
}
|
}
|
||||||
if ((noCulling) || (tt->shouldRenderFace(level, pX, pY, pZ + 1, 3))) {
|
if ((noCulling) || (tt->shouldRenderFace(level, pX, pY, pZ + 1, 3))) {
|
||||||
@@ -1282,15 +1250,6 @@ bool TileRenderer::tesselateBlockInWorldWithAmbienceOcclusion( Tile* tt, int pX,
|
|||||||
c4g *= ll4;
|
c4g *= ll4;
|
||||||
c4b *= ll4;
|
c4b *= ll4;
|
||||||
renderSouth(tt, (float) pX, (float) pY, (float) pZ, tt->getTexture(level, pX, pY, pZ, 3));
|
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;
|
i = true;
|
||||||
}
|
}
|
||||||
if ((noCulling) || (tt->shouldRenderFace(level, pX - 1, pY, pZ, 4))) {
|
if ((noCulling) || (tt->shouldRenderFace(level, pX - 1, pY, pZ, 4))) {
|
||||||
@@ -1343,15 +1302,6 @@ bool TileRenderer::tesselateBlockInWorldWithAmbienceOcclusion( Tile* tt, int pX,
|
|||||||
c4g *= ll4;
|
c4g *= ll4;
|
||||||
c4b *= ll4;
|
c4b *= ll4;
|
||||||
renderWest(tt, (float) pX, (float) pY, (float) pZ, tt->getTexture(level, pX, pY, pZ, 4));
|
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;
|
i = true;
|
||||||
}
|
}
|
||||||
if ((noCulling) || (tt->shouldRenderFace(level, pX + 1, pY, pZ, 5))) {
|
if ((noCulling) || (tt->shouldRenderFace(level, pX + 1, pY, pZ, 5))) {
|
||||||
@@ -1405,15 +1355,6 @@ bool TileRenderer::tesselateBlockInWorldWithAmbienceOcclusion( Tile* tt, int pX,
|
|||||||
c4b *= ll4;
|
c4b *= ll4;
|
||||||
|
|
||||||
renderEast(tt, (float) pX, (float) pY, (float) pZ, tt->getTexture(level, pX, pY, pZ, 5));
|
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;
|
i = true;
|
||||||
}
|
}
|
||||||
applyAmbienceOcclusion = false;
|
applyAmbienceOcclusion = false;
|
||||||
@@ -1462,7 +1403,7 @@ bool TileRenderer::tesselateCactusInWorld(Tile* tt, int x, int y, int z, float r
|
|||||||
if (noCulling || tt->shouldRenderFace(level, x, y - 1, z, 0)) {
|
if (noCulling || tt->shouldRenderFace(level, x, y - 1, z, 0)) {
|
||||||
float br = tt->getBrightness(level, x, y - 1, z);
|
float br = tt->getBrightness(level, x, y - 1, z);
|
||||||
// if (Tile::lightEmission[tt->id] > br*Level.MAX_BRIGHTNESS) br =
|
// if (Tile::lightEmission[tt->id] > br*Level.MAX_BRIGHTNESS) br =
|
||||||
// Tile::lightEmission[tt->id]/Level.MAX_BRIGHTNESS;
|
// Tile::lightEmission[tt->id]/Level.MAX_BRIGHTNESS;
|
||||||
t.color(r10 * br, g10 * br, b10 * br);
|
t.color(r10 * br, g10 * br, b10 * br);
|
||||||
renderFaceDown(tt, X, Y, Z, tt->getTexture(level, x, y, z, 0));
|
renderFaceDown(tt, X, Y, Z, tt->getTexture(level, x, y, z, 0));
|
||||||
changed = true;
|
changed = true;
|
||||||
@@ -1472,7 +1413,7 @@ bool TileRenderer::tesselateCactusInWorld(Tile* tt, int x, int y, int z, float r
|
|||||||
float br = tt->getBrightness(level, x, y + 1, z);
|
float br = tt->getBrightness(level, x, y + 1, z);
|
||||||
if (tt->yy1 != 1 && !tt->material->isLiquid()) br = centerBrightness;
|
if (tt->yy1 != 1 && !tt->material->isLiquid()) br = centerBrightness;
|
||||||
// if (Tile::lightEmission[tt->id] > br*Level.MAX_BRIGHTNESS) br =
|
// if (Tile::lightEmission[tt->id] > br*Level.MAX_BRIGHTNESS) br =
|
||||||
// Tile::lightEmission[tt->id]/Level.MAX_BRIGHTNESS;
|
// Tile::lightEmission[tt->id]/Level.MAX_BRIGHTNESS;
|
||||||
t.color(r11 * br, g11 * br, b11 * br);
|
t.color(r11 * br, g11 * br, b11 * br);
|
||||||
renderFaceUp(tt, X, Y, Z, tt->getTexture(level, x, y, z, 1));
|
renderFaceUp(tt, X, Y, Z, tt->getTexture(level, x, y, z, 1));
|
||||||
changed = true;
|
changed = true;
|
||||||
@@ -1482,7 +1423,7 @@ bool TileRenderer::tesselateCactusInWorld(Tile* tt, int x, int y, int z, float r
|
|||||||
float br = tt->getBrightness(level, x, y, z - 1);
|
float br = tt->getBrightness(level, x, y, z - 1);
|
||||||
if (tt->zz0 > 0) br = centerBrightness;
|
if (tt->zz0 > 0) br = centerBrightness;
|
||||||
// if (Tile::lightEmission[tt->id] > br*Level.MAX_BRIGHTNESS) br =
|
// if (Tile::lightEmission[tt->id] > br*Level.MAX_BRIGHTNESS) br =
|
||||||
// Tile::lightEmission[tt->id]/Level.MAX_BRIGHTNESS;
|
// Tile::lightEmission[tt->id]/Level.MAX_BRIGHTNESS;
|
||||||
t.color(r2 * br, g2 * br, b2 * br);
|
t.color(r2 * br, g2 * br, b2 * br);
|
||||||
t.addOffset(0, 0, s);
|
t.addOffset(0, 0, s);
|
||||||
renderNorth(tt, X, Y, Z, tt->getTexture(level, x, y, z, 2));
|
renderNorth(tt, X, Y, Z, tt->getTexture(level, x, y, z, 2));
|
||||||
@@ -1494,7 +1435,7 @@ bool TileRenderer::tesselateCactusInWorld(Tile* tt, int x, int y, int z, float r
|
|||||||
float br = tt->getBrightness(level, x, y, z + 1);
|
float br = tt->getBrightness(level, x, y, z + 1);
|
||||||
if (tt->zz1 < 1) br = centerBrightness;
|
if (tt->zz1 < 1) br = centerBrightness;
|
||||||
// if (Tile::lightEmission[tt->id] > br*Level.MAX_BRIGHTNESS) br =
|
// if (Tile::lightEmission[tt->id] > br*Level.MAX_BRIGHTNESS) br =
|
||||||
// Tile::lightEmission[tt->id]/Level.MAX_BRIGHTNESS;
|
// Tile::lightEmission[tt->id]/Level.MAX_BRIGHTNESS;
|
||||||
t.color(r2 * br, g2 * br, b2 * br);
|
t.color(r2 * br, g2 * br, b2 * br);
|
||||||
t.addOffset(0, 0, -s);
|
t.addOffset(0, 0, -s);
|
||||||
renderSouth(tt, X, Y, Z, tt->getTexture(level, x, y, z, 3));
|
renderSouth(tt, X, Y, Z, tt->getTexture(level, x, y, z, 3));
|
||||||
@@ -1506,7 +1447,7 @@ bool TileRenderer::tesselateCactusInWorld(Tile* tt, int x, int y, int z, float r
|
|||||||
float br = tt->getBrightness(level, x - 1, y, z);
|
float br = tt->getBrightness(level, x - 1, y, z);
|
||||||
if (tt->xx0 > 0) br = centerBrightness;
|
if (tt->xx0 > 0) br = centerBrightness;
|
||||||
// if (Tile::lightEmission[tt->id] > br*Level.MAX_BRIGHTNESS) br =
|
// if (Tile::lightEmission[tt->id] > br*Level.MAX_BRIGHTNESS) br =
|
||||||
// Tile::lightEmission[tt->id]/Level.MAX_BRIGHTNESS;
|
// Tile::lightEmission[tt->id]/Level.MAX_BRIGHTNESS;
|
||||||
t.color(r3 * br, g3 * br, b3 * br);
|
t.color(r3 * br, g3 * br, b3 * br);
|
||||||
t.addOffset(s, 0, 0);
|
t.addOffset(s, 0, 0);
|
||||||
renderWest(tt, X, Y, Z, tt->getTexture(level, x, y, z, 4));
|
renderWest(tt, X, Y, Z, tt->getTexture(level, x, y, z, 4));
|
||||||
@@ -1518,7 +1459,7 @@ bool TileRenderer::tesselateCactusInWorld(Tile* tt, int x, int y, int z, float r
|
|||||||
float br = tt->getBrightness(level, x + 1, y, z);
|
float br = tt->getBrightness(level, x + 1, y, z);
|
||||||
if (tt->xx1 < 1) br = centerBrightness;
|
if (tt->xx1 < 1) br = centerBrightness;
|
||||||
// if (Tile::lightEmission[tt->id] > br*Level.MAX_BRIGHTNESS) br =
|
// if (Tile::lightEmission[tt->id] > br*Level.MAX_BRIGHTNESS) br =
|
||||||
// Tile::lightEmission[tt->id]/Level.MAX_BRIGHTNESS;
|
// Tile::lightEmission[tt->id]/Level.MAX_BRIGHTNESS;
|
||||||
t.color(r3 * br, g3 * br, b3 * br);
|
t.color(r3 * br, g3 * br, b3 * br);
|
||||||
t.addOffset(-s, 0, 0);
|
t.addOffset(-s, 0, 0);
|
||||||
renderEast(tt, X, Y, Z, tt->getTexture(level, x, y, z, 5));
|
renderEast(tt, X, Y, Z, tt->getTexture(level, x, y, z, 5));
|
||||||
@@ -2368,53 +2309,29 @@ void TileRenderer::renderTile( Tile* tile, int data )
|
|||||||
{
|
{
|
||||||
Tesselator& t = Tesselator::instance;
|
Tesselator& t = Tesselator::instance;
|
||||||
|
|
||||||
t.color(0xff, 0xff, 0xff); // i disabled this, this is normally enabled in normal mcpe see if this fits OPTION_NORMAL_LIGHTING - shredder
|
t.color(0xff, 0xff, 0xff);
|
||||||
int shape = tile->getRenderShape();
|
int shape = tile->getRenderShape();
|
||||||
|
|
||||||
if (shape == Tile::SHAPE_BLOCK) {
|
if (shape == Tile::SHAPE_BLOCK) {
|
||||||
tile->updateDefaultShape();
|
tile->updateDefaultShape();
|
||||||
t.addOffset(-0.5f, -0.5f, -0.5f);
|
t.addOffset(-0.5f, -0.5f, -0.5f);
|
||||||
t.begin();
|
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));
|
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));
|
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));
|
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));
|
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));
|
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));
|
renderEast(tile, 0, 0, 0, tile->getTexture(5, data));
|
||||||
t.draw();
|
t.draw();
|
||||||
|
|
||||||
t.addOffset(0.5f, 0.5f, 0.5f);
|
t.addOffset(0.5f, 0.5f, 0.5f);
|
||||||
|
|
||||||
} else if (shape == Tile::SHAPE_CROSS_TEXTURE) { // uhh java has this but is this even ever used??? - shredder
|
} else if (shape == Tile::SHAPE_CROSS_TEXTURE) {
|
||||||
t.begin();
|
t.begin();
|
||||||
|
|
||||||
t.normal(0.0f, -1.0f, 0.0f);
|
|
||||||
|
|
||||||
tesselateCrossTexture(tile, data, -0.5f, -0.5f, -0.5f);
|
tesselateCrossTexture(tile, data, -0.5f, -0.5f, -0.5f);
|
||||||
t.draw();
|
t.draw();
|
||||||
} else if(shape == Tile::SHAPE_STEM) {
|
} else if(shape == Tile::SHAPE_STEM) {
|
||||||
t.begin();
|
t.begin();
|
||||||
|
|
||||||
t.normal(0.0f, -1.0f, 0.0f);
|
|
||||||
|
|
||||||
tile->updateDefaultShape();
|
tile->updateDefaultShape();
|
||||||
tesselateStemTexture(tile, data, tile->yy1, -0.5f, -0.5f, -0.5f);
|
tesselateStemTexture(tile, data, tile->yy1, -0.5f, -0.5f, -0.5f);
|
||||||
t.draw();
|
t.draw();
|
||||||
@@ -2423,39 +2340,16 @@ void TileRenderer::renderTile( Tile* tile, int data )
|
|||||||
t.offset(-0.5f, -0.5f, -0.5f);
|
t.offset(-0.5f, -0.5f, -0.5f);
|
||||||
float s = 1 / 16.0f;
|
float s = 1 / 16.0f;
|
||||||
t.begin();
|
t.begin();
|
||||||
|
|
||||||
t.normal(0.0f, -1.0f, 0.0f);
|
|
||||||
|
|
||||||
renderFaceDown(tile, 0, 0, 0, tile->getTexture(0));
|
renderFaceDown(tile, 0, 0, 0, tile->getTexture(0));
|
||||||
|
|
||||||
t.normal(0.0f, 1.0f, 0.0f);
|
|
||||||
|
|
||||||
renderFaceUp(tile, 0, 0, 0, tile->getTexture(1));
|
renderFaceUp(tile, 0, 0, 0, tile->getTexture(1));
|
||||||
|
|
||||||
t.normal(0.0f, 0.0f, -1.0f);
|
|
||||||
|
|
||||||
t.addOffset(0, 0, s);
|
t.addOffset(0, 0, s);
|
||||||
|
|
||||||
|
|
||||||
renderNorth(tile, 0, 0, 0, tile->getTexture(2));
|
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);
|
||||||
t.addOffset(0, 0, -s);
|
t.addOffset(0, 0, -s);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
renderSouth(tile, 0, 0, 0, tile->getTexture(3));
|
renderSouth(tile, 0, 0, 0, tile->getTexture(3));
|
||||||
|
|
||||||
t.normal(-1.0f, 0.0f, 0.0f);
|
|
||||||
|
|
||||||
t.addOffset(0, 0, s);
|
t.addOffset(0, 0, s);
|
||||||
t.addOffset(s, 0, 0);
|
t.addOffset(s, 0, 0);
|
||||||
renderWest(tile, 0, 0, 0, tile->getTexture(4));
|
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);
|
||||||
t.addOffset(-s, 0, 0);
|
t.addOffset(-s, 0, 0);
|
||||||
renderEast(tile, 0, 0, 0, tile->getTexture(5));
|
renderEast(tile, 0, 0, 0, tile->getTexture(5));
|
||||||
@@ -2469,7 +2363,7 @@ void TileRenderer::renderTile( Tile* tile, int data )
|
|||||||
//} else if (shape == Tile::SHAPE_TORCH) {
|
//} else if (shape == Tile::SHAPE_TORCH) {
|
||||||
//// t.begin();
|
//// t.begin();
|
||||||
//// t.normal(0, -1, 0);
|
//// 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();
|
//// t.end();
|
||||||
} else if (shape == Tile::SHAPE_ENTITYTILE_ANIMATED) {
|
} else if (shape == Tile::SHAPE_ENTITYTILE_ANIMATED) {
|
||||||
EntityTileRenderer::instance->render(tile, data, 1.0f);
|
EntityTileRenderer::instance->render(tile, data, 1.0f);
|
||||||
@@ -2481,23 +2375,11 @@ void TileRenderer::renderTile( Tile* tile, int data )
|
|||||||
if (i == 0) tile->setShape(0, 0, 0, 1, 1, 0.5f);
|
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);
|
if (i == 1) tile->setShape(0, 0, 0.5f, 1, 0.5f, 1);
|
||||||
|
|
||||||
|
|
||||||
t.normal(0.0f, -1.0f, 0.0f);
|
|
||||||
renderFaceDown(tile, 0, 0, 0, tile->getTexture(0));
|
renderFaceDown(tile, 0, 0, 0, tile->getTexture(0));
|
||||||
|
|
||||||
t.normal(0.0f, 1.0f, 0.0f);
|
|
||||||
renderFaceUp(tile, 0, 0, 0, tile->getTexture(1));
|
renderFaceUp(tile, 0, 0, 0, tile->getTexture(1));
|
||||||
|
|
||||||
t.normal(0.0f, 0.0f, -1.0f);
|
|
||||||
renderNorth(tile, 0, 0, 0, tile->getTexture(2));
|
renderNorth(tile, 0, 0, 0, tile->getTexture(2));
|
||||||
|
|
||||||
t.normal(0.0f, 0.0f, 1.0f);
|
|
||||||
renderSouth(tile, 0, 0, 0, tile->getTexture(3));
|
renderSouth(tile, 0, 0, 0, tile->getTexture(3));
|
||||||
|
|
||||||
t.normal(-1.0f, 0.0f, 0.0f);
|
|
||||||
renderWest(tile, 0, 0, 0, tile->getTexture(4));
|
renderWest(tile, 0, 0, 0, tile->getTexture(4));
|
||||||
|
|
||||||
t.normal(1.0f, 0.0f, 0.0f);
|
|
||||||
renderEast(tile, 0, 0, 0, tile->getTexture(5));
|
renderEast(tile, 0, 0, 0, tile->getTexture(5));
|
||||||
}
|
}
|
||||||
t.draw();
|
t.draw();
|
||||||
@@ -2514,22 +2396,11 @@ void TileRenderer::renderTile( Tile* tile, int data )
|
|||||||
if (i == 2) tile->setShape(0.5f - w, 1 - w * 3, -w * 2, 0.5f + w, 1 - w, 1 + w * 2);
|
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);
|
if (i == 3) tile->setShape(0.5f - w, 0.5f - w * 3, -w * 2, 0.5f + w, 0.5f - w, 1 + w * 2);
|
||||||
|
|
||||||
t.normal(0.0f, -1.0f, 0.0f);
|
|
||||||
renderFaceDown(tile, 0, 0, 0, tile->getTexture(0));
|
renderFaceDown(tile, 0, 0, 0, tile->getTexture(0));
|
||||||
|
|
||||||
t.normal(0.0f, 1.0f, 0.0f);
|
|
||||||
renderFaceUp(tile, 0, 0, 0, tile->getTexture(1));
|
renderFaceUp(tile, 0, 0, 0, tile->getTexture(1));
|
||||||
|
|
||||||
t.normal(0.0f, 0.0f, -1.0f);
|
|
||||||
renderNorth(tile, 0, 0, 0, tile->getTexture(2));
|
renderNorth(tile, 0, 0, 0, tile->getTexture(2));
|
||||||
|
|
||||||
t.normal(0.0f, 0.0f, 1.0f);
|
|
||||||
renderSouth(tile, 0, 0, 0, tile->getTexture(3));
|
renderSouth(tile, 0, 0, 0, tile->getTexture(3));
|
||||||
|
|
||||||
t.normal(-1.0f, 0.0f, 0.0f);
|
|
||||||
renderWest(tile, 0, 0, 0, tile->getTexture(4));
|
renderWest(tile, 0, 0, 0, tile->getTexture(4));
|
||||||
|
|
||||||
t.normal(1.0f, 0.0f, 0.0f);
|
|
||||||
renderEast(tile, 0, 0, 0, tile->getTexture(5));
|
renderEast(tile, 0, 0, 0, tile->getTexture(5));
|
||||||
}
|
}
|
||||||
t.draw();
|
t.draw();
|
||||||
@@ -2544,22 +2415,11 @@ void TileRenderer::renderTile( Tile* tile, int data )
|
|||||||
if (i == 1) tile->setShape(0.5f - w, .3f, 1 - w * 2, 0.5f + w, 1, 1);
|
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);
|
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);
|
renderFaceUp(tile, 0, 0, 0, tile->getTexture(0));
|
||||||
renderFaceDown(tile, 0, 0, 0, tile->getTexture(0));
|
renderFaceDown(tile, 0, 0, 0, tile->getTexture(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));
|
renderNorth(tile, 0, 0, 0, tile->getTexture(2));
|
||||||
|
|
||||||
t.normal(0.0f, 0.0f, 1.0f);
|
|
||||||
renderSouth(tile, 0, 0, 0, tile->getTexture(3));
|
renderSouth(tile, 0, 0, 0, tile->getTexture(3));
|
||||||
|
|
||||||
t.normal(-1.0f, 0.0f, 0.0f);
|
|
||||||
renderWest(tile, 0, 0, 0, tile->getTexture(4));
|
renderWest(tile, 0, 0, 0, tile->getTexture(4));
|
||||||
|
|
||||||
t.normal(1.0f, 0.0f, 0.0f);
|
|
||||||
renderEast(tile, 0, 0, 0, tile->getTexture(5));
|
renderEast(tile, 0, 0, 0, tile->getTexture(5));
|
||||||
}
|
}
|
||||||
t.draw();
|
t.draw();
|
||||||
@@ -2609,7 +2469,7 @@ void TileRenderer::renderGuiTile( Tile* tile, int data )
|
|||||||
|
|
||||||
} else if (shape == Tile::SHAPE_CROSS_TEXTURE) {
|
} else if (shape == Tile::SHAPE_CROSS_TEXTURE) {
|
||||||
t.begin();
|
t.begin();
|
||||||
t.normal(0, -1, 0);
|
//t.normal(0, -1, 0);
|
||||||
tesselateCrossTexture(tile, data, -0.5f, -0.5f, -0.5f);
|
tesselateCrossTexture(tile, data, -0.5f, -0.5f, -0.5f);
|
||||||
//t.end();
|
//t.end();
|
||||||
t.draw();
|
t.draw();
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ class ThinFenceTile;
|
|||||||
class StairTile;
|
class StairTile;
|
||||||
class LevelSource;
|
class LevelSource;
|
||||||
class Material;
|
class Material;
|
||||||
class Minecraft;
|
|
||||||
|
|
||||||
class TileRenderer
|
class TileRenderer
|
||||||
{
|
{
|
||||||
@@ -61,10 +60,6 @@ public:
|
|||||||
void renderTile(Tile* tile, int data);
|
void renderTile(Tile* tile, int data);
|
||||||
void renderGuiTile(Tile* tile, int data);
|
void renderGuiTile(Tile* tile, int data);
|
||||||
|
|
||||||
static void setUseTint(bool value) {
|
|
||||||
sideTinting = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool canRender(int renderShape);
|
static bool canRender(int renderShape);
|
||||||
private:
|
private:
|
||||||
float getWaterHeight(int x, int y, int z, const Material* m);
|
float getWaterHeight(int x, int y, int z, const Material* m);
|
||||||
@@ -73,7 +68,6 @@ private:
|
|||||||
int fixedTexture;
|
int fixedTexture;
|
||||||
bool xFlipTexture;
|
bool xFlipTexture;
|
||||||
bool noCulling;
|
bool noCulling;
|
||||||
static bool sideTinting;
|
|
||||||
|
|
||||||
bool applyAmbienceOcclusion;
|
bool applyAmbienceOcclusion;
|
||||||
float ll000, llx00, ll0y0, ll00z, llX00, ll0Y0, ll00Z;
|
float ll000, llx00, ll0y0, ll00z, llX00, ll0Y0, ll00Z;
|
||||||
|
|||||||
@@ -14,8 +14,7 @@ typedef struct VertexDeclPTCN
|
|||||||
GLfloat x, y, z;
|
GLfloat x, y, z;
|
||||||
GLfloat u, v;
|
GLfloat u, v;
|
||||||
GLuint color;
|
GLuint color;
|
||||||
// GLuint normal; // trying a new thing
|
GLuint normal;
|
||||||
GLfloat nx, ny, nz;
|
|
||||||
|
|
||||||
} VertexDeclPTCN;
|
} VertexDeclPTCN;
|
||||||
|
|
||||||
|
|||||||
@@ -40,18 +40,18 @@ EntityRenderDispatcher::EntityRenderDispatcher()
|
|||||||
{
|
{
|
||||||
//@note: The Models (model/armor) will be deleted by resp. MobRenderer
|
//@note: The Models (model/armor) will be deleted by resp. MobRenderer
|
||||||
assign( ER_ITEM_RENDERER, new ItemRenderer());
|
assign( ER_ITEM_RENDERER, new ItemRenderer());
|
||||||
assign( ER_HUMANOID_RENDERER, new HumanoidMobRenderer(new HumanoidModel(), 0.5));
|
assign( ER_HUMANOID_RENDERER, new HumanoidMobRenderer(new HumanoidModel(), 0));
|
||||||
assign( ER_PIG_RENDERER, new PigRenderer(new PigModel(0.5), NULL/*new PigModel(0.5f)*/, 0.7));
|
assign( ER_PIG_RENDERER, new PigRenderer(new PigModel(), NULL/*new PigModel(0.5f)*/, 0));
|
||||||
assign( ER_COW_RENDERER, new MobRenderer(new CowModel(), 0.7));
|
assign( ER_COW_RENDERER, new MobRenderer(new CowModel(), 0));
|
||||||
assign( ER_CHICKEN_RENDERER, new ChickenRenderer( new ChickenModel(), 0.3));
|
assign( ER_CHICKEN_RENDERER, new ChickenRenderer( new ChickenModel(), 0));
|
||||||
assign( ER_SHEEP_RENDERER, new SheepRenderer(new SheepModel(), new SheepFurModel(), 0.7));
|
assign( ER_SHEEP_RENDERER, new SheepRenderer(new SheepModel(), new SheepFurModel(), 0));
|
||||||
assign( ER_SKELETON_RENDERER, new HumanoidMobRenderer(new SkeletonModel(), 0.5f));
|
assign( ER_SKELETON_RENDERER, new HumanoidMobRenderer(new SkeletonModel(), 0.5f));
|
||||||
assign( ER_ZOMBIE_RENDERER, new HumanoidMobRenderer(new ZombieModel(), 0.5f));
|
assign( ER_ZOMBIE_RENDERER, new HumanoidMobRenderer(new ZombieModel(), 0.5f));
|
||||||
assign( ER_CREEPER_RENDERER, new CreeperRenderer());
|
assign( ER_CREEPER_RENDERER, new CreeperRenderer());
|
||||||
assign( ER_SPIDER_RENDERER, new SpiderRenderer());
|
assign( ER_SPIDER_RENDERER, new SpiderRenderer());
|
||||||
assign( ER_TNT_RENDERER, new TntRenderer());
|
assign( ER_TNT_RENDERER, new TntRenderer());
|
||||||
assign( ER_ARROW_RENDERER, new ArrowRenderer());
|
assign( ER_ARROW_RENDERER, new ArrowRenderer());
|
||||||
assign( ER_PLAYER_RENDERER, new PlayerRenderer(new HumanoidModel(0, 0, 64, 64), 0.5));
|
assign( ER_PLAYER_RENDERER, new PlayerRenderer(new HumanoidModel(0, 0, 64, 64), 0));
|
||||||
assign( ER_THROWNEGG_RENDERER, new ItemSpriteRenderer(Item::egg->getIcon(0)));
|
assign( ER_THROWNEGG_RENDERER, new ItemSpriteRenderer(Item::egg->getIcon(0)));
|
||||||
assign( ER_SNOWBALL_RENDERER, new ItemSpriteRenderer(Item::snowBall->getIcon(0)));
|
assign( ER_SNOWBALL_RENDERER, new ItemSpriteRenderer(Item::snowBall->getIcon(0)));
|
||||||
assign( ER_PAINTING_RENDERER, new PaintingRenderer());
|
assign( ER_PAINTING_RENDERER, new PaintingRenderer());
|
||||||
@@ -133,7 +133,7 @@ void EntityRenderDispatcher::render( Entity* entity, float x, float y, float z,
|
|||||||
EntityRenderer* renderer = getRenderer(entity);
|
EntityRenderer* renderer = getRenderer(entity);
|
||||||
if (renderer != NULL) {
|
if (renderer != NULL) {
|
||||||
renderer->render(entity, x, y, z, rot, a);
|
renderer->render(entity, x, y, z, rot, a);
|
||||||
renderer->postRender(entity, x, y, z, rot, a);
|
//renderer->postRender(entity, x, y, z, rot, a);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,18 +5,11 @@
|
|||||||
#include "../gles.h"
|
#include "../gles.h"
|
||||||
#include "../../../world/phys/AABB.h"
|
#include "../../../world/phys/AABB.h"
|
||||||
#include "EntityRenderDispatcher.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;
|
EntityRenderDispatcher* EntityRenderer::entityRenderDispatcher = NULL;
|
||||||
|
|
||||||
EntityRenderer::EntityRenderer()
|
EntityRenderer::EntityRenderer()
|
||||||
: shadowRadius(0),
|
: shadowRadius(0),
|
||||||
shadowStrength(1.0f)
|
shadowStrength(1.0f)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
@@ -43,37 +36,37 @@ void EntityRenderer::render(const AABB& bb, float xo, float yo, float zo) {
|
|||||||
glColor4f2(1, 1, 1, 1);
|
glColor4f2(1, 1, 1, 1);
|
||||||
t.begin();
|
t.begin();
|
||||||
t.offset(xo, yo, zo);
|
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.x0, bb.y1, bb.z0);
|
||||||
t.vertex(bb.x1, bb.y1, bb.z0);
|
t.vertex(bb.x1, bb.y1, bb.z0);
|
||||||
t.vertex(bb.x1, bb.y0, bb.z0);
|
t.vertex(bb.x1, bb.y0, bb.z0);
|
||||||
t.vertex(bb.x0, 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.x0, bb.y0, bb.z1);
|
||||||
t.vertex(bb.x1, bb.y0, bb.z1);
|
t.vertex(bb.x1, bb.y0, bb.z1);
|
||||||
t.vertex(bb.x1, bb.y1, bb.z1);
|
t.vertex(bb.x1, bb.y1, bb.z1);
|
||||||
t.vertex(bb.x0, 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.x0, bb.y0, bb.z0);
|
||||||
t.vertex(bb.x1, bb.y0, bb.z0);
|
t.vertex(bb.x1, bb.y0, bb.z0);
|
||||||
t.vertex(bb.x1, bb.y0, bb.z1);
|
t.vertex(bb.x1, bb.y0, bb.z1);
|
||||||
t.vertex(bb.x0, 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.x0, bb.y1, bb.z1);
|
||||||
t.vertex(bb.x1, bb.y1, bb.z1);
|
t.vertex(bb.x1, bb.y1, bb.z1);
|
||||||
t.vertex(bb.x1, bb.y1, bb.z0);
|
t.vertex(bb.x1, bb.y1, bb.z0);
|
||||||
t.vertex(bb.x0, 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.y0, bb.z1);
|
||||||
t.vertex(bb.x0, bb.y1, bb.z1);
|
t.vertex(bb.x0, bb.y1, bb.z1);
|
||||||
t.vertex(bb.x0, bb.y1, bb.z0);
|
t.vertex(bb.x0, bb.y1, bb.z0);
|
||||||
t.vertex(bb.x0, bb.y0, 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.y0, bb.z0);
|
||||||
t.vertex(bb.x1, bb.y1, bb.z0);
|
t.vertex(bb.x1, bb.y1, bb.z0);
|
||||||
t.vertex(bb.x1, bb.y1, bb.z1);
|
t.vertex(bb.x1, bb.y1, bb.z1);
|
||||||
@@ -123,214 +116,134 @@ Font* EntityRenderer::getFont() {
|
|||||||
return entityRenderDispatcher->getFont();
|
return entityRenderDispatcher->getFont();
|
||||||
}
|
}
|
||||||
|
|
||||||
void EntityRenderer::postRender(Entity* entity, float x, float y, float z, float rot, float a) {
|
//void 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) {
|
// if (entityRenderDispatcher.options.fancyGraphics && shadowRadius > 0) {
|
||||||
float dist = entityRenderDispatcher->distanceToSqr(entity->x, entity->y, entity->z);
|
// float dist = entityRenderDispatcher.distanceToSqr(entity.x, entity.y, entity.z);
|
||||||
float pow = (float) ((1 - dist / (16.0f * 16.0f)) * shadowStrength);
|
// float pow = (float) ((1 - dist / (16.0f * 16.0f)) * shadowStrength);
|
||||||
if (pow > 0) {
|
// if (pow > 0) {
|
||||||
renderShadow(entity, x, y, z, pow, a);
|
// renderShadow(entity, x, y, z, pow, a);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
if (entity->isOnFire()) renderFlame(entity, x, y, z, 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;
|
|
||||||
|
|
||||||
int xt = (tex & 0xf) << 4;
|
//void renderFlame(Entity e, float x, float y, float z, float a) {
|
||||||
int yt = tex & 0xf0;
|
// glDisable2(GL_LIGHTING);
|
||||||
|
// int tex = Tile.fire.tex;
|
||||||
|
|
||||||
float u0 = (xt) / 256.0f;
|
// int xt = (tex & 0xf) << 4;
|
||||||
float u1 = (xt + 15.99f) / 256.0f;
|
// int yt = tex & 0xf0;
|
||||||
float v0 = (yt) / 256.0f;
|
|
||||||
float v1 = (yt + 15.99f) / 256.0f;
|
|
||||||
|
|
||||||
glPushMatrix2();
|
// float u0 = (xt) / 256.0f;
|
||||||
glTranslatef2((float) x, (float) y, (float) z);
|
// float u1 = (xt + 15.99f) / 256.0f;
|
||||||
|
// float v0 = (yt) / 256.0f;
|
||||||
|
// float v1 = (yt + 15.99f) / 256.0f;
|
||||||
|
|
||||||
float s = e->bbWidth * 1.4f;
|
// glPushMatrix2();
|
||||||
glScalef2(s, s, s);
|
// glTranslatef2((float) x, (float) y, (float) z);
|
||||||
bindTexture("terrain.png");
|
|
||||||
Tesselator& t = Tesselator::instance;
|
|
||||||
|
|
||||||
float r = 1.0f;
|
// float s = e.bbWidth * 1.4f;
|
||||||
float xo = 0.5f;
|
// glScalef2(s, s, s);
|
||||||
float yo = 0.0f;
|
// bindTexture("terrain.png");
|
||||||
|
// Tesselator t = Tesselator.instance;
|
||||||
|
|
||||||
float h = e->bbHeight / e->bbWidth;
|
// float r = 1.0f;
|
||||||
|
// float xo = 0.5f;
|
||||||
|
// float yo = 0.0f;
|
||||||
|
|
||||||
glRotatef2(-entityRenderDispatcher->playerRotY, 0, 1, 0);
|
// float h = e.bbHeight / e.bbWidth;
|
||||||
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;
|
|
||||||
|
|
||||||
int xt = (tex & 0xf) << 4;
|
// glRotatef2(-entityRenderDispatcher.playerRotY, 0, 1, 0);
|
||||||
int yt = tex & 0xf0;
|
// 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);
|
||||||
|
//}
|
||||||
|
|
||||||
float u0 = (xt) / 256.0f;
|
//void renderShadow(Entity e, float x, float y, float z, float pow, float a) {
|
||||||
float u1 = (xt + 15.99f) / 256.0f;
|
// glEnable2(GL_BLEND);
|
||||||
float v0 = (yt) / 256.0f;
|
// glBlendFunc2(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
float v1 = (yt + 15.99f) / 256.0f;
|
|
||||||
|
|
||||||
glPushMatrix2();
|
// Textures textures = entityRenderDispatcher.textures;
|
||||||
glTranslatef2((float) x, (float) y, (float) z);
|
// textures.bind(textures.loadTexture("%clamp%/misc/shadow.png"));
|
||||||
|
|
||||||
float s = e->bbWidth * 1.4f;
|
// Level level = getLevel();
|
||||||
glScalef2(s, s, s);
|
|
||||||
bindTexture("terrain.png");
|
|
||||||
Tesselator& t = Tesselator::instance;
|
|
||||||
|
|
||||||
float r = 0.5f;
|
// glDepthMask(false);
|
||||||
float xo = 0.0f;
|
// float r = shadowRadius;
|
||||||
|
|
||||||
float h = e->bbHeight / s;
|
// float ex = e.xOld + (e.x - e.xOld) * a;
|
||||||
float yo = (float)(e->y - e->bb.y0) / s;
|
// float ey = e.yOld + (e.y - e.yOld) * a + e.getShadowHeightOffs();
|
||||||
|
// float ez = e.zOld + (e.z - e.zOld) * a;
|
||||||
|
|
||||||
glRotatef2(-entityRenderDispatcher->playerRotY, 0, 1, 0);
|
// int x0 = Mth.floor(ex - r);
|
||||||
glTranslatef2(0, 0, -0.3f + ((int) h) * 0.02f);
|
// int x1 = Mth.floor(ex + r);
|
||||||
glColor4f2(1, 1, 1, 1);
|
// int y0 = Mth.floor(ey - r);
|
||||||
|
// int y1 = Mth.floor(ey);
|
||||||
|
// int z0 = Mth.floor(ez - r);
|
||||||
|
// int z1 = Mth.floor(ez + r);
|
||||||
|
|
||||||
float zo = 0.0f;
|
// float xo = x - ex;
|
||||||
int cycle_counter = 0;
|
// float yo = y - ey;
|
||||||
|
// float zo = z - ez;
|
||||||
|
|
||||||
t.begin();
|
// Tesselator tt = Tesselator.instance;
|
||||||
while (h > 0.0f) {
|
// tt.begin();
|
||||||
float current_u0 = u0;
|
// for (int xt = x0; xt <= x1; xt++)
|
||||||
float current_u1 = u1;
|
// for (int yt = y0; yt <= y1; yt++)
|
||||||
float current_v0 = v0;
|
// for (int zt = z0; zt <= z1; zt++) {
|
||||||
float current_v1 = v1;
|
// 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) {
|
// glColor4f2(1, 1, 1, 1);
|
||||||
current_v0 = (yt + 16) / 256.0f;
|
// glDisable2(GL_BLEND);
|
||||||
current_v1 = (yt + 16 + 15.99f) / 256.0f;
|
// glDepthMask(true);
|
||||||
}
|
//}
|
||||||
|
|
||||||
if ((cycle_counter / 2) % 2 == 0) {
|
//Level* getLevel() {
|
||||||
float tmp = current_u1;
|
// return entityRenderDispatcher.level;
|
||||||
current_u1 = current_u0;
|
//}
|
||||||
current_u0 = tmp;
|
|
||||||
}
|
|
||||||
|
|
||||||
t.vertexUV(r - xo, 0.0f - yo, zo, current_u1, current_v1);
|
//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) {
|
||||||
t.vertexUV(-r - xo, 0.0f - yo, zo, current_u0, current_v1);
|
// Tesselator t = Tesselator.instance;
|
||||||
t.vertexUV(-r - xo, 1.4f - yo, zo, current_u0, current_v0);
|
// if (!tt.isCubeShaped()) return;
|
||||||
t.vertexUV(r - xo, 1.4f - yo, zo, current_u1, current_v0);
|
|
||||||
|
|
||||||
h -= 0.45f;
|
// float a = ((pow - (y - (yt + yo)) / 2) * 0.5f) * getLevel().getBrightness(xt, yt, zt);
|
||||||
yo -= 0.45f;
|
// if (a < 0) return;
|
||||||
r *= 0.9f;
|
// if (a > 1) a = 1;
|
||||||
zo += 0.03f;
|
// t.color(1, 1, 1, (float) a);
|
||||||
cycle_counter++;
|
// // glColor4f2(1, 1, 1, (float) a);
|
||||||
}
|
|
||||||
t.draw();
|
|
||||||
|
|
||||||
glPopMatrix2();
|
// float x0 = xt + tt.xx0 + xo;
|
||||||
glEnable2(GL_LIGHTING);
|
// 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;
|
||||||
|
|
||||||
void EntityRenderer::renderShadow(Entity* e, float x, float y, float z, float pow, float a) { //
|
// float u0 = (float) ((x - (x0)) / 2 / r + 0.5f);
|
||||||
glEnable2(GL_BLEND);
|
// float u1 = (float) ((x - (x1)) / 2 / r + 0.5f);
|
||||||
glBlendFunc2(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
// float v0 = (float) ((z - (z0)) / 2 / r + 0.5f);
|
||||||
|
// float v1 = (float) ((z - (z1)) / 2 / r + 0.5f);
|
||||||
|
|
||||||
//Textures* textures = entityRenderDispatcher->textures;
|
// t.vertexUV(x0, y0, z0, u0, v0);
|
||||||
//textures->bind(textures->loadTexture("%clamp%/environment/shadow.png"));
|
// t.vertexUV(x0, y0, z1, u0, v1);
|
||||||
Textures* textures = entityRenderDispatcher->textures;
|
// t.vertexUV(x1, y0, z1, u1, v1);
|
||||||
textures->loadAndBindTexture("/misc/shadow.png");
|
// t.vertexUV(x1, y0, z0, u1, v0);
|
||||||
|
//}
|
||||||
|
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
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);
|
|
||||||
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, 1, 1, (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);
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -12,8 +12,6 @@ class EntityRenderDispatcher;
|
|||||||
class Entity;
|
class Entity;
|
||||||
class AABB;
|
class AABB;
|
||||||
class Font;
|
class Font;
|
||||||
class Tile;
|
|
||||||
class Level;
|
|
||||||
|
|
||||||
class EntityRenderer
|
class EntityRenderer
|
||||||
{
|
{
|
||||||
@@ -26,11 +24,6 @@ public:
|
|||||||
virtual void render(Entity* entity, float x, float y, float z, float rot, float a) = 0;
|
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 render(const AABB& bb, float xo, float yo, float zo);
|
||||||
static void renderFlat(const AABB& bb);
|
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();
|
Font* getFont();
|
||||||
|
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ void ItemRenderer::render(Entity* itemEntity_, float x, float y, float z, float
|
|||||||
else if (item->count > 1) count = 2;
|
else if (item->count > 1) count = 2;
|
||||||
|
|
||||||
glTranslatef2((float) x, (float) y + bob, (float) z);
|
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())) {
|
if (item->id < 256 && TileRenderer::canRender(Tile::tiles[item->id]->getRenderShape())) {
|
||||||
glRotatef2(spin, 0, 1, 0);
|
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);
|
glRotatef2(180 - entityRenderDispatcher->playerRotY, 0, 1, 0);
|
||||||
t.begin();
|
t.begin();
|
||||||
t.normal(0, 1, 0);
|
//t.normal(0, 1, 0);
|
||||||
t.vertexUV(0 - xo, 0 - yo, 0, u0, v1);
|
t.vertexUV(0 - xo, 0 - yo, 0, u0, v1);
|
||||||
t.vertexUV(r - xo, 0 - yo, 0, u1, v1);
|
t.vertexUV(r - xo, 0 - yo, 0, u1, v1);
|
||||||
t.vertexUV(r - xo, 1 - yo, 0, u1, v0);
|
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();
|
glPopMatrix2();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
glDisable2(GL_RESCALE_NORMAL);
|
//glDisable2(GL_RESCALE_NORMAL);
|
||||||
glPopMatrix2();
|
glPopMatrix2();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -226,42 +226,7 @@ void ItemRenderer::renderGuiItem(Font* font, Textures* textures, const ItemInsta
|
|||||||
t.draw();
|
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) return;
|
||||||
if (item->count > 0 && item->isDamaged()) {
|
if (item->count > 0 && item->isDamaged()) {
|
||||||
float p = std::floor(13.5f - (float) item->getDamageValue() * 13.0f / (float) item->getMaxDamage());
|
float p = std::floor(13.5f - (float) item->getDamageValue() * 13.0f / (float) item->getMaxDamage());
|
||||||
|
|||||||
@@ -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, bool fancy);
|
||||||
static void renderGuiItem(Font* font, Textures* textures, const ItemInstance* item, float x, float y, float w, float h, 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);
|
static void renderGuiItemCorrect(Font* font, Textures* textures, const ItemInstance* item, int x, int y);
|
||||||
static void renderGuiItemDecorations(Font* font, Textures* textures, ItemInstance* item, int x, int y);
|
//void renderGuiItemDecorations(Font* font, Textures* textures, ItemInstance* item, int x, int y);
|
||||||
static void renderGuiItemDecorations(const ItemInstance* item, float x, float 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);
|
static void blit(float x, float y, float sx, float sy, float w, float h);
|
||||||
|
|||||||
@@ -135,7 +135,7 @@ void MobRenderer::render(Entity* e, float x, float y, float z, float rot, float
|
|||||||
//glEnable2(GL_DEPTH_TEST);
|
//glEnable2(GL_DEPTH_TEST);
|
||||||
|
|
||||||
glPopMatrix2();
|
glPopMatrix2();
|
||||||
postRender(mob, x, y, z, rot, a);
|
|
||||||
renderName(mob, x, y, z);
|
renderName(mob, x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -187,12 +187,10 @@ void MobRenderer::scale(Mob* mob, float a) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MobRenderer::renderName(Mob* mob, float x, float y, float z) {
|
void MobRenderer::renderName(Mob* mob, float x, float y, float z) {
|
||||||
|
/*
|
||||||
std::stringstream ss; ss << mob->entityId;
|
std::stringstream ss; ss << mob->entityId;
|
||||||
if (entityRenderDispatcher->minecraft->options.getBooleanValue(OPTIONS_RENDER_DEBUG)) {
|
|
||||||
renderNameTag(mob, ss.str(), x, y, z, 64);
|
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) {
|
void MobRenderer::renderNameTag(Mob* mob, const std::string& name, float x, float y, float z, int maxDist) {
|
||||||
@@ -207,19 +205,13 @@ void MobRenderer::renderNameTag(Mob* mob, const std::string& name, float x, floa
|
|||||||
float s = 1 / 60.0f * size;
|
float s = 1 / 60.0f * size;
|
||||||
|
|
||||||
glPushMatrix2();
|
glPushMatrix2();
|
||||||
if (mob->isPlayer()){
|
glTranslatef2((float) x + 0, (float) y + 1.0f /*2.3f*/, (float) z);
|
||||||
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->playerRotY, 0, 1, 0);
|
||||||
glRotatef2(entityRenderDispatcher->playerRotX, 1, 0, 0);
|
glRotatef2(entityRenderDispatcher->playerRotX, 1, 0, 0);
|
||||||
|
|
||||||
glScalef2(-s, -s, s);
|
glScalef2(-s, -s, s);
|
||||||
|
|
||||||
glDisable(GL_LIGHTING);
|
|
||||||
|
|
||||||
glDepthMask(false);
|
glDepthMask(false);
|
||||||
glDisable2(GL_DEPTH_TEST);
|
glDisable2(GL_DEPTH_TEST);
|
||||||
glEnable2(GL_BLEND);
|
glEnable2(GL_BLEND);
|
||||||
@@ -243,7 +235,6 @@ void MobRenderer::renderNameTag(Mob* mob, const std::string& name, float x, floa
|
|||||||
|
|
||||||
glDepthMask(true);
|
glDepthMask(true);
|
||||||
font->draw(name, (float) fnameWidth, 0, 0xffffffff);
|
font->draw(name, (float) fnameWidth, 0, 0xffffffff);
|
||||||
glEnable(GL_LIGHTING);
|
|
||||||
glDisable2(GL_BLEND);
|
glDisable2(GL_BLEND);
|
||||||
glColor4f2(1, 1, 1, 1);
|
glColor4f2(1, 1, 1, 1);
|
||||||
glPopMatrix2();
|
glPopMatrix2();
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ void PaintingRenderer::render( Entity* entity, float x, float y, float z, float
|
|||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glTranslatef(float(x), float(y), float(z));
|
glTranslatef(float(x), float(y), float(z));
|
||||||
glRotatef(rot, 0, 1.0f, 0);
|
glRotatef(rot, 0, 1.0f, 0);
|
||||||
glEnable(GL_RESCALE_NORMAL);
|
//glEnable(GL_RESCALE_NORMAL);
|
||||||
bindTexture("art/kz.png");
|
bindTexture("art/kz.png");
|
||||||
Painting* painting = (Painting*)entity;
|
Painting* painting = (Painting*)entity;
|
||||||
const Motive* motive = painting->motive;
|
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;
|
float s = 1.0f / 16.0f;
|
||||||
glScalef(s, s, s);
|
glScalef(s, s, s);
|
||||||
renderPainting(painting, motive->w, motive->h, motive->uo, motive->vo, a);
|
renderPainting(painting, motive->w, motive->h, motive->uo, motive->vo, a);
|
||||||
glDisable(GL_RESCALE_NORMAL);
|
//glDisable(GL_RESCALE_NORMAL);
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -77,10 +77,10 @@ void PlayerRenderer::render(Entity* mob_, float x, float y, float z, float rot,
|
|||||||
model = desired;
|
model = desired;
|
||||||
humanoidModel = desired;
|
humanoidModel = desired;
|
||||||
}
|
}
|
||||||
// LOGI("[PlayerRenderer] %s: skin=%s, modelTex=%dx%d, desired=%s\n", // don't log it always, only for debug - shredder
|
LOGI("[PlayerRenderer] %s: skin=%s, modelTex=%dx%d, desired=%s\n",
|
||||||
// ((Player*)mob)->name.c_str(), mob->getTexture().c_str(),
|
((Player*)mob)->name.c_str(), mob->getTexture().c_str(),
|
||||||
// humanoidModel->texWidth, humanoidModel->texHeight,
|
humanoidModel->texWidth, humanoidModel->texHeight,
|
||||||
// (desired == playerModel64 ? "64" : "32"));
|
(desired == playerModel64 ? "64" : "32"));
|
||||||
HumanoidMobRenderer::render(mob_, x, y, z, rot, a);
|
HumanoidMobRenderer::render(mob_, x, y, z, rot, a);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -115,41 +115,6 @@ void drawArrayVTC_NoState(int bufferId, int vertices, int vertexSize /* = 24 */)
|
|||||||
}
|
}
|
||||||
#endif
|
#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
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -4,15 +4,11 @@
|
|||||||
#include "../../platform/log.h"
|
#include "../../platform/log.h"
|
||||||
#include "../Options.h"
|
#include "../Options.h"
|
||||||
|
|
||||||
#if defined(__APPLE__)
|
|
||||||
#define GLES_SILENCE_DEPRECATION
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Android should always run OPENGL_ES
|
// Android should always run OPENGL_ES
|
||||||
#if defined(ANDROID) || defined(__APPLE__) || defined(RPI)
|
#if defined(ANDROID) || defined(__APPLE__) || defined(RPI)
|
||||||
#define OPENGL_ES
|
#define OPENGL_ES
|
||||||
#endif
|
#endif
|
||||||
#define GLES_SILENCE_DEPRECATION
|
|
||||||
// Other systems might run it, if they #define OPENGL_ES
|
// Other systems might run it, if they #define OPENGL_ES
|
||||||
// #if defined(OPENGL_ES) // || defined(ANDROID)
|
// #if defined(OPENGL_ES) // || defined(ANDROID)
|
||||||
#define USE_VBO
|
#define USE_VBO
|
||||||
@@ -59,18 +55,13 @@ void anGenBuffers(GLsizei n, GLuint* buffer);
|
|||||||
#ifdef USE_VBO
|
#ifdef USE_VBO
|
||||||
#define drawArrayVT_NoState drawArrayVT
|
#define drawArrayVT_NoState drawArrayVT
|
||||||
#define drawArrayVTC_NoState drawArrayVTC
|
#define drawArrayVTC_NoState drawArrayVTC
|
||||||
#define drawArrayVTN_NoState drawArrayVTN
|
void drawArrayVT(int bufferId, int vertices, int vertexSize = 24, unsigned int mode = GL_TRIANGLES);
|
||||||
void drawArrayVT(int bufferId, int vertices, int vertexSize = 36, unsigned int mode = GL_TRIANGLES);
|
|
||||||
#ifndef drawArrayVT_NoState
|
#ifndef drawArrayVT_NoState
|
||||||
//void drawArrayVT_NoState(int bufferId, int vertices, int vertexSize = 36);
|
//void drawArrayVT_NoState(int bufferId, int vertices, int vertexSize = 24);
|
||||||
#endif
|
#endif
|
||||||
void drawArrayVTC(int bufferId, int vertices, int vertexSize = 36);
|
void drawArrayVTC(int bufferId, int vertices, int vertexSize = 24);
|
||||||
#ifndef drawArrayVTC_NoState
|
#ifndef drawArrayVTC_NoState
|
||||||
void drawArrayVTC_NoState(int bufferId, int vertices, int vertexSize = 36);
|
void drawArrayVTC_NoState(int bufferId, int vertices, int vertexSize = 24);
|
||||||
#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
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -123,7 +114,6 @@ int glhUnProjectf( float winx, float winy, float winz,
|
|||||||
#define glVertexPointer2 glVertexPointer
|
#define glVertexPointer2 glVertexPointer
|
||||||
#define glColorPointer2 glColorPointer
|
#define glColorPointer2 glColorPointer
|
||||||
#define glTexCoordPointer2 glTexCoordPointer
|
#define glTexCoordPointer2 glTexCoordPointer
|
||||||
#define glNormalPointer2 glNormalPointer
|
|
||||||
#define glEnableClientState2 glEnableClientState
|
#define glEnableClientState2 glEnableClientState
|
||||||
#define glDisableClientState2 glDisableClientState
|
#define glDisableClientState2 glDisableClientState
|
||||||
#define glDrawArrays2 glDrawArrays
|
#define glDrawArrays2 glDrawArrays
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
// DynamicTexture
|
// DynamicTexture
|
||||||
//
|
//
|
||||||
DynamicTexture::DynamicTexture(int tex_)
|
DynamicTexture::DynamicTexture(int tex_)
|
||||||
: tex(tex_),
|
: tex(tex_),
|
||||||
replicate(1)
|
replicate(1)
|
||||||
{
|
{
|
||||||
memset(pixels, 0, 16*16*4);
|
memset(pixels, 0, 16*16*4);
|
||||||
@@ -29,8 +29,8 @@ void DynamicTexture::bindTexture(Textures* tex) {
|
|||||||
/*
|
/*
|
||||||
WaterTexture::WaterTexture()
|
WaterTexture::WaterTexture()
|
||||||
: super(Tile::water->tex),
|
: super(Tile::water->tex),
|
||||||
_tick(0),
|
_tick(0),
|
||||||
_frame(0)
|
_frame(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -39,7 +39,7 @@ void WaterTexture::tick() {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
WaterTexture::WaterTexture()
|
WaterTexture::WaterTexture()
|
||||||
: super(Tile::water->tex),
|
: super(Tile::water->tex),
|
||||||
_tick(0),
|
_tick(0),
|
||||||
_frame(0)
|
_frame(0)
|
||||||
{
|
{
|
||||||
@@ -124,7 +124,7 @@ void WaterTexture::tick()
|
|||||||
// WaterSideTexture
|
// WaterSideTexture
|
||||||
//
|
//
|
||||||
WaterSideTexture::WaterSideTexture()
|
WaterSideTexture::WaterSideTexture()
|
||||||
: super(Tile::water->tex + 1),
|
: super(Tile::water->tex + 1),
|
||||||
_tick(0),
|
_tick(0),
|
||||||
_frame(0),
|
_frame(0),
|
||||||
_tickCount(0)
|
_tickCount(0)
|
||||||
@@ -207,194 +207,8 @@ void WaterSideTexture::tick() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
FireTexture::FireTexture()
|
||||||
/// Lava Texture
|
: super(((Tile*)Tile::fire)->tex),
|
||||||
///
|
|
||||||
|
|
||||||
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++) {
|
|
||||||
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),
|
_tick(0),
|
||||||
_frame(0)
|
_frame(0)
|
||||||
{
|
{
|
||||||
@@ -422,7 +236,7 @@ FireTexture::~FireTexture() {
|
|||||||
// oh boy time to implement fire textures, i am so fucked - shredder
|
// oh boy time to implement fire textures, i am so fucked - shredder
|
||||||
|
|
||||||
void FireTexture::tick() {
|
void FireTexture::tick() {
|
||||||
// loop generates fire texture on the empty texture grid, hopefully shouldnt be too taxing on older hardware - shredder
|
// 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 x = 0; x < 16; x++) {
|
||||||
for (int y = 0; y < 20; y++) {
|
for (int y = 0; y < 20; y++) {
|
||||||
int count = 18;
|
int count = 18;
|
||||||
|
|||||||
@@ -56,44 +56,6 @@ public:
|
|||||||
void tick();
|
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
|
class FireTexture: public DynamicTexture
|
||||||
{
|
{
|
||||||
typedef DynamicTexture super;
|
typedef DynamicTexture super;
|
||||||
@@ -106,7 +68,7 @@ class FireTexture: public DynamicTexture
|
|||||||
float* heata;
|
float* heata;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
FireTexture(int id);
|
FireTexture();
|
||||||
~FireTexture();
|
~FireTexture();
|
||||||
|
|
||||||
void tick();
|
void tick();
|
||||||
|
|||||||
@@ -111,7 +111,6 @@
|
|||||||
#include "data/eat1.pcm"
|
#include "data/eat1.pcm"
|
||||||
#include "data/eat2.pcm"
|
#include "data/eat2.pcm"
|
||||||
#include "data/eat3.pcm"
|
#include "data/eat3.pcm"
|
||||||
#include "data/burp1.pcm"
|
|
||||||
#include "data/fuse.pcm"
|
#include "data/fuse.pcm"
|
||||||
|
|
||||||
SoundDesc SA_cloth1((char*)PCM_cloth1);
|
SoundDesc SA_cloth1((char*)PCM_cloth1);
|
||||||
@@ -222,7 +221,6 @@ SoundDesc SA_creeperdeath((char*)PCM_creeperdeath);
|
|||||||
SoundDesc SA_eat1((char*)PCM_eat1);
|
SoundDesc SA_eat1((char*)PCM_eat1);
|
||||||
SoundDesc SA_eat2((char*)PCM_eat2);
|
SoundDesc SA_eat2((char*)PCM_eat2);
|
||||||
SoundDesc SA_eat3((char*)PCM_eat3);
|
SoundDesc SA_eat3((char*)PCM_eat3);
|
||||||
SoundDesc SA_burp1((char*)PCM_burp1);
|
|
||||||
SoundDesc SA_fuse((char*)PCM_fuse);
|
SoundDesc SA_fuse((char*)PCM_fuse);
|
||||||
|
|
||||||
#endif /*!PRE_ANDROID23 && !__APPLE__*/
|
#endif /*!PRE_ANDROID23 && !__APPLE__*/
|
||||||
|
|||||||
@@ -172,7 +172,6 @@ extern SoundDesc SA_creeperdeath;
|
|||||||
extern SoundDesc SA_eat1;
|
extern SoundDesc SA_eat1;
|
||||||
extern SoundDesc SA_eat2;
|
extern SoundDesc SA_eat2;
|
||||||
extern SoundDesc SA_eat3;
|
extern SoundDesc SA_eat3;
|
||||||
extern SoundDesc SA_burp1;
|
|
||||||
extern SoundDesc SA_fuse;
|
extern SoundDesc SA_fuse;
|
||||||
|
|
||||||
#endif /*!PRE_ANDROID23 && !__APPLE__*/
|
#endif /*!PRE_ANDROID23 && !__APPLE__*/
|
||||||
|
|||||||
@@ -144,7 +144,6 @@ void SoundEngine::init( Minecraft* mc, Options* options )
|
|||||||
sounds.add("random.eat", SA_eat1);
|
sounds.add("random.eat", SA_eat1);
|
||||||
sounds.add("random.eat", SA_eat2);
|
sounds.add("random.eat", SA_eat2);
|
||||||
sounds.add("random.eat", SA_eat3);
|
sounds.add("random.eat", SA_eat3);
|
||||||
sounds.add("random.burp", SA_burp1);
|
|
||||||
sounds.add("random.fuse", SA_fuse);
|
sounds.add("random.fuse", SA_fuse);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -227,7 +227,6 @@ void SoundEngine::init( Minecraft* mc, Options* options )
|
|||||||
sounds.add( "random.eat", _pp("eat1"));
|
sounds.add( "random.eat", _pp("eat1"));
|
||||||
sounds.add( "random.eat", _pp("eat2"));
|
sounds.add( "random.eat", _pp("eat2"));
|
||||||
sounds.add( "random.eat", _pp("eat3"));
|
sounds.add( "random.eat", _pp("eat3"));
|
||||||
sounds.add( "random.burp", _pp("burp1"));
|
|
||||||
sounds.add( "random.fuse", _pp("fuse"));
|
sounds.add( "random.fuse", _pp("fuse"));
|
||||||
|
|
||||||
sounds.add( "step.cloth", _pp("cloth1"));
|
sounds.add( "step.cloth", _pp("cloth1"));
|
||||||
|
|||||||
@@ -1,98 +0,0 @@
|
|||||||
#include "Mth.h"
|
|
||||||
|
|
||||||
#include "Color.h"
|
|
||||||
#include <cassert>
|
|
||||||
|
|
||||||
//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;
|
|
||||||
}
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
#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();
|
|
||||||
};
|
|
||||||
@@ -75,7 +75,7 @@ void PerfRenderer::renderFpsMeter( float tickTime )
|
|||||||
glDisable2(GL_TEXTURE_2D);
|
glDisable2(GL_TEXTURE_2D);
|
||||||
Tesselator& t = Tesselator::instance;
|
Tesselator& t = Tesselator::instance;
|
||||||
|
|
||||||
t.begin(GL_QUADS);
|
t.begin(GL_TRIANGLES);
|
||||||
int hh1 = (int) (usPer60Fps / 200);
|
int hh1 = (int) (usPer60Fps / 200);
|
||||||
float count = (float)frameTimes.size();
|
float count = (float)frameTimes.size();
|
||||||
t.color(0x20000000);
|
t.color(0x20000000);
|
||||||
@@ -117,8 +117,7 @@ void PerfRenderer::renderFpsMeter( float tickTime )
|
|||||||
t.color(0xff000000 + cc * 256);
|
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;
|
float time2 = 10 * 1000 * tickTimes[i] / 200;
|
||||||
|
|
||||||
t.vertex(i + 0.5f, _mc->height - time + 0.5f, 0);
|
t.vertex(i + 0.5f, _mc->height - time + 0.5f, 0);
|
||||||
@@ -211,12 +210,12 @@ void PerfRenderer::renderFpsMeter( float tickTime )
|
|||||||
msg << result.name;
|
msg << result.name;
|
||||||
float xx = (float)(x - r);
|
float xx = (float)(x - r);
|
||||||
float yy = (float)(y + r/2 + i * 8 + 20);
|
float yy = (float)(y + r/2 + i * 8 + 20);
|
||||||
_font->drawShadow(msg.str(), xx + 10 + 10, yy, result.getColor());
|
_font->drawShadow(msg.str(), xx, yy, result.getColor());
|
||||||
std::string msg2 = toPercentString(result.percentage);
|
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);
|
//LOGI("name: %s: perc: %f == %s @ %d, %d\n", msg.str().c_str(), result.percentage, msg2.c_str(), xx, yy);
|
||||||
_font->drawShadow(msg2, xx + 10 + 10 - _font->width(msg2), yy, result.getColor());
|
_font->drawShadow(msg2, xx - 50 - _font->width(msg2), yy, result.getColor());
|
||||||
msg2 = toPercentString(result.globalPercentage);
|
msg2 = toPercentString(result.globalPercentage);
|
||||||
_font->drawShadow(msg2, xx + 10 + 10 - _font->width(msg2), yy, result.getColor());
|
_font->drawShadow(msg2, xx - _font->width(msg2), yy, result.getColor());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
#include "StringUtils.h"
|
#include "StringUtils.h"
|
||||||
|
|
||||||
//package util;
|
//package util;
|
||||||
//#ifdef PROFILER
|
#ifdef PROFILER
|
||||||
#define TIMER_PUSH(x) PerfTimer::push(x)
|
#define TIMER_PUSH(x) PerfTimer::push(x)
|
||||||
#define TIMER_POP() PerfTimer::pop()
|
#define TIMER_POP() PerfTimer::pop()
|
||||||
#define TIMER_POP_PUSH(x) PerfTimer::popPush(x)
|
#define TIMER_POP_PUSH(x) PerfTimer::popPush(x)
|
||||||
@@ -16,11 +16,11 @@
|
|||||||
// #define TIMER_PUSH(x) ServerProfiler::push(x)
|
// #define TIMER_PUSH(x) ServerProfiler::push(x)
|
||||||
// #define TIMER_POP() ServerProfiler::pop()
|
// #define TIMER_POP() ServerProfiler::pop()
|
||||||
// #define TIMER_POP_PUSH(x) ServerProfiler::popPush(x)
|
// #define TIMER_POP_PUSH(x) ServerProfiler::popPush(x)
|
||||||
//#else
|
#else
|
||||||
// #define TIMER_PUSH(x) ((void*)0)
|
#define TIMER_PUSH(x) ((void*)0)
|
||||||
// #define TIMER_POP() ((void*)0)
|
#define TIMER_POP() ((void*)0)
|
||||||
// #define TIMER_POP_PUSH(x) ((void*)0)
|
#define TIMER_POP_PUSH(x) ((void*)0)
|
||||||
//#endif
|
#endif
|
||||||
|
|
||||||
class PerfTimer
|
class PerfTimer
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -465,15 +465,6 @@ void Entity::tick()
|
|||||||
baseTick();
|
baseTick();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Entity::setOnFire(int numberOfSeconds)
|
|
||||||
{
|
|
||||||
int newValue = numberOfSeconds * 20;
|
|
||||||
if (onFire < newValue)
|
|
||||||
{
|
|
||||||
onFire = newValue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Entity::baseTick()
|
void Entity::baseTick()
|
||||||
{
|
{
|
||||||
TIMER_PUSH("entityBaseTick");
|
TIMER_PUSH("entityBaseTick");
|
||||||
|
|||||||
@@ -89,8 +89,6 @@ public:
|
|||||||
virtual bool isAlive();
|
virtual bool isAlive();
|
||||||
virtual bool isOnFire();
|
virtual bool isOnFire();
|
||||||
|
|
||||||
virtual void setOnFire(int numberOfSeconds);
|
|
||||||
|
|
||||||
virtual bool isPlayer();
|
virtual bool isPlayer();
|
||||||
virtual bool isCreativeModeAllowed();
|
virtual bool isCreativeModeAllowed();
|
||||||
|
|
||||||
|
|||||||
@@ -169,9 +169,7 @@ void Mob::playAmbientSound()
|
|||||||
level->playSound(this, ambient, getSoundVolume(), getVoicePitch());
|
level->playSound(this, ambient, getSoundVolume(), getVoicePitch());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bool Mob::isOnFire() {
|
|
||||||
return onFire > 0 || getSharedFlag(SharedFlagsInformation::FLAG_ONFIRE);
|
|
||||||
}
|
|
||||||
void Mob::baseTick()
|
void Mob::baseTick()
|
||||||
{
|
{
|
||||||
oAttackAnim = attackAnim;
|
oAttackAnim = attackAnim;
|
||||||
@@ -179,18 +177,6 @@ void Mob::baseTick()
|
|||||||
|
|
||||||
TIMER_PUSH("mobBaseTick");
|
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) {
|
if (((ambientSoundTime++ & 15) == 0) && random.nextInt(2000) < ambientSoundTime) {
|
||||||
ambientSoundTime = -getAmbientSoundInterval();
|
ambientSoundTime = -getAmbientSoundInterval();
|
||||||
playAmbientSound();
|
playAmbientSound();
|
||||||
|
|||||||
@@ -52,7 +52,6 @@ public:
|
|||||||
virtual bool isPickable();
|
virtual bool isPickable();
|
||||||
virtual bool isPushable();
|
virtual bool isPushable();
|
||||||
|
|
||||||
virtual bool isOnFire();
|
|
||||||
virtual bool isShootable();
|
virtual bool isShootable();
|
||||||
|
|
||||||
MoveControl* getMoveControl();
|
MoveControl* getMoveControl();
|
||||||
|
|||||||
@@ -51,13 +51,13 @@ void Chicken::aiStep()
|
|||||||
flap += flapping * 2;
|
flap += flapping * 2;
|
||||||
|
|
||||||
//@todo
|
//@todo
|
||||||
if (!isBaby()) {
|
//if (!isBaby()) {
|
||||||
if (!level->isClientSide && --eggTime <= 0) {
|
// if (!level->isClientSide && --eggTime <= 0) {
|
||||||
level->playSound(this, "mob.chickenplop", 1.0f, (random.nextFloat() - random.nextFloat()) * 0.2f + 1.0f);
|
// level->playSound(this, "mob.chickenplop", 1.0f, (random.nextFloat() - random.nextFloat()) * 0.2f + 1.0f);
|
||||||
spawnAtLocation(Item::egg->id, 1);
|
// spawnAtLocation(Item::egg->id, 1);
|
||||||
eggTime = random.nextInt(SharedConstants::TicksPerSecond * 60 * 5) + SharedConstants::TicksPerSecond * 60 * 5;
|
// eggTime = random.nextInt(SharedConstants::TicksPerSecond * 60 * 5) + SharedConstants::TicksPerSecond * 60 * 5;
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Chicken::addAdditonalSaveData( CompoundTag* tag )
|
void Chicken::addAdditonalSaveData( CompoundTag* tag )
|
||||||
@@ -102,8 +102,8 @@ void Chicken::dropDeathLoot( /*bool wasKilledByPlayer, int playerBonusLevel*/ )
|
|||||||
spawnAtLocation(Item::feather->id, 1);
|
spawnAtLocation(Item::feather->id, 1);
|
||||||
}
|
}
|
||||||
//// and some meat
|
//// and some meat
|
||||||
if (isOnFire()) spawnAtLocation(Item::chicken_cooked->id, 1); //@fire
|
//if (isOnFire()) spawnAtLocation(Item::chicken_cooked->id, 1); //@fire
|
||||||
else
|
//else
|
||||||
spawnAtLocation(Item::chicken_raw->id, 1);
|
spawnAtLocation(Item::chicken_raw->id, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -66,11 +66,11 @@ void Cow::dropDeathLoot( /*bool wasKilledByPlayer, int playerBonusLevel*/ ) {
|
|||||||
// and some meat
|
// and some meat
|
||||||
count = random.nextInt(3) + 1;
|
count = random.nextInt(3) + 1;
|
||||||
for (int i = 0; i < count; i++) {
|
for (int i = 0; i < count; i++) {
|
||||||
if (isOnFire()) { //@fire
|
// if (isOnFire()) { //@fire
|
||||||
spawnAtLocation(Item::beef_cooked->id, 1);
|
// spawnAtLocation(Item::beef_cooked->id, 1);
|
||||||
} else {
|
// } else {
|
||||||
spawnAtLocation(Item::beef_raw->id, 1);
|
spawnAtLocation(Item::beef_raw->id, 1);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -54,8 +54,8 @@ std::string Pig::getDeathSound()
|
|||||||
int Pig::getDeathLoot()
|
int Pig::getDeathLoot()
|
||||||
{
|
{
|
||||||
//@fire
|
//@fire
|
||||||
if (isOnFire())
|
//if (isOnFire())
|
||||||
return Item::porkChop_cooked->id;
|
// return Item::porkChop_cooked->id;
|
||||||
return Item::porkChop_raw->id;
|
return Item::porkChop_raw->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
#include "Sheep.h"
|
#include "Sheep.h"
|
||||||
#include "../../item/DyePowderItem.h"
|
#include "../../item/DyePowderItem.h"
|
||||||
#include "../../level/tile/TallGrass.h"
|
|
||||||
#include "../../level/tile/LevelEvent.h"
|
#include "../../level/tile/LevelEvent.h"
|
||||||
|
|
||||||
const float Sheep::COLOR[][3] = {
|
const float Sheep::COLOR[][3] = {
|
||||||
@@ -199,7 +198,7 @@ void Sheep::updateAi()
|
|||||||
int yy = Mth::floor(y);
|
int yy = Mth::floor(y);
|
||||||
int zz = Mth::floor(z);
|
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;
|
eatAnimationTick = EAT_ANIMATION_TICKS;
|
||||||
level->broadcastEntityEvent(this, EntityEvent::EAT_GRASS);
|
level->broadcastEntityEvent(this, EntityEvent::EAT_GRASS);
|
||||||
}
|
}
|
||||||
@@ -209,11 +208,11 @@ void Sheep::updateAi()
|
|||||||
int zz = Mth::floor(z);
|
int zz = Mth::floor(z);
|
||||||
|
|
||||||
bool ate = false;
|
bool ate = false;
|
||||||
if (level->getTile(xx, yy, zz) == Tile::tallgrass->id) {
|
/* 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->levelEvent(LevelEvent::PARTICLES_DESTROY_BLOCK, xx, yy, zz, Tile::tallgrass->id + TallGrass::TALL_GRASS * 256);
|
||||||
level->setTile(xx, yy, zz, 0);
|
level->setTile(xx, yy, zz, 0);
|
||||||
ate = true;
|
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->levelEvent(NULL, LevelEvent::PARTICLES_DESTROY_BLOCK, xx, yy - 1, zz, ((Tile*)Tile::grass)->id);
|
||||||
level->setTile(xx, yy - 1, zz, Tile::dirt->id);
|
level->setTile(xx, yy - 1, zz, Tile::dirt->id);
|
||||||
ate = true;
|
ate = true;
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ void Skeleton::aiStep() {
|
|||||||
float br = getBrightness(1);
|
float br = getBrightness(1);
|
||||||
if (br > 0.5f) {
|
if (br > 0.5f) {
|
||||||
if (level->canSeeSky(Mth::floor(x), Mth::floor(y), Mth::floor(z)) && random.nextFloat() * 3.5f < (br - 0.4f)) {
|
if (level->canSeeSky(Mth::floor(x), Mth::floor(y), Mth::floor(z)) && random.nextFloat() * 3.5f < (br - 0.4f)) {
|
||||||
// hurt(NULL, 1); // no use anymore since i restored setOnFire - shredder
|
hurt(NULL, 1);
|
||||||
|
|
||||||
for (int i = 0; i < 5; ++i) {
|
for (int i = 0; i < 5; ++i) {
|
||||||
float xa = (2.0f * random.nextFloat() - 1.0f) * (2.0f * random.nextFloat() - 1.0f) * 0.02f;
|
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;
|
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);
|
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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ void Zombie::aiStep() {
|
|||||||
float br = getBrightness(1);
|
float br = getBrightness(1);
|
||||||
if (br > 0.5f) {
|
if (br > 0.5f) {
|
||||||
if (level->canSeeSky(Mth::floor(x), Mth::floor(y), Mth::floor(z)) && random.nextFloat() * 3.5f < (br - 0.4f)) {
|
if (level->canSeeSky(Mth::floor(x), Mth::floor(y), Mth::floor(z)) && random.nextFloat() * 3.5f < (br - 0.4f)) {
|
||||||
// hurt(NULL, 1); // no use anymore since i restored setOnFire - shredder
|
hurt(NULL, 1);
|
||||||
|
|
||||||
for (int i = 0; i < 5; ++i) {
|
for (int i = 0; i < 5; ++i) {
|
||||||
float xa = (2.0f * random.nextFloat() - 1.0f) * (2.0f * random.nextFloat() - 1.0f) * 0.02f;
|
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;
|
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);
|
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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -245,7 +245,6 @@ void Inventory::setupDefault() {
|
|||||||
addItem(new ItemInstance(Item::seeds_melon));
|
addItem(new ItemInstance(Item::seeds_melon));
|
||||||
addItem(new ItemInstance(Item::dye_powder, 1, DyePowderItem::WHITE));
|
addItem(new ItemInstance(Item::dye_powder, 1, DyePowderItem::WHITE));
|
||||||
addItem(new ItemInstance(Item::hoe_iron));
|
addItem(new ItemInstance(Item::hoe_iron));
|
||||||
addItem(new ItemInstance(Item::flintAndSteel));
|
|
||||||
#ifdef RPI
|
#ifdef RPI
|
||||||
Sel[0] = addItem(new ItemInstance(Item::sword_iron));
|
Sel[0] = addItem(new ItemInstance(Item::sword_iron));
|
||||||
#else
|
#else
|
||||||
|
|||||||
@@ -216,7 +216,6 @@ bool Player::checkBed() {
|
|||||||
return (level->getTile(bedPosition.x, bedPosition.y, bedPosition.z) == Tile::bed->id);
|
return (level->getTile(bedPosition.x, bedPosition.y, bedPosition.z) == Tile::bed->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Player::tick() {
|
void Player::tick() {
|
||||||
bool shouldSleep = entityData.getFlag<SharedFlagsInformation::SharedFlagsInformationType>(DATA_PLAYER_FLAGS_ID, PLAYER_SLEEP_FLAG);
|
bool shouldSleep = entityData.getFlag<SharedFlagsInformation::SharedFlagsInformationType>(DATA_PLAYER_FLAGS_ID, PLAYER_SLEEP_FLAG);
|
||||||
if(shouldSleep != isSleeping()) {
|
if(shouldSleep != isSleeping()) {
|
||||||
@@ -247,20 +246,7 @@ void Player::tick() {
|
|||||||
}
|
}
|
||||||
super::tick();
|
super::tick();
|
||||||
|
|
||||||
|
|
||||||
if (!level->isClientSide) {
|
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);
|
foodData.tick(this);
|
||||||
// if (containerMenu != NULL && !containerMenu->stillValid(this)) {
|
// if (containerMenu != NULL && !containerMenu->stillValid(this)) {
|
||||||
// closeContainer();
|
// closeContainer();
|
||||||
|
|||||||
@@ -10,7 +10,6 @@
|
|||||||
#include "../level/tile/ClothTile.h"
|
#include "../level/tile/ClothTile.h"
|
||||||
#include "../level/tile/CropTile.h"
|
#include "../level/tile/CropTile.h"
|
||||||
#include "../level/tile/StemTile.h"
|
#include "../level/tile/StemTile.h"
|
||||||
#include "../level/tile/TallGrass.h"
|
|
||||||
|
|
||||||
const std::string DyePowderItem::COLOR_DESCS[] = {
|
const std::string DyePowderItem::COLOR_DESCS[] = {
|
||||||
"black", "red", "green", "brown", "blue", "purple", "cyan", "silver", "gray", "pink", "lime", "yellow", "lightBlue", "magenta", "orange", "white"
|
"black", "red", "green", "brown", "blue", "purple", "cyan", "silver", "gray", "pink", "lime", "yellow", "lightBlue", "magenta", "orange", "white"
|
||||||
@@ -92,9 +91,9 @@ bool DyePowderItem::useOn( ItemInstance* itemInstance, Player* player, Level* le
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (level->getTile(xx, yy, zz) == 0) {
|
if (level->getTile(xx, yy, zz) == 0) {
|
||||||
if (random.nextInt(10) != 0) {
|
/*if (random.nextInt(10) != 0) {
|
||||||
level->setTileAndData(xx, yy, zz, Tile::tallgrass->id, TallGrass::TALL_GRASS);
|
level->setTileAndData(xx, yy, zz, Tile::tallgrass.id, TallGrass.TALL_GRASS);
|
||||||
} else if (random.nextInt(3) != 0) {
|
} else*/ if (random.nextInt(3) != 0) {
|
||||||
level->setTile(xx, yy, zz, Tile::flower->id);
|
level->setTile(xx, yy, zz, Tile::flower->id);
|
||||||
} else {
|
} else {
|
||||||
level->setTile(xx, yy, zz, Tile::rose->id);
|
level->setTile(xx, yy, zz, Tile::rose->id);
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ public:
|
|||||||
|
|
||||||
/*@Override*/
|
/*@Override*/
|
||||||
bool mineBlock(ItemInstance* itemInstance, int tile, int x, int y, int z/*, Mob* owner*/) {
|
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);
|
itemInstance->hurt(1);//, owner);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int getDefaultColor() {
|
static int getDefaultColor() {
|
||||||
return 0x48b518;
|
return 0xFFFFFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
#include "../../network/packet/ExplodePacket.h"
|
#include "../../network/packet/ExplodePacket.h"
|
||||||
|
|
||||||
Level::Level(LevelStorage* levelStorage, const std::string& levelName, const LevelSettings& settings, int generatorVersion, Dimension* fixedDimension /* = NULL */)
|
Level::Level(LevelStorage* levelStorage, const std::string& levelName, const LevelSettings& settings, int generatorVersion, Dimension* fixedDimension /* = NULL */)
|
||||||
: levelStorage(levelStorage),
|
: levelStorage(levelStorage),
|
||||||
isClientSide(false),
|
isClientSide(false),
|
||||||
isFindingSpawn(false),
|
isFindingSpawn(false),
|
||||||
noNeighborUpdate(false),
|
noNeighborUpdate(false),
|
||||||
@@ -1165,13 +1165,7 @@ int Level::getSkyDarken(float a) {
|
|||||||
|
|
||||||
float br = 1 - (Mth::cos(td * Mth::PI * 2) * 2 + 0.5f);
|
float br = 1 - (Mth::cos(td * Mth::PI * 2) * 2 + 0.5f);
|
||||||
if (br < 0.0f) br = 0.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 > 0.80f) br = 0.80f; //@note; was 1.0f
|
||||||
{
|
|
||||||
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));
|
return ((int) (br * 11));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1180,29 +1174,12 @@ Vec3 Level::getSkyColor(Entity* source, float a) {
|
|||||||
|
|
||||||
float br = Mth::cos(td * Mth::PI * 2) * 2 + 0.5f;
|
float br = Mth::cos(td * Mth::PI * 2) * 2 + 0.5f;
|
||||||
if (br < 0.0f) br = 0.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 > 0.75f) br = 0.75f; //@note; was 1.0f
|
||||||
{
|
|
||||||
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 xx = Mth::floor(source->x);
|
// int zz = Mth::floor(source->z);
|
||||||
int zz = Mth::floor(source->z);
|
// float temp = 0.5;//(float) getBiomeSource().getTemperature(xx, zz);
|
||||||
// float temp = 0.5;//(float) getBiomeSource().getTemperature(xx, zz); // unused in normal pe too, just hardcoded temp values for some reason.
|
int skyColor = 0x3070ff;//getBiomeSource().getBiome(xx, zz).getSkyColor(temp);
|
||||||
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
|
|
||||||
|
|
||||||
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 r = ((skyColor >> 16) & 0xff) / 255.0f;
|
||||||
float g = ((skyColor >> 8) & 0xff) / 255.0f;
|
float g = ((skyColor >> 8) & 0xff) / 255.0f;
|
||||||
@@ -1741,15 +1718,13 @@ void Level::extinguishFire(int x, int y, int z, int face) {
|
|||||||
setTile(x, y, z, 0);
|
setTile(x, y, z, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
std::string Level::gatherStats() {
|
// String gatherStats() {
|
||||||
std::stringstream ss;
|
// return "All: " + this.entities.size();
|
||||||
ss << "All: " << entities.size();
|
// }
|
||||||
return ss.str();
|
//
|
||||||
}
|
// String gatherChunkSourceStats() {
|
||||||
|
// return chunkSource.gatherStats();
|
||||||
std::string Level::gatherChunkSourceStats() {
|
// }
|
||||||
return _chunkSource->gatherStats();
|
|
||||||
}
|
|
||||||
//
|
//
|
||||||
TileEntity* Level::getTileEntity(int x, int y, int z) {
|
TileEntity* Level::getTileEntity(int x, int y, int z) {
|
||||||
LevelChunk* lc = getChunk(x >> 4, z >> 4);
|
LevelChunk* lc = getChunk(x >> 4, z >> 4);
|
||||||
@@ -1968,10 +1943,10 @@ const EntityList& Level::getAllEntities() {
|
|||||||
//
|
//
|
||||||
/*
|
/*
|
||||||
void Level::addEntities(const EntityList& list) {
|
void Level::addEntities(const EntityList& list) {
|
||||||
entities.insert(entities.end(), list.begin(), list.end());
|
entities.insert(entities.end(), list.begin(), list.end());
|
||||||
for (int j = 0; j < (int)list.size(); j++) {
|
for (int j = 0; j < (int)list.size(); j++) {
|
||||||
entityAdded(list[j]);
|
entityAdded(list[j]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -2067,18 +2042,18 @@ void Level::setSpawnPos(Pos spawnPos) {
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
void Level::ensureAdded(Entity* entity) {
|
void Level::ensureAdded(Entity* entity) {
|
||||||
int xc = Mth::floor(entity->x / 16);
|
int xc = Mth::floor(entity->x / 16);
|
||||||
int zc = Mth::floor(entity->z / 16);
|
int zc = Mth::floor(entity->z / 16);
|
||||||
int r = 2;
|
int r = 2;
|
||||||
for (int x = xc - r; x <= xc + r; x++) {
|
for (int x = xc - r; x <= xc + r; x++) {
|
||||||
for (int z = zc - r; z <= zc + r; z++) {
|
for (int z = zc - r; z <= zc + r; z++) {
|
||||||
this->getChunk(x, z);
|
this->getChunk(x, z);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (std::find(entities.begin(), entities.end(), entity) == entities.end()) {
|
if (std::find(entities.begin(), entities.end(), entity) == entities.end()) {
|
||||||
entities.push_back(entity);
|
entities.push_back(entity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -2095,35 +2070,35 @@ void Level::broadcastEntityEvent(Entity* e, char eventId) {
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
void Level::removeAllPendingEntityRemovals() {
|
void Level::removeAllPendingEntityRemovals() {
|
||||||
//Util::removeAll(entities, _entitiesToRemove);
|
//Util::removeAll(entities, _entitiesToRemove);
|
||||||
// //entities.removeAll(entitiesToRemove);
|
// //entities.removeAll(entitiesToRemove);
|
||||||
// for (int j = 0; j < (int)_entitiesToRemove.size(); j++) {
|
// for (int j = 0; j < (int)_entitiesToRemove.size(); j++) {
|
||||||
// Entity* e = _entitiesToRemove[j];
|
// Entity* e = _entitiesToRemove[j];
|
||||||
// int xc = e->xChunk;
|
// int xc = e->xChunk;
|
||||||
// int zc = e->zChunk;
|
// int zc = e->zChunk;
|
||||||
// if (e->inChunk && hasChunk(xc, zc)) {
|
// if (e->inChunk && hasChunk(xc, zc)) {
|
||||||
// getChunk(xc, zc)->removeEntity(e);
|
// getChunk(xc, zc)->removeEntity(e);
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// for (unsigned int j = 0; j < _entitiesToRemove.size(); j++) {
|
// for (unsigned int j = 0; j < _entitiesToRemove.size(); j++) {
|
||||||
// entityRemoved(_entitiesToRemove[j]);
|
// entityRemoved(_entitiesToRemove[j]);
|
||||||
// }
|
// }
|
||||||
// _entitiesToRemove.clear();
|
// _entitiesToRemove.clear();
|
||||||
|
|
||||||
for (unsigned int i = 0; i < entities.size(); i++) {
|
for (unsigned int i = 0; i < entities.size(); i++) {
|
||||||
Entity* e = entities[i];
|
Entity* e = entities[i];
|
||||||
|
|
||||||
if (e->removed) {
|
if (e->removed) {
|
||||||
int xc = e->xChunk;
|
int xc = e->xChunk;
|
||||||
int zc = e->zChunk;
|
int zc = e->zChunk;
|
||||||
if (e->inChunk && hasChunk(xc, zc)) {
|
if (e->inChunk && hasChunk(xc, zc)) {
|
||||||
getChunk(xc, zc)->removeEntity(e);
|
getChunk(xc, zc)->removeEntity(e);
|
||||||
}
|
}
|
||||||
entities.erase( entities.begin() + (i--) );
|
entities.erase( entities.begin() + (i--) );
|
||||||
entityRemoved(e);
|
entityRemoved(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -2256,7 +2231,7 @@ bool Level::inRange( int x, int y, int z ) {
|
|||||||
// AdventureSettings
|
// AdventureSettings
|
||||||
//
|
//
|
||||||
AdventureSettings::AdventureSettings()
|
AdventureSettings::AdventureSettings()
|
||||||
: doTickTime(true),
|
: doTickTime(true),
|
||||||
noPvP(false),
|
noPvP(false),
|
||||||
noPvM(false),
|
noPvM(false),
|
||||||
noMvP(false),
|
noMvP(false),
|
||||||
|
|||||||
@@ -202,9 +202,6 @@ public:
|
|||||||
bool checkAndHandleWater(const AABB& box, const Material* material, Entity* e);
|
bool checkAndHandleWater(const AABB& box, const Material* material, Entity* e);
|
||||||
void extinguishFire(int x, int y, int z, int face);
|
void extinguishFire(int x, int y, int z, int face);
|
||||||
|
|
||||||
std::string gatherStats();
|
|
||||||
std::string gatherChunkSourceStats();
|
|
||||||
|
|
||||||
//void addEntities(const EntityList& list);
|
//void addEntities(const EntityList& list);
|
||||||
//void removeEntities(const EntityList& list);
|
//void removeEntities(const EntityList& list);
|
||||||
//void ensureAdded(Entity* entity);
|
//void ensureAdded(Entity* entity);
|
||||||
|
|||||||
@@ -8,9 +8,6 @@
|
|||||||
#include "../../entity/MobCategory.h"
|
#include "../../entity/MobCategory.h"
|
||||||
#include "../../level/tile/TallGrass.h"
|
#include "../../level/tile/TallGrass.h"
|
||||||
|
|
||||||
#include "../../../util/Color.h"
|
|
||||||
#include "../GrassColor.h"
|
|
||||||
|
|
||||||
Biome* Biome::rainForest = NULL;
|
Biome* Biome::rainForest = NULL;
|
||||||
Biome* Biome::swampland = NULL;
|
Biome* Biome::swampland = NULL;
|
||||||
Biome* Biome::seasonalForest = NULL;
|
Biome* Biome::seasonalForest = NULL;
|
||||||
@@ -144,7 +141,7 @@ void Biome::teardownBiomes() {
|
|||||||
Feature* Biome::getTreeFeature( Random* random )
|
Feature* Biome::getTreeFeature( Random* random )
|
||||||
{
|
{
|
||||||
if (random->nextInt(10) == 0) {
|
if (random->nextInt(10) == 0) {
|
||||||
// return new BasicTree(false); // temporarily disabled
|
return new BasicTree(false);
|
||||||
}
|
}
|
||||||
return new TreeFeature(false);
|
return new TreeFeature(false);
|
||||||
}
|
}
|
||||||
@@ -211,31 +208,11 @@ float Biome::adjustDepth( float depth )
|
|||||||
|
|
||||||
int Biome::getSkyColor( float temp )
|
int Biome::getSkyColor( float temp )
|
||||||
{
|
{
|
||||||
temp /= 3.f;
|
// temp /= 3.f;
|
||||||
if (temp < -1) temp = -1;
|
// if (temp < -1) temp = -1;
|
||||||
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 0x80808080;
|
||||||
return Color::getHSBColor(224 / 360.0f - temp * 0.05f, 0.50f + temp * 0.1f, 1.0f).getRGB();
|
//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)
|
Biome::MobList& Biome::getMobs(const MobCategory& category)
|
||||||
|
|||||||
@@ -78,13 +78,7 @@ public:
|
|||||||
virtual float adjustScale(float scale);
|
virtual float adjustScale(float scale);
|
||||||
virtual float adjustDepth(float depth);
|
virtual float adjustDepth(float depth);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
virtual int getSkyColor(float temp);
|
virtual int getSkyColor(float temp);
|
||||||
virtual int getGrassColor();
|
|
||||||
|
|
||||||
virtual float getDownfall();
|
|
||||||
virtual float getTemperature();
|
|
||||||
|
|
||||||
virtual MobList& getMobs(const MobCategory& category);
|
virtual MobList& getMobs(const MobCategory& category);
|
||||||
virtual float getCreatureProbability();
|
virtual float getCreatureProbability();
|
||||||
@@ -94,8 +88,6 @@ public:
|
|||||||
char topMaterial;
|
char topMaterial;
|
||||||
char material;
|
char material;
|
||||||
int leafColor;
|
int leafColor;
|
||||||
float temperature;
|
|
||||||
float downfall;
|
|
||||||
private:
|
private:
|
||||||
static Biome* map[64*64];
|
static Biome* map[64*64];
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ public:
|
|||||||
return new BirchFeature();
|
return new BirchFeature();
|
||||||
}
|
}
|
||||||
if (random->nextInt(3) == 0) {
|
if (random->nextInt(3) == 0) {
|
||||||
// return new BasicTree(false); // temporarily disabled
|
return new BasicTree(false);
|
||||||
}
|
}
|
||||||
return new TreeFeature(false);
|
return new TreeFeature(false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ class RainforestBiome: public Biome
|
|||||||
public:
|
public:
|
||||||
Feature* getTreeFeature(Random* random) {
|
Feature* getTreeFeature(Random* random) {
|
||||||
if (random->nextInt(3) == 0) {
|
if (random->nextInt(3) == 0) {
|
||||||
// return new BasicTree(false); // temporarily disabled
|
return new BasicTree(false);
|
||||||
}
|
}
|
||||||
return new TreeFeature(false);
|
return new TreeFeature(false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -193,10 +193,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::string gatherStats() {
|
std::string gatherStats() {
|
||||||
// return "ChunkCache: 1024";
|
return "ChunkCache: 1024";
|
||||||
std::stringstream ss;
|
|
||||||
ss << "ChunkCache: " << CHUNK_CACHE_WIDTH * CHUNK_CACHE_WIDTH;
|
|
||||||
return ss.str();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void saveAll(bool onlyUnsaved) {
|
void saveAll(bool onlyUnsaved) {
|
||||||
|
|||||||
@@ -262,14 +262,14 @@ void LevelChunk::recalcHeight(int x, int yStart, int z) {
|
|||||||
|
|
||||||
/*public*/
|
/*public*/
|
||||||
void LevelChunk::skyBrightnessChanged() {
|
void LevelChunk::skyBrightnessChanged() {
|
||||||
int x0 = xt;
|
// int x0 = xt;
|
||||||
int y0 = this->minHeight - 16;
|
// int y0 = this->minHeight - 16;
|
||||||
int z0 = zt;
|
// int z0 = zt;
|
||||||
int x1 = xt + 16;
|
// int x1 = xt + 16;
|
||||||
int y1 = Level::DEPTH - 1;
|
// int y1 = Level::DEPTH - 1;
|
||||||
int z1 = zt + 16;
|
// int z1 = zt + 16;
|
||||||
|
|
||||||
level->setTilesDirty(x0, y0, z0, x1, y1, z1);
|
//level->setTilesDirty(x0, y0, z0, x1, y1, z1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*public*/
|
/*public*/
|
||||||
|
|||||||
@@ -15,8 +15,7 @@ Dimension::Dimension()
|
|||||||
ultraWarm(false),
|
ultraWarm(false),
|
||||||
hasCeiling(false),
|
hasCeiling(false),
|
||||||
biomeSource(NULL),
|
biomeSource(NULL),
|
||||||
id(0),
|
id(0)
|
||||||
fogColor(0x80daff)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -94,18 +93,6 @@ float* Dimension::getSunriseColor( float td, float a )
|
|||||||
|
|
||||||
Vec3 Dimension::getFogColor( 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;
|
float br = Mth::cos(td * Mth::PI * 2) * 2 + 0.5f;
|
||||||
if (br < 0.0f) br = 0.0f;
|
if (br < 0.0f) br = 0.0f;
|
||||||
if (br > 1.0f) br = 1.0f;
|
if (br > 1.0f) br = 1.0f;
|
||||||
@@ -117,8 +104,7 @@ Vec3 Dimension::getFogColor( float td, float a )
|
|||||||
g *= br * 0.94f + 0.06f;
|
g *= br * 0.94f + 0.06f;
|
||||||
b *= br * 0.91f + 0.09f;
|
b *= br * 0.91f + 0.09f;
|
||||||
return Vec3(r, g, b);
|
return Vec3(r, g, b);
|
||||||
|
//return Vec3(0.752941f, 0.847059f, 1);
|
||||||
//
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Dimension::mayRespawn()
|
bool Dimension::mayRespawn()
|
||||||
@@ -133,19 +119,12 @@ Dimension* Dimension::getNew( int id )
|
|||||||
return NULL;
|
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
|
// DimensionFactory
|
||||||
//
|
//
|
||||||
#include "../storage/LevelData.h"
|
#include "../storage/LevelData.h"
|
||||||
Dimension* DimensionFactory::createDefaultDimension(LevelData* data )
|
Dimension* DimensionFactory::createDefaultDimension(LevelData* data )
|
||||||
{
|
{
|
||||||
int dimensionId = Dimension::NORMAL;
|
int dimensionId = Dimension::NORMAL;
|
||||||
|
|
||||||
switch(data->getGameType()) {
|
switch(data->getGameType()) {
|
||||||
|
|||||||
@@ -49,11 +49,8 @@ public:
|
|||||||
bool hasCeiling;
|
bool hasCeiling;
|
||||||
float brightnessRamp[16];//Level::MAX_BRIGHTNESS + 1];
|
float brightnessRamp[16];//Level::MAX_BRIGHTNESS + 1];
|
||||||
int id;
|
int id;
|
||||||
std::string getDimension();
|
|
||||||
// shredder added
|
|
||||||
int FogType; // lets us choose between what fog we want ig
|
|
||||||
protected:
|
protected:
|
||||||
long fogColor; //= 0x80daff;//0x406fe5;//0xc0d8ff;
|
static const long fogColor = 0x80daff;//0x406fe5;//0xc0d8ff;
|
||||||
float sunriseCol[4];
|
float sunriseCol[4];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,6 @@
|
|||||||
|
|
||||||
class NormalDayCycleDimension: public Dimension {
|
class NormalDayCycleDimension: public Dimension {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
float getTimeOfDay(long time, float a) {
|
float getTimeOfDay(long time, float a) {
|
||||||
int dayStep = (int) (time % Level::TICKS_PER_DAY);
|
int dayStep = (int) (time % Level::TICKS_PER_DAY);
|
||||||
float td = (dayStep + a) / Level::TICKS_PER_DAY - 0.25f;
|
float td = (dayStep + a) / Level::TICKS_PER_DAY - 0.25f;
|
||||||
@@ -21,18 +20,6 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
Vec3 getFogColor( float td, float a ) {
|
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;
|
float br = cos(td * Mth::PI * 2) * 2 + 0.5f;
|
||||||
if (br < 0) br = 0;
|
if (br < 0) br = 0;
|
||||||
if (br > 1.f) br = 1.f;
|
if (br > 1.f) br = 1.f;
|
||||||
|
|||||||
@@ -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, unsigned char* blocks, int blocksSize)
|
void CanyonFeature::addFeature(Level* level, int x, int z, int xOffs, int zOffs,unsigned char* blocks)
|
||||||
{
|
{
|
||||||
if (random.nextInt(15) != 0) return;
|
if (random.nextInt(15) != 0) return;
|
||||||
|
|
||||||
|
|||||||
@@ -11,12 +11,8 @@ class CanyonFeature: public LargeFeature {
|
|||||||
|
|
||||||
/*protected*/
|
/*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);
|
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*/
|
/*protected*/
|
||||||
void addFeature(Level* level, int x, int z, int xOffs, int zOffs, unsigned char* blocks, int blocksSize);
|
void addFeature(Level* level, int x, int z, int xOffs, int zOffs,unsigned char* blocks);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -11,14 +11,13 @@
|
|||||||
#include "../tile/Tile.h"
|
#include "../tile/Tile.h"
|
||||||
#include "../tile/HeavyTile.h"
|
#include "../tile/HeavyTile.h"
|
||||||
#include "../../../util/Random.h"
|
#include "../../../util/Random.h"
|
||||||
#include "../../level/tile/TallGrass.h"
|
|
||||||
|
|
||||||
const float RandomLevelSource::SNOW_CUTOFF = 0.5f;
|
const float RandomLevelSource::SNOW_CUTOFF = 0.5f;
|
||||||
const float RandomLevelSource::SNOW_SCALE = 0.3f;
|
const float RandomLevelSource::SNOW_SCALE = 0.3f;
|
||||||
static const int MAX_BUFFER_SIZE = 1024;
|
static const int MAX_BUFFER_SIZE = 1024;
|
||||||
|
|
||||||
RandomLevelSource::RandomLevelSource(Level* level, long seed, int version, bool spawnMobs)
|
RandomLevelSource::RandomLevelSource(Level* level, long seed, int version, bool spawnMobs)
|
||||||
: random(seed),
|
: random(seed),
|
||||||
level(level),
|
level(level),
|
||||||
lperlinNoise1(&random, 16),
|
lperlinNoise1(&random, 16),
|
||||||
lperlinNoise2(&random, 16),
|
lperlinNoise2(&random, 16),
|
||||||
@@ -103,7 +102,7 @@ void RandomLevelSource::prepareHeights(int xOffs, int zOffs, unsigned char* bloc
|
|||||||
float val = _s0;
|
float val = _s0;
|
||||||
float vala = (_s1 - _s0) * zStep;
|
float vala = (_s1 - _s0) * zStep;
|
||||||
for (int z = 0; z < CHUNK_WIDTH; z++) {
|
for (int z = 0; z < CHUNK_WIDTH; z++) {
|
||||||
// + (zc * CHUNK_WIDTH + z)];
|
// + (zc * CHUNK_WIDTH + z)];
|
||||||
float temp = temperatures[(xc * CHUNK_WIDTH + x) * 16 + (zc * CHUNK_WIDTH + z)];
|
float temp = temperatures[(xc * CHUNK_WIDTH + x) * 16 + (zc * CHUNK_WIDTH + z)];
|
||||||
int tileId = 0;
|
int tileId = 0;
|
||||||
if (yc * CHUNK_HEIGHT + y < waterHeight) {
|
if (yc * CHUNK_HEIGHT + y < waterHeight) {
|
||||||
@@ -226,36 +225,33 @@ void RandomLevelSource::postProcess(ChunkSource* parent, int xt, int zt) {
|
|||||||
int zo = zt * 16;
|
int zo = zt * 16;
|
||||||
|
|
||||||
Biome* biome = level->getBiomeSource()->getBiome(xo + 16, zo + 16);
|
Biome* biome = level->getBiomeSource()->getBiome(xo + 16, zo + 16);
|
||||||
// Biome* biome = Biome::forest;
|
// Biome* biome = Biome::forest;
|
||||||
|
|
||||||
random.setSeed(level->getSeed());
|
random.setSeed(level->getSeed());
|
||||||
int xScale = random.nextInt() / 2 * 2 + 1;
|
int xScale = random.nextInt() / 2 * 2 + 1;
|
||||||
int zScale = random.nextInt() / 2 * 2 + 1;
|
int zScale = random.nextInt() / 2 * 2 + 1;
|
||||||
random.setSeed(((xt * xScale) + (zt * zScale)) ^ level->getSeed());
|
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
|
// //@todo: hide those chunks if they are aren't visible
|
||||||
if (random.nextInt(4) == 0) {
|
// if (random.nextInt(4) == 0) {
|
||||||
int x = xo + random.nextInt(16) + 8;
|
// int x = xo + random.nextInt(16) + 8;
|
||||||
int y = random.nextInt(128);
|
// int y = random.nextInt(128);
|
||||||
int z = zo + random.nextInt(16) + 8;
|
// int z = zo + random.nextInt(16) + 8;
|
||||||
LakeFeature feature(Tile::calmWater->id);
|
// LakeFeature feature(Tile::calmWater->id);
|
||||||
feature.place(level, &random, x, y, z);
|
// feature.place(level, &random, x, y, z);
|
||||||
// LOGI("Adding underground lake @ (%d,%d,%d)\n", x, y, z);
|
// LOGI("Adding underground lake @ (%d,%d,%d)\n", x, y, z);
|
||||||
}
|
// }
|
||||||
|
|
||||||
////@todo: hide those chunks if they are aren't visible
|
////@todo: hide those chunks if they are aren't visible
|
||||||
if (random.nextInt(8) == 0) {
|
// if (random.nextInt(8) == 0) {
|
||||||
int x = xo + random.nextInt(16) + 8;
|
// int x = xo + random.nextInt(16) + 8;
|
||||||
int y = random.nextInt(random.nextInt(120) + 8);
|
// int y = random.nextInt(random.nextInt(120) + 8);
|
||||||
int z = zo + random.nextInt(16) + 8;
|
// int z = zo + random.nextInt(16) + 8;
|
||||||
if (y < 64 || random.nextInt(10) == 0) {
|
// if (y < 64 || random.nextInt(10) == 0) {
|
||||||
LakeFeature feature(Tile::calmLava->id);
|
// LakeFeature feature(Tile::calmLava->id);
|
||||||
feature.place(level, &random, x, y, z);
|
// feature.place(level, &random, x, y, z);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
static float totalTime = 0;
|
static float totalTime = 0;
|
||||||
const float st = getTimeS();
|
const float st = getTimeS();
|
||||||
@@ -291,8 +287,6 @@ void RandomLevelSource::postProcess(ChunkSource* parent, int xt, int zt) {
|
|||||||
feature.place(level, &random, x, y, z);
|
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
|
|
||||||
|
|
||||||
// Coal: common, wide Y range, moderate vein size
|
// Coal: common, wide Y range, moderate vein size
|
||||||
for (int i = 0; i < 16; i++) {
|
for (int i = 0; i < 16; i++) {
|
||||||
int x = xo + random.nextInt(16);
|
int x = xo + random.nextInt(16);
|
||||||
@@ -420,46 +414,17 @@ void RandomLevelSource::postProcess(ChunkSource* parent, int xt, int zt) {
|
|||||||
FlowerFeature feature(Tile::mushroom2->id);
|
FlowerFeature feature(Tile::mushroom2->id);
|
||||||
feature.place(level, &random, x, y, z);
|
feature.place(level, &random, x, y, z);
|
||||||
}
|
}
|
||||||
// normally unused in mcpe but how its supposed to do it
|
/*int grassCount = 1;
|
||||||
//int grassCount = 1;
|
for (int i = 0; i < grassCount; i++) {
|
||||||
//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;
|
|
||||||
}
|
|
||||||
|
|
||||||
int x = xo + random.nextInt(16) + 8;
|
int x = xo + random.nextInt(16) + 8;
|
||||||
|
int y = random.nextInt(Level::genDepth);
|
||||||
int z = zo + random.nextInt(16) + 8;
|
int z = zo + random.nextInt(16) + 8;
|
||||||
int y = level->getHeightmap(x, z);
|
Feature* grassFeature = biome->getGrassFeature(&random);
|
||||||
|
if (grassFeature) {
|
||||||
TallgrassFeature grassFeature(Tile::tallgrass->id, grassMetadata);
|
grassFeature->place(level, &random, x, y, z);
|
||||||
grassFeature.place(level, &random, x, y, z);
|
delete grassFeature;
|
||||||
}
|
}
|
||||||
|
}*/
|
||||||
|
|
||||||
for (int i = 0; i < 10; i++) {
|
for (int i = 0; i < 10; i++) {
|
||||||
int x = xo + random.nextInt(16) + 8;
|
int x = xo + random.nextInt(16) + 8;
|
||||||
int y = random.nextInt(128);
|
int y = random.nextInt(128);
|
||||||
@@ -558,7 +523,6 @@ LevelChunk* RandomLevelSource::getChunk(int xOffs, int zOffs) {
|
|||||||
|
|
||||||
// Carve caves into the chunk
|
// Carve caves into the chunk
|
||||||
caveFeature.apply(this, level, xOffs, zOffs, blocks, LevelChunk::ChunkBlockCount);
|
caveFeature.apply(this, level, xOffs, zOffs, blocks, LevelChunk::ChunkBlockCount);
|
||||||
canyonFeature.apply(this, level, xOffs, zOffs, blocks, LevelChunk::ChunkBlockCount);
|
|
||||||
levelChunk->recalcHeightmap();
|
levelChunk->recalcHeightmap();
|
||||||
|
|
||||||
return levelChunk;
|
return levelChunk;
|
||||||
@@ -727,10 +691,10 @@ Biome::MobList RandomLevelSource::getMobsAt(const MobCategory& mobCategory, int
|
|||||||
if (biomeSource == NULL) {
|
if (biomeSource == NULL) {
|
||||||
return Biome::MobList();
|
return Biome::MobList();
|
||||||
}
|
}
|
||||||
// static Stopwatch sw; sw.start();
|
// static Stopwatch sw; sw.start();
|
||||||
Biome* biome = biomeSource->getBiome(x, z);
|
Biome* biome = biomeSource->getBiome(x, z);
|
||||||
// sw.stop();
|
// sw.stop();
|
||||||
// sw.printEvery(10, "getBiome::");
|
// sw.printEvery(10, "getBiome::");
|
||||||
if (biome == NULL) {
|
if (biome == NULL) {
|
||||||
return Biome::MobList();
|
return Biome::MobList();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ class LevelChunk;
|
|||||||
|
|
||||||
#include "../chunk/ChunkSource.h"
|
#include "../chunk/ChunkSource.h"
|
||||||
#include "LargeCaveFeature.h"
|
#include "LargeCaveFeature.h"
|
||||||
#include "CanyonFeature.h"
|
|
||||||
#include "synth/PerlinNoise.h"
|
#include "synth/PerlinNoise.h"
|
||||||
#include "../../../SharedConstants.h"
|
#include "../../../SharedConstants.h"
|
||||||
|
|
||||||
@@ -64,7 +63,6 @@ private:
|
|||||||
public:
|
public:
|
||||||
//Biome** biomes;
|
//Biome** biomes;
|
||||||
LargeCaveFeature caveFeature;
|
LargeCaveFeature caveFeature;
|
||||||
CanyonFeature canyonFeature;
|
|
||||||
int waterDepths[16+16][16+16];
|
int waterDepths[16+16][16+16];
|
||||||
private:
|
private:
|
||||||
ChunkMap chunkMap;
|
ChunkMap chunkMap;
|
||||||
@@ -94,7 +92,6 @@ private:
|
|||||||
float* fi;
|
float* fi;
|
||||||
float* fis;
|
float* fis;
|
||||||
///*private*/ float[] temperatures;
|
///*private*/ float[] temperatures;
|
||||||
float* temperatures; // normally unused like above, but restored this maybe might come handy - shredder
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class PerformanceTestChunkSource : public ChunkSource
|
class PerformanceTestChunkSource : public ChunkSource
|
||||||
|
|||||||
@@ -25,11 +25,11 @@ private:
|
|||||||
int origin[3];
|
int origin[3];
|
||||||
int height;
|
int height;
|
||||||
int trunkHeight;
|
int trunkHeight;
|
||||||
float trunkHeightScale;
|
double trunkHeightScale;
|
||||||
float branchDensity;
|
double branchDensity;
|
||||||
float branchSlope;
|
double branchSlope;
|
||||||
float widthScale;
|
double widthScale;
|
||||||
float foliageDensity;
|
double foliageDensity;
|
||||||
int trunkWidth;
|
int trunkWidth;
|
||||||
int heightVariance;
|
int heightVariance;
|
||||||
int foliageHeight;
|
int foliageHeight;
|
||||||
@@ -38,7 +38,7 @@ private:
|
|||||||
void prepare(){
|
void prepare(){
|
||||||
trunkHeight = (int) (height * trunkHeightScale);
|
trunkHeight = (int) (height * trunkHeightScale);
|
||||||
if (trunkHeight >= height) trunkHeight = height - 1;
|
if (trunkHeight >= height) trunkHeight = height - 1;
|
||||||
int clustersPerY = (int) (1.382f + pow(foliageDensity * height / 13.0, 2));
|
int clustersPerY = (int) (1.382 + pow(foliageDensity * height / 13.0, 2));
|
||||||
if (clustersPerY < 1) clustersPerY = 1;
|
if (clustersPerY < 1) clustersPerY = 1;
|
||||||
int **tempFoliageCoords = new int *[clustersPerY * height];
|
int **tempFoliageCoords = new int *[clustersPerY * height];
|
||||||
for( int i = 0; i < clustersPerY * height; i++ )
|
for( int i = 0; i < clustersPerY * height; i++ )
|
||||||
@@ -68,19 +68,19 @@ private:
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
float originOffset = 0.5f;
|
double originOffset = 0.5;
|
||||||
while (num < clustersPerY)
|
while (num < clustersPerY)
|
||||||
{
|
{
|
||||||
float radius = widthScale * (shapefac * (rnd->nextFloat() + 0.328f));
|
double radius = widthScale * (shapefac * (rnd->nextFloat() + 0.328));
|
||||||
float angle = rnd->nextFloat() * 2.0f * 3.14159f;
|
double angle = rnd->nextFloat() * 2.0 * 3.14159;
|
||||||
int x = Mth::floor(radius * sin(angle) + origin[0] + originOffset);
|
int x = Mth::floor(radius * sin(angle) + origin[0] + originOffset);
|
||||||
int z = Mth::floor(radius * cos(angle) + origin[2] + originOffset);
|
int z = Mth::floor(radius * cos(angle) + origin[2] + originOffset);
|
||||||
int checkStart[] = { x, y, z };
|
int checkStart[] = { x, y, z };
|
||||||
int checkEnd[] = { x, y + foliageHeight, z };
|
int checkEnd[] = { x, y + foliageHeight, z };
|
||||||
if (checkLine(checkStart, checkEnd) == -1) {
|
if (checkLine(checkStart, checkEnd) == -1) {
|
||||||
int checkBranchBase[] = { origin[0], origin[1], origin[2] };
|
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));
|
double distance = sqrt(pow(abs(origin[0] - checkStart[0]), 2.0) + pow(abs(origin[2] - checkStart[2]), 2.0));
|
||||||
float branchHeight = distance * branchSlope;
|
double branchHeight = distance * branchSlope;
|
||||||
if ((checkStart[1] - branchHeight) > trunkTop)
|
if ((checkStart[1] - branchHeight) > trunkTop)
|
||||||
{
|
{
|
||||||
checkBranchBase[1] = trunkTop;
|
checkBranchBase[1] = trunkTop;
|
||||||
@@ -134,9 +134,7 @@ private:
|
|||||||
offset2 = -rad;
|
offset2 = -rad;
|
||||||
while (offset2 <= rad)
|
while (offset2 <= rad)
|
||||||
{
|
{
|
||||||
float off1 = (float)offset1 + 0.5f;
|
double thisdistance = pow(abs(offset1) + 0.5, 2) + pow(abs(offset2) + 0.5, 2);
|
||||||
float off2 = (float)offset2 + 0.5f;
|
|
||||||
float thisdistance = (off1 * off1) + (off2 * off2);
|
|
||||||
if (thisdistance > radius * radius)
|
if (thisdistance > radius * radius)
|
||||||
{
|
{
|
||||||
offset2++;
|
offset2++;
|
||||||
@@ -161,14 +159,14 @@ private:
|
|||||||
|
|
||||||
}
|
}
|
||||||
float treeShape(int y){
|
float treeShape(int y){
|
||||||
if (y < (((float) height) * 0.3f)) return (float) -1.618f;
|
if (y < (((float) height) * 0.3)) return (float) -1.618;
|
||||||
float radius = ((float) height) / ((float) 2.0f);
|
float radius = ((float) height) / ((float) 2.0);
|
||||||
float adjacent = (((float) height) / ((float) 2.0f)) - y;
|
float adjacent = (((float) height) / ((float) 2.0)) - y;
|
||||||
float distance;
|
float distance;
|
||||||
if (adjacent == 0) distance = radius;
|
if (adjacent == 0) distance = radius;
|
||||||
else if (abs(adjacent) >= radius) distance = (float) 0.0f;
|
else if (abs(adjacent) >= radius) distance = (float) 0.0;
|
||||||
else distance = (float) sqrt(pow(abs(radius), 2) - pow(abs(adjacent), 2));
|
else distance = (float) sqrt(pow(abs(radius), 2) - pow(abs(adjacent), 2));
|
||||||
distance *= (float) 0.5f;
|
distance *= (float) 0.5;
|
||||||
return distance;
|
return distance;
|
||||||
}
|
}
|
||||||
float foliageShape(int y){
|
float foliageShape(int y){
|
||||||
@@ -209,8 +207,8 @@ private:
|
|||||||
char primsign;
|
char primsign;
|
||||||
if (delta[primidx] > 0) primsign = 1;
|
if (delta[primidx] > 0) primsign = 1;
|
||||||
else primsign = -1;
|
else primsign = -1;
|
||||||
float secfac1 = ((float) delta[secidx1]) / ((float) delta[primidx]);
|
double secfac1 = ((double) delta[secidx1]) / ((double) delta[primidx]);
|
||||||
float secfac2 = ((float) delta[secidx2]) / ((float) delta[primidx]);
|
double secfac2 = ((double) delta[secidx2]) / ((double) delta[primidx]);
|
||||||
int coordinate[] = { 0, 0, 0 };
|
int coordinate[] = { 0, 0, 0 };
|
||||||
int primoffset = 0;
|
int primoffset = 0;
|
||||||
int endoffset = delta[primidx] + primsign;
|
int endoffset = delta[primidx] + primsign;
|
||||||
@@ -314,8 +312,8 @@ private:
|
|||||||
char primsign;
|
char primsign;
|
||||||
if (delta[primidx] > 0) primsign = 1;
|
if (delta[primidx] > 0) primsign = 1;
|
||||||
else primsign = -1;
|
else primsign = -1;
|
||||||
float secfac1 = ((float) delta[secidx1]) / ((float) delta[primidx]);
|
double secfac1 = ((double) delta[secidx1]) / ((double) delta[primidx]);
|
||||||
float secfac2 = ((float) delta[secidx2]) / ((float) delta[primidx]);
|
double secfac2 = ((double) delta[secidx2]) / ((double) delta[primidx]);
|
||||||
int coordinate[] = { 0, 0, 0 };
|
int coordinate[] = { 0, 0, 0 };
|
||||||
int primoffset = 0;
|
int primoffset = 0;
|
||||||
int endoffset = delta[primidx] + primsign;
|
int endoffset = delta[primidx] + primsign;
|
||||||
@@ -407,7 +405,7 @@ public:
|
|||||||
delete [] foliageCoords;
|
delete [] foliageCoords;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void init(float heightInit, float widthInit, float foliageDensityInit){
|
virtual void init(double heightInit, double widthInit, double foliageDensityInit){
|
||||||
|
|
||||||
heightVariance = (int) (heightInit * 12);
|
heightVariance = (int) (heightInit * 12);
|
||||||
if (heightInit > 0.5) foliageHeight = 5;
|
if (heightInit > 0.5) foliageHeight = 5;
|
||||||
|
|||||||
@@ -10,6 +10,5 @@
|
|||||||
#include "OreFeature.h"
|
#include "OreFeature.h"
|
||||||
#include "ReedsFeature.h"
|
#include "ReedsFeature.h"
|
||||||
#include "SpringFeature.h"
|
#include "SpringFeature.h"
|
||||||
#include "TallgrassFeature.h"
|
|
||||||
|
|
||||||
#endif /*FEATURE_INCLUDE__H__*/
|
#endif /*FEATURE_INCLUDE__H__*/
|
||||||
|
|||||||
@@ -131,10 +131,6 @@ public:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int getRenderLayer() {
|
|
||||||
return Tile::RENDERLAYER_ALPHATEST;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool canBurn(LevelSource* level, int x, int y, int z) {
|
bool canBurn(LevelSource* level, int x, int y, int z) {
|
||||||
return flameOdds[level->getTile(x, y, z)] > 0;
|
return flameOdds[level->getTile(x, y, z)] > 0;
|
||||||
}
|
}
|
||||||
|
|||||||