forked from Kolyah35/minecraft-pe-0.6.1
Another Huge Commit my bad - shredder
Restored Java's Debug Screen using partial unused code and ported code, avaliable in options menu as a style Slight Water texture is now overlayed when in water Vignette function has been fixed and can now be toggled in options World Generation now includes Tall Grass and Ferns both Broken Frame Chart Graph found in the source has now been fixed and enabled when debug screen is turned on Pie Chart works now and will appear when debug screen is opened Most changes have not been tested on anything besides windows, will test it
This commit is contained in:
@@ -161,6 +161,18 @@ 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
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include <string>
|
||||
#include <cstdlib>
|
||||
|
||||
|
||||
#if defined(APPLE_DEMO_PROMOTION)
|
||||
#define NO_NETWORK
|
||||
#endif
|
||||
@@ -475,19 +476,20 @@ void Minecraft::update() {
|
||||
#ifndef STANDALONE_SERVER
|
||||
Multitouch::resetThisUpdate();
|
||||
#endif
|
||||
TIMER_POP();
|
||||
|
||||
#ifndef STANDALONE_SERVER
|
||||
TIMER_POP();
|
||||
checkGlError("Update finished");
|
||||
|
||||
if (options.getBooleanValue(OPTIONS_RENDER_DEBUG)) {
|
||||
#ifndef PLATFORM_DESKTOP
|
||||
//#ifndef PLATFORM_DESKTOP
|
||||
if (!PerfTimer::enabled) {
|
||||
PerfTimer::reset();
|
||||
PerfTimer::enabled = true;
|
||||
}
|
||||
_perfRenderer->renderFpsMeter(1);
|
||||
checkGlError("render debug");
|
||||
#endif
|
||||
//#endif
|
||||
} else {
|
||||
PerfTimer::enabled = false;
|
||||
}
|
||||
@@ -829,6 +831,12 @@ void Minecraft::tickInput() {
|
||||
}
|
||||
#endif
|
||||
|
||||
if (options.getBooleanValue(OPTIONS_RENDER_DEBUG)) {
|
||||
if (key >= '0' && key <= '9') {
|
||||
_perfRenderer->debugFpsMeterKeyPress(key - '0');
|
||||
}
|
||||
}
|
||||
|
||||
if (key == Keyboard::KEY_ESCAPE)
|
||||
pauseGame(false);
|
||||
|
||||
@@ -840,6 +848,12 @@ void Minecraft::tickInput() {
|
||||
//glPolygonMode(GL_BACK, isWireFrame? GL_LINE : GL_FILL);
|
||||
}
|
||||
#endif
|
||||
if (key == Keyboard::KEY_P) {
|
||||
static bool isWireFrame = false;
|
||||
isWireFrame = !isWireFrame;
|
||||
glPolygonMode(GL_FRONT, isWireFrame? GL_LINE : GL_FILL);
|
||||
//glPolygonMode(GL_BACK, isWireFrame? GL_LINE : GL_FILL);
|
||||
}
|
||||
}
|
||||
#ifdef WIN32
|
||||
if (key == Keyboard::KEY_M) {
|
||||
@@ -1411,7 +1425,7 @@ void Minecraft::_levelGenerated()
|
||||
}
|
||||
|
||||
if (level && level->dimension) {
|
||||
// For example, if you want FogType or any other option
|
||||
|
||||
level->dimension->FogType = options.getIntValue(OPTIONS_FOG_TYPE);
|
||||
}
|
||||
|
||||
@@ -1441,6 +1455,25 @@ void Minecraft::_levelGenerated()
|
||||
_hasSignaledGeneratingLevelFinished = true;
|
||||
}
|
||||
|
||||
std::string Minecraft::gatherStats1() {
|
||||
return levelRenderer->gatherStats1();
|
||||
}
|
||||
|
||||
std::string Minecraft::gatherStats2() {
|
||||
return levelRenderer->gatherStats2();
|
||||
}
|
||||
|
||||
std::string Minecraft::gatherStats3() {
|
||||
return ("P: " + particleEngine->countParticles() + ". T: " + (level->gatherStats()));
|
||||
}
|
||||
|
||||
std::string Minecraft::gatherStats4() {
|
||||
return level->gatherChunkSourceStats();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Player* Minecraft::respawnPlayer(int playerId) {
|
||||
for (unsigned int i = 0; i < level->players.size(); ++i) {
|
||||
if (level->players[i]->entityId == playerId) {
|
||||
|
||||
@@ -87,6 +87,14 @@ public:
|
||||
|
||||
void update();
|
||||
|
||||
std::string gatherStats1();
|
||||
|
||||
std::string gatherStats2();
|
||||
|
||||
std::string gatherStats4();
|
||||
|
||||
std::string gatherStats3();
|
||||
|
||||
void tick(int nTick, int maxTick);
|
||||
void tickInput();
|
||||
|
||||
|
||||
@@ -58,6 +58,10 @@ OptionBool ambientOcclusion("ao", true);
|
||||
|
||||
OptionBool useNormalLighting("normalLighting", true);
|
||||
|
||||
OptionBool beautifulSky("beautifulSky", true);
|
||||
|
||||
OptionBool useVignette("useVignette", true);
|
||||
|
||||
OptionBool useTouchscreen("useTouchscreen", true);
|
||||
|
||||
OptionBool serverVisible("servervisible", true);
|
||||
@@ -76,6 +80,8 @@ OptionBool blockOutline("blockOutline", false);
|
||||
|
||||
OptionBool restoredAnims("restoredAnims", true);
|
||||
|
||||
OptionInt debugStyle("debugStyle", 0, 0, 1);
|
||||
|
||||
OptionInt keyForward("key.forward", Keyboard::KEY_W);
|
||||
OptionInt keyLeft("key.left", Keyboard::KEY_A);
|
||||
OptionInt keyBack("key.back", Keyboard::KEY_S);
|
||||
@@ -154,6 +160,10 @@ void Options::initTable() {
|
||||
|
||||
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;
|
||||
@@ -187,6 +197,8 @@ void Options::initTable() {
|
||||
// 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;
|
||||
|
||||
@@ -92,6 +92,9 @@ enum OptionId {
|
||||
OPTIONS_RESTORED_ANIMS,
|
||||
OPTIONS_TINTED_SIDE,
|
||||
OPTIONS_BETA_SKY,
|
||||
OPTIONS_BEAUTIFUL_SKY,
|
||||
OPTIONS_VIGNETTE,
|
||||
OPTIONS_DEBUG_STYLE,
|
||||
// Should be last!
|
||||
OPTIONS_COUNT
|
||||
};
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "screens/ConsoleScreen.h"
|
||||
#include "../Minecraft.h"
|
||||
#include "../player/LocalPlayer.h"
|
||||
#include "../renderer/Chunk.h"
|
||||
#include "../renderer/Tesselator.h"
|
||||
#include "../renderer/TileRenderer.h"
|
||||
#include "../renderer/LevelRenderer.h"
|
||||
@@ -103,10 +104,10 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) {
|
||||
}
|
||||
}
|
||||
|
||||
// @todo - Shredder: I added this here but currently viginette is broken so i cant do much about it.
|
||||
// if (minecraft->options.getBooleanValue(OPTIONS_FANCY_GRAPHICS)){
|
||||
// this->renderVignette(this->minecraft->player->getBrightness(a), screenWidth, screenHeight);
|
||||
// }
|
||||
// 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) {
|
||||
@@ -121,7 +122,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) {
|
||||
if (!minecraft->options.getBooleanValue(OPTIONS_HIDEGUI)) {
|
||||
renderToolBar(a, ySlot, screenWidth);
|
||||
|
||||
font->drawShadow("Minecraft - Pocket Edition ", 2, 2, 0xffffffff);
|
||||
// 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);
|
||||
@@ -363,6 +364,7 @@ void Gui::renderVignette(float br, int w, int h) {
|
||||
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
glDepthMask(false);
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc2(GL_ZERO, GL_ONE_MINUS_SRC_COLOR);
|
||||
glColor4f2(tbr, tbr, tbr, 1);
|
||||
|
||||
@@ -379,6 +381,7 @@ void Gui::renderVignette(float br, int w, int h) {
|
||||
t.draw();
|
||||
glDepthMask(true);
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glDisable(GL_BLEND);
|
||||
glColor4f2(1, 1, 1, 1);
|
||||
glBlendFunc2(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
}
|
||||
@@ -729,13 +732,20 @@ void Gui::onLevelGenerated() {
|
||||
|
||||
void Gui::renderDebugInfo() {
|
||||
// FPS counter (updates once per second)
|
||||
static float fps = 0.0f;
|
||||
static float fpsLastTime = 0.0f;
|
||||
static int fps = 0;
|
||||
static int fpsLastTime = 0;
|
||||
static int fpsFrames = 0;
|
||||
static int displayChunkUpdates = 0;
|
||||
float now = getTimeS();
|
||||
fpsFrames++;
|
||||
if (now - fpsLastTime >= 1.0f) {
|
||||
if (now - fpsLastTime >= 1) {
|
||||
fps = fpsFrames / (now - fpsLastTime);
|
||||
|
||||
displayChunkUpdates = Chunk::updates;
|
||||
|
||||
// 3. RESET the actual game counter to 0 for the next second
|
||||
Chunk::updates = 0;
|
||||
|
||||
fpsFrames = 0;
|
||||
fpsLastTime = now;
|
||||
}
|
||||
@@ -773,6 +783,31 @@ void Gui::renderDebugInfo() {
|
||||
long seed = lvl ? lvl->getSeed() : 0;
|
||||
|
||||
// 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){
|
||||
font->drawShadow("Minecraft - Pocket Edition ("
|
||||
+ std::to_string((int)fps) + " fps, "
|
||||
+ std::to_string(displayChunkUpdates) + " chunk updates)", 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);
|
||||
|
||||
drawString(font, "x: " + std::to_string(minecraft->player->x), 2, 64, 0xE0E0E0);
|
||||
drawString(font, "y: " + std::to_string(minecraft->player->y), 2, 72, 0xE0E0E0);
|
||||
drawString(font, "z: " + std::to_string(minecraft->player->z), 2, 80, 0xE0E0E0);
|
||||
drawString(font, "f: " + std::to_string(Mth::floor(minecraft->player->yRot * 4.0f / 360.0f + 0.5) & 0x3), 2, 88, 0xE0E0E0);
|
||||
drawString(font, "Seed: " + std::to_string(lvl->getSeed()), 2, 104, 0xE0E0E0);
|
||||
drawString(font, "Dimension: " + std::to_string(lvl->dimension->id) + " (" + lvl->dimension->getDimension() + ")", 2, 114, 0xE0E0E0);
|
||||
drawString(font, "Biome: " + std::string(biomeName), 2, 124, 0xE0E0E0);
|
||||
}
|
||||
else if (minecraft->options.getIntValue(OPTIONS_DEBUG_STYLE) == 1){
|
||||
|
||||
|
||||
static char ln[8][96];
|
||||
sprintf(ln[0], "Minecraft PE 0.6.1 alpha (mcpe64)");
|
||||
sprintf(ln[1], "%.1f fps", fps);
|
||||
@@ -787,7 +822,7 @@ void Gui::renderDebugInfo() {
|
||||
const float LH = (float)Font::DefaultLineHeight; // 10 font-pixels
|
||||
const float MGN = 2.0f; // left/top margin in font-pixels
|
||||
const float PAD = 2.0f; // horizontal padding for background
|
||||
Font* font = minecraft->font;
|
||||
// Font* font = minecraft->font;
|
||||
|
||||
// 1) Draw semi-transparent background boxes behind each line
|
||||
for (int i = 0; i < N; i++) {
|
||||
@@ -811,6 +846,7 @@ void Gui::renderDebugInfo() {
|
||||
}
|
||||
t.endOverrideAndDraw();
|
||||
}
|
||||
}
|
||||
|
||||
void Gui::renderPlayerList(Font* font, int screenWidth, int screenHeight) {
|
||||
// only show when in game, no other screen
|
||||
|
||||
@@ -46,6 +46,16 @@ void OptionsItem::render( Minecraft* minecraft, int xm, int ym ) {
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
minecraft->font->draw(text, (float)x, (float)y + yOffset, 0x909090, false);
|
||||
super::render(minecraft, xm, ym);
|
||||
|
||||
@@ -227,7 +227,9 @@ void OptionsScreen::generateOptionScreens() {
|
||||
.addOptionItem(OPTIONS_ANAGLYPH_3D, minecraft)
|
||||
.addOptionItem(OPTIONS_VIEW_BOBBING, minecraft)
|
||||
.addOptionItem(OPTIONS_AMBIENT_OCCLUSION, minecraft)
|
||||
.addOptionItem(OPTIONS_NORMAL_LIGHTING, minecraft);
|
||||
.addOptionItem(OPTIONS_NORMAL_LIGHTING, minecraft)
|
||||
.addOptionItem(OPTIONS_BEAUTIFUL_SKY, minecraft)
|
||||
.addOptionItem(OPTIONS_VIGNETTE, minecraft);
|
||||
|
||||
optionPanes[4]->addOptionItem(OPTIONS_ALLOW_SPRINT, minecraft)
|
||||
.addOptionItem(OPTIONS_BAR_ON_TOP, minecraft)
|
||||
@@ -237,7 +239,8 @@ void OptionsScreen::generateOptionScreens() {
|
||||
.addOptionItem(OPTIONS_JAVA_HUD, minecraft)
|
||||
.addOptionItem(OPTIONS_FOG_TYPE, minecraft)
|
||||
.addOptionItem(OPTIONS_BETA_SKY, minecraft)
|
||||
.addOptionItem(OPTIONS_RESTORED_ANIMS, minecraft);
|
||||
.addOptionItem(OPTIONS_RESTORED_ANIMS, minecraft)
|
||||
.addOptionItem(OPTIONS_DEBUG_STYLE, minecraft);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -285,7 +285,7 @@ void GameRenderer::renderLevel(float a) {
|
||||
mc->levelRenderer->cull(&frustum, a);
|
||||
mc->levelRenderer->updateDirtyChunks(cameraEntity, false);
|
||||
// this sky rendering code below was originally before the frustrum and culling stuff but sunset color breaks for some reason in that place, so i moved i after those two - shredder
|
||||
if(mc->options.getBooleanValue(OPTIONS_FANCY_GRAPHICS)) {
|
||||
// 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.
|
||||
@@ -298,7 +298,7 @@ void GameRenderer::renderLevel(float a) {
|
||||
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
|
||||
|
||||
@@ -443,10 +443,10 @@ void ItemInHandRenderer::renderScreenEffect( float a )
|
||||
}
|
||||
}
|
||||
|
||||
// if (mc->player->isUnderLiquid(Material::water)) {
|
||||
//mc->textures->loadAndBindTexture("misc/water.png");
|
||||
// renderWater(a);
|
||||
// }
|
||||
if (mc->player->isUnderLiquid(Material::water)) {
|
||||
mc->textures->loadAndBindTexture("misc/water.png");
|
||||
renderWater(a);
|
||||
}
|
||||
glEnable2(GL_ALPHA_TEST);
|
||||
}
|
||||
|
||||
|
||||
@@ -1063,9 +1063,9 @@ std::string LevelRenderer::gatherStats1() {
|
||||
}
|
||||
|
||||
//
|
||||
// /*public*/ std::string gatherStats2() {
|
||||
// return "E: " + renderedEntities + "/" + totalEntities + ". B: " + culledEntities + ", I: " + ((totalEntities - culledEntities) - renderedEntities);
|
||||
// }
|
||||
std::string LevelRenderer::gatherStats2() {
|
||||
return "E: " + std::to_string(renderedEntities) + "/" + std::to_string(totalEntities) + ". B: " + std::to_string(culledEntities) + ", I: " + std::to_string(((totalEntities - culledEntities) - renderedEntities));
|
||||
}
|
||||
//
|
||||
// int[] toRender = new int[50000];
|
||||
// IntBuffer resultBuffer = MemoryTracker.createIntBuffer(64);
|
||||
@@ -1158,6 +1158,7 @@ void LevelRenderer::renderSky(float alpha) {
|
||||
// thanks to the mcpe 0.1 decomp project a bit for this part, was not getting the gl states correctly, gles is painful - shredder
|
||||
|
||||
// Sunrise
|
||||
if (mc->options.getBooleanValue(OPTIONS_BEAUTIFUL_SKY)) {
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
@@ -1228,6 +1229,7 @@ void LevelRenderer::renderSky(float alpha) {
|
||||
glColor4f(a, a, a, a);
|
||||
drawArrayVT(starBuffer, starVertexCount);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
@@ -1240,7 +1242,9 @@ void LevelRenderer::renderSky(float alpha) {
|
||||
|
||||
glColor3f(sc.x * 0.2f + 0.04f, sc.y * 0.2f + 0.04f, sc.z * 0.6f + 0.1f);
|
||||
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
|
||||
@@ -1251,7 +1255,7 @@ void LevelRenderer::renderSky(float alpha) {
|
||||
|
||||
void LevelRenderer::renderClouds( float alpha ) {
|
||||
//if (!mc->level->dimension->isNaturalDimension()) return;
|
||||
if (mc->options.getBooleanValue(OPTIONS_FANCY_GRAPHICS)){
|
||||
if (mc->options.getBooleanValue(OPTIONS_FANCY_GRAPHICS) && mc->options.getBooleanValue(OPTIONS_BETA_SKY)){
|
||||
renderAdvancedClouds(alpha);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -69,6 +69,7 @@ public:
|
||||
void levelEvent(Player* source, int type, int x, int y, int z, int data);
|
||||
|
||||
std::string gatherStats1();
|
||||
std::string gatherStats2();
|
||||
|
||||
void render(const AABB& b) const;
|
||||
void onGraphicsReset();
|
||||
|
||||
@@ -75,7 +75,7 @@ void PerfRenderer::renderFpsMeter( float tickTime )
|
||||
glDisable2(GL_TEXTURE_2D);
|
||||
Tesselator& t = Tesselator::instance;
|
||||
|
||||
t.begin(GL_TRIANGLES);
|
||||
t.begin(GL_QUADS);
|
||||
int hh1 = (int) (usPer60Fps / 200);
|
||||
float count = (float)frameTimes.size();
|
||||
t.color(0x20000000);
|
||||
@@ -117,7 +117,8 @@ void PerfRenderer::renderFpsMeter( float tickTime )
|
||||
t.color(0xff000000 + cc * 256);
|
||||
}
|
||||
|
||||
float time = 10 * 1000 * frameTimes[i] / 200;
|
||||
// float time = 10 * 1000 * frameTimes[i] / 200;
|
||||
float time = frameTimes[i] * 4000.0f;
|
||||
float time2 = 10 * 1000 * tickTimes[i] / 200;
|
||||
|
||||
t.vertex(i + 0.5f, _mc->height - time + 0.5f, 0);
|
||||
@@ -210,12 +211,12 @@ void PerfRenderer::renderFpsMeter( float tickTime )
|
||||
msg << result.name;
|
||||
float xx = (float)(x - r);
|
||||
float yy = (float)(y + r/2 + i * 8 + 20);
|
||||
_font->drawShadow(msg.str(), xx, yy, result.getColor());
|
||||
_font->drawShadow(msg.str(), xx + 10 + 10, yy, result.getColor());
|
||||
std::string msg2 = toPercentString(result.percentage);
|
||||
//LOGI("name: %s: perc: %f == %s @ %d, %d\n", msg.str().c_str(), result.percentage, msg2.c_str(), xx, yy);
|
||||
_font->drawShadow(msg2, xx - 50 - _font->width(msg2), yy, result.getColor());
|
||||
_font->drawShadow(msg2, xx + 10 + 10 - _font->width(msg2), yy, result.getColor());
|
||||
msg2 = toPercentString(result.globalPercentage);
|
||||
_font->drawShadow(msg2, xx - _font->width(msg2), yy, result.getColor());
|
||||
_font->drawShadow(msg2, xx + 10 + 10 - _font->width(msg2), yy, result.getColor());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include "StringUtils.h"
|
||||
|
||||
//package util;
|
||||
#ifdef PROFILER
|
||||
//#ifdef PROFILER
|
||||
#define TIMER_PUSH(x) PerfTimer::push(x)
|
||||
#define TIMER_POP() PerfTimer::pop()
|
||||
#define TIMER_POP_PUSH(x) PerfTimer::popPush(x)
|
||||
@@ -16,11 +16,11 @@
|
||||
// #define TIMER_PUSH(x) ServerProfiler::push(x)
|
||||
// #define TIMER_POP() ServerProfiler::pop()
|
||||
// #define TIMER_POP_PUSH(x) ServerProfiler::popPush(x)
|
||||
#else
|
||||
#define TIMER_PUSH(x) ((void*)0)
|
||||
#define TIMER_POP() ((void*)0)
|
||||
#define TIMER_POP_PUSH(x) ((void*)0)
|
||||
#endif
|
||||
//#else
|
||||
// #define TIMER_PUSH(x) ((void*)0)
|
||||
// #define TIMER_POP() ((void*)0)
|
||||
// #define TIMER_POP_PUSH(x) ((void*)0)
|
||||
//#endif
|
||||
|
||||
class PerfTimer
|
||||
{
|
||||
|
||||
@@ -1735,13 +1735,13 @@ void Level::extinguishFire(int x, int y, int z, int face) {
|
||||
setTile(x, y, z, 0);
|
||||
}
|
||||
}
|
||||
// String gatherStats() {
|
||||
// return "All: " + this.entities.size();
|
||||
// }
|
||||
//
|
||||
// String gatherChunkSourceStats() {
|
||||
// return chunkSource.gatherStats();
|
||||
// }
|
||||
std::string Level::gatherStats() {
|
||||
return "All: " + std::to_string(entities.size());
|
||||
}
|
||||
|
||||
std::string Level::gatherChunkSourceStats() {
|
||||
return _chunkSource->gatherStats();
|
||||
}
|
||||
//
|
||||
TileEntity* Level::getTileEntity(int x, int y, int z) {
|
||||
LevelChunk* lc = getChunk(x >> 4, z >> 4);
|
||||
|
||||
@@ -202,6 +202,9 @@ public:
|
||||
bool checkAndHandleWater(const AABB& box, const Material* material, Entity* e);
|
||||
void extinguishFire(int x, int y, int z, int face);
|
||||
|
||||
std::string Level::gatherStats();
|
||||
std::string Level::gatherChunkSourceStats();
|
||||
|
||||
//void addEntities(const EntityList& list);
|
||||
//void removeEntities(const EntityList& list);
|
||||
//void ensureAdded(Entity* entity);
|
||||
|
||||
@@ -193,7 +193,8 @@ public:
|
||||
}
|
||||
|
||||
std::string gatherStats() {
|
||||
return "ChunkCache: 1024";
|
||||
// return "ChunkCache: 1024";
|
||||
return ("ChunkCache: " + std::to_string(CHUNK_CACHE_WIDTH * CHUNK_CACHE_WIDTH));
|
||||
}
|
||||
|
||||
void saveAll(bool onlyUnsaved) {
|
||||
|
||||
@@ -133,6 +133,13 @@ Dimension* Dimension::getNew( int id )
|
||||
return NULL;
|
||||
}
|
||||
|
||||
std::string Dimension::getDimension(){
|
||||
int currentID = this->id;
|
||||
if (currentID == Dimension::NORMAL) return "Overworld";
|
||||
if (currentID == Dimension::NORMAL_DAYCYCLE) return "Overworld";
|
||||
return "Unknown";
|
||||
}
|
||||
|
||||
//
|
||||
// DimensionFactory
|
||||
//
|
||||
|
||||
@@ -49,7 +49,7 @@ public:
|
||||
bool hasCeiling;
|
||||
float brightnessRamp[16];//Level::MAX_BRIGHTNESS + 1];
|
||||
int id;
|
||||
|
||||
std::string getDimension();
|
||||
// shredder added
|
||||
int FogType; // lets us choose between what fog we want ig
|
||||
protected:
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "../tile/Tile.h"
|
||||
#include "../tile/HeavyTile.h"
|
||||
#include "../../../util/Random.h"
|
||||
#include "../../level/tile/TallGrass.h"
|
||||
|
||||
const float RandomLevelSource::SNOW_CUTOFF = 0.5f;
|
||||
const float RandomLevelSource::SNOW_SCALE = 0.3f;
|
||||
@@ -419,17 +420,46 @@ void RandomLevelSource::postProcess(ChunkSource* parent, int xt, int zt) {
|
||||
FlowerFeature feature(Tile::mushroom2->id);
|
||||
feature.place(level, &random, x, y, z);
|
||||
}
|
||||
int grassCount = 1;
|
||||
// normally unused in mcpe but how its supposed to do it
|
||||
//int grassCount = 1;
|
||||
//for (int i = 0; i < grassCount; i++) {
|
||||
//int x = xo + random.nextInt(16) + 8;
|
||||
//int y = random.nextInt(Level::genDepth);
|
||||
//int z = zo + random.nextInt(16) + 8;
|
||||
//Feature* grassFeature = biome->getGrassFeature(&random);
|
||||
//if (grassFeature) {
|
||||
//grassFeature->place(level, &random, x, y, z);
|
||||
//delete grassFeature;
|
||||
//}
|
||||
//}
|
||||
|
||||
// reworked code from above to generate ferns and shrubs to just like in beta java
|
||||
int grassCount = 0;
|
||||
|
||||
if (biome == Biome::forest) { grassCount = 2; }
|
||||
else if (biome == Biome::rainForest) { grassCount = 10; }
|
||||
else if (biome == Biome::seasonalForest) { grassCount = 2; }
|
||||
else if (biome == Biome::taiga) { grassCount = 1; }
|
||||
else if (biome == Biome::plains) { grassCount = 10; }
|
||||
|
||||
for (int i = 0; i < grassCount; i++) {
|
||||
int grassMetadata = TallGrass::TALL_GRASS;
|
||||
|
||||
|
||||
if (biome == Biome::rainForest && random.nextInt(3) != 0) {
|
||||
grassMetadata = TallGrass::FERN;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
int y = level->getHeightmap(x, z);
|
||||
|
||||
TallgrassFeature grassFeature(Tile::tallgrass->id, grassMetadata);
|
||||
grassFeature.place(level, &random, x, y, z);
|
||||
}
|
||||
|
||||
|
||||
for (int i = 0; i < 10; i++) {
|
||||
int x = xo + random.nextInt(16) + 8;
|
||||
int y = random.nextInt(128);
|
||||
|
||||
@@ -10,5 +10,6 @@
|
||||
#include "OreFeature.h"
|
||||
#include "ReedsFeature.h"
|
||||
#include "SpringFeature.h"
|
||||
#include "TallgrassFeature.h"
|
||||
|
||||
#endif /*FEATURE_INCLUDE__H__*/
|
||||
|
||||
@@ -33,15 +33,21 @@ int TallGrass::getColor() {
|
||||
}
|
||||
|
||||
int TallGrass::getColor( int auxData ) {
|
||||
if(auxData == DEAD_SHRUB) return 0xffffffff;
|
||||
if(auxData == DEAD_SHRUB);
|
||||
if (!FoliageColor::useTint && auxData == DEAD_SHRUB){
|
||||
return 0xffffff;
|
||||
}
|
||||
return FoliageColor::getDefaultColor();
|
||||
}
|
||||
|
||||
int TallGrass::getColor( LevelSource* level, int x, int y, int z ) {
|
||||
int d = level->getData(x, y, z);
|
||||
if (d == DEAD_SHRUB) return 0xffffff;
|
||||
if (d == DEAD_SHRUB); //return 0xffffff; // i removed this to make it accurate to beta 1.6.6 instead of early java release versions
|
||||
float temp = level->getBiomeSource()->temperatures[0]; // shredder added
|
||||
float rain = level->getBiomeSource()->downfalls[0]; // shredder added
|
||||
if (!GrassColor::useTint && d == DEAD_SHRUB){
|
||||
return 0xffffff;
|
||||
}
|
||||
if (GrassColor::useTint){
|
||||
return GrassColor::get(temp, rain);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user