mirror of
https://github.com/celisej567/mcpe.git
synced 2026-09-11 20:11:18 +03:00
* ItemInHandRenderer: Add dynamic hand.
* Options: Fix saving of a few options * PatchManager: Load patch options before regular options - this fixes a bug where the fancy grass option would be reset to false even if grass tint would be set to true.
This commit is contained in:
@@ -789,6 +789,8 @@ void Minecraft::update()
|
||||
|
||||
void Minecraft::init()
|
||||
{
|
||||
GetPatchManager()->LoadPatchData(platform()->getPatchData());
|
||||
|
||||
if (platform()->hasFileSystemAccess())
|
||||
m_options = new Options(m_externalStorageDir);
|
||||
else
|
||||
@@ -831,8 +833,6 @@ void Minecraft::init()
|
||||
FoliageColor::init(m_pPlatform->loadTexture("misc/foliagecolor.png", true));
|
||||
}
|
||||
|
||||
// Patch Manager
|
||||
GetPatchManager()->LoadPatchData(platform()->getPatchData());
|
||||
|
||||
m_pTextures->loadAndBindTexture(C_TERRAIN_NAME);
|
||||
GetPatchManager()->PatchTextures(platform(), TYPE_TERRAIN);
|
||||
|
||||
@@ -301,6 +301,7 @@ void OptionList::initDefaultMenu()
|
||||
OPTION(Render, m_bFancyGrass, "Fancy grass"); idxGrass = currentIndex; // renders colored grass side overlay
|
||||
OPTION(Render, m_bBiomeColors, "Biome colors"); idxBiome = currentIndex; // colors the grass based on the current biome
|
||||
OPTION(Boolean, m_bDontRenderGui, "Hide GUI");
|
||||
OPTION(Boolean, m_bDynamicHand, "Dynamic hand movement");
|
||||
OPTION(Boolean, m_bDebugText, "Debug text");
|
||||
}
|
||||
|
||||
|
||||
@@ -62,6 +62,7 @@ void Options::_initDefaultValues()
|
||||
m_bFancyGrass = false;
|
||||
m_bBiomeColors = false;
|
||||
m_bSplitControls = false;
|
||||
m_bDynamicHand = false;
|
||||
field_19 = 1;
|
||||
|
||||
// Win32 key codes are being used by default
|
||||
@@ -242,7 +243,7 @@ void Options::_load()
|
||||
else if (key == "ctrl_autojump")
|
||||
m_bAutoJump = readBool(value);
|
||||
else if (key == "ctrl_split")
|
||||
m_bFancyGraphics = readBool(value);
|
||||
m_bSplitControls = readBool(value);
|
||||
else if (key == "gfx_fancygraphics")
|
||||
m_bFancyGraphics = readBool(value);
|
||||
else if (key == "mp_server_visible_default")
|
||||
@@ -269,6 +270,16 @@ void Options::_load()
|
||||
m_bBiomeColors = false;
|
||||
}
|
||||
}
|
||||
else if (key == "gfx_hidegui")
|
||||
m_bDontRenderGui = readBool(value);
|
||||
else if (key == "gfx_thirdperson")
|
||||
m_bThirdPerson = readBool(value);
|
||||
else if (key == "gfx_3danaglyphs")
|
||||
m_bAnaglyphs = readBool(value);
|
||||
else if (key == "gfx_dynamichand")
|
||||
m_bDynamicHand = readBool(value);
|
||||
else if (key == "info_debugtext")
|
||||
m_bDebugText = readBool(value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -380,13 +391,18 @@ std::vector<std::string> Options::getOptionStrings()
|
||||
SO("ctrl_invertmouse", saveBool(m_bInvertMouse));
|
||||
SO("ctrl_autojump", saveBool(m_bAutoJump));
|
||||
SO("ctrl_split", saveBool(m_bSplitControls));
|
||||
SO("gfx_fancygraphics", saveBool(m_bFancyGraphics));
|
||||
SO("mp_server_visible_default", saveBool(m_bServerVisibleDefault));
|
||||
SO("gfx_fancygraphics", saveBool(m_bFancyGraphics));
|
||||
SO("gfx_smoothlighting", saveBool(m_bAmbientOcclusion));
|
||||
SO("gfx_hidegui", saveBool(m_bDontRenderGui));
|
||||
SO("gfx_thirdperson", saveBool(m_bThirdPerson));
|
||||
SO("gfx_3danaglyphs", saveBool(m_bAnaglyphs));
|
||||
SO("gfx_viewdistance", saveInt (m_iViewDistance));
|
||||
SO("gfx_blockoutlines", saveBool(m_bBlockOutlines));
|
||||
SO("gfx_fancygrass", saveBool(m_bFancyGrass));
|
||||
SO("gfx_biomecolors", saveBool(m_bBiomeColors));
|
||||
SO("gfx_dynamichand", saveBool(m_bDynamicHand));
|
||||
SO("info_debugtext", saveBool(m_bAutoJump));
|
||||
|
||||
return vec;
|
||||
}
|
||||
|
||||
@@ -129,6 +129,7 @@ public:
|
||||
bool m_bFancyGrass;
|
||||
bool m_bBiomeColors;
|
||||
bool m_bSplitControls;
|
||||
bool m_bDynamicHand;
|
||||
|
||||
public:
|
||||
struct Option
|
||||
|
||||
@@ -600,7 +600,10 @@ void GameRenderer::render(float f)
|
||||
field_80 = pMC->m_mouseHandler.m_delta.y;
|
||||
}
|
||||
|
||||
pMC->m_pLocalPlayer->turn(diff_field_84 * field_7C, diff_field_84 * multPitch * field_80);
|
||||
float yawDiff = diff_field_84 * field_7C;
|
||||
float pitchDiff = diff_field_84 * multPitch * field_80;
|
||||
m_pItemInHandRenderer->turn(yawDiff, pitchDiff);
|
||||
pMC->m_pLocalPlayer->turn(yawDiff, pitchDiff);
|
||||
}
|
||||
|
||||
int mouseX = int(Mouse::getX() * Gui::InvGuiScale);
|
||||
|
||||
@@ -17,6 +17,12 @@ ItemInHandRenderer::ItemInHandRenderer(Minecraft* pMC) :
|
||||
field_18 = 0;
|
||||
field_1C = 0.0f;
|
||||
field_20 = 0.0f;
|
||||
m_yawOffs = 0.0f;
|
||||
m_pitchOffs = 0.0f;
|
||||
m_yawOffsVel = 0.0f;
|
||||
m_pitchOffsVel = 0.0f;
|
||||
m_lastYawOffs = 0.0f;
|
||||
m_lastPitchOffs = 0.0f;
|
||||
}
|
||||
|
||||
// This and itemUsed are probably leftovers from Minecraft Classic
|
||||
@@ -163,9 +169,13 @@ void ItemInHandRenderer::render(float f)
|
||||
|
||||
float f1 = field_20 + (field_1C - field_20) * f;
|
||||
glPushMatrix();
|
||||
glRotatef(pLP->field_60 + (pLP->m_pitch - pLP->field_60) * f, 1.0f, 0.0f, 0.0f);
|
||||
glRotatef(pLP->field_5C + (pLP->m_yaw - pLP->field_5C) * f, 0.0f, 1.0f, 0.0f);
|
||||
glPopMatrix();//huh?
|
||||
//glRotatef(pLP->field_60 + (pLP->m_pitch - pLP->field_60) * f, 1.0f, 0.0f, 0.0f);
|
||||
//glRotatef(pLP->field_5C + (pLP->m_yaw - pLP->field_5C) * f, 0.0f, 1.0f, 0.0f);
|
||||
//glPopMatrix();//huh?
|
||||
|
||||
// @TODO: Change to Mth::Lerp when iOS port pulled!
|
||||
glRotatef(-Lerp(m_lastPitchOffs, m_pitchOffs, f), 1.0f, 0.0f, 0.0f);
|
||||
glRotatef(+Lerp(m_lastYawOffs, m_yawOffs, f), 0.0f, 1.0f, 0.0f);
|
||||
|
||||
float fBright = m_pMinecraft->m_pLevel->getBrightness(Mth::floor(pLP->m_pos.x), Mth::floor(pLP->m_pos.y), Mth::floor(pLP->m_pos.z));
|
||||
glColor4f(fBright, fBright, fBright, 1.0f);
|
||||
@@ -228,6 +238,7 @@ void ItemInHandRenderer::render(float f)
|
||||
glPopMatrix();
|
||||
}
|
||||
|
||||
glPopMatrix();
|
||||
glDisable(GL_RESCALE_NORMAL);
|
||||
}
|
||||
|
||||
@@ -313,10 +324,48 @@ void ItemInHandRenderer::tick()
|
||||
|
||||
field_1C += a;
|
||||
|
||||
if (m_pMinecraft->getOptions()->m_bDynamicHand)
|
||||
{
|
||||
m_lastYawOffs = m_yawOffs;
|
||||
m_lastPitchOffs = m_pitchOffs;
|
||||
|
||||
m_yawOffsVel *= 0.3f;
|
||||
m_pitchOffsVel *= 0.3f;
|
||||
|
||||
m_yawOffs *= 0.3f;
|
||||
m_pitchOffs *= 0.3f;
|
||||
|
||||
m_yawOffs += m_yawOffsVel;
|
||||
m_pitchOffs += m_pitchOffsVel;
|
||||
|
||||
if (m_yawOffs < 0.01f && m_yawOffs > -0.01f) m_yawOffs = 0.0f;
|
||||
if (m_yawOffsVel < 0.01f && m_yawOffsVel > -0.01f) m_yawOffsVel = 0.0f;
|
||||
if (m_pitchOffs < 0.01f && m_pitchOffs > -0.01f) m_pitchOffs = 0.0f;
|
||||
if (m_pitchOffsVel < 0.01f && m_pitchOffsVel > -0.01f) m_pitchOffsVel = 0.0f;
|
||||
|
||||
if (m_yawOffsVel > +2.0f) m_yawOffsVel = +2.0f;
|
||||
if (m_yawOffsVel < -2.0f) m_yawOffsVel = -2.0f;
|
||||
if (m_pitchOffsVel > +2.0f) m_pitchOffsVel = +2.0f;
|
||||
if (m_pitchOffsVel < -2.0f) m_pitchOffsVel = -2.0f;
|
||||
if (m_yawOffs > +10.0f) m_yawOffs = +10.0f;
|
||||
if (m_yawOffs < -10.0f) m_yawOffs = -10.0f;
|
||||
if (m_pitchOffs > +10.0f) m_pitchOffs = +10.0f;
|
||||
if (m_pitchOffs < -10.0f) m_pitchOffs = -10.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_yawOffs = m_pitchOffs = m_lastYawOffs = m_lastPitchOffs = m_yawOffsVel = m_pitchOffsVel = 0.0f;
|
||||
}
|
||||
if (field_1C < 0.1f)
|
||||
m_ItemInstance.m_itemID = itemID;
|
||||
}
|
||||
|
||||
void ItemInHandRenderer::turn(float yd, float pd)
|
||||
{
|
||||
m_yawOffsVel += yd * 0.15f;
|
||||
m_pitchOffsVel += pd * 0.15f;
|
||||
}
|
||||
|
||||
void ItemInHandRenderer::renderScreenEffect(float f)
|
||||
{
|
||||
glDisable(GL_ALPHA_TEST);
|
||||
|
||||
@@ -25,6 +25,7 @@ public:
|
||||
void renderFire(float f);
|
||||
void renderTex(float f, int tex);
|
||||
void tick();
|
||||
void turn(float yd, float pd);
|
||||
|
||||
public:
|
||||
int field_0;
|
||||
@@ -34,5 +35,11 @@ public:
|
||||
float field_1C;
|
||||
float field_20;
|
||||
TileRenderer m_tileRenderer;
|
||||
float m_yawOffsVel;
|
||||
float m_pitchOffsVel;
|
||||
float m_yawOffs;
|
||||
float m_pitchOffs;
|
||||
float m_lastYawOffs;
|
||||
float m_lastPitchOffs;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user