diff --git a/Minecraft.Client/Common/DLC/DLCSkinFile.cpp b/Minecraft.Client/Common/DLC/DLCSkinFile.cpp index 9b519e28..e693601c 100644 --- a/Minecraft.Client/Common/DLC/DLCSkinFile.cpp +++ b/Minecraft.Client/Common/DLC/DLCSkinFile.cpp @@ -110,7 +110,7 @@ void DLCSkinFile::addParameter(DLCManager::EDLCParameterType type, const wstring break; case DLCManager::e_DLCParamType_Box: { - WCHAR wchBodyPart[11]; + WCHAR wchBodyPart[10]; SKIN_BOX *pSkinBox = new SKIN_BOX; ZeroMemory(pSkinBox,sizeof(SKIN_BOX)); @@ -118,7 +118,7 @@ void DLCSkinFile::addParameter(DLCManager::EDLCParameterType type, const wstring // 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%f%f%f", wchBodyPart, #else - swscanf_s(value.c_str(), L"%9ls%f%f%f%f%f%f%f%f%f%f%f", wchBodyPart,11, + swscanf_s(value.c_str(), L"%9ls%f%f%f%f%f%f%f%f%f%f%f", wchBodyPart,10, #endif &pSkinBox->fX, &pSkinBox->fY, @@ -231,18 +231,31 @@ void DLCSkinFile::addParameter(DLCManager::EDLCParameterType type, const wstring break; case DLCManager::e_DLCParamType_Offset: { - WCHAR wchBodyPart[2]; + WCHAR wchBodyPart[10]; + wchar_t wchDirection[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, + swscanf(value.c_str(), L"%10ls%2ls%f", wchBodyPart, #else - swscanf_s(value.c_str(), L"%9ls%f%f", wchBodyPart,2, + swscanf_s(value.c_str(), L"%9ls%2ls%f", wchBodyPart,10, wchDirection,2, #endif - &pSkinOffset->fD, &pSkinOffset->fO); + + if(wcscmp(wchDirection,L"X")==0) + { + pSkinOffset->fD=eOffsetDirection_X; + } + else if (wcscmp(wchDirection,L"Y")==0) + { + pSkinOffset->fD=eOffsetDirection_Y; + } + else if(wcscmp(wchDirection,L"Z")==0) + { + pSkinOffset->fD=eOffsetDirection_Z; + } if(wcscmp(wchBodyPart,L"HEAD")==0) { diff --git a/Minecraft.Client/HumanoidModel.cpp b/Minecraft.Client/HumanoidModel.cpp index 033f0d59..cd38920a 100644 --- a/Minecraft.Client/HumanoidModel.cpp +++ b/Minecraft.Client/HumanoidModel.cpp @@ -118,7 +118,7 @@ ModelPart * HumanoidModel::AddOrRetrievePart(SKIN_BOX *pBox) return pNewBox; } -void HumanoidModel::_init(float g, float yOffset, int texWidth, int texHeight, bool slimHands, bool isArmor) +void HumanoidModel::_init(float g, float yOffset, int texWidth, int texHeight, bool slim, bool isArmor) { this->texWidth = texWidth; this->texHeight = texHeight; @@ -209,12 +209,12 @@ void HumanoidModel::_init(float g, float yOffset, int texWidth, int texHeight, b sleeve0 = new ModelPart(this, 24 + 16, 32); sleeve1 = new ModelPart(this, 32 + 16, 48); - if (slimHands == false) + if (slim == 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) + else if (slim == 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 @@ -230,12 +230,12 @@ void HumanoidModel::_init(float g, float yOffset, int texWidth, int texHeight, b arm1->bMirror = true; } - if (slimHands == false) + if (slim == 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) + else if (slim == true) { arm0->addHumanoidBox(-2, -2, -2, 3, 12, 4, g); // Arm0 Slim arm1->addHumanoidBox(-1, -2, -2, 3, 12, 4, g); // Arm1 Slim @@ -349,9 +349,9 @@ HumanoidModel::HumanoidModel(float g, float yOffset, int texWidth, int texHeight _init(g,yOffset,texWidth,texHeight, false, false); } -HumanoidModel::HumanoidModel(float g, float yOffset, int texWidth, int texHeight, bool slimHands) : Model() +HumanoidModel::HumanoidModel(float g, float yOffset, int texWidth, int texHeight, bool slim) : Model() { - _init(g,yOffset,texWidth,texHeight, slimHands, false); + _init(g,yOffset,texWidth,texHeight, slim, false); } void HumanoidModel::render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) @@ -834,14 +834,6 @@ void HumanoidModel::setupAnim(float time, float r, float bob, float yRot, float } } -void HumanoidModel::setOffset(int part, wchar_t direction, float amount) -{ - if (part == 1) - head->y += amount; - else if (part == 2) - body->y += amount; -} - void HumanoidModel::renderHair(float scale,bool usecompiled) { hair->yRot = head->yRot; diff --git a/Minecraft.Client/HumanoidModel.h b/Minecraft.Client/HumanoidModel.h index 9193acc8..d46a8ea4 100644 --- a/Minecraft.Client/HumanoidModel.h +++ b/Minecraft.Client/HumanoidModel.h @@ -77,15 +77,14 @@ public: (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); - virtual void setOffset(int part, wchar_t direction, float amount); void renderHair(float scale, bool usecompiled); void renderEars(float scale, bool usecompiled); void renderCloak(float scale, bool usecompiled); diff --git a/Minecraft.Client/PlayerRenderer.cpp b/Minecraft.Client/PlayerRenderer.cpp index 8aecc6a1..b5b5f41b 100644 --- a/Minecraft.Client/PlayerRenderer.cpp +++ b/Minecraft.Client/PlayerRenderer.cpp @@ -251,6 +251,34 @@ void PlayerRenderer::render(shared_ptr _mob, double x, double y, double armorParts2->idle=false; } + // Langtanium - any skin offsets to add to this player (skin dependent) + vector* pModelOffsets=mob->GetModelOffsets(); + if (pModelOffsets!=nullptr) + { + for( SKIN_OFFSET *pModelOffset : *pModelOffsets ) + { + // pModelOffset->ePart, pModelOffset->fD, pModelOffset->fO + switch (pModelOffset->ePart) + { + case eBodyOffset_Head: + glPushMatrix(); + glTranslatef(0, 16 * 2, 0); + glPopMatrix(); + break; + case eBodyOffset_Body: + break; + case eBodyOffset_Arm0: + break; + case eBodyOffset_Arm1: + break; + case eBodyOffset_Leg0: + break; + case eBodyOffset_Leg1: + break; + } + } + } + // 4J-PB - any additional parts to turn on for this player (skin dependent) vector *pAdditionalModelParts=mob->GetAdditionalModelParts(); //turn them on @@ -273,23 +301,6 @@ void PlayerRenderer::render(shared_ptr _mob, double x, double y, double } } - vector* pModelOffsets=mob->GetModelOffsets(); - if (pModelOffsets!=nullptr) - { - for( SKIN_OFFSET *pModelOffset : *pModelOffsets ) - { - switch (pModelOffset->ePart) - { - case eBodyOffset_Head: - resModel->setOffset(1, pModelOffset->fD, pModelOffset->fO); - break; - case eBodyOffset_Body: - resModel->setOffset(2, pModelOffset->fD, pModelOffset->fO); - break; - } - } - } - armorParts1->bowAndArrow = armorParts2->bowAndArrow = resModel->bowAndArrow = false; armorParts1->sneaking = armorParts2->sneaking = resModel->sneaking = false; armorParts1->holdingRightHand = armorParts2->holdingRightHand = resModel->holdingRightHand = 0; diff --git a/Minecraft.Client/SkinOffset.h b/Minecraft.Client/SkinOffset.h index 0cc220c0..bba7bcc2 100644 --- a/Minecraft.Client/SkinOffset.h +++ b/Minecraft.Client/SkinOffset.h @@ -31,10 +31,17 @@ enum eBodyOffset }; +enum eOffsetDirection +{ + eOffsetDirection_Unknown=0, + eOffsetDirection_X, + eOffsetDirection_Y, + eOffsetDirection_Z +}; + typedef struct { eBodyOffset ePart; - wchar_t fD; - float fO; + float fD, fO; } SKIN_OFFSET; diff --git a/Minecraft.World/TextureAndGeometryPacket.cpp b/Minecraft.World/TextureAndGeometryPacket.cpp index 9f3e06e5..c777f961 100644 --- a/Minecraft.World/TextureAndGeometryPacket.cpp +++ b/Minecraft.World/TextureAndGeometryPacket.cpp @@ -237,7 +237,7 @@ void TextureAndGeometryPacket::read(DataInputStream *dis) //throws IOException for(DWORD i=0;iOffsetDataA[i].ePart = static_cast(dis->readShort()); - this->OffsetDataA[i].fD = dis->readChar(); + this->OffsetDataA[i].fD = dis->readFloat(); this->OffsetDataA[i].fO = dis->readFloat(); } } @@ -274,7 +274,7 @@ void TextureAndGeometryPacket::write(DataOutputStream *dos) //throws IOException for(DWORD i=0;iwriteShort(static_cast(this->OffsetDataA[i].ePart)); - dos->writeChar(this->OffsetDataA[i].fD); + dos->writeFloat(this->OffsetDataA[i].fD); dos->writeFloat(this->OffsetDataA[i].fO); } }