forked from Kolyah35/minecraft-pe-0.6.1
Compare commits
6 Commits
feature/is
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d08948fb00 | ||
|
|
061d6db3a9 | ||
|
|
346ec7469e | ||
|
|
d7d887f882 | ||
| ce182b676f | |||
|
|
88ef7f3d17 |
BIN
project/android_java/res/raw/burp1.ogg
Normal file
BIN
project/android_java/res/raw/burp1.ogg
Normal file
Binary file not shown.
@@ -129,6 +129,7 @@ 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"),
|
||||||
|
|||||||
@@ -857,6 +857,7 @@ void Minecraft::tickInput() {
|
|||||||
for (int i = 0; i < 5 * SharedConstants::TicksPerSecond; ++i)
|
for (int i = 0; i < 5 * SharedConstants::TicksPerSecond; ++i)
|
||||||
level->tick();
|
level->tick();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -882,6 +883,9 @@ 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
|
||||||
|
|||||||
@@ -224,58 +224,58 @@ 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
|
||||||
if (key == 38) { // VK_UP
|
if (key == 38) { // VK_UP
|
||||||
scrollChat(1);
|
scrollChat(1);
|
||||||
return;
|
return;
|
||||||
} else if (key == 40) { // VK_DOWN
|
} else if (key == 40) { // VK_DOWN
|
||||||
scrollChat(-1);
|
scrollChat(-1);
|
||||||
return;
|
return;
|
||||||
} else if (key == 33) { // VK_PRIOR (Page Up)
|
} else if (key == 33) { // VK_PRIOR (Page Up)
|
||||||
// Scroll by a page
|
// Scroll by a page
|
||||||
int screenHeight = (int)(minecraft->height * InvGuiScale);
|
int screenHeight = (int)(minecraft->height * InvGuiScale);
|
||||||
int maxVisible = (screenHeight - 48) / 9;
|
int maxVisible = (screenHeight - 48) / 9;
|
||||||
scrollChat(maxVisible);
|
scrollChat(maxVisible);
|
||||||
return;
|
return;
|
||||||
} else if (key == 34) { // VK_NEXT (Page Down)
|
} else if (key == 34) { // VK_NEXT (Page Down)
|
||||||
int screenHeight = (int)(minecraft->height * InvGuiScale);
|
int screenHeight = (int)(minecraft->height * InvGuiScale);
|
||||||
int maxVisible = (screenHeight - 48) / 9;
|
int maxVisible = (screenHeight - 48) / 9;
|
||||||
scrollChat(-maxVisible);
|
scrollChat(-maxVisible);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (key == Keyboard::KEY_F1) {
|
if (key == Keyboard::KEY_F1) {
|
||||||
minecraft->options.toggle(OPTIONS_HIDEGUI);
|
minecraft->options.toggle(OPTIONS_HIDEGUI);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (key == 99)
|
if (key == 99)
|
||||||
{
|
|
||||||
if (minecraft->player->inventory->selected > 0)
|
|
||||||
{
|
{
|
||||||
minecraft->player->inventory->selected--;
|
if (minecraft->player->inventory->selected > 0)
|
||||||
|
{
|
||||||
|
minecraft->player->inventory->selected--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (key == 4)
|
||||||
|
{
|
||||||
|
if (minecraft->player->inventory->selected < (getNumSlots() - 2))
|
||||||
|
{
|
||||||
|
minecraft->player->inventory->selected++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (key == 100)
|
||||||
|
{
|
||||||
|
minecraft->screenChooser.setScreen(SCREEN_BLOCKSELECTION);
|
||||||
|
}
|
||||||
|
else if (key == minecraft->options.getIntValue(OPTIONS_KEY_DROP))
|
||||||
|
{
|
||||||
|
minecraft->player->inventory->dropSlot(minecraft->player->inventory->selected, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (key == 4)
|
|
||||||
{
|
|
||||||
if (minecraft->player->inventory->selected < (getNumSlots() - 2))
|
|
||||||
{
|
|
||||||
minecraft->player->inventory->selected++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (key == 100)
|
|
||||||
{
|
|
||||||
minecraft->screenChooser.setScreen(SCREEN_BLOCKSELECTION);
|
|
||||||
}
|
|
||||||
else if (key == minecraft->options.getIntValue(OPTIONS_KEY_DROP))
|
|
||||||
{
|
|
||||||
minecraft->player->inventory->dropSlot(minecraft->player->inventory->selected, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Gui::scrollChat(int delta) {
|
void Gui::scrollChat(int delta) {
|
||||||
if (delta == 0)
|
if (delta == 0)
|
||||||
@@ -782,6 +782,25 @@ 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;
|
Font* font = minecraft->font;
|
||||||
|
|
||||||
@@ -820,6 +839,9 @@ void Gui::renderDebugInfo() {
|
|||||||
|
|
||||||
sprintf(buf, "Biome: %s", biomeName);
|
sprintf(buf, "Biome: %s", biomeName);
|
||||||
drawString(font, buf, 2, 124, 0xE0E0E0);
|
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){
|
else if (minecraft->options.getIntValue(OPTIONS_DEBUG_STYLE) == 1){
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,6 @@
|
|||||||
#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),
|
||||||
@@ -18,7 +17,6 @@ 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),
|
||||||
@@ -45,7 +43,6 @@ PauseScreen::~PauseScreen() {
|
|||||||
delete bQuit;
|
delete bQuit;
|
||||||
delete bQuitAndSaveLocally;
|
delete bQuitAndSaveLocally;
|
||||||
delete bServerVisibility;
|
delete bServerVisibility;
|
||||||
delete bPhotoMode;
|
|
||||||
delete bOptions;
|
delete bOptions;
|
||||||
// delete bThirdPerson;
|
// delete bThirdPerson;
|
||||||
}
|
}
|
||||||
@@ -54,7 +51,6 @@ 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, "");
|
||||||
@@ -62,7 +58,6 @@ 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, "");
|
||||||
@@ -71,7 +66,6 @@ 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");
|
||||||
@@ -80,7 +74,6 @@ 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);
|
||||||
@@ -122,7 +115,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 = bPhotoMode->width = bQuit->width = /*bThirdPerson->w =*/ 200;
|
bContinue->width = bOptions->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;
|
||||||
@@ -131,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 + 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;
|
||||||
|
|
||||||
@@ -141,7 +131,7 @@ void PauseScreen::setupPositions() {
|
|||||||
bQuit->y = yBase + 24 * 4 + 24;
|
bQuit->y = yBase + 24 * 4 + 24;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
bContinue->width = bOptions->width = bPhotoMode->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;
|
||||||
|
|
||||||
bContinue->x = (width - bContinue->width) / 2;
|
bContinue->x = (width - bContinue->width) / 2;
|
||||||
@@ -150,18 +140,15 @@ 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 * 4;
|
bQuit->y = yBase + 32 * 3;
|
||||||
|
|
||||||
#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 * 5;
|
bQuitAndSaveLocally->y = bServerVisibility->y = yBase + 32 * 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -205,9 +192,6 @@ 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,7 +33,6 @@ private:
|
|||||||
Button* bQuit;
|
Button* bQuit;
|
||||||
Button* bQuitAndSaveLocally;
|
Button* bQuitAndSaveLocally;
|
||||||
Button* bServerVisibility;
|
Button* bServerVisibility;
|
||||||
Button* bPhotoMode;
|
|
||||||
Button* bOptions;
|
Button* bOptions;
|
||||||
|
|
||||||
// Button* bThirdPerson;
|
// Button* bThirdPerson;
|
||||||
|
|||||||
@@ -1,160 +1,177 @@
|
|||||||
#include "UploadPhotoScreen.h"
|
#if 0
|
||||||
|
|
||||||
#include "../components/Button.h"
|
#include "UploadPhotoScreen.h"
|
||||||
#include "../../Minecraft.h"
|
#include "../renderer/TileRenderer.h"
|
||||||
#include "../../player/LocalPlayer.h"
|
#include "../player/LocalPlayer.h"
|
||||||
#include "../../../world/entity/item/TripodCamera.h"
|
#include "../../world/entity/player/Inventory.h"
|
||||||
#include "../../../world/level/Level.h"
|
|
||||||
#include "../../../platform/input/Keyboard.h"
|
UploadPhotoScreen::UploadPhotoScreen()
|
||||||
#include "../../renderer/GameRenderer.h"
|
:
|
||||||
#include "../../renderer/LevelRenderer.h"
|
selectedItem(0)
|
||||||
|
{
|
||||||
UploadPhotoScreen::UploadPhotoScreen()
|
}
|
||||||
: hasAppliedPhotoMode(false),
|
|
||||||
oldHideGui(false),
|
void UploadPhotoScreen::init()
|
||||||
oldThirdPerson(false),
|
{
|
||||||
oldFixedCamera(false),
|
int currentSelection = minecraft->player->inventory->getSelectedItemId();
|
||||||
hasOldPose(false),
|
for (int i = 0; i < Inventory::INVENTORY_SIZE; i++)
|
||||||
oldX(0),
|
{
|
||||||
oldY(0),
|
if (currentSelection == minecraft->player->inventory->getSelectionSlotItemId(i + Inventory::SELECTION_SIZE))
|
||||||
oldZ(0),
|
{
|
||||||
oldYaw(0),
|
selectedItem = i;
|
||||||
oldPitch(0),
|
break;
|
||||||
photoCameraTarget(NULL),
|
}
|
||||||
photoCameraX(0),
|
}
|
||||||
photoCameraY(0),
|
|
||||||
photoCameraZ(0),
|
}
|
||||||
bBack(0)
|
|
||||||
{
|
void UploadPhotoScreen::renderSlots()
|
||||||
}
|
{
|
||||||
|
glColor4f2(1, 1, 1, 1);
|
||||||
UploadPhotoScreen::~UploadPhotoScreen()
|
|
||||||
{
|
blitOffset = -90;
|
||||||
restorePhotoMode();
|
|
||||||
delete photoCameraTarget;
|
minecraft->textures->loadAndBindTexture("gui/gui.png");
|
||||||
delete bBack;
|
for (int r = 0; r < Inventory::INVENTORY_ROWS; r++)
|
||||||
}
|
{
|
||||||
|
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;
|
||||||
if (minecraft->useTouchscreen()) {
|
int y = height - 22 * 3 - 1 - (selectedItem / Inventory::SELECTION_SIZE) * 22;
|
||||||
bBack = new Touch::TButton(1, "Back");
|
blit(x, y, 0, 22, 24, 22);
|
||||||
} else {
|
}
|
||||||
bBack = new Button(1, "Back");
|
|
||||||
}
|
for (int r = 0; r < Inventory::INVENTORY_ROWS; r++)
|
||||||
|
{
|
||||||
buttons.push_back(bBack);
|
for (int i = 0; i < 9; i++) {
|
||||||
tabButtons.push_back(bBack);
|
int x = width / 2 - 9 * 10 + i * 20 + 2;
|
||||||
}
|
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::applyPhotoMode()
|
void UploadPhotoScreen::renderSlot(int slot, int x, int y, float a)
|
||||||
{
|
{
|
||||||
if (hasAppliedPhotoMode || !minecraft || !minecraft->gameRenderer) return;
|
int itemId = minecraft->player->inventory->getSelectionSlotItemId(slot);
|
||||||
|
if (itemId < 0) return;
|
||||||
if (minecraft->player) {
|
|
||||||
oldX = minecraft->player->x;
|
const bool fancy = false;
|
||||||
oldY = minecraft->player->y;
|
|
||||||
oldZ = minecraft->player->z;
|
if (fancy && itemId < 256 && TileRenderer::canRender(Tile::tiles[itemId]->getRenderShape())) {
|
||||||
oldYaw = minecraft->player->yRot;
|
|
||||||
oldPitch = minecraft->player->xRot;
|
} else {
|
||||||
hasOldPose = true;
|
if (itemId < 256) {
|
||||||
}
|
Tile* tile = Tile::tiles[itemId];
|
||||||
|
if (tile == NULL) return;
|
||||||
oldHideGui = minecraft->options.getBooleanValue(OPTIONS_HIDEGUI);
|
|
||||||
oldThirdPerson = minecraft->options.getBooleanValue(OPTIONS_THIRD_PERSON_VIEW);
|
minecraft->textures->loadAndBindTexture("terrain.png");
|
||||||
oldFixedCamera = minecraft->options.getBooleanValue(OPTIONS_FIXED_CAMERA);
|
|
||||||
Pos spawn = minecraft->level->getSharedSpawnPos();
|
int textureId = tile->getTexture(2, 0);
|
||||||
photoCameraX = (float) spawn.x;
|
blit(x, y, textureId % 16 * 16, textureId / 16 * 16, 16, 16);
|
||||||
photoCameraY = 128.0f;
|
}
|
||||||
photoCameraZ = (float) spawn.z;
|
}
|
||||||
if (!photoCameraTarget) {
|
|
||||||
photoCameraTarget = new TripodCamera(minecraft->level, minecraft->player, photoCameraX, photoCameraY, photoCameraZ);
|
}
|
||||||
}
|
|
||||||
photoCameraTarget->setPos(photoCameraX, photoCameraY, photoCameraZ);
|
void UploadPhotoScreen::keyPressed(int eventKey)
|
||||||
photoCameraTarget->xo = photoCameraTarget->xOld = photoCameraX;
|
{
|
||||||
photoCameraTarget->yo = photoCameraTarget->yOld = photoCameraY;
|
int selX = selectedItem % Inventory::SELECTION_SIZE;
|
||||||
photoCameraTarget->zo = photoCameraTarget->zOld = photoCameraZ;
|
int selY = selectedItem / Inventory::SELECTION_SIZE;
|
||||||
|
|
||||||
if (!oldHideGui) minecraft->options.toggle(OPTIONS_HIDEGUI);
|
Options& o = minecraft->options;
|
||||||
if (!oldThirdPerson) minecraft->options.toggle(OPTIONS_THIRD_PERSON_VIEW);
|
if (eventKey == o.keyLeft.key && selX > 0)
|
||||||
if (!oldFixedCamera) minecraft->options.toggle(OPTIONS_FIXED_CAMERA);
|
{
|
||||||
|
selectedItem -= 1;
|
||||||
minecraft->gameRenderer->setPhotoModeIsometric();
|
}
|
||||||
minecraft->levelRenderer->allChanged();
|
else if (eventKey == o.keyRight.key && selX < (Inventory::SELECTION_SIZE - 1))
|
||||||
hasAppliedPhotoMode = true;
|
{
|
||||||
}
|
selectedItem += 1;
|
||||||
|
}
|
||||||
void UploadPhotoScreen::tick()
|
else if (eventKey == o.keyDown.key && selY > 0)
|
||||||
{
|
{
|
||||||
if (!hasAppliedPhotoMode || !minecraft || !minecraft->player || !minecraft->level) return;
|
selectedItem -= Inventory::SELECTION_SIZE;
|
||||||
|
}
|
||||||
if (photoCameraTarget) {
|
else if (eventKey == o.keyUp.key && selY < (Inventory::INVENTORY_ROWS - 1))
|
||||||
photoCameraTarget->setPos(photoCameraX, photoCameraY, photoCameraZ);
|
{
|
||||||
photoCameraTarget->xo = photoCameraTarget->xOld = photoCameraX;
|
selectedItem += Inventory::SELECTION_SIZE;
|
||||||
photoCameraTarget->yo = photoCameraTarget->yOld = photoCameraY;
|
}
|
||||||
photoCameraTarget->zo = photoCameraTarget->zOld = photoCameraZ;
|
|
||||||
photoCameraTarget->yRot = photoCameraTarget->yRotO = 45.0f;
|
if (eventKey == o.keyMenuOk.key)
|
||||||
photoCameraTarget->xRot = photoCameraTarget->xRotO = 68.0f;
|
{
|
||||||
minecraft->cameraTargetPlayer = photoCameraTarget;
|
selectSlotAndClose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UploadPhotoScreen::restorePhotoMode()
|
int UploadPhotoScreen::getSelectedSlot(int x, int y)
|
||||||
{
|
{
|
||||||
if (!hasAppliedPhotoMode || !minecraft) return;
|
int left = 3 + width / 2 - Inventory::SELECTION_SIZE * 10;
|
||||||
|
int top = height - 16 - 3 - 22 * 2 - 22 * Inventory::INVENTORY_ROWS;
|
||||||
if (minecraft->options.getBooleanValue(OPTIONS_HIDEGUI) != oldHideGui) minecraft->options.toggle(OPTIONS_HIDEGUI);
|
|
||||||
if (minecraft->options.getBooleanValue(OPTIONS_THIRD_PERSON_VIEW) != oldThirdPerson) minecraft->options.toggle(OPTIONS_THIRD_PERSON_VIEW);
|
if (x >= left && y >= top)
|
||||||
if (minecraft->options.getBooleanValue(OPTIONS_FIXED_CAMERA) != oldFixedCamera) minecraft->options.toggle(OPTIONS_FIXED_CAMERA);
|
{
|
||||||
minecraft->gameRenderer->clearPhotoModeIsometric();
|
int xSlot = (x - left) / 20;
|
||||||
minecraft->cameraTargetPlayer = minecraft->player;
|
if (xSlot < Inventory::SELECTION_SIZE)
|
||||||
|
{
|
||||||
if (hasOldPose && minecraft->player) {
|
// rows are rendered upsidedown
|
||||||
minecraft->player->yRot = oldYaw;
|
return xSlot + Inventory::INVENTORY_SIZE - ((y - top) / 22) * Inventory::SELECTION_SIZE;
|
||||||
minecraft->player->xRot = oldPitch;
|
}
|
||||||
}
|
}
|
||||||
|
return -1;
|
||||||
hasAppliedPhotoMode = false;
|
}
|
||||||
}
|
|
||||||
|
void UploadPhotoScreen::mouseClicked(int x, int y, int buttonNum) {
|
||||||
void UploadPhotoScreen::keyPressed(int eventKey)
|
if (buttonNum == MouseAction::ACTION_LEFT) {
|
||||||
{
|
|
||||||
if (eventKey == Keyboard::KEY_ESCAPE) {
|
int slot = getSelectedSlot(x, y);
|
||||||
restorePhotoMode();
|
if (slot >= 0 && slot < Inventory::INVENTORY_SIZE)
|
||||||
minecraft->setScreen(NULL);
|
{
|
||||||
return;
|
selectedItem = slot;
|
||||||
}
|
//minecraft->soundEngine->playUI("random.click", 1, 1);
|
||||||
|
}
|
||||||
Screen::keyPressed(eventKey);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UploadPhotoScreen::buttonClicked(Button* button)
|
void UploadPhotoScreen::mouseReleased(int x, int y, int buttonNum)
|
||||||
{
|
{
|
||||||
if (!button || button->id != 1) return;
|
if (buttonNum == MouseAction::ACTION_LEFT) {
|
||||||
|
|
||||||
restorePhotoMode();
|
int slot = getSelectedSlot(x, y);
|
||||||
minecraft->setScreen(NULL);
|
if (slot >= 0 && slot < Inventory::INVENTORY_SIZE && slot == selectedItem)
|
||||||
}
|
{
|
||||||
|
selectSlotAndClose();
|
||||||
void UploadPhotoScreen::setupPositions()
|
}
|
||||||
{
|
}
|
||||||
const int buttonWidth = 120;
|
}
|
||||||
const int buttonHeight = 24;
|
|
||||||
bBack->width = buttonWidth;
|
void UploadPhotoScreen::selectSlotAndClose()
|
||||||
bBack->height = buttonHeight;
|
{
|
||||||
bBack->x = (width - buttonWidth) / 2;
|
Inventory* inventory = minecraft->player->inventory;
|
||||||
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);
|
{
|
||||||
Screen::render(xm, ym, a);
|
if (itemId == inventory->getSelectionSlotItemId(i))
|
||||||
}
|
{
|
||||||
|
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,50 +1,36 @@
|
|||||||
#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 Button;
|
class UploadPhotoScreen : public Screen
|
||||||
class Mob;
|
{
|
||||||
|
public:
|
||||||
class UploadPhotoScreen : public Screen
|
|
||||||
{
|
UploadPhotoScreen();
|
||||||
public:
|
virtual ~UploadPhotoScreen() {}
|
||||||
|
|
||||||
UploadPhotoScreen();
|
virtual void init();
|
||||||
virtual ~UploadPhotoScreen();
|
|
||||||
|
void render(int xm, int ym, float a) {
|
||||||
virtual void init();
|
Screen::render(xm, ym, a);
|
||||||
virtual void setupPositions();
|
}
|
||||||
virtual void tick();
|
|
||||||
virtual void removed();
|
protected:
|
||||||
virtual void keyPressed(int eventKey);
|
|
||||||
|
virtual void mouseClicked(int x, int y, int buttonNum);
|
||||||
virtual void render(int xm, int ym, float a);
|
virtual void mouseReleased(int x, int y, int buttonNum);
|
||||||
|
virtual void keyPressed(int eventKey);
|
||||||
protected:
|
|
||||||
|
private:
|
||||||
virtual void buttonClicked(Button* button);
|
|
||||||
|
int selectedItem;
|
||||||
private:
|
|
||||||
|
void renderSlots();
|
||||||
void applyPhotoMode();
|
void renderSlot(int slot, int x, int y, float a);
|
||||||
void restorePhotoMode();
|
|
||||||
|
int getSelectedSlot(int x, int y);
|
||||||
bool hasAppliedPhotoMode;
|
void selectSlotAndClose();
|
||||||
bool oldHideGui;
|
};
|
||||||
bool oldThirdPerson;
|
|
||||||
bool oldFixedCamera;
|
#endif /*NET_MINECRAFT_CLIENT_GUI_SCREENS__UploadPhotoScreen_H__*/
|
||||||
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__*/
|
|
||||||
|
|||||||
@@ -40,10 +40,9 @@ 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);
|
||||||
@@ -99,17 +98,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);
|
||||||
@@ -123,12 +122,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;
|
||||||
@@ -273,7 +272,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) {
|
||||||
|
|||||||
@@ -355,7 +355,11 @@ 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();
|
||||||
@@ -550,6 +554,10 @@ 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,6 +22,10 @@ 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();
|
||||||
|
|||||||
@@ -34,7 +34,6 @@ 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),
|
||||||
@@ -91,7 +90,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 = photoModeIsometric ? 1024.0f : (float) (16 * 16 >> (mc->options.getIntValue(OPTIONS_VIEW_DISTANCE)));
|
renderDistance = (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;
|
||||||
@@ -315,7 +314,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) && !photoModeIsometric) {
|
if(mc->options.getBooleanValue(OPTIONS_FANCY_GRAPHICS)) {
|
||||||
prepareAndRenderClouds(levelRenderer, a);
|
prepareAndRenderClouds(levelRenderer, a);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -348,6 +347,7 @@ void GameRenderer::renderLevel(float a) {
|
|||||||
Lighting::turnOff();
|
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);
|
||||||
@@ -574,14 +574,6 @@ 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};
|
||||||
|
|
||||||
@@ -838,14 +830,6 @@ 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;
|
||||||
|
|
||||||
@@ -959,28 +943,6 @@ 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,9 +33,6 @@ 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);
|
||||||
@@ -61,7 +58,6 @@ private:
|
|||||||
Minecraft* mc;
|
Minecraft* mc;
|
||||||
|
|
||||||
float renderDistance;
|
float renderDistance;
|
||||||
bool photoModeIsometric;
|
|
||||||
int _tick;
|
int _tick;
|
||||||
Vec3 pickDirection;
|
Vec3 pickDirection;
|
||||||
|
|
||||||
|
|||||||
@@ -280,6 +280,9 @@ 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);
|
||||||
@@ -288,6 +291,16 @@ void ItemInHandRenderer::render( float a )
|
|||||||
Lighting::turnOn(mc);
|
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;
|
||||||
|
|||||||
@@ -193,9 +193,7 @@ void LevelRenderer::allChanged()
|
|||||||
TileRenderer::setUseTint(sideTint);
|
TileRenderer::setUseTint(sideTint);
|
||||||
|
|
||||||
|
|
||||||
int dist = mc->gameRenderer && mc->gameRenderer->isPhotoModeIsometric()
|
int dist = (512 >> 3) << (3 - lastViewDistance);
|
||||||
? 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());
|
||||||
@@ -204,9 +202,7 @@ void LevelRenderer::allChanged()
|
|||||||
dist *= 0.6f;
|
dist *= 0.6f;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!(mc->gameRenderer && mc->gameRenderer->isPhotoModeIsometric())) {
|
if (dist > 400) dist = 400;
|
||||||
if (dist > 400) dist = 400;
|
|
||||||
}
|
|
||||||
/*
|
/*
|
||||||
* if (Minecraft.FLYBY_MODE) { dist = 512 - CHUNK_SIZE * 2; }
|
* if (Minecraft.FLYBY_MODE) { dist = 512 - CHUNK_SIZE * 2; }
|
||||||
*/
|
*/
|
||||||
@@ -678,11 +674,9 @@ void LevelRenderer::tick()
|
|||||||
|
|
||||||
bool LevelRenderer::updateDirtyChunks( Mob* player, bool force )
|
bool LevelRenderer::updateDirtyChunks( Mob* player, bool force )
|
||||||
{
|
{
|
||||||
bool slow = mc->gameRenderer && mc->gameRenderer->isPhotoModeIsometric();
|
bool slow = false;
|
||||||
|
|
||||||
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;
|
||||||
@@ -692,9 +686,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 >= visibleLimit) return false;
|
if (i >= MAX_VISIBLE_REBUILDS_PER_FRAME) return false;
|
||||||
} else {
|
} else {
|
||||||
if (i >= invisibleLimit) return false;
|
if (i >= MAX_INVISIBLE_REBUILDS_PER_FRAME) return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -708,9 +702,10 @@ bool LevelRenderer::updateDirtyChunks( Mob* player, bool force )
|
|||||||
|
|
||||||
return dirtyChunks.size() == 0;
|
return dirtyChunks.size() == 0;
|
||||||
} else {
|
} else {
|
||||||
const int count = (mc->gameRenderer && mc->gameRenderer->isPhotoModeIsometric()) ? 32 : 3;
|
const int count = 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();
|
||||||
@@ -720,7 +715,7 @@ bool LevelRenderer::updateDirtyChunks( Mob* player, bool force )
|
|||||||
Chunk* chunk = dirtyChunks[i];
|
Chunk* chunk = dirtyChunks[i];
|
||||||
|
|
||||||
if (!force) {
|
if (!force) {
|
||||||
if (chunk->distanceToSqr(player) > ((mc->gameRenderer && mc->gameRenderer->isPhotoModeIsometric()) ? 65536.0f : 1024.0f)) {
|
if (chunk->distanceToSqr(player) > 1024.0f) {
|
||||||
int index;
|
int index;
|
||||||
|
|
||||||
// is this chunk in the closest <count>?
|
// is this chunk in the closest <count>?
|
||||||
@@ -759,7 +754,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 = (mc->gameRenderer && mc->gameRenderer->isPhotoModeIsometric()) ? (1.0f / 75.0f) : (1.0f / 100.0f);
|
static const float MaxFrameTime = 1.0f / 100.0f;
|
||||||
Stopwatch chunkWatch;
|
Stopwatch chunkWatch;
|
||||||
chunkWatch.start();
|
chunkWatch.start();
|
||||||
|
|
||||||
|
|||||||
@@ -133,6 +133,8 @@ void EntityRenderer::postRender(Entity* entity, float x, float y, float z, float
|
|||||||
}
|
}
|
||||||
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) {
|
void EntityRenderer::renderFlame(Entity* e, float x, float y, float z, float a) {
|
||||||
glDisable(GL_LIGHTING);
|
glDisable(GL_LIGHTING);
|
||||||
int tex = ((Tile*)Tile::fire)->tex;
|
int tex = ((Tile*)Tile::fire)->tex;
|
||||||
@@ -178,6 +180,75 @@ void EntityRenderer::renderFlame(Entity* e, float x, float y, float z, float a)
|
|||||||
glPopMatrix2();
|
glPopMatrix2();
|
||||||
glEnable2(GL_LIGHTING);
|
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;
|
||||||
|
int yt = tex & 0xf0;
|
||||||
|
|
||||||
|
float u0 = (xt) / 256.0f;
|
||||||
|
float u1 = (xt + 15.99f) / 256.0f;
|
||||||
|
float v0 = (yt) / 256.0f;
|
||||||
|
float v1 = (yt + 15.99f) / 256.0f;
|
||||||
|
|
||||||
|
glPushMatrix2();
|
||||||
|
glTranslatef2((float) x, (float) y, (float) z);
|
||||||
|
|
||||||
|
float s = e->bbWidth * 1.4f;
|
||||||
|
glScalef2(s, s, s);
|
||||||
|
bindTexture("terrain.png");
|
||||||
|
Tesselator& t = Tesselator::instance;
|
||||||
|
|
||||||
|
float r = 0.5f;
|
||||||
|
float xo = 0.0f;
|
||||||
|
|
||||||
|
float h = e->bbHeight / s;
|
||||||
|
float yo = (float)(e->y - e->bb.y0) / s;
|
||||||
|
|
||||||
|
glRotatef2(-entityRenderDispatcher->playerRotY, 0, 1, 0);
|
||||||
|
glTranslatef2(0, 0, -0.3f + ((int) h) * 0.02f);
|
||||||
|
glColor4f2(1, 1, 1, 1);
|
||||||
|
|
||||||
|
float zo = 0.0f;
|
||||||
|
int cycle_counter = 0;
|
||||||
|
|
||||||
|
t.begin();
|
||||||
|
while (h > 0.0f) {
|
||||||
|
float current_u0 = u0;
|
||||||
|
float current_u1 = u1;
|
||||||
|
float current_v0 = v0;
|
||||||
|
float current_v1 = v1;
|
||||||
|
|
||||||
|
if (cycle_counter % 2 != 0) {
|
||||||
|
current_v0 = (yt + 16) / 256.0f;
|
||||||
|
current_v1 = (yt + 16 + 15.99f) / 256.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((cycle_counter / 2) % 2 == 0) {
|
||||||
|
float tmp = current_u1;
|
||||||
|
current_u1 = current_u0;
|
||||||
|
current_u0 = tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
t.vertexUV(r - xo, 0.0f - yo, zo, current_u1, current_v1);
|
||||||
|
t.vertexUV(-r - xo, 0.0f - yo, zo, current_u0, current_v1);
|
||||||
|
t.vertexUV(-r - xo, 1.4f - yo, zo, current_u0, current_v0);
|
||||||
|
t.vertexUV(r - xo, 1.4f - yo, zo, current_u1, current_v0);
|
||||||
|
|
||||||
|
h -= 0.45f;
|
||||||
|
yo -= 0.45f;
|
||||||
|
r *= 0.9f;
|
||||||
|
zo += 0.03f;
|
||||||
|
cycle_counter++;
|
||||||
|
}
|
||||||
|
t.draw();
|
||||||
|
|
||||||
|
glPopMatrix2();
|
||||||
|
glEnable2(GL_LIGHTING);
|
||||||
|
}
|
||||||
|
|
||||||
void EntityRenderer::renderShadow(Entity* e, float x, float y, float z, float pow, float a) { //
|
void EntityRenderer::renderShadow(Entity* e, float x, float y, float z, float pow, float a) { //
|
||||||
glEnable2(GL_BLEND);
|
glEnable2(GL_BLEND);
|
||||||
@@ -229,6 +300,8 @@ void EntityRenderer::renderShadow(Entity* e, float x, float y, float z, float po
|
|||||||
glColor4f2(1, 1, 1, 1);
|
glColor4f2(1, 1, 1, 1);
|
||||||
glDisable2(GL_BLEND);
|
glDisable2(GL_BLEND);
|
||||||
glDepthMask(true);
|
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() {
|
Level* EntityRenderer::getLevel() {
|
||||||
|
|||||||
@@ -218,6 +218,8 @@ void MobRenderer::renderNameTag(Mob* mob, const std::string& name, float x, floa
|
|||||||
|
|
||||||
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);
|
||||||
@@ -241,6 +243,7 @@ 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();
|
||||||
|
|||||||
@@ -111,6 +111,7 @@
|
|||||||
#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);
|
||||||
@@ -221,6 +222,7 @@ 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,6 +172,7 @@ 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,6 +144,7 @@ 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,6 +227,7 @@ 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"));
|
||||||
|
|||||||
2413
src/client/sound/data/burp1.pcm
Normal file
2413
src/client/sound/data/burp1.pcm
Normal file
File diff suppressed because it is too large
Load Diff
@@ -465,6 +465,15 @@ 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,6 +89,8 @@ 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,7 +169,9 @@ 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;
|
||||||
@@ -177,6 +179,18 @@ 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,6 +52,7 @@ 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();
|
||||||
|
|||||||
@@ -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);
|
// hurt(NULL, 1); // no use anymore since i restored setOnFire - shredder
|
||||||
|
|
||||||
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);
|
// hurt(NULL, 1); // no use anymore since i restored setOnFire - shredder
|
||||||
|
|
||||||
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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -216,6 +216,7 @@ 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()) {
|
||||||
@@ -246,11 +247,24 @@ 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();
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user