forked from backups/MinecraftConsoles
Remove AUTO_VAR macro and _toString function (#592)
This commit is contained in:
parent
7d6658fe5b
commit
55231bb8d3
18
.clang-tidy
Normal file
18
.clang-tidy
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
---
|
||||||
|
# Enable all modernize checks, but explicitly exclude trailing return types
|
||||||
|
Checks: >
|
||||||
|
-*,
|
||||||
|
modernize-*,
|
||||||
|
google-readability-casting,
|
||||||
|
cppcoreguidelines-pro-type-cstyle-cast,
|
||||||
|
-modernize-use-trailing-return-type
|
||||||
|
|
||||||
|
# Pass the C++14 flag to the internal Clang compiler
|
||||||
|
ExtraArgs: ['-std=c++14']
|
||||||
|
|
||||||
|
CheckOptions:
|
||||||
|
- key: modernize-loop-convert.MinConfidence
|
||||||
|
value: reasonable
|
||||||
|
- key: modernize-use-auto.MinTypeNameLength
|
||||||
|
value: 5
|
||||||
|
...
|
||||||
30
Minecraft.Client/.clangd
Normal file
30
Minecraft.Client/.clangd
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
CompileFlags:
|
||||||
|
Add: [-std=c++14,
|
||||||
|
-m64,
|
||||||
|
-Wno-unused-includes
|
||||||
|
]
|
||||||
|
Remove: [-W*]
|
||||||
|
|
||||||
|
Index:
|
||||||
|
StandardLibrary: true
|
||||||
|
|
||||||
|
Diagnostics:
|
||||||
|
Suppress: unused-includes
|
||||||
|
UnusedIncludes: None
|
||||||
|
ClangTidy:
|
||||||
|
Add: [modernize-loop-convert]
|
||||||
|
|
||||||
|
Completion:
|
||||||
|
AllScopes: Yes
|
||||||
|
ArgumentLists: Delimiters
|
||||||
|
HeaderInsertion: Never
|
||||||
|
|
||||||
|
InlayHints:
|
||||||
|
BlockEnd: true
|
||||||
|
ParameterNames: false
|
||||||
|
DeducedTypes: false
|
||||||
|
Designators: false
|
||||||
|
DefaultArguments: false
|
||||||
|
|
||||||
|
Hover:
|
||||||
|
ShowAKA: true
|
||||||
|
|
@ -52,12 +52,9 @@ void AbstractContainerScreen::render(int xm, int ym, float a)
|
||||||
glEnable(GL_RESCALE_NORMAL);
|
glEnable(GL_RESCALE_NORMAL);
|
||||||
|
|
||||||
Slot *hoveredSlot = NULL;
|
Slot *hoveredSlot = NULL;
|
||||||
|
|
||||||
AUTO_VAR(itEnd, menu->slots->end());
|
|
||||||
for (AUTO_VAR(it, menu->slots->begin()); it != itEnd; it++)
|
|
||||||
{
|
|
||||||
Slot *slot = *it; //menu->slots->at(i);
|
|
||||||
|
|
||||||
|
for ( Slot *slot : *menu->slots )
|
||||||
|
{
|
||||||
renderSlot(slot);
|
renderSlot(slot);
|
||||||
|
|
||||||
if (isHovering(slot, xm, ym))
|
if (isHovering(slot, xm, ym))
|
||||||
|
|
@ -150,10 +147,8 @@ void AbstractContainerScreen::renderSlot(Slot *slot)
|
||||||
|
|
||||||
Slot *AbstractContainerScreen::findSlot(int x, int y)
|
Slot *AbstractContainerScreen::findSlot(int x, int y)
|
||||||
{
|
{
|
||||||
AUTO_VAR(itEnd, menu->slots->end());
|
for (Slot* slot : menu->slots )
|
||||||
for (AUTO_VAR(it, menu->slots->begin()); it != itEnd; it++)
|
|
||||||
{
|
{
|
||||||
Slot *slot = *it; //menu->slots->at(i);
|
|
||||||
if (isHovering(slot, x, y)) return slot;
|
if (isHovering(slot, x, y)) return slot;
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
||||||
|
|
@ -261,12 +261,10 @@ void AchievementScreen::renderBg(int xm, int ym, float a)
|
||||||
glDepthFunc(GL_LEQUAL);
|
glDepthFunc(GL_LEQUAL);
|
||||||
|
|
||||||
glDisable(GL_TEXTURE_2D);
|
glDisable(GL_TEXTURE_2D);
|
||||||
|
|
||||||
AUTO_VAR(itEnd, Achievements::achievements->end());
|
for ( Achievement *ach : *Achievements::achievements )
|
||||||
for (AUTO_VAR(it, Achievements::achievements->begin()); it != itEnd; it++)
|
|
||||||
{
|
{
|
||||||
Achievement *ach = *it; //Achievements::achievements->at(i);
|
if ( ach == nullptr || ach->requires == nullptr) continue;
|
||||||
if (ach->requires == NULL) continue;
|
|
||||||
|
|
||||||
int x1 = ach->x * ACHIEVEMENT_COORD_SCALE - (int) xScroll + 11 + xBigMap;
|
int x1 = ach->x * ACHIEVEMENT_COORD_SCALE - (int) xScroll + 11 + xBigMap;
|
||||||
int y1 = ach->y * ACHIEVEMENT_COORD_SCALE - (int) yScroll + 11 + yBigMap;
|
int y1 = ach->y * ACHIEVEMENT_COORD_SCALE - (int) yScroll + 11 + yBigMap;
|
||||||
|
|
@ -298,12 +296,9 @@ void AchievementScreen::renderBg(int xm, int ym, float a)
|
||||||
glDisable(GL_LIGHTING);
|
glDisable(GL_LIGHTING);
|
||||||
glEnable(GL_RESCALE_NORMAL);
|
glEnable(GL_RESCALE_NORMAL);
|
||||||
glEnable(GL_COLOR_MATERIAL);
|
glEnable(GL_COLOR_MATERIAL);
|
||||||
|
|
||||||
itEnd = Achievements::achievements->end();
|
|
||||||
for (AUTO_VAR(it, Achievements::achievements->begin()); it != itEnd; it++)
|
|
||||||
{
|
|
||||||
Achievement *ach = *it; //Achievements::achievements->at(i);
|
|
||||||
|
|
||||||
|
for ( Achievement *ach : *Achievements::achievements )
|
||||||
|
{
|
||||||
int x = ach->x * ACHIEVEMENT_COORD_SCALE - (int) xScroll;
|
int x = ach->x * ACHIEVEMENT_COORD_SCALE - (int) xScroll;
|
||||||
int y = ach->y * ACHIEVEMENT_COORD_SCALE - (int) yScroll;
|
int y = ach->y * ACHIEVEMENT_COORD_SCALE - (int) yScroll;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -78,11 +78,8 @@ vector<wstring> *ArchiveFile::getFileList()
|
||||||
{
|
{
|
||||||
vector<wstring> *out = new vector<wstring>();
|
vector<wstring> *out = new vector<wstring>();
|
||||||
|
|
||||||
for ( AUTO_VAR(it, m_index.begin());
|
for ( const auto& it : m_index )
|
||||||
it != m_index.end();
|
out->push_back( it.first );
|
||||||
it++ )
|
|
||||||
|
|
||||||
out->push_back( it->first );
|
|
||||||
|
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
@ -100,7 +97,7 @@ int ArchiveFile::getFileSize(const wstring &filename)
|
||||||
byteArray ArchiveFile::getFile(const wstring &filename)
|
byteArray ArchiveFile::getFile(const wstring &filename)
|
||||||
{
|
{
|
||||||
byteArray out;
|
byteArray out;
|
||||||
AUTO_VAR(it,m_index.find(filename));
|
auto it = m_index.find(filename);
|
||||||
|
|
||||||
if(it == m_index.end())
|
if(it == m_index.end())
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "..\Minecraft.World\StringHelpers.h"
|
#include "..\Minecraft.World\StringHelpers.h"
|
||||||
#include "Textures.h"
|
#include "Textures.h"
|
||||||
#include "..\Minecraft.World\ArrayWithLength.h"
|
#include "..\Minecraft.World\ArrayWithLength.h"
|
||||||
|
|
@ -46,7 +46,7 @@ void BufferedImage::ByteFlip4(unsigned int &data)
|
||||||
}
|
}
|
||||||
// Loads a bitmap into a buffered image - only currently supports the 2 types of 32-bit image that we've made so far
|
// Loads a bitmap into a buffered image - only currently supports the 2 types of 32-bit image that we've made so far
|
||||||
// and determines which of these is which by the compression method. Compression method 3 is a 32-bit image with only
|
// and determines which of these is which by the compression method. Compression method 3 is a 32-bit image with only
|
||||||
// 24-bits used (ie no alpha channel) whereas method 0 is a full 32-bit image with a valid alpha channel.
|
// 24-bits used (ie no alpha channel) whereas method 0 is a full 32-bit image with a valid alpha channel.
|
||||||
BufferedImage::BufferedImage(const wstring& File, bool filenameHasExtension /*=false*/, bool bTitleUpdateTexture /*=false*/, const wstring &drive /*=L""*/)
|
BufferedImage::BufferedImage(const wstring& File, bool filenameHasExtension /*=false*/, bool bTitleUpdateTexture /*=false*/, const wstring &drive /*=L""*/)
|
||||||
{
|
{
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
@ -149,7 +149,7 @@ BufferedImage::BufferedImage(const wstring& File, bool filenameHasExtension /*=f
|
||||||
wstring mipMapPath = L"";
|
wstring mipMapPath = L"";
|
||||||
if( l != 0 )
|
if( l != 0 )
|
||||||
{
|
{
|
||||||
mipMapPath = L"MipMapLevel" + _toString<int>(l+1);
|
mipMapPath = L"MipMapLevel" + std::to_wstring(l+1);
|
||||||
}
|
}
|
||||||
if( filenameHasExtension )
|
if( filenameHasExtension )
|
||||||
{
|
{
|
||||||
|
|
@ -171,7 +171,7 @@ BufferedImage::BufferedImage(const wstring& File, bool filenameHasExtension /*=f
|
||||||
hr=RenderManager.LoadTextureData(pchTextureName,&ImageInfo,&data[l]);
|
hr=RenderManager.LoadTextureData(pchTextureName,&ImageInfo,&data[l]);
|
||||||
|
|
||||||
|
|
||||||
if(hr!=ERROR_SUCCESS)
|
if(hr!=ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
// 4J - If we haven't loaded the non-mipmap version then exit the game
|
// 4J - If we haven't loaded the non-mipmap version then exit the game
|
||||||
if( l == 0 )
|
if( l == 0 )
|
||||||
|
|
@ -179,7 +179,7 @@ BufferedImage::BufferedImage(const wstring& File, bool filenameHasExtension /*=f
|
||||||
app.FatalLoadError();
|
app.FatalLoadError();
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( l == 0 )
|
if( l == 0 )
|
||||||
{
|
{
|
||||||
|
|
@ -207,7 +207,7 @@ BufferedImage::BufferedImage(DLCPack *dlcPack, const wstring& File, bool filenam
|
||||||
wstring mipMapPath = L"";
|
wstring mipMapPath = L"";
|
||||||
if( l != 0 )
|
if( l != 0 )
|
||||||
{
|
{
|
||||||
mipMapPath = L"MipMapLevel" + _toString<int>(l+1);
|
mipMapPath = L"MipMapLevel" + std::to_wstring(l+1);
|
||||||
}
|
}
|
||||||
if( filenameHasExtension )
|
if( filenameHasExtension )
|
||||||
{
|
{
|
||||||
|
|
@ -231,7 +231,7 @@ BufferedImage::BufferedImage(DLCPack *dlcPack, const wstring& File, bool filenam
|
||||||
DLCFile *dlcFile = dlcPack->getFile(DLCManager::e_DLCType_All, name);
|
DLCFile *dlcFile = dlcPack->getFile(DLCManager::e_DLCType_All, name);
|
||||||
pbData = dlcFile->getData(dwBytes);
|
pbData = dlcFile->getData(dwBytes);
|
||||||
if(pbData == NULL || dwBytes == 0)
|
if(pbData == NULL || dwBytes == 0)
|
||||||
{
|
{
|
||||||
// 4J - If we haven't loaded the non-mipmap version then exit the game
|
// 4J - If we haven't loaded the non-mipmap version then exit the game
|
||||||
if( l == 0 )
|
if( l == 0 )
|
||||||
{
|
{
|
||||||
|
|
@ -245,7 +245,7 @@ BufferedImage::BufferedImage(DLCPack *dlcPack, const wstring& File, bool filenam
|
||||||
hr=RenderManager.LoadTextureData(pbData,dwBytes,&ImageInfo,&data[l]);
|
hr=RenderManager.LoadTextureData(pbData,dwBytes,&ImageInfo,&data[l]);
|
||||||
|
|
||||||
|
|
||||||
if(hr!=ERROR_SUCCESS)
|
if(hr!=ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
// 4J - If we haven't loaded the non-mipmap version then exit the game
|
// 4J - If we haven't loaded the non-mipmap version then exit the game
|
||||||
if( l == 0 )
|
if( l == 0 )
|
||||||
|
|
@ -253,7 +253,7 @@ BufferedImage::BufferedImage(DLCPack *dlcPack, const wstring& File, bool filenam
|
||||||
app.FatalLoadError();
|
app.FatalLoadError();
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( l == 0 )
|
if( l == 0 )
|
||||||
{
|
{
|
||||||
|
|
@ -276,7 +276,7 @@ BufferedImage::BufferedImage(BYTE *pbData, DWORD dwBytes)
|
||||||
ZeroMemory(&ImageInfo,sizeof(D3DXIMAGE_INFO));
|
ZeroMemory(&ImageInfo,sizeof(D3DXIMAGE_INFO));
|
||||||
HRESULT hr=RenderManager.LoadTextureData(pbData,dwBytes,&ImageInfo,&data[0]);
|
HRESULT hr=RenderManager.LoadTextureData(pbData,dwBytes,&ImageInfo,&data[0]);
|
||||||
|
|
||||||
if(hr==ERROR_SUCCESS)
|
if(hr==ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
width=ImageInfo.Width;
|
width=ImageInfo.Width;
|
||||||
height=ImageInfo.Height;
|
height=ImageInfo.Height;
|
||||||
|
|
|
||||||
|
|
@ -105,7 +105,7 @@ void Chunk::setPos(int x, int y, int z)
|
||||||
{
|
{
|
||||||
bb = shared_ptr<AABB>(AABB::newPermanent(-g, -g, -g, XZSIZE+g, SIZE+g, XZSIZE+g));
|
bb = shared_ptr<AABB>(AABB::newPermanent(-g, -g, -g, XZSIZE+g, SIZE+g, XZSIZE+g));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// 4J MGH - bounds are relative to the position now, so the AABB will be setup already, either above, or from the tesselator bounds.
|
// 4J MGH - bounds are relative to the position now, so the AABB will be setup already, either above, or from the tesselator bounds.
|
||||||
// bb->set(-g, -g, -g, SIZE+g, SIZE+g, SIZE+g);
|
// bb->set(-g, -g, -g, SIZE+g, SIZE+g, SIZE+g);
|
||||||
|
|
@ -143,7 +143,7 @@ void Chunk::setPos(int x, int y, int z)
|
||||||
|
|
||||||
LeaveCriticalSection(&levelRenderer->m_csDirtyChunks);
|
LeaveCriticalSection(&levelRenderer->m_csDirtyChunks);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Chunk::translateToPos()
|
void Chunk::translateToPos()
|
||||||
|
|
@ -176,7 +176,7 @@ void Chunk::makeCopyForRebuild(Chunk *source)
|
||||||
this->clipChunk = NULL;
|
this->clipChunk = NULL;
|
||||||
this->id = source->id;
|
this->id = source->id;
|
||||||
this->globalRenderableTileEntities = source->globalRenderableTileEntities;
|
this->globalRenderableTileEntities = source->globalRenderableTileEntities;
|
||||||
this->globalRenderableTileEntities_cs = source->globalRenderableTileEntities_cs;
|
this->globalRenderableTileEntities_cs = source->globalRenderableTileEntities_cs;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Chunk::rebuild()
|
void Chunk::rebuild()
|
||||||
|
|
@ -189,7 +189,7 @@ void Chunk::rebuild()
|
||||||
|
|
||||||
// if (!dirty) return;
|
// if (!dirty) return;
|
||||||
PIXBeginNamedEvent(0,"Rebuild section A");
|
PIXBeginNamedEvent(0,"Rebuild section A");
|
||||||
|
|
||||||
#ifdef _LARGE_WORLDS
|
#ifdef _LARGE_WORLDS
|
||||||
Tesselator *t = Tesselator::getInstance();
|
Tesselator *t = Tesselator::getInstance();
|
||||||
#else
|
#else
|
||||||
|
|
@ -226,7 +226,7 @@ void Chunk::rebuild()
|
||||||
// Get the data for the level chunk that this render chunk is it (level chunk is 16 x 16 x 128,
|
// Get the data for the level chunk that this render chunk is it (level chunk is 16 x 16 x 128,
|
||||||
// render chunk is 16 x 16 x 16. We wouldn't have to actually get all of it if the data was ordered differently, but currently
|
// render chunk is 16 x 16 x 16. We wouldn't have to actually get all of it if the data was ordered differently, but currently
|
||||||
// it is ordered by x then z then y so just getting a small range of y out of it would involve getting the whole thing into
|
// it is ordered by x then z then y so just getting a small range of y out of it would involve getting the whole thing into
|
||||||
// the cache anyway.
|
// the cache anyway.
|
||||||
|
|
||||||
#ifdef _LARGE_WORLDS
|
#ifdef _LARGE_WORLDS
|
||||||
unsigned char *tileIds = GetTileIdsStorage();
|
unsigned char *tileIds = GetTileIdsStorage();
|
||||||
|
|
@ -240,9 +240,9 @@ void Chunk::rebuild()
|
||||||
TileRenderer *tileRenderer = new TileRenderer(region, this->x, this->y, this->z, tileIds);
|
TileRenderer *tileRenderer = new TileRenderer(region, this->x, this->y, this->z, tileIds);
|
||||||
|
|
||||||
// AP - added a caching system for Chunk::rebuild to take advantage of
|
// AP - added a caching system for Chunk::rebuild to take advantage of
|
||||||
// Basically we're storing of copy of the tileIDs array inside the region so that calls to Region::getTile can grab data
|
// Basically we're storing of copy of the tileIDs array inside the region so that calls to Region::getTile can grab data
|
||||||
// more quickly from this array rather than calling CompressedTileStorage. On the Vita the total thread time spent in
|
// more quickly from this array rather than calling CompressedTileStorage. On the Vita the total thread time spent in
|
||||||
// Region::getTile went from 20% to 4%.
|
// Region::getTile went from 20% to 4%.
|
||||||
#ifdef __PSVITA__
|
#ifdef __PSVITA__
|
||||||
int xc = x >> 4;
|
int xc = x >> 4;
|
||||||
int zc = z >> 4;
|
int zc = z >> 4;
|
||||||
|
|
@ -278,7 +278,7 @@ void Chunk::rebuild()
|
||||||
if( yy == (Level::maxBuildHeight - 1) ) continue;
|
if( yy == (Level::maxBuildHeight - 1) ) continue;
|
||||||
if(( xx == 0 ) || ( xx == 15 )) continue;
|
if(( xx == 0 ) || ( xx == 15 )) continue;
|
||||||
if(( zz == 0 ) || ( zz == 15 )) continue;
|
if(( zz == 0 ) || ( zz == 15 )) continue;
|
||||||
|
|
||||||
// Establish whether this tile and its neighbours are all made of rock, dirt, unbreakable tiles, or have already
|
// Establish whether this tile and its neighbours are all made of rock, dirt, unbreakable tiles, or have already
|
||||||
// been determined to meet this criteria themselves and have a tile of 255 set.
|
// been determined to meet this criteria themselves and have a tile of 255 set.
|
||||||
if( !( ( tileId == Tile::stone_Id ) || ( tileId == Tile::dirt_Id ) || ( tileId == Tile::unbreakable_Id ) || ( tileId == 255) ) ) continue;
|
if( !( ( tileId == Tile::stone_Id ) || ( tileId == Tile::dirt_Id ) || ( tileId == Tile::unbreakable_Id ) || ( tileId == 255) ) ) continue;
|
||||||
|
|
@ -340,7 +340,7 @@ void Chunk::rebuild()
|
||||||
PIXBeginNamedEvent(0,"Rebuild section C");
|
PIXBeginNamedEvent(0,"Rebuild section C");
|
||||||
Tesselator::Bounds bounds; // 4J MGH - added
|
Tesselator::Bounds bounds; // 4J MGH - added
|
||||||
{
|
{
|
||||||
// this was the old default clip bounds for the chunk, set in Chunk::setPos.
|
// this was the old default clip bounds for the chunk, set in Chunk::setPos.
|
||||||
float g = 6.0f;
|
float g = 6.0f;
|
||||||
bounds.boundingBox[0] = -g;
|
bounds.boundingBox[0] = -g;
|
||||||
bounds.boundingBox[1] = -g;
|
bounds.boundingBox[1] = -g;
|
||||||
|
|
@ -401,7 +401,7 @@ void Chunk::rebuild()
|
||||||
t->begin();
|
t->begin();
|
||||||
t->offset((float)(-this->x), (float)(-this->y), (float)(-this->z));
|
t->offset((float)(-this->x), (float)(-this->y), (float)(-this->z));
|
||||||
}
|
}
|
||||||
|
|
||||||
Tile *tile = Tile::tiles[tileId];
|
Tile *tile = Tile::tiles[tileId];
|
||||||
if (currentLayer == 0 && tile->isEntityTile())
|
if (currentLayer == 0 && tile->isEntityTile())
|
||||||
{
|
{
|
||||||
|
|
@ -468,7 +468,7 @@ void Chunk::rebuild()
|
||||||
{
|
{
|
||||||
levelRenderer->setGlobalChunkFlag(this->x, this->y, this->z, level, LevelRenderer::CHUNK_FLAG_EMPTY1);
|
levelRenderer->setGlobalChunkFlag(this->x, this->y, this->z, level, LevelRenderer::CHUNK_FLAG_EMPTY1);
|
||||||
RenderManager.CBuffClear(lists + 1);
|
RenderManager.CBuffClear(lists + 1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -484,7 +484,6 @@ void Chunk::rebuild()
|
||||||
|
|
||||||
PIXEndNamedEvent();
|
PIXEndNamedEvent();
|
||||||
PIXBeginNamedEvent(0,"Rebuild section D");
|
PIXBeginNamedEvent(0,"Rebuild section D");
|
||||||
|
|
||||||
// 4J - have rewritten the way that tile entities are stored globally to make it work more easily with split screen. Chunks are now
|
// 4J - have rewritten the way that tile entities are stored globally to make it work more easily with split screen. Chunks are now
|
||||||
// stored globally in the levelrenderer, in a hashmap with a special key made up from the dimension and chunk position (using same index
|
// stored globally in the levelrenderer, in a hashmap with a special key made up from the dimension and chunk position (using same index
|
||||||
// as is used for global flags)
|
// as is used for global flags)
|
||||||
|
|
@ -493,25 +492,25 @@ void Chunk::rebuild()
|
||||||
EnterCriticalSection(globalRenderableTileEntities_cs);
|
EnterCriticalSection(globalRenderableTileEntities_cs);
|
||||||
if( renderableTileEntities.size() )
|
if( renderableTileEntities.size() )
|
||||||
{
|
{
|
||||||
AUTO_VAR(it, globalRenderableTileEntities->find(key));
|
auto it = globalRenderableTileEntities->find(key);
|
||||||
if( it != globalRenderableTileEntities->end() )
|
if( it != globalRenderableTileEntities->end() )
|
||||||
{
|
{
|
||||||
// We've got some renderable tile entities that we want associated with this chunk, and an existing list of things that used to be.
|
// We've got some renderable tile entities that we want associated with this chunk, and an existing list of things that used to be.
|
||||||
// We need to flag any that we don't need any more to be removed, keep those that we do, and add any new ones
|
// We need to flag any that we don't need any more to be removed, keep those that we do, and add any new ones
|
||||||
|
|
||||||
// First pass - flag everything already existing to be removed
|
// First pass - flag everything already existing to be removed
|
||||||
for( AUTO_VAR(it2, it->second.begin()); it2 != it->second.end(); it2++ )
|
for(auto& it2 : it->second)
|
||||||
{
|
{
|
||||||
(*it2)->setRenderRemoveStage(TileEntity::e_RenderRemoveStageFlaggedAtChunk);
|
it2->setRenderRemoveStage(TileEntity::e_RenderRemoveStageFlaggedAtChunk);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now go through the current list. If these are already in the list, then unflag the remove flag. If they aren't, then add
|
// Now go through the current list. If these are already in the list, then unflag the remove flag. If they aren't, then add
|
||||||
for( int i = 0; i < renderableTileEntities.size(); i++ )
|
for(const auto& it3 : renderableTileEntities)
|
||||||
{
|
{
|
||||||
AUTO_VAR(it2, find( it->second.begin(), it->second.end(), renderableTileEntities[i] ));
|
auto it2 = find(it->second.begin(), it->second.end(), it3);
|
||||||
if( it2 == it->second.end() )
|
if( it2 == it->second.end() )
|
||||||
{
|
{
|
||||||
(*globalRenderableTileEntities)[key].push_back(renderableTileEntities[i]);
|
(*globalRenderableTileEntities)[key].push_back(it3);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -531,12 +530,12 @@ void Chunk::rebuild()
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Another easy case - we don't want any renderable tile entities associated with this chunk. Flag all to be removed.
|
// Another easy case - we don't want any renderable tile entities associated with this chunk. Flag all to be removed.
|
||||||
AUTO_VAR(it, globalRenderableTileEntities->find(key));
|
auto it = globalRenderableTileEntities->find(key);
|
||||||
if( it != globalRenderableTileEntities->end() )
|
if( it != globalRenderableTileEntities->end() )
|
||||||
{
|
{
|
||||||
for( AUTO_VAR(it2, it->second.begin()); it2 != it->second.end(); it2++ )
|
for(auto& it2 : it->second)
|
||||||
{
|
{
|
||||||
(*it2)->setRenderRemoveStage(TileEntity::e_RenderRemoveStageFlaggedAtChunk);
|
it2->setRenderRemoveStage(TileEntity::e_RenderRemoveStageFlaggedAtChunk);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -555,11 +554,11 @@ void Chunk::rebuild()
|
||||||
oldTileEntities.removeAll(renderableTileEntities);
|
oldTileEntities.removeAll(renderableTileEntities);
|
||||||
globalRenderableTileEntities.removeAll(oldTileEntities);
|
globalRenderableTileEntities.removeAll(oldTileEntities);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
unordered_set<shared_ptr<TileEntity> > newTileEntities(renderableTileEntities.begin(),renderableTileEntities.end());
|
unordered_set<shared_ptr<TileEntity> > newTileEntities(renderableTileEntities.begin(),renderableTileEntities.end());
|
||||||
|
|
||||||
AUTO_VAR(endIt, oldTileEntities.end());
|
auto endIt = oldTileEntities.end();
|
||||||
for( unordered_set<shared_ptr<TileEntity> >::iterator it = oldTileEntities.begin(); it != endIt; it++ )
|
for( unordered_set<shared_ptr<TileEntity> >::iterator it = oldTileEntities.begin(); it != endIt; it++ )
|
||||||
{
|
{
|
||||||
newTileEntities.erase(*it);
|
newTileEntities.erase(*it);
|
||||||
|
|
@ -576,7 +575,7 @@ void Chunk::rebuild()
|
||||||
|
|
||||||
// 4J - All these new things added to globalRenderableTileEntities
|
// 4J - All these new things added to globalRenderableTileEntities
|
||||||
|
|
||||||
AUTO_VAR(endItRTE, renderableTileEntities.end());
|
auto endItRTE = renderableTileEntities.end();
|
||||||
for( vector<shared_ptr<TileEntity> >::iterator it = renderableTileEntities.begin(); it != endItRTE; it++ )
|
for( vector<shared_ptr<TileEntity> >::iterator it = renderableTileEntities.begin(); it != endItRTE; it++ )
|
||||||
{
|
{
|
||||||
oldTileEntities.erase(*it);
|
oldTileEntities.erase(*it);
|
||||||
|
|
@ -680,13 +679,13 @@ void Chunk::rebuild_SPU()
|
||||||
// Get the data for the level chunk that this render chunk is it (level chunk is 16 x 16 x 128,
|
// Get the data for the level chunk that this render chunk is it (level chunk is 16 x 16 x 128,
|
||||||
// render chunk is 16 x 16 x 16. We wouldn't have to actually get all of it if the data was ordered differently, but currently
|
// render chunk is 16 x 16 x 16. We wouldn't have to actually get all of it if the data was ordered differently, but currently
|
||||||
// it is ordered by x then z then y so just getting a small range of y out of it would involve getting the whole thing into
|
// it is ordered by x then z then y so just getting a small range of y out of it would involve getting the whole thing into
|
||||||
// the cache anyway.
|
// the cache anyway.
|
||||||
ChunkRebuildData* pOutData = NULL;
|
ChunkRebuildData* pOutData = NULL;
|
||||||
g_rebuildDataIn.buildForChunk(®ion, level, x0, y0, z0);
|
g_rebuildDataIn.buildForChunk(®ion, level, x0, y0, z0);
|
||||||
|
|
||||||
Tesselator::Bounds bounds;
|
Tesselator::Bounds bounds;
|
||||||
{
|
{
|
||||||
// this was the old default clip bounds for the chunk, set in Chunk::setPos.
|
// this was the old default clip bounds for the chunk, set in Chunk::setPos.
|
||||||
float g = 6.0f;
|
float g = 6.0f;
|
||||||
bounds.boundingBox[0] = -g;
|
bounds.boundingBox[0] = -g;
|
||||||
bounds.boundingBox[1] = -g;
|
bounds.boundingBox[1] = -g;
|
||||||
|
|
@ -814,14 +813,14 @@ void Chunk::rebuild_SPU()
|
||||||
EnterCriticalSection(globalRenderableTileEntities_cs);
|
EnterCriticalSection(globalRenderableTileEntities_cs);
|
||||||
if( renderableTileEntities.size() )
|
if( renderableTileEntities.size() )
|
||||||
{
|
{
|
||||||
AUTO_VAR(it, globalRenderableTileEntities->find(key));
|
auto it = globalRenderableTileEntities->find(key);
|
||||||
if( it != globalRenderableTileEntities->end() )
|
if( it != globalRenderableTileEntities->end() )
|
||||||
{
|
{
|
||||||
// We've got some renderable tile entities that we want associated with this chunk, and an existing list of things that used to be.
|
// We've got some renderable tile entities that we want associated with this chunk, and an existing list of things that used to be.
|
||||||
// We need to flag any that we don't need any more to be removed, keep those that we do, and add any new ones
|
// We need to flag any that we don't need any more to be removed, keep those that we do, and add any new ones
|
||||||
|
|
||||||
// First pass - flag everything already existing to be removed
|
// First pass - flag everything already existing to be removed
|
||||||
for( AUTO_VAR(it2, it->second.begin()); it2 != it->second.end(); it2++ )
|
for( auto it2 = it->second.begin(); it2 != it->second.end(); it2++ )
|
||||||
{
|
{
|
||||||
(*it2)->setRenderRemoveStage(TileEntity::e_RenderRemoveStageFlaggedAtChunk);
|
(*it2)->setRenderRemoveStage(TileEntity::e_RenderRemoveStageFlaggedAtChunk);
|
||||||
}
|
}
|
||||||
|
|
@ -829,7 +828,7 @@ void Chunk::rebuild_SPU()
|
||||||
// Now go through the current list. If these are already in the list, then unflag the remove flag. If they aren't, then add
|
// Now go through the current list. If these are already in the list, then unflag the remove flag. If they aren't, then add
|
||||||
for( int i = 0; i < renderableTileEntities.size(); i++ )
|
for( int i = 0; i < renderableTileEntities.size(); i++ )
|
||||||
{
|
{
|
||||||
AUTO_VAR(it2, find( it->second.begin(), it->second.end(), renderableTileEntities[i] ));
|
auto it2 = find( it->second.begin(), it->second.end(), renderableTileEntities[i] );
|
||||||
if( it2 == it->second.end() )
|
if( it2 == it->second.end() )
|
||||||
{
|
{
|
||||||
(*globalRenderableTileEntities)[key].push_back(renderableTileEntities[i]);
|
(*globalRenderableTileEntities)[key].push_back(renderableTileEntities[i]);
|
||||||
|
|
@ -852,10 +851,10 @@ void Chunk::rebuild_SPU()
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Another easy case - we don't want any renderable tile entities associated with this chunk. Flag all to be removed.
|
// Another easy case - we don't want any renderable tile entities associated with this chunk. Flag all to be removed.
|
||||||
AUTO_VAR(it, globalRenderableTileEntities->find(key));
|
auto it = globalRenderableTileEntities->find(key);
|
||||||
if( it != globalRenderableTileEntities->end() )
|
if( it != globalRenderableTileEntities->end() )
|
||||||
{
|
{
|
||||||
for( AUTO_VAR(it2, it->second.begin()); it2 != it->second.end(); it2++ )
|
for( auto it2 = it->second.begin(); it2 != it->second.end(); it2++ )
|
||||||
{
|
{
|
||||||
(*it2)->setRenderRemoveStage(TileEntity::e_RenderRemoveStageFlaggedAtChunk);
|
(*it2)->setRenderRemoveStage(TileEntity::e_RenderRemoveStageFlaggedAtChunk);
|
||||||
}
|
}
|
||||||
|
|
@ -875,11 +874,11 @@ void Chunk::rebuild_SPU()
|
||||||
oldTileEntities.removeAll(renderableTileEntities);
|
oldTileEntities.removeAll(renderableTileEntities);
|
||||||
globalRenderableTileEntities.removeAll(oldTileEntities);
|
globalRenderableTileEntities.removeAll(oldTileEntities);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
unordered_set<shared_ptr<TileEntity> > newTileEntities(renderableTileEntities.begin(),renderableTileEntities.end());
|
unordered_set<shared_ptr<TileEntity> > newTileEntities(renderableTileEntities.begin(),renderableTileEntities.end());
|
||||||
|
|
||||||
AUTO_VAR(endIt, oldTileEntities.end());
|
auto endIt = oldTileEntities.end();
|
||||||
for( unordered_set<shared_ptr<TileEntity> >::iterator it = oldTileEntities.begin(); it != endIt; it++ )
|
for( unordered_set<shared_ptr<TileEntity> >::iterator it = oldTileEntities.begin(); it != endIt; it++ )
|
||||||
{
|
{
|
||||||
newTileEntities.erase(*it);
|
newTileEntities.erase(*it);
|
||||||
|
|
@ -896,7 +895,7 @@ void Chunk::rebuild_SPU()
|
||||||
|
|
||||||
// 4J - All these new things added to globalRenderableTileEntities
|
// 4J - All these new things added to globalRenderableTileEntities
|
||||||
|
|
||||||
AUTO_VAR(endItRTE, renderableTileEntities.end());
|
auto endItRTE = renderableTileEntities.end();
|
||||||
for( vector<shared_ptr<TileEntity> >::iterator it = renderableTileEntities.begin(); it != endItRTE; it++ )
|
for( vector<shared_ptr<TileEntity> >::iterator it = renderableTileEntities.begin(); it != endItRTE; it++ )
|
||||||
{
|
{
|
||||||
oldTileEntities.erase(*it);
|
oldTileEntities.erase(*it);
|
||||||
|
|
|
||||||
|
|
@ -168,9 +168,9 @@ void ClientConnection::handleLogin(shared_ptr<LoginPacket> packet)
|
||||||
PlayerUID OnlineXuid;
|
PlayerUID OnlineXuid;
|
||||||
ProfileManager.GetXUID(m_userIndex,&OnlineXuid,true); // online xuid
|
ProfileManager.GetXUID(m_userIndex,&OnlineXuid,true); // online xuid
|
||||||
MOJANG_DATA *pMojangData = NULL;
|
MOJANG_DATA *pMojangData = NULL;
|
||||||
|
|
||||||
if(!g_NetworkManager.IsLocalGame())
|
if(!g_NetworkManager.IsLocalGame())
|
||||||
{
|
{
|
||||||
pMojangData=app.GetMojangDataForXuid(OnlineXuid);
|
pMojangData=app.GetMojangDataForXuid(OnlineXuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -222,7 +222,7 @@ void ClientConnection::handleLogin(shared_ptr<LoginPacket> packet)
|
||||||
// check the file is not already in
|
// check the file is not already in
|
||||||
bRes=app.IsFileInMemoryTextures(wstr);
|
bRes=app.IsFileInMemoryTextures(wstr);
|
||||||
if(!bRes)
|
if(!bRes)
|
||||||
{
|
{
|
||||||
#ifdef _XBOX
|
#ifdef _XBOX
|
||||||
C4JStorage::ETMSStatus eTMSStatus;
|
C4JStorage::ETMSStatus eTMSStatus;
|
||||||
eTMSStatus=StorageManager.ReadTMSFile(iUserID,C4JStorage::eGlobalStorage_Title,C4JStorage::eTMS_FileType_Graphic,pMojangData->wchSkin,&pBuffer, &dwSize);
|
eTMSStatus=StorageManager.ReadTMSFile(iUserID,C4JStorage::eGlobalStorage_Title,C4JStorage::eTMS_FileType_Graphic,pMojangData->wchSkin,&pBuffer, &dwSize);
|
||||||
|
|
@ -234,17 +234,17 @@ void ClientConnection::handleLogin(shared_ptr<LoginPacket> packet)
|
||||||
if(bRes)
|
if(bRes)
|
||||||
{
|
{
|
||||||
app.AddMemoryTextureFile(wstr,pBuffer,dwSize);
|
app.AddMemoryTextureFile(wstr,pBuffer,dwSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// a cloak?
|
// a cloak?
|
||||||
if(pMojangData->wchCape[0]!=0L)
|
if(pMojangData->wchCape[0]!=0L)
|
||||||
{
|
{
|
||||||
wstring wstr=pMojangData->wchCape;
|
wstring wstr=pMojangData->wchCape;
|
||||||
// check the file is not already in
|
// check the file is not already in
|
||||||
bRes=app.IsFileInMemoryTextures(wstr);
|
bRes=app.IsFileInMemoryTextures(wstr);
|
||||||
if(!bRes)
|
if(!bRes)
|
||||||
{
|
{
|
||||||
#ifdef _XBOX
|
#ifdef _XBOX
|
||||||
C4JStorage::ETMSStatus eTMSStatus;
|
C4JStorage::ETMSStatus eTMSStatus;
|
||||||
eTMSStatus=StorageManager.ReadTMSFile(iUserID,C4JStorage::eGlobalStorage_Title,C4JStorage::eTMS_FileType_Graphic,pMojangData->wchCape,&pBuffer, &dwSize);
|
eTMSStatus=StorageManager.ReadTMSFile(iUserID,C4JStorage::eGlobalStorage_Title,C4JStorage::eTMS_FileType_Graphic,pMojangData->wchCape,&pBuffer, &dwSize);
|
||||||
|
|
@ -302,7 +302,7 @@ void ClientConnection::handleLogin(shared_ptr<LoginPacket> packet)
|
||||||
app.DebugPrintf("ClientConnection - DIFFICULTY --- %d\n",packet->difficulty);
|
app.DebugPrintf("ClientConnection - DIFFICULTY --- %d\n",packet->difficulty);
|
||||||
level->difficulty = packet->difficulty; // 4J Added
|
level->difficulty = packet->difficulty; // 4J Added
|
||||||
level->isClientSide = true;
|
level->isClientSide = true;
|
||||||
minecraft->setLevel(level);
|
minecraft->setLevel(level);
|
||||||
}
|
}
|
||||||
|
|
||||||
minecraft->player->setPlayerIndex( packet->m_playerIndex );
|
minecraft->player->setPlayerIndex( packet->m_playerIndex );
|
||||||
|
|
@ -362,7 +362,7 @@ void ClientConnection::handleLogin(shared_ptr<LoginPacket> packet)
|
||||||
// 4J Stu - At time of writing ProfileManager.GetGamertag() does not always return the correct name,
|
// 4J Stu - At time of writing ProfileManager.GetGamertag() does not always return the correct name,
|
||||||
// if sign-ins are turned off while the player signed in. Using the qnetPlayer instead.
|
// if sign-ins are turned off while the player signed in. Using the qnetPlayer instead.
|
||||||
// need to have a level before create extra local player
|
// need to have a level before create extra local player
|
||||||
MultiPlayerLevel *levelpassedin=(MultiPlayerLevel *)level;
|
MultiPlayerLevel *levelpassedin=(MultiPlayerLevel *)level;
|
||||||
player = minecraft->createExtraLocalPlayer(m_userIndex, networkPlayer->GetOnlineName(), m_userIndex, packet->dimension, this,levelpassedin);
|
player = minecraft->createExtraLocalPlayer(m_userIndex, networkPlayer->GetOnlineName(), m_userIndex, packet->dimension, this,levelpassedin);
|
||||||
|
|
||||||
// need to have a player before the setlevel
|
// need to have a player before the setlevel
|
||||||
|
|
@ -384,7 +384,7 @@ void ClientConnection::handleLogin(shared_ptr<LoginPacket> packet)
|
||||||
player->setPlayerIndex( packet->m_playerIndex );
|
player->setPlayerIndex( packet->m_playerIndex );
|
||||||
player->setCustomSkin( app.GetPlayerSkinId(m_userIndex) );
|
player->setCustomSkin( app.GetPlayerSkinId(m_userIndex) );
|
||||||
player->setCustomCape( app.GetPlayerCapeId(m_userIndex) );
|
player->setCustomCape( app.GetPlayerCapeId(m_userIndex) );
|
||||||
|
|
||||||
|
|
||||||
BYTE networkSmallId = getSocket()->getSmallId();
|
BYTE networkSmallId = getSocket()->getSmallId();
|
||||||
app.UpdatePlayerInfo(networkSmallId, packet->m_playerIndex, packet->m_uiGamePrivileges);
|
app.UpdatePlayerInfo(networkSmallId, packet->m_playerIndex, packet->m_uiGamePrivileges);
|
||||||
|
|
@ -396,21 +396,21 @@ void ClientConnection::handleLogin(shared_ptr<LoginPacket> packet)
|
||||||
|
|
||||||
displayPrivilegeChanges(minecraft->localplayers[m_userIndex],startingPrivileges);
|
displayPrivilegeChanges(minecraft->localplayers[m_userIndex],startingPrivileges);
|
||||||
}
|
}
|
||||||
|
|
||||||
maxPlayers = packet->maxPlayers;
|
maxPlayers = packet->maxPlayers;
|
||||||
|
|
||||||
// need to have a player before the setLocalCreativeMode
|
// need to have a player before the setLocalCreativeMode
|
||||||
shared_ptr<MultiplayerLocalPlayer> lastPlayer = minecraft->player;
|
shared_ptr<MultiplayerLocalPlayer> lastPlayer = minecraft->player;
|
||||||
minecraft->player = minecraft->localplayers[m_userIndex];
|
minecraft->player = minecraft->localplayers[m_userIndex];
|
||||||
((MultiPlayerGameMode *)minecraft->localgameModes[m_userIndex])->setLocalMode(GameType::byId(packet->gameType));
|
((MultiPlayerGameMode *)minecraft->localgameModes[m_userIndex])->setLocalMode(GameType::byId(packet->gameType));
|
||||||
minecraft->player = lastPlayer;
|
minecraft->player = lastPlayer;
|
||||||
|
|
||||||
// make sure the UI offsets for this player are set correctly
|
// make sure the UI offsets for this player are set correctly
|
||||||
if(iUserID!=-1)
|
if(iUserID!=-1)
|
||||||
{
|
{
|
||||||
ui.UpdateSelectedItemPos(iUserID);
|
ui.UpdateSelectedItemPos(iUserID);
|
||||||
}
|
}
|
||||||
|
|
||||||
TelemetryManager->RecordLevelStart(m_userIndex, eSen_FriendOrMatch_Playing_With_Invited_Friends, eSen_CompeteOrCoop_Coop_and_Competitive, Minecraft::GetInstance()->getLevel(packet->dimension)->difficulty, app.GetLocalPlayerCount(), g_NetworkManager.GetOnlinePlayerCount());
|
TelemetryManager->RecordLevelStart(m_userIndex, eSen_FriendOrMatch_Playing_With_Invited_Friends, eSen_CompeteOrCoop_Coop_and_Competitive, Minecraft::GetInstance()->getLevel(packet->dimension)->difficulty, app.GetLocalPlayerCount(), g_NetworkManager.GetOnlinePlayerCount());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -448,7 +448,7 @@ void ClientConnection::handleAddEntity(shared_ptr<AddEntityPacket> packet)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (owner != NULL && owner->instanceof(eTYPE_PLAYER))
|
if (owner != NULL && owner->instanceof(eTYPE_PLAYER))
|
||||||
{
|
{
|
||||||
shared_ptr<Player> player = dynamic_pointer_cast<Player>(owner);
|
shared_ptr<Player> player = dynamic_pointer_cast<Player>(owner);
|
||||||
|
|
@ -574,7 +574,7 @@ void ClientConnection::handleAddEntity(shared_ptr<AddEntityPacket> packet)
|
||||||
}
|
}
|
||||||
packet->data = 0;
|
packet->data = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (packet->type == AddEntityPacket::ARROW) e = shared_ptr<Entity>( new Arrow(level, x, y, z) );
|
if (packet->type == AddEntityPacket::ARROW) e = shared_ptr<Entity>( new Arrow(level, x, y, z) );
|
||||||
if (packet->type == AddEntityPacket::SNOWBALL) e = shared_ptr<Entity>( new Snowball(level, x, y, z) );
|
if (packet->type == AddEntityPacket::SNOWBALL) e = shared_ptr<Entity>( new Snowball(level, x, y, z) );
|
||||||
if (packet->type == AddEntityPacket::THROWN_ENDERPEARL) e = shared_ptr<Entity>( new ThrownEnderpearl(level, x, y, z) );
|
if (packet->type == AddEntityPacket::THROWN_ENDERPEARL) e = shared_ptr<Entity>( new ThrownEnderpearl(level, x, y, z) );
|
||||||
|
|
@ -620,22 +620,19 @@ void ClientConnection::handleAddEntity(shared_ptr<AddEntityPacket> packet)
|
||||||
e->yRotp = packet->yRot;
|
e->yRotp = packet->yRot;
|
||||||
e->xRotp = packet->xRot;
|
e->xRotp = packet->xRot;
|
||||||
|
|
||||||
if (setRot)
|
if (setRot)
|
||||||
{
|
{
|
||||||
e->yRot = 0.0f;
|
e->yRot = 0.0f;
|
||||||
e->xRot = 0.0f;
|
e->xRot = 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
vector<shared_ptr<Entity> > *subEntities = e->getSubEntities();
|
vector<shared_ptr<Entity> > *subEntities = e->getSubEntities();
|
||||||
if (subEntities != NULL)
|
if (subEntities)
|
||||||
{
|
{
|
||||||
int offs = packet->id - e->entityId;
|
int offs = packet->id - e->entityId;
|
||||||
//for (int i = 0; i < subEntities.length; i++)
|
for ( auto it : *subEntities )
|
||||||
for(AUTO_VAR(it, subEntities->begin()); it != subEntities->end(); ++it)
|
{
|
||||||
{
|
it->entityId += offs;
|
||||||
(*it)->entityId += offs;
|
|
||||||
//subEntities[i].entityId += offs;
|
|
||||||
//System.out.println(subEntities[i].entityId);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -685,10 +682,10 @@ void ClientConnection::handleAddEntity(shared_ptr<AddEntityPacket> packet)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
e->lerpMotion(packet->xa / 8000.0, packet->ya / 8000.0, packet->za / 8000.0);
|
e->lerpMotion(packet->xa / 8000.0, packet->ya / 8000.0, packet->za / 8000.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4J: Check our deferred entity link packets
|
// 4J: Check our deferred entity link packets
|
||||||
checkDeferredEntityLinkPackets(e->entityId);
|
checkDeferredEntityLinkPackets(e->entityId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -839,7 +836,7 @@ void ClientConnection::handleAddPlayer(shared_ptr<AddPlayerPacket> packet)
|
||||||
player->setCustomSkin( packet->m_skinId );
|
player->setCustomSkin( packet->m_skinId );
|
||||||
player->setCustomCape( packet->m_capeId );
|
player->setCustomCape( packet->m_capeId );
|
||||||
player->setPlayerGamePrivilege(Player::ePlayerGamePrivilege_All, packet->m_uiGamePrivileges);
|
player->setPlayerGamePrivilege(Player::ePlayerGamePrivilege_All, packet->m_uiGamePrivileges);
|
||||||
|
|
||||||
if(!player->customTextureUrl.empty() && player->customTextureUrl.substr(0,3).compare(L"def") != 0 && !app.IsFileInMemoryTextures(player->customTextureUrl))
|
if(!player->customTextureUrl.empty() && player->customTextureUrl.substr(0,3).compare(L"def") != 0 && !app.IsFileInMemoryTextures(player->customTextureUrl))
|
||||||
{
|
{
|
||||||
if( minecraft->addPendingClientTextureRequest(player->customTextureUrl) )
|
if( minecraft->addPendingClientTextureRequest(player->customTextureUrl) )
|
||||||
|
|
@ -856,7 +853,7 @@ void ClientConnection::handleAddPlayer(shared_ptr<AddPlayerPacket> packet)
|
||||||
}
|
}
|
||||||
|
|
||||||
app.DebugPrintf("Custom skin for player %ls is %ls\n",player->name.c_str(),player->customTextureUrl.c_str());
|
app.DebugPrintf("Custom skin for player %ls is %ls\n",player->name.c_str(),player->customTextureUrl.c_str());
|
||||||
|
|
||||||
if(!player->customTextureUrl2.empty() && player->customTextureUrl2.substr(0,3).compare(L"def") != 0 && !app.IsFileInMemoryTextures(player->customTextureUrl2))
|
if(!player->customTextureUrl2.empty() && player->customTextureUrl2.substr(0,3).compare(L"def") != 0 && !app.IsFileInMemoryTextures(player->customTextureUrl2))
|
||||||
{
|
{
|
||||||
if( minecraft->addPendingClientTextureRequest(player->customTextureUrl2) )
|
if( minecraft->addPendingClientTextureRequest(player->customTextureUrl2) )
|
||||||
|
|
@ -1034,7 +1031,7 @@ void ClientConnection::handleMovePlayer(shared_ptr<MovePlayerPacket> packet)
|
||||||
packet->yView = player->y;
|
packet->yView = player->y;
|
||||||
connection->send(packet);
|
connection->send(packet);
|
||||||
if (!started)
|
if (!started)
|
||||||
{
|
{
|
||||||
|
|
||||||
if(!g_NetworkManager.IsHost() )
|
if(!g_NetworkManager.IsHost() )
|
||||||
{
|
{
|
||||||
|
|
@ -1050,7 +1047,7 @@ void ClientConnection::handleMovePlayer(shared_ptr<MovePlayerPacket> packet)
|
||||||
|
|
||||||
started = true;
|
started = true;
|
||||||
minecraft->setScreen(NULL);
|
minecraft->setScreen(NULL);
|
||||||
|
|
||||||
// Fix for #105852 - TU12: Content: Gameplay: Local splitscreen Players are spawned at incorrect places after re-joining previously saved and loaded "Mass Effect World".
|
// Fix for #105852 - TU12: Content: Gameplay: Local splitscreen Players are spawned at incorrect places after re-joining previously saved and loaded "Mass Effect World".
|
||||||
// Move this check from Minecraft::createExtraLocalPlayer
|
// Move this check from Minecraft::createExtraLocalPlayer
|
||||||
// 4J-PB - can't call this when this function is called from the qnet thread (GetGameStarted will be false)
|
// 4J-PB - can't call this when this function is called from the qnet thread (GetGameStarted will be false)
|
||||||
|
|
@ -1124,7 +1121,7 @@ void ClientConnection::handleChunkTilesUpdate(shared_ptr<ChunkTilesUpdatePacket>
|
||||||
// Don't bother setting this to dirty if it isn't going to visually change - we get a lot of
|
// Don't bother setting this to dirty if it isn't going to visually change - we get a lot of
|
||||||
// water changing from static to dynamic for instance
|
// water changing from static to dynamic for instance
|
||||||
if(!( ( ( prevTile == Tile::water_Id ) && ( tile == Tile::calmWater_Id ) ) ||
|
if(!( ( ( prevTile == Tile::water_Id ) && ( tile == Tile::calmWater_Id ) ) ||
|
||||||
( ( prevTile == Tile::calmWater_Id ) && ( tile == Tile::water_Id ) ) ||
|
( ( prevTile == Tile::calmWater_Id ) && ( tile == Tile::water_Id ) ) ||
|
||||||
( ( prevTile == Tile::lava_Id ) && ( tile == Tile::calmLava_Id ) ) ||
|
( ( prevTile == Tile::lava_Id ) && ( tile == Tile::calmLava_Id ) ) ||
|
||||||
( ( prevTile == Tile::calmLava_Id ) && ( tile == Tile::calmLava_Id ) ) ||
|
( ( prevTile == Tile::calmLava_Id ) && ( tile == Tile::calmLava_Id ) ) ||
|
||||||
( ( prevTile == Tile::calmLava_Id ) && ( tile == Tile::lava_Id ) ) ) )
|
( ( prevTile == Tile::calmLava_Id ) && ( tile == Tile::lava_Id ) ) ) )
|
||||||
|
|
@ -1253,7 +1250,7 @@ void ClientConnection::handleDisconnect(shared_ptr<DisconnectPacket> packet)
|
||||||
{
|
{
|
||||||
connection->close(DisconnectPacket::eDisconnect_Kicked);
|
connection->close(DisconnectPacket::eDisconnect_Kicked);
|
||||||
done = true;
|
done = true;
|
||||||
|
|
||||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||||
pMinecraft->connectionDisconnected( m_userIndex , packet->reason );
|
pMinecraft->connectionDisconnected( m_userIndex , packet->reason );
|
||||||
app.SetDisconnectReason( packet->reason );
|
app.SetDisconnectReason( packet->reason );
|
||||||
|
|
@ -1337,7 +1334,7 @@ void ClientConnection::handleTakeItemEntity(shared_ptr<TakeItemEntityPacket> pac
|
||||||
|
|
||||||
if (from != NULL)
|
if (from != NULL)
|
||||||
{
|
{
|
||||||
// If this is a local player, then we only want to do processing for it if this connection is associated with the player it is for. In
|
// If this is a local player, then we only want to do processing for it if this connection is associated with the player it is for. In
|
||||||
// particular, we don't want to remove the item entity until we are processing it for the right connection, or else we won't have a valid
|
// particular, we don't want to remove the item entity until we are processing it for the right connection, or else we won't have a valid
|
||||||
// "from" reference if we've already removed the item for an earlier processed connection
|
// "from" reference if we've already removed the item for an earlier processed connection
|
||||||
if( isLocalPlayer )
|
if( isLocalPlayer )
|
||||||
|
|
@ -1422,7 +1419,7 @@ void ClientConnection::handleChat(shared_ptr<ChatPacket> packet)
|
||||||
case ChatPacket::e_ChatBedMeSleep:
|
case ChatPacket::e_ChatBedMeSleep:
|
||||||
message=app.GetString(IDS_TILE_BED_MESLEEP);
|
message=app.GetString(IDS_TILE_BED_MESLEEP);
|
||||||
break;
|
break;
|
||||||
case ChatPacket::e_ChatPlayerJoinedGame:
|
case ChatPacket::e_ChatPlayerJoinedGame:
|
||||||
message=app.GetString(IDS_PLAYER_JOINED);
|
message=app.GetString(IDS_PLAYER_JOINED);
|
||||||
iPos=message.find(L"%s");
|
iPos=message.find(L"%s");
|
||||||
message.replace(iPos,2,playerDisplayName);
|
message.replace(iPos,2,playerDisplayName);
|
||||||
|
|
@ -1537,7 +1534,7 @@ void ClientConnection::handleChat(shared_ptr<ChatPacket> packet)
|
||||||
replaceEntitySource = true;
|
replaceEntitySource = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case ChatPacket::e_ChatDeathFellAccidentLadder:
|
case ChatPacket::e_ChatDeathFellAccidentLadder:
|
||||||
message=app.GetString(IDS_DEATH_FELL_ACCIDENT_LADDER);
|
message=app.GetString(IDS_DEATH_FELL_ACCIDENT_LADDER);
|
||||||
replacePlayer = true;
|
replacePlayer = true;
|
||||||
|
|
@ -1702,7 +1699,7 @@ void ClientConnection::handleChat(shared_ptr<ChatPacket> packet)
|
||||||
message=app.GetString(IDS_MAX_WOLVES_BRED);
|
message=app.GetString(IDS_MAX_WOLVES_BRED);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// can't shear the mooshroom
|
// can't shear the mooshroom
|
||||||
case ChatPacket::e_ChatPlayerCantShearMooshroom:
|
case ChatPacket::e_ChatPlayerCantShearMooshroom:
|
||||||
message=app.GetString(IDS_CANT_SHEAR_MOOSHROOM);
|
message=app.GetString(IDS_CANT_SHEAR_MOOSHROOM);
|
||||||
break;
|
break;
|
||||||
|
|
@ -1710,16 +1707,16 @@ void ClientConnection::handleChat(shared_ptr<ChatPacket> packet)
|
||||||
// Paintings/Item Frames
|
// Paintings/Item Frames
|
||||||
case ChatPacket::e_ChatPlayerMaxHangingEntities:
|
case ChatPacket::e_ChatPlayerMaxHangingEntities:
|
||||||
message=app.GetString(IDS_MAX_HANGINGENTITIES);
|
message=app.GetString(IDS_MAX_HANGINGENTITIES);
|
||||||
break;
|
break;
|
||||||
// Enemy spawn eggs in peaceful
|
// Enemy spawn eggs in peaceful
|
||||||
case ChatPacket::e_ChatPlayerCantSpawnInPeaceful:
|
case ChatPacket::e_ChatPlayerCantSpawnInPeaceful:
|
||||||
message=app.GetString(IDS_CANT_SPAWN_IN_PEACEFUL);
|
message=app.GetString(IDS_CANT_SPAWN_IN_PEACEFUL);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Enemy spawn eggs in peaceful
|
// Enemy spawn eggs in peaceful
|
||||||
case ChatPacket::e_ChatPlayerMaxBoats:
|
case ChatPacket::e_ChatPlayerMaxBoats:
|
||||||
message=app.GetString(IDS_MAX_BOATS);
|
message=app.GetString(IDS_MAX_BOATS);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ChatPacket::e_ChatCommandTeleportSuccess:
|
case ChatPacket::e_ChatCommandTeleportSuccess:
|
||||||
message=app.GetString(IDS_COMMAND_TELEPORT_SUCCESS);
|
message=app.GetString(IDS_COMMAND_TELEPORT_SUCCESS);
|
||||||
|
|
@ -1851,7 +1848,7 @@ void ClientConnection::handlePreLogin(shared_ptr<PreLoginPacket> packet)
|
||||||
BOOL isAtLeastOneFriend = g_NetworkManager.IsHost();
|
BOOL isAtLeastOneFriend = g_NetworkManager.IsHost();
|
||||||
BOOL isFriendsWithHost = TRUE;
|
BOOL isFriendsWithHost = TRUE;
|
||||||
BOOL cantPlayContentRestricted = FALSE;
|
BOOL cantPlayContentRestricted = FALSE;
|
||||||
|
|
||||||
if(!g_NetworkManager.IsHost())
|
if(!g_NetworkManager.IsHost())
|
||||||
{
|
{
|
||||||
// set the game host settings
|
// set the game host settings
|
||||||
|
|
@ -1885,7 +1882,7 @@ void ClientConnection::handlePreLogin(shared_ptr<PreLoginPacket> packet)
|
||||||
}
|
}
|
||||||
if( playerXuid != INVALID_XUID )
|
if( playerXuid != INVALID_XUID )
|
||||||
{
|
{
|
||||||
// Is this user friends with the host player?
|
// Is this user friends with the host player?
|
||||||
BOOL result;
|
BOOL result;
|
||||||
DWORD error;
|
DWORD error;
|
||||||
error = XUserAreUsersFriends(idx,&packet->m_playerXuids[packet->m_hostIndex],1,&result,NULL);
|
error = XUserAreUsersFriends(idx,&packet->m_playerXuids[packet->m_hostIndex],1,&result,NULL);
|
||||||
|
|
@ -1915,7 +1912,7 @@ void ClientConnection::handlePreLogin(shared_ptr<PreLoginPacket> packet)
|
||||||
}
|
}
|
||||||
if( playerXuid != INVALID_XUID )
|
if( playerXuid != INVALID_XUID )
|
||||||
{
|
{
|
||||||
// Is this user friends with the host player?
|
// Is this user friends with the host player?
|
||||||
BOOL result;
|
BOOL result;
|
||||||
DWORD error;
|
DWORD error;
|
||||||
error = XUserAreUsersFriends(m_userIndex,&packet->m_playerXuids[packet->m_hostIndex],1,&result,NULL);
|
error = XUserAreUsersFriends(m_userIndex,&packet->m_playerXuids[packet->m_hostIndex],1,&result,NULL);
|
||||||
|
|
@ -2030,7 +2027,7 @@ void ClientConnection::handlePreLogin(shared_ptr<PreLoginPacket> packet)
|
||||||
|
|
||||||
if(m_userIndex == ProfileManager.GetPrimaryPad() )
|
if(m_userIndex == ProfileManager.GetPrimaryPad() )
|
||||||
{
|
{
|
||||||
// Is this user friends with the host player?
|
// Is this user friends with the host player?
|
||||||
bool isFriend = true;
|
bool isFriend = true;
|
||||||
unsigned int friendCount = 0;
|
unsigned int friendCount = 0;
|
||||||
#ifdef __PS3__
|
#ifdef __PS3__
|
||||||
|
|
@ -2060,7 +2057,7 @@ void ClientConnection::handlePreLogin(shared_ptr<PreLoginPacket> packet)
|
||||||
requestParam.offset = 0;
|
requestParam.offset = 0;
|
||||||
requestParam.userInfo.userId = ProfileManager.getUserID(ProfileManager.GetPrimaryPad());
|
requestParam.userInfo.userId = ProfileManager.getUserID(ProfileManager.GetPrimaryPad());
|
||||||
|
|
||||||
int ret = sce::Toolkit::NP::Friends::Interface::getFriendslist(&friendList, &requestParam, false);
|
int ret = sce::Toolkit::NP::Friends::Interface::getFriendslist(&friendList, &requestParam, false);
|
||||||
if( ret == 0 )
|
if( ret == 0 )
|
||||||
{
|
{
|
||||||
if( friendList.hasResult() )
|
if( friendList.hasResult() )
|
||||||
|
|
@ -2070,7 +2067,7 @@ void ClientConnection::handlePreLogin(shared_ptr<PreLoginPacket> packet)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if( ret == 0 )
|
if( ret == 0 )
|
||||||
{
|
{
|
||||||
isFriend = false;
|
isFriend = false;
|
||||||
SceNpId npid;
|
SceNpId npid;
|
||||||
for( unsigned int i = 0; i < friendCount; i++ )
|
for( unsigned int i = 0; i < friendCount; i++ )
|
||||||
|
|
@ -2153,7 +2150,7 @@ void ClientConnection::handlePreLogin(shared_ptr<PreLoginPacket> packet)
|
||||||
isAtLeastOneFriend = true;
|
isAtLeastOneFriend = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
app.DebugPrintf("ClientConnection::handlePreLogin: User has at least one friend? %s\n", isAtLeastOneFriend ? "Yes" : "No");
|
app.DebugPrintf("ClientConnection::handlePreLogin: User has at least one friend? %s\n", isAtLeastOneFriend ? "Yes" : "No");
|
||||||
|
|
@ -2195,8 +2192,8 @@ void ClientConnection::handlePreLogin(shared_ptr<PreLoginPacket> packet)
|
||||||
DisconnectPacket::eDisconnectReason reason = DisconnectPacket::eDisconnect_NoUGC_Remote;
|
DisconnectPacket::eDisconnectReason reason = DisconnectPacket::eDisconnect_NoUGC_Remote;
|
||||||
#else
|
#else
|
||||||
DisconnectPacket::eDisconnectReason reason = DisconnectPacket::eDisconnect_None;
|
DisconnectPacket::eDisconnectReason reason = DisconnectPacket::eDisconnect_None;
|
||||||
#endif
|
#endif
|
||||||
if(m_userIndex == ProfileManager.GetPrimaryPad())
|
if(m_userIndex == ProfileManager.GetPrimaryPad())
|
||||||
{
|
{
|
||||||
if(!isFriendsWithHost) reason = DisconnectPacket::eDisconnect_NotFriendsWithHost;
|
if(!isFriendsWithHost) reason = DisconnectPacket::eDisconnect_NotFriendsWithHost;
|
||||||
else if(!isAtLeastOneFriend) reason = DisconnectPacket::eDisconnect_NoFriendsInGame;
|
else if(!isAtLeastOneFriend) reason = DisconnectPacket::eDisconnect_NoFriendsInGame;
|
||||||
|
|
@ -2208,7 +2205,7 @@ void ClientConnection::handlePreLogin(shared_ptr<PreLoginPacket> packet)
|
||||||
app.SetAction(ProfileManager.GetPrimaryPad(),eAppAction_ExitWorld,(void *)TRUE);
|
app.SetAction(ProfileManager.GetPrimaryPad(),eAppAction_ExitWorld,(void *)TRUE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(!isFriendsWithHost) reason = DisconnectPacket::eDisconnect_NotFriendsWithHost;
|
if(!isFriendsWithHost) reason = DisconnectPacket::eDisconnect_NotFriendsWithHost;
|
||||||
else if(!canPlayLocal) reason = DisconnectPacket::eDisconnect_NoUGC_Single_Local;
|
else if(!canPlayLocal) reason = DisconnectPacket::eDisconnect_NoUGC_Single_Local;
|
||||||
else if(cantPlayContentRestricted) reason = DisconnectPacket::eDisconnect_ContentRestricted_Single_Local;
|
else if(cantPlayContentRestricted) reason = DisconnectPacket::eDisconnect_ContentRestricted_Single_Local;
|
||||||
|
|
@ -2221,7 +2218,7 @@ void ClientConnection::handlePreLogin(shared_ptr<PreLoginPacket> packet)
|
||||||
|
|
||||||
app.SetDisconnectReason( reason );
|
app.SetDisconnectReason( reason );
|
||||||
|
|
||||||
// 4J-PB - this locks up on the read and write threads not closing down, because they are trying to lock the incoming critsec when it's already locked by this thread
|
// 4J-PB - this locks up on the read and write threads not closing down, because they are trying to lock the incoming critsec when it's already locked by this thread
|
||||||
// Minecraft::GetInstance()->connectionDisconnected( m_userIndex , reason );
|
// Minecraft::GetInstance()->connectionDisconnected( m_userIndex , reason );
|
||||||
// done = true;
|
// done = true;
|
||||||
// connection->flush();
|
// connection->flush();
|
||||||
|
|
@ -2278,7 +2275,7 @@ void ClientConnection::handlePreLogin(shared_ptr<PreLoginPacket> packet)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// On PS3, all non-signed in players (even guests) can get a useful offlineXUID
|
// On PS3, all non-signed in players (even guests) can get a useful offlineXUID
|
||||||
#if !(defined __PS3__ || defined _DURANGO )
|
#if !(defined __PS3__ || defined _DURANGO )
|
||||||
if( !ProfileManager.IsGuest( m_userIndex ) )
|
if( !ProfileManager.IsGuest( m_userIndex ) )
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
|
|
@ -2287,7 +2284,7 @@ void ClientConnection::handlePreLogin(shared_ptr<PreLoginPacket> packet)
|
||||||
}
|
}
|
||||||
BOOL allAllowed, friendsAllowed;
|
BOOL allAllowed, friendsAllowed;
|
||||||
ProfileManager.AllowedPlayerCreatedContent(m_userIndex,true,&allAllowed,&friendsAllowed);
|
ProfileManager.AllowedPlayerCreatedContent(m_userIndex,true,&allAllowed,&friendsAllowed);
|
||||||
send( shared_ptr<LoginPacket>( new LoginPacket(minecraft->user->name, SharedConstants::NETWORK_PROTOCOL_VERSION, offlineXUID, onlineXUID, (allAllowed!=TRUE && friendsAllowed==TRUE),
|
send( shared_ptr<LoginPacket>( new LoginPacket(minecraft->user->name, SharedConstants::NETWORK_PROTOCOL_VERSION, offlineXUID, onlineXUID, (allAllowed!=TRUE && friendsAllowed==TRUE),
|
||||||
packet->m_ugcPlayersVersion, app.GetPlayerSkinId(m_userIndex), app.GetPlayerCapeId(m_userIndex), ProfileManager.IsGuest( m_userIndex ))));
|
packet->m_ugcPlayersVersion, app.GetPlayerSkinId(m_userIndex), app.GetPlayerCapeId(m_userIndex), ProfileManager.IsGuest( m_userIndex ))));
|
||||||
|
|
||||||
if(!g_NetworkManager.IsHost() )
|
if(!g_NetworkManager.IsHost() )
|
||||||
|
|
@ -2345,14 +2342,12 @@ void ClientConnection::handleAddMob(shared_ptr<AddMobPacket> packet)
|
||||||
mob->xRotp = packet->xRot;
|
mob->xRotp = packet->xRot;
|
||||||
|
|
||||||
vector<shared_ptr<Entity> > *subEntities = mob->getSubEntities();
|
vector<shared_ptr<Entity> > *subEntities = mob->getSubEntities();
|
||||||
if (subEntities != NULL)
|
if (subEntities)
|
||||||
{
|
{
|
||||||
int offs = packet->id - mob->entityId;
|
int offs = packet->id - mob->entityId;
|
||||||
//for (int i = 0; i < subEntities.length; i++)
|
for (auto& it : *subEntities )
|
||||||
for(AUTO_VAR(it, subEntities->begin()); it != subEntities->end(); ++it)
|
{
|
||||||
{
|
it->entityId += offs;
|
||||||
//subEntities[i].entityId += offs;
|
|
||||||
(*it)->entityId += offs;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2438,7 +2433,7 @@ void ClientConnection::handleEntityLinkPacket(shared_ptr<SetEntityLinkPacket> pa
|
||||||
minecraft.gui.setOverlayMessage(I18n.get("mount.onboard", Options.getTranslatedKeyMessage(options.keySneak.key)), false);
|
minecraft.gui.setOverlayMessage(I18n.get("mount.onboard", Options.getTranslatedKeyMessage(options.keySneak.key)), false);
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
else if (packet->type == SetEntityLinkPacket::LEASH)
|
else if (packet->type == SetEntityLinkPacket::LEASH)
|
||||||
{
|
{
|
||||||
if ( (sourceEntity != NULL) && sourceEntity->instanceof(eTYPE_MOB) )
|
if ( (sourceEntity != NULL) && sourceEntity->instanceof(eTYPE_MOB) )
|
||||||
|
|
@ -2508,7 +2503,7 @@ void ClientConnection::handleTexture(shared_ptr<TexturePacket> packet)
|
||||||
wprintf(L"Client received request for custom texture %ls\n",packet->textureName.c_str());
|
wprintf(L"Client received request for custom texture %ls\n",packet->textureName.c_str());
|
||||||
#endif
|
#endif
|
||||||
PBYTE pbData=NULL;
|
PBYTE pbData=NULL;
|
||||||
DWORD dwBytes=0;
|
DWORD dwBytes=0;
|
||||||
app.GetMemFileDetails(packet->textureName,&pbData,&dwBytes);
|
app.GetMemFileDetails(packet->textureName,&pbData,&dwBytes);
|
||||||
|
|
||||||
if(dwBytes!=0)
|
if(dwBytes!=0)
|
||||||
|
|
@ -2540,7 +2535,7 @@ void ClientConnection::handleTextureAndGeometry(shared_ptr<TextureAndGeometryPac
|
||||||
wprintf(L"Client received request for custom texture and geometry %ls\n",packet->textureName.c_str());
|
wprintf(L"Client received request for custom texture and geometry %ls\n",packet->textureName.c_str());
|
||||||
#endif
|
#endif
|
||||||
PBYTE pbData=NULL;
|
PBYTE pbData=NULL;
|
||||||
DWORD dwBytes=0;
|
DWORD dwBytes=0;
|
||||||
app.GetMemFileDetails(packet->textureName,&pbData,&dwBytes);
|
app.GetMemFileDetails(packet->textureName,&pbData,&dwBytes);
|
||||||
DLCSkinFile *pDLCSkinFile = app.m_dlcManager.getSkinFile(packet->textureName);
|
DLCSkinFile *pDLCSkinFile = app.m_dlcManager.getSkinFile(packet->textureName);
|
||||||
|
|
||||||
|
|
@ -2574,9 +2569,9 @@ void ClientConnection::handleTextureAndGeometry(shared_ptr<TextureAndGeometryPac
|
||||||
// Add the texture data
|
// Add the texture data
|
||||||
app.AddMemoryTextureFile(packet->textureName,packet->pbData,packet->dwTextureBytes);
|
app.AddMemoryTextureFile(packet->textureName,packet->pbData,packet->dwTextureBytes);
|
||||||
// Add the geometry data
|
// Add the geometry data
|
||||||
if(packet->dwBoxC!=0)
|
if(packet->dwBoxC!=0)
|
||||||
{
|
{
|
||||||
app.SetAdditionalSkinBoxes(packet->dwSkinID,packet->BoxDataA,packet->dwBoxC);
|
app.SetAdditionalSkinBoxes(packet->dwSkinID,packet->BoxDataA,packet->dwBoxC);
|
||||||
}
|
}
|
||||||
// Add the anim override
|
// Add the anim override
|
||||||
app.SetAnimOverrideBitmask(packet->dwSkinID,packet->uiAnimOverrideBitmask);
|
app.SetAnimOverrideBitmask(packet->dwSkinID,packet->uiAnimOverrideBitmask);
|
||||||
|
|
@ -2622,7 +2617,7 @@ void ClientConnection::handleTextureChange(shared_ptr<TextureChangePacket> packe
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!packet->path.empty() && packet->path.substr(0,3).compare(L"def") != 0 && !app.IsFileInMemoryTextures(packet->path))
|
if(!packet->path.empty() && packet->path.substr(0,3).compare(L"def") != 0 && !app.IsFileInMemoryTextures(packet->path))
|
||||||
{
|
{
|
||||||
if( minecraft->addPendingClientTextureRequest(packet->path) )
|
if( minecraft->addPendingClientTextureRequest(packet->path) )
|
||||||
|
|
@ -2728,7 +2723,7 @@ void ClientConnection::handleRespawn(shared_ptr<RespawnPacket> packet)
|
||||||
level->removeEntity( shared_ptr<Entity>(minecraft->localplayers[m_userIndex]) );
|
level->removeEntity( shared_ptr<Entity>(minecraft->localplayers[m_userIndex]) );
|
||||||
|
|
||||||
level = dimensionLevel;
|
level = dimensionLevel;
|
||||||
|
|
||||||
// Whilst calling setLevel, make sure that minecraft::player is set up to be correct for this
|
// Whilst calling setLevel, make sure that minecraft::player is set up to be correct for this
|
||||||
// connection
|
// connection
|
||||||
shared_ptr<MultiplayerLocalPlayer> lastPlayer = minecraft->player;
|
shared_ptr<MultiplayerLocalPlayer> lastPlayer = minecraft->player;
|
||||||
|
|
@ -2737,7 +2732,7 @@ void ClientConnection::handleRespawn(shared_ptr<RespawnPacket> packet)
|
||||||
minecraft->player = lastPlayer;
|
minecraft->player = lastPlayer;
|
||||||
|
|
||||||
TelemetryManager->RecordLevelExit(m_userIndex, eSen_LevelExitStatus_Succeeded);
|
TelemetryManager->RecordLevelExit(m_userIndex, eSen_LevelExitStatus_Succeeded);
|
||||||
|
|
||||||
//minecraft->player->dimension = packet->dimension;
|
//minecraft->player->dimension = packet->dimension;
|
||||||
minecraft->localplayers[m_userIndex]->dimension = packet->dimension;
|
minecraft->localplayers[m_userIndex]->dimension = packet->dimension;
|
||||||
//minecraft->setScreen(new ReceivingLevelScreen(this));
|
//minecraft->setScreen(new ReceivingLevelScreen(this));
|
||||||
|
|
@ -2788,12 +2783,12 @@ void ClientConnection::handleRespawn(shared_ptr<RespawnPacket> packet)
|
||||||
{
|
{
|
||||||
ui.NavigateToScene(m_userIndex, eUIScene_ConnectingProgress, param);
|
ui.NavigateToScene(m_userIndex, eUIScene_ConnectingProgress, param);
|
||||||
}
|
}
|
||||||
|
|
||||||
app.SetAction( m_userIndex, eAppAction_WaitForDimensionChangeComplete);
|
app.SetAction( m_userIndex, eAppAction_WaitForDimensionChangeComplete);
|
||||||
}
|
}
|
||||||
|
|
||||||
//minecraft->respawnPlayer(minecraft->player->GetXboxPad(),true, packet->dimension);
|
//minecraft->respawnPlayer(minecraft->player->GetXboxPad(),true, packet->dimension);
|
||||||
|
|
||||||
// Wrap respawnPlayer call up in code to set & restore the player/gamemode etc. as some things
|
// Wrap respawnPlayer call up in code to set & restore the player/gamemode etc. as some things
|
||||||
// in there assume that we are set up for the player that the respawn is coming in for
|
// in there assume that we are set up for the player that the respawn is coming in for
|
||||||
int oldIndex = minecraft->getLocalPlayerIdx();
|
int oldIndex = minecraft->getLocalPlayerIdx();
|
||||||
|
|
@ -2818,7 +2813,7 @@ void ClientConnection::handleExplosion(shared_ptr<ExplodePacket> packet)
|
||||||
MultiPlayerLevel *mpLevel = (MultiPlayerLevel *)minecraft->level;
|
MultiPlayerLevel *mpLevel = (MultiPlayerLevel *)minecraft->level;
|
||||||
mpLevel->enableResetChanges(false);
|
mpLevel->enableResetChanges(false);
|
||||||
// 4J - now directly pass a pointer to the toBlow array in the packet rather than copying around
|
// 4J - now directly pass a pointer to the toBlow array in the packet rather than copying around
|
||||||
e->finalizeExplosion(true, &packet->toBlow);
|
e->finalizeExplosion(true, &packet->toBlow);
|
||||||
mpLevel->enableResetChanges(true);
|
mpLevel->enableResetChanges(true);
|
||||||
PIXEndNamedEvent();
|
PIXEndNamedEvent();
|
||||||
PIXEndNamedEvent();
|
PIXEndNamedEvent();
|
||||||
|
|
@ -2864,7 +2859,7 @@ void ClientConnection::handleContainerOpen(shared_ptr<ContainerOpenPacket> packe
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
failed = true;
|
failed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -2878,7 +2873,7 @@ void ClientConnection::handleContainerOpen(shared_ptr<ContainerOpenPacket> packe
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
failed = true;
|
failed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -2892,7 +2887,7 @@ void ClientConnection::handleContainerOpen(shared_ptr<ContainerOpenPacket> packe
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
failed = true;
|
failed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -2907,7 +2902,7 @@ void ClientConnection::handleContainerOpen(shared_ptr<ContainerOpenPacket> packe
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
failed = true;
|
failed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -2922,7 +2917,7 @@ void ClientConnection::handleContainerOpen(shared_ptr<ContainerOpenPacket> packe
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
failed = true;
|
failed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -2937,7 +2932,7 @@ void ClientConnection::handleContainerOpen(shared_ptr<ContainerOpenPacket> packe
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
failed = true;
|
failed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -2949,7 +2944,7 @@ void ClientConnection::handleContainerOpen(shared_ptr<ContainerOpenPacket> packe
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
failed = true;
|
failed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -2961,7 +2956,7 @@ void ClientConnection::handleContainerOpen(shared_ptr<ContainerOpenPacket> packe
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
failed = true;
|
failed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -2975,7 +2970,7 @@ void ClientConnection::handleContainerOpen(shared_ptr<ContainerOpenPacket> packe
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
failed = true;
|
failed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -2990,7 +2985,7 @@ void ClientConnection::handleContainerOpen(shared_ptr<ContainerOpenPacket> packe
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
failed = true;
|
failed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -3002,7 +2997,7 @@ void ClientConnection::handleContainerOpen(shared_ptr<ContainerOpenPacket> packe
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
failed = true;
|
failed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -3025,7 +3020,7 @@ void ClientConnection::handleContainerOpen(shared_ptr<ContainerOpenPacket> packe
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
failed = true;
|
failed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -3037,7 +3032,7 @@ void ClientConnection::handleContainerOpen(shared_ptr<ContainerOpenPacket> packe
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
failed = true;
|
failed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -3115,7 +3110,7 @@ void ClientConnection::handleContainerAck(shared_ptr<ContainerAckPacket> packet)
|
||||||
void ClientConnection::handleContainerContent(shared_ptr<ContainerSetContentPacket> packet)
|
void ClientConnection::handleContainerContent(shared_ptr<ContainerSetContentPacket> packet)
|
||||||
{
|
{
|
||||||
shared_ptr<MultiplayerLocalPlayer> player = minecraft->localplayers[m_userIndex];
|
shared_ptr<MultiplayerLocalPlayer> player = minecraft->localplayers[m_userIndex];
|
||||||
if (packet->containerId == AbstractContainerMenu::CONTAINER_ID_INVENTORY)
|
if (packet->containerId == AbstractContainerMenu::CONTAINER_ID_INVENTORY)
|
||||||
{
|
{
|
||||||
player->inventoryMenu->setAll(&packet->items);
|
player->inventoryMenu->setAll(&packet->items);
|
||||||
}
|
}
|
||||||
|
|
@ -3195,7 +3190,7 @@ void ClientConnection::handleTileEntityData(shared_ptr<TileEntityDataPacket> pac
|
||||||
else if (packet->type == TileEntityDataPacket::TYPE_BEACON && dynamic_pointer_cast<BeaconTileEntity>(te) != NULL)
|
else if (packet->type == TileEntityDataPacket::TYPE_BEACON && dynamic_pointer_cast<BeaconTileEntity>(te) != NULL)
|
||||||
{
|
{
|
||||||
dynamic_pointer_cast<BeaconTileEntity>(te)->load(packet->tag);
|
dynamic_pointer_cast<BeaconTileEntity>(te)->load(packet->tag);
|
||||||
}
|
}
|
||||||
else if (packet->type == TileEntityDataPacket::TYPE_SKULL && dynamic_pointer_cast<SkullTileEntity>(te) != NULL)
|
else if (packet->type == TileEntityDataPacket::TYPE_SKULL && dynamic_pointer_cast<SkullTileEntity>(te) != NULL)
|
||||||
{
|
{
|
||||||
dynamic_pointer_cast<SkullTileEntity>(te)->load(packet->tag);
|
dynamic_pointer_cast<SkullTileEntity>(te)->load(packet->tag);
|
||||||
|
|
@ -3273,7 +3268,7 @@ void ClientConnection::handleGameEvent(shared_ptr<GameEventPacket> gameEventPack
|
||||||
else if (event == GameEventPacket::WIN_GAME)
|
else if (event == GameEventPacket::WIN_GAME)
|
||||||
{
|
{
|
||||||
ui.SetWinUserIndex( (BYTE)gameEventPacket->param );
|
ui.SetWinUserIndex( (BYTE)gameEventPacket->param );
|
||||||
|
|
||||||
#ifdef _XBOX
|
#ifdef _XBOX
|
||||||
|
|
||||||
// turn off the gamertags in splitscreen for the primary player, since they are about to be made fullscreen
|
// turn off the gamertags in splitscreen for the primary player, since they are about to be made fullscreen
|
||||||
|
|
@ -3513,7 +3508,7 @@ void ClientConnection::displayPrivilegeChanges(shared_ptr<MultiplayerLocalPlayer
|
||||||
case Player::ePlayerGamePrivilege_Invulnerable:
|
case Player::ePlayerGamePrivilege_Invulnerable:
|
||||||
if(privOn) message = app.GetString(IDS_PRIV_INVULNERABLE_TOGGLE_ON);
|
if(privOn) message = app.GetString(IDS_PRIV_INVULNERABLE_TOGGLE_ON);
|
||||||
else message = app.GetString(IDS_PRIV_INVULNERABLE_TOGGLE_OFF);
|
else message = app.GetString(IDS_PRIV_INVULNERABLE_TOGGLE_OFF);
|
||||||
break;
|
break;
|
||||||
case Player::ePlayerGamePrivilege_CanToggleInvisible:
|
case Player::ePlayerGamePrivilege_CanToggleInvisible:
|
||||||
if(privOn) message = app.GetString(IDS_PRIV_CAN_INVISIBLE_TOGGLE_ON);
|
if(privOn) message = app.GetString(IDS_PRIV_CAN_INVISIBLE_TOGGLE_ON);
|
||||||
else message = app.GetString(IDS_PRIV_CAN_INVISIBLE_TOGGLE_OFF);
|
else message = app.GetString(IDS_PRIV_CAN_INVISIBLE_TOGGLE_OFF);
|
||||||
|
|
@ -3587,7 +3582,7 @@ void ClientConnection::handleCustomPayload(shared_ptr<CustomPayloadPacket> custo
|
||||||
UIScene_TradingMenu *screen = (UIScene_TradingMenu *)scene;
|
UIScene_TradingMenu *screen = (UIScene_TradingMenu *)scene;
|
||||||
trader = screen->getMerchant();
|
trader = screen->getMerchant();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
MerchantRecipeList *recipeList = MerchantRecipeList::createFromStream(&input);
|
MerchantRecipeList *recipeList = MerchantRecipeList::createFromStream(&input);
|
||||||
trader->overrideOffers(recipeList);
|
trader->overrideOffers(recipeList);
|
||||||
}
|
}
|
||||||
|
|
@ -3674,7 +3669,7 @@ int ClientConnection::HostDisconnectReturned(void *pParam,int iPad,C4JStorage::E
|
||||||
|
|
||||||
DLCPack *pDLCPack=pDLCTexPack->getDLCInfoParentPack();//tPack->getDLCPack();
|
DLCPack *pDLCPack=pDLCTexPack->getDLCInfoParentPack();//tPack->getDLCPack();
|
||||||
if(!pDLCPack->hasPurchasedFile( DLCManager::e_DLCType_Texture, L"" ))
|
if(!pDLCPack->hasPurchasedFile( DLCManager::e_DLCType_Texture, L"" ))
|
||||||
{
|
{
|
||||||
// no upsell, we're about to quit
|
// no upsell, we're about to quit
|
||||||
MinecraftServer::getInstance()->setSaveOnExit( false );
|
MinecraftServer::getInstance()->setSaveOnExit( false );
|
||||||
// flag a app action of exit game
|
// flag a app action of exit game
|
||||||
|
|
@ -3728,7 +3723,7 @@ int ClientConnection::HostDisconnectReturned(void *pParam,int iPad,C4JStorage::E
|
||||||
int ClientConnection::ExitGameAndSaveReturned(void *pParam,int iPad,C4JStorage::EMessageResult result)
|
int ClientConnection::ExitGameAndSaveReturned(void *pParam,int iPad,C4JStorage::EMessageResult result)
|
||||||
{
|
{
|
||||||
// results switched for this dialog
|
// results switched for this dialog
|
||||||
if(result==C4JStorage::EMessage_ResultDecline)
|
if(result==C4JStorage::EMessage_ResultDecline)
|
||||||
{
|
{
|
||||||
//INT saveOrCheckpointId = 0;
|
//INT saveOrCheckpointId = 0;
|
||||||
//bool validSave = StorageManager.GetSaveUniqueNumber(&saveOrCheckpointId);
|
//bool validSave = StorageManager.GetSaveUniqueNumber(&saveOrCheckpointId);
|
||||||
|
|
@ -3747,7 +3742,7 @@ int ClientConnection::ExitGameAndSaveReturned(void *pParam,int iPad,C4JStorage::
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
wstring ClientConnection::GetDisplayNameByGamertag(wstring gamertag)
|
wstring ClientConnection::GetDisplayNameByGamertag(wstring gamertag)
|
||||||
{
|
{
|
||||||
#ifdef _DURANGO
|
#ifdef _DURANGO
|
||||||
|
|
@ -3892,31 +3887,31 @@ void ClientConnection::handleUpdateAttributes(shared_ptr<UpdateAttributesPacket>
|
||||||
if ( !entity->instanceof(eTYPE_LIVINGENTITY) )
|
if ( !entity->instanceof(eTYPE_LIVINGENTITY) )
|
||||||
{
|
{
|
||||||
// Entity is not a living entity!
|
// Entity is not a living entity!
|
||||||
assert(0);
|
assert(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
BaseAttributeMap *attributes = (dynamic_pointer_cast<LivingEntity>(entity))->getAttributes();
|
BaseAttributeMap *attributes = (dynamic_pointer_cast<LivingEntity>(entity))->getAttributes();
|
||||||
unordered_set<UpdateAttributesPacket::AttributeSnapshot *> attributeSnapshots = packet->getValues();
|
unordered_set<UpdateAttributesPacket::AttributeSnapshot *> attributeSnapshots = packet->getValues();
|
||||||
for (AUTO_VAR(it,attributeSnapshots.begin()); it != attributeSnapshots.end(); ++it)
|
for ( UpdateAttributesPacket::AttributeSnapshot *attribute : attributeSnapshots )
|
||||||
{
|
{
|
||||||
UpdateAttributesPacket::AttributeSnapshot *attribute = *it;
|
|
||||||
AttributeInstance *instance = attributes->getInstance(attribute->getId());
|
AttributeInstance *instance = attributes->getInstance(attribute->getId());
|
||||||
|
|
||||||
if (instance == NULL)
|
if (instance)
|
||||||
{
|
{
|
||||||
// 4J - TODO: revisit, not familiar with the attribute system, why are we passing in MIN_NORMAL (Java's smallest non-zero value conforming to IEEE Standard 754 (?)) and MAX_VALUE
|
// 4J - TODO: revisit, not familiar with the attribute system, why are we passing in MIN_NORMAL (Java's smallest non-zero value conforming to IEEE Standard 754 (?)) and MAX_VALUE
|
||||||
instance = attributes->registerAttribute(new RangedAttribute(attribute->getId(), 0, Double::MIN_NORMAL, Double::MAX_VALUE));
|
instance = attributes->registerAttribute(new RangedAttribute(attribute->getId(), 0, Double::MIN_NORMAL, Double::MAX_VALUE));
|
||||||
}
|
instance->setBaseValue(attribute->getBase());
|
||||||
|
instance->removeModifiers();
|
||||||
|
|
||||||
|
unordered_set<AttributeModifier *> *modifiers = attribute->getModifiers();
|
||||||
|
|
||||||
instance->setBaseValue(attribute->getBase());
|
if ( modifiers )
|
||||||
instance->removeModifiers();
|
{
|
||||||
|
for ( AttributeModifier* modifier : *modifiers )
|
||||||
unordered_set<AttributeModifier *> *modifiers = attribute->getModifiers();
|
{
|
||||||
|
instance->addModifier(new AttributeModifier(modifier->getId(), modifier->getAmount(), modifier->getOperation()));
|
||||||
for (AUTO_VAR(it2,modifiers->begin()); it2 != modifiers->end(); ++it2)
|
}
|
||||||
{
|
}
|
||||||
AttributeModifier* modifier = *it2;
|
|
||||||
instance->addModifier(new AttributeModifier(modifier->getId(), modifier->getAmount(), modifier->getOperation() ) );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ void ConsoleSoundEngine::tick()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(AUTO_VAR(it,scheduledSounds.begin()); it != scheduledSounds.end();)
|
for (auto it = scheduledSounds.begin(); it != scheduledSounds.end();)
|
||||||
{
|
{
|
||||||
SoundEngine::ScheduledSound *next = *it;
|
SoundEngine::ScheduledSound *next = *it;
|
||||||
next->delay--;
|
next->delay--;
|
||||||
|
|
|
||||||
|
|
@ -355,7 +355,7 @@ void ColourTable::loadColoursFromData(PBYTE pbData, DWORD dwLength)
|
||||||
wstring colourId = dis.readUTF();
|
wstring colourId = dis.readUTF();
|
||||||
int colourValue = dis.readInt();
|
int colourValue = dis.readInt();
|
||||||
setColour(colourId, colourValue);
|
setColour(colourId, colourValue);
|
||||||
AUTO_VAR(it,s_colourNamesMap.find(colourId));
|
auto it = s_colourNamesMap.find(colourId); // ?
|
||||||
}
|
}
|
||||||
|
|
||||||
bais.reset();
|
bais.reset();
|
||||||
|
|
@ -363,7 +363,7 @@ void ColourTable::loadColoursFromData(PBYTE pbData, DWORD dwLength)
|
||||||
|
|
||||||
void ColourTable::setColour(const wstring &colourName, int value)
|
void ColourTable::setColour(const wstring &colourName, int value)
|
||||||
{
|
{
|
||||||
AUTO_VAR(it,s_colourNamesMap.find(colourName));
|
auto it = s_colourNamesMap.find(colourName);
|
||||||
if(it != s_colourNamesMap.end())
|
if(it != s_colourNamesMap.end())
|
||||||
{
|
{
|
||||||
m_colourValues[(int)it->second] = value;
|
m_colourValues[(int)it->second] = value;
|
||||||
|
|
|
||||||
|
|
@ -1475,9 +1475,8 @@ void CMinecraftApp::ActionGameSettings(int iPad,eGameSetting eVal)
|
||||||
app.SetXuiServerAction(iPad,eXuiServerAction_ServerSettingChanged_Gamertags);
|
app.SetXuiServerAction(iPad,eXuiServerAction_ServerSettingChanged_Gamertags);
|
||||||
|
|
||||||
PlayerList *players = MinecraftServer::getInstance()->getPlayerList();
|
PlayerList *players = MinecraftServer::getInstance()->getPlayerList();
|
||||||
for(AUTO_VAR(it3, players->players.begin()); it3 != players->players.end(); ++it3)
|
for( auto& decorationPlayer : players->players )
|
||||||
{
|
{
|
||||||
shared_ptr<ServerPlayer> decorationPlayer = *it3;
|
|
||||||
decorationPlayer->setShowOnMaps((app.GetGameHostOption(eGameHostOption_Gamertags)!=0)?true:false);
|
decorationPlayer->setShowOnMaps((app.GetGameHostOption(eGameHostOption_Gamertags)!=0)?true:false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -5641,7 +5640,7 @@ bool CMinecraftApp::isXuidNotch(PlayerUID xuid)
|
||||||
|
|
||||||
bool CMinecraftApp::isXuidDeadmau5(PlayerUID xuid)
|
bool CMinecraftApp::isXuidDeadmau5(PlayerUID xuid)
|
||||||
{
|
{
|
||||||
AUTO_VAR(it, MojangData.find( xuid )); // 4J Stu - The .at and [] accessors insert elements if they don't exist
|
auto it = MojangData.find(xuid); // 4J Stu - The .at and [] accessors insert elements if they don't exist
|
||||||
if (it != MojangData.end() )
|
if (it != MojangData.end() )
|
||||||
{
|
{
|
||||||
MOJANG_DATA *pMojangData=MojangData[xuid];
|
MOJANG_DATA *pMojangData=MojangData[xuid];
|
||||||
|
|
@ -5659,7 +5658,7 @@ void CMinecraftApp::AddMemoryTextureFile(const wstring &wName,PBYTE pbData,DWORD
|
||||||
EnterCriticalSection(&csMemFilesLock);
|
EnterCriticalSection(&csMemFilesLock);
|
||||||
// check it's not already in
|
// check it's not already in
|
||||||
PMEMDATA pData=NULL;
|
PMEMDATA pData=NULL;
|
||||||
AUTO_VAR(it, m_MEM_Files.find(wName));
|
auto it = m_MEM_Files.find(wName);
|
||||||
if(it != m_MEM_Files.end())
|
if(it != m_MEM_Files.end())
|
||||||
{
|
{
|
||||||
#ifndef _CONTENT_PACKAGE
|
#ifndef _CONTENT_PACKAGE
|
||||||
|
|
@ -5704,7 +5703,7 @@ void CMinecraftApp::RemoveMemoryTextureFile(const wstring &wName)
|
||||||
{
|
{
|
||||||
EnterCriticalSection(&csMemFilesLock);
|
EnterCriticalSection(&csMemFilesLock);
|
||||||
|
|
||||||
AUTO_VAR(it, m_MEM_Files.find(wName));
|
auto it = m_MEM_Files.find(wName);
|
||||||
if(it != m_MEM_Files.end())
|
if(it != m_MEM_Files.end())
|
||||||
{
|
{
|
||||||
#ifndef _CONTENT_PACKAGE
|
#ifndef _CONTENT_PACKAGE
|
||||||
|
|
@ -5730,7 +5729,7 @@ bool CMinecraftApp::DefaultCapeExists()
|
||||||
bool val = false;
|
bool val = false;
|
||||||
|
|
||||||
EnterCriticalSection(&csMemFilesLock);
|
EnterCriticalSection(&csMemFilesLock);
|
||||||
AUTO_VAR(it, m_MEM_Files.find(wTex));
|
auto it = m_MEM_Files.find(wTex);
|
||||||
if(it != m_MEM_Files.end()) val = true;
|
if(it != m_MEM_Files.end()) val = true;
|
||||||
LeaveCriticalSection(&csMemFilesLock);
|
LeaveCriticalSection(&csMemFilesLock);
|
||||||
|
|
||||||
|
|
@ -5742,7 +5741,7 @@ bool CMinecraftApp::IsFileInMemoryTextures(const wstring &wName)
|
||||||
bool val = false;
|
bool val = false;
|
||||||
|
|
||||||
EnterCriticalSection(&csMemFilesLock);
|
EnterCriticalSection(&csMemFilesLock);
|
||||||
AUTO_VAR(it, m_MEM_Files.find(wName));
|
auto it = m_MEM_Files.find(wName);
|
||||||
if(it != m_MEM_Files.end()) val = true;
|
if(it != m_MEM_Files.end()) val = true;
|
||||||
LeaveCriticalSection(&csMemFilesLock);
|
LeaveCriticalSection(&csMemFilesLock);
|
||||||
|
|
||||||
|
|
@ -5752,7 +5751,7 @@ bool CMinecraftApp::IsFileInMemoryTextures(const wstring &wName)
|
||||||
void CMinecraftApp::GetMemFileDetails(const wstring &wName,PBYTE *ppbData,DWORD *pdwBytes)
|
void CMinecraftApp::GetMemFileDetails(const wstring &wName,PBYTE *ppbData,DWORD *pdwBytes)
|
||||||
{
|
{
|
||||||
EnterCriticalSection(&csMemFilesLock);
|
EnterCriticalSection(&csMemFilesLock);
|
||||||
AUTO_VAR(it, m_MEM_Files.find(wName));
|
auto it = m_MEM_Files.find(wName);
|
||||||
if(it != m_MEM_Files.end())
|
if(it != m_MEM_Files.end())
|
||||||
{
|
{
|
||||||
PMEMDATA pData = (*it).second;
|
PMEMDATA pData = (*it).second;
|
||||||
|
|
@ -5767,7 +5766,7 @@ void CMinecraftApp::AddMemoryTPDFile(int iConfig,PBYTE pbData,DWORD dwBytes)
|
||||||
EnterCriticalSection(&csMemTPDLock);
|
EnterCriticalSection(&csMemTPDLock);
|
||||||
// check it's not already in
|
// check it's not already in
|
||||||
PMEMDATA pData=NULL;
|
PMEMDATA pData=NULL;
|
||||||
AUTO_VAR(it, m_MEM_TPD.find(iConfig));
|
auto it = m_MEM_TPD.find(iConfig);
|
||||||
if(it == m_MEM_TPD.end())
|
if(it == m_MEM_TPD.end())
|
||||||
{
|
{
|
||||||
pData = (PMEMDATA)new BYTE[sizeof(MEMDATA)];
|
pData = (PMEMDATA)new BYTE[sizeof(MEMDATA)];
|
||||||
|
|
@ -5787,7 +5786,7 @@ void CMinecraftApp::RemoveMemoryTPDFile(int iConfig)
|
||||||
EnterCriticalSection(&csMemTPDLock);
|
EnterCriticalSection(&csMemTPDLock);
|
||||||
// check it's not already in
|
// check it's not already in
|
||||||
PMEMDATA pData=NULL;
|
PMEMDATA pData=NULL;
|
||||||
AUTO_VAR(it, m_MEM_TPD.find(iConfig));
|
auto it = m_MEM_TPD.find(iConfig);
|
||||||
if(it != m_MEM_TPD.end())
|
if(it != m_MEM_TPD.end())
|
||||||
{
|
{
|
||||||
pData=m_MEM_TPD[iConfig];
|
pData=m_MEM_TPD[iConfig];
|
||||||
|
|
@ -5844,7 +5843,7 @@ bool CMinecraftApp::IsFileInTPD(int iConfig)
|
||||||
bool val = false;
|
bool val = false;
|
||||||
|
|
||||||
EnterCriticalSection(&csMemTPDLock);
|
EnterCriticalSection(&csMemTPDLock);
|
||||||
AUTO_VAR(it, m_MEM_TPD.find(iConfig));
|
auto it = m_MEM_TPD.find(iConfig);
|
||||||
if(it != m_MEM_TPD.end()) val = true;
|
if(it != m_MEM_TPD.end()) val = true;
|
||||||
LeaveCriticalSection(&csMemTPDLock);
|
LeaveCriticalSection(&csMemTPDLock);
|
||||||
|
|
||||||
|
|
@ -5854,7 +5853,7 @@ bool CMinecraftApp::IsFileInTPD(int iConfig)
|
||||||
void CMinecraftApp::GetTPD(int iConfig,PBYTE *ppbData,DWORD *pdwBytes)
|
void CMinecraftApp::GetTPD(int iConfig,PBYTE *ppbData,DWORD *pdwBytes)
|
||||||
{
|
{
|
||||||
EnterCriticalSection(&csMemTPDLock);
|
EnterCriticalSection(&csMemTPDLock);
|
||||||
AUTO_VAR(it, m_MEM_TPD.find(iConfig));
|
auto it = m_MEM_TPD.find(iConfig);
|
||||||
if(it != m_MEM_TPD.end())
|
if(it != m_MEM_TPD.end())
|
||||||
{
|
{
|
||||||
PMEMDATA pData = (*it).second;
|
PMEMDATA pData = (*it).second;
|
||||||
|
|
@ -6989,7 +6988,7 @@ HRESULT CMinecraftApp::RegisterDLCData(eDLCContentType eType, WCHAR *pwchBannerN
|
||||||
// check if we already have this info from the local DLC file
|
// check if we already have this info from the local DLC file
|
||||||
wstring wsTemp=wchUppercaseProductID;
|
wstring wsTemp=wchUppercaseProductID;
|
||||||
|
|
||||||
AUTO_VAR(it, DLCInfo_Full.find(wsTemp));
|
auto it = DLCInfo_Full.find(wsTemp);
|
||||||
if( it == DLCInfo_Full.end() )
|
if( it == DLCInfo_Full.end() )
|
||||||
{
|
{
|
||||||
// Not found
|
// Not found
|
||||||
|
|
@ -7097,7 +7096,7 @@ HRESULT CMinecraftApp::RegisterDLCData(char *pchDLCName, unsigned int uiSortInde
|
||||||
#if defined( __PS3__) || defined(__ORBIS__) || defined(__PSVITA__)
|
#if defined( __PS3__) || defined(__ORBIS__) || defined(__PSVITA__)
|
||||||
bool CMinecraftApp::GetDLCFullOfferIDForSkinID(const wstring &FirstSkin,ULONGLONG *pullVal)
|
bool CMinecraftApp::GetDLCFullOfferIDForSkinID(const wstring &FirstSkin,ULONGLONG *pullVal)
|
||||||
{
|
{
|
||||||
AUTO_VAR(it, DLCInfo_SkinName.find(FirstSkin));
|
auto it = DLCInfo_SkinName.find(FirstSkin);
|
||||||
if( it == DLCInfo_SkinName.end() )
|
if( it == DLCInfo_SkinName.end() )
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -7110,7 +7109,7 @@ bool CMinecraftApp::GetDLCFullOfferIDForSkinID(const wstring &FirstSkin,ULONGLON
|
||||||
}
|
}
|
||||||
bool CMinecraftApp::GetDLCNameForPackID(const int iPackID,char **ppchKeyID)
|
bool CMinecraftApp::GetDLCNameForPackID(const int iPackID,char **ppchKeyID)
|
||||||
{
|
{
|
||||||
AUTO_VAR(it, DLCTextures_PackID.find(iPackID));
|
auto it = DLCTextures_PackID.find(iPackID);
|
||||||
if( it == DLCTextures_PackID.end() )
|
if( it == DLCTextures_PackID.end() )
|
||||||
{
|
{
|
||||||
*ppchKeyID=NULL;
|
*ppchKeyID=NULL;
|
||||||
|
|
@ -7128,7 +7127,7 @@ DLC_INFO *CMinecraftApp::GetDLCInfo(char *pchDLCName)
|
||||||
|
|
||||||
if(DLCInfo.size()>0)
|
if(DLCInfo.size()>0)
|
||||||
{
|
{
|
||||||
AUTO_VAR(it, DLCInfo.find(tempString));
|
auto it = DLCInfo.find(tempString);
|
||||||
|
|
||||||
if( it == DLCInfo.end() )
|
if( it == DLCInfo.end() )
|
||||||
{
|
{
|
||||||
|
|
@ -7185,7 +7184,7 @@ char *CMinecraftApp::GetDLCInfoTextures(int iIndex)
|
||||||
#elif defined _XBOX_ONE
|
#elif defined _XBOX_ONE
|
||||||
bool CMinecraftApp::GetDLCFullOfferIDForSkinID(const wstring &FirstSkin,wstring &ProductId)
|
bool CMinecraftApp::GetDLCFullOfferIDForSkinID(const wstring &FirstSkin,wstring &ProductId)
|
||||||
{
|
{
|
||||||
AUTO_VAR(it, DLCInfo_SkinName.find(FirstSkin));
|
auto it = DLCInfo_SkinName.find(FirstSkin);
|
||||||
if( it == DLCInfo_SkinName.end() )
|
if( it == DLCInfo_SkinName.end() )
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -7198,7 +7197,7 @@ bool CMinecraftApp::GetDLCFullOfferIDForSkinID(const wstring &FirstSkin,wstring
|
||||||
}
|
}
|
||||||
bool CMinecraftApp::GetDLCFullOfferIDForPackID(const int iPackID,wstring &ProductId)
|
bool CMinecraftApp::GetDLCFullOfferIDForPackID(const int iPackID,wstring &ProductId)
|
||||||
{
|
{
|
||||||
AUTO_VAR(it, DLCTextures_PackID.find(iPackID));
|
auto it = DLCTextures_PackID.find(iPackID);
|
||||||
if( it == DLCTextures_PackID.end() )
|
if( it == DLCTextures_PackID.end() )
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -7243,7 +7242,7 @@ wstring CMinecraftApp::GetDLCInfoTexturesFullOffer(int iIndex)
|
||||||
#else
|
#else
|
||||||
bool CMinecraftApp::GetDLCFullOfferIDForSkinID(const wstring &FirstSkin,ULONGLONG *pullVal)
|
bool CMinecraftApp::GetDLCFullOfferIDForSkinID(const wstring &FirstSkin,ULONGLONG *pullVal)
|
||||||
{
|
{
|
||||||
AUTO_VAR(it, DLCInfo_SkinName.find(FirstSkin));
|
auto it = DLCInfo_SkinName.find(FirstSkin);
|
||||||
if( it == DLCInfo_SkinName.end() )
|
if( it == DLCInfo_SkinName.end() )
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -7256,15 +7255,15 @@ bool CMinecraftApp::GetDLCFullOfferIDForSkinID(const wstring &FirstSkin,ULONGLON
|
||||||
}
|
}
|
||||||
bool CMinecraftApp::GetDLCFullOfferIDForPackID(const int iPackID,ULONGLONG *pullVal)
|
bool CMinecraftApp::GetDLCFullOfferIDForPackID(const int iPackID,ULONGLONG *pullVal)
|
||||||
{
|
{
|
||||||
AUTO_VAR(it, DLCTextures_PackID.find(iPackID));
|
auto it = DLCTextures_PackID.find(iPackID);
|
||||||
if( it == DLCTextures_PackID.end() )
|
if( it == DLCTextures_PackID.end() )
|
||||||
{
|
{
|
||||||
*pullVal=(ULONGLONG)0;
|
*pullVal=0ULL;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
*pullVal=(ULONGLONG)it->second;
|
*pullVal=it->second;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -7273,7 +7272,7 @@ DLC_INFO *CMinecraftApp::GetDLCInfoForTrialOfferID(ULONGLONG ullOfferID_Trial)
|
||||||
//DLC_INFO *pDLCInfo=NULL;
|
//DLC_INFO *pDLCInfo=NULL;
|
||||||
if(DLCInfo_Trial.size()>0)
|
if(DLCInfo_Trial.size()>0)
|
||||||
{
|
{
|
||||||
AUTO_VAR(it, DLCInfo_Trial.find(ullOfferID_Trial));
|
auto it = DLCInfo_Trial.find(ullOfferID_Trial);
|
||||||
|
|
||||||
if( it == DLCInfo_Trial.end() )
|
if( it == DLCInfo_Trial.end() )
|
||||||
{
|
{
|
||||||
|
|
@ -7330,7 +7329,7 @@ DLC_INFO *CMinecraftApp::GetDLCInfoForFullOfferID(WCHAR *pwchProductID)
|
||||||
wstring wsTemp = pwchProductID;
|
wstring wsTemp = pwchProductID;
|
||||||
if(DLCInfo_Full.size()>0)
|
if(DLCInfo_Full.size()>0)
|
||||||
{
|
{
|
||||||
AUTO_VAR(it, DLCInfo_Full.find(wsTemp));
|
auto it = DLCInfo_Full.find(wsTemp);
|
||||||
|
|
||||||
if( it == DLCInfo_Full.end() )
|
if( it == DLCInfo_Full.end() )
|
||||||
{
|
{
|
||||||
|
|
@ -7370,7 +7369,7 @@ DLC_INFO *CMinecraftApp::GetDLCInfoForFullOfferID(ULONGLONG ullOfferID_Full)
|
||||||
|
|
||||||
if(DLCInfo_Full.size()>0)
|
if(DLCInfo_Full.size()>0)
|
||||||
{
|
{
|
||||||
AUTO_VAR(it, DLCInfo_Full.find(ullOfferID_Full));
|
auto it = DLCInfo_Full.find(ullOfferID_Full);
|
||||||
|
|
||||||
if( it == DLCInfo_Full.end() )
|
if( it == DLCInfo_Full.end() )
|
||||||
{
|
{
|
||||||
|
|
@ -7570,9 +7569,8 @@ void CMinecraftApp::AddLevelToBannedLevelList(int iPad, PlayerUID xuid, char *ps
|
||||||
DWORD dwDataBytes=(DWORD)(sizeof(BANNEDLISTDATA)*m_vBannedListA[iPad]->size());
|
DWORD dwDataBytes=(DWORD)(sizeof(BANNEDLISTDATA)*m_vBannedListA[iPad]->size());
|
||||||
PBANNEDLISTDATA pBannedList = (BANNEDLISTDATA *)(new CHAR [dwDataBytes]);
|
PBANNEDLISTDATA pBannedList = (BANNEDLISTDATA *)(new CHAR [dwDataBytes]);
|
||||||
int iCount=0;
|
int iCount=0;
|
||||||
for(AUTO_VAR(it, m_vBannedListA[iPad]->begin()); it != m_vBannedListA[iPad]->end(); ++it)
|
for (PBANNEDLISTDATA pData : *m_vBannedListA[iPad] )
|
||||||
{
|
{
|
||||||
PBANNEDLISTDATA pData=*it;
|
|
||||||
memcpy(&pBannedList[iCount++],pData,sizeof(BANNEDLISTDATA));
|
memcpy(&pBannedList[iCount++],pData,sizeof(BANNEDLISTDATA));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -7590,9 +7588,8 @@ void CMinecraftApp::AddLevelToBannedLevelList(int iPad, PlayerUID xuid, char *ps
|
||||||
|
|
||||||
bool CMinecraftApp::IsInBannedLevelList(int iPad, PlayerUID xuid, char *pszLevelName)
|
bool CMinecraftApp::IsInBannedLevelList(int iPad, PlayerUID xuid, char *pszLevelName)
|
||||||
{
|
{
|
||||||
for(AUTO_VAR(it, m_vBannedListA[iPad]->begin()); it != m_vBannedListA[iPad]->end(); ++it)
|
for( PBANNEDLISTDATA pData : *m_vBannedListA[iPad] )
|
||||||
{
|
{
|
||||||
PBANNEDLISTDATA pData=*it;
|
|
||||||
#ifdef _XBOX_ONE
|
#ifdef _XBOX_ONE
|
||||||
PlayerUID bannedPlayerUID = pData->wchPlayerUID;
|
PlayerUID bannedPlayerUID = pData->wchPlayerUID;
|
||||||
if(IsEqualXUID (bannedPlayerUID,xuid) && (strcmp(pData->pszLevelName,pszLevelName)==0))
|
if(IsEqualXUID (bannedPlayerUID,xuid) && (strcmp(pData->pszLevelName,pszLevelName)==0))
|
||||||
|
|
@ -7613,7 +7610,7 @@ void CMinecraftApp::RemoveLevelFromBannedLevelList(int iPad, PlayerUID xuid, cha
|
||||||
//bool bRes;
|
//bool bRes;
|
||||||
|
|
||||||
// we will have retrieved the banned level list from TMS, so remove this one from it and write it back to TMS
|
// we will have retrieved the banned level list from TMS, so remove this one from it and write it back to TMS
|
||||||
for(AUTO_VAR(it, m_vBannedListA[iPad]->begin()); it != m_vBannedListA[iPad]->end(); )
|
for (auto it = m_vBannedListA[iPad]->begin(); it != m_vBannedListA[iPad]->end(); )
|
||||||
{
|
{
|
||||||
PBANNEDLISTDATA pBannedListData = *it;
|
PBANNEDLISTDATA pBannedListData = *it;
|
||||||
|
|
||||||
|
|
@ -8321,10 +8318,8 @@ unsigned int CMinecraftApp::CreateImageTextData(PBYTE bTextMetadata, __int64 see
|
||||||
void CMinecraftApp::AddTerrainFeaturePosition(_eTerrainFeatureType eFeatureType,int x,int z)
|
void CMinecraftApp::AddTerrainFeaturePosition(_eTerrainFeatureType eFeatureType,int x,int z)
|
||||||
{
|
{
|
||||||
// check we don't already have this in
|
// check we don't already have this in
|
||||||
for(AUTO_VAR(it, m_vTerrainFeatures.begin()); it < m_vTerrainFeatures.end(); ++it)
|
for( FEATURE_DATA *pFeatureData : m_vTerrainFeatures )
|
||||||
{
|
{
|
||||||
FEATURE_DATA *pFeatureData=*it;
|
|
||||||
|
|
||||||
if((pFeatureData->eTerrainFeature==eFeatureType) &&(pFeatureData->x==x) && (pFeatureData->z==z)) return;
|
if((pFeatureData->eTerrainFeature==eFeatureType) &&(pFeatureData->x==x) && (pFeatureData->z==z)) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -8338,10 +8333,8 @@ void CMinecraftApp::AddTerrainFeaturePosition(_eTerrainFeatureType eFeatureType,
|
||||||
|
|
||||||
_eTerrainFeatureType CMinecraftApp::IsTerrainFeature(int x,int z)
|
_eTerrainFeatureType CMinecraftApp::IsTerrainFeature(int x,int z)
|
||||||
{
|
{
|
||||||
for(AUTO_VAR(it, m_vTerrainFeatures.begin()); it < m_vTerrainFeatures.end(); ++it)
|
for(FEATURE_DATA *pFeatureData : m_vTerrainFeatures )
|
||||||
{
|
{
|
||||||
FEATURE_DATA *pFeatureData=*it;
|
|
||||||
|
|
||||||
if((pFeatureData->x==x) && (pFeatureData->z==z)) return pFeatureData->eTerrainFeature;
|
if((pFeatureData->x==x) && (pFeatureData->z==z)) return pFeatureData->eTerrainFeature;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -8350,10 +8343,8 @@ _eTerrainFeatureType CMinecraftApp::IsTerrainFeature(int x,int z)
|
||||||
|
|
||||||
bool CMinecraftApp::GetTerrainFeaturePosition(_eTerrainFeatureType eType,int *pX, int *pZ)
|
bool CMinecraftApp::GetTerrainFeaturePosition(_eTerrainFeatureType eType,int *pX, int *pZ)
|
||||||
{
|
{
|
||||||
for(AUTO_VAR(it, m_vTerrainFeatures.begin()); it < m_vTerrainFeatures.end(); ++it)
|
for ( const FEATURE_DATA *pFeatureData : m_vTerrainFeatures )
|
||||||
{
|
{
|
||||||
FEATURE_DATA *pFeatureData=*it;
|
|
||||||
|
|
||||||
if(pFeatureData->eTerrainFeature==eType)
|
if(pFeatureData->eTerrainFeature==eType)
|
||||||
{
|
{
|
||||||
*pX=pFeatureData->x;
|
*pX=pFeatureData->x;
|
||||||
|
|
@ -8489,10 +8480,8 @@ unsigned int CMinecraftApp::AddDLCRequest(eDLCMarketplaceType eType, bool bPromo
|
||||||
|
|
||||||
// If it's already in there, promote it to the top of the list
|
// If it's already in there, promote it to the top of the list
|
||||||
int iPosition=0;
|
int iPosition=0;
|
||||||
for(AUTO_VAR(it, m_DLCDownloadQueue.begin()); it != m_DLCDownloadQueue.end(); ++it)
|
for( DLCRequest *pCurrent : m_DLCDownloadQueue )
|
||||||
{
|
{
|
||||||
DLCRequest *pCurrent = *it;
|
|
||||||
|
|
||||||
if(pCurrent->dwType==m_dwContentTypeA[eType])
|
if(pCurrent->dwType==m_dwContentTypeA[eType])
|
||||||
{
|
{
|
||||||
// already got this in the list
|
// already got this in the list
|
||||||
|
|
@ -8543,7 +8532,7 @@ unsigned int CMinecraftApp::AddTMSPPFileTypeRequest(eDLCContentType eType, bool
|
||||||
bool bPromoted=false;
|
bool bPromoted=false;
|
||||||
|
|
||||||
|
|
||||||
for(AUTO_VAR(it, m_TMSPPDownloadQueue.begin()); it != m_TMSPPDownloadQueue.end(); ++it)
|
for ( TMSPPRequest *pCurrent : m_TMSPPDownloadQueue )
|
||||||
{
|
{
|
||||||
TMSPPRequest *pCurrent = *it;
|
TMSPPRequest *pCurrent = *it;
|
||||||
|
|
||||||
|
|
@ -8601,10 +8590,8 @@ unsigned int CMinecraftApp::AddTMSPPFileTypeRequest(eDLCContentType eType, bool
|
||||||
// this may already be present in the vector because of a previous trial/full offer
|
// this may already be present in the vector because of a previous trial/full offer
|
||||||
|
|
||||||
bool bAlreadyInQueue=false;
|
bool bAlreadyInQueue=false;
|
||||||
for(AUTO_VAR(it, m_TMSPPDownloadQueue.begin()); it != m_TMSPPDownloadQueue.end(); ++it)
|
for( TMSPPRequest *pCurrent : m_TMSPPDownloadQueue )
|
||||||
{
|
{
|
||||||
TMSPPRequest *pCurrent = *it;
|
|
||||||
|
|
||||||
if(wcscmp(pDLC->wchDataFile,pCurrent->wchFilename)==0)
|
if(wcscmp(pDLC->wchDataFile,pCurrent->wchFilename)==0)
|
||||||
{
|
{
|
||||||
bAlreadyInQueue=true;
|
bAlreadyInQueue=true;
|
||||||
|
|
@ -8664,10 +8651,8 @@ unsigned int CMinecraftApp::AddTMSPPFileTypeRequest(eDLCContentType eType, bool
|
||||||
if(!bPresent) // retrieve it from TMSPP
|
if(!bPresent) // retrieve it from TMSPP
|
||||||
{
|
{
|
||||||
bool bAlreadyInQueue=false;
|
bool bAlreadyInQueue=false;
|
||||||
for(AUTO_VAR(it, m_TMSPPDownloadQueue.begin()); it != m_TMSPPDownloadQueue.end(); ++it)
|
for( TMSPPRequest *pCurrent : m_TMSPPDownloadQueue )
|
||||||
{
|
{
|
||||||
TMSPPRequest *pCurrent = *it;
|
|
||||||
|
|
||||||
if(wcscmp(pDLC->wchBanner,pCurrent->wchFilename)==0)
|
if(wcscmp(pDLC->wchBanner,pCurrent->wchFilename)==0)
|
||||||
{
|
{
|
||||||
bAlreadyInQueue=true;
|
bAlreadyInQueue=true;
|
||||||
|
|
@ -8721,10 +8706,8 @@ unsigned int CMinecraftApp::AddTMSPPFileTypeRequest(eDLCContentType eType, bool
|
||||||
// this may already be present in the vector because of a previous trial/full offer
|
// this may already be present in the vector because of a previous trial/full offer
|
||||||
|
|
||||||
bool bAlreadyInQueue=false;
|
bool bAlreadyInQueue=false;
|
||||||
for(AUTO_VAR(it, m_TMSPPDownloadQueue.begin()); it != m_TMSPPDownloadQueue.end(); ++it)
|
for( TMSPPRequest *pCurrent : m_TMSPPDownloadQueue )
|
||||||
{
|
{
|
||||||
TMSPPRequest *pCurrent = *it;
|
|
||||||
|
|
||||||
if(wcscmp(pDLC->wchBanner,pCurrent->wchFilename)==0)
|
if(wcscmp(pDLC->wchBanner,pCurrent->wchFilename)==0)
|
||||||
{
|
{
|
||||||
bAlreadyInQueue=true;
|
bAlreadyInQueue=true;
|
||||||
|
|
@ -8767,10 +8750,8 @@ unsigned int CMinecraftApp::AddTMSPPFileTypeRequest(eDLCContentType eType, bool
|
||||||
bool CMinecraftApp::CheckTMSDLCCanStop()
|
bool CMinecraftApp::CheckTMSDLCCanStop()
|
||||||
{
|
{
|
||||||
EnterCriticalSection(&csTMSPPDownloadQueue);
|
EnterCriticalSection(&csTMSPPDownloadQueue);
|
||||||
for(AUTO_VAR(it, m_TMSPPDownloadQueue.begin()); it != m_TMSPPDownloadQueue.end(); ++it)
|
for( TMSPPRequest *pCurrent : m_TMSPPDownloadQueue )
|
||||||
{
|
{
|
||||||
TMSPPRequest *pCurrent = *it;
|
|
||||||
|
|
||||||
if(pCurrent->eState==e_TMS_ContentState_Retrieving)
|
if(pCurrent->eState==e_TMS_ContentState_Retrieving)
|
||||||
{
|
{
|
||||||
LeaveCriticalSection(&csTMSPPDownloadQueue);
|
LeaveCriticalSection(&csTMSPPDownloadQueue);
|
||||||
|
|
@ -8796,10 +8777,8 @@ bool CMinecraftApp::RetrieveNextDLCContent()
|
||||||
}
|
}
|
||||||
|
|
||||||
EnterCriticalSection(&csDLCDownloadQueue);
|
EnterCriticalSection(&csDLCDownloadQueue);
|
||||||
for(AUTO_VAR(it, m_DLCDownloadQueue.begin()); it != m_DLCDownloadQueue.end(); ++it)
|
for( const DLCRequest* pCurrent : m_DLCDownloadQueue )
|
||||||
{
|
{
|
||||||
DLCRequest *pCurrent = *it;
|
|
||||||
|
|
||||||
if(pCurrent->eState==e_DLC_ContentState_Retrieving)
|
if(pCurrent->eState==e_DLC_ContentState_Retrieving)
|
||||||
{
|
{
|
||||||
LeaveCriticalSection(&csDLCDownloadQueue);
|
LeaveCriticalSection(&csDLCDownloadQueue);
|
||||||
|
|
@ -8808,10 +8787,8 @@ bool CMinecraftApp::RetrieveNextDLCContent()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now look for the next retrieval
|
// Now look for the next retrieval
|
||||||
for(AUTO_VAR(it, m_DLCDownloadQueue.begin()); it != m_DLCDownloadQueue.end(); ++it)
|
for( DLCRequest *pCurrent : m_DLCDownloadQueue )
|
||||||
{
|
{
|
||||||
DLCRequest *pCurrent = *it;
|
|
||||||
|
|
||||||
if(pCurrent->eState==e_DLC_ContentState_Idle)
|
if(pCurrent->eState==e_DLC_ContentState_Idle)
|
||||||
{
|
{
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
|
|
@ -8853,9 +8830,8 @@ int CMinecraftApp::TMSPPFileReturned(LPVOID pParam,int iPad,int iUserData,C4JSto
|
||||||
|
|
||||||
// find the right one in the vector
|
// find the right one in the vector
|
||||||
EnterCriticalSection(&pClass->csTMSPPDownloadQueue);
|
EnterCriticalSection(&pClass->csTMSPPDownloadQueue);
|
||||||
for(AUTO_VAR(it, pClass->m_TMSPPDownloadQueue.begin()); it != pClass->m_TMSPPDownloadQueue.end(); ++it)
|
for( TMSPPRequest *pCurrent : pClass->m_TMSPPDownloadQueue )
|
||||||
{
|
{
|
||||||
TMSPPRequest *pCurrent = *it;
|
|
||||||
#if defined(_XBOX) || defined(_WINDOWS64)
|
#if defined(_XBOX) || defined(_WINDOWS64)
|
||||||
char szFile[MAX_TMSFILENAME_SIZE];
|
char szFile[MAX_TMSFILENAME_SIZE];
|
||||||
wcstombs(szFile,pCurrent->wchFilename,MAX_TMSFILENAME_SIZE);
|
wcstombs(szFile,pCurrent->wchFilename,MAX_TMSFILENAME_SIZE);
|
||||||
|
|
@ -8956,8 +8932,7 @@ bool CMinecraftApp::RetrieveNextTMSPPContent()
|
||||||
|
|
||||||
if(ProfileManager.IsSignedInLive(ProfileManager.GetPrimaryPad())==false) return false;
|
if(ProfileManager.IsSignedInLive(ProfileManager.GetPrimaryPad())==false) return false;
|
||||||
|
|
||||||
EnterCriticalSection(&csTMSPPDownloadQueue);
|
for( TMSPPRequest *pCurrent : m_TMSPPDownloadQueue )
|
||||||
for(AUTO_VAR(it, m_TMSPPDownloadQueue.begin()); it != m_TMSPPDownloadQueue.end(); ++it)
|
|
||||||
{
|
{
|
||||||
TMSPPRequest *pCurrent = *it;
|
TMSPPRequest *pCurrent = *it;
|
||||||
|
|
||||||
|
|
@ -8970,7 +8945,7 @@ bool CMinecraftApp::RetrieveNextTMSPPContent()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now look for the next retrieval
|
// Now look for the next retrieval
|
||||||
for(AUTO_VAR(it, m_TMSPPDownloadQueue.begin()); it != m_TMSPPDownloadQueue.end(); ++it)
|
for( TMSPPRequest *pCurrent : m_TMSPPDownloadQueue )
|
||||||
{
|
{
|
||||||
TMSPPRequest *pCurrent = *it;
|
TMSPPRequest *pCurrent = *it;
|
||||||
|
|
||||||
|
|
@ -9074,11 +9049,10 @@ void CMinecraftApp::ClearAndResetDLCDownloadQueue()
|
||||||
|
|
||||||
int iPosition=0;
|
int iPosition=0;
|
||||||
EnterCriticalSection(&csTMSPPDownloadQueue);
|
EnterCriticalSection(&csTMSPPDownloadQueue);
|
||||||
for(AUTO_VAR(it, m_DLCDownloadQueue.begin()); it != m_DLCDownloadQueue.end(); ++it)
|
for( DLCRequest *pCurrent : m_DLCDownloadQueue )
|
||||||
{
|
{
|
||||||
DLCRequest *pCurrent = *it;
|
if ( pCurrent )
|
||||||
|
delete pCurrent;
|
||||||
delete pCurrent;
|
|
||||||
iPosition++;
|
iPosition++;
|
||||||
}
|
}
|
||||||
m_DLCDownloadQueue.clear();
|
m_DLCDownloadQueue.clear();
|
||||||
|
|
@ -9100,11 +9074,10 @@ void CMinecraftApp::ClearTMSPPFilesRetrieved()
|
||||||
{
|
{
|
||||||
int iPosition=0;
|
int iPosition=0;
|
||||||
EnterCriticalSection(&csTMSPPDownloadQueue);
|
EnterCriticalSection(&csTMSPPDownloadQueue);
|
||||||
for(AUTO_VAR(it, m_TMSPPDownloadQueue.begin()); it != m_TMSPPDownloadQueue.end(); ++it)
|
for ( TMSPPRequest *pCurrent : m_TMSPPDownloadQueue )
|
||||||
{
|
{
|
||||||
TMSPPRequest *pCurrent = *it;
|
if ( pCurrent )
|
||||||
|
delete pCurrent;
|
||||||
delete pCurrent;
|
|
||||||
iPosition++;
|
iPosition++;
|
||||||
}
|
}
|
||||||
m_TMSPPDownloadQueue.clear();
|
m_TMSPPDownloadQueue.clear();
|
||||||
|
|
@ -9118,10 +9091,8 @@ int CMinecraftApp::DLCOffersReturned(void *pParam, int iOfferC, DWORD dwType, in
|
||||||
|
|
||||||
// find the right one in the vector
|
// find the right one in the vector
|
||||||
EnterCriticalSection(&pClass->csTMSPPDownloadQueue);
|
EnterCriticalSection(&pClass->csTMSPPDownloadQueue);
|
||||||
for(AUTO_VAR(it, pClass->m_DLCDownloadQueue.begin()); it != pClass->m_DLCDownloadQueue.end(); ++it)
|
for( DLCRequest *pCurrent : pClass->m_DLCDownloadQueue )
|
||||||
{
|
{
|
||||||
DLCRequest *pCurrent = *it;
|
|
||||||
|
|
||||||
// avatar items are coming back as type Content, so we can't trust the type setting
|
// avatar items are coming back as type Content, so we can't trust the type setting
|
||||||
if(pCurrent->dwType==dwType)
|
if(pCurrent->dwType==dwType)
|
||||||
{
|
{
|
||||||
|
|
@ -9151,10 +9122,8 @@ bool CMinecraftApp::DLCContentRetrieved(eDLCMarketplaceType eType)
|
||||||
// If there's already a retrieve in progress, quit
|
// If there's already a retrieve in progress, quit
|
||||||
// we may have re-ordered the list, so need to check every item
|
// we may have re-ordered the list, so need to check every item
|
||||||
EnterCriticalSection(&csDLCDownloadQueue);
|
EnterCriticalSection(&csDLCDownloadQueue);
|
||||||
for(AUTO_VAR(it, m_DLCDownloadQueue.begin()); it != m_DLCDownloadQueue.end(); ++it)
|
for( DLCRequest *pCurrent : m_DLCDownloadQueue )
|
||||||
{
|
{
|
||||||
DLCRequest *pCurrent = *it;
|
|
||||||
|
|
||||||
if((pCurrent->dwType==m_dwContentTypeA[eType]) && (pCurrent->eState==e_DLC_ContentState_Retrieved))
|
if((pCurrent->dwType==m_dwContentTypeA[eType]) && (pCurrent->eState==e_DLC_ContentState_Retrieved))
|
||||||
{
|
{
|
||||||
LeaveCriticalSection(&csDLCDownloadQueue);
|
LeaveCriticalSection(&csDLCDownloadQueue);
|
||||||
|
|
@ -9208,17 +9177,17 @@ vector<ModelPart *> * CMinecraftApp::SetAdditionalSkinBoxes(DWORD dwSkinID, vect
|
||||||
app.DebugPrintf("*** SetAdditionalSkinBoxes - Inserting model parts for skin %d from array of Skin Boxes\n",dwSkinID&0x0FFFFFFF);
|
app.DebugPrintf("*** SetAdditionalSkinBoxes - Inserting model parts for skin %d from array of Skin Boxes\n",dwSkinID&0x0FFFFFFF);
|
||||||
|
|
||||||
// convert the skin boxes into model parts, and add to the humanoid model
|
// convert the skin boxes into model parts, and add to the humanoid model
|
||||||
for(AUTO_VAR(it, pvSkinBoxA->begin());it != pvSkinBoxA->end(); ++it)
|
for( auto& it : *pvSkinBoxA )
|
||||||
{
|
{
|
||||||
if(pModel)
|
if(pModel)
|
||||||
{
|
{
|
||||||
ModelPart *pModelPart=pModel->AddOrRetrievePart(*it);
|
ModelPart *pModelPart=pModel->AddOrRetrievePart(it);
|
||||||
pvModelPart->push_back(pModelPart);
|
pvModelPart->push_back(pModelPart);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_AdditionalModelParts.insert( std::pair<DWORD, vector<ModelPart *> *>(dwSkinID, pvModelPart) );
|
m_AdditionalModelParts.emplace(dwSkinID, pvModelPart);
|
||||||
m_AdditionalSkinBoxes.insert( std::pair<DWORD, vector<SKIN_BOX *> *>(dwSkinID, pvSkinBoxA) );
|
m_AdditionalSkinBoxes.emplace(dwSkinID, pvSkinBoxA);
|
||||||
|
|
||||||
LeaveCriticalSection( &csAdditionalSkinBoxes );
|
LeaveCriticalSection( &csAdditionalSkinBoxes );
|
||||||
LeaveCriticalSection( &csAdditionalModelParts );
|
LeaveCriticalSection( &csAdditionalModelParts );
|
||||||
|
|
@ -9232,7 +9201,7 @@ vector<ModelPart *> *CMinecraftApp::GetAdditionalModelParts(DWORD dwSkinID)
|
||||||
vector<ModelPart *> *pvModelParts=NULL;
|
vector<ModelPart *> *pvModelParts=NULL;
|
||||||
if(m_AdditionalModelParts.size()>0)
|
if(m_AdditionalModelParts.size()>0)
|
||||||
{
|
{
|
||||||
AUTO_VAR(it, m_AdditionalModelParts.find(dwSkinID));
|
auto it = m_AdditionalModelParts.find(dwSkinID);
|
||||||
if(it!=m_AdditionalModelParts.end())
|
if(it!=m_AdditionalModelParts.end())
|
||||||
{
|
{
|
||||||
pvModelParts = (*it).second;
|
pvModelParts = (*it).second;
|
||||||
|
|
@ -9249,7 +9218,7 @@ vector<SKIN_BOX *> *CMinecraftApp::GetAdditionalSkinBoxes(DWORD dwSkinID)
|
||||||
vector<SKIN_BOX *> *pvSkinBoxes=NULL;
|
vector<SKIN_BOX *> *pvSkinBoxes=NULL;
|
||||||
if(m_AdditionalSkinBoxes.size()>0)
|
if(m_AdditionalSkinBoxes.size()>0)
|
||||||
{
|
{
|
||||||
AUTO_VAR(it,m_AdditionalSkinBoxes.find(dwSkinID));
|
auto it = m_AdditionalSkinBoxes.find(dwSkinID);
|
||||||
if(it!=m_AdditionalSkinBoxes.end())
|
if(it!=m_AdditionalSkinBoxes.end())
|
||||||
{
|
{
|
||||||
pvSkinBoxes = (*it).second;
|
pvSkinBoxes = (*it).second;
|
||||||
|
|
@ -9267,7 +9236,7 @@ unsigned int CMinecraftApp::GetAnimOverrideBitmask(DWORD dwSkinID)
|
||||||
|
|
||||||
if(m_AnimOverrides.size()>0)
|
if(m_AnimOverrides.size()>0)
|
||||||
{
|
{
|
||||||
AUTO_VAR(it, m_AnimOverrides.find(dwSkinID));
|
auto it = m_AnimOverrides.find(dwSkinID);
|
||||||
if(it!=m_AnimOverrides.end())
|
if(it!=m_AnimOverrides.end())
|
||||||
{
|
{
|
||||||
uiAnimOverrideBitmask = (*it).second;
|
uiAnimOverrideBitmask = (*it).second;
|
||||||
|
|
@ -9285,7 +9254,7 @@ void CMinecraftApp::SetAnimOverrideBitmask(DWORD dwSkinID,unsigned int uiAnimOve
|
||||||
|
|
||||||
if(m_AnimOverrides.size()>0)
|
if(m_AnimOverrides.size()>0)
|
||||||
{
|
{
|
||||||
AUTO_VAR(it, m_AnimOverrides.find(dwSkinID));
|
auto it = m_AnimOverrides.find(dwSkinID);
|
||||||
if(it!=m_AnimOverrides.end())
|
if(it!=m_AnimOverrides.end())
|
||||||
{
|
{
|
||||||
LeaveCriticalSection( &csAnimOverrideBitmask );
|
LeaveCriticalSection( &csAnimOverrideBitmask );
|
||||||
|
|
|
||||||
|
|
@ -178,7 +178,7 @@ bool DLCAudioFile::processDLCDataFile(PBYTE pbData, DWORD dwLength)
|
||||||
{
|
{
|
||||||
//EAudioParameterType paramType = e_AudioParamType_Invalid;
|
//EAudioParameterType paramType = e_AudioParamType_Invalid;
|
||||||
|
|
||||||
AUTO_VAR(it, parameterMapping.find( pParams->dwType ));
|
auto it = parameterMapping.find(pParams->dwType);
|
||||||
|
|
||||||
if(it != parameterMapping.end() )
|
if(it != parameterMapping.end() )
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -32,10 +32,10 @@ DLCManager::DLCManager()
|
||||||
|
|
||||||
DLCManager::~DLCManager()
|
DLCManager::~DLCManager()
|
||||||
{
|
{
|
||||||
for(AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it)
|
for ( DLCPack *pack : m_packs )
|
||||||
{
|
{
|
||||||
DLCPack *pack = *it;
|
if ( pack )
|
||||||
delete pack;
|
delete pack;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -60,10 +60,9 @@ DWORD DLCManager::getPackCount(EDLCType type /*= e_DLCType_All*/)
|
||||||
DWORD packCount = 0;
|
DWORD packCount = 0;
|
||||||
if( type != e_DLCType_All )
|
if( type != e_DLCType_All )
|
||||||
{
|
{
|
||||||
for(AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it)
|
for( DLCPack *pack : m_packs )
|
||||||
{
|
{
|
||||||
DLCPack *pack = *it;
|
if( pack && pack->getDLCItemsCount(type) > 0 )
|
||||||
if( pack->getDLCItemsCount(type) > 0 )
|
|
||||||
{
|
{
|
||||||
++packCount;
|
++packCount;
|
||||||
}
|
}
|
||||||
|
|
@ -85,7 +84,7 @@ void DLCManager::removePack(DLCPack *pack)
|
||||||
{
|
{
|
||||||
if(pack != NULL)
|
if(pack != NULL)
|
||||||
{
|
{
|
||||||
AUTO_VAR(it, find(m_packs.begin(),m_packs.end(),pack));
|
auto it = find(m_packs.begin(), m_packs.end(), pack);
|
||||||
if(it != m_packs.end() ) m_packs.erase(it);
|
if(it != m_packs.end() ) m_packs.erase(it);
|
||||||
delete pack;
|
delete pack;
|
||||||
}
|
}
|
||||||
|
|
@ -93,10 +92,10 @@ void DLCManager::removePack(DLCPack *pack)
|
||||||
|
|
||||||
void DLCManager::removeAllPacks(void)
|
void DLCManager::removeAllPacks(void)
|
||||||
{
|
{
|
||||||
for(AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it)
|
for( DLCPack *pack : m_packs )
|
||||||
{
|
{
|
||||||
DLCPack *pack = (DLCPack *)*it;
|
if ( pack )
|
||||||
delete pack;
|
delete pack;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_packs.clear();
|
m_packs.clear();
|
||||||
|
|
@ -104,23 +103,19 @@ void DLCManager::removeAllPacks(void)
|
||||||
|
|
||||||
void DLCManager::LanguageChanged(void)
|
void DLCManager::LanguageChanged(void)
|
||||||
{
|
{
|
||||||
for(AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it)
|
for( DLCPack *pack : m_packs )
|
||||||
{
|
{
|
||||||
DLCPack *pack = (DLCPack *)*it;
|
|
||||||
// update the language
|
// update the language
|
||||||
pack->UpdateLanguage();
|
pack->UpdateLanguage();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DLCPack *DLCManager::getPack(const wstring &name)
|
DLCPack *DLCManager::getPack(const wstring &name)
|
||||||
{
|
{
|
||||||
DLCPack *pack = NULL;
|
DLCPack *pack = NULL;
|
||||||
//DWORD currentIndex = 0;
|
//DWORD currentIndex = 0;
|
||||||
DLCPack *currentPack = NULL;
|
for( DLCPack * currentPack : m_packs )
|
||||||
for(AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it)
|
|
||||||
{
|
{
|
||||||
currentPack = *it;
|
|
||||||
wstring wsName=currentPack->getName();
|
wstring wsName=currentPack->getName();
|
||||||
|
|
||||||
if(wsName.compare(name) == 0)
|
if(wsName.compare(name) == 0)
|
||||||
|
|
@ -136,11 +131,8 @@ DLCPack *DLCManager::getPack(const wstring &name)
|
||||||
DLCPack *DLCManager::getPackFromProductID(const wstring &productID)
|
DLCPack *DLCManager::getPackFromProductID(const wstring &productID)
|
||||||
{
|
{
|
||||||
DLCPack *pack = NULL;
|
DLCPack *pack = NULL;
|
||||||
//DWORD currentIndex = 0;
|
for( DLCPack *currentPack : m_packs )
|
||||||
DLCPack *currentPack = NULL;
|
|
||||||
for(AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it)
|
|
||||||
{
|
{
|
||||||
currentPack = *it;
|
|
||||||
wstring wsName=currentPack->getPurchaseOfferId();
|
wstring wsName=currentPack->getPurchaseOfferId();
|
||||||
|
|
||||||
if(wsName.compare(productID) == 0)
|
if(wsName.compare(productID) == 0)
|
||||||
|
|
@ -159,10 +151,8 @@ DLCPack *DLCManager::getPack(DWORD index, EDLCType type /*= e_DLCType_All*/)
|
||||||
if( type != e_DLCType_All )
|
if( type != e_DLCType_All )
|
||||||
{
|
{
|
||||||
DWORD currentIndex = 0;
|
DWORD currentIndex = 0;
|
||||||
DLCPack *currentPack = NULL;
|
for( DLCPack *currentPack : m_packs )
|
||||||
for(AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it)
|
|
||||||
{
|
{
|
||||||
currentPack = *it;
|
|
||||||
if(currentPack->getDLCItemsCount(type)>0)
|
if(currentPack->getDLCItemsCount(type)>0)
|
||||||
{
|
{
|
||||||
if(currentIndex == index)
|
if(currentIndex == index)
|
||||||
|
|
@ -200,9 +190,8 @@ DWORD DLCManager::getPackIndex(DLCPack *pack, bool &found, EDLCType type /*= e_D
|
||||||
if( type != e_DLCType_All )
|
if( type != e_DLCType_All )
|
||||||
{
|
{
|
||||||
DWORD index = 0;
|
DWORD index = 0;
|
||||||
for(AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it)
|
for( DLCPack *thisPack : m_packs )
|
||||||
{
|
{
|
||||||
DLCPack *thisPack = *it;
|
|
||||||
if(thisPack->getDLCItemsCount(type)>0)
|
if(thisPack->getDLCItemsCount(type)>0)
|
||||||
{
|
{
|
||||||
if(thisPack == pack)
|
if(thisPack == pack)
|
||||||
|
|
@ -218,9 +207,8 @@ DWORD DLCManager::getPackIndex(DLCPack *pack, bool &found, EDLCType type /*= e_D
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DWORD index = 0;
|
DWORD index = 0;
|
||||||
for(AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it)
|
for( DLCPack *thisPack : m_packs )
|
||||||
{
|
{
|
||||||
DLCPack *thisPack = *it;
|
|
||||||
if(thisPack == pack)
|
if(thisPack == pack)
|
||||||
{
|
{
|
||||||
found = true;
|
found = true;
|
||||||
|
|
@ -238,9 +226,8 @@ DWORD DLCManager::getPackIndexContainingSkin(const wstring &path, bool &found)
|
||||||
DWORD foundIndex = 0;
|
DWORD foundIndex = 0;
|
||||||
found = false;
|
found = false;
|
||||||
DWORD index = 0;
|
DWORD index = 0;
|
||||||
for(AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it)
|
for( DLCPack *pack : m_packs )
|
||||||
{
|
{
|
||||||
DLCPack *pack = *it;
|
|
||||||
if(pack->getDLCItemsCount(e_DLCType_Skin)>0)
|
if(pack->getDLCItemsCount(e_DLCType_Skin)>0)
|
||||||
{
|
{
|
||||||
if(pack->doesPackContainSkin(path))
|
if(pack->doesPackContainSkin(path))
|
||||||
|
|
@ -258,9 +245,8 @@ DWORD DLCManager::getPackIndexContainingSkin(const wstring &path, bool &found)
|
||||||
DLCPack *DLCManager::getPackContainingSkin(const wstring &path)
|
DLCPack *DLCManager::getPackContainingSkin(const wstring &path)
|
||||||
{
|
{
|
||||||
DLCPack *foundPack = NULL;
|
DLCPack *foundPack = NULL;
|
||||||
for(AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it)
|
for( DLCPack *pack : m_packs )
|
||||||
{
|
{
|
||||||
DLCPack *pack = *it;
|
|
||||||
if(pack->getDLCItemsCount(e_DLCType_Skin)>0)
|
if(pack->getDLCItemsCount(e_DLCType_Skin)>0)
|
||||||
{
|
{
|
||||||
if(pack->doesPackContainSkin(path))
|
if(pack->doesPackContainSkin(path))
|
||||||
|
|
@ -276,9 +262,8 @@ DLCPack *DLCManager::getPackContainingSkin(const wstring &path)
|
||||||
DLCSkinFile *DLCManager::getSkinFile(const wstring &path)
|
DLCSkinFile *DLCManager::getSkinFile(const wstring &path)
|
||||||
{
|
{
|
||||||
DLCSkinFile *foundSkinfile = NULL;
|
DLCSkinFile *foundSkinfile = NULL;
|
||||||
for(AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it)
|
for( DLCPack *pack : m_packs )
|
||||||
{
|
{
|
||||||
DLCPack *pack = *it;
|
|
||||||
foundSkinfile=pack->getSkinFile(path);
|
foundSkinfile=pack->getSkinFile(path);
|
||||||
if(foundSkinfile!=NULL)
|
if(foundSkinfile!=NULL)
|
||||||
{
|
{
|
||||||
|
|
@ -291,12 +276,10 @@ DLCSkinFile *DLCManager::getSkinFile(const wstring &path)
|
||||||
DWORD DLCManager::checkForCorruptDLCAndAlert(bool showMessage /*= true*/)
|
DWORD DLCManager::checkForCorruptDLCAndAlert(bool showMessage /*= true*/)
|
||||||
{
|
{
|
||||||
DWORD corruptDLCCount = m_dwUnnamedCorruptDLCCount;
|
DWORD corruptDLCCount = m_dwUnnamedCorruptDLCCount;
|
||||||
DLCPack *pack = NULL;
|
|
||||||
DLCPack *firstCorruptPack = NULL;
|
DLCPack *firstCorruptPack = NULL;
|
||||||
|
|
||||||
for(AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it)
|
for( DLCPack *pack : m_packs )
|
||||||
{
|
{
|
||||||
pack = *it;
|
|
||||||
if( pack->IsCorrupt() )
|
if( pack->IsCorrupt() )
|
||||||
{
|
{
|
||||||
++corruptDLCCount;
|
++corruptDLCCount;
|
||||||
|
|
@ -468,7 +451,7 @@ bool DLCManager::processDLCDataFile(DWORD &dwFilesProcessed, PBYTE pbData, DWORD
|
||||||
{
|
{
|
||||||
//DLCManager::EDLCParameterType paramType = DLCManager::e_DLCParamType_Invalid;
|
//DLCManager::EDLCParameterType paramType = DLCManager::e_DLCParamType_Invalid;
|
||||||
|
|
||||||
AUTO_VAR(it, parameterMapping.find( pParams->dwType ));
|
auto it = parameterMapping.find(pParams->dwType);
|
||||||
|
|
||||||
if(it != parameterMapping.end() )
|
if(it != parameterMapping.end() )
|
||||||
{
|
{
|
||||||
|
|
@ -658,7 +641,7 @@ DWORD DLCManager::retrievePackID(PBYTE pbData, DWORD dwLength, DLCPack *pack)
|
||||||
pParams = (C4JStorage::DLC_FILE_PARAM *)pbTemp;
|
pParams = (C4JStorage::DLC_FILE_PARAM *)pbTemp;
|
||||||
for(unsigned int j=0;j<uiParameterCount;j++)
|
for(unsigned int j=0;j<uiParameterCount;j++)
|
||||||
{
|
{
|
||||||
AUTO_VAR(it, parameterMapping.find( pParams->dwType ));
|
auto it = parameterMapping.find(pParams->dwType);
|
||||||
|
|
||||||
if(it != parameterMapping.end() )
|
if(it != parameterMapping.end() )
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -54,16 +54,18 @@ DLCPack::DLCPack(const wstring &name,const wstring &productID,DWORD dwLicenseMas
|
||||||
|
|
||||||
DLCPack::~DLCPack()
|
DLCPack::~DLCPack()
|
||||||
{
|
{
|
||||||
for(AUTO_VAR(it, m_childPacks.begin()); it != m_childPacks.end(); ++it)
|
for( auto& it : m_childPacks )
|
||||||
{
|
{
|
||||||
delete *it;
|
if ( it )
|
||||||
|
delete it;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(unsigned int i = 0; i < DLCManager::e_DLCType_Max; ++i)
|
for(unsigned int i = 0; i < DLCManager::e_DLCType_Max; ++i)
|
||||||
{
|
{
|
||||||
for(AUTO_VAR(it,m_files[i].begin()); it != m_files[i].end(); ++it)
|
for (auto& it : m_files[i] )
|
||||||
{
|
{
|
||||||
delete *it;
|
if ( it )
|
||||||
|
delete it;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -161,7 +163,7 @@ void DLCPack::addParameter(DLCManager::EDLCParameterType type, const wstring &va
|
||||||
|
|
||||||
bool DLCPack::getParameterAsUInt(DLCManager::EDLCParameterType type, unsigned int ¶m)
|
bool DLCPack::getParameterAsUInt(DLCManager::EDLCParameterType type, unsigned int ¶m)
|
||||||
{
|
{
|
||||||
AUTO_VAR(it,m_parameters.find((int)type));
|
auto it = m_parameters.find((int)type);
|
||||||
if(it != m_parameters.end())
|
if(it != m_parameters.end())
|
||||||
{
|
{
|
||||||
switch(type)
|
switch(type)
|
||||||
|
|
@ -270,7 +272,7 @@ bool DLCPack::doesPackContainFile(DLCManager::EDLCType type, const wstring &path
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
g_pathCmpString = &path;
|
g_pathCmpString = &path;
|
||||||
AUTO_VAR(it, find_if( m_files[type].begin(), m_files[type].end(), pathCmp ));
|
auto it = find_if(m_files[type].begin(), m_files[type].end(), pathCmp);
|
||||||
hasFile = it != m_files[type].end();
|
hasFile = it != m_files[type].end();
|
||||||
if(!hasFile && m_parentPack )
|
if(!hasFile && m_parentPack )
|
||||||
{
|
{
|
||||||
|
|
@ -316,7 +318,7 @@ DLCFile *DLCPack::getFile(DLCManager::EDLCType type, const wstring &path)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
g_pathCmpString = &path;
|
g_pathCmpString = &path;
|
||||||
AUTO_VAR(it, find_if( m_files[type].begin(), m_files[type].end(), pathCmp ));
|
auto it = find_if(m_files[type].begin(), m_files[type].end(), pathCmp);
|
||||||
|
|
||||||
if(it == m_files[type].end())
|
if(it == m_files[type].end())
|
||||||
{
|
{
|
||||||
|
|
@ -368,9 +370,9 @@ DWORD DLCPack::getFileIndexAt(DLCManager::EDLCType type, const wstring &path, bo
|
||||||
DWORD foundIndex = 0;
|
DWORD foundIndex = 0;
|
||||||
found = false;
|
found = false;
|
||||||
DWORD index = 0;
|
DWORD index = 0;
|
||||||
for(AUTO_VAR(it, m_files[type].begin()); it != m_files[type].end(); ++it)
|
for( auto& it : m_files[type] )
|
||||||
{
|
{
|
||||||
if(path.compare((*it)->getPath()) == 0)
|
if(path.compare(it->getPath()) == 0)
|
||||||
{
|
{
|
||||||
foundIndex = index;
|
foundIndex = index;
|
||||||
found = true;
|
found = true;
|
||||||
|
|
|
||||||
|
|
@ -14,10 +14,10 @@ void AddEnchantmentRuleDefinition::writeAttributes(DataOutputStream *dos, UINT n
|
||||||
GameRuleDefinition::writeAttributes(dos, numAttributes + 2);
|
GameRuleDefinition::writeAttributes(dos, numAttributes + 2);
|
||||||
|
|
||||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_enchantmentId);
|
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_enchantmentId);
|
||||||
dos->writeUTF( _toString( m_enchantmentId ) );
|
dos->writeUTF( std::to_wstring( m_enchantmentId ) );
|
||||||
|
|
||||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_enchantmentLevel);
|
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_enchantmentLevel);
|
||||||
dos->writeUTF( _toString( m_enchantmentLevel ) );
|
dos->writeUTF( std::to_wstring( m_enchantmentLevel ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddEnchantmentRuleDefinition::addAttribute(const wstring &attributeName, const wstring &attributeValue)
|
void AddEnchantmentRuleDefinition::addAttribute(const wstring &attributeName, const wstring &attributeValue)
|
||||||
|
|
@ -50,7 +50,7 @@ bool AddEnchantmentRuleDefinition::enchantItem(shared_ptr<ItemInstance> item)
|
||||||
{
|
{
|
||||||
// 4J-JEV: Ripped code from enchantmenthelpers
|
// 4J-JEV: Ripped code from enchantmenthelpers
|
||||||
// Maybe we want to add an addEnchantment method to EnchantmentHelpers
|
// Maybe we want to add an addEnchantment method to EnchantmentHelpers
|
||||||
if (item->id == Item::enchantedBook_Id)
|
if (item->id == Item::enchantedBook_Id)
|
||||||
{
|
{
|
||||||
Item::enchantedBook->addEnchantment( item, new EnchantmentInstance(m_enchantmentId, m_enchantmentLevel) );
|
Item::enchantedBook->addEnchantment( item, new EnchantmentInstance(m_enchantmentId, m_enchantmentLevel) );
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,26 +17,26 @@ void AddItemRuleDefinition::writeAttributes(DataOutputStream *dos, UINT numAttrs
|
||||||
GameRuleDefinition::writeAttributes(dos, numAttrs + 5);
|
GameRuleDefinition::writeAttributes(dos, numAttrs + 5);
|
||||||
|
|
||||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_itemId);
|
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_itemId);
|
||||||
dos->writeUTF( _toString( m_itemId ) );
|
dos->writeUTF( std::to_wstring( m_itemId ) );
|
||||||
|
|
||||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_quantity);
|
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_quantity);
|
||||||
dos->writeUTF( _toString( m_quantity ) );
|
dos->writeUTF( std::to_wstring( m_quantity ) );
|
||||||
|
|
||||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_auxValue);
|
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_auxValue);
|
||||||
dos->writeUTF( _toString( m_auxValue ) );
|
dos->writeUTF( std::to_wstring( m_auxValue ) );
|
||||||
|
|
||||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_dataTag);
|
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_dataTag);
|
||||||
dos->writeUTF( _toString( m_dataTag ) );
|
dos->writeUTF( std::to_wstring( m_dataTag ) );
|
||||||
|
|
||||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_slot);
|
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_slot);
|
||||||
dos->writeUTF( _toString( m_slot ) );
|
dos->writeUTF( std::to_wstring( m_slot ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddItemRuleDefinition::getChildren(vector<GameRuleDefinition *> *children)
|
void AddItemRuleDefinition::getChildren(vector<GameRuleDefinition *> *children)
|
||||||
{
|
{
|
||||||
GameRuleDefinition::getChildren( children );
|
GameRuleDefinition::getChildren( children );
|
||||||
for (AUTO_VAR(it, m_enchantments.begin()); it != m_enchantments.end(); it++)
|
for ( const auto& it : m_enchantments )
|
||||||
children->push_back( *it );
|
children->push_back( it );
|
||||||
}
|
}
|
||||||
|
|
||||||
GameRuleDefinition *AddItemRuleDefinition::addChild(ConsoleGameRules::EGameRuleType ruleType)
|
GameRuleDefinition *AddItemRuleDefinition::addChild(ConsoleGameRules::EGameRuleType ruleType)
|
||||||
|
|
@ -99,13 +99,13 @@ bool AddItemRuleDefinition::addItemToContainer(shared_ptr<Container> container,
|
||||||
bool added = false;
|
bool added = false;
|
||||||
if(Item::items[m_itemId] != NULL)
|
if(Item::items[m_itemId] != NULL)
|
||||||
{
|
{
|
||||||
int quantity = min(m_quantity, Item::items[m_itemId]->getMaxStackSize());
|
int quantity = std::min<int>(m_quantity, Item::items[m_itemId]->getMaxStackSize());
|
||||||
shared_ptr<ItemInstance> newItem = shared_ptr<ItemInstance>(new ItemInstance(m_itemId,quantity,m_auxValue) );
|
shared_ptr<ItemInstance> newItem = shared_ptr<ItemInstance>(new ItemInstance(m_itemId,quantity,m_auxValue) );
|
||||||
newItem->set4JData(m_dataTag);
|
newItem->set4JData(m_dataTag);
|
||||||
|
|
||||||
for(AUTO_VAR(it, m_enchantments.begin()); it != m_enchantments.end(); ++it)
|
for( auto& it : m_enchantments )
|
||||||
{
|
{
|
||||||
(*it)->enchantItem(newItem);
|
it->enchantItem(newItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(m_slot >= 0 && m_slot < container->getContainerSize() )
|
if(m_slot >= 0 && m_slot < container->getContainerSize() )
|
||||||
|
|
|
||||||
|
|
@ -37,19 +37,19 @@ void ApplySchematicRuleDefinition::writeAttributes(DataOutputStream *dos, UINT n
|
||||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_filename);
|
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_filename);
|
||||||
dos->writeUTF(m_schematicName);
|
dos->writeUTF(m_schematicName);
|
||||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_x);
|
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_x);
|
||||||
dos->writeUTF(_toString(m_location->x));
|
dos->writeUTF(std::to_wstring(m_location->x));
|
||||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_y);
|
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_y);
|
||||||
dos->writeUTF(_toString(m_location->y));
|
dos->writeUTF(std::to_wstring(m_location->y));
|
||||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_z);
|
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_z);
|
||||||
dos->writeUTF(_toString(m_location->z));
|
dos->writeUTF(std::to_wstring(m_location->z));
|
||||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_rot);
|
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_rot);
|
||||||
|
|
||||||
switch (m_rotation)
|
switch (m_rotation)
|
||||||
{
|
{
|
||||||
case ConsoleSchematicFile::eSchematicRot_0: dos->writeUTF(_toString( 0 )); break;
|
case ConsoleSchematicFile::eSchematicRot_0: dos->writeUTF(L"0"); break;
|
||||||
case ConsoleSchematicFile::eSchematicRot_90: dos->writeUTF(_toString( 90 )); break;
|
case ConsoleSchematicFile::eSchematicRot_90: dos->writeUTF(L"90"); break;
|
||||||
case ConsoleSchematicFile::eSchematicRot_180: dos->writeUTF(_toString( 180 )); break;
|
case ConsoleSchematicFile::eSchematicRot_180: dos->writeUTF(L"180"); break;
|
||||||
case ConsoleSchematicFile::eSchematicRot_270: dos->writeUTF(_toString( 270 )); break;
|
case ConsoleSchematicFile::eSchematicRot_270: dos->writeUTF(L"270"); break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -113,7 +113,7 @@ void ApplySchematicRuleDefinition::addAttribute(const wstring &attributeName, co
|
||||||
m_rotation = ConsoleSchematicFile::eSchematicRot_0;
|
m_rotation = ConsoleSchematicFile::eSchematicRot_0;
|
||||||
break;
|
break;
|
||||||
};
|
};
|
||||||
|
|
||||||
//app.DebugPrintf("ApplySchematicRuleDefinition: Adding parameter rot=%d\n",m_rotation);
|
//app.DebugPrintf("ApplySchematicRuleDefinition: Adding parameter rot=%d\n",m_rotation);
|
||||||
}
|
}
|
||||||
else if(attributeName.compare(L"dim") == 0)
|
else if(attributeName.compare(L"dim") == 0)
|
||||||
|
|
@ -160,7 +160,7 @@ void ApplySchematicRuleDefinition::processSchematic(AABB *chunkBox, LevelChunk *
|
||||||
{
|
{
|
||||||
if( m_completed ) return;
|
if( m_completed ) return;
|
||||||
if(chunk->level->dimension->id != m_dimension) return;
|
if(chunk->level->dimension->id != m_dimension) return;
|
||||||
|
|
||||||
PIXBeginNamedEvent(0, "Processing ApplySchematicRuleDefinition");
|
PIXBeginNamedEvent(0, "Processing ApplySchematicRuleDefinition");
|
||||||
if(m_schematic == NULL) m_schematic = m_levelGenOptions->getSchematicFile(m_schematicName);
|
if(m_schematic == NULL) m_schematic = m_levelGenOptions->getSchematicFile(m_schematicName);
|
||||||
|
|
||||||
|
|
@ -199,7 +199,7 @@ void ApplySchematicRuleDefinition::processSchematicLighting(AABB *chunkBox, Leve
|
||||||
{
|
{
|
||||||
if( m_completed ) return;
|
if( m_completed ) return;
|
||||||
if(chunk->level->dimension->id != m_dimension) return;
|
if(chunk->level->dimension->id != m_dimension) return;
|
||||||
|
|
||||||
PIXBeginNamedEvent(0, "Processing ApplySchematicRuleDefinition (lighting)");
|
PIXBeginNamedEvent(0, "Processing ApplySchematicRuleDefinition (lighting)");
|
||||||
if(m_schematic == NULL) m_schematic = m_levelGenOptions->getSchematicFile(m_schematicName);
|
if(m_schematic == NULL) m_schematic = m_levelGenOptions->getSchematicFile(m_schematicName);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,11 +14,11 @@ void BiomeOverride::writeAttributes(DataOutputStream *dos, UINT numAttrs)
|
||||||
GameRuleDefinition::writeAttributes(dos, numAttrs + 3);
|
GameRuleDefinition::writeAttributes(dos, numAttrs + 3);
|
||||||
|
|
||||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_biomeId);
|
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_biomeId);
|
||||||
dos->writeUTF(_toString(m_biomeId));
|
dos->writeUTF(std::to_wstring(m_biomeId));
|
||||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_tileId);
|
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_tileId);
|
||||||
dos->writeUTF(_toString(m_tile));
|
dos->writeUTF(std::to_wstring(m_tile));
|
||||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_topTileId);
|
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_topTileId);
|
||||||
dos->writeUTF(_toString(m_topTile));
|
dos->writeUTF(std::to_wstring(m_topTile));
|
||||||
}
|
}
|
||||||
|
|
||||||
void BiomeOverride::addAttribute(const wstring &attributeName, const wstring &attributeValue)
|
void BiomeOverride::addAttribute(const wstring &attributeName, const wstring &attributeValue)
|
||||||
|
|
|
||||||
|
|
@ -22,13 +22,13 @@ void CollectItemRuleDefinition::writeAttributes(DataOutputStream *dos, UINT numA
|
||||||
GameRuleDefinition::writeAttributes(dos, numAttributes + 3);
|
GameRuleDefinition::writeAttributes(dos, numAttributes + 3);
|
||||||
|
|
||||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_itemId);
|
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_itemId);
|
||||||
dos->writeUTF( _toString( m_itemId ) );
|
dos->writeUTF( std::to_wstring( m_itemId ) );
|
||||||
|
|
||||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_auxValue);
|
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_auxValue);
|
||||||
dos->writeUTF( _toString( m_auxValue ) );
|
dos->writeUTF( std::to_wstring( m_auxValue ) );
|
||||||
|
|
||||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_quantity);
|
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_quantity);
|
||||||
dos->writeUTF( _toString( m_quantity ) );
|
dos->writeUTF( std::to_wstring( m_quantity ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void CollectItemRuleDefinition::addAttribute(const wstring &attributeName, const wstring &attributeValue)
|
void CollectItemRuleDefinition::addAttribute(const wstring &attributeName, const wstring &attributeValue)
|
||||||
|
|
@ -108,9 +108,9 @@ wstring CollectItemRuleDefinition::generateXml(shared_ptr<ItemInstance> item)
|
||||||
wstring xml = L"";
|
wstring xml = L"";
|
||||||
if(item != NULL)
|
if(item != NULL)
|
||||||
{
|
{
|
||||||
xml = L"<CollectItemRule itemId=\"" + _toString<int>(item->id) + L"\" quantity=\"SET\" descriptionName=\"OPTIONAL\" promptName=\"OPTIONAL\"";
|
xml = L"<CollectItemRule itemId=\"" + std::to_wstring(item->id) + L"\" quantity=\"SET\" descriptionName=\"OPTIONAL\" promptName=\"OPTIONAL\"";
|
||||||
if(item->getAuxValue() != 0) xml += L" auxValue=\"" + _toString<int>(item->getAuxValue()) + L"\"";
|
if(item->getAuxValue() != 0) xml += L" auxValue=\"" + std::to_wstring(item->getAuxValue()) + L"\"";
|
||||||
if(item->get4JData() != 0) xml += L" dataTag=\"" + _toString<int>(item->get4JData()) + L"\"";
|
if(item->get4JData() != 0) xml += L" dataTag=\"" + std::to_wstring(item->get4JData()) + L"\"";
|
||||||
xml += L"/>\n";
|
xml += L"/>\n";
|
||||||
}
|
}
|
||||||
return xml;
|
return xml;
|
||||||
|
|
|
||||||
|
|
@ -28,12 +28,12 @@ void CompleteAllRuleDefinition::updateStatus(GameRule *rule)
|
||||||
{
|
{
|
||||||
int goal = 0;
|
int goal = 0;
|
||||||
int progress = 0;
|
int progress = 0;
|
||||||
for(AUTO_VAR(it, rule->m_parameters.begin()); it != rule->m_parameters.end(); ++it)
|
for (auto& it : rule->m_parameters )
|
||||||
{
|
{
|
||||||
if(it->second.isPointer)
|
if(it.second.isPointer)
|
||||||
{
|
{
|
||||||
goal += it->second.gr->getGameRuleDefinition()->getGoal();
|
goal += it.second.gr->getGameRuleDefinition()->getGoal();
|
||||||
progress += it->second.gr->getGameRuleDefinition()->getProgress(it->second.gr);
|
progress += it.second.gr->getGameRuleDefinition()->getProgress(it.second.gr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(rule->getConnection() != NULL)
|
if(rule->getConnection() != NULL)
|
||||||
|
|
@ -44,9 +44,9 @@ void CompleteAllRuleDefinition::updateStatus(GameRule *rule)
|
||||||
|
|
||||||
int icon = -1;
|
int icon = -1;
|
||||||
int auxValue = 0;
|
int auxValue = 0;
|
||||||
|
|
||||||
if(m_lastRuleStatusChanged != NULL)
|
if(m_lastRuleStatusChanged != NULL)
|
||||||
{
|
{
|
||||||
icon = m_lastRuleStatusChanged->getIcon();
|
icon = m_lastRuleStatusChanged->getIcon();
|
||||||
auxValue = m_lastRuleStatusChanged->getAuxValue();
|
auxValue = m_lastRuleStatusChanged->getAuxValue();
|
||||||
m_lastRuleStatusChanged = NULL;
|
m_lastRuleStatusChanged = NULL;
|
||||||
|
|
@ -60,7 +60,7 @@ wstring CompleteAllRuleDefinition::generateDescriptionString(const wstring &desc
|
||||||
{
|
{
|
||||||
PacketData *values = (PacketData *)data;
|
PacketData *values = (PacketData *)data;
|
||||||
wstring newDesc = description;
|
wstring newDesc = description;
|
||||||
newDesc = replaceAll(newDesc,L"{*progress*}",_toString<int>(values->progress));
|
newDesc = replaceAll(newDesc,L"{*progress*}",std::to_wstring(values->progress));
|
||||||
newDesc = replaceAll(newDesc,L"{*goal*}",_toString<int>(values->goal));
|
newDesc = replaceAll(newDesc,L"{*goal*}",std::to_wstring(values->goal));
|
||||||
return newDesc;
|
return newDesc;
|
||||||
}
|
}
|
||||||
|
|
@ -11,17 +11,17 @@ CompoundGameRuleDefinition::CompoundGameRuleDefinition()
|
||||||
|
|
||||||
CompoundGameRuleDefinition::~CompoundGameRuleDefinition()
|
CompoundGameRuleDefinition::~CompoundGameRuleDefinition()
|
||||||
{
|
{
|
||||||
for(AUTO_VAR(it, m_children.begin()); it != m_children.end(); ++it)
|
for (auto it : m_children )
|
||||||
{
|
{
|
||||||
delete (*it);
|
delete it;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CompoundGameRuleDefinition::getChildren(vector<GameRuleDefinition *> *children)
|
void CompoundGameRuleDefinition::getChildren(vector<GameRuleDefinition *> *children)
|
||||||
{
|
{
|
||||||
GameRuleDefinition::getChildren(children);
|
GameRuleDefinition::getChildren(children);
|
||||||
for (AUTO_VAR(it, m_children.begin()); it != m_children.end(); it++)
|
for (auto& it : m_children )
|
||||||
children->push_back(*it);
|
children->push_back(it);
|
||||||
}
|
}
|
||||||
|
|
||||||
GameRuleDefinition *CompoundGameRuleDefinition::addChild(ConsoleGameRules::EGameRuleType ruleType)
|
GameRuleDefinition *CompoundGameRuleDefinition::addChild(ConsoleGameRules::EGameRuleType ruleType)
|
||||||
|
|
@ -40,7 +40,7 @@ GameRuleDefinition *CompoundGameRuleDefinition::addChild(ConsoleGameRules::EGame
|
||||||
rule = new UseTileRuleDefinition();
|
rule = new UseTileRuleDefinition();
|
||||||
}
|
}
|
||||||
else if(ruleType == ConsoleGameRules::eGameRuleType_UpdatePlayerRule)
|
else if(ruleType == ConsoleGameRules::eGameRuleType_UpdatePlayerRule)
|
||||||
{
|
{
|
||||||
rule = new UpdatePlayerRuleDefinition();
|
rule = new UpdatePlayerRuleDefinition();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -57,17 +57,17 @@ void CompoundGameRuleDefinition::populateGameRule(GameRulesInstance::EGameRulesI
|
||||||
{
|
{
|
||||||
GameRule *newRule = NULL;
|
GameRule *newRule = NULL;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for(AUTO_VAR(it, m_children.begin()); it != m_children.end(); ++it)
|
for (auto& it : m_children )
|
||||||
{
|
{
|
||||||
newRule = new GameRule(*it, rule->getConnection() );
|
newRule = new GameRule(it, rule->getConnection() );
|
||||||
(*it)->populateGameRule(type,newRule);
|
it->populateGameRule(type,newRule);
|
||||||
|
|
||||||
GameRule::ValueType value;
|
GameRule::ValueType value;
|
||||||
value.gr = newRule;
|
value.gr = newRule;
|
||||||
value.isPointer = true;
|
value.isPointer = true;
|
||||||
|
|
||||||
// Somehow add the newRule to the current rule
|
// Somehow add the newRule to the current rule
|
||||||
rule->setParameter(L"rule" + _toString<int>(i),value);
|
rule->setParameter(L"rule" + std::to_wstring(i),value);
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
GameRuleDefinition::populateGameRule(type, rule);
|
GameRuleDefinition::populateGameRule(type, rule);
|
||||||
|
|
@ -76,14 +76,14 @@ void CompoundGameRuleDefinition::populateGameRule(GameRulesInstance::EGameRulesI
|
||||||
bool CompoundGameRuleDefinition::onUseTile(GameRule *rule, int tileId, int x, int y, int z)
|
bool CompoundGameRuleDefinition::onUseTile(GameRule *rule, int tileId, int x, int y, int z)
|
||||||
{
|
{
|
||||||
bool statusChanged = false;
|
bool statusChanged = false;
|
||||||
for(AUTO_VAR(it, rule->m_parameters.begin()); it != rule->m_parameters.end(); ++it)
|
for (auto& it : rule->m_parameters )
|
||||||
{
|
{
|
||||||
if(it->second.isPointer)
|
if(it.second.isPointer)
|
||||||
{
|
{
|
||||||
bool changed = it->second.gr->getGameRuleDefinition()->onUseTile(it->second.gr,tileId,x,y,z);
|
bool changed = it.second.gr->getGameRuleDefinition()->onUseTile(it.second.gr,tileId,x,y,z);
|
||||||
if(!statusChanged && changed)
|
if(!statusChanged && changed)
|
||||||
{
|
{
|
||||||
m_lastRuleStatusChanged = it->second.gr->getGameRuleDefinition();
|
m_lastRuleStatusChanged = it.second.gr->getGameRuleDefinition();
|
||||||
statusChanged = true;
|
statusChanged = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -94,14 +94,14 @@ bool CompoundGameRuleDefinition::onUseTile(GameRule *rule, int tileId, int x, in
|
||||||
bool CompoundGameRuleDefinition::onCollectItem(GameRule *rule, shared_ptr<ItemInstance> item)
|
bool CompoundGameRuleDefinition::onCollectItem(GameRule *rule, shared_ptr<ItemInstance> item)
|
||||||
{
|
{
|
||||||
bool statusChanged = false;
|
bool statusChanged = false;
|
||||||
for(AUTO_VAR(it, rule->m_parameters.begin()); it != rule->m_parameters.end(); ++it)
|
for (auto& it : rule->m_parameters )
|
||||||
{
|
{
|
||||||
if(it->second.isPointer)
|
if(it.second.isPointer)
|
||||||
{
|
{
|
||||||
bool changed = it->second.gr->getGameRuleDefinition()->onCollectItem(it->second.gr,item);
|
bool changed = it.second.gr->getGameRuleDefinition()->onCollectItem(it.second.gr,item);
|
||||||
if(!statusChanged && changed)
|
if(!statusChanged && changed)
|
||||||
{
|
{
|
||||||
m_lastRuleStatusChanged = it->second.gr->getGameRuleDefinition();
|
m_lastRuleStatusChanged = it.second.gr->getGameRuleDefinition();
|
||||||
statusChanged = true;
|
statusChanged = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -111,8 +111,8 @@ bool CompoundGameRuleDefinition::onCollectItem(GameRule *rule, shared_ptr<ItemIn
|
||||||
|
|
||||||
void CompoundGameRuleDefinition::postProcessPlayer(shared_ptr<Player> player)
|
void CompoundGameRuleDefinition::postProcessPlayer(shared_ptr<Player> player)
|
||||||
{
|
{
|
||||||
for(AUTO_VAR(it, m_children.begin()); it != m_children.end(); ++it)
|
for (auto it : m_children )
|
||||||
{
|
{
|
||||||
(*it)->postProcessPlayer(player);
|
it->postProcessPlayer(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -17,10 +17,10 @@ ConsoleGenerateStructure::ConsoleGenerateStructure() : StructurePiece(0)
|
||||||
|
|
||||||
void ConsoleGenerateStructure::getChildren(vector<GameRuleDefinition *> *children)
|
void ConsoleGenerateStructure::getChildren(vector<GameRuleDefinition *> *children)
|
||||||
{
|
{
|
||||||
GameRuleDefinition::getChildren(children);
|
GameRuleDefinition::getChildren(children);
|
||||||
|
|
||||||
for(AUTO_VAR(it, m_actions.begin()); it != m_actions.end(); it++)
|
for ( auto& action : m_actions )
|
||||||
children->push_back( *it );
|
children->push_back( action );
|
||||||
}
|
}
|
||||||
|
|
||||||
GameRuleDefinition *ConsoleGenerateStructure::addChild(ConsoleGameRules::EGameRuleType ruleType)
|
GameRuleDefinition *ConsoleGenerateStructure::addChild(ConsoleGameRules::EGameRuleType ruleType)
|
||||||
|
|
@ -60,16 +60,16 @@ void ConsoleGenerateStructure::writeAttributes(DataOutputStream *dos, UINT numAt
|
||||||
GameRuleDefinition::writeAttributes(dos, numAttrs + 5);
|
GameRuleDefinition::writeAttributes(dos, numAttrs + 5);
|
||||||
|
|
||||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_x);
|
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_x);
|
||||||
dos->writeUTF(_toString(m_x));
|
dos->writeUTF(std::to_wstring(m_x));
|
||||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_y);
|
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_y);
|
||||||
dos->writeUTF(_toString(m_y));
|
dos->writeUTF(std::to_wstring(m_y));
|
||||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_z);
|
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_z);
|
||||||
dos->writeUTF(_toString(m_z));
|
dos->writeUTF(std::to_wstring(m_z));
|
||||||
|
|
||||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_orientation);
|
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_orientation);
|
||||||
dos->writeUTF(_toString(orientation));
|
dos->writeUTF(std::to_wstring(orientation));
|
||||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_dimension);
|
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_dimension);
|
||||||
dos->writeUTF(_toString(m_dimension));
|
dos->writeUTF(std::to_wstring(m_dimension));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConsoleGenerateStructure::addAttribute(const wstring &attributeName, const wstring &attributeValue)
|
void ConsoleGenerateStructure::addAttribute(const wstring &attributeName, const wstring &attributeValue)
|
||||||
|
|
@ -117,27 +117,24 @@ BoundingBox* ConsoleGenerateStructure::getBoundingBox()
|
||||||
// Find the max bounds
|
// Find the max bounds
|
||||||
int maxX, maxY, maxZ;
|
int maxX, maxY, maxZ;
|
||||||
maxX = maxY = maxZ = 1;
|
maxX = maxY = maxZ = 1;
|
||||||
for(AUTO_VAR(it, m_actions.begin()); it != m_actions.end(); ++it)
|
for( ConsoleGenerateStructureAction *action : m_actions )
|
||||||
{
|
{
|
||||||
ConsoleGenerateStructureAction *action = *it;
|
maxX = std::max<int>(maxX,action->getEndX());
|
||||||
maxX = max(maxX,action->getEndX());
|
maxY = std::max<int>(maxY,action->getEndY());
|
||||||
maxY = max(maxY,action->getEndY());
|
maxZ = std::max<int>(maxZ,action->getEndZ());
|
||||||
maxZ = max(maxZ,action->getEndZ());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
boundingBox = new BoundingBox(m_x, m_y, m_z, m_x + maxX, m_y + maxY, m_z + maxZ);
|
boundingBox = new BoundingBox(m_x, m_y, m_z, m_x + maxX, m_y + maxY, m_z + maxZ);
|
||||||
}
|
}
|
||||||
return boundingBox;
|
return boundingBox;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ConsoleGenerateStructure::postProcess(Level *level, Random *random, BoundingBox *chunkBB)
|
bool ConsoleGenerateStructure::postProcess(Level *level, Random *random, BoundingBox *chunkBB)
|
||||||
{
|
{
|
||||||
if(level->dimension->id != m_dimension) return false;
|
if(level->dimension->id != m_dimension) return false;
|
||||||
|
|
||||||
for(AUTO_VAR(it, m_actions.begin()); it != m_actions.end(); ++it)
|
for( ConsoleGenerateStructureAction *action : m_actions )
|
||||||
{
|
{
|
||||||
ConsoleGenerateStructureAction *action = *it;
|
|
||||||
|
|
||||||
switch(action->getActionType())
|
switch(action->getActionType())
|
||||||
{
|
{
|
||||||
case ConsoleGameRules::eGameRuleType_GenerateBox:
|
case ConsoleGameRules::eGameRuleType_GenerateBox:
|
||||||
|
|
|
||||||
|
|
@ -167,18 +167,18 @@ void ConsoleSchematicFile::save_tags(DataOutputStream *dos)
|
||||||
ListTag<CompoundTag> *tileEntityTags = new ListTag<CompoundTag>();
|
ListTag<CompoundTag> *tileEntityTags = new ListTag<CompoundTag>();
|
||||||
tag->put(L"TileEntities", tileEntityTags);
|
tag->put(L"TileEntities", tileEntityTags);
|
||||||
|
|
||||||
for (AUTO_VAR(it, m_tileEntities.begin()); it != m_tileEntities.end(); it++)
|
for ( auto& it : m_tileEntities )
|
||||||
{
|
{
|
||||||
CompoundTag *cTag = new CompoundTag();
|
CompoundTag *cTag = new CompoundTag();
|
||||||
(*it)->save(cTag);
|
it->save(cTag);
|
||||||
tileEntityTags->add(cTag);
|
tileEntityTags->add(cTag);
|
||||||
}
|
}
|
||||||
|
|
||||||
ListTag<CompoundTag> *entityTags = new ListTag<CompoundTag>();
|
ListTag<CompoundTag> *entityTags = new ListTag<CompoundTag>();
|
||||||
tag->put(L"Entities", entityTags);
|
tag->put(L"Entities", entityTags);
|
||||||
|
|
||||||
for (AUTO_VAR(it, m_entities.begin()); it != m_entities.end(); it++)
|
for (auto& it : m_entities )
|
||||||
entityTags->add( (CompoundTag *)(*it).second->copy() );
|
entityTags->add( (CompoundTag *)(it).second->copy() );
|
||||||
|
|
||||||
NbtIo::write(tag,dos);
|
NbtIo::write(tag,dos);
|
||||||
delete tag;
|
delete tag;
|
||||||
|
|
@ -186,15 +186,15 @@ void ConsoleSchematicFile::save_tags(DataOutputStream *dos)
|
||||||
|
|
||||||
__int64 ConsoleSchematicFile::applyBlocksAndData(LevelChunk *chunk, AABB *chunkBox, AABB *destinationBox, ESchematicRotation rot)
|
__int64 ConsoleSchematicFile::applyBlocksAndData(LevelChunk *chunk, AABB *chunkBox, AABB *destinationBox, ESchematicRotation rot)
|
||||||
{
|
{
|
||||||
int xStart = max(destinationBox->x0, (double)chunk->x*16);
|
int xStart = static_cast<int>(std::fmax<double>(destinationBox->x0, (double)chunk->x*16));
|
||||||
int xEnd = min(destinationBox->x1, (double)((xStart>>4)<<4) + 16);
|
int xEnd = static_cast<int>(std::fmin<double>(destinationBox->x1, (double)((xStart >> 4) << 4) + 16));
|
||||||
|
|
||||||
int yStart = destinationBox->y0;
|
int yStart = destinationBox->y0;
|
||||||
int yEnd = destinationBox->y1;
|
int yEnd = destinationBox->y1;
|
||||||
if(yEnd > Level::maxBuildHeight) yEnd = Level::maxBuildHeight;
|
if(yEnd > Level::maxBuildHeight) yEnd = Level::maxBuildHeight;
|
||||||
|
|
||||||
int zStart = max(destinationBox->z0, (double)chunk->z*16);
|
int zStart = static_cast<int>(std::fmax<double>(destinationBox->z0, (double)chunk->z * 16));
|
||||||
int zEnd = min(destinationBox->z1, (double)((zStart>>4)<<4) + 16);
|
int zEnd = static_cast<int>(std::fmin<double>(destinationBox->z1, (double)((zStart >> 4) << 4) + 16));
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
app.DebugPrintf("Range is (%d,%d,%d) to (%d,%d,%d)\n",xStart,yStart,zStart,xEnd-1,yEnd-1,zEnd-1);
|
app.DebugPrintf("Range is (%d,%d,%d) to (%d,%d,%d)\n",xStart,yStart,zStart,xEnd-1,yEnd-1,zEnd-1);
|
||||||
|
|
@ -431,10 +431,8 @@ void ConsoleSchematicFile::schematicCoordToChunkCoord(AABB *destinationBox, doub
|
||||||
|
|
||||||
void ConsoleSchematicFile::applyTileEntities(LevelChunk *chunk, AABB *chunkBox, AABB *destinationBox, ESchematicRotation rot)
|
void ConsoleSchematicFile::applyTileEntities(LevelChunk *chunk, AABB *chunkBox, AABB *destinationBox, ESchematicRotation rot)
|
||||||
{
|
{
|
||||||
for(AUTO_VAR(it, m_tileEntities.begin()); it != m_tileEntities.end();++it)
|
for (auto& te : m_tileEntities )
|
||||||
{
|
{
|
||||||
shared_ptr<TileEntity> te = *it;
|
|
||||||
|
|
||||||
double targetX = te->x;
|
double targetX = te->x;
|
||||||
double targetY = te->y + destinationBox->y0;
|
double targetY = te->y + destinationBox->y0;
|
||||||
double targetZ = te->z;
|
double targetZ = te->z;
|
||||||
|
|
@ -477,7 +475,7 @@ void ConsoleSchematicFile::applyTileEntities(LevelChunk *chunk, AABB *chunkBox,
|
||||||
teCopy->setChanged();
|
teCopy->setChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for(AUTO_VAR(it, m_entities.begin()); it != m_entities.end();)
|
for (auto it = m_entities.begin(); it != m_entities.end();)
|
||||||
{
|
{
|
||||||
Vec3 *source = it->first;
|
Vec3 *source = it->first;
|
||||||
|
|
||||||
|
|
@ -679,9 +677,8 @@ void ConsoleSchematicFile::generateSchematicFile(DataOutputStream *dos, Level *l
|
||||||
for (int zc = zc0; zc <= zc1; zc++)
|
for (int zc = zc0; zc <= zc1; zc++)
|
||||||
{
|
{
|
||||||
vector<shared_ptr<TileEntity> > *tileEntities = getTileEntitiesInRegion(level->getChunk(xc, zc), xStart, yStart, zStart, xStart + xSize, yStart + ySize, zStart + zSize);
|
vector<shared_ptr<TileEntity> > *tileEntities = getTileEntitiesInRegion(level->getChunk(xc, zc), xStart, yStart, zStart, xStart + xSize, yStart + ySize, zStart + zSize);
|
||||||
for(AUTO_VAR(it, tileEntities->begin()); it != tileEntities->end(); ++it)
|
for( auto& te : *tileEntities )
|
||||||
{
|
{
|
||||||
shared_ptr<TileEntity> te = *it;
|
|
||||||
CompoundTag *teTag = new CompoundTag();
|
CompoundTag *teTag = new CompoundTag();
|
||||||
shared_ptr<TileEntity> teCopy = te->clone();
|
shared_ptr<TileEntity> teCopy = te->clone();
|
||||||
|
|
||||||
|
|
@ -701,10 +698,8 @@ void ConsoleSchematicFile::generateSchematicFile(DataOutputStream *dos, Level *l
|
||||||
vector<shared_ptr<Entity> > *entities = level->getEntities(nullptr, bb);
|
vector<shared_ptr<Entity> > *entities = level->getEntities(nullptr, bb);
|
||||||
ListTag<CompoundTag> *entitiesTag = new ListTag<CompoundTag>(L"entities");
|
ListTag<CompoundTag> *entitiesTag = new ListTag<CompoundTag>(L"entities");
|
||||||
|
|
||||||
for(AUTO_VAR(it, entities->begin()); it != entities->end(); ++it)
|
for (auto& e : *entities )
|
||||||
{
|
{
|
||||||
shared_ptr<Entity> e = *it;
|
|
||||||
|
|
||||||
bool mobCanBeSaved = false;
|
bool mobCanBeSaved = false;
|
||||||
if (bSaveMobs)
|
if (bSaveMobs)
|
||||||
{
|
{
|
||||||
|
|
@ -1012,12 +1007,15 @@ void ConsoleSchematicFile::setBlocksAndData(LevelChunk *chunk, byteArray blockDa
|
||||||
vector<shared_ptr<TileEntity> > *ConsoleSchematicFile::getTileEntitiesInRegion(LevelChunk *chunk, int x0, int y0, int z0, int x1, int y1, int z1)
|
vector<shared_ptr<TileEntity> > *ConsoleSchematicFile::getTileEntitiesInRegion(LevelChunk *chunk, int x0, int y0, int z0, int x1, int y1, int z1)
|
||||||
{
|
{
|
||||||
vector<shared_ptr<TileEntity> > *result = new vector<shared_ptr<TileEntity> >;
|
vector<shared_ptr<TileEntity> > *result = new vector<shared_ptr<TileEntity> >;
|
||||||
for (AUTO_VAR(it, chunk->tileEntities.begin()); it != chunk->tileEntities.end(); ++it)
|
if ( result )
|
||||||
{
|
{
|
||||||
shared_ptr<TileEntity> te = it->second;
|
for ( auto& it : chunk->tileEntities )
|
||||||
if (te->x >= x0 && te->y >= y0 && te->z >= z0 && te->x < x1 && te->y < y1 && te->z < z1)
|
|
||||||
{
|
{
|
||||||
result->push_back(te);
|
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)
|
||||||
|
{
|
||||||
|
result->push_back(te);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
|
|
||||||
|
|
@ -9,11 +9,11 @@ GameRule::GameRule(GameRuleDefinition *definition, Connection *connection)
|
||||||
|
|
||||||
GameRule::~GameRule()
|
GameRule::~GameRule()
|
||||||
{
|
{
|
||||||
for(AUTO_VAR(it, m_parameters.begin()); it != m_parameters.end(); ++it)
|
for(auto& it : m_parameters )
|
||||||
{
|
{
|
||||||
if(it->second.isPointer)
|
if(it.second.isPointer)
|
||||||
{
|
{
|
||||||
delete it->second.gr;
|
delete it.second.gr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -59,12 +59,12 @@ void GameRule::write(DataOutputStream *dos)
|
||||||
{
|
{
|
||||||
// Find required parameters.
|
// Find required parameters.
|
||||||
dos->writeInt(m_parameters.size());
|
dos->writeInt(m_parameters.size());
|
||||||
for (AUTO_VAR(it, m_parameters.begin()); it != m_parameters.end(); it++)
|
for ( const auto& parameter : m_parameters )
|
||||||
{
|
{
|
||||||
wstring pName = (*it).first;
|
wstring pName = parameter.first;
|
||||||
ValueType vType = (*it).second;
|
ValueType vType = parameter.second;
|
||||||
|
|
||||||
dos->writeUTF( (*it).first );
|
dos->writeUTF( parameter.first );
|
||||||
dos->writeBoolean( vType.isPointer );
|
dos->writeBoolean( vType.isPointer );
|
||||||
|
|
||||||
if (vType.isPointer)
|
if (vType.isPointer)
|
||||||
|
|
@ -80,7 +80,7 @@ void GameRule::read(DataInputStream *dis)
|
||||||
for (int i = 0; i < savedParams; i++)
|
for (int i = 0; i < savedParams; i++)
|
||||||
{
|
{
|
||||||
wstring pNames = dis->readUTF();
|
wstring pNames = dis->readUTF();
|
||||||
|
|
||||||
ValueType vType = getParameter(pNames);
|
ValueType vType = getParameter(pNames);
|
||||||
|
|
||||||
if (dis->readBoolean())
|
if (dis->readBoolean())
|
||||||
|
|
|
||||||
|
|
@ -18,15 +18,15 @@ void GameRuleDefinition::write(DataOutputStream *dos)
|
||||||
ConsoleGameRules::write(dos, eType); // stringID
|
ConsoleGameRules::write(dos, eType); // stringID
|
||||||
|
|
||||||
writeAttributes(dos, 0);
|
writeAttributes(dos, 0);
|
||||||
|
|
||||||
// 4J-JEV: Get children.
|
// 4J-JEV: Get children.
|
||||||
vector<GameRuleDefinition *> *children = new vector<GameRuleDefinition *>();
|
vector<GameRuleDefinition *> *children = new vector<GameRuleDefinition *>();
|
||||||
getChildren( children );
|
getChildren( children );
|
||||||
|
|
||||||
// Write children.
|
// Write children.
|
||||||
dos->writeInt( children->size() );
|
dos->writeInt( children->size() );
|
||||||
for (AUTO_VAR(it, children->begin()); it != children->end(); it++)
|
for ( auto& it : *children )
|
||||||
(*it)->write(dos);
|
it->write(dos);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameRuleDefinition::writeAttributes(DataOutputStream *dos, UINT numAttributes)
|
void GameRuleDefinition::writeAttributes(DataOutputStream *dos, UINT numAttributes)
|
||||||
|
|
@ -40,7 +40,7 @@ void GameRuleDefinition::writeAttributes(DataOutputStream *dos, UINT numAttribut
|
||||||
dos->writeUTF(m_promptId);
|
dos->writeUTF(m_promptId);
|
||||||
|
|
||||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_dataTag);
|
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_dataTag);
|
||||||
dos->writeUTF(_toString(m_4JDataValue));
|
dos->writeUTF(std::to_wstring(m_4JDataValue));
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameRuleDefinition::getChildren(vector<GameRuleDefinition *> *children) {}
|
void GameRuleDefinition::getChildren(vector<GameRuleDefinition *> *children) {}
|
||||||
|
|
@ -116,13 +116,13 @@ vector<GameRuleDefinition *> *GameRuleDefinition::enumerate()
|
||||||
|
|
||||||
unordered_map<GameRuleDefinition *, int> *GameRuleDefinition::enumerateMap()
|
unordered_map<GameRuleDefinition *, int> *GameRuleDefinition::enumerateMap()
|
||||||
{
|
{
|
||||||
unordered_map<GameRuleDefinition *, int> *out
|
unordered_map<GameRuleDefinition *, int> *out
|
||||||
= new unordered_map<GameRuleDefinition *, int>();
|
= new unordered_map<GameRuleDefinition *, int>();
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
vector<GameRuleDefinition *> *gRules = enumerate();
|
vector<GameRuleDefinition *> *gRules = enumerate();
|
||||||
for (AUTO_VAR(it, gRules->begin()); it != gRules->end(); it++)
|
for ( auto& it : *gRules )
|
||||||
out->insert( pair<GameRuleDefinition *, int>( *it, i++ ) );
|
out->emplace(it, i++);
|
||||||
|
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,7 @@ WCHAR *GameRuleManager::wchAttrNameA[] =
|
||||||
L"spawnY", // eGameRuleAttr_spawnY
|
L"spawnY", // eGameRuleAttr_spawnY
|
||||||
L"spawnZ", // eGameRuleAttr_spawnZ
|
L"spawnZ", // eGameRuleAttr_spawnZ
|
||||||
L"orientation",
|
L"orientation",
|
||||||
L"dimension",
|
L"dimension",
|
||||||
L"topTileId", // eGameRuleAttr_topTileId
|
L"topTileId", // eGameRuleAttr_topTileId
|
||||||
L"biomeId", // eGameRuleAttr_biomeId
|
L"biomeId", // eGameRuleAttr_biomeId
|
||||||
L"feature", // eGameRuleAttr_feature
|
L"feature", // eGameRuleAttr_feature
|
||||||
|
|
@ -127,7 +127,7 @@ void GameRuleManager::loadGameRules(DLCPack *pack)
|
||||||
|
|
||||||
LevelGenerationOptions *createdLevelGenerationOptions = new LevelGenerationOptions(pack);
|
LevelGenerationOptions *createdLevelGenerationOptions = new LevelGenerationOptions(pack);
|
||||||
// = loadGameRules(dData, dSize); //, strings);
|
// = loadGameRules(dData, dSize); //, strings);
|
||||||
|
|
||||||
createdLevelGenerationOptions->setGrSource( new JustGrSource() );
|
createdLevelGenerationOptions->setGrSource( new JustGrSource() );
|
||||||
createdLevelGenerationOptions->setSrc( LevelGenerationOptions::eSrc_tutorial );
|
createdLevelGenerationOptions->setSrc( LevelGenerationOptions::eSrc_tutorial );
|
||||||
|
|
||||||
|
|
@ -164,7 +164,7 @@ void GameRuleManager::loadGameRules(LevelGenerationOptions *lgo, byte *dIn, UINT
|
||||||
app.DebugPrintf("\tversion=%d.\n", version);
|
app.DebugPrintf("\tversion=%d.\n", version);
|
||||||
|
|
||||||
for (int i = 0; i < 8; i++) dis.readByte();
|
for (int i = 0; i < 8; i++) dis.readByte();
|
||||||
|
|
||||||
BYTE compression_type = dis.readByte();
|
BYTE compression_type = dis.readByte();
|
||||||
|
|
||||||
app.DebugPrintf("\tcompressionType=%d.\n", compression_type);
|
app.DebugPrintf("\tcompressionType=%d.\n", compression_type);
|
||||||
|
|
@ -174,11 +174,11 @@ void GameRuleManager::loadGameRules(LevelGenerationOptions *lgo, byte *dIn, UINT
|
||||||
decomp_len = dis.readInt();
|
decomp_len = dis.readInt();
|
||||||
|
|
||||||
app.DebugPrintf("\tcompr_len=%d.\n\tdecomp_len=%d.\n", compr_len, decomp_len);
|
app.DebugPrintf("\tcompr_len=%d.\n\tdecomp_len=%d.\n", compr_len, decomp_len);
|
||||||
|
|
||||||
|
|
||||||
// Decompress File Body
|
// Decompress File Body
|
||||||
|
|
||||||
byteArray content(new BYTE[decomp_len], decomp_len),
|
byteArray content(new BYTE[decomp_len], decomp_len),
|
||||||
compr_content(new BYTE[compr_len], compr_len);
|
compr_content(new BYTE[compr_len], compr_len);
|
||||||
dis.read(compr_content);
|
dis.read(compr_content);
|
||||||
|
|
||||||
|
|
@ -251,7 +251,7 @@ void GameRuleManager::saveGameRules(byte **dOut, UINT *dSize)
|
||||||
// Initialise output stream.
|
// Initialise output stream.
|
||||||
ByteArrayOutputStream baos;
|
ByteArrayOutputStream baos;
|
||||||
DataOutputStream dos(&baos);
|
DataOutputStream dos(&baos);
|
||||||
|
|
||||||
// Write header.
|
// Write header.
|
||||||
|
|
||||||
// VERSION NUMBER
|
// VERSION NUMBER
|
||||||
|
|
@ -279,7 +279,7 @@ void GameRuleManager::saveGameRules(byte **dOut, UINT *dSize)
|
||||||
compr_dos.writeInt( 0 ); // XmlObjects.length
|
compr_dos.writeInt( 0 ); // XmlObjects.length
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
StringTable *st = m_currentGameRuleDefinitions->getStringTable();
|
StringTable *st = m_currentGameRuleDefinitions->getStringTable();
|
||||||
|
|
||||||
if (st == NULL)
|
if (st == NULL)
|
||||||
|
|
@ -311,9 +311,9 @@ void GameRuleManager::saveGameRules(byte **dOut, UINT *dSize)
|
||||||
dos.writeInt( compr_ba.length ); // Write length
|
dos.writeInt( compr_ba.length ); // Write length
|
||||||
dos.writeInt( compr_baos.buf.length );
|
dos.writeInt( compr_baos.buf.length );
|
||||||
dos.write(compr_ba);
|
dos.write(compr_ba);
|
||||||
|
|
||||||
delete [] compr_ba.data;
|
delete [] compr_ba.data;
|
||||||
|
|
||||||
compr_dos.close();
|
compr_dos.close();
|
||||||
compr_baos.close();
|
compr_baos.close();
|
||||||
// -- END COMPRESSED -- //
|
// -- END COMPRESSED -- //
|
||||||
|
|
@ -323,7 +323,7 @@ void GameRuleManager::saveGameRules(byte **dOut, UINT *dSize)
|
||||||
*dOut = baos.buf.data;
|
*dOut = baos.buf.data;
|
||||||
|
|
||||||
baos.buf.data = NULL;
|
baos.buf.data = NULL;
|
||||||
|
|
||||||
dos.close(); baos.close();
|
dos.close(); baos.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -344,11 +344,10 @@ void GameRuleManager::writeRuleFile(DataOutputStream *dos)
|
||||||
// Write schematic files.
|
// Write schematic files.
|
||||||
unordered_map<wstring, ConsoleSchematicFile *> *files;
|
unordered_map<wstring, ConsoleSchematicFile *> *files;
|
||||||
files = getLevelGenerationOptions()->getUnfinishedSchematicFiles();
|
files = getLevelGenerationOptions()->getUnfinishedSchematicFiles();
|
||||||
dos->writeInt( files->size() );
|
for ( auto& it : *files )
|
||||||
for (AUTO_VAR(it, files->begin()); it != files->end(); it++)
|
|
||||||
{
|
{
|
||||||
wstring filename = it->first;
|
const wstring& filename = it.first;
|
||||||
ConsoleSchematicFile *file = it->second;
|
ConsoleSchematicFile *file = it.second;
|
||||||
|
|
||||||
ByteArrayOutputStream fileBaos;
|
ByteArrayOutputStream fileBaos;
|
||||||
DataOutputStream fileDos(&fileBaos);
|
DataOutputStream fileDos(&fileBaos);
|
||||||
|
|
@ -378,7 +377,7 @@ bool GameRuleManager::readRuleFile(LevelGenerationOptions *lgo, byte *dIn, UINT
|
||||||
//DWORD dwLen = 0;
|
//DWORD dwLen = 0;
|
||||||
//PBYTE pbData = dlcFile->getData(dwLen);
|
//PBYTE pbData = dlcFile->getData(dwLen);
|
||||||
//byteArray data(pbData,dwLen);
|
//byteArray data(pbData,dwLen);
|
||||||
|
|
||||||
byteArray data(dIn, dSize);
|
byteArray data(dIn, dSize);
|
||||||
ByteArrayInputStream bais(data);
|
ByteArrayInputStream bais(data);
|
||||||
DataInputStream dis(&bais);
|
DataInputStream dis(&bais);
|
||||||
|
|
@ -497,7 +496,7 @@ bool GameRuleManager::readRuleFile(LevelGenerationOptions *lgo, byte *dIn, UINT
|
||||||
}
|
}
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
// subfile
|
// subfile
|
||||||
UINT numFiles = contentDis->readInt();
|
UINT numFiles = contentDis->readInt();
|
||||||
for (UINT i = 0; i < numFiles; i++)
|
for (UINT i = 0; i < numFiles; i++)
|
||||||
{
|
{
|
||||||
|
|
@ -519,7 +518,7 @@ bool GameRuleManager::readRuleFile(LevelGenerationOptions *lgo, byte *dIn, UINT
|
||||||
{
|
{
|
||||||
int tagId = contentDis->readInt();
|
int tagId = contentDis->readInt();
|
||||||
ConsoleGameRules::EGameRuleType tagVal = ConsoleGameRules::eGameRuleType_Invalid;
|
ConsoleGameRules::EGameRuleType tagVal = ConsoleGameRules::eGameRuleType_Invalid;
|
||||||
AUTO_VAR(it,tagIdMap.find(tagId));
|
auto it = tagIdMap.find(tagId);
|
||||||
if(it != tagIdMap.end()) tagVal = it->second;
|
if(it != tagIdMap.end()) tagVal = it->second;
|
||||||
|
|
||||||
GameRuleDefinition *rule = NULL;
|
GameRuleDefinition *rule = NULL;
|
||||||
|
|
@ -565,10 +564,10 @@ bool GameRuleManager::readRuleFile(LevelGenerationOptions *lgo, byte *dIn, UINT
|
||||||
|
|
||||||
LevelGenerationOptions *GameRuleManager::readHeader(DLCGameRulesHeader *grh)
|
LevelGenerationOptions *GameRuleManager::readHeader(DLCGameRulesHeader *grh)
|
||||||
{
|
{
|
||||||
LevelGenerationOptions *out =
|
LevelGenerationOptions *out =
|
||||||
new LevelGenerationOptions();
|
new LevelGenerationOptions();
|
||||||
|
|
||||||
|
|
||||||
out->setSrc(LevelGenerationOptions::eSrc_fromDLC);
|
out->setSrc(LevelGenerationOptions::eSrc_fromDLC);
|
||||||
out->setGrSource(grh);
|
out->setGrSource(grh);
|
||||||
addLevelGenerationOptions(out);
|
addLevelGenerationOptions(out);
|
||||||
|
|
@ -595,7 +594,7 @@ void GameRuleManager::readChildren(DataInputStream *dis, vector<wstring> *tagsAn
|
||||||
{
|
{
|
||||||
int tagId = dis->readInt();
|
int tagId = dis->readInt();
|
||||||
ConsoleGameRules::EGameRuleType tagVal = ConsoleGameRules::eGameRuleType_Invalid;
|
ConsoleGameRules::EGameRuleType tagVal = ConsoleGameRules::eGameRuleType_Invalid;
|
||||||
AUTO_VAR(it,tagIdMap->find(tagId));
|
auto it = tagIdMap->find(tagId);
|
||||||
if(it != tagIdMap->end()) tagVal = it->second;
|
if(it != tagIdMap->end()) tagVal = it->second;
|
||||||
|
|
||||||
GameRuleDefinition *childRule = NULL;
|
GameRuleDefinition *childRule = NULL;
|
||||||
|
|
@ -640,18 +639,6 @@ void GameRuleManager::loadDefaultGameRules()
|
||||||
m_levelGenerators.getLevelGenerators()->at(0)->setDefaultSaveName(app.GetString(IDS_TUTORIALSAVENAME));
|
m_levelGenerators.getLevelGenerators()->at(0)->setDefaultSaveName(app.GetString(IDS_TUTORIALSAVENAME));
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef _CONTENT_PACKAGE
|
|
||||||
// 4J Stu - Remove these just now
|
|
||||||
//File testRulesPath(L"GAME:\\GameRules");
|
|
||||||
//vector<File *> *packFiles = testRulesPath.listFiles();
|
|
||||||
|
|
||||||
//for(AUTO_VAR(it,packFiles->begin()); it != packFiles->end(); ++it)
|
|
||||||
//{
|
|
||||||
// loadGameRulesPack(*it);
|
|
||||||
//}
|
|
||||||
//delete packFiles;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#else // _XBOX
|
#else // _XBOX
|
||||||
|
|
||||||
#ifdef _WINDOWS64
|
#ifdef _WINDOWS64
|
||||||
|
|
@ -741,7 +728,7 @@ LPCWSTR GameRuleManager::GetGameRulesString(const wstring &key)
|
||||||
LEVEL_GEN_ID GameRuleManager::addLevelGenerationOptions(LevelGenerationOptions *lgo)
|
LEVEL_GEN_ID GameRuleManager::addLevelGenerationOptions(LevelGenerationOptions *lgo)
|
||||||
{
|
{
|
||||||
vector<LevelGenerationOptions *> *lgs = m_levelGenerators.getLevelGenerators();
|
vector<LevelGenerationOptions *> *lgs = m_levelGenerators.getLevelGenerators();
|
||||||
|
|
||||||
for (int i = 0; i<lgs->size(); i++)
|
for (int i = 0; i<lgs->size(); i++)
|
||||||
if (lgs->at(i) == lgo)
|
if (lgs->at(i) == lgo)
|
||||||
return i;
|
return i;
|
||||||
|
|
@ -761,7 +748,7 @@ void GameRuleManager::unloadCurrentGameRules()
|
||||||
if (m_currentLevelGenerationOptions->isFromSave())
|
if (m_currentLevelGenerationOptions->isFromSave())
|
||||||
{
|
{
|
||||||
m_levelGenerators.removeLevelGenerator( m_currentLevelGenerationOptions );
|
m_levelGenerators.removeLevelGenerator( m_currentLevelGenerationOptions );
|
||||||
|
|
||||||
delete m_currentLevelGenerationOptions;
|
delete m_currentLevelGenerationOptions;
|
||||||
}
|
}
|
||||||
else if (m_currentLevelGenerationOptions->isFromDLC())
|
else if (m_currentLevelGenerationOptions->isFromDLC())
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,7 @@ LevelGenerationOptions::LevelGenerationOptions(DLCPack *parentPack)
|
||||||
m_pbBaseSaveData = NULL;
|
m_pbBaseSaveData = NULL;
|
||||||
m_dwBaseSaveSize = 0;
|
m_dwBaseSaveSize = 0;
|
||||||
|
|
||||||
m_parentDLCPack = parentPack;
|
m_parentDLCPack = parentPack;
|
||||||
m_bLoadingData = false;
|
m_bLoadingData = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -67,23 +67,24 @@ LevelGenerationOptions::~LevelGenerationOptions()
|
||||||
{
|
{
|
||||||
clearSchematics();
|
clearSchematics();
|
||||||
if(m_spawnPos != NULL) delete m_spawnPos;
|
if(m_spawnPos != NULL) delete m_spawnPos;
|
||||||
for(AUTO_VAR(it, m_schematicRules.begin()); it != m_schematicRules.end(); ++it)
|
for (auto& it : m_schematicRules )
|
||||||
{
|
{
|
||||||
delete *it;
|
delete it;
|
||||||
}
|
|
||||||
for(AUTO_VAR(it, m_structureRules.begin()); it != m_structureRules.end(); ++it)
|
|
||||||
{
|
|
||||||
delete *it;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for(AUTO_VAR(it, m_biomeOverrides.begin()); it != m_biomeOverrides.end(); ++it)
|
for (auto& it : m_structureRules )
|
||||||
{
|
{
|
||||||
delete *it;
|
delete it;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(AUTO_VAR(it, m_features.begin()); it != m_features.end(); ++it)
|
for (auto& it : m_biomeOverrides )
|
||||||
{
|
{
|
||||||
delete *it;
|
delete it;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (auto& it : m_features )
|
||||||
|
{
|
||||||
|
delete it;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_stringTable)
|
if (m_stringTable)
|
||||||
|
|
@ -100,16 +101,16 @@ void LevelGenerationOptions::writeAttributes(DataOutputStream *dos, UINT numAttr
|
||||||
GameRuleDefinition::writeAttributes(dos, numAttrs + 5);
|
GameRuleDefinition::writeAttributes(dos, numAttrs + 5);
|
||||||
|
|
||||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_spawnX);
|
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_spawnX);
|
||||||
dos->writeUTF(_toString(m_spawnPos->x));
|
dos->writeUTF(std::to_wstring(m_spawnPos->x));
|
||||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_spawnY);
|
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_spawnY);
|
||||||
dos->writeUTF(_toString(m_spawnPos->y));
|
dos->writeUTF(std::to_wstring(m_spawnPos->y));
|
||||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_spawnZ);
|
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_spawnZ);
|
||||||
dos->writeUTF(_toString(m_spawnPos->z));
|
dos->writeUTF(std::to_wstring(m_spawnPos->z));
|
||||||
|
|
||||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_seed);
|
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_seed);
|
||||||
dos->writeUTF(_toString(m_seed));
|
dos->writeUTF(std::to_wstring(m_seed));
|
||||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_flatworld);
|
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_flatworld);
|
||||||
dos->writeUTF(_toString(m_useFlatWorld));
|
dos->writeUTF(std::to_wstring(m_useFlatWorld));
|
||||||
}
|
}
|
||||||
|
|
||||||
void LevelGenerationOptions::getChildren(vector<GameRuleDefinition *> *children)
|
void LevelGenerationOptions::getChildren(vector<GameRuleDefinition *> *children)
|
||||||
|
|
@ -117,18 +118,25 @@ void LevelGenerationOptions::getChildren(vector<GameRuleDefinition *> *children)
|
||||||
GameRuleDefinition::getChildren(children);
|
GameRuleDefinition::getChildren(children);
|
||||||
|
|
||||||
vector<ApplySchematicRuleDefinition *> used_schematics;
|
vector<ApplySchematicRuleDefinition *> used_schematics;
|
||||||
for (AUTO_VAR(it, m_schematicRules.begin()); it != m_schematicRules.end(); it++)
|
for (auto& it : m_schematicRules )
|
||||||
if ( !(*it)->isComplete() )
|
if ( it && !it->isComplete() )
|
||||||
used_schematics.push_back( *it );
|
used_schematics.push_back( it );
|
||||||
|
|
||||||
for(AUTO_VAR(it, m_structureRules.begin()); it!=m_structureRules.end(); it++)
|
for (auto& it : m_structureRules)
|
||||||
children->push_back( *it );
|
if ( it )
|
||||||
for(AUTO_VAR(it, used_schematics.begin()); it!=used_schematics.end(); it++)
|
children->push_back( it );
|
||||||
children->push_back( *it );
|
|
||||||
for(AUTO_VAR(it, m_biomeOverrides.begin()); it != m_biomeOverrides.end(); ++it)
|
for (auto& it : used_schematics)
|
||||||
children->push_back( *it );
|
if ( it )
|
||||||
for(AUTO_VAR(it, m_features.begin()); it != m_features.end(); ++it)
|
children->push_back( it );
|
||||||
children->push_back( *it );
|
|
||||||
|
for (auto& it : m_biomeOverrides)
|
||||||
|
if ( it )
|
||||||
|
children->push_back( it );
|
||||||
|
|
||||||
|
for (auto& it : m_features)
|
||||||
|
if ( it )
|
||||||
|
children->push_back( it );
|
||||||
}
|
}
|
||||||
|
|
||||||
GameRuleDefinition *LevelGenerationOptions::addChild(ConsoleGameRules::EGameRuleType ruleType)
|
GameRuleDefinition *LevelGenerationOptions::addChild(ConsoleGameRules::EGameRuleType ruleType)
|
||||||
|
|
@ -195,7 +203,7 @@ void LevelGenerationOptions::addAttribute(const wstring &attributeName, const ws
|
||||||
{
|
{
|
||||||
if(attributeValue.compare(L"true") == 0) m_useFlatWorld = true;
|
if(attributeValue.compare(L"true") == 0) m_useFlatWorld = true;
|
||||||
app.DebugPrintf("LevelGenerationOptions: Adding parameter flatworld=%s\n",m_useFlatWorld?"TRUE":"FALSE");
|
app.DebugPrintf("LevelGenerationOptions: Adding parameter flatworld=%s\n",m_useFlatWorld?"TRUE":"FALSE");
|
||||||
}
|
}
|
||||||
else if(attributeName.compare(L"saveName") == 0)
|
else if(attributeName.compare(L"saveName") == 0)
|
||||||
{
|
{
|
||||||
wstring string(attributeValue);
|
wstring string(attributeValue);
|
||||||
|
|
@ -218,7 +226,7 @@ void LevelGenerationOptions::addAttribute(const wstring &attributeName, const ws
|
||||||
app.DebugPrintf("LevelGenerationOptions: Adding parameter displayName=%ls\n", getDisplayName());
|
app.DebugPrintf("LevelGenerationOptions: Adding parameter displayName=%ls\n", getDisplayName());
|
||||||
}
|
}
|
||||||
else if(attributeName.compare(L"texturePackId") == 0)
|
else if(attributeName.compare(L"texturePackId") == 0)
|
||||||
{
|
{
|
||||||
setRequiredTexturePackId( _fromString<unsigned int>(attributeValue) );
|
setRequiredTexturePackId( _fromString<unsigned int>(attributeValue) );
|
||||||
setRequiresTexturePack( true );
|
setRequiresTexturePack( true );
|
||||||
app.DebugPrintf("LevelGenerationOptions: Adding parameter texturePackId=%0x\n", getRequiredTexturePackId());
|
app.DebugPrintf("LevelGenerationOptions: Adding parameter texturePackId=%0x\n", getRequiredTexturePackId());
|
||||||
|
|
@ -249,19 +257,14 @@ void LevelGenerationOptions::processSchematics(LevelChunk *chunk)
|
||||||
{
|
{
|
||||||
PIXBeginNamedEvent(0,"Processing schematics for chunk (%d,%d)", chunk->x, chunk->z);
|
PIXBeginNamedEvent(0,"Processing schematics for chunk (%d,%d)", chunk->x, chunk->z);
|
||||||
AABB *chunkBox = AABB::newTemp(chunk->x*16,0,chunk->z*16,chunk->x*16 + 16,Level::maxBuildHeight,chunk->z*16 + 16);
|
AABB *chunkBox = AABB::newTemp(chunk->x*16,0,chunk->z*16,chunk->x*16 + 16,Level::maxBuildHeight,chunk->z*16 + 16);
|
||||||
for( AUTO_VAR(it, m_schematicRules.begin()); it != m_schematicRules.end();++it)
|
for( ApplySchematicRuleDefinition *rule : m_schematicRules )
|
||||||
{
|
|
||||||
ApplySchematicRuleDefinition *rule = *it;
|
|
||||||
rule->processSchematic(chunkBox, chunk);
|
rule->processSchematic(chunkBox, chunk);
|
||||||
}
|
|
||||||
|
|
||||||
int cx = (chunk->x << 4);
|
int cx = (chunk->x << 4);
|
||||||
int cz = (chunk->z << 4);
|
int cz = (chunk->z << 4);
|
||||||
|
|
||||||
for( AUTO_VAR(it, m_structureRules.begin()); it != m_structureRules.end(); it++ )
|
for ( ConsoleGenerateStructure *structureStart : m_structureRules )
|
||||||
{
|
{
|
||||||
ConsoleGenerateStructure *structureStart = *it;
|
|
||||||
|
|
||||||
if (structureStart->getBoundingBox()->intersects(cx, cz, cx + 15, cz + 15))
|
if (structureStart->getBoundingBox()->intersects(cx, cz, cx + 15, cz + 15))
|
||||||
{
|
{
|
||||||
BoundingBox *bb = new BoundingBox(cx, cz, cx + 15, cz + 15);
|
BoundingBox *bb = new BoundingBox(cx, cz, cx + 15, cz + 15);
|
||||||
|
|
@ -276,9 +279,8 @@ void LevelGenerationOptions::processSchematicsLighting(LevelChunk *chunk)
|
||||||
{
|
{
|
||||||
PIXBeginNamedEvent(0,"Processing schematics (lighting) for chunk (%d,%d)", chunk->x, chunk->z);
|
PIXBeginNamedEvent(0,"Processing schematics (lighting) for chunk (%d,%d)", chunk->x, chunk->z);
|
||||||
AABB *chunkBox = AABB::newTemp(chunk->x*16,0,chunk->z*16,chunk->x*16 + 16,Level::maxBuildHeight,chunk->z*16 + 16);
|
AABB *chunkBox = AABB::newTemp(chunk->x*16,0,chunk->z*16,chunk->x*16 + 16,Level::maxBuildHeight,chunk->z*16 + 16);
|
||||||
for( AUTO_VAR(it, m_schematicRules.begin()); it != m_schematicRules.end();++it)
|
for ( ApplySchematicRuleDefinition *rule : m_schematicRules )
|
||||||
{
|
{
|
||||||
ApplySchematicRuleDefinition *rule = *it;
|
|
||||||
rule->processSchematicLighting(chunkBox, chunk);
|
rule->processSchematicLighting(chunkBox, chunk);
|
||||||
}
|
}
|
||||||
PIXEndNamedEvent();
|
PIXEndNamedEvent();
|
||||||
|
|
@ -292,16 +294,14 @@ bool LevelGenerationOptions::checkIntersects(int x0, int y0, int z0, int x1, int
|
||||||
// a) ores generally being below ground/sea level and b) tutorial world additions generally being above ground/sea level
|
// a) ores generally being below ground/sea level and b) tutorial world additions generally being above ground/sea level
|
||||||
if(!m_bHaveMinY)
|
if(!m_bHaveMinY)
|
||||||
{
|
{
|
||||||
for(AUTO_VAR(it, m_schematicRules.begin()); it != m_schematicRules.end();++it)
|
for ( ApplySchematicRuleDefinition *rule : m_schematicRules )
|
||||||
{
|
{
|
||||||
ApplySchematicRuleDefinition *rule = *it;
|
|
||||||
int minY = rule->getMinY();
|
int minY = rule->getMinY();
|
||||||
if(minY < m_minY) m_minY = minY;
|
if(minY < m_minY) m_minY = minY;
|
||||||
}
|
}
|
||||||
|
|
||||||
for( AUTO_VAR(it, m_structureRules.begin()); it != m_structureRules.end(); it++ )
|
for ( ConsoleGenerateStructure *structureStart : m_structureRules )
|
||||||
{
|
{
|
||||||
ConsoleGenerateStructure *structureStart = *it;
|
|
||||||
int minY = structureStart->getMinY();
|
int minY = structureStart->getMinY();
|
||||||
if(minY < m_minY) m_minY = minY;
|
if(minY < m_minY) m_minY = minY;
|
||||||
}
|
}
|
||||||
|
|
@ -313,18 +313,16 @@ bool LevelGenerationOptions::checkIntersects(int x0, int y0, int z0, int x1, int
|
||||||
if( y1 < m_minY ) return false;
|
if( y1 < m_minY ) return false;
|
||||||
|
|
||||||
bool intersects = false;
|
bool intersects = false;
|
||||||
for(AUTO_VAR(it, m_schematicRules.begin()); it != m_schematicRules.end();++it)
|
for( ApplySchematicRuleDefinition *rule : m_schematicRules )
|
||||||
{
|
{
|
||||||
ApplySchematicRuleDefinition *rule = *it;
|
|
||||||
intersects = rule->checkIntersects(x0,y0,z0,x1,y1,z1);
|
intersects = rule->checkIntersects(x0,y0,z0,x1,y1,z1);
|
||||||
if(intersects) break;
|
if(intersects) break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!intersects)
|
if(!intersects)
|
||||||
{
|
{
|
||||||
for( AUTO_VAR(it, m_structureRules.begin()); it != m_structureRules.end(); it++ )
|
for( ConsoleGenerateStructure *structureStart : m_structureRules )
|
||||||
{
|
{
|
||||||
ConsoleGenerateStructure *structureStart = *it;
|
|
||||||
intersects = structureStart->checkIntersects(x0,y0,z0,x1,y1,z1);
|
intersects = structureStart->checkIntersects(x0,y0,z0,x1,y1,z1);
|
||||||
if(intersects) break;
|
if(intersects) break;
|
||||||
}
|
}
|
||||||
|
|
@ -335,9 +333,9 @@ bool LevelGenerationOptions::checkIntersects(int x0, int y0, int z0, int x1, int
|
||||||
|
|
||||||
void LevelGenerationOptions::clearSchematics()
|
void LevelGenerationOptions::clearSchematics()
|
||||||
{
|
{
|
||||||
for(AUTO_VAR(it, m_schematics.begin()); it != m_schematics.end(); ++it)
|
for ( auto& it : m_schematics )
|
||||||
{
|
{
|
||||||
delete it->second;
|
delete it.second;
|
||||||
}
|
}
|
||||||
m_schematics.clear();
|
m_schematics.clear();
|
||||||
}
|
}
|
||||||
|
|
@ -345,7 +343,7 @@ void LevelGenerationOptions::clearSchematics()
|
||||||
ConsoleSchematicFile *LevelGenerationOptions::loadSchematicFile(const wstring &filename, PBYTE pbData, DWORD dwLen)
|
ConsoleSchematicFile *LevelGenerationOptions::loadSchematicFile(const wstring &filename, PBYTE pbData, DWORD dwLen)
|
||||||
{
|
{
|
||||||
// If we have already loaded this, just return
|
// If we have already loaded this, just return
|
||||||
AUTO_VAR(it, m_schematics.find(filename));
|
auto it = m_schematics.find(filename);
|
||||||
if(it != m_schematics.end())
|
if(it != m_schematics.end())
|
||||||
{
|
{
|
||||||
#ifndef _CONTENT_PACKAGE
|
#ifndef _CONTENT_PACKAGE
|
||||||
|
|
@ -370,7 +368,7 @@ ConsoleSchematicFile *LevelGenerationOptions::getSchematicFile(const wstring &fi
|
||||||
{
|
{
|
||||||
ConsoleSchematicFile *schematic = NULL;
|
ConsoleSchematicFile *schematic = NULL;
|
||||||
// If we have already loaded this, just return
|
// If we have already loaded this, just return
|
||||||
AUTO_VAR(it, m_schematics.find(filename));
|
auto it = m_schematics.find(filename);
|
||||||
if(it != m_schematics.end())
|
if(it != m_schematics.end())
|
||||||
{
|
{
|
||||||
schematic = it->second;
|
schematic = it->second;
|
||||||
|
|
@ -381,7 +379,7 @@ ConsoleSchematicFile *LevelGenerationOptions::getSchematicFile(const wstring &fi
|
||||||
void LevelGenerationOptions::releaseSchematicFile(const wstring &filename)
|
void LevelGenerationOptions::releaseSchematicFile(const wstring &filename)
|
||||||
{
|
{
|
||||||
// 4J Stu - We don't want to delete them when done, but probably want to keep a set of active schematics for the current world
|
// 4J Stu - We don't want to delete them when done, but probably want to keep a set of active schematics for the current world
|
||||||
//AUTO_VAR(it, m_schematics.find(filename));
|
// auto it = m_schematics.find(filename);
|
||||||
//if(it != m_schematics.end())
|
//if(it != m_schematics.end())
|
||||||
//{
|
//{
|
||||||
// ConsoleSchematicFile *schematic = it->second;
|
// ConsoleSchematicFile *schematic = it->second;
|
||||||
|
|
@ -413,10 +411,9 @@ LPCWSTR LevelGenerationOptions::getString(const wstring &key)
|
||||||
|
|
||||||
void LevelGenerationOptions::getBiomeOverride(int biomeId, BYTE &tile, BYTE &topTile)
|
void LevelGenerationOptions::getBiomeOverride(int biomeId, BYTE &tile, BYTE &topTile)
|
||||||
{
|
{
|
||||||
for(AUTO_VAR(it, m_biomeOverrides.begin()); it != m_biomeOverrides.end(); ++it)
|
for ( BiomeOverride *bo : m_biomeOverrides )
|
||||||
{
|
{
|
||||||
BiomeOverride *bo = *it;
|
if ( bo && bo->isBiome(biomeId) )
|
||||||
if(bo->isBiome(biomeId))
|
|
||||||
{
|
{
|
||||||
bo->getTileValues(tile,topTile);
|
bo->getTileValues(tile,topTile);
|
||||||
break;
|
break;
|
||||||
|
|
@ -428,9 +425,8 @@ bool LevelGenerationOptions::isFeatureChunk(int chunkX, int chunkZ, StructureFea
|
||||||
{
|
{
|
||||||
bool isFeature = false;
|
bool isFeature = false;
|
||||||
|
|
||||||
for(AUTO_VAR(it, m_features.begin()); it != m_features.end(); ++it)
|
for( StartFeature *sf : m_features )
|
||||||
{
|
{
|
||||||
StartFeature *sf = *it;
|
|
||||||
if(sf->isFeatureChunk(chunkX, chunkZ, feature, orientation))
|
if(sf->isFeatureChunk(chunkX, chunkZ, feature, orientation))
|
||||||
{
|
{
|
||||||
isFeature = true;
|
isFeature = true;
|
||||||
|
|
@ -444,17 +440,17 @@ unordered_map<wstring, ConsoleSchematicFile *> *LevelGenerationOptions::getUnfin
|
||||||
{
|
{
|
||||||
// Clean schematic rules.
|
// Clean schematic rules.
|
||||||
unordered_set<wstring> usedFiles = unordered_set<wstring>();
|
unordered_set<wstring> usedFiles = unordered_set<wstring>();
|
||||||
for (AUTO_VAR(it, m_schematicRules.begin()); it!=m_schematicRules.end(); it++)
|
for ( auto& it : m_schematicRules )
|
||||||
if ( !(*it)->isComplete() )
|
if ( !it->isComplete() )
|
||||||
usedFiles.insert( (*it)->getSchematicName() );
|
usedFiles.insert( it->getSchematicName() );
|
||||||
|
|
||||||
// Clean schematic files.
|
// Clean schematic files.
|
||||||
unordered_map<wstring, ConsoleSchematicFile *> *out
|
unordered_map<wstring, ConsoleSchematicFile *> *out
|
||||||
= new unordered_map<wstring, ConsoleSchematicFile *>();
|
= new unordered_map<wstring, ConsoleSchematicFile *>();
|
||||||
for (AUTO_VAR(it, usedFiles.begin()); it!=usedFiles.end(); it++)
|
for ( auto& it : usedFiles )
|
||||||
out->insert( pair<wstring, ConsoleSchematicFile *>(*it, getSchematicFile(*it)) );
|
out->insert( pair<wstring, ConsoleSchematicFile *>(it, getSchematicFile(it)) );
|
||||||
|
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LevelGenerationOptions::loadBaseSaveData()
|
void LevelGenerationOptions::loadBaseSaveData()
|
||||||
|
|
@ -472,7 +468,7 @@ void LevelGenerationOptions::loadBaseSaveData()
|
||||||
{
|
{
|
||||||
// corrupt DLC
|
// corrupt DLC
|
||||||
setLoadedData();
|
setLoadedData();
|
||||||
app.DebugPrintf("Failed to mount LGO DLC %d for pad %d\n",mountIndex,ProfileManager.GetPrimaryPad());
|
app.DebugPrintf("Failed to mount LGO DLC %d for pad %d\n",mountIndex,ProfileManager.GetPrimaryPad());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -604,7 +600,7 @@ int LevelGenerationOptions::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
#ifdef _DURANGO
|
#ifdef _DURANGO
|
||||||
DWORD result = StorageManager.UnmountInstalledDLC(L"WPACK");
|
DWORD result = StorageManager.UnmountInstalledDLC(L"WPACK");
|
||||||
#else
|
#else
|
||||||
DWORD result = StorageManager.UnmountInstalledDLC("WPACK");
|
DWORD result = StorageManager.UnmountInstalledDLC("WPACK");
|
||||||
|
|
@ -619,11 +615,10 @@ int LevelGenerationOptions::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD
|
||||||
|
|
||||||
void LevelGenerationOptions::reset_start()
|
void LevelGenerationOptions::reset_start()
|
||||||
{
|
{
|
||||||
for ( AUTO_VAR( it, m_schematicRules.begin());
|
for ( auto& it : m_schematicRules )
|
||||||
it != m_schematicRules.end();
|
|
||||||
it++ )
|
|
||||||
{
|
{
|
||||||
(*it)->reset();
|
if ( it )
|
||||||
|
it->reset();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -651,7 +646,7 @@ bool LevelGenerationOptions::requiresTexturePack() { return info()->requiresText
|
||||||
UINT LevelGenerationOptions::getRequiredTexturePackId() { return info()->getRequiredTexturePackId(); }
|
UINT LevelGenerationOptions::getRequiredTexturePackId() { return info()->getRequiredTexturePackId(); }
|
||||||
|
|
||||||
wstring LevelGenerationOptions::getDefaultSaveName()
|
wstring LevelGenerationOptions::getDefaultSaveName()
|
||||||
{
|
{
|
||||||
switch (getSrc())
|
switch (getSrc())
|
||||||
{
|
{
|
||||||
case eSrc_fromSave: return getString( info()->getDefaultSaveName() );
|
case eSrc_fromSave: return getString( info()->getDefaultSaveName() );
|
||||||
|
|
@ -661,7 +656,7 @@ wstring LevelGenerationOptions::getDefaultSaveName()
|
||||||
return L"";
|
return L"";
|
||||||
}
|
}
|
||||||
LPCWSTR LevelGenerationOptions::getWorldName()
|
LPCWSTR LevelGenerationOptions::getWorldName()
|
||||||
{
|
{
|
||||||
switch (getSrc())
|
switch (getSrc())
|
||||||
{
|
{
|
||||||
case eSrc_fromSave: return getString( info()->getWorldName() );
|
case eSrc_fromSave: return getString( info()->getWorldName() );
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ LevelRuleset::LevelRuleset()
|
||||||
|
|
||||||
LevelRuleset::~LevelRuleset()
|
LevelRuleset::~LevelRuleset()
|
||||||
{
|
{
|
||||||
for(AUTO_VAR(it, m_areas.begin()); it != m_areas.end(); ++it)
|
for (auto it = m_areas.begin(); it != m_areas.end(); ++it)
|
||||||
{
|
{
|
||||||
delete *it;
|
delete *it;
|
||||||
}
|
}
|
||||||
|
|
@ -20,8 +20,8 @@ LevelRuleset::~LevelRuleset()
|
||||||
void LevelRuleset::getChildren(vector<GameRuleDefinition *> *children)
|
void LevelRuleset::getChildren(vector<GameRuleDefinition *> *children)
|
||||||
{
|
{
|
||||||
CompoundGameRuleDefinition::getChildren(children);
|
CompoundGameRuleDefinition::getChildren(children);
|
||||||
for (AUTO_VAR(it, m_areas.begin()); it != m_areas.end(); it++)
|
for (const auto& area : m_areas)
|
||||||
children->push_back(*it);
|
children->push_back(area);
|
||||||
}
|
}
|
||||||
|
|
||||||
GameRuleDefinition *LevelRuleset::addChild(ConsoleGameRules::EGameRuleType ruleType)
|
GameRuleDefinition *LevelRuleset::addChild(ConsoleGameRules::EGameRuleType ruleType)
|
||||||
|
|
@ -58,12 +58,12 @@ LPCWSTR LevelRuleset::getString(const wstring &key)
|
||||||
|
|
||||||
AABB *LevelRuleset::getNamedArea(const wstring &areaName)
|
AABB *LevelRuleset::getNamedArea(const wstring &areaName)
|
||||||
{
|
{
|
||||||
AABB *area = NULL;
|
AABB *area = nullptr;
|
||||||
for(AUTO_VAR(it, m_areas.begin()); it != m_areas.end(); ++it)
|
for(auto& it : m_areas)
|
||||||
{
|
{
|
||||||
if( (*it)->getName().compare(areaName) == 0 )
|
if( it->getName().compare(areaName) == 0 )
|
||||||
{
|
{
|
||||||
area = (*it)->getArea();
|
area = it->getArea();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,18 +22,18 @@ void NamedAreaRuleDefinition::writeAttributes(DataOutputStream *dos, UINT numAtt
|
||||||
dos->writeUTF(m_name);
|
dos->writeUTF(m_name);
|
||||||
|
|
||||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_x0);
|
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_x0);
|
||||||
dos->writeUTF(_toString(m_area->x0));
|
dos->writeUTF(std::to_wstring(m_area->x0));
|
||||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_y0);
|
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_y0);
|
||||||
dos->writeUTF(_toString(m_area->y0));
|
dos->writeUTF(std::to_wstring(m_area->y0));
|
||||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_z0);
|
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_z0);
|
||||||
dos->writeUTF(_toString(m_area->z0));
|
dos->writeUTF(std::to_wstring(m_area->z0));
|
||||||
|
|
||||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_x1);
|
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_x1);
|
||||||
dos->writeUTF(_toString(m_area->x1));
|
dos->writeUTF(std::to_wstring(m_area->x1));
|
||||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_y1);
|
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_y1);
|
||||||
dos->writeUTF(_toString(m_area->y1));
|
dos->writeUTF(std::to_wstring(m_area->y1));
|
||||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_z1);
|
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_z1);
|
||||||
dos->writeUTF(_toString(m_area->z1));
|
dos->writeUTF(std::to_wstring(m_area->z1));
|
||||||
}
|
}
|
||||||
|
|
||||||
void NamedAreaRuleDefinition::addAttribute(const wstring &attributeName, const wstring &attributeValue)
|
void NamedAreaRuleDefinition::addAttribute(const wstring &attributeName, const wstring &attributeValue)
|
||||||
|
|
|
||||||
|
|
@ -15,13 +15,13 @@ void StartFeature::writeAttributes(DataOutputStream *dos, UINT numAttrs)
|
||||||
GameRuleDefinition::writeAttributes(dos, numAttrs + 4);
|
GameRuleDefinition::writeAttributes(dos, numAttrs + 4);
|
||||||
|
|
||||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_chunkX);
|
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_chunkX);
|
||||||
dos->writeUTF(_toString(m_chunkX));
|
dos->writeUTF(std::to_wstring(m_chunkX));
|
||||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_chunkZ);
|
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_chunkZ);
|
||||||
dos->writeUTF(_toString(m_chunkZ));
|
dos->writeUTF(std::to_wstring(m_chunkZ));
|
||||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_feature);
|
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_feature);
|
||||||
dos->writeUTF(_toString((int)m_feature));
|
dos->writeUTF(std::to_wstring((int)m_feature));
|
||||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_orientation);
|
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_orientation);
|
||||||
dos->writeUTF(_toString(m_orientation));
|
dos->writeUTF(std::to_wstring(m_orientation));
|
||||||
}
|
}
|
||||||
|
|
||||||
void StartFeature::addAttribute(const wstring &attributeName, const wstring &attributeValue)
|
void StartFeature::addAttribute(const wstring &attributeName, const wstring &attributeValue)
|
||||||
|
|
|
||||||
|
|
@ -11,16 +11,16 @@ UpdatePlayerRuleDefinition::UpdatePlayerRuleDefinition()
|
||||||
{
|
{
|
||||||
m_bUpdateHealth = m_bUpdateFood = m_bUpdateYRot = false;;
|
m_bUpdateHealth = m_bUpdateFood = m_bUpdateYRot = false;;
|
||||||
m_health = 0;
|
m_health = 0;
|
||||||
m_food = 0;
|
m_food = 0;
|
||||||
m_spawnPos = NULL;
|
m_spawnPos = NULL;
|
||||||
m_yRot = 0.0f;
|
m_yRot = 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdatePlayerRuleDefinition::~UpdatePlayerRuleDefinition()
|
UpdatePlayerRuleDefinition::~UpdatePlayerRuleDefinition()
|
||||||
{
|
{
|
||||||
for(AUTO_VAR(it, m_items.begin()); it != m_items.end(); ++it)
|
for(auto& item : m_items)
|
||||||
{
|
{
|
||||||
delete *it;
|
delete item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -33,34 +33,34 @@ void UpdatePlayerRuleDefinition::writeAttributes(DataOutputStream *dos, UINT num
|
||||||
GameRuleDefinition::writeAttributes(dos, numAttributes + attrCount );
|
GameRuleDefinition::writeAttributes(dos, numAttributes + attrCount );
|
||||||
|
|
||||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_spawnX);
|
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_spawnX);
|
||||||
dos->writeUTF(_toString(m_spawnPos->x));
|
dos->writeUTF(std::to_wstring(m_spawnPos->x));
|
||||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_spawnY);
|
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_spawnY);
|
||||||
dos->writeUTF(_toString(m_spawnPos->y));
|
dos->writeUTF(std::to_wstring(m_spawnPos->y));
|
||||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_spawnZ);
|
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_spawnZ);
|
||||||
dos->writeUTF(_toString(m_spawnPos->z));
|
dos->writeUTF(std::to_wstring(m_spawnPos->z));
|
||||||
|
|
||||||
if(m_bUpdateYRot)
|
if(m_bUpdateYRot)
|
||||||
{
|
{
|
||||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_yRot);
|
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_yRot);
|
||||||
dos->writeUTF(_toString(m_yRot));
|
dos->writeUTF(std::to_wstring(m_yRot));
|
||||||
}
|
}
|
||||||
if(m_bUpdateHealth)
|
if(m_bUpdateHealth)
|
||||||
{
|
{
|
||||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_food);
|
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_food);
|
||||||
dos->writeUTF(_toString(m_health));
|
dos->writeUTF(std::to_wstring(m_health));
|
||||||
}
|
}
|
||||||
if(m_bUpdateFood)
|
if(m_bUpdateFood)
|
||||||
{
|
{
|
||||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_health);
|
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_health);
|
||||||
dos->writeUTF(_toString(m_food));
|
dos->writeUTF(std::to_wstring(m_food));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdatePlayerRuleDefinition::getChildren(vector<GameRuleDefinition *> *children)
|
void UpdatePlayerRuleDefinition::getChildren(vector<GameRuleDefinition *> *children)
|
||||||
{
|
{
|
||||||
GameRuleDefinition::getChildren(children);
|
GameRuleDefinition::getChildren(children);
|
||||||
for(AUTO_VAR(it, m_items.begin()); it!=m_items.end(); it++)
|
for(auto& item : m_items)
|
||||||
children->push_back(*it);
|
children->push_back(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
GameRuleDefinition *UpdatePlayerRuleDefinition::addChild(ConsoleGameRules::EGameRuleType ruleType)
|
GameRuleDefinition *UpdatePlayerRuleDefinition::addChild(ConsoleGameRules::EGameRuleType ruleType)
|
||||||
|
|
@ -162,10 +162,8 @@ void UpdatePlayerRuleDefinition::postProcessPlayer(shared_ptr<Player> player)
|
||||||
|
|
||||||
if(m_spawnPos != NULL || m_bUpdateYRot) player->absMoveTo(x,y,z,yRot,xRot);
|
if(m_spawnPos != NULL || m_bUpdateYRot) player->absMoveTo(x,y,z,yRot,xRot);
|
||||||
|
|
||||||
for(AUTO_VAR(it, m_items.begin()); it != m_items.end(); ++it)
|
for(auto& addItem : m_items)
|
||||||
{
|
{
|
||||||
AddItemRuleDefinition *addItem = *it;
|
|
||||||
|
|
||||||
addItem->addItemToContainer(player->inventory, -1);
|
addItem->addItemToContainer(player->inventory, -1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -13,19 +13,19 @@ void UseTileRuleDefinition::writeAttributes(DataOutputStream *dos, UINT numAttri
|
||||||
GameRuleDefinition::writeAttributes(dos, numAttributes + 5);
|
GameRuleDefinition::writeAttributes(dos, numAttributes + 5);
|
||||||
|
|
||||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_tileId);
|
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_tileId);
|
||||||
dos->writeUTF(_toString(m_tileId));
|
dos->writeUTF(std::to_wstring(m_tileId));
|
||||||
|
|
||||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_useCoords);
|
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_useCoords);
|
||||||
dos->writeUTF(_toString(m_useCoords));
|
dos->writeUTF(std::to_wstring(m_useCoords));
|
||||||
|
|
||||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_x);
|
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_x);
|
||||||
dos->writeUTF(_toString(m_coordinates.x));
|
dos->writeUTF(std::to_wstring(m_coordinates.x));
|
||||||
|
|
||||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_y);
|
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_y);
|
||||||
dos->writeUTF(_toString(m_coordinates.y));
|
dos->writeUTF(std::to_wstring(m_coordinates.y));
|
||||||
|
|
||||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_z);
|
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_z);
|
||||||
dos->writeUTF(_toString(m_coordinates.z));
|
dos->writeUTF(std::to_wstring(m_coordinates.z));
|
||||||
}
|
}
|
||||||
|
|
||||||
void UseTileRuleDefinition::addAttribute(const wstring &attributeName, const wstring &attributeValue)
|
void UseTileRuleDefinition::addAttribute(const wstring &attributeName, const wstring &attributeValue)
|
||||||
|
|
|
||||||
|
|
@ -14,25 +14,25 @@ void XboxStructureActionGenerateBox::writeAttributes(DataOutputStream *dos, UINT
|
||||||
ConsoleGenerateStructureAction::writeAttributes(dos, numAttrs + 9);
|
ConsoleGenerateStructureAction::writeAttributes(dos, numAttrs + 9);
|
||||||
|
|
||||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_x0);
|
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_x0);
|
||||||
dos->writeUTF(_toString(m_x0));
|
dos->writeUTF(std::to_wstring(m_x0));
|
||||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_y0);
|
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_y0);
|
||||||
dos->writeUTF(_toString(m_y0));
|
dos->writeUTF(std::to_wstring(m_y0));
|
||||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_z0);
|
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_z0);
|
||||||
dos->writeUTF(_toString(m_z0));
|
dos->writeUTF(std::to_wstring(m_z0));
|
||||||
|
|
||||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_x1);
|
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_x1);
|
||||||
dos->writeUTF(_toString(m_x1));
|
dos->writeUTF(std::to_wstring(m_x1));
|
||||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_y1);
|
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_y1);
|
||||||
dos->writeUTF(_toString(m_y1));
|
dos->writeUTF(std::to_wstring(m_y1));
|
||||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_z1);
|
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_z1);
|
||||||
dos->writeUTF(_toString(m_z1));
|
dos->writeUTF(std::to_wstring(m_z1));
|
||||||
|
|
||||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_edgeTile);
|
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_edgeTile);
|
||||||
dos->writeUTF(_toString(m_edgeTile));
|
dos->writeUTF(std::to_wstring(m_edgeTile));
|
||||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_fillTile);
|
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_fillTile);
|
||||||
dos->writeUTF(_toString(m_fillTile));
|
dos->writeUTF(std::to_wstring(m_fillTile));
|
||||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_skipAir);
|
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_skipAir);
|
||||||
dos->writeUTF(_toString(m_skipAir));
|
dos->writeUTF(std::to_wstring(m_skipAir));
|
||||||
}
|
}
|
||||||
|
|
||||||
void XboxStructureActionGenerateBox::addAttribute(const wstring &attributeName, const wstring &attributeValue)
|
void XboxStructureActionGenerateBox::addAttribute(const wstring &attributeName, const wstring &attributeValue)
|
||||||
|
|
|
||||||
|
|
@ -13,16 +13,16 @@ void XboxStructureActionPlaceBlock::writeAttributes(DataOutputStream *dos, UINT
|
||||||
ConsoleGenerateStructureAction::writeAttributes(dos, numAttrs + 5);
|
ConsoleGenerateStructureAction::writeAttributes(dos, numAttrs + 5);
|
||||||
|
|
||||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_x);
|
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_x);
|
||||||
dos->writeUTF(_toString(m_x));
|
dos->writeUTF(std::to_wstring(m_x));
|
||||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_y);
|
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_y);
|
||||||
dos->writeUTF(_toString(m_y));
|
dos->writeUTF(std::to_wstring(m_y));
|
||||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_z);
|
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_z);
|
||||||
dos->writeUTF(_toString(m_z));
|
dos->writeUTF(std::to_wstring(m_z));
|
||||||
|
|
||||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_data);
|
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_data);
|
||||||
dos->writeUTF(_toString(m_data));
|
dos->writeUTF(std::to_wstring(m_data));
|
||||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_block);
|
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_block);
|
||||||
dos->writeUTF(_toString(m_tile));
|
dos->writeUTF(std::to_wstring(m_tile));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,21 +14,21 @@ XboxStructureActionPlaceContainer::XboxStructureActionPlaceContainer()
|
||||||
|
|
||||||
XboxStructureActionPlaceContainer::~XboxStructureActionPlaceContainer()
|
XboxStructureActionPlaceContainer::~XboxStructureActionPlaceContainer()
|
||||||
{
|
{
|
||||||
for(AUTO_VAR(it, m_items.begin()); it != m_items.end(); ++it)
|
for(auto& item : m_items)
|
||||||
{
|
{
|
||||||
delete *it;
|
delete item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4J-JEV: Super class handles attr-facing fine.
|
// 4J-JEV: Super class handles attr-facing fine.
|
||||||
//void XboxStructureActionPlaceContainer::writeAttributes(DataOutputStream *dos, UINT numAttrs)
|
//void XboxStructureActionPlaceContainer::writeAttributes(DataOutputStream *dos, UINT numAttrs)
|
||||||
|
|
||||||
|
|
||||||
void XboxStructureActionPlaceContainer::getChildren(vector<GameRuleDefinition *> *children)
|
void XboxStructureActionPlaceContainer::getChildren(vector<GameRuleDefinition *> *children)
|
||||||
{
|
{
|
||||||
XboxStructureActionPlaceBlock::getChildren(children);
|
XboxStructureActionPlaceBlock::getChildren(children);
|
||||||
for(AUTO_VAR(it, m_items.begin()); it!=m_items.end(); it++)
|
for(auto & item : m_items)
|
||||||
children->push_back( *it );
|
children->push_back( item );
|
||||||
}
|
}
|
||||||
|
|
||||||
GameRuleDefinition *XboxStructureActionPlaceContainer::addChild(ConsoleGameRules::EGameRuleType ruleType)
|
GameRuleDefinition *XboxStructureActionPlaceContainer::addChild(ConsoleGameRules::EGameRuleType ruleType)
|
||||||
|
|
@ -79,15 +79,15 @@ bool XboxStructureActionPlaceContainer::placeContainerInLevel(StructurePiece *st
|
||||||
|
|
||||||
level->setTileAndData( worldX, worldY, worldZ, m_tile, 0, Tile::UPDATE_ALL );
|
level->setTileAndData( worldX, worldY, worldZ, m_tile, 0, Tile::UPDATE_ALL );
|
||||||
shared_ptr<Container> container = dynamic_pointer_cast<Container>(level->getTileEntity( worldX, worldY, worldZ ));
|
shared_ptr<Container> container = dynamic_pointer_cast<Container>(level->getTileEntity( worldX, worldY, worldZ ));
|
||||||
|
|
||||||
app.DebugPrintf("XboxStructureActionPlaceContainer - placing a container at (%d,%d,%d)\n", worldX, worldY, worldZ);
|
app.DebugPrintf("XboxStructureActionPlaceContainer - placing a container at (%d,%d,%d)\n", worldX, worldY, worldZ);
|
||||||
if ( container != NULL )
|
if ( container != NULL )
|
||||||
{
|
{
|
||||||
level->setData( worldX, worldY, worldZ, m_data, Tile::UPDATE_CLIENTS);
|
level->setData( worldX, worldY, worldZ, m_data, Tile::UPDATE_CLIENTS);
|
||||||
// Add items
|
// Add items
|
||||||
int slotId = 0;
|
int slotId = 0;
|
||||||
for(AUTO_VAR(it, m_items.begin()); it != m_items.end() && (slotId < container->getContainerSize()); ++it, ++slotId )
|
for (auto it = m_items.begin(); it != m_items.end() && (slotId < container->getContainerSize()); ++it, ++slotId)
|
||||||
{
|
{
|
||||||
AddItemRuleDefinition *addItem = *it;
|
AddItemRuleDefinition *addItem = *it;
|
||||||
|
|
||||||
addItem->addItemToContainer(container,slotId);
|
addItem->addItemToContainer(container,slotId);
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,7 @@ void CGameNetworkManager::Initialise()
|
||||||
#else
|
#else
|
||||||
s_pPlatformNetworkManager = new CPlatformNetworkManagerStub();
|
s_pPlatformNetworkManager = new CPlatformNetworkManagerStub();
|
||||||
#endif
|
#endif
|
||||||
s_pPlatformNetworkManager->Initialise( this, flagIndexSize );
|
s_pPlatformNetworkManager->Initialise( this, flagIndexSize );
|
||||||
m_bNetworkThreadRunning = false;
|
m_bNetworkThreadRunning = false;
|
||||||
m_bInitialised = true;
|
m_bInitialised = true;
|
||||||
}
|
}
|
||||||
|
|
@ -105,7 +105,7 @@ void CGameNetworkManager::DoWork()
|
||||||
if((g_NetworkManager.GetLockedProfile()!=-1) && iPrimaryPlayer!=-1 && bConnected == false && g_NetworkManager.IsInSession() )
|
if((g_NetworkManager.GetLockedProfile()!=-1) && iPrimaryPlayer!=-1 && bConnected == false && g_NetworkManager.IsInSession() )
|
||||||
{
|
{
|
||||||
app.SetAction(iPrimaryPlayer,eAppAction_EthernetDisconnected);
|
app.SetAction(iPrimaryPlayer,eAppAction_EthernetDisconnected);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case XN_LIVE_INVITE_ACCEPTED:
|
case XN_LIVE_INVITE_ACCEPTED:
|
||||||
|
|
@ -162,7 +162,7 @@ bool CGameNetworkManager::_RunNetworkGame(LPVOID lpParameter)
|
||||||
|
|
||||||
success = s_pPlatformNetworkManager->_RunNetworkGame();
|
success = s_pPlatformNetworkManager->_RunNetworkGame();
|
||||||
if(!success)
|
if(!success)
|
||||||
{
|
{
|
||||||
app.SetAction(ProfileManager.GetPrimaryPad(),eAppAction_ExitWorld,(void *)TRUE);
|
app.SetAction(ProfileManager.GetPrimaryPad(),eAppAction_ExitWorld,(void *)TRUE);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -172,7 +172,7 @@ bool CGameNetworkManager::_RunNetworkGame(LPVOID lpParameter)
|
||||||
// Client needs QNET_STATE_GAME_PLAY so that IsInGameplay() returns true
|
// Client needs QNET_STATE_GAME_PLAY so that IsInGameplay() returns true
|
||||||
s_pPlatformNetworkManager->SetGamePlayState();
|
s_pPlatformNetworkManager->SetGamePlayState();
|
||||||
}
|
}
|
||||||
|
|
||||||
if( g_NetworkManager.IsLeavingGame() ) return false;
|
if( g_NetworkManager.IsLeavingGame() ) return false;
|
||||||
|
|
||||||
app.SetGameStarted(true);
|
app.SetGameStarted(true);
|
||||||
|
|
@ -199,7 +199,7 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, LPVOID lpParame
|
||||||
{
|
{
|
||||||
NetworkGameInitData *param = (NetworkGameInitData *)lpParameter;
|
NetworkGameInitData *param = (NetworkGameInitData *)lpParameter;
|
||||||
seed = param->seed;
|
seed = param->seed;
|
||||||
|
|
||||||
app.setLevelGenerationOptions(param->levelGen);
|
app.setLevelGenerationOptions(param->levelGen);
|
||||||
if(param->levelGen != NULL)
|
if(param->levelGen != NULL)
|
||||||
{
|
{
|
||||||
|
|
@ -305,7 +305,7 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, LPVOID lpParame
|
||||||
ServerReadyWait();
|
ServerReadyWait();
|
||||||
ServerReadyDestroy();
|
ServerReadyDestroy();
|
||||||
|
|
||||||
if( MinecraftServer::serverHalted() )
|
if( MinecraftServer::serverHalted() )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// printf("Server ready to go!\n");
|
// printf("Server ready to go!\n");
|
||||||
|
|
@ -316,7 +316,7 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, LPVOID lpParame
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef _XBOX
|
#ifndef _XBOX
|
||||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||||
// Make sure that we have transitioned through any joining/creating stages and are actually playing the game, so that we know the players should be valid
|
// Make sure that we have transitioned through any joining/creating stages and are actually playing the game, so that we know the players should be valid
|
||||||
bool changedMessage = false;
|
bool changedMessage = false;
|
||||||
while(!IsReadyToPlayOrIdle())
|
while(!IsReadyToPlayOrIdle())
|
||||||
|
|
@ -492,9 +492,10 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, LPVOID lpParame
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
// We need to keep ticking the connections for players that already logged in
|
// We need to keep ticking the connections for players that already logged in
|
||||||
for(AUTO_VAR(it, createdConnections.begin()); it < createdConnections.end(); ++it)
|
for (auto& it : createdConnections )
|
||||||
{
|
{
|
||||||
(*it)->tick();
|
if ( it )
|
||||||
|
it->tick();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4J Stu - We were ticking this way too fast which could cause the connection to time out
|
// 4J Stu - We were ticking this way too fast which could cause the connection to time out
|
||||||
|
|
@ -522,8 +523,8 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, LPVOID lpParame
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
connection->close();
|
connection->close();
|
||||||
AUTO_VAR(it, find( createdConnections.begin(), createdConnections.end(), connection ));
|
auto it = find(createdConnections.begin(), createdConnections.end(), connection);
|
||||||
if(it != createdConnections.end() ) createdConnections.erase( it );
|
if(it != createdConnections.end() ) createdConnections.erase( it );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -536,12 +537,12 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, LPVOID lpParame
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(g_NetworkManager.IsLeavingGame() || !IsInSession() )
|
if(g_NetworkManager.IsLeavingGame() || !IsInSession() )
|
||||||
{
|
{
|
||||||
for(AUTO_VAR(it, createdConnections.begin()); it < createdConnections.end(); ++it)
|
for (auto& it : createdConnections)
|
||||||
{
|
{
|
||||||
(*it)->close();
|
it->close();
|
||||||
}
|
}
|
||||||
// assert(false);
|
// assert(false);
|
||||||
MinecraftServer::HaltServer();
|
MinecraftServer::HaltServer();
|
||||||
|
|
@ -832,7 +833,7 @@ int CGameNetworkManager::JoinFromInvite_SignInReturned(void *pParam,bool bContin
|
||||||
ProfileManager.SetPrimaryPad(iPad);
|
ProfileManager.SetPrimaryPad(iPad);
|
||||||
|
|
||||||
g_NetworkManager.SetLocalGame(false);
|
g_NetworkManager.SetLocalGame(false);
|
||||||
|
|
||||||
// If the player was signed in before selecting play, we'll not have read the profile yet, so query the sign-in status to get this to happen
|
// If the player was signed in before selecting play, we'll not have read the profile yet, so query the sign-in status to get this to happen
|
||||||
ProfileManager.QuerySigninStatus();
|
ProfileManager.QuerySigninStatus();
|
||||||
|
|
||||||
|
|
@ -848,7 +849,7 @@ int CGameNetworkManager::JoinFromInvite_SignInReturned(void *pParam,bool bContin
|
||||||
pInviteInfo ); // pInviteInfo
|
pInviteInfo ); // pInviteInfo
|
||||||
if( !success )
|
if( !success )
|
||||||
{
|
{
|
||||||
app.DebugPrintf( "Failed joining game from invite\n" );
|
app.DebugPrintf( "Failed joining game from invite\n" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -894,7 +895,7 @@ int CGameNetworkManager::RunNetworkGameThreadProc( void* lpParameter )
|
||||||
Compression::UseDefaultThreadStorage();
|
Compression::UseDefaultThreadStorage();
|
||||||
Tile::CreateNewThreadStorage();
|
Tile::CreateNewThreadStorage();
|
||||||
IntCache::CreateNewThreadStorage();
|
IntCache::CreateNewThreadStorage();
|
||||||
|
|
||||||
g_NetworkManager.m_bNetworkThreadRunning = true;
|
g_NetworkManager.m_bNetworkThreadRunning = true;
|
||||||
bool success = g_NetworkManager._RunNetworkGame(lpParameter);
|
bool success = g_NetworkManager._RunNetworkGame(lpParameter);
|
||||||
g_NetworkManager.m_bNetworkThreadRunning = false;
|
g_NetworkManager.m_bNetworkThreadRunning = false;
|
||||||
|
|
@ -906,7 +907,7 @@ int CGameNetworkManager::RunNetworkGameThreadProc( void* lpParameter )
|
||||||
Sleep(1);
|
Sleep(1);
|
||||||
}
|
}
|
||||||
ui.CleanUpSkinReload();
|
ui.CleanUpSkinReload();
|
||||||
if(app.GetDisconnectReason() == DisconnectPacket::eDisconnect_None)
|
if(app.GetDisconnectReason() == DisconnectPacket::eDisconnect_None)
|
||||||
{
|
{
|
||||||
app.SetDisconnectReason( DisconnectPacket::eDisconnect_ConnectionCreationFailed );
|
app.SetDisconnectReason( DisconnectPacket::eDisconnect_ConnectionCreationFailed );
|
||||||
}
|
}
|
||||||
|
|
@ -949,7 +950,7 @@ int CGameNetworkManager::ServerThreadProc( void* lpParameter )
|
||||||
SetThreadName(-1, "Minecraft Server thread");
|
SetThreadName(-1, "Minecraft Server thread");
|
||||||
AABB::CreateNewThreadStorage();
|
AABB::CreateNewThreadStorage();
|
||||||
Vec3::CreateNewThreadStorage();
|
Vec3::CreateNewThreadStorage();
|
||||||
IntCache::CreateNewThreadStorage();
|
IntCache::CreateNewThreadStorage();
|
||||||
Compression::UseDefaultThreadStorage();
|
Compression::UseDefaultThreadStorage();
|
||||||
OldChunkStorage::UseDefaultThreadStorage();
|
OldChunkStorage::UseDefaultThreadStorage();
|
||||||
Entity::useSmallIds();
|
Entity::useSmallIds();
|
||||||
|
|
@ -958,7 +959,7 @@ int CGameNetworkManager::ServerThreadProc( void* lpParameter )
|
||||||
FireworksRecipe::CreateNewThreadStorage();
|
FireworksRecipe::CreateNewThreadStorage();
|
||||||
|
|
||||||
MinecraftServer::main(seed, lpParameter); //saveData, app.GetGameHostOption(eGameHostOption_All));
|
MinecraftServer::main(seed, lpParameter); //saveData, app.GetGameHostOption(eGameHostOption_All));
|
||||||
|
|
||||||
Tile::ReleaseThreadStorage();
|
Tile::ReleaseThreadStorage();
|
||||||
AABB::ReleaseThreadStorage();
|
AABB::ReleaseThreadStorage();
|
||||||
Vec3::ReleaseThreadStorage();
|
Vec3::ReleaseThreadStorage();
|
||||||
|
|
@ -1012,7 +1013,7 @@ int CGameNetworkManager::ExitAndJoinFromInviteThreadProc( void* lpParam )
|
||||||
// The pair of methods MustSignInReturned_0 & PSNSignInReturned_0 handle this
|
// The pair of methods MustSignInReturned_0 & PSNSignInReturned_0 handle this
|
||||||
int CGameNetworkManager::MustSignInReturned_0(void *pParam,int iPad,C4JStorage::EMessageResult result)
|
int CGameNetworkManager::MustSignInReturned_0(void *pParam,int iPad,C4JStorage::EMessageResult result)
|
||||||
{
|
{
|
||||||
if(result==C4JStorage::EMessage_ResultAccept)
|
if(result==C4JStorage::EMessage_ResultAccept)
|
||||||
{
|
{
|
||||||
#ifdef __PS3__
|
#ifdef __PS3__
|
||||||
SQRNetworkManager_PS3::AttemptPSNSignIn(&CGameNetworkManager::PSNSignInReturned_0, pParam,true);
|
SQRNetworkManager_PS3::AttemptPSNSignIn(&CGameNetworkManager::PSNSignInReturned_0, pParam,true);
|
||||||
|
|
@ -1072,7 +1073,7 @@ int CGameNetworkManager::PSNSignInReturned_0(void* pParam, bool bContinue, int i
|
||||||
// The pair of methods MustSignInReturned_1 & PSNSignInReturned_1 handle this
|
// The pair of methods MustSignInReturned_1 & PSNSignInReturned_1 handle this
|
||||||
int CGameNetworkManager::MustSignInReturned_1(void *pParam,int iPad,C4JStorage::EMessageResult result)
|
int CGameNetworkManager::MustSignInReturned_1(void *pParam,int iPad,C4JStorage::EMessageResult result)
|
||||||
{
|
{
|
||||||
if(result==C4JStorage::EMessage_ResultAccept)
|
if(result==C4JStorage::EMessage_ResultAccept)
|
||||||
{
|
{
|
||||||
#ifdef __PS3__
|
#ifdef __PS3__
|
||||||
SQRNetworkManager_PS3::AttemptPSNSignIn(&CGameNetworkManager::PSNSignInReturned_1, pParam,true);
|
SQRNetworkManager_PS3::AttemptPSNSignIn(&CGameNetworkManager::PSNSignInReturned_1, pParam,true);
|
||||||
|
|
@ -1104,7 +1105,7 @@ int CGameNetworkManager::PSNSignInReturned_1(void* pParam, bool bContinue, int i
|
||||||
#elif defined __ORBIS__
|
#elif defined __ORBIS__
|
||||||
// TODO: No Orbis equivalent (should there be?)
|
// TODO: No Orbis equivalent (should there be?)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1129,7 +1130,7 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc( void* lpParam )
|
||||||
Vec3::UseDefaultThreadStorage();
|
Vec3::UseDefaultThreadStorage();
|
||||||
Compression::UseDefaultThreadStorage();
|
Compression::UseDefaultThreadStorage();
|
||||||
|
|
||||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||||
MinecraftServer *pServer = MinecraftServer::getInstance();
|
MinecraftServer *pServer = MinecraftServer::getInstance();
|
||||||
|
|
||||||
#if defined(__PS3__) || defined(__ORBIS__) || defined __PSVITA__
|
#if defined(__PS3__) || defined(__ORBIS__) || defined __PSVITA__
|
||||||
|
|
@ -1168,7 +1169,7 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc( void* lpParam )
|
||||||
pMinecraft->progressRenderer->progressStartNoAbort( g_NetworkManager.CorrectErrorIDS(IDS_CONNECTION_LOST_LIVE_NO_EXIT) );
|
pMinecraft->progressRenderer->progressStartNoAbort( g_NetworkManager.CorrectErrorIDS(IDS_CONNECTION_LOST_LIVE_NO_EXIT) );
|
||||||
pMinecraft->progressRenderer->progressStage( IDS_PROGRESS_CONVERTING_TO_OFFLINE_GAME );
|
pMinecraft->progressRenderer->progressStage( IDS_PROGRESS_CONVERTING_TO_OFFLINE_GAME );
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
pMinecraft->progressRenderer->progressStartNoAbort( g_NetworkManager.CorrectErrorIDS(IDS_CONNECTION_LOST_LIVE_NO_EXIT) );
|
pMinecraft->progressRenderer->progressStartNoAbort( g_NetworkManager.CorrectErrorIDS(IDS_CONNECTION_LOST_LIVE_NO_EXIT) );
|
||||||
pMinecraft->progressRenderer->progressStage( IDS_PROGRESS_CONVERTING_TO_OFFLINE_GAME );
|
pMinecraft->progressRenderer->progressStage( IDS_PROGRESS_CONVERTING_TO_OFFLINE_GAME );
|
||||||
|
|
@ -1182,7 +1183,7 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc( void* lpParam )
|
||||||
|
|
||||||
// wait for the server to be in a non-ticking state
|
// wait for the server to be in a non-ticking state
|
||||||
pServer->m_serverPausedEvent->WaitForSignal(INFINITE);
|
pServer->m_serverPausedEvent->WaitForSignal(INFINITE);
|
||||||
|
|
||||||
#if defined(__PS3__) || defined(__ORBIS__) || defined __PSVITA__
|
#if defined(__PS3__) || defined(__ORBIS__) || defined __PSVITA__
|
||||||
// Swap these two messages around as one is too long to display at 480
|
// Swap these two messages around as one is too long to display at 480
|
||||||
pMinecraft->progressRenderer->progressStartNoAbort( IDS_PROGRESS_CONVERTING_TO_OFFLINE_GAME );
|
pMinecraft->progressRenderer->progressStartNoAbort( IDS_PROGRESS_CONVERTING_TO_OFFLINE_GAME );
|
||||||
|
|
@ -1218,9 +1219,8 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc( void* lpParam )
|
||||||
if( pServer != NULL )
|
if( pServer != NULL )
|
||||||
{
|
{
|
||||||
PlayerList *players = pServer->getPlayers();
|
PlayerList *players = pServer->getPlayers();
|
||||||
for(AUTO_VAR(it, players->players.begin()); it < players->players.end(); ++it)
|
for(auto& servPlayer : players->players)
|
||||||
{
|
{
|
||||||
shared_ptr<ServerPlayer> servPlayer = *it;
|
|
||||||
if( servPlayer->connection->isLocal() && !servPlayer->connection->isGuest() )
|
if( servPlayer->connection->isLocal() && !servPlayer->connection->isGuest() )
|
||||||
{
|
{
|
||||||
servPlayer->connection->connection->getSocket()->setPlayer(NULL);
|
servPlayer->connection->connection->getSocket()->setPlayer(NULL);
|
||||||
|
|
@ -1244,7 +1244,7 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc( void* lpParam )
|
||||||
{
|
{
|
||||||
Sleep(1);
|
Sleep(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reset this flag as the we don't need to know that we only lost the room only from this point onwards, the behaviour is exactly the same
|
// Reset this flag as the we don't need to know that we only lost the room only from this point onwards, the behaviour is exactly the same
|
||||||
g_NetworkManager.m_bLastDisconnectWasLostRoomOnly = false;
|
g_NetworkManager.m_bLastDisconnectWasLostRoomOnly = false;
|
||||||
g_NetworkManager.m_bFullSessionMessageOnNextSessionChange = false;
|
g_NetworkManager.m_bFullSessionMessageOnNextSessionChange = false;
|
||||||
|
|
@ -1275,7 +1275,7 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc( void* lpParam )
|
||||||
{
|
{
|
||||||
Sleep(1);
|
Sleep(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Restore the network player of all the server players that are local
|
// Restore the network player of all the server players that are local
|
||||||
if( pServer != NULL )
|
if( pServer != NULL )
|
||||||
{
|
{
|
||||||
|
|
@ -1286,9 +1286,8 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc( void* lpParam )
|
||||||
PlayerUID localPlayerXuid = pMinecraft->localplayers[index]->getXuid();
|
PlayerUID localPlayerXuid = pMinecraft->localplayers[index]->getXuid();
|
||||||
|
|
||||||
PlayerList *players = pServer->getPlayers();
|
PlayerList *players = pServer->getPlayers();
|
||||||
for(AUTO_VAR(it, players->players.begin()); it < players->players.end(); ++it)
|
for(auto& servPlayer : players->players)
|
||||||
{
|
{
|
||||||
shared_ptr<ServerPlayer> servPlayer = *it;
|
|
||||||
if( servPlayer->getXuid() == localPlayerXuid )
|
if( servPlayer->getXuid() == localPlayerXuid )
|
||||||
{
|
{
|
||||||
servPlayer->connection->connection->getSocket()->setPlayer( g_NetworkManager.GetLocalPlayerByUserIndex(index) );
|
servPlayer->connection->connection->getSocket()->setPlayer( g_NetworkManager.GetLocalPlayerByUserIndex(index) );
|
||||||
|
|
@ -1302,7 +1301,7 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc( void* lpParam )
|
||||||
pMinecraft->m_pendingLocalConnections[index]->getConnection()->getSocket()->setPlayer(g_NetworkManager.GetLocalPlayerByUserIndex(index));
|
pMinecraft->m_pendingLocalConnections[index]->getConnection()->getSocket()->setPlayer(g_NetworkManager.GetLocalPlayerByUserIndex(index));
|
||||||
}
|
}
|
||||||
else if ( pMinecraft->m_connectionFailed[index] && (pMinecraft->m_connectionFailedReason[index] == DisconnectPacket::eDisconnect_ConnectionCreationFailed) )
|
else if ( pMinecraft->m_connectionFailed[index] && (pMinecraft->m_connectionFailedReason[index] == DisconnectPacket::eDisconnect_ConnectionCreationFailed) )
|
||||||
{
|
{
|
||||||
pMinecraft->removeLocalPlayerIdx(index);
|
pMinecraft->removeLocalPlayerIdx(index);
|
||||||
#ifdef _XBOX_ONE
|
#ifdef _XBOX_ONE
|
||||||
ProfileManager.RemoveGamepadFromGame(index);
|
ProfileManager.RemoveGamepadFromGame(index);
|
||||||
|
|
@ -1311,7 +1310,7 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc( void* lpParam )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pMinecraft->progressRenderer->progressStagePercentage(100);
|
pMinecraft->progressRenderer->progressStagePercentage(100);
|
||||||
|
|
||||||
#ifndef _XBOX
|
#ifndef _XBOX
|
||||||
|
|
@ -1333,7 +1332,7 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc( void* lpParam )
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Start the game again
|
// Start the game again
|
||||||
app.SetGameStarted(true);
|
app.SetGameStarted(true);
|
||||||
app.SetXuiServerAction(ProfileManager.GetPrimaryPad(),eXuiServerAction_PauseServer,(void *)FALSE);
|
app.SetXuiServerAction(ProfileManager.GetPrimaryPad(),eXuiServerAction_PauseServer,(void *)FALSE);
|
||||||
app.SetChangingSessionType(false);
|
app.SetChangingSessionType(false);
|
||||||
app.SetReallyChangingSessionType(false);
|
app.SetReallyChangingSessionType(false);
|
||||||
|
|
@ -1387,7 +1386,7 @@ void CGameNetworkManager::StateChange_AnyToJoining()
|
||||||
app.DebugPrintf("Disabling Guest Signin\n");
|
app.DebugPrintf("Disabling Guest Signin\n");
|
||||||
XEnableGuestSignin(FALSE);
|
XEnableGuestSignin(FALSE);
|
||||||
Minecraft::GetInstance()->clearPendingClientTextureRequests();
|
Minecraft::GetInstance()->clearPendingClientTextureRequests();
|
||||||
|
|
||||||
ConnectionProgressParams *param = new ConnectionProgressParams();
|
ConnectionProgressParams *param = new ConnectionProgressParams();
|
||||||
param->iPad = ProfileManager.GetPrimaryPad();
|
param->iPad = ProfileManager.GetPrimaryPad();
|
||||||
param->stringId = -1;
|
param->stringId = -1;
|
||||||
|
|
@ -1435,7 +1434,7 @@ void CGameNetworkManager::StateChange_AnyToStarting()
|
||||||
completionData->type = e_ProgressCompletion_CloseAllPlayersUIScenes;
|
completionData->type = e_ProgressCompletion_CloseAllPlayersUIScenes;
|
||||||
completionData->iPad = ProfileManager.GetPrimaryPad();
|
completionData->iPad = ProfileManager.GetPrimaryPad();
|
||||||
loadingParams->completionData = completionData;
|
loadingParams->completionData = completionData;
|
||||||
|
|
||||||
ui.NavigateToScene(ProfileManager.GetPrimaryPad(),eUIScene_FullscreenProgress, loadingParams);
|
ui.NavigateToScene(ProfileManager.GetPrimaryPad(),eUIScene_FullscreenProgress, loadingParams);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1559,7 +1558,7 @@ void CGameNetworkManager::PlayerJoining( INetworkPlayer *pNetworkPlayer )
|
||||||
bool multiplayer = g_NetworkManager.GetPlayerCount() > 1, localgame = g_NetworkManager.IsLocalGame();
|
bool multiplayer = g_NetworkManager.GetPlayerCount() > 1, localgame = g_NetworkManager.IsLocalGame();
|
||||||
for (int iPad=0; iPad<XUSER_MAX_COUNT; ++iPad)
|
for (int iPad=0; iPad<XUSER_MAX_COUNT; ++iPad)
|
||||||
{
|
{
|
||||||
INetworkPlayer *pNetworkPlayer = g_NetworkManager.GetLocalPlayerByUserIndex(iPad);
|
INetworkPlayer *pNetworkPlayer = g_NetworkManager.GetLocalPlayerByUserIndex(iPad);
|
||||||
if (pNetworkPlayer == NULL) continue;
|
if (pNetworkPlayer == NULL) continue;
|
||||||
|
|
||||||
app.SetRichPresenceContext(iPad,CONTEXT_GAME_STATE_BLANK);
|
app.SetRichPresenceContext(iPad,CONTEXT_GAME_STATE_BLANK);
|
||||||
|
|
@ -1584,7 +1583,7 @@ void CGameNetworkManager::PlayerJoining( INetworkPlayer *pNetworkPlayer )
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if( !pNetworkPlayer->IsHost() )
|
if( !pNetworkPlayer->IsHost() )
|
||||||
{
|
{
|
||||||
for(int idx = 0; idx < XUSER_MAX_COUNT; ++idx)
|
for(int idx = 0; idx < XUSER_MAX_COUNT; ++idx)
|
||||||
{
|
{
|
||||||
if(Minecraft::GetInstance()->localplayers[idx] != NULL)
|
if(Minecraft::GetInstance()->localplayers[idx] != NULL)
|
||||||
|
|
@ -1640,7 +1639,7 @@ void CGameNetworkManager::GameInviteReceived( int userIndex, const INVITE_INFO *
|
||||||
}
|
}
|
||||||
|
|
||||||
// Need to check we're signed in to PSN
|
// Need to check we're signed in to PSN
|
||||||
bool isSignedInLive = true;
|
bool isSignedInLive = true;
|
||||||
bool isLocalMultiplayerAvailable = app.IsLocalMultiplayerAvailable();
|
bool isLocalMultiplayerAvailable = app.IsLocalMultiplayerAvailable();
|
||||||
int iPadNotSignedInLive = -1;
|
int iPadNotSignedInLive = -1;
|
||||||
for(unsigned int i = 0; i < XUSER_MAX_COUNT; i++)
|
for(unsigned int i = 0; i < XUSER_MAX_COUNT; i++)
|
||||||
|
|
@ -1680,7 +1679,7 @@ void CGameNetworkManager::GameInviteReceived( int userIndex, const INVITE_INFO *
|
||||||
ui.RequestErrorMessage( IDS_ERROR_NETWORK_TITLE, IDS_ERROR_NETWORK, uiIDA, 1, iPadNotSignedInLive);
|
ui.RequestErrorMessage( IDS_ERROR_NETWORK_TITLE, IDS_ERROR_NETWORK, uiIDA, 1, iPadNotSignedInLive);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Not signed in to PSN
|
// Not signed in to PSN
|
||||||
UINT uiIDA[1];
|
UINT uiIDA[1];
|
||||||
uiIDA[0] = IDS_PRO_NOTONLINE_ACCEPT;
|
uiIDA[0] = IDS_PRO_NOTONLINE_ACCEPT;
|
||||||
|
|
@ -1700,10 +1699,10 @@ void CGameNetworkManager::GameInviteReceived( int userIndex, const INVITE_INFO *
|
||||||
{
|
{
|
||||||
m_pInviteInfo = (INVITE_INFO *) pInviteInfo;
|
m_pInviteInfo = (INVITE_INFO *) pInviteInfo;
|
||||||
m_iPlayerInvited = userIndex;
|
m_iPlayerInvited = userIndex;
|
||||||
|
|
||||||
m_pUpsell = new PsPlusUpsellWrapper(index);
|
m_pUpsell = new PsPlusUpsellWrapper(index);
|
||||||
m_pUpsell->displayUpsell();
|
m_pUpsell->displayUpsell();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1723,9 +1722,9 @@ void CGameNetworkManager::GameInviteReceived( int userIndex, const INVITE_INFO *
|
||||||
// 4J-PB we shouldn't bring any inactive players into the game, except for the invited player (who may be an inactive player)
|
// 4J-PB we shouldn't bring any inactive players into the game, 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
|
// 4J Stu - If we are not in a game, then bring in all players signed in
|
||||||
if(index==userIndex || pMinecraft->localplayers[index]!=NULL )
|
if(index==userIndex || pMinecraft->localplayers[index]!=NULL )
|
||||||
{
|
{
|
||||||
++joiningUsers;
|
++joiningUsers;
|
||||||
if( !ProfileManager.AllowedToPlayMultiplayer(index) ) noPrivileges = true;
|
if( !ProfileManager.AllowedToPlayMultiplayer(index) ) noPrivileges = true;
|
||||||
localUsersMask |= GetLocalPlayerMask( index );
|
localUsersMask |= GetLocalPlayerMask( index );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1742,7 +1741,7 @@ void CGameNetworkManager::GameInviteReceived( int userIndex, const INVITE_INFO *
|
||||||
ProfileManager.AllowedPlayerCreatedContent(ProfileManager.GetPrimaryPad(),false,&pccAllowed,&pccFriendsAllowed);
|
ProfileManager.AllowedPlayerCreatedContent(ProfileManager.GetPrimaryPad(),false,&pccAllowed,&pccFriendsAllowed);
|
||||||
if(!pccAllowed && !pccFriendsAllowed) noUGC = true;
|
if(!pccAllowed && !pccFriendsAllowed) noUGC = true;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(_XBOX) || defined(__PS3__)
|
#if defined(_XBOX) || defined(__PS3__)
|
||||||
if(joiningUsers > 1 && !RenderManager.IsHiDef() && userIndex != ProfileManager.GetPrimaryPad())
|
if(joiningUsers > 1 && !RenderManager.IsHiDef() && userIndex != ProfileManager.GetPrimaryPad())
|
||||||
{
|
{
|
||||||
|
|
@ -1796,10 +1795,10 @@ void CGameNetworkManager::GameInviteReceived( int userIndex, const INVITE_INFO *
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if( !g_NetworkManager.IsInSession() )
|
if( !g_NetworkManager.IsInSession() )
|
||||||
{
|
{
|
||||||
#if defined (__PS3__) || defined (__PSVITA__)
|
#if defined (__PS3__) || defined (__PSVITA__)
|
||||||
// PS3 is more complicated here - we need to make sure that the player is online. If they are then we can do the same as the xbox, if not we need to try and get them online and then, if they do sign in, go down the same path
|
// PS3 is more complicated here - we need to make sure that the player is online. If they are then we can do the same as the xbox, if not we need to try and get them online and then, if they do sign in, go down the same path
|
||||||
|
|
||||||
// Determine why they're not "signed in live"
|
// Determine why they're not "signed in live"
|
||||||
// MGH - On Vita we need to add a new message at some point for connecting when already signed in
|
// MGH - On Vita we need to add a new message at some point for connecting when already signed in
|
||||||
if(ProfileManager.IsSignedInLive(ProfileManager.GetPrimaryPad()))
|
if(ProfileManager.IsSignedInLive(ProfileManager.GetPrimaryPad()))
|
||||||
|
|
@ -1816,7 +1815,7 @@ void CGameNetworkManager::GameInviteReceived( int userIndex, const INVITE_INFO *
|
||||||
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
HandleInviteWhenInMenus(userIndex, pInviteInfo);
|
HandleInviteWhenInMenus(userIndex, pInviteInfo);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -1856,7 +1855,7 @@ void CGameNetworkManager::HandleInviteWhenInMenus( int userIndex, const INVITE_I
|
||||||
if(!ProfileManager.IsFullVersion())
|
if(!ProfileManager.IsFullVersion())
|
||||||
{
|
{
|
||||||
// The marketplace will fail with the primary player set to -1
|
// The marketplace will fail with the primary player set to -1
|
||||||
ProfileManager.SetPrimaryPad(userIndex);
|
ProfileManager.SetPrimaryPad(userIndex);
|
||||||
|
|
||||||
app.SetAction(userIndex,eAppAction_DashboardTrialJoinFromInvite);
|
app.SetAction(userIndex,eAppAction_DashboardTrialJoinFromInvite);
|
||||||
}
|
}
|
||||||
|
|
@ -1900,7 +1899,7 @@ void CGameNetworkManager::HandleInviteWhenInMenus( int userIndex, const INVITE_I
|
||||||
ProfileManager.QuerySigninStatus();
|
ProfileManager.QuerySigninStatus();
|
||||||
|
|
||||||
// 4J-PB - clear any previous connection errors
|
// 4J-PB - clear any previous connection errors
|
||||||
Minecraft::GetInstance()->clearConnectionFailed();
|
Minecraft::GetInstance()->clearConnectionFailed();
|
||||||
|
|
||||||
g_NetworkManager.SetLocalGame(false);
|
g_NetworkManager.SetLocalGame(false);
|
||||||
|
|
||||||
|
|
@ -1910,7 +1909,7 @@ void CGameNetworkManager::HandleInviteWhenInMenus( int userIndex, const INVITE_I
|
||||||
bool success = g_NetworkManager.JoinGameFromInviteInfo( userIndex, localUsersMask, pInviteInfo );
|
bool success = g_NetworkManager.JoinGameFromInviteInfo( userIndex, localUsersMask, pInviteInfo );
|
||||||
if( !success )
|
if( !success )
|
||||||
{
|
{
|
||||||
app.DebugPrintf( "Failed joining game from invite\n" );
|
app.DebugPrintf( "Failed joining game from invite\n" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "..\..\..\Minecraft.World\Socket.h"
|
#include "..\..\..\Minecraft.World\Socket.h"
|
||||||
#include "..\..\..\Minecraft.World\StringHelpers.h"
|
#include "..\..\..\Minecraft.World\StringHelpers.h"
|
||||||
#include "PlatformNetworkManagerStub.h"
|
#include "PlatformNetworkManagerStub.h"
|
||||||
|
|
@ -64,9 +64,8 @@ void CPlatformNetworkManagerStub::NotifyPlayerJoined(IQNetPlayer *pQNetPlayer )
|
||||||
{
|
{
|
||||||
// Do we already have a primary player for this system?
|
// Do we already have a primary player for this system?
|
||||||
bool systemHasPrimaryPlayer = false;
|
bool systemHasPrimaryPlayer = false;
|
||||||
for(AUTO_VAR(it, m_machineQNetPrimaryPlayers.begin()); it < m_machineQNetPrimaryPlayers.end(); ++it)
|
for (auto& pQNetPrimaryPlayer : m_machineQNetPrimaryPlayers)
|
||||||
{
|
{
|
||||||
IQNetPlayer *pQNetPrimaryPlayer = *it;
|
|
||||||
if( pQNetPlayer->IsSameSystem(pQNetPrimaryPlayer) )
|
if( pQNetPlayer->IsSameSystem(pQNetPrimaryPlayer) )
|
||||||
{
|
{
|
||||||
systemHasPrimaryPlayer = true;
|
systemHasPrimaryPlayer = true;
|
||||||
|
|
@ -78,7 +77,7 @@ void CPlatformNetworkManagerStub::NotifyPlayerJoined(IQNetPlayer *pQNetPlayer )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
g_NetworkManager.PlayerJoining( networkPlayer );
|
g_NetworkManager.PlayerJoining( networkPlayer );
|
||||||
|
|
||||||
if( createFakeSocket == true && !m_bHostChanged )
|
if( createFakeSocket == true && !m_bHostChanged )
|
||||||
{
|
{
|
||||||
g_NetworkManager.CreateSocket( networkPlayer, localPlayer );
|
g_NetworkManager.CreateSocket( networkPlayer, localPlayer );
|
||||||
|
|
@ -98,7 +97,7 @@ void CPlatformNetworkManagerStub::NotifyPlayerJoined(IQNetPlayer *pQNetPlayer )
|
||||||
// g_NetworkManager.UpdateAndSetGameSessionData();
|
// g_NetworkManager.UpdateAndSetGameSessionData();
|
||||||
SystemFlagAddPlayer( networkPlayer );
|
SystemFlagAddPlayer( networkPlayer );
|
||||||
}
|
}
|
||||||
|
|
||||||
for( int idx = 0; idx < XUSER_MAX_COUNT; ++idx)
|
for( int idx = 0; idx < XUSER_MAX_COUNT; ++idx)
|
||||||
{
|
{
|
||||||
if(playerChangedCallback[idx] != NULL)
|
if(playerChangedCallback[idx] != NULL)
|
||||||
|
|
@ -162,7 +161,7 @@ bool CPlatformNetworkManagerStub::Initialise(CGameNetworkManager *pGameNetworkMa
|
||||||
{
|
{
|
||||||
playerChangedCallback[ i ] = NULL;
|
playerChangedCallback[ i ] = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_bLeavingGame = false;
|
m_bLeavingGame = false;
|
||||||
m_bLeaveGameOnTick = false;
|
m_bLeaveGameOnTick = false;
|
||||||
m_bHostChanged = false;
|
m_bHostChanged = false;
|
||||||
|
|
@ -318,8 +317,8 @@ bool CPlatformNetworkManagerStub::LeaveGame(bool bMigrateHost)
|
||||||
m_pIQNet->EndGame();
|
m_pIQNet->EndGame();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (AUTO_VAR(it, currentNetworkPlayers.begin()); it != currentNetworkPlayers.end(); it++)
|
for (auto & it : currentNetworkPlayers)
|
||||||
delete* it;
|
delete it;
|
||||||
currentNetworkPlayers.clear();
|
currentNetworkPlayers.clear();
|
||||||
m_machineQNetPrimaryPlayers.clear();
|
m_machineQNetPrimaryPlayers.clear();
|
||||||
SystemFlagReset();
|
SystemFlagReset();
|
||||||
|
|
@ -473,7 +472,7 @@ void CPlatformNetworkManagerStub::UnRegisterPlayerChangedCallback(int iPad, void
|
||||||
|
|
||||||
void CPlatformNetworkManagerStub::HandleSignInChange()
|
void CPlatformNetworkManagerStub::HandleSignInChange()
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CPlatformNetworkManagerStub::_RunNetworkGame()
|
bool CPlatformNetworkManagerStub::_RunNetworkGame()
|
||||||
|
|
@ -500,24 +499,24 @@ bool CPlatformNetworkManagerStub::_RunNetworkGame()
|
||||||
void CPlatformNetworkManagerStub::UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving /*= NULL*/)
|
void CPlatformNetworkManagerStub::UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving /*= NULL*/)
|
||||||
{
|
{
|
||||||
// DWORD playerCount = m_pIQNet->GetPlayerCount();
|
// DWORD playerCount = m_pIQNet->GetPlayerCount();
|
||||||
//
|
//
|
||||||
// if( this->m_bLeavingGame )
|
// if( this->m_bLeavingGame )
|
||||||
// return;
|
// return;
|
||||||
//
|
//
|
||||||
// if( GetHostPlayer() == NULL )
|
// if( GetHostPlayer() == NULL )
|
||||||
// return;
|
// return;
|
||||||
//
|
//
|
||||||
// for(unsigned int i = 0; i < MINECRAFT_NET_MAX_PLAYERS; ++i)
|
// for(unsigned int i = 0; i < MINECRAFT_NET_MAX_PLAYERS; ++i)
|
||||||
// {
|
// {
|
||||||
// if( i < playerCount )
|
// if( i < playerCount )
|
||||||
// {
|
// {
|
||||||
// INetworkPlayer *pNetworkPlayer = GetPlayerByIndex(i);
|
// INetworkPlayer *pNetworkPlayer = GetPlayerByIndex(i);
|
||||||
//
|
//
|
||||||
// // We can call this from NotifyPlayerLeaving but at that point the player is still considered in the session
|
// // We can call this from NotifyPlayerLeaving but at that point the player is still considered in the session
|
||||||
// if( pNetworkPlayer != pNetworkPlayerLeaving )
|
// if( pNetworkPlayer != pNetworkPlayerLeaving )
|
||||||
// {
|
// {
|
||||||
// m_hostGameSessionData.players[i] = ((NetworkPlayerXbox *)pNetworkPlayer)->GetUID();
|
// m_hostGameSessionData.players[i] = ((NetworkPlayerXbox *)pNetworkPlayer)->GetUID();
|
||||||
//
|
//
|
||||||
// char *temp;
|
// char *temp;
|
||||||
// temp = (char *)wstringtofilename( pNetworkPlayer->GetOnlineName() );
|
// temp = (char *)wstringtofilename( pNetworkPlayer->GetOnlineName() );
|
||||||
// memcpy(m_hostGameSessionData.szPlayers[i],temp,XUSER_NAME_SIZE);
|
// memcpy(m_hostGameSessionData.szPlayers[i],temp,XUSER_NAME_SIZE);
|
||||||
|
|
@ -534,7 +533,7 @@ void CPlatformNetworkManagerStub::UpdateAndSetGameSessionData(INetworkPlayer *pN
|
||||||
// memset(m_hostGameSessionData.szPlayers[i],0,XUSER_NAME_SIZE);
|
// memset(m_hostGameSessionData.szPlayers[i],0,XUSER_NAME_SIZE);
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// m_hostGameSessionData.hostPlayerUID = ((NetworkPlayerXbox *)GetHostPlayer())->GetQNetPlayer()->GetXuid();
|
// m_hostGameSessionData.hostPlayerUID = ((NetworkPlayerXbox *)GetHostPlayer())->GetQNetPlayer()->GetXuid();
|
||||||
// m_hostGameSessionData.m_uiGameHostSettings = app.GetGameHostOption(eGameHostOption_All);
|
// m_hostGameSessionData.m_uiGameHostSettings = app.GetGameHostOption(eGameHostOption_All);
|
||||||
}
|
}
|
||||||
|
|
@ -823,7 +822,7 @@ void CPlatformNetworkManagerStub::GetFullFriendSessionInfo( FriendSessionInfo *f
|
||||||
void CPlatformNetworkManagerStub::ForceFriendsSessionRefresh()
|
void CPlatformNetworkManagerStub::ForceFriendsSessionRefresh()
|
||||||
{
|
{
|
||||||
app.DebugPrintf("Resetting friends session search data\n");
|
app.DebugPrintf("Resetting friends session search data\n");
|
||||||
|
|
||||||
for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i)
|
for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i)
|
||||||
{
|
{
|
||||||
m_searchResultsCount[i] = 0;
|
m_searchResultsCount[i] = 0;
|
||||||
|
|
@ -844,8 +843,8 @@ INetworkPlayer *CPlatformNetworkManagerStub::addNetworkPlayer(IQNetPlayer *pQNet
|
||||||
void CPlatformNetworkManagerStub::removeNetworkPlayer(IQNetPlayer *pQNetPlayer)
|
void CPlatformNetworkManagerStub::removeNetworkPlayer(IQNetPlayer *pQNetPlayer)
|
||||||
{
|
{
|
||||||
INetworkPlayer *pNetworkPlayer = getNetworkPlayer(pQNetPlayer);
|
INetworkPlayer *pNetworkPlayer = getNetworkPlayer(pQNetPlayer);
|
||||||
for( AUTO_VAR(it, currentNetworkPlayers.begin()); it != currentNetworkPlayers.end(); it++ )
|
for (auto it = currentNetworkPlayers.begin(); it != currentNetworkPlayers.end(); it++)
|
||||||
{
|
{
|
||||||
if( *it == pNetworkPlayer )
|
if( *it == pNetworkPlayer )
|
||||||
{
|
{
|
||||||
currentNetworkPlayers.erase(it);
|
currentNetworkPlayers.erase(it);
|
||||||
|
|
@ -862,7 +861,7 @@ INetworkPlayer *CPlatformNetworkManagerStub::getNetworkPlayer(IQNetPlayer *pQNet
|
||||||
|
|
||||||
INetworkPlayer *CPlatformNetworkManagerStub::GetLocalPlayerByUserIndex(int userIndex )
|
INetworkPlayer *CPlatformNetworkManagerStub::GetLocalPlayerByUserIndex(int userIndex )
|
||||||
{
|
{
|
||||||
return getNetworkPlayer(m_pIQNet->GetLocalPlayerByUserIndex(userIndex));
|
return getNetworkPlayer(m_pIQNet->GetLocalPlayerByUserIndex(userIndex));
|
||||||
}
|
}
|
||||||
|
|
||||||
INetworkPlayer *CPlatformNetworkManagerStub::GetPlayerByIndex(int playerIndex)
|
INetworkPlayer *CPlatformNetworkManagerStub::GetPlayerByIndex(int playerIndex)
|
||||||
|
|
|
||||||
|
|
@ -7,21 +7,21 @@
|
||||||
|
|
||||||
CPlatformNetworkManagerSony *g_pPlatformNetworkManager;
|
CPlatformNetworkManagerSony *g_pPlatformNetworkManager;
|
||||||
|
|
||||||
bool CPlatformNetworkManagerSony::IsLocalGame()
|
bool CPlatformNetworkManagerSony::IsLocalGame()
|
||||||
{
|
{
|
||||||
return m_bIsOfflineGame;
|
return m_bIsOfflineGame;
|
||||||
}
|
}
|
||||||
bool CPlatformNetworkManagerSony::IsPrivateGame()
|
bool CPlatformNetworkManagerSony::IsPrivateGame()
|
||||||
{
|
{
|
||||||
return m_bIsPrivateGame;
|
return m_bIsPrivateGame;
|
||||||
}
|
}
|
||||||
bool CPlatformNetworkManagerSony::IsLeavingGame()
|
bool CPlatformNetworkManagerSony::IsLeavingGame()
|
||||||
{
|
{
|
||||||
return m_bLeavingGame;
|
return m_bLeavingGame;
|
||||||
}
|
}
|
||||||
void CPlatformNetworkManagerSony::ResetLeavingGame()
|
void CPlatformNetworkManagerSony::ResetLeavingGame()
|
||||||
{
|
{
|
||||||
m_bLeavingGame = false;
|
m_bLeavingGame = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -188,9 +188,8 @@ void CPlatformNetworkManagerSony::HandlePlayerJoined(SQRNetworkPlayer *
|
||||||
{
|
{
|
||||||
// Do we already have a primary player for this system?
|
// Do we already have a primary player for this system?
|
||||||
bool systemHasPrimaryPlayer = false;
|
bool systemHasPrimaryPlayer = false;
|
||||||
for(AUTO_VAR(it, m_machineSQRPrimaryPlayers.begin()); it < m_machineSQRPrimaryPlayers.end(); ++it)
|
for( SQRNetworkPlayer *pQNetPrimaryPlayer : m_machineSQRPrimaryPlayers )
|
||||||
{
|
{
|
||||||
SQRNetworkPlayer *pQNetPrimaryPlayer = *it;
|
|
||||||
if( pSQRPlayer->IsSameSystem(pQNetPrimaryPlayer) )
|
if( pSQRPlayer->IsSameSystem(pQNetPrimaryPlayer) )
|
||||||
{
|
{
|
||||||
systemHasPrimaryPlayer = true;
|
systemHasPrimaryPlayer = true;
|
||||||
|
|
@ -202,7 +201,7 @@ void CPlatformNetworkManagerSony::HandlePlayerJoined(SQRNetworkPlayer *
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
g_NetworkManager.PlayerJoining( networkPlayer );
|
g_NetworkManager.PlayerJoining( networkPlayer );
|
||||||
|
|
||||||
if( createFakeSocket == true && !m_bHostChanged )
|
if( createFakeSocket == true && !m_bHostChanged )
|
||||||
{
|
{
|
||||||
g_NetworkManager.CreateSocket( networkPlayer, localPlayer );
|
g_NetworkManager.CreateSocket( networkPlayer, localPlayer );
|
||||||
|
|
@ -224,7 +223,7 @@ void CPlatformNetworkManagerSony::HandlePlayerJoined(SQRNetworkPlayer *
|
||||||
g_NetworkManager.UpdateAndSetGameSessionData();
|
g_NetworkManager.UpdateAndSetGameSessionData();
|
||||||
SystemFlagAddPlayer( networkPlayer );
|
SystemFlagAddPlayer( networkPlayer );
|
||||||
}
|
}
|
||||||
|
|
||||||
for( int idx = 0; idx < XUSER_MAX_COUNT; ++idx)
|
for( int idx = 0; idx < XUSER_MAX_COUNT; ++idx)
|
||||||
{
|
{
|
||||||
if(playerChangedCallback[idx] != NULL)
|
if(playerChangedCallback[idx] != NULL)
|
||||||
|
|
@ -293,7 +292,7 @@ void CPlatformNetworkManagerSony::HandlePlayerLeaving(SQRNetworkPlayer *pSQRPlay
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
AUTO_VAR(it, find( m_machineSQRPrimaryPlayers.begin(), m_machineSQRPrimaryPlayers.end(), pSQRPlayer));
|
auto it = find( m_machineSQRPrimaryPlayers.begin(), m_machineSQRPrimaryPlayers.end(), pSQRPlayer);
|
||||||
if( it != m_machineSQRPrimaryPlayers.end() )
|
if( it != m_machineSQRPrimaryPlayers.end() )
|
||||||
{
|
{
|
||||||
m_machineSQRPrimaryPlayers.erase( it );
|
m_machineSQRPrimaryPlayers.erase( it );
|
||||||
|
|
@ -309,7 +308,7 @@ void CPlatformNetworkManagerSony::HandlePlayerLeaving(SQRNetworkPlayer *pSQRPlay
|
||||||
}
|
}
|
||||||
|
|
||||||
g_NetworkManager.PlayerLeaving( networkPlayer );
|
g_NetworkManager.PlayerLeaving( networkPlayer );
|
||||||
|
|
||||||
for( int idx = 0; idx < XUSER_MAX_COUNT; ++idx)
|
for( int idx = 0; idx < XUSER_MAX_COUNT; ++idx)
|
||||||
{
|
{
|
||||||
if(playerChangedCallback[idx] != NULL)
|
if(playerChangedCallback[idx] != NULL)
|
||||||
|
|
@ -374,7 +373,7 @@ bool CPlatformNetworkManagerSony::Initialise(CGameNetworkManager *pGameNetworkMa
|
||||||
#ifdef __ORBIS__
|
#ifdef __ORBIS__
|
||||||
m_pSQRNet = new SQRNetworkManager_Orbis(this);
|
m_pSQRNet = new SQRNetworkManager_Orbis(this);
|
||||||
m_pSQRNet->Initialise();
|
m_pSQRNet->Initialise();
|
||||||
#elif defined __PS3__
|
#elif defined __PS3__
|
||||||
m_pSQRNet = new SQRNetworkManager_PS3(this);
|
m_pSQRNet = new SQRNetworkManager_PS3(this);
|
||||||
m_pSQRNet->Initialise();
|
m_pSQRNet->Initialise();
|
||||||
#else // __PSVITA__
|
#else // __PSVITA__
|
||||||
|
|
@ -405,7 +404,7 @@ bool CPlatformNetworkManagerSony::Initialise(CGameNetworkManager *pGameNetworkMa
|
||||||
{
|
{
|
||||||
playerChangedCallback[ i ] = NULL;
|
playerChangedCallback[ i ] = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_bLeavingGame = false;
|
m_bLeavingGame = false;
|
||||||
m_bLeaveGameOnTick = false;
|
m_bLeaveGameOnTick = false;
|
||||||
m_bHostChanged = false;
|
m_bHostChanged = false;
|
||||||
|
|
@ -419,7 +418,7 @@ bool CPlatformNetworkManagerSony::Initialise(CGameNetworkManager *pGameNetworkMa
|
||||||
|
|
||||||
m_searchResultsCount = 0;
|
m_searchResultsCount = 0;
|
||||||
m_pSearchResults = NULL;
|
m_pSearchResults = NULL;
|
||||||
|
|
||||||
m_lastSearchStartTime = 0;
|
m_lastSearchStartTime = 0;
|
||||||
|
|
||||||
// Success!
|
// Success!
|
||||||
|
|
@ -458,7 +457,7 @@ int CPlatformNetworkManagerSony::CorrectErrorIDS(int IDS)
|
||||||
bool preferSignoutError = false;
|
bool preferSignoutError = false;
|
||||||
int state;
|
int state;
|
||||||
|
|
||||||
#if defined __PSVITA__ // MGH - to fix devtrack #6258
|
#if defined __PSVITA__ // MGH - to fix devtrack #6258
|
||||||
if(!ProfileManager.IsSignedInPSN(ProfileManager.GetPrimaryPad()))
|
if(!ProfileManager.IsSignedInPSN(ProfileManager.GetPrimaryPad()))
|
||||||
preferSignoutError = true;
|
preferSignoutError = true;
|
||||||
#elif defined __ORBIS__
|
#elif defined __ORBIS__
|
||||||
|
|
@ -529,9 +528,8 @@ int CPlatformNetworkManagerSony::CorrectErrorIDS(int IDS)
|
||||||
bool CPlatformNetworkManagerSony::isSystemPrimaryPlayer(SQRNetworkPlayer *pSQRPlayer)
|
bool CPlatformNetworkManagerSony::isSystemPrimaryPlayer(SQRNetworkPlayer *pSQRPlayer)
|
||||||
{
|
{
|
||||||
bool playerIsSystemPrimary = false;
|
bool playerIsSystemPrimary = false;
|
||||||
for(AUTO_VAR(it, m_machineSQRPrimaryPlayers.begin()); it < m_machineSQRPrimaryPlayers.end(); ++it)
|
for( SQRNetworkPlayer *pSQRPrimaryPlayer : m_machineSQRPrimaryPlayers )
|
||||||
{
|
{
|
||||||
SQRNetworkPlayer *pSQRPrimaryPlayer = *it;
|
|
||||||
if( pSQRPrimaryPlayer == pSQRPlayer )
|
if( pSQRPrimaryPlayer == pSQRPlayer )
|
||||||
{
|
{
|
||||||
playerIsSystemPrimary = true;
|
playerIsSystemPrimary = true;
|
||||||
|
|
@ -552,7 +550,7 @@ void CPlatformNetworkManagerSony::DoWork()
|
||||||
m_notificationListener,
|
m_notificationListener,
|
||||||
0, // Any notification
|
0, // Any notification
|
||||||
&dwNotifyId,
|
&dwNotifyId,
|
||||||
&ulpNotifyParam)
|
&ulpNotifyParam)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
@ -650,7 +648,7 @@ bool CPlatformNetworkManagerSony::IsInStatsEnabledSession()
|
||||||
DWORD dataSize = sizeof(QNET_LIVE_STATS_MODE);
|
DWORD dataSize = sizeof(QNET_LIVE_STATS_MODE);
|
||||||
QNET_LIVE_STATS_MODE statsMode;
|
QNET_LIVE_STATS_MODE statsMode;
|
||||||
m_pIQNet->GetOpt(QNET_OPTION_LIVE_STATS_MODE, &statsMode , &dataSize );
|
m_pIQNet->GetOpt(QNET_OPTION_LIVE_STATS_MODE, &statsMode , &dataSize );
|
||||||
|
|
||||||
// Use QNET_LIVE_STATS_MODE_AUTO if there is another way to check if stats are enabled or not
|
// Use QNET_LIVE_STATS_MODE_AUTO if there is another way to check if stats are enabled or not
|
||||||
bool statsEnabled = statsMode == QNET_LIVE_STATS_MODE_ENABLED;
|
bool statsEnabled = statsMode == QNET_LIVE_STATS_MODE_ENABLED;
|
||||||
return m_pIQNet->GetState() != QNET_STATE_IDLE && statsEnabled;
|
return m_pIQNet->GetState() != QNET_STATE_IDLE && statsEnabled;
|
||||||
|
|
@ -732,7 +730,7 @@ bool CPlatformNetworkManagerSony::LeaveGame(bool bMigrateHost)
|
||||||
|
|
||||||
// If we are the host wait for the game server to end
|
// If we are the host wait for the game server to end
|
||||||
if(m_pSQRNet->IsHost() && g_NetworkManager.ServerStoppedValid())
|
if(m_pSQRNet->IsHost() && g_NetworkManager.ServerStoppedValid())
|
||||||
{
|
{
|
||||||
m_pSQRNet->EndGame();
|
m_pSQRNet->EndGame();
|
||||||
g_NetworkManager.ServerStoppedWait();
|
g_NetworkManager.ServerStoppedWait();
|
||||||
g_NetworkManager.ServerStoppedDestroy();
|
g_NetworkManager.ServerStoppedDestroy();
|
||||||
|
|
@ -887,7 +885,7 @@ void CPlatformNetworkManagerSony::UnRegisterPlayerChangedCallback(int iPad, void
|
||||||
|
|
||||||
void CPlatformNetworkManagerSony::HandleSignInChange()
|
void CPlatformNetworkManagerSony::HandleSignInChange()
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CPlatformNetworkManagerSony::_RunNetworkGame()
|
bool CPlatformNetworkManagerSony::_RunNetworkGame()
|
||||||
|
|
@ -930,7 +928,7 @@ void CPlatformNetworkManagerSony::UpdateAndSetGameSessionData(INetworkPlayer *pN
|
||||||
{
|
{
|
||||||
m_hostGameSessionData.hostPlayerUID.setForAdhoc();
|
m_hostGameSessionData.hostPlayerUID.setForAdhoc();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
m_hostGameSessionData.m_uiGameHostSettings = app.GetGameHostOption(eGameHostOption_All);
|
m_hostGameSessionData.m_uiGameHostSettings = app.GetGameHostOption(eGameHostOption_All);
|
||||||
|
|
||||||
|
|
@ -1066,8 +1064,8 @@ bool CPlatformNetworkManagerSony::SystemFlagGet(INetworkPlayer *pNetworkPlayer,
|
||||||
wstring CPlatformNetworkManagerSony::GatherStats()
|
wstring CPlatformNetworkManagerSony::GatherStats()
|
||||||
{
|
{
|
||||||
#if 0
|
#if 0
|
||||||
return L"Queue messages: " + _toString(((NetworkPlayerXbox *)GetHostPlayer())->GetQNetPlayer()->GetSendQueueSize( NULL, QNET_GETSENDQUEUESIZE_MESSAGES ) )
|
return L"Queue messages: " + std::to_wstring(((NetworkPlayerXbox *)GetHostPlayer())->GetQNetPlayer()->GetSendQueueSize( NULL, QNET_GETSENDQUEUESIZE_MESSAGES ) )
|
||||||
+ L" Queue bytes: " + _toString( ((NetworkPlayerXbox *)GetHostPlayer())->GetQNetPlayer()->GetSendQueueSize( NULL, QNET_GETSENDQUEUESIZE_BYTES ) );
|
+ L" Queue bytes: " + std::to_wstring( ((NetworkPlayerXbox *)GetHostPlayer())->GetQNetPlayer()->GetSendQueueSize( NULL, QNET_GETSENDQUEUESIZE_BYTES ) );
|
||||||
#else
|
#else
|
||||||
return L"";
|
return L"";
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -1192,7 +1190,7 @@ bool CPlatformNetworkManagerSony::GetGameSessionInfo(int iPad, SessionID session
|
||||||
|
|
||||||
bool foundSession = false;
|
bool foundSession = false;
|
||||||
FriendSessionInfo *sessionInfo = NULL;
|
FriendSessionInfo *sessionInfo = NULL;
|
||||||
AUTO_VAR(itFriendSession, friendsSessions[iPad].begin());
|
auto itFriendSession = friendsSessions[iPad].begin();
|
||||||
for(itFriendSession = friendsSessions[iPad].begin(); itFriendSession < friendsSessions[iPad].end(); ++itFriendSession)
|
for(itFriendSession = friendsSessions[iPad].begin(); itFriendSession < friendsSessions[iPad].end(); ++itFriendSession)
|
||||||
{
|
{
|
||||||
sessionInfo = *itFriendSession;
|
sessionInfo = *itFriendSession;
|
||||||
|
|
@ -1224,7 +1222,7 @@ bool CPlatformNetworkManagerSony::GetGameSessionInfo(int iPad, SessionID session
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
swprintf(sessionInfo->displayLabel,app.GetString(IDS_GAME_HOST_NAME_UNKNOWN));
|
swprintf(sessionInfo->displayLabel,app.GetString(IDS_GAME_HOST_NAME_UNKNOWN));
|
||||||
}
|
}
|
||||||
sessionInfo->displayLabelLength = wcslen( sessionInfo->displayLabel );
|
sessionInfo->displayLabelLength = wcslen( sessionInfo->displayLabel );
|
||||||
|
|
||||||
// If this host wasn't disabled use this one.
|
// If this host wasn't disabled use this one.
|
||||||
|
|
@ -1283,7 +1281,7 @@ INetworkPlayer *CPlatformNetworkManagerSony::addNetworkPlayer(SQRNetworkPlayer *
|
||||||
void CPlatformNetworkManagerSony::removeNetworkPlayer(SQRNetworkPlayer *pSQRPlayer)
|
void CPlatformNetworkManagerSony::removeNetworkPlayer(SQRNetworkPlayer *pSQRPlayer)
|
||||||
{
|
{
|
||||||
INetworkPlayer *pNetworkPlayer = getNetworkPlayer(pSQRPlayer);
|
INetworkPlayer *pNetworkPlayer = getNetworkPlayer(pSQRPlayer);
|
||||||
for( AUTO_VAR(it, currentNetworkPlayers.begin()); it != currentNetworkPlayers.end(); it++ )
|
for( auto it = currentNetworkPlayers.begin(); it != currentNetworkPlayers.end(); it++ )
|
||||||
{
|
{
|
||||||
if( *it == pNetworkPlayer )
|
if( *it == pNetworkPlayer )
|
||||||
{
|
{
|
||||||
|
|
@ -1301,7 +1299,7 @@ INetworkPlayer *CPlatformNetworkManagerSony::getNetworkPlayer(SQRNetworkPlayer *
|
||||||
|
|
||||||
INetworkPlayer *CPlatformNetworkManagerSony::GetLocalPlayerByUserIndex(int userIndex )
|
INetworkPlayer *CPlatformNetworkManagerSony::GetLocalPlayerByUserIndex(int userIndex )
|
||||||
{
|
{
|
||||||
return getNetworkPlayer(m_pSQRNet->GetLocalPlayerByUserIndex(userIndex));
|
return getNetworkPlayer(m_pSQRNet->GetLocalPlayerByUserIndex(userIndex));
|
||||||
}
|
}
|
||||||
|
|
||||||
INetworkPlayer *CPlatformNetworkManagerSony::GetPlayerByIndex(int playerIndex)
|
INetworkPlayer *CPlatformNetworkManagerSony::GetPlayerByIndex(int playerIndex)
|
||||||
|
|
@ -1400,7 +1398,7 @@ bool CPlatformNetworkManagerSony::setAdhocMode( bool bAdhoc )
|
||||||
{
|
{
|
||||||
if(m_bUsingAdhocMode != bAdhoc)
|
if(m_bUsingAdhocMode != bAdhoc)
|
||||||
{
|
{
|
||||||
m_bUsingAdhocMode = bAdhoc;
|
m_bUsingAdhocMode = bAdhoc;
|
||||||
if(m_bUsingAdhocMode)
|
if(m_bUsingAdhocMode)
|
||||||
{
|
{
|
||||||
// uninit the PSN, and init adhoc
|
// uninit the PSN, and init adhoc
|
||||||
|
|
@ -1419,14 +1417,14 @@ bool CPlatformNetworkManagerSony::setAdhocMode( bool bAdhoc )
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(m_pSQRNet_Vita_Adhoc->IsInitialised())
|
if(m_pSQRNet_Vita_Adhoc->IsInitialised())
|
||||||
{
|
{
|
||||||
int ret = sceNetCtlAdhocDisconnect();
|
int ret = sceNetCtlAdhocDisconnect();
|
||||||
// uninit the adhoc, and init psn
|
// uninit the adhoc, and init psn
|
||||||
m_pSQRNet_Vita_Adhoc->UnInitialise();
|
m_pSQRNet_Vita_Adhoc->UnInitialise();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(m_pSQRNet_Vita->IsInitialised()==false)
|
if(m_pSQRNet_Vita->IsInitialised()==false)
|
||||||
{
|
{
|
||||||
m_pSQRNet_Vita->Initialise();
|
m_pSQRNet_Vita->Initialise();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,9 +23,8 @@ bool AreaTask::isCompleted()
|
||||||
case eAreaTaskCompletion_CompleteOnConstraintsSatisfied:
|
case eAreaTaskCompletion_CompleteOnConstraintsSatisfied:
|
||||||
{
|
{
|
||||||
bool allSatisfied = true;
|
bool allSatisfied = true;
|
||||||
for(AUTO_VAR(it, constraints.begin()); it != constraints.end(); ++it)
|
for( auto& constraint : constraints )
|
||||||
{
|
{
|
||||||
TutorialConstraint *constraint = *it;
|
|
||||||
if(!constraint->isConstraintSatisfied(tutorial->getPad()))
|
if(!constraint->isConstraintSatisfied(tutorial->getPad()))
|
||||||
{
|
{
|
||||||
allSatisfied = false;
|
allSatisfied = false;
|
||||||
|
|
|
||||||
|
|
@ -53,15 +53,15 @@ bool ControllerTask::isCompleted()
|
||||||
|
|
||||||
if(m_bHasSouthpaw && app.GetGameSettings(pMinecraft->player->GetXboxPad(),eGameSetting_ControlSouthPaw))
|
if(m_bHasSouthpaw && app.GetGameSettings(pMinecraft->player->GetXboxPad(),eGameSetting_ControlSouthPaw))
|
||||||
{
|
{
|
||||||
for(AUTO_VAR(it, southpawCompletedMappings.begin()); it != southpawCompletedMappings.end(); ++it)
|
for (auto& it : southpawCompletedMappings )
|
||||||
{
|
{
|
||||||
bool current = (*it).second;
|
bool current = it.second;
|
||||||
if(!current)
|
if(!current)
|
||||||
{
|
{
|
||||||
// TODO Use a different pad
|
// TODO Use a different pad
|
||||||
if( InputManager.GetValue(pMinecraft->player->GetXboxPad(), (*it).first) > 0 )
|
if( InputManager.GetValue(pMinecraft->player->GetXboxPad(), it.first) > 0 )
|
||||||
{
|
{
|
||||||
(*it).second = true;
|
it.second = true;
|
||||||
m_uiCompletionMask|=1<<iCurrent;
|
m_uiCompletionMask|=1<<iCurrent;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -78,15 +78,15 @@ bool ControllerTask::isCompleted()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for(AUTO_VAR(it, completedMappings.begin()); it != completedMappings.end(); ++it)
|
for (auto& it : completedMappings )
|
||||||
{
|
{
|
||||||
bool current = (*it).second;
|
bool current = it.second;
|
||||||
if(!current)
|
if(!current)
|
||||||
{
|
{
|
||||||
// TODO Use a different pad
|
// TODO Use a different pad
|
||||||
if( InputManager.GetValue(pMinecraft->player->GetXboxPad(), (*it).first) > 0 )
|
if( InputManager.GetValue(pMinecraft->player->GetXboxPad(), it.first) > 0 )
|
||||||
{
|
{
|
||||||
(*it).second = true;
|
it.second = true;
|
||||||
m_uiCompletionMask|=1<<iCurrent;
|
m_uiCompletionMask|=1<<iCurrent;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ bool InfoTask::isCompleted()
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
bool bAllComplete = true;
|
bool bAllComplete = true;
|
||||||
|
|
||||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||||
|
|
||||||
// If the player is under water then allow all keypresses so they can jump out
|
// If the player is under water then allow all keypresses so they can jump out
|
||||||
|
|
@ -47,9 +47,9 @@ bool InfoTask::isCompleted()
|
||||||
{
|
{
|
||||||
// If a menu is displayed, then we use the handleUIInput to complete the task
|
// If a menu is displayed, then we use the handleUIInput to complete the task
|
||||||
bAllComplete = true;
|
bAllComplete = true;
|
||||||
for(AUTO_VAR(it, completedMappings.begin()); it != completedMappings.end(); ++it)
|
for( auto& it : completedMappings )
|
||||||
{
|
{
|
||||||
bool current = (*it).second;
|
bool current = it.second;
|
||||||
if(!current)
|
if(!current)
|
||||||
{
|
{
|
||||||
bAllComplete = false;
|
bAllComplete = false;
|
||||||
|
|
@ -61,18 +61,18 @@ bool InfoTask::isCompleted()
|
||||||
{
|
{
|
||||||
int iCurrent=0;
|
int iCurrent=0;
|
||||||
|
|
||||||
for(AUTO_VAR(it, completedMappings.begin()); it != completedMappings.end(); ++it)
|
for( auto& it : completedMappings )
|
||||||
{
|
{
|
||||||
bool current = (*it).second;
|
bool current = it.second;
|
||||||
if(!current)
|
if(!current)
|
||||||
{
|
{
|
||||||
#ifdef _WINDOWS64
|
#ifdef _WINDOWS64
|
||||||
if (InputManager.GetValue(pMinecraft->player->GetXboxPad(), (*it).first) > 0 || g_KBMInput.IsKeyDown(VK_SPACE))
|
if (InputManager.GetValue(pMinecraft->player->GetXboxPad(), it.first) > 0 || g_KBMInput.IsKeyDown(VK_SPACE))
|
||||||
#else
|
#else
|
||||||
if( InputManager.GetValue(pMinecraft->player->GetXboxPad(), (*it).first) > 0)
|
if( InputManager.GetValue(pMinecraft->player->GetXboxPad(), it.first) > 0)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
(*it).second = true;
|
it.second = true;
|
||||||
bAllComplete=true;
|
bAllComplete=true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -111,11 +111,11 @@ void InfoTask::handleUIInput(int iAction)
|
||||||
{
|
{
|
||||||
if(bHasBeenActivated)
|
if(bHasBeenActivated)
|
||||||
{
|
{
|
||||||
for(AUTO_VAR(it, completedMappings.begin()); it != completedMappings.end(); ++it)
|
for( auto& it : completedMappings )
|
||||||
{
|
{
|
||||||
if( iAction == (*it).first )
|
if( iAction == it.first )
|
||||||
{
|
{
|
||||||
(*it).second = true;
|
it.second = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,8 @@
|
||||||
|
|
||||||
ProcedureCompoundTask::~ProcedureCompoundTask()
|
ProcedureCompoundTask::~ProcedureCompoundTask()
|
||||||
{
|
{
|
||||||
for(AUTO_VAR(it, m_taskSequence.begin()); it < m_taskSequence.end(); ++it)
|
for (auto it = m_taskSequence.begin(); it < m_taskSequence.end(); ++it)
|
||||||
{
|
{
|
||||||
delete (*it);
|
delete (*it);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -24,10 +24,8 @@ int ProcedureCompoundTask::getDescriptionId()
|
||||||
|
|
||||||
// Return the id of the first task not completed
|
// Return the id of the first task not completed
|
||||||
int descriptionId = -1;
|
int descriptionId = -1;
|
||||||
AUTO_VAR(itEnd, m_taskSequence.end());
|
for (auto& task : m_taskSequence)
|
||||||
for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it)
|
{
|
||||||
{
|
|
||||||
TutorialTask *task = *it;
|
|
||||||
if(!task->isCompleted())
|
if(!task->isCompleted())
|
||||||
{
|
{
|
||||||
task->setAsCurrentTask(true);
|
task->setAsCurrentTask(true);
|
||||||
|
|
@ -50,10 +48,8 @@ int ProcedureCompoundTask::getPromptId()
|
||||||
|
|
||||||
// Return the id of the first task not completed
|
// Return the id of the first task not completed
|
||||||
int promptId = -1;
|
int promptId = -1;
|
||||||
AUTO_VAR(itEnd, m_taskSequence.end());
|
for(auto& task : m_taskSequence)
|
||||||
for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it)
|
|
||||||
{
|
{
|
||||||
TutorialTask *task = *it;
|
|
||||||
if(!task->isCompleted())
|
if(!task->isCompleted())
|
||||||
{
|
{
|
||||||
promptId = task->getPromptId();
|
promptId = task->getPromptId();
|
||||||
|
|
@ -69,11 +65,8 @@ bool ProcedureCompoundTask::isCompleted()
|
||||||
|
|
||||||
bool allCompleted = true;
|
bool allCompleted = true;
|
||||||
bool isCurrentTask = true;
|
bool isCurrentTask = true;
|
||||||
AUTO_VAR(itEnd, m_taskSequence.end());
|
for(auto& task : m_taskSequence)
|
||||||
for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it)
|
|
||||||
{
|
{
|
||||||
TutorialTask *task = *it;
|
|
||||||
|
|
||||||
if(allCompleted && isCurrentTask)
|
if(allCompleted && isCurrentTask)
|
||||||
{
|
{
|
||||||
if(task->isCompleted())
|
if(task->isCompleted())
|
||||||
|
|
@ -99,11 +92,9 @@ bool ProcedureCompoundTask::isCompleted()
|
||||||
|
|
||||||
if(allCompleted)
|
if(allCompleted)
|
||||||
{
|
{
|
||||||
//Disable all constraints
|
// Disable all constraints
|
||||||
itEnd = m_taskSequence.end();
|
for(auto& task : m_taskSequence)
|
||||||
for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it)
|
|
||||||
{
|
{
|
||||||
TutorialTask *task = *it;
|
|
||||||
task->enableConstraints(false);
|
task->enableConstraints(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -113,20 +104,16 @@ bool ProcedureCompoundTask::isCompleted()
|
||||||
|
|
||||||
void ProcedureCompoundTask::onCrafted(shared_ptr<ItemInstance> item)
|
void ProcedureCompoundTask::onCrafted(shared_ptr<ItemInstance> item)
|
||||||
{
|
{
|
||||||
AUTO_VAR(itEnd, m_taskSequence.end());
|
for(auto& task : m_taskSequence)
|
||||||
for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it)
|
|
||||||
{
|
{
|
||||||
TutorialTask *task = *it;
|
|
||||||
task->onCrafted(item);
|
task->onCrafted(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProcedureCompoundTask::handleUIInput(int iAction)
|
void ProcedureCompoundTask::handleUIInput(int iAction)
|
||||||
{
|
{
|
||||||
AUTO_VAR(itEnd, m_taskSequence.end());
|
for(auto task : m_taskSequence)
|
||||||
for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it)
|
|
||||||
{
|
{
|
||||||
TutorialTask *task = *it;
|
|
||||||
task->handleUIInput(iAction);
|
task->handleUIInput(iAction);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -135,10 +122,8 @@ void ProcedureCompoundTask::handleUIInput(int iAction)
|
||||||
void ProcedureCompoundTask::setAsCurrentTask(bool active /*= true*/)
|
void ProcedureCompoundTask::setAsCurrentTask(bool active /*= true*/)
|
||||||
{
|
{
|
||||||
bool allCompleted = true;
|
bool allCompleted = true;
|
||||||
AUTO_VAR(itEnd, m_taskSequence.end());
|
for(auto& task : m_taskSequence)
|
||||||
for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it)
|
|
||||||
{
|
{
|
||||||
TutorialTask *task = *it;
|
|
||||||
if(allCompleted && !task->isCompleted())
|
if(allCompleted && !task->isCompleted())
|
||||||
{
|
{
|
||||||
task->setAsCurrentTask(true);
|
task->setAsCurrentTask(true);
|
||||||
|
|
@ -157,10 +142,8 @@ bool ProcedureCompoundTask::ShowMinimumTime()
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
bool showMinimumTime = false;
|
bool showMinimumTime = false;
|
||||||
AUTO_VAR(itEnd, m_taskSequence.end());
|
for(auto& task : m_taskSequence)
|
||||||
for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it)
|
|
||||||
{
|
{
|
||||||
TutorialTask *task = *it;
|
|
||||||
if(!task->isCompleted())
|
if(!task->isCompleted())
|
||||||
{
|
{
|
||||||
showMinimumTime = task->ShowMinimumTime();
|
showMinimumTime = task->ShowMinimumTime();
|
||||||
|
|
@ -176,10 +159,8 @@ bool ProcedureCompoundTask::hasBeenActivated()
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
bool hasBeenActivated = false;
|
bool hasBeenActivated = false;
|
||||||
AUTO_VAR(itEnd, m_taskSequence.end());
|
for(auto& task : m_taskSequence)
|
||||||
for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it)
|
|
||||||
{
|
{
|
||||||
TutorialTask *task = *it;
|
|
||||||
if(!task->isCompleted())
|
if(!task->isCompleted())
|
||||||
{
|
{
|
||||||
hasBeenActivated = task->hasBeenActivated();
|
hasBeenActivated = task->hasBeenActivated();
|
||||||
|
|
@ -191,10 +172,8 @@ bool ProcedureCompoundTask::hasBeenActivated()
|
||||||
|
|
||||||
void ProcedureCompoundTask::setShownForMinimumTime()
|
void ProcedureCompoundTask::setShownForMinimumTime()
|
||||||
{
|
{
|
||||||
AUTO_VAR(itEnd, m_taskSequence.end());
|
for(auto& task : m_taskSequence)
|
||||||
for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it)
|
|
||||||
{
|
{
|
||||||
TutorialTask *task = *it;
|
|
||||||
if(!task->isCompleted())
|
if(!task->isCompleted())
|
||||||
{
|
{
|
||||||
task->setShownForMinimumTime();
|
task->setShownForMinimumTime();
|
||||||
|
|
@ -209,10 +188,8 @@ bool ProcedureCompoundTask::AllowFade()
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
bool allowFade = true;
|
bool allowFade = true;
|
||||||
AUTO_VAR(itEnd, m_taskSequence.end());
|
for(auto& task : m_taskSequence)
|
||||||
for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it)
|
|
||||||
{
|
{
|
||||||
TutorialTask *task = *it;
|
|
||||||
if(!task->isCompleted())
|
if(!task->isCompleted())
|
||||||
{
|
{
|
||||||
allowFade = task->AllowFade();
|
allowFade = task->AllowFade();
|
||||||
|
|
@ -224,40 +201,32 @@ bool ProcedureCompoundTask::AllowFade()
|
||||||
|
|
||||||
void ProcedureCompoundTask::useItemOn(Level *level, shared_ptr<ItemInstance> item, int x, int y, int z,bool bTestUseOnly)
|
void ProcedureCompoundTask::useItemOn(Level *level, shared_ptr<ItemInstance> item, int x, int y, int z,bool bTestUseOnly)
|
||||||
{
|
{
|
||||||
AUTO_VAR(itEnd, m_taskSequence.end());
|
for(auto& task : m_taskSequence)
|
||||||
for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it)
|
|
||||||
{
|
{
|
||||||
TutorialTask *task = *it;
|
|
||||||
task->useItemOn(level, item, x, y, z, bTestUseOnly);
|
task->useItemOn(level, item, x, y, z, bTestUseOnly);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProcedureCompoundTask::useItem(shared_ptr<ItemInstance> item, bool bTestUseOnly)
|
void ProcedureCompoundTask::useItem(shared_ptr<ItemInstance> item, bool bTestUseOnly)
|
||||||
{
|
{
|
||||||
AUTO_VAR(itEnd, m_taskSequence.end());
|
for(auto& task : m_taskSequence)
|
||||||
for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it)
|
|
||||||
{
|
{
|
||||||
TutorialTask *task = *it;
|
|
||||||
task->useItem(item, bTestUseOnly);
|
task->useItem(item, bTestUseOnly);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProcedureCompoundTask::onTake(shared_ptr<ItemInstance> item, unsigned int invItemCountAnyAux, unsigned int invItemCountThisAux)
|
void ProcedureCompoundTask::onTake(shared_ptr<ItemInstance> item, unsigned int invItemCountAnyAux, unsigned int invItemCountThisAux)
|
||||||
{
|
{
|
||||||
AUTO_VAR(itEnd, m_taskSequence.end());
|
for(auto& task : m_taskSequence)
|
||||||
for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it)
|
|
||||||
{
|
{
|
||||||
TutorialTask *task = *it;
|
|
||||||
task->onTake(item, invItemCountAnyAux, invItemCountThisAux);
|
task->onTake(item, invItemCountAnyAux, invItemCountThisAux);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProcedureCompoundTask::onStateChange(eTutorial_State newState)
|
void ProcedureCompoundTask::onStateChange(eTutorial_State newState)
|
||||||
{
|
{
|
||||||
AUTO_VAR(itEnd, m_taskSequence.end());
|
for(auto& task : m_taskSequence)
|
||||||
for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it)
|
|
||||||
{
|
{
|
||||||
TutorialTask *task = *it;
|
|
||||||
task->onStateChange(newState);
|
task->onStateChange(newState);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -41,7 +41,7 @@ bool Tutorial::PopupMessageDetails::isSameContent(PopupMessageDetails *other)
|
||||||
|
|
||||||
void Tutorial::staticCtor()
|
void Tutorial::staticCtor()
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
/*
|
/*
|
||||||
*****
|
*****
|
||||||
*****
|
*****
|
||||||
|
|
@ -72,7 +72,7 @@ void Tutorial::staticCtor()
|
||||||
s_completableTasks.push_back( e_Tutorial_State_Enchanting );
|
s_completableTasks.push_back( e_Tutorial_State_Enchanting );
|
||||||
|
|
||||||
s_completableTasks.push_back( e_Tutorial_Hint_Hold_To_Mine );
|
s_completableTasks.push_back( e_Tutorial_Hint_Hold_To_Mine );
|
||||||
s_completableTasks.push_back( e_Tutorial_Hint_Tool_Damaged );
|
s_completableTasks.push_back( e_Tutorial_Hint_Tool_Damaged );
|
||||||
s_completableTasks.push_back( e_Tutorial_Hint_Swim_Up );
|
s_completableTasks.push_back( e_Tutorial_Hint_Swim_Up );
|
||||||
|
|
||||||
s_completableTasks.push_back( e_Tutorial_Hint_Unused_2 );
|
s_completableTasks.push_back( e_Tutorial_Hint_Unused_2 );
|
||||||
|
|
@ -164,7 +164,7 @@ void Tutorial::staticCtor()
|
||||||
s_completableTasks.push_back( e_Tutorial_Hint_Thin_Glass );
|
s_completableTasks.push_back( e_Tutorial_Hint_Thin_Glass );
|
||||||
s_completableTasks.push_back( e_Tutorial_Hint_Melon );
|
s_completableTasks.push_back( e_Tutorial_Hint_Melon );
|
||||||
s_completableTasks.push_back( e_Tutorial_Hint_Vine );
|
s_completableTasks.push_back( e_Tutorial_Hint_Vine );
|
||||||
s_completableTasks.push_back( e_Tutorial_Hint_Fence_Gate );
|
s_completableTasks.push_back( e_Tutorial_Hint_Fence_Gate );
|
||||||
s_completableTasks.push_back( e_Tutorial_Hint_Mycel );
|
s_completableTasks.push_back( e_Tutorial_Hint_Mycel );
|
||||||
s_completableTasks.push_back( e_Tutorial_Hint_Water_Lily );
|
s_completableTasks.push_back( e_Tutorial_Hint_Water_Lily );
|
||||||
s_completableTasks.push_back( e_Tutorial_Hint_Nether_Brick );
|
s_completableTasks.push_back( e_Tutorial_Hint_Nether_Brick );
|
||||||
|
|
@ -319,7 +319,7 @@ void Tutorial::staticCtor()
|
||||||
s_completableTasks.push_back( e_Tutorial_State_Enderchests );
|
s_completableTasks.push_back( e_Tutorial_State_Enderchests );
|
||||||
s_completableTasks.push_back( e_Tutorial_State_Horse_Menu );
|
s_completableTasks.push_back( e_Tutorial_State_Horse_Menu );
|
||||||
s_completableTasks.push_back( e_Tutorial_State_Hopper_Menu );
|
s_completableTasks.push_back( e_Tutorial_State_Hopper_Menu );
|
||||||
|
|
||||||
s_completableTasks.push_back( e_Tutorial_Hint_Wither );
|
s_completableTasks.push_back( e_Tutorial_Hint_Wither );
|
||||||
s_completableTasks.push_back( e_Tutorial_Hint_Witch );
|
s_completableTasks.push_back( e_Tutorial_Hint_Witch );
|
||||||
s_completableTasks.push_back( e_Tutorial_Hint_Bat );
|
s_completableTasks.push_back( e_Tutorial_Hint_Bat );
|
||||||
|
|
@ -470,7 +470,7 @@ Tutorial::Tutorial(int iPad, bool isFullTutorial /*= false*/) : m_iPad( iPad )
|
||||||
if(!isHintCompleted(e_Tutorial_Hint_Detector_Rail)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Detector_Rail, this, detectorRailItems, 1 ) );
|
if(!isHintCompleted(e_Tutorial_Hint_Detector_Rail)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Detector_Rail, this, detectorRailItems, 1 ) );
|
||||||
|
|
||||||
int tallGrassItems[] = {Tile::tallgrass_Id};
|
int tallGrassItems[] = {Tile::tallgrass_Id};
|
||||||
if(!isHintCompleted(e_Tutorial_Hint_Tall_Grass))
|
if(!isHintCompleted(e_Tutorial_Hint_Tall_Grass))
|
||||||
{
|
{
|
||||||
addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Tall_Grass, this, tallGrassItems, 1, -1, TallGrass::DEAD_SHRUB ) );
|
addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Tall_Grass, this, tallGrassItems, 1, -1, TallGrass::DEAD_SHRUB ) );
|
||||||
addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Tall_Grass, this, tallGrassItems, 1, -1, TallGrass::TALL_GRASS ) );
|
addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Tall_Grass, this, tallGrassItems, 1, -1, TallGrass::TALL_GRASS ) );
|
||||||
|
|
@ -753,46 +753,46 @@ Tutorial::Tutorial(int iPad, bool isFullTutorial /*= false*/) : m_iPad( iPad )
|
||||||
|
|
||||||
int potatoItems[] = {Tile::potatoes_Id};
|
int potatoItems[] = {Tile::potatoes_Id};
|
||||||
if(!isHintCompleted(e_Tutorial_Hint_Potato)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Potato, this, potatoItems, 1, -1, -1, 7 ) );
|
if(!isHintCompleted(e_Tutorial_Hint_Potato)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Potato, this, potatoItems, 1, -1, -1, 7 ) );
|
||||||
|
|
||||||
int carrotItems[] = {Tile::carrots_Id};
|
int carrotItems[] = {Tile::carrots_Id};
|
||||||
if(!isHintCompleted(e_Tutorial_Hint_Carrot)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Carrot, this, carrotItems, 1, -1, -1, 7 ) );
|
if(!isHintCompleted(e_Tutorial_Hint_Carrot)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Carrot, this, carrotItems, 1, -1, -1, 7 ) );
|
||||||
|
|
||||||
int commandBlockItems[] = {Tile::commandBlock_Id};
|
int commandBlockItems[] = {Tile::commandBlock_Id};
|
||||||
if(!isHintCompleted(e_Tutorial_Hint_CommandBlock)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_CommandBlock, this, commandBlockItems, 1 ) );
|
if(!isHintCompleted(e_Tutorial_Hint_CommandBlock)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_CommandBlock, this, commandBlockItems, 1 ) );
|
||||||
|
|
||||||
int beaconItems[] = {Tile::beacon_Id};
|
int beaconItems[] = {Tile::beacon_Id};
|
||||||
if(!isHintCompleted(e_Tutorial_Hint_Beacon)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Beacon, this, beaconItems, 1 ) );
|
if(!isHintCompleted(e_Tutorial_Hint_Beacon)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Beacon, this, beaconItems, 1 ) );
|
||||||
|
|
||||||
int activatorRailItems[] = {Tile::activatorRail_Id};
|
int activatorRailItems[] = {Tile::activatorRail_Id};
|
||||||
if(!isHintCompleted(e_Tutorial_Hint_Activator_Rail)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Activator_Rail, this, activatorRailItems, 1 ) );
|
if(!isHintCompleted(e_Tutorial_Hint_Activator_Rail)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Activator_Rail, this, activatorRailItems, 1 ) );
|
||||||
|
|
||||||
int redstoneBlockItems[] = {Tile::redstoneBlock_Id};
|
int redstoneBlockItems[] = {Tile::redstoneBlock_Id};
|
||||||
if(!isHintCompleted(e_Tutorial_Hint_RedstoneBlock)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_RedstoneBlock, this, redstoneBlockItems, 1 ) );
|
if(!isHintCompleted(e_Tutorial_Hint_RedstoneBlock)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_RedstoneBlock, this, redstoneBlockItems, 1 ) );
|
||||||
|
|
||||||
int daylightDetectorItems[] = {Tile::daylightDetector_Id};
|
int daylightDetectorItems[] = {Tile::daylightDetector_Id};
|
||||||
if(!isHintCompleted(e_Tutorial_Hint_DaylightDetector)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_DaylightDetector, this, daylightDetectorItems, 1 ) );
|
if(!isHintCompleted(e_Tutorial_Hint_DaylightDetector)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_DaylightDetector, this, daylightDetectorItems, 1 ) );
|
||||||
|
|
||||||
int dropperItems[] = {Tile::dropper_Id};
|
int dropperItems[] = {Tile::dropper_Id};
|
||||||
if(!isHintCompleted(e_Tutorial_Hint_Dropper)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Dropper, this, dropperItems, 1 ) );
|
if(!isHintCompleted(e_Tutorial_Hint_Dropper)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Dropper, this, dropperItems, 1 ) );
|
||||||
|
|
||||||
int hopperItems[] = {Tile::hopper_Id};
|
int hopperItems[] = {Tile::hopper_Id};
|
||||||
if(!isHintCompleted(e_Tutorial_Hint_Hopper)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Hopper, this, hopperItems, 1 ) );
|
if(!isHintCompleted(e_Tutorial_Hint_Hopper)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Hopper, this, hopperItems, 1 ) );
|
||||||
|
|
||||||
int comparatorItems[] = {Tile::comparator_off_Id, Tile::comparator_on_Id};
|
int comparatorItems[] = {Tile::comparator_off_Id, Tile::comparator_on_Id};
|
||||||
if(!isHintCompleted(e_Tutorial_Hint_Comparator)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Comparator, this, comparatorItems, 2, Item::comparator_Id ) );
|
if(!isHintCompleted(e_Tutorial_Hint_Comparator)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Comparator, this, comparatorItems, 2, Item::comparator_Id ) );
|
||||||
|
|
||||||
int trappedChestItems[] = {Tile::chest_trap_Id};
|
int trappedChestItems[] = {Tile::chest_trap_Id};
|
||||||
if(!isHintCompleted(e_Tutorial_Hint_ChestTrap)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_ChestTrap, this, trappedChestItems, 1 ) );
|
if(!isHintCompleted(e_Tutorial_Hint_ChestTrap)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_ChestTrap, this, trappedChestItems, 1 ) );
|
||||||
|
|
||||||
int hayBlockItems[] = {Tile::hayBlock_Id};
|
int hayBlockItems[] = {Tile::hayBlock_Id};
|
||||||
if(!isHintCompleted(e_Tutorial_Hint_HayBlock)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_HayBlock, this, hayBlockItems, 1 ) );
|
if(!isHintCompleted(e_Tutorial_Hint_HayBlock)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_HayBlock, this, hayBlockItems, 1 ) );
|
||||||
|
|
||||||
int clayHardenedItems[] = {Tile::clayHardened_Id};
|
int clayHardenedItems[] = {Tile::clayHardened_Id};
|
||||||
if(!isHintCompleted(e_Tutorial_Hint_ClayHardened)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_ClayHardened, this, clayHardenedItems, 1 ) );
|
if(!isHintCompleted(e_Tutorial_Hint_ClayHardened)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_ClayHardened, this, clayHardenedItems, 1 ) );
|
||||||
|
|
||||||
int clayHardenedColoredItems[] = {Tile::clayHardened_colored_Id};
|
int clayHardenedColoredItems[] = {Tile::clayHardened_colored_Id};
|
||||||
if(!isHintCompleted(e_Tutorial_Hint_ClayHardenedColored)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_ClayHardenedColored, this, clayHardenedColoredItems, 1 ) );
|
if(!isHintCompleted(e_Tutorial_Hint_ClayHardenedColored)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_ClayHardenedColored, this, clayHardenedColoredItems, 1 ) );
|
||||||
|
|
||||||
int coalBlockItems[] = {Tile::coalBlock_Id};
|
int coalBlockItems[] = {Tile::coalBlock_Id};
|
||||||
if(!isHintCompleted(e_Tutorial_Hint_CoalBlock)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_CoalBlock, this, coalBlockItems, 1 ) );
|
if(!isHintCompleted(e_Tutorial_Hint_CoalBlock)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_CoalBlock, this, coalBlockItems, 1 ) );
|
||||||
|
|
||||||
|
|
@ -1000,9 +1000,9 @@ Tutorial::Tutorial(int iPad, bool isFullTutorial /*= false*/) : m_iPad( iPad )
|
||||||
* HORSE ENCOUNTER
|
* HORSE ENCOUNTER
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
if(isFullTutorial || !isStateCompleted(e_Tutorial_State_Horse) )
|
if(isFullTutorial || !isStateCompleted(e_Tutorial_State_Horse) )
|
||||||
{
|
{
|
||||||
addTask(e_Tutorial_State_Horse,
|
addTask(e_Tutorial_State_Horse,
|
||||||
new HorseChoiceTask(this, IDS_TUTORIAL_TASK_HORSE_OVERVIEW, IDS_TUTORIAL_TASK_DONKEY_OVERVIEW, IDS_TUTORIAL_TASK_MULE_OVERVIEW, IDS_TUTORIAL_PROMPT_HORSE_OVERVIEW,
|
new HorseChoiceTask(this, IDS_TUTORIAL_TASK_HORSE_OVERVIEW, IDS_TUTORIAL_TASK_DONKEY_OVERVIEW, IDS_TUTORIAL_TASK_MULE_OVERVIEW, IDS_TUTORIAL_PROMPT_HORSE_OVERVIEW,
|
||||||
true, ACTION_MENU_A, ACTION_MENU_B, e_Tutorial_Completion_Complete_State_Gameplay_Constraints, eTelemetryTutorial_Horse) );
|
true, ACTION_MENU_A, ACTION_MENU_B, e_Tutorial_Completion_Complete_State_Gameplay_Constraints, eTelemetryTutorial_Horse) );
|
||||||
|
|
||||||
|
|
@ -1144,23 +1144,23 @@ Tutorial::Tutorial(int iPad, bool isFullTutorial /*= false*/) : m_iPad( iPad )
|
||||||
|
|
||||||
Tutorial::~Tutorial()
|
Tutorial::~Tutorial()
|
||||||
{
|
{
|
||||||
for(AUTO_VAR(it, m_globalConstraints.begin()); it != m_globalConstraints.end(); ++it)
|
for(auto& it : m_globalConstraints)
|
||||||
{
|
{
|
||||||
delete (*it);
|
delete it;
|
||||||
}
|
}
|
||||||
for(unordered_map<int, TutorialMessage *>::iterator it = messages.begin(); it != messages.end(); ++it)
|
for(auto& message : messages)
|
||||||
{
|
{
|
||||||
delete (*it).second;
|
delete message.second;
|
||||||
}
|
}
|
||||||
for(unsigned int i = 0; i < e_Tutorial_State_Max; ++i)
|
for(unsigned int i = 0; i < e_Tutorial_State_Max; ++i)
|
||||||
{
|
{
|
||||||
for(AUTO_VAR(it, activeTasks[i].begin()); it < activeTasks[i].end(); ++it)
|
for(auto& it : activeTasks[i])
|
||||||
{
|
{
|
||||||
delete (*it);
|
delete it;
|
||||||
}
|
}
|
||||||
for(AUTO_VAR(it, hints[i].begin()); it < hints[i].end(); ++it)
|
for(auto& it : hints[i])
|
||||||
{
|
{
|
||||||
delete (*it);
|
delete it;
|
||||||
}
|
}
|
||||||
|
|
||||||
currentTask[i] = NULL;
|
currentTask[i] = NULL;
|
||||||
|
|
@ -1188,10 +1188,10 @@ void Tutorial::setCompleted( int completableId )
|
||||||
|
|
||||||
|
|
||||||
int completableIndex = -1;
|
int completableIndex = -1;
|
||||||
for( AUTO_VAR(it, s_completableTasks.begin()); it < s_completableTasks.end(); ++it)
|
for (int task : s_completableTasks)
|
||||||
{
|
{
|
||||||
++completableIndex;
|
++completableIndex;
|
||||||
if( *it == completableId )
|
if( task == completableId )
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -1220,10 +1220,10 @@ bool Tutorial::getCompleted( int completableId )
|
||||||
//}
|
//}
|
||||||
|
|
||||||
int completableIndex = -1;
|
int completableIndex = -1;
|
||||||
for( AUTO_VAR(it, s_completableTasks.begin()); it < s_completableTasks.end(); ++it)
|
for (int it : s_completableTasks)
|
||||||
{
|
{
|
||||||
++completableIndex;
|
++completableIndex;
|
||||||
if( *it == completableId )
|
if( it == completableId )
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -1318,8 +1318,8 @@ void Tutorial::tick()
|
||||||
|
|
||||||
for(unsigned int state = 0; state < e_Tutorial_State_Max; ++state)
|
for(unsigned int state = 0; state < e_Tutorial_State_Max; ++state)
|
||||||
{
|
{
|
||||||
AUTO_VAR(it, constraintsToRemove[state].begin());
|
auto it = constraintsToRemove[state].begin();
|
||||||
while(it < constraintsToRemove[state].end() )
|
while(it != constraintsToRemove[state].end() )
|
||||||
{
|
{
|
||||||
++(*it).second;
|
++(*it).second;
|
||||||
if( (*it).second > m_iTutorialConstraintDelayRemoveTicks )
|
if( (*it).second > m_iTutorialConstraintDelayRemoveTicks )
|
||||||
|
|
@ -1361,7 +1361,7 @@ void Tutorial::tick()
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!m_allowShow)
|
if(!m_allowShow)
|
||||||
{
|
{
|
||||||
if( currentTask[m_CurrentState] != NULL && (!currentTask[m_CurrentState]->AllowFade() || (lastMessageTime + m_iTutorialDisplayMessageTime ) > GetTickCount() ) )
|
if( currentTask[m_CurrentState] != NULL && (!currentTask[m_CurrentState]->AllowFade() || (lastMessageTime + m_iTutorialDisplayMessageTime ) > GetTickCount() ) )
|
||||||
{
|
{
|
||||||
uiTempDisabled = true;
|
uiTempDisabled = true;
|
||||||
|
|
@ -1397,7 +1397,7 @@ void Tutorial::tick()
|
||||||
app.TutorialSceneNavigateBack(m_iPad);
|
app.TutorialSceneNavigateBack(m_iPad);
|
||||||
m_bSceneIsSplitscreen=app.GetLocalPlayerCount()>1;
|
m_bSceneIsSplitscreen=app.GetLocalPlayerCount()>1;
|
||||||
if(m_bSceneIsSplitscreen)
|
if(m_bSceneIsSplitscreen)
|
||||||
{
|
{
|
||||||
app.NavigateToScene(m_iPad, eUIComponent_TutorialPopup,(void *)this, false, false, &m_hTutorialScene);
|
app.NavigateToScene(m_iPad, eUIComponent_TutorialPopup,(void *)this, false, false, &m_hTutorialScene);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -1427,9 +1427,8 @@ void Tutorial::tick()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check constraints
|
// Check constraints
|
||||||
for(AUTO_VAR(it, m_globalConstraints.begin()); it < m_globalConstraints.end(); ++it)
|
for (auto& constraint : m_globalConstraints)
|
||||||
{
|
{
|
||||||
TutorialConstraint *constraint = *it;
|
|
||||||
constraint->tick(m_iPad);
|
constraint->tick(m_iPad);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1443,9 +1442,8 @@ void Tutorial::tick()
|
||||||
|
|
||||||
if(hintsOn)
|
if(hintsOn)
|
||||||
{
|
{
|
||||||
for(AUTO_VAR(it, hints[m_CurrentState].begin()); it < hints[m_CurrentState].end(); ++it)
|
for (auto& hint : hints[m_CurrentState])
|
||||||
{
|
{
|
||||||
TutorialHint *hint = *it;
|
|
||||||
hintNeeded = hint->tick();
|
hintNeeded = hint->tick();
|
||||||
if(hintNeeded >= 0)
|
if(hintNeeded >= 0)
|
||||||
{
|
{
|
||||||
|
|
@ -1469,9 +1467,8 @@ void Tutorial::tick()
|
||||||
constraintChanged = true;
|
constraintChanged = true;
|
||||||
currentFailedConstraint[m_CurrentState] = NULL;
|
currentFailedConstraint[m_CurrentState] = NULL;
|
||||||
}
|
}
|
||||||
for(AUTO_VAR(it, constraints[m_CurrentState].begin()); it < constraints[m_CurrentState].end(); ++it)
|
for (auto& constraint : constraints[m_CurrentState])
|
||||||
{
|
{
|
||||||
TutorialConstraint *constraint = *it;
|
|
||||||
if( !constraint->isConstraintSatisfied(m_iPad) && constraint->isConstraintRestrictive(m_iPad) )
|
if( !constraint->isConstraintSatisfied(m_iPad) && constraint->isConstraintRestrictive(m_iPad) )
|
||||||
{
|
{
|
||||||
constraintChanged = true;
|
constraintChanged = true;
|
||||||
|
|
@ -1484,15 +1481,15 @@ void Tutorial::tick()
|
||||||
{
|
{
|
||||||
// Update tasks
|
// Update tasks
|
||||||
bool isCurrentTask = true;
|
bool isCurrentTask = true;
|
||||||
AUTO_VAR(it, activeTasks[m_CurrentState].begin());
|
auto it = activeTasks[m_CurrentState].begin();
|
||||||
while(activeTasks[m_CurrentState].size() > 0 && it < activeTasks[m_CurrentState].end())
|
while(activeTasks[m_CurrentState].size() > 0 && it != activeTasks[m_CurrentState].end())
|
||||||
{
|
{
|
||||||
TutorialTask *task = *it;
|
TutorialTask *task = *it;
|
||||||
if( isCurrentTask || task->isPreCompletionEnabled() )
|
if( isCurrentTask || task->isPreCompletionEnabled() )
|
||||||
{
|
{
|
||||||
isCurrentTask = false;
|
isCurrentTask = false;
|
||||||
if(
|
if(
|
||||||
( !task->ShowMinimumTime() || ( task->hasBeenActivated() && (lastMessageTime + m_iTutorialMinimumDisplayMessageTime ) < GetTickCount() ) )
|
( !task->ShowMinimumTime() || ( task->hasBeenActivated() && (lastMessageTime + m_iTutorialMinimumDisplayMessageTime ) < GetTickCount() ) )
|
||||||
&& task->isCompleted()
|
&& task->isCompleted()
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|
@ -1509,8 +1506,8 @@ void Tutorial::tick()
|
||||||
{
|
{
|
||||||
// 4J Stu - Move the delayed constraints to the gameplay state so that they are in
|
// 4J Stu - Move the delayed constraints to the gameplay state so that they are in
|
||||||
// effect for a bit longer
|
// effect for a bit longer
|
||||||
AUTO_VAR(itCon, constraintsToRemove[m_CurrentState].begin());
|
auto itCon = constraintsToRemove[m_CurrentState].begin();
|
||||||
while(itCon != constraintsToRemove[m_CurrentState].end() )
|
while(itCon != constraintsToRemove[m_CurrentState].end() )
|
||||||
{
|
{
|
||||||
constraints[e_Tutorial_State_Gameplay].push_back(itCon->first);
|
constraints[e_Tutorial_State_Gameplay].push_back(itCon->first);
|
||||||
constraintsToRemove[e_Tutorial_State_Gameplay].push_back( pair<TutorialConstraint *, unsigned char>(itCon->first, itCon->second) );
|
constraintsToRemove[e_Tutorial_State_Gameplay].push_back( pair<TutorialConstraint *, unsigned char>(itCon->first, itCon->second) );
|
||||||
|
|
@ -1521,9 +1518,9 @@ void Tutorial::tick()
|
||||||
}
|
}
|
||||||
// Fall through the the normal complete state
|
// Fall through the the normal complete state
|
||||||
case e_Tutorial_Completion_Complete_State:
|
case e_Tutorial_Completion_Complete_State:
|
||||||
for(AUTO_VAR(itRem, activeTasks[m_CurrentState].begin()); itRem < activeTasks[m_CurrentState].end(); ++itRem)
|
for (auto& itRem : activeTasks[m_CurrentState])
|
||||||
{
|
{
|
||||||
delete (*itRem);
|
delete itRem;
|
||||||
}
|
}
|
||||||
activeTasks[m_CurrentState].clear();
|
activeTasks[m_CurrentState].clear();
|
||||||
break;
|
break;
|
||||||
|
|
@ -1531,9 +1528,9 @@ void Tutorial::tick()
|
||||||
{
|
{
|
||||||
TutorialTask *lastTask = activeTasks[m_CurrentState].at( activeTasks[m_CurrentState].size() - 1 );
|
TutorialTask *lastTask = activeTasks[m_CurrentState].at( activeTasks[m_CurrentState].size() - 1 );
|
||||||
activeTasks[m_CurrentState].pop_back();
|
activeTasks[m_CurrentState].pop_back();
|
||||||
for(AUTO_VAR(itRem, activeTasks[m_CurrentState].begin()); itRem < activeTasks[m_CurrentState].end(); ++itRem)
|
for(auto& itRem : activeTasks[m_CurrentState])
|
||||||
{
|
{
|
||||||
delete (*itRem);
|
delete itRem;
|
||||||
}
|
}
|
||||||
activeTasks[m_CurrentState].clear();
|
activeTasks[m_CurrentState].clear();
|
||||||
activeTasks[m_CurrentState].push_back( lastTask );
|
activeTasks[m_CurrentState].push_back( lastTask );
|
||||||
|
|
@ -1636,7 +1633,7 @@ void Tutorial::tick()
|
||||||
message->m_promptId = currentTask[m_CurrentState]->getPromptId();
|
message->m_promptId = currentTask[m_CurrentState]->getPromptId();
|
||||||
message->m_allowFade = currentTask[m_CurrentState]->AllowFade();
|
message->m_allowFade = currentTask[m_CurrentState]->AllowFade();
|
||||||
setMessage( message );
|
setMessage( message );
|
||||||
currentTask[m_CurrentState]->TaskReminders()? m_iTaskReminders = 1 : m_iTaskReminders = 0;
|
currentTask[m_CurrentState]->TaskReminders()? m_iTaskReminders = 1 : m_iTaskReminders = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -1697,8 +1694,8 @@ bool Tutorial::setMessage(PopupMessageDetails *message)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AUTO_VAR(it, messages.find(message->m_messageId));
|
auto it = messages.find(message->m_messageId);
|
||||||
if( it != messages.end() && it->second != NULL )
|
if( it != messages.end() && it->second != NULL )
|
||||||
{
|
{
|
||||||
TutorialMessage *messageString = it->second;
|
TutorialMessage *messageString = it->second;
|
||||||
text = wstring( messageString->getMessageForDisplay() );
|
text = wstring( messageString->getMessageForDisplay() );
|
||||||
|
|
@ -1727,8 +1724,8 @@ bool Tutorial::setMessage(PopupMessageDetails *message)
|
||||||
}
|
}
|
||||||
else if(message->m_promptId >= 0)
|
else if(message->m_promptId >= 0)
|
||||||
{
|
{
|
||||||
AUTO_VAR(it, messages.find(message->m_promptId));
|
auto it = messages.find(message->m_promptId);
|
||||||
if(it != messages.end() && it->second != NULL)
|
if(it != messages.end() && it->second != NULL)
|
||||||
{
|
{
|
||||||
TutorialMessage *prompt = it->second;
|
TutorialMessage *prompt = it->second;
|
||||||
text.append( prompt->getMessageForDisplay() );
|
text.append( prompt->getMessageForDisplay() );
|
||||||
|
|
@ -1781,7 +1778,7 @@ bool Tutorial::setMessage(TutorialHint *hint, PopupMessageDetails *message)
|
||||||
bool messageShown = false;
|
bool messageShown = false;
|
||||||
DWORD time = GetTickCount();
|
DWORD time = GetTickCount();
|
||||||
if(message != NULL && (message->m_forceDisplay || hintsOn) &&
|
if(message != NULL && (message->m_forceDisplay || hintsOn) &&
|
||||||
(!message->m_delay ||
|
(!message->m_delay ||
|
||||||
(
|
(
|
||||||
(m_hintDisplayed && (time - m_lastHintDisplayedTime) > m_iTutorialHintDelayTime ) ||
|
(m_hintDisplayed && (time - m_lastHintDisplayedTime) > m_iTutorialHintDelayTime ) ||
|
||||||
(!m_hintDisplayed && (time - lastMessageTime) > m_iTutorialMinimumDisplayMessageTime )
|
(!m_hintDisplayed && (time - lastMessageTime) > m_iTutorialMinimumDisplayMessageTime )
|
||||||
|
|
@ -1793,7 +1790,7 @@ bool Tutorial::setMessage(TutorialHint *hint, PopupMessageDetails *message)
|
||||||
|
|
||||||
if(messageShown)
|
if(messageShown)
|
||||||
{
|
{
|
||||||
m_lastHintDisplayedTime = time;
|
m_lastHintDisplayedTime = time;
|
||||||
m_hintDisplayed = true;
|
m_hintDisplayed = true;
|
||||||
if(hint!=NULL) setHintCompleted( hint );
|
if(hint!=NULL) setHintCompleted( hint );
|
||||||
}
|
}
|
||||||
|
|
@ -1817,7 +1814,7 @@ void Tutorial::showTutorialPopup(bool show)
|
||||||
m_allowShow = show;
|
m_allowShow = show;
|
||||||
|
|
||||||
if(!show)
|
if(!show)
|
||||||
{
|
{
|
||||||
if( currentTask[m_CurrentState] != NULL && (!currentTask[m_CurrentState]->AllowFade() || (lastMessageTime + m_iTutorialDisplayMessageTime ) > GetTickCount() ) )
|
if( currentTask[m_CurrentState] != NULL && (!currentTask[m_CurrentState]->AllowFade() || (lastMessageTime + m_iTutorialDisplayMessageTime ) > GetTickCount() ) )
|
||||||
{
|
{
|
||||||
uiTempDisabled = true;
|
uiTempDisabled = true;
|
||||||
|
|
@ -1828,36 +1825,32 @@ void Tutorial::showTutorialPopup(bool show)
|
||||||
|
|
||||||
void Tutorial::useItemOn(Level *level, shared_ptr<ItemInstance> item, int x, int y, int z, bool bTestUseOnly)
|
void Tutorial::useItemOn(Level *level, shared_ptr<ItemInstance> item, int x, int y, int z, bool bTestUseOnly)
|
||||||
{
|
{
|
||||||
for(AUTO_VAR(it, activeTasks[m_CurrentState].begin()); it < activeTasks[m_CurrentState].end(); ++it)
|
for(auto& task : activeTasks[m_CurrentState])
|
||||||
{
|
{
|
||||||
TutorialTask *task = *it;
|
|
||||||
task->useItemOn(level, item, x, y, z, bTestUseOnly);
|
task->useItemOn(level, item, x, y, z, bTestUseOnly);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Tutorial::useItemOn(shared_ptr<ItemInstance> item, bool bTestUseOnly)
|
void Tutorial::useItemOn(shared_ptr<ItemInstance> item, bool bTestUseOnly)
|
||||||
{
|
{
|
||||||
for(AUTO_VAR(it, activeTasks[m_CurrentState].begin()); it < activeTasks[m_CurrentState].end(); ++it)
|
for(auto& task : activeTasks[m_CurrentState])
|
||||||
{
|
{
|
||||||
TutorialTask *task = *it;
|
|
||||||
task->useItem(item, bTestUseOnly);
|
task->useItem(item, bTestUseOnly);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Tutorial::completeUsingItem(shared_ptr<ItemInstance> item)
|
void Tutorial::completeUsingItem(shared_ptr<ItemInstance> item)
|
||||||
{
|
{
|
||||||
for(AUTO_VAR(it, activeTasks[m_CurrentState].begin()); it < activeTasks[m_CurrentState].end(); ++it)
|
for(auto task : activeTasks[m_CurrentState])
|
||||||
{
|
{
|
||||||
TutorialTask *task = *it;
|
|
||||||
task->completeUsingItem(item);
|
task->completeUsingItem(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fix for #46922 - TU5: UI: Player receives a reminder that he is hungry while "hunger bar" is full (triggered in split-screen mode)
|
// Fix for #46922 - TU5: UI: Player receives a reminder that he is hungry while "hunger bar" is full (triggered in split-screen mode)
|
||||||
if(m_CurrentState != e_Tutorial_State_Gameplay)
|
if(m_CurrentState != e_Tutorial_State_Gameplay)
|
||||||
{
|
{
|
||||||
for(AUTO_VAR(it, activeTasks[e_Tutorial_State_Gameplay].begin()); it < activeTasks[e_Tutorial_State_Gameplay].end(); ++it)
|
for(auto task : activeTasks[e_Tutorial_State_Gameplay])
|
||||||
{
|
{
|
||||||
TutorialTask *task = *it;
|
|
||||||
task->completeUsingItem(item);
|
task->completeUsingItem(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1866,9 +1859,8 @@ void Tutorial::completeUsingItem(shared_ptr<ItemInstance> item)
|
||||||
void Tutorial::startDestroyBlock(shared_ptr<ItemInstance> item, Tile *tile)
|
void Tutorial::startDestroyBlock(shared_ptr<ItemInstance> item, Tile *tile)
|
||||||
{
|
{
|
||||||
int hintNeeded = -1;
|
int hintNeeded = -1;
|
||||||
for(AUTO_VAR(it, hints[m_CurrentState].begin()); it < hints[m_CurrentState].end(); ++it)
|
for(auto& hint : hints[m_CurrentState])
|
||||||
{
|
{
|
||||||
TutorialHint *hint = *it;
|
|
||||||
hintNeeded = hint->startDestroyBlock(item, tile);
|
hintNeeded = hint->startDestroyBlock(item, tile);
|
||||||
if(hintNeeded >= 0)
|
if(hintNeeded >= 0)
|
||||||
{
|
{
|
||||||
|
|
@ -1877,16 +1869,14 @@ void Tutorial::startDestroyBlock(shared_ptr<ItemInstance> item, Tile *tile)
|
||||||
setMessage( hint, message );
|
setMessage( hint, message );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Tutorial::destroyBlock(Tile *tile)
|
void Tutorial::destroyBlock(Tile *tile)
|
||||||
{
|
{
|
||||||
int hintNeeded = -1;
|
int hintNeeded = -1;
|
||||||
for(AUTO_VAR(it, hints[m_CurrentState].begin()); it < hints[m_CurrentState].end(); ++it)
|
for(auto& hint : hints[m_CurrentState])
|
||||||
{
|
{
|
||||||
TutorialHint *hint = *it;
|
|
||||||
hintNeeded = hint->destroyBlock(tile);
|
hintNeeded = hint->destroyBlock(tile);
|
||||||
if(hintNeeded >= 0)
|
if(hintNeeded >= 0)
|
||||||
{
|
{
|
||||||
|
|
@ -1895,16 +1885,14 @@ void Tutorial::destroyBlock(Tile *tile)
|
||||||
setMessage( hint, message );
|
setMessage( hint, message );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Tutorial::attack(shared_ptr<Player> player, shared_ptr<Entity> entity)
|
void Tutorial::attack(shared_ptr<Player> player, shared_ptr<Entity> entity)
|
||||||
{
|
{
|
||||||
int hintNeeded = -1;
|
int hintNeeded = -1;
|
||||||
for(AUTO_VAR(it, hints[m_CurrentState].begin()); it < hints[m_CurrentState].end(); ++it)
|
for(auto& hint : hints[m_CurrentState])
|
||||||
{
|
{
|
||||||
TutorialHint *hint = *it;
|
|
||||||
hintNeeded = hint->attack(player->inventory->getSelected(), entity);
|
hintNeeded = hint->attack(player->inventory->getSelected(), entity);
|
||||||
if(hintNeeded >= 0)
|
if(hintNeeded >= 0)
|
||||||
{
|
{
|
||||||
|
|
@ -1920,9 +1908,8 @@ void Tutorial::attack(shared_ptr<Player> player, shared_ptr<Entity> entity)
|
||||||
void Tutorial::itemDamaged(shared_ptr<ItemInstance> item)
|
void Tutorial::itemDamaged(shared_ptr<ItemInstance> item)
|
||||||
{
|
{
|
||||||
int hintNeeded = -1;
|
int hintNeeded = -1;
|
||||||
for(AUTO_VAR(it, hints[m_CurrentState].begin()); it < hints[m_CurrentState].end(); ++it)
|
for(auto& hint : hints[m_CurrentState])
|
||||||
{
|
{
|
||||||
TutorialHint *hint = *it;
|
|
||||||
hintNeeded = hint->itemDamaged(item);
|
hintNeeded = hint->itemDamaged(item);
|
||||||
if(hintNeeded >= 0)
|
if(hintNeeded >= 0)
|
||||||
{
|
{
|
||||||
|
|
@ -1939,11 +1926,6 @@ void Tutorial::handleUIInput(int iAction)
|
||||||
{
|
{
|
||||||
if( m_hintDisplayed ) return;
|
if( m_hintDisplayed ) return;
|
||||||
|
|
||||||
//for(AUTO_VAR(it, activeTasks[m_CurrentState].begin()); it < activeTasks[m_CurrentState].end(); ++it)
|
|
||||||
//{
|
|
||||||
// TutorialTask *task = *it;
|
|
||||||
// task->handleUIInput(iAction);
|
|
||||||
//}
|
|
||||||
if(currentTask[m_CurrentState] != NULL)
|
if(currentTask[m_CurrentState] != NULL)
|
||||||
currentTask[m_CurrentState]->handleUIInput(iAction);
|
currentTask[m_CurrentState]->handleUIInput(iAction);
|
||||||
}
|
}
|
||||||
|
|
@ -1951,9 +1933,8 @@ void Tutorial::handleUIInput(int iAction)
|
||||||
void Tutorial::createItemSelected(shared_ptr<ItemInstance> item, bool canMake)
|
void Tutorial::createItemSelected(shared_ptr<ItemInstance> item, bool canMake)
|
||||||
{
|
{
|
||||||
int hintNeeded = -1;
|
int hintNeeded = -1;
|
||||||
for(AUTO_VAR(it, hints[m_CurrentState].begin()); it < hints[m_CurrentState].end(); ++it)
|
for(auto& hint : hints[m_CurrentState])
|
||||||
{
|
{
|
||||||
TutorialHint *hint = *it;
|
|
||||||
hintNeeded = hint->createItemSelected(item, canMake);
|
hintNeeded = hint->createItemSelected(item, canMake);
|
||||||
if(hintNeeded >= 0)
|
if(hintNeeded >= 0)
|
||||||
{
|
{
|
||||||
|
|
@ -1968,11 +1949,10 @@ void Tutorial::createItemSelected(shared_ptr<ItemInstance> item, bool canMake)
|
||||||
|
|
||||||
void Tutorial::onCrafted(shared_ptr<ItemInstance> item)
|
void Tutorial::onCrafted(shared_ptr<ItemInstance> item)
|
||||||
{
|
{
|
||||||
for(unsigned int state = 0; state < e_Tutorial_State_Max; ++state)
|
for(auto& subtasks : activeTasks)
|
||||||
{
|
{
|
||||||
for(AUTO_VAR(it, activeTasks[state].begin()); it < activeTasks[state].end(); ++it)
|
for(auto& task : subtasks)
|
||||||
{
|
{
|
||||||
TutorialTask *task = *it;
|
|
||||||
task->onCrafted(item);
|
task->onCrafted(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1983,23 +1963,20 @@ void Tutorial::onTake(shared_ptr<ItemInstance> item, unsigned int invItemCountAn
|
||||||
if( !m_hintDisplayed )
|
if( !m_hintDisplayed )
|
||||||
{
|
{
|
||||||
bool hintNeeded = false;
|
bool hintNeeded = false;
|
||||||
for(AUTO_VAR(it, hints[m_CurrentState].begin()); it < hints[m_CurrentState].end(); ++it)
|
for(auto hint : hints[m_CurrentState])
|
||||||
{
|
{
|
||||||
TutorialHint *hint = *it;
|
|
||||||
hintNeeded = hint->onTake(item);
|
hintNeeded = hint->onTake(item);
|
||||||
if(hintNeeded)
|
if(hintNeeded)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for(unsigned int state = 0; state < e_Tutorial_State_Max; ++state)
|
for(auto& subtasks : activeTasks)
|
||||||
{
|
{
|
||||||
for(AUTO_VAR(it, activeTasks[state].begin()); it < activeTasks[state].end(); ++it)
|
for(auto& task : subtasks)
|
||||||
{
|
{
|
||||||
TutorialTask *task = *it;
|
|
||||||
task->onTake(item, invItemCountAnyAux, invItemCountThisAux);
|
task->onTake(item, invItemCountAnyAux, invItemCountThisAux);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2035,9 +2012,8 @@ void Tutorial::onLookAt(int id, int iData)
|
||||||
if( m_hintDisplayed ) return;
|
if( m_hintDisplayed ) return;
|
||||||
|
|
||||||
bool hintNeeded = false;
|
bool hintNeeded = false;
|
||||||
for(AUTO_VAR(it, hints[m_CurrentState].begin()); it < hints[m_CurrentState].end(); ++it)
|
for(auto& hint : hints[m_CurrentState])
|
||||||
{
|
{
|
||||||
TutorialHint *hint = *it;
|
|
||||||
hintNeeded = hint->onLookAt(id, iData);
|
hintNeeded = hint->onLookAt(id, iData);
|
||||||
if(hintNeeded)
|
if(hintNeeded)
|
||||||
{
|
{
|
||||||
|
|
@ -2066,9 +2042,8 @@ void Tutorial::onLookAtEntity(shared_ptr<Entity> entity)
|
||||||
if( m_hintDisplayed ) return;
|
if( m_hintDisplayed ) return;
|
||||||
|
|
||||||
bool hintNeeded = false;
|
bool hintNeeded = false;
|
||||||
for(AUTO_VAR(it, hints[m_CurrentState].begin()); it < hints[m_CurrentState].end(); ++it)
|
for(auto& hint : hints[m_CurrentState])
|
||||||
{
|
{
|
||||||
TutorialHint *hint = *it;
|
|
||||||
hintNeeded = hint->onLookAtEntity(entity->GetType());
|
hintNeeded = hint->onLookAtEntity(entity->GetType());
|
||||||
if(hintNeeded)
|
if(hintNeeded)
|
||||||
{
|
{
|
||||||
|
|
@ -2081,9 +2056,9 @@ void Tutorial::onLookAtEntity(shared_ptr<Entity> entity)
|
||||||
changeTutorialState(e_Tutorial_State_Horse);
|
changeTutorialState(e_Tutorial_State_Horse);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (AUTO_VAR(it, activeTasks[m_CurrentState].begin()); it != activeTasks[m_CurrentState].end(); ++it)
|
for (auto& it : activeTasks[m_CurrentState])
|
||||||
{
|
{
|
||||||
(*it)->onLookAtEntity(entity);
|
it->onLookAtEntity(entity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2098,17 +2073,16 @@ void Tutorial::onRideEntity(shared_ptr<Entity> entity)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (AUTO_VAR(it, activeTasks[m_CurrentState].begin()); it != activeTasks[m_CurrentState].end(); ++it)
|
for (auto& it : activeTasks[m_CurrentState])
|
||||||
{
|
{
|
||||||
(*it)->onRideEntity(entity);
|
it->onRideEntity(entity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Tutorial::onEffectChanged(MobEffect *effect, bool bRemoved)
|
void Tutorial::onEffectChanged(MobEffect *effect, bool bRemoved)
|
||||||
{
|
{
|
||||||
for(AUTO_VAR(it, activeTasks[m_CurrentState].begin()); it < activeTasks[m_CurrentState].end(); ++it)
|
for(auto& task : activeTasks[m_CurrentState])
|
||||||
{
|
{
|
||||||
TutorialTask *task = *it;
|
|
||||||
task->onEffectChanged(effect,bRemoved);
|
task->onEffectChanged(effect,bRemoved);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2116,9 +2090,8 @@ void Tutorial::onEffectChanged(MobEffect *effect, bool bRemoved)
|
||||||
bool Tutorial::canMoveToPosition(double xo, double yo, double zo, double xt, double yt, double zt)
|
bool Tutorial::canMoveToPosition(double xo, double yo, double zo, double xt, double yt, double zt)
|
||||||
{
|
{
|
||||||
bool allowed = true;
|
bool allowed = true;
|
||||||
for(AUTO_VAR(it, constraints[m_CurrentState].begin()); it < constraints[m_CurrentState].end(); ++it)
|
for(auto& constraint : constraints[m_CurrentState])
|
||||||
{
|
{
|
||||||
TutorialConstraint *constraint = *it;
|
|
||||||
if( !constraint->isConstraintSatisfied(m_iPad) && !constraint->canMoveToPosition(xo,yo,zo,xt,yt,zt) )
|
if( !constraint->isConstraintSatisfied(m_iPad) && !constraint->canMoveToPosition(xo,yo,zo,xt,yt,zt) )
|
||||||
{
|
{
|
||||||
allowed = false;
|
allowed = false;
|
||||||
|
|
@ -2136,9 +2109,8 @@ bool Tutorial::isInputAllowed(int mapping)
|
||||||
if( Minecraft::GetInstance()->localplayers[m_iPad]->isUnderLiquid(Material::water) ) return true;
|
if( Minecraft::GetInstance()->localplayers[m_iPad]->isUnderLiquid(Material::water) ) return true;
|
||||||
|
|
||||||
bool allowed = true;
|
bool allowed = true;
|
||||||
for(AUTO_VAR(it, constraints[m_CurrentState].begin()); it < constraints[m_CurrentState].end(); ++it)
|
for(auto& constraint : constraints[m_CurrentState])
|
||||||
{
|
{
|
||||||
TutorialConstraint *constraint = *it;
|
|
||||||
if( constraint->isMappingConstrained( m_iPad, mapping ) )
|
if( constraint->isMappingConstrained( m_iPad, mapping ) )
|
||||||
{
|
{
|
||||||
allowed = false;
|
allowed = false;
|
||||||
|
|
@ -2156,9 +2128,9 @@ vector<TutorialTask *> *Tutorial::getTasks()
|
||||||
unsigned int Tutorial::getCurrentTaskIndex()
|
unsigned int Tutorial::getCurrentTaskIndex()
|
||||||
{
|
{
|
||||||
unsigned int index = 0;
|
unsigned int index = 0;
|
||||||
for(AUTO_VAR(it, tasks.begin()); it < tasks.end(); ++it)
|
for(const auto& task : tasks)
|
||||||
{
|
{
|
||||||
if(*it == currentTask[e_Tutorial_State_Gameplay])
|
if(task == currentTask[e_Tutorial_State_Gameplay])
|
||||||
break;
|
break;
|
||||||
|
|
||||||
++index;
|
++index;
|
||||||
|
|
@ -2184,11 +2156,11 @@ void Tutorial::RemoveConstraint(TutorialConstraint *c, bool delayedRemove /*= fa
|
||||||
if( c->getQueuedForRemoval() )
|
if( c->getQueuedForRemoval() )
|
||||||
{
|
{
|
||||||
// If it is already queued for removal, remove it on the next tick
|
// If it is already queued for removal, remove it on the next tick
|
||||||
/*for(AUTO_VAR(it, constraintsToRemove[m_CurrentState].begin()); it < constraintsToRemove[m_CurrentState].end(); ++it)
|
/*for(auto& it : constraintsToRemove[m_CurrentState])
|
||||||
{
|
{
|
||||||
if( it->first == c )
|
if( it.first == c )
|
||||||
{
|
{
|
||||||
it->second = m_iTutorialConstraintDelayRemoveTicks;
|
it.second = m_iTutorialConstraintDelayRemoveTicks;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}*/
|
}*/
|
||||||
|
|
@ -2196,12 +2168,12 @@ void Tutorial::RemoveConstraint(TutorialConstraint *c, bool delayedRemove /*= fa
|
||||||
else if(delayedRemove)
|
else if(delayedRemove)
|
||||||
{
|
{
|
||||||
c->setQueuedForRemoval(true);
|
c->setQueuedForRemoval(true);
|
||||||
constraintsToRemove[m_CurrentState].push_back( pair<TutorialConstraint *, unsigned char>(c, 0) );
|
constraintsToRemove[m_CurrentState].emplace_back(c, 0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for( AUTO_VAR(it, constraintsToRemove[m_CurrentState].begin()); it < constraintsToRemove[m_CurrentState].end(); ++it)
|
for (auto it = constraintsToRemove[m_CurrentState].begin(); it != constraintsToRemove[m_CurrentState].end(); ++it)
|
||||||
{
|
{
|
||||||
if( it->first == c )
|
if( it->first == c )
|
||||||
{
|
{
|
||||||
constraintsToRemove[m_CurrentState].erase( it );
|
constraintsToRemove[m_CurrentState].erase( it );
|
||||||
|
|
@ -2209,8 +2181,8 @@ void Tutorial::RemoveConstraint(TutorialConstraint *c, bool delayedRemove /*= fa
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AUTO_VAR(it, find( constraints[m_CurrentState].begin(), constraints[m_CurrentState].end(), c));
|
auto it = find(constraints[m_CurrentState].begin(), constraints[m_CurrentState].end(), c);
|
||||||
if( it != constraints[m_CurrentState].end() ) constraints[m_CurrentState].erase( find( constraints[m_CurrentState].begin(), constraints[m_CurrentState].end(), c) );
|
if( it != constraints[m_CurrentState].end() ) constraints[m_CurrentState].erase( find( constraints[m_CurrentState].begin(), constraints[m_CurrentState].end(), c) );
|
||||||
|
|
||||||
// It may be in the gameplay list, so remove it from there if it is
|
// It may be in the gameplay list, so remove it from there if it is
|
||||||
it = find( constraints[e_Tutorial_State_Gameplay].begin(), constraints[e_Tutorial_State_Gameplay].end(), c);
|
it = find( constraints[e_Tutorial_State_Gameplay].begin(), constraints[e_Tutorial_State_Gameplay].end(), c);
|
||||||
|
|
@ -2271,7 +2243,7 @@ void Tutorial::changeTutorialState(eTutorial_State newState, UIScene *scene /*=
|
||||||
// The action that caused the change of state may also have completed the current task
|
// The action that caused the change of state may also have completed the current task
|
||||||
if( currentTask[m_CurrentState] != NULL && currentTask[m_CurrentState]->isCompleted() )
|
if( currentTask[m_CurrentState] != NULL && currentTask[m_CurrentState]->isCompleted() )
|
||||||
{
|
{
|
||||||
activeTasks[m_CurrentState].erase( find( activeTasks[m_CurrentState].begin(), activeTasks[m_CurrentState].end(), currentTask[m_CurrentState]) );
|
activeTasks[m_CurrentState].erase( find( activeTasks[m_CurrentState].begin(), activeTasks[m_CurrentState].end(), currentTask[m_CurrentState]) );
|
||||||
|
|
||||||
if( activeTasks[m_CurrentState].size() > 0 )
|
if( activeTasks[m_CurrentState].size() > 0 )
|
||||||
{
|
{
|
||||||
|
|
@ -2304,9 +2276,8 @@ void Tutorial::changeTutorialState(eTutorial_State newState, UIScene *scene /*=
|
||||||
|
|
||||||
if( m_CurrentState != newState )
|
if( m_CurrentState != newState )
|
||||||
{
|
{
|
||||||
for(AUTO_VAR(it, activeTasks[newState].begin()); it < activeTasks[newState].end(); ++it)
|
for (auto& task : activeTasks[newState] )
|
||||||
{
|
{
|
||||||
TutorialTask *task = *it;
|
|
||||||
task->onStateChange(newState);
|
task->onStateChange(newState);
|
||||||
}
|
}
|
||||||
m_CurrentState = newState;
|
m_CurrentState = newState;
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
#include "TutorialConstraints.h"
|
#include "TutorialConstraints.h"
|
||||||
#include "TutorialTask.h"
|
#include "TutorialTask.h"
|
||||||
|
|
||||||
TutorialTask::TutorialTask(Tutorial *tutorial, int descriptionId, bool enablePreCompletion, vector<TutorialConstraint *> *inConstraints,
|
TutorialTask::TutorialTask(Tutorial *tutorial, int descriptionId, bool enablePreCompletion, vector<TutorialConstraint *> *inConstraints,
|
||||||
bool bShowMinimumTime, bool bAllowFade, bool bTaskReminders)
|
bool bShowMinimumTime, bool bAllowFade, bool bTaskReminders)
|
||||||
: tutorial( tutorial ), descriptionId( descriptionId ), m_promptId( -1 ), enablePreCompletion( enablePreCompletion ),
|
: tutorial( tutorial ), descriptionId( descriptionId ), m_promptId( -1 ), enablePreCompletion( enablePreCompletion ),
|
||||||
areConstraintsEnabled( false ), bIsCompleted( false ), bHasBeenActivated( false ),
|
areConstraintsEnabled( false ), bIsCompleted( false ), bHasBeenActivated( false ),
|
||||||
|
|
@ -11,9 +11,8 @@ TutorialTask::TutorialTask(Tutorial *tutorial, int descriptionId, bool enablePre
|
||||||
{
|
{
|
||||||
if(inConstraints != NULL)
|
if(inConstraints != NULL)
|
||||||
{
|
{
|
||||||
for(AUTO_VAR(it, inConstraints->begin()); it < inConstraints->end(); ++it)
|
for(auto& constraint : *inConstraints)
|
||||||
{
|
{
|
||||||
TutorialConstraint *constraint = *it;
|
|
||||||
constraints.push_back( constraint );
|
constraints.push_back( constraint );
|
||||||
}
|
}
|
||||||
delete inConstraints;
|
delete inConstraints;
|
||||||
|
|
@ -26,10 +25,8 @@ TutorialTask::~TutorialTask()
|
||||||
{
|
{
|
||||||
enableConstraints(false);
|
enableConstraints(false);
|
||||||
|
|
||||||
for(AUTO_VAR(it, constraints.begin()); it < constraints.end(); ++it)
|
for(auto& constraint : constraints)
|
||||||
{
|
{
|
||||||
TutorialConstraint *constraint = *it;
|
|
||||||
|
|
||||||
if( constraint->getQueuedForRemoval() )
|
if( constraint->getQueuedForRemoval() )
|
||||||
{
|
{
|
||||||
constraint->setDeleteOnDeactivate(true);
|
constraint->setDeleteOnDeactivate(true);
|
||||||
|
|
@ -52,9 +49,8 @@ void TutorialTask::enableConstraints(bool enable, bool delayRemove /*= false*/)
|
||||||
if( !enable && (areConstraintsEnabled || !delayRemove) )
|
if( !enable && (areConstraintsEnabled || !delayRemove) )
|
||||||
{
|
{
|
||||||
// Remove
|
// Remove
|
||||||
for(AUTO_VAR(it, constraints.begin()); it != constraints.end(); ++it)
|
for(auto& constraint : constraints)
|
||||||
{
|
{
|
||||||
TutorialConstraint *constraint = *it;
|
|
||||||
//app.DebugPrintf(">>>>>>>> %i\n", constraints.size());
|
//app.DebugPrintf(">>>>>>>> %i\n", constraints.size());
|
||||||
tutorial->RemoveConstraint( constraint, delayRemove );
|
tutorial->RemoveConstraint( constraint, delayRemove );
|
||||||
}
|
}
|
||||||
|
|
@ -63,9 +59,8 @@ void TutorialTask::enableConstraints(bool enable, bool delayRemove /*= false*/)
|
||||||
else if( !areConstraintsEnabled && enable )
|
else if( !areConstraintsEnabled && enable )
|
||||||
{
|
{
|
||||||
// Add
|
// Add
|
||||||
for(AUTO_VAR(it, constraints.begin()); it != constraints.end(); ++it)
|
for(auto& constraint : constraints)
|
||||||
{
|
{
|
||||||
TutorialConstraint *constraint = *it;
|
|
||||||
tutorial->AddConstraint( constraint );
|
tutorial->AddConstraint( constraint );
|
||||||
}
|
}
|
||||||
areConstraintsEnabled = true;
|
areConstraintsEnabled = true;
|
||||||
|
|
|
||||||
|
|
@ -91,7 +91,7 @@ IUIScene_CraftingMenu::_eGroupTab IUIScene_CraftingMenu::m_GroupTabBkgMapping3x3
|
||||||
// eBaseItemType_bow,
|
// eBaseItemType_bow,
|
||||||
// eBaseItemType_pockettool,
|
// eBaseItemType_pockettool,
|
||||||
// eBaseItemType_utensil,
|
// eBaseItemType_utensil,
|
||||||
//
|
//
|
||||||
// }
|
// }
|
||||||
// eBaseItemType;
|
// eBaseItemType;
|
||||||
|
|
||||||
|
|
@ -180,11 +180,11 @@ bool IUIScene_CraftingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat)
|
||||||
UpdateTooltips();
|
UpdateTooltips();
|
||||||
break;
|
break;
|
||||||
case ACTION_MENU_PAUSEMENU:
|
case ACTION_MENU_PAUSEMENU:
|
||||||
case ACTION_MENU_B:
|
case ACTION_MENU_B:
|
||||||
ui.ShowTooltip( iPad, eToolTipButtonX, false );
|
ui.ShowTooltip( iPad, eToolTipButtonX, false );
|
||||||
ui.ShowTooltip( iPad, eToolTipButtonB, false );
|
ui.ShowTooltip( iPad, eToolTipButtonB, false );
|
||||||
ui.ShowTooltip( iPad, eToolTipButtonA, false );
|
ui.ShowTooltip( iPad, eToolTipButtonA, false );
|
||||||
ui.ShowTooltip( iPad, eToolTipButtonRB, false );
|
ui.ShowTooltip( iPad, eToolTipButtonRB, false );
|
||||||
// kill the crafting xui
|
// kill the crafting xui
|
||||||
//ui.PlayUISFX(eSFX_Back);
|
//ui.PlayUISFX(eSFX_Back);
|
||||||
ui.CloseUIScenes(iPad);
|
ui.CloseUIScenes(iPad);
|
||||||
|
|
@ -197,14 +197,14 @@ bool IUIScene_CraftingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat)
|
||||||
#endif
|
#endif
|
||||||
// Do some crafting!
|
// Do some crafting!
|
||||||
if(m_pPlayer && m_pPlayer->inventory)
|
if(m_pPlayer && m_pPlayer->inventory)
|
||||||
{
|
{
|
||||||
//RecipyList *recipes = ((Recipes *)Recipes::getInstance())->getRecipies();
|
//RecipyList *recipes = ((Recipes *)Recipes::getInstance())->getRecipies();
|
||||||
Recipy::INGREDIENTS_REQUIRED *pRecipeIngredientsRequired=Recipes::getInstance()->getRecipeIngredientsArray();
|
Recipy::INGREDIENTS_REQUIRED *pRecipeIngredientsRequired=Recipes::getInstance()->getRecipeIngredientsArray();
|
||||||
// Force a make if the debug is on
|
// Force a make if the debug is on
|
||||||
if(app.DebugSettingsOn() && app.GetGameSettingsDebugMask(ProfileManager.GetPrimaryPad())&(1L<<eDebugSetting_CraftAnything))
|
if(app.DebugSettingsOn() && app.GetGameSettingsDebugMask(ProfileManager.GetPrimaryPad())&(1L<<eDebugSetting_CraftAnything))
|
||||||
{
|
{
|
||||||
if(CanBeMadeA[m_iCurrentSlotHIndex].iCount!=0)
|
if(CanBeMadeA[m_iCurrentSlotHIndex].iCount!=0)
|
||||||
{
|
{
|
||||||
int iSlot=iVSlotIndexA[m_iCurrentSlotVIndex];
|
int iSlot=iVSlotIndexA[m_iCurrentSlotVIndex];
|
||||||
|
|
||||||
int iRecipe= CanBeMadeA[m_iCurrentSlotHIndex].iRecipeA[iSlot];
|
int iRecipe= CanBeMadeA[m_iCurrentSlotHIndex].iRecipeA[iSlot];
|
||||||
|
|
@ -256,7 +256,7 @@ bool IUIScene_CraftingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(pRecipeIngredientsRequired[iRecipe].bCanMake[iPad])
|
if(pRecipeIngredientsRequired[iRecipe].bCanMake[iPad])
|
||||||
{
|
{
|
||||||
pTempItemInst->onCraftedBy(m_pPlayer->level, dynamic_pointer_cast<Player>( m_pPlayer->shared_from_this() ), pTempItemInst->count );
|
pTempItemInst->onCraftedBy(m_pPlayer->level, dynamic_pointer_cast<Player>( m_pPlayer->shared_from_this() ), pTempItemInst->count );
|
||||||
// TODO 4J Stu - handleCraftItem should do a lot more than what it does, loads of the "can we craft" code should also probably be
|
// TODO 4J Stu - handleCraftItem should do a lot more than what it does, loads of the "can we craft" code should also probably be
|
||||||
|
|
@ -340,7 +340,7 @@ bool IUIScene_CraftingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ACTION_MENU_LEFT_SCROLL:
|
case ACTION_MENU_LEFT_SCROLL:
|
||||||
// turn off the old group tab
|
// turn off the old group tab
|
||||||
showTabHighlight(m_iGroupIndex,false);
|
showTabHighlight(m_iGroupIndex,false);
|
||||||
|
|
||||||
if(m_iGroupIndex==0)
|
if(m_iGroupIndex==0)
|
||||||
|
|
@ -434,7 +434,7 @@ bool IUIScene_CraftingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat)
|
||||||
// clear the indices
|
// clear the indices
|
||||||
iVSlotIndexA[0]=CanBeMadeA[m_iCurrentSlotHIndex].iCount-1;
|
iVSlotIndexA[0]=CanBeMadeA[m_iCurrentSlotHIndex].iCount-1;
|
||||||
iVSlotIndexA[1]=0;
|
iVSlotIndexA[1]=0;
|
||||||
iVSlotIndexA[2]=1;
|
iVSlotIndexA[2]=1;
|
||||||
|
|
||||||
UpdateVerticalSlots();
|
UpdateVerticalSlots();
|
||||||
UpdateHighlight();
|
UpdateHighlight();
|
||||||
|
|
@ -485,13 +485,13 @@ bool IUIScene_CraftingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
iVSlotIndexA[1]--;
|
iVSlotIndexA[1]--;
|
||||||
}
|
}
|
||||||
ui.PlayUISFX(eSFX_Focus);
|
ui.PlayUISFX(eSFX_Focus);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if(CanBeMadeA[m_iCurrentSlotHIndex].iCount>2)
|
if(CanBeMadeA[m_iCurrentSlotHIndex].iCount>2)
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
if(m_iCurrentSlotVIndex!=0)
|
if(m_iCurrentSlotVIndex!=0)
|
||||||
{
|
{
|
||||||
// just move the highlight
|
// just move the highlight
|
||||||
|
|
@ -499,11 +499,11 @@ bool IUIScene_CraftingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat)
|
||||||
ui.PlayUISFX(eSFX_Focus);
|
ui.PlayUISFX(eSFX_Focus);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//move the slots
|
//move the slots
|
||||||
iVSlotIndexA[2]=iVSlotIndexA[1];
|
iVSlotIndexA[2]=iVSlotIndexA[1];
|
||||||
iVSlotIndexA[1]=iVSlotIndexA[0];
|
iVSlotIndexA[1]=iVSlotIndexA[0];
|
||||||
// on 0 and went up, so cycle the values
|
// on 0 and went up, so cycle the values
|
||||||
if(iVSlotIndexA[0]==0)
|
if(iVSlotIndexA[0]==0)
|
||||||
{
|
{
|
||||||
iVSlotIndexA[0]=CanBeMadeA[m_iCurrentSlotHIndex].iCount-1;
|
iVSlotIndexA[0]=CanBeMadeA[m_iCurrentSlotHIndex].iCount-1;
|
||||||
|
|
@ -536,7 +536,7 @@ bool IUIScene_CraftingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat)
|
||||||
if(CanBeMadeA[m_iCurrentSlotHIndex].iCount>1)
|
if(CanBeMadeA[m_iCurrentSlotHIndex].iCount>1)
|
||||||
{
|
{
|
||||||
if(bNoScrollSlots)
|
if(bNoScrollSlots)
|
||||||
{
|
{
|
||||||
if(iVSlotIndexA[1]==(CanBeMadeA[m_iCurrentSlotHIndex].iCount-1))
|
if(iVSlotIndexA[1]==(CanBeMadeA[m_iCurrentSlotHIndex].iCount-1))
|
||||||
{
|
{
|
||||||
iVSlotIndexA[1]=0;
|
iVSlotIndexA[1]=0;
|
||||||
|
|
@ -577,7 +577,7 @@ bool IUIScene_CraftingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat)
|
||||||
{
|
{
|
||||||
m_iCurrentSlotVIndex++;
|
m_iCurrentSlotVIndex++;
|
||||||
ui.PlayUISFX(eSFX_Focus);
|
ui.PlayUISFX(eSFX_Focus);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
UpdateVerticalSlots();
|
UpdateVerticalSlots();
|
||||||
UpdateHighlight();
|
UpdateHighlight();
|
||||||
|
|
@ -621,9 +621,9 @@ void IUIScene_CraftingMenu::CheckRecipesAvailable()
|
||||||
RecipyList *recipes = ((Recipes *)Recipes::getInstance())->getRecipies();
|
RecipyList *recipes = ((Recipes *)Recipes::getInstance())->getRecipies();
|
||||||
Recipy::INGREDIENTS_REQUIRED *pRecipeIngredientsRequired=Recipes::getInstance()->getRecipeIngredientsArray();
|
Recipy::INGREDIENTS_REQUIRED *pRecipeIngredientsRequired=Recipes::getInstance()->getRecipeIngredientsArray();
|
||||||
int iRecipeC=(int)recipes->size();
|
int iRecipeC=(int)recipes->size();
|
||||||
AUTO_VAR(itRecipe, recipes->begin());
|
auto itRecipe = recipes->begin();
|
||||||
|
|
||||||
// dump out the recipe products
|
// dump out the recipe products
|
||||||
|
|
||||||
// for (int i = 0; i < iRecipeC; i++)
|
// for (int i = 0; i < iRecipeC; i++)
|
||||||
// {
|
// {
|
||||||
|
|
@ -631,7 +631,7 @@ void IUIScene_CraftingMenu::CheckRecipesAvailable()
|
||||||
// if (pTempItemInst != NULL)
|
// if (pTempItemInst != NULL)
|
||||||
// {
|
// {
|
||||||
// wstring itemstring=pTempItemInst->toString();
|
// wstring itemstring=pTempItemInst->toString();
|
||||||
//
|
//
|
||||||
// printf("Recipe [%d] = ",i);
|
// printf("Recipe [%d] = ",i);
|
||||||
// OutputDebugStringW(itemstring.c_str());
|
// OutputDebugStringW(itemstring.c_str());
|
||||||
// if(pTempItemInst->id!=0)
|
// if(pTempItemInst->id!=0)
|
||||||
|
|
@ -645,7 +645,7 @@ void IUIScene_CraftingMenu::CheckRecipesAvailable()
|
||||||
// {
|
// {
|
||||||
// printf("ID\t%d\tAux val\t%d\tBase type\t%d\tMaterial\t%d Count=%d\n",pTempItemInst->id, pTempItemInst->getAuxValue(),pTempItemInst->getItem()->getBaseItemType(),pTempItemInst->getItem()->getMaterial(),pTempItemInst->GetCount());
|
// printf("ID\t%d\tAux val\t%d\tBase type\t%d\tMaterial\t%d Count=%d\n",pTempItemInst->id, pTempItemInst->getAuxValue(),pTempItemInst->getItem()->getBaseItemType(),pTempItemInst->getItem()->getMaterial(),pTempItemInst->GetCount());
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
@ -686,9 +686,9 @@ void IUIScene_CraftingMenu::CheckRecipesAvailable()
|
||||||
if (m_pPlayer->inventory->items[k] != NULL)
|
if (m_pPlayer->inventory->items[k] != NULL)
|
||||||
{
|
{
|
||||||
// do they have the ingredient, and the aux value matches, and enough off it?
|
// do they have the ingredient, and the aux value matches, and enough off it?
|
||||||
if((m_pPlayer->inventory->items[k]->id == pRecipeIngredientsRequired[i].iIngIDA[j]) &&
|
if((m_pPlayer->inventory->items[k]->id == pRecipeIngredientsRequired[i].iIngIDA[j]) &&
|
||||||
// check if the ingredient required doesn't care about the aux value, or if it does, does the inventory item aux match it
|
// check if the ingredient required doesn't care about the aux value, or if it does, does the inventory item aux match it
|
||||||
((pRecipeIngredientsRequired[i].iIngAuxValA[j]==Recipes::ANY_AUX_VALUE) || (pRecipeIngredientsRequired[i].iIngAuxValA[j]==m_pPlayer->inventory->items[k]->getAuxValue()))
|
((pRecipeIngredientsRequired[i].iIngAuxValA[j]==Recipes::ANY_AUX_VALUE) || (pRecipeIngredientsRequired[i].iIngAuxValA[j]==m_pPlayer->inventory->items[k]->getAuxValue()))
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// do they have enough? We need to check the whole inventory, since they may have enough in different slots (milk isn't milkx3, but milk,milk,milk)
|
// do they have enough? We need to check the whole inventory, since they may have enough in different slots (milk isn't milkx3, but milk,milk,milk)
|
||||||
|
|
@ -724,18 +724,18 @@ void IUIScene_CraftingMenu::CheckRecipesAvailable()
|
||||||
// 4J Stu - TU-1 hotfix
|
// 4J Stu - TU-1 hotfix
|
||||||
// Fix for #13143 - Players are able to craft items they do not have enough ingredients for if they store the ingredients in multiple, smaller stacks
|
// Fix for #13143 - Players are able to craft items they do not have enough ingredients for if they store the ingredients in multiple, smaller stacks
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// if bFoundA[j] is false, then we didn't have enough of the ingredient required by the recipe, so mark the grid items we're short of
|
// if bFoundA[j] is false, then we didn't have enough of the ingredient required by the recipe, so mark the grid items we're short of
|
||||||
if(bFoundA[j]==false)
|
if(bFoundA[j]==false)
|
||||||
{
|
{
|
||||||
int iMissing = pRecipeIngredientsRequired[i].iIngValA[j]-iTotalCount;
|
int iMissing = pRecipeIngredientsRequired[i].iIngValA[j]-iTotalCount;
|
||||||
int iGridIndex=0;
|
int iGridIndex=0;
|
||||||
while(iMissing!=0)
|
while(iMissing!=0)
|
||||||
{
|
{
|
||||||
// need to check if there is an aux val and match that
|
// need to check if there is an aux val and match that
|
||||||
if(((pRecipeIngredientsRequired[i].uiGridA[iGridIndex]&0x00FFFFFF)==pRecipeIngredientsRequired[i].iIngIDA[j]) &&
|
if(((pRecipeIngredientsRequired[i].uiGridA[iGridIndex]&0x00FFFFFF)==pRecipeIngredientsRequired[i].iIngIDA[j]) &&
|
||||||
((pRecipeIngredientsRequired[i].iIngAuxValA[j]==Recipes::ANY_AUX_VALUE) ||(pRecipeIngredientsRequired[i].iIngAuxValA[j]== ((pRecipeIngredientsRequired[i].uiGridA[iGridIndex]&0xFF000000)>>24))) )
|
((pRecipeIngredientsRequired[i].iIngAuxValA[j]==Recipes::ANY_AUX_VALUE) ||(pRecipeIngredientsRequired[i].iIngAuxValA[j]== ((pRecipeIngredientsRequired[i].uiGridA[iGridIndex]&0xFF000000)>>24))) )
|
||||||
{
|
{
|
||||||
// this grid entry is the ingredient we don't have enough of
|
// this grid entry is the ingredient we don't have enough of
|
||||||
|
|
@ -780,7 +780,7 @@ void IUIScene_CraftingMenu::CheckRecipesAvailable()
|
||||||
|
|
||||||
// ignore for the misc base type - these have not been placed in a base type group
|
// ignore for the misc base type - these have not been placed in a base type group
|
||||||
if(iBaseType!=Item::eBaseItemType_undefined)
|
if(iBaseType!=Item::eBaseItemType_undefined)
|
||||||
{
|
{
|
||||||
for(int k=0;k<iHSlotBrushControl;k++)
|
for(int k=0;k<iHSlotBrushControl;k++)
|
||||||
{
|
{
|
||||||
// if the item base type is the same as one already in, then add it to that list
|
// if the item base type is the same as one already in, then add it to that list
|
||||||
|
|
@ -804,7 +804,7 @@ void IUIScene_CraftingMenu::CheckRecipesAvailable()
|
||||||
if(!bFound)
|
if(!bFound)
|
||||||
{
|
{
|
||||||
if(iHSlotBrushControl<m_iCraftablesMaxHSlotC)
|
if(iHSlotBrushControl<m_iCraftablesMaxHSlotC)
|
||||||
{
|
{
|
||||||
// add to the list
|
// add to the list
|
||||||
CanBeMadeA[iHSlotBrushControl].iItemBaseType=iBaseType;
|
CanBeMadeA[iHSlotBrushControl].iItemBaseType=iBaseType;
|
||||||
CanBeMadeA[iHSlotBrushControl].iRecipeA[CanBeMadeA[iHSlotBrushControl].iCount++]=i;
|
CanBeMadeA[iHSlotBrushControl].iRecipeA[CanBeMadeA[iHSlotBrushControl].iCount++]=i;
|
||||||
|
|
@ -827,7 +827,7 @@ void IUIScene_CraftingMenu::CheckRecipesAvailable()
|
||||||
}
|
}
|
||||||
|
|
||||||
delete [] bFoundA;
|
delete [] bFoundA;
|
||||||
itRecipe++;
|
itRecipe++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -847,7 +847,7 @@ void IUIScene_CraftingMenu::CheckRecipesAvailable()
|
||||||
uiAlpha = 31;
|
uiAlpha = 31;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(pRecipeIngredientsRequired[CanBeMadeA[iIndex].iRecipeA[0]].bCanMake[getPad()])
|
if(pRecipeIngredientsRequired[CanBeMadeA[iIndex].iRecipeA[0]].bCanMake[getPad()])
|
||||||
{
|
{
|
||||||
uiAlpha = 31;
|
uiAlpha = 31;
|
||||||
|
|
@ -936,10 +936,10 @@ void IUIScene_CraftingMenu::UpdateHighlight()
|
||||||
{
|
{
|
||||||
itemstring=app.GetString( IDS_ITEM_FIREBALLCOAL );
|
itemstring=app.GetString( IDS_ITEM_FIREBALLCOAL );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
itemstring=app.GetString(id );
|
itemstring=app.GetString(id );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1004,7 +1004,7 @@ void IUIScene_CraftingMenu::UpdateVerticalSlots()
|
||||||
uiAlpha = 31;
|
uiAlpha = 31;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(pRecipeIngredientsRequired[CanBeMadeA[m_iCurrentSlotHIndex].iRecipeA[iVSlotIndexA[i]]].bCanMake[getPad()])
|
if(pRecipeIngredientsRequired[CanBeMadeA[m_iCurrentSlotHIndex].iRecipeA[iVSlotIndexA[i]]].bCanMake[getPad()])
|
||||||
{
|
{
|
||||||
uiAlpha = 31;
|
uiAlpha = 31;
|
||||||
|
|
@ -1043,7 +1043,7 @@ void IUIScene_CraftingMenu::DisplayIngredients()
|
||||||
hideAllIngredientsSlots();
|
hideAllIngredientsSlots();
|
||||||
|
|
||||||
if(CanBeMadeA[m_iCurrentSlotHIndex].iCount!=0)
|
if(CanBeMadeA[m_iCurrentSlotHIndex].iCount!=0)
|
||||||
{
|
{
|
||||||
int iSlot,iRecipy;
|
int iSlot,iRecipy;
|
||||||
if(CanBeMadeA[m_iCurrentSlotHIndex].iCount>1)
|
if(CanBeMadeA[m_iCurrentSlotHIndex].iCount>1)
|
||||||
{
|
{
|
||||||
|
|
@ -1135,13 +1135,13 @@ void IUIScene_CraftingMenu::DisplayIngredients()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
for (int x = 0; x < iBoxWidth; x++)
|
for (int x = 0; x < iBoxWidth; x++)
|
||||||
{
|
{
|
||||||
for (int y = 0; y < iBoxWidth; y++)
|
for (int y = 0; y < iBoxWidth; y++)
|
||||||
{
|
{
|
||||||
int index = x+y*iBoxWidth;
|
int index = x+y*iBoxWidth;
|
||||||
if(pRecipeIngredientsRequired[iRecipy].uiGridA[x+y*3]!=0)
|
if(pRecipeIngredientsRequired[iRecipy].uiGridA[x+y*3]!=0)
|
||||||
{
|
{
|
||||||
int id=pRecipeIngredientsRequired[iRecipy].uiGridA[x+y*3]&0x00FFFFFF;
|
int id=pRecipeIngredientsRequired[iRecipy].uiGridA[x+y*3]&0x00FFFFFF;
|
||||||
assert(id!=0);
|
assert(id!=0);
|
||||||
int iAuxVal=(pRecipeIngredientsRequired[iRecipy].uiGridA[x+y*3]&0xFF000000)>>24;
|
int iAuxVal=(pRecipeIngredientsRequired[iRecipy].uiGridA[x+y*3]&0xFF000000)>>24;
|
||||||
|
|
@ -1164,7 +1164,7 @@ void IUIScene_CraftingMenu::DisplayIngredients()
|
||||||
setIngredientSlotRedBox(index, false);
|
setIngredientSlotRedBox(index, false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if((pRecipeIngredientsRequired[iRecipy].usBitmaskMissingGridIngredients[getPad()]&(1<<(x+y*3)))!=0)
|
if((pRecipeIngredientsRequired[iRecipy].usBitmaskMissingGridIngredients[getPad()]&(1<<(x+y*3)))!=0)
|
||||||
{
|
{
|
||||||
setIngredientSlotRedBox(index, true);
|
setIngredientSlotRedBox(index, true);
|
||||||
|
|
@ -1179,7 +1179,7 @@ void IUIScene_CraftingMenu::DisplayIngredients()
|
||||||
{
|
{
|
||||||
setIngredientSlotRedBox(index, false);
|
setIngredientSlotRedBox(index, false);
|
||||||
setIngredientSlotItem(getPad(),index,nullptr);
|
setIngredientSlotItem(getPad(),index,nullptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1203,7 +1203,7 @@ void IUIScene_CraftingMenu::DisplayIngredients()
|
||||||
{
|
{
|
||||||
setIngredientSlotRedBox(i, false);
|
setIngredientSlotRedBox(i, false);
|
||||||
setIngredientSlotItem(getPad(),i,nullptr);
|
setIngredientSlotItem(getPad(),i,nullptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1220,7 +1220,7 @@ void IUIScene_CraftingMenu::UpdateDescriptionText(bool bCanBeMade)
|
||||||
Recipy::INGREDIENTS_REQUIRED *pRecipeIngredientsRequired=Recipes::getInstance()->getRecipeIngredientsArray();
|
Recipy::INGREDIENTS_REQUIRED *pRecipeIngredientsRequired=Recipes::getInstance()->getRecipeIngredientsArray();
|
||||||
|
|
||||||
if(bCanBeMade)
|
if(bCanBeMade)
|
||||||
{
|
{
|
||||||
int iSlot;//,iRecipy;
|
int iSlot;//,iRecipy;
|
||||||
if(CanBeMadeA[m_iCurrentSlotHIndex].iCount>1)
|
if(CanBeMadeA[m_iCurrentSlotHIndex].iCount>1)
|
||||||
{
|
{
|
||||||
|
|
@ -1293,13 +1293,13 @@ void IUIScene_CraftingMenu::UpdateDescriptionText(bool bCanBeMade)
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
setDescriptionText(L"This is some placeholder description text about the craftable item.");
|
setDescriptionText(L"This is some placeholder description text about the craftable item.");
|
||||||
#else
|
#else
|
||||||
setDescriptionText(L"");
|
setDescriptionText(L"");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setDescriptionText(L"");
|
setDescriptionText(L"");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1323,7 +1323,7 @@ void IUIScene_CraftingMenu::UpdateTooltips()
|
||||||
{
|
{
|
||||||
iSlot=iVSlotIndexA[m_iCurrentSlotVIndex];
|
iSlot=iVSlotIndexA[m_iCurrentSlotVIndex];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
iSlot=0;
|
iSlot=0;
|
||||||
}
|
}
|
||||||
|
|
@ -1363,7 +1363,7 @@ void IUIScene_CraftingMenu::UpdateTooltips()
|
||||||
{
|
{
|
||||||
iSlot=iVSlotIndexA[m_iCurrentSlotVIndex];
|
iSlot=iVSlotIndexA[m_iCurrentSlotVIndex];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
iSlot=0;
|
iSlot=0;
|
||||||
}
|
}
|
||||||
|
|
@ -1396,7 +1396,7 @@ bool IUIScene_CraftingMenu::isItemSelected(int itemId)
|
||||||
{
|
{
|
||||||
bool isSelected = false;
|
bool isSelected = false;
|
||||||
if(m_pPlayer && m_pPlayer->inventory)
|
if(m_pPlayer && m_pPlayer->inventory)
|
||||||
{
|
{
|
||||||
//RecipyList *recipes = ((Recipes *)Recipes::getInstance())->getRecipies();
|
//RecipyList *recipes = ((Recipes *)Recipes::getInstance())->getRecipies();
|
||||||
Recipy::INGREDIENTS_REQUIRED *pRecipeIngredientsRequired=Recipes::getInstance()->getRecipeIngredientsArray();
|
Recipy::INGREDIENTS_REQUIRED *pRecipeIngredientsRequired=Recipes::getInstance()->getRecipeIngredientsArray();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ void IUIScene_CreativeMenu::staticCtor()
|
||||||
ITEM_AUX(Tile::treeTrunk_Id, 0)
|
ITEM_AUX(Tile::treeTrunk_Id, 0)
|
||||||
ITEM_AUX(Tile::treeTrunk_Id, TreeTile::DARK_TRUNK)
|
ITEM_AUX(Tile::treeTrunk_Id, TreeTile::DARK_TRUNK)
|
||||||
ITEM_AUX(Tile::treeTrunk_Id, TreeTile::BIRCH_TRUNK)
|
ITEM_AUX(Tile::treeTrunk_Id, TreeTile::BIRCH_TRUNK)
|
||||||
ITEM_AUX(Tile::treeTrunk_Id, TreeTile::JUNGLE_TRUNK)
|
ITEM_AUX(Tile::treeTrunk_Id, TreeTile::JUNGLE_TRUNK)
|
||||||
ITEM(Tile::gravel_Id)
|
ITEM(Tile::gravel_Id)
|
||||||
ITEM(Tile::redBrick_Id)
|
ITEM(Tile::redBrick_Id)
|
||||||
ITEM(Tile::mossyCobblestone_Id)
|
ITEM(Tile::mossyCobblestone_Id)
|
||||||
|
|
@ -144,7 +144,7 @@ void IUIScene_CreativeMenu::staticCtor()
|
||||||
ITEM(Tile::sponge_Id)
|
ITEM(Tile::sponge_Id)
|
||||||
ITEM(Tile::melon_Id)
|
ITEM(Tile::melon_Id)
|
||||||
ITEM(Tile::pumpkin_Id)
|
ITEM(Tile::pumpkin_Id)
|
||||||
ITEM(Tile::litPumpkin_Id)
|
ITEM(Tile::litPumpkin_Id)
|
||||||
ITEM_AUX(Tile::sapling_Id, Sapling::TYPE_DEFAULT)
|
ITEM_AUX(Tile::sapling_Id, Sapling::TYPE_DEFAULT)
|
||||||
ITEM_AUX(Tile::sapling_Id, Sapling::TYPE_EVERGREEN)
|
ITEM_AUX(Tile::sapling_Id, Sapling::TYPE_EVERGREEN)
|
||||||
ITEM_AUX(Tile::sapling_Id, Sapling::TYPE_BIRCH)
|
ITEM_AUX(Tile::sapling_Id, Sapling::TYPE_BIRCH)
|
||||||
|
|
@ -321,7 +321,7 @@ void IUIScene_CreativeMenu::staticCtor()
|
||||||
ITEM(Tile::anvil_Id);
|
ITEM(Tile::anvil_Id);
|
||||||
ITEM(Item::bed_Id)
|
ITEM(Item::bed_Id)
|
||||||
ITEM(Item::bucket_empty_Id)
|
ITEM(Item::bucket_empty_Id)
|
||||||
ITEM(Item::bucket_lava_Id)
|
ITEM(Item::bucket_lava_Id)
|
||||||
ITEM(Item::bucket_water_Id)
|
ITEM(Item::bucket_water_Id)
|
||||||
ITEM(Item::bucket_milk_Id)
|
ITEM(Item::bucket_milk_Id)
|
||||||
ITEM(Item::cauldron_Id)
|
ITEM(Item::cauldron_Id)
|
||||||
|
|
@ -408,7 +408,7 @@ void IUIScene_CreativeMenu::staticCtor()
|
||||||
ITEM(Item::beef_cooked_Id)
|
ITEM(Item::beef_cooked_Id)
|
||||||
ITEM(Item::beef_raw_Id)
|
ITEM(Item::beef_raw_Id)
|
||||||
ITEM(Item::chicken_raw_Id)
|
ITEM(Item::chicken_raw_Id)
|
||||||
ITEM(Item::chicken_cooked_Id)
|
ITEM(Item::chicken_cooked_Id)
|
||||||
ITEM(Item::rotten_flesh_Id)
|
ITEM(Item::rotten_flesh_Id)
|
||||||
ITEM(Item::spiderEye_Id)
|
ITEM(Item::spiderEye_Id)
|
||||||
ITEM(Item::potato_Id)
|
ITEM(Item::potato_Id)
|
||||||
|
|
@ -430,7 +430,7 @@ void IUIScene_CreativeMenu::staticCtor()
|
||||||
ITEM(Item::pickAxe_wood_Id)
|
ITEM(Item::pickAxe_wood_Id)
|
||||||
ITEM(Item::hatchet_wood_Id)
|
ITEM(Item::hatchet_wood_Id)
|
||||||
ITEM(Item::hoe_wood_Id)
|
ITEM(Item::hoe_wood_Id)
|
||||||
|
|
||||||
ITEM(Item::emptyMap_Id)
|
ITEM(Item::emptyMap_Id)
|
||||||
ITEM(Item::helmet_chain_Id)
|
ITEM(Item::helmet_chain_Id)
|
||||||
ITEM(Item::chestplate_chain_Id)
|
ITEM(Item::chestplate_chain_Id)
|
||||||
|
|
@ -441,7 +441,7 @@ void IUIScene_CreativeMenu::staticCtor()
|
||||||
ITEM(Item::pickAxe_stone_Id)
|
ITEM(Item::pickAxe_stone_Id)
|
||||||
ITEM(Item::hatchet_stone_Id)
|
ITEM(Item::hatchet_stone_Id)
|
||||||
ITEM(Item::hoe_stone_Id)
|
ITEM(Item::hoe_stone_Id)
|
||||||
|
|
||||||
ITEM(Item::bow_Id)
|
ITEM(Item::bow_Id)
|
||||||
ITEM(Item::helmet_iron_Id)
|
ITEM(Item::helmet_iron_Id)
|
||||||
ITEM(Item::chestplate_iron_Id)
|
ITEM(Item::chestplate_iron_Id)
|
||||||
|
|
@ -452,7 +452,7 @@ void IUIScene_CreativeMenu::staticCtor()
|
||||||
ITEM(Item::pickAxe_iron_Id)
|
ITEM(Item::pickAxe_iron_Id)
|
||||||
ITEM(Item::hatchet_iron_Id)
|
ITEM(Item::hatchet_iron_Id)
|
||||||
ITEM(Item::hoe_iron_Id)
|
ITEM(Item::hoe_iron_Id)
|
||||||
|
|
||||||
ITEM(Item::arrow_Id)
|
ITEM(Item::arrow_Id)
|
||||||
ITEM(Item::helmet_gold_Id)
|
ITEM(Item::helmet_gold_Id)
|
||||||
ITEM(Item::chestplate_gold_Id)
|
ITEM(Item::chestplate_gold_Id)
|
||||||
|
|
@ -514,7 +514,7 @@ void IUIScene_CreativeMenu::staticCtor()
|
||||||
ITEM(Item::brick_Id)
|
ITEM(Item::brick_Id)
|
||||||
ITEM(Item::netherbrick_Id)
|
ITEM(Item::netherbrick_Id)
|
||||||
ITEM(Item::stick_Id)
|
ITEM(Item::stick_Id)
|
||||||
ITEM(Item::bowl_Id)
|
ITEM(Item::bowl_Id)
|
||||||
ITEM(Item::bone_Id)
|
ITEM(Item::bone_Id)
|
||||||
ITEM(Item::string_Id)
|
ITEM(Item::string_Id)
|
||||||
ITEM(Item::feather_Id)
|
ITEM(Item::feather_Id)
|
||||||
|
|
@ -523,13 +523,13 @@ void IUIScene_CreativeMenu::staticCtor()
|
||||||
ITEM(Item::gunpowder_Id)
|
ITEM(Item::gunpowder_Id)
|
||||||
ITEM(Item::clay_Id)
|
ITEM(Item::clay_Id)
|
||||||
ITEM(Item::yellowDust_Id)
|
ITEM(Item::yellowDust_Id)
|
||||||
ITEM(Item::seeds_wheat_Id)
|
ITEM(Item::seeds_wheat_Id)
|
||||||
ITEM(Item::seeds_melon_Id)
|
ITEM(Item::seeds_melon_Id)
|
||||||
ITEM(Item::seeds_pumpkin_Id)
|
ITEM(Item::seeds_pumpkin_Id)
|
||||||
ITEM(Item::wheat_Id)
|
ITEM(Item::wheat_Id)
|
||||||
ITEM(Item::reeds_Id)
|
ITEM(Item::reeds_Id)
|
||||||
ITEM(Item::egg_Id)
|
ITEM(Item::egg_Id)
|
||||||
ITEM(Item::sugar_Id)
|
ITEM(Item::sugar_Id)
|
||||||
ITEM(Item::slimeBall_Id)
|
ITEM(Item::slimeBall_Id)
|
||||||
ITEM(Item::blazeRod_Id)
|
ITEM(Item::blazeRod_Id)
|
||||||
ITEM(Item::goldNugget_Id)
|
ITEM(Item::goldNugget_Id)
|
||||||
|
|
@ -562,7 +562,7 @@ void IUIScene_CreativeMenu::staticCtor()
|
||||||
ITEM(Item::magmaCream_Id)
|
ITEM(Item::magmaCream_Id)
|
||||||
ITEM(Item::speckledMelon_Id)
|
ITEM(Item::speckledMelon_Id)
|
||||||
ITEM(Item::glassBottle_Id)
|
ITEM(Item::glassBottle_Id)
|
||||||
ITEM_AUX(Item::potion_Id,0) // Water bottle
|
ITEM_AUX(Item::potion_Id,0) // Water bottle
|
||||||
//ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(0, 0, MASK_TYPE_AWKWARD)) // Awkward Potion
|
//ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(0, 0, MASK_TYPE_AWKWARD)) // Awkward Potion
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -594,7 +594,7 @@ void IUIScene_CreativeMenu::staticCtor()
|
||||||
//ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(0, MASK_LEVEL2, MASK_INSTANTHEALTH))
|
//ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(0, MASK_LEVEL2, MASK_INSTANTHEALTH))
|
||||||
//ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(0, MASK_LEVEL2, MASK_NIGHTVISION))
|
//ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(0, MASK_LEVEL2, MASK_NIGHTVISION))
|
||||||
//ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(0, MASK_LEVEL2, MASK_INVISIBILITY))
|
//ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(0, MASK_LEVEL2, MASK_INVISIBILITY))
|
||||||
|
|
||||||
ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(0, 0, MASK_WEAKNESS))
|
ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(0, 0, MASK_WEAKNESS))
|
||||||
ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(0, MASK_LEVEL2, MASK_STRENGTH))
|
ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(0, MASK_LEVEL2, MASK_STRENGTH))
|
||||||
ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(0, 0, MASK_SLOWNESS))
|
ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(0, 0, MASK_SLOWNESS))
|
||||||
|
|
@ -669,7 +669,7 @@ void IUIScene_CreativeMenu::staticCtor()
|
||||||
// Top Row
|
// Top Row
|
||||||
ECreative_Inventory_Groups blocksGroup[] = {eCreativeInventory_BuildingBlocks};
|
ECreative_Inventory_Groups blocksGroup[] = {eCreativeInventory_BuildingBlocks};
|
||||||
specs[eCreativeInventoryTab_BuildingBlocks] = new TabSpec(L"Structures", IDS_GROUPNAME_BUILDING_BLOCKS, 1, blocksGroup);
|
specs[eCreativeInventoryTab_BuildingBlocks] = new TabSpec(L"Structures", IDS_GROUPNAME_BUILDING_BLOCKS, 1, blocksGroup);
|
||||||
|
|
||||||
#ifndef _CONTENT_PACKAGE
|
#ifndef _CONTENT_PACKAGE
|
||||||
ECreative_Inventory_Groups decorationsGroup[] = {eCreativeInventory_Decoration};
|
ECreative_Inventory_Groups decorationsGroup[] = {eCreativeInventory_Decoration};
|
||||||
ECreative_Inventory_Groups debugDecorationsGroup[] = {eCreativeInventory_ArtToolsDecorations};
|
ECreative_Inventory_Groups debugDecorationsGroup[] = {eCreativeInventory_ArtToolsDecorations};
|
||||||
|
|
@ -720,7 +720,7 @@ IUIScene_CreativeMenu::IUIScene_CreativeMenu()
|
||||||
m_creativeSlotX = m_creativeSlotY = m_inventorySlotX = m_inventorySlotY = 0;
|
m_creativeSlotX = m_creativeSlotY = m_inventorySlotX = m_inventorySlotY = 0;
|
||||||
|
|
||||||
// 4J JEV - Settup Tabs
|
// 4J JEV - Settup Tabs
|
||||||
for (int i = 0; i < eCreativeInventoryTab_COUNT; i++)
|
for (int i = 0; i < eCreativeInventoryTab_COUNT; i++)
|
||||||
{
|
{
|
||||||
m_tabDynamicPos[i] = 0;
|
m_tabDynamicPos[i] = 0;
|
||||||
m_tabPage[i] = 0;
|
m_tabPage[i] = 0;
|
||||||
|
|
@ -735,7 +735,7 @@ void IUIScene_CreativeMenu::switchTab(ECreativeInventoryTabs tab)
|
||||||
if(tab != m_curTab) updateTabHighlightAndText(tab);
|
if(tab != m_curTab) updateTabHighlightAndText(tab);
|
||||||
|
|
||||||
m_curTab = tab;
|
m_curTab = tab;
|
||||||
|
|
||||||
updateScrollCurrentPage(m_tabPage[m_curTab] + 1, specs[m_curTab]->getPageCount());
|
updateScrollCurrentPage(m_tabPage[m_curTab] + 1, specs[m_curTab]->getPageCount());
|
||||||
|
|
||||||
specs[tab]->populateMenu(itemPickerMenu,m_tabDynamicPos[m_curTab], m_tabPage[m_curTab]);
|
specs[tab]->populateMenu(itemPickerMenu,m_tabDynamicPos[m_curTab], m_tabPage[m_curTab]);
|
||||||
|
|
@ -769,7 +769,7 @@ void IUIScene_CreativeMenu::ScrollBar(UIVec2D pointerPos)
|
||||||
IUIScene_CreativeMenu::TabSpec::TabSpec(LPCWSTR icon, int descriptionId, int staticGroupsCount, ECreative_Inventory_Groups *staticGroups, int dynamicGroupsCount, ECreative_Inventory_Groups *dynamicGroups, int debugGroupsCount /*= 0*/, ECreative_Inventory_Groups *debugGroups /*= NULL*/)
|
IUIScene_CreativeMenu::TabSpec::TabSpec(LPCWSTR icon, int descriptionId, int staticGroupsCount, ECreative_Inventory_Groups *staticGroups, int dynamicGroupsCount, ECreative_Inventory_Groups *dynamicGroups, int debugGroupsCount /*= 0*/, ECreative_Inventory_Groups *debugGroups /*= NULL*/)
|
||||||
: m_icon(icon), m_descriptionId(descriptionId), m_staticGroupsCount(staticGroupsCount), m_dynamicGroupsCount(dynamicGroupsCount), m_debugGroupsCount(debugGroupsCount)
|
: m_icon(icon), m_descriptionId(descriptionId), m_staticGroupsCount(staticGroupsCount), m_dynamicGroupsCount(dynamicGroupsCount), m_debugGroupsCount(debugGroupsCount)
|
||||||
{
|
{
|
||||||
|
|
||||||
m_pages = 0;
|
m_pages = 0;
|
||||||
m_staticGroupsA = NULL;
|
m_staticGroupsA = NULL;
|
||||||
|
|
||||||
|
|
@ -828,8 +828,8 @@ void IUIScene_CreativeMenu::TabSpec::populateMenu(AbstractContainerMenu *menu, i
|
||||||
// Fill the dynamic group
|
// Fill the dynamic group
|
||||||
if(m_dynamicGroupsCount > 0 && m_dynamicGroupsA != NULL)
|
if(m_dynamicGroupsCount > 0 && m_dynamicGroupsA != NULL)
|
||||||
{
|
{
|
||||||
for(AUTO_VAR(it, categoryGroups[m_dynamicGroupsA[dynamicIndex]].rbegin()); it != categoryGroups[m_dynamicGroupsA[dynamicIndex]].rend() && lastSlotIndex < MAX_SIZE; ++it)
|
for (auto it = categoryGroups[m_dynamicGroupsA[dynamicIndex]].rbegin(); it != categoryGroups[m_dynamicGroupsA[dynamicIndex]].rend() && lastSlotIndex < MAX_SIZE; ++it)
|
||||||
{
|
{
|
||||||
Slot *slot = menu->getSlot(++lastSlotIndex);
|
Slot *slot = menu->getSlot(++lastSlotIndex);
|
||||||
slot->set( *it );
|
slot->set( *it );
|
||||||
}
|
}
|
||||||
|
|
@ -953,7 +953,7 @@ unsigned int IUIScene_CreativeMenu::TabSpec::getPageCount()
|
||||||
IUIScene_CreativeMenu::ItemPickerMenu::ItemPickerMenu( shared_ptr<SimpleContainer> smp, shared_ptr<Inventory> inv ) : AbstractContainerMenu()
|
IUIScene_CreativeMenu::ItemPickerMenu::ItemPickerMenu( shared_ptr<SimpleContainer> smp, shared_ptr<Inventory> inv ) : AbstractContainerMenu()
|
||||||
{
|
{
|
||||||
inventory = inv;
|
inventory = inv;
|
||||||
creativeContainer = smp;
|
creativeContainer = smp;
|
||||||
|
|
||||||
//int startLength = slots->size();
|
//int startLength = slots->size();
|
||||||
|
|
||||||
|
|
@ -994,7 +994,7 @@ IUIScene_AbstractContainerMenu::ESceneSection IUIScene_CreativeMenu::GetSectionA
|
||||||
switch( eSection )
|
switch( eSection )
|
||||||
{
|
{
|
||||||
case eSectionInventoryCreativeSelector:
|
case eSectionInventoryCreativeSelector:
|
||||||
if (eTapDirection == eTapStateDown || eTapDirection == eTapStateUp)
|
if (eTapDirection == eTapStateDown || eTapDirection == eTapStateUp)
|
||||||
{
|
{
|
||||||
newSection = eSectionInventoryCreativeUsing;
|
newSection = eSectionInventoryCreativeUsing;
|
||||||
}
|
}
|
||||||
|
|
@ -1081,7 +1081,7 @@ void IUIScene_CreativeMenu::handleAdditionalKeyPress(int iAction)
|
||||||
dir = -1;
|
dir = -1;
|
||||||
// Fall through intentional
|
// Fall through intentional
|
||||||
case ACTION_MENU_RIGHT_SCROLL:
|
case ACTION_MENU_RIGHT_SCROLL:
|
||||||
{
|
{
|
||||||
ECreativeInventoryTabs tab = (ECreativeInventoryTabs)(m_curTab + dir);
|
ECreativeInventoryTabs tab = (ECreativeInventoryTabs)(m_curTab + dir);
|
||||||
if (tab < 0) tab = (ECreativeInventoryTabs)(eCreativeInventoryTab_COUNT - 1);
|
if (tab < 0) tab = (ECreativeInventoryTabs)(eCreativeInventoryTab_COUNT - 1);
|
||||||
if (tab >= eCreativeInventoryTab_COUNT) tab = eCreativeInventoryTab_BuildingBlocks;
|
if (tab >= eCreativeInventoryTab_COUNT) tab = eCreativeInventoryTab_BuildingBlocks;
|
||||||
|
|
@ -1375,7 +1375,7 @@ void IUIScene_CreativeMenu::BuildFirework(vector<shared_ptr<ItemInstance> > *lis
|
||||||
itemTag->put(FireworksItem::TAG_FIREWORKS, fireTag);
|
itemTag->put(FireworksItem::TAG_FIREWORKS, fireTag);
|
||||||
|
|
||||||
firework->setTag(itemTag);
|
firework->setTag(itemTag);
|
||||||
}
|
}
|
||||||
|
|
||||||
list->push_back(firework);
|
list->push_back(firework);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -47,11 +47,11 @@ bool IUIScene_TradingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat)
|
||||||
|
|
||||||
switch(iAction)
|
switch(iAction)
|
||||||
{
|
{
|
||||||
case ACTION_MENU_B:
|
case ACTION_MENU_B:
|
||||||
ui.ShowTooltip( iPad, eToolTipButtonX, false );
|
ui.ShowTooltip( iPad, eToolTipButtonX, false );
|
||||||
ui.ShowTooltip( iPad, eToolTipButtonB, false );
|
ui.ShowTooltip( iPad, eToolTipButtonB, false );
|
||||||
ui.ShowTooltip( iPad, eToolTipButtonA, false );
|
ui.ShowTooltip( iPad, eToolTipButtonA, false );
|
||||||
ui.ShowTooltip( iPad, eToolTipButtonRB, false );
|
ui.ShowTooltip( iPad, eToolTipButtonRB, false );
|
||||||
// kill the crafting xui
|
// kill the crafting xui
|
||||||
//ui.PlayUISFX(eSFX_Back);
|
//ui.PlayUISFX(eSFX_Back);
|
||||||
ui.CloseUIScenes(iPad);
|
ui.CloseUIScenes(iPad);
|
||||||
|
|
@ -78,7 +78,7 @@ bool IUIScene_TradingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat)
|
||||||
int buyBMatches = player->inventory->countMatches(buyBItem);
|
int buyBMatches = player->inventory->countMatches(buyBItem);
|
||||||
if( (buyAItem != NULL && buyAMatches >= buyAItem->count) && (buyBItem == NULL || buyBMatches >= buyBItem->count) )
|
if( (buyAItem != NULL && buyAMatches >= buyAItem->count) && (buyBItem == NULL || buyBMatches >= buyBItem->count) )
|
||||||
{
|
{
|
||||||
// 4J-JEV: Fix for PS4 #7111: [PATCH 1.12] Trading Librarian villagers for multiple ‘Enchanted Books’ will cause the title to crash.
|
// 4J-JEV: Fix for PS4 #7111: [PATCH 1.12] Trading Librarian villagers for multiple <EFBFBD>Enchanted Books<6B> will cause the title to crash.
|
||||||
int actualShopItem = m_activeOffers.at(selectedShopItem).second;
|
int actualShopItem = m_activeOffers.at(selectedShopItem).second;
|
||||||
|
|
||||||
m_merchant->notifyTrade(activeRecipe);
|
m_merchant->notifyTrade(activeRecipe);
|
||||||
|
|
@ -186,13 +186,12 @@ void IUIScene_TradingMenu::updateDisplay()
|
||||||
m_activeOffers.clear();
|
m_activeOffers.clear();
|
||||||
int unfilteredIndex = 0;
|
int unfilteredIndex = 0;
|
||||||
int firstValidTrade = INT_MAX;
|
int firstValidTrade = INT_MAX;
|
||||||
for(AUTO_VAR(it, unfilteredOffers->begin()); it != unfilteredOffers->end(); ++it)
|
for(auto& recipe : *unfilteredOffers)
|
||||||
{
|
{
|
||||||
MerchantRecipe *recipe = *it;
|
|
||||||
if(!recipe->isDeprecated())
|
if(!recipe->isDeprecated())
|
||||||
{
|
{
|
||||||
m_activeOffers.push_back( pair<MerchantRecipe *,int>(recipe,unfilteredIndex));
|
m_activeOffers.emplace_back(recipe,unfilteredIndex);
|
||||||
firstValidTrade = min(firstValidTrade,unfilteredIndex);
|
firstValidTrade = std::min<int>(firstValidTrade, unfilteredIndex);
|
||||||
}
|
}
|
||||||
++unfilteredIndex;
|
++unfilteredIndex;
|
||||||
}
|
}
|
||||||
|
|
@ -249,7 +248,7 @@ void IUIScene_TradingMenu::updateDisplay()
|
||||||
|
|
||||||
vector<HtmlString> *offerDescription = GetItemDescription(activeRecipe->getSellItem());
|
vector<HtmlString> *offerDescription = GetItemDescription(activeRecipe->getSellItem());
|
||||||
setOfferDescription(offerDescription);
|
setOfferDescription(offerDescription);
|
||||||
|
|
||||||
shared_ptr<ItemInstance> buyAItem = activeRecipe->getBuyAItem();
|
shared_ptr<ItemInstance> buyAItem = activeRecipe->getBuyAItem();
|
||||||
shared_ptr<ItemInstance> buyBItem = activeRecipe->getBuyBItem();
|
shared_ptr<ItemInstance> buyBItem = activeRecipe->getBuyBItem();
|
||||||
|
|
||||||
|
|
@ -307,7 +306,7 @@ void IUIScene_TradingMenu::updateDisplay()
|
||||||
setRequest1RedBox(false);
|
setRequest1RedBox(false);
|
||||||
setRequest2RedBox(false);
|
setRequest2RedBox(false);
|
||||||
setRequest1Item(nullptr);
|
setRequest1Item(nullptr);
|
||||||
setRequest2Item(nullptr);
|
setRequest2Item(nullptr);
|
||||||
vector<HtmlString> offerDescription;
|
vector<HtmlString> offerDescription;
|
||||||
setOfferDescription(&offerDescription);
|
setOfferDescription(&offerDescription);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ bool UIControl_EnchantmentButton::setupControl(UIScene *scene, IggyValuePath *pa
|
||||||
UIControl::setControlType(UIControl::eEnchantmentButton);
|
UIControl::setControlType(UIControl::eEnchantmentButton);
|
||||||
bool success = UIControl_Button::setupControl(scene,parent,controlName);
|
bool success = UIControl_Button::setupControl(scene,parent,controlName);
|
||||||
|
|
||||||
//Button specific initialisers
|
//Button specific initialisers
|
||||||
m_funcChangeState = registerFastName(L"ChangeState");
|
m_funcChangeState = registerFastName(L"ChangeState");
|
||||||
|
|
||||||
return success;
|
return success;
|
||||||
|
|
@ -40,7 +40,7 @@ void UIControl_EnchantmentButton::ReInit()
|
||||||
{
|
{
|
||||||
UIControl_Button::ReInit();
|
UIControl_Button::ReInit();
|
||||||
|
|
||||||
|
|
||||||
m_lastState = eState_Inactive;
|
m_lastState = eState_Inactive;
|
||||||
m_lastCost = 0;
|
m_lastCost = 0;
|
||||||
m_bHasFocus = false;
|
m_bHasFocus = false;
|
||||||
|
|
@ -54,10 +54,10 @@ void UIControl_EnchantmentButton::tick()
|
||||||
}
|
}
|
||||||
|
|
||||||
void UIControl_EnchantmentButton::render(IggyCustomDrawCallbackRegion *region)
|
void UIControl_EnchantmentButton::render(IggyCustomDrawCallbackRegion *region)
|
||||||
{
|
{
|
||||||
UIScene_EnchantingMenu *enchantingScene = (UIScene_EnchantingMenu *)m_parentScene;
|
UIScene_EnchantingMenu *enchantingScene = (UIScene_EnchantingMenu *)m_parentScene;
|
||||||
EnchantmentMenu *menu = enchantingScene->getMenu();
|
EnchantmentMenu *menu = enchantingScene->getMenu();
|
||||||
|
|
||||||
float width = region->x1 - region->x0;
|
float width = region->x1 - region->x0;
|
||||||
float height = region->y1 - region->y0;
|
float height = region->y1 - region->y0;
|
||||||
float xo = width/2;
|
float xo = width/2;
|
||||||
|
|
@ -101,7 +101,7 @@ void UIControl_EnchantmentButton::render(IggyCustomDrawCallbackRegion *region)
|
||||||
glEnable(GL_ALPHA_TEST);
|
glEnable(GL_ALPHA_TEST);
|
||||||
glAlphaFunc(GL_GREATER, 0.1f);
|
glAlphaFunc(GL_GREATER, 0.1f);
|
||||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||||
wstring line = _toString<int>(cost);
|
wstring line = std::to_wstring(cost);
|
||||||
Font *font = pMinecraft->altFont;
|
Font *font = pMinecraft->altFont;
|
||||||
//int col = 0x685E4A;
|
//int col = 0x685E4A;
|
||||||
unsigned int col = m_textColour;
|
unsigned int col = m_textColour;
|
||||||
|
|
@ -143,7 +143,7 @@ void UIControl_EnchantmentButton::updateState()
|
||||||
EState state = eState_Inactive;
|
EState state = eState_Inactive;
|
||||||
|
|
||||||
int cost = menu->costs[m_index];
|
int cost = menu->costs[m_index];
|
||||||
|
|
||||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||||
if(cost > pMinecraft->localplayers[enchantingScene->getPad()]->experienceLevel && !pMinecraft->localplayers[enchantingScene->getPad()]->abilities.instabuild)
|
if(cost > pMinecraft->localplayers[enchantingScene->getPad()]->experienceLevel && !pMinecraft->localplayers[enchantingScene->getPad()]->abilities.instabuild)
|
||||||
{
|
{
|
||||||
|
|
@ -165,7 +165,7 @@ void UIControl_EnchantmentButton::updateState()
|
||||||
|
|
||||||
if(cost != m_lastCost)
|
if(cost != m_lastCost)
|
||||||
{
|
{
|
||||||
setLabel( _toString<int>(cost) );
|
setLabel( std::to_wstring(cost) );
|
||||||
m_lastCost = cost;
|
m_lastCost = cost;
|
||||||
m_enchantmentString = EnchantmentNames::instance.getRandomName();
|
m_enchantmentString = EnchantmentNames::instance.getRandomName();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -175,14 +175,14 @@ void UIControl_PlayerSkinPreview::CycleNextAnimation()
|
||||||
|
|
||||||
void UIControl_PlayerSkinPreview::CyclePreviousAnimation()
|
void UIControl_PlayerSkinPreview::CyclePreviousAnimation()
|
||||||
{
|
{
|
||||||
m_currentAnimation = (ESkinPreviewAnimations)(m_currentAnimation - 1);
|
m_currentAnimation = (ESkinPreviewAnimations)(m_currentAnimation - 1);
|
||||||
if(m_currentAnimation < e_SkinPreviewAnimation_Walking) m_currentAnimation = (ESkinPreviewAnimations)(e_SkinPreviewAnimation_Count - 1);
|
if(m_currentAnimation < e_SkinPreviewAnimation_Walking) m_currentAnimation = (ESkinPreviewAnimations)(e_SkinPreviewAnimation_Count - 1);
|
||||||
|
|
||||||
m_swingTime = 0.0f;
|
m_swingTime = 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UIControl_PlayerSkinPreview::render(IggyCustomDrawCallbackRegion *region)
|
void UIControl_PlayerSkinPreview::render(IggyCustomDrawCallbackRegion *region)
|
||||||
{
|
{
|
||||||
Minecraft *pMinecraft=Minecraft::GetInstance();
|
Minecraft *pMinecraft=Minecraft::GetInstance();
|
||||||
|
|
||||||
glEnable(GL_RESCALE_NORMAL);
|
glEnable(GL_RESCALE_NORMAL);
|
||||||
|
|
@ -193,7 +193,7 @@ void UIControl_PlayerSkinPreview::render(IggyCustomDrawCallbackRegion *region)
|
||||||
float height = region->y1 - region->y0;
|
float height = region->y1 - region->y0;
|
||||||
float xo = width/2;
|
float xo = width/2;
|
||||||
float yo = height;
|
float yo = height;
|
||||||
|
|
||||||
glTranslatef(xo, yo - 3.5f, 50.0f);
|
glTranslatef(xo, yo - 3.5f, 50.0f);
|
||||||
//glTranslatef(120.0f, 294, 0.0f);
|
//glTranslatef(120.0f, 294, 0.0f);
|
||||||
|
|
||||||
|
|
@ -224,11 +224,9 @@ void UIControl_PlayerSkinPreview::render(IggyCustomDrawCallbackRegion *region)
|
||||||
//vector<ModelPart *> *pAdditionalModelParts=mob->GetAdditionalModelParts();
|
//vector<ModelPart *> *pAdditionalModelParts=mob->GetAdditionalModelParts();
|
||||||
|
|
||||||
if(m_pvAdditionalModelParts && m_pvAdditionalModelParts->size()!=0)
|
if(m_pvAdditionalModelParts && m_pvAdditionalModelParts->size()!=0)
|
||||||
{
|
{
|
||||||
for(AUTO_VAR(it, m_pvAdditionalModelParts->begin()); it != m_pvAdditionalModelParts->end(); ++it)
|
for(auto& pModelPart : *m_pvAdditionalModelParts)
|
||||||
{
|
{
|
||||||
ModelPart *pModelPart=*it;
|
|
||||||
|
|
||||||
pModelPart->visible=true;
|
pModelPart->visible=true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -238,11 +236,9 @@ void UIControl_PlayerSkinPreview::render(IggyCustomDrawCallbackRegion *region)
|
||||||
|
|
||||||
// hide the additional parts
|
// hide the additional parts
|
||||||
if(m_pvAdditionalModelParts && m_pvAdditionalModelParts->size()!=0)
|
if(m_pvAdditionalModelParts && m_pvAdditionalModelParts->size()!=0)
|
||||||
{
|
{
|
||||||
for(AUTO_VAR(it, m_pvAdditionalModelParts->begin()); it != m_pvAdditionalModelParts->end(); ++it)
|
for(auto& pModelPart : *m_pvAdditionalModelParts)
|
||||||
{
|
{
|
||||||
ModelPart *pModelPart=*it;
|
|
||||||
|
|
||||||
pModelPart->visible=false;
|
pModelPart->visible=false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -182,7 +182,7 @@ UIController::UIController()
|
||||||
{
|
{
|
||||||
m_uiDebugConsole = NULL;
|
m_uiDebugConsole = NULL;
|
||||||
m_reloadSkinThread = NULL;
|
m_reloadSkinThread = NULL;
|
||||||
|
|
||||||
m_navigateToHomeOnReload = false;
|
m_navigateToHomeOnReload = false;
|
||||||
|
|
||||||
m_bCleanupOnReload = false;
|
m_bCleanupOnReload = false;
|
||||||
|
|
@ -302,7 +302,7 @@ void UIController::postInit()
|
||||||
IggySetTextureSubstitutionCallbacks ( &UIController::TextureSubstitutionCreateCallback , &UIController::TextureSubstitutionDestroyCallback, this );
|
IggySetTextureSubstitutionCallbacks ( &UIController::TextureSubstitutionCreateCallback , &UIController::TextureSubstitutionDestroyCallback, this );
|
||||||
|
|
||||||
SetupFont();
|
SetupFont();
|
||||||
//
|
//
|
||||||
loadSkins();
|
loadSkins();
|
||||||
|
|
||||||
for(unsigned int i = 0; i < eUIGroup_COUNT; ++i)
|
for(unsigned int i = 0; i < eUIGroup_COUNT; ++i)
|
||||||
|
|
@ -383,7 +383,7 @@ void UIController::SetupFont()
|
||||||
app.m_dlcManager.LanguageChanged();
|
app.m_dlcManager.LanguageChanged();
|
||||||
|
|
||||||
app.loadStringTable(); // Switch to use new string table,
|
app.loadStringTable(); // Switch to use new string table,
|
||||||
|
|
||||||
if (m_eTargetFont == m_eCurrentFont)
|
if (m_eTargetFont == m_eCurrentFont)
|
||||||
{
|
{
|
||||||
// 4J-JEV: If we're ingame, reload the font to update all the text.
|
// 4J-JEV: If we're ingame, reload the font to update all the text.
|
||||||
|
|
@ -458,12 +458,12 @@ bool UIController::UsingBitmapFont()
|
||||||
void UIController::tick()
|
void UIController::tick()
|
||||||
{
|
{
|
||||||
SetupFont(); // If necessary, change font.
|
SetupFont(); // If necessary, change font.
|
||||||
|
|
||||||
if ( (m_navigateToHomeOnReload || m_bCleanupOnReload) && !ui.IsReloadingSkin() )
|
if ( (m_navigateToHomeOnReload || m_bCleanupOnReload) && !ui.IsReloadingSkin() )
|
||||||
{
|
{
|
||||||
ui.CleanUpSkinReload();
|
ui.CleanUpSkinReload();
|
||||||
|
|
||||||
if (m_navigateToHomeOnReload || !g_NetworkManager.IsInSession())
|
if (m_navigateToHomeOnReload || !g_NetworkManager.IsInSession())
|
||||||
{
|
{
|
||||||
ui.NavigateToScene(ProfileManager.GetPrimaryPad(),eUIScene_MainMenu);
|
ui.NavigateToScene(ProfileManager.GetPrimaryPad(),eUIScene_MainMenu);
|
||||||
}
|
}
|
||||||
|
|
@ -500,8 +500,8 @@ void UIController::tick()
|
||||||
|
|
||||||
// Clear out the cached movie file data
|
// Clear out the cached movie file data
|
||||||
__int64 currentTime = System::currentTimeMillis();
|
__int64 currentTime = System::currentTimeMillis();
|
||||||
for(AUTO_VAR(it, m_cachedMovieData.begin()); it != m_cachedMovieData.end();)
|
for (auto it = m_cachedMovieData.begin(); it != m_cachedMovieData.end();)
|
||||||
{
|
{
|
||||||
if(it->second.m_expiry < currentTime)
|
if(it->second.m_expiry < currentTime)
|
||||||
{
|
{
|
||||||
delete [] it->second.m_ba.data;
|
delete [] it->second.m_ba.data;
|
||||||
|
|
@ -730,7 +730,7 @@ void UIController::CleanUpSkinReload()
|
||||||
{
|
{
|
||||||
if(!Minecraft::GetInstance()->skins->getSelected()->hasAudio())
|
if(!Minecraft::GetInstance()->skins->getSelected()->hasAudio())
|
||||||
{
|
{
|
||||||
#ifdef _DURANGO
|
#ifdef _DURANGO
|
||||||
DWORD result = StorageManager.UnmountInstalledDLC(L"TPACK");
|
DWORD result = StorageManager.UnmountInstalledDLC(L"TPACK");
|
||||||
#else
|
#else
|
||||||
DWORD result = StorageManager.UnmountInstalledDLC("TPACK");
|
DWORD result = StorageManager.UnmountInstalledDLC("TPACK");
|
||||||
|
|
@ -738,9 +738,8 @@ void UIController::CleanUpSkinReload()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for(AUTO_VAR(it,m_queuedMessageBoxData.begin()); it != m_queuedMessageBoxData.end(); ++it)
|
for(auto queuedData : m_queuedMessageBoxData)
|
||||||
{
|
{
|
||||||
QueuedMessageBoxData *queuedData = *it;
|
|
||||||
ui.NavigateToScene(queuedData->iPad, eUIScene_MessageBox, &queuedData->info, queuedData->layer, eUIGroup_Fullscreen);
|
ui.NavigateToScene(queuedData->iPad, eUIScene_MessageBox, &queuedData->info, queuedData->layer, eUIGroup_Fullscreen);
|
||||||
delete queuedData->info.uiOptionA;
|
delete queuedData->info.uiOptionA;
|
||||||
delete queuedData;
|
delete queuedData;
|
||||||
|
|
@ -752,8 +751,8 @@ byteArray UIController::getMovieData(const wstring &filename)
|
||||||
{
|
{
|
||||||
// Cache everything we load in the current tick
|
// Cache everything we load in the current tick
|
||||||
__int64 targetTime = System::currentTimeMillis() + (1000LL * 60);
|
__int64 targetTime = System::currentTimeMillis() + (1000LL * 60);
|
||||||
AUTO_VAR(it,m_cachedMovieData.find(filename));
|
auto it = m_cachedMovieData.find(filename);
|
||||||
if(it == m_cachedMovieData.end() )
|
if(it == m_cachedMovieData.end() )
|
||||||
{
|
{
|
||||||
byteArray baFile = app.getArchiveFile(filename);
|
byteArray baFile = app.getArchiveFile(filename);
|
||||||
CachedMovieData cmd;
|
CachedMovieData cmd;
|
||||||
|
|
@ -959,7 +958,7 @@ void UIController::handleInput()
|
||||||
{
|
{
|
||||||
#ifdef _DURANGO
|
#ifdef _DURANGO
|
||||||
// 4J-JEV: Added exception for primary play who migh've uttered speech commands.
|
// 4J-JEV: Added exception for primary play who migh've uttered speech commands.
|
||||||
if(iPad != ProfileManager.GetPrimaryPad()
|
if(iPad != ProfileManager.GetPrimaryPad()
|
||||||
&& (!InputManager.IsPadConnected(iPad) || !InputManager.IsPadLocked(iPad)) ) continue;
|
&& (!InputManager.IsPadConnected(iPad) || !InputManager.IsPadLocked(iPad)) ) continue;
|
||||||
#endif
|
#endif
|
||||||
for(unsigned int key = 0; key <= ACTION_MAX_MENU; ++key)
|
for(unsigned int key = 0; key <= ACTION_MAX_MENU; ++key)
|
||||||
|
|
@ -1035,7 +1034,7 @@ void UIController::handleKeyPress(unsigned int iPad, unsigned int key)
|
||||||
{
|
{
|
||||||
// no active touch? clear active and highlighted touch UI elements
|
// no active touch? clear active and highlighted touch UI elements
|
||||||
m_ActiveUIElement = NULL;
|
m_ActiveUIElement = NULL;
|
||||||
m_HighlightedUIElement = NULL;
|
m_HighlightedUIElement = NULL;
|
||||||
|
|
||||||
// fullscreen first
|
// fullscreen first
|
||||||
UIScene *pScene=m_groups[(int)eUIGroup_Fullscreen]->getCurrentScene();
|
UIScene *pScene=m_groups[(int)eUIGroup_Fullscreen]->getCurrentScene();
|
||||||
|
|
@ -1085,7 +1084,7 @@ void UIController::handleKeyPress(unsigned int iPad, unsigned int key)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(m_bTouchscreenPressed && pTouchData->reportNum==1)
|
else if(m_bTouchscreenPressed && pTouchData->reportNum==1)
|
||||||
{
|
{
|
||||||
// fullscreen first
|
// fullscreen first
|
||||||
|
|
@ -1337,8 +1336,8 @@ void UIController::handleKeyPress(unsigned int iPad, unsigned int key)
|
||||||
app.DebugPrintf(app.USER_SR, "Total static: %d , Total dynamic: %d\n", totalStatic, totalDynamic);
|
app.DebugPrintf(app.USER_SR, "Total static: %d , Total dynamic: %d\n", totalStatic, totalDynamic);
|
||||||
app.DebugPrintf(app.USER_SR, "\n\nEND TOTAL SWF MEMORY USAGE\n");
|
app.DebugPrintf(app.USER_SR, "\n\nEND TOTAL SWF MEMORY USAGE\n");
|
||||||
app.DebugPrintf(app.USER_SR, "********************************\n\n");
|
app.DebugPrintf(app.USER_SR, "********************************\n\n");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -1535,7 +1534,7 @@ void UIController::setupCustomDrawGameState()
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
glOrtho(0, m_fScreenWidth, m_fScreenHeight, 0, 1000, 3000);
|
glOrtho(0, m_fScreenWidth, m_fScreenHeight, 0, 1000, 3000);
|
||||||
glMatrixMode(GL_MODELVIEW);
|
glMatrixMode(GL_MODELVIEW);
|
||||||
glEnable(GL_ALPHA_TEST);
|
glEnable(GL_ALPHA_TEST);
|
||||||
glAlphaFunc(GL_GREATER, 0.1f);
|
glAlphaFunc(GL_GREATER, 0.1f);
|
||||||
glEnable(GL_DEPTH_TEST);
|
glEnable(GL_DEPTH_TEST);
|
||||||
glDepthFunc(GL_LEQUAL);
|
glDepthFunc(GL_LEQUAL);
|
||||||
|
|
@ -1635,22 +1634,22 @@ void RADLINK UIController::CustomDrawCallback(void *user_callback_data, Iggy *pl
|
||||||
//Description
|
//Description
|
||||||
//Callback to create a user-defined texture to replace SWF-defined textures.
|
//Callback to create a user-defined texture to replace SWF-defined textures.
|
||||||
//Parameters
|
//Parameters
|
||||||
//width - Input value: optional number of pixels wide specified from AS3, or -1 if not defined. Output value: the number of pixels wide to pretend to Iggy that the bitmap is. SWF and AS3 scales bitmaps based on their pixel dimensions, so you can use this to substitute a texture that is higher or lower resolution that ActionScript thinks it is.
|
//width - Input value: optional number of pixels wide specified from AS3, or -1 if not defined. Output value: the number of pixels wide to pretend to Iggy that the bitmap is. SWF and AS3 scales bitmaps based on their pixel dimensions, so you can use this to substitute a texture that is higher or lower resolution that ActionScript thinks it is.
|
||||||
//height - Input value: optional number of pixels high specified from AS3, or -1 if not defined. Output value: the number of pixels high to pretend to Iggy that the bitmap is. SWF and AS3 scales bitmaps based on their pixel dimensions, so you can use this to substitute a texture that is higher or lower resolution that ActionScript thinks it is.
|
//height - Input value: optional number of pixels high specified from AS3, or -1 if not defined. Output value: the number of pixels high to pretend to Iggy that the bitmap is. SWF and AS3 scales bitmaps based on their pixel dimensions, so you can use this to substitute a texture that is higher or lower resolution that ActionScript thinks it is.
|
||||||
//destroy_callback_data - Optional additional output value you can set; the value will be passed along to the corresponding Iggy_TextureSubstitutionDestroyCallback (e.g. you can store the pointer to your own internal structure here).
|
//destroy_callback_data - Optional additional output value you can set; the value will be passed along to the corresponding Iggy_TextureSubstitutionDestroyCallback (e.g. you can store the pointer to your own internal structure here).
|
||||||
//return - A platform-independent wrapped texture handle provided by GDraw, or NULL (NULL with throw an ActionScript 3 ArgumentError that the Flash developer can catch) Use by calling IggySetTextureSubstitutionCallbacks.
|
//return - A platform-independent wrapped texture handle provided by GDraw, or NULL (NULL with throw an ActionScript 3 ArgumentError that the Flash developer can catch) Use by calling IggySetTextureSubstitutionCallbacks.
|
||||||
//
|
//
|
||||||
//Discussion
|
//Discussion
|
||||||
//
|
//
|
||||||
//If your texture includes an alpha channel, you must use a premultiplied alpha (where the R,G, and B channels have been multiplied by the alpha value); all Iggy shaders assume premultiplied alpha (and it looks better anyway).
|
//If your texture includes an alpha channel, you must use a premultiplied alpha (where the R,G, and B channels have been multiplied by the alpha value); all Iggy shaders assume premultiplied alpha (and it looks better anyway).
|
||||||
GDrawTexture * RADLINK UIController::TextureSubstitutionCreateCallback ( void * user_callback_data , IggyUTF16 * texture_name , S32 * width , S32 * height , void * * destroy_callback_data )
|
GDrawTexture * RADLINK UIController::TextureSubstitutionCreateCallback ( void * user_callback_data , IggyUTF16 * texture_name , S32 * width , S32 * height , void * * destroy_callback_data )
|
||||||
{
|
{
|
||||||
UIController *uiController = (UIController *)user_callback_data;
|
UIController *uiController = static_cast<UIController *>(user_callback_data);
|
||||||
AUTO_VAR(it,uiController->m_substitutionTextures.find((wchar_t *)texture_name));
|
auto it = uiController->m_substitutionTextures.find(texture_name);
|
||||||
|
|
||||||
if(it != uiController->m_substitutionTextures.end())
|
if(it != uiController->m_substitutionTextures.end())
|
||||||
{
|
{
|
||||||
app.DebugPrintf("Found substitution texture %ls, with %d bytes\n", (wchar_t *)texture_name,it->second.length);
|
app.DebugPrintf("Found substitution texture %ls, with %d bytes\n", texture_name,it->second.length);
|
||||||
|
|
||||||
BufferedImage image(it->second.data, it->second.length);
|
BufferedImage image(it->second.data, it->second.length);
|
||||||
if( image.getData() != NULL )
|
if( image.getData() != NULL )
|
||||||
|
|
@ -1711,9 +1710,9 @@ void UIController::registerSubstitutionTexture(const wstring &textureName, PBYTE
|
||||||
|
|
||||||
void UIController::unregisterSubstitutionTexture(const wstring &textureName, bool deleteData)
|
void UIController::unregisterSubstitutionTexture(const wstring &textureName, bool deleteData)
|
||||||
{
|
{
|
||||||
AUTO_VAR(it,m_substitutionTextures.find(textureName));
|
auto it = m_substitutionTextures.find(textureName);
|
||||||
|
|
||||||
if(it != m_substitutionTextures.end())
|
if(it != m_substitutionTextures.end())
|
||||||
{
|
{
|
||||||
if(deleteData) delete [] it->second.data;
|
if(deleteData) delete [] it->second.data;
|
||||||
m_substitutionTextures.erase(it);
|
m_substitutionTextures.erase(it);
|
||||||
|
|
@ -1854,7 +1853,7 @@ bool UIController::NavigateBack(int iPad, bool forceUsePad, EUIScene eScene, EUI
|
||||||
void UIController::NavigateToHomeMenu()
|
void UIController::NavigateToHomeMenu()
|
||||||
{
|
{
|
||||||
ui.CloseAllPlayersScenes();
|
ui.CloseAllPlayersScenes();
|
||||||
|
|
||||||
// Alert the app the we no longer want to be informed of ethernet connections
|
// Alert the app the we no longer want to be informed of ethernet connections
|
||||||
app.SetLiveLinkRequired( false );
|
app.SetLiveLinkRequired( false );
|
||||||
|
|
||||||
|
|
@ -1953,8 +1952,8 @@ size_t UIController::RegisterForCallbackId(UIScene *scene)
|
||||||
void UIController::UnregisterCallbackId(size_t id)
|
void UIController::UnregisterCallbackId(size_t id)
|
||||||
{
|
{
|
||||||
EnterCriticalSection(&m_registeredCallbackScenesCS);
|
EnterCriticalSection(&m_registeredCallbackScenesCS);
|
||||||
AUTO_VAR(it, m_registeredCallbackScenes.find(id) );
|
auto it = m_registeredCallbackScenes.find(id);
|
||||||
if(it != m_registeredCallbackScenes.end() )
|
if(it != m_registeredCallbackScenes.end() )
|
||||||
{
|
{
|
||||||
m_registeredCallbackScenes.erase(it);
|
m_registeredCallbackScenes.erase(it);
|
||||||
}
|
}
|
||||||
|
|
@ -1964,8 +1963,8 @@ void UIController::UnregisterCallbackId(size_t id)
|
||||||
UIScene *UIController::GetSceneFromCallbackId(size_t id)
|
UIScene *UIController::GetSceneFromCallbackId(size_t id)
|
||||||
{
|
{
|
||||||
UIScene *scene = NULL;
|
UIScene *scene = NULL;
|
||||||
AUTO_VAR(it, m_registeredCallbackScenes.find(id) );
|
auto it = m_registeredCallbackScenes.find(id);
|
||||||
if(it != m_registeredCallbackScenes.end() )
|
if(it != m_registeredCallbackScenes.end() )
|
||||||
{
|
{
|
||||||
scene = it->second;
|
scene = it->second;
|
||||||
}
|
}
|
||||||
|
|
@ -2017,7 +2016,7 @@ void UIController::CloseUIScenes(int iPad, bool forceIPad)
|
||||||
|
|
||||||
m_groups[(int)group]->closeAllScenes();
|
m_groups[(int)group]->closeAllScenes();
|
||||||
m_groups[(int)group]->getTooltips()->SetTooltips(-1);
|
m_groups[(int)group]->getTooltips()->SetTooltips(-1);
|
||||||
|
|
||||||
// This should cause the popup to dissappear
|
// This should cause the popup to dissappear
|
||||||
TutorialPopupInfo popupInfo;
|
TutorialPopupInfo popupInfo;
|
||||||
if(m_groups[(int)group]->getTutorialPopup()) m_groups[(int)group]->getTutorialPopup()->SetTutorialDescription(&popupInfo);
|
if(m_groups[(int)group]->getTutorialPopup()) m_groups[(int)group]->getTutorialPopup()->SetTutorialDescription(&popupInfo);
|
||||||
|
|
@ -2168,7 +2167,7 @@ void UIController::SetMenuDisplayed(int iPad,bool bVal)
|
||||||
|
|
||||||
#ifdef _DURANGO
|
#ifdef _DURANGO
|
||||||
// 4J-JEV: When in-game, allow player to toggle the 'Pause' and 'IngameInfo' menus via Kinnect.
|
// 4J-JEV: When in-game, allow player to toggle the 'Pause' and 'IngameInfo' menus via Kinnect.
|
||||||
if (Minecraft::GetInstance()->running)
|
if (Minecraft::GetInstance()->running)
|
||||||
InputManager.SetEnabledGtcButtons(_360_GTC_MENU | _360_GTC_PAUSE | _360_GTC_VIEW);
|
InputManager.SetEnabledGtcButtons(_360_GTC_MENU | _360_GTC_PAUSE | _360_GTC_VIEW);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
@ -2341,7 +2340,7 @@ void UIController::PlayUISFX(ESoundEffect eSound)
|
||||||
// Don't play multiple SFX on the same tick
|
// Don't play multiple SFX on the same tick
|
||||||
// (prevents horrible sounds when programmatically setting multiple checkboxes)
|
// (prevents horrible sounds when programmatically setting multiple checkboxes)
|
||||||
if (time - m_lastUiSfx < 10) { return; }
|
if (time - m_lastUiSfx < 10) { return; }
|
||||||
m_lastUiSfx = time;
|
m_lastUiSfx = time;
|
||||||
|
|
||||||
Minecraft::GetInstance()->soundEngine->playUI(eSound,1.0f,1.0f);
|
Minecraft::GetInstance()->soundEngine->playUI(eSound,1.0f,1.0f);
|
||||||
}
|
}
|
||||||
|
|
@ -2588,7 +2587,7 @@ void UIController::SetTrialTimerLimitSecs(unsigned int uiSeconds)
|
||||||
|
|
||||||
void UIController::UpdateTrialTimer(unsigned int iPad)
|
void UIController::UpdateTrialTimer(unsigned int iPad)
|
||||||
{
|
{
|
||||||
WCHAR wcTime[20];
|
WCHAR wcTime[20];
|
||||||
|
|
||||||
DWORD dwTimeTicks=(DWORD)app.getTrialTimer();
|
DWORD dwTimeTicks=(DWORD)app.getTrialTimer();
|
||||||
|
|
||||||
|
|
@ -2650,7 +2649,7 @@ void UIController::ShowAutosaveCountdownTimer(bool show)
|
||||||
void UIController::UpdateAutosaveCountdownTimer(unsigned int uiSeconds)
|
void UIController::UpdateAutosaveCountdownTimer(unsigned int uiSeconds)
|
||||||
{
|
{
|
||||||
#if !(defined(_XBOX_ONE) || defined(__ORBIS__))
|
#if !(defined(_XBOX_ONE) || defined(__ORBIS__))
|
||||||
WCHAR wcAutosaveCountdown[100];
|
WCHAR wcAutosaveCountdown[100];
|
||||||
swprintf( wcAutosaveCountdown, 100, app.GetString(IDS_AUTOSAVE_COUNTDOWN),uiSeconds);
|
swprintf( wcAutosaveCountdown, 100, app.GetString(IDS_AUTOSAVE_COUNTDOWN),uiSeconds);
|
||||||
if(m_groups[(int)eUIGroup_Fullscreen]->getPressStartToPlay()) m_groups[(int)eUIGroup_Fullscreen]->getPressStartToPlay()->setTrialTimer(wcAutosaveCountdown);
|
if(m_groups[(int)eUIGroup_Fullscreen]->getPressStartToPlay()) m_groups[(int)eUIGroup_Fullscreen]->getPressStartToPlay()->setTrialTimer(wcAutosaveCountdown);
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -2820,7 +2819,7 @@ C4JStorage::EMessageResult UIController::RequestUGCMessageBox(UINT title/* = -1
|
||||||
#ifdef __ORBIS__
|
#ifdef __ORBIS__
|
||||||
// Show the vague UGC system message in addition to our message
|
// Show the vague UGC system message in addition to our message
|
||||||
ProfileManager.DisplaySystemMessage( SCE_MSG_DIALOG_SYSMSG_TYPE_TRC_PSN_UGC_RESTRICTION, iPad );
|
ProfileManager.DisplaySystemMessage( SCE_MSG_DIALOG_SYSMSG_TYPE_TRC_PSN_UGC_RESTRICTION, iPad );
|
||||||
return C4JStorage::EMessage_ResultAccept;
|
return C4JStorage::EMessage_ResultAccept;
|
||||||
#elif defined(__PSVITA__)
|
#elif defined(__PSVITA__)
|
||||||
ProfileManager.ShowSystemMessage( SCE_MSG_DIALOG_SYSMSG_TYPE_TRC_PSN_CHAT_RESTRICTION, iPad );
|
ProfileManager.ShowSystemMessage( SCE_MSG_DIALOG_SYSMSG_TYPE_TRC_PSN_CHAT_RESTRICTION, iPad );
|
||||||
UINT uiIDA[1];
|
UINT uiIDA[1];
|
||||||
|
|
@ -2857,7 +2856,7 @@ C4JStorage::EMessageResult UIController::RequestContentRestrictedMessageBox(UINT
|
||||||
#ifdef __ORBIS__
|
#ifdef __ORBIS__
|
||||||
// Show the vague UGC system message in addition to our message
|
// Show the vague UGC system message in addition to our message
|
||||||
ProfileManager.DisplaySystemMessage( SCE_MSG_DIALOG_SYSMSG_TYPE_TRC_PSN_UGC_RESTRICTION, iPad );
|
ProfileManager.DisplaySystemMessage( SCE_MSG_DIALOG_SYSMSG_TYPE_TRC_PSN_UGC_RESTRICTION, iPad );
|
||||||
return C4JStorage::EMessage_ResultAccept;
|
return C4JStorage::EMessage_ResultAccept;
|
||||||
#elif defined(__PSVITA__)
|
#elif defined(__PSVITA__)
|
||||||
ProfileManager.ShowSystemMessage( SCE_MSG_DIALOG_SYSMSG_TYPE_TRC_PSN_AGE_RESTRICTION, iPad );
|
ProfileManager.ShowSystemMessage( SCE_MSG_DIALOG_SYSMSG_TYPE_TRC_PSN_AGE_RESTRICTION, iPad );
|
||||||
return C4JStorage::EMessage_ResultAccept;
|
return C4JStorage::EMessage_ResultAccept;
|
||||||
|
|
@ -2897,7 +2896,7 @@ void UIController::setFontCachingCalculationBuffer(int length)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns the first scene of given type if it exists, NULL otherwise
|
// Returns the first scene of given type if it exists, NULL otherwise
|
||||||
UIScene *UIController::FindScene(EUIScene sceneType)
|
UIScene *UIController::FindScene(EUIScene sceneType)
|
||||||
{
|
{
|
||||||
UIScene *pScene = NULL;
|
UIScene *pScene = NULL;
|
||||||
|
|
@ -3002,11 +3001,8 @@ void UIController::TouchBoxRebuild(UIScene *pUIScene)
|
||||||
ui.TouchBoxesClear(pUIScene);
|
ui.TouchBoxesClear(pUIScene);
|
||||||
|
|
||||||
// rebuild boxes
|
// rebuild boxes
|
||||||
AUTO_VAR(itEnd, pUIScene->GetControls()->end());
|
for ( UIControl *control : *pUIScene->GetControls() )
|
||||||
for (AUTO_VAR(it, pUIScene->GetControls()->begin()); it != itEnd; it++)
|
|
||||||
{
|
{
|
||||||
UIControl *control=(UIControl *)*it;
|
|
||||||
|
|
||||||
if(control->getControlType() == UIControl::eButton ||
|
if(control->getControlType() == UIControl::eButton ||
|
||||||
control->getControlType() == UIControl::eSlider ||
|
control->getControlType() == UIControl::eSlider ||
|
||||||
control->getControlType() == UIControl::eCheckBox ||
|
control->getControlType() == UIControl::eCheckBox ||
|
||||||
|
|
@ -3035,11 +3031,9 @@ void UIController::TouchBoxesClear(UIScene *pUIScene)
|
||||||
EUILayer eUILayer=pUIScene->GetParentLayer()->m_iLayer;
|
EUILayer eUILayer=pUIScene->GetParentLayer()->m_iLayer;
|
||||||
EUIScene eUIscene=pUIScene->getSceneType();
|
EUIScene eUIscene=pUIScene->getSceneType();
|
||||||
|
|
||||||
AUTO_VAR(itEnd, m_TouchBoxes[eUIGroup][eUILayer][eUIscene].end());
|
for ( UIELEMENT *element : m_TouchBoxes[eUIGroup][eUILayer][eUIscene] )
|
||||||
for (AUTO_VAR(it, m_TouchBoxes[eUIGroup][eUILayer][eUIscene].begin()); it != itEnd; it++)
|
|
||||||
{
|
{
|
||||||
UIELEMENT *element=(UIELEMENT *)*it;
|
delete element;
|
||||||
delete element;
|
|
||||||
}
|
}
|
||||||
m_TouchBoxes[eUIGroup][eUILayer][eUIscene].clear();
|
m_TouchBoxes[eUIGroup][eUILayer][eUIscene].clear();
|
||||||
}
|
}
|
||||||
|
|
@ -3056,10 +3050,8 @@ bool UIController::TouchBoxHit(UIScene *pUIScene,S32 x, S32 y)
|
||||||
|
|
||||||
if(m_TouchBoxes[eUIGroup][eUILayer][eUIscene].size()>0)
|
if(m_TouchBoxes[eUIGroup][eUILayer][eUIscene].size()>0)
|
||||||
{
|
{
|
||||||
AUTO_VAR(itEnd, m_TouchBoxes[eUIGroup][eUILayer][eUIscene].end());
|
for ( UIELEMENT *element : m_TouchBoxes[eUIGroup][eUILayer][eUIscene] )
|
||||||
for (AUTO_VAR(it, m_TouchBoxes[eUIGroup][eUILayer][eUIscene].begin()); it != itEnd; it++)
|
|
||||||
{
|
{
|
||||||
UIELEMENT *element=(UIELEMENT *)*it;
|
|
||||||
if(element->pControl->getHidden() == false && element->pControl->getVisible()) // ignore removed controls
|
if(element->pControl->getHidden() == false && element->pControl->getVisible()) // ignore removed controls
|
||||||
{
|
{
|
||||||
if((x>=element->x1) &&(x<=element->x2) && (y>=element->y1) && (y<=element->y2))
|
if((x>=element->x1) &&(x<=element->x2) && (y>=element->y1) && (y<=element->y2))
|
||||||
|
|
@ -3075,7 +3067,7 @@ bool UIController::TouchBoxHit(UIScene *pUIScene,S32 x, S32 y)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//app.DebugPrintf("MISS at x = %i y = %i\n", (int)x, (int)y);
|
//app.DebugPrintf("MISS at x = %i y = %i\n", (int)x, (int)y);
|
||||||
|
|
|
||||||
|
|
@ -18,18 +18,16 @@ void UILayer::tick()
|
||||||
{
|
{
|
||||||
// Delete old scenes - deleting a scene can cause a new scene to be deleted, so we need to make a copy of the scenes that we are going to try and destroy this tick
|
// Delete old scenes - deleting a scene can cause a new scene to be deleted, so we need to make a copy of the scenes that we are going to try and destroy this tick
|
||||||
vector<UIScene *>scenesToDeleteCopy;
|
vector<UIScene *>scenesToDeleteCopy;
|
||||||
for( AUTO_VAR(it,m_scenesToDelete.begin()); it != m_scenesToDelete.end(); it++)
|
for(auto& scene : m_scenesToDelete)
|
||||||
{
|
{
|
||||||
UIScene *scene = (*it);
|
|
||||||
scenesToDeleteCopy.push_back(scene);
|
scenesToDeleteCopy.push_back(scene);
|
||||||
}
|
}
|
||||||
m_scenesToDelete.clear();
|
m_scenesToDelete.clear();
|
||||||
|
|
||||||
// Delete the scenes in our copy if they are ready to delete, otherwise add back to the ones that are still to be deleted. Actually deleting a scene might also add something back into m_scenesToDelete.
|
// Delete the scenes in our copy if they are ready to delete, otherwise add back to the ones that are still to be deleted. Actually deleting a scene might also add something back into m_scenesToDelete.
|
||||||
for( AUTO_VAR(it,scenesToDeleteCopy.begin()); it != scenesToDeleteCopy.end(); it++)
|
for(auto& scene : scenesToDeleteCopy)
|
||||||
{
|
{
|
||||||
UIScene *scene = (*it);
|
if( scene && scene->isReadyToDelete())
|
||||||
if( scene->isReadyToDelete())
|
|
||||||
{
|
{
|
||||||
delete scene;
|
delete scene;
|
||||||
}
|
}
|
||||||
|
|
@ -38,7 +36,7 @@ void UILayer::tick()
|
||||||
m_scenesToDelete.push_back(scene);
|
m_scenesToDelete.push_back(scene);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
while (!m_scenesToDestroy.empty())
|
while (!m_scenesToDestroy.empty())
|
||||||
{
|
{
|
||||||
UIScene *scene = m_scenesToDestroy.back();
|
UIScene *scene = m_scenesToDestroy.back();
|
||||||
|
|
@ -46,14 +44,13 @@ void UILayer::tick()
|
||||||
scene->destroyMovie();
|
scene->destroyMovie();
|
||||||
}
|
}
|
||||||
m_scenesToDestroy.clear();
|
m_scenesToDestroy.clear();
|
||||||
|
|
||||||
for(AUTO_VAR(it,m_components.begin()); it != m_components.end(); ++it)
|
for(auto & component : m_components)
|
||||||
{
|
{
|
||||||
(*it)->tick();
|
component->tick();
|
||||||
}
|
}
|
||||||
// Note: reverse iterator, the last element is the top of the stack
|
// Note: reverse iterator, the last element is the top of the stack
|
||||||
int sceneIndex = m_sceneStack.size() - 1;
|
int sceneIndex = m_sceneStack.size() - 1;
|
||||||
//for(AUTO_VAR(it,m_sceneStack.rbegin()); it != m_sceneStack.rend(); ++it)
|
|
||||||
while( sceneIndex >= 0 && sceneIndex < m_sceneStack.size() )
|
while( sceneIndex >= 0 && sceneIndex < m_sceneStack.size() )
|
||||||
{
|
{
|
||||||
//(*it)->tick();
|
//(*it)->tick();
|
||||||
|
|
@ -68,20 +65,20 @@ void UILayer::render(S32 width, S32 height, C4JRender::eViewportType viewport)
|
||||||
{
|
{
|
||||||
if(!ui.IsExpectingOrReloadingSkin())
|
if(!ui.IsExpectingOrReloadingSkin())
|
||||||
{
|
{
|
||||||
for(AUTO_VAR(it,m_components.begin()); it != m_components.end(); ++it)
|
for(auto& it : m_components)
|
||||||
{
|
|
||||||
AUTO_VAR(itRef,m_componentRefCount.find((*it)->getSceneType()));
|
|
||||||
if(itRef != m_componentRefCount.end() && itRef->second.second)
|
|
||||||
{
|
{
|
||||||
if((*it)->isVisible() )
|
auto itRef = m_componentRefCount.find(it->getSceneType());
|
||||||
|
if(itRef != m_componentRefCount.end() && itRef->second.second)
|
||||||
{
|
{
|
||||||
PIXBeginNamedEvent(0, "Rendering component %d", (*it)->getSceneType() );
|
if(it->isVisible() )
|
||||||
(*it)->render(width, height,viewport);
|
{
|
||||||
PIXEndNamedEvent();
|
PIXBeginNamedEvent(0, "Rendering component %d", it->getSceneType() );
|
||||||
|
it->render(width, height,viewport);
|
||||||
|
PIXEndNamedEvent();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if(!m_sceneStack.empty())
|
if(!m_sceneStack.empty())
|
||||||
{
|
{
|
||||||
int lowestRenderable = m_sceneStack.size() - 1;
|
int lowestRenderable = m_sceneStack.size() - 1;
|
||||||
|
|
@ -139,9 +136,9 @@ bool UILayer::HasFocus(int iPad)
|
||||||
bool UILayer::hidesLowerScenes()
|
bool UILayer::hidesLowerScenes()
|
||||||
{
|
{
|
||||||
bool hidesScenes = false;
|
bool hidesScenes = false;
|
||||||
for(AUTO_VAR(it,m_components.begin()); it != m_components.end(); ++it)
|
for(auto& it : m_components)
|
||||||
{
|
{
|
||||||
if((*it)->hidesLowerScenes())
|
if(it->hidesLowerScenes())
|
||||||
{
|
{
|
||||||
hidesScenes = true;
|
hidesScenes = true;
|
||||||
break;
|
break;
|
||||||
|
|
@ -168,28 +165,27 @@ void UILayer::getRenderDimensions(S32 &width, S32 &height)
|
||||||
|
|
||||||
void UILayer::DestroyAll()
|
void UILayer::DestroyAll()
|
||||||
{
|
{
|
||||||
for(AUTO_VAR(it,m_components.begin()); it != m_components.end(); ++it)
|
for(auto& it : m_components)
|
||||||
{
|
{
|
||||||
(*it)->destroyMovie();
|
it->destroyMovie();
|
||||||
}
|
}
|
||||||
for(AUTO_VAR(it, m_sceneStack.begin()); it != m_sceneStack.end(); ++it)
|
for(auto& it : m_sceneStack)
|
||||||
{
|
{
|
||||||
(*it)->destroyMovie();
|
it->destroyMovie();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UILayer::ReloadAll(bool force)
|
void UILayer::ReloadAll(bool force)
|
||||||
{
|
{
|
||||||
for(AUTO_VAR(it,m_components.begin()); it != m_components.end(); ++it)
|
for(auto& it : m_components)
|
||||||
{
|
{
|
||||||
(*it)->reloadMovie(force);
|
it->reloadMovie(force);
|
||||||
}
|
}
|
||||||
if(!m_sceneStack.empty())
|
if(!m_sceneStack.empty())
|
||||||
{
|
{
|
||||||
int lowestRenderable = 0;
|
for(auto& lowestRenderable : m_sceneStack)
|
||||||
for(;lowestRenderable < m_sceneStack.size(); ++lowestRenderable)
|
|
||||||
{
|
{
|
||||||
m_sceneStack[lowestRenderable]->reloadMovie(force);
|
lowestRenderable->reloadMovie(force);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -440,9 +436,9 @@ bool UILayer::NavigateToScene(int iPad, EUIScene scene, void *initData)
|
||||||
}
|
}
|
||||||
|
|
||||||
m_sceneStack.push_back(newScene);
|
m_sceneStack.push_back(newScene);
|
||||||
|
|
||||||
updateFocusState();
|
updateFocusState();
|
||||||
|
|
||||||
newScene->tick();
|
newScene->tick();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -493,8 +489,8 @@ bool UILayer::NavigateBack(int iPad, EUIScene eScene)
|
||||||
|
|
||||||
void UILayer::showComponent(int iPad, EUIScene scene, bool show)
|
void UILayer::showComponent(int iPad, EUIScene scene, bool show)
|
||||||
{
|
{
|
||||||
AUTO_VAR(it,m_componentRefCount.find(scene));
|
auto it = m_componentRefCount.find(scene);
|
||||||
if(it != m_componentRefCount.end())
|
if(it != m_componentRefCount.end())
|
||||||
{
|
{
|
||||||
it->second.second = show;
|
it->second.second = show;
|
||||||
return;
|
return;
|
||||||
|
|
@ -505,8 +501,8 @@ void UILayer::showComponent(int iPad, EUIScene scene, bool show)
|
||||||
bool UILayer::isComponentVisible(EUIScene scene)
|
bool UILayer::isComponentVisible(EUIScene scene)
|
||||||
{
|
{
|
||||||
bool visible = false;
|
bool visible = false;
|
||||||
AUTO_VAR(it,m_componentRefCount.find(scene));
|
auto it = m_componentRefCount.find(scene);
|
||||||
if(it != m_componentRefCount.end())
|
if(it != m_componentRefCount.end())
|
||||||
{
|
{
|
||||||
visible = it->second.second;
|
visible = it->second.second;
|
||||||
}
|
}
|
||||||
|
|
@ -515,16 +511,16 @@ bool UILayer::isComponentVisible(EUIScene scene)
|
||||||
|
|
||||||
UIScene *UILayer::addComponent(int iPad, EUIScene scene, void *initData)
|
UIScene *UILayer::addComponent(int iPad, EUIScene scene, void *initData)
|
||||||
{
|
{
|
||||||
AUTO_VAR(it,m_componentRefCount.find(scene));
|
auto it = m_componentRefCount.find(scene);
|
||||||
if(it != m_componentRefCount.end())
|
if(it != m_componentRefCount.end())
|
||||||
{
|
{
|
||||||
++it->second.first;
|
++it->second.first;
|
||||||
|
|
||||||
for(AUTO_VAR(itComp,m_components.begin()); itComp != m_components.end(); ++itComp)
|
for(auto& itComp : m_components)
|
||||||
{
|
{
|
||||||
if( (*itComp)->getSceneType() == scene )
|
if( itComp->getSceneType() == scene )
|
||||||
{
|
{
|
||||||
return *itComp;
|
return itComp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
@ -586,16 +582,16 @@ UIScene *UILayer::addComponent(int iPad, EUIScene scene, void *initData)
|
||||||
|
|
||||||
void UILayer::removeComponent(EUIScene scene)
|
void UILayer::removeComponent(EUIScene scene)
|
||||||
{
|
{
|
||||||
AUTO_VAR(it,m_componentRefCount.find(scene));
|
auto it = m_componentRefCount.find(scene);
|
||||||
if(it != m_componentRefCount.end())
|
if(it != m_componentRefCount.end())
|
||||||
{
|
{
|
||||||
--it->second.first;
|
--it->second.first;
|
||||||
|
|
||||||
if(it->second.first <= 0)
|
if(it->second.first <= 0)
|
||||||
{
|
{
|
||||||
m_componentRefCount.erase(it);
|
m_componentRefCount.erase(it);
|
||||||
for(AUTO_VAR(compIt, m_components.begin()) ; compIt != m_components.end(); )
|
for (auto compIt = m_components.begin(); compIt != m_components.end();)
|
||||||
{
|
{
|
||||||
if( (*compIt)->getSceneType() == scene)
|
if( (*compIt)->getSceneType() == scene)
|
||||||
{
|
{
|
||||||
#ifdef __PSVITA__
|
#ifdef __PSVITA__
|
||||||
|
|
@ -622,8 +618,8 @@ void UILayer::removeScene(UIScene *scene)
|
||||||
ui.TouchBoxesClear(scene);
|
ui.TouchBoxesClear(scene);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
AUTO_VAR(newEnd, std::remove(m_sceneStack.begin(), m_sceneStack.end(), scene) );
|
auto newEnd = std::remove(m_sceneStack.begin(), m_sceneStack.end(), scene);
|
||||||
m_sceneStack.erase(newEnd, m_sceneStack.end());
|
m_sceneStack.erase(newEnd, m_sceneStack.end());
|
||||||
|
|
||||||
m_scenesToDelete.push_back(scene);
|
m_scenesToDelete.push_back(scene);
|
||||||
|
|
||||||
|
|
@ -645,14 +641,14 @@ void UILayer::closeAllScenes()
|
||||||
vector<UIScene *> temp;
|
vector<UIScene *> temp;
|
||||||
temp.insert(temp.end(), m_sceneStack.begin(), m_sceneStack.end());
|
temp.insert(temp.end(), m_sceneStack.begin(), m_sceneStack.end());
|
||||||
m_sceneStack.clear();
|
m_sceneStack.clear();
|
||||||
for(AUTO_VAR(it, temp.begin()); it != temp.end(); ++it)
|
for(auto& it : temp)
|
||||||
{
|
{
|
||||||
#ifdef __PSVITA__
|
#ifdef __PSVITA__
|
||||||
// remove any touchboxes
|
// remove any touchboxes
|
||||||
ui.TouchBoxesClear(*it);
|
ui.TouchBoxesClear(it);
|
||||||
#endif
|
#endif
|
||||||
m_scenesToDelete.push_back(*it);
|
m_scenesToDelete.push_back(it);
|
||||||
(*it)->handleDestroy(); // For anything that might require the pointer be valid
|
it->handleDestroy(); // For anything that might require the pointer be valid
|
||||||
}
|
}
|
||||||
|
|
||||||
updateFocusState();
|
updateFocusState();
|
||||||
|
|
@ -696,8 +692,8 @@ bool UILayer::updateFocusState(bool allowedFocus /* = false */)
|
||||||
m_bIgnorePlayerJoinMenuDisplayed = false;
|
m_bIgnorePlayerJoinMenuDisplayed = false;
|
||||||
|
|
||||||
bool layerFocusSet = false;
|
bool layerFocusSet = false;
|
||||||
for(AUTO_VAR(it,m_sceneStack.rbegin()); it != m_sceneStack.rend(); ++it)
|
for (auto it = m_sceneStack.rbegin(); it != m_sceneStack.rend(); ++it)
|
||||||
{
|
{
|
||||||
UIScene *scene = *it;
|
UIScene *scene = *it;
|
||||||
|
|
||||||
// UPDATE FOCUS STATES
|
// UPDATE FOCUS STATES
|
||||||
|
|
@ -730,12 +726,12 @@ bool UILayer::updateFocusState(bool allowedFocus /* = false */)
|
||||||
|
|
||||||
// 4J-PB - this should just be true
|
// 4J-PB - this should just be true
|
||||||
m_bMenuDisplayed=true;
|
m_bMenuDisplayed=true;
|
||||||
|
|
||||||
EUIScene sceneType = scene->getSceneType();
|
EUIScene sceneType = scene->getSceneType();
|
||||||
switch(sceneType)
|
switch(sceneType)
|
||||||
{
|
{
|
||||||
case eUIScene_PauseMenu:
|
case eUIScene_PauseMenu:
|
||||||
m_bPauseMenuDisplayed = true;
|
m_bPauseMenuDisplayed = true;
|
||||||
break;
|
break;
|
||||||
case eUIScene_Crafting2x2Menu:
|
case eUIScene_Crafting2x2Menu:
|
||||||
case eUIScene_Crafting3x3Menu:
|
case eUIScene_Crafting3x3Menu:
|
||||||
|
|
@ -757,7 +753,7 @@ bool UILayer::updateFocusState(bool allowedFocus /* = false */)
|
||||||
|
|
||||||
// Intentional fall-through
|
// Intentional fall-through
|
||||||
case eUIScene_DeathMenu:
|
case eUIScene_DeathMenu:
|
||||||
case eUIScene_FullscreenProgress:
|
case eUIScene_FullscreenProgress:
|
||||||
case eUIScene_SignEntryMenu:
|
case eUIScene_SignEntryMenu:
|
||||||
case eUIScene_EndPoem:
|
case eUIScene_EndPoem:
|
||||||
m_bIgnoreAutosaveMenuDisplayed = true;
|
m_bIgnoreAutosaveMenuDisplayed = true;
|
||||||
|
|
@ -766,7 +762,7 @@ bool UILayer::updateFocusState(bool allowedFocus /* = false */)
|
||||||
|
|
||||||
switch(sceneType)
|
switch(sceneType)
|
||||||
{
|
{
|
||||||
case eUIScene_FullscreenProgress:
|
case eUIScene_FullscreenProgress:
|
||||||
case eUIScene_EndPoem:
|
case eUIScene_EndPoem:
|
||||||
case eUIScene_Credits:
|
case eUIScene_Credits:
|
||||||
case eUIScene_LeaderboardsMenu:
|
case eUIScene_LeaderboardsMenu:
|
||||||
|
|
@ -783,7 +779,7 @@ bool UILayer::updateFocusState(bool allowedFocus /* = false */)
|
||||||
UIScene *UILayer::getCurrentScene()
|
UIScene *UILayer::getCurrentScene()
|
||||||
{
|
{
|
||||||
// Note: reverse iterator, the last element is the top of the stack
|
// Note: reverse iterator, the last element is the top of the stack
|
||||||
for(AUTO_VAR(it,m_sceneStack.rbegin()); it != m_sceneStack.rend(); ++it)
|
for( auto it = m_sceneStack.rbegin(); it != m_sceneStack.rend(); ++it)
|
||||||
{
|
{
|
||||||
UIScene *scene = *it;
|
UIScene *scene = *it;
|
||||||
// 4J-PB - only used on Vita, so iPad 0 is fine
|
// 4J-PB - only used on Vita, so iPad 0 is fine
|
||||||
|
|
@ -800,13 +796,13 @@ UIScene *UILayer::getCurrentScene()
|
||||||
void UILayer::handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled)
|
void UILayer::handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled)
|
||||||
{
|
{
|
||||||
// Note: reverse iterator, the last element is the top of the stack
|
// Note: reverse iterator, the last element is the top of the stack
|
||||||
for(AUTO_VAR(it,m_sceneStack.rbegin()); it != m_sceneStack.rend(); ++it)
|
for (auto it = m_sceneStack.rbegin(); it != m_sceneStack.rend(); ++it)
|
||||||
{
|
{
|
||||||
UIScene *scene = *it;
|
UIScene *scene = *it;
|
||||||
if(scene->hasFocus(iPad) && scene->canHandleInput())
|
if(scene->hasFocus(iPad) && scene->canHandleInput())
|
||||||
{
|
{
|
||||||
// 4J-PB - ignore repeats of action ABXY buttons
|
// 4J-PB - ignore repeats of action ABXY buttons
|
||||||
// fix for PS3 213 - [MAIN MENU] Holding down buttons will continue to activate every prompt.
|
// fix for PS3 213 - [MAIN MENU] Holding down buttons will continue to activate every prompt.
|
||||||
// 4J Stu - Changed this slightly to add the allowRepeat function so we can allow repeats in the crafting menu
|
// 4J Stu - Changed this slightly to add the allowRepeat function so we can allow repeats in the crafting menu
|
||||||
if(repeat && !scene->allowRepeat(key) )
|
if(repeat && !scene->allowRepeat(key) )
|
||||||
{
|
{
|
||||||
|
|
@ -814,8 +810,8 @@ void UILayer::handleInput(int iPad, int key, bool repeat, bool pressed, bool rel
|
||||||
}
|
}
|
||||||
scene->handleInput(iPad, key, repeat, pressed, released, handled);
|
scene->handleInput(iPad, key, repeat, pressed, released, handled);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fix for PS3 #444 - [IN GAME] If the user keeps pressing CROSS while on the 'Save Game' screen the title will crash.
|
// Fix for PS3 #444 - [IN GAME] If the user keeps pressing CROSS while on the 'Save Game' screen the title will crash.
|
||||||
handled = handled || scene->hidesLowerScenes() || scene->blocksInput();
|
handled = handled || scene->hidesLowerScenes() || scene->blocksInput();
|
||||||
if(handled ) break;
|
if(handled ) break;
|
||||||
}
|
}
|
||||||
|
|
@ -825,8 +821,8 @@ void UILayer::handleInput(int iPad, int key, bool repeat, bool pressed, bool rel
|
||||||
|
|
||||||
void UILayer::HandleDLCMountingComplete()
|
void UILayer::HandleDLCMountingComplete()
|
||||||
{
|
{
|
||||||
for(AUTO_VAR(it,m_sceneStack.rbegin()); it != m_sceneStack.rend(); ++it)
|
for (auto it = m_sceneStack.rbegin(); it != m_sceneStack.rend(); ++it)
|
||||||
{
|
{
|
||||||
UIScene *topScene = *it;
|
UIScene *topScene = *it;
|
||||||
app.DebugPrintf("UILayer::HandleDLCMountingComplete - topScene\n");
|
app.DebugPrintf("UILayer::HandleDLCMountingComplete - topScene\n");
|
||||||
topScene->HandleDLCMountingComplete();
|
topScene->HandleDLCMountingComplete();
|
||||||
|
|
@ -835,8 +831,8 @@ void UILayer::HandleDLCMountingComplete()
|
||||||
|
|
||||||
void UILayer::HandleDLCInstalled()
|
void UILayer::HandleDLCInstalled()
|
||||||
{
|
{
|
||||||
for(AUTO_VAR(it,m_sceneStack.rbegin()); it != m_sceneStack.rend(); ++it)
|
for (auto it = m_sceneStack.rbegin(); it != m_sceneStack.rend(); ++it)
|
||||||
{
|
{
|
||||||
UIScene *topScene = *it;
|
UIScene *topScene = *it;
|
||||||
topScene->HandleDLCInstalled();
|
topScene->HandleDLCInstalled();
|
||||||
}
|
}
|
||||||
|
|
@ -845,7 +841,7 @@ void UILayer::HandleDLCInstalled()
|
||||||
#ifdef _XBOX_ONE
|
#ifdef _XBOX_ONE
|
||||||
void UILayer::HandleDLCLicenseChange()
|
void UILayer::HandleDLCLicenseChange()
|
||||||
{
|
{
|
||||||
for(AUTO_VAR(it,m_sceneStack.rbegin()); it != m_sceneStack.rend(); ++it)
|
for( auto it = m_sceneStack.rbegin(); it != m_sceneStack.rend(); ++it)
|
||||||
{
|
{
|
||||||
UIScene *topScene = *it;
|
UIScene *topScene = *it;
|
||||||
topScene->HandleDLCLicenseChange();
|
topScene->HandleDLCLicenseChange();
|
||||||
|
|
@ -855,8 +851,8 @@ void UILayer::HandleDLCLicenseChange()
|
||||||
|
|
||||||
void UILayer::HandleMessage(EUIMessage message, void *data)
|
void UILayer::HandleMessage(EUIMessage message, void *data)
|
||||||
{
|
{
|
||||||
for(AUTO_VAR(it,m_sceneStack.rbegin()); it != m_sceneStack.rend(); ++it)
|
for (auto it = m_sceneStack.rbegin(); it != m_sceneStack.rend(); ++it)
|
||||||
{
|
{
|
||||||
UIScene *topScene = *it;
|
UIScene *topScene = *it;
|
||||||
topScene->HandleMessage(message, data);
|
topScene->HandleMessage(message, data);
|
||||||
}
|
}
|
||||||
|
|
@ -875,9 +871,9 @@ C4JRender::eViewportType UILayer::getViewport()
|
||||||
|
|
||||||
void UILayer::handleUnlockFullVersion()
|
void UILayer::handleUnlockFullVersion()
|
||||||
{
|
{
|
||||||
for(AUTO_VAR(it, m_sceneStack.begin()); it != m_sceneStack.end(); ++it)
|
for(auto& it : m_sceneStack)
|
||||||
{
|
{
|
||||||
(*it)->handleUnlockFullVersion();
|
it->handleUnlockFullVersion();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -885,20 +881,20 @@ void UILayer::PrintTotalMemoryUsage(__int64 &totalStatic, __int64 &totalDynamic)
|
||||||
{
|
{
|
||||||
__int64 layerStatic = 0;
|
__int64 layerStatic = 0;
|
||||||
__int64 layerDynamic = 0;
|
__int64 layerDynamic = 0;
|
||||||
for(AUTO_VAR(it,m_components.begin()); it != m_components.end(); ++it)
|
for(auto& it : m_components)
|
||||||
{
|
{
|
||||||
(*it)->PrintTotalMemoryUsage(layerStatic, layerDynamic);
|
it->PrintTotalMemoryUsage(layerStatic, layerDynamic);
|
||||||
}
|
}
|
||||||
for(AUTO_VAR(it, m_sceneStack.begin()); it != m_sceneStack.end(); ++it)
|
for(auto& it : m_sceneStack)
|
||||||
{
|
{
|
||||||
(*it)->PrintTotalMemoryUsage(layerStatic, layerDynamic);
|
it->PrintTotalMemoryUsage(layerStatic, layerDynamic);
|
||||||
}
|
}
|
||||||
app.DebugPrintf(app.USER_SR, " \\- Layer static: %d , Layer dynamic: %d\n", layerStatic, layerDynamic);
|
app.DebugPrintf(app.USER_SR, " \\- Layer static: %d , Layer dynamic: %d\n", layerStatic, layerDynamic);
|
||||||
totalStatic += layerStatic;
|
totalStatic += layerStatic;
|
||||||
totalDynamic += layerDynamic;
|
totalDynamic += layerDynamic;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns the first scene of given type if it exists, NULL otherwise
|
// Returns the first scene of given type if it exists, NULL otherwise
|
||||||
UIScene *UILayer::FindScene(EUIScene sceneType)
|
UIScene *UILayer::FindScene(EUIScene sceneType)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < m_sceneStack.size(); i++)
|
for (int i = 0; i < m_sceneStack.size(); i++)
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ UIScene::UIScene(int iPad, UILayer *parentLayer)
|
||||||
m_iPad = iPad;
|
m_iPad = iPad;
|
||||||
swf = NULL;
|
swf = NULL;
|
||||||
m_pItemRenderer = NULL;
|
m_pItemRenderer = NULL;
|
||||||
|
|
||||||
bHasFocus = false;
|
bHasFocus = false;
|
||||||
m_hasTickedOnce = false;
|
m_hasTickedOnce = false;
|
||||||
m_bFocussedOnce = false;
|
m_bFocussedOnce = false;
|
||||||
|
|
@ -27,7 +27,7 @@ UIScene::UIScene(int iPad, UILayer *parentLayer)
|
||||||
m_bUpdateOpacity = false;
|
m_bUpdateOpacity = false;
|
||||||
|
|
||||||
m_backScene = NULL;
|
m_backScene = NULL;
|
||||||
|
|
||||||
m_cacheSlotRenders = false;
|
m_cacheSlotRenders = false;
|
||||||
m_needsCacheRendered = true;
|
m_needsCacheRendered = true;
|
||||||
m_expectedCachedSlotCount = 0;
|
m_expectedCachedSlotCount = 0;
|
||||||
|
|
@ -39,9 +39,9 @@ UIScene::~UIScene()
|
||||||
/* Destroy the Iggy player. */
|
/* Destroy the Iggy player. */
|
||||||
IggyPlayerDestroy( swf );
|
IggyPlayerDestroy( swf );
|
||||||
|
|
||||||
for(AUTO_VAR(it,m_registeredTextures.begin()); it != m_registeredTextures.end(); ++it)
|
for(auto & it : m_registeredTextures)
|
||||||
{
|
{
|
||||||
ui.unregisterSubstitutionTexture( it->first, it->second );
|
ui.unregisterSubstitutionTexture( it.first, it.second );
|
||||||
}
|
}
|
||||||
|
|
||||||
if(m_callbackUniqueId != 0)
|
if(m_callbackUniqueId != 0)
|
||||||
|
|
@ -88,14 +88,14 @@ void UIScene::reloadMovie(bool force)
|
||||||
handlePreReload();
|
handlePreReload();
|
||||||
|
|
||||||
// Reload controls
|
// Reload controls
|
||||||
for(AUTO_VAR(it, m_controls.begin()); it != m_controls.end(); ++it)
|
for(auto & it : m_controls)
|
||||||
{
|
{
|
||||||
(*it)->ReInit();
|
it->ReInit();
|
||||||
}
|
}
|
||||||
|
|
||||||
updateComponents();
|
updateComponents();
|
||||||
handleReload();
|
handleReload();
|
||||||
|
|
||||||
IggyDataValue result;
|
IggyDataValue result;
|
||||||
IggyDataValue value[1];
|
IggyDataValue value[1];
|
||||||
|
|
||||||
|
|
@ -332,7 +332,7 @@ void UIScene::loadMovie()
|
||||||
__int64 beforeLoad = ui.iggyAllocCount;
|
__int64 beforeLoad = ui.iggyAllocCount;
|
||||||
swf = IggyPlayerCreateFromMemory ( baFile.data , baFile.length, NULL);
|
swf = IggyPlayerCreateFromMemory ( baFile.data , baFile.length, NULL);
|
||||||
__int64 afterLoad = ui.iggyAllocCount;
|
__int64 afterLoad = ui.iggyAllocCount;
|
||||||
IggyPlayerInitializeAndTickRS ( swf );
|
IggyPlayerInitializeAndTickRS ( swf );
|
||||||
__int64 afterTick = ui.iggyAllocCount;
|
__int64 afterTick = ui.iggyAllocCount;
|
||||||
|
|
||||||
if(!swf)
|
if(!swf)
|
||||||
|
|
@ -344,7 +344,7 @@ void UIScene::loadMovie()
|
||||||
app.FatalLoadError();
|
app.FatalLoadError();
|
||||||
}
|
}
|
||||||
app.DebugPrintf( app.USER_SR, "Loaded iggy movie %ls\n", moviePath.c_str() );
|
app.DebugPrintf( app.USER_SR, "Loaded iggy movie %ls\n", moviePath.c_str() );
|
||||||
IggyProperties *properties = IggyPlayerProperties ( swf );
|
IggyProperties *properties = IggyPlayerProperties ( swf );
|
||||||
m_movieHeight = properties->movie_height_in_pixels;
|
m_movieHeight = properties->movie_height_in_pixels;
|
||||||
m_movieWidth = properties->movie_width_in_pixels;
|
m_movieWidth = properties->movie_width_in_pixels;
|
||||||
|
|
||||||
|
|
@ -352,7 +352,7 @@ void UIScene::loadMovie()
|
||||||
m_renderHeight = m_movieHeight;
|
m_renderHeight = m_movieHeight;
|
||||||
|
|
||||||
S32 width, height;
|
S32 width, height;
|
||||||
m_parentLayer->getRenderDimensions(width, height);
|
m_parentLayer->getRenderDimensions(width, height);
|
||||||
IggyPlayerSetDisplaySize( swf, width, height );
|
IggyPlayerSetDisplaySize( swf, width, height );
|
||||||
|
|
||||||
IggyPlayerSetUserdata(swf,this);
|
IggyPlayerSetUserdata(swf,this);
|
||||||
|
|
@ -373,7 +373,7 @@ void UIScene::loadMovie()
|
||||||
{
|
{
|
||||||
totalStatic += memoryInfo.static_allocation_bytes;
|
totalStatic += memoryInfo.static_allocation_bytes;
|
||||||
totalDynamic += memoryInfo.dynamic_allocation_bytes;
|
totalDynamic += memoryInfo.dynamic_allocation_bytes;
|
||||||
app.DebugPrintf(app.USER_SR, "%ls - %.*s static: %d ( %d ) dynamic: %d ( %d )\n", moviePath.c_str(), memoryInfo.subcategory_stringlen, memoryInfo.subcategory,
|
app.DebugPrintf(app.USER_SR, "%ls - %.*s static: %d ( %d ) dynamic: %d ( %d )\n", moviePath.c_str(), memoryInfo.subcategory_stringlen, memoryInfo.subcategory,
|
||||||
memoryInfo.static_allocation_bytes, memoryInfo.static_allocation_count, memoryInfo.dynamic_allocation_bytes, memoryInfo.dynamic_allocation_count);
|
memoryInfo.static_allocation_bytes, memoryInfo.static_allocation_count, memoryInfo.dynamic_allocation_bytes, memoryInfo.dynamic_allocation_count);
|
||||||
++iteration;
|
++iteration;
|
||||||
//if(memoryInfo.static_allocation_bytes > 0) getDebugMemoryUseRecursive(moviePath, memoryInfo);
|
//if(memoryInfo.static_allocation_bytes > 0) getDebugMemoryUseRecursive(moviePath, memoryInfo);
|
||||||
|
|
@ -399,7 +399,7 @@ void UIScene::getDebugMemoryUseRecursive(const wstring &moviePath, IggyMemoryUse
|
||||||
internalIteration ,
|
internalIteration ,
|
||||||
&internalMemoryInfo ))
|
&internalMemoryInfo ))
|
||||||
{
|
{
|
||||||
app.DebugPrintf(app.USER_SR, "%ls - %.*s static: %d ( %d ) dynamic: %d ( %d )\n", moviePath.c_str(), internalMemoryInfo.subcategory_stringlen, internalMemoryInfo.subcategory,
|
app.DebugPrintf(app.USER_SR, "%ls - %.*s static: %d ( %d ) dynamic: %d ( %d )\n", moviePath.c_str(), internalMemoryInfo.subcategory_stringlen, internalMemoryInfo.subcategory,
|
||||||
internalMemoryInfo.static_allocation_bytes, internalMemoryInfo.static_allocation_count, internalMemoryInfo.dynamic_allocation_bytes, internalMemoryInfo.dynamic_allocation_count);
|
internalMemoryInfo.static_allocation_bytes, internalMemoryInfo.static_allocation_count, internalMemoryInfo.dynamic_allocation_bytes, internalMemoryInfo.dynamic_allocation_count);
|
||||||
++internalIteration;
|
++internalIteration;
|
||||||
if(internalMemoryInfo.subcategory_stringlen > memoryInfo.subcategory_stringlen) getDebugMemoryUseRecursive(moviePath, internalMemoryInfo);
|
if(internalMemoryInfo.subcategory_stringlen > memoryInfo.subcategory_stringlen) getDebugMemoryUseRecursive(moviePath, internalMemoryInfo);
|
||||||
|
|
@ -440,9 +440,9 @@ void UIScene::tick()
|
||||||
while(IggyPlayerReadyToTick( swf ))
|
while(IggyPlayerReadyToTick( swf ))
|
||||||
{
|
{
|
||||||
tickTimers();
|
tickTimers();
|
||||||
for(AUTO_VAR(it, m_controls.begin()); it != m_controls.end(); ++it)
|
for(auto & it : m_controls)
|
||||||
{
|
{
|
||||||
(*it)->tick();
|
it->tick();
|
||||||
}
|
}
|
||||||
IggyPlayerTickRS( swf );
|
IggyPlayerTickRS( swf );
|
||||||
m_hasTickedOnce = true;
|
m_hasTickedOnce = true;
|
||||||
|
|
@ -468,8 +468,8 @@ void UIScene::addTimer(int id, int ms)
|
||||||
|
|
||||||
void UIScene::killTimer(int id)
|
void UIScene::killTimer(int id)
|
||||||
{
|
{
|
||||||
AUTO_VAR(it, m_timers.find(id));
|
auto it = m_timers.find(id);
|
||||||
if(it != m_timers.end())
|
if(it != m_timers.end())
|
||||||
{
|
{
|
||||||
it->second.running = false;
|
it->second.running = false;
|
||||||
}
|
}
|
||||||
|
|
@ -478,13 +478,13 @@ void UIScene::killTimer(int id)
|
||||||
void UIScene::tickTimers()
|
void UIScene::tickTimers()
|
||||||
{
|
{
|
||||||
int currentTime = System::currentTimeMillis();
|
int currentTime = System::currentTimeMillis();
|
||||||
for(AUTO_VAR(it, m_timers.begin()); it != m_timers.end();)
|
for (auto it = m_timers.begin(); it != m_timers.end();)
|
||||||
{
|
{
|
||||||
if(!it->second.running)
|
if(!it->second.running)
|
||||||
{
|
{
|
||||||
it = m_timers.erase(it);
|
it = m_timers.erase(it);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(currentTime > it->second.targetTime)
|
if(currentTime > it->second.targetTime)
|
||||||
{
|
{
|
||||||
|
|
@ -501,8 +501,8 @@ void UIScene::tickTimers()
|
||||||
IggyName UIScene::registerFastName(const wstring &name)
|
IggyName UIScene::registerFastName(const wstring &name)
|
||||||
{
|
{
|
||||||
IggyName var;
|
IggyName var;
|
||||||
AUTO_VAR(it,m_fastNames.find(name));
|
auto it = m_fastNames.find(name);
|
||||||
if(it != m_fastNames.end())
|
if(it != m_fastNames.end())
|
||||||
{
|
{
|
||||||
var = it->second;
|
var = it->second;
|
||||||
}
|
}
|
||||||
|
|
@ -635,17 +635,16 @@ void UIScene::customDrawSlotControl(IggyCustomDrawCallbackRegion *region, int iP
|
||||||
if(useCommandBuffers) RenderManager.CBuffStart(list, true);
|
if(useCommandBuffers) RenderManager.CBuffStart(list, true);
|
||||||
#endif
|
#endif
|
||||||
PIXBeginNamedEvent(0,"Draw uncached");
|
PIXBeginNamedEvent(0,"Draw uncached");
|
||||||
ui.setupCustomDrawMatrices(this, customDrawRegion);
|
ui.setupCustomDrawMatrices(this, customDrawRegion);
|
||||||
_customDrawSlotControl(customDrawRegion, iPad, item, fAlpha, isFoil, bDecorations, useCommandBuffers);
|
_customDrawSlotControl(customDrawRegion, iPad, item, fAlpha, isFoil, bDecorations, useCommandBuffers);
|
||||||
delete customDrawRegion;
|
delete customDrawRegion;
|
||||||
PIXEndNamedEvent();
|
PIXEndNamedEvent();
|
||||||
|
|
||||||
PIXBeginNamedEvent(0,"Draw all cache");
|
PIXBeginNamedEvent(0,"Draw all cache");
|
||||||
// Draw all the cached slots
|
// Draw all the cached slots
|
||||||
for(AUTO_VAR(it, m_cachedSlotDraw.begin()); it != m_cachedSlotDraw.end(); ++it)
|
for(auto& drawData : m_cachedSlotDraw)
|
||||||
{
|
{
|
||||||
CachedSlotDrawData *drawData = *it;
|
ui.setupCustomDrawMatrices(this, drawData->customDrawRegion);
|
||||||
ui.setupCustomDrawMatrices(this, drawData->customDrawRegion);
|
|
||||||
_customDrawSlotControl(drawData->customDrawRegion, iPad, drawData->item, drawData->fAlpha, drawData->isFoil, drawData->bDecorations, useCommandBuffers);
|
_customDrawSlotControl(drawData->customDrawRegion, iPad, drawData->item, drawData->fAlpha, drawData->isFoil, drawData->bDecorations, useCommandBuffers);
|
||||||
delete drawData->customDrawRegion;
|
delete drawData->customDrawRegion;
|
||||||
delete drawData;
|
delete drawData;
|
||||||
|
|
@ -699,7 +698,7 @@ void UIScene::customDrawSlotControl(IggyCustomDrawCallbackRegion *region, int iP
|
||||||
// Finish GDraw and anything else that needs to be finalised
|
// Finish GDraw and anything else that needs to be finalised
|
||||||
ui.endCustomDraw(region);
|
ui.endCustomDraw(region);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UIScene::_customDrawSlotControl(CustomDrawData *region, int iPad, shared_ptr<ItemInstance> item, float fAlpha, bool isFoil, bool bDecorations, bool usingCommandBuffer)
|
void UIScene::_customDrawSlotControl(CustomDrawData *region, int iPad, shared_ptr<ItemInstance> item, float fAlpha, bool isFoil, bool bDecorations, bool usingCommandBuffer)
|
||||||
|
|
@ -717,7 +716,7 @@ void UIScene::_customDrawSlotControl(CustomDrawData *region, int iPad, shared_pt
|
||||||
// we might want separate x & y scales here
|
// we might want separate x & y scales here
|
||||||
|
|
||||||
float scaleX = bwidth / 16.0f;
|
float scaleX = bwidth / 16.0f;
|
||||||
float scaleY = bheight / 16.0f;
|
float scaleY = bheight / 16.0f;
|
||||||
|
|
||||||
glEnable(GL_RESCALE_NORMAL);
|
glEnable(GL_RESCALE_NORMAL);
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
|
|
@ -755,8 +754,8 @@ void UIScene::_customDrawSlotControl(CustomDrawData *region, int iPad, shared_pt
|
||||||
if(bDecorations)
|
if(bDecorations)
|
||||||
{
|
{
|
||||||
if((scaleX!=1.0f) ||(scaleY!=1.0f))
|
if((scaleX!=1.0f) ||(scaleY!=1.0f))
|
||||||
{
|
{
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glScalef(scaleX, scaleY, 1.0f);
|
glScalef(scaleX, scaleY, 1.0f);
|
||||||
int iX= (int)(0.5f+((float)x)/scaleX);
|
int iX= (int)(0.5f+((float)x)/scaleX);
|
||||||
int iY= (int)(0.5f+((float)y)/scaleY);
|
int iY= (int)(0.5f+((float)y)/scaleY);
|
||||||
|
|
@ -991,8 +990,8 @@ int UIScene::convertGameActionToIggyKeycode(int action)
|
||||||
|
|
||||||
bool UIScene::allowRepeat(int key)
|
bool UIScene::allowRepeat(int key)
|
||||||
{
|
{
|
||||||
// 4J-PB - ignore repeats of action ABXY buttons
|
// 4J-PB - ignore repeats of action ABXY buttons
|
||||||
// fix for PS3 213 - [MAIN MENU] Holding down buttons will continue to activate every prompt.
|
// fix for PS3 213 - [MAIN MENU] Holding down buttons will continue to activate every prompt.
|
||||||
switch(key)
|
switch(key)
|
||||||
{
|
{
|
||||||
case ACTION_MENU_OK:
|
case ACTION_MENU_OK:
|
||||||
|
|
@ -1185,9 +1184,9 @@ void UIScene::registerSubstitutionTexture(const wstring &textureName, PBYTE pbDa
|
||||||
|
|
||||||
bool UIScene::hasRegisteredSubstitutionTexture(const wstring &textureName)
|
bool UIScene::hasRegisteredSubstitutionTexture(const wstring &textureName)
|
||||||
{
|
{
|
||||||
AUTO_VAR(it, m_registeredTextures.find( textureName ) );
|
auto it = m_registeredTextures.find(textureName);
|
||||||
|
|
||||||
return it != m_registeredTextures.end();
|
return it != m_registeredTextures.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
void UIScene::_handleFocusChange(F64 controlId, F64 childId)
|
void UIScene::_handleFocusChange(F64 controlId, F64 childId)
|
||||||
|
|
@ -1240,10 +1239,8 @@ UIScene *UIScene::getBackScene()
|
||||||
#ifdef __PSVITA__
|
#ifdef __PSVITA__
|
||||||
void UIScene::UpdateSceneControls()
|
void UIScene::UpdateSceneControls()
|
||||||
{
|
{
|
||||||
AUTO_VAR(itEnd, GetControls()->end());
|
for ( UIControl *control : *GetControls() )
|
||||||
for (AUTO_VAR(it, GetControls()->begin()); it != itEnd; it++)
|
|
||||||
{
|
{
|
||||||
UIControl *control=(UIControl *)*it;
|
|
||||||
control->UpdateControl();
|
control->UpdateControl();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -191,13 +191,13 @@ void UIScene_DLCOffersMenu::handleInput(int iPad, int key, bool repeat, bool pre
|
||||||
switch(iTextC)
|
switch(iTextC)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
m_labelHTMLSellText.init("Voici un fantastique mini-pack de 24 apparences pour personnaliser votre personnage Minecraft et vous mettre dans l'ambiance des fêtes de fin d'année.<br><br>1-4 joueurs<br>2-8 joueurs en réseau<br><br> Cet article fait l’objet d’une licence ou d’une sous-licence de Sony Computer Entertainment America, et est soumis aux conditions générales du service du réseau, au contrat d’utilisateur, aux restrictions d’utilisation de cet article et aux autres conditions applicables, disponibles sur le site www.us.playstation.com/support/useragreements. Si vous ne souhaitez pas accepter ces conditions, ne téléchargez pas ce produit. Cet article peut être utilisé avec un maximum de deux systèmes PlayStation®3 activés associés à ce compte Sony Entertainment Network. <br><br>'Minecraft' est une marque commerciale de Notch Development AB.");
|
m_labelHTMLSellText.init("Voici un fantastique mini-pack de 24 apparences pour personnaliser votre personnage Minecraft et vous mettre dans l'ambiance des f<EFBFBD>tes de fin d'ann<6E>e.<br><br>1-4 joueurs<br>2-8 joueurs en r<>seau<br><br> Cet article fait l<>objet d<>une licence ou d<>une sous-licence de Sony Computer Entertainment America, et est soumis aux conditions g<>n<EFBFBD>rales du service du r<>seau, au contrat d<>utilisateur, aux restrictions d<>utilisation de cet article et aux autres conditions applicables, disponibles sur le site www.us.playstation.com/support/useragreements. Si vous ne souhaitez pas accepter ces conditions, ne t<EFBFBD>l<EFBFBD>chargez pas ce produit. Cet article peut <20>tre utilis<69> avec un maximum de deux syst<73>mes PlayStation<6F>3 activ<69>s associ<63>s <20> ce compte Sony Entertainment Network.<2E><br><br>'Minecraft' est une marque commerciale de Notch Development AB.");
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
m_labelHTMLSellText.init("Un fabuloso minipack de 24 aspectos para personalizar tu personaje de Minecraft y ponerte a tono con las fiestas.<br><br>1-4 jugadores<br>2-8 jugadores en red<br><br> Sony Computer Entertainment America le concede la licencia o sublicencia de este artículo, que está sujeto a los términos de servicio y al acuerdo de usuario de la red. Las restricciones de uso de este artículo, así como otros términos aplicables, se encuentran en www.us.playstation.com/support/useragreements. Si no desea aceptar todos estos términos, no descargue este artículo. Este artículo puede usarse en hasta dos sistemas PlayStation®3 activados asociados con esta cuenta de Sony Entertainment Network. <br><br>'Minecraft' es una marca comercial de Notch Development AB.");
|
m_labelHTMLSellText.init("Un fabuloso minipack de 24 aspectos para personalizar tu personaje de Minecraft y ponerte a tono con las fiestas.<br><br>1-4 jugadores<br>2-8 jugadores en red<br><br> Sony Computer Entertainment America le concede la licencia o sublicencia de este art<EFBFBD>culo, que est<73> sujeto a los t<>rminos de servicio y al acuerdo de usuario de la red. Las restricciones de uso de este art<72>culo, as<61> como otros t<>rminos aplicables, se encuentran en www.us.playstation.com/support/useragreements. Si no desea aceptar todos estos t<EFBFBD>rminos, no descargue este art<72>culo. Este art<72>culo puede usarse en hasta dos sistemas PlayStation<6F>3 activados asociados con esta cuenta de Sony Entertainment Network.<2E><br><br>'Minecraft' es una marca comercial de Notch Development AB.");
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
m_labelHTMLSellText.init("Este é um incrível pacote com 24 capas para personalizar seu personagem no Minecraft e entrar no clima de final de ano.<br><br>1-4 Jogadores<br>Jogadores em rede 2-8<br><br> Este item está sendo licenciado ou sublicenciado para você pela Sony Computer Entertainment America e está sujeito aos Termos de Serviço da Rede e Acordo do Usuário, as restrições de uso deste item e outros termos aplicáveis estão localizados em www.us.playstation.com/support/useragreements. Caso não queira aceitar todos esses termos, não baixe este item. Este item pode ser usado com até 2 sistemas PlayStation®3 ativados associados a esta Conta de Rede Sony Entertainment. <br><br>'Minecraft' é uma marca registrada da Notch Development AB");
|
m_labelHTMLSellText.init("Este <EFBFBD> um incr<63>vel pacote com 24 capas para personalizar seu personagem no Minecraft e entrar no clima de final de ano.<br><br>1-4 Jogadores<br>Jogadores em rede 2-8<br><br> Este item est<EFBFBD> sendo licenciado ou sublicenciado para voc<6F> pela Sony Computer Entertainment America e est<73> sujeito aos Termos de Servi<76>o da Rede e Acordo do Usu<73>rio, as restri<72><69>es de uso deste item e outros termos aplic<69>veis est<73>o localizados em www.us.playstation.com/support/useragreements. Caso n<>o queira aceitar todos esses termos, n<>o baixe este item. Este item pode ser usado com at<61> 2 sistemas PlayStation<6F>3 ativados associados a esta Conta de Rede Sony Entertainment.<2E><br><br>'Minecraft' <20> uma marca registrada da Notch Development AB");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
iTextC++;
|
iTextC++;
|
||||||
|
|
@ -208,7 +208,7 @@ void UIScene_DLCOffersMenu::handleInput(int iPad, int key, bool repeat, bool pre
|
||||||
case ACTION_MENU_OTHER_STICK_DOWN:
|
case ACTION_MENU_OTHER_STICK_DOWN:
|
||||||
case ACTION_MENU_OTHER_STICK_UP:
|
case ACTION_MENU_OTHER_STICK_UP:
|
||||||
// don't pass down PageUp or PageDown because this will cause conflicts between the buttonlist and scrollable html text component
|
// don't pass down PageUp or PageDown because this will cause conflicts between the buttonlist and scrollable html text component
|
||||||
//case ACTION_MENU_PAGEUP:
|
//case ACTION_MENU_PAGEUP:
|
||||||
//case ACTION_MENU_PAGEDOWN:
|
//case ACTION_MENU_PAGEDOWN:
|
||||||
sendInputToMovie(key, repeat, pressed, released);
|
sendInputToMovie(key, repeat, pressed, released);
|
||||||
break;
|
break;
|
||||||
|
|
@ -235,7 +235,7 @@ void UIScene_DLCOffersMenu::handlePress(F64 controlId, F64 childId)
|
||||||
|
|
||||||
#ifdef __PS3__
|
#ifdef __PS3__
|
||||||
// is the item purchasable?
|
// is the item purchasable?
|
||||||
if(info.purchasabilityFlag==1)
|
if(info.purchasabilityFlag==1)
|
||||||
{
|
{
|
||||||
// can be bought
|
// can be bought
|
||||||
app.Checkout(info.skuId);
|
app.Checkout(info.skuId);
|
||||||
|
|
@ -249,7 +249,7 @@ void UIScene_DLCOffersMenu::handlePress(F64 controlId, F64 childId)
|
||||||
}
|
}
|
||||||
#else // __ORBIS__
|
#else // __ORBIS__
|
||||||
// is the item purchasable?
|
// is the item purchasable?
|
||||||
if(info.purchasabilityFlag==SCE_TOOLKIT_NP_COMMERCE_NOT_PURCHASED)
|
if(info.purchasabilityFlag==SCE_TOOLKIT_NP_COMMERCE_NOT_PURCHASED)
|
||||||
{
|
{
|
||||||
// can be bought
|
// can be bought
|
||||||
app.Checkout(info.skuId);
|
app.Checkout(info.skuId);
|
||||||
|
|
@ -280,7 +280,7 @@ void UIScene_DLCOffersMenu::handleSelectionChanged(F64 selectedId)
|
||||||
}
|
}
|
||||||
|
|
||||||
void UIScene_DLCOffersMenu::handleFocusChange(F64 controlId, F64 childId)
|
void UIScene_DLCOffersMenu::handleFocusChange(F64 controlId, F64 childId)
|
||||||
{
|
{
|
||||||
app.DebugPrintf("UIScene_DLCOffersMenu::handleFocusChange\n");
|
app.DebugPrintf("UIScene_DLCOffersMenu::handleFocusChange\n");
|
||||||
|
|
||||||
#ifdef __PSVITA__
|
#ifdef __PSVITA__
|
||||||
|
|
@ -305,7 +305,7 @@ void UIScene_DLCOffersMenu::handleFocusChange(F64 controlId, F64 childId)
|
||||||
|
|
||||||
#if defined __PSVITA__ || defined __ORBIS__
|
#if defined __PSVITA__ || defined __ORBIS__
|
||||||
if(m_pvProductInfo)
|
if(m_pvProductInfo)
|
||||||
{
|
{
|
||||||
m_bIsSelected = true;
|
m_bIsSelected = true;
|
||||||
vector<SonyCommerce::ProductInfo >::iterator it = m_pvProductInfo->begin();
|
vector<SonyCommerce::ProductInfo >::iterator it = m_pvProductInfo->begin();
|
||||||
string teststring;
|
string teststring;
|
||||||
|
|
@ -315,7 +315,7 @@ void UIScene_DLCOffersMenu::handleFocusChange(F64 controlId, F64 childId)
|
||||||
}
|
}
|
||||||
|
|
||||||
SonyCommerce::ProductInfo info = *it;
|
SonyCommerce::ProductInfo info = *it;
|
||||||
if(info.purchasabilityFlag==SCE_TOOLKIT_NP_COMMERCE_NOT_PURCHASED)
|
if(info.purchasabilityFlag==SCE_TOOLKIT_NP_COMMERCE_NOT_PURCHASED)
|
||||||
{
|
{
|
||||||
m_bHasPurchased=false;
|
m_bHasPurchased=false;
|
||||||
}
|
}
|
||||||
|
|
@ -379,7 +379,7 @@ void UIScene_DLCOffersMenu::tick()
|
||||||
|
|
||||||
#ifdef __PS3__
|
#ifdef __PS3__
|
||||||
// is the item purchasable?
|
// is the item purchasable?
|
||||||
if(info.purchasabilityFlag==1)
|
if(info.purchasabilityFlag==1)
|
||||||
{
|
{
|
||||||
// can be bought
|
// can be bought
|
||||||
app.DebugPrintf("Adding DLC (%s) - not bought\n",teststring.c_str());
|
app.DebugPrintf("Adding DLC (%s) - not bought\n",teststring.c_str());
|
||||||
|
|
@ -397,7 +397,7 @@ void UIScene_DLCOffersMenu::tick()
|
||||||
}
|
}
|
||||||
#else // __ORBIS__
|
#else // __ORBIS__
|
||||||
// is the item purchasable?
|
// is the item purchasable?
|
||||||
if(info.purchasabilityFlag==SCE_TOOLKIT_NP_COMMERCE_NOT_PURCHASED)
|
if(info.purchasabilityFlag==SCE_TOOLKIT_NP_COMMERCE_NOT_PURCHASED)
|
||||||
{
|
{
|
||||||
// can be bought
|
// can be bought
|
||||||
m_buttonListOffers.addItem(teststring,false,i);
|
m_buttonListOffers.addItem(teststring,false,i);
|
||||||
|
|
@ -445,13 +445,13 @@ void UIScene_DLCOffersMenu::tick()
|
||||||
|
|
||||||
// does the DLC info have an image?
|
// does the DLC info have an image?
|
||||||
if(pSONYDLCInfo && pSONYDLCInfo->dwImageBytes!=0)
|
if(pSONYDLCInfo && pSONYDLCInfo->dwImageBytes!=0)
|
||||||
{
|
{
|
||||||
pbImageData=pSONYDLCInfo->pbImageData;
|
pbImageData=pSONYDLCInfo->pbImageData;
|
||||||
iImageDataBytes=pSONYDLCInfo->dwImageBytes;
|
iImageDataBytes=pSONYDLCInfo->dwImageBytes;
|
||||||
bDeleteData=false; // we'll clean up the local LDC images
|
bDeleteData=false; // we'll clean up the local LDC images
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
if(info.imageUrl[0]!=0)
|
if(info.imageUrl[0]!=0)
|
||||||
{
|
{
|
||||||
SonyHttp::getDataFromURL(info.imageUrl,(void **)&pbImageData,&iImageDataBytes);
|
SonyHttp::getDataFromURL(info.imageUrl,(void **)&pbImageData,&iImageDataBytes);
|
||||||
|
|
@ -460,7 +460,7 @@ void UIScene_DLCOffersMenu::tick()
|
||||||
|
|
||||||
if(iImageDataBytes!=0)
|
if(iImageDataBytes!=0)
|
||||||
{
|
{
|
||||||
// set the image
|
// set the image
|
||||||
registerSubstitutionTexture(textureName,pbImageData,iImageDataBytes,bDeleteData);
|
registerSubstitutionTexture(textureName,pbImageData,iImageDataBytes,bDeleteData);
|
||||||
m_bitmapIconOfferImage.setTextureName(textureName);
|
m_bitmapIconOfferImage.setTextureName(textureName);
|
||||||
// 4J Stu - Don't delete this
|
// 4J Stu - Don't delete this
|
||||||
|
|
@ -497,25 +497,25 @@ void UIScene_DLCOffersMenu::tick()
|
||||||
m_labelOffers.setLabel(app.GetString(IDS_NO_DLCCATEGORIES));
|
m_labelOffers.setLabel(app.GetString(IDS_NO_DLCCATEGORIES));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Timer.setVisible(false);
|
m_Timer.setVisible(false);
|
||||||
m_bProductInfoShown=true;
|
m_bProductInfoShown=true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifdef __PSVITA__
|
#ifdef __PSVITA__
|
||||||
// MGH - fixes bug 5768 on Vita - should be extended properly to work for other platforms
|
// MGH - fixes bug 5768 on Vita - should be extended properly to work for other platforms
|
||||||
if((SonyCommerce_Vita::getPurchasabilityUpdated()) && app.GetCommerceProductListRetrieved()&& app.GetCommerceProductListInfoRetrieved() && m_iTotalDLC > 0)
|
if((SonyCommerce_Vita::getPurchasabilityUpdated()) && app.GetCommerceProductListRetrieved()&& app.GetCommerceProductListInfoRetrieved() && m_iTotalDLC > 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
{
|
{
|
||||||
vector<SonyCommerce::ProductInfo >::iterator it = m_pvProductInfo->begin();
|
vector<SonyCommerce::ProductInfo >::iterator it = m_pvProductInfo->begin();
|
||||||
for(int i=0;i<m_iTotalDLC;i++)
|
for(int i=0;i<m_iTotalDLC;i++)
|
||||||
{
|
{
|
||||||
SonyCommerce::ProductInfo info = *it;
|
SonyCommerce::ProductInfo info = *it;
|
||||||
// is the item purchasable?
|
// is the item purchasable?
|
||||||
if(info.purchasabilityFlag==SCE_TOOLKIT_NP_COMMERCE_NOT_PURCHASED)
|
if(info.purchasabilityFlag==SCE_TOOLKIT_NP_COMMERCE_NOT_PURCHASED)
|
||||||
{
|
{
|
||||||
// can be bought
|
// can be bought
|
||||||
m_buttonListOffers.showTick(i, false);
|
m_buttonListOffers.showTick(i, false);
|
||||||
|
|
@ -577,11 +577,11 @@ void UIScene_DLCOffersMenu::tick()
|
||||||
|
|
||||||
// does the DLC info have an image?
|
// does the DLC info have an image?
|
||||||
if(pSONYDLCInfo->dwImageBytes!=0)
|
if(pSONYDLCInfo->dwImageBytes!=0)
|
||||||
{
|
{
|
||||||
pbImageData=pSONYDLCInfo->pbImageData;
|
pbImageData=pSONYDLCInfo->pbImageData;
|
||||||
iImageDataBytes=pSONYDLCInfo->dwImageBytes;
|
iImageDataBytes=pSONYDLCInfo->dwImageBytes;
|
||||||
bDeleteData=false; // we'll clean up the local LDC images
|
bDeleteData=false; // we'll clean up the local LDC images
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
|
|
@ -601,7 +601,7 @@ void UIScene_DLCOffersMenu::tick()
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_bitmapIconOfferImage.setTextureName(L"");
|
m_bitmapIconOfferImage.setTextureName(L"");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -620,7 +620,7 @@ void UIScene_DLCOffersMenu::tick()
|
||||||
{
|
{
|
||||||
// DLCContentRetrieved is to see if the type of content has been retrieved - and on Durango there is only type 0 - XMARKETPLACE_OFFERING_TYPE_CONTENT
|
// DLCContentRetrieved is to see if the type of content has been retrieved - and on Durango there is only type 0 - XMARKETPLACE_OFFERING_TYPE_CONTENT
|
||||||
if(app.DLCContentRetrieved(e_Marketplace_Content))
|
if(app.DLCContentRetrieved(e_Marketplace_Content))
|
||||||
{
|
{
|
||||||
m_bDLCRequiredIsRetrieved=true;
|
m_bDLCRequiredIsRetrieved=true;
|
||||||
|
|
||||||
// Retrieve the info
|
// Retrieve the info
|
||||||
|
|
@ -660,29 +660,10 @@ void UIScene_DLCOffersMenu::tick()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// if(m_bBitmapOfferIconDisplayed==false)
|
|
||||||
// {
|
|
||||||
// // do we have it yet?
|
|
||||||
// if
|
|
||||||
// }
|
|
||||||
// retrieve the icons for the DLC
|
|
||||||
// if(m_vIconRetrieval.size()>0)
|
|
||||||
// {
|
|
||||||
// // for each icon, request it, and remove it from the list
|
|
||||||
// // the callback for the retrieval will update the display if needed
|
|
||||||
//
|
|
||||||
// AUTO_VAR(itEnd, m_vIconRetrieval.end());
|
|
||||||
// for (AUTO_VAR(it, m_vIconRetrieval.begin()); it != itEnd; it++)
|
|
||||||
// {
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined _XBOX_ONE
|
#if defined _XBOX_ONE
|
||||||
void UIScene_DLCOffersMenu::GetDLCInfo( int iOfferC, bool bUpdateOnly )
|
void UIScene_DLCOffersMenu::GetDLCInfo( int iOfferC, bool bUpdateOnly )
|
||||||
{
|
{
|
||||||
MARKETPLACE_CONTENTOFFER_INFO xOffer;
|
MARKETPLACE_CONTENTOFFER_INFO xOffer;
|
||||||
|
|
@ -719,7 +700,7 @@ void UIScene_DLCOffersMenu::GetDLCInfo( int iOfferC, bool bUpdateOnly )
|
||||||
app.DebugPrintf("Unknown offer - %ls\n",xOffer.wszOfferName);
|
app.DebugPrintf("Unknown offer - %ls\n",xOffer.wszOfferName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
qsort( OrderA, uiDLCCount, sizeof(SORTINDEXSTRUCT), OrderSortFunction );
|
qsort( OrderA, uiDLCCount, sizeof(SORTINDEXSTRUCT), OrderSortFunction );
|
||||||
|
|
||||||
for(int i = 0; i < uiDLCCount; i++)
|
for(int i = 0; i < uiDLCCount; i++)
|
||||||
|
|
@ -737,7 +718,7 @@ void UIScene_DLCOffersMenu::GetDLCInfo( int iOfferC, bool bUpdateOnly )
|
||||||
}
|
}
|
||||||
|
|
||||||
if(pDLC->eDLCType==(eDLCContentType)m_iProductInfoIndex)
|
if(pDLC->eDLCType==(eDLCContentType)m_iProductInfoIndex)
|
||||||
{
|
{
|
||||||
wstring wstrTemp=xOffer.wszOfferName;
|
wstring wstrTemp=xOffer.wszOfferName;
|
||||||
|
|
||||||
// 4J-PB - Rog requested we remove the Minecraft at the start of the name. It's required for the Bing search, but gets in the way here
|
// 4J-PB - Rog requested we remove the Minecraft at the start of the name. It's required for the Bing search, but gets in the way here
|
||||||
|
|
@ -774,7 +755,7 @@ void UIScene_DLCOffersMenu::GetDLCInfo( int iOfferC, bool bUpdateOnly )
|
||||||
* We've filtered results out from the list, need to keep track
|
* We've filtered results out from the list, need to keep track
|
||||||
* of the 'actual' list index.
|
* of the 'actual' list index.
|
||||||
*/
|
*/
|
||||||
iCount++;
|
iCount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -834,7 +815,7 @@ bool UIScene_DLCOffersMenu::UpdateDisplay(MARKETPLACE_CONTENTOFFER_INFO& xOffer)
|
||||||
|
|
||||||
|
|
||||||
// is the file in the local DLC images?
|
// is the file in the local DLC images?
|
||||||
// is the file in the TMS XZP?
|
// is the file in the TMS XZP?
|
||||||
//int iIndex = app.GetLocalTMSFileIndex(cString, true);
|
//int iIndex = app.GetLocalTMSFileIndex(cString, true);
|
||||||
|
|
||||||
if(dlc->dwImageBytes!=0)
|
if(dlc->dwImageBytes!=0)
|
||||||
|
|
@ -862,7 +843,7 @@ bool UIScene_DLCOffersMenu::UpdateDisplay(MARKETPLACE_CONTENTOFFER_INFO& xOffer)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(hasRegisteredSubstitutionTexture(cString)==false)
|
if(hasRegisteredSubstitutionTexture(cString)==false)
|
||||||
{
|
{
|
||||||
BYTE *pData=NULL;
|
BYTE *pData=NULL;
|
||||||
DWORD dwSize=0;
|
DWORD dwSize=0;
|
||||||
app.GetMemFileDetails(cString,&pData,&dwSize);
|
app.GetMemFileDetails(cString,&pData,&dwSize);
|
||||||
|
|
@ -879,12 +860,12 @@ bool UIScene_DLCOffersMenu::UpdateDisplay(MARKETPLACE_CONTENTOFFER_INFO& xOffer)
|
||||||
m_bitmapIconOfferImage.setTextureName(cString);
|
m_bitmapIconOfferImage.setTextureName(cString);
|
||||||
}
|
}
|
||||||
bImageAvailable=true;
|
bImageAvailable=true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_labelHTMLSellText.setLabel(xOffer.wszSellText);
|
m_labelHTMLSellText.setLabel(xOffer.wszSellText);
|
||||||
|
|
||||||
// set the price info
|
// set the price info
|
||||||
m_labelPriceTag.setVisible(true);
|
m_labelPriceTag.setVisible(true);
|
||||||
m_labelPriceTag.setLabel(xOffer.wszCurrencyPrice);
|
m_labelPriceTag.setLabel(xOffer.wszCurrencyPrice);
|
||||||
|
|
||||||
|
|
@ -923,7 +904,7 @@ void UIScene_DLCOffersMenu::HandleDLCInstalled()
|
||||||
}
|
}
|
||||||
|
|
||||||
// void UIScene_DLCOffersMenu::HandleDLCMountingComplete()
|
// void UIScene_DLCOffersMenu::HandleDLCMountingComplete()
|
||||||
// {
|
// {
|
||||||
// app.DebugPrintf(4,"UIScene_SkinSelectMenu::HandleDLCMountingComplete\n");
|
// app.DebugPrintf(4,"UIScene_SkinSelectMenu::HandleDLCMountingComplete\n");
|
||||||
//}
|
//}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,7 @@ UIScene_DebugOverlay::UIScene_DebugOverlay(int iPad, void *initData, UILayer *pa
|
||||||
for(unsigned int level = ench->getMinLevel(); level <= ench->getMaxLevel(); ++level)
|
for(unsigned int level = ench->getMinLevel(); level <= ench->getMaxLevel(); ++level)
|
||||||
{
|
{
|
||||||
m_enchantmentIdAndLevels.push_back(pair<int,int>(ench->id,level));
|
m_enchantmentIdAndLevels.push_back(pair<int,int>(ench->id,level));
|
||||||
m_buttonListEnchantments.addItem(app.GetString( ench->getDescriptionId() ) + _toString<int>(level) );
|
m_buttonListEnchantments.addItem(app.GetString( ench->getDescriptionId() ) + std::to_wstring(level) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -196,7 +196,7 @@ void UIScene_DebugOverlay::handlePress(F64 controlId, F64 childId)
|
||||||
{
|
{
|
||||||
int id = childId;
|
int id = childId;
|
||||||
if(id<m_mobFactories.size())
|
if(id<m_mobFactories.size())
|
||||||
{
|
{
|
||||||
app.SetXuiServerAction(ProfileManager.GetPrimaryPad(),eXuiServerAction_SpawnMob,(void *)m_mobFactories[id]);
|
app.SetXuiServerAction(ProfileManager.GetPrimaryPad(),eXuiServerAction_SpawnMob,(void *)m_mobFactories[id]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -61,13 +61,13 @@ UIScene_EndPoem::UIScene_EndPoem(int iPad, void *initData, UILayer *parentLayer)
|
||||||
noNoiseString = replaceAll(noNoiseString,L"{*PLAYER*}",playerName);
|
noNoiseString = replaceAll(noNoiseString,L"{*PLAYER*}",playerName);
|
||||||
|
|
||||||
Random random(8124371);
|
Random random(8124371);
|
||||||
int found=(int)noNoiseString.find(L"{*NOISE*}");
|
size_t found=noNoiseString.find(L"{*NOISE*}");
|
||||||
int length;
|
int length;
|
||||||
while (found!=string::npos)
|
while (found!=string::npos)
|
||||||
{
|
{
|
||||||
length = random.nextInt(4) + 3;
|
length = random.nextInt(4) + 3;
|
||||||
m_noiseLengths.push_back(length);
|
m_noiseLengths.push_back(length);
|
||||||
found=(int)noNoiseString.find(L"{*NOISE*}",found+1);
|
found=noNoiseString.find(L"{*NOISE*}",found+1);
|
||||||
}
|
}
|
||||||
|
|
||||||
updateNoise();
|
updateNoise();
|
||||||
|
|
@ -77,7 +77,7 @@ UIScene_EndPoem::UIScene_EndPoem(int iPad, void *initData, UILayer *parentLayer)
|
||||||
m_paragraphs = vector<wstring>();
|
m_paragraphs = vector<wstring>();
|
||||||
int lastIndex = 0;
|
int lastIndex = 0;
|
||||||
for ( int index = 0;
|
for ( int index = 0;
|
||||||
index != wstring::npos;
|
index != wstring::npos;
|
||||||
index = noiseString.find(L"<br /><br />", index+12, 12)
|
index = noiseString.find(L"<br /><br />", index+12, 12)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|
@ -198,7 +198,7 @@ void UIScene_EndPoem::updateNoise()
|
||||||
{
|
{
|
||||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||||
noiseString = noNoiseString;
|
noiseString = noNoiseString;
|
||||||
|
|
||||||
int length = 0;
|
int length = 0;
|
||||||
wchar_t replacements[64];
|
wchar_t replacements[64];
|
||||||
wstring replaceString = L"";
|
wstring replaceString = L"";
|
||||||
|
|
@ -209,8 +209,8 @@ void UIScene_EndPoem::updateNoise()
|
||||||
|
|
||||||
wstring tag = L"{*NOISE*}";
|
wstring tag = L"{*NOISE*}";
|
||||||
|
|
||||||
AUTO_VAR(it, m_noiseLengths.begin());
|
auto it = m_noiseLengths.begin();
|
||||||
int found=(int)noiseString.find(tag);
|
size_t found= noiseString.find(tag);
|
||||||
while (found!=string::npos && it != m_noiseLengths.end() )
|
while (found!=string::npos && it != m_noiseLengths.end() )
|
||||||
{
|
{
|
||||||
length = *it;
|
length = *it;
|
||||||
|
|
@ -229,7 +229,7 @@ void UIScene_EndPoem::updateNoise()
|
||||||
static wstring acceptableLetters = L"!\"#$%&'()*+,-./0123456789:;<=>?@[\\]^_'|}~";
|
static wstring acceptableLetters = L"!\"#$%&'()*+,-./0123456789:;<=>?@[\\]^_'|}~";
|
||||||
randomChar = acceptableLetters[ random->nextInt((int)acceptableLetters.length()) ];
|
randomChar = acceptableLetters[ random->nextInt((int)acceptableLetters.length()) ];
|
||||||
}
|
}
|
||||||
|
|
||||||
wstring randomCharStr = L"";
|
wstring randomCharStr = L"";
|
||||||
randomCharStr.push_back(randomChar);
|
randomCharStr.push_back(randomChar);
|
||||||
if(randomChar == L'<')
|
if(randomChar == L'<')
|
||||||
|
|
@ -275,6 +275,6 @@ void UIScene_EndPoem::updateNoise()
|
||||||
//ib.put(listPos + 256 + random->nextInt(2) + 8 + (darken ? 16 : 0));
|
//ib.put(listPos + 256 + random->nextInt(2) + 8 + (darken ? 16 : 0));
|
||||||
//ib.put(listPos + pos + 32);
|
//ib.put(listPos + pos + 32);
|
||||||
|
|
||||||
found=(int)noiseString.find(tag,found+1);
|
found=noiseString.find(tag,found+1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -32,7 +32,7 @@ UIScene_InventoryMenu::UIScene_InventoryMenu(int iPad, void *_initData, UILayer
|
||||||
m_previousTutorialState = gameMode->getTutorial()->getCurrentState();
|
m_previousTutorialState = gameMode->getTutorial()->getCurrentState();
|
||||||
gameMode->getTutorial()->changeTutorialState(e_Tutorial_State_Inventory_Menu, this);
|
gameMode->getTutorial()->changeTutorialState(e_Tutorial_State_Inventory_Menu, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
InventoryMenu *menu = (InventoryMenu *)initData->player->inventoryMenu;
|
InventoryMenu *menu = (InventoryMenu *)initData->player->inventoryMenu;
|
||||||
|
|
||||||
initData->player->awardStat(GenericStats::openInventory(),GenericStats::param_openInventory());
|
initData->player->awardStat(GenericStats::openInventory(),GenericStats::param_openInventory());
|
||||||
|
|
@ -261,10 +261,8 @@ void UIScene_InventoryMenu::updateEffectsDisplay()
|
||||||
int iValue = 0;
|
int iValue = 0;
|
||||||
IggyDataValue *UpdateValue = new IggyDataValue[activeEffects->size()*2];
|
IggyDataValue *UpdateValue = new IggyDataValue[activeEffects->size()*2];
|
||||||
|
|
||||||
for(AUTO_VAR(it, activeEffects->begin()); it != activeEffects->end(); ++it)
|
for(auto& effect : *activeEffects)
|
||||||
{
|
{
|
||||||
MobEffectInstance *effect = *it;
|
|
||||||
|
|
||||||
if(effect->getDuration() >= m_bEffectTime[effect->getId()])
|
if(effect->getDuration() >= m_bEffectTime[effect->getId()])
|
||||||
{
|
{
|
||||||
wstring effectString = app.GetString( effect->getDescriptionId() );//I18n.get(effect.getDescriptionId()).trim();
|
wstring effectString = app.GetString( effect->getDescriptionId() );//I18n.get(effect.getDescriptionId()).trim();
|
||||||
|
|
|
||||||
|
|
@ -300,7 +300,7 @@ UIScene_LoadOrJoinMenu::UIScene_LoadOrJoinMenu(int iPad, void *initData, UILayer
|
||||||
bool bTexturePackAlreadyListed;
|
bool bTexturePackAlreadyListed;
|
||||||
bool bNeedToGetTPD=false;
|
bool bNeedToGetTPD=false;
|
||||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||||
int texturePacksCount = pMinecraft->skins->getTexturePackCount();
|
int texturePacksCount = pMinecraft->skins->getTexturePackCount();
|
||||||
|
|
||||||
for(unsigned int i = 0; i < app.GetDLCInfoTexturesOffersCount(); ++i)
|
for(unsigned int i = 0; i < app.GetDLCInfoTexturesOffersCount(); ++i)
|
||||||
{
|
{
|
||||||
|
|
@ -407,7 +407,7 @@ void UIScene_LoadOrJoinMenu::updateTooltips()
|
||||||
// update the tooltips
|
// update the tooltips
|
||||||
// if the saves list has focus, then we should show the Delete Save tooltip
|
// if the saves list has focus, then we should show the Delete Save tooltip
|
||||||
// if the games list has focus, then we should the the View Gamercard tooltip
|
// if the games list has focus, then we should the the View Gamercard tooltip
|
||||||
int iRB=-1;
|
int iRB=-1;
|
||||||
int iY = -1;
|
int iY = -1;
|
||||||
int iLB = -1;
|
int iLB = -1;
|
||||||
int iX=-1;
|
int iX=-1;
|
||||||
|
|
@ -418,7 +418,7 @@ void UIScene_LoadOrJoinMenu::updateTooltips()
|
||||||
else if (DoesSavesListHaveFocus())
|
else if (DoesSavesListHaveFocus())
|
||||||
{
|
{
|
||||||
if((m_iDefaultButtonsC > 0) && (m_iSaveListIndex >= m_iDefaultButtonsC))
|
if((m_iDefaultButtonsC > 0) && (m_iSaveListIndex >= m_iDefaultButtonsC))
|
||||||
{
|
{
|
||||||
if(StorageManager.GetSaveDisabled())
|
if(StorageManager.GetSaveDisabled())
|
||||||
{
|
{
|
||||||
iRB=IDS_TOOLTIPS_DELETESAVE;
|
iRB=IDS_TOOLTIPS_DELETESAVE;
|
||||||
|
|
@ -474,7 +474,7 @@ void UIScene_LoadOrJoinMenu::updateTooltips()
|
||||||
// Is there a save from PS3 or PSVita available?
|
// Is there a save from PS3 or PSVita available?
|
||||||
// Sony asked that this be displayed at all times so users are aware of the functionality. We'll display some text when there's no save available
|
// Sony asked that this be displayed at all times so users are aware of the functionality. We'll display some text when there's no save available
|
||||||
//if(app.getRemoteStorage()->saveIsAvailable())
|
//if(app.getRemoteStorage()->saveIsAvailable())
|
||||||
{
|
{
|
||||||
bool bSignedInLive = ProfileManager.IsSignedInLive(m_iPad);
|
bool bSignedInLive = ProfileManager.IsSignedInLive(m_iPad);
|
||||||
if(bSignedInLive)
|
if(bSignedInLive)
|
||||||
{
|
{
|
||||||
|
|
@ -489,7 +489,7 @@ void UIScene_LoadOrJoinMenu::updateTooltips()
|
||||||
ui.SetTooltips( DEFAULT_XUI_MENU_USER, IDS_TOOLTIPS_SELECT, IDS_TOOLTIPS_BACK, iX, iY,-1,-1,iLB,iRB);
|
ui.SetTooltips( DEFAULT_XUI_MENU_USER, IDS_TOOLTIPS_SELECT, IDS_TOOLTIPS_BACK, iX, iY,-1,-1,iLB,iRB);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
void UIScene_LoadOrJoinMenu::Initialise()
|
void UIScene_LoadOrJoinMenu::Initialise()
|
||||||
{
|
{
|
||||||
m_iSaveListIndex = 0;
|
m_iSaveListIndex = 0;
|
||||||
|
|
@ -577,7 +577,7 @@ void UIScene_LoadOrJoinMenu::handleGainFocus(bool navBack)
|
||||||
{
|
{
|
||||||
app.SetLiveLinkRequired( true );
|
app.SetLiveLinkRequired( true );
|
||||||
|
|
||||||
m_bMultiplayerAllowed = ProfileManager.IsSignedInLive( m_iPad ) && ProfileManager.AllowedToPlayMultiplayer(m_iPad);
|
m_bMultiplayerAllowed = ProfileManager.IsSignedInLive( m_iPad ) && ProfileManager.AllowedToPlayMultiplayer(m_iPad);
|
||||||
|
|
||||||
// re-enable button presses
|
// re-enable button presses
|
||||||
m_bIgnoreInput=false;
|
m_bIgnoreInput=false;
|
||||||
|
|
@ -661,7 +661,7 @@ void UIScene_LoadOrJoinMenu::tick()
|
||||||
#ifdef SONY_REMOTE_STORAGE_DOWNLOAD
|
#ifdef SONY_REMOTE_STORAGE_DOWNLOAD
|
||||||
// if the loadOrJoin menu has focus again, we can clear the saveTransfer flag now. Added so we can delay the ehternet disconnect till it's cleaned up
|
// if the loadOrJoin menu has focus again, we can clear the saveTransfer flag now. Added so we can delay the ehternet disconnect till it's cleaned up
|
||||||
if(m_eSaveTransferState == eSaveTransfer_Idle)
|
if(m_eSaveTransferState == eSaveTransfer_Idle)
|
||||||
m_bSaveTransferRunning = false;
|
m_bSaveTransferRunning = false;
|
||||||
#endif
|
#endif
|
||||||
#if defined(_XBOX_ONE) || defined(__ORBIS__)
|
#if defined(_XBOX_ONE) || defined(__ORBIS__)
|
||||||
if(m_bUpdateSaveSize)
|
if(m_bUpdateSaveSize)
|
||||||
|
|
@ -978,7 +978,7 @@ void UIScene_LoadOrJoinMenu::GetSaveInfo()
|
||||||
m_pSaveDetails=StorageManager.ReturnSavesInfo();
|
m_pSaveDetails=StorageManager.ReturnSavesInfo();
|
||||||
if(m_pSaveDetails==NULL)
|
if(m_pSaveDetails==NULL)
|
||||||
{
|
{
|
||||||
C4JStorage::ESaveGameState eSGIStatus= StorageManager.GetSavesInfo(m_iPad,NULL,this,"save");
|
C4JStorage::ESaveGameState eSGIStatus= StorageManager.GetSavesInfo(m_iPad,NULL,this,"save");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -1027,7 +1027,7 @@ void UIScene_LoadOrJoinMenu::GetSaveInfo()
|
||||||
m_pSaveDetails=StorageManager.ReturnSavesInfo();
|
m_pSaveDetails=StorageManager.ReturnSavesInfo();
|
||||||
if(m_pSaveDetails==NULL)
|
if(m_pSaveDetails==NULL)
|
||||||
{
|
{
|
||||||
C4JStorage::ESaveGameState eSGIStatus= StorageManager.GetSavesInfo(m_iPad,NULL,this,"save");
|
C4JStorage::ESaveGameState eSGIStatus= StorageManager.GetSavesInfo(m_iPad,NULL,this,"save");
|
||||||
}
|
}
|
||||||
|
|
||||||
#if TO_BE_IMPLEMENTED
|
#if TO_BE_IMPLEMENTED
|
||||||
|
|
@ -1054,10 +1054,8 @@ void UIScene_LoadOrJoinMenu::AddDefaultButtons()
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
for(AUTO_VAR(it, app.getLevelGenerators()->begin()); it != app.getLevelGenerators()->end(); ++it)
|
for ( LevelGenerationOptions *levelGen : *app.getLevelGenerators() )
|
||||||
{
|
{
|
||||||
LevelGenerationOptions *levelGen = *it;
|
|
||||||
|
|
||||||
// retrieve the save icon from the texture pack, if there is one
|
// retrieve the save icon from the texture pack, if there is one
|
||||||
unsigned int uiTexturePackID=levelGen->getRequiredTexturePackId();
|
unsigned int uiTexturePackID=levelGen->getRequiredTexturePackId();
|
||||||
|
|
||||||
|
|
@ -1071,7 +1069,7 @@ void UIScene_LoadOrJoinMenu::AddDefaultButtons()
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4J-JEV: For debug. Ignore worlds with no name.
|
// 4J-JEV: For debug. Ignore worlds with no name.
|
||||||
LPCWSTR wstr = levelGen->getWorldName();
|
LPCWSTR wstr = levelGen->getWorldName();
|
||||||
m_buttonListSaves.addItem( wstr );
|
m_buttonListSaves.addItem( wstr );
|
||||||
|
|
@ -1124,7 +1122,7 @@ void UIScene_LoadOrJoinMenu::handleInput(int iPad, int key, bool repeat, bool pr
|
||||||
case ACTION_MENU_X:
|
case ACTION_MENU_X:
|
||||||
#if TO_BE_IMPLEMENTED
|
#if TO_BE_IMPLEMENTED
|
||||||
// Change device
|
// Change device
|
||||||
// Fix for #12531 - TCR 001: BAS Game Stability: When a player selects to change a storage
|
// Fix for #12531 - TCR 001: BAS Game Stability: When a player selects to change a storage
|
||||||
// device, and repeatedly backs out of the SD screen, disconnects from LIVE, and then selects a SD, the title crashes.
|
// device, and repeatedly backs out of the SD screen, disconnects from LIVE, and then selects a SD, the title crashes.
|
||||||
m_bIgnoreInput=true;
|
m_bIgnoreInput=true;
|
||||||
StorageManager.SetSaveDevice(&CScene_MultiGameJoinLoad::DeviceSelectReturned,this,true);
|
StorageManager.SetSaveDevice(&CScene_MultiGameJoinLoad::DeviceSelectReturned,this,true);
|
||||||
|
|
@ -1142,7 +1140,7 @@ void UIScene_LoadOrJoinMenu::handleInput(int iPad, int key, bool repeat, bool pr
|
||||||
{
|
{
|
||||||
bool bSignedInLive = ProfileManager.IsSignedInLive(iPad);
|
bool bSignedInLive = ProfileManager.IsSignedInLive(iPad);
|
||||||
if(bSignedInLive)
|
if(bSignedInLive)
|
||||||
{
|
{
|
||||||
LaunchSaveTransfer();
|
LaunchSaveTransfer();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1334,7 +1332,7 @@ int UIScene_LoadOrJoinMenu::KeyboardCompleteWorldNameCallback(LPVOID lpParam,boo
|
||||||
UIScene_LoadOrJoinMenu *pClass=(UIScene_LoadOrJoinMenu *)lpParam;
|
UIScene_LoadOrJoinMenu *pClass=(UIScene_LoadOrJoinMenu *)lpParam;
|
||||||
pClass->m_bIgnoreInput=false;
|
pClass->m_bIgnoreInput=false;
|
||||||
if (bRes)
|
if (bRes)
|
||||||
{
|
{
|
||||||
uint16_t ui16Text[128];
|
uint16_t ui16Text[128];
|
||||||
ZeroMemory(ui16Text, 128 * sizeof(uint16_t) );
|
ZeroMemory(ui16Text, 128 * sizeof(uint16_t) );
|
||||||
InputManager.GetText(ui16Text);
|
InputManager.GetText(ui16Text);
|
||||||
|
|
@ -1347,13 +1345,13 @@ int UIScene_LoadOrJoinMenu::KeyboardCompleteWorldNameCallback(LPVOID lpParam,boo
|
||||||
StorageManager.RenameSaveData(pClass->m_iSaveListIndex - pClass->m_iDefaultButtonsC, ui16Text,&UIScene_LoadOrJoinMenu::RenameSaveDataReturned,pClass);
|
StorageManager.RenameSaveData(pClass->m_iSaveListIndex - pClass->m_iDefaultButtonsC, ui16Text,&UIScene_LoadOrJoinMenu::RenameSaveDataReturned,pClass);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pClass->m_bIgnoreInput=false;
|
pClass->m_bIgnoreInput=false;
|
||||||
pClass->updateTooltips();
|
pClass->updateTooltips();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pClass->m_bIgnoreInput=false;
|
pClass->m_bIgnoreInput=false;
|
||||||
pClass->updateTooltips();
|
pClass->updateTooltips();
|
||||||
|
|
@ -1367,13 +1365,13 @@ void UIScene_LoadOrJoinMenu::handleInitFocus(F64 controlId, F64 childId)
|
||||||
app.DebugPrintf(app.USER_SR, "UIScene_LoadOrJoinMenu::handleInitFocus - %d , %d\n", (int)controlId, (int)childId);
|
app.DebugPrintf(app.USER_SR, "UIScene_LoadOrJoinMenu::handleInitFocus - %d , %d\n", (int)controlId, (int)childId);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UIScene_LoadOrJoinMenu::handleFocusChange(F64 controlId, F64 childId)
|
void UIScene_LoadOrJoinMenu::handleFocusChange(F64 controlId, F64 childId)
|
||||||
{
|
{
|
||||||
app.DebugPrintf(app.USER_SR, "UIScene_LoadOrJoinMenu::handleFocusChange - %d , %d\n", (int)controlId, (int)childId);
|
app.DebugPrintf(app.USER_SR, "UIScene_LoadOrJoinMenu::handleFocusChange - %d , %d\n", (int)controlId, (int)childId);
|
||||||
|
|
||||||
switch((int)controlId)
|
switch((int)controlId)
|
||||||
{
|
{
|
||||||
case eControl_GamesList:
|
case eControl_GamesList:
|
||||||
m_iGameListIndex = childId;
|
m_iGameListIndex = childId;
|
||||||
m_buttonListGames.updateChildFocus( (int) childId );
|
m_buttonListGames.updateChildFocus( (int) childId );
|
||||||
break;
|
break;
|
||||||
|
|
@ -1409,7 +1407,7 @@ void UIScene_LoadOrJoinMenu::handlePress(F64 controlId, F64 childId)
|
||||||
ui.PlayUISFX(eSFX_Press);
|
ui.PlayUISFX(eSFX_Press);
|
||||||
|
|
||||||
if((int)childId == JOIN_LOAD_CREATE_BUTTON_INDEX)
|
if((int)childId == JOIN_LOAD_CREATE_BUTTON_INDEX)
|
||||||
{
|
{
|
||||||
app.SetTutorialMode( false );
|
app.SetTutorialMode( false );
|
||||||
|
|
||||||
m_controlJoinTimer.setVisible( false );
|
m_controlJoinTimer.setVisible( false );
|
||||||
|
|
@ -1461,7 +1459,7 @@ void UIScene_LoadOrJoinMenu::handlePress(F64 controlId, F64 childId)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
app.SetTutorialMode( false );
|
app.SetTutorialMode( false );
|
||||||
|
|
||||||
if(app.DebugSettingsOn() && app.GetLoadSavesFromFolderEnabled())
|
if(app.DebugSettingsOn() && app.GetLoadSavesFromFolderEnabled())
|
||||||
|
|
@ -1503,7 +1501,7 @@ void UIScene_LoadOrJoinMenu::handlePress(F64 controlId, F64 childId)
|
||||||
case eControl_GamesList:
|
case eControl_GamesList:
|
||||||
{
|
{
|
||||||
m_bIgnoreInput=true;
|
m_bIgnoreInput=true;
|
||||||
|
|
||||||
m_eAction = eAction_JoinGame;
|
m_eAction = eAction_JoinGame;
|
||||||
|
|
||||||
//CD - Added for audio
|
//CD - Added for audio
|
||||||
|
|
@ -1538,7 +1536,7 @@ void UIScene_LoadOrJoinMenu::CheckAndJoinGame(int gameIndex)
|
||||||
|
|
||||||
bool bPlayStationPlus=true;
|
bool bPlayStationPlus=true;
|
||||||
int iPadWithNoPlaystationPlus=0;
|
int iPadWithNoPlaystationPlus=0;
|
||||||
bool isSignedInLive = true;
|
bool isSignedInLive = true;
|
||||||
int iPadNotSignedInLive = -1;
|
int iPadNotSignedInLive = -1;
|
||||||
for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i)
|
for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i)
|
||||||
{
|
{
|
||||||
|
|
@ -1631,7 +1629,7 @@ void UIScene_LoadOrJoinMenu::CheckAndJoinGame(int gameIndex)
|
||||||
SceNpCommerceDialogParam param;
|
SceNpCommerceDialogParam param;
|
||||||
sceNpCommerceDialogParamInitialize(¶m);
|
sceNpCommerceDialogParamInitialize(¶m);
|
||||||
param.mode=SCE_NP_COMMERCE_DIALOG_MODE_PLUS;
|
param.mode=SCE_NP_COMMERCE_DIALOG_MODE_PLUS;
|
||||||
param.features = SCE_NP_PLUS_FEATURE_REALTIME_MULTIPLAY;
|
param.features = SCE_NP_PLUS_FEATURE_REALTIME_MULTIPLAY;
|
||||||
param.userId = ProfileManager.getUserID(iPadWithNoPlaystationPlus);
|
param.userId = ProfileManager.getUserID(iPadWithNoPlaystationPlus);
|
||||||
|
|
||||||
iResult=sceNpCommerceDialogOpen(¶m);
|
iResult=sceNpCommerceDialogOpen(¶m);
|
||||||
|
|
@ -1714,7 +1712,7 @@ void UIScene_LoadOrJoinMenu::CheckAndJoinGame(int gameIndex)
|
||||||
}
|
}
|
||||||
|
|
||||||
void UIScene_LoadOrJoinMenu::LoadLevelGen(LevelGenerationOptions *levelGen)
|
void UIScene_LoadOrJoinMenu::LoadLevelGen(LevelGenerationOptions *levelGen)
|
||||||
{
|
{
|
||||||
// Load data from disc
|
// Load data from disc
|
||||||
//File saveFile( L"Tutorial\\Tutorial" );
|
//File saveFile( L"Tutorial\\Tutorial" );
|
||||||
//LoadSaveFromDisk(&saveFile);
|
//LoadSaveFromDisk(&saveFile);
|
||||||
|
|
@ -1812,7 +1810,7 @@ void UIScene_LoadOrJoinMenu::UpdateGamesList()
|
||||||
|
|
||||||
// if the saves list has focus, then we should show the Delete Save tooltip
|
// if the saves list has focus, then we should show the Delete Save tooltip
|
||||||
// if the games list has focus, then we should show the View Gamercard tooltip
|
// if the games list has focus, then we should show the View Gamercard tooltip
|
||||||
int iRB=-1;
|
int iRB=-1;
|
||||||
int iY = -1;
|
int iY = -1;
|
||||||
int iX=-1;
|
int iX=-1;
|
||||||
|
|
||||||
|
|
@ -1859,10 +1857,8 @@ void UIScene_LoadOrJoinMenu::UpdateGamesList()
|
||||||
unsigned int sessionIndex = 0;
|
unsigned int sessionIndex = 0;
|
||||||
m_buttonListGames.setCurrentSelection(0);
|
m_buttonListGames.setCurrentSelection(0);
|
||||||
|
|
||||||
for( AUTO_VAR(it, m_currentSessions->begin()); it < m_currentSessions->end(); ++it)
|
for( FriendSessionInfo *sessionInfo : *m_currentSessions )
|
||||||
{
|
{
|
||||||
FriendSessionInfo *sessionInfo = *it;
|
|
||||||
|
|
||||||
wchar_t textureName[64] = L"\0";
|
wchar_t textureName[64] = L"\0";
|
||||||
|
|
||||||
// Is this a default game or a texture pack game?
|
// Is this a default game or a texture pack game?
|
||||||
|
|
@ -2036,7 +2032,7 @@ void UIScene_LoadOrJoinMenu::handleTimerComplete(int id)
|
||||||
|
|
||||||
if(iImageDataBytes!=0)
|
if(iImageDataBytes!=0)
|
||||||
{
|
{
|
||||||
// set the image
|
// set the image
|
||||||
registerSubstitutionTexture(textureName,pbImageData,iImageDataBytes,true);
|
registerSubstitutionTexture(textureName,pbImageData,iImageDataBytes,true);
|
||||||
m_iConfigA[i]=-1;
|
m_iConfigA[i]=-1;
|
||||||
}
|
}
|
||||||
|
|
@ -2049,7 +2045,7 @@ void UIScene_LoadOrJoinMenu::handleTimerComplete(int id)
|
||||||
bool bAllDone=true;
|
bool bAllDone=true;
|
||||||
for(int i=0;i<m_iTexturePacksNotInstalled;i++)
|
for(int i=0;i<m_iTexturePacksNotInstalled;i++)
|
||||||
{
|
{
|
||||||
if(m_iConfigA[i]!=-1)
|
if(m_iConfigA[i]!=-1)
|
||||||
{
|
{
|
||||||
bAllDone = false;
|
bAllDone = false;
|
||||||
}
|
}
|
||||||
|
|
@ -2064,13 +2060,13 @@ void UIScene_LoadOrJoinMenu::handleTimerComplete(int id)
|
||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void UIScene_LoadOrJoinMenu::LoadSaveFromDisk(File *saveFile, ESavePlatform savePlatform /*= SAVE_FILE_PLATFORM_LOCAL*/)
|
void UIScene_LoadOrJoinMenu::LoadSaveFromDisk(File *saveFile, ESavePlatform savePlatform /*= SAVE_FILE_PLATFORM_LOCAL*/)
|
||||||
{
|
{
|
||||||
// we'll only be coming in here when the tutorial is loaded now
|
// we'll only be coming in here when the tutorial is loaded now
|
||||||
|
|
||||||
StorageManager.ResetSaveData();
|
StorageManager.ResetSaveData();
|
||||||
|
|
@ -2128,7 +2124,7 @@ void UIScene_LoadOrJoinMenu::LoadSaveFromDisk(File *saveFile, ESavePlatform save
|
||||||
|
|
||||||
#ifdef SONY_REMOTE_STORAGE_DOWNLOAD
|
#ifdef SONY_REMOTE_STORAGE_DOWNLOAD
|
||||||
void UIScene_LoadOrJoinMenu::LoadSaveFromCloud()
|
void UIScene_LoadOrJoinMenu::LoadSaveFromCloud()
|
||||||
{
|
{
|
||||||
|
|
||||||
wchar_t wFileName[128];
|
wchar_t wFileName[128];
|
||||||
mbstowcs(wFileName, app.getRemoteStorage()->getLocalFilename(), strlen(app.getRemoteStorage()->getLocalFilename())+1); // plus null
|
mbstowcs(wFileName, app.getRemoteStorage()->getLocalFilename(), strlen(app.getRemoteStorage()->getLocalFilename())+1); // plus null
|
||||||
|
|
@ -2201,7 +2197,7 @@ int UIScene_LoadOrJoinMenu::DeleteSaveDialogReturned(void *pParam,int iPad,C4JSt
|
||||||
// Check that we have a valid save selected (can get a bad index if the save list has been refreshed)
|
// Check that we have a valid save selected (can get a bad index if the save list has been refreshed)
|
||||||
bool validSelection= pClass->m_iDefaultButtonsC != 0 && pClass->m_iSaveListIndex >= pClass->m_iDefaultButtonsC;
|
bool validSelection= pClass->m_iDefaultButtonsC != 0 && pClass->m_iSaveListIndex >= pClass->m_iDefaultButtonsC;
|
||||||
|
|
||||||
if(result==C4JStorage::EMessage_ResultDecline && validSelection)
|
if(result==C4JStorage::EMessage_ResultDecline && validSelection)
|
||||||
{
|
{
|
||||||
if(app.DebugSettingsOn() && app.GetLoadSavesFromFolderEnabled())
|
if(app.DebugSettingsOn() && app.GetLoadSavesFromFolderEnabled())
|
||||||
{
|
{
|
||||||
|
|
@ -2231,7 +2227,7 @@ int UIScene_LoadOrJoinMenu::DeleteSaveDataReturned(LPVOID lpParam,bool bRes)
|
||||||
if(bRes)
|
if(bRes)
|
||||||
{
|
{
|
||||||
// wipe the list and repopulate it
|
// wipe the list and repopulate it
|
||||||
pClass->m_iState=e_SavesRepopulateAfterDelete;
|
pClass->m_iState=e_SavesRepopulateAfterDelete;
|
||||||
}
|
}
|
||||||
else pClass->m_bIgnoreInput=false;
|
else pClass->m_bIgnoreInput=false;
|
||||||
|
|
||||||
|
|
@ -2363,7 +2359,7 @@ int UIScene_LoadOrJoinMenu::MustSignInTexturePack(void *pParam,int iPad,C4JStora
|
||||||
{
|
{
|
||||||
UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu*)pParam;
|
UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu*)pParam;
|
||||||
|
|
||||||
if(result==C4JStorage::EMessage_ResultAccept)
|
if(result==C4JStorage::EMessage_ResultAccept)
|
||||||
{
|
{
|
||||||
SQRNetworkManager_Vita::AttemptPSNSignIn(&UIScene_LoadOrJoinMenu::MustSignInReturnedTexturePack, pClass);
|
SQRNetworkManager_Vita::AttemptPSNSignIn(&UIScene_LoadOrJoinMenu::MustSignInReturnedTexturePack, pClass);
|
||||||
}
|
}
|
||||||
|
|
@ -2391,7 +2387,7 @@ int UIScene_LoadOrJoinMenu::MustSignInReturnedTexturePack(void *pParam,bool bCon
|
||||||
|
|
||||||
if(bContinue==true)
|
if(bContinue==true)
|
||||||
{
|
{
|
||||||
SONYDLC *pSONYDLCInfo=app.GetSONYDLCInfo(pClass->m_initData->selectedSession->data.texturePackParentId);
|
SONYDLC *pSONYDLCInfo=app.GetSONYDLCInfo(pClass->m_initData->selectedSession->data.texturePackParentId);
|
||||||
if(pSONYDLCInfo!=NULL)
|
if(pSONYDLCInfo!=NULL)
|
||||||
{
|
{
|
||||||
char chName[42];
|
char chName[42];
|
||||||
|
|
@ -2420,7 +2416,7 @@ int UIScene_LoadOrJoinMenu::MustSignInReturnedTexturePack(void *pParam,bool bCon
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
app.Checkout(chSkuID);
|
app.Checkout(chSkuID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2436,7 +2432,7 @@ int UIScene_LoadOrJoinMenu::TexturePackDialogReturned(void *pParam,int iPad,C4JS
|
||||||
UIScene_LoadOrJoinMenu *pClass = (UIScene_LoadOrJoinMenu *)pParam;
|
UIScene_LoadOrJoinMenu *pClass = (UIScene_LoadOrJoinMenu *)pParam;
|
||||||
|
|
||||||
// Exit with or without saving
|
// Exit with or without saving
|
||||||
if(result==C4JStorage::EMessage_ResultAccept)
|
if(result==C4JStorage::EMessage_ResultAccept)
|
||||||
{
|
{
|
||||||
// we need to enable background downloading for the DLC
|
// we need to enable background downloading for the DLC
|
||||||
XBackgroundDownloadSetMode(XBACKGROUND_DOWNLOAD_MODE_ALWAYS_ALLOW);
|
XBackgroundDownloadSetMode(XBACKGROUND_DOWNLOAD_MODE_ALWAYS_ALLOW);
|
||||||
|
|
@ -2454,7 +2450,7 @@ int UIScene_LoadOrJoinMenu::TexturePackDialogReturned(void *pParam,int iPad,C4JS
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
SONYDLC *pSONYDLCInfo=app.GetSONYDLCInfo(pClass->m_initData->selectedSession->data.texturePackParentId);
|
SONYDLC *pSONYDLCInfo=app.GetSONYDLCInfo(pClass->m_initData->selectedSession->data.texturePackParentId);
|
||||||
if(pSONYDLCInfo!=NULL)
|
if(pSONYDLCInfo!=NULL)
|
||||||
{
|
{
|
||||||
char chName[42];
|
char chName[42];
|
||||||
|
|
@ -2483,16 +2479,16 @@ int UIScene_LoadOrJoinMenu::TexturePackDialogReturned(void *pParam,int iPad,C4JS
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
app.Checkout(chSkuID);
|
app.Checkout(chSkuID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if defined _XBOX_ONE
|
#if defined _XBOX_ONE
|
||||||
if(ProfileManager.IsSignedIn(iPad))
|
if(ProfileManager.IsSignedIn(iPad))
|
||||||
{
|
{
|
||||||
if (ProfileManager.IsSignedInLive(iPad))
|
if (ProfileManager.IsSignedInLive(iPad))
|
||||||
{
|
{
|
||||||
wstring ProductId;
|
wstring ProductId;
|
||||||
|
|
@ -2501,13 +2497,13 @@ int UIScene_LoadOrJoinMenu::TexturePackDialogReturned(void *pParam,int iPad,C4JS
|
||||||
StorageManager.InstallOffer(1,(WCHAR *)ProductId.c_str(),NULL,NULL);
|
StorageManager.InstallOffer(1,(WCHAR *)ProductId.c_str(),NULL,NULL);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// 4J-JEV: Fix for XB1: #165863 - XR-074: Compliance: With no active network connection user is unable to convert from Trial to Full texture pack and is not messaged why.
|
// 4J-JEV: Fix for XB1: #165863 - XR-074: Compliance: With no active network connection user is unable to convert from Trial to Full texture pack and is not messaged why.
|
||||||
UINT uiIDA[1] = { IDS_CONFIRM_OK };
|
UINT uiIDA[1] = { IDS_CONFIRM_OK };
|
||||||
ui.RequestErrorMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_XBOXLIVE_NOTIFICATION, uiIDA, 1, iPad);
|
ui.RequestErrorMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_XBOXLIVE_NOTIFICATION, uiIDA, 1, iPad);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
pClass->m_bIgnoreInput=false;
|
pClass->m_bIgnoreInput=false;
|
||||||
|
|
@ -2519,7 +2515,7 @@ int UIScene_LoadOrJoinMenu::MustSignInReturnedPSN(void *pParam,int iPad,C4JStora
|
||||||
{
|
{
|
||||||
UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu*)pParam;
|
UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu*)pParam;
|
||||||
|
|
||||||
if(result==C4JStorage::EMessage_ResultAccept)
|
if(result==C4JStorage::EMessage_ResultAccept)
|
||||||
{
|
{
|
||||||
#if defined(__PS3__)
|
#if defined(__PS3__)
|
||||||
SQRNetworkManager_PS3::AttemptPSNSignIn(&UIScene_LoadOrJoinMenu::PSN_SignInReturned, pClass);
|
SQRNetworkManager_PS3::AttemptPSNSignIn(&UIScene_LoadOrJoinMenu::PSN_SignInReturned, pClass);
|
||||||
|
|
@ -2679,7 +2675,7 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc( LPVOID lpParameter
|
||||||
Compression::UseDefaultThreadStorage();
|
Compression::UseDefaultThreadStorage();
|
||||||
UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu *) lpParameter;
|
UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu *) lpParameter;
|
||||||
pClass->m_saveTransferDownloadCancelled = false;
|
pClass->m_saveTransferDownloadCancelled = false;
|
||||||
m_bSaveTransferRunning = true;
|
m_bSaveTransferRunning = true;
|
||||||
bool bAbortCalled = false;
|
bool bAbortCalled = false;
|
||||||
Minecraft *pMinecraft=Minecraft::GetInstance();
|
Minecraft *pMinecraft=Minecraft::GetInstance();
|
||||||
bool bSaveFileCreated = false;
|
bool bSaveFileCreated = false;
|
||||||
|
|
@ -2728,7 +2724,7 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc( LPVOID lpParameter
|
||||||
ui.RequestAlertMessage(IDS_TOOLTIPS_SAVETRANSFER_DOWNLOAD, IDS_SAVE_TRANSFER_WRONG_VERSION, uiIDA, 1, ProfileManager.GetPrimaryPad(),RemoteSaveNotFoundCallback,pClass);
|
ui.RequestAlertMessage(IDS_TOOLTIPS_SAVETRANSFER_DOWNLOAD, IDS_SAVE_TRANSFER_WRONG_VERSION, uiIDA, 1, ProfileManager.GetPrimaryPad(),RemoteSaveNotFoundCallback,pClass);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// no save available, inform the user about the functionality
|
// no save available, inform the user about the functionality
|
||||||
UINT uiIDA[1];
|
UINT uiIDA[1];
|
||||||
|
|
@ -2752,7 +2748,7 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc( LPVOID lpParameter
|
||||||
DWORD dwDataSizeSaveImage=0;
|
DWORD dwDataSizeSaveImage=0;
|
||||||
|
|
||||||
StorageManager.GetDefaultSaveImage(&pbDataSaveImage, &dwDataSizeSaveImage); // Get the default save thumbnail (as set by SetDefaultImages) for use on saving games t
|
StorageManager.GetDefaultSaveImage(&pbDataSaveImage, &dwDataSizeSaveImage); // Get the default save thumbnail (as set by SetDefaultImages) for use on saving games t
|
||||||
StorageManager.GetDefaultSaveThumbnail(&pbThumbnailData,&dwThumbnailDataSize); // Get the default save image (as set by SetDefaultImages) for use on saving games that
|
StorageManager.GetDefaultSaveThumbnail(&pbThumbnailData,&dwThumbnailDataSize); // Get the default save image (as set by SetDefaultImages) for use on saving games that
|
||||||
|
|
||||||
BYTE bTextMetadata[88];
|
BYTE bTextMetadata[88];
|
||||||
ZeroMemory(bTextMetadata,88);
|
ZeroMemory(bTextMetadata,88);
|
||||||
|
|
@ -2784,7 +2780,7 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc( LPVOID lpParameter
|
||||||
{
|
{
|
||||||
// we can't cancel here, we need the saves info so we can delete the file
|
// we can't cancel here, we need the saves info so we can delete the file
|
||||||
if(pClass->m_saveTransferDownloadCancelled)
|
if(pClass->m_saveTransferDownloadCancelled)
|
||||||
{
|
{
|
||||||
WCHAR wcTemp[256];
|
WCHAR wcTemp[256];
|
||||||
swprintf(wcTemp,256, app.GetString(IDS_CANCEL)); // MGH - should change this string to "cancelling download"
|
swprintf(wcTemp,256, app.GetString(IDS_CANCEL)); // MGH - should change this string to "cancelling download"
|
||||||
m_wstrStageText=wcTemp;
|
m_wstrStageText=wcTemp;
|
||||||
|
|
@ -2799,7 +2795,7 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc( LPVOID lpParameter
|
||||||
break;
|
break;
|
||||||
case eSaveTransfer_GettingSavesInfo:
|
case eSaveTransfer_GettingSavesInfo:
|
||||||
if(pClass->m_saveTransferDownloadCancelled)
|
if(pClass->m_saveTransferDownloadCancelled)
|
||||||
{
|
{
|
||||||
WCHAR wcTemp[256];
|
WCHAR wcTemp[256];
|
||||||
swprintf(wcTemp,256, app.GetString(IDS_CANCEL)); // MGH - should change this string to "cancelling download"
|
swprintf(wcTemp,256, app.GetString(IDS_CANCEL)); // MGH - should change this string to "cancelling download"
|
||||||
m_wstrStageText=wcTemp;
|
m_wstrStageText=wcTemp;
|
||||||
|
|
@ -2916,7 +2912,7 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc( LPVOID lpParameter
|
||||||
DWORD dwDataSizeSaveImage=0;
|
DWORD dwDataSizeSaveImage=0;
|
||||||
|
|
||||||
StorageManager.GetDefaultSaveImage(&pbDataSaveImage, &dwDataSizeSaveImage); // Get the default save thumbnail (as set by SetDefaultImages) for use on saving games t
|
StorageManager.GetDefaultSaveImage(&pbDataSaveImage, &dwDataSizeSaveImage); // Get the default save thumbnail (as set by SetDefaultImages) for use on saving games t
|
||||||
StorageManager.GetDefaultSaveThumbnail(&pbThumbnailData,&dwThumbnailDataSize); // Get the default save image (as set by SetDefaultImages) for use on saving games that
|
StorageManager.GetDefaultSaveThumbnail(&pbThumbnailData,&dwThumbnailDataSize); // Get the default save image (as set by SetDefaultImages) for use on saving games that
|
||||||
|
|
||||||
BYTE bTextMetadata[88];
|
BYTE bTextMetadata[88];
|
||||||
ZeroMemory(bTextMetadata,88);
|
ZeroMemory(bTextMetadata,88);
|
||||||
|
|
@ -2929,12 +2925,12 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc( LPVOID lpParameter
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef SPLIT_SAVES
|
#ifdef SPLIT_SAVES
|
||||||
ConsoleSaveFileOriginal oldFormatSave( wSaveName, ba.data, ba.length, false, app.getRemoteStorage()->getSavePlatform() );
|
ConsoleSaveFileOriginal oldFormatSave( wSaveName, ba.data, ba.length, false, app.getRemoteStorage()->getSavePlatform() );
|
||||||
pSave = new ConsoleSaveFileSplit( &oldFormatSave, false, pMinecraft->progressRenderer );
|
pSave = new ConsoleSaveFileSplit( &oldFormatSave, false, pMinecraft->progressRenderer );
|
||||||
|
|
||||||
pMinecraft->progressRenderer->progressStage(IDS_SAVETRANSFER_STAGE_SAVING);
|
pMinecraft->progressRenderer->progressStage(IDS_SAVETRANSFER_STAGE_SAVING);
|
||||||
pSave->Flush(false,false);
|
pSave->Flush(false,false);
|
||||||
pClass->m_eSaveTransferState = eSaveTransfer_Saving;
|
pClass->m_eSaveTransferState = eSaveTransfer_Saving;
|
||||||
#else
|
#else
|
||||||
pSave = new ConsoleSaveFileOriginal( wSaveName, ba.data, ba.length, false, app.getRemoteStorage()->getSavePlatform() );
|
pSave = new ConsoleSaveFileOriginal( wSaveName, ba.data, ba.length, false, app.getRemoteStorage()->getSavePlatform() );
|
||||||
|
|
@ -2970,7 +2966,7 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc( LPVOID lpParameter
|
||||||
|
|
||||||
delete pSave;
|
delete pSave;
|
||||||
|
|
||||||
|
|
||||||
pMinecraft->progressRenderer->progressStage(IDS_PROGRESS_SAVING_TO_DISC);
|
pMinecraft->progressRenderer->progressStage(IDS_PROGRESS_SAVING_TO_DISC);
|
||||||
pClass->m_eSaveTransferState = eSaveTransfer_Succeeded;
|
pClass->m_eSaveTransferState = eSaveTransfer_Succeeded;
|
||||||
}
|
}
|
||||||
|
|
@ -2984,7 +2980,7 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc( LPVOID lpParameter
|
||||||
UINT uiIDA[1];
|
UINT uiIDA[1];
|
||||||
uiIDA[0]=IDS_CONFIRM_OK;
|
uiIDA[0]=IDS_CONFIRM_OK;
|
||||||
app.getRemoteStorage()->waitForStorageManagerIdle(); // wait for everything to complete before we hand control back to the player
|
app.getRemoteStorage()->waitForStorageManagerIdle(); // wait for everything to complete before we hand control back to the player
|
||||||
ui.RequestErrorMessage( IDS_TOOLTIPS_SAVETRANSFER_DOWNLOAD, IDS_SAVE_TRANSFER_DOWNLOADCOMPLETE, uiIDA,1,ProfileManager.GetPrimaryPad(),CrossSaveFinishedCallback,pClass);
|
ui.RequestErrorMessage( IDS_TOOLTIPS_SAVETRANSFER_DOWNLOAD, IDS_SAVE_TRANSFER_DOWNLOADCOMPLETE, uiIDA,1,ProfileManager.GetPrimaryPad(),CrossSaveFinishedCallback,pClass);
|
||||||
pClass->m_eSaveTransferState = eSaveTransfer_Finished;
|
pClass->m_eSaveTransferState = eSaveTransfer_Finished;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -2999,7 +2995,7 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc( LPVOID lpParameter
|
||||||
if(bSaveFileCreated)
|
if(bSaveFileCreated)
|
||||||
{
|
{
|
||||||
if(pClass->m_saveTransferDownloadCancelled)
|
if(pClass->m_saveTransferDownloadCancelled)
|
||||||
{
|
{
|
||||||
WCHAR wcTemp[256];
|
WCHAR wcTemp[256];
|
||||||
swprintf(wcTemp,256, app.GetString(IDS_CANCEL)); // MGH - should change this string to "cancelling download"
|
swprintf(wcTemp,256, app.GetString(IDS_CANCEL)); // MGH - should change this string to "cancelling download"
|
||||||
m_wstrStageText=wcTemp;
|
m_wstrStageText=wcTemp;
|
||||||
|
|
@ -3077,7 +3073,7 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc( LPVOID lpParameter
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
ui.RequestErrorMessage( IDS_TOOLTIPS_SAVETRANSFER_DOWNLOAD, errorMessage, uiIDA,1,ProfileManager.GetPrimaryPad(),CrossSaveFinishedCallback,pClass);
|
ui.RequestErrorMessage( IDS_TOOLTIPS_SAVETRANSFER_DOWNLOAD, errorMessage, uiIDA,1,ProfileManager.GetPrimaryPad(),CrossSaveFinishedCallback,pClass);
|
||||||
pClass->m_eSaveTransferState = eSaveTransfer_Finished;
|
pClass->m_eSaveTransferState = eSaveTransfer_Finished;
|
||||||
}
|
}
|
||||||
if(bSaveFileCreated) // save file has been created, then deleted.
|
if(bSaveFileCreated) // save file has been created, then deleted.
|
||||||
|
|
@ -3223,7 +3219,7 @@ int UIScene_LoadOrJoinMenu::UploadSonyCrossSaveThreadProc( LPVOID lpParameter )
|
||||||
{
|
{
|
||||||
UINT uiIDA[1];
|
UINT uiIDA[1];
|
||||||
uiIDA[0]=IDS_CONFIRM_OK;
|
uiIDA[0]=IDS_CONFIRM_OK;
|
||||||
ui.RequestErrorMessage( IDS_TOOLTIPS_SAVETRANSFER_UPLOAD, IDS_SAVE_TRANSFER_UPLOADCOMPLETE, uiIDA,1,ProfileManager.GetPrimaryPad(),CrossSaveUploadFinishedCallback,pClass);
|
ui.RequestErrorMessage( IDS_TOOLTIPS_SAVETRANSFER_UPLOAD, IDS_SAVE_TRANSFER_UPLOADCOMPLETE, uiIDA,1,ProfileManager.GetPrimaryPad(),CrossSaveUploadFinishedCallback,pClass);
|
||||||
pClass->m_eSaveUploadState = esaveUpload_Finished;
|
pClass->m_eSaveUploadState = esaveUpload_Finished;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -3240,7 +3236,7 @@ int UIScene_LoadOrJoinMenu::UploadSonyCrossSaveThreadProc( LPVOID lpParameter )
|
||||||
{
|
{
|
||||||
UINT uiIDA[1];
|
UINT uiIDA[1];
|
||||||
uiIDA[0]=IDS_CONFIRM_OK;
|
uiIDA[0]=IDS_CONFIRM_OK;
|
||||||
ui.RequestErrorMessage( IDS_TOOLTIPS_SAVETRANSFER_UPLOAD, IDS_SAVE_TRANSFER_UPLOADFAILED, uiIDA,1,ProfileManager.GetPrimaryPad(),CrossSaveUploadFinishedCallback,pClass);
|
ui.RequestErrorMessage( IDS_TOOLTIPS_SAVETRANSFER_UPLOAD, IDS_SAVE_TRANSFER_UPLOADFAILED, uiIDA,1,ProfileManager.GetPrimaryPad(),CrossSaveUploadFinishedCallback,pClass);
|
||||||
pClass->m_eSaveUploadState = esaveUpload_Finished;
|
pClass->m_eSaveUploadState = esaveUpload_Finished;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -3289,7 +3285,7 @@ int UIScene_LoadOrJoinMenu::SaveTransferDialogReturned(void *pParam,int iPad,C4J
|
||||||
{
|
{
|
||||||
UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu*)pParam;
|
UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu*)pParam;
|
||||||
// results switched for this dialog
|
// results switched for this dialog
|
||||||
if(result==C4JStorage::EMessage_ResultAccept)
|
if(result==C4JStorage::EMessage_ResultAccept)
|
||||||
{
|
{
|
||||||
// upload the save
|
// upload the save
|
||||||
pClass->LaunchSaveUpload();
|
pClass->LaunchSaveUpload();
|
||||||
|
|
@ -3408,13 +3404,13 @@ int UIScene_LoadOrJoinMenu::DownloadXbox360SaveThreadProc( LPVOID lpParameter )
|
||||||
ByteArrayInputStream bais(UIScene_LoadOrJoinMenu::s_transferData);
|
ByteArrayInputStream bais(UIScene_LoadOrJoinMenu::s_transferData);
|
||||||
DataInputStream dis(&bais);
|
DataInputStream dis(&bais);
|
||||||
|
|
||||||
wstring saveTitle = dis.readUTF();
|
wstring saveTitle = dis.readUTF();
|
||||||
StorageManager.SetSaveTitle(saveTitle.c_str());
|
StorageManager.SetSaveTitle(saveTitle.c_str());
|
||||||
|
|
||||||
wstring saveUniqueName = dis.readUTF();
|
wstring saveUniqueName = dis.readUTF();
|
||||||
|
|
||||||
// 4J Stu - Don't set this any more. We added it so that we could share the ban list data for this save
|
// 4J Stu - Don't set this any more. We added it so that we could share the ban list data for this save
|
||||||
// However if the player downloads the same save multiple times, it will overwrite the previous version
|
// However if the player downloads the same save multiple times, it will overwrite the previous version
|
||||||
// with that filname, and they could have made changes to it.
|
// with that filname, and they could have made changes to it.
|
||||||
//StorageManager.SetSaveUniqueFilename((wchar_t *)saveUniqueName.c_str());
|
//StorageManager.SetSaveUniqueFilename((wchar_t *)saveUniqueName.c_str());
|
||||||
|
|
||||||
|
|
@ -3424,7 +3420,7 @@ int UIScene_LoadOrJoinMenu::DownloadXbox360SaveThreadProc( LPVOID lpParameter )
|
||||||
byteArray ba(thumbnailSize);
|
byteArray ba(thumbnailSize);
|
||||||
dis.readFully(ba);
|
dis.readFully(ba);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// retrieve the seed value from the image metadata, we need to change to host options, then set it back again
|
// retrieve the seed value from the image metadata, we need to change to host options, then set it back again
|
||||||
bool bHostOptionsRead = false;
|
bool bHostOptionsRead = false;
|
||||||
|
|
@ -3458,13 +3454,13 @@ int UIScene_LoadOrJoinMenu::DownloadXbox360SaveThreadProc( LPVOID lpParameter )
|
||||||
case eSaveTransferFile_SaveData:
|
case eSaveTransferFile_SaveData:
|
||||||
{
|
{
|
||||||
#ifdef SPLIT_SAVES
|
#ifdef SPLIT_SAVES
|
||||||
if(!pStateContainer->m_bSaveTransferCancelled)
|
if(!pStateContainer->m_bSaveTransferCancelled)
|
||||||
{
|
{
|
||||||
ConsoleSaveFileOriginal oldFormatSave( L"Temp name", UIScene_LoadOrJoinMenu::s_transferData.data, UIScene_LoadOrJoinMenu::s_transferData.length, false, SAVE_FILE_PLATFORM_X360 );
|
ConsoleSaveFileOriginal oldFormatSave( L"Temp name", UIScene_LoadOrJoinMenu::s_transferData.data, UIScene_LoadOrJoinMenu::s_transferData.length, false, SAVE_FILE_PLATFORM_X360 );
|
||||||
pSave = new ConsoleSaveFileSplit( &oldFormatSave, false, pMinecraft->progressRenderer );
|
pSave = new ConsoleSaveFileSplit( &oldFormatSave, false, pMinecraft->progressRenderer );
|
||||||
|
|
||||||
pMinecraft->progressRenderer->progressStage(IDS_SAVETRANSFER_STAGE_SAVING);
|
pMinecraft->progressRenderer->progressStage(IDS_SAVETRANSFER_STAGE_SAVING);
|
||||||
if(!pStateContainer->m_bSaveTransferCancelled) pSave->Flush(false,false);
|
if(!pStateContainer->m_bSaveTransferCancelled) pSave->Flush(false,false);
|
||||||
}
|
}
|
||||||
pStateContainer->m_eSaveTransferState=C4JStorage::eSaveTransfer_Saving;
|
pStateContainer->m_eSaveTransferState=C4JStorage::eSaveTransfer_Saving;
|
||||||
|
|
||||||
|
|
@ -3485,7 +3481,7 @@ int UIScene_LoadOrJoinMenu::DownloadXbox360SaveThreadProc( LPVOID lpParameter )
|
||||||
pSave->ConvertToLocalPlatform();
|
pSave->ConvertToLocalPlatform();
|
||||||
|
|
||||||
pMinecraft->progressRenderer->progressStage(IDS_SAVETRANSFER_STAGE_SAVING);
|
pMinecraft->progressRenderer->progressStage(IDS_SAVETRANSFER_STAGE_SAVING);
|
||||||
if(!pStateContainer->m_bSaveTransferCancelled) pSave->Flush(false,false);
|
if(!pStateContainer->m_bSaveTransferCancelled) pSave->Flush(false,false);
|
||||||
|
|
||||||
pStateContainer->m_iProgress+=1;
|
pStateContainer->m_iProgress+=1;
|
||||||
if(pStateContainer->m_iProgress==101)
|
if(pStateContainer->m_iProgress==101)
|
||||||
|
|
@ -3501,8 +3497,8 @@ int UIScene_LoadOrJoinMenu::DownloadXbox360SaveThreadProc( LPVOID lpParameter )
|
||||||
// On Durango/Orbis, we need to wait for all the asynchronous saving processes to complete before destroying the levels, as that will ultimately delete
|
// On Durango/Orbis, we need to wait for all the asynchronous saving processes to complete before destroying the levels, as that will ultimately delete
|
||||||
// the directory level storage & therefore the ConsoleSaveSplit instance, which needs to be around until all the sub files have completed saving.
|
// the directory level storage & therefore the ConsoleSaveSplit instance, which needs to be around until all the sub files have completed saving.
|
||||||
#if defined(_DURANGO) || defined(__ORBIS__)
|
#if defined(_DURANGO) || defined(__ORBIS__)
|
||||||
pMinecraft->progressRenderer->progressStage(IDS_PROGRESS_SAVING_TO_DISC);
|
pMinecraft->progressRenderer->progressStage(IDS_PROGRESS_SAVING_TO_DISC);
|
||||||
|
|
||||||
while(StorageManager.GetSaveState() != C4JStorage::ESaveGame_Idle )
|
while(StorageManager.GetSaveState() != C4JStorage::ESaveGame_Idle )
|
||||||
{
|
{
|
||||||
Sleep(10);
|
Sleep(10);
|
||||||
|
|
@ -3517,9 +3513,9 @@ int UIScene_LoadOrJoinMenu::DownloadXbox360SaveThreadProc( LPVOID lpParameter )
|
||||||
#ifdef _XBOX_ONE
|
#ifdef _XBOX_ONE
|
||||||
pMinecraft->progressRenderer->progressStage(IDS_SAVE_TRANSFER_DOWNLOAD_AND_CONVERT_COMPLETE);
|
pMinecraft->progressRenderer->progressStage(IDS_SAVE_TRANSFER_DOWNLOAD_AND_CONVERT_COMPLETE);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
pStateContainer->m_eSaveTransferState=C4JStorage::eSaveTransfer_Idle;
|
pStateContainer->m_eSaveTransferState=C4JStorage::eSaveTransfer_Idle;
|
||||||
|
|
||||||
// wipe the list and repopulate it
|
// wipe the list and repopulate it
|
||||||
if(!pStateContainer->m_bSaveTransferCancelled) pStateContainer->m_pClass->m_iState=e_SavesRepopulateAfterTransferDownload;
|
if(!pStateContainer->m_bSaveTransferCancelled) pStateContainer->m_pClass->m_iState=e_SavesRepopulateAfterTransferDownload;
|
||||||
|
|
||||||
|
|
@ -3559,7 +3555,7 @@ int UIScene_LoadOrJoinMenu::DownloadXbox360SaveThreadProc( LPVOID lpParameter )
|
||||||
}
|
}
|
||||||
|
|
||||||
void UIScene_LoadOrJoinMenu::RequestFileSize( SaveTransferStateContainer *pClass, wchar_t *filename )
|
void UIScene_LoadOrJoinMenu::RequestFileSize( SaveTransferStateContainer *pClass, wchar_t *filename )
|
||||||
{
|
{
|
||||||
Minecraft *pMinecraft=Minecraft::GetInstance();
|
Minecraft *pMinecraft=Minecraft::GetInstance();
|
||||||
|
|
||||||
// get the save file size
|
// get the save file size
|
||||||
|
|
@ -3665,7 +3661,7 @@ int UIScene_LoadOrJoinMenu::SaveTransferUpdateProgress(LPVOID lpParam,unsigned l
|
||||||
|
|
||||||
if(pClass->m_bSaveTransferCancelled) // was cancelled
|
if(pClass->m_bSaveTransferCancelled) // was cancelled
|
||||||
{
|
{
|
||||||
pMinecraft->progressRenderer->progressStage(IDS_SAVE_TRANSFER_DOWNLOAD_CANCELLING);
|
pMinecraft->progressRenderer->progressStage(IDS_SAVE_TRANSFER_DOWNLOAD_CANCELLING);
|
||||||
swprintf(wcTemp,app.GetString(IDS_SAVE_TRANSFER_DOWNLOAD_CANCELLING));
|
swprintf(wcTemp,app.GetString(IDS_SAVE_TRANSFER_DOWNLOAD_CANCELLING));
|
||||||
m_wstrStageText=wcTemp;
|
m_wstrStageText=wcTemp;
|
||||||
pMinecraft->progressRenderer->progressStage( m_wstrStageText );
|
pMinecraft->progressRenderer->progressStage( m_wstrStageText );
|
||||||
|
|
@ -3740,7 +3736,7 @@ int UIScene_LoadOrJoinMenu::CopySaveDialogReturned(void *pParam,int iPad,C4JStor
|
||||||
{
|
{
|
||||||
UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu*)pParam;
|
UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu*)pParam;
|
||||||
|
|
||||||
if(result==C4JStorage::EMessage_ResultAccept)
|
if(result==C4JStorage::EMessage_ResultAccept)
|
||||||
{
|
{
|
||||||
|
|
||||||
LoadingInputParams *loadingParams = new LoadingInputParams();
|
LoadingInputParams *loadingParams = new LoadingInputParams();
|
||||||
|
|
@ -3785,7 +3781,7 @@ int UIScene_LoadOrJoinMenu::CopySaveThreadProc( LPVOID lpParameter )
|
||||||
ui.LeaveCallbackIdCriticalSection();
|
ui.LeaveCallbackIdCriticalSection();
|
||||||
// Copy save data takes two callbacks - one for completion, and one for progress. The progress callback also lets us cancel the operation, if we return false.
|
// Copy save data takes two callbacks - one for completion, and one for progress. The progress callback also lets us cancel the operation, if we return false.
|
||||||
StorageManager.CopySaveData(&pClass->m_pSaveDetails->SaveInfoA[pClass->m_iSaveListIndex - pClass->m_iDefaultButtonsC],UIScene_LoadOrJoinMenu::CopySaveDataReturned,UIScene_LoadOrJoinMenu::CopySaveDataProgress,lpParameter);
|
StorageManager.CopySaveData(&pClass->m_pSaveDetails->SaveInfoA[pClass->m_iSaveListIndex - pClass->m_iDefaultButtonsC],UIScene_LoadOrJoinMenu::CopySaveDataReturned,UIScene_LoadOrJoinMenu::CopySaveDataProgress,lpParameter);
|
||||||
|
|
||||||
bool bContinue = true;
|
bool bContinue = true;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
|
@ -3822,7 +3818,7 @@ int UIScene_LoadOrJoinMenu::CopySaveDataReturned(LPVOID lpParam, bool success, C
|
||||||
{
|
{
|
||||||
pClass->m_bCopying = false;
|
pClass->m_bCopying = false;
|
||||||
// wipe the list and repopulate it
|
// wipe the list and repopulate it
|
||||||
pClass->m_iState=e_SavesRepopulateAfterDelete;
|
pClass->m_iState=e_SavesRepopulateAfterDelete;
|
||||||
ui.LeaveCallbackIdCriticalSection();
|
ui.LeaveCallbackIdCriticalSection();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ HRESULT CXuiCtrl4JList::OnInit(XUIMessageInit *pInitData, BOOL& bHandled)
|
||||||
void CXuiCtrl4JList::AddData( const LIST_ITEM_INFO& ItemInfo , int iSortListFromIndex, int iSortFunction)
|
void CXuiCtrl4JList::AddData( const LIST_ITEM_INFO& ItemInfo , int iSortListFromIndex, int iSortFunction)
|
||||||
{
|
{
|
||||||
// need to allocate memory for the structure and its strings
|
// need to allocate memory for the structure and its strings
|
||||||
// and remap the string pointers
|
// and remap the string pointers
|
||||||
DWORD dwBytes=0;
|
DWORD dwBytes=0;
|
||||||
DWORD dwLen1=0;
|
DWORD dwLen1=0;
|
||||||
DWORD dwLen2=0;
|
DWORD dwLen2=0;
|
||||||
|
|
@ -37,7 +37,7 @@ void CXuiCtrl4JList::AddData( const LIST_ITEM_INFO& ItemInfo , int iSortListFrom
|
||||||
ZeroMemory(pItemInfo,dwBytes);
|
ZeroMemory(pItemInfo,dwBytes);
|
||||||
|
|
||||||
XMemCpy( pItemInfo, &ItemInfo, sizeof( LIST_ITEM_INFO ) );
|
XMemCpy( pItemInfo, &ItemInfo, sizeof( LIST_ITEM_INFO ) );
|
||||||
if(dwLen1!=0)
|
if(dwLen1!=0)
|
||||||
{
|
{
|
||||||
XMemCpy( &pItemInfo[1], ItemInfo.pwszText, dwLen1 );
|
XMemCpy( &pItemInfo[1], ItemInfo.pwszText, dwLen1 );
|
||||||
pItemInfo->pwszText=(LPCWSTR)&pItemInfo[1];
|
pItemInfo->pwszText=(LPCWSTR)&pItemInfo[1];
|
||||||
|
|
@ -68,13 +68,13 @@ void CXuiCtrl4JList::AddData( const LIST_ITEM_INFO& ItemInfo , int iSortListFrom
|
||||||
|
|
||||||
// added to force a sort order for DLC
|
// added to force a sort order for DLC
|
||||||
//pItemInfo->iSortIndex=iSortIndex;
|
//pItemInfo->iSortIndex=iSortIndex;
|
||||||
|
|
||||||
m_vListData.push_back(pItemInfo);
|
m_vListData.push_back(pItemInfo);
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
|
|
||||||
int iCount=0;
|
int iCount=0;
|
||||||
for (AUTO_VAR(it, m_vListData.begin()); it != m_vListData.end(); it++)
|
for ( auto it : m_vListData )
|
||||||
{
|
{
|
||||||
PLIST_ITEM_INFO pInfo=(PLIST_ITEM_INFO)*it;
|
PLIST_ITEM_INFO pInfo=(PLIST_ITEM_INFO)*it;
|
||||||
app.DebugPrintf("%d. ",iCount++);
|
app.DebugPrintf("%d. ",iCount++);
|
||||||
|
|
@ -99,22 +99,10 @@ void CXuiCtrl4JList::AddData( const LIST_ITEM_INFO& ItemInfo , int iSortListFrom
|
||||||
break;
|
break;
|
||||||
case eSortList_Index:
|
case eSortList_Index:
|
||||||
sort(m_vListData.begin()+iSortListFromIndex, m_vListData.end(),CXuiCtrl4JList::IndexSortFn);
|
sort(m_vListData.begin()+iSortListFromIndex, m_vListData.end(),CXuiCtrl4JList::IndexSortFn);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
LeaveCriticalSection(&m_AccessListData);
|
LeaveCriticalSection(&m_AccessListData);
|
||||||
// #ifdef _DEBUG
|
|
||||||
//
|
|
||||||
// iCount=0;
|
|
||||||
// for (AUTO_VAR(it, m_vListData.begin()); it != m_vListData.end(); it++)
|
|
||||||
// {
|
|
||||||
// PLIST_ITEM_INFO pInfo=(PLIST_ITEM_INFO)*it;
|
|
||||||
// app.DebugPrintf("After Sort - %d. ",iCount++);
|
|
||||||
// OutputDebugStringW(pInfo->pwszText);
|
|
||||||
// app.DebugPrintf(" - %d\n",pInfo->iSortIndex);
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
// #endif
|
|
||||||
InsertItems( 0, 1 );
|
InsertItems( 0, 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -162,13 +150,13 @@ int CXuiCtrl4JList::GetIndexByUserData(int iData)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
CXuiCtrl4JList::LIST_ITEM_INFO& CXuiCtrl4JList::GetData(DWORD dw)
|
CXuiCtrl4JList::LIST_ITEM_INFO& CXuiCtrl4JList::GetData(DWORD dw)
|
||||||
{
|
{
|
||||||
return *m_vListData[dw];
|
return *m_vListData[dw];
|
||||||
}
|
}
|
||||||
|
|
||||||
CXuiCtrl4JList::LIST_ITEM_INFO& CXuiCtrl4JList::GetDataiData(int iData)
|
CXuiCtrl4JList::LIST_ITEM_INFO& CXuiCtrl4JList::GetDataiData(int iData)
|
||||||
{
|
{
|
||||||
LIST_ITEM_INFO info;
|
LIST_ITEM_INFO info;
|
||||||
|
|
||||||
for(unsigned int i=0;i<m_vListData.size();i++)
|
for(unsigned int i=0;i<m_vListData.size();i++)
|
||||||
|
|
@ -180,11 +168,11 @@ CXuiCtrl4JList::LIST_ITEM_INFO& CXuiCtrl4JList::GetDataiData(int iData)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return *m_vListData[0];
|
return *m_vListData[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
CXuiCtrl4JList::LIST_ITEM_INFO& CXuiCtrl4JList::GetData(FILETIME *pFileTime)
|
CXuiCtrl4JList::LIST_ITEM_INFO& CXuiCtrl4JList::GetData(FILETIME *pFileTime)
|
||||||
{
|
{
|
||||||
LIST_ITEM_INFO info;
|
LIST_ITEM_INFO info;
|
||||||
|
|
||||||
for(unsigned int i=0;i<m_vListData.size();i++)
|
for(unsigned int i=0;i<m_vListData.size();i++)
|
||||||
|
|
@ -196,13 +184,13 @@ CXuiCtrl4JList::LIST_ITEM_INFO& CXuiCtrl4JList::GetData(FILETIME *pFileTime)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return *m_vListData[0];
|
return *m_vListData[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CXuiCtrl4JList::TimeSortFn(const void *a, const void *b)
|
bool CXuiCtrl4JList::TimeSortFn(const void *a, const void *b)
|
||||||
{
|
{
|
||||||
CXuiCtrl4JList::LIST_ITEM_INFO *SaveDetailsA=(CXuiCtrl4JList::LIST_ITEM_INFO *)a;
|
CXuiCtrl4JList::LIST_ITEM_INFO *SaveDetailsA=(CXuiCtrl4JList::LIST_ITEM_INFO *)a;
|
||||||
CXuiCtrl4JList::LIST_ITEM_INFO *SaveDetailsB=(CXuiCtrl4JList::LIST_ITEM_INFO *)b;
|
CXuiCtrl4JList::LIST_ITEM_INFO *SaveDetailsB=(CXuiCtrl4JList::LIST_ITEM_INFO *)b;
|
||||||
|
|
||||||
if(SaveDetailsA->fTime.dwHighDateTime > SaveDetailsB->fTime.dwHighDateTime)
|
if(SaveDetailsA->fTime.dwHighDateTime > SaveDetailsB->fTime.dwHighDateTime)
|
||||||
{
|
{
|
||||||
|
|
@ -229,14 +217,14 @@ bool CXuiCtrl4JList::TimeSortFn(const void *a, const void *b)
|
||||||
bool CXuiCtrl4JList::AlphabeticSortFn(const void *a, const void *b)
|
bool CXuiCtrl4JList::AlphabeticSortFn(const void *a, const void *b)
|
||||||
{
|
{
|
||||||
CXuiCtrl4JList::LIST_ITEM_INFO *SaveDetailsA=(CXuiCtrl4JList::LIST_ITEM_INFO *)a;
|
CXuiCtrl4JList::LIST_ITEM_INFO *SaveDetailsA=(CXuiCtrl4JList::LIST_ITEM_INFO *)a;
|
||||||
CXuiCtrl4JList::LIST_ITEM_INFO *SaveDetailsB=(CXuiCtrl4JList::LIST_ITEM_INFO *)b;
|
CXuiCtrl4JList::LIST_ITEM_INFO *SaveDetailsB=(CXuiCtrl4JList::LIST_ITEM_INFO *)b;
|
||||||
|
|
||||||
wstring wstr1=SaveDetailsA->pwszText;
|
wstring wstr1=SaveDetailsA->pwszText;
|
||||||
wstring wstr2=SaveDetailsB->pwszText;
|
wstring wstr2=SaveDetailsB->pwszText;
|
||||||
if(wstr1.compare(wstr2)<0)
|
if(wstr1.compare(wstr2)<0)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -244,14 +232,14 @@ bool CXuiCtrl4JList::AlphabeticSortFn(const void *a, const void *b)
|
||||||
bool CXuiCtrl4JList::IndexSortFn(const void *a, const void *b)
|
bool CXuiCtrl4JList::IndexSortFn(const void *a, const void *b)
|
||||||
{
|
{
|
||||||
CXuiCtrl4JList::LIST_ITEM_INFO *SaveDetailsA=(CXuiCtrl4JList::LIST_ITEM_INFO *)a;
|
CXuiCtrl4JList::LIST_ITEM_INFO *SaveDetailsA=(CXuiCtrl4JList::LIST_ITEM_INFO *)a;
|
||||||
CXuiCtrl4JList::LIST_ITEM_INFO *SaveDetailsB=(CXuiCtrl4JList::LIST_ITEM_INFO *)b;
|
CXuiCtrl4JList::LIST_ITEM_INFO *SaveDetailsB=(CXuiCtrl4JList::LIST_ITEM_INFO *)b;
|
||||||
|
|
||||||
int iA=SaveDetailsA->iSortIndex;
|
int iA=SaveDetailsA->iSortIndex;
|
||||||
int iB=SaveDetailsB->iSortIndex;
|
int iB=SaveDetailsB->iSortIndex;
|
||||||
if(iA>iB)
|
if(iA>iB)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -303,10 +291,10 @@ void CXuiCtrl4JList::UpdateGraphic(FILETIME *pfTime,HXUIBRUSH hXuiBrush )
|
||||||
// Gets called every frame
|
// Gets called every frame
|
||||||
HRESULT CXuiCtrl4JList::OnGetSourceDataText(XUIMessageGetSourceText *pGetSourceTextData,BOOL& bHandled)
|
HRESULT CXuiCtrl4JList::OnGetSourceDataText(XUIMessageGetSourceText *pGetSourceTextData,BOOL& bHandled)
|
||||||
{
|
{
|
||||||
if( ( 0 == pGetSourceTextData->iData ) && ( ( pGetSourceTextData->bItemData ) ) )
|
if( ( 0 == pGetSourceTextData->iData ) && ( ( pGetSourceTextData->bItemData ) ) )
|
||||||
{
|
{
|
||||||
EnterCriticalSection(&m_AccessListData);
|
EnterCriticalSection(&m_AccessListData);
|
||||||
pGetSourceTextData->szText =
|
pGetSourceTextData->szText =
|
||||||
GetData(pGetSourceTextData->iItem).pwszText;
|
GetData(pGetSourceTextData->iItem).pwszText;
|
||||||
LeaveCriticalSection(&m_AccessListData);
|
LeaveCriticalSection(&m_AccessListData);
|
||||||
bHandled = TRUE;
|
bHandled = TRUE;
|
||||||
|
|
@ -323,7 +311,7 @@ HRESULT CXuiCtrl4JList::OnGetItemCountAll(XUIMessageGetItemCount *pGetItemCountD
|
||||||
|
|
||||||
HRESULT CXuiCtrl4JList::OnGetSourceDataImage(XUIMessageGetSourceImage *pGetSourceImageData,BOOL& bHandled)
|
HRESULT CXuiCtrl4JList::OnGetSourceDataImage(XUIMessageGetSourceImage *pGetSourceImageData,BOOL& bHandled)
|
||||||
{
|
{
|
||||||
if( ( 0 == pGetSourceImageData->iData ) && ( pGetSourceImageData->bItemData ) )
|
if( ( 0 == pGetSourceImageData->iData ) && ( pGetSourceImageData->bItemData ) )
|
||||||
{
|
{
|
||||||
// Check for a brush
|
// Check for a brush
|
||||||
EnterCriticalSection(&m_AccessListData);
|
EnterCriticalSection(&m_AccessListData);
|
||||||
|
|
@ -333,7 +321,7 @@ HRESULT CXuiCtrl4JList::OnGetSourceDataImage(XUIMessageGetSourceImage *pGetSourc
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pGetSourceImageData->szPath =
|
pGetSourceImageData->szPath =
|
||||||
GetData(pGetSourceImageData->iItem).pwszImage;
|
GetData(pGetSourceImageData->iItem).pwszImage;
|
||||||
}
|
}
|
||||||
LeaveCriticalSection(&m_AccessListData);
|
LeaveCriticalSection(&m_AccessListData);
|
||||||
|
|
@ -347,7 +335,7 @@ HRESULT CXuiCtrl4JList::OnGetItemEnable(XUIMessageGetItemEnable *pGetItemEnableD
|
||||||
if(m_vListData.size()!=0)
|
if(m_vListData.size()!=0)
|
||||||
{
|
{
|
||||||
EnterCriticalSection(&m_AccessListData);
|
EnterCriticalSection(&m_AccessListData);
|
||||||
pGetItemEnableData->bEnabled =
|
pGetItemEnableData->bEnabled =
|
||||||
GetData(pGetItemEnableData->iItem).fEnabled;
|
GetData(pGetItemEnableData->iItem).fEnabled;
|
||||||
LeaveCriticalSection(&m_AccessListData);
|
LeaveCriticalSection(&m_AccessListData);
|
||||||
}
|
}
|
||||||
|
|
@ -356,14 +344,14 @@ HRESULT CXuiCtrl4JList::OnGetItemEnable(XUIMessageGetItemEnable *pGetItemEnableD
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
HRESULT CXuiCtrl4JList::SetBorder(DWORD dw,BOOL bShow)
|
HRESULT CXuiCtrl4JList::SetBorder(DWORD dw,BOOL bShow)
|
||||||
{
|
{
|
||||||
CXuiControl Control;
|
CXuiControl Control;
|
||||||
HXUIOBJ hVisual,hBorder;
|
HXUIOBJ hVisual,hBorder;
|
||||||
GetItemControl(dw,&Control);
|
GetItemControl(dw,&Control);
|
||||||
Control.GetVisual(&hVisual);
|
Control.GetVisual(&hVisual);
|
||||||
XuiElementGetChildById(hVisual,L"Border",&hBorder);
|
XuiElementGetChildById(hVisual,L"Border",&hBorder);
|
||||||
return XuiElementSetShow(hBorder,bShow);
|
return XuiElementSetShow(hBorder,bShow);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CXuiCtrl4JList::SetSelectionChangedHandle(HXUIOBJ hObj)
|
void CXuiCtrl4JList::SetSelectionChangedHandle(HXUIOBJ hObj)
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@ HRESULT CXuiCtrlEnchantmentButton::OnGetSourceDataText(XUIMessageGetSourceText *
|
||||||
// Light background and focus background
|
// Light background and focus background
|
||||||
SetEnable(TRUE);
|
SetEnable(TRUE);
|
||||||
}
|
}
|
||||||
m_costString = _toString<int>(cost);
|
m_costString = std::to_wstring(cost);
|
||||||
m_lastCost = cost;
|
m_lastCost = cost;
|
||||||
}
|
}
|
||||||
if(cost == 0)
|
if(cost == 0)
|
||||||
|
|
@ -79,7 +79,7 @@ HRESULT CXuiCtrlEnchantmentButton::OnGetSourceDataText(XUIMessageGetSourceText *
|
||||||
pGetSourceTextData->bDisplay = FALSE;
|
pGetSourceTextData->bDisplay = FALSE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pGetSourceTextData->szText = m_costString.c_str();
|
pGetSourceTextData->szText = m_costString.c_str();
|
||||||
pGetSourceTextData->bDisplay = TRUE;
|
pGetSourceTextData->bDisplay = TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -70,11 +70,11 @@ HRESULT CXuiCtrlEnchantmentButtonText::OnRender(XUIMessageRender *pRenderData, B
|
||||||
D3DXMATRIX matrix;
|
D3DXMATRIX matrix;
|
||||||
xuiControl.GetFullXForm(&matrix);
|
xuiControl.GetFullXForm(&matrix);
|
||||||
float bwidth,bheight;
|
float bwidth,bheight;
|
||||||
xuiControl.GetBounds(&bwidth,&bheight);
|
xuiControl.GetBounds(&bwidth,&bheight);
|
||||||
|
|
||||||
// Annoyingly, XUI renders everything to a z of 0 so if we want to render anything that needs the z-buffer on top of it, then we need to clear it.
|
// Annoyingly, XUI renders everything to a z of 0 so if we want to render anything that needs the z-buffer on top of it, then we need to clear it.
|
||||||
// Clear just the region required for this control.
|
// Clear just the region required for this control.
|
||||||
D3DRECT clearRect;
|
D3DRECT clearRect;
|
||||||
clearRect.x1 = (int)(matrix._41) - 2;
|
clearRect.x1 = (int)(matrix._41) - 2;
|
||||||
clearRect.y1 = (int)(matrix._42) - 2;
|
clearRect.y1 = (int)(matrix._42) - 2;
|
||||||
clearRect.x2 = (int)(matrix._41 + ( bwidth * matrix._11 )) + 2;
|
clearRect.x2 = (int)(matrix._41 + ( bwidth * matrix._11 )) + 2;
|
||||||
|
|
@ -124,7 +124,7 @@ HRESULT CXuiCtrlEnchantmentButtonText::OnRender(XUIMessageRender *pRenderData, B
|
||||||
glColor4f(1, 1, 1, 1);
|
glColor4f(1, 1, 1, 1);
|
||||||
if (cost != 0)
|
if (cost != 0)
|
||||||
{
|
{
|
||||||
wstring line = _toString<int>(cost);
|
wstring line = std::to_wstring(cost);
|
||||||
Font *font = pMinecraft->altFont;
|
Font *font = pMinecraft->altFont;
|
||||||
//int col = 0x685E4A;
|
//int col = 0x685E4A;
|
||||||
unsigned int col = m_textColour;
|
unsigned int col = m_textColour;
|
||||||
|
|
|
||||||
|
|
@ -145,7 +145,7 @@ void CXuiCtrlMinecraftSkinPreview::CycleNextAnimation()
|
||||||
|
|
||||||
void CXuiCtrlMinecraftSkinPreview::CyclePreviousAnimation()
|
void CXuiCtrlMinecraftSkinPreview::CyclePreviousAnimation()
|
||||||
{
|
{
|
||||||
m_currentAnimation = (ESkinPreviewAnimations)(m_currentAnimation - 1);
|
m_currentAnimation = (ESkinPreviewAnimations)(m_currentAnimation - 1);
|
||||||
if(m_currentAnimation < e_SkinPreviewAnimation_Walking) m_currentAnimation = (ESkinPreviewAnimations)(e_SkinPreviewAnimation_Count - 1);
|
if(m_currentAnimation < e_SkinPreviewAnimation_Walking) m_currentAnimation = (ESkinPreviewAnimations)(e_SkinPreviewAnimation_Count - 1);
|
||||||
|
|
||||||
m_swingTime = 0.0f;
|
m_swingTime = 0.0f;
|
||||||
|
|
@ -253,13 +253,11 @@ HRESULT CXuiCtrlMinecraftSkinPreview::OnRender(XUIMessageRender *pRenderData, BO
|
||||||
{
|
{
|
||||||
// 4J-PB - any additional parts to turn on for this player (skin dependent)
|
// 4J-PB - any additional parts to turn on for this player (skin dependent)
|
||||||
//vector<ModelPart *> *pAdditionalModelParts=mob->GetAdditionalModelParts();
|
//vector<ModelPart *> *pAdditionalModelParts=mob->GetAdditionalModelParts();
|
||||||
|
|
||||||
if(m_pvAdditionalModelParts && m_pvAdditionalModelParts->size()!=0)
|
|
||||||
{
|
|
||||||
for(AUTO_VAR(it, m_pvAdditionalModelParts->begin()); it != m_pvAdditionalModelParts->end(); ++it)
|
|
||||||
{
|
|
||||||
ModelPart *pModelPart=*it;
|
|
||||||
|
|
||||||
|
if(m_pvAdditionalModelParts && m_pvAdditionalModelParts->size()!=0)
|
||||||
|
{
|
||||||
|
for(auto& pModelPart : *m_pvAdditionalModelParts)
|
||||||
|
{
|
||||||
pModelPart->visible=true;
|
pModelPart->visible=true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -269,11 +267,9 @@ HRESULT CXuiCtrlMinecraftSkinPreview::OnRender(XUIMessageRender *pRenderData, BO
|
||||||
|
|
||||||
// hide the additional parts
|
// hide the additional parts
|
||||||
if(m_pvAdditionalModelParts && m_pvAdditionalModelParts->size()!=0)
|
if(m_pvAdditionalModelParts && m_pvAdditionalModelParts->size()!=0)
|
||||||
{
|
{
|
||||||
for(AUTO_VAR(it, m_pvAdditionalModelParts->begin()); it != m_pvAdditionalModelParts->end(); ++it)
|
for(auto& pModelPart : *m_pvAdditionalModelParts)
|
||||||
{
|
{
|
||||||
ModelPart *pModelPart=*it;
|
|
||||||
|
|
||||||
pModelPart->visible=false;
|
pModelPart->visible=false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -344,7 +340,7 @@ void CXuiCtrlMinecraftSkinPreview::render(EntityRenderer *renderer, double x, do
|
||||||
float bodyRot = m_yRot; //(mob->yBodyRotO + (mob->yBodyRot - mob->yBodyRotO) * a);
|
float bodyRot = m_yRot; //(mob->yBodyRotO + (mob->yBodyRot - mob->yBodyRotO) * a);
|
||||||
float headRot = m_yRot; //(mob->yRotO + (mob->yRot - mob->yRotO) * a);
|
float headRot = m_yRot; //(mob->yRotO + (mob->yRot - mob->yRotO) * a);
|
||||||
float headRotx = 0; //(mob->xRotO + (mob->xRot - mob->xRotO) * a);
|
float headRotx = 0; //(mob->xRotO + (mob->xRot - mob->xRotO) * a);
|
||||||
|
|
||||||
//setupPosition(mob, x, y, z);
|
//setupPosition(mob, x, y, z);
|
||||||
// is equivalent to
|
// is equivalent to
|
||||||
glTranslatef((float) x, (float) y, (float) z);
|
glTranslatef((float) x, (float) y, (float) z);
|
||||||
|
|
@ -515,7 +511,7 @@ bool CXuiCtrlMinecraftSkinPreview::bindTexture(const wstring& urlTexture, int ba
|
||||||
Textures *t = Minecraft::GetInstance()->textures;
|
Textures *t = Minecraft::GetInstance()->textures;
|
||||||
|
|
||||||
// 4J-PB - no http textures on the xbox, mem textures instead
|
// 4J-PB - no http textures on the xbox, mem textures instead
|
||||||
|
|
||||||
//int id = t->loadHttpTexture(urlTexture, backupTexture);
|
//int id = t->loadHttpTexture(urlTexture, backupTexture);
|
||||||
int id = t->loadMemTexture(urlTexture, backupTexture);
|
int id = t->loadMemTexture(urlTexture, backupTexture);
|
||||||
|
|
||||||
|
|
@ -535,7 +531,7 @@ bool CXuiCtrlMinecraftSkinPreview::bindTexture(const wstring& urlTexture, const
|
||||||
Textures *t = Minecraft::GetInstance()->textures;
|
Textures *t = Minecraft::GetInstance()->textures;
|
||||||
|
|
||||||
// 4J-PB - no http textures on the xbox, mem textures instead
|
// 4J-PB - no http textures on the xbox, mem textures instead
|
||||||
|
|
||||||
//int id = t->loadHttpTexture(urlTexture, backupTexture);
|
//int id = t->loadHttpTexture(urlTexture, backupTexture);
|
||||||
int id = t->loadMemTexture(urlTexture, backupTexture);
|
int id = t->loadMemTexture(urlTexture, backupTexture);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,7 @@ HRESULT CXuiCtrlSlotItemCtrlBase::OnCustomMessage_GetSlotItem(HXUIOBJ hObj, Cust
|
||||||
// 11 bits - auxval
|
// 11 bits - auxval
|
||||||
// 6 bits - count
|
// 6 bits - count
|
||||||
// 6 bits - scale
|
// 6 bits - scale
|
||||||
pData->iDataBitField = MAKE_SLOTDISPLAY_DATA_BITMASK(pUserDataContainer->m_iPad, (int)(31*pUserDataContainer->m_fAlpha),true,item->GetCount(),7,item->popTime);
|
pData->iDataBitField = MAKE_SLOTDISPLAY_DATA_BITMASK(pUserDataContainer->m_iPad, (int)(31*pUserDataContainer->m_fAlpha),true,item->GetCount(),7,item->popTime);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -93,7 +93,7 @@ void CXuiCtrlSlotItemCtrlBase::SetUserIndex( HXUIOBJ hObj, int iPad )
|
||||||
XuiElementGetUserData( hObj, &pvUserData );
|
XuiElementGetUserData( hObj, &pvUserData );
|
||||||
|
|
||||||
SlotControlUserDataContainer* pUserDataContainer = (SlotControlUserDataContainer*)pvUserData;
|
SlotControlUserDataContainer* pUserDataContainer = (SlotControlUserDataContainer*)pvUserData;
|
||||||
|
|
||||||
pUserDataContainer->m_iPad = iPad;
|
pUserDataContainer->m_iPad = iPad;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -103,7 +103,7 @@ void CXuiCtrlSlotItemCtrlBase::SetAlpha( HXUIOBJ hObj, float fAlpha )
|
||||||
XuiElementGetUserData( hObj, &pvUserData );
|
XuiElementGetUserData( hObj, &pvUserData );
|
||||||
|
|
||||||
SlotControlUserDataContainer* pUserDataContainer = (SlotControlUserDataContainer*)pvUserData;
|
SlotControlUserDataContainer* pUserDataContainer = (SlotControlUserDataContainer*)pvUserData;
|
||||||
|
|
||||||
pUserDataContainer->m_fAlpha = fAlpha;
|
pUserDataContainer->m_fAlpha = fAlpha;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -137,16 +137,15 @@ wstring CXuiCtrlSlotItemCtrlBase::GetItemDescription( HXUIOBJ hObj, vector<wstri
|
||||||
wstring desc = L"";
|
wstring desc = L"";
|
||||||
vector<wstring> *strings = pUserDataContainer->slot->getItem()->getHoverText(Minecraft::GetInstance()->localplayers[pUserDataContainer->m_iPad], false, unformattedStrings);
|
vector<wstring> *strings = pUserDataContainer->slot->getItem()->getHoverText(Minecraft::GetInstance()->localplayers[pUserDataContainer->m_iPad], false, unformattedStrings);
|
||||||
bool firstLine = true;
|
bool firstLine = true;
|
||||||
for(AUTO_VAR(it, strings->begin()); it != strings->end(); ++it)
|
for ( wstring& thisString : *strings )
|
||||||
{
|
{
|
||||||
wstring thisString = *it;
|
|
||||||
if(!firstLine)
|
if(!firstLine)
|
||||||
{
|
{
|
||||||
desc.append( L"<br />" );
|
desc.append( L"<br />" );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
firstLine = false;
|
firstLine = false;
|
||||||
wchar_t formatted[256];
|
wchar_t formatted[256];
|
||||||
eMinecraftColour rarityColour = pUserDataContainer->slot->getItem()->getRarity()->color;
|
eMinecraftColour rarityColour = pUserDataContainer->slot->getItem()->getRarity()->color;
|
||||||
int colour = app.GetHTMLColour(rarityColour);
|
int colour = app.GetHTMLColour(rarityColour);
|
||||||
|
|
@ -156,7 +155,7 @@ wstring CXuiCtrlSlotItemCtrlBase::GetItemDescription( HXUIOBJ hObj, vector<wstri
|
||||||
colour = app.GetHTMLColour(eTextColor_RenamedItemTitle);
|
colour = app.GetHTMLColour(eTextColor_RenamedItemTitle);
|
||||||
}
|
}
|
||||||
|
|
||||||
swprintf(formatted, 256, L"<font color=\"#%08x\">%s</font>",colour,thisString.c_str());
|
swprintf(formatted, 256, L"<font color=\"#%08x\">%s</font>",colour,thisString.c_str());
|
||||||
thisString = formatted;
|
thisString = formatted;
|
||||||
}
|
}
|
||||||
desc.append( thisString );
|
desc.append( thisString );
|
||||||
|
|
@ -221,7 +220,7 @@ HRESULT CXuiCtrlSlotItemCtrlBase::OnKeyDown(HXUIOBJ hObj, XUIMessageInput *pInpu
|
||||||
|
|
||||||
XUIMessage message;
|
XUIMessage message;
|
||||||
XUIMessageInput messageInput;
|
XUIMessageInput messageInput;
|
||||||
|
|
||||||
XuiMessageInput( &message, &messageInput, XUI_KEYDOWN, pInputData->dwKeyCode, pInputData->wch, pInputData->dwFlags, pInputData->UserIndex );
|
XuiMessageInput( &message, &messageInput, XUI_KEYDOWN, pInputData->dwKeyCode, pInputData->wch, pInputData->dwFlags, pInputData->UserIndex );
|
||||||
|
|
||||||
if (HRESULT_SUCCEEDED(hr))
|
if (HRESULT_SUCCEEDED(hr))
|
||||||
|
|
@ -358,7 +357,7 @@ bool CXuiCtrlSlotItemCtrlBase::IsSameItemAs( HXUIOBJ hThisObj, HXUIOBJ hOtherObj
|
||||||
|
|
||||||
// 4J WESTY : Pointer Prototype : Added to support prototype only.
|
// 4J WESTY : Pointer Prototype : Added to support prototype only.
|
||||||
// Returns number of items that can still be stacked into this slot.
|
// Returns number of items that can still be stacked into this slot.
|
||||||
int CXuiCtrlSlotItemCtrlBase::GetEmptyStackSpace( HXUIOBJ hObj )
|
int CXuiCtrlSlotItemCtrlBase::GetEmptyStackSpace( HXUIOBJ hObj )
|
||||||
{
|
{
|
||||||
int iResult = 0;
|
int iResult = 0;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
#include "..\..\Common\GameRules\ConsoleGameRules.h"
|
#include "..\..\Common\GameRules\ConsoleGameRules.h"
|
||||||
#include "XUI_DebugItemEditor.h"
|
#include "XUI_DebugItemEditor.h"
|
||||||
|
|
||||||
#ifdef _DEBUG_MENUS_ENABLED
|
#ifdef _DEBUG_MENUS_ENABLED
|
||||||
HRESULT CScene_DebugItemEditor::OnInit( XUIMessageInit *pInitData, BOOL &bHandled )
|
HRESULT CScene_DebugItemEditor::OnInit( XUIMessageInit *pInitData, BOOL &bHandled )
|
||||||
{
|
{
|
||||||
MapChildControls();
|
MapChildControls();
|
||||||
|
|
@ -22,13 +22,13 @@ HRESULT CScene_DebugItemEditor::OnInit( XUIMessageInit *pInitData, BOOL &bHandle
|
||||||
|
|
||||||
if(m_item!=NULL)
|
if(m_item!=NULL)
|
||||||
{
|
{
|
||||||
m_icon->SetIcon(m_iPad, m_item->id,m_item->getAuxValue(),m_item->count,10,31,false,m_item->isFoil());
|
m_icon->SetIcon(m_iPad, m_item->id,m_item->getAuxValue(),m_item->count,10,31,false,m_item->isFoil());
|
||||||
m_itemName.SetText( app.GetString( Item::items[m_item->id]->getDescriptionId(m_item) ) );
|
m_itemName.SetText( app.GetString( Item::items[m_item->id]->getDescriptionId(m_item) ) );
|
||||||
|
|
||||||
m_itemId .SetText( _toString<int>(m_item->id).c_str() );
|
m_itemId .SetText( std::to_wstring(m_item->id).c_str() );
|
||||||
m_itemAuxValue .SetText( _toString<int>(m_item->getAuxValue()).c_str() );
|
m_itemAuxValue .SetText( std::to_wstring(m_item->getAuxValue()).c_str() );
|
||||||
m_itemCount .SetText( _toString<int>(m_item->count).c_str() );
|
m_itemCount .SetText( std::to_wstring(m_item->count).c_str() );
|
||||||
m_item4JData .SetText( _toString<int>(m_item->get4JData()).c_str() );
|
m_item4JData .SetText( std::to_wstring(m_item->get4JData()).c_str() );
|
||||||
}
|
}
|
||||||
|
|
||||||
m_itemId .SetKeyboardType(C_4JInput::EKeyboardMode_Numeric);
|
m_itemId .SetKeyboardType(C_4JInput::EKeyboardMode_Numeric);
|
||||||
|
|
@ -107,7 +107,7 @@ HRESULT CScene_DebugItemEditor::OnNotifyValueChanged( HXUIOBJ hObjSource, XUINot
|
||||||
if(!value.empty()) data = _fromString<int>( value );
|
if(!value.empty()) data = _fromString<int>( value );
|
||||||
m_item->set4JData(data);
|
m_item->set4JData(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_icon->SetIcon(m_iPad, m_item->id,m_item->getAuxValue(),m_item->count,10,31,false,m_item->isFoil());
|
m_icon->SetIcon(m_iPad, m_item->id,m_item->getAuxValue(),m_item->count,10,31,false,m_item->isFoil());
|
||||||
|
|
||||||
m_itemName.SetText( app.GetString( Item::items[m_item->id]->getDescriptionId(m_item) ) );
|
m_itemName.SetText( app.GetString( Item::items[m_item->id]->getDescriptionId(m_item) ) );
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@
|
||||||
#include "..\..\..\Minecraft.World\net.minecraft.commands.common.h"
|
#include "..\..\..\Minecraft.World\net.minecraft.commands.common.h"
|
||||||
#include "..\..\..\Minecraft.World\ConsoleSaveFileOriginal.h"
|
#include "..\..\..\Minecraft.World\ConsoleSaveFileOriginal.h"
|
||||||
|
|
||||||
#ifdef _DEBUG_MENUS_ENABLED
|
#ifdef _DEBUG_MENUS_ENABLED
|
||||||
HRESULT CScene_DebugOverlay::OnInit( XUIMessageInit *pInitData, BOOL &bHandled )
|
HRESULT CScene_DebugOverlay::OnInit( XUIMessageInit *pInitData, BOOL &bHandled )
|
||||||
{
|
{
|
||||||
MapChildControls();
|
MapChildControls();
|
||||||
|
|
@ -53,7 +53,7 @@ HRESULT CScene_DebugOverlay::OnInit( XUIMessageInit *pInitData, BOOL &bHandled )
|
||||||
m_enchantmentIds.push_back(ench->id);
|
m_enchantmentIds.push_back(ench->id);
|
||||||
m_enchantments.SetText( i, app.GetString( ench->getDescriptionId() ) );
|
m_enchantments.SetText( i, app.GetString( ench->getDescriptionId() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
m_mobs.InsertItems( 0, 21 );
|
m_mobs.InsertItems( 0, 21 );
|
||||||
|
|
||||||
m_mobs.SetText( m_mobFactories.size(), L"Chicken" );
|
m_mobs.SetText( m_mobFactories.size(), L"Chicken" );
|
||||||
|
|
@ -98,7 +98,7 @@ HRESULT CScene_DebugOverlay::OnInit( XUIMessageInit *pInitData, BOOL &bHandled )
|
||||||
m_mobFactories.push_back(eTYPE_BLAZE);
|
m_mobFactories.push_back(eTYPE_BLAZE);
|
||||||
m_mobs.SetText( m_mobFactories.size(), L"Magma Cube" );
|
m_mobs.SetText( m_mobFactories.size(), L"Magma Cube" );
|
||||||
m_mobFactories.push_back(eTYPE_LAVASLIME);
|
m_mobFactories.push_back(eTYPE_LAVASLIME);
|
||||||
|
|
||||||
|
|
||||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||||
m_setTime.SetValue( pMinecraft->level->getLevelData()->getTime() % 24000 );
|
m_setTime.SetValue( pMinecraft->level->getLevelData()->getTime() % 24000 );
|
||||||
|
|
@ -135,7 +135,7 @@ HRESULT CScene_DebugOverlay::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress
|
||||||
{
|
{
|
||||||
nIndex = m_mobs.GetCurSel();
|
nIndex = m_mobs.GetCurSel();
|
||||||
if(nIndex<m_mobFactories.size())
|
if(nIndex<m_mobFactories.size())
|
||||||
{
|
{
|
||||||
app.SetXuiServerAction(ProfileManager.GetPrimaryPad(),eXuiServerAction_SpawnMob,(void *)m_mobFactories[nIndex]);
|
app.SetXuiServerAction(ProfileManager.GetPrimaryPad(),eXuiServerAction_SpawnMob,(void *)m_mobFactories[nIndex]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -171,7 +171,7 @@ HRESULT CScene_DebugOverlay::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress
|
||||||
HXUIOBJ hScene;
|
HXUIOBJ hScene;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
//const WCHAR XZP_SEPARATOR = L'#';
|
//const WCHAR XZP_SEPARATOR = L'#';
|
||||||
const DWORD LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string
|
const DWORD LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string
|
||||||
WCHAR szResourceLocator[ LOCATOR_SIZE ];
|
WCHAR szResourceLocator[ LOCATOR_SIZE ];
|
||||||
|
|
||||||
swprintf(szResourceLocator, LOCATOR_SIZE, L"section://%X,%ls#%ls",c_ModuleHandle,L"media", L"media/");
|
swprintf(szResourceLocator, LOCATOR_SIZE, L"section://%X,%ls#%ls",c_ModuleHandle,L"media", L"media/");
|
||||||
|
|
@ -189,7 +189,7 @@ HRESULT CScene_DebugOverlay::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress
|
||||||
HXUIOBJ hScene;
|
HXUIOBJ hScene;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
//const WCHAR XZP_SEPARATOR = L'#';
|
//const WCHAR XZP_SEPARATOR = L'#';
|
||||||
const DWORD LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string
|
const DWORD LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string
|
||||||
WCHAR szResourceLocator[ LOCATOR_SIZE ];
|
WCHAR szResourceLocator[ LOCATOR_SIZE ];
|
||||||
|
|
||||||
swprintf(szResourceLocator, LOCATOR_SIZE, L"section://%X,%ls#%ls",c_ModuleHandle,L"media", L"media/");
|
swprintf(szResourceLocator, LOCATOR_SIZE, L"section://%X,%ls#%ls",c_ModuleHandle,L"media", L"media/");
|
||||||
|
|
@ -256,7 +256,7 @@ HRESULT CScene_DebugOverlay::OnNotifyValueChanged( HXUIOBJ hObjSource, XUINotify
|
||||||
if( hObjSource == m_setTime )
|
if( hObjSource == m_setTime )
|
||||||
{
|
{
|
||||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||||
|
|
||||||
// Need to set the time on both levels to stop the flickering as the local level
|
// Need to set the time on both levels to stop the flickering as the local level
|
||||||
// tries to predict the time
|
// tries to predict the time
|
||||||
// Only works if we are on the host machine, but shouldn't break if not
|
// Only works if we are on the host machine, but shouldn't break if not
|
||||||
|
|
@ -365,11 +365,11 @@ void CScene_DebugOverlay::SaveLimitedFile(int chunkRadius)
|
||||||
|
|
||||||
RegionFile *CScene_DebugOverlay::getRegionFile(unordered_map<File, RegionFile *, FileKeyHash, FileKeyEq> &newFileCache, ConsoleSaveFile *saveFile, const wstring &prefix, int chunkX, int chunkZ) // 4J - TODO was synchronized
|
RegionFile *CScene_DebugOverlay::getRegionFile(unordered_map<File, RegionFile *, FileKeyHash, FileKeyEq> &newFileCache, ConsoleSaveFile *saveFile, const wstring &prefix, int chunkX, int chunkZ) // 4J - TODO was synchronized
|
||||||
{
|
{
|
||||||
File file( prefix + wstring(L"r.") + _toString(chunkX>>5) + L"." + _toString(chunkZ>>5) + L".mcr" );
|
File file( prefix + wstring(L"r.") + std::to_wstring(chunkX>>5) + L"." + std::to_wstring(chunkZ>>5) + L".mcr" );
|
||||||
|
|
||||||
RegionFile *ref = NULL;
|
RegionFile *ref = NULL;
|
||||||
AUTO_VAR(it, newFileCache.find(file));
|
auto it = newFileCache.find(file);
|
||||||
if( it != newFileCache.end() )
|
if( it != newFileCache.end() )
|
||||||
ref = it->second;
|
ref = it->second;
|
||||||
|
|
||||||
// 4J Jev, put back in.
|
// 4J Jev, put back in.
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ HRESULT CScene_DebugSetCamera::OnInit( XUIMessageInit *pInitData, BOOL &bHandled
|
||||||
currentPosition = new DebugSetCameraPosition();
|
currentPosition = new DebugSetCameraPosition();
|
||||||
|
|
||||||
currentPosition->player = playerNo;
|
currentPosition->player = playerNo;
|
||||||
|
|
||||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||||
if (pMinecraft != NULL)
|
if (pMinecraft != NULL)
|
||||||
{
|
{
|
||||||
|
|
@ -43,13 +43,13 @@ HRESULT CScene_DebugSetCamera::OnInit( XUIMessageInit *pInitData, BOOL &bHandled
|
||||||
m_yRot.SetKeyboardType(C_4JInput::EKeyboardMode_Full);
|
m_yRot.SetKeyboardType(C_4JInput::EKeyboardMode_Full);
|
||||||
m_elevation.SetKeyboardType(C_4JInput::EKeyboardMode_Full);
|
m_elevation.SetKeyboardType(C_4JInput::EKeyboardMode_Full);
|
||||||
|
|
||||||
m_camX.SetText((CONST WCHAR *) _toString<double>(currentPosition->m_camX).c_str());
|
m_camX.SetText((CONST WCHAR *) std::to_wstring(currentPosition->m_camX).c_str());
|
||||||
m_camY.SetText((CONST WCHAR *) _toString<double>(currentPosition->m_camY + 1.62).c_str());
|
m_camY.SetText((CONST WCHAR *) std::to_wstring(currentPosition->m_camY + 1.62).c_str());
|
||||||
m_camZ.SetText((CONST WCHAR *) _toString<double>(currentPosition->m_camZ).c_str());
|
m_camZ.SetText((CONST WCHAR *) std::to_wstring(currentPosition->m_camZ).c_str());
|
||||||
|
|
||||||
|
m_yRot.SetText((CONST WCHAR *) std::to_wstring(currentPosition->m_yRot).c_str());
|
||||||
|
m_elevation.SetText((CONST WCHAR *) std::to_wstring(currentPosition->m_elev).c_str());
|
||||||
|
|
||||||
m_yRot.SetText((CONST WCHAR *) _toString<double>(currentPosition->m_yRot).c_str());
|
|
||||||
m_elevation.SetText((CONST WCHAR *) _toString<double>(currentPosition->m_elev).c_str());
|
|
||||||
|
|
||||||
//fpp = new FreezePlayerParam();
|
//fpp = new FreezePlayerParam();
|
||||||
//fpp->player = playerNo;
|
//fpp->player = playerNo;
|
||||||
//fpp->freeze = true;
|
//fpp->freeze = true;
|
||||||
|
|
@ -69,7 +69,7 @@ HRESULT CScene_DebugSetCamera::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPre
|
||||||
if (hObjPressed == m_teleport)
|
if (hObjPressed == m_teleport)
|
||||||
{
|
{
|
||||||
app.SetXuiServerAction( ProfileManager.GetPrimaryPad(),
|
app.SetXuiServerAction( ProfileManager.GetPrimaryPad(),
|
||||||
eXuiServerAction_SetCameraLocation,
|
eXuiServerAction_SetCameraLocation,
|
||||||
(void *)currentPosition);
|
(void *)currentPosition);
|
||||||
rfHandled = TRUE;
|
rfHandled = TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -42,13 +42,13 @@ HRESULT CScene_MultiGameJoinLoad::OnInit( XUIMessageInit* pInitData, BOOL& bHand
|
||||||
|
|
||||||
m_iTexturePacksNotInstalled=0;
|
m_iTexturePacksNotInstalled=0;
|
||||||
m_iConfigA=NULL;
|
m_iConfigA=NULL;
|
||||||
|
|
||||||
XuiControlSetText(m_LabelNoGames,app.GetString(IDS_NO_GAMES_FOUND));
|
XuiControlSetText(m_LabelNoGames,app.GetString(IDS_NO_GAMES_FOUND));
|
||||||
XuiControlSetText(m_GamesList,app.GetString(IDS_JOIN_GAME));
|
XuiControlSetText(m_GamesList,app.GetString(IDS_JOIN_GAME));
|
||||||
XuiControlSetText(m_SavesList,app.GetString(IDS_START_GAME));
|
XuiControlSetText(m_SavesList,app.GetString(IDS_START_GAME));
|
||||||
|
|
||||||
|
|
||||||
const DWORD LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string
|
const DWORD LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string
|
||||||
WCHAR szResourceLocator[ LOCATOR_SIZE ];
|
WCHAR szResourceLocator[ LOCATOR_SIZE ];
|
||||||
|
|
||||||
const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(NULL);
|
const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(NULL);
|
||||||
|
|
@ -64,17 +64,17 @@ HRESULT CScene_MultiGameJoinLoad::OnInit( XUIMessageInit* pInitData, BOOL& bHand
|
||||||
|
|
||||||
m_bRetrievingSaveInfo=false;
|
m_bRetrievingSaveInfo=false;
|
||||||
m_bSaveTransferInProgress=false;
|
m_bSaveTransferInProgress=false;
|
||||||
|
|
||||||
// check for a default custom cloak in the global storage
|
// check for a default custom cloak in the global storage
|
||||||
// 4J-PB - changed to a config file
|
// 4J-PB - changed to a config file
|
||||||
// if(ProfileManager.IsSignedInLive( m_iPad ))
|
// if(ProfileManager.IsSignedInLive( m_iPad ))
|
||||||
// {
|
// {
|
||||||
// app.InstallDefaultCape();
|
// app.InstallDefaultCape();
|
||||||
// }
|
// }
|
||||||
|
|
||||||
m_initData= new JoinMenuInitData();
|
m_initData= new JoinMenuInitData();
|
||||||
m_bMultiplayerAllowed = ProfileManager.IsSignedInLive( m_iPad ) && ProfileManager.AllowedToPlayMultiplayer(m_iPad);
|
m_bMultiplayerAllowed = ProfileManager.IsSignedInLive( m_iPad ) && ProfileManager.AllowedToPlayMultiplayer(m_iPad);
|
||||||
|
|
||||||
XPARTY_USER_LIST partyList;
|
XPARTY_USER_LIST partyList;
|
||||||
|
|
||||||
if((XPartyGetUserList( &partyList ) != XPARTY_E_NOT_IN_PARTY ) && (partyList.dwUserCount>1))
|
if((XPartyGetUserList( &partyList ) != XPARTY_E_NOT_IN_PARTY ) && (partyList.dwUserCount>1))
|
||||||
|
|
@ -90,7 +90,7 @@ HRESULT CScene_MultiGameJoinLoad::OnInit( XUIMessageInit* pInitData, BOOL& bHand
|
||||||
if(m_bInParty) iLB = IDS_TOOLTIPS_PARTY_GAMES;
|
if(m_bInParty) iLB = IDS_TOOLTIPS_PARTY_GAMES;
|
||||||
|
|
||||||
XuiSetTimer(m_hObj,JOIN_LOAD_ONLINE_TIMER_ID,JOIN_LOAD_ONLINE_TIMER_TIME);
|
XuiSetTimer(m_hObj,JOIN_LOAD_ONLINE_TIMER_ID,JOIN_LOAD_ONLINE_TIMER_TIME);
|
||||||
|
|
||||||
m_iSaveInfoC=0;
|
m_iSaveInfoC=0;
|
||||||
|
|
||||||
VOID *pObj;
|
VOID *pObj;
|
||||||
|
|
@ -110,7 +110,7 @@ HRESULT CScene_MultiGameJoinLoad::OnInit( XUIMessageInit* pInitData, BOOL& bHand
|
||||||
{
|
{
|
||||||
// if we're waiting for DLC to mount, don't fill the save list. The custom message on end of dlc mounting will do that
|
// if we're waiting for DLC to mount, don't fill the save list. The custom message on end of dlc mounting will do that
|
||||||
m_bIgnoreInput=false;
|
m_bIgnoreInput=false;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
m_iChangingSaveGameInfoIndex = 0;
|
m_iChangingSaveGameInfoIndex = 0;
|
||||||
|
|
@ -135,7 +135,7 @@ HRESULT CScene_MultiGameJoinLoad::OnInit( XUIMessageInit* pInitData, BOOL& bHand
|
||||||
// saving is disabled, but we should still be able to load from a selected save device
|
// saving is disabled, but we should still be able to load from a selected save device
|
||||||
|
|
||||||
ui.SetTooltips( DEFAULT_XUI_MENU_USER, IDS_TOOLTIPS_SELECT,IDS_TOOLTIPS_BACK,IDS_TOOLTIPS_CHANGEDEVICE,-1,-1,-1,iLB,IDS_TOOLTIPS_DELETESAVE);
|
ui.SetTooltips( DEFAULT_XUI_MENU_USER, IDS_TOOLTIPS_SELECT,IDS_TOOLTIPS_BACK,IDS_TOOLTIPS_CHANGEDEVICE,-1,-1,-1,iLB,IDS_TOOLTIPS_DELETESAVE);
|
||||||
|
|
||||||
GetSaveInfo();
|
GetSaveInfo();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -153,7 +153,7 @@ HRESULT CScene_MultiGameJoinLoad::OnInit( XUIMessageInit* pInitData, BOOL& bHand
|
||||||
// 4J-PB - we need to check that there is enough space left to create a copy of the save (for a rename)
|
// 4J-PB - we need to check that there is enough space left to create a copy of the save (for a rename)
|
||||||
bool bCanRename = StorageManager.EnoughSpaceForAMinSaveGame();
|
bool bCanRename = StorageManager.EnoughSpaceForAMinSaveGame();
|
||||||
ui.SetTooltips( DEFAULT_XUI_MENU_USER, IDS_TOOLTIPS_SELECT,IDS_TOOLTIPS_BACK,IDS_TOOLTIPS_CHANGEDEVICE,-1,-1,-1,-1,bCanRename?IDS_TOOLTIPS_SAVEOPTIONS:IDS_TOOLTIPS_DELETESAVE);
|
ui.SetTooltips( DEFAULT_XUI_MENU_USER, IDS_TOOLTIPS_SELECT,IDS_TOOLTIPS_BACK,IDS_TOOLTIPS_CHANGEDEVICE,-1,-1,-1,-1,bCanRename?IDS_TOOLTIPS_SAVEOPTIONS:IDS_TOOLTIPS_DELETESAVE);
|
||||||
|
|
||||||
GetSaveInfo();
|
GetSaveInfo();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -165,7 +165,7 @@ HRESULT CScene_MultiGameJoinLoad::OnInit( XUIMessageInit* pInitData, BOOL& bHand
|
||||||
|
|
||||||
// 4J Stu - Fix for #12530 -TCR 001 BAS Game Stability: Title will crash if the player disconnects while starting a new world and then opts to play the tutorial once they have been returned to the Main Menu.
|
// 4J Stu - Fix for #12530 -TCR 001 BAS Game Stability: Title will crash if the player disconnects while starting a new world and then opts to play the tutorial once they have been returned to the Main Menu.
|
||||||
MinecraftServer::resetFlags();
|
MinecraftServer::resetFlags();
|
||||||
|
|
||||||
// If we're not ignoring input, then we aren't still waiting for the DLC to mount, and can now check for corrupt dlc. Otherwise this will happen when the dlc has finished mounting.
|
// If we're not ignoring input, then we aren't still waiting for the DLC to mount, and can now check for corrupt dlc. Otherwise this will happen when the dlc has finished mounting.
|
||||||
if( !m_bIgnoreInput)
|
if( !m_bIgnoreInput)
|
||||||
{
|
{
|
||||||
|
|
@ -191,7 +191,7 @@ HRESULT CScene_MultiGameJoinLoad::OnInit( XUIMessageInit* pInitData, BOOL& bHand
|
||||||
bool bTexturePackAlreadyListed;
|
bool bTexturePackAlreadyListed;
|
||||||
bool bNeedToGetTPD=false;
|
bool bNeedToGetTPD=false;
|
||||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||||
int texturePacksCount = pMinecraft->skins->getTexturePackCount();
|
int texturePacksCount = pMinecraft->skins->getTexturePackCount();
|
||||||
//CXuiCtrl4JList::LIST_ITEM_INFO ListInfo;
|
//CXuiCtrl4JList::LIST_ITEM_INFO ListInfo;
|
||||||
//HRESULT hr;
|
//HRESULT hr;
|
||||||
|
|
||||||
|
|
@ -267,9 +267,8 @@ void CScene_MultiGameJoinLoad::AddDefaultButtons()
|
||||||
int iGeneratorIndex = 0;
|
int iGeneratorIndex = 0;
|
||||||
m_iMashUpButtonsC=0;
|
m_iMashUpButtonsC=0;
|
||||||
|
|
||||||
for(AUTO_VAR(it, m_generators->begin()); it != m_generators->end(); ++it)
|
for (LevelGenerationOptions *levelGen : *m_generators )
|
||||||
{
|
{
|
||||||
LevelGenerationOptions *levelGen = *it;
|
|
||||||
ListInfo.pwszText = levelGen->getWorldName();
|
ListInfo.pwszText = levelGen->getWorldName();
|
||||||
ListInfo.fEnabled = TRUE;
|
ListInfo.fEnabled = TRUE;
|
||||||
ListInfo.iData = iGeneratorIndex++; // used to index into the list of generators
|
ListInfo.iData = iGeneratorIndex++; // used to index into the list of generators
|
||||||
|
|
@ -295,7 +294,7 @@ void CScene_MultiGameJoinLoad::AddDefaultButtons()
|
||||||
// increment the count of the mash-up pack worlds in the save list
|
// increment the count of the mash-up pack worlds in the save list
|
||||||
m_iMashUpButtonsC++;
|
m_iMashUpButtonsC++;
|
||||||
TexturePack *tp = Minecraft::GetInstance()->skins->getTexturePackById(levelGen->getRequiredTexturePackId());
|
TexturePack *tp = Minecraft::GetInstance()->skins->getTexturePackById(levelGen->getRequiredTexturePackId());
|
||||||
DWORD dwImageBytes;
|
DWORD dwImageBytes;
|
||||||
PBYTE pbImageData = tp->getPackIcon(dwImageBytes);
|
PBYTE pbImageData = tp->getPackIcon(dwImageBytes);
|
||||||
HXUIBRUSH hXuiBrush;
|
HXUIBRUSH hXuiBrush;
|
||||||
|
|
||||||
|
|
@ -353,8 +352,8 @@ HRESULT CScene_MultiGameJoinLoad::GetSaveInfo( )
|
||||||
ListInfo.fEnabled=TRUE;
|
ListInfo.fEnabled=TRUE;
|
||||||
ListInfo.iData = -1;
|
ListInfo.iData = -1;
|
||||||
m_pSavesList->AddData(ListInfo);
|
m_pSavesList->AddData(ListInfo);
|
||||||
}
|
}
|
||||||
m_pSavesList->SetCurSelVisible(0);
|
m_pSavesList->SetCurSelVisible(0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -387,9 +386,9 @@ HRESULT CScene_MultiGameJoinLoad::OnDestroy()
|
||||||
{
|
{
|
||||||
g_NetworkManager.SetSessionsUpdatedCallback( NULL, NULL );
|
g_NetworkManager.SetSessionsUpdatedCallback( NULL, NULL );
|
||||||
|
|
||||||
for(AUTO_VAR(it, currentSessions.begin()); it < currentSessions.end(); ++it)
|
for (auto& it : currentSessions )
|
||||||
{
|
{
|
||||||
delete (*it);
|
delete it;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(m_bSaveTransferInProgress)
|
if(m_bSaveTransferInProgress)
|
||||||
|
|
@ -419,7 +418,7 @@ int CScene_MultiGameJoinLoad::DeviceRemovedDialogReturned(void *pParam,int iPad,
|
||||||
CScene_MultiGameJoinLoad* pClass = (CScene_MultiGameJoinLoad*)pParam;
|
CScene_MultiGameJoinLoad* pClass = (CScene_MultiGameJoinLoad*)pParam;
|
||||||
|
|
||||||
// results switched for this dialog
|
// results switched for this dialog
|
||||||
if(result==C4JStorage::EMessage_ResultDecline)
|
if(result==C4JStorage::EMessage_ResultDecline)
|
||||||
{
|
{
|
||||||
StorageManager.SetSaveDisabled(true);
|
StorageManager.SetSaveDisabled(true);
|
||||||
StorageManager.SetSaveDeviceSelected(ProfileManager.GetPrimaryPad(),false);
|
StorageManager.SetSaveDeviceSelected(ProfileManager.GetPrimaryPad(),false);
|
||||||
|
|
@ -462,7 +461,7 @@ HRESULT CScene_MultiGameJoinLoad::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotify
|
||||||
//CScene_MultiGameInfo::JoinMenuInitData *initData = new CScene_MultiGameInfo::JoinMenuInitData();
|
//CScene_MultiGameInfo::JoinMenuInitData *initData = new CScene_MultiGameInfo::JoinMenuInitData();
|
||||||
m_initData->iPad = m_iPad;
|
m_initData->iPad = m_iPad;
|
||||||
m_initData->selectedSession = currentSessions.at( nIndex );
|
m_initData->selectedSession = currentSessions.at( nIndex );
|
||||||
|
|
||||||
// check that we have the texture pack available
|
// check that we have the texture pack available
|
||||||
// If it's not the default texture pack
|
// If it's not the default texture pack
|
||||||
if(m_initData->selectedSession->data.texturePackParentId!=0)
|
if(m_initData->selectedSession->data.texturePackParentId!=0)
|
||||||
|
|
@ -513,7 +512,7 @@ HRESULT CScene_MultiGameJoinLoad::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotify
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_NetGamesListTimer.SetShow( FALSE );
|
m_NetGamesListTimer.SetShow( FALSE );
|
||||||
|
|
||||||
// Reset the background downloading, in case we changed it by attempting to download a texture pack
|
// Reset the background downloading, in case we changed it by attempting to download a texture pack
|
||||||
|
|
@ -536,7 +535,7 @@ HRESULT CScene_MultiGameJoinLoad::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotify
|
||||||
CXuiCtrl4JList::LIST_ITEM_INFO info = m_pSavesList->GetData(iIndex);
|
CXuiCtrl4JList::LIST_ITEM_INFO info = m_pSavesList->GetData(iIndex);
|
||||||
|
|
||||||
if(iIndex == JOIN_LOAD_CREATE_BUTTON_INDEX)
|
if(iIndex == JOIN_LOAD_CREATE_BUTTON_INDEX)
|
||||||
{
|
{
|
||||||
app.SetTutorialMode( false );
|
app.SetTutorialMode( false );
|
||||||
m_NetGamesListTimer.SetShow( FALSE );
|
m_NetGamesListTimer.SetShow( FALSE );
|
||||||
|
|
||||||
|
|
@ -571,7 +570,7 @@ HRESULT CScene_MultiGameJoinLoad::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotify
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// check if this is a damaged save
|
// check if this is a damaged save
|
||||||
if(m_pSavesList->GetData(iIndex).bIsDamaged)
|
if(m_pSavesList->GetData(iIndex).bIsDamaged)
|
||||||
{
|
{
|
||||||
|
|
@ -582,7 +581,7 @@ HRESULT CScene_MultiGameJoinLoad::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotify
|
||||||
StorageManager.RequestMessageBox(IDS_CORRUPT_OR_DAMAGED_SAVE_TITLE, IDS_CORRUPT_OR_DAMAGED_SAVE_TEXT, uiIDA, 2, pNotifyPressData->UserIndex,&CScene_MultiGameJoinLoad::DeleteSaveDialogReturned,this, app.GetStringTable());
|
StorageManager.RequestMessageBox(IDS_CORRUPT_OR_DAMAGED_SAVE_TITLE, IDS_CORRUPT_OR_DAMAGED_SAVE_TEXT, uiIDA, 2, pNotifyPressData->UserIndex,&CScene_MultiGameJoinLoad::DeleteSaveDialogReturned,this, app.GetStringTable());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
app.SetTutorialMode( false );
|
app.SetTutorialMode( false );
|
||||||
if(app.DebugSettingsOn() && app.GetLoadSavesFromFolderEnabled())
|
if(app.DebugSettingsOn() && app.GetLoadSavesFromFolderEnabled())
|
||||||
{
|
{
|
||||||
|
|
@ -605,7 +604,7 @@ HRESULT CScene_MultiGameJoinLoad::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotify
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -632,11 +631,11 @@ HRESULT CScene_MultiGameJoinLoad::OnKeyDown(XUIMessageInput* pInputData, BOOL& r
|
||||||
|
|
||||||
app.NavigateBack(XUSER_INDEX_ANY);
|
app.NavigateBack(XUSER_INDEX_ANY);
|
||||||
rfHandled = TRUE;
|
rfHandled = TRUE;
|
||||||
break;
|
break;
|
||||||
case VK_PAD_X:
|
case VK_PAD_X:
|
||||||
|
|
||||||
// Change device
|
// Change device
|
||||||
// Fix for #12531 - TCR 001: BAS Game Stability: When a player selects to change a storage
|
// Fix for #12531 - TCR 001: BAS Game Stability: When a player selects to change a storage
|
||||||
// device, and repeatedly backs out of the SD screen, disconnects from LIVE, and then selects a SD, the title crashes.
|
// device, and repeatedly backs out of the SD screen, disconnects from LIVE, and then selects a SD, the title crashes.
|
||||||
m_bIgnoreInput=true;
|
m_bIgnoreInput=true;
|
||||||
StorageManager.SetSaveDevice(&CScene_MultiGameJoinLoad::DeviceSelectReturned,this,true);
|
StorageManager.SetSaveDevice(&CScene_MultiGameJoinLoad::DeviceSelectReturned,this,true);
|
||||||
|
|
@ -657,7 +656,7 @@ HRESULT CScene_MultiGameJoinLoad::OnKeyDown(XUIMessageInput* pInputData, BOOL& r
|
||||||
{
|
{
|
||||||
// save transfer - make sure they want to overwrite a save that is up there
|
// save transfer - make sure they want to overwrite a save that is up there
|
||||||
if(ProfileManager.IsSignedInLive( m_iPad ))
|
if(ProfileManager.IsSignedInLive( m_iPad ))
|
||||||
{
|
{
|
||||||
// 4J-PB - required for a delete of the save if it's found to be a corrupted save
|
// 4J-PB - required for a delete of the save if it's found to be a corrupted save
|
||||||
DWORD nIndex = m_pSavesList->GetCurSel();
|
DWORD nIndex = m_pSavesList->GetCurSel();
|
||||||
m_iChangingSaveGameInfoIndex=m_pSavesList->GetData(nIndex).iIndex;
|
m_iChangingSaveGameInfoIndex=m_pSavesList->GetData(nIndex).iIndex;
|
||||||
|
|
@ -668,13 +667,13 @@ HRESULT CScene_MultiGameJoinLoad::OnKeyDown(XUIMessageInput* pInputData, BOOL& r
|
||||||
|
|
||||||
ui.RequestMessageBox(IDS_SAVE_TRANSFER_TITLE, IDS_SAVE_TRANSFER_TEXT, uiIDA, 2, pInputData->UserIndex,&CScene_MultiGameJoinLoad::SaveTransferDialogReturned,this, app.GetStringTable());
|
ui.RequestMessageBox(IDS_SAVE_TRANSFER_TITLE, IDS_SAVE_TRANSFER_TEXT, uiIDA, 2, pInputData->UserIndex,&CScene_MultiGameJoinLoad::SaveTransferDialogReturned,this, app.GetStringTable());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case VK_PAD_RSHOULDER:
|
case VK_PAD_RSHOULDER:
|
||||||
if(DoesSavesListHaveFocus())
|
if(DoesSavesListHaveFocus())
|
||||||
{
|
{
|
||||||
m_bIgnoreInput = true;
|
m_bIgnoreInput = true;
|
||||||
|
|
||||||
int iIndex=m_SavesList.GetCurSel();
|
int iIndex=m_SavesList.GetCurSel();
|
||||||
m_iChangingSaveGameInfoIndex=m_pSavesList->GetData(iIndex).iIndex;
|
m_iChangingSaveGameInfoIndex=m_pSavesList->GetData(iIndex).iIndex;
|
||||||
|
|
||||||
|
|
@ -755,19 +754,19 @@ HRESULT CScene_MultiGameJoinLoad::OnKeyDown(XUIMessageInput* pInputData, BOOL& r
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT CScene_MultiGameJoinLoad::OnNavReturn(HXUIOBJ hSceneFrom,BOOL& rfHandled)
|
HRESULT CScene_MultiGameJoinLoad::OnNavReturn(HXUIOBJ hSceneFrom,BOOL& rfHandled)
|
||||||
{
|
{
|
||||||
|
|
||||||
CXuiSceneBase::ShowLogo( DEFAULT_XUI_MENU_USER, TRUE );
|
CXuiSceneBase::ShowLogo( DEFAULT_XUI_MENU_USER, TRUE );
|
||||||
// start the texture pack timer again
|
// start the texture pack timer again
|
||||||
XuiSetTimer(m_hObj,CHECKFORAVAILABLETEXTUREPACKS_TIMER_ID,CHECKFORAVAILABLETEXTUREPACKS_TIMER_TIME);
|
XuiSetTimer(m_hObj,CHECKFORAVAILABLETEXTUREPACKS_TIMER_ID,CHECKFORAVAILABLETEXTUREPACKS_TIMER_TIME);
|
||||||
|
|
||||||
m_bMultiplayerAllowed = ProfileManager.IsSignedInLive( m_iPad ) && ProfileManager.AllowedToPlayMultiplayer(m_iPad);
|
m_bMultiplayerAllowed = ProfileManager.IsSignedInLive( m_iPad ) && ProfileManager.AllowedToPlayMultiplayer(m_iPad);
|
||||||
|
|
||||||
// re-enable button presses
|
// re-enable button presses
|
||||||
m_bIgnoreInput=false;
|
m_bIgnoreInput=false;
|
||||||
|
|
||||||
|
|
@ -812,7 +811,7 @@ HRESULT CScene_MultiGameJoinLoad::OnNavReturn(HXUIOBJ hSceneFrom,BOOL& rfHandled
|
||||||
iY = IDS_TOOLTIPS_VIEW_GAMERCARD;
|
iY = IDS_TOOLTIPS_VIEW_GAMERCARD;
|
||||||
}
|
}
|
||||||
else if(DoesSavesListHaveFocus())
|
else if(DoesSavesListHaveFocus())
|
||||||
{
|
{
|
||||||
if(ProfileManager.IsSignedInLive( m_iPad ))
|
if(ProfileManager.IsSignedInLive( m_iPad ))
|
||||||
{
|
{
|
||||||
iY=IDS_TOOLTIPS_UPLOAD_SAVE_FOR_XBOXONE;
|
iY=IDS_TOOLTIPS_UPLOAD_SAVE_FOR_XBOXONE;
|
||||||
|
|
@ -901,7 +900,7 @@ HRESULT CScene_MultiGameJoinLoad::OnTransitionStart( XUIMessageTransition *pTran
|
||||||
if(pTransition->dwTransType == XUI_TRANSITION_BACKTO)
|
if(pTransition->dwTransType == XUI_TRANSITION_BACKTO)
|
||||||
{
|
{
|
||||||
// Can't call this here because if you back out of the load info screen and then go back in and load a game, it will attempt to use the dlc as it's running a mount of the dlc
|
// Can't call this here because if you back out of the load info screen and then go back in and load a game, it will attempt to use the dlc as it's running a mount of the dlc
|
||||||
|
|
||||||
// block input if we're waiting for DLC to install, and wipe the saves list. The end of dlc mounting custom message will fill the list again
|
// block input if we're waiting for DLC to install, and wipe the saves list. The end of dlc mounting custom message will fill the list again
|
||||||
if(app.StartInstallDLCProcess(m_iPad)==false)
|
if(app.StartInstallDLCProcess(m_iPad)==false)
|
||||||
{
|
{
|
||||||
|
|
@ -925,14 +924,14 @@ HRESULT CScene_MultiGameJoinLoad::OnFontRendererChange()
|
||||||
// update the tooltips
|
// update the tooltips
|
||||||
// if the saves list has focus, then we should show the Delete Save tooltip
|
// if the saves list has focus, then we should show the Delete Save tooltip
|
||||||
// if the games list has focus, then we should the the View Gamercard tooltip
|
// if the games list has focus, then we should the the View Gamercard tooltip
|
||||||
int iRB=-1;
|
int iRB=-1;
|
||||||
int iY = -1;
|
int iY = -1;
|
||||||
if( DoesGamesListHaveFocus() )
|
if( DoesGamesListHaveFocus() )
|
||||||
{
|
{
|
||||||
iY = IDS_TOOLTIPS_VIEW_GAMERCARD;
|
iY = IDS_TOOLTIPS_VIEW_GAMERCARD;
|
||||||
}
|
}
|
||||||
else if(DoesSavesListHaveFocus())
|
else if(DoesSavesListHaveFocus())
|
||||||
{
|
{
|
||||||
if(ProfileManager.IsSignedInLive( m_iPad ))
|
if(ProfileManager.IsSignedInLive( m_iPad ))
|
||||||
{
|
{
|
||||||
iY=IDS_TOOLTIPS_UPLOAD_SAVE_FOR_XBOXONE;
|
iY=IDS_TOOLTIPS_UPLOAD_SAVE_FOR_XBOXONE;
|
||||||
|
|
@ -986,12 +985,12 @@ HRESULT CScene_MultiGameJoinLoad::OnNotifySetFocus(HXUIOBJ hObjSource, XUINotify
|
||||||
// update the tooltips
|
// update the tooltips
|
||||||
// if the saves list has focus, then we should show the Delete Save tooltip
|
// if the saves list has focus, then we should show the Delete Save tooltip
|
||||||
// if the games list has focus, then we should the the View Gamercard tooltip
|
// if the games list has focus, then we should the the View Gamercard tooltip
|
||||||
int iRB=-1;
|
int iRB=-1;
|
||||||
int iY = -1;
|
int iY = -1;
|
||||||
if( DoesGamesListHaveFocus() )
|
if( DoesGamesListHaveFocus() )
|
||||||
{
|
{
|
||||||
iY = IDS_TOOLTIPS_VIEW_GAMERCARD;
|
iY = IDS_TOOLTIPS_VIEW_GAMERCARD;
|
||||||
}
|
}
|
||||||
else if(DoesSavesListHaveFocus())
|
else if(DoesSavesListHaveFocus())
|
||||||
{
|
{
|
||||||
if(ProfileManager.IsSignedInLive( m_iPad ))
|
if(ProfileManager.IsSignedInLive( m_iPad ))
|
||||||
|
|
@ -1118,7 +1117,7 @@ void CScene_MultiGameJoinLoad::UpdateGamesListCallback(LPVOID lpParam)
|
||||||
// check this there's no save transfer in progress
|
// check this there's no save transfer in progress
|
||||||
if(!pClass->m_bSaveTransferInProgress)
|
if(!pClass->m_bSaveTransferInProgress)
|
||||||
{
|
{
|
||||||
pClass->UpdateGamesList();
|
pClass->UpdateGamesList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1145,17 +1144,17 @@ void CScene_MultiGameJoinLoad::UpdateGamesList()
|
||||||
if( pSelectedSession != NULL )selectedSessionId = pSelectedSession->sessionId;
|
if( pSelectedSession != NULL )selectedSessionId = pSelectedSession->sessionId;
|
||||||
pSelectedSession = NULL;
|
pSelectedSession = NULL;
|
||||||
|
|
||||||
for(AUTO_VAR(it, currentSessions.begin()); it < currentSessions.end(); ++it)
|
for (auto& it : currentSessions )
|
||||||
{
|
{
|
||||||
delete (*it);
|
delete it;
|
||||||
}
|
}
|
||||||
currentSessions.clear();
|
currentSessions.clear();
|
||||||
|
|
||||||
m_NetGamesListTimer.SetShow( FALSE );
|
m_NetGamesListTimer.SetShow( FALSE );
|
||||||
|
|
||||||
// if the saves list has focus, then we should show the Delete Save tooltip
|
// if the saves list has focus, then we should show the Delete Save tooltip
|
||||||
// if the games list has focus, then we should show the View Gamercard tooltip
|
// if the games list has focus, then we should show the View Gamercard tooltip
|
||||||
int iRB=-1;
|
int iRB=-1;
|
||||||
int iY = -1;
|
int iY = -1;
|
||||||
|
|
||||||
if( DoesGamesListHaveFocus() )
|
if( DoesGamesListHaveFocus() )
|
||||||
|
|
@ -1163,7 +1162,7 @@ void CScene_MultiGameJoinLoad::UpdateGamesList()
|
||||||
iY = IDS_TOOLTIPS_VIEW_GAMERCARD;
|
iY = IDS_TOOLTIPS_VIEW_GAMERCARD;
|
||||||
}
|
}
|
||||||
else if(DoesSavesListHaveFocus())
|
else if(DoesSavesListHaveFocus())
|
||||||
{
|
{
|
||||||
if(ProfileManager.IsSignedInLive( m_iPad ))
|
if(ProfileManager.IsSignedInLive( m_iPad ))
|
||||||
{
|
{
|
||||||
iY=IDS_TOOLTIPS_UPLOAD_SAVE_FOR_XBOXONE;
|
iY=IDS_TOOLTIPS_UPLOAD_SAVE_FOR_XBOXONE;
|
||||||
|
|
@ -1248,9 +1247,8 @@ void CScene_MultiGameJoinLoad::UpdateGamesList()
|
||||||
unsigned int sessionIndex = 0;
|
unsigned int sessionIndex = 0;
|
||||||
m_pGamesList->SetCurSel(0);
|
m_pGamesList->SetCurSel(0);
|
||||||
|
|
||||||
for( AUTO_VAR(it, currentSessions.begin()); it < currentSessions.end(); ++it)
|
for ( FriendSessionInfo *sessionInfo : currentSessions )
|
||||||
{
|
{
|
||||||
FriendSessionInfo *sessionInfo = *it;
|
|
||||||
HXUIBRUSH hXuiBrush;
|
HXUIBRUSH hXuiBrush;
|
||||||
CXuiCtrl4JList::LIST_ITEM_INFO ListInfo;
|
CXuiCtrl4JList::LIST_ITEM_INFO ListInfo;
|
||||||
|
|
||||||
|
|
@ -1282,7 +1280,7 @@ void CScene_MultiGameJoinLoad::UpdateGamesList()
|
||||||
// is it in the tpd data ?
|
// is it in the tpd data ?
|
||||||
app.GetFileFromTPD(eTPDFileType_Icon,pbData,dwBytes,&pbImageData,&dwImageBytes );
|
app.GetFileFromTPD(eTPDFileType_Icon,pbData,dwBytes,&pbImageData,&dwImageBytes );
|
||||||
if(dwImageBytes > 0 && pbImageData)
|
if(dwImageBytes > 0 && pbImageData)
|
||||||
{
|
{
|
||||||
hr=XuiCreateTextureBrushFromMemory(pbImageData,dwImageBytes,&hXuiBrush);
|
hr=XuiCreateTextureBrushFromMemory(pbImageData,dwImageBytes,&hXuiBrush);
|
||||||
m_pGamesList->UpdateGraphic(sessionIndex,hXuiBrush);
|
m_pGamesList->UpdateGraphic(sessionIndex,hXuiBrush);
|
||||||
}
|
}
|
||||||
|
|
@ -1291,7 +1289,7 @@ void CScene_MultiGameJoinLoad::UpdateGamesList()
|
||||||
{
|
{
|
||||||
pbImageData = tp->getPackIcon(dwImageBytes);
|
pbImageData = tp->getPackIcon(dwImageBytes);
|
||||||
if(dwImageBytes > 0 && pbImageData)
|
if(dwImageBytes > 0 && pbImageData)
|
||||||
{
|
{
|
||||||
hr=XuiCreateTextureBrushFromMemory(pbImageData,dwImageBytes,&hXuiBrush);
|
hr=XuiCreateTextureBrushFromMemory(pbImageData,dwImageBytes,&hXuiBrush);
|
||||||
m_pGamesList->UpdateGraphic(sessionIndex,hXuiBrush);
|
m_pGamesList->UpdateGraphic(sessionIndex,hXuiBrush);
|
||||||
}
|
}
|
||||||
|
|
@ -1303,7 +1301,7 @@ void CScene_MultiGameJoinLoad::UpdateGamesList()
|
||||||
XuiCreateTextureBrushFromMemory(m_DefaultMinecraftIconData,m_DefaultMinecraftIconSize,&hXuiBrush);
|
XuiCreateTextureBrushFromMemory(m_DefaultMinecraftIconData,m_DefaultMinecraftIconSize,&hXuiBrush);
|
||||||
m_pGamesList->UpdateGraphic(sessionIndex,hXuiBrush);
|
m_pGamesList->UpdateGraphic(sessionIndex,hXuiBrush);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(memcmp( &selectedSessionId, &sessionInfo->sessionId, sizeof(SessionID) ) == 0)
|
if(memcmp( &selectedSessionId, &sessionInfo->sessionId, sizeof(SessionID) ) == 0)
|
||||||
{
|
{
|
||||||
|
|
@ -1324,14 +1322,14 @@ void CScene_MultiGameJoinLoad::UpdateGamesList(DWORD dwNumResults, IQNetGameSear
|
||||||
|
|
||||||
if(m_searches>0)
|
if(m_searches>0)
|
||||||
--m_searches;
|
--m_searches;
|
||||||
|
|
||||||
if(m_searches==0)
|
if(m_searches==0)
|
||||||
{
|
{
|
||||||
m_NetGamesListTimer.SetShow( FALSE );
|
m_NetGamesListTimer.SetShow( FALSE );
|
||||||
|
|
||||||
// if the saves list has focus, then we should show the Delete Save tooltip
|
// if the saves list has focus, then we should show the Delete Save tooltip
|
||||||
// if the games list has focus, then we should show the View Gamercard tooltip
|
// if the games list has focus, then we should show the View Gamercard tooltip
|
||||||
int iRB=-1;
|
int iRB=-1;
|
||||||
int iY = -1;
|
int iY = -1;
|
||||||
|
|
||||||
if( DoesGamesListHaveFocus() )
|
if( DoesGamesListHaveFocus() )
|
||||||
|
|
@ -1374,7 +1372,7 @@ void CScene_MultiGameJoinLoad::UpdateGamesList(DWORD dwNumResults, IQNetGameSear
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int startOffset = m_GamesList.GetItemCount();
|
unsigned int startOffset = m_GamesList.GetItemCount();
|
||||||
//m_GamesList.InsertItems(startOffset,dwNumResults);
|
//m_GamesList.InsertItems(startOffset,dwNumResults);
|
||||||
//m_GamesList.SetEnable(TRUE);
|
//m_GamesList.SetEnable(TRUE);
|
||||||
//XuiElementSetDisableFocusRecursion( m_GamesList.m_hObj, FALSE);
|
//XuiElementSetDisableFocusRecursion( m_GamesList.m_hObj, FALSE);
|
||||||
|
|
||||||
|
|
@ -1390,7 +1388,7 @@ void CScene_MultiGameJoinLoad::UpdateGamesList(DWORD dwNumResults, IQNetGameSear
|
||||||
|
|
||||||
FriendSessionInfo *sessionInfo = NULL;
|
FriendSessionInfo *sessionInfo = NULL;
|
||||||
bool foundSession = false;
|
bool foundSession = false;
|
||||||
for(AUTO_VAR(it, friendsSessions.begin()); it < friendsSessions.end(); ++it)
|
for( auto it = friendsSessions.begin(); it != friendsSessions.end(); ++it)
|
||||||
{
|
{
|
||||||
sessionInfo = *it;
|
sessionInfo = *it;
|
||||||
if(memcmp( &pSearchResult->info.sessionID, &sessionInfo->sessionId, sizeof(SessionID) ) == 0)
|
if(memcmp( &pSearchResult->info.sessionID, &sessionInfo->sessionId, sizeof(SessionID) ) == 0)
|
||||||
|
|
@ -1449,7 +1447,7 @@ void CScene_MultiGameJoinLoad::UpdateGamesList(DWORD dwNumResults, IQNetGameSear
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( m_GamesList.GetItemCount() == 0)
|
if( m_GamesList.GetItemCount() == 0)
|
||||||
{
|
{
|
||||||
m_LabelNoGames.SetShow( TRUE );
|
m_LabelNoGames.SetShow( TRUE );
|
||||||
|
|
@ -1537,14 +1535,14 @@ int CScene_MultiGameJoinLoad::DeviceSelectReturned(void *pParam,bool bContinue)
|
||||||
{
|
{
|
||||||
// if the saves list has focus, then we should show the Delete Save tooltip
|
// if the saves list has focus, then we should show the Delete Save tooltip
|
||||||
// if the games list has focus, then we should show the View Gamercard tooltip
|
// if the games list has focus, then we should show the View Gamercard tooltip
|
||||||
int iRB=-1;
|
int iRB=-1;
|
||||||
int iY = -1;
|
int iY = -1;
|
||||||
if( pClass->DoesGamesListHaveFocus() )
|
if( pClass->DoesGamesListHaveFocus() )
|
||||||
{
|
{
|
||||||
iY = IDS_TOOLTIPS_VIEW_GAMERCARD;
|
iY = IDS_TOOLTIPS_VIEW_GAMERCARD;
|
||||||
}
|
}
|
||||||
else if(pClass->DoesSavesListHaveFocus())
|
else if(pClass->DoesSavesListHaveFocus())
|
||||||
{
|
{
|
||||||
if(ProfileManager.IsSignedInLive( pClass->m_iPad ))
|
if(ProfileManager.IsSignedInLive( pClass->m_iPad ))
|
||||||
{
|
{
|
||||||
iY=IDS_TOOLTIPS_UPLOAD_SAVE_FOR_XBOXONE;
|
iY=IDS_TOOLTIPS_UPLOAD_SAVE_FOR_XBOXONE;
|
||||||
|
|
@ -1593,7 +1591,7 @@ int CScene_MultiGameJoinLoad::DeviceSelectReturned(void *pParam,bool bContinue)
|
||||||
pClass->GetSaveInfo();
|
pClass->GetSaveInfo();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ui.SetTooltips( DEFAULT_XUI_MENU_USER, IDS_TOOLTIPS_SELECT,IDS_TOOLTIPS_BACK,IDS_TOOLTIPS_SELECTDEVICE,iY,-1,-1,iLB,iRB);
|
ui.SetTooltips( DEFAULT_XUI_MENU_USER, IDS_TOOLTIPS_SELECT,IDS_TOOLTIPS_BACK,IDS_TOOLTIPS_SELECTDEVICE,iY,-1,-1,iLB,iRB);
|
||||||
// clear the saves list
|
// clear the saves list
|
||||||
pClass->m_pSavesList->RemoveAllData();
|
pClass->m_pSavesList->RemoveAllData();
|
||||||
|
|
@ -1623,11 +1621,11 @@ int CScene_MultiGameJoinLoad::DeviceSelectReturned(void *pParam,bool bContinue)
|
||||||
|
|
||||||
HRESULT CScene_MultiGameJoinLoad::OnTimer( XUIMessageTimer *pTimer, BOOL& bHandled )
|
HRESULT CScene_MultiGameJoinLoad::OnTimer( XUIMessageTimer *pTimer, BOOL& bHandled )
|
||||||
{
|
{
|
||||||
// 4J-PB - TODO - Don't think we can do this - if a 2nd player signs in here with an offline profile, the signed in LIVE player gets re-logged in, and bMultiplayerAllowed is false briefly
|
// 4J-PB - TODO - Don't think we can do this - if a 2nd player signs in here with an offline profile, the signed in LIVE player gets re-logged in, and bMultiplayerAllowed is false briefly
|
||||||
switch(pTimer->nId)
|
switch(pTimer->nId)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
case JOIN_LOAD_ONLINE_TIMER_ID:
|
case JOIN_LOAD_ONLINE_TIMER_ID:
|
||||||
{
|
{
|
||||||
XPARTY_USER_LIST partyList;
|
XPARTY_USER_LIST partyList;
|
||||||
|
|
@ -1673,7 +1671,7 @@ HRESULT CScene_MultiGameJoinLoad::OnTimer( XUIMessageTimer *pTimer, BOOL& bHandl
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
else if(DoesSavesListHaveFocus())
|
else if(DoesSavesListHaveFocus())
|
||||||
{
|
{
|
||||||
if(ProfileManager.IsSignedInLive( m_iPad ))
|
if(ProfileManager.IsSignedInLive( m_iPad ))
|
||||||
{
|
{
|
||||||
iY=IDS_TOOLTIPS_UPLOAD_SAVE_FOR_XBOXONE;
|
iY=IDS_TOOLTIPS_UPLOAD_SAVE_FOR_XBOXONE;
|
||||||
|
|
@ -1737,7 +1735,7 @@ HRESULT CScene_MultiGameJoinLoad::OnTimer( XUIMessageTimer *pTimer, BOOL& bHandl
|
||||||
|
|
||||||
//CXuiCtrl4JList::LIST_ITEM_INFO ListInfo;
|
//CXuiCtrl4JList::LIST_ITEM_INFO ListInfo;
|
||||||
// for each iConfig, check if the data is available, and add it to the List, then remove it from the viConfig
|
// for each iConfig, check if the data is available, and add it to the List, then remove it from the viConfig
|
||||||
|
|
||||||
for(int i=0;i<m_iTexturePacksNotInstalled;i++)
|
for(int i=0;i<m_iTexturePacksNotInstalled;i++)
|
||||||
{
|
{
|
||||||
if(m_iConfigA[i]!=-1)
|
if(m_iConfigA[i]!=-1)
|
||||||
|
|
@ -1760,7 +1758,7 @@ HRESULT CScene_MultiGameJoinLoad::OnTimer( XUIMessageTimer *pTimer, BOOL& bHandl
|
||||||
bool bAllDone=true;
|
bool bAllDone=true;
|
||||||
for(int i=0;i<m_iTexturePacksNotInstalled;i++)
|
for(int i=0;i<m_iTexturePacksNotInstalled;i++)
|
||||||
{
|
{
|
||||||
if(m_iConfigA[i]!=-1)
|
if(m_iConfigA[i]!=-1)
|
||||||
{
|
{
|
||||||
bAllDone = false;
|
bAllDone = false;
|
||||||
}
|
}
|
||||||
|
|
@ -1878,25 +1876,25 @@ int CScene_MultiGameJoinLoad::DeleteSaveDataReturned(void *pParam,bool bSuccess)
|
||||||
pClass->m_iSaveInfoC=0;
|
pClass->m_iSaveInfoC=0;
|
||||||
pClass->GetSaveInfo();
|
pClass->GetSaveInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
pClass->m_bIgnoreInput=false;
|
pClass->m_bIgnoreInput=false;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CScene_MultiGameJoinLoad::LoadLevelGen(LevelGenerationOptions *levelGen)
|
void CScene_MultiGameJoinLoad::LoadLevelGen(LevelGenerationOptions *levelGen)
|
||||||
{
|
{
|
||||||
// Load data from disc
|
// Load data from disc
|
||||||
//File saveFile( L"Tutorial\\Tutorial" );
|
//File saveFile( L"Tutorial\\Tutorial" );
|
||||||
//LoadSaveFromDisk(&saveFile);
|
//LoadSaveFromDisk(&saveFile);
|
||||||
|
|
||||||
// clear out the app's terrain features list
|
// clear out the app's terrain features list
|
||||||
app.ClearTerrainFeaturePosition();
|
app.ClearTerrainFeaturePosition();
|
||||||
|
|
||||||
StorageManager.ResetSaveData();
|
StorageManager.ResetSaveData();
|
||||||
// Make our next save default to the name of the level
|
// Make our next save default to the name of the level
|
||||||
StorageManager.SetSaveTitle(levelGen->getDefaultSaveName().c_str());
|
StorageManager.SetSaveTitle(levelGen->getDefaultSaveName().c_str());
|
||||||
|
|
||||||
bool isClientSide = false;
|
bool isClientSide = false;
|
||||||
bool isPrivate = false;
|
bool isPrivate = false;
|
||||||
int maxPlayers = MINECRAFT_NET_MAX_PLAYERS;
|
int maxPlayers = MINECRAFT_NET_MAX_PLAYERS;
|
||||||
|
|
@ -1918,7 +1916,7 @@ void CScene_MultiGameJoinLoad::LoadLevelGen(LevelGenerationOptions *levelGen)
|
||||||
if(levelGen->requiresTexturePack())
|
if(levelGen->requiresTexturePack())
|
||||||
{
|
{
|
||||||
param->texturePackId = levelGen->getRequiredTexturePackId();
|
param->texturePackId = levelGen->getRequiredTexturePackId();
|
||||||
|
|
||||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||||
pMinecraft->skins->selectTexturePackById(param->texturePackId);
|
pMinecraft->skins->selectTexturePackById(param->texturePackId);
|
||||||
//pMinecraft->skins->updateUI();
|
//pMinecraft->skins->updateUI();
|
||||||
|
|
@ -1939,7 +1937,7 @@ void CScene_MultiGameJoinLoad::LoadLevelGen(LevelGenerationOptions *levelGen)
|
||||||
}
|
}
|
||||||
|
|
||||||
void CScene_MultiGameJoinLoad::LoadSaveFromDisk(File *saveFile)
|
void CScene_MultiGameJoinLoad::LoadSaveFromDisk(File *saveFile)
|
||||||
{
|
{
|
||||||
// we'll only be coming in here when the tutorial is loaded now
|
// we'll only be coming in here when the tutorial is loaded now
|
||||||
|
|
||||||
StorageManager.ResetSaveData();
|
StorageManager.ResetSaveData();
|
||||||
|
|
@ -1952,7 +1950,7 @@ void CScene_MultiGameJoinLoad::LoadSaveFromDisk(File *saveFile)
|
||||||
byteArray ba(fileSize);
|
byteArray ba(fileSize);
|
||||||
fis.read(ba);
|
fis.read(ba);
|
||||||
fis.close();
|
fis.close();
|
||||||
|
|
||||||
bool isClientSide = false;
|
bool isClientSide = false;
|
||||||
bool isPrivate = false;
|
bool isPrivate = false;
|
||||||
int maxPlayers = MINECRAFT_NET_MAX_PLAYERS;
|
int maxPlayers = MINECRAFT_NET_MAX_PLAYERS;
|
||||||
|
|
@ -1962,7 +1960,7 @@ void CScene_MultiGameJoinLoad::LoadSaveFromDisk(File *saveFile)
|
||||||
isClientSide = false;
|
isClientSide = false;
|
||||||
maxPlayers = 4;
|
maxPlayers = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
app.SetGameHostOption(eGameHostOption_GameType,GameType::CREATIVE->getId());
|
app.SetGameHostOption(eGameHostOption_GameType,GameType::CREATIVE->getId());
|
||||||
|
|
||||||
g_NetworkManager.HostGame(0,isClientSide,isPrivate,maxPlayers,0);
|
g_NetworkManager.HostGame(0,isClientSide,isPrivate,maxPlayers,0);
|
||||||
|
|
@ -1992,7 +1990,7 @@ int CScene_MultiGameJoinLoad::DeleteSaveDialogReturned(void *pParam,int iPad,C4J
|
||||||
{
|
{
|
||||||
CScene_MultiGameJoinLoad* pClass = (CScene_MultiGameJoinLoad*)pParam;
|
CScene_MultiGameJoinLoad* pClass = (CScene_MultiGameJoinLoad*)pParam;
|
||||||
// results switched for this dialog
|
// results switched for this dialog
|
||||||
if(result==C4JStorage::EMessage_ResultDecline)
|
if(result==C4JStorage::EMessage_ResultDecline)
|
||||||
{
|
{
|
||||||
if(app.DebugSettingsOn() && app.GetLoadSavesFromFolderEnabled())
|
if(app.DebugSettingsOn() && app.GetLoadSavesFromFolderEnabled())
|
||||||
{
|
{
|
||||||
|
|
@ -2017,7 +2015,7 @@ int CScene_MultiGameJoinLoad::SaveTransferDialogReturned(void *pParam,int iPad,C
|
||||||
{
|
{
|
||||||
CScene_MultiGameJoinLoad* pClass = (CScene_MultiGameJoinLoad*)pParam;
|
CScene_MultiGameJoinLoad* pClass = (CScene_MultiGameJoinLoad*)pParam;
|
||||||
// results switched for this dialog
|
// results switched for this dialog
|
||||||
if(result==C4JStorage::EMessage_ResultAccept)
|
if(result==C4JStorage::EMessage_ResultAccept)
|
||||||
{
|
{
|
||||||
// upload the save
|
// upload the save
|
||||||
|
|
||||||
|
|
@ -2042,7 +2040,7 @@ int CScene_MultiGameJoinLoad::SaveTransferDialogReturned(void *pParam,int iPad,C
|
||||||
int CScene_MultiGameJoinLoad::UploadSaveForXboxOneThreadProc( LPVOID lpParameter )
|
int CScene_MultiGameJoinLoad::UploadSaveForXboxOneThreadProc( LPVOID lpParameter )
|
||||||
{
|
{
|
||||||
CScene_MultiGameJoinLoad* pClass = (CScene_MultiGameJoinLoad *) lpParameter;
|
CScene_MultiGameJoinLoad* pClass = (CScene_MultiGameJoinLoad *) lpParameter;
|
||||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||||
|
|
||||||
pMinecraft->progressRenderer->progressStart(IDS_SAVE_TRANSFER_TITLE);
|
pMinecraft->progressRenderer->progressStart(IDS_SAVE_TRANSFER_TITLE);
|
||||||
pMinecraft->progressRenderer->progressStage( IDS_SAVE_TRANSFER_UPLOADING );
|
pMinecraft->progressRenderer->progressStage( IDS_SAVE_TRANSFER_UPLOADING );
|
||||||
|
|
@ -2092,7 +2090,7 @@ int CScene_MultiGameJoinLoad::UploadSaveForXboxOneThreadProc( LPVOID lpParameter
|
||||||
StorageManager.GetSaveCacheFileInfo(iIndex,XContentData);
|
StorageManager.GetSaveCacheFileInfo(iIndex,XContentData);
|
||||||
StorageManager.GetSaveCacheFileInfo(iIndex,&pbImageData,&dwImageBytes);
|
StorageManager.GetSaveCacheFileInfo(iIndex,&pbImageData,&dwImageBytes);
|
||||||
|
|
||||||
// if there is no thumbnail, retrieve the default one from the file.
|
// if there is no thumbnail, retrieve the default one from the file.
|
||||||
// Don't delete the image data after creating the xuibrush, since we'll use it in the rename of the save
|
// Don't delete the image data after creating the xuibrush, since we'll use it in the rename of the save
|
||||||
if(pbImageData==NULL)
|
if(pbImageData==NULL)
|
||||||
{
|
{
|
||||||
|
|
@ -2143,7 +2141,7 @@ int CScene_MultiGameJoinLoad::UploadSaveForXboxOneThreadProc( LPVOID lpParameter
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
// change text for completion confirmation
|
// change text for completion confirmation
|
||||||
pMinecraft->progressRenderer->progressStage( IDS_SAVE_TRANSFER_UPLOADCOMPLETE );
|
pMinecraft->progressRenderer->progressStage( IDS_SAVE_TRANSFER_UPLOADCOMPLETE );
|
||||||
|
|
||||||
// done
|
// done
|
||||||
|
|
@ -2180,7 +2178,7 @@ void CScene_MultiGameJoinLoad::UploadFile(CScene_MultiGameJoinLoad *pClass, char
|
||||||
C4JStorage::TMS_FILETYPE_BINARY,
|
C4JStorage::TMS_FILETYPE_BINARY,
|
||||||
C4JStorage::TMS_UGCTYPE_NONE,
|
C4JStorage::TMS_UGCTYPE_NONE,
|
||||||
filename,
|
filename,
|
||||||
(CHAR *)data,
|
(CHAR *)data,
|
||||||
size,
|
size,
|
||||||
&CScene_MultiGameJoinLoad::TransferComplete,pClass, 0,
|
&CScene_MultiGameJoinLoad::TransferComplete,pClass, 0,
|
||||||
&CScene_MultiGameJoinLoad::Progress,pClass);
|
&CScene_MultiGameJoinLoad::Progress,pClass);
|
||||||
|
|
@ -2219,7 +2217,7 @@ bool CScene_MultiGameJoinLoad::WaitForTransferComplete( CScene_MultiGameJoinLoad
|
||||||
// cancelled
|
// cancelled
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Sleep(50);
|
Sleep(50);
|
||||||
// update the progress
|
// update the progress
|
||||||
pMinecraft->progressRenderer->progressStagePercentage((unsigned int)(pClass->m_fProgress*100.0f));
|
pMinecraft->progressRenderer->progressStagePercentage((unsigned int)(pClass->m_fProgress*100.0f));
|
||||||
}
|
}
|
||||||
|
|
@ -2235,7 +2233,7 @@ int CScene_MultiGameJoinLoad::SaveOptionsDialogReturned(void *pParam,int iPad,C4
|
||||||
|
|
||||||
// results switched for this dialog
|
// results switched for this dialog
|
||||||
// EMessage_ResultAccept means cancel
|
// EMessage_ResultAccept means cancel
|
||||||
if(result==C4JStorage::EMessage_ResultDecline || result==C4JStorage::EMessage_ResultThirdOption)
|
if(result==C4JStorage::EMessage_ResultDecline || result==C4JStorage::EMessage_ResultThirdOption)
|
||||||
{
|
{
|
||||||
if(result==C4JStorage::EMessage_ResultDecline) // rename
|
if(result==C4JStorage::EMessage_ResultDecline) // rename
|
||||||
{
|
{
|
||||||
|
|
@ -2302,9 +2300,9 @@ int CScene_MultiGameJoinLoad::LoadSaveDataReturned(void *pParam,bool bContinue)
|
||||||
UINT uiIDA[2];
|
UINT uiIDA[2];
|
||||||
uiIDA[0]=IDS_CONFIRM_CANCEL;
|
uiIDA[0]=IDS_CONFIRM_CANCEL;
|
||||||
uiIDA[1]=IDS_CONFIRM_OK;
|
uiIDA[1]=IDS_CONFIRM_OK;
|
||||||
StorageManager.RequestMessageBox(IDS_CORRUPT_OR_DAMAGED_SAVE_TITLE, IDS_CORRUPT_OR_DAMAGED_SAVE_TEXT, uiIDA, 2,
|
StorageManager.RequestMessageBox(IDS_CORRUPT_OR_DAMAGED_SAVE_TITLE, IDS_CORRUPT_OR_DAMAGED_SAVE_TEXT, uiIDA, 2,
|
||||||
pClass->m_iPad,&CScene_MultiGameJoinLoad::DeleteSaveDialogReturned,pClass, app.GetStringTable());
|
pClass->m_iPad,&CScene_MultiGameJoinLoad::DeleteSaveDialogReturned,pClass, app.GetStringTable());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -2366,7 +2364,7 @@ int CScene_MultiGameJoinLoad::KeyboardReturned(void *pParam,bool bSet)
|
||||||
|
|
||||||
if(eLoadStatus==C4JStorage::ELoadGame_DeviceRemoved)
|
if(eLoadStatus==C4JStorage::ELoadGame_DeviceRemoved)
|
||||||
{
|
{
|
||||||
// disable saving
|
// disable saving
|
||||||
StorageManager.SetSaveDisabled(true);
|
StorageManager.SetSaveDisabled(true);
|
||||||
StorageManager.SetSaveDeviceSelected(ProfileManager.GetPrimaryPad(),false);
|
StorageManager.SetSaveDeviceSelected(ProfileManager.GetPrimaryPad(),false);
|
||||||
UINT uiIDA[1];
|
UINT uiIDA[1];
|
||||||
|
|
@ -2375,11 +2373,11 @@ int CScene_MultiGameJoinLoad::KeyboardReturned(void *pParam,bool bSet)
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
// rename the save
|
// rename the save
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pClass->m_bIgnoreInput=false;
|
pClass->m_bIgnoreInput=false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2400,7 +2398,7 @@ int CScene_MultiGameJoinLoad::LoadSaveDataForRenameReturned(void *pParam,bool bC
|
||||||
StorageManager.GetSaveCacheFileInfo(pClass->m_iChangingSaveGameInfoIndex-pClass->m_iDefaultButtonsC,XContentData);
|
StorageManager.GetSaveCacheFileInfo(pClass->m_iChangingSaveGameInfoIndex-pClass->m_iDefaultButtonsC,XContentData);
|
||||||
StorageManager.GetSaveCacheFileInfo(pClass->m_iChangingSaveGameInfoIndex-pClass->m_iDefaultButtonsC,&pbImageData,&dwImageBytes);
|
StorageManager.GetSaveCacheFileInfo(pClass->m_iChangingSaveGameInfoIndex-pClass->m_iDefaultButtonsC,&pbImageData,&dwImageBytes);
|
||||||
|
|
||||||
// if there is no thumbnail, retrieve the default one from the file.
|
// if there is no thumbnail, retrieve the default one from the file.
|
||||||
// Don't delete the image data after creating the xuibrush, since we'll use it in the rename of the save
|
// Don't delete the image data after creating the xuibrush, since we'll use it in the rename of the save
|
||||||
if(pbImageData==NULL)
|
if(pbImageData==NULL)
|
||||||
{
|
{
|
||||||
|
|
@ -2456,7 +2454,7 @@ int CScene_MultiGameJoinLoad::TexturePackDialogReturned(void *pParam,int iPad,C4
|
||||||
|
|
||||||
// Exit with or without saving
|
// Exit with or without saving
|
||||||
// Decline means install full version of the texture pack in this dialog
|
// Decline means install full version of the texture pack in this dialog
|
||||||
if(result==C4JStorage::EMessage_ResultDecline || result==C4JStorage::EMessage_ResultAccept)
|
if(result==C4JStorage::EMessage_ResultDecline || result==C4JStorage::EMessage_ResultAccept)
|
||||||
{
|
{
|
||||||
// we need to enable background downloading for the DLC
|
// we need to enable background downloading for the DLC
|
||||||
XBackgroundDownloadSetMode(XBACKGROUND_DOWNLOAD_MODE_ALWAYS_ALLOW);
|
XBackgroundDownloadSetMode(XBACKGROUND_DOWNLOAD_MODE_ALWAYS_ALLOW);
|
||||||
|
|
@ -2480,7 +2478,7 @@ int CScene_MultiGameJoinLoad::TexturePackDialogReturned(void *pParam,int iPad,C4
|
||||||
ullIndexA[0]=pDLCInfo->ullOfferID_Trial;
|
ullIndexA[0]=pDLCInfo->ullOfferID_Trial;
|
||||||
StorageManager.InstallOffer(1,ullIndexA,NULL,NULL);
|
StorageManager.InstallOffer(1,ullIndexA,NULL,NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pClass->m_bIgnoreInput=false;
|
pClass->m_bIgnoreInput=false;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -2489,7 +2487,7 @@ int CScene_MultiGameJoinLoad::TexturePackDialogReturned(void *pParam,int iPad,C4
|
||||||
HRESULT CScene_MultiGameJoinLoad::OnCustomMessage_DLCInstalled()
|
HRESULT CScene_MultiGameJoinLoad::OnCustomMessage_DLCInstalled()
|
||||||
{
|
{
|
||||||
// mounted DLC may have changed
|
// mounted DLC may have changed
|
||||||
|
|
||||||
if(app.StartInstallDLCProcess(m_iPad)==false)
|
if(app.StartInstallDLCProcess(m_iPad)==false)
|
||||||
{
|
{
|
||||||
// not doing a mount, so re-enable input
|
// not doing a mount, so re-enable input
|
||||||
|
|
@ -2508,7 +2506,7 @@ HRESULT CScene_MultiGameJoinLoad::OnCustomMessage_DLCInstalled()
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT CScene_MultiGameJoinLoad::OnCustomMessage_DLCMountingComplete()
|
HRESULT CScene_MultiGameJoinLoad::OnCustomMessage_DLCMountingComplete()
|
||||||
{
|
{
|
||||||
|
|
||||||
VOID *pObj;
|
VOID *pObj;
|
||||||
XuiObjectFromHandle( m_SavesList, &pObj );
|
XuiObjectFromHandle( m_SavesList, &pObj );
|
||||||
|
|
@ -2534,7 +2532,7 @@ HRESULT CScene_MultiGameJoinLoad::OnCustomMessage_DLCMountingComplete()
|
||||||
|
|
||||||
int iY=-1;
|
int iY=-1;
|
||||||
if(DoesSavesListHaveFocus())
|
if(DoesSavesListHaveFocus())
|
||||||
{
|
{
|
||||||
if(ProfileManager.IsSignedInLive( m_iPad ))
|
if(ProfileManager.IsSignedInLive( m_iPad ))
|
||||||
{
|
{
|
||||||
iY=IDS_TOOLTIPS_UPLOAD_SAVE_FOR_XBOXONE;
|
iY=IDS_TOOLTIPS_UPLOAD_SAVE_FOR_XBOXONE;
|
||||||
|
|
@ -2627,7 +2625,7 @@ void CScene_MultiGameJoinLoad::UpdateTooltips()
|
||||||
// 4J-PB - we need to check that there is enough space left to create a copy of the save (for a rename)
|
// 4J-PB - we need to check that there is enough space left to create a copy of the save (for a rename)
|
||||||
bool bCanRename = StorageManager.EnoughSpaceForAMinSaveGame();
|
bool bCanRename = StorageManager.EnoughSpaceForAMinSaveGame();
|
||||||
|
|
||||||
if(bCanRename)
|
if(bCanRename)
|
||||||
{
|
{
|
||||||
iRB=IDS_TOOLTIPS_SAVEOPTIONS;
|
iRB=IDS_TOOLTIPS_SAVEOPTIONS;
|
||||||
}
|
}
|
||||||
|
|
@ -2694,11 +2692,11 @@ bool CScene_MultiGameJoinLoad::GetSavesInfoCallback(LPVOID pParam,int iTotalSave
|
||||||
pbCurrentImagePtr=pbImageData+InfoA[i].dwImageOffset;
|
pbCurrentImagePtr=pbImageData+InfoA[i].dwImageOffset;
|
||||||
hr=XuiCreateTextureBrushFromMemory(pbCurrentImagePtr,InfoA[i].dwImageBytes,&hXuiBrush);
|
hr=XuiCreateTextureBrushFromMemory(pbCurrentImagePtr,InfoA[i].dwImageBytes,&hXuiBrush);
|
||||||
pClass->m_pSavesList->UpdateGraphic(i+pClass->m_iDefaultButtonsC,hXuiBrush );
|
pClass->m_pSavesList->UpdateGraphic(i+pClass->m_iDefaultButtonsC,hXuiBrush );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// we could put in a damaged save icon here
|
// we could put in a damaged save icon here
|
||||||
const DWORD LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string
|
const DWORD LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string
|
||||||
WCHAR szResourceLocator[ LOCATOR_SIZE ];
|
WCHAR szResourceLocator[ LOCATOR_SIZE ];
|
||||||
const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(NULL);
|
const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(NULL);
|
||||||
|
|
||||||
|
|
@ -2724,7 +2722,7 @@ bool CScene_MultiGameJoinLoad::GetSavesInfoCallback(LPVOID pParam,int iTotalSave
|
||||||
// It's possible that the games list is updated but we haven't displayed it yet as we were still waiting on saves list to load
|
// It's possible that the games list is updated but we haven't displayed it yet as we were still waiting on saves list to load
|
||||||
// This is to fix a bug where joining a game before the saves list has loaded causes a crash when this callback is called
|
// This is to fix a bug where joining a game before the saves list has loaded causes a crash when this callback is called
|
||||||
// as the scene no longer exists
|
// as the scene no longer exists
|
||||||
pClass->UpdateGamesList();
|
pClass->UpdateGamesList();
|
||||||
|
|
||||||
// Fix for #45154 - Frontend: DLC: Content can only be downloaded from the frontend if you have not joined/exited multiplayer
|
// Fix for #45154 - Frontend: DLC: Content can only be downloaded from the frontend if you have not joined/exited multiplayer
|
||||||
XBackgroundDownloadSetMode(XBACKGROUND_DOWNLOAD_MODE_AUTO);
|
XBackgroundDownloadSetMode(XBACKGROUND_DOWNLOAD_MODE_AUTO);
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@
|
||||||
#include "XUI_Ctrl_SlotItem.h"
|
#include "XUI_Ctrl_SlotItem.h"
|
||||||
#include "XUI_Ctrl_SlotItemListItem.h"
|
#include "XUI_Ctrl_SlotItemListItem.h"
|
||||||
#include "XUI_Scene_AbstractContainer.h"
|
#include "XUI_Scene_AbstractContainer.h"
|
||||||
#ifdef _DEBUG_MENUS_ENABLED
|
#ifdef _DEBUG_MENUS_ENABLED
|
||||||
#include "XUI_DebugItemEditor.h"
|
#include "XUI_DebugItemEditor.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -44,14 +44,14 @@ void CXuiSceneAbstractContainer::PlatformInitialize(int iPad, int startIndex)
|
||||||
|
|
||||||
// We may have varying depths of controls here, so base off the pointers parent
|
// We may have varying depths of controls here, so base off the pointers parent
|
||||||
HXUIOBJ parent;
|
HXUIOBJ parent;
|
||||||
XuiElementGetBounds( m_pointerControl->m_hObj, &fPointerWidth, &fPointerHeight );
|
XuiElementGetBounds( m_pointerControl->m_hObj, &fPointerWidth, &fPointerHeight );
|
||||||
XuiElementGetParent( m_pointerControl->m_hObj, &parent );
|
XuiElementGetParent( m_pointerControl->m_hObj, &parent );
|
||||||
m_pointerControl->SetShow(TRUE);
|
m_pointerControl->SetShow(TRUE);
|
||||||
XuiElementGetBounds( parent, &fPanelWidth, &fPanelHeight );
|
XuiElementGetBounds( parent, &fPanelWidth, &fPanelHeight );
|
||||||
// Get size of pointer
|
// Get size of pointer
|
||||||
m_fPointerImageOffsetX = floor(fPointerWidth/2.0f);
|
m_fPointerImageOffsetX = floor(fPointerWidth/2.0f);
|
||||||
m_fPointerImageOffsetY = floor(fPointerHeight/2.0f);
|
m_fPointerImageOffsetY = floor(fPointerHeight/2.0f);
|
||||||
|
|
||||||
m_fPanelMinX = 0.0f;
|
m_fPanelMinX = 0.0f;
|
||||||
m_fPanelMaxX = fPanelWidth;
|
m_fPanelMaxX = fPanelWidth;
|
||||||
m_fPanelMinY = 0.0f;
|
m_fPanelMinY = 0.0f;
|
||||||
|
|
@ -97,13 +97,13 @@ void CXuiSceneAbstractContainer::PlatformInitialize(int iPad, int startIndex)
|
||||||
m_pointerPos.x = newPointerPos.x;
|
m_pointerPos.x = newPointerPos.x;
|
||||||
m_pointerPos.y = newPointerPos.y;
|
m_pointerPos.y = newPointerPos.y;
|
||||||
|
|
||||||
#ifdef USE_POINTER_ACCEL
|
#ifdef USE_POINTER_ACCEL
|
||||||
m_fPointerVelX = 0.0f;
|
m_fPointerVelX = 0.0f;
|
||||||
m_fPointerVelY = 0.0f;
|
m_fPointerVelY = 0.0f;
|
||||||
m_fPointerAccelX = 0.0f;
|
m_fPointerAccelX = 0.0f;
|
||||||
m_fPointerAccelY = 0.0f;
|
m_fPointerAccelY = 0.0f;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Add timer to poll controller stick input at 60Hz
|
// Add timer to poll controller stick input at 60Hz
|
||||||
HRESULT timerResult = SetTimer( POINTER_INPUT_TIMER_ID, ( 1000 / 60 ) );
|
HRESULT timerResult = SetTimer( POINTER_INPUT_TIMER_ID, ( 1000 / 60 ) );
|
||||||
assert( timerResult == S_OK );
|
assert( timerResult == S_OK );
|
||||||
|
|
@ -114,7 +114,7 @@ void CXuiSceneAbstractContainer::PlatformInitialize(int iPad, int startIndex)
|
||||||
for ( int iSection = m_eFirstSection; iSection < m_eMaxSection; ++iSection )
|
for ( int iSection = m_eFirstSection; iSection < m_eMaxSection; ++iSection )
|
||||||
{
|
{
|
||||||
ESceneSection eSection = ( ESceneSection )( iSection );
|
ESceneSection eSection = ( ESceneSection )( iSection );
|
||||||
|
|
||||||
if(!IsSectionSlotList(eSection)) continue;
|
if(!IsSectionSlotList(eSection)) continue;
|
||||||
|
|
||||||
// Get dimensions of this section.
|
// Get dimensions of this section.
|
||||||
|
|
@ -153,7 +153,7 @@ int CXuiSceneAbstractContainer::getSectionRows(ESceneSection eSection)
|
||||||
return GetSectionSlotList( eSection )->GetRows();
|
return GetSectionSlotList( eSection )->GetRows();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Adding this so we can turn off the pointer text background, since it flickers on then off at the start of a scene where a tutorial popup is
|
// Adding this so we can turn off the pointer text background, since it flickers on then off at the start of a scene where a tutorial popup is
|
||||||
HRESULT CXuiSceneAbstractContainer::OnTransitionStart( XUIMessageTransition *pTransition, BOOL& bHandled )
|
HRESULT CXuiSceneAbstractContainer::OnTransitionStart( XUIMessageTransition *pTransition, BOOL& bHandled )
|
||||||
{
|
{
|
||||||
if(pTransition->dwTransAction==XUI_TRANSITION_ACTION_DESTROY ) return S_OK;
|
if(pTransition->dwTransAction==XUI_TRANSITION_ACTION_DESTROY ) return S_OK;
|
||||||
|
|
@ -327,7 +327,7 @@ HRESULT CXuiSceneAbstractContainer::OnTimer( XUIMessageTimer *pTimer, BOOL& bHan
|
||||||
// Update pointer from stick input on timer.
|
// Update pointer from stick input on timer.
|
||||||
if ( pTimer->nId == POINTER_INPUT_TIMER_ID )
|
if ( pTimer->nId == POINTER_INPUT_TIMER_ID )
|
||||||
{
|
{
|
||||||
|
|
||||||
onMouseTick();
|
onMouseTick();
|
||||||
D3DXVECTOR3 pointerPos;
|
D3DXVECTOR3 pointerPos;
|
||||||
pointerPos.x = m_pointerPos.x;
|
pointerPos.x = m_pointerPos.x;
|
||||||
|
|
@ -348,7 +348,7 @@ HRESULT CXuiSceneAbstractContainer::OnTimer( XUIMessageTimer *pTimer, BOOL& bHan
|
||||||
hr = handleCustomTimer( pTimer, bHandled );
|
hr = handleCustomTimer( pTimer, bHandled );
|
||||||
}
|
}
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT CXuiSceneAbstractContainer::OnCustomMessage_Splitscreenplayer(bool bJoining, BOOL& bHandled)
|
HRESULT CXuiSceneAbstractContainer::OnCustomMessage_Splitscreenplayer(bool bJoining, BOOL& bHandled)
|
||||||
{
|
{
|
||||||
|
|
@ -388,15 +388,15 @@ void CXuiSceneAbstractContainer::SetPointerText(const wstring &description, vect
|
||||||
}
|
}
|
||||||
|
|
||||||
bool smallPointer = m_bSplitscreen || (!RenderManager.IsHiDef() && !RenderManager.IsWidescreen());
|
bool smallPointer = m_bSplitscreen || (!RenderManager.IsHiDef() && !RenderManager.IsWidescreen());
|
||||||
wstring desc = L"<font size=\"" + _toString<int>(smallPointer ? 12 :14) + L"\">" + description + L"</font>";
|
wstring desc = L"<font size=\"" + std::to_wstring(smallPointer ? 12 :14) + L"\">" + description + L"</font>";
|
||||||
|
|
||||||
XUIRect tempXuiRect, xuiRect;
|
XUIRect tempXuiRect, xuiRect;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
xuiRect.right = 0;
|
xuiRect.right = 0;
|
||||||
|
|
||||||
for(AUTO_VAR(it, unformattedStrings.begin()); it != unformattedStrings.end(); ++it)
|
for (auto& it : unformattedStrings )
|
||||||
{
|
{
|
||||||
XuiTextPresenterMeasureText(m_hPointerTextMeasurer, parseXMLSpecials((*it)).c_str(), &tempXuiRect);
|
XuiTextPresenterMeasureText(m_hPointerTextMeasurer, parseXMLSpecials(it).c_str(), &tempXuiRect);
|
||||||
if(tempXuiRect.right > xuiRect.right) xuiRect = tempXuiRect;
|
if(tempXuiRect.right > xuiRect.right) xuiRect = tempXuiRect;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -443,7 +443,7 @@ void CXuiSceneAbstractContainer::adjustPointerForSafeZone()
|
||||||
D3DXVECTOR2 baseSceneOrigin;
|
D3DXVECTOR2 baseSceneOrigin;
|
||||||
float baseWidth, baseHeight;
|
float baseWidth, baseHeight;
|
||||||
if(CXuiSceneBase::GetBaseSceneSafeZone( m_iPad, baseSceneOrigin, baseWidth, baseHeight))
|
if(CXuiSceneBase::GetBaseSceneSafeZone( m_iPad, baseSceneOrigin, baseWidth, baseHeight))
|
||||||
{
|
{
|
||||||
D3DXMATRIX pointerBackgroundMatrix;
|
D3DXMATRIX pointerBackgroundMatrix;
|
||||||
XuiElementGetFullXForm( m_hPointerTextBkg, &pointerBackgroundMatrix);
|
XuiElementGetFullXForm( m_hPointerTextBkg, &pointerBackgroundMatrix);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ HRESULT CXuiSceneInventory::OnInit( XUIMessageInit *pInitData, BOOL &bHandled )
|
||||||
{
|
{
|
||||||
if(m_bSplitscreen)
|
if(m_bSplitscreen)
|
||||||
{
|
{
|
||||||
app.AdjustSplitscreenScene(m_hObj,&m_OriginalPosition,m_iPad);
|
app.AdjustSplitscreenScene(m_hObj,&m_OriginalPosition,m_iPad);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -57,7 +57,7 @@ HRESULT CXuiSceneInventory::OnInit( XUIMessageInit *pInitData, BOOL &bHandled )
|
||||||
initData->player->awardStat(GenericStats::openInventory(), GenericStats::param_noArgs());
|
initData->player->awardStat(GenericStats::openInventory(), GenericStats::param_noArgs());
|
||||||
|
|
||||||
CXuiSceneAbstractContainer::Initialize( initData->iPad, menu, false, InventoryMenu::INV_SLOT_START, eSectionInventoryUsing, eSectionInventoryMax, initData->bNavigateBack );
|
CXuiSceneAbstractContainer::Initialize( initData->iPad, menu, false, InventoryMenu::INV_SLOT_START, eSectionInventoryUsing, eSectionInventoryMax, initData->bNavigateBack );
|
||||||
|
|
||||||
delete initData;
|
delete initData;
|
||||||
|
|
||||||
float fWidth;
|
float fWidth;
|
||||||
|
|
@ -86,7 +86,7 @@ HRESULT CXuiSceneInventory::OnDestroy()
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4J Stu - Fix for #11302 - TCR 001: Network Connectivity: Host crashed after being killed by the client while accessing a chest during burst packet loss.
|
// 4J Stu - Fix for #11302 - TCR 001: Network Connectivity: Host crashed after being killed by the client while accessing a chest during burst packet loss.
|
||||||
// We need to make sure that we call closeContainer() anytime this menu is closed, even if it is forced to close by some other reason (like the player dying)
|
// We need to make sure that we call closeContainer() anytime this menu is closed, even if it is forced to close by some other reason (like the player dying)
|
||||||
if(Minecraft::GetInstance()->localplayers[m_iPad] != NULL) Minecraft::GetInstance()->localplayers[m_iPad]->closeContainer();
|
if(Minecraft::GetInstance()->localplayers[m_iPad] != NULL) Minecraft::GetInstance()->localplayers[m_iPad]->closeContainer();
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
@ -176,8 +176,8 @@ void CXuiSceneInventory::updateEffectsDisplay()
|
||||||
// Fill out details for display
|
// Fill out details for display
|
||||||
D3DXVECTOR3 position;
|
D3DXVECTOR3 position;
|
||||||
m_hEffectDisplayA[0]->GetPosition(&position);
|
m_hEffectDisplayA[0]->GetPosition(&position);
|
||||||
AUTO_VAR(it, activeEffects->begin());
|
auto it = activeEffects->begin();
|
||||||
for(unsigned int i = 0; i < MAX_EFFECTS; ++i)
|
for(unsigned int i = 0; i < MAX_EFFECTS; ++i)
|
||||||
{
|
{
|
||||||
if(it != activeEffects->end())
|
if(it != activeEffects->end())
|
||||||
{
|
{
|
||||||
|
|
@ -185,7 +185,7 @@ void CXuiSceneInventory::updateEffectsDisplay()
|
||||||
|
|
||||||
if(i > 0) position.y -= fNextEffectYOffset; // Stack from the bottom
|
if(i > 0) position.y -= fNextEffectYOffset; // Stack from the bottom
|
||||||
m_hEffectDisplayA[i]->SetPosition(&position);
|
m_hEffectDisplayA[i]->SetPosition(&position);
|
||||||
|
|
||||||
MobEffectInstance *effect = *it;
|
MobEffectInstance *effect = *it;
|
||||||
|
|
||||||
MobEffect *mobEffect = MobEffect::effects[effect->getId()];
|
MobEffect *mobEffect = MobEffect::effects[effect->getId()];
|
||||||
|
|
|
||||||
|
|
@ -19,11 +19,11 @@
|
||||||
HRESULT CXuiSceneTrading::OnInit( XUIMessageInit* pInitData, BOOL& bHandled )
|
HRESULT CXuiSceneTrading::OnInit( XUIMessageInit* pInitData, BOOL& bHandled )
|
||||||
{
|
{
|
||||||
MapChildControls();
|
MapChildControls();
|
||||||
|
|
||||||
//XuiControlSetText(m_villagerText,app.GetString(IDS_VILLAGER));
|
//XuiControlSetText(m_villagerText,app.GetString(IDS_VILLAGER));
|
||||||
XuiControlSetText(m_inventoryLabel,app.GetString(IDS_INVENTORY));
|
XuiControlSetText(m_inventoryLabel,app.GetString(IDS_INVENTORY));
|
||||||
XuiControlSetText(m_requiredLabel,app.GetString(IDS_REQUIRED_ITEMS_FOR_TRADE));
|
XuiControlSetText(m_requiredLabel,app.GetString(IDS_REQUIRED_ITEMS_FOR_TRADE));
|
||||||
|
|
||||||
|
|
||||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||||
|
|
||||||
|
|
@ -36,7 +36,7 @@ HRESULT CXuiSceneTrading::OnInit( XUIMessageInit* pInitData, BOOL& bHandled )
|
||||||
|
|
||||||
if(m_bSplitscreen)
|
if(m_bSplitscreen)
|
||||||
{
|
{
|
||||||
app.AdjustSplitscreenScene(m_hObj,&m_OriginalPosition,m_iPad);
|
app.AdjustSplitscreenScene(m_hObj,&m_OriginalPosition,m_iPad);
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pMinecraft->localgameModes[m_iPad] != NULL )
|
if( pMinecraft->localgameModes[m_iPad] != NULL )
|
||||||
|
|
@ -65,7 +65,7 @@ HRESULT CXuiSceneTrading::OnInit( XUIMessageInit* pInitData, BOOL& bHandled )
|
||||||
|
|
||||||
// store the slot 0 highlight position
|
// store the slot 0 highlight position
|
||||||
m_tradingSelector.GetPosition(&m_vSelectorInitialPos);
|
m_tradingSelector.GetPosition(&m_vSelectorInitialPos);
|
||||||
|
|
||||||
//app.SetRichPresenceContextValue(m_iPad,CONTEXT_GAME_STATE_FORGING);
|
//app.SetRichPresenceContextValue(m_iPad,CONTEXT_GAME_STATE_FORGING);
|
||||||
|
|
||||||
XuiSetTimer(m_hObj,TRADING_UPDATE_TIMER_ID,TRADING_UPDATE_TIMER_TIME);
|
XuiSetTimer(m_hObj,TRADING_UPDATE_TIMER_ID,TRADING_UPDATE_TIMER_TIME);
|
||||||
|
|
@ -86,7 +86,7 @@ HRESULT CXuiSceneTrading::OnDestroy()
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4J Stu - Fix for #11302 - TCR 001: Network Connectivity: Host crashed after being killed by the client while accessing a chest during burst packet loss.
|
// 4J Stu - Fix for #11302 - TCR 001: Network Connectivity: Host crashed after being killed by the client while accessing a chest during burst packet loss.
|
||||||
// We need to make sure that we call closeContainer() anytime this menu is closed, even if it is forced to close by some other reason (like the player dying)
|
// We need to make sure that we call closeContainer() anytime this menu is closed, even if it is forced to close by some other reason (like the player dying)
|
||||||
if(Minecraft::GetInstance()->localplayers[m_iPad] != NULL) Minecraft::GetInstance()->localplayers[m_iPad]->closeContainer();
|
if(Minecraft::GetInstance()->localplayers[m_iPad] != NULL) Minecraft::GetInstance()->localplayers[m_iPad]->closeContainer();
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
@ -270,15 +270,15 @@ void CXuiSceneTrading::setOfferDescription(const wstring &name, vector<wstring>
|
||||||
}
|
}
|
||||||
|
|
||||||
bool smallPointer = m_bSplitscreen || (!RenderManager.IsHiDef() && !RenderManager.IsWidescreen());
|
bool smallPointer = m_bSplitscreen || (!RenderManager.IsHiDef() && !RenderManager.IsWidescreen());
|
||||||
wstring desc = L"<font size=\"" + _toString<int>(smallPointer ? 12 :14) + L"\">" + name + L"</font>";
|
wstring desc = L"<font size=\"" + std::to_wstring(smallPointer ? 12 :14) + L"\">" + name + L"</font>";
|
||||||
|
|
||||||
XUIRect tempXuiRect, xuiRect;
|
XUIRect tempXuiRect, xuiRect;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
xuiRect.right = 0;
|
xuiRect.right = 0;
|
||||||
|
|
||||||
for(AUTO_VAR(it, unformattedStrings.begin()); it != unformattedStrings.end(); ++it)
|
for (auto& it : unformattedStrings )
|
||||||
{
|
{
|
||||||
XuiTextPresenterMeasureText(m_hOfferInfoTextMeasurer, (*it).c_str(), &tempXuiRect);
|
XuiTextPresenterMeasureText(m_hOfferInfoTextMeasurer, it.c_str(), &tempXuiRect);
|
||||||
if(tempXuiRect.right > xuiRect.right) xuiRect = tempXuiRect;
|
if(tempXuiRect.right > xuiRect.right) xuiRect = tempXuiRect;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -299,7 +299,7 @@ void CXuiSceneTrading::setOfferDescription(const wstring &name, vector<wstring>
|
||||||
XuiElementSetBounds(m_hOfferInfoText,xuiRect.right+4.0f+4.0f,xuiRect.bottom+4.0f+4.0f); // edge graphics are 8 pixels, text is centred
|
XuiElementSetBounds(m_hOfferInfoText,xuiRect.right+4.0f+4.0f,xuiRect.bottom+4.0f+4.0f); // edge graphics are 8 pixels, text is centred
|
||||||
|
|
||||||
m_offerInfoControl.SetShow(TRUE);
|
m_offerInfoControl.SetShow(TRUE);
|
||||||
|
|
||||||
D3DXVECTOR3 highlightPos, offerInfoPos;
|
D3DXVECTOR3 highlightPos, offerInfoPos;
|
||||||
float highlightWidth, highlightHeight;
|
float highlightWidth, highlightHeight;
|
||||||
m_tradingSelector.GetPosition(&highlightPos);
|
m_tradingSelector.GetPosition(&highlightPos);
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ const float CScene_Win::PLAYER_SCROLL_SPEED = 3.0f;
|
||||||
// Performs initialization tasks - retrieves controls.
|
// Performs initialization tasks - retrieves controls.
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
HRESULT CScene_Win::OnInit( XUIMessageInit* pInitData, BOOL& bHandled )
|
HRESULT CScene_Win::OnInit( XUIMessageInit* pInitData, BOOL& bHandled )
|
||||||
{
|
{
|
||||||
m_iPad = *(int *)pInitData->pvInitData;
|
m_iPad = *(int *)pInitData->pvInitData;
|
||||||
|
|
||||||
m_bIgnoreInput = false;
|
m_bIgnoreInput = false;
|
||||||
|
|
@ -194,8 +194,8 @@ void CScene_Win::updateNoise()
|
||||||
{
|
{
|
||||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||||
noiseString = noNoiseString;
|
noiseString = noNoiseString;
|
||||||
|
|
||||||
int length = 0;
|
size_t length = 0;
|
||||||
wchar_t replacements[64];
|
wchar_t replacements[64];
|
||||||
wstring replaceString = L"";
|
wstring replaceString = L"";
|
||||||
wchar_t randomChar = L'a';
|
wchar_t randomChar = L'a';
|
||||||
|
|
@ -205,18 +205,18 @@ void CScene_Win::updateNoise()
|
||||||
|
|
||||||
wstring tag = L"{*NOISE*}";
|
wstring tag = L"{*NOISE*}";
|
||||||
|
|
||||||
AUTO_VAR(it, m_noiseLengths.begin());
|
auto it = m_noiseLengths.begin();
|
||||||
int found=(int)noiseString.find_first_of(L"{");
|
size_t found = noiseString.find_first_of(L"{");
|
||||||
while (found!=string::npos && it != m_noiseLengths.end() )
|
while (found!=string::npos && it != m_noiseLengths.end() )
|
||||||
{
|
{
|
||||||
length = *it;
|
length = *it;
|
||||||
++it;
|
++it;
|
||||||
|
|
||||||
replaceString = L"";
|
replaceString = L"";
|
||||||
for(int i = 0; i < length; ++i)
|
for(size_t i = 0; i < length; ++i)
|
||||||
{
|
{
|
||||||
randomChar = SharedConstants::acceptableLetters[random->nextInt((int)SharedConstants::acceptableLetters.length())];
|
randomChar = SharedConstants::acceptableLetters[random->nextInt(SharedConstants::acceptableLetters.length())];
|
||||||
|
|
||||||
wstring randomCharStr = L"";
|
wstring randomCharStr = L"";
|
||||||
randomCharStr.push_back(randomChar);
|
randomCharStr.push_back(randomChar);
|
||||||
if(randomChar == L'<')
|
if(randomChar == L'<')
|
||||||
|
|
@ -262,7 +262,7 @@ void CScene_Win::updateNoise()
|
||||||
//ib.put(listPos + 256 + random->nextInt(2) + 8 + (darken ? 16 : 0));
|
//ib.put(listPos + 256 + random->nextInt(2) + 8 + (darken ? 16 : 0));
|
||||||
//ib.put(listPos + pos + 32);
|
//ib.put(listPos + pos + 32);
|
||||||
|
|
||||||
found=(int)noiseString.find_first_of(L"{",found+1);
|
found = noiseString.find_first_of(L"{",found+1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ HRESULT CScene_TextEntry::OnNotifyValueChanged (HXUIOBJ hObjSource, XUINotifyVal
|
||||||
if(pValueChangedData->nValue==10)
|
if(pValueChangedData->nValue==10)
|
||||||
{
|
{
|
||||||
LPCWSTR pText = m_EditText.GetText();
|
LPCWSTR pText = m_EditText.GetText();
|
||||||
|
|
||||||
if(pText)
|
if(pText)
|
||||||
{
|
{
|
||||||
wstring wText = pText;
|
wstring wText = pText;
|
||||||
|
|
@ -61,7 +61,7 @@ HRESULT CScene_TextEntry::OnNotifyValueChanged (HXUIOBJ hObjSource, XUINotifyVal
|
||||||
}
|
}
|
||||||
|
|
||||||
app.NavigateBack(m_iPad);
|
app.NavigateBack(m_iPad);
|
||||||
rfHandled = TRUE;
|
rfHandled = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
|
|
@ -86,7 +86,7 @@ HRESULT CScene_TextEntry::OnKeyDown(XUIMessageInput* pInputData, BOOL& rfHandled
|
||||||
|
|
||||||
app.NavigateBack(m_iPad);
|
app.NavigateBack(m_iPad);
|
||||||
rfHandled = TRUE;
|
rfHandled = TRUE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VK_PAD_B:
|
case VK_PAD_B:
|
||||||
|
|
@ -113,8 +113,8 @@ HRESULT CScene_TextEntry::InterpretString(wstring &wsText)
|
||||||
swscanf_s(wsText.c_str(), L"%s", wchCommand,40);
|
swscanf_s(wsText.c_str(), L"%s", wchCommand,40);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
AUTO_VAR(it, m_CommandSet.find(wchCommand));
|
auto it = m_CommandSet.find(wchCommand);
|
||||||
if(it != m_CommandSet.end())
|
if(it != m_CommandSet.end())
|
||||||
{
|
{
|
||||||
// found it
|
// found it
|
||||||
|
|
||||||
|
|
@ -125,7 +125,7 @@ HRESULT CScene_TextEntry::InterpretString(wstring &wsText)
|
||||||
case eCommand_Teleport:
|
case eCommand_Teleport:
|
||||||
{
|
{
|
||||||
int x,z;
|
int x,z;
|
||||||
|
|
||||||
#ifdef __PS3__
|
#ifdef __PS3__
|
||||||
// 4J Stu - The Xbox version uses swscanf_s which isn't available in GCC.
|
// 4J Stu - The Xbox version uses swscanf_s which isn't available in GCC.
|
||||||
swscanf(wsText.c_str(), L"%40s%c%d%c%d", wchCommand,wchSep,&x,wchSep,&z);
|
swscanf(wsText.c_str(), L"%40s%c%d%c%d", wchCommand,wchSep,&x,wchSep,&z);
|
||||||
|
|
@ -146,9 +146,9 @@ HRESULT CScene_TextEntry::InterpretString(wstring &wsText)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case eCommand_Give:
|
case eCommand_Give:
|
||||||
{
|
{
|
||||||
int iItem,iCount;
|
int iItem,iCount;
|
||||||
|
|
||||||
#ifdef __PS3__
|
#ifdef __PS3__
|
||||||
// 4J Stu - The Xbox version uses swscanf_s which isn't available in GCC.
|
// 4J Stu - The Xbox version uses swscanf_s which isn't available in GCC.
|
||||||
swscanf(wsText.c_str(), L"%40s%c%d%c%d", wchCommand,wchSep,&iItem,wchSep,&iCount);
|
swscanf(wsText.c_str(), L"%40s%c%d%c%d", wchCommand,wchSep,&iItem,wchSep,&iCount);
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ void DeathScreen::render(int xm, int ym, float a)
|
||||||
glScalef(2, 2, 2);
|
glScalef(2, 2, 2);
|
||||||
drawCenteredString(font, L"Game over!", width / 2 / 2, 60 / 2, 0xffffff);
|
drawCenteredString(font, L"Game over!", width / 2 / 2, 60 / 2, 0xffffff);
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
drawCenteredString(font, L"Score: &e" + _toString( minecraft->player->getScore() ), width / 2, 100, 0xffffff);
|
drawCenteredString(font, L"Score: &e" + std::to_wstring( minecraft->player->getScore() ), width / 2, 100, 0xffffff);
|
||||||
|
|
||||||
Screen::render(xm, ym, a);
|
Screen::render(xm, ym, a);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ void DemoMode::tick()
|
||||||
{
|
{
|
||||||
if (day <= (DEMO_DAYS + 1))
|
if (day <= (DEMO_DAYS + 1))
|
||||||
{
|
{
|
||||||
minecraft->gui->displayClientMessage(L"demo.day." + _toString<__int64>(day));
|
minecraft->gui->displayClientMessage(L"demo.day." + std::to_wstring(day));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (day == 1)
|
else if (day == 1)
|
||||||
|
|
|
||||||
|
|
@ -171,7 +171,7 @@ int CConsoleMinecraftApp::LoadLocalDLCImages()
|
||||||
{
|
{
|
||||||
unordered_map<wstring,DLC_INFO * > *pDLCInfoA=app.GetDLCInfo();
|
unordered_map<wstring,DLC_INFO * > *pDLCInfoA=app.GetDLCInfo();
|
||||||
// 4J-PB - Any local graphic files for the Minecraft Store?
|
// 4J-PB - Any local graphic files for the Minecraft Store?
|
||||||
for( AUTO_VAR(it, pDLCInfoA->begin()); it != pDLCInfoA->end(); it++ )
|
for (auto it = pDLCInfoA->begin(); it != pDLCInfoA->end(); it++)
|
||||||
{
|
{
|
||||||
DLC_INFO * pDLCInfo=(*it).second;
|
DLC_INFO * pDLCInfo=(*it).second;
|
||||||
|
|
||||||
|
|
@ -185,7 +185,7 @@ void CConsoleMinecraftApp::FreeLocalDLCImages()
|
||||||
// 4J-PB - Any local graphic files for the Minecraft Store?
|
// 4J-PB - Any local graphic files for the Minecraft Store?
|
||||||
unordered_map<wstring,DLC_INFO * > *pDLCInfoA=app.GetDLCInfo();
|
unordered_map<wstring,DLC_INFO * > *pDLCInfoA=app.GetDLCInfo();
|
||||||
|
|
||||||
for( AUTO_VAR(it, pDLCInfoA->begin()); it != pDLCInfoA->end(); it++ )
|
for (auto it = pDLCInfoA->begin(); it != pDLCInfoA->end(); it++)
|
||||||
{
|
{
|
||||||
DLC_INFO * pDLCInfo=(*it).second;
|
DLC_INFO * pDLCInfo=(*it).second;
|
||||||
|
|
||||||
|
|
@ -567,8 +567,8 @@ int CConsoleMinecraftApp::Callback_TMSPPRetrieveFileList(void *pParam,int iPad,
|
||||||
// dump out the file list
|
// dump out the file list
|
||||||
app.DebugPrintf("TMSPP filecount - %d\nFiles - \n",pvTmsFileDetails->size());
|
app.DebugPrintf("TMSPP filecount - %d\nFiles - \n",pvTmsFileDetails->size());
|
||||||
int iCount=0;
|
int iCount=0;
|
||||||
AUTO_VAR(itEnd, pvTmsFileDetails->end());
|
auto itEnd = pvTmsFileDetails->end();
|
||||||
for( AUTO_VAR(it, pvTmsFileDetails->begin()); it != itEnd; it++ )
|
for (auto it = pvTmsFileDetails->begin(); it != itEnd; it++)
|
||||||
{
|
{
|
||||||
C4JStorage::PTMSPP_FILE_DETAILS fd = *it;
|
C4JStorage::PTMSPP_FILE_DETAILS fd = *it;
|
||||||
app.DebugPrintf("%2d. %ls (size - %d)\n",iCount++,fd->wchFilename,fd->ulFileSize);
|
app.DebugPrintf("%2d. %ls (size - %d)\n",iCount++,fd->wchFilename,fd->ulFileSize);
|
||||||
|
|
|
||||||
|
|
@ -1102,12 +1102,12 @@ SIZE_T WINAPI XMemSize(
|
||||||
void DumpMem()
|
void DumpMem()
|
||||||
{
|
{
|
||||||
int totalLeak = 0;
|
int totalLeak = 0;
|
||||||
for(AUTO_VAR(it, allocCounts.begin()); it != allocCounts.end(); it++ )
|
for( auto& it : allocCounts )
|
||||||
{
|
{
|
||||||
if(it->second > 0 )
|
if(it.second > 0 )
|
||||||
{
|
{
|
||||||
app.DebugPrintf("%d %d %d %d\n",( it->first >> 26 ) & 0x3f,it->first & 0x03ffffff, it->second, (it->first & 0x03ffffff) * it->second);
|
app.DebugPrintf("%d %d %d %d\n",( it.first >> 26 ) & 0x3f,it.first & 0x03ffffff, it.second, (it.first & 0x03ffffff) * it.second);
|
||||||
totalLeak += ( it->first & 0x03ffffff ) * it->second;
|
totalLeak += ( it.first & 0x03ffffff ) * it.second;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
app.DebugPrintf("Total %d\n",totalLeak);
|
app.DebugPrintf("Total %d\n",totalLeak);
|
||||||
|
|
@ -1150,13 +1150,13 @@ void MemPixStuff()
|
||||||
|
|
||||||
int totals[MAX_SECT] = {0};
|
int totals[MAX_SECT] = {0};
|
||||||
|
|
||||||
for(AUTO_VAR(it, allocCounts.begin()); it != allocCounts.end(); it++ )
|
for ( auto& it : allocCounts )
|
||||||
{
|
{
|
||||||
if(it->second > 0 )
|
if ( it.second > 0 )
|
||||||
{
|
{
|
||||||
int sect = ( it->first >> 26 ) & 0x3f;
|
int sect = ( it.first >> 26 ) & 0x3f;
|
||||||
int bytes = it->first & 0x03ffffff;
|
int bytes = it.first & 0x03ffffff;
|
||||||
totals[sect] += bytes * it->second;
|
totals[sect] += bytes * it.second;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,52 +21,52 @@ DurangoLeaderboardManager::DurangoLeaderboardManager()
|
||||||
|
|
||||||
m_difficulty = 0;
|
m_difficulty = 0;
|
||||||
m_type = eStatsType_UNDEFINED;
|
m_type = eStatsType_UNDEFINED;
|
||||||
m_statNames = ref new PC::Vector<P::String^>();
|
m_statNames = ref new PC::Vector<P::String^>();
|
||||||
m_xboxUserIds = ref new PC::Vector<P::String^>();
|
m_xboxUserIds = ref new PC::Vector<P::String^>();
|
||||||
m_leaderboardAsyncOp = nullptr;
|
m_leaderboardAsyncOp = nullptr;
|
||||||
m_statsAsyncOp = nullptr;
|
m_statsAsyncOp = nullptr;
|
||||||
|
|
||||||
for(unsigned int difficulty = 0; difficulty < 4; ++difficulty)
|
for(unsigned int difficulty = 0; difficulty < 4; ++difficulty)
|
||||||
{
|
{
|
||||||
m_leaderboardNames[difficulty][eStatsType_Travelling] = L"LeaderboardTravelling" + _toString(difficulty);
|
m_leaderboardNames[difficulty][eStatsType_Travelling] = L"LeaderboardTravelling" + std::to_wstring(difficulty);
|
||||||
m_leaderboardNames[difficulty][eStatsType_Mining] = L"LeaderboardMining" + _toString(difficulty);
|
m_leaderboardNames[difficulty][eStatsType_Mining] = L"LeaderboardMining" + std::to_wstring(difficulty);
|
||||||
m_leaderboardNames[difficulty][eStatsType_Farming] = L"LeaderboardFarming" + _toString(difficulty);
|
m_leaderboardNames[difficulty][eStatsType_Farming] = L"LeaderboardFarming" + std::to_wstring(difficulty);
|
||||||
m_leaderboardNames[difficulty][eStatsType_Kills] = L"LeaderboardKills" + _toString(difficulty);
|
m_leaderboardNames[difficulty][eStatsType_Kills] = L"LeaderboardKills" + std::to_wstring(difficulty);
|
||||||
|
|
||||||
m_socialLeaderboardNames[difficulty][eStatsType_Travelling] = L"Leaderboard.LeaderboardId.0.DifficultyLevelId." + _toString(difficulty);
|
m_socialLeaderboardNames[difficulty][eStatsType_Travelling] = L"Leaderboard.LeaderboardId.0.DifficultyLevelId." + std::to_wstring(difficulty);
|
||||||
m_socialLeaderboardNames[difficulty][eStatsType_Mining] = L"Leaderboard.LeaderboardId.1.DifficultyLevelId." + _toString(difficulty);
|
m_socialLeaderboardNames[difficulty][eStatsType_Mining] = L"Leaderboard.LeaderboardId.1.DifficultyLevelId." + std::to_wstring(difficulty);
|
||||||
m_socialLeaderboardNames[difficulty][eStatsType_Farming] = L"Leaderboard.LeaderboardId.2.DifficultyLevelId." + _toString(difficulty);
|
m_socialLeaderboardNames[difficulty][eStatsType_Farming] = L"Leaderboard.LeaderboardId.2.DifficultyLevelId." + std::to_wstring(difficulty);
|
||||||
m_socialLeaderboardNames[difficulty][eStatsType_Kills] = L"Leaderboard.LeaderboardId.3.DifficultyLevelId." + _toString(difficulty);
|
m_socialLeaderboardNames[difficulty][eStatsType_Kills] = L"Leaderboard.LeaderboardId.3.DifficultyLevelId." + std::to_wstring(difficulty);
|
||||||
|
|
||||||
m_leaderboardStatNames[difficulty][eStatsType_Travelling].push_back( L"DistanceTravelled.DifficultyLevelId." + _toString(difficulty) + L".TravelMethodId.0"); // Walked
|
m_leaderboardStatNames[difficulty][eStatsType_Travelling].push_back( L"DistanceTravelled.DifficultyLevelId." + std::to_wstring(difficulty) + L".TravelMethodId.0"); // Walked
|
||||||
m_leaderboardStatNames[difficulty][eStatsType_Travelling].push_back( L"DistanceTravelled.DifficultyLevelId." + _toString(difficulty) + L".TravelMethodId.2"); // Fallen
|
m_leaderboardStatNames[difficulty][eStatsType_Travelling].push_back( L"DistanceTravelled.DifficultyLevelId." + std::to_wstring(difficulty) + L".TravelMethodId.2"); // Fallen
|
||||||
m_leaderboardStatNames[difficulty][eStatsType_Travelling].push_back( L"DistanceTravelled.DifficultyLevelId." + _toString(difficulty) + L".TravelMethodId.4"); // Minecart
|
m_leaderboardStatNames[difficulty][eStatsType_Travelling].push_back( L"DistanceTravelled.DifficultyLevelId." + std::to_wstring(difficulty) + L".TravelMethodId.4"); // Minecart
|
||||||
m_leaderboardStatNames[difficulty][eStatsType_Travelling].push_back( L"DistanceTravelled.DifficultyLevelId." + _toString(difficulty) + L".TravelMethodId.5"); // Boat
|
m_leaderboardStatNames[difficulty][eStatsType_Travelling].push_back( L"DistanceTravelled.DifficultyLevelId." + std::to_wstring(difficulty) + L".TravelMethodId.5"); // Boat
|
||||||
|
|
||||||
m_leaderboardStatNames[difficulty][eStatsType_Mining].push_back( L"BlockBroken.DifficultyLevelId." + _toString(difficulty) + L".BlockId.3"); // Dirt
|
m_leaderboardStatNames[difficulty][eStatsType_Mining].push_back( L"BlockBroken.DifficultyLevelId." + std::to_wstring(difficulty) + L".BlockId.3"); // Dirt
|
||||||
m_leaderboardStatNames[difficulty][eStatsType_Mining].push_back( L"BlockBroken.DifficultyLevelId." + _toString(difficulty) + L".BlockId.4"); // Cobblestone
|
m_leaderboardStatNames[difficulty][eStatsType_Mining].push_back( L"BlockBroken.DifficultyLevelId." + std::to_wstring(difficulty) + L".BlockId.4"); // Cobblestone
|
||||||
m_leaderboardStatNames[difficulty][eStatsType_Mining].push_back( L"BlockBroken.DifficultyLevelId." + _toString(difficulty) + L".BlockId.12"); // Sand
|
m_leaderboardStatNames[difficulty][eStatsType_Mining].push_back( L"BlockBroken.DifficultyLevelId." + std::to_wstring(difficulty) + L".BlockId.12"); // Sand
|
||||||
m_leaderboardStatNames[difficulty][eStatsType_Mining].push_back( L"BlockBroken.DifficultyLevelId." + _toString(difficulty) + L".BlockId.1"); // Stone
|
m_leaderboardStatNames[difficulty][eStatsType_Mining].push_back( L"BlockBroken.DifficultyLevelId." + std::to_wstring(difficulty) + L".BlockId.1"); // Stone
|
||||||
m_leaderboardStatNames[difficulty][eStatsType_Mining].push_back( L"BlockBroken.DifficultyLevelId." + _toString(difficulty) + L".BlockId.13"); // Gravel
|
m_leaderboardStatNames[difficulty][eStatsType_Mining].push_back( L"BlockBroken.DifficultyLevelId." + std::to_wstring(difficulty) + L".BlockId.13"); // Gravel
|
||||||
m_leaderboardStatNames[difficulty][eStatsType_Mining].push_back( L"BlockBroken.DifficultyLevelId." + _toString(difficulty) + L".BlockId.82"); // Clay
|
m_leaderboardStatNames[difficulty][eStatsType_Mining].push_back( L"BlockBroken.DifficultyLevelId." + std::to_wstring(difficulty) + L".BlockId.82"); // Clay
|
||||||
m_leaderboardStatNames[difficulty][eStatsType_Mining].push_back( L"BlockBroken.DifficultyLevelId." + _toString(difficulty) + L".BlockId.49"); // Obsidian
|
m_leaderboardStatNames[difficulty][eStatsType_Mining].push_back( L"BlockBroken.DifficultyLevelId." + std::to_wstring(difficulty) + L".BlockId.49"); // Obsidian
|
||||||
|
|
||||||
m_leaderboardStatNames[difficulty][eStatsType_Farming].push_back( L"McItemAcquired.DifficultyLevelId." + _toString(difficulty) + L".AcquisitionMethodId.1.ItemId.344"); // Eggs
|
m_leaderboardStatNames[difficulty][eStatsType_Farming].push_back( L"McItemAcquired.DifficultyLevelId." + std::to_wstring(difficulty) + L".AcquisitionMethodId.1.ItemId.344"); // Eggs
|
||||||
m_leaderboardStatNames[difficulty][eStatsType_Farming].push_back( L"BlockBroken.DifficultyLevelId." + _toString(difficulty) + L".BlockId.59"); // Wheat
|
m_leaderboardStatNames[difficulty][eStatsType_Farming].push_back( L"BlockBroken.DifficultyLevelId." + std::to_wstring(difficulty) + L".BlockId.59"); // Wheat
|
||||||
m_leaderboardStatNames[difficulty][eStatsType_Farming].push_back( L"BlockBroken.DifficultyLevelId." + _toString(difficulty) + L".BlockId.39"); // Mushroom
|
m_leaderboardStatNames[difficulty][eStatsType_Farming].push_back( L"BlockBroken.DifficultyLevelId." + std::to_wstring(difficulty) + L".BlockId.39"); // Mushroom
|
||||||
m_leaderboardStatNames[difficulty][eStatsType_Farming].push_back( L"BlockBroken.DifficultyLevelId." + _toString(difficulty) + L".BlockId.83"); // Sugarcane
|
m_leaderboardStatNames[difficulty][eStatsType_Farming].push_back( L"BlockBroken.DifficultyLevelId." + std::to_wstring(difficulty) + L".BlockId.83"); // Sugarcane
|
||||||
m_leaderboardStatNames[difficulty][eStatsType_Farming].push_back( L"McItemAcquired.DifficultyLevelId." + _toString(difficulty) + L".AcquisitionMethodId.2.ItemId.335"); // Milk
|
m_leaderboardStatNames[difficulty][eStatsType_Farming].push_back( L"McItemAcquired.DifficultyLevelId." + std::to_wstring(difficulty) + L".AcquisitionMethodId.2.ItemId.335"); // Milk
|
||||||
m_leaderboardStatNames[difficulty][eStatsType_Farming].push_back( L"McItemAcquired.DifficultyLevelId." + _toString(difficulty) + L".AcquisitionMethodId.1.ItemId.86"); // Pumpkin
|
m_leaderboardStatNames[difficulty][eStatsType_Farming].push_back( L"McItemAcquired.DifficultyLevelId." + std::to_wstring(difficulty) + L".AcquisitionMethodId.1.ItemId.86"); // Pumpkin
|
||||||
|
|
||||||
m_leaderboardStatNames[difficulty][eStatsType_Kills].push_back( L"MobKilledTotal.DifficultyLevelId." + _toString(difficulty) + L".EnemyRoleId.54"); // Zombie
|
m_leaderboardStatNames[difficulty][eStatsType_Kills].push_back( L"MobKilledTotal.DifficultyLevelId." + std::to_wstring(difficulty) + L".EnemyRoleId.54"); // Zombie
|
||||||
m_leaderboardStatNames[difficulty][eStatsType_Kills].push_back( L"MobKilledTotal.DifficultyLevelId." + _toString(difficulty) + L".EnemyRoleId.51"); // Skeleton
|
m_leaderboardStatNames[difficulty][eStatsType_Kills].push_back( L"MobKilledTotal.DifficultyLevelId." + std::to_wstring(difficulty) + L".EnemyRoleId.51"); // Skeleton
|
||||||
m_leaderboardStatNames[difficulty][eStatsType_Kills].push_back( L"MobKilledTotal.DifficultyLevelId." + _toString(difficulty) + L".EnemyRoleId.50"); // Creeper
|
m_leaderboardStatNames[difficulty][eStatsType_Kills].push_back( L"MobKilledTotal.DifficultyLevelId." + std::to_wstring(difficulty) + L".EnemyRoleId.50"); // Creeper
|
||||||
m_leaderboardStatNames[difficulty][eStatsType_Kills].push_back( L"MobKilledTotal.DifficultyLevelId." + _toString(difficulty) + L".EnemyRoleId.52"); // Spider
|
m_leaderboardStatNames[difficulty][eStatsType_Kills].push_back( L"MobKilledTotal.DifficultyLevelId." + std::to_wstring(difficulty) + L".EnemyRoleId.52"); // Spider
|
||||||
m_leaderboardStatNames[difficulty][eStatsType_Kills].push_back( L"MobKilledTotal.DifficultyLevelId." + _toString(difficulty) + L".EnemyRoleId.49"); // Spider Jockey
|
m_leaderboardStatNames[difficulty][eStatsType_Kills].push_back( L"MobKilledTotal.DifficultyLevelId." + std::to_wstring(difficulty) + L".EnemyRoleId.49"); // Spider Jockey
|
||||||
m_leaderboardStatNames[difficulty][eStatsType_Kills].push_back( L"MobKilledTotal.DifficultyLevelId." + _toString(difficulty) + L".EnemyRoleId.57"); // Zombie Pigman
|
m_leaderboardStatNames[difficulty][eStatsType_Kills].push_back( L"MobKilledTotal.DifficultyLevelId." + std::to_wstring(difficulty) + L".EnemyRoleId.57"); // Zombie Pigman
|
||||||
m_leaderboardStatNames[difficulty][eStatsType_Kills].push_back( L"MobKilledTotal.DifficultyLevelId." + _toString(difficulty) + L".EnemyRoleId.55"); // Slime
|
m_leaderboardStatNames[difficulty][eStatsType_Kills].push_back( L"MobKilledTotal.DifficultyLevelId." + std::to_wstring(difficulty) + L".EnemyRoleId.55"); // Slime
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DurangoLeaderboardManager::Tick()
|
void DurangoLeaderboardManager::Tick()
|
||||||
{
|
{
|
||||||
|
|
@ -93,7 +93,7 @@ void DurangoLeaderboardManager::Tick()
|
||||||
{
|
{
|
||||||
app.DebugPrintf("[LeaderboardManager] Second continuation\n");
|
app.DebugPrintf("[LeaderboardManager] Second continuation\n");
|
||||||
m_statsAsyncOp = nullptr;
|
m_statsAsyncOp = nullptr;
|
||||||
|
|
||||||
WFC::IVectorView<MXS::UserStatistics::UserStatisticsResult^>^ resultList = resultListTask.get();
|
WFC::IVectorView<MXS::UserStatistics::UserStatisticsResult^>^ resultList = resultListTask.get();
|
||||||
|
|
||||||
if (m_xboxLiveContext == nullptr) throw(ref new P::Exception(-1));
|
if (m_xboxLiveContext == nullptr) throw(ref new P::Exception(-1));
|
||||||
|
|
@ -170,7 +170,7 @@ void DurangoLeaderboardManager::Tick()
|
||||||
|
|
||||||
eStatsReturn ret = view.m_numQueries > 0 ? eStatsReturn_Success : eStatsReturn_NoResults;
|
eStatsReturn ret = view.m_numQueries > 0 ? eStatsReturn_Success : eStatsReturn_NoResults;
|
||||||
|
|
||||||
if (m_readListener != NULL)
|
if (m_readListener != NULL)
|
||||||
{
|
{
|
||||||
app.DebugPrintf("[LeaderboardManager] OnStatsReadComplete(%i, %i, _)\n", ret, m_readCount);
|
app.DebugPrintf("[LeaderboardManager] OnStatsReadComplete(%i, %i, _)\n", ret, m_readCount);
|
||||||
m_readListener->OnStatsReadComplete(ret, m_maxRank, view);
|
m_readListener->OnStatsReadComplete(ret, m_maxRank, view);
|
||||||
|
|
@ -380,10 +380,10 @@ void DurangoLeaderboardManager::CancelOperation()
|
||||||
//if (m_transactionCtx != 0)
|
//if (m_transactionCtx != 0)
|
||||||
//{
|
//{
|
||||||
// int ret = sceNpScoreAbortTransaction(m_transactionCtx);
|
// int ret = sceNpScoreAbortTransaction(m_transactionCtx);
|
||||||
//
|
//
|
||||||
// if (ret < 0)
|
// if (ret < 0)
|
||||||
// {
|
// {
|
||||||
// app.DebugPrintf("[LeaderboardManager] CancelOperation(): Problem encountered aborting current operation, 0x%X.\n", ret);
|
// app.DebugPrintf("[LeaderboardManager] CancelOperation(): Problem encountered aborting current operation, 0x%X.\n", ret);
|
||||||
// }
|
// }
|
||||||
// else
|
// else
|
||||||
// {
|
// {
|
||||||
|
|
@ -415,20 +415,20 @@ void DurangoLeaderboardManager::runLeaderboardRequest(WF::IAsyncOperation<MXSL::
|
||||||
|
|
||||||
app.DebugPrintf("[LeaderboardManager] Running request\n");
|
app.DebugPrintf("[LeaderboardManager] Running request\n");
|
||||||
CC::create_task(asyncOp)
|
CC::create_task(asyncOp)
|
||||||
.then( [this, readCount, difficulty, type, filter] (CC::task<MXSL::LeaderboardResult^> resultTask)
|
.then( [this, readCount, difficulty, type, filter] (CC::task<MXSL::LeaderboardResult^> resultTask)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
app.DebugPrintf("[LeaderboardManager] First continuation.\n");
|
app.DebugPrintf("[LeaderboardManager] First continuation.\n");
|
||||||
|
|
||||||
m_leaderboardAsyncOp = nullptr;
|
m_leaderboardAsyncOp = nullptr;
|
||||||
|
|
||||||
MXSL::LeaderboardResult^ lastResult = resultTask.get();
|
MXSL::LeaderboardResult^ lastResult = resultTask.get();
|
||||||
|
|
||||||
app.DebugPrintf(
|
app.DebugPrintf(
|
||||||
"Name: %ls - Filter: %ls - Rows: Retrieved=%d Total=%d Requested=%d.\n",
|
"Name: %ls - Filter: %ls - Rows: Retrieved=%d Total=%d Requested=%d.\n",
|
||||||
lastResult->DisplayName->Data(),
|
lastResult->DisplayName->Data(),
|
||||||
LeaderboardManager::filterNames[ (int) filter ].c_str(),
|
LeaderboardManager::filterNames[ (int) filter ].c_str(),
|
||||||
lastResult->Rows->Size, lastResult->TotalRowCount, readCount
|
lastResult->Rows->Size, lastResult->TotalRowCount, readCount
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -459,21 +459,21 @@ void DurangoLeaderboardManager::runLeaderboardRequest(WF::IAsyncOperation<MXSL::
|
||||||
m_readCount = lastResult->Rows->Size;
|
m_readCount = lastResult->Rows->Size;
|
||||||
|
|
||||||
if (m_scores != NULL) delete [] m_scores;
|
if (m_scores != NULL) delete [] m_scores;
|
||||||
m_scores = new ReadScore[m_readCount];
|
m_scores = new ReadScore[m_readCount];
|
||||||
ZeroMemory(m_scores, sizeof(ReadScore) * m_readCount);
|
ZeroMemory(m_scores, sizeof(ReadScore) * m_readCount);
|
||||||
|
|
||||||
m_xboxUserIds->Clear();
|
m_xboxUserIds->Clear();
|
||||||
|
|
||||||
app.DebugPrintf("[LeaderboardManager] Retrieved Scores:\n");
|
app.DebugPrintf("[LeaderboardManager] Retrieved Scores:\n");
|
||||||
for( UINT index = 0; index < lastResult->Rows->Size; index++ )
|
for( UINT index = 0; index < lastResult->Rows->Size; index++ )
|
||||||
{
|
{
|
||||||
MXSL::LeaderboardRow^ row = lastResult->Rows->GetAt(index);
|
MXSL::LeaderboardRow^ row = lastResult->Rows->GetAt(index);
|
||||||
|
|
||||||
app.DebugPrintf(
|
app.DebugPrintf(
|
||||||
"\tIndex: %d\tRank: %d\tPercentile: %.1f%%\tXboxUserId: %ls\tValue: %ls.\n",
|
"\tIndex: %d\tRank: %d\tPercentile: %.1f%%\tXboxUserId: %ls\tValue: %ls.\n",
|
||||||
index,
|
index,
|
||||||
row->Rank,
|
row->Rank,
|
||||||
row->Percentile * 100,
|
row->Percentile * 100,
|
||||||
row->XboxUserId->Data(),
|
row->XboxUserId->Data(),
|
||||||
row->Values->GetAt(0)->Data()
|
row->Values->GetAt(0)->Data()
|
||||||
);
|
);
|
||||||
|
|
@ -484,7 +484,7 @@ void DurangoLeaderboardManager::runLeaderboardRequest(WF::IAsyncOperation<MXSL::
|
||||||
|
|
||||||
// 4J-JEV: Added to help determine if this player's score is hidden due to their privacy settings.
|
// 4J-JEV: Added to help determine if this player's score is hidden due to their privacy settings.
|
||||||
m_scores[index].m_totalScore = (unsigned long) _fromString<long long>(row->Values->GetAt(0)->Data());
|
m_scores[index].m_totalScore = (unsigned long) _fromString<long long>(row->Values->GetAt(0)->Data());
|
||||||
|
|
||||||
m_xboxUserIds->Append(row->XboxUserId);
|
m_xboxUserIds->Append(row->XboxUserId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -681,12 +681,12 @@ void DurangoLeaderboardManager::setState(EStatsState newState)
|
||||||
};
|
};
|
||||||
break;
|
break;
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifndef _CONTENT_PACKAGE
|
#ifndef _CONTENT_PACKAGE
|
||||||
app.DebugPrintf(
|
app.DebugPrintf(
|
||||||
"[LeaderboardManager] %s state transition:\t%ls(%d) -> %ls(%d).\n",
|
"[LeaderboardManager] %s state transition:\t%ls(%d) -> %ls(%d).\n",
|
||||||
(validTransition ? "Valid" : "INVALID"),
|
(validTransition ? "Valid" : "INVALID"),
|
||||||
stateToString(m_eStatsState).c_str(), m_eStatsState,
|
stateToString(m_eStatsState).c_str(), m_eStatsState,
|
||||||
stateToString(newState).c_str(), newState
|
stateToString(newState).c_str(), newState
|
||||||
);
|
);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -1460,7 +1460,7 @@ void DQRNetworkManager::UpdateRoomSyncPlayers(RoomSyncData *pNewSyncData)
|
||||||
{
|
{
|
||||||
PlayerSyncData *pNewPlayer = &pNewSyncData->players[i];
|
PlayerSyncData *pNewPlayer = &pNewSyncData->players[i];
|
||||||
bool bAlreadyExisted = false;
|
bool bAlreadyExisted = false;
|
||||||
for( AUTO_VAR(it, tempPlayers.begin()); it != tempPlayers.end(); it++ )
|
for (auto it = tempPlayers.begin(); it != tempPlayers.end(); it++)
|
||||||
{
|
{
|
||||||
if( pNewPlayer->m_smallId == (*it)->GetSmallId() )
|
if( pNewPlayer->m_smallId == (*it)->GetSmallId() )
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "..\..\..\Minecraft.World\Socket.h"
|
#include "..\..\..\Minecraft.World\Socket.h"
|
||||||
#include "..\..\..\Minecraft.World\StringHelpers.h"
|
#include "..\..\..\Minecraft.World\StringHelpers.h"
|
||||||
#include "PlatformNetworkManagerDurango.h"
|
#include "PlatformNetworkManagerDurango.h"
|
||||||
|
|
@ -131,9 +131,8 @@ void CPlatformNetworkManagerDurango::HandlePlayerJoined(DQRNetworkPlayer *pDQRPl
|
||||||
{
|
{
|
||||||
// Do we already have a primary player for this system?
|
// Do we already have a primary player for this system?
|
||||||
bool systemHasPrimaryPlayer = false;
|
bool systemHasPrimaryPlayer = false;
|
||||||
for(AUTO_VAR(it, m_machineDQRPrimaryPlayers.begin()); it < m_machineDQRPrimaryPlayers.end(); ++it)
|
for ( DQRNetworkPlayer *pQNetPrimaryPlayer : m_machineDQRPrimaryPlayers )
|
||||||
{
|
{
|
||||||
DQRNetworkPlayer *pQNetPrimaryPlayer = *it;
|
|
||||||
if( pDQRPlayer->IsSameSystem(pQNetPrimaryPlayer) )
|
if( pDQRPlayer->IsSameSystem(pQNetPrimaryPlayer) )
|
||||||
{
|
{
|
||||||
systemHasPrimaryPlayer = true;
|
systemHasPrimaryPlayer = true;
|
||||||
|
|
@ -145,7 +144,7 @@ void CPlatformNetworkManagerDurango::HandlePlayerJoined(DQRNetworkPlayer *pDQRPl
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
g_NetworkManager.PlayerJoining( networkPlayer );
|
g_NetworkManager.PlayerJoining( networkPlayer );
|
||||||
|
|
||||||
if( createFakeSocket == true && !m_bHostChanged )
|
if( createFakeSocket == true && !m_bHostChanged )
|
||||||
{
|
{
|
||||||
g_NetworkManager.CreateSocket( networkPlayer, localPlayer );
|
g_NetworkManager.CreateSocket( networkPlayer, localPlayer );
|
||||||
|
|
@ -164,7 +163,7 @@ void CPlatformNetworkManagerDurango::HandlePlayerJoined(DQRNetworkPlayer *pDQRPl
|
||||||
g_NetworkManager.UpdateAndSetGameSessionData();
|
g_NetworkManager.UpdateAndSetGameSessionData();
|
||||||
SystemFlagAddPlayer( networkPlayer );
|
SystemFlagAddPlayer( networkPlayer );
|
||||||
}
|
}
|
||||||
|
|
||||||
for( int idx = 0; idx < XUSER_MAX_COUNT; ++idx)
|
for( int idx = 0; idx < XUSER_MAX_COUNT; ++idx)
|
||||||
{
|
{
|
||||||
if(playerChangedCallback[idx] != NULL)
|
if(playerChangedCallback[idx] != NULL)
|
||||||
|
|
@ -233,8 +232,8 @@ void CPlatformNetworkManagerDurango::HandlePlayerLeaving(DQRNetworkPlayer *pDQRP
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
AUTO_VAR(it, find( m_machineDQRPrimaryPlayers.begin(), m_machineDQRPrimaryPlayers.end(), pDQRPlayer));
|
auto it = find(m_machineDQRPrimaryPlayers.begin(), m_machineDQRPrimaryPlayers.end(), pDQRPlayer);
|
||||||
if( it != m_machineDQRPrimaryPlayers.end() )
|
if( it != m_machineDQRPrimaryPlayers.end() )
|
||||||
{
|
{
|
||||||
m_machineDQRPrimaryPlayers.erase( it );
|
m_machineDQRPrimaryPlayers.erase( it );
|
||||||
}
|
}
|
||||||
|
|
@ -249,7 +248,7 @@ void CPlatformNetworkManagerDurango::HandlePlayerLeaving(DQRNetworkPlayer *pDQRP
|
||||||
}
|
}
|
||||||
|
|
||||||
g_NetworkManager.PlayerLeaving( networkPlayer );
|
g_NetworkManager.PlayerLeaving( networkPlayer );
|
||||||
|
|
||||||
for( int idx = 0; idx < XUSER_MAX_COUNT; ++idx)
|
for( int idx = 0; idx < XUSER_MAX_COUNT; ++idx)
|
||||||
{
|
{
|
||||||
if(playerChangedCallback[idx] != NULL)
|
if(playerChangedCallback[idx] != NULL)
|
||||||
|
|
@ -322,7 +321,7 @@ bool CPlatformNetworkManagerDurango::Initialise(CGameNetworkManager *pGameNetwor
|
||||||
{
|
{
|
||||||
playerChangedCallback[ i ] = NULL;
|
playerChangedCallback[ i ] = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_bLeavingGame = false;
|
m_bLeavingGame = false;
|
||||||
m_bLeaveGameOnTick = false;
|
m_bLeaveGameOnTick = false;
|
||||||
m_bHostChanged = false;
|
m_bHostChanged = false;
|
||||||
|
|
@ -593,7 +592,7 @@ void CPlatformNetworkManagerDurango::UnRegisterPlayerChangedCallback(int iPad, v
|
||||||
|
|
||||||
void CPlatformNetworkManagerDurango::HandleSignInChange()
|
void CPlatformNetworkManagerDurango::HandleSignInChange()
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPlatformNetworkManagerDurango::HandleAddLocalPlayerFailed(int idx, bool serverFull)
|
void CPlatformNetworkManagerDurango::HandleAddLocalPlayerFailed(int idx, bool serverFull)
|
||||||
|
|
@ -618,10 +617,10 @@ void CPlatformNetworkManagerDurango::UpdateAndSetGameSessionData(INetworkPlayer
|
||||||
{
|
{
|
||||||
if( this->m_bLeavingGame )
|
if( this->m_bLeavingGame )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( GetHostPlayer() == NULL )
|
if( GetHostPlayer() == NULL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_hostGameSessionData.m_uiGameHostSettings = app.GetGameHostOption(eGameHostOption_All);
|
m_hostGameSessionData.m_uiGameHostSettings = app.GetGameHostOption(eGameHostOption_All);
|
||||||
|
|
||||||
m_pDQRNet->UpdateCustomSessionData();
|
m_pDQRNet->UpdateCustomSessionData();
|
||||||
|
|
@ -847,8 +846,8 @@ INetworkPlayer *CPlatformNetworkManagerDurango::addNetworkPlayer(DQRNetworkPlaye
|
||||||
void CPlatformNetworkManagerDurango::removeNetworkPlayer(DQRNetworkPlayer *pDQRPlayer)
|
void CPlatformNetworkManagerDurango::removeNetworkPlayer(DQRNetworkPlayer *pDQRPlayer)
|
||||||
{
|
{
|
||||||
INetworkPlayer *pNetworkPlayer = getNetworkPlayer(pDQRPlayer);
|
INetworkPlayer *pNetworkPlayer = getNetworkPlayer(pDQRPlayer);
|
||||||
for( AUTO_VAR(it, currentNetworkPlayers.begin()); it != currentNetworkPlayers.end(); it++ )
|
for (auto it = currentNetworkPlayers.begin(); it != currentNetworkPlayers.end(); ++it)
|
||||||
{
|
{
|
||||||
if( *it == pNetworkPlayer )
|
if( *it == pNetworkPlayer )
|
||||||
{
|
{
|
||||||
currentNetworkPlayers.erase(it);
|
currentNetworkPlayers.erase(it);
|
||||||
|
|
@ -865,7 +864,7 @@ INetworkPlayer *CPlatformNetworkManagerDurango::getNetworkPlayer(DQRNetworkPlaye
|
||||||
|
|
||||||
INetworkPlayer *CPlatformNetworkManagerDurango::GetLocalPlayerByUserIndex(int userIndex )
|
INetworkPlayer *CPlatformNetworkManagerDurango::GetLocalPlayerByUserIndex(int userIndex )
|
||||||
{
|
{
|
||||||
return getNetworkPlayer(m_pDQRNet->GetLocalPlayerByUserIndex(userIndex));
|
return getNetworkPlayer(m_pDQRNet->GetLocalPlayerByUserIndex(userIndex));
|
||||||
}
|
}
|
||||||
|
|
||||||
INetworkPlayer *CPlatformNetworkManagerDurango::GetPlayerByIndex(int playerIndex)
|
INetworkPlayer *CPlatformNetworkManagerDurango::GetPlayerByIndex(int playerIndex)
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ HRESULT CDurangoTelemetryManager::Flush()
|
||||||
bool CDurangoTelemetryManager::RecordPlayerSessionStart(int iPad)
|
bool CDurangoTelemetryManager::RecordPlayerSessionStart(int iPad)
|
||||||
{
|
{
|
||||||
durangoStats()->generatePlayerSession();
|
durangoStats()->generatePlayerSession();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -123,7 +123,7 @@ bool CDurangoTelemetryManager::RecordPlayerSessionExit(int iPad, int exitStatus)
|
||||||
bool CDurangoTelemetryManager::RecordLevelStart(int iPad, ESen_FriendOrMatch friendsOrMatch, ESen_CompeteOrCoop competeOrCoop, int difficulty, int numberOfLocalPlayers, int numberOfOnlinePlayers)
|
bool CDurangoTelemetryManager::RecordLevelStart(int iPad, ESen_FriendOrMatch friendsOrMatch, ESen_CompeteOrCoop competeOrCoop, int difficulty, int numberOfLocalPlayers, int numberOfOnlinePlayers)
|
||||||
{
|
{
|
||||||
CTelemetryManager::RecordLevelStart(iPad, friendsOrMatch, competeOrCoop, difficulty, numberOfLocalPlayers, numberOfOnlinePlayers);
|
CTelemetryManager::RecordLevelStart(iPad, friendsOrMatch, competeOrCoop, difficulty, numberOfLocalPlayers, numberOfOnlinePlayers);
|
||||||
|
|
||||||
ULONG hr = 0;
|
ULONG hr = 0;
|
||||||
|
|
||||||
// Grab player info.
|
// Grab player info.
|
||||||
|
|
@ -191,10 +191,10 @@ bool CDurangoTelemetryManager::RecordLevelStart(int iPad, ESen_FriendOrMatch fri
|
||||||
GetSubLevelId(iPad),
|
GetSubLevelId(iPad),
|
||||||
GetLevelInstanceID(),
|
GetLevelInstanceID(),
|
||||||
&ZERO_GUID,
|
&ZERO_GUID,
|
||||||
friendsOrMatch,
|
friendsOrMatch,
|
||||||
competeOrCoop,
|
competeOrCoop,
|
||||||
difficulty,
|
difficulty,
|
||||||
numberOfLocalPlayers,
|
numberOfLocalPlayers,
|
||||||
numberOfOnlinePlayers,
|
numberOfOnlinePlayers,
|
||||||
&ZERO_GUID
|
&ZERO_GUID
|
||||||
);
|
);
|
||||||
|
|
@ -219,10 +219,10 @@ bool CDurangoTelemetryManager::RecordLevelStart(int iPad, ESen_FriendOrMatch fri
|
||||||
// Durango //
|
// Durango //
|
||||||
/* GUID */ guid2str(DurangoStats::getPlayerSession()).c_str(),
|
/* GUID */ guid2str(DurangoStats::getPlayerSession()).c_str(),
|
||||||
/* WSTR */ DurangoStats::getMultiplayerCorrelationId(),
|
/* WSTR */ DurangoStats::getMultiplayerCorrelationId(),
|
||||||
/* int */ friendsOrMatch,
|
/* int */ friendsOrMatch,
|
||||||
/* int */ competeOrCoop,
|
/* int */ competeOrCoop,
|
||||||
/* int */ difficulty,
|
/* int */ difficulty,
|
||||||
/* int */ numberOfLocalPlayers,
|
/* int */ numberOfLocalPlayers,
|
||||||
/* int */ numberOfOnlinePlayers
|
/* int */ numberOfOnlinePlayers
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
@ -577,7 +577,7 @@ bool CDurangoTelemetryManager::RecordMediaShareUpload(int iPad, ESen_MediaDestin
|
||||||
mediaDestination,
|
mediaDestination,
|
||||||
mediaType
|
mediaType
|
||||||
);
|
);
|
||||||
#else
|
#else
|
||||||
ULONG hr = -1;
|
ULONG hr = -1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -974,11 +974,11 @@ DurangoStats *CDurangoTelemetryManager::durangoStats()
|
||||||
wstring CDurangoTelemetryManager::guid2str(LPCGUID guid)
|
wstring CDurangoTelemetryManager::guid2str(LPCGUID guid)
|
||||||
{
|
{
|
||||||
wstring out = L"GUID<";
|
wstring out = L"GUID<";
|
||||||
out += _toString<unsigned long>(guid->Data1);
|
out += std::to_wstring(guid->Data1);
|
||||||
out += L":";
|
out += L":";
|
||||||
out += _toString<unsigned short>(guid->Data2);
|
out += std::to_wstring(guid->Data2);
|
||||||
out += L":";
|
out += L":";
|
||||||
out += _toString<unsigned short>(guid->Data3);
|
out += std::to_wstring(guid->Data3);
|
||||||
//out += L":";
|
//out += L":";
|
||||||
//out += convStringToWstring(string((char*)&guid->Data4,8));
|
//out += convStringToWstring(string((char*)&guid->Data4,8));
|
||||||
out += L">";
|
out += L">";
|
||||||
|
|
|
||||||
|
|
@ -169,10 +169,9 @@ EntityRenderDispatcher::EntityRenderDispatcher()
|
||||||
renderers[eTYPE_LIGHTNINGBOLT] = new LightningBoltRenderer();
|
renderers[eTYPE_LIGHTNINGBOLT] = new LightningBoltRenderer();
|
||||||
glDisable(GL_LIGHTING);
|
glDisable(GL_LIGHTING);
|
||||||
|
|
||||||
AUTO_VAR(itEnd, renderers.end());
|
for( auto& it : renderers )
|
||||||
for( classToRendererMap::iterator it = renderers.begin(); it != itEnd; it++ )
|
|
||||||
{
|
{
|
||||||
it->second->init(this);
|
it.second->init(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
isGuiRender = false; // 4J added
|
isGuiRender = false; // 4J added
|
||||||
|
|
@ -182,7 +181,7 @@ EntityRenderer *EntityRenderDispatcher::getRenderer(eINSTANCEOF e)
|
||||||
{
|
{
|
||||||
if( (e & eTYPE_PLAYER) == eTYPE_PLAYER) e = eTYPE_PLAYER;
|
if( (e & eTYPE_PLAYER) == eTYPE_PLAYER) e = eTYPE_PLAYER;
|
||||||
//EntityRenderer * r = renderers[e];
|
//EntityRenderer * r = renderers[e];
|
||||||
AUTO_VAR(it, renderers.find( e )); // 4J Stu - The .at and [] accessors insert elements if they don't exist
|
auto it = renderers.find(e); // 4J Stu - The .at and [] accessors insert elements if they don't exist
|
||||||
|
|
||||||
if( it == renderers.end() )
|
if( it == renderers.end() )
|
||||||
{
|
{
|
||||||
|
|
@ -305,10 +304,9 @@ Font *EntityRenderDispatcher::getFont()
|
||||||
|
|
||||||
void EntityRenderDispatcher::registerTerrainTextures(IconRegister *iconRegister)
|
void EntityRenderDispatcher::registerTerrainTextures(IconRegister *iconRegister)
|
||||||
{
|
{
|
||||||
//for (EntityRenderer<? extends Entity> renderer : renderers.values())
|
for( auto& it : renderers )
|
||||||
for(AUTO_VAR(it, renderers.begin()); it != renderers.end(); ++it)
|
|
||||||
{
|
{
|
||||||
EntityRenderer *renderer = it->second;
|
EntityRenderer *renderer = it.second;
|
||||||
renderer->registerTerrainTextures(iconRegister);
|
renderer->registerTerrainTextures(iconRegister);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,11 +33,11 @@ void EntityTracker::addEntity(shared_ptr<Entity> e)
|
||||||
{
|
{
|
||||||
addEntity(e, 32 * 16, 2);
|
addEntity(e, 32 * 16, 2);
|
||||||
shared_ptr<ServerPlayer> player = dynamic_pointer_cast<ServerPlayer>(e);
|
shared_ptr<ServerPlayer> player = dynamic_pointer_cast<ServerPlayer>(e);
|
||||||
for( AUTO_VAR(it, entities.begin()); it != entities.end(); it++ )
|
for ( auto& it : entities )
|
||||||
{
|
{
|
||||||
if( (*it)->e != player )
|
if( it && it->e != player )
|
||||||
{
|
{
|
||||||
(*it)->updatePlayer(this, player);
|
it->updatePlayer(this, player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -95,7 +95,7 @@ void EntityTracker::addEntity(shared_ptr<Entity> e, int range, int updateInterva
|
||||||
// This is to allow us to now choose to remove the player as a "seenBy" only when the player has actually been removed from the level's own player array
|
// This is to allow us to now choose to remove the player as a "seenBy" only when the player has actually been removed from the level's own player array
|
||||||
void EntityTracker::removeEntity(shared_ptr<Entity> e)
|
void EntityTracker::removeEntity(shared_ptr<Entity> e)
|
||||||
{
|
{
|
||||||
AUTO_VAR(it, entityMap.find(e->entityId));
|
auto it = entityMap.find(e->entityId);
|
||||||
if( it != entityMap.end() )
|
if( it != entityMap.end() )
|
||||||
{
|
{
|
||||||
shared_ptr<TrackedEntity> te = it->second;
|
shared_ptr<TrackedEntity> te = it->second;
|
||||||
|
|
@ -110,9 +110,10 @@ void EntityTracker::removePlayer(shared_ptr<Entity> e)
|
||||||
if (e->GetType() == eTYPE_SERVERPLAYER)
|
if (e->GetType() == eTYPE_SERVERPLAYER)
|
||||||
{
|
{
|
||||||
shared_ptr<ServerPlayer> player = dynamic_pointer_cast<ServerPlayer>(e);
|
shared_ptr<ServerPlayer> player = dynamic_pointer_cast<ServerPlayer>(e);
|
||||||
for( AUTO_VAR(it, entities.begin()); it != entities.end(); it++ )
|
for( auto& it : entities )
|
||||||
{
|
{
|
||||||
(*it)->removePlayer(player);
|
if ( it )
|
||||||
|
it->removePlayer(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4J: Flush now to ensure remove packets are sent before player respawns and add entity packets are sent
|
// 4J: Flush now to ensure remove packets are sent before player respawns and add entity packets are sent
|
||||||
|
|
@ -123,14 +124,16 @@ void EntityTracker::removePlayer(shared_ptr<Entity> e)
|
||||||
void EntityTracker::tick()
|
void EntityTracker::tick()
|
||||||
{
|
{
|
||||||
vector<shared_ptr<ServerPlayer> > movedPlayers;
|
vector<shared_ptr<ServerPlayer> > movedPlayers;
|
||||||
for( AUTO_VAR(it, entities.begin()); it != entities.end(); it++ )
|
for( auto& te : entities )
|
||||||
{
|
{
|
||||||
shared_ptr<TrackedEntity> te = *it;
|
if ( te )
|
||||||
te->tick(this, &level->players);
|
|
||||||
if (te->moved && te->e->GetType() == eTYPE_SERVERPLAYER)
|
|
||||||
{
|
{
|
||||||
movedPlayers.push_back(dynamic_pointer_cast<ServerPlayer>(te->e));
|
te->tick(this, &level->players);
|
||||||
}
|
if (te->moved && te->e->GetType() == eTYPE_SERVERPLAYER)
|
||||||
|
{
|
||||||
|
movedPlayers.push_back(dynamic_pointer_cast<ServerPlayer>(te->e));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4J Stu - If one player on a system is updated, then make sure they all are as they all have their
|
// 4J Stu - If one player on a system is updated, then make sure they all are as they all have their
|
||||||
|
|
@ -168,10 +171,9 @@ void EntityTracker::tick()
|
||||||
{
|
{
|
||||||
shared_ptr<ServerPlayer> player = movedPlayers[i];
|
shared_ptr<ServerPlayer> player = movedPlayers[i];
|
||||||
if(player->connection == NULL) continue;
|
if(player->connection == NULL) continue;
|
||||||
for( AUTO_VAR(it, entities.begin()); it != entities.end(); it++ )
|
for( auto& te : entities )
|
||||||
{
|
{
|
||||||
shared_ptr<TrackedEntity> te = *it;
|
if ( te && te->e != player)
|
||||||
if (te->e != player)
|
|
||||||
{
|
{
|
||||||
te->updatePlayer(this, player);
|
te->updatePlayer(this, player);
|
||||||
}
|
}
|
||||||
|
|
@ -179,10 +181,10 @@ void EntityTracker::tick()
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4J Stu - We want to do this for dead players as they don't tick normally
|
// 4J Stu - We want to do this for dead players as they don't tick normally
|
||||||
for(AUTO_VAR(it, level->players.begin()); it != level->players.end(); ++it)
|
for (auto& it : level->players )
|
||||||
{
|
{
|
||||||
shared_ptr<ServerPlayer> player = dynamic_pointer_cast<ServerPlayer>(*it);
|
shared_ptr<ServerPlayer> player = dynamic_pointer_cast<ServerPlayer>(it);
|
||||||
if(!player->isAlive())
|
if( player && !player->isAlive())
|
||||||
{
|
{
|
||||||
player->flushEntitiesToRemove();
|
player->flushEntitiesToRemove();
|
||||||
}
|
}
|
||||||
|
|
@ -191,7 +193,7 @@ void EntityTracker::tick()
|
||||||
|
|
||||||
void EntityTracker::broadcast(shared_ptr<Entity> e, shared_ptr<Packet> packet)
|
void EntityTracker::broadcast(shared_ptr<Entity> e, shared_ptr<Packet> packet)
|
||||||
{
|
{
|
||||||
AUTO_VAR(it, entityMap.find( e->entityId ));
|
auto it = entityMap.find(e->entityId);
|
||||||
if( it != entityMap.end() )
|
if( it != entityMap.end() )
|
||||||
{
|
{
|
||||||
shared_ptr<TrackedEntity> te = it->second;
|
shared_ptr<TrackedEntity> te = it->second;
|
||||||
|
|
@ -201,7 +203,7 @@ void EntityTracker::broadcast(shared_ptr<Entity> e, shared_ptr<Packet> packet)
|
||||||
|
|
||||||
void EntityTracker::broadcastAndSend(shared_ptr<Entity> e, shared_ptr<Packet> packet)
|
void EntityTracker::broadcastAndSend(shared_ptr<Entity> e, shared_ptr<Packet> packet)
|
||||||
{
|
{
|
||||||
AUTO_VAR(it, entityMap.find( e->entityId ));
|
auto it = entityMap.find(e->entityId);
|
||||||
if( it != entityMap.end() )
|
if( it != entityMap.end() )
|
||||||
{
|
{
|
||||||
shared_ptr<TrackedEntity> te = it->second;
|
shared_ptr<TrackedEntity> te = it->second;
|
||||||
|
|
@ -211,18 +213,17 @@ void EntityTracker::broadcastAndSend(shared_ptr<Entity> e, shared_ptr<Packet> pa
|
||||||
|
|
||||||
void EntityTracker::clear(shared_ptr<ServerPlayer> serverPlayer)
|
void EntityTracker::clear(shared_ptr<ServerPlayer> serverPlayer)
|
||||||
{
|
{
|
||||||
for( AUTO_VAR(it, entities.begin()); it != entities.end(); it++ )
|
for ( auto& te : entities )
|
||||||
{
|
{
|
||||||
shared_ptr<TrackedEntity> te = *it;
|
if ( te )
|
||||||
te->clear(serverPlayer);
|
te->clear(serverPlayer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EntityTracker::playerLoadedChunk(shared_ptr<ServerPlayer> player, LevelChunk *chunk)
|
void EntityTracker::playerLoadedChunk(shared_ptr<ServerPlayer> player, LevelChunk *chunk)
|
||||||
{
|
{
|
||||||
for (AUTO_VAR(it,entities.begin()); it != entities.end(); ++it)
|
for ( auto& te : entities )
|
||||||
{
|
{
|
||||||
shared_ptr<TrackedEntity> te = *it;
|
|
||||||
if (te->e != player && te->e->xChunk == chunk->x && te->e->zChunk == chunk->z)
|
if (te->e != player && te->e->xChunk == chunk->x && te->e->zChunk == chunk->z)
|
||||||
{
|
{
|
||||||
te->updatePlayer(this, player);
|
te->updatePlayer(this, player);
|
||||||
|
|
@ -239,7 +240,7 @@ void EntityTracker::updateMaxRange()
|
||||||
|
|
||||||
shared_ptr<TrackedEntity> EntityTracker::getTracker(shared_ptr<Entity> e)
|
shared_ptr<TrackedEntity> EntityTracker::getTracker(shared_ptr<Entity> e)
|
||||||
{
|
{
|
||||||
AUTO_VAR(it, entityMap.find(e->entityId));
|
auto it = entityMap.find(e->entityId);
|
||||||
if( it != entityMap.end() )
|
if( it != entityMap.end() )
|
||||||
{
|
{
|
||||||
return it->second;
|
return it->second;
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ Font::Font(Options *options, const wstring& name, Textures* textures, bool enfor
|
||||||
{
|
{
|
||||||
int xt = i % m_cols;
|
int xt = i % m_cols;
|
||||||
int yt = i / m_cols;
|
int yt = i / m_cols;
|
||||||
|
|
||||||
int x = 7;
|
int x = 7;
|
||||||
for (; x >= 0; x--)
|
for (; x >= 0; x--)
|
||||||
{
|
{
|
||||||
|
|
@ -70,7 +70,7 @@ Font::Font(Options *options, const wstring& name, Textures* textures, bool enfor
|
||||||
{
|
{
|
||||||
int yPixel = (yt * 8 + y) * w;
|
int yPixel = (yt * 8 + y) * w;
|
||||||
bool emptyPixel = (rawPixels[xPixel + yPixel] >> 24) == 0; // Check the alpha value
|
bool emptyPixel = (rawPixels[xPixel + yPixel] >> 24) == 0; // Check the alpha value
|
||||||
if (!emptyPixel) emptyColumn = false;
|
if (!emptyPixel) emptyColumn = false;
|
||||||
}
|
}
|
||||||
if (!emptyColumn)
|
if (!emptyColumn)
|
||||||
{
|
{
|
||||||
|
|
@ -127,13 +127,13 @@ Font::~Font()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void Font::renderCharacter(wchar_t c)
|
void Font::renderCharacter(wchar_t c)
|
||||||
{
|
{
|
||||||
float xOff = c % m_cols * m_charWidth;
|
float xOff = c % m_cols * m_charWidth;
|
||||||
float yOff = c / m_cols * m_charWidth;
|
float yOff = c / m_cols * m_charWidth;
|
||||||
|
|
||||||
float width = charWidths[c] - .01f;
|
float width = charWidths[c] - .01f;
|
||||||
float height = m_charHeight - .01f;
|
float height = m_charHeight - .01f;
|
||||||
|
|
||||||
float fontWidth = m_cols * m_charWidth;
|
float fontWidth = m_cols * m_charWidth;
|
||||||
float fontHeight = m_rows * m_charHeight;
|
float fontHeight = m_rows * m_charHeight;
|
||||||
|
|
||||||
|
|
@ -235,7 +235,7 @@ void Font::draw(const wstring &str, bool dropShadow)
|
||||||
i += 1;
|
i += 1;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// "noise" for crazy splash screen message
|
// "noise" for crazy splash screen message
|
||||||
if (noise)
|
if (noise)
|
||||||
{
|
{
|
||||||
|
|
@ -245,7 +245,7 @@ void Font::draw(const wstring &str, bool dropShadow)
|
||||||
newc = random->nextInt(SharedConstants::acceptableLetters.length());
|
newc = random->nextInt(SharedConstants::acceptableLetters.length());
|
||||||
} while (charWidths[c + 32] != charWidths[newc + 32]);
|
} while (charWidths[c + 32] != charWidths[newc + 32]);
|
||||||
c = newc;
|
c = newc;
|
||||||
}
|
}
|
||||||
|
|
||||||
renderCharacter(c);
|
renderCharacter(c);
|
||||||
}
|
}
|
||||||
|
|
@ -366,13 +366,12 @@ void Font::drawWordWrapInternal(const wstring& string, int x, int y, int w, int
|
||||||
vector<wstring>lines = stringSplit(string,L'\n');
|
vector<wstring>lines = stringSplit(string,L'\n');
|
||||||
if (lines.size() > 1)
|
if (lines.size() > 1)
|
||||||
{
|
{
|
||||||
AUTO_VAR(itEnd, lines.end());
|
for ( auto& it : lines )
|
||||||
for (AUTO_VAR(it, lines.begin()); it != itEnd; it++)
|
{
|
||||||
{
|
|
||||||
// 4J Stu - Don't draw text that will be partially cutoff/overlap something it shouldn't
|
// 4J Stu - Don't draw text that will be partially cutoff/overlap something it shouldn't
|
||||||
if( (y + this->wordWrapHeight(*it, w)) > h) break;
|
if( (y + this->wordWrapHeight(it, w)) > h) break;
|
||||||
drawWordWrapInternal(*it, x, y, w, col, h);
|
drawWordWrapInternal(it, x, y, w, col, h);
|
||||||
y += this->wordWrapHeight(*it, w);
|
y += this->wordWrapHeight(it, w);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -418,10 +417,9 @@ int Font::wordWrapHeight(const wstring& string, int w)
|
||||||
if (lines.size() > 1)
|
if (lines.size() > 1)
|
||||||
{
|
{
|
||||||
int h = 0;
|
int h = 0;
|
||||||
AUTO_VAR(itEnd, lines.end());
|
for ( auto& it : lines )
|
||||||
for (AUTO_VAR(it, lines.begin()); it != itEnd; it++)
|
{
|
||||||
{
|
h += this->wordWrapHeight(it, w);
|
||||||
h += this->wordWrapHeight(*it, w);
|
|
||||||
}
|
}
|
||||||
return h;
|
return h;
|
||||||
}
|
}
|
||||||
|
|
@ -483,7 +481,7 @@ bool Font::AllCharactersValid(const wstring &str)
|
||||||
int index = SharedConstants::acceptableLetters.find(c);
|
int index = SharedConstants::acceptableLetters.find(c);
|
||||||
|
|
||||||
if ((c != ' ') && !(index > 0 && !enforceUnicodeSheet))
|
if ((c != ' ') && !(index > 0 && !enforceUnicodeSheet))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -598,7 +596,7 @@ void Font::renderUnicodeCharacter(wchar_t c)
|
||||||
float xOff = c % 16 * 16 + left;
|
float xOff = c % 16 * 16 + left;
|
||||||
float yOff = (c & 0xFF) / 16 * 16;
|
float yOff = (c & 0xFF) / 16 * 16;
|
||||||
float width = right - left - .02f;
|
float width = right - left - .02f;
|
||||||
|
|
||||||
Tesselator *t = Tesselator::getInstance();
|
Tesselator *t = Tesselator::getInstance();
|
||||||
t->begin(GL_TRIANGLE_STRIP);
|
t->begin(GL_TRIANGLE_STRIP);
|
||||||
t->tex(xOff / 256.0F, yOff / 256.0F);
|
t->tex(xOff / 256.0F, yOff / 256.0F);
|
||||||
|
|
|
||||||
|
|
@ -186,7 +186,7 @@ GameRenderer::~GameRenderer()
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameRenderer::tick(bool first) // 4J - add bFirst
|
void GameRenderer::tick(bool first) // 4J - add bFirst
|
||||||
{
|
{
|
||||||
tickFov();
|
tickFov();
|
||||||
tickLightTexture(); // 4J - change brought forward from 1.8.2
|
tickLightTexture(); // 4J - change brought forward from 1.8.2
|
||||||
fogBrO = fogBr;
|
fogBrO = fogBr;
|
||||||
|
|
@ -308,11 +308,9 @@ void GameRenderer::pick(float a)
|
||||||
vector<shared_ptr<Entity> > *objects = mc->level->getEntities(mc->cameraTargetPlayer, mc->cameraTargetPlayer->bb->expand(b->x * (range), b->y * (range), b->z * (range))->grow(overlap, overlap, overlap));
|
vector<shared_ptr<Entity> > *objects = mc->level->getEntities(mc->cameraTargetPlayer, mc->cameraTargetPlayer->bb->expand(b->x * (range), b->y * (range), b->z * (range))->grow(overlap, overlap, overlap));
|
||||||
double nearest = dist;
|
double nearest = dist;
|
||||||
|
|
||||||
AUTO_VAR(itEnd, objects->end());
|
for (auto& e : *objects )
|
||||||
for (AUTO_VAR(it, objects->begin()); it != itEnd; it++)
|
{
|
||||||
{
|
if ( e == nullptr || !e->isPickable() ) continue;
|
||||||
shared_ptr<Entity> e = *it; //objects->at(i);
|
|
||||||
if (!e->isPickable()) continue;
|
|
||||||
|
|
||||||
float rr = e->getPickRadius();
|
float rr = e->getPickRadius();
|
||||||
AABB *bb = e->bb->grow(rr, rr, rr);
|
AABB *bb = e->bb->grow(rr, rr, rr);
|
||||||
|
|
@ -325,7 +323,7 @@ void GameRenderer::pick(float a)
|
||||||
nearest = 0;
|
nearest = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (p != NULL)
|
else if (p != nullptr)
|
||||||
{
|
{
|
||||||
double dd = from->distanceTo(p->pos);
|
double dd = from->distanceTo(p->pos);
|
||||||
if (e == mc->cameraTargetPlayer->riding != NULL)
|
if (e == mc->cameraTargetPlayer->riding != NULL)
|
||||||
|
|
@ -335,7 +333,7 @@ void GameRenderer::pick(float a)
|
||||||
hovered = e;
|
hovered = e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
hovered = e;
|
hovered = e;
|
||||||
nearest = dd;
|
nearest = dd;
|
||||||
|
|
@ -595,7 +593,7 @@ void GameRenderer::unZoomRegion()
|
||||||
void GameRenderer::getFovAndAspect(float& fov, float& aspect, float a, bool applyEffects)
|
void GameRenderer::getFovAndAspect(float& fov, float& aspect, float a, bool applyEffects)
|
||||||
{
|
{
|
||||||
// 4J - split out aspect ratio and fov here so we can adjust for viewports - we might need to revisit these as
|
// 4J - split out aspect ratio and fov here so we can adjust for viewports - we might need to revisit these as
|
||||||
// they are maybe be too generous for performance.
|
// they are maybe be too generous for performance.
|
||||||
aspect = mc->width / (float) mc->height;
|
aspect = mc->width / (float) mc->height;
|
||||||
fov = getFov(a, applyEffects);
|
fov = getFov(a, applyEffects);
|
||||||
|
|
||||||
|
|
@ -735,14 +733,14 @@ void GameRenderer::renderItemInHand(float a, int eye)
|
||||||
bool bNoLegAnim =(localplayer->getAnimOverrideBitmask()&( (1<<HumanoidModel::eAnim_NoLegAnim) | (1<<HumanoidModel::eAnim_NoBobbing) ))!=0;
|
bool bNoLegAnim =(localplayer->getAnimOverrideBitmask()&( (1<<HumanoidModel::eAnim_NoLegAnim) | (1<<HumanoidModel::eAnim_NoBobbing) ))!=0;
|
||||||
if(app.GetGameSettings(localplayer->GetXboxPad(),eGameSetting_ViewBob) && !localplayer->abilities.flying && !bNoLegAnim) bobView(a);
|
if(app.GetGameSettings(localplayer->GetXboxPad(),eGameSetting_ViewBob) && !localplayer->abilities.flying && !bNoLegAnim) bobView(a);
|
||||||
|
|
||||||
// 4J: Skip hand rendering if render hand is off
|
// 4J: Skip hand rendering if render hand is off
|
||||||
if (renderHand)
|
if (renderHand)
|
||||||
{
|
{
|
||||||
// 4J-PB - changing this to be per player
|
// 4J-PB - changing this to be per player
|
||||||
//if (!mc->options->thirdPersonView && !mc->cameraTargetPlayer->isSleeping())
|
//if (!mc->options->thirdPersonView && !mc->cameraTargetPlayer->isSleeping())
|
||||||
if (!localplayer->ThirdPersonView() && !mc->cameraTargetPlayer->isSleeping())
|
if (!localplayer->ThirdPersonView() && !mc->cameraTargetPlayer->isSleeping())
|
||||||
{
|
{
|
||||||
if (!mc->options->hideGui && !mc->gameMode->isCutScene())
|
if (!mc->options->hideGui && !mc->gameMode->isCutScene())
|
||||||
{
|
{
|
||||||
turnOnLightLayer(a);
|
turnOnLightLayer(a);
|
||||||
PIXBeginNamedEvent(0,"Item in hand render");
|
PIXBeginNamedEvent(0,"Item in hand render");
|
||||||
|
|
@ -770,7 +768,7 @@ void GameRenderer::renderItemInHand(float a, int eye)
|
||||||
// 4J - change brought forward from 1.8.2
|
// 4J - change brought forward from 1.8.2
|
||||||
void GameRenderer::turnOffLightLayer(double alpha)
|
void GameRenderer::turnOffLightLayer(double alpha)
|
||||||
{ // 4J - TODO
|
{ // 4J - TODO
|
||||||
#if 0
|
#if 0
|
||||||
if (SharedConstants::TEXTURE_LIGHTING)
|
if (SharedConstants::TEXTURE_LIGHTING)
|
||||||
{
|
{
|
||||||
glClientActiveTexture(GL_TEXTURE1);
|
glClientActiveTexture(GL_TEXTURE1);
|
||||||
|
|
@ -1111,7 +1109,7 @@ int GameRenderer::runUpdate(LPVOID lpParam)
|
||||||
Vec3::CreateNewThreadStorage();
|
Vec3::CreateNewThreadStorage();
|
||||||
AABB::CreateNewThreadStorage();
|
AABB::CreateNewThreadStorage();
|
||||||
IntCache::CreateNewThreadStorage();
|
IntCache::CreateNewThreadStorage();
|
||||||
Tesselator::CreateNewThreadStorage(1024*1024);
|
Tesselator::CreateNewThreadStorage(1024*1024);
|
||||||
Compression::UseDefaultThreadStorage();
|
Compression::UseDefaultThreadStorage();
|
||||||
RenderManager.InitialiseContext();
|
RenderManager.InitialiseContext();
|
||||||
#ifdef _LARGE_WORLDS
|
#ifdef _LARGE_WORLDS
|
||||||
|
|
@ -1185,7 +1183,7 @@ int GameRenderer::runUpdate(LPVOID lpParam)
|
||||||
|
|
||||||
AABB::resetPool();
|
AABB::resetPool();
|
||||||
Vec3::resetPool();
|
Vec3::resetPool();
|
||||||
IntCache::Reset();
|
IntCache::Reset();
|
||||||
m_updateEvents->Set(eUpdateEventIsFinished);
|
m_updateEvents->Set(eUpdateEventIsFinished);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1217,7 +1215,7 @@ void GameRenderer::DisableUpdateThread()
|
||||||
if( !updateRunning) return;
|
if( !updateRunning) return;
|
||||||
app.DebugPrintf("------------------DisableUpdateThread--------------------\n");
|
app.DebugPrintf("------------------DisableUpdateThread--------------------\n");
|
||||||
updateRunning = false;
|
updateRunning = false;
|
||||||
m_updateEvents->Clear(eUpdateCanRun);
|
m_updateEvents->Clear(eUpdateCanRun);
|
||||||
m_updateEvents->WaitForSingle(eUpdateEventIsFinished,INFINITE);
|
m_updateEvents->WaitForSingle(eUpdateEventIsFinished,INFINITE);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
@ -1588,7 +1586,7 @@ void GameRenderer::renderSnowAndRain(float a)
|
||||||
|
|
||||||
turnOnLightLayer(a);
|
turnOnLightLayer(a);
|
||||||
|
|
||||||
if (rainXa == NULL)
|
if (rainXa == NULL)
|
||||||
{
|
{
|
||||||
rainXa = new float[32 * 32];
|
rainXa = new float[32 * 32];
|
||||||
rainZa = new float[32 * 32];
|
rainZa = new float[32 * 32];
|
||||||
|
|
@ -1709,9 +1707,9 @@ void GameRenderer::renderSnowAndRain(float a)
|
||||||
float Alpha = ((1 - dd * dd) * 0.5f + 0.5f) * rainLevel;
|
float Alpha = ((1 - dd * dd) * 0.5f + 0.5f) * rainLevel;
|
||||||
int tex2 = (level->getLightColor(x, yl, z, 0) * 3 + 0xf000f0) / 4;
|
int tex2 = (level->getLightColor(x, yl, z, 0) * 3 + 0xf000f0) / 4;
|
||||||
t->tileRainQuad(x - xa + 0.5, yy0, z - za + 0.5, 0 * s, yy0 * s / 4.0f + ra * s,
|
t->tileRainQuad(x - xa + 0.5, yy0, z - za + 0.5, 0 * s, yy0 * s / 4.0f + ra * s,
|
||||||
x + xa + 0.5, yy0, z + za + 0.5, 1 * s, yy0 * s / 4.0f + ra * s,
|
x + xa + 0.5, yy0, z + za + 0.5, 1 * s, yy0 * s / 4.0f + ra * s,
|
||||||
x + xa + 0.5, yy1, z + za + 0.5, 1 * s, yy1 * s / 4.0f + ra * s,
|
x + xa + 0.5, yy1, z + za + 0.5, 1 * s, yy1 * s / 4.0f + ra * s,
|
||||||
x - xa + 0.5, yy1, z - za + 0.5, 0 * s, yy1 * s / 4.0f + ra * s,
|
x - xa + 0.5, yy1, z - za + 0.5, 0 * s, yy1 * s / 4.0f + ra * s,
|
||||||
br, br, br, Alpha, br, br, br, 0, tex2);
|
br, br, br, Alpha, br, br, br, 0, tex2);
|
||||||
#else
|
#else
|
||||||
t->tex2(level->getLightColor(x, yl, z, 0));
|
t->tex2(level->getLightColor(x, yl, z, 0));
|
||||||
|
|
@ -1747,9 +1745,9 @@ void GameRenderer::renderSnowAndRain(float a)
|
||||||
float Alpha = ((1 - dd * dd) * 0.3f + 0.5f) * rainLevel;
|
float Alpha = ((1 - dd * dd) * 0.3f + 0.5f) * rainLevel;
|
||||||
int tex2 = (level->getLightColor(x, yl, z, 0) * 3 + 0xf000f0) / 4;
|
int tex2 = (level->getLightColor(x, yl, z, 0) * 3 + 0xf000f0) / 4;
|
||||||
t->tileRainQuad(x - xa + 0.5, yy0, z - za + 0.5, 0 * s + uo, yy0 * s / 4.0f + ra * s + vo,
|
t->tileRainQuad(x - xa + 0.5, yy0, z - za + 0.5, 0 * s + uo, yy0 * s / 4.0f + ra * s + vo,
|
||||||
x + xa + 0.5, yy0, z + za + 0.5, 1 * s + uo, yy0 * s / 4.0f + ra * s + vo,
|
x + xa + 0.5, yy0, z + za + 0.5, 1 * s + uo, yy0 * s / 4.0f + ra * s + vo,
|
||||||
x + xa + 0.5, yy1, z + za + 0.5, 1 * s + uo, yy1 * s / 4.0f + ra * s + vo,
|
x + xa + 0.5, yy1, z + za + 0.5, 1 * s + uo, yy1 * s / 4.0f + ra * s + vo,
|
||||||
x - xa + 0.5, yy1, z - za + 0.5, 0 * s + uo, yy1 * s / 4.0f + ra * s + vo,
|
x - xa + 0.5, yy1, z - za + 0.5, 0 * s + uo, yy1 * s / 4.0f + ra * s + vo,
|
||||||
br, br, br, Alpha, br, br, br, Alpha, tex2);
|
br, br, br, Alpha, br, br, br, Alpha, tex2);
|
||||||
#else
|
#else
|
||||||
t->tex2((level->getLightColor(x, yl, z, 0) * 3 + 0xf000f0) / 4);
|
t->tex2((level->getLightColor(x, yl, z, 0) * 3 + 0xf000f0) / 4);
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse)
|
||||||
{
|
{
|
||||||
// 4J Stu - I have copied this code for XUI_BaseScene. If/when it gets changed it should be broken out
|
// 4J Stu - I have copied this code for XUI_BaseScene. If/when it gets changed it should be broken out
|
||||||
// 4J - altered to force full screen mode to 3X scaling, and any split screen modes to 2X scaling. This is so that the further scaling by 0.5 that
|
// 4J - altered to force full screen mode to 3X scaling, and any split screen modes to 2X scaling. This is so that the further scaling by 0.5 that
|
||||||
// happens in split screen modes results in a final scaling of 1 rather than 1.5.
|
// happens in split screen modes results in a final scaling of 1 rather than 1.5.
|
||||||
int splitYOffset;// = 20; // This offset is applied when doing the 2X scaling above to move the gui out of the way of the tool tips
|
int splitYOffset;// = 20; // This offset is applied when doing the 2X scaling above to move the gui out of the way of the tool tips
|
||||||
int guiScale;// = ( minecraft->player->m_iScreenSection == C4JRender::VIEWPORT_TYPE_FULLSCREEN ? 3 : 2 );
|
int guiScale;// = ( minecraft->player->m_iScreenSection == C4JRender::VIEWPORT_TYPE_FULLSCREEN ? 3 : 2 );
|
||||||
int iPad=minecraft->player->GetXboxPad();
|
int iPad=minecraft->player->GetXboxPad();
|
||||||
|
|
@ -100,7 +100,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse)
|
||||||
default: // 2
|
default: // 2
|
||||||
splitYOffset = 10;
|
splitYOffset = 10;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check which screen section this player is in
|
// Check which screen section this player is in
|
||||||
switch(minecraft->player->m_iScreenSection)
|
switch(minecraft->player->m_iScreenSection)
|
||||||
|
|
@ -143,7 +143,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse)
|
||||||
currentGuiScaleFactor *= 0.5f;
|
currentGuiScaleFactor *= 0.5f;
|
||||||
break;
|
break;
|
||||||
case C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT:
|
case C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT:
|
||||||
iSafezoneXHalf = 0;
|
iSafezoneXHalf = 0;
|
||||||
iSafezoneYHalf = splitYOffset + screenHeight/10;// 5% (need to treat the whole screen is 2x this screen)
|
iSafezoneYHalf = splitYOffset + screenHeight/10;// 5% (need to treat the whole screen is 2x this screen)
|
||||||
iSafezoneTopYHalf = splitYOffset + screenHeight/10;
|
iSafezoneTopYHalf = splitYOffset + screenHeight/10;
|
||||||
fScaleFactorHeight=0.5f;
|
fScaleFactorHeight=0.5f;
|
||||||
|
|
@ -160,7 +160,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse)
|
||||||
currentGuiScaleFactor *= 0.5f;
|
currentGuiScaleFactor *= 0.5f;
|
||||||
break;
|
break;
|
||||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT:
|
case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT:
|
||||||
iSafezoneXHalf = 0;
|
iSafezoneXHalf = 0;
|
||||||
iSafezoneYHalf = splitYOffset; // 5%
|
iSafezoneYHalf = splitYOffset; // 5%
|
||||||
iSafezoneTopYHalf = screenHeight/10;
|
iSafezoneTopYHalf = screenHeight/10;
|
||||||
iTooltipsYOffset=44;
|
iTooltipsYOffset=44;
|
||||||
|
|
@ -174,28 +174,28 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse)
|
||||||
currentGuiScaleFactor *= 0.5f;
|
currentGuiScaleFactor *= 0.5f;
|
||||||
break;
|
break;
|
||||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT:
|
case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT:
|
||||||
iSafezoneXHalf = 0;
|
iSafezoneXHalf = 0;
|
||||||
iSafezoneYHalf = splitYOffset + screenHeight/10; // 5% (the whole screen is 2x this screen)
|
iSafezoneYHalf = splitYOffset + screenHeight/10; // 5% (the whole screen is 2x this screen)
|
||||||
iSafezoneTopYHalf = 0;
|
iSafezoneTopYHalf = 0;
|
||||||
iTooltipsYOffset=44;
|
iTooltipsYOffset=44;
|
||||||
currentGuiScaleFactor *= 0.5f;
|
currentGuiScaleFactor *= 0.5f;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4J-PB - turn off the slot display if a xui menu is up, or if we're autosaving
|
// 4J-PB - turn off the slot display if a xui menu is up, or if we're autosaving
|
||||||
bool bDisplayGui=!ui.GetMenuDisplayed(iPad) && !(app.GetXuiAction(iPad)==eAppAction_AutosaveSaveGameCapturedThumbnail);
|
bool bDisplayGui=!ui.GetMenuDisplayed(iPad) && !(app.GetXuiAction(iPad)==eAppAction_AutosaveSaveGameCapturedThumbnail);
|
||||||
|
|
||||||
// if tooltips are off, set the y offset to zero
|
// if tooltips are off, set the y offset to zero
|
||||||
if(app.GetGameSettings(iPad,eGameSetting_Tooltips)==0 && bDisplayGui)
|
if(app.GetGameSettings(iPad,eGameSetting_Tooltips)==0 && bDisplayGui)
|
||||||
{
|
{
|
||||||
switch(minecraft->player->m_iScreenSection)
|
switch(minecraft->player->m_iScreenSection)
|
||||||
{
|
{
|
||||||
case C4JRender::VIEWPORT_TYPE_FULLSCREEN:
|
case C4JRender::VIEWPORT_TYPE_FULLSCREEN:
|
||||||
iTooltipsYOffset=screenHeight/10;
|
iTooltipsYOffset=screenHeight/10;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
//iTooltipsYOffset=screenHeight/10;
|
//iTooltipsYOffset=screenHeight/10;
|
||||||
switch(guiScale)
|
switch(guiScale)
|
||||||
{
|
{
|
||||||
case 3:
|
case 3:
|
||||||
|
|
@ -207,11 +207,11 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse)
|
||||||
default: // 2
|
default: // 2
|
||||||
iTooltipsYOffset=14;//screenHeight/10;
|
iTooltipsYOffset=14;//screenHeight/10;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4J-PB - Turn off interface if eGameSetting_DisplayHUD is off - for screen shots/videos.
|
// 4J-PB - Turn off interface if eGameSetting_DisplayHUD is off - for screen shots/videos.
|
||||||
if ( app.GetGameSettings(iPad,eGameSetting_DisplayHUD)==0 )
|
if ( app.GetGameSettings(iPad,eGameSetting_DisplayHUD)==0 )
|
||||||
{
|
{
|
||||||
|
|
@ -222,13 +222,13 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse)
|
||||||
|
|
||||||
|
|
||||||
minecraft->gameRenderer->setupGuiScreen(guiScale);
|
minecraft->gameRenderer->setupGuiScreen(guiScale);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // 4J - added - this did actually get set in renderVignette but that code is currently commented out
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // 4J - added - this did actually get set in renderVignette but that code is currently commented out
|
||||||
|
|
||||||
if (Minecraft::useFancyGraphics())
|
if (Minecraft::useFancyGraphics())
|
||||||
{
|
{
|
||||||
renderVignette(minecraft->player->getBrightness(a), screenWidth, screenHeight);
|
renderVignette(minecraft->player->getBrightness(a), screenWidth, screenHeight);
|
||||||
}
|
}
|
||||||
|
|
@ -256,7 +256,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse)
|
||||||
if(bDisplayGui && bTwoPlayerSplitscreen)
|
if(bDisplayGui && bTwoPlayerSplitscreen)
|
||||||
{
|
{
|
||||||
// need to apply scale factors depending on the mode
|
// need to apply scale factors depending on the mode
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glScalef(fScaleFactorWidth, fScaleFactorHeight, fScaleFactorWidth);
|
glScalef(fScaleFactorWidth, fScaleFactorHeight, fScaleFactorWidth);
|
||||||
}
|
}
|
||||||
#if RENDER_HUD
|
#if RENDER_HUD
|
||||||
|
|
@ -320,9 +320,9 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse)
|
||||||
// need to apply scale factors depending on the mode
|
// need to apply scale factors depending on the mode
|
||||||
|
|
||||||
// 4J Stu - Moved this push and scale further up as we still need to do it for the few HUD components not replaced by xui
|
// 4J Stu - Moved this push and scale further up as we still need to do it for the few HUD components not replaced by xui
|
||||||
//glPushMatrix();
|
//glPushMatrix();
|
||||||
//glScalef(fScaleFactorWidth, fScaleFactorHeight, fScaleFactorWidth);
|
//glScalef(fScaleFactorWidth, fScaleFactorHeight, fScaleFactorWidth);
|
||||||
|
|
||||||
// 4J-PB - move into the safe zone, and account for 2 player splitscreen
|
// 4J-PB - move into the safe zone, and account for 2 player splitscreen
|
||||||
blit(iWidthOffset + (screenWidth - quickSelectWidth)/2, iHeightOffset + screenHeight - iSafezoneYHalf - iTooltipsYOffset , 0, 0, 182, 22);
|
blit(iWidthOffset + (screenWidth - quickSelectWidth)/2, iHeightOffset + screenHeight - iSafezoneYHalf - iTooltipsYOffset , 0, 0, 182, 22);
|
||||||
blit(iWidthOffset + (screenWidth - quickSelectWidth)/2 - 1 + inventory->selected * 20, iHeightOffset + screenHeight - iSafezoneYHalf - iTooltipsYOffset - 1, 0, 22, 24, 22);
|
blit(iWidthOffset + (screenWidth - quickSelectWidth)/2 - 1 + inventory->selected * 20, iHeightOffset + screenHeight - iSafezoneYHalf - iTooltipsYOffset - 1, 0, 22, 24, 22);
|
||||||
|
|
@ -370,13 +370,13 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse)
|
||||||
int food = foodData->getFoodLevel();
|
int food = foodData->getFoodLevel();
|
||||||
int oldFood = foodData->getLastFoodLevel();
|
int oldFood = foodData->getLastFoodLevel();
|
||||||
|
|
||||||
// if (false) //(true)
|
// if (false) //(true)
|
||||||
// {
|
// {
|
||||||
// renderBossHealth();
|
// renderBossHealth();
|
||||||
// }
|
// }
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////
|
||||||
// Display the experience, food, armour, health and the air bubbles
|
// Display the experience, food, armour, health and the air bubbles
|
||||||
/////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////
|
||||||
if(bDisplayGui)
|
if(bDisplayGui)
|
||||||
{
|
{
|
||||||
|
|
@ -625,12 +625,12 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse)
|
||||||
glEnable(GL_RESCALE_NORMAL);
|
glEnable(GL_RESCALE_NORMAL);
|
||||||
|
|
||||||
Lighting::turnOnGui();
|
Lighting::turnOnGui();
|
||||||
|
|
||||||
|
|
||||||
int x,y;
|
int x,y;
|
||||||
|
|
||||||
for (int i = 0; i < 9; i++)
|
for (int i = 0; i < 9; i++)
|
||||||
{
|
{
|
||||||
if(bTwoPlayerSplitscreen)
|
if(bTwoPlayerSplitscreen)
|
||||||
{
|
{
|
||||||
x = iWidthOffset + screenWidth / 2 - 9 * 10 + i * 20 + 2;
|
x = iWidthOffset + screenWidth / 2 - 9 * 10 + i * 20 + 2;
|
||||||
|
|
@ -667,11 +667,11 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse)
|
||||||
else if( minecraft->player->isSprinting() )
|
else if( minecraft->player->isSprinting() )
|
||||||
{
|
{
|
||||||
characterDisplayTimer[iPad] = 30;
|
characterDisplayTimer[iPad] = 30;
|
||||||
}
|
}
|
||||||
else if( minecraft->player->abilities.flying)
|
else if( minecraft->player->abilities.flying)
|
||||||
{
|
{
|
||||||
characterDisplayTimer[iPad] = 5; // quickly get rid of the player display if they stop flying
|
characterDisplayTimer[iPad] = 5; // quickly get rid of the player display if they stop flying
|
||||||
}
|
}
|
||||||
else if( characterDisplayTimer[iPad] > 0 )
|
else if( characterDisplayTimer[iPad] > 0 )
|
||||||
{
|
{
|
||||||
--characterDisplayTimer[iPad];
|
--characterDisplayTimer[iPad];
|
||||||
|
|
@ -733,7 +733,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse)
|
||||||
|
|
||||||
minecraft->player->onFire = 0;
|
minecraft->player->onFire = 0;
|
||||||
minecraft->player->setSharedFlag(Entity::FLAG_ONFIRE, false);
|
minecraft->player->setSharedFlag(Entity::FLAG_ONFIRE, false);
|
||||||
|
|
||||||
// 4J - TomK don't offset the player. it's easier to align it with the safe zones that way!
|
// 4J - TomK don't offset the player. it's easier to align it with the safe zones that way!
|
||||||
//glTranslatef(0, minecraft->player->heightOffset, 0);
|
//glTranslatef(0, minecraft->player->heightOffset, 0);
|
||||||
glTranslatef(0, 0, 0);
|
glTranslatef(0, 0, 0);
|
||||||
|
|
@ -777,7 +777,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse)
|
||||||
{
|
{
|
||||||
y-=13;
|
y-=13;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(bTwoPlayerSplitscreen)
|
if(bTwoPlayerSplitscreen)
|
||||||
{
|
{
|
||||||
y+=iHeightOffset;
|
y+=iHeightOffset;
|
||||||
|
|
@ -849,7 +849,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse)
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
if (Minecraft::warezTime > 0) glTranslatef(0, 32, 0);
|
if (Minecraft::warezTime > 0) glTranslatef(0, 32, 0);
|
||||||
font->drawShadow(ClientConstants::VERSION_STRING + L" (" + minecraft->fpsString + L")", iSafezoneXHalf+2, 20, 0xffffff);
|
font->drawShadow(ClientConstants::VERSION_STRING + L" (" + minecraft->fpsString + L")", iSafezoneXHalf+2, 20, 0xffffff);
|
||||||
font->drawShadow(L"Seed: " + _toString<__int64>(minecraft->level->getLevelData()->getSeed() ), iSafezoneXHalf+2, 32 + 00, 0xffffff);
|
font->drawShadow(L"Seed: " + std::to_wstring(minecraft->level->getLevelData()->getSeed() ), iSafezoneXHalf+2, 32 + 00, 0xffffff);
|
||||||
font->drawShadow(minecraft->gatherStats1(), iSafezoneXHalf+2, 32 + 10, 0xffffff);
|
font->drawShadow(minecraft->gatherStats1(), iSafezoneXHalf+2, 32 + 10, 0xffffff);
|
||||||
font->drawShadow(minecraft->gatherStats2(), iSafezoneXHalf+2, 32 + 20, 0xffffff);
|
font->drawShadow(minecraft->gatherStats2(), iSafezoneXHalf+2, 32 + 20, 0xffffff);
|
||||||
font->drawShadow(minecraft->gatherStats3(), iSafezoneXHalf+2, 32 + 30, 0xffffff);
|
font->drawShadow(minecraft->gatherStats3(), iSafezoneXHalf+2, 32 + 30, 0xffffff);
|
||||||
|
|
@ -871,7 +871,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse)
|
||||||
{
|
{
|
||||||
FEATURE_DATA *pFeatureData=app.m_vTerrainFeatures[i];
|
FEATURE_DATA *pFeatureData=app.m_vTerrainFeatures[i];
|
||||||
|
|
||||||
wstring itemInfo = L"[" + _toString<int>( pFeatureData->x*16 ) + L", " + _toString<int>( pFeatureData->z*16 ) + L"] ";
|
wstring itemInfo = L"[" + std::to_wstring( pFeatureData->x*16 ) + L", " + std::to_wstring( pFeatureData->z*16 ) + L"] ";
|
||||||
wfeature[pFeatureData->eTerrainFeature] += itemInfo;
|
wfeature[pFeatureData->eTerrainFeature] += itemInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -899,10 +899,10 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse)
|
||||||
double xBlockPos = floor(minecraft->player->x);
|
double xBlockPos = floor(minecraft->player->x);
|
||||||
double yBlockPos = floor(minecraft->player->y);
|
double yBlockPos = floor(minecraft->player->y);
|
||||||
double zBlockPos = floor(minecraft->player->z);
|
double zBlockPos = floor(minecraft->player->z);
|
||||||
drawString(font, L"x: " + _toString<double>(minecraft->player->x) + L"/ Head: " + _toString<double>(xBlockPos) + L"/ Chunk: " + _toString<double>(minecraft->player->xChunk), iSafezoneXHalf+2, iYPos + 8 * 0, 0xe0e0e0);
|
drawString(font, L"x: " + std::to_wstring(minecraft->player->x) + L"/ Head: " + std::to_wstring(static_cast<int>(xBlockPos)) + L"/ Chunk: " + std::to_wstring(minecraft->player->xChunk), iSafezoneXHalf+2, iYPos + 8 * 0, 0xe0e0e0);
|
||||||
drawString(font, L"y: " + _toString<double>(minecraft->player->y) + L"/ Head: " + _toString<double>(yBlockPos), iSafezoneXHalf+2, iYPos + 8 * 1, 0xe0e0e0);
|
drawString(font, L"y: " + std::to_wstring(minecraft->player->y) + L"/ Head: " + std::to_wstring(static_cast<int>(yBlockPos)), iSafezoneXHalf+2, iYPos + 8 * 1, 0xe0e0e0);
|
||||||
drawString(font, L"z: " + _toString<double>(minecraft->player->z) + L"/ Head: " + _toString<double>(zBlockPos) + L"/ Chunk: " + _toString<double>(minecraft->player->zChunk), iSafezoneXHalf+2, iYPos + 8 * 2, 0xe0e0e0);
|
drawString(font, L"z: " + std::to_wstring(minecraft->player->z) + L"/ Head: " + std::to_wstring(static_cast<int>(zBlockPos)) + L"/ Chunk: " + std::to_wstring(minecraft->player->zChunk), iSafezoneXHalf+2, iYPos + 8 * 2, 0xe0e0e0);
|
||||||
drawString(font, L"f: " + _toString<double>(Mth::floor(minecraft->player->yRot * 4.0f / 360.0f + 0.5) & 0x3) + L"/ yRot: " + _toString<double>(minecraft->player->yRot), iSafezoneXHalf+2, iYPos + 8 * 3, 0xe0e0e0);
|
drawString(font, L"f: " + std::to_wstring(Mth::floor(minecraft->player->yRot * 4.0f / 360.0f + 0.5) & 0x3) + L"/ yRot: " + std::to_wstring(minecraft->player->yRot), iSafezoneXHalf+2, iYPos + 8 * 3, 0xe0e0e0);
|
||||||
iYPos += 8*4;
|
iYPos += 8*4;
|
||||||
|
|
||||||
int px = Mth::floor(minecraft->player->x);
|
int px = Mth::floor(minecraft->player->x);
|
||||||
|
|
@ -914,7 +914,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse)
|
||||||
Biome *biome = chunkAt->getBiome(px & 15, pz & 15, minecraft->level->getBiomeSource());
|
Biome *biome = chunkAt->getBiome(px & 15, pz & 15, minecraft->level->getBiomeSource());
|
||||||
drawString(
|
drawString(
|
||||||
font,
|
font,
|
||||||
L"b: " + biome->m_name + L" (" + _toString<int>(biome->id) + L")", iSafezoneXHalf+2, iYPos, 0xe0e0e0);
|
L"b: " + biome->m_name + L" (" + std::to_wstring(biome->id) + L")", iSafezoneXHalf+2, iYPos, 0xe0e0e0);
|
||||||
}
|
}
|
||||||
|
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
|
|
@ -931,7 +931,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse)
|
||||||
float t = overlayMessageTime - a;
|
float t = overlayMessageTime - a;
|
||||||
int alpha = (int) (t * 256 / 20);
|
int alpha = (int) (t * 256 / 20);
|
||||||
if (alpha > 255) alpha = 255;
|
if (alpha > 255) alpha = 255;
|
||||||
if (alpha > 0)
|
if (alpha > 0)
|
||||||
{
|
{
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
|
|
||||||
|
|
@ -958,7 +958,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
unsigned int max = 10;
|
unsigned int max = 10;
|
||||||
bool isChatting = false;
|
bool isChatting = false;
|
||||||
if (dynamic_cast<ChatScreen *>(minecraft->screen) != NULL)
|
if (dynamic_cast<ChatScreen *>(minecraft->screen) != NULL)
|
||||||
|
|
@ -1091,35 +1091,35 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse)
|
||||||
// void Gui::renderBossHealth(void)
|
// void Gui::renderBossHealth(void)
|
||||||
// {
|
// {
|
||||||
// if (EnderDragonRenderer::bossInstance == NULL) return;
|
// if (EnderDragonRenderer::bossInstance == NULL) return;
|
||||||
//
|
//
|
||||||
// shared_ptr<EnderDragon> boss = EnderDragonRenderer::bossInstance;
|
// shared_ptr<EnderDragon> boss = EnderDragonRenderer::bossInstance;
|
||||||
// EnderDragonRenderer::bossInstance = NULL;
|
// EnderDragonRenderer::bossInstance = NULL;
|
||||||
//
|
//
|
||||||
// Minecraft *pMinecraft=Minecraft::GetInstance();
|
// Minecraft *pMinecraft=Minecraft::GetInstance();
|
||||||
//
|
//
|
||||||
// Font *font = pMinecraft->font;
|
// Font *font = pMinecraft->font;
|
||||||
//
|
//
|
||||||
// ScreenSizeCalculator ssc(pMinecraft->options, pMinecraft->width_phys, pMinecraft->height_phys);
|
// ScreenSizeCalculator ssc(pMinecraft->options, pMinecraft->width_phys, pMinecraft->height_phys);
|
||||||
// int screenWidth = ssc.getWidth();
|
// int screenWidth = ssc.getWidth();
|
||||||
//
|
//
|
||||||
// int w = 182;
|
// int w = 182;
|
||||||
// int xLeft = screenWidth / 2 - w / 2;
|
// int xLeft = screenWidth / 2 - w / 2;
|
||||||
//
|
//
|
||||||
// int progress = (int) (boss->getSynchedHealth() / (float) boss->getMaxHealth() * (float) (w + 1));
|
// int progress = (int) (boss->getSynchedHealth() / (float) boss->getMaxHealth() * (float) (w + 1));
|
||||||
//
|
//
|
||||||
// int yo = 12;
|
// int yo = 12;
|
||||||
// blit(xLeft, yo, 0, 74, w, 5);
|
// blit(xLeft, yo, 0, 74, w, 5);
|
||||||
// blit(xLeft, yo, 0, 74, w, 5);
|
// blit(xLeft, yo, 0, 74, w, 5);
|
||||||
// if (progress > 0)
|
// if (progress > 0)
|
||||||
// {
|
// {
|
||||||
// blit(xLeft, yo, 0, 79, progress, 5);
|
// blit(xLeft, yo, 0, 79, progress, 5);
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// wstring msg = L"Boss health - NON LOCALISED";
|
// wstring msg = L"Boss health - NON LOCALISED";
|
||||||
// font->drawShadow(msg, screenWidth / 2 - font->width(msg) / 2, yo - 10, 0xff00ff);
|
// font->drawShadow(msg, screenWidth / 2 - font->width(msg) / 2, yo - 10, 0xff00ff);
|
||||||
// glColor4f(1, 1, 1, 1);
|
// glColor4f(1, 1, 1, 1);
|
||||||
// glBindTexture(GL_TEXTURE_2D, pMinecraft->textures->loadTexture(TN_GUI_ICONS) );//"/gui/icons.png"));
|
// glBindTexture(GL_TEXTURE_2D, pMinecraft->textures->loadTexture(TN_GUI_ICONS) );//"/gui/icons.png"));
|
||||||
//
|
//
|
||||||
// }
|
// }
|
||||||
|
|
||||||
void Gui::renderPumpkin(int w, int h)
|
void Gui::renderPumpkin(int w, int h)
|
||||||
|
|
@ -1146,7 +1146,7 @@ void Gui::renderPumpkin(int w, int h)
|
||||||
glColor4f(1, 1, 1, 1);
|
glColor4f(1, 1, 1, 1);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Gui::renderVignette(float br, int w, int h)
|
void Gui::renderVignette(float br, int w, int h)
|
||||||
{
|
{
|
||||||
br = 1 - br;
|
br = 1 - br;
|
||||||
|
|
@ -1191,7 +1191,7 @@ void Gui::renderTp(float br, int w, int h)
|
||||||
MemSect(31);
|
MemSect(31);
|
||||||
minecraft->textures->bindTexture(&TextureAtlas::LOCATION_BLOCKS);
|
minecraft->textures->bindTexture(&TextureAtlas::LOCATION_BLOCKS);
|
||||||
MemSect(0);
|
MemSect(0);
|
||||||
|
|
||||||
Icon *slot = Tile::portalTile->getTexture(Facing::UP);
|
Icon *slot = Tile::portalTile->getTexture(Facing::UP);
|
||||||
float u0 = slot->getU0();
|
float u0 = slot->getU0();
|
||||||
float v0 = slot->getV0();
|
float v0 = slot->getV0();
|
||||||
|
|
@ -1243,15 +1243,14 @@ void Gui::tick()
|
||||||
tickCount++;
|
tickCount++;
|
||||||
|
|
||||||
for(int iPad=0;iPad<XUSER_MAX_COUNT;iPad++)
|
for(int iPad=0;iPad<XUSER_MAX_COUNT;iPad++)
|
||||||
{
|
{
|
||||||
// 4J Stu - Fix for #10929 - MP LAB: Network Disconnects: Host does not receive an error message stating the client left the game when viewing the Pause Menu.
|
// 4J Stu - Fix for #10929 - MP LAB: Network Disconnects: Host does not receive an error message stating the client left the game when viewing the Pause Menu.
|
||||||
// We don't show the guiMessages when a menu is up, so don't fade them out
|
// We don't show the guiMessages when a menu is up, so don't fade them out
|
||||||
if(!ui.GetMenuDisplayed(iPad))
|
if(!ui.GetMenuDisplayed(iPad))
|
||||||
{
|
{
|
||||||
AUTO_VAR(itEnd, guiMessages[iPad].end());
|
for (auto& it : guiMessages[iPad])
|
||||||
for (AUTO_VAR(it, guiMessages[iPad].begin()); it != itEnd; it++)
|
{
|
||||||
{
|
it.ticks++;
|
||||||
(*it).ticks++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1267,7 +1266,7 @@ void Gui::clearMessages(int iPad)
|
||||||
{
|
{
|
||||||
guiMessages[i].clear();
|
guiMessages[i].clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -1500,7 +1499,7 @@ void Gui::renderGraph(int dataLength, int dataPos, __int64 *dataA, float dataASc
|
||||||
t->vertex((float)(xScale*i + 0.5f), (float)( height - aVal + 0.5f), (float)( 0));
|
t->vertex((float)(xScale*i + 0.5f), (float)( height - aVal + 0.5f), (float)( 0));
|
||||||
t->vertex((float)(xScale*i + 0.5f), (float)( height + 0.5f), (float)( 0));
|
t->vertex((float)(xScale*i + 0.5f), (float)( height + 0.5f), (float)( 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
if( dataB != NULL )
|
if( dataB != NULL )
|
||||||
{
|
{
|
||||||
if (dataB[i]>dataBWarning)
|
if (dataB[i]>dataBWarning)
|
||||||
|
|
|
||||||
|
|
@ -37,10 +37,8 @@ void GuiParticles::render(float a)
|
||||||
#if 0
|
#if 0
|
||||||
mc->textures->bindTexture(L"/gui/particles.png");
|
mc->textures->bindTexture(L"/gui/particles.png");
|
||||||
|
|
||||||
AUTO_VAR(itEnd, particles.end());
|
for ( GuiParticle *gp : particles )
|
||||||
for (AUTO_VAR(it, particles.begin()); it != itEnd; it++)
|
|
||||||
{
|
{
|
||||||
GuiParticle *gp = *it; //particles[i];
|
|
||||||
int xx = (int) (gp->xo + (gp->x - gp->xo) * a - 4);
|
int xx = (int) (gp->xo + (gp->x - gp->xo) * a - 4);
|
||||||
int yy = (int) (gp->yo + (gp->y - gp->yo) * a - 4);
|
int yy = (int) (gp->yo + (gp->y - gp->yo) * a - 4);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -83,9 +83,9 @@ ResourceLocation *HorseRenderer::getOrCreateLayeredTextureLocation(shared_ptr<En
|
||||||
{
|
{
|
||||||
wstring textureName = horse->getLayeredTextureHashName();
|
wstring textureName = horse->getLayeredTextureHashName();
|
||||||
|
|
||||||
AUTO_VAR(it, LAYERED_LOCATION_CACHE.find(textureName));
|
auto it = LAYERED_LOCATION_CACHE.find(textureName);
|
||||||
|
|
||||||
ResourceLocation *location;
|
ResourceLocation *location;
|
||||||
if (it != LAYERED_LOCATION_CACHE.end())
|
if (it != LAYERED_LOCATION_CACHE.end())
|
||||||
{
|
{
|
||||||
location = it->second;
|
location = it->second;
|
||||||
|
|
@ -93,7 +93,7 @@ ResourceLocation *HorseRenderer::getOrCreateLayeredTextureLocation(shared_ptr<En
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LAYERED_LOCATION_CACHE[textureName] = new ResourceLocation(horse->getLayeredTextureLayers());
|
LAYERED_LOCATION_CACHE[textureName] = new ResourceLocation(horse->getLayeredTextureLayers());
|
||||||
|
|
||||||
it = LAYERED_LOCATION_CACHE.find(textureName);
|
it = LAYERED_LOCATION_CACHE.find(textureName);
|
||||||
location = it->second;
|
location = it->second;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ ResourceLocation *HumanoidMobRenderer::getArmorLocation(ArmorItem *armorItem, in
|
||||||
case 4:
|
case 4:
|
||||||
break;
|
break;
|
||||||
};
|
};
|
||||||
wstring path = wstring(L"armor/" + MATERIAL_NAMES[armorItem->modelIndex]).append(L"_").append(_toString<int>(layer == 2 ? 2 : 1)).append((overlay ? L"_b" :L"")).append(L".png");
|
wstring path = wstring(L"armor/" + MATERIAL_NAMES[armorItem->modelIndex]).append(L"_").append(std::to_wstring(layer == 2 ? 2 : 1)).append((overlay ? L"_b" :L"")).append(L".png");
|
||||||
|
|
||||||
std::map<wstring, ResourceLocation>::iterator it = ARMOR_LOCATION_CACHE.find(path);
|
std::map<wstring, ResourceLocation>::iterator it = ARMOR_LOCATION_CACHE.find(path);
|
||||||
|
|
||||||
|
|
@ -74,7 +74,7 @@ ResourceLocation *HumanoidMobRenderer::getArmorLocation(ArmorItem *armorItem, in
|
||||||
}
|
}
|
||||||
|
|
||||||
void HumanoidMobRenderer::prepareSecondPassArmor(shared_ptr<LivingEntity> mob, int layer, float a)
|
void HumanoidMobRenderer::prepareSecondPassArmor(shared_ptr<LivingEntity> mob, int layer, float a)
|
||||||
{
|
{
|
||||||
shared_ptr<ItemInstance> itemInstance = mob->getArmor(3 - layer);
|
shared_ptr<ItemInstance> itemInstance = mob->getArmor(3 - layer);
|
||||||
if (itemInstance != NULL) {
|
if (itemInstance != NULL) {
|
||||||
Item *item = itemInstance->getItem();
|
Item *item = itemInstance->getItem();
|
||||||
|
|
@ -193,7 +193,7 @@ void HumanoidMobRenderer::additionalRendering(shared_ptr<LivingEntity> mob, floa
|
||||||
// 4J-PB - need to disable rendering armour/skulls/pumpkins for some special skins (Daleks)
|
// 4J-PB - need to disable rendering armour/skulls/pumpkins for some special skins (Daleks)
|
||||||
|
|
||||||
if((mob->getAnimOverrideBitmask()&(1<<HumanoidModel::eAnim_DontRenderArmour))==0)
|
if((mob->getAnimOverrideBitmask()&(1<<HumanoidModel::eAnim_DontRenderArmour))==0)
|
||||||
{
|
{
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
humanoidModel->head->translateTo(1 / 16.0f);
|
humanoidModel->head->translateTo(1 / 16.0f);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -86,7 +86,7 @@ void ItemRenderer::render(shared_ptr<Entity> _itemEntity, double x, double y, do
|
||||||
{
|
{
|
||||||
glRotatef(spin, 0, 1, 0);
|
glRotatef(spin, 0, 1, 0);
|
||||||
|
|
||||||
if (m_bItemFrame)
|
if (m_bItemFrame)
|
||||||
{
|
{
|
||||||
glScalef(1.25f, 1.25f, 1.25f);
|
glScalef(1.25f, 1.25f, 1.25f);
|
||||||
glTranslatef(0, 0.05f, 0);
|
glTranslatef(0, 0.05f, 0);
|
||||||
|
|
@ -104,7 +104,7 @@ void ItemRenderer::render(shared_ptr<Entity> _itemEntity, double x, double y, do
|
||||||
for (int i = 0; i < count; i++)
|
for (int i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
if (i > 0)
|
if (i > 0)
|
||||||
{
|
{
|
||||||
float xo = (random->nextFloat() * 2 - 1) * 0.2f / s;
|
float xo = (random->nextFloat() * 2 - 1) * 0.2f / s;
|
||||||
float yo = (random->nextFloat() * 2 - 1) * 0.2f / s;
|
float yo = (random->nextFloat() * 2 - 1) * 0.2f / s;
|
||||||
|
|
@ -119,13 +119,13 @@ void ItemRenderer::render(shared_ptr<Entity> _itemEntity, double x, double y, do
|
||||||
}
|
}
|
||||||
else if (item->getIconType() == Icon::TYPE_ITEM && item->getItem()->hasMultipleSpriteLayers())
|
else if (item->getIconType() == Icon::TYPE_ITEM && item->getItem()->hasMultipleSpriteLayers())
|
||||||
{
|
{
|
||||||
if (m_bItemFrame)
|
if (m_bItemFrame)
|
||||||
{
|
{
|
||||||
glScalef(1 / 1.95f, 1 / 1.95f, 1 / 1.95f);
|
glScalef(1 / 1.95f, 1 / 1.95f, 1 / 1.95f);
|
||||||
glTranslatef(0, -0.05f, 0);
|
glTranslatef(0, -0.05f, 0);
|
||||||
glDisable(GL_LIGHTING);
|
glDisable(GL_LIGHTING);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
glScalef(1 / 2.0f, 1 / 2.0f, 1 / 2.0f);
|
glScalef(1 / 2.0f, 1 / 2.0f, 1 / 2.0f);
|
||||||
}
|
}
|
||||||
|
|
@ -155,17 +155,17 @@ void ItemRenderer::render(shared_ptr<Entity> _itemEntity, double x, double y, do
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (m_bItemFrame)
|
if (m_bItemFrame)
|
||||||
{
|
{
|
||||||
glScalef(1 / 1.95f, 1 / 1.95f, 1 / 1.95f);
|
glScalef(1 / 1.95f, 1 / 1.95f, 1 / 1.95f);
|
||||||
glTranslatef(0, -0.05f, 0);
|
glTranslatef(0, -0.05f, 0);
|
||||||
glDisable(GL_LIGHTING);
|
glDisable(GL_LIGHTING);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
glScalef(1 / 2.0f, 1 / 2.0f, 1 / 2.0f);
|
glScalef(1 / 2.0f, 1 / 2.0f, 1 / 2.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4J Stu - For rendering the static compass, we give it a non-zero aux value
|
// 4J Stu - For rendering the static compass, we give it a non-zero aux value
|
||||||
if(item->id == Item::compass_Id) item->setAuxValue(255);
|
if(item->id == Item::compass_Id) item->setAuxValue(255);
|
||||||
if(item->id == Item::compass_Id) item->setAuxValue(0);
|
if(item->id == Item::compass_Id) item->setAuxValue(0);
|
||||||
|
|
@ -212,7 +212,7 @@ void ItemRenderer::renderItemBillboard(shared_ptr<ItemEntity> entity, Icon *icon
|
||||||
|
|
||||||
if (entityRenderDispatcher->options->fancyGraphics)
|
if (entityRenderDispatcher->options->fancyGraphics)
|
||||||
{
|
{
|
||||||
// Consider forcing the mipmap LOD level to use, if this is to be rendered from a larger than standard source texture.
|
// Consider forcing the mipmap LOD level to use, if this is to be rendered from a larger than standard source texture.
|
||||||
int iconWidth = icon->getWidth();
|
int iconWidth = icon->getWidth();
|
||||||
int LOD = -1; // Default to not doing anything special with LOD forcing
|
int LOD = -1; // Default to not doing anything special with LOD forcing
|
||||||
if( iconWidth == 32 )
|
if( iconWidth == 32 )
|
||||||
|
|
@ -262,7 +262,7 @@ void ItemRenderer::renderItemBillboard(shared_ptr<ItemEntity> entity, Icon *icon
|
||||||
for (int i = 0; i < count; i++)
|
for (int i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
glTranslatef(0, 0, width + margin);
|
glTranslatef(0, 0, width + margin);
|
||||||
|
|
||||||
bool bIsTerrain = false;
|
bool bIsTerrain = false;
|
||||||
if (item->getIconType() == Icon::TYPE_TERRAIN && Tile::tiles[item->id] != NULL)
|
if (item->getIconType() == Icon::TYPE_TERRAIN && Tile::tiles[item->id] != NULL)
|
||||||
{
|
{
|
||||||
|
|
@ -270,7 +270,7 @@ void ItemRenderer::renderItemBillboard(shared_ptr<ItemEntity> entity, Icon *icon
|
||||||
bindTexture(&TextureAtlas::LOCATION_BLOCKS); // TODO: Do this sanely by Icon
|
bindTexture(&TextureAtlas::LOCATION_BLOCKS); // TODO: Do this sanely by Icon
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
bindTexture(&TextureAtlas::LOCATION_ITEMS); // TODO: Do this sanely by Icon
|
bindTexture(&TextureAtlas::LOCATION_ITEMS); // TODO: Do this sanely by Icon
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -395,7 +395,7 @@ void ItemRenderer::renderGuiItem(Font *font, Textures *textures, shared_ptr<Item
|
||||||
PIXBeginNamedEvent(0,"Potion gui item render %d\n",itemIcon);
|
PIXBeginNamedEvent(0,"Potion gui item render %d\n",itemIcon);
|
||||||
// special double-layered
|
// special double-layered
|
||||||
glDisable(GL_LIGHTING);
|
glDisable(GL_LIGHTING);
|
||||||
|
|
||||||
ResourceLocation *location = getTextureLocation(item->getIconType());
|
ResourceLocation *location = getTextureLocation(item->getIconType());
|
||||||
textures->bindTexture(location);
|
textures->bindTexture(location);
|
||||||
|
|
||||||
|
|
@ -487,7 +487,7 @@ void ItemRenderer::renderAndDecorateItem(Font *font, Textures *textures, const s
|
||||||
|
|
||||||
// 4J - added isConstantBlended and blendFactor parameters. This is true if the gui item is being rendered from a context where it already has blending enabled to do general interface fading
|
// 4J - added isConstantBlended and blendFactor parameters. This is true if the gui item is being rendered from a context where it already has blending enabled to do general interface fading
|
||||||
// (ie from the gui rather than xui). In this case we dno't want to enable/disable blending, and do need to restore the blend state when we are done.
|
// (ie from the gui rather than xui). In this case we dno't want to enable/disable blending, and do need to restore the blend state when we are done.
|
||||||
void ItemRenderer::renderAndDecorateItem(Font *font, Textures *textures, const shared_ptr<ItemInstance> item, float x, float y,float fScaleX, float fScaleY,float fAlpha, bool isFoil, bool isConstantBlended, bool useCompiled)
|
void ItemRenderer::renderAndDecorateItem(Font *font, Textures *textures, const shared_ptr<ItemInstance> item, float x, float y,float fScaleX, float fScaleY,float fAlpha, bool isFoil, bool isConstantBlended, bool useCompiled)
|
||||||
{
|
{
|
||||||
if (item == NULL)
|
if (item == NULL)
|
||||||
{
|
{
|
||||||
|
|
@ -495,7 +495,7 @@ void ItemRenderer::renderAndDecorateItem(Font *font, Textures *textures, const s
|
||||||
}
|
}
|
||||||
|
|
||||||
renderGuiItem(font, textures, item, x, y,fScaleX,fScaleY,fAlpha, useCompiled);
|
renderGuiItem(font, textures, item, x, y,fScaleX,fScaleY,fAlpha, useCompiled);
|
||||||
|
|
||||||
if (isFoil || item->isFoil())
|
if (isFoil || item->isFoil())
|
||||||
{
|
{
|
||||||
glDepthFunc(GL_GREATER);
|
glDepthFunc(GL_GREATER);
|
||||||
|
|
@ -504,7 +504,7 @@ void ItemRenderer::renderAndDecorateItem(Font *font, Textures *textures, const s
|
||||||
textures->bindTexture(&ItemInHandRenderer::ENCHANT_GLINT_LOCATION); // 4J was "%blur%/misc/glint.png"
|
textures->bindTexture(&ItemInHandRenderer::ENCHANT_GLINT_LOCATION); // 4J was "%blur%/misc/glint.png"
|
||||||
blitOffset -= 50;
|
blitOffset -= 50;
|
||||||
if( !isConstantBlended ) glEnable(GL_BLEND);
|
if( !isConstantBlended ) glEnable(GL_BLEND);
|
||||||
|
|
||||||
glBlendFunc(GL_DST_COLOR, GL_ONE); // 4J - changed blend equation from GL_DST_COLOR, GL_DST_COLOR so we can fade this out
|
glBlendFunc(GL_DST_COLOR, GL_ONE); // 4J - changed blend equation from GL_DST_COLOR, GL_DST_COLOR so we can fade this out
|
||||||
|
|
||||||
float blendFactor = isConstantBlended ? Gui::currentGuiBlendFactor : 1.0f;
|
float blendFactor = isConstantBlended ? Gui::currentGuiBlendFactor : 1.0f;
|
||||||
|
|
@ -597,7 +597,7 @@ void ItemRenderer::renderGuiItemDecorations(Font *font, Textures *textures, shar
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item->count > 1 || !countText.empty() || item->GetForceNumberDisplay())
|
if (item->count > 1 || !countText.empty() || item->GetForceNumberDisplay())
|
||||||
{
|
{
|
||||||
MemSect(31);
|
MemSect(31);
|
||||||
|
|
@ -607,11 +607,11 @@ void ItemRenderer::renderGuiItemDecorations(Font *font, Textures *textures, shar
|
||||||
int count = item->count;
|
int count = item->count;
|
||||||
if(count > 64)
|
if(count > 64)
|
||||||
{
|
{
|
||||||
amount = _toString<int>(64) + L"+";
|
amount = L"64+";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
amount = _toString<int>(item->count);
|
amount = std::to_wstring(item->count);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MemSect(0);
|
MemSect(0);
|
||||||
|
|
|
||||||
|
|
@ -464,7 +464,7 @@ void LevelRenderer::allChanged(int playerIndex)
|
||||||
zMaxChunk = zChunks;
|
zMaxChunk = zChunks;
|
||||||
|
|
||||||
// 4J removed - we now only fully clear this on exiting the game (setting level to NULL). Apart from that, the chunk rebuilding is responsible for maintaining this
|
// 4J removed - we now only fully clear this on exiting the game (setting level to NULL). Apart from that, the chunk rebuilding is responsible for maintaining this
|
||||||
// renderableTileEntities.clear();
|
// renderableTileEntities.clear();
|
||||||
|
|
||||||
for (int x = 0; x < xChunks; x++)
|
for (int x = 0; x < xChunks; x++)
|
||||||
{
|
{
|
||||||
|
|
@ -533,19 +533,14 @@ void LevelRenderer::renderEntities(Vec3 *cam, Culler *culler, float a)
|
||||||
vector<shared_ptr<Entity> > entities = level[playerIndex]->getAllEntities();
|
vector<shared_ptr<Entity> > entities = level[playerIndex]->getAllEntities();
|
||||||
totalEntities = (int)entities.size();
|
totalEntities = (int)entities.size();
|
||||||
|
|
||||||
AUTO_VAR(itEndGE, level[playerIndex]->globalEntities.end());
|
for (auto& entity : level[playerIndex]->globalEntities)
|
||||||
for (AUTO_VAR(it, level[playerIndex]->globalEntities.begin()); it != itEndGE; it++)
|
|
||||||
{
|
{
|
||||||
shared_ptr<Entity> entity = *it; //level->globalEntities[i];
|
|
||||||
renderedEntities++;
|
renderedEntities++;
|
||||||
if (entity->shouldRender(cam)) EntityRenderDispatcher::instance->render(entity, a);
|
if (entity->shouldRender(cam)) EntityRenderDispatcher::instance->render(entity, a);
|
||||||
}
|
}
|
||||||
|
|
||||||
AUTO_VAR(itEndEnts, entities.end());
|
for (auto& entity : entities)
|
||||||
for (AUTO_VAR(it, entities.begin()); it != itEndEnts; it++)
|
|
||||||
{
|
{
|
||||||
shared_ptr<Entity> entity = *it; //entities[i];
|
|
||||||
|
|
||||||
bool shouldRender = (entity->shouldRender(cam) && (entity->noCulling || culler->isVisible(entity->bb)));
|
bool shouldRender = (entity->shouldRender(cam) && (entity->noCulling || culler->isVisible(entity->bb)));
|
||||||
|
|
||||||
// Render the mob if the mob's leash holder is within the culler
|
// Render the mob if the mob's leash holder is within the culler
|
||||||
|
|
@ -580,25 +575,25 @@ void LevelRenderer::renderEntities(Vec3 *cam, Culler *culler, float a)
|
||||||
// 4J - have restructed this so that the tile entities are stored within a hashmap by chunk/dimension index. The index
|
// 4J - have restructed this so that the tile entities are stored within a hashmap by chunk/dimension index. The index
|
||||||
// is calculated in the same way as the global flags.
|
// is calculated in the same way as the global flags.
|
||||||
EnterCriticalSection(&m_csRenderableTileEntities);
|
EnterCriticalSection(&m_csRenderableTileEntities);
|
||||||
for (AUTO_VAR(it, renderableTileEntities.begin()); it != renderableTileEntities.end(); it++)
|
for (auto & it : renderableTileEntities)
|
||||||
{
|
{
|
||||||
int idx = it->first;
|
int idx = it.first;
|
||||||
// Don't render if it isn't in the same dimension as this player
|
// Don't render if it isn't in the same dimension as this player
|
||||||
if( !isGlobalIndexInSameDimension(idx, level[playerIndex]) ) continue;
|
if( !isGlobalIndexInSameDimension(idx, level[playerIndex]) ) continue;
|
||||||
|
|
||||||
for( AUTO_VAR(it2, it->second.begin()); it2 != it->second.end(); it2++)
|
for( auto& it2 : it.second)
|
||||||
{
|
{
|
||||||
TileEntityRenderDispatcher::instance->render(*it2, a);
|
TileEntityRenderDispatcher::instance->render(it2, a);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now consider if any of these renderable tile entities have been flagged for removal, and if so, remove
|
// Now consider if any of these renderable tile entities have been flagged for removal, and if so, remove
|
||||||
for (AUTO_VAR(it, renderableTileEntities.begin()); it != renderableTileEntities.end();)
|
for (auto it = renderableTileEntities.begin(); it != renderableTileEntities.end();)
|
||||||
{
|
{
|
||||||
int idx = it->first;
|
int idx = it->first;
|
||||||
|
|
||||||
for( AUTO_VAR(it2, it->second.begin()); it2 != it->second.end(); )
|
for (auto it2 = it->second.begin(); it2 != it->second.end();)
|
||||||
{
|
{
|
||||||
// If it has been flagged for removal, remove
|
// If it has been flagged for removal, remove
|
||||||
if((*it2)->shouldRemoveForRender())
|
if((*it2)->shouldRemoveForRender())
|
||||||
{
|
{
|
||||||
|
|
@ -628,12 +623,12 @@ void LevelRenderer::renderEntities(Vec3 *cam, Culler *culler, float a)
|
||||||
|
|
||||||
wstring LevelRenderer::gatherStats1()
|
wstring LevelRenderer::gatherStats1()
|
||||||
{
|
{
|
||||||
return L"C: " + _toString<int>(renderedChunks) + L"/" + _toString<int>(totalChunks) + L". F: " + _toString<int>(offscreenChunks) + L", O: " + _toString<int>(occludedChunks) + L", E: " + _toString<int>(emptyChunks);
|
return L"C: " + std::to_wstring(renderedChunks) + L"/" + std::to_wstring(totalChunks) + L". F: " + std::to_wstring(offscreenChunks) + L", O: " + std::to_wstring(occludedChunks) + L", E: " + std::to_wstring(emptyChunks);
|
||||||
}
|
}
|
||||||
|
|
||||||
wstring LevelRenderer::gatherStats2()
|
wstring LevelRenderer::gatherStats2()
|
||||||
{
|
{
|
||||||
return L"E: " + _toString<int>(renderedEntities) + L"/" + _toString<int>(totalEntities) + L". B: " + _toString<int>(culledEntities) + L", I: " + _toString<int>((totalEntities - culledEntities) - renderedEntities);
|
return L"E: " + std::to_wstring(renderedEntities) + L"/" + std::to_wstring(totalEntities) + L". B: " + std::to_wstring(culledEntities) + L", I: " + std::to_wstring((totalEntities - culledEntities) - renderedEntities);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LevelRenderer::resortChunks(int xc, int yc, int zc)
|
void LevelRenderer::resortChunks(int xc, int yc, int zc)
|
||||||
|
|
@ -888,11 +883,8 @@ int LevelRenderer::renderChunks(int from, int to, int layer, double alpha)
|
||||||
renderLists[l].clear();
|
renderLists[l].clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
AUTO_VAR(itEnd, _renderChunks.end());
|
for ( Chunk *chunk : _renderChunks )
|
||||||
for (AUTO_VAR(it, _renderChunks.begin()); it != itEnd; it++)
|
|
||||||
{
|
{
|
||||||
Chunk *chunk = *it; //_renderChunks[i];
|
|
||||||
|
|
||||||
int list = -1;
|
int list = -1;
|
||||||
for (int l = 0; l < lists; l++)
|
for (int l = 0; l < lists; l++)
|
||||||
{
|
{
|
||||||
|
|
@ -918,7 +910,7 @@ int LevelRenderer::renderChunks(int from, int to, int layer, double alpha)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LevelRenderer::renderSameAsLast(int layer, double alpha)
|
void LevelRenderer::renderSameAsLast(int layer, double alpha)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < RENDERLISTS_LENGTH; i++)
|
for (int i = 0; i < RENDERLISTS_LENGTH; i++)
|
||||||
{
|
{
|
||||||
|
|
@ -932,8 +924,8 @@ void LevelRenderer::tick()
|
||||||
|
|
||||||
if ((ticks % SharedConstants::TICKS_PER_SECOND) == 0)
|
if ((ticks % SharedConstants::TICKS_PER_SECOND) == 0)
|
||||||
{
|
{
|
||||||
AUTO_VAR(it , destroyingBlocks.begin());
|
auto it = destroyingBlocks.begin();
|
||||||
while (it != destroyingBlocks.end())
|
while (it != destroyingBlocks.end())
|
||||||
{
|
{
|
||||||
BlockDestructionProgress *block = it->second;
|
BlockDestructionProgress *block = it->second;
|
||||||
|
|
||||||
|
|
@ -1150,7 +1142,7 @@ void LevelRenderer::renderSky(float alpha)
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
|
|
||||||
// 4J - can't work out what this big black box is for. Taking it out until someone misses it... it causes a big black box to visible appear in 3rd person mode whilst under the ground.
|
// 4J - can't work out what this big black box is for. Taking it out until someone misses it... it causes a big black box to visible appear in 3rd person mode whilst under the ground.
|
||||||
#if 0
|
#if 0
|
||||||
float ss = 1;
|
float ss = 1;
|
||||||
float yo = -(float) (yy + 65);
|
float yo = -(float) (yy + 65);
|
||||||
float y0 = -ss;
|
float y0 = -ss;
|
||||||
|
|
@ -1223,7 +1215,7 @@ void LevelRenderer::renderHaloRing(float alpha)
|
||||||
|
|
||||||
// Rough lumninance calculation
|
// Rough lumninance calculation
|
||||||
float Y = (sr+sr+sb+sg+sg+sg)/6;
|
float Y = (sr+sr+sb+sg+sg+sg)/6;
|
||||||
float br = 0.6f + (Y*0.4f);
|
float br = 0.6f + (Y*0.4f);
|
||||||
//app.DebugPrintf("Luminance = %f, brightness = %f\n", Y, br);
|
//app.DebugPrintf("Luminance = %f, brightness = %f\n", Y, br);
|
||||||
glColor3f(br,br,br);
|
glColor3f(br,br,br);
|
||||||
|
|
||||||
|
|
@ -1392,7 +1384,7 @@ void LevelRenderer::createCloudMesh()
|
||||||
t->vertexUV(x0, y0, z0, u, v );
|
t->vertexUV(x0, y0, z0, u, v );
|
||||||
t->vertexUV(x1, y0, z0, u, v );
|
t->vertexUV(x1, y0, z0, u, v );
|
||||||
t->vertexUV(x1, y0, z1, u, v );
|
t->vertexUV(x1, y0, z1, u, v );
|
||||||
t->vertexUV(x0, y0, z1, u, v );
|
t->vertexUV(x0, y0, z1, u, v );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
t->end();
|
t->end();
|
||||||
|
|
@ -1492,7 +1484,7 @@ void LevelRenderer::createCloudMesh()
|
||||||
t->vertexUV(x0, y1, z0, u, v );
|
t->vertexUV(x0, y1, z0, u, v );
|
||||||
t->vertexUV(x1, y1, z0, u, v );
|
t->vertexUV(x1, y1, z0, u, v );
|
||||||
t->vertexUV(x1, y0, z0, u, v );
|
t->vertexUV(x1, y0, z0, u, v );
|
||||||
t->vertexUV(x0, y0, z0, u, v );
|
t->vertexUV(x0, y0, z0, u, v );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
t->end();
|
t->end();
|
||||||
|
|
@ -1514,10 +1506,10 @@ void LevelRenderer::createCloudMesh()
|
||||||
float z1 = z0 + 1.0f;
|
float z1 = z0 + 1.0f;
|
||||||
t->color(0.8f, 0.8f, 0.8f, 0.8f);
|
t->color(0.8f, 0.8f, 0.8f, 0.8f);
|
||||||
t->normal(1, 0, 0);
|
t->normal(1, 0, 0);
|
||||||
t->vertexUV(x0, y0, z1, u, v );
|
t->vertexUV(x0, y0, z1, u, v );
|
||||||
t->vertexUV(x1, y0, z1, u, v );
|
t->vertexUV(x1, y0, z1, u, v );
|
||||||
t->vertexUV(x1, y1, z1, u, v );
|
t->vertexUV(x1, y1, z1, u, v );
|
||||||
t->vertexUV(x0, y1, z1, u, v );
|
t->vertexUV(x0, y1, z1, u, v );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
t->end();
|
t->end();
|
||||||
|
|
@ -1796,7 +1788,7 @@ void LevelRenderer::renderAdvancedClouds(float alpha)
|
||||||
t->end();
|
t->end();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
glColor4f(1, 1, 1, 1.0f);
|
glColor4f(1, 1, 1, 1.0f);
|
||||||
|
|
@ -1933,14 +1925,14 @@ bool LevelRenderer::updateDirtyChunks()
|
||||||
{
|
{
|
||||||
// It's possible that the localplayers member can be set to NULL on the main thread when a player chooses to exit the game
|
// It's possible that the localplayers member can be set to NULL on the main thread when a player chooses to exit the game
|
||||||
// So take a reference to the player object now. As it is a shared_ptr it should live as long as we need it
|
// So take a reference to the player object now. As it is a shared_ptr it should live as long as we need it
|
||||||
shared_ptr<LocalPlayer> player = mc->localplayers[p];
|
shared_ptr<LocalPlayer> player = mc->localplayers[p];
|
||||||
if( player == NULL ) continue;
|
if( player == NULL ) continue;
|
||||||
if( chunks[p].data == NULL ) continue;
|
if( chunks[p].data == NULL ) continue;
|
||||||
if( level[p] == NULL ) continue;
|
if( level[p] == NULL ) continue;
|
||||||
if( chunks[p].length != xChunks * zChunks * CHUNK_Y_COUNT ) continue;
|
if( chunks[p].length != xChunks * zChunks * CHUNK_Y_COUNT ) continue;
|
||||||
int px = (int)player->x;
|
int px = (int)player->x;
|
||||||
int py = (int)player->y;
|
int py = (int)player->y;
|
||||||
int pz = (int)player->z;
|
int pz = (int)player->z;
|
||||||
|
|
||||||
// app.DebugPrintf("!! %d %d %d, %d %d %d {%d,%d} ",px,py,pz,stackChunkDirty,nonStackChunkDirty,onlyRebuild, xChunks, zChunks);
|
// app.DebugPrintf("!! %d %d %d, %d %d %d {%d,%d} ",px,py,pz,stackChunkDirty,nonStackChunkDirty,onlyRebuild, xChunks, zChunks);
|
||||||
|
|
||||||
|
|
@ -1955,7 +1947,7 @@ bool LevelRenderer::updateDirtyChunks()
|
||||||
ClipChunk *pClipChunk = &chunks[p][(z * yChunks + y) * xChunks + x];
|
ClipChunk *pClipChunk = &chunks[p][(z * yChunks + y) * xChunks + x];
|
||||||
// Get distance to this chunk - deliberately not calling the chunk's method of doing this to avoid overheads (passing entitie, type conversion etc.) that this involves
|
// Get distance to this chunk - deliberately not calling the chunk's method of doing this to avoid overheads (passing entitie, type conversion etc.) that this involves
|
||||||
int xd = pClipChunk->xm - px;
|
int xd = pClipChunk->xm - px;
|
||||||
int yd = pClipChunk->ym - py;
|
int yd = pClipChunk->ym - py;
|
||||||
int zd = pClipChunk->zm - pz;
|
int zd = pClipChunk->zm - pz;
|
||||||
int distSq = xd * xd + yd * yd + zd * zd;
|
int distSq = xd * xd + yd * yd + zd * zd;
|
||||||
int distSqWeighted = xd * xd + yd * yd * 4 + zd * zd; // Weighting against y to prioritise things in same x/z plane as player first
|
int distSqWeighted = xd * xd + yd * yd * 4 + zd * zd; // Weighting against y to prioritise things in same x/z plane as player first
|
||||||
|
|
@ -1970,8 +1962,8 @@ bool LevelRenderer::updateDirtyChunks()
|
||||||
// Is this chunk nearer than our nearest?
|
// Is this chunk nearer than our nearest?
|
||||||
#ifdef _LARGE_WORLDS
|
#ifdef _LARGE_WORLDS
|
||||||
bool isNearer = nearestClipChunks.empty();
|
bool isNearer = nearestClipChunks.empty();
|
||||||
AUTO_VAR(itNearest, nearestClipChunks.begin());
|
auto itNearest = nearestClipChunks.begin();
|
||||||
for(; itNearest != nearestClipChunks.end(); ++itNearest)
|
for(; itNearest != nearestClipChunks.end(); ++itNearest)
|
||||||
{
|
{
|
||||||
isNearer = distSqWeighted < itNearest->second;
|
isNearer = distSqWeighted < itNearest->second;
|
||||||
if(isNearer) break;
|
if(isNearer) break;
|
||||||
|
|
@ -1997,12 +1989,12 @@ bool LevelRenderer::updateDirtyChunks()
|
||||||
// emptiness without actually testing as many data items as uncompressed data would.
|
// emptiness without actually testing as many data items as uncompressed data would.
|
||||||
Chunk *chunk = pClipChunk->chunk;
|
Chunk *chunk = pClipChunk->chunk;
|
||||||
LevelChunk *lc = level[p]->getChunkAt(chunk->x,chunk->z);
|
LevelChunk *lc = level[p]->getChunkAt(chunk->x,chunk->z);
|
||||||
if( !lc->isRenderChunkEmpty(y * 16) )
|
if( !lc->isRenderChunkEmpty(y * 16) )
|
||||||
{
|
{
|
||||||
nearChunk = pClipChunk;
|
nearChunk = pClipChunk;
|
||||||
minDistSq = distSqWeighted;
|
minDistSq = distSqWeighted;
|
||||||
#ifdef _LARGE_WORLDS
|
#ifdef _LARGE_WORLDS
|
||||||
nearestClipChunks.insert(itNearest, std::pair<ClipChunk *, int>(nearChunk, minDistSq) );
|
nearestClipChunks.insert(itNearest, std::make_pair(nearChunk, minDistSq) );
|
||||||
if(nearestClipChunks.size() > maxNearestChunks)
|
if(nearestClipChunks.size() > maxNearestChunks)
|
||||||
{
|
{
|
||||||
nearestClipChunks.pop_back();
|
nearestClipChunks.pop_back();
|
||||||
|
|
@ -2044,9 +2036,9 @@ bool LevelRenderer::updateDirtyChunks()
|
||||||
if(!nearestClipChunks.empty())
|
if(!nearestClipChunks.empty())
|
||||||
{
|
{
|
||||||
int index = 0;
|
int index = 0;
|
||||||
for(AUTO_VAR(it, nearestClipChunks.begin()); it != nearestClipChunks.end(); ++it)
|
for(auto & it : nearestClipChunks)
|
||||||
{
|
{
|
||||||
chunk = it->first->chunk;
|
chunk = it.first->chunk;
|
||||||
// If this chunk is very near, then move the renderer into a deferred mode. This won't commit any command buffers
|
// If this chunk is very near, then move the renderer into a deferred mode. This won't commit any command buffers
|
||||||
// for rendering until we call CBuffDeferredModeEnd(), allowing us to group any near changes into an atomic unit. This
|
// for rendering until we call CBuffDeferredModeEnd(), allowing us to group any near changes into an atomic unit. This
|
||||||
// is essential so we don't temporarily create any holes in the environment whilst updating one chunk and not the neighbours.
|
// is essential so we don't temporarily create any holes in the environment whilst updating one chunk and not the neighbours.
|
||||||
|
|
@ -2081,7 +2073,7 @@ bool LevelRenderer::updateDirtyChunks()
|
||||||
if((veryNearCount > 0))
|
if((veryNearCount > 0))
|
||||||
bAtomic = true; //MGH - if veryNearCount, then we're trying to rebuild atomically, so do it all on the main thread
|
bAtomic = true; //MGH - if veryNearCount, then we're trying to rebuild atomically, so do it all on the main thread
|
||||||
|
|
||||||
if( bAtomic || (index == 0) )
|
if( bAtomic || (index == 0) )
|
||||||
{
|
{
|
||||||
//PIXBeginNamedEvent(0,"Rebuilding near chunk %d %d %d",chunk->x, chunk->y, chunk->z);
|
//PIXBeginNamedEvent(0,"Rebuilding near chunk %d %d %d",chunk->x, chunk->y, chunk->z);
|
||||||
// static __int64 totalTime = 0;
|
// static __int64 totalTime = 0;
|
||||||
|
|
@ -2090,9 +2082,9 @@ bool LevelRenderer::updateDirtyChunks()
|
||||||
|
|
||||||
//app.DebugPrintf("Rebuilding permaChunk %d\n", index);
|
//app.DebugPrintf("Rebuilding permaChunk %d\n", index);
|
||||||
|
|
||||||
permaChunk[index].rebuild();
|
permaChunk[index].rebuild();
|
||||||
|
|
||||||
if(index !=0)
|
if(index !=0)
|
||||||
s_rebuildCompleteEvents->Set(index-1); // MGH - this rebuild happening on the main thread instead, mark the thread it should have been running on as complete
|
s_rebuildCompleteEvents->Set(index-1); // MGH - this rebuild happening on the main thread instead, mark the thread it should have been running on as complete
|
||||||
|
|
||||||
// __int64 endTime = System::currentTimeMillis();
|
// __int64 endTime = System::currentTimeMillis();
|
||||||
|
|
@ -2233,8 +2225,8 @@ void LevelRenderer::renderDestroyAnimation(Tesselator *t, shared_ptr<Player> pla
|
||||||
#endif
|
#endif
|
||||||
t->noColor();
|
t->noColor();
|
||||||
|
|
||||||
AUTO_VAR(it, destroyingBlocks.begin());
|
auto it = destroyingBlocks.begin();
|
||||||
while (it != destroyingBlocks.end())
|
while (it != destroyingBlocks.end())
|
||||||
{
|
{
|
||||||
BlockDestructionProgress *block = it->second;
|
BlockDestructionProgress *block = it->second;
|
||||||
double xd = block->getX() - xo;
|
double xd = block->getX() - xo;
|
||||||
|
|
@ -2337,7 +2329,7 @@ void LevelRenderer::setDirty(int x0, int y0, int z0, int x1, int y1, int z1, Lev
|
||||||
{
|
{
|
||||||
// 4J - level is passed if this is coming from setTilesDirty, which could come from when connection is being ticked outside of normal level tick, and player won't
|
// 4J - level is passed if this is coming from setTilesDirty, which could come from when connection is being ticked outside of normal level tick, and player won't
|
||||||
// be set up
|
// be set up
|
||||||
if( level == NULL ) level = this->level[mc->player->GetXboxPad()];
|
if( level == NULL ) level = this->level[mc->player->GetXboxPad()];
|
||||||
// EnterCriticalSection(&m_csDirtyChunks);
|
// EnterCriticalSection(&m_csDirtyChunks);
|
||||||
int _x0 = Mth::intFloorDiv(x0, CHUNK_XZSIZE);
|
int _x0 = Mth::intFloorDiv(x0, CHUNK_XZSIZE);
|
||||||
int _y0 = Mth::intFloorDiv(y0, CHUNK_SIZE);
|
int _y0 = Mth::intFloorDiv(y0, CHUNK_SIZE);
|
||||||
|
|
@ -2368,10 +2360,10 @@ void LevelRenderer::setDirty(int x0, int y0, int z0, int x1, int y1, int z1, Lev
|
||||||
|
|
||||||
// AP - by the time we reach this function the area passed in has a 1 block border added to it to make sure geometry and lighting is updated correctly.
|
// AP - by the time we reach this function the area passed in has a 1 block border added to it to make sure geometry and lighting is updated correctly.
|
||||||
// Some of those blocks will only need lighting updated so it is acceptable to not have those blocks grouped in the deferral system as the mismatch
|
// Some of those blocks will only need lighting updated so it is acceptable to not have those blocks grouped in the deferral system as the mismatch
|
||||||
// will hardly be noticable. The blocks that need geometry updated will be adjacent to the original, non-bordered area.
|
// will hardly be noticable. The blocks that need geometry updated will be adjacent to the original, non-bordered area.
|
||||||
// This bit of code will mark a chunk as 'non-critical' if all of the blocks inside it are NOT adjacent to the original area. This has the greatest effect
|
// This bit of code will mark a chunk as 'non-critical' if all of the blocks inside it are NOT adjacent to the original area. This has the greatest effect
|
||||||
// when digging a single block. Only 6 of the blocks out of the possible 26 are actually adjacent to the original block. The other 20 only need lighting updated.
|
// when digging a single block. Only 6 of the blocks out of the possible 26 are actually adjacent to the original block. The other 20 only need lighting updated.
|
||||||
// Note I have noticed a new side effect of this system where it's possible to see into the sides of water but this is acceptable compared to seeing through
|
// Note I have noticed a new side effect of this system where it's possible to see into the sides of water but this is acceptable compared to seeing through
|
||||||
// the entire landscape.
|
// the entire landscape.
|
||||||
// is the left or right most block just inside this chunk
|
// is the left or right most block just inside this chunk
|
||||||
if( ((x0 & 15) == 15 && x == _x0) || ((x1 & 15) == 0 && x == _x1) )
|
if( ((x0 & 15) == 15 && x == _x0) || ((x1 & 15) == 0 && x == _x1) )
|
||||||
|
|
@ -2398,7 +2390,7 @@ void LevelRenderer::setDirty(int x0, int y0, int z0, int x1, int y1, int z1, Lev
|
||||||
|
|
||||||
dirtyChunksLockFreeStack.Push((int *)(index));
|
dirtyChunksLockFreeStack.Push((int *)(index));
|
||||||
#else
|
#else
|
||||||
dirtyChunksLockFreeStack.Push((int *)(index + 2));
|
dirtyChunksLockFreeStack.Push((int *)(index + 2));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _XBOX
|
#ifdef _XBOX
|
||||||
|
|
@ -2511,7 +2503,7 @@ void LevelRenderer::cull_SPU(int playerIndex, Culler *culler, float a)
|
||||||
m_jobPort_CullSPU->submitSync();
|
m_jobPort_CullSPU->submitSync();
|
||||||
// static int doSort = false;
|
// static int doSort = false;
|
||||||
// if(doSort)
|
// if(doSort)
|
||||||
{
|
{
|
||||||
m_jobPort_CullSPU->submitJob(&sortJob);
|
m_jobPort_CullSPU->submitJob(&sortJob);
|
||||||
}
|
}
|
||||||
// doSort ^= 1;
|
// doSort ^= 1;
|
||||||
|
|
@ -2624,7 +2616,7 @@ void LevelRenderer::playSoundExceptPlayer(shared_ptr<Player> player, int iSound,
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4J-PB - original function. I've changed to an enum instead of string compares
|
// 4J-PB - original function. I've changed to an enum instead of string compares
|
||||||
// 4J removed -
|
// 4J removed -
|
||||||
/*
|
/*
|
||||||
void LevelRenderer::addParticle(const wstring& name, double x, double y, double z, double xa, double ya, double za)
|
void LevelRenderer::addParticle(const wstring& name, double x, double y, double z, double xa, double ya, double za)
|
||||||
{
|
{
|
||||||
|
|
@ -2788,7 +2780,7 @@ shared_ptr<Particle> LevelRenderer::addParticleInternal(ePARTICLE_TYPE eParticle
|
||||||
float fStart=((float)(cStart&0xFF));
|
float fStart=((float)(cStart&0xFF));
|
||||||
float fDiff=(float)((cEnd-cStart)&0xFF);
|
float fDiff=(float)((cEnd-cStart)&0xFF);
|
||||||
|
|
||||||
float fCol = (fStart + (Math::random() * fDiff))/255.0f;
|
float fCol = (fStart + (Math::random() * fDiff))/255.0f;
|
||||||
particle->setColor( fCol, fCol, fCol );
|
particle->setColor( fCol, fCol, fCol );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2933,11 +2925,11 @@ void LevelRenderer::entityAdded(shared_ptr<Entity> entity)
|
||||||
player->prepareCustomTextures();
|
player->prepareCustomTextures();
|
||||||
|
|
||||||
// 4J-PB - adding these from global title storage
|
// 4J-PB - adding these from global title storage
|
||||||
if (player->customTextureUrl != L"")
|
if (player->customTextureUrl != L"")
|
||||||
{
|
{
|
||||||
textures->addMemTexture(player->customTextureUrl, new MobSkinMemTextureProcessor());
|
textures->addMemTexture(player->customTextureUrl, new MobSkinMemTextureProcessor());
|
||||||
}
|
}
|
||||||
if (player->customTextureUrl2 != L"")
|
if (player->customTextureUrl2 != L"")
|
||||||
{
|
{
|
||||||
textures->addMemTexture(player->customTextureUrl2, new MobSkinMemTextureProcessor());
|
textures->addMemTexture(player->customTextureUrl2, new MobSkinMemTextureProcessor());
|
||||||
}
|
}
|
||||||
|
|
@ -2949,11 +2941,11 @@ void LevelRenderer::entityRemoved(shared_ptr<Entity> entity)
|
||||||
if(entity->instanceof(eTYPE_PLAYER))
|
if(entity->instanceof(eTYPE_PLAYER))
|
||||||
{
|
{
|
||||||
shared_ptr<Player> player = dynamic_pointer_cast<Player>(entity);
|
shared_ptr<Player> player = dynamic_pointer_cast<Player>(entity);
|
||||||
if (player->customTextureUrl != L"")
|
if (player->customTextureUrl != L"")
|
||||||
{
|
{
|
||||||
textures->removeMemTexture(player->customTextureUrl);
|
textures->removeMemTexture(player->customTextureUrl);
|
||||||
}
|
}
|
||||||
if (player->customTextureUrl2 != L"")
|
if (player->customTextureUrl2 != L"")
|
||||||
{
|
{
|
||||||
textures->removeMemTexture(player->customTextureUrl2);
|
textures->removeMemTexture(player->customTextureUrl2);
|
||||||
}
|
}
|
||||||
|
|
@ -3032,7 +3024,7 @@ void LevelRenderer::levelEvent(shared_ptr<Player> source, int type, int x, int y
|
||||||
{
|
{
|
||||||
//case LevelEvent::SOUND_WITHER_BOSS_SPAWN:
|
//case LevelEvent::SOUND_WITHER_BOSS_SPAWN:
|
||||||
case LevelEvent::SOUND_DRAGON_DEATH:
|
case LevelEvent::SOUND_DRAGON_DEATH:
|
||||||
if (mc->cameraTargetPlayer != NULL)
|
if (mc->cameraTargetPlayer != NULL)
|
||||||
{
|
{
|
||||||
// play the sound at an offset from the player
|
// play the sound at an offset from the player
|
||||||
double dx = x - mc->cameraTargetPlayer->x;
|
double dx = x - mc->cameraTargetPlayer->x;
|
||||||
|
|
@ -3044,7 +3036,7 @@ void LevelRenderer::levelEvent(shared_ptr<Player> source, int type, int x, int y
|
||||||
double sy = mc->cameraTargetPlayer->y;
|
double sy = mc->cameraTargetPlayer->y;
|
||||||
double sz = mc->cameraTargetPlayer->z;
|
double sz = mc->cameraTargetPlayer->z;
|
||||||
|
|
||||||
if (len > 0)
|
if (len > 0)
|
||||||
{
|
{
|
||||||
sx += (dx / len) * 2;
|
sx += (dx / len) * 2;
|
||||||
sy += (dy / len) * 2;
|
sy += (dy / len) * 2;
|
||||||
|
|
@ -3284,8 +3276,8 @@ void LevelRenderer::destroyTileProgress(int id, int x, int y, int z, int progres
|
||||||
{
|
{
|
||||||
if (progress < 0 || progress >= 10)
|
if (progress < 0 || progress >= 10)
|
||||||
{
|
{
|
||||||
AUTO_VAR(it, destroyingBlocks.find(id));
|
auto it = destroyingBlocks.find(id);
|
||||||
if(it != destroyingBlocks.end())
|
if(it != destroyingBlocks.end())
|
||||||
{
|
{
|
||||||
delete it->second;
|
delete it->second;
|
||||||
destroyingBlocks.erase(it);
|
destroyingBlocks.erase(it);
|
||||||
|
|
@ -3296,8 +3288,8 @@ void LevelRenderer::destroyTileProgress(int id, int x, int y, int z, int progres
|
||||||
{
|
{
|
||||||
BlockDestructionProgress *entry = NULL;
|
BlockDestructionProgress *entry = NULL;
|
||||||
|
|
||||||
AUTO_VAR(it, destroyingBlocks.find(id));
|
auto it = destroyingBlocks.find(id);
|
||||||
if(it != destroyingBlocks.end()) entry = it->second;
|
if(it != destroyingBlocks.end()) entry = it->second;
|
||||||
|
|
||||||
if (entry == NULL || entry->getX() != x || entry->getY() != y || entry->getZ() != z)
|
if (entry == NULL || entry->getX() != x || entry->getY() != y || entry->getZ() != z)
|
||||||
{
|
{
|
||||||
|
|
@ -3316,7 +3308,7 @@ void LevelRenderer::registerTextures(IconRegister *iconRegister)
|
||||||
|
|
||||||
for (int i = 0; i < 10; i++)
|
for (int i = 0; i < 10; i++)
|
||||||
{
|
{
|
||||||
breakingTextures[i] = iconRegister->registerIcon(L"destroy_" + _toString(i) );
|
breakingTextures[i] = iconRegister->registerIcon(L"destroy_" + std::to_wstring(i) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -3473,7 +3465,7 @@ unsigned char LevelRenderer::incGlobalChunkRefCount(int x, int y, int z, Level *
|
||||||
unsigned char refCount = (flags >> CHUNK_FLAG_REF_SHIFT ) & CHUNK_FLAG_REF_MASK;
|
unsigned char refCount = (flags >> CHUNK_FLAG_REF_SHIFT ) & CHUNK_FLAG_REF_MASK;
|
||||||
refCount++;
|
refCount++;
|
||||||
flags &= ~(CHUNK_FLAG_REF_MASK<<CHUNK_FLAG_REF_SHIFT);
|
flags &= ~(CHUNK_FLAG_REF_MASK<<CHUNK_FLAG_REF_SHIFT);
|
||||||
flags |= refCount << CHUNK_FLAG_REF_SHIFT;
|
flags |= refCount << CHUNK_FLAG_REF_SHIFT;
|
||||||
globalChunkFlags[ index ] = flags;
|
globalChunkFlags[ index ] = flags;
|
||||||
|
|
||||||
return refCount;
|
return refCount;
|
||||||
|
|
@ -3509,13 +3501,11 @@ unsigned char LevelRenderer::decGlobalChunkRefCount(int x, int y, int z, Level *
|
||||||
void LevelRenderer::fullyFlagRenderableTileEntitiesToBeRemoved()
|
void LevelRenderer::fullyFlagRenderableTileEntitiesToBeRemoved()
|
||||||
{
|
{
|
||||||
EnterCriticalSection(&m_csRenderableTileEntities);
|
EnterCriticalSection(&m_csRenderableTileEntities);
|
||||||
AUTO_VAR(itChunkEnd, renderableTileEntities.end());
|
for (auto& it : renderableTileEntities)
|
||||||
for (AUTO_VAR(it, renderableTileEntities.begin()); it != itChunkEnd; it++)
|
{
|
||||||
{
|
for(auto& it2 : it.second)
|
||||||
AUTO_VAR(itTEEnd, it->second.end());
|
|
||||||
for( AUTO_VAR(it2, it->second.begin()); it2 != itTEEnd; it2++ )
|
|
||||||
{
|
{
|
||||||
(*it2)->upgradeRenderRemoveStage();
|
it2->upgradeRenderRemoveStage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
LeaveCriticalSection(&m_csRenderableTileEntities);
|
LeaveCriticalSection(&m_csRenderableTileEntities);
|
||||||
|
|
@ -3529,9 +3519,9 @@ LevelRenderer::DestroyedTileManager::RecentTile::RecentTile(int x, int y, int z,
|
||||||
|
|
||||||
LevelRenderer::DestroyedTileManager::RecentTile::~RecentTile()
|
LevelRenderer::DestroyedTileManager::RecentTile::~RecentTile()
|
||||||
{
|
{
|
||||||
for( AUTO_VAR(it, boxes.begin()); it!= boxes.end(); it++ )
|
for(auto& it : boxes)
|
||||||
{
|
{
|
||||||
delete *it;
|
delete it;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -3645,7 +3635,7 @@ void LevelRenderer::DestroyedTileManager::addAABBs( Level *level, AABB *box, AAB
|
||||||
// without worrying about the lifespan of the copy we've passed out
|
// without worrying about the lifespan of the copy we've passed out
|
||||||
if( m_destroyedTiles[i]->boxes[j]->intersects( box ) )
|
if( m_destroyedTiles[i]->boxes[j]->intersects( box ) )
|
||||||
{
|
{
|
||||||
boxes->push_back(AABB::newTemp( m_destroyedTiles[i]->boxes[j]->x0,
|
boxes->push_back(AABB::newTemp( m_destroyedTiles[i]->boxes[j]->x0,
|
||||||
m_destroyedTiles[i]->boxes[j]->y0,
|
m_destroyedTiles[i]->boxes[j]->y0,
|
||||||
m_destroyedTiles[i]->boxes[j]->z0,
|
m_destroyedTiles[i]->boxes[j]->z0,
|
||||||
m_destroyedTiles[i]->boxes[j]->x1,
|
m_destroyedTiles[i]->boxes[j]->x1,
|
||||||
|
|
|
||||||
|
|
@ -23,8 +23,8 @@ int MemoryTracker::genTextures()
|
||||||
|
|
||||||
void MemoryTracker::releaseLists(int id)
|
void MemoryTracker::releaseLists(int id)
|
||||||
{
|
{
|
||||||
AUTO_VAR(it, GL_LIST_IDS.find(id));
|
auto it = GL_LIST_IDS.find(id);
|
||||||
if( it != GL_LIST_IDS.end() )
|
if( it != GL_LIST_IDS.end() )
|
||||||
{
|
{
|
||||||
glDeleteLists(id, it->second);
|
glDeleteLists(id, it->second);
|
||||||
GL_LIST_IDS.erase(it);
|
GL_LIST_IDS.erase(it);
|
||||||
|
|
@ -43,9 +43,9 @@ void MemoryTracker::releaseTextures()
|
||||||
void MemoryTracker::release()
|
void MemoryTracker::release()
|
||||||
{
|
{
|
||||||
//for (Map.Entry<Integer, Integer> entry : GL_LIST_IDS.entrySet())
|
//for (Map.Entry<Integer, Integer> entry : GL_LIST_IDS.entrySet())
|
||||||
for(AUTO_VAR(it, GL_LIST_IDS.begin()); it != GL_LIST_IDS.end(); ++it)
|
for(auto& it : GL_LIST_IDS)
|
||||||
{
|
{
|
||||||
glDeleteLists(it->first, it->second);
|
glDeleteLists(it.first, it.second);
|
||||||
}
|
}
|
||||||
GL_LIST_IDS.clear();
|
GL_LIST_IDS.clear();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -747,6 +747,9 @@
|
||||||
<LinkIncremental>true</LinkIncremental>
|
<LinkIncremental>true</LinkIncremental>
|
||||||
<ImageXexOutput>$(OutDir)$(ProjectName)_D.xex</ImageXexOutput>
|
<ImageXexOutput>$(OutDir)$(ProjectName)_D.xex</ImageXexOutput>
|
||||||
<IncludePath>$(ProjectDir)\..\Minecraft.World\x64headers;$(ProjectDir)\Xbox\Sentient\Include;$(IncludePath)</IncludePath>
|
<IncludePath>$(ProjectDir)\..\Minecraft.World\x64headers;$(ProjectDir)\Xbox\Sentient\Include;$(IncludePath)</IncludePath>
|
||||||
|
<RunCodeAnalysis>false</RunCodeAnalysis>
|
||||||
|
<EnableMicrosoftCodeAnalysis>false</EnableMicrosoftCodeAnalysis>
|
||||||
|
<EnableClangTidyCodeAnalysis>false</EnableClangTidyCodeAnalysis>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64EC'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64EC'">
|
||||||
<LinkIncremental>true</LinkIncremental>
|
<LinkIncremental>true</LinkIncremental>
|
||||||
|
|
@ -778,6 +781,9 @@
|
||||||
<LinkIncremental>false</LinkIncremental>
|
<LinkIncremental>false</LinkIncremental>
|
||||||
<ImageXexOutput>$(OutDir)$(ProjectName)_D.xex</ImageXexOutput>
|
<ImageXexOutput>$(OutDir)$(ProjectName)_D.xex</ImageXexOutput>
|
||||||
<IncludePath>$(ProjectDir)\..\Minecraft.World\x64headers;$(ProjectDir)\Xbox\Sentient\Include;$(IncludePath)</IncludePath>
|
<IncludePath>$(ProjectDir)\..\Minecraft.World\x64headers;$(ProjectDir)\Xbox\Sentient\Include;$(IncludePath)</IncludePath>
|
||||||
|
<RunCodeAnalysis>false</RunCodeAnalysis>
|
||||||
|
<EnableMicrosoftCodeAnalysis>false</EnableMicrosoftCodeAnalysis>
|
||||||
|
<EnableClangTidyCodeAnalysis>false</EnableClangTidyCodeAnalysis>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64EC'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64EC'">
|
||||||
<LinkIncremental>true</LinkIncremental>
|
<LinkIncremental>true</LinkIncremental>
|
||||||
|
|
@ -793,6 +799,9 @@
|
||||||
<LinkIncremental>true</LinkIncremental>
|
<LinkIncremental>true</LinkIncremental>
|
||||||
<ImageXexOutput>$(OutDir)$(ProjectName)_D.xex</ImageXexOutput>
|
<ImageXexOutput>$(OutDir)$(ProjectName)_D.xex</ImageXexOutput>
|
||||||
<IncludePath>$(ProjectDir)\..\Minecraft.World\x64headers;$(ProjectDir)\Xbox\Sentient\Include;$(IncludePath)</IncludePath>
|
<IncludePath>$(ProjectDir)\..\Minecraft.World\x64headers;$(ProjectDir)\Xbox\Sentient\Include;$(IncludePath)</IncludePath>
|
||||||
|
<RunCodeAnalysis>false</RunCodeAnalysis>
|
||||||
|
<EnableMicrosoftCodeAnalysis>false</EnableMicrosoftCodeAnalysis>
|
||||||
|
<EnableClangTidyCodeAnalysis>false</EnableClangTidyCodeAnalysis>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ContentPackage_Vita|ARM64EC'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ContentPackage_Vita|ARM64EC'">
|
||||||
<LinkIncremental>true</LinkIncremental>
|
<LinkIncremental>true</LinkIncremental>
|
||||||
|
|
@ -909,6 +918,9 @@
|
||||||
<OutputFile>$(OutDir)default$(TargetExt)</OutputFile>
|
<OutputFile>$(OutDir)default$(TargetExt)</OutputFile>
|
||||||
<ImageXexOutput>$(OutDir)default.xex</ImageXexOutput>
|
<ImageXexOutput>$(OutDir)default.xex</ImageXexOutput>
|
||||||
<IncludePath>$(ProjectDir)\Xbox\Sentient\Include;$(IncludePath)</IncludePath>
|
<IncludePath>$(ProjectDir)\Xbox\Sentient\Include;$(IncludePath)</IncludePath>
|
||||||
|
<RunCodeAnalysis>false</RunCodeAnalysis>
|
||||||
|
<EnableMicrosoftCodeAnalysis>false</EnableMicrosoftCodeAnalysis>
|
||||||
|
<EnableClangTidyCodeAnalysis>false</EnableClangTidyCodeAnalysis>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ContentPackage|ARM64EC'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ContentPackage|ARM64EC'">
|
||||||
<LinkIncremental>false</LinkIncremental>
|
<LinkIncremental>false</LinkIncremental>
|
||||||
|
|
@ -927,6 +939,9 @@
|
||||||
<OutputFile>$(OutDir)default$(TargetExt)</OutputFile>
|
<OutputFile>$(OutDir)default$(TargetExt)</OutputFile>
|
||||||
<ImageXexOutput>$(OutDir)default.xex</ImageXexOutput>
|
<ImageXexOutput>$(OutDir)default.xex</ImageXexOutput>
|
||||||
<IncludePath>$(ProjectDir)\Xbox\Sentient\Include;$(IncludePath)</IncludePath>
|
<IncludePath>$(ProjectDir)\Xbox\Sentient\Include;$(IncludePath)</IncludePath>
|
||||||
|
<RunCodeAnalysis>false</RunCodeAnalysis>
|
||||||
|
<EnableMicrosoftCodeAnalysis>false</EnableMicrosoftCodeAnalysis>
|
||||||
|
<EnableClangTidyCodeAnalysis>false</EnableClangTidyCodeAnalysis>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='CONTENTPACKAGE_SYMBOLS|ARM64EC'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='CONTENTPACKAGE_SYMBOLS|ARM64EC'">
|
||||||
<LinkIncremental>false</LinkIncremental>
|
<LinkIncremental>false</LinkIncremental>
|
||||||
|
|
@ -945,6 +960,9 @@
|
||||||
<OutputFile>$(OutDir)default$(TargetExt)</OutputFile>
|
<OutputFile>$(OutDir)default$(TargetExt)</OutputFile>
|
||||||
<ImageXexOutput>$(OutDir)default.xex</ImageXexOutput>
|
<ImageXexOutput>$(OutDir)default.xex</ImageXexOutput>
|
||||||
<IncludePath>$(ProjectDir)\Xbox\Sentient\Include;$(IncludePath)</IncludePath>
|
<IncludePath>$(ProjectDir)\Xbox\Sentient\Include;$(IncludePath)</IncludePath>
|
||||||
|
<RunCodeAnalysis>false</RunCodeAnalysis>
|
||||||
|
<EnableMicrosoftCodeAnalysis>false</EnableMicrosoftCodeAnalysis>
|
||||||
|
<EnableClangTidyCodeAnalysis>false</EnableClangTidyCodeAnalysis>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseForArt|ARM64EC'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseForArt|ARM64EC'">
|
||||||
<LinkIncremental>false</LinkIncremental>
|
<LinkIncremental>false</LinkIncremental>
|
||||||
|
|
@ -963,6 +981,9 @@
|
||||||
<OutputFile>$(OutDir)default$(TargetExt)</OutputFile>
|
<OutputFile>$(OutDir)default$(TargetExt)</OutputFile>
|
||||||
<ImageXexOutput>$(OutDir)default.xex</ImageXexOutput>
|
<ImageXexOutput>$(OutDir)default.xex</ImageXexOutput>
|
||||||
<IncludePath>$(ProjectDir)\Xbox\Sentient\Include;$(IncludePath)</IncludePath>
|
<IncludePath>$(ProjectDir)\Xbox\Sentient\Include;$(IncludePath)</IncludePath>
|
||||||
|
<RunCodeAnalysis>false</RunCodeAnalysis>
|
||||||
|
<EnableMicrosoftCodeAnalysis>false</EnableMicrosoftCodeAnalysis>
|
||||||
|
<EnableClangTidyCodeAnalysis>false</EnableClangTidyCodeAnalysis>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ContentPackage_NO_TU|ARM64EC'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ContentPackage_NO_TU|ARM64EC'">
|
||||||
<LinkIncremental>false</LinkIncremental>
|
<LinkIncremental>false</LinkIncremental>
|
||||||
|
|
@ -48678,4 +48699,4 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CU</Comman
|
||||||
<ImportGroup Label="ExtensionTargets">
|
<ImportGroup Label="ExtensionTargets">
|
||||||
<Import Project="$(VCTargetsPath)\BuildCustomizations\masm.targets" />
|
<Import Project="$(VCTargetsPath)\BuildCustomizations\masm.targets" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|
@ -79,7 +79,7 @@
|
||||||
//#define DEBUG_RENDER_SHOWS_PACKETS 1
|
//#define DEBUG_RENDER_SHOWS_PACKETS 1
|
||||||
//#define SPLITSCREEN_TEST
|
//#define SPLITSCREEN_TEST
|
||||||
|
|
||||||
// If not disabled, this creates an event queue on a seperate thread so that the Level::tick calls can be offloaded
|
// If not disabled, this creates an event queue on a seperate thread so that the Level::tick calls can be offloaded
|
||||||
// from the main thread, and have longer to run, since it's called at 20Hz instead of 60
|
// from the main thread, and have longer to run, since it's called at 20Hz instead of 60
|
||||||
#define DISABLE_LEVELTICK_THREAD
|
#define DISABLE_LEVELTICK_THREAD
|
||||||
|
|
||||||
|
|
@ -96,7 +96,7 @@ TOUCHSCREENRECT QuickSelectRect[3]=
|
||||||
{
|
{
|
||||||
{ 560, 890, 1360, 980 },
|
{ 560, 890, 1360, 980 },
|
||||||
{ 450, 840, 1449, 960 },
|
{ 450, 840, 1449, 960 },
|
||||||
{ 320, 840, 1600, 970 },
|
{ 320, 840, 1600, 970 },
|
||||||
};
|
};
|
||||||
|
|
||||||
int QuickSelectBoxWidth[3]=
|
int QuickSelectBoxWidth[3]=
|
||||||
|
|
@ -741,7 +741,7 @@ void Minecraft::run()
|
||||||
|
|
||||||
while (System::currentTimeMillis() >= lastTime + 1000)
|
while (System::currentTimeMillis() >= lastTime + 1000)
|
||||||
{
|
{
|
||||||
fpsString = _toString<int>(frames) + L" fps, " + _toString<int>(Chunk::updates) + L" chunk updates";
|
fpsString = std::to_wstring(frames) + L" fps, " + std::to_wstring(Chunk::updates) + L" chunk updates";
|
||||||
Chunk::updates = 0;
|
Chunk::updates = 0;
|
||||||
lastTime += 1000;
|
lastTime += 1000;
|
||||||
frames = 0;
|
frames = 0;
|
||||||
|
|
@ -1286,7 +1286,7 @@ void Minecraft::run_middle()
|
||||||
if( pDLCPack )
|
if( pDLCPack )
|
||||||
{
|
{
|
||||||
if(!pDLCPack->hasPurchasedFile( DLCManager::e_DLCType_Texture, L"" ))
|
if(!pDLCPack->hasPurchasedFile( DLCManager::e_DLCType_Texture, L"" ))
|
||||||
{
|
{
|
||||||
bTrialTexturepack=true;
|
bTrialTexturepack=true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1408,7 +1408,7 @@ void Minecraft::run_middle()
|
||||||
{
|
{
|
||||||
delete m_pPsPlusUpsell;
|
delete m_pPsPlusUpsell;
|
||||||
m_pPsPlusUpsell = NULL;
|
m_pPsPlusUpsell = NULL;
|
||||||
|
|
||||||
if ( ProfileManager.HasPlayStationPlus(i) )
|
if ( ProfileManager.HasPlayStationPlus(i) )
|
||||||
{
|
{
|
||||||
app.DebugPrintf("<Minecraft.cpp> Player_%i is now authorised for PsPlus.\n", i);
|
app.DebugPrintf("<Minecraft.cpp> Player_%i is now authorised for PsPlus.\n", i);
|
||||||
|
|
@ -2034,7 +2034,7 @@ void Minecraft::run_middle()
|
||||||
while (System::nanoTime() >= lastTime + 1000000000)
|
while (System::nanoTime() >= lastTime + 1000000000)
|
||||||
{
|
{
|
||||||
MemSect(31);
|
MemSect(31);
|
||||||
fpsString = _toString<int>(frames) + L" fps, " + _toString<int>(Chunk::updates) + L" chunk updates";
|
fpsString = std::to_wstring(frames) + L" fps, " + std::to_wstring(Chunk::updates) + L" chunk updates";
|
||||||
MemSect(0);
|
MemSect(0);
|
||||||
Chunk::updates = 0;
|
Chunk::updates = 0;
|
||||||
lastTime += 1000000000;
|
lastTime += 1000000000;
|
||||||
|
|
@ -2231,7 +2231,7 @@ void Minecraft::levelTickThreadInitFunc()
|
||||||
{
|
{
|
||||||
AABB::CreateNewThreadStorage();
|
AABB::CreateNewThreadStorage();
|
||||||
Vec3::CreateNewThreadStorage();
|
Vec3::CreateNewThreadStorage();
|
||||||
IntCache::CreateNewThreadStorage();
|
IntCache::CreateNewThreadStorage();
|
||||||
Compression::UseDefaultThreadStorage();
|
Compression::UseDefaultThreadStorage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2861,10 +2861,10 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
|
||||||
shared_ptr<ItemInstance> heldItem = nullptr;
|
shared_ptr<ItemInstance> heldItem = nullptr;
|
||||||
if (player->inventory->IsHeldItem())
|
if (player->inventory->IsHeldItem())
|
||||||
{
|
{
|
||||||
heldItem = player->inventory->getSelected();
|
heldItem = player->inventory->getSelected();
|
||||||
}
|
}
|
||||||
int heldItemId = heldItem != NULL ? heldItem->getItem()->id : -1;
|
int heldItemId = heldItem != NULL ? heldItem->getItem()->id : -1;
|
||||||
|
|
||||||
switch(entityType)
|
switch(entityType)
|
||||||
{
|
{
|
||||||
case eTYPE_CHICKEN:
|
case eTYPE_CHICKEN:
|
||||||
|
|
@ -2906,7 +2906,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
|
||||||
case eTYPE_COW:
|
case eTYPE_COW:
|
||||||
{
|
{
|
||||||
if(player->isAllowedToAttackAnimals()) *piAction=IDS_TOOLTIPS_HIT;
|
if(player->isAllowedToAttackAnimals()) *piAction=IDS_TOOLTIPS_HIT;
|
||||||
|
|
||||||
shared_ptr<Animal> animal = dynamic_pointer_cast<Animal>(hitResult->entity);
|
shared_ptr<Animal> animal = dynamic_pointer_cast<Animal>(hitResult->entity);
|
||||||
|
|
||||||
if (animal->isLeashed() && animal->getLeashHolder() == player)
|
if (animal->isLeashed() && animal->getLeashHolder() == player)
|
||||||
|
|
@ -2970,7 +2970,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
|
||||||
*piUse=IDS_TOOLTIPS_MILK;
|
*piUse=IDS_TOOLTIPS_MILK;
|
||||||
break;
|
break;
|
||||||
case Item::shears_Id:
|
case Item::shears_Id:
|
||||||
{
|
{
|
||||||
if(player->isAllowedToAttackAnimals()) *piAction=IDS_TOOLTIPS_HIT;
|
if(player->isAllowedToAttackAnimals()) *piAction=IDS_TOOLTIPS_HIT;
|
||||||
if(!animal->isBaby()) *piUse=IDS_TOOLTIPS_SHEAR;
|
if(!animal->isBaby()) *piUse=IDS_TOOLTIPS_SHEAR;
|
||||||
}
|
}
|
||||||
|
|
@ -2998,10 +2998,10 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
|
||||||
*piAction = IDS_TOOLTIPS_MINE;
|
*piAction = IDS_TOOLTIPS_MINE;
|
||||||
*piUse = IDS_TOOLTIPS_RIDE; // are we in the minecart already? - 4J-JEV: Doesn't matter anymore.
|
*piUse = IDS_TOOLTIPS_RIDE; // are we in the minecart already? - 4J-JEV: Doesn't matter anymore.
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case eTYPE_MINECART_FURNACE:
|
case eTYPE_MINECART_FURNACE:
|
||||||
*piAction = IDS_TOOLTIPS_MINE;
|
*piAction = IDS_TOOLTIPS_MINE;
|
||||||
|
|
||||||
// if you have coal, it'll go. Is there an object in hand?
|
// if you have coal, it'll go. Is there an object in hand?
|
||||||
if (heldItemId == Item::coal_Id) *piUse=IDS_TOOLTIPS_USE;
|
if (heldItemId == Item::coal_Id) *piUse=IDS_TOOLTIPS_USE;
|
||||||
break;
|
break;
|
||||||
|
|
@ -3082,7 +3082,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
|
||||||
if(player->isAllowedToAttackAnimals()) *piAction=IDS_TOOLTIPS_HIT;
|
if(player->isAllowedToAttackAnimals()) *piAction=IDS_TOOLTIPS_HIT;
|
||||||
|
|
||||||
shared_ptr<Pig> pig = dynamic_pointer_cast<Pig>(hitResult->entity);
|
shared_ptr<Pig> pig = dynamic_pointer_cast<Pig>(hitResult->entity);
|
||||||
|
|
||||||
if (pig->isLeashed() && pig->getLeashHolder() == player)
|
if (pig->isLeashed() && pig->getLeashHolder() == player)
|
||||||
{
|
{
|
||||||
*piUse=IDS_TOOLTIPS_UNLEASH;
|
*piUse=IDS_TOOLTIPS_UNLEASH;
|
||||||
|
|
@ -3225,7 +3225,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
|
||||||
shared_ptr<Ocelot> ocelot = dynamic_pointer_cast<Ocelot>(hitResult->entity);
|
shared_ptr<Ocelot> ocelot = dynamic_pointer_cast<Ocelot>(hitResult->entity);
|
||||||
|
|
||||||
if(player->isAllowedToAttackAnimals()) *piAction=IDS_TOOLTIPS_HIT;
|
if(player->isAllowedToAttackAnimals()) *piAction=IDS_TOOLTIPS_HIT;
|
||||||
|
|
||||||
if (ocelot->isLeashed() && ocelot->getLeashHolder() == player)
|
if (ocelot->isLeashed() && ocelot->getLeashHolder() == player)
|
||||||
{
|
{
|
||||||
*piUse = IDS_TOOLTIPS_UNLEASH;
|
*piUse = IDS_TOOLTIPS_UNLEASH;
|
||||||
|
|
@ -3254,7 +3254,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
*piUse=IDS_TOOLTIPS_FEED;
|
*piUse=IDS_TOOLTIPS_FEED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -3277,7 +3277,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case eTYPE_PLAYER:
|
case eTYPE_PLAYER:
|
||||||
{
|
{
|
||||||
// Fix for #58576 - TU6: Content: Gameplay: Hit button prompt is available when attacking a host who has "Invisible" option turned on
|
// Fix for #58576 - TU6: Content: Gameplay: Hit button prompt is available when attacking a host who has "Invisible" option turned on
|
||||||
|
|
@ -3343,9 +3343,9 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
|
||||||
case eTYPE_HORSE:
|
case eTYPE_HORSE:
|
||||||
{
|
{
|
||||||
shared_ptr<EntityHorse> horse = dynamic_pointer_cast<EntityHorse>(hitResult->entity);
|
shared_ptr<EntityHorse> horse = dynamic_pointer_cast<EntityHorse>(hitResult->entity);
|
||||||
|
|
||||||
bool heldItemIsFood = false, heldItemIsLove = false, heldItemIsArmour = false;
|
bool heldItemIsFood = false, heldItemIsLove = false, heldItemIsArmour = false;
|
||||||
|
|
||||||
switch( heldItemId )
|
switch( heldItemId )
|
||||||
{
|
{
|
||||||
case Item::wheat_Id:
|
case Item::wheat_Id:
|
||||||
|
|
@ -3400,7 +3400,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
|
||||||
*piUse = IDS_TOOLTIPS_FEED;
|
*piUse = IDS_TOOLTIPS_FEED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( player->isSneaking()
|
else if ( player->isSneaking()
|
||||||
|| (heldItemId == Item::saddle_Id)
|
|| (heldItemId == Item::saddle_Id)
|
||||||
|| (horse->canWearArmor() && heldItemIsArmour)
|
|| (horse->canWearArmor() && heldItemIsArmour)
|
||||||
)
|
)
|
||||||
|
|
@ -3409,7 +3409,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
|
||||||
if (*piUse == -1) *piUse = IDS_TOOLTIPS_OPEN;
|
if (*piUse == -1) *piUse = IDS_TOOLTIPS_OPEN;
|
||||||
}
|
}
|
||||||
else if ( horse->canWearBags()
|
else if ( horse->canWearBags()
|
||||||
&& !horse->isChestedHorse()
|
&& !horse->isChestedHorse()
|
||||||
&& (heldItemId == Tile::chest_Id) )
|
&& (heldItemId == Tile::chest_Id) )
|
||||||
{
|
{
|
||||||
// 4j - Attach saddle-bags (chest) to donkey or mule.
|
// 4j - Attach saddle-bags (chest) to donkey or mule.
|
||||||
|
|
@ -3431,7 +3431,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
|
||||||
// 4j - Ride tamed horse.
|
// 4j - Ride tamed horse.
|
||||||
*piUse = IDS_TOOLTIPS_MOUNT;
|
*piUse = IDS_TOOLTIPS_MOUNT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player->isAllowedToAttackAnimals()) *piAction=IDS_TOOLTIPS_HIT;
|
if (player->isAllowedToAttackAnimals()) *piAction=IDS_TOOLTIPS_HIT;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -3471,7 +3471,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*piAction=IDS_TOOLTIPS_HIT;
|
*piAction=IDS_TOOLTIPS_HIT;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -3666,7 +3666,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
|
||||||
player->abilities.debugflying = !player->abilities.debugflying;
|
player->abilities.debugflying = !player->abilities.debugflying;
|
||||||
player->abilities.flying = !player->abilities.flying;
|
player->abilities.flying = !player->abilities.flying;
|
||||||
}
|
}
|
||||||
#endif // PSVITA
|
#endif // PSVITA
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -3743,7 +3743,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
|
||||||
}
|
}
|
||||||
|
|
||||||
__uint64 ullButtonsPressed=player->ullButtonsPressed;
|
__uint64 ullButtonsPressed=player->ullButtonsPressed;
|
||||||
|
|
||||||
bool selected = false;
|
bool selected = false;
|
||||||
#ifdef __PSVITA__
|
#ifdef __PSVITA__
|
||||||
// 4J-PB - use the touchscreen for quickselect
|
// 4J-PB - use the touchscreen for quickselect
|
||||||
|
|
@ -3768,7 +3768,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
|
||||||
shared_ptr<ItemInstance> selectedItem = player->getSelectedItem();
|
shared_ptr<ItemInstance> selectedItem = player->getSelectedItem();
|
||||||
// Dropping items happens over network, so if we only have one then assume that we dropped it and should hide the item
|
// Dropping items happens over network, so if we only have one then assume that we dropped it and should hide the item
|
||||||
int iCount=0;
|
int iCount=0;
|
||||||
|
|
||||||
if(selectedItem != NULL) iCount=selectedItem->GetCount();
|
if(selectedItem != NULL) iCount=selectedItem->GetCount();
|
||||||
if(selectedItem != NULL && !( (player->ullButtonsPressed&(1LL<<MINECRAFT_ACTION_DROP)) && selectedItem->GetCount() == 1))
|
if(selectedItem != NULL && !( (player->ullButtonsPressed&(1LL<<MINECRAFT_ACTION_DROP)) && selectedItem->GetCount() == 1))
|
||||||
{
|
{
|
||||||
|
|
@ -4077,7 +4077,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
|
||||||
}
|
}
|
||||||
#ifdef __PS3__
|
#ifdef __PS3__
|
||||||
|
|
||||||
// while(!g_tickLevelQueue.empty())
|
// while(!g_tickLevelQueue.empty())
|
||||||
// {
|
// {
|
||||||
// Level* pLevel = g_tickLevelQueue.front();
|
// Level* pLevel = g_tickLevelQueue.front();
|
||||||
// g_tickLevelQueue.pop();
|
// g_tickLevelQueue.pop();
|
||||||
|
|
@ -4305,7 +4305,7 @@ void Minecraft::setLevel(MultiPlayerLevel *level, int message /*=-1*/, shared_pt
|
||||||
|
|
||||||
player->resetPos();
|
player->resetPos();
|
||||||
gameMode->initPlayer(player);
|
gameMode->initPlayer(player);
|
||||||
|
|
||||||
player->SetXboxPad(iPrimaryPlayer);
|
player->SetXboxPad(iPrimaryPlayer);
|
||||||
|
|
||||||
for(int i=0;i<XUSER_MAX_COUNT;i++)
|
for(int i=0;i<XUSER_MAX_COUNT;i++)
|
||||||
|
|
@ -4432,7 +4432,7 @@ void Minecraft::prepareLevel(int title)
|
||||||
wstring Minecraft::gatherStats1()
|
wstring Minecraft::gatherStats1()
|
||||||
{
|
{
|
||||||
//return levelRenderer->gatherStats1();
|
//return levelRenderer->gatherStats1();
|
||||||
return L"Time to autosave: " + _toString<unsigned int>( app.SecondsToAutosave() ) + L"s";
|
return L"Time to autosave: " + std::to_wstring( app.SecondsToAutosave() ) + L"s";
|
||||||
}
|
}
|
||||||
|
|
||||||
wstring Minecraft::gatherStats2()
|
wstring Minecraft::gatherStats2()
|
||||||
|
|
@ -4610,7 +4610,7 @@ void Minecraft::startAndConnectTo(const wstring& name, const wstring& sid, const
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
minecraft->user = new User(L"Player" + _toString<int>(System::currentTimeMillis() % 1000), L"");
|
minecraft->user = new User(L"Player" + std::to_wstring(System::currentTimeMillis() % 1000), L"");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//else
|
//else
|
||||||
|
|
@ -4691,7 +4691,7 @@ void Minecraft::main()
|
||||||
}
|
}
|
||||||
|
|
||||||
app.DebugPrintf("\n\n\n\n\n");
|
app.DebugPrintf("\n\n\n\n\n");
|
||||||
|
|
||||||
for(unsigned int i = 0; i < 256; ++i)
|
for(unsigned int i = 0; i < 256; ++i)
|
||||||
{
|
{
|
||||||
if(Tile::tiles[i] != NULL)
|
if(Tile::tiles[i] != NULL)
|
||||||
|
|
@ -4705,7 +4705,7 @@ void Minecraft::main()
|
||||||
// 4J-PB - Can't call this for the first 5 seconds of a game - MS rule
|
// 4J-PB - Can't call this for the first 5 seconds of a game - MS rule
|
||||||
//if (ProfileManager.IsFullVersion())
|
//if (ProfileManager.IsFullVersion())
|
||||||
{
|
{
|
||||||
name = L"Player" + _toString<__int64>(System::currentTimeMillis() % 1000);
|
name = L"Player" + std::to_wstring(System::currentTimeMillis() % 1000);
|
||||||
sessionId = L"-";
|
sessionId = L"-";
|
||||||
/* 4J - TODO - get a session ID from somewhere?
|
/* 4J - TODO - get a session ID from somewhere?
|
||||||
if (args.length > 0) name = args[0];
|
if (args.length > 0) name = args[0];
|
||||||
|
|
@ -5106,8 +5106,8 @@ void Minecraft::tickAllConnections()
|
||||||
|
|
||||||
bool Minecraft::addPendingClientTextureRequest(const wstring &textureName)
|
bool Minecraft::addPendingClientTextureRequest(const wstring &textureName)
|
||||||
{
|
{
|
||||||
AUTO_VAR(it, find( m_pendingTextureRequests.begin(), m_pendingTextureRequests.end(), textureName));
|
auto it = find(m_pendingTextureRequests.begin(), m_pendingTextureRequests.end(), textureName);
|
||||||
if( it == m_pendingTextureRequests.end() )
|
if( it == m_pendingTextureRequests.end() )
|
||||||
{
|
{
|
||||||
m_pendingTextureRequests.push_back(textureName);
|
m_pendingTextureRequests.push_back(textureName);
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -5117,8 +5117,8 @@ bool Minecraft::addPendingClientTextureRequest(const wstring &textureName)
|
||||||
|
|
||||||
void Minecraft::handleClientTextureReceived(const wstring &textureName)
|
void Minecraft::handleClientTextureReceived(const wstring &textureName)
|
||||||
{
|
{
|
||||||
AUTO_VAR(it, find( m_pendingTextureRequests.begin(), m_pendingTextureRequests.end(), textureName));
|
auto it = find(m_pendingTextureRequests.begin(), m_pendingTextureRequests.end(), textureName);
|
||||||
if( it != m_pendingTextureRequests.end() )
|
if( it != m_pendingTextureRequests.end() )
|
||||||
{
|
{
|
||||||
m_pendingTextureRequests.erase(it);
|
m_pendingTextureRequests.erase(it);
|
||||||
}
|
}
|
||||||
|
|
@ -5148,8 +5148,8 @@ int Minecraft::MustSignInReturnedPSN(void *pParam, int iPad, C4JStorage::EMessag
|
||||||
{
|
{
|
||||||
Minecraft* pMinecraft = (Minecraft *)pParam;
|
Minecraft* pMinecraft = (Minecraft *)pParam;
|
||||||
|
|
||||||
if(result == C4JStorage::EMessage_ResultAccept)
|
if(result == C4JStorage::EMessage_ResultAccept)
|
||||||
{
|
{
|
||||||
SQRNetworkManager_Orbis::AttemptPSNSignIn(&Minecraft::InGame_SignInReturned, pMinecraft, false, iPad);
|
SQRNetworkManager_Orbis::AttemptPSNSignIn(&Minecraft::InGame_SignInReturned, pMinecraft, false, iPad);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -211,7 +211,7 @@ static bool ExecuteConsoleCommand(MinecraftServer *server, const wstring &rawCom
|
||||||
{
|
{
|
||||||
wstring playerNames = (playerList != NULL) ? playerList->getPlayerNames() : L"";
|
wstring playerNames = (playerList != NULL) ? playerList->getPlayerNames() : L"";
|
||||||
if (playerNames.empty()) playerNames = L"(none)";
|
if (playerNames.empty()) playerNames = L"(none)";
|
||||||
server->info(L"Players (" + _toString((playerList != NULL) ? playerList->getPlayerCount() : 0) + L"): " + playerNames);
|
server->info(L"Players (" + std::to_wstring((playerList != NULL) ? playerList->getPlayerCount() : 0) + L"): " + playerNames);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -273,7 +273,7 @@ static bool ExecuteConsoleCommand(MinecraftServer *server, const wstring &rawCom
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
server->info(L"Added " + _toString(delta) + L" ticks.");
|
server->info(L"Added " + std::to_wstring(delta) + L" ticks.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -304,7 +304,7 @@ static bool ExecuteConsoleCommand(MinecraftServer *server, const wstring &rawCom
|
||||||
}
|
}
|
||||||
|
|
||||||
SetAllLevelTimes(server, targetTime);
|
SetAllLevelTimes(server, targetTime);
|
||||||
server->info(L"Time set to " + _toString(targetTime) + L".");
|
server->info(L"Time set to " + std::to_wstring(targetTime) + L".");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -427,7 +427,7 @@ static bool ExecuteConsoleCommand(MinecraftServer *server, const wstring &rawCom
|
||||||
}
|
}
|
||||||
if (itemId <= 0 || Item::items[itemId] == NULL)
|
if (itemId <= 0 || Item::items[itemId] == NULL)
|
||||||
{
|
{
|
||||||
server->warn(L"Unknown item id: " + _toString(itemId));
|
server->warn(L"Unknown item id: " + std::to_wstring(itemId));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (amount <= 0)
|
if (amount <= 0)
|
||||||
|
|
@ -442,7 +442,7 @@ static bool ExecuteConsoleCommand(MinecraftServer *server, const wstring &rawCom
|
||||||
{
|
{
|
||||||
drop->throwTime = 0;
|
drop->throwTime = 0;
|
||||||
}
|
}
|
||||||
server->info(L"Gave item " + _toString(itemId) + L" x" + _toString(amount) + L" to " + player->getName() + L".");
|
server->info(L"Gave item " + std::to_wstring(itemId) + L" x" + std::to_wstring(amount) + L" to " + player->getName() + L".");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -484,7 +484,7 @@ static bool ExecuteConsoleCommand(MinecraftServer *server, const wstring &rawCom
|
||||||
Enchantment *enchantment = Enchantment::enchantments[enchantmentId];
|
Enchantment *enchantment = Enchantment::enchantments[enchantmentId];
|
||||||
if (enchantment == NULL)
|
if (enchantment == NULL)
|
||||||
{
|
{
|
||||||
server->warn(L"Unknown enchantment id: " + _toString(enchantmentId));
|
server->warn(L"Unknown enchantment id: " + std::to_wstring(enchantmentId));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!enchantment->canEnchant(selectedItem))
|
if (!enchantment->canEnchant(selectedItem))
|
||||||
|
|
@ -514,7 +514,7 @@ static bool ExecuteConsoleCommand(MinecraftServer *server, const wstring &rawCom
|
||||||
}
|
}
|
||||||
|
|
||||||
selectedItem->enchant(enchantment, enchantmentLevel);
|
selectedItem->enchant(enchantment, enchantmentLevel);
|
||||||
server->info(L"Enchanted " + player->getName() + L"'s held item with " + _toString(enchantmentId) + L" " + _toString(enchantmentLevel) + L".");
|
server->info(L"Enchanted " + player->getName() + L"'s held item with " + std::to_wstring(enchantmentId) + L" " + std::to_wstring(enchantmentLevel) + L".");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -712,7 +712,7 @@ bool MinecraftServer::initServer(__int64 seed, NetworkGameInitData *initData, DW
|
||||||
}
|
}
|
||||||
|
|
||||||
LevelType *pLevelType = LevelType::getLevelType(levelTypeString);
|
LevelType *pLevelType = LevelType::getLevelType(levelTypeString);
|
||||||
if (pLevelType == NULL)
|
if (pLevelType == NULL)
|
||||||
{
|
{
|
||||||
pLevelType = LevelType::lvl_normal;
|
pLevelType = LevelType::lvl_normal;
|
||||||
}
|
}
|
||||||
|
|
@ -771,7 +771,7 @@ int MinecraftServer::runPostUpdate(void* lpParam)
|
||||||
Entity::useSmallIds(); // This thread can end up spawning entities as resources
|
Entity::useSmallIds(); // This thread can end up spawning entities as resources
|
||||||
IntCache::CreateNewThreadStorage();
|
IntCache::CreateNewThreadStorage();
|
||||||
AABB::CreateNewThreadStorage();
|
AABB::CreateNewThreadStorage();
|
||||||
Vec3::CreateNewThreadStorage();
|
Vec3::CreateNewThreadStorage();
|
||||||
Compression::UseDefaultThreadStorage();
|
Compression::UseDefaultThreadStorage();
|
||||||
Level::enableLightingCache();
|
Level::enableLightingCache();
|
||||||
Tile::CreateNewThreadStorage();
|
Tile::CreateNewThreadStorage();
|
||||||
|
|
@ -892,7 +892,7 @@ bool MinecraftServer::loadLevel(LevelStorageSource *storageSource, const wstring
|
||||||
{
|
{
|
||||||
// We are loading a file from disk with the data passed in
|
// We are loading a file from disk with the data passed in
|
||||||
|
|
||||||
#ifdef SPLIT_SAVES
|
#ifdef SPLIT_SAVES
|
||||||
ConsoleSaveFileOriginal oldFormatSave( initData->saveData->saveName, initData->saveData->data, initData->saveData->fileSize, false, initData->savePlatform );
|
ConsoleSaveFileOriginal oldFormatSave( initData->saveData->saveName, initData->saveData->data, initData->saveData->fileSize, false, initData->savePlatform );
|
||||||
ConsoleSaveFile* pSave = new ConsoleSaveFileSplit( &oldFormatSave );
|
ConsoleSaveFile* pSave = new ConsoleSaveFileSplit( &oldFormatSave );
|
||||||
|
|
||||||
|
|
@ -936,7 +936,7 @@ bool MinecraftServer::loadLevel(LevelStorageSource *storageSource, const wstring
|
||||||
}
|
}
|
||||||
|
|
||||||
// McRegionLevelStorage *storage = new McRegionLevelStorage(new ConsoleSaveFile( L"" ), L"", L"", 0); // original
|
// McRegionLevelStorage *storage = new McRegionLevelStorage(new ConsoleSaveFile( L"" ), L"", L"", 0); // original
|
||||||
// McRegionLevelStorage *storage = new McRegionLevelStorage(File(L"."), name, true); // TODO
|
// McRegionLevelStorage *storage = new McRegionLevelStorage(File(L"."), name, true); // TODO
|
||||||
for (unsigned int i = 0; i < levels.length; i++)
|
for (unsigned int i = 0; i < levels.length; i++)
|
||||||
{
|
{
|
||||||
if( s_bServerHalted || !g_NetworkManager.IsInSession() )
|
if( s_bServerHalted || !g_NetworkManager.IsInSession() )
|
||||||
|
|
@ -1022,7 +1022,7 @@ bool MinecraftServer::loadLevel(LevelStorageSource *storageSource, const wstring
|
||||||
#ifdef __PSVITA__
|
#ifdef __PSVITA__
|
||||||
int r = 48;
|
int r = 48;
|
||||||
#else
|
#else
|
||||||
int r = 196;
|
int r = 196;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// 4J JEV: load gameRules.
|
// 4J JEV: load gameRules.
|
||||||
|
|
@ -1173,7 +1173,7 @@ bool MinecraftServer::loadLevel(LevelStorageSource *storageSource, const wstring
|
||||||
|
|
||||||
if(!levels[0]->getLevelData()->getHasStronghold())
|
if(!levels[0]->getLevelData()->getHasStronghold())
|
||||||
{
|
{
|
||||||
int x,z;
|
int x,z;
|
||||||
if(app.GetTerrainFeaturePosition(eTerrainFeature_Stronghold,&x,&z))
|
if(app.GetTerrainFeaturePosition(eTerrainFeature_Stronghold,&x,&z))
|
||||||
{
|
{
|
||||||
levels[0]->getLevelData()->setXStronghold(x);
|
levels[0]->getLevelData()->setXStronghold(x);
|
||||||
|
|
@ -1401,7 +1401,7 @@ void MinecraftServer::Suspend()
|
||||||
// Save the start time
|
// Save the start time
|
||||||
QueryPerformanceCounter( &qwTime );
|
QueryPerformanceCounter( &qwTime );
|
||||||
if(m_bLoaded && ProfileManager.IsFullVersion() && (!StorageManager.GetSaveDisabled()))
|
if(m_bLoaded && ProfileManager.IsFullVersion() && (!StorageManager.GetSaveDisabled()))
|
||||||
{
|
{
|
||||||
if (players != NULL)
|
if (players != NULL)
|
||||||
{
|
{
|
||||||
players->saveAll(NULL);
|
players->saveAll(NULL);
|
||||||
|
|
@ -1476,7 +1476,7 @@ void MinecraftServer::stopServer(bool didInit)
|
||||||
#endif
|
#endif
|
||||||
// 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.
|
// 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.
|
||||||
if(m_saveOnExit && ProfileManager.IsFullVersion() && (!StorageManager.GetSaveDisabled()) && didInit)
|
if(m_saveOnExit && ProfileManager.IsFullVersion() && (!StorageManager.GetSaveDisabled()) && didInit)
|
||||||
{
|
{
|
||||||
if (players != NULL)
|
if (players != NULL)
|
||||||
{
|
{
|
||||||
players->saveAll(Minecraft::GetInstance()->progressRenderer, true);
|
players->saveAll(Minecraft::GetInstance()->progressRenderer, true);
|
||||||
|
|
@ -1715,7 +1715,7 @@ void MinecraftServer::run(__int64 seed, void *lpParameter)
|
||||||
|
|
||||||
if(pLevelData && pLevelData->getHasStronghold()==false)
|
if(pLevelData && pLevelData->getHasStronghold()==false)
|
||||||
{
|
{
|
||||||
int x,z;
|
int x,z;
|
||||||
if(app.GetTerrainFeaturePosition(eTerrainFeature_Stronghold,&x,&z))
|
if(app.GetTerrainFeaturePosition(eTerrainFeature_Stronghold,&x,&z))
|
||||||
{
|
{
|
||||||
pLevelData->setXStronghold(x);
|
pLevelData->setXStronghold(x);
|
||||||
|
|
@ -1815,7 +1815,7 @@ void MinecraftServer::run(__int64 seed, void *lpParameter)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Process delayed actions
|
// Process delayed actions
|
||||||
eXuiServerAction eAction;
|
eXuiServerAction eAction;
|
||||||
LPVOID param;
|
LPVOID param;
|
||||||
for(int i=0;i<XUSER_MAX_COUNT;i++)
|
for(int i=0;i<XUSER_MAX_COUNT;i++)
|
||||||
|
|
@ -1898,7 +1898,7 @@ void MinecraftServer::run(__int64 seed, void *lpParameter)
|
||||||
{
|
{
|
||||||
saveGameRules();
|
saveGameRules();
|
||||||
|
|
||||||
levels[0]->saveToDisc(Minecraft::GetInstance()->progressRenderer, (eAction==eXuiServerAction_AutoSaveGame));
|
levels[0]->saveToDisc(Minecraft::GetInstance()->progressRenderer, (eAction==eXuiServerAction_AutoSaveGame));
|
||||||
}
|
}
|
||||||
app.LeaveSaveNotificationSection();
|
app.LeaveSaveNotificationSection();
|
||||||
break;
|
break;
|
||||||
|
|
@ -1923,19 +1923,19 @@ void MinecraftServer::run(__int64 seed, void *lpParameter)
|
||||||
case eXuiServerAction_PauseServer:
|
case eXuiServerAction_PauseServer:
|
||||||
m_isServerPaused = ( (size_t) param == TRUE );
|
m_isServerPaused = ( (size_t) param == TRUE );
|
||||||
if( m_isServerPaused )
|
if( m_isServerPaused )
|
||||||
{
|
{
|
||||||
m_serverPausedEvent->Set();
|
m_serverPausedEvent->Set();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case eXuiServerAction_ToggleRain:
|
case eXuiServerAction_ToggleRain:
|
||||||
{
|
{
|
||||||
bool isRaining = levels[0]->getLevelData()->isRaining();
|
bool isRaining = levels[0]->getLevelData()->isRaining();
|
||||||
levels[0]->getLevelData()->setRaining(!isRaining);
|
levels[0]->getLevelData()->setRaining(!isRaining);
|
||||||
levels[0]->getLevelData()->setRainTime(levels[0]->random->nextInt(Level::TICKS_PER_DAY * 7) + Level::TICKS_PER_DAY / 2);
|
levels[0]->getLevelData()->setRainTime(levels[0]->random->nextInt(Level::TICKS_PER_DAY * 7) + Level::TICKS_PER_DAY / 2);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case eXuiServerAction_ToggleThunder:
|
case eXuiServerAction_ToggleThunder:
|
||||||
{
|
{
|
||||||
bool isThundering = levels[0]->getLevelData()->isThundering();
|
bool isThundering = levels[0]->getLevelData()->isThundering();
|
||||||
levels[0]->getLevelData()->setThundering(!isThundering);
|
levels[0]->getLevelData()->setThundering(!isThundering);
|
||||||
levels[0]->getLevelData()->setThunderTime(levels[0]->random->nextInt(Level::TICKS_PER_DAY * 7) + Level::TICKS_PER_DAY / 2);
|
levels[0]->getLevelData()->setThunderTime(levels[0]->random->nextInt(Level::TICKS_PER_DAY * 7) + Level::TICKS_PER_DAY / 2);
|
||||||
|
|
@ -1973,7 +1973,7 @@ void MinecraftServer::run(__int64 seed, void *lpParameter)
|
||||||
File dataFile = File( targetFileDir, wstring(filename) );
|
File dataFile = File( targetFileDir, wstring(filename) );
|
||||||
if(dataFile.exists()) dataFile._delete();
|
if(dataFile.exists()) dataFile._delete();
|
||||||
FileOutputStream fos = FileOutputStream(dataFile);
|
FileOutputStream fos = FileOutputStream(dataFile);
|
||||||
DataOutputStream dos = DataOutputStream(&fos);
|
DataOutputStream dos = DataOutputStream(&fos);
|
||||||
ConsoleSchematicFile::generateSchematicFile(&dos, levels[0], initData->startX, initData->startY, initData->startZ, initData->endX, initData->endY, initData->endZ, initData->bSaveMobs, initData->compressionType);
|
ConsoleSchematicFile::generateSchematicFile(&dos, levels[0], initData->startX, initData->startY, initData->startZ, initData->endX, initData->endY, initData->endZ, initData->bSaveMobs, initData->compressionType);
|
||||||
dos.close();
|
dos.close();
|
||||||
|
|
||||||
|
|
@ -1990,7 +1990,7 @@ void MinecraftServer::run(__int64 seed, void *lpParameter)
|
||||||
app.DebugPrintf( "DEBUG: Player=%i\n", pos->player );
|
app.DebugPrintf( "DEBUG: Player=%i\n", pos->player );
|
||||||
app.DebugPrintf( "DEBUG: Teleporting to pos=(%f.2, %f.2, %f.2), looking at=(%f.2,%f.2)\n",
|
app.DebugPrintf( "DEBUG: Teleporting to pos=(%f.2, %f.2, %f.2), looking at=(%f.2,%f.2)\n",
|
||||||
pos->m_camX, pos->m_camY, pos->m_camZ,
|
pos->m_camX, pos->m_camY, pos->m_camZ,
|
||||||
pos->m_yRot, pos->m_elev
|
pos->m_yRot, pos->m_elev
|
||||||
);
|
);
|
||||||
|
|
||||||
shared_ptr<ServerPlayer> player = players->players.at(pos->player);
|
shared_ptr<ServerPlayer> player = players->players.at(pos->player);
|
||||||
|
|
@ -2064,21 +2064,21 @@ void MinecraftServer::broadcastStopSavingPacket()
|
||||||
void MinecraftServer::tick()
|
void MinecraftServer::tick()
|
||||||
{
|
{
|
||||||
vector<wstring> toRemove;
|
vector<wstring> toRemove;
|
||||||
for (AUTO_VAR(it, ironTimers.begin()); it != ironTimers.end(); it++ )
|
for ( auto& it : ironTimers )
|
||||||
{
|
{
|
||||||
int t = it->second;
|
int t = it.second;
|
||||||
if (t > 0)
|
if (t > 0)
|
||||||
{
|
{
|
||||||
ironTimers[it->first] = t - 1;
|
ironTimers[it.first] = t - 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
toRemove.push_back(it->first);
|
toRemove.push_back(it.first);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (unsigned int i = 0; i < toRemove.size(); i++)
|
for (const auto& i : toRemove)
|
||||||
{
|
{
|
||||||
ironTimers.erase(toRemove[i]);
|
ironTimers.erase(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
AABB::resetPool();
|
AABB::resetPool();
|
||||||
|
|
@ -2316,8 +2316,8 @@ void MinecraftServer::chunkPacketManagement_PreTick()
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
int longestTime = 0;
|
int longestTime = 0;
|
||||||
AUTO_VAR(playerConnectionBest,playersOrig.begin());
|
auto playerConnectionBest = playersOrig.begin();
|
||||||
for( AUTO_VAR(it, playersOrig.begin()); it != playersOrig.end(); it++)
|
for( auto it = playersOrig.begin(); it != playersOrig.end(); it++)
|
||||||
{
|
{
|
||||||
int thisTime = 0;
|
int thisTime = 0;
|
||||||
INetworkPlayer *np = (*it)->getNetworkPlayer();
|
INetworkPlayer *np = (*it)->getNetworkPlayer();
|
||||||
|
|
@ -2326,7 +2326,7 @@ void MinecraftServer::chunkPacketManagement_PreTick()
|
||||||
thisTime = np->GetTimeSinceLastChunkPacket_ms();
|
thisTime = np->GetTimeSinceLastChunkPacket_ms();
|
||||||
}
|
}
|
||||||
|
|
||||||
if( thisTime > longestTime )
|
if( thisTime > longestTime )
|
||||||
{
|
{
|
||||||
playerConnectionBest = it;
|
playerConnectionBest = it;
|
||||||
longestTime = thisTime;
|
longestTime = thisTime;
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,7 @@ void Minimap::reloadColours()
|
||||||
LUT[i] = 255 << 24 | r << 16 | g << 8 | b;
|
LUT[i] = 255 << 24 | r << 16 | g << 8 | b;
|
||||||
#elif defined __ORBIS__
|
#elif defined __ORBIS__
|
||||||
r >>= 3; g >>= 3; b >>= 3;
|
r >>= 3; g >>= 3; b >>= 3;
|
||||||
LUT[i] = 1 << 15 | ( r << 10 ) | ( g << 5 ) | b;
|
LUT[i] = 1 << 15 | ( r << 10 ) | ( g << 5 ) | b;
|
||||||
#else
|
#else
|
||||||
LUT[i] = r << 24 | g << 16 | b << 8 | 255;
|
LUT[i] = r << 24 | g << 16 | b << 8 | 255;
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -144,18 +144,14 @@ void Minimap::render(shared_ptr<Player> player, Textures *textures, shared_ptr<M
|
||||||
|
|
||||||
textures->bind(textures->loadTexture(TN_MISC_MAPICONS));//L"/misc/mapicons.png"));
|
textures->bind(textures->loadTexture(TN_MISC_MAPICONS));//L"/misc/mapicons.png"));
|
||||||
|
|
||||||
AUTO_VAR(itEnd, data->decorations.end());
|
|
||||||
|
|
||||||
#ifdef _LARGE_WORLDS
|
#ifdef _LARGE_WORLDS
|
||||||
vector<MapItemSavedData::MapDecoration *> m_edgeIcons;
|
vector<MapItemSavedData::MapDecoration *> m_edgeIcons;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// 4J-PB - stack the map icons
|
// 4J-PB - stack the map icons
|
||||||
float fIconZ=-0.04f;// 4J - moved to -0.04 (was -0.02) to stop z fighting
|
float fIconZ=-0.04f;// 4J - moved to -0.04 (was -0.02) to stop z fighting
|
||||||
for( vector<MapItemSavedData::MapDecoration *>::iterator it = data->decorations.begin(); it != itEnd; it++ )
|
for( MapItemSavedData::MapDecoration *dec : data->decorations )
|
||||||
{
|
{
|
||||||
MapItemSavedData::MapDecoration *dec = *it;
|
|
||||||
|
|
||||||
if(!dec->visible) continue;
|
if(!dec->visible) continue;
|
||||||
|
|
||||||
char imgIndex = dec->img;
|
char imgIndex = dec->img;
|
||||||
|
|
@ -200,10 +196,8 @@ void Minimap::render(shared_ptr<Player> player, Textures *textures, shared_ptr<M
|
||||||
textures->bind(textures->loadTexture(TN_MISC_ADDITIONALMAPICONS));
|
textures->bind(textures->loadTexture(TN_MISC_ADDITIONALMAPICONS));
|
||||||
|
|
||||||
fIconZ=-0.04f;// 4J - moved to -0.04 (was -0.02) to stop z fighting
|
fIconZ=-0.04f;// 4J - moved to -0.04 (was -0.02) to stop z fighting
|
||||||
for( AUTO_VAR(it,m_edgeIcons.begin()); it != m_edgeIcons.end(); it++ )
|
for( MapItemSavedData::MapDecoration *dec : m_edgeIcons )
|
||||||
{
|
{
|
||||||
MapItemSavedData::MapDecoration *dec = *it;
|
|
||||||
|
|
||||||
char imgIndex = dec->img;
|
char imgIndex = dec->img;
|
||||||
imgIndex -= 16;
|
imgIndex -= 16;
|
||||||
|
|
||||||
|
|
@ -253,7 +247,7 @@ void Minimap::render(shared_ptr<Player> player, Textures *textures, shared_ptr<M
|
||||||
int posy = floor(player->y);
|
int posy = floor(player->y);
|
||||||
int posz = floor(player->z);
|
int posz = floor(player->z);
|
||||||
swprintf(playerPosText, 32, L"X: %d, Y: %d, Z: %d", posx, posy, posz);
|
swprintf(playerPosText, 32, L"X: %d, Y: %d, Z: %d", posx, posy, posz);
|
||||||
|
|
||||||
font->draw(playerPosText, x, y, Minecraft::GetInstance()->getColourTable()->getColour(eMinecraftColour_Map_Text));
|
font->draw(playerPosText, x, y, Minecraft::GetInstance()->getColourTable()->getColour(eMinecraftColour_Map_Text));
|
||||||
}
|
}
|
||||||
//#endif
|
//#endif
|
||||||
|
|
|
||||||
|
|
@ -24,23 +24,23 @@ ModelPart::ModelPart()
|
||||||
_init();
|
_init();
|
||||||
}
|
}
|
||||||
|
|
||||||
ModelPart::ModelPart(Model *model, const wstring& id)
|
ModelPart::ModelPart(Model *model, const wstring& id)
|
||||||
{
|
{
|
||||||
construct(model, id);
|
construct(model, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
ModelPart::ModelPart(Model *model)
|
ModelPart::ModelPart(Model *model)
|
||||||
{
|
{
|
||||||
construct(model);
|
construct(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
ModelPart::ModelPart(Model *model, int xTexOffs, int yTexOffs)
|
ModelPart::ModelPart(Model *model, int xTexOffs, int yTexOffs)
|
||||||
{
|
{
|
||||||
construct(model, xTexOffs, yTexOffs);
|
construct(model, xTexOffs, yTexOffs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ModelPart::construct(Model *model, const wstring& id)
|
void ModelPart::construct(Model *model, const wstring& id)
|
||||||
{
|
{
|
||||||
_init();
|
_init();
|
||||||
this->model = model;
|
this->model = model;
|
||||||
|
|
@ -49,13 +49,13 @@ void ModelPart::construct(Model *model, const wstring& id)
|
||||||
setTexSize(model->texWidth, model->texHeight);
|
setTexSize(model->texWidth, model->texHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModelPart::construct(Model *model)
|
void ModelPart::construct(Model *model)
|
||||||
{
|
{
|
||||||
_init();
|
_init();
|
||||||
construct(model, L"");
|
construct(model, L"");
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModelPart::construct(Model *model, int xTexOffs, int yTexOffs)
|
void ModelPart::construct(Model *model, int xTexOffs, int yTexOffs)
|
||||||
{
|
{
|
||||||
_init();
|
_init();
|
||||||
construct(model);
|
construct(model);
|
||||||
|
|
@ -63,22 +63,18 @@ void ModelPart::construct(Model *model, int xTexOffs, int yTexOffs)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ModelPart::addChild(ModelPart *child)
|
void ModelPart::addChild(ModelPart *child)
|
||||||
{
|
{
|
||||||
//if (children == NULL) children = new ModelPartArray;
|
//if (children == NULL) children = new ModelPartArray;
|
||||||
children.push_back(child);
|
children.push_back(child);
|
||||||
}
|
}
|
||||||
|
|
||||||
ModelPart * ModelPart::retrieveChild(SKIN_BOX *pBox)
|
ModelPart * ModelPart::retrieveChild(SKIN_BOX *pBox)
|
||||||
{
|
{
|
||||||
for(AUTO_VAR(it, children.begin()); it != children.end(); ++it)
|
for( ModelPart *child : children )
|
||||||
{
|
{
|
||||||
ModelPart *child=*it;
|
for ( const Cube *pCube : child->cubes )
|
||||||
|
{
|
||||||
for(AUTO_VAR(itcube, child->cubes.begin()); itcube != child->cubes.end(); ++itcube)
|
|
||||||
{
|
|
||||||
Cube *pCube=*itcube;
|
|
||||||
|
|
||||||
if((pCube->x0==pBox->fX) &&
|
if((pCube->x0==pBox->fX) &&
|
||||||
(pCube->y0==pBox->fY) &&
|
(pCube->y0==pBox->fY) &&
|
||||||
(pCube->z0==pBox->fZ) &&
|
(pCube->z0==pBox->fZ) &&
|
||||||
|
|
@ -96,20 +92,20 @@ ModelPart * ModelPart::retrieveChild(SKIN_BOX *pBox)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
ModelPart *ModelPart::mirror()
|
ModelPart *ModelPart::mirror()
|
||||||
{
|
{
|
||||||
bMirror = !bMirror;
|
bMirror = !bMirror;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
ModelPart *ModelPart::texOffs(int xTexOffs, int yTexOffs)
|
ModelPart *ModelPart::texOffs(int xTexOffs, int yTexOffs)
|
||||||
{
|
{
|
||||||
this->xTexOffs = xTexOffs;
|
this->xTexOffs = xTexOffs;
|
||||||
this->yTexOffs = yTexOffs;
|
this->yTexOffs = yTexOffs;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
ModelPart *ModelPart::addBox(wstring id, float x0, float y0, float z0, int w, int h, int d)
|
ModelPart *ModelPart::addBox(wstring id, float x0, float y0, float z0, int w, int h, int d)
|
||||||
{
|
{
|
||||||
id = this->id + L"." + id;
|
id = this->id + L"." + id;
|
||||||
TexOffs *offs = model->getMapTex(id);
|
TexOffs *offs = model->getMapTex(id);
|
||||||
|
|
@ -118,42 +114,42 @@ ModelPart *ModelPart::addBox(wstring id, float x0, float y0, float z0, int w, in
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
ModelPart *ModelPart::addBox(float x0, float y0, float z0, int w, int h, int d)
|
ModelPart *ModelPart::addBox(float x0, float y0, float z0, int w, int h, int d)
|
||||||
{
|
{
|
||||||
cubes.push_back(new Cube(this, xTexOffs, yTexOffs, x0, y0, z0, w, h, d, 0));
|
cubes.push_back(new Cube(this, xTexOffs, yTexOffs, x0, y0, z0, w, h, d, 0));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModelPart::addHumanoidBox(float x0, float y0, float z0, int w, int h, int d, float g)
|
void ModelPart::addHumanoidBox(float x0, float y0, float z0, int w, int h, int d, float g)
|
||||||
{
|
{
|
||||||
cubes.push_back(new Cube(this, xTexOffs, yTexOffs, x0, y0, z0, w, h, d, g, 63, true));
|
cubes.push_back(new Cube(this, xTexOffs, yTexOffs, x0, y0, z0, w, h, d, g, 63, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
ModelPart *ModelPart::addBoxWithMask(float x0, float y0, float z0, int w, int h, int d, int faceMask)
|
ModelPart *ModelPart::addBoxWithMask(float x0, float y0, float z0, int w, int h, int d, int faceMask)
|
||||||
{
|
{
|
||||||
cubes.push_back(new Cube(this, xTexOffs, yTexOffs, x0, y0, z0, w, h, d, 0, faceMask));
|
cubes.push_back(new Cube(this, xTexOffs, yTexOffs, x0, y0, z0, w, h, d, 0, faceMask));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModelPart::addBox(float x0, float y0, float z0, int w, int h, int d, float g)
|
void ModelPart::addBox(float x0, float y0, float z0, int w, int h, int d, float g)
|
||||||
{
|
{
|
||||||
cubes.push_back(new Cube(this, xTexOffs, yTexOffs, x0, y0, z0, w, h, d, g));
|
cubes.push_back(new Cube(this, xTexOffs, yTexOffs, x0, y0, z0, w, h, d, g));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ModelPart::addTexBox(float x0, float y0, float z0, int w, int h, int d, int tex)
|
void ModelPart::addTexBox(float x0, float y0, float z0, int w, int h, int d, int tex)
|
||||||
{
|
{
|
||||||
cubes.push_back(new Cube(this, xTexOffs, yTexOffs, x0, y0, z0, w, h, d, (float)tex));
|
cubes.push_back(new Cube(this, xTexOffs, yTexOffs, x0, y0, z0, w, h, d, (float)tex));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModelPart::setPos(float x, float y, float z)
|
void ModelPart::setPos(float x, float y, float z)
|
||||||
{
|
{
|
||||||
this->x = x;
|
this->x = x;
|
||||||
this->y = y;
|
this->y = y;
|
||||||
this->z = z;
|
this->z = z;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModelPart::render(float scale, bool usecompiled, bool bHideParentBodyPart)
|
void ModelPart::render(float scale, bool usecompiled, bool bHideParentBodyPart)
|
||||||
{
|
{
|
||||||
if (neverRender) return;
|
if (neverRender) return;
|
||||||
if (!visible) return;
|
if (!visible) return;
|
||||||
|
|
@ -161,7 +157,7 @@ void ModelPart::render(float scale, bool usecompiled, bool bHideParentBodyPart)
|
||||||
|
|
||||||
glTranslatef(translateX, translateY, translateZ);
|
glTranslatef(translateX, translateY, translateZ);
|
||||||
|
|
||||||
if (xRot != 0 || yRot != 0 || zRot != 0)
|
if (xRot != 0 || yRot != 0 || zRot != 0)
|
||||||
{
|
{
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glTranslatef(x * scale, y * scale, z * scale);
|
glTranslatef(x * scale, y * scale, z * scale);
|
||||||
|
|
@ -170,7 +166,7 @@ void ModelPart::render(float scale, bool usecompiled, bool bHideParentBodyPart)
|
||||||
if (xRot != 0) glRotatef(xRot * RAD, 1, 0, 0);
|
if (xRot != 0) glRotatef(xRot * RAD, 1, 0, 0);
|
||||||
|
|
||||||
if(!bHideParentBodyPart)
|
if(!bHideParentBodyPart)
|
||||||
{
|
{
|
||||||
if( usecompiled )
|
if( usecompiled )
|
||||||
{
|
{
|
||||||
glCallList(list);
|
glCallList(list);
|
||||||
|
|
@ -178,53 +174,27 @@ void ModelPart::render(float scale, bool usecompiled, bool bHideParentBodyPart)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Tesselator *t = Tesselator::getInstance();
|
Tesselator *t = Tesselator::getInstance();
|
||||||
for (unsigned int i = 0; i < cubes.size(); i++)
|
for (unsigned int i = 0; i < cubes.size(); i++)
|
||||||
{
|
{
|
||||||
cubes[i]->render(t, scale);
|
cubes[i]->render(t, scale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//if (children != NULL)
|
//if (children != NULL)
|
||||||
{
|
{
|
||||||
for (unsigned int i = 0; i < children.size(); i++)
|
for (unsigned int i = 0; i < children.size(); i++)
|
||||||
{
|
{
|
||||||
children.at(i)->render(scale,usecompiled);
|
children.at(i)->render(scale,usecompiled);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
}
|
}
|
||||||
else if (x != 0 || y != 0 || z != 0)
|
else if (x != 0 || y != 0 || z != 0)
|
||||||
{
|
{
|
||||||
glTranslatef(x * scale, y * scale, z * scale);
|
glTranslatef(x * scale, y * scale, z * scale);
|
||||||
if(!bHideParentBodyPart)
|
if(!bHideParentBodyPart)
|
||||||
{
|
|
||||||
if( usecompiled )
|
|
||||||
{
|
|
||||||
glCallList(list);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Tesselator *t = Tesselator::getInstance();
|
|
||||||
for (unsigned int i = 0; i < cubes.size(); i++)
|
|
||||||
{
|
|
||||||
cubes[i]->render(t, scale);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//if (children != NULL)
|
|
||||||
{
|
{
|
||||||
for (unsigned int i = 0; i < children.size(); i++)
|
|
||||||
{
|
|
||||||
children.at(i)->render(scale,usecompiled);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
glTranslatef(-x * scale, -y * scale, -z * scale);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if(!bHideParentBodyPart)
|
|
||||||
{
|
|
||||||
if( usecompiled )
|
if( usecompiled )
|
||||||
{
|
{
|
||||||
glCallList(list);
|
glCallList(list);
|
||||||
|
|
@ -232,15 +202,41 @@ void ModelPart::render(float scale, bool usecompiled, bool bHideParentBodyPart)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Tesselator *t = Tesselator::getInstance();
|
Tesselator *t = Tesselator::getInstance();
|
||||||
for (unsigned int i = 0; i < cubes.size(); i++)
|
for (unsigned int i = 0; i < cubes.size(); i++)
|
||||||
{
|
{
|
||||||
cubes[i]->render(t, scale);
|
cubes[i]->render(t, scale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//if (children != NULL)
|
//if (children != NULL)
|
||||||
{
|
{
|
||||||
for (unsigned int i = 0; i < children.size(); i++)
|
for (unsigned int i = 0; i < children.size(); i++)
|
||||||
|
{
|
||||||
|
children.at(i)->render(scale,usecompiled);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
glTranslatef(-x * scale, -y * scale, -z * scale);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(!bHideParentBodyPart)
|
||||||
|
{
|
||||||
|
if( usecompiled )
|
||||||
|
{
|
||||||
|
glCallList(list);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Tesselator *t = Tesselator::getInstance();
|
||||||
|
for (unsigned int i = 0; i < cubes.size(); i++)
|
||||||
|
{
|
||||||
|
cubes[i]->render(t, scale);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//if (children != NULL)
|
||||||
|
{
|
||||||
|
for (unsigned int i = 0; i < children.size(); i++)
|
||||||
{
|
{
|
||||||
children.at(i)->render(scale,usecompiled);
|
children.at(i)->render(scale,usecompiled);
|
||||||
}
|
}
|
||||||
|
|
@ -250,7 +246,7 @@ void ModelPart::render(float scale, bool usecompiled, bool bHideParentBodyPart)
|
||||||
glTranslatef(-translateX, -translateY, -translateZ);
|
glTranslatef(-translateX, -translateY, -translateZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModelPart::renderRollable(float scale, bool usecompiled)
|
void ModelPart::renderRollable(float scale, bool usecompiled)
|
||||||
{
|
{
|
||||||
if (neverRender) return;
|
if (neverRender) return;
|
||||||
if (!visible) return;
|
if (!visible) return;
|
||||||
|
|
@ -266,29 +262,29 @@ void ModelPart::renderRollable(float scale, bool usecompiled)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModelPart::translateTo(float scale)
|
void ModelPart::translateTo(float scale)
|
||||||
{
|
{
|
||||||
if (neverRender) return;
|
if (neverRender) return;
|
||||||
if (!visible) return;
|
if (!visible) return;
|
||||||
if (!compiled) compile(scale);
|
if (!compiled) compile(scale);
|
||||||
|
|
||||||
if (xRot != 0 || yRot != 0 || zRot != 0)
|
if (xRot != 0 || yRot != 0 || zRot != 0)
|
||||||
{
|
{
|
||||||
glTranslatef(x * scale, y * scale, z * scale);
|
glTranslatef(x * scale, y * scale, z * scale);
|
||||||
if (zRot != 0) glRotatef(zRot * RAD, 0, 0, 1);
|
if (zRot != 0) glRotatef(zRot * RAD, 0, 0, 1);
|
||||||
if (yRot != 0) glRotatef(yRot * RAD, 0, 1, 0);
|
if (yRot != 0) glRotatef(yRot * RAD, 0, 1, 0);
|
||||||
if (xRot != 0) glRotatef(xRot * RAD, 1, 0, 0);
|
if (xRot != 0) glRotatef(xRot * RAD, 1, 0, 0);
|
||||||
}
|
}
|
||||||
else if (x != 0 || y != 0 || z != 0)
|
else if (x != 0 || y != 0 || z != 0)
|
||||||
{
|
{
|
||||||
glTranslatef(x * scale, y * scale, z * scale);
|
glTranslatef(x * scale, y * scale, z * scale);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModelPart::compile(float scale)
|
void ModelPart::compile(float scale)
|
||||||
{
|
{
|
||||||
list = MemoryTracker::genLists(1);
|
list = MemoryTracker::genLists(1);
|
||||||
|
|
||||||
|
|
@ -299,24 +295,24 @@ void ModelPart::compile(float scale)
|
||||||
glDepthMask(true);
|
glDepthMask(true);
|
||||||
Tesselator *t = Tesselator::getInstance();
|
Tesselator *t = Tesselator::getInstance();
|
||||||
|
|
||||||
for (unsigned int i = 0; i < cubes.size(); i++)
|
for (unsigned int i = 0; i < cubes.size(); i++)
|
||||||
{
|
{
|
||||||
cubes.at(i)->render(t, scale);
|
cubes.at(i)->render(t, scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
glEndList();
|
glEndList();
|
||||||
|
|
||||||
compiled = true;
|
compiled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
ModelPart *ModelPart::setTexSize(int xs, int ys)
|
ModelPart *ModelPart::setTexSize(int xs, int ys)
|
||||||
{
|
{
|
||||||
this->xTexSize = (float)xs;
|
this->xTexSize = (float)xs;
|
||||||
this->yTexSize = (float)ys;
|
this->yTexSize = (float)ys;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModelPart::mimic(ModelPart *o)
|
void ModelPart::mimic(ModelPart *o)
|
||||||
{
|
{
|
||||||
x = o->x;
|
x = o->x;
|
||||||
y = o->y;
|
y = o->y;
|
||||||
|
|
|
||||||
|
|
@ -105,11 +105,13 @@ MultiPlayerChunkCache::~MultiPlayerChunkCache()
|
||||||
delete cache;
|
delete cache;
|
||||||
delete hasData;
|
delete hasData;
|
||||||
|
|
||||||
AUTO_VAR(itEnd, loadedChunkList.end());
|
for (auto& it : loadedChunkList)
|
||||||
for (AUTO_VAR(it, loadedChunkList.begin()); it != itEnd; it++)
|
{
|
||||||
delete *it;
|
if ( it )
|
||||||
|
delete it;
|
||||||
|
}
|
||||||
|
|
||||||
DeleteCriticalSection(&m_csLoadCreate);
|
DeleteCriticalSection(&m_csLoadCreate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -146,7 +148,7 @@ void MultiPlayerChunkCache::drop(int x, int z)
|
||||||
{
|
{
|
||||||
// Added parameter here specifies that we don't want to delete tile entities, as they won't get recreated unless they've got update packets
|
// Added parameter here specifies that we don't want to delete tile entities, as they won't get recreated unless they've got update packets
|
||||||
// The tile entities are in general only created on the client by virtue of the chunk rebuild
|
// The tile entities are in general only created on the client by virtue of the chunk rebuild
|
||||||
chunk->unload(false);
|
chunk->unload(false);
|
||||||
|
|
||||||
// 4J - We just want to clear out the entities in the chunk, but everything else should be valid
|
// 4J - We just want to clear out the entities in the chunk, but everything else should be valid
|
||||||
chunk->loaded = true;
|
chunk->loaded = true;
|
||||||
|
|
@ -174,7 +176,7 @@ LevelChunk *MultiPlayerChunkCache::create(int x, int z)
|
||||||
// 4J-JEV: We are about to use shared data, abort if the server is stopped and the data is deleted.
|
// 4J-JEV: We are about to use shared data, abort if the server is stopped and the data is deleted.
|
||||||
if (MinecraftServer::getInstance()->serverHalted()) return NULL;
|
if (MinecraftServer::getInstance()->serverHalted()) return NULL;
|
||||||
|
|
||||||
// If we're the host, then don't create the chunk, share data from the server's copy
|
// If we're the host, then don't create the chunk, share data from the server's copy
|
||||||
#ifdef _LARGE_WORLDS
|
#ifdef _LARGE_WORLDS
|
||||||
LevelChunk *serverChunk = MinecraftServer::getInstance()->getLevel(level->dimension->id)->cache->getChunkLoadedOrUnloaded(x,z);
|
LevelChunk *serverChunk = MinecraftServer::getInstance()->getLevel(level->dimension->id)->cache->getChunkLoadedOrUnloaded(x,z);
|
||||||
#else
|
#else
|
||||||
|
|
@ -193,7 +195,7 @@ LevelChunk *MultiPlayerChunkCache::create(int x, int z)
|
||||||
chunk = new LevelChunk(level, bytes, x, z);
|
chunk = new LevelChunk(level, bytes, x, z);
|
||||||
|
|
||||||
// 4J - changed to use new methods for lighting
|
// 4J - changed to use new methods for lighting
|
||||||
chunk->setSkyLightDataAllBright();
|
chunk->setSkyLightDataAllBright();
|
||||||
// Arrays::fill(chunk->skyLight->data, (byte) 255);
|
// Arrays::fill(chunk->skyLight->data, (byte) 255);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -294,7 +296,7 @@ wstring MultiPlayerChunkCache::gatherStats()
|
||||||
EnterCriticalSection(&m_csLoadCreate);
|
EnterCriticalSection(&m_csLoadCreate);
|
||||||
int size = (int)loadedChunkList.size();
|
int size = (int)loadedChunkList.size();
|
||||||
LeaveCriticalSection(&m_csLoadCreate);
|
LeaveCriticalSection(&m_csLoadCreate);
|
||||||
return L"MultiplayerChunkCache: " + _toString<int>(size);
|
return L"MultiplayerChunkCache: " + std::to_wstring(size);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -97,7 +97,7 @@ void MultiPlayerLevel::tick()
|
||||||
if (getGameRules()->getBoolean(GameRules::RULE_DAYLIGHT))
|
if (getGameRules()->getBoolean(GameRules::RULE_DAYLIGHT))
|
||||||
{
|
{
|
||||||
// 4J: Debug setting added to keep it at day time
|
// 4J: Debug setting added to keep it at day time
|
||||||
#ifndef _FINAL_BUILD
|
#ifndef _FINAL_BUILD
|
||||||
bool freezeTime = app.DebugSettingsOn() && app.GetGameSettingsDebugMask(ProfileManager.GetPrimaryPad())&(1L<<eDebugSetting_FreezeTime);
|
bool freezeTime = app.DebugSettingsOn() && app.GetGameSettingsDebugMask(ProfileManager.GetPrimaryPad())&(1L<<eDebugSetting_FreezeTime);
|
||||||
if (!freezeTime)
|
if (!freezeTime)
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -131,9 +131,10 @@ void MultiPlayerLevel::tick()
|
||||||
PIXBeginNamedEvent(0,"Connection ticking");
|
PIXBeginNamedEvent(0,"Connection ticking");
|
||||||
// 4J HEG - Copy the connections vector to prevent crash when moving to Nether
|
// 4J HEG - Copy the connections vector to prevent crash when moving to Nether
|
||||||
vector<ClientConnection *> connectionsTemp = connections;
|
vector<ClientConnection *> connectionsTemp = connections;
|
||||||
for(AUTO_VAR(connection, connectionsTemp.begin()); connection < connectionsTemp.end(); ++connection )
|
for (auto connection : connectionsTemp )
|
||||||
{
|
{
|
||||||
(*connection)->tick();
|
if ( connection )
|
||||||
|
connection->tick();
|
||||||
}
|
}
|
||||||
PIXEndNamedEvent();
|
PIXEndNamedEvent();
|
||||||
|
|
||||||
|
|
@ -383,10 +384,8 @@ void MultiPlayerLevel::tickTiles()
|
||||||
{
|
{
|
||||||
ChunkPos cp = chunksToPoll.get(i);
|
ChunkPos cp = chunksToPoll.get(i);
|
||||||
#else
|
#else
|
||||||
AUTO_VAR(itEndCtp, chunksToPoll.end());
|
for (ChunkPos cp : chunksToPoll)
|
||||||
for (AUTO_VAR(it, chunksToPoll.begin()); it != itEndCtp; it++)
|
|
||||||
{
|
{
|
||||||
ChunkPos cp = *it;
|
|
||||||
#endif
|
#endif
|
||||||
int xo = cp.x * 16;
|
int xo = cp.x * 16;
|
||||||
int zo = cp.z * 16;
|
int zo = cp.z * 16;
|
||||||
|
|
@ -433,8 +432,8 @@ void MultiPlayerLevel::removeEntity(shared_ptr<Entity> e)
|
||||||
{
|
{
|
||||||
// 4J Stu - Add this remove from the reEntries collection to stop us continually removing and re-adding things,
|
// 4J Stu - Add this remove from the reEntries collection to stop us continually removing and re-adding things,
|
||||||
// in particular the MultiPlayerLocalPlayer when they die
|
// in particular the MultiPlayerLocalPlayer when they die
|
||||||
AUTO_VAR(it, reEntries.find(e));
|
auto it = reEntries.find(e);
|
||||||
if (it!=reEntries.end())
|
if (it!=reEntries.end())
|
||||||
{
|
{
|
||||||
reEntries.erase(it);
|
reEntries.erase(it);
|
||||||
}
|
}
|
||||||
|
|
@ -446,8 +445,8 @@ void MultiPlayerLevel::removeEntity(shared_ptr<Entity> e)
|
||||||
void MultiPlayerLevel::entityAdded(shared_ptr<Entity> e)
|
void MultiPlayerLevel::entityAdded(shared_ptr<Entity> e)
|
||||||
{
|
{
|
||||||
Level::entityAdded(e);
|
Level::entityAdded(e);
|
||||||
AUTO_VAR(it, reEntries.find(e));
|
auto it = reEntries.find(e);
|
||||||
if (it!=reEntries.end())
|
if (it!=reEntries.end())
|
||||||
{
|
{
|
||||||
reEntries.erase(it);
|
reEntries.erase(it);
|
||||||
}
|
}
|
||||||
|
|
@ -456,8 +455,8 @@ void MultiPlayerLevel::entityAdded(shared_ptr<Entity> e)
|
||||||
void MultiPlayerLevel::entityRemoved(shared_ptr<Entity> e)
|
void MultiPlayerLevel::entityRemoved(shared_ptr<Entity> e)
|
||||||
{
|
{
|
||||||
Level::entityRemoved(e);
|
Level::entityRemoved(e);
|
||||||
AUTO_VAR(it, forced.find(e));
|
auto it = forced.find(e);
|
||||||
if (it!=forced.end())
|
if (it!=forced.end())
|
||||||
{
|
{
|
||||||
reEntries.insert(e);
|
reEntries.insert(e);
|
||||||
}
|
}
|
||||||
|
|
@ -482,16 +481,16 @@ void MultiPlayerLevel::putEntity(int id, shared_ptr<Entity> e)
|
||||||
|
|
||||||
shared_ptr<Entity> MultiPlayerLevel::getEntity(int id)
|
shared_ptr<Entity> MultiPlayerLevel::getEntity(int id)
|
||||||
{
|
{
|
||||||
AUTO_VAR(it, entitiesById.find(id));
|
auto it = entitiesById.find(id);
|
||||||
if( it == entitiesById.end() ) return nullptr;
|
if( it == entitiesById.end() ) return nullptr;
|
||||||
return it->second;
|
return it->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
shared_ptr<Entity> MultiPlayerLevel::removeEntity(int id)
|
shared_ptr<Entity> MultiPlayerLevel::removeEntity(int id)
|
||||||
{
|
{
|
||||||
shared_ptr<Entity> e;
|
shared_ptr<Entity> e;
|
||||||
AUTO_VAR(it, entitiesById.find(id));
|
auto it = entitiesById.find(id);
|
||||||
if( it != entitiesById.end() )
|
if( it != entitiesById.end() )
|
||||||
{
|
{
|
||||||
e = it->second;
|
e = it->second;
|
||||||
entitiesById.erase(it);
|
entitiesById.erase(it);
|
||||||
|
|
@ -508,19 +507,20 @@ shared_ptr<Entity> MultiPlayerLevel::removeEntity(int id)
|
||||||
// This gets called when a chunk is unloaded, but we only do half an unload to remove entities slightly differently
|
// This gets called when a chunk is unloaded, but we only do half an unload to remove entities slightly differently
|
||||||
void MultiPlayerLevel::removeEntities(vector<shared_ptr<Entity> > *list)
|
void MultiPlayerLevel::removeEntities(vector<shared_ptr<Entity> > *list)
|
||||||
{
|
{
|
||||||
for(AUTO_VAR(it, list->begin()); it < list->end(); ++it)
|
if ( list )
|
||||||
{
|
{
|
||||||
shared_ptr<Entity> e = *it;
|
for (auto& e : *list )
|
||||||
|
|
||||||
AUTO_VAR(reIt, reEntries.find(e));
|
|
||||||
if (reIt!=reEntries.end())
|
|
||||||
{
|
{
|
||||||
reEntries.erase(reIt);
|
auto reIt = reEntries.find(e);
|
||||||
}
|
if (reIt!=reEntries.end())
|
||||||
|
{
|
||||||
|
reEntries.erase(reIt);
|
||||||
|
}
|
||||||
|
|
||||||
forced.erase(e);
|
forced.erase(e);
|
||||||
|
}
|
||||||
|
Level::removeEntities(list);
|
||||||
}
|
}
|
||||||
Level::removeEntities(list);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MultiPlayerLevel::setData(int x, int y, int z, int data, int updateFlags, bool forceUpdate/*=false*/) // 4J added forceUpdate)
|
bool MultiPlayerLevel::setData(int x, int y, int z, int data, int updateFlags, bool forceUpdate/*=false*/) // 4J added forceUpdate)
|
||||||
|
|
@ -590,7 +590,7 @@ bool MultiPlayerLevel::doSetTileAndData(int x, int y, int z, int tile, int data)
|
||||||
// and so the thing being notified of any update through tileUpdated is the renderer
|
// and so the thing being notified of any update through tileUpdated is the renderer
|
||||||
int prevTile = getTile(x, y, z);
|
int prevTile = getTile(x, y, z);
|
||||||
bool visuallyImportant = (!( ( ( prevTile == Tile::water_Id ) && ( tile == Tile::calmWater_Id ) ) ||
|
bool visuallyImportant = (!( ( ( prevTile == Tile::water_Id ) && ( tile == Tile::calmWater_Id ) ) ||
|
||||||
( ( prevTile == Tile::calmWater_Id ) && ( tile == Tile::water_Id ) ) ||
|
( ( prevTile == Tile::calmWater_Id ) && ( tile == Tile::water_Id ) ) ||
|
||||||
( ( prevTile == Tile::lava_Id ) && ( tile == Tile::calmLava_Id ) ) ||
|
( ( prevTile == Tile::lava_Id ) && ( tile == Tile::calmLava_Id ) ) ||
|
||||||
( ( prevTile == Tile::calmLava_Id ) && ( tile == Tile::calmLava_Id ) ) ||
|
( ( prevTile == Tile::calmLava_Id ) && ( tile == Tile::calmLava_Id ) ) ||
|
||||||
( ( prevTile == Tile::calmLava_Id ) && ( tile == Tile::lava_Id ) ) ) );
|
( ( prevTile == Tile::calmLava_Id ) && ( tile == Tile::lava_Id ) ) ) );
|
||||||
|
|
@ -615,16 +615,18 @@ void MultiPlayerLevel::disconnect(bool sendDisconnect /*= true*/)
|
||||||
{
|
{
|
||||||
if( sendDisconnect )
|
if( sendDisconnect )
|
||||||
{
|
{
|
||||||
for(AUTO_VAR(it, connections.begin()); it < connections.end(); ++it )
|
for (auto& it : connections )
|
||||||
{
|
{
|
||||||
(*it)->sendAndDisconnect( shared_ptr<DisconnectPacket>( new DisconnectPacket(DisconnectPacket::eDisconnect_Quitting) ) );
|
if ( it )
|
||||||
|
it->sendAndDisconnect( shared_ptr<DisconnectPacket>( new DisconnectPacket(DisconnectPacket::eDisconnect_Quitting) ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for(AUTO_VAR(it, connections.begin()); it < connections.end(); ++it )
|
for (auto& it : connections )
|
||||||
{
|
{
|
||||||
(*it)->close();
|
if ( it )
|
||||||
|
it->close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -707,9 +709,8 @@ void MultiPlayerLevel::animateTickDoWork()
|
||||||
|
|
||||||
for( int i = 0; i < ticksPerChunk; i++ )
|
for( int i = 0; i < ticksPerChunk; i++ )
|
||||||
{
|
{
|
||||||
for( AUTO_VAR(it, chunksToAnimate.begin()); it != chunksToAnimate.end(); it++ )
|
for(int packed : chunksToAnimate)
|
||||||
{
|
{
|
||||||
int packed = *it;
|
|
||||||
int cx = ( packed << 8 ) >> 24;
|
int cx = ( packed << 8 ) >> 24;
|
||||||
int cy = ( packed << 16 ) >> 24;
|
int cy = ( packed << 16 ) >> 24;
|
||||||
int cz = ( packed << 24 ) >> 24;
|
int cz = ( packed << 24 ) >> 24;
|
||||||
|
|
@ -809,12 +810,12 @@ void MultiPlayerLevel::removeAllPendingEntityRemovals()
|
||||||
//entities.removeAll(entitiesToRemove);
|
//entities.removeAll(entitiesToRemove);
|
||||||
|
|
||||||
EnterCriticalSection(&m_entitiesCS);
|
EnterCriticalSection(&m_entitiesCS);
|
||||||
for( AUTO_VAR(it, entities.begin()); it != entities.end(); )
|
for (auto it = entities.begin(); it != entities.end();)
|
||||||
{
|
{
|
||||||
bool found = false;
|
bool found = false;
|
||||||
for( AUTO_VAR(it2, entitiesToRemove.begin()); it2 != entitiesToRemove.end(); it2++ )
|
for(auto & it2 : entitiesToRemove)
|
||||||
{
|
{
|
||||||
if( (*it) == (*it2) )
|
if( (*it) == it2 )
|
||||||
{
|
{
|
||||||
found = true;
|
found = true;
|
||||||
break;
|
break;
|
||||||
|
|
@ -831,29 +832,30 @@ void MultiPlayerLevel::removeAllPendingEntityRemovals()
|
||||||
}
|
}
|
||||||
LeaveCriticalSection(&m_entitiesCS);
|
LeaveCriticalSection(&m_entitiesCS);
|
||||||
|
|
||||||
AUTO_VAR(endIt, entitiesToRemove.end());
|
for (auto& e : entitiesToRemove)
|
||||||
for (AUTO_VAR(it, entitiesToRemove.begin()); it != endIt; it++)
|
|
||||||
{
|
{
|
||||||
shared_ptr<Entity> e = *it;
|
if ( e )
|
||||||
int xc = e->xChunk;
|
|
||||||
int zc = e->zChunk;
|
|
||||||
if (e->inChunk && hasChunk(xc, zc))
|
|
||||||
{
|
{
|
||||||
getChunk(xc, zc)->removeEntity(e);
|
int xc = e->xChunk;
|
||||||
|
int zc = e->zChunk;
|
||||||
|
if (e->inChunk && hasChunk(xc, zc))
|
||||||
|
{
|
||||||
|
getChunk(xc, zc)->removeEntity(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4J Stu - Is there a reason do this in a separate loop? Thats what the Java does...
|
// 4J Stu - Is there a reason do this in a separate loop? Thats what the Java does...
|
||||||
endIt = entitiesToRemove.end();
|
for (auto& it : entitiesToRemove)
|
||||||
for (AUTO_VAR(it, entitiesToRemove.begin()); it != endIt; it++)
|
|
||||||
{
|
{
|
||||||
entityRemoved(*it);
|
if ( it )
|
||||||
|
entityRemoved(it);
|
||||||
}
|
}
|
||||||
entitiesToRemove.clear();
|
entitiesToRemove.clear();
|
||||||
|
|
||||||
//for (int i = 0; i < entities.size(); i++)
|
//for (int i = 0; i < entities.size(); i++)
|
||||||
EnterCriticalSection(&m_entitiesCS);
|
EnterCriticalSection(&m_entitiesCS);
|
||||||
vector<shared_ptr<Entity> >::iterator it = entities.begin();
|
auto it = entities.begin();
|
||||||
while( it != entities.end() )
|
while( it != entities.end() )
|
||||||
{
|
{
|
||||||
shared_ptr<Entity> e = *it;//entities.at(i);
|
shared_ptr<Entity> e = *it;//entities.at(i);
|
||||||
|
|
@ -865,7 +867,7 @@ void MultiPlayerLevel::removeAllPendingEntityRemovals()
|
||||||
e->riding->rider = weak_ptr<Entity>();
|
e->riding->rider = weak_ptr<Entity>();
|
||||||
e->riding = nullptr;
|
e->riding = nullptr;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
++it;
|
++it;
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -900,8 +902,8 @@ void MultiPlayerLevel::removeClientConnection(ClientConnection *c, bool sendDisc
|
||||||
c->sendAndDisconnect( shared_ptr<DisconnectPacket>( new DisconnectPacket(DisconnectPacket::eDisconnect_Quitting) ) );
|
c->sendAndDisconnect( shared_ptr<DisconnectPacket>( new DisconnectPacket(DisconnectPacket::eDisconnect_Quitting) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
AUTO_VAR(it, find( connections.begin(), connections.end(), c ));
|
auto it = find(connections.begin(), connections.end(), c);
|
||||||
if( it != connections.end() )
|
if( it != connections.end() )
|
||||||
{
|
{
|
||||||
connections.erase( it );
|
connections.erase( it );
|
||||||
}
|
}
|
||||||
|
|
@ -910,9 +912,10 @@ void MultiPlayerLevel::removeClientConnection(ClientConnection *c, bool sendDisc
|
||||||
void MultiPlayerLevel::tickAllConnections()
|
void MultiPlayerLevel::tickAllConnections()
|
||||||
{
|
{
|
||||||
PIXBeginNamedEvent(0,"Connection ticking");
|
PIXBeginNamedEvent(0,"Connection ticking");
|
||||||
for(AUTO_VAR(it, connections.begin()); it < connections.end(); ++it )
|
for (auto& it : connections )
|
||||||
{
|
{
|
||||||
(*it)->tick();
|
if ( it )
|
||||||
|
it->tick();
|
||||||
}
|
}
|
||||||
PIXEndNamedEvent();
|
PIXEndNamedEvent();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -328,7 +328,7 @@ wstring Options::getMessage(const Options::Option *item)
|
||||||
{
|
{
|
||||||
return caption + language->getElement(L"options.sensitivity.max");
|
return caption + language->getElement(L"options.sensitivity.max");
|
||||||
}
|
}
|
||||||
return caption + _toString<int>((int) (progressValue * 200)) + L"%";
|
return caption + std::to_wstring(static_cast<int>(progressValue * 200)) + L"%";
|
||||||
} else if (item == Option::FOV)
|
} else if (item == Option::FOV)
|
||||||
{
|
{
|
||||||
if (progressValue == 0)
|
if (progressValue == 0)
|
||||||
|
|
@ -339,7 +339,7 @@ wstring Options::getMessage(const Options::Option *item)
|
||||||
{
|
{
|
||||||
return caption + language->getElement(L"options.fov.max");
|
return caption + language->getElement(L"options.fov.max");
|
||||||
}
|
}
|
||||||
return caption + _toString<int>((int) (70 + progressValue * 40));
|
return caption + std::to_wstring(static_cast<int>(70.0f + progressValue * 40.0f));
|
||||||
} else if (item == Option::GAMMA)
|
} else if (item == Option::GAMMA)
|
||||||
{
|
{
|
||||||
if (progressValue == 0)
|
if (progressValue == 0)
|
||||||
|
|
@ -350,7 +350,7 @@ wstring Options::getMessage(const Options::Option *item)
|
||||||
{
|
{
|
||||||
return caption + language->getElement(L"options.gamma.max");
|
return caption + language->getElement(L"options.gamma.max");
|
||||||
}
|
}
|
||||||
return caption + L"+" + _toString<int>((int) (progressValue * 100)) + L"%";
|
return caption + L"+" + std::to_wstring( static_cast<int>(progressValue * 100.0f)) + L"%";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -358,7 +358,7 @@ wstring Options::getMessage(const Options::Option *item)
|
||||||
{
|
{
|
||||||
return caption + language->getElement(L"options.off");
|
return caption + language->getElement(L"options.off");
|
||||||
}
|
}
|
||||||
return caption + _toString<int>((int) (progressValue * 100)) + L"%";
|
return caption + std::to_wstring(static_cast<int>(progressValue * 100.0f)) + L"%";
|
||||||
}
|
}
|
||||||
} else if (item->isBoolean())
|
} else if (item->isBoolean())
|
||||||
{
|
{
|
||||||
|
|
@ -410,7 +410,7 @@ void Options::load()
|
||||||
if (!optionsFile.exists()) return;
|
if (!optionsFile.exists()) return;
|
||||||
// 4J - was new BufferedReader(new FileReader(optionsFile));
|
// 4J - was new BufferedReader(new FileReader(optionsFile));
|
||||||
BufferedReader *br = new BufferedReader(new InputStreamReader( new FileInputStream( optionsFile ) ) );
|
BufferedReader *br = new BufferedReader(new InputStreamReader( new FileInputStream( optionsFile ) ) );
|
||||||
|
|
||||||
wstring line = L"";
|
wstring line = L"";
|
||||||
while ((line = br->readLine()) != L"") // 4J - was check against NULL - do we need to distinguish between empty lines and a fail here?
|
while ((line = br->readLine()) != L"") // 4J - was check against NULL - do we need to distinguish between empty lines and a fail here?
|
||||||
{
|
{
|
||||||
|
|
@ -486,29 +486,29 @@ void Options::save()
|
||||||
DataOutputStream dos = DataOutputStream(&fos);
|
DataOutputStream dos = DataOutputStream(&fos);
|
||||||
// PrintWriter pw = new PrintWriter(new FileWriter(optionsFile));
|
// PrintWriter pw = new PrintWriter(new FileWriter(optionsFile));
|
||||||
|
|
||||||
dos.writeChars(L"music:" + _toString<float>(music) + L"\n");
|
dos.writeChars(L"music:" + std::to_wstring(music) + L"\n");
|
||||||
dos.writeChars(L"sound:" + _toString<float>(sound) + L"\n");
|
dos.writeChars(L"sound:" + std::to_wstring(sound) + L"\n");
|
||||||
dos.writeChars(L"invertYMouse:" + wstring(invertYMouse ? L"true" : L"false") + L"\n");
|
dos.writeChars(L"invertYMouse:" + wstring(invertYMouse ? L"true" : L"false") + L"\n");
|
||||||
dos.writeChars(L"mouseSensitivity:" + _toString<float>(sensitivity));
|
dos.writeChars(L"mouseSensitivity:" + std::to_wstring(sensitivity));
|
||||||
dos.writeChars(L"fov:" + _toString<float>(fov));
|
dos.writeChars(L"fov:" + std::to_wstring(fov));
|
||||||
dos.writeChars(L"gamma:" + _toString<float>(gamma));
|
dos.writeChars(L"gamma:" + std::to_wstring(gamma));
|
||||||
dos.writeChars(L"viewDistance:" + _toString<int>(viewDistance));
|
dos.writeChars(L"viewDistance:" + std::to_wstring(viewDistance));
|
||||||
dos.writeChars(L"guiScale:" + _toString<int>(guiScale));
|
dos.writeChars(L"guiScale:" + std::to_wstring(guiScale));
|
||||||
dos.writeChars(L"particles:" + _toString<int>(particles));
|
dos.writeChars(L"particles:" + std::to_wstring(particles));
|
||||||
dos.writeChars(L"bobView:" + wstring(bobView ? L"true" : L"false"));
|
dos.writeChars(L"bobView:" + wstring(bobView ? L"true" : L"false"));
|
||||||
dos.writeChars(L"anaglyph3d:" + wstring(anaglyph3d ? L"true" : L"false"));
|
dos.writeChars(L"anaglyph3d:" + wstring(anaglyph3d ? L"true" : L"false"));
|
||||||
dos.writeChars(L"advancedOpengl:" + wstring(advancedOpengl ? L"true" : L"false"));
|
dos.writeChars(L"advancedOpengl:" + wstring(advancedOpengl ? L"true" : L"false"));
|
||||||
dos.writeChars(L"fpsLimit:" + _toString<int>(framerateLimit));
|
dos.writeChars(L"fpsLimit:" + std::to_wstring(framerateLimit));
|
||||||
dos.writeChars(L"difficulty:" + _toString<int>(difficulty));
|
dos.writeChars(L"difficulty:" + std::to_wstring(difficulty));
|
||||||
dos.writeChars(L"fancyGraphics:" + wstring(fancyGraphics ? L"true" : L"false"));
|
dos.writeChars(L"fancyGraphics:" + wstring(fancyGraphics ? L"true" : L"false"));
|
||||||
dos.writeChars(L"ao:" + wstring(ambientOcclusion ? L"true" : L"false"));
|
dos.writeChars(ambientOcclusion ? L"ao:true" : L"ao:false");
|
||||||
dos.writeChars(L"clouds:" + _toString<bool>(renderClouds));
|
dos.writeChars(renderClouds ? L"clouds:true" : L"clouds:false");
|
||||||
dos.writeChars(L"skin:" + skin);
|
dos.writeChars(L"skin:" + skin);
|
||||||
dos.writeChars(L"lastServer:" + lastMpIp);
|
dos.writeChars(L"lastServer:" + lastMpIp);
|
||||||
|
|
||||||
for (int i = 0; i < keyMappings_length; i++)
|
for (int i = 0; i < keyMappings_length; i++)
|
||||||
{
|
{
|
||||||
dos.writeChars(L"key_" + keyMappings[i]->name + L":" + _toString<int>(keyMappings[i]->key));
|
dos.writeChars(L"key_" + keyMappings[i]->name + L":" + std::to_wstring(keyMappings[i]->key));
|
||||||
}
|
}
|
||||||
|
|
||||||
dos.close();
|
dos.close();
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ int g_numRUDPContextsBound = 0;
|
||||||
//unsigned int SQRNetworkManager_Orbis::RoomSyncData::playerCount = 0;
|
//unsigned int SQRNetworkManager_Orbis::RoomSyncData::playerCount = 0;
|
||||||
|
|
||||||
// This maps internal to extern states, and needs to match element-by-element the eSQRNetworkManagerInternalState enumerated type
|
// This maps internal to extern states, and needs to match element-by-element the eSQRNetworkManagerInternalState enumerated type
|
||||||
const SQRNetworkManager_Orbis::eSQRNetworkManagerState SQRNetworkManager_Orbis::m_INTtoEXTStateMappings[SQRNetworkManager_Orbis::SNM_INT_STATE_COUNT] =
|
const SQRNetworkManager_Orbis::eSQRNetworkManagerState SQRNetworkManager_Orbis::m_INTtoEXTStateMappings[SQRNetworkManager_Orbis::SNM_INT_STATE_COUNT] =
|
||||||
{
|
{
|
||||||
SNM_STATE_INITIALISING, // SNM_INT_STATE_UNINITIALISED
|
SNM_STATE_INITIALISING, // SNM_INT_STATE_UNINITIALISED
|
||||||
SNM_STATE_INITIALISING, // SNM_INT_STATE_SIGNING_IN
|
SNM_STATE_INITIALISING, // SNM_INT_STATE_SIGNING_IN
|
||||||
|
|
@ -143,7 +143,7 @@ void SQRNetworkManager_Orbis::Initialise()
|
||||||
|
|
||||||
assert( m_state == SNM_INT_STATE_UNINITIALISED );
|
assert( m_state == SNM_INT_STATE_UNINITIALISED );
|
||||||
|
|
||||||
|
|
||||||
//Initialize libnetctl
|
//Initialize libnetctl
|
||||||
ret = sceNetCtlInit();
|
ret = sceNetCtlInit();
|
||||||
if( ( ret < 0 /*&& ret != CELL_NET_CTL_ERROR_NOT_TERMINATED*/ ) || ForceErrorPoint( SNM_FORCE_ERROR_NET_CTL_INIT ) )
|
if( ( ret < 0 /*&& ret != CELL_NET_CTL_ERROR_NOT_TERMINATED*/ ) || ForceErrorPoint( SNM_FORCE_ERROR_NET_CTL_INIT ) )
|
||||||
|
|
@ -172,14 +172,14 @@ void SQRNetworkManager_Orbis::Initialise()
|
||||||
|
|
||||||
SonyHttp::init();
|
SonyHttp::init();
|
||||||
ret = sceNpSetNpTitleId(GetSceNpTitleId(), GetSceNpTitleSecret());
|
ret = sceNpSetNpTitleId(GetSceNpTitleId(), GetSceNpTitleSecret());
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
app.DebugPrintf("sceNpSetNpTitleId failed, ret=%x\n", ret);
|
app.DebugPrintf("sceNpSetNpTitleId failed, ret=%x\n", ret);
|
||||||
assert(0);
|
assert(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = sceRudpEnableInternalIOThread(RUDP_THREAD_STACK_SIZE, RUDP_THREAD_PRIORITY);
|
ret = sceRudpEnableInternalIOThread(RUDP_THREAD_STACK_SIZE, RUDP_THREAD_PRIORITY);
|
||||||
if(ret < 0)
|
if(ret < 0)
|
||||||
{
|
{
|
||||||
app.DebugPrintf("sceRudpEnableInternalIOThread failed with error code 0x%08x\n", ret);
|
app.DebugPrintf("sceRudpEnableInternalIOThread failed with error code 0x%08x\n", ret);
|
||||||
assert(0);
|
assert(0);
|
||||||
|
|
@ -192,7 +192,7 @@ void SQRNetworkManager_Orbis::Initialise()
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// On Orbis, PSN sign in is only handled by the XMB
|
// On Orbis, PSN sign in is only handled by the XMB
|
||||||
SetState(SNM_INT_STATE_IDLE);
|
SetState(SNM_INT_STATE_IDLE);
|
||||||
}
|
}
|
||||||
SonyVoiceChat_Orbis::init();
|
SonyVoiceChat_Orbis::init();
|
||||||
|
|
||||||
|
|
@ -299,7 +299,7 @@ void SQRNetworkManager_Orbis::InitialiseAfterOnline()
|
||||||
|
|
||||||
|
|
||||||
ret = sceNpMatching2CreateContext(¶m, &m_matchingContext);
|
ret = sceNpMatching2CreateContext(¶m, &m_matchingContext);
|
||||||
|
|
||||||
if( ( ret < 0 ) || ForceErrorPoint( SNM_FORCE_ERROR_CREATE_MATCHING_CONTEXT ) )
|
if( ( ret < 0 ) || ForceErrorPoint( SNM_FORCE_ERROR_CREATE_MATCHING_CONTEXT ) )
|
||||||
{
|
{
|
||||||
app.DebugPrintf("SQRNetworkManager_Orbis::InitialiseAfterOnline - sceNpMatching2CreateContext failed with error 0x%08x\n", ret);
|
app.DebugPrintf("SQRNetworkManager_Orbis::InitialiseAfterOnline - sceNpMatching2CreateContext failed with error 0x%08x\n", ret);
|
||||||
|
|
@ -398,7 +398,7 @@ void SQRNetworkManager_Orbis::Tick()
|
||||||
{
|
{
|
||||||
// make sure we've removed all the remote players and killed the udp connections before we bail out
|
// make sure we've removed all the remote players and killed the udp connections before we bail out
|
||||||
if(m_RudpCtxToPlayerMap.size() == 0)
|
if(m_RudpCtxToPlayerMap.size() == 0)
|
||||||
ResetToIdle();
|
ResetToIdle();
|
||||||
}
|
}
|
||||||
|
|
||||||
EnterCriticalSection(&m_csStateChangeQueue);
|
EnterCriticalSection(&m_csStateChangeQueue);
|
||||||
|
|
@ -451,7 +451,7 @@ void SQRNetworkManager_Orbis::tickErrorDialog()
|
||||||
if(s_errorDialogRunning)
|
if(s_errorDialogRunning)
|
||||||
{
|
{
|
||||||
SceErrorDialogStatus s = sceErrorDialogUpdateStatus();
|
SceErrorDialogStatus s = sceErrorDialogUpdateStatus();
|
||||||
switch (s)
|
switch (s)
|
||||||
{
|
{
|
||||||
case SCE_ERROR_DIALOG_STATUS_NONE:
|
case SCE_ERROR_DIALOG_STATUS_NONE:
|
||||||
assert(0);
|
assert(0);
|
||||||
|
|
@ -465,9 +465,9 @@ void SQRNetworkManager_Orbis::tickErrorDialog()
|
||||||
case SCE_ERROR_DIALOG_STATUS_FINISHED:
|
case SCE_ERROR_DIALOG_STATUS_FINISHED:
|
||||||
sceErrorDialogTerminate();
|
sceErrorDialogTerminate();
|
||||||
s_errorDialogRunning = false;
|
s_errorDialogRunning = false;
|
||||||
|
|
||||||
// Start callback timer
|
// Start callback timer
|
||||||
s_SignInCompleteCallbackPending = true;
|
s_SignInCompleteCallbackPending = true;
|
||||||
s_errorDialogClosed = System::currentTimeMillis();
|
s_errorDialogClosed = System::currentTimeMillis();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -490,9 +490,9 @@ void SQRNetworkManager_Orbis::tickErrorDialog()
|
||||||
SceSystemServiceStatus status = SceSystemServiceStatus();
|
SceSystemServiceStatus status = SceSystemServiceStatus();
|
||||||
sceSystemServiceGetStatus(&status);
|
sceSystemServiceGetStatus(&status);
|
||||||
bool systemUiDisplayed = status.isInBackgroundExecution || status.isSystemUiOverlaid;
|
bool systemUiDisplayed = status.isInBackgroundExecution || status.isSystemUiOverlaid;
|
||||||
|
|
||||||
if (systemUiDisplayed)
|
if (systemUiDisplayed)
|
||||||
{
|
{
|
||||||
// Wait till the system goes away
|
// Wait till the system goes away
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -583,7 +583,7 @@ void SQRNetworkManager_Orbis::ErrorHandlingTick()
|
||||||
DeleteServerContext();
|
DeleteServerContext();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start hosting a game, by creating a room & joining it. We explicity create a server context here (via GetServerContext) as Sony suggest that
|
// Start hosting a game, by creating a room & joining it. We explicity create a server context here (via GetServerContext) as Sony suggest that
|
||||||
|
|
@ -643,7 +643,7 @@ void SQRNetworkManager_Orbis::UpdateExternalRoomData()
|
||||||
{
|
{
|
||||||
if( m_offlineGame ) return;
|
if( m_offlineGame ) return;
|
||||||
if( m_isHosting )
|
if( m_isHosting )
|
||||||
{
|
{
|
||||||
SceNpMatching2SetRoomDataExternalRequest reqParam;
|
SceNpMatching2SetRoomDataExternalRequest reqParam;
|
||||||
memset( &reqParam, 0, sizeof(reqParam) );
|
memset( &reqParam, 0, sizeof(reqParam) );
|
||||||
reqParam.roomId = m_room;
|
reqParam.roomId = m_room;
|
||||||
|
|
@ -774,13 +774,13 @@ int SQRNetworkManager_Orbis::BasicEventThreadProc( void *lpParameter )
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
ret = sceKernelWaitEqueue(manager->m_basicEventQueue, &event, 1, &outEv, NULL);
|
ret = sceKernelWaitEqueue(manager->m_basicEventQueue, &event, 1, &outEv, NULL);
|
||||||
|
|
||||||
// If the sys_event_t we've sent here from the handler has a non-zero data1 element, this is to signify that we should terminate the thread
|
// If the sys_event_t we've sent here from the handler has a non-zero data1 element, this is to signify that we should terminate the thread
|
||||||
if( event.udata == 0 )
|
if( event.udata == 0 )
|
||||||
{
|
{
|
||||||
// int iEvent;
|
// int iEvent;
|
||||||
// SceNpUserInfo from;
|
// SceNpUserInfo from;
|
||||||
// uint8_t buffer[SCE_NP_BASIC_MAX_MESSAGE_SIZE];
|
// uint8_t buffer[SCE_NP_BASIC_MAX_MESSAGE_SIZE];
|
||||||
// size_t bufferSize = SCE_NP_BASIC_MAX_MESSAGE_SIZE;
|
// size_t bufferSize = SCE_NP_BASIC_MAX_MESSAGE_SIZE;
|
||||||
// int ret = sceNpBasicGetEvent(&iEvent, &from, &buffer, &bufferSize);
|
// int ret = sceNpBasicGetEvent(&iEvent, &from, &buffer, &bufferSize);
|
||||||
// if( ret == 0 )
|
// if( ret == 0 )
|
||||||
|
|
@ -788,7 +788,7 @@ int SQRNetworkManager_Orbis::BasicEventThreadProc( void *lpParameter )
|
||||||
// if( iEvent == SCE_NP_BASIC_EVENT_INCOMING_BOOTABLE_INVITATION )
|
// if( iEvent == SCE_NP_BASIC_EVENT_INCOMING_BOOTABLE_INVITATION )
|
||||||
// {
|
// {
|
||||||
// // 4J Stu - Don't do this here as it can be very disruptive to gameplay. Players can bring this up from LoadOrJoinMenu, PauseMenu and InGameInfoMenu
|
// // 4J Stu - Don't do this here as it can be very disruptive to gameplay. Players can bring this up from LoadOrJoinMenu, PauseMenu and InGameInfoMenu
|
||||||
// //sceNpBasicRecvMessageCustom(SCE_NP_BASIC_MESSAGE_MAIN_TYPE_INVITE, SCE_NP_BASIC_RECV_MESSAGE_OPTIONS_INCLUDE_BOOTABLE, SYS_MEMORY_CONTAINER_ID_INVALID);
|
// //sceNpBasicRecvMessageCustom(SCE_NP_BASIC_MESSAGE_MAIN_TYPE_INVITE, SCE_NP_BASIC_RECV_MESSAGE_OPTIONS_INCLUDE_BOOTABLE, SYS_MEMORY_CONTAINER_ID_INVALID);
|
||||||
// }
|
// }
|
||||||
// if( iEvent == SCE_NP_BASIC_EVENT_RECV_INVITATION_RESULT )
|
// if( iEvent == SCE_NP_BASIC_EVENT_RECV_INVITATION_RESULT )
|
||||||
// {
|
// {
|
||||||
|
|
@ -835,12 +835,12 @@ int SQRNetworkManager_Orbis::GetFriendsThreadProc( void* lpParameter )
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (friendList.hasResult())
|
if (friendList.hasResult())
|
||||||
{
|
{
|
||||||
sce::Toolkit::NP::FriendsList::const_iterator iter ;
|
sce::Toolkit::NP::FriendsList::const_iterator iter ;
|
||||||
int i = 1 ;
|
int i = 1 ;
|
||||||
bool noFriends = true;
|
bool noFriends = true;
|
||||||
for (iter = friendList.get()->begin(); iter != friendList.get()->end() ; ++iter,i++)
|
for (iter = friendList.get()->begin(); iter != friendList.get()->end() ; ++iter,i++)
|
||||||
{
|
{
|
||||||
manager->m_friendCount++;
|
manager->m_friendCount++;
|
||||||
noFriends = false;
|
noFriends = false;
|
||||||
|
|
@ -848,7 +848,7 @@ int SQRNetworkManager_Orbis::GetFriendsThreadProc( void* lpParameter )
|
||||||
app.DebugPrintf("Online Name: %s\n",iter->npid.handle.data);
|
app.DebugPrintf("Online Name: %s\n",iter->npid.handle.data);
|
||||||
app.DebugPrintf("------------------------\n");
|
app.DebugPrintf("------------------------\n");
|
||||||
|
|
||||||
|
|
||||||
sce::Toolkit::NP::PresenceRequest presenceRequest;
|
sce::Toolkit::NP::PresenceRequest presenceRequest;
|
||||||
sce::Toolkit::NP::Utilities::Future<sce::Toolkit::NP::PresenceInfo> presenceInfo;
|
sce::Toolkit::NP::Utilities::Future<sce::Toolkit::NP::PresenceInfo> presenceInfo;
|
||||||
memset(&presenceRequest,0,sizeof(presenceRequest));
|
memset(&presenceRequest,0,sizeof(presenceRequest));
|
||||||
|
|
@ -858,11 +858,11 @@ int SQRNetworkManager_Orbis::GetFriendsThreadProc( void* lpParameter )
|
||||||
|
|
||||||
|
|
||||||
ret = sce::Toolkit::NP::Presence::Interface::getPresence(&presenceRequest,&presenceInfo,false);
|
ret = sce::Toolkit::NP::Presence::Interface::getPresence(&presenceRequest,&presenceInfo,false);
|
||||||
if( ret < 0 )
|
if( ret < 0 )
|
||||||
{
|
{
|
||||||
app.DebugPrintf("getPresence() error. ret = 0x%x\n", ret);
|
app.DebugPrintf("getPresence() error. ret = 0x%x\n", ret);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
app.DebugPrintf("\nPresence Data Retrieved:\n");
|
app.DebugPrintf("\nPresence Data Retrieved:\n");
|
||||||
app.DebugPrintf("Platform Type: %s\n", presenceInfo.get()->platformType.c_str());
|
app.DebugPrintf("Platform Type: %s\n", presenceInfo.get()->platformType.c_str());
|
||||||
|
|
@ -897,13 +897,13 @@ int SQRNetworkManager_Orbis::GetFriendsThreadProc( void* lpParameter )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (friendList.hasError())
|
else if (friendList.hasError())
|
||||||
{
|
{
|
||||||
app.DebugPrintf( "Error occurred while retrieving FriendsList, ret = 0x%x\n", friendList.getError());
|
app.DebugPrintf( "Error occurred while retrieving FriendsList, ret = 0x%x\n", friendList.getError());
|
||||||
app.DebugPrintf("Check sign-in status\n");
|
app.DebugPrintf("Check sign-in status\n");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -944,7 +944,7 @@ bool SQRNetworkManager_Orbis::IsReadyToPlayOrIdle()
|
||||||
|
|
||||||
|
|
||||||
// Consider as "in session" from the moment that a game is created or joined, until the point where the game itself has been told via state change that we are now idle. The
|
// Consider as "in session" from the moment that a game is created or joined, until the point where the game itself has been told via state change that we are now idle. The
|
||||||
// game code requires IsInSession to return true as soon as it has asked to do one of these things (even if the state system hasn't really caught up with this request yet), and
|
// game code requires IsInSession to return true as soon as it has asked to do one of these things (even if the state system hasn't really caught up with this request yet), and
|
||||||
// it also requires that it is informed of the state changes leading up to not being in the session, before this should report false.
|
// it also requires that it is informed of the state changes leading up to not being in the session, before this should report false.
|
||||||
bool SQRNetworkManager_Orbis::IsInSession()
|
bool SQRNetworkManager_Orbis::IsInSession()
|
||||||
{
|
{
|
||||||
|
|
@ -1119,7 +1119,7 @@ bool SQRNetworkManager_Orbis::JoinRoom(SceNpMatching2RoomId roomId, SceNpMatchin
|
||||||
m_localPlayerJoinMask = localPlayerMask;
|
m_localPlayerJoinMask = localPlayerMask;
|
||||||
m_localPlayerCount = 0;
|
m_localPlayerCount = 0;
|
||||||
m_localPlayerJoined = 0;
|
m_localPlayerJoined = 0;
|
||||||
|
|
||||||
for( int i = 0; i < MAX_LOCAL_PLAYER_COUNT; i++ )
|
for( int i = 0; i < MAX_LOCAL_PLAYER_COUNT; i++ )
|
||||||
{
|
{
|
||||||
if( localPlayerMask & ( 1 << i ) ) m_localPlayerCount++;
|
if( localPlayerMask & ( 1 << i ) ) m_localPlayerCount++;
|
||||||
|
|
@ -1240,7 +1240,7 @@ bool SQRNetworkManager_Orbis::AddLocalPlayerByUserIndex(int idx)
|
||||||
|
|
||||||
// Sync this back out to our networked clients...
|
// Sync this back out to our networked clients...
|
||||||
SyncRoomData();
|
SyncRoomData();
|
||||||
|
|
||||||
UpdateRemotePlay();
|
UpdateRemotePlay();
|
||||||
|
|
||||||
// no connections being made because we're all on the host, so add this player to the existing connections
|
// no connections being made because we're all on the host, so add this player to the existing connections
|
||||||
|
|
@ -1264,7 +1264,7 @@ bool SQRNetworkManager_Orbis::AddLocalPlayerByUserIndex(int idx)
|
||||||
|
|
||||||
memset(&reqParam, 0, sizeof(reqParam));
|
memset(&reqParam, 0, sizeof(reqParam));
|
||||||
memset(&binAttr, 0, sizeof(binAttr));
|
memset(&binAttr, 0, sizeof(binAttr));
|
||||||
|
|
||||||
binAttr.id = SCE_NP_MATCHING2_ROOMMEMBER_BIN_ATTR_INTERNAL_1_ID;
|
binAttr.id = SCE_NP_MATCHING2_ROOMMEMBER_BIN_ATTR_INTERNAL_1_ID;
|
||||||
binAttr.ptr = &m_localPlayerJoinMask;
|
binAttr.ptr = &m_localPlayerJoinMask;
|
||||||
binAttr.size = sizeof(m_localPlayerJoinMask);
|
binAttr.size = sizeof(m_localPlayerJoinMask);
|
||||||
|
|
@ -1357,7 +1357,7 @@ bool SQRNetworkManager_Orbis::RemoveLocalPlayerByUserIndex(int idx)
|
||||||
|
|
||||||
memset(&reqParam, 0, sizeof(reqParam));
|
memset(&reqParam, 0, sizeof(reqParam));
|
||||||
memset(&binAttr, 0, sizeof(binAttr));
|
memset(&binAttr, 0, sizeof(binAttr));
|
||||||
|
|
||||||
binAttr.id = SCE_NP_MATCHING2_ROOMMEMBER_BIN_ATTR_INTERNAL_1_ID;
|
binAttr.id = SCE_NP_MATCHING2_ROOMMEMBER_BIN_ATTR_INTERNAL_1_ID;
|
||||||
binAttr.ptr = &m_localPlayerJoinMask;
|
binAttr.ptr = &m_localPlayerJoinMask;
|
||||||
binAttr.size = sizeof(m_localPlayerJoinMask);
|
binAttr.size = sizeof(m_localPlayerJoinMask);
|
||||||
|
|
@ -1395,7 +1395,7 @@ void SQRNetworkManager_Orbis::UpdateRemotePlay()
|
||||||
|
|
||||||
extern uint8_t *mallocAndCreateUTF8ArrayFromString(int iID);
|
extern uint8_t *mallocAndCreateUTF8ArrayFromString(int iID);
|
||||||
|
|
||||||
// Bring up a Gui to send an invite so a player that the user can select. This invite will contain the room Id so that
|
// Bring up a Gui to send an invite so a player that the user can select. This invite will contain the room Id so that
|
||||||
void SQRNetworkManager_Orbis::SendInviteGUI()
|
void SQRNetworkManager_Orbis::SendInviteGUI()
|
||||||
{
|
{
|
||||||
if(s_bInviteDialogRunning)
|
if(s_bInviteDialogRunning)
|
||||||
|
|
@ -1403,7 +1403,7 @@ void SQRNetworkManager_Orbis::SendInviteGUI()
|
||||||
app.DebugPrintf("SendInviteGUI - Invite dialog is already running so ignoring request\n");
|
app.DebugPrintf("SendInviteGUI - Invite dialog is already running so ignoring request\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
s_bInviteDialogRunning = true;
|
s_bInviteDialogRunning = true;
|
||||||
|
|
||||||
//Set invitation information - this is now exactly the same as the presence information that we synchronise out.
|
//Set invitation information - this is now exactly the same as the presence information that we synchronise out.
|
||||||
|
|
@ -1428,7 +1428,7 @@ void SQRNetworkManager_Orbis::SendInviteGUI()
|
||||||
messData.dialogFlag = SCE_TOOLKIT_NP_DIALOG_TYPE_USER_EDITABLE;
|
messData.dialogFlag = SCE_TOOLKIT_NP_DIALOG_TYPE_USER_EDITABLE;
|
||||||
messData.npIdsCount = 2; // TODO: Set this to the number of available slots
|
messData.npIdsCount = 2; // TODO: Set this to the number of available slots
|
||||||
messData.npIds = NULL;
|
messData.npIds = NULL;
|
||||||
messData.userInfo.userId = userId;
|
messData.userInfo.userId = userId;
|
||||||
|
|
||||||
// Set expire to maximum
|
// Set expire to maximum
|
||||||
messData.expireMinutes = 0;
|
messData.expireMinutes = 0;
|
||||||
|
|
@ -1451,9 +1451,9 @@ void SQRNetworkManager_Orbis::SendInviteGUI()
|
||||||
// int ret = sce::Toolkit::NP::Messaging::Interface::sendMessage(&messData, SCE_TOOLKIT_NP_MESSAGE_TYPE_INVITE);
|
// int ret = sce::Toolkit::NP::Messaging::Interface::sendMessage(&messData, SCE_TOOLKIT_NP_MESSAGE_TYPE_INVITE);
|
||||||
|
|
||||||
free(subject);
|
free(subject);
|
||||||
free(body);
|
free(body);
|
||||||
|
|
||||||
if(ret < SCE_TOOLKIT_NP_SUCCESS )
|
if(ret < SCE_TOOLKIT_NP_SUCCESS )
|
||||||
{
|
{
|
||||||
s_bInviteDialogRunning = false;
|
s_bInviteDialogRunning = false;
|
||||||
app.DebugPrintf("Send Message failed 0x%x ...\n",ret);
|
app.DebugPrintf("Send Message failed 0x%x ...\n",ret);
|
||||||
|
|
@ -1513,7 +1513,7 @@ void SQRNetworkManager_Orbis::TickInviteGUI()
|
||||||
int32_t ret = sceGameCustomDataDialogGetResult( &dialogResult );
|
int32_t ret = sceGameCustomDataDialogGetResult( &dialogResult );
|
||||||
|
|
||||||
if( SCE_OK != ret )
|
if( SCE_OK != ret )
|
||||||
{
|
{
|
||||||
app.DebugPrintf( "***** sceGameCustomDataDialogGetResult error:0x%x\n", ret);
|
app.DebugPrintf( "***** sceGameCustomDataDialogGetResult error:0x%x\n", ret);
|
||||||
}
|
}
|
||||||
sceGameCustomDataDialogClose();
|
sceGameCustomDataDialogClose();
|
||||||
|
|
@ -1536,7 +1536,7 @@ void SQRNetworkManager_Orbis::GetInviteDataAndProcess(sce::Toolkit::NP::MessageA
|
||||||
}
|
}
|
||||||
// InvitationInfoRequest requestInfo;
|
// InvitationInfoRequest requestInfo;
|
||||||
// sce::Toolkit::NP::Utilities::Future< NpSessionInvitationInfo > inviteInfo;
|
// sce::Toolkit::NP::Utilities::Future< NpSessionInvitationInfo > inviteInfo;
|
||||||
//
|
//
|
||||||
// requestInfo.invitationId = pInvite->invitationId;
|
// requestInfo.invitationId = pInvite->invitationId;
|
||||||
// requestInfo.userInfo.npId = pInvite->onlineId;
|
// requestInfo.userInfo.npId = pInvite->onlineId;
|
||||||
// int err = sce::Toolkit::NP::Sessions::Interface::getInvitationInfo(&requestInfo, &inviteInfo, false);
|
// int err = sce::Toolkit::NP::Sessions::Interface::getInvitationInfo(&requestInfo, &inviteInfo, false);
|
||||||
|
|
@ -1555,21 +1555,21 @@ void SQRNetworkManager_Orbis::GetInviteDataAndProcess(sce::Toolkit::NP::MessageA
|
||||||
// {
|
// {
|
||||||
// app.DebugPrintf("getInvitationInfo error 0x%08x", err);
|
// app.DebugPrintf("getInvitationInfo error 0x%08x", err);
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
// INVITE_INFO *invite = &m_inviteReceived[m_inviteIndex];
|
// INVITE_INFO *invite = &m_inviteReceived[m_inviteIndex];
|
||||||
// m_inviteIndex = ( m_inviteIndex + 1 ) % MAX_SIMULTANEOUS_INVITES;
|
// m_inviteIndex = ( m_inviteIndex + 1 ) % MAX_SIMULTANEOUS_INVITES;
|
||||||
// size_t dataSize = sizeof(INVITE_INFO);
|
// size_t dataSize = sizeof(INVITE_INFO);
|
||||||
// int ret = sceNpBasicRecvMessageAttachmentLoad(id, invite, &dataSize);
|
// int ret = sceNpBasicRecvMessageAttachmentLoad(id, invite, &dataSize);
|
||||||
//
|
//
|
||||||
// // If we fail ( which we might do if we aren't online at this point) then zero the invite information and we'll try and get it later after (possibly) signing in
|
// // If we fail ( which we might do if we aren't online at this point) then zero the invite information and we'll try and get it later after (possibly) signing in
|
||||||
// if( ret != 0 )
|
// if( ret != 0 )
|
||||||
// {
|
// {
|
||||||
// memset(invite, 0, sizeof( INVITE_INFO ) );
|
// memset(invite, 0, sizeof( INVITE_INFO ) );
|
||||||
// s_lastInviteIdToRetry = id;
|
// s_lastInviteIdToRetry = id;
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// m_gameBootInvite = invite;
|
// m_gameBootInvite = invite;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1588,8 +1588,8 @@ void SQRNetworkManager_Orbis::GetInviteDataAndProcess(sce::Toolkit::NP::MessageA
|
||||||
// and there's a period when starting up the host game where it doesn't accurately know the memberId for its own local players
|
// and there's a period when starting up the host game where it doesn't accurately know the memberId for its own local players
|
||||||
void SQRNetworkManager_Orbis::FindOrCreateNonNetworkPlayer(int slot, int playerType, SceNpMatching2RoomMemberId memberId, int localPlayerIdx, int smallId)
|
void SQRNetworkManager_Orbis::FindOrCreateNonNetworkPlayer(int slot, int playerType, SceNpMatching2RoomMemberId memberId, int localPlayerIdx, int smallId)
|
||||||
{
|
{
|
||||||
for(AUTO_VAR(it, m_vecTempPlayers.begin()); it != m_vecTempPlayers.end(); it++ )
|
for (auto it = m_vecTempPlayers.begin(); it != m_vecTempPlayers.end(); it++)
|
||||||
{
|
{
|
||||||
if( ((*it)->m_type == playerType ) && ( (*it)->m_localPlayerIdx == localPlayerIdx ) )
|
if( ((*it)->m_type == playerType ) && ( (*it)->m_localPlayerIdx == localPlayerIdx ) )
|
||||||
{
|
{
|
||||||
if( ( playerType != SQRNetworkPlayer::SNP_TYPE_REMOTE ) || ( (*it)->m_roomMemberId == memberId ) )
|
if( ( playerType != SQRNetworkPlayer::SNP_TYPE_REMOTE ) || ( (*it)->m_roomMemberId == memberId ) )
|
||||||
|
|
@ -1647,7 +1647,7 @@ void SQRNetworkManager_Orbis::MapRoomSlotPlayers(int roomSlotPlayerCount/*=-1*/)
|
||||||
{
|
{
|
||||||
EnterCriticalSection(&m_csRoomSyncData);
|
EnterCriticalSection(&m_csRoomSyncData);
|
||||||
|
|
||||||
// If we pass an explicit roomSlotPlayerCount, it is because we are removing a player, and this is the count of slots that there were *before* the removal.
|
// If we pass an explicit roomSlotPlayerCount, it is because we are removing a player, and this is the count of slots that there were *before* the removal.
|
||||||
bool zeroLastSlot = false;
|
bool zeroLastSlot = false;
|
||||||
if( roomSlotPlayerCount == -1 )
|
if( roomSlotPlayerCount == -1 )
|
||||||
{
|
{
|
||||||
|
|
@ -1751,7 +1751,7 @@ void SQRNetworkManager_Orbis::MapRoomSlotPlayers(int roomSlotPlayerCount/*=-1*/)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FindOrCreateNonNetworkPlayer( i, SQRNetworkPlayer::SNP_TYPE_REMOTE, m_roomSyncData.players[i].m_roomMemberId, m_roomSyncData.players[i].m_localIdx, m_roomSyncData.players[i].m_smallId);
|
FindOrCreateNonNetworkPlayer( i, SQRNetworkPlayer::SNP_TYPE_REMOTE, m_roomSyncData.players[i].m_roomMemberId, m_roomSyncData.players[i].m_localIdx, m_roomSyncData.players[i].m_smallId);
|
||||||
m_aRoomSlotPlayers[i]->SetUID(m_roomSyncData.players[i].m_UID); // On client, UIDs flow from m_roomSyncData->player data
|
m_aRoomSlotPlayers[i]->SetUID(m_roomSyncData.players[i].m_UID); // On client, UIDs flow from m_roomSyncData->player data
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1759,8 +1759,8 @@ void SQRNetworkManager_Orbis::MapRoomSlotPlayers(int roomSlotPlayerCount/*=-1*/)
|
||||||
}
|
}
|
||||||
// Clear up any non-network players that are no longer required - this would be a good point to notify of players leaving when we support that
|
// Clear up any non-network players that are no longer required - this would be a good point to notify of players leaving when we support that
|
||||||
// FindOrCreateNonNetworkPlayer will have pulled any players that we Do need out of m_vecTempPlayers, so the ones that are remaining are no longer in the game
|
// FindOrCreateNonNetworkPlayer will have pulled any players that we Do need out of m_vecTempPlayers, so the ones that are remaining are no longer in the game
|
||||||
for(AUTO_VAR(it, m_vecTempPlayers.begin()); it != m_vecTempPlayers.end(); it++ )
|
for (auto it = m_vecTempPlayers.begin(); it != m_vecTempPlayers.end(); it++)
|
||||||
{
|
{
|
||||||
if( m_listener )
|
if( m_listener )
|
||||||
{
|
{
|
||||||
m_listener->HandlePlayerLeaving(*it);
|
m_listener->HandlePlayerLeaving(*it);
|
||||||
|
|
@ -1844,7 +1844,7 @@ bool SQRNetworkManager_Orbis::AddRemotePlayersAndSync( SceNpMatching2RoomMemberI
|
||||||
}
|
}
|
||||||
|
|
||||||
// We want to keep all players from a particular machine together, so search through the room sync data to see if we can find
|
// We want to keep all players from a particular machine together, so search through the room sync data to see if we can find
|
||||||
// any pre-existing players from this machine.
|
// any pre-existing players from this machine.
|
||||||
int firstIdx = -1;
|
int firstIdx = -1;
|
||||||
for( int i = 0; i < m_roomSyncData.getPlayerCount(); i++ )
|
for( int i = 0; i < m_roomSyncData.getPlayerCount(); i++ )
|
||||||
{
|
{
|
||||||
|
|
@ -1950,7 +1950,7 @@ void SQRNetworkManager_Orbis::RemoveRemotePlayersAndSync( SceNpMatching2RoomMemb
|
||||||
|
|
||||||
// Update mapping from the room slot players to SQRNetworkPlayer instances
|
// Update mapping from the room slot players to SQRNetworkPlayer instances
|
||||||
MapRoomSlotPlayers();
|
MapRoomSlotPlayers();
|
||||||
|
|
||||||
|
|
||||||
// And then synchronise this out to all other machines
|
// And then synchronise this out to all other machines
|
||||||
SyncRoomData();
|
SyncRoomData();
|
||||||
|
|
@ -1964,8 +1964,8 @@ void SQRNetworkManager_Orbis::RemoveNetworkPlayers( int mask )
|
||||||
{
|
{
|
||||||
assert( !m_isHosting );
|
assert( !m_isHosting );
|
||||||
|
|
||||||
for(AUTO_VAR(it, m_RudpCtxToPlayerMap.begin()); it != m_RudpCtxToPlayerMap.end(); )
|
for (auto it = m_RudpCtxToPlayerMap.begin(); it != m_RudpCtxToPlayerMap.end();)
|
||||||
{
|
{
|
||||||
SQRNetworkPlayer *player = it->second;
|
SQRNetworkPlayer *player = it->second;
|
||||||
if( (player->m_roomMemberId == m_localMemberId ) && ( ( 1 << player->m_localPlayerIdx ) & mask ) )
|
if( (player->m_roomMemberId == m_localMemberId ) && ( ( 1 << player->m_localPlayerIdx ) & mask ) )
|
||||||
{
|
{
|
||||||
|
|
@ -1993,7 +1993,7 @@ void SQRNetworkManager_Orbis::RemoveNetworkPlayers( int mask )
|
||||||
removePlayerFromVoiceChat(player);
|
removePlayerFromVoiceChat(player);
|
||||||
|
|
||||||
// Delete the player itself and the mapping from context to player map as this context is no longer valid
|
// Delete the player itself and the mapping from context to player map as this context is no longer valid
|
||||||
delete player;
|
delete player;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -2107,7 +2107,7 @@ bool SQRNetworkManager_Orbis::GetMatchingContext(eSQRNetworkManagerInternalState
|
||||||
|
|
||||||
// Starts the process of obtaining a server context. This is an asynchronous operation, at the end of which (if successful), we'll be creating
|
// Starts the process of obtaining a server context. This is an asynchronous operation, at the end of which (if successful), we'll be creating
|
||||||
// a room. General procedure followed here is as suggested by Sony - we get a list of servers, then pick a random one, and see if it is available.
|
// a room. General procedure followed here is as suggested by Sony - we get a list of servers, then pick a random one, and see if it is available.
|
||||||
// If not we just cycle round trying other random ones until we either find an available one or fail.
|
// If not we just cycle round trying other random ones until we either find an available one or fail.
|
||||||
bool SQRNetworkManager_Orbis::GetServerContext()
|
bool SQRNetworkManager_Orbis::GetServerContext()
|
||||||
{
|
{
|
||||||
assert(m_state == SNM_INT_STATE_IDLE);
|
assert(m_state == SNM_INT_STATE_IDLE);
|
||||||
|
|
@ -2165,7 +2165,7 @@ bool SQRNetworkManager_Orbis::GetServerContext(SceNpMatching2ServerId serverId)
|
||||||
// ( serverCount == SCE_NP_MATCHING2_ERROR_CONTEXT_NOT_STARTED ) ) // Also checking for this as a means of simulating the previous error
|
// ( serverCount == SCE_NP_MATCHING2_ERROR_CONTEXT_NOT_STARTED ) ) // Also checking for this as a means of simulating the previous error
|
||||||
// {
|
// {
|
||||||
// sceNpMatching2DestroyContext(m_matchingContext);
|
// sceNpMatching2DestroyContext(m_matchingContext);
|
||||||
// m_matchingContextValid = false;
|
// m_matchingContextValid = false;
|
||||||
// if( !GetMatchingContext(SNM_INT_STATE_JOINING_STARTING_MATCHING_CONTEXT) ) return false;
|
// if( !GetMatchingContext(SNM_INT_STATE_JOINING_STARTING_MATCHING_CONTEXT) ) return false;
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
@ -2298,7 +2298,7 @@ void SQRNetworkManager_Orbis::NetworkPlayerConnectionComplete(SQRNetworkPlayer *
|
||||||
|
|
||||||
if( ( !wasReady ) && ( isReady ) )
|
if( ( !wasReady ) && ( isReady ) )
|
||||||
{
|
{
|
||||||
HandlePlayerJoined( player );
|
HandlePlayerJoined( player );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2327,7 +2327,7 @@ void SQRNetworkManager_Orbis::NetworkPlayerSmallIdAllocated(SQRNetworkPlayer *pl
|
||||||
|
|
||||||
if( ( !wasReady ) && ( isReady ) )
|
if( ( !wasReady ) && ( isReady ) )
|
||||||
{
|
{
|
||||||
HandlePlayerJoined( player );
|
HandlePlayerJoined( player );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2345,7 +2345,7 @@ void SQRNetworkManager_Orbis::NetworkPlayerInitialDataReceived(SQRNetworkPlayer
|
||||||
|
|
||||||
if( ( !wasReady ) && ( isReady ) )
|
if( ( !wasReady ) && ( isReady ) )
|
||||||
{
|
{
|
||||||
HandlePlayerJoined( player );
|
HandlePlayerJoined( player );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2361,7 +2361,7 @@ void SQRNetworkManager_Orbis::HandlePlayerJoined(SQRNetworkPlayer *player)
|
||||||
{
|
{
|
||||||
if( m_listener )
|
if( m_listener )
|
||||||
{
|
{
|
||||||
m_listener->HandlePlayerJoined( player );
|
m_listener->HandlePlayerJoined( player );
|
||||||
}
|
}
|
||||||
app.DebugPrintf(sc_verbose, ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> HandlePlayerJoined\n");
|
app.DebugPrintf(sc_verbose, ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> HandlePlayerJoined\n");
|
||||||
|
|
||||||
|
|
@ -2425,7 +2425,7 @@ std::string getIPAddressString(SceNetInAddr add)
|
||||||
{
|
{
|
||||||
char str[32];
|
char str[32];
|
||||||
unsigned char *vals = (unsigned char*)&add.s_addr;
|
unsigned char *vals = (unsigned char*)&add.s_addr;
|
||||||
sprintf(str, "%d.%d.%d.%d", (int)vals[0], (int)vals[1], (int)vals[2], (int)vals[3]);
|
sprintf(str, "%d.%d.%d.%d", (int)vals[0], (int)vals[1], (int)vals[2], (int)vals[3]);
|
||||||
return std::string(str);
|
return std::string(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2495,7 +2495,7 @@ bool SQRNetworkManager_Orbis::CreateVoiceRudpConnections(SceNpMatching2RoomId ro
|
||||||
SQRVoiceConnection* pConnection = SonyVoiceChat_Orbis::getVoiceConnectionFromRoomMemberID(peerMemberId);
|
SQRVoiceConnection* pConnection = SonyVoiceChat_Orbis::getVoiceConnectionFromRoomMemberID(peerMemberId);
|
||||||
if(pConnection == NULL)
|
if(pConnection == NULL)
|
||||||
{
|
{
|
||||||
|
|
||||||
// Create an Rudp context for the voice connection, this will happen regardless of whether the peer is client or host
|
// Create an Rudp context for the voice connection, this will happen regardless of whether the peer is client or host
|
||||||
int rudpCtx;
|
int rudpCtx;
|
||||||
ret = sceRudpCreateContext( RudpContextCallback, this, &rudpCtx );
|
ret = sceRudpCreateContext( RudpContextCallback, this, &rudpCtx );
|
||||||
|
|
@ -2510,7 +2510,7 @@ bool SQRNetworkManager_Orbis::CreateVoiceRudpConnections(SceNpMatching2RoomId ro
|
||||||
g_numRUDPContextsBound++;
|
g_numRUDPContextsBound++;
|
||||||
app.DebugPrintf(sc_verbose, "-----------------::::::::::::: sceRudpBind\n" );
|
app.DebugPrintf(sc_verbose, "-----------------::::::::::::: sceRudpBind\n" );
|
||||||
|
|
||||||
ret = sceRudpInitiate( rudpCtx, (SceNetSockaddr*)&sinp2pPeer, sizeof(sinp2pPeer), 0);
|
ret = sceRudpInitiate( rudpCtx, (SceNetSockaddr*)&sinp2pPeer, sizeof(sinp2pPeer), 0);
|
||||||
if(ret < 0){ app.DebugPrintf("sceRudpInitiate %s failed : 0x%08x\n", getIPAddressString(sinp2pPeer.sin_addr).c_str(), ret); assert(0); }
|
if(ret < 0){ app.DebugPrintf("sceRudpInitiate %s failed : 0x%08x\n", getIPAddressString(sinp2pPeer.sin_addr).c_str(), ret); assert(0); }
|
||||||
if ( ( ret < 0 ) || ForceErrorPoint(SNM_FORCE_ERROR_RUDP_INIT2) ) return false;
|
if ( ( ret < 0 ) || ForceErrorPoint(SNM_FORCE_ERROR_RUDP_INIT2) ) return false;
|
||||||
app.DebugPrintf(sc_verbose, "-----------------::::::::::::: sceRudpInitiate\n" );
|
app.DebugPrintf(sc_verbose, "-----------------::::::::::::: sceRudpInitiate\n" );
|
||||||
|
|
@ -2521,7 +2521,7 @@ bool SQRNetworkManager_Orbis::CreateVoiceRudpConnections(SceNpMatching2RoomId ro
|
||||||
|
|
||||||
pConnection = SonyVoiceChat_Orbis::addRemoteConnection(rudpCtx, peerMemberId);
|
pConnection = SonyVoiceChat_Orbis::addRemoteConnection(rudpCtx, peerMemberId);
|
||||||
}
|
}
|
||||||
|
|
||||||
for( int i = 0; i < MAX_LOCAL_PLAYER_COUNT; i++ )
|
for( int i = 0; i < MAX_LOCAL_PLAYER_COUNT; i++ )
|
||||||
{
|
{
|
||||||
bool bMaskVal = ( playerMask & ( 1 << i ) );
|
bool bMaskVal = ( playerMask & ( 1 << i ) );
|
||||||
|
|
@ -2544,11 +2544,11 @@ bool SQRNetworkManager_Orbis::CreateRudpConnections(SceNpMatching2RoomId roomId,
|
||||||
memset(&sinp2pPeer, 0, sizeof(sinp2pPeer));
|
memset(&sinp2pPeer, 0, sizeof(sinp2pPeer));
|
||||||
sinp2pPeer.sin_len = sizeof(sinp2pPeer);
|
sinp2pPeer.sin_len = sizeof(sinp2pPeer);
|
||||||
sinp2pPeer.sin_family = AF_INET;
|
sinp2pPeer.sin_family = AF_INET;
|
||||||
|
|
||||||
int ret = sceNpMatching2SignalingGetConnectionStatus(m_matchingContext, roomId, peerMemberId, &connStatus, &sinp2pPeer.sin_addr, &sinp2pPeer.sin_port);
|
int ret = sceNpMatching2SignalingGetConnectionStatus(m_matchingContext, roomId, peerMemberId, &connStatus, &sinp2pPeer.sin_addr, &sinp2pPeer.sin_port);
|
||||||
app.DebugPrintf(CMinecraftApp::USER_RR,"sceNpMatching2SignalingGetConnectionStatus returned 0x%x, connStatus %d peer add:%s peer port:0x%x\n",ret, connStatus,getIPAddressString(sinp2pPeer.sin_addr).c_str(),sinp2pPeer.sin_port);
|
app.DebugPrintf(CMinecraftApp::USER_RR,"sceNpMatching2SignalingGetConnectionStatus returned 0x%x, connStatus %d peer add:%s peer port:0x%x\n",ret, connStatus,getIPAddressString(sinp2pPeer.sin_addr).c_str(),sinp2pPeer.sin_port);
|
||||||
|
|
||||||
// Set vport
|
// Set vport
|
||||||
sinp2pPeer.sin_vport = sceNetHtons(1);
|
sinp2pPeer.sin_vport = sceNetHtons(1);
|
||||||
|
|
||||||
// Create socket & bind, if we don't already have one
|
// Create socket & bind, if we don't already have one
|
||||||
|
|
@ -2606,8 +2606,8 @@ bool SQRNetworkManager_Orbis::CreateRudpConnections(SceNpMatching2RoomId roomId,
|
||||||
|
|
||||||
SQRNetworkPlayer *SQRNetworkManager_Orbis::GetPlayerFromRudpCtx(int rudpCtx)
|
SQRNetworkPlayer *SQRNetworkManager_Orbis::GetPlayerFromRudpCtx(int rudpCtx)
|
||||||
{
|
{
|
||||||
AUTO_VAR(it,m_RudpCtxToPlayerMap.find(rudpCtx));
|
auto it = m_RudpCtxToPlayerMap.find(rudpCtx);
|
||||||
if( it != m_RudpCtxToPlayerMap.end() )
|
if( it != m_RudpCtxToPlayerMap.end() )
|
||||||
{
|
{
|
||||||
return it->second;
|
return it->second;
|
||||||
}
|
}
|
||||||
|
|
@ -2618,8 +2618,8 @@ SQRNetworkPlayer *SQRNetworkManager_Orbis::GetPlayerFromRudpCtx(int rudpCtx)
|
||||||
|
|
||||||
SQRNetworkPlayer *SQRNetworkManager_Orbis::GetPlayerFromRoomMemberAndLocalIdx(int roomMember, int localIdx)
|
SQRNetworkPlayer *SQRNetworkManager_Orbis::GetPlayerFromRoomMemberAndLocalIdx(int roomMember, int localIdx)
|
||||||
{
|
{
|
||||||
for(AUTO_VAR(it, m_RudpCtxToPlayerMap.begin()); it != m_RudpCtxToPlayerMap.end(); it++ )
|
for (auto it = m_RudpCtxToPlayerMap.begin(); it != m_RudpCtxToPlayerMap.end(); it++)
|
||||||
{
|
{
|
||||||
if( (it->second->m_roomMemberId == roomMember ) && ( it->second->m_localPlayerIdx == localIdx ) )
|
if( (it->second->m_roomMemberId == roomMember ) && ( it->second->m_localPlayerIdx == localIdx ) )
|
||||||
{
|
{
|
||||||
return it->second;
|
return it->second;
|
||||||
|
|
@ -2706,7 +2706,7 @@ void SQRNetworkManager_Orbis::ContextCallback(SceNpMatching2ContextId id, SceNp
|
||||||
manager->m_state == SNM_INT_STATE_HOSTING_STARTING_MATCHING_CONTEXT ||
|
manager->m_state == SNM_INT_STATE_HOSTING_STARTING_MATCHING_CONTEXT ||
|
||||||
manager->m_state == SNM_INT_STATE_JOINING_STARTING_MATCHING_CONTEXT)
|
manager->m_state == SNM_INT_STATE_JOINING_STARTING_MATCHING_CONTEXT)
|
||||||
{
|
{
|
||||||
// matching context failed to start (this can happen when you block the IP addresses of the matching servers on your router
|
// matching context failed to start (this can happen when you block the IP addresses of the matching servers on your router
|
||||||
// agent-0101.ww.sp-int.matching.playstation.net (198.107.157.191)
|
// agent-0101.ww.sp-int.matching.playstation.net (198.107.157.191)
|
||||||
// static-resource.sp-int.community.playstation.net (203.105.77.140)
|
// static-resource.sp-int.community.playstation.net (203.105.77.140)
|
||||||
app.DebugPrintf("SQRNetworkManager_Orbis::ContextCallback - Error\n");
|
app.DebugPrintf("SQRNetworkManager_Orbis::ContextCallback - Error\n");
|
||||||
|
|
@ -2771,7 +2771,7 @@ void SQRNetworkManager_Orbis::ContextCallback(SceNpMatching2ContextId id, SceNp
|
||||||
// unsigned int type, attributes;
|
// unsigned int type, attributes;
|
||||||
// CellGameContentSize gameSize;`
|
// CellGameContentSize gameSize;`
|
||||||
// char dirName[CELL_GAME_DIRNAME_SIZE];
|
// char dirName[CELL_GAME_DIRNAME_SIZE];
|
||||||
//
|
//
|
||||||
// if( g_bBootedFromInvite )
|
// if( g_bBootedFromInvite )
|
||||||
// {
|
// {
|
||||||
// manager->GetInviteDataAndProcess(SCE_NP_BASIC_SELECTED_INVITATION_DATA);
|
// manager->GetInviteDataAndProcess(SCE_NP_BASIC_SELECTED_INVITATION_DATA);
|
||||||
|
|
@ -2789,7 +2789,7 @@ void SQRNetworkManager_Orbis::ContextCallback(SceNpMatching2ContextId id, SceNp
|
||||||
assert(false);
|
assert(false);
|
||||||
break;
|
break;
|
||||||
case SCE_NP_MATCHING2_CONTEXT_EVENT_START_OVER:
|
case SCE_NP_MATCHING2_CONTEXT_EVENT_START_OVER:
|
||||||
|
|
||||||
app.DebugPrintf("SCE_NP_MATCHING2_CONTEXT_EVENT_START_OVER\n");
|
app.DebugPrintf("SCE_NP_MATCHING2_CONTEXT_EVENT_START_OVER\n");
|
||||||
app.DebugPrintf("eventCause=%u, errorCode=0x%08x\n", eventCause, errorCode);
|
app.DebugPrintf("eventCause=%u, errorCode=0x%08x\n", eventCause, errorCode);
|
||||||
|
|
||||||
|
|
@ -2950,7 +2950,7 @@ void SQRNetworkManager_Orbis::DefaultRequestCallback(SceNpMatching2ContextId id,
|
||||||
if( success1 )
|
if( success1 )
|
||||||
{
|
{
|
||||||
success2 = manager->CreateRudpConnections(manager->m_room, pRoomMemberData->roomMemberDataInternal->memberId, playerMask, pRoomMemberData->roomMemberDataInternal->memberId);
|
success2 = manager->CreateRudpConnections(manager->m_room, pRoomMemberData->roomMemberDataInternal->memberId, playerMask, pRoomMemberData->roomMemberDataInternal->memberId);
|
||||||
if( success2 )
|
if( success2 )
|
||||||
{
|
{
|
||||||
bool ret = manager->CreateVoiceRudpConnections( manager->m_room, pRoomMemberData->roomMemberDataInternal->memberId, 0);
|
bool ret = manager->CreateVoiceRudpConnections( manager->m_room, pRoomMemberData->roomMemberDataInternal->memberId, 0);
|
||||||
assert(ret == true);
|
assert(ret == true);
|
||||||
|
|
@ -3055,7 +3055,7 @@ void SQRNetworkManager_Orbis::DefaultRequestCallback(SceNpMatching2ContextId id,
|
||||||
void SQRNetworkManager_Orbis::RoomEventCallback(SceNpMatching2ContextId id, SceNpMatching2RoomId roomId, SceNpMatching2Event event, const void *data, void *arg)
|
void SQRNetworkManager_Orbis::RoomEventCallback(SceNpMatching2ContextId id, SceNpMatching2RoomId roomId, SceNpMatching2Event event, const void *data, void *arg)
|
||||||
{
|
{
|
||||||
SQRNetworkManager_Orbis *manager = (SQRNetworkManager_Orbis *)arg;
|
SQRNetworkManager_Orbis *manager = (SQRNetworkManager_Orbis *)arg;
|
||||||
|
|
||||||
bool gotEventData = false;
|
bool gotEventData = false;
|
||||||
switch( event )
|
switch( event )
|
||||||
{
|
{
|
||||||
|
|
@ -3186,7 +3186,7 @@ void SQRNetworkManager_Orbis::RoomEventCallback(SceNpMatching2ContextId id, SceN
|
||||||
int oldMask = manager->GetOldMask( pRoomMemberData->newRoomMemberDataInternal->memberId );
|
int oldMask = manager->GetOldMask( pRoomMemberData->newRoomMemberDataInternal->memberId );
|
||||||
int addedMask = manager->GetAddedMask(playerMask, oldMask );
|
int addedMask = manager->GetAddedMask(playerMask, oldMask );
|
||||||
int removedMask = manager->GetRemovedMask(playerMask, oldMask );
|
int removedMask = manager->GetRemovedMask(playerMask, oldMask );
|
||||||
|
|
||||||
if( addedMask != 0 )
|
if( addedMask != 0 )
|
||||||
{
|
{
|
||||||
bool success = manager->AddRemotePlayersAndSync( pRoomMemberData->newRoomMemberDataInternal->memberId, addedMask );
|
bool success = manager->AddRemotePlayersAndSync( pRoomMemberData->newRoomMemberDataInternal->memberId, addedMask );
|
||||||
|
|
@ -3203,7 +3203,7 @@ void SQRNetworkManager_Orbis::RoomEventCallback(SceNpMatching2ContextId id, SceN
|
||||||
|
|
||||||
memset(&reqParam, 0, sizeof(reqParam));
|
memset(&reqParam, 0, sizeof(reqParam));
|
||||||
memset(&binAttr, 0, sizeof(binAttr));
|
memset(&binAttr, 0, sizeof(binAttr));
|
||||||
|
|
||||||
binAttr.id = SCE_NP_MATCHING2_ROOMMEMBER_BIN_ATTR_INTERNAL_1_ID;
|
binAttr.id = SCE_NP_MATCHING2_ROOMMEMBER_BIN_ATTR_INTERNAL_1_ID;
|
||||||
binAttr.ptr = &oldMask;
|
binAttr.ptr = &oldMask;
|
||||||
binAttr.size = sizeof(oldMask);
|
binAttr.size = sizeof(oldMask);
|
||||||
|
|
@ -3265,7 +3265,7 @@ void SQRNetworkManager_Orbis::RoomEventCallback(SceNpMatching2ContextId id, SceN
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -3426,7 +3426,7 @@ void SQRNetworkManager_Orbis::SysUtilCallback(uint64_t status, uint64_t param, v
|
||||||
// }
|
// }
|
||||||
// return;
|
// return;
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// if( netstart_result.result != 0 )
|
// if( netstart_result.result != 0 )
|
||||||
// {
|
// {
|
||||||
// // Failed, or user may have decided not to sign in - maybe need to differentiate here
|
// // Failed, or user may have decided not to sign in - maybe need to differentiate here
|
||||||
|
|
@ -3440,7 +3440,7 @@ void SQRNetworkManager_Orbis::SysUtilCallback(uint64_t status, uint64_t param, v
|
||||||
// s_SignInCompleteCallbackFn = NULL;
|
// s_SignInCompleteCallbackFn = NULL;
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// break;
|
// break;
|
||||||
// case CELL_SYSUTIL_NET_CTL_NETSTART_UNLOADED:
|
// case CELL_SYSUTIL_NET_CTL_NETSTART_UNLOADED:
|
||||||
// break;
|
// break;
|
||||||
|
|
@ -3608,7 +3608,7 @@ void SQRNetworkManager_Orbis::NetCtlCallback(int eventType, void *arg)
|
||||||
if( eventType == SCE_NET_CTL_EVENT_TYPE_DISCONNECTED)// CELL_NET_CTL_EVENT_LINK_DISCONNECTED )
|
if( eventType == SCE_NET_CTL_EVENT_TYPE_DISCONNECTED)// CELL_NET_CTL_EVENT_LINK_DISCONNECTED )
|
||||||
{
|
{
|
||||||
manager->m_bLinkDisconnected = true;
|
manager->m_bLinkDisconnected = true;
|
||||||
manager->m_listener->HandleDisconnect(false);
|
manager->m_listener->HandleDisconnect(false);
|
||||||
}
|
}
|
||||||
else //if( event == CELL_NET_CTL_EVENT_ESTABLISH )
|
else //if( event == CELL_NET_CTL_EVENT_ESTABLISH )
|
||||||
{
|
{
|
||||||
|
|
@ -3762,7 +3762,7 @@ void SQRNetworkManager_Orbis::GetExtDataForRoom( SceNpMatching2RoomId roomId, vo
|
||||||
if( ret == SCE_NP_MATCHING2_ERROR_CONTEXT_NOT_STARTED ) // Also checking for this as a means of simulating the previous error
|
if( ret == SCE_NP_MATCHING2_ERROR_CONTEXT_NOT_STARTED ) // Also checking for this as a means of simulating the previous error
|
||||||
{
|
{
|
||||||
sceNpMatching2DestroyContext(m_matchingContext);
|
sceNpMatching2DestroyContext(m_matchingContext);
|
||||||
m_matchingContextValid = false;
|
m_matchingContextValid = false;
|
||||||
if( !GetMatchingContext(SNM_INT_STATE_IDLE_RECREATING_MATCHING_CONTEXT) )
|
if( !GetMatchingContext(SNM_INT_STATE_IDLE_RECREATING_MATCHING_CONTEXT) )
|
||||||
{
|
{
|
||||||
// No matching context, and failed to try and make one. We're really broken here.
|
// No matching context, and failed to try and make one. We're really broken here.
|
||||||
|
|
@ -3789,7 +3789,7 @@ bool SQRNetworkManager_Orbis::ForceErrorPoint(eSQRForceError error)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
bool SQRNetworkManager_Orbis::aForceError[SNM_FORCE_ERROR_COUNT] =
|
bool SQRNetworkManager_Orbis::aForceError[SNM_FORCE_ERROR_COUNT] =
|
||||||
{
|
{
|
||||||
false, // SNM_FORCE_ERROR_NP2_INIT
|
false, // SNM_FORCE_ERROR_NP2_INIT
|
||||||
false, // SNM_FORCE_ERROR_NET_INITIALIZE_NETWORK
|
false, // SNM_FORCE_ERROR_NET_INITIALIZE_NETWORK
|
||||||
|
|
@ -3919,7 +3919,7 @@ void SQRNetworkManager_Orbis::AttemptPSNSignIn(int (*SignInCompleteCallbackFn)(v
|
||||||
ui.RequestMessageBox( IDS_ERROR_NETWORK_TITLE, IDS_ERROR_NETWORK, uiIDA,1,iPad,ErrorPSNDisconnectedDialogReturned,pParam, app.GetStringTable());
|
ui.RequestMessageBox( IDS_ERROR_NETWORK_TITLE, IDS_ERROR_NETWORK, uiIDA,1,iPad,ErrorPSNDisconnectedDialogReturned,pParam, app.GetStringTable());
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int SQRNetworkManager_Orbis::SetRichPresence(const void *data)
|
int SQRNetworkManager_Orbis::SetRichPresence(const void *data)
|
||||||
{
|
{
|
||||||
|
|
@ -3971,13 +3971,13 @@ void SQRNetworkManager_Orbis::SendLastPresenceInfo()
|
||||||
|
|
||||||
// On PS4 we can't set the status and the data at the same time
|
// On PS4 we can't set the status and the data at the same time
|
||||||
unsigned int options = 0;
|
unsigned int options = 0;
|
||||||
if( s_presenceDataDirty )
|
if( s_presenceDataDirty )
|
||||||
{
|
{
|
||||||
// Prioritise data over status as it is critical to discovering the network game
|
// Prioritise data over status as it is critical to discovering the network game
|
||||||
s_lastPresenceInfo.presenceType = SCE_TOOLKIT_NP_PRESENCE_DATA;
|
s_lastPresenceInfo.presenceType = SCE_TOOLKIT_NP_PRESENCE_DATA;
|
||||||
}
|
}
|
||||||
else if( s_presenceStatusDirty )
|
else if( s_presenceStatusDirty )
|
||||||
{
|
{
|
||||||
s_lastPresenceInfo.presenceType = SCE_TOOLKIT_NP_PRESENCE_STATUS;
|
s_lastPresenceInfo.presenceType = SCE_TOOLKIT_NP_PRESENCE_STATUS;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -4065,7 +4065,7 @@ void SQRNetworkManager_Orbis::removePlayerFromVoiceChat( SQRNetworkPlayer* pPlay
|
||||||
{
|
{
|
||||||
if(pPlayer->IsLocal())
|
if(pPlayer->IsLocal())
|
||||||
{
|
{
|
||||||
|
|
||||||
SonyVoiceChat_Orbis::disconnectLocalPlayer(pPlayer->GetLocalPlayerIndex());
|
SonyVoiceChat_Orbis::disconnectLocalPlayer(pPlayer->GetLocalPlayerIndex());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -4097,7 +4097,7 @@ void SQRNetworkManager_Orbis::removePlayerFromVoiceChat( SQRNetworkPlayer* pPlay
|
||||||
void SQRNetworkManager_Orbis::TickNotify()
|
void SQRNetworkManager_Orbis::TickNotify()
|
||||||
{
|
{
|
||||||
if (g_NetworkManager.IsInSession() && !g_NetworkManager.IsLocalGame())
|
if (g_NetworkManager.IsInSession() && !g_NetworkManager.IsLocalGame())
|
||||||
{
|
{
|
||||||
long long currentTime = System::currentTimeMillis();
|
long long currentTime = System::currentTimeMillis();
|
||||||
|
|
||||||
// Note: interval at which to notify Sony of realtime play, according to docs an interval greater than 1 sec is bad
|
// Note: interval at which to notify Sony of realtime play, according to docs an interval greater than 1 sec is bad
|
||||||
|
|
@ -4109,7 +4109,7 @@ void SQRNetworkManager_Orbis::TickNotify()
|
||||||
m_lastNotifyTime = currentTime;
|
m_lastNotifyTime = currentTime;
|
||||||
for(int i = 0; i < XUSER_MAX_COUNT; i++)
|
for(int i = 0; i < XUSER_MAX_COUNT; i++)
|
||||||
{
|
{
|
||||||
if (ProfileManager.IsSignedInLive(i))
|
if (ProfileManager.IsSignedInLive(i))
|
||||||
{
|
{
|
||||||
NotifyRealtimePlusFeature(i);
|
NotifyRealtimePlusFeature(i);
|
||||||
}
|
}
|
||||||
|
|
@ -4143,8 +4143,8 @@ void SQRNetworkManager_Orbis::NotifyRealtimePlusFeature(int iQuadrant)
|
||||||
// {
|
// {
|
||||||
// app.DebugPrintf("============ Calling CallSignInCompleteCallback and s_SignInCompleteCallbackFn is OK\n");
|
// app.DebugPrintf("============ Calling CallSignInCompleteCallback and s_SignInCompleteCallbackFn is OK\n");
|
||||||
// bool isSignedIn = ProfileManager.IsSignedInLive(s_SignInCompleteCallbackPad);
|
// bool isSignedIn = ProfileManager.IsSignedInLive(s_SignInCompleteCallbackPad);
|
||||||
//
|
//
|
||||||
// s_SignInCompleteCallbackFn(s_SignInCompleteParam, isSignedIn, s_SignInCompleteCallbackPad);
|
// s_SignInCompleteCallbackFn(s_SignInCompleteParam, isSignedIn, s_SignInCompleteCallbackPad);
|
||||||
// s_SignInCompleteCallbackFn = NULL;
|
// s_SignInCompleteCallbackFn = NULL;
|
||||||
// s_SignInCompleteCallbackPad = -1;
|
// s_SignInCompleteCallbackPad = -1;
|
||||||
// }
|
// }
|
||||||
|
|
|
||||||
|
|
@ -170,7 +170,3 @@ typedef LPVOID LPSECURITY_ATTRIBUTES;
|
||||||
|
|
||||||
#define __in_ecount(a)
|
#define __in_ecount(a)
|
||||||
#define __in_bcount(a)
|
#define __in_bcount(a)
|
||||||
|
|
||||||
#ifndef AUTO_VAR
|
|
||||||
#define AUTO_VAR(_var, _val) auto _var = _val
|
|
||||||
#endif
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue