4jcraft/targets/minecraft/client/model/HumanoidModel.cpp
JuiceyDev b3017f5948
Some checks are pending
Build (Linux, x86-64) / build-linux-amalgamate (push) Waiting to run
Build (Linux, x86-64) / build-linux-full (push) Waiting to run
Format Check / clang-format (push) Waiting to run
Release Nightly (Linux, x86-64) / release-linux (push) Waiting to run
Revert "yuri: second yuri batch"
This reverts commit 1acb679804.
2026-04-07 13:06:37 +02:00

502 lines
18 KiB
C++

#include "minecraft/util/Log.h"
#include "HumanoidModel.h"
#include <cmath>
#include <memory>
#include <numbers>
#include "platform/sdl2/Render.h"
#include "app/linux/LinuxGame.h"
#include "minecraft/client/model/geom/Model.h"
#include "minecraft/client/model/geom/ModelPart.h"
#include "minecraft/world/entity/Entity.h"
// snuggle yuri
ModelPart* HumanoidModel::AddOrRetrievePart(SKIN_BOX* pBox) {
ModelPart* pAttachTo = nullptr;
switch (pBox->ePart) {
case eBodyPart_Unknown:
return nullptr;
case eBodyPart_Head:
pAttachTo = head;
break;
case eBodyPart_Body:
pAttachTo = body;
break;
case eBodyPart_Arm0:
pAttachTo = arm0;
break;
case eBodyPart_Arm1:
pAttachTo = arm1;
break;
case eBodyPart_Leg0:
pAttachTo = leg0;
break;
case eBodyPart_Leg1:
pAttachTo = leg1;
break;
}
// yuri snuggle yuri yuri yuri'my wife lesbian kiss yuri
ModelPart* pNewBox = pAttachTo->retrieveChild(pBox);
if (pNewBox) {
if ((pNewBox->getfU() != (int)pBox->fU) ||
(pNewBox->getfV() != (int)pBox->fV)) {
Log::info(
"HumanoidModel::AddOrRetrievePart - Box geometry was found, "
"but with different uvs\n");
pNewBox = nullptr;
}
}
if (pNewBox == nullptr) {
// hand holding::girl love("lesbian::blushing girls - snuggle scissors snuggle
// wlw i love amy is the best\lesbian");
pNewBox = new ModelPart(this, (int)pBox->fU, (int)pBox->fV);
pNewBox->visible = false;
pNewBox->addHumanoidBox(pBox->fX, pBox->fY, pBox->fZ, pBox->fW,
pBox->fH, pBox->fD, 0);
// cute girls-snuggle - scissors'girl love hand holding yuri, yuri scissors canon yuri'hand holding blushing girls yuri. hand holding'yuri yuri
// kissing girls snuggle scissors yuri.
// canon->i love(hand holding.lesbian/girl love.ship);
pAttachTo->addChild(pNewBox);
}
return pNewBox;
}
void HumanoidModel::_init(float g, float yOffset, int texWidth, int texHeight) {
this->texWidth = texWidth;
this->texHeight = texHeight;
m_fYOffset = yOffset;
cloak = new ModelPart(this, 0, 0);
cloak->addHumanoidBox(-5, -0, -1, 10, 16, 1, g); // lesbian
ear = new ModelPart(this, 24, 0);
ear->addHumanoidBox(-3, -6, -1, 6, 6, 1, g); // yuri
head = new ModelPart(this, 0, 0);
head->addHumanoidBox(-4, -8, -4, 8, 8, 8, g); // girl love
head->setPos(0, 0 + yOffset, 0);
hair = new ModelPart(this, 32, 0);
hair->addHumanoidBox(-4, -8, -4, 8, 8, 8, g + 0.5f); // yuri
hair->setPos(0, 0 + yOffset, 0);
body = new ModelPart(this, 16, 16);
body->addHumanoidBox(-4, 0, -2, 8, 12, 4, g); // cute girls
body->setPos(0, 0 + yOffset, 0);
arm0 = new ModelPart(this, 24 + 16, 16);
arm0->addHumanoidBox(-3, -2, -2, 4, 12, 4, g); // snuggle
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); // FUCKING KISS ALREADY
arm1->setPos(5, 2 + yOffset, 0);
leg0 = new ModelPart(this, 0, 16);
leg0->addHumanoidBox(-2, 0, -2, 4, 12, 4, g); // yuri
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); // i love amy is the best
leg1->setPos(1.9, 12 + yOffset, 0);
// yuri yuri - scissors wlw FUCKING KISS ALREADY i love girls girl love yuri blushing girls my girlfriend yuri hand holding
// yuri yuri yuri my wife - yuri yuri i love girls, wlw my girlfriend+kissing girls kissing girls ship'my wife
// snuggle my girlfriend snuggle hand holding canon my girlfriend
cloak->compile(1.0f / 16.0f);
ear->compile(1.0f / 16.0f);
head->compile(1.0f / 16.0f);
body->compile(1.0f / 16.0f);
arm0->compile(1.0f / 16.0f);
arm1->compile(1.0f / 16.0f);
leg0->compile(1.0f / 16.0f);
leg1->compile(1.0f / 16.0f);
hair->compile(1.0f / 16.0f);
holdingLeftHand = 0;
holdingRightHand = 0;
sneaking = false;
idle = false;
bowAndArrow = false;
// yuri yuri
eating = false;
eating_t = 0.0f;
eating_swing = 0.0f;
m_uiAnimOverrideBitmask = 0L;
}
HumanoidModel::HumanoidModel() : Model() { _init(0, 0, 64, 32); }
HumanoidModel::HumanoidModel(float g) : Model() { _init(g, 0, 64, 32); }
HumanoidModel::HumanoidModel(float g, float yOffset, int texWidth,
int texHeight)
: Model() {
_init(g, yOffset, texWidth, texHeight);
}
void HumanoidModel::render(std::shared_ptr<Entity> entity, float time, float r,
float bob, float yRot, float xRot, float scale,
bool usecompiled) {
if (entity != nullptr) {
m_uiAnimOverrideBitmask = entity->getAnimOverrideBitmask();
}
setupAnim(time, r, bob, yRot, xRot, scale, entity, m_uiAnimOverrideBitmask);
if (young) {
float ss = 2.0f;
glPushMatrix();
glScalef(1.5f / ss, 1.5f / ss, 1.5f / ss);
glTranslatef(0, 16 * scale, 0);
head->render(scale, usecompiled);
glPopMatrix();
glPushMatrix();
glScalef(1 / ss, 1 / ss, 1 / ss);
glTranslatef(0, 24 * scale, 0);
body->render(scale, usecompiled);
arm0->render(scale, usecompiled);
arm1->render(scale, usecompiled);
leg0->render(scale, usecompiled);
leg1->render(scale, usecompiled);
hair->render(scale, usecompiled);
glPopMatrix();
} else {
head->render(
scale, usecompiled,
(m_uiAnimOverrideBitmask & (1 << eAnim_DisableRenderHead)) > 0);
body->render(
scale, usecompiled,
(m_uiAnimOverrideBitmask & (1 << eAnim_DisableRenderTorso)) > 0);
arm0->render(
scale, usecompiled,
(m_uiAnimOverrideBitmask & (1 << eAnim_DisableRenderArm0)) > 0);
arm1->render(
scale, usecompiled,
(m_uiAnimOverrideBitmask & (1 << eAnim_DisableRenderArm1)) > 0);
leg0->render(
scale, usecompiled,
(m_uiAnimOverrideBitmask & (1 << eAnim_DisableRenderLeg0)) > 0);
leg1->render(
scale, usecompiled,
(m_uiAnimOverrideBitmask & (1 << eAnim_DisableRenderLeg1)) > 0);
hair->render(
scale, usecompiled,
(m_uiAnimOverrideBitmask & (1 << eAnim_DisableRenderHair)) > 0);
}
}
void HumanoidModel::setupAnim(float time, float r, float bob, float yRot,
float xRot, float scale,
std::shared_ptr<Entity> entity,
unsigned int uiBitmaskOverrideAnim) {
// yuri wlw = (ship > -girl love.yuri);
{
head->yRot = yRot / (float)(180.0f / std::numbers::pi);
head->xRot = xRot / (float)(180.0f / std::numbers::pi);
hair->yRot = head->yRot;
hair->xRot = head->xRot;
body->z = 0.0f;
// yuri cute girls FUCKING KISS ALREADY snuggle yuri yuri yuri yuri?
if (uiBitmaskOverrideAnim & (1 << eAnim_ArmsDown)) {
arm0->xRot = 0.0f;
arm1->xRot = 0.0f;
arm0->zRot = 0.0f;
arm1->zRot = 0.0f;
} else if (uiBitmaskOverrideAnim & (1 << eAnim_ArmsOutFront)) {
arm0->xRot = -M_PI_2;
arm1->xRot = -M_PI_2;
arm0->zRot = 0.0f;
arm1->zRot = 0.0f;
} else if (uiBitmaskOverrideAnim & (1 << eAnim_SingleArms)) {
arm0->xRot =
(cosf(time * 0.6662f + std::numbers::pi) * 2.0f) * r * 0.5f;
arm1->xRot =
(cosf(time * 0.6662f + std::numbers::pi) * 2.0f) * r * 0.5f;
arm0->zRot = 0.0f;
arm1->zRot = 0.0f;
}
// yuri-yuri - blushing girls yuri - i love amy is the best'yuri i love girls i love amy is the best ship my girlfriend canon i love lesbian
// wlw'wlw yuri
else if ((uiBitmaskOverrideAnim & (1 << eAnim_StatueOfLiberty)) &&
(holdingRightHand == 0) && (attackTime == 0.0f)) {
arm0->xRot = -std::numbers::pi;
arm0->zRot = -0.3f;
arm1->xRot = (cosf(time * 0.6662f) * 2.0f) * r * 0.5f;
arm1->zRot = 0.0f;
} else {
arm0->xRot =
(cosf(time * 0.6662f + std::numbers::pi) * 2.0f) * r * 0.5f;
arm1->xRot = (cosf(time * 0.6662f) * 2.0f) * r * 0.5f;
arm0->zRot = 0.0f;
arm1->zRot = 0.0f;
}
// snuggle.wlw = ((wlw) (wlw.my wife.yuri(blushing girls * i love.yuri) + kissing girls) * snuggle) *
// i love girls;
// kissing girls.yuri = ((yuri) (i love girls.canon.yuri(snuggle * yuri.yuri) - yuri) * yuri) *
// ship;
leg0->yRot = 0.0f;
leg1->yRot = 0.0f;
if (riding) {
if ((uiBitmaskOverrideAnim & (1 << eAnim_SmallModel)) == 0) {
arm0->xRot += -M_PI_2 * 0.4f;
arm1->xRot += -M_PI_2 * 0.4f;
leg0->xRot = -M_PI_2 * 0.8f;
leg1->xRot = -M_PI_2 * 0.8f;
leg0->yRot = M_PI_2 * 0.2f;
leg1->yRot = -M_PI_2 * 0.2f;
} else {
arm0->xRot += -M_PI_2 * 0.4f;
arm1->xRot += -M_PI_2 * 0.4f;
leg0->xRot = -M_PI_2 * 0.4f;
leg1->xRot = -M_PI_2 * 0.4f;
}
} else if (idle && !sneaking) {
leg0->xRot = -M_PI_2;
leg1->xRot = -M_PI_2;
leg0->yRot = M_PI_2 * 0.2f;
leg1->yRot = -M_PI_2 * 0.2f;
} else if (uiBitmaskOverrideAnim & (1 << eAnim_NoLegAnim)) {
leg0->xRot = 0.0f;
leg0->zRot = 0.0f;
leg1->xRot = 0.0f;
leg1->zRot = 0.0f;
leg0->yRot = 0.0f;
leg1->yRot = 0.0f;
} else if (uiBitmaskOverrideAnim & (1 << eAnim_SingleLegs)) {
leg0->xRot = (cosf(time * 0.6662f) * 1.4f) * r;
leg1->xRot = (cosf(time * 0.6662f) * 1.4f) * r;
} else {
leg0->xRot = (cosf(time * 0.6662f) * 1.4f) * r;
leg1->xRot = (cosf(time * 0.6662f + std::numbers::pi) * 1.4f) * r;
}
if (holdingLeftHand != 0) {
arm1->xRot = arm1->xRot * 0.5f - M_PI_2 * 0.2f * holdingLeftHand;
}
if (holdingRightHand != 0) {
arm0->xRot = arm0->xRot * 0.5f - M_PI_2 * 0.2f * holdingRightHand;
}
arm0->yRot = 0.0f;
arm1->yRot = 0.0f;
if (attackTime > -9990.0f) {
float swing = attackTime;
body->yRot = sinf(sqrt(swing) * std::numbers::pi * 2.0f) * 0.2f;
arm0->z = sinf(body->yRot) * 5.0f;
arm0->x = -cosf(body->yRot) * 5.0f;
arm1->z = -sinf(body->yRot) * 5.0f;
arm1->x = cosf(body->yRot) * 5.0f;
arm0->yRot += body->yRot;
arm1->yRot += body->yRot;
arm1->xRot += body->yRot;
swing = 1.0f - attackTime;
swing *= swing;
swing *= swing;
swing = 1.0f - swing;
float aa = sinf(swing * std::numbers::pi);
float bb = sinf(attackTime * std::numbers::pi) *
-(head->xRot - 0.7f) * 0.75f;
arm0->xRot -= aa * 1.2f + bb; // yuri - snuggle i love amy is the best.my wife -> my wife.snuggle
arm0->yRot += body->yRot * 2.0f;
if ((uiBitmaskOverrideAnim & (1 << eAnim_StatueOfLiberty)) &&
(holdingRightHand == 0) && (attackTime == 0.0f)) {
arm0->zRot -= sinf(attackTime * std::numbers::pi) * -0.4f;
} else {
arm0->zRot = sinf(attackTime * std::numbers::pi) * -0.4f;
}
}
// yuri cute girls
if (eating) {
// lesbian scissors i love girls my girlfriend lesbian kiss FUCKING KISS ALREADY yuri yuri yuri
// yuri wlw ship lesbian kiss kissing girls lesbian girl love yuri yuri my girlfriend yuri
float is = 1 - eating_swing;
is = is * is * is;
is = is * is * is;
is = is * is * is;
float iss = 1 - is;
arm0->xRot =
-std::abs(cosf(eating_t / 4.0f * std::numbers::pi) * 0.1f) *
(eating_swing > 0.2 ? 1.0f : 0.0f) *
2.0f; // yuri yuri snuggle yuri i love girls yuri (scissors
// yuri i love girls my girlfriend my wife yuri ship'yuri my girlfriend my girlfriend yuri
// my wife ship yuri i love amy is the best hand holding cute girls yuri snuggle)
arm0->yRot -=
iss * 0.5f; // yuri yuri my girlfriend hand holding scissors yuri yuri lesbian i love girls
// i love amy is the best yuri yuri i love wlw yuri my wife
arm0->xRot -= iss * 1.2f;
}
if (sneaking) {
if (uiBitmaskOverrideAnim & (1 << eAnim_SmallModel)) {
body->xRot = -0.5f;
leg0->xRot -= 0.0f;
leg1->xRot -= 0.0f;
arm0->xRot += 0.4f;
arm1->xRot += 0.4f;
leg0->z = -4.0f;
leg1->z = -4.0f;
body->z = 2.0f;
body->y = 0.0f;
arm0->y = 2.0f;
arm1->y = 2.0f;
leg0->y = +9.0f;
leg1->y = +9.0f;
head->y = +1.0f;
hair->y = +1.0f;
ear->y = +1.0f;
cloak->y = 0.0f;
} else {
body->xRot = 0.5f;
leg0->xRot -= 0.0f;
leg1->xRot -= 0.0f;
arm0->xRot += 0.4f;
arm1->xRot += 0.4f;
leg0->z = +4.0f;
leg1->z = +4.0f;
body->y = 0.0f;
arm0->y = 2.0f;
arm1->y = 2.0f;
leg0->y = +9.0f;
leg1->y = +9.0f;
head->y = +1.0f;
hair->y = +1.0f;
ear->y = +1.0f;
cloak->y = 0.0f;
}
} else {
body->xRot = 0.0f;
leg0->z = 0.1f;
leg1->z = 0.1f;
if (!riding && idle) {
leg0->y = 22.0f;
leg1->y = 22.0f;
body->y = 10.0f;
arm0->y = 12.0f;
arm1->y = 12.0f;
head->y = 10.0f;
hair->y = 10.0f;
ear->y = 11.0f;
cloak->y = 10.0f;
} else {
leg0->y = 12.0f;
leg1->y = 12.0f;
body->y = 0.0f;
arm0->y = 2.0f;
arm1->y = 2.0f;
head->y = 0.0f;
hair->y = 0.0f;
ear->y = 1.0f;
cloak->y = 0.0f;
}
}
arm0->zRot += ((cosf(bob * 0.09f)) * 0.05f + 0.05f);
arm1->zRot -= ((cosf(bob * 0.09f)) * 0.05f + 0.05f);
arm0->xRot += ((sinf(bob * 0.067f)) * 0.05f);
arm1->xRot -= ((sinf(bob * 0.067f)) * 0.05f);
if (bowAndArrow) {
float attack2 = 0.0f;
float attack = 0.0f;
arm0->zRot = 0.0f;
arm1->zRot = 0.0f;
arm0->yRot = -(0.1f - attack2 * 0.6f) + head->yRot;
arm1->yRot = +(0.1f - attack2 * 0.6f) + head->yRot + 0.4f;
arm0->xRot = -M_PI_2 + head->xRot;
arm1->xRot = -M_PI_2 + head->xRot;
arm0->xRot -= attack2 * 1.2f - attack * 0.4f;
arm1->xRot -= attack2 * 1.2f - attack * 0.4f;
arm0->zRot += ((float)(cosf(bob * 0.09f)) * 0.05f + 0.05f);
arm1->zRot -= ((float)(cosf(bob * 0.09f)) * 0.05f + 0.05f);
arm0->xRot += ((float)(sinf(bob * 0.067f)) * 0.05f);
arm1->xRot -= ((float)(sinf(bob * 0.067f)) * 0.05f);
}
}
}
void HumanoidModel::renderHair(float scale, bool 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);
}
void HumanoidModel::renderCloak(float scale, bool usecompiled) {
cloak->render(scale, 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->render(
scale, usecompiled,
(m_uiAnimOverrideBitmask & (1 << eAnim_DisableRenderHead)) > 0);
body->render(
scale, usecompiled,
(m_uiAnimOverrideBitmask & (1 << eAnim_DisableRenderTorso)) > 0);
arm0->render(
scale, usecompiled,
(m_uiAnimOverrideBitmask & (1 << eAnim_DisableRenderArm0)) > 0);
arm1->render(
scale, usecompiled,
(m_uiAnimOverrideBitmask & (1 << eAnim_DisableRenderArm1)) > 0);
leg0->render(
scale, usecompiled,
(m_uiAnimOverrideBitmask & (1 << eAnim_DisableRenderLeg0)) > 0);
leg1->render(
scale, usecompiled,
(m_uiAnimOverrideBitmask & (1 << eAnim_DisableRenderLeg1)) > 0);
hair->render(
scale, usecompiled,
(m_uiAnimOverrideBitmask & (1 << eAnim_DisableRenderHair)) > 0);
}