Squashed commit of the following:
commitb40530fa5eAuthor: Langtanium <94726057+Langtanium@users.noreply.github.com> Date: Wed Apr 15 19:59:46 2026 -0700 Implemented skin offsets in UI Added code to render skin offsets in the skin select UI. commita8384d9840Author: Langtanium <94726057+Langtanium@users.noreply.github.com> Date: Wed Apr 15 19:38:08 2026 -0700 Partially implemented offsets Added code that visually shifts the player's model parts, but only in game not in the skin select UI. commit875100cf9aAuthor: Langtanium <94726057+Langtanium@users.noreply.github.com> Date: Wed Apr 15 16:48:03 2026 -0700 Minor change Simplified redundant conditions in HumanoidModel.cpp commit96f683d1fbMerge:db685a7424c74aa2Author: Langtanium <94726057+Langtanium@users.noreply.github.com> Date: Tue Apr 14 16:37:30 2026 -0700 Merge branch 'feat/64x64-skins' into feat/skin-offsets commitdb685a74f3Author: Langtanium <94726057+Langtanium@users.noreply.github.com> Date: Tue Apr 14 15:35:38 2026 -0700 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). commitaa769d54adAuthor: Langtanium <94726057+Langtanium@users.noreply.github.com> Date: Sat Apr 11 19:36:52 2026 -0700 Fixed crashes Fixed code for offsets preventing crashes. The amount of offsets is correctly obtain, but lacks the actual data. commitf18ac12cc0Merge:8e76763afd2fd659Author: Langtanium <94726057+Langtanium@users.noreply.github.com> Date: Fri Apr 10 16:06:57 2026 -0700 Merge branch 'feat/64x64-skins' into feat/skin-offsets commit8e76763a3dAuthor: Langtanium <94726057+Langtanium@users.noreply.github.com> Date: Tue Apr 7 16:50:43 2026 -0700 Made more changes Made more changes in files to support skin offsets. The game still crashes when trying to load skins. commit1a8f353297Merge:a1d9ae59bb5fa506Author: Langtanium <94726057+Langtanium@users.noreply.github.com> Date: Tue Apr 7 13:12:39 2026 -0700 Merge branch 'feat/64x64-skins' into feat/skin-offsets commita1d9ae591aAuthor: Langtanium <94726057+Langtanium@users.noreply.github.com> Date: Fri Apr 3 21:50:42 2026 -0700 Added small additions Added more code referencing skin offsets. Still doesn't work correctly. commitd28a751d9cMerge:3888de7a8bf03435Author: Langtanium <94726057+Langtanium@users.noreply.github.com> Date: Thu Apr 2 17:09:08 2026 -0700 Merge branch 'smartcmd:main' into feat/skin-offsets commit3888de7ab4Author: Langtanium <94726057+Langtanium@users.noreply.github.com> Date: Thu Apr 2 17:07:48 2026 -0700 Added code for skin offsets Added code to the file which have the functionality to get skin boxes and duplicated the functionality for skin offsets. The code causes the game to crash when switching to third person. The error occurs with the skin offsets returning as an empty class object.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
#include "stdafx.h"
|
||||
#include "HumanoidModel.h"
|
||||
#include "..\Minecraft.World\Mth.h"
|
||||
#include "..\Minecraft.World\Entity.h"
|
||||
#include "..\Minecraft.World\Player.h"
|
||||
#include "ModelPart.h"
|
||||
|
||||
// 4J added
|
||||
@@ -119,7 +119,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;
|
||||
@@ -210,12 +210,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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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
|
||||
@@ -231,12 +231,12 @@ void HumanoidModel::_init(float g, float yOffset, int texWidth, int texHeight, b
|
||||
arm1->bMirror = true;
|
||||
}
|
||||
|
||||
if (slimHands == false)
|
||||
if (!slim)
|
||||
{
|
||||
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)
|
||||
{
|
||||
arm0->addHumanoidBox(-2, -2, -2, 3, 12, 4, g); // Arm0 Slim
|
||||
arm1->addHumanoidBox(-1, -2, -2, 3, 12, 4, g); // Arm1 Slim
|
||||
@@ -350,12 +350,12 @@ 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)
|
||||
void HumanoidModel::render(shared_ptr<Entity> entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled, vector<SKIN_OFFSET *> *modelOffsets)
|
||||
{
|
||||
if(entity != nullptr)
|
||||
{
|
||||
@@ -385,12 +385,100 @@ void HumanoidModel::render(shared_ptr<Entity> entity, float time, float r, float
|
||||
}
|
||||
else
|
||||
{
|
||||
shared_ptr<Player> player = dynamic_pointer_cast<Player>(entity);
|
||||
vector<float> headOffsets = {0, 0, 0};
|
||||
vector<float> bodyOffsets = {0, 0, 0};
|
||||
vector<float> arm0Offsets = {0, 0, 0};
|
||||
vector<float> arm1Offsets = {0, 0, 0};
|
||||
vector<float> leg0Offsets = {0, 0, 0};
|
||||
vector<float> leg1Offsets = {0, 0, 0};
|
||||
vector<SKIN_OFFSET *>* pModelOffsets = nullptr;
|
||||
if (player != nullptr)
|
||||
pModelOffsets = player->GetModelOffsets();
|
||||
else if (modelOffsets != nullptr)
|
||||
pModelOffsets = modelOffsets;
|
||||
if (pModelOffsets != nullptr)
|
||||
{
|
||||
for( SKIN_OFFSET *pModelOffset : *pModelOffsets )
|
||||
{
|
||||
switch (pModelOffset->ePart)
|
||||
{
|
||||
case eBodyOffset_Head:
|
||||
if(pModelOffset->fD == 1)
|
||||
headOffsets[0] = pModelOffset->fO;
|
||||
else if(pModelOffset->fD == 2)
|
||||
headOffsets[1] = pModelOffset->fO;
|
||||
else if(pModelOffset->fD == 3)
|
||||
headOffsets[2] = pModelOffset->fO;
|
||||
break;
|
||||
case eBodyOffset_Body:
|
||||
if(pModelOffset->fD == 1)
|
||||
bodyOffsets[0] = pModelOffset->fO;
|
||||
else if(pModelOffset->fD == 2)
|
||||
bodyOffsets[1] = pModelOffset->fO;
|
||||
else if(pModelOffset->fD == 3)
|
||||
bodyOffsets[2] = pModelOffset->fO;
|
||||
break;
|
||||
case eBodyOffset_Arm0:
|
||||
if(pModelOffset->fD == 1)
|
||||
arm0Offsets[0] = pModelOffset->fO;
|
||||
else if(pModelOffset->fD == 2)
|
||||
arm0Offsets[1] = pModelOffset->fO;
|
||||
else if(pModelOffset->fD == 3)
|
||||
arm0Offsets[2] = pModelOffset->fO;
|
||||
break;
|
||||
case eBodyOffset_Arm1:
|
||||
if(pModelOffset->fD == 1)
|
||||
arm1Offsets[0] = pModelOffset->fO;
|
||||
else if(pModelOffset->fD == 2)
|
||||
arm1Offsets[1] = pModelOffset->fO;
|
||||
else if(pModelOffset->fD == 3)
|
||||
arm1Offsets[2] = pModelOffset->fO;
|
||||
break;
|
||||
case eBodyOffset_Leg0:
|
||||
if(pModelOffset->fD == 1)
|
||||
leg0Offsets[0] = pModelOffset->fO;
|
||||
else if(pModelOffset->fD == 2)
|
||||
leg0Offsets[1] = pModelOffset->fO;
|
||||
else if(pModelOffset->fD == 3)
|
||||
leg0Offsets[2] = pModelOffset->fO;
|
||||
break;
|
||||
case eBodyOffset_Leg1:
|
||||
if(pModelOffset->fD == 1)
|
||||
leg1Offsets[0] = pModelOffset->fO;
|
||||
else if(pModelOffset->fD == 2)
|
||||
leg1Offsets[1] = pModelOffset->fO;
|
||||
else if(pModelOffset->fD == 3)
|
||||
leg1Offsets[2] = pModelOffset->fO;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
glPushMatrix();
|
||||
glTranslatef(headOffsets[0]/16.0f, headOffsets[1]/16.0f, headOffsets[2]/16.0f);
|
||||
head->render(scale, usecompiled,(m_uiAnimOverrideBitmask&(1<<eAnim_DisableRenderHead))>0&&(!(m_uiAnimOverrideBitmask&(1<<eAnim_RenderArmorHead))>0||!m_isArmor));
|
||||
glPopMatrix();
|
||||
glPushMatrix();
|
||||
glTranslatef(bodyOffsets[0]/16.0f, bodyOffsets[1]/16.0f, bodyOffsets[2]/16.0f);
|
||||
body->render(scale, usecompiled,(m_uiAnimOverrideBitmask&(1<<eAnim_DisableRenderTorso))>0&&(!(m_uiAnimOverrideBitmask&(1<<eAnim_RenderArmorTorso))>0||!m_isArmor));
|
||||
glPopMatrix();
|
||||
glPushMatrix();
|
||||
glTranslatef(arm0Offsets[0]/16.0f, arm0Offsets[1]/16.0f, arm0Offsets[2]/16.0f);
|
||||
arm0->render(scale, usecompiled,(m_uiAnimOverrideBitmask&(1<<eAnim_DisableRenderArm0))>0&&(!(m_uiAnimOverrideBitmask&(1<<eAnim_RenderArmorArm0))>0||!m_isArmor));
|
||||
glPopMatrix();
|
||||
glPushMatrix();
|
||||
glTranslatef(arm1Offsets[0]/16.0f, arm1Offsets[1]/16.0f, arm1Offsets[2]/16.0f);
|
||||
arm1->render(scale, usecompiled,(m_uiAnimOverrideBitmask&(1<<eAnim_DisableRenderArm1))>0&&(!(m_uiAnimOverrideBitmask&(1<<eAnim_RenderArmorArm1))>0||!m_isArmor));
|
||||
glPopMatrix();
|
||||
glPushMatrix();
|
||||
glTranslatef(leg0Offsets[0]/16.0f, leg0Offsets[1]/16.0f, leg0Offsets[2]/16.0f);
|
||||
leg0->render(scale, usecompiled,(m_uiAnimOverrideBitmask&(1<<eAnim_DisableRenderLeg0))>0&&(!(m_uiAnimOverrideBitmask&(1<<eAnim_RenderArmorLeg0))>0||!m_isArmor));
|
||||
glPopMatrix();
|
||||
glPushMatrix();
|
||||
glTranslatef(leg1Offsets[0]/16.0f, leg1Offsets[1]/16.0f, leg1Offsets[2]/16.0f);
|
||||
leg1->render(scale, usecompiled,(m_uiAnimOverrideBitmask&(1<<eAnim_DisableRenderLeg1))>0&&(!(m_uiAnimOverrideBitmask&(1<<eAnim_RenderArmorLeg1))>0||!m_isArmor));
|
||||
glPopMatrix();
|
||||
hair->render(scale, usecompiled,(m_uiAnimOverrideBitmask&(1<<eAnim_DisableRenderHair))>0);
|
||||
if (jacket != 0)
|
||||
jacket->render(scale, usecompiled,(m_uiAnimOverrideBitmask&(1<<eAnim_DisableRenderJacket))>0);
|
||||
@@ -687,6 +775,7 @@ 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;
|
||||
|
||||
Reference in New Issue
Block a user