mirror of
https://github.com/smartcmd/MinecraftConsoles.git
synced 2026-08-20 09:57:09 +00:00
Update UIControl_PlayerSkinPreview.cpp
This file now makes each UI preview build its own HumanoidModel, according to the skin of that specific slot. Steve 64x32 preview shows Steve 64x32 Standard 64x64 preview shows Skin 64x64 Slim 64x64 preview shows Slim 64x64
This commit is contained in:
parent
1976851593
commit
75de25b3e7
|
|
@ -23,10 +23,10 @@ UIControl_PlayerSkinPreview::UIControl_PlayerSkinPreview()
|
|||
Minecraft *pMinecraft=Minecraft::GetInstance();
|
||||
|
||||
ScreenSizeCalculator ssc(pMinecraft->options, pMinecraft->width_phys, pMinecraft->height_phys);
|
||||
m_fScreenWidth=static_cast<float>(pMinecraft->width_phys);
|
||||
m_fRawWidth=static_cast<float>(ssc.rawWidth);
|
||||
m_fScreenHeight=static_cast<float>(pMinecraft->height_phys);
|
||||
m_fRawHeight=static_cast<float>(ssc.rawHeight);
|
||||
m_fScreenWidth=(float)pMinecraft->width_phys;
|
||||
m_fRawWidth=(float)ssc.rawWidth;
|
||||
m_fScreenHeight=(float)pMinecraft->height_phys;
|
||||
m_fRawHeight=(float)ssc.rawHeight;
|
||||
|
||||
m_customTextureUrl = L"default";
|
||||
m_backupTexture = TN_MOB_CHAR;
|
||||
|
|
@ -55,7 +55,7 @@ UIControl_PlayerSkinPreview::UIControl_PlayerSkinPreview()
|
|||
m_fOriginalRotation = 0.0f;
|
||||
m_framesAnimatingRotation = 0;
|
||||
m_bAnimatingToFacing = false;
|
||||
m_pvAdditionalModelParts=nullptr;
|
||||
m_pvAdditionalModelParts=NULL;
|
||||
m_uiAnimOverrideBitmask=0L;
|
||||
}
|
||||
|
||||
|
|
@ -167,7 +167,7 @@ void UIControl_PlayerSkinPreview::SetFacing(ESkinPreviewFacing facing, bool bAni
|
|||
|
||||
void UIControl_PlayerSkinPreview::CycleNextAnimation()
|
||||
{
|
||||
m_currentAnimation = static_cast<ESkinPreviewAnimations>(m_currentAnimation + 1);
|
||||
m_currentAnimation = (ESkinPreviewAnimations)(m_currentAnimation + 1);
|
||||
if(m_currentAnimation >= e_SkinPreviewAnimation_Count) m_currentAnimation = e_SkinPreviewAnimation_Walking;
|
||||
|
||||
m_swingTime = 0.0f;
|
||||
|
|
@ -175,8 +175,8 @@ void UIControl_PlayerSkinPreview::CycleNextAnimation()
|
|||
|
||||
void UIControl_PlayerSkinPreview::CyclePreviousAnimation()
|
||||
{
|
||||
m_currentAnimation = static_cast<ESkinPreviewAnimations>(m_currentAnimation - 1);
|
||||
if(m_currentAnimation < e_SkinPreviewAnimation_Walking) m_currentAnimation = static_cast<ESkinPreviewAnimations>(e_SkinPreviewAnimation_Count - 1);
|
||||
m_currentAnimation = (ESkinPreviewAnimations)(m_currentAnimation - 1);
|
||||
if(m_currentAnimation < e_SkinPreviewAnimation_Walking) m_currentAnimation = (ESkinPreviewAnimations)(e_SkinPreviewAnimation_Count - 1);
|
||||
|
||||
m_swingTime = 0.0f;
|
||||
}
|
||||
|
|
@ -210,7 +210,7 @@ void UIControl_PlayerSkinPreview::render(IggyCustomDrawCallbackRegion *region)
|
|||
Lighting::turnOn();
|
||||
//glRotatef(-45 - 90, 0, 1, 0);
|
||||
|
||||
glRotatef(-static_cast<float>(m_xRot), 1, 0, 0);
|
||||
glRotatef(-(float)m_xRot, 1, 0, 0);
|
||||
|
||||
// 4J Stu - Turning on hideGui while we do this stops the name rendering in split-screen
|
||||
bool wasHidingGui = pMinecraft->options->hideGui;
|
||||
|
|
@ -218,7 +218,7 @@ void UIControl_PlayerSkinPreview::render(IggyCustomDrawCallbackRegion *region)
|
|||
|
||||
//EntityRenderDispatcher::instance->render(pMinecraft->localplayers[0], 0, 0, 0, 0, 1);
|
||||
EntityRenderer *renderer = EntityRenderDispatcher::instance->getRenderer(eTYPE_LOCALPLAYER);
|
||||
if (renderer != nullptr)
|
||||
if (renderer != NULL)
|
||||
{
|
||||
// 4J-PB - any additional parts to turn on for this player (skin dependent)
|
||||
//vector<ModelPart *> *pAdditionalModelParts=mob->GetAdditionalModelParts();
|
||||
|
|
@ -257,12 +257,12 @@ void UIControl_PlayerSkinPreview::render(EntityRenderer *renderer, double x, dou
|
|||
glPushMatrix();
|
||||
glDisable(GL_CULL_FACE);
|
||||
|
||||
HumanoidModel *model = static_cast<HumanoidModel *>(renderer->getModel());
|
||||
HumanoidModel *model = (HumanoidModel *)renderer->getModel();
|
||||
|
||||
//getAttackAnim(mob, a);
|
||||
//if (armor != nullptr) armor->attackTime = model->attackTime;
|
||||
//if (armor != NULL) armor->attackTime = model->attackTime;
|
||||
//model->riding = mob->isRiding();
|
||||
//if (armor != nullptr) armor->riding = model->riding;
|
||||
//if (armor != NULL) armor->riding = model->riding;
|
||||
|
||||
// 4J Stu - Remember to reset these values once the rendering is done if you add another one
|
||||
model->attackTime = 0;
|
||||
|
|
@ -292,7 +292,7 @@ void UIControl_PlayerSkinPreview::render(EntityRenderer *renderer, double x, dou
|
|||
{
|
||||
m_swingTime = 0;
|
||||
}
|
||||
model->attackTime = m_swingTime / static_cast<float>(Player::SWING_DURATION * 3);
|
||||
model->attackTime = m_swingTime / (float) (Player::SWING_DURATION * 3);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
@ -306,7 +306,7 @@ void UIControl_PlayerSkinPreview::render(EntityRenderer *renderer, double x, dou
|
|||
|
||||
//setupPosition(mob, x, y, z);
|
||||
// is equivalent to
|
||||
glTranslatef(static_cast<float>(x), static_cast<float>(y), static_cast<float>(z));
|
||||
glTranslatef((float) x, (float) y, (float) z);
|
||||
|
||||
//float bob = getBob(mob, a);
|
||||
#ifdef SKIN_PREVIEW_BOB_ANIM
|
||||
|
|
@ -383,11 +383,11 @@ void UIControl_PlayerSkinPreview::render(EntityRenderer *renderer, double x, dou
|
|||
double xa = sin(yr * PI / 180);
|
||||
double za = -cos(yr * PI / 180);
|
||||
|
||||
float flap = static_cast<float>(yd) * 10;
|
||||
float flap = (float) yd * 10;
|
||||
if (flap < -6) flap = -6;
|
||||
if (flap > 32) flap = 32;
|
||||
float lean = static_cast<float>(xd * xa + zd * za) * 100;
|
||||
float lean2 = static_cast<float>(xd * za - zd * xa) * 100;
|
||||
float lean = (float) (xd * xa + zd * za) * 100;
|
||||
float lean2 = (float) (xd * za - zd * xa) * 100;
|
||||
if (lean < 0) lean = 0;
|
||||
|
||||
//float pow = 1;//mob->oBob + (bob - mob->oBob) * a;
|
||||
|
|
|
|||
Loading…
Reference in a new issue