This commit is contained in:
AngelDev 2026-03-15 07:50:55 +00:00 committed by GitHub
commit 81e8de45b2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
174 changed files with 766 additions and 576 deletions

View file

@ -13,6 +13,9 @@
//#define SKIN_PREVIEW_BOB_ANIM //#define SKIN_PREVIEW_BOB_ANIM
#define SKIN_PREVIEW_WALKING_ANIM #define SKIN_PREVIEW_WALKING_ANIM
static const unsigned int ANIM_64x64_CLASSIC_SKIN = 0x00040000;
static const unsigned int ANIM_64x64_ALEX_SLIM_SKIN = 0x00080000;
UIControl_PlayerSkinPreview::UIControl_PlayerSkinPreview() UIControl_PlayerSkinPreview::UIControl_PlayerSkinPreview()
{ {
UIControl::setControlType(UIControl::ePlayerSkinPreview); UIControl::setControlType(UIControl::ePlayerSkinPreview);
@ -23,10 +26,10 @@ UIControl_PlayerSkinPreview::UIControl_PlayerSkinPreview()
Minecraft *pMinecraft=Minecraft::GetInstance(); Minecraft *pMinecraft=Minecraft::GetInstance();
ScreenSizeCalculator ssc(pMinecraft->options, pMinecraft->width_phys, pMinecraft->height_phys); ScreenSizeCalculator ssc(pMinecraft->options, pMinecraft->width_phys, pMinecraft->height_phys);
m_fScreenWidth=static_cast<float>(pMinecraft->width_phys); m_fScreenWidth=(float)pMinecraft->width_phys;
m_fRawWidth=static_cast<float>(ssc.rawWidth); m_fRawWidth=(float)ssc.rawWidth;
m_fScreenHeight=static_cast<float>(pMinecraft->height_phys); m_fScreenHeight=(float)pMinecraft->height_phys;
m_fRawHeight=static_cast<float>(ssc.rawHeight); m_fRawHeight=(float)ssc.rawHeight;
m_customTextureUrl = L"default"; m_customTextureUrl = L"default";
m_backupTexture = TN_MOB_CHAR; m_backupTexture = TN_MOB_CHAR;
@ -55,8 +58,61 @@ UIControl_PlayerSkinPreview::UIControl_PlayerSkinPreview()
m_fOriginalRotation = 0.0f; m_fOriginalRotation = 0.0f;
m_framesAnimatingRotation = 0; m_framesAnimatingRotation = 0;
m_bAnimatingToFacing = false; m_bAnimatingToFacing = false;
m_pvAdditionalModelParts=nullptr; m_pvAdditionalModelParts=NULL;
m_uiAnimOverrideBitmask=0L; m_uiAnimOverrideBitmask=0L;
m_pPreviewModel = NULL;
m_iPreviewModelType = HumanoidModel::ePlayerModel_Steve;
m_iPreviewTexWidth = 64;
m_iPreviewTexHeight = 32;
}
UIControl_PlayerSkinPreview::~UIControl_PlayerSkinPreview()
{
DestroyPreviewModel();
}
void UIControl_PlayerSkinPreview::DestroyPreviewModel()
{
if (m_pPreviewModel != NULL)
{
delete m_pPreviewModel;
m_pPreviewModel = NULL;
}
}
void UIControl_PlayerSkinPreview::RebuildPreviewModel()
{
int iWantedModelType = HumanoidModel::ePlayerModel_Steve;
int iWantedTexWidth = 64;
int iWantedTexHeight = 32;
if ((m_uiAnimOverrideBitmask & ANIM_64x64_ALEX_SLIM_SKIN) != 0)
{
iWantedModelType = HumanoidModel::ePlayerModel_Alex;
iWantedTexHeight = 64;
}
else if ((m_uiAnimOverrideBitmask & ANIM_64x64_CLASSIC_SKIN) != 0)
{
iWantedModelType = HumanoidModel::ePlayerModel_Steve;
iWantedTexHeight = 64;
}
if (m_pPreviewModel != NULL &&
m_iPreviewModelType == iWantedModelType &&
m_iPreviewTexWidth == iWantedTexWidth &&
m_iPreviewTexHeight == iWantedTexHeight)
{
return;
}
DestroyPreviewModel();
bool bSlim = (iWantedModelType == HumanoidModel::ePlayerModel_Alex);
m_pPreviewModel = new HumanoidModel(0.0f, 0.0f, iWantedTexWidth, iWantedTexHeight, bSlim);
m_iPreviewModelType = iWantedModelType;
m_iPreviewTexWidth = iWantedTexWidth;
m_iPreviewTexHeight = iWantedTexHeight;
} }
void UIControl_PlayerSkinPreview::tick() void UIControl_PlayerSkinPreview::tick()
@ -67,8 +123,6 @@ void UIControl_PlayerSkinPreview::tick()
{ {
++m_framesAnimatingRotation; ++m_framesAnimatingRotation;
m_yRot = m_fOriginalRotation + m_framesAnimatingRotation * ( (m_fTargetRotation - m_fOriginalRotation) / CHANGING_SKIN_FRAMES ); m_yRot = m_fOriginalRotation + m_framesAnimatingRotation * ( (m_fTargetRotation - m_fOriginalRotation) / CHANGING_SKIN_FRAMES );
//if(m_framesAnimatingRotation == CHANGING_SKIN_FRAMES) m_bAnimatingToFacing = false;
} }
else else
{ {
@ -114,9 +168,6 @@ void UIControl_PlayerSkinPreview::SetTexture(const wstring &url, TEXTURE_NAME ba
if(app.GetGameSettings(eGameSetting_CustomSkinAnim)==0 ) if(app.GetGameSettings(eGameSetting_CustomSkinAnim)==0 )
{ {
// We have a force animation for some skins (claptrap)
// 4J-PB - treat all the eAnim_Disable flags as a force anim
if((uiAnimOverrideBitmask & HumanoidModel::m_staticBitmaskIgnorePlayerCustomAnimSetting)!=0) if((uiAnimOverrideBitmask & HumanoidModel::m_staticBitmaskIgnorePlayerCustomAnimSetting)!=0)
{ {
m_uiAnimOverrideBitmask=uiAnimOverrideBitmask; m_uiAnimOverrideBitmask=uiAnimOverrideBitmask;
@ -132,6 +183,7 @@ void UIControl_PlayerSkinPreview::SetTexture(const wstring &url, TEXTURE_NAME ba
} }
m_pvAdditionalModelParts=app.GetAdditionalModelParts(app.getSkinIdFromPath(m_customTextureUrl)); m_pvAdditionalModelParts=app.GetAdditionalModelParts(app.getSkinIdFromPath(m_customTextureUrl));
RebuildPreviewModel();
} }
void UIControl_PlayerSkinPreview::SetFacing(ESkinPreviewFacing facing, bool bAnimate /*= false*/) void UIControl_PlayerSkinPreview::SetFacing(ESkinPreviewFacing facing, bool bAnimate /*= false*/)
@ -167,7 +219,7 @@ void UIControl_PlayerSkinPreview::SetFacing(ESkinPreviewFacing facing, bool bAni
void UIControl_PlayerSkinPreview::CycleNextAnimation() 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; if(m_currentAnimation >= e_SkinPreviewAnimation_Count) m_currentAnimation = e_SkinPreviewAnimation_Walking;
m_swingTime = 0.0f; m_swingTime = 0.0f;
@ -175,8 +227,8 @@ void UIControl_PlayerSkinPreview::CycleNextAnimation()
void UIControl_PlayerSkinPreview::CyclePreviousAnimation() void UIControl_PlayerSkinPreview::CyclePreviousAnimation()
{ {
m_currentAnimation = static_cast<ESkinPreviewAnimations>(m_currentAnimation - 1); m_currentAnimation = (ESkinPreviewAnimations)(m_currentAnimation - 1);
if(m_currentAnimation < e_SkinPreviewAnimation_Walking) m_currentAnimation = static_cast<ESkinPreviewAnimations>(e_SkinPreviewAnimation_Count - 1); if(m_currentAnimation < e_SkinPreviewAnimation_Walking) m_currentAnimation = (ESkinPreviewAnimations)(e_SkinPreviewAnimation_Count - 1);
m_swingTime = 0.0f; m_swingTime = 0.0f;
} }
@ -195,34 +247,22 @@ void UIControl_PlayerSkinPreview::render(IggyCustomDrawCallbackRegion *region)
float yo = height; float yo = height;
glTranslatef(xo, yo - 3.5f, 50.0f); glTranslatef(xo, yo - 3.5f, 50.0f);
//glTranslatef(120.0f, 294, 0.0f);
float ss; float ss;
// Base scale on height of this control
// Potentially we might want separate x & y scales here
ss = width / (m_fScreenWidth / m_fScreenHeight); ss = width / (m_fScreenWidth / m_fScreenHeight);
glScalef(-ss, ss, ss); glScalef(-ss, ss, ss);
glRotatef(180, 0, 0, 1); glRotatef(180, 0, 0, 1);
//glRotatef(45 + 90, 0, 1, 0);
Lighting::turnOn(); Lighting::turnOn();
//glRotatef(-45 - 90, 0, 1, 0); glRotatef(-(float)m_xRot, 1, 0, 0);
glRotatef(-static_cast<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; bool wasHidingGui = pMinecraft->options->hideGui;
pMinecraft->options->hideGui = true; pMinecraft->options->hideGui = true;
//EntityRenderDispatcher::instance->render(pMinecraft->localplayers[0], 0, 0, 0, 0, 1);
EntityRenderer *renderer = EntityRenderDispatcher::instance->getRenderer(eTYPE_LOCALPLAYER); 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();
if(m_pvAdditionalModelParts && m_pvAdditionalModelParts->size()!=0) if(m_pvAdditionalModelParts && m_pvAdditionalModelParts->size()!=0)
{ {
for(auto& pModelPart : *m_pvAdditionalModelParts) for(auto& pModelPart : *m_pvAdditionalModelParts)
@ -232,9 +272,7 @@ void UIControl_PlayerSkinPreview::render(IggyCustomDrawCallbackRegion *region)
} }
render(renderer,0,0,0,0,1); render(renderer,0,0,0,0,1);
//renderer->postRender(entity, x, y, z, rot, a);
// hide the additional parts
if(m_pvAdditionalModelParts && m_pvAdditionalModelParts->size()!=0) if(m_pvAdditionalModelParts && m_pvAdditionalModelParts->size()!=0)
{ {
for(auto& pModelPart : *m_pvAdditionalModelParts) for(auto& pModelPart : *m_pvAdditionalModelParts)
@ -251,20 +289,25 @@ void UIControl_PlayerSkinPreview::render(IggyCustomDrawCallbackRegion *region)
glDisable(GL_RESCALE_NORMAL); glDisable(GL_RESCALE_NORMAL);
} }
// 4J Stu - Modified version of MobRenderer::render that does not require an actual entity
void UIControl_PlayerSkinPreview::render(EntityRenderer *renderer, double x, double y, double z, float rot, float a) void UIControl_PlayerSkinPreview::render(EntityRenderer *renderer, double x, double y, double z, float rot, float a)
{ {
glPushMatrix(); glPushMatrix();
glDisable(GL_CULL_FACE); glDisable(GL_CULL_FACE);
HumanoidModel *model = static_cast<HumanoidModel *>(renderer->getModel()); HumanoidModel *model = m_pPreviewModel;
if (model == NULL)
{
RebuildPreviewModel();
model = m_pPreviewModel;
}
//getAttackAnim(mob, a); if (model == NULL)
//if (armor != nullptr) armor->attackTime = model->attackTime; {
//model->riding = mob->isRiding(); glEnable(GL_CULL_FACE);
//if (armor != nullptr) armor->riding = model->riding; glPopMatrix();
return;
}
// 4J Stu - Remember to reset these values once the rendering is done if you add another one
model->attackTime = 0; model->attackTime = 0;
model->sneaking = false; model->sneaking = false;
model->holdingRightHand = false; model->holdingRightHand = false;
@ -275,7 +318,6 @@ void UIControl_PlayerSkinPreview::render(EntityRenderer *renderer, double x, dou
model->eating_t = 0; model->eating_t = 0;
model->young = false; model->young = false;
model->riding = false; model->riding = false;
model->m_uiAnimOverrideBitmask = m_uiAnimOverrideBitmask; model->m_uiAnimOverrideBitmask = m_uiAnimOverrideBitmask;
if( !m_bAnimatingToFacing ) if( !m_bAnimatingToFacing )
@ -292,46 +334,36 @@ void UIControl_PlayerSkinPreview::render(EntityRenderer *renderer, double x, dou
{ {
m_swingTime = 0; m_swingTime = 0;
} }
model->attackTime = m_swingTime / static_cast<float>(Player::SWING_DURATION * 3); model->attackTime = m_swingTime / (float) (Player::SWING_DURATION * 3);
break; break;
default: default:
break; break;
}; };
} }
float bodyRot = m_yRot;
float headRot = m_yRot;
float headRotx = 0;
float bodyRot = m_yRot; //(mob->yBodyRotO + (mob->yBodyRot - mob->yBodyRotO) * a); glTranslatef((float) x, (float) y, (float) z);
float headRot = m_yRot; //(mob->yRotO + (mob->yRot - mob->yRotO) * a);
float headRotx = 0; //(mob->xRotO + (mob->xRot - mob->xRotO) * a);
//setupPosition(mob, x, y, z);
// is equivalent to
glTranslatef(static_cast<float>(x), static_cast<float>(y), static_cast<float>(z));
//float bob = getBob(mob, a);
#ifdef SKIN_PREVIEW_BOB_ANIM #ifdef SKIN_PREVIEW_BOB_ANIM
float bob = (m_bobTick + a)/2; float bob = (m_bobTick + a)/2;
++m_bobTick; ++m_bobTick;
if(m_bobTick>=360*2) m_bobTick = 0; if(m_bobTick>=360*2) m_bobTick = 0;
#else #else
float bob = 0.0f; float bob = 0.0f;
#endif #endif
//setupRotations(mob, bob, bodyRot, a);
// is equivalent to
glRotatef(180 - bodyRot, 0, 1, 0); glRotatef(180 - bodyRot, 0, 1, 0);
float _scale = 1 / 16.0f; float _scale = 1 / 16.0f;
glEnable(GL_RESCALE_NORMAL); glEnable(GL_RESCALE_NORMAL);
glScalef(-1, -1, 1); glScalef(-1, -1, 1);
//scale(mob, a);
// is equivalent to
float s = 15 / 16.0f; float s = 15 / 16.0f;
glScalef(s, s, s); glScalef(s, s, s);
// 4J - TomK - pull up character a bit more to make sure extra geo around feet doesn't cause rendering problems on PSVita
#ifdef __PSVITA__ #ifdef __PSVITA__
glTranslatef(0, -24 * _scale - 1.0f / 16.0f, 0); glTranslatef(0, -24 * _scale - 1.0f / 16.0f, 0);
#else #else
@ -356,43 +388,30 @@ void UIControl_PlayerSkinPreview::render(EntityRenderer *renderer, double x, dou
MemSect(0); MemSect(0);
glEnable(GL_ALPHA_TEST); glEnable(GL_ALPHA_TEST);
//model->prepareMobModel(mob, wp, ws, a);
model->render(nullptr, wp, ws, bob, headRot - bodyRot, headRotx, _scale, true); model->render(nullptr, wp, ws, bob, headRot - bodyRot, headRotx, _scale, true);
/*for (int i = 0; i < MAX_ARMOR_LAYERS; i++)
{
if (prepareArmor(mob, i, a))
{
armor->render(wp, ws, bob, headRot - bodyRot, headRotx, _scale, true);
glDisable(GL_BLEND);
glEnable(GL_ALPHA_TEST);
}
}*/
//additionalRendering(mob, a);
if (bindTexture(m_capeTextureUrl, L"" )) if (bindTexture(m_capeTextureUrl, L"" ))
{ {
glPushMatrix(); glPushMatrix();
glTranslatef(0, 0, 2 / 16.0f); glTranslatef(0, 0, 2 / 16.0f);
double xd = 0;//(mob->xCloakO + (mob->xCloak - mob->xCloakO) * a) - (mob->xo + (mob->x - mob->xo) * a); double xd = 0;
double yd = 0;//(mob->yCloakO + (mob->yCloak - mob->yCloakO) * a) - (mob->yo + (mob->y - mob->yo) * a); double yd = 0;
double zd = 0;//(mob->zCloakO + (mob->zCloak - mob->zCloakO) * a) - (mob->zo + (mob->z - mob->zo) * a); double zd = 0;
float yr = 1;//mob->yBodyRotO + (mob->yBodyRot - mob->yBodyRotO) * a; float yr = 1;
double xa = sin(yr * PI / 180); double xa = sin(yr * PI / 180);
double za = -cos(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 < -6) flap = -6;
if (flap > 32) flap = 32; if (flap > 32) flap = 32;
float lean = static_cast<float>(xd * xa + zd * za) * 100; float lean = (float) (xd * xa + zd * za) * 100;
float lean2 = static_cast<float>(xd * za - zd * xa) * 100; float lean2 = (float) (xd * za - zd * xa) * 100;
if (lean < 0) lean = 0; if (lean < 0) lean = 0;
//float pow = 1;//mob->oBob + (bob - mob->oBob) * a; flap += 1;
flap += 1;//sin((mob->walkDistO + (mob->walkDist - mob->walkDistO) * a) * 6) * 32 * pow;
if (model->sneaking) if (model->sneaking)
{ {
flap += 25; flap += 25;
@ -405,69 +424,14 @@ void UIControl_PlayerSkinPreview::render(EntityRenderer *renderer, double x, dou
model->renderCloak(1 / 16.0f,true); model->renderCloak(1 / 16.0f,true);
glPopMatrix(); glPopMatrix();
} }
/*
float br = mob->getBrightness(a);
int overlayColor = getOverlayColor(mob, br, a);
if (((overlayColor >> 24) & 0xff) > 0 || mob->hurtTime > 0 || mob->deathTime > 0)
{
glDisable(GL_TEXTURE_2D);
glDisable(GL_ALPHA_TEST);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glDepthFunc(GL_EQUAL);
// 4J - changed these renders to not use the compiled version of their models, because otherwise the render states set
// about (in particular the depth & alpha test) don't work with our command buffer versions
if (mob->hurtTime > 0 || mob->deathTime > 0)
{
glColor4f(br, 0, 0, 0.4f);
model->render(wp, ws, bob, headRot - bodyRot, headRotx, _scale, false);
for (int i = 0; i < MAX_ARMOR_LAYERS; i++)
{
if (prepareArmorOverlay(mob, i, a))
{
glColor4f(br, 0, 0, 0.4f);
armor->render(wp, ws, bob, headRot - bodyRot, headRotx, _scale, false);
}
}
}
if (((overlayColor >> 24) & 0xff) > 0)
{
float r = ((overlayColor >> 16) & 0xff) / 255.0f;
float g = ((overlayColor >> 8) & 0xff) / 255.0f;
float b = ((overlayColor) & 0xff) / 255.0f;
float aa = ((overlayColor >> 24) & 0xff) / 255.0f;
glColor4f(r, g, b, aa);
model->render(wp, ws, bob, headRot - bodyRot, headRotx, _scale, false);
for (int i = 0; i < MAX_ARMOR_LAYERS; i++)
{
if (prepareArmorOverlay(mob, i, a))
{
glColor4f(r, g, b, aa);
armor->render(wp, ws, bob, headRot - bodyRot, headRotx, _scale, false);
}
}
}
glDepthFunc(GL_LEQUAL);
glDisable(GL_BLEND);
glEnable(GL_ALPHA_TEST);
glEnable(GL_TEXTURE_2D);
}
*/
glDisable(GL_RESCALE_NORMAL); glDisable(GL_RESCALE_NORMAL);
glEnable(GL_CULL_FACE); glEnable(GL_CULL_FACE);
glPopMatrix(); glPopMatrix();
MemSect(31); MemSect(31);
//renderName(mob, x, y, z);
MemSect(0); MemSect(0);
// Reset the model values to stop the changes we made here affecting anything in game (like the player hand render)
model->attackTime = 0; model->attackTime = 0;
model->sneaking = false; model->sneaking = false;
model->holdingRightHand = false; model->holdingRightHand = false;
@ -477,10 +441,6 @@ void UIControl_PlayerSkinPreview::render(EntityRenderer *renderer, double x, dou
bool UIControl_PlayerSkinPreview::bindTexture(const wstring& urlTexture, int backupTexture) bool UIControl_PlayerSkinPreview::bindTexture(const wstring& urlTexture, int backupTexture)
{ {
Textures *t = Minecraft::GetInstance()->textures; Textures *t = Minecraft::GetInstance()->textures;
// 4J-PB - no http textures on the xbox, mem textures instead
//int id = t->loadHttpTexture(urlTexture, backupTexture);
int id = t->loadMemTexture(urlTexture, backupTexture); int id = t->loadMemTexture(urlTexture, backupTexture);
if (id >= 0) if (id >= 0)
@ -497,10 +457,6 @@ bool UIControl_PlayerSkinPreview::bindTexture(const wstring& urlTexture, int bac
bool UIControl_PlayerSkinPreview::bindTexture(const wstring& urlTexture, const wstring& backupTexture) bool UIControl_PlayerSkinPreview::bindTexture(const wstring& urlTexture, const wstring& backupTexture)
{ {
Textures *t = Minecraft::GetInstance()->textures; Textures *t = Minecraft::GetInstance()->textures;
// 4J-PB - no http textures on the xbox, mem textures instead
//int id = t->loadHttpTexture(urlTexture, backupTexture);
int id = t->loadMemTexture(urlTexture, backupTexture); int id = t->loadMemTexture(urlTexture, backupTexture);
if (id >= 0) if (id >= 0)

View file

@ -5,6 +5,7 @@
class ModelPart; class ModelPart;
class EntityRenderer; class EntityRenderer;
class HumanoidModel;
class UIControl_PlayerSkinPreview : public UIControl class UIControl_PlayerSkinPreview : public UIControl
{ {
@ -51,8 +52,12 @@ private:
float m_swingTime; float m_swingTime;
ESkinPreviewAnimations m_currentAnimation; ESkinPreviewAnimations m_currentAnimation;
//vector<Model::SKIN_BOX *> *m_pvAdditionalBoxes;
vector<ModelPart *> *m_pvAdditionalModelParts; vector<ModelPart *> *m_pvAdditionalModelParts;
HumanoidModel *m_pPreviewModel;
int m_iPreviewModelType;
int m_iPreviewTexWidth;
int m_iPreviewTexHeight;
public: public:
enum ESkinPreviewFacing enum ESkinPreviewFacing
{ {
@ -62,6 +67,7 @@ public:
}; };
UIControl_PlayerSkinPreview(); UIControl_PlayerSkinPreview();
virtual ~UIControl_PlayerSkinPreview();
virtual void tick(); virtual void tick();
@ -87,4 +93,6 @@ private:
void render(EntityRenderer *renderer, double x, double y, double z, float rot, float a); void render(EntityRenderer *renderer, double x, double y, double z, float rot, float a);
bool bindTexture(const wstring& urlTexture, int backupTexture); bool bindTexture(const wstring& urlTexture, int backupTexture);
bool bindTexture(const wstring& urlTexture, const wstring& backupTexture); bool bindTexture(const wstring& urlTexture, const wstring& backupTexture);
void RebuildPreviewModel();
void DestroyPreviewModel();
}; };

View file

@ -8,27 +8,27 @@
ModelPart * HumanoidModel::AddOrRetrievePart(SKIN_BOX *pBox) ModelPart * HumanoidModel::AddOrRetrievePart(SKIN_BOX *pBox)
{ {
ModelPart *pAttachTo=nullptr; ModelPart *pAttachTo = NULL;
switch(pBox->ePart) switch(pBox->ePart)
{ {
case eBodyPart_Head: case eBodyPart_Head:
pAttachTo=head; pAttachTo = head;
break; break;
case eBodyPart_Body: case eBodyPart_Body:
pAttachTo=body; pAttachTo = body;
break; break;
case eBodyPart_Arm0: case eBodyPart_Arm0:
pAttachTo=arm0; pAttachTo = arm0;
break; break;
case eBodyPart_Arm1: case eBodyPart_Arm1:
pAttachTo=arm1; pAttachTo = arm1;
break; break;
case eBodyPart_Leg0: case eBodyPart_Leg0:
pAttachTo=leg0; pAttachTo = leg0;
break; break;
case eBodyPart_Leg1: case eBodyPart_Leg1:
pAttachTo=leg1; pAttachTo = leg1;
break; break;
} }
@ -37,35 +37,42 @@ ModelPart * HumanoidModel::AddOrRetrievePart(SKIN_BOX *pBox)
if(pNewBox) if(pNewBox)
{ {
if((pNewBox->getfU()!=static_cast<int>(pBox->fU)) || (pNewBox->getfV()!=static_cast<int>(pBox->fV))) if((pNewBox->getfU() != (int)pBox->fU) || (pNewBox->getfV() != (int)pBox->fV))
{ {
app.DebugPrintf("HumanoidModel::AddOrRetrievePart - Box geometry was found, but with different uvs\n"); app.DebugPrintf("HumanoidModel::AddOrRetrievePart - Box geometry was found, but with different uvs\n");
pNewBox=nullptr; pNewBox = NULL;
} }
} }
if(pNewBox==nullptr) if(pNewBox == NULL)
{ {
//app.DebugPrintf("HumanoidModel::AddOrRetrievePart - Adding box to model part\n"); pNewBox = new ModelPart(this, (int)pBox->fU, (int)pBox->fV);
pNewBox->visible = false;
pNewBox = new ModelPart(this, static_cast<int>(pBox->fU), static_cast<int>(pBox->fV));
pNewBox->visible=false;
pNewBox->addHumanoidBox(pBox->fX, pBox->fY, pBox->fZ, pBox->fW, pBox->fH, pBox->fD, 0); pNewBox->addHumanoidBox(pBox->fX, pBox->fY, pBox->fZ, pBox->fW, pBox->fH, pBox->fD, 0);
// 4J-PB - don't compile here, since the lighting isn't set up. It'll be compiled on first use.
//pNewBox->compile(1.0f/16.0f);
pAttachTo->addChild(pNewBox); pAttachTo->addChild(pNewBox);
} }
return pNewBox; return pNewBox;
} }
void HumanoidModel::_init(float g, float yOffset, int texWidth, int texHeight) void HumanoidModel::_init(float g, float yOffset, int texWidth, int texHeight, bool slimArms)
{ {
isSlimArms = slimArms;
m_ePlayerModelType = slimArms ? ePlayerModel_Alex : ePlayerModel_Steve;
this->texWidth = texWidth; this->texWidth = texWidth;
this->texHeight = texHeight; this->texHeight = texHeight;
m_fYOffset=yOffset; m_fYOffset = yOffset;
hasLayer2 = (texWidth == 64 && texHeight == 64);
bodyWear = NULL;
arm0Wear = NULL;
arm1Wear = NULL;
leg0Wear = NULL;
leg1Wear = NULL;
cloak = new ModelPart(this, 0, 0); cloak = new ModelPart(this, 0, 0);
cloak->addHumanoidBox(-5, -0, -1, 10, 16, 1, g); // Cloak cloak->addHumanoidBox(-5, 0, -1, 10, 16, 1, g); // Cloak
ear = new ModelPart(this, 24, 0); ear = new ModelPart(this, 24, 0);
ear->addHumanoidBox(-3, -6, -1, 6, 6, 1, g); // Ear ear->addHumanoidBox(-3, -6, -1, 6, 6, 1, g); // Ear
@ -75,76 +82,145 @@ void HumanoidModel::_init(float g, float yOffset, int texWidth, int texHeight)
head->setPos(0, 0 + yOffset, 0); head->setPos(0, 0 + yOffset, 0);
hair = new ModelPart(this, 32, 0); hair = new ModelPart(this, 32, 0);
hair->addHumanoidBox(-4, -8, -4, 8, 8, 8, g + 0.5f); // Head hair->addHumanoidBox(-4, -8, -4, 8, 8, 8, g + 0.5f); // Head overlay
hair->setPos(0, 0 + yOffset, 0); hair->setPos(0, 0 + yOffset, 0);
body = new ModelPart(this, 16, 16); body = new ModelPart(this, 16, 16);
body->addHumanoidBox(-4, 0, -2, 8, 12, 4, g); // Body body->addHumanoidBox(-4, 0, -2, 8, 12, 4, g); // Body
body->setPos(0, 0 + yOffset, 0); body->setPos(0, 0 + yOffset, 0);
arm0 = new ModelPart(this, 24 + 16, 16); arm0 = new ModelPart(this, 40, 16);
arm0->addHumanoidBox(-3, -2, -2, 4, 12, 4, g); // Arm0 arm1 = new ModelPart(this, 40, 16);
arm0->setPos(-5, 2 + yOffset, 0);
arm1 = new ModelPart(this, 24 + 16, 16); if (isSlimArms)
arm1->bMirror = true; {
arm1->addHumanoidBox(-1, -2, -2, 4, 12, 4, g); // Arm1 // Alex
arm1->setPos(5, 2 + yOffset, 0); arm0->addHumanoidBox(-2, -2, -2, 3, 12, 4, g);
arm0->setPos(-5.0f, 2.0f + yOffset, 0.0f);
arm1->mirror();
arm1->addHumanoidBox(-1, -2, -2, 3, 12, 4, g);
arm1->setPos(5.0f, 2.0f + yOffset, 0.0f);
}
else
{
// Steve
arm0->addHumanoidBox(-3, -2, -2, 4, 12, 4, g);
arm0->setPos(-5.0f, 2.0f + yOffset, 0.0f);
arm1->mirror();
arm1->addHumanoidBox(-1, -2, -2, 4, 12, 4, g);
arm1->setPos(5.0f, 2.0f + yOffset, 0.0f);
}
leg0 = new ModelPart(this, 0, 16); leg0 = new ModelPart(this, 0, 16);
leg0->addHumanoidBox(-2, 0, -2, 4, 12, 4, g); // Leg0 leg0->addHumanoidBox(-2, 0, -2, 4, 12, 4, g); // Leg0
leg0->setPos(-1.9, 12 + yOffset, 0); leg0->setPos(-1.9f, 12 + yOffset, 0);
leg1 = new ModelPart(this, 0, 16); leg1 = new ModelPart(this, 0, 16);
leg1->bMirror = true; leg1->bMirror = true;
leg1->addHumanoidBox(-2, 0, -2, 4, 12, 4, g); // Leg1 leg1->addHumanoidBox(-2, 0, -2, 4, 12, 4, g); // Leg1
leg1->setPos(1.9, 12 + yOffset, 0); leg1->setPos(1.9f, 12 + yOffset, 0);
// 4J added - compile now to avoid random performance hit first time cubes are rendered // second layer / wear layer only for 64x64 skins
// 4J Stu - Not just performance, but alpha+depth tests don't work right unless we compile here if (hasLayer2)
cloak->compile(1.0f/16.0f); {
ear->compile(1.0f/16.0f); bodyWear = new ModelPart(this, 16, 32);
head->compile(1.0f/16.0f); bodyWear->addHumanoidBox(-4, 0, -2, 8, 12, 4, g + 0.25f);
body->compile(1.0f/16.0f); bodyWear->setPos(0.0f, 0.0f + yOffset, 0.0f);
arm0->compile(1.0f/16.0f);
arm1->compile(1.0f/16.0f);
leg0->compile(1.0f/16.0f);
leg1->compile(1.0f/16.0f);
hair->compile(1.0f/16.0f);
holdingLeftHand=0; arm0Wear = new ModelPart(this, 40, 32);
holdingRightHand=0; arm1Wear = new ModelPart(this, 40, 32);
sneaking=false;
idle=false; if (isSlimArms)
bowAndArrow=false; {
arm0Wear->addHumanoidBox(-2, -2, -2, 3, 12, 4, g + 0.25f);
arm0Wear->setPos(-5.0f, 2.0f + yOffset, 0.0f);
arm1Wear->mirror();
arm1Wear->addHumanoidBox(-1, -2, -2, 3, 12, 4, g + 0.25f);
arm1Wear->setPos(5.0f, 2.0f + yOffset, 0.0f);
}
else
{
arm0Wear->addHumanoidBox(-3, -2, -2, 4, 12, 4, g + 0.25f);
arm0Wear->setPos(-5.0f, 2.0f + yOffset, 0.0f);
arm1Wear->mirror();
arm1Wear->addHumanoidBox(-1, -2, -2, 4, 12, 4, g + 0.25f);
arm1Wear->setPos(5.0f, 2.0f + yOffset, 0.0f);
}
leg0Wear = new ModelPart(this, 0, 32);
leg0Wear->addHumanoidBox(-2, 0, -2, 4, 12, 4, g + 0.25f);
leg0Wear->setPos(-1.9f, 12.0f + yOffset, 0.0f);
leg1Wear = new ModelPart(this, 0, 48);
leg1Wear->mirror();
leg1Wear->addHumanoidBox(-2, 0, -2, 4, 12, 4, g + 0.25f);
leg1Wear->setPos(1.9f, 12.0f + yOffset, 0.0f);
}
// compile now to avoid first-render hitch
cloak->compile(1.0f / 16.0f);
ear->compile(1.0f / 16.0f);
head->compile(1.0f / 16.0f);
body->compile(1.0f / 16.0f);
arm0->compile(1.0f / 16.0f);
arm1->compile(1.0f / 16.0f);
leg0->compile(1.0f / 16.0f);
leg1->compile(1.0f / 16.0f);
hair->compile(1.0f / 16.0f);
if(bodyWear) bodyWear->compile(1.0f / 16.0f);
if(arm0Wear) arm0Wear->compile(1.0f / 16.0f);
if(arm1Wear) arm1Wear->compile(1.0f / 16.0f);
if(leg0Wear) leg0Wear->compile(1.0f / 16.0f);
if(leg1Wear) leg1Wear->compile(1.0f / 16.0f);
holdingLeftHand = 0;
holdingRightHand = 0;
sneaking = false;
idle = false;
bowAndArrow = false;
// 4J added
eating = false; eating = false;
eating_t = 0.0f; eating_t = 0.0f;
eating_swing = 0.0f; eating_swing = 0.0f;
m_uiAnimOverrideBitmask = 0L; m_uiAnimOverrideBitmask = 0L;
} }
HumanoidModel::HumanoidModel() : Model() HumanoidModel::HumanoidModel()
{ {
_init(0, 0, 64, 32); _init(0.0f, 0.0f, 64, 32, false);
} }
HumanoidModel::HumanoidModel(float g) : Model() HumanoidModel::HumanoidModel(float g)
{ {
_init(g, 0, 64, 32); _init(g, 0.0f, 64, 32, false);
} }
HumanoidModel::HumanoidModel(float g, float yOffset, int texWidth, int texHeight) : Model() HumanoidModel::HumanoidModel(float g, float yOffset, int texWidth, int texHeight)
{ {
_init(g,yOffset,texWidth,texHeight); _init(g, yOffset, texWidth, texHeight, false);
}
HumanoidModel::HumanoidModel(float g, float yOffset, int texWidth, int texHeight, bool slimArms)
{
_init(g, yOffset, texWidth, texHeight, slimArms);
}
void HumanoidModel::setPlayerModelType(int type)
{
m_ePlayerModelType = type;
isSlimArms = (type == ePlayerModel_Alex);
} }
void HumanoidModel::render(shared_ptr<Entity> entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) void HumanoidModel::render(shared_ptr<Entity> entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled)
{ {
if(entity != nullptr) if(entity != NULL)
{ {
m_uiAnimOverrideBitmask=entity->getAnimOverrideBitmask(); m_uiAnimOverrideBitmask = entity->getAnimOverrideBitmask();
} }
setupAnim(time, r, bob, yRot, xRot, scale, entity, m_uiAnimOverrideBitmask); setupAnim(time, r, bob, yRot, xRot, scale, entity, m_uiAnimOverrideBitmask);
@ -152,11 +228,14 @@ void HumanoidModel::render(shared_ptr<Entity> entity, float time, float r, float
if (young) if (young)
{ {
float ss = 2.0f; float ss = 2.0f;
glPushMatrix(); glPushMatrix();
glScalef(1.5f / ss, 1.5f / ss, 1.5f / ss); glScalef(1.5f / ss, 1.5f / ss, 1.5f / ss);
glTranslatef(0, 16 * scale, 0); glTranslatef(0, 16 * scale, 0);
head->render(scale, usecompiled); head->render(scale, usecompiled);
hair->render(scale, usecompiled);
glPopMatrix(); glPopMatrix();
glPushMatrix(); glPushMatrix();
glScalef(1 / ss, 1 / ss, 1 / ss); glScalef(1 / ss, 1 / ss, 1 / ss);
glTranslatef(0, 24 * scale, 0); glTranslatef(0, 24 * scale, 0);
@ -165,304 +244,335 @@ void HumanoidModel::render(shared_ptr<Entity> entity, float time, float r, float
arm1->render(scale, usecompiled); arm1->render(scale, usecompiled);
leg0->render(scale, usecompiled); leg0->render(scale, usecompiled);
leg1->render(scale, usecompiled); leg1->render(scale, usecompiled);
hair->render(scale, usecompiled);
if(bodyWear) bodyWear->render(scale, usecompiled);
if(arm0Wear) arm0Wear->render(scale, usecompiled);
if(arm1Wear) arm1Wear->render(scale, usecompiled);
if(leg0Wear) leg0Wear->render(scale, usecompiled);
if(leg1Wear) leg1Wear->render(scale, usecompiled);
glPopMatrix(); glPopMatrix();
} }
else else
{ {
head->render(scale, usecompiled,(m_uiAnimOverrideBitmask&(1<<eAnim_DisableRenderHead))>0); head->render(scale, usecompiled, (m_uiAnimOverrideBitmask & (1 << eAnim_DisableRenderHead)) > 0);
body->render(scale, usecompiled,(m_uiAnimOverrideBitmask&(1<<eAnim_DisableRenderTorso))>0); body->render(scale, usecompiled, (m_uiAnimOverrideBitmask & (1 << eAnim_DisableRenderTorso)) > 0);
arm0->render(scale, usecompiled,(m_uiAnimOverrideBitmask&(1<<eAnim_DisableRenderArm0))>0); arm0->render(scale, usecompiled, (m_uiAnimOverrideBitmask & (1 << eAnim_DisableRenderArm0)) > 0);
arm1->render(scale, usecompiled,(m_uiAnimOverrideBitmask&(1<<eAnim_DisableRenderArm1))>0); arm1->render(scale, usecompiled, (m_uiAnimOverrideBitmask & (1 << eAnim_DisableRenderArm1)) > 0);
leg0->render(scale, usecompiled,(m_uiAnimOverrideBitmask&(1<<eAnim_DisableRenderLeg0))>0); leg0->render(scale, usecompiled, (m_uiAnimOverrideBitmask & (1 << eAnim_DisableRenderLeg0)) > 0);
leg1->render(scale, usecompiled,(m_uiAnimOverrideBitmask&(1<<eAnim_DisableRenderLeg1))>0); leg1->render(scale, usecompiled, (m_uiAnimOverrideBitmask & (1 << eAnim_DisableRenderLeg1)) > 0);
hair->render(scale, usecompiled,(m_uiAnimOverrideBitmask&(1<<eAnim_DisableRenderHair))>0); hair->render(scale, usecompiled, (m_uiAnimOverrideBitmask & (1 << eAnim_DisableRenderHair)) > 0);
if(bodyWear) bodyWear->render(scale, usecompiled);
if(arm0Wear) arm0Wear->render(scale, usecompiled);
if(arm1Wear) arm1Wear->render(scale, usecompiled);
if(leg0Wear) leg0Wear->render(scale, usecompiled);
if(leg1Wear) leg1Wear->render(scale, usecompiled);
} }
} }
void HumanoidModel::setupAnim(float time, float r, float bob, float yRot, float xRot, float scale, shared_ptr<Entity> entity, unsigned int uiBitmaskOverrideAnim) void HumanoidModel::setupAnim(float time, float r, float bob, float yRot, float xRot, float scale, shared_ptr<Entity> entity, unsigned int uiBitmaskOverrideAnim)
{ {
//bool bIsAttacking = (attackTime > -9990.0f); head->yRot = yRot / (float)(180.0f / PI);
head->xRot = xRot / (float)(180.0f / PI);
hair->yRot = head->yRot;
hair->xRot = head->xRot;
body->z = 0.0f;
// Does the skin have an override for anim?
if(uiBitmaskOverrideAnim & (1 << eAnim_ArmsDown))
{ {
head->yRot = yRot / (float) (180.0f / PI); arm0->xRot = 0.0f;
head->xRot = xRot / (float) (180.0f / PI); arm1->xRot = 0.0f;
hair->yRot = head->yRot; arm0->zRot = 0.0f;
hair->xRot = head->xRot; arm1->zRot = 0.0f;
body->z = 0.0f; }
else if(uiBitmaskOverrideAnim & (1 << eAnim_ArmsOutFront))
{
arm0->xRot = -HALF_PI;
arm1->xRot = -HALF_PI;
arm0->zRot = 0.0f;
arm1->zRot = 0.0f;
}
else if(uiBitmaskOverrideAnim & (1 << eAnim_SingleArms))
{
arm0->xRot = (Mth::cos(time * 0.6662f + PI) * 2.0f) * r * 0.5f;
arm1->xRot = (Mth::cos(time * 0.6662f + PI) * 2.0f) * r * 0.5f;
arm0->zRot = 0.0f;
arm1->zRot = 0.0f;
}
else if((uiBitmaskOverrideAnim & (1 << eAnim_StatueOfLiberty)) && (holdingRightHand == 0) && (attackTime == 0.0f))
{
arm0->xRot = -PI;
arm0->zRot = -0.3f;
arm1->xRot = (Mth::cos(time * 0.6662f) * 2.0f) * r * 0.5f;
arm1->zRot = 0.0f;
}
else
{
arm0->xRot = (Mth::cos(time * 0.6662f + PI) * 2.0f) * r * 0.5f;
arm1->xRot = (Mth::cos(time * 0.6662f) * 2.0f) * r * 0.5f;
arm0->zRot = 0.0f;
arm1->zRot = 0.0f;
}
// Does the skin have an override for anim? leg0->yRot = 0.0f;
leg1->yRot = 0.0f;
if(uiBitmaskOverrideAnim&(1<<eAnim_ArmsDown)) if (riding)
{
if((uiBitmaskOverrideAnim & (1 << eAnim_SmallModel)) == 0)
{ {
arm0->xRot=0.0f; arm0->xRot += -HALF_PI * 0.4f;
arm1->xRot=0.0f; arm1->xRot += -HALF_PI * 0.4f;
arm0->zRot = 0.0f; leg0->xRot = -HALF_PI * 0.8f;
arm1->zRot = 0.0f; leg1->xRot = -HALF_PI * 0.8f;
}
else if(uiBitmaskOverrideAnim&(1<<eAnim_ArmsOutFront))
{
arm0->xRot=-HALF_PI;
arm1->xRot=-HALF_PI;
arm0->zRot = 0.0f;
arm1->zRot = 0.0f;
}
else if(uiBitmaskOverrideAnim&(1<<eAnim_SingleArms))
{
arm0->xRot = (Mth::cos(time * 0.6662f + PI) * 2.0f) * r * 0.5f;
arm1->xRot = (Mth::cos(time * 0.6662f + PI) * 2.0f) * r * 0.5f;
arm0->zRot = 0.0f;
arm1->zRot = 0.0f;
}
// 4J-PB - Weeping Angel - does't look good holding something in the arm that's up
else if((uiBitmaskOverrideAnim&(1<<eAnim_StatueOfLiberty)) && (holdingRightHand==0) && (attackTime==0.0f))
{
arm0->xRot = -PI;
arm0->zRot = -0.3f;
arm1->xRot = ( Mth::cos(time * 0.6662f) * 2.0f) * r * 0.5f;
arm1->zRot = 0.0f;
}
else
{
arm0->xRot = (Mth::cos(time * 0.6662f + PI) * 2.0f) * r * 0.5f;
arm1->xRot = ( Mth::cos(time * 0.6662f) * 2.0f) * r * 0.5f;
arm0->zRot = 0.0f;
arm1->zRot = 0.0f;
}
// arm0.zRot = ((float) (util.Mth.cos(time * 0.2312f) + 1) * 1) * r;
// arm1.zRot = ((float) (util.Mth.cos(time * 0.2812f) - 1) * 1) * r;
leg0->yRot = 0.0f;
leg1->yRot = 0.0f;
if (riding)
{
if(uiBitmaskOverrideAnim&(1<<eAnim_SmallModel) == 0)
{
arm0->xRot += -HALF_PI * 0.4f;
arm1->xRot += -HALF_PI * 0.4f;
leg0->xRot = -HALF_PI * 0.8f;
leg1->xRot = -HALF_PI * 0.8f;
leg0->yRot = HALF_PI * 0.2f;
leg1->yRot = -HALF_PI * 0.2f;
}
else
{
arm0->xRot += -HALF_PI * 0.4f;
arm1->xRot += -HALF_PI * 0.4f;
leg0->xRot = -HALF_PI * 0.4f;
leg1->xRot = -HALF_PI * 0.4f;
}
}
else if(idle && !sneaking )
{
leg0->xRot = -HALF_PI;
leg1->xRot = -HALF_PI;
leg0->yRot = HALF_PI * 0.2f; leg0->yRot = HALF_PI * 0.2f;
leg1->yRot = -HALF_PI * 0.2f; leg1->yRot = -HALF_PI * 0.2f;
} }
else if(uiBitmaskOverrideAnim&(1<<eAnim_NoLegAnim)) else
{ {
leg0->xRot=0.0f; arm0->xRot += -HALF_PI * 0.4f;
leg0->zRot=0.0f; arm1->xRot += -HALF_PI * 0.4f;
leg1->xRot=0.0f; leg0->xRot = -HALF_PI * 0.4f;
leg1->zRot=0.0f; leg1->xRot = -HALF_PI * 0.4f;
leg0->yRot = 0.0f;
leg1->yRot = 0.0f;
} }
else if(uiBitmaskOverrideAnim&(1<<eAnim_SingleLegs)) }
else if(idle && !sneaking)
{
leg0->xRot = -HALF_PI;
leg1->xRot = -HALF_PI;
leg0->yRot = HALF_PI * 0.2f;
leg1->yRot = -HALF_PI * 0.2f;
}
else if(uiBitmaskOverrideAnim & (1 << eAnim_NoLegAnim))
{
leg0->xRot = 0.0f;
leg0->zRot = 0.0f;
leg1->xRot = 0.0f;
leg1->zRot = 0.0f;
leg0->yRot = 0.0f;
leg1->yRot = 0.0f;
}
else if(uiBitmaskOverrideAnim & (1 << eAnim_SingleLegs))
{
leg0->xRot = (Mth::cos(time * 0.6662f) * 1.4f) * r;
leg1->xRot = (Mth::cos(time * 0.6662f) * 1.4f) * r;
}
else
{
leg0->xRot = (Mth::cos(time * 0.6662f) * 1.4f) * r;
leg1->xRot = (Mth::cos(time * 0.6662f + PI) * 1.4f) * r;
}
if (holdingLeftHand != 0)
{
arm1->xRot = arm1->xRot * 0.5f - HALF_PI * 0.2f * holdingLeftHand;
}
if (holdingRightHand != 0)
{
arm0->xRot = arm0->xRot * 0.5f - HALF_PI * 0.2f * holdingRightHand;
}
arm0->yRot = 0.0f;
arm1->yRot = 0.0f;
if (attackTime > -9990.0f)
{
float swing = attackTime;
body->yRot = Mth::sin(sqrt(swing) * PI * 2.0f) * 0.2f;
arm0->z = Mth::sin(body->yRot) * 5.0f;
arm0->x = -Mth::cos(body->yRot) * 5.0f;
arm1->z = -Mth::sin(body->yRot) * 5.0f;
arm1->x = Mth::cos(body->yRot) * 5.0f;
arm0->yRot += body->yRot;
arm1->yRot += body->yRot;
arm1->xRot += body->yRot;
swing = 1.0f - attackTime;
swing *= swing;
swing *= swing;
swing = 1.0f - swing;
float aa = Mth::sin(swing * PI);
float bb = Mth::sin(attackTime * PI) * -(head->xRot - 0.7f) * 0.75f;
arm0->xRot -= aa * 1.2f + bb;
arm0->yRot += body->yRot * 2.0f;
if((uiBitmaskOverrideAnim & (1 << eAnim_StatueOfLiberty)) && (holdingRightHand == 0) && (attackTime == 0.0f))
{ {
leg0->xRot = ( Mth::cos(time * 0.6662f) * 1.4f) * r; arm0->zRot -= Mth::sin(attackTime * PI) * -0.4f;
leg1->xRot = ( Mth::cos(time * 0.6662f) * 1.4f) * r;
} }
else else
{ {
leg0->xRot = ( Mth::cos(time * 0.6662f) * 1.4f) * r; arm0->zRot = Mth::sin(attackTime * PI) * -0.4f;
leg1->xRot = ( Mth::cos(time * 0.6662f + PI) * 1.4f) * r;
} }
}
if(eating)
{
float is = 1 - eating_swing;
is = is * is * is;
is = is * is * is;
is = is * is * is;
float iss = 1 - is;
arm0->xRot = -Mth::abs(Mth::cos(eating_t / 4.0f * PI) * 0.1f) * (eating_swing > 0.2 ? 1.0f : 0.0f) * 2.0f;
arm0->yRot -= iss * 0.5f;
arm0->xRot -= iss * 1.2f;
}
if (holdingLeftHand != 0) if (sneaking)
{
if(uiBitmaskOverrideAnim & (1 << eAnim_SmallModel))
{ {
arm1->xRot = arm1->xRot * 0.5f - HALF_PI * 0.2f * holdingLeftHand; body->xRot = -0.5f;
} arm0->xRot += 0.4f;
if (holdingRightHand != 0) arm1->xRot += 0.4f;
{ leg0->z = -4.0f;
arm0->xRot = arm0->xRot * 0.5f - HALF_PI * 0.2f * holdingRightHand; leg1->z = -4.0f;
} body->z = 2.0f;
body->y = 0.0f;
arm0->yRot = 0.0f; arm0->y = 2.0f;
arm1->yRot = 0.0f; arm1->y = 2.0f;
if (attackTime > -9990.0f) leg0->y = 9.0f;
{ leg1->y = 9.0f;
float swing = attackTime; head->y = 1.0f;
body->yRot = Mth::sin(sqrt(swing) * PI * 2.0f) * 0.2f; hair->y = 1.0f;
arm0->z = Mth::sin(body->yRot) * 5.0f; ear->y = 1.0f;
arm0->x = -Mth::cos(body->yRot) * 5.0f; cloak->y = 0.0f;
arm1->z = -Mth::sin(body->yRot) * 5.0f;
arm1->x = Mth::cos(body->yRot) * 5.0f;
arm0->yRot += body->yRot;
arm1->yRot += body->yRot;
arm1->xRot += body->yRot;
swing = 1.0f - attackTime;
swing *= swing;
swing *= swing;
swing = 1.0f - swing;
float aa = Mth::sin(swing * PI);
float bb = Mth::sin(attackTime * PI) * -(head->xRot - 0.7f) * 0.75f;
arm0->xRot -= aa * 1.2f + bb; // 4J - changed 1.2 -> 1.2f
arm0->yRot += body->yRot * 2.0f;
if((uiBitmaskOverrideAnim&(1<<eAnim_StatueOfLiberty))&& (holdingRightHand==0) && (attackTime==0.0f))
{
arm0->zRot -= Mth::sin(attackTime * PI) * -0.4f;
}
else
{
arm0->zRot = Mth::sin(attackTime * PI) * -0.4f;
}
}
// 4J added
if( eating )
{
// These factors are largely lifted from ItemInHandRenderer to try and keep the 3rd person eating animation as similar as possible
float is = 1 - eating_swing;
is = is * is * is;
is = is * is * is;
is = is * is * is;
float iss = 1 - is;
arm0->xRot = - Mth::abs(Mth::cos(eating_t / 4.0f * PI) * 0.1f) * (eating_swing > 0.2 ? 1.0f : 0.0f) * 2.0f; // This factor is the chomping bit (conditional factor is so that he doesn't eat whilst the food is being pulled away at the end)
arm0->yRot -= iss * 0.5f; // This factor and the following to the general arm movement through the life of the swing
arm0->xRot -= iss * 1.2f;
}
if (sneaking)
{
if(uiBitmaskOverrideAnim&(1<<eAnim_SmallModel))
{
body->xRot = -0.5f;
leg0->xRot -= 0.0f;
leg1->xRot -= 0.0f;
arm0->xRot += 0.4f;
arm1->xRot += 0.4f;
leg0->z = -4.0f;
leg1->z = -4.0f;
body->z = 2.0f;
body->y = 0.0f;
arm0->y = 2.0f;
arm1->y = 2.0f;
leg0->y = +9.0f;
leg1->y = +9.0f;
head->y = +1.0f;
hair->y = +1.0f;
ear->y = +1.0f;
cloak->y = 0.0f;
}
else
{
body->xRot = 0.5f;
leg0->xRot -= 0.0f;
leg1->xRot -= 0.0f;
arm0->xRot += 0.4f;
arm1->xRot += 0.4f;
leg0->z = +4.0f;
leg1->z = +4.0f;
body->y = 0.0f;
arm0->y = 2.0f;
arm1->y = 2.0f;
leg0->y = +9.0f;
leg1->y = +9.0f;
head->y = +1.0f;
hair->y = +1.0f;
ear->y = +1.0f;
cloak->y = 0.0f;
}
} }
else else
{ {
body->xRot = 0.0f; body->xRot = 0.5f;
leg0->z = 0.1f; arm0->xRot += 0.4f;
leg1->z = 0.1f; arm1->xRot += 0.4f;
leg0->z = 4.0f;
if(!riding && idle) leg1->z = 4.0f;
{ body->y = 0.0f;
leg0->y = 22.0f; arm0->y = 2.0f;
leg1->y = 22.0f; arm1->y = 2.0f;
body->y = 10.0f; leg0->y = 9.0f;
arm0->y = 12.0f; leg1->y = 9.0f;
arm1->y = 12.0f; head->y = 1.0f;
head->y = 10.0f; hair->y = 1.0f;
hair->y = 10.0f; ear->y = 1.0f;
ear->y = 11.0f; cloak->y = 0.0f;
cloak->y = 10.0f;
}
else
{
leg0->y = 12.0f;
leg1->y = 12.0f;
body->y = 0.0f;
arm0->y = 2.0f;
arm1->y = 2.0f;
head->y = 0.0f;
hair->y = 0.0f;
ear->y = 1.0f;
cloak->y = 0.0f;
}
} }
}
else
{
body->xRot = 0.0f;
leg0->z = 0.1f;
leg1->z = 0.1f;
if(!riding && idle)
arm0->zRot += ((Mth::cos(bob * 0.09f)) * 0.05f + 0.05f);
arm1->zRot -= ((Mth::cos(bob * 0.09f)) * 0.05f + 0.05f);
arm0->xRot += ((Mth::sin(bob * 0.067f)) * 0.05f);
arm1->xRot -= ((Mth::sin(bob * 0.067f)) * 0.05f);
if (bowAndArrow)
{ {
float attack2 = 0.0f; leg0->y = 22.0f;
float attack = 0.0f; leg1->y = 22.0f;
body->y = 10.0f;
arm0->zRot = 0.0f; arm0->y = 12.0f;
arm1->zRot = 0.0f; arm1->y = 12.0f;
arm0->yRot = -(0.1f - attack2 * 0.6f) + head->yRot; head->y = 10.0f;
arm1->yRot = +(0.1f - attack2 * 0.6f) + head->yRot + 0.4f; hair->y = 10.0f;
arm0->xRot = -HALF_PI + head->xRot; ear->y = 11.0f;
arm1->xRot = -HALF_PI + head->xRot; cloak->y = 10.0f;
arm0->xRot -= attack2 * 1.2f - attack * 0.4f;
arm1->xRot -= attack2 * 1.2f - attack * 0.4f;
arm0->zRot += ((float) (Mth::cos(bob * 0.09f)) * 0.05f + 0.05f);
arm1->zRot -= ((float) (Mth::cos(bob * 0.09f)) * 0.05f + 0.05f);
arm0->xRot += ((float) (Mth::sin(bob * 0.067f)) * 0.05f);
arm1->xRot -= ((float) (Mth::sin(bob * 0.067f)) * 0.05f);
} }
else
{
leg0->y = 12.0f;
leg1->y = 12.0f;
body->y = 0.0f;
arm0->y = 2.0f;
arm1->y = 2.0f;
head->y = 0.0f;
hair->y = 0.0f;
ear->y = 1.0f;
cloak->y = 0.0f;
}
}
arm0->zRot += ((Mth::cos(bob * 0.09f)) * 0.05f + 0.05f);
arm1->zRot -= ((Mth::cos(bob * 0.09f)) * 0.05f + 0.05f);
arm0->xRot += ((Mth::sin(bob * 0.067f)) * 0.05f);
arm1->xRot -= ((Mth::sin(bob * 0.067f)) * 0.05f);
if (bowAndArrow)
{
float attack2 = 0.0f;
float attack = 0.0f;
arm0->zRot = 0.0f;
arm1->zRot = 0.0f;
arm0->yRot = -(0.1f - attack2 * 0.6f) + head->yRot;
arm1->yRot = +(0.1f - attack2 * 0.6f) + head->yRot + 0.4f;
arm0->xRot = -HALF_PI + head->xRot;
arm1->xRot = -HALF_PI + head->xRot;
arm0->xRot -= attack2 * 1.2f - attack * 0.4f;
arm1->xRot -= attack2 * 1.2f - attack * 0.4f;
arm0->zRot += ((float)(Mth::cos(bob * 0.09f)) * 0.05f + 0.05f);
arm1->zRot -= ((float)(Mth::cos(bob * 0.09f)) * 0.05f + 0.05f);
arm0->xRot += ((float)(Mth::sin(bob * 0.067f)) * 0.05f);
arm1->xRot -= ((float)(Mth::sin(bob * 0.067f)) * 0.05f);
}
// sync second layer after ALL animation is applied
if(bodyWear)
{
bodyWear->xRot = body->xRot;
bodyWear->yRot = body->yRot;
bodyWear->zRot = body->zRot;
bodyWear->x = body->x;
bodyWear->y = body->y;
bodyWear->z = body->z;
arm0Wear->xRot = arm0->xRot;
arm0Wear->yRot = arm0->yRot;
arm0Wear->zRot = arm0->zRot;
arm0Wear->x = arm0->x;
arm0Wear->y = arm0->y;
arm0Wear->z = arm0->z;
arm1Wear->xRot = arm1->xRot;
arm1Wear->yRot = arm1->yRot;
arm1Wear->zRot = arm1->zRot;
arm1Wear->x = arm1->x;
arm1Wear->y = arm1->y;
arm1Wear->z = arm1->z;
leg0Wear->xRot = leg0->xRot;
leg0Wear->yRot = leg0->yRot;
leg0Wear->zRot = leg0->zRot;
leg0Wear->x = leg0->x;
leg0Wear->y = leg0->y;
leg0Wear->z = leg0->z;
leg1Wear->xRot = leg1->xRot;
leg1Wear->yRot = leg1->yRot;
leg1Wear->zRot = leg1->zRot;
leg1Wear->x = leg1->x;
leg1Wear->y = leg1->y;
leg1Wear->z = leg1->z;
} }
} }
void HumanoidModel::renderHair(float scale,bool usecompiled) void HumanoidModel::renderHair(float scale, bool usecompiled)
{ {
hair->yRot = head->yRot; hair->yRot = head->yRot;
hair->xRot = head->xRot; hair->xRot = head->xRot;
hair->render(scale,usecompiled); hair->render(scale, usecompiled);
} }
void HumanoidModel::renderEars(float scale,bool usecompiled) void HumanoidModel::renderEars(float scale, bool usecompiled)
{ {
ear->yRot = head->yRot; ear->yRot = head->yRot;
ear->xRot = head->xRot; ear->xRot = head->xRot;
ear->x=0; ear->x = 0;
ear->y=0; ear->y = 0;
ear->render(scale,usecompiled); ear->render(scale, usecompiled);
} }
void HumanoidModel::renderCloak(float scale,bool usecompiled) void HumanoidModel::renderCloak(float scale, bool usecompiled)
{ {
cloak->render(scale,usecompiled); cloak->render(scale, usecompiled);
} }
void HumanoidModel::render(HumanoidModel *model, float scale, bool usecompiled) void HumanoidModel::render(HumanoidModel *model, float scale, bool usecompiled)
@ -470,28 +580,95 @@ void HumanoidModel::render(HumanoidModel *model, float scale, bool usecompiled)
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;
hair->y = head->y; hair->y = head->y;
hair->yRot = head->yRot; hair->yRot = head->yRot;
hair->xRot = head->xRot; hair->xRot = head->xRot;
body->xRot = model->body->xRot;
body->yRot = model->body->yRot; body->yRot = model->body->yRot;
body->zRot = model->body->zRot;
body->x = model->body->x;
body->y = model->body->y;
body->z = model->body->z;
arm0->xRot = model->arm0->xRot; arm0->xRot = model->arm0->xRot;
arm0->yRot = model->arm0->yRot; arm0->yRot = model->arm0->yRot;
arm0->zRot = model->arm0->zRot; arm0->zRot = model->arm0->zRot;
arm0->x = model->arm0->x;
arm0->y = model->arm0->y;
arm0->z = model->arm0->z;
arm1->xRot = model->arm1->xRot; arm1->xRot = model->arm1->xRot;
arm1->yRot = model->arm1->yRot; arm1->yRot = model->arm1->yRot;
arm1->zRot = model->arm1->zRot; arm1->zRot = model->arm1->zRot;
arm1->x = model->arm1->x;
arm1->y = model->arm1->y;
arm1->z = model->arm1->z;
leg0->xRot = model->leg0->xRot; leg0->xRot = model->leg0->xRot;
leg1->xRot = model->leg1->xRot; leg0->yRot = model->leg0->yRot;
leg0->zRot = model->leg0->zRot;
leg0->x = model->leg0->x;
leg0->y = model->leg0->y;
leg0->z = model->leg0->z;
head->render(scale, usecompiled,(m_uiAnimOverrideBitmask&(1<<eAnim_DisableRenderHead))>0); leg1->xRot = model->leg1->xRot;
body->render(scale, usecompiled,(m_uiAnimOverrideBitmask&(1<<eAnim_DisableRenderTorso))>0); leg1->yRot = model->leg1->yRot;
arm0->render(scale, usecompiled,(m_uiAnimOverrideBitmask&(1<<eAnim_DisableRenderArm0))>0); leg1->zRot = model->leg1->zRot;
arm1->render(scale, usecompiled,(m_uiAnimOverrideBitmask&(1<<eAnim_DisableRenderArm1))>0); leg1->x = model->leg1->x;
leg0->render(scale, usecompiled,(m_uiAnimOverrideBitmask&(1<<eAnim_DisableRenderLeg0))>0); leg1->y = model->leg1->y;
leg1->render(scale, usecompiled,(m_uiAnimOverrideBitmask&(1<<eAnim_DisableRenderLeg1))>0); leg1->z = model->leg1->z;
hair->render(scale, usecompiled,(m_uiAnimOverrideBitmask&(1<<eAnim_DisableRenderHair))>0);
head->render(scale, usecompiled, (m_uiAnimOverrideBitmask & (1 << eAnim_DisableRenderHead)) > 0);
body->render(scale, usecompiled, (m_uiAnimOverrideBitmask & (1 << eAnim_DisableRenderTorso)) > 0);
arm0->render(scale, usecompiled, (m_uiAnimOverrideBitmask & (1 << eAnim_DisableRenderArm0)) > 0);
arm1->render(scale, usecompiled, (m_uiAnimOverrideBitmask & (1 << eAnim_DisableRenderArm1)) > 0);
leg0->render(scale, usecompiled, (m_uiAnimOverrideBitmask & (1 << eAnim_DisableRenderLeg0)) > 0);
leg1->render(scale, usecompiled, (m_uiAnimOverrideBitmask & (1 << eAnim_DisableRenderLeg1)) > 0);
hair->render(scale, usecompiled, (m_uiAnimOverrideBitmask & (1 << eAnim_DisableRenderHair)) > 0);
if(bodyWear && model->bodyWear)
{
bodyWear->xRot = model->bodyWear->xRot;
bodyWear->yRot = model->bodyWear->yRot;
bodyWear->zRot = model->bodyWear->zRot;
bodyWear->x = model->bodyWear->x;
bodyWear->y = model->bodyWear->y;
bodyWear->z = model->bodyWear->z;
arm0Wear->xRot = model->arm0Wear->xRot;
arm0Wear->yRot = model->arm0Wear->yRot;
arm0Wear->zRot = model->arm0Wear->zRot;
arm0Wear->x = model->arm0Wear->x;
arm0Wear->y = model->arm0Wear->y;
arm0Wear->z = model->arm0Wear->z;
arm1Wear->xRot = model->arm1Wear->xRot;
arm1Wear->yRot = model->arm1Wear->yRot;
arm1Wear->zRot = model->arm1Wear->zRot;
arm1Wear->x = model->arm1Wear->x;
arm1Wear->y = model->arm1Wear->y;
arm1Wear->z = model->arm1Wear->z;
leg0Wear->xRot = model->leg0Wear->xRot;
leg0Wear->yRot = model->leg0Wear->yRot;
leg0Wear->zRot = model->leg0Wear->zRot;
leg0Wear->x = model->leg0Wear->x;
leg0Wear->y = model->leg0Wear->y;
leg0Wear->z = model->leg0Wear->z;
leg1Wear->xRot = model->leg1Wear->xRot;
leg1Wear->yRot = model->leg1Wear->yRot;
leg1Wear->zRot = model->leg1Wear->zRot;
leg1Wear->x = model->leg1Wear->x;
leg1Wear->y = model->leg1Wear->y;
leg1Wear->z = model->leg1Wear->z;
bodyWear->render(scale, usecompiled);
arm0Wear->render(scale, usecompiled);
arm1Wear->render(scale, usecompiled);
leg0Wear->render(scale, usecompiled);
leg1Wear->render(scale, usecompiled);
}
} }

View file

@ -4,32 +4,40 @@
class HumanoidModel : public Model class HumanoidModel : public Model
{ {
public: public:
ModelPart *head, *hair, *body, *arm0, *arm1, *leg0, *leg1, *ear, *cloak; enum ePlayerModelType
//ModelPart *hat; {
ePlayerModel_Steve = 0,
ePlayerModel_Alex
};
ModelPart *head, *hair, *body, *arm0, *arm1, *leg0, *leg1, *ear, *cloak, *bodyWear, *arm0Wear, *arm1Wear, *leg0Wear, *leg1Wear;
bool hasLayer2;
bool isSlimArms;
int m_ePlayerModelType;
int holdingLeftHand; int holdingLeftHand;
int holdingRightHand; int holdingRightHand;
bool idle; bool idle;
bool sneaking; bool sneaking;
bool bowAndArrow; bool bowAndArrow;
bool eating; // 4J added bool eating;
float eating_t; // 4J added float eating_t;
float eating_swing; // 4J added float eating_swing;
unsigned int m_uiAnimOverrideBitmask; // 4J added unsigned int m_uiAnimOverrideBitmask;
float m_fYOffset; // 4J added float m_fYOffset;
enum animbits enum animbits
{ {
eAnim_ArmsDown =0, eAnim_ArmsDown =0,
eAnim_ArmsOutFront, eAnim_ArmsOutFront,
eAnim_NoLegAnim, eAnim_NoLegAnim,
eAnim_HasIdle, eAnim_HasIdle,
eAnim_ForceAnim, // Claptrap looks bad if the user turns off custom skin anim eAnim_ForceAnim,
// 4J-PB - DaveK wants Fish characters to move both legs in the same way
eAnim_SingleLegs, eAnim_SingleLegs,
eAnim_SingleArms, eAnim_SingleArms,
eAnim_StatueOfLiberty, // Dr Who Weeping Angel eAnim_StatueOfLiberty,
eAnim_DontRenderArmour, // Dr Who Daleks eAnim_DontRenderArmour,
eAnim_NoBobbing, // Dr Who Daleks eAnim_NoBobbing,
eAnim_DisableRenderHead, eAnim_DisableRenderHead,
eAnim_DisableRenderArm0, eAnim_DisableRenderArm0,
eAnim_DisableRenderArm1, eAnim_DisableRenderArm1,
@ -37,8 +45,7 @@ public:
eAnim_DisableRenderLeg0, eAnim_DisableRenderLeg0,
eAnim_DisableRenderLeg1, eAnim_DisableRenderLeg1,
eAnim_DisableRenderHair, eAnim_DisableRenderHair,
eAnim_SmallModel // Maggie Simpson for riding horse, etc eAnim_SmallModel
}; };
static const unsigned int m_staticBitmaskIgnorePlayerCustomAnimSetting= (1<<HumanoidModel::eAnim_ForceAnim) | static const unsigned int m_staticBitmaskIgnorePlayerCustomAnimSetting= (1<<HumanoidModel::eAnim_ForceAnim) |
@ -49,11 +56,12 @@ public:
(1<<HumanoidModel::eAnim_DisableRenderLeg1) | (1<<HumanoidModel::eAnim_DisableRenderLeg1) |
(1<<HumanoidModel::eAnim_DisableRenderHair); (1<<HumanoidModel::eAnim_DisableRenderHair);
void _init(float g, float yOffset, int texWidth, int texHeight, bool slimArms);
void _init(float g, float yOffset, int texWidth, int texHeight); // 4J added
HumanoidModel(); HumanoidModel();
HumanoidModel(float g); HumanoidModel(float g);
HumanoidModel(float g, float yOffset, int texWidth, int texHeight); HumanoidModel(float g, float yOffset, int texWidth, int texHeight);
HumanoidModel(float g, float yOffset, int texWidth, int texHeight, bool slimArms);
void setPlayerModelType(int type);
virtual void render(shared_ptr<Entity> entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled); virtual void render(shared_ptr<Entity> entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled);
virtual void setupAnim(float time, float r, float bob, float yRot, float xRot, float scale, shared_ptr<Entity> entity, unsigned int uiBitmaskOverrideAnim = 0); virtual void setupAnim(float time, float r, float bob, float yRot, float xRot, float scale, shared_ptr<Entity> entity, unsigned int uiBitmaskOverrideAnim = 0);
void renderHair(float scale, bool usecompiled); void renderHair(float scale, bool usecompiled);
@ -61,6 +69,5 @@ public:
void renderCloak(float scale, bool usecompiled); void renderCloak(float scale, bool usecompiled);
void render(HumanoidModel *model, float scale, bool usecompiled); void render(HumanoidModel *model, float scale, bool usecompiled);
// Add new bits to models
ModelPart * AddOrRetrievePart(SKIN_BOX *pBox); ModelPart * AddOrRetrievePart(SKIN_BOX *pBox);
}; };

View file

@ -55,12 +55,92 @@ static unsigned int nametagColorForIndex(int index)
ResourceLocation PlayerRenderer::DEFAULT_LOCATION = ResourceLocation(TN_MOB_CHAR); ResourceLocation PlayerRenderer::DEFAULT_LOCATION = ResourceLocation(TN_MOB_CHAR);
PlayerRenderer::PlayerRenderer() : LivingEntityRenderer( new HumanoidModel(0), 0.5f ) static const unsigned int ANIM_64x64_CLASSIC_SKIN = 0x00040000;
{ static const unsigned int ANIM_64x64_ALEX_SLIM_SKIN = 0x00080000;
humanoidModel = static_cast<HumanoidModel *>(model);
armorParts1 = new HumanoidModel(1.0f); struct PlayerSkinModelInfo
armorParts2 = new HumanoidModel(0.5f); {
int modelType;
int texWidth;
int texHeight;
};
static PlayerSkinModelInfo GetPlayerSkinModelInfoFromAnimFlags(unsigned int uiAnimFlags)
{
PlayerSkinModelInfo info;
info.modelType = HumanoidModel::ePlayerModel_Steve;
info.texWidth = 64;
info.texHeight = 32;
if ((uiAnimFlags & ANIM_64x64_ALEX_SLIM_SKIN) != 0)
{
info.modelType = HumanoidModel::ePlayerModel_Alex;
info.texWidth = 64;
info.texHeight = 64;
}
else if ((uiAnimFlags & ANIM_64x64_CLASSIC_SKIN) != 0)
{
info.modelType = HumanoidModel::ePlayerModel_Steve;
info.texWidth = 64;
info.texHeight = 64;
}
return info;
}
PlayerRenderer::PlayerRenderer() : LivingEntityRenderer(new HumanoidModel(0.0f, 0.0f, 64, 32, false), 0.5f)
{
humanoidModel = (HumanoidModel*)model;
armorParts1 = NULL;
armorParts2 = NULL;
m_iCurrentPlayerModelType = HumanoidModel::ePlayerModel_Steve;
m_iCurrentPlayerTexWidth = 64;
m_iCurrentPlayerTexHeight = 32;
createArmorParts(false); // Steve por padrao
}
void PlayerRenderer::createArmorParts(bool slimArms)
{
if (armorParts1 != NULL)
{
delete armorParts1;
armorParts1 = NULL;
}
if (armorParts2 != NULL)
{
delete armorParts2;
armorParts2 = NULL;
}
// Armour textures remain the legacy 64x32 sheets; only arm width changes for slim skins.
armorParts1 = new HumanoidModel(1.0f, 0.0f, 64, 32, slimArms);
armorParts2 = new HumanoidModel(0.5f, 0.0f, 64, 32, slimArms);
}
void PlayerRenderer::setPlayerModelType(int type)
{
setPlayerSkinModel(type, m_iCurrentPlayerTexWidth, m_iCurrentPlayerTexHeight);
}
void PlayerRenderer::setPlayerSkinModel(int type, int texWidth, int texHeight)
{
bool slimArms = (type == HumanoidModel::ePlayerModel_Alex);
m_iCurrentPlayerModelType = type;
m_iCurrentPlayerTexWidth = texWidth;
m_iCurrentPlayerTexHeight = texHeight;
if (humanoidModel != NULL)
{
delete humanoidModel;
humanoidModel = NULL;
}
humanoidModel = new HumanoidModel(0.0f, 0.0f, texWidth, texHeight, slimArms);
model = humanoidModel;
createArmorParts(slimArms);
} }
unsigned int PlayerRenderer::getNametagColour(int index) unsigned int PlayerRenderer::getNametagColour(int index)
@ -72,10 +152,8 @@ unsigned int PlayerRenderer::getNametagColour(int index)
int PlayerRenderer::prepareArmor(shared_ptr<LivingEntity> _player, int layer, float a) int PlayerRenderer::prepareArmor(shared_ptr<LivingEntity> _player, int layer, float a)
{ {
// 4J - dynamic cast required because we aren't using templates/generics in our version
shared_ptr<Player> player = dynamic_pointer_cast<Player>(_player); shared_ptr<Player> player = dynamic_pointer_cast<Player>(_player);
// 4J-PB - need to disable rendering armour for some special skins (Daleks)
unsigned int uiAnimOverrideBitmask=player->getAnimOverrideBitmask(); unsigned int uiAnimOverrideBitmask=player->getAnimOverrideBitmask();
if(uiAnimOverrideBitmask&(1<<HumanoidModel::eAnim_DontRenderArmour)) if(uiAnimOverrideBitmask&(1<<HumanoidModel::eAnim_DontRenderArmour))
{ {
@ -83,7 +161,7 @@ int PlayerRenderer::prepareArmor(shared_ptr<LivingEntity> _player, int layer, fl
} }
shared_ptr<ItemInstance> itemInstance = player->inventory->getArmor(3 - layer); shared_ptr<ItemInstance> itemInstance = player->inventory->getArmor(3 - layer);
if (itemInstance != nullptr) if (itemInstance != NULL)
{ {
Item *item = itemInstance->getItem(); Item *item = itemInstance->getItem();
if (dynamic_cast<ArmorItem *>(item)) if (dynamic_cast<ArmorItem *>(item))
@ -102,17 +180,17 @@ int PlayerRenderer::prepareArmor(shared_ptr<LivingEntity> _player, int layer, fl
armor->leg1->visible = layer == 2 || layer == 3; armor->leg1->visible = layer == 2 || layer == 3;
setArmor(armor); setArmor(armor);
if (armor != nullptr) armor->attackTime = model->attackTime; if (armor != NULL) armor->attackTime = model->attackTime;
if (armor != nullptr) armor->riding = model->riding; if (armor != NULL) armor->riding = model->riding;
if (armor != nullptr) armor->young = model->young; if (armor != NULL) armor->young = model->young;
float brightness = SharedConstants::TEXTURE_LIGHTING ? 1 : player->getBrightness(a); float brightness = SharedConstants::TEXTURE_LIGHTING ? 1 : player->getBrightness(a);
if (armorItem->getMaterial() == ArmorItem::ArmorMaterial::CLOTH) if (armorItem->getMaterial() == ArmorItem::ArmorMaterial::CLOTH)
{ {
int color = armorItem->getColor(itemInstance); int color = armorItem->getColor(itemInstance);
float red = static_cast<float>((color >> 16) & 0xFF) / 0xFF; float red = (float) ((color >> 16) & 0xFF) / 0xFF;
float green = static_cast<float>((color >> 8) & 0xFF) / 0xFF; float green = (float) ((color >> 8) & 0xFF) / 0xFF;
float blue = static_cast<float>(color & 0xFF) / 0xFF; float blue = (float) (color & 0xFF) / 0xFF;
glColor3f(brightness * red, brightness * green, brightness * blue); glColor3f(brightness * red, brightness * green, brightness * blue);
if (itemInstance->isEnchanted()) return 0x1f; if (itemInstance->isEnchanted()) return 0x1f;
@ -129,21 +207,19 @@ int PlayerRenderer::prepareArmor(shared_ptr<LivingEntity> _player, int layer, fl
} }
} }
return -1; return -1;
} }
void PlayerRenderer::prepareSecondPassArmor(shared_ptr<LivingEntity> _player, int layer, float a) void PlayerRenderer::prepareSecondPassArmor(shared_ptr<LivingEntity> _player, int layer, float a)
{ {
// 4J - dynamic cast required because we aren't using templates/generics in our version
shared_ptr<Player> player = dynamic_pointer_cast<Player>(_player); shared_ptr<Player> player = dynamic_pointer_cast<Player>(_player);
shared_ptr<ItemInstance> itemInstance = player->inventory->getArmor(3 - layer); shared_ptr<ItemInstance> itemInstance = player->inventory->getArmor(3 - layer);
if (itemInstance != nullptr) if (itemInstance != NULL)
{ {
Item *item = itemInstance->getItem(); Item *item = itemInstance->getItem();
if (dynamic_cast<ArmorItem *>(item)) if (dynamic_cast<ArmorItem *>(item))
{ {
ArmorItem *armorItem = dynamic_cast<ArmorItem *>(item); ArmorItem *armorItem = dynamic_cast<ArmorItem *>(item);
bindTexture(HumanoidMobRenderer::getArmorLocation(static_cast<ArmorItem *>(item), layer, true)); bindTexture(HumanoidMobRenderer::getArmorLocation((ArmorItem *)item, layer, true));
float brightness = SharedConstants::TEXTURE_LIGHTING ? 1 : player->getBrightness(a); float brightness = SharedConstants::TEXTURE_LIGHTING ? 1 : player->getBrightness(a);
glColor3f(brightness, brightness, brightness); glColor3f(brightness, brightness, brightness);
@ -153,20 +229,23 @@ void PlayerRenderer::prepareSecondPassArmor(shared_ptr<LivingEntity> _player, in
void PlayerRenderer::render(shared_ptr<Entity> _mob, double x, double y, double z, float rot, float a) void PlayerRenderer::render(shared_ptr<Entity> _mob, double x, double y, double z, float rot, float a)
{ {
if (_mob == nullptr)
{
return;
}
// 4J - dynamic cast required because we aren't using templates/generics in our version
shared_ptr<Player> mob = dynamic_pointer_cast<Player>(_mob); shared_ptr<Player> mob = dynamic_pointer_cast<Player>(_mob);
if(mob == nullptr) return;
if(mob->hasInvisiblePrivilege()) return; if(mob->hasInvisiblePrivilege()) return;
unsigned int uiSkinAnimFlags = Player::getSkinAnimOverrideBitmask(mob->getCustomSkin());
PlayerSkinModelInfo modelInfo = GetPlayerSkinModelInfoFromAnimFlags(uiSkinAnimFlags);
if (humanoidModel != NULL &&
(m_iCurrentPlayerModelType != modelInfo.modelType ||
m_iCurrentPlayerTexWidth != modelInfo.texWidth ||
m_iCurrentPlayerTexHeight != modelInfo.texHeight))
{
setPlayerSkinModel(modelInfo.modelType, modelInfo.texWidth, modelInfo.texHeight);
}
shared_ptr<ItemInstance> item = mob->inventory->getSelected(); shared_ptr<ItemInstance> item = mob->inventory->getSelected();
armorParts1->holdingRightHand = armorParts2->holdingRightHand = humanoidModel->holdingRightHand = item != nullptr ? 1 : 0; armorParts1->holdingRightHand = armorParts2->holdingRightHand = humanoidModel->holdingRightHand = item != NULL ? 1 : 0;
if (item != nullptr) if (item != NULL)
{ {
if (mob->getUseItemDuration() > 0) if (mob->getUseItemDuration() > 0)
{ {
@ -181,10 +260,8 @@ void PlayerRenderer::render(shared_ptr<Entity> _mob, double x, double y, double
} }
} }
} }
// 4J added, for 3rd person view of eating if( item != NULL && mob->getUseItemDuration() > 0 && item->getUseAnimation() == UseAnim_eat )
if( item != nullptr && mob->getUseItemDuration() > 0 && item->getUseAnimation() == UseAnim_eat )
{ {
// These factors are largely lifted from ItemInHandRenderer to try and keep the 3rd person eating animation as similar as possible
float t = (mob->getUseItemDuration() - a + 1); float t = (mob->getUseItemDuration() - a + 1);
float swing = 1 - (t / item->getUseDuration()); float swing = 1 - (t / item->getUseDuration());
armorParts1->eating = armorParts2->eating = humanoidModel->eating = true; armorParts1->eating = armorParts2->eating = humanoidModel->eating = true;
@ -204,7 +281,6 @@ void PlayerRenderer::render(shared_ptr<Entity> _mob, double x, double y, double
yp -= 2 / 16.0f; yp -= 2 / 16.0f;
} }
// Check if an idle animation is needed
if(mob->getAnimOverrideBitmask()&(1<<HumanoidModel::eAnim_HasIdle)) if(mob->getAnimOverrideBitmask()&(1<<HumanoidModel::eAnim_HasIdle))
{ {
if(mob->isIdle()) if(mob->isIdle())
@ -227,9 +303,7 @@ void PlayerRenderer::render(shared_ptr<Entity> _mob, double x, double y, double
armorParts2->idle=false; armorParts2->idle=false;
} }
// 4J-PB - any additional parts to turn on for this player (skin dependent)
vector<ModelPart *> *pAdditionalModelParts=mob->GetAdditionalModelParts(); vector<ModelPart *> *pAdditionalModelParts=mob->GetAdditionalModelParts();
//turn them on
if(pAdditionalModelParts!=nullptr) if(pAdditionalModelParts!=nullptr)
{ {
for(ModelPart *pModelPart : *pAdditionalModelParts) for(ModelPart *pModelPart : *pAdditionalModelParts)
@ -240,7 +314,6 @@ void PlayerRenderer::render(shared_ptr<Entity> _mob, double x, double y, double
LivingEntityRenderer::render(mob, x, yp, z, rot, a); LivingEntityRenderer::render(mob, x, yp, z, rot, a);
// turn them off again
if(pAdditionalModelParts && pAdditionalModelParts->size()!=0) if(pAdditionalModelParts && pAdditionalModelParts->size()!=0)
{ {
for(ModelPart *pModelPart : *pAdditionalModelParts) for(ModelPart *pModelPart : *pAdditionalModelParts)
@ -251,7 +324,6 @@ void PlayerRenderer::render(shared_ptr<Entity> _mob, double x, double y, double
armorParts1->bowAndArrow = armorParts2->bowAndArrow = humanoidModel->bowAndArrow = false; armorParts1->bowAndArrow = armorParts2->bowAndArrow = humanoidModel->bowAndArrow = false;
armorParts1->sneaking = armorParts2->sneaking = humanoidModel->sneaking = false; armorParts1->sneaking = armorParts2->sneaking = humanoidModel->sneaking = false;
armorParts1->holdingRightHand = armorParts2->holdingRightHand = humanoidModel->holdingRightHand = 0; armorParts1->holdingRightHand = armorParts2->holdingRightHand = humanoidModel->holdingRightHand = 0;
} }
void PlayerRenderer::additionalRendering(shared_ptr<LivingEntity> _mob, float a) void PlayerRenderer::additionalRendering(shared_ptr<LivingEntity> _mob, float a)
@ -262,13 +334,11 @@ void PlayerRenderer::additionalRendering(shared_ptr<LivingEntity> _mob, float a)
LivingEntityRenderer::additionalRendering(_mob,a); LivingEntityRenderer::additionalRendering(_mob,a);
LivingEntityRenderer::renderArrows(_mob, a); LivingEntityRenderer::renderArrows(_mob, a);
// 4J - dynamic cast required because we aren't using templates/generics in our version
shared_ptr<Player> mob = dynamic_pointer_cast<Player>(_mob); shared_ptr<Player> mob = dynamic_pointer_cast<Player>(_mob);
shared_ptr<ItemInstance> headGear = mob->inventory->getArmor(3); shared_ptr<ItemInstance> headGear = mob->inventory->getArmor(3);
if (headGear != nullptr) if (headGear != NULL)
{ {
// don't render the pumpkin for the skins
unsigned int uiAnimOverrideBitmask = mob->getSkinAnimOverrideBitmask( mob->getCustomSkin()); unsigned int uiAnimOverrideBitmask = mob->getSkinAnimOverrideBitmask( mob->getCustomSkin());
if((uiAnimOverrideBitmask&(1<<HumanoidModel::eAnim_DontRenderArmour))==0) if((uiAnimOverrideBitmask&(1<<HumanoidModel::eAnim_DontRenderArmour))==0)
@ -305,8 +375,7 @@ void PlayerRenderer::additionalRendering(shared_ptr<LivingEntity> _mob, float a)
} }
} }
// need to add a custom texture for deadmau5 if (mob != NULL && app.isXuidDeadmau5( mob->getXuid() ) && bindTexture(mob->customTextureUrl, L"" ))
if (mob != nullptr && app.isXuidDeadmau5( mob->getXuid() ) && bindTexture(mob->customTextureUrl, L"" ))
{ {
for (int i = 0; i < 2; i++) for (int i = 0; i < 2; i++)
{ {
@ -327,10 +396,6 @@ void PlayerRenderer::additionalRendering(shared_ptr<LivingEntity> _mob, float a)
} }
} }
// 4J: removed
/*boolean loaded = mob->getCloakTexture()->isLoaded();
boolean b1 = !mob->isInvisible();
boolean b2 = !mob->isCapeHidden();*/
if (bindTexture(mob->customTextureUrl2, L"") && !mob->isInvisible()) if (bindTexture(mob->customTextureUrl2, L"") && !mob->isInvisible())
{ {
glPushMatrix(); glPushMatrix();
@ -345,11 +410,11 @@ void PlayerRenderer::additionalRendering(shared_ptr<LivingEntity> _mob, float a)
double xa = Mth::sin(yr * PI / 180); double xa = Mth::sin(yr * PI / 180);
double za = -Mth::cos(yr * PI / 180); double za = -Mth::cos(yr * PI / 180);
float flap = static_cast<float>(yd) * 10; float flap = (float) yd * 10;
if (flap < -6) flap = -6; if (flap < -6) flap = -6;
if (flap > 32) flap = 32; if (flap > 32) flap = 32;
float lean = static_cast<float>(xd * xa + zd * za) * 100; float lean = (float) (xd * xa + zd * za) * 100;
float lean2 = static_cast<float>(xd * za - zd * xa) * 100; float lean2 = (float) (xd * za - zd * xa) * 100;
if (lean < 0) lean = 0; if (lean < 0) lean = 0;
float pow = mob->oBob + (mob->bob - mob->oBob) * a; float pow = mob->oBob + (mob->bob - mob->oBob) * a;
@ -360,7 +425,6 @@ void PlayerRenderer::additionalRendering(shared_ptr<LivingEntity> _mob, float a)
flap += 25; flap += 25;
} }
// 4J Stu - Fix for sprint-flying causing the cape to rotate up by 180 degrees or more
float xRot = 6.0f + lean / 2 + flap; float xRot = 6.0f + lean / 2 + flap;
if(xRot > 64.0f) xRot = 64.0f; if(xRot > 64.0f) xRot = 64.0f;
@ -374,18 +438,18 @@ void PlayerRenderer::additionalRendering(shared_ptr<LivingEntity> _mob, float a)
shared_ptr<ItemInstance> item = mob->inventory->getSelected(); shared_ptr<ItemInstance> item = mob->inventory->getSelected();
if (item != nullptr) if (item != NULL)
{ {
glPushMatrix(); glPushMatrix();
humanoidModel->arm0->translateTo(1 / 16.0f); humanoidModel->arm0->translateTo(1 / 16.0f);
glTranslatef(-1 / 16.0f, 7 / 16.0f, 1 / 16.0f); glTranslatef(-1 / 16.0f, 7 / 16.0f, 1 / 16.0f);
if (mob->fishing != nullptr) if (mob->fishing != NULL)
{ {
item = std::make_shared<ItemInstance>(Item::stick); item = shared_ptr<ItemInstance>( new ItemInstance(Item::stick) );
} }
UseAnim anim = UseAnim_none;//null; UseAnim anim = UseAnim_none;
if (mob->getUseItemDuration() > 0) if (mob->getUseItemDuration() > 0)
{ {
anim = item->getUseAnimation(); anim = item->getUseAnimation();
@ -472,30 +536,6 @@ void PlayerRenderer::additionalRendering(shared_ptr<LivingEntity> _mob, float a)
void PlayerRenderer::renderNameTags(shared_ptr<LivingEntity> player, double x, double y, double z, wstring msg, float scale, double dist) void PlayerRenderer::renderNameTags(shared_ptr<LivingEntity> player, double x, double y, double z, wstring msg, float scale, double dist)
{ {
#if 0
if (dist < 10 * 10)
{
Scoreboard *scoreboard = player->getScoreboard();
Objective *objective = scoreboard->getDisplayObjective(Scoreboard::DISPLAY_SLOT_BELOW_NAME);
if (objective != nullptr)
{
Score *score = scoreboard->getPlayerScore(player->getAName(), objective);
if (player->isSleeping())
{
renderNameTag(player, score->getScore() + " " + objective->getDisplayName(), x, y - 1.5f, z, 64);
}
else
{
renderNameTag(player, score->getScore() + " " + objective->getDisplayName(), x, y, z, 64);
}
y += getFont()->lineHeight * 1.15f * scale;
}
}
#endif
LivingEntityRenderer::renderNameTags(player, x, y, z, msg, scale, dist); LivingEntityRenderer::renderNameTags(player, x, y, z, msg, scale, dist);
} }
@ -510,11 +550,23 @@ void PlayerRenderer::renderHand()
float brightness = 1; float brightness = 1;
glColor3f(brightness, brightness, brightness); glColor3f(brightness, brightness, brightness);
humanoidModel->m_uiAnimOverrideBitmask = Minecraft::GetInstance()->player->getAnimOverrideBitmask(); shared_ptr<Player> localPlayer = Minecraft::GetInstance()->player;
unsigned int uiSkinAnimFlags = localPlayer != NULL ? Player::getSkinAnimOverrideBitmask(localPlayer->getCustomSkin()) : 0;
PlayerSkinModelInfo modelInfo = GetPlayerSkinModelInfoFromAnimFlags(uiSkinAnimFlags);
if (humanoidModel != NULL &&
(m_iCurrentPlayerModelType != modelInfo.modelType ||
m_iCurrentPlayerTexWidth != modelInfo.texWidth ||
m_iCurrentPlayerTexHeight != modelInfo.texHeight))
{
setPlayerSkinModel(modelInfo.modelType, modelInfo.texWidth, modelInfo.texHeight);
}
unsigned int uiAnimFlags = localPlayer != NULL ? localPlayer->getAnimOverrideBitmask() : 0;
humanoidModel->m_uiAnimOverrideBitmask = uiAnimFlags;
armorParts1->eating = armorParts2->eating = humanoidModel->eating = humanoidModel->idle = false; armorParts1->eating = armorParts2->eating = humanoidModel->eating = humanoidModel->idle = false;
humanoidModel->attackTime = 0; humanoidModel->attackTime = 0;
humanoidModel->setupAnim(0, 0, 0, 0, 0, 1 / 16.0f, Minecraft::GetInstance()->player); humanoidModel->setupAnim(0, 0, 0, 0, 0, 1 / 16.0f, Minecraft::GetInstance()->player);
// 4J-PB - does this skin have its arm0 disabled? (Dalek, etc)
if((humanoidModel->m_uiAnimOverrideBitmask&(1<<HumanoidModel::eAnim_DisableRenderArm0))==0) if((humanoidModel->m_uiAnimOverrideBitmask&(1<<HumanoidModel::eAnim_DisableRenderArm0))==0)
{ {
humanoidModel->arm0->render(1 / 16.0f,true); humanoidModel->arm0->render(1 / 16.0f,true);
@ -523,13 +575,11 @@ void PlayerRenderer::renderHand()
void PlayerRenderer::setupPosition(shared_ptr<LivingEntity> _mob, double x, double y, double z) void PlayerRenderer::setupPosition(shared_ptr<LivingEntity> _mob, double x, double y, double z)
{ {
// 4J - dynamic cast required because we aren't using templates/generics in our version
shared_ptr<Player> mob = dynamic_pointer_cast<Player>(_mob); shared_ptr<Player> mob = dynamic_pointer_cast<Player>(_mob);
if (mob->isAlive() && mob->isSleeping()) if (mob->isAlive() && mob->isSleeping())
{ {
LivingEntityRenderer::setupPosition(mob, x + mob->bedOffsetX, y + mob->bedOffsetY, z + mob->bedOffsetZ); LivingEntityRenderer::setupPosition(mob, x + mob->bedOffsetX, y + mob->bedOffsetY, z + mob->bedOffsetZ);
} }
else else
{ {
@ -543,7 +593,6 @@ void PlayerRenderer::setupPosition(shared_ptr<LivingEntity> _mob, double x, doub
void PlayerRenderer::setupRotations(shared_ptr<LivingEntity> _mob, float bob, float bodyRot, float a) void PlayerRenderer::setupRotations(shared_ptr<LivingEntity> _mob, float bob, float bodyRot, float a)
{ {
// 4J - dynamic cast required because we aren't using templates/generics in our version
shared_ptr<Player> mob = dynamic_pointer_cast<Player>(_mob); shared_ptr<Player> mob = dynamic_pointer_cast<Player>(_mob);
if (mob->isAlive() && mob->isSleeping()) if (mob->isAlive() && mob->isSleeping())
@ -558,18 +607,16 @@ void PlayerRenderer::setupRotations(shared_ptr<LivingEntity> _mob, float bob, fl
} }
} }
// 4J Added override to stop rendering shadow if player is invisible
void PlayerRenderer::renderShadow(shared_ptr<Entity> e, double x, double y, double z, float pow, float a) void PlayerRenderer::renderShadow(shared_ptr<Entity> e, double x, double y, double z, float pow, float a)
{ {
if(app.GetGameHostOption(eGameHostOption_HostCanBeInvisible) > 0) if(app.GetGameHostOption(eGameHostOption_HostCanBeInvisible) > 0)
{ {
shared_ptr<Player> player = dynamic_pointer_cast<Player>(e); shared_ptr<Player> player = dynamic_pointer_cast<Player>(e);
if(player != nullptr && player->hasInvisiblePrivilege()) return; if(player != NULL && player->hasInvisiblePrivilege()) return;
} }
EntityRenderer::renderShadow(e,x,y,z,pow,a); EntityRenderer::renderShadow(e,x,y,z,pow,a);
} }
// 4J Added override
void PlayerRenderer::bindTexture(shared_ptr<Entity> entity) void PlayerRenderer::bindTexture(shared_ptr<Entity> entity)
{ {
shared_ptr<Player> player = dynamic_pointer_cast<Player>(entity); shared_ptr<Player> player = dynamic_pointer_cast<Player>(entity);
@ -579,5 +626,5 @@ void PlayerRenderer::bindTexture(shared_ptr<Entity> entity)
ResourceLocation *PlayerRenderer::getTextureLocation(shared_ptr<Entity> entity) ResourceLocation *PlayerRenderer::getTextureLocation(shared_ptr<Entity> entity)
{ {
shared_ptr<Player> player = dynamic_pointer_cast<Player>(entity); shared_ptr<Player> player = dynamic_pointer_cast<Player>(entity);
return new ResourceLocation(static_cast<_TEXTURE_NAME>(player->getTexture())); return new ResourceLocation((_TEXTURE_NAME)player->getTexture());
} }

View file

@ -16,11 +16,17 @@ private:
HumanoidModel *humanoidModel; HumanoidModel *humanoidModel;
HumanoidModel *armorParts1; HumanoidModel *armorParts1;
HumanoidModel *armorParts2; HumanoidModel *armorParts2;
int m_iCurrentPlayerModelType;
int m_iCurrentPlayerTexWidth;
int m_iCurrentPlayerTexHeight;
public: public:
PlayerRenderer(); PlayerRenderer();
static unsigned int getNametagColour(int index); static unsigned int getNametagColour(int index);
void createArmorParts(bool slimArms);
void setPlayerModelType(int type);
void setPlayerSkinModel(int type, int texWidth, int texHeight);
private: private:
static const wstring MATERIAL_NAMES[5]; static const wstring MATERIAL_NAMES[5];

Some files were not shown because too many files have changed in this diff Show more