diff --git a/data/lang/en_US.lang b/data/lang/en_US.lang index b7c2ca9..c90c4be 100755 --- a/data/lang/en_US.lang +++ b/data/lang/en_US.lang @@ -229,6 +229,12 @@ options.fancyGraphics=Fancy graphics options.renderDebug=Debug render options.anaglyph3d=3D anaglyph +options.windowScale =Window Scaling + +options.menuStyle =Menu Style +options.menuStyle.pocket =Pocket Edition +options.menuStyle.xperia =Xperia/Pi +options.menuStyle.java =Java Beta performance.max=Max FPS performance.balanced=Balanced diff --git a/src/client/Minecraft.cpp b/src/client/Minecraft.cpp index db32ae2..eadb978 100755 --- a/src/client/Minecraft.cpp +++ b/src/client/Minecraft.cpp @@ -843,7 +843,7 @@ void Minecraft::tickInput() { if (key == Keyboard::KEY_ESCAPE) pauseGame(false); - #ifndef OPENGL_ES + #ifdef PLATFORM_DESKTOP if (key == Keyboard::KEY_P) { static bool isWireFrame = false; isWireFrame = !isWireFrame; @@ -864,12 +864,14 @@ void Minecraft::tickInput() { static bool prevMouseDownLeft = false; - if (Mouse::getButtonState(MouseAction::ACTION_LEFT) == 0) { - gameMode->stopDestroyBlock(); - } + if (!useTouchscreen()) { + if (Mouse::getButtonState(MouseAction::ACTION_LEFT) == 0) { + gameMode->stopDestroyBlock(); + } - if (!Mouse::isButtonDown(MouseAction::ACTION_RIGHT)) { - gameMode->releaseUsingItem(player); + if (!Mouse::isButtonDown(MouseAction::ACTION_RIGHT)) { + gameMode->releaseUsingItem(player); + } } if (useTouchscreen()) { @@ -1142,7 +1144,8 @@ void Minecraft::init() textures->addDynamicTexture(new WaterSideTexture()); textures->addDynamicTexture(new LavaTexture()); textures->addDynamicTexture(new LavaSideTexture()); - textures->addDynamicTexture(new FireTexture()); + textures->addDynamicTexture(new FireTexture(0)); + textures->addDynamicTexture(new FireTexture(1)); gui.texturesLoaded(textures); levelRenderer = new LevelRenderer(this); @@ -1191,6 +1194,27 @@ void Minecraft::setSize(int w, int h) { width = w; height = h; + int screenWidth; + int screenHeight; +//#ifdef PLATFORM_DESKTOP +if (options.getBooleanValue(OPTIONS_WINDOW_SCALE)){ // scales with resolution using a formula instead of having hardcoded if checks + int guiScale = options.getIntValue(OPTIONS_GUI_SCALE); + if (guiScale == 0) { + guiScale = 1000; + } + + // determine gui scale, optionally overriding auto + + + Gui::GuiScale = (float)Mth::Min(guiScale, Mth::Max(1, Mth::Min(width / 320, height / 240))); + + // 2. Calculate the Inverse based on the NEW scale + Gui::InvGuiScale = 1.0f / Gui::GuiScale; + screenWidth = (int)(width * Gui::InvGuiScale); + screenHeight = (int)(height * Gui::InvGuiScale); + +} else { + int guiScale = options.getIntValue(OPTIONS_GUI_SCALE); @@ -1228,8 +1252,8 @@ void Minecraft::setSize(int w, int h) { } Gui::InvGuiScale = 1.0f / Gui::GuiScale; - int screenWidth = (int)(width * Gui::InvGuiScale); - int screenHeight = (int)(height * Gui::InvGuiScale); + screenWidth = (int)(width * Gui::InvGuiScale); + screenHeight = (int)(height * Gui::InvGuiScale); // if (platform()) { // float pixelsPerMillimeter = options.getProgressValue(&Option::PIXELS_PER_MILLIMETER); @@ -1237,6 +1261,8 @@ void Minecraft::setSize(int w, int h) { // pixelCalcUi.setPixelsPerMillimeter(pixelsPerMillimeter * Gui::InvGuiScale); // } +#endif +} Config config = createConfig(this); gui.onConfigChanged(config); @@ -1251,7 +1277,7 @@ void Minecraft::setSize(int w, int h) { char resbuf[128]; sprintf(resbuf, " %d x %d @ scale %.2f", width, height, Gui::GuiScale); //gui.addMessage(resbuf); -#endif + #endif /* STANDALONE_SERVER */ } diff --git a/src/client/Options.cpp b/src/client/Options.cpp index 5a438eb..0785d4d 100755 --- a/src/client/Options.cpp +++ b/src/client/Options.cpp @@ -82,6 +82,10 @@ OptionBool restoredAnims("restoredAnims", true); OptionInt debugStyle("debugStyle", 0, 0, 1); +OptionInt menuStyle("menuStyle",0, 0, 2); + +OptionBool windowScale("windowScale", false); + OptionInt keyForward("key.forward", Keyboard::KEY_W); OptionInt keyLeft("key.left", Keyboard::KEY_A); OptionInt keyBack("key.back", Keyboard::KEY_S); @@ -134,6 +138,7 @@ void Options::initTable() { m_options[OPTIONS_GUI_SCALE] = &guiScale; + m_options[OPTIONS_WINDOW_SCALE] = &windowScale; m_options[OPTIONS_SKIN] = &skin; m_options[OPTIONS_USERNAME] = &username; @@ -170,6 +175,8 @@ void Options::initTable() { m_options[OPTIONS_SERVER_VISIBLE] = &serverVisible; + m_options[OPTIONS_MENU_STYLE] = &menuStyle; + m_options[OPTIONS_KEY_FORWARD] = &keyForward; m_options[OPTIONS_KEY_LEFT] = &keyLeft; m_options[OPTIONS_KEY_BACK] = &keyBack; diff --git a/src/client/Options.h b/src/client/Options.h index 90aea6c..001a555 100755 --- a/src/client/Options.h +++ b/src/client/Options.h @@ -37,6 +37,7 @@ enum OptionId { OPTIONS_BAR_ON_TOP, OPTIONS_ALLOW_SPRINT, OPTIONS_AUTOJUMP, + OPTIONS_WINDOW_SCALE, // Graphics OPTIONS_RENDER_DEBUG, @@ -51,6 +52,7 @@ enum OptionId { OPTIONS_FANCY_GRAPHICS, OPTIONS_NORMAL_LIGHTING, + // Cheats / debug OPTIONS_FLY_SPEED, OPTIONS_CAMERA_SPEED, @@ -95,6 +97,8 @@ enum OptionId { OPTIONS_BEAUTIFUL_SKY, OPTIONS_VIGNETTE, OPTIONS_DEBUG_STYLE, + OPTIONS_COMPLETE_LIGHTING, + OPTIONS_MENU_STYLE, // Should be last! OPTIONS_COUNT }; diff --git a/src/client/gui/components/OptionsItem.cpp b/src/client/gui/components/OptionsItem.cpp index d55b447..93eccb8 100755 --- a/src/client/gui/components/OptionsItem.cpp +++ b/src/client/gui/components/OptionsItem.cpp @@ -56,6 +56,28 @@ void OptionsItem::render( Minecraft* minecraft, int xm, int ym ) { } text += ": " + scaleText; } + if (m_optionId == OPTIONS_MENU_STYLE) { + int value = minecraft->options.getIntValue(OPTIONS_MENU_STYLE); + std::string scaleText; + switch (value) { + case 0: scaleText = I18n::get("options.menuStyle.pocket"); break; + case 1: scaleText = I18n::get("options.menuStyle.xperia"); break; + case 2: scaleText = I18n::get("options.menuStyle.java"); break; + } + text += ": " + scaleText; + } + if (m_optionId == OPTIONS_VIEW_DISTANCE) { + int value = minecraft->options.getIntValue(OPTIONS_VIEW_DISTANCE); + std::string scaleText; + switch (value) { + case 0: scaleText = I18n::get("options.renderDistance.far"); break; + case 1: scaleText = I18n::get("options.renderDistance.normal"); break; + case 2: scaleText = I18n::get("options.renderDistance.short"); break; + case 3: scaleText = I18n::get("options.renderDistance.tiny"); break; + default: scaleText = "Debug"; break; + } + text += ": " + scaleText; + } minecraft->font->draw(text, (float)x, (float)y + yOffset, 0x909090, false); super::render(minecraft, xm, ym); diff --git a/src/client/gui/screens/DeathScreen.cpp b/src/client/gui/screens/DeathScreen.cpp index 411b148..e97b103 100755 --- a/src/client/gui/screens/DeathScreen.cpp +++ b/src/client/gui/screens/DeathScreen.cpp @@ -23,12 +23,15 @@ DeathScreen::~DeathScreen() void DeathScreen::init() { - if (/* minecraft->useTouchscreen() */ true) { + if (minecraft->options.getIntValue(OPTIONS_MENU_STYLE) == 0) { bRespawn = new Touch::TButton(1, "Respawn!"); bTitle = new Touch::TButton(2, "Main menu"); - } else { + } else if (minecraft->options.getIntValue(OPTIONS_MENU_STYLE) == 1) { bRespawn = new Button(1, "Respawn!"); bTitle = new Button(2, "Main menu"); + } else { + bRespawn = new Button(1, 0, 0, 200, 20, "Respawn"); + bTitle = new Button(2, 0, 0, 200, 20, "Title menu"); } buttons.push_back(bRespawn); buttons.push_back(bTitle); @@ -39,13 +42,23 @@ void DeathScreen::init() void DeathScreen::setupPositions() { - bRespawn->width = bTitle->width = width / 4; +if (minecraft->options.getIntValue(OPTIONS_MENU_STYLE) == 2){ + bRespawn->width = 200; + bTitle->width = 200; + int centerX = (width / 2) - (bRespawn->width / 2); + bRespawn->x = centerX; + bTitle->x = centerX; + + bRespawn->y = (height / 2); + bTitle->y = bRespawn->y + 24; +} else { + bRespawn->width = bTitle->width = width / 4; bRespawn->y = bTitle->y = height / 2; bRespawn->x = width/2 - bRespawn->width - 10; bTitle->x = width/2 + 10; - - LOGI("xyz: %d, %d (%d, %d)\n", bTitle->x, bTitle->y, width, height); +} +// LOGI("xyz: %d, %d (%d, %d)\n", bTitle->x, bTitle->y, width, height); } void DeathScreen::tick() { @@ -56,10 +69,20 @@ void DeathScreen::render( int xm, int ym, float a ) { fillGradient(0, 0, width, height, 0x60500000, 0xa0803030); +if (minecraft->options.getIntValue(OPTIONS_MENU_STYLE) == 2){ + glPushMatrix2(); + glScalef2(2, 2, 2); + drawCenteredString(font, "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(); glScalef2(2, 2, 2); drawCenteredString(font, "You died!", width / 2 / 2, height / 8, 0xffffff); glPopMatrix2(); +} if (_tick >= WAIT_TICKS) Screen::render(xm, ym, a); diff --git a/src/client/gui/screens/IngameBlockSelectionScreen.cpp b/src/client/gui/screens/IngameBlockSelectionScreen.cpp index c1b72c7..1eab145 100755 --- a/src/client/gui/screens/IngameBlockSelectionScreen.cpp +++ b/src/client/gui/screens/IngameBlockSelectionScreen.cpp @@ -12,6 +12,7 @@ #include "../../renderer/Textures.h" #include "../../gamemode/GameMode.h" #include "ArmorScreen.h" +#include "crafting/WorkbenchScreen.h" #include "../components/Button.h" #if defined(__APPLE__) @@ -27,7 +28,8 @@ IngameBlockSelectionScreen::IngameBlockSelectionScreen() InventoryRows(1), InventoryCols(1), InventorySize(1), - bArmor(1, "Armor") + bArmor(1, "Armor"), + bCrafting(1, "Crafting") { } @@ -42,6 +44,19 @@ void IngameBlockSelectionScreen::init() (float)getSlotPosY(0) - 4, (float)getSlotPosX(InventoryCols) + 4, (float)getSlotPosY(InventoryRows) + 4); + + if (!minecraft->isCreativeMode()) { + bArmor.width = 42; + bCrafting.width = 42; + + bArmor.x = 0; + bArmor.y = height - bArmor.height; + + bCrafting.x = 0; + bCrafting.y = height - bCrafting.height - 30; + buttons.push_back(&bArmor); + buttons.push_back(&bCrafting); + } ItemInstance* selected = inventory->getSelected(); if (!selected || selected->isNull()) { @@ -58,13 +73,6 @@ void IngameBlockSelectionScreen::init() } if (!isAllowed(selectedItem)) selectedItem = 0; - - if (!minecraft->isCreativeMode()) { - bArmor.width = 42; - bArmor.x = 0; - bArmor.y = height - bArmor.height; - buttons.push_back(&bArmor); - } } void IngameBlockSelectionScreen::removed() @@ -124,7 +132,7 @@ void IngameBlockSelectionScreen::renderSlots() //w.printEvery(1000, "render-blocksel"); glDisable2(GL_RESCALE_NORMAL); - Lighting::turnOn(minecraft); + Lighting::turnOff(); } int IngameBlockSelectionScreen::getSlotPosX(int slotX) { @@ -249,7 +257,7 @@ void IngameBlockSelectionScreen::mouseClicked(int x, int y, int buttonNum) //minecraft->soundEngine->playUI("random.click", 1, 1); } else { _pendingQuit = !_area.isInside((float)x, (float)y) - && !bArmor.isInside(x, y); + && !bArmor.isInside(x, y) && !bCrafting.isInside(x, y); } } if (!_pendingQuit) @@ -338,5 +346,8 @@ void IngameBlockSelectionScreen::buttonClicked( Button* button ) if (button == &bArmor) { minecraft->setScreen(new ArmorScreen()); } + if (button == &bCrafting) { + minecraft->setScreen(new WorkbenchScreen(Recipe::SIZE_2X2)); + } super::buttonClicked(button); } diff --git a/src/client/gui/screens/IngameBlockSelectionScreen.h b/src/client/gui/screens/IngameBlockSelectionScreen.h index affd6af..6a0c4b9 100755 --- a/src/client/gui/screens/IngameBlockSelectionScreen.h +++ b/src/client/gui/screens/IngameBlockSelectionScreen.h @@ -52,6 +52,7 @@ private: bool _pendingQuit; Button bArmor; + Button bCrafting; RectangleArea _area; }; diff --git a/src/client/gui/screens/OptionsScreen.cpp b/src/client/gui/screens/OptionsScreen.cpp index 77d5a5f..d4eced8 100755 --- a/src/client/gui/screens/OptionsScreen.cpp +++ b/src/client/gui/screens/OptionsScreen.cpp @@ -197,6 +197,7 @@ void OptionsScreen::generateOptionScreens() { optionPanes[1]->addOptionItem(OPTIONS_DIFFICULTY, minecraft) .addOptionItem(OPTIONS_SERVER_VISIBLE, minecraft) .addOptionItem(OPTIONS_THIRD_PERSON_VIEW, minecraft) + .addOptionItem(OPTIONS_WINDOW_SCALE, minecraft) .addOptionItem(OPTIONS_GUI_SCALE, minecraft) .addOptionItem(OPTIONS_SENSITIVITY, minecraft) .addOptionItem(OPTIONS_MUSIC_VOLUME, minecraft) @@ -223,6 +224,7 @@ void OptionsScreen::generateOptionScreens() { // .addOptionItem(&Option::ANAGLYPH, minecraft) .addOptionItem(OPTIONS_LIMIT_FRAMERATE, minecraft) .addOptionItem(OPTIONS_VSYNC, minecraft) + .addOptionItem(OPTIONS_VIEW_DISTANCE, minecraft) .addOptionItem(OPTIONS_RENDER_DEBUG, minecraft) .addOptionItem(OPTIONS_ANAGLYPH_3D, minecraft) .addOptionItem(OPTIONS_VIEW_BOBBING, minecraft) @@ -233,6 +235,7 @@ void OptionsScreen::generateOptionScreens() { optionPanes[4]->addOptionItem(OPTIONS_ALLOW_SPRINT, minecraft) .addOptionItem(OPTIONS_BAR_ON_TOP, minecraft) + .addOptionItem(OPTIONS_MENU_STYLE, minecraft) .addOptionItem(OPTIONS_RPI_CURSOR, minecraft) .addOptionItem(OPTIONS_FOLIAGE_TINT, minecraft) .addOptionItem(OPTIONS_TINTED_SIDE, minecraft) diff --git a/src/client/gui/screens/PauseScreen.cpp b/src/client/gui/screens/PauseScreen.cpp index ab30ecb..64b611e 100755 --- a/src/client/gui/screens/PauseScreen.cpp +++ b/src/client/gui/screens/PauseScreen.cpp @@ -10,18 +10,18 @@ #include "client/gui/screens/OptionsScreen.h" PauseScreen::PauseScreen(bool wasBackPaused) -: saveStep(0), + : saveStep(0), visibleTime(0), bContinue(0), bQuit(0), bOptions(0), bQuitAndSaveLocally(0), bServerVisibility(0), -// bThirdPerson(0), + // bThirdPerson(0), wasBackPaused(wasBackPaused), // bSound(OPTIONS_SOUND_VOLUME, 1, 0), bThirdPerson(OPTIONS_THIRD_PERSON_VIEW), - bHideGui(OPTIONS_HIDEGUI) + bHideGui(OPTIONS_HIDEGUI) { ImageDef def; def.setSrc(IntRectangle(160, 144, 39, 31)); @@ -34,7 +34,7 @@ PauseScreen::PauseScreen(bool wasBackPaused) // bSound.setImageDef(def, true); defSrc.y += defSrc.h; bThirdPerson.setImageDef(def, true); - bHideGui.setImageDef(def, true); + bHideGui.setImageDef(def, true); //void setImageDef(ImageDef& imageDef, bool setButtonSize); } @@ -44,24 +44,31 @@ PauseScreen::~PauseScreen() { delete bQuitAndSaveLocally; delete bServerVisibility; delete bOptions; -// delete bThirdPerson; + // delete bThirdPerson; } void PauseScreen::init() { - if (/* minecraft->useTouchscreen() */ true) { + if (minecraft->options.getIntValue(OPTIONS_MENU_STYLE) == 0) { bContinue = new Touch::TButton(1, "Back to game"); bOptions = new Touch::TButton(5, "Options"); bQuit = new Touch::TButton(2, "Quit to title"); bQuitAndSaveLocally = new Touch::TButton(3, "Quit and copy map"); bServerVisibility = new Touch::TButton(4, ""); -// bThirdPerson = new Touch::TButton(5, "Toggle 3:rd person view"); - } else { + // bThirdPerson = new Touch::TButton(5, "Toggle 3:rd person view"); + } else if (minecraft->options.getIntValue(OPTIONS_MENU_STYLE) == 1) { bContinue = new Button(1, "Back to game"); bOptions = new Button(5, "Options"); bQuit = new Button(2, "Quit to title"); bQuitAndSaveLocally = new Button(3, "Quit and copy map"); bServerVisibility = new Button(4, ""); -// bThirdPerson = new Button(5, "Toggle 3:rd person view"); + // bThirdPerson = new Button(5, "Toggle 3:rd person view"); + } else { + bContinue = new Button(1, 0, 0, 200, 20, "Back to game"); + bServerVisibility = new Button(4, 0, 0, 200, 20, ""); + bOptions = new Button(5, 0, 0, 200, 20, "Options..."); + bQuit = new Button(2, 0, 0, 200, 20, "Save and quit to title"); + bQuitAndSaveLocally = new Button(3, 0, 0, 200, 20, "Copy and quit map"); + // bThirdPerson = new Button(5, "Toggle 3:rd person view"); } buttons.push_back(bContinue); @@ -72,12 +79,12 @@ void PauseScreen::init() { bHideGui.updateImage(&minecraft->options); // buttons.push_back(&bSound); buttons.push_back(&bThirdPerson); - //buttons.push_back(&bHideGui); + //buttons.push_back(&bHideGui); // If Back wasn't pressed, set up additional items (more than Quit to menu // and Back to game) here - - #if !defined(APPLE_DEMO_PROMOTION) && !defined(RPI) + +#if !defined(APPLE_DEMO_PROMOTION) && !defined(RPI) if (true || !wasBackPaused) { if (minecraft->raknetInstance) { if (minecraft->raknetInstance->isServer()) { @@ -85,14 +92,14 @@ void PauseScreen::init() { buttons.push_back(bServerVisibility); } else { - #if !defined(DEMO_MODE) - buttons.push_back(bQuitAndSaveLocally); - #endif +#if !defined(DEMO_MODE) + buttons.push_back(bQuitAndSaveLocally); +#endif } } } - #endif -// buttons.push_back(bThirdPerson); +#endif + // buttons.push_back(bThirdPerson); for (unsigned int i = 0; i < buttons.size(); ++i) { // if (buttons[i] == &bSound) continue; @@ -103,27 +110,48 @@ void PauseScreen::init() { } void PauseScreen::setupPositions() { - saveStep = 0; + saveStep = 0; int yBase = 16; + if (minecraft->options.getIntValue(OPTIONS_MENU_STYLE) == 2){ + yBase = 50; - bContinue->width = bOptions->width = bQuit->width = /*bThirdPerson->w =*/ 160; - bQuitAndSaveLocally->width = bServerVisibility->width = 160; + bContinue->width = bOptions->width = bQuit->width = /*bThirdPerson->w =*/ 200; + bQuitAndSaveLocally->width = bServerVisibility->width = 200; - bContinue->x = (width - bContinue->width) / 2; - bContinue->y = yBase + 32 * 1; + bContinue->x = (width - bContinue->width) / 2; + bContinue->y = yBase + 24 * 1; - bOptions->x = (width - bOptions->width) / 2; - bOptions->y = yBase + 32 * 2; + bQuitAndSaveLocally->x = bServerVisibility->x = (width - bQuitAndSaveLocally->width) / 2; + bQuitAndSaveLocally->y = bServerVisibility->y = yBase + 24 * 2; - bQuit->x = (width - bQuit->width) / 2; - bQuit->y = yBase + 32 * 3; + bOptions->x = (width - bOptions->width) / 2; + bOptions->y = yBase + 24 * 3 + 24; + + bQuit->x = (width - bQuit->width) / 2; + bQuit->y = yBase + 24 * 4 + 24; + + } else { + bContinue->width = bOptions->width = bQuit->width = /*bThirdPerson->w =*/ 160; + bQuitAndSaveLocally->width = bServerVisibility->width = 160; + + bContinue->x = (width - bContinue->width) / 2; + bContinue->y = yBase + 32 * 1; + + bOptions->x = (width - bOptions->width) / 2; + bOptions->y = yBase + 32 * 2; + + bQuit->x = (width - bQuit->width) / 2; + bQuit->y = yBase + 32 * 3; #if APPLE_DEMO_PROMOTION - bQuit->y += 16; + bQuit->y += 16; #endif - - bQuitAndSaveLocally->x = bServerVisibility->x = (width - bQuitAndSaveLocally->width) / 2; - bQuitAndSaveLocally->y = bServerVisibility->y = yBase + 32 * 4; + + bQuitAndSaveLocally->x = bServerVisibility->x = (width - bQuitAndSaveLocally->width) / 2; + bQuitAndSaveLocally->y = bServerVisibility->y = yBase + 32 * 4; + } + + // bSound.y = bThirdPerson.y = 8; // bSound.x = 4; @@ -161,9 +189,9 @@ void PauseScreen::buttonClicked(Button* button) { minecraft->setScreen(NULL); //minecraft->grabMouse(); } - if (button->id == bQuit->id) { + if (button->id == bQuit->id) { minecraft->leaveGame(); - } + } if (button->id == bQuitAndSaveLocally->id) { minecraft->leaveGame(true); } @@ -197,5 +225,5 @@ void PauseScreen::updateServerVisibilityText() ServerSideNetworkHandler* ss = (ServerSideNetworkHandler*) minecraft->netCallback; bServerVisibility->msg = ss->allowsIncomingConnections()? "Server is visible" - : "Server is invisible"; + : "Server is invisible"; } diff --git a/src/client/gui/screens/ScreenChooser.cpp b/src/client/gui/screens/ScreenChooser.cpp index 610a209..86dbdf5 100755 --- a/src/client/gui/screens/ScreenChooser.cpp +++ b/src/client/gui/screens/ScreenChooser.cpp @@ -21,7 +21,7 @@ Screen* ScreenChooser::createScreen( ScreenId id ) Screen* screen = NULL; // :sob: - if (/* _mc->useTouchscreen() */ true) { + if (_mc->options.getIntValue(OPTIONS_MENU_STYLE) == 0) { switch (id) { case SCREEN_STARTMENU: screen = new Touch::StartMenuScreen(); break; case SCREEN_SELECTWORLD: screen = new Touch::SelectWorldScreen();break; diff --git a/src/client/gui/screens/StartMenuScreen.cpp b/src/client/gui/screens/StartMenuScreen.cpp index 3fede7e..27f25ec 100755 --- a/src/client/gui/screens/StartMenuScreen.cpp +++ b/src/client/gui/screens/StartMenuScreen.cpp @@ -23,49 +23,62 @@ // Some kind of default settings, might be overridden in ::init StartMenuScreen::StartMenuScreen() -: bHost( 2, 0, 0, 160, 24, "Start Game"), - bJoin( 3, 0, 0, 160, 24, "Join Game"), - bOptions( 4, 0, 0, 160, 24, "Options"), - bQuit( 5, "") { } StartMenuScreen::~StartMenuScreen() { + delete bHost; + delete bJoin; + delete bOptions; + delete bQuit; } void StartMenuScreen::init() { - bJoin.active = bHost.active = bOptions.active = true; + if (minecraft->options.getIntValue(OPTIONS_MENU_STYLE) == 2){ + bHost = new Button( 2, 0, 0, 200, 20, "Singleplayer"); + bJoin = new Button( 3, 0, 0, 200, 20, "Multiplayer"); + bOptions = new Button( 4, 0, 0, 200, 20, "Options..."); + bQuit = new Button( 5, 0, 0, 200, 20, "Ouit Game"); + } else { + bHost = new Button( 2, 0, 0, 160, 24, "Start Game"); + bJoin = new Button( 3, 0, 0, 160, 24, "Join Game"); + bOptions = new Button( 4, 0, 0, 160, 24, "Options"); + bQuit = new Button( 5, 0, 0, 160, 24, "Ouit Game"); + } + bJoin->active = bHost->active = bOptions->active = true; if (minecraft->options.getStringValue(OPTIONS_USERNAME).empty()) { return; // tick() will redirect to UsernameScreen } - buttons.push_back(&bHost); - buttons.push_back(&bJoin); + buttons.push_back(bHost); + buttons.push_back(bJoin); //buttons.push_back(&bTest); + buttons.push_back(bQuit); - tabButtons.push_back(&bHost); - tabButtons.push_back(&bJoin); + tabButtons.push_back(bHost); + tabButtons.push_back(bJoin); + tabButtons.push_back(bQuit); #ifndef RPI - buttons.push_back(&bOptions); - tabButtons.push_back(&bOptions); + buttons.push_back(bOptions); + tabButtons.push_back(bOptions); #endif - // add quit button (top right X icon) – match OptionsScreen style - { - ImageDef def; - def.name = "gui/touchgui.png"; - def.width = 34; - def.height = 26; - def.setSrc(IntRectangle(150, 0, (int)def.width, (int)def.height)); - bQuit.setImageDef(def, true); - bQuit.scaleWhenPressed = false; - buttons.push_back(&bQuit); - // don't include in tab navigation - } + //// add quit button (top right X icon) – match OptionsScreen style + //{ + // ImageDef def; + // def.name = "gui/touchgui.png"; + // def.width = 34; + // def.height = 26; + // def.setSrc(IntRectangle(150, 0, (int)def.width, (int)def.height)); + // bQuit.setImageDef(def, true); + // bQuit.scaleWhenPressed = false; + // buttons.push_back(&bQuit); + // // don't include in tab navigation + //} copyright = "\xffMojang AB";//. Do not distribute!"; @@ -93,20 +106,30 @@ void StartMenuScreen::init() } void StartMenuScreen::setupPositions() { - int yBase = height / 2; + if (minecraft->options.getIntValue(OPTIONS_MENU_STYLE) == 2){ + int yBase = (height / 2) - 20; - bHost.y = yBase; - bJoin.y = bHost.y + 24 + 4; - bOptions.y = bJoin.y + 24 + 4; + bHost->y = yBase; + bJoin->y = bHost->y + 24; + bOptions->y = bJoin->y + 24; + bQuit->y = bOptions->y + 24; + } else { + int yBase = height / 2; + bHost->y = yBase; + bJoin->y = bHost->y + 24 + 4; + bOptions->y = bJoin->y + 24 + 4; + bQuit->y = bOptions->y + 24 + 4; + } // Center buttons - bHost.x = (width - bHost.width) / 2; - bJoin.x = (width - bJoin.width) / 2; - bOptions.x = (width - bOptions.width) / 2; + bHost->x = (width - bHost->width) / 2; + bJoin->x = (width - bJoin->width) / 2; + bOptions->x = (width - bOptions->width) / 2; + bQuit->x = (width - bQuit->width) / 2; - // position quit icon at top-right (use image-defined size) - bQuit.x = width - bQuit.width; - bQuit.y = 0; + //// position quit icon at top-right (use image-defined size) + //bQuit.x = width - bQuit.width; + //bQuit.y = 0; } void StartMenuScreen::tick() { @@ -114,7 +137,7 @@ void StartMenuScreen::tick() { void StartMenuScreen::buttonClicked(Button* button) { - if (button->id == bHost.id) + if (button->id == bHost->id) { #if defined(DEMO_MODE) || defined(APPLE_DEMO_PROMOTION) minecraft->setScreen( new SimpleChooseLevelScreen("_DemoLevel") ); @@ -122,16 +145,16 @@ void StartMenuScreen::buttonClicked(Button* button) { minecraft->screenChooser.setScreen(SCREEN_SELECTWORLD); #endif } - if (button->id == bJoin.id) + if (button->id == bJoin->id) { minecraft->locateMultiplayer(); minecraft->screenChooser.setScreen(SCREEN_JOINGAME); } - if (button->id == bOptions.id) + if (button->id == bOptions->id) { minecraft->setScreen(new OptionsScreen()); } - if (button == &bQuit) + if (button->id == bQuit->id) { minecraft->quit(); } diff --git a/src/client/gui/screens/StartMenuScreen.h b/src/client/gui/screens/StartMenuScreen.h index e2801fe..9ff3c8b 100755 --- a/src/client/gui/screens/StartMenuScreen.h +++ b/src/client/gui/screens/StartMenuScreen.h @@ -23,10 +23,10 @@ public: bool isInGameScreen(); private: - Button bHost; - Button bJoin; - Button bOptions; - ImageButton bQuit; // X button in top-right corner + Button* bHost; + Button* bJoin; + Button* bOptions; + Button* bQuit; std::string copyright; int copyrightPosX; diff --git a/src/client/renderer/LevelRenderer.cpp b/src/client/renderer/LevelRenderer.cpp index ea5120a..efccf21 100755 --- a/src/client/renderer/LevelRenderer.cpp +++ b/src/client/renderer/LevelRenderer.cpp @@ -575,7 +575,7 @@ void LevelRenderer::render(const AABB& b) const // t.color(255, 255, 255, 255); // again not needed, for some reason the vanilla source code tints it... white? maybe this was used for something else in MCPE's dev at one point? - shredder // t.offset(((Mob*)mc->player)->getPos(0).negated()); // why does this even exist normally, it just makes the thing... not render - + glLineWidth(2.0f); // make it more thick - shredder t.begin(GL_LINE_STRIP); t.vertex(b.x0, b.y0, b.z0); t.vertex(b.x1, b.y0, b.z0); diff --git a/src/client/renderer/entity/EntityRenderer.cpp b/src/client/renderer/entity/EntityRenderer.cpp index 692a967..335384f 100755 --- a/src/client/renderer/entity/EntityRenderer.cpp +++ b/src/client/renderer/entity/EntityRenderer.cpp @@ -130,9 +130,8 @@ void EntityRenderer::postRender(Entity* entity, float x, float y, float z, float if (pow > 0) { 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); } void EntityRenderer::renderFlame(Entity* e, float x, float y, float z, float a) { glDisable(GL_LIGHTING); @@ -187,7 +186,11 @@ void EntityRenderer::renderShadow(Entity* e, float x, float y, float z, float po //Textures* textures = entityRenderDispatcher->textures; //textures->bind(textures->loadTexture("%clamp%/environment/shadow.png")); Textures* textures = entityRenderDispatcher->textures; - + textures->loadAndBindTexture("/misc/shadow.png"); + + + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); @@ -221,9 +224,6 @@ void EntityRenderer::renderShadow(Entity* e, float x, float y, float z, float po renderTileShadow(Tile::tiles[t], x, y + e->getShadowHeightOffs(), z, xt, yt, zt, pow, r, xo, yo + e->getShadowHeightOffs(), zo); } } - textures->loadAndBindTexture(("/misc/shadow.png")); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); tt.draw(); glColor4f2(1, 1, 1, 1); diff --git a/src/client/renderer/ptexture/DynamicTexture.cpp b/src/client/renderer/ptexture/DynamicTexture.cpp index 23a6464..0af8757 100755 --- a/src/client/renderer/ptexture/DynamicTexture.cpp +++ b/src/client/renderer/ptexture/DynamicTexture.cpp @@ -393,8 +393,8 @@ void LavaSideTexture::tick() { } } -FireTexture::FireTexture() - : super(((Tile*)Tile::fire)->tex), +FireTexture::FireTexture(int id) + : super(((Tile*)Tile::fire)->tex + id * 16), _tick(0), _frame(0) { diff --git a/src/client/renderer/ptexture/DynamicTexture.h b/src/client/renderer/ptexture/DynamicTexture.h index 84b902e..a38f086 100755 --- a/src/client/renderer/ptexture/DynamicTexture.h +++ b/src/client/renderer/ptexture/DynamicTexture.h @@ -106,7 +106,7 @@ class FireTexture: public DynamicTexture float* heata; public: - FireTexture(); + FireTexture(int id); ~FireTexture(); void tick();