merge upstream

This commit is contained in:
Fireblade
2026-07-05 19:48:38 -04:00
parent 878198d6f1
commit 3f51fcb01f
85 changed files with 2097 additions and 914 deletions
+1 -1
View File
@@ -70,7 +70,7 @@ jobs:
- name: Build
run: |
export INSTALL_PREFIX=$PWD/result
taskset -c 0-2 ./build-linux.sh . Release
./build-linux.sh . Release
- name: Package artifacts
run: |
+1 -1
View File
@@ -1,4 +1,4 @@
name: Pull Request Build
name: Pull Request Build
on:
workflow_dispatch:
+6 -6
View File
@@ -69,7 +69,7 @@ jobs:
- name: Build
run: |
export INSTALL_PREFIX=$PWD/result
taskset -c 1-3 ./build-linux.sh . Release
./build-linux.sh . Release
- name: Package artifacts
run: |
@@ -130,12 +130,12 @@ jobs:
- name: Publish stable server release
uses: akkuman/gitea-release-action@v1
with:
name: ${{ steps.vars.outputs.version }} Server
name: v${{ steps.vars.outputs.version }} Server
direction: upload
server_url: ${{ gitea.server_url }}
repository: ${{ gitea.repository }}
token: ${{ gitea.token }}
tag_name: ${{ steps.vars.outputs.version }}-Dedicated-Server
tag_name: v${{ steps.vars.outputs.version }}-Dedicated-Server
prerelease: false
# override: true
verbose: true
@@ -152,12 +152,12 @@ jobs:
- name: Publish stable client release
uses: akkuman/gitea-release-action@v1
with:
name: ${{ steps.vars.outputs.version }}
name: v${{ steps.vars.outputs.version }}
direction: upload
server_url: ${{ gitea.server_url }}
repository: ${{ gitea.repository }}
token: ${{ gitea.token }}
tag_name: ${{ steps.vars.outputs.version }}
tag_name: v${{ steps.vars.outputs.version }}
prerelease: false
# override: true
verbose: true
@@ -187,4 +187,4 @@ jobs:
for ARTIFACT_ID in $(echo "$ARTIFACTS" | jq -r '.artifacts[].id // empty'); do
curl -s -X DELETE -H "$AUTH" \
"$API/repos/$REPO/actions/artifacts/$ARTIFACT_ID"
done
done
+9 -3
View File
@@ -1655,7 +1655,7 @@ void ClientConnection::handleChat(shared_ptr<ChatPacket> packet)
message = packet->m_stringArgs[0];
message = app.EscapeHTMLString(message); //do this to enforce escaped string
message = app.FormatChatMessage(message); //this needs to be last cause it converts colors to html colors that would have been escaped
message = app.FormatColoredString(message); //this needs to be last cause it converts colors to html colors that would have been escaped
} else {
message = L"";
}
@@ -2823,7 +2823,7 @@ void ClientConnection::handleTextureAndGeometry(shared_ptr<TextureAndGeometryPac
{
unsigned int uiAnimOverrideBitmask= app.GetAnimOverrideBitmask(packet->dwSkinID);
send(std::make_shared<TextureAndGeometryPacket>(packet->textureName, pbData, dwBytes, app.GetAdditionalSkinBoxes(packet->dwSkinID), uiAnimOverrideBitmask));
send(std::make_shared<TextureAndGeometryPacket>(packet->textureName, pbData, dwBytes, app.GetAdditionalSkinBoxes(packet->dwSkinID), app.GetSkinOffsets(packet->dwSkinID), uiAnimOverrideBitmask));
}
}
}
@@ -2840,6 +2840,11 @@ void ClientConnection::handleTextureAndGeometry(shared_ptr<TextureAndGeometryPac
{
app.SetAdditionalSkinBoxes(packet->dwSkinID,packet->BoxDataA,packet->dwBoxC);
}
// Add the offet data
if(packet->dwOffsetC!=0)
{
app.SetSkinOffsets(packet->dwSkinID,packet->OffsetDataA,packet->dwOffsetC);
}
// Add the anim override
app.SetAnimOverrideBitmask(packet->dwSkinID,packet->uiAnimOverrideBitmask);
@@ -4341,7 +4346,8 @@ void ClientConnection::handleSetPlayerTeamPacket(shared_ptr<SetPlayerTeamPacket>
void ClientConnection::handleParticleEvent(shared_ptr<LevelParticlesPacket> packet)
{
ePARTICLE_TYPE particleId = (ePARTICLE_TYPE)Integer::parseInt(packet->getName());
wstring particleName = packet->getName();
ePARTICLE_TYPE particleId = (ePARTICLE_TYPE)Integer::parseInt(particleName);
for (int i = 0; i < packet->getCount(); i++)
{
+168 -70
View File
@@ -201,6 +201,7 @@ CMinecraftApp::CMinecraftApp()
InitializeCriticalSection(&csTMSPPDownloadQueue);
InitializeCriticalSection(&csAdditionalModelParts);
InitializeCriticalSection(&csAdditionalSkinBoxes);
InitializeCriticalSection(&csSkinOffsets);
InitializeCriticalSection(&csAnimOverrideBitmask);
InitializeCriticalSection(&csMemFilesLock);
InitializeCriticalSection(&csMemTPDLock);
@@ -245,8 +246,7 @@ CMinecraftApp::CMinecraftApp()
}
void CMinecraftApp::GetSkinAdjustments(_SkinAdjustments* out,
unsigned int skinId)
void CMinecraftApp::GetSkinAdjustments(_SkinAdjustments* out, unsigned int skinId)
{
_SkinAdjustments adj;
@@ -264,8 +264,7 @@ void CMinecraftApp::GetSkinAdjustments(_SkinAdjustments* out,
*out = adj;
}
void CMinecraftApp::SetSkinAdjustments(unsigned int skinId,
const _SkinAdjustments& adj)
void CMinecraftApp::SetSkinAdjustments(unsigned int skinId, const _SkinAdjustments& adj)
{
EnterCriticalSection(&csAdditionalSkinBoxes);
@@ -6960,72 +6959,102 @@ wstring CMinecraftApp::EscapeHTMLString(const wstring& desc)
return finalString;
}
wstring CMinecraftApp::FormatChatMessage(const wstring& desc, bool applyStyling)
{
static std::wregex IDS_Pattern(LR"(\{\*IDS_(\d+)\*\})"); //maybe theres a better way to do translateable IDS
static std::wstring_view colorFormatString = L"<font color=\"#%08x\">";
wstring results = desc;
wchar_t replacements[64];
swprintf(replacements, 64, (applyStyling ? colorFormatString.data() : L""), GetHTMLColour(eHTMLColor_0), 0xFFFFFFFF);
results = replaceAll(results, L"\u00A70", replacements);
swprintf(replacements, 64, (applyStyling ? colorFormatString.data() : L""), GetHTMLColour(eHTMLColor_1), 0xFFFFFFFF);
results = replaceAll(results, L"\u00A71", replacements);
swprintf(replacements, 64, (applyStyling ? colorFormatString.data() : L""), GetHTMLColour(eHTMLColor_2), 0xFFFFFFFF);
results = replaceAll(results, L"\u00A72", replacements);
swprintf(replacements, 64, (applyStyling ? colorFormatString.data() : L""), GetHTMLColour(eHTMLColor_3), 0xFFFFFFFF);
results = replaceAll(results, L"\u00A73", replacements);
swprintf(replacements, 64, (applyStyling ? colorFormatString.data() : L""), GetHTMLColour(eHTMLColor_4), 0xFFFFFFFF);
results = replaceAll(results, L"\u00A74", replacements);
swprintf(replacements, 64, (applyStyling ? colorFormatString.data() : L""), GetHTMLColour(eHTMLColor_5), 0xFFFFFFFF);
results = replaceAll(results, L"\u00A75", replacements);
swprintf(replacements, 64, (applyStyling ? colorFormatString.data() : L""), GetHTMLColour(eHTMLColor_6), 0xFFFFFFFF);
results = replaceAll(results, L"\u00A76", replacements);
swprintf(replacements, 64, (applyStyling ? colorFormatString.data() : L""), GetHTMLColour(eHTMLColor_7), 0xFFFFFFFF);
results = replaceAll(results, L"\u00A77", replacements);
swprintf(replacements, 64, (applyStyling ? colorFormatString.data() : L""), GetHTMLColour(eHTMLColor_8), 0xFFFFFFFF);
results = replaceAll(results, L"\u00A78", replacements);
swprintf(replacements, 64, (applyStyling ? colorFormatString.data() : L""), GetHTMLColour(eHTMLColor_9), 0xFFFFFFFF);
results = replaceAll(results, L"\u00A79", replacements);
swprintf(replacements, 64, (applyStyling ? colorFormatString.data() : L""), GetHTMLColour(eHTMLColor_a), 0xFFFFFFFF);
results = replaceAll(results, L"\u00A7a", replacements);
swprintf(replacements, 64, (applyStyling ? colorFormatString.data() : L""), GetHTMLColour(eHTMLColor_b), 0xFFFFFFFF);
results = replaceAll(results, L"\u00A7b", replacements);
swprintf(replacements, 64, (applyStyling ? colorFormatString.data() : L""), GetHTMLColour(eHTMLColor_c), 0xFFFFFFFF);
results = replaceAll(results, L"\u00A7c", replacements);
swprintf(replacements, 64, (applyStyling ? colorFormatString.data() : L""), GetHTMLColour(eHTMLColor_d), 0xFFFFFFFF);
results = replaceAll(results, L"\u00A7d", replacements);
swprintf(replacements, 64, (applyStyling ? colorFormatString.data() : L""), GetHTMLColour(eHTMLColor_e), 0xFFFFFFFF);
results = replaceAll(results, L"\u00A7e", replacements);
swprintf(replacements, 64, (applyStyling ? colorFormatString.data() : L""), GetHTMLColour(eHTMLColor_f), 0xFFFFFFFF);
results = replaceAll(results, L"\u00A7f", replacements);
results = replaceAll(results, L"\u00A7r", replacements); //we only support color so reset is the same as white color
if (applyStyling) {
std::wsmatch match;
while (std::regex_search(results, match, IDS_Pattern)) {
results = replaceAll(results, match[0], app.GetString(std::stoi(match[1].str())));
}
eMinecraftColour GetColorFromCode(wchar_t _char) {
switch (_char) {
case L'0': return eHTMLColor_0;
case L'1': return eHTMLColor_1;
case L'2': return eHTMLColor_2;
case L'3': return eHTMLColor_3;
case L'4': return eHTMLColor_4;
case L'5': return eHTMLColor_5;
case L'6': return eHTMLColor_6;
case L'7': return eHTMLColor_7;
case L'8': return eHTMLColor_8;
case L'9': return eHTMLColor_9;
case L'a': return eHTMLColor_a;
case L'b': return eHTMLColor_b;
case L'c': return eHTMLColor_c;
case L'd': return eHTMLColor_d;
case L'e': return eHTMLColor_e;
case L'f': return eHTMLColor_f;
default: return eMinecraftColour_NOT_SET;
}
}
return results;
wstring CMinecraftApp::FormatColoredString(const wstring& string) {
static constexpr std::wstring_view colorFormatString = L"<font color=\"#%08x\">";
wstring result;
bool fontOpen = false;
bool italicOpen = false;
auto CloseItalic = [&]() {
if (italicOpen) {
result += L"</i>";
italicOpen = false;
}
};
auto CloseFont = [&]() {
if (fontOpen) {
result += L"</font>";
fontOpen = false;
}
};
wchar_t buffer[64];
for (size_t i = 0; i < string.length(); ++i) {
if (string[i] == L'\u00A7' && i + 1 < string.length()) {
wchar_t code = towlower(string[i + 1]);
if (GetColorFromCode(code) != eMinecraftColour_NOT_SET) {
bool restoreItalic = italicOpen;
CloseItalic();
CloseFont();
swprintf(buffer, _countof(buffer), colorFormatString.data(), GetHTMLColour(GetColorFromCode(code)));
result += buffer;
fontOpen = true;
if (restoreItalic) {
result += L"<i>";
italicOpen = true;
}
++i;
continue;
}
if (code == L'o') {
if (!italicOpen) {
result += L"<i>";
italicOpen = true;
}
++i;
continue;
}
if (code == L'r') {
CloseItalic();
CloseFont();
++i;
continue;
}
}
result += string[i];
}
CloseItalic();
CloseFont();
return result;
}
wstring CMinecraftApp::GetActionReplacement(int iPad, unsigned char ucAction)
@@ -9684,7 +9713,14 @@ void CMinecraftApp::SetAdditionalSkinBoxes(DWORD dwSkinID, SKIN_BOX *SkinBoxA, D
{
EntityRenderDispatcher *dispatcher = EntityRenderDispatcher::instance;
EntityRenderer *renderer = dispatcher ? dispatcher->getRenderer(eTYPE_PLAYER) : nullptr;
Model *pModel = renderer ? renderer->getModel() : nullptr;
unsigned int m_uiAnimOverrideBitmask = GetAnimOverrideBitmask(dwSkinID);
Model *pModel;
if (m_uiAnimOverrideBitmask & (1 << HumanoidModel::eAnim_SlimModel))
pModel = renderer ? renderer->getModel(2) : nullptr;
else if (m_uiAnimOverrideBitmask & (1 << HumanoidModel::eAnim_WideModel))
pModel = renderer ? renderer->getModel(1) : nullptr;
else
pModel = renderer ? renderer->getModel(0) : nullptr;
vector<ModelPart *> *pvModelPart = new vector<ModelPart *>;
vector<SKIN_BOX *> *pvSkinBoxes = new vector<SKIN_BOX *>;
@@ -9717,7 +9753,14 @@ vector<ModelPart *> * CMinecraftApp::SetAdditionalSkinBoxes(DWORD dwSkinID, vect
{
EntityRenderDispatcher *dispatcher = EntityRenderDispatcher::instance;
EntityRenderer *renderer = dispatcher ? dispatcher->getRenderer(eTYPE_PLAYER) : nullptr;
Model *pModel = renderer ? renderer->getModel() : nullptr;
unsigned int m_uiAnimOverrideBitmask = GetAnimOverrideBitmask(dwSkinID);
Model *pModel;
if (m_uiAnimOverrideBitmask & (1 << HumanoidModel::eAnim_SlimModel))
pModel = renderer ? renderer->getModel(2) : nullptr;
else if (m_uiAnimOverrideBitmask & (1 << HumanoidModel::eAnim_WideModel))
pModel = renderer ? renderer->getModel(1) : nullptr;
else
pModel = renderer ? renderer->getModel(0) : nullptr;
vector<ModelPart *> *pvModelPart = new vector<ModelPart *>;
EnterCriticalSection( &csAdditionalModelParts );
@@ -9742,6 +9785,44 @@ vector<ModelPart *> * CMinecraftApp::SetAdditionalSkinBoxes(DWORD dwSkinID, vect
return pvModelPart;
}
void CMinecraftApp::SetSkinOffsets(DWORD dwSkinID, SKIN_OFFSET *SkinOffsetA, DWORD dwSkinOffsetC)
{
vector<SKIN_OFFSET *> *pvSkinOffset = new vector<SKIN_OFFSET *>;
EnterCriticalSection( &csSkinOffsets );
app.DebugPrintf("*** SetSkinOffsets - Adding skin offsets for skin %d from array of Skin Offsets\n",dwSkinID&0x0FFFFFFF);
for(unsigned int i=0;i<dwSkinOffsetC;i++)
{
pvSkinOffset->push_back(&SkinOffsetA[i]);
}
m_SkinOffsets.insert( std::pair<DWORD, vector<SKIN_OFFSET *> *>(dwSkinID, pvSkinOffset) );
LeaveCriticalSection( &csSkinOffsets );
}
vector<SKIN_OFFSET *> * CMinecraftApp::SetSkinOffsets(DWORD dwSkinID, vector<SKIN_OFFSET *> *pvSkinOffsetA)
{
vector<SKIN_OFFSET *> *pvSkinOffset = new vector<SKIN_OFFSET *>;
EnterCriticalSection( &csSkinOffsets );
app.DebugPrintf("*** SetSkinOffsets - Inserting skin offsets for skin %d from array of Skin Offsets\n",dwSkinID&0x0FFFFFFF);
for( auto& it : *pvSkinOffsetA )
{
pvSkinOffset->push_back(it);
}
m_SkinOffsets.emplace(dwSkinID, pvSkinOffsetA);
LeaveCriticalSection( &csSkinOffsets );
return pvSkinOffset;
}
vector<ModelPart *> *CMinecraftApp::GetAdditionalModelParts(DWORD dwSkinID)
{
@@ -9777,6 +9858,23 @@ vector<SKIN_BOX *> *CMinecraftApp::GetAdditionalSkinBoxes(DWORD dwSkinID)
return pvSkinBoxes;
}
vector<SKIN_OFFSET *> *CMinecraftApp::GetSkinOffsets(DWORD dwSkinID)
{
EnterCriticalSection( &csSkinOffsets );
vector<SKIN_OFFSET *> *pvSkinOffsets=nullptr;
if(m_SkinOffsets.size()>0)
{
auto it = m_SkinOffsets.find(dwSkinID);
if(it!=m_SkinOffsets.end())
{
pvSkinOffsets = (*it).second;
}
}
LeaveCriticalSection( &csSkinOffsets );
return pvSkinOffsets;
}
unsigned int CMinecraftApp::GetAnimOverrideBitmask(DWORD dwSkinID)
{
EnterCriticalSection( &csAnimOverrideBitmask );
+7 -1
View File
@@ -21,6 +21,7 @@ using namespace std;
#include "./GameRules/ConsoleGameRulesConstants.h"
#include "./GameRules/GameRuleManager.h"
#include "../SkinBox.h"
#include "../SkinOffset.h"
#include "../ArchiveFile.h"
#include "lce_filesystem/FolderFile.h"
@@ -574,7 +575,7 @@ public:
int GetHTMLFontSize(EHTMLFontSize size);
wstring FormatHTMLString(int iPad, const wstring& desc, int shadowColour = 0xFFFFFFFF, bool override = false);
wstring EscapeHTMLString(const wstring &desc);
wstring FormatChatMessage(const wstring& desc, bool applyStyling = true);
wstring FormatColoredString(const wstring& desc);
wstring GetActionReplacement(int iPad, unsigned char ucAction);
wstring GetVKReplacement(unsigned int uiVKey, bool override = false);
wstring GetIconReplacement(unsigned int uiIcon);
@@ -848,6 +849,7 @@ private:
CRITICAL_SECTION csTMSPPDownloadQueue;
CRITICAL_SECTION csAdditionalModelParts;
CRITICAL_SECTION csAdditionalSkinBoxes;
CRITICAL_SECTION csSkinOffsets;
CRITICAL_SECTION csAnimOverrideBitmask;
bool m_bCorruptSaveDeleted;
wstring m_currentSaveFolderName; // 4J Added: for hardcore world deletion on Win64
@@ -870,6 +872,9 @@ public:
vector<ModelPart *> * SetAdditionalSkinBoxes(DWORD dwSkinID, vector<SKIN_BOX *> *pvSkinBoxA);
vector<ModelPart *> *GetAdditionalModelParts(DWORD dwSkinID);
vector<SKIN_BOX *> *GetAdditionalSkinBoxes(DWORD dwSkinID);
void SetSkinOffsets(DWORD dwSkinID, SKIN_OFFSET *SkinOffsetA, DWORD dwSkinOffsetC);
vector<SKIN_OFFSET *> * SetSkinOffsets(DWORD dwSkinID, vector<SKIN_OFFSET *> *pvSkinOffsetA);
vector<SKIN_OFFSET *> *GetSkinOffsets(DWORD dwSkinID);
void SetAnimOverrideBitmask(DWORD dwSkinID,unsigned int uiAnimOverrideBitmask);
unsigned int GetAnimOverrideBitmask(DWORD dwSkinID);
@@ -900,6 +905,7 @@ private:
// vector of additional skin model parts, indexed by the skin texture id
unordered_map<DWORD, vector<ModelPart *> *> m_AdditionalModelParts;
unordered_map<DWORD, vector<SKIN_BOX *> *> m_AdditionalSkinBoxes;
unordered_map<DWORD, vector<SKIN_OFFSET *> *> m_SkinOffsets;
unordered_map<DWORD, unsigned int> m_AnimOverrides;
@@ -109,6 +109,7 @@ const WCHAR *DLCManager::wchTypeNamesA[]=
L"ENCHANTTEXTFOCUSCOLOUR",
L"DATAPATH",
L"PACKVERSION",
L"OFFSET",
};
DLCManager::DLCManager()
+1
View File
@@ -45,6 +45,7 @@ public:
e_DLCParamType_EnchantmentTextFocusColour,
e_DLCParamType_DataPath,
e_DLCParamType_PackVersion,
e_DLCParamType_Offset,
e_DLCParamType_Max,
+220 -3
View File
@@ -120,9 +120,9 @@ void DLCSkinFile::addParameter(DLCManager::EDLCParameterType type, const wstring
#ifdef __PS3__
// 4J Stu - The Xbox version used swscanf_s which isn't available in GCC.
swscanf(value.c_str(), L"%10ls%f%f%f%f%f%f%f%f", wchBodyPart,
swscanf(value.c_str(), L"%10ls%f%f%f%f%f%f%f%f%f%f%f", wchBodyPart,
#else
swscanf_s(value.c_str(), L"%9ls%f%f%f%f%f%f%f%f", wchBodyPart,10,
swscanf_s(value.c_str(), L"%9ls%f%f%f%f%f%f%f%f%f%f%f", wchBodyPart,10,
#endif
&pSkinBox->fX,
&pSkinBox->fY,
@@ -131,7 +131,10 @@ void DLCSkinFile::addParameter(DLCManager::EDLCParameterType type, const wstring
&pSkinBox->fH,
&pSkinBox->fD,
&pSkinBox->fU,
&pSkinBox->fV);
&pSkinBox->fV,
&pSkinBox->fA,
&pSkinBox->fM,
&pSkinBox->fS);
if(wcscmp(wchBodyPart,L"HEAD")==0)
{
@@ -157,11 +160,216 @@ void DLCSkinFile::addParameter(DLCManager::EDLCParameterType type, const wstring
{
pSkinBox->ePart=eBodyPart_Leg1;
}
else if(wcscmp(wchBodyPart,L"HEADWEAR")==0)
{
pSkinBox->ePart=eBodyPart_Headwear;
}
else if(wcscmp(wchBodyPart,L"JACKET")==0)
{
pSkinBox->ePart=eBodyPart_Jacket;
}
else if(wcscmp(wchBodyPart,L"SLEEVE0")==0)
{
pSkinBox->ePart=eBodyPart_Sleeve0;
}
else if(wcscmp(wchBodyPart,L"SLEEVE1")==0)
{
pSkinBox->ePart=eBodyPart_Sleeve1;
}
else if(wcscmp(wchBodyPart,L"PANTS0")==0)
{
pSkinBox->ePart=eBodyPart_Pants0;
}
else if(wcscmp(wchBodyPart,L"PANTS1")==0)
{
pSkinBox->ePart=eBodyPart_Pants1;
}
else if(wcscmp(wchBodyPart,L"WAIST")==0)
{
pSkinBox->ePart=eBodyPart_Waist;
}
else if(wcscmp(wchBodyPart,L"LEGGING0")==0)
{
pSkinBox->ePart=eBodyPart_Legging0;
}
else if(wcscmp(wchBodyPart,L"LEGGING1")==0)
{
pSkinBox->ePart=eBodyPart_Legging1;
}
else if(wcscmp(wchBodyPart,L"SOCK0")==0)
{
pSkinBox->ePart=eBodyPart_Sock0;
}
else if(wcscmp(wchBodyPart,L"SOCK1")==0)
{
pSkinBox->ePart=eBodyPart_Sock1;
}
else if(wcscmp(wchBodyPart,L"BOOT0")==0)
{
pSkinBox->ePart=eBodyPart_Boot0;
}
else if(wcscmp(wchBodyPart,L"BOOT1")==0)
{
pSkinBox->ePart=eBodyPart_Boot1;
}
else if(wcscmp(wchBodyPart,L"ARMARMOR0")==0)
{
pSkinBox->ePart=eBodyPart_ArmArmor0;
}
else if(wcscmp(wchBodyPart,L"ARMARMOR1")==0)
{
pSkinBox->ePart=eBodyPart_ArmArmor1;
}
else if(wcscmp(wchBodyPart,L"BODYARMOR")==0)
{
pSkinBox->ePart=eBodyPart_BodyArmor;
}
else if(wcscmp(wchBodyPart,L"BELT")==0)
{
pSkinBox->ePart=eBodyPart_Belt;
}
// add this to the skin's vector of parts
m_AdditionalBoxes.push_back(pSkinBox);
}
break;
case DLCManager::e_DLCParamType_Offset:
{
WCHAR wchBodyPart[10];
wchar_t wchDirection[2];
SKIN_OFFSET *pSkinOffset = new SKIN_OFFSET;
ZeroMemory(pSkinOffset,sizeof(SKIN_OFFSET));
#ifdef __PS3__
// 4J Stu - The Xbox version used swscanf_s which isn't available in GCC.
swscanf(value.c_str(), L"%10ls%2ls%f", wchBodyPart,
#else
swscanf_s(value.c_str(), L"%9ls%2ls%f", wchBodyPart,10, wchDirection,2,
#endif
&pSkinOffset->fO);
if(wcscmp(wchDirection,L"X")==0)
{
pSkinOffset->fD=eOffsetDirection_X;
}
else if (wcscmp(wchDirection,L"Y")==0)
{
pSkinOffset->fD=eOffsetDirection_Y;
}
else if(wcscmp(wchDirection,L"Z")==0)
{
pSkinOffset->fD=eOffsetDirection_Z;
}
if(wcscmp(wchBodyPart,L"HEAD")==0)
{
pSkinOffset->ePart=eBodyOffset_Head;
}
else if(wcscmp(wchBodyPart,L"BODY")==0)
{
pSkinOffset->ePart=eBodyOffset_Body;
}
else if(wcscmp(wchBodyPart,L"ARM0")==0)
{
pSkinOffset->ePart=eBodyOffset_Arm0;
}
else if(wcscmp(wchBodyPart,L"ARM1")==0)
{
pSkinOffset->ePart=eBodyOffset_Arm1;
}
else if(wcscmp(wchBodyPart,L"LEG0")==0)
{
pSkinOffset->ePart=eBodyOffset_Leg0;
}
else if(wcscmp(wchBodyPart,L"LEG1")==0)
{
pSkinOffset->ePart=eBodyOffset_Leg1;
}
else if(wcscmp(wchBodyPart,L"HEADWEAR")==0)
{
pSkinOffset->ePart=eBodyOffset_Headwear;
}
else if(wcscmp(wchBodyPart,L"JACKET")==0)
{
pSkinOffset->ePart=eBodyOffset_Jacket;
}
else if(wcscmp(wchBodyPart,L"SLEEVE0")==0)
{
pSkinOffset->ePart=eBodyOffset_Sleeve0;
}
else if(wcscmp(wchBodyPart,L"SLEEVE1")==0)
{
pSkinOffset->ePart=eBodyOffset_Sleeve1;
}
else if(wcscmp(wchBodyPart,L"PANTS0")==0)
{
pSkinOffset->ePart=eBodyOffset_Pants0;
}
else if(wcscmp(wchBodyPart,L"PANTS1")==0)
{
pSkinOffset->ePart=eBodyOffset_Pants1;
}
else if(wcscmp(wchBodyPart,L"HELMET")==0)
{
pSkinOffset->ePart=eBodyOffset_Helmet;
}
else if(wcscmp(wchBodyPart,L"WAIST")==0)
{
pSkinOffset->ePart=eBodyOffset_Waist;
}
else if(wcscmp(wchBodyPart,L"LEGGING0")==0)
{
pSkinOffset->ePart=eBodyOffset_Legging0;
}
else if(wcscmp(wchBodyPart,L"LEGGING1")==0)
{
pSkinOffset->ePart=eBodyOffset_Legging1;
}
else if(wcscmp(wchBodyPart,L"SOCK0")==0)
{
pSkinOffset->ePart=eBodyOffset_Sock0;
}
else if(wcscmp(wchBodyPart,L"SOCK1")==0)
{
pSkinOffset->ePart=eBodyOffset_Sock1;
}
else if(wcscmp(wchBodyPart,L"BOOT0")==0)
{
pSkinOffset->ePart=eBodyOffset_Boot0;
}
else if(wcscmp(wchBodyPart,L"BOOT1")==0)
{
pSkinOffset->ePart=eBodyOffset_Boot1;
}
else if(wcscmp(wchBodyPart,L"ARMARMOR1")==0)
{
pSkinOffset->ePart=eBodyOffset_ArmArmor1;
}
else if(wcscmp(wchBodyPart,L"ARMARMOR0")==0)
{
pSkinOffset->ePart=eBodyOffset_ArmArmor0;
}
else if(wcscmp(wchBodyPart,L"BODYARMOR")==0)
{
pSkinOffset->ePart=eBodyOffset_BodyArmor;
}
else if(wcscmp(wchBodyPart,L"BELT")==0)
{
pSkinOffset->ePart=eBodyOffset_Belt;
}
else if(wcscmp(wchBodyPart,L"TOOL0")==0)
{
pSkinOffset->ePart=eBodyOffset_Tool0;
}
else if(wcscmp(wchBodyPart,L"TOOL1")==0)
{
pSkinOffset->ePart=eBodyOffset_Tool1;
}
// add this to the skin's vector of offsets
m_Offsets.push_back(pSkinOffset);
}
break;
case DLCManager::e_DLCParamType_Anim:
#ifdef __PS3__
// 4J Stu - The Xbox version used swscanf_s which isn't available in GCC.
@@ -189,6 +397,15 @@ vector<SKIN_BOX *> *DLCSkinFile::getAdditionalBoxes()
return &m_AdditionalBoxes;
}
int DLCSkinFile::getOffsetsCount()
{
return static_cast<int>(m_Offsets.size());
}
vector<SKIN_OFFSET *> *DLCSkinFile::getOffsets()
{
return &m_Offsets;
}
wstring DLCSkinFile::getParameterAsString(DLCManager::EDLCParameterType type)
{
switch(type)
@@ -13,6 +13,7 @@ private:
unsigned int m_uiAnimOverrideBitmask;
bool m_bIsFree;
vector<SKIN_BOX *> m_AdditionalBoxes;
vector<SKIN_OFFSET *> m_Offsets;
_SkinAdjustments m_skinAdjustments;
public:
@@ -26,6 +27,8 @@ public:
bool getParameterAsBool(DLCManager::EDLCParameterType type) override;
vector<SKIN_BOX *> *getAdditionalBoxes();
int getAdditionalBoxesCount();
vector<SKIN_OFFSET *> *getOffsets();
int getOffsetsCount();
unsigned int getAnimOverrideBitmask() { return m_uiAnimOverrideBitmask;}
bool isFree() {return m_bIsFree;}
};
@@ -13,6 +13,9 @@
#include <iostream>
#endif
#include <codecvt>
#include <string>
CPlatformNetworkManagerStub *g_pPlatformNetworkManager;
@@ -910,14 +913,13 @@ void CPlatformNetworkManagerStub::SearchForGames()
if (std::fread(&nameLen, sizeof(uint16_t), 1, file) != 1) break;
if (nameLen > 256) break;
char nameBuf[257] = {};
if (nameLen > 0)
{
if (std::fread(nameBuf, 1, nameLen, file) != nameLen) break;
wstring wName = L"";
for (int l = 0; l < nameLen; l++) {
uint16_t _char = 0;
if (std::fread(&_char, 1, 1, file) != 1) break;
wName += _char;
}
wstring wName = convStringToWstring(nameBuf);
FriendSessionInfo* info = new FriendSessionInfo();
size_t nLen = wName.length();
info->displayLabel = new wchar_t[nLen + 1];
@@ -8,7 +8,6 @@
#include "../../ModelPart.h"
#include "../../Options.h"
#include "../../../Minecraft.World/net.minecraft.world.entity.player.h"
#include "Skins.h"
#include "UIControl_PlayerSkinPreview.h"
#include <string>
@@ -108,6 +107,7 @@ UIControl_PlayerSkinPreview::UIControl_PlayerSkinPreview()
m_framesAnimatingRotation = 0;
m_bAnimatingToFacing = false;
m_pvAdditionalModelParts=nullptr;
m_pvSkinOffsets=nullptr;
m_uiAnimOverrideBitmask=0L;
}
@@ -184,6 +184,7 @@ void UIControl_PlayerSkinPreview::SetTexture(const wstring &url, TEXTURE_NAME ba
}
m_pvAdditionalModelParts=app.GetAdditionalModelParts(app.getSkinIdFromPath(m_customTextureUrl));
m_pvSkinOffsets=app.GetSkinOffsets(app.getSkinIdFromPath(m_customTextureUrl));
}
void UIControl_PlayerSkinPreview::SetFacing(ESkinPreviewFacing facing, bool bAnimate /*= false*/)
@@ -309,24 +310,8 @@ void UIControl_PlayerSkinPreview::render(EntityRenderer *renderer, double x, dou
glPushMatrix();
glDisable(GL_CULL_FACE);
HumanoidModel *model = static_cast<HumanoidModel *>(renderer->getModel());
Textures *textures = Minecraft::GetInstance()->textures;
int skinId = textures->loadMemTexture(m_customTextureUrl, m_backupTexture) - 37;
if (slim[skinId] == true)
{
if (textures->getHeight(m_customTextureUrl, m_backupTexture) == 64)
model = static_cast<HumanoidModel *>(renderer->getNewModelSlim());
else
model = static_cast<HumanoidModel *>(renderer->getModelSlim());
}
else
{
if (textures->getHeight(m_customTextureUrl, m_backupTexture) == 64)
model = static_cast<HumanoidModel *>(renderer->getNewModel());
else
model = static_cast<HumanoidModel *>(renderer->getModel());
}
Textures *t = Minecraft::GetInstance()->textures;
HumanoidModel *model = static_cast<HumanoidModel *>(renderer->getModel(Player::GetModelTypeFromTextureId(t->loadMemTexture(m_customTextureUrl, m_backupTexture)-36)+Player::GetModelTypeFromAnimBitmask(m_uiAnimOverrideBitmask)));
//getAttackAnim(mob, a);
//if (armor != nullptr) armor->attackTime = model->attackTime;
@@ -438,7 +423,7 @@ void UIControl_PlayerSkinPreview::render(EntityRenderer *renderer, double x, dou
glEnable(GL_ALPHA_TEST);
//model->prepareMobModel(mob, wp, ws, a);
model->render(nullptr, wp, ws, bob, headRot - bodyRot, headRotx, _scale, true);
model->renderUI(wp, ws, bob, headRot - bodyRot, headRotx, _scale, true, m_pvSkinOffsets);
/*for (int i = 0; i < MAX_ARMOR_LAYERS; i++)
{
if (prepareArmor(mob, i, a))
@@ -53,6 +53,7 @@ private:
ESkinPreviewAnimations m_currentAnimation;
//vector<Model::SKIN_BOX *> *m_pvAdditionalBoxes;
vector<ModelPart *> *m_pvAdditionalModelParts;
vector<SKIN_OFFSET *> *m_pvSkinOffsets;
public:
enum ESkinPreviewFacing
{
@@ -19,7 +19,10 @@ UIScene_ContainerMenu::UIScene_ContainerMenu(int iPad, void *_initData, UILayer
// Setup all the Iggy references we need for this scene
initialiseMovie();
m_labelChest.init(initData->container->getName());
IggyValueSetBooleanRS(m_labelChest.getIggyValuePath(), 0, "m_bUseHtmlText", true);
wstring title = app.EscapeHTMLString(initData->container->getName());
m_labelChest.init(app.FormatColoredString(title));
ContainerMenu* menu = new ContainerMenu( initData->inventory, initData->container );
+60 -4
View File
@@ -21,6 +21,28 @@ UIScene_HUD::UIScene_HUD(int iPad, void *initData, UILayer *parentLayer) : UISce
SetDragonLabel( app.GetString( IDS_BOSS_ENDERDRAGON_HEALTH ) );
SetSelectedLabel(L"");
//enable colors for selected item text
{
IggyValuePath classPath;
IggyValuePathMakeNameRef(&classPath, m_rootPath, "SelectedLabel");
IggyValuePath labelPath;
IggyValuePathMakeNameRef(&labelPath, &classPath, "Label");
IggyValueSetBooleanRS(&labelPath, 0, "m_bUseHtmlText", true);
}
//enable colors for boss bar
{
IggyValuePath classPath;
IggyValuePathMakeNameRef(&classPath, m_rootPath, "m_DragonHealthBar");
IggyValuePath labelPath;
IggyValuePathMakeNameRef(&labelPath, &classPath, "m_DragonHealthLabel");
IggyValueSetBooleanRS(&labelPath, 0, "m_bUseHtmlText", true);
}
for(unsigned int i = 0; i < CHAT_LINES_COUNT; ++i)
{
m_labelChatText[i].init(L"");
@@ -263,6 +285,28 @@ void UIScene_HUD::handleReload()
SetDragonLabel(BossMobGuiInfo::name[idx]);
SetSelectedLabel(L"");
//enable colors for selected item text
{
IggyValuePath classPath;
IggyValuePathMakeNameRef(&classPath, m_rootPath, "SelectedLabel");
IggyValuePath labelPath;
IggyValuePathMakeNameRef(&labelPath, &classPath, "Label");
IggyValueSetBooleanRS(&labelPath, 0, "m_bUseHtmlText", true);
}
//enable colors for boss bar
{
IggyValuePath classPath;
IggyValuePathMakeNameRef(&classPath, m_rootPath, "m_DragonHealthBar");
IggyValuePath labelPath;
IggyValuePathMakeNameRef(&labelPath, &classPath, "m_DragonHealthLabel");
IggyValueSetBooleanRS(&labelPath, 0, "m_bUseHtmlText", true);
}
for(unsigned int i = 0; i < CHAT_LINES_COUNT; ++i)
{
m_labelChatText[i].init(L"");
@@ -569,11 +613,17 @@ void UIScene_HUD::SetDragonHealth(float health)
void UIScene_HUD::SetDragonLabel(const wstring &label)
{
wstring itemName = L"";
if (!label.empty()) {
itemName = app.EscapeHTMLString(label);
itemName = app.FormatColoredString(itemName);
}
IggyDataValue result;
IggyDataValue value[1];
IggyStringUTF16 stringVal;
stringVal.string = (IggyUTF16*)label.c_str();
stringVal.length = label.length();
stringVal.string = (IggyUTF16*)itemName.c_str();
stringVal.length = itemName.length();
value[0].type = IGGY_DATATYPE_string_UTF16;
value[0].string16 = stringVal;
IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcSetDragonLabel , 1 , value );
@@ -599,11 +649,17 @@ void UIScene_HUD::SetSelectedLabel(const wstring &label)
// 4J Stu - Timing here is kept the same as on Xbox360, even though we do it differently now and do the fade out in Flash rather than directly setting opacity
if(!label.empty()) m_uiSelectedItemOpacityCountDown = SharedConstants::TICKS_PER_SECOND * 3;
wstring itemName = L"";
if (!label.empty()) {
itemName = app.EscapeHTMLString(label);
itemName = app.FormatColoredString(itemName);
}
IggyDataValue result;
IggyDataValue value[1];
IggyStringUTF16 stringVal;
stringVal.string = (IggyUTF16*)label.c_str();
stringVal.length = label.length();
stringVal.string = (IggyUTF16*)itemName.c_str();
stringVal.length = itemName.length();
value[0].type = IGGY_DATATYPE_string_UTF16;
value[0].string16 = stringVal;
IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcSetSelectedLabel , 1 , value );
@@ -375,7 +375,7 @@ void UIScene_JoinMenu::updateServerDescription() {
wstring testText = L"\nNothing yet...";
IggyStringUTF16 iggyStr;
wstring formattedText = app.EscapeHTMLString(testText);
formattedText = app.FormatChatMessage(formattedText);
formattedText = app.FormatColoredString(formattedText);
iggyStr.string = (IggyUTF16*)formattedText.c_str();
iggyStr.length = (unsigned int)formattedText.length();
@@ -4675,7 +4675,7 @@ void UIScene_LoadCreateJoinMenu::RebuildJoinGamesListVisual(bool syncFocus)
m_buttonListGames.getItemCount() - 1,
L"lceheadwer.png",
L"lceheadwer");
RefreshServerListHtmlPatch();
#endif
if (m_currentSessions == nullptr || m_currentSessions->empty())
@@ -4756,7 +4756,10 @@ void UIScene_LoadCreateJoinMenu::RebuildJoinGamesListVisual(bool syncFocus)
}
}
m_buttonListGames.addItem(sessionInfo->displayLabel, modeIconName, tpIconName);
wstring htmlLabel = app.EscapeHTMLString(sessionInfo->displayLabel);
htmlLabel = app.FormatColoredString(htmlLabel);
m_buttonListGames.addItem(htmlLabel, modeIconName, tpIconName);
if (memcmp(&selectedSessionId, &sessionInfo->sessionId, sizeof(SessionID)) == 0)
@@ -4778,6 +4781,8 @@ void UIScene_LoadCreateJoinMenu::RebuildJoinGamesListVisual(bool syncFocus)
}
RefreshServerListHtmlPatch();
if(syncFocus)
m_buttonListGames.updateChildFocus(m_buttonListGames.getCurrentSelection());
@@ -9208,6 +9213,21 @@ int UIScene_LoadCreateJoinMenu::AddServerKeyboardCallback(LPVOID lpParam, bool b
}
void UIScene_LoadCreateJoinMenu::RefreshServerListHtmlPatch() {
S32 arrayItems = 0;
IggyValueGetArrayLengthRS(m_buttonListGames.getIggyValuePath(), 0, "m_aItems", &arrayItems);
IggyValuePath listPath;
IggyValuePathMakeNameRef(&listPath, m_buttonListGames.getIggyValuePath(), "m_aItems");
for (int i = 0; i < arrayItems; i++) {
IggyValuePath listItem;
IggyValuePathMakeArrayRef(&listItem, &listPath, i);
IggyValueSetBooleanRS(&listItem, 0, "m_bUseHtmlText", true);
}
}
void UIScene_LoadCreateJoinMenu::AppendServerToFile(const wstring& ip, const wstring& port, const wstring& name)
@@ -270,6 +270,8 @@ private:
void BeginAddServer();
void AppendServerToFile(const wstring& ip, const wstring& port, const wstring& name);
static int AddServerKeyboardCallback(LPVOID lpParam, bool bRes);
void RefreshServerListHtmlPatch();
#endif
#if defined(__PS3__) || defined(__PSVITA__) || defined(__ORBIS__)
@@ -24,16 +24,16 @@ const WCHAR *UIScene_SkinSelectMenu::wchDefaultNamesA[]=
L"Prisoner Steve",
L"Cyclist Steve",
L"Boxer Steve",
L"Developer Steve",
L"Alex",
L"Tuxedo Alex",
L"Boxer Alex",
L"Prisoner Alex",
L"Tennis Alex",
L"Cyclist Alex",
L"Tuxedo Alex",
L"Athlete Alex",
L"Swedish Alex",
L"Prisoner Alex",
L"Cyclist Alex",
L"Boxer Alex",
L"Developer Alex",
L"Developer Steve",
};
UIScene_SkinSelectMenu::UIScene_SkinSelectMenu(int iPad, void *initData, UILayer *parentLayer) : UIScene(iPad, parentLayer)
@@ -59,6 +59,7 @@ UIScene_SkinSelectMenu::UIScene_SkinSelectMenu(int iPad, void *initData, UILayer
m_selectedSkinPath = L"";
m_selectedCapePath = L"";
m_vAdditionalSkinBoxes = nullptr;
m_vSkinOffsets = nullptr;
m_bSlidingSkins = false;
m_bAnimatingMove = false;
@@ -662,6 +663,7 @@ void UIScene_SkinSelectMenu::handleSkinIndexChanged()
m_selectedSkinPath = skinFile->getPath();
m_selectedCapePath = skinFile->getParameterAsString(DLCManager::e_DLCParamType_Cape);
m_vAdditionalSkinBoxes = skinFile->getAdditionalBoxes();
m_vSkinOffsets = skinFile->getOffsets();
skinName = skinFile->getParameterAsString( DLCManager::e_DLCParamType_DisplayName );
skinOrigin = skinFile->getParameterAsString( DLCManager::e_DLCParamType_ThemeName );
@@ -684,6 +686,7 @@ void UIScene_SkinSelectMenu::handleSkinIndexChanged()
m_selectedSkinPath = L"";
m_selectedCapePath = L"";
m_vAdditionalSkinBoxes = nullptr;
m_vSkinOffsets = nullptr;
switch(m_packIndex)
{
@@ -726,6 +729,7 @@ void UIScene_SkinSelectMenu::handleSkinIndexChanged()
m_selectedSkinPath = skinFile->getPath();
m_selectedCapePath = skinFile->getParameterAsString(DLCManager::e_DLCParamType_Cape);
m_vAdditionalSkinBoxes = skinFile->getAdditionalBoxes();
m_vSkinOffsets = skinFile->getOffsets();
skinName = skinFile->getParameterAsString( DLCManager::e_DLCParamType_DisplayName );
skinOrigin = skinFile->getParameterAsString( DLCManager::e_DLCParamType_ThemeName );
@@ -773,6 +777,17 @@ void UIScene_SkinSelectMenu::handleSkinIndexChanged()
pAdditionalModelParts = app.SetAdditionalSkinBoxes(skinFile->getSkinID(),m_vAdditionalSkinBoxes);
}
}
if(m_vSkinOffsets && m_vSkinOffsets->size()!=0)
{
// add the skin Offsets to the humanoid model, but only if we've not done this already
vector<SKIN_OFFSET *> *pSkinOffsets = app.GetSkinOffsets(skinFile->getSkinID());
if(pSkinOffsets==nullptr)
{
pSkinOffsets = app.SetSkinOffsets(skinFile->getSkinID(),m_vSkinOffsets);
}
}
if(skinFile!=nullptr)
{
@@ -790,6 +805,7 @@ void UIScene_SkinSelectMenu::handleSkinIndexChanged()
wstring otherSkinPath = L"";
wstring otherCapePath = L"";
vector<SKIN_BOX *> *othervAdditionalSkinBoxes=nullptr;
vector<SKIN_OFFSET *> *othervSkinOffsets=nullptr;
wchar_t chars[256];
// turn off all displays
@@ -844,6 +860,7 @@ void UIScene_SkinSelectMenu::handleSkinIndexChanged()
otherSkinPath = skinFile->getPath();
otherCapePath = skinFile->getParameterAsString(DLCManager::e_DLCParamType_Cape);
othervAdditionalSkinBoxes = skinFile->getAdditionalBoxes();
othervSkinOffsets = skinFile->getOffsets();
backupTexture = TN_MOB_CHAR;
}
else
@@ -851,6 +868,7 @@ void UIScene_SkinSelectMenu::handleSkinIndexChanged()
otherSkinPath = L"";
otherCapePath = L"";
othervAdditionalSkinBoxes=nullptr;
othervSkinOffsets=nullptr;
switch(m_packIndex)
{
case SKIN_SELECT_PACK_DEFAULT:
@@ -870,6 +888,7 @@ void UIScene_SkinSelectMenu::handleSkinIndexChanged()
otherSkinPath = skinFile->getPath();
otherCapePath = skinFile->getParameterAsString(DLCManager::e_DLCParamType_Cape);
othervAdditionalSkinBoxes = skinFile->getAdditionalBoxes();
othervSkinOffsets = skinFile->getOffsets();
backupTexture = TN_MOB_CHAR;
}
}
@@ -887,6 +906,14 @@ void UIScene_SkinSelectMenu::handleSkinIndexChanged()
pAdditionalModelParts = app.SetAdditionalSkinBoxes(skinFile->getSkinID(),othervAdditionalSkinBoxes);
}
}
if(othervSkinOffsets && othervSkinOffsets->size()!=0)
{
vector<SKIN_OFFSET *> *pSkinOffsets = app.GetSkinOffsets(skinFile->getSkinID());
if(pSkinOffsets==nullptr)
{
pSkinOffsets = app.SetSkinOffsets(skinFile->getSkinID(),othervSkinOffsets);
}
}
// 4J-PB - anim override needs set before SetTexture
if(skinFile!=nullptr)
{
@@ -915,6 +942,7 @@ void UIScene_SkinSelectMenu::handleSkinIndexChanged()
otherSkinPath = skinFile->getPath();
otherCapePath = skinFile->getParameterAsString(DLCManager::e_DLCParamType_Cape);
othervAdditionalSkinBoxes = skinFile->getAdditionalBoxes();
othervSkinOffsets = skinFile->getOffsets();
backupTexture = TN_MOB_CHAR;
}
else
@@ -922,6 +950,7 @@ void UIScene_SkinSelectMenu::handleSkinIndexChanged()
otherSkinPath = L"";
otherCapePath = L"";
othervAdditionalSkinBoxes=nullptr;
othervSkinOffsets=nullptr;
switch(m_packIndex)
{
case SKIN_SELECT_PACK_DEFAULT:
@@ -941,6 +970,7 @@ void UIScene_SkinSelectMenu::handleSkinIndexChanged()
otherSkinPath = skinFile->getPath();
otherCapePath = skinFile->getParameterAsString(DLCManager::e_DLCParamType_Cape);
othervAdditionalSkinBoxes = skinFile->getAdditionalBoxes();
othervSkinOffsets = skinFile->getOffsets();
backupTexture = TN_MOB_CHAR;
}
}
@@ -958,6 +988,14 @@ void UIScene_SkinSelectMenu::handleSkinIndexChanged()
pAdditionalModelParts = app.SetAdditionalSkinBoxes(skinFile->getSkinID(),othervAdditionalSkinBoxes);
}
}
if(othervSkinOffsets && othervSkinOffsets->size()!=0)
{
vector<SKIN_OFFSET *> *pSkinOffsets = app.GetSkinOffsets(skinFile->getSkinID());
if(pSkinOffsets==nullptr)
{
pSkinOffsets = app.SetSkinOffsets(skinFile->getSkinID(),othervSkinOffsets);
}
}
// 4J-PB - anim override needs set before SetTexture
if(skinFile)
{
@@ -1004,34 +1042,34 @@ TEXTURE_NAME UIScene_SkinSelectMenu::getTextureId(int skinIndex)
texture = TN_MOB_CHAR7;
break;
case eDefaultSkins_Skin8:
texture = TN_MOB_CHAR8;
texture = TN_MOB_ALEX;
break;
case eDefaultSkins_Skin9:
texture = TN_MOB_CHAR9;
texture = TN_MOB_ALEX1;
break;
case eDefaultSkins_Skin10:
texture = TN_MOB_CHAR10;
texture = TN_MOB_ALEX2;
break;
case eDefaultSkins_Skin11:
texture = TN_MOB_CHAR11;
texture = TN_MOB_ALEX3;
break;
case eDefaultSkins_Skin12:
texture = TN_MOB_CHAR12;
texture = TN_MOB_ALEX4;
break;
case eDefaultSkins_Skin13:
texture = TN_MOB_CHAR13;
texture = TN_MOB_ALEX5;
break;
case eDefaultSkins_Skin14:
texture = TN_MOB_CHAR14;
texture = TN_MOB_ALEX6;
break;
case eDefaultSkins_Skin15:
texture = TN_MOB_CHAR15;
texture = TN_MOB_ALEX7;
break;
case eDefaultSkins_Skin16:
texture = TN_MOB_CHAR16;
texture = TN_MOB_DEVALEX;
break;
case eDefaultSkins_Skin17:
texture = TN_MOB_CHAR17;
texture = TN_MOB_DEVSTEVE;
break;
};
@@ -104,6 +104,7 @@ private:
DWORD m_originalSkinId;
wstring m_currentSkinPath, m_selectedSkinPath, m_selectedCapePath;
vector<SKIN_BOX *> *m_vAdditionalSkinBoxes;
vector<SKIN_OFFSET *> *m_vSkinOffsets;
bool m_bSlidingSkins, m_bAnimatingMove;
ESkinSelectNavigation m_currentNavigation;

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

+8 -2
View File
@@ -19,9 +19,8 @@ ResourceLocation EntityRenderer::SHADOW_LOCATION = ResourceLocation(TN__CLAMP__M
EntityRenderer::EntityRenderer()
{
model = nullptr;
modelWide = nullptr;
modelSlim = nullptr;
newModel = nullptr;
newModelSlim = nullptr;
tileRenderer = new TileRenderer();
shadowRadius = 0;
shadowStrength = 1.0f;
@@ -409,6 +408,13 @@ void EntityRenderer::registerTerrainTextures(IconRegister *iconRegister)
{
}
Model *EntityRenderer::getModel(int modelType)
{
if (modelType == 2) return modelSlim;
else if (modelType == 1) return modelWide;
else return model;
}
ResourceLocation *EntityRenderer::getTextureLocation(shared_ptr<Entity> mob)
{
+2 -6
View File
@@ -31,9 +31,8 @@ private:
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 *modelWide;
Model *modelSlim;
Model *newModel;
Model *newModelSlim;
protected:
TileRenderer *tileRenderer; // 4J - changed to protected so derived classes can use instead of shadowing their own
@@ -71,10 +70,7 @@ public:
public:
// 4J Added
virtual Model *getModel() { return model; }
virtual Model *getModelSlim() { return modelSlim; }
virtual Model *getNewModel() { return newModel; }
virtual Model *getNewModelSlim() { return newModelSlim; }
virtual Model *getModel(int modelType = 0);
virtual void SetItemFrame(bool bSet) {}
virtual bool shouldRender(shared_ptr<Entity> entity, float camX, float camY, float camZ) { return true; }
+1 -2
View File
@@ -214,8 +214,7 @@ void GameRenderer::tick(bool first) // 4J - add bFirst
{
shared_ptr<Player> yBobPlayer = dynamic_pointer_cast<Player>(mc->cameraTargetPlayer);
float target = 0.0f;
if (yBobPlayer != nullptr && !yBobPlayer->onGround
&& !(yBobPlayer->abilities.mayfly && yBobPlayer->abilities.flying))
if (yBobPlayer != nullptr && yBobPlayer->isElytraFlying())
{
target = (float)(atan(-yBobPlayer->yd * 0.2) * 15.0);
File diff suppressed because it is too large Load Diff
+24 -16
View File
@@ -1,9 +1,11 @@
#pragma once
#include "Model.h"
#include "SkinOffset.h"
class HumanoidModel : public Model
{
public:
ModelPart* head, * hair, * body, * jacket, * arm0, * sleeve0, * arm1, * sleeve1, * leg0, * pants0, * leg1, * pants1, * ear, * cloak;
ModelPart* waist, * belt, * bodyArmor, * armArmor0, * armArmor1, * legging0, * legging1, * sock0, * sock1, * boot0, * boot1;
ModelPart* elytraLeft, * elytraRight;
int holdingLeftHand;
int holdingRightHand;
@@ -15,6 +17,8 @@ public:
float eating_swing;
bool elytraFlying;
bool elytraCrouching;
bool m_isArmor;
bool m_is64x64;
unsigned int m_uiAnimOverrideBitmask;
float m_fYOffset;
enum animbits
@@ -37,11 +41,20 @@ public:
eAnim_DisableRenderLeg1,
eAnim_DisableRenderHair,
eAnim_SmallModel,
eAnim_DisableRenderJacket,
eAnim_DisableRenderSleeve0,
eAnim_DisableRenderSleeve1,
eAnim_DisableRenderPants0,
eAnim_DisableRenderPants1
eAnim_WideModel,
eAnim_SlimModel,
eAnim_DisableRenderSleeve1,
eAnim_DisableRenderSleeve0,
eAnim_DisableRenderPants1,
eAnim_DisableRenderPants0,
eAnim_DisableRenderJacket,
eAnim_RenderArmorHead,
eAnim_RenderArmorArm0,
eAnim_RenderArmorArm1,
eAnim_RenderArmorTorso,
eAnim_RenderArmorLeg0,
eAnim_RenderArmorLeg1,
eAnim_Dinnerbone
};
@@ -59,22 +72,17 @@ public:
(1 << HumanoidModel::eAnim_DisableRenderPants0) |
(1 << HumanoidModel::eAnim_DisableRenderPants1);
void _init(float g, float yOffset, int texWidth, int texHeight,
bool slimHands, bool mirror, bool force32);
void _init(float g, float yOffset, int texWidth, int texHeight, bool slim, bool isArmor);
HumanoidModel();
HumanoidModel(float g);
HumanoidModel(float g, bool isArmor);
HumanoidModel(float g, float yOffset, int texWidth, int texHeight);
HumanoidModel(float g, float yOffset, int texWidth, int texHeight, bool slimHands);
HumanoidModel(float g, float yOffset, int texWidth, int texHeight, bool slimHands, bool mirror);
HumanoidModel(float g, float yOffset, int texWidth, int texHeight, bool slimHands, bool mirror, bool force32);
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);
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 renderUI(float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled, vector<SKIN_OFFSET *> *skinOffsets);
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);
void renderEars(float scale, bool usecompiled);
void renderCloak(float scale, bool usecompiled);
+4 -4
View File
@@ -404,8 +404,8 @@ void ItemInHandRenderer::renderItem3D(Tesselator *t, float u0, float v0, float u
void ItemInHandRenderer::render(float a)
{
float h = oHeight + (height - oHeight) * a;
shared_ptr<Player> player = minecraft->player;
float h = oHeight + (height - oHeight) * a;
shared_ptr<Player> player = minecraft->player;
if (player == nullptr)
{
@@ -907,8 +907,8 @@ void ItemInHandRenderer::renderFire(float a)
unsigned int col = Minecraft::GetInstance()->getColourTable()->getColor( eMinecraftColour_Fire_Overlay );
float aCol = ( (col>>24)&0xFF )/255.0f;
float rCol = ( (col>>16)&0xFF )/255.0f;
float gCol = ( (col>>8)&0xFF )/255.0;
float bCol = ( col&0xFF )/255.0;
float gCol = ( (col>>8)&0xFF )/255.0f;
float bCol = ( col&0xFF )/255.0f;
glColor4f(rCol, gCol, bCol, aCol);
glEnable(GL_BLEND);
+11 -92
View File
@@ -8,29 +8,23 @@
#include "../Minecraft.World/Arrow.h"
#include "../Minecraft.World/Mth.h"
#include "../Minecraft.World/Player.h"
#include "Skins.h"
ResourceLocation LivingEntityRenderer::ENCHANT_GLINT_LOCATION = ResourceLocation(TN__BLUR__MISC_GLINT);
int LivingEntityRenderer::MAX_ARMOR_LAYERS = 4;
LivingEntityRenderer::LivingEntityRenderer(Model *model, float shadow, bool slimHands, bool createNewVar)
LivingEntityRenderer::LivingEntityRenderer(Model *model, float shadow, bool isPlayer)
{
this->model = model;
if (slimHands == true)
this->modelSlim = new HumanoidModel(0, 0, 64, 32, true);
if (createNewVar)
if (isPlayer)
{
this->newModel = new HumanoidModel(0, 0, 64, 64, false, false);
if (slimHands == true)
this->newModelSlim = new HumanoidModel(0, 0, 64, 64, true, false);
this->modelWide = new HumanoidModel(0, 0, 64, 64);
this->modelSlim = new HumanoidModel(0, 0, 64, 64, true);
}
shadowRadius = shadow;
armor = nullptr;
resModel = model;
}
void LivingEntityRenderer::setArmor(Model *armor)
@@ -38,6 +32,11 @@ void LivingEntityRenderer::setArmor(Model *armor)
this->armor = armor;
}
void LivingEntityRenderer::setPlayerModelType(Model *humanoidModel)
{
resModel = humanoidModel;
}
float LivingEntityRenderer::rotlerp(float from, float to, float a)
{
float diff = to - from;
@@ -56,8 +55,6 @@ 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 = static_cast<HumanoidModel *>(model);
if (mob == nullptr)
{
@@ -67,30 +64,6 @@ void LivingEntityRenderer::render(shared_ptr<Entity> _mob, double x, double y, d
glPushMatrix();
glDisable(GL_CULL_FACE);
if (player != nullptr)
{
Textures *textures = Minecraft::GetInstance()->textures;
int skinId = player->getPlayerDefaultSkin() - 1;
int defaultSkin = player->getPlayerDefaultSkin() + 35;
if (slim[skinId] == true)
{
if (textures->getHeight(player->customTextureUrl, defaultSkin) == 64)
resModel = static_cast<HumanoidModel *>(newModelSlim);
else
resModel = static_cast<HumanoidModel *>(modelSlim);
}
else
{
if (textures->getHeight(player->customTextureUrl, defaultSkin) == 64)
resModel = static_cast<HumanoidModel *>(newModel);
else
resModel = static_cast<HumanoidModel *>(model);
}
}
else
resModel = static_cast<HumanoidModel *>(model);
resModel->attackTime = getAttackAnim(mob, a);
if (armor != nullptr) armor->attackTime = resModel->attackTime;
resModel->riding = mob->isRiding();
@@ -283,33 +256,6 @@ 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 = static_cast<HumanoidModel *>(model);
if (player != nullptr)
{
Textures *textures = Minecraft::GetInstance()->textures;
int skinId = player->getPlayerDefaultSkin() - 1;
int defaultSkin = player->getPlayerDefaultSkin() + 35;
if (slim[skinId] == true)
{
if (textures->getHeight(player->customTextureUrl, defaultSkin) == 64)
resModel = static_cast<HumanoidModel *>(newModelSlim);
else
resModel = static_cast<HumanoidModel *>(modelSlim);
}
else
{
if (textures->getHeight(player->customTextureUrl, defaultSkin) == 64)
resModel = static_cast<HumanoidModel *>(newModel);
else
resModel = static_cast<HumanoidModel *>(model);
}
}
else
resModel = static_cast<HumanoidModel *>(model);
bindTexture(mob);
if (!mob->isInvisible())
{
@@ -353,7 +299,7 @@ void LivingEntityRenderer::setupRotations(shared_ptr<LivingEntity> mob, float bo
else
{
wstring name = mob->getAName();
if (name == L"Dinnerbone" || name == L"Grumm")
if (name == L"Dinnerbone" || name == L"Grumm" || mob->getAnimOverrideBitmask() & (1 << HumanoidModel::eAnim_Dinnerbone))
{
if ( !mob->instanceof(eTYPE_PLAYER) || !dynamic_pointer_cast<Player>(mob)->isCapeHidden() )
{
@@ -381,33 +327,6 @@ 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);
Model *resModel = static_cast<HumanoidModel *>(model);
if (player != nullptr)
{
Textures *textures = Minecraft::GetInstance()->textures;
int skinId = player->getPlayerDefaultSkin() - 1;
int defaultSkin = player->getPlayerDefaultSkin() + 35;
if (slim[skinId] == true)
{
if (textures->getHeight(player->customTextureUrl, defaultSkin) == 64)
resModel = static_cast<HumanoidModel *>(newModelSlim);
else
resModel = static_cast<HumanoidModel *>(modelSlim);
}
else
{
if (textures->getHeight(player->customTextureUrl, defaultSkin) == 64)
resModel = static_cast<HumanoidModel *>(newModel);
else
resModel = static_cast<HumanoidModel *>(model);
}
}
else
resModel = static_cast<HumanoidModel *>(model);
int arrowCount = mob->getArrowCount();
if (arrowCount > 0)
+3 -1
View File
@@ -17,11 +17,13 @@ class LivingEntityRenderer : public EntityRenderer
protected:
//Model *model; // 4J Stu - This shadows the one in EntityRenderer
Model *armor;
Model *resModel;
public:
LivingEntityRenderer(Model *model, float shadow, bool slimHands = 0, bool createNewVar = 0);
LivingEntityRenderer(Model *model, float shadow, bool isPlayer = false);
virtual void render(shared_ptr<Entity> mob, double x, double y, double z, float rot, float a);
virtual void setArmor(Model *armor);
virtual void setPlayerModelType(Model *humanoidModel);
private:
float rotlerp(float from, float to, float a);
+2
View File
@@ -14,6 +14,8 @@ void ModelPart::_init()
bMirror = false;
visible = true;
neverRender = false;
hideWithArmor = 0L;
isArmorPart2 = false;
x=y=z = 0.0f;
xRot=yRot=zRot = 0.0f;
translateX = translateY = translateZ = 0.0f;
+2
View File
@@ -17,6 +17,8 @@ public:
bool bMirror;
bool visible;
bool neverRender;
unsigned int hideWithArmor;
bool isArmorPart2;
vector <Cube *> cubes;
vector <ModelPart *> children;
static const float RAD;
+11 -2
View File
@@ -1651,9 +1651,10 @@ void PlayerConnection::handleTextureAndGeometry(shared_ptr<TextureAndGeometryPac
{
// we don't have the dlc skin, so retrieve the data from the app store
vector<SKIN_BOX *> *pvSkinBoxes = app.GetAdditionalSkinBoxes(packet->dwSkinID);
vector<SKIN_OFFSET *> *pvSkinOffsets = app.GetSkinOffsets(packet->dwSkinID);
unsigned int uiAnimOverrideBitmask= app.GetAnimOverrideBitmask(packet->dwSkinID);
send(std::make_shared<TextureAndGeometryPacket>(packet->textureName, pbData, dwTextureBytes, pvSkinBoxes, uiAnimOverrideBitmask));
send(std::make_shared<TextureAndGeometryPacket>(packet->textureName, pbData, dwTextureBytes, pvSkinBoxes, pvSkinOffsets, uiAnimOverrideBitmask));
}
}
else
@@ -1676,6 +1677,13 @@ void PlayerConnection::handleTextureAndGeometry(shared_ptr<TextureAndGeometryPac
wprintf(L"Adding skin boxes for skin id %X, box count %d\n",packet->dwSkinID,packet->dwBoxC);
#endif
app.SetAdditionalSkinBoxes(packet->dwSkinID,packet->BoxDataA,packet->dwBoxC);
}// add the offsets to the app list
if(packet->dwOffsetC!=0)
{
#ifndef _CONTENT_PACKAGE
wprintf(L"Adding skin offsets for skin id %X, offset count %d\n",packet->dwSkinID,packet->dwOffsetC);
#endif
app.SetSkinOffsets(packet->dwSkinID,packet->OffsetDataA,packet->dwOffsetC);
}
// Add the anim override
app.SetAnimOverrideBitmask(packet->dwSkinID,packet->uiAnimOverrideBitmask);
@@ -1726,9 +1734,10 @@ void PlayerConnection::handleTextureAndGeometryReceived(const wstring &textureNa
// get the data from the app
DWORD dwSkinID = app.getSkinIdFromPath(textureName);
vector<SKIN_BOX *> *pvSkinBoxes = app.GetAdditionalSkinBoxes(dwSkinID);
vector<SKIN_OFFSET *> *pvSkinOffsets = app.GetSkinOffsets(dwSkinID);
unsigned int uiAnimOverrideBitmask= app.GetAnimOverrideBitmask(dwSkinID);
send(std::make_shared<TextureAndGeometryPacket>(textureName, pbData, dwTextureBytes, pvSkinBoxes, uiAnimOverrideBitmask));
send(std::make_shared<TextureAndGeometryPacket>(textureName, pbData, dwTextureBytes, pvSkinBoxes, pvSkinOffsets, uiAnimOverrideBitmask));
}
m_texturesRequested.erase(it);
}
+67 -100
View File
@@ -16,7 +16,6 @@
#include "../Minecraft.World/StringHelpers.h"
#include "SkeletonHeadModel.h"
#include "Textures.h"
#include "Skins.h"
ResourceLocation PlayerRenderer::SKELETON_LOCATION = ResourceLocation(TN_MOB_SKELETON);
ResourceLocation PlayerRenderer::WITHER_SKELETON_LOCATION = ResourceLocation(TN_MOB_WITHER_SKELETON);
@@ -64,16 +63,26 @@ static unsigned int nametagColorForIndex(int index)
ResourceLocation PlayerRenderer::DEFAULT_LOCATION = ResourceLocation(TN_MOB_CHAR);
PlayerRenderer::PlayerRenderer() : LivingEntityRenderer(new HumanoidModel(0), 0.5f, true, true)
PlayerRenderer::PlayerRenderer() : LivingEntityRenderer(new HumanoidModel(0), 0.5f, true)
{
humanoidModel = static_cast<HumanoidModel*>(model);
humanoidModelWide = static_cast<HumanoidModel*>(modelWide);
humanoidModelSlim = static_cast<HumanoidModel*>(modelSlim);
newHumanoidModel = static_cast<HumanoidModel*>(newModel);
newHumanoidModelSlim = static_cast<HumanoidModel*>(newModelSlim);
resModel = humanoidModel;
armorParts1 = new HumanoidModel(1.0f);
armorParts2 = new HumanoidModel(0.5f);
armorParts3 = new HumanoidModel(0.5f);
armorParts1 = new HumanoidModel(1.0f, true);
armorParts2 = new HumanoidModel(0.5f, true);
armorParts3 = new HumanoidModel(0.5f, true);
}
void PlayerRenderer::setModelType(shared_ptr<Player> player)
{
if (Player::GetModelTypeFromTextureId(player->getCustomSkin()) == 2 || Player::GetModelTypeFromAnimBitmask(player->getAnimOverrideBitmask()) == 2)
resModel = humanoidModelSlim;
else if (Player::GetModelTypeFromTextureId(player->getCustomSkin()) == 1 || Player::GetModelTypeFromAnimBitmask(player->getAnimOverrideBitmask()) == 1)
resModel = humanoidModelWide;
else
resModel = humanoidModel;
}
unsigned int PlayerRenderer::getNametagColour(int index)
@@ -115,10 +124,14 @@ int PlayerRenderer::prepareArmor(shared_ptr<LivingEntity> _player, int layer, fl
armor->leg0->visible = layer == 2 || layer == 3;
armor->leg1->visible = layer == 2 || layer == 3;
armor->body->isArmorPart2 = layer == 2;
armor->leg0->isArmorPart2 = layer == 2;
armor->leg1->isArmorPart2 = layer == 2;
setArmor(armor);
if (armor != nullptr) armor->attackTime = model->attackTime;
if (armor != nullptr) armor->riding = model->riding;
if (armor != nullptr) armor->young = model->young;
if (armor != nullptr) armor->attackTime = resModel->attackTime;
if (armor != nullptr) armor->riding = resModel->riding;
if (armor != nullptr) armor->young = resModel->young;
float brightness = SharedConstants::TEXTURE_LIGHTING ? 1 : player->getBrightness(a);
if (armorItem->getMaterial() == ArmorItem::ArmorMaterial::CLOTH)
@@ -221,38 +234,12 @@ void PlayerRenderer::render(shared_ptr<Entity> _mob, double x, double y, double
// 4J - dynamic cast required because we aren't using templates/generics in our version
shared_ptr<Player> mob = dynamic_pointer_cast<Player>(_mob);
HumanoidModel* resModel = static_cast<HumanoidModel*>(model);
if (mob == nullptr) return;
if (mob->hasInvisiblePrivilege()) return;
if (mob != nullptr)
{
Textures* textures = Minecraft::GetInstance()->textures;
int skinId = mob->getPlayerDefaultSkin() - 1;
int defaultSkin = mob->getPlayerDefaultSkin() + 35;
if (slim[skinId] == true)
{
if (textures->getHeight(mob->customTextureUrl, defaultSkin) == 64)
resModel = static_cast<HumanoidModel*>(newHumanoidModelSlim);
else
resModel = static_cast<HumanoidModel*>(humanoidModelSlim);
}
else
{
if (textures->getHeight(mob->customTextureUrl, defaultSkin) == 64)
resModel = static_cast<HumanoidModel*>(newHumanoidModel);
else
resModel = static_cast<HumanoidModel*>(humanoidModel);
}
}
else
resModel = static_cast<HumanoidModel*>(model);
/*if (mob != nullptr && newHumanoidModelSlim != nullptr && (mob->getCustomSkin() >= 10 && mob->getCustomSkin() <= 18)) resModel = newHumanoidModelSlim;
else if (mob != nullptr && newHumanoidModel != nullptr && (mob->getCustomSkin() >= 2 && mob->getCustomSkin() <= 9)) resModel = newHumanoidModel;
else resModel = humanoidModel;*/
setModelType(mob);
setPlayerModelType(resModel);
shared_ptr<ItemInstance> item = mob->inventory->getSelected();
@@ -341,6 +328,12 @@ void PlayerRenderer::render(shared_ptr<Entity> _mob, double x, double y, double
armorParts2->idle = false;
}
// Get armor in armor slot so we can hide the armor layer of the skin - Langtanium
shared_ptr<ItemInstance> itemHelmet = mob->inventory->getArmor(3);
shared_ptr<ItemInstance> itemChestplate = mob->inventory->getArmor(2);
shared_ptr<ItemInstance> itemLeggings = mob->inventory->getArmor(1);
shared_ptr<ItemInstance> itemBoots = mob->inventory->getArmor(0);
// 4J-PB - any additional parts to turn on for this player (skin dependent)
vector<ModelPart*>* pAdditionalModelParts = mob->GetAdditionalModelParts();
//turn them on
@@ -348,7 +341,16 @@ void PlayerRenderer::render(shared_ptr<Entity> _mob, double x, double y, double
{
for (ModelPart* pModelPart : *pAdditionalModelParts)
{
pModelPart->visible = true;
if (itemHelmet != nullptr && pModelPart->hideWithArmor & (1 << 0)) // Hide the skin boxes that have the "hide when helmet is worn" bit flag - Langtanium
pModelPart->visible = false;
else if (itemChestplate != nullptr && pModelPart->hideWithArmor & (1 << 1)) // Hide the skin boxes that have the "hide when chestplate is worn" bit flag - Langtanium
pModelPart->visible = false;
else if (itemLeggings != nullptr && pModelPart->hideWithArmor & (1 << 2)) // Hide the skin boxes that have the "hide when leggings are worn" bit flag - Langtanium
pModelPart->visible = false;
else if (itemBoots != nullptr && pModelPart->hideWithArmor & (1 << 3)) // Hide the skin boxes that have the "hide when boots are worn" bit flag - Langtanium
pModelPart->visible = false;
else
pModelPart->visible = true;
}
}
@@ -379,35 +381,6 @@ void PlayerRenderer::additionalRendering(shared_ptr<LivingEntity> _mob, float a)
// 4J - dynamic cast required because we aren't using templates/generics in our version
shared_ptr<Player> mob = dynamic_pointer_cast<Player>(_mob);
HumanoidModel* resModel = static_cast<HumanoidModel*>(model);
if (mob != nullptr)
{
Textures* textures = Minecraft::GetInstance()->textures;
int skinId = mob->getPlayerDefaultSkin() - 1;
int defaultSkin = mob->getPlayerDefaultSkin() + 35;
if (slim[skinId] == true)
{
if (textures->getHeight(mob->customTextureUrl, defaultSkin) == 64)
resModel = static_cast<HumanoidModel*>(newHumanoidModelSlim);
else
resModel = static_cast<HumanoidModel*>(humanoidModelSlim);
}
else
{
if (textures->getHeight(mob->customTextureUrl, defaultSkin) == 64)
resModel = static_cast<HumanoidModel*>(newHumanoidModel);
else
resModel = static_cast<HumanoidModel*>(humanoidModel);
}
}
else
resModel = static_cast<HumanoidModel*>(model);
/*if (mob != nullptr && newHumanoidModelSlim != nullptr && (mob->getCustomSkin() >= 10 && mob->getCustomSkin() <= 18)) resModel = newHumanoidModelSlim;
else if (mob != nullptr && newHumanoidModel != nullptr && (mob->getCustomSkin() >= 2 && mob->getCustomSkin() <= 9)) resModel = newHumanoidModel;
else resModel = humanoidModel;*/
shared_ptr<ItemInstance> headGear = mob->inventory->getArmor(3);
if (headGear != nullptr)
@@ -510,7 +483,7 @@ void PlayerRenderer::additionalRendering(shared_ptr<LivingEntity> _mob, float a)
glRotatef(lean2 / 2, 0, 0, 1);
glRotatef(-lean2 / 2, 0, 1, 0);
glRotatef(180, 0, 1, 0);
resModel->renderCloak(1 / 16.0f, true);
humanoidModel->renderCloak(1 / 16.0f, true);
glPopMatrix();
}
@@ -741,35 +714,7 @@ void PlayerRenderer::scale(shared_ptr<LivingEntity> player, float a)
void PlayerRenderer::renderHand()
{
shared_ptr<Player> player = dynamic_pointer_cast<Player>(Minecraft::GetInstance()->player);
HumanoidModel* resModel = static_cast<HumanoidModel*>(model);
if (player != nullptr)
{
Textures* textures = Minecraft::GetInstance()->textures;
int skinId = player->getPlayerDefaultSkin() - 1;
int defaultSkin = player->getPlayerDefaultSkin() + 35;
if (slim[skinId] == true)
{
if (textures->getHeight(player->customTextureUrl, defaultSkin) == 64)
resModel = static_cast<HumanoidModel*>(newHumanoidModelSlim);
else
resModel = static_cast<HumanoidModel*>(humanoidModelSlim);
}
else
{
if (textures->getHeight(player->customTextureUrl, defaultSkin) == 64)
resModel = static_cast<HumanoidModel*>(newHumanoidModel);
else
resModel = static_cast<HumanoidModel*>(humanoidModel);
}
}
else
resModel = static_cast<HumanoidModel*>(model);
/*if (player != nullptr && newHumanoidModelSlim != nullptr && (player->getCustomSkin() >= 10 && player->getCustomSkin() <= 18)) resModel = newHumanoidModelSlim;
else if (player != nullptr && newHumanoidModel != nullptr && (player->getCustomSkin() >= 2 && player->getCustomSkin() <= 9)) resModel = newHumanoidModel;
else resModel = humanoidModel;*/
setModelType(player);
float brightness = 1;
glColor3f(brightness, brightness, brightness);
@@ -781,9 +726,12 @@ void PlayerRenderer::renderHand()
// 4J-PB - does this skin have its arm0 disabled? (Dalek, etc)
if ((resModel->m_uiAnimOverrideBitmask & (1 << HumanoidModel::eAnim_DisableRenderArm0)) == 0)
resModel->arm0->render(1 / 16.0f, true);
// Does this skin have its sleeve0 disabled?
if ((resModel->m_uiAnimOverrideBitmask & (1 << HumanoidModel::eAnim_DisableRenderSleeve0)) == 0 && resModel->sleeve0 != nullptr)
resModel->sleeve0->render(1 / 16.0f, true);
//Render custom skin boxes on viewmodel - Botch
vector<ModelPart*>* additionalModelParts = Minecraft::GetInstance()->player->GetAdditionalModelParts();
vector<ModelPart*>* additionalModelParts = player->GetAdditionalModelParts();
if (!additionalModelParts) return; //If there are no custom boxes, return. This fixes bug where the game will crash if you select a skin with no additional boxes.
vector<ModelPart*> armchildren = resModel->arm0->children;
std::unordered_set<ModelPart*> additionalModelPartSet(additionalModelParts->begin(), additionalModelParts->end());
@@ -801,6 +749,25 @@ void PlayerRenderer::renderHand()
}
}
}
//Render custom skin boxes on viewmodel for sleeve0
if (resModel->sleeve0!=nullptr)
{
vector<ModelPart*> sleevechildren = resModel->sleeve0->children;
for (const auto& x : sleevechildren) {
if (x) {
if (additionalModelPartSet.find(x) != additionalModelPartSet.end()) { //This is to verify box is still actually on current skin
glPushMatrix();
//We need to transform to match offset of arm/sleeve
glTranslatef(-5 * 0.0625f, 2 * 0.0625f, 0);
glRotatef(0.1 * (180.0f / PI), 0, 0, 1);
x->visible = true;
x->render(1.0f / 16.0f, true);
x->visible = false;
glPopMatrix();
}
}
}
}
}
void PlayerRenderer::setupPosition(shared_ptr<LivingEntity> _mob, double x, double y, double z)
@@ -857,7 +824,7 @@ void PlayerRenderer::setupRotations(shared_ptr<LivingEntity> _mob, float bob, fl
}
}
else
else
{
LivingEntityRenderer::setupRotations(mob, bob, bodyRot, a);
}
+3 -2
View File
@@ -14,9 +14,9 @@ public:
private:
HumanoidModel *humanoidModel;
HumanoidModel *humanoidModelWide;
HumanoidModel *humanoidModelSlim;
HumanoidModel *newHumanoidModel;
HumanoidModel *newHumanoidModelSlim;
HumanoidModel *resModel;
HumanoidModel *armorParts1;
HumanoidModel *armorParts2;
@@ -38,6 +38,7 @@ private:
static const wstring MATERIAL_NAMES[5];
protected:
virtual void setModelType(shared_ptr<Player> player);
virtual int prepareArmor(shared_ptr<LivingEntity> _player, int layer, float a);
virtual void prepareSecondPassArmor(shared_ptr<LivingEntity> mob, int layer, float a);
+13 -1
View File
@@ -9,16 +9,28 @@ enum eBodyPart
eBodyPart_Arm1,
eBodyPart_Leg0,
eBodyPart_Leg1,
eBodyPart_Headwear,
eBodyPart_Jacket,
eBodyPart_Sleeve0,
eBodyPart_Sleeve1,
eBodyPart_Pants0,
eBodyPart_Pants1,
eBodyPart_Waist,
eBodyPart_Legging0,
eBodyPart_Legging1,
eBodyPart_Sock0,
eBodyPart_Sock1,
eBodyPart_Boot0,
eBodyPart_Boot1,
eBodyPart_ArmArmor0,
eBodyPart_ArmArmor1,
eBodyPart_BodyArmor,
eBodyPart_Belt
};
typedef struct
{
eBodyPart ePart;
float fX,fY,fZ,fW,fH,fD,fU,fV;
float fX,fY,fZ,fW,fH,fD,fU,fV,fA,fM,fS;
}
SKIN_BOX;
+48
View File
@@ -0,0 +1,48 @@
#pragma once
enum eBodyOffset
{
eBodyOffset_Unknown=0,
eBodyOffset_Head,
eBodyOffset_Body,
eBodyOffset_Arm0,
eBodyOffset_Arm1,
eBodyOffset_Leg0,
eBodyOffset_Leg1,
eBodyOffset_Headwear,
eBodyOffset_Jacket,
eBodyOffset_Sleeve0,
eBodyOffset_Sleeve1,
eBodyOffset_Pants0,
eBodyOffset_Pants1,
eBodyOffset_Helmet,
eBodyOffset_Waist,
eBodyOffset_Legging0,
eBodyOffset_Legging1,
eBodyOffset_Sock0,
eBodyOffset_Sock1,
eBodyOffset_Boot0,
eBodyOffset_Boot1,
eBodyOffset_ArmArmor1,
eBodyOffset_ArmArmor0,
eBodyOffset_BodyArmor,
eBodyOffset_Belt,
eBodyOffset_Tool0,
eBodyOffset_Tool1
};
enum eOffsetDirection
{
eOffsetDirection_Unknown=0,
eOffsetDirection_X,
eOffsetDirection_Y,
eOffsetDirection_Z
};
typedef struct
{
eBodyOffset ePart;
float fD, fO;
}
SKIN_OFFSET;
-29
View File
@@ -1,29 +0,0 @@
#pragma once
#include <map>
using namespace std;
class AABB;
class Recipy;
class Object;
static std::map<int, bool> slim = {
{ 0, false },
{ 1, false },
{ 2, false },
{ 3, false },
{ 4, false },
{ 5, false },
{ 6, false },
{ 7, false },
{ 8, false },
{ 9, true },
{ 10, true },
{ 11, true },
{ 12, true },
{ 13, true },
{ 14, true },
{ 15, true },
{ 16, true },
{ 17, true },
{ 18, true },
};
+60 -36
View File
@@ -72,16 +72,16 @@ const wchar_t *Textures::preLoaded[TN_COUNT] =
L"mob/char5",
L"mob/char6",
L"mob/char7",
L"mob/char8",
L"mob/char9",
L"mob/char10",
L"mob/char11",
L"mob/char12",
L"mob/char13",
L"mob/char14",
L"mob/char15",
L"mob/char16",
L"mob/char17",
L"mob/alex",
L"mob/alex1",
L"mob/alex2",
L"mob/alex3",
L"mob/alex4",
L"mob/alex5",
L"mob/alex6",
L"mob/alex7",
L"mob/DevAlex",
L"mob/DevSteve",
L"terrain/moon",
L"terrain/sun",
L"armor/power",
@@ -1129,24 +1129,32 @@ void Textures::removeHttpTexture(const wstring& url)
// 4J-PB - adding for texture in memory (from global title storage)
int Textures::loadMemTexture(const wstring& url, const wstring& backup)
{
wstring effectiveUrl = url;
if(effectiveUrl.empty())
{
wchar_t lookup[32];
swprintf(lookup, 32, L"__backup_%s", backup.c_str());
effectiveUrl = lookup;
}
MemTexture *texture = nullptr;
auto it = memTextures.find(url);
auto it = memTextures.find(effectiveUrl);
if (it != memTextures.end())
{
texture = (*it).second;
}
if(texture == nullptr && app.IsFileInMemoryTextures(url))
if(texture == nullptr && !effectiveUrl.empty() && app.IsFileInMemoryTextures(effectiveUrl))
{
// If we haven't loaded it yet, but we have the data for it then add it
texture = addMemTexture(url, new MobSkinMemTextureProcessor() );
texture = addMemTexture(effectiveUrl, new MobSkinMemTextureProcessor() );
}
if(texture != nullptr)
{
if (texture->loadedImage != nullptr && !texture->isLoaded)
{
// 4J - Disable mipmapping in general for skins & capes. Have seen problems with edge-on polys for some eg mumbo jumbo
if( ( url.substr(0,7) == L"dlcskin" ) ||
( url.substr(0,7) == L"dlccape" ) )
if( ( effectiveUrl.substr(0,7) == L"dlcskin" ) ||
( effectiveUrl.substr(0,7) == L"dlccape" ) )
{
MIPMAP = false;
}
@@ -1173,16 +1181,24 @@ int Textures::loadMemTexture(const wstring& url, const wstring& backup)
int Textures::loadMemTexture(const wstring& url, int backup)
{
wstring effectiveUrl = url;
if(effectiveUrl.empty())
{
wchar_t lookup[32];
swprintf(lookup, 32, L"__backup_%d", backup);
effectiveUrl = lookup;
}
MemTexture *texture = nullptr;
auto it = memTextures.find(url);
auto it = memTextures.find(effectiveUrl);
if (it != memTextures.end())
{
texture = (*it).second;
}
if(texture == nullptr && app.IsFileInMemoryTextures(url))
if(texture == nullptr && !effectiveUrl.empty() && app.IsFileInMemoryTextures(effectiveUrl))
{
// If we haven't loaded it yet, but we have the data for it then add it
texture = addMemTexture(url, new MobSkinMemTextureProcessor() );
texture = addMemTexture(effectiveUrl, new MobSkinMemTextureProcessor() );
}
if(texture != nullptr)
{
@@ -1190,8 +1206,8 @@ int Textures::loadMemTexture(const wstring& url, int backup)
if (texture->loadedImage != nullptr && !texture->isLoaded)
{
// 4J - Disable mipmapping in general for skins & capes. Have seen problems with edge-on polys for some eg mumbo jumbo
if( ( url.substr(0,7) == L"dlcskin" ) ||
( url.substr(0,7) == L"dlccape" ) )
if( ( effectiveUrl.substr(0,7) == L"dlcskin" ) ||
( effectiveUrl.substr(0,7) == L"dlccape" ) )
{
MIPMAP = false;
}
@@ -1216,24 +1232,32 @@ int Textures::loadMemTexture(const wstring& url, int backup)
int Textures::getHeight(const wstring& url, int backup)
{
wstring effectiveUrl = url;
if(effectiveUrl.empty())
{
wchar_t lookup[32];
swprintf(lookup, 32, L"__backup_%d", backup);
effectiveUrl = lookup;
}
MemTexture *texture = nullptr;
auto it = memTextures.find(url);
auto it = memTextures.find(effectiveUrl);
if (it != memTextures.end())
{
texture = (*it).second;
}
if(texture == nullptr && app.IsFileInMemoryTextures(url))
if(texture == nullptr && !effectiveUrl.empty() && app.IsFileInMemoryTextures(effectiveUrl))
{
// If we haven't loaded it yet, but we have the data for it then add it
texture = addMemTexture(url, new MobSkinMemTextureProcessor() );
texture = addMemTexture(effectiveUrl, new MobSkinMemTextureProcessor() );
}
if(texture != nullptr)
{
if (texture->loadedImage != nullptr && !texture->isLoaded)
{
// 4J - Disable mipmapping in general for skins & capes. Have seen problems with edge-on polys for some eg mumbo jumbo
if( ( url.substr(0,7) == L"dlcskin" ) ||
( url.substr(0,7) == L"dlccape" ) )
if( ( effectiveUrl.substr(0,7) == L"dlcskin" ) ||
( effectiveUrl.substr(0,7) == L"dlccape" ) )
{
MIPMAP = false;
}
@@ -1263,7 +1287,7 @@ int Textures::getHeight(const wstring& url, int backup)
int h = img->getHeight();
//delete img; // commenting this out and inserting the loaded texture to memTextures unordered_map
this->memTextures[url] = _texture;
this->memTextures[effectiveUrl] = _texture;
return h;
}
@@ -1703,16 +1727,16 @@ TEXTURE_NAME OriginalImages[] =
TN_MOB_CHAR5,
TN_MOB_CHAR6,
TN_MOB_CHAR7,
TN_MOB_CHAR8,
TN_MOB_CHAR9,
TN_MOB_CHAR10,
TN_MOB_CHAR11,
TN_MOB_CHAR12,
TN_MOB_CHAR13,
TN_MOB_CHAR14,
TN_MOB_CHAR15,
TN_MOB_CHAR16,
TN_MOB_CHAR17,
TN_MOB_ALEX,
TN_MOB_ALEX1,
TN_MOB_ALEX2,
TN_MOB_ALEX3,
TN_MOB_ALEX4,
TN_MOB_ALEX5,
TN_MOB_ALEX6,
TN_MOB_ALEX7,
TN_MOB_DEVALEX,
TN_MOB_DEVSTEVE,
TN_MISC_MAPBG,
+10 -10
View File
@@ -63,16 +63,16 @@ typedef enum _TEXTURE_NAME
TN_MOB_CHAR5,
TN_MOB_CHAR6,
TN_MOB_CHAR7,
TN_MOB_CHAR8,
TN_MOB_CHAR9,
TN_MOB_CHAR10,
TN_MOB_CHAR11,
TN_MOB_CHAR12,
TN_MOB_CHAR13,
TN_MOB_CHAR14,
TN_MOB_CHAR15,
TN_MOB_CHAR16,
TN_MOB_CHAR17,
TN_MOB_ALEX,
TN_MOB_ALEX1,
TN_MOB_ALEX2,
TN_MOB_ALEX3,
TN_MOB_ALEX4,
TN_MOB_ALEX5,
TN_MOB_ALEX6,
TN_MOB_ALEX7,
TN_MOB_DEVALEX,
TN_MOB_DEVSTEVE,
TN_TERRAIN_MOON,
TN_TERRAIN_SUN,
TN_POWERED_CREEPER,
+7
View File
@@ -486,6 +486,9 @@ TrackedEntity::eVisibility TrackedEntity::isVisible(EntityTracker *tracker, shar
// 4J Stu - We call update players when the entity has moved more than a certain amount at the start of it's tick
// Before this call we set xpu, ypu and zpu to the entities new position, but xp,yp and zp are the old position until later in the tick.
// Therefore we should use the new position for visibility checks
// nullptr check
if (!this || !tracker || !sp) return eVisibility_NotVisible;
if (sp == nullptr) return eVisibility_NotVisible;
double xd = sp->x - xpu; //xp / 32;
double zd = sp->z - zpu; //zp / 32;
@@ -516,6 +519,7 @@ TrackedEntity::eVisibility TrackedEntity::isVisible(EntityTracker *tracker, shar
if (!bVisible)
#endif
{
if (!e || !e->riding) return eVisibility_NotVisible;
MinecraftServer *server = MinecraftServer::getInstance();
INetworkPlayer *thisPlayer = sp->connection->getNetworkPlayer();
if( thisPlayer )
@@ -524,6 +528,9 @@ TrackedEntity::eVisibility TrackedEntity::isVisible(EntityTracker *tracker, shar
{
// Consider extra players, but not if they are the entity we are tracking, or the player we've been passed as input, or in another dimension
shared_ptr<ServerPlayer> ep = server->getPlayers()->players[i];
if (!ep) continue;
if (!ep->connection) continue;
if (!ep->connection->getNetworkPlayer()) continue;
if( ep == sp ) continue;
if( ep == e ) continue;
if( ep->dimension != sp->dimension ) continue;
+2 -2
View File
@@ -25,12 +25,12 @@ void VillagerZombieModel::_init(float g, float yOffset, bool isArmor)
head->compile(1.0f/16.0f);
}
VillagerZombieModel::VillagerZombieModel() : HumanoidModel(0, 0, 64, 64, false, true, true)
VillagerZombieModel::VillagerZombieModel() : HumanoidModel(0, 0, 64, 64)
{
_init(0, 0, false);
}
VillagerZombieModel::VillagerZombieModel(float g, float yOffset, bool isArmor) : HumanoidModel(g, 0, 64, isArmor ? 32 : 64 , false, true, isArmor ? true : false)
VillagerZombieModel::VillagerZombieModel(float g, float yOffset, bool isArmor) : HumanoidModel(g, 0, 64, isArmor ? 32 : 64)
{
_init(g, yOffset, isArmor);
}
+6
View File
@@ -24,6 +24,12 @@ bool BonusChestFeature::place(Level *level, Random *random, int x, int y, int z)
bool BonusChestFeature::place(Level *level, Random *random, int x, int y, int z, bool force)
{
// check if level is corrupted first
if (level == nullptr || random == nullptr)
{
return false;
}
if (!level->isNew) return false;
//Will only spawn a bonus chest if the world is new and has never been saved.
if (level->isNew)
{
+16 -16
View File
@@ -736,9 +736,13 @@ vector<HtmlString> *ItemInstance::getHoverText(shared_ptr<Player> player, bool a
{
vector<HtmlString> *lines = new vector<HtmlString>();
Item *item = Item::items[id];
HtmlString title = HtmlString(getHoverName());
if (hasCustomHoverName())
wstring hoverName = getHoverName();
HtmlString title = HtmlString(L"");
title.text = app.EscapeHTMLString(hoverName);
title.text = app.FormatColoredString(title.text);
if (hasCustomHoverName() && !(hoverName[0] == L'\u00A7' && hoverName[1] == L'r'))
{
title.italics = true;
}
@@ -791,19 +795,12 @@ vector<HtmlString> *ItemInstance::getHoverText(shared_ptr<Player> player, bool a
{
CompoundTag *display = tag->getCompound(L"display");
//if (display->contains(L"color"))
//{
// if (advanced)
// {
// wchar_t text [256];
// swprintf(text, 256, L"Color: LOCALISE #%08X", display->getInt(L"color"));
// lines->push_back(HtmlString(text));
// }
// else
// {
// lines->push_back(HtmlString(L"Dyed LOCALISE", eMinecraftColour_NOT_SET, true));
// }
//}
if (display->contains(L"color") && advanced)
{
wchar_t text[256];
swprintf(text, 256, L"Color: LOCALISE #%08X", display->getInt(L"color"));
lines->push_back(HtmlString(text));
}
if (display->contains(L"Lore"))
{
@@ -813,7 +810,10 @@ vector<HtmlString> *ItemInstance::getHoverText(shared_ptr<Player> player, bool a
for (int i = 0; i < lore->size(); i++)
{
//lines->push_back(ChatFormatting::DARK_PURPLE + "" + ChatFormatting::ITALIC + lore->get(i)->data);
lines->push_back(lore->get(i)->data);
HtmlString loreString = HtmlString(L"");
loreString.text = app.EscapeHTMLString(lore->get(i)->data);
loreString.text = app.EscapeHTMLString(loreString.text);
lines->push_back(loreString);
}
}
}
+77 -11
View File
@@ -110,6 +110,10 @@ void Player::_init()
m_bCheckedForModelParts=false;
m_bCheckedDLCForModelParts=false;
m_ppSkinOffsets=nullptr;
m_bCheckedForSkinOffsets=false;
m_bCheckedDLCForSkinOffsets=false;
#if defined(__PS3__) || defined(__ORBIS__)
m_ePlayerNameValidState=ePlayerNameValid_NotSet;
#endif
@@ -724,7 +728,9 @@ void Player::setCustomSkin(DWORD skinId)
m_bCheckedDLCForModelParts=false;
this->SetAdditionalModelParts(nullptr);
m_bCheckedForSkinOffsets=false;
m_bCheckedDLCForSkinOffsets=false;
this->SetSkinOffsets(nullptr);
}
unsigned int Player::getSkinAnimOverrideBitmask(DWORD skinId)
@@ -2903,25 +2909,25 @@ int Player::getTexture()
case eDefaultSkins_Skin7:
return TN_MOB_CHAR7; // 4J - was L"/mob/char7.png";
case eDefaultSkins_Skin8:
return TN_MOB_CHAR8; // 4J - was L"/mob/char8.png";
return TN_MOB_ALEX; // 4J - was L"/mob/alex.png";
case eDefaultSkins_Skin9:
return TN_MOB_CHAR9; // 4J - was L"/mob/char9.png";
return TN_MOB_ALEX1; // 4J - was L"/mob/alex1.png";
case eDefaultSkins_Skin10:
return TN_MOB_CHAR10; // 4J - was L"/mob/char10.png";
return TN_MOB_ALEX2; // 4J - was L"/mob/alex2.png";
case eDefaultSkins_Skin11:
return TN_MOB_CHAR11; // 4J - was L"/mob/char11.png";
return TN_MOB_ALEX3; // 4J - was L"/mob/alex3.png";
case eDefaultSkins_Skin12:
return TN_MOB_CHAR12; // 4J - was L"/mob/char12.png";
return TN_MOB_ALEX4; // 4J - was L"/mob/alex4.png";
case eDefaultSkins_Skin13:
return TN_MOB_CHAR13; // 4J - was L"/mob/char13.png";
return TN_MOB_ALEX5; // 4J - was L"/mob/alex5.png";
case eDefaultSkins_Skin14:
return TN_MOB_CHAR14; // 4J - was L"/mob/char14.png";
return TN_MOB_ALEX6; // 4J - was L"/mob/alex6.png";
case eDefaultSkins_Skin15:
return TN_MOB_CHAR15; // 4J - was L"/mob/char15.png";
return TN_MOB_ALEX7; // 4J - was L"/mob/alex7.png";
case eDefaultSkins_Skin16:
return TN_MOB_CHAR16; // 4J - was L"/mob/char16.png";
return TN_MOB_DEVALEX; // 4J - was L"/mob/DevAlex.png";
case eDefaultSkins_Skin17:
return TN_MOB_CHAR17; // 4J - was L"/mob/char17.png";
return TN_MOB_DEVSTEVE; // 4J - was L"/mob/DevSteve.png";
default:
return TN_MOB_CHAR; // 4J - was L"/mob/char.png";
@@ -3389,11 +3395,71 @@ vector<ModelPart *> *Player::GetAdditionalModelParts()
return m_ppAdditionalModelParts;
}
vector<SKIN_OFFSET *> *Player::GetSkinOffsets()
{
if(m_ppSkinOffsets==nullptr && !m_bCheckedForSkinOffsets)
{
bool hasCustomTexture = !customTextureUrl.empty();
bool customTextureIsDefaultSkin = customTextureUrl.substr(0,3).compare(L"def") == 0;
// see if we can find the parts
m_ppSkinOffsets=app.GetSkinOffsets(m_dwSkinId);
// If it's a default texture (which has no parts), we have the parts, or we already have the texture (in which case we should have parts if there are any) then we are done
if(!hasCustomTexture || customTextureIsDefaultSkin || m_ppSkinOffsets != nullptr || app.IsFileInMemoryTextures(customTextureUrl))
{
m_bCheckedForSkinOffsets=true;
}
if(m_ppSkinOffsets == nullptr && !m_bCheckedDLCForSkinOffsets)
{
m_bCheckedDLCForSkinOffsets = true;
// we don't have the data from the dlc skin yet
app.DebugPrintf("m_bCheckedForModelOffsets Couldn't get skin offsets for skin %X\n",m_dwSkinId);
// do we have it from the DLC pack?
DLCSkinFile *pDLCSkinFile = app.m_dlcManager.getSkinFile(this->customTextureUrl);
if(pDLCSkinFile!=nullptr)
{
DWORD dwOffsetC=pDLCSkinFile->getOffsetsCount();
if(dwOffsetC!=0)
{
app.DebugPrintf("m_bCheckedForSkinOffsets Got skin offsets from DLCskin for skin %X\n",m_dwSkinId);
m_ppSkinOffsets=app.SetSkinOffsets(m_dwSkinId,pDLCSkinFile->getOffsets());
}
m_bCheckedForSkinOffsets=true;
}
}
}
return m_ppSkinOffsets;
}
int Player::GetModelTypeFromAnimBitmask(unsigned int animBitmask)
{
if (animBitmask&(1<<HumanoidModel::eAnim_SlimModel)) return 2;
else if (animBitmask&(1<<HumanoidModel::eAnim_WideModel)) return 1;
else return 0;
}
int Player::GetModelTypeFromTextureId(int textureId)
{
if (textureId > 8 && textureId < 18) return 2;
else if (textureId == 18) return 1;
else return 0;
}
void Player::SetAdditionalModelParts(vector<ModelPart *> *ppAdditionalModelParts)
{
m_ppAdditionalModelParts=ppAdditionalModelParts;
}
void Player::SetSkinOffsets(vector<SKIN_OFFSET *> *ppSkinOffsets)
{
m_ppSkinOffsets=ppSkinOffsets;
}
#if defined(__PS3__) || defined(__ORBIS__)
Player::ePlayerNameValidState Player::GetPlayerNameValidState(void)
+7
View File
@@ -442,6 +442,8 @@ public:
static DWORD getCapeIdFromPath(const wstring &cape);
static wstring getCapePathFromId(DWORD capeId);
static unsigned int getSkinAnimOverrideBitmask(DWORD skinId);
static int GetModelTypeFromAnimBitmask(unsigned int uiAnimOverrideBitmask);
static int GetModelTypeFromTextureId(int textureId);
// 4J Added
void setXuid(PlayerUID xuid);
@@ -553,6 +555,8 @@ public:
vector<ModelPart *> *GetAdditionalModelParts();
void SetAdditionalModelParts(vector<ModelPart *> *ppAdditionalModelParts);
vector<SKIN_OFFSET *> *GetSkinOffsets();
void SetSkinOffsets(vector<SKIN_OFFSET *> *ppSkinOffsets);
#if defined(__PS3__) || defined(__ORBIS__)
enum ePlayerNameValidState
@@ -569,6 +573,9 @@ private:
vector<ModelPart *> *m_ppAdditionalModelParts;
bool m_bCheckedForModelParts;
bool m_bCheckedDLCForModelParts;
vector<SKIN_OFFSET *> *m_ppSkinOffsets;
bool m_bCheckedForSkinOffsets;
bool m_bCheckedDLCForSkinOffsets;
#if defined(__PS3__) || defined(__ORBIS__)
ePlayerNameValidState m_ePlayerNameValidState; // 4J-PB - to ensure we have the characters for this name in our font, or display a player number instead
+75 -2
View File
@@ -12,7 +12,9 @@ TextureAndGeometryPacket::TextureAndGeometryPacket()
this->dwTextureBytes = 0;
this->pbData = nullptr;
this->dwBoxC = 0;
this->dwOffsetC = 0;
this->BoxDataA = nullptr;
this->OffsetDataA = nullptr;
uiAnimOverrideBitmask=0;
}
@@ -43,7 +45,9 @@ TextureAndGeometryPacket::TextureAndGeometryPacket(const wstring &textureName, P
this->pbData = pbData;
this->dwTextureBytes = dwBytes;
this->dwBoxC = 0;
this->dwOffsetC = 0;
this->BoxDataA=nullptr;
this->OffsetDataA=nullptr;
this->uiAnimOverrideBitmask=0;
}
@@ -62,6 +66,7 @@ TextureAndGeometryPacket::TextureAndGeometryPacket(const wstring &textureName, P
this->dwTextureBytes = dwBytes;
this->uiAnimOverrideBitmask = pDLCSkinFile->getAnimOverrideBitmask();
this->dwBoxC = pDLCSkinFile->getAdditionalBoxesCount();
this->dwOffsetC = pDLCSkinFile->getOffsetsCount();
if(this->dwBoxC!=0)
{
this->BoxDataA= new SKIN_BOX [this->dwBoxC];
@@ -77,9 +82,24 @@ TextureAndGeometryPacket::TextureAndGeometryPacket(const wstring &textureName, P
{
this->BoxDataA=nullptr;
}
if(this->dwOffsetC!=0)
{
this->OffsetDataA= new SKIN_OFFSET [this->dwOffsetC];
vector<SKIN_OFFSET *> *pSkinOffsets=pDLCSkinFile->getOffsets();
int iCount=0;
for(auto& pSkinOffset : *pSkinOffsets)
{
this->OffsetDataA[iCount++]=*pSkinOffset;
}
}
else
{
this->OffsetDataA=nullptr;
}
}
TextureAndGeometryPacket::TextureAndGeometryPacket(const wstring &textureName, PBYTE pbData, DWORD dwBytes,vector<SKIN_BOX *> *pvSkinBoxes, unsigned int uiAnimOverrideBitmask)
TextureAndGeometryPacket::TextureAndGeometryPacket(const wstring &textureName, PBYTE pbData, DWORD dwBytes, vector<SKIN_BOX *> *pvSkinBoxes, vector<SKIN_OFFSET *> *pvSkinOffsets, unsigned int uiAnimOverrideBitmask)
{
this->textureName = textureName;
@@ -109,6 +129,22 @@ TextureAndGeometryPacket::TextureAndGeometryPacket(const wstring &textureName, P
this->BoxDataA[iCount++]=*pSkinBox;
}
}
if(pvSkinOffsets==nullptr)
{
this->dwOffsetC=0;
this->OffsetDataA=nullptr;
}
else
{
this->dwOffsetC = static_cast<DWORD>(pvSkinOffsets->size());
this->OffsetDataA= new SKIN_OFFSET [this->dwOffsetC];
int iCount=0;
for(auto& pSkinOffset : *pvSkinOffsets)
{
this->OffsetDataA[iCount++]=*pSkinOffset;
}
}
}
@@ -148,6 +184,7 @@ void TextureAndGeometryPacket::read(DataInputStream *dis) //throws IOException
uiAnimOverrideBitmask = dis->readInt();
short rawBoxC = dis->readShort();
short rawOffsetC = dis->readShort();
if (rawBoxC <= 0)
{
dwBoxC = 0;
@@ -160,11 +197,27 @@ void TextureAndGeometryPacket::read(DataInputStream *dis) //throws IOException
dwBoxC = 0; // sane limit for skin boxes
}
}
if (rawOffsetC <= 0)
{
dwOffsetC = 0;
}
else
{
dwOffsetC = (DWORD)(unsigned short)rawOffsetC;
if (dwOffsetC > 256)
{
dwOffsetC = 0; // sane limit for skin offsets
}
}
if(dwBoxC>0)
{
this->BoxDataA= new SKIN_BOX [dwBoxC];
}
if(dwOffsetC>0)
{
this->OffsetDataA= new SKIN_OFFSET [dwOffsetC];
}
for(DWORD i=0;i<dwBoxC;i++)
{
@@ -177,10 +230,19 @@ void TextureAndGeometryPacket::read(DataInputStream *dis) //throws IOException
this->BoxDataA[i].fD = dis->readFloat();
this->BoxDataA[i].fU = dis->readFloat();
this->BoxDataA[i].fV = dis->readFloat();
this->BoxDataA[i].fA = dis->readFloat();
this->BoxDataA[i].fM = dis->readFloat();
this->BoxDataA[i].fS = dis->readFloat();
}
for(DWORD i=0;i<dwOffsetC;i++)
{
this->OffsetDataA[i].ePart = static_cast<eBodyOffset>(dis->readShort());
this->OffsetDataA[i].fD = dis->readFloat();
this->OffsetDataA[i].fO = dis->readFloat();
}
}
void TextureAndGeometryPacket::write(DataOutputStream *dos) //throws IOException
void __fastcall TextureAndGeometryPacket::write(DataOutputStream *dos) //throws IOException
{
dos->writeUTF(textureName);
dos->writeInt(dwSkinID);
@@ -203,6 +265,17 @@ void TextureAndGeometryPacket::write(DataOutputStream *dos) //throws IOException
dos->writeFloat(this->BoxDataA[i].fD);
dos->writeFloat(this->BoxDataA[i].fU);
dos->writeFloat(this->BoxDataA[i].fV);
dos->writeFloat(this->BoxDataA[i].fA);
dos->writeFloat(this->BoxDataA[i].fM);
dos->writeFloat(this->BoxDataA[i].fS);
}
dos->writeShort(static_cast<short>(dwOffsetC));
for(DWORD i=0;i<dwOffsetC;i++)
{
dos->writeShort(static_cast<short>(this->OffsetDataA[i].ePart));
dos->writeFloat(this->OffsetDataA[i].fD);
dos->writeFloat(this->OffsetDataA[i].fO);
}
}
+4 -1
View File
@@ -4,6 +4,7 @@ using namespace std;
#include "Packet.h"
#include "../Minecraft.Client/Model.h"
#include "../Minecraft.Client/SkinBox.h"
#include "../Minecraft.Client/SkinOffset.h"
class DLCSkinFile;
@@ -15,14 +16,16 @@ public:
PBYTE pbData;
DWORD dwTextureBytes;
SKIN_BOX *BoxDataA;
SKIN_OFFSET *OffsetDataA;
DWORD dwBoxC;
DWORD dwOffsetC;
unsigned int uiAnimOverrideBitmask;
TextureAndGeometryPacket();
~TextureAndGeometryPacket();
TextureAndGeometryPacket(const wstring &textureName, PBYTE pbData, DWORD dwBytes);
TextureAndGeometryPacket(const wstring &textureName, PBYTE pbData, DWORD dwBytes, DLCSkinFile *pDLCSkinFile);
TextureAndGeometryPacket(const wstring &textureName, PBYTE pbData, DWORD dwBytes, vector<SKIN_BOX *> *pvSkinBoxes, unsigned int uiAnimOverrideBitmask);
TextureAndGeometryPacket(const wstring &textureName, PBYTE pbData, DWORD dwBytes, vector<SKIN_BOX *> *pvSkinBoxes, vector<SKIN_OFFSET *> *pvSkinOffsets, unsigned int uiAnimOverrideBitmask);
virtual void handle(PacketListener *listener);
virtual void read(DataInputStream *dis);