shared_ptr -> std::shared_ptr

This is one of the first commits in a plan to remove all `using namespace std;` lines in the entire codebase as it is considered anti-pattern today.
This commit is contained in:
void_17
2026-03-02 15:58:20 +07:00
parent d63f79325f
commit 7074f35e4b
1373 changed files with 12054 additions and 12054 deletions

View File

@@ -52,7 +52,7 @@ 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()); AUTO_VAR(itEnd, menu->slots->end());
for (AUTO_VAR(it, menu->slots->begin()); it != itEnd; it++) for (AUTO_VAR(it, menu->slots->begin()); it != itEnd; it++)
{ {
@@ -75,7 +75,7 @@ void AbstractContainerScreen::render(int xm, int ym, float a)
} }
} }
shared_ptr<Inventory> inventory = minecraft->player->inventory; std::shared_ptr<Inventory> inventory = minecraft->player->inventory;
if (inventory->getCarried() != NULL) if (inventory->getCarried() != NULL)
{ {
glTranslatef(0, 0, 32); glTranslatef(0, 0, 32);
@@ -128,7 +128,7 @@ void AbstractContainerScreen::renderSlot(Slot *slot)
#if 0 #if 0
int x = slot->x; int x = slot->x;
int y = slot->y; int y = slot->y;
shared_ptr<ItemInstance> item = slot->getItem(); std::shared_ptr<ItemInstance> item = slot->getItem();
if (item == NULL) if (item == NULL)
{ {
@@ -218,7 +218,7 @@ void AbstractContainerScreen::removed()
if (minecraft->player == NULL) return; if (minecraft->player == NULL) return;
} }
void AbstractContainerScreen::slotsChanged(shared_ptr<Container> container) void AbstractContainerScreen::slotsChanged(std::shared_ptr<Container> container)
{ {
} }

View File

@@ -32,7 +32,7 @@ protected:
virtual void keyPressed(wchar_t eventCharacter, int eventKey); virtual void keyPressed(wchar_t eventCharacter, int eventKey);
public: public:
virtual void removed(); virtual void removed();
virtual void slotsChanged(shared_ptr<Container> container); virtual void slotsChanged(std::shared_ptr<Container> container);
virtual bool isPauseScreen(); virtual bool isPauseScreen();
virtual void tick(); virtual void tick();
}; };

View File

@@ -3,11 +3,11 @@
#include "..\Minecraft.World\net.minecraft.world.entity.projectile.h" #include "..\Minecraft.World\net.minecraft.world.entity.projectile.h"
#include "..\Minecraft.World\Mth.h" #include "..\Minecraft.World\Mth.h"
void ArrowRenderer::render(shared_ptr<Entity> _arrow, double x, double y, double z, float rot, float a) void ArrowRenderer::render(std::shared_ptr<Entity> _arrow, double x, double y, double z, float rot, float a)
{ {
// 4J - original version used generics and thus had an input parameter of type Arrow rather than shared_ptr<Entity> we have here - // 4J - original version used generics and thus had an input parameter of type Arrow rather than std::shared_ptr<Entity> we have here -
// do some casting around instead // do some casting around instead
shared_ptr<Arrow> arrow = dynamic_pointer_cast<Arrow>(_arrow); std::shared_ptr<Arrow> arrow = dynamic_pointer_cast<Arrow>(_arrow);
bindTexture(TN_ITEM_ARROWS); // 4J - was L"/item/arrows.png" bindTexture(TN_ITEM_ARROWS); // 4J - was L"/item/arrows.png"
glPushMatrix(); glPushMatrix();

View File

@@ -4,5 +4,5 @@
class ArrowRenderer : public EntityRenderer class ArrowRenderer : public EntityRenderer
{ {
public: public:
virtual void render(shared_ptr<Entity> _arrow, double x, double y, double z, float rot, float a); virtual void render(std::shared_ptr<Entity> _arrow, double x, double y, double z, float rot, float a);
}; };

View File

@@ -7,7 +7,7 @@ BlazeModel::BlazeModel() : Model()
{ {
upperBodyParts = ModelPartArray(12); upperBodyParts = ModelPartArray(12);
for (unsigned int i = 0; i < upperBodyParts.length; i++) for (unsigned int i = 0; i < upperBodyParts.length; i++)
{ {
upperBodyParts[i] = new ModelPart(this, 0, 16); upperBodyParts[i] = new ModelPart(this, 0, 16);
upperBodyParts[i]->addBox(0, 0, 0, 2, 8, 2); upperBodyParts[i]->addBox(0, 0, 0, 2, 8, 2);
@@ -18,34 +18,34 @@ BlazeModel::BlazeModel() : Model()
// 4J added - compile now to avoid random performance hit first time cubes are rendered // 4J added - compile now to avoid random performance hit first time cubes are rendered
// 4J Stu - Not just performance, but alpha+depth tests don't work right unless we compile here // 4J Stu - Not just performance, but alpha+depth tests don't work right unless we compile here
for (unsigned int i = 0; i < upperBodyParts.length; i++) for (unsigned int i = 0; i < upperBodyParts.length; i++)
{ {
upperBodyParts[i]->compile(1.0f/16.0f); upperBodyParts[i]->compile(1.0f/16.0f);
} }
head->compile(1.0f/16.0f); head->compile(1.0f/16.0f);
} }
int BlazeModel::modelVersion() int BlazeModel::modelVersion()
{ {
return 8; return 8;
} }
void BlazeModel::render(shared_ptr<Entity> entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) void BlazeModel::render(std::shared_ptr<Entity> entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled)
{ {
setupAnim(time, r, bob, yRot, xRot, scale); setupAnim(time, r, bob, yRot, xRot, scale);
head->render(scale,usecompiled); head->render(scale,usecompiled);
for (unsigned int i = 0; i < upperBodyParts.length; i++) for (unsigned int i = 0; i < upperBodyParts.length; i++)
{ {
upperBodyParts[i]->render(scale, usecompiled); upperBodyParts[i]->render(scale, usecompiled);
} }
} }
void BlazeModel::setupAnim(float time, float r, float bob, float yRot, float xRot, float scale, unsigned int uiBitmaskOverrideAnim) void BlazeModel::setupAnim(float time, float r, float bob, float yRot, float xRot, float scale, unsigned int uiBitmaskOverrideAnim)
{ {
float angle = bob * PI * -.1f; float angle = bob * PI * -.1f;
for (int i = 0; i < 4; i++) for (int i = 0; i < 4; i++)
{ {
upperBodyParts[i]->y = -2 + Mth::cos((i * 2 + bob) * .25f); upperBodyParts[i]->y = -2 + Mth::cos((i * 2 + bob) * .25f);
upperBodyParts[i]->x = Mth::cos(angle) * 9.0f; upperBodyParts[i]->x = Mth::cos(angle) * 9.0f;
@@ -53,7 +53,7 @@ void BlazeModel::setupAnim(float time, float r, float bob, float yRot, float xRo
angle += PI * 0.5f; angle += PI * 0.5f;
} }
angle = .25f * PI + bob * PI * .03f; angle = .25f * PI + bob * PI * .03f;
for (int i = 4; i < 8; i++) for (int i = 4; i < 8; i++)
{ {
upperBodyParts[i]->y = 2 + Mth::cos((i * 2 + bob) * .25f); upperBodyParts[i]->y = 2 + Mth::cos((i * 2 + bob) * .25f);
upperBodyParts[i]->x = Mth::cos(angle) * 7.0f; upperBodyParts[i]->x = Mth::cos(angle) * 7.0f;
@@ -62,7 +62,7 @@ void BlazeModel::setupAnim(float time, float r, float bob, float yRot, float xRo
} }
angle = .15f * PI + bob * PI * -.05f; angle = .15f * PI + bob * PI * -.05f;
for (int i = 8; i < 12; i++) for (int i = 8; i < 12; i++)
{ {
upperBodyParts[i]->y = 11 + Mth::cos((i * 1.5f + bob) * .5f); upperBodyParts[i]->y = 11 + Mth::cos((i * 1.5f + bob) * .5f);
upperBodyParts[i]->x = Mth::cos(angle) * 5.0f; upperBodyParts[i]->x = Mth::cos(angle) * 5.0f;

View File

@@ -1,7 +1,7 @@
#pragma once #pragma once
#include "Model.h" #include "Model.h"
class BlazeModel : public Model class BlazeModel : public Model
{ {
private: private:
@@ -11,6 +11,6 @@ private:
public: public:
BlazeModel(); BlazeModel();
int modelVersion(); int modelVersion();
virtual void render(shared_ptr<Entity> entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled); virtual void render(std::shared_ptr<Entity> entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled);
virtual void setupAnim(float time, float r, float bob, float yRot, float xRot, float scale, unsigned int uiBitmaskOverrideAnim=0); virtual void setupAnim(float time, float r, float bob, float yRot, float xRot, float scale, unsigned int uiBitmaskOverrideAnim=0);
}; };

View File

@@ -8,11 +8,11 @@ BlazeRenderer::BlazeRenderer() : MobRenderer(new BlazeModel(), 0.5f)
this->modelVersion = ((BlazeModel *) model)->modelVersion(); this->modelVersion = ((BlazeModel *) model)->modelVersion();
} }
void BlazeRenderer::render(shared_ptr<Entity> _mob, double x, double y, double z, float rot, float a) void BlazeRenderer::render(std::shared_ptr<Entity> _mob, double x, double y, double z, float rot, float a)
{ {
// 4J - original version used generics and thus had an input parameter of type Blaze rather than shared_ptr<Entity> we have here - // 4J - original version used generics and thus had an input parameter of type Blaze rather than std::shared_ptr<Entity> we have here -
// do some casting around instead // do some casting around instead
shared_ptr<Blaze> mob = dynamic_pointer_cast<Blaze>(_mob); std::shared_ptr<Blaze> mob = dynamic_pointer_cast<Blaze>(_mob);
int modelVersion = ((BlazeModel *) model)->modelVersion(); int modelVersion = ((BlazeModel *) model)->modelVersion();
if (modelVersion != this->modelVersion) if (modelVersion != this->modelVersion)

View File

@@ -10,5 +10,5 @@ private:
public: public:
BlazeRenderer(); BlazeRenderer();
virtual void render(shared_ptr<Entity> mob, double x, double y, double z, float rot, float a); virtual void render(std::shared_ptr<Entity> mob, double x, double y, double z, float rot, float a);
}; };

View File

@@ -16,19 +16,19 @@ BoatModel::BoatModel() : Model()
cubes[0]->addBox((float)(-w / 2), (float)(-h / 2 + 2), -3, w, h - 4, 4, 0); cubes[0]->addBox((float)(-w / 2), (float)(-h / 2 + 2), -3, w, h - 4, 4, 0);
cubes[0]->setPos(0, (float)(0 + yOff), 0); cubes[0]->setPos(0, (float)(0 + yOff), 0);
cubes[1]->addBox((float)(-w / 2 + 2), (float)(-d - 1), -1, w - 4, d, 2, 0); cubes[1]->addBox((float)(-w / 2 + 2), (float)(-d - 1), -1, w - 4, d, 2, 0);
cubes[1]->setPos((float)(-w / 2 + 1), (float)(0 + yOff), 0); cubes[1]->setPos((float)(-w / 2 + 1), (float)(0 + yOff), 0);
cubes[2]->addBox((float)(-w / 2 + 2), (float)(-d - 1), -1, w - 4, d, 2, 0); cubes[2]->addBox((float)(-w / 2 + 2), (float)(-d - 1), -1, w - 4, d, 2, 0);
cubes[2]->setPos((float)(+w / 2 - 1), (float)(0 + yOff), 0); cubes[2]->setPos((float)(+w / 2 - 1), (float)(0 + yOff), 0);
cubes[3]->addBox((float)(-w / 2 + 2), (float)(-d - 1), -1, w - 4, d, 2, 0); cubes[3]->addBox((float)(-w / 2 + 2), (float)(-d - 1), -1, w - 4, d, 2, 0);
cubes[3]->setPos(0, (float)(0 + yOff), (float)(-h / 2 + 1)); cubes[3]->setPos(0, (float)(0 + yOff), (float)(-h / 2 + 1));
cubes[4]->addBox((float)(-w / 2 + 2), (float)(-d - 1), -1, w - 4, d, 2, 0); cubes[4]->addBox((float)(-w / 2 + 2), (float)(-d - 1), -1, w - 4, d, 2, 0);
cubes[4]->setPos(0, (float)(0 + yOff), (float)(+h / 2 - 1)); cubes[4]->setPos(0, (float)(0 + yOff), (float)(+h / 2 - 1));
cubes[0]->xRot = PI / 2; cubes[0]->xRot = PI / 2;
cubes[1]->yRot = PI / 2 * 3; cubes[1]->yRot = PI / 2 * 3;
cubes[2]->yRot = PI / 2 * 1; cubes[2]->yRot = PI / 2 * 1;
@@ -42,7 +42,7 @@ BoatModel::BoatModel() : Model()
cubes[4]->compile(1.0f/16.0f); cubes[4]->compile(1.0f/16.0f);
} }
void BoatModel::render(shared_ptr<Entity> entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) void BoatModel::render(std::shared_ptr<Entity> entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled)
{ {
for (int i = 0; i < 5; i++) for (int i = 0; i < 5; i++)
{ {

View File

@@ -7,5 +7,5 @@ class BoatModel : public Model
public: public:
ModelPart *cubes[5]; ModelPart *cubes[5];
BoatModel(); BoatModel();
virtual void render(shared_ptr<Entity> entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled); virtual void render(std::shared_ptr<Entity> entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled);
}; };

View File

@@ -10,11 +10,11 @@ BoatRenderer::BoatRenderer() : EntityRenderer()
model = new BoatModel(); model = new BoatModel();
} }
void BoatRenderer::render(shared_ptr<Entity> _boat, double x, double y, double z, float rot, float a) void BoatRenderer::render(std::shared_ptr<Entity> _boat, double x, double y, double z, float rot, float a)
{ {
// 4J - original version used generics and thus had an input parameter of type Boat rather than shared_ptr<Entity> we have here - // 4J - original version used generics and thus had an input parameter of type Boat rather than std::shared_ptr<Entity> we have here -
// do some casting around instead // do some casting around instead
shared_ptr<Boat> boat = dynamic_pointer_cast<Boat>(_boat); std::shared_ptr<Boat> boat = dynamic_pointer_cast<Boat>(_boat);
glPushMatrix(); glPushMatrix();

View File

@@ -9,5 +9,5 @@ protected:
public: public:
BoatRenderer(); BoatRenderer();
virtual void render(shared_ptr<Entity> boat, double x, double y, double z, float rot, float a); virtual void render(std::shared_ptr<Entity> boat, double x, double y, double z, float rot, float a);
}; };

View File

@@ -3,7 +3,7 @@
#include "BookModel.h" #include "BookModel.h"
#include "ModelPart.h" #include "ModelPart.h"
BookModel::BookModel() BookModel::BookModel()
{ {
leftLid = (new ModelPart(this))->texOffs(0, 0)->addBox(-6, -5, 0, 6, 10, 0); leftLid = (new ModelPart(this))->texOffs(0, 0)->addBox(-6, -5, 0, 6, 10, 0);
rightLid = (new ModelPart(this))->texOffs(16, 0)->addBox(0, -5, 0, 6, 10, 0); rightLid = (new ModelPart(this))->texOffs(16, 0)->addBox(0, -5, 0, 6, 10, 0);
@@ -33,7 +33,7 @@ BookModel::BookModel()
} }
void BookModel::render(shared_ptr<Entity> entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) void BookModel::render(std::shared_ptr<Entity> entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled)
{ {
setupAnim(time, r, bob, yRot, xRot, scale); setupAnim(time, r, bob, yRot, xRot, scale);

View File

@@ -2,7 +2,7 @@
#pragma once #pragma once
#include "Model.h" #include "Model.h"
class BookModel : public Model class BookModel : public Model
{ {
public: public:
ModelPart *leftLid, *rightLid; ModelPart *leftLid, *rightLid;
@@ -11,6 +11,6 @@ public:
ModelPart *seam; ModelPart *seam;
BookModel(); BookModel();
virtual void render(shared_ptr<Entity> entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled); virtual void render(std::shared_ptr<Entity> entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled);
virtual void setupAnim(float time, float r, float bob, float yRot, float xRot, float scale, unsigned int uiBitmaskOverrideAnim=0); virtual void setupAnim(float time, float r, float bob, float yRot, float xRot, float scale, unsigned int uiBitmaskOverrideAnim=0);
}; };

View File

@@ -21,7 +21,7 @@ float Camera::za = 0.0f;
float Camera::xa2 = 0.0f; float Camera::xa2 = 0.0f;
float Camera::za2 = 0.0f; float Camera::za2 = 0.0f;
void Camera::prepare(shared_ptr<Player> player, bool mirror) void Camera::prepare(std::shared_ptr<Player> player, bool mirror)
{ {
glGetFloat(GL_MODELVIEW_MATRIX, modelview); glGetFloat(GL_MODELVIEW_MATRIX, modelview);
glGetFloat(GL_PROJECTION_MATRIX, projection); glGetFloat(GL_PROJECTION_MATRIX, projection);
@@ -88,12 +88,12 @@ void Camera::prepare(shared_ptr<Player> player, bool mirror)
ya = cosf(xRot * PI / 180.0f); ya = cosf(xRot * PI / 180.0f);
} }
TilePos *Camera::getCameraTilePos(shared_ptr<Mob> player, double alpha) TilePos *Camera::getCameraTilePos(std::shared_ptr<Mob> player, double alpha)
{ {
return new TilePos(getCameraPos(player, alpha)); return new TilePos(getCameraPos(player, alpha));
} }
Vec3 *Camera::getCameraPos(shared_ptr<Mob> player, double alpha) Vec3 *Camera::getCameraPos(std::shared_ptr<Mob> player, double alpha)
{ {
double xx = player->xo + (player->x - player->xo) * alpha; double xx = player->xo + (player->x - player->xo) * alpha;
double yy = player->yo + (player->y - player->yo) * alpha + player->getHeadHeight(); double yy = player->yo + (player->y - player->yo) * alpha + player->getHeadHeight();
@@ -106,7 +106,7 @@ Vec3 *Camera::getCameraPos(shared_ptr<Mob> player, double alpha)
return Vec3::newTemp(xt, yt, zt); return Vec3::newTemp(xt, yt, zt);
} }
int Camera::getBlockAt(Level *level, shared_ptr<Mob> player, float alpha) int Camera::getBlockAt(Level *level, std::shared_ptr<Mob> player, float alpha)
{ {
Vec3 *p = Camera::getCameraPos(player, alpha); Vec3 *p = Camera::getCameraPos(player, alpha);
TilePos tp = TilePos(p); TilePos tp = TilePos(p);

View File

@@ -24,9 +24,9 @@ private:
public: public:
static float xa, ya, za, xa2, za2; static float xa, ya, za, xa2, za2;
static void prepare(shared_ptr<Player> player, bool mirror); static void prepare(std::shared_ptr<Player> player, bool mirror);
static TilePos *getCameraTilePos(shared_ptr<Mob> player, double alpha); static TilePos *getCameraTilePos(std::shared_ptr<Mob> player, double alpha);
static Vec3 *getCameraPos(shared_ptr<Mob> player, double alpha); static Vec3 *getCameraPos(std::shared_ptr<Mob> player, double alpha);
static int getBlockAt(Level *level, shared_ptr<Mob> player, float alpha); static int getBlockAt(Level *level, std::shared_ptr<Mob> player, float alpha);
}; };

View File

@@ -18,10 +18,10 @@ ChestRenderer::~ChestRenderer()
delete largeChestModel; delete largeChestModel;
} }
void ChestRenderer::render(shared_ptr<TileEntity> _chest, double x, double y, double z, float a, bool setColor, float alpha, bool useCompiled) void ChestRenderer::render(std::shared_ptr<TileEntity> _chest, double x, double y, double z, float a, bool setColor, float alpha, bool useCompiled)
{ {
// 4J Convert as we aren't using a templated class // 4J Convert as we aren't using a templated class
shared_ptr<ChestTileEntity> chest = dynamic_pointer_cast<ChestTileEntity>(_chest); std::shared_ptr<ChestTileEntity> chest = dynamic_pointer_cast<ChestTileEntity>(_chest);
int data; int data;

View File

@@ -11,8 +11,8 @@ private:
ChestModel *largeChestModel; ChestModel *largeChestModel;
public: public:
ChestRenderer(); ChestRenderer();
~ChestRenderer(); ~ChestRenderer();
void render(shared_ptr<TileEntity> _chest, double x, double y, double z, float a, bool setColor, float alpha=1.0f, bool useCompiled = true); // 4J added setColor param void render(std::shared_ptr<TileEntity> _chest, double x, double y, double z, float a, bool setColor, float alpha=1.0f, bool useCompiled = true); // 4J added setColor param
}; };

View File

@@ -49,10 +49,10 @@ ChickenModel::ChickenModel() : Model()
wing1->compile(1.0f/16.0f); wing1->compile(1.0f/16.0f);
} }
void ChickenModel::render(shared_ptr<Entity> entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) void ChickenModel::render(std::shared_ptr<Entity> entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled)
{ {
setupAnim(time, r, bob, yRot, xRot, scale); setupAnim(time, r, bob, yRot, xRot, scale);
if (young) if (young)
{ {
float ss = 2; float ss = 2;
glPushMatrix(); glPushMatrix();
@@ -70,8 +70,8 @@ void ChickenModel::render(shared_ptr<Entity> entity, float time, float r, float
wing0->render(scale,usecompiled); wing0->render(scale,usecompiled);
wing1->render(scale,usecompiled); wing1->render(scale,usecompiled);
glPopMatrix(); glPopMatrix();
} }
else else
{ {
head->render(scale,usecompiled); head->render(scale,usecompiled);
beak->render(scale,usecompiled); beak->render(scale,usecompiled);
@@ -88,13 +88,13 @@ void ChickenModel::setupAnim(float time, float r, float bob, float yRot, float x
{ {
head->xRot = xRot / (float) (180 / PI); head->xRot = xRot / (float) (180 / PI);
head->yRot = yRot / (float) (180 / PI); head->yRot = yRot / (float) (180 / PI);
beak->xRot = head->xRot; beak->xRot = head->xRot;
beak->yRot = head->yRot; beak->yRot = head->yRot;
redThing->xRot = head->xRot; redThing->xRot = head->xRot;
redThing->yRot = head->yRot; redThing->yRot = head->yRot;
body->xRot = 90 / (float) (180 / PI); body->xRot = 90 / (float) (180 / PI);
leg0->xRot = (Mth::cos(time * 0.6662f) * 1.4f) * r; leg0->xRot = (Mth::cos(time * 0.6662f) * 1.4f) * r;

View File

@@ -6,6 +6,6 @@ public:
ModelPart *head, *hair, *body, *leg0, *leg1, *wing0,* wing1, *beak, *redThing; ModelPart *head, *hair, *body, *leg0, *leg1, *wing0,* wing1, *beak, *redThing;
ChickenModel(); ChickenModel();
virtual void render(shared_ptr<Entity> entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled); virtual void render(std::shared_ptr<Entity> entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled);
virtual void setupAnim(float time, float r, float bob, float yRot, float xRot, float scale, unsigned int uiBitmaskOverrideAnim=0); virtual void setupAnim(float time, float r, float bob, float yRot, float xRot, float scale, unsigned int uiBitmaskOverrideAnim=0);
}; };

View File

@@ -7,18 +7,18 @@ ChickenRenderer::ChickenRenderer(Model *model, float shadow) : MobRenderer(model
{ {
} }
void ChickenRenderer::render(shared_ptr<Entity> _mob, double x, double y, double z, float rot, float a) void ChickenRenderer::render(std::shared_ptr<Entity> _mob, double x, double y, double z, float rot, float a)
{ {
MobRenderer::render(_mob, x, y, z, rot, a); MobRenderer::render(_mob, x, y, z, rot, a);
} }
float ChickenRenderer::getBob(shared_ptr<Mob> _mob, float a) float ChickenRenderer::getBob(std::shared_ptr<Mob> _mob, float a)
{ {
// 4J - dynamic cast required because we aren't using templates/generics in our version // 4J - dynamic cast required because we aren't using templates/generics in our version
shared_ptr<Chicken> mob = dynamic_pointer_cast<Chicken>(_mob); std::shared_ptr<Chicken> mob = dynamic_pointer_cast<Chicken>(_mob);
float flap = mob->oFlap+(mob->flap-mob->oFlap)*a; float flap = mob->oFlap+(mob->flap-mob->oFlap)*a;
float flapSpeed = mob->oFlapSpeed+(mob->flapSpeed-mob->oFlapSpeed)*a; float flapSpeed = mob->oFlapSpeed+(mob->flapSpeed-mob->oFlapSpeed)*a;
return (Mth::sin(flap)+1)*flapSpeed; return (Mth::sin(flap)+1)*flapSpeed;
} }

View File

@@ -5,7 +5,7 @@ class ChickenRenderer : public MobRenderer
{ {
public: public:
ChickenRenderer(Model *model, float shadow); ChickenRenderer(Model *model, float shadow);
virtual void render(shared_ptr<Entity> _mob, double x, double y, double z, float rot, float a); virtual void render(std::shared_ptr<Entity> _mob, double x, double y, double z, float rot, float a);
protected: protected:
virtual float getBob(shared_ptr<Mob> _mob, float a); virtual float getBob(std::shared_ptr<Mob> _mob, float a);
}; };

View File

@@ -103,7 +103,7 @@ void Chunk::setPos(int x, int y, int z)
{ {
bb = AABB::newPermanent(-g, -g, -g, XZSIZE+g, SIZE+g, XZSIZE+g); bb = 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);
@@ -141,7 +141,7 @@ void Chunk::setPos(int x, int y, int z)
LeaveCriticalSection(&levelRenderer->m_csDirtyChunks); LeaveCriticalSection(&levelRenderer->m_csDirtyChunks);
} }
void Chunk::translateToPos() void Chunk::translateToPos()
@@ -173,7 +173,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()
@@ -186,7 +186,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
@@ -204,10 +204,10 @@ void Chunk::rebuild()
LevelChunk::touchedSky = false; LevelChunk::touchedSky = false;
// unordered_set<shared_ptr<TileEntity> > oldTileEntities(renderableTileEntities.begin(),renderableTileEntities.end()); // 4J removed this & next line // unordered_set<std::shared_ptr<TileEntity> > oldTileEntities(renderableTileEntities.begin(),renderableTileEntities.end()); // 4J removed this & next line
// renderableTileEntities.clear(); // renderableTileEntities.clear();
vector<shared_ptr<TileEntity> > renderableTileEntities; // 4J - added vector<std::shared_ptr<TileEntity> > renderableTileEntities; // 4J - added
int r = 1; int r = 1;
@@ -223,7 +223,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();
@@ -237,9 +237,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;
@@ -275,7 +275,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::rock_Id ) || ( tileId == Tile::dirt_Id ) || ( tileId == Tile::unbreakable_Id ) || ( tileId == 255) ) ) continue; if( !( ( tileId == Tile::rock_Id ) || ( tileId == Tile::dirt_Id ) || ( tileId == Tile::unbreakable_Id ) || ( tileId == 255) ) ) continue;
@@ -337,7 +337,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;
@@ -398,11 +398,11 @@ 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())
{ {
shared_ptr<TileEntity> et = region->getTileEntity(x, y, z); std::shared_ptr<TileEntity> et = region->getTileEntity(x, y, z);
if (TileEntityRenderDispatcher::instance->hasRenderer(et)) if (TileEntityRenderDispatcher::instance->hasRenderer(et))
{ {
renderableTileEntities.push_back(et); renderableTileEntities.push_back(et);
@@ -465,7 +465,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;
} }
} }
@@ -552,12 +552,12 @@ 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<std::shared_ptr<TileEntity> > newTileEntities(renderableTileEntities.begin(),renderableTileEntities.end());
AUTO_VAR(endIt, oldTileEntities.end()); AUTO_VAR(endIt, oldTileEntities.end());
for( unordered_set<shared_ptr<TileEntity> >::iterator it = oldTileEntities.begin(); it != endIt; it++ ) for( unordered_set<std::shared_ptr<TileEntity> >::iterator it = oldTileEntities.begin(); it != endIt; it++ )
{ {
newTileEntities.erase(*it); newTileEntities.erase(*it);
} }
@@ -566,7 +566,7 @@ void Chunk::rebuild()
EnterCriticalSection(globalRenderableTileEntities_cs); EnterCriticalSection(globalRenderableTileEntities_cs);
endIt = newTileEntities.end(); endIt = newTileEntities.end();
for( unordered_set<shared_ptr<TileEntity> >::iterator it = newTileEntities.begin(); it != endIt; it++ ) for( unordered_set<std::shared_ptr<TileEntity> >::iterator it = newTileEntities.begin(); it != endIt; it++ )
{ {
globalRenderableTileEntities->push_back(*it); globalRenderableTileEntities->push_back(*it);
} }
@@ -574,12 +574,12 @@ 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_VAR(endItRTE, renderableTileEntities.end());
for( vector<shared_ptr<TileEntity> >::iterator it = renderableTileEntities.begin(); it != endItRTE; it++ ) for( vector<std::shared_ptr<TileEntity> >::iterator it = renderableTileEntities.begin(); it != endItRTE; it++ )
{ {
oldTileEntities.erase(*it); oldTileEntities.erase(*it);
} }
// 4J - oldTileEntities is now the removed items // 4J - oldTileEntities is now the removed items
vector<shared_ptr<TileEntity> >::iterator it = globalRenderableTileEntities->begin(); vector<std::shared_ptr<TileEntity> >::iterator it = globalRenderableTileEntities->begin();
while( it != globalRenderableTileEntities->end() ) while( it != globalRenderableTileEntities->end() )
{ {
if( oldTileEntities.find(*it) != oldTileEntities.end() ) if( oldTileEntities.find(*it) != oldTileEntities.end() )
@@ -656,10 +656,10 @@ void Chunk::rebuild_SPU()
LevelChunk::touchedSky = false; LevelChunk::touchedSky = false;
// unordered_set<shared_ptr<TileEntity> > oldTileEntities(renderableTileEntities.begin(),renderableTileEntities.end()); // 4J removed this & next line // unordered_set<std::shared_ptr<TileEntity> > oldTileEntities(renderableTileEntities.begin(),renderableTileEntities.end()); // 4J removed this & next line
// renderableTileEntities.clear(); // renderableTileEntities.clear();
vector<shared_ptr<TileEntity> > renderableTileEntities; // 4J - added vector<std::shared_ptr<TileEntity> > renderableTileEntities; // 4J - added
// List<TileEntity> newTileEntities = new ArrayList<TileEntity>(); // List<TileEntity> newTileEntities = new ArrayList<TileEntity>();
// newTileEntities.clear(); // newTileEntities.clear();
@@ -679,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(&region, level, x0, y0, z0); g_rebuildDataIn.buildForChunk(&region, 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;
@@ -750,7 +750,7 @@ void Chunk::rebuild_SPU()
{ {
if (currentLayer == 0 && Tile::tiles[tileId]->isEntityTile()) if (currentLayer == 0 && Tile::tiles[tileId]->isEntityTile())
{ {
shared_ptr<TileEntity> et = region.getTileEntity(x, y, z); std::shared_ptr<TileEntity> et = region.getTileEntity(x, y, z);
if (TileEntityRenderDispatcher::instance->hasRenderer(et)) if (TileEntityRenderDispatcher::instance->hasRenderer(et))
{ {
renderableTileEntities.push_back(et); renderableTileEntities.push_back(et);
@@ -881,12 +881,12 @@ 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<std::shared_ptr<TileEntity> > newTileEntities(renderableTileEntities.begin(),renderableTileEntities.end());
AUTO_VAR(endIt, oldTileEntities.end()); AUTO_VAR(endIt, oldTileEntities.end());
for( unordered_set<shared_ptr<TileEntity> >::iterator it = oldTileEntities.begin(); it != endIt; it++ ) for( unordered_set<std::shared_ptr<TileEntity> >::iterator it = oldTileEntities.begin(); it != endIt; it++ )
{ {
newTileEntities.erase(*it); newTileEntities.erase(*it);
} }
@@ -895,7 +895,7 @@ void Chunk::rebuild_SPU()
EnterCriticalSection(globalRenderableTileEntities_cs); EnterCriticalSection(globalRenderableTileEntities_cs);
endIt = newTileEntities.end(); endIt = newTileEntities.end();
for( unordered_set<shared_ptr<TileEntity> >::iterator it = newTileEntities.begin(); it != endIt; it++ ) for( unordered_set<std::shared_ptr<TileEntity> >::iterator it = newTileEntities.begin(); it != endIt; it++ )
{ {
globalRenderableTileEntities.push_back(*it); globalRenderableTileEntities.push_back(*it);
} }
@@ -903,12 +903,12 @@ 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_VAR(endItRTE, renderableTileEntities.end());
for( vector<shared_ptr<TileEntity> >::iterator it = renderableTileEntities.begin(); it != endItRTE; it++ ) for( vector<std::shared_ptr<TileEntity> >::iterator it = renderableTileEntities.begin(); it != endItRTE; it++ )
{ {
oldTileEntities.erase(*it); oldTileEntities.erase(*it);
} }
// 4J - oldTileEntities is now the removed items // 4J - oldTileEntities is now the removed items
vector<shared_ptr<TileEntity> >::iterator it = globalRenderableTileEntities->begin(); vector<std::shared_ptr<TileEntity> >::iterator it = globalRenderableTileEntities->begin();
while( it != globalRenderableTileEntities->end() ) while( it != globalRenderableTileEntities->end() )
{ {
if( oldTileEntities.find(*it) != oldTileEntities.end() ) if( oldTileEntities.find(*it) != oldTileEntities.end() )
@@ -941,7 +941,7 @@ void Chunk::rebuild_SPU()
#endif // _PS3_ #endif // _PS3_
float Chunk::distanceToSqr(shared_ptr<Entity> player) const float Chunk::distanceToSqr(std::shared_ptr<Entity> player) const
{ {
float xd = (float) (player->x - xm); float xd = (float) (player->x - xm);
float yd = (float) (player->y - ym); float yd = (float) (player->y - ym);
@@ -949,7 +949,7 @@ float Chunk::distanceToSqr(shared_ptr<Entity> player) const
return xd * xd + yd * yd + zd * zd; return xd * xd + yd * yd + zd * zd;
} }
float Chunk::squishedDistanceToSqr(shared_ptr<Entity> player) float Chunk::squishedDistanceToSqr(std::shared_ptr<Entity> player)
{ {
float xd = (float) (player->x - xm); float xd = (float) (player->x - xm);
float yd = (float) (player->y - ym) * 2; float yd = (float) (player->y - ym) * 2;

View File

@@ -38,22 +38,22 @@ public:
static void ReleaseThreadStorage(); static void ReleaseThreadStorage();
static unsigned char *GetTileIdsStorage(); static unsigned char *GetTileIdsStorage();
#endif #endif
public: public:
static int updates; static int updates;
int x, y, z; int x, y, z;
int xRender, yRender, zRender; int xRender, yRender, zRender;
int xRenderOffs, yRenderOffs, zRenderOffs; int xRenderOffs, yRenderOffs, zRenderOffs;
int xm, ym, zm; int xm, ym, zm;
AABB *bb; AABB *bb;
ClipChunk *clipChunk; ClipChunk *clipChunk;
int id; int id;
//public: //public:
// vector<shared_ptr<TileEntity> > renderableTileEntities; // 4J - removed // vector<std::shared_ptr<TileEntity> > renderableTileEntities; // 4J - removed
private: private:
LevelRenderer::rteMap *globalRenderableTileEntities; LevelRenderer::rteMap *globalRenderableTileEntities;
CRITICAL_SECTION *globalRenderableTileEntities_cs; CRITICAL_SECTION *globalRenderableTileEntities_cs;
@@ -71,8 +71,8 @@ public:
#ifdef __PS3__ #ifdef __PS3__
void rebuild_SPU(); void rebuild_SPU();
#endif // __PS3__ #endif // __PS3__
float distanceToSqr(shared_ptr<Entity> player) const; float distanceToSqr(std::shared_ptr<Entity> player) const;
float squishedDistanceToSqr(shared_ptr<Entity> player); float squishedDistanceToSqr(std::shared_ptr<Entity> player);
void reset(); void reset();
void _delete(); void _delete();

File diff suppressed because it is too large Load Diff

View File

@@ -49,92 +49,92 @@ public:
~ClientConnection(); ~ClientConnection();
void tick(); void tick();
INetworkPlayer *getNetworkPlayer(); INetworkPlayer *getNetworkPlayer();
virtual void handleLogin(shared_ptr<LoginPacket> packet); virtual void handleLogin(std::shared_ptr<LoginPacket> packet);
virtual void handleAddEntity(shared_ptr<AddEntityPacket> packet); virtual void handleAddEntity(std::shared_ptr<AddEntityPacket> packet);
virtual void handleAddExperienceOrb(shared_ptr<AddExperienceOrbPacket> packet); virtual void handleAddExperienceOrb(std::shared_ptr<AddExperienceOrbPacket> packet);
virtual void handleAddGlobalEntity(shared_ptr<AddGlobalEntityPacket> packet); virtual void handleAddGlobalEntity(std::shared_ptr<AddGlobalEntityPacket> packet);
virtual void handleAddPainting(shared_ptr<AddPaintingPacket> packet); virtual void handleAddPainting(std::shared_ptr<AddPaintingPacket> packet);
virtual void handleSetEntityMotion(shared_ptr<SetEntityMotionPacket> packet); virtual void handleSetEntityMotion(std::shared_ptr<SetEntityMotionPacket> packet);
virtual void handleSetEntityData(shared_ptr<SetEntityDataPacket> packet); virtual void handleSetEntityData(std::shared_ptr<SetEntityDataPacket> packet);
virtual void handleAddPlayer(shared_ptr<AddPlayerPacket> packet); virtual void handleAddPlayer(std::shared_ptr<AddPlayerPacket> packet);
virtual void handleTeleportEntity(shared_ptr<TeleportEntityPacket> packet); virtual void handleTeleportEntity(std::shared_ptr<TeleportEntityPacket> packet);
virtual void handleMoveEntity(shared_ptr<MoveEntityPacket> packet); virtual void handleMoveEntity(std::shared_ptr<MoveEntityPacket> packet);
virtual void handleRotateMob(shared_ptr<RotateHeadPacket> packet); virtual void handleRotateMob(std::shared_ptr<RotateHeadPacket> packet);
virtual void handleMoveEntitySmall(shared_ptr<MoveEntityPacketSmall> packet); virtual void handleMoveEntitySmall(std::shared_ptr<MoveEntityPacketSmall> packet);
virtual void handleRemoveEntity(shared_ptr<RemoveEntitiesPacket> packet); virtual void handleRemoveEntity(std::shared_ptr<RemoveEntitiesPacket> packet);
virtual void handleMovePlayer(shared_ptr<MovePlayerPacket> packet); virtual void handleMovePlayer(std::shared_ptr<MovePlayerPacket> packet);
Random *random; Random *random;
// 4J Added
virtual void handleChunkVisibilityArea(shared_ptr<ChunkVisibilityAreaPacket> packet);
virtual void handleChunkVisibility(shared_ptr<ChunkVisibilityPacket> packet); // 4J Added
virtual void handleChunkTilesUpdate(shared_ptr<ChunkTilesUpdatePacket> packet); virtual void handleChunkVisibilityArea(std::shared_ptr<ChunkVisibilityAreaPacket> packet);
virtual void handleBlockRegionUpdate(shared_ptr<BlockRegionUpdatePacket> packet);
virtual void handleTileUpdate(shared_ptr<TileUpdatePacket> packet); virtual void handleChunkVisibility(std::shared_ptr<ChunkVisibilityPacket> packet);
virtual void handleDisconnect(shared_ptr<DisconnectPacket> packet); virtual void handleChunkTilesUpdate(std::shared_ptr<ChunkTilesUpdatePacket> packet);
virtual void handleBlockRegionUpdate(std::shared_ptr<BlockRegionUpdatePacket> packet);
virtual void handleTileUpdate(std::shared_ptr<TileUpdatePacket> packet);
virtual void handleDisconnect(std::shared_ptr<DisconnectPacket> packet);
virtual void onDisconnect(DisconnectPacket::eDisconnectReason reason, void *reasonObjects); virtual void onDisconnect(DisconnectPacket::eDisconnectReason reason, void *reasonObjects);
void sendAndDisconnect(shared_ptr<Packet> packet); void sendAndDisconnect(std::shared_ptr<Packet> packet);
void send(shared_ptr<Packet> packet); void send(std::shared_ptr<Packet> packet);
virtual void handleTakeItemEntity(shared_ptr<TakeItemEntityPacket> packet); virtual void handleTakeItemEntity(std::shared_ptr<TakeItemEntityPacket> packet);
virtual void handleChat(shared_ptr<ChatPacket> packet); virtual void handleChat(std::shared_ptr<ChatPacket> packet);
virtual void handleAnimate(shared_ptr<AnimatePacket> packet); virtual void handleAnimate(std::shared_ptr<AnimatePacket> packet);
virtual void handleEntityActionAtPosition(shared_ptr<EntityActionAtPositionPacket> packet); virtual void handleEntityActionAtPosition(std::shared_ptr<EntityActionAtPositionPacket> packet);
virtual void handlePreLogin(shared_ptr<PreLoginPacket> packet); virtual void handlePreLogin(std::shared_ptr<PreLoginPacket> packet);
void close(); void close();
virtual void handleAddMob(shared_ptr<AddMobPacket> packet); virtual void handleAddMob(std::shared_ptr<AddMobPacket> packet);
virtual void handleSetTime(shared_ptr<SetTimePacket> packet); virtual void handleSetTime(std::shared_ptr<SetTimePacket> packet);
virtual void handleSetSpawn(shared_ptr<SetSpawnPositionPacket> packet); virtual void handleSetSpawn(std::shared_ptr<SetSpawnPositionPacket> packet);
virtual void handleRidePacket(shared_ptr<SetRidingPacket> packet); virtual void handleRidePacket(std::shared_ptr<SetRidingPacket> packet);
virtual void handleEntityEvent(shared_ptr<EntityEventPacket> packet); virtual void handleEntityEvent(std::shared_ptr<EntityEventPacket> packet);
private: private:
shared_ptr<Entity> getEntity(int entityId); std::shared_ptr<Entity> getEntity(int entityId);
wstring GetDisplayNameByGamertag(wstring gamertag); wstring GetDisplayNameByGamertag(wstring gamertag);
public: public:
virtual void handleSetHealth(shared_ptr<SetHealthPacket> packet); virtual void handleSetHealth(std::shared_ptr<SetHealthPacket> packet);
virtual void handleSetExperience(shared_ptr<SetExperiencePacket> packet); virtual void handleSetExperience(std::shared_ptr<SetExperiencePacket> packet);
virtual void handleRespawn(shared_ptr<RespawnPacket> packet); virtual void handleRespawn(std::shared_ptr<RespawnPacket> packet);
virtual void handleExplosion(shared_ptr<ExplodePacket> packet); virtual void handleExplosion(std::shared_ptr<ExplodePacket> packet);
virtual void handleContainerOpen(shared_ptr<ContainerOpenPacket> packet); virtual void handleContainerOpen(std::shared_ptr<ContainerOpenPacket> packet);
virtual void handleContainerSetSlot(shared_ptr<ContainerSetSlotPacket> packet); virtual void handleContainerSetSlot(std::shared_ptr<ContainerSetSlotPacket> packet);
virtual void handleContainerAck(shared_ptr<ContainerAckPacket> packet); virtual void handleContainerAck(std::shared_ptr<ContainerAckPacket> packet);
virtual void handleContainerContent(shared_ptr<ContainerSetContentPacket> packet); virtual void handleContainerContent(std::shared_ptr<ContainerSetContentPacket> packet);
virtual void handleSignUpdate(shared_ptr<SignUpdatePacket> packet); virtual void handleSignUpdate(std::shared_ptr<SignUpdatePacket> packet);
virtual void handleTileEntityData(shared_ptr<TileEntityDataPacket> packet); virtual void handleTileEntityData(std::shared_ptr<TileEntityDataPacket> packet);
virtual void handleContainerSetData(shared_ptr<ContainerSetDataPacket> packet); virtual void handleContainerSetData(std::shared_ptr<ContainerSetDataPacket> packet);
virtual void handleSetEquippedItem(shared_ptr<SetEquippedItemPacket> packet); virtual void handleSetEquippedItem(std::shared_ptr<SetEquippedItemPacket> packet);
virtual void handleContainerClose(shared_ptr<ContainerClosePacket> packet); virtual void handleContainerClose(std::shared_ptr<ContainerClosePacket> packet);
virtual void handleTileEvent(shared_ptr<TileEventPacket> packet); virtual void handleTileEvent(std::shared_ptr<TileEventPacket> packet);
virtual void handleTileDestruction(shared_ptr<TileDestructionPacket> packet); virtual void handleTileDestruction(std::shared_ptr<TileDestructionPacket> packet);
virtual bool canHandleAsyncPackets(); virtual bool canHandleAsyncPackets();
virtual void handleGameEvent(shared_ptr<GameEventPacket> gameEventPacket); virtual void handleGameEvent(std::shared_ptr<GameEventPacket> gameEventPacket);
virtual void handleComplexItemData(shared_ptr<ComplexItemDataPacket> packet); virtual void handleComplexItemData(std::shared_ptr<ComplexItemDataPacket> packet);
virtual void handleLevelEvent(shared_ptr<LevelEventPacket> packet); virtual void handleLevelEvent(std::shared_ptr<LevelEventPacket> packet);
virtual void handleAwardStat(shared_ptr<AwardStatPacket> packet); virtual void handleAwardStat(std::shared_ptr<AwardStatPacket> packet);
virtual void handleUpdateMobEffect(shared_ptr<UpdateMobEffectPacket> packet); virtual void handleUpdateMobEffect(std::shared_ptr<UpdateMobEffectPacket> packet);
virtual void handleRemoveMobEffect(shared_ptr<RemoveMobEffectPacket> packet); virtual void handleRemoveMobEffect(std::shared_ptr<RemoveMobEffectPacket> packet);
virtual bool isServerPacketListener(); virtual bool isServerPacketListener();
virtual void handlePlayerInfo(shared_ptr<PlayerInfoPacket> packet); virtual void handlePlayerInfo(std::shared_ptr<PlayerInfoPacket> packet);
virtual void handleKeepAlive(shared_ptr<KeepAlivePacket> packet); virtual void handleKeepAlive(std::shared_ptr<KeepAlivePacket> packet);
virtual void handlePlayerAbilities(shared_ptr<PlayerAbilitiesPacket> playerAbilitiesPacket); virtual void handlePlayerAbilities(std::shared_ptr<PlayerAbilitiesPacket> playerAbilitiesPacket);
virtual void handleSoundEvent(shared_ptr<LevelSoundPacket> packet); virtual void handleSoundEvent(std::shared_ptr<LevelSoundPacket> packet);
virtual void handleCustomPayload(shared_ptr<CustomPayloadPacket> customPayloadPacket); virtual void handleCustomPayload(std::shared_ptr<CustomPayloadPacket> customPayloadPacket);
virtual Connection *getConnection(); virtual Connection *getConnection();
// 4J Added // 4J Added
virtual void handleServerSettingsChanged(shared_ptr<ServerSettingsChangedPacket> packet); virtual void handleServerSettingsChanged(std::shared_ptr<ServerSettingsChangedPacket> packet);
virtual void handleTexture(shared_ptr<TexturePacket> packet); virtual void handleTexture(std::shared_ptr<TexturePacket> packet);
virtual void handleTextureAndGeometry(shared_ptr<TextureAndGeometryPacket> packet); virtual void handleTextureAndGeometry(std::shared_ptr<TextureAndGeometryPacket> packet);
virtual void handleUpdateProgress(shared_ptr<UpdateProgressPacket> packet); virtual void handleUpdateProgress(std::shared_ptr<UpdateProgressPacket> packet);
// 4J Added // 4J Added
static int HostDisconnectReturned(void *pParam,int iPad,C4JStorage::EMessageResult result); static int HostDisconnectReturned(void *pParam,int iPad,C4JStorage::EMessageResult result);
static int ExitGameAndSaveReturned(void *pParam,int iPad,C4JStorage::EMessageResult result); static int ExitGameAndSaveReturned(void *pParam,int iPad,C4JStorage::EMessageResult result);
virtual void handleTextureChange(shared_ptr<TextureChangePacket> packet); virtual void handleTextureChange(std::shared_ptr<TextureChangePacket> packet);
virtual void handleTextureAndGeometryChange(shared_ptr<TextureAndGeometryChangePacket> packet); virtual void handleTextureAndGeometryChange(std::shared_ptr<TextureAndGeometryChangePacket> packet);
virtual void handleUpdateGameRuleProgressPacket(shared_ptr<UpdateGameRuleProgressPacket> packet); virtual void handleUpdateGameRuleProgressPacket(std::shared_ptr<UpdateGameRuleProgressPacket> packet);
virtual void handleXZ(shared_ptr<XZPacket> packet); virtual void handleXZ(std::shared_ptr<XZPacket> packet);
void displayPrivilegeChanges(shared_ptr<MultiplayerLocalPlayer> player, unsigned int oldPrivileges); void displayPrivilegeChanges(std::shared_ptr<MultiplayerLocalPlayer> player, unsigned int oldPrivileges);
}; };

View File

@@ -43,7 +43,7 @@ class ConsoleSoundEngine
public: public:
ConsoleSoundEngine() : m_bIsPlayingStreamingCDMusic(false),m_bIsPlayingStreamingGameMusic(false), m_bIsPlayingEndMusic(false),m_bIsPlayingNetherMusic(false){}; ConsoleSoundEngine() : m_bIsPlayingStreamingCDMusic(false),m_bIsPlayingStreamingGameMusic(false), m_bIsPlayingEndMusic(false),m_bIsPlayingNetherMusic(false){};
virtual void tick(shared_ptr<Mob> *players, float a) =0; virtual void tick(std::shared_ptr<Mob> *players, float a) =0;
virtual void destroy()=0; virtual void destroy()=0;
virtual void play(int iSound, float x, float y, float z, float volume, float pitch) =0; virtual void play(int iSound, float x, float y, float z, float volume, float pitch) =0;
virtual void playStreaming(const wstring& name, float x, float y , float z, float volume, float pitch, bool bMusicDelay=true) =0; virtual void playStreaming(const wstring& name, float x, float y , float z, float volume, float pitch, bool bMusicDelay=true) =0;

View File

@@ -22,17 +22,17 @@
#ifdef __ORBIS__ #ifdef __ORBIS__
#include <audioout.h> #include <audioout.h>
//#define __DISABLE_MILES__ // MGH disabled for now as it crashes if we call sceNpMatching2Initialize //#define __DISABLE_MILES__ // MGH disabled for now as it crashes if we call sceNpMatching2Initialize
#endif #endif
// take out Orbis until they are done // take out Orbis until they are done
#if defined _XBOX #if defined _XBOX
SoundEngine::SoundEngine() {} SoundEngine::SoundEngine() {}
void SoundEngine::init(Options *pOptions) void SoundEngine::init(Options *pOptions)
{ {
} }
void SoundEngine::tick(shared_ptr<Mob> *players, float a) void SoundEngine::tick(std::shared_ptr<Mob> *players, float a)
{ {
} }
void SoundEngine::destroy() {} void SoundEngine::destroy() {}
@@ -95,7 +95,7 @@ char SoundEngine::m_szRedistName[]={"redist"};
#endif #endif
F32 AILCALLBACK custom_falloff_function (HSAMPLE S, F32 AILCALLBACK custom_falloff_function (HSAMPLE S,
F32 distance, F32 distance,
F32 rolloff_factor, F32 rolloff_factor,
F32 min_dist, F32 min_dist,
@@ -124,7 +124,7 @@ char *SoundEngine::m_szStreamFileA[eStream_Max]=
"menu2", "menu2",
"menu3", "menu3",
"menu4", "menu4",
#endif #endif
"piano1", "piano1",
"piano2", "piano2",
"piano3", "piano3",
@@ -209,7 +209,7 @@ void SoundEngine::init(Options *pOptions)
#endif #endif
#ifdef __ORBIS__ #ifdef __ORBIS__
C4JThread::PushAffinityAllCores(); C4JThread::PushAffinityAllCores();
#endif #endif
#if defined _DURANGO || defined __ORBIS__ || defined __PS3__ || defined __PSVITA__ #if defined _DURANGO || defined __ORBIS__ || defined __PS3__ || defined __PSVITA__
Register_RIB(BinkADec); Register_RIB(BinkADec);
#endif #endif
@@ -226,8 +226,8 @@ void SoundEngine::init(Options *pOptions)
int iNumberOfChannels=initAudioHardware(8); int iNumberOfChannels=initAudioHardware(8);
// Create a driver to render our audio - 44khz, 16 bit, // Create a driver to render our audio - 44khz, 16 bit,
#ifdef __PS3__ #ifdef __PS3__
// On the Sony PS3, the driver is always opened in 48 kHz, 32-bit floating point. The only meaningful configurations are MSS_MC_STEREO, MSS_MC_51_DISCRETE, and MSS_MC_71_DISCRETE. // On the Sony PS3, the driver is always opened in 48 kHz, 32-bit floating point. The only meaningful configurations are MSS_MC_STEREO, MSS_MC_51_DISCRETE, and MSS_MC_71_DISCRETE.
m_hDriver = AIL_open_digital_driver( 48000, 16, iNumberOfChannels, AIL_OPEN_DIGITAL_USE_SPU0 ); m_hDriver = AIL_open_digital_driver( 48000, 16, iNumberOfChannels, AIL_OPEN_DIGITAL_USE_SPU0 );
#elif defined __PSVITA__ #elif defined __PSVITA__
@@ -236,7 +236,7 @@ void SoundEngine::init(Options *pOptions)
m_hDriver = AIL_open_digital_driver( 48000, 16, MSS_MC_STEREO, 0 ); m_hDriver = AIL_open_digital_driver( 48000, 16, MSS_MC_STEREO, 0 );
// AP - For some reason the submit thread defaults to a priority of zero (invalid). Make sure it has the highest priority to avoid audio breakup. // AP - For some reason the submit thread defaults to a priority of zero (invalid). Make sure it has the highest priority to avoid audio breakup.
SceUID threadID; SceUID threadID;
AIL_platform_property( m_hDriver, PSP2_SUBMIT_THREAD, &threadID, 0, 0); AIL_platform_property( m_hDriver, PSP2_SUBMIT_THREAD, &threadID, 0, 0);
S32 g_DefaultCPU = sceKernelGetThreadCpuAffinityMask(threadID); S32 g_DefaultCPU = sceKernelGetThreadCpuAffinityMask(threadID);
@@ -260,7 +260,7 @@ void SoundEngine::init(Options *pOptions)
AIL_shutdown(); AIL_shutdown();
#ifdef __ORBIS__ #ifdef __ORBIS__
C4JThread::PopAffinity(); C4JThread::PopAffinity();
#endif #endif
return; return;
} }
app.DebugPrintf("---SoundEngine::init - driver opened\n"); app.DebugPrintf("---SoundEngine::init - driver opened\n");
@@ -289,12 +289,12 @@ void SoundEngine::init(Options *pOptions)
AIL_shutdown(); AIL_shutdown();
#ifdef __ORBIS__ #ifdef __ORBIS__
C4JThread::PopAffinity(); C4JThread::PopAffinity();
#endif #endif
app.DebugPrintf("---SoundEngine::init - AIL_startup_event_system failed\n"); app.DebugPrintf("---SoundEngine::init - AIL_startup_event_system failed\n");
return; return;
} }
char szBankName[255]; char szBankName[255];
#if defined __PS3__ #if defined __PS3__
if(app.GetBootedFromDiscPatch()) if(app.GetBootedFromDiscPatch())
{ {
char szTempSoundFilename[255]; char szTempSoundFilename[255];
@@ -308,7 +308,7 @@ void SoundEngine::init(Options *pOptions)
{ {
sprintf(szBankName,"%s/%s",getUsrDirPath(), m_szSoundPath ); sprintf(szBankName,"%s/%s",getUsrDirPath(), m_szSoundPath );
} }
#elif defined __PSVITA__ #elif defined __PSVITA__
sprintf(szBankName,"%s/%s",getUsrDirPath(), m_szSoundPath ); sprintf(szBankName,"%s/%s",getUsrDirPath(), m_szSoundPath );
#elif defined __ORBIS__ #elif defined __ORBIS__
@@ -329,7 +329,7 @@ void SoundEngine::init(Options *pOptions)
AIL_shutdown(); AIL_shutdown();
#ifdef __ORBIS__ #ifdef __ORBIS__
C4JThread::PopAffinity(); C4JThread::PopAffinity();
#endif #endif
return; return;
} }
@@ -362,7 +362,7 @@ void SoundEngine::init(Options *pOptions)
#endif #endif
#ifdef __PSVITA__ #ifdef __PSVITA__
// AP - By default the mixer won't start up and nothing will process. Kick off a blank sample to force the mixer to start up. // AP - By default the mixer won't start up and nothing will process. Kick off a blank sample to force the mixer to start up.
HSAMPLE Sample = AIL_allocate_sample_handle(m_hDriver); HSAMPLE Sample = AIL_allocate_sample_handle(m_hDriver);
AIL_init_sample(Sample, DIG_F_STEREO_16); AIL_init_sample(Sample, DIG_F_STEREO_16);
static U64 silence = 0; static U64 silence = 0;
@@ -403,7 +403,7 @@ void SoundEngine::SetStreamingSounds(int iOverworldMin, int iOverWorldMax, int i
// AP - moved to a separate function so it can be called from the mixer callback on Vita // AP - moved to a separate function so it can be called from the mixer callback on Vita
void SoundEngine::updateMiles() void SoundEngine::updateMiles()
{ {
#ifdef __PSVITA__ #ifdef __PSVITA__
//CD - We must check for Background Music [BGM] at any point //CD - We must check for Background Music [BGM] at any point
//If it's playing disable our audio, otherwise enable //If it's playing disable our audio, otherwise enable
int NoBGMPlaying = sceAudioOutGetAdopt(SCE_AUDIO_OUT_PORT_TYPE_BGM); int NoBGMPlaying = sceAudioOutGetAdopt(SCE_AUDIO_OUT_PORT_TYPE_BGM);
@@ -463,7 +463,7 @@ void SoundEngine::updateMiles()
{ {
isThunder = true; isThunder = true;
} }
if(game_data->volume>1) if(game_data->volume>1)
{ {
game_data->volume=1; game_data->volume=1;
} }
@@ -477,7 +477,7 @@ void SoundEngine::updateMiles()
AIL_register_falloff_function_callback(SoundInfo.Sample,&custom_falloff_function); AIL_register_falloff_function_callback(SoundInfo.Sample,&custom_falloff_function);
if(game_data->bIs3D) if(game_data->bIs3D)
{ {
AIL_set_sample_is_3D( SoundInfo.Sample, 1 ); AIL_set_sample_is_3D( SoundInfo.Sample, 1 );
int iSound = game_data->iSound - eSFX_MAX; int iSound = game_data->iSound - eSFX_MAX;
@@ -518,7 +518,7 @@ void SoundEngine::updateMiles()
} }
if(game_data->bIs3D) if(game_data->bIs3D)
{ {
if(m_validListenerCount>1) if(m_validListenerCount>1)
{ {
float fClosest=10000.0f; float fClosest=10000.0f;
@@ -562,7 +562,7 @@ void SoundEngine::updateMiles()
default: default:
if(game_data->bIs3D) if(game_data->bIs3D)
{ {
if(m_validListenerCount>1) if(m_validListenerCount>1)
{ {
float fClosest=10000.0f; float fClosest=10000.0f;
@@ -600,9 +600,9 @@ void SoundEngine::updateMiles()
{ {
AIL_set_sample_3D_position( SoundInfo.Sample, game_data->x, game_data->y, -game_data->z ); // Flipped sign of z as Miles is expecting left handed coord system AIL_set_sample_3D_position( SoundInfo.Sample, game_data->x, game_data->y, -game_data->z ); // Flipped sign of z as Miles is expecting left handed coord system
} }
} }
break; break;
} }
} }
} }
AIL_complete_event_queue_processing(); AIL_complete_event_queue_processing();
@@ -622,7 +622,7 @@ static float fVal=0.0f;
static S32 running = AIL_ms_count(); static S32 running = AIL_ms_count();
#endif #endif
void SoundEngine::tick(shared_ptr<Mob> *players, float a) void SoundEngine::tick(std::shared_ptr<Mob> *players, float a)
{ {
#ifdef __DISABLE_MILES__ #ifdef __DISABLE_MILES__
return; return;
@@ -657,7 +657,7 @@ void SoundEngine::tick(shared_ptr<Mob> *players, float a)
// store the listener positions for splitscreen // store the listener positions for splitscreen
m_ListenerA[i].vPosition.x = x; m_ListenerA[i].vPosition.x = x;
m_ListenerA[i].vPosition.y = y; m_ListenerA[i].vPosition.y = y;
m_ListenerA[i].vPosition.z = z; m_ListenerA[i].vPosition.z = z;
m_ListenerA[i].vOrientFront.x = ySin; m_ListenerA[i].vOrientFront.x = ySin;
m_ListenerA[i].vOrientFront.y = 0; m_ListenerA[i].vOrientFront.y = 0;
@@ -707,7 +707,7 @@ SoundEngine::SoundEngine()
m_hStream=0; m_hStream=0;
m_StreamState=eMusicStreamState_Idle; m_StreamState=eMusicStreamState_Idle;
m_iMusicDelay=0; m_iMusicDelay=0;
m_validListenerCount=0; m_validListenerCount=0;
m_bHeardTrackA=NULL; m_bHeardTrackA=NULL;
@@ -763,7 +763,7 @@ void SoundEngine::play(int iSound, float x, float y, float z, float volume, floa
// AP removed old counting system. Now relying on Miles' Play Count Limit // AP removed old counting system. Now relying on Miles' Play Count Limit
/* // if we are already playing loads of this sounds ignore this one /* // if we are already playing loads of this sounds ignore this one
if(CurrentSoundsPlaying[iSound+eSFX_MAX]>MAX_SAME_SOUNDS_PLAYING) if(CurrentSoundsPlaying[iSound+eSFX_MAX]>MAX_SAME_SOUNDS_PLAYING)
{ {
// wstring name = wchSoundNames[iSound]; // wstring name = wchSoundNames[iSound];
// char *SoundName = (char *)ConvertSoundPathToName(name); // char *SoundName = (char *)ConvertSoundPathToName(name);
@@ -810,7 +810,7 @@ void SoundEngine::play(int iSound, float x, float y, float z, float volume, floa
// playUI // playUI
// //
///////////////////////////////////////////// /////////////////////////////////////////////
void SoundEngine::playUI(int iSound, float volume, float pitch) void SoundEngine::playUI(int iSound, float volume, float pitch)
{ {
U8 szSoundName[256]; U8 szSoundName[256];
wstring name; wstring name;
@@ -956,7 +956,7 @@ int SoundEngine::GetRandomishTrack(int iStart,int iEnd)
int iVal=iStart; int iVal=iStart;
for(int i=iStart;i<=iEnd;i++) for(int i=iStart;i<=iEnd;i++)
{ {
if(m_bHeardTrackA[i]==false) if(m_bHeardTrackA[i]==false)
{ {
bAllTracksHeard=false; bAllTracksHeard=false;
app.DebugPrintf("Not heard all tracks yet\n"); app.DebugPrintf("Not heard all tracks yet\n");
@@ -974,7 +974,7 @@ int SoundEngine::GetRandomishTrack(int iStart,int iEnd)
} }
} }
// trying to get a track we haven't heard, but not too hard // trying to get a track we haven't heard, but not too hard
for(int i=0;i<=((iEnd-iStart)/2);i++) for(int i=0;i<=((iEnd-iStart)/2);i++)
{ {
// random->nextInt(1) will always return 0 // random->nextInt(1) will always return 0
@@ -1111,7 +1111,7 @@ void SoundEngine::updateSystemMusicPlaying(bool isPlaying)
// updateSoundEffectVolume // updateSoundEffectVolume
// //
///////////////////////////////////////////// /////////////////////////////////////////////
void SoundEngine::updateSoundEffectVolume(float fVal) void SoundEngine::updateSoundEffectVolume(float fVal)
{ {
m_MasterEffectsVolume=fVal; m_MasterEffectsVolume=fVal;
//AIL_set_variable_float(0,"UserEffectVol",fVal); //AIL_set_variable_float(0,"UserEffectVol",fVal);
@@ -1137,7 +1137,7 @@ int SoundEngine::OpenStreamThreadProc( void* lpParameter )
// playMusicTick // playMusicTick
// //
///////////////////////////////////////////// /////////////////////////////////////////////
void SoundEngine::playMusicTick() void SoundEngine::playMusicTick()
{ {
// AP - vita will update the music during the mixer callback // AP - vita will update the music during the mixer callback
#ifndef __PSVITA__ #ifndef __PSVITA__
@@ -1146,7 +1146,7 @@ void SoundEngine::playMusicTick()
} }
// AP - moved to a separate function so it can be called from the mixer callback on Vita // AP - moved to a separate function so it can be called from the mixer callback on Vita
void SoundEngine::playMusicUpdate() void SoundEngine::playMusicUpdate()
{ {
//return; //return;
static bool firstCall = true; static bool firstCall = true;
@@ -1179,7 +1179,7 @@ void SoundEngine::playMusicUpdate()
// 4J-PB - Need to check if we are a patched BD build // 4J-PB - Need to check if we are a patched BD build
if(app.GetBootedFromDiscPatch()) if(app.GetBootedFromDiscPatch())
{ {
sprintf(m_szStreamName,"%s/%s",app.GetBDUsrDirPath(m_szMusicPath), m_szMusicPath ); sprintf(m_szStreamName,"%s/%s",app.GetBDUsrDirPath(m_szMusicPath), m_szMusicPath );
app.DebugPrintf("SoundEngine::playMusicUpdate - (booted from disc patch) music path - %s",m_szStreamName); app.DebugPrintf("SoundEngine::playMusicUpdate - (booted from disc patch) music path - %s",m_szStreamName);
} }
else else
@@ -1214,7 +1214,7 @@ void SoundEngine::playMusicUpdate()
SetIsPlayingStreamingCDMusic(false); SetIsPlayingStreamingCDMusic(false);
m_MusicType=eMusicType_Game; m_MusicType=eMusicType_Game;
m_StreamingAudioInfo.bIs3D=false; m_StreamingAudioInfo.bIs3D=false;
#ifdef _XBOX_ONE #ifdef _XBOX_ONE
wstring &wstrSoundName=dlcAudioFile->GetSoundName(m_musicID); wstring &wstrSoundName=dlcAudioFile->GetSoundName(m_musicID);
wstring wstrFile=L"TPACK:\\Data\\" + wstrSoundName +L".binka"; wstring wstrFile=L"TPACK:\\Data\\" + wstrSoundName +L".binka";
@@ -1244,7 +1244,7 @@ void SoundEngine::playMusicUpdate()
} }
} }
else else
{ {
// 4J-PB - if this is a PS3 disc patch, we have to check if the music file is in the patch data // 4J-PB - if this is a PS3 disc patch, we have to check if the music file is in the patch data
#ifdef __PS3__ #ifdef __PS3__
if(app.GetBootedFromDiscPatch() && (m_musicID<m_iStream_CD_1)) if(app.GetBootedFromDiscPatch() && (m_musicID<m_iStream_CD_1))
@@ -1256,7 +1256,7 @@ void SoundEngine::playMusicUpdate()
strcat((char *)m_szStreamName,".binka"); strcat((char *)m_szStreamName,".binka");
// check if this is in the patch data // check if this is in the patch data
sprintf(m_szStreamName,"%s/%s",app.GetBDUsrDirPath(m_szStreamName), m_szMusicPath ); sprintf(m_szStreamName,"%s/%s",app.GetBDUsrDirPath(m_szStreamName), m_szMusicPath );
strcat((char *)m_szStreamName,"music/"); strcat((char *)m_szStreamName,"music/");
strcat((char *)m_szStreamName,m_szStreamFileA[m_musicID]); strcat((char *)m_szStreamName,m_szStreamFileA[m_musicID]);
strcat((char *)m_szStreamName,".binka"); strcat((char *)m_szStreamName,".binka");
@@ -1289,7 +1289,7 @@ void SoundEngine::playMusicUpdate()
strcat((char *)m_szStreamName,m_szStreamFileA[m_musicID]); strcat((char *)m_szStreamName,m_szStreamFileA[m_musicID]);
strcat((char *)m_szStreamName,".binka"); strcat((char *)m_szStreamName,".binka");
} }
#else #else
if(m_musicID<m_iStream_CD_1) if(m_musicID<m_iStream_CD_1)
{ {
SetIsPlayingStreamingGameMusic(true); SetIsPlayingStreamingGameMusic(true);
@@ -1310,7 +1310,7 @@ void SoundEngine::playMusicUpdate()
} }
strcat((char *)m_szStreamName,m_szStreamFileA[m_musicID]); strcat((char *)m_szStreamName,m_szStreamFileA[m_musicID]);
strcat((char *)m_szStreamName,".binka"); strcat((char *)m_szStreamName,".binka");
#endif #endif
} }
@@ -1321,7 +1321,7 @@ void SoundEngine::playMusicUpdate()
app.DebugPrintf("Starting streaming - %s\n",m_szStreamName); app.DebugPrintf("Starting streaming - %s\n",m_szStreamName);
// Don't actually open in this thread, as it can block for ~300ms. // Don't actually open in this thread, as it can block for ~300ms.
m_openStreamThread = new C4JThread(OpenStreamThreadProc, this, "OpenStreamThreadProc"); m_openStreamThread = new C4JThread(OpenStreamThreadProc, this, "OpenStreamThreadProc");
m_openStreamThread->Run(); m_openStreamThread->Run();
m_StreamState = eMusicStreamState_Opening; m_StreamState = eMusicStreamState_Opening;
@@ -1335,7 +1335,7 @@ void SoundEngine::playMusicUpdate()
delete m_openStreamThread; delete m_openStreamThread;
m_openStreamThread = NULL; m_openStreamThread = NULL;
HSAMPLE hSample = AIL_stream_sample_handle( m_hStream); HSAMPLE hSample = AIL_stream_sample_handle( m_hStream);
// 4J-PB - causes the falloff to be calculated on the PPU instead of the SPU, and seems to resolve our distorted sound issue // 4J-PB - causes the falloff to be calculated on the PPU instead of the SPU, and seems to resolve our distorted sound issue
AIL_register_falloff_function_callback(hSample,&custom_falloff_function); AIL_register_falloff_function_callback(hSample,&custom_falloff_function);
@@ -1383,12 +1383,12 @@ void SoundEngine::playMusicUpdate()
else else
{ {
// clear the 3d flag on the stream after a jukebox finishes and streaming music starts // clear the 3d flag on the stream after a jukebox finishes and streaming music starts
AIL_set_sample_is_3D( hSample, 0 ); AIL_set_sample_is_3D( hSample, 0 );
} }
// set the pitch // set the pitch
app.DebugPrintf("Sample rate:%d\n", AIL_sample_playback_rate(hSample)); app.DebugPrintf("Sample rate:%d\n", AIL_sample_playback_rate(hSample));
AIL_set_sample_playback_rate_factor(hSample,m_StreamingAudioInfo.pitch); AIL_set_sample_playback_rate_factor(hSample,m_StreamingAudioInfo.pitch);
// set the volume // set the volume
AIL_set_sample_volume_levels( hSample, m_StreamingAudioInfo.volume*getMasterMusicVolume(), m_StreamingAudioInfo.volume*getMasterMusicVolume()); AIL_set_sample_volume_levels( hSample, m_StreamingAudioInfo.volume*getMasterMusicVolume(), m_StreamingAudioInfo.volume*getMasterMusicVolume());
AIL_start_stream( m_hStream ); AIL_start_stream( m_hStream );
@@ -1447,7 +1447,7 @@ void SoundEngine::playMusicUpdate()
// Set the end track // Set the end track
m_musicID = getMusicID(LevelData::DIMENSION_END); m_musicID = getMusicID(LevelData::DIMENSION_END);
SetIsPlayingEndMusic(true); SetIsPlayingEndMusic(true);
SetIsPlayingNetherMusic(false); SetIsPlayingNetherMusic(false);
} }
else if(!playerInEnd && GetIsPlayingEndMusic()) else if(!playerInEnd && GetIsPlayingEndMusic())
{ {
@@ -1458,7 +1458,7 @@ void SoundEngine::playMusicUpdate()
// Set the end track // Set the end track
m_musicID = getMusicID(LevelData::DIMENSION_NETHER); m_musicID = getMusicID(LevelData::DIMENSION_NETHER);
SetIsPlayingEndMusic(false); SetIsPlayingEndMusic(false);
SetIsPlayingNetherMusic(true); SetIsPlayingNetherMusic(true);
} }
else else
{ {
@@ -1467,7 +1467,7 @@ void SoundEngine::playMusicUpdate()
// Set the end track // Set the end track
m_musicID = getMusicID(LevelData::DIMENSION_OVERWORLD); m_musicID = getMusicID(LevelData::DIMENSION_OVERWORLD);
SetIsPlayingEndMusic(false); SetIsPlayingEndMusic(false);
SetIsPlayingNetherMusic(false); SetIsPlayingNetherMusic(false);
} }
} }
else if (playerInNether && !GetIsPlayingNetherMusic()) else if (playerInNether && !GetIsPlayingNetherMusic())
@@ -1502,7 +1502,7 @@ void SoundEngine::playMusicUpdate()
if(fMusicVol!=getMasterMusicVolume()) if(fMusicVol!=getMasterMusicVolume())
{ {
fMusicVol=getMasterMusicVolume(); fMusicVol=getMasterMusicVolume();
HSAMPLE hSample = AIL_stream_sample_handle( m_hStream); HSAMPLE hSample = AIL_stream_sample_handle( m_hStream);
//AIL_set_sample_3D_position( hSample, m_StreamingAudioInfo.x, m_StreamingAudioInfo.y, m_StreamingAudioInfo.z ); //AIL_set_sample_3D_position( hSample, m_StreamingAudioInfo.x, m_StreamingAudioInfo.y, m_StreamingAudioInfo.z );
AIL_set_sample_volume_levels( hSample, fMusicVol, fMusicVol); AIL_set_sample_volume_levels( hSample, fMusicVol, fMusicVol);
} }
@@ -1545,7 +1545,7 @@ void SoundEngine::playMusicUpdate()
} }
// our distances in the world aren't very big, so floats rather than casts to doubles should be fine // our distances in the world aren't very big, so floats rather than casts to doubles should be fine
HSAMPLE hSample = AIL_stream_sample_handle( m_hStream); HSAMPLE hSample = AIL_stream_sample_handle( m_hStream);
fDist=sqrtf((fClosestX*fClosestX)+(fClosestY*fClosestY)+(fClosestZ*fClosestZ)); fDist=sqrtf((fClosestX*fClosestX)+(fClosestY*fClosestY)+(fClosestZ*fClosestZ));
AIL_set_sample_3D_position( hSample, 0, 0, fDist ); AIL_set_sample_3D_position( hSample, 0, 0, fDist );
} }
@@ -1555,7 +1555,7 @@ void SoundEngine::playMusicUpdate()
break; break;
case eMusicStreamState_Completed: case eMusicStreamState_Completed:
{ {
// random delay of up to 3 minutes for music // random delay of up to 3 minutes for music
m_iMusicDelay = random->nextInt(20 * 60 * 3);//random->nextInt(20 * 60 * 10) + 20 * 60 * 10; m_iMusicDelay = random->nextInt(20 * 60 * 3);//random->nextInt(20 * 60 * 10) + 20 * 60 * 10;
// Check if we have a local player in The Nether or in The End, and play that music if they are // Check if we have a local player in The Nether or in The End, and play that music if they are
@@ -1644,7 +1644,7 @@ char *SoundEngine::ConvertSoundPathToName(const wstring& name, bool bConvertSpac
#endif #endif
F32 AILCALLBACK custom_falloff_function (HSAMPLE S, F32 AILCALLBACK custom_falloff_function (HSAMPLE S,
F32 distance, F32 distance,
F32 rolloff_factor, F32 rolloff_factor,
F32 min_dist, F32 min_dist,

View File

@@ -78,8 +78,8 @@ typedef struct
{ {
F32 x,y,z,volume,pitch; F32 x,y,z,volume,pitch;
int iSound; int iSound;
bool bIs3D; bool bIs3D;
bool bUseSoundsPitchVal; bool bUseSoundsPitchVal;
#ifdef _DEBUG #ifdef _DEBUG
char chName[64]; char chName[64];
#endif #endif
@@ -103,7 +103,7 @@ public:
virtual void updateSystemMusicPlaying(bool isPlaying); virtual void updateSystemMusicPlaying(bool isPlaying);
virtual void updateSoundEffectVolume(float fVal); virtual void updateSoundEffectVolume(float fVal);
virtual void init(Options *); virtual void init(Options *);
virtual void tick(shared_ptr<Mob> *players, float a); // 4J - updated to take array of local players rather than single one virtual void tick(std::shared_ptr<Mob> *players, float a); // 4J - updated to take array of local players rather than single one
virtual void add(const wstring& name, File *file); virtual void add(const wstring& name, File *file);
virtual void addMusic(const wstring& name, File *file); virtual void addMusic(const wstring& name, File *file);
virtual void addStreaming(const wstring& name, File *file); virtual void addStreaming(const wstring& name, File *file);
@@ -123,7 +123,7 @@ private:
#else #else
int initAudioHardware(int iMinSpeakers) { return iMinSpeakers;} int initAudioHardware(int iMinSpeakers) { return iMinSpeakers;}
#endif #endif
int GetRandomishTrack(int iStart,int iEnd); int GetRandomishTrack(int iStart,int iEnd);
HMSOUNDBANK m_hBank; HMSOUNDBANK m_hBank;
@@ -165,4 +165,4 @@ private:
#ifdef __ORBIS__ #ifdef __ORBIS__
int32_t m_hBGMAudio; int32_t m_hBGMAudio;
#endif #endif
}; };

View File

@@ -365,7 +365,7 @@ void CMinecraftApp::HandleButtonPresses(int iPad)
// ProfileManager.WriteToProfile(iPad,true); // ProfileManager.WriteToProfile(iPad,true);
} }
bool CMinecraftApp::LoadInventoryMenu(int iPad,shared_ptr<LocalPlayer> player,bool bNavigateBack) bool CMinecraftApp::LoadInventoryMenu(int iPad,std::shared_ptr<LocalPlayer> player,bool bNavigateBack)
{ {
bool success = true; bool success = true;
@@ -388,7 +388,7 @@ bool CMinecraftApp::LoadInventoryMenu(int iPad,shared_ptr<LocalPlayer> player,bo
return success; return success;
} }
bool CMinecraftApp::LoadCreativeMenu(int iPad,shared_ptr<LocalPlayer> player,bool bNavigateBack) bool CMinecraftApp::LoadCreativeMenu(int iPad,std::shared_ptr<LocalPlayer> player,bool bNavigateBack)
{ {
bool success = true; bool success = true;
@@ -411,7 +411,7 @@ bool CMinecraftApp::LoadCreativeMenu(int iPad,shared_ptr<LocalPlayer> player,boo
return success; return success;
} }
bool CMinecraftApp::LoadCrafting2x2Menu(int iPad,shared_ptr<LocalPlayer> player) bool CMinecraftApp::LoadCrafting2x2Menu(int iPad,std::shared_ptr<LocalPlayer> player)
{ {
bool success = true; bool success = true;
@@ -437,7 +437,7 @@ bool CMinecraftApp::LoadCrafting2x2Menu(int iPad,shared_ptr<LocalPlayer> player)
return success; return success;
} }
bool CMinecraftApp::LoadCrafting3x3Menu(int iPad,shared_ptr<LocalPlayer> player, int x, int y, int z) bool CMinecraftApp::LoadCrafting3x3Menu(int iPad,std::shared_ptr<LocalPlayer> player, int x, int y, int z)
{ {
bool success = true; bool success = true;
@@ -463,7 +463,7 @@ bool CMinecraftApp::LoadCrafting3x3Menu(int iPad,shared_ptr<LocalPlayer> player,
return success; return success;
} }
bool CMinecraftApp::LoadEnchantingMenu(int iPad,shared_ptr<Inventory> inventory, int x, int y, int z, Level *level) bool CMinecraftApp::LoadEnchantingMenu(int iPad,std::shared_ptr<Inventory> inventory, int x, int y, int z, Level *level)
{ {
bool success = true; bool success = true;
@@ -489,7 +489,7 @@ bool CMinecraftApp::LoadEnchantingMenu(int iPad,shared_ptr<Inventory> inventory,
return success; return success;
} }
bool CMinecraftApp::LoadFurnaceMenu(int iPad,shared_ptr<Inventory> inventory, shared_ptr<FurnaceTileEntity> furnace) bool CMinecraftApp::LoadFurnaceMenu(int iPad,std::shared_ptr<Inventory> inventory, std::shared_ptr<FurnaceTileEntity> furnace)
{ {
bool success = true; bool success = true;
@@ -514,7 +514,7 @@ bool CMinecraftApp::LoadFurnaceMenu(int iPad,shared_ptr<Inventory> inventory, sh
return success; return success;
} }
bool CMinecraftApp::LoadBrewingStandMenu(int iPad,shared_ptr<Inventory> inventory, shared_ptr<BrewingStandTileEntity> brewingStand) bool CMinecraftApp::LoadBrewingStandMenu(int iPad,std::shared_ptr<Inventory> inventory, std::shared_ptr<BrewingStandTileEntity> brewingStand)
{ {
bool success = true; bool success = true;
@@ -540,7 +540,7 @@ bool CMinecraftApp::LoadBrewingStandMenu(int iPad,shared_ptr<Inventory> inventor
} }
bool CMinecraftApp::LoadContainerMenu(int iPad,shared_ptr<Container> inventory, shared_ptr<Container> container) bool CMinecraftApp::LoadContainerMenu(int iPad,std::shared_ptr<Container> inventory, std::shared_ptr<Container> container)
{ {
bool success = true; bool success = true;
@@ -574,7 +574,7 @@ bool CMinecraftApp::LoadContainerMenu(int iPad,shared_ptr<Container> inventory,
return success; return success;
} }
bool CMinecraftApp::LoadTrapMenu(int iPad,shared_ptr<Container> inventory, shared_ptr<DispenserTileEntity> trap) bool CMinecraftApp::LoadTrapMenu(int iPad,std::shared_ptr<Container> inventory, std::shared_ptr<DispenserTileEntity> trap)
{ {
bool success = true; bool success = true;
@@ -599,7 +599,7 @@ bool CMinecraftApp::LoadTrapMenu(int iPad,shared_ptr<Container> inventory, share
return success; return success;
} }
bool CMinecraftApp::LoadSignEntryMenu(int iPad,shared_ptr<SignTileEntity> sign) bool CMinecraftApp::LoadSignEntryMenu(int iPad,std::shared_ptr<SignTileEntity> sign)
{ {
bool success = true; bool success = true;
@@ -615,7 +615,7 @@ bool CMinecraftApp::LoadSignEntryMenu(int iPad,shared_ptr<SignTileEntity> sign)
return success; return success;
} }
bool CMinecraftApp::LoadRepairingMenu(int iPad,shared_ptr<Inventory> inventory, Level *level, int x, int y, int z) bool CMinecraftApp::LoadRepairingMenu(int iPad,std::shared_ptr<Inventory> inventory, Level *level, int x, int y, int z)
{ {
bool success = true; bool success = true;
@@ -634,7 +634,7 @@ bool CMinecraftApp::LoadRepairingMenu(int iPad,shared_ptr<Inventory> inventory,
return success; return success;
} }
bool CMinecraftApp::LoadTradingMenu(int iPad, shared_ptr<Inventory> inventory, shared_ptr<Merchant> trader, Level *level) bool CMinecraftApp::LoadTradingMenu(int iPad, std::shared_ptr<Inventory> inventory, std::shared_ptr<Merchant> trader, Level *level)
{ {
bool success = true; bool success = true;
@@ -1272,7 +1272,7 @@ void CMinecraftApp::ActionGameSettings(int iPad,eGameSetting eVal)
PlayerList *players = MinecraftServer::getInstance()->getPlayerList(); PlayerList *players = MinecraftServer::getInstance()->getPlayerList();
for(AUTO_VAR(it3, players->players.begin()); it3 != players->players.end(); ++it3) for(AUTO_VAR(it3, players->players.begin()); it3 != players->players.end(); ++it3)
{ {
shared_ptr<ServerPlayer> decorationPlayer = *it3; std::shared_ptr<ServerPlayer> decorationPlayer = *it3;
decorationPlayer->setShowOnMaps((app.GetGameHostOption(eGameHostOption_Gamertags)!=0)?true:false); decorationPlayer->setShowOnMaps((app.GetGameHostOption(eGameHostOption_Gamertags)!=0)?true:false);
} }
} }
@@ -2240,7 +2240,7 @@ unsigned int CMinecraftApp::GetGameSettingsDebugMask(int iPad,bool bOverridePlay
} }
if(iPad < 0) iPad = 0; if(iPad < 0) iPad = 0;
shared_ptr<Player> player = Minecraft::GetInstance()->localplayers[iPad]; std::shared_ptr<Player> player = Minecraft::GetInstance()->localplayers[iPad];
if(bOverridePlayer || player==NULL) if(bOverridePlayer || player==NULL)
{ {
@@ -2260,7 +2260,7 @@ void CMinecraftApp::SetGameSettingsDebugMask(int iPad, unsigned int uiVal)
GameSettingsA[iPad]->uiDebugBitmask=uiVal; GameSettingsA[iPad]->uiDebugBitmask=uiVal;
// update the value so the network server can use it // update the value so the network server can use it
shared_ptr<Player> player = Minecraft::GetInstance()->localplayers[iPad]; std::shared_ptr<Player> player = Minecraft::GetInstance()->localplayers[iPad];
if(player) if(player)
{ {
@@ -2427,7 +2427,7 @@ void CMinecraftApp::HandleXuiActions(void)
eTMSAction eTMS; eTMSAction eTMS;
LPVOID param; LPVOID param;
Minecraft *pMinecraft=Minecraft::GetInstance(); Minecraft *pMinecraft=Minecraft::GetInstance();
shared_ptr<MultiplayerLocalPlayer> player; std::shared_ptr<MultiplayerLocalPlayer> player;
// are there any global actions to deal with? // are there any global actions to deal with?
eAction = app.GetGlobalXuiAction(); eAction = app.GetGlobalXuiAction();

View File

@@ -125,18 +125,18 @@ public:
bool GetGameStarted() {return m_bGameStarted;} bool GetGameStarted() {return m_bGameStarted;}
void SetGameStarted(bool bVal) { if(bVal) DebugPrintf("SetGameStarted - true\n"); else DebugPrintf("SetGameStarted - false\n"); m_bGameStarted = bVal; m_bIsAppPaused = !bVal;} void SetGameStarted(bool bVal) { if(bVal) DebugPrintf("SetGameStarted - true\n"); else DebugPrintf("SetGameStarted - false\n"); m_bGameStarted = bVal; m_bIsAppPaused = !bVal;}
int GetLocalPlayerCount(void); int GetLocalPlayerCount(void);
bool LoadInventoryMenu(int iPad,shared_ptr<LocalPlayer> player, bool bNavigateBack=false); bool LoadInventoryMenu(int iPad,std::shared_ptr<LocalPlayer> player, bool bNavigateBack=false);
bool LoadCreativeMenu(int iPad,shared_ptr<LocalPlayer> player,bool bNavigateBack=false); bool LoadCreativeMenu(int iPad,std::shared_ptr<LocalPlayer> player,bool bNavigateBack=false);
bool LoadEnchantingMenu(int iPad,shared_ptr<Inventory> inventory, int x, int y, int z, Level *level); bool LoadEnchantingMenu(int iPad,std::shared_ptr<Inventory> inventory, int x, int y, int z, Level *level);
bool LoadFurnaceMenu(int iPad,shared_ptr<Inventory> inventory, shared_ptr<FurnaceTileEntity> furnace); bool LoadFurnaceMenu(int iPad,std::shared_ptr<Inventory> inventory, std::shared_ptr<FurnaceTileEntity> furnace);
bool LoadBrewingStandMenu(int iPad,shared_ptr<Inventory> inventory, shared_ptr<BrewingStandTileEntity> brewingStand); bool LoadBrewingStandMenu(int iPad,std::shared_ptr<Inventory> inventory, std::shared_ptr<BrewingStandTileEntity> brewingStand);
bool LoadContainerMenu(int iPad,shared_ptr<Container> inventory, shared_ptr<Container> container); bool LoadContainerMenu(int iPad,std::shared_ptr<Container> inventory, std::shared_ptr<Container> container);
bool LoadTrapMenu(int iPad,shared_ptr<Container> inventory, shared_ptr<DispenserTileEntity> trap); bool LoadTrapMenu(int iPad,std::shared_ptr<Container> inventory, std::shared_ptr<DispenserTileEntity> trap);
bool LoadCrafting2x2Menu(int iPad,shared_ptr<LocalPlayer> player); bool LoadCrafting2x2Menu(int iPad,std::shared_ptr<LocalPlayer> player);
bool LoadCrafting3x3Menu(int iPad,shared_ptr<LocalPlayer> player, int x, int y, int z); bool LoadCrafting3x3Menu(int iPad,std::shared_ptr<LocalPlayer> player, int x, int y, int z);
bool LoadSignEntryMenu(int iPad,shared_ptr<SignTileEntity> sign); bool LoadSignEntryMenu(int iPad,std::shared_ptr<SignTileEntity> sign);
bool LoadRepairingMenu(int iPad,shared_ptr<Inventory> inventory, Level *level, int x, int y, int z); bool LoadRepairingMenu(int iPad,std::shared_ptr<Inventory> inventory, Level *level, int x, int y, int z);
bool LoadTradingMenu(int iPad, shared_ptr<Inventory> inventory, shared_ptr<Merchant> trader, Level *level); bool LoadTradingMenu(int iPad, std::shared_ptr<Inventory> inventory, std::shared_ptr<Merchant> trader, Level *level);
bool GetTutorialMode() { return m_bTutorialMode;} bool GetTutorialMode() { return m_bTutorialMode;}
void SetTutorialMode(bool bSet) {m_bTutorialMode=bSet;} void SetTutorialMode(bool bSet) {m_bTutorialMode=bSet;}

View File

@@ -43,14 +43,14 @@ void AddEnchantmentRuleDefinition::addAttribute(const wstring &attributeName, co
} }
} }
bool AddEnchantmentRuleDefinition::enchantItem(shared_ptr<ItemInstance> item) bool AddEnchantmentRuleDefinition::enchantItem(std::shared_ptr<ItemInstance> item)
{ {
bool enchanted = false; bool enchanted = false;
if (item != NULL) if (item != NULL)
{ {
// 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) );
} }

View File

@@ -19,5 +19,5 @@ public:
virtual void addAttribute(const wstring &attributeName, const wstring &attributeValue); virtual void addAttribute(const wstring &attributeName, const wstring &attributeValue);
bool enchantItem(shared_ptr<ItemInstance> item); bool enchantItem(std::shared_ptr<ItemInstance> item);
}; };

View File

@@ -94,13 +94,13 @@ void AddItemRuleDefinition::addAttribute(const wstring &attributeName, const wst
} }
} }
bool AddItemRuleDefinition::addItemToContainer(shared_ptr<Container> container, int slotId) bool AddItemRuleDefinition::addItemToContainer(std::shared_ptr<Container> container, int slotId)
{ {
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 = min(m_quantity, Item::items[m_itemId]->getMaxStackSize());
shared_ptr<ItemInstance> newItem = shared_ptr<ItemInstance>(new ItemInstance(m_itemId,quantity,m_auxValue) ); std::shared_ptr<ItemInstance> newItem = std::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_VAR(it, m_enchantments.begin()); it != m_enchantments.end(); ++it)

View File

@@ -26,5 +26,5 @@ public:
virtual GameRuleDefinition *addChild(ConsoleGameRules::EGameRuleType ruleType); virtual GameRuleDefinition *addChild(ConsoleGameRules::EGameRuleType ruleType);
virtual void addAttribute(const wstring &attributeName, const wstring &attributeValue); virtual void addAttribute(const wstring &attributeName, const wstring &attributeValue);
bool addItemToContainer(shared_ptr<Container> container, int slotId); bool addItemToContainer(std::shared_ptr<Container> container, int slotId);
}; };

View File

@@ -74,7 +74,7 @@ void CollectItemRuleDefinition::populateGameRule(GameRulesInstance::EGameRulesIn
GameRuleDefinition::populateGameRule(type, rule); GameRuleDefinition::populateGameRule(type, rule);
} }
bool CollectItemRuleDefinition::onCollectItem(GameRule *rule, shared_ptr<ItemInstance> item) bool CollectItemRuleDefinition::onCollectItem(GameRule *rule, std::shared_ptr<ItemInstance> item)
{ {
bool statusChanged = false; bool statusChanged = false;
if(item != NULL && item->id == m_itemId && item->getAuxValue() == m_auxValue && item->get4JData() == m_4JDataValue) if(item != NULL && item->id == m_itemId && item->getAuxValue() == m_auxValue && item->get4JData() == m_4JDataValue)
@@ -94,7 +94,7 @@ bool CollectItemRuleDefinition::onCollectItem(GameRule *rule, shared_ptr<ItemIns
if(rule->getConnection() != NULL) if(rule->getConnection() != NULL)
{ {
rule->getConnection()->send( shared_ptr<UpdateGameRuleProgressPacket>( new UpdateGameRuleProgressPacket(getActionType(), this->m_descriptionId, m_itemId, m_auxValue, this->m_4JDataValue,NULL,0))); rule->getConnection()->send( std::shared_ptr<UpdateGameRuleProgressPacket>( new UpdateGameRuleProgressPacket(getActionType(), this->m_descriptionId, m_itemId, m_auxValue, this->m_4JDataValue,NULL,0)));
} }
} }
} }
@@ -102,7 +102,7 @@ bool CollectItemRuleDefinition::onCollectItem(GameRule *rule, shared_ptr<ItemIns
return statusChanged; return statusChanged;
} }
wstring CollectItemRuleDefinition::generateXml(shared_ptr<ItemInstance> item) wstring CollectItemRuleDefinition::generateXml(std::shared_ptr<ItemInstance> item)
{ {
// 4J Stu - This should be kept in sync with the GameRulesDefinition.xsd // 4J Stu - This should be kept in sync with the GameRulesDefinition.xsd
wstring xml = L""; wstring xml = L"";

View File

@@ -25,16 +25,16 @@ public:
virtual int getGoal(); virtual int getGoal();
virtual int getProgress(GameRule *rule); virtual int getProgress(GameRule *rule);
virtual int getIcon() { return m_itemId; } virtual int getIcon() { return m_itemId; }
virtual int getAuxValue() { return m_auxValue; } virtual int getAuxValue() { return m_auxValue; }
void populateGameRule(GameRulesInstance::EGameRulesInstanceType type, GameRule *rule); void populateGameRule(GameRulesInstance::EGameRulesInstanceType type, GameRule *rule);
bool onCollectItem(GameRule *rule, shared_ptr<ItemInstance> item); bool onCollectItem(GameRule *rule, std::shared_ptr<ItemInstance> item);
static wstring generateXml(shared_ptr<ItemInstance> item); static wstring generateXml(std::shared_ptr<ItemInstance> item);
private: private:
//static wstring generateXml(CollectItemRuleDefinition *ruleDef); //static wstring generateXml(CollectItemRuleDefinition *ruleDef);
}; };

View File

@@ -17,7 +17,7 @@ bool CompleteAllRuleDefinition::onUseTile(GameRule *rule, int tileId, int x, int
return statusChanged; return statusChanged;
} }
bool CompleteAllRuleDefinition::onCollectItem(GameRule *rule, shared_ptr<ItemInstance> item) bool CompleteAllRuleDefinition::onCollectItem(GameRule *rule, std::shared_ptr<ItemInstance> item)
{ {
bool statusChanged = CompoundGameRuleDefinition::onCollectItem(rule,item); bool statusChanged = CompoundGameRuleDefinition::onCollectItem(rule,item);
if(statusChanged) updateStatus(rule); if(statusChanged) updateStatus(rule);
@@ -44,14 +44,14 @@ 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;
} }
rule->getConnection()->send( shared_ptr<UpdateGameRuleProgressPacket>( new UpdateGameRuleProgressPacket(getActionType(), this->m_descriptionId,icon, auxValue, 0,&data,sizeof(PacketData)))); rule->getConnection()->send( std::shared_ptr<UpdateGameRuleProgressPacket>( new UpdateGameRuleProgressPacket(getActionType(), this->m_descriptionId,icon, auxValue, 0,&data,sizeof(PacketData))));
} }
app.DebugPrintf("Updated CompleteAllRule - Completed %d of %d\n", progress, goal); app.DebugPrintf("Updated CompleteAllRule - Completed %d of %d\n", progress, goal);
} }

View File

@@ -17,7 +17,7 @@ public:
virtual void getChildren(vector<GameRuleDefinition *> *children); virtual void getChildren(vector<GameRuleDefinition *> *children);
virtual bool onUseTile(GameRule *rule, int tileId, int x, int y, int z); virtual bool onUseTile(GameRule *rule, int tileId, int x, int y, int z);
virtual bool onCollectItem(GameRule *rule, shared_ptr<ItemInstance> item); virtual bool onCollectItem(GameRule *rule, std::shared_ptr<ItemInstance> item);
static wstring generateDescriptionString(const wstring &description, void *data, int dataLength); static wstring generateDescriptionString(const wstring &description, void *data, int dataLength);

View File

@@ -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
@@ -91,7 +91,7 @@ bool CompoundGameRuleDefinition::onUseTile(GameRule *rule, int tileId, int x, in
return statusChanged; return statusChanged;
} }
bool CompoundGameRuleDefinition::onCollectItem(GameRule *rule, shared_ptr<ItemInstance> item) bool CompoundGameRuleDefinition::onCollectItem(GameRule *rule, std::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_VAR(it, rule->m_parameters.begin()); it != rule->m_parameters.end(); ++it)
@@ -100,7 +100,7 @@ bool CompoundGameRuleDefinition::onCollectItem(GameRule *rule, shared_ptr<ItemIn
{ {
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;
} }
@@ -109,7 +109,7 @@ bool CompoundGameRuleDefinition::onCollectItem(GameRule *rule, shared_ptr<ItemIn
return statusChanged; return statusChanged;
} }
void CompoundGameRuleDefinition::postProcessPlayer(shared_ptr<Player> player) void CompoundGameRuleDefinition::postProcessPlayer(std::shared_ptr<Player> player)
{ {
for(AUTO_VAR(it, m_children.begin()); it != m_children.end(); ++it) for(AUTO_VAR(it, m_children.begin()); it != m_children.end(); ++it)
{ {

View File

@@ -18,6 +18,6 @@ public:
virtual void populateGameRule(GameRulesInstance::EGameRulesInstanceType type, GameRule *rule); virtual void populateGameRule(GameRulesInstance::EGameRulesInstanceType type, GameRule *rule);
virtual bool onUseTile(GameRule *rule, int tileId, int x, int y, int z); virtual bool onUseTile(GameRule *rule, int tileId, int x, int y, int z);
virtual bool onCollectItem(GameRule *rule, shared_ptr<ItemInstance> item); virtual bool onCollectItem(GameRule *rule, std::shared_ptr<ItemInstance> item);
virtual void postProcessPlayer(shared_ptr<Player> player); virtual void postProcessPlayer(std::shared_ptr<Player> player);
}; };

View File

@@ -116,7 +116,7 @@ void ConsoleSchematicFile::load(DataInputStream *dis)
for (int i = 0; i < tileEntityTags->size(); i++) for (int i = 0; i < tileEntityTags->size(); i++)
{ {
CompoundTag *teTag = tileEntityTags->get(i); CompoundTag *teTag = tileEntityTags->get(i);
shared_ptr<TileEntity> te = TileEntity::loadStatic(teTag); std::shared_ptr<TileEntity> te = TileEntity::loadStatic(teTag);
if(te == NULL) if(te == NULL)
{ {
@@ -433,7 +433,7 @@ void ConsoleSchematicFile::applyTileEntities(LevelChunk *chunk, AABB *chunkBox,
{ {
for(AUTO_VAR(it, m_tileEntities.begin()); it != m_tileEntities.end();++it) for(AUTO_VAR(it, m_tileEntities.begin()); it != m_tileEntities.end();++it)
{ {
shared_ptr<TileEntity> te = *it; std::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;
@@ -444,7 +444,7 @@ void ConsoleSchematicFile::applyTileEntities(LevelChunk *chunk, AABB *chunkBox,
Vec3 *pos = Vec3::newTemp(targetX,targetY,targetZ); Vec3 *pos = Vec3::newTemp(targetX,targetY,targetZ);
if( chunkBox->containsIncludingLowerBound(pos) ) if( chunkBox->containsIncludingLowerBound(pos) )
{ {
shared_ptr<TileEntity> teCopy = chunk->getTileEntity( (int)targetX & 15, (int)targetY & 15, (int)targetZ & 15 ); std::shared_ptr<TileEntity> teCopy = chunk->getTileEntity( (int)targetX & 15, (int)targetY & 15, (int)targetZ & 15 );
if ( teCopy != NULL ) if ( teCopy != NULL )
{ {
@@ -495,11 +495,11 @@ void ConsoleSchematicFile::applyTileEntities(LevelChunk *chunk, AABB *chunkBox,
} }
CompoundTag *eTag = it->second; CompoundTag *eTag = it->second;
shared_ptr<Entity> e = EntityIO::loadStatic(eTag, NULL); std::shared_ptr<Entity> e = EntityIO::loadStatic(eTag, NULL);
if( e->GetType() == eTYPE_PAINTING ) if( e->GetType() == eTYPE_PAINTING )
{ {
shared_ptr<Painting> painting = dynamic_pointer_cast<Painting>(e); std::shared_ptr<Painting> painting = dynamic_pointer_cast<Painting>(e);
double tileX = painting->xTile; double tileX = painting->xTile;
double tileZ = painting->zTile; double tileZ = painting->zTile;
@@ -512,7 +512,7 @@ void ConsoleSchematicFile::applyTileEntities(LevelChunk *chunk, AABB *chunkBox,
} }
else if( e->GetType() == eTYPE_ITEM_FRAME ) else if( e->GetType() == eTYPE_ITEM_FRAME )
{ {
shared_ptr<ItemFrame> frame = dynamic_pointer_cast<ItemFrame>(e); std::shared_ptr<ItemFrame> frame = dynamic_pointer_cast<ItemFrame>(e);
double tileX = frame->xTile; double tileX = frame->xTile;
double tileZ = frame->zTile; double tileZ = frame->zTile;
@@ -678,12 +678,12 @@ 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<std::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_VAR(it, tileEntities->begin()); it != tileEntities->end(); ++it)
{ {
shared_ptr<TileEntity> te = *it; std::shared_ptr<TileEntity> te = *it;
CompoundTag *teTag = new CompoundTag(); CompoundTag *teTag = new CompoundTag();
shared_ptr<TileEntity> teCopy = te->clone(); std::shared_ptr<TileEntity> teCopy = te->clone();
// Adjust the tileEntity position to schematic coords from world co-ords // Adjust the tileEntity position to schematic coords from world co-ords
teCopy->x -= xStart; teCopy->x -= xStart;
@@ -698,12 +698,12 @@ void ConsoleSchematicFile::generateSchematicFile(DataOutputStream *dos, Level *l
tag.put(L"TileEntities", tileEntitiesTag); tag.put(L"TileEntities", tileEntitiesTag);
AABB *bb = AABB::newTemp(xStart,yStart,zStart,xEnd,yEnd,zEnd); AABB *bb = AABB::newTemp(xStart,yStart,zStart,xEnd,yEnd,zEnd);
vector<shared_ptr<Entity> > *entities = level->getEntities(nullptr, bb); vector<std::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_VAR(it, entities->begin()); it != entities->end(); ++it)
{ {
shared_ptr<Entity> e = *it; std::shared_ptr<Entity> e = *it;
bool mobCanBeSaved = false; bool mobCanBeSaved = false;
if(bSaveMobs) if(bSaveMobs)
@@ -1005,12 +1005,12 @@ 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<std::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<std::shared_ptr<TileEntity> > *result = new vector<std::shared_ptr<TileEntity> >;
for (AUTO_VAR(it, chunk->tileEntities.begin()); it != chunk->tileEntities.end(); ++it) for (AUTO_VAR(it, chunk->tileEntities.begin()); it != chunk->tileEntities.end(); ++it)
{ {
shared_ptr<TileEntity> te = it->second; std::shared_ptr<TileEntity> te = it->second;
if (te->x >= x0 && te->y >= y0 && te->z >= z0 && te->x < x1 && te->y < y1 && te->z < z1) if (te->x >= x0 && te->y >= y0 && te->z >= z0 && te->x < x1 && te->y < y1 && te->z < z1)
{ {
result->push_back(te); result->push_back(te);

View File

@@ -55,7 +55,7 @@ public:
} XboxSchematicInitParam; } XboxSchematicInitParam;
private: private:
int m_xSize, m_ySize, m_zSize; int m_xSize, m_ySize, m_zSize;
vector<shared_ptr<TileEntity> > m_tileEntities; vector<std::shared_ptr<TileEntity> > m_tileEntities;
vector< pair<Vec3 *, CompoundTag *> > m_entities; vector< pair<Vec3 *, CompoundTag *> > m_entities;
public: public:
@@ -83,7 +83,7 @@ private:
void load_tags(DataInputStream *dis); void load_tags(DataInputStream *dis);
static void getBlocksAndData(LevelChunk *chunk, byteArray *data, int x0, int y0, int z0, int x1, int y1, int z1, int &blocksP, int &dataP, int &blockLightP, int &skyLightP); static void getBlocksAndData(LevelChunk *chunk, byteArray *data, int x0, int y0, int z0, int x1, int y1, int z1, int &blocksP, int &dataP, int &blockLightP, int &skyLightP);
static vector<shared_ptr<TileEntity> > *getTileEntitiesInRegion(LevelChunk *chunk, int x0, int y0, int z0, int x1, int y1, int z1); static vector<std::shared_ptr<TileEntity> > *getTileEntitiesInRegion(LevelChunk *chunk, int x0, int y0, int z0, int x1, int y1, int z1);
void chunkCoordToSchematicCoord(AABB *destinationBox, int chunkX, int chunkZ, ESchematicRotation rot, int &schematicX, int &schematicZ); void chunkCoordToSchematicCoord(AABB *destinationBox, int chunkX, int chunkZ, ESchematicRotation rot, int &schematicX, int &schematicZ);
void schematicCoordToChunkCoord(AABB *destinationBox, double schematicX, double schematicZ, ESchematicRotation rot, double &chunkX, double &chunkZ); void schematicCoordToChunkCoord(AABB *destinationBox, double schematicX, double schematicZ, ESchematicRotation rot, double &chunkX, double &chunkZ);

View File

@@ -53,7 +53,7 @@ GameRuleDefinition *GameRule::getGameRuleDefinition()
} }
void GameRule::onUseTile(int tileId, int x, int y, int z) { m_definition->onUseTile(this,tileId,x,y,z); } void GameRule::onUseTile(int tileId, int x, int y, int z) { m_definition->onUseTile(this,tileId,x,y,z); }
void GameRule::onCollectItem(shared_ptr<ItemInstance> item) { m_definition->onCollectItem(this,item); } void GameRule::onCollectItem(std::shared_ptr<ItemInstance> item) { m_definition->onCollectItem(this,item); }
void GameRule::write(DataOutputStream *dos) void GameRule::write(DataOutputStream *dos)
{ {
@@ -63,7 +63,7 @@ void GameRule::write(DataOutputStream *dos)
{ {
wstring pName = (*it).first; wstring pName = (*it).first;
ValueType vType = (*it).second; ValueType vType = (*it).second;
dos->writeUTF( (*it).first ); dos->writeUTF( (*it).first );
dos->writeBoolean( vType.isPointer ); dos->writeBoolean( 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())

View File

@@ -51,7 +51,7 @@ public:
// All the hooks go here // All the hooks go here
void onUseTile(int tileId, int x, int y, int z); void onUseTile(int tileId, int x, int y, int z);
void onCollectItem(shared_ptr<ItemInstance> item); void onCollectItem(std::shared_ptr<ItemInstance> item);
// 4J-JEV: For saving. // 4J-JEV: For saving.
//CompoundTag *toTags(unordered_map<GameRuleDefinition *, int> *map); //CompoundTag *toTags(unordered_map<GameRuleDefinition *, int> *map);

View File

@@ -39,7 +39,7 @@ public:
virtual GameRuleDefinition *addChild(ConsoleGameRules::EGameRuleType ruleType); virtual GameRuleDefinition *addChild(ConsoleGameRules::EGameRuleType ruleType);
virtual void addAttribute(const wstring &attributeName, const wstring &attributeValue); virtual void addAttribute(const wstring &attributeName, const wstring &attributeValue);
virtual void populateGameRule(GameRulesInstance::EGameRulesInstanceType type, GameRule *rule); virtual void populateGameRule(GameRulesInstance::EGameRulesInstanceType type, GameRule *rule);
bool getComplete(GameRule *rule); bool getComplete(GameRule *rule);
@@ -53,8 +53,8 @@ public:
// Here we should have functions for all the hooks, with a GameRule* as the first parameter // Here we should have functions for all the hooks, with a GameRule* as the first parameter
virtual bool onUseTile(GameRule *rule, int tileId, int x, int y, int z) { return false; } virtual bool onUseTile(GameRule *rule, int tileId, int x, int y, int z) { return false; }
virtual bool onCollectItem(GameRule *rule, shared_ptr<ItemInstance> item) { return false; } virtual bool onCollectItem(GameRule *rule, std::shared_ptr<ItemInstance> item) { return false; }
virtual void postProcessPlayer(shared_ptr<Player> player) { } virtual void postProcessPlayer(std::shared_ptr<Player> player) { }
vector<GameRuleDefinition *> *enumerate(); vector<GameRuleDefinition *> *enumerate();
unordered_map<GameRuleDefinition *, int> *enumerateMap(); unordered_map<GameRuleDefinition *, int> *enumerateMap();

View File

@@ -11,7 +11,7 @@ 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;
} }
@@ -130,7 +130,7 @@ void UpdatePlayerRuleDefinition::addAttribute(const wstring &attributeName, cons
} }
} }
void UpdatePlayerRuleDefinition::postProcessPlayer(shared_ptr<Player> player) void UpdatePlayerRuleDefinition::postProcessPlayer(std::shared_ptr<Player> player)
{ {
if(m_bUpdateHealth) if(m_bUpdateHealth)
{ {

View File

@@ -13,7 +13,7 @@ private:
bool m_bUpdateHealth, m_bUpdateFood, m_bUpdateYRot, m_bUpdateInventory; bool m_bUpdateHealth, m_bUpdateFood, m_bUpdateYRot, m_bUpdateInventory;
int m_health; int m_health;
int m_food; int m_food;
Pos *m_spawnPos; Pos *m_spawnPos;
float m_yRot; float m_yRot;
@@ -22,12 +22,12 @@ public:
~UpdatePlayerRuleDefinition(); ~UpdatePlayerRuleDefinition();
virtual ConsoleGameRules::EGameRuleType getActionType() { return ConsoleGameRules::eGameRuleType_UpdatePlayerRule; } virtual ConsoleGameRules::EGameRuleType getActionType() { return ConsoleGameRules::eGameRuleType_UpdatePlayerRule; }
virtual void getChildren(vector<GameRuleDefinition *> *children); virtual void getChildren(vector<GameRuleDefinition *> *children);
virtual GameRuleDefinition *addChild(ConsoleGameRules::EGameRuleType ruleType); virtual GameRuleDefinition *addChild(ConsoleGameRules::EGameRuleType ruleType);
virtual void writeAttributes(DataOutputStream *dos, UINT numAttributes); virtual void writeAttributes(DataOutputStream *dos, UINT numAttributes);
virtual void addAttribute(const wstring &attributeName, const wstring &attributeValue); virtual void addAttribute(const wstring &attributeName, const wstring &attributeValue);
virtual void postProcessPlayer(shared_ptr<Player> player); virtual void postProcessPlayer(std::shared_ptr<Player> player);
}; };

View File

@@ -22,7 +22,7 @@ XboxStructureActionPlaceContainer::~XboxStructureActionPlaceContainer()
// 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)
{ {
@@ -78,8 +78,8 @@ bool XboxStructureActionPlaceContainer::placeContainerInLevel(StructurePiece *st
} }
level->setTile( worldX, worldY, worldZ, m_tile ); level->setTile( worldX, worldY, worldZ, m_tile );
shared_ptr<Container> container = dynamic_pointer_cast<Container>(level->getTileEntity( worldX, worldY, worldZ )); std::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 )
{ {

View File

@@ -54,7 +54,7 @@ bool XboxStructureActionPlaceSpawner::placeSpawnerInLevel(StructurePiece *struct
} }
level->setTile( worldX, worldY, worldZ, m_tile ); level->setTile( worldX, worldY, worldZ, m_tile );
shared_ptr<MobSpawnerTileEntity> entity = dynamic_pointer_cast<MobSpawnerTileEntity>(level->getTileEntity( worldX, worldY, worldZ )); std::shared_ptr<MobSpawnerTileEntity> entity = dynamic_pointer_cast<MobSpawnerTileEntity>(level->getTileEntity( worldX, worldY, worldZ ));
#ifndef _CONTENT_PACKAGE #ifndef _CONTENT_PACKAGE
wprintf(L"XboxStructureActionPlaceSpawner - placing a %ls spawner at (%d,%d,%d)\n", m_entityId.c_str(), worldX, worldY, worldZ); wprintf(L"XboxStructureActionPlaceSpawner - placing a %ls spawner at (%d,%d,%d)\n", m_entityId.c_str(), worldX, worldY, worldZ);

View File

@@ -316,7 +316,7 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, LPVOID lpParame
return false; return false;
} }
connection->send( shared_ptr<PreLoginPacket>( new PreLoginPacket(minecraft->user->name) ) ); connection->send( std::shared_ptr<PreLoginPacket>( new PreLoginPacket(minecraft->user->name) ) );
// Tick connection until we're ready to go. The stages involved in this are: // Tick connection until we're ready to go. The stages involved in this are:
// (1) Creating the ClientConnection sends a prelogin packet to the server // (1) Creating the ClientConnection sends a prelogin packet to the server
@@ -403,7 +403,7 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, LPVOID lpParame
// Open the socket on the server end to accept incoming data // Open the socket on the server end to accept incoming data
Socket::addIncomingSocket(socket); Socket::addIncomingSocket(socket);
connection->send( shared_ptr<PreLoginPacket>( new PreLoginPacket(convStringToWstring( ProfileManager.GetGamertag(idx) )) ) ); connection->send( std::shared_ptr<PreLoginPacket>( new PreLoginPacket(convStringToWstring( ProfileManager.GetGamertag(idx) )) ) );
createdConnections.push_back( connection ); createdConnections.push_back( connection );
@@ -1134,7 +1134,7 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc( void* lpParam )
PlayerList *players = pServer->getPlayers(); PlayerList *players = pServer->getPlayers();
for(AUTO_VAR(it, players->players.begin()); it < players->players.end(); ++it) for(AUTO_VAR(it, players->players.begin()); it < players->players.end(); ++it)
{ {
shared_ptr<ServerPlayer> servPlayer = *it; std::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);
@@ -1202,7 +1202,7 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc( void* lpParam )
PlayerList *players = pServer->getPlayers(); PlayerList *players = pServer->getPlayers();
for(AUTO_VAR(it, players->players.begin()); it < players->players.end(); ++it) for(AUTO_VAR(it, players->players.begin()); it < players->players.end(); ++it)
{ {
shared_ptr<ServerPlayer> servPlayer = *it; std::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) );
@@ -1391,7 +1391,7 @@ void CGameNetworkManager::CreateSocket( INetworkPlayer *pNetworkPlayer, bool loc
Minecraft *pMinecraft = Minecraft::GetInstance(); Minecraft *pMinecraft = Minecraft::GetInstance();
Socket *socket = NULL; Socket *socket = NULL;
shared_ptr<MultiplayerLocalPlayer> mpPlayer = pMinecraft->localplayers[pNetworkPlayer->GetUserIndex()]; std::shared_ptr<MultiplayerLocalPlayer> mpPlayer = pMinecraft->localplayers[pNetworkPlayer->GetUserIndex()];
if( localPlayer && mpPlayer != NULL && mpPlayer->connection != NULL) if( localPlayer && mpPlayer != NULL && mpPlayer->connection != NULL)
{ {
// If we already have a MultiplayerLocalPlayer here then we are doing a session type change // If we already have a MultiplayerLocalPlayer here then we are doing a session type change
@@ -1428,7 +1428,7 @@ void CGameNetworkManager::CreateSocket( INetworkPlayer *pNetworkPlayer, bool loc
if( connection->createdOk ) if( connection->createdOk )
{ {
connection->send( shared_ptr<PreLoginPacket>( new PreLoginPacket( pNetworkPlayer->GetOnlineName() ) ) ); connection->send( std::shared_ptr<PreLoginPacket>( new PreLoginPacket( pNetworkPlayer->GetOnlineName() ) ) );
pMinecraft->addPendingLocalConnection(idx, connection); pMinecraft->addPendingLocalConnection(idx, connection);
} }
else else

View File

@@ -24,7 +24,7 @@ ChangeStateConstraint::ChangeStateConstraint( Tutorial *tutorial, eTutorial_Stat
m_tutorial = tutorial; m_tutorial = tutorial;
m_targetState = targetState; m_targetState = targetState;
m_sourceStatesCount = sourceStatesCount; m_sourceStatesCount = sourceStatesCount;
m_bHasChanged = false; m_bHasChanged = false;
m_changedFromState = e_Tutorial_State_None; m_changedFromState = e_Tutorial_State_None;
@@ -59,11 +59,11 @@ void ChangeStateConstraint::tick(int iPad)
if(originalPrivileges != playerPrivs) if(originalPrivileges != playerPrivs)
{ {
// Send update settings packet to server // Send update settings packet to server
Minecraft *pMinecraft = Minecraft::GetInstance(); Minecraft *pMinecraft = Minecraft::GetInstance();
shared_ptr<MultiplayerLocalPlayer> player = minecraft->localplayers[iPad]; std::shared_ptr<MultiplayerLocalPlayer> player = minecraft->localplayers[iPad];
if(player != NULL && player->connection && player->connection->getNetworkPlayer() != NULL) if(player != NULL && player->connection && player->connection->getNetworkPlayer() != NULL)
{ {
player->connection->send( shared_ptr<PlayerInfoPacket>( new PlayerInfoPacket( player->connection->getNetworkPlayer()->GetSmallId(), -1, playerPrivs) ) ); player->connection->send( std::shared_ptr<PlayerInfoPacket>( new PlayerInfoPacket( player->connection->getNetworkPlayer()->GetSmallId(), -1, playerPrivs) ) );
} }
} }
} }
@@ -100,11 +100,11 @@ void ChangeStateConstraint::tick(int iPad)
if(originalPrivileges != playerPrivs) if(originalPrivileges != playerPrivs)
{ {
// Send update settings packet to server // Send update settings packet to server
Minecraft *pMinecraft = Minecraft::GetInstance(); Minecraft *pMinecraft = Minecraft::GetInstance();
shared_ptr<MultiplayerLocalPlayer> player = minecraft->localplayers[iPad]; std::shared_ptr<MultiplayerLocalPlayer> player = minecraft->localplayers[iPad];
if(player != NULL && player->connection && player->connection->getNetworkPlayer() != NULL) if(player != NULL && player->connection && player->connection->getNetworkPlayer() != NULL)
{ {
player->connection->send( shared_ptr<PlayerInfoPacket>( new PlayerInfoPacket( player->connection->getNetworkPlayer()->GetSmallId(), -1, playerPrivs) ) ); player->connection->send( std::shared_ptr<PlayerInfoPacket>( new PlayerInfoPacket( player->connection->getNetworkPlayer()->GetSmallId(), -1, playerPrivs) ) );
} }
} }
} }
@@ -124,11 +124,11 @@ void ChangeStateConstraint::tick(int iPad)
if(originalPrivileges != playerPrivs) if(originalPrivileges != playerPrivs)
{ {
// Send update settings packet to server // Send update settings packet to server
Minecraft *pMinecraft = Minecraft::GetInstance(); Minecraft *pMinecraft = Minecraft::GetInstance();
shared_ptr<MultiplayerLocalPlayer> player = minecraft->localplayers[iPad]; std::shared_ptr<MultiplayerLocalPlayer> player = minecraft->localplayers[iPad];
if(player != NULL && player->connection && player->connection->getNetworkPlayer() != NULL) if(player != NULL && player->connection && player->connection->getNetworkPlayer() != NULL)
{ {
player->connection->send( shared_ptr<PlayerInfoPacket>( new PlayerInfoPacket( player->connection->getNetworkPlayer()->GetSmallId(), -1, playerPrivs) ) ); player->connection->send( std::shared_ptr<PlayerInfoPacket>( new PlayerInfoPacket( player->connection->getNetworkPlayer()->GetSmallId(), -1, playerPrivs) ) );
} }
} }
} }

View File

@@ -4,7 +4,7 @@
CompleteUsingItemTask::CompleteUsingItemTask(Tutorial *tutorial, int descriptionId, int itemIds[], unsigned int itemIdsLength, bool enablePreCompletion) CompleteUsingItemTask::CompleteUsingItemTask(Tutorial *tutorial, int descriptionId, int itemIds[], unsigned int itemIdsLength, bool enablePreCompletion)
: TutorialTask( tutorial, descriptionId, enablePreCompletion, NULL) : TutorialTask( tutorial, descriptionId, enablePreCompletion, NULL)
{ {
m_iValidItemsA= new int [itemIdsLength]; m_iValidItemsA= new int [itemIdsLength];
for(int i=0;i<itemIdsLength;i++) for(int i=0;i<itemIdsLength;i++)
{ {
@@ -23,7 +23,7 @@ bool CompleteUsingItemTask::isCompleted()
return bIsCompleted; return bIsCompleted;
} }
void CompleteUsingItemTask::completeUsingItem(shared_ptr<ItemInstance> item) void CompleteUsingItemTask::completeUsingItem(std::shared_ptr<ItemInstance> item)
{ {
if(!hasBeenActivated() && !isPreCompletionEnabled()) return; if(!hasBeenActivated() && !isPreCompletionEnabled()) return;
for(int i=0;i<m_iValidItemsCount;i++) for(int i=0;i<m_iValidItemsCount;i++)

View File

@@ -16,5 +16,5 @@ public:
CompleteUsingItemTask(Tutorial *tutorial, int descriptionId, int itemIds[], unsigned int itemIdsLength, bool enablePreCompletion = false); CompleteUsingItemTask(Tutorial *tutorial, int descriptionId, int itemIds[], unsigned int itemIdsLength, bool enablePreCompletion = false);
virtual ~CompleteUsingItemTask(); virtual ~CompleteUsingItemTask();
virtual bool isCompleted(); virtual bool isCompleted();
virtual void completeUsingItem(shared_ptr<ItemInstance> item); virtual void completeUsingItem(std::shared_ptr<ItemInstance> item);
}; };

View File

@@ -40,7 +40,7 @@ CraftTask::~CraftTask()
delete[] m_auxValues; delete[] m_auxValues;
} }
void CraftTask::onCrafted(shared_ptr<ItemInstance> item) void CraftTask::onCrafted(std::shared_ptr<ItemInstance> item)
{ {
#ifndef _CONTENT_PACKAGE #ifndef _CONTENT_PACKAGE
wprintf(L"CraftTask::onCrafted - %ls\n", item->toString().c_str() ); wprintf(L"CraftTask::onCrafted - %ls\n", item->toString().c_str() );

View File

@@ -14,7 +14,7 @@ public:
~CraftTask(); ~CraftTask();
virtual bool isCompleted() { return bIsCompleted; } virtual bool isCompleted() { return bIsCompleted; }
virtual void onCrafted(shared_ptr<ItemInstance> item); virtual void onCrafted(std::shared_ptr<ItemInstance> item);
private: private:
int *m_items; int *m_items;

View File

@@ -20,7 +20,7 @@ DiggerItemHint::DiggerItemHint(eTutorial_Hint id, Tutorial *tutorial, int descri
tutorial->addMessage(IDS_TUTORIAL_HINT_ATTACK_WITH_TOOL, true); tutorial->addMessage(IDS_TUTORIAL_HINT_ATTACK_WITH_TOOL, true);
} }
int DiggerItemHint::startDestroyBlock(shared_ptr<ItemInstance> item, Tile *tile) int DiggerItemHint::startDestroyBlock(std::shared_ptr<ItemInstance> item, Tile *tile)
{ {
if(item != NULL) if(item != NULL)
{ {
@@ -46,7 +46,7 @@ int DiggerItemHint::startDestroyBlock(shared_ptr<ItemInstance> item, Tile *tile)
return -1; return -1;
} }
int DiggerItemHint::attack(shared_ptr<ItemInstance> item, shared_ptr<Entity> entity) int DiggerItemHint::attack(std::shared_ptr<ItemInstance> item, std::shared_ptr<Entity> entity)
{ {
if(item != NULL) if(item != NULL)
{ {

View File

@@ -13,6 +13,6 @@ private:
public: public:
DiggerItemHint(eTutorial_Hint id, Tutorial *tutorial, int descriptionId, int items[], unsigned int itemsLength); DiggerItemHint(eTutorial_Hint id, Tutorial *tutorial, int descriptionId, int items[], unsigned int itemsLength);
virtual int startDestroyBlock(shared_ptr<ItemInstance> item, Tile *tile); virtual int startDestroyBlock(std::shared_ptr<ItemInstance> item, Tile *tile);
virtual int attack(shared_ptr<ItemInstance> item, shared_ptr<Entity> entity); virtual int attack(std::shared_ptr<ItemInstance> item, std::shared_ptr<Entity> entity);
}; };

View File

@@ -1,7 +1,7 @@
#include "stdafx.h" #include "stdafx.h"
#include "PickupTask.h" #include "PickupTask.h"
void PickupTask::onTake(shared_ptr<ItemInstance> item, unsigned int invItemCountAnyAux, unsigned int invItemCountThisAux) void PickupTask::onTake(std::shared_ptr<ItemInstance> item, unsigned int invItemCountAnyAux, unsigned int invItemCountThisAux)
{ {
if(item->id == m_itemId) if(item->id == m_itemId)
{ {

View File

@@ -17,7 +17,7 @@ public:
{} {}
virtual bool isCompleted() { return bIsCompleted; } virtual bool isCompleted() { return bIsCompleted; }
virtual void onTake(shared_ptr<ItemInstance> item, unsigned int invItemCountAnyAux, unsigned int invItemCountThisAux); virtual void onTake(std::shared_ptr<ItemInstance> item, unsigned int invItemCountAnyAux, unsigned int invItemCountThisAux);
private: private:
int m_itemId; int m_itemId;

View File

@@ -111,7 +111,7 @@ bool ProcedureCompoundTask::isCompleted()
return allCompleted; return allCompleted;
} }
void ProcedureCompoundTask::onCrafted(shared_ptr<ItemInstance> item) void ProcedureCompoundTask::onCrafted(std::shared_ptr<ItemInstance> item)
{ {
AUTO_VAR(itEnd, m_taskSequence.end()); AUTO_VAR(itEnd, m_taskSequence.end());
for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it) for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it)
@@ -222,7 +222,7 @@ bool ProcedureCompoundTask::AllowFade()
return allowFade; return allowFade;
} }
void ProcedureCompoundTask::useItemOn(Level *level, shared_ptr<ItemInstance> item, int x, int y, int z,bool bTestUseOnly) void ProcedureCompoundTask::useItemOn(Level *level, std::shared_ptr<ItemInstance> item, int x, int y, int z,bool bTestUseOnly)
{ {
AUTO_VAR(itEnd, m_taskSequence.end()); AUTO_VAR(itEnd, m_taskSequence.end());
for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it) for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it)
@@ -232,7 +232,7 @@ void ProcedureCompoundTask::useItemOn(Level *level, shared_ptr<ItemInstance> ite
} }
} }
void ProcedureCompoundTask::useItem(shared_ptr<ItemInstance> item, bool bTestUseOnly) void ProcedureCompoundTask::useItem(std::shared_ptr<ItemInstance> item, bool bTestUseOnly)
{ {
AUTO_VAR(itEnd, m_taskSequence.end()); AUTO_VAR(itEnd, m_taskSequence.end());
for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it) for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it)
@@ -242,7 +242,7 @@ void ProcedureCompoundTask::useItem(shared_ptr<ItemInstance> item, bool bTestUse
} }
} }
void ProcedureCompoundTask::onTake(shared_ptr<ItemInstance> item, unsigned int invItemCountAnyAux, unsigned int invItemCountThisAux) void ProcedureCompoundTask::onTake(std::shared_ptr<ItemInstance> item, unsigned int invItemCountAnyAux, unsigned int invItemCountThisAux)
{ {
AUTO_VAR(itEnd, m_taskSequence.end()); AUTO_VAR(itEnd, m_taskSequence.end());
for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it) for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it)

View File

@@ -18,7 +18,7 @@ public:
virtual int getDescriptionId(); virtual int getDescriptionId();
virtual int getPromptId(); virtual int getPromptId();
virtual bool isCompleted(); virtual bool isCompleted();
virtual void onCrafted(shared_ptr<ItemInstance> item); virtual void onCrafted(std::shared_ptr<ItemInstance> item);
virtual void handleUIInput(int iAction); virtual void handleUIInput(int iAction);
virtual void setAsCurrentTask(bool active = true); virtual void setAsCurrentTask(bool active = true);
virtual bool ShowMinimumTime(); virtual bool ShowMinimumTime();
@@ -26,9 +26,9 @@ public:
virtual void setShownForMinimumTime(); virtual void setShownForMinimumTime();
virtual bool AllowFade(); virtual bool AllowFade();
virtual void useItemOn(Level *level, shared_ptr<ItemInstance> item, int x, int y, int z, bool bTestUseOnly=false); virtual void useItemOn(Level *level, std::shared_ptr<ItemInstance> item, int x, int y, int z, bool bTestUseOnly=false);
virtual void useItem(shared_ptr<ItemInstance> item, bool bTestUseOnly=false); virtual void useItem(std::shared_ptr<ItemInstance> item, bool bTestUseOnly=false);
virtual void onTake(shared_ptr<ItemInstance> item, unsigned int invItemCountAnyAux, unsigned int invItemCountThisAux); virtual void onTake(std::shared_ptr<ItemInstance> item, unsigned int invItemCountAnyAux, unsigned int invItemCountThisAux);
virtual void onStateChange(eTutorial_State newState); virtual void onStateChange(eTutorial_State newState);
private: private:

View File

@@ -17,7 +17,7 @@ TakeItemHint::TakeItemHint(eTutorial_Hint id, Tutorial *tutorial, int items[], u
} }
} }
bool TakeItemHint::onTake(shared_ptr<ItemInstance> item) bool TakeItemHint::onTake(std::shared_ptr<ItemInstance> item)
{ {
if(item != NULL) if(item != NULL)
{ {

View File

@@ -15,5 +15,5 @@ public:
TakeItemHint(eTutorial_Hint id, Tutorial *tutorial, int items[], unsigned int itemsLength); TakeItemHint(eTutorial_Hint id, Tutorial *tutorial, int items[], unsigned int itemsLength);
~TakeItemHint(); ~TakeItemHint();
virtual bool onTake( shared_ptr<ItemInstance> item ); virtual bool onTake( std::shared_ptr<ItemInstance> item );
}; };

View File

@@ -1681,7 +1681,7 @@ 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, std::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_VAR(it, activeTasks[m_CurrentState].begin()); it < activeTasks[m_CurrentState].end(); ++it)
{ {
@@ -1690,7 +1690,7 @@ void Tutorial::useItemOn(Level *level, shared_ptr<ItemInstance> item, int x, int
} }
} }
void Tutorial::useItemOn(shared_ptr<ItemInstance> item, bool bTestUseOnly) void Tutorial::useItemOn(std::shared_ptr<ItemInstance> item, bool bTestUseOnly)
{ {
for(AUTO_VAR(it, activeTasks[m_CurrentState].begin()); it < activeTasks[m_CurrentState].end(); ++it) for(AUTO_VAR(it, activeTasks[m_CurrentState].begin()); it < activeTasks[m_CurrentState].end(); ++it)
{ {
@@ -1699,7 +1699,7 @@ void Tutorial::useItemOn(shared_ptr<ItemInstance> item, bool bTestUseOnly)
} }
} }
void Tutorial::completeUsingItem(shared_ptr<ItemInstance> item) void Tutorial::completeUsingItem(std::shared_ptr<ItemInstance> item)
{ {
for(AUTO_VAR(it, activeTasks[m_CurrentState].begin()); it < activeTasks[m_CurrentState].end(); ++it) for(AUTO_VAR(it, activeTasks[m_CurrentState].begin()); it < activeTasks[m_CurrentState].end(); ++it)
{ {
@@ -1718,7 +1718,7 @@ void Tutorial::completeUsingItem(shared_ptr<ItemInstance> item)
} }
} }
void Tutorial::startDestroyBlock(shared_ptr<ItemInstance> item, Tile *tile) void Tutorial::startDestroyBlock(std::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_VAR(it, hints[m_CurrentState].begin()); it < hints[m_CurrentState].end(); ++it)
@@ -1754,7 +1754,7 @@ void Tutorial::destroyBlock(Tile *tile)
} }
} }
void Tutorial::attack(shared_ptr<Player> player, shared_ptr<Entity> entity) void Tutorial::attack(std::shared_ptr<Player> player, std::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_VAR(it, hints[m_CurrentState].begin()); it < hints[m_CurrentState].end(); ++it)
@@ -1772,7 +1772,7 @@ void Tutorial::attack(shared_ptr<Player> player, shared_ptr<Entity> entity)
} }
} }
void Tutorial::itemDamaged(shared_ptr<ItemInstance> item) void Tutorial::itemDamaged(std::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_VAR(it, hints[m_CurrentState].begin()); it < hints[m_CurrentState].end(); ++it)
@@ -1803,7 +1803,7 @@ void Tutorial::handleUIInput(int iAction)
currentTask[m_CurrentState]->handleUIInput(iAction); currentTask[m_CurrentState]->handleUIInput(iAction);
} }
void Tutorial::createItemSelected(shared_ptr<ItemInstance> item, bool canMake) void Tutorial::createItemSelected(std::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_VAR(it, hints[m_CurrentState].begin()); it < hints[m_CurrentState].end(); ++it)
@@ -1821,7 +1821,7 @@ void Tutorial::createItemSelected(shared_ptr<ItemInstance> item, bool canMake)
} }
} }
void Tutorial::onCrafted(shared_ptr<ItemInstance> item) void Tutorial::onCrafted(std::shared_ptr<ItemInstance> item)
{ {
for(unsigned int state = 0; state < e_Tutorial_State_Max; ++state) for(unsigned int state = 0; state < e_Tutorial_State_Max; ++state)
{ {
@@ -1833,7 +1833,7 @@ void Tutorial::onCrafted(shared_ptr<ItemInstance> item)
} }
} }
void Tutorial::onTake(shared_ptr<ItemInstance> item, unsigned int invItemCountAnyAux, unsigned int invItemCountThisAux) void Tutorial::onTake(std::shared_ptr<ItemInstance> item, unsigned int invItemCountAnyAux, unsigned int invItemCountThisAux)
{ {
if( !m_hintDisplayed ) if( !m_hintDisplayed )
{ {
@@ -1860,7 +1860,7 @@ void Tutorial::onTake(shared_ptr<ItemInstance> item, unsigned int invItemCountAn
} }
} }
void Tutorial::onSelectedItemChanged(shared_ptr<ItemInstance> item) void Tutorial::onSelectedItemChanged(std::shared_ptr<ItemInstance> item)
{ {
// We only handle this if we are in a state that allows changing based on the selected item // We only handle this if we are in a state that allows changing based on the selected item
// Menus and states like riding in a minecart will NOT allow this // Menus and states like riding in a minecart will NOT allow this

View File

@@ -11,7 +11,7 @@ using namespace std;
// #define TUTORIAL_MINIMUM_DISPLAY_MESSAGE_TIME 2000 // #define TUTORIAL_MINIMUM_DISPLAY_MESSAGE_TIME 2000
// #define TUTORIAL_REMINDER_TIME (TUTORIAL_DISPLAY_MESSAGE_TIME + 20000) // #define TUTORIAL_REMINDER_TIME (TUTORIAL_DISPLAY_MESSAGE_TIME + 20000)
// #define TUTORIAL_CONSTRAINT_DELAY_REMOVE_TICKS 15 // #define TUTORIAL_CONSTRAINT_DELAY_REMOVE_TICKS 15
// //
// // 0-24000 // // 0-24000
// #define TUTORIAL_FREEZE_TIME_VALUE 8000 // #define TUTORIAL_FREEZE_TIME_VALUE 8000
@@ -151,19 +151,19 @@ public:
void showTutorialPopup(bool show); void showTutorialPopup(bool show);
void useItemOn(Level *level, shared_ptr<ItemInstance> item, int x, int y, int z,bool bTestUseOnly=false); void useItemOn(Level *level, std::shared_ptr<ItemInstance> item, int x, int y, int z,bool bTestUseOnly=false);
void useItemOn(shared_ptr<ItemInstance> item, bool bTestUseOnly=false); void useItemOn(std::shared_ptr<ItemInstance> item, bool bTestUseOnly=false);
void completeUsingItem(shared_ptr<ItemInstance> item); void completeUsingItem(std::shared_ptr<ItemInstance> item);
void startDestroyBlock(shared_ptr<ItemInstance> item, Tile *tile); void startDestroyBlock(std::shared_ptr<ItemInstance> item, Tile *tile);
void destroyBlock(Tile *tile); void destroyBlock(Tile *tile);
void attack(shared_ptr<Player> player, shared_ptr<Entity> entity); void attack(std::shared_ptr<Player> player, std::shared_ptr<Entity> entity);
void itemDamaged(shared_ptr<ItemInstance> item); void itemDamaged(std::shared_ptr<ItemInstance> item);
void handleUIInput(int iAction); void handleUIInput(int iAction);
void createItemSelected(shared_ptr<ItemInstance> item, bool canMake); void createItemSelected(std::shared_ptr<ItemInstance> item, bool canMake);
void onCrafted(shared_ptr<ItemInstance> item); void onCrafted(std::shared_ptr<ItemInstance> item);
void onTake(shared_ptr<ItemInstance> item, unsigned int invItemCountAnyAux, unsigned int invItemCountThisAux); void onTake(std::shared_ptr<ItemInstance> item, unsigned int invItemCountAnyAux, unsigned int invItemCountThisAux);
void onSelectedItemChanged(shared_ptr<ItemInstance> item); void onSelectedItemChanged(std::shared_ptr<ItemInstance> item);
void onLookAt(int id, int iData=0); void onLookAt(int id, int iData=0);
void onLookAtEntity(eINSTANCEOF type); void onLookAtEntity(eINSTANCEOF type);
void onEffectChanged(MobEffect *effect, bool bRemoved=false); void onEffectChanged(MobEffect *effect, bool bRemoved=false);

View File

@@ -7,14 +7,14 @@
#include "..\..\Minecraft.h" #include "..\..\Minecraft.h"
#include "..\..\MultiplayerLocalPlayer.h" #include "..\..\MultiplayerLocalPlayer.h"
TutorialHint::TutorialHint(eTutorial_Hint id, Tutorial *tutorial, int descriptionId, eHintType type, bool allowFade /*= true*/) TutorialHint::TutorialHint(eTutorial_Hint id, Tutorial *tutorial, int descriptionId, eHintType type, bool allowFade /*= true*/)
: m_id( id ), m_tutorial(tutorial), m_descriptionId( descriptionId ), m_type( type ), m_counter( 0 ), : m_id( id ), m_tutorial(tutorial), m_descriptionId( descriptionId ), m_type( type ), m_counter( 0 ),
m_lastTile( NULL ), m_hintNeeded( true ), m_allowFade(allowFade) m_lastTile( NULL ), m_hintNeeded( true ), m_allowFade(allowFade)
{ {
tutorial->addMessage(descriptionId, type != e_Hint_NoIngredients); tutorial->addMessage(descriptionId, type != e_Hint_NoIngredients);
} }
int TutorialHint::startDestroyBlock(shared_ptr<ItemInstance> item, Tile *tile) int TutorialHint::startDestroyBlock(std::shared_ptr<ItemInstance> item, Tile *tile)
{ {
int returnVal = -1; int returnVal = -1;
switch(m_type) switch(m_type)
@@ -59,7 +59,7 @@ int TutorialHint::destroyBlock(Tile *tile)
return returnVal; return returnVal;
} }
int TutorialHint::attack(shared_ptr<ItemInstance> item, shared_ptr<Entity> entity) int TutorialHint::attack(std::shared_ptr<ItemInstance> item, std::shared_ptr<Entity> entity)
{ {
/* /*
switch(m_type) switch(m_type)
@@ -71,7 +71,7 @@ int TutorialHint::attack(shared_ptr<ItemInstance> item, shared_ptr<Entity> entit
return -1; return -1;
} }
int TutorialHint::createItemSelected(shared_ptr<ItemInstance> item, bool canMake) int TutorialHint::createItemSelected(std::shared_ptr<ItemInstance> item, bool canMake)
{ {
int returnVal = -1; int returnVal = -1;
switch(m_type) switch(m_type)
@@ -86,7 +86,7 @@ int TutorialHint::createItemSelected(shared_ptr<ItemInstance> item, bool canMake
return returnVal; return returnVal;
} }
int TutorialHint::itemDamaged(shared_ptr<ItemInstance> item) int TutorialHint::itemDamaged(std::shared_ptr<ItemInstance> item)
{ {
int returnVal = -1; int returnVal = -1;
switch(m_type) switch(m_type)
@@ -100,7 +100,7 @@ int TutorialHint::itemDamaged(shared_ptr<ItemInstance> item)
return returnVal; return returnVal;
} }
bool TutorialHint::onTake( shared_ptr<ItemInstance> item ) bool TutorialHint::onTake( std::shared_ptr<ItemInstance> item )
{ {
return false; return false;
} }
@@ -121,7 +121,7 @@ int TutorialHint::tick()
switch(m_type) switch(m_type)
{ {
case e_Hint_SwimUp: case e_Hint_SwimUp:
if( Minecraft::GetInstance()->localplayers[m_tutorial->getPad()]->isUnderLiquid(Material::water) ) returnVal = m_descriptionId; if( Minecraft::GetInstance()->localplayers[m_tutorial->getPad()]->isUnderLiquid(Material::water) ) returnVal = m_descriptionId;
break; break;
} }
return returnVal; return returnVal;

View File

@@ -10,7 +10,7 @@ class Tutorial;
class TutorialHint class TutorialHint
{ {
public: public:
enum eHintType enum eHintType
{ {
e_Hint_DiggerItem, e_Hint_DiggerItem,
@@ -40,12 +40,12 @@ public:
eTutorial_Hint getId() { return m_id; } eTutorial_Hint getId() { return m_id; }
virtual int startDestroyBlock(shared_ptr<ItemInstance> item, Tile *tile); virtual int startDestroyBlock(std::shared_ptr<ItemInstance> item, Tile *tile);
virtual int destroyBlock(Tile *tile); virtual int destroyBlock(Tile *tile);
virtual int attack(shared_ptr<ItemInstance> item, shared_ptr<Entity> entity); virtual int attack(std::shared_ptr<ItemInstance> item, std::shared_ptr<Entity> entity);
virtual int createItemSelected(shared_ptr<ItemInstance> item, bool canMake); virtual int createItemSelected(std::shared_ptr<ItemInstance> item, bool canMake);
virtual int itemDamaged(shared_ptr<ItemInstance> item); virtual int itemDamaged(std::shared_ptr<ItemInstance> item);
virtual bool onTake( shared_ptr<ItemInstance> item ); virtual bool onTake( std::shared_ptr<ItemInstance> item );
virtual bool onLookAt(int id, int iData=0); virtual bool onLookAt(int id, int iData=0);
virtual bool onLookAtEntity(eINSTANCEOF type); virtual bool onLookAtEntity(eINSTANCEOF type);
virtual int tick(); virtual int tick();

View File

@@ -36,7 +36,7 @@ bool TutorialMode::destroyBlock(int x, int y, int z, int face)
int t = minecraft->level->getTile(x, y, z); int t = minecraft->level->getTile(x, y, z);
tutorial->destroyBlock(Tile::tiles[t]); tutorial->destroyBlock(Tile::tiles[t]);
} }
shared_ptr<ItemInstance> item = minecraft->player->getSelectedItem(); std::shared_ptr<ItemInstance> item = minecraft->player->getSelectedItem();
int damageBefore; int damageBefore;
if(item != NULL) if(item != NULL)
{ {
@@ -47,7 +47,7 @@ bool TutorialMode::destroyBlock(int x, int y, int z, int face)
if(!tutorial->m_allTutorialsComplete) if(!tutorial->m_allTutorialsComplete)
{ {
if ( item != NULL && item->isDamageableItem() ) if ( item != NULL && item->isDamageableItem() )
{ {
int max = item->getMaxDamage(); int max = item->getMaxDamage();
int damageNow = item->getDamageValue(); int damageNow = item->getDamageValue();
@@ -78,7 +78,7 @@ void TutorialMode::tick()
*/ */
} }
bool TutorialMode::useItemOn(shared_ptr<Player> player, Level *level, shared_ptr<ItemInstance> item, int x, int y, int z, int face, Vec3 *hit, bool bTestUseOnly, bool *pbUsedItem) bool TutorialMode::useItemOn(std::shared_ptr<Player> player, Level *level, std::shared_ptr<ItemInstance> item, int x, int y, int z, int face, Vec3 *hit, bool bTestUseOnly, bool *pbUsedItem)
{ {
bool haveItem = false; bool haveItem = false;
int itemCount = 0; int itemCount = 0;
@@ -87,7 +87,7 @@ bool TutorialMode::useItemOn(shared_ptr<Player> player, Level *level, shared_ptr
tutorial->useItemOn(level, item, x, y, z, bTestUseOnly); tutorial->useItemOn(level, item, x, y, z, bTestUseOnly);
if(!bTestUseOnly) if(!bTestUseOnly)
{ {
if(item != NULL) if(item != NULL)
{ {
haveItem = true; haveItem = true;
@@ -110,7 +110,7 @@ bool TutorialMode::useItemOn(shared_ptr<Player> player, Level *level, shared_ptr
return result; return result;
} }
void TutorialMode::attack(shared_ptr<Player> player, shared_ptr<Entity> entity) void TutorialMode::attack(std::shared_ptr<Player> player, std::shared_ptr<Entity> entity)
{ {
if(!tutorial->m_allTutorialsComplete) if(!tutorial->m_allTutorialsComplete)
tutorial->attack(player, entity); tutorial->attack(player, entity);

View File

@@ -19,8 +19,8 @@ public:
virtual void startDestroyBlock(int x, int y, int z, int face); virtual void startDestroyBlock(int x, int y, int z, int face);
virtual bool destroyBlock(int x, int y, int z, int face); virtual bool destroyBlock(int x, int y, int z, int face);
virtual void tick(); virtual void tick();
virtual bool useItemOn(shared_ptr<Player> player, Level *level, shared_ptr<ItemInstance> item, int x, int y, int z, int face, Vec3 *hit, bool bTestUseOnly=false, bool *pbUsedItem=NULL); virtual bool useItemOn(std::shared_ptr<Player> player, Level *level, std::shared_ptr<ItemInstance> item, int x, int y, int z, int face, Vec3 *hit, bool bTestUseOnly=false, bool *pbUsedItem=NULL);
virtual void attack(shared_ptr<Player> player, shared_ptr<Entity> entity); virtual void attack(std::shared_ptr<Player> player, std::shared_ptr<Entity> entity);
virtual bool isInputAllowed(int mapping); virtual bool isInputAllowed(int mapping);

View File

@@ -26,7 +26,7 @@ protected:
bool m_bAllowFade; bool m_bAllowFade;
bool m_bTaskReminders; bool m_bTaskReminders;
bool m_bShowMinimumTime; bool m_bShowMinimumTime;
protected: protected:
bool bIsCompleted; bool bIsCompleted;
bool m_bShownForMinimumTime; bool m_bShownForMinimumTime;
@@ -43,7 +43,7 @@ public:
virtual eTutorial_CompletionAction getCompletionAction() { return e_Tutorial_Completion_None; } virtual eTutorial_CompletionAction getCompletionAction() { return e_Tutorial_Completion_None; }
virtual bool isPreCompletionEnabled() { return enablePreCompletion; } virtual bool isPreCompletionEnabled() { return enablePreCompletion; }
virtual void taskCompleted(); virtual void taskCompleted();
virtual void enableConstraints(bool enable, bool delayRemove = false); virtual void enableConstraints(bool enable, bool delayRemove = false);
virtual void setAsCurrentTask(bool active = true); virtual void setAsCurrentTask(bool active = true);
virtual void setShownForMinimumTime() { m_bShownForMinimumTime = true; } virtual void setShownForMinimumTime() { m_bShownForMinimumTime = true; }
@@ -52,12 +52,12 @@ public:
bool TaskReminders() { return m_bTaskReminders;} bool TaskReminders() { return m_bTaskReminders;}
virtual bool ShowMinimumTime() { return m_bShowMinimumTime;} virtual bool ShowMinimumTime() { return m_bShowMinimumTime;}
virtual void useItemOn(Level *level, shared_ptr<ItemInstance> item, int x, int y, int z, bool bTestUseOnly=false) { } virtual void useItemOn(Level *level, std::shared_ptr<ItemInstance> item, int x, int y, int z, bool bTestUseOnly=false) { }
virtual void useItem(shared_ptr<ItemInstance> item,bool bTestUseOnly=false) { } virtual void useItem(std::shared_ptr<ItemInstance> item,bool bTestUseOnly=false) { }
virtual void completeUsingItem(shared_ptr<ItemInstance> item) { } virtual void completeUsingItem(std::shared_ptr<ItemInstance> item) { }
virtual void handleUIInput(int iAction) { } virtual void handleUIInput(int iAction) { }
virtual void onCrafted(shared_ptr<ItemInstance> item) { } virtual void onCrafted(std::shared_ptr<ItemInstance> item) { }
virtual void onTake(shared_ptr<ItemInstance> item, unsigned int invItemCountAnyAux, unsigned int invItemCountThisAux) { } virtual void onTake(std::shared_ptr<ItemInstance> item, unsigned int invItemCountAnyAux, unsigned int invItemCountThisAux) { }
virtual void onStateChange(eTutorial_State newState) { } virtual void onStateChange(eTutorial_State newState) { }
virtual void onEffectChanged(MobEffect *effect, bool bRemoved=false) { } virtual void onEffectChanged(MobEffect *effect, bool bRemoved=false) { }
}; };

View File

@@ -16,7 +16,7 @@ bool UseItemTask::isCompleted()
return bIsCompleted; return bIsCompleted;
} }
void UseItemTask::useItem(shared_ptr<ItemInstance> item,bool bTestUseOnly) void UseItemTask::useItem(std::shared_ptr<ItemInstance> item,bool bTestUseOnly)
{ {
if(bTestUseOnly) return; if(bTestUseOnly) return;

View File

@@ -16,5 +16,5 @@ public:
UseItemTask(const int itemId, Tutorial *tutorial, int descriptionId, UseItemTask(const int itemId, Tutorial *tutorial, int descriptionId,
bool enablePreCompletion = false, vector<TutorialConstraint *> *inConstraints = NULL, bool bShowMinimumTime = false, bool bAllowFade = true, bool bTaskReminders = true ); bool enablePreCompletion = false, vector<TutorialConstraint *> *inConstraints = NULL, bool bShowMinimumTime = false, bool bAllowFade = true, bool bTaskReminders = true );
virtual bool isCompleted(); virtual bool isCompleted();
virtual void useItem(shared_ptr<ItemInstance> item, bool bTestUseOnly=false); virtual void useItem(std::shared_ptr<ItemInstance> item, bool bTestUseOnly=false);
}; };

View File

@@ -25,7 +25,7 @@ bool UseTileTask::isCompleted()
return bIsCompleted; return bIsCompleted;
} }
void UseTileTask::useItemOn(Level *level, shared_ptr<ItemInstance> item, int x, int y, int z,bool bTestUseOnly) void UseTileTask::useItemOn(Level *level, std::shared_ptr<ItemInstance> item, int x, int y, int z,bool bTestUseOnly)
{ {
if(bTestUseOnly) return; if(bTestUseOnly) return;

View File

@@ -20,5 +20,5 @@ public:
UseTileTask(const int tileId, Tutorial *tutorial, int descriptionId, UseTileTask(const int tileId, Tutorial *tutorial, int descriptionId,
bool enablePreCompletion = false, vector<TutorialConstraint *> *inConstraints = NULL, bool bShowMinimumTime = false, bool bAllowFade = true, bool bTaskReminders = true); bool enablePreCompletion = false, vector<TutorialConstraint *> *inConstraints = NULL, bool bShowMinimumTime = false, bool bAllowFade = true, bool bTaskReminders = true);
virtual bool isCompleted(); virtual bool isCompleted();
virtual void useItemOn(Level *level, shared_ptr<ItemInstance> item, int x, int y, int z, bool bTestUseOnly=false); virtual void useItemOn(Level *level, std::shared_ptr<ItemInstance> item, int x, int y, int z, bool bTestUseOnly=false);
}; };

View File

@@ -73,7 +73,7 @@ void IUIScene_AbstractContainerMenu::Initialize(int iPad, AbstractContainerMenu*
m_iCurrSlotX = 0; m_iCurrSlotX = 0;
m_iCurrSlotY = 0; m_iCurrSlotY = 0;
#endif // TAP_DETECTION #endif // TAP_DETECTION
// //
// for(int i=0;i<XUSER_MAX_COUNT;i++) // for(int i=0;i<XUSER_MAX_COUNT;i++)
// { // {
// m_bFirstTouchStored[i]=false; // m_bFirstTouchStored[i]=false;
@@ -101,7 +101,7 @@ int IUIScene_AbstractContainerMenu::GetSectionDimensions( ESceneSection eSection
*piNumRows = 0; *piNumRows = 0;
*piNumColumns = 0; *piNumColumns = 0;
} }
return( ( *piNumRows ) * ( *piNumColumns ) ); return( ( *piNumRows ) * ( *piNumColumns ) );
} }
void IUIScene_AbstractContainerMenu::updateSlotPosition( ESceneSection eSection, ESceneSection newSection, ETapState eTapDirection, int *piTargetX, int *piTargetY, int xOffset ) void IUIScene_AbstractContainerMenu::updateSlotPosition( ESceneSection eSection, ESceneSection newSection, ETapState eTapDirection, int *piTargetX, int *piTargetY, int xOffset )
@@ -205,7 +205,7 @@ void IUIScene_AbstractContainerMenu::SetToolTip( EToolTipButton eButton, EToolTi
void IUIScene_AbstractContainerMenu::UpdateTooltips() void IUIScene_AbstractContainerMenu::UpdateTooltips()
{ {
// Table gives us text id for tooltip. // Table gives us text id for tooltip.
static const DWORD kaToolTipextIds[ eNumToolTips ] = static const DWORD kaToolTipextIds[ eNumToolTips ] =
{ {
IDS_TOOLTIPS_PICKUPPLACE, //eToolTipPickupPlace_OLD IDS_TOOLTIPS_PICKUPPLACE, //eToolTipPickupPlace_OLD
IDS_TOOLTIPS_EXIT, // eToolTipExit IDS_TOOLTIPS_EXIT, // eToolTipExit
@@ -307,7 +307,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
float fNewX=(((float)pTouchPadData->touch[0].x)-m_oldvTouchPos.x) * m_fTouchPadMulX; float fNewX=(((float)pTouchPadData->touch[0].x)-m_oldvTouchPos.x) * m_fTouchPadMulX;
float fNewY=(((float)pTouchPadData->touch[0].y)-m_oldvTouchPos.y) * m_fTouchPadMulY; float fNewY=(((float)pTouchPadData->touch[0].y)-m_oldvTouchPos.y) * m_fTouchPadMulY;
// relative positions - needs a deadzone // relative positions - needs a deadzone
if(fNewX>m_fTouchPadDeadZoneX) if(fNewX>m_fTouchPadDeadZoneX)
{ {
@@ -320,11 +320,11 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
if(fNewY>m_fTouchPadDeadZoneY) if(fNewY>m_fTouchPadDeadZoneY)
{ {
vPointerPos.y=m_oldvPointerPos.y+((fNewY-m_fTouchPadDeadZoneY)*((float)app.GetGameSettings(iPad,eGameSetting_Sensitivity_InMenu)/100.0f)); vPointerPos.y=m_oldvPointerPos.y+((fNewY-m_fTouchPadDeadZoneY)*((float)app.GetGameSettings(iPad,eGameSetting_Sensitivity_InMenu)/100.0f));
} }
else if(fNewY<-m_fTouchPadDeadZoneY) else if(fNewY<-m_fTouchPadDeadZoneY)
{ {
vPointerPos.y=m_oldvPointerPos.y+((fNewY+m_fTouchPadDeadZoneY)*((float)app.GetGameSettings(iPad,eGameSetting_Sensitivity_InMenu)/100.0f)); vPointerPos.y=m_oldvPointerPos.y+((fNewY+m_fTouchPadDeadZoneY)*((float)app.GetGameSettings(iPad,eGameSetting_Sensitivity_InMenu)/100.0f));
} }
// Clamp to pointer extents. // Clamp to pointer extents.
@@ -334,7 +334,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
else if ( vPointerPos.y > m_fPointerMaxY ) vPointerPos.y = m_fPointerMaxY; else if ( vPointerPos.y > m_fPointerMaxY ) vPointerPos.y = m_fPointerMaxY;
bStickInput = true; bStickInput = true;
m_eCurrTapState=eTapStateNoInput; m_eCurrTapState=eTapStateNoInput;
} }
else else
{ {
@@ -408,7 +408,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
fInputX *= fInputScale; fInputX *= fInputScale;
fInputY *= fInputScale; fInputY *= fInputScale;
#ifdef USE_POINTER_ACCEL #ifdef USE_POINTER_ACCEL
m_fPointerAccelX += fInputX / 50.0f; m_fPointerAccelX += fInputX / 50.0f;
m_fPointerAccelY += fInputY / 50.0f; m_fPointerAccelY += fInputY / 50.0f;
@@ -451,12 +451,12 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
else else
{ {
m_iConsectiveInputTicks = 0; m_iConsectiveInputTicks = 0;
#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
} }
#ifdef __ORBIS__ #ifdef __ORBIS__
@@ -501,7 +501,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
( vPointerPos.y >= sectionPos.y ) && ( vPointerPos.y <= itemMax.y ) ) ( vPointerPos.y >= sectionPos.y ) && ( vPointerPos.y <= itemMax.y ) )
{ {
// Pointer is over this control! // Pointer is over this control!
eSectionUnderPointer = eSection; eSectionUnderPointer = eSection;
vSnapPos.x = itemPos.x + ( itemSize.x / 2.0f ); vSnapPos.x = itemPos.x + ( itemSize.x / 2.0f );
vSnapPos.y = itemPos.y + ( itemSize.y / 2.0f ); vSnapPos.y = itemPos.y + ( itemSize.y / 2.0f );
@@ -590,7 +590,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
} }
// If we are not over any slot, set focus elsewhere. // If we are not over any slot, set focus elsewhere.
if ( eSectionUnderPointer == eSectionNone ) if ( eSectionUnderPointer == eSectionNone )
{ {
setFocusToPointer( getPad() ); setFocusToPointer( getPad() );
#ifdef TAP_DETECTION #ifdef TAP_DETECTION
@@ -704,11 +704,11 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
// Determine appropriate context sensitive tool tips, based on what is carried on the pointer and what is under the pointer. // Determine appropriate context sensitive tool tips, based on what is carried on the pointer and what is under the pointer.
// What are we carrying on pointer. // What are we carrying on pointer.
shared_ptr<LocalPlayer> player = Minecraft::GetInstance()->localplayers[getPad()]; std::shared_ptr<LocalPlayer> player = Minecraft::GetInstance()->localplayers[getPad()];
shared_ptr<ItemInstance> carriedItem = nullptr; std::shared_ptr<ItemInstance> carriedItem = nullptr;
if(player != NULL) carriedItem = player->inventory->getCarried(); if(player != NULL) carriedItem = player->inventory->getCarried();
shared_ptr<ItemInstance> slotItem = nullptr; std::shared_ptr<ItemInstance> slotItem = nullptr;
Slot *slot = NULL; Slot *slot = NULL;
int slotIndex = 0; int slotIndex = 0;
if(bPointerIsOverSlot) if(bPointerIsOverSlot)
@@ -790,7 +790,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
if ( bSlotHasItem ) if ( bSlotHasItem )
{ {
// Item in hand and item in slot ... is item in slot the same as in out hand? If so, can we stack on to it? // Item in hand and item in slot ... is item in slot the same as in out hand? If so, can we stack on to it?
if ( bCarriedIsSameAsSlot ) if ( bCarriedIsSameAsSlot )
{ {
// Can we stack more into this slot? // Can we stack more into this slot?
if ( iSlotStackSizeRemaining == 0 ) if ( iSlotStackSizeRemaining == 0 )
@@ -889,7 +889,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
if((eSectionUnderPointer==eSectionInventoryUsing)||(eSectionUnderPointer==eSectionInventoryInventory)) if((eSectionUnderPointer==eSectionInventoryUsing)||(eSectionUnderPointer==eSectionInventoryInventory))
{ {
shared_ptr<ItemInstance> item = getSlotItem(eSectionUnderPointer, iNewSlotIndex); std::shared_ptr<ItemInstance> item = getSlotItem(eSectionUnderPointer, iNewSlotIndex);
ArmorRecipes::_eArmorType eArmourType=ArmorRecipes::GetArmorType(item->id); ArmorRecipes::_eArmorType eArmourType=ArmorRecipes::GetArmorType(item->id);
if(eArmourType==ArmorRecipes::eArmorType_None) if(eArmourType==ArmorRecipes::eArmorType_None)
@@ -919,7 +919,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
else else
{ {
buttonY = eToolTipQuickMove; buttonY = eToolTipQuickMove;
} }
break; break;
case ArmorRecipes::eArmorType_Leggings: case ArmorRecipes::eArmorType_Leggings:
if(isSlotEmpty(eSectionInventoryArmor,2)) if(isSlotEmpty(eSectionInventoryArmor,2))
@@ -952,7 +952,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
else if((eSectionUnderPointer==eSectionFurnaceUsing)||(eSectionUnderPointer==eSectionFurnaceInventory)) else if((eSectionUnderPointer==eSectionFurnaceUsing)||(eSectionUnderPointer==eSectionFurnaceInventory))
{ {
// Get the info on this item. // Get the info on this item.
shared_ptr<ItemInstance> item = getSlotItem(eSectionUnderPointer, iNewSlotIndex); std::shared_ptr<ItemInstance> item = getSlotItem(eSectionUnderPointer, iNewSlotIndex);
bool bValidFuel = FurnaceTileEntity::isFuel(item); bool bValidFuel = FurnaceTileEntity::isFuel(item);
bool bValidIngredient = FurnaceRecipes::getInstance()->getResult(item->getItem()->id) != NULL; bool bValidIngredient = FurnaceRecipes::getInstance()->getResult(item->getItem()->id) != NULL;
@@ -962,7 +962,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
if(!isSlotEmpty(eSectionFurnaceIngredient,0)) if(!isSlotEmpty(eSectionFurnaceIngredient,0))
{ {
// is it the same as this item // is it the same as this item
shared_ptr<ItemInstance> IngredientItem = getSlotItem(eSectionFurnaceIngredient,0); std::shared_ptr<ItemInstance> IngredientItem = getSlotItem(eSectionFurnaceIngredient,0);
if(IngredientItem->id == item->id) if(IngredientItem->id == item->id)
{ {
buttonY = eToolTipQuickMoveIngredient; buttonY = eToolTipQuickMoveIngredient;
@@ -991,7 +991,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
if(!isSlotEmpty(eSectionFurnaceFuel,0)) if(!isSlotEmpty(eSectionFurnaceFuel,0))
{ {
// is it the same as this item // is it the same as this item
shared_ptr<ItemInstance> fuelItem = getSlotItem(eSectionFurnaceFuel,0); std::shared_ptr<ItemInstance> fuelItem = getSlotItem(eSectionFurnaceFuel,0);
if(fuelItem->id == item->id) if(fuelItem->id == item->id)
{ {
buttonY = eToolTipQuickMoveFuel; buttonY = eToolTipQuickMoveFuel;
@@ -1002,7 +1002,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
if(!isSlotEmpty(eSectionFurnaceIngredient,0)) if(!isSlotEmpty(eSectionFurnaceIngredient,0))
{ {
// is it the same as this item // is it the same as this item
shared_ptr<ItemInstance> IngredientItem = getSlotItem(eSectionFurnaceIngredient,0); std::shared_ptr<ItemInstance> IngredientItem = getSlotItem(eSectionFurnaceIngredient,0);
if(IngredientItem->id == item->id) if(IngredientItem->id == item->id)
{ {
buttonY = eToolTipQuickMoveIngredient; buttonY = eToolTipQuickMoveIngredient;
@@ -1044,7 +1044,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
else if((eSectionUnderPointer==eSectionBrewingUsing)||(eSectionUnderPointer==eSectionBrewingInventory)) else if((eSectionUnderPointer==eSectionBrewingUsing)||(eSectionUnderPointer==eSectionBrewingInventory))
{ {
// Get the info on this item. // Get the info on this item.
shared_ptr<ItemInstance> item = getSlotItem(eSectionUnderPointer, iNewSlotIndex); std::shared_ptr<ItemInstance> item = getSlotItem(eSectionUnderPointer, iNewSlotIndex);
int iId=item->id; int iId=item->id;
// valid ingredient? // valid ingredient?
@@ -1062,7 +1062,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
if(!isSlotEmpty(eSectionBrewingIngredient,0)) if(!isSlotEmpty(eSectionBrewingIngredient,0))
{ {
// is it the same as this item // is it the same as this item
shared_ptr<ItemInstance> IngredientItem = getSlotItem(eSectionBrewingIngredient,0); std::shared_ptr<ItemInstance> IngredientItem = getSlotItem(eSectionBrewingIngredient,0);
if(IngredientItem->id == item->id) if(IngredientItem->id == item->id)
{ {
buttonY = eToolTipQuickMoveIngredient; buttonY = eToolTipQuickMoveIngredient;
@@ -1077,15 +1077,15 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
// ingredient slot empty // ingredient slot empty
buttonY = eToolTipQuickMoveIngredient; buttonY = eToolTipQuickMoveIngredient;
} }
} }
else else
{ {
// valid potion? Glass bottle with water in it is a 'potion' too. // valid potion? Glass bottle with water in it is a 'potion' too.
if(iId==Item::potion_Id) if(iId==Item::potion_Id)
{ {
// space available? // space available?
if(isSlotEmpty(eSectionBrewingBottle1,0) || if(isSlotEmpty(eSectionBrewingBottle1,0) ||
isSlotEmpty(eSectionBrewingBottle2,0) || isSlotEmpty(eSectionBrewingBottle2,0) ||
isSlotEmpty(eSectionBrewingBottle3,0)) isSlotEmpty(eSectionBrewingBottle3,0))
{ {
buttonY = eToolTipQuickMoveIngredient; buttonY = eToolTipQuickMoveIngredient;
@@ -1104,7 +1104,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
else if((eSectionUnderPointer==eSectionEnchantUsing)||(eSectionUnderPointer==eSectionEnchantInventory)) else if((eSectionUnderPointer==eSectionEnchantUsing)||(eSectionUnderPointer==eSectionEnchantInventory))
{ {
// Get the info on this item. // Get the info on this item.
shared_ptr<ItemInstance> item = getSlotItem(eSectionUnderPointer, iNewSlotIndex); std::shared_ptr<ItemInstance> item = getSlotItem(eSectionUnderPointer, iNewSlotIndex);
int iId=item->id; int iId=item->id;
// valid enchantable tool? // valid enchantable tool?
@@ -1112,8 +1112,8 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
{ {
// is there already something in the ingredient slot? // is there already something in the ingredient slot?
if(isSlotEmpty(eSectionEnchantSlot,0)) if(isSlotEmpty(eSectionEnchantSlot,0))
{ {
// tool slot empty // tool slot empty
switch(iId) switch(iId)
{ {
case Item::bow_Id: case Item::bow_Id:
@@ -1155,7 +1155,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
buttonY = eToolTipQuickMove; buttonY = eToolTipQuickMove;
break; break;
default: default:
buttonY=eToolTipQuickMoveTool; buttonY=eToolTipQuickMoveTool;
break; break;
} }
} }
@@ -1163,10 +1163,10 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
{ {
buttonY = eToolTipQuickMove; buttonY = eToolTipQuickMove;
} }
} }
else else
{ {
buttonY=eToolTipQuickMove; buttonY=eToolTipQuickMove;
} }
} }
else else
@@ -1199,7 +1199,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
SetPointerOutsideMenu( false ); SetPointerOutsideMenu( false );
} }
shared_ptr<ItemInstance> item = nullptr; std::shared_ptr<ItemInstance> item = nullptr;
if(bPointerIsOverSlot && bSlotHasItem) item = getSlotItem(eSectionUnderPointer, iNewSlotIndex); if(bPointerIsOverSlot && bSlotHasItem) item = getSlotItem(eSectionUnderPointer, iNewSlotIndex);
overrideTooltips(eSectionUnderPointer, item, bIsItemCarried, bSlotHasItem, bCarriedIsSameAsSlot, iSlotStackSizeRemaining, buttonA, buttonX, buttonY, buttonRT); overrideTooltips(eSectionUnderPointer, item, bIsItemCarried, bSlotHasItem, bCarriedIsSameAsSlot, iSlotStackSizeRemaining, buttonA, buttonX, buttonY, buttonRT);
@@ -1358,7 +1358,7 @@ bool IUIScene_AbstractContainerMenu::handleKeyDown(int iPad, int iAction, bool b
} }
else else
{ {
ui.CloseUIScenes(iPad); ui.CloseUIScenes(iPad);
} }
bHandled = true; bHandled = true;
@@ -1410,7 +1410,7 @@ bool IUIScene_AbstractContainerMenu::handleKeyDown(int iPad, int iAction, bool b
bool bSlotHasItem = !isSlotEmpty(m_eCurrSection, currentIndex); bool bSlotHasItem = !isSlotEmpty(m_eCurrSection, currentIndex);
if ( bSlotHasItem ) if ( bSlotHasItem )
{ {
shared_ptr<ItemInstance> item = getSlotItem(m_eCurrSection, currentIndex); std::shared_ptr<ItemInstance> item = getSlotItem(m_eCurrSection, currentIndex);
if( Minecraft::GetInstance()->localgameModes[iPad] != NULL ) if( Minecraft::GetInstance()->localgameModes[iPad] != NULL )
{ {
Tutorial::PopupMessageDetails *message = new Tutorial::PopupMessageDetails; Tutorial::PopupMessageDetails *message = new Tutorial::PopupMessageDetails;
@@ -1456,7 +1456,7 @@ bool IUIScene_AbstractContainerMenu::handleKeyDown(int iPad, int iAction, bool b
{ {
handleOutsideClicked(iPad, buttonNum, quickKeyHeld); handleOutsideClicked(iPad, buttonNum, quickKeyHeld);
} }
else // else //
{ {
// over empty space or something else??? // over empty space or something else???
handleOtherClicked(iPad,m_eCurrSection,buttonNum,quickKeyHeld?true:false); handleOtherClicked(iPad,m_eCurrSection,buttonNum,quickKeyHeld?true:false);
@@ -1569,7 +1569,7 @@ int IUIScene_AbstractContainerMenu::getCurrentIndex(ESceneSection eSection)
return currentIndex + getSectionStartOffset(eSection); return currentIndex + getSectionStartOffset(eSection);
} }
bool IUIScene_AbstractContainerMenu::IsSameItemAs(shared_ptr<ItemInstance> itemA, shared_ptr<ItemInstance> itemB) bool IUIScene_AbstractContainerMenu::IsSameItemAs(std::shared_ptr<ItemInstance> itemA, std::shared_ptr<ItemInstance> itemB)
{ {
if(itemA == NULL || itemB == NULL) return false; if(itemA == NULL || itemB == NULL) return false;
@@ -1583,7 +1583,7 @@ int IUIScene_AbstractContainerMenu::GetEmptyStackSpace(Slot *slot)
if(slot != NULL && slot->hasItem()) if(slot != NULL && slot->hasItem())
{ {
shared_ptr<ItemInstance> item = slot->getItem(); std::shared_ptr<ItemInstance> item = slot->getItem();
if ( item->isStackable() ) if ( item->isStackable() )
{ {
int iCount = item->GetCount(); int iCount = item->GetCount();
@@ -1614,7 +1614,7 @@ wstring IUIScene_AbstractContainerMenu::GetItemDescription(Slot *slot, vector<ws
} }
else else
{ {
firstLine = false; firstLine = false;
wchar_t formatted[256]; wchar_t formatted[256];
eMinecraftColour rarityColour = slot->getItem()->getRarity()->color; eMinecraftColour rarityColour = slot->getItem()->getRarity()->color;
int colour = app.GetHTMLColour(rarityColour); int colour = app.GetHTMLColour(rarityColour);
@@ -1624,7 +1624,7 @@ wstring IUIScene_AbstractContainerMenu::GetItemDescription(Slot *slot, vector<ws
colour = app.GetHTMLColour(eTextColor_RenamedItemTitle); colour = app.GetHTMLColour(eTextColor_RenamedItemTitle);
} }
swprintf(formatted, 256, L"<font color=\"#%08x\">%ls</font>",colour,thisString.c_str()); swprintf(formatted, 256, L"<font color=\"#%08x\">%ls</font>",colour,thisString.c_str());
thisString = formatted; thisString = formatted;
} }
desc.append( thisString ); desc.append( thisString );

View File

@@ -10,7 +10,7 @@
// Uncomment to enable acceleration on pointer input. // Uncomment to enable acceleration on pointer input.
//#define USE_POINTER_ACCEL //#define USE_POINTER_ACCEL
#define POINTER_INPUT_TIMER_ID (0) // Arbitrary timer ID. #define POINTER_INPUT_TIMER_ID (0) // Arbitrary timer ID.
#define POINTER_SPEED_FACTOR (13.0f) // Speed of pointer. #define POINTER_SPEED_FACTOR (13.0f) // Speed of pointer.
//#define POINTER_PANEL_OVER_REACH (42.0f) // Amount beyond edge of panel which pointer can go over to drop items. - comes from the pointer size in the scene //#define POINTER_PANEL_OVER_REACH (42.0f) // Amount beyond edge of panel which pointer can go over to drop items. - comes from the pointer size in the scene
@@ -32,19 +32,19 @@ protected:
eSectionContainerInventory, eSectionContainerInventory,
eSectionContainerChest, eSectionContainerChest,
eSectionContainerMax, eSectionContainerMax,
eSectionFurnaceUsing, eSectionFurnaceUsing,
eSectionFurnaceInventory, eSectionFurnaceInventory,
eSectionFurnaceIngredient, eSectionFurnaceIngredient,
eSectionFurnaceFuel, eSectionFurnaceFuel,
eSectionFurnaceResult, eSectionFurnaceResult,
eSectionFurnaceMax, eSectionFurnaceMax,
eSectionInventoryUsing, eSectionInventoryUsing,
eSectionInventoryInventory, eSectionInventoryInventory,
eSectionInventoryArmor, eSectionInventoryArmor,
eSectionInventoryMax, eSectionInventoryMax,
eSectionTrapUsing, eSectionTrapUsing,
eSectionTrapInventory, eSectionTrapInventory,
eSectionTrapTrap, eSectionTrapTrap,
@@ -64,7 +64,7 @@ protected:
eSectionInventoryCreativeSlider, eSectionInventoryCreativeSlider,
#endif #endif
eSectionInventoryCreativeMax, eSectionInventoryCreativeMax,
eSectionEnchantUsing, eSectionEnchantUsing,
eSectionEnchantInventory, eSectionEnchantInventory,
eSectionEnchantSlot, eSectionEnchantSlot,
@@ -151,7 +151,7 @@ protected:
// 4J - WESTY - Added for pointer prototype. // 4J - WESTY - Added for pointer prototype.
// Current tooltip settings. // Current tooltip settings.
EToolTipItem m_aeToolTipSettings[ eToolTipNumButtons ]; EToolTipItem m_aeToolTipSettings[ eToolTipNumButtons ];
// 4J - WESTY - Added for pointer prototype. // 4J - WESTY - Added for pointer prototype.
// Indicates if pointer is outside UI window (used to drop items). // Indicates if pointer is outside UI window (used to drop items).
bool m_bPointerOutsideMenu; bool m_bPointerOutsideMenu;
@@ -159,7 +159,7 @@ protected:
bool m_bSplitscreen; bool m_bSplitscreen;
bool m_bNavigateBack; // should we exit the xuiscenes or just navigate back on exit? bool m_bNavigateBack; // should we exit the xuiscenes or just navigate back on exit?
virtual bool IsSectionSlotList( ESceneSection eSection ) { return eSection != eSectionNone; } virtual bool IsSectionSlotList( ESceneSection eSection ) { return eSection != eSectionNone; }
virtual bool CanHaveFocus( ESceneSection eSection ) { return true; } virtual bool CanHaveFocus( ESceneSection eSection ) { return true; }
int GetSectionDimensions( ESceneSection eSection, int* piNumColumns, int* piNumRows ); int GetSectionDimensions( ESceneSection eSection, int* piNumColumns, int* piNumRows );
@@ -180,7 +180,7 @@ protected:
// 4J - WESTY - Added for pointer prototype. // 4J - WESTY - Added for pointer prototype.
void SetPointerOutsideMenu( bool bOutside ) { m_bPointerOutsideMenu = bOutside; } void SetPointerOutsideMenu( bool bOutside ) { m_bPointerOutsideMenu = bOutside; }
void Initialize(int m_iPad, AbstractContainerMenu* menu, bool autoDeleteMenu, int startIndex,ESceneSection firstSection,ESceneSection maxSection, bool bNavigateBack=FALSE); void Initialize(int m_iPad, AbstractContainerMenu* menu, bool autoDeleteMenu, int startIndex,ESceneSection firstSection,ESceneSection maxSection, bool bNavigateBack=FALSE);
virtual void PlatformInitialize(int iPad, int startIndex) = 0; virtual void PlatformInitialize(int iPad, int startIndex) = 0;
virtual void InitDataAssociations(int iPad, AbstractContainerMenu *menu, int startIndex = 0) = 0; virtual void InitDataAssociations(int iPad, AbstractContainerMenu *menu, int startIndex = 0) = 0;
@@ -201,15 +201,15 @@ protected:
virtual void setSectionSelectedSlot(ESceneSection eSection, int x, int y) = 0; virtual void setSectionSelectedSlot(ESceneSection eSection, int x, int y) = 0;
virtual void setFocusToPointer(int iPad) = 0; virtual void setFocusToPointer(int iPad) = 0;
virtual void SetPointerText(const wstring &description, vector<wstring> &unformattedStrings, bool newSlot) = 0; virtual void SetPointerText(const wstring &description, vector<wstring> &unformattedStrings, bool newSlot) = 0;
virtual shared_ptr<ItemInstance> getSlotItem(ESceneSection eSection, int iSlot) = 0; virtual std::shared_ptr<ItemInstance> getSlotItem(ESceneSection eSection, int iSlot) = 0;
virtual bool isSlotEmpty(ESceneSection eSection, int iSlot) = 0; virtual bool isSlotEmpty(ESceneSection eSection, int iSlot) = 0;
virtual void adjustPointerForSafeZone() = 0; virtual void adjustPointerForSafeZone() = 0;
virtual bool overrideTooltips(ESceneSection sectionUnderPointer, shared_ptr<ItemInstance> itemUnderPointer, bool bIsItemCarried, bool bSlotHasItem, bool bCarriedIsSameAsSlot, int iSlotStackSizeRemaining, virtual bool overrideTooltips(ESceneSection sectionUnderPointer, std::shared_ptr<ItemInstance> itemUnderPointer, bool bIsItemCarried, bool bSlotHasItem, bool bCarriedIsSameAsSlot, int iSlotStackSizeRemaining,
EToolTipItem &buttonA, EToolTipItem &buttonX, EToolTipItem &buttonY, EToolTipItem &buttonRT) { return false; } EToolTipItem &buttonA, EToolTipItem &buttonX, EToolTipItem &buttonY, EToolTipItem &buttonRT) { return false; }
private: private:
bool IsSameItemAs(shared_ptr<ItemInstance> itemA, shared_ptr<ItemInstance> itemB); bool IsSameItemAs(std::shared_ptr<ItemInstance> itemA, std::shared_ptr<ItemInstance> itemB);
int GetEmptyStackSpace(Slot *slot); int GetEmptyStackSpace(Slot *slot);
wstring GetItemDescription(Slot *slot, vector<wstring> &unformattedStrings); wstring GetItemDescription(Slot *slot, vector<wstring> &unformattedStrings);

View File

@@ -245,15 +245,15 @@ void IUIScene_AnvilMenu::updateItemName()
ByteArrayOutputStream baos; ByteArrayOutputStream baos;
DataOutputStream dos(&baos); DataOutputStream dos(&baos);
dos.writeUTF(m_itemName); dos.writeUTF(m_itemName);
Minecraft::GetInstance()->localplayers[getPad()]->connection->send(shared_ptr<CustomPayloadPacket>(new CustomPayloadPacket(CustomPayloadPacket::SET_ITEM_NAME_PACKET, baos.toByteArray()))); Minecraft::GetInstance()->localplayers[getPad()]->connection->send(std::shared_ptr<CustomPayloadPacket>(new CustomPayloadPacket(CustomPayloadPacket::SET_ITEM_NAME_PACKET, baos.toByteArray())));
} }
void IUIScene_AnvilMenu::refreshContainer(AbstractContainerMenu *container, vector<shared_ptr<ItemInstance> > *items) void IUIScene_AnvilMenu::refreshContainer(AbstractContainerMenu *container, vector<std::shared_ptr<ItemInstance> > *items)
{ {
slotChanged(container, RepairMenu::INPUT_SLOT, container->getSlot(0)->getItem()); slotChanged(container, RepairMenu::INPUT_SLOT, container->getSlot(0)->getItem());
} }
void IUIScene_AnvilMenu::slotChanged(AbstractContainerMenu *container, int slotIndex, shared_ptr<ItemInstance> item) void IUIScene_AnvilMenu::slotChanged(AbstractContainerMenu *container, int slotIndex, std::shared_ptr<ItemInstance> item)
{ {
if (slotIndex == RepairMenu::INPUT_SLOT) if (slotIndex == RepairMenu::INPUT_SLOT)
{ {

View File

@@ -16,7 +16,7 @@ class RepairMenu;
class IUIScene_AnvilMenu : public virtual IUIScene_AbstractContainerMenu, public net_minecraft_world_inventory::ContainerListener class IUIScene_AnvilMenu : public virtual IUIScene_AbstractContainerMenu, public net_minecraft_world_inventory::ContainerListener
{ {
protected: protected:
shared_ptr<Inventory> m_inventory; std::shared_ptr<Inventory> m_inventory;
RepairMenu *m_repairMenu; RepairMenu *m_repairMenu;
wstring m_itemName; wstring m_itemName;
@@ -24,7 +24,7 @@ protected:
IUIScene_AnvilMenu(); IUIScene_AnvilMenu();
virtual ESceneSection GetSectionAndSlotInDirection( ESceneSection eSection, ETapState eTapDirection, int *piTargetX, int *piTargetY ); virtual ESceneSection GetSectionAndSlotInDirection( ESceneSection eSection, ETapState eTapDirection, int *piTargetX, int *piTargetY );
int getSectionStartOffset(ESceneSection eSection); int getSectionStartOffset(ESceneSection eSection);
virtual void handleOtherClicked(int iPad, ESceneSection eSection, int buttonNum, bool quickKey); virtual void handleOtherClicked(int iPad, ESceneSection eSection, int buttonNum, bool quickKey);
bool IsSectionSlotList( ESceneSection eSection ); bool IsSectionSlotList( ESceneSection eSection );
@@ -39,7 +39,7 @@ protected:
void updateItemName(); void updateItemName();
// ContainerListenr // ContainerListenr
void refreshContainer(AbstractContainerMenu *container, vector<shared_ptr<ItemInstance> > *items); void refreshContainer(AbstractContainerMenu *container, vector<std::shared_ptr<ItemInstance> > *items);
void slotChanged(AbstractContainerMenu *container, int slotIndex, shared_ptr<ItemInstance> item); void slotChanged(AbstractContainerMenu *container, int slotIndex, std::shared_ptr<ItemInstance> item);
void setContainerData(AbstractContainerMenu *container, int id, int value); void setContainerData(AbstractContainerMenu *container, int id, int value);
}; };

View File

@@ -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,18 +197,18 @@ 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];
shared_ptr<ItemInstance> pTempItemInst=pRecipeIngredientsRequired[iRecipe].pRecipy->assemble(nullptr); std::shared_ptr<ItemInstance> pTempItemInst=pRecipeIngredientsRequired[iRecipe].pRecipy->assemble(nullptr);
//int iIcon=pTempItemInst->getItem()->getIcon(pTempItemInst->getAuxValue()); //int iIcon=pTempItemInst->getItem()->getIcon(pTempItemInst->getAuxValue());
if( pMinecraft->localgameModes[iPad] != NULL) if( pMinecraft->localgameModes[iPad] != NULL)
@@ -244,7 +244,7 @@ bool IUIScene_CraftingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat)
iSlot=0; iSlot=0;
} }
int iRecipe= CanBeMadeA[m_iCurrentSlotHIndex].iRecipeA[iSlot]; int iRecipe= CanBeMadeA[m_iCurrentSlotHIndex].iRecipeA[iSlot];
shared_ptr<ItemInstance> pTempItemInst=pRecipeIngredientsRequired[iRecipe].pRecipy->assemble(nullptr); std::shared_ptr<ItemInstance> pTempItemInst=pRecipeIngredientsRequired[iRecipe].pRecipy->assemble(nullptr);
//int iIcon=pTempItemInst->getItem()->getIcon(pTempItemInst->getAuxValue()); //int iIcon=pTempItemInst->getItem()->getIcon(pTempItemInst->getAuxValue());
if( pMinecraft->localgameModes[iPad] != NULL ) if( pMinecraft->localgameModes[iPad] != NULL )
@@ -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
@@ -272,7 +272,7 @@ bool IUIScene_CraftingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat)
{ {
for(int j=0;j<pRecipeIngredientsRequired[iRecipe].iIngValA[i];j++) for(int j=0;j<pRecipeIngredientsRequired[iRecipe].iIngValA[i];j++)
{ {
shared_ptr<ItemInstance> ingItemInst = nullptr; std::shared_ptr<ItemInstance> ingItemInst = nullptr;
// do we need to remove a specific aux value? // do we need to remove a specific aux value?
if(pRecipeIngredientsRequired[iRecipe].iIngAuxValA[i]!=Recipes::ANY_AUX_VALUE) if(pRecipeIngredientsRequired[iRecipe].iIngAuxValA[i]!=Recipes::ANY_AUX_VALUE)
{ {
@@ -291,7 +291,7 @@ bool IUIScene_CraftingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat)
if (ingItemInst->getItem()->hasCraftingRemainingItem()) if (ingItemInst->getItem()->hasCraftingRemainingItem())
{ {
// replace item with remaining result // replace item with remaining result
m_pPlayer->inventory->add( shared_ptr<ItemInstance>( new ItemInstance(ingItemInst->getItem()->getCraftingRemainingItem()) ) ); m_pPlayer->inventory->add( std::shared_ptr<ItemInstance>( new ItemInstance(ingItemInst->getItem()->getCraftingRemainingItem()) ) );
} }
} }
@@ -337,7 +337,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)
@@ -431,7 +431,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();
@@ -482,13 +482,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
@@ -496,11 +496,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;
@@ -533,7 +533,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;
@@ -574,7 +574,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();
@@ -624,11 +624,11 @@ void IUIScene_CraftingMenu::CheckRecipesAvailable()
// for (int i = 0; i < iRecipeC; i++) // for (int i = 0; i < iRecipeC; i++)
// { // {
// shared_ptr<ItemInstance> pTempItemInst=pRecipeIngredientsRequired[i].pRecipy->assemble(NULL); // std::shared_ptr<ItemInstance> pTempItemInst=pRecipeIngredientsRequired[i].pRecipy->assemble(NULL);
// 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)
@@ -642,7 +642,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());
// } // }
// //
// } // }
// } // }
// } // }
@@ -683,9 +683,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)
@@ -721,18 +721,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
@@ -761,7 +761,7 @@ void IUIScene_CraftingMenu::CheckRecipesAvailable()
if(iHSlotBrushControl<=m_iCraftablesMaxHSlotC) if(iHSlotBrushControl<=m_iCraftablesMaxHSlotC)
{ {
bool bFound=false; bool bFound=false;
shared_ptr<ItemInstance> pTempItemInst=pRecipeIngredientsRequired[i].pRecipy->assemble(nullptr); std::shared_ptr<ItemInstance> pTempItemInst=pRecipeIngredientsRequired[i].pRecipy->assemble(nullptr);
//int iIcon=pTempItemInst->getItem()->getIcon(pTempItemInst->getAuxValue()); //int iIcon=pTempItemInst->getItem()->getIcon(pTempItemInst->getAuxValue());
int iID=pTempItemInst->getItem()->id; int iID=pTempItemInst->getItem()->id;
int iBaseType; int iBaseType;
@@ -777,7 +777,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
@@ -801,7 +801,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;
@@ -824,7 +824,7 @@ void IUIScene_CraftingMenu::CheckRecipesAvailable()
} }
delete [] bFoundA; delete [] bFoundA;
itRecipe++; itRecipe++;
} }
} }
@@ -835,7 +835,7 @@ void IUIScene_CraftingMenu::CheckRecipesAvailable()
while((iIndex<m_iCraftablesMaxHSlotC) && CanBeMadeA[iIndex].iCount!=0) while((iIndex<m_iCraftablesMaxHSlotC) && CanBeMadeA[iIndex].iCount!=0)
{ {
shared_ptr<ItemInstance> pTempItemInst=pRecipeIngredientsRequired[CanBeMadeA[iIndex].iRecipeA[0]].pRecipy->assemble(nullptr); std::shared_ptr<ItemInstance> pTempItemInst=pRecipeIngredientsRequired[CanBeMadeA[iIndex].iRecipeA[0]].pRecipy->assemble(nullptr);
assert(pTempItemInst->id!=0); assert(pTempItemInst->id!=0);
unsigned int uiAlpha; unsigned int uiAlpha;
@@ -844,7 +844,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;
@@ -903,7 +903,7 @@ void IUIScene_CraftingMenu::UpdateHighlight()
{ {
iSlot=0; iSlot=0;
} }
shared_ptr<ItemInstance> pTempItemInstAdditional=pRecipeIngredientsRequired[CanBeMadeA[m_iCurrentSlotHIndex].iRecipeA[iSlot]].pRecipy->assemble(nullptr); std::shared_ptr<ItemInstance> pTempItemInstAdditional=pRecipeIngredientsRequired[CanBeMadeA[m_iCurrentSlotHIndex].iRecipeA[iSlot]].pRecipy->assemble(nullptr);
// special case for the torch coal/charcoal // special case for the torch coal/charcoal
int id=pTempItemInstAdditional->getDescriptionId(); int id=pTempItemInstAdditional->getDescriptionId();
@@ -933,10 +933,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;
} }
@@ -991,7 +991,7 @@ void IUIScene_CraftingMenu::UpdateVerticalSlots()
{ {
if(i!=1) continue; if(i!=1) continue;
} }
shared_ptr<ItemInstance> pTempItemInstAdditional=pRecipeIngredientsRequired[CanBeMadeA[m_iCurrentSlotHIndex].iRecipeA[iVSlotIndexA[i]]].pRecipy->assemble(nullptr); std::shared_ptr<ItemInstance> pTempItemInstAdditional=pRecipeIngredientsRequired[CanBeMadeA[m_iCurrentSlotHIndex].iRecipeA[iVSlotIndexA[i]]].pRecipy->assemble(nullptr);
assert(pTempItemInstAdditional->id!=0); assert(pTempItemInstAdditional->id!=0);
unsigned int uiAlpha; unsigned int uiAlpha;
@@ -1001,7 +1001,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;
@@ -1040,7 +1040,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)
{ {
@@ -1057,7 +1057,7 @@ void IUIScene_CraftingMenu::DisplayIngredients()
int iBoxWidth=(m_iContainerType==RECIPE_TYPE_2x2)?2:3; int iBoxWidth=(m_iContainerType==RECIPE_TYPE_2x2)?2:3;
int iRecipe=CanBeMadeA[m_iCurrentSlotHIndex].iRecipeA[iSlot]; int iRecipe=CanBeMadeA[m_iCurrentSlotHIndex].iRecipeA[iSlot];
bool bCanMakeRecipe = pRecipeIngredientsRequired[iRecipe].bCanMake[getPad()]; bool bCanMakeRecipe = pRecipeIngredientsRequired[iRecipe].bCanMake[getPad()];
shared_ptr<ItemInstance> pTempItemInst=pRecipeIngredientsRequired[iRecipe].pRecipy->assemble(nullptr); std::shared_ptr<ItemInstance> pTempItemInst=pRecipeIngredientsRequired[iRecipe].pRecipy->assemble(nullptr);
m_iIngredientsC=pRecipeIngredientsRequired[iRecipe].iIngC; m_iIngredientsC=pRecipeIngredientsRequired[iRecipe].iIngC;
@@ -1077,7 +1077,7 @@ void IUIScene_CraftingMenu::DisplayIngredients()
iAuxVal = 0xFF; iAuxVal = 0xFF;
} }
shared_ptr<ItemInstance> itemInst= shared_ptr<ItemInstance>(new ItemInstance(item,pRecipeIngredientsRequired[iRecipe].iIngValA[i],iAuxVal)); std::shared_ptr<ItemInstance> itemInst= std::shared_ptr<ItemInstance>(new ItemInstance(item,pRecipeIngredientsRequired[iRecipe].iIngValA[i],iAuxVal));
setIngredientDescriptionItem(getPad(),i,itemInst); setIngredientDescriptionItem(getPad(),i,itemInst);
setIngredientDescriptionRedBox(i,false); setIngredientDescriptionRedBox(i,false);
@@ -1124,13 +1124,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;
@@ -1141,7 +1141,7 @@ void IUIScene_CraftingMenu::DisplayIngredients()
{ {
iAuxVal = 0xFF; iAuxVal = 0xFF;
} }
shared_ptr<ItemInstance> itemInst= shared_ptr<ItemInstance>(new ItemInstance(id,1,iAuxVal)); std::shared_ptr<ItemInstance> itemInst= std::shared_ptr<ItemInstance>(new ItemInstance(id,1,iAuxVal));
setIngredientSlotItem(getPad(),index,itemInst); setIngredientSlotItem(getPad(),index,itemInst);
// show the ingredients we don't have if we can't make the recipe // show the ingredients we don't have if we can't make the recipe
if(app.DebugSettingsOn() && app.GetGameSettingsDebugMask(ProfileManager.GetPrimaryPad())&(1L<<eDebugSetting_CraftAnything)) if(app.DebugSettingsOn() && app.GetGameSettingsDebugMask(ProfileManager.GetPrimaryPad())&(1L<<eDebugSetting_CraftAnything))
@@ -1149,7 +1149,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);
@@ -1164,7 +1164,7 @@ void IUIScene_CraftingMenu::DisplayIngredients()
{ {
setIngredientSlotRedBox(index, false); setIngredientSlotRedBox(index, false);
setIngredientSlotItem(getPad(),index,nullptr); setIngredientSlotItem(getPad(),index,nullptr);
} }
} }
} }
} }
@@ -1188,7 +1188,7 @@ void IUIScene_CraftingMenu::DisplayIngredients()
{ {
setIngredientSlotRedBox(i, false); setIngredientSlotRedBox(i, false);
setIngredientSlotItem(getPad(),i,nullptr); setIngredientSlotItem(getPad(),i,nullptr);
} }
} }
} }
@@ -1205,7 +1205,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)
{ {
@@ -1218,7 +1218,7 @@ void IUIScene_CraftingMenu::UpdateDescriptionText(bool bCanBeMade)
//iRecipy=CanBeMadeA[m_iCurrentSlotHIndex].iRecipeA[0]; //iRecipy=CanBeMadeA[m_iCurrentSlotHIndex].iRecipeA[0];
} }
shared_ptr<ItemInstance> pTempItemInst=pRecipeIngredientsRequired[CanBeMadeA[m_iCurrentSlotHIndex].iRecipeA[iSlot]].pRecipy->assemble(nullptr); std::shared_ptr<ItemInstance> pTempItemInst=pRecipeIngredientsRequired[CanBeMadeA[m_iCurrentSlotHIndex].iRecipeA[iSlot]].pRecipy->assemble(nullptr);
int iID=pTempItemInst->getItem()->id; int iID=pTempItemInst->getItem()->id;
int iAuxVal=pTempItemInst->getAuxValue(); int iAuxVal=pTempItemInst->getAuxValue();
int iBaseType; int iBaseType;
@@ -1278,13 +1278,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"");
} }
} }
@@ -1308,7 +1308,7 @@ void IUIScene_CraftingMenu::UpdateTooltips()
{ {
iSlot=iVSlotIndexA[m_iCurrentSlotVIndex]; iSlot=iVSlotIndexA[m_iCurrentSlotVIndex];
} }
else else
{ {
iSlot=0; iSlot=0;
} }
@@ -1348,7 +1348,7 @@ void IUIScene_CraftingMenu::UpdateTooltips()
{ {
iSlot=iVSlotIndexA[m_iCurrentSlotVIndex]; iSlot=iVSlotIndexA[m_iCurrentSlotVIndex];
} }
else else
{ {
iSlot=0; iSlot=0;
} }
@@ -1372,7 +1372,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();

View File

@@ -22,7 +22,7 @@ protected:
static const int m_iMaxHSlotC = 12; static const int m_iMaxHSlotC = 12;
static const int m_iMaxHCraftingSlotC = 10; static const int m_iMaxHCraftingSlotC = 10;
static const int m_iMaxVSlotC = 17; static const int m_iMaxVSlotC = 17;
static const int m_iMaxDisplayedVSlotC = 3; static const int m_iMaxDisplayedVSlotC = 3;
static const int m_iIngredients3x3SlotC = 9; static const int m_iIngredients3x3SlotC = 9;
static const int m_iIngredients2x2SlotC = 4; static const int m_iIngredients2x2SlotC = 4;
@@ -35,7 +35,7 @@ protected:
static int m_iBaseTypeMapA[Item::eBaseItemType_MAXTYPES]; static int m_iBaseTypeMapA[Item::eBaseItemType_MAXTYPES];
typedef struct typedef struct
{ {
int iCount; int iCount;
int iItemBaseType; int iItemBaseType;
@@ -49,7 +49,7 @@ protected:
int m_iCurrentSlotVIndex; int m_iCurrentSlotVIndex;
int m_iRecipeC; int m_iRecipeC;
int m_iContainerType; // 2x2 or 3x3 int m_iContainerType; // 2x2 or 3x3
shared_ptr<LocalPlayer> m_pPlayer; std::shared_ptr<LocalPlayer> m_pPlayer;
int m_iGroupIndex; int m_iGroupIndex;
int iVSlotIndexA[3]; // index of the v slots currently displayed int iVSlotIndexA[3]; // index of the v slots currently displayed
@@ -59,7 +59,7 @@ protected:
static Recipy::_eGroupType m_GroupTypeMapping9GridA[m_iMaxGroup3x3]; static Recipy::_eGroupType m_GroupTypeMapping9GridA[m_iMaxGroup3x3];
Recipy::_eGroupType *m_pGroupA; Recipy::_eGroupType *m_pGroupA;
static LPCWSTR m_GroupTabNameA[3]; static LPCWSTR m_GroupTabNameA[3];
static _eGroupTab m_GroupTabBkgMapping2x2A[m_iMaxGroup2x2]; static _eGroupTab m_GroupTabBkgMapping2x2A[m_iMaxGroup2x2];
static _eGroupTab m_GroupTabBkgMapping3x3A[m_iMaxGroup3x3]; static _eGroupTab m_GroupTabBkgMapping3x3A[m_iMaxGroup3x3];
_eGroupTab *m_pGroupTabA; _eGroupTab *m_pGroupTabA;
@@ -96,13 +96,13 @@ protected:
virtual void hideAllHSlots() = 0; virtual void hideAllHSlots() = 0;
virtual void hideAllVSlots() = 0; virtual void hideAllVSlots() = 0;
virtual void hideAllIngredientsSlots() = 0; virtual void hideAllIngredientsSlots() = 0;
virtual void setCraftHSlotItem(int iPad, int iIndex, shared_ptr<ItemInstance> item, unsigned int uiAlpha) = 0; virtual void setCraftHSlotItem(int iPad, int iIndex, std::shared_ptr<ItemInstance> item, unsigned int uiAlpha) = 0;
virtual void setCraftVSlotItem(int iPad, int iIndex, shared_ptr<ItemInstance> item, unsigned int uiAlpha) = 0; virtual void setCraftVSlotItem(int iPad, int iIndex, std::shared_ptr<ItemInstance> item, unsigned int uiAlpha) = 0;
virtual void setCraftingOutputSlotItem(int iPad, shared_ptr<ItemInstance> item) = 0; virtual void setCraftingOutputSlotItem(int iPad, std::shared_ptr<ItemInstance> item) = 0;
virtual void setCraftingOutputSlotRedBox(bool show) = 0; virtual void setCraftingOutputSlotRedBox(bool show) = 0;
virtual void setIngredientSlotItem(int iPad, int index, shared_ptr<ItemInstance> item) = 0; virtual void setIngredientSlotItem(int iPad, int index, std::shared_ptr<ItemInstance> item) = 0;
virtual void setIngredientSlotRedBox(int index, bool show) = 0; virtual void setIngredientSlotRedBox(int index, bool show) = 0;
virtual void setIngredientDescriptionItem(int iPad, int index, shared_ptr<ItemInstance> item) = 0; virtual void setIngredientDescriptionItem(int iPad, int index, std::shared_ptr<ItemInstance> item) = 0;
virtual void setIngredientDescriptionRedBox(int index, bool show) = 0; virtual void setIngredientDescriptionRedBox(int index, bool show) = 0;
virtual void setIngredientDescriptionText(int index, LPCWSTR text) = 0; virtual void setIngredientDescriptionText(int index, LPCWSTR text) = 0;
virtual void setShowCraftHSlot(int iIndex, bool show) = 0; virtual void setShowCraftHSlot(int iIndex, bool show) = 0;

View File

@@ -12,16 +12,16 @@
// 4J JEV - Images for each tab. // 4J JEV - Images for each tab.
IUIScene_CreativeMenu::TabSpec **IUIScene_CreativeMenu::specs = NULL; IUIScene_CreativeMenu::TabSpec **IUIScene_CreativeMenu::specs = NULL;
vector< shared_ptr<ItemInstance> > IUIScene_CreativeMenu::categoryGroups[eCreativeInventoryGroupsCount]; vector< std::shared_ptr<ItemInstance> > IUIScene_CreativeMenu::categoryGroups[eCreativeInventoryGroupsCount];
#define ITEM(id) list->push_back( shared_ptr<ItemInstance>(new ItemInstance(id, 1, 0)) ); #define ITEM(id) list->push_back( std::shared_ptr<ItemInstance>(new ItemInstance(id, 1, 0)) );
#define ITEM_AUX(id, aux) list->push_back( shared_ptr<ItemInstance>(new ItemInstance(id, 1, aux)) ); #define ITEM_AUX(id, aux) list->push_back( std::shared_ptr<ItemInstance>(new ItemInstance(id, 1, aux)) );
#define DEF(index) list = &categoryGroups[index]; #define DEF(index) list = &categoryGroups[index];
void IUIScene_CreativeMenu::staticCtor() void IUIScene_CreativeMenu::staticCtor()
{ {
vector< shared_ptr<ItemInstance> > *list; vector< std::shared_ptr<ItemInstance> > *list;
// Building Blocks // Building Blocks
@@ -56,7 +56,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::mossStone_Id) ITEM(Tile::mossStone_Id)
@@ -118,7 +118,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)
@@ -232,7 +232,7 @@ void IUIScene_CreativeMenu::staticCtor()
ITEM_AUX(Tile::cobbleWall_Id, WallTile::TYPE_MOSSY) ITEM_AUX(Tile::cobbleWall_Id, WallTile::TYPE_MOSSY)
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::milk_Id) ITEM(Item::milk_Id)
ITEM(Item::cauldron_Id) ITEM(Item::cauldron_Id)
@@ -292,7 +292,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)
@@ -314,7 +314,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::map_Id) ITEM(Item::map_Id)
ITEM(Item::helmet_chain_Id) ITEM(Item::helmet_chain_Id)
ITEM(Item::chestplate_chain_Id) ITEM(Item::chestplate_chain_Id)
@@ -325,7 +325,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)
@@ -336,7 +336,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)
@@ -384,7 +384,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)
@@ -393,13 +393,13 @@ void IUIScene_CreativeMenu::staticCtor()
ITEM(Item::sulphur_Id) ITEM(Item::sulphur_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)
@@ -432,7 +432,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
@@ -464,7 +464,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))
@@ -579,7 +579,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;
@@ -594,7 +594,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]);
@@ -605,7 +605,7 @@ void IUIScene_CreativeMenu::switchTab(ECreativeInventoryTabs tab)
IUIScene_CreativeMenu::TabSpec::TabSpec(LPCWSTR icon, int descriptionId, int staticGroupsCount, ECreative_Inventory_Groups *staticGroups, int dynamicGroupsCount, ECreative_Inventory_Groups *dynamicGroups) IUIScene_CreativeMenu::TabSpec::TabSpec(LPCWSTR icon, int descriptionId, int staticGroupsCount, ECreative_Inventory_Groups *staticGroups, int dynamicGroupsCount, ECreative_Inventory_Groups *dynamicGroups)
: m_icon(icon), m_descriptionId(descriptionId), m_staticGroupsCount(staticGroupsCount), m_dynamicGroupsCount(dynamicGroupsCount) : m_icon(icon), m_descriptionId(descriptionId), m_staticGroupsCount(staticGroupsCount), m_dynamicGroupsCount(dynamicGroupsCount)
{ {
m_pages = 0; m_pages = 0;
m_staticGroupsA = NULL; m_staticGroupsA = NULL;
@@ -708,10 +708,10 @@ unsigned int IUIScene_CreativeMenu::TabSpec::getPageCount()
// 4J JEV - Item Picker Menu // 4J JEV - Item Picker Menu
IUIScene_CreativeMenu::ItemPickerMenu::ItemPickerMenu( shared_ptr<SimpleContainer> smp, shared_ptr<Inventory> inv ) : AbstractContainerMenu() IUIScene_CreativeMenu::ItemPickerMenu::ItemPickerMenu( std::shared_ptr<SimpleContainer> smp, std::shared_ptr<Inventory> inv ) : AbstractContainerMenu()
{ {
inventory = inv; inventory = inv;
creativeContainer = smp; creativeContainer = smp;
//int startLength = slots->size(); //int startLength = slots->size();
@@ -734,7 +734,7 @@ IUIScene_CreativeMenu::ItemPickerMenu::ItemPickerMenu( shared_ptr<SimpleContaine
containerId = CONTAINER_ID_CREATIVE; containerId = CONTAINER_ID_CREATIVE;
} }
bool IUIScene_CreativeMenu::ItemPickerMenu::stillValid(shared_ptr<Player> player) bool IUIScene_CreativeMenu::ItemPickerMenu::stillValid(std::shared_ptr<Player> player)
{ {
return true; return true;
} }
@@ -752,7 +752,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;
} }
@@ -794,7 +794,7 @@ bool IUIScene_CreativeMenu::handleValidKeyPress(int iPad, int buttonNum, BOOL qu
Minecraft *pMinecraft = Minecraft::GetInstance(); Minecraft *pMinecraft = Minecraft::GetInstance();
for(unsigned int i = TabSpec::MAX_SIZE; i < TabSpec::MAX_SIZE + 9; ++i) for(unsigned int i = TabSpec::MAX_SIZE; i < TabSpec::MAX_SIZE + 9; ++i)
{ {
shared_ptr<ItemInstance> newItem = m_menu->getSlot(i)->getItem(); std::shared_ptr<ItemInstance> newItem = m_menu->getSlot(i)->getItem();
if(newItem != NULL) if(newItem != NULL)
{ {
@@ -813,7 +813,7 @@ void IUIScene_CreativeMenu::handleOutsideClicked(int iPad, int buttonNum, BOOL q
// Drop items. // Drop items.
Minecraft *pMinecraft = Minecraft::GetInstance(); Minecraft *pMinecraft = Minecraft::GetInstance();
shared_ptr<Inventory> playerInventory = pMinecraft->localplayers[iPad]->inventory; std::shared_ptr<Inventory> playerInventory = pMinecraft->localplayers[iPad]->inventory;
if (playerInventory->getCarried() != NULL) if (playerInventory->getCarried() != NULL)
{ {
if (buttonNum == 0) if (buttonNum == 0)
@@ -823,7 +823,7 @@ void IUIScene_CreativeMenu::handleOutsideClicked(int iPad, int buttonNum, BOOL q
} }
if (buttonNum == 1) if (buttonNum == 1)
{ {
shared_ptr<ItemInstance> removedItem = playerInventory->getCarried()->remove(1); std::shared_ptr<ItemInstance> removedItem = playerInventory->getCarried()->remove(1);
pMinecraft->localgameModes[iPad]->handleCreativeModeItemDrop(removedItem); pMinecraft->localgameModes[iPad]->handleCreativeModeItemDrop(removedItem);
if (playerInventory->getCarried()->count == 0) playerInventory->setCarried(nullptr); if (playerInventory->getCarried()->count == 0) playerInventory->setCarried(nullptr);
} }
@@ -841,7 +841,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;
@@ -894,9 +894,9 @@ void IUIScene_CreativeMenu::handleSlotListClicked(ESceneSection eSection, int bu
if (buttonNum == 0) if (buttonNum == 0)
{ {
shared_ptr<Inventory> playerInventory = pMinecraft->localplayers[getPad()]->inventory; std::shared_ptr<Inventory> playerInventory = pMinecraft->localplayers[getPad()]->inventory;
shared_ptr<ItemInstance> carried = playerInventory->getCarried(); std::shared_ptr<ItemInstance> carried = playerInventory->getCarried();
shared_ptr<ItemInstance> clicked = m_menu->getSlot(currentIndex)->getItem(); std::shared_ptr<ItemInstance> clicked = m_menu->getSlot(currentIndex)->getItem();
if (clicked != NULL) if (clicked != NULL)
{ {
playerInventory->setCarried(ItemInstance::clone(clicked)); playerInventory->setCarried(ItemInstance::clone(clicked));
@@ -928,7 +928,7 @@ void IUIScene_CreativeMenu::handleSlotListClicked(ESceneSection eSection, int bu
quickKeyHeld = FALSE; quickKeyHeld = FALSE;
} }
m_menu->clicked(currentIndex, buttonNum, quickKeyHeld?AbstractContainerMenu::CLICK_QUICK_MOVE:AbstractContainerMenu::CLICK_PICKUP, pMinecraft->localplayers[getPad()]); m_menu->clicked(currentIndex, buttonNum, quickKeyHeld?AbstractContainerMenu::CLICK_QUICK_MOVE:AbstractContainerMenu::CLICK_PICKUP, pMinecraft->localplayers[getPad()]);
shared_ptr<ItemInstance> newItem = m_menu->getSlot(currentIndex)->getItem(); std::shared_ptr<ItemInstance> newItem = m_menu->getSlot(currentIndex)->getItem();
// call this function to synchronize multiplayer item bar // call this function to synchronize multiplayer item bar
pMinecraft->localgameModes[getPad()]->handleCreativeModeItemAdd(newItem, currentIndex - (int)m_menu->slots->size() + 9 + InventoryMenu::USE_ROW_SLOT_START); pMinecraft->localgameModes[getPad()]->handleCreativeModeItemAdd(newItem, currentIndex - (int)m_menu->slots->size() + 9 + InventoryMenu::USE_ROW_SLOT_START);
@@ -941,7 +941,7 @@ void IUIScene_CreativeMenu::handleSlotListClicked(ESceneSection eSection, int bu
m_iCurrSlotX = m_creativeSlotX; m_iCurrSlotX = m_creativeSlotX;
m_iCurrSlotY = m_creativeSlotY; m_iCurrSlotY = m_creativeSlotY;
shared_ptr<Inventory> playerInventory = pMinecraft->localplayers[getPad()]->inventory; std::shared_ptr<Inventory> playerInventory = pMinecraft->localplayers[getPad()]->inventory;
playerInventory->setCarried(nullptr); playerInventory->setCarried(nullptr);
m_bCarryingCreativeItem = false; m_bCarryingCreativeItem = false;
} }
@@ -970,14 +970,14 @@ bool IUIScene_CreativeMenu::CanHaveFocus( ESceneSection eSection )
return false; return false;
} }
bool IUIScene_CreativeMenu::getEmptyInventorySlot(shared_ptr<ItemInstance> item, int &slotX) bool IUIScene_CreativeMenu::getEmptyInventorySlot(std::shared_ptr<ItemInstance> item, int &slotX)
{ {
bool sameItemFound = false; bool sameItemFound = false;
bool emptySlotFound = false; bool emptySlotFound = false;
// Jump to the slot with this item already on it, if we can stack more // Jump to the slot with this item already on it, if we can stack more
for(unsigned int i = TabSpec::MAX_SIZE; i < TabSpec::MAX_SIZE + 9; ++i) for(unsigned int i = TabSpec::MAX_SIZE; i < TabSpec::MAX_SIZE + 9; ++i)
{ {
shared_ptr<ItemInstance> slotItem = m_menu->getSlot(i)->getItem(); std::shared_ptr<ItemInstance> slotItem = m_menu->getSlot(i)->getItem();
if( slotItem != NULL && slotItem->sameItem(item) && (slotItem->GetCount() + item->GetCount() <= item->getMaxStackSize() )) if( slotItem != NULL && slotItem->sameItem(item) && (slotItem->GetCount() + item->GetCount() <= item->getMaxStackSize() ))
{ {
sameItemFound = true; sameItemFound = true;
@@ -1020,7 +1020,7 @@ int IUIScene_CreativeMenu::getSectionStartOffset(ESceneSection eSection)
return offset; return offset;
} }
bool IUIScene_CreativeMenu::overrideTooltips(ESceneSection sectionUnderPointer, shared_ptr<ItemInstance> itemUnderPointer, bool bIsItemCarried, bool bSlotHasItem, bool bCarriedIsSameAsSlot, int iSlotStackSizeRemaining, bool IUIScene_CreativeMenu::overrideTooltips(ESceneSection sectionUnderPointer, std::shared_ptr<ItemInstance> itemUnderPointer, bool bIsItemCarried, bool bSlotHasItem, bool bCarriedIsSameAsSlot, int iSlotStackSizeRemaining,
EToolTipItem &buttonA, EToolTipItem &buttonX, EToolTipItem &buttonY, EToolTipItem &buttonRT) EToolTipItem &buttonA, EToolTipItem &buttonX, EToolTipItem &buttonY, EToolTipItem &buttonRT)
{ {
bool _override = false; bool _override = false;

View File

@@ -74,21 +74,21 @@ public:
class ItemPickerMenu : public AbstractContainerMenu class ItemPickerMenu : public AbstractContainerMenu
{ {
protected: protected:
shared_ptr<SimpleContainer> creativeContainer; std::shared_ptr<SimpleContainer> creativeContainer;
shared_ptr<Inventory> inventory; std::shared_ptr<Inventory> inventory;
public: public:
ItemPickerMenu( shared_ptr<SimpleContainer> creativeContainer, shared_ptr<Inventory> inventory ); ItemPickerMenu( std::shared_ptr<SimpleContainer> creativeContainer, std::shared_ptr<Inventory> inventory );
virtual bool stillValid(shared_ptr<Player> player); virtual bool stillValid(std::shared_ptr<Player> player);
bool isOverrideResultClick(int slotNum, int buttonNum); bool isOverrideResultClick(int slotNum, int buttonNum);
protected: protected:
// 4J Stu - Brought forward from 1.2 to fix infinite recursion bug in creative // 4J Stu - Brought forward from 1.2 to fix infinite recursion bug in creative
virtual void loopClick(int slotIndex, int buttonNum, bool quickKeyHeld, shared_ptr<Player> player) { } // do nothing virtual void loopClick(int slotIndex, int buttonNum, bool quickKeyHeld, std::shared_ptr<Player> player) { } // do nothing
} *itemPickerMenu; } *itemPickerMenu;
protected: protected:
static vector< shared_ptr<ItemInstance> > categoryGroups[eCreativeInventoryGroupsCount]; static vector< std::shared_ptr<ItemInstance> > categoryGroups[eCreativeInventoryGroupsCount];
// 4J JEV - Tabs // 4J JEV - Tabs
static TabSpec **specs; static TabSpec **specs;
@@ -112,11 +112,11 @@ protected:
virtual void handleOutsideClicked(int iPad, int buttonNum, BOOL quickKeyHeld); virtual void handleOutsideClicked(int iPad, int buttonNum, BOOL quickKeyHeld);
virtual void handleAdditionalKeyPress(int iAction); virtual void handleAdditionalKeyPress(int iAction);
virtual void handleSlotListClicked(ESceneSection eSection, int buttonNum, BOOL quickKeyHeld); virtual void handleSlotListClicked(ESceneSection eSection, int buttonNum, BOOL quickKeyHeld);
bool getEmptyInventorySlot(shared_ptr<ItemInstance> item, int &slotX); bool getEmptyInventorySlot(std::shared_ptr<ItemInstance> item, int &slotX);
int getSectionStartOffset(ESceneSection eSection); int getSectionStartOffset(ESceneSection eSection);
virtual bool IsSectionSlotList( ESceneSection eSection ); virtual bool IsSectionSlotList( ESceneSection eSection );
virtual bool CanHaveFocus( ESceneSection eSection ); virtual bool CanHaveFocus( ESceneSection eSection );
virtual bool overrideTooltips(ESceneSection sectionUnderPointer, shared_ptr<ItemInstance> itemUnderPointer, bool bIsItemCarried, bool bSlotHasItem, bool bCarriedIsSameAsSlot, int iSlotStackSizeRemaining, virtual bool overrideTooltips(ESceneSection sectionUnderPointer, std::shared_ptr<ItemInstance> itemUnderPointer, bool bIsItemCarried, bool bSlotHasItem, bool bCarriedIsSameAsSlot, int iSlotStackSizeRemaining,
EToolTipItem &buttonA, EToolTipItem &buttonX, EToolTipItem &buttonY, EToolTipItem &buttonRT); EToolTipItem &buttonA, EToolTipItem &buttonX, EToolTipItem &buttonY, EToolTipItem &buttonRT);
}; };

View File

@@ -16,7 +16,7 @@ IUIScene_TradingMenu::IUIScene_TradingMenu()
m_bHasUpdatedOnce = false; m_bHasUpdatedOnce = false;
} }
shared_ptr<Merchant> IUIScene_TradingMenu::getMerchant() std::shared_ptr<Merchant> IUIScene_TradingMenu::getMerchant()
{ {
return m_merchant; return m_merchant;
} }
@@ -46,11 +46,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);
@@ -70,9 +70,9 @@ bool IUIScene_TradingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat)
if(!activeRecipe->isDeprecated()) if(!activeRecipe->isDeprecated())
{ {
// Do we have the ingredients? // Do we have the ingredients?
shared_ptr<ItemInstance> buyAItem = activeRecipe->getBuyAItem(); std::shared_ptr<ItemInstance> buyAItem = activeRecipe->getBuyAItem();
shared_ptr<ItemInstance> buyBItem = activeRecipe->getBuyBItem(); std::shared_ptr<ItemInstance> buyBItem = activeRecipe->getBuyBItem();
shared_ptr<MultiplayerLocalPlayer> player = Minecraft::GetInstance()->localplayers[getPad()]; std::shared_ptr<MultiplayerLocalPlayer> player = Minecraft::GetInstance()->localplayers[getPad()];
int buyAMatches = player->inventory->countMatches(buyAItem); int buyAMatches = player->inventory->countMatches(buyAItem);
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) )
@@ -84,7 +84,7 @@ bool IUIScene_TradingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat)
player->inventory->removeResources(buyBItem); player->inventory->removeResources(buyBItem);
// Add the item we have purchased // Add the item we have purchased
shared_ptr<ItemInstance> result = activeRecipe->getSellItem()->copy(); std::shared_ptr<ItemInstance> result = activeRecipe->getSellItem()->copy();
if(!player->inventory->add( result ) ) if(!player->inventory->add( result ) )
{ {
player->drop(result); player->drop(result);
@@ -92,7 +92,7 @@ bool IUIScene_TradingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat)
// Send a packet to the server // Send a packet to the server
int actualShopItem = m_activeOffers.at(selectedShopItem).second; int actualShopItem = m_activeOffers.at(selectedShopItem).second;
player->connection->send( shared_ptr<TradeItemPacket>( new TradeItemPacket(m_menu->containerId, actualShopItem) ) ); player->connection->send( std::shared_ptr<TradeItemPacket>( new TradeItemPacket(m_menu->containerId, actualShopItem) ) );
updateDisplay(); updateDisplay();
} }
@@ -149,7 +149,7 @@ bool IUIScene_TradingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat)
ByteArrayOutputStream rawOutput; ByteArrayOutputStream rawOutput;
DataOutputStream output(&rawOutput); DataOutputStream output(&rawOutput);
output.writeInt(actualShopItem); output.writeInt(actualShopItem);
Minecraft::GetInstance()->getConnection(getPad())->send(shared_ptr<CustomPayloadPacket>( new CustomPayloadPacket(CustomPayloadPacket::TRADER_SELECTION_PACKET, rawOutput.toByteArray()))); Minecraft::GetInstance()->getConnection(getPad())->send(std::shared_ptr<CustomPayloadPacket>( new CustomPayloadPacket(CustomPayloadPacket::TRADER_SELECTION_PACKET, rawOutput.toByteArray())));
} }
} }
return handled; return handled;
@@ -203,7 +203,7 @@ void IUIScene_TradingMenu::updateDisplay()
ByteArrayOutputStream rawOutput; ByteArrayOutputStream rawOutput;
DataOutputStream output(&rawOutput); DataOutputStream output(&rawOutput);
output.writeInt(firstValidTrade); output.writeInt(firstValidTrade);
Minecraft::GetInstance()->getConnection(getPad())->send(shared_ptr<CustomPayloadPacket>( new CustomPayloadPacket(CustomPayloadPacket::TRADER_SELECTION_PACKET, rawOutput.toByteArray()))); Minecraft::GetInstance()->getConnection(getPad())->send(std::shared_ptr<CustomPayloadPacket>( new CustomPayloadPacket(CustomPayloadPacket::TRADER_SELECTION_PACKET, rawOutput.toByteArray())));
} }
} }
@@ -247,9 +247,9 @@ void IUIScene_TradingMenu::updateDisplay()
vector<wstring> unformattedStrings; vector<wstring> unformattedStrings;
wstring offerDescription = GetItemDescription(activeRecipe->getSellItem(), unformattedStrings); wstring offerDescription = GetItemDescription(activeRecipe->getSellItem(), unformattedStrings);
setOfferDescription(offerDescription, unformattedStrings); setOfferDescription(offerDescription, unformattedStrings);
shared_ptr<ItemInstance> buyAItem = activeRecipe->getBuyAItem(); std::shared_ptr<ItemInstance> buyAItem = activeRecipe->getBuyAItem();
shared_ptr<ItemInstance> buyBItem = activeRecipe->getBuyBItem(); std::shared_ptr<ItemInstance> buyBItem = activeRecipe->getBuyBItem();
setRequest1Item(buyAItem); setRequest1Item(buyAItem);
setRequest2Item(buyBItem); setRequest2Item(buyBItem);
@@ -262,7 +262,7 @@ void IUIScene_TradingMenu::updateDisplay()
bool canMake = true; bool canMake = true;
shared_ptr<MultiplayerLocalPlayer> player = Minecraft::GetInstance()->localplayers[getPad()]; std::shared_ptr<MultiplayerLocalPlayer> player = Minecraft::GetInstance()->localplayers[getPad()];
int buyAMatches = player->inventory->countMatches(buyAItem); int buyAMatches = player->inventory->countMatches(buyAItem);
if(buyAMatches > 0) if(buyAMatches > 0)
{ {
@@ -321,10 +321,10 @@ bool IUIScene_TradingMenu::canMake(MerchantRecipe *recipe)
{ {
if(recipe->isDeprecated()) return false; if(recipe->isDeprecated()) return false;
shared_ptr<ItemInstance> buyAItem = recipe->getBuyAItem(); std::shared_ptr<ItemInstance> buyAItem = recipe->getBuyAItem();
shared_ptr<ItemInstance> buyBItem = recipe->getBuyBItem(); std::shared_ptr<ItemInstance> buyBItem = recipe->getBuyBItem();
shared_ptr<MultiplayerLocalPlayer> player = Minecraft::GetInstance()->localplayers[getPad()]; std::shared_ptr<MultiplayerLocalPlayer> player = Minecraft::GetInstance()->localplayers[getPad()];
int buyAMatches = player->inventory->countMatches(buyAItem); int buyAMatches = player->inventory->countMatches(buyAItem);
if(buyAMatches > 0) if(buyAMatches > 0)
{ {
@@ -349,19 +349,19 @@ bool IUIScene_TradingMenu::canMake(MerchantRecipe *recipe)
} }
void IUIScene_TradingMenu::setRequest1Item(shared_ptr<ItemInstance> item) void IUIScene_TradingMenu::setRequest1Item(std::shared_ptr<ItemInstance> item)
{ {
} }
void IUIScene_TradingMenu::setRequest2Item(shared_ptr<ItemInstance> item) void IUIScene_TradingMenu::setRequest2Item(std::shared_ptr<ItemInstance> item)
{ {
} }
void IUIScene_TradingMenu::setTradeItem(int index, shared_ptr<ItemInstance> item) void IUIScene_TradingMenu::setTradeItem(int index, std::shared_ptr<ItemInstance> item)
{ {
} }
wstring IUIScene_TradingMenu::GetItemDescription(shared_ptr<ItemInstance> item, vector<wstring> &unformattedStrings) wstring IUIScene_TradingMenu::GetItemDescription(std::shared_ptr<ItemInstance> item, vector<wstring> &unformattedStrings)
{ {
if(item == NULL) return L""; if(item == NULL) return L"";

View File

@@ -7,7 +7,7 @@ class IUIScene_TradingMenu
{ {
protected: protected:
MerchantMenu *m_menu; MerchantMenu *m_menu;
shared_ptr<Merchant> m_merchant; std::shared_ptr<Merchant> m_merchant;
vector< pair<MerchantRecipe *,int> > m_activeOffers; vector< pair<MerchantRecipe *,int> > m_activeOffers;
int m_validOffersCount; int m_validOffersCount;
@@ -39,20 +39,20 @@ protected:
virtual void setRequest1RedBox(bool show) = 0; virtual void setRequest1RedBox(bool show) = 0;
virtual void setRequest2RedBox(bool show) = 0; virtual void setRequest2RedBox(bool show) = 0;
virtual void setTradeRedBox(int index, bool show) = 0; virtual void setTradeRedBox(int index, bool show) = 0;
virtual void setOfferDescription(const wstring &name, vector<wstring> &unformattedStrings) = 0; virtual void setOfferDescription(const wstring &name, vector<wstring> &unformattedStrings) = 0;
virtual void setRequest1Item(shared_ptr<ItemInstance> item); virtual void setRequest1Item(std::shared_ptr<ItemInstance> item);
virtual void setRequest2Item(shared_ptr<ItemInstance> item); virtual void setRequest2Item(std::shared_ptr<ItemInstance> item);
virtual void setTradeItem(int index, shared_ptr<ItemInstance> item); virtual void setTradeItem(int index, std::shared_ptr<ItemInstance> item);
private: private:
void updateDisplay(); void updateDisplay();
bool canMake(MerchantRecipe *recipe); bool canMake(MerchantRecipe *recipe);
wstring GetItemDescription(shared_ptr<ItemInstance> item, vector<wstring> &unformattedStrings); wstring GetItemDescription(std::shared_ptr<ItemInstance> item, vector<wstring> &unformattedStrings);
public: public:
shared_ptr<Merchant> getMerchant(); std::shared_ptr<Merchant> getMerchant();
virtual int getPad() = 0; virtual int getPad() = 0;
}; };

View File

@@ -126,7 +126,7 @@ void UIComponent_TutorialPopup::handleTimerComplete(int id)
} }
void UIComponent_TutorialPopup::_SetDescription(UIScene *interactScene, const wstring &desc, const wstring &title, bool allowFade, bool isReminder) void UIComponent_TutorialPopup::_SetDescription(UIScene *interactScene, const wstring &desc, const wstring &title, bool allowFade, bool isReminder)
{ {
m_interactScene = interactScene; m_interactScene = interactScene;
app.DebugPrintf("Setting m_interactScene to %08x\n", m_interactScene); app.DebugPrintf("Setting m_interactScene to %08x\n", m_interactScene);
if( interactScene != m_lastInteractSceneMoved ) m_lastInteractSceneMoved = NULL; if( interactScene != m_lastInteractSceneMoved ) m_lastInteractSceneMoved = NULL;
@@ -204,12 +204,12 @@ wstring UIComponent_TutorialPopup::_SetIcon(int icon, int iAuxVal, bool isFoil,
wstring temp(desc); wstring temp(desc);
bool isFixedIcon = false; bool isFixedIcon = false;
m_iconIsFoil = isFoil; m_iconIsFoil = isFoil;
if( icon != TUTORIAL_NO_ICON ) if( icon != TUTORIAL_NO_ICON )
{ {
m_iconIsFoil = false; m_iconIsFoil = false;
m_iconItem = shared_ptr<ItemInstance>(new ItemInstance(icon,1,iAuxVal)); m_iconItem = std::shared_ptr<ItemInstance>(new ItemInstance(icon,1,iAuxVal));
} }
else else
{ {
@@ -238,72 +238,72 @@ wstring UIComponent_TutorialPopup::_SetIcon(int icon, int iAuxVal, bool isFoil,
{ {
iAuxVal = 0; iAuxVal = 0;
} }
m_iconItem = shared_ptr<ItemInstance>(new ItemInstance(iconId,1,iAuxVal)); m_iconItem = std::shared_ptr<ItemInstance>(new ItemInstance(iconId,1,iAuxVal));
temp.replace(iconTagStartPos, iconEndPos - iconTagStartPos + closeTag.length(), L""); temp.replace(iconTagStartPos, iconEndPos - iconTagStartPos + closeTag.length(), L"");
} }
} }
// remove any icon text // remove any icon text
else if(temp.find(L"{*CraftingTableIcon*}")!=wstring::npos) else if(temp.find(L"{*CraftingTableIcon*}")!=wstring::npos)
{ {
m_iconItem = shared_ptr<ItemInstance>(new ItemInstance(Tile::workBench_Id,1,0)); m_iconItem = std::shared_ptr<ItemInstance>(new ItemInstance(Tile::workBench_Id,1,0));
} }
else if(temp.find(L"{*SticksIcon*}")!=wstring::npos) else if(temp.find(L"{*SticksIcon*}")!=wstring::npos)
{ {
m_iconItem = shared_ptr<ItemInstance>(new ItemInstance(Item::stick_Id,1,0)); m_iconItem = std::shared_ptr<ItemInstance>(new ItemInstance(Item::stick_Id,1,0));
} }
else if(temp.find(L"{*PlanksIcon*}")!=wstring::npos) else if(temp.find(L"{*PlanksIcon*}")!=wstring::npos)
{ {
m_iconItem = shared_ptr<ItemInstance>(new ItemInstance(Tile::wood_Id,1,0)); m_iconItem = std::shared_ptr<ItemInstance>(new ItemInstance(Tile::wood_Id,1,0));
} }
else if(temp.find(L"{*WoodenShovelIcon*}")!=wstring::npos) else if(temp.find(L"{*WoodenShovelIcon*}")!=wstring::npos)
{ {
m_iconItem = shared_ptr<ItemInstance>(new ItemInstance(Item::shovel_wood_Id,1,0)); m_iconItem = std::shared_ptr<ItemInstance>(new ItemInstance(Item::shovel_wood_Id,1,0));
} }
else if(temp.find(L"{*WoodenHatchetIcon*}")!=wstring::npos) else if(temp.find(L"{*WoodenHatchetIcon*}")!=wstring::npos)
{ {
m_iconItem = shared_ptr<ItemInstance>(new ItemInstance(Item::hatchet_wood_Id,1,0)); m_iconItem = std::shared_ptr<ItemInstance>(new ItemInstance(Item::hatchet_wood_Id,1,0));
} }
else if(temp.find(L"{*WoodenPickaxeIcon*}")!=wstring::npos) else if(temp.find(L"{*WoodenPickaxeIcon*}")!=wstring::npos)
{ {
m_iconItem = shared_ptr<ItemInstance>(new ItemInstance(Item::pickAxe_wood_Id,1,0)); m_iconItem = std::shared_ptr<ItemInstance>(new ItemInstance(Item::pickAxe_wood_Id,1,0));
} }
else if(temp.find(L"{*FurnaceIcon*}")!=wstring::npos) else if(temp.find(L"{*FurnaceIcon*}")!=wstring::npos)
{ {
m_iconItem = shared_ptr<ItemInstance>(new ItemInstance(Tile::furnace_Id,1,0)); m_iconItem = std::shared_ptr<ItemInstance>(new ItemInstance(Tile::furnace_Id,1,0));
} }
else if(temp.find(L"{*WoodenDoorIcon*}")!=wstring::npos) else if(temp.find(L"{*WoodenDoorIcon*}")!=wstring::npos)
{ {
m_iconItem = shared_ptr<ItemInstance>(new ItemInstance(Item::door_wood,1,0)); m_iconItem = std::shared_ptr<ItemInstance>(new ItemInstance(Item::door_wood,1,0));
} }
else if(temp.find(L"{*TorchIcon*}")!=wstring::npos) else if(temp.find(L"{*TorchIcon*}")!=wstring::npos)
{ {
m_iconItem = shared_ptr<ItemInstance>(new ItemInstance(Tile::torch_Id,1,0)); m_iconItem = std::shared_ptr<ItemInstance>(new ItemInstance(Tile::torch_Id,1,0));
} }
else if(temp.find(L"{*BoatIcon*}")!=wstring::npos) else if(temp.find(L"{*BoatIcon*}")!=wstring::npos)
{ {
m_iconItem = shared_ptr<ItemInstance>(new ItemInstance(Item::boat_Id,1,0)); m_iconItem = std::shared_ptr<ItemInstance>(new ItemInstance(Item::boat_Id,1,0));
} }
else if(temp.find(L"{*FishingRodIcon*}")!=wstring::npos) else if(temp.find(L"{*FishingRodIcon*}")!=wstring::npos)
{ {
m_iconItem = shared_ptr<ItemInstance>(new ItemInstance(Item::fishingRod_Id,1,0)); m_iconItem = std::shared_ptr<ItemInstance>(new ItemInstance(Item::fishingRod_Id,1,0));
} }
else if(temp.find(L"{*FishIcon*}")!=wstring::npos) else if(temp.find(L"{*FishIcon*}")!=wstring::npos)
{ {
m_iconItem = shared_ptr<ItemInstance>(new ItemInstance(Item::fish_raw_Id,1,0)); m_iconItem = std::shared_ptr<ItemInstance>(new ItemInstance(Item::fish_raw_Id,1,0));
} }
else if(temp.find(L"{*MinecartIcon*}")!=wstring::npos) else if(temp.find(L"{*MinecartIcon*}")!=wstring::npos)
{ {
m_iconItem = shared_ptr<ItemInstance>(new ItemInstance(Item::minecart_Id,1,0)); m_iconItem = std::shared_ptr<ItemInstance>(new ItemInstance(Item::minecart_Id,1,0));
} }
else if(temp.find(L"{*RailIcon*}")!=wstring::npos) else if(temp.find(L"{*RailIcon*}")!=wstring::npos)
{ {
m_iconItem = shared_ptr<ItemInstance>(new ItemInstance(Tile::rail_Id,1,0)); m_iconItem = std::shared_ptr<ItemInstance>(new ItemInstance(Tile::rail_Id,1,0));
} }
else if(temp.find(L"{*PoweredRailIcon*}")!=wstring::npos) else if(temp.find(L"{*PoweredRailIcon*}")!=wstring::npos)
{ {
m_iconItem = shared_ptr<ItemInstance>(new ItemInstance(Tile::goldenRail_Id,1,0)); m_iconItem = std::shared_ptr<ItemInstance>(new ItemInstance(Tile::goldenRail_Id,1,0));
} }
else if(temp.find(L"{*StructuresIcon*}")!=wstring::npos) else if(temp.find(L"{*StructuresIcon*}")!=wstring::npos)
{ {
@@ -317,7 +317,7 @@ wstring UIComponent_TutorialPopup::_SetIcon(int icon, int iAuxVal, bool isFoil,
} }
else if(temp.find(L"{*StoneIcon*}")!=wstring::npos) else if(temp.find(L"{*StoneIcon*}")!=wstring::npos)
{ {
m_iconItem = shared_ptr<ItemInstance>(new ItemInstance(Tile::rock_Id,1,0)); m_iconItem = std::shared_ptr<ItemInstance>(new ItemInstance(Tile::rock_Id,1,0));
} }
else else
{ {
@@ -358,7 +358,7 @@ wstring UIComponent_TutorialPopup::_SetImage(wstring &desc)
// hide the icon slot // hide the icon slot
m_image.SetShow( FALSE ); m_image.SetShow( FALSE );
} }
BOOL imageShowAtEnd = m_image.IsShown(); BOOL imageShowAtEnd = m_image.IsShown();
if(imageShowAtStart != imageShowAtEnd) if(imageShowAtStart != imageShowAtEnd)
{ {

View File

@@ -15,7 +15,7 @@ private:
bool m_lastSceneMovedLeft; bool m_lastSceneMovedLeft;
bool m_bAllowFade; bool m_bAllowFade;
Tutorial *m_tutorial; Tutorial *m_tutorial;
shared_ptr<ItemInstance> m_iconItem; std::shared_ptr<ItemInstance> m_iconItem;
bool m_iconIsFoil; bool m_iconIsFoil;
//int m_iLocalPlayerC; //int m_iLocalPlayerC;

View File

@@ -100,7 +100,7 @@ void UIControl_EnchantmentBook::tickBook()
{ {
UIScene_EnchantingMenu *m_containerScene = (UIScene_EnchantingMenu *)m_parentScene; UIScene_EnchantingMenu *m_containerScene = (UIScene_EnchantingMenu *)m_parentScene;
EnchantmentMenu *menu = m_containerScene->getMenu(); EnchantmentMenu *menu = m_containerScene->getMenu();
shared_ptr<ItemInstance> current = menu->getSlot(0)->getItem(); std::shared_ptr<ItemInstance> current = menu->getSlot(0)->getItem();
if (!ItemInstance::matches(current, last)) if (!ItemInstance::matches(current, last))
{ {
last = current; last = current;
@@ -122,7 +122,7 @@ void UIControl_EnchantmentBook::tickBook()
{ {
shouldBeOpen = true; shouldBeOpen = true;
} }
} }
if (shouldBeOpen) open += 0.2f; if (shouldBeOpen) open += 0.2f;
else open -= 0.2f; else open -= 0.2f;

View File

@@ -19,7 +19,7 @@ private:
//BOOL m_bDirty; //BOOL m_bDirty;
//float m_fScale,m_fAlpha; //float m_fScale,m_fAlpha;
//int m_iPad; //int m_iPad;
shared_ptr<ItemInstance> last; std::shared_ptr<ItemInstance> last;
//float m_fScreenWidth,m_fScreenHeight; //float m_fScreenWidth,m_fScreenHeight;
//float m_fRawWidth,m_fRawHeight; //float m_fRawWidth,m_fRawHeight;

View File

@@ -597,7 +597,7 @@ void UIScene::customDraw(IggyCustomDrawCallbackRegion *region)
app.DebugPrintf("Handling custom draw for scene with no override!\n"); app.DebugPrintf("Handling custom draw for scene with no override!\n");
} }
void UIScene::customDrawSlotControl(IggyCustomDrawCallbackRegion *region, int iPad, shared_ptr<ItemInstance> item, float fAlpha, bool isFoil, bool bDecorations) void UIScene::customDrawSlotControl(IggyCustomDrawCallbackRegion *region, int iPad, std::shared_ptr<ItemInstance> item, float fAlpha, bool isFoil, bool bDecorations)
{ {
if (item!= NULL) if (item!= NULL)
{ {
@@ -608,7 +608,7 @@ void UIScene::customDrawSlotControl(IggyCustomDrawCallbackRegion *region, int iP
//Make sure that pMinecraft->player is the correct player so that player specific rendering //Make sure that pMinecraft->player is the correct player so that player specific rendering
// eg clock and compass, are rendered correctly // eg clock and compass, are rendered correctly
Minecraft *pMinecraft=Minecraft::GetInstance(); Minecraft *pMinecraft=Minecraft::GetInstance();
shared_ptr<MultiplayerLocalPlayer> oldPlayer = pMinecraft->player; std::shared_ptr<MultiplayerLocalPlayer> oldPlayer = pMinecraft->player;
if( iPad >= 0 && iPad < XUSER_MAX_COUNT ) pMinecraft->player = pMinecraft->localplayers[iPad]; if( iPad >= 0 && iPad < XUSER_MAX_COUNT ) pMinecraft->player = pMinecraft->localplayers[iPad];
// Setup GDraw, normal game render states and matrices // Setup GDraw, normal game render states and matrices
@@ -688,7 +688,7 @@ void UIScene::customDrawSlotControl(IggyCustomDrawCallbackRegion *region, int iP
//Make sure that pMinecraft->player is the correct player so that player specific rendering //Make sure that pMinecraft->player is the correct player so that player specific rendering
// eg clock and compass, are rendered correctly // eg clock and compass, are rendered correctly
shared_ptr<MultiplayerLocalPlayer> oldPlayer = pMinecraft->player; std::shared_ptr<MultiplayerLocalPlayer> oldPlayer = pMinecraft->player;
if( iPad >= 0 && iPad < XUSER_MAX_COUNT ) pMinecraft->player = pMinecraft->localplayers[iPad]; if( iPad >= 0 && iPad < XUSER_MAX_COUNT ) pMinecraft->player = pMinecraft->localplayers[iPad];
_customDrawSlotControl(customDrawRegion, iPad, item, fAlpha, isFoil, bDecorations, false); _customDrawSlotControl(customDrawRegion, iPad, item, fAlpha, isFoil, bDecorations, false);
@@ -701,7 +701,7 @@ void UIScene::customDrawSlotControl(IggyCustomDrawCallbackRegion *region, int iP
} }
} }
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, std::shared_ptr<ItemInstance> item, float fAlpha, bool isFoil, bool bDecorations, bool usingCommandBuffer)
{ {
Minecraft *pMinecraft=Minecraft::GetInstance(); Minecraft *pMinecraft=Minecraft::GetInstance();

View File

@@ -187,7 +187,7 @@ public:
protected: protected:
//void customDrawSlotControl(IggyCustomDrawCallbackRegion *region, int iPad, int iID, int iCount, int iAuxVal, float fAlpha, bool isFoil, bool bDecorations); //void customDrawSlotControl(IggyCustomDrawCallbackRegion *region, int iPad, int iID, int iCount, int iAuxVal, float fAlpha, bool isFoil, bool bDecorations);
void customDrawSlotControl(IggyCustomDrawCallbackRegion *region, int iPad, shared_ptr<ItemInstance> item, float fAlpha, bool isFoil, bool bDecorations); void customDrawSlotControl(IggyCustomDrawCallbackRegion *region, int iPad, std::shared_ptr<ItemInstance> item, float fAlpha, bool isFoil, bool bDecorations);
bool m_cacheSlotRenders; bool m_cacheSlotRenders;
bool m_needsCacheRendered; bool m_needsCacheRendered;
@@ -196,14 +196,14 @@ private:
typedef struct _CachedSlotDrawData typedef struct _CachedSlotDrawData
{ {
CustomDrawData *customDrawRegion; CustomDrawData *customDrawRegion;
shared_ptr<ItemInstance> item; std::shared_ptr<ItemInstance> item;
float fAlpha; float fAlpha;
bool isFoil; bool isFoil;
bool bDecorations; bool bDecorations;
} CachedSlotDrawData; } CachedSlotDrawData;
vector<CachedSlotDrawData *> m_cachedSlotDraw; vector<CachedSlotDrawData *> m_cachedSlotDraw;
void _customDrawSlotControl(CustomDrawData *region, int iPad, shared_ptr<ItemInstance> item, float fAlpha, bool isFoil, bool bDecorations, bool usingCommandBuffer); void _customDrawSlotControl(CustomDrawData *region, int iPad, std::shared_ptr<ItemInstance> item, float fAlpha, bool isFoil, bool bDecorations, bool usingCommandBuffer);
public: public:
// INPUT // INPUT

View File

@@ -49,7 +49,7 @@ void UIScene_AbstractContainerMenu::handleDestroy()
} }
// 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(pMinecraft->localplayers[m_iPad] != NULL) pMinecraft->localplayers[m_iPad]->closeContainer(); if(pMinecraft->localplayers[m_iPad] != NULL) pMinecraft->localplayers[m_iPad]->closeContainer();
ui.OverrideSFX(m_iPad,ACTION_MENU_A,false); ui.OverrideSFX(m_iPad,ACTION_MENU_A,false);
@@ -90,7 +90,7 @@ void UIScene_AbstractContainerMenu::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
#if TO_BE_IMPLEMENTED #if TO_BE_IMPLEMENTED
HXUIOBJ parent; HXUIOBJ parent;
XuiElementGetBounds( m_pointerControl->m_hObj, &fPointerWidth, &fPointerHeight ); XuiElementGetBounds( m_pointerControl->m_hObj, &fPointerWidth, &fPointerHeight );
#else #else
fPointerWidth = 50; fPointerWidth = 50;
fPointerHeight = 50; fPointerHeight = 50;
@@ -103,7 +103,7 @@ void UIScene_AbstractContainerMenu::PlatformInitialize(int iPad, int startIndex)
// Get size of pointer // Get size of pointer
m_fPointerImageOffsetX = 0; //floor(fPointerWidth/2.0f); m_fPointerImageOffsetX = 0; //floor(fPointerWidth/2.0f);
m_fPointerImageOffsetY = 0; //floor(fPointerHeight/2.0f); m_fPointerImageOffsetY = 0; //floor(fPointerHeight/2.0f);
m_fPanelMinX = fPanelX; m_fPanelMinX = fPanelX;
m_fPanelMaxX = fPanelX + fPanelWidth; m_fPanelMaxX = fPanelX + fPanelWidth;
m_fPanelMinY = fPanelY; m_fPanelMinY = fPanelY;
@@ -111,9 +111,9 @@ void UIScene_AbstractContainerMenu::PlatformInitialize(int iPad, int startIndex)
#ifdef __ORBIS__ #ifdef __ORBIS__
// we need to map the touchpad rectangle to the UI rectangle. While it works great for the creative menu, it is much too sensitive for the smaller menus. // we need to map the touchpad rectangle to the UI rectangle. While it works great for the creative menu, it is much too sensitive for the smaller menus.
//X coordinate of the touch point (0 to 1919) //X coordinate of the touch point (0 to 1919)
//Y coordinate of the touch point (0 to 941: DUALSHOCK<43>4 wireless controllers and the CUH-ZCT1J/CAP-ZCT1J/CAP-ZCT1U controllers for the PlayStation<6F>4 development tool, //Y coordinate of the touch point (0 to 941: DUALSHOCK<43>4 wireless controllers and the CUH-ZCT1J/CAP-ZCT1J/CAP-ZCT1U controllers for the PlayStation<6F>4 development tool,
//0 to 753: JDX-1000x series controllers for the PlayStation<6F>4 development tool,) //0 to 753: JDX-1000x series controllers for the PlayStation<6F>4 development tool,)
m_fTouchPadMulX=fPanelWidth/1919.0f; m_fTouchPadMulX=fPanelWidth/1919.0f;
m_fTouchPadMulY=fPanelHeight/941.0f; m_fTouchPadMulY=fPanelHeight/941.0f;
m_fTouchPadDeadZoneX=15.0f*m_fTouchPadMulX; m_fTouchPadDeadZoneX=15.0f*m_fTouchPadMulX;
@@ -161,13 +161,13 @@ void UIScene_AbstractContainerMenu::PlatformInitialize(int iPad, int startIndex)
S32 width, height; S32 width, height;
m_parentLayer->getRenderDimensions(width, height); m_parentLayer->getRenderDimensions(width, height);
S32 x = m_pointerPos.x*((float)width/m_movieWidth); S32 x = m_pointerPos.x*((float)width/m_movieWidth);
S32 y = m_pointerPos.y*((float)height/m_movieHeight); S32 y = m_pointerPos.y*((float)height/m_movieHeight);
IggyMakeEventMouseMove( &mouseEvent, x, y); IggyMakeEventMouseMove( &mouseEvent, x, y);
IggyEventResult result; IggyEventResult result;
IggyPlayerDispatchEventRS ( getMovie() , &mouseEvent , &result ); IggyPlayerDispatchEventRS ( getMovie() , &mouseEvent , &result );
#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;
@@ -332,9 +332,9 @@ void UIScene_AbstractContainerMenu::customDraw(IggyCustomDrawCallbackRegion *reg
Minecraft *pMinecraft = Minecraft::GetInstance(); Minecraft *pMinecraft = Minecraft::GetInstance();
if(pMinecraft->localplayers[m_iPad] == NULL || pMinecraft->localgameModes[m_iPad] == NULL) return; if(pMinecraft->localplayers[m_iPad] == NULL || pMinecraft->localgameModes[m_iPad] == NULL) return;
shared_ptr<ItemInstance> item = nullptr; std::shared_ptr<ItemInstance> item = nullptr;
if(wcscmp((wchar_t *)region->name,L"pointerIcon")==0) if(wcscmp((wchar_t *)region->name,L"pointerIcon")==0)
{ {
m_cacheSlotRenders = false; m_cacheSlotRenders = false;
item = pMinecraft->localplayers[m_iPad]->inventory->getCarried(); item = pMinecraft->localplayers[m_iPad]->inventory->getCarried();
} }
@@ -347,7 +347,7 @@ void UIScene_AbstractContainerMenu::customDraw(IggyCustomDrawCallbackRegion *reg
app.DebugPrintf("This is not the control we are looking for\n"); app.DebugPrintf("This is not the control we are looking for\n");
} }
else else
{ {
m_cacheSlotRenders = true; m_cacheSlotRenders = true;
Slot *slot = m_menu->getSlot(slotId); Slot *slot = m_menu->getSlot(slotId);
item = slot->getItem(); item = slot->getItem();
@@ -398,7 +398,7 @@ void UIScene_AbstractContainerMenu::setFocusToPointer(int iPad)
m_focusSection = eSectionNone; m_focusSection = eSectionNone;
} }
shared_ptr<ItemInstance> UIScene_AbstractContainerMenu::getSlotItem(ESceneSection eSection, int iSlot) std::shared_ptr<ItemInstance> UIScene_AbstractContainerMenu::getSlotItem(ESceneSection eSection, int iSlot)
{ {
Slot *slot = m_menu->getSlot( getSectionStartOffset(eSection) + iSlot ); Slot *slot = m_menu->getSlot( getSectionStartOffset(eSection) + iSlot );
if(slot) return slot->getItem(); if(slot) return slot->getItem();

View File

@@ -31,7 +31,7 @@ protected:
UI_MAP_ELEMENT( m_labelInventory, "inventoryLabel") UI_MAP_ELEMENT( m_labelInventory, "inventoryLabel")
UI_END_MAP_CHILD_ELEMENTS() UI_END_MAP_CHILD_ELEMENTS()
UI_END_MAP_ELEMENTS_AND_NAMES() UI_END_MAP_ELEMENTS_AND_NAMES()
public: public:
UIScene_AbstractContainerMenu(int iPad, UILayer *parentLayer); UIScene_AbstractContainerMenu(int iPad, UILayer *parentLayer);
~UIScene_AbstractContainerMenu(); ~UIScene_AbstractContainerMenu();
@@ -49,7 +49,7 @@ protected:
virtual void setSectionFocus(ESceneSection eSection, int iPad); virtual void setSectionFocus(ESceneSection eSection, int iPad);
void setFocusToPointer(int iPad); void setFocusToPointer(int iPad);
void SetPointerText(const wstring &description, vector<wstring> &unformattedStrings, bool newSlot); void SetPointerText(const wstring &description, vector<wstring> &unformattedStrings, bool newSlot);
virtual shared_ptr<ItemInstance> getSlotItem(ESceneSection eSection, int iSlot); virtual std::shared_ptr<ItemInstance> getSlotItem(ESceneSection eSection, int iSlot);
virtual bool isSlotEmpty(ESceneSection eSection, int iSlot); virtual bool isSlotEmpty(ESceneSection eSection, int iSlot);
virtual void adjustPointerForSafeZone(); virtual void adjustPointerForSafeZone();
@@ -57,7 +57,7 @@ protected:
public: public:
virtual void tick(); virtual void tick();
virtual void render(S32 width, S32 height, C4JRender::eViewportType viewpBort); virtual void render(S32 width, S32 height, C4JRender::eViewportType viewpBort);
virtual void customDraw(IggyCustomDrawCallbackRegion *region); virtual void customDraw(IggyCustomDrawCallbackRegion *region);

View File

@@ -8,7 +8,7 @@ class InventoryMenu;
class UIScene_BrewingStandMenu : public UIScene_AbstractContainerMenu, public IUIScene_BrewingMenu class UIScene_BrewingStandMenu : public UIScene_AbstractContainerMenu, public IUIScene_BrewingMenu
{ {
private: private:
shared_ptr<BrewingStandTileEntity> m_brewingStand; std::shared_ptr<BrewingStandTileEntity> m_brewingStand;
public: public:
UIScene_BrewingStandMenu(int iPad, void *initData, UILayer *parentLayer); UIScene_BrewingStandMenu(int iPad, void *initData, UILayer *parentLayer);

View File

@@ -51,7 +51,7 @@ UIScene_CraftingMenu::UIScene_CraftingMenu(int iPad, void *_initData, UILayer *p
// if we are in splitscreen, then we need to figure out if we want to move this scene // if we are in splitscreen, then we need to figure out if we want to move this scene
if(m_bSplitscreen) if(m_bSplitscreen)
{ {
app.AdjustSplitscreenScene(m_hObj,&m_OriginalPosition,m_iPad); app.AdjustSplitscreenScene(m_hObj,&m_OriginalPosition,m_iPad);
} }
XuiElementSetShow(m_hGrid,TRUE); XuiElementSetShow(m_hGrid,TRUE);
@@ -76,7 +76,7 @@ UIScene_CraftingMenu::UIScene_CraftingMenu(int iPad, void *_initData, UILayer *p
#if TO_BE_IMPLEMENTED #if TO_BE_IMPLEMENTED
// display the first group tab // display the first group tab
m_hTabGroupA[m_iGroupIndex].SetShow(TRUE); m_hTabGroupA[m_iGroupIndex].SetShow(TRUE);
// store the slot 0 position // store the slot 0 position
@@ -196,7 +196,7 @@ void UIScene_CraftingMenu::handleDestroy()
if(gameMode != NULL) gameMode->getTutorial()->changeTutorialState(m_previousTutorialState); if(gameMode != NULL) gameMode->getTutorial()->changeTutorialState(m_previousTutorialState);
} }
// 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();
ui.OverrideSFX(m_iPad,ACTION_MENU_A,false); ui.OverrideSFX(m_iPad,ACTION_MENU_A,false);
@@ -297,7 +297,7 @@ void UIScene_CraftingMenu::handleTouchInput(unsigned int iPad, S32 x, S32 y, int
else else
{ {
iVSlotIndexA[1]--; iVSlotIndexA[1]--;
} }
ui.PlayUISFX(eSFX_Focus); ui.PlayUISFX(eSFX_Focus);
UpdateVerticalSlots(); UpdateVerticalSlots();
@@ -349,7 +349,7 @@ void UIScene_CraftingMenu::handleTouchInput(unsigned int iPad, S32 x, S32 y, int
// 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();
@@ -435,7 +435,7 @@ void UIScene_CraftingMenu::customDraw(IggyCustomDrawCallbackRegion *region)
Minecraft *pMinecraft = Minecraft::GetInstance(); Minecraft *pMinecraft = Minecraft::GetInstance();
if(pMinecraft->localplayers[m_iPad] == NULL || pMinecraft->localgameModes[m_iPad] == NULL) return; if(pMinecraft->localplayers[m_iPad] == NULL || pMinecraft->localgameModes[m_iPad] == NULL) return;
shared_ptr<ItemInstance> item = nullptr; std::shared_ptr<ItemInstance> item = nullptr;
int slotId = -1; int slotId = -1;
float alpha = 1.0f; float alpha = 1.0f;
bool decorations = true; bool decorations = true;
@@ -606,21 +606,21 @@ void UIScene_CraftingMenu::hideAllIngredientsSlots()
} }
} }
void UIScene_CraftingMenu::setCraftHSlotItem(int iPad, int iIndex, shared_ptr<ItemInstance> item, unsigned int uiAlpha) void UIScene_CraftingMenu::setCraftHSlotItem(int iPad, int iIndex, std::shared_ptr<ItemInstance> item, unsigned int uiAlpha)
{ {
m_hSlotsInfo[iIndex].item = item; m_hSlotsInfo[iIndex].item = item;
m_hSlotsInfo[iIndex].alpha = uiAlpha; m_hSlotsInfo[iIndex].alpha = uiAlpha;
m_hSlotsInfo[iIndex].show = true; m_hSlotsInfo[iIndex].show = true;
} }
void UIScene_CraftingMenu::setCraftVSlotItem(int iPad, int iIndex, shared_ptr<ItemInstance> item, unsigned int uiAlpha) void UIScene_CraftingMenu::setCraftVSlotItem(int iPad, int iIndex, std::shared_ptr<ItemInstance> item, unsigned int uiAlpha)
{ {
m_vSlotsInfo[iIndex].item = item; m_vSlotsInfo[iIndex].item = item;
m_vSlotsInfo[iIndex].alpha = uiAlpha; m_vSlotsInfo[iIndex].alpha = uiAlpha;
m_vSlotsInfo[iIndex].show = true; m_vSlotsInfo[iIndex].show = true;
} }
void UIScene_CraftingMenu::setCraftingOutputSlotItem(int iPad, shared_ptr<ItemInstance> item) void UIScene_CraftingMenu::setCraftingOutputSlotItem(int iPad, std::shared_ptr<ItemInstance> item)
{ {
m_craftingOutputSlotInfo.item = item; m_craftingOutputSlotInfo.item = item;
m_craftingOutputSlotInfo.alpha = 31; m_craftingOutputSlotInfo.alpha = 31;
@@ -632,7 +632,7 @@ void UIScene_CraftingMenu::setCraftingOutputSlotRedBox(bool show)
m_slotListCraftingOutput.showSlotRedBox(0,show); m_slotListCraftingOutput.showSlotRedBox(0,show);
} }
void UIScene_CraftingMenu::setIngredientSlotItem(int iPad, int index, shared_ptr<ItemInstance> item) void UIScene_CraftingMenu::setIngredientSlotItem(int iPad, int index, std::shared_ptr<ItemInstance> item)
{ {
m_ingredientsSlotsInfo[index].item = item; m_ingredientsSlotsInfo[index].item = item;
m_ingredientsSlotsInfo[index].alpha = 31; m_ingredientsSlotsInfo[index].alpha = 31;
@@ -644,7 +644,7 @@ void UIScene_CraftingMenu::setIngredientSlotRedBox(int index, bool show)
m_slotListIngredientsLayout.showSlotRedBox(index,show); m_slotListIngredientsLayout.showSlotRedBox(index,show);
} }
void UIScene_CraftingMenu::setIngredientDescriptionItem(int iPad, int index, shared_ptr<ItemInstance> item) void UIScene_CraftingMenu::setIngredientDescriptionItem(int iPad, int index, std::shared_ptr<ItemInstance> item)
{ {
m_ingredientsInfo[index].item = item; m_ingredientsInfo[index].item = item;
m_ingredientsInfo[index].alpha = 31; m_ingredientsInfo[index].alpha = 31;
@@ -680,7 +680,7 @@ void UIScene_CraftingMenu::setShowCraftHSlot(int iIndex, bool show)
void UIScene_CraftingMenu::showTabHighlight(int iIndex, bool show) void UIScene_CraftingMenu::showTabHighlight(int iIndex, bool show)
{ {
if(show) if(show)
{ {
IggyDataValue result; IggyDataValue result;
IggyDataValue value[1]; IggyDataValue value[1];
@@ -729,7 +729,7 @@ void UIScene_CraftingMenu::scrollDescriptionDown()
void UIScene_CraftingMenu::updateHighlightAndScrollPositions() void UIScene_CraftingMenu::updateHighlightAndScrollPositions()
{ {
{ {
IggyDataValue result; IggyDataValue result;
IggyDataValue value[2]; IggyDataValue value[2];

View File

@@ -32,7 +32,7 @@ class UIScene_CraftingMenu : public UIScene, public IUIScene_CraftingMenu
private: private:
typedef struct _SlotInfo typedef struct _SlotInfo
{ {
shared_ptr<ItemInstance> item; std::shared_ptr<ItemInstance> item;
unsigned int alpha; unsigned int alpha;
bool show; bool show;
@@ -97,7 +97,7 @@ protected:
ETouchInput_TouchPanel_5, ETouchInput_TouchPanel_5,
ETouchInput_TouchPanel_6, ETouchInput_TouchPanel_6,
ETouchInput_CraftingHSlots, ETouchInput_CraftingHSlots,
ETouchInput_Count, ETouchInput_Count,
}; };
UIControl_Touch m_TouchInput[ETouchInput_Count]; UIControl_Touch m_TouchInput[ETouchInput_Count];
@@ -182,13 +182,13 @@ protected:
virtual void hideAllHSlots(); virtual void hideAllHSlots();
virtual void hideAllVSlots(); virtual void hideAllVSlots();
virtual void hideAllIngredientsSlots(); virtual void hideAllIngredientsSlots();
virtual void setCraftHSlotItem(int iPad, int iIndex, shared_ptr<ItemInstance> item, unsigned int uiAlpha); virtual void setCraftHSlotItem(int iPad, int iIndex, std::shared_ptr<ItemInstance> item, unsigned int uiAlpha);
virtual void setCraftVSlotItem(int iPad, int iIndex, shared_ptr<ItemInstance> item, unsigned int uiAlpha); virtual void setCraftVSlotItem(int iPad, int iIndex, std::shared_ptr<ItemInstance> item, unsigned int uiAlpha);
virtual void setCraftingOutputSlotItem(int iPad, shared_ptr<ItemInstance> item); virtual void setCraftingOutputSlotItem(int iPad, std::shared_ptr<ItemInstance> item);
virtual void setCraftingOutputSlotRedBox(bool show); virtual void setCraftingOutputSlotRedBox(bool show);
virtual void setIngredientSlotItem(int iPad, int index, shared_ptr<ItemInstance> item); virtual void setIngredientSlotItem(int iPad, int index, std::shared_ptr<ItemInstance> item);
virtual void setIngredientSlotRedBox(int index, bool show); virtual void setIngredientSlotRedBox(int index, bool show);
virtual void setIngredientDescriptionItem(int iPad, int index, shared_ptr<ItemInstance> item); virtual void setIngredientDescriptionItem(int iPad, int index, std::shared_ptr<ItemInstance> item);
virtual void setIngredientDescriptionRedBox(int index, bool show); virtual void setIngredientDescriptionRedBox(int index, bool show);
virtual void setIngredientDescriptionText(int index, LPCWSTR text); virtual void setIngredientDescriptionText(int index, LPCWSTR text);
virtual void setShowCraftHSlot(int iIndex, bool show); virtual void setShowCraftHSlot(int iIndex, bool show);

View File

@@ -21,7 +21,7 @@ UIScene_CreativeMenu::UIScene_CreativeMenu(int iPad, void *_initData, UILayer *p
InventoryScreenInput *initData = (InventoryScreenInput *)_initData; InventoryScreenInput *initData = (InventoryScreenInput *)_initData;
shared_ptr<SimpleContainer> creativeContainer = shared_ptr<SimpleContainer>(new SimpleContainer( 0, TabSpec::MAX_SIZE )); std::shared_ptr<SimpleContainer> creativeContainer = std::shared_ptr<SimpleContainer>(new SimpleContainer( 0, TabSpec::MAX_SIZE ));
itemPickerMenu = new ItemPickerMenu(creativeContainer, initData->player->inventory); itemPickerMenu = new ItemPickerMenu(creativeContainer, initData->player->inventory);
Initialize( initData->iPad, itemPickerMenu, false, -1, eSectionInventoryCreativeUsing, eSectionInventoryCreativeMax, initData->bNavigateBack); Initialize( initData->iPad, itemPickerMenu, false, -1, eSectionInventoryCreativeUsing, eSectionInventoryCreativeMax, initData->bNavigateBack);
@@ -96,7 +96,7 @@ void UIScene_CreativeMenu::handleTouchInput(unsigned int iPad, S32 x, S32 y, int
{ {
// calculate relative touch position on slider // calculate relative touch position on slider
float fPosition = ((float)y - (float)m_TouchInput[ETouchInput_TouchSlider].getYPos() - m_controlMainPanel.getYPos()) / (float)m_TouchInput[ETouchInput_TouchSlider].getHeight(); float fPosition = ((float)y - (float)m_TouchInput[ETouchInput_TouchSlider].getYPos() - m_controlMainPanel.getYPos()) / (float)m_TouchInput[ETouchInput_TouchSlider].getHeight();
// clamp // clamp
if(fPosition > 1) if(fPosition > 1)
fPosition = 1.0f; fPosition = 1.0f;
@@ -105,7 +105,7 @@ void UIScene_CreativeMenu::handleTouchInput(unsigned int iPad, S32 x, S32 y, int
// calculate page position according to page count // calculate page position according to page count
int iCurrentPage = Math::round(fPosition * (specs[m_curTab]->getPageCount() - 1)); int iCurrentPage = Math::round(fPosition * (specs[m_curTab]->getPageCount() - 1));
// set tab page // set tab page
m_tabPage[m_curTab] = iCurrentPage; m_tabPage[m_curTab] = iCurrentPage;
@@ -208,7 +208,7 @@ void UIScene_CreativeMenu::handleInput(int iPad, int key, bool repeat, bool pres
dir = -1; dir = -1;
// Fall through intentional // Fall through intentional
case VK_PAD_RSHOULDER: case VK_PAD_RSHOULDER:
{ {
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;

View File

@@ -127,7 +127,7 @@ void UIScene_DebugOverlay::customDraw(IggyCustomDrawCallbackRegion *region)
} }
else else
{ {
shared_ptr<ItemInstance> item = shared_ptr<ItemInstance>( new ItemInstance(itemId,1,0) ); std::shared_ptr<ItemInstance> item = std::shared_ptr<ItemInstance>( new ItemInstance(itemId,1,0) );
if(item != NULL) customDrawSlotControl(region,m_iPad,item,1.0f,false,false); if(item != NULL) customDrawSlotControl(region,m_iPad,item,1.0f,false,false);
} }
} }
@@ -176,7 +176,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]);
} }
} }

View File

@@ -8,7 +8,7 @@ class InventoryMenu;
class UIScene_FurnaceMenu : public UIScene_AbstractContainerMenu, public IUIScene_FurnaceMenu class UIScene_FurnaceMenu : public UIScene_AbstractContainerMenu, public IUIScene_FurnaceMenu
{ {
private: private:
shared_ptr<FurnaceTileEntity> m_furnace; std::shared_ptr<FurnaceTileEntity> m_furnace;
public: public:
UIScene_FurnaceMenu(int iPad, void *initData, UILayer *parentLayer); UIScene_FurnaceMenu(int iPad, void *initData, UILayer *parentLayer);

View File

@@ -161,7 +161,7 @@ void UIScene_HUD::tick()
} }
else else
{ {
shared_ptr<EnderDragon> boss = EnderDragonRenderer::bossInstance; std::shared_ptr<EnderDragon> boss = EnderDragonRenderer::bossInstance;
// 4J Stu - Don't clear this here as it's wiped for other players // 4J Stu - Don't clear this here as it's wiped for other players
//EnderDragonRenderer::bossInstance = nullptr; //EnderDragonRenderer::bossInstance = nullptr;
m_ticksWithNoBoss = 0; m_ticksWithNoBoss = 0;
@@ -191,7 +191,7 @@ void UIScene_HUD::customDraw(IggyCustomDrawCallbackRegion *region)
else else
{ {
Slot *invSlot = pMinecraft->localplayers[m_iPad]->inventoryMenu->getSlot(InventoryMenu::USE_ROW_SLOT_START + slot); Slot *invSlot = pMinecraft->localplayers[m_iPad]->inventoryMenu->getSlot(InventoryMenu::USE_ROW_SLOT_START + slot);
shared_ptr<ItemInstance> item = invSlot->getItem(); std::shared_ptr<ItemInstance> item = invSlot->getItem();
if(item != NULL) if(item != NULL)
{ {
unsigned char ucAlpha=app.GetGameSettings(ProfileManager.GetPrimaryPad(),eGameSetting_InterfaceOpacity); unsigned char ucAlpha=app.GetGameSettings(ProfileManager.GetPrimaryPad(),eGameSetting_InterfaceOpacity);
@@ -265,7 +265,7 @@ void UIScene_HUD::handleReload()
} }
m_labelJukebox.init(L""); m_labelJukebox.init(L"");
int iGuiScale; int iGuiScale;
Minecraft *pMinecraft = Minecraft::GetInstance(); Minecraft *pMinecraft = Minecraft::GetInstance();
if(pMinecraft->localplayers[m_iPad] == NULL || pMinecraft->localplayers[m_iPad]->m_iScreenSection == C4JRender::VIEWPORT_TYPE_FULLSCREEN) if(pMinecraft->localplayers[m_iPad] == NULL || pMinecraft->localplayers[m_iPad]->m_iScreenSection == C4JRender::VIEWPORT_TYPE_FULLSCREEN)
{ {
@@ -629,7 +629,7 @@ void UIScene_HUD::render(S32 width, S32 height, C4JRender::eViewportType viewpor
} }
IggyPlayerSetDisplaySize( getMovie(), m_movieWidth, m_movieHeight ); IggyPlayerSetDisplaySize( getMovie(), m_movieWidth, m_movieHeight );
m_renderWidth = tileWidth; m_renderWidth = tileWidth;
m_renderHeight = tileHeight; m_renderHeight = tileHeight;
@@ -639,7 +639,7 @@ void UIScene_HUD::render(S32 width, S32 height, C4JRender::eViewportType viewpor
tileYStart , tileYStart ,
tileXStart + tileWidth , tileXStart + tileWidth ,
tileYStart + tileHeight , tileYStart + tileHeight ,
0 ); 0 );
IggyPlayerDrawTilesEnd ( getMovie() ); IggyPlayerDrawTilesEnd ( getMovie() );
} }
else else
@@ -651,7 +651,7 @@ void UIScene_HUD::render(S32 width, S32 height, C4JRender::eViewportType viewpor
void UIScene_HUD::handleTimerComplete(int id) void UIScene_HUD::handleTimerComplete(int id)
{ {
Minecraft *pMinecraft = Minecraft::GetInstance(); Minecraft *pMinecraft = Minecraft::GetInstance();
bool anyVisible = false; bool anyVisible = false;
if(pMinecraft->localplayers[m_iPad]!= NULL) if(pMinecraft->localplayers[m_iPad]!= NULL)
{ {
@@ -735,7 +735,7 @@ void UIScene_HUD::SetDisplayName(const wstring &displayName)
if(displayName.compare(m_displayName) != 0) if(displayName.compare(m_displayName) != 0)
{ {
m_displayName = displayName; m_displayName = displayName;
IggyDataValue result; IggyDataValue result;
IggyDataValue value[1]; IggyDataValue value[1];
IggyStringUTF16 stringVal; IggyStringUTF16 stringVal;
@@ -775,7 +775,7 @@ void UIScene_HUD::handleGameTick()
} }
m_parentLayer->showComponent(m_iPad, eUIScene_HUD,true); m_parentLayer->showComponent(m_iPad, eUIScene_HUD,true);
int iGuiScale; int iGuiScale;
if(pMinecraft->localplayers[m_iPad]->m_iScreenSection == C4JRender::VIEWPORT_TYPE_FULLSCREEN) if(pMinecraft->localplayers[m_iPad]->m_iScreenSection == C4JRender::VIEWPORT_TYPE_FULLSCREEN)
{ {
@@ -788,7 +788,7 @@ void UIScene_HUD::handleGameTick()
SetHudSize(iGuiScale); SetHudSize(iGuiScale);
SetDisplayName(ProfileManager.GetDisplayName(m_iPad)); SetDisplayName(ProfileManager.GetDisplayName(m_iPad));
SetTooltipsEnabled(((ui.GetMenuDisplayed(ProfileManager.GetPrimaryPad())) || (app.GetGameSettings(ProfileManager.GetPrimaryPad(),eGameSetting_Tooltips) != 0))); SetTooltipsEnabled(((ui.GetMenuDisplayed(ProfileManager.GetPrimaryPad())) || (app.GetGameSettings(ProfileManager.GetPrimaryPad(),eGameSetting_Tooltips) != 0)));
#if TO_BE_IMPLEMENTED #if TO_BE_IMPLEMENTED
@@ -797,8 +797,8 @@ void UIScene_HUD::handleGameTick()
{ {
int iTooltipsYOffset = 0; int iTooltipsYOffset = 0;
// if tooltips are off, set the y offset to zero // if tooltips are off, set the y offset to zero
if(app.GetGameSettings(m_iPad,eGameSetting_Tooltips)==0) if(app.GetGameSettings(m_iPad,eGameSetting_Tooltips)==0)
{ {
switch(iGuiScale) switch(iGuiScale)
{ {
case 0: case 0:
@@ -987,11 +987,11 @@ void UIScene_HUD::handleGameTick()
bool bDisplayGui=app.GetGameStarted() && !ui.GetMenuDisplayed(m_iPad) && !(app.GetXuiAction(m_iPad)==eAppAction_AutosaveSaveGameCapturedThumbnail) && app.GetGameSettings(m_iPad,eGameSetting_DisplayHUD)!=0; bool bDisplayGui=app.GetGameStarted() && !ui.GetMenuDisplayed(m_iPad) && !(app.GetXuiAction(m_iPad)==eAppAction_AutosaveSaveGameCapturedThumbnail) && app.GetGameSettings(m_iPad,eGameSetting_DisplayHUD)!=0;
if(bDisplayGui && pMinecraft->localplayers[m_iPad] != NULL) if(bDisplayGui && pMinecraft->localplayers[m_iPad] != NULL)
{ {
setVisible(true); setVisible(true);
} }
else else
{ {
setVisible(false); setVisible(false);
} }
} }
} }

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