smartcmd-MinecraftConsoles/Minecraft.Client/Common/UI/UIScene_SkinSelectMenu.h

197 lines
6 KiB
C
Raw Normal View History

2026-03-01 12:16:08 +08:00
#pragma once
#include "../../../Minecraft.World/Definitions.h"
2026-03-01 12:16:08 +08:00
#include "UIScene.h"
#include "UIControl_PlayerSkinPreview.h"
class UIScene_SkinSelectMenu : public UIScene
{
private:
2026-03-06 23:25:57 +01:00
static const WCHAR *wchDefaultNamesA[eDefaultSkins_Count];
2026-03-01 12:16:08 +08:00
// 4J Stu - How many to show on each side of the main control
static const BYTE sidePreviewControls = 4;
#ifdef __PSVITA__
enum ETouchInput
{
ETouchInput_TabLeft = 10,
ETouchInput_TabRight,
ETouchInput_TabCenter,
ETouchInput_IggyCharacters,
ETouchInput_Count,
};
#endif
enum ESkinSelectNavigation
{
eSkinNavigation_Pack,
eSkinNavigation_Skin,
eSkinNavigation_Count,
};
enum ECharacters
{
eCharacter_Current,
eCharacter_Next1,
eCharacter_Next2,
eCharacter_Next3,
eCharacter_Next4,
eCharacter_Previous1,
eCharacter_Previous2,
eCharacter_Previous3,
eCharacter_Previous4,
eCharacter_COUNT,
};
UIControl_PlayerSkinPreview m_characters[eCharacter_COUNT];
UIControl_Label m_labelSkinName, m_labelSkinOrigin;
UIControl_Label m_labelSelected;
UIControl m_controlSkinNamePlate, m_controlSelectedPanel, m_controlIggyCharacters, m_controlTimer;
#ifdef __PSVITA__
UIControl_Touch m_TouchTabLeft, m_TouchTabRight, m_TouchTabCenter, m_TouchIggyCharacters;
#endif
IggyName m_funcSetPlayerCharacterSelected, m_funcSetCharacterLocked;
IggyName m_funcSetLeftLabel, m_funcSetRightLabel, m_funcSetCentreLabel;
UI_BEGIN_MAP_ELEMENTS_AND_NAMES(UIScene)
#ifdef __PSVITA__
UI_MAP_ELEMENT( m_TouchTabLeft, "TouchTabLeft" )
UI_MAP_ELEMENT( m_TouchTabRight, "TouchTabRight" )
UI_MAP_ELEMENT( m_TouchTabCenter, "TouchTabCenter" )
UI_MAP_ELEMENT( m_TouchIggyCharacters, "TouchIggyCharacters" )
#endif
UI_MAP_ELEMENT( m_controlSkinNamePlate, "SkinNamePlate")
UI_BEGIN_MAP_CHILD_ELEMENTS( m_controlSkinNamePlate )
UI_MAP_ELEMENT( m_labelSkinName, "SkinTitle1")
UI_MAP_ELEMENT( m_labelSkinOrigin, "SkinTitle2")
UI_END_MAP_CHILD_ELEMENTS()
UI_MAP_ELEMENT( m_controlSelectedPanel, "SelectedPanel" )
UI_BEGIN_MAP_CHILD_ELEMENTS( m_controlSelectedPanel )
UI_MAP_ELEMENT( m_labelSelected, "SelectedPanelLabel" )
UI_END_MAP_CHILD_ELEMENTS()
UI_MAP_ELEMENT( m_controlTimer, "Timer" )
// 4J Stu - These aren't really used a AS3 controls, but adding here means that they get ticked by the scene
UI_MAP_ELEMENT( m_controlIggyCharacters, "IggyCharacters" )
UI_BEGIN_MAP_CHILD_ELEMENTS( m_controlIggyCharacters )
UI_MAP_ELEMENT( m_characters[eCharacter_Current], "iggy_Character0" )
UI_MAP_ELEMENT( m_characters[eCharacter_Next1], "iggy_Character1" )
UI_MAP_ELEMENT( m_characters[eCharacter_Next2], "iggy_Character2" )
UI_MAP_ELEMENT( m_characters[eCharacter_Next3], "iggy_Character3" )
UI_MAP_ELEMENT( m_characters[eCharacter_Next4], "iggy_Character4" )
UI_MAP_ELEMENT( m_characters[eCharacter_Previous1], "iggy_Character5" )
UI_MAP_ELEMENT( m_characters[eCharacter_Previous2], "iggy_Character6" )
UI_MAP_ELEMENT( m_characters[eCharacter_Previous3], "iggy_Character7" )
UI_MAP_ELEMENT( m_characters[eCharacter_Previous4], "iggy_Character8" )
UI_END_MAP_CHILD_ELEMENTS()
UI_MAP_NAME( m_funcSetPlayerCharacterSelected, L"SetPlayerCharacterSelected" )
UI_MAP_NAME( m_funcSetCharacterLocked, L"SetCharacterLocked" )
UI_MAP_NAME( m_funcSetLeftLabel, L"SetLeftLabel" )
UI_MAP_NAME( m_funcSetCentreLabel, L"SetCenterLabel" )
UI_MAP_NAME( m_funcSetRightLabel, L"SetRightLabel" )
UI_END_MAP_ELEMENTS_AND_NAMES()
DLCPack *m_currentPack;
DWORD m_packIndex, m_skinIndex;
DWORD m_originalSkinId;
wstring m_currentSkinPath, m_selectedSkinPath, m_selectedCapePath;
vector<SKIN_BOX *> *m_vAdditionalSkinBoxes;
Squashed commit of the following: commit b40530fa5e12bdd0e2d03686b111964f9c5b3359 Author: Langtanium <94726057+Langtanium@users.noreply.github.com> Date: Wed Apr 15 19:59:46 2026 -0700 Implemented skin offsets in UI Added code to render skin offsets in the skin select UI. commit a8384d984089b989a162550705dee7a505412e22 Author: Langtanium <94726057+Langtanium@users.noreply.github.com> Date: Wed Apr 15 19:38:08 2026 -0700 Partially implemented offsets Added code that visually shifts the player's model parts, but only in game not in the skin select UI. commit 875100cf9afe7df258dc653a4b33857d3cd285c1 Author: Langtanium <94726057+Langtanium@users.noreply.github.com> Date: Wed Apr 15 16:48:03 2026 -0700 Minor change Simplified redundant conditions in HumanoidModel.cpp commit 96f683d1fb93d09a49987460ef698e0d125c2c93 Merge: db685a74 24c74aa2 Author: Langtanium <94726057+Langtanium@users.noreply.github.com> Date: Tue Apr 14 16:37:30 2026 -0700 Merge branch 'feat/64x64-skins' into feat/skin-offsets commit db685a74f34d02cc83e33ab97c5a7ad9a62ef023 Author: Langtanium <94726057+Langtanium@users.noreply.github.com> Date: Tue Apr 14 15:35:38 2026 -0700 Fixed skin offset data Fixed skin offsets so they now return the actual data instead of the defaults, added a few minor tweaks, and added code in PlayerRenderer.cpp to access offsets (Can read the offsets but can not apply them). commit aa769d54adb8f5bf96c75d10766422d23cc9129a Author: Langtanium <94726057+Langtanium@users.noreply.github.com> Date: Sat Apr 11 19:36:52 2026 -0700 Fixed crashes Fixed code for offsets preventing crashes. The amount of offsets is correctly obtain, but lacks the actual data. commit f18ac12cc072db74ed9b8da937e00c2e15f889a0 Merge: 8e76763a fd2fd659 Author: Langtanium <94726057+Langtanium@users.noreply.github.com> Date: Fri Apr 10 16:06:57 2026 -0700 Merge branch 'feat/64x64-skins' into feat/skin-offsets commit 8e76763a3ddeaff943243fd0469d6c4a7b12b6c1 Author: Langtanium <94726057+Langtanium@users.noreply.github.com> Date: Tue Apr 7 16:50:43 2026 -0700 Made more changes Made more changes in files to support skin offsets. The game still crashes when trying to load skins. commit 1a8f3532979033717044e74e6ceb766e23e35032 Merge: a1d9ae59 bb5fa506 Author: Langtanium <94726057+Langtanium@users.noreply.github.com> Date: Tue Apr 7 13:12:39 2026 -0700 Merge branch 'feat/64x64-skins' into feat/skin-offsets commit a1d9ae591ac27117626aac708a4204a9e2451684 Author: Langtanium <94726057+Langtanium@users.noreply.github.com> Date: Fri Apr 3 21:50:42 2026 -0700 Added small additions Added more code referencing skin offsets. Still doesn't work correctly. commit d28a751d9ca0527854e40be82e7841a650c2f189 Merge: 3888de7a 8bf03435 Author: Langtanium <94726057+Langtanium@users.noreply.github.com> Date: Thu Apr 2 17:09:08 2026 -0700 Merge branch 'smartcmd:main' into feat/skin-offsets commit 3888de7ab401d9562b7b922eca8b898aa73ba024 Author: Langtanium <94726057+Langtanium@users.noreply.github.com> Date: Thu Apr 2 17:07:48 2026 -0700 Added code for skin offsets Added code to the file which have the functionality to get skin boxes and duplicated the functionality for skin offsets. The code causes the game to crash when switching to third person. The error occurs with the skin offsets returning as an empty class object.
2026-04-15 20:00:28 -07:00
vector<SKIN_OFFSET *> *m_vSkinOffsets;
2026-03-01 12:16:08 +08:00
bool m_bSlidingSkins, m_bAnimatingMove;
ESkinSelectNavigation m_currentNavigation;
bool m_bNoSkinsToShow;
DWORD m_currentPackCount;
bool m_bIgnoreInput;
bool m_bSkinIndexChanged;
wstring m_leftLabel, m_centreLabel, m_rightLabel;
S32 m_iTouchXStart;
bool m_bTouchScrolled;
public:
UIScene_SkinSelectMenu(int iPad, void *initData, UILayer *parentLayer);
#ifdef __PSVITA__
virtual ~UIScene_SkinSelectMenu() { DeleteCriticalSection(&m_DLCInstallCS); }
#endif
virtual void tick();
virtual void updateTooltips();
virtual void updateComponents();
virtual EUIScene getSceneType() { return eUIScene_SkinSelectMenu;}
virtual void handleAnimationEnd();
protected:
// TODO: This should be pure virtual in this class
virtual wstring getMoviePath();
public:
// INPUT
virtual void handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled);
virtual void customDraw(IggyCustomDrawCallbackRegion *region);
private:
void handleSkinIndexChanged();
int getNextSkinIndex(DWORD sourceIndex);
int getPreviousSkinIndex(DWORD sourceIndex);
TEXTURE_NAME getTextureId(int skinIndex);
void handlePackIndexChanged();
void updatePackDisplay();
int getNextPackIndex(DWORD sourceIndex);
int getPreviousPackIndex(DWORD sourceIndex);
void setCharacterSelected(bool selected);
void setCharacterLocked(bool locked);
void setLeftLabel(const wstring &label);
void setCentreLabel(const wstring &label);
void setRightLabel(const wstring &label);
virtual void HandleDLCMountingComplete();
virtual void HandleDLCInstalled();
#ifdef _XBOX_ONE
virtual void HandleDLCLicenseChange();
#endif
void showNotOnlineDialog(int iPad);
static int UnlockSkinReturned(void *pParam,int iPad,C4JStorage::EMessageResult result);
static int RenableInput(LPVOID lpVoid, int, int);
void AddFavoriteSkin(int iPad,int iSkinID);
void InputActionOK(unsigned int iPad);
#ifdef __PSVITA__
virtual void handleTouchInput(unsigned int iPad, S32 x, S32 y, int iId, bool bPressed, bool bRepeat, bool bReleased);
#endif //__PSVITA__
virtual void handleReload();
#ifdef __ORBIS__
bool m_bErrorDialogRunning;
#endif
#ifdef __PSVITA__
static int MustSignInReturned(void *pParam,int iPad,C4JStorage::EMessageResult result);
static int PSNSignInReturned(void* pParam, bool bContinue, int iPad);
#endif
2026-03-01 12:16:08 +08:00
#ifdef __PSVITA__
CRITICAL_SECTION m_DLCInstallCS; // to prevent a race condition between the install and the mounted callback
#endif
};