mirror of
https://github.com/4jcraft/4jcraft.git
synced 2026-08-20 09:57:10 +00:00
Remove DWORD skin IDs from player customisation APIs
This commit is contained in:
parent
62a1aea3fc
commit
3f374cecad
|
|
@ -1139,12 +1139,12 @@ void LocalPlayer::onCrafted(std::shared_ptr<ItemInstance> item)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LocalPlayer::setAndBroadcastCustomSkin(DWORD skinId)
|
void LocalPlayer::setAndBroadcastCustomSkin(std::uint32_t skinId)
|
||||||
{
|
{
|
||||||
setCustomSkin(skinId);
|
setCustomSkin(skinId);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LocalPlayer::setAndBroadcastCustomCape(DWORD capeId)
|
void LocalPlayer::setAndBroadcastCustomCape(std::uint32_t capeId)
|
||||||
{
|
{
|
||||||
setCustomCape(capeId);
|
setCustomCape(capeId);
|
||||||
}
|
}
|
||||||
|
|
@ -1613,4 +1613,3 @@ void LocalPlayer::SetPlayerAdditionalModelParts(std::vector<ModelPart *>pAdditio
|
||||||
{
|
{
|
||||||
m_pAdditionalModelParts=pAdditionalModelParts;
|
m_pAdditionalModelParts=pAdditionalModelParts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
#include <cstdint>
|
||||||
#include "../../Minecraft.World/Util/SmoothFloat.h"
|
#include "../../Minecraft.World/Util/SmoothFloat.h"
|
||||||
#include "../../Minecraft.World/Headers/net.minecraft.world.entity.player.h"
|
#include "../../Minecraft.World/Headers/net.minecraft.world.entity.player.h"
|
||||||
#include "../../Minecraft.World/Util/Pos.h"
|
#include "../../Minecraft.World/Util/Pos.h"
|
||||||
|
|
@ -161,8 +162,8 @@ public:
|
||||||
// 4J Stu - Added to allow callback to tutorial to stay within Minecraft.Client
|
// 4J Stu - Added to allow callback to tutorial to stay within Minecraft.Client
|
||||||
virtual void onCrafted(std::shared_ptr<ItemInstance> item);
|
virtual void onCrafted(std::shared_ptr<ItemInstance> item);
|
||||||
|
|
||||||
virtual void setAndBroadcastCustomSkin(DWORD skinId);
|
virtual void setAndBroadcastCustomSkin(std::uint32_t skinId);
|
||||||
virtual void setAndBroadcastCustomCape(DWORD capeId);
|
virtual void setAndBroadcastCustomCape(std::uint32_t capeId);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool isSolidBlock(int x, int y, int z);
|
bool isSolidBlock(int x, int y, int z);
|
||||||
|
|
|
||||||
|
|
@ -348,9 +348,9 @@ void MultiplayerLocalPlayer::StopSleeping()
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4J Added
|
// 4J Added
|
||||||
void MultiplayerLocalPlayer::setAndBroadcastCustomSkin(DWORD skinId)
|
void MultiplayerLocalPlayer::setAndBroadcastCustomSkin(std::uint32_t skinId)
|
||||||
{
|
{
|
||||||
DWORD oldSkinIndex = getCustomSkin();
|
std::uint32_t oldSkinIndex = getCustomSkin();
|
||||||
LocalPlayer::setCustomSkin(skinId);
|
LocalPlayer::setCustomSkin(skinId);
|
||||||
#ifndef _CONTENT_PACKAGE
|
#ifndef _CONTENT_PACKAGE
|
||||||
wprintf(L"Skin for local player %ls has changed to %ls (%d)\n", name.c_str(), customTextureUrl.c_str(), getPlayerDefaultSkin() );
|
wprintf(L"Skin for local player %ls has changed to %ls (%d)\n", name.c_str(), customTextureUrl.c_str(), getPlayerDefaultSkin() );
|
||||||
|
|
@ -358,9 +358,9 @@ void MultiplayerLocalPlayer::setAndBroadcastCustomSkin(DWORD skinId)
|
||||||
if(getCustomSkin() != oldSkinIndex) connection->send( std::shared_ptr<TextureAndGeometryChangePacket>( new TextureAndGeometryChangePacket( shared_from_this(), app.GetPlayerSkinName(GetXboxPad()) ) ) );
|
if(getCustomSkin() != oldSkinIndex) connection->send( std::shared_ptr<TextureAndGeometryChangePacket>( new TextureAndGeometryChangePacket( shared_from_this(), app.GetPlayerSkinName(GetXboxPad()) ) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void MultiplayerLocalPlayer::setAndBroadcastCustomCape(DWORD capeId)
|
void MultiplayerLocalPlayer::setAndBroadcastCustomCape(std::uint32_t capeId)
|
||||||
{
|
{
|
||||||
DWORD oldCapeIndex = getCustomCape();
|
std::uint32_t oldCapeIndex = getCustomCape();
|
||||||
LocalPlayer::setCustomCape(capeId);
|
LocalPlayer::setCustomCape(capeId);
|
||||||
#ifndef _CONTENT_PACKAGE
|
#ifndef _CONTENT_PACKAGE
|
||||||
wprintf(L"Cape for local player %ls has changed to %ls\n", name.c_str(), customTextureUrl2.c_str());
|
wprintf(L"Cape for local player %ls has changed to %ls\n", name.c_str(), customTextureUrl2.c_str());
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
#include <cstdint>
|
||||||
#include "LocalPlayer.h"
|
#include "LocalPlayer.h"
|
||||||
#include "../../Minecraft.World/Util/SharedConstants.h"
|
#include "../../Minecraft.World/Util/SharedConstants.h"
|
||||||
|
|
||||||
|
|
@ -68,6 +69,6 @@ public:
|
||||||
virtual void StopSleeping();
|
virtual void StopSleeping();
|
||||||
|
|
||||||
// 4J Added
|
// 4J Added
|
||||||
virtual void setAndBroadcastCustomSkin(DWORD skinId);
|
virtual void setAndBroadcastCustomSkin(std::uint32_t skinId);
|
||||||
virtual void setAndBroadcastCustomCape(DWORD capeId);
|
virtual void setAndBroadcastCustomCape(std::uint32_t capeId);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -620,7 +620,7 @@ void Player::setPlayerDefaultSkin(EDefaultSkins skin)
|
||||||
m_skinIndex = skin;
|
m_skinIndex = skin;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::setCustomSkin(DWORD skinId)
|
void Player::setCustomSkin(std::uint32_t skinId)
|
||||||
{
|
{
|
||||||
#ifndef _CONTENT_PACKAGE
|
#ifndef _CONTENT_PACKAGE
|
||||||
wprintf(L"Attempting to set skin to %08X for player %ls\n", skinId, name.c_str() );
|
wprintf(L"Attempting to set skin to %08X for player %ls\n", skinId, name.c_str() );
|
||||||
|
|
@ -634,8 +634,8 @@ void Player::setCustomSkin(DWORD skinId)
|
||||||
if( !GET_IS_DLC_SKIN_FROM_BITMASK(skinId) )
|
if( !GET_IS_DLC_SKIN_FROM_BITMASK(skinId) )
|
||||||
{
|
{
|
||||||
// GET_UGC_SKIN_ID_FROM_BITMASK will always be zero - this was for a possible custom skin editor skin
|
// GET_UGC_SKIN_ID_FROM_BITMASK will always be zero - this was for a possible custom skin editor skin
|
||||||
DWORD ugcSkinIndex = GET_UGC_SKIN_ID_FROM_BITMASK(skinId);
|
std::uint32_t ugcSkinIndex = GET_UGC_SKIN_ID_FROM_BITMASK(skinId);
|
||||||
DWORD defaultSkinIndex = GET_DEFAULT_SKIN_ID_FROM_BITMASK(skinId);
|
std::uint32_t defaultSkinIndex = GET_DEFAULT_SKIN_ID_FROM_BITMASK(skinId);
|
||||||
if( ugcSkinIndex == 0 && defaultSkinIndex > 0 )
|
if( ugcSkinIndex == 0 && defaultSkinIndex > 0 )
|
||||||
{
|
{
|
||||||
playerSkin = (EDefaultSkins) defaultSkinIndex;
|
playerSkin = (EDefaultSkins) defaultSkinIndex;
|
||||||
|
|
@ -699,7 +699,7 @@ void Player::setCustomSkin(DWORD skinId)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int Player::getSkinAnimOverrideBitmask(DWORD skinId)
|
unsigned int Player::getSkinAnimOverrideBitmask(std::uint32_t skinId)
|
||||||
{
|
{
|
||||||
unsigned long bitmask = 0L;
|
unsigned long bitmask = 0L;
|
||||||
if( GET_IS_DLC_SKIN_FROM_BITMASK(skinId) )
|
if( GET_IS_DLC_SKIN_FROM_BITMASK(skinId) )
|
||||||
|
|
@ -751,7 +751,7 @@ void Player::setXuid(PlayerUID xuid)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::setCustomCape(DWORD capeId)
|
void Player::setCustomCape(std::uint32_t capeId)
|
||||||
{
|
{
|
||||||
#ifndef _CONTENT_PACKAGE
|
#ifndef _CONTENT_PACKAGE
|
||||||
wprintf(L"Attempting to set cape to %08X for player %s\n", capeId, name.c_str() );
|
wprintf(L"Attempting to set cape to %08X for player %s\n", capeId, name.c_str() );
|
||||||
|
|
@ -801,10 +801,10 @@ void Player::setCustomCape(DWORD capeId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD Player::getCapeIdFromPath(const std::wstring &cape)
|
std::uint32_t Player::getCapeIdFromPath(const std::wstring &cape)
|
||||||
{
|
{
|
||||||
bool dlcCape = false;
|
bool dlcCape = false;
|
||||||
unsigned int capeId = 0;
|
std::uint32_t capeId = 0;
|
||||||
|
|
||||||
if(cape.size() >= 14)
|
if(cape.size() >= 14)
|
||||||
{
|
{
|
||||||
|
|
@ -827,7 +827,7 @@ DWORD Player::getCapeIdFromPath(const std::wstring &cape)
|
||||||
return capeId;
|
return capeId;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::wstring Player::getCapePathFromId(DWORD capeId)
|
std::wstring Player::getCapePathFromId(std::uint32_t capeId)
|
||||||
{
|
{
|
||||||
// 4J Stu - This function maps the encoded DWORD we store in the player profile
|
// 4J Stu - This function maps the encoded DWORD we store in the player profile
|
||||||
// to a filename that is stored as a memory texture and shared between systems in game
|
// to a filename that is stored as a memory texture and shared between systems in game
|
||||||
|
|
@ -840,8 +840,8 @@ std::wstring Player::getCapePathFromId(DWORD capeId)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DWORD ugcCapeIndex = GET_UGC_SKIN_ID_FROM_BITMASK(capeId);
|
std::uint32_t ugcCapeIndex = GET_UGC_SKIN_ID_FROM_BITMASK(capeId);
|
||||||
DWORD defaultCapeIndex = GET_DEFAULT_SKIN_ID_FROM_BITMASK(capeId);
|
std::uint32_t defaultCapeIndex = GET_DEFAULT_SKIN_ID_FROM_BITMASK(capeId);
|
||||||
if( ugcCapeIndex == 0 )
|
if( ugcCapeIndex == 0 )
|
||||||
{
|
{
|
||||||
swprintf(chars,256,L"defcape%08X.png",defaultCapeIndex);
|
swprintf(chars,256,L"defcape%08X.png",defaultCapeIndex);
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
#include "../Entities/Mob.h"
|
#include "../Entities/Mob.h"
|
||||||
#include "../Util/Definitions.h"
|
#include "../Util/Definitions.h"
|
||||||
|
|
@ -396,14 +397,14 @@ public:
|
||||||
virtual int getTexture(); // 4J changed from std::wstring to int
|
virtual int getTexture(); // 4J changed from std::wstring to int
|
||||||
void setPlayerDefaultSkin(EDefaultSkins skin);
|
void setPlayerDefaultSkin(EDefaultSkins skin);
|
||||||
EDefaultSkins getPlayerDefaultSkin() { return m_skinIndex; }
|
EDefaultSkins getPlayerDefaultSkin() { return m_skinIndex; }
|
||||||
virtual void setCustomSkin(DWORD skinId);
|
virtual void setCustomSkin(std::uint32_t skinId);
|
||||||
DWORD getCustomSkin() {return m_dwSkinId; }
|
std::uint32_t getCustomSkin() {return m_dwSkinId; }
|
||||||
virtual void setCustomCape(DWORD capeId);
|
virtual void setCustomCape(std::uint32_t capeId);
|
||||||
DWORD getCustomCape() {return m_dwCapeId; }
|
std::uint32_t getCustomCape() {return m_dwCapeId; }
|
||||||
|
|
||||||
static DWORD getCapeIdFromPath(const std::wstring &cape);
|
static std::uint32_t getCapeIdFromPath(const std::wstring &cape);
|
||||||
static std::wstring getCapePathFromId(DWORD capeId);
|
static std::wstring getCapePathFromId(std::uint32_t capeId);
|
||||||
static unsigned int getSkinAnimOverrideBitmask(DWORD skinId);
|
static unsigned int getSkinAnimOverrideBitmask(std::uint32_t skinId);
|
||||||
|
|
||||||
// 4J Added
|
// 4J Added
|
||||||
void setXuid(PlayerUID xuid);
|
void setXuid(PlayerUID xuid);
|
||||||
|
|
@ -436,7 +437,7 @@ protected:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
EDefaultSkins m_skinIndex;
|
EDefaultSkins m_skinIndex;
|
||||||
DWORD m_dwSkinId,m_dwCapeId;
|
std::uint32_t m_dwSkinId,m_dwCapeId;
|
||||||
|
|
||||||
// 4J Added - Used to show which colour the player is on the map/behind their name
|
// 4J Added - Used to show which colour the player is on the map/behind their name
|
||||||
DWORD m_playerIndex;
|
DWORD m_playerIndex;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue