Merge pull request #363 from 4jcraft/chore/fmt2
Some checks are pending
Publish Documentation / build (push) Waiting to run
Build (Linux, x86-64) / build-linux (push) Waiting to run
Format Check / clang-format (push) Waiting to run

chore: format everything
This commit is contained in:
Tropical 2026-03-30 02:33:42 -05:00 committed by GitHub
commit 8a83ea0879
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
463 changed files with 12634 additions and 11237 deletions

View file

@ -87,8 +87,7 @@ using PXMARKETPLACE_CONTENTOFFER_INFO = XMARKETPLACE_CONTENTOFFER_INFO*;
#endif
#ifndef XMARKETPLACE_OFFERING_TYPE_CONTENT
inline constexpr std::uint32_t XMARKETPLACE_OFFERING_TYPE_CONTENT =
0x00000002;
inline constexpr std::uint32_t XMARKETPLACE_OFFERING_TYPE_CONTENT = 0x00000002;
#endif
#ifndef XMARKETPLACE_OFFERING_TYPE_GAME_DEMO

View file

@ -264,7 +264,6 @@ static void utf8_pop_back(std::string& str) {
str.erase(i);
}
// Each tick we update the input state by polling SDL, this is where we get the
// kbd and mouse state.
void C_4JInput::Tick() {
@ -650,9 +649,7 @@ bool C_4JInput::GetMenuDisplayed(int iPad) {
if (iPad >= 0 && iPad < 4) return s_menuDisplayed[iPad];
return false;
}
const char* C_4JInput::GetText() {
return s_textInputBuf.c_str();
}
const char* C_4JInput::GetText() { return s_textInputBuf.c_str(); }
bool C_4JInput::VerifyStrings(wchar_t**, int,
int (*)(void*, STRING_VERIFY_RESPONSE*), void*) {
return true;

View file

@ -102,8 +102,7 @@ void initialiseDefaultGameSettings(ProfileGameSettings* gameSettings) {
}
} // namespace
void C_4JProfile::Initialise(std::uint32_t dwTitleID,
std::uint32_t dwOfferID,
void C_4JProfile::Initialise(std::uint32_t dwTitleID, std::uint32_t dwOfferID,
unsigned short usProfileVersion,
unsigned int uiProfileValuesC,
unsigned int uiProfileSettingsC,
@ -139,9 +138,9 @@ unsigned int C_4JProfile::RequestSignInUI(
int iQuadrant) {
return 0;
}
unsigned int C_4JProfile::DisplayOfflineProfile(
int (*Func)(void*, const bool, const int iPad), void* lpParam,
int iQuadrant) {
unsigned int C_4JProfile::DisplayOfflineProfile(int (*Func)(void*, const bool,
const int iPad),
void* lpParam, int iQuadrant) {
return 0;
}
unsigned int C_4JProfile::RequestConvertOfflineToGuestUI(
@ -152,7 +151,9 @@ unsigned int C_4JProfile::RequestConvertOfflineToGuestUI(
void C_4JProfile::SetPrimaryPlayerChanged(bool bVal) {}
bool C_4JProfile::QuerySigninStatus(void) { return true; }
void C_4JProfile::GetXUID(int iPad, PlayerUID* pXuid, bool bOnlineXuid) {
if (pXuid) *pXuid = kFakeXuidBase + static_cast<PlayerUID>(isValidPad(iPad) ? iPad : 0);
if (pXuid)
*pXuid =
kFakeXuidBase + static_cast<PlayerUID>(isValidPad(iPad) ? iPad : 0);
}
bool C_4JProfile::AreXUIDSEqual(PlayerUID xuid1, PlayerUID xuid2) {
return xuid1 == xuid2;
@ -267,4 +268,6 @@ void C_4JProfile::SetUpsellCallback(void (*Func)(void* lpParam,
eUpsellResponse response,
int iUserData),
void* lpParam) {}
void C_4JProfile::SetDebugFullOverride(bool bVal) { s_profileIsFullVersion = bVal; }
void C_4JProfile::SetDebugFullOverride(bool bVal) {
s_profileIsFullVersion = bVal;
}

View file

@ -56,14 +56,15 @@ public:
bool IsSignedInLive(int iProf);
bool IsGuest(int iQuadrant);
unsigned int RequestSignInUI(bool bFromInvite, bool bLocalGame,
bool bNoGuestsAllowed,
bool bMultiplayerSignIn, bool bAddUser,
bool bNoGuestsAllowed, bool bMultiplayerSignIn,
bool bAddUser,
int (*Func)(void*, const bool, const int iPad),
void* lpParam,
int iQuadrant = XUSER_INDEX_ANY);
unsigned int DisplayOfflineProfile(
int (*Func)(void*, const bool, const int iPad), void* lpParam,
int iQuadrant = XUSER_INDEX_ANY);
unsigned int DisplayOfflineProfile(int (*Func)(void*, const bool,
const int iPad),
void* lpParam,
int iQuadrant = XUSER_INDEX_ANY);
unsigned int RequestConvertOfflineToGuestUI(
int (*Func)(void*, const bool, const int iPad), void* lpParam,
int iQuadrant = XUSER_INDEX_ANY);
@ -80,8 +81,7 @@ public:
void AllowedPlayerCreatedContent(int iPad, bool thisQuadrantOnly,
bool* allAllowed, bool* friendsAllowed);
bool CanViewPlayerCreatedContent(int iPad, bool thisQuadrantOnly,
PlayerUID* pXuids,
unsigned int xuidCount);
PlayerUID* pXuids, unsigned int xuidCount);
void ShowProfileCard(int iPad, PlayerUID targetUid);
bool GetProfileAvatar(int iPad,
int (*Func)(void* lpParam,
@ -129,9 +129,8 @@ public:
void RegisterAward(int iAwardNumber, int iGamerconfigID, eAwardType eType,
bool bLeaderboardAffected = false,
CXuiStringTable* pStringTable = nullptr,
int iTitleStr = -1,
int iTextStr = -1, int iAcceptStr = -1,
char* pszThemeName = nullptr,
int iTitleStr = -1, int iTextStr = -1,
int iAcceptStr = -1, char* pszThemeName = nullptr,
unsigned int uiThemeSize = 0L);
int GetAwardId(int iAwardNumber);
eAwardType GetAwardType(int iAwardNumber);

View file

@ -1,28 +1,28 @@
#pragma once
#ifndef GL_GLEXT_PROTOTYPES
# define GL_GLEXT_PROTOTYPES 1
#define GL_GLEXT_PROTOTYPES 1
#endif
#include <GL/gl.h>
#include <GL/glext.h>
#include <SDL2/SDL.h>
#include <cstdio>
#ifndef GL_ARRAY_BUFFER
# define GL_ARRAY_BUFFER 0x8892
#define GL_ARRAY_BUFFER 0x8892
#endif
#ifndef GL_ELEMENT_ARRAY_BUFFER
# define GL_ELEMENT_ARRAY_BUFFER 0x8893
#define GL_ELEMENT_ARRAY_BUFFER 0x8893
#endif
#ifndef GL_STATIC_DRAW
# define GL_STATIC_DRAW 0x88B4
#define GL_STATIC_DRAW 0x88B4
#endif
#ifndef GL_VERTEX_SHADER
# define GL_VERTEX_SHADER 0x8B31
#define GL_VERTEX_SHADER 0x8B31
#endif
#ifndef GL_FRAGMENT_SHADER
# define GL_FRAGMENT_SHADER 0x8B30
#define GL_FRAGMENT_SHADER 0x8B30
#endif
#ifndef GL_QUADS
# define GL_QUADS 0x0007
#define GL_QUADS 0x0007
#endif
static inline bool gl3_load() {
const char* ver = (const char*)glGetString(GL_VERSION);
@ -33,10 +33,15 @@ static inline bool gl3_load() {
int major = 0, minor = 0;
if (sscanf(ver, "%d.%d", &major, &minor) >= 2) {
if (major < 3 || (major == 3 && minor < 3)) {
fprintf(stderr, "[gl3_loader] ERROR: Need GL 3.3, but system provides %s\n", ver);
fprintf(stderr,
"[gl3_loader] ERROR: Need GL 3.3, but system provides %s\n",
ver);
return false;
}
}
fprintf(stderr, "[gl3_loader] GL Version: %s, it's all okay!! until android support.\n", ver);
fprintf(
stderr,
"[gl3_loader] GL Version: %s, it's all okay!! until android support.\n",
ver);
return true;
}

View file

@ -31,8 +31,8 @@ bool C4JStorage::SetSaveDevice(int (*Func)(void*, const bool), void* lpParam,
}
void C4JStorage::Init(unsigned int uiSaveVersion,
const wchar_t* pwchDefaultSaveName,
char* pszSavePackName, int iMinimumSaveSize,
const wchar_t* pwchDefaultSaveName, char* pszSavePackName,
int iMinimumSaveSize,
int (*Func)(void*, const ESavingMessage, int),
void* lpParam, const char* szGroupID) {}
void C4JStorage::ResetSaveData() {}
@ -61,8 +61,7 @@ void* C4JStorage::AllocateSaveData(unsigned int uiBytes) {
}
void C4JStorage::SetSaveImages(std::uint8_t* pbThumbnail,
unsigned int thumbnailBytes,
std::uint8_t* pbImage,
unsigned int imageBytes,
std::uint8_t* pbImage, unsigned int imageBytes,
std::uint8_t* pbTextData,
unsigned int textDataBytes) {}
C4JStorage::ESaveGameState C4JStorage::SaveSaveData(int (*Func)(void*,
@ -130,7 +129,9 @@ C4JStorage::EDLCStatus C4JStorage::GetDLCOffers(
}
unsigned int C4JStorage::CancelGetDLCOffers() { return 0; }
void C4JStorage::ClearDLCOffers() {}
XMARKETPLACE_CONTENTOFFER_INFO& C4JStorage::GetOffer(unsigned int dw) { return s_dummyOffer; }
XMARKETPLACE_CONTENTOFFER_INFO& C4JStorage::GetOffer(unsigned int dw) {
return s_dummyOffer;
}
int C4JStorage::GetOfferCount() { return 0; }
unsigned int C4JStorage::InstallOffer(int iOfferIDC, std::uint64_t* ullOfferIDA,
int (*Func)(void*, int, int),
@ -146,7 +147,9 @@ C4JStorage::EDLCStatus C4JStorage::GetInstalledDLC(int iPad,
}
return EDLC_NoInstalledDLC;
}
XCONTENT_DATA& C4JStorage::GetDLC(unsigned int dw) { return s_dummyContentData; }
XCONTENT_DATA& C4JStorage::GetDLC(unsigned int dw) {
return s_dummyContentData;
}
std::uint32_t C4JStorage::MountInstalledDLC(
int iPad, std::uint32_t dwDLC,
int (*Func)(void*, int, std::uint32_t, std::uint32_t), void* lpParam,
@ -165,8 +168,7 @@ C4JStorage::ETMSStatus C4JStorage::ReadTMSFile(
int iQuadrant, eGlobalStorage eStorageFacility,
C4JStorage::eTMS_FileType eFileType, wchar_t* pwchFilename,
std::uint8_t** ppBuffer, unsigned int* pBufferSize,
int (*Func)(void*, wchar_t*, int, bool, int), void* lpParam,
int iAction) {
int (*Func)(void*, wchar_t*, int, bool, int), void* lpParam, int iAction) {
return ETMSStatus_Fail;
}
bool C4JStorage::WriteTMSFile(int iQuadrant, eGlobalStorage eStorageFacility,

View file

@ -42,18 +42,18 @@ typedef std::vector<PXCONTENT_DATA> XContentDataArray;
class C4JStorage {
public:
// Structs defined in the DLC_Creator, but added here to be used in the app
typedef struct {
unsigned int uiFileSize;
std::uint32_t dwType;
std::uint32_t dwWchCount; // count of wchar_t in next array
wchar_t wchFile[1];
} DLC_FILE_DETAILS, *PDLC_FILE_DETAILS;
typedef struct {
unsigned int uiFileSize;
std::uint32_t dwType;
std::uint32_t dwWchCount; // count of wchar_t in next array
wchar_t wchFile[1];
} DLC_FILE_DETAILS, *PDLC_FILE_DETAILS;
typedef struct {
std::uint32_t dwType;
std::uint32_t dwWchCount; // count of wchar_t in next array;
wchar_t wchData[1]; // will be an array of size dwBytes
} DLC_FILE_PARAM, *PDLC_FILE_PARAM;
typedef struct {
std::uint32_t dwType;
std::uint32_t dwWchCount; // count of wchar_t in next array;
wchar_t wchData[1]; // will be an array of size dwBytes
} DLC_FILE_PARAM, *PDLC_FILE_PARAM;
// End of DLC_Creator structs
typedef struct {
@ -240,8 +240,8 @@ typedef struct {
std::uint8_t* pbImage, unsigned int imageBytes,
std::uint8_t* pbTextData,
unsigned int textDataBytes); // Sets the thumbnail & image for the
// save, optionally setting the
// metadata in the png
// save, optionally setting the
// metadata in the png
C4JStorage::ESaveGameState SaveSaveData(int (*Func)(void*, const bool),
void* lpParam);
void CopySaveDataToNewSave(std::uint8_t* pbThumbnail,
@ -269,7 +269,8 @@ typedef struct {
void* lpParam); // Get the thumbnail for an individual save referenced
// by pSaveInfo
void GetSaveCacheFileInfo(unsigned int fileIndex, XCONTENT_DATA& xContentData);
void GetSaveCacheFileInfo(unsigned int fileIndex,
XCONTENT_DATA& xContentData);
void GetSaveCacheFileInfo(unsigned int fileIndex,
std::uint8_t** ppbImageData,
unsigned int* pImageBytes);
@ -291,8 +292,7 @@ typedef struct {
void SetDLCPackageRoot(char* pszDLCRoot);
C4JStorage::EDLCStatus GetDLCOffers(
int iPad, int (*Func)(void*, int, std::uint32_t, int), void* lpParam,
std::uint32_t dwOfferTypesBitmask =
XMARKETPLACE_OFFERING_TYPE_CONTENT);
std::uint32_t dwOfferTypesBitmask = XMARKETPLACE_OFFERING_TYPE_CONTENT);
unsigned int CancelGetDLCOffers();
void ClearDLCOffers();
XMARKETPLACE_CONTENTOFFER_INFO& GetOffer(unsigned int dw);
@ -334,9 +334,8 @@ typedef struct {
#ifdef _XBOX
C4JStorage::ETMSStatus WriteTMSFile(
int iPad, C4JStorage::eGlobalStorage eStorageFacility,
C4JStorage::eTMS_FileType eFileType, char* pchFilePath,
char* pchBuffer, unsigned int bufferSize, TMSCLIENT_CALLBACK Func,
void* lpParam);
C4JStorage::eTMS_FileType eFileType, char* pchFilePath, char* pchBuffer,
unsigned int bufferSize, TMSCLIENT_CALLBACK Func, void* lpParam);
int GetUserQuotaInfo(int iPad, TMSCLIENT_CALLBACK Func, void* lpParam);
#endif

View file

@ -65,22 +65,23 @@ void TeleportCommand::execute(std::shared_ptr<CommandSender> source,
// int pos = args.length - 3;
// int maxPos = Level.MAX_LEVEL_SIZE;
// int x = convertArgToInt(source, args[pos++], -maxPos,
//maxPos); int y = convertArgToInt(source, args[pos++],
//Level.minBuildHeight, Level.maxBuildHeight); int z =
//convertArgToInt(source, args[pos++], -maxPos, maxPos);
// maxPos); int y = convertArgToInt(source,
// args[pos++], Level.minBuildHeight, Level.maxBuildHeight);
// int z = convertArgToInt(source, args[pos++], -maxPos, maxPos);
// victim.teleportTo(x + 0.5f, y, z + 0.5f);
// logAdminAction(source, "commands.tp.coordinates",
//victim.getAName(), x, y, z);
// victim.getAName(), x, y, z);
// }
// } else if (args.length == 1 || args.length == 2) {
// ServerPlayer destination =
//server.getPlayers().getPlayer(args[args.length - 1]); if (destination ==
//null) throw new PlayerNotFoundException();
// server.getPlayers().getPlayer(args[args.length - 1]); if
// (destination == null) throw new PlayerNotFoundException();
// victim.connection.teleport(destination.x, destination.y,
//destination.z, destination.yRot, destination.xRot); logAdminAction(source,
//"commands.tp.success", victim.getAName(), destination.getAName());
// destination.z, destination.yRot, destination.xRot);
// logAdminAction(source, "commands.tp.success", victim.getAName(),
// destination.getAName());
// }
//}
}

View file

@ -254,7 +254,6 @@ void StatsCounter::save(int player, bool force) {
saveCounter = SAVE_DELAY;
}
void StatsCounter::flushLeaderboards() {
if (LeaderboardManager::Instance()->OpenSession()) {
writeStats();
@ -301,7 +300,6 @@ void StatsCounter::writeStats() {
int viewCount = 0;
int iPad = ProfileManager.GetLockedProfile();
}
void StatsCounter::setupStatBoards() {
@ -390,6 +388,5 @@ void StatsCounter::dumpStatsToTTY() {
#define DEBUG_CLEAR_LEADERBOARDS (0xFFFFFFFF)
#define DEBUG_ENABLE_CLEAR_LEADERBOARDS
void StatsCounter::WipeLeaderboards() {
}
void StatsCounter::WipeLeaderboards() {}
#endif

View file

@ -90,6 +90,5 @@ private:
bool isLargeStat(Stat* stat);
void dumpStatsToTTY();
void writeStats();
};

View file

@ -626,8 +626,8 @@ void MultiPlayerLevel::disconnect(bool sendDisconnect /*= true*/) {
Tickable* MultiPlayerLevel::makeSoundUpdater(
std::shared_ptr<Minecart> minecart) {
return nullptr; // new MinecartSoundUpdater(minecraft->soundEngine, minecart,
// minecraft->player);
return nullptr; // new MinecartSoundUpdater(minecraft->soundEngine,
// minecart, minecraft->player);
}
void MultiPlayerLevel::tickWeather() {
@ -811,8 +811,8 @@ void MultiPlayerLevel::removeAllPendingEntityRemovals() {
EnterCriticalSection(&m_entitiesCS);
for (auto it = entities.begin(); it != entities.end();) {
bool found = false;
for (auto it2 = entitiesToRemove.begin();
it2 != entitiesToRemove.end(); it2++) {
for (auto it2 = entitiesToRemove.begin(); it2 != entitiesToRemove.end();
it2++) {
if ((*it) == (*it2)) {
found = true;
break;

View file

@ -1384,8 +1384,7 @@ void ServerLevel::entityRemovedExtra(std::shared_ptr<Entity> e) {
EnterCriticalSection(&m_limiterCS);
// printf("entity removed: item entity count
//%d\n",m_itemEntities.size());
auto it =
find(m_hangingEntities.begin(), m_hangingEntities.end(), e);
auto it = find(m_hangingEntities.begin(), m_hangingEntities.end(), e);
if (it != m_hangingEntities.end()) {
// printf("Item to remove found\n");
m_hangingEntities.erase(it);
@ -1410,7 +1409,7 @@ void ServerLevel::entityRemovedExtra(std::shared_ptr<Entity> e) {
// printf("entity removed: experience orb entity count
//%d\n",m_arrowEntities.size());
auto it = find(m_experienceOrbEntities.begin(),
m_experienceOrbEntities.end(), e);
m_experienceOrbEntities.end(), e);
if (it != m_experienceOrbEntities.end()) {
// printf("Item to remove found\n");
m_experienceOrbEntities.erase(it);

View file

@ -91,7 +91,6 @@ int Minecraft::frameTimePos = 0;
int64_t Minecraft::warezTime = 0;
File Minecraft::workDir = File(L"");
ResourceLocation Minecraft::DEFAULT_FONT_LOCATION =
ResourceLocation(TN_DEFAULT_FONT);
ResourceLocation Minecraft::ALT_FONT_LOCATION = ResourceLocation(TN_ALT_FONT);
@ -198,8 +197,8 @@ Minecraft::Minecraft(Component* mouseComponent, Canvas* parent,
localgameModes[i] = nullptr;
}
animateTickLevel = nullptr; // 4J added
m_inFullTutorialBits = 0; // 4J Added
animateTickLevel = nullptr; // 4J added
m_inFullTutorialBits = 0; // 4J Added
reloadTextures = false;
// initialise the audio before any textures are loaded - to avoid the
@ -233,7 +232,6 @@ void Minecraft::connectTo(const std::wstring& server, int port) {
}
void Minecraft::init() {
// glClearColor(0.2f, 0.2f, 0.2f, 1);
workingDirectory = getWorkingDirectory();
@ -468,7 +466,8 @@ void Minecraft::setScreen(Screen* screen) {
this->screen = screen;
if (screen == nullptr && level == nullptr) {
screen = new TitleScreen();
} else if (player != nullptr && !ui.GetMenuDisplayed(player->GetXboxPad()) &&
} else if (player != nullptr &&
!ui.GetMenuDisplayed(player->GetXboxPad()) &&
player->getHealth() <= 0) {
#if defined(ENABLE_JAVA_GUIS)
screen = new DeathScreen();
@ -480,7 +479,8 @@ void Minecraft::setScreen(Screen* screen) {
if (ticks == 0) {
player->respawn();
} else {
ui.NavigateToScene(player->GetXboxPad(), eUIScene_DeathMenu, nullptr);
ui.NavigateToScene(player->GetXboxPad(), eUIScene_DeathMenu,
nullptr);
}
#endif
}
@ -541,7 +541,8 @@ void Minecraft::destroy() {
if (screen == nullptr && level == nullptr) {
screen = new TitleScreen();
} else if (player != nullptr && !ui.GetMenuDisplayed(player->GetXboxPad()) &&
} else if (player != nullptr &&
!ui.GetMenuDisplayed(player->GetXboxPad()) &&
player->getHealth() <= 0) {
#if defined(ENABLE_JAVA_GUIS)
screen = new DeathScreen();
@ -553,7 +554,8 @@ void Minecraft::destroy() {
if (ticks == 0) {
player->respawn();
} else {
ui.NavigateToScene(player->GetXboxPad(), eUIScene_DeathMenu, nullptr);
ui.NavigateToScene(player->GetXboxPad(), eUIScene_DeathMenu,
nullptr);
}
#endif
}
@ -605,7 +607,6 @@ void Minecraft::destroy() {
// 4J-PB - splitting this function into 3 parts, so we can call the middle part
// from our xbox game loop
void Minecraft::run() {
running = true;
// try { // 4J - removed try/catch
@ -624,7 +625,8 @@ bool Minecraft::setLocalPlayerIdx(int idx) {
localPlayerIdx = idx;
// If the player is not null, but the game mode is then this is just a temp
// player whose only real purpose is to hold the viewport position
if (localplayers[idx] == nullptr || localgameModes[idx] == nullptr) return false;
if (localplayers[idx] == nullptr || localgameModes[idx] == nullptr)
return false;
gameMode = localgameModes[idx];
player = localplayers[idx];
@ -854,7 +856,8 @@ std::shared_ptr<MultiplayerLocalPlayer> Minecraft::createExtraLocalPlayer(
localplayers[idx]->SetXboxPad(iPad);
if (localplayers[idx]->input != nullptr) delete localplayers[idx]->input;
if (localplayers[idx]->input != nullptr)
delete localplayers[idx]->input;
localplayers[idx]->input = new Input();
localplayers[idx]->resetPos();
@ -907,7 +910,6 @@ void Minecraft::removeLocalPlayerIdx(int idx) {
}
getLevel(localplayers[idx]->dimension)->removeEntity(localplayers[idx]);
// 4J Stu - Fix for #13257 - CRASH: Gameplay: Title crashed after
// exiting the tutorial It doesn't matter if they were in the tutorial
// already
@ -1322,8 +1324,7 @@ void Minecraft::run_middle() {
// did we just get input from a player who doesn't
// exist? They'll be wanting to join the game then
if (InputManager.ButtonPressed(
i, MINECRAFT_ACTION_PAUSEMENU))
{
i, MINECRAFT_ACTION_PAUSEMENU)) {
// Let them join
// are they signed in?
@ -1430,7 +1431,6 @@ void Minecraft::run_middle() {
}
}
if (pause && level != nullptr) {
float lastA = timer->a;
timer->advanceTime();
@ -2349,8 +2349,8 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) {
case Tile::chest_Id:
*piAction = IDS_TOOLTIPS_MINE;
*piUse = (Tile::chest->getContainer(level, x, y,
z) != nullptr)
*piUse = (Tile::chest->getContainer(
level, x, y, z) != nullptr)
? IDS_TOOLTIPS_OPEN
: -1;
break;
@ -3402,14 +3402,14 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) {
#endif
}
if ((player->ullButtonsPressed & (1LL << MINECRAFT_ACTION_PAUSEMENU))
) {
if ((player->ullButtonsPressed & (1LL << MINECRAFT_ACTION_PAUSEMENU))) {
app.DebugPrintf(
"PAUSE PRESS PROCESSING - ipad = %d, NavigateToScene\n",
player->GetXboxPad());
ui.PlayUISFX(eSFX_Press);
#if !defined(ENABLE_JAVA_GUIS)
ui.NavigateToScene(iPad, eUIScene_PauseMenu, nullptr, eUILayer_Scene);
ui.NavigateToScene(iPad, eUIScene_PauseMenu, nullptr,
eUILayer_Scene);
#endif
}
@ -3439,8 +3439,8 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) {
if (selectedItem != nullptr) iCount = selectedItem->GetCount();
if (selectedItem != nullptr && !((player->ullButtonsPressed &
(1LL << MINECRAFT_ACTION_DROP)) &&
selectedItem->GetCount() == 1)) {
(1LL << MINECRAFT_ACTION_DROP)) &&
selectedItem->GetCount() == 1)) {
itemName = selectedItem->getHoverName();
}
if (!(player->ullButtonsPressed & (1LL << MINECRAFT_ACTION_DROP)) ||
@ -3473,7 +3473,6 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) {
// }
// #endif
if (level != nullptr) {
if (player != nullptr) {
recheckPlayerIn++;
@ -3598,7 +3597,9 @@ void Minecraft::reloadSound() {
bgLoader->forceReload();
}
bool Minecraft::isClientSide() { return level != nullptr && level->isClientSide; }
bool Minecraft::isClientSide() {
return level != nullptr && level->isClientSide;
}
void Minecraft::selectLevel(ConsoleSaveFile* saveFile,
const std::wstring& levelId,
@ -3698,9 +3699,9 @@ void Minecraft::setLevel(MultiPlayerLevel* level, int message /*=-1*/,
forceStatsSave(player->GetXboxPad());
// 4J Stu - Added these for the case when we exit a level so we are
// setting the level to nullptr The level renderer needs to have it's
// stored level set to nullptr so that it doesn't break next time we
// set one
// setting the level to nullptr The level renderer needs to have
// it's stored level set to nullptr so that it doesn't break next
// time we set one
if (levelRenderer != nullptr) {
for (unsigned int p = 0; p < XUSER_MAX_COUNT; ++p) {
levelRenderer->setLevel(p, nullptr);
@ -3709,8 +3710,8 @@ void Minecraft::setLevel(MultiPlayerLevel* level, int message /*=-1*/,
if (particleEngine != nullptr) particleEngine->setLevel(nullptr);
}
}
// 4J If we are setting the level to nullptr then we are exiting, so delete the
// levels
// 4J If we are setting the level to nullptr then we are exiting, so delete
// the levels
if (level == nullptr) {
if (levels[0] != nullptr) {
delete levels[0];
@ -3863,7 +3864,6 @@ void Minecraft::prepareLevel(int title) {
spawnPos->z = (int)player->z;
}
for (int x = -r; x <= r; x += 16) {
for (int z = -r; z <= r; z += 16) {
if (progressRenderer != nullptr)
@ -4078,8 +4078,8 @@ void Minecraft::startAndConnectTo(const std::wstring& name,
// if (ProfileManager.IsFullVersion())
{
if (userName != L"" &&
sid != L"") // 4J - username & side were compared with nullptr rather
// than empty strings
sid != L"") // 4J - username & side were compared with nullptr
// rather than empty strings
{
minecraft->user = new User(userName, sid);
} else {
@ -4226,8 +4226,8 @@ if (gameMode->instaBuild) return;
if (!down) missTime = 0;
if (button == 0 && missTime > 0) return;
if (down && hitResult != nullptr && hitResult->type == HitResult::TILE && button ==
0)
if (down && hitResult != nullptr && hitResult->type == HitResult::TILE && button
== 0)
{
int x = hitResult->x;
int y = hitResult->y;
@ -4260,7 +4260,8 @@ bool mayUse = true;
// 4J-PB - Adding a special case in here for sleeping in a bed in a multiplayer
game - we need to wake up, and we don't have the inbedchatscreen with a button
if(button==1 && (player->isSleeping() && level != nullptr && level->isClientSide))
if(button==1 && (player->isSleeping() && level != nullptr &&
level->isClientSide))
{
shared_ptr<MultiplayerLocalPlayer> mplp =
std::dynamic_pointer_cast<MultiplayerLocalPlayer>( player );
@ -4279,8 +4280,8 @@ PlayerCommandPacket.STOP_SLEEPING));
if (hitResult == nullptr)
{
if (button == 0 && !(dynamic_cast<CreativeMode *>(gameMode) != nullptr)) missTime =
10;
if (button == 0 && !(dynamic_cast<CreativeMode *>(gameMode) != nullptr))
missTime = 10;
}
else if (hitResult->type == HitResult::ENTITY)
{
@ -4402,9 +4403,7 @@ void Minecraft::playerLeftTutorial(int iPad) {
}
}
int Minecraft::InGame_SignInReturned(void* pParam, bool bContinue, int iPad)
{
int Minecraft::InGame_SignInReturned(void* pParam, bool bContinue, int iPad) {
Minecraft* pMinecraftClass = (Minecraft*)pParam;
if (g_NetworkManager.IsInSession()) {
@ -4424,7 +4423,7 @@ int Minecraft::InGame_SignInReturned(void* pParam, bool bContinue, int iPad)
// It's possible that the player has not signed in - they can back out
// or choose no for the converttoguest
if (ProfileManager.IsSignedIn(iPad)) {
if (!g_NetworkManager.SessionHasSpace()) {
if (!g_NetworkManager.SessionHasSpace()) {
unsigned int uiIDA[1];
uiIDA[0] = IDS_OK;
ui.RequestErrorMessage(IDS_MULTIPLAYER_FULL_TITLE,
@ -4485,7 +4484,7 @@ void Minecraft::tickAllConnections() {
bool Minecraft::addPendingClientTextureRequest(
const std::wstring& textureName) {
auto it = find(m_pendingTextureRequests.begin(),
m_pendingTextureRequests.end(), textureName);
m_pendingTextureRequests.end(), textureName);
if (it == m_pendingTextureRequests.end()) {
m_pendingTextureRequests.push_back(textureName);
return true;
@ -4495,7 +4494,7 @@ bool Minecraft::addPendingClientTextureRequest(
void Minecraft::handleClientTextureReceived(const std::wstring& textureName) {
auto it = find(m_pendingTextureRequests.begin(),
m_pendingTextureRequests.end(), textureName);
m_pendingTextureRequests.end(), textureName);
if (it != m_pendingTextureRequests.end()) {
m_pendingTextureRequests.erase(it);
}
@ -4516,4 +4515,3 @@ ColourTable* Minecraft::getColourTable() {
return colours;
}

View file

@ -277,7 +277,7 @@ public:
// bool isRaining ;
// 4J - Moved to per player
//int64_t lastTickTime;
// int64_t lastTickTime;
private:
// 4J- per player?
@ -386,5 +386,4 @@ public:
unsigned int getCurrentTexturePackId();
ColourTable* getColourTable();
};

View file

@ -889,8 +889,7 @@ void MinecraftServer::stopServer(bool didInit) {
// also need to check for a profile switch here - primary player signs out,
// and another player signs in before dismissing the dash
if ((m_bPrimaryPlayerSignedOut == false) &&
ProfileManager.IsSignedIn(ProfileManager.GetPrimaryPad()))
{
ProfileManager.IsSignedIn(ProfileManager.GetPrimaryPad())) {
// if trial version or saving is disabled, then don't save anything.
// Also don't save anything if we didn't actually get through the server
// initialisation.
@ -916,7 +915,7 @@ void MinecraftServer::stopServer(bool didInit) {
saveGameRules();
app.m_gameRules.unloadCurrentGameRules();
if (levels[0] != nullptr) // This can be null if stopServer happens
// very quickly due to network error
// very quickly due to network error
{
levels[0]->saveToDisc(
Minecraft::GetInstance()->progressRenderer, false);
@ -942,7 +941,6 @@ void MinecraftServer::stopServer(bool didInit) {
}
}
delete connection;
connection = nullptr;
delete players;
@ -1613,8 +1611,7 @@ void MinecraftServer::chunkPacketManagement_PreTick() {
do {
int longestTime = 0;
auto playerConnectionBest = playersOrig.begin();
for (auto it = playersOrig.begin(); it != playersOrig.end();
it++) {
for (auto it = playersOrig.begin(); it != playersOrig.end(); it++) {
int thisTime = 0;
INetworkPlayer* np = (*it)->getNetworkPlayer();
if (np) {
@ -1700,8 +1697,8 @@ void MinecraftServer::cycleSlowQueueIndex() {
s_slowQueuePlayerIndex = 0;
}
} while (g_NetworkManager.IsInSession() && currentPlayerCount > 0 &&
s_slowQueuePlayerIndex != startingIndex && currentPlayer != nullptr &&
currentPlayer->IsLocal());
s_slowQueuePlayerIndex != startingIndex &&
currentPlayer != nullptr && currentPlayer->IsLocal());
// app.DebugPrintf("Cycled slow queue index to %d\n",
// s_slowQueuePlayerIndex);
}

View file

@ -22,7 +22,6 @@ class CommandDispatcher;
#define MINECRAFT_SERVER_SLOW_QUEUE_DELAY 250
typedef struct _LoadSaveDataThreadParam {
void* data;
int64_t fileSize;

View file

@ -50,7 +50,6 @@
#include "../Platform/Common/UI/UI.h"
#include "../Textures/Packs/DLCTexturePack.h"
ClientConnection::ClientConnection(Minecraft* minecraft, const std::wstring& ip,
int port) {
// 4J Stu - No longer used as we use the socket version below.
@ -1256,7 +1255,8 @@ void ClientConnection::onDisconnect(DisconnectPacket::eDisconnectReason reason,
uiIDA[0] = IDS_CONFIRM_OK;
ui.RequestErrorMessage(IDS_EXITING_GAME, IDS_GENERIC_ERROR, uiIDA, 1,
ProfileManager.GetPrimaryPad(),
&ClientConnection::HostDisconnectReturned, nullptr);
&ClientConnection::HostDisconnectReturned,
nullptr);
} else {
app.SetAction(m_userIndex, eAppAction_ExitWorld, (void*)true);
}
@ -1839,9 +1839,6 @@ void ClientConnection::handlePreLogin(std::shared_ptr<PreLoginPacket> packet) {
isAtLeastOneFriend = true;
cantPlayContentRestricted = false;
if (!canPlay || !canPlayLocal || !isAtLeastOneFriend ||
cantPlayContentRestricted) {
DisconnectPacket::eDisconnectReason reason =
@ -1943,8 +1940,7 @@ void ClientConnection::handlePreLogin(std::shared_ptr<PreLoginPacket> packet) {
// On PS3, all non-signed in players (even guests) can get a useful
// offlineXUID
if (!ProfileManager.IsGuest(m_userIndex))
{
if (!ProfileManager.IsGuest(m_userIndex)) {
// All other players we use their offline XUID so that they can play
// the game offline
ProfileManager.GetXUID(m_userIndex, &offlineXUID, false);
@ -2003,8 +1999,7 @@ void ClientConnection::handleAddMob(std::shared_ptr<AddMobPacket> packet) {
if (subEntities != nullptr) {
int offs = packet->id - mob->entityId;
// for (int i = 0; i < subEntities.length; i++)
for (auto it = subEntities->begin(); it != subEntities->end();
++it) {
for (auto it = subEntities->begin(); it != subEntities->end(); ++it) {
// subEntities[i].entityId += offs;
(*it)->entityId += offs;
}
@ -2078,7 +2073,8 @@ void ClientConnection::handleEntityLinkPacket(
displayMountMessage =
(sourceEntity->riding == nullptr && destEntity != nullptr);
} else if (destEntity != nullptr && destEntity->instanceof(eTYPE_BOAT)) {
} else if (destEntity != nullptr &&
destEntity->instanceof(eTYPE_BOAT)) {
(std::dynamic_pointer_cast<Boat>(destEntity))->setDoLerp(true);
}
@ -2416,7 +2412,6 @@ void ClientConnection::handleRespawn(std::shared_ptr<RespawnPacket> packet) {
minecraft->setScreen(new ReceivingLevelScreen(this));
// minecraft->addPendingLocalConnection(m_userIndex, this);
if (minecraft->localgameModes[m_userIndex] != nullptr) {
TutorialMode* gameMode =
(TutorialMode*)minecraft->localgameModes[m_userIndex];
@ -2816,7 +2811,8 @@ void ClientConnection::handleTileEntityData(
if (te != nullptr) {
if (packet->type == TileEntityDataPacket::TYPE_MOB_SPAWNER &&
std::dynamic_pointer_cast<MobSpawnerTileEntity>(te) != nullptr) {
std::dynamic_pointer_cast<MobSpawnerTileEntity>(te) !=
nullptr) {
std::dynamic_pointer_cast<MobSpawnerTileEntity>(te)->load(
packet->tag);
} else if (packet->type == TileEntityDataPacket::TYPE_ADV_COMMAND &&
@ -2830,7 +2826,8 @@ void ClientConnection::handleTileEntityData(
std::dynamic_pointer_cast<BeaconTileEntity>(te)->load(
packet->tag);
} else if (packet->type == TileEntityDataPacket::TYPE_SKULL &&
std::dynamic_pointer_cast<SkullTileEntity>(te) != nullptr) {
std::dynamic_pointer_cast<SkullTileEntity>(te) !=
nullptr) {
std::dynamic_pointer_cast<SkullTileEntity>(te)->load(
packet->tag);
}
@ -2912,7 +2909,8 @@ void ClientConnection::handleGameEvent(
app.DebugPrintf("handleGameEvent packet for WIN_GAME - %d\n",
m_userIndex);
// This just allows it to be shown
if (minecraft->localgameModes[ProfileManager.GetPrimaryPad()] != nullptr)
if (minecraft->localgameModes[ProfileManager.GetPrimaryPad()] !=
nullptr)
minecraft->localgameModes[ProfileManager.GetPrimaryPad()]
->getTutorial()
->showTutorialPopup(false);
@ -3362,8 +3360,7 @@ int ClientConnection::HostDisconnectReturned(
uiIDA, 2, ProfileManager.GetPrimaryPad(),
&ClientConnection::ExitGameAndSaveReturned,
nullptr);
} else
{
} else {
MinecraftServer::getInstance()->setSaveOnExit(true);
// flag a app action of exit game
app.SetAction(iPad, eAppAction_ExitWorld);
@ -3396,19 +3393,15 @@ std::wstring ClientConnection::GetDisplayNameByGamertag(std::wstring gamertag) {
}
void ClientConnection::handleAddObjective(
std::shared_ptr<SetObjectivePacket> packet) {
}
std::shared_ptr<SetObjectivePacket> packet) {}
void ClientConnection::handleSetScore(std::shared_ptr<SetScorePacket> packet) {
}
void ClientConnection::handleSetScore(std::shared_ptr<SetScorePacket> packet) {}
void ClientConnection::handleSetDisplayObjective(
std::shared_ptr<SetDisplayObjectivePacket> packet) {
}
std::shared_ptr<SetDisplayObjectivePacket> packet) {}
void ClientConnection::handleSetPlayerTeamPacket(
std::shared_ptr<SetPlayerTeamPacket> packet) {
}
std::shared_ptr<SetPlayerTeamPacket> packet) {}
void ClientConnection::handleParticleEvent(
std::shared_ptr<LevelParticlesPacket> packet) {
@ -3444,8 +3437,8 @@ void ClientConnection::handleUpdateAttributes(
(std::dynamic_pointer_cast<LivingEntity>(entity))->getAttributes();
std::unordered_set<UpdateAttributesPacket::AttributeSnapshot*>
attributeSnapshots = packet->getValues();
for (auto it = attributeSnapshots.begin();
it != attributeSnapshots.end(); ++it) {
for (auto it = attributeSnapshots.begin(); it != attributeSnapshots.end();
++it) {
UpdateAttributesPacket::AttributeSnapshot* attribute = *it;
AttributeInstance* instance =
attributes->getInstance(attribute->getId());
@ -3465,8 +3458,7 @@ void ClientConnection::handleUpdateAttributes(
std::unordered_set<AttributeModifier*>* modifiers =
attribute->getModifiers();
for (auto it2 = modifiers->begin(); it2 != modifiers->end();
++it2) {
for (auto it2 = modifiers->begin(); it2 != modifiers->end(); ++it2) {
AttributeModifier* modifier = *it2;
instance->addModifier(
new AttributeModifier(modifier->getId(), modifier->getAmount(),

View file

@ -207,8 +207,8 @@ LevelChunk* MultiPlayerChunkCache::create(int x, int z) {
(int64_t*)&cache[idx], (int64_t)chunk, (int64_t)lastChunk) ==
(int64_t)lastChunk)
#else
if (InterlockedCompareExchangeRelease((int32_t*)&cache[idx], (int32_t)chunk,
(int32_t)lastChunk) ==
if (InterlockedCompareExchangeRelease(
(int32_t*)&cache[idx], (int32_t)chunk, (int32_t)lastChunk) ==
(int32_t)lastChunk)
#endif // 0
{

View file

@ -93,8 +93,8 @@ void PendingConnection::sendPreLoginResponse() {
StorageManager.GetSaveUniqueFilename(szUniqueMapName);
PlayerList* playerList = MinecraftServer::getInstance()->getPlayers();
for (auto it = playerList->players.begin();
it != playerList->players.end(); ++it) {
for (auto it = playerList->players.begin(); it != playerList->players.end();
++it) {
std::shared_ptr<ServerPlayer> player = *it;
// If the offline Xuid is invalid but the online one is not then that's
// guest which we should ignore If the online Xuid is invalid but the
@ -180,9 +180,9 @@ void PendingConnection::handleAcceptedLogin(
packet->m_onlineXuid);
if (playerEntity != nullptr) {
server->getPlayers()->placeNewPlayer(connection, playerEntity, packet);
connection = nullptr; // We've moved responsibility for this over to the
// new PlayerConnection, nullptr so we don't delete our
// reference to it here in our dtor
connection = nullptr; // We've moved responsibility for this over to
// the new PlayerConnection, nullptr so we don't
// delete our reference to it here in our dtor
}
done = true;
}

View file

@ -105,7 +105,7 @@ void PlayerChunkMap::PlayerChunk::remove(std::shared_ptr<ServerPlayer> player) {
LevelChunk* chunk = parent->level->getChunk(pos.x, pos.z);
updateInhabitedTime(chunk);
auto it = find(parent->knownChunks.begin(),
parent->knownChunks.end(), this);
parent->knownChunks.end(), this);
if (it != parent->knownChunks.end()) parent->knownChunks.erase(it);
}
int64_t id = (pos.x + 0x7fffffffLL) | ((pos.z + 0x7fffffffLL) << 32);
@ -117,7 +117,7 @@ void PlayerChunkMap::PlayerChunk::remove(std::shared_ptr<ServerPlayer> player) {
}
if (changes > 0) {
auto it = find(parent->changedChunks.begin(),
parent->changedChunks.end(), this);
parent->changedChunks.end(), this);
parent->changedChunks.erase(it);
}
parent->getLevel()->cache->drop(pos.x, pos.z);
@ -764,10 +764,9 @@ bool PlayerChunkMap::isPlayerIn(std::shared_ptr<ServerPlayer> player,
if (chunk == nullptr) {
return false;
} else {
auto it1 =
find(chunk->players.begin(), chunk->players.end(), player);
auto it1 = find(chunk->players.begin(), chunk->players.end(), player);
auto it2 = find(player->chunksToSend.begin(),
player->chunksToSend.end(), chunk->pos);
player->chunksToSend.end(), chunk->pos);
return it1 != chunk->players.end() && it2 == player->chunksToSend.end();
}

View file

@ -273,9 +273,7 @@ void PlayerConnection::handleMovePlayer(
float r = 1 / 16.0f;
AABB shrunk = player->bb.shrink(r, r, r);
bool oldOk =
level->getCubes(player, &shrunk)
->empty();
bool oldOk = level->getCubes(player, &shrunk)->empty();
if (player->onGround && !packet->onGround && yDist > 0) {
// assume the player made a jump
@ -327,9 +325,7 @@ void PlayerConnection::handleMovePlayer(
// TODO: check if this can be elided
shrunk = player->bb.shrink(r, r, r);
bool newOk =
level->getCubes(player, &shrunk)
->empty();
bool newOk = level->getCubes(player, &shrunk)->empty();
if (oldOk && (fail || !newOk) && !player->isSleeping()) {
teleport(xLastOk, yLastOk, zLastOk, yRotT, xRotT);
return;
@ -712,7 +708,7 @@ void PlayerConnection::handleInteract(std::shared_ptr<InteractPacket> packet) {
// a ray from head->head, but we may actually be looking at a different part
// of the entity that can be seen even though the ray is blocked.
if (target != nullptr) // && player->canSee(target) &&
// player->distanceToSqr(target) < 6 * 6)
// player->distanceToSqr(target) < 6 * 6)
{
// boole canSee = player->canSee(target);
// double maxDist = 6 * 6;
@ -852,7 +848,7 @@ void PlayerConnection::handleTextureReceived(const std::wstring& textureName) {
// This sends the server received texture out to any other players waiting
// for the data
auto it = find(m_texturesRequested.begin(), m_texturesRequested.end(),
textureName);
textureName);
if (it != m_texturesRequested.end()) {
std::uint8_t* pbData = nullptr;
unsigned int dwBytes = 0;
@ -871,7 +867,7 @@ void PlayerConnection::handleTextureAndGeometryReceived(
// This sends the server received texture out to any other players waiting
// for the data
auto it = find(m_texturesRequested.begin(), m_texturesRequested.end(),
textureName);
textureName);
if (it != m_texturesRequested.end()) {
std::uint8_t* pbData = nullptr;
unsigned int dwTextureBytes = 0;
@ -1112,7 +1108,8 @@ void PlayerConnection::handleContainerSetSlot(
std::shared_ptr<ItemInstance> lastItem =
player->inventoryMenu->getSlot(packet->slot)->getItem();
if (packet->item != nullptr) {
if (lastItem == nullptr || lastItem->count < packet->item->count) {
if (lastItem == nullptr ||
lastItem->count < packet->item->count) {
packet->item->popTime = Inventory::POP_TIME_DURATION;
}
}
@ -1226,11 +1223,12 @@ void PlayerConnection::handleSetCreativeModeSlot(
bool validSlot = (packet->slotNum >= InventoryMenu::CRAFT_SLOT_START &&
packet->slotNum < (InventoryMenu::USE_ROW_SLOT_START +
Inventory::getSelectionSize()));
bool validItem =
item == nullptr || (item->id < Item::items.length && item->id >= 0 &&
Item::items[item->id] != nullptr);
bool validData = item == nullptr || (item->getAuxValue() >= 0 &&
item->count > 0 && item->count <= 64);
bool validItem = item == nullptr ||
(item->id < Item::items.length && item->id >= 0 &&
Item::items[item->id] != nullptr);
bool validData =
item == nullptr ||
(item->getAuxValue() >= 0 && item->count > 0 && item->count <= 64);
if (validSlot && validItem && validData) {
if (item == nullptr) {
@ -1795,8 +1793,10 @@ void PlayerConnection::handleTradeItem(
int buyAMatches = player->inventory->countMatches(buyAItem);
int buyBMatches = player->inventory->countMatches(buyBItem);
if ((buyAItem != nullptr && buyAMatches >= buyAItem->count) &&
(buyBItem == nullptr || buyBMatches >= buyBItem->count)) {
if ((buyAItem != nullptr &&
buyAMatches >= buyAItem->count) &&
(buyBItem == nullptr ||
buyBMatches >= buyBItem->count)) {
menu->getMerchant()->notifyTrade(activeRecipe);
// Remove the items we are purchasing with

View file

@ -83,7 +83,6 @@ void PlayerList::placeNewPlayer(Connection* connection,
player->setPlayerGamePrivilege(Player::ePlayerGamePrivilege_HOST, 1);
}
// 4J Stu - TU-1 hotfix
// Fix for #13150 - When a player loads/joins a game after saving/leaving in
// the nether, sometimes they are spawned on top of the nether and cannot
@ -268,8 +267,7 @@ void PlayerList::placeNewPlayer(Connection* connection,
level->getGameRules()->getBoolean(GameRules::RULE_DAYLIGHT))));
auto activeEffects = player->getActiveEffects();
for (auto it = activeEffects->begin(); it != activeEffects->end();
++it) {
for (auto it = activeEffects->begin(); it != activeEffects->end(); ++it) {
MobEffectInstance* effect = *it;
playerConnection->send(std::shared_ptr<UpdateMobEffectPacket>(
new UpdateMobEffectPacket(player->entityId, effect)));
@ -602,7 +600,8 @@ std::shared_ptr<ServerPlayer> PlayerList::respawn(
if (ep->dimension != oldDimension) continue;
INetworkPlayer* otherPlayer = ep->connection->getNetworkPlayer();
if (otherPlayer != nullptr && thisPlayer->IsSameSystem(otherPlayer)) {
if (otherPlayer != nullptr &&
thisPlayer->IsSameSystem(otherPlayer)) {
// There's another player here in the same dimension - we're not
// the last one out
isEmptying = false;
@ -614,9 +613,9 @@ std::shared_ptr<ServerPlayer> PlayerList::respawn(
// (1) if this isn't the primary player, then we just need to remove it from
// the entity tracker (2) if this Is the primary player then:
// (a) if isEmptying is true, then remove the player from the
//tracker, and send "remove entity" packets for anything seen (this is the
//original behaviour of the code) (b) if isEmptying is false, then we'll be
//transferring control of entity tracking to another player
// tracker, and send "remove entity" packets for anything seen (this is the
// original behaviour of the code) (b) if isEmptying is false, then
// we'll be transferring control of entity tracking to another player
if (isPrimary) {
if (isEmptying) {
@ -893,8 +892,7 @@ void PlayerList::toggleDimension(std::shared_ptr<ServerPlayer> player,
// 4J Stu - Fix for #64683 - Customer Encountered: TU7: Content: Gameplay:
// Potion effects are removed after using the Nether Portal
std::vector<MobEffectInstance*>* activeEffects = player->getActiveEffects();
for (auto it = activeEffects->begin(); it != activeEffects->end();
++it) {
for (auto it = activeEffects->begin(); it != activeEffects->end(); ++it) {
MobEffectInstance* effect = *it;
player->connection->send(std::shared_ptr<UpdateMobEffectPacket>(
@ -1130,9 +1128,9 @@ bool PlayerList::isOp(std::shared_ptr<ServerPlayer> player) {
cheatsEnabled = cheatsEnabled || app.GetUseDPadForDebug();
#endif
INetworkPlayer* networkPlayer = player->connection->getNetworkPlayer();
bool isOp =
cheatsEnabled && (player->isModerator() ||
(networkPlayer != nullptr && networkPlayer->IsHost()));
bool isOp = cheatsEnabled &&
(player->isModerator() ||
(networkPlayer != nullptr && networkPlayer->IsHost()));
return isOp;
}
@ -1345,8 +1343,8 @@ void PlayerList::saveAll(ProgressListener* progressListener,
bool bDeleteGuestMaps /*= false*/) {
if (progressListener != nullptr)
progressListener->progressStart(IDS_PROGRESS_SAVING_PLAYERS);
// 4J - playerIo can be nullptr if we have have to exit a game really early on
// due to network failure
// 4J - playerIo can be nullptr if we have have to exit a game really early
// on due to network failure
if (playerIo) {
playerIo->saveAllCachedData();
for (unsigned int i = 0; i < players.size(); i++) {
@ -1489,7 +1487,7 @@ void PlayerList::removePlayerFromReceiving(std::shared_ptr<ServerPlayer> player,
bool playerRemoved = false;
auto it = find(receiveAllPlayers[dimIndex].begin(),
receiveAllPlayers[dimIndex].end(), player);
receiveAllPlayers[dimIndex].end(), player);
if (it != receiveAllPlayers[dimIndex].end()) {
#if !defined(_CONTENT_PACKAGE)
app.DebugPrintf(
@ -1509,7 +1507,8 @@ void PlayerList::removePlayerFromReceiving(std::shared_ptr<ServerPlayer> player,
newPlayer->connection->getNetworkPlayer();
if (newPlayer != player && newPlayer->dimension == playerDim &&
otherPlayer != nullptr && otherPlayer->IsSameSystem(thisPlayer)) {
otherPlayer != nullptr &&
otherPlayer->IsSameSystem(thisPlayer)) {
#if !defined(_CONTENT_PACKAGE)
app.DebugPrintf(
"Remove: Adding player %ls as primary in dimension %d\n",
@ -1522,7 +1521,8 @@ void PlayerList::removePlayerFromReceiving(std::shared_ptr<ServerPlayer> player,
} else if (thisPlayer == nullptr) {
#if !defined(_CONTENT_PACKAGE)
app.DebugPrintf(
"Remove: Qnet player for %ls was nullptr so re-checking all players\n",
"Remove: Qnet player for %ls was nullptr so re-checking all "
"players\n",
player->name.c_str());
#endif
// 4J Stu - Something went wrong, or possibly the QNet player left

View file

@ -46,7 +46,7 @@ ServerChunkCache::ServerChunkCache(ServerLevel* level, ChunkStorage* storage,
ServerChunkCache::~ServerChunkCache() {
storage->WaitForAll(); // MGH - added to fix crash bug 175183
delete emptyChunk;
delete[] cache; // 4jcraft changed to delete[]
delete[] cache; // 4jcraft changed to delete[]
delete source;
#if defined(_LARGE_WORLDS)
@ -166,8 +166,8 @@ LevelChunk* ServerChunkCache::create(
(int64_t*)&cache[idx], (int64_t)chunk, (int64_t)lastChunk) ==
(int64_t)lastChunk)
#else
if (InterlockedCompareExchangeRelease((int32_t*)&cache[idx], (int32_t)chunk,
(int32_t)lastChunk) ==
if (InterlockedCompareExchangeRelease(
(int32_t*)&cache[idx], (int32_t)chunk, (int32_t)lastChunk) ==
(int32_t)lastChunk)
#endif
{
@ -715,8 +715,8 @@ bool ServerChunkCache::save(bool force, ProgressListener* progressListener) {
}
}
} else {
// 4J Stu - We have multiple for threads for all saving as part of the
// storage, so use that rather than new threads here
// 4J Stu - We have multiple for threads for all saving as part of the
// storage, so use that rather than new threads here
// Created a roughly sorted list to match the order that the files were
// created in McRegionChunkStorage::McRegionChunkStorage. This is to
@ -814,7 +814,7 @@ bool ServerChunkCache::tick() {
// loadedChunks.remove(cp);
// loadedChunkList.remove(chunk);
auto it = find(m_loadedChunkList.begin(),
m_loadedChunkList.end(), chunk);
m_loadedChunkList.end(), chunk);
if (it != m_loadedChunkList.end())
m_loadedChunkList.erase(it);

View file

@ -57,8 +57,8 @@ void ServerCommandDispatcher::logAdminCommand(
int customData, const std::wstring& additionalMessage) {
PlayerList* playerList = MinecraftServer::getInstance()->getPlayers();
// for (Player player : MinecraftServer.getInstance().getPlayers().players)
for (auto it = playerList->players.begin();
it != playerList->players.end(); ++it) {
for (auto it = playerList->players.begin(); it != playerList->players.end();
++it) {
std::shared_ptr<ServerPlayer> player = *it;
if (player != source && playerList->isOp(player)) {
// TODO: Change chat packet to be able to send more bits of data

View file

@ -103,7 +103,7 @@ void ServerConnection::tick() {
bool ServerConnection::addPendingTextureRequest(
const std::wstring& textureName) {
auto it = find(m_pendingTextureRequests.begin(),
m_pendingTextureRequests.end(), textureName);
m_pendingTextureRequests.end(), textureName);
if (it == m_pendingTextureRequests.end()) {
m_pendingTextureRequests.push_back(textureName);
return true;
@ -120,7 +120,7 @@ bool ServerConnection::addPendingTextureRequest(
void ServerConnection::handleTextureReceived(const std::wstring& textureName) {
auto it = find(m_pendingTextureRequests.begin(),
m_pendingTextureRequests.end(), textureName);
m_pendingTextureRequests.end(), textureName);
if (it != m_pendingTextureRequests.end()) {
m_pendingTextureRequests.erase(it);
}
@ -135,7 +135,7 @@ void ServerConnection::handleTextureReceived(const std::wstring& textureName) {
void ServerConnection::handleTextureAndGeometryReceived(
const std::wstring& textureName) {
auto it = find(m_pendingTextureRequests.begin(),
m_pendingTextureRequests.end(), textureName);
m_pendingTextureRequests.end(), textureName);
if (it != m_pendingTextureRequests.end()) {
m_pendingTextureRequests.erase(it);
}

View file

@ -658,8 +658,6 @@ enum EControllerActions {
ACTION_MENU_OTHER_STICK_RIGHT,
ACTION_MENU_PAUSEMENU,
ACTION_MENU_OK,
ACTION_MENU_CANCEL,
// 4jcraft added, off by one

View file

@ -87,5 +87,3 @@ private:
bool m_bIsPlayingEndMusic;
bool m_bIsPlayingNetherMusic;
};

View file

@ -794,7 +794,6 @@ void SoundEngine::init(Options* pOptions) {
}
app.DebugPrintf("---SoundEngine::init - driver opened\n");
AIL_set_event_error_callback(ErrorCallback);
AIL_set_3D_rolloff_factor(m_hDriver, 1.0);
@ -853,14 +852,11 @@ void SoundEngine::init(Options* pOptions) {
m_bSystemMusicPlaying = false;
m_openStreamThread = nullptr;
}
// AP - moved to a separate function so it can be called from the mixer callback
// on Vita
void SoundEngine::updateMiles() {
if (m_validListenerCount == 1) {
for (int i = 0; i < MAX_LOCAL_PLAYERS; i++) {
// set the listener as the first player we find
@ -1093,13 +1089,11 @@ static float fVal = 0.0f;
//
/////////////////////////////////////////////
void SoundEngine::tick(std::shared_ptr<Mob>* players, float a) {
#if defined(__DISABLE_MILES__)
return;
#endif
// update the listener positions
int listenerCount = 0;
#if defined(DISTORTION_TEST)
@ -1175,7 +1169,6 @@ SoundEngine::SoundEngine() {
memset(CurrentSoundsPlaying, 0, sizeof(int) * (eSoundType_MAX + eSFX_MAX));
memset(m_ListenerA, 0, sizeof(AUDIO_LISTENER) * XUSER_MAX_COUNT);
}
void SoundEngine::destroy() {}
@ -1389,7 +1382,7 @@ int SoundEngine::OpenStreamThreadProc(void* lpParameter) {
//
/////////////////////////////////////////////
void SoundEngine::playMusicTick() {
// AP - vita will update the music during the mixer callback
// AP - vita will update the music during the mixer callback
playMusicUpdate();
}
@ -1487,7 +1480,6 @@ void SoundEngine::playMusicUpdate() {
}
strcat((char*)m_szStreamName, m_szStreamFileA[m_musicID]);
strcat((char*)m_szStreamName, ".binka");
}
// std::wstring name =

View file

@ -170,5 +170,4 @@ private:
int m_iStream_End_Min, m_iStream_End_Max;
int m_iStream_CD_1;
bool* m_bHeardTrackA;
};

View file

@ -3,64 +3,64 @@
#include "Consoles_SoundEngine.h"
const wchar_t* ConsoleSoundEngine::wchSoundNames[eSoundType_MAX] = {
L"mob/chicken/chicken", // eSoundType_MOB_CHICKEN_AMBIENT
L"mob/chicken/chickenhurt", // eSoundType_MOB_CHICKEN_HURT
L"mob/chicken/chickenplop", // eSoundType_MOB_CHICKENPLOP
L"mob/cow/say", // eSoundType_MOB_COW_AMBIENT
L"mob/cow/hurt", // eSoundType_MOB_COW_HURT
L"mob/pig/pig", // eSoundType_MOB_PIG_AMBIENT
L"mob/pig/pigdeath", // eSoundType_MOB_PIG_DEATH
L"mob/sheep/sheep", // eSoundType_MOB_SHEEP_AMBIENT
L"mob/wolf/growl", // eSoundType_MOB_WOLF_GROWL
L"mob/wolf/whine", // eSoundType_MOB_WOLF_WHINE
L"mob/wolf/panting", // eSoundType_MOB_WOLF_PANTING
L"mob/wolf/bark", // eSoundType_MOB_WOLF_BARK
L"mob/wolf/hurt", // eSoundType_MOB_WOLF_HURT
L"mob/wolf/death", // eSoundType_MOB_WOLF_DEATH
L"mob/wolf/shake", // eSoundType_MOB_WOLF_SHAKE
L"mob/blaze/breathe", // eSoundType_MOB_BLAZE_BREATHE
L"mob/blaze/hit", // eSoundType_MOB_BLAZE_HURT
L"mob/blaze/death", // eSoundType_MOB_BLAZE_DEATH
L"mob/ghast/moan", // eSoundType_MOB_GHAST_MOAN
L"mob/ghast/scream", // eSoundType_MOB_GHAST_SCREAM
L"mob/ghast/death", // eSoundType_MOB_GHAST_DEATH
L"mob/ghast/fireball", // eSoundType_MOB_GHAST_FIREBALL
L"mob/ghast/charge", // eSoundType_MOB_GHAST_CHARGE
L"mob/endermen/idle", // eSoundType_MOB_ENDERMEN_IDLE
L"mob/endermen/hit", // eSoundType_MOB_ENDERMEN_HIT
L"mob/endermen/death", // eSoundType_MOB_ENDERMEN_DEATH
L"mob/endermen/portal", // eSoundType_MOB_ENDERMEN_PORTAL
L"mob/zombiepig/zpig", // eSoundType_MOB_ZOMBIEPIG_AMBIENT
L"mob/zombiepig/zpighurt", // eSoundType_MOB_ZOMBIEPIG_HURT
L"mob/zombiepig/zpigdeath", // eSoundType_MOB_ZOMBIEPIG_DEATH
L"mob/zombiepig/zpigangry", // eSoundType_MOB_ZOMBIEPIG_ZPIGANGRY
L"mob/silverfish/say", // eSoundType_MOB_SILVERFISH_AMBIENT,
L"mob/silverfish/hit", // eSoundType_MOB_SILVERFISH_HURT
L"mob/silverfish/kill", // eSoundType_MOB_SILVERFISH_DEATH,
L"mob/silverfish/step", // eSoundType_MOB_SILVERFISH_STEP,
L"mob/skeleton/skeleton", // eSoundType_MOB_SKELETON_AMBIENT,
L"mob/skeleton/skeletonhurt", // eSoundType_MOB_SKELETON_HURT,
L"mob/spider/spider", // eSoundType_MOB_SPIDER_AMBIENT,
L"mob/spider/spiderdeath", // eSoundType_MOB_SPIDER_DEATH,
L"mob/slime/slime", // eSoundType_MOB_SLIME,
L"mob/slime/slimeattack", // eSoundType_MOB_SLIME_ATTACK,
L"mob/creeper/creeper", // eSoundType_MOB_CREEPER_HURT,
L"mob/creeper/creeperdeath", // eSoundType_MOB_CREEPER_DEATH,
L"mob/zombie/zombie", // eSoundType_MOB_ZOMBIE_AMBIENT,
L"mob/zombie/zombiehurt", // eSoundType_MOB_ZOMBIE_HURT,
L"mob/zombie/zombiedeath", // eSoundType_MOB_ZOMBIE_DEATH,
L"mob/zombie/wood", // eSoundType_MOB_ZOMBIE_WOOD,
L"mob/zombie/woodbreak", // eSoundType_MOB_ZOMBIE_WOOD_BREAK,
L"mob/zombie/metal", // eSoundType_MOB_ZOMBIE_METAL,
L"mob/magmacube/big", // eSoundType_MOB_MAGMACUBE_BIG,
L"mob/magmacube/small", // eSoundType_MOB_MAGMACUBE_SMALL,
L"mob/cat/purr", // eSoundType_MOB_CAT_PURR
L"mob/cat/purreow", // eSoundType_MOB_CAT_PURREOW
L"mob/cat/meow", // eSoundType_MOB_CAT_MEOW
L"mob/chicken/chicken", // eSoundType_MOB_CHICKEN_AMBIENT
L"mob/chicken/chickenhurt", // eSoundType_MOB_CHICKEN_HURT
L"mob/chicken/chickenplop", // eSoundType_MOB_CHICKENPLOP
L"mob/cow/say", // eSoundType_MOB_COW_AMBIENT
L"mob/cow/hurt", // eSoundType_MOB_COW_HURT
L"mob/pig/pig", // eSoundType_MOB_PIG_AMBIENT
L"mob/pig/pigdeath", // eSoundType_MOB_PIG_DEATH
L"mob/sheep/sheep", // eSoundType_MOB_SHEEP_AMBIENT
L"mob/wolf/growl", // eSoundType_MOB_WOLF_GROWL
L"mob/wolf/whine", // eSoundType_MOB_WOLF_WHINE
L"mob/wolf/panting", // eSoundType_MOB_WOLF_PANTING
L"mob/wolf/bark", // eSoundType_MOB_WOLF_BARK
L"mob/wolf/hurt", // eSoundType_MOB_WOLF_HURT
L"mob/wolf/death", // eSoundType_MOB_WOLF_DEATH
L"mob/wolf/shake", // eSoundType_MOB_WOLF_SHAKE
L"mob/blaze/breathe", // eSoundType_MOB_BLAZE_BREATHE
L"mob/blaze/hit", // eSoundType_MOB_BLAZE_HURT
L"mob/blaze/death", // eSoundType_MOB_BLAZE_DEATH
L"mob/ghast/moan", // eSoundType_MOB_GHAST_MOAN
L"mob/ghast/scream", // eSoundType_MOB_GHAST_SCREAM
L"mob/ghast/death", // eSoundType_MOB_GHAST_DEATH
L"mob/ghast/fireball", // eSoundType_MOB_GHAST_FIREBALL
L"mob/ghast/charge", // eSoundType_MOB_GHAST_CHARGE
L"mob/endermen/idle", // eSoundType_MOB_ENDERMEN_IDLE
L"mob/endermen/hit", // eSoundType_MOB_ENDERMEN_HIT
L"mob/endermen/death", // eSoundType_MOB_ENDERMEN_DEATH
L"mob/endermen/portal", // eSoundType_MOB_ENDERMEN_PORTAL
L"mob/zombiepig/zpig", // eSoundType_MOB_ZOMBIEPIG_AMBIENT
L"mob/zombiepig/zpighurt", // eSoundType_MOB_ZOMBIEPIG_HURT
L"mob/zombiepig/zpigdeath", // eSoundType_MOB_ZOMBIEPIG_DEATH
L"mob/zombiepig/zpigangry", // eSoundType_MOB_ZOMBIEPIG_ZPIGANGRY
L"mob/silverfish/say", // eSoundType_MOB_SILVERFISH_AMBIENT,
L"mob/silverfish/hit", // eSoundType_MOB_SILVERFISH_HURT
L"mob/silverfish/kill", // eSoundType_MOB_SILVERFISH_DEATH,
L"mob/silverfish/step", // eSoundType_MOB_SILVERFISH_STEP,
L"mob/skeleton/skeleton", // eSoundType_MOB_SKELETON_AMBIENT,
L"mob/skeleton/skeletonhurt", // eSoundType_MOB_SKELETON_HURT,
L"mob/spider/spider", // eSoundType_MOB_SPIDER_AMBIENT,
L"mob/spider/spiderdeath", // eSoundType_MOB_SPIDER_DEATH,
L"mob/slime/slime", // eSoundType_MOB_SLIME,
L"mob/slime/slimeattack", // eSoundType_MOB_SLIME_ATTACK,
L"mob/creeper/creeper", // eSoundType_MOB_CREEPER_HURT,
L"mob/creeper/creeperdeath", // eSoundType_MOB_CREEPER_DEATH,
L"mob/zombie/zombie", // eSoundType_MOB_ZOMBIE_AMBIENT,
L"mob/zombie/zombiehurt", // eSoundType_MOB_ZOMBIE_HURT,
L"mob/zombie/zombiedeath", // eSoundType_MOB_ZOMBIE_DEATH,
L"mob/zombie/wood", // eSoundType_MOB_ZOMBIE_WOOD,
L"mob/zombie/woodbreak", // eSoundType_MOB_ZOMBIE_WOOD_BREAK,
L"mob/zombie/metal", // eSoundType_MOB_ZOMBIE_METAL,
L"mob/magmacube/big", // eSoundType_MOB_MAGMACUBE_BIG,
L"mob/magmacube/small", // eSoundType_MOB_MAGMACUBE_SMALL,
L"mob/cat/purr", // eSoundType_MOB_CAT_PURR
L"mob/cat/purreow", // eSoundType_MOB_CAT_PURREOW
L"mob/cat/meow", // eSoundType_MOB_CAT_MEOW
// 4J-PB - correct the name of the event for hitting ocelots
L"mob/cat/hitt", // eSoundType_MOB_CAT_HITT
// L"mob.irongolem.throw", //
//eSoundType_MOB_IRONGOLEM_THROW L"mob.irongolem.hit",
// L"mob.irongolem.throw", //
// eSoundType_MOB_IRONGOLEM_THROW L"mob.irongolem.hit",
//// eSoundType_MOB_IRONGOLEM_HIT L"mob.irongolem.death",
//// eSoundType_MOB_IRONGOLEM_DEATH L"mob.irongolem.walk",
//// eSoundType_MOB_IRONGOLEM_WALK
@ -85,14 +85,14 @@ const wchar_t* ConsoleSoundEngine::wchSoundNames[eSoundType_MAX] = {
L"ambient/weather/rain", // eSoundType_AMBIENT_WEATHER_RAIN,
L"ambient/weather/thunder", // eSoundType_AMBIENT_WEATHER_THUNDER,
L"ambient/cave/cave", // eSoundType_CAVE_CAVE, DON'T USE FOR XBOX 360!!!
L"portal/portal", // eSoundType_PORTAL_PORTAL,
L"portal/portal", // eSoundType_PORTAL_PORTAL,
// 4J-PB - added a couple that were still using std::wstring
L"portal/trigger", // eSoundType_PORTAL_TRIGGER
L"portal/travel", // eSoundType_PORTAL_TRAVEL
L"fire/ignite", // eSoundType_FIRE_IGNITE,
L"fire/fire", // eSoundType_FIRE_FIRE,
L"damage/hit", // eSoundType_DAMAGE_HURT,
L"damage/hit", // eSoundType_DAMAGE_HURT,
L"damage/fallsmall", // eSoundType_DAMAGE_FALL_SMALL,
L"damage/fallbig", // eSoundType_DAMAGE_FALL_BIG,
L"note/harp", // eSoundType_NOTE_HARP,

View file

@ -1,34 +1,38 @@
#pragma once
#define VER_PRODUCTMAJORVERSION 0
#define VER_PRODUCTMINORVERSION 0
#define VER_PRODUCTMAJORVERSION 0
#define VER_PRODUCTMINORVERSION 0
// This goes up with each build
// 4J-JEV: This value is extracted with a regex so it can be placed as the version in the AppX manifest on Durango.
#define VER_PRODUCTBUILD 560
// 4J-JEV: This value is extracted with a regex so it can be placed as the
// version in the AppX manifest on Durango.
#define VER_PRODUCTBUILD 560
// This goes up if there is any change to network traffic or code in a build
#define VER_NETWORK 560
#define VER_PRODUCTBUILD_QFE 0
#define VER_NETWORK 560
#define VER_PRODUCTBUILD_QFE 0
#define VER_FILEVERSION_STRING "1.6"
#define VER_PRODUCTVERSION_STRING VER_FILEVERSION_STRING
#define VER_FILEVERSION_STRING_W L"1.6"
#define VER_PRODUCTVERSION_STRING_W VER_FILEVERSION_STRING_W
#define VER_FILEBETA_STR ""
#define VER_FILEVERSION_STRING "1.6"
#define VER_PRODUCTVERSION_STRING VER_FILEVERSION_STRING
#define VER_FILEVERSION_STRING_W L"1.6"
#define VER_PRODUCTVERSION_STRING_W VER_FILEVERSION_STRING_W
#define VER_FILEBETA_STR ""
#undef VER_FILEVERSION
#define VER_FILEVERSION VER_PRODUCTMAJORVERSION, VER_PRODUCTMINORVERSION, VER_PRODUCTBUILD, VER_PRODUCTBUILD_QFE
#define VER_PRODUCTVERSION VER_PRODUCTMAJORVERSION, VER_PRODUCTMINORVERSION, VER_PRODUCTBUILD, VER_PRODUCTBUILD_QFE
#define VER_FILEVERSION \
VER_PRODUCTMAJORVERSION, VER_PRODUCTMINORVERSION, VER_PRODUCTBUILD, \
VER_PRODUCTBUILD_QFE
#define VER_PRODUCTVERSION \
VER_PRODUCTMAJORVERSION, VER_PRODUCTMINORVERSION, VER_PRODUCTBUILD, \
VER_PRODUCTBUILD_QFE
#if (VER_PRODUCTBUILD < 10)
#define VER_FILEBPAD "000"
#if (VER_PRODUCTBUILD < 10)
#define VER_FILEBPAD "000"
#define VER_FILEBPAD_W L"000"
#elif (VER_PRODUCTBUILD < 100)
#define VER_FILEBPAD "00"
#elif (VER_PRODUCTBUILD < 100)
#define VER_FILEBPAD "00"
#define VER_FILEBPAD_W L"00"
#elif (VER_PRODUCTBUILD < 1000)
#define VER_FILEBPAD "0"
#elif (VER_PRODUCTBUILD < 1000)
#define VER_FILEBPAD "0"
#define VER_FILEBPAD_W L"0"
#else
#define VER_FILEBPAD
@ -37,21 +41,25 @@
#define VER_WIDE_PREFIX(x) L##x
#define VER_FILEVERSION_STR2(x,y) VER_FILEVERSION_STRING "." VER_FILEBPAD #x "." #y
#define VER_FILEVERSION_STR2_W(x,y) VER_FILEVERSION_STRING_W L"." VER_FILEBPAD_W VER_WIDE_PREFIX(#x) L"." VER_WIDE_PREFIX(#y)
#define VER_FILEVERSION_STR1(x,y) VER_FILEVERSION_STR2(x, y)
#define VER_FILEVERSION_STR1_W(x,y) VER_FILEVERSION_STR2_W(x, y)
#define VER_FILEVERSION_STR2(x, y) \
VER_FILEVERSION_STRING "." VER_FILEBPAD #x "." #y
#define VER_FILEVERSION_STR2_W(x, y) \
VER_FILEVERSION_STRING_W L"." VER_FILEBPAD_W VER_WIDE_PREFIX( \
#x) L"." VER_WIDE_PREFIX(#y)
#define VER_FILEVERSION_STR1(x, y) VER_FILEVERSION_STR2(x, y)
#define VER_FILEVERSION_STR1_W(x, y) VER_FILEVERSION_STR2_W(x, y)
#undef VER_FILEVERSION_STR
#define VER_FILEVERSION_STR VER_FILEVERSION_STR1(VER_PRODUCTBUILD, VER_PRODUCTBUILD_QFE)
#define VER_PRODUCTVERSION_STR VER_FILEVERSION_STR1(VER_PRODUCTBUILD, VER_PRODUCTBUILD_QFE)
#define VER_FILEVERSION_STR \
VER_FILEVERSION_STR1(VER_PRODUCTBUILD, VER_PRODUCTBUILD_QFE)
#define VER_PRODUCTVERSION_STR \
VER_FILEVERSION_STR1(VER_PRODUCTBUILD, VER_PRODUCTBUILD_QFE)
#define VER_FILEVERSION_STR_W VER_FILEVERSION_STR1_W(VER_PRODUCTBUILD, VER_PRODUCTBUILD_QFE)
#define VER_PRODUCTVERSION_STR_W VER_FILEVERSION_STR1_W(VER_PRODUCTBUILD, VER_PRODUCTBUILD_QFE)
#define VER_FILEVERSION_STR_W \
VER_FILEVERSION_STR1_W(VER_PRODUCTBUILD, VER_PRODUCTBUILD_QFE)
#define VER_PRODUCTVERSION_STR_W \
VER_FILEVERSION_STR1_W(VER_PRODUCTBUILD, VER_PRODUCTBUILD_QFE)
#if (VER_PRODUCTBUILD_QFE >= 256)
#error "QFE number cannot exceed 255"
#if (VER_PRODUCTBUILD_QFE >= 256)
#error "QFE number cannot exceed 255"
#endif

View file

@ -1,176 +1,147 @@
#pragma once
#include <stdlib.h>
class C4JMemoryPool
{
class C4JMemoryPool {
public:
unsigned int Align(unsigned int val, unsigned int align) { return int((val+(align-1))/align) * align; }
virtual void* Alloc(size_t size) = 0;
virtual void Free(void* ptr) = 0;
unsigned int Align(unsigned int val, unsigned int align) {
return int((val + (align - 1)) / align) * align;
}
virtual void* Alloc(size_t size) = 0;
virtual void Free(void* ptr) = 0;
};
// Fast Efficient Fixed-Size Memory Pool : No Loops and No Overhead
// http://www.alogicalmind.com/memory_pools/index.htm
class C4JMemoryPoolFixed : public C4JMemoryPool
{
// Basic type define
typedef unsigned int uint;
typedef unsigned char uchar;
uint m_numOfBlocks; // Num of blocks
uint m_sizeOfEachBlock; // Size of each block
uint m_numFreeBlocks; // Num of remaining blocks
uint m_numInitialized; // Num of initialized blocks
uchar* m_memStart; // Beginning of memory pool
uchar* m_memEnd; // End of memory pool
uchar* m_next; // Num of next free block
// CRITICAL_SECTION m_CS;
class C4JMemoryPoolFixed : public C4JMemoryPool {
// Basic type define
typedef unsigned int uint;
typedef unsigned char uchar;
uint m_numOfBlocks; // Num of blocks
uint m_sizeOfEachBlock; // Size of each block
uint m_numFreeBlocks; // Num of remaining blocks
uint m_numInitialized; // Num of initialized blocks
uchar* m_memStart; // Beginning of memory pool
uchar* m_memEnd; // End of memory pool
uchar* m_next; // Num of next free block
// CRITICAL_SECTION m_CS;
public:
C4JMemoryPoolFixed()
{
m_numOfBlocks = 0;
m_sizeOfEachBlock = 0;
m_numFreeBlocks = 0;
m_numInitialized = 0;
m_memStart = nullptr;
m_memEnd = nullptr;
m_next = 0;
}
C4JMemoryPoolFixed() {
m_numOfBlocks = 0;
m_sizeOfEachBlock = 0;
m_numFreeBlocks = 0;
m_numInitialized = 0;
m_memStart = nullptr;
m_memEnd = nullptr;
m_next = 0;
}
C4JMemoryPoolFixed(uint sizeOfEachBlock, uint numOfBlocks)
{
CreatePool(sizeOfEachBlock, numOfBlocks);
}
C4JMemoryPoolFixed(uint sizeOfEachBlock, uint numOfBlocks) {
CreatePool(sizeOfEachBlock, numOfBlocks);
}
~C4JMemoryPoolFixed() { DestroyPool(); }
~C4JMemoryPoolFixed() { DestroyPool(); }
void CreatePool(uint sizeOfEachBlock, uint numOfBlocks)
{
assert(sizeOfEachBlock >= 4); // has to be at least the size of an int, for book keeping
m_numOfBlocks = numOfBlocks;
m_sizeOfEachBlock = sizeOfEachBlock;
m_numFreeBlocks = numOfBlocks;
m_numInitialized = 0;
m_memStart = new uchar[ m_sizeOfEachBlock *
m_numOfBlocks ];
m_memEnd = m_memStart + (m_sizeOfEachBlock * m_numOfBlocks);
m_next = m_memStart;
// InitializeCriticalSection(&m_CS);
}
void CreatePool(uint sizeOfEachBlock, uint numOfBlocks) {
assert(sizeOfEachBlock >=
4); // has to be at least the size of an int, for book keeping
m_numOfBlocks = numOfBlocks;
m_sizeOfEachBlock = sizeOfEachBlock;
m_numFreeBlocks = numOfBlocks;
m_numInitialized = 0;
m_memStart = new uchar[m_sizeOfEachBlock * m_numOfBlocks];
m_memEnd = m_memStart + (m_sizeOfEachBlock * m_numOfBlocks);
m_next = m_memStart;
// InitializeCriticalSection(&m_CS);
}
void DestroyPool()
{
delete[] m_memStart;
m_memStart = nullptr;
}
void DestroyPool() {
delete[] m_memStart;
m_memStart = nullptr;
}
uchar* AddrFromIndex(uint i) const
{
return m_memStart + ( i * m_sizeOfEachBlock );
}
uchar* AddrFromIndex(uint i) const {
return m_memStart + (i * m_sizeOfEachBlock);
}
uint IndexFromAddr(const uchar* p) const
{
return (((uint)(p - m_memStart)) / m_sizeOfEachBlock);
}
uint IndexFromAddr(const uchar* p) const {
return (((uint)(p - m_memStart)) / m_sizeOfEachBlock);
}
virtual void* Alloc(size_t size)
{
if(size > m_sizeOfEachBlock)
return ::malloc(size);
// EnterCriticalSection(&m_CS);
if (m_numInitialized < m_numOfBlocks )
{
uint* p = (uint*)AddrFromIndex( m_numInitialized );
*p = m_numInitialized + 1;
m_numInitialized++;
}
void* ret = nullptr;
if ( m_numFreeBlocks > 0 )
{
ret = (void*)m_next;
--m_numFreeBlocks;
if (m_numFreeBlocks!=0)
{
m_next = AddrFromIndex( *((uint*)m_next) );
}
else
{
m_next = nullptr;
}
}
// LeaveCriticalSection(&m_CS);
return ret;
}
virtual void* Alloc(size_t size) {
if (size > m_sizeOfEachBlock) return ::malloc(size);
// EnterCriticalSection(&m_CS);
if (m_numInitialized < m_numOfBlocks) {
uint* p = (uint*)AddrFromIndex(m_numInitialized);
*p = m_numInitialized + 1;
m_numInitialized++;
}
void* ret = nullptr;
if (m_numFreeBlocks > 0) {
ret = (void*)m_next;
--m_numFreeBlocks;
if (m_numFreeBlocks != 0) {
m_next = AddrFromIndex(*((uint*)m_next));
} else {
m_next = nullptr;
}
}
// LeaveCriticalSection(&m_CS);
return ret;
}
virtual void Free(void* ptr)
{
if(ptr < m_memStart || ptr > m_memEnd)
{
::free(ptr);
return;
}
// EnterCriticalSection(&m_CS);
if (m_next != nullptr)
{
(*(uint*)ptr) = IndexFromAddr( m_next );
m_next = (uchar*)ptr;
}
else
{
*((uint*)ptr) = m_numOfBlocks;
m_next = (uchar*)ptr;
}
++m_numFreeBlocks;
// LeaveCriticalSection(&m_CS);
}
}; // End pool class
virtual void Free(void* ptr) {
if (ptr < m_memStart || ptr > m_memEnd) {
::free(ptr);
return;
}
// EnterCriticalSection(&m_CS);
if (m_next != nullptr) {
(*(uint*)ptr) = IndexFromAddr(m_next);
m_next = (uchar*)ptr;
} else {
*((uint*)ptr) = m_numOfBlocks;
m_next = (uchar*)ptr;
}
++m_numFreeBlocks;
// LeaveCriticalSection(&m_CS);
}
}; // End pool class
// this pool will constantly grow until it is reset (automatically when all allocs have been "freed")
class C4JMemoryPoolGrow : public C4JMemoryPool
{
uint32_t m_totalSize;
uint32_t m_memUsed;
uint32_t m_numAllocations;
uint8_t* m_pMemory;
uint32_t m_currentOffset;
// this pool will constantly grow until it is reset (automatically when all
// allocs have been "freed")
class C4JMemoryPoolGrow : public C4JMemoryPool {
uint32_t m_totalSize;
uint32_t m_memUsed;
uint32_t m_numAllocations;
uint8_t* m_pMemory;
uint32_t m_currentOffset;
public:
C4JMemoryPoolGrow(uint32_t size = 64*1024)
{
size = Align(size, 4);
m_totalSize = size;
m_pMemory = new uint8_t[size];
m_currentOffset = 0;
m_memUsed = 0;
m_numAllocations = 0;
}
C4JMemoryPoolGrow(uint32_t size = 64 * 1024) {
size = Align(size, 4);
m_totalSize = size;
m_pMemory = new uint8_t[size];
m_currentOffset = 0;
m_memUsed = 0;
m_numAllocations = 0;
}
virtual void* Alloc(size_t size)
{
size = Align(size, 4); // 4 byte align the memory
assert((m_currentOffset + size) < m_totalSize); // make sure we haven't ran out of space
void* returnMem = &m_pMemory[m_currentOffset]; // grab the return memory
m_currentOffset += size;
m_numAllocations++;
return returnMem;
}
virtual void Free(void* ptr)
{
m_numAllocations--;
if(m_numAllocations == 0)
m_currentOffset = 0; // reset the pool when we reach zero allocations
}
virtual void* Alloc(size_t size) {
size = Align(size, 4); // 4 byte align the memory
assert((m_currentOffset + size) <
m_totalSize); // make sure we haven't ran out of space
void* returnMem =
&m_pMemory[m_currentOffset]; // grab the return memory
m_currentOffset += size;
m_numAllocations++;
return returnMem;
}
virtual void Free(void* ptr) {
m_numAllocations--;
if (m_numAllocations == 0)
m_currentOffset =
0; // reset the pool when we reach zero allocations
}
};

View file

@ -1,113 +1,87 @@
#pragma once
#include "C4JMemoryPool.h"
#include "C4JMemoryPool.h"
// Custom allocator, takes a C4JMemoryPool class, which can be one of a number of pool implementations.
// Custom allocator, takes a C4JMemoryPool class, which can be one of a number
// of pool implementations.
template <class T>
class C4JPoolAllocator
{
class C4JPoolAllocator {
public:
typedef T value_type;
typedef size_t size_type;
typedef ptrdiff_t difference_type;
typedef T* pointer;
typedef const T* const_pointer;
typedef T& reference;
typedef const T& const_reference;
//! A struct to construct an allocator for a different type.
template<typename U>
struct rebind { typedef C4JPoolAllocator<U> other; };
typedef T value_type;
typedef size_t size_type;
typedef ptrdiff_t difference_type;
typedef T* pointer;
typedef const T* const_pointer;
C4JMemoryPool* m_pPool;
bool m_selfAllocated;
typedef T& reference;
typedef const T& const_reference;
C4JPoolAllocator( C4JMemoryPool* pool = new C4JMemoryPoolFixed(32, 4096 )) : m_pPool( pool ), m_selfAllocated(true)
{
printf("allocated mempool\n");
}
//! A struct to construct an allocator for a different type.
template <typename U>
struct rebind {
typedef C4JPoolAllocator<U> other;
};
template<typename U>
C4JPoolAllocator(C4JPoolAllocator<U> const& obj) : m_pPool( obj.m_pPool ), m_selfAllocated(false) // copy constructor
{
printf("C4JPoolAllocator constructed from 0x%08x\n", &obj);
assert(obj.m_pPool);
C4JMemoryPool* m_pPool;
bool m_selfAllocated;
C4JPoolAllocator(C4JMemoryPool* pool = new C4JMemoryPoolFixed(32, 4096))
: m_pPool(pool), m_selfAllocated(true) {
printf("allocated mempool\n");
}
template <typename U>
C4JPoolAllocator(C4JPoolAllocator<U> const& obj)
: m_pPool(obj.m_pPool),
m_selfAllocated(false) // copy constructor
{
printf("C4JPoolAllocator constructed from 0x%08x\n", &obj);
assert(obj.m_pPool);
}
private:
public:
~C4JPoolAllocator()
{
if(m_selfAllocated)
delete m_pPool;
~C4JPoolAllocator() {
if (m_selfAllocated) delete m_pPool;
}
pointer address( reference r ) const { return &r; }
const_pointer address( const_reference r ) const { return &r; }
pointer allocate( size_type n, const void* /*hint*/=0 )
{
assert(m_pPool);
pointer address(reference r) const { return &r; }
const_pointer address(const_reference r) const { return &r; }
pointer allocate(size_type n, const void* /*hint*/ = 0) {
assert(m_pPool);
return (pointer)m_pPool->Alloc(n * sizeof(T));
}
void deallocate( pointer p, size_type /*n*/ )
{
assert(m_pPool);
m_pPool->Free(p);
void deallocate(pointer p, size_type /*n*/) {
assert(m_pPool);
m_pPool->Free(p);
}
void construct( pointer p, const T& val )
{
new (p) T(val);
}
void destroy( pointer p )
{
p->~T();
}
size_type max_size() const
{
return ULONG_MAX / sizeof(T);
}
void construct(pointer p, const T& val) { new (p) T(val); }
void destroy(pointer p) { p->~T(); }
size_type max_size() const { return ULONG_MAX / sizeof(T); }
};
template <class T>
bool
operator==( const C4JPoolAllocator<T>& left, const C4JPoolAllocator<T>& right )
{
if (left.m_pPool == right.m_pPool)
{
bool operator==(const C4JPoolAllocator<T>& left,
const C4JPoolAllocator<T>& right) {
if (left.m_pPool == right.m_pPool) {
return true;
}
return false;
}
template <class T>
bool
operator!=( const C4JPoolAllocator<T>& left, const C4JPoolAllocator<T>& right)
{
if (left.m_pPool != right.m_pPool)
{
return true;
}
return false;
}
template <class T>
bool operator!=(const C4JPoolAllocator<T>& left,
const C4JPoolAllocator<T>& right) {
if (left.m_pPool != right.m_pPool) {
return true;
}
return false;
}

View file

@ -1,24 +1,24 @@
#pragma once
#include <cstdint>
class ColourTable
{
class ColourTable {
private:
unsigned int m_colourValues[eMinecraftColour_COUNT];
unsigned int m_colourValues[eMinecraftColour_COUNT];
static const wchar_t *ColourTableElements[eMinecraftColour_COUNT];
static std::unordered_map<std::wstring,eMinecraftColour> s_colourNamesMap;
static const wchar_t* ColourTableElements[eMinecraftColour_COUNT];
static std::unordered_map<std::wstring, eMinecraftColour> s_colourNamesMap;
public:
static void staticCtor();
static void staticCtor();
ColourTable(std::uint8_t *pbData, std::uint32_t dataLength);
ColourTable(ColourTable *defaultColours, std::uint8_t *pbData, std::uint32_t dataLength);
ColourTable(std::uint8_t* pbData, std::uint32_t dataLength);
ColourTable(ColourTable* defaultColours, std::uint8_t* pbData,
std::uint32_t dataLength);
unsigned int getColour(eMinecraftColour id);
unsigned int getColor(eMinecraftColour id) { return getColour(id); }
unsigned int getColour(eMinecraftColour id);
unsigned int getColor(eMinecraftColour id) { return getColour(id); }
void loadColoursFromData(std::uint8_t *pbData, std::uint32_t dataLength);
void setColour(const std::wstring &colourName, int value);
void setColour(const std::wstring &colourName, const std::wstring &value);
void loadColoursFromData(std::uint8_t* pbData, std::uint32_t dataLength);
void setColour(const std::wstring& colourName, int value);
void setColour(const std::wstring& colourName, const std::wstring& value);
};

View file

@ -2,8 +2,8 @@
#include "ConsoleGameMode.h"
#include "Tutorial/Tutorial.h"
ConsoleGameMode::ConsoleGameMode(int iPad, Minecraft *minecraft, ClientConnection *connection)
: TutorialMode(iPad, minecraft, connection)
{
tutorial = new Tutorial(iPad);
ConsoleGameMode::ConsoleGameMode(int iPad, Minecraft* minecraft,
ClientConnection* connection)
: TutorialMode(iPad, minecraft, connection) {
tutorial = new Tutorial(iPad);
}

View file

@ -1,10 +1,10 @@
#pragma once
#include "Tutorial/TutorialMode.h"
class ConsoleGameMode : public TutorialMode
{
public:
ConsoleGameMode(int iPad, Minecraft *minecraft, ClientConnection *connection);
class ConsoleGameMode : public TutorialMode {
public:
ConsoleGameMode(int iPad, Minecraft* minecraft,
ClientConnection* connection);
virtual bool isImplemented() { return true; }
virtual bool isImplemented() { return true; }
};

View file

@ -1,70 +1,69 @@
#pragma once
enum eAward
{
eAward_TakingInventory=0,
eAward_GettingWood,
eAward_Benchmarking,
eAward_TimeToMine,
eAward_HotTopic,
eAward_AquireHardware,
eAward_TimeToFarm,
eAward_BakeBread,
eAward_TheLie,
eAward_GettingAnUpgrade,
eAward_DeliciousFish,
eAward_OnARail,
eAward_TimeToStrike,
eAward_MonsterHunter,
eAward_CowTipper,
eAward_WhenPigsFly,
eAward_LeaderOfThePack,
eAward_MOARTools,
eAward_DispenseWithThis,
eAward_InToTheNether,
enum eAward {
eAward_TakingInventory = 0,
eAward_GettingWood,
eAward_Benchmarking,
eAward_TimeToMine,
eAward_HotTopic,
eAward_AquireHardware,
eAward_TimeToFarm,
eAward_BakeBread,
eAward_TheLie,
eAward_GettingAnUpgrade,
eAward_DeliciousFish,
eAward_OnARail,
eAward_TimeToStrike,
eAward_MonsterHunter,
eAward_CowTipper,
eAward_WhenPigsFly,
eAward_LeaderOfThePack,
eAward_MOARTools,
eAward_DispenseWithThis,
eAward_InToTheNether,
eAward_mine100Blocks,
eAward_kill10Creepers,
eAward_eatPorkChop,
eAward_play100Days,
eAward_arrowKillCreeper,
eAward_socialPost,
eAward_mine100Blocks,
eAward_kill10Creepers,
eAward_eatPorkChop,
eAward_play100Days,
eAward_arrowKillCreeper,
eAward_socialPost,
// 4J Stu - Does not map to any Xbox achievements
eAward_snipeSkeleton,
eAward_diamonds,
eAward_portal,
eAward_ghast,
eAward_blazeRod,
eAward_potion,
eAward_theEnd,
eAward_winGame,
eAward_enchantments,
eAward_overkill,
eAward_bookcase,
// 4J Stu - Does not map to any Xbox achievements
eAward_snipeSkeleton,
eAward_diamonds,
eAward_portal,
eAward_ghast,
eAward_blazeRod,
eAward_potion,
eAward_theEnd,
eAward_winGame,
eAward_enchantments,
eAward_overkill,
eAward_bookcase,
#if defined(_EXTENDED_ACHIEVEMENTS)
eAward_adventuringTime,
eAward_repopulation,
//eAward_porkChop,
eAward_diamondsToYou,
//eAward_passingTheTime,
//eAward_archer,
eAward_theHaggler,
eAward_potPlanter,
eAward_itsASign,
eAward_ironBelly,
eAward_haveAShearfulDay,
eAward_rainbowCollection,
eAward_stayinFrosty,
eAward_chestfulOfCobblestone,
eAward_renewableEnergy,
eAward_musicToMyEars,
eAward_bodyGuard,
eAward_ironMan,
eAward_zombieDoctor,
eAward_lionTamer,
eAward_adventuringTime,
eAward_repopulation,
// eAward_porkChop,
eAward_diamondsToYou,
// eAward_passingTheTime,
// eAward_archer,
eAward_theHaggler,
eAward_potPlanter,
eAward_itsASign,
eAward_ironBelly,
eAward_haveAShearfulDay,
eAward_rainbowCollection,
eAward_stayinFrosty,
eAward_chestfulOfCobblestone,
eAward_renewableEnergy,
eAward_musicToMyEars,
eAward_bodyGuard,
eAward_ironMan,
eAward_zombieDoctor,
eAward_lionTamer,
#endif
eAward_Max,
eAward_Max,
};

View file

@ -7,17 +7,16 @@
// Desc: Internal helper function
//--------------------------------------------------------------------------------------
#if !defined(_CONTENT_PACKAGE)
static void DebugSpewV(const char* strFormat, va_list pArgList)
{
static void DebugSpewV(const char* strFormat, va_list pArgList) {
#if defined(__linux__)
assert(0);
assert(0);
#else
char str[2048];
// Use the secure CRT to avoid buffer overruns. Specify a count of
// _TRUNCATE so that too long strings will be silently truncated
// rather than triggering an error.
_vsnprintf_s( str, _TRUNCATE, strFormat, pArgList );
OutputDebugStringA( str );
char str[2048];
// Use the secure CRT to avoid buffer overruns. Specify a count of
// _TRUNCATE so that too long strings will be silently truncated
// rather than triggering an error.
_vsnprintf_s(str, _TRUNCATE, strFormat, pArgList);
OutputDebugStringA(str);
#endif
}
#endif
@ -26,12 +25,11 @@ static void DebugSpewV(const char* strFormat, va_list pArgList)
// Name: DebugPrintf()
// Desc: Prints formatted debug spew
//--------------------------------------------------------------------------------------
void CDECL DebugPrintf(const char* strFormat, ...)
{
void CDECL DebugPrintf(const char* strFormat, ...) {
#if !defined(_CONTENT_PACKAGE)
va_list pArgList;
va_start( pArgList, strFormat );
DebugSpewV( strFormat, pArgList );
va_end( pArgList );
va_list pArgList;
va_start(pArgList, strFormat);
DebugSpewV(strFormat, pArgList);
va_end(pArgList);
#endif
}

View file

@ -71,8 +71,7 @@ const float CMinecraftApp::fSafeZoneY = 36.0f; // 5% of 720
int CMinecraftApp::s_iHTMLFontSizesA[eHTMLSize_COUNT] = {
// 20,15,20,24
20, 13, 20, 26
};
20, 13, 20, 26};
CMinecraftApp::CMinecraftApp() {
if (GAME_SETTINGS_PROFILE_DATA_BYTES != sizeof(GAME_SETTINGS)) {
@ -195,20 +194,17 @@ CMinecraftApp::CMinecraftApp() {
m_bResetNether = false;
#if defined(_CONTENT_PACAKGE)
m_bUseDPadForDebug = false;
#else
m_bUseDPadForDebug = true;
#endif
for (int i = 0; i < XUSER_MAX_COUNT; i++) {
m_vBannedListA[i] = new std::vector<PBANNEDLISTDATA>;
}
LocaleAndLanguageInit();
}
void CMinecraftApp::DebugPrintf(const char* szFormat, ...) {
@ -267,9 +263,7 @@ void CMinecraftApp::SetAction(int iPad, eXuiAction action, void* param) {
}
}
bool CMinecraftApp::IsAppPaused() {
return m_bIsAppPaused;
}
bool CMinecraftApp::IsAppPaused() { return m_bIsAppPaused; }
void CMinecraftApp::SetAppPaused(bool val) { m_bIsAppPaused = val; }
@ -701,8 +695,7 @@ void CMinecraftApp::InitGameSettings() {
}
int CMinecraftApp::SetDefaultOptions(C_4JProfile::PROFILESETTINGS* pSettings,
const int iPad)
{
const int iPad) {
SetGameSettings(iPad, eGameSetting_MusicVolume, DEFAULT_VOLUME_LEVEL);
SetGameSettings(iPad, eGameSetting_SoundFXVolume, DEFAULT_VOLUME_LEVEL);
SetGameSettings(iPad, eGameSetting_Gamma, 50);
@ -796,13 +789,11 @@ int CMinecraftApp::SetDefaultOptions(C_4JProfile::PROFILESETTINGS* pSettings,
// #endif
return 0;
}
int CMinecraftApp::DefaultOptionsCallback(
void* pParam, C_4JProfile::PROFILESETTINGS* pSettings, const int iPad)
{
void* pParam, C_4JProfile::PROFILESETTINGS* pSettings, const int iPad) {
CMinecraftApp* pApp = (CMinecraftApp*)pParam;
// flag the default options to be set
@ -819,7 +810,6 @@ int CMinecraftApp::DefaultOptionsCallback(
return 0;
}
int CMinecraftApp::OldProfileVersionCallback(void* pParam,
unsigned char* pucData,
const unsigned short usVersion,
@ -2452,7 +2442,6 @@ void CMinecraftApp::HandleXuiActions(void) {
ProfileManager.GetPrimaryPad());
pMinecraft->removeLocalPlayerIdx(i);
// Wipe out the tooltips
ui.SetTooltips(i, -1);
@ -2500,7 +2489,6 @@ void CMinecraftApp::HandleXuiActions(void) {
}
}
SetAction(i, eAppAction_Idle);
}
break;
@ -2519,7 +2507,6 @@ void CMinecraftApp::HandleXuiActions(void) {
ProfileManager.GetPrimaryPad());
pMinecraft->removeLocalPlayerIdx(i);
// Wipe out the tooltips
ui.SetTooltips(i, -1);
@ -2566,7 +2553,6 @@ void CMinecraftApp::HandleXuiActions(void) {
SetAction(i, eAppAction_Idle);
} break;
case eAppAction_ExitWorld:
pMinecraft->exitingWorldRightNow = true;
@ -2679,7 +2665,6 @@ void CMinecraftApp::HandleXuiActions(void) {
// 4J Stu - Fix for #12368 - Crash: Game crashes when saving
// then exiting and selecting to save
for (unsigned int idx = 0; idx < XUSER_MAX_COUNT; ++idx) {
// 4J Stu - Fix for #13257 - CRASH: Gameplay: Title
// crashed after exiting the tutorial It doesn't matter
// if they were in the tutorial already
@ -2700,7 +2685,8 @@ void CMinecraftApp::HandleXuiActions(void) {
// action, use a dialog instead
completionData->bRequiresUserAction =
false; //(param != nullptr) ? true : false;
completionData->bShowTips = (param != nullptr) ? false : true;
completionData->bShowTips =
(param != nullptr) ? false : true;
completionData->bShowBackground = true;
completionData->bShowLogo = true;
completionData->type =
@ -2729,7 +2715,6 @@ void CMinecraftApp::HandleXuiActions(void) {
// 4J Stu - Fix for #12368 - Crash: Game crashes when saving
// then exiting and selecting to save
for (unsigned int idx = 0; idx < XUSER_MAX_COUNT; ++idx) {
// 4J Stu - Fix for #13257 - CRASH: Gameplay: Title
// crashed after exiting the tutorial It doesn't matter
// if they were in the tutorial already
@ -3034,7 +3019,6 @@ void CMinecraftApp::HandleXuiActions(void) {
// saving then exiting and selecting to save
for (unsigned int idx = 0; idx < XUSER_MAX_COUNT;
++idx) {
// 4J Stu - Fix for #13257 - CRASH: Gameplay: Title
// crashed after exiting the tutorial It doesn't
// matter if they were in the tutorial already
@ -3131,8 +3115,7 @@ void CMinecraftApp::HandleXuiActions(void) {
&CMinecraftApp::
ExitAndJoinFromInviteSaveDialogReturned,
this);
} else
{
} else {
if (!ProfileManager.IsFullVersion()) {
TelemetryManager->RecordUpsellPresented(
i, eSen_UpsellID_Full_Version_Of_Game,
@ -3172,7 +3155,6 @@ void CMinecraftApp::HandleXuiActions(void) {
// 4J Stu - Fix for #12368 - Crash: Game crashes when saving
// then exiting and selecting to save
for (unsigned int idx = 0; idx < XUSER_MAX_COUNT; ++idx) {
// 4J Stu - Fix for #13257 - CRASH: Gameplay: Title
// crashed after exiting the tutorial It doesn't matter
// if they were in the tutorial already
@ -3214,7 +3196,6 @@ void CMinecraftApp::HandleXuiActions(void) {
app.DebugPrintf("Unmount result is %d\n", result);
}
LoadingInputParams* loadingParams =
new LoadingInputParams();
loadingParams->func =
@ -3259,7 +3240,6 @@ void CMinecraftApp::HandleXuiActions(void) {
ProfileManager.SetLockedProfile(inviteData->dwUserIndex);
ProfileManager.SetPrimaryPad(inviteData->dwUserIndex);
// change the minecraft player name
Minecraft::GetInstance()->user->name =
convStringToWstring(ProfileManager.GetGamertag(
@ -3706,7 +3686,6 @@ void CMinecraftApp::loadMediaArchive() {
}
void CMinecraftApp::loadStringTable() {
if (m_stringTable != nullptr) {
// we need to unload the current std::string table, this is a reload
delete m_stringTable;
@ -4008,7 +3987,6 @@ void CMinecraftApp::ClearSignInChangeUsersMask() {
void CMinecraftApp::SignInChangeCallback(void* pParam,
bool bPrimaryPlayerChanged,
unsigned int uiSignInData) {
CMinecraftApp* pApp = (CMinecraftApp*)pParam;
// check if the primary player signed out
int iPrimaryPlayer = ProfileManager.GetPrimaryPad();
@ -4083,7 +4061,8 @@ void CMinecraftApp::SignInChangeCallback(void* pParam,
// invalidates all the guest players we have in the game
if (hasGuestIdChanged &&
pApp->m_currentSigninInfo[i].dwGuestNumber != 0 &&
g_NetworkManager.GetLocalPlayerByUserIndex(i) != nullptr) {
g_NetworkManager.GetLocalPlayerByUserIndex(i) !=
nullptr) {
pApp->DebugPrintf(
"Recommending removal of player at index %d "
"because their guest id changed\n",
@ -4153,7 +4132,6 @@ void CMinecraftApp::SignInChangeCallback(void* pParam,
eAppAction_EthernetDisconnected);
}
}
}
m_uiLastSignInData = uiSignInData;
} else if (iPrimaryPlayer != -1) {
@ -4392,7 +4370,6 @@ void CMinecraftApp::MountNextDLC(int iPad) {
m_bDLCInstallProcessCompleted = true;
ui.HandleDLCMountingComplete();
}
}
@ -4565,7 +4542,7 @@ bool CMinecraftApp::isXuidNotch(PlayerUID xuid) {
bool CMinecraftApp::isXuidDeadmau5(PlayerUID xuid) {
auto it = MojangData.find(xuid); // 4J Stu - The .at and [] accessors
// insert elements if they don't exist
// insert elements if they don't exist
if (it != MojangData.end()) {
MOJANG_DATA* pMojangData = MojangData[xuid];
if (pMojangData && pMojangData->eXuid == eXUID_Deadmau5) {
@ -4815,7 +4792,6 @@ int CMinecraftApp::ExitAndJoinFromInviteSaveDialogReturned(
// upsell
// get the dlc texture pack
unsigned int uiIDA[2];
uiIDA[0] = IDS_CONFIRM_OK;
uiIDA[1] = IDS_CONFIRM_CANCEL;
@ -4847,8 +4823,7 @@ int CMinecraftApp::ExitAndJoinFromInviteSaveDialogReturned(
&CMinecraftApp::ExitAndJoinFromInviteAndSaveReturned,
pClass);
return 0;
} else
{
} else {
MinecraftServer::getInstance()->setSaveOnExit(true);
}
} else {
@ -4898,7 +4873,6 @@ int CMinecraftApp::ExitAndJoinFromInviteAndSaveReturned(
// upsell
// get the dlc texture pack
unsigned int uiIDA[2];
uiIDA[0] = IDS_CONFIRM_OK;
uiIDA[1] = IDS_CONFIRM_CANCEL;
@ -5251,7 +5225,6 @@ std::wstring CMinecraftApp::FormatHTMLString(
text = replaceAll(text, L"{*CONTROLLER_ACTION_DPAD_LEFT*}",
GetActionReplacement(iPad, MINECRAFT_ACTION_DPAD_LEFT));
// Fix for #8903 - UI: Localization: KOR/JPN/CHT: Button Icons are rendered
// with padding space, which looks no good
std::uint32_t dwLanguage = XGetLanguage();
@ -5655,8 +5628,7 @@ DLC_INFO* CMinecraftApp::GetDLCInfoTrialOffer(int iIndex) {
return it->second;
}
DLC_INFO* CMinecraftApp::GetDLCInfoFullOffer(int iIndex) {
std::unordered_map<uint64_t, DLC_INFO*>::iterator it =
DLCInfo_Full.begin();
std::unordered_map<uint64_t, DLC_INFO*>::iterator it = DLCInfo_Full.begin();
for (int i = 0; i < iIndex; i++) {
++it;
@ -5665,8 +5637,7 @@ DLC_INFO* CMinecraftApp::GetDLCInfoFullOffer(int iIndex) {
return it->second;
}
uint64_t CMinecraftApp::GetDLCInfoTexturesFullOffer(int iIndex) {
std::unordered_map<int, uint64_t>::iterator it =
DLCTextures_PackID.begin();
std::unordered_map<int, uint64_t>::iterator it = DLCTextures_PackID.begin();
for (int i = 0; i < iIndex; i++) {
++it;
@ -5675,7 +5646,6 @@ uint64_t CMinecraftApp::GetDLCInfoTexturesFullOffer(int iIndex) {
return it->second;
}
DLC_INFO* CMinecraftApp::GetDLCInfoForFullOfferID(uint64_t ullOfferID_Full) {
if (DLCInfo_Full.size() > 0) {
auto it = DLCInfo_Full.find(ullOfferID_Full);
@ -5802,8 +5772,7 @@ int CMinecraftApp::ExitGameFromRemoteSaveDialogReturned(
UIScene_FullscreenProgress* pScene =
(UIScene_FullscreenProgress*)ui.FindScene(
eUIScene_FullscreenProgress);
if (pScene != nullptr)
{
if (pScene != nullptr) {
pScene->SetWasCancelled(false);
}
}
@ -5837,7 +5806,6 @@ void CMinecraftApp::InvalidateBannedList(int iPad) {
}
}
void CMinecraftApp::AddLevelToBannedLevelList(int iPad, PlayerUID xuid,
char* pszLevelName,
bool bWriteToTMS) {
@ -5880,8 +5848,7 @@ bool CMinecraftApp::IsInBannedLevelList(int iPad, PlayerUID xuid,
it != m_vBannedListA[iPad]->end(); ++it) {
PBANNEDLISTDATA pData = *it;
if (IsEqualXUID(pData->xuid, xuid) &&
(strcmp(pData->pszLevelName, pszLevelName) == 0))
{
(strcmp(pData->pszLevelName, pszLevelName) == 0)) {
return true;
}
}
@ -5902,8 +5869,7 @@ void CMinecraftApp::RemoveLevelFromBannedLevelList(int iPad, PlayerUID xuid,
if (pBannedListData != nullptr) {
if (IsEqualXUID(pBannedListData->xuid, xuid) &&
(strcmp(pBannedListData->pszLevelName, pszLevelName) == 0))
{
(strcmp(pBannedListData->pszLevelName, pszLevelName) == 0)) {
TelemetryManager->RecordUnBanLevel(iPad);
// match found, so remove this entry
@ -6507,8 +6473,8 @@ unsigned int CMinecraftApp::CreateImageTextData(std::uint8_t* textMetadata,
void CMinecraftApp::AddTerrainFeaturePosition(_eTerrainFeatureType eFeatureType,
int x, int z) {
// check we don't already have this in
for (auto it = m_vTerrainFeatures.begin();
it < m_vTerrainFeatures.end(); ++it) {
for (auto it = m_vTerrainFeatures.begin(); it < m_vTerrainFeatures.end();
++it) {
FEATURE_DATA* pFeatureData = *it;
if ((pFeatureData->eTerrainFeature == eFeatureType) &&
@ -6525,8 +6491,8 @@ void CMinecraftApp::AddTerrainFeaturePosition(_eTerrainFeatureType eFeatureType,
}
_eTerrainFeatureType CMinecraftApp::IsTerrainFeature(int x, int z) {
for (auto it = m_vTerrainFeatures.begin();
it < m_vTerrainFeatures.end(); ++it) {
for (auto it = m_vTerrainFeatures.begin(); it < m_vTerrainFeatures.end();
++it) {
FEATURE_DATA* pFeatureData = *it;
if ((pFeatureData->x == x) && (pFeatureData->z == z))
@ -6538,8 +6504,8 @@ _eTerrainFeatureType CMinecraftApp::IsTerrainFeature(int x, int z) {
bool CMinecraftApp::GetTerrainFeaturePosition(_eTerrainFeatureType eType,
int* pX, int* pZ) {
for (auto it = m_vTerrainFeatures.begin();
it < m_vTerrainFeatures.end(); ++it) {
for (auto it = m_vTerrainFeatures.begin(); it < m_vTerrainFeatures.end();
++it) {
FEATURE_DATA* pFeatureData = *it;
if (pFeatureData->eTerrainFeature == eType) {
@ -6654,7 +6620,7 @@ std::wstring CMinecraftApp::getEntityName(eINSTANCEOF type) {
std::uint32_t CMinecraftApp::m_dwContentTypeA[e_Marketplace_MAX] = {
XMARKETPLACE_OFFERING_TYPE_CONTENT, // e_DLC_SkinPack, e_DLC_TexturePacks,
// e_DLC_MashupPacks
XMARKETPLACE_OFFERING_TYPE_THEME, // e_DLC_Themes
XMARKETPLACE_OFFERING_TYPE_THEME, // e_DLC_Themes
XMARKETPLACE_OFFERING_TYPE_AVATARITEM, // e_DLC_AvatarItems
XMARKETPLACE_OFFERING_TYPE_TILE, // e_DLC_Gamerpics
};
@ -6666,8 +6632,8 @@ unsigned int CMinecraftApp::AddDLCRequest(eDLCMarketplaceType eType,
// If it's already in there, promote it to the top of the list
int iPosition = 0;
for (auto it = m_DLCDownloadQueue.begin();
it != m_DLCDownloadQueue.end(); ++it) {
for (auto it = m_DLCDownloadQueue.begin(); it != m_DLCDownloadQueue.end();
++it) {
DLCRequest* pCurrent = *it;
if (pCurrent->dwType == m_dwContentTypeA[eType]) {
@ -6921,8 +6887,8 @@ bool CMinecraftApp::RetrieveNextDLCContent() {
}
EnterCriticalSection(&csDLCDownloadQueue);
for (auto it = m_DLCDownloadQueue.begin();
it != m_DLCDownloadQueue.end(); ++it) {
for (auto it = m_DLCDownloadQueue.begin(); it != m_DLCDownloadQueue.end();
++it) {
DLCRequest* pCurrent = *it;
if (pCurrent->eState == e_DLC_ContentState_Retrieving) {
@ -6932,8 +6898,8 @@ bool CMinecraftApp::RetrieveNextDLCContent() {
}
// Now look for the next retrieval
for (auto it = m_DLCDownloadQueue.begin();
it != m_DLCDownloadQueue.end(); ++it) {
for (auto it = m_DLCDownloadQueue.begin(); it != m_DLCDownloadQueue.end();
++it) {
DLCRequest* pCurrent = *it;
if (pCurrent->eState == e_DLC_ContentState_Idle) {
@ -6965,7 +6931,6 @@ bool CMinecraftApp::RetrieveNextDLCContent() {
int CMinecraftApp::TMSPPFileReturned(void* pParam, int iPad, int iUserData,
C4JStorage::PTMSPP_FILEDATA pFileData,
const char* szFilename) {
CMinecraftApp* pClass = (CMinecraftApp*)pParam;
// find the right one in the vector
@ -7013,9 +6978,7 @@ int CMinecraftApp::TMSPPFileReturned(void* pParam, int iPad, int iUserData,
return 0;
}
bool CMinecraftApp::RetrieveNextTMSPPContent() {
return false;
}
bool CMinecraftApp::RetrieveNextTMSPPContent() { return false; }
void CMinecraftApp::TickDLCOffersRetrieved() {
if (!m_bAllDLCContentRetrieved) {
@ -7030,8 +6993,8 @@ void CMinecraftApp::ClearAndResetDLCDownloadQueue() {
int iPosition = 0;
EnterCriticalSection(&csTMSPPDownloadQueue);
for (auto it = m_DLCDownloadQueue.begin();
it != m_DLCDownloadQueue.end(); ++it) {
for (auto it = m_DLCDownloadQueue.begin(); it != m_DLCDownloadQueue.end();
++it) {
DLCRequest* pCurrent = *it;
delete pCurrent;
@ -7102,8 +7065,8 @@ bool CMinecraftApp::DLCContentRetrieved(eDLCMarketplaceType eType) {
// If there's already a retrieve in progress, quit
// we may have re-ordered the list, so need to check every item
EnterCriticalSection(&csDLCDownloadQueue);
for (auto it = m_DLCDownloadQueue.begin();
it != m_DLCDownloadQueue.end(); ++it) {
for (auto it = m_DLCDownloadQueue.begin(); it != m_DLCDownloadQueue.end();
++it) {
DLCRequest* pCurrent = *it;
if ((pCurrent->dwType == m_dwContentTypeA[eType]) &&
@ -7300,7 +7263,6 @@ std::wstring CMinecraftApp::getSkinPathFromId(std::uint32_t skinId) {
int CMinecraftApp::TexturePackDialogReturned(
void* pParam, int iPad, C4JStorage::EMessageResult result) {
return 0;
}
@ -7388,7 +7350,6 @@ bool CMinecraftApp::IsLocalMultiplayerAvailable() {
bool available = RenderManager.IsHiDef() && connectedControllers > 1;
return available;
// Found this in GameNetworkManager?
@ -7561,7 +7522,6 @@ void CMinecraftApp::getLocale(std::vector<std::wstring>& vecWstrLocales) {
locales.push_back(eMCLang_csCS);
locales.push_back(eMCLang_zhCN);
break;
}
locales.push_back(eMCLang_enUS);
@ -7824,7 +7784,6 @@ std::wstring titleUpdateTexturePackRoot = L"Windows64\\DLC\\";
std::wstring titleUpdateTexturePackRoot = L"CU\\DLC\\";
#endif
std::wstring CMinecraftApp::getRootPath(std::uint32_t packId,
bool allowOverride, bool bAddDataFolder,
std::wstring mountPoint) {
@ -7847,4 +7806,3 @@ std::wstring CMinecraftApp::getRootPath(std::uint32_t packId,
return path + L"\\";
}
}

View file

@ -25,7 +25,6 @@
#include "../Minecraft.Client/Utils/ArchiveFile.h"
#include "../Minecraft.World/Entities/MinecartHopper.h"
typedef struct _JoinFromInviteData {
std::uint32_t dwUserIndex; // dwUserIndex
std::uint32_t dwLocalUsersMask; // dwUserMask
@ -56,8 +55,7 @@ class Merchant;
class CMinecraftAudio;
class CMinecraftApp
{
class CMinecraftApp {
private:
static int s_iHTMLFontSizesA[eHTMLSize_COUNT];
@ -268,8 +266,7 @@ public:
void SetFreezePlayers(bool bVal) { m_bFreezePlayers = bVal; }
// debug -0 show safe area
void ShowSafeArea(bool show) {
}
void ShowSafeArea(bool show) {}
// 4J-PB - to capture the social post screenshot
virtual void CaptureScreenshot(int iPad) {};
// void GetPreviewImage(int iPad,XSOCIAL_PREVIEWIMAGE
@ -371,7 +368,6 @@ public:
static void UpsellReturnedCallback(void* pParam, eUpsellType type,
eUpsellResponse result, int iUserData);
#if defined(_DEBUG_MENUS_ENABLED)
bool DebugSettingsOn() { return m_bDebugOptions; }
bool DebugArtToolsOn();
@ -677,7 +673,8 @@ public:
static int32_t RegisterConfigValues(wchar_t* pType, int iValue);
static int32_t RegisterDLCData(wchar_t*, wchar_t*, int, uint64_t, uint64_t,
wchar_t*, unsigned int, int, wchar_t* pDataFile);
wchar_t*, unsigned int, int,
wchar_t* pDataFile);
bool GetDLCFullOfferIDForSkinID(const std::wstring& FirstSkin,
uint64_t* pullVal);
DLC_INFO* GetDLCInfoForTrialOfferID(uint64_t ullOfferID_Trial);
@ -839,7 +836,8 @@ private:
unsigned int m_playerGamePrivileges[MINECRAFT_NET_MAX_PLAYERS];
public:
void UpdatePlayerInfo(std::uint8_t networkSmallId, int16_t playerColourIndex,
void UpdatePlayerInfo(std::uint8_t networkSmallId,
int16_t playerColourIndex,
unsigned int playerGamePrivileges);
short GetPlayerColour(std::uint8_t networkSmallId);
unsigned int GetPlayerPrivileges(std::uint8_t networkSmallId);
@ -915,9 +913,10 @@ public:
// static int CallbackReadXuidsFileFromTMS(void* lpParam, wchar_t
// *wchFilename, int iPad, bool bResult, int iAction); static int
// CallbackDLCFileFromTMS(void* lpParam, wchar_t *wchFilename, int iPad, bool
// bResult, int iAction); static int CallbackBannedListFileFromTMS(void*
// lpParam, wchar_t *wchFilename, int iPad, bool bResult, int iAction);
// CallbackDLCFileFromTMS(void* lpParam, wchar_t *wchFilename, int iPad,
// bool bResult, int iAction); static int
// CallbackBannedListFileFromTMS(void* lpParam, wchar_t *wchFilename, int
// iPad, bool bResult, int iAction);
// Storing additional model parts per skin texture
void SetAdditionalSkinBoxes(std::uint32_t dwSkinID, SKIN_BOX* SkinBoxA,
@ -982,7 +981,6 @@ private:
bool m_bResetNether;
std::uint32_t m_dwRequiredTexturePackID;
// 4J-PB - language and locale functions
public:
void LocaleAndLanguageInit();
@ -1009,7 +1007,6 @@ public:
#else
#endif
};
// singleton

View file

@ -25,7 +25,6 @@ void DLCGameRulesHeader::addData(std::uint8_t* pbData,
std::uint32_t dataBytes) {
m_pbData = pbData;
m_dataBytes = dataBytes;
}
std::uint8_t* DLCGameRulesHeader::getData(std::uint32_t& dataBytes) {

View file

@ -229,7 +229,6 @@ DLCPack* DLCManager::getPack(const std::wstring& name) {
return pack;
}
DLCPack* DLCManager::getPack(unsigned int index,
EDLCType type /*= e_DLCType_All*/) {
DLCPack* pack = nullptr;

View file

@ -27,7 +27,6 @@ DLCPack::DLCPack(const std::wstring& name, std::uint32_t dwLicenseMask) {
m_data = nullptr;
}
DLCPack::~DLCPack() {
for (auto it = m_childPacks.begin(); it != m_childPacks.end(); ++it) {
delete *it;
@ -213,8 +212,8 @@ bool DLCPack::doesPackContainFile(DLCManager::EDLCType type,
}
} else {
g_pathCmpString = &path;
auto it = std::find_if(m_files[type].begin(), m_files[type].end(),
pathCmp);
auto it =
std::find_if(m_files[type].begin(), m_files[type].end(), pathCmp);
hasFile = it != m_files[type].end();
if (!hasFile && m_parentPack) {
hasFile = m_parentPack->doesPackContainFile(type, path);
@ -252,7 +251,8 @@ DLCFile* DLCPack::getFile(DLCManager::EDLCType type, const std::wstring& path) {
}
} else {
g_pathCmpString = &path;
auto it = std::find_if(m_files[type].begin(), m_files[type].end(), pathCmp);
auto it =
std::find_if(m_files[type].begin(), m_files[type].end(), pathCmp);
if (it == m_files[type].end()) {
// Not found

View file

@ -107,10 +107,10 @@ void DLCSkinFile::addParameter(DLCManager::EDLCParameterType type,
SKIN_BOX* pSkinBox = new SKIN_BOX;
ZeroMemory(pSkinBox, sizeof(SKIN_BOX));
swscanf_s(
value.c_str(), L"%9ls%f%f%f%f%f%f%f%f", wchBodyPart, 10,
&pSkinBox->fX, &pSkinBox->fY, &pSkinBox->fZ, &pSkinBox->fW,
&pSkinBox->fH, &pSkinBox->fD, &pSkinBox->fU, &pSkinBox->fV);
swscanf_s(value.c_str(), L"%9ls%f%f%f%f%f%f%f%f", wchBodyPart, 10,
&pSkinBox->fX, &pSkinBox->fY, &pSkinBox->fZ,
&pSkinBox->fW, &pSkinBox->fH, &pSkinBox->fD,
&pSkinBox->fU, &pSkinBox->fV);
if (wcscmp(wchBodyPart, L"HEAD") == 0) {
pSkinBox->ePart = eBodyPart_Head;

View file

@ -88,8 +88,8 @@ bool CollectItemRuleDefinition::onCollectItem(
std::shared_ptr<UpdateGameRuleProgressPacket>(
new UpdateGameRuleProgressPacket(
getActionType(), this->m_descriptionId,
m_itemId, m_auxValue, this->m_4JDataValue, nullptr,
0)));
m_itemId, m_auxValue, this->m_4JDataValue,
nullptr, 0)));
}
}
}

View file

@ -28,8 +28,8 @@ bool CompleteAllRuleDefinition::onCollectItem(
void CompleteAllRuleDefinition::updateStatus(GameRule* rule) {
int goal = 0;
int progress = 0;
for (auto it = rule->m_parameters.begin();
it != rule->m_parameters.end(); ++it) {
for (auto it = rule->m_parameters.begin(); it != rule->m_parameters.end();
++it) {
if (it->second.isPointer) {
goal += it->second.gr->getGameRuleDefinition()->getGoal();
progress += it->second.gr->getGameRuleDefinition()->getProgress(

View file

@ -66,8 +66,8 @@ void CompoundGameRuleDefinition::populateGameRule(
bool CompoundGameRuleDefinition::onUseTile(GameRule* rule, int tileId, int x,
int y, int z) {
bool statusChanged = false;
for (auto it = rule->m_parameters.begin();
it != rule->m_parameters.end(); ++it) {
for (auto it = rule->m_parameters.begin(); it != rule->m_parameters.end();
++it) {
if (it->second.isPointer) {
bool changed = it->second.gr->getGameRuleDefinition()->onUseTile(
it->second.gr, tileId, x, y, z);
@ -84,8 +84,8 @@ bool CompoundGameRuleDefinition::onUseTile(GameRule* rule, int tileId, int x,
bool CompoundGameRuleDefinition::onCollectItem(
GameRule* rule, std::shared_ptr<ItemInstance> item) {
bool statusChanged = false;
for (auto it = rule->m_parameters.begin();
it != rule->m_parameters.end(); ++it) {
for (auto it = rule->m_parameters.begin(); it != rule->m_parameters.end();
++it) {
if (it->second.isPointer) {
bool changed =
it->second.gr->getGameRuleDefinition()->onCollectItem(

View file

@ -122,7 +122,8 @@ void ConsoleSchematicFile::load(DataInputStream* dis) {
if (te == nullptr) {
#ifndef _CONTENT_PACKAGE
app.DebugPrintf(
"ConsoleSchematicFile has read a nullptr tile entity\n");
"ConsoleSchematicFile has read a nullptr tile "
"entity\n");
__debugbreak();
#endif
} else {
@ -169,8 +170,7 @@ void ConsoleSchematicFile::save_tags(DataOutputStream* dos) {
ListTag<CompoundTag>* tileEntityTags = new ListTag<CompoundTag>();
tag->put(L"TileEntities", tileEntityTags);
for (auto it = m_tileEntities.begin(); it != m_tileEntities.end();
it++) {
for (auto it = m_tileEntities.begin(); it != m_tileEntities.end(); it++) {
CompoundTag* cTag = new CompoundTag();
(*it)->save(cTag);
tileEntityTags->add(cTag);
@ -452,8 +452,7 @@ void ConsoleSchematicFile::schematicCoordToChunkCoord(
void ConsoleSchematicFile::applyTileEntities(LevelChunk* chunk, AABB* chunkBox,
AABB* destinationBox,
ESchematicRotation rot) {
for (auto it = m_tileEntities.begin(); it != m_tileEntities.end();
++it) {
for (auto it = m_tileEntities.begin(); it != m_tileEntities.end(); ++it) {
std::shared_ptr<TileEntity> te = *it;
double targetX = te->x;
@ -1070,8 +1069,8 @@ ConsoleSchematicFile::getTileEntitiesInRegion(LevelChunk* chunk, int x0, int y0,
int z0, int x1, int y1, int z1) {
std::vector<std::shared_ptr<TileEntity> >* result =
new std::vector<std::shared_ptr<TileEntity> >;
for (auto it = chunk->tileEntities.begin();
it != chunk->tileEntities.end(); ++it) {
for (auto it = chunk->tileEntities.begin(); it != chunk->tileEntities.end();
++it) {
std::shared_ptr<TileEntity> te = it->second;
if (te->x >= x0 && te->y >= y0 && te->z >= z0 && te->x < x1 &&
te->y < y1 && te->z < z1) {

View file

@ -77,5 +77,6 @@ public:
Connection* connection);
static std::wstring generateDescriptionString(
ConsoleGameRules::EGameRuleType defType,
const std::wstring& description, void* data = nullptr, int dataLength = 0);
const std::wstring& description, void* data = nullptr,
int dataLength = 0);
};

View file

@ -627,7 +627,6 @@ void GameRuleManager::processSchematicsLighting(LevelChunk* levelChunk) {
}
void GameRuleManager::loadDefaultGameRules() {
#if !defined(__linux__)
#if defined(_WINDOWS64)
File packedTutorialFile(L"Windows64Media\\Tutorial\\Tutorial.pck");
@ -644,19 +643,20 @@ void GameRuleManager::loadDefaultGameRules() {
app.GetString(IDS_TUTORIALSAVENAME));
}
#else
std::wstring fpTutorial = L"Tutorial.pck";
if(app.getArchiveFileSize(fpTutorial) >= 0)
{
DLCPack *pack = new DLCPack(L"",0xffffffff);
uint32_t dwFilesProcessed = 0;
if ( app.m_dlcManager.readDLCDataFile(dwFilesProcessed,fpTutorial,pack,true) )
{
app.m_dlcManager.addPack(pack);
m_levelGenerators.getLevelGenerators()->at(0)->setWorldName(app.GetString(IDS_PLAY_TUTORIAL));
m_levelGenerators.getLevelGenerators()->at(0)->setDefaultSaveName(app.GetString(IDS_TUTORIALSAVENAME));
}
else delete pack;
}
std::wstring fpTutorial = L"Tutorial.pck";
if (app.getArchiveFileSize(fpTutorial) >= 0) {
DLCPack* pack = new DLCPack(L"", 0xffffffff);
uint32_t dwFilesProcessed = 0;
if (app.m_dlcManager.readDLCDataFile(dwFilesProcessed, fpTutorial, pack,
true)) {
app.m_dlcManager.addPack(pack);
m_levelGenerators.getLevelGenerators()->at(0)->setWorldName(
app.GetString(IDS_PLAY_TUTORIAL));
m_levelGenerators.getLevelGenerators()->at(0)->setDefaultSaveName(
app.GetString(IDS_TUTORIALSAVENAME));
} else
delete pack;
}
#endif
}

View file

@ -56,7 +56,7 @@ public:
bool readRuleFile(LevelGenerationOptions* lgo, uint8_t* dIn,
unsigned int dSize,
StringTable* strings); //(DLCGameRulesFile *dlcFile,
//StringTable *strings);
// StringTable *strings);
private:
void readAttributes(DataInputStream* dis,

View file

@ -124,18 +124,14 @@ void LevelGenerationOptions::getChildren(
GameRuleDefinition::getChildren(children);
std::vector<ApplySchematicRuleDefinition*> used_schematics;
for (auto it = m_schematicRules.begin(); it != m_schematicRules.end();
it++)
for (auto it = m_schematicRules.begin(); it != m_schematicRules.end(); it++)
if (!(*it)->isComplete()) used_schematics.push_back(*it);
for (auto it = m_structureRules.begin(); it != m_structureRules.end();
it++)
for (auto it = m_structureRules.begin(); it != m_structureRules.end(); it++)
children->push_back(*it);
for (auto it = used_schematics.begin(); it != used_schematics.end();
it++)
for (auto it = used_schematics.begin(); it != used_schematics.end(); it++)
children->push_back(*it);
for (auto it = m_biomeOverrides.begin(); it != m_biomeOverrides.end();
++it)
for (auto it = m_biomeOverrides.begin(); it != m_biomeOverrides.end(); ++it)
children->push_back(*it);
for (auto it = m_features.begin(); it != m_features.end(); ++it)
children->push_back(*it);
@ -300,15 +296,15 @@ bool LevelGenerationOptions::checkIntersects(int x0, int y0, int z0, int x1,
// ground/sea level and b) tutorial world additions generally being above
// ground/sea level
if (!m_bHaveMinY) {
for (auto it = m_schematicRules.begin();
it != m_schematicRules.end(); ++it) {
for (auto it = m_schematicRules.begin(); it != m_schematicRules.end();
++it) {
ApplySchematicRuleDefinition* rule = *it;
int minY = rule->getMinY();
if (minY < m_minY) m_minY = minY;
}
for (auto it = m_structureRules.begin();
it != m_structureRules.end(); it++) {
for (auto it = m_structureRules.begin(); it != m_structureRules.end();
it++) {
ConsoleGenerateStructure* structureStart = *it;
int minY = structureStart->getMinY();
if (minY < m_minY) m_minY = minY;
@ -330,8 +326,8 @@ bool LevelGenerationOptions::checkIntersects(int x0, int y0, int z0, int x1,
}
if (!intersects) {
for (auto it = m_structureRules.begin();
it != m_structureRules.end(); it++) {
for (auto it = m_structureRules.begin(); it != m_structureRules.end();
it++) {
ConsoleGenerateStructure* structureStart = *it;
intersects =
structureStart->checkIntersects(x0, y0, z0, x1, y1, z1);
@ -446,8 +442,7 @@ LevelGenerationOptions::getUnfinishedSchematicFiles() {
// Clean schematic rules.
std::unordered_set<std::wstring> usedFiles =
std::unordered_set<std::wstring>();
for (auto it = m_schematicRules.begin(); it != m_schematicRules.end();
it++)
for (auto it = m_schematicRules.begin(); it != m_schematicRules.end(); it++)
if (!(*it)->isComplete()) usedFiles.insert((*it)->getSchematicName());
// Clean schematic files.
@ -469,8 +464,7 @@ void LevelGenerationOptions::loadBaseSaveData() {
if (StorageManager.MountInstalledDLC(
ProfileManager.GetPrimaryPad(), mountIndex,
&LevelGenerationOptions::packMounted, this,
"WPACK") != ERROR_IO_PENDING)
{
"WPACK") != ERROR_IO_PENDING) {
// corrupt DLC
setLoadedData();
app.DebugPrintf("Failed to mount LGO DLC %d for pad %d\n",
@ -518,12 +512,12 @@ int LevelGenerationOptions::packMounted(void* pParam, int iPad, uint32_t dwErr,
GENERIC_READ, // access mode
0, // share mode // TODO 4J Stu - Will we need to share
// file? Probably not but...
nullptr, // Unused
nullptr, // Unused
OPEN_EXISTING, // how to create // TODO 4J Stu -
// Assuming that the file already exists
// if we are opening to read from it
FILE_FLAG_SEQUENTIAL_SCAN, // file attributes
nullptr // Unsupported
nullptr // Unsupported
);
#else
const char* pchFilename = wstringtofilename(grf.getPath());
@ -532,19 +526,19 @@ int LevelGenerationOptions::packMounted(void* pParam, int iPad, uint32_t dwErr,
GENERIC_READ, // access mode
0, // share mode // TODO 4J Stu - Will we need to share
// file? Probably not but...
nullptr, // Unused
nullptr, // Unused
OPEN_EXISTING, // how to create // TODO 4J Stu -
// Assuming that the file already exists
// if we are opening to read from it
FILE_FLAG_SEQUENTIAL_SCAN, // file attributes
nullptr // Unsupported
nullptr // Unsupported
);
#endif
if (fileHandle != INVALID_HANDLE_VALUE) {
uint32_t dwFileSize = grf.length();
uint32_t bytesRead;
uint8_t* pbData = (uint8_t*) new uint8_t[dwFileSize];
uint8_t* pbData = (uint8_t*)new uint8_t[dwFileSize];
bool bSuccess = ReadFile(fileHandle, pbData, dwFileSize,
&bytesRead, nullptr);
if (bSuccess == false) {
@ -574,34 +568,35 @@ int LevelGenerationOptions::packMounted(void* pParam, int iPad, uint32_t dwErr,
void* fileHandle = CreateFile(
pchFilename, // file name
GENERIC_READ, // access mode
0, // share mode // TODO 4J Stu - Will we need to share
// file? Probably not but...
nullptr, // Unused
0, // share mode // TODO 4J Stu - Will we need to share
// file? Probably not but...
nullptr, // Unused
OPEN_EXISTING, // how to create // TODO 4J Stu - Assuming
// that the file already exists if we are
// opening to read from it
FILE_FLAG_SEQUENTIAL_SCAN, // file attributes
nullptr // Unsupported
nullptr // Unsupported
);
#else
const char* pchFilename = wstringtofilename(save.getPath());
void* fileHandle = CreateFile(
pchFilename, // file name
GENERIC_READ, // access mode
0, // share mode // TODO 4J Stu - Will we need to share
// file? Probably not but...
nullptr, // Unused
0, // share mode // TODO 4J Stu - Will we need to share
// file? Probably not but...
nullptr, // Unused
OPEN_EXISTING, // how to create // TODO 4J Stu - Assuming
// that the file already exists if we are
// opening to read from it
FILE_FLAG_SEQUENTIAL_SCAN, // file attributes
nullptr // Unsupported
nullptr // Unsupported
);
#endif
if (fileHandle != INVALID_HANDLE_VALUE) {
uint32_t bytesRead, dwFileSize = GetFileSize(fileHandle, nullptr);
uint8_t* pbData = (uint8_t*) new uint8_t[dwFileSize];
uint32_t bytesRead,
dwFileSize = GetFileSize(fileHandle, nullptr);
uint8_t* pbData = (uint8_t*)new uint8_t[dwFileSize];
bool bSuccess = ReadFile(fileHandle, pbData, dwFileSize,
&bytesRead, nullptr);
if (bSuccess == false) {

View file

@ -24,7 +24,8 @@ public:
ConsoleGameRules::EGameRuleType ruleType);
// 4J-JEV: Super class handles attr-facing fine.
// virtual void writeAttributes(DataOutputStream *dos, uint32_t numAttributes);
// virtual void writeAttributes(DataOutputStream *dos, uint32_t
// numAttributes);
virtual void addAttribute(const std::wstring& attributeName,
const std::wstring& attributeValue);

View file

@ -4,101 +4,105 @@
#include "LeaderboardManager.h"
const std::wstring LeaderboardManager::filterNames[eNumFilterModes] =
{
L"Friends", L"MyScore", L"TopRank"
};
const std::wstring LeaderboardManager::filterNames[eNumFilterModes] = {
L"Friends", L"MyScore", L"TopRank"};
void LeaderboardManager::DeleteInstance()
{
delete m_instance;
m_instance = nullptr;
void LeaderboardManager::DeleteInstance() {
delete m_instance;
m_instance = nullptr;
}
LeaderboardManager::LeaderboardManager()
{
zeroReadParameters();
LeaderboardManager::LeaderboardManager() {
zeroReadParameters();
m_myXUID = INVALID_XUID;
m_myXUID = INVALID_XUID;
}
void LeaderboardManager::zeroReadParameters()
{
m_difficulty = -1;
m_statsType = eStatsType_UNDEFINED;
m_readListener = nullptr;
m_startIndex = 0;
m_readCount = 0;
m_eFilterMode = eFM_UNDEFINED;
void LeaderboardManager::zeroReadParameters() {
m_difficulty = -1;
m_statsType = eStatsType_UNDEFINED;
m_readListener = nullptr;
m_startIndex = 0;
m_readCount = 0;
m_eFilterMode = eFM_UNDEFINED;
}
bool LeaderboardManager::ReadStats_Friends(LeaderboardReadListener *listener, int difficulty, EStatsType type, PlayerUID myUID, unsigned int startIndex, unsigned int readCount)
{
zeroReadParameters();
bool LeaderboardManager::ReadStats_Friends(LeaderboardReadListener* listener,
int difficulty, EStatsType type,
PlayerUID myUID,
unsigned int startIndex,
unsigned int readCount) {
zeroReadParameters();
m_readListener = listener;
m_difficulty = difficulty;
m_statsType = type;
m_eFilterMode = eFM_Friends;
return true;
m_readListener = listener;
m_difficulty = difficulty;
m_statsType = type;
m_eFilterMode = eFM_Friends;
return true;
}
bool LeaderboardManager::ReadStats_MyScore(LeaderboardReadListener *listener, int difficulty, EStatsType type, PlayerUID myUID, unsigned int readCount)
{
zeroReadParameters();
bool LeaderboardManager::ReadStats_MyScore(LeaderboardReadListener* listener,
int difficulty, EStatsType type,
PlayerUID myUID,
unsigned int readCount) {
zeroReadParameters();
m_readListener = listener;
m_difficulty = difficulty;
m_statsType = type;
m_readCount = readCount;
m_eFilterMode = eFM_MyScore;
return true;
m_readListener = listener;
m_difficulty = difficulty;
m_statsType = type;
m_readCount = readCount;
m_eFilterMode = eFM_MyScore;
return true;
}
bool LeaderboardManager::ReadStats_TopRank(LeaderboardReadListener *listener, int difficulty, EStatsType type, unsigned int startIndex, unsigned int readCount)
{
zeroReadParameters();
bool LeaderboardManager::ReadStats_TopRank(LeaderboardReadListener* listener,
int difficulty, EStatsType type,
unsigned int startIndex,
unsigned int readCount) {
zeroReadParameters();
m_readListener = listener;
m_difficulty = difficulty;
m_statsType = type;
m_readListener = listener;
m_difficulty = difficulty;
m_statsType = type;
m_startIndex = startIndex;
m_readCount = readCount;
m_startIndex = startIndex;
m_readCount = readCount;
m_eFilterMode = eFM_TopRank;
return true;
m_eFilterMode = eFM_TopRank;
return true;
}
void LeaderboardManager::printStats(ReadView &view)
{
app.DebugPrintf("[LeaderboardManager] Printing stats:\n"
"\tnumQueries=%i\n", view.m_numQueries);
void LeaderboardManager::printStats(ReadView& view) {
app.DebugPrintf(
"[LeaderboardManager] Printing stats:\n"
"\tnumQueries=%i\n",
view.m_numQueries);
for (int i=0; i<view.m_numQueries; i++)
{
ReadScore score = view.m_queries[i];
for (int i = 0; i < view.m_numQueries; i++) {
ReadScore score = view.m_queries[i];
app.DebugPrintf( "\tname='%s'\n", wstringtofilename(std::wstring(score.m_name)) );
app.DebugPrintf( "\trank='%i'\n", score.m_rank );
app.DebugPrintf( "\tstatsData=[" );
for (int j=0; j<score.m_statsSize; j++)
app.DebugPrintf( " %i", score.m_statsData[j] );
app.DebugPrintf( "]\n" );
}
app.DebugPrintf("\tname='%s'\n",
wstringtofilename(std::wstring(score.m_name)));
app.DebugPrintf("\trank='%i'\n", score.m_rank);
app.DebugPrintf("\tstatsData=[");
for (int j = 0; j < score.m_statsSize; j++)
app.DebugPrintf(" %i", score.m_statsData[j]);
app.DebugPrintf("]\n");
}
}
bool DebugReadListener::OnStatsReadComplete(
LeaderboardManager::eStatsReturn success, int numResults,
LeaderboardManager::ViewOut results) {
app.DebugPrintf("[DebugReadListener] OnStatsReadComplete, %s:\n",
(success ? "success" : "FAILED"));
LeaderboardManager::printStats(results);
bool DebugReadListener::OnStatsReadComplete(LeaderboardManager::eStatsReturn success, int numResults, LeaderboardManager::ViewOut results)
{
app.DebugPrintf("[DebugReadListener] OnStatsReadComplete, %s:\n", (success ? "success" : "FAILED") );
LeaderboardManager::printStats(results);
return true;
return true;
}
DebugReadListener *DebugReadListener::m_instance = new DebugReadListener();
DebugReadListener* DebugReadListener::m_instance = new DebugReadListener();

View file

@ -7,249 +7,246 @@ class LeaderboardManager;
class LeaderboardReadListener;
// ABSTRACT CLASS //
class LeaderboardManager
{
class LeaderboardManager {
public:
enum eStatsReturn
{
eStatsReturn_Success=0,
eStatsReturn_NoResults,
eStatsReturn_NetworkError
};
enum eStatsReturn {
eStatsReturn_Success = 0,
eStatsReturn_NoResults,
eStatsReturn_NetworkError
};
enum eProperty_Kills
{
eProperty_Kills_Zombie=0,
eProperty_Kills_Skeleton,
eProperty_Kills_Creeper,
eProperty_Kills_Spider,
eProperty_Kills_SpiderJockey,
eProperty_Kills_ZombiePigman,
eProperty_Kills_Slime,
eProperty_Kills_Rating,
eProperty_Kills_Max,
};
enum eProperty_Kills {
eProperty_Kills_Zombie = 0,
eProperty_Kills_Skeleton,
eProperty_Kills_Creeper,
eProperty_Kills_Spider,
eProperty_Kills_SpiderJockey,
eProperty_Kills_ZombiePigman,
eProperty_Kills_Slime,
eProperty_Kills_Rating,
eProperty_Kills_Max,
};
enum eProperty_Mining
{
eProperty_Mining_Dirt=0,
eProperty_Mining_Stone,
eProperty_Mining_Sand,
eProperty_Mining_Cobblestone,
eProperty_Mining_Gravel,
eProperty_Mining_Clay,
eProperty_Mining_Obsidian,
eProperty_Mining_Rating,
eProperty_Mining_Max,
};
enum eProperty_Mining {
eProperty_Mining_Dirt = 0,
eProperty_Mining_Stone,
eProperty_Mining_Sand,
eProperty_Mining_Cobblestone,
eProperty_Mining_Gravel,
eProperty_Mining_Clay,
eProperty_Mining_Obsidian,
eProperty_Mining_Rating,
eProperty_Mining_Max,
};
enum eProperty_Farming
{
eProperty_Farming_Egg=0,
eProperty_Farming_Wheat,
eProperty_Farming_Mushroom,
eProperty_Farming_Sugarcane,
eProperty_Farming_Milk,
eProperty_Farming_Pumpkin,
eProperty_Farming_Rating,
eProperty_Farming_Max,
};
enum eProperty_Farming {
eProperty_Farming_Egg = 0,
eProperty_Farming_Wheat,
eProperty_Farming_Mushroom,
eProperty_Farming_Sugarcane,
eProperty_Farming_Milk,
eProperty_Farming_Pumpkin,
eProperty_Farming_Rating,
eProperty_Farming_Max,
};
enum eProperty_Travelling
{
eProperty_Travelling_Walked=0,
eProperty_Travelling_Fallen,
eProperty_Travelling_Minecart,
eProperty_Travelling_Boat,
eProperty_Travelling_Rating,
eProperty_Travelling_Max,
};
enum eProperty_Travelling {
eProperty_Travelling_Walked = 0,
eProperty_Travelling_Fallen,
eProperty_Travelling_Minecart,
eProperty_Travelling_Boat,
eProperty_Travelling_Rating,
eProperty_Travelling_Max,
};
enum EStatsType
{
eStatsType_Travelling=0,
eStatsType_Mining,
eStatsType_Farming,
eStatsType_Kills,
eStatsType_MAX,
eStatsType_UNDEFINED
};
enum EStatsType {
eStatsType_Travelling = 0,
eStatsType_Mining,
eStatsType_Farming,
eStatsType_Kills,
eStatsType_MAX,
eStatsType_UNDEFINED
};
enum EFilterMode
{
eFM_Friends=0, //Stats belonging to current user's friends
eFM_MyScore, //Stats around the current user's rank
eFM_TopRank, //Stats at the top of the leaderboard
eNumFilterModes,
eFM_UNDEFINED
};
enum EFilterMode {
eFM_Friends = 0, // Stats belonging to current user's friends
eFM_MyScore, // Stats around the current user's rank
eFM_TopRank, // Stats at the top of the leaderboard
eNumFilterModes,
eFM_UNDEFINED
};
static const std::wstring filterNames[eNumFilterModes];
static const std::wstring filterNames[eNumFilterModes];
typedef struct KillsRecord
{
public:
unsigned short m_zombie;
unsigned short m_skeleton;
unsigned short m_creeper;
unsigned short m_spider;
unsigned short m_spiderJockey;
unsigned short m_zombiePigman;
unsigned short m_slime;
} KillsRecord;
typedef struct KillsRecord {
public:
unsigned short m_zombie;
unsigned short m_skeleton;
unsigned short m_creeper;
unsigned short m_spider;
unsigned short m_spiderJockey;
unsigned short m_zombiePigman;
unsigned short m_slime;
} KillsRecord;
typedef struct MiningRecord
{
public:
unsigned short m_dirt;
unsigned short m_stone;
unsigned short m_sand;
unsigned short m_cobblestone;
unsigned short m_gravel;
unsigned short m_clay;
unsigned short m_obsidian;
} MiningRecord;
typedef struct MiningRecord {
public:
unsigned short m_dirt;
unsigned short m_stone;
unsigned short m_sand;
unsigned short m_cobblestone;
unsigned short m_gravel;
unsigned short m_clay;
unsigned short m_obsidian;
} MiningRecord;
typedef struct FarmingRecord
{
public:
unsigned short m_eggs;
unsigned short m_wheat;
unsigned short m_mushroom;
unsigned short m_sugarcane;
unsigned short m_milk;
unsigned short m_pumpkin;
} FarmingRecord;
typedef struct FarmingRecord {
public:
unsigned short m_eggs;
unsigned short m_wheat;
unsigned short m_mushroom;
unsigned short m_sugarcane;
unsigned short m_milk;
unsigned short m_pumpkin;
} FarmingRecord;
typedef struct TravellingRecord
{
public:
unsigned int m_walked;
unsigned int m_fallen;
unsigned int m_minecart;
unsigned int m_boat;
} TravellingRecord;
typedef struct TravellingRecord {
public:
unsigned int m_walked;
unsigned int m_fallen;
unsigned int m_minecart;
unsigned int m_boat;
} TravellingRecord;
public:
static const int RECORD_SIZE = 40; //base32
static const int RECORD_SIZE = 40; // base32
typedef struct StatsData
{
EStatsType m_statsType;
union
{
LeaderboardManager::KillsRecord m_kills;
LeaderboardManager::MiningRecord m_mining;
LeaderboardManager::FarmingRecord m_farming;
LeaderboardManager::TravellingRecord m_travelling;
unsigned char m_padding[RECORD_SIZE];
};
} StatsData;
typedef struct StatsData {
EStatsType m_statsType;
union {
LeaderboardManager::KillsRecord m_kills;
LeaderboardManager::MiningRecord m_mining;
LeaderboardManager::FarmingRecord m_farming;
LeaderboardManager::TravellingRecord m_travelling;
unsigned char m_padding[RECORD_SIZE];
};
} StatsData;
typedef struct RegisterScore
{
int m_iPad;
int m_score;
int m_difficulty;
StatsData m_commentData;
} RegisterScore;
typedef struct RegisterScore {
int m_iPad;
int m_score;
int m_difficulty;
StatsData m_commentData;
} RegisterScore;
typedef struct ReadScore
{
// Maximum number of columns in a scoreboard.
static const unsigned int STATSDATA_MAX = 8;
typedef struct ReadScore {
// Maximum number of columns in a scoreboard.
static const unsigned int STATSDATA_MAX = 8;
PlayerUID m_uid; // Player's unique identifier.
unsigned long m_rank; // Rank of the player on this scoreboard.
std::wstring m_name; // Player's display name.
unsigned long m_totalScore; // Sum of all the player's scores on this leaderboard.
PlayerUID m_uid; // Player's unique identifier.
unsigned long m_rank; // Rank of the player on this scoreboard.
std::wstring m_name; // Player's display name.
unsigned short m_statsSize; // Iff (m_hasResults): Number of columns on this leaderboard.
unsigned long m_statsData[STATSDATA_MAX]; // Iff (m_hasResults): Player's score for each appropriate column.
unsigned long m_totalScore; // Sum of all the player's scores on this
// leaderboard.
int m_idsErrorMessage; // Iff (not m_hasResults): error message explaining what went wrong.
unsigned short m_statsSize; // Iff (m_hasResults): Number of columns on
// this leaderboard.
unsigned long
m_statsData[STATSDATA_MAX]; // Iff (m_hasResults): Player's score
// for each appropriate column.
} ReadScore;
int m_idsErrorMessage; // Iff (not m_hasResults): error message
// explaining what went wrong.
typedef struct ReadView
{
unsigned int m_numQueries;
ReadScore *m_queries;
} ReadScore;
} ReadView;
typedef ReadView ViewOut;
typedef RegisterScore *ViewIn;
typedef struct ReadView {
unsigned int m_numQueries;
ReadScore* m_queries;
} ReadView;
typedef ReadView ViewOut;
typedef RegisterScore* ViewIn;
public:
LeaderboardManager();
virtual ~LeaderboardManager() {}
LeaderboardManager();
virtual ~LeaderboardManager() {}
protected:
virtual void zeroReadParameters();
virtual void zeroReadParameters();
EFilterMode m_eFilterMode;
EFilterMode m_eFilterMode;
// Parameters for reading.
int m_difficulty;
EStatsType m_statsType;
LeaderboardReadListener *m_readListener;
PlayerUID m_myXUID;
unsigned int m_startIndex, m_readCount;
// Parameters for reading.
int m_difficulty;
EStatsType m_statsType;
LeaderboardReadListener* m_readListener;
PlayerUID m_myXUID;
unsigned int m_startIndex, m_readCount;
private:
static LeaderboardManager *m_instance; //Singleton instance of the LeaderboardManager
static LeaderboardManager*
m_instance; // Singleton instance of the LeaderboardManager
public:
static LeaderboardManager *Instance() { return m_instance; }
static void DeleteInstance();
static LeaderboardManager* Instance() { return m_instance; }
static void DeleteInstance();
virtual void Tick() = 0;
virtual void Tick() = 0;
//Open a session
virtual bool OpenSession() = 0;
// Open a session
virtual bool OpenSession() = 0;
//Close a session
virtual void CloseSession() = 0;
// Close a session
virtual void CloseSession() = 0;
//Delete a session
virtual void DeleteSession() = 0;
// Delete a session
virtual void DeleteSession() = 0;
//Write the given stats
//This is called synchronously and will not free any memory allocated for views when it is done
// Write the given stats
// This is called synchronously and will not free any memory allocated for
// views when it is done
virtual bool WriteStats(unsigned int viewCount, ViewIn views) = 0;
virtual bool WriteStats(unsigned int viewCount, ViewIn views) = 0;
virtual bool ReadStats_Friends(LeaderboardReadListener *callback, int difficulty, EStatsType type, PlayerUID myUID, unsigned int startIndex, unsigned int readCount);
virtual bool ReadStats_MyScore(LeaderboardReadListener *callback, int difficulty, EStatsType type, PlayerUID myUID, unsigned int readCount);
virtual bool ReadStats_TopRank(LeaderboardReadListener *callback, int difficulty, EStatsType type, unsigned int startIndex, unsigned int readCount);
virtual bool ReadStats_Friends(LeaderboardReadListener* callback,
int difficulty, EStatsType type,
PlayerUID myUID, unsigned int startIndex,
unsigned int readCount);
virtual bool ReadStats_MyScore(LeaderboardReadListener* callback,
int difficulty, EStatsType type,
PlayerUID myUID, unsigned int readCount);
virtual bool ReadStats_TopRank(LeaderboardReadListener* callback,
int difficulty, EStatsType type,
unsigned int startIndex,
unsigned int readCount);
//Perform a flush of the stats
virtual void FlushStats() = 0;
// Perform a flush of the stats
virtual void FlushStats() = 0;
//Cancel the current operation
virtual void CancelOperation() = 0;
// Cancel the current operation
virtual void CancelOperation() = 0;
//Is the leaderboard manager idle.
virtual bool isIdle() = 0;
// Is the leaderboard manager idle.
virtual bool isIdle() = 0;
public:
static void printStats(ReadView &view);
static void printStats(ReadView& view);
};
class LeaderboardReadListener
{
class LeaderboardReadListener {
public:
virtual bool OnStatsReadComplete(LeaderboardManager::eStatsReturn ret, int numResults, LeaderboardManager::ViewOut results) = 0;
virtual bool OnStatsReadComplete(LeaderboardManager::eStatsReturn ret,
int numResults,
LeaderboardManager::ViewOut results) = 0;
};
class DebugReadListener : public LeaderboardReadListener
{
class DebugReadListener : public LeaderboardReadListener {
public:
virtual bool OnStatsReadComplete(LeaderboardManager::eStatsReturn ret, int numResults, LeaderboardManager::ViewOut results);
static DebugReadListener *m_instance;
virtual bool OnStatsReadComplete(LeaderboardManager::eStatsReturn ret,
int numResults,
LeaderboardManager::ViewOut results);
static DebugReadListener* m_instance;
};

View file

@ -236,88 +236,86 @@ bool SonyLeaderboardManager::getScoreByIds() {
/* app.DebugPrintf("sceNpScoreGetRankingByNpId(\n\t transaction=%i,\n\t
boardID=0,\n\t npId=%i,\n\t friendCount*sizeof(SceNpId)=%i*%i=%i,\
rankData=%i,\n\t friendCount*sizeof(SceNpScorePlayerRankData)=%i,\n\t nullptr,
0, nullptr, 0,\n\t friendCount=%i,\n...\n", transaction, npId, friendCount,
sizeof(SceNpId), friendCount*sizeof(SceNpId), rankData,
rankData=%i,\n\t friendCount*sizeof(SceNpScorePlayerRankData)=%i,\n\t
nullptr, 0, nullptr, 0,\n\t friendCount=%i,\n...\n", transaction, npId,
friendCount, sizeof(SceNpId), friendCount*sizeof(SceNpId), rankData,
friendCount*sizeof(SceNpScorePlayerRankData), friendCount
); */
int boardId = getBoardId(m_difficulty, m_statsType);
// 4J-JEV: Orbis can only do with 100 ids max, so we use batches.
ret = createTransactionContext(m_titleContext);
if (m_eStatsState == eStatsState_Canceled) {
// Cancel operation has been called, abort.
app.DebugPrintf(
"[SonyLeaderboardManager]\tgetScoreByIds() - m_eStatsState == "
"eStatsState_Canceled.\n");
ret = createTransactionContext(m_titleContext);
if (m_eStatsState == eStatsState_Canceled) {
// Cancel operation has been called, abort.
app.DebugPrintf(
"[SonyLeaderboardManager]\tgetScoreByIds() - m_eStatsState == "
"eStatsState_Canceled.\n");
destroyTransactionContext(ret);
destroyTransactionContext(ret);
if (npIds != nullptr) delete[] npIds;
if (ptr != nullptr) delete[] ptr;
if (comments != nullptr) delete[] comments;
if (npIds != nullptr) delete[] npIds;
if (ptr != nullptr) delete[] ptr;
if (comments != nullptr) delete[] comments;
return false;
} else if (ret < 0) {
// Error occurred creating a transacion, abort.
app.DebugPrintf(
"[SonyLeaderboardManager]\tgetScoreByIds() - createTransaction "
"failed, ret=0x%X\n",
ret);
return false;
} else if (ret < 0) {
// Error occurred creating a transacion, abort.
app.DebugPrintf(
"[SonyLeaderboardManager]\tgetScoreByIds() - createTransaction "
"failed, ret=0x%X\n",
ret);
m_eStatsState = eStatsState_Failed;
m_eStatsState = eStatsState_Failed;
if (npIds != nullptr) delete[] npIds;
if (ptr != nullptr) delete[] ptr;
if (comments != nullptr) delete[] comments;
if (npIds != nullptr) delete[] npIds;
if (ptr != nullptr) delete[] ptr;
if (comments != nullptr) delete[] comments;
return false;
} else {
// Transaction created successfully, continue.
m_requestId = ret;
}
return false;
} else {
// Transaction created successfully, continue.
m_requestId = ret;
}
int tmpNum = num;
ret = sceNpScoreGetRankingByNpId(
m_requestId,
boardId, // BoardId
ret = sceNpScoreGetRankingByNpId(
m_requestId,
boardId, // BoardId
npIds, sizeof(SceNpId) * tmpNum, // IN: Player IDs
ptr, sizeof(SceNpScorePlayerRankData) * tmpNum, // OUT: Rank Data
comments, sizeof(SceNpScoreComment) * tmpNum, // OUT: Comments
nullptr, 0, // GameData. (unused)
nullptr, 0, // GameData. (unused)
tmpNum,
tmpNum,
&last_sort_date, &mTotalRecord,
&last_sort_date, &mTotalRecord,
nullptr // Reserved, specify null.
);
nullptr // Reserved, specify null.
);
if (ret == SCE_NP_COMMUNITY_ERROR_ABORTED) {
ret = destroyTransactionContext(m_requestId);
app.DebugPrintf(
"[SonyLeaderboardManager] getScoreByIds(): "
"'sceNpScoreGetRankingByRange' aborted (0x%X).\n",
ret);
if (ret == SCE_NP_COMMUNITY_ERROR_ABORTED) {
ret = destroyTransactionContext(m_requestId);
app.DebugPrintf(
"[SonyLeaderboardManager] getScoreByIds(): "
"'sceNpScoreGetRankingByRange' aborted (0x%X).\n",
ret);
delete[] ptr;
delete[] comments;
delete[] npIds;
delete[] ptr;
delete[] comments;
delete[] npIds;
return false;
} else if (ret ==
SCE_NP_COMMUNITY_SERVER_ERROR_GAME_RANKING_NOT_FOUND) {
// 4J-JEV: Keep going, other batches might have scores.
} else if (ret < 0)
goto error3;
// Return.
destroyTransactionContext(m_requestId);
m_requestId = 0;
return false;
} else if (ret == SCE_NP_COMMUNITY_SERVER_ERROR_GAME_RANKING_NOT_FOUND) {
// 4J-JEV: Keep going, other batches might have scores.
} else if (ret < 0)
goto error3;
// Return.
destroyTransactionContext(m_requestId);
m_requestId = 0;
m_readCount = num;
@ -544,7 +542,7 @@ bool SonyLeaderboardManager::setScore() {
rscore.m_score, // IN: new score,
&comment, // Comments
nullptr, // GameInfo
nullptr, // GameInfo
&tmp, // OUT: current rank,

View file

@ -131,6 +131,5 @@ protected:
virtual int32_t fillByIdsQuery(const SceNpId& myNpId, SceNpId*& npIds,
uint32_t& len);
virtual char* getComment(SceNpScoreComment* comment) = 0;
};

View file

@ -37,44 +37,50 @@
#include <algorithm>
#include <stdexcept>
//
// Depending on the url parameter in base64_chars, one of
// two sets of base64 characters needs to be chosen.
// They differ in their last two characters.
//
//
// Depending on the url parameter in base64_chars, one of
// two sets of base64 characters needs to be chosen.
// They differ in their last two characters.
//
static const char* base64_chars[2] = {
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz"
"0123456789"
"+/",
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz"
"0123456789"
"+/",
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz"
"0123456789"
"-_"};
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz"
"0123456789"
"-_"};
static unsigned int pos_of_char(const unsigned char chr) {
//
// Return the position of chr within base64_encode()
//
//
// Return the position of chr within base64_encode()
//
if (chr >= 'A' && chr <= 'Z') return chr - 'A';
else if (chr >= 'a' && chr <= 'z') return chr - 'a' + ('Z' - 'A') + 1;
else if (chr >= '0' && chr <= '9') return chr - '0' + ('Z' - 'A') + ('z' - 'a') + 2;
else if (chr == '+' || chr == '-') return 62; // Be liberal with input and accept both url ('-') and non-url ('+') base 64 characters (
else if (chr == '/' || chr == '_') return 63; // Ditto for '/' and '_'
if (chr >= 'A' && chr <= 'Z')
return chr - 'A';
else if (chr >= 'a' && chr <= 'z')
return chr - 'a' + ('Z' - 'A') + 1;
else if (chr >= '0' && chr <= '9')
return chr - '0' + ('Z' - 'A') + ('z' - 'a') + 2;
else if (chr == '+' || chr == '-')
return 62; // Be liberal with input and accept both url ('-') and
// non-url ('+') base 64 characters (
else if (chr == '/' || chr == '_')
return 63; // Ditto for '/' and '_'
else
//
// 2020-10-23: Throw std::exception rather than const char*
//(Pablo Martin-Gomez, https://github.com/Bouska)
//
throw std::runtime_error("Input is not valid base64-encoded data.");
//
// 2020-10-23: Throw std::exception rather than const char*
//(Pablo Martin-Gomez, https://github.com/Bouska)
//
throw std::runtime_error("Input is not valid base64-encoded data.");
}
static std::string insert_linebreaks(std::string str, size_t distance) {
//
// Provided by https://github.com/JomaCorpFX, adapted by me.
//
//
// Provided by https://github.com/JomaCorpFX, adapted by me.
//
if (!str.length()) {
return "";
}
@ -91,39 +97,40 @@ static std::string insert_linebreaks(std::string str, size_t distance) {
template <typename String, unsigned int line_length>
static std::string encode_with_line_breaks(String s) {
return insert_linebreaks(base64_encode(s, false), line_length);
return insert_linebreaks(base64_encode(s, false), line_length);
}
template <typename String>
static std::string encode_pem(String s) {
return encode_with_line_breaks<String, 64>(s);
return encode_with_line_breaks<String, 64>(s);
}
template <typename String>
static std::string encode_mime(String s) {
return encode_with_line_breaks<String, 76>(s);
return encode_with_line_breaks<String, 76>(s);
}
template <typename String>
static std::string encode(String s, bool url) {
return base64_encode(reinterpret_cast<const unsigned char*>(s.data()), s.length(), url);
return base64_encode(reinterpret_cast<const unsigned char*>(s.data()),
s.length(), url);
}
std::string base64_encode(unsigned char const* bytes_to_encode, size_t in_len, bool url) {
size_t len_encoded = (in_len +2) / 3 * 4;
std::string base64_encode(unsigned char const* bytes_to_encode, size_t in_len,
bool url) {
size_t len_encoded = (in_len + 2) / 3 * 4;
unsigned char trailing_char = url ? '.' : '=';
//
// Choose set of base64 characters. They differ
// for the last two positions, depending on the url
// parameter.
// A bool (as is the parameter url) is guaranteed
// to evaluate to either 0 or 1 in C++ therefore,
// the correct character set is chosen by subscripting
// base64_chars with url.
//
//
// Choose set of base64 characters. They differ
// for the last two positions, depending on the url
// parameter.
// A bool (as is the parameter url) is guaranteed
// to evaluate to either 0 or 1 in C++ therefore,
// the correct character set is chosen by subscripting
// base64_chars with url.
//
const char* base64_chars_ = base64_chars[url];
std::string ret;
@ -134,21 +141,24 @@ std::string base64_encode(unsigned char const* bytes_to_encode, size_t in_len, b
while (pos < in_len) {
ret.push_back(base64_chars_[(bytes_to_encode[pos + 0] & 0xfc) >> 2]);
if (pos+1 < in_len) {
ret.push_back(base64_chars_[((bytes_to_encode[pos + 0] & 0x03) << 4) + ((bytes_to_encode[pos + 1] & 0xf0) >> 4)]);
if (pos + 1 < in_len) {
ret.push_back(
base64_chars_[((bytes_to_encode[pos + 0] & 0x03) << 4) +
((bytes_to_encode[pos + 1] & 0xf0) >> 4)]);
if (pos+2 < in_len) {
ret.push_back(base64_chars_[((bytes_to_encode[pos + 1] & 0x0f) << 2) + ((bytes_to_encode[pos + 2] & 0xc0) >> 6)]);
ret.push_back(base64_chars_[ bytes_to_encode[pos + 2] & 0x3f]);
}
else {
ret.push_back(base64_chars_[(bytes_to_encode[pos + 1] & 0x0f) << 2]);
ret.push_back(trailing_char);
}
}
else {
ret.push_back(base64_chars_[(bytes_to_encode[pos + 0] & 0x03) << 4]);
if (pos + 2 < in_len) {
ret.push_back(
base64_chars_[((bytes_to_encode[pos + 1] & 0x0f) << 2) +
((bytes_to_encode[pos + 2] & 0xc0) >> 6)]);
ret.push_back(base64_chars_[bytes_to_encode[pos + 2] & 0x3f]);
} else {
ret.push_back(
base64_chars_[(bytes_to_encode[pos + 1] & 0x0f) << 2]);
ret.push_back(trailing_char);
}
} else {
ret.push_back(
base64_chars_[(bytes_to_encode[pos + 0] & 0x03) << 4]);
ret.push_back(trailing_char);
ret.push_back(trailing_char);
}
@ -156,106 +166,110 @@ std::string base64_encode(unsigned char const* bytes_to_encode, size_t in_len, b
pos += 3;
}
return ret;
}
template <typename String>
static std::string decode(String const& encoded_string, bool remove_linebreaks) {
//
// decode(…) is templated so that it can be used with String = const std::string&
// or std::string_view (requires at least C++17)
//
static std::string decode(String const& encoded_string,
bool remove_linebreaks) {
//
// decode(…) is templated so that it can be used with String = const
// std::string& or std::string_view (requires at least C++17)
//
if (encoded_string.empty()) return std::string();
if (remove_linebreaks) {
std::string copy(encoded_string);
std::string copy(encoded_string);
copy.erase(std::remove(copy.begin(), copy.end(), '\n'), copy.end());
copy.erase(std::remove(copy.begin(), copy.end(), '\n'), copy.end());
return base64_decode(copy, false);
return base64_decode(copy, false);
}
size_t length_of_string = encoded_string.length();
size_t pos = 0;
//
// The approximate length (bytes) of the decoded string might be one or
// two bytes smaller, depending on the amount of trailing equal signs
// in the encoded string. This approximation is needed to reserve
// enough space in the string to be returned.
//
//
// The approximate length (bytes) of the decoded string might be one or
// two bytes smaller, depending on the amount of trailing equal signs
// in the encoded string. This approximation is needed to reserve
// enough space in the string to be returned.
//
size_t approx_length_of_decoded_string = length_of_string / 4 * 3;
std::string ret;
ret.reserve(approx_length_of_decoded_string);
while (pos < length_of_string) {
//
// Iterate over encoded input string in chunks. The size of all
// chunks except the last one is 4 bytes.
//
// The last chunk might be padded with equal signs or dots
// in order to make it 4 bytes in size as well, but this
// is not required as per RFC 2045.
//
// All chunks except the last one produce three output bytes.
//
// The last chunk produces at least one and up to three bytes.
//
//
// Iterate over encoded input string in chunks. The size of all
// chunks except the last one is 4 bytes.
//
// The last chunk might be padded with equal signs or dots
// in order to make it 4 bytes in size as well, but this
// is not required as per RFC 2045.
//
// All chunks except the last one produce three output bytes.
//
// The last chunk produces at least one and up to three bytes.
//
size_t pos_of_char_1 = pos_of_char(encoded_string.at(pos+1) );
size_t pos_of_char_1 = pos_of_char(encoded_string.at(pos + 1));
//
// Emit the first output byte that is produced in each chunk:
//
ret.push_back(static_cast<std::string::value_type>( ( (pos_of_char(encoded_string.at(pos+0)) ) << 2 ) + ( (pos_of_char_1 & 0x30 ) >> 4)));
//
// Emit the first output byte that is produced in each chunk:
//
ret.push_back(static_cast<std::string::value_type>(
((pos_of_char(encoded_string.at(pos + 0))) << 2) +
((pos_of_char_1 & 0x30) >> 4)));
if ( ( pos + 2 < length_of_string ) && // Check for data that is not padded with equal signs (which is allowed by RFC 2045)
encoded_string.at(pos+2) != '=' &&
encoded_string.at(pos+2) != '.' // accept URL-safe base 64 strings, too, so check for '.' also.
)
{
//
// Emit a chunk's second byte (which might not be produced in the last chunk).
//
unsigned int pos_of_char_2 = pos_of_char(encoded_string.at(pos+2) );
ret.push_back(static_cast<std::string::value_type>( (( pos_of_char_1 & 0x0f) << 4) + (( pos_of_char_2 & 0x3c) >> 2)));
if ((pos + 2 <
length_of_string) && // Check for data that is not padded with
// equal signs (which is allowed by RFC 2045)
encoded_string.at(pos + 2) != '=' &&
encoded_string.at(pos + 2) !=
'.' // accept URL-safe base 64 strings, too, so check for '.'
// also.
) {
//
// Emit a chunk's second byte (which might not be produced in the
// last chunk).
//
unsigned int pos_of_char_2 =
pos_of_char(encoded_string.at(pos + 2));
ret.push_back(static_cast<std::string::value_type>(
((pos_of_char_1 & 0x0f) << 4) + ((pos_of_char_2 & 0x3c) >> 2)));
if ( ( pos + 3 < length_of_string ) &&
encoded_string.at(pos+3) != '=' &&
encoded_string.at(pos+3) != '.'
)
{
//
// Emit a chunk's third byte (which might not be produced in the last chunk).
//
ret.push_back(static_cast<std::string::value_type>( ( (pos_of_char_2 & 0x03 ) << 6 ) + pos_of_char(encoded_string.at(pos+3)) ));
}
}
if ((pos + 3 < length_of_string) &&
encoded_string.at(pos + 3) != '=' &&
encoded_string.at(pos + 3) != '.') {
//
// Emit a chunk's third byte (which might not be produced in the
// last chunk).
//
ret.push_back(static_cast<std::string::value_type>(
((pos_of_char_2 & 0x03) << 6) +
pos_of_char(encoded_string.at(pos + 3))));
}
}
pos += 4;
pos += 4;
}
return ret;
}
std::string base64_decode(std::string const& s, bool remove_linebreaks) {
return decode(s, remove_linebreaks);
return decode(s, remove_linebreaks);
}
std::string base64_encode(std::string const& s, bool url) {
return encode(s, url);
return encode(s, url);
}
std::string base64_encode_pem (std::string const& s) {
return encode_pem(s);
}
std::string base64_encode_pem(std::string const& s) { return encode_pem(s); }
std::string base64_encode_mime(std::string const& s) {
return encode_mime(s);
}
std::string base64_encode_mime(std::string const& s) { return encode_mime(s); }
#if __cplusplus >= 201703L
//
@ -265,19 +279,15 @@ std::string base64_encode_mime(std::string const& s) {
//
std::string base64_encode(std::string_view s, bool url) {
return encode(s, url);
return encode(s, url);
}
std::string base64_encode_pem(std::string_view s) {
return encode_pem(s);
}
std::string base64_encode_pem(std::string_view s) { return encode_pem(s); }
std::string base64_encode_mime(std::string_view s) {
return encode_mime(s);
}
std::string base64_encode_mime(std::string_view s) { return encode_mime(s); }
std::string base64_decode(std::string_view s, bool remove_linebreaks) {
return decode(s, remove_linebreaks);
return decode(s, remove_linebreaks);
}
#endif // __cplusplus >= 201703L

View file

@ -12,8 +12,8 @@
#include <string_view>
#endif // __cplusplus >= 201703L
std::string base64_encode (std::string const& s, bool url = false);
std::string base64_encode_pem (std::string const& s);
std::string base64_encode(std::string const& s, bool url = false);
std::string base64_encode_pem(std::string const& s);
std::string base64_encode_mime(std::string const& s);
std::string base64_decode(std::string const& s, bool remove_linebreaks = false);
@ -25,8 +25,8 @@ std::string base64_encode(unsigned char const*, size_t len, bool url = false);
// Requires C++17
// Provided by Yannic Bonenberger (https://github.com/Yannic)
//
std::string base64_encode (std::string_view s, bool url = false);
std::string base64_encode_pem (std::string_view s);
std::string base64_encode(std::string_view s, bool url = false);
std::string base64_encode_pem(std::string_view s);
std::string base64_encode_mime(std::string_view s);
std::string base64_decode(std::string_view s, bool remove_linebreaks = false);

View file

@ -7,38 +7,56 @@
// 5 bits alpha
// 1 bit decoration
// 3 bits poptime
// 8 bits unused // was 11 bits aux val but needed 15 bits for potions so moved to item bitmask
// 6 bits count
// 6 bits scale
// 8 bits unused // was 11 bits aux val but needed 15 bits for potions so moved
// to item bitmask 6 bits count 6 bits scale
// uiCount is up to 64, but can't ever be 0, so to make it 6 bits, subtract one from the packing, and add one on the unpacking
#define MAKE_SLOTDISPLAY_DATA_BITMASK(uiUserIndex,uiAlpha,bDecorations,uiCount,uiScale,uiPopTime) ((((uiUserIndex&0x7)<<29) | (uiAlpha&0x1F)<<24) | (bDecorations?0x800000:0) | ((uiPopTime&0x7)<<20) | ((uiCount-1)<<6) | (uiScale&0x3F))
// uiCount is up to 64, but can't ever be 0, so to make it 6 bits, subtract one
// from the packing, and add one on the unpacking
#define MAKE_SLOTDISPLAY_DATA_BITMASK(uiUserIndex, uiAlpha, bDecorations, \
uiCount, uiScale, uiPopTime) \
((((uiUserIndex & 0x7) << 29) | (uiAlpha & 0x1F) << 24) | \
(bDecorations ? 0x800000 : 0) | ((uiPopTime & 0x7) << 20) | \
((uiCount - 1) << 6) | (uiScale & 0x3F))
#define GET_SLOTDISPLAY_USERINDEX_FROM_DATA_BITMASK(uiBitmask) ((((unsigned int)uiBitmask)>>29)&0x7)
#define GET_SLOTDISPLAY_ALPHA_FROM_DATA_BITMASK(uiBitmask) ((((unsigned int)uiBitmask)>>24)&0x1F)
#define GET_SLOTDISPLAY_DECORATIONS_FROM_DATA_BITMASK(uiBitmask) ((((unsigned int)uiBitmask)&0x800000)?true:false)
//#define GET_SLOTDISPLAY_AUXVAL_FROM_DATA_BITMASK(uiBitmask) ((((unsigned long)uiBitmask)>>12)&0x7FF)
#define GET_SLOTDISPLAY_COUNT_FROM_DATA_BITMASK(uiBitmask) (((((unsigned int)uiBitmask)>>6)&0x3F)+1)
#define GET_SLOTDISPLAY_SCALE_FROM_DATA_BITMASK(uiBitmask) (((unsigned int)uiBitmask)&0x3F)
#define GET_SLOTDISPLAY_POPTIME_FROM_DATA_BITMASK(uiBitmask) ((((unsigned int)uiBitmask)>>20)&0x7)
#define GET_SLOTDISPLAY_USERINDEX_FROM_DATA_BITMASK(uiBitmask) \
((((unsigned int)uiBitmask) >> 29) & 0x7)
#define GET_SLOTDISPLAY_ALPHA_FROM_DATA_BITMASK(uiBitmask) \
((((unsigned int)uiBitmask) >> 24) & 0x1F)
#define GET_SLOTDISPLAY_DECORATIONS_FROM_DATA_BITMASK(uiBitmask) \
((((unsigned int)uiBitmask) & 0x800000) ? true : false)
// #define GET_SLOTDISPLAY_AUXVAL_FROM_DATA_BITMASK(uiBitmask)
// ((((unsigned long)uiBitmask)>>12)&0x7FF)
#define GET_SLOTDISPLAY_COUNT_FROM_DATA_BITMASK(uiBitmask) \
(((((unsigned int)uiBitmask) >> 6) & 0x3F) + 1)
#define GET_SLOTDISPLAY_SCALE_FROM_DATA_BITMASK(uiBitmask) \
(((unsigned int)uiBitmask) & 0x3F)
#define GET_SLOTDISPLAY_POPTIME_FROM_DATA_BITMASK(uiBitmask) \
((((unsigned int)uiBitmask) >> 20) & 0x7)
// 16 bits for id (either item id or xzp icon id)
// 15 bits for aux value
// 1 bit for foil
#define MAKE_SLOTDISPLAY_ITEM_BITMASK(uiId,uiAuxValue,bFoil) ( (uiId & 0xFFFF) | ((uiAuxValue & 0x7FFF) << 16) | (bFoil?0x80000000:0) )
#define GET_SLOTDISPLAY_ID_FROM_ITEM_BITMASK(uiBitmask) (((unsigned int)uiBitmask)&0xFFFF)
#define GET_SLOTDISPLAY_AUXVAL_FROM_ITEM_BITMASK(uiBitmask) ((((unsigned int)uiBitmask)>>16) & 0x7FFF)
#define GET_SLOTDISPLAY_FOIL_FROM_ITEM_BITMASK(uiBitmask) ((((unsigned int)uiBitmask)&0x80000000)?true:false)
#define MAKE_SLOTDISPLAY_ITEM_BITMASK(uiId, uiAuxValue, bFoil) \
((uiId & 0xFFFF) | ((uiAuxValue & 0x7FFF) << 16) | (bFoil ? 0x80000000 : 0))
#define GET_SLOTDISPLAY_ID_FROM_ITEM_BITMASK(uiBitmask) \
(((unsigned int)uiBitmask) & 0xFFFF)
#define GET_SLOTDISPLAY_AUXVAL_FROM_ITEM_BITMASK(uiBitmask) \
((((unsigned int)uiBitmask) >> 16) & 0x7FFF)
#define GET_SLOTDISPLAY_FOIL_FROM_ITEM_BITMASK(uiBitmask) \
((((unsigned int)uiBitmask) & 0x80000000) ? true : false)
// For encoding the players skin selection in their profile
// bDlcSkin = false is a players skin, bDlcSkin = true is a DLC skin
#define MAKE_SKIN_BITMASK(bDlcSkin, dwSkinId) ( (bDlcSkin?0x80000000:0) | (dwSkinId & 0x7FFFFFFF) )
#define MAKE_SKIN_BITMASK(bDlcSkin, dwSkinId) \
((bDlcSkin ? 0x80000000 : 0) | (dwSkinId & 0x7FFFFFFF))
#define IS_SKIN_ID_IN_RANGE(dwSkinId) (dwSkinId <= 0x7FFFFFFF)
#define GET_DLC_SKIN_ID_FROM_BITMASK(uiBitmask) (static_cast<std::uint32_t>(uiBitmask) & 0x7FFFFFFF)
#define GET_UGC_SKIN_ID_FROM_BITMASK(uiBitmask) (static_cast<std::uint32_t>(uiBitmask) & 0x7FFFFFE0)
#define GET_DEFAULT_SKIN_ID_FROM_BITMASK(uiBitmask) (static_cast<std::uint32_t>(uiBitmask) & 0x0000001F)
#define GET_IS_DLC_SKIN_FROM_BITMASK(uiBitmask) ((static_cast<std::uint32_t>(uiBitmask) & 0x80000000) ? true : false)
#define GET_DLC_SKIN_ID_FROM_BITMASK(uiBitmask) \
(static_cast<std::uint32_t>(uiBitmask) & 0x7FFFFFFF)
#define GET_UGC_SKIN_ID_FROM_BITMASK(uiBitmask) \
(static_cast<std::uint32_t>(uiBitmask) & 0x7FFFFFE0)
#define GET_DEFAULT_SKIN_ID_FROM_BITMASK(uiBitmask) \
(static_cast<std::uint32_t>(uiBitmask) & 0x0000001F)
#define GET_IS_DLC_SKIN_FROM_BITMASK(uiBitmask) \
((static_cast<std::uint32_t>(uiBitmask) & 0x80000000) ? true : false)

View file

@ -34,7 +34,6 @@
#include "../UI/UI.h"
#include "../UI/UIScene_PauseMenu.h"
// Global instance
CGameNetworkManager g_NetworkManager;
CPlatformNetworkManager* CGameNetworkManager::s_pPlatformNetworkManager;
@ -47,7 +46,6 @@ CGameNetworkManager::CGameNetworkManager() {
m_bInitialised = false;
m_bLastDisconnectWasLostRoomOnly = false;
m_bFullSessionMessageOnNextSessionChange = false;
}
void CGameNetworkManager::Initialise() {
@ -69,10 +67,7 @@ void CGameNetworkManager::Terminate() {
}
}
void CGameNetworkManager::DoWork() {
s_pPlatformNetworkManager->DoWork();
}
void CGameNetworkManager::DoWork() { s_pPlatformNetworkManager->DoWork(); }
bool CGameNetworkManager::_RunNetworkGame(void* lpParameter) {
bool success = true;
@ -113,7 +108,6 @@ bool CGameNetworkManager::_RunNetworkGame(void* lpParameter) {
bool CGameNetworkManager::StartNetworkGame(Minecraft* minecraft,
void* lpParameter) {
int64_t seed = 0;
if (lpParameter != nullptr) {
NetworkGameInitData* param = (NetworkGameInitData*)lpParameter;
@ -156,13 +150,13 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft* minecraft,
GENERIC_READ, // access mode
0, // share mode // TODO 4J Stu - Will we need
// to share file? Probably not but...
nullptr, // Unused
nullptr, // Unused
OPEN_EXISTING, // how to create // TODO 4J Stu
// - Assuming that the file
// already exists if we are
// opening to read from it
FILE_FLAG_SEQUENTIAL_SCAN, // file attributes
nullptr // Unsupported
nullptr // Unsupported
);
#else
const char* pchFilename =
@ -172,20 +166,21 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft* minecraft,
GENERIC_READ, // access mode
0, // share mode // TODO 4J Stu - Will we need
// to share file? Probably not but...
nullptr, // Unused
nullptr, // Unused
OPEN_EXISTING, // how to create // TODO 4J Stu
// - Assuming that the file
// already exists if we are
// opening to read from it
FILE_FLAG_SEQUENTIAL_SCAN, // file attributes
nullptr // Unsupported
nullptr // Unsupported
);
#endif
if (fileHandle != INVALID_HANDLE_VALUE) {
uint32_t bytesRead,
dwFileSize = GetFileSize(fileHandle, nullptr);
uint8_t* pbData = (uint8_t*) new uint8_t[dwFileSize];
uint32_t bytesRead, dwFileSize = GetFileSize(
fileHandle, nullptr);
uint8_t* pbData =
(uint8_t*)new uint8_t[dwFileSize];
bool bSuccess =
ReadFile(fileHandle, pbData, dwFileSize,
&bytesRead, nullptr);
@ -483,7 +478,7 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft* minecraft,
} else {
connection->close();
auto it = find(createdConnections.begin(),
createdConnections.end(), connection);
createdConnections.end(), connection);
if (it != createdConnections.end())
createdConnections.erase(it);
}
@ -552,7 +547,6 @@ INetworkPlayer* CGameNetworkManager::GetPlayerBySmallId(unsigned char smallId) {
return s_pPlatformNetworkManager->GetPlayerBySmallId(smallId);
}
INetworkPlayer* CGameNetworkManager::GetHostPlayer() {
return s_pPlatformNetworkManager->GetHostPlayer();
}
@ -689,8 +683,7 @@ CGameNetworkManager::eJoinGameResult CGameNetworkManager::JoinGame(
searchResult, localUsersMask, primaryUserIndex));
}
void CGameNetworkManager::CancelJoinGame(void* lpParam) {
}
void CGameNetworkManager::CancelJoinGame(void* lpParam) {}
bool CGameNetworkManager::LeaveGame(bool bMigrateHost) {
Minecraft::GetInstance()->gui->clearMessages();
@ -703,7 +696,6 @@ int CGameNetworkManager::JoinFromInvite_SignInReturned(void* pParam,
INVITE_INFO* pInviteInfo = (INVITE_INFO*)pParam;
if (bContinue == true) {
app.DebugPrintf("JoinFromInvite_SignInReturned, iPad %d\n", iPad);
// It's possible that the player has not signed in - they can back out
if (ProfileManager.IsSignedIn(iPad) &&
@ -833,7 +825,6 @@ int CGameNetworkManager::RunNetworkGameThreadProc(void* lpParameter) {
return -1;
}
Tile::ReleaseThreadStorage();
return 0;
}
@ -899,7 +890,6 @@ int CGameNetworkManager::ExitAndJoinFromInviteThreadProc(void* lpParam) {
return S_OK;
}
void CGameNetworkManager::_LeaveGame() {
s_pPlatformNetworkManager->_LeaveGame(false, true);
}
@ -912,10 +902,10 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc(void* lpParam) {
Minecraft* pMinecraft = Minecraft::GetInstance();
MinecraftServer* pServer = MinecraftServer::getInstance();
pMinecraft->progressRenderer->progressStartNoAbort(
g_NetworkManager.CorrectErrorIDS(IDS_CONNECTION_LOST_LIVE_NO_EXIT));
pMinecraft->progressRenderer->progressStage(
IDS_PROGRESS_CONVERTING_TO_OFFLINE_GAME);
pMinecraft->progressRenderer->progressStartNoAbort(
g_NetworkManager.CorrectErrorIDS(IDS_CONNECTION_LOST_LIVE_NO_EXIT));
pMinecraft->progressRenderer->progressStage(
IDS_PROGRESS_CONVERTING_TO_OFFLINE_GAME);
while (app.GetXuiServerAction(ProfileManager.GetPrimaryPad()) !=
eXuiServerAction_Idle &&
@ -928,20 +918,19 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc(void* lpParam) {
// wait for the server to be in a non-ticking state
pServer->m_serverPausedEvent->WaitForSignal(INFINITE);
pMinecraft->progressRenderer->progressStartNoAbort(
g_NetworkManager.CorrectErrorIDS(IDS_CONNECTION_LOST_LIVE_NO_EXIT));
pMinecraft->progressRenderer->progressStage(
IDS_PROGRESS_CONVERTING_TO_OFFLINE_GAME);
pMinecraft->progressRenderer->progressStartNoAbort(
g_NetworkManager.CorrectErrorIDS(IDS_CONNECTION_LOST_LIVE_NO_EXIT));
pMinecraft->progressRenderer->progressStage(
IDS_PROGRESS_CONVERTING_TO_OFFLINE_GAME);
pMinecraft->progressRenderer->progressStagePercentage(25);
// Null the network player of all the server players that are local, to stop
// them being removed from the server when removed from the session
if (pServer != nullptr) {
PlayerList* players = pServer->getPlayers();
for (auto it = players->players.begin();
it < players->players.end(); ++it) {
for (auto it = players->players.begin(); it < players->players.end();
++it) {
std::shared_ptr<ServerPlayer> servPlayer = *it;
if (servPlayer->connection->isLocal() &&
!servPlayer->connection->isGuest()) {
@ -1073,8 +1062,7 @@ std::wstring CGameNetworkManager::GatherStats() {
return s_pPlatformNetworkManager->GatherStats();
}
void CGameNetworkManager::renderQueueMeter() {
}
void CGameNetworkManager::renderQueueMeter() {}
std::wstring CGameNetworkManager::GatherRTTStats() {
return s_pPlatformNetworkManager->GatherRTTStats();
@ -1125,7 +1113,6 @@ void CGameNetworkManager::StateChange_JoiningToIdle(
}
void CGameNetworkManager::StateChange_AnyToStarting() {
if (!g_NetworkManager.IsHost()) {
LoadingInputParams* loadingParams = new LoadingInputParams();
loadingParams->func = &CGameNetworkManager::RunNetworkGameThreadProc;
@ -1321,7 +1308,8 @@ void CGameNetworkManager::GameInviteReceived(int userIndex,
// except for the invited player (who may be an inactive player) 4J
// Stu - If we are not in a game, then bring in all players signed
// in
if (index == userIndex || pMinecraft->localplayers[index] != nullptr) {
if (index == userIndex ||
pMinecraft->localplayers[index] != nullptr) {
++joiningUsers;
if (!ProfileManager.AllowedToPlayMultiplayer(index))
noPrivileges = true;
@ -1340,16 +1328,14 @@ void CGameNetworkManager::GameInviteReceived(int userIndex,
ProfileManager.GetPrimaryPad(), false, &pccAllowed, &pccFriendsAllowed);
if (!pccAllowed && !pccFriendsAllowed) noUGC = true;
if (noUGC) {
if (noUGC) {
int messageText = IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_SINGLE_LOCAL;
if (joiningUsers > 1)
messageText = IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_ALL_LOCAL;
ui.RequestUGCMessageBox(IDS_CONNECTION_FAILED, messageText,
XUSER_INDEX_ANY);
}
else if (noPrivileges) {
} else if (noPrivileges) {
unsigned int uiIDA[1];
uiIDA[0] = IDS_CONFIRM_OK;
@ -1389,7 +1375,6 @@ void CGameNetworkManager::HandleInviteWhenInMenus(
int userIndex, const INVITE_INFO* pInviteInfo) {
// We are in the root menus somewhere
// if this is the trial game, then we need the user to unlock the full game
if (!ProfileManager.IsFullVersion()) {
// The marketplace will fail with the primary player set to -1
@ -1411,8 +1396,7 @@ void CGameNetworkManager::HandleInviteWhenInMenus(
// as the main player might sign out in the sign-in ui
// ProfileManager.SetLockedProfile(-1);
if (!app.IsLocalMultiplayerAvailable())
{
if (!app.IsLocalMultiplayerAvailable()) {
bool noPrivileges =
!ProfileManager.AllowedToPlayMultiplayer(userIndex);
@ -1473,8 +1457,7 @@ void CGameNetworkManager::AddLocalPlayerFailed(int idx,
: DisconnectPacket::eDisconnect_ConnectionCreationFailed);
}
void CGameNetworkManager::HandleDisconnect(bool bLostRoomOnly)
{
void CGameNetworkManager::HandleDisconnect(bool bLostRoomOnly) {
int iPrimaryPlayer = g_NetworkManager.GetPrimaryPad();
if ((g_NetworkManager.GetLockedProfile() != -1) && iPrimaryPlayer != -1 &&
@ -1600,4 +1583,3 @@ int CGameNetworkManager::GetJoiningReadyPercentage() {
void CGameNetworkManager::FakeLocalPlayerJoined() {
s_pPlatformNetworkManager->FakeLocalPlayerJoined();
}

View file

@ -22,6 +22,7 @@ const int NON_QNET_SENDDATA_ACK_REQUIRED = 1;
class CGameNetworkManager {
friend class CPlatformNetworkManagerStub;
public:
CGameNetworkManager();
// Misc high level flow
@ -122,7 +123,6 @@ public:
static int ServerThreadProc(void* lpParameter);
static int ExitAndJoinFromInviteThreadProc(void* lpParam);
static void _LeaveGame();
static int ChangeSessionTypeThreadProc(void* lpParam);
@ -133,11 +133,12 @@ public:
// Events
void ServerReadyCreate(bool create); // Create the signal (or set to nullptr)
void ServerReady(); // Signal that we are ready
void ServerReadyWait(); // Wait for the signal
void ServerReadyDestroy(); // Destroy signal
bool ServerReadyValid(); // Is non-nullptr
void ServerReadyCreate(
bool create); // Create the signal (or set to nullptr)
void ServerReady(); // Signal that we are ready
void ServerReadyWait(); // Wait for the signal
void ServerReadyDestroy(); // Destroy signal
bool ServerReadyValid(); // Is non-nullptr
void ServerStoppedCreate(bool create); // Create the signal
void ServerStopped(); // Signal that we are ready
@ -204,4 +205,3 @@ public:
};
extern CGameNetworkManager g_NetworkManager;

View file

@ -141,5 +141,4 @@ public:
virtual void FakeLocalPlayerJoined() {
}; // Temporary method whilst we don't have real networking to make this
// happen
};

View file

@ -292,8 +292,8 @@ void CPlatformNetworkManagerStub::UpdateAndSetGameSessionData(
// INetworkPlayer *pNetworkPlayer = GetPlayerByIndex(i);
//
// // We can call this from NotifyPlayerLeaving but at that
// point the player is still considered in the session if( pNetworkPlayer !=
// pNetworkPlayerLeaving )
// point the player is still considered in the session
// if( pNetworkPlayer != pNetworkPlayerLeaving )
// {
// m_hostGameSessionData.players[i] =
// ((NetworkPlayerXbox *)pNetworkPlayer)->GetUID();

View file

@ -1,6 +1,5 @@
#pragma once
// A struct that we store in the QoS data when we are hosting the session. Max
// size 1020 bytes.
typedef struct _GameSessionData {

View file

@ -3,52 +3,59 @@
// 4J-JEV:
// All functional potions need bit-13 set.
#define MASK_REGENERATION 0x2001
#define MASK_SPEED 0x2002
#define MASK_FIRE_RESISTANCE 0x2003
#define MASK_POISON 0x2004
#define MASK_INSTANTHEALTH 0x2005
#define MASK_NIGHTVISION 0x2006
#define MASK_INVISIBILITY 0x200E
#define MASK_WEAKNESS 0x2008
#define MASK_STRENGTH 0x2009
#define MASK_SLOWNESS 0x200A
#define MASK_INSTANTDAMAGE 0x200C
#define MASK_REGENERATION 0x2001
#define MASK_SPEED 0x2002
#define MASK_FIRE_RESISTANCE 0x2003
#define MASK_POISON 0x2004
#define MASK_INSTANTHEALTH 0x2005
#define MASK_NIGHTVISION 0x2006
#define MASK_INVISIBILITY 0x200E
#define MASK_WEAKNESS 0x2008
#define MASK_STRENGTH 0x2009
#define MASK_SLOWNESS 0x200A
#define MASK_INSTANTDAMAGE 0x200C
#define MASK_TYPE_AWKWARD 0x0010
#define MASK_TYPE_AWKWARD 0x0010
#define MASK_SPLASH 0x4000
#define MASK_BIT13 0x2000
#define MASK_SPLASH 0x4000
#define MASK_BIT13 0x2000
#define MASK_LEVEL2 0x0020
#define MASK_EXTENDED 0x0040
#define MASK_LEVEL2EXTENDED 0x0060
#define MASK_LEVEL2 0x0020
#define MASK_EXTENDED 0x0040
#define MASK_LEVEL2EXTENDED 0x0060
#define MACRO_POTION_IS_REGENERATION(aux) ((aux & 0x200F) == MASK_REGENERATION)
#define MACRO_POTION_IS_SPEED(aux) ((aux & 0x200F) == MASK_SPEED)
#define MACRO_POTION_IS_FIRE_RESISTANCE(aux) ((aux & 0x200F) == MASK_FIRE_RESISTANCE)
#define MACRO_POTION_IS_INSTANTHEALTH(aux) ((aux & 0x200F) == MASK_INSTANTHEALTH)
#define MACRO_POTION_IS_NIGHTVISION(aux) ((aux & 0x200F) == MASK_NIGHTVISION)
#define MACRO_POTION_IS_INVISIBILITY(aux) ((aux & 0x200F) == MASK_INVISIBILITY)
#define MACRO_POTION_IS_WEAKNESS(aux) ((aux & 0x200F) == MASK_WEAKNESS)
#define MACRO_POTION_IS_STRENGTH(aux) ((aux & 0x200F) == MASK_STRENGTH)
#define MACRO_POTION_IS_SLOWNESS(aux) ((aux & 0x200F) == MASK_SLOWNESS)
#define MACRO_POTION_IS_POISON(aux) ((aux & 0x200F) == MASK_POISON)
#define MACRO_POTION_IS_INSTANTDAMAGE(aux) ((aux & 0x200F) == MASK_INSTANTDAMAGE)
#define MACRO_POTION_IS_REGENERATION(aux) ((aux & 0x200F) == MASK_REGENERATION)
#define MACRO_POTION_IS_SPEED(aux) ((aux & 0x200F) == MASK_SPEED)
#define MACRO_POTION_IS_FIRE_RESISTANCE(aux) \
((aux & 0x200F) == MASK_FIRE_RESISTANCE)
#define MACRO_POTION_IS_INSTANTHEALTH(aux) \
((aux & 0x200F) == MASK_INSTANTHEALTH)
#define MACRO_POTION_IS_NIGHTVISION(aux) ((aux & 0x200F) == MASK_NIGHTVISION)
#define MACRO_POTION_IS_INVISIBILITY(aux) ((aux & 0x200F) == MASK_INVISIBILITY)
#define MACRO_POTION_IS_WEAKNESS(aux) ((aux & 0x200F) == MASK_WEAKNESS)
#define MACRO_POTION_IS_STRENGTH(aux) ((aux & 0x200F) == MASK_STRENGTH)
#define MACRO_POTION_IS_SLOWNESS(aux) ((aux & 0x200F) == MASK_SLOWNESS)
#define MACRO_POTION_IS_POISON(aux) ((aux & 0x200F) == MASK_POISON)
#define MACRO_POTION_IS_INSTANTDAMAGE(aux) \
((aux & 0x200F) == MASK_INSTANTDAMAGE)
#define MACRO_POTION_IS_SPLASH(aux) ((aux & MASK_SPLASH) == MASK_SPLASH)
#define MACRO_POTION_IS_BOTTLE(aux) ((aux & MASK_SPLASH) == 0)
#define MACRO_POTION_IS_SPLASH(aux) ((aux & MASK_SPLASH) == MASK_SPLASH)
#define MACRO_POTION_IS_BOTTLE(aux) ((aux & MASK_SPLASH) == 0)
#define MACRO_POTION_IS_AKWARD(aux) ((aux & MASK_TYPE_AWKWARD) == MASK_TYPE_AWKWARD)
#define MACRO_POTION_IS_AKWARD(aux) \
((aux & MASK_TYPE_AWKWARD) == MASK_TYPE_AWKWARD)
#define MACRO_POTION_IS_REGULAR(aux) ((aux & (MASK_LEVEL2EXTENDED)) == 0)
#define MACRO_POTION_IS_LEVEL2(aux) ((aux & (MASK_LEVEL2 )) == MASK_LEVEL2)
#define MACRO_POTION_IS_EXTENDED(aux) ((aux & (MASK_EXTENDED)) == (MASK_EXTENDED))
#define MACRO_POTION_IS_LEVEL2EXTENDED(aux) ((aux & (MASK_LEVEL2EXTENDED)) == (MASK_LEVEL2EXTENDED))
#define MACRO_POTION_IS_REGULAR(aux) ((aux & (MASK_LEVEL2EXTENDED)) == 0)
#define MACRO_POTION_IS_LEVEL2(aux) ((aux & (MASK_LEVEL2)) == MASK_LEVEL2)
#define MACRO_POTION_IS_EXTENDED(aux) \
((aux & (MASK_EXTENDED)) == (MASK_EXTENDED))
#define MACRO_POTION_IS_LEVEL2EXTENDED(aux) \
((aux & (MASK_LEVEL2EXTENDED)) == (MASK_LEVEL2EXTENDED))
#define MACRO_MAKEPOTION_AUXVAL(potion_type, potion_strength, potion_effect) \
(potion_type | potion_strength | potion_effect)
#define MACRO_MAKEPOTION_AUXVAL(potion_type, potion_strength, potion_effect) (potion_type | potion_strength | potion_effect)
// The potion brewing creates high aux values with redundant high bits, so use this to bring the aux val into ranges that match our macros
// 4J-JEV: 0x2000 == bit-13; Used to stop netherwart "resetting" functional potions.
// The potion brewing creates high aux values with redundant high bits, so use
// this to bring the aux val into ranges that match our macros 4J-JEV: 0x2000 ==
// bit-13; Used to stop netherwart "resetting" functional potions.
#define NORMALISE_POTION_AUXVAL(aux) (aux & (MASK_BIT13 | MASK_SPLASH | 0xFF))

View file

@ -9,7 +9,7 @@
#include "../../../Minecraft.World/Util/C4JThread.h"
class ShutdownManager {
public:
public:
enum EThreadId {
eMainThread,
eLeaderboardThread,
@ -36,7 +36,7 @@ class ShutdownManager {
static bool ShouldRun(EThreadId threadId);
static void HasFinished(EThreadId threadId);
private:
private:
struct GroupState {
std::size_t started = 0;
std::size_t running = 0;

View file

@ -8,435 +8,396 @@
#include "TelemetryManager.h"
CTelemetryManager* TelemetryManager = new CTelemetryManager();
CTelemetryManager *TelemetryManager = new CTelemetryManager();
int32_t CTelemetryManager::Init() { return 0; }
int32_t CTelemetryManager::Tick() { return 0; }
int32_t CTelemetryManager::Init()
{
return 0;
int32_t CTelemetryManager::Flush() { return 0; }
bool CTelemetryManager::RecordPlayerSessionStart(int iPad) { return true; }
bool CTelemetryManager::RecordPlayerSessionExit(int iPad, int exitStatus) {
return true;
}
int32_t CTelemetryManager::Tick()
{
return 0;
bool CTelemetryManager::RecordHeartBeat(int iPad) { return true; }
bool CTelemetryManager::RecordLevelStart(int iPad,
ESen_FriendOrMatch friendsOrMatch,
ESen_CompeteOrCoop competeOrCoop,
int difficulty,
int numberOfLocalPlayers,
int numberOfOnlinePlayers) {
if (iPad == ProfileManager.GetPrimaryPad()) m_bFirstFlush = true;
++m_levelInstanceID;
m_fLevelStartTime[iPad] = app.getAppTime();
return true;
}
int32_t CTelemetryManager::Flush()
{
return 0;
bool CTelemetryManager::RecordLevelExit(int iPad,
ESen_LevelExitStatus levelExitStatus) {
return true;
}
bool CTelemetryManager::RecordPlayerSessionStart(int iPad)
{
return true;
bool CTelemetryManager::RecordLevelSaveOrCheckpoint(int iPad,
int saveOrCheckPointID,
int saveSizeInBytes) {
return true;
}
bool CTelemetryManager::RecordPlayerSessionExit(int iPad, int exitStatus)
{
return true;
bool CTelemetryManager::RecordLevelResume(
int iPad, ESen_FriendOrMatch friendsOrMatch,
ESen_CompeteOrCoop competeOrCoop, int difficulty, int numberOfLocalPlayers,
int numberOfOnlinePlayers, int saveOrCheckPointID) {
return true;
}
bool CTelemetryManager::RecordHeartBeat(int iPad)
{
return true;
bool CTelemetryManager::RecordPauseOrInactive(int iPad) { return true; }
bool CTelemetryManager::RecordUnpauseOrActive(int iPad) { return true; }
bool CTelemetryManager::RecordMenuShown(int iPad, EUIScene menuID,
int optionalMenuSubID) {
return true;
}
bool CTelemetryManager::RecordLevelStart(int iPad, ESen_FriendOrMatch friendsOrMatch, ESen_CompeteOrCoop competeOrCoop, int difficulty, int numberOfLocalPlayers, int numberOfOnlinePlayers)
{
if(iPad == ProfileManager.GetPrimaryPad() ) m_bFirstFlush = true;
++m_levelInstanceID;
m_fLevelStartTime[iPad] = app.getAppTime();
return true;
bool CTelemetryManager::RecordAchievementUnlocked(int iPad, int achievementID,
int achievementGamerscore) {
return true;
}
bool CTelemetryManager::RecordLevelExit(int iPad, ESen_LevelExitStatus levelExitStatus)
{
return true;
bool CTelemetryManager::RecordMediaShareUpload(
int iPad, ESen_MediaDestination mediaDestination,
ESen_MediaType mediaType) {
return true;
}
bool CTelemetryManager::RecordLevelSaveOrCheckpoint(int iPad, int saveOrCheckPointID, int saveSizeInBytes)
{
return true;
bool CTelemetryManager::RecordUpsellPresented(int iPad, ESen_UpsellID upsellId,
int marketplaceOfferID) {
return true;
}
bool CTelemetryManager::RecordLevelResume(int iPad, ESen_FriendOrMatch friendsOrMatch, ESen_CompeteOrCoop competeOrCoop, int difficulty, int numberOfLocalPlayers, int numberOfOnlinePlayers, int saveOrCheckPointID)
{
return true;
bool CTelemetryManager::RecordUpsellResponded(
int iPad, ESen_UpsellID upsellId, int marketplaceOfferID,
ESen_UpsellOutcome upsellOutcome) {
return true;
}
bool CTelemetryManager::RecordPauseOrInactive(int iPad)
{
return true;
bool CTelemetryManager::RecordPlayerDiedOrFailed(
int iPad, int lowResMapX, int lowResMapY, int lowResMapZ, int mapID,
int playerWeaponID, int enemyWeaponID, ETelemetryChallenges enemyTypeID) {
return true;
}
bool CTelemetryManager::RecordUnpauseOrActive(int iPad)
{
return true;
bool CTelemetryManager::RecordEnemyKilledOrOvercome(
int iPad, int lowResMapX, int lowResMapY, int lowResMapZ, int mapID,
int playerWeaponID, int enemyWeaponID, ETelemetryChallenges enemyTypeID) {
return true;
}
bool CTelemetryManager::RecordMenuShown(int iPad, EUIScene menuID, int optionalMenuSubID)
{
return true;
bool CTelemetryManager::RecordTexturePackLoaded(int iPad, int texturePackId,
bool purchased) {
return true;
}
bool CTelemetryManager::RecordAchievementUnlocked(int iPad, int achievementID, int achievementGamerscore)
{
return true;
bool CTelemetryManager::RecordSkinChanged(int iPad, int dwSkinId) {
return true;
}
bool CTelemetryManager::RecordMediaShareUpload(int iPad, ESen_MediaDestination mediaDestination, ESen_MediaType mediaType)
{
return true;
}
bool CTelemetryManager::RecordBanLevel(int iPad) { return true; }
bool CTelemetryManager::RecordUpsellPresented(int iPad, ESen_UpsellID upsellId, int marketplaceOfferID)
{
return true;
}
bool CTelemetryManager::RecordUpsellResponded(int iPad, ESen_UpsellID upsellId, int marketplaceOfferID, ESen_UpsellOutcome upsellOutcome)
{
return true;
}
bool CTelemetryManager::RecordPlayerDiedOrFailed(int iPad, int lowResMapX, int lowResMapY, int lowResMapZ, int mapID, int playerWeaponID, int enemyWeaponID, ETelemetryChallenges enemyTypeID)
{
return true;
}
bool CTelemetryManager::RecordEnemyKilledOrOvercome(int iPad, int lowResMapX, int lowResMapY, int lowResMapZ, int mapID, int playerWeaponID, int enemyWeaponID, ETelemetryChallenges enemyTypeID)
{
return true;
}
bool CTelemetryManager::RecordTexturePackLoaded(int iPad, int texturePackId, bool purchased)
{
return true;
}
bool CTelemetryManager::RecordSkinChanged(int iPad, int dwSkinId)
{
return true;
}
bool CTelemetryManager::RecordBanLevel(int iPad)
{
return true;
}
bool CTelemetryManager::RecordUnBanLevel(int iPad)
{
return true;
}
///////////////////////////////////////////////////////////////////
// 4J-JEV: FOLLOWING LOGIC TAKEN FROM XBOX 'SentientManager.cpp' //
///////////////////////////////////////////////////////////////////
bool CTelemetryManager::RecordUnBanLevel(int iPad) { return true; }
///////////////////////////////////////////////////////////////////
// 4J-JEV: FOLLOWING LOGIC TAKEN FROM XBOX 'SentientManager.cpp' //
///////////////////////////////////////////////////////////////////
/*
Number of seconds elapsed since Sentient initialize.
Title needs to track this and report it as a property.
These times will be used to create timelines and understand durations.
This should be tracked independently of saved games (restoring a save should not reset the seconds since initialize)
These times will be used to create timelines and understand durations.
This should be tracked independently of saved games (restoring a save should not
reset the seconds since initialize)
*/
int CTelemetryManager::GetSecondsSinceInitialize()
{
return static_cast<int>(app.getAppTime() - m_initialiseTime);
int CTelemetryManager::GetSecondsSinceInitialize() {
return static_cast<int>(app.getAppTime() - m_initialiseTime);
}
/*
An in-game setting that significantly differentiates the play style of the game.
(This should be captured as an integer and correspond to mode specific to the game.)
Teams will have to provide the game mappings that correspond to the integers.
The intent is to allow teams to capture data on the highest level categories of gameplay in their game.
For example, a game mode could be the name of the specific mini game (eg: golf vs darts) or a specific multiplayer mode (eg: hoard vs beast.) ModeID = 0 means undefined or unknown.
The intent is to answer the question "How are players playing your game?"
(This should be captured as an integer and correspond to mode specific to the
game.) Teams will have to provide the game mappings that correspond to the
integers. The intent is to allow teams to capture data on the highest level
categories of gameplay in their game. For example, a game mode could be the name
of the specific mini game (eg: golf vs darts) or a specific multiplayer mode
(eg: hoard vs beast.) ModeID = 0 means undefined or unknown. The intent is to
answer the question "How are players playing your game?"
*/
int CTelemetryManager::GetMode(int userId)
{
int mode = static_cast<int>(eTelem_ModeId_Undefined);
Minecraft *pMinecraft = Minecraft::GetInstance();
int CTelemetryManager::GetMode(int userId) {
int mode = static_cast<int>(eTelem_ModeId_Undefined);
if( pMinecraft->localplayers[userId] != nullptr && pMinecraft->localplayers[userId]->level != nullptr && pMinecraft->localplayers[userId]->level->getLevelData() != nullptr )
{
GameType *gameType = pMinecraft->localplayers[userId]->level->getLevelData()->getGameType();
Minecraft* pMinecraft = Minecraft::GetInstance();
if (gameType->isSurvival())
{
mode = static_cast<int>(eTelem_ModeId_Survival);
}
else if (gameType->isCreative())
{
mode = static_cast<int>(eTelem_ModeId_Creative);
}
else
{
mode = static_cast<int>(eTelem_ModeId_Undefined);
}
}
return mode;
if (pMinecraft->localplayers[userId] != nullptr &&
pMinecraft->localplayers[userId]->level != nullptr &&
pMinecraft->localplayers[userId]->level->getLevelData() != nullptr) {
GameType* gameType = pMinecraft->localplayers[userId]
->level->getLevelData()
->getGameType();
if (gameType->isSurvival()) {
mode = static_cast<int>(eTelem_ModeId_Survival);
} else if (gameType->isCreative()) {
mode = static_cast<int>(eTelem_ModeId_Creative);
} else {
mode = static_cast<int>(eTelem_ModeId_Undefined);
}
}
return mode;
}
/*
Used when a title has more heirarchy required.
OptionalSubMode ID = 0 means undefined or unknown.
For titles that have sub-modes (Sports/Football).
Mode is always an indicator of "How is the player choosing to play my game?" so these do not have to be consecutive.
LevelIDs and SubLevelIDs can be reused as they will always be paired with a Mode/SubModeID, Mode should be unique - SubMode can be shared between modes.
Mode is always an indicator of "How is the player choosing to play my game?" so
these do not have to be consecutive. LevelIDs and SubLevelIDs can be reused as
they will always be paired with a Mode/SubModeID, Mode should be unique -
SubMode can be shared between modes.
*/
int CTelemetryManager::GetSubMode(int userId)
{
int subMode = static_cast<int>(eTelem_SubModeId_Undefined);
int CTelemetryManager::GetSubMode(int userId) {
int subMode = static_cast<int>(eTelem_SubModeId_Undefined);
if(Minecraft::GetInstance()->isTutorial())
{
subMode = static_cast<int>(eTelem_SubModeId_Tutorial);
}
else
{
subMode = static_cast<int>(eTelem_SubModeId_Normal);
}
if (Minecraft::GetInstance()->isTutorial()) {
subMode = static_cast<int>(eTelem_SubModeId_Tutorial);
} else {
subMode = static_cast<int>(eTelem_SubModeId_Normal);
}
return subMode;
return subMode;
}
/*
This is a more granular view of mode, allowing teams to get a sense of the levels or maps players are playing and providing some insight into how players progress through a game.
Teams will have to provide the game mappings that correspond to the integers.
The intent is that a level is highest level at which modes can be dissected and provides an indication of player progression in a game.
The intent is that level start and ends do not occur more than every 2 minutes or so, otherwise the data reported will be difficult to understand.
Levels are unique only within a given modeID - so you can have a ModeID =1, LevelID =1 and a different ModeID=2, LevelID = 1 indicate two completely different levels.
LevelID = 0 means undefined or unknown.
This is a more granular view of mode, allowing teams to get a sense of the
levels or maps players are playing and providing some insight into how players
progress through a game. Teams will have to provide the game mappings that
correspond to the integers. The intent is that a level is highest level at which
modes can be dissected and provides an indication of player progression in a
game. The intent is that level start and ends do not occur more than every 2
minutes or so, otherwise the data reported will be difficult to understand.
Levels are unique only within a given modeID - so you can have a ModeID =1,
LevelID =1 and a different ModeID=2, LevelID = 1 indicate two completely
different levels. LevelID = 0 means undefined or unknown.
*/
int CTelemetryManager::GetLevelId(int userId)
{
int levelId = static_cast<int>(eTelem_LevelId_Undefined);
int CTelemetryManager::GetLevelId(int userId) {
int levelId = static_cast<int>(eTelem_LevelId_Undefined);
levelId = static_cast<int>(eTelem_LevelId_PlayerGeneratedLevel);
levelId = static_cast<int>(eTelem_LevelId_PlayerGeneratedLevel);
return levelId;
return levelId;
}
/*
Used when a title has more heirarchy required. OptionalSubLevel ID = 0 means undefined or unknown.
For titles that have sub-levels.
Level is always an indicator of "How far has the player progressed." so when possible these should be consecutive or at least monotonically increasing.
LevelIDs and SubLevelIDs can be reused as they will always be paired with a Mode/SubModeID
Used when a title has more heirarchy required. OptionalSubLevel ID = 0 means
undefined or unknown. For titles that have sub-levels. Level is always an
indicator of "How far has the player progressed." so when possible these should
be consecutive or at least monotonically increasing. LevelIDs and SubLevelIDs
can be reused as they will always be paired with a Mode/SubModeID
*/
int CTelemetryManager::GetSubLevelId(int userId)
{
int subLevelId = static_cast<int>(eTelem_SubLevelId_Undefined);
int CTelemetryManager::GetSubLevelId(int userId) {
int subLevelId = static_cast<int>(eTelem_SubLevelId_Undefined);
Minecraft *pMinecraft = Minecraft::GetInstance();
Minecraft* pMinecraft = Minecraft::GetInstance();
if(pMinecraft->localplayers[userId] != nullptr)
{
switch(pMinecraft->localplayers[userId]->dimension)
{
case 0:
subLevelId = static_cast<int>(eTelem_SubLevelId_Overworld);
break;
case -1:
subLevelId = static_cast<int>(eTelem_SubLevelId_Nether);
break;
case 1:
subLevelId = static_cast<int>(eTelem_SubLevelId_End);
break;
};
}
if (pMinecraft->localplayers[userId] != nullptr) {
switch (pMinecraft->localplayers[userId]->dimension) {
case 0:
subLevelId = static_cast<int>(eTelem_SubLevelId_Overworld);
break;
case -1:
subLevelId = static_cast<int>(eTelem_SubLevelId_Nether);
break;
case 1:
subLevelId = static_cast<int>(eTelem_SubLevelId_End);
break;
};
}
return subLevelId;
return subLevelId;
}
/*
Build version of the title, used to track changes in development as well as patches/title updates
Allows developer to separate out stats from different builds
Build version of the title, used to track changes in development as well as
patches/title updates Allows developer to separate out stats from different
builds
*/
int CTelemetryManager::GetTitleBuildId()
{
return static_cast<int>(VER_PRODUCTBUILD);
int CTelemetryManager::GetTitleBuildId() {
return static_cast<int>(VER_PRODUCTBUILD);
}
/*
Generated by the game every time LevelStart or LevelResume is called.
This should be a unique ID (can be sequential) within a session.
Helps differentiate level attempts when a play plays the same mode/level - especially with aggregated stats
Helps differentiate level attempts when a play plays the same mode/level -
especially with aggregated stats
*/
int CTelemetryManager::GetLevelInstanceID()
{
return m_levelInstanceID;
int CTelemetryManager::GetLevelInstanceID() { return m_levelInstanceID; }
/*
MultiplayerinstanceID is a title-generated value that is the same for all
players in the same multiplayer session. Link up players into a single
multiplayer session ID.
*/
int CTelemetryManager::GetMultiplayerInstanceID() {
return m_multiplayerInstanceID;
}
int CTelemetryManager::GenerateMultiplayerInstanceId() { return 0; }
void CTelemetryManager::SetMultiplayerInstanceId(int value) {
m_multiplayerInstanceID = value;
}
/*
MultiplayerinstanceID is a title-generated value that is the same for all players in the same multiplayer session.
Link up players into a single multiplayer session ID.
Indicates whether the game is being played in single or multiplayer mode and
whether multiplayer is being played locally or over live. How social is your
game? How do people play it?
*/
int CTelemetryManager::GetMultiplayerInstanceID()
{
return m_multiplayerInstanceID;
}
int CTelemetryManager::GetSingleOrMultiplayer() {
int singleOrMultiplayer =
static_cast<int>(eSen_SingleOrMultiplayer_Undefined);
int CTelemetryManager::GenerateMultiplayerInstanceId()
{
return 0;
}
// Unused
// eSen_SingleOrMultiplayer_Single_Player
// eSen_SingleOrMultiplayer_Multiplayer_Live
void CTelemetryManager::SetMultiplayerInstanceId(int value)
{
m_multiplayerInstanceID = value;
}
if (app.GetLocalPlayerCount() == 1 &&
g_NetworkManager.GetOnlinePlayerCount() == 0) {
singleOrMultiplayer =
static_cast<int>(eSen_SingleOrMultiplayer_Single_Player);
} else if (app.GetLocalPlayerCount() > 1 &&
g_NetworkManager.GetOnlinePlayerCount() == 0) {
singleOrMultiplayer =
static_cast<int>(eSen_SingleOrMultiplayer_Multiplayer_Local);
} else if (app.GetLocalPlayerCount() == 1 &&
g_NetworkManager.GetOnlinePlayerCount() > 0) {
singleOrMultiplayer =
static_cast<int>(eSen_SingleOrMultiplayer_Multiplayer_Live);
} else if (app.GetLocalPlayerCount() > 1 &&
g_NetworkManager.GetOnlinePlayerCount() > 0) {
singleOrMultiplayer = static_cast<int>(
eSen_SingleOrMultiplayer_Multiplayer_Both_Local_and_Live);
}
/*
Indicates whether the game is being played in single or multiplayer mode and whether multiplayer is being played locally or over live.
How social is your game? How do people play it?
*/
int CTelemetryManager::GetSingleOrMultiplayer()
{
int singleOrMultiplayer = static_cast<int>(eSen_SingleOrMultiplayer_Undefined);
// Unused
//eSen_SingleOrMultiplayer_Single_Player
//eSen_SingleOrMultiplayer_Multiplayer_Live
if(app.GetLocalPlayerCount() == 1 && g_NetworkManager.GetOnlinePlayerCount() == 0)
{
singleOrMultiplayer = static_cast<int>(eSen_SingleOrMultiplayer_Single_Player);
}
else if(app.GetLocalPlayerCount() > 1 && g_NetworkManager.GetOnlinePlayerCount() == 0)
{
singleOrMultiplayer = static_cast<int>(eSen_SingleOrMultiplayer_Multiplayer_Local);
}
else if(app.GetLocalPlayerCount() == 1 && g_NetworkManager.GetOnlinePlayerCount() > 0)
{
singleOrMultiplayer = static_cast<int>(eSen_SingleOrMultiplayer_Multiplayer_Live);
}
else if(app.GetLocalPlayerCount() > 1 && g_NetworkManager.GetOnlinePlayerCount() > 0)
{
singleOrMultiplayer = static_cast<int>(eSen_SingleOrMultiplayer_Multiplayer_Both_Local_and_Live);
}
return singleOrMultiplayer;
return singleOrMultiplayer;
}
/*
An in-game setting that differentiates the challenge imposed on the user.
Normalized to a standard 5-point scale. Are players changing the difficulty?
*/
int CTelemetryManager::GetDifficultyLevel(int diff)
{
int difficultyLevel = static_cast<int>(eSen_DifficultyLevel_Undefined);
int CTelemetryManager::GetDifficultyLevel(int diff) {
int difficultyLevel = static_cast<int>(eSen_DifficultyLevel_Undefined);
switch(diff)
{
case 0:
difficultyLevel = static_cast<int>(eSen_DifficultyLevel_Easiest);
break;
case 1:
difficultyLevel = static_cast<int>(eSen_DifficultyLevel_Easier);
break;
case 2:
difficultyLevel = static_cast<int>(eSen_DifficultyLevel_Normal);
break;
case 3:
difficultyLevel = static_cast<int>(eSen_DifficultyLevel_Harder);
break;
}
switch (diff) {
case 0:
difficultyLevel = static_cast<int>(eSen_DifficultyLevel_Easiest);
break;
case 1:
difficultyLevel = static_cast<int>(eSen_DifficultyLevel_Easier);
break;
case 2:
difficultyLevel = static_cast<int>(eSen_DifficultyLevel_Normal);
break;
case 3:
difficultyLevel = static_cast<int>(eSen_DifficultyLevel_Harder);
break;
}
// Unused
//eSen_DifficultyLevel_Hardest = 5,
// Unused
// eSen_DifficultyLevel_Hardest = 5,
return difficultyLevel;
return difficultyLevel;
}
/*
Differentiates trial/demo from full purchased titles
Is this a full title or demo?
*/
int CTelemetryManager::GetLicense()
{
int license = eSen_License_Undefined;
int CTelemetryManager::GetLicense() {
int license = eSen_License_Undefined;
if(ProfileManager.IsFullVersion())
{
license = static_cast<int>(eSen_License_Full_Purchased_Title);
}
else
{
license = static_cast<int>(eSen_License_Trial_or_Demo);
}
return license;
if (ProfileManager.IsFullVersion()) {
license = static_cast<int>(eSen_License_Full_Purchased_Title);
} else {
license = static_cast<int>(eSen_License_Trial_or_Demo);
}
return license;
}
/*
This is intended to capture whether players played using default control scheme or customized the control scheme.
Are players customizing your controls?
This is intended to capture whether players played using default control scheme
or customized the control scheme. Are players customizing your controls?
*/
int CTelemetryManager::GetDefaultGameControls()
{
int defaultGameControls = eSen_DefaultGameControls_Undefined;
int CTelemetryManager::GetDefaultGameControls() {
int defaultGameControls = eSen_DefaultGameControls_Undefined;
// Unused
//eSen_DefaultGameControls_Custom_controls
// Unused
// eSen_DefaultGameControls_Custom_controls
defaultGameControls = eSen_DefaultGameControls_Default_controls;
defaultGameControls = eSen_DefaultGameControls_Default_controls;
return defaultGameControls;
return defaultGameControls;
}
/*
Are players changing default audio settings?
This is intended to capture whether players are playing with or without volume and whether they make changes from the default audio settings.
This is intended to capture whether players are playing with or without volume
and whether they make changes from the default audio settings.
*/
int CTelemetryManager::GetAudioSettings(int userId)
{
int audioSettings = static_cast<int>(eSen_AudioSettings_Undefined);
int CTelemetryManager::GetAudioSettings(int userId) {
int audioSettings = static_cast<int>(eSen_AudioSettings_Undefined);
if(userId == ProfileManager.GetPrimaryPad())
{
unsigned char volume = app.GetGameSettings(userId, eGameSetting_SoundFXVolume);
if (userId == ProfileManager.GetPrimaryPad()) {
unsigned char volume =
app.GetGameSettings(userId, eGameSetting_SoundFXVolume);
if(volume == 0)
{
audioSettings = static_cast<int>(eSen_AudioSettings_Off);
}
else if(volume == DEFAULT_VOLUME_LEVEL)
{
audioSettings = static_cast<int>(eSen_AudioSettings_On_Default);
}
else
{
audioSettings = static_cast<int>(eSen_AudioSettings_On_CustomSetting);
}
}
return audioSettings;
if (volume == 0) {
audioSettings = static_cast<int>(eSen_AudioSettings_Off);
} else if (volume == DEFAULT_VOLUME_LEVEL) {
audioSettings = static_cast<int>(eSen_AudioSettings_On_Default);
} else {
audioSettings =
static_cast<int>(eSen_AudioSettings_On_CustomSetting);
}
}
return audioSettings;
}
/*
Refers to the highest level performance metric for your game.
For example, a performance metric could points earned, race time, total kills, etc.
This is entirely up to you and will help us understand how well the player performed, or how far the player progressed  in the level before exiting.
How far did users progress before failing/exiting the level?
For example, a performance metric could points earned, race time, total kills,
etc. This is entirely up to you and will help us understand how well the player
performed, or how far the player progressed  in the level before exiting. How
far did users progress before failing/exiting the level?
*/
int CTelemetryManager::GetLevelExitProgressStat1()
{
// 4J Stu - Unused
return 0;
int CTelemetryManager::GetLevelExitProgressStat1() {
// 4J Stu - Unused
return 0;
}
/*
Refers to the highest level performance metric for your game.
For example, a performance metric could points earned, race time, total kills, etc.
This is entirely up to you and will help us understand how well the player performed, or how far the player progressed  in the level before exiting.
How far did users progress before failing/exiting the level?
For example, a performance metric could points earned, race time, total kills,
etc. This is entirely up to you and will help us understand how well the player
performed, or how far the player progressed  in the level before exiting. How
far did users progress before failing/exiting the level?
*/
int CTelemetryManager::GetLevelExitProgressStat2()
{
// 4J Stu - Unused
return 0;
int CTelemetryManager::GetLevelExitProgressStat2() {
// 4J Stu - Unused
return 0;
}

View file

@ -10,64 +10,88 @@
#endif
#include "../UI/UIEnums.h"
class CTelemetryManager
{
class CTelemetryManager {
public:
virtual int32_t Init();
virtual int32_t Tick();
virtual int32_t Flush();
virtual int32_t Init();
virtual int32_t Tick();
virtual int32_t Flush();
virtual bool RecordPlayerSessionStart(int iPad);
virtual bool RecordPlayerSessionExit(int iPad, int exitStatus);
virtual bool RecordHeartBeat(int iPad);
virtual bool RecordLevelStart(int iPad, ESen_FriendOrMatch friendsOrMatch, ESen_CompeteOrCoop competeOrCoop, int difficulty, int numberOfLocalPlayers, int numberOfOnlinePlayers);
virtual bool RecordLevelExit(int iPad, ESen_LevelExitStatus levelExitStatus);
virtual bool RecordLevelSaveOrCheckpoint(int iPad, int saveOrCheckPointID, int saveSizeInBytes);
virtual bool RecordLevelResume(int iPad, ESen_FriendOrMatch friendsOrMatch, ESen_CompeteOrCoop competeOrCoop, int difficulty, int numberOfLocalPlayers, int numberOfOnlinePlayers, int saveOrCheckPointID);
virtual bool RecordPauseOrInactive(int iPad);
virtual bool RecordUnpauseOrActive(int iPad);
virtual bool RecordMenuShown(int iPad, EUIScene menuID, int optionalMenuSubID);
virtual bool RecordAchievementUnlocked(int iPad, int achievementID, int achievementGamerscore);
virtual bool RecordMediaShareUpload(int iPad, ESen_MediaDestination mediaDestination, ESen_MediaType mediaType);
virtual bool RecordUpsellPresented(int iPad, ESen_UpsellID upsellId, int marketplaceOfferID);
virtual bool RecordUpsellResponded(int iPad, ESen_UpsellID upsellId, int marketplaceOfferID, ESen_UpsellOutcome upsellOutcome);
virtual bool RecordPlayerDiedOrFailed(int iPad, int lowResMapX, int lowResMapY, int lowResMapZ, int mapID, int playerWeaponID, int enemyWeaponID, ETelemetryChallenges enemyTypeID);
virtual bool RecordEnemyKilledOrOvercome(int iPad, int lowResMapX, int lowResMapY, int lowResMapZ, int mapID, int playerWeaponID, int enemyWeaponID, ETelemetryChallenges enemyTypeID);
virtual bool RecordTexturePackLoaded(int iPad, int texturePackId, bool purchased);
virtual bool RecordPlayerSessionStart(int iPad);
virtual bool RecordPlayerSessionExit(int iPad, int exitStatus);
virtual bool RecordHeartBeat(int iPad);
virtual bool RecordLevelStart(int iPad, ESen_FriendOrMatch friendsOrMatch,
ESen_CompeteOrCoop competeOrCoop,
int difficulty, int numberOfLocalPlayers,
int numberOfOnlinePlayers);
virtual bool RecordLevelExit(int iPad,
ESen_LevelExitStatus levelExitStatus);
virtual bool RecordLevelSaveOrCheckpoint(int iPad, int saveOrCheckPointID,
int saveSizeInBytes);
virtual bool RecordLevelResume(int iPad, ESen_FriendOrMatch friendsOrMatch,
ESen_CompeteOrCoop competeOrCoop,
int difficulty, int numberOfLocalPlayers,
int numberOfOnlinePlayers,
int saveOrCheckPointID);
virtual bool RecordPauseOrInactive(int iPad);
virtual bool RecordUnpauseOrActive(int iPad);
virtual bool RecordMenuShown(int iPad, EUIScene menuID,
int optionalMenuSubID);
virtual bool RecordAchievementUnlocked(int iPad, int achievementID,
int achievementGamerscore);
virtual bool RecordMediaShareUpload(int iPad,
ESen_MediaDestination mediaDestination,
ESen_MediaType mediaType);
virtual bool RecordUpsellPresented(int iPad, ESen_UpsellID upsellId,
int marketplaceOfferID);
virtual bool RecordUpsellResponded(int iPad, ESen_UpsellID upsellId,
int marketplaceOfferID,
ESen_UpsellOutcome upsellOutcome);
virtual bool RecordPlayerDiedOrFailed(int iPad, int lowResMapX,
int lowResMapY, int lowResMapZ,
int mapID, int playerWeaponID,
int enemyWeaponID,
ETelemetryChallenges enemyTypeID);
virtual bool RecordEnemyKilledOrOvercome(int iPad, int lowResMapX,
int lowResMapY, int lowResMapZ,
int mapID, int playerWeaponID,
int enemyWeaponID,
ETelemetryChallenges enemyTypeID);
virtual bool RecordTexturePackLoaded(int iPad, int texturePackId,
bool purchased);
virtual bool RecordSkinChanged(int iPad, int dwSkinId);
virtual bool RecordBanLevel(int iPad);
virtual bool RecordUnBanLevel(int iPad);
virtual bool RecordSkinChanged(int iPad, int dwSkinId);
virtual bool RecordBanLevel(int iPad);
virtual bool RecordUnBanLevel(int iPad);
virtual int GetMultiplayerInstanceID();
virtual int GenerateMultiplayerInstanceId();
virtual void SetMultiplayerInstanceId(int value);
virtual int GetMultiplayerInstanceID();
virtual int GenerateMultiplayerInstanceId();
virtual void SetMultiplayerInstanceId(int value);
protected:
float m_initialiseTime;
float m_lastHeartbeat;
bool m_bFirstFlush;
float m_initialiseTime;
float m_lastHeartbeat;
bool m_bFirstFlush;
float m_fLevelStartTime[XUSER_MAX_COUNT];
float m_fLevelStartTime[XUSER_MAX_COUNT];
int m_multiplayerInstanceID;
int m_levelInstanceID;
int m_multiplayerInstanceID;
int m_levelInstanceID;
// Helper functions to get the various common settings
int GetSecondsSinceInitialize();
int GetMode(int userId);
int GetSubMode(int userId);
int GetLevelId(int userId);
int GetSubLevelId(int userId);
int GetTitleBuildId();
int GetLevelInstanceID();
int GetSingleOrMultiplayer();
int GetDifficultyLevel(int diff);
int GetLicense();
int GetDefaultGameControls();
int GetAudioSettings(int userId);
int GetLevelExitProgressStat1();
int GetLevelExitProgressStat2();
// Helper functions to get the various common settings
int GetSecondsSinceInitialize();
int GetMode(int userId);
int GetSubMode(int userId);
int GetLevelId(int userId);
int GetSubLevelId(int userId);
int GetTitleBuildId();
int GetLevelInstanceID();
int GetSingleOrMultiplayer();
int GetDifficultyLevel(int diff);
int GetLicense();
int GetDefaultGameControls();
int GetAudioSettings(int userId);
int GetLevelExitProgressStat1();
int GetLevelExitProgressStat2();
};
extern CTelemetryManager *TelemetryManager;
extern CTelemetryManager* TelemetryManager;

View file

@ -2,8 +2,8 @@
#include "TrialMode.h"
#include "../Tutorial/FullTutorial.h"
TrialMode::TrialMode(int iPad, Minecraft *minecraft, ClientConnection *connection)
: FullTutorialMode(iPad, minecraft, connection)
{
tutorial = new FullTutorial(iPad, true);
TrialMode::TrialMode(int iPad, Minecraft* minecraft,
ClientConnection* connection)
: FullTutorialMode(iPad, minecraft, connection) {
tutorial = new FullTutorial(iPad, true);
}

View file

@ -1,10 +1,9 @@
#pragma once
#include "../Tutorial/FullTutorialMode.h"
class TrialMode : public FullTutorialMode
{
public:
TrialMode(int iPad, Minecraft *minecraft, ClientConnection *connection);
class TrialMode : public FullTutorialMode {
public:
TrialMode(int iPad, Minecraft* minecraft, ClientConnection* connection);
virtual bool isImplemented() { return true; }
virtual bool isImplemented() { return true; }
};

View file

@ -21,8 +21,7 @@ bool AreaTask::isCompleted() {
switch (m_completionState) {
case eAreaTaskCompletion_CompleteOnConstraintsSatisfied: {
bool allSatisfied = true;
for (auto it = constraints.begin(); it != constraints.end();
++it) {
for (auto it = constraints.begin(); it != constraints.end(); ++it) {
TutorialConstraint* constraint = *it;
if (!constraint->isConstraintSatisfied(tutorial->getPad())) {
allSatisfied = false;

View file

@ -14,7 +14,8 @@ ChoiceTask::ChoiceTask(
int iCancelMapping /*= 0*/,
eTutorial_CompletionAction cancelAction /*= e_Tutorial_Completion_None*/,
ETelemetryChallenges telemetryEvent /*= eTelemetryTutorial_NoEvent*/)
: TutorialTask(tutorial, descriptionId, false, nullptr, true, false, false) {
: TutorialTask(tutorial, descriptionId, false, nullptr, true, false,
false) {
if (requiresUserInput == true) {
constraints.push_back(new InputConstraint(iConfirmMapping));
constraints.push_back(new InputConstraint(iCancelMapping));

View file

@ -23,7 +23,8 @@ public:
ControllerTask(Tutorial* tutorial, int descriptionId,
bool enablePreCompletion, bool showMinimumTime,
int mappings[], unsigned int mappingsLength,
int iCompletionMaskA[] = nullptr, int iCompletionMaskACount = 0,
int iCompletionMaskA[] = nullptr,
int iCompletionMaskACount = 0,
int iSouthpawMappings[] = nullptr,
unsigned int uiSouthpawMappingsCount = 0);
~ControllerTask();

View file

@ -2,11 +2,12 @@
#include "CraftTask.h"
#include "../../Minecraft.World/Headers/net.minecraft.world.item.h"
CraftTask::CraftTask(int itemId, int auxValue, int quantity, Tutorial* tutorial,
int descriptionId, bool enablePreCompletion /*= true*/,
std::vector<TutorialConstraint*>* inConstraints /*= nullptr*/,
bool bShowMinimumTime /*=false*/,
bool bAllowFade /*=true*/, bool m_bTaskReminders /*=true*/)
CraftTask::CraftTask(
int itemId, int auxValue, int quantity, Tutorial* tutorial,
int descriptionId, bool enablePreCompletion /*= true*/,
std::vector<TutorialConstraint*>* inConstraints /*= nullptr*/,
bool bShowMinimumTime /*=false*/, bool bAllowFade /*=true*/,
bool m_bTaskReminders /*=true*/)
: TutorialTask(tutorial, descriptionId, enablePreCompletion, inConstraints,
bShowMinimumTime, bAllowFade, m_bTaskReminders),
m_quantity(quantity),
@ -18,12 +19,12 @@ CraftTask::CraftTask(int itemId, int auxValue, int quantity, Tutorial* tutorial,
m_auxValues[0] = auxValue;
}
CraftTask::CraftTask(int* items, int* auxValues, int numItems, int quantity,
Tutorial* tutorial, int descriptionId,
bool enablePreCompletion /*= true*/,
std::vector<TutorialConstraint*>* inConstraints /*= nullptr*/,
bool bShowMinimumTime /*=false*/,
bool bAllowFade /*=true*/, bool m_bTaskReminders /*=true*/)
CraftTask::CraftTask(
int* items, int* auxValues, int numItems, int quantity, Tutorial* tutorial,
int descriptionId, bool enablePreCompletion /*= true*/,
std::vector<TutorialConstraint*>* inConstraints /*= nullptr*/,
bool bShowMinimumTime /*=false*/, bool bAllowFade /*=true*/,
bool m_bTaskReminders /*=true*/)
: TutorialTask(tutorial, descriptionId, enablePreCompletion, inConstraints,
bShowMinimumTime, bAllowFade, m_bTaskReminders),
m_quantity(quantity),

View file

@ -12,7 +12,8 @@ InfoTask::InfoTask(
Tutorial* tutorial, int descriptionId, int promptId /*= -1*/,
bool requiresUserInput /*= false*/, int iMapping /*= 0*/,
ETelemetryChallenges telemetryEvent /*= eTelemetryTutorial_NoEvent*/)
: TutorialTask(tutorial, descriptionId, false, nullptr, true, false, false) {
: TutorialTask(tutorial, descriptionId, false, nullptr, true, false,
false) {
if (requiresUserInput == true) {
constraints.push_back(new InputConstraint(iMapping));
}
@ -45,8 +46,8 @@ bool InfoTask::isCompleted() {
// If a menu is displayed, then we use the handleUIInput to complete the
// task
bAllComplete = true;
for (auto it = completedMappings.begin();
it != completedMappings.end(); ++it) {
for (auto it = completedMappings.begin(); it != completedMappings.end();
++it) {
bool current = (*it).second;
if (!current) {
bAllComplete = false;
@ -56,8 +57,8 @@ bool InfoTask::isCompleted() {
} else {
int iCurrent = 0;
for (auto it = completedMappings.begin();
it != completedMappings.end(); ++it) {
for (auto it = completedMappings.begin(); it != completedMappings.end();
++it) {
bool current = (*it).second;
if (!current) {
if (InputManager.GetValue(pMinecraft->player->GetXboxPad(),
@ -94,8 +95,8 @@ void InfoTask::setAsCurrentTask(bool active /*= true*/) {
void InfoTask::handleUIInput(int iAction) {
if (bHasBeenActivated) {
for (auto it = completedMappings.begin();
it != completedMappings.end(); ++it) {
for (auto it = completedMappings.begin(); it != completedMappings.end();
++it) {
if (iAction == (*it).first) {
(*it).second = true;
}

View file

@ -2,8 +2,7 @@
#include "ProcedureCompoundTask.h"
ProcedureCompoundTask::~ProcedureCompoundTask() {
for (auto it = m_taskSequence.begin(); it < m_taskSequence.end();
++it) {
for (auto it = m_taskSequence.begin(); it < m_taskSequence.end(); ++it) {
delete (*it);
}
}

View file

@ -1683,8 +1683,8 @@ Tutorial::Tutorial(int iPad, bool isFullTutorial /*= false*/) : m_iPad(iPad) {
if (isFullTutorial)
addTask(e_Tutorial_State_Horse,
new RideEntityTask(eTYPE_HORSE, this,
IDS_TUTORIAL_TASK_HORSE_RIDE, true, nullptr,
false, false, false));
IDS_TUTORIAL_TASK_HORSE_RIDE, true,
nullptr, false, false, false));
else
addTask(e_Tutorial_State_Horse,
new InfoTask(this, IDS_TUTORIAL_TASK_HORSE_RIDE,
@ -1929,8 +1929,8 @@ Tutorial::Tutorial(int iPad, bool isFullTutorial /*= false*/) : m_iPad(iPad) {
}
Tutorial::~Tutorial() {
for (auto it = m_globalConstraints.begin();
it != m_globalConstraints.end(); ++it) {
for (auto it = m_globalConstraints.begin(); it != m_globalConstraints.end();
++it) {
delete (*it);
}
for (std::unordered_map<int, TutorialMessage*>::iterator it =
@ -1968,8 +1968,8 @@ void Tutorial::setCompleted(int completableId) {
// }
int completableIndex = -1;
for (auto it = s_completableTasks.begin();
it < s_completableTasks.end(); ++it) {
for (auto it = s_completableTasks.begin(); it < s_completableTasks.end();
++it) {
++completableIndex;
if (*it == completableId) {
break;
@ -1996,8 +1996,8 @@ bool Tutorial::getCompleted(int completableId) {
// }
int completableIndex = -1;
for (auto it = s_completableTasks.begin();
it < s_completableTasks.end(); ++it) {
for (auto it = s_completableTasks.begin(); it < s_completableTasks.end();
++it) {
++completableIndex;
if (*it == completableId) {
break;
@ -2152,8 +2152,8 @@ void Tutorial::tick() {
}
// Check constraints
for (auto it = m_globalConstraints.begin();
it < m_globalConstraints.end(); ++it) {
for (auto it = m_globalConstraints.begin(); it < m_globalConstraints.end();
++it) {
TutorialConstraint* constraint = *it;
constraint->tick(m_iPad);
}
@ -2234,8 +2234,7 @@ void Tutorial::tick() {
// gameplay state so that they are in effect for
// a bit longer
auto itCon =
constraintsToRemove[m_CurrentState]
.begin();
constraintsToRemove[m_CurrentState].begin();
while (
itCon !=
constraintsToRemove[m_CurrentState].end()) {
@ -2259,8 +2258,7 @@ void Tutorial::tick() {
}
// Fall through the the normal complete state
case e_Tutorial_Completion_Complete_State:
for (auto
itRem =
for (auto itRem =
activeTasks[m_CurrentState].begin();
itRem < activeTasks[m_CurrentState].end();
++itRem) {
@ -2273,8 +2271,7 @@ void Tutorial::tick() {
activeTasks[m_CurrentState].at(
activeTasks[m_CurrentState].size() - 1);
activeTasks[m_CurrentState].pop_back();
for (auto
itRem =
for (auto itRem =
activeTasks[m_CurrentState].begin();
itRem < activeTasks[m_CurrentState].end();
++itRem) {
@ -2773,8 +2770,8 @@ void Tutorial::onLookAtEntity(std::shared_ptr<Entity> entity) {
}
}
if ((m_CurrentState == e_Tutorial_State_Gameplay) && entity->instanceof
(eTYPE_HORSE)) {
if ((m_CurrentState == e_Tutorial_State_Gameplay) &&
entity->instanceof(eTYPE_HORSE)) {
changeTutorialState(e_Tutorial_State_Horse);
}
@ -2898,7 +2895,7 @@ void Tutorial::RemoveConstraint(TutorialConstraint* c,
}
auto it = find(constraints[m_CurrentState].begin(),
constraints[m_CurrentState].end(), c);
constraints[m_CurrentState].end(), c);
if (it != constraints[m_CurrentState].end())
constraints[m_CurrentState].erase(
find(constraints[m_CurrentState].begin(),
@ -2934,8 +2931,7 @@ void Tutorial::addMessage(
}
void Tutorial::changeTutorialState(eTutorial_State newState,
UIScene* scene /*= nullptr*/)
{
UIScene* scene /*= nullptr*/) {
if (newState == m_CurrentState) {
// If clearing the scene, make sure that the tutorial popup has its
// reference to this scene removed

View file

@ -135,7 +135,8 @@ public:
void setCompleted(int completableId);
bool getCompleted(int completableId);
void changeTutorialState(eTutorial_State newState, UIScene* scene = nullptr);
void changeTutorialState(eTutorial_State newState,
UIScene* scene = nullptr);
bool isSelectedItemState();
bool setMessage(PopupMessageDetails* message);

View file

@ -22,7 +22,8 @@ public:
virtual bool useItemOn(std::shared_ptr<Player> player, Level* level,
std::shared_ptr<ItemInstance> item, int x, int y,
int z, int face, Vec3* hit,
bool bTestUseOnly = false, bool* pbUsedItem = nullptr);
bool bTestUseOnly = false,
bool* pbUsedItem = nullptr);
virtual void attack(std::shared_ptr<Player> player,
std::shared_ptr<Entity> entity);

View file

@ -13,11 +13,11 @@ class MobEffect;
// enablePreCompletion - If this is true, then the player can complete this
// task out of sequence.
// This stops us asking them to do
//things they have already done
// things they have already done
// constraints - A list of constraints which can be activated
// (as a whole).
// If they are active, then the
//constraints are removed when the task is completed
// constraints are removed when the task is completed
// areConstraintsEnabled- A flag which records whether or not we have added the
// constraints to the tutorial
class TutorialTask {

View file

@ -9,7 +9,6 @@
#include "../../Minecraft.Client/Player/MultiPlayerLocalPlayer.h"
#include "../../Minecraft.Client/Minecraft.h"
IUIScene_AbstractContainerMenu::IUIScene_AbstractContainerMenu() {
m_menu = nullptr;
m_autoDeleteMenu = false;
@ -68,12 +67,11 @@ void IUIScene_AbstractContainerMenu::Initialize(
m_iCurrSlotX = 0;
m_iCurrSlotY = 0;
#endif
//
// for(int i=0;i<XUSER_MAX_COUNT;i++)
// {
// m_bFirstTouchStored[i]=false;
// }
//
// for(int i=0;i<XUSER_MAX_COUNT;i++)
// {
// m_bFirstTouchStored[i]=false;
// }
PlatformInitialize(iPad, startIndex);
}
@ -247,123 +245,117 @@ void IUIScene_AbstractContainerMenu::onMouseTick() {
((float)app.GetGameSettings(iPad, eGameSetting_Sensitivity_InMenu) /
100.0f); // apply the sensitivity
// If there is any input on sticks, move the pointer.
if ((fabs(fInputX) >= 0.01f) || (fabs(fInputY) >= 0.01f)) {
fInputDirX = (fInputX > 0.0f) ? 1.0f
: (fInputX < 0.0f) ? -1.0f
: 0.0f;
fInputDirY = (fInputY > 0.0f) ? 1.0f
: (fInputY < 0.0f) ? -1.0f
: 0.0f;
// If there is any input on sticks, move the pointer.
if ((fabs(fInputX) >= 0.01f) || (fabs(fInputY) >= 0.01f)) {
fInputDirX = (fInputX > 0.0f) ? 1.0f : (fInputX < 0.0f) ? -1.0f : 0.0f;
fInputDirY = (fInputY > 0.0f) ? 1.0f : (fInputY < 0.0f) ? -1.0f : 0.0f;
#if defined(TAP_DETECTION)
// Check for potential tap input to jump slot.
ETapState eNewTapInput = GetTapInputType(fInputX, fInputY);
// Check for potential tap input to jump slot.
ETapState eNewTapInput = GetTapInputType(fInputX, fInputY);
switch (m_eCurrTapState) {
case eTapStateNoInput:
m_eCurrTapState = eNewTapInput;
break;
switch (m_eCurrTapState) {
case eTapStateNoInput:
m_eCurrTapState = eNewTapInput;
break;
case eTapStateUp:
case eTapStateDown:
case eTapStateLeft:
case eTapStateRight:
if ((eNewTapInput != m_eCurrTapState) &&
(eNewTapInput != eTapStateNoInput)) {
// Input is no longer suitable for tap.
m_eCurrTapState = eTapNone;
}
break;
case eTapStateUp:
case eTapStateDown:
case eTapStateLeft:
case eTapStateRight:
if ((eNewTapInput != m_eCurrTapState) &&
(eNewTapInput != eTapStateNoInput)) {
// Input is no longer suitable for tap.
m_eCurrTapState = eTapNone;
}
break;
case eTapNone:
/// Nothing to do, input is not a tap.
break;
default:
break;
}
case eTapNone:
/// Nothing to do, input is not a tap.
break;
default:
break;
}
#endif
// Square it so we get more precision for small inputs.
fInputX = fInputX * fInputX * fInputDirX * POINTER_SPEED_FACTOR;
fInputY = fInputY * fInputY * fInputDirY * POINTER_SPEED_FACTOR;
// fInputX = fInputX * POINTER_SPEED_FACTOR;
// fInputY = fInputY * POINTER_SPEED_FACTOR;
float fInputScale = 1.0f;
// Square it so we get more precision for small inputs.
fInputX = fInputX * fInputX * fInputDirX * POINTER_SPEED_FACTOR;
fInputY = fInputY * fInputY * fInputDirY * POINTER_SPEED_FACTOR;
// fInputX = fInputX * POINTER_SPEED_FACTOR;
// fInputY = fInputY * POINTER_SPEED_FACTOR;
float fInputScale = 1.0f;
// Ramp up input from zero when new input is recieved over
// INPUT_TICKS_FOR_SCALING ticks. This is to try to improve tapping
// stick to move 1 box.
if (m_iConsectiveInputTicks < MAX_INPUT_TICKS_FOR_SCALING) {
++m_iConsectiveInputTicks;
fInputScale = ((float)(m_iConsectiveInputTicks) /
(float)(MAX_INPUT_TICKS_FOR_SCALING));
}
// Ramp up input from zero when new input is recieved over
// INPUT_TICKS_FOR_SCALING ticks. This is to try to improve tapping
// stick to move 1 box.
if (m_iConsectiveInputTicks < MAX_INPUT_TICKS_FOR_SCALING) {
++m_iConsectiveInputTicks;
fInputScale = ((float)(m_iConsectiveInputTicks) /
(float)(MAX_INPUT_TICKS_FOR_SCALING));
}
#if defined(TAP_DETECTION)
else if (m_iConsectiveInputTicks < MAX_INPUT_TICKS_FOR_TAPPING) {
++m_iConsectiveInputTicks;
} else {
m_eCurrTapState = eTapNone;
}
else if (m_iConsectiveInputTicks < MAX_INPUT_TICKS_FOR_TAPPING) {
++m_iConsectiveInputTicks;
} else {
m_eCurrTapState = eTapNone;
}
#endif
// 4J Stu - The cursor moves too fast in SD mode
// The SD/splitscreen scenes are approximately 0.6 times the size of
// the fullscreen on
if (!RenderManager.IsHiDef() || app.GetLocalPlayerCount() > 1)
fInputScale *= 0.6f;
// 4J Stu - The cursor moves too fast in SD mode
// The SD/splitscreen scenes are approximately 0.6 times the size of
// the fullscreen on
if (!RenderManager.IsHiDef() || app.GetLocalPlayerCount() > 1)
fInputScale *= 0.6f;
fInputX *= fInputScale;
fInputY *= fInputScale;
fInputX *= fInputScale;
fInputY *= fInputScale;
#if defined(USE_POINTER_ACCEL)
m_fPointerAccelX += fInputX / 50.0f;
m_fPointerAccelY += fInputY / 50.0f;
m_fPointerAccelX += fInputX / 50.0f;
m_fPointerAccelY += fInputY / 50.0f;
if (fabsf(fInputX) > fabsf(m_fPointerVelX + m_fPointerAccelX)) {
m_fPointerVelX += m_fPointerAccelX;
} else {
m_fPointerAccelX = fInputX - m_fPointerVelX;
m_fPointerVelX = fInputX;
}
if (fabsf(fInputX) > fabsf(m_fPointerVelX + m_fPointerAccelX)) {
m_fPointerVelX += m_fPointerAccelX;
} else {
m_fPointerAccelX = fInputX - m_fPointerVelX;
m_fPointerVelX = fInputX;
}
if (fabsf(fInputY) > fabsf(m_fPointerVelY + m_fPointerAccelY)) {
m_fPointerVelY += m_fPointerAccelY;
} else {
m_fPointerAccelY = fInputY - m_fPointerVelY;
m_fPointerVelY = fInputY;
}
// printf( "IN %.2f VEL %.2f ACC %.2f\n", fInputY, m_fPointerVelY,
// m_fPointerAccelY );
if (fabsf(fInputY) > fabsf(m_fPointerVelY + m_fPointerAccelY)) {
m_fPointerVelY += m_fPointerAccelY;
} else {
m_fPointerAccelY = fInputY - m_fPointerVelY;
m_fPointerVelY = fInputY;
}
// printf( "IN %.2f VEL %.2f ACC %.2f\n", fInputY, m_fPointerVelY,
// m_fPointerAccelY );
vPointerPos.x += m_fPointerVelX;
vPointerPos.y -= m_fPointerVelY;
vPointerPos.x += m_fPointerVelX;
vPointerPos.y -= m_fPointerVelY;
#else
// Add input to pointer position.
vPointerPos.x += fInputX;
vPointerPos.y -= fInputY;
#endif
// Clamp to pointer extents.
if (vPointerPos.x < m_fPointerMinX)
vPointerPos.x = m_fPointerMinX;
else if (vPointerPos.x > m_fPointerMaxX)
vPointerPos.x = m_fPointerMaxX;
if (vPointerPos.y < m_fPointerMinY)
vPointerPos.y = m_fPointerMinY;
else if (vPointerPos.y > m_fPointerMaxY)
vPointerPos.y = m_fPointerMaxY;
// Clamp to pointer extents.
if (vPointerPos.x < m_fPointerMinX)
vPointerPos.x = m_fPointerMinX;
else if (vPointerPos.x > m_fPointerMaxX)
vPointerPos.x = m_fPointerMaxX;
if (vPointerPos.y < m_fPointerMinY)
vPointerPos.y = m_fPointerMinY;
else if (vPointerPos.y > m_fPointerMaxY)
vPointerPos.y = m_fPointerMaxY;
bStickInput = true;
} else {
m_iConsectiveInputTicks = 0;
bStickInput = true;
} else {
m_iConsectiveInputTicks = 0;
#if defined(USE_POINTER_ACCEL)
m_fPointerVelX = 0.0f;
m_fPointerVelY = 0.0f;
m_fPointerAccelX = 0.0f;
m_fPointerAccelY = 0.0f;
m_fPointerVelX = 0.0f;
m_fPointerVelY = 0.0f;
m_fPointerAccelX = 0.0f;
m_fPointerAccelY = 0.0f;
#endif
}
}
// Determine which slot the pointer is currently over.
ESceneSection eSectionUnderPointer = eSectionNone;
@ -480,8 +472,8 @@ void IUIScene_AbstractContainerMenu::onMouseTick() {
m_iCurrSlotX = iNewSlotX;
m_iCurrSlotY = iNewSlotY;
#endif
// No need to check any further slots, the pointer can only ever be over
// one.
// No need to check any further slots, the pointer can
// only ever be over one.
break;
}
}

View file

@ -164,7 +164,6 @@ protected:
int m_iCurrSlotX;
int m_iCurrSlotY;
// ENum indexes of the first section for this scene, and 1+the last section
ESceneSection m_eFirstSection, m_eMaxSection;

View file

@ -271,7 +271,8 @@ void IUIScene_BeaconMenu::handleTick() {
int totalWidth = count * 22 + (count - 1) * 2;
for (int c = 0; c < count; c++) {
if (BeaconTileEntity::BEACON_EFFECTS[tier][c] == nullptr) continue;
if (BeaconTileEntity::BEACON_EFFECTS[tier][c] == nullptr)
continue;
int effectId = BeaconTileEntity::BEACON_EFFECTS[tier][c]->id;
int icon = BeaconTileEntity::BEACON_EFFECTS[tier][c]->getIcon();
@ -298,7 +299,8 @@ void IUIScene_BeaconMenu::handleTick() {
int totalWidth = count * 22 + (count - 1) * 2;
for (int c = 0; c < count - 1; c++) {
if (BeaconTileEntity::BEACON_EFFECTS[tier][c] == nullptr) continue;
if (BeaconTileEntity::BEACON_EFFECTS[tier][c] == nullptr)
continue;
int effectId = BeaconTileEntity::BEACON_EFFECTS[tier][c]->id;
int icon = BeaconTileEntity::BEACON_EFFECTS[tier][c]->getIcon();

View file

@ -651,8 +651,9 @@ void IUIScene_CraftingMenu::CheckRecipesAvailable() {
// if(pTempItemInst->id<256)
// {
// Tile
// *pTile=Tile::tiles[pTempItemInst->id]; printf("[TILE] ID\t%d\tAux
// val\t%d\tBase type\t%d\tMaterial\t%d\t Count=%d\n",pTempItemInst->id,
// *pTile=Tile::tiles[pTempItemInst->id];
// printf("[TILE] ID\t%d\tAux val\t%d\tBase type\t%d\tMaterial\t%d\t
// Count=%d\n",pTempItemInst->id,
// pTempItemInst->getAuxValue(),pTile->getBaseItemType(),pTile->getMaterial(),pTempItemInst->GetCount());
// }
// else

View file

@ -211,7 +211,6 @@ void IUIScene_CreativeMenu::staticCtor() {
ITEM_AUX(Tile::woolCarpet_Id, 13) // Green
ITEM_AUX(Tile::woolCarpet_Id, 12) // Brown
#if !defined(_CONTENT_PACKAGE)
DEF(eCreativeInventory_ArtToolsDecorations)
if (app.DebugSettingsOn()) {
@ -508,7 +507,8 @@ void IUIScene_CreativeMenu::staticCtor() {
for (unsigned int i = 0; i < Enchantment::enchantments.length; ++i) {
Enchantment* enchantment = Enchantment::enchantments[i];
if (enchantment == nullptr || enchantment->category == nullptr) continue;
if (enchantment == nullptr || enchantment->category == nullptr)
continue;
list->push_back(Item::enchantedBook->createForEnchantment(
new EnchantmentInstance(enchantment, enchantment->getMaxLevel())));
}
@ -862,8 +862,8 @@ void IUIScene_CreativeMenu::staticCtor() {
ECreative_Inventory_Groups debugMiscGroup[] = {
eCreativeInventory_ArtToolsMisc};
specs[eCreativeInventoryTab_Misc] =
new TabSpec(L"Misc", IDS_GROUPNAME_MISCELLANEOUS, 1, miscGroup, 0, nullptr,
1, debugMiscGroup);
new TabSpec(L"Misc", IDS_GROUPNAME_MISCELLANEOUS, 1, miscGroup, 0,
nullptr, 1, debugMiscGroup);
#else
ECreative_Inventory_Groups miscGroup[] = {eCreativeInventory_Misc};
specs[eCreativeInventoryTab_Misc] =
@ -982,8 +982,7 @@ void IUIScene_CreativeMenu::TabSpec::populateMenu(AbstractContainerMenu* menu,
// Fill the dynamic group
if (m_dynamicGroupsCount > 0 && m_dynamicGroupsA != nullptr) {
for (auto it=
categoryGroups[m_dynamicGroupsA[dynamicIndex]].rbegin();
for (auto it = categoryGroups[m_dynamicGroupsA[dynamicIndex]].rbegin();
it != categoryGroups[m_dynamicGroupsA[dynamicIndex]].rend() &&
lastSlotIndex < MAX_SIZE;
++it) {

View file

@ -205,7 +205,8 @@ void IUIScene_HUD::renderPlayerHealth() {
std::shared_ptr<Entity> riding = pMinecraft->localplayers[iPad]->riding;
if (riding == nullptr || riding && !riding->instanceof(eTYPE_LIVINGENTITY)) {
if (riding == nullptr ||
riding && !riding->instanceof(eTYPE_LIVINGENTITY)) {
SetRidingHorse(false, false, 0);
ShowFood(true);

View file

@ -51,7 +51,6 @@ int IUIScene_PauseMenu::ExitGameSaveDialogReturned(
->getDLCInfoParentPack(); // tPack->getDLCPack();
if (!pDLCPack->hasPurchasedFile(DLCManager::e_DLCType_Texture,
L"")) {
unsigned int uiIDA[2];
uiIDA[0] = IDS_CONFIRM_OK;
uiIDA[1] = IDS_CONFIRM_CANCEL;
@ -192,9 +191,6 @@ int IUIScene_PauseMenu::ExitGameDeclineSaveReturned(
int IUIScene_PauseMenu::WarningTrialTexturePackReturned(
void* pParam, int iPad, C4JStorage::EMessageResult result) {
return 0;
}
@ -227,7 +223,6 @@ int IUIScene_PauseMenu::SaveWorldThreadProc(void* lpParameter) {
if (!MinecraftServer::serverHalted() && !app.GetChangingSessionType())
app.SetGameStarted(true);
}
int32_t hr = S_OK;
@ -443,7 +438,6 @@ void IUIScene_PauseMenu::_ExitWorld(void* lpParameter) {
app.SetChangingSessionType(false);
app.SetReallyChangingSessionType(false);
pMinecraft->exitingWorldRightNow = false;
}
int IUIScene_PauseMenu::SaveGameDialogReturned(

View file

@ -166,7 +166,7 @@ void IUIScene_StartGame::UpdateTexturePackDescription(int index) {
// if(imageBytes > 0 && imageData)
//{
// registerSubstitutionTexture(L"texturePackIcon", imageData,
//imageBytes);
// imageBytes);
// m_bitmapTexturePackIcon.setTextureName(L"texturePackIcon");
// }
@ -249,7 +249,6 @@ int IUIScene_StartGame::UnlockTexturePackReturned(
if (result == C4JStorage::EMessage_ResultAccept) {
if (ProfileManager.IsSignedIn(iPad)) {
// the license change coming in when the offer has been installed
// will cause this scene to refresh
}

View file

@ -180,8 +180,8 @@ void IUIScene_TradingMenu::updateDisplay() {
m_activeOffers.clear();
int unfilteredIndex = 0;
int firstValidTrade = INT_MAX;
for (auto it = unfilteredOffers->begin();
it != unfilteredOffers->end(); ++it) {
for (auto it = unfilteredOffers->begin(); it != unfilteredOffers->end();
++it) {
MerchantRecipe* recipe = *it;
if (!recipe->isDeprecated()) {
m_activeOffers.push_back(

View file

@ -38,7 +38,6 @@
#include "UIControl_SpaceIndicatorBar.h"
#include "UIControl_BeaconEffectButton.h"
#include "UIScene_HUD.h"
#include "UIComponent_Panorama.h"
#include "UIComponent_Logo.h"

View file

@ -240,8 +240,8 @@ rrbool UIBitmapFont::CanProvideBitmap(S32 glyph, F32 pixel_scale) {
// Parameters
// glyph The glyph to compute/get the bitmap for
// pixel_scale The scale factor (pseudo point size) requested by the
//textfield,adjusted for display resolution bitmap The structure to store the
//bitmap into
// textfield,adjusted for display resolution bitmap The structure to store
// the bitmap into
rrbool UIBitmapFont::GetGlyphBitmap(S32 glyph, F32 pixel_scale,
IggyBitmapCharacter* bitmap) {
// Description
@ -326,8 +326,9 @@ rrbool UIBitmapFont::GetGlyphBitmap(S32 glyph, F32 pixel_scale,
#endif
// app.DebugPrintf("Request glyph_%d (U+%.4X) at %f, converted to %f
// (%f)\n", glyph, GetUnicode(glyph), pixel_scale, targetPixelScale,
//glyphScale);
// (%f)\n", glyph, GetUnicode(glyph),
// pixel_scale, targetPixelScale,
// glyphScale);
// It is not necessary to shrink the glyph width here
// as its already been done in 'GetGlyphMetrics' by:

View file

@ -7,8 +7,12 @@ class CFontData;
// const int BITMAP_FONT_LANGUAGES = XC_LANGUAGE_ENGLISH
// |
// XC_LANGUAGE_GERMAN | XC_LANGUAGE_FRENCH | XC_LANGUAGE_SPANISH |
// XC_LANGUAGE_ITALIAN | XC_LANGUAGE_PORTUGUESE | XC_LANGUAGE_BRAZILIAN;
// XC_LANGUAGE_GERMAN
// | XC_LANGUAGE_FRENCH
// | XC_LANGUAGE_SPANISH
// | XC_LANGUAGE_ITALIAN
// | XC_LANGUAGE_PORTUGUESE
// | XC_LANGUAGE_BRAZILIAN;
// using namespace std;

View file

@ -12,8 +12,6 @@ UIComponent_Tooltips::UIComponent_Tooltips(int iPad, void* initData,
}
// Setup all the Iggy references we need for this scene
initialiseMovie();
}
std::wstring UIComponent_Tooltips::getMoviePath() {
@ -311,14 +309,11 @@ void UIComponent_Tooltips::_Relayout() {
IggyResult out = IggyPlayerCallMethodRS(getMovie(), &result,
IggyPlayerRootPath(getMovie()),
m_funcUpdateLayout, 0, nullptr);
}
void UIComponent_Tooltips::handleReload() {
app.DebugPrintf("UIComponent_Tooltips::handleReload\n");
for (unsigned int i = 0; i < eToolTipNumButtons; ++i) {
_SetTooltip(i, m_tooltipValues[i].iString, m_tooltipValues[i].show,
true);

View file

@ -24,7 +24,6 @@ protected:
IggyName m_funcSetTooltip, m_funcSetOpacity, m_funcSetABSwap,
m_funcUpdateLayout;
UI_BEGIN_MAP_ELEMENTS_AND_NAMES(UIScene)
UI_MAP_NAME(m_funcSetTooltip, L"SetToolTip")
UI_MAP_NAME(m_funcSetOpacity, L"SetOpacity")
@ -81,5 +80,4 @@ private:
void _Relayout();
bool m_overrideSFX[XUSER_MAX_COUNT][ACTION_MAX_MENU];
};

View file

@ -335,7 +335,8 @@ std::wstring UIComponent_TutorialPopup::_SetIcon(int icon, int iAuxVal,
m_iconItem = nullptr;
}
}
if (!isFixedIcon && m_iconItem != nullptr) setupIconHolder(e_ICON_TYPE_IGGY);
if (!isFixedIcon && m_iconItem != nullptr)
setupIconHolder(e_ICON_TYPE_IGGY);
m_controlIconHolder.setVisible(isFixedIcon || m_iconItem != nullptr);
return temp;

View file

@ -98,7 +98,8 @@ private:
void _SetDescription(UIScene* interactScene, const std::wstring& desc,
const std::wstring& title, bool allowFade,
bool isReminder);
std::wstring _SetIcon(int icon, int iAuxVal, bool isFoil, const wchar_t* desc);
std::wstring _SetIcon(int icon, int iAuxVal, bool isFoil,
const wchar_t* desc);
std::wstring _SetImage(std::wstring& desc);
std::wstring ParseDescription(int iPad, std::wstring& text);
void UpdateInteractScenePosition(bool visible);

View file

@ -64,7 +64,6 @@ bool UIControl::setupControl(UIScene* scene, IggyValuePath* parent,
return res;
}
void UIControl::ReInit() {
if (!m_isValid) return;
@ -86,7 +85,8 @@ void UIControl::ReInit() {
m_funcSetAlpha, 2, value);
}
IggyValueSetBooleanRS(getIggyValuePath(), m_nameVisible, nullptr, m_isVisible);
IggyValueSetBooleanRS(getIggyValuePath(), m_nameVisible, nullptr,
m_isVisible);
}
IggyValuePath* UIControl::getIggyValuePath() { return &m_iggyPath; }

View file

@ -35,7 +35,6 @@ void UIControl_Button::init(UIString label, int id) {
IggyResult out =
IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result,
getIggyValuePath(), m_initFunc, 2, value);
}
void UIControl_Button::ReInit() {

View file

@ -34,7 +34,6 @@ void UIControl_ButtonList::init(int id) {
IggyResult out =
IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result,
getIggyValuePath(), m_initFunc, 1, value);
}
void UIControl_ButtonList::ReInit() {
@ -151,7 +150,6 @@ void UIControl_ButtonList::setButtonLabel(int iButtonId,
m_funcSetButtonLabel, 2, value);
}
void UIControl_DynamicButtonList::tick() {
UIControl_ButtonList::tick();

Some files were not shown because too many files have changed in this diff Show more