diff --git a/Minecraft.Client/Common/Consoles_App.cpp b/Minecraft.Client/Common/Consoles_App.cpp index 0a2fd159a4..2dd3882eb0 100644 --- a/Minecraft.Client/Common/Consoles_App.cpp +++ b/Minecraft.Client/Common/Consoles_App.cpp @@ -9201,7 +9201,14 @@ bool CMinecraftApp::DLCContentRetrieved(eDLCMarketplaceType eType) void CMinecraftApp::SetAdditionalSkinBoxes(DWORD dwSkinID, SKIN_BOX *SkinBoxA, DWORD dwSkinBoxC) { EntityRenderer *renderer = EntityRenderDispatcher::instance->getRenderer(eTYPE_PLAYER); - Model *pModel = renderer->getModel(); + unsigned int m_uiAnimOverrideBitmask = Player::getSkinAnimOverrideBitmask(dwSkinID); + Model *pModel; + if (m_uiAnimOverrideBitmask&(1<getModelClassic(); + else if (m_uiAnimOverrideBitmask&(1<getModelSlim(); + else + pModel = renderer->getModel(); vector *pvModelPart = new vector; vector *pvSkinBoxes = new vector; @@ -9233,7 +9240,14 @@ void CMinecraftApp::SetAdditionalSkinBoxes(DWORD dwSkinID, SKIN_BOX *SkinBoxA, D vector * CMinecraftApp::SetAdditionalSkinBoxes(DWORD dwSkinID, vector *pvSkinBoxA) { EntityRenderer *renderer = EntityRenderDispatcher::instance->getRenderer(eTYPE_PLAYER); - Model *pModel = renderer->getModel(); + unsigned int m_uiAnimOverrideBitmask = Player::getSkinAnimOverrideBitmask(dwSkinID); + Model *pModel; + if (m_uiAnimOverrideBitmask&(1<getModelClassic(); + else if (m_uiAnimOverrideBitmask&(1<getModelSlim(); + else + pModel = renderer->getModel(); vector *pvModelPart = new vector; EnterCriticalSection( &csAdditionalModelParts ); diff --git a/Minecraft.Client/Common/DLC/DLCManager.cpp b/Minecraft.Client/Common/DLC/DLCManager.cpp index c363becf43..f56b48b5fa 100644 --- a/Minecraft.Client/Common/DLC/DLCManager.cpp +++ b/Minecraft.Client/Common/DLC/DLCManager.cpp @@ -24,6 +24,7 @@ const WCHAR *DLCManager::wchTypeNamesA[]= L"ENCHANTTEXTFOCUSCOLOUR", L"DATAPATH", L"PACKVERSION", + L"OFFSET", }; DLCManager::DLCManager() diff --git a/Minecraft.Client/Common/DLC/DLCManager.h b/Minecraft.Client/Common/DLC/DLCManager.h index f114bd0756..a51160d777 100644 --- a/Minecraft.Client/Common/DLC/DLCManager.h +++ b/Minecraft.Client/Common/DLC/DLCManager.h @@ -45,6 +45,7 @@ class DLCManager e_DLCParamType_EnchantmentTextFocusColour, e_DLCParamType_DataPath, e_DLCParamType_PackVersion, + e_DLCParamType_Offset, e_DLCParamType_Max, diff --git a/Minecraft.Client/Common/DLC/DLCSkinFile.cpp b/Minecraft.Client/Common/DLC/DLCSkinFile.cpp index f7ef2ad005..3e36f36f64 100644 --- a/Minecraft.Client/Common/DLC/DLCSkinFile.cpp +++ b/Minecraft.Client/Common/DLC/DLCSkinFile.cpp @@ -113,12 +113,12 @@ void DLCSkinFile::addParameter(DLCManager::EDLCParameterType type, const wstring WCHAR wchBodyPart[10]; SKIN_BOX *pSkinBox = new SKIN_BOX; ZeroMemory(pSkinBox,sizeof(SKIN_BOX)); - + #ifdef __PS3__ // 4J Stu - The Xbox version used swscanf_s which isn't available in GCC. - swscanf(value.c_str(), L"%10ls%f%f%f%f%f%f%f%f", wchBodyPart, + swscanf(value.c_str(), L"%10ls%f%f%f%f%f%f%f%f%f%f", wchBodyPart, #else - swscanf_s(value.c_str(), L"%9ls%f%f%f%f%f%f%f%f", wchBodyPart,10, + swscanf_s(value.c_str(), L"%9ls%f%f%f%f%f%f%f%f%f%f", wchBodyPart,10, #endif &pSkinBox->fX, &pSkinBox->fY, @@ -127,7 +127,9 @@ void DLCSkinFile::addParameter(DLCManager::EDLCParameterType type, const wstring &pSkinBox->fH, &pSkinBox->fD, &pSkinBox->fU, - &pSkinBox->fV); + &pSkinBox->fV, + &pSkinBox->fA, + &pSkinBox->fM); if(wcscmp(wchBodyPart,L"HEAD")==0) { @@ -153,11 +155,199 @@ void DLCSkinFile::addParameter(DLCManager::EDLCParameterType type, const wstring { pSkinBox->ePart=eBodyPart_Leg1; } + else if(wcscmp(wchBodyPart,L"HEADWEAR")==0) + { + pSkinBox->ePart=eBodyPart_Headwear; + } + else if(wcscmp(wchBodyPart,L"JACKET")==0) + { + pSkinBox->ePart=eBodyPart_Jacket; + } + else if(wcscmp(wchBodyPart,L"SLEEVE0")==0) + { + pSkinBox->ePart=eBodyPart_Sleeve0; + } + else if(wcscmp(wchBodyPart,L"SLEEVE1")==0) + { + pSkinBox->ePart=eBodyPart_Sleeve1; + } + else if(wcscmp(wchBodyPart,L"PANTS0")==0) + { + pSkinBox->ePart=eBodyPart_Pants0; + } + else if(wcscmp(wchBodyPart,L"PANTS1")==0) + { + pSkinBox->ePart=eBodyPart_Pants1; + } + else if(wcscmp(wchBodyPart,L"WAIST")==0) + { + pSkinBox->ePart=eBodyPart_Waist; + } + else if(wcscmp(wchBodyPart,L"LEGGING0")==0) + { + pSkinBox->ePart=eBodyPart_Legging0; + } + else if(wcscmp(wchBodyPart,L"LEGGING1")==0) + { + pSkinBox->ePart=eBodyPart_Legging1; + } + else if(wcscmp(wchBodyPart,L"SOCK0")==0) + { + pSkinBox->ePart=eBodyPart_Sock0; + } + else if(wcscmp(wchBodyPart,L"SOCK1")==0) + { + pSkinBox->ePart=eBodyPart_Sock1; + } + else if(wcscmp(wchBodyPart,L"BOOT0")==0) + { + pSkinBox->ePart=eBodyPart_Boot0; + } + else if(wcscmp(wchBodyPart,L"BOOT1")==0) + { + pSkinBox->ePart=eBodyPart_Boot1; + } + else if(wcscmp(wchBodyPart,L"ARMARMOR0")==0) + { + pSkinBox->ePart=eBodyPart_ArmArmor0; + } + else if(wcscmp(wchBodyPart,L"ARMARMOR1")==0) + { + pSkinBox->ePart=eBodyPart_ArmArmor1; + } + else if(wcscmp(wchBodyPart,L"BODYARMOR")==0) + { + pSkinBox->ePart=eBodyPart_BodyArmor; + } + else if(wcscmp(wchBodyPart,L"BELT")==0) + { + pSkinBox->ePart=eBodyPart_Belt; + } // add this to the skin's vector of parts m_AdditionalBoxes.push_back(pSkinBox); } break; + case DLCManager::e_DLCParamType_Offset: + { + WCHAR wchBodyPart[2]; + SKIN_OFFSET *pSkinOffset = new SKIN_OFFSET; + ZeroMemory(pSkinOffset,sizeof(SKIN_OFFSET)); + +#ifdef __PS3__ + // 4J Stu - The Xbox version used swscanf_s which isn't available in GCC. + swscanf(value.c_str(), L"%10ls%f%f", wchBodyPart, +#else + swscanf_s(value.c_str(), L"%9ls%f%f", wchBodyPart,2, +#endif + &pSkinOffset->fD, + &pSkinOffset->fO); + + if(wcscmp(wchBodyPart,L"HEAD")==0) + { + pSkinOffset->ePart=eBodyOffset_Head; + } + else if(wcscmp(wchBodyPart,L"BODY")==0) + { + pSkinOffset->ePart=eBodyOffset_Body; + } + else if(wcscmp(wchBodyPart,L"ARM0")==0) + { + pSkinOffset->ePart=eBodyOffset_Arm0; + } + else if(wcscmp(wchBodyPart,L"ARM1")==0) + { + pSkinOffset->ePart=eBodyOffset_Arm1; + } + else if(wcscmp(wchBodyPart,L"LEG0")==0) + { + pSkinOffset->ePart=eBodyOffset_Leg0; + } + else if(wcscmp(wchBodyPart,L"LEG1")==0) + { + pSkinOffset->ePart=eBodyOffset_Leg1; + } + else if(wcscmp(wchBodyPart,L"HEADWEAR")==0) + { + pSkinOffset->ePart=eBodyOffset_Headwear; + } + else if(wcscmp(wchBodyPart,L"JACKET")==0) + { + pSkinOffset->ePart=eBodyOffset_Jacket; + } + else if(wcscmp(wchBodyPart,L"SLEEVE0")==0) + { + pSkinOffset->ePart=eBodyOffset_Sleeve0; + } + else if(wcscmp(wchBodyPart,L"SLEEVE1")==0) + { + pSkinOffset->ePart=eBodyOffset_Sleeve1; + } + else if(wcscmp(wchBodyPart,L"PANTS0")==0) + { + pSkinOffset->ePart=eBodyOffset_Pants0; + } + else if(wcscmp(wchBodyPart,L"PANTS1")==0) + { + pSkinOffset->ePart=eBodyOffset_Pants1; + } + else if(wcscmp(wchBodyPart,L"WAIST")==0) + { + pSkinOffset->ePart=eBodyOffset_Waist; + } + else if(wcscmp(wchBodyPart,L"LEGGING0")==0) + { + pSkinOffset->ePart=eBodyOffset_Legging0; + } + else if(wcscmp(wchBodyPart,L"LEGGING1")==0) + { + pSkinOffset->ePart=eBodyOffset_Legging1; + } + else if(wcscmp(wchBodyPart,L"SOCK0")==0) + { + pSkinOffset->ePart=eBodyOffset_Sock0; + } + else if(wcscmp(wchBodyPart,L"SOCK1")==0) + { + pSkinOffset->ePart=eBodyOffset_Sock1; + } + else if(wcscmp(wchBodyPart,L"BOOT0")==0) + { + pSkinOffset->ePart=eBodyOffset_Boot0; + } + else if(wcscmp(wchBodyPart,L"BOOT1")==0) + { + pSkinOffset->ePart=eBodyOffset_Boot1; + } + else if(wcscmp(wchBodyPart,L"ARMARMOR1")==0) + { + pSkinOffset->ePart=eBodyOffset_ArmArmor1; + } + else if(wcscmp(wchBodyPart,L"ARMARMOR0")==0) + { + pSkinOffset->ePart=eBodyOffset_ArmArmor0; + } + else if(wcscmp(wchBodyPart,L"BODYARMOR")==0) + { + pSkinOffset->ePart=eBodyOffset_BodyArmor; + } + else if(wcscmp(wchBodyPart,L"BELT")==0) + { + pSkinOffset->ePart=eBodyOffset_Belt; + } + else if(wcscmp(wchBodyPart,L"TOOL0")==0) + { + pSkinOffset->ePart=eBodyOffset_Tool0; + } + else if(wcscmp(wchBodyPart,L"TOOL1")==0) + { + pSkinOffset->ePart=eBodyOffset_Tool1; + } + + // add this to the skin's vector of offsets + m_Offsets.push_back(pSkinOffset); + } + break; case DLCManager::e_DLCParamType_Anim: #ifdef __PS3__ // 4J Stu - The Xbox version used swscanf_s which isn't available in GCC. @@ -185,6 +375,15 @@ vector *DLCSkinFile::getAdditionalBoxes() return &m_AdditionalBoxes; } +int DLCSkinFile::getOffsetsCount() +{ + return static_cast(m_Offsets.size()); +} +vector *DLCSkinFile::getOffsets() +{ + return &m_Offsets; +} + wstring DLCSkinFile::getParameterAsString(DLCManager::EDLCParameterType type) { switch(type) diff --git a/Minecraft.Client/Common/DLC/DLCSkinFile.h b/Minecraft.Client/Common/DLC/DLCSkinFile.h index 15a50e7178..3b25861e8b 100644 --- a/Minecraft.Client/Common/DLC/DLCSkinFile.h +++ b/Minecraft.Client/Common/DLC/DLCSkinFile.h @@ -1,6 +1,8 @@ #pragma once #include "DLCFile.h" #include "..\..\..\Minecraft.Client\HumanoidModel.h" +// This is added to prevent a building failure, probably should move it to HumanoidModel.h later - Langtanium +#include "..\..\..\Minecraft.Client\SkinOffset.h" class DLCSkinFile : public DLCFile { @@ -12,6 +14,7 @@ class DLCSkinFile : public DLCFile unsigned int m_uiAnimOverrideBitmask; bool m_bIsFree; vector m_AdditionalBoxes; + vector m_Offsets; public: @@ -24,6 +27,8 @@ class DLCSkinFile : public DLCFile bool getParameterAsBool(DLCManager::EDLCParameterType type) override; vector *getAdditionalBoxes(); int getAdditionalBoxesCount(); + vector *getOffsets(); + int getOffsetsCount(); unsigned int getAnimOverrideBitmask() { return m_uiAnimOverrideBitmask;} bool isFree() {return m_bIsFree;} }; \ No newline at end of file diff --git a/Minecraft.Client/Common/UI/UIControl_PlayerSkinPreview.cpp b/Minecraft.Client/Common/UI/UIControl_PlayerSkinPreview.cpp index b8c439b1a5..be6169c3d6 100644 --- a/Minecraft.Client/Common/UI/UIControl_PlayerSkinPreview.cpp +++ b/Minecraft.Client/Common/UI/UIControl_PlayerSkinPreview.cpp @@ -257,7 +257,15 @@ void UIControl_PlayerSkinPreview::render(EntityRenderer *renderer, double x, dou glPushMatrix(); glDisable(GL_CULL_FACE); - HumanoidModel *model = static_cast(renderer->getModel()); + HumanoidModel *model; + Textures *t = Minecraft::GetInstance()->textures; + + if ((t->loadMemTexture(m_customTextureUrl, m_backupTexture) >= 45 && t->loadMemTexture(m_customTextureUrl, m_backupTexture) <= 53) || m_uiAnimOverrideBitmask&(1<(renderer->getModelSlim()); + else if (t->loadMemTexture(m_customTextureUrl, m_backupTexture) == 54 || m_uiAnimOverrideBitmask&(1<(renderer->getModelClassic()); + else + model = static_cast(renderer->getModel()); //getAttackAnim(mob, a); //if (armor != nullptr) armor->attackTime = model->attackTime; diff --git a/Minecraft.Client/Common/UI/UIScene_SkinSelectMenu.cpp b/Minecraft.Client/Common/UI/UIScene_SkinSelectMenu.cpp index a3482a24d1..2c179d9d74 100644 --- a/Minecraft.Client/Common/UI/UIScene_SkinSelectMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_SkinSelectMenu.cpp @@ -24,6 +24,16 @@ const WCHAR *UIScene_SkinSelectMenu::wchDefaultNamesA[]= L"Prisoner Steve", L"Cyclist Steve", L"Boxer Steve", + L"Alex", + L"Tennis Alex", + L"Tuxedo Alex", + L"Athlete Alex", + L"Swedish Alex", + L"Prisoner Alex", + L"Cyclist Alex", + L"Boxer Alex", + L"Developer Alex", + L"Developer Steve", }; UIScene_SkinSelectMenu::UIScene_SkinSelectMenu(int iPad, void *initData, UILayer *parentLayer) : UIScene(iPad, parentLayer) @@ -993,6 +1003,36 @@ TEXTURE_NAME UIScene_SkinSelectMenu::getTextureId(int skinIndex) case eDefaultSkins_Skin7: texture = TN_MOB_CHAR7; break; + case eDefaultSkins_Skin8: + texture = TN_MOB_ALEX; + break; + case eDefaultSkins_Skin9: + texture = TN_MOB_ALEX1; + break; + case eDefaultSkins_Skin10: + texture = TN_MOB_ALEX2; + break; + case eDefaultSkins_Skin11: + texture = TN_MOB_ALEX3; + break; + case eDefaultSkins_Skin12: + texture = TN_MOB_ALEX4; + break; + case eDefaultSkins_Skin13: + texture = TN_MOB_ALEX5; + break; + case eDefaultSkins_Skin14: + texture = TN_MOB_ALEX6; + break; + case eDefaultSkins_Skin15: + texture = TN_MOB_ALEX7; + break; + case eDefaultSkins_Skin16: + texture = TN_MOB_DEVALEX; + break; + case eDefaultSkins_Skin17: + texture = TN_MOB_DEVSTEVE; + break; }; return texture; diff --git a/Minecraft.Client/Common/res/1_2_2/mob/DevAlex.png b/Minecraft.Client/Common/res/1_2_2/mob/DevAlex.png new file mode 100644 index 0000000000..9db32e3d85 Binary files /dev/null and b/Minecraft.Client/Common/res/1_2_2/mob/DevAlex.png differ diff --git a/Minecraft.Client/Common/res/1_2_2/mob/DevSteve.png b/Minecraft.Client/Common/res/1_2_2/mob/DevSteve.png new file mode 100644 index 0000000000..652a7c4279 Binary files /dev/null and b/Minecraft.Client/Common/res/1_2_2/mob/DevSteve.png differ diff --git a/Minecraft.Client/Common/res/1_2_2/mob/alex.png b/Minecraft.Client/Common/res/1_2_2/mob/alex.png new file mode 100644 index 0000000000..b643fe2d08 Binary files /dev/null and b/Minecraft.Client/Common/res/1_2_2/mob/alex.png differ diff --git a/Minecraft.Client/Common/res/1_2_2/mob/alex1.png b/Minecraft.Client/Common/res/1_2_2/mob/alex1.png new file mode 100644 index 0000000000..3f6abf7e04 Binary files /dev/null and b/Minecraft.Client/Common/res/1_2_2/mob/alex1.png differ diff --git a/Minecraft.Client/Common/res/1_2_2/mob/alex2.png b/Minecraft.Client/Common/res/1_2_2/mob/alex2.png new file mode 100644 index 0000000000..6f42db335c Binary files /dev/null and b/Minecraft.Client/Common/res/1_2_2/mob/alex2.png differ diff --git a/Minecraft.Client/Common/res/1_2_2/mob/alex3.png b/Minecraft.Client/Common/res/1_2_2/mob/alex3.png new file mode 100644 index 0000000000..a67a3c8234 Binary files /dev/null and b/Minecraft.Client/Common/res/1_2_2/mob/alex3.png differ diff --git a/Minecraft.Client/Common/res/1_2_2/mob/alex4.png b/Minecraft.Client/Common/res/1_2_2/mob/alex4.png new file mode 100644 index 0000000000..a73a9314ab Binary files /dev/null and b/Minecraft.Client/Common/res/1_2_2/mob/alex4.png differ diff --git a/Minecraft.Client/Common/res/1_2_2/mob/alex5.png b/Minecraft.Client/Common/res/1_2_2/mob/alex5.png new file mode 100644 index 0000000000..a81c05fcc1 Binary files /dev/null and b/Minecraft.Client/Common/res/1_2_2/mob/alex5.png differ diff --git a/Minecraft.Client/Common/res/1_2_2/mob/alex6.png b/Minecraft.Client/Common/res/1_2_2/mob/alex6.png new file mode 100644 index 0000000000..eed411793c Binary files /dev/null and b/Minecraft.Client/Common/res/1_2_2/mob/alex6.png differ diff --git a/Minecraft.Client/Common/res/1_2_2/mob/alex7.png b/Minecraft.Client/Common/res/1_2_2/mob/alex7.png new file mode 100644 index 0000000000..cb20ba3aab Binary files /dev/null and b/Minecraft.Client/Common/res/1_2_2/mob/alex7.png differ diff --git a/Minecraft.Client/EntityRenderer.cpp b/Minecraft.Client/EntityRenderer.cpp index fa41dfa606..637b6315af 100644 --- a/Minecraft.Client/EntityRenderer.cpp +++ b/Minecraft.Client/EntityRenderer.cpp @@ -19,6 +19,8 @@ ResourceLocation EntityRenderer::SHADOW_LOCATION = ResourceLocation(TN__CLAMP__M EntityRenderer::EntityRenderer() { model = nullptr; + modelClassic = nullptr; + modelSlim = nullptr; tileRenderer = new TileRenderer(); shadowRadius = 0; shadowStrength = 1.0f; diff --git a/Minecraft.Client/EntityRenderer.h b/Minecraft.Client/EntityRenderer.h index ef3b63bdc2..a60b3a1452 100644 --- a/Minecraft.Client/EntityRenderer.h +++ b/Minecraft.Client/EntityRenderer.h @@ -30,6 +30,8 @@ class EntityRenderer protected: Model *model; // TODO 4J: Check why exactly this is here, it seems to get shadowed by classes inheriting from this by their own + Model *modelClassic; + Model *modelSlim; protected: TileRenderer *tileRenderer; // 4J - changed to protected so derived classes can use instead of shadowing their own @@ -68,5 +70,7 @@ class EntityRenderer public: // 4J Added virtual Model *getModel() { return model; } + virtual Model *getModelClassic() { return modelClassic; } + virtual Model *getModelSlim() { return modelSlim; } virtual void SetItemFrame(bool bSet) {} }; diff --git a/Minecraft.Client/HumanoidModel.cpp b/Minecraft.Client/HumanoidModel.cpp index f44654c33b..509da6d365 100644 --- a/Minecraft.Client/HumanoidModel.cpp +++ b/Minecraft.Client/HumanoidModel.cpp @@ -9,6 +9,7 @@ ModelPart * HumanoidModel::AddOrRetrievePart(SKIN_BOX *pBox) { ModelPart *pAttachTo=nullptr; + float scale=0; switch(pBox->ePart) { @@ -30,6 +31,26 @@ ModelPart * HumanoidModel::AddOrRetrievePart(SKIN_BOX *pBox) case eBodyPart_Leg1: pAttachTo=leg1; break; + case eBodyPart_Jacket: + pAttachTo=jacket; + scale=0.25; + break; + case eBodyPart_Sleeve0: + pAttachTo=sleeve0; + scale=0.25; + break; + case eBodyPart_Sleeve1: + pAttachTo=sleeve1; + scale=0.25; + break; + case eBodyPart_Pants0: + pAttachTo=pants0; + scale=0.25; + break; + case eBodyPart_Pants1: + pAttachTo=pants1; + scale=0.25; + break; } // first check this box doesn't already exist @@ -49,7 +70,8 @@ ModelPart * HumanoidModel::AddOrRetrievePart(SKIN_BOX *pBox) pNewBox = new ModelPart(this, static_cast(pBox->fU), static_cast(pBox->fV)); pNewBox->visible=false; - pNewBox->addHumanoidBox(pBox->fX, pBox->fY, pBox->fZ, pBox->fW, pBox->fH, pBox->fD, 0); + if (pBox->fM > 0) pNewBox->bMirror = true; + pNewBox->addHumanoidBox(pBox->fX, pBox->fY, pBox->fZ, pBox->fW, pBox->fH, pBox->fD, scale); // 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); @@ -58,47 +80,110 @@ ModelPart * HumanoidModel::AddOrRetrievePart(SKIN_BOX *pBox) 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 slimHands, bool isArmor) { this->texWidth = texWidth; this->texHeight = texHeight; + jacket = nullptr; + sleeve0 = nullptr; + sleeve1 = nullptr; + pants0 = nullptr; + pants1 = nullptr; + m_fYOffset=yOffset; - cloak = new ModelPart(this, 0, 0); - cloak->addHumanoidBox(-5, -0, -1, 10, 16, 1, g); // Cloak - - ear = new ModelPart(this, 24, 0); - ear->addHumanoidBox(-3, -6, -1, 6, 6, 1, g); // Ear - - head = new ModelPart(this, 0, 0); - head->addHumanoidBox(-4, -8, -4, 8, 8, 8, g); // Head - head->setPos(0, 0 + yOffset, 0); - - hair = new ModelPart(this, 32, 0); - hair->addHumanoidBox(-4, -8, -4, 8, 8, 8, g + 0.5f); // Head - hair->setPos(0, 0 + yOffset, 0); - - body = new ModelPart(this, 16, 16); - body->addHumanoidBox(-4, 0, -2, 8, 12, 4, g); // Body - body->setPos(0, 0 + yOffset, 0); - - arm0 = new ModelPart(this, 24 + 16, 16); - arm0->addHumanoidBox(-3, -2, -2, 4, 12, 4, g); // Arm0 - arm0->setPos(-5, 2 + yOffset, 0); - - arm1 = new ModelPart(this, 24 + 16, 16); - arm1->bMirror = true; - arm1->addHumanoidBox(-1, -2, -2, 4, 12, 4, g); // Arm1 - arm1->setPos(5, 2 + yOffset, 0); - - leg0 = new ModelPart(this, 0, 16); - leg0->addHumanoidBox(-2, 0, -2, 4, 12, 4, g); // Leg0 - leg0->setPos(-1.9, 12 + yOffset, 0); - - leg1 = new ModelPart(this, 0, 16); - leg1->bMirror = true; - leg1->addHumanoidBox(-2, 0, -2, 4, 12, 4, g); // Leg1 - leg1->setPos(1.9, 12 + yOffset, 0); + cloak = new ModelPart(this, 0, 0); + cloak->addHumanoidBox(-5, -0, -1, 10, 16, 1, g); // Cloak + + ear = new ModelPart(this, 24, 0); + ear->addHumanoidBox(-3, -6, -1, 6, 6, 1, g); // Ear + + head = new ModelPart(this, 0, 0); + head->addHumanoidBox(-4, -8, -4, 8, 8, 8, g); // Head + head->setPos(0, 0 + yOffset, 0); + + hair = new ModelPart(this, 32, 0); + hair->addHumanoidBox(-4, -8, -4, 8, 8, 8, g + 0.5f); // Head + hair->setPos(0, 0 + yOffset, 0); + + body = new ModelPart(this, 16, 16); + body->addHumanoidBox(-4, 0, -2, 8, 12, 4, g); // Body + body->setPos(0, 0 + yOffset, 0); + + if (texHeight == 64) + { + jacket = new ModelPart(this, 16, 32); + jacket->addHumanoidBox(-4, 0, -2, 8, 12, 4, g + 0.25); // Jacket + jacket->setPos(0, 0 + yOffset, 0); + } + + if (texHeight == 64) + { + arm0 = new ModelPart(this, 24 + 16, 16); + arm1 = new ModelPart(this, 16 + 16, 48); + + sleeve0 = new ModelPart(this, 24 + 16, 32); + sleeve1 = new ModelPart(this, 32 + 16, 48); + + if (slimHands == false) + { + sleeve0->addHumanoidBox(-3, -2, -2, 4, 12, 4, g + 0.25); // Sleeve0 + sleeve1->addHumanoidBox(-1, -2, -2, 4, 12, 4, g + 0.25); // Sleeve1 + } + else if (slimHands == true) + { + sleeve0->addHumanoidBox(-2, -2, -2, 3, 12, 4, g + 0.25); // Sleeve0 Slim + sleeve1->addHumanoidBox(-1, -2, -2, 3, 12, 4, g + 0.25); // Sleeve1 Slim + } + + sleeve0->setPos(-5, 2 + yOffset, 0); + sleeve1->setPos(5, 2 + yOffset, 0); + } + else if (texHeight == 32) + { + arm0 = new ModelPart(this, 24 + 16, 16); + arm1 = new ModelPart(this, 24 + 16, 16); + arm1->bMirror = true; + } + + if (slimHands == false) + { + arm0->addHumanoidBox(-3, -2, -2, 4, 12, 4, g); // Arm0 + arm1->addHumanoidBox(-1, -2, -2, 4, 12, 4, g); // Arm1 + } + else if (slimHands == true) + { + arm0->addHumanoidBox(-2, -2, -2, 3, 12, 4, g); // Arm0 Slim + arm1->addHumanoidBox(-1, -2, -2, 3, 12, 4, g); // Arm1 Slim + } + + arm0->setPos(-5, 2 + yOffset, 0); + arm1->setPos(5, 2 + yOffset, 0); + + leg0 = new ModelPart(this, 0, 16); + if (texHeight == 64) + { + leg1 = new ModelPart(this, 16, 48); + + pants0 = new ModelPart(this, 0, 32); + pants0->addHumanoidBox(-2, 0, -2, 4, 12, 4, g + 0.25); // Pants0 + pants0->setPos(-1.9, 12 + yOffset, 0); + + pants1 = new ModelPart(this, 0, 48); + pants1->addHumanoidBox(-2, 0, -2, 4, 12, 4, g + 0.25); // Pants1 + pants1->setPos(1.9, 12 + yOffset, 0); + } + else if (texHeight == 32) + { + leg1 = new ModelPart(this, 0, 16); + leg1->bMirror = true; + } + + leg0->addHumanoidBox(-2, 0, -2, 4, 12, 4, g); // Leg0 + leg0->setPos(-1.9, 12 + yOffset, 0); + + leg1->addHumanoidBox(-2, 0, -2, 4, 12, 4, g); // Leg1 + leg1->setPos(1.9, 12 + yOffset, 0); // 4J added - compile now to avoid random performance hit first time cubes are rendered // 4J Stu - Not just performance, but alpha+depth tests don't work right unless we compile here @@ -112,6 +197,17 @@ void HumanoidModel::_init(float g, float yOffset, int texWidth, int texHeight) leg1->compile(1.0f/16.0f); hair->compile(1.0f/16.0f); + if (jacket != 0) + jacket->compile(1.0f/16.0f); + if (sleeve0 != 0) + sleeve0->compile(1.0f/16.0f); + if (sleeve1 != 0) + sleeve1->compile(1.0f/16.0f); + if (pants0 != 0) + pants0->compile(1.0f/16.0f); + if (pants1 != 0) + pants1->compile(1.0f/16.0f); + holdingLeftHand=0; holdingRightHand=0; sneaking=false; @@ -123,21 +219,33 @@ void HumanoidModel::_init(float g, float yOffset, int texWidth, int texHeight) eating_t = 0.0f; eating_swing = 0.0f; m_uiAnimOverrideBitmask = 0L; + m_isArmor = isArmor; } + HumanoidModel::HumanoidModel() : Model() { - _init(0, 0, 64, 32); + _init(0, 0, 64, 32, false, false); } HumanoidModel::HumanoidModel(float g) : Model() { - _init(g, 0, 64, 32); + _init(g, 0, 64, 32, false, false); +} + +HumanoidModel::HumanoidModel(float g, bool isArmor) : Model() +{ + _init(g, 0, 64, 32, false, isArmor); } HumanoidModel::HumanoidModel(float g, float yOffset, int texWidth, int texHeight) : Model() { - _init(g,yOffset,texWidth,texHeight); + _init(g,yOffset,texWidth,texHeight, false, false); +} + +HumanoidModel::HumanoidModel(float g, float yOffset, int texWidth, int texHeight, bool slimHands) : Model() +{ + _init(g,yOffset,texWidth,texHeight, slimHands, false); } void HumanoidModel::render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) @@ -170,13 +278,23 @@ void HumanoidModel::render(shared_ptr entity, float time, float r, float } else { - head->render(scale, usecompiled,(m_uiAnimOverrideBitmask&(1<0); - body->render(scale, usecompiled,(m_uiAnimOverrideBitmask&(1<0); - arm0->render(scale, usecompiled,(m_uiAnimOverrideBitmask&(1<0); - arm1->render(scale, usecompiled,(m_uiAnimOverrideBitmask&(1<0); - leg0->render(scale, usecompiled,(m_uiAnimOverrideBitmask&(1<0); - leg1->render(scale, usecompiled,(m_uiAnimOverrideBitmask&(1<0); + head->render(scale, usecompiled,(m_uiAnimOverrideBitmask&(1<0&&(!(m_uiAnimOverrideBitmask&(1<0||!m_isArmor)); + body->render(scale, usecompiled,(m_uiAnimOverrideBitmask&(1<0&&(!(m_uiAnimOverrideBitmask&(1<0||!m_isArmor)); + arm0->render(scale, usecompiled,(m_uiAnimOverrideBitmask&(1<0&&(!(m_uiAnimOverrideBitmask&(1<0||!m_isArmor)); + arm1->render(scale, usecompiled,(m_uiAnimOverrideBitmask&(1<0&&(!(m_uiAnimOverrideBitmask&(1<0||!m_isArmor)); + leg0->render(scale, usecompiled,(m_uiAnimOverrideBitmask&(1<0&&(!(m_uiAnimOverrideBitmask&(1<0||!m_isArmor)); + leg1->render(scale, usecompiled,(m_uiAnimOverrideBitmask&(1<0&&(!(m_uiAnimOverrideBitmask&(1<0||!m_isArmor)); hair->render(scale, usecompiled,(m_uiAnimOverrideBitmask&(1<0); + if (jacket != 0) + jacket->render(scale, usecompiled,(m_uiAnimOverrideBitmask&(1<0); + if (sleeve0 != 0) + sleeve0->render(scale, usecompiled,(m_uiAnimOverrideBitmask&(1<0); + if (sleeve1 != 0) + sleeve1->render(scale, usecompiled,(m_uiAnimOverrideBitmask&(1<0); + if (pants0 != 0) + pants0->render(scale, usecompiled,(m_uiAnimOverrideBitmask&(1<0); + if (pants1 != 0) + pants1->render(scale, usecompiled,(m_uiAnimOverrideBitmask&(1<0); } } @@ -199,7 +317,6 @@ void HumanoidModel::setupAnim(float time, float r, float bob, float yRot, float arm1->xRot=0.0f; arm0->zRot = 0.0f; arm1->zRot = 0.0f; - } else if(uiBitmaskOverrideAnim&(1<zRot = 0.0f; arm1->zRot = 0.0f; } - // arm0.zRot = ((float) (util.Mth.cos(time * 0.2312f) + 1) * 1) * r; + // arm0.zRot = ((float) (util.Mth.cos(time * 0.2312f) + 1) * 1) * r; - // arm1.zRot = ((float) (util.Mth.cos(time * 0.2812f) - 1) * 1) * r; + // arm1.zRot = ((float) (util.Mth.cos(time * 0.2812f) - 1) * 1) * r; leg0->yRot = 0.0f; @@ -272,7 +389,7 @@ void HumanoidModel::setupAnim(float time, float r, float bob, float yRot, float leg1->xRot=0.0f; leg1->zRot=0.0f; leg0->yRot = 0.0f; - leg1->yRot = 0.0f; + leg1->yRot = 0.0f; } else if(uiBitmaskOverrideAnim&(1<yRot = 0.0f; arm1->yRot = 0.0f; + if (attackTime > -9990.0f) { float swing = attackTime; @@ -316,7 +434,7 @@ void HumanoidModel::setupAnim(float time, float r, float bob, float yRot, float 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; + arm0->yRot += body->yRot * 2.0f; if((uiBitmaskOverrideAnim&(1<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) @@ -441,23 +558,68 @@ void HumanoidModel::setupAnim(float time, float r, float bob, float yRot, float arm0->xRot += ((float) (Mth::sin(bob * 0.067f)) * 0.05f); arm1->xRot -= ((float) (Mth::sin(bob * 0.067f)) * 0.05f); } + if (jacket != 0) + { + jacket->x = body->x; + jacket->y = body->y; + jacket->z = body->z; + jacket->xRot = body->xRot; + jacket->yRot = body->yRot; + jacket->zRot = body->zRot; + } + if (sleeve0 != 0) + { + sleeve0->x = arm0->x; + sleeve0->y = arm0->y; + sleeve0->z = arm0->z; + sleeve0->xRot = arm0->xRot; + sleeve0->yRot = arm0->yRot; + sleeve0->zRot = arm0->zRot; + } + if (sleeve1 != 0) + { + sleeve1->x = arm1->x; + sleeve1->y = arm1->y; + sleeve1->z = arm1->z; + sleeve1->xRot = arm1->xRot; + sleeve1->yRot = arm1->yRot; + sleeve1->zRot = arm1->zRot; + } + if (pants0 != 0) + { + pants0->x = leg0->x; + pants0->y = leg0->y; + pants0->z = leg0->z; + pants0->xRot = leg0->xRot; + pants0->yRot = leg0->yRot; + pants0->zRot = leg0->zRot; + } + if (pants1 != 0) + { + pants1->x = leg1->x; + pants1->y = leg1->y; + pants1->z = leg1->z; + pants1->xRot = leg1->xRot; + pants1->yRot = leg1->yRot; + pants1->zRot = leg1->zRot; + } } } void HumanoidModel::renderHair(float scale,bool usecompiled) { - hair->yRot = head->yRot; - hair->xRot = head->xRot; - hair->render(scale,usecompiled); + hair->yRot = head->yRot; + hair->xRot = head->xRot; + hair->render(scale,usecompiled); } void HumanoidModel::renderEars(float scale,bool usecompiled) { - ear->yRot = head->yRot; - ear->xRot = head->xRot; - ear->x=0; - ear->y=0; - ear->render(scale,usecompiled); + ear->yRot = head->yRot; + ear->xRot = head->xRot; + ear->x=0; + ear->y=0; + ear->render(scale,usecompiled); } void HumanoidModel::renderCloak(float scale,bool usecompiled) @@ -467,25 +629,42 @@ void HumanoidModel::renderCloak(float scale,bool usecompiled) void HumanoidModel::render(HumanoidModel *model, float scale, bool usecompiled) { - head->yRot = model->head->yRot; - head->y = model->head->y; - head->xRot = model->head->xRot; - hair->y = head->y; - hair->yRot = head->yRot; - hair->xRot = head->xRot; - - body->yRot = model->body->yRot; - - arm0->xRot = model->arm0->xRot; - arm0->yRot = model->arm0->yRot; - arm0->zRot = model->arm0->zRot; - - arm1->xRot = model->arm1->xRot; - arm1->yRot = model->arm1->yRot; - arm1->zRot = model->arm1->zRot; - - leg0->xRot = model->leg0->xRot; - leg1->xRot = model->leg1->xRot; + head->yRot = model->head->yRot; + head->y = model->head->y; + head->xRot = model->head->xRot; + hair->y = head->y; + hair->yRot = head->yRot; + hair->xRot = head->xRot; + + body->yRot = model->body->yRot; + + if (jacket != 0) + jacket->yRot = model->body->yRot; + + arm0->xRot = model->arm0->xRot; + arm0->yRot = model->arm0->yRot; + arm0->zRot = model->arm0->zRot; + + if (sleeve0 != 0) + sleeve0->xRot = model->arm0->xRot; + sleeve0->yRot = model->arm0->yRot; + sleeve0->zRot = model->arm0->zRot; + + arm1->xRot = model->arm1->xRot; + arm1->yRot = model->arm1->yRot; + arm1->zRot = model->arm1->zRot; + + if (sleeve1 != 0) + sleeve1->xRot = model->arm1->xRot; + sleeve1->yRot = model->arm1->yRot; + sleeve1->zRot = model->arm1->zRot; + + leg0->xRot = model->leg0->xRot; + if (pants0 != 0) + pants0->xRot = model->leg0->xRot; + leg1->xRot = model->leg1->xRot; + if (pants1 != 0) + pants1->xRot = model->leg1->xRot; head->render(scale, usecompiled,(m_uiAnimOverrideBitmask&(1<0); body->render(scale, usecompiled,(m_uiAnimOverrideBitmask&(1<0); @@ -494,4 +673,14 @@ void HumanoidModel::render(HumanoidModel *model, float scale, bool usecompiled) leg0->render(scale, usecompiled,(m_uiAnimOverrideBitmask&(1<0); leg1->render(scale, usecompiled,(m_uiAnimOverrideBitmask&(1<0); hair->render(scale, usecompiled,(m_uiAnimOverrideBitmask&(1<0); + if (jacket != 0) + jacket->render(scale, usecompiled,(m_uiAnimOverrideBitmask&(1<0); + if (sleeve0 != 0) + sleeve0->render(scale, usecompiled,(m_uiAnimOverrideBitmask&(1<0); + if (sleeve1 != 0) + sleeve1->render(scale, usecompiled,(m_uiAnimOverrideBitmask&(1<0); + if (pants0 != 0) + pants0->render(scale, usecompiled,(m_uiAnimOverrideBitmask&(1<0); + if (pants1 != 0) + pants1->render(scale, usecompiled,(m_uiAnimOverrideBitmask&(1<0); } diff --git a/Minecraft.Client/HumanoidModel.h b/Minecraft.Client/HumanoidModel.h index 52f9d98e1a..88a57adafb 100644 --- a/Minecraft.Client/HumanoidModel.h +++ b/Minecraft.Client/HumanoidModel.h @@ -4,7 +4,7 @@ class HumanoidModel : public Model { public: - ModelPart *head, *hair, *body, *arm0, *arm1, *leg0, *leg1, *ear, *cloak; + ModelPart *head, *hair, *body, *jacket, *arm0, *sleeve0, *arm1, *sleeve1, *leg0, *pants0, *leg1, *pants1, *ear, *cloak; //ModelPart *hat; int holdingLeftHand; @@ -17,6 +17,7 @@ class HumanoidModel : public Model float eating_swing; // 4J added unsigned int m_uiAnimOverrideBitmask; // 4J added float m_fYOffset; // 4J added + bool m_isArmor; enum animbits { eAnim_ArmsDown =0, @@ -37,7 +38,22 @@ class HumanoidModel : public Model eAnim_DisableRenderLeg0, eAnim_DisableRenderLeg1, eAnim_DisableRenderHair, - eAnim_SmallModel // Maggie Simpson for riding horse, etc + eAnim_SmallModel, // Maggie Simpson for riding horse, etc + eAnim_ClassicModel, + eAnim_SlimModel, + // Hide overlay/second layer on 64x64 skins + eAnim_DisableRenderSleeve1, + eAnim_DisableRenderSleeve0, + eAnim_DisableRenderPants1, + eAnim_DisableRenderPants0, + eAnim_DisableRenderJacket, + eAnim_RenderArmorHead, + eAnim_RenderArmorArm0, + eAnim_RenderArmorArm1, + eAnim_RenderArmorTorso, + eAnim_RenderArmorLeg0, + eAnim_RenderArmorLeg1, + eAnim_Dinnerbone }; @@ -47,13 +63,20 @@ class HumanoidModel : public Model (1< 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, unsigned int uiBitmaskOverrideAnim = 0); void renderHair(float scale, bool usecompiled); diff --git a/Minecraft.Client/LivingEntityRenderer.cpp b/Minecraft.Client/LivingEntityRenderer.cpp index b3478ba92c..aa738ec772 100644 --- a/Minecraft.Client/LivingEntityRenderer.cpp +++ b/Minecraft.Client/LivingEntityRenderer.cpp @@ -9,13 +9,29 @@ #include "..\Minecraft.World\Mth.h" #include "..\Minecraft.World\Player.h" - ResourceLocation LivingEntityRenderer::ENCHANT_GLINT_LOCATION = ResourceLocation(TN__BLUR__MISC_GLINT); int LivingEntityRenderer::MAX_ARMOR_LAYERS = 4; LivingEntityRenderer::LivingEntityRenderer(Model *model, float shadow) { this->model = model; + + shadowRadius = shadow; + armor = nullptr; +} + +LivingEntityRenderer::LivingEntityRenderer(Model *model, float shadow, bool slimHands, bool is64x64) +{ + this->model = model; + + if (is64x64) + { + this->modelClassic = new HumanoidModel(0, 0, 64, 64, false); + + if (slimHands == true) + this->modelSlim = new HumanoidModel(0, 0, 64, 64, true); + } + shadowRadius = shadow; armor = nullptr; } @@ -43,6 +59,8 @@ void LivingEntityRenderer::render(shared_ptr _mob, double x, double y, d } shared_ptr mob = dynamic_pointer_cast(_mob); + shared_ptr player = dynamic_pointer_cast(_mob); + Model *resModel; if (mob == nullptr) { @@ -52,12 +70,16 @@ void LivingEntityRenderer::render(shared_ptr _mob, double x, double y, d glPushMatrix(); glDisable(GL_CULL_FACE); - model->attackTime = getAttackAnim(mob, a); - if (armor != nullptr) armor->attackTime = model->attackTime; - model->riding = mob->isRiding(); - if (armor != nullptr) armor->riding = model->riding; - model->young = mob->isBaby(); - if (armor != nullptr) armor->young = model->young; + if (player != nullptr && modelClassic != nullptr && (player->getCustomSkin() == 18 || player->getAnimOverrideBitmask()&(1<getCustomSkin() >= 8 && player->getCustomSkin() <= 17) || player->getAnimOverrideBitmask()&(1<attackTime = getAttackAnim(mob, a); + if (armor != nullptr) armor->attackTime = resModel->attackTime; + resModel->riding = mob->isRiding(); + if (armor != nullptr) armor->riding = resModel->riding; + resModel->young = mob->isBaby(); + if (armor != nullptr) armor->young = resModel->young; /*try*/ { @@ -103,7 +125,7 @@ void LivingEntityRenderer::render(shared_ptr _mob, double x, double y, d if (ws > 1) ws = 1; glEnable(GL_ALPHA_TEST); - model->prepareMobModel(mob, wp, ws, a); + resModel->prepareMobModel(mob, wp, ws, a); renderModel(mob, wp, ws, bob, headRot - bodyRot, headRotx, fScale); for (int i = 0; i < MAX_ARMOR_LAYERS; i++) @@ -187,7 +209,7 @@ void LivingEntityRenderer::render(shared_ptr _mob, double x, double y, d if (mob->hurtTime > 0 || mob->deathTime > 0) { glColor4f(br, 0, 0, 0.4f); - model->render(mob, wp, ws, bob, headRot - bodyRot, headRotx, fScale, false); + resModel->render(mob, wp, ws, bob, headRot - bodyRot, headRotx, fScale, false); for (int i = 0; i < MAX_ARMOR_LAYERS; i++) { if (prepareArmorOverlay(mob, i, a) >= 0) @@ -205,7 +227,7 @@ void LivingEntityRenderer::render(shared_ptr _mob, double x, double y, d float b = ((overlayColor) & 0xff) / 255.0f; float aa = ((overlayColor >> 24) & 0xff) / 255.0f; glColor4f(r, g, b, aa); - model->render(mob, wp, ws, bob, headRot - bodyRot, headRotx, fScale, false); + resModel->render(mob, wp, ws, bob, headRot - bodyRot, headRotx, fScale, false); for (int i = 0; i < MAX_ARMOR_LAYERS; i++) { if (prepareArmorOverlay(mob, i, a) >= 0) @@ -242,10 +264,17 @@ void LivingEntityRenderer::render(shared_ptr _mob, double x, double y, d void LivingEntityRenderer::renderModel(shared_ptr mob, float wp, float ws, float bob, float headRotMinusBodyRot, float headRotx, float scale) { + shared_ptr player = dynamic_pointer_cast(mob); + Model *resModel; + + if (player != nullptr && modelClassic != nullptr && (player->getCustomSkin() == 18 || player->getAnimOverrideBitmask()&(1<getCustomSkin() >= 8 && player->getCustomSkin() <= 17) || player->getAnimOverrideBitmask()&(1<isInvisible()) { - model->render(mob, wp, ws, bob, headRotMinusBodyRot, headRotx, scale, true); + resModel->render(mob, wp, ws, bob, headRotMinusBodyRot, headRotx, scale, true); } else if(!mob->isInvisibleTo(dynamic_pointer_cast(Minecraft::GetInstance()->player))) { @@ -255,7 +284,7 @@ void LivingEntityRenderer::renderModel(shared_ptr mob, float wp, f glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glAlphaFunc(GL_GREATER, 1.0f / 255.0f); - model->render(mob, wp, ws, bob, headRotMinusBodyRot, headRotx, scale, true); + resModel->render(mob, wp, ws, bob, headRotMinusBodyRot, headRotx, scale, true); glDisable(GL_BLEND); glAlphaFunc(GL_GREATER, .1f); glPopMatrix(); @@ -263,7 +292,7 @@ void LivingEntityRenderer::renderModel(shared_ptr mob, float wp, f } else { - model->setupAnim(wp, ws, bob, headRotMinusBodyRot, headRotx, scale, mob); + resModel->setupAnim(wp, ws, bob, headRotMinusBodyRot, headRotx, scale, mob); } } @@ -285,7 +314,7 @@ void LivingEntityRenderer::setupRotations(shared_ptr mob, float bo else { wstring name = mob->getAName(); - if (name == L"Dinnerbone" || name == L"Grumm") + if (name == L"Dinnerbone" || name == L"Grumm" || mob->getAnimOverrideBitmask()&(1<instanceof(eTYPE_PLAYER) || !dynamic_pointer_cast(mob)->isCapeHidden() ) { @@ -313,7 +342,15 @@ void LivingEntityRenderer::additionalRendering(shared_ptr mob, flo void LivingEntityRenderer::renderArrows(shared_ptr mob, float a) { + shared_ptr player = dynamic_pointer_cast(mob); + Model *resModel; + + if (player != nullptr && modelClassic != nullptr && (player->getCustomSkin() == 18 || player->getAnimOverrideBitmask()&(1<getCustomSkin() >= 8 && player->getCustomSkin() <= 17) || player->getAnimOverrideBitmask()&(1<getArrowCount(); + if (arrowCount > 0) { shared_ptr arrow = std::make_shared(mob->level, mob->x, mob->y, mob->z); @@ -322,7 +359,10 @@ void LivingEntityRenderer::renderArrows(shared_ptr mob, float a) for (int i = 0; i < arrowCount; i++) { glPushMatrix(); - ModelPart *modelPart = model->getRandomModelPart(random); + + ModelPart *modelPart; + modelPart = resModel->getRandomModelPart(random); + Cube *cube = modelPart->cubes[random.nextInt(modelPart->cubes.size())]; modelPart->translateTo(1 / 16.0f); float xd = random.nextFloat(); diff --git a/Minecraft.Client/LivingEntityRenderer.h b/Minecraft.Client/LivingEntityRenderer.h index 2f77e1b54a..6ea76df39a 100644 --- a/Minecraft.Client/LivingEntityRenderer.h +++ b/Minecraft.Client/LivingEntityRenderer.h @@ -20,6 +20,7 @@ class LivingEntityRenderer : public EntityRenderer public: LivingEntityRenderer(Model *model, float shadow); + LivingEntityRenderer(Model *model, float shadow, bool slimHands, bool is64x64); virtual void render(shared_ptr mob, double x, double y, double z, float rot, float a); virtual void setArmor(Model *armor); diff --git a/Minecraft.Client/PlayerRenderer.cpp b/Minecraft.Client/PlayerRenderer.cpp index bc4c61a732..3a460ed792 100644 --- a/Minecraft.Client/PlayerRenderer.cpp +++ b/Minecraft.Client/PlayerRenderer.cpp @@ -55,12 +55,14 @@ static unsigned int nametagColorForIndex(int index) ResourceLocation PlayerRenderer::DEFAULT_LOCATION = ResourceLocation(TN_MOB_CHAR); -PlayerRenderer::PlayerRenderer() : LivingEntityRenderer( new HumanoidModel(0), 0.5f ) +PlayerRenderer::PlayerRenderer() : LivingEntityRenderer( new HumanoidModel(0), 0.5f, true, true ) { - humanoidModel = static_cast(model); + humanoidModel = static_cast(model); + humanoidModelClassic = static_cast(modelClassic); + humanoidModelSlim = static_cast(modelSlim); - armorParts1 = new HumanoidModel(1.0f); - armorParts2 = new HumanoidModel(0.5f); + armorParts1 = new HumanoidModel(1.0f, true); + armorParts2 = new HumanoidModel(0.5f, true); } unsigned int PlayerRenderer::getNametagColour(int index) @@ -160,12 +162,19 @@ void PlayerRenderer::render(shared_ptr _mob, double x, double y, double // 4J - dynamic cast required because we aren't using templates/generics in our version shared_ptr mob = dynamic_pointer_cast(_mob); + HumanoidModel *resModel; if(mob == nullptr) return; if(mob->hasInvisiblePrivilege()) return; + if (mob != nullptr && humanoidModelClassic != nullptr && (mob->getCustomSkin() == 18 || mob->getAnimOverrideBitmask()&(1<getCustomSkin() >= 8 && mob->getCustomSkin() <= 17) || mob->getAnimOverrideBitmask()&(1< item = mob->inventory->getSelected(); - armorParts1->holdingRightHand = armorParts2->holdingRightHand = humanoidModel->holdingRightHand = item != nullptr ? 1 : 0; + + armorParts1->holdingRightHand = armorParts2->holdingRightHand = resModel->holdingRightHand = item != nullptr ? 1 : 0; + if (item != nullptr) { if (mob->getUseItemDuration() > 0) @@ -173,11 +182,11 @@ void PlayerRenderer::render(shared_ptr _mob, double x, double y, double UseAnim anim = item->getUseAnimation(); if (anim == UseAnim_block) { - armorParts1->holdingRightHand = armorParts2->holdingRightHand = humanoidModel->holdingRightHand = 3; + armorParts1->holdingRightHand = armorParts2->holdingRightHand = resModel->holdingRightHand = 3; } else if (anim == UseAnim_bow) { - armorParts1->bowAndArrow = armorParts2->bowAndArrow = humanoidModel->bowAndArrow = true; + armorParts1->bowAndArrow = armorParts2->bowAndArrow = resModel->bowAndArrow = true; } } } @@ -187,17 +196,17 @@ void PlayerRenderer::render(shared_ptr _mob, double x, double y, double // 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 swing = 1 - (t / item->getUseDuration()); - armorParts1->eating = armorParts2->eating = humanoidModel->eating = true; - armorParts1->eating_t = armorParts2->eating_t = humanoidModel->eating_t = t; - armorParts1->eating_swing = armorParts2->eating_swing = humanoidModel->eating_swing = swing; + + armorParts1->eating = armorParts2->eating = resModel->eating = true; + armorParts1->eating_t = armorParts2->eating_t = resModel->eating_t = t; + armorParts1->eating_swing = armorParts2->eating_swing = resModel->eating_swing = swing; } else { - armorParts1->eating = armorParts2->eating = humanoidModel->eating = false; + armorParts1->eating = armorParts2->eating = resModel->eating = false; } - armorParts1->sneaking = armorParts2->sneaking = humanoidModel->sneaking = mob->isSneaking(); - + armorParts1->sneaking = armorParts2->sneaking = resModel->sneaking = mob->isSneaking(); double yp = y - mob->heightOffset; if (mob->isSneaking()) { @@ -224,20 +233,20 @@ void PlayerRenderer::render(shared_ptr _mob, double x, double y, double { if(mob->isIdle()) { - humanoidModel->idle=true; + resModel->idle=true; armorParts1->idle=true; armorParts2->idle=true; } else { - humanoidModel->idle=false; + resModel->idle=false; armorParts1->idle=false; armorParts2->idle=false; } } else { - humanoidModel->idle=false; + resModel->idle=false; armorParts1->idle=false; armorParts2->idle=false; } @@ -263,10 +272,9 @@ void PlayerRenderer::render(shared_ptr _mob, double x, double y, double pModelPart->visible=false; } } - armorParts1->bowAndArrow = armorParts2->bowAndArrow = humanoidModel->bowAndArrow = false; - armorParts1->sneaking = armorParts2->sneaking = humanoidModel->sneaking = false; - armorParts1->holdingRightHand = armorParts2->holdingRightHand = humanoidModel->holdingRightHand = 0; - + armorParts1->bowAndArrow = armorParts2->bowAndArrow = resModel->bowAndArrow = false; + armorParts1->sneaking = armorParts2->sneaking = resModel->sneaking = false; + armorParts1->holdingRightHand = armorParts2->holdingRightHand = resModel->holdingRightHand = 0; } void PlayerRenderer::additionalRendering(shared_ptr _mob, float a) @@ -279,6 +287,11 @@ void PlayerRenderer::additionalRendering(shared_ptr _mob, float a) // 4J - dynamic cast required because we aren't using templates/generics in our version shared_ptr mob = dynamic_pointer_cast(_mob); + HumanoidModel *resModel; + + if (mob != nullptr && humanoidModelClassic != nullptr && (mob->getCustomSkin() == 18 || mob->getAnimOverrideBitmask()&(1<getCustomSkin() >= 8 && mob->getCustomSkin() <= 17) || mob->getAnimOverrideBitmask()&(1< headGear = mob->inventory->getArmor(3); if (headGear != nullptr) @@ -289,7 +302,7 @@ void PlayerRenderer::additionalRendering(shared_ptr _mob, float a) if((uiAnimOverrideBitmask&(1<head->translateTo(1 / 16.0f); + resModel->head->translateTo(1 / 16.0f); if(headGear->getItem()->id < 256) { @@ -337,7 +350,7 @@ void PlayerRenderer::additionalRendering(shared_ptr _mob, float a) float s = 8 / 6.0f; glScalef(s, s, s); - humanoidModel->renderEars(1 / 16.0f,true); + resModel->renderEars(1 / 16.0f,true); glPopMatrix(); } } @@ -383,7 +396,7 @@ void PlayerRenderer::additionalRendering(shared_ptr _mob, float a) glRotatef(lean2 / 2, 0, 0, 1); glRotatef(-lean2 / 2, 0, 1, 0); glRotatef(180, 0, 1, 0); - humanoidModel->renderCloak(1 / 16.0f,true); + humanoidModel->renderCloak(1 / 16.0f,true); glPopMatrix(); } @@ -392,7 +405,7 @@ void PlayerRenderer::additionalRendering(shared_ptr _mob, float a) if (item != nullptr) { glPushMatrix(); - humanoidModel->arm0->translateTo(1 / 16.0f); + resModel->arm0->translateTo(1 / 16.0f); glTranslatef(-1 / 16.0f, 7 / 16.0f, 1 / 16.0f); if (mob->fishing != nullptr) @@ -522,30 +535,54 @@ void PlayerRenderer::scale(shared_ptr player, float a) void PlayerRenderer::renderHand() { + shared_ptr player = dynamic_pointer_cast(Minecraft::GetInstance()->player); + HumanoidModel *resModel; + + if (player != nullptr && humanoidModelClassic != nullptr && (player->getCustomSkin() == 18 || player->getAnimOverrideBitmask()&(1<getCustomSkin() >= 8 && player->getCustomSkin() <= 17) || player->getAnimOverrideBitmask()&(1<m_uiAnimOverrideBitmask = Minecraft::GetInstance()->player->getAnimOverrideBitmask(); - armorParts1->eating = armorParts2->eating = humanoidModel->eating = humanoidModel->idle = false; - humanoidModel->attackTime = 0; - humanoidModel->setupAnim(0, 0, 0, 0, 0, 1 / 16.0f, Minecraft::GetInstance()->player); + resModel->m_uiAnimOverrideBitmask = player->getAnimOverrideBitmask(); + armorParts1->eating = armorParts2->eating = resModel->eating = resModel->idle = false; + resModel->attackTime = 0; + resModel->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<arm0->render(1 / 16.0f,true); - } - - + if((resModel->m_uiAnimOverrideBitmask&(1<arm0->render(1 / 16.0f,true); + // Does this skin have its sleeve0 disabled? + if((resModel->m_uiAnimOverrideBitmask&(1<sleeve0!=nullptr) + resModel->sleeve0->render(1 / 16.0f,true); + //Render custom skin boxes on viewmodel - Botch vector* additionalModelParts = Minecraft::GetInstance()->player->GetAdditionalModelParts(); if (!additionalModelParts) return; //If there are no custom boxes, return. This fixes bug where the game will crash if you select a skin with no additional boxes. - vector armchildren = humanoidModel->arm0->children; std::unordered_set additionalModelPartSet(additionalModelParts->begin(), additionalModelParts->end()); + vector armchildren = resModel->arm0->children; for (const auto& x : armchildren) { - if (x) { - if (additionalModelPartSet.find(x) != additionalModelPartSet.end()) { //This is to verify box is still actually on current skin - Botch + if (x && additionalModelPartSet.find(x) != additionalModelPartSet.end()) //This is to verify box is still actually on current skin - Botch + { + glPushMatrix(); + //We need to transform to match offset of arm - Botch + glTranslatef(-5 * 0.0625f, 2 * 0.0625f, 0); + glRotatef(0.1 * (180.0f / PI), 0, 0, 1); + x->visible = true; + x->render(1.0f / 16.0f, true); + x->visible = false; + glPopMatrix(); + } + } + //Render custom skin boxes on viewmodel for sleeve0 + if (resModel->sleeve0!=nullptr) + { + vector sleevechildren = resModel->sleeve0->children; + for (const auto& x : sleevechildren) { + if (x && additionalModelPartSet.find(x) != additionalModelPartSet.end()) //This is to verify box is still actually on current skin + { glPushMatrix(); - //We need to transform to match offset of arm - Botch + //We need to transform to match offset of arm/sleeve glTranslatef(-5 * 0.0625f, 2 * 0.0625f, 0); glRotatef(0.1 * (180.0f / PI), 0, 0, 1); x->visible = true; @@ -555,8 +592,6 @@ void PlayerRenderer::renderHand() } } } - - } void PlayerRenderer::setupPosition(shared_ptr _mob, double x, double y, double z) @@ -618,4 +653,4 @@ ResourceLocation *PlayerRenderer::getTextureLocation(shared_ptr entity) { shared_ptr player = dynamic_pointer_cast(entity); return new ResourceLocation(static_cast<_TEXTURE_NAME>(player->getTexture())); -} +} \ No newline at end of file diff --git a/Minecraft.Client/PlayerRenderer.h b/Minecraft.Client/PlayerRenderer.h index 494ff795f0..eafb7aaba2 100644 --- a/Minecraft.Client/PlayerRenderer.h +++ b/Minecraft.Client/PlayerRenderer.h @@ -14,6 +14,9 @@ class PlayerRenderer : public LivingEntityRenderer private: HumanoidModel *humanoidModel; + HumanoidModel *humanoidModelClassic; + HumanoidModel *humanoidModelSlim; + HumanoidModel *armorParts1; HumanoidModel *armorParts2; diff --git a/Minecraft.Client/SkinBox.h b/Minecraft.Client/SkinBox.h index 827e4447c3..907da411dc 100644 --- a/Minecraft.Client/SkinBox.h +++ b/Minecraft.Client/SkinBox.h @@ -9,11 +9,28 @@ enum eBodyPart eBodyPart_Arm1, eBodyPart_Leg0, eBodyPart_Leg1, + eBodyPart_Headwear, + eBodyPart_Jacket, + eBodyPart_Sleeve0, + eBodyPart_Sleeve1, + eBodyPart_Pants0, + eBodyPart_Pants1, + eBodyPart_Waist, + eBodyPart_Legging0, + eBodyPart_Legging1, + eBodyPart_Sock0, + eBodyPart_Sock1, + eBodyPart_Boot0, + eBodyPart_Boot1, + eBodyPart_ArmArmor0, + eBodyPart_ArmArmor1, + eBodyPart_BodyArmor, + eBodyPart_Belt }; typedef struct { eBodyPart ePart; - float fX,fY,fZ,fW,fH,fD,fU,fV; + float fX,fY,fZ,fW,fH,fD,fU,fV,fA,fM; } SKIN_BOX; diff --git a/Minecraft.Client/SkinOffset.h b/Minecraft.Client/SkinOffset.h new file mode 100644 index 0000000000..39f3780a0a --- /dev/null +++ b/Minecraft.Client/SkinOffset.h @@ -0,0 +1,40 @@ +#pragma once + +enum eBodyOffset +{ + eBodyOffset_Unknown=0, + eBodyOffset_Head, + eBodyOffset_Body, + eBodyOffset_Arm0, + eBodyOffset_Arm1, + eBodyOffset_Leg0, + eBodyOffset_Leg1, + eBodyOffset_Headwear, + eBodyOffset_Jacket, + eBodyOffset_Sleeve0, + eBodyOffset_Sleeve1, + eBodyOffset_Pants0, + eBodyOffset_Pants1, + eBodyOffset_Waist, + eBodyOffset_Legging0, + eBodyOffset_Legging1, + eBodyOffset_Sock0, + eBodyOffset_Sock1, + eBodyOffset_Boot0, + eBodyOffset_Boot1, + eBodyOffset_ArmArmor1, + eBodyOffset_ArmArmor0, + eBodyOffset_BodyArmor, + eBodyOffset_Belt, + eBodyOffset_Tool0, + eBodyOffset_Tool1 + +}; + +typedef struct +{ + eBodyOffset ePart; + string fD; + float fO; +} +SKIN_OFFSET; diff --git a/Minecraft.Client/Textures.cpp b/Minecraft.Client/Textures.cpp index ba7c028212..ba38dcf7f5 100644 --- a/Minecraft.Client/Textures.cpp +++ b/Minecraft.Client/Textures.cpp @@ -72,6 +72,16 @@ const wchar_t *Textures::preLoaded[TN_COUNT] = L"mob/char5", L"mob/char6", L"mob/char7", + L"mob/alex", + L"mob/alex1", + L"mob/alex2", + L"mob/alex3", + L"mob/alex4", + L"mob/alex5", + L"mob/alex6", + L"mob/alex7", + L"mob/DevAlex", + L"mob/DevSteve", L"terrain/moon", L"terrain/sun", L"armor/power", diff --git a/Minecraft.Client/Textures.h b/Minecraft.Client/Textures.h index 1fca56106a..5ac3182e2a 100644 --- a/Minecraft.Client/Textures.h +++ b/Minecraft.Client/Textures.h @@ -63,6 +63,16 @@ typedef enum _TEXTURE_NAME TN_MOB_CHAR5, TN_MOB_CHAR6, TN_MOB_CHAR7, + TN_MOB_ALEX, + TN_MOB_ALEX1, + TN_MOB_ALEX2, + TN_MOB_ALEX3, + TN_MOB_ALEX4, + TN_MOB_ALEX5, + TN_MOB_ALEX6, + TN_MOB_ALEX7, + TN_MOB_DEVALEX, + TN_MOB_DEVSTEVE, TN_TERRAIN_MOON, TN_TERRAIN_SUN, TN_POWERED_CREEPER, diff --git a/Minecraft.World/Definitions.h b/Minecraft.World/Definitions.h index d338019dbe..f45252f5bc 100644 --- a/Minecraft.World/Definitions.h +++ b/Minecraft.World/Definitions.h @@ -35,6 +35,16 @@ enum EDefaultSkins eDefaultSkins_Skin5, eDefaultSkins_Skin6, eDefaultSkins_Skin7, + eDefaultSkins_Skin8, + eDefaultSkins_Skin9, + eDefaultSkins_Skin10, + eDefaultSkins_Skin11, + eDefaultSkins_Skin12, + eDefaultSkins_Skin13, + eDefaultSkins_Skin14, + eDefaultSkins_Skin15, + eDefaultSkins_Skin16, + eDefaultSkins_Skin17, eDefaultSkins_Count, }; \ No newline at end of file diff --git a/Minecraft.World/Player.cpp b/Minecraft.World/Player.cpp index 00c7148e41..0bc5154462 100644 --- a/Minecraft.World/Player.cpp +++ b/Minecraft.World/Player.cpp @@ -2702,6 +2702,26 @@ int Player::getTexture() return TN_MOB_CHAR6; // 4J - was L"/mob/char6.png"; case eDefaultSkins_Skin7: return TN_MOB_CHAR7; // 4J - was L"/mob/char7.png"; + case eDefaultSkins_Skin8: + return TN_MOB_ALEX; // 4J - was L"/mob/alex.png"; + case eDefaultSkins_Skin9: + return TN_MOB_ALEX1; // 4J - was L"/mob/alex1.png"; + case eDefaultSkins_Skin10: + return TN_MOB_ALEX2; // 4J - was L"/mob/alex2.png"; + case eDefaultSkins_Skin11: + return TN_MOB_ALEX3; // 4J - was L"/mob/alex3.png"; + case eDefaultSkins_Skin12: + return TN_MOB_ALEX4; // 4J - was L"/mob/alex4.png"; + case eDefaultSkins_Skin13: + return TN_MOB_ALEX5; // 4J - was L"/mob/alex5.png"; + case eDefaultSkins_Skin14: + return TN_MOB_ALEX6; // 4J - was L"/mob/alex6.png"; + case eDefaultSkins_Skin15: + return TN_MOB_ALEX7; // 4J - was L"/mob/alex7.png"; + case eDefaultSkins_Skin16: + return TN_MOB_DEVALEX; // 4J - was L"/mob/DevAlex.png"; + case eDefaultSkins_Skin17: + return TN_MOB_DEVSTEVE; // 4J - was L"/mob/DevSteve.png"; default: return TN_MOB_CHAR; // 4J - was L"/mob/char.png";