forked from Kolyah35/minecraft-pe-0.6.1
Compare commits
1 Commits
web-change
...
feature/is
| Author | SHA1 | Date | |
|---|---|---|---|
| 9b5d12832d |
@@ -8,6 +8,7 @@
|
|||||||
#include "client/Options.h"
|
#include "client/Options.h"
|
||||||
#include "client/gui/components/Button.h"
|
#include "client/gui/components/Button.h"
|
||||||
#include "client/gui/screens/OptionsScreen.h"
|
#include "client/gui/screens/OptionsScreen.h"
|
||||||
|
#include "UploadPhotoScreen.h"
|
||||||
|
|
||||||
PauseScreen::PauseScreen(bool wasBackPaused)
|
PauseScreen::PauseScreen(bool wasBackPaused)
|
||||||
: saveStep(0),
|
: saveStep(0),
|
||||||
@@ -17,6 +18,7 @@ PauseScreen::PauseScreen(bool wasBackPaused)
|
|||||||
bOptions(0),
|
bOptions(0),
|
||||||
bQuitAndSaveLocally(0),
|
bQuitAndSaveLocally(0),
|
||||||
bServerVisibility(0),
|
bServerVisibility(0),
|
||||||
|
bPhotoMode(0),
|
||||||
// bThirdPerson(0),
|
// bThirdPerson(0),
|
||||||
wasBackPaused(wasBackPaused),
|
wasBackPaused(wasBackPaused),
|
||||||
// bSound(OPTIONS_SOUND_VOLUME, 1, 0),
|
// bSound(OPTIONS_SOUND_VOLUME, 1, 0),
|
||||||
@@ -43,6 +45,7 @@ PauseScreen::~PauseScreen() {
|
|||||||
delete bQuit;
|
delete bQuit;
|
||||||
delete bQuitAndSaveLocally;
|
delete bQuitAndSaveLocally;
|
||||||
delete bServerVisibility;
|
delete bServerVisibility;
|
||||||
|
delete bPhotoMode;
|
||||||
delete bOptions;
|
delete bOptions;
|
||||||
// delete bThirdPerson;
|
// delete bThirdPerson;
|
||||||
}
|
}
|
||||||
@@ -51,6 +54,7 @@ void PauseScreen::init() {
|
|||||||
if (minecraft->options.getIntValue(OPTIONS_MENU_STYLE) == 0) {
|
if (minecraft->options.getIntValue(OPTIONS_MENU_STYLE) == 0) {
|
||||||
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");
|
||||||
|
bPhotoMode = new Touch::TButton(6, "Photo Mode");
|
||||||
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, "");
|
||||||
@@ -58,6 +62,7 @@ void PauseScreen::init() {
|
|||||||
} else if (minecraft->options.getIntValue(OPTIONS_MENU_STYLE) == 1) {
|
} else if (minecraft->options.getIntValue(OPTIONS_MENU_STYLE) == 1) {
|
||||||
bContinue = new Button(1, "Back to game");
|
bContinue = new Button(1, "Back to game");
|
||||||
bOptions = new Button(5, "Options");
|
bOptions = new Button(5, "Options");
|
||||||
|
bPhotoMode = new Button(6, "Photo Mode");
|
||||||
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, "");
|
||||||
@@ -66,6 +71,7 @@ void PauseScreen::init() {
|
|||||||
bContinue = new Button(1, 0, 0, 200, 20, "Back to game");
|
bContinue = new Button(1, 0, 0, 200, 20, "Back to game");
|
||||||
bServerVisibility = new Button(4, 0, 0, 200, 20, "");
|
bServerVisibility = new Button(4, 0, 0, 200, 20, "");
|
||||||
bOptions = new Button(5, 0, 0, 200, 20, "Options...");
|
bOptions = new Button(5, 0, 0, 200, 20, "Options...");
|
||||||
|
bPhotoMode = new Button(6, 0, 0, 200, 20, "Photo Mode");
|
||||||
bQuit = new Button(2, 0, 0, 200, 20, "Save and quit to title");
|
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");
|
bQuitAndSaveLocally = new Button(3, 0, 0, 200, 20, "Copy and quit map");
|
||||||
// bThirdPerson = new Button(5, "Toggle 3:rd person view");
|
// bThirdPerson = new Button(5, "Toggle 3:rd person view");
|
||||||
@@ -74,6 +80,7 @@ void PauseScreen::init() {
|
|||||||
buttons.push_back(bContinue);
|
buttons.push_back(bContinue);
|
||||||
buttons.push_back(bQuit);
|
buttons.push_back(bQuit);
|
||||||
buttons.push_back(bOptions);
|
buttons.push_back(bOptions);
|
||||||
|
buttons.push_back(bPhotoMode);
|
||||||
// bSound.updateImage(&minecraft->options);
|
// bSound.updateImage(&minecraft->options);
|
||||||
bThirdPerson.updateImage(&minecraft->options);
|
bThirdPerson.updateImage(&minecraft->options);
|
||||||
bHideGui.updateImage(&minecraft->options);
|
bHideGui.updateImage(&minecraft->options);
|
||||||
@@ -115,7 +122,7 @@ void PauseScreen::setupPositions() {
|
|||||||
if (minecraft->options.getIntValue(OPTIONS_MENU_STYLE) == 2){
|
if (minecraft->options.getIntValue(OPTIONS_MENU_STYLE) == 2){
|
||||||
yBase = 50;
|
yBase = 50;
|
||||||
|
|
||||||
bContinue->width = bOptions->width = bQuit->width = /*bThirdPerson->w =*/ 200;
|
bContinue->width = bOptions->width = bPhotoMode->width = bQuit->width = /*bThirdPerson->w =*/ 200;
|
||||||
bQuitAndSaveLocally->width = bServerVisibility->width = 200;
|
bQuitAndSaveLocally->width = bServerVisibility->width = 200;
|
||||||
|
|
||||||
bContinue->x = (width - bContinue->width) / 2;
|
bContinue->x = (width - bContinue->width) / 2;
|
||||||
@@ -124,6 +131,9 @@ void PauseScreen::setupPositions() {
|
|||||||
bQuitAndSaveLocally->x = bServerVisibility->x = (width - bQuitAndSaveLocally->width) / 2;
|
bQuitAndSaveLocally->x = bServerVisibility->x = (width - bQuitAndSaveLocally->width) / 2;
|
||||||
bQuitAndSaveLocally->y = bServerVisibility->y = yBase + 24 * 2;
|
bQuitAndSaveLocally->y = bServerVisibility->y = yBase + 24 * 2;
|
||||||
|
|
||||||
|
bPhotoMode->x = (width - bPhotoMode->width) / 2;
|
||||||
|
bPhotoMode->y = yBase + 24 * 3;
|
||||||
|
|
||||||
bOptions->x = (width - bOptions->width) / 2;
|
bOptions->x = (width - bOptions->width) / 2;
|
||||||
bOptions->y = yBase + 24 * 3 + 24;
|
bOptions->y = yBase + 24 * 3 + 24;
|
||||||
|
|
||||||
@@ -131,7 +141,7 @@ void PauseScreen::setupPositions() {
|
|||||||
bQuit->y = yBase + 24 * 4 + 24;
|
bQuit->y = yBase + 24 * 4 + 24;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
bContinue->width = bOptions->width = bQuit->width = /*bThirdPerson->w =*/ 160;
|
bContinue->width = bOptions->width = bPhotoMode->width = bQuit->width = /*bThirdPerson->w =*/ 160;
|
||||||
bQuitAndSaveLocally->width = bServerVisibility->width = 160;
|
bQuitAndSaveLocally->width = bServerVisibility->width = 160;
|
||||||
|
|
||||||
bContinue->x = (width - bContinue->width) / 2;
|
bContinue->x = (width - bContinue->width) / 2;
|
||||||
@@ -140,15 +150,18 @@ void PauseScreen::setupPositions() {
|
|||||||
bOptions->x = (width - bOptions->width) / 2;
|
bOptions->x = (width - bOptions->width) / 2;
|
||||||
bOptions->y = yBase + 32 * 2;
|
bOptions->y = yBase + 32 * 2;
|
||||||
|
|
||||||
|
bPhotoMode->x = (width - bPhotoMode->width) / 2;
|
||||||
|
bPhotoMode->y = yBase + 32 * 3;
|
||||||
|
|
||||||
bQuit->x = (width - bQuit->width) / 2;
|
bQuit->x = (width - bQuit->width) / 2;
|
||||||
bQuit->y = yBase + 32 * 3;
|
bQuit->y = yBase + 32 * 4;
|
||||||
|
|
||||||
#if APPLE_DEMO_PROMOTION
|
#if APPLE_DEMO_PROMOTION
|
||||||
bQuit->y += 16;
|
bQuit->y += 16;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
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 * 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -192,6 +205,9 @@ void PauseScreen::buttonClicked(Button* button) {
|
|||||||
if (button->id == bQuit->id) {
|
if (button->id == bQuit->id) {
|
||||||
minecraft->leaveGame();
|
minecraft->leaveGame();
|
||||||
}
|
}
|
||||||
|
if (button->id == bPhotoMode->id) {
|
||||||
|
minecraft->setScreen(new UploadPhotoScreen());
|
||||||
|
}
|
||||||
if (button->id == bQuitAndSaveLocally->id) {
|
if (button->id == bQuitAndSaveLocally->id) {
|
||||||
minecraft->leaveGame(true);
|
minecraft->leaveGame(true);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ private:
|
|||||||
Button* bQuit;
|
Button* bQuit;
|
||||||
Button* bQuitAndSaveLocally;
|
Button* bQuitAndSaveLocally;
|
||||||
Button* bServerVisibility;
|
Button* bServerVisibility;
|
||||||
|
Button* bPhotoMode;
|
||||||
Button* bOptions;
|
Button* bOptions;
|
||||||
|
|
||||||
// Button* bThirdPerson;
|
// Button* bThirdPerson;
|
||||||
|
|||||||
@@ -1,177 +1,160 @@
|
|||||||
#if 0
|
#include "UploadPhotoScreen.h"
|
||||||
|
|
||||||
#include "UploadPhotoScreen.h"
|
#include "../components/Button.h"
|
||||||
#include "../renderer/TileRenderer.h"
|
#include "../../Minecraft.h"
|
||||||
#include "../player/LocalPlayer.h"
|
#include "../../player/LocalPlayer.h"
|
||||||
#include "../../world/entity/player/Inventory.h"
|
#include "../../../world/entity/item/TripodCamera.h"
|
||||||
|
#include "../../../world/level/Level.h"
|
||||||
UploadPhotoScreen::UploadPhotoScreen()
|
#include "../../../platform/input/Keyboard.h"
|
||||||
:
|
#include "../../renderer/GameRenderer.h"
|
||||||
selectedItem(0)
|
#include "../../renderer/LevelRenderer.h"
|
||||||
{
|
|
||||||
}
|
UploadPhotoScreen::UploadPhotoScreen()
|
||||||
|
: hasAppliedPhotoMode(false),
|
||||||
void UploadPhotoScreen::init()
|
oldHideGui(false),
|
||||||
{
|
oldThirdPerson(false),
|
||||||
int currentSelection = minecraft->player->inventory->getSelectedItemId();
|
oldFixedCamera(false),
|
||||||
for (int i = 0; i < Inventory::INVENTORY_SIZE; i++)
|
hasOldPose(false),
|
||||||
{
|
oldX(0),
|
||||||
if (currentSelection == minecraft->player->inventory->getSelectionSlotItemId(i + Inventory::SELECTION_SIZE))
|
oldY(0),
|
||||||
{
|
oldZ(0),
|
||||||
selectedItem = i;
|
oldYaw(0),
|
||||||
break;
|
oldPitch(0),
|
||||||
}
|
photoCameraTarget(NULL),
|
||||||
}
|
photoCameraX(0),
|
||||||
|
photoCameraY(0),
|
||||||
}
|
photoCameraZ(0),
|
||||||
|
bBack(0)
|
||||||
void UploadPhotoScreen::renderSlots()
|
{
|
||||||
{
|
}
|
||||||
glColor4f2(1, 1, 1, 1);
|
|
||||||
|
UploadPhotoScreen::~UploadPhotoScreen()
|
||||||
blitOffset = -90;
|
{
|
||||||
|
restorePhotoMode();
|
||||||
minecraft->textures->loadAndBindTexture("gui/gui.png");
|
delete photoCameraTarget;
|
||||||
for (int r = 0; r < Inventory::INVENTORY_ROWS; r++)
|
delete bBack;
|
||||||
{
|
}
|
||||||
blit(width / 2 - 182 / 2, height - 22 * 3 - 22 * r, 0, 0, 182, 22);
|
|
||||||
}
|
void UploadPhotoScreen::init()
|
||||||
if (selectedItem >= 0)
|
{
|
||||||
{
|
applyPhotoMode();
|
||||||
int x = width / 2 - 182 / 2 - 1 + (selectedItem % Inventory::SELECTION_SIZE) * 20;
|
|
||||||
int y = height - 22 * 3 - 1 - (selectedItem / Inventory::SELECTION_SIZE) * 22;
|
if (minecraft->useTouchscreen()) {
|
||||||
blit(x, y, 0, 22, 24, 22);
|
bBack = new Touch::TButton(1, "Back");
|
||||||
}
|
} else {
|
||||||
|
bBack = new Button(1, "Back");
|
||||||
for (int r = 0; r < Inventory::INVENTORY_ROWS; r++)
|
}
|
||||||
{
|
|
||||||
for (int i = 0; i < 9; i++) {
|
buttons.push_back(bBack);
|
||||||
int x = width / 2 - 9 * 10 + i * 20 + 2;
|
tabButtons.push_back(bBack);
|
||||||
int y = height - 16 - 3 - 22 * 2 - 22 * r;
|
}
|
||||||
renderSlot(r * 9 + i + Inventory::SELECTION_SIZE, x, y, 0);
|
|
||||||
}
|
void UploadPhotoScreen::removed()
|
||||||
}
|
{
|
||||||
|
restorePhotoMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
void UploadPhotoScreen::renderSlot(int slot, int x, int y, float a)
|
void UploadPhotoScreen::applyPhotoMode()
|
||||||
{
|
{
|
||||||
int itemId = minecraft->player->inventory->getSelectionSlotItemId(slot);
|
if (hasAppliedPhotoMode || !minecraft || !minecraft->gameRenderer) return;
|
||||||
if (itemId < 0) return;
|
|
||||||
|
if (minecraft->player) {
|
||||||
const bool fancy = false;
|
oldX = minecraft->player->x;
|
||||||
|
oldY = minecraft->player->y;
|
||||||
if (fancy && itemId < 256 && TileRenderer::canRender(Tile::tiles[itemId]->getRenderShape())) {
|
oldZ = minecraft->player->z;
|
||||||
|
oldYaw = minecraft->player->yRot;
|
||||||
} else {
|
oldPitch = minecraft->player->xRot;
|
||||||
if (itemId < 256) {
|
hasOldPose = true;
|
||||||
Tile* tile = Tile::tiles[itemId];
|
}
|
||||||
if (tile == NULL) return;
|
|
||||||
|
oldHideGui = minecraft->options.getBooleanValue(OPTIONS_HIDEGUI);
|
||||||
minecraft->textures->loadAndBindTexture("terrain.png");
|
oldThirdPerson = minecraft->options.getBooleanValue(OPTIONS_THIRD_PERSON_VIEW);
|
||||||
|
oldFixedCamera = minecraft->options.getBooleanValue(OPTIONS_FIXED_CAMERA);
|
||||||
int textureId = tile->getTexture(2, 0);
|
Pos spawn = minecraft->level->getSharedSpawnPos();
|
||||||
blit(x, y, textureId % 16 * 16, textureId / 16 * 16, 16, 16);
|
photoCameraX = (float) spawn.x;
|
||||||
}
|
photoCameraY = 128.0f;
|
||||||
}
|
photoCameraZ = (float) spawn.z;
|
||||||
|
if (!photoCameraTarget) {
|
||||||
}
|
photoCameraTarget = new TripodCamera(minecraft->level, minecraft->player, photoCameraX, photoCameraY, photoCameraZ);
|
||||||
|
}
|
||||||
void UploadPhotoScreen::keyPressed(int eventKey)
|
photoCameraTarget->setPos(photoCameraX, photoCameraY, photoCameraZ);
|
||||||
{
|
photoCameraTarget->xo = photoCameraTarget->xOld = photoCameraX;
|
||||||
int selX = selectedItem % Inventory::SELECTION_SIZE;
|
photoCameraTarget->yo = photoCameraTarget->yOld = photoCameraY;
|
||||||
int selY = selectedItem / Inventory::SELECTION_SIZE;
|
photoCameraTarget->zo = photoCameraTarget->zOld = photoCameraZ;
|
||||||
|
|
||||||
Options& o = minecraft->options;
|
if (!oldHideGui) minecraft->options.toggle(OPTIONS_HIDEGUI);
|
||||||
if (eventKey == o.keyLeft.key && selX > 0)
|
if (!oldThirdPerson) minecraft->options.toggle(OPTIONS_THIRD_PERSON_VIEW);
|
||||||
{
|
if (!oldFixedCamera) minecraft->options.toggle(OPTIONS_FIXED_CAMERA);
|
||||||
selectedItem -= 1;
|
|
||||||
}
|
minecraft->gameRenderer->setPhotoModeIsometric();
|
||||||
else if (eventKey == o.keyRight.key && selX < (Inventory::SELECTION_SIZE - 1))
|
minecraft->levelRenderer->allChanged();
|
||||||
{
|
hasAppliedPhotoMode = true;
|
||||||
selectedItem += 1;
|
}
|
||||||
}
|
|
||||||
else if (eventKey == o.keyDown.key && selY > 0)
|
void UploadPhotoScreen::tick()
|
||||||
{
|
{
|
||||||
selectedItem -= Inventory::SELECTION_SIZE;
|
if (!hasAppliedPhotoMode || !minecraft || !minecraft->player || !minecraft->level) return;
|
||||||
}
|
|
||||||
else if (eventKey == o.keyUp.key && selY < (Inventory::INVENTORY_ROWS - 1))
|
if (photoCameraTarget) {
|
||||||
{
|
photoCameraTarget->setPos(photoCameraX, photoCameraY, photoCameraZ);
|
||||||
selectedItem += Inventory::SELECTION_SIZE;
|
photoCameraTarget->xo = photoCameraTarget->xOld = photoCameraX;
|
||||||
}
|
photoCameraTarget->yo = photoCameraTarget->yOld = photoCameraY;
|
||||||
|
photoCameraTarget->zo = photoCameraTarget->zOld = photoCameraZ;
|
||||||
if (eventKey == o.keyMenuOk.key)
|
photoCameraTarget->yRot = photoCameraTarget->yRotO = 45.0f;
|
||||||
{
|
photoCameraTarget->xRot = photoCameraTarget->xRotO = 68.0f;
|
||||||
selectSlotAndClose();
|
minecraft->cameraTargetPlayer = photoCameraTarget;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int UploadPhotoScreen::getSelectedSlot(int x, int y)
|
void UploadPhotoScreen::restorePhotoMode()
|
||||||
{
|
{
|
||||||
int left = 3 + width / 2 - Inventory::SELECTION_SIZE * 10;
|
if (!hasAppliedPhotoMode || !minecraft) return;
|
||||||
int top = height - 16 - 3 - 22 * 2 - 22 * Inventory::INVENTORY_ROWS;
|
|
||||||
|
if (minecraft->options.getBooleanValue(OPTIONS_HIDEGUI) != oldHideGui) minecraft->options.toggle(OPTIONS_HIDEGUI);
|
||||||
if (x >= left && y >= top)
|
if (minecraft->options.getBooleanValue(OPTIONS_THIRD_PERSON_VIEW) != oldThirdPerson) minecraft->options.toggle(OPTIONS_THIRD_PERSON_VIEW);
|
||||||
{
|
if (minecraft->options.getBooleanValue(OPTIONS_FIXED_CAMERA) != oldFixedCamera) minecraft->options.toggle(OPTIONS_FIXED_CAMERA);
|
||||||
int xSlot = (x - left) / 20;
|
minecraft->gameRenderer->clearPhotoModeIsometric();
|
||||||
if (xSlot < Inventory::SELECTION_SIZE)
|
minecraft->cameraTargetPlayer = minecraft->player;
|
||||||
{
|
|
||||||
// rows are rendered upsidedown
|
if (hasOldPose && minecraft->player) {
|
||||||
return xSlot + Inventory::INVENTORY_SIZE - ((y - top) / 22) * Inventory::SELECTION_SIZE;
|
minecraft->player->yRot = oldYaw;
|
||||||
}
|
minecraft->player->xRot = oldPitch;
|
||||||
}
|
}
|
||||||
return -1;
|
|
||||||
}
|
hasAppliedPhotoMode = false;
|
||||||
|
}
|
||||||
void UploadPhotoScreen::mouseClicked(int x, int y, int buttonNum) {
|
|
||||||
if (buttonNum == MouseAction::ACTION_LEFT) {
|
void UploadPhotoScreen::keyPressed(int eventKey)
|
||||||
|
{
|
||||||
int slot = getSelectedSlot(x, y);
|
if (eventKey == Keyboard::KEY_ESCAPE) {
|
||||||
if (slot >= 0 && slot < Inventory::INVENTORY_SIZE)
|
restorePhotoMode();
|
||||||
{
|
minecraft->setScreen(NULL);
|
||||||
selectedItem = slot;
|
return;
|
||||||
//minecraft->soundEngine->playUI("random.click", 1, 1);
|
}
|
||||||
}
|
|
||||||
}
|
Screen::keyPressed(eventKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UploadPhotoScreen::mouseReleased(int x, int y, int buttonNum)
|
void UploadPhotoScreen::buttonClicked(Button* button)
|
||||||
{
|
{
|
||||||
if (buttonNum == MouseAction::ACTION_LEFT) {
|
if (!button || button->id != 1) return;
|
||||||
|
|
||||||
int slot = getSelectedSlot(x, y);
|
restorePhotoMode();
|
||||||
if (slot >= 0 && slot < Inventory::INVENTORY_SIZE && slot == selectedItem)
|
minecraft->setScreen(NULL);
|
||||||
{
|
}
|
||||||
selectSlotAndClose();
|
|
||||||
}
|
void UploadPhotoScreen::setupPositions()
|
||||||
}
|
{
|
||||||
}
|
const int buttonWidth = 120;
|
||||||
|
const int buttonHeight = 24;
|
||||||
void UploadPhotoScreen::selectSlotAndClose()
|
bBack->width = buttonWidth;
|
||||||
{
|
bBack->height = buttonHeight;
|
||||||
Inventory* inventory = minecraft->player->inventory;
|
bBack->x = (width - buttonWidth) / 2;
|
||||||
|
bBack->y = height - 32;
|
||||||
int itemId = inventory->getSelectionSlotItemId(selectedItem + Inventory::SELECTION_SIZE);
|
}
|
||||||
int i = 0;
|
|
||||||
|
void UploadPhotoScreen::render(int xm, int ym, float a)
|
||||||
for (; i < Inventory::SELECTION_SIZE - 2; i++)
|
{
|
||||||
{
|
drawCenteredString(font, "Photo Mode - Isometric", width / 2, 12, 0xffffff);
|
||||||
if (itemId == inventory->getSelectionSlotItemId(i))
|
Screen::render(xm, ym, a);
|
||||||
{
|
}
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// update selection list
|
|
||||||
for (; i >= 1; i--)
|
|
||||||
{
|
|
||||||
inventory->setSelectionSlotItemId(i, inventory->getSelectionSlotItemId(i - 1));
|
|
||||||
}
|
|
||||||
inventory->setSelectionSlotItemId(0, itemId);
|
|
||||||
inventory->selectSlot(0);
|
|
||||||
|
|
||||||
minecraft->soundEngine->playUI("random.click", 1, 1);
|
|
||||||
minecraft->setScreen(NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -1,36 +1,50 @@
|
|||||||
#ifndef NET_MINECRAFT_CLIENT_GUI_SCREENS__UploadPhotoScreen_H__
|
#ifndef NET_MINECRAFT_CLIENT_GUI_SCREENS__UploadPhotoScreen_H__
|
||||||
#define NET_MINECRAFT_CLIENT_GUI_SCREENS__UploadPhotoScreen_H__
|
#define NET_MINECRAFT_CLIENT_GUI_SCREENS__UploadPhotoScreen_H__
|
||||||
|
|
||||||
#include "Screen.h"
|
#include "../Screen.h"
|
||||||
|
|
||||||
class UploadPhotoScreen : public Screen
|
class Button;
|
||||||
{
|
class Mob;
|
||||||
public:
|
|
||||||
|
class UploadPhotoScreen : public Screen
|
||||||
UploadPhotoScreen();
|
{
|
||||||
virtual ~UploadPhotoScreen() {}
|
public:
|
||||||
|
|
||||||
virtual void init();
|
UploadPhotoScreen();
|
||||||
|
virtual ~UploadPhotoScreen();
|
||||||
void render(int xm, int ym, float a) {
|
|
||||||
Screen::render(xm, ym, a);
|
virtual void init();
|
||||||
}
|
virtual void setupPositions();
|
||||||
|
virtual void tick();
|
||||||
protected:
|
virtual void removed();
|
||||||
|
virtual void keyPressed(int eventKey);
|
||||||
virtual void mouseClicked(int x, int y, int buttonNum);
|
|
||||||
virtual void mouseReleased(int x, int y, int buttonNum);
|
virtual void render(int xm, int ym, float a);
|
||||||
virtual void keyPressed(int eventKey);
|
|
||||||
|
protected:
|
||||||
private:
|
|
||||||
|
virtual void buttonClicked(Button* button);
|
||||||
int selectedItem;
|
|
||||||
|
private:
|
||||||
void renderSlots();
|
|
||||||
void renderSlot(int slot, int x, int y, float a);
|
void applyPhotoMode();
|
||||||
|
void restorePhotoMode();
|
||||||
int getSelectedSlot(int x, int y);
|
|
||||||
void selectSlotAndClose();
|
bool hasAppliedPhotoMode;
|
||||||
};
|
bool oldHideGui;
|
||||||
|
bool oldThirdPerson;
|
||||||
#endif /*NET_MINECRAFT_CLIENT_GUI_SCREENS__UploadPhotoScreen_H__*/
|
bool oldFixedCamera;
|
||||||
|
bool hasOldPose;
|
||||||
|
float oldX;
|
||||||
|
float oldY;
|
||||||
|
float oldZ;
|
||||||
|
float oldYaw;
|
||||||
|
float oldPitch;
|
||||||
|
Mob* photoCameraTarget;
|
||||||
|
float photoCameraX;
|
||||||
|
float photoCameraY;
|
||||||
|
float photoCameraZ;
|
||||||
|
Button* bBack;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /*NET_MINECRAFT_CLIENT_GUI_SCREENS__UploadPhotoScreen_H__*/
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ static int _shTicks = -1;
|
|||||||
GameRenderer::GameRenderer( Minecraft* mc )
|
GameRenderer::GameRenderer( Minecraft* mc )
|
||||||
: mc(mc),
|
: mc(mc),
|
||||||
renderDistance(0),
|
renderDistance(0),
|
||||||
|
photoModeIsometric(false),
|
||||||
_tick(0),
|
_tick(0),
|
||||||
_lastTickT(0),
|
_lastTickT(0),
|
||||||
fovOffset(0),
|
fovOffset(0),
|
||||||
@@ -90,7 +91,7 @@ void renderCursor(float x, float y, Minecraft* minecraft) {
|
|||||||
|
|
||||||
/*private*/
|
/*private*/
|
||||||
void GameRenderer::setupCamera(float a, int eye) {
|
void GameRenderer::setupCamera(float a, int eye) {
|
||||||
renderDistance = (float) (16 * 16 >> (mc->options.getIntValue(OPTIONS_VIEW_DISTANCE)));
|
renderDistance = photoModeIsometric ? 1024.0f : (float) (16 * 16 >> (mc->options.getIntValue(OPTIONS_VIEW_DISTANCE)));
|
||||||
#if defined(ANDROID)
|
#if defined(ANDROID)
|
||||||
if (mc->isPowerVR() && mc->options.getIntValue(OPTIONS_VIEW_DISTANCE) <= 2)
|
if (mc->isPowerVR() && mc->options.getIntValue(OPTIONS_VIEW_DISTANCE) <= 2)
|
||||||
renderDistance *= 0.8f;
|
renderDistance *= 0.8f;
|
||||||
@@ -314,7 +315,7 @@ void GameRenderer::renderLevel(float a) {
|
|||||||
setupFog(1);
|
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
|
// 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_BETA_SKY)){
|
||||||
if(mc->options.getBooleanValue(OPTIONS_FANCY_GRAPHICS)) {
|
if(mc->options.getBooleanValue(OPTIONS_FANCY_GRAPHICS) && !photoModeIsometric) {
|
||||||
prepareAndRenderClouds(levelRenderer, a);
|
prepareAndRenderClouds(levelRenderer, a);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -573,6 +574,14 @@ void GameRenderer::bobView(float a) {
|
|||||||
|
|
||||||
/*private*/
|
/*private*/
|
||||||
void GameRenderer::setupFog(int i) {
|
void GameRenderer::setupFog(int i) {
|
||||||
|
if (photoModeIsometric) {
|
||||||
|
glDisable2(GL_FOG);
|
||||||
|
glFogf(GL_FOG_START, 0.0f);
|
||||||
|
glFogf(GL_FOG_END, 1024.0f);
|
||||||
|
glEnable2(GL_COLOR_MATERIAL);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Mob* player = mc->cameraTargetPlayer;
|
Mob* player = mc->cameraTargetPlayer;
|
||||||
float fogBuffer[4] = {fr, fg, fb, 1};
|
float fogBuffer[4] = {fr, fg, fb, 1};
|
||||||
|
|
||||||
@@ -829,6 +838,14 @@ void GameRenderer::tick(int nTick, int maxTick) {
|
|||||||
|
|
||||||
/*private*/
|
/*private*/
|
||||||
void GameRenderer::setupClearColor(float a) {
|
void GameRenderer::setupClearColor(float a) {
|
||||||
|
if (photoModeIsometric) {
|
||||||
|
fr = 0.47f;
|
||||||
|
fg = 0.78f;
|
||||||
|
fb = 1.0f;
|
||||||
|
glClearColor(fr, fg, fb, 1.0f);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Level* level = mc->level;
|
Level* level = mc->level;
|
||||||
Mob* player = mc->cameraTargetPlayer;
|
Mob* player = mc->cameraTargetPlayer;
|
||||||
|
|
||||||
@@ -942,6 +959,28 @@ void GameRenderer::onGraphicsReset()
|
|||||||
if (itemInHandRenderer) itemInHandRenderer->onGraphicsReset();
|
if (itemInHandRenderer) itemInHandRenderer->onGraphicsReset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GameRenderer::setPhotoModeIsometric()
|
||||||
|
{
|
||||||
|
photoModeIsometric = true;
|
||||||
|
thirdDistance = thirdDistanceO = 128.0f;
|
||||||
|
thirdRotation = thirdRotationO = 45.0f;
|
||||||
|
thirdTilt = thirdTiltO = 56.0f;
|
||||||
|
zoom = 1.0f;
|
||||||
|
zoom_x = 0.0f;
|
||||||
|
zoom_y = 0.0f;
|
||||||
|
cameraRoll = cameraRollO = 0.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GameRenderer::clearPhotoModeIsometric()
|
||||||
|
{
|
||||||
|
photoModeIsometric = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GameRenderer::isPhotoModeIsometric() const
|
||||||
|
{
|
||||||
|
return photoModeIsometric;
|
||||||
|
}
|
||||||
|
|
||||||
void GameRenderer::saveMatrices()
|
void GameRenderer::saveMatrices()
|
||||||
{
|
{
|
||||||
#if defined(RPI)
|
#if defined(RPI)
|
||||||
|
|||||||
@@ -33,6 +33,9 @@ public:
|
|||||||
void renderItemInHand(float a, int eye);
|
void renderItemInHand(float a, int eye);
|
||||||
|
|
||||||
void onGraphicsReset();
|
void onGraphicsReset();
|
||||||
|
void setPhotoModeIsometric();
|
||||||
|
void clearPhotoModeIsometric();
|
||||||
|
bool isPhotoModeIsometric() const;
|
||||||
|
|
||||||
void setupCamera(float a, int eye);
|
void setupCamera(float a, int eye);
|
||||||
void moveCameraToPlayer(float a);
|
void moveCameraToPlayer(float a);
|
||||||
@@ -58,6 +61,7 @@ private:
|
|||||||
Minecraft* mc;
|
Minecraft* mc;
|
||||||
|
|
||||||
float renderDistance;
|
float renderDistance;
|
||||||
|
bool photoModeIsometric;
|
||||||
int _tick;
|
int _tick;
|
||||||
Vec3 pickDirection;
|
Vec3 pickDirection;
|
||||||
|
|
||||||
|
|||||||
@@ -193,7 +193,9 @@ void LevelRenderer::allChanged()
|
|||||||
TileRenderer::setUseTint(sideTint);
|
TileRenderer::setUseTint(sideTint);
|
||||||
|
|
||||||
|
|
||||||
int dist = (512 >> 3) << (3 - lastViewDistance);
|
int dist = mc->gameRenderer && mc->gameRenderer->isPhotoModeIsometric()
|
||||||
|
? 1024
|
||||||
|
: (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());
|
||||||
@@ -202,7 +204,9 @@ void LevelRenderer::allChanged()
|
|||||||
dist *= 0.6f;
|
dist *= 0.6f;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (dist > 400) dist = 400;
|
if (!(mc->gameRenderer && mc->gameRenderer->isPhotoModeIsometric())) {
|
||||||
|
if (dist > 400) dist = 400;
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
* if (Minecraft.FLYBY_MODE) { dist = 512 - CHUNK_SIZE * 2; }
|
* if (Minecraft.FLYBY_MODE) { dist = 512 - CHUNK_SIZE * 2; }
|
||||||
*/
|
*/
|
||||||
@@ -674,9 +678,11 @@ void LevelRenderer::tick()
|
|||||||
|
|
||||||
bool LevelRenderer::updateDirtyChunks( Mob* player, bool force )
|
bool LevelRenderer::updateDirtyChunks( Mob* player, bool force )
|
||||||
{
|
{
|
||||||
bool slow = false;
|
bool slow = mc->gameRenderer && mc->gameRenderer->isPhotoModeIsometric();
|
||||||
|
|
||||||
if (slow) {
|
if (slow) {
|
||||||
|
const int visibleLimit = 12;
|
||||||
|
const int invisibleLimit = 4;
|
||||||
DirtyChunkSorter dirtySorter(player);
|
DirtyChunkSorter dirtySorter(player);
|
||||||
std::sort(dirtyChunks.begin(), dirtyChunks.end(), dirtySorter);
|
std::sort(dirtyChunks.begin(), dirtyChunks.end(), dirtySorter);
|
||||||
int s = dirtyChunks.size() - 1;
|
int s = dirtyChunks.size() - 1;
|
||||||
@@ -686,9 +692,9 @@ bool LevelRenderer::updateDirtyChunks( Mob* player, bool force )
|
|||||||
if (!force) {
|
if (!force) {
|
||||||
if (chunk->distanceToSqr(player) > 16 * 16) {
|
if (chunk->distanceToSqr(player) > 16 * 16) {
|
||||||
if (chunk->visible) {
|
if (chunk->visible) {
|
||||||
if (i >= MAX_VISIBLE_REBUILDS_PER_FRAME) return false;
|
if (i >= visibleLimit) return false;
|
||||||
} else {
|
} else {
|
||||||
if (i >= MAX_INVISIBLE_REBUILDS_PER_FRAME) return false;
|
if (i >= invisibleLimit) return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -702,10 +708,9 @@ bool LevelRenderer::updateDirtyChunks( Mob* player, bool force )
|
|||||||
|
|
||||||
return dirtyChunks.size() == 0;
|
return dirtyChunks.size() == 0;
|
||||||
} else {
|
} else {
|
||||||
const int count = 3;
|
const int count = (mc->gameRenderer && mc->gameRenderer->isPhotoModeIsometric()) ? 32 : 3;
|
||||||
|
Chunk* toAdd[24] = {NULL};
|
||||||
DirtyChunkSorter dirtyChunkSorter(player);
|
DirtyChunkSorter dirtyChunkSorter(player);
|
||||||
Chunk* toAdd[count] = {NULL};
|
|
||||||
std::vector<Chunk*>* nearChunks = NULL;
|
std::vector<Chunk*>* nearChunks = NULL;
|
||||||
|
|
||||||
int pendingChunkSize = dirtyChunks.size();
|
int pendingChunkSize = dirtyChunks.size();
|
||||||
@@ -715,7 +720,7 @@ bool LevelRenderer::updateDirtyChunks( Mob* player, bool force )
|
|||||||
Chunk* chunk = dirtyChunks[i];
|
Chunk* chunk = dirtyChunks[i];
|
||||||
|
|
||||||
if (!force) {
|
if (!force) {
|
||||||
if (chunk->distanceToSqr(player) > 1024.0f) {
|
if (chunk->distanceToSqr(player) > ((mc->gameRenderer && mc->gameRenderer->isPhotoModeIsometric()) ? 65536.0f : 1024.0f)) {
|
||||||
int index;
|
int index;
|
||||||
|
|
||||||
// is this chunk in the closest <count>?
|
// is this chunk in the closest <count>?
|
||||||
@@ -754,7 +759,7 @@ bool LevelRenderer::updateDirtyChunks( Mob* player, bool force )
|
|||||||
|
|
||||||
// if there are nearby chunks that need to be prepared for
|
// if there are nearby chunks that need to be prepared for
|
||||||
// rendering, sort them and then process them
|
// rendering, sort them and then process them
|
||||||
static const float MaxFrameTime = 1.0f / 100.0f;
|
static const float MaxFrameTime = (mc->gameRenderer && mc->gameRenderer->isPhotoModeIsometric()) ? (1.0f / 75.0f) : (1.0f / 100.0f);
|
||||||
Stopwatch chunkWatch;
|
Stopwatch chunkWatch;
|
||||||
chunkWatch.start();
|
chunkWatch.start();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user