Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion Minecraft.Client/Common/UI/UIControl_PlayerSkinPreview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,12 @@ void UIControl_PlayerSkinPreview::render(EntityRenderer *renderer, double x, dou
glPushMatrix();
glDisable(GL_CULL_FACE);

HumanoidModel *model = static_cast<HumanoidModel *>(renderer->getModel());
HumanoidModel *model;

if (m_backupTexture == TN_MOB_CHAR8)
model = static_cast<HumanoidModel *>(renderer->getModelSlim());
else
model = static_cast<HumanoidModel *>(renderer->getModel());

//getAttackAnim(mob, a);
//if (armor != nullptr) armor->attackTime = model->attackTime;
Expand Down Expand Up @@ -353,6 +358,7 @@ void UIControl_PlayerSkinPreview::render(EntityRenderer *renderer, double x, dou

MemSect(31);
bindTexture(m_customTextureUrl, m_backupTexture);

MemSect(0);
glEnable(GL_ALPHA_TEST);

Expand Down
4 changes: 4 additions & 0 deletions Minecraft.Client/Common/UI/UIScene_SkinSelectMenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const WCHAR *UIScene_SkinSelectMenu::wchDefaultNamesA[]=
L"Prisoner Steve",
L"Cyclist Steve",
L"Boxer Steve",
L"Alex",
};

UIScene_SkinSelectMenu::UIScene_SkinSelectMenu(int iPad, void *initData, UILayer *parentLayer) : UIScene(iPad, parentLayer)
Expand Down Expand Up @@ -993,6 +994,9 @@ TEXTURE_NAME UIScene_SkinSelectMenu::getTextureId(int skinIndex)
case eDefaultSkins_Skin7:
texture = TN_MOB_CHAR7;
break;
case eDefaultSkins_Skin8:
texture = TN_MOB_CHAR8;
break;
};

return texture;
Expand Down
Binary file added Minecraft.Client/Common/res/1_2_2/mob/char8.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Minecraft.Client/Common/res/mob/char8.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion Minecraft.Client/EntityRenderDispatcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ EntityRenderDispatcher::EntityRenderDispatcher()
renderers[eTYPE_PIGZOMBIE] = new ZombieRenderer();
renderers[eTYPE_SLIME] = new SlimeRenderer(new SlimeModel(16), new SlimeModel(0), 0.25f);
renderers[eTYPE_LAVASLIME] = new LavaSlimeRenderer();
renderers[eTYPE_PLAYER] = new PlayerRenderer();
renderers[eTYPE_PLAYER] = new PlayerRenderer(true);
renderers[eTYPE_GIANT] = new GiantMobRenderer(new ZombieModel(), 0.5f, 6);
renderers[eTYPE_GHAST] = new GhastRenderer();
renderers[eTYPE_SQUID] = new SquidRenderer(new SquidModel(), 0.7f);
Expand Down Expand Up @@ -180,6 +180,7 @@ EntityRenderDispatcher::EntityRenderDispatcher()
EntityRenderer *EntityRenderDispatcher::getRenderer(eINSTANCEOF e)
{
if( (e & eTYPE_PLAYER) == eTYPE_PLAYER) e = eTYPE_PLAYER;
else if( (e & eTYPE_PLAYER) == eTYPE_PLAYER) e = eTYPE_PLAYER;
//EntityRenderer * r = renderers[e];
auto it = renderers.find(e); // 4J Stu - The .at and [] accessors insert elements if they don't exist

Expand Down
1 change: 1 addition & 0 deletions Minecraft.Client/EntityRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ ResourceLocation EntityRenderer::SHADOW_LOCATION = ResourceLocation(TN__CLAMP__M
EntityRenderer::EntityRenderer()
{
model = nullptr;
modelSlim = nullptr;
tileRenderer = new TileRenderer();
shadowRadius = 0;
shadowStrength = 1.0f;
Expand Down
2 changes: 2 additions & 0 deletions Minecraft.Client/EntityRenderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class EntityRenderer

protected:
Model *model; // TODO 4J: Check why exactly this is here, it seems to get shadowed by classes inheriting from this by their own
Model *modelSlim;

protected:
TileRenderer *tileRenderer; // 4J - changed to protected so derived classes can use instead of shadowing their own
Expand Down Expand Up @@ -68,5 +69,6 @@ class EntityRenderer
public:
// 4J Added
virtual Model *getModel() { return model; }
virtual Model *getModelSlim() { return modelSlim; }
virtual void SetItemFrame(bool bSet) {}
};
27 changes: 21 additions & 6 deletions Minecraft.Client/HumanoidModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ ModelPart * HumanoidModel::AddOrRetrievePart(SKIN_BOX *pBox)
return pNewBox;
}

void HumanoidModel::_init(float g, float yOffset, int texWidth, int texHeight)
void HumanoidModel::_init(float g, float yOffset, int texWidth, int texHeight, bool slimHands)
{
this->texWidth = texWidth;
this->texHeight = texHeight;
Expand All @@ -83,14 +83,23 @@ void HumanoidModel::_init(float g, float yOffset, int texWidth, int texHeight)
body->setPos(0, 0 + yOffset, 0);

arm0 = new ModelPart(this, 24 + 16, 16);
arm0->addHumanoidBox(-3, -2, -2, 4, 12, 4, g); // Arm0
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); // Arm1
arm1->setPos(5, 2 + yOffset, 0);

if (slimHands == false)
{
arm0->addHumanoidBox(-3, -2, -2, 4, 12, 4, g);
arm1->addHumanoidBox(-1, -2, -2, 4, 12, 4, g);
}
else if (slimHands == true)
{
arm0->addHumanoidBox(-2, -2, -2, 3, 12, 4, 0);
arm1->addHumanoidBox(-1, -2, -2, 3, 12, 4, 0);
}

leg0 = new ModelPart(this, 0, 16);
leg0->addHumanoidBox(-2, 0, -2, 4, 12, 4, g); // Leg0
leg0->setPos(-1.9, 12 + yOffset, 0);
Expand Down Expand Up @@ -125,19 +134,25 @@ void HumanoidModel::_init(float g, float yOffset, int texWidth, int texHeight)
m_uiAnimOverrideBitmask = 0L;
}


HumanoidModel::HumanoidModel() : Model()
{
_init(0, 0, 64, 32);
_init(0, 0, 64, 32, false);
}

HumanoidModel::HumanoidModel(float g) : Model()
{
_init(g, 0, 64, 32);
_init(g, 0, 64, 32, false);
}

HumanoidModel::HumanoidModel(float g, float yOffset, int texWidth, int texHeight) : Model()
{
_init(g,yOffset,texWidth,texHeight);
_init(g,yOffset,texWidth,texHeight, false);
}

HumanoidModel::HumanoidModel(float g, float yOffset, int texWidth, int texHeight, bool slimHands) : Model()
{
_init(g,yOffset,texWidth,texHeight, slimHands);
}

void HumanoidModel::render(shared_ptr<Entity> entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled)
Expand Down
5 changes: 3 additions & 2 deletions Minecraft.Client/HumanoidModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,11 @@ class HumanoidModel : public Model
(1<<HumanoidModel::eAnim_DisableRenderHair);


void _init(float g, float yOffset, int texWidth, int texHeight); // 4J added
void _init(float g, float yOffset, int texWidth, int texHeight, bool slimHands); // 4J added
HumanoidModel();
HumanoidModel(float g);
HumanoidModel(float g, float yOffset, int texWidth, int texHeight);
HumanoidModel(float g, float yOffset, int texWidth, int texHeight);
HumanoidModel(float g, float yOffset, int texWidth, int texHeight, bool slimHands);
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);
void renderHair(float scale, bool usecompiled);
Expand Down
53 changes: 38 additions & 15 deletions Minecraft.Client/LivingEntityRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,16 @@
#include "..\Minecraft.World\Mth.h"
#include "..\Minecraft.World\Player.h"


ResourceLocation LivingEntityRenderer::ENCHANT_GLINT_LOCATION = ResourceLocation(TN__BLUR__MISC_GLINT);
int LivingEntityRenderer::MAX_ARMOR_LAYERS = 4;

LivingEntityRenderer::LivingEntityRenderer(Model *model, float shadow)
LivingEntityRenderer::LivingEntityRenderer(Model *model, float shadow, bool slimHands)
{
this->model = model;

if (slimHands == true)
this->modelSlim = new HumanoidModel(0, 0, 64, 32, true);

shadowRadius = shadow;
armor = nullptr;
}
Expand Down Expand Up @@ -43,6 +46,8 @@ void LivingEntityRenderer::render(shared_ptr<Entity> _mob, double x, double y, d
}

shared_ptr<LivingEntity> mob = dynamic_pointer_cast<LivingEntity>(_mob);
shared_ptr<Player> player = dynamic_pointer_cast<Player>(_mob);
Model *resModel;

if (mob == nullptr)
{
Expand All @@ -52,12 +57,15 @@ void LivingEntityRenderer::render(shared_ptr<Entity> _mob, double x, double y, d
glPushMatrix();
glDisable(GL_CULL_FACE);

model->attackTime = getAttackAnim(mob, a);
if (armor != nullptr) armor->attackTime = model->attackTime;
model->riding = mob->isRiding();
if (armor != nullptr) armor->riding = model->riding;
model->young = mob->isBaby();
if (armor != nullptr) armor->young = model->young;
if (player != nullptr && modelSlim != nullptr && player->getPlayerDefaultSkin() == 9) resModel = modelSlim;
else resModel = model;

resModel->attackTime = getAttackAnim(mob, a);
if (armor != nullptr) armor->attackTime = resModel->attackTime;
resModel->riding = mob->isRiding();
if (armor != nullptr) armor->riding = resModel->riding;
resModel->young = mob->isBaby();
if (armor != nullptr) armor->young = resModel->young;

/*try*/
{
Expand Down Expand Up @@ -103,7 +111,7 @@ void LivingEntityRenderer::render(shared_ptr<Entity> _mob, double x, double y, d
if (ws > 1) ws = 1;

glEnable(GL_ALPHA_TEST);
model->prepareMobModel(mob, wp, ws, a);
resModel->prepareMobModel(mob, wp, ws, a);
renderModel(mob, wp, ws, bob, headRot - bodyRot, headRotx, fScale);

for (int i = 0; i < MAX_ARMOR_LAYERS; i++)
Expand Down Expand Up @@ -187,7 +195,7 @@ void LivingEntityRenderer::render(shared_ptr<Entity> _mob, double x, double y, d
if (mob->hurtTime > 0 || mob->deathTime > 0)
{
glColor4f(br, 0, 0, 0.4f);
model->render(mob, wp, ws, bob, headRot - bodyRot, headRotx, fScale, false);
resModel->render(mob, wp, ws, bob, headRot - bodyRot, headRotx, fScale, false);
for (int i = 0; i < MAX_ARMOR_LAYERS; i++)
{
if (prepareArmorOverlay(mob, i, a) >= 0)
Expand All @@ -205,7 +213,7 @@ void LivingEntityRenderer::render(shared_ptr<Entity> _mob, double x, double y, d
float b = ((overlayColor) & 0xff) / 255.0f;
float aa = ((overlayColor >> 24) & 0xff) / 255.0f;
glColor4f(r, g, b, aa);
model->render(mob, wp, ws, bob, headRot - bodyRot, headRotx, fScale, false);
resModel->render(mob, wp, ws, bob, headRot - bodyRot, headRotx, fScale, false);
for (int i = 0; i < MAX_ARMOR_LAYERS; i++)
{
if (prepareArmorOverlay(mob, i, a) >= 0)
Expand Down Expand Up @@ -242,10 +250,16 @@ void LivingEntityRenderer::render(shared_ptr<Entity> _mob, double x, double y, d

void LivingEntityRenderer::renderModel(shared_ptr<LivingEntity> mob, float wp, float ws, float bob, float headRotMinusBodyRot, float headRotx, float scale)
{
shared_ptr<Player> player = dynamic_pointer_cast<Player>(mob);
Model *resModel;

if (player != nullptr && modelSlim != nullptr && player->getPlayerDefaultSkin() == 9) resModel = modelSlim;
else resModel = model;

bindTexture(mob);
if (!mob->isInvisible())
{
model->render(mob, wp, ws, bob, headRotMinusBodyRot, headRotx, scale, true);
resModel->render(mob, wp, ws, bob, headRotMinusBodyRot, headRotx, scale, true);
}
else if(!mob->isInvisibleTo(dynamic_pointer_cast<Player>(Minecraft::GetInstance()->player)))
{
Expand All @@ -255,15 +269,15 @@ void LivingEntityRenderer::renderModel(shared_ptr<LivingEntity> mob, float wp, f
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glAlphaFunc(GL_GREATER, 1.0f / 255.0f);
model->render(mob, wp, ws, bob, headRotMinusBodyRot, headRotx, scale, true);
resModel->render(mob, wp, ws, bob, headRotMinusBodyRot, headRotx, scale, true);
glDisable(GL_BLEND);
glAlphaFunc(GL_GREATER, .1f);
glPopMatrix();
glDepthMask(true);
}
else
{
model->setupAnim(wp, ws, bob, headRotMinusBodyRot, headRotx, scale, mob);
resModel->setupAnim(wp, ws, bob, headRotMinusBodyRot, headRotx, scale, mob);
}
}

Expand Down Expand Up @@ -313,7 +327,9 @@ void LivingEntityRenderer::additionalRendering(shared_ptr<LivingEntity> mob, flo

void LivingEntityRenderer::renderArrows(shared_ptr<LivingEntity> mob, float a)
{
shared_ptr<Player> player = dynamic_pointer_cast<Player>(mob);
int arrowCount = mob->getArrowCount();

if (arrowCount > 0)
{
shared_ptr<Entity> arrow = std::make_shared<Arrow>(mob->level, mob->x, mob->y, mob->z);
Expand All @@ -322,7 +338,14 @@ void LivingEntityRenderer::renderArrows(shared_ptr<LivingEntity> mob, float a)
for (int i = 0; i < arrowCount; i++)
{
glPushMatrix();
ModelPart *modelPart = model->getRandomModelPart(random);

ModelPart *modelPart;

if (player != nullptr && modelSlim != nullptr && player->getPlayerDefaultSkin() == 9)
modelPart = model->getRandomModelPart(random);
else
modelPart = modelSlim->getRandomModelPart(random);

Cube *cube = modelPart->cubes[random.nextInt(modelPart->cubes.size())];
modelPart->translateTo(1 / 16.0f);
float xd = random.nextFloat();
Expand Down
2 changes: 1 addition & 1 deletion Minecraft.Client/LivingEntityRenderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class LivingEntityRenderer : public EntityRenderer
Model *armor;

public:
LivingEntityRenderer(Model *model, float shadow);
LivingEntityRenderer(Model *model, float shadow, bool slimHands);
virtual void render(shared_ptr<Entity> mob, double x, double y, double z, float rot, float a);
virtual void setArmor(Model *armor);

Expand Down
2 changes: 1 addition & 1 deletion Minecraft.Client/MobRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include "..\Minecraft.World\Mth.h"
#include "entityRenderDispatcher.h"

MobRenderer::MobRenderer(Model *model, float shadow) : LivingEntityRenderer(model, shadow)
MobRenderer::MobRenderer(Model *model, float shadow) : LivingEntityRenderer(model, shadow, false)
{
}

Expand Down
Loading