forked from Kolyah35/minecraft-pe-0.6.1
Compare commits
9 Commits
feature/gr
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d08948fb00 | ||
|
|
061d6db3a9 | ||
|
|
346ec7469e | ||
|
|
d7d887f882 | ||
| ce182b676f | |||
|
|
4b69a1240a | ||
|
|
8f34fbc1ec | ||
|
|
890604256b | ||
|
|
88ef7f3d17 |
@@ -229,6 +229,12 @@ options.fancyGraphics=Fancy graphics
|
|||||||
options.renderDebug=Debug render
|
options.renderDebug=Debug render
|
||||||
options.anaglyph3d=3D anaglyph
|
options.anaglyph3d=3D anaglyph
|
||||||
|
|
||||||
|
options.windowScale =Window Scaling
|
||||||
|
|
||||||
|
options.menuStyle =Menu Style
|
||||||
|
options.menuStyle.pocket =Pocket Edition
|
||||||
|
options.menuStyle.xperia =Xperia/Pi
|
||||||
|
options.menuStyle.java =Java Beta
|
||||||
|
|
||||||
performance.max=Max FPS
|
performance.max=Max FPS
|
||||||
performance.balanced=Balanced
|
performance.balanced=Balanced
|
||||||
|
|||||||
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"),
|
||||||
|
|||||||
@@ -10,11 +10,11 @@
|
|||||||
|
|
||||||
|
|
||||||
#if defined(APPLE_DEMO_PROMOTION)
|
#if defined(APPLE_DEMO_PROMOTION)
|
||||||
#define NO_NETWORK
|
#define NO_NETWORK
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(RPI)
|
#if defined(RPI)
|
||||||
#define CREATORMODE
|
#define CREATORMODE
|
||||||
#endif
|
#endif
|
||||||
#include "../network/RakNetInstance.h"
|
#include "../network/RakNetInstance.h"
|
||||||
#include "../network/ClientSideNetworkHandler.h"
|
#include "../network/ClientSideNetworkHandler.h"
|
||||||
@@ -117,7 +117,7 @@ const char* Minecraft::progressMessages[] = {
|
|||||||
int Minecraft::customDebugId = Minecraft::CDI_NONE;
|
int Minecraft::customDebugId = Minecraft::CDI_NONE;
|
||||||
|
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
#pragma warning( disable : 4355 ) // 'this' pointer in initialization list which is perfectly legal
|
#pragma warning( disable : 4355 ) // 'this' pointer in initialization list which is perfectly legal
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool Minecraft::useAmbientOcclusion = false;
|
bool Minecraft::useAmbientOcclusion = false;
|
||||||
@@ -182,7 +182,7 @@ Minecraft::Minecraft() :
|
|||||||
reserved_d1(0),reserved_d2(0),
|
reserved_d1(0),reserved_d2(0),
|
||||||
reserved_f1(0),reserved_f2(0), options(this)
|
reserved_f1(0),reserved_f2(0), options(this)
|
||||||
{
|
{
|
||||||
//#ifdef ANDROID
|
//#ifdef ANDROID
|
||||||
|
|
||||||
#if defined(NO_NETWORK)
|
#if defined(NO_NETWORK)
|
||||||
raknetInstance = new IRakNetInstance();
|
raknetInstance = new IRakNetInstance();
|
||||||
@@ -466,16 +466,16 @@ void Minecraft::update() {
|
|||||||
}
|
}
|
||||||
TIMER_POP();
|
TIMER_POP();
|
||||||
|
|
||||||
#ifndef STANDALONE_SERVER
|
#ifndef STANDALONE_SERVER
|
||||||
if (gameMode != NULL) gameMode->render(timer.a);
|
if (gameMode != NULL) gameMode->render(timer.a);
|
||||||
TIMER_PUSH("sound");
|
TIMER_PUSH("sound");
|
||||||
soundEngine->update(player, timer.a);
|
soundEngine->update(player, timer.a);
|
||||||
TIMER_POP_PUSH("render");
|
TIMER_POP_PUSH("render");
|
||||||
gameRenderer->render(timer.a);
|
gameRenderer->render(timer.a);
|
||||||
TIMER_POP();
|
TIMER_POP();
|
||||||
#else
|
#else
|
||||||
CThread::sleep(1);
|
CThread::sleep(1);
|
||||||
#endif
|
#endif
|
||||||
#ifndef STANDALONE_SERVER
|
#ifndef STANDALONE_SERVER
|
||||||
Multitouch::resetThisUpdate();
|
Multitouch::resetThisUpdate();
|
||||||
#endif
|
#endif
|
||||||
@@ -485,14 +485,14 @@ void Minecraft::update() {
|
|||||||
checkGlError("Update finished");
|
checkGlError("Update finished");
|
||||||
|
|
||||||
if (options.getBooleanValue(OPTIONS_RENDER_DEBUG)) {
|
if (options.getBooleanValue(OPTIONS_RENDER_DEBUG)) {
|
||||||
//#ifndef PLATFORM_DESKTOP
|
//#ifndef PLATFORM_DESKTOP
|
||||||
if (!PerfTimer::enabled) {
|
if (!PerfTimer::enabled) {
|
||||||
PerfTimer::reset();
|
PerfTimer::reset();
|
||||||
PerfTimer::enabled = true;
|
PerfTimer::enabled = true;
|
||||||
}
|
}
|
||||||
_perfRenderer->renderFpsMeter(1);
|
_perfRenderer->renderFpsMeter(1);
|
||||||
checkGlError("render debug");
|
checkGlError("render debug");
|
||||||
//#endif
|
//#endif
|
||||||
} else {
|
} else {
|
||||||
PerfTimer::enabled = false;
|
PerfTimer::enabled = false;
|
||||||
}
|
}
|
||||||
@@ -569,17 +569,17 @@ void Minecraft::tick(int nTick, int maxTick) {
|
|||||||
#ifndef STANDALONE_SERVER
|
#ifndef STANDALONE_SERVER
|
||||||
textures->loadAndBindTexture("terrain.png");
|
textures->loadAndBindTexture("terrain.png");
|
||||||
if (!pause && !(screen && !screen->renderGameBehind())) {
|
if (!pause && !(screen && !screen->renderGameBehind())) {
|
||||||
#if !defined(RPI)
|
#if !defined(RPI)
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
if (isSuperFast())
|
if (isSuperFast())
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
if (nTick == maxTick) {
|
if (nTick == maxTick) {
|
||||||
TIMER_POP_PUSH("textures");
|
TIMER_POP_PUSH("textures");
|
||||||
textures->tick(true);
|
textures->tick(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
TIMER_POP_PUSH("particles");
|
TIMER_POP_PUSH("particles");
|
||||||
if (!pause) {
|
if (!pause) {
|
||||||
@@ -701,7 +701,7 @@ void Minecraft::tickInput() {
|
|||||||
if (slot >= 0 && slot < gui.getNumSlots())
|
if (slot >= 0 && slot < gui.getNumSlots())
|
||||||
player->inventory->selectSlot(slot);
|
player->inventory->selectSlot(slot);
|
||||||
|
|
||||||
#if defined(WIN32)
|
#if defined(WIN32)
|
||||||
if (digit >= 1 && GetAsyncKeyState(VK_CONTROL) < 0) {
|
if (digit >= 1 && GetAsyncKeyState(VK_CONTROL) < 0) {
|
||||||
// Set adventure settings here!
|
// Set adventure settings here!
|
||||||
AdventureSettingsPacket p(level->adventureSettings);
|
AdventureSettingsPacket p(level->adventureSettings);
|
||||||
@@ -714,7 +714,7 @@ void Minecraft::tickInput() {
|
|||||||
SetSpawnPositionPacket p(pos);
|
SetSpawnPositionPacket p(pos);
|
||||||
raknetInstance->send(p);
|
raknetInstance->send(p);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (key == Keyboard::KEY_LEFT_CTRL) {
|
if (key == Keyboard::KEY_LEFT_CTRL) {
|
||||||
@@ -751,7 +751,7 @@ void Minecraft::tickInput() {
|
|||||||
options.set(OPTIONS_VIEW_DISTANCE, (dst + 1) % 4);
|
options.set(OPTIONS_VIEW_DISTANCE, (dst + 1) % 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CHEATS
|
#ifdef CHEATS
|
||||||
if (key == Keyboard::KEY_U) {
|
if (key == Keyboard::KEY_U) {
|
||||||
onGraphicsReset();
|
onGraphicsReset();
|
||||||
player->heal(100);
|
player->heal(100);
|
||||||
@@ -832,7 +832,7 @@ void Minecraft::tickInput() {
|
|||||||
_perfRenderer->debugFpsMeterKeyPress(key - '0');
|
_perfRenderer->debugFpsMeterKeyPress(key - '0');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (options.getBooleanValue(OPTIONS_RENDER_DEBUG)) {
|
if (options.getBooleanValue(OPTIONS_RENDER_DEBUG)) {
|
||||||
if (key >= '0' && key <= '9') {
|
if (key >= '0' && key <= '9') {
|
||||||
@@ -843,27 +843,29 @@ void Minecraft::tickInput() {
|
|||||||
if (key == Keyboard::KEY_ESCAPE)
|
if (key == Keyboard::KEY_ESCAPE)
|
||||||
pauseGame(false);
|
pauseGame(false);
|
||||||
|
|
||||||
#ifndef OPENGL_ES
|
#ifdef PLATFORM_DESKTOP
|
||||||
if (key == Keyboard::KEY_P) {
|
if (key == Keyboard::KEY_P) {
|
||||||
static bool isWireFrame = false;
|
static bool isWireFrame = false;
|
||||||
isWireFrame = !isWireFrame;
|
isWireFrame = !isWireFrame;
|
||||||
glPolygonMode(GL_FRONT, isWireFrame? GL_LINE : GL_FILL);
|
glPolygonMode(GL_FRONT, isWireFrame? GL_LINE : GL_FILL);
|
||||||
//glPolygonMode(GL_BACK, isWireFrame? GL_LINE : GL_FILL);
|
//glPolygonMode(GL_BACK, isWireFrame? GL_LINE : GL_FILL);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
if (key == Keyboard::KEY_M) {
|
if (key == Keyboard::KEY_M) {
|
||||||
for (int i = 0; i < 5 * SharedConstants::TicksPerSecond; ++i)
|
for (int i = 0; i < 5 * SharedConstants::TicksPerSecond; ++i)
|
||||||
level->tick();
|
level->tick();
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
TIMER_POP_PUSH("handlemouse");
|
TIMER_POP_PUSH("handlemouse");
|
||||||
|
|
||||||
static bool prevMouseDownLeft = false;
|
static bool prevMouseDownLeft = false;
|
||||||
|
|
||||||
|
if (!useTouchscreen()) {
|
||||||
if (Mouse::getButtonState(MouseAction::ACTION_LEFT) == 0) {
|
if (Mouse::getButtonState(MouseAction::ACTION_LEFT) == 0) {
|
||||||
gameMode->stopDestroyBlock();
|
gameMode->stopDestroyBlock();
|
||||||
}
|
}
|
||||||
@@ -871,6 +873,7 @@ void Minecraft::tickInput() {
|
|||||||
if (!Mouse::isButtonDown(MouseAction::ACTION_RIGHT)) {
|
if (!Mouse::isButtonDown(MouseAction::ACTION_RIGHT)) {
|
||||||
gameMode->releaseUsingItem(player);
|
gameMode->releaseUsingItem(player);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (useTouchscreen()) {
|
if (useTouchscreen()) {
|
||||||
// Touch: gesture recognizer classifies the action type (turn/destroy/build)
|
// Touch: gesture recognizer classifies the action type (turn/destroy/build)
|
||||||
@@ -880,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
|
||||||
@@ -985,10 +991,10 @@ void Minecraft::handleBuildAction(BuildActionIntention* action) {
|
|||||||
if (gameMode->useItemOn(player, level, item, x, y, z, face, hitResult.pos)) {
|
if (gameMode->useItemOn(player, level, item, x, y, z, face, hitResult.pos)) {
|
||||||
mayUse = false;
|
mayUse = false;
|
||||||
player->swing();
|
player->swing();
|
||||||
#ifdef RPI
|
#ifdef RPI
|
||||||
} else if (item && item->id == ((Item*)Item::sword_iron)->id) {
|
} else if (item && item->id == ((Item*)Item::sword_iron)->id) {
|
||||||
player->swing();
|
player->swing();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
if (item && item->count <= 0) {
|
if (item && item->count <= 0) {
|
||||||
player->inventory->clearSlot(player->inventory->selected);
|
player->inventory->clearSlot(player->inventory->selected);
|
||||||
@@ -1142,7 +1148,8 @@ void Minecraft::init()
|
|||||||
textures->addDynamicTexture(new WaterSideTexture());
|
textures->addDynamicTexture(new WaterSideTexture());
|
||||||
textures->addDynamicTexture(new LavaTexture());
|
textures->addDynamicTexture(new LavaTexture());
|
||||||
textures->addDynamicTexture(new LavaSideTexture());
|
textures->addDynamicTexture(new LavaSideTexture());
|
||||||
textures->addDynamicTexture(new FireTexture());
|
textures->addDynamicTexture(new FireTexture(0));
|
||||||
|
textures->addDynamicTexture(new FireTexture(1));
|
||||||
gui.texturesLoaded(textures);
|
gui.texturesLoaded(textures);
|
||||||
|
|
||||||
levelRenderer = new LevelRenderer(this);
|
levelRenderer = new LevelRenderer(this);
|
||||||
@@ -1150,7 +1157,7 @@ void Minecraft::init()
|
|||||||
particleEngine = new ParticleEngine(level, textures);
|
particleEngine = new ParticleEngine(level, textures);
|
||||||
|
|
||||||
// 4j's code for reference
|
// 4j's code for reference
|
||||||
// FoliageColor::init(textures->loadTexturePixels(L"misc/foliagecolor.png"));
|
// FoliageColor::init(textures->loadTexturePixels(L"misc/foliagecolor.png"));
|
||||||
|
|
||||||
|
|
||||||
// my code
|
// my code
|
||||||
@@ -1191,6 +1198,24 @@ void Minecraft::setSize(int w, int h) {
|
|||||||
|
|
||||||
width = w;
|
width = w;
|
||||||
height = h;
|
height = h;
|
||||||
|
int screenWidth;
|
||||||
|
int screenHeight;
|
||||||
|
//#ifdef PLATFORM_DESKTOP
|
||||||
|
if (options.getBooleanValue(OPTIONS_WINDOW_SCALE)){ // scales with resolution using a formula instead of having hardcoded if checks
|
||||||
|
int guiScale = options.getIntValue(OPTIONS_GUI_SCALE);
|
||||||
|
if (guiScale == 0) {
|
||||||
|
guiScale = 1000;
|
||||||
|
}
|
||||||
|
|
||||||
|
// determine gui scale, optionally overriding auto
|
||||||
|
|
||||||
|
|
||||||
|
Gui::GuiScale = (float)Mth::Min(guiScale, Mth::Max(1, Mth::Min(width / 320, height / 240)));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
|
||||||
int guiScale = options.getIntValue(OPTIONS_GUI_SCALE);
|
int guiScale = options.getIntValue(OPTIONS_GUI_SCALE);
|
||||||
|
|
||||||
@@ -1208,11 +1233,11 @@ void Minecraft::setSize(int w, int h) {
|
|||||||
} else {
|
} else {
|
||||||
// auto compute from resolution
|
// auto compute from resolution
|
||||||
if (width >= 1000) {
|
if (width >= 1000) {
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
Gui::GuiScale = (width > 2000)? 8.0f : 4.0f;
|
Gui::GuiScale = (width > 2000)? 8.0f : 4.0f;
|
||||||
#else
|
#else
|
||||||
Gui::GuiScale = 4.0f;
|
Gui::GuiScale = 4.0f;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else if (width >= 800) {
|
else if (width >= 800) {
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
@@ -1227,9 +1252,7 @@ void Minecraft::setSize(int w, int h) {
|
|||||||
Gui::GuiScale = 1.0f;
|
Gui::GuiScale = 1.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
Gui::InvGuiScale = 1.0f / Gui::GuiScale;
|
|
||||||
int screenWidth = (int)(width * Gui::InvGuiScale);
|
|
||||||
int screenHeight = (int)(height * Gui::InvGuiScale);
|
|
||||||
|
|
||||||
// if (platform()) {
|
// if (platform()) {
|
||||||
// float pixelsPerMillimeter = options.getProgressValue(&Option::PIXELS_PER_MILLIMETER);
|
// float pixelsPerMillimeter = options.getProgressValue(&Option::PIXELS_PER_MILLIMETER);
|
||||||
@@ -1237,6 +1260,13 @@ void Minecraft::setSize(int w, int h) {
|
|||||||
// pixelCalcUi.setPixelsPerMillimeter(pixelsPerMillimeter * Gui::InvGuiScale);
|
// pixelCalcUi.setPixelsPerMillimeter(pixelsPerMillimeter * Gui::InvGuiScale);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Gui::InvGuiScale = 1.0f / Gui::GuiScale;
|
||||||
|
screenWidth = (int)(width * Gui::InvGuiScale);
|
||||||
|
screenHeight = (int)(height * Gui::InvGuiScale);
|
||||||
|
|
||||||
Config config = createConfig(this);
|
Config config = createConfig(this);
|
||||||
gui.onConfigChanged(config);
|
gui.onConfigChanged(config);
|
||||||
|
|
||||||
@@ -1281,17 +1311,17 @@ void Minecraft::_reloadInput() {
|
|||||||
if (useTouchHolder) {
|
if (useTouchHolder) {
|
||||||
inputHolder = new TouchInputHolder(this, &options);
|
inputHolder = new TouchInputHolder(this, &options);
|
||||||
} else {
|
} else {
|
||||||
#if defined(ANDROID) || defined(__APPLE__)
|
#if defined(ANDROID) || defined(__APPLE__)
|
||||||
inputHolder = new CustomInputHolder(
|
inputHolder = new CustomInputHolder(
|
||||||
new XperiaPlayInput(&options),
|
new XperiaPlayInput(&options),
|
||||||
new ControllerTurnInput(2, ControllerTurnInput::MODE_DELTA),
|
new ControllerTurnInput(2, ControllerTurnInput::MODE_DELTA),
|
||||||
new IBuildInput());
|
new IBuildInput());
|
||||||
#else
|
#else
|
||||||
inputHolder = new CustomInputHolder(
|
inputHolder = new CustomInputHolder(
|
||||||
new KeyboardInput(&options),
|
new KeyboardInput(&options),
|
||||||
new MouseTurnInput(MouseTurnInput::MODE_DELTA, width/2, height/2),
|
new MouseTurnInput(MouseTurnInput::MODE_DELTA, width/2, height/2),
|
||||||
new MouseBuildInput());
|
new MouseBuildInput());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
mouseHandler.setTurnInput(inputHolder->getTurnInput());
|
mouseHandler.setTurnInput(inputHolder->getTurnInput());
|
||||||
@@ -1363,11 +1393,11 @@ void Minecraft::hostMultiplayer(int port) {
|
|||||||
|
|
||||||
#if !defined(NO_NETWORK)
|
#if !defined(NO_NETWORK)
|
||||||
netCallback = new ServerSideNetworkHandler(this, raknetInstance);
|
netCallback = new ServerSideNetworkHandler(this, raknetInstance);
|
||||||
#ifdef STANDALONE_SERVER
|
#ifdef STANDALONE_SERVER
|
||||||
raknetInstance->host("Server", port, 16);
|
raknetInstance->host("Server", port, 16);
|
||||||
#else
|
#else
|
||||||
raknetInstance->host(options.getStringValue(OPTIONS_USERNAME), port);
|
raknetInstance->host(options.getStringValue(OPTIONS_USERNAME), port);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1642,12 +1672,12 @@ void Minecraft::optionUpdated(OptionId option, bool value ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Minecraft::optionUpdated(OptionId option, float value ) {
|
void Minecraft::optionUpdated(OptionId option, float value ) {
|
||||||
// #ifndef STANDALONE_SERVER
|
// #ifndef STANDALONE_SERVER
|
||||||
// if(option == OPTIONS_PIXELS_PER_MILLIMETER) {
|
// if(option == OPTIONS_PIXELS_PER_MILLIMETER) {
|
||||||
// pixelCalcUi.setPixelsPerMillimeter(value * Gui::InvGuiScale);
|
// pixelCalcUi.setPixelsPerMillimeter(value * Gui::InvGuiScale);
|
||||||
// pixelCalc.setPixelsPerMillimeter(value);
|
// pixelCalc.setPixelsPerMillimeter(value);
|
||||||
// }
|
// }
|
||||||
// #endif
|
// #endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void Minecraft::optionUpdated(OptionId option, int value ) {
|
void Minecraft::optionUpdated(OptionId option, int value ) {
|
||||||
|
|||||||
@@ -82,6 +82,10 @@ OptionBool restoredAnims("restoredAnims", true);
|
|||||||
|
|
||||||
OptionInt debugStyle("debugStyle", 0, 0, 1);
|
OptionInt debugStyle("debugStyle", 0, 0, 1);
|
||||||
|
|
||||||
|
OptionInt menuStyle("menuStyle",0, 0, 2);
|
||||||
|
|
||||||
|
OptionBool windowScale("windowScale", false);
|
||||||
|
|
||||||
OptionInt keyForward("key.forward", Keyboard::KEY_W);
|
OptionInt keyForward("key.forward", Keyboard::KEY_W);
|
||||||
OptionInt keyLeft("key.left", Keyboard::KEY_A);
|
OptionInt keyLeft("key.left", Keyboard::KEY_A);
|
||||||
OptionInt keyBack("key.back", Keyboard::KEY_S);
|
OptionInt keyBack("key.back", Keyboard::KEY_S);
|
||||||
@@ -134,6 +138,7 @@ void Options::initTable() {
|
|||||||
|
|
||||||
|
|
||||||
m_options[OPTIONS_GUI_SCALE] = &guiScale;
|
m_options[OPTIONS_GUI_SCALE] = &guiScale;
|
||||||
|
m_options[OPTIONS_WINDOW_SCALE] = &windowScale;
|
||||||
|
|
||||||
m_options[OPTIONS_SKIN] = &skin;
|
m_options[OPTIONS_SKIN] = &skin;
|
||||||
m_options[OPTIONS_USERNAME] = &username;
|
m_options[OPTIONS_USERNAME] = &username;
|
||||||
@@ -170,6 +175,8 @@ void Options::initTable() {
|
|||||||
|
|
||||||
m_options[OPTIONS_SERVER_VISIBLE] = &serverVisible;
|
m_options[OPTIONS_SERVER_VISIBLE] = &serverVisible;
|
||||||
|
|
||||||
|
m_options[OPTIONS_MENU_STYLE] = &menuStyle;
|
||||||
|
|
||||||
m_options[OPTIONS_KEY_FORWARD] = &keyForward;
|
m_options[OPTIONS_KEY_FORWARD] = &keyForward;
|
||||||
m_options[OPTIONS_KEY_LEFT] = &keyLeft;
|
m_options[OPTIONS_KEY_LEFT] = &keyLeft;
|
||||||
m_options[OPTIONS_KEY_BACK] = &keyBack;
|
m_options[OPTIONS_KEY_BACK] = &keyBack;
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ enum OptionId {
|
|||||||
OPTIONS_BAR_ON_TOP,
|
OPTIONS_BAR_ON_TOP,
|
||||||
OPTIONS_ALLOW_SPRINT,
|
OPTIONS_ALLOW_SPRINT,
|
||||||
OPTIONS_AUTOJUMP,
|
OPTIONS_AUTOJUMP,
|
||||||
|
OPTIONS_WINDOW_SCALE,
|
||||||
|
|
||||||
// Graphics
|
// Graphics
|
||||||
OPTIONS_RENDER_DEBUG,
|
OPTIONS_RENDER_DEBUG,
|
||||||
@@ -51,6 +52,7 @@ enum OptionId {
|
|||||||
OPTIONS_FANCY_GRAPHICS,
|
OPTIONS_FANCY_GRAPHICS,
|
||||||
OPTIONS_NORMAL_LIGHTING,
|
OPTIONS_NORMAL_LIGHTING,
|
||||||
|
|
||||||
|
|
||||||
// Cheats / debug
|
// Cheats / debug
|
||||||
OPTIONS_FLY_SPEED,
|
OPTIONS_FLY_SPEED,
|
||||||
OPTIONS_CAMERA_SPEED,
|
OPTIONS_CAMERA_SPEED,
|
||||||
@@ -95,6 +97,8 @@ enum OptionId {
|
|||||||
OPTIONS_BEAUTIFUL_SKY,
|
OPTIONS_BEAUTIFUL_SKY,
|
||||||
OPTIONS_VIGNETTE,
|
OPTIONS_VIGNETTE,
|
||||||
OPTIONS_DEBUG_STYLE,
|
OPTIONS_DEBUG_STYLE,
|
||||||
|
OPTIONS_COMPLETE_LIGHTING,
|
||||||
|
OPTIONS_MENU_STYLE,
|
||||||
// Should be last!
|
// Should be last!
|
||||||
OPTIONS_COUNT
|
OPTIONS_COUNT
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -224,8 +224,8 @@ void Gui::handleClick(int button, int x, int y) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Gui::handleKeyPressed(int key)
|
void Gui::handleKeyPressed(int key)
|
||||||
{
|
{
|
||||||
bool isChatting = (minecraft->screen && (dynamic_cast<ChatScreen*>(minecraft->screen) || dynamic_cast<ConsoleScreen*>(minecraft->screen)));
|
bool isChatting = (minecraft->screen && (dynamic_cast<ChatScreen*>(minecraft->screen) || dynamic_cast<ConsoleScreen*>(minecraft->screen)));
|
||||||
if (isChatting) {
|
if (isChatting) {
|
||||||
// Allow scrolling the chat history with the mouse/keyboard when chat is open
|
// Allow scrolling the chat history with the mouse/keyboard when chat is open
|
||||||
@@ -275,7 +275,7 @@ void Gui::handleKeyPressed(int key)
|
|||||||
{
|
{
|
||||||
minecraft->player->inventory->dropSlot(minecraft->player->inventory->selected, false);
|
minecraft->player->inventory->dropSlot(minecraft->player->inventory->selected, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Gui::scrollChat(int delta) {
|
void Gui::scrollChat(int delta) {
|
||||||
if (delta == 0)
|
if (delta == 0)
|
||||||
@@ -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){
|
||||||
|
|
||||||
|
|||||||
@@ -56,6 +56,28 @@ void OptionsItem::render( Minecraft* minecraft, int xm, int ym ) {
|
|||||||
}
|
}
|
||||||
text += ": " + scaleText;
|
text += ": " + scaleText;
|
||||||
}
|
}
|
||||||
|
if (m_optionId == OPTIONS_MENU_STYLE) {
|
||||||
|
int value = minecraft->options.getIntValue(OPTIONS_MENU_STYLE);
|
||||||
|
std::string scaleText;
|
||||||
|
switch (value) {
|
||||||
|
case 0: scaleText = I18n::get("options.menuStyle.pocket"); break;
|
||||||
|
case 1: scaleText = I18n::get("options.menuStyle.xperia"); break;
|
||||||
|
case 2: scaleText = I18n::get("options.menuStyle.java"); break;
|
||||||
|
}
|
||||||
|
text += ": " + scaleText;
|
||||||
|
}
|
||||||
|
if (m_optionId == OPTIONS_VIEW_DISTANCE) {
|
||||||
|
int value = minecraft->options.getIntValue(OPTIONS_VIEW_DISTANCE);
|
||||||
|
std::string scaleText;
|
||||||
|
switch (value) {
|
||||||
|
case 0: scaleText = I18n::get("options.renderDistance.far"); break;
|
||||||
|
case 1: scaleText = I18n::get("options.renderDistance.normal"); break;
|
||||||
|
case 2: scaleText = I18n::get("options.renderDistance.short"); break;
|
||||||
|
case 3: scaleText = I18n::get("options.renderDistance.tiny"); break;
|
||||||
|
default: scaleText = "Debug"; break;
|
||||||
|
}
|
||||||
|
text += ": " + scaleText;
|
||||||
|
}
|
||||||
|
|
||||||
minecraft->font->draw(text, (float)x, (float)y + yOffset, 0x909090, false);
|
minecraft->font->draw(text, (float)x, (float)y + yOffset, 0x909090, false);
|
||||||
super::render(minecraft, xm, ym);
|
super::render(minecraft, xm, ym);
|
||||||
|
|||||||
@@ -23,12 +23,15 @@ DeathScreen::~DeathScreen()
|
|||||||
|
|
||||||
void DeathScreen::init()
|
void DeathScreen::init()
|
||||||
{
|
{
|
||||||
if (/* minecraft->useTouchscreen() */ true) {
|
if (minecraft->options.getIntValue(OPTIONS_MENU_STYLE) == 0) {
|
||||||
bRespawn = new Touch::TButton(1, "Respawn!");
|
bRespawn = new Touch::TButton(1, "Respawn!");
|
||||||
bTitle = new Touch::TButton(2, "Main menu");
|
bTitle = new Touch::TButton(2, "Main menu");
|
||||||
} else {
|
} else if (minecraft->options.getIntValue(OPTIONS_MENU_STYLE) == 1) {
|
||||||
bRespawn = new Button(1, "Respawn!");
|
bRespawn = new Button(1, "Respawn!");
|
||||||
bTitle = new Button(2, "Main menu");
|
bTitle = new Button(2, "Main menu");
|
||||||
|
} else {
|
||||||
|
bRespawn = new Button(1, 0, 0, 200, 20, "Respawn");
|
||||||
|
bTitle = new Button(2, 0, 0, 200, 20, "Title menu");
|
||||||
}
|
}
|
||||||
buttons.push_back(bRespawn);
|
buttons.push_back(bRespawn);
|
||||||
buttons.push_back(bTitle);
|
buttons.push_back(bTitle);
|
||||||
@@ -39,13 +42,23 @@ void DeathScreen::init()
|
|||||||
|
|
||||||
void DeathScreen::setupPositions()
|
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->y = bTitle->y = height / 2;
|
||||||
bRespawn->x = width/2 - bRespawn->width - 10;
|
bRespawn->x = width/2 - bRespawn->width - 10;
|
||||||
bTitle->x = width/2 + 10;
|
bTitle->x = width/2 + 10;
|
||||||
|
}
|
||||||
LOGI("xyz: %d, %d (%d, %d)\n", bTitle->x, bTitle->y, width, height);
|
// LOGI("xyz: %d, %d (%d, %d)\n", bTitle->x, bTitle->y, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeathScreen::tick() {
|
void DeathScreen::tick() {
|
||||||
@@ -56,10 +69,20 @@ void DeathScreen::render( int xm, int ym, float a )
|
|||||||
{
|
{
|
||||||
fillGradient(0, 0, width, height, 0x60500000, 0xa0803030);
|
fillGradient(0, 0, width, height, 0x60500000, 0xa0803030);
|
||||||
|
|
||||||
|
if (minecraft->options.getIntValue(OPTIONS_MENU_STYLE) == 2){
|
||||||
|
glPushMatrix2();
|
||||||
|
glScalef2(2, 2, 2);
|
||||||
|
drawCenteredString(font, "Game over!", width / 2 / 2, height / 8, 0xffffff);
|
||||||
|
glPopMatrix2();
|
||||||
|
std::stringstream ss;
|
||||||
|
ss << "Score: &e" << minecraft->player->getScore();
|
||||||
|
drawCenteredString(font, ss.str(), width / 2, (height / 4) + 32, 0xffffff);
|
||||||
|
} else {
|
||||||
glPushMatrix2();
|
glPushMatrix2();
|
||||||
glScalef2(2, 2, 2);
|
glScalef2(2, 2, 2);
|
||||||
drawCenteredString(font, "You died!", width / 2 / 2, height / 8, 0xffffff);
|
drawCenteredString(font, "You died!", width / 2 / 2, height / 8, 0xffffff);
|
||||||
glPopMatrix2();
|
glPopMatrix2();
|
||||||
|
}
|
||||||
|
|
||||||
if (_tick >= WAIT_TICKS)
|
if (_tick >= WAIT_TICKS)
|
||||||
Screen::render(xm, ym, a);
|
Screen::render(xm, ym, a);
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
#include "../../renderer/Textures.h"
|
#include "../../renderer/Textures.h"
|
||||||
#include "../../gamemode/GameMode.h"
|
#include "../../gamemode/GameMode.h"
|
||||||
#include "ArmorScreen.h"
|
#include "ArmorScreen.h"
|
||||||
|
#include "crafting/WorkbenchScreen.h"
|
||||||
#include "../components/Button.h"
|
#include "../components/Button.h"
|
||||||
|
|
||||||
#if defined(__APPLE__)
|
#if defined(__APPLE__)
|
||||||
@@ -27,7 +28,8 @@ IngameBlockSelectionScreen::IngameBlockSelectionScreen()
|
|||||||
InventoryRows(1),
|
InventoryRows(1),
|
||||||
InventoryCols(1),
|
InventoryCols(1),
|
||||||
InventorySize(1),
|
InventorySize(1),
|
||||||
bArmor(1, "Armor")
|
bArmor(1, "Armor"),
|
||||||
|
bCrafting(1, "Crafting")
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -43,6 +45,19 @@ void IngameBlockSelectionScreen::init()
|
|||||||
(float)getSlotPosX(InventoryCols) + 4,
|
(float)getSlotPosX(InventoryCols) + 4,
|
||||||
(float)getSlotPosY(InventoryRows) + 4);
|
(float)getSlotPosY(InventoryRows) + 4);
|
||||||
|
|
||||||
|
if (!minecraft->isCreativeMode()) {
|
||||||
|
bArmor.width = 42;
|
||||||
|
bCrafting.width = 42;
|
||||||
|
|
||||||
|
bArmor.x = 0;
|
||||||
|
bArmor.y = height - bArmor.height;
|
||||||
|
|
||||||
|
bCrafting.x = 0;
|
||||||
|
bCrafting.y = height - bCrafting.height - 30;
|
||||||
|
buttons.push_back(&bArmor);
|
||||||
|
buttons.push_back(&bCrafting);
|
||||||
|
}
|
||||||
|
|
||||||
ItemInstance* selected = inventory->getSelected();
|
ItemInstance* selected = inventory->getSelected();
|
||||||
if (!selected || selected->isNull()) {
|
if (!selected || selected->isNull()) {
|
||||||
selectedItem = 0;
|
selectedItem = 0;
|
||||||
@@ -58,13 +73,6 @@ void IngameBlockSelectionScreen::init()
|
|||||||
}
|
}
|
||||||
if (!isAllowed(selectedItem))
|
if (!isAllowed(selectedItem))
|
||||||
selectedItem = 0;
|
selectedItem = 0;
|
||||||
|
|
||||||
if (!minecraft->isCreativeMode()) {
|
|
||||||
bArmor.width = 42;
|
|
||||||
bArmor.x = 0;
|
|
||||||
bArmor.y = height - bArmor.height;
|
|
||||||
buttons.push_back(&bArmor);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void IngameBlockSelectionScreen::removed()
|
void IngameBlockSelectionScreen::removed()
|
||||||
@@ -124,7 +132,7 @@ void IngameBlockSelectionScreen::renderSlots()
|
|||||||
//w.printEvery(1000, "render-blocksel");
|
//w.printEvery(1000, "render-blocksel");
|
||||||
|
|
||||||
glDisable2(GL_RESCALE_NORMAL);
|
glDisable2(GL_RESCALE_NORMAL);
|
||||||
Lighting::turnOn(minecraft);
|
Lighting::turnOff();
|
||||||
}
|
}
|
||||||
|
|
||||||
int IngameBlockSelectionScreen::getSlotPosX(int slotX) {
|
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);
|
//minecraft->soundEngine->playUI("random.click", 1, 1);
|
||||||
} else {
|
} else {
|
||||||
_pendingQuit = !_area.isInside((float)x, (float)y)
|
_pendingQuit = !_area.isInside((float)x, (float)y)
|
||||||
&& !bArmor.isInside(x, y);
|
&& !bArmor.isInside(x, y) && !bCrafting.isInside(x, y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!_pendingQuit)
|
if (!_pendingQuit)
|
||||||
@@ -338,5 +346,8 @@ void IngameBlockSelectionScreen::buttonClicked( Button* button )
|
|||||||
if (button == &bArmor) {
|
if (button == &bArmor) {
|
||||||
minecraft->setScreen(new ArmorScreen());
|
minecraft->setScreen(new ArmorScreen());
|
||||||
}
|
}
|
||||||
|
if (button == &bCrafting) {
|
||||||
|
minecraft->setScreen(new WorkbenchScreen(Recipe::SIZE_2X2));
|
||||||
|
}
|
||||||
super::buttonClicked(button);
|
super::buttonClicked(button);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ private:
|
|||||||
bool _pendingQuit;
|
bool _pendingQuit;
|
||||||
|
|
||||||
Button bArmor;
|
Button bArmor;
|
||||||
|
Button bCrafting;
|
||||||
|
|
||||||
RectangleArea _area;
|
RectangleArea _area;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -197,6 +197,7 @@ void OptionsScreen::generateOptionScreens() {
|
|||||||
optionPanes[1]->addOptionItem(OPTIONS_DIFFICULTY, minecraft)
|
optionPanes[1]->addOptionItem(OPTIONS_DIFFICULTY, minecraft)
|
||||||
.addOptionItem(OPTIONS_SERVER_VISIBLE, minecraft)
|
.addOptionItem(OPTIONS_SERVER_VISIBLE, minecraft)
|
||||||
.addOptionItem(OPTIONS_THIRD_PERSON_VIEW, minecraft)
|
.addOptionItem(OPTIONS_THIRD_PERSON_VIEW, minecraft)
|
||||||
|
.addOptionItem(OPTIONS_WINDOW_SCALE, minecraft)
|
||||||
.addOptionItem(OPTIONS_GUI_SCALE, minecraft)
|
.addOptionItem(OPTIONS_GUI_SCALE, minecraft)
|
||||||
.addOptionItem(OPTIONS_SENSITIVITY, minecraft)
|
.addOptionItem(OPTIONS_SENSITIVITY, minecraft)
|
||||||
.addOptionItem(OPTIONS_MUSIC_VOLUME, minecraft)
|
.addOptionItem(OPTIONS_MUSIC_VOLUME, minecraft)
|
||||||
@@ -223,6 +224,7 @@ void OptionsScreen::generateOptionScreens() {
|
|||||||
// .addOptionItem(&Option::ANAGLYPH, minecraft)
|
// .addOptionItem(&Option::ANAGLYPH, minecraft)
|
||||||
.addOptionItem(OPTIONS_LIMIT_FRAMERATE, minecraft)
|
.addOptionItem(OPTIONS_LIMIT_FRAMERATE, minecraft)
|
||||||
.addOptionItem(OPTIONS_VSYNC, minecraft)
|
.addOptionItem(OPTIONS_VSYNC, minecraft)
|
||||||
|
.addOptionItem(OPTIONS_VIEW_DISTANCE, minecraft)
|
||||||
.addOptionItem(OPTIONS_RENDER_DEBUG, minecraft)
|
.addOptionItem(OPTIONS_RENDER_DEBUG, minecraft)
|
||||||
.addOptionItem(OPTIONS_ANAGLYPH_3D, minecraft)
|
.addOptionItem(OPTIONS_ANAGLYPH_3D, minecraft)
|
||||||
.addOptionItem(OPTIONS_VIEW_BOBBING, minecraft)
|
.addOptionItem(OPTIONS_VIEW_BOBBING, minecraft)
|
||||||
@@ -233,6 +235,7 @@ void OptionsScreen::generateOptionScreens() {
|
|||||||
|
|
||||||
optionPanes[4]->addOptionItem(OPTIONS_ALLOW_SPRINT, minecraft)
|
optionPanes[4]->addOptionItem(OPTIONS_ALLOW_SPRINT, minecraft)
|
||||||
.addOptionItem(OPTIONS_BAR_ON_TOP, minecraft)
|
.addOptionItem(OPTIONS_BAR_ON_TOP, minecraft)
|
||||||
|
.addOptionItem(OPTIONS_MENU_STYLE, minecraft)
|
||||||
.addOptionItem(OPTIONS_RPI_CURSOR, minecraft)
|
.addOptionItem(OPTIONS_RPI_CURSOR, minecraft)
|
||||||
.addOptionItem(OPTIONS_FOLIAGE_TINT, minecraft)
|
.addOptionItem(OPTIONS_FOLIAGE_TINT, minecraft)
|
||||||
.addOptionItem(OPTIONS_TINTED_SIDE, minecraft)
|
.addOptionItem(OPTIONS_TINTED_SIDE, minecraft)
|
||||||
|
|||||||
@@ -10,14 +10,14 @@
|
|||||||
#include "client/gui/screens/OptionsScreen.h"
|
#include "client/gui/screens/OptionsScreen.h"
|
||||||
|
|
||||||
PauseScreen::PauseScreen(bool wasBackPaused)
|
PauseScreen::PauseScreen(bool wasBackPaused)
|
||||||
: saveStep(0),
|
: saveStep(0),
|
||||||
visibleTime(0),
|
visibleTime(0),
|
||||||
bContinue(0),
|
bContinue(0),
|
||||||
bQuit(0),
|
bQuit(0),
|
||||||
bOptions(0),
|
bOptions(0),
|
||||||
bQuitAndSaveLocally(0),
|
bQuitAndSaveLocally(0),
|
||||||
bServerVisibility(0),
|
bServerVisibility(0),
|
||||||
// bThirdPerson(0),
|
// bThirdPerson(0),
|
||||||
wasBackPaused(wasBackPaused),
|
wasBackPaused(wasBackPaused),
|
||||||
// bSound(OPTIONS_SOUND_VOLUME, 1, 0),
|
// bSound(OPTIONS_SOUND_VOLUME, 1, 0),
|
||||||
bThirdPerson(OPTIONS_THIRD_PERSON_VIEW),
|
bThirdPerson(OPTIONS_THIRD_PERSON_VIEW),
|
||||||
@@ -44,24 +44,31 @@ PauseScreen::~PauseScreen() {
|
|||||||
delete bQuitAndSaveLocally;
|
delete bQuitAndSaveLocally;
|
||||||
delete bServerVisibility;
|
delete bServerVisibility;
|
||||||
delete bOptions;
|
delete bOptions;
|
||||||
// delete bThirdPerson;
|
// delete bThirdPerson;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PauseScreen::init() {
|
void PauseScreen::init() {
|
||||||
if (/* minecraft->useTouchscreen() */ true) {
|
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");
|
||||||
bQuit = new Touch::TButton(2, "Quit to title");
|
bQuit = new Touch::TButton(2, "Quit to title");
|
||||||
bQuitAndSaveLocally = new Touch::TButton(3, "Quit and copy map");
|
bQuitAndSaveLocally = new Touch::TButton(3, "Quit and copy map");
|
||||||
bServerVisibility = new Touch::TButton(4, "");
|
bServerVisibility = new Touch::TButton(4, "");
|
||||||
// bThirdPerson = new Touch::TButton(5, "Toggle 3:rd person view");
|
// bThirdPerson = new Touch::TButton(5, "Toggle 3:rd person view");
|
||||||
} else {
|
} 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");
|
||||||
bQuit = new Button(2, "Quit to title");
|
bQuit = new Button(2, "Quit to title");
|
||||||
bQuitAndSaveLocally = new Button(3, "Quit and copy map");
|
bQuitAndSaveLocally = new Button(3, "Quit and copy map");
|
||||||
bServerVisibility = new Button(4, "");
|
bServerVisibility = new Button(4, "");
|
||||||
// bThirdPerson = new Button(5, "Toggle 3:rd person view");
|
// bThirdPerson = new Button(5, "Toggle 3:rd person view");
|
||||||
|
} else {
|
||||||
|
bContinue = new Button(1, 0, 0, 200, 20, "Back to game");
|
||||||
|
bServerVisibility = new Button(4, 0, 0, 200, 20, "");
|
||||||
|
bOptions = new Button(5, 0, 0, 200, 20, "Options...");
|
||||||
|
bQuit = new Button(2, 0, 0, 200, 20, "Save and quit to title");
|
||||||
|
bQuitAndSaveLocally = new Button(3, 0, 0, 200, 20, "Copy and quit map");
|
||||||
|
// bThirdPerson = new Button(5, "Toggle 3:rd person view");
|
||||||
}
|
}
|
||||||
|
|
||||||
buttons.push_back(bContinue);
|
buttons.push_back(bContinue);
|
||||||
@@ -77,7 +84,7 @@ void PauseScreen::init() {
|
|||||||
// If Back wasn't pressed, set up additional items (more than Quit to menu
|
// If Back wasn't pressed, set up additional items (more than Quit to menu
|
||||||
// and Back to game) here
|
// and Back to game) here
|
||||||
|
|
||||||
#if !defined(APPLE_DEMO_PROMOTION) && !defined(RPI)
|
#if !defined(APPLE_DEMO_PROMOTION) && !defined(RPI)
|
||||||
if (true || !wasBackPaused) {
|
if (true || !wasBackPaused) {
|
||||||
if (minecraft->raknetInstance) {
|
if (minecraft->raknetInstance) {
|
||||||
if (minecraft->raknetInstance->isServer()) {
|
if (minecraft->raknetInstance->isServer()) {
|
||||||
@@ -85,14 +92,14 @@ void PauseScreen::init() {
|
|||||||
buttons.push_back(bServerVisibility);
|
buttons.push_back(bServerVisibility);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
#if !defined(DEMO_MODE)
|
#if !defined(DEMO_MODE)
|
||||||
buttons.push_back(bQuitAndSaveLocally);
|
buttons.push_back(bQuitAndSaveLocally);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
// buttons.push_back(bThirdPerson);
|
// buttons.push_back(bThirdPerson);
|
||||||
|
|
||||||
for (unsigned int i = 0; i < buttons.size(); ++i) {
|
for (unsigned int i = 0; i < buttons.size(); ++i) {
|
||||||
// if (buttons[i] == &bSound) continue;
|
// if (buttons[i] == &bSound) continue;
|
||||||
@@ -105,7 +112,25 @@ void PauseScreen::init() {
|
|||||||
void PauseScreen::setupPositions() {
|
void PauseScreen::setupPositions() {
|
||||||
saveStep = 0;
|
saveStep = 0;
|
||||||
int yBase = 16;
|
int yBase = 16;
|
||||||
|
if (minecraft->options.getIntValue(OPTIONS_MENU_STYLE) == 2){
|
||||||
|
yBase = 50;
|
||||||
|
|
||||||
|
bContinue->width = bOptions->width = bQuit->width = /*bThirdPerson->w =*/ 200;
|
||||||
|
bQuitAndSaveLocally->width = bServerVisibility->width = 200;
|
||||||
|
|
||||||
|
bContinue->x = (width - bContinue->width) / 2;
|
||||||
|
bContinue->y = yBase + 24 * 1;
|
||||||
|
|
||||||
|
bQuitAndSaveLocally->x = bServerVisibility->x = (width - bQuitAndSaveLocally->width) / 2;
|
||||||
|
bQuitAndSaveLocally->y = bServerVisibility->y = yBase + 24 * 2;
|
||||||
|
|
||||||
|
bOptions->x = (width - bOptions->width) / 2;
|
||||||
|
bOptions->y = yBase + 24 * 3 + 24;
|
||||||
|
|
||||||
|
bQuit->x = (width - bQuit->width) / 2;
|
||||||
|
bQuit->y = yBase + 24 * 4 + 24;
|
||||||
|
|
||||||
|
} else {
|
||||||
bContinue->width = bOptions->width = bQuit->width = /*bThirdPerson->w =*/ 160;
|
bContinue->width = bOptions->width = bQuit->width = /*bThirdPerson->w =*/ 160;
|
||||||
bQuitAndSaveLocally->width = bServerVisibility->width = 160;
|
bQuitAndSaveLocally->width = bServerVisibility->width = 160;
|
||||||
|
|
||||||
@@ -124,6 +149,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 + 32 * 4;
|
bQuitAndSaveLocally->y = bServerVisibility->y = yBase + 32 * 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// bSound.y = bThirdPerson.y = 8;
|
// bSound.y = bThirdPerson.y = 8;
|
||||||
// bSound.x = 4;
|
// bSound.x = 4;
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ Screen* ScreenChooser::createScreen( ScreenId id )
|
|||||||
Screen* screen = NULL;
|
Screen* screen = NULL;
|
||||||
|
|
||||||
// :sob:
|
// :sob:
|
||||||
if (/* _mc->useTouchscreen() */ true) {
|
if (_mc->options.getIntValue(OPTIONS_MENU_STYLE) == 0) {
|
||||||
switch (id) {
|
switch (id) {
|
||||||
case SCREEN_STARTMENU: screen = new Touch::StartMenuScreen(); break;
|
case SCREEN_STARTMENU: screen = new Touch::StartMenuScreen(); break;
|
||||||
case SCREEN_SELECTWORLD: screen = new Touch::SelectWorldScreen();break;
|
case SCREEN_SELECTWORLD: screen = new Touch::SelectWorldScreen();break;
|
||||||
|
|||||||
@@ -23,49 +23,62 @@
|
|||||||
|
|
||||||
// Some kind of default settings, might be overridden in ::init
|
// Some kind of default settings, might be overridden in ::init
|
||||||
StartMenuScreen::StartMenuScreen()
|
StartMenuScreen::StartMenuScreen()
|
||||||
: bHost( 2, 0, 0, 160, 24, "Start Game"),
|
|
||||||
bJoin( 3, 0, 0, 160, 24, "Join Game"),
|
|
||||||
bOptions( 4, 0, 0, 160, 24, "Options"),
|
|
||||||
bQuit( 5, "")
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
StartMenuScreen::~StartMenuScreen()
|
StartMenuScreen::~StartMenuScreen()
|
||||||
{
|
{
|
||||||
|
delete bHost;
|
||||||
|
delete bJoin;
|
||||||
|
delete bOptions;
|
||||||
|
delete bQuit;
|
||||||
}
|
}
|
||||||
|
|
||||||
void StartMenuScreen::init()
|
void StartMenuScreen::init()
|
||||||
{
|
{
|
||||||
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()) {
|
if (minecraft->options.getStringValue(OPTIONS_USERNAME).empty()) {
|
||||||
return; // tick() will redirect to UsernameScreen
|
return; // tick() will redirect to UsernameScreen
|
||||||
}
|
}
|
||||||
|
|
||||||
buttons.push_back(&bHost);
|
buttons.push_back(bHost);
|
||||||
buttons.push_back(&bJoin);
|
buttons.push_back(bJoin);
|
||||||
//buttons.push_back(&bTest);
|
//buttons.push_back(&bTest);
|
||||||
|
buttons.push_back(bQuit);
|
||||||
|
|
||||||
tabButtons.push_back(&bHost);
|
tabButtons.push_back(bHost);
|
||||||
tabButtons.push_back(&bJoin);
|
tabButtons.push_back(bJoin);
|
||||||
|
tabButtons.push_back(bQuit);
|
||||||
|
|
||||||
#ifndef RPI
|
#ifndef RPI
|
||||||
buttons.push_back(&bOptions);
|
buttons.push_back(bOptions);
|
||||||
tabButtons.push_back(&bOptions);
|
tabButtons.push_back(bOptions);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// add quit button (top right X icon) – match OptionsScreen style
|
//// add quit button (top right X icon) – match OptionsScreen style
|
||||||
{
|
//{
|
||||||
ImageDef def;
|
// ImageDef def;
|
||||||
def.name = "gui/touchgui.png";
|
// def.name = "gui/touchgui.png";
|
||||||
def.width = 34;
|
// def.width = 34;
|
||||||
def.height = 26;
|
// def.height = 26;
|
||||||
def.setSrc(IntRectangle(150, 0, (int)def.width, (int)def.height));
|
// def.setSrc(IntRectangle(150, 0, (int)def.width, (int)def.height));
|
||||||
bQuit.setImageDef(def, true);
|
// bQuit.setImageDef(def, true);
|
||||||
bQuit.scaleWhenPressed = false;
|
// bQuit.scaleWhenPressed = false;
|
||||||
buttons.push_back(&bQuit);
|
// buttons.push_back(&bQuit);
|
||||||
// don't include in tab navigation
|
// // don't include in tab navigation
|
||||||
}
|
//}
|
||||||
|
|
||||||
copyright = "\xffMojang AB";//. Do not distribute!";
|
copyright = "\xffMojang AB";//. Do not distribute!";
|
||||||
|
|
||||||
@@ -93,20 +106,30 @@ void StartMenuScreen::init()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void StartMenuScreen::setupPositions() {
|
void StartMenuScreen::setupPositions() {
|
||||||
int yBase = height / 2;
|
if (minecraft->options.getIntValue(OPTIONS_MENU_STYLE) == 2){
|
||||||
|
int yBase = (height / 2) - 20;
|
||||||
|
|
||||||
bHost.y = yBase;
|
bHost->y = yBase;
|
||||||
bJoin.y = bHost.y + 24 + 4;
|
bJoin->y = bHost->y + 24;
|
||||||
bOptions.y = bJoin.y + 24 + 4;
|
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
|
// Center buttons
|
||||||
bHost.x = (width - bHost.width) / 2;
|
bHost->x = (width - bHost->width) / 2;
|
||||||
bJoin.x = (width - bJoin.width) / 2;
|
bJoin->x = (width - bJoin->width) / 2;
|
||||||
bOptions.x = (width - bOptions.width) / 2;
|
bOptions->x = (width - bOptions->width) / 2;
|
||||||
|
bQuit->x = (width - bQuit->width) / 2;
|
||||||
|
|
||||||
// position quit icon at top-right (use image-defined size)
|
//// position quit icon at top-right (use image-defined size)
|
||||||
bQuit.x = width - bQuit.width;
|
//bQuit.x = width - bQuit.width;
|
||||||
bQuit.y = 0;
|
//bQuit.y = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void StartMenuScreen::tick() {
|
void StartMenuScreen::tick() {
|
||||||
@@ -114,7 +137,7 @@ void StartMenuScreen::tick() {
|
|||||||
|
|
||||||
void StartMenuScreen::buttonClicked(Button* button) {
|
void StartMenuScreen::buttonClicked(Button* button) {
|
||||||
|
|
||||||
if (button->id == bHost.id)
|
if (button->id == bHost->id)
|
||||||
{
|
{
|
||||||
#if defined(DEMO_MODE) || defined(APPLE_DEMO_PROMOTION)
|
#if defined(DEMO_MODE) || defined(APPLE_DEMO_PROMOTION)
|
||||||
minecraft->setScreen( new SimpleChooseLevelScreen("_DemoLevel") );
|
minecraft->setScreen( new SimpleChooseLevelScreen("_DemoLevel") );
|
||||||
@@ -122,16 +145,16 @@ void StartMenuScreen::buttonClicked(Button* button) {
|
|||||||
minecraft->screenChooser.setScreen(SCREEN_SELECTWORLD);
|
minecraft->screenChooser.setScreen(SCREEN_SELECTWORLD);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
if (button->id == bJoin.id)
|
if (button->id == bJoin->id)
|
||||||
{
|
{
|
||||||
minecraft->locateMultiplayer();
|
minecraft->locateMultiplayer();
|
||||||
minecraft->screenChooser.setScreen(SCREEN_JOINGAME);
|
minecraft->screenChooser.setScreen(SCREEN_JOINGAME);
|
||||||
}
|
}
|
||||||
if (button->id == bOptions.id)
|
if (button->id == bOptions->id)
|
||||||
{
|
{
|
||||||
minecraft->setScreen(new OptionsScreen());
|
minecraft->setScreen(new OptionsScreen());
|
||||||
}
|
}
|
||||||
if (button == &bQuit)
|
if (button->id == bQuit->id)
|
||||||
{
|
{
|
||||||
minecraft->quit();
|
minecraft->quit();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,10 +23,10 @@ public:
|
|||||||
bool isInGameScreen();
|
bool isInGameScreen();
|
||||||
private:
|
private:
|
||||||
|
|
||||||
Button bHost;
|
Button* bHost;
|
||||||
Button bJoin;
|
Button* bJoin;
|
||||||
Button bOptions;
|
Button* bOptions;
|
||||||
ImageButton bQuit; // X button in top-right corner
|
Button* bQuit;
|
||||||
|
|
||||||
std::string copyright;
|
std::string copyright;
|
||||||
int copyrightPosX;
|
int copyrightPosX;
|
||||||
|
|||||||
@@ -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();
|
||||||
|
|||||||
@@ -101,6 +101,15 @@ void GameRenderer::setupCamera(float a, int eye) {
|
|||||||
|
|
||||||
float stereoScale = 0.07f;
|
float stereoScale = 0.07f;
|
||||||
if (mc->options.getBooleanValue(OPTIONS_ANAGLYPH_3D)) glTranslatef2(-(eye * 2 - 1) * stereoScale, 0, 0);
|
if (mc->options.getBooleanValue(OPTIONS_ANAGLYPH_3D)) glTranslatef2(-(eye * 2 - 1) * stereoScale, 0, 0);
|
||||||
|
if (mc->options.getBooleanValue(OPTIONS_BETA_SKY)){
|
||||||
|
if (zoom != 1) {
|
||||||
|
glTranslatef2((float) zoom_x, (float) -zoom_y, 0);
|
||||||
|
glScalef2(zoom, zoom, 1);
|
||||||
|
gluPerspective(_setupCameraFov = getFov(a, true), mc->width / (float) mc->height, 0.05f, renderDistance * 2.0f);
|
||||||
|
} else {
|
||||||
|
gluPerspective(_setupCameraFov = getFov(a, true), mc->width / (float) mc->height, 0.05f, renderDistance * 2.0f);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
if (zoom != 1) {
|
if (zoom != 1) {
|
||||||
glTranslatef2((float) zoom_x, (float) -zoom_y, 0);
|
glTranslatef2((float) zoom_x, (float) -zoom_y, 0);
|
||||||
glScalef2(zoom, zoom, 1);
|
glScalef2(zoom, zoom, 1);
|
||||||
@@ -108,6 +117,7 @@ void GameRenderer::setupCamera(float a, int eye) {
|
|||||||
} else {
|
} else {
|
||||||
gluPerspective(_setupCameraFov = getFov(a, true), mc->width / (float) mc->height, 0.05f, renderDistance);
|
gluPerspective(_setupCameraFov = getFov(a, true), mc->width / (float) mc->height, 0.05f, renderDistance);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
glMatrixMode(GL_MODELVIEW);
|
glMatrixMode(GL_MODELVIEW);
|
||||||
glLoadIdentity2();
|
glLoadIdentity2();
|
||||||
@@ -337,12 +347,15 @@ 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);
|
||||||
glDepthMask(GL_FALSE);
|
glDepthMask(GL_FALSE); // @TODO commenting this out fixes Ice transparency and clouds are no longer visilbe underwater like normal beta - shredder
|
||||||
glDisable2(GL_ALPHA_TEST);
|
glDisable2(GL_ALPHA_TEST);
|
||||||
mc->textures->loadAndBindTexture("terrain.png");
|
mc->textures->loadAndBindTexture("terrain.png");
|
||||||
|
// @TODO - below is a commented out double render system that fixes ice transparency, but probs harm performance, add it as an option - shredder
|
||||||
|
|
||||||
//if (mc->options.fancyGraphics) {
|
//if (mc->options.fancyGraphics) {
|
||||||
// glColorMask(false, false, false, false);
|
// glColorMask(false, false, false, false);
|
||||||
// int visibleWaterChunks = levelRenderer->render(cameraEntity, 1, a);
|
// int visibleWaterChunks = levelRenderer->render(cameraEntity, 1, a);
|
||||||
@@ -677,7 +690,7 @@ void GameRenderer::pick(float a) {
|
|||||||
float range = mc->gameMode->getPickRange();
|
float range = mc->gameMode->getPickRange();
|
||||||
bool isPicking = true;
|
bool isPicking = true;
|
||||||
|
|
||||||
bool freeform = mc->useTouchscreen(); //&& !mc->options.getBooleanValue(OPTIONS_IS_JOY_TOUCH_AREA);
|
bool freeform = mc->useTouchscreen() && !mc->options.getBooleanValue(OPTIONS_IS_JOY_TOUCH_AREA);
|
||||||
|
|
||||||
if (freeform) {
|
if (freeform) {
|
||||||
isPicking = updateFreeformPickDirection(a, pickDirection);
|
isPicking = updateFreeformPickDirection(a, pickDirection);
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -26,6 +26,7 @@
|
|||||||
#include "../../client/player/LocalPlayer.h"
|
#include "../../client/player/LocalPlayer.h"
|
||||||
|
|
||||||
#include "../../world/level/GrassColor.h"
|
#include "../../world/level/GrassColor.h"
|
||||||
|
#include "Lighting.h"
|
||||||
|
|
||||||
#ifdef GFX_SMALLER_CHUNKS
|
#ifdef GFX_SMALLER_CHUNKS
|
||||||
/* static */ const int LevelRenderer::CHUNK_SIZE = 8;
|
/* static */ const int LevelRenderer::CHUNK_SIZE = 8;
|
||||||
@@ -575,7 +576,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.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
|
// t.offset(((Mob*)mc->player)->getPos(0).negated()); // why does this even exist normally, it just makes the thing... not render
|
||||||
|
glLineWidth(2.0f); // make it more thick - shredder
|
||||||
t.begin(GL_LINE_STRIP);
|
t.begin(GL_LINE_STRIP);
|
||||||
t.vertex(b.x0, b.y0, b.z0);
|
t.vertex(b.x0, b.y0, b.z0);
|
||||||
t.vertex(b.x1, b.y0, b.z0);
|
t.vertex(b.x1, b.y0, b.z0);
|
||||||
@@ -1157,23 +1158,22 @@ void LevelRenderer::renderSky(float alpha) {
|
|||||||
glDisable(GL_FOG);
|
glDisable(GL_FOG);
|
||||||
glDisable(GL_ALPHA_TEST);
|
glDisable(GL_ALPHA_TEST);
|
||||||
|
|
||||||
// thanks to the mcpe 0.1 decomp project a bit for this part, was not getting the gl states correctly, gles is painful - shredder
|
// re ported this again from beta 1.6.6, thanks to the mcpe 0.1 decomp team's code for some bit of help about the void layer - shredder
|
||||||
|
|
||||||
// Sunrise
|
// Sunrise
|
||||||
if (mc->options.getBooleanValue(OPTIONS_BEAUTIFUL_SKY)) {
|
if (mc->options.getBooleanValue(OPTIONS_BEAUTIFUL_SKY)) {
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
Lighting::turnOff();
|
||||||
float* c = level->dimension->getSunriseColor(level->getTimeOfDay(alpha), alpha);
|
float* c = level->dimension->getSunriseColor(level->getTimeOfDay(alpha), alpha);
|
||||||
if (c != nullptr)
|
if (c != nullptr)
|
||||||
{
|
{
|
||||||
glDisable(GL_TEXTURE_2D);
|
glDisable(GL_TEXTURE_2D);
|
||||||
|
// glShadeModel(GL_SMOOTH); //
|
||||||
|
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glRotatef(90.0f, 1.0f, 0.0f, 0.0f);
|
glRotatef(90.0f, 1.0f, 0.0f, 0.0f);
|
||||||
glRotatef(level->getTimeOfDay(alpha) > 0.5f ? 180 : 0, 0.0f, 0.0f, 1.0f);
|
glRotatef(level->getTimeOfDay(alpha) > 0.5f ? 180 : 0, 0.0f, 0.0f, 1.0f);
|
||||||
|
|
||||||
t.begin(GL_TRIANGLE_FAN);
|
t.begin(GL_TRIANGLE_FAN);
|
||||||
t.color(c[0], c[1], c[2], c[3]);
|
t.color(c[0], c[1], c[2], c[3]);
|
||||||
t.vertex(0.0f, 100.0f, 0.0f);
|
t.vertex(0.0f, 100.0f, 0.0f);
|
||||||
@@ -1190,11 +1190,12 @@ void LevelRenderer::renderSky(float alpha) {
|
|||||||
|
|
||||||
t.draw();
|
t.draw();
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
|
// glShadeModel(GL_FLAT); //
|
||||||
}
|
}
|
||||||
|
|
||||||
// gets the time of day and rotates the sun and moon png based on the time
|
// gets the time of day and rotates the sun and moon png based on the time
|
||||||
glEnable(GL_TEXTURE_2D);
|
glEnable(GL_TEXTURE_2D);
|
||||||
glBlendFunc(GL_ONE, GL_ONE);
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
|
|
||||||
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||||
@@ -1326,8 +1327,8 @@ void LevelRenderer::renderAdvancedClouds(float alpha) {
|
|||||||
|
|
||||||
float cloudTime = (float)ticks + alpha;
|
float cloudTime = (float)ticks + alpha;
|
||||||
|
|
||||||
double xo = (px + cloudTime * 0.03f) / ss;
|
float xo = (px + cloudTime * 0.03f) / ss;
|
||||||
double zo = pz / ss + 0.33f;
|
float zo = pz / ss + 0.33f;
|
||||||
|
|
||||||
float yy = 108.0f - py + 0.33f;
|
float yy = 108.0f - py + 0.33f;
|
||||||
|
|
||||||
|
|||||||
@@ -130,10 +130,11 @@ void EntityRenderer::postRender(Entity* entity, float x, float y, float z, float
|
|||||||
if (pow > 0) {
|
if (pow > 0) {
|
||||||
renderShadow(entity, x, y, z, pow, a);
|
renderShadow(entity, x, y, z, pow, a);
|
||||||
}
|
}
|
||||||
//}
|
|
||||||
if (entity->isOnFire()) renderFlame(entity, x, y, z, a);
|
|
||||||
}
|
}
|
||||||
|
if (entity->isOnFire()) renderFlame(entity, x, y, z, a);
|
||||||
}
|
}
|
||||||
|
// duplicate renderflame below is the pre b1.6.6 way flame rendered on player and mobs, probs gonna make it an option. - shredder
|
||||||
|
/*
|
||||||
void EntityRenderer::renderFlame(Entity* e, float x, float y, float z, float a) {
|
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;
|
||||||
@@ -179,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);
|
||||||
@@ -187,8 +257,12 @@ void EntityRenderer::renderShadow(Entity* e, float x, float y, float z, float po
|
|||||||
//Textures* textures = entityRenderDispatcher->textures;
|
//Textures* textures = entityRenderDispatcher->textures;
|
||||||
//textures->bind(textures->loadTexture("%clamp%/environment/shadow.png"));
|
//textures->bind(textures->loadTexture("%clamp%/environment/shadow.png"));
|
||||||
Textures* textures = entityRenderDispatcher->textures;
|
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);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Level* level = getLevel();
|
Level* level = getLevel();
|
||||||
@@ -221,14 +295,13 @@ 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);
|
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();
|
tt.draw();
|
||||||
|
|
||||||
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();
|
||||||
|
|||||||
@@ -393,8 +393,8 @@ void LavaSideTexture::tick() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FireTexture::FireTexture()
|
FireTexture::FireTexture(int id)
|
||||||
: super(((Tile*)Tile::fire)->tex),
|
: super(((Tile*)Tile::fire)->tex + id * 16),
|
||||||
_tick(0),
|
_tick(0),
|
||||||
_frame(0)
|
_frame(0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ class FireTexture: public DynamicTexture
|
|||||||
float* heata;
|
float* heata;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
FireTexture();
|
FireTexture(int id);
|
||||||
~FireTexture();
|
~FireTexture();
|
||||||
|
|
||||||
void tick();
|
void tick();
|
||||||
|
|||||||
@@ -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();
|
||||||
|
|||||||
@@ -51,13 +51,13 @@ void Chicken::aiStep()
|
|||||||
flap += flapping * 2;
|
flap += flapping * 2;
|
||||||
|
|
||||||
//@todo
|
//@todo
|
||||||
//if (!isBaby()) {
|
if (!isBaby()) {
|
||||||
// if (!level->isClientSide && --eggTime <= 0) {
|
if (!level->isClientSide && --eggTime <= 0) {
|
||||||
// level->playSound(this, "mob.chickenplop", 1.0f, (random.nextFloat() - random.nextFloat()) * 0.2f + 1.0f);
|
level->playSound(this, "mob.chickenplop", 1.0f, (random.nextFloat() - random.nextFloat()) * 0.2f + 1.0f);
|
||||||
// spawnAtLocation(Item::egg->id, 1);
|
spawnAtLocation(Item::egg->id, 1);
|
||||||
// eggTime = random.nextInt(SharedConstants::TicksPerSecond * 60 * 5) + SharedConstants::TicksPerSecond * 60 * 5;
|
eggTime = random.nextInt(SharedConstants::TicksPerSecond * 60 * 5) + SharedConstants::TicksPerSecond * 60 * 5;
|
||||||
// }
|
}
|
||||||
//}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Chicken::addAdditonalSaveData( CompoundTag* tag )
|
void Chicken::addAdditonalSaveData( CompoundTag* tag )
|
||||||
|
|||||||
@@ -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,7 +247,20 @@ 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