Skip to content

Commit

Permalink
Merge pull request #73 from fallahn/golf-1.12
Browse files Browse the repository at this point in the history
1.12.1 hotfix
  • Loading branch information
fallahn authored Apr 23, 2023
2 parents 88b93ff + 345d768 commit 57ca785
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion crogine/src/core/App.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ void winAbort(int)
#include <algorithm>

#ifdef CRO_DEBUG_
#define DEBUG_NO_CONTROLLER
//#define DEBUG_NO_CONTROLLER
#endif // CRO_DEBUG_

using namespace cro;
Expand Down
2 changes: 1 addition & 1 deletion libsocial/include/Social.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ source distribution.
//(terrain vertex data and materials changed 1100 -> 1110)
//(player avatar data format changed 1110 -> 1120)
static constexpr std::uint16_t CURRENT_VER = 1120;
static const std::string StringVer("1.12.0");
static const std::string StringVer("1.12.1");


class Social final
Expand Down
9 changes: 8 additions & 1 deletion samples/golf/src/golf/MenuAvatars.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1613,6 +1613,14 @@ void MenuState::eraseCurrentProfile()
{
auto profileID = m_profileData.playerProfiles[m_profileData.activeProfileIndex].profileID;

//assign a valid texture to the preview model
auto idx = indexFromAvatarID(m_profileData.playerProfiles[m_profileData.activeProfileIndex].skinID);
m_playerAvatars[idx].previewModel.getComponent<cro::Model>().setMaterialProperty(0, "u_diffuseMap", m_playerAvatars[idx].getTextureID());

//before we delete the old one...
m_profileTextures.erase(m_profileTextures.begin() + m_profileData.activeProfileIndex);


//erase profile first so we know we have valid remaining
m_profileData.playerProfiles.erase(m_profileData.playerProfiles.begin() + m_profileData.activeProfileIndex);

Expand All @@ -1627,7 +1635,6 @@ void MenuState::eraseCurrentProfile()
}
}

m_profileTextures.erase(m_profileTextures.begin() + m_profileData.activeProfileIndex);
m_profileData.activeProfileIndex = m_rosterMenu.profileIndices[m_rosterMenu.activeIndex];

//refresh the preview / roster list
Expand Down
2 changes: 1 addition & 1 deletion samples/golf/src/golf/MenuCustomisation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ void MenuState::updateProfileTextures(std::size_t start, std::size_t count)
return;
}

CRO_ASSERT(start < count && count <= m_profileData.playerProfiles.size(), "");
CRO_ASSERT(start < m_profileData.playerProfiles.size() && start + count <= m_profileData.playerProfiles.size(), "");

for (auto i = start; i < start + count; ++i)
{
Expand Down
4 changes: 3 additions & 1 deletion samples/golf/src/golf/ProfileState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ void ProfileState::buildScene()
//refresh the avatar settings
setAvatarIndex(indexFromAvatarID(m_activeProfile.skinID));
setHairIndex(indexFromHairID(m_activeProfile.hairID));
setBallIndex(indexFromBallID(m_activeProfile.ballID));
setBallIndex(indexFromBallID(m_activeProfile.ballID) % m_ballModels.size());
refreshMugshot();
refreshNameString();
refreshSwatch();
Expand Down Expand Up @@ -1656,6 +1656,8 @@ void ProfileState::setHairIndex(std::size_t idx)

void ProfileState::setBallIndex(std::size_t idx)
{
CRO_ASSERT(idx < m_ballModels.size(), "");

if (m_ballHairModels[m_ballHairIndex].isValid())
{
m_ballModels[m_ballIndex].root.getComponent<cro::Transform>().removeChild(m_ballHairModels[m_ballHairIndex].getComponent<cro::Transform>());
Expand Down

0 comments on commit 57ca785

Please sign in to comment.