This commit is contained in:
arsenicviscera 2026-03-10 18:05:50 -07:00
parent 907a9155e6
commit 6579d802d5
8 changed files with 47 additions and 11 deletions

View file

@ -1,7 +1,7 @@
#pragma once #pragma once
#define VER_PRODUCTBUILD 560 #define VER_PRODUCTBUILD 560
#define VER_PRODUCTVERSION_STR_W L"DEV (unknown version)" #define VER_PRODUCTVERSION_STR_W L""
#define VER_FILEVERSION_STR_W VER_PRODUCTVERSION_STR_W #define VER_FILEVERSION_STR_W VER_PRODUCTVERSION_STR_W
#define VER_BRANCHVERSION_STR_W L"UNKNOWN BRANCH" #define VER_BRANCHVERSION_STR_W L"UNKNOWN/"
#define VER_NETWORK VER_PRODUCTBUILD #define VER_NETWORK VER_PRODUCTBUILD

View file

@ -465,11 +465,13 @@ void LivingEntityRenderer::renderNameTags(shared_ptr<LivingEntity> mob, double x
{ {
if (mob->isSleeping()) if (mob->isSleeping())
{ {
renderNameTag(mob, msg, x, y - 1.5f, z, 64); renderNameTag(mob, msg, x, y - 1.5f, z, 64, mob->nametagColor); //This fills the "color" argument
} }
else else
{ {
renderNameTag(mob, msg, x, y, z, 64); //but THIS. THIS works. ???
mob->nametagColor = 0xFFFF0000;
renderNameTag(mob, msg, x, y, z, 64, mob->nametagColor);
} }
} }
@ -548,7 +550,6 @@ void LivingEntityRenderer::renderNameTag(shared_ptr<LivingEntity> mob, const wst
shared_ptr<Player> player = dynamic_pointer_cast<Player>(mob); shared_ptr<Player> player = dynamic_pointer_cast<Player>(mob);
if(app.isXuidDeadmau5( player->getXuid() ) ) offs = -10; if(app.isXuidDeadmau5( player->getXuid() ) ) offs = -10;
#if defined(__PS3__) || defined(__ORBIS__) #if defined(__PS3__) || defined(__ORBIS__)
// Check we have all the font characters for this player name // Check we have all the font characters for this player name
switch(player->GetPlayerNameValidState()) switch(player->GetPlayerNameValidState())
@ -649,14 +650,16 @@ void LivingEntityRenderer::renderNameTag(shared_ptr<LivingEntity> mob, const wst
t->end(); t->end();
glDepthFunc(GL_LEQUAL); glDepthFunc(GL_LEQUAL);
glEnable(GL_TEXTURE_2D); glEnable(GL_TEXTURE_2D);
glTranslatef(0.0f, 0.0f, -0.04f); glTranslatef(0.0f, 0.0f, -0.04f);
} }
if( textOpacity > 0.0f ) if( textOpacity > 0.0f )
{ {
//This works as intended
int textColor = ( ( static_cast<int>(textOpacity * 255) << 24 ) | 0xffffff ); int textColor = ( ( static_cast<int>(textOpacity * 255) << 24 ) | 0xffffff );
font->draw(playerName, -font->width(playerName) / 2, offs, textColor); font->draw(L"PLR " + mob->SettingThis ? L"YES" : L"NO", -font->width(playerName) / 2, offs, textColor);
} }
glEnable(GL_LIGHTING); glEnable(GL_LIGHTING);

View file

@ -120,6 +120,7 @@ LocalPlayer::LocalPlayer(Minecraft *minecraft, Level *level, User *user, int dim
lastClickTolerance = 0.0f; lastClickTolerance = 0.0f;
m_bHasAwardedStayinFrosty = false; m_bHasAwardedStayinFrosty = false;
} }
LocalPlayer::~LocalPlayer() LocalPlayer::~LocalPlayer()

View file

@ -65,8 +65,7 @@ PlayerRenderer::PlayerRenderer() : LivingEntityRenderer( new HumanoidModel(0), 0
unsigned int PlayerRenderer::getNametagColour(int index) unsigned int PlayerRenderer::getNametagColour(int index)
{ {
if( index >= 0 && index < MINECRAFT_NET_MAX_PLAYERS) if( index >= 0 && index < MINECRAFT_NET_MAX_PLAYERS) return nametagColorForIndex(index);
return nametagColorForIndex(index);
return 0xFF000000; return 0xFF000000;
} }
@ -496,6 +495,23 @@ void PlayerRenderer::renderNameTags(shared_ptr<LivingEntity> player, double x, d
} }
#endif #endif
//Check if the player is a local or server player, and if so, add the gamertag prefix to the nametag
//For some reason this is a LivingEntity instead of a Player, but this is derived from LivingEntityRenderer so it makes sense
//Anyways just recast
if (player->instanceof(eTYPE_PLAYER)) {
shared_ptr<Player> plr = static_pointer_cast<Player>(player);
//This doesn't work for some reason
player->nametagColor = 0xFF0000FF;
//But this does??? nametagColor is still black in the renderNameTag method, but it is set to the correct color here, so maybe the renderNameTag method is using a different player instance or something?
player->SettingThis = true; //This is how I know
}
//Set it literally right before, mind you both player and mob are LivingEntity
player->nametagColor = 0xFF0000FF; //This doesn't do anything and is still black.
LivingEntityRenderer::renderNameTags(player, x, y, z, msg, scale, dist); LivingEntityRenderer::renderNameTags(player, x, y, z, msg, scale, dist);
} }

View file

@ -93,6 +93,8 @@ void LivingEntity::_init()
speed = 0.0f; speed = 0.0f;
noJumpDelay = 0; noJumpDelay = 0;
absorptionAmount = 0.0f; absorptionAmount = 0.0f;
nametagColor = 0xff000000; //default black
} }
LivingEntity::LivingEntity( Level* level) : Entity(level) LivingEntity::LivingEntity( Level* level) : Entity(level)
@ -114,6 +116,7 @@ LivingEntity::LivingEntity( Level* level) : Entity(level)
yHeadRot = yRot; yHeadRot = yRot;
footSize = 0.5f; footSize = 0.5f;
} }
LivingEntity::~LivingEntity() LivingEntity::~LivingEntity()

View file

@ -80,6 +80,9 @@ public:
float yHeadRot, yHeadRotO; float yHeadRot, yHeadRotO;
float flyingSpeed; float flyingSpeed;
//New
int nametagColor;
bool SettingThis = false;
protected: protected:
shared_ptr<Player> lastHurtByPlayer; shared_ptr<Player> lastHurtByPlayer;
int lastHurtByPlayerTime; int lastHurtByPlayerTime;

View file

@ -41,6 +41,7 @@
#include "..\Minecraft.Client\LocalPlayer.h" #include "..\Minecraft.Client\LocalPlayer.h"
#include "..\Minecraft.Client\HumanoidModel.h" #include "..\Minecraft.Client\HumanoidModel.h"
#include "..\Minecraft.Client\Common\Colours\ColourTable.h"
#include "SoundTypes.h" #include "SoundTypes.h"
@ -101,6 +102,7 @@ void Player::_init()
m_bCheckedForModelParts=false; m_bCheckedForModelParts=false;
m_bCheckedDLCForModelParts=false; m_bCheckedDLCForModelParts=false;
#if defined(__PS3__) || defined(__ORBIS__) #if defined(__PS3__) || defined(__ORBIS__)
m_ePlayerNameValidState=ePlayerNameValid_NotSet; m_ePlayerNameValidState=ePlayerNameValid_NotSet;
#endif #endif
@ -108,6 +110,8 @@ void Player::_init()
enderChestInventory = std::make_shared<PlayerEnderChestContainer>(); enderChestInventory = std::make_shared<PlayerEnderChestContainer>();
m_bAwardedOnARail=false; m_bAwardedOnARail=false;
} }
Player::Player(Level *level, const wstring &name) : LivingEntity( level ) Player::Player(Level *level, const wstring &name) : LivingEntity( level )
@ -145,13 +149,18 @@ Player::Player(Level *level, const wstring &name) : LivingEntity( level )
setShowOnMaps(app.GetGameHostOption(eGameHostOption_Gamertags)!=0?true:false); setShowOnMaps(app.GetGameHostOption(eGameHostOption_Gamertags)!=0?true:false);
m_bIsGuest = false; m_bIsGuest = false;
#ifndef _XBOX_ONE #ifndef _XBOX_ONE
// 4J: Set UUID to name on none-XB1 consoles, may change in future but for now // 4J: Set UUID to name on none-XB1 consoles, may change in future but for now
// ownership of animals on these consoles is done by name // ownership of animals on these consoles is done by name
setUUID(name); setUUID(name);
#endif #endif
}
}
Player::~Player() Player::~Player()
{ {
// TODO 4J // TODO 4J

View file

@ -72,6 +72,7 @@ protected:
int jumpTriggerTime; int jumpTriggerTime;
public: public:
BYTE userType; BYTE userType;
float oBob, bob; float oBob, bob;