smartcmd-MinecraftConsoles/Minecraft.Client/HumanoidModel.h

97 lines
3.5 KiB
C
Raw Normal View History

2026-03-01 12:16:08 +08:00
#pragma once
#include "Model.h"
#include "SkinOffset.h"
2026-03-01 12:16:08 +08:00
class HumanoidModel : public Model
{
public:
// Base geometry
ModelPart *head, *hair, *body, *arm0, *arm1, *leg0, *leg1, *ear, *cloak;
// Second layer/64x64 skin geometry
ModelPart *jacket, *sleeve0, *sleeve1, *pants0, *pants1;
// Extra geometry for DLC skins
ModelPart *waist, *belt, *bodyArmor, *armArmor0, *armArmor1, *legging0, *legging1, *sock0, *sock1, *boot0, *boot1;
//ModelPart *hat;
2026-03-01 12:16:08 +08:00
int holdingLeftHand;
int holdingRightHand;
bool idle;
bool sneaking;
bool bowAndArrow;
bool eating; // 4J added
float eating_t; // 4J added
float eating_swing; // 4J added
unsigned int m_uiAnimOverrideBitmask; // 4J added
float m_fYOffset; // 4J added
bool m_isArmor;
2026-03-01 12:16:08 +08:00
enum animbits
{
eAnim_ArmsDown =0,
eAnim_ArmsOutFront,
eAnim_NoLegAnim,
eAnim_HasIdle,
eAnim_ForceAnim, // Claptrap looks bad if the user turns off custom skin anim
// 4J-PB - DaveK wants Fish characters to move both legs in the same way
eAnim_SingleLegs,
eAnim_SingleArms,
eAnim_StatueOfLiberty, // Dr Who Weeping Angel
eAnim_DontRenderArmour, // Dr Who Daleks
eAnim_NoBobbing, // Dr Who Daleks
eAnim_DisableRenderHead,
eAnim_DisableRenderArm0,
eAnim_DisableRenderArm1,
eAnim_DisableRenderTorso,
eAnim_DisableRenderLeg0,
eAnim_DisableRenderLeg1,
eAnim_DisableRenderHair,
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
2026-03-01 12:16:08 +08:00
};
static const unsigned int m_staticBitmaskIgnorePlayerCustomAnimSetting= (1<<HumanoidModel::eAnim_ForceAnim) |
(1<<HumanoidModel::eAnim_DisableRenderArm0) |
(1<<HumanoidModel::eAnim_DisableRenderArm1) |
(1<<HumanoidModel::eAnim_DisableRenderTorso) |
(1<<HumanoidModel::eAnim_DisableRenderLeg0) |
(1<<HumanoidModel::eAnim_DisableRenderLeg1) |
(1<<HumanoidModel::eAnim_DisableRenderHair) |
(1<<HumanoidModel::eAnim_DisableRenderSleeve1) |
(1<<HumanoidModel::eAnim_DisableRenderSleeve0) |
(1<<HumanoidModel::eAnim_DisableRenderPants1) |
(1<<HumanoidModel::eAnim_DisableRenderPants0) |
(1<<HumanoidModel::eAnim_DisableRenderJacket);
2026-03-01 12:16:08 +08:00
Squashed commit of the following: commit b40530fa5e12bdd0e2d03686b111964f9c5b3359 Author: 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. commit a8384d984089b989a162550705dee7a505412e22 Author: 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. commit 875100cf9afe7df258dc653a4b33857d3cd285c1 Author: Langtanium <94726057+Langtanium@users.noreply.github.com> Date: Wed Apr 15 16:48:03 2026 -0700 Minor change Simplified redundant conditions in HumanoidModel.cpp commit 96f683d1fb93d09a49987460ef698e0d125c2c93 Merge: db685a74 24c74aa2 Author: 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 commit db685a74f34d02cc83e33ab97c5a7ad9a62ef023 Author: 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). commit aa769d54adb8f5bf96c75d10766422d23cc9129a Author: 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. commit f18ac12cc072db74ed9b8da937e00c2e15f889a0 Merge: 8e76763a fd2fd659 Author: 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 commit 8e76763a3ddeaff943243fd0469d6c4a7b12b6c1 Author: 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. commit 1a8f3532979033717044e74e6ceb766e23e35032 Merge: a1d9ae59 bb5fa506 Author: 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 commit a1d9ae591ac27117626aac708a4204a9e2451684 Author: 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. commit d28a751d9ca0527854e40be82e7841a650c2f189 Merge: 3888de7a 8bf03435 Author: Langtanium <94726057+Langtanium@users.noreply.github.com> Date: Thu Apr 2 17:09:08 2026 -0700 Merge branch 'smartcmd:main' into feat/skin-offsets commit 3888de7ab401d9562b7b922eca8b898aa73ba024 Author: 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.
2026-04-15 20:00:28 -07:00
void _init(float g, float yOffset, int texWidth, int texHeight, bool slim, bool isArmor); // 4J added
2026-03-01 12:16:08 +08:00
HumanoidModel();
HumanoidModel(float g);
HumanoidModel(float g, bool isArmor);
2026-03-01 12:16:08 +08:00
HumanoidModel(float g, float yOffset, int texWidth, int texHeight);
Squashed commit of the following: commit b40530fa5e12bdd0e2d03686b111964f9c5b3359 Author: 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. commit a8384d984089b989a162550705dee7a505412e22 Author: 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. commit 875100cf9afe7df258dc653a4b33857d3cd285c1 Author: Langtanium <94726057+Langtanium@users.noreply.github.com> Date: Wed Apr 15 16:48:03 2026 -0700 Minor change Simplified redundant conditions in HumanoidModel.cpp commit 96f683d1fb93d09a49987460ef698e0d125c2c93 Merge: db685a74 24c74aa2 Author: 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 commit db685a74f34d02cc83e33ab97c5a7ad9a62ef023 Author: 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). commit aa769d54adb8f5bf96c75d10766422d23cc9129a Author: 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. commit f18ac12cc072db74ed9b8da937e00c2e15f889a0 Merge: 8e76763a fd2fd659 Author: 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 commit 8e76763a3ddeaff943243fd0469d6c4a7b12b6c1 Author: 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. commit 1a8f3532979033717044e74e6ceb766e23e35032 Merge: a1d9ae59 bb5fa506 Author: 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 commit a1d9ae591ac27117626aac708a4204a9e2451684 Author: 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. commit d28a751d9ca0527854e40be82e7841a650c2f189 Merge: 3888de7a 8bf03435 Author: Langtanium <94726057+Langtanium@users.noreply.github.com> Date: Thu Apr 2 17:09:08 2026 -0700 Merge branch 'smartcmd:main' into feat/skin-offsets commit 3888de7ab401d9562b7b922eca8b898aa73ba024 Author: 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.
2026-04-15 20:00:28 -07:00
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 renderUIOffset(float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled, vector<SKIN_OFFSET *> *modelOffsets);
virtual void setupAnim(float time, float r, float bob, float yRot, float xRot, float scale, shared_ptr<Entity> entity, unsigned int uiBitmaskOverrideAnim = 0);
2026-03-01 12:16:08 +08:00
void renderHair(float scale, bool usecompiled);
void renderEars(float scale, bool usecompiled);
void renderCloak(float scale, bool usecompiled);
2026-03-01 12:16:08 +08:00
void render(HumanoidModel *model, float scale, bool usecompiled);
// Add new bits to models
ModelPart * AddOrRetrievePart(SKIN_BOX *pBox);
};