Fixed skin offset data
Fixed skin offsets so they now return the actual data instead of the defaults, added a few minor tweaks, and added code in PlayerRenderer.cpp to access offsets (Can read the offsets but can not apply them).
This commit is contained in:
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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> 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;
|
||||
|
||||
@@ -77,15 +77,14 @@ public:
|
||||
(1<<HumanoidModel::eAnim_DisableRenderJacket);
|
||||
|
||||
|
||||
void _init(float g, float yOffset, int texWidth, int texHeight, bool slimHands, bool isArmor); // 4J added
|
||||
void _init(float g, float yOffset, int texWidth, int texHeight, bool slim, bool isArmor); // 4J added
|
||||
HumanoidModel();
|
||||
HumanoidModel(float g);
|
||||
HumanoidModel(float g, bool isArmor);
|
||||
HumanoidModel(float g, float yOffset, int texWidth, int texHeight);
|
||||
HumanoidModel(float g, float yOffset, int texWidth, int texHeight, bool slimHands);
|
||||
HumanoidModel(float g, float yOffset, int texWidth, int texHeight, bool slim);
|
||||
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 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);
|
||||
|
||||
@@ -251,6 +251,34 @@ void PlayerRenderer::render(shared_ptr<Entity> _mob, double x, double y, double
|
||||
armorParts2->idle=false;
|
||||
}
|
||||
|
||||
// Langtanium - any skin offsets to add to this player (skin dependent)
|
||||
vector<SKIN_OFFSET *>* 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<ModelPart *> *pAdditionalModelParts=mob->GetAdditionalModelParts();
|
||||
//turn them on
|
||||
@@ -273,23 +301,6 @@ void PlayerRenderer::render(shared_ptr<Entity> _mob, double x, double y, double
|
||||
}
|
||||
}
|
||||
|
||||
vector<SKIN_OFFSET *>* 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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -237,7 +237,7 @@ void TextureAndGeometryPacket::read(DataInputStream *dis) //throws IOException
|
||||
for(DWORD i=0;i<dwOffsetC;i++)
|
||||
{
|
||||
this->OffsetDataA[i].ePart = static_cast<eBodyOffset>(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;i<dwOffsetC;i++)
|
||||
{
|
||||
dos->writeShort(static_cast<short>(this->OffsetDataA[i].ePart));
|
||||
dos->writeChar(this->OffsetDataA[i].fD);
|
||||
dos->writeFloat(this->OffsetDataA[i].fD);
|
||||
dos->writeFloat(this->OffsetDataA[i].fO);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user