mirror of
https://github.com/smartcmd/MinecraftConsoles.git
synced 2026-08-20 09:57:09 +00:00
Merge branch 'main' into Infinite-worlds
This commit is contained in:
commit
484d6bc300
|
|
@ -52,7 +52,7 @@ void AbstractContainerScreen::render(int xm, int ym, float a)
|
|||
glEnable(GL_RESCALE_NORMAL);
|
||||
|
||||
Slot *hoveredSlot = NULL;
|
||||
|
||||
|
||||
AUTO_VAR(itEnd, menu->slots->end());
|
||||
for (AUTO_VAR(it, menu->slots->begin()); it != itEnd; it++)
|
||||
{
|
||||
|
|
@ -75,7 +75,7 @@ void AbstractContainerScreen::render(int xm, int ym, float a)
|
|||
}
|
||||
}
|
||||
|
||||
std::shared_ptr<Inventory> inventory = minecraft->player->inventory;
|
||||
shared_ptr<Inventory> inventory = minecraft->player->inventory;
|
||||
if (inventory->getCarried() != NULL)
|
||||
{
|
||||
glTranslatef(0, 0, 32);
|
||||
|
|
@ -128,7 +128,7 @@ void AbstractContainerScreen::renderSlot(Slot *slot)
|
|||
#if 0
|
||||
int x = slot->x;
|
||||
int y = slot->y;
|
||||
std::shared_ptr<ItemInstance> item = slot->getItem();
|
||||
shared_ptr<ItemInstance> item = slot->getItem();
|
||||
|
||||
if (item == NULL)
|
||||
{
|
||||
|
|
@ -218,7 +218,7 @@ void AbstractContainerScreen::removed()
|
|||
if (minecraft->player == NULL) return;
|
||||
}
|
||||
|
||||
void AbstractContainerScreen::slotsChanged(std::shared_ptr<Container> container)
|
||||
void AbstractContainerScreen::slotsChanged(shared_ptr<Container> container)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ protected:
|
|||
virtual void keyPressed(wchar_t eventCharacter, int eventKey);
|
||||
public:
|
||||
virtual void removed();
|
||||
virtual void slotsChanged(std::shared_ptr<Container> container);
|
||||
virtual void slotsChanged(shared_ptr<Container> container);
|
||||
virtual bool isPauseScreen();
|
||||
virtual void tick();
|
||||
};
|
||||
|
|
@ -13,7 +13,7 @@ private:
|
|||
wstring title;
|
||||
wstring desc;
|
||||
Achievement *ach;
|
||||
int64_t startTime;
|
||||
__int64 startTime;
|
||||
ItemRenderer *ir;
|
||||
bool isHelper;
|
||||
|
||||
|
|
|
|||
|
|
@ -3,11 +3,11 @@
|
|||
#include "..\Minecraft.World\net.minecraft.world.entity.projectile.h"
|
||||
#include "..\Minecraft.World\Mth.h"
|
||||
|
||||
void ArrowRenderer::render(std::shared_ptr<Entity> _arrow, double x, double y, double z, float rot, float a)
|
||||
void ArrowRenderer::render(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 std::shared_ptr<Entity> we have here -
|
||||
// 4J - original version used generics and thus had an input parameter of type Arrow rather than shared_ptr<Entity> we have here -
|
||||
// do some casting around instead
|
||||
std::shared_ptr<Arrow> arrow = dynamic_pointer_cast<Arrow>(_arrow);
|
||||
shared_ptr<Arrow> arrow = dynamic_pointer_cast<Arrow>(_arrow);
|
||||
bindTexture(TN_ITEM_ARROWS); // 4J - was L"/item/arrows.png"
|
||||
|
||||
glPushMatrix();
|
||||
|
|
|
|||
|
|
@ -4,5 +4,5 @@
|
|||
class ArrowRenderer : public EntityRenderer
|
||||
{
|
||||
public:
|
||||
virtual void render(std::shared_ptr<Entity> _arrow, double x, double y, double z, float rot, float a);
|
||||
virtual void render(shared_ptr<Entity> _arrow, double x, double y, double z, float rot, float a);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ BlazeModel::BlazeModel() : Model()
|
|||
{
|
||||
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]->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 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);
|
||||
}
|
||||
head->compile(1.0f/16.0f);
|
||||
}
|
||||
|
||||
int BlazeModel::modelVersion()
|
||||
int BlazeModel::modelVersion()
|
||||
{
|
||||
return 8;
|
||||
}
|
||||
|
||||
void BlazeModel::render(std::shared_ptr<Entity> entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled)
|
||||
void BlazeModel::render(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);
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
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]->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 = .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]->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;
|
||||
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]->x = Mth::cos(angle) * 5.0f;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#pragma once
|
||||
#include "Model.h"
|
||||
|
||||
class BlazeModel : public Model
|
||||
class BlazeModel : public Model
|
||||
{
|
||||
|
||||
private:
|
||||
|
|
@ -11,6 +11,6 @@ private:
|
|||
public:
|
||||
BlazeModel();
|
||||
int modelVersion();
|
||||
virtual void render(std::shared_ptr<Entity> entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled);
|
||||
virtual void render(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);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -8,11 +8,11 @@ BlazeRenderer::BlazeRenderer() : MobRenderer(new BlazeModel(), 0.5f)
|
|||
this->modelVersion = ((BlazeModel *) model)->modelVersion();
|
||||
}
|
||||
|
||||
void BlazeRenderer::render(std::shared_ptr<Entity> _mob, double x, double y, double z, float rot, float a)
|
||||
void BlazeRenderer::render(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 std::shared_ptr<Entity> we have here -
|
||||
// 4J - original version used generics and thus had an input parameter of type Blaze rather than shared_ptr<Entity> we have here -
|
||||
// do some casting around instead
|
||||
std::shared_ptr<Blaze> mob = dynamic_pointer_cast<Blaze>(_mob);
|
||||
shared_ptr<Blaze> mob = dynamic_pointer_cast<Blaze>(_mob);
|
||||
|
||||
int modelVersion = ((BlazeModel *) model)->modelVersion();
|
||||
if (modelVersion != this->modelVersion)
|
||||
|
|
|
|||
|
|
@ -10,5 +10,5 @@ private:
|
|||
public:
|
||||
BlazeRenderer();
|
||||
|
||||
virtual void render(std::shared_ptr<Entity> mob, double x, double y, double z, float rot, float a);
|
||||
virtual void render(shared_ptr<Entity> mob, double x, double y, double z, float rot, float a);
|
||||
};
|
||||
|
|
@ -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]->setPos(0, (float)(0 + yOff), 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[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[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[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[0]->xRot = PI / 2;
|
||||
cubes[1]->yRot = PI / 2 * 3;
|
||||
cubes[2]->yRot = PI / 2 * 1;
|
||||
|
|
@ -42,7 +42,7 @@ BoatModel::BoatModel() : Model()
|
|||
cubes[4]->compile(1.0f/16.0f);
|
||||
}
|
||||
|
||||
void BoatModel::render(std::shared_ptr<Entity> entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled)
|
||||
void BoatModel::render(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++)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -7,5 +7,5 @@ class BoatModel : public Model
|
|||
public:
|
||||
ModelPart *cubes[5];
|
||||
BoatModel();
|
||||
virtual void render(std::shared_ptr<Entity> entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled);
|
||||
virtual void render(shared_ptr<Entity> entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled);
|
||||
};
|
||||
|
|
@ -10,11 +10,11 @@ BoatRenderer::BoatRenderer() : EntityRenderer()
|
|||
model = new BoatModel();
|
||||
}
|
||||
|
||||
void BoatRenderer::render(std::shared_ptr<Entity> _boat, double x, double y, double z, float rot, float a)
|
||||
void BoatRenderer::render(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 std::shared_ptr<Entity> we have here -
|
||||
// 4J - original version used generics and thus had an input parameter of type Boat rather than shared_ptr<Entity> we have here -
|
||||
// do some casting around instead
|
||||
std::shared_ptr<Boat> boat = dynamic_pointer_cast<Boat>(_boat);
|
||||
shared_ptr<Boat> boat = dynamic_pointer_cast<Boat>(_boat);
|
||||
|
||||
glPushMatrix();
|
||||
|
||||
|
|
|
|||
|
|
@ -9,5 +9,5 @@ protected:
|
|||
public:
|
||||
BoatRenderer();
|
||||
|
||||
virtual void render(std::shared_ptr<Entity> boat, double x, double y, double z, float rot, float a);
|
||||
virtual void render(shared_ptr<Entity> boat, double x, double y, double z, float rot, float a);
|
||||
};
|
||||
|
|
@ -3,7 +3,7 @@
|
|||
#include "BookModel.h"
|
||||
#include "ModelPart.h"
|
||||
|
||||
BookModel::BookModel()
|
||||
BookModel::BookModel()
|
||||
{
|
||||
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);
|
||||
|
|
@ -33,7 +33,7 @@ BookModel::BookModel()
|
|||
|
||||
}
|
||||
|
||||
void BookModel::render(std::shared_ptr<Entity> entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled)
|
||||
void BookModel::render(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);
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
#pragma once
|
||||
#include "Model.h"
|
||||
|
||||
class BookModel : public Model
|
||||
class BookModel : public Model
|
||||
{
|
||||
public:
|
||||
ModelPart *leftLid, *rightLid;
|
||||
|
|
@ -11,6 +11,6 @@ public:
|
|||
ModelPart *seam;
|
||||
|
||||
BookModel();
|
||||
virtual void render(std::shared_ptr<Entity> entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled);
|
||||
virtual void render(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);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ float Camera::za = 0.0f;
|
|||
float Camera::xa2 = 0.0f;
|
||||
float Camera::za2 = 0.0f;
|
||||
|
||||
void Camera::prepare(std::shared_ptr<Player> player, bool mirror)
|
||||
void Camera::prepare(shared_ptr<Player> player, bool mirror)
|
||||
{
|
||||
glGetFloat(GL_MODELVIEW_MATRIX, modelview);
|
||||
glGetFloat(GL_PROJECTION_MATRIX, projection);
|
||||
|
|
@ -88,12 +88,12 @@ void Camera::prepare(std::shared_ptr<Player> player, bool mirror)
|
|||
ya = cosf(xRot * PI / 180.0f);
|
||||
}
|
||||
|
||||
TilePos *Camera::getCameraTilePos(std::shared_ptr<Mob> player, double alpha)
|
||||
TilePos *Camera::getCameraTilePos(shared_ptr<Mob> player, double alpha)
|
||||
{
|
||||
return new TilePos(getCameraPos(player, alpha));
|
||||
}
|
||||
|
||||
Vec3 *Camera::getCameraPos(std::shared_ptr<Mob> player, double alpha)
|
||||
Vec3 *Camera::getCameraPos(shared_ptr<Mob> player, double alpha)
|
||||
{
|
||||
double xx = player->xo + (player->x - player->xo) * alpha;
|
||||
double yy = player->yo + (player->y - player->yo) * alpha + player->getHeadHeight();
|
||||
|
|
@ -106,7 +106,7 @@ Vec3 *Camera::getCameraPos(std::shared_ptr<Mob> player, double alpha)
|
|||
return Vec3::newTemp(xt, yt, zt);
|
||||
}
|
||||
|
||||
int Camera::getBlockAt(Level *level, std::shared_ptr<Mob> player, float alpha)
|
||||
int Camera::getBlockAt(Level *level, shared_ptr<Mob> player, float alpha)
|
||||
{
|
||||
Vec3 *p = Camera::getCameraPos(player, alpha);
|
||||
TilePos tp = TilePos(p);
|
||||
|
|
|
|||
|
|
@ -24,9 +24,9 @@ private:
|
|||
public:
|
||||
static float xa, ya, za, xa2, za2;
|
||||
|
||||
static void prepare(std::shared_ptr<Player> player, bool mirror);
|
||||
static void prepare(shared_ptr<Player> player, bool mirror);
|
||||
|
||||
static TilePos *getCameraTilePos(std::shared_ptr<Mob> player, double alpha);
|
||||
static Vec3 *getCameraPos(std::shared_ptr<Mob> player, double alpha);
|
||||
static int getBlockAt(Level *level, std::shared_ptr<Mob> player, float alpha);
|
||||
static TilePos *getCameraTilePos(shared_ptr<Mob> player, double alpha);
|
||||
static Vec3 *getCameraPos(shared_ptr<Mob> player, double alpha);
|
||||
static int getBlockAt(Level *level, shared_ptr<Mob> player, float alpha);
|
||||
};
|
||||
|
|
@ -18,10 +18,10 @@ ChestRenderer::~ChestRenderer()
|
|||
delete largeChestModel;
|
||||
}
|
||||
|
||||
void ChestRenderer::render(std::shared_ptr<TileEntity> _chest, double x, double y, double z, float a, bool setColor, float alpha, bool useCompiled)
|
||||
void ChestRenderer::render(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
|
||||
std::shared_ptr<ChestTileEntity> chest = dynamic_pointer_cast<ChestTileEntity>(_chest);
|
||||
shared_ptr<ChestTileEntity> chest = dynamic_pointer_cast<ChestTileEntity>(_chest);
|
||||
|
||||
int data;
|
||||
|
||||
|
|
|
|||
|
|
@ -11,8 +11,8 @@ private:
|
|||
ChestModel *largeChestModel;
|
||||
|
||||
public:
|
||||
ChestRenderer();
|
||||
ChestRenderer();
|
||||
~ChestRenderer();
|
||||
|
||||
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
|
||||
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
|
||||
};
|
||||
|
|
|
|||
|
|
@ -49,10 +49,10 @@ ChickenModel::ChickenModel() : Model()
|
|||
wing1->compile(1.0f/16.0f);
|
||||
}
|
||||
|
||||
void ChickenModel::render(std::shared_ptr<Entity> entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled)
|
||||
void ChickenModel::render(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);
|
||||
if (young)
|
||||
if (young)
|
||||
{
|
||||
float ss = 2;
|
||||
glPushMatrix();
|
||||
|
|
@ -70,8 +70,8 @@ void ChickenModel::render(std::shared_ptr<Entity> entity, float time, float r, f
|
|||
wing0->render(scale,usecompiled);
|
||||
wing1->render(scale,usecompiled);
|
||||
glPopMatrix();
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
head->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->yRot = yRot / (float) (180 / PI);
|
||||
|
||||
|
||||
beak->xRot = head->xRot;
|
||||
beak->yRot = head->yRot;
|
||||
|
||||
|
||||
redThing->xRot = head->xRot;
|
||||
redThing->yRot = head->yRot;
|
||||
|
||||
|
||||
body->xRot = 90 / (float) (180 / PI);
|
||||
|
||||
leg0->xRot = (Mth::cos(time * 0.6662f) * 1.4f) * r;
|
||||
|
|
|
|||
|
|
@ -6,6 +6,6 @@ public:
|
|||
ModelPart *head, *hair, *body, *leg0, *leg1, *wing0,* wing1, *beak, *redThing;
|
||||
|
||||
ChickenModel();
|
||||
virtual void render(std::shared_ptr<Entity> entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled);
|
||||
virtual void render(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);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -7,18 +7,18 @@ ChickenRenderer::ChickenRenderer(Model *model, float shadow) : MobRenderer(model
|
|||
{
|
||||
}
|
||||
|
||||
void ChickenRenderer::render(std::shared_ptr<Entity> _mob, double x, double y, double z, float rot, float a)
|
||||
void ChickenRenderer::render(shared_ptr<Entity> _mob, double x, double y, double z, float rot, float a)
|
||||
{
|
||||
MobRenderer::render(_mob, x, y, z, rot, a);
|
||||
}
|
||||
|
||||
float ChickenRenderer::getBob(std::shared_ptr<Mob> _mob, float a)
|
||||
float ChickenRenderer::getBob(shared_ptr<Mob> _mob, float a)
|
||||
{
|
||||
// 4J - dynamic cast required because we aren't using templates/generics in our version
|
||||
std::shared_ptr<Chicken> mob = dynamic_pointer_cast<Chicken>(_mob);
|
||||
shared_ptr<Chicken> mob = dynamic_pointer_cast<Chicken>(_mob);
|
||||
|
||||
float flap = mob->oFlap+(mob->flap-mob->oFlap)*a;
|
||||
float flapSpeed = mob->oFlapSpeed+(mob->flapSpeed-mob->oFlapSpeed)*a;
|
||||
|
||||
|
||||
return (Mth::sin(flap)+1)*flapSpeed;
|
||||
}
|
||||
|
|
@ -5,7 +5,7 @@ class ChickenRenderer : public MobRenderer
|
|||
{
|
||||
public:
|
||||
ChickenRenderer(Model *model, float shadow);
|
||||
virtual void render(std::shared_ptr<Entity> _mob, double x, double y, double z, float rot, float a);
|
||||
virtual void render(shared_ptr<Entity> _mob, double x, double y, double z, float rot, float a);
|
||||
protected:
|
||||
virtual float getBob(std::shared_ptr<Mob> _mob, float a);
|
||||
virtual float getBob(shared_ptr<Mob> _mob, float a);
|
||||
};
|
||||
|
|
@ -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);
|
||||
}
|
||||
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.
|
||||
// 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);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
void Chunk::translateToPos()
|
||||
|
|
@ -173,7 +173,7 @@ void Chunk::makeCopyForRebuild(Chunk *source)
|
|||
this->clipChunk = NULL;
|
||||
this->id = source->id;
|
||||
this->globalRenderableTileEntities = source->globalRenderableTileEntities;
|
||||
this->globalRenderableTileEntities_cs = source->globalRenderableTileEntities_cs;
|
||||
this->globalRenderableTileEntities_cs = source->globalRenderableTileEntities_cs;
|
||||
}
|
||||
|
||||
void Chunk::rebuild()
|
||||
|
|
@ -186,7 +186,7 @@ void Chunk::rebuild()
|
|||
|
||||
// if (!dirty) return;
|
||||
PIXBeginNamedEvent(0,"Rebuild section A");
|
||||
|
||||
|
||||
#ifdef _LARGE_WORLDS
|
||||
Tesselator *t = Tesselator::getInstance();
|
||||
#else
|
||||
|
|
@ -204,10 +204,10 @@ void Chunk::rebuild()
|
|||
|
||||
LevelChunk::touchedSky = false;
|
||||
|
||||
// unordered_set<std::shared_ptr<TileEntity> > oldTileEntities(renderableTileEntities.begin(),renderableTileEntities.end()); // 4J removed this & next line
|
||||
// unordered_set<shared_ptr<TileEntity> > oldTileEntities(renderableTileEntities.begin(),renderableTileEntities.end()); // 4J removed this & next line
|
||||
// renderableTileEntities.clear();
|
||||
|
||||
vector<std::shared_ptr<TileEntity> > renderableTileEntities; // 4J - added
|
||||
vector<shared_ptr<TileEntity> > renderableTileEntities; // 4J - added
|
||||
|
||||
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,
|
||||
// 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
|
||||
// the cache anyway.
|
||||
// the cache anyway.
|
||||
|
||||
#ifdef _LARGE_WORLDS
|
||||
unsigned char *tileIds = GetTileIdsStorage();
|
||||
|
|
@ -237,9 +237,9 @@ void Chunk::rebuild()
|
|||
TileRenderer *tileRenderer = new TileRenderer(region, this->x, this->y, this->z, tileIds);
|
||||
|
||||
// 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
|
||||
// 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%.
|
||||
// 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
|
||||
// Region::getTile went from 20% to 4%.
|
||||
#ifdef __PSVITA__
|
||||
int xc = x >> 4;
|
||||
int zc = z >> 4;
|
||||
|
|
@ -275,7 +275,7 @@ void Chunk::rebuild()
|
|||
if( yy == (Level::maxBuildHeight - 1) ) continue;
|
||||
if(( xx == 0 ) || ( xx == 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
|
||||
// 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;
|
||||
|
|
@ -337,7 +337,7 @@ void Chunk::rebuild()
|
|||
PIXBeginNamedEvent(0,"Rebuild section C");
|
||||
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;
|
||||
bounds.boundingBox[0] = -g;
|
||||
bounds.boundingBox[1] = -g;
|
||||
|
|
@ -398,11 +398,11 @@ void Chunk::rebuild()
|
|||
t->begin();
|
||||
t->offset((float)(-this->x), (float)(-this->y), (float)(-this->z));
|
||||
}
|
||||
|
||||
|
||||
Tile *tile = Tile::tiles[tileId];
|
||||
if (currentLayer == 0 && tile->isEntityTile())
|
||||
{
|
||||
std::shared_ptr<TileEntity> et = region->getTileEntity(x, y, z);
|
||||
shared_ptr<TileEntity> et = region->getTileEntity(x, y, z);
|
||||
if (TileEntityRenderDispatcher::instance->hasRenderer(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);
|
||||
RenderManager.CBuffClear(lists + 1);
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -552,12 +552,12 @@ void Chunk::rebuild()
|
|||
oldTileEntities.removeAll(renderableTileEntities);
|
||||
globalRenderableTileEntities.removeAll(oldTileEntities);
|
||||
*/
|
||||
|
||||
|
||||
|
||||
unordered_set<std::shared_ptr<TileEntity> > newTileEntities(renderableTileEntities.begin(),renderableTileEntities.end());
|
||||
|
||||
unordered_set<shared_ptr<TileEntity> > newTileEntities(renderableTileEntities.begin(),renderableTileEntities.end());
|
||||
|
||||
AUTO_VAR(endIt, oldTileEntities.end());
|
||||
for( unordered_set<std::shared_ptr<TileEntity> >::iterator it = oldTileEntities.begin(); it != endIt; it++ )
|
||||
for( unordered_set<shared_ptr<TileEntity> >::iterator it = oldTileEntities.begin(); it != endIt; it++ )
|
||||
{
|
||||
newTileEntities.erase(*it);
|
||||
}
|
||||
|
|
@ -566,7 +566,7 @@ void Chunk::rebuild()
|
|||
|
||||
EnterCriticalSection(globalRenderableTileEntities_cs);
|
||||
endIt = newTileEntities.end();
|
||||
for( unordered_set<std::shared_ptr<TileEntity> >::iterator it = newTileEntities.begin(); it != endIt; it++ )
|
||||
for( unordered_set<shared_ptr<TileEntity> >::iterator it = newTileEntities.begin(); it != endIt; it++ )
|
||||
{
|
||||
globalRenderableTileEntities->push_back(*it);
|
||||
}
|
||||
|
|
@ -574,12 +574,12 @@ void Chunk::rebuild()
|
|||
// 4J - All these new things added to globalRenderableTileEntities
|
||||
|
||||
AUTO_VAR(endItRTE, renderableTileEntities.end());
|
||||
for( vector<std::shared_ptr<TileEntity> >::iterator it = renderableTileEntities.begin(); it != endItRTE; it++ )
|
||||
for( vector<shared_ptr<TileEntity> >::iterator it = renderableTileEntities.begin(); it != endItRTE; it++ )
|
||||
{
|
||||
oldTileEntities.erase(*it);
|
||||
}
|
||||
// 4J - oldTileEntities is now the removed items
|
||||
vector<std::shared_ptr<TileEntity> >::iterator it = globalRenderableTileEntities->begin();
|
||||
vector<shared_ptr<TileEntity> >::iterator it = globalRenderableTileEntities->begin();
|
||||
while( it != globalRenderableTileEntities->end() )
|
||||
{
|
||||
if( oldTileEntities.find(*it) != oldTileEntities.end() )
|
||||
|
|
@ -656,10 +656,10 @@ void Chunk::rebuild_SPU()
|
|||
|
||||
LevelChunk::touchedSky = false;
|
||||
|
||||
// unordered_set<std::shared_ptr<TileEntity> > oldTileEntities(renderableTileEntities.begin(),renderableTileEntities.end()); // 4J removed this & next line
|
||||
// unordered_set<shared_ptr<TileEntity> > oldTileEntities(renderableTileEntities.begin(),renderableTileEntities.end()); // 4J removed this & next line
|
||||
// renderableTileEntities.clear();
|
||||
|
||||
vector<std::shared_ptr<TileEntity> > renderableTileEntities; // 4J - added
|
||||
vector<shared_ptr<TileEntity> > renderableTileEntities; // 4J - added
|
||||
|
||||
// List<TileEntity> newTileEntities = new ArrayList<TileEntity>();
|
||||
// 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,
|
||||
// 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
|
||||
// the cache anyway.
|
||||
// the cache anyway.
|
||||
ChunkRebuildData* pOutData = NULL;
|
||||
g_rebuildDataIn.buildForChunk(®ion, level, x0, y0, z0);
|
||||
|
||||
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;
|
||||
bounds.boundingBox[0] = -g;
|
||||
bounds.boundingBox[1] = -g;
|
||||
|
|
@ -750,7 +750,7 @@ void Chunk::rebuild_SPU()
|
|||
{
|
||||
if (currentLayer == 0 && Tile::tiles[tileId]->isEntityTile())
|
||||
{
|
||||
std::shared_ptr<TileEntity> et = region.getTileEntity(x, y, z);
|
||||
shared_ptr<TileEntity> et = region.getTileEntity(x, y, z);
|
||||
if (TileEntityRenderDispatcher::instance->hasRenderer(et))
|
||||
{
|
||||
renderableTileEntities.push_back(et);
|
||||
|
|
@ -881,12 +881,12 @@ void Chunk::rebuild_SPU()
|
|||
oldTileEntities.removeAll(renderableTileEntities);
|
||||
globalRenderableTileEntities.removeAll(oldTileEntities);
|
||||
*/
|
||||
|
||||
|
||||
|
||||
unordered_set<std::shared_ptr<TileEntity> > newTileEntities(renderableTileEntities.begin(),renderableTileEntities.end());
|
||||
|
||||
unordered_set<shared_ptr<TileEntity> > newTileEntities(renderableTileEntities.begin(),renderableTileEntities.end());
|
||||
|
||||
AUTO_VAR(endIt, oldTileEntities.end());
|
||||
for( unordered_set<std::shared_ptr<TileEntity> >::iterator it = oldTileEntities.begin(); it != endIt; it++ )
|
||||
for( unordered_set<shared_ptr<TileEntity> >::iterator it = oldTileEntities.begin(); it != endIt; it++ )
|
||||
{
|
||||
newTileEntities.erase(*it);
|
||||
}
|
||||
|
|
@ -895,7 +895,7 @@ void Chunk::rebuild_SPU()
|
|||
|
||||
EnterCriticalSection(globalRenderableTileEntities_cs);
|
||||
endIt = newTileEntities.end();
|
||||
for( unordered_set<std::shared_ptr<TileEntity> >::iterator it = newTileEntities.begin(); it != endIt; it++ )
|
||||
for( unordered_set<shared_ptr<TileEntity> >::iterator it = newTileEntities.begin(); it != endIt; it++ )
|
||||
{
|
||||
globalRenderableTileEntities.push_back(*it);
|
||||
}
|
||||
|
|
@ -903,12 +903,12 @@ void Chunk::rebuild_SPU()
|
|||
// 4J - All these new things added to globalRenderableTileEntities
|
||||
|
||||
AUTO_VAR(endItRTE, renderableTileEntities.end());
|
||||
for( vector<std::shared_ptr<TileEntity> >::iterator it = renderableTileEntities.begin(); it != endItRTE; it++ )
|
||||
for( vector<shared_ptr<TileEntity> >::iterator it = renderableTileEntities.begin(); it != endItRTE; it++ )
|
||||
{
|
||||
oldTileEntities.erase(*it);
|
||||
}
|
||||
// 4J - oldTileEntities is now the removed items
|
||||
vector<std::shared_ptr<TileEntity> >::iterator it = globalRenderableTileEntities->begin();
|
||||
vector<shared_ptr<TileEntity> >::iterator it = globalRenderableTileEntities->begin();
|
||||
while( it != globalRenderableTileEntities->end() )
|
||||
{
|
||||
if( oldTileEntities.find(*it) != oldTileEntities.end() )
|
||||
|
|
@ -941,7 +941,7 @@ void Chunk::rebuild_SPU()
|
|||
#endif // _PS3_
|
||||
|
||||
|
||||
float Chunk::distanceToSqr(std::shared_ptr<Entity> player) const
|
||||
float Chunk::distanceToSqr(shared_ptr<Entity> player) const
|
||||
{
|
||||
float xd = (float) (player->x - xm);
|
||||
float yd = (float) (player->y - ym);
|
||||
|
|
@ -949,7 +949,7 @@ float Chunk::distanceToSqr(std::shared_ptr<Entity> player) const
|
|||
return xd * xd + yd * yd + zd * zd;
|
||||
}
|
||||
|
||||
float Chunk::squishedDistanceToSqr(std::shared_ptr<Entity> player)
|
||||
float Chunk::squishedDistanceToSqr(shared_ptr<Entity> player)
|
||||
{
|
||||
float xd = (float) (player->x - xm);
|
||||
float yd = (float) (player->y - ym) * 2;
|
||||
|
|
|
|||
|
|
@ -38,22 +38,22 @@ public:
|
|||
static void ReleaseThreadStorage();
|
||||
static unsigned char *GetTileIdsStorage();
|
||||
#endif
|
||||
|
||||
|
||||
public:
|
||||
static int updates;
|
||||
|
||||
int x, y, z;
|
||||
int xRender, yRender, zRender;
|
||||
int xRenderOffs, yRenderOffs, zRenderOffs;
|
||||
|
||||
|
||||
int xm, ym, zm;
|
||||
AABB *bb;
|
||||
ClipChunk *clipChunk;
|
||||
|
||||
int id;
|
||||
//public:
|
||||
// vector<std::shared_ptr<TileEntity> > renderableTileEntities; // 4J - removed
|
||||
|
||||
// vector<shared_ptr<TileEntity> > renderableTileEntities; // 4J - removed
|
||||
|
||||
private:
|
||||
LevelRenderer::rteMap *globalRenderableTileEntities;
|
||||
CRITICAL_SECTION *globalRenderableTileEntities_cs;
|
||||
|
|
@ -71,8 +71,8 @@ public:
|
|||
#ifdef __PS3__
|
||||
void rebuild_SPU();
|
||||
#endif // __PS3__
|
||||
float distanceToSqr(std::shared_ptr<Entity> player) const;
|
||||
float squishedDistanceToSqr(std::shared_ptr<Entity> player);
|
||||
float distanceToSqr(shared_ptr<Entity> player) const;
|
||||
float squishedDistanceToSqr(shared_ptr<Entity> player);
|
||||
void reset();
|
||||
void _delete();
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -49,92 +49,92 @@ public:
|
|||
~ClientConnection();
|
||||
void tick();
|
||||
INetworkPlayer *getNetworkPlayer();
|
||||
virtual void handleLogin(std::shared_ptr<LoginPacket> packet);
|
||||
virtual void handleAddEntity(std::shared_ptr<AddEntityPacket> packet);
|
||||
virtual void handleAddExperienceOrb(std::shared_ptr<AddExperienceOrbPacket> packet);
|
||||
virtual void handleAddGlobalEntity(std::shared_ptr<AddGlobalEntityPacket> packet);
|
||||
virtual void handleAddPainting(std::shared_ptr<AddPaintingPacket> packet);
|
||||
virtual void handleSetEntityMotion(std::shared_ptr<SetEntityMotionPacket> packet);
|
||||
virtual void handleSetEntityData(std::shared_ptr<SetEntityDataPacket> packet);
|
||||
virtual void handleAddPlayer(std::shared_ptr<AddPlayerPacket> packet);
|
||||
virtual void handleTeleportEntity(std::shared_ptr<TeleportEntityPacket> packet);
|
||||
virtual void handleMoveEntity(std::shared_ptr<MoveEntityPacket> packet);
|
||||
virtual void handleRotateMob(std::shared_ptr<RotateHeadPacket> packet);
|
||||
virtual void handleMoveEntitySmall(std::shared_ptr<MoveEntityPacketSmall> packet);
|
||||
virtual void handleRemoveEntity(std::shared_ptr<RemoveEntitiesPacket> packet);
|
||||
virtual void handleMovePlayer(std::shared_ptr<MovePlayerPacket> packet);
|
||||
virtual void handleLogin(shared_ptr<LoginPacket> packet);
|
||||
virtual void handleAddEntity(shared_ptr<AddEntityPacket> packet);
|
||||
virtual void handleAddExperienceOrb(shared_ptr<AddExperienceOrbPacket> packet);
|
||||
virtual void handleAddGlobalEntity(shared_ptr<AddGlobalEntityPacket> packet);
|
||||
virtual void handleAddPainting(shared_ptr<AddPaintingPacket> packet);
|
||||
virtual void handleSetEntityMotion(shared_ptr<SetEntityMotionPacket> packet);
|
||||
virtual void handleSetEntityData(shared_ptr<SetEntityDataPacket> packet);
|
||||
virtual void handleAddPlayer(shared_ptr<AddPlayerPacket> packet);
|
||||
virtual void handleTeleportEntity(shared_ptr<TeleportEntityPacket> packet);
|
||||
virtual void handleMoveEntity(shared_ptr<MoveEntityPacket> packet);
|
||||
virtual void handleRotateMob(shared_ptr<RotateHeadPacket> packet);
|
||||
virtual void handleMoveEntitySmall(shared_ptr<MoveEntityPacketSmall> packet);
|
||||
virtual void handleRemoveEntity(shared_ptr<RemoveEntitiesPacket> packet);
|
||||
virtual void handleMovePlayer(shared_ptr<MovePlayerPacket> packet);
|
||||
|
||||
Random *random;
|
||||
|
||||
|
||||
// 4J Added
|
||||
virtual void handleChunkVisibilityArea(std::shared_ptr<ChunkVisibilityAreaPacket> packet);
|
||||
virtual void handleChunkVisibilityArea(shared_ptr<ChunkVisibilityAreaPacket> packet);
|
||||
|
||||
virtual void handleChunkVisibility(std::shared_ptr<ChunkVisibilityPacket> 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 handleChunkVisibility(shared_ptr<ChunkVisibilityPacket> packet);
|
||||
virtual void handleChunkTilesUpdate(shared_ptr<ChunkTilesUpdatePacket> packet);
|
||||
virtual void handleBlockRegionUpdate(shared_ptr<BlockRegionUpdatePacket> packet);
|
||||
virtual void handleTileUpdate(shared_ptr<TileUpdatePacket> packet);
|
||||
virtual void handleDisconnect(shared_ptr<DisconnectPacket> packet);
|
||||
virtual void onDisconnect(DisconnectPacket::eDisconnectReason reason, void *reasonObjects);
|
||||
void sendAndDisconnect(std::shared_ptr<Packet> packet);
|
||||
void send(std::shared_ptr<Packet> packet);
|
||||
virtual void handleTakeItemEntity(std::shared_ptr<TakeItemEntityPacket> packet);
|
||||
virtual void handleChat(std::shared_ptr<ChatPacket> packet);
|
||||
virtual void handleAnimate(std::shared_ptr<AnimatePacket> packet);
|
||||
virtual void handleEntityActionAtPosition(std::shared_ptr<EntityActionAtPositionPacket> packet);
|
||||
virtual void handlePreLogin(std::shared_ptr<PreLoginPacket> packet);
|
||||
void sendAndDisconnect(shared_ptr<Packet> packet);
|
||||
void send(shared_ptr<Packet> packet);
|
||||
virtual void handleTakeItemEntity(shared_ptr<TakeItemEntityPacket> packet);
|
||||
virtual void handleChat(shared_ptr<ChatPacket> packet);
|
||||
virtual void handleAnimate(shared_ptr<AnimatePacket> packet);
|
||||
virtual void handleEntityActionAtPosition(shared_ptr<EntityActionAtPositionPacket> packet);
|
||||
virtual void handlePreLogin(shared_ptr<PreLoginPacket> packet);
|
||||
void close();
|
||||
virtual void handleAddMob(std::shared_ptr<AddMobPacket> packet);
|
||||
virtual void handleSetTime(std::shared_ptr<SetTimePacket> packet);
|
||||
virtual void handleSetSpawn(std::shared_ptr<SetSpawnPositionPacket> packet);
|
||||
virtual void handleRidePacket(std::shared_ptr<SetRidingPacket> packet);
|
||||
virtual void handleEntityEvent(std::shared_ptr<EntityEventPacket> packet);
|
||||
virtual void handleAddMob(shared_ptr<AddMobPacket> packet);
|
||||
virtual void handleSetTime(shared_ptr<SetTimePacket> packet);
|
||||
virtual void handleSetSpawn(shared_ptr<SetSpawnPositionPacket> packet);
|
||||
virtual void handleRidePacket(shared_ptr<SetRidingPacket> packet);
|
||||
virtual void handleEntityEvent(shared_ptr<EntityEventPacket> packet);
|
||||
private:
|
||||
std::shared_ptr<Entity> getEntity(int entityId);
|
||||
shared_ptr<Entity> getEntity(int entityId);
|
||||
wstring GetDisplayNameByGamertag(wstring gamertag);
|
||||
public:
|
||||
virtual void handleSetHealth(std::shared_ptr<SetHealthPacket> packet);
|
||||
virtual void handleSetExperience(std::shared_ptr<SetExperiencePacket> packet);
|
||||
virtual void handleRespawn(std::shared_ptr<RespawnPacket> packet);
|
||||
virtual void handleExplosion(std::shared_ptr<ExplodePacket> packet);
|
||||
virtual void handleContainerOpen(std::shared_ptr<ContainerOpenPacket> packet);
|
||||
virtual void handleContainerSetSlot(std::shared_ptr<ContainerSetSlotPacket> packet);
|
||||
virtual void handleContainerAck(std::shared_ptr<ContainerAckPacket> packet);
|
||||
virtual void handleContainerContent(std::shared_ptr<ContainerSetContentPacket> packet);
|
||||
virtual void handleSignUpdate(std::shared_ptr<SignUpdatePacket> packet);
|
||||
virtual void handleTileEntityData(std::shared_ptr<TileEntityDataPacket> packet);
|
||||
virtual void handleContainerSetData(std::shared_ptr<ContainerSetDataPacket> packet);
|
||||
virtual void handleSetEquippedItem(std::shared_ptr<SetEquippedItemPacket> packet);
|
||||
virtual void handleContainerClose(std::shared_ptr<ContainerClosePacket> packet);
|
||||
virtual void handleTileEvent(std::shared_ptr<TileEventPacket> packet);
|
||||
virtual void handleTileDestruction(std::shared_ptr<TileDestructionPacket> packet);
|
||||
virtual void handleSetHealth(shared_ptr<SetHealthPacket> packet);
|
||||
virtual void handleSetExperience(shared_ptr<SetExperiencePacket> packet);
|
||||
virtual void handleRespawn(shared_ptr<RespawnPacket> packet);
|
||||
virtual void handleExplosion(shared_ptr<ExplodePacket> packet);
|
||||
virtual void handleContainerOpen(shared_ptr<ContainerOpenPacket> packet);
|
||||
virtual void handleContainerSetSlot(shared_ptr<ContainerSetSlotPacket> packet);
|
||||
virtual void handleContainerAck(shared_ptr<ContainerAckPacket> packet);
|
||||
virtual void handleContainerContent(shared_ptr<ContainerSetContentPacket> packet);
|
||||
virtual void handleSignUpdate(shared_ptr<SignUpdatePacket> packet);
|
||||
virtual void handleTileEntityData(shared_ptr<TileEntityDataPacket> packet);
|
||||
virtual void handleContainerSetData(shared_ptr<ContainerSetDataPacket> packet);
|
||||
virtual void handleSetEquippedItem(shared_ptr<SetEquippedItemPacket> packet);
|
||||
virtual void handleContainerClose(shared_ptr<ContainerClosePacket> packet);
|
||||
virtual void handleTileEvent(shared_ptr<TileEventPacket> packet);
|
||||
virtual void handleTileDestruction(shared_ptr<TileDestructionPacket> packet);
|
||||
virtual bool canHandleAsyncPackets();
|
||||
virtual void handleGameEvent(std::shared_ptr<GameEventPacket> gameEventPacket);
|
||||
virtual void handleComplexItemData(std::shared_ptr<ComplexItemDataPacket> packet);
|
||||
virtual void handleLevelEvent(std::shared_ptr<LevelEventPacket> packet);
|
||||
virtual void handleAwardStat(std::shared_ptr<AwardStatPacket> packet);
|
||||
virtual void handleUpdateMobEffect(std::shared_ptr<UpdateMobEffectPacket> packet);
|
||||
virtual void handleRemoveMobEffect(std::shared_ptr<RemoveMobEffectPacket> packet);
|
||||
virtual void handleGameEvent(shared_ptr<GameEventPacket> gameEventPacket);
|
||||
virtual void handleComplexItemData(shared_ptr<ComplexItemDataPacket> packet);
|
||||
virtual void handleLevelEvent(shared_ptr<LevelEventPacket> packet);
|
||||
virtual void handleAwardStat(shared_ptr<AwardStatPacket> packet);
|
||||
virtual void handleUpdateMobEffect(shared_ptr<UpdateMobEffectPacket> packet);
|
||||
virtual void handleRemoveMobEffect(shared_ptr<RemoveMobEffectPacket> packet);
|
||||
virtual bool isServerPacketListener();
|
||||
virtual void handlePlayerInfo(std::shared_ptr<PlayerInfoPacket> packet);
|
||||
virtual void handleKeepAlive(std::shared_ptr<KeepAlivePacket> packet);
|
||||
virtual void handlePlayerAbilities(std::shared_ptr<PlayerAbilitiesPacket> playerAbilitiesPacket);
|
||||
virtual void handleSoundEvent(std::shared_ptr<LevelSoundPacket> packet);
|
||||
virtual void handleCustomPayload(std::shared_ptr<CustomPayloadPacket> customPayloadPacket);
|
||||
virtual void handlePlayerInfo(shared_ptr<PlayerInfoPacket> packet);
|
||||
virtual void handleKeepAlive(shared_ptr<KeepAlivePacket> packet);
|
||||
virtual void handlePlayerAbilities(shared_ptr<PlayerAbilitiesPacket> playerAbilitiesPacket);
|
||||
virtual void handleSoundEvent(shared_ptr<LevelSoundPacket> packet);
|
||||
virtual void handleCustomPayload(shared_ptr<CustomPayloadPacket> customPayloadPacket);
|
||||
virtual Connection *getConnection();
|
||||
|
||||
// 4J Added
|
||||
virtual void handleServerSettingsChanged(std::shared_ptr<ServerSettingsChangedPacket> packet);
|
||||
virtual void handleTexture(std::shared_ptr<TexturePacket> packet);
|
||||
virtual void handleTextureAndGeometry(std::shared_ptr<TextureAndGeometryPacket> packet);
|
||||
virtual void handleUpdateProgress(std::shared_ptr<UpdateProgressPacket> packet);
|
||||
virtual void handleServerSettingsChanged(shared_ptr<ServerSettingsChangedPacket> packet);
|
||||
virtual void handleTexture(shared_ptr<TexturePacket> packet);
|
||||
virtual void handleTextureAndGeometry(shared_ptr<TextureAndGeometryPacket> packet);
|
||||
virtual void handleUpdateProgress(shared_ptr<UpdateProgressPacket> packet);
|
||||
|
||||
// 4J Added
|
||||
static int HostDisconnectReturned(void *pParam,int iPad,C4JStorage::EMessageResult result);
|
||||
static int ExitGameAndSaveReturned(void *pParam,int iPad,C4JStorage::EMessageResult result);
|
||||
virtual void handleTextureChange(std::shared_ptr<TextureChangePacket> packet);
|
||||
virtual void handleTextureAndGeometryChange(std::shared_ptr<TextureAndGeometryChangePacket> packet);
|
||||
virtual void handleUpdateGameRuleProgressPacket(std::shared_ptr<UpdateGameRuleProgressPacket> packet);
|
||||
virtual void handleXZ(std::shared_ptr<XZPacket> packet);
|
||||
virtual void handleTextureChange(shared_ptr<TextureChangePacket> packet);
|
||||
virtual void handleTextureAndGeometryChange(shared_ptr<TextureAndGeometryChangePacket> packet);
|
||||
virtual void handleUpdateGameRuleProgressPacket(shared_ptr<UpdateGameRuleProgressPacket> packet);
|
||||
virtual void handleXZ(shared_ptr<XZPacket> packet);
|
||||
|
||||
void displayPrivilegeChanges(std::shared_ptr<MultiplayerLocalPlayer> player, unsigned int oldPrivileges);
|
||||
void displayPrivilegeChanges(shared_ptr<MultiplayerLocalPlayer> player, unsigned int oldPrivileges);
|
||||
};
|
||||
|
|
@ -43,7 +43,7 @@ class ConsoleSoundEngine
|
|||
public:
|
||||
|
||||
ConsoleSoundEngine() : m_bIsPlayingStreamingCDMusic(false),m_bIsPlayingStreamingGameMusic(false), m_bIsPlayingEndMusic(false),m_bIsPlayingNetherMusic(false){};
|
||||
virtual void tick(std::shared_ptr<Mob> *players, float a) =0;
|
||||
virtual void tick(shared_ptr<Mob> *players, float a) =0;
|
||||
virtual void destroy()=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;
|
||||
|
|
|
|||
|
|
@ -22,17 +22,17 @@
|
|||
#ifdef __ORBIS__
|
||||
#include <audioout.h>
|
||||
//#define __DISABLE_MILES__ // MGH disabled for now as it crashes if we call sceNpMatching2Initialize
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// take out Orbis until they are done
|
||||
#if defined _XBOX
|
||||
#if defined _XBOX
|
||||
|
||||
SoundEngine::SoundEngine() {}
|
||||
void SoundEngine::init(Options *pOptions)
|
||||
{
|
||||
}
|
||||
|
||||
void SoundEngine::tick(std::shared_ptr<Mob> *players, float a)
|
||||
void SoundEngine::tick(shared_ptr<Mob> *players, float a)
|
||||
{
|
||||
}
|
||||
void SoundEngine::destroy() {}
|
||||
|
|
@ -95,7 +95,7 @@ char SoundEngine::m_szRedistName[]={"redist"};
|
|||
|
||||
#endif
|
||||
|
||||
F32 AILCALLBACK custom_falloff_function (HSAMPLE S,
|
||||
F32 AILCALLBACK custom_falloff_function (HSAMPLE S,
|
||||
F32 distance,
|
||||
F32 rolloff_factor,
|
||||
F32 min_dist,
|
||||
|
|
@ -124,7 +124,7 @@ char *SoundEngine::m_szStreamFileA[eStream_Max]=
|
|||
"menu2",
|
||||
"menu3",
|
||||
"menu4",
|
||||
#endif
|
||||
#endif
|
||||
"piano1",
|
||||
"piano2",
|
||||
"piano3",
|
||||
|
|
@ -209,7 +209,7 @@ void SoundEngine::init(Options *pOptions)
|
|||
#endif
|
||||
#ifdef __ORBIS__
|
||||
C4JThread::PushAffinityAllCores();
|
||||
#endif
|
||||
#endif
|
||||
#if defined _DURANGO || defined __ORBIS__ || defined __PS3__ || defined __PSVITA__
|
||||
Register_RIB(BinkADec);
|
||||
#endif
|
||||
|
|
@ -226,8 +226,8 @@ void SoundEngine::init(Options *pOptions)
|
|||
int iNumberOfChannels=initAudioHardware(8);
|
||||
|
||||
// Create a driver to render our audio - 44khz, 16 bit,
|
||||
#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.
|
||||
#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.
|
||||
m_hDriver = AIL_open_digital_driver( 48000, 16, iNumberOfChannels, AIL_OPEN_DIGITAL_USE_SPU0 );
|
||||
#elif defined __PSVITA__
|
||||
|
||||
|
|
@ -236,7 +236,7 @@ void SoundEngine::init(Options *pOptions)
|
|||
|
||||
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;
|
||||
AIL_platform_property( m_hDriver, PSP2_SUBMIT_THREAD, &threadID, 0, 0);
|
||||
S32 g_DefaultCPU = sceKernelGetThreadCpuAffinityMask(threadID);
|
||||
|
|
@ -260,7 +260,7 @@ void SoundEngine::init(Options *pOptions)
|
|||
AIL_shutdown();
|
||||
#ifdef __ORBIS__
|
||||
C4JThread::PopAffinity();
|
||||
#endif
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
app.DebugPrintf("---SoundEngine::init - driver opened\n");
|
||||
|
|
@ -289,12 +289,12 @@ void SoundEngine::init(Options *pOptions)
|
|||
AIL_shutdown();
|
||||
#ifdef __ORBIS__
|
||||
C4JThread::PopAffinity();
|
||||
#endif
|
||||
#endif
|
||||
app.DebugPrintf("---SoundEngine::init - AIL_startup_event_system failed\n");
|
||||
return;
|
||||
}
|
||||
char szBankName[255];
|
||||
#if defined __PS3__
|
||||
#if defined __PS3__
|
||||
if(app.GetBootedFromDiscPatch())
|
||||
{
|
||||
char szTempSoundFilename[255];
|
||||
|
|
@ -308,7 +308,7 @@ void SoundEngine::init(Options *pOptions)
|
|||
{
|
||||
sprintf(szBankName,"%s/%s",getUsrDirPath(), m_szSoundPath );
|
||||
}
|
||||
|
||||
|
||||
#elif defined __PSVITA__
|
||||
sprintf(szBankName,"%s/%s",getUsrDirPath(), m_szSoundPath );
|
||||
#elif defined __ORBIS__
|
||||
|
|
@ -329,7 +329,7 @@ void SoundEngine::init(Options *pOptions)
|
|||
AIL_shutdown();
|
||||
#ifdef __ORBIS__
|
||||
C4JThread::PopAffinity();
|
||||
#endif
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -362,7 +362,7 @@ void SoundEngine::init(Options *pOptions)
|
|||
#endif
|
||||
|
||||
#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);
|
||||
AIL_init_sample(Sample, DIG_F_STEREO_16);
|
||||
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
|
||||
void SoundEngine::updateMiles()
|
||||
{
|
||||
#ifdef __PSVITA__
|
||||
#ifdef __PSVITA__
|
||||
//CD - We must check for Background Music [BGM] at any point
|
||||
//If it's playing disable our audio, otherwise enable
|
||||
int NoBGMPlaying = sceAudioOutGetAdopt(SCE_AUDIO_OUT_PORT_TYPE_BGM);
|
||||
|
|
@ -463,7 +463,7 @@ void SoundEngine::updateMiles()
|
|||
{
|
||||
isThunder = true;
|
||||
}
|
||||
if(game_data->volume>1)
|
||||
if(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);
|
||||
|
||||
if(game_data->bIs3D)
|
||||
{
|
||||
{
|
||||
AIL_set_sample_is_3D( SoundInfo.Sample, 1 );
|
||||
|
||||
int iSound = game_data->iSound - eSFX_MAX;
|
||||
|
|
@ -518,7 +518,7 @@ void SoundEngine::updateMiles()
|
|||
}
|
||||
|
||||
if(game_data->bIs3D)
|
||||
{
|
||||
{
|
||||
if(m_validListenerCount>1)
|
||||
{
|
||||
float fClosest=10000.0f;
|
||||
|
|
@ -562,7 +562,7 @@ void SoundEngine::updateMiles()
|
|||
|
||||
default:
|
||||
if(game_data->bIs3D)
|
||||
{
|
||||
{
|
||||
if(m_validListenerCount>1)
|
||||
{
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
AIL_complete_event_queue_processing();
|
||||
|
|
@ -622,7 +622,7 @@ static float fVal=0.0f;
|
|||
static S32 running = AIL_ms_count();
|
||||
#endif
|
||||
|
||||
void SoundEngine::tick(std::shared_ptr<Mob> *players, float a)
|
||||
void SoundEngine::tick(shared_ptr<Mob> *players, float a)
|
||||
{
|
||||
#ifdef __DISABLE_MILES__
|
||||
return;
|
||||
|
|
@ -657,7 +657,7 @@ void SoundEngine::tick(std::shared_ptr<Mob> *players, float a)
|
|||
// store the listener positions for splitscreen
|
||||
m_ListenerA[i].vPosition.x = x;
|
||||
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.y = 0;
|
||||
|
|
@ -707,7 +707,7 @@ SoundEngine::SoundEngine()
|
|||
m_hStream=0;
|
||||
m_StreamState=eMusicStreamState_Idle;
|
||||
m_iMusicDelay=0;
|
||||
m_validListenerCount=0;
|
||||
m_validListenerCount=0;
|
||||
|
||||
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
|
||||
/* // 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];
|
||||
// char *SoundName = (char *)ConvertSoundPathToName(name);
|
||||
|
|
@ -810,7 +810,7 @@ void SoundEngine::play(int iSound, float x, float y, float z, float volume, floa
|
|||
// playUI
|
||||
//
|
||||
/////////////////////////////////////////////
|
||||
void SoundEngine::playUI(int iSound, float volume, float pitch)
|
||||
void SoundEngine::playUI(int iSound, float volume, float pitch)
|
||||
{
|
||||
U8 szSoundName[256];
|
||||
wstring name;
|
||||
|
|
@ -956,7 +956,7 @@ int SoundEngine::GetRandomishTrack(int iStart,int iEnd)
|
|||
int iVal=iStart;
|
||||
for(int i=iStart;i<=iEnd;i++)
|
||||
{
|
||||
if(m_bHeardTrackA[i]==false)
|
||||
if(m_bHeardTrackA[i]==false)
|
||||
{
|
||||
bAllTracksHeard=false;
|
||||
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++)
|
||||
{
|
||||
// random->nextInt(1) will always return 0
|
||||
|
|
@ -1111,7 +1111,7 @@ void SoundEngine::updateSystemMusicPlaying(bool isPlaying)
|
|||
// updateSoundEffectVolume
|
||||
//
|
||||
/////////////////////////////////////////////
|
||||
void SoundEngine::updateSoundEffectVolume(float fVal)
|
||||
void SoundEngine::updateSoundEffectVolume(float fVal)
|
||||
{
|
||||
m_MasterEffectsVolume=fVal;
|
||||
//AIL_set_variable_float(0,"UserEffectVol",fVal);
|
||||
|
|
@ -1137,7 +1137,7 @@ int SoundEngine::OpenStreamThreadProc( void* lpParameter )
|
|||
// playMusicTick
|
||||
//
|
||||
/////////////////////////////////////////////
|
||||
void SoundEngine::playMusicTick()
|
||||
void SoundEngine::playMusicTick()
|
||||
{
|
||||
// AP - vita will update the music during the mixer callback
|
||||
#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
|
||||
void SoundEngine::playMusicUpdate()
|
||||
void SoundEngine::playMusicUpdate()
|
||||
{
|
||||
//return;
|
||||
static bool firstCall = true;
|
||||
|
|
@ -1179,7 +1179,7 @@ void SoundEngine::playMusicUpdate()
|
|||
// 4J-PB - Need to check if we are a patched BD build
|
||||
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);
|
||||
}
|
||||
else
|
||||
|
|
@ -1214,7 +1214,7 @@ void SoundEngine::playMusicUpdate()
|
|||
SetIsPlayingStreamingCDMusic(false);
|
||||
m_MusicType=eMusicType_Game;
|
||||
m_StreamingAudioInfo.bIs3D=false;
|
||||
|
||||
|
||||
#ifdef _XBOX_ONE
|
||||
wstring &wstrSoundName=dlcAudioFile->GetSoundName(m_musicID);
|
||||
wstring wstrFile=L"TPACK:\\Data\\" + wstrSoundName +L".binka";
|
||||
|
|
@ -1244,7 +1244,7 @@ void SoundEngine::playMusicUpdate()
|
|||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
// 4J-PB - if this is a PS3 disc patch, we have to check if the music file is in the patch data
|
||||
#ifdef __PS3__
|
||||
if(app.GetBootedFromDiscPatch() && (m_musicID<m_iStream_CD_1))
|
||||
|
|
@ -1256,7 +1256,7 @@ void SoundEngine::playMusicUpdate()
|
|||
strcat((char *)m_szStreamName,".binka");
|
||||
|
||||
// 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,m_szStreamFileA[m_musicID]);
|
||||
strcat((char *)m_szStreamName,".binka");
|
||||
|
|
@ -1289,7 +1289,7 @@ void SoundEngine::playMusicUpdate()
|
|||
strcat((char *)m_szStreamName,m_szStreamFileA[m_musicID]);
|
||||
strcat((char *)m_szStreamName,".binka");
|
||||
}
|
||||
#else
|
||||
#else
|
||||
if(m_musicID<m_iStream_CD_1)
|
||||
{
|
||||
SetIsPlayingStreamingGameMusic(true);
|
||||
|
|
@ -1310,7 +1310,7 @@ void SoundEngine::playMusicUpdate()
|
|||
}
|
||||
strcat((char *)m_szStreamName,m_szStreamFileA[m_musicID]);
|
||||
strcat((char *)m_szStreamName,".binka");
|
||||
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -1321,7 +1321,7 @@ void SoundEngine::playMusicUpdate()
|
|||
|
||||
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->Run();
|
||||
m_StreamState = eMusicStreamState_Opening;
|
||||
|
|
@ -1335,7 +1335,7 @@ void SoundEngine::playMusicUpdate()
|
|||
delete m_openStreamThread;
|
||||
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
|
||||
AIL_register_falloff_function_callback(hSample,&custom_falloff_function);
|
||||
|
|
@ -1383,12 +1383,12 @@ void SoundEngine::playMusicUpdate()
|
|||
else
|
||||
{
|
||||
// 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
|
||||
app.DebugPrintf("Sample rate:%d\n", AIL_sample_playback_rate(hSample));
|
||||
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_start_stream( m_hStream );
|
||||
|
|
@ -1447,7 +1447,7 @@ void SoundEngine::playMusicUpdate()
|
|||
// Set the end track
|
||||
m_musicID = getMusicID(LevelData::DIMENSION_END);
|
||||
SetIsPlayingEndMusic(true);
|
||||
SetIsPlayingNetherMusic(false);
|
||||
SetIsPlayingNetherMusic(false);
|
||||
}
|
||||
else if(!playerInEnd && GetIsPlayingEndMusic())
|
||||
{
|
||||
|
|
@ -1458,7 +1458,7 @@ void SoundEngine::playMusicUpdate()
|
|||
// Set the end track
|
||||
m_musicID = getMusicID(LevelData::DIMENSION_NETHER);
|
||||
SetIsPlayingEndMusic(false);
|
||||
SetIsPlayingNetherMusic(true);
|
||||
SetIsPlayingNetherMusic(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -1467,7 +1467,7 @@ void SoundEngine::playMusicUpdate()
|
|||
// Set the end track
|
||||
m_musicID = getMusicID(LevelData::DIMENSION_OVERWORLD);
|
||||
SetIsPlayingEndMusic(false);
|
||||
SetIsPlayingNetherMusic(false);
|
||||
SetIsPlayingNetherMusic(false);
|
||||
}
|
||||
}
|
||||
else if (playerInNether && !GetIsPlayingNetherMusic())
|
||||
|
|
@ -1502,7 +1502,7 @@ void SoundEngine::playMusicUpdate()
|
|||
if(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_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
|
||||
HSAMPLE hSample = AIL_stream_sample_handle( m_hStream);
|
||||
HSAMPLE hSample = AIL_stream_sample_handle( m_hStream);
|
||||
fDist=sqrtf((fClosestX*fClosestX)+(fClosestY*fClosestY)+(fClosestZ*fClosestZ));
|
||||
AIL_set_sample_3D_position( hSample, 0, 0, fDist );
|
||||
}
|
||||
|
|
@ -1555,7 +1555,7 @@ void SoundEngine::playMusicUpdate()
|
|||
break;
|
||||
|
||||
case eMusicStreamState_Completed:
|
||||
{
|
||||
{
|
||||
// random delay of up to 3 minutes for music
|
||||
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
|
||||
|
|
@ -1644,7 +1644,7 @@ char *SoundEngine::ConvertSoundPathToName(const wstring& name, bool bConvertSpac
|
|||
#endif
|
||||
|
||||
|
||||
F32 AILCALLBACK custom_falloff_function (HSAMPLE S,
|
||||
F32 AILCALLBACK custom_falloff_function (HSAMPLE S,
|
||||
F32 distance,
|
||||
F32 rolloff_factor,
|
||||
F32 min_dist,
|
||||
|
|
|
|||
|
|
@ -78,8 +78,8 @@ typedef struct
|
|||
{
|
||||
F32 x,y,z,volume,pitch;
|
||||
int iSound;
|
||||
bool bIs3D;
|
||||
bool bUseSoundsPitchVal;
|
||||
bool bIs3D;
|
||||
bool bUseSoundsPitchVal;
|
||||
#ifdef _DEBUG
|
||||
char chName[64];
|
||||
#endif
|
||||
|
|
@ -103,7 +103,7 @@ public:
|
|||
virtual void updateSystemMusicPlaying(bool isPlaying);
|
||||
virtual void updateSoundEffectVolume(float fVal);
|
||||
virtual void init(Options *);
|
||||
virtual void tick(std::shared_ptr<Mob> *players, float a); // 4J - updated to take array of local players rather than single one
|
||||
virtual void tick(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 addMusic(const wstring& name, File *file);
|
||||
virtual void addStreaming(const wstring& name, File *file);
|
||||
|
|
@ -123,7 +123,7 @@ private:
|
|||
#else
|
||||
int initAudioHardware(int iMinSpeakers) { return iMinSpeakers;}
|
||||
#endif
|
||||
|
||||
|
||||
int GetRandomishTrack(int iStart,int iEnd);
|
||||
|
||||
HMSOUNDBANK m_hBank;
|
||||
|
|
@ -165,4 +165,4 @@ private:
|
|||
#ifdef __ORBIS__
|
||||
int32_t m_hBGMAudio;
|
||||
#endif
|
||||
};
|
||||
};
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -28,7 +28,7 @@ typedef struct _JoinFromInviteData
|
|||
DWORD dwUserIndex; // dwUserIndex
|
||||
DWORD dwLocalUsersMask; // dwUserMask
|
||||
const INVITE_INFO *pInviteInfo; // pInviteInfo
|
||||
}
|
||||
}
|
||||
JoinFromInviteData;
|
||||
|
||||
class Player;
|
||||
|
|
@ -50,7 +50,7 @@ class Merchant;
|
|||
|
||||
class CMinecraftAudio;
|
||||
|
||||
class CMinecraftApp
|
||||
class CMinecraftApp
|
||||
|
||||
#ifdef _XBOX
|
||||
: public CXuiModule
|
||||
|
|
@ -87,7 +87,7 @@ public:
|
|||
|
||||
#ifdef _EXTENDED_ACHIEVEMENTS
|
||||
/* 4J-JEV:
|
||||
* We need more space in the profile data because of the new achievements and statistics
|
||||
* We need more space in the profile data because of the new achievements and statistics
|
||||
* necessary for the new expanded achievement set.
|
||||
*/
|
||||
static const int GAME_DEFINED_PROFILE_DATA_BYTES = 2*972; // per user
|
||||
|
|
@ -108,7 +108,7 @@ public:
|
|||
static const int USER_RR = 5;
|
||||
static const int USER_SR = 6;
|
||||
static const int USER_UI = 7; // 4J Stu - This also makes it appear on the UI console
|
||||
|
||||
|
||||
void HandleButtonPresses();
|
||||
bool IntroRunning() { return m_bIntroRunning;}
|
||||
void SetIntroRunning(bool bSet) {m_bIntroRunning=bSet;}
|
||||
|
|
@ -125,18 +125,18 @@ public:
|
|||
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;}
|
||||
int GetLocalPlayerCount(void);
|
||||
bool LoadInventoryMenu(int iPad,std::shared_ptr<LocalPlayer> player, bool bNavigateBack=false);
|
||||
bool LoadCreativeMenu(int iPad,std::shared_ptr<LocalPlayer> player,bool bNavigateBack=false);
|
||||
bool LoadEnchantingMenu(int iPad,std::shared_ptr<Inventory> inventory, int x, int y, int z, Level *level);
|
||||
bool LoadFurnaceMenu(int iPad,std::shared_ptr<Inventory> inventory, std::shared_ptr<FurnaceTileEntity> furnace);
|
||||
bool LoadBrewingStandMenu(int iPad,std::shared_ptr<Inventory> inventory, std::shared_ptr<BrewingStandTileEntity> brewingStand);
|
||||
bool LoadContainerMenu(int iPad,std::shared_ptr<Container> inventory, std::shared_ptr<Container> container);
|
||||
bool LoadTrapMenu(int iPad,std::shared_ptr<Container> inventory, std::shared_ptr<DispenserTileEntity> trap);
|
||||
bool LoadCrafting2x2Menu(int iPad,std::shared_ptr<LocalPlayer> player);
|
||||
bool LoadCrafting3x3Menu(int iPad,std::shared_ptr<LocalPlayer> player, int x, int y, int z);
|
||||
bool LoadSignEntryMenu(int iPad,std::shared_ptr<SignTileEntity> sign);
|
||||
bool LoadRepairingMenu(int iPad,std::shared_ptr<Inventory> inventory, Level *level, int x, int y, int z);
|
||||
bool LoadTradingMenu(int iPad, std::shared_ptr<Inventory> inventory, std::shared_ptr<Merchant> trader, Level *level);
|
||||
bool LoadInventoryMenu(int iPad,shared_ptr<LocalPlayer> player, bool bNavigateBack=false);
|
||||
bool LoadCreativeMenu(int iPad,shared_ptr<LocalPlayer> player,bool bNavigateBack=false);
|
||||
bool LoadEnchantingMenu(int iPad,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 LoadBrewingStandMenu(int iPad,shared_ptr<Inventory> inventory, shared_ptr<BrewingStandTileEntity> brewingStand);
|
||||
bool LoadContainerMenu(int iPad,shared_ptr<Container> inventory, shared_ptr<Container> container);
|
||||
bool LoadTrapMenu(int iPad,shared_ptr<Container> inventory, shared_ptr<DispenserTileEntity> trap);
|
||||
bool LoadCrafting2x2Menu(int iPad,shared_ptr<LocalPlayer> player);
|
||||
bool LoadCrafting3x3Menu(int iPad,shared_ptr<LocalPlayer> player, int x, int y, int z);
|
||||
bool LoadSignEntryMenu(int iPad,shared_ptr<SignTileEntity> sign);
|
||||
bool LoadRepairingMenu(int iPad,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 GetTutorialMode() { return m_bTutorialMode;}
|
||||
void SetTutorialMode(bool bSet) {m_bTutorialMode=bSet;}
|
||||
|
|
@ -152,14 +152,14 @@ public:
|
|||
void SetGlobalXuiAction(eXuiAction action) {m_eGlobalXuiAction=action;}
|
||||
eXuiAction GetXuiAction(int iPad) {return m_eXuiAction[iPad];}
|
||||
void SetAction(int iPad, eXuiAction action, LPVOID param = NULL);
|
||||
void SetTMSAction(int iPad, eTMSAction action) {m_eTMSAction[iPad]=action; }
|
||||
void SetTMSAction(int iPad, eTMSAction action) {m_eTMSAction[iPad]=action; }
|
||||
eTMSAction GetTMSAction(int iPad) {return m_eTMSAction[iPad];}
|
||||
eXuiServerAction GetXuiServerAction(int iPad) {return m_eXuiServerAction[iPad];}
|
||||
LPVOID GetXuiServerActionParam(int iPad) {return m_eXuiServerActionParam[iPad];}
|
||||
void SetXuiServerAction(int iPad, eXuiServerAction action, LPVOID param = NULL) {m_eXuiServerAction[iPad]=action; m_eXuiServerActionParam[iPad] = param;}
|
||||
eXuiServerAction GetGlobalXuiServerAction() {return m_eGlobalXuiServerAction;}
|
||||
void SetGlobalXuiServerAction(eXuiServerAction action) {m_eGlobalXuiServerAction=action;}
|
||||
|
||||
|
||||
DisconnectPacket::eDisconnectReason GetDisconnectReason() { return m_disconnectReason; }
|
||||
void SetDisconnectReason(DisconnectPacket::eDisconnectReason bVal) { m_disconnectReason = bVal; }
|
||||
|
||||
|
|
@ -224,7 +224,7 @@ public:
|
|||
#endif
|
||||
virtual void SetRichPresenceContext(int iPad, int contextId) = 0;
|
||||
|
||||
|
||||
|
||||
void SetGameSettings(int iPad,eGameSetting eVal,unsigned char ucVal);
|
||||
unsigned char GetGameSettings(int iPad,eGameSetting eVal);
|
||||
unsigned char GetGameSettings(eGameSetting eVal); // for the primary pad
|
||||
|
|
@ -268,7 +268,7 @@ public:
|
|||
void SetGameSettingsDebugMask(int iPad, unsigned int uiVal);
|
||||
void ActionDebugMask(int iPad, bool bSetAllClear=false);
|
||||
|
||||
//
|
||||
//
|
||||
bool IsLocalMultiplayerAvailable();
|
||||
|
||||
// for sign in change monitoring
|
||||
|
|
@ -343,7 +343,7 @@ public:
|
|||
|
||||
// Texture Pack Data files (icon, banner, comparison shot & text)
|
||||
void AddMemoryTPDFile(int iConfig,PBYTE pbData,DWORD dwBytes);
|
||||
void RemoveMemoryTPDFile(int iConfig);
|
||||
void RemoveMemoryTPDFile(int iConfig);
|
||||
bool IsFileInTPD(int iConfig);
|
||||
void GetTPD(int iConfig,PBYTE *ppbData,DWORD *pdwBytes);
|
||||
int GetTPDSize() {return m_MEM_TPD.size();}
|
||||
|
|
@ -424,11 +424,11 @@ public:
|
|||
byteArray getArchiveFile(const wstring &filename);
|
||||
|
||||
private:
|
||||
|
||||
|
||||
static int BannedLevelDialogReturned(void *pParam,int iPad,const C4JStorage::EMessageResult);
|
||||
static int TexturePackDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result);
|
||||
|
||||
VBANNEDLIST *m_vBannedListA[XUSER_MAX_COUNT];
|
||||
|
||||
VBANNEDLIST *m_vBannedListA[XUSER_MAX_COUNT];
|
||||
|
||||
void HandleButtonPresses(int iPad);
|
||||
|
||||
|
|
@ -456,7 +456,7 @@ private:
|
|||
|
||||
static unsigned int m_uiLastSignInData;
|
||||
|
||||
// We've got sizeof(GAME_SETTINGS) bytes reserved at the start of the gamedefined data per player for settings
|
||||
// We've got sizeof(GAME_SETTINGS) bytes reserved at the start of the gamedefined data per player for settings
|
||||
GAME_SETTINGS *GameSettingsA[XUSER_MAX_COUNT];
|
||||
|
||||
// For promo work
|
||||
|
|
@ -489,7 +489,7 @@ public:
|
|||
// trial timer
|
||||
void SetTrialTimerStart(void);
|
||||
float getTrialTimer(void);
|
||||
|
||||
|
||||
// notifications from the game for qnet
|
||||
VNOTIFICATIONS *GetNotifications() {return &m_vNotifications;}
|
||||
|
||||
|
|
@ -501,7 +501,7 @@ private:
|
|||
eXuiAction m_eXuiAction[XUSER_MAX_COUNT];
|
||||
eTMSAction m_eTMSAction[XUSER_MAX_COUNT];
|
||||
LPVOID m_eXuiActionParam[XUSER_MAX_COUNT];
|
||||
eXuiAction m_eGlobalXuiAction;
|
||||
eXuiAction m_eGlobalXuiAction;
|
||||
eXuiServerAction m_eXuiServerAction[XUSER_MAX_COUNT];
|
||||
LPVOID m_eXuiServerActionParam[XUSER_MAX_COUNT];
|
||||
eXuiServerAction m_eGlobalXuiServerAction;
|
||||
|
|
@ -525,20 +525,20 @@ private:
|
|||
// Trial timer
|
||||
float m_fTrialTimerStart,mfTrialPausedTime;
|
||||
typedef struct TimeInfo
|
||||
{
|
||||
LARGE_INTEGER qwTime;
|
||||
LARGE_INTEGER qwAppTime;
|
||||
{
|
||||
LARGE_INTEGER qwTime;
|
||||
LARGE_INTEGER qwAppTime;
|
||||
|
||||
float fAppTime;
|
||||
float fElapsedTime;
|
||||
float fSecsPerTick;
|
||||
} TIMEINFO;
|
||||
float fAppTime;
|
||||
float fElapsedTime;
|
||||
float fSecsPerTick;
|
||||
} TIMEINFO;
|
||||
|
||||
TimeInfo m_Time;
|
||||
|
||||
protected:
|
||||
static const int MAX_TIPS_GAMETIP = 50;
|
||||
static const int MAX_TIPS_TRIVIATIP = 20;
|
||||
static const int MAX_TIPS_GAMETIP = 50;
|
||||
static const int MAX_TIPS_TRIVIATIP = 20;
|
||||
static TIPSTRUCT m_GameTipA[MAX_TIPS_GAMETIP];
|
||||
static TIPSTRUCT m_TriviaTipA[MAX_TIPS_TRIVIATIP];
|
||||
static Random *TipRandom;
|
||||
|
|
@ -590,7 +590,7 @@ public:
|
|||
DLC_INFO *GetDLCInfoForFullOfferID(WCHAR *pwchProductId);
|
||||
DLC_INFO *GetDLCInfoForProductName(WCHAR *pwchProductName);
|
||||
#else
|
||||
static HRESULT RegisterDLCData(WCHAR *, WCHAR *, int, uint64_t, uint64_t, WCHAR *, unsigned int, int, WCHAR *pDataFile);
|
||||
static HRESULT RegisterDLCData(WCHAR *, WCHAR *, int, __uint64, __uint64, WCHAR *, unsigned int, int, WCHAR *pDataFile);
|
||||
bool GetDLCFullOfferIDForSkinID(const wstring &FirstSkin,ULONGLONG *pullVal);
|
||||
DLC_INFO *GetDLCInfoForTrialOfferID(ULONGLONG ullOfferID_Trial);
|
||||
DLC_INFO *GetDLCInfoForFullOfferID(ULONGLONG ullOfferID_Full);
|
||||
|
|
@ -618,7 +618,7 @@ private:
|
|||
#if defined(__PS3__) || defined(__ORBIS__) || defined (__PSVITA__)
|
||||
static unordered_map<PlayerUID,MOJANG_DATA *, PlayerUID::Hash > MojangData;
|
||||
static unordered_map<int, char * > DLCTextures_PackID; // for mash-up packs & texture packs
|
||||
static unordered_map<string,DLC_INFO * > DLCInfo;
|
||||
static unordered_map<string,DLC_INFO * > DLCInfo;
|
||||
static unordered_map<wstring, ULONGLONG > DLCInfo_SkinName; // skin name, full offer id
|
||||
#elif defined(_DURANGO)
|
||||
static unordered_map<PlayerUID,MOJANG_DATA *, PlayerUID::Hash > MojangData;
|
||||
|
|
@ -701,7 +701,7 @@ public:
|
|||
|
||||
// World seed from png image
|
||||
void GetImageTextData(PBYTE pbImageData, DWORD dwImageBytes,unsigned char *pszSeed,unsigned int &uiHostOptions,bool &bHostOptionsRead,DWORD &uiTexturePack);
|
||||
unsigned int CreateImageTextData(PBYTE bTextMetadata, int64_t seed, bool hasSeed, unsigned int uiHostOptions, unsigned int uiTexturePackId);
|
||||
unsigned int CreateImageTextData(PBYTE bTextMetadata, __int64 seed, bool hasSeed, unsigned int uiHostOptions, unsigned int uiTexturePackId);
|
||||
|
||||
// Game rules
|
||||
GameRuleManager m_gameRules;
|
||||
|
|
@ -745,7 +745,7 @@ public:
|
|||
unsigned int AddTMSPPFileTypeRequest(eDLCContentType eType, bool bPromote=false);
|
||||
int GetDLCInfoTexturesOffersCount();
|
||||
#if defined( __PS3__) || defined(__ORBIS__) || defined(__PSVITA__)
|
||||
DLC_INFO *GetDLCInfo(int iIndex);
|
||||
DLC_INFO *GetDLCInfo(int iIndex);
|
||||
DLC_INFO *GetDLCInfo(char *);
|
||||
DLC_INFO *GetDLCInfoFromTPackID(int iTPID);
|
||||
bool GetDLCNameForPackID(const int iPackID,char **ppchKeyID);
|
||||
|
|
@ -887,15 +887,15 @@ public:
|
|||
#ifdef _XBOX
|
||||
// bool m_bTransferSavesToXboxOne;
|
||||
// unsigned int m_uiTransferSlotC;
|
||||
|
||||
|
||||
#elif defined (__PS3__)
|
||||
|
||||
|
||||
#elif defined _DURANGO
|
||||
|
||||
|
||||
#elif defined _WINDOWS64
|
||||
//CMinecraftAudio audio;
|
||||
#else // PS4
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef _XBOX_ONE
|
||||
|
|
@ -907,5 +907,5 @@ private:
|
|||
#endif
|
||||
};
|
||||
|
||||
//singleton
|
||||
//singleton
|
||||
//extern CMinecraftApp app;
|
||||
|
|
|
|||
|
|
@ -43,14 +43,14 @@ void AddEnchantmentRuleDefinition::addAttribute(const wstring &attributeName, co
|
|||
}
|
||||
}
|
||||
|
||||
bool AddEnchantmentRuleDefinition::enchantItem(std::shared_ptr<ItemInstance> item)
|
||||
bool AddEnchantmentRuleDefinition::enchantItem(shared_ptr<ItemInstance> item)
|
||||
{
|
||||
bool enchanted = false;
|
||||
if (item != NULL)
|
||||
{
|
||||
// 4J-JEV: Ripped code from 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) );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,5 +19,5 @@ public:
|
|||
|
||||
virtual void addAttribute(const wstring &attributeName, const wstring &attributeValue);
|
||||
|
||||
bool enchantItem(std::shared_ptr<ItemInstance> item);
|
||||
bool enchantItem(shared_ptr<ItemInstance> item);
|
||||
};
|
||||
|
|
@ -94,13 +94,13 @@ void AddItemRuleDefinition::addAttribute(const wstring &attributeName, const wst
|
|||
}
|
||||
}
|
||||
|
||||
bool AddItemRuleDefinition::addItemToContainer(std::shared_ptr<Container> container, int slotId)
|
||||
bool AddItemRuleDefinition::addItemToContainer(shared_ptr<Container> container, int slotId)
|
||||
{
|
||||
bool added = false;
|
||||
if(Item::items[m_itemId] != NULL)
|
||||
{
|
||||
int quantity = min(m_quantity, Item::items[m_itemId]->getMaxStackSize());
|
||||
std::shared_ptr<ItemInstance> newItem = std::shared_ptr<ItemInstance>(new ItemInstance(m_itemId,quantity,m_auxValue) );
|
||||
shared_ptr<ItemInstance> newItem = shared_ptr<ItemInstance>(new ItemInstance(m_itemId,quantity,m_auxValue) );
|
||||
newItem->set4JData(m_dataTag);
|
||||
|
||||
for(AUTO_VAR(it, m_enchantments.begin()); it != m_enchantments.end(); ++it)
|
||||
|
|
|
|||
|
|
@ -26,5 +26,5 @@ public:
|
|||
virtual GameRuleDefinition *addChild(ConsoleGameRules::EGameRuleType ruleType);
|
||||
virtual void addAttribute(const wstring &attributeName, const wstring &attributeValue);
|
||||
|
||||
bool addItemToContainer(std::shared_ptr<Container> container, int slotId);
|
||||
bool addItemToContainer(shared_ptr<Container> container, int slotId);
|
||||
};
|
||||
|
|
@ -19,17 +19,17 @@ private:
|
|||
ConsoleSchematicFile::ESchematicRotation m_rotation;
|
||||
int m_dimension;
|
||||
|
||||
int64_t m_totalBlocksChanged;
|
||||
int64_t m_totalBlocksChangedLighting;
|
||||
__int64 m_totalBlocksChanged;
|
||||
__int64 m_totalBlocksChangedLighting;
|
||||
bool m_completed;
|
||||
|
||||
void updateLocationBox();
|
||||
public:
|
||||
public:
|
||||
ApplySchematicRuleDefinition(LevelGenerationOptions *levelGenOptions);
|
||||
~ApplySchematicRuleDefinition();
|
||||
|
||||
virtual ConsoleGameRules::EGameRuleType getActionType() { return ConsoleGameRules::eGameRuleType_ApplySchematic; }
|
||||
|
||||
|
||||
virtual void writeAttributes(DataOutputStream *dos, UINT numAttrs);
|
||||
virtual void addAttribute(const wstring &attributeName, const wstring &attributeValue);
|
||||
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ void CollectItemRuleDefinition::populateGameRule(GameRulesInstance::EGameRulesIn
|
|||
GameRuleDefinition::populateGameRule(type, rule);
|
||||
}
|
||||
|
||||
bool CollectItemRuleDefinition::onCollectItem(GameRule *rule, std::shared_ptr<ItemInstance> item)
|
||||
bool CollectItemRuleDefinition::onCollectItem(GameRule *rule, shared_ptr<ItemInstance> item)
|
||||
{
|
||||
bool statusChanged = false;
|
||||
if(item != NULL && item->id == m_itemId && item->getAuxValue() == m_auxValue && item->get4JData() == m_4JDataValue)
|
||||
|
|
@ -94,7 +94,7 @@ bool CollectItemRuleDefinition::onCollectItem(GameRule *rule, std::shared_ptr<It
|
|||
|
||||
if(rule->getConnection() != NULL)
|
||||
{
|
||||
rule->getConnection()->send( std::shared_ptr<UpdateGameRuleProgressPacket>( new UpdateGameRuleProgressPacket(getActionType(), this->m_descriptionId, m_itemId, m_auxValue, this->m_4JDataValue,NULL,0)));
|
||||
rule->getConnection()->send( 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, std::shared_ptr<It
|
|||
return statusChanged;
|
||||
}
|
||||
|
||||
wstring CollectItemRuleDefinition::generateXml(std::shared_ptr<ItemInstance> item)
|
||||
wstring CollectItemRuleDefinition::generateXml(shared_ptr<ItemInstance> item)
|
||||
{
|
||||
// 4J Stu - This should be kept in sync with the GameRulesDefinition.xsd
|
||||
wstring xml = L"";
|
||||
|
|
|
|||
|
|
@ -25,16 +25,16 @@ public:
|
|||
|
||||
virtual int getGoal();
|
||||
virtual int getProgress(GameRule *rule);
|
||||
|
||||
|
||||
virtual int getIcon() { return m_itemId; }
|
||||
virtual int getAuxValue() { return m_auxValue; }
|
||||
|
||||
void populateGameRule(GameRulesInstance::EGameRulesInstanceType type, GameRule *rule);
|
||||
|
||||
bool onCollectItem(GameRule *rule, std::shared_ptr<ItemInstance> item);
|
||||
bool onCollectItem(GameRule *rule, shared_ptr<ItemInstance> item);
|
||||
|
||||
static wstring generateXml(std::shared_ptr<ItemInstance> item);
|
||||
static wstring generateXml(shared_ptr<ItemInstance> item);
|
||||
|
||||
private:
|
||||
private:
|
||||
//static wstring generateXml(CollectItemRuleDefinition *ruleDef);
|
||||
};
|
||||
|
|
@ -17,7 +17,7 @@ bool CompleteAllRuleDefinition::onUseTile(GameRule *rule, int tileId, int x, int
|
|||
return statusChanged;
|
||||
}
|
||||
|
||||
bool CompleteAllRuleDefinition::onCollectItem(GameRule *rule, std::shared_ptr<ItemInstance> item)
|
||||
bool CompleteAllRuleDefinition::onCollectItem(GameRule *rule, shared_ptr<ItemInstance> item)
|
||||
{
|
||||
bool statusChanged = CompoundGameRuleDefinition::onCollectItem(rule,item);
|
||||
if(statusChanged) updateStatus(rule);
|
||||
|
|
@ -44,14 +44,14 @@ void CompleteAllRuleDefinition::updateStatus(GameRule *rule)
|
|||
|
||||
int icon = -1;
|
||||
int auxValue = 0;
|
||||
|
||||
|
||||
if(m_lastRuleStatusChanged != NULL)
|
||||
{
|
||||
{
|
||||
icon = m_lastRuleStatusChanged->getIcon();
|
||||
auxValue = m_lastRuleStatusChanged->getAuxValue();
|
||||
m_lastRuleStatusChanged = NULL;
|
||||
}
|
||||
rule->getConnection()->send( std::shared_ptr<UpdateGameRuleProgressPacket>( new UpdateGameRuleProgressPacket(getActionType(), this->m_descriptionId,icon, auxValue, 0,&data,sizeof(PacketData))));
|
||||
rule->getConnection()->send( 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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ public:
|
|||
virtual void getChildren(vector<GameRuleDefinition *> *children);
|
||||
|
||||
virtual bool onUseTile(GameRule *rule, int tileId, int x, int y, int z);
|
||||
virtual bool onCollectItem(GameRule *rule, std::shared_ptr<ItemInstance> item);
|
||||
virtual bool onCollectItem(GameRule *rule, shared_ptr<ItemInstance> item);
|
||||
|
||||
static wstring generateDescriptionString(const wstring &description, void *data, int dataLength);
|
||||
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ GameRuleDefinition *CompoundGameRuleDefinition::addChild(ConsoleGameRules::EGame
|
|||
rule = new UseTileRuleDefinition();
|
||||
}
|
||||
else if(ruleType == ConsoleGameRules::eGameRuleType_UpdatePlayerRule)
|
||||
{
|
||||
{
|
||||
rule = new UpdatePlayerRuleDefinition();
|
||||
}
|
||||
else
|
||||
|
|
@ -91,7 +91,7 @@ bool CompoundGameRuleDefinition::onUseTile(GameRule *rule, int tileId, int x, in
|
|||
return statusChanged;
|
||||
}
|
||||
|
||||
bool CompoundGameRuleDefinition::onCollectItem(GameRule *rule, std::shared_ptr<ItemInstance> item)
|
||||
bool CompoundGameRuleDefinition::onCollectItem(GameRule *rule, shared_ptr<ItemInstance> item)
|
||||
{
|
||||
bool statusChanged = false;
|
||||
for(AUTO_VAR(it, rule->m_parameters.begin()); it != rule->m_parameters.end(); ++it)
|
||||
|
|
@ -100,7 +100,7 @@ bool CompoundGameRuleDefinition::onCollectItem(GameRule *rule, std::shared_ptr<I
|
|||
{
|
||||
bool changed = it->second.gr->getGameRuleDefinition()->onCollectItem(it->second.gr,item);
|
||||
if(!statusChanged && changed)
|
||||
{
|
||||
{
|
||||
m_lastRuleStatusChanged = it->second.gr->getGameRuleDefinition();
|
||||
statusChanged = true;
|
||||
}
|
||||
|
|
@ -109,7 +109,7 @@ bool CompoundGameRuleDefinition::onCollectItem(GameRule *rule, std::shared_ptr<I
|
|||
return statusChanged;
|
||||
}
|
||||
|
||||
void CompoundGameRuleDefinition::postProcessPlayer(std::shared_ptr<Player> player)
|
||||
void CompoundGameRuleDefinition::postProcessPlayer(shared_ptr<Player> player)
|
||||
{
|
||||
for(AUTO_VAR(it, m_children.begin()); it != m_children.end(); ++it)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -18,6 +18,6 @@ public:
|
|||
virtual void populateGameRule(GameRulesInstance::EGameRulesInstanceType type, GameRule *rule);
|
||||
|
||||
virtual bool onUseTile(GameRule *rule, int tileId, int x, int y, int z);
|
||||
virtual bool onCollectItem(GameRule *rule, std::shared_ptr<ItemInstance> item);
|
||||
virtual void postProcessPlayer(std::shared_ptr<Player> player);
|
||||
virtual bool onCollectItem(GameRule *rule, shared_ptr<ItemInstance> item);
|
||||
virtual void postProcessPlayer(shared_ptr<Player> player);
|
||||
};
|
||||
|
|
@ -38,7 +38,7 @@ void ConsoleSchematicFile::save(DataOutputStream *dos)
|
|||
dos->writeInt(m_zSize);
|
||||
|
||||
byteArray ba(new BYTE[ m_data.length ], m_data.length);
|
||||
Compression::getCompression()->CompressLZXRLE( ba.data, &ba.length,
|
||||
Compression::getCompression()->CompressLZXRLE( ba.data, &ba.length,
|
||||
m_data.data, m_data.length);
|
||||
|
||||
dos->writeInt(ba.length);
|
||||
|
|
@ -71,13 +71,13 @@ void ConsoleSchematicFile::load(DataInputStream *dis)
|
|||
m_ySize = dis->readInt();
|
||||
m_zSize = dis->readInt();
|
||||
|
||||
int compressedSize = dis->readInt();
|
||||
int compressedSize = dis->readInt();
|
||||
byteArray compressedBuffer(compressedSize);
|
||||
dis->readFully(compressedBuffer);
|
||||
|
||||
if(m_data.data != NULL)
|
||||
{
|
||||
delete [] m_data.data;
|
||||
delete [] m_data.data;
|
||||
m_data.data = NULL;
|
||||
}
|
||||
|
||||
|
|
@ -116,7 +116,7 @@ void ConsoleSchematicFile::load(DataInputStream *dis)
|
|||
for (int i = 0; i < tileEntityTags->size(); i++)
|
||||
{
|
||||
CompoundTag *teTag = tileEntityTags->get(i);
|
||||
std::shared_ptr<TileEntity> te = TileEntity::loadStatic(teTag);
|
||||
shared_ptr<TileEntity> te = TileEntity::loadStatic(teTag);
|
||||
|
||||
if(te == NULL)
|
||||
{
|
||||
|
|
@ -145,7 +145,7 @@ void ConsoleSchematicFile::load(DataInputStream *dis)
|
|||
double z = pos->get(2)->data;
|
||||
|
||||
if( type == eTYPE_PAINTING || type == eTYPE_ITEM_FRAME )
|
||||
{
|
||||
{
|
||||
x = ((IntTag *) eTag->get(L"TileX") )->data;
|
||||
y = ((IntTag *) eTag->get(L"TileY") )->data;
|
||||
z = ((IntTag *) eTag->get(L"TileZ") )->data;
|
||||
|
|
@ -184,7 +184,7 @@ void ConsoleSchematicFile::save_tags(DataOutputStream *dos)
|
|||
delete tag;
|
||||
}
|
||||
|
||||
int64_t ConsoleSchematicFile::applyBlocksAndData(LevelChunk *chunk, AABB *chunkBox, AABB *destinationBox, ESchematicRotation rot)
|
||||
__int64 ConsoleSchematicFile::applyBlocksAndData(LevelChunk *chunk, AABB *chunkBox, AABB *destinationBox, ESchematicRotation rot)
|
||||
{
|
||||
int xStart = max(destinationBox->x0, (double)chunk->x*16);
|
||||
int xEnd = min(destinationBox->x1, (double)((xStart>>4)<<4) + 16);
|
||||
|
|
@ -281,7 +281,7 @@ int64_t ConsoleSchematicFile::applyBlocksAndData(LevelChunk *chunk, AABB *chunkB
|
|||
// blockData[i] = Tile::whiteStone_Id;
|
||||
// }
|
||||
//}
|
||||
|
||||
|
||||
PIXBeginNamedEvent(0,"Setting Block data");
|
||||
chunk->setBlockData(blockData);
|
||||
PIXEndNamedEvent();
|
||||
|
|
@ -323,7 +323,7 @@ int64_t ConsoleSchematicFile::applyBlocksAndData(LevelChunk *chunk, AABB *chunkB
|
|||
|
||||
// At the point that this is called, we have all the neighbouring chunks loaded in (and generally post-processed, apart from this lighting pass), so
|
||||
// we can do the sort of lighting that might propagate out of the chunk.
|
||||
int64_t ConsoleSchematicFile::applyLighting(LevelChunk *chunk, AABB *chunkBox, AABB *destinationBox, ESchematicRotation rot)
|
||||
__int64 ConsoleSchematicFile::applyLighting(LevelChunk *chunk, AABB *chunkBox, AABB *destinationBox, ESchematicRotation rot)
|
||||
{
|
||||
int xStart = max(destinationBox->x0, (double)chunk->x*16);
|
||||
int xEnd = min(destinationBox->x1, (double)((xStart>>4)<<4) + 16);
|
||||
|
|
@ -433,7 +433,7 @@ void ConsoleSchematicFile::applyTileEntities(LevelChunk *chunk, AABB *chunkBox,
|
|||
{
|
||||
for(AUTO_VAR(it, m_tileEntities.begin()); it != m_tileEntities.end();++it)
|
||||
{
|
||||
std::shared_ptr<TileEntity> te = *it;
|
||||
shared_ptr<TileEntity> te = *it;
|
||||
|
||||
double targetX = te->x;
|
||||
double targetY = te->y + destinationBox->y0;
|
||||
|
|
@ -444,10 +444,10 @@ void ConsoleSchematicFile::applyTileEntities(LevelChunk *chunk, AABB *chunkBox,
|
|||
Vec3 *pos = Vec3::newTemp(targetX,targetY,targetZ);
|
||||
if( chunkBox->containsIncludingLowerBound(pos) )
|
||||
{
|
||||
std::shared_ptr<TileEntity> teCopy = chunk->getTileEntity( (int)targetX & 15, (int)targetY & 15, (int)targetZ & 15 );
|
||||
shared_ptr<TileEntity> teCopy = chunk->getTileEntity( (int)targetX & 15, (int)targetY & 15, (int)targetZ & 15 );
|
||||
|
||||
if ( teCopy != NULL )
|
||||
{
|
||||
{
|
||||
CompoundTag *teData = new CompoundTag();
|
||||
te->save(teData);
|
||||
|
||||
|
|
@ -480,7 +480,7 @@ void ConsoleSchematicFile::applyTileEntities(LevelChunk *chunk, AABB *chunkBox,
|
|||
for(AUTO_VAR(it, m_entities.begin()); it != m_entities.end();)
|
||||
{
|
||||
Vec3 *source = it->first;
|
||||
|
||||
|
||||
double targetX = source->x;
|
||||
double targetY = source->y + destinationBox->y0;
|
||||
double targetZ = source->z;
|
||||
|
|
@ -495,12 +495,12 @@ void ConsoleSchematicFile::applyTileEntities(LevelChunk *chunk, AABB *chunkBox,
|
|||
}
|
||||
|
||||
CompoundTag *eTag = it->second;
|
||||
std::shared_ptr<Entity> e = EntityIO::loadStatic(eTag, NULL);
|
||||
shared_ptr<Entity> e = EntityIO::loadStatic(eTag, NULL);
|
||||
|
||||
if( e->GetType() == eTYPE_PAINTING )
|
||||
{
|
||||
std::shared_ptr<Painting> painting = dynamic_pointer_cast<Painting>(e);
|
||||
|
||||
shared_ptr<Painting> painting = dynamic_pointer_cast<Painting>(e);
|
||||
|
||||
double tileX = painting->xTile;
|
||||
double tileZ = painting->zTile;
|
||||
schematicCoordToChunkCoord(destinationBox, painting->xTile, painting->zTile, rot, tileX, tileZ);
|
||||
|
|
@ -512,8 +512,8 @@ void ConsoleSchematicFile::applyTileEntities(LevelChunk *chunk, AABB *chunkBox,
|
|||
}
|
||||
else if( e->GetType() == eTYPE_ITEM_FRAME )
|
||||
{
|
||||
std::shared_ptr<ItemFrame> frame = dynamic_pointer_cast<ItemFrame>(e);
|
||||
|
||||
shared_ptr<ItemFrame> frame = dynamic_pointer_cast<ItemFrame>(e);
|
||||
|
||||
double tileX = frame->xTile;
|
||||
double tileZ = frame->zTile;
|
||||
schematicCoordToChunkCoord(destinationBox, frame->xTile, frame->zTile, rot, tileX, tileZ);
|
||||
|
|
@ -561,7 +561,7 @@ void ConsoleSchematicFile::generateSchematicFile(DataOutputStream *dos, Level *l
|
|||
zStart-=1;
|
||||
else if(zStart < 0 && zStart%2 !=0)
|
||||
zStart-=1;
|
||||
|
||||
|
||||
// We want the end to be odd to have a total size that is even
|
||||
if(xEnd > 0 && xEnd%2 == 0)
|
||||
xEnd+=1;
|
||||
|
|
@ -615,7 +615,7 @@ void ConsoleSchematicFile::generateSchematicFile(DataOutputStream *dos, Level *l
|
|||
|
||||
// Every x is a whole row
|
||||
for(int xPos = xStart; xPos < xStart + xSize; ++xPos)
|
||||
{
|
||||
{
|
||||
int xc = xPos >> 4;
|
||||
|
||||
int x0 = xPos - xc * 16;
|
||||
|
|
@ -624,7 +624,7 @@ void ConsoleSchematicFile::generateSchematicFile(DataOutputStream *dos, Level *l
|
|||
if (x1 > 16) x1 = 16;
|
||||
|
||||
for(int zPos = zStart; zPos < zStart + zSize;)
|
||||
{
|
||||
{
|
||||
int zc = zPos >> 4;
|
||||
|
||||
int z0 = zStart - zc * 16;
|
||||
|
|
@ -678,12 +678,12 @@ void ConsoleSchematicFile::generateSchematicFile(DataOutputStream *dos, Level *l
|
|||
{
|
||||
for (int zc = zc0; zc <= zc1; zc++)
|
||||
{
|
||||
vector<std::shared_ptr<TileEntity> > *tileEntities = getTileEntitiesInRegion(level->getChunk(xc, zc), xStart, yStart, zStart, xStart + xSize, yStart + ySize, zStart + zSize);
|
||||
vector<shared_ptr<TileEntity> > *tileEntities = getTileEntitiesInRegion(level->getChunk(xc, zc), xStart, yStart, zStart, xStart + xSize, yStart + ySize, zStart + zSize);
|
||||
for(AUTO_VAR(it, tileEntities->begin()); it != tileEntities->end(); ++it)
|
||||
{
|
||||
std::shared_ptr<TileEntity> te = *it;
|
||||
shared_ptr<TileEntity> te = *it;
|
||||
CompoundTag *teTag = new CompoundTag();
|
||||
std::shared_ptr<TileEntity> teCopy = te->clone();
|
||||
shared_ptr<TileEntity> teCopy = te->clone();
|
||||
|
||||
// Adjust the tileEntity position to schematic coords from world co-ords
|
||||
teCopy->x -= xStart;
|
||||
|
|
@ -698,12 +698,12 @@ void ConsoleSchematicFile::generateSchematicFile(DataOutputStream *dos, Level *l
|
|||
tag.put(L"TileEntities", tileEntitiesTag);
|
||||
|
||||
AABB *bb = AABB::newTemp(xStart,yStart,zStart,xEnd,yEnd,zEnd);
|
||||
vector<std::shared_ptr<Entity> > *entities = level->getEntities(nullptr, bb);
|
||||
vector<shared_ptr<Entity> > *entities = level->getEntities(nullptr, bb);
|
||||
ListTag<CompoundTag> *entitiesTag = new ListTag<CompoundTag>(L"entities");
|
||||
|
||||
for(AUTO_VAR(it, entities->begin()); it != entities->end(); ++it)
|
||||
{
|
||||
std::shared_ptr<Entity> e = *it;
|
||||
shared_ptr<Entity> e = *it;
|
||||
|
||||
bool mobCanBeSaved = false;
|
||||
if(bSaveMobs)
|
||||
|
|
@ -718,7 +718,7 @@ void ConsoleSchematicFile::generateSchematicFile(DataOutputStream *dos, Level *l
|
|||
{
|
||||
CompoundTag *eTag = new CompoundTag();
|
||||
if( e->save(eTag) )
|
||||
{
|
||||
{
|
||||
ListTag<DoubleTag> *pos = (ListTag<DoubleTag> *) eTag->getList(L"Pos");
|
||||
|
||||
pos->get(0)->data -= xStart;
|
||||
|
|
@ -726,7 +726,7 @@ void ConsoleSchematicFile::generateSchematicFile(DataOutputStream *dos, Level *l
|
|||
pos->get(2)->data -= zStart;
|
||||
|
||||
if( e->GetType() == eTYPE_PAINTING || e->GetType() == eTYPE_ITEM_FRAME )
|
||||
{
|
||||
{
|
||||
((IntTag *) eTag->get(L"TileX") )->data -= xStart;
|
||||
((IntTag *) eTag->get(L"TileY") )->data -= yStart;
|
||||
((IntTag *) eTag->get(L"TileZ") )->data -= zStart;
|
||||
|
|
@ -767,7 +767,7 @@ void ConsoleSchematicFile::getBlocksAndData(LevelChunk *chunk, byteArray *data,
|
|||
// skyLightP += skyLightData.length;
|
||||
// return;
|
||||
//}
|
||||
|
||||
|
||||
bool bHasLower, bHasUpper;
|
||||
bHasLower = bHasUpper = false;
|
||||
int lowerY0, lowerY1, upperY0, upperY1;
|
||||
|
|
@ -1005,12 +1005,12 @@ void ConsoleSchematicFile::setBlocksAndData(LevelChunk *chunk, byteArray blockDa
|
|||
}
|
||||
}
|
||||
|
||||
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> > *ConsoleSchematicFile::getTileEntitiesInRegion(LevelChunk *chunk, int x0, int y0, int z0, int x1, int y1, int z1)
|
||||
{
|
||||
vector<std::shared_ptr<TileEntity> > *result = new vector<std::shared_ptr<TileEntity> >;
|
||||
vector<shared_ptr<TileEntity> > *result = new vector<shared_ptr<TileEntity> >;
|
||||
for (AUTO_VAR(it, chunk->tileEntities.begin()); it != chunk->tileEntities.end(); ++it)
|
||||
{
|
||||
std::shared_ptr<TileEntity> te = it->second;
|
||||
shared_ptr<TileEntity> te = it->second;
|
||||
if (te->x >= x0 && te->y >= y0 && te->z >= z0 && te->x < x1 && te->y < y1 && te->z < z1)
|
||||
{
|
||||
result->push_back(te);
|
||||
|
|
|
|||
|
|
@ -55,10 +55,10 @@ public:
|
|||
} XboxSchematicInitParam;
|
||||
private:
|
||||
int m_xSize, m_ySize, m_zSize;
|
||||
vector<std::shared_ptr<TileEntity> > m_tileEntities;
|
||||
vector<shared_ptr<TileEntity> > m_tileEntities;
|
||||
vector< pair<Vec3 *, CompoundTag *> > m_entities;
|
||||
|
||||
public:
|
||||
public:
|
||||
byteArray m_data;
|
||||
|
||||
public:
|
||||
|
|
@ -72,8 +72,8 @@ public:
|
|||
void save(DataOutputStream *dos);
|
||||
void load(DataInputStream *dis);
|
||||
|
||||
int64_t applyBlocksAndData(LevelChunk *chunk, AABB *chunkBox, AABB *destinationBox, ESchematicRotation rot);
|
||||
int64_t applyLighting(LevelChunk *chunk, AABB *chunkBox, AABB *destinationBox, ESchematicRotation rot);
|
||||
__int64 applyBlocksAndData(LevelChunk *chunk, AABB *chunkBox, AABB *destinationBox, ESchematicRotation rot);
|
||||
__int64 applyLighting(LevelChunk *chunk, AABB *chunkBox, AABB *destinationBox, ESchematicRotation rot);
|
||||
void applyTileEntities(LevelChunk *chunk, AABB *chunkBox, AABB *destinationBox, ESchematicRotation rot);
|
||||
|
||||
static void generateSchematicFile(DataOutputStream *dos, Level *level, int xStart, int yStart, int zStart, int xEnd, int yEnd, int zEnd, bool bSaveMobs, Compression::ECompressionTypes);
|
||||
|
|
@ -83,7 +83,7 @@ private:
|
|||
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 vector<std::shared_ptr<TileEntity> > *getTileEntitiesInRegion(LevelChunk *chunk, int x0, int y0, int z0, int x1, int y1, int z1);
|
||||
static vector<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 schematicCoordToChunkCoord(AABB *destinationBox, double schematicX, double schematicZ, ESchematicRotation rot, double &chunkX, double &chunkZ);
|
||||
|
|
|
|||
|
|
@ -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::onCollectItem(std::shared_ptr<ItemInstance> item) { m_definition->onCollectItem(this,item); }
|
||||
void GameRule::onCollectItem(shared_ptr<ItemInstance> item) { m_definition->onCollectItem(this,item); }
|
||||
|
||||
void GameRule::write(DataOutputStream *dos)
|
||||
{
|
||||
|
|
@ -63,7 +63,7 @@ void GameRule::write(DataOutputStream *dos)
|
|||
{
|
||||
wstring pName = (*it).first;
|
||||
ValueType vType = (*it).second;
|
||||
|
||||
|
||||
dos->writeUTF( (*it).first );
|
||||
dos->writeBoolean( vType.isPointer );
|
||||
|
||||
|
|
@ -80,7 +80,7 @@ void GameRule::read(DataInputStream *dis)
|
|||
for (int i = 0; i < savedParams; i++)
|
||||
{
|
||||
wstring pNames = dis->readUTF();
|
||||
|
||||
|
||||
ValueType vType = getParameter(pNames);
|
||||
|
||||
if (dis->readBoolean())
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ public:
|
|||
typedef struct _ValueType
|
||||
{
|
||||
union{
|
||||
int64_t i64;
|
||||
__int64 i64;
|
||||
int i;
|
||||
char c;
|
||||
bool b;
|
||||
|
|
@ -44,14 +44,14 @@ public:
|
|||
virtual ~GameRule();
|
||||
|
||||
Connection *getConnection() { return m_connection; }
|
||||
|
||||
|
||||
ValueType getParameter(const wstring ¶meterName);
|
||||
void setParameter(const wstring ¶meterName,ValueType value);
|
||||
GameRuleDefinition *getGameRuleDefinition();
|
||||
|
||||
// All the hooks go here
|
||||
void onUseTile(int tileId, int x, int y, int z);
|
||||
void onCollectItem(std::shared_ptr<ItemInstance> item);
|
||||
void onCollectItem(shared_ptr<ItemInstance> item);
|
||||
|
||||
// 4J-JEV: For saving.
|
||||
//CompoundTag *toTags(unordered_map<GameRuleDefinition *, int> *map);
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ public:
|
|||
|
||||
virtual GameRuleDefinition *addChild(ConsoleGameRules::EGameRuleType ruleType);
|
||||
virtual void addAttribute(const wstring &attributeName, const wstring &attributeValue);
|
||||
|
||||
|
||||
virtual void populateGameRule(GameRulesInstance::EGameRulesInstanceType type, 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
|
||||
virtual bool onUseTile(GameRule *rule, int tileId, int x, int y, int z) { return false; }
|
||||
virtual bool onCollectItem(GameRule *rule, std::shared_ptr<ItemInstance> item) { return false; }
|
||||
virtual void postProcessPlayer(std::shared_ptr<Player> player) { }
|
||||
virtual bool onCollectItem(GameRule *rule, shared_ptr<ItemInstance> item) { return false; }
|
||||
virtual void postProcessPlayer(shared_ptr<Player> player) { }
|
||||
|
||||
vector<GameRuleDefinition *> *enumerate();
|
||||
unordered_map<GameRuleDefinition *, int> *enumerateMap();
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ WCHAR *GameRuleManager::wchAttrNameA[] =
|
|||
L"spawnY", // eGameRuleAttr_spawnY
|
||||
L"spawnZ", // eGameRuleAttr_spawnZ
|
||||
L"orientation",
|
||||
L"dimension",
|
||||
L"dimension",
|
||||
L"topTileId", // eGameRuleAttr_topTileId
|
||||
L"biomeId", // eGameRuleAttr_biomeId
|
||||
L"feature", // eGameRuleAttr_feature
|
||||
|
|
@ -114,7 +114,7 @@ void GameRuleManager::loadGameRules(DLCPack *pack)
|
|||
readRuleFile(createdLevelGenerationOptions, dData, dSize, strings);
|
||||
|
||||
createdLevelGenerationOptions->setSrc( LevelGenerationOptions::eSrc_fromDLC );
|
||||
|
||||
|
||||
|
||||
//createdLevelGenerationOptions->setSrc( LevelGenerationOptions::eSrc_fromDLC );
|
||||
dlcHeader->lgo = createdLevelGenerationOptions;
|
||||
|
|
@ -130,12 +130,12 @@ void GameRuleManager::loadGameRules(DLCPack *pack)
|
|||
|
||||
LevelGenerationOptions *createdLevelGenerationOptions = new LevelGenerationOptions();
|
||||
// = loadGameRules(dData, dSize); //, strings);
|
||||
|
||||
|
||||
createdLevelGenerationOptions->setGrSource( new JustGrSource() );
|
||||
readRuleFile(createdLevelGenerationOptions, dData, dSize, strings);
|
||||
|
||||
createdLevelGenerationOptions->setSrc( LevelGenerationOptions::eSrc_tutorial );
|
||||
|
||||
|
||||
//createdLevelGenerationOptions->set_DLCGameRulesFile( dlcFile );
|
||||
|
||||
createdLevelGenerationOptions->setLoadedData();
|
||||
|
|
@ -169,7 +169,7 @@ void GameRuleManager::loadGameRules(LevelGenerationOptions *lgo, byte *dIn, UINT
|
|||
app.DebugPrintf("\tversion=%d.\n", version);
|
||||
|
||||
for (int i = 0; i < 8; i++) dis.readByte();
|
||||
|
||||
|
||||
BYTE compression_type = dis.readByte();
|
||||
|
||||
app.DebugPrintf("\tcompressionType=%d.\n", compression_type);
|
||||
|
|
@ -179,11 +179,11 @@ void GameRuleManager::loadGameRules(LevelGenerationOptions *lgo, byte *dIn, UINT
|
|||
decomp_len = dis.readInt();
|
||||
|
||||
app.DebugPrintf("\tcompr_len=%d.\n\tdecomp_len=%d.\n", compr_len, decomp_len);
|
||||
|
||||
|
||||
|
||||
// Decompress File Body
|
||||
|
||||
byteArray content(new BYTE[decomp_len], decomp_len),
|
||||
byteArray content(new BYTE[decomp_len], decomp_len),
|
||||
compr_content(new BYTE[compr_len], compr_len);
|
||||
dis.read(compr_content);
|
||||
|
||||
|
|
@ -256,7 +256,7 @@ void GameRuleManager::saveGameRules(byte **dOut, UINT *dSize)
|
|||
// Initialise output stream.
|
||||
ByteArrayOutputStream baos;
|
||||
DataOutputStream dos(&baos);
|
||||
|
||||
|
||||
// Write header.
|
||||
|
||||
// VERSION NUMBER
|
||||
|
|
@ -284,7 +284,7 @@ void GameRuleManager::saveGameRules(byte **dOut, UINT *dSize)
|
|||
compr_dos.writeInt( 0 ); // XmlObjects.length
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
StringTable *st = m_currentGameRuleDefinitions->getStringTable();
|
||||
|
||||
if (st == NULL)
|
||||
|
|
@ -316,9 +316,9 @@ void GameRuleManager::saveGameRules(byte **dOut, UINT *dSize)
|
|||
dos.writeInt( compr_ba.length ); // Write length
|
||||
dos.writeInt( compr_baos.buf.length );
|
||||
dos.write(compr_ba);
|
||||
|
||||
|
||||
delete [] compr_ba.data;
|
||||
|
||||
|
||||
compr_dos.close();
|
||||
compr_baos.close();
|
||||
// -- END COMPRESSED -- //
|
||||
|
|
@ -328,7 +328,7 @@ void GameRuleManager::saveGameRules(byte **dOut, UINT *dSize)
|
|||
*dOut = baos.buf.data;
|
||||
|
||||
baos.buf.data = NULL;
|
||||
|
||||
|
||||
dos.close(); baos.close();
|
||||
}
|
||||
|
||||
|
|
@ -383,7 +383,7 @@ bool GameRuleManager::readRuleFile(LevelGenerationOptions *lgo, byte *dIn, UINT
|
|||
//DWORD dwLen = 0;
|
||||
//PBYTE pbData = dlcFile->getData(dwLen);
|
||||
//byteArray data(pbData,dwLen);
|
||||
|
||||
|
||||
byteArray data(dIn, dSize);
|
||||
ByteArrayInputStream bais(data);
|
||||
DataInputStream dis(&bais);
|
||||
|
|
@ -391,7 +391,7 @@ bool GameRuleManager::readRuleFile(LevelGenerationOptions *lgo, byte *dIn, UINT
|
|||
// Read File.
|
||||
|
||||
// version_number
|
||||
int64_t version = dis.readShort();
|
||||
__int64 version = dis.readShort();
|
||||
unsigned char compressionType = 0;
|
||||
if(version == 0)
|
||||
{
|
||||
|
|
@ -502,7 +502,7 @@ bool GameRuleManager::readRuleFile(LevelGenerationOptions *lgo, byte *dIn, UINT
|
|||
}
|
||||
}*/
|
||||
|
||||
// subfile
|
||||
// subfile
|
||||
UINT numFiles = contentDis->readInt();
|
||||
for (UINT i = 0; i < numFiles; i++)
|
||||
{
|
||||
|
|
@ -570,10 +570,10 @@ bool GameRuleManager::readRuleFile(LevelGenerationOptions *lgo, byte *dIn, UINT
|
|||
|
||||
LevelGenerationOptions *GameRuleManager::readHeader(DLCGameRulesHeader *grh)
|
||||
{
|
||||
LevelGenerationOptions *out =
|
||||
LevelGenerationOptions *out =
|
||||
new LevelGenerationOptions();
|
||||
|
||||
|
||||
|
||||
out->setSrc(LevelGenerationOptions::eSrc_fromDLC);
|
||||
out->setGrSource(grh);
|
||||
addLevelGenerationOptions(out);
|
||||
|
|
@ -733,7 +733,7 @@ LPCWSTR GameRuleManager::GetGameRulesString(const wstring &key)
|
|||
LEVEL_GEN_ID GameRuleManager::addLevelGenerationOptions(LevelGenerationOptions *lgo)
|
||||
{
|
||||
vector<LevelGenerationOptions *> *lgs = m_levelGenerators.getLevelGenerators();
|
||||
|
||||
|
||||
for (int i = 0; i<lgs->size(); i++)
|
||||
if (lgs->at(i) == lgo)
|
||||
return i;
|
||||
|
|
@ -753,7 +753,7 @@ void GameRuleManager::unloadCurrentGameRules()
|
|||
if (m_currentLevelGenerationOptions->isFromSave())
|
||||
{
|
||||
m_levelGenerators.removeLevelGenerator( m_currentLevelGenerationOptions );
|
||||
|
||||
|
||||
delete m_currentLevelGenerationOptions;
|
||||
}
|
||||
else if (m_currentLevelGenerationOptions->isFromDLC())
|
||||
|
|
|
|||
|
|
@ -70,17 +70,17 @@ LevelGenerationOptions::~LevelGenerationOptions()
|
|||
{
|
||||
delete *it;
|
||||
}
|
||||
|
||||
|
||||
for(AUTO_VAR(it, m_biomeOverrides.begin()); it != m_biomeOverrides.end(); ++it)
|
||||
{
|
||||
delete *it;
|
||||
}
|
||||
|
||||
|
||||
for(AUTO_VAR(it, m_features.begin()); it != m_features.end(); ++it)
|
||||
{
|
||||
delete *it;
|
||||
}
|
||||
|
||||
|
||||
if (m_stringTable)
|
||||
if (!isTutorial())
|
||||
delete m_stringTable;
|
||||
|
|
@ -93,7 +93,7 @@ ConsoleGameRules::EGameRuleType LevelGenerationOptions::getActionType() { return
|
|||
void LevelGenerationOptions::writeAttributes(DataOutputStream *dos, UINT numAttrs)
|
||||
{
|
||||
GameRuleDefinition::writeAttributes(dos, numAttrs + 5);
|
||||
|
||||
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_spawnX);
|
||||
dos->writeUTF(_toString(m_spawnPos->x));
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_spawnY);
|
||||
|
|
@ -110,12 +110,12 @@ void LevelGenerationOptions::writeAttributes(DataOutputStream *dos, UINT numAttr
|
|||
void LevelGenerationOptions::getChildren(vector<GameRuleDefinition *> *children)
|
||||
{
|
||||
GameRuleDefinition::getChildren(children);
|
||||
|
||||
|
||||
vector<ApplySchematicRuleDefinition *> used_schematics;
|
||||
for (AUTO_VAR(it, m_schematicRules.begin()); it != m_schematicRules.end(); it++)
|
||||
if ( !(*it)->isComplete() )
|
||||
used_schematics.push_back( *it );
|
||||
|
||||
|
||||
for(AUTO_VAR(it, m_structureRules.begin()); it!=m_structureRules.end(); it++)
|
||||
children->push_back( *it );
|
||||
for(AUTO_VAR(it, used_schematics.begin()); it!=used_schematics.end(); it++)
|
||||
|
|
@ -162,7 +162,7 @@ void LevelGenerationOptions::addAttribute(const wstring &attributeName, const ws
|
|||
{
|
||||
if(attributeName.compare(L"seed") == 0)
|
||||
{
|
||||
m_seed = _fromString<int64_t>(attributeValue);
|
||||
m_seed = _fromString<__int64>(attributeValue);
|
||||
app.DebugPrintf("LevelGenerationOptions: Adding parameter m_seed=%I64d\n",m_seed);
|
||||
}
|
||||
else if(attributeName.compare(L"spawnX") == 0)
|
||||
|
|
@ -213,7 +213,7 @@ void LevelGenerationOptions::addAttribute(const wstring &attributeName, const ws
|
|||
app.DebugPrintf("LevelGenerationOptions: Adding parameter displayName=%ls\n", getDisplayName());
|
||||
}
|
||||
else if(attributeName.compare(L"texturePackId") == 0)
|
||||
{
|
||||
{
|
||||
setRequiredTexturePackId( _fromString<unsigned int>(attributeValue) );
|
||||
setRequiresTexturePack( true );
|
||||
app.DebugPrintf("LevelGenerationOptions: Adding parameter texturePackId=%0x\n", getRequiredTexturePackId());
|
||||
|
|
@ -290,14 +290,14 @@ bool LevelGenerationOptions::checkIntersects(int x0, int y0, int z0, int x1, int
|
|||
|
||||
for( AUTO_VAR(it, m_structureRules.begin()); it != m_structureRules.end(); it++ )
|
||||
{
|
||||
ConsoleGenerateStructure *structureStart = *it;
|
||||
ConsoleGenerateStructure *structureStart = *it;
|
||||
int minY = structureStart->getMinY();
|
||||
if(minY < m_minY) m_minY = minY;
|
||||
}
|
||||
|
||||
m_bHaveMinY = true;
|
||||
}
|
||||
|
||||
|
||||
// 4J Stu - We DO NOT intersect if our upper bound is below the lower bound for all schematics
|
||||
if( y1 < m_minY ) return false;
|
||||
|
||||
|
|
@ -313,7 +313,7 @@ bool LevelGenerationOptions::checkIntersects(int x0, int y0, int z0, int x1, int
|
|||
{
|
||||
for( AUTO_VAR(it, m_structureRules.begin()); it != m_structureRules.end(); it++ )
|
||||
{
|
||||
ConsoleGenerateStructure *structureStart = *it;
|
||||
ConsoleGenerateStructure *structureStart = *it;
|
||||
intersects = structureStart->checkIntersects(x0,y0,z0,x1,y1,z1);
|
||||
if(intersects) break;
|
||||
}
|
||||
|
|
@ -438,12 +438,12 @@ unordered_map<wstring, ConsoleSchematicFile *> *LevelGenerationOptions::getUnfin
|
|||
usedFiles.insert( (*it)->getSchematicName() );
|
||||
|
||||
// Clean schematic files.
|
||||
unordered_map<wstring, ConsoleSchematicFile *> *out
|
||||
unordered_map<wstring, ConsoleSchematicFile *> *out
|
||||
= new unordered_map<wstring, ConsoleSchematicFile *>();
|
||||
for (AUTO_VAR(it, usedFiles.begin()); it!=usedFiles.end(); it++)
|
||||
out->insert( pair<wstring, ConsoleSchematicFile *>(*it, getSchematicFile(*it)) );
|
||||
|
||||
return out;
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
void LevelGenerationOptions::reset_start()
|
||||
|
|
@ -505,7 +505,7 @@ void LevelGenerationOptions::deleteBaseSaveData() { if(m_pbBaseSaveData) delete
|
|||
bool LevelGenerationOptions::hasLoadedData() { return m_hasLoadedData; }
|
||||
void LevelGenerationOptions::setLoadedData() { m_hasLoadedData = true; }
|
||||
|
||||
int64_t LevelGenerationOptions::getLevelSeed() { return m_seed; }
|
||||
__int64 LevelGenerationOptions::getLevelSeed() { return m_seed; }
|
||||
Pos *LevelGenerationOptions::getSpawnPos() { return m_spawnPos; }
|
||||
bool LevelGenerationOptions::getuseFlatWorld() { return m_useFlatWorld; }
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ class GrSource
|
|||
public:
|
||||
// 4J-JEV:
|
||||
// Moved all this here; I didn't like that all this header information
|
||||
// was being mixed in with all the game information as they have
|
||||
// was being mixed in with all the game information as they have
|
||||
// completely different lifespans.
|
||||
|
||||
virtual bool requiresTexturePack()=0;
|
||||
|
|
@ -146,7 +146,7 @@ public:
|
|||
|
||||
private:
|
||||
// This should match the "MapOptionsRule" definition in the XML schema
|
||||
int64_t m_seed;
|
||||
__int64 m_seed;
|
||||
bool m_useFlatWorld;
|
||||
Pos *m_spawnPos;
|
||||
vector<ApplySchematicRuleDefinition *> m_schematicRules;
|
||||
|
|
@ -167,13 +167,13 @@ public:
|
|||
~LevelGenerationOptions();
|
||||
|
||||
virtual ConsoleGameRules::EGameRuleType getActionType();
|
||||
|
||||
|
||||
virtual void writeAttributes(DataOutputStream *dos, UINT numAttributes);
|
||||
virtual void getChildren(vector<GameRuleDefinition *> *children);
|
||||
virtual GameRuleDefinition *addChild(ConsoleGameRules::EGameRuleType ruleType);
|
||||
virtual void addAttribute(const wstring &attributeName, const wstring &attributeValue);
|
||||
|
||||
int64_t getLevelSeed();
|
||||
__int64 getLevelSeed();
|
||||
Pos *getSpawnPos();
|
||||
bool getuseFlatWorld();
|
||||
|
||||
|
|
@ -185,7 +185,7 @@ public:
|
|||
private:
|
||||
void clearSchematics();
|
||||
|
||||
public:
|
||||
public:
|
||||
ConsoleSchematicFile *loadSchematicFile(const wstring &filename, PBYTE pbData, DWORD dwLen);
|
||||
|
||||
public:
|
||||
|
|
@ -203,7 +203,7 @@ public:
|
|||
LPCWSTR getString(const wstring &key);
|
||||
|
||||
unordered_map<wstring, ConsoleSchematicFile *> *getUnfinishedSchematicFiles();
|
||||
|
||||
|
||||
// 4J-JEV:
|
||||
// ApplySchematicRules contain limited state
|
||||
// which needs to be reset BEFORE a new game starts.
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ UpdatePlayerRuleDefinition::UpdatePlayerRuleDefinition()
|
|||
{
|
||||
m_bUpdateHealth = m_bUpdateFood = m_bUpdateYRot = false;;
|
||||
m_health = 0;
|
||||
m_food = 0;
|
||||
m_food = 0;
|
||||
m_spawnPos = NULL;
|
||||
m_yRot = 0.0f;
|
||||
}
|
||||
|
|
@ -130,7 +130,7 @@ void UpdatePlayerRuleDefinition::addAttribute(const wstring &attributeName, cons
|
|||
}
|
||||
}
|
||||
|
||||
void UpdatePlayerRuleDefinition::postProcessPlayer(std::shared_ptr<Player> player)
|
||||
void UpdatePlayerRuleDefinition::postProcessPlayer(shared_ptr<Player> player)
|
||||
{
|
||||
if(m_bUpdateHealth)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ private:
|
|||
|
||||
bool m_bUpdateHealth, m_bUpdateFood, m_bUpdateYRot, m_bUpdateInventory;
|
||||
int m_health;
|
||||
int m_food;
|
||||
int m_food;
|
||||
Pos *m_spawnPos;
|
||||
float m_yRot;
|
||||
|
||||
|
|
@ -22,12 +22,12 @@ public:
|
|||
~UpdatePlayerRuleDefinition();
|
||||
|
||||
virtual ConsoleGameRules::EGameRuleType getActionType() { return ConsoleGameRules::eGameRuleType_UpdatePlayerRule; }
|
||||
|
||||
|
||||
virtual void getChildren(vector<GameRuleDefinition *> *children);
|
||||
virtual GameRuleDefinition *addChild(ConsoleGameRules::EGameRuleType ruleType);
|
||||
|
||||
virtual void writeAttributes(DataOutputStream *dos, UINT numAttributes);
|
||||
virtual void addAttribute(const wstring &attributeName, const wstring &attributeValue);
|
||||
|
||||
virtual void postProcessPlayer(std::shared_ptr<Player> player);
|
||||
virtual void postProcessPlayer(shared_ptr<Player> player);
|
||||
};
|
||||
|
|
@ -22,7 +22,7 @@ XboxStructureActionPlaceContainer::~XboxStructureActionPlaceContainer()
|
|||
|
||||
// 4J-JEV: Super class handles attr-facing fine.
|
||||
//void XboxStructureActionPlaceContainer::writeAttributes(DataOutputStream *dos, UINT numAttrs)
|
||||
|
||||
|
||||
|
||||
void XboxStructureActionPlaceContainer::getChildren(vector<GameRuleDefinition *> *children)
|
||||
{
|
||||
|
|
@ -78,8 +78,8 @@ bool XboxStructureActionPlaceContainer::placeContainerInLevel(StructurePiece *st
|
|||
}
|
||||
|
||||
level->setTile( worldX, worldY, worldZ, m_tile );
|
||||
std::shared_ptr<Container> container = dynamic_pointer_cast<Container>(level->getTileEntity( worldX, worldY, worldZ ));
|
||||
|
||||
shared_ptr<Container> container = dynamic_pointer_cast<Container>(level->getTileEntity( worldX, worldY, worldZ ));
|
||||
|
||||
app.DebugPrintf("XboxStructureActionPlaceContainer - placing a container at (%d,%d,%d)\n", worldX, worldY, worldZ);
|
||||
if ( container != NULL )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ bool XboxStructureActionPlaceSpawner::placeSpawnerInLevel(StructurePiece *struct
|
|||
}
|
||||
|
||||
level->setTile( worldX, worldY, worldZ, m_tile );
|
||||
std::shared_ptr<MobSpawnerTileEntity> entity = dynamic_pointer_cast<MobSpawnerTileEntity>(level->getTileEntity( worldX, worldY, worldZ ));
|
||||
shared_ptr<MobSpawnerTileEntity> entity = dynamic_pointer_cast<MobSpawnerTileEntity>(level->getTileEntity( worldX, worldY, worldZ ));
|
||||
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
wprintf(L"XboxStructureActionPlaceSpawner - placing a %ls spawner at (%d,%d,%d)\n", m_entityId.c_str(), worldX, worldY, worldZ);
|
||||
|
|
|
|||
|
|
@ -44,8 +44,8 @@
|
|||
CGameNetworkManager g_NetworkManager;
|
||||
CPlatformNetworkManager *CGameNetworkManager::s_pPlatformNetworkManager;
|
||||
|
||||
int64_t CGameNetworkManager::messageQueue[512];
|
||||
int64_t CGameNetworkManager::byteQueue[512];
|
||||
__int64 CGameNetworkManager::messageQueue[512];
|
||||
__int64 CGameNetworkManager::byteQueue[512];
|
||||
int CGameNetworkManager::messageQueuePos = 0;
|
||||
|
||||
CGameNetworkManager::CGameNetworkManager()
|
||||
|
|
@ -74,7 +74,7 @@ void CGameNetworkManager::Initialise()
|
|||
#else
|
||||
s_pPlatformNetworkManager = new CPlatformNetworkManagerStub();
|
||||
#endif
|
||||
s_pPlatformNetworkManager->Initialise( this, flagIndexSize );
|
||||
s_pPlatformNetworkManager->Initialise( this, flagIndexSize );
|
||||
m_bNetworkThreadRunning = false;
|
||||
m_bInitialised = true;
|
||||
}
|
||||
|
|
@ -104,7 +104,7 @@ void CGameNetworkManager::DoWork()
|
|||
if((g_NetworkManager.GetLockedProfile()!=-1) && iPrimaryPlayer!=-1 && bConnected == false && g_NetworkManager.IsInSession() )
|
||||
{
|
||||
app.SetAction(iPrimaryPlayer,eAppAction_EthernetDisconnected);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case XN_LIVE_INVITE_ACCEPTED:
|
||||
|
|
@ -161,12 +161,12 @@ bool CGameNetworkManager::_RunNetworkGame(LPVOID lpParameter)
|
|||
|
||||
success = s_pPlatformNetworkManager->_RunNetworkGame();
|
||||
if(!success)
|
||||
{
|
||||
{
|
||||
app.SetAction(ProfileManager.GetPrimaryPad(),eAppAction_ExitWorld,(void *)TRUE);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if( g_NetworkManager.IsLeavingGame() ) return false;
|
||||
|
||||
app.SetGameStarted(true);
|
||||
|
|
@ -188,12 +188,12 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, LPVOID lpParame
|
|||
ProfileManager.SetDeferredSignoutEnabled(true);
|
||||
#endif
|
||||
|
||||
int64_t seed = 0;
|
||||
__int64 seed = 0;
|
||||
if(lpParameter != NULL)
|
||||
{
|
||||
NetworkGameInitData *param = (NetworkGameInitData *)lpParameter;
|
||||
seed = param->seed;
|
||||
|
||||
|
||||
app.setLevelGenerationOptions(param->levelGen);
|
||||
if(param->levelGen != NULL)
|
||||
{
|
||||
|
|
@ -204,12 +204,12 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, LPVOID lpParame
|
|||
}
|
||||
else
|
||||
{
|
||||
param->seed = seed = app.getLevelGenerationOptions()->getLevelSeed();
|
||||
param->seed = seed = app.getLevelGenerationOptions()->getLevelSeed();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int64_t sseed = seed; // Create static version so this will be valid until next call to this function & whilst thread is running
|
||||
static __int64 sseed = seed; // Create static version so this will be valid until next call to this function & whilst thread is running
|
||||
ServerStoppedCreate(false);
|
||||
if( g_NetworkManager.IsHost() )
|
||||
{
|
||||
|
|
@ -227,7 +227,7 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, LPVOID lpParame
|
|||
ServerReadyWait();
|
||||
ServerReadyDestroy();
|
||||
|
||||
if( MinecraftServer::serverHalted() )
|
||||
if( MinecraftServer::serverHalted() )
|
||||
return false;
|
||||
|
||||
// printf("Server ready to go!\n");
|
||||
|
|
@ -238,7 +238,7 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, LPVOID lpParame
|
|||
}
|
||||
|
||||
#ifndef _XBOX
|
||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||
// Make sure that we have transitioned through any joining/creating stages and are actually playing the game, so that we know the players should be valid
|
||||
bool changedMessage = false;
|
||||
while(!IsReadyToPlayOrIdle())
|
||||
|
|
@ -316,7 +316,7 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, LPVOID lpParame
|
|||
return false;
|
||||
}
|
||||
|
||||
connection->send( std::shared_ptr<PreLoginPacket>( new PreLoginPacket(minecraft->user->name) ) );
|
||||
connection->send( shared_ptr<PreLoginPacket>( new PreLoginPacket(minecraft->user->name) ) );
|
||||
|
||||
// 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
|
||||
|
|
@ -403,7 +403,7 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, LPVOID lpParame
|
|||
// Open the socket on the server end to accept incoming data
|
||||
Socket::addIncomingSocket(socket);
|
||||
|
||||
connection->send( std::shared_ptr<PreLoginPacket>( new PreLoginPacket(convStringToWstring( ProfileManager.GetGamertag(idx) )) ) );
|
||||
connection->send( shared_ptr<PreLoginPacket>( new PreLoginPacket(convStringToWstring( ProfileManager.GetGamertag(idx) )) ) );
|
||||
|
||||
createdConnections.push_back( connection );
|
||||
|
||||
|
|
@ -458,7 +458,7 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, LPVOID lpParame
|
|||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(g_NetworkManager.IsLeavingGame() || !IsInSession() )
|
||||
{
|
||||
for(AUTO_VAR(it, createdConnections.begin()); it < createdConnections.end(); ++it)
|
||||
|
|
@ -754,7 +754,7 @@ int CGameNetworkManager::JoinFromInvite_SignInReturned(void *pParam,bool bContin
|
|||
ProfileManager.SetPrimaryPad(iPad);
|
||||
|
||||
g_NetworkManager.SetLocalGame(false);
|
||||
|
||||
|
||||
// If the player was signed in before selecting play, we'll not have read the profile yet, so query the sign-in status to get this to happen
|
||||
ProfileManager.QuerySigninStatus();
|
||||
|
||||
|
|
@ -770,7 +770,7 @@ int CGameNetworkManager::JoinFromInvite_SignInReturned(void *pParam,bool bContin
|
|||
pInviteInfo ); // pInviteInfo
|
||||
if( !success )
|
||||
{
|
||||
app.DebugPrintf( "Failed joining game from invite\n" );
|
||||
app.DebugPrintf( "Failed joining game from invite\n" );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -816,7 +816,7 @@ int CGameNetworkManager::RunNetworkGameThreadProc( void* lpParameter )
|
|||
Compression::UseDefaultThreadStorage();
|
||||
Tile::CreateNewThreadStorage();
|
||||
IntCache::CreateNewThreadStorage();
|
||||
|
||||
|
||||
g_NetworkManager.m_bNetworkThreadRunning = true;
|
||||
bool success = g_NetworkManager._RunNetworkGame(lpParameter);
|
||||
g_NetworkManager.m_bNetworkThreadRunning = false;
|
||||
|
|
@ -828,7 +828,7 @@ int CGameNetworkManager::RunNetworkGameThreadProc( void* lpParameter )
|
|||
Sleep(1);
|
||||
}
|
||||
ui.CleanUpSkinReload();
|
||||
if(app.GetDisconnectReason() == DisconnectPacket::eDisconnect_None)
|
||||
if(app.GetDisconnectReason() == DisconnectPacket::eDisconnect_None)
|
||||
{
|
||||
app.SetDisconnectReason( DisconnectPacket::eDisconnect_ConnectionCreationFailed );
|
||||
}
|
||||
|
|
@ -850,7 +850,7 @@ int CGameNetworkManager::RunNetworkGameThreadProc( void* lpParameter )
|
|||
|
||||
int CGameNetworkManager::ServerThreadProc( void* lpParameter )
|
||||
{
|
||||
int64_t seed = 0;
|
||||
__int64 seed = 0;
|
||||
if(lpParameter != NULL)
|
||||
{
|
||||
NetworkGameInitData *param = (NetworkGameInitData *)lpParameter;
|
||||
|
|
@ -861,7 +861,7 @@ int CGameNetworkManager::ServerThreadProc( void* lpParameter )
|
|||
SetThreadName(-1, "Minecraft Server thread");
|
||||
AABB::CreateNewThreadStorage();
|
||||
Vec3::CreateNewThreadStorage();
|
||||
IntCache::CreateNewThreadStorage();
|
||||
IntCache::CreateNewThreadStorage();
|
||||
Compression::UseDefaultThreadStorage();
|
||||
OldChunkStorage::UseDefaultThreadStorage();
|
||||
Entity::useSmallIds();
|
||||
|
|
@ -869,7 +869,7 @@ int CGameNetworkManager::ServerThreadProc( void* lpParameter )
|
|||
Tile::CreateNewThreadStorage();
|
||||
|
||||
MinecraftServer::main(seed, lpParameter); //saveData, app.GetGameHostOption(eGameHostOption_All));
|
||||
|
||||
|
||||
Tile::ReleaseThreadStorage();
|
||||
AABB::ReleaseThreadStorage();
|
||||
Vec3::ReleaseThreadStorage();
|
||||
|
|
@ -926,7 +926,7 @@ int CGameNetworkManager::ExitAndJoinFromInviteThreadProc( void* lpParam )
|
|||
// The pair of methods MustSignInReturned_0 & PSNSignInReturned_0 handle this
|
||||
int CGameNetworkManager::MustSignInReturned_0(void *pParam,int iPad,C4JStorage::EMessageResult result)
|
||||
{
|
||||
if(result==C4JStorage::EMessage_ResultAccept)
|
||||
if(result==C4JStorage::EMessage_ResultAccept)
|
||||
{
|
||||
#ifdef __PS3__
|
||||
SQRNetworkManager_PS3::AttemptPSNSignIn(&CGameNetworkManager::PSNSignInReturned_0, pParam,true);
|
||||
|
|
@ -986,7 +986,7 @@ int CGameNetworkManager::PSNSignInReturned_0(void* pParam, bool bContinue, int i
|
|||
// The pair of methods MustSignInReturned_1 & PSNSignInReturned_1 handle this
|
||||
int CGameNetworkManager::MustSignInReturned_1(void *pParam,int iPad,C4JStorage::EMessageResult result)
|
||||
{
|
||||
if(result==C4JStorage::EMessage_ResultAccept)
|
||||
if(result==C4JStorage::EMessage_ResultAccept)
|
||||
{
|
||||
#ifdef __PS3__
|
||||
SQRNetworkManager_PS3::AttemptPSNSignIn(&CGameNetworkManager::PSNSignInReturned_1, pParam,true);
|
||||
|
|
@ -1018,7 +1018,7 @@ int CGameNetworkManager::PSNSignInReturned_1(void* pParam, bool bContinue, int i
|
|||
#elif defined __ORBIS__
|
||||
// TODO: No Orbis equivalent (should there be?)
|
||||
#endif
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1043,7 +1043,7 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc( void* lpParam )
|
|||
Vec3::UseDefaultThreadStorage();
|
||||
Compression::UseDefaultThreadStorage();
|
||||
|
||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||
MinecraftServer *pServer = MinecraftServer::getInstance();
|
||||
|
||||
#if defined(__PS3__) || defined(__ORBIS__) || defined __PSVITA__
|
||||
|
|
@ -1082,7 +1082,7 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc( void* lpParam )
|
|||
pMinecraft->progressRenderer->progressStartNoAbort( g_NetworkManager.CorrectErrorIDS(IDS_CONNECTION_LOST_LIVE_NO_EXIT) );
|
||||
pMinecraft->progressRenderer->progressStage( IDS_PROGRESS_CONVERTING_TO_OFFLINE_GAME );
|
||||
}
|
||||
|
||||
|
||||
#else
|
||||
pMinecraft->progressRenderer->progressStartNoAbort( g_NetworkManager.CorrectErrorIDS(IDS_CONNECTION_LOST_LIVE_NO_EXIT) );
|
||||
pMinecraft->progressRenderer->progressStage( IDS_PROGRESS_CONVERTING_TO_OFFLINE_GAME );
|
||||
|
|
@ -1096,7 +1096,7 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc( void* lpParam )
|
|||
|
||||
// wait for the server to be in a non-ticking state
|
||||
pServer->m_serverPausedEvent->WaitForSignal(INFINITE);
|
||||
|
||||
|
||||
#if defined(__PS3__) || defined(__ORBIS__) || defined __PSVITA__
|
||||
// Swap these two messages around as one is too long to display at 480
|
||||
pMinecraft->progressRenderer->progressStartNoAbort( IDS_PROGRESS_CONVERTING_TO_OFFLINE_GAME );
|
||||
|
|
@ -1134,7 +1134,7 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc( void* lpParam )
|
|||
PlayerList *players = pServer->getPlayers();
|
||||
for(AUTO_VAR(it, players->players.begin()); it < players->players.end(); ++it)
|
||||
{
|
||||
std::shared_ptr<ServerPlayer> servPlayer = *it;
|
||||
shared_ptr<ServerPlayer> servPlayer = *it;
|
||||
if( servPlayer->connection->isLocal() && !servPlayer->connection->isGuest() )
|
||||
{
|
||||
servPlayer->connection->connection->getSocket()->setPlayer(NULL);
|
||||
|
|
@ -1158,7 +1158,7 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc( void* lpParam )
|
|||
{
|
||||
Sleep(1);
|
||||
}
|
||||
|
||||
|
||||
// Reset this flag as the we don't need to know that we only lost the room only from this point onwards, the behaviour is exactly the same
|
||||
g_NetworkManager.m_bLastDisconnectWasLostRoomOnly = false;
|
||||
g_NetworkManager.m_bFullSessionMessageOnNextSessionChange = false;
|
||||
|
|
@ -1189,7 +1189,7 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc( void* lpParam )
|
|||
{
|
||||
Sleep(1);
|
||||
}
|
||||
|
||||
|
||||
// Restore the network player of all the server players that are local
|
||||
if( pServer != NULL )
|
||||
{
|
||||
|
|
@ -1202,7 +1202,7 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc( void* lpParam )
|
|||
PlayerList *players = pServer->getPlayers();
|
||||
for(AUTO_VAR(it, players->players.begin()); it < players->players.end(); ++it)
|
||||
{
|
||||
std::shared_ptr<ServerPlayer> servPlayer = *it;
|
||||
shared_ptr<ServerPlayer> servPlayer = *it;
|
||||
if( servPlayer->getXuid() == localPlayerXuid )
|
||||
{
|
||||
servPlayer->connection->connection->getSocket()->setPlayer( g_NetworkManager.GetLocalPlayerByUserIndex(index) );
|
||||
|
|
@ -1218,7 +1218,7 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc( void* lpParam )
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
pMinecraft->progressRenderer->progressStagePercentage(100);
|
||||
|
||||
#ifndef _XBOX
|
||||
|
|
@ -1240,7 +1240,7 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc( void* lpParam )
|
|||
#endif
|
||||
|
||||
// Start the game again
|
||||
app.SetGameStarted(true);
|
||||
app.SetGameStarted(true);
|
||||
app.SetXuiServerAction(ProfileManager.GetPrimaryPad(),eXuiServerAction_PauseServer,(void *)FALSE);
|
||||
app.SetChangingSessionType(false);
|
||||
app.SetReallyChangingSessionType(false);
|
||||
|
|
@ -1294,7 +1294,7 @@ void CGameNetworkManager::StateChange_AnyToJoining()
|
|||
app.DebugPrintf("Disabling Guest Signin\n");
|
||||
XEnableGuestSignin(FALSE);
|
||||
Minecraft::GetInstance()->clearPendingClientTextureRequests();
|
||||
|
||||
|
||||
ConnectionProgressParams *param = new ConnectionProgressParams();
|
||||
param->iPad = ProfileManager.GetPrimaryPad();
|
||||
param->stringId = -1;
|
||||
|
|
@ -1342,7 +1342,7 @@ void CGameNetworkManager::StateChange_AnyToStarting()
|
|||
completionData->type = e_ProgressCompletion_CloseAllPlayersUIScenes;
|
||||
completionData->iPad = ProfileManager.GetPrimaryPad();
|
||||
loadingParams->completionData = completionData;
|
||||
|
||||
|
||||
ui.NavigateToScene(ProfileManager.GetPrimaryPad(),eUIScene_FullscreenProgress, loadingParams);
|
||||
}
|
||||
}
|
||||
|
|
@ -1391,7 +1391,7 @@ void CGameNetworkManager::CreateSocket( INetworkPlayer *pNetworkPlayer, bool loc
|
|||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||
|
||||
Socket *socket = NULL;
|
||||
std::shared_ptr<MultiplayerLocalPlayer> mpPlayer = pMinecraft->localplayers[pNetworkPlayer->GetUserIndex()];
|
||||
shared_ptr<MultiplayerLocalPlayer> mpPlayer = pMinecraft->localplayers[pNetworkPlayer->GetUserIndex()];
|
||||
if( localPlayer && mpPlayer != NULL && mpPlayer->connection != NULL)
|
||||
{
|
||||
// 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 )
|
||||
{
|
||||
connection->send( std::shared_ptr<PreLoginPacket>( new PreLoginPacket( pNetworkPlayer->GetOnlineName() ) ) );
|
||||
connection->send( shared_ptr<PreLoginPacket>( new PreLoginPacket( pNetworkPlayer->GetOnlineName() ) ) );
|
||||
pMinecraft->addPendingLocalConnection(idx, connection);
|
||||
}
|
||||
else
|
||||
|
|
@ -1463,7 +1463,7 @@ void CGameNetworkManager::PlayerJoining( INetworkPlayer *pNetworkPlayer )
|
|||
bool multiplayer = g_NetworkManager.GetPlayerCount() > 1, localgame = g_NetworkManager.IsLocalGame();
|
||||
for (int iPad=0; iPad<XUSER_MAX_COUNT; ++iPad)
|
||||
{
|
||||
INetworkPlayer *pNetworkPlayer = g_NetworkManager.GetLocalPlayerByUserIndex(iPad);
|
||||
INetworkPlayer *pNetworkPlayer = g_NetworkManager.GetLocalPlayerByUserIndex(iPad);
|
||||
if (pNetworkPlayer == NULL) continue;
|
||||
|
||||
app.SetRichPresenceContext(iPad,CONTEXT_GAME_STATE_BLANK);
|
||||
|
|
@ -1488,7 +1488,7 @@ void CGameNetworkManager::PlayerJoining( INetworkPlayer *pNetworkPlayer )
|
|||
else
|
||||
{
|
||||
if( !pNetworkPlayer->IsHost() )
|
||||
{
|
||||
{
|
||||
for(int idx = 0; idx < XUSER_MAX_COUNT; ++idx)
|
||||
{
|
||||
if(Minecraft::GetInstance()->localplayers[idx] != NULL)
|
||||
|
|
@ -1544,7 +1544,7 @@ void CGameNetworkManager::GameInviteReceived( int userIndex, const INVITE_INFO *
|
|||
}
|
||||
|
||||
// Need to check we're signed in to PSN
|
||||
bool isSignedInLive = true;
|
||||
bool isSignedInLive = true;
|
||||
bool isLocalMultiplayerAvailable = app.IsLocalMultiplayerAvailable();
|
||||
int iPadNotSignedInLive = -1;
|
||||
for(unsigned int i = 0; i < XUSER_MAX_COUNT; i++)
|
||||
|
|
@ -1584,7 +1584,7 @@ void CGameNetworkManager::GameInviteReceived( int userIndex, const INVITE_INFO *
|
|||
ui.RequestMessageBox( IDS_ERROR_NETWORK_TITLE, IDS_ERROR_NETWORK, uiIDA, 1, iPadNotSignedInLive, NULL, NULL, app.GetStringTable());
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
// Not signed in to PSN
|
||||
UINT uiIDA[1];
|
||||
uiIDA[0] = IDS_PRO_NOTONLINE_ACCEPT;
|
||||
|
|
@ -1601,10 +1601,10 @@ void CGameNetworkManager::GameInviteReceived( int userIndex, const INVITE_INFO *
|
|||
{
|
||||
m_pInviteInfo = (INVITE_INFO *) pInviteInfo;
|
||||
m_iPlayerInvited = userIndex;
|
||||
|
||||
|
||||
m_pUpsell = new PsPlusUpsellWrapper(index);
|
||||
m_pUpsell->displayUpsell();
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -1612,7 +1612,7 @@ void CGameNetworkManager::GameInviteReceived( int userIndex, const INVITE_INFO *
|
|||
|
||||
#ifdef __PSVITA__
|
||||
// Need to check we're signed in to PSN
|
||||
bool isSignedInLive = ProfileManager.IsSignedInLive(ProfileManager.GetPrimaryPad());
|
||||
bool isSignedInLive = ProfileManager.IsSignedInLive(ProfileManager.GetPrimaryPad());
|
||||
if (!isSignedInLive)
|
||||
{
|
||||
// Determine why they're not "signed in live"
|
||||
|
|
@ -1625,7 +1625,7 @@ void CGameNetworkManager::GameInviteReceived( int userIndex, const INVITE_INFO *
|
|||
// ui.RequestMessageBox( IDS_ERROR_NETWORK_TITLE, IDS_ERROR_NETWORK, uiIDA, 1, ProfileManager.GetPrimaryPad(), NULL, NULL, app.GetStringTable());
|
||||
// }
|
||||
// else
|
||||
{
|
||||
{
|
||||
// Not signed in to PSN
|
||||
UINT uiIDA[1];
|
||||
uiIDA[0] = IDS_PRO_NOTONLINE_ACCEPT;
|
||||
|
|
@ -1648,9 +1648,9 @@ void CGameNetworkManager::GameInviteReceived( int userIndex, const INVITE_INFO *
|
|||
// 4J-PB we shouldn't bring any inactive players into the game, except for the invited player (who may be an inactive player)
|
||||
// 4J Stu - If we are not in a game, then bring in all players signed in
|
||||
if(index==userIndex || pMinecraft->localplayers[index]!=NULL )
|
||||
{
|
||||
{
|
||||
++joiningUsers;
|
||||
if( !ProfileManager.AllowedToPlayMultiplayer(index) ) noPrivileges = true;
|
||||
if( !ProfileManager.AllowedToPlayMultiplayer(index) ) noPrivileges = true;
|
||||
localUsersMask |= GetLocalPlayerMask( index );
|
||||
}
|
||||
}
|
||||
|
|
@ -1667,7 +1667,7 @@ void CGameNetworkManager::GameInviteReceived( int userIndex, const INVITE_INFO *
|
|||
ProfileManager.AllowedPlayerCreatedContent(ProfileManager.GetPrimaryPad(),false,&pccAllowed,&pccFriendsAllowed);
|
||||
if(!pccAllowed && !pccFriendsAllowed) noUGC = true;
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(_XBOX) || defined(__PS3__)
|
||||
if(joiningUsers > 1 && !RenderManager.IsHiDef() && userIndex != ProfileManager.GetPrimaryPad())
|
||||
{
|
||||
|
|
@ -1716,9 +1716,9 @@ void CGameNetworkManager::GameInviteReceived( int userIndex, const INVITE_INFO *
|
|||
}
|
||||
#endif
|
||||
if( !g_NetworkManager.IsInSession() )
|
||||
{
|
||||
{
|
||||
#ifndef __PS3__
|
||||
HandleInviteWhenInMenus(userIndex, pInviteInfo);
|
||||
HandleInviteWhenInMenus(userIndex, pInviteInfo);
|
||||
#else
|
||||
// PS3 is more complicated here - we need to make sure that the player is online. If they are then we can do the same as the xbox, if not we need to try and get them online and then, if they do sign in, go down the same path
|
||||
if(ProfileManager.IsSignedInLive(ProfileManager.GetPrimaryPad()))
|
||||
|
|
@ -1771,7 +1771,7 @@ void CGameNetworkManager::HandleInviteWhenInMenus( int userIndex, const INVITE_I
|
|||
if(!ProfileManager.IsFullVersion())
|
||||
{
|
||||
// The marketplace will fail with the primary player set to -1
|
||||
ProfileManager.SetPrimaryPad(userIndex);
|
||||
ProfileManager.SetPrimaryPad(userIndex);
|
||||
|
||||
app.SetAction(userIndex,eAppAction_DashboardTrialJoinFromInvite);
|
||||
}
|
||||
|
|
@ -1809,7 +1809,7 @@ void CGameNetworkManager::HandleInviteWhenInMenus( int userIndex, const INVITE_I
|
|||
ProfileManager.QuerySigninStatus();
|
||||
|
||||
// 4J-PB - clear any previous connection errors
|
||||
Minecraft::GetInstance()->clearConnectionFailed();
|
||||
Minecraft::GetInstance()->clearConnectionFailed();
|
||||
|
||||
g_NetworkManager.SetLocalGame(false);
|
||||
|
||||
|
|
@ -1819,7 +1819,7 @@ void CGameNetworkManager::HandleInviteWhenInMenus( int userIndex, const INVITE_I
|
|||
bool success = g_NetworkManager.JoinGameFromInviteInfo( userIndex, localUsersMask, pInviteInfo );
|
||||
if( !success )
|
||||
{
|
||||
app.DebugPrintf( "Failed joining game from invite\n" );
|
||||
app.DebugPrintf( "Failed joining game from invite\n" );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -99,11 +99,11 @@ public:
|
|||
void SetSessionsUpdatedCallback( void (*SessionsUpdatedCallback)(LPVOID pParam), LPVOID pSearchParam );
|
||||
void GetFullFriendSessionInfo( FriendSessionInfo *foundSession, void (* FriendSessionUpdatedFn)(bool success, void *pParam), void *pParam );
|
||||
void ForceFriendsSessionRefresh();
|
||||
|
||||
|
||||
// Session joining and leaving
|
||||
|
||||
bool JoinGameFromInviteInfo( int userIndex, int userMask, const INVITE_INFO *pInviteInfo);
|
||||
eJoinGameResult JoinGame(FriendSessionInfo *searchResult, int localUsersMask);
|
||||
eJoinGameResult JoinGame(FriendSessionInfo *searchResult, int localUsersMask);
|
||||
static void CancelJoinGame(LPVOID lpParam); // Not part of the shared interface
|
||||
bool LeaveGame(bool bMigrateHost);
|
||||
static int JoinFromInvite_SignInReturned(void *pParam,bool bContinue, int iPad);
|
||||
|
|
@ -112,13 +112,13 @@ public:
|
|||
void ResetLeavingGame();
|
||||
|
||||
// Threads
|
||||
|
||||
|
||||
bool IsNetworkThreadRunning();
|
||||
static int RunNetworkGameThreadProc( void* lpParameter );
|
||||
static int ServerThreadProc( void* lpParameter );
|
||||
static int ExitAndJoinFromInviteThreadProc( void* lpParam );
|
||||
|
||||
#if (defined __PS3__) || (defined __ORBIS__) || (defined __PSVITA__)
|
||||
#if (defined __PS3__) || (defined __ORBIS__) || (defined __PSVITA__)
|
||||
static int MustSignInReturned_0(void *pParam,int iPad,C4JStorage::EMessageResult result);
|
||||
static int PSNSignInReturned_0(void* pParam, bool bContinue, int iPad);
|
||||
|
||||
|
|
@ -129,7 +129,7 @@ public:
|
|||
static void _LeaveGame();
|
||||
static int ChangeSessionTypeThreadProc( void* lpParam );
|
||||
|
||||
// System flags
|
||||
// System flags
|
||||
|
||||
void SystemFlagSet(INetworkPlayer *pNetworkPlayer, int index);
|
||||
bool SystemFlagGet(INetworkPlayer *pNetworkPlayer, int index);
|
||||
|
|
@ -144,8 +144,8 @@ public:
|
|||
|
||||
void ServerStoppedCreate(bool create); // Create the signal
|
||||
void ServerStopped(); // Signal that we are ready
|
||||
void ServerStoppedWait(); // Wait for the signal
|
||||
void ServerStoppedDestroy(); // Destroy signal
|
||||
void ServerStoppedWait(); // Wait for the signal
|
||||
void ServerStoppedDestroy(); // Destroy signal
|
||||
bool ServerStoppedValid(); // Is non-NULL
|
||||
|
||||
#ifdef __PSVITA__
|
||||
|
|
@ -163,9 +163,9 @@ public:
|
|||
|
||||
// Used for debugging output
|
||||
static const int messageQueue_length = 512;
|
||||
static int64_t messageQueue[messageQueue_length];
|
||||
static __int64 messageQueue[messageQueue_length];
|
||||
static const int byteQueue_length = 512;
|
||||
static int64_t byteQueue[byteQueue_length];
|
||||
static __int64 byteQueue[byteQueue_length];
|
||||
static int messageQueuePos;
|
||||
|
||||
// Methods called from PlatformNetworkManager
|
||||
|
|
|
|||
|
|
@ -25,11 +25,11 @@ static SceRemoteStorageStatus statParams;
|
|||
// {
|
||||
// app.DebugPrintf("remoteStorageGetCallback err : 0x%08x\n");
|
||||
// }
|
||||
//
|
||||
//
|
||||
// void remoteStorageCallback(LPVOID lpParam, SonyRemoteStorage::Status s, int error_code)
|
||||
// {
|
||||
// app.DebugPrintf("remoteStorageCallback err : 0x%08x\n");
|
||||
//
|
||||
//
|
||||
// app.getRemoteStorage()->getRemoteFileInfo(&statParams, remoteStorageGetInfoCallback, NULL);
|
||||
// }
|
||||
|
||||
|
|
@ -161,17 +161,17 @@ ESavePlatform SonyRemoteStorage::getSavePlatform()
|
|||
|
||||
}
|
||||
|
||||
int64_t SonyRemoteStorage::getSaveSeed()
|
||||
__int64 SonyRemoteStorage::getSaveSeed()
|
||||
{
|
||||
if(m_getInfoStatus != e_infoFound)
|
||||
return 0;
|
||||
DescriptionData* pDescData = (DescriptionData*)m_remoteFileInfo->fileDescription;
|
||||
|
||||
char seedString[17];
|
||||
ZeroMemory(seedString,17);
|
||||
ZeroMemory(seedString,17);
|
||||
memcpy(seedString, pDescData->m_seed,16);
|
||||
|
||||
uint64_t seed = 0;
|
||||
__uint64 seed = 0;
|
||||
std::stringstream ss;
|
||||
ss << seedString;
|
||||
ss >> std::hex >> seed;
|
||||
|
|
@ -185,7 +185,7 @@ unsigned int SonyRemoteStorage::getSaveHostOptions()
|
|||
DescriptionData* pDescData = (DescriptionData*)m_remoteFileInfo->fileDescription;
|
||||
|
||||
char optionsString[9];
|
||||
ZeroMemory(optionsString,9);
|
||||
ZeroMemory(optionsString,9);
|
||||
memcpy(optionsString, pDescData->m_hostOptions,8);
|
||||
|
||||
unsigned int uiHostOptions = 0;
|
||||
|
|
@ -202,7 +202,7 @@ unsigned int SonyRemoteStorage::getSaveTexturePack()
|
|||
DescriptionData* pDescData = (DescriptionData*)m_remoteFileInfo->fileDescription;
|
||||
|
||||
char textureString[9];
|
||||
ZeroMemory(textureString,9);
|
||||
ZeroMemory(textureString,9);
|
||||
memcpy(textureString, pDescData->m_texturePack,8);
|
||||
|
||||
unsigned int uiTexturePack = 0;
|
||||
|
|
@ -219,9 +219,9 @@ const char* SonyRemoteStorage::getRemoteSaveFilename()
|
|||
|
||||
int SonyRemoteStorage::getSaveFilesize()
|
||||
{
|
||||
if(m_getInfoStatus == e_infoFound)
|
||||
if(m_getInfoStatus == e_infoFound)
|
||||
{
|
||||
return m_remoteFileInfo->fileSize;
|
||||
return m_remoteFileInfo->fileSize;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -284,9 +284,9 @@ bool SonyRemoteStorage::saveIsAvailable()
|
|||
if(m_getInfoStatus != e_infoFound)
|
||||
return false;
|
||||
#ifdef __PS3__
|
||||
return (getSavePlatform() == SAVE_FILE_PLATFORM_PSVITA);
|
||||
return (getSavePlatform() == SAVE_FILE_PLATFORM_PSVITA);
|
||||
#elif defined __PSVITA__
|
||||
return (getSavePlatform() == SAVE_FILE_PLATFORM_PS3);
|
||||
return (getSavePlatform() == SAVE_FILE_PLATFORM_PS3);
|
||||
#else // __ORBIS__
|
||||
return true;
|
||||
#endif
|
||||
|
|
@ -294,7 +294,7 @@ bool SonyRemoteStorage::saveIsAvailable()
|
|||
|
||||
int SonyRemoteStorage::getDataProgress()
|
||||
{
|
||||
int64_t time = System::currentTimeMillis();
|
||||
__int64 time = System::currentTimeMillis();
|
||||
int elapsedSecs = (time - m_startTime) / 1000;
|
||||
int progVal = m_dataProgress + (elapsedSecs/3);
|
||||
if(progVal > 95)
|
||||
|
|
@ -310,15 +310,15 @@ bool SonyRemoteStorage::shutdown()
|
|||
if(m_bInitialised)
|
||||
{
|
||||
int ret = sceRemoteStorageTerm();
|
||||
if(ret >= 0)
|
||||
if(ret >= 0)
|
||||
{
|
||||
app.DebugPrintf("Term request done \n");
|
||||
m_bInitialised = false;
|
||||
free(m_memPoolBuffer);
|
||||
m_memPoolBuffer = NULL;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
app.DebugPrintf("Error in Term request: 0x%x \n", ret);
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#pragma once
|
||||
#pragma once
|
||||
|
||||
|
||||
#include "..\..\Common\Network\Sony\sceRemoteStorage\header\sceRemoteStorage.h"
|
||||
|
|
@ -42,7 +42,7 @@ public:
|
|||
SceRemoteStorageData* m_remoteFileInfo;
|
||||
|
||||
class DescriptionData
|
||||
{
|
||||
{
|
||||
// this stuff is read from a JSON query, so it all has to be text based, max 256 bytes
|
||||
public:
|
||||
char m_platform[4];
|
||||
|
|
@ -72,7 +72,7 @@ public:
|
|||
const char* getLocalFilename();
|
||||
const char* getSaveNameUTF8();
|
||||
ESavePlatform getSavePlatform();
|
||||
int64_t getSaveSeed();
|
||||
__int64 getSaveSeed();
|
||||
unsigned int getSaveHostOptions();
|
||||
unsigned int getSaveTexturePack();
|
||||
|
||||
|
|
@ -97,7 +97,7 @@ public:
|
|||
static int LoadSaveDataThumbnailReturned(LPVOID lpParam,PBYTE pbThumbnail,DWORD dwThumbnailBytes);
|
||||
static int setDataThread(void* lpParam);
|
||||
|
||||
SonyRemoteStorage() : m_memPoolBuffer(NULL), m_bInitialised(false),m_getInfoStatus(e_noInfoFound) {}
|
||||
SonyRemoteStorage() : m_memPoolBuffer(NULL), m_bInitialised(false),m_getInfoStatus(e_noInfoFound) {}
|
||||
|
||||
protected:
|
||||
const char* getRemoteSaveFilename();
|
||||
|
|
@ -111,7 +111,7 @@ protected:
|
|||
unsigned int m_thumbnailDataSize;
|
||||
C4JThread* m_SetDataThread;
|
||||
PSAVE_INFO m_setDataSaveInfo;
|
||||
int64_t m_startTime;
|
||||
__int64 m_startTime;
|
||||
|
||||
bool m_bAborting;
|
||||
bool m_bTransferStarted;
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ ChangeStateConstraint::ChangeStateConstraint( Tutorial *tutorial, eTutorial_Stat
|
|||
m_tutorial = tutorial;
|
||||
m_targetState = targetState;
|
||||
m_sourceStatesCount = sourceStatesCount;
|
||||
|
||||
|
||||
m_bHasChanged = false;
|
||||
m_changedFromState = e_Tutorial_State_None;
|
||||
|
||||
|
|
@ -59,11 +59,11 @@ void ChangeStateConstraint::tick(int iPad)
|
|||
if(originalPrivileges != playerPrivs)
|
||||
{
|
||||
// Send update settings packet to server
|
||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||
std::shared_ptr<MultiplayerLocalPlayer> player = minecraft->localplayers[iPad];
|
||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||
shared_ptr<MultiplayerLocalPlayer> player = minecraft->localplayers[iPad];
|
||||
if(player != NULL && player->connection && player->connection->getNetworkPlayer() != NULL)
|
||||
{
|
||||
player->connection->send( std::shared_ptr<PlayerInfoPacket>( new PlayerInfoPacket( player->connection->getNetworkPlayer()->GetSmallId(), -1, playerPrivs) ) );
|
||||
player->connection->send( shared_ptr<PlayerInfoPacket>( new PlayerInfoPacket( player->connection->getNetworkPlayer()->GetSmallId(), -1, playerPrivs) ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -100,11 +100,11 @@ void ChangeStateConstraint::tick(int iPad)
|
|||
if(originalPrivileges != playerPrivs)
|
||||
{
|
||||
// Send update settings packet to server
|
||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||
std::shared_ptr<MultiplayerLocalPlayer> player = minecraft->localplayers[iPad];
|
||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||
shared_ptr<MultiplayerLocalPlayer> player = minecraft->localplayers[iPad];
|
||||
if(player != NULL && player->connection && player->connection->getNetworkPlayer() != NULL)
|
||||
{
|
||||
player->connection->send( std::shared_ptr<PlayerInfoPacket>( new PlayerInfoPacket( player->connection->getNetworkPlayer()->GetSmallId(), -1, playerPrivs) ) );
|
||||
player->connection->send( shared_ptr<PlayerInfoPacket>( new PlayerInfoPacket( player->connection->getNetworkPlayer()->GetSmallId(), -1, playerPrivs) ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -124,11 +124,11 @@ void ChangeStateConstraint::tick(int iPad)
|
|||
if(originalPrivileges != playerPrivs)
|
||||
{
|
||||
// Send update settings packet to server
|
||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||
std::shared_ptr<MultiplayerLocalPlayer> player = minecraft->localplayers[iPad];
|
||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||
shared_ptr<MultiplayerLocalPlayer> player = minecraft->localplayers[iPad];
|
||||
if(player != NULL && player->connection && player->connection->getNetworkPlayer() != NULL)
|
||||
{
|
||||
player->connection->send( std::shared_ptr<PlayerInfoPacket>( new PlayerInfoPacket( player->connection->getNetworkPlayer()->GetSmallId(), -1, playerPrivs) ) );
|
||||
player->connection->send( shared_ptr<PlayerInfoPacket>( new PlayerInfoPacket( player->connection->getNetworkPlayer()->GetSmallId(), -1, playerPrivs) ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
CompleteUsingItemTask::CompleteUsingItemTask(Tutorial *tutorial, int descriptionId, int itemIds[], unsigned int itemIdsLength, bool enablePreCompletion)
|
||||
: TutorialTask( tutorial, descriptionId, enablePreCompletion, NULL)
|
||||
{
|
||||
{
|
||||
m_iValidItemsA= new int [itemIdsLength];
|
||||
for(int i=0;i<itemIdsLength;i++)
|
||||
{
|
||||
|
|
@ -23,7 +23,7 @@ bool CompleteUsingItemTask::isCompleted()
|
|||
return bIsCompleted;
|
||||
}
|
||||
|
||||
void CompleteUsingItemTask::completeUsingItem(std::shared_ptr<ItemInstance> item)
|
||||
void CompleteUsingItemTask::completeUsingItem(shared_ptr<ItemInstance> item)
|
||||
{
|
||||
if(!hasBeenActivated() && !isPreCompletionEnabled()) return;
|
||||
for(int i=0;i<m_iValidItemsCount;i++)
|
||||
|
|
|
|||
|
|
@ -16,5 +16,5 @@ public:
|
|||
CompleteUsingItemTask(Tutorial *tutorial, int descriptionId, int itemIds[], unsigned int itemIdsLength, bool enablePreCompletion = false);
|
||||
virtual ~CompleteUsingItemTask();
|
||||
virtual bool isCompleted();
|
||||
virtual void completeUsingItem(std::shared_ptr<ItemInstance> item);
|
||||
virtual void completeUsingItem(shared_ptr<ItemInstance> item);
|
||||
};
|
||||
|
|
@ -40,7 +40,7 @@ CraftTask::~CraftTask()
|
|||
delete[] m_auxValues;
|
||||
}
|
||||
|
||||
void CraftTask::onCrafted(std::shared_ptr<ItemInstance> item)
|
||||
void CraftTask::onCrafted(shared_ptr<ItemInstance> item)
|
||||
{
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
wprintf(L"CraftTask::onCrafted - %ls\n", item->toString().c_str() );
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ public:
|
|||
~CraftTask();
|
||||
|
||||
virtual bool isCompleted() { return bIsCompleted; }
|
||||
virtual void onCrafted(std::shared_ptr<ItemInstance> item);
|
||||
virtual void onCrafted(shared_ptr<ItemInstance> item);
|
||||
|
||||
private:
|
||||
int *m_items;
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ DiggerItemHint::DiggerItemHint(eTutorial_Hint id, Tutorial *tutorial, int descri
|
|||
tutorial->addMessage(IDS_TUTORIAL_HINT_ATTACK_WITH_TOOL, true);
|
||||
}
|
||||
|
||||
int DiggerItemHint::startDestroyBlock(std::shared_ptr<ItemInstance> item, Tile *tile)
|
||||
int DiggerItemHint::startDestroyBlock(shared_ptr<ItemInstance> item, Tile *tile)
|
||||
{
|
||||
if(item != NULL)
|
||||
{
|
||||
|
|
@ -46,7 +46,7 @@ int DiggerItemHint::startDestroyBlock(std::shared_ptr<ItemInstance> item, Tile *
|
|||
return -1;
|
||||
}
|
||||
|
||||
int DiggerItemHint::attack(std::shared_ptr<ItemInstance> item, std::shared_ptr<Entity> entity)
|
||||
int DiggerItemHint::attack(shared_ptr<ItemInstance> item, shared_ptr<Entity> entity)
|
||||
{
|
||||
if(item != NULL)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -13,6 +13,6 @@ private:
|
|||
|
||||
public:
|
||||
DiggerItemHint(eTutorial_Hint id, Tutorial *tutorial, int descriptionId, int items[], unsigned int itemsLength);
|
||||
virtual int startDestroyBlock(std::shared_ptr<ItemInstance> item, Tile *tile);
|
||||
virtual int attack(std::shared_ptr<ItemInstance> item, std::shared_ptr<Entity> entity);
|
||||
virtual int startDestroyBlock(shared_ptr<ItemInstance> item, Tile *tile);
|
||||
virtual int attack(shared_ptr<ItemInstance> item, shared_ptr<Entity> entity);
|
||||
};
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
#include "stdafx.h"
|
||||
#include "PickupTask.h"
|
||||
|
||||
void PickupTask::onTake(std::shared_ptr<ItemInstance> item, unsigned int invItemCountAnyAux, unsigned int invItemCountThisAux)
|
||||
void PickupTask::onTake(shared_ptr<ItemInstance> item, unsigned int invItemCountAnyAux, unsigned int invItemCountThisAux)
|
||||
{
|
||||
if(item->id == m_itemId)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ public:
|
|||
{}
|
||||
|
||||
virtual bool isCompleted() { return bIsCompleted; }
|
||||
virtual void onTake(std::shared_ptr<ItemInstance> item, unsigned int invItemCountAnyAux, unsigned int invItemCountThisAux);
|
||||
virtual void onTake(shared_ptr<ItemInstance> item, unsigned int invItemCountAnyAux, unsigned int invItemCountThisAux);
|
||||
|
||||
private:
|
||||
int m_itemId;
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ bool ProcedureCompoundTask::isCompleted()
|
|||
return allCompleted;
|
||||
}
|
||||
|
||||
void ProcedureCompoundTask::onCrafted(std::shared_ptr<ItemInstance> item)
|
||||
void ProcedureCompoundTask::onCrafted(shared_ptr<ItemInstance> item)
|
||||
{
|
||||
AUTO_VAR(itEnd, m_taskSequence.end());
|
||||
for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it)
|
||||
|
|
@ -222,7 +222,7 @@ bool ProcedureCompoundTask::AllowFade()
|
|||
return allowFade;
|
||||
}
|
||||
|
||||
void ProcedureCompoundTask::useItemOn(Level *level, std::shared_ptr<ItemInstance> item, int x, int y, int z,bool bTestUseOnly)
|
||||
void ProcedureCompoundTask::useItemOn(Level *level, shared_ptr<ItemInstance> item, int x, int y, int z,bool bTestUseOnly)
|
||||
{
|
||||
AUTO_VAR(itEnd, m_taskSequence.end());
|
||||
for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it)
|
||||
|
|
@ -232,7 +232,7 @@ void ProcedureCompoundTask::useItemOn(Level *level, std::shared_ptr<ItemInstance
|
|||
}
|
||||
}
|
||||
|
||||
void ProcedureCompoundTask::useItem(std::shared_ptr<ItemInstance> item, bool bTestUseOnly)
|
||||
void ProcedureCompoundTask::useItem(shared_ptr<ItemInstance> item, bool bTestUseOnly)
|
||||
{
|
||||
AUTO_VAR(itEnd, m_taskSequence.end());
|
||||
for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it)
|
||||
|
|
@ -242,7 +242,7 @@ void ProcedureCompoundTask::useItem(std::shared_ptr<ItemInstance> item, bool bTe
|
|||
}
|
||||
}
|
||||
|
||||
void ProcedureCompoundTask::onTake(std::shared_ptr<ItemInstance> item, unsigned int invItemCountAnyAux, unsigned int invItemCountThisAux)
|
||||
void ProcedureCompoundTask::onTake(shared_ptr<ItemInstance> item, unsigned int invItemCountAnyAux, unsigned int invItemCountThisAux)
|
||||
{
|
||||
AUTO_VAR(itEnd, m_taskSequence.end());
|
||||
for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it)
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ public:
|
|||
virtual int getDescriptionId();
|
||||
virtual int getPromptId();
|
||||
virtual bool isCompleted();
|
||||
virtual void onCrafted(std::shared_ptr<ItemInstance> item);
|
||||
virtual void onCrafted(shared_ptr<ItemInstance> item);
|
||||
virtual void handleUIInput(int iAction);
|
||||
virtual void setAsCurrentTask(bool active = true);
|
||||
virtual bool ShowMinimumTime();
|
||||
|
|
@ -26,9 +26,9 @@ public:
|
|||
virtual void setShownForMinimumTime();
|
||||
virtual bool AllowFade();
|
||||
|
||||
virtual void useItemOn(Level *level, std::shared_ptr<ItemInstance> item, int x, int y, int z, bool bTestUseOnly=false);
|
||||
virtual void useItem(std::shared_ptr<ItemInstance> item, bool bTestUseOnly=false);
|
||||
virtual void onTake(std::shared_ptr<ItemInstance> item, unsigned int invItemCountAnyAux, unsigned int invItemCountThisAux);
|
||||
virtual void useItemOn(Level *level, 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 onTake(shared_ptr<ItemInstance> item, unsigned int invItemCountAnyAux, unsigned int invItemCountThisAux);
|
||||
virtual void onStateChange(eTutorial_State newState);
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ TakeItemHint::TakeItemHint(eTutorial_Hint id, Tutorial *tutorial, int items[], u
|
|||
}
|
||||
}
|
||||
|
||||
bool TakeItemHint::onTake(std::shared_ptr<ItemInstance> item)
|
||||
bool TakeItemHint::onTake(shared_ptr<ItemInstance> item)
|
||||
{
|
||||
if(item != NULL)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -15,5 +15,5 @@ public:
|
|||
TakeItemHint(eTutorial_Hint id, Tutorial *tutorial, int items[], unsigned int itemsLength);
|
||||
~TakeItemHint();
|
||||
|
||||
virtual bool onTake( std::shared_ptr<ItemInstance> item );
|
||||
virtual bool onTake( shared_ptr<ItemInstance> item );
|
||||
};
|
||||
|
|
@ -41,7 +41,7 @@ bool Tutorial::PopupMessageDetails::isSameContent(PopupMessageDetails *other)
|
|||
|
||||
void Tutorial::staticCtor()
|
||||
{
|
||||
//
|
||||
//
|
||||
/*
|
||||
*****
|
||||
*****
|
||||
|
|
@ -72,7 +72,7 @@ void Tutorial::staticCtor()
|
|||
s_completableTasks.push_back( e_Tutorial_State_Enchanting );
|
||||
|
||||
s_completableTasks.push_back( e_Tutorial_Hint_Hold_To_Mine );
|
||||
s_completableTasks.push_back( e_Tutorial_Hint_Tool_Damaged );
|
||||
s_completableTasks.push_back( e_Tutorial_Hint_Tool_Damaged );
|
||||
s_completableTasks.push_back( e_Tutorial_Hint_Swim_Up );
|
||||
|
||||
s_completableTasks.push_back( e_Tutorial_Hint_Unused_2 );
|
||||
|
|
@ -164,7 +164,7 @@ void Tutorial::staticCtor()
|
|||
s_completableTasks.push_back( e_Tutorial_Hint_Thin_Glass );
|
||||
s_completableTasks.push_back( e_Tutorial_Hint_Melon );
|
||||
s_completableTasks.push_back( e_Tutorial_Hint_Vine );
|
||||
s_completableTasks.push_back( e_Tutorial_Hint_Fence_Gate );
|
||||
s_completableTasks.push_back( e_Tutorial_Hint_Fence_Gate );
|
||||
s_completableTasks.push_back( e_Tutorial_Hint_Mycel );
|
||||
s_completableTasks.push_back( e_Tutorial_Hint_Water_Lily );
|
||||
s_completableTasks.push_back( e_Tutorial_Hint_Nether_Brick );
|
||||
|
|
@ -448,7 +448,7 @@ Tutorial::Tutorial(int iPad, bool isFullTutorial /*= false*/) : m_iPad( iPad )
|
|||
if(!isHintCompleted(e_Tutorial_Hint_Detector_Rail)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Detector_Rail, this, detectorRailItems, 1 ) );
|
||||
|
||||
int tallGrassItems[] = {Tile::tallgrass_Id};
|
||||
if(!isHintCompleted(e_Tutorial_Hint_Tall_Grass))
|
||||
if(!isHintCompleted(e_Tutorial_Hint_Tall_Grass))
|
||||
{
|
||||
addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Tall_Grass, this, tallGrassItems, 1, -1, TallGrass::DEAD_SHRUB ) );
|
||||
addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Tall_Grass, this, tallGrassItems, 1, -1, TallGrass::TALL_GRASS ) );
|
||||
|
|
@ -731,7 +731,7 @@ Tutorial::Tutorial(int iPad, bool isFullTutorial /*= false*/) : m_iPad( iPad )
|
|||
|
||||
int potatoItems[] = {Tile::potatoes_Id};
|
||||
if(!isHintCompleted(e_Tutorial_Hint_Potato)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Potato, this, potatoItems, 1, -1, -1, 7 ) );
|
||||
|
||||
|
||||
int carrotItems[] = {Tile::carrots_Id};
|
||||
if(!isHintCompleted(e_Tutorial_Hint_Carrot)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Carrot, this, carrotItems, 1, -1, -1, 7 ) );
|
||||
|
||||
|
|
@ -1208,7 +1208,7 @@ void Tutorial::tick()
|
|||
}
|
||||
else if(m_freezeTime && m_timeFrozen && m_fullTutorialComplete)
|
||||
{
|
||||
int64_t currentTime = pMinecraft->level->getTime();
|
||||
__int64 currentTime = pMinecraft->level->getTime();
|
||||
int currentDayTime = (currentTime % Level::TICKS_PER_DAY);
|
||||
int timeToAdd = 0;
|
||||
if(currentDayTime > m_iTutorialFreezeTimeValue)
|
||||
|
|
@ -1219,7 +1219,7 @@ void Tutorial::tick()
|
|||
{
|
||||
timeToAdd = m_iTutorialFreezeTimeValue - currentDayTime;
|
||||
}
|
||||
int64_t targetTime = currentTime + timeToAdd;
|
||||
__int64 targetTime = currentTime + timeToAdd;
|
||||
MinecraftServer::SetTimeOfDay(-1);
|
||||
MinecraftServer::SetTime(targetTime);
|
||||
pMinecraft->level->setOverrideTimeOfDay(-1);
|
||||
|
|
@ -1228,7 +1228,7 @@ void Tutorial::tick()
|
|||
}
|
||||
|
||||
if(!m_allowShow)
|
||||
{
|
||||
{
|
||||
if( currentTask[m_CurrentState] != NULL && (!currentTask[m_CurrentState]->AllowFade() || (lastMessageTime + m_iTutorialDisplayMessageTime ) > GetTickCount() ) )
|
||||
{
|
||||
uiTempDisabled = true;
|
||||
|
|
@ -1264,7 +1264,7 @@ void Tutorial::tick()
|
|||
app.TutorialSceneNavigateBack(m_iPad);
|
||||
m_bSceneIsSplitscreen=app.GetLocalPlayerCount()>1;
|
||||
if(m_bSceneIsSplitscreen)
|
||||
{
|
||||
{
|
||||
app.NavigateToScene(m_iPad, eUIComponent_TutorialPopup,(void *)this, false, false, &m_hTutorialScene);
|
||||
}
|
||||
else
|
||||
|
|
@ -1359,7 +1359,7 @@ void Tutorial::tick()
|
|||
{
|
||||
isCurrentTask = false;
|
||||
if(
|
||||
( !task->ShowMinimumTime() || ( task->hasBeenActivated() && (lastMessageTime + m_iTutorialMinimumDisplayMessageTime ) < GetTickCount() ) )
|
||||
( !task->ShowMinimumTime() || ( task->hasBeenActivated() && (lastMessageTime + m_iTutorialMinimumDisplayMessageTime ) < GetTickCount() ) )
|
||||
&& task->isCompleted()
|
||||
)
|
||||
{
|
||||
|
|
@ -1503,7 +1503,7 @@ void Tutorial::tick()
|
|||
message->m_promptId = currentTask[m_CurrentState]->getPromptId();
|
||||
message->m_allowFade = currentTask[m_CurrentState]->AllowFade();
|
||||
setMessage( message );
|
||||
currentTask[m_CurrentState]->TaskReminders()? m_iTaskReminders = 1 : m_iTaskReminders = 0;
|
||||
currentTask[m_CurrentState]->TaskReminders()? m_iTaskReminders = 1 : m_iTaskReminders = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -1636,7 +1636,7 @@ bool Tutorial::setMessage(TutorialHint *hint, PopupMessageDetails *message)
|
|||
bool messageShown = false;
|
||||
DWORD time = GetTickCount();
|
||||
if(message != NULL && (message->m_forceDisplay || hintsOn) &&
|
||||
(!message->m_delay ||
|
||||
(!message->m_delay ||
|
||||
(
|
||||
(m_hintDisplayed && (time - m_lastHintDisplayedTime) > m_iTutorialHintDelayTime ) ||
|
||||
(!m_hintDisplayed && (time - lastMessageTime) > m_iTutorialMinimumDisplayMessageTime )
|
||||
|
|
@ -1648,7 +1648,7 @@ bool Tutorial::setMessage(TutorialHint *hint, PopupMessageDetails *message)
|
|||
|
||||
if(messageShown)
|
||||
{
|
||||
m_lastHintDisplayedTime = time;
|
||||
m_lastHintDisplayedTime = time;
|
||||
m_hintDisplayed = true;
|
||||
if(hint!=NULL) setHintCompleted( hint );
|
||||
}
|
||||
|
|
@ -1672,7 +1672,7 @@ void Tutorial::showTutorialPopup(bool show)
|
|||
m_allowShow = show;
|
||||
|
||||
if(!show)
|
||||
{
|
||||
{
|
||||
if( currentTask[m_CurrentState] != NULL && (!currentTask[m_CurrentState]->AllowFade() || (lastMessageTime + m_iTutorialDisplayMessageTime ) > GetTickCount() ) )
|
||||
{
|
||||
uiTempDisabled = true;
|
||||
|
|
@ -1681,7 +1681,7 @@ void Tutorial::showTutorialPopup(bool show)
|
|||
}
|
||||
}
|
||||
|
||||
void Tutorial::useItemOn(Level *level, std::shared_ptr<ItemInstance> item, int x, int y, int z, bool bTestUseOnly)
|
||||
void Tutorial::useItemOn(Level *level, shared_ptr<ItemInstance> item, int x, int y, int z, bool bTestUseOnly)
|
||||
{
|
||||
for(AUTO_VAR(it, activeTasks[m_CurrentState].begin()); it < activeTasks[m_CurrentState].end(); ++it)
|
||||
{
|
||||
|
|
@ -1690,7 +1690,7 @@ void Tutorial::useItemOn(Level *level, std::shared_ptr<ItemInstance> item, int x
|
|||
}
|
||||
}
|
||||
|
||||
void Tutorial::useItemOn(std::shared_ptr<ItemInstance> item, bool bTestUseOnly)
|
||||
void Tutorial::useItemOn(shared_ptr<ItemInstance> item, bool bTestUseOnly)
|
||||
{
|
||||
for(AUTO_VAR(it, activeTasks[m_CurrentState].begin()); it < activeTasks[m_CurrentState].end(); ++it)
|
||||
{
|
||||
|
|
@ -1699,7 +1699,7 @@ void Tutorial::useItemOn(std::shared_ptr<ItemInstance> item, bool bTestUseOnly)
|
|||
}
|
||||
}
|
||||
|
||||
void Tutorial::completeUsingItem(std::shared_ptr<ItemInstance> item)
|
||||
void Tutorial::completeUsingItem(shared_ptr<ItemInstance> item)
|
||||
{
|
||||
for(AUTO_VAR(it, activeTasks[m_CurrentState].begin()); it < activeTasks[m_CurrentState].end(); ++it)
|
||||
{
|
||||
|
|
@ -1718,7 +1718,7 @@ void Tutorial::completeUsingItem(std::shared_ptr<ItemInstance> item)
|
|||
}
|
||||
}
|
||||
|
||||
void Tutorial::startDestroyBlock(std::shared_ptr<ItemInstance> item, Tile *tile)
|
||||
void Tutorial::startDestroyBlock(shared_ptr<ItemInstance> item, Tile *tile)
|
||||
{
|
||||
int hintNeeded = -1;
|
||||
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(std::shared_ptr<Player> player, std::shared_ptr<Entity> entity)
|
||||
void Tutorial::attack(shared_ptr<Player> player, shared_ptr<Entity> entity)
|
||||
{
|
||||
int hintNeeded = -1;
|
||||
for(AUTO_VAR(it, hints[m_CurrentState].begin()); it < hints[m_CurrentState].end(); ++it)
|
||||
|
|
@ -1772,7 +1772,7 @@ void Tutorial::attack(std::shared_ptr<Player> player, std::shared_ptr<Entity> en
|
|||
}
|
||||
}
|
||||
|
||||
void Tutorial::itemDamaged(std::shared_ptr<ItemInstance> item)
|
||||
void Tutorial::itemDamaged(shared_ptr<ItemInstance> item)
|
||||
{
|
||||
int hintNeeded = -1;
|
||||
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);
|
||||
}
|
||||
|
||||
void Tutorial::createItemSelected(std::shared_ptr<ItemInstance> item, bool canMake)
|
||||
void Tutorial::createItemSelected(shared_ptr<ItemInstance> item, bool canMake)
|
||||
{
|
||||
int hintNeeded = -1;
|
||||
for(AUTO_VAR(it, hints[m_CurrentState].begin()); it < hints[m_CurrentState].end(); ++it)
|
||||
|
|
@ -1821,7 +1821,7 @@ void Tutorial::createItemSelected(std::shared_ptr<ItemInstance> item, bool canMa
|
|||
}
|
||||
}
|
||||
|
||||
void Tutorial::onCrafted(std::shared_ptr<ItemInstance> item)
|
||||
void Tutorial::onCrafted(shared_ptr<ItemInstance> item)
|
||||
{
|
||||
for(unsigned int state = 0; state < e_Tutorial_State_Max; ++state)
|
||||
{
|
||||
|
|
@ -1833,7 +1833,7 @@ void Tutorial::onCrafted(std::shared_ptr<ItemInstance> item)
|
|||
}
|
||||
}
|
||||
|
||||
void Tutorial::onTake(std::shared_ptr<ItemInstance> item, unsigned int invItemCountAnyAux, unsigned int invItemCountThisAux)
|
||||
void Tutorial::onTake(shared_ptr<ItemInstance> item, unsigned int invItemCountAnyAux, unsigned int invItemCountThisAux)
|
||||
{
|
||||
if( !m_hintDisplayed )
|
||||
{
|
||||
|
|
@ -1860,7 +1860,7 @@ void Tutorial::onTake(std::shared_ptr<ItemInstance> item, unsigned int invItemCo
|
|||
}
|
||||
}
|
||||
|
||||
void Tutorial::onSelectedItemChanged(std::shared_ptr<ItemInstance> item)
|
||||
void Tutorial::onSelectedItemChanged(shared_ptr<ItemInstance> 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
|
||||
|
|
@ -2099,7 +2099,7 @@ void Tutorial::changeTutorialState(eTutorial_State newState, UIScene *scene /*=
|
|||
// The action that caused the change of state may also have completed the current task
|
||||
if( currentTask[m_CurrentState] != NULL && currentTask[m_CurrentState]->isCompleted() )
|
||||
{
|
||||
activeTasks[m_CurrentState].erase( find( activeTasks[m_CurrentState].begin(), activeTasks[m_CurrentState].end(), currentTask[m_CurrentState]) );
|
||||
activeTasks[m_CurrentState].erase( find( activeTasks[m_CurrentState].begin(), activeTasks[m_CurrentState].end(), currentTask[m_CurrentState]) );
|
||||
|
||||
if( activeTasks[m_CurrentState].size() > 0 )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ using namespace std;
|
|||
// #define TUTORIAL_MINIMUM_DISPLAY_MESSAGE_TIME 2000
|
||||
// #define TUTORIAL_REMINDER_TIME (TUTORIAL_DISPLAY_MESSAGE_TIME + 20000)
|
||||
// #define TUTORIAL_CONSTRAINT_DELAY_REMOVE_TICKS 15
|
||||
//
|
||||
//
|
||||
// // 0-24000
|
||||
// #define TUTORIAL_FREEZE_TIME_VALUE 8000
|
||||
|
||||
|
|
@ -151,19 +151,19 @@ public:
|
|||
|
||||
void showTutorialPopup(bool show);
|
||||
|
||||
void useItemOn(Level *level, std::shared_ptr<ItemInstance> item, int x, int y, int z,bool bTestUseOnly=false);
|
||||
void useItemOn(std::shared_ptr<ItemInstance> item, bool bTestUseOnly=false);
|
||||
void completeUsingItem(std::shared_ptr<ItemInstance> item);
|
||||
void startDestroyBlock(std::shared_ptr<ItemInstance> item, Tile *tile);
|
||||
void useItemOn(Level *level, shared_ptr<ItemInstance> item, int x, int y, int z,bool bTestUseOnly=false);
|
||||
void useItemOn(shared_ptr<ItemInstance> item, bool bTestUseOnly=false);
|
||||
void completeUsingItem(shared_ptr<ItemInstance> item);
|
||||
void startDestroyBlock(shared_ptr<ItemInstance> item, Tile *tile);
|
||||
void destroyBlock(Tile *tile);
|
||||
void attack(std::shared_ptr<Player> player, std::shared_ptr<Entity> entity);
|
||||
void itemDamaged(std::shared_ptr<ItemInstance> item);
|
||||
void attack(shared_ptr<Player> player, shared_ptr<Entity> entity);
|
||||
void itemDamaged(shared_ptr<ItemInstance> item);
|
||||
|
||||
void handleUIInput(int iAction);
|
||||
void createItemSelected(std::shared_ptr<ItemInstance> item, bool canMake);
|
||||
void onCrafted(std::shared_ptr<ItemInstance> item);
|
||||
void onTake(std::shared_ptr<ItemInstance> item, unsigned int invItemCountAnyAux, unsigned int invItemCountThisAux);
|
||||
void onSelectedItemChanged(std::shared_ptr<ItemInstance> item);
|
||||
void createItemSelected(shared_ptr<ItemInstance> item, bool canMake);
|
||||
void onCrafted(shared_ptr<ItemInstance> item);
|
||||
void onTake(shared_ptr<ItemInstance> item, unsigned int invItemCountAnyAux, unsigned int invItemCountThisAux);
|
||||
void onSelectedItemChanged(shared_ptr<ItemInstance> item);
|
||||
void onLookAt(int id, int iData=0);
|
||||
void onLookAtEntity(eINSTANCEOF type);
|
||||
void onEffectChanged(MobEffect *effect, bool bRemoved=false);
|
||||
|
|
|
|||
|
|
@ -7,14 +7,14 @@
|
|||
#include "..\..\Minecraft.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_lastTile( NULL ), m_hintNeeded( true ), m_allowFade(allowFade)
|
||||
{
|
||||
tutorial->addMessage(descriptionId, type != e_Hint_NoIngredients);
|
||||
}
|
||||
|
||||
int TutorialHint::startDestroyBlock(std::shared_ptr<ItemInstance> item, Tile *tile)
|
||||
int TutorialHint::startDestroyBlock(shared_ptr<ItemInstance> item, Tile *tile)
|
||||
{
|
||||
int returnVal = -1;
|
||||
switch(m_type)
|
||||
|
|
@ -59,7 +59,7 @@ int TutorialHint::destroyBlock(Tile *tile)
|
|||
return returnVal;
|
||||
}
|
||||
|
||||
int TutorialHint::attack(std::shared_ptr<ItemInstance> item, std::shared_ptr<Entity> entity)
|
||||
int TutorialHint::attack(shared_ptr<ItemInstance> item, shared_ptr<Entity> entity)
|
||||
{
|
||||
/*
|
||||
switch(m_type)
|
||||
|
|
@ -71,7 +71,7 @@ int TutorialHint::attack(std::shared_ptr<ItemInstance> item, std::shared_ptr<Ent
|
|||
return -1;
|
||||
}
|
||||
|
||||
int TutorialHint::createItemSelected(std::shared_ptr<ItemInstance> item, bool canMake)
|
||||
int TutorialHint::createItemSelected(shared_ptr<ItemInstance> item, bool canMake)
|
||||
{
|
||||
int returnVal = -1;
|
||||
switch(m_type)
|
||||
|
|
@ -86,7 +86,7 @@ int TutorialHint::createItemSelected(std::shared_ptr<ItemInstance> item, bool ca
|
|||
return returnVal;
|
||||
}
|
||||
|
||||
int TutorialHint::itemDamaged(std::shared_ptr<ItemInstance> item)
|
||||
int TutorialHint::itemDamaged(shared_ptr<ItemInstance> item)
|
||||
{
|
||||
int returnVal = -1;
|
||||
switch(m_type)
|
||||
|
|
@ -100,7 +100,7 @@ int TutorialHint::itemDamaged(std::shared_ptr<ItemInstance> item)
|
|||
return returnVal;
|
||||
}
|
||||
|
||||
bool TutorialHint::onTake( std::shared_ptr<ItemInstance> item )
|
||||
bool TutorialHint::onTake( shared_ptr<ItemInstance> item )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
@ -121,7 +121,7 @@ int TutorialHint::tick()
|
|||
switch(m_type)
|
||||
{
|
||||
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;
|
||||
}
|
||||
return returnVal;
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ class Tutorial;
|
|||
|
||||
class TutorialHint
|
||||
{
|
||||
public:
|
||||
public:
|
||||
enum eHintType
|
||||
{
|
||||
e_Hint_DiggerItem,
|
||||
|
|
@ -40,12 +40,12 @@ public:
|
|||
|
||||
eTutorial_Hint getId() { return m_id; }
|
||||
|
||||
virtual int startDestroyBlock(std::shared_ptr<ItemInstance> item, Tile *tile);
|
||||
virtual int startDestroyBlock(shared_ptr<ItemInstance> item, Tile *tile);
|
||||
virtual int destroyBlock(Tile *tile);
|
||||
virtual int attack(std::shared_ptr<ItemInstance> item, std::shared_ptr<Entity> entity);
|
||||
virtual int createItemSelected(std::shared_ptr<ItemInstance> item, bool canMake);
|
||||
virtual int itemDamaged(std::shared_ptr<ItemInstance> item);
|
||||
virtual bool onTake( std::shared_ptr<ItemInstance> item );
|
||||
virtual int attack(shared_ptr<ItemInstance> item, shared_ptr<Entity> entity);
|
||||
virtual int createItemSelected(shared_ptr<ItemInstance> item, bool canMake);
|
||||
virtual int itemDamaged(shared_ptr<ItemInstance> item);
|
||||
virtual bool onTake( shared_ptr<ItemInstance> item );
|
||||
virtual bool onLookAt(int id, int iData=0);
|
||||
virtual bool onLookAtEntity(eINSTANCEOF type);
|
||||
virtual int tick();
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ bool TutorialMode::destroyBlock(int x, int y, int z, int face)
|
|||
int t = minecraft->level->getTile(x, y, z);
|
||||
tutorial->destroyBlock(Tile::tiles[t]);
|
||||
}
|
||||
std::shared_ptr<ItemInstance> item = minecraft->player->getSelectedItem();
|
||||
shared_ptr<ItemInstance> item = minecraft->player->getSelectedItem();
|
||||
int damageBefore;
|
||||
if(item != NULL)
|
||||
{
|
||||
|
|
@ -47,7 +47,7 @@ bool TutorialMode::destroyBlock(int x, int y, int z, int face)
|
|||
if(!tutorial->m_allTutorialsComplete)
|
||||
{
|
||||
if ( item != NULL && item->isDamageableItem() )
|
||||
{
|
||||
{
|
||||
int max = item->getMaxDamage();
|
||||
int damageNow = item->getDamageValue();
|
||||
|
||||
|
|
@ -78,7 +78,7 @@ void TutorialMode::tick()
|
|||
*/
|
||||
}
|
||||
|
||||
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 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 haveItem = false;
|
||||
int itemCount = 0;
|
||||
|
|
@ -87,7 +87,7 @@ bool TutorialMode::useItemOn(std::shared_ptr<Player> player, Level *level, std::
|
|||
tutorial->useItemOn(level, item, x, y, z, bTestUseOnly);
|
||||
|
||||
if(!bTestUseOnly)
|
||||
{
|
||||
{
|
||||
if(item != NULL)
|
||||
{
|
||||
haveItem = true;
|
||||
|
|
@ -110,7 +110,7 @@ bool TutorialMode::useItemOn(std::shared_ptr<Player> player, Level *level, std::
|
|||
return result;
|
||||
}
|
||||
|
||||
void TutorialMode::attack(std::shared_ptr<Player> player, std::shared_ptr<Entity> entity)
|
||||
void TutorialMode::attack(shared_ptr<Player> player, shared_ptr<Entity> entity)
|
||||
{
|
||||
if(!tutorial->m_allTutorialsComplete)
|
||||
tutorial->attack(player, entity);
|
||||
|
|
|
|||
|
|
@ -19,8 +19,8 @@ public:
|
|||
virtual void startDestroyBlock(int x, int y, int z, int face);
|
||||
virtual bool destroyBlock(int x, int y, int z, int face);
|
||||
virtual void tick();
|
||||
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(std::shared_ptr<Player> player, std::shared_ptr<Entity> entity);
|
||||
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 void attack(shared_ptr<Player> player, shared_ptr<Entity> entity);
|
||||
|
||||
virtual bool isInputAllowed(int mapping);
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ protected:
|
|||
bool m_bAllowFade;
|
||||
bool m_bTaskReminders;
|
||||
bool m_bShowMinimumTime;
|
||||
|
||||
|
||||
protected:
|
||||
bool bIsCompleted;
|
||||
bool m_bShownForMinimumTime;
|
||||
|
|
@ -43,7 +43,7 @@ public:
|
|||
virtual eTutorial_CompletionAction getCompletionAction() { return e_Tutorial_Completion_None; }
|
||||
virtual bool isPreCompletionEnabled() { return enablePreCompletion; }
|
||||
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 setShownForMinimumTime() { m_bShownForMinimumTime = true; }
|
||||
|
|
@ -52,12 +52,12 @@ public:
|
|||
bool TaskReminders() { return m_bTaskReminders;}
|
||||
virtual bool ShowMinimumTime() { return m_bShowMinimumTime;}
|
||||
|
||||
virtual void useItemOn(Level *level, std::shared_ptr<ItemInstance> item, int x, int y, int z, bool bTestUseOnly=false) { }
|
||||
virtual void useItem(std::shared_ptr<ItemInstance> item,bool bTestUseOnly=false) { }
|
||||
virtual void completeUsingItem(std::shared_ptr<ItemInstance> item) { }
|
||||
virtual void useItemOn(Level *level, 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 completeUsingItem(shared_ptr<ItemInstance> item) { }
|
||||
virtual void handleUIInput(int iAction) { }
|
||||
virtual void onCrafted(std::shared_ptr<ItemInstance> item) { }
|
||||
virtual void onTake(std::shared_ptr<ItemInstance> item, unsigned int invItemCountAnyAux, unsigned int invItemCountThisAux) { }
|
||||
virtual void onCrafted(shared_ptr<ItemInstance> item) { }
|
||||
virtual void onTake(shared_ptr<ItemInstance> item, unsigned int invItemCountAnyAux, unsigned int invItemCountThisAux) { }
|
||||
virtual void onStateChange(eTutorial_State newState) { }
|
||||
virtual void onEffectChanged(MobEffect *effect, bool bRemoved=false) { }
|
||||
};
|
||||
|
|
@ -16,7 +16,7 @@ bool UseItemTask::isCompleted()
|
|||
return bIsCompleted;
|
||||
}
|
||||
|
||||
void UseItemTask::useItem(std::shared_ptr<ItemInstance> item,bool bTestUseOnly)
|
||||
void UseItemTask::useItem(shared_ptr<ItemInstance> item,bool bTestUseOnly)
|
||||
{
|
||||
if(bTestUseOnly) return;
|
||||
|
||||
|
|
|
|||
|
|
@ -16,5 +16,5 @@ public:
|
|||
UseItemTask(const int itemId, Tutorial *tutorial, int descriptionId,
|
||||
bool enablePreCompletion = false, vector<TutorialConstraint *> *inConstraints = NULL, bool bShowMinimumTime = false, bool bAllowFade = true, bool bTaskReminders = true );
|
||||
virtual bool isCompleted();
|
||||
virtual void useItem(std::shared_ptr<ItemInstance> item, bool bTestUseOnly=false);
|
||||
virtual void useItem(shared_ptr<ItemInstance> item, bool bTestUseOnly=false);
|
||||
};
|
||||
|
|
@ -25,7 +25,7 @@ bool UseTileTask::isCompleted()
|
|||
return bIsCompleted;
|
||||
}
|
||||
|
||||
void UseTileTask::useItemOn(Level *level, std::shared_ptr<ItemInstance> item, int x, int y, int z,bool bTestUseOnly)
|
||||
void UseTileTask::useItemOn(Level *level, shared_ptr<ItemInstance> item, int x, int y, int z,bool bTestUseOnly)
|
||||
{
|
||||
if(bTestUseOnly) return;
|
||||
|
||||
|
|
|
|||
|
|
@ -20,5 +20,5 @@ public:
|
|||
UseTileTask(const int tileId, Tutorial *tutorial, int descriptionId,
|
||||
bool enablePreCompletion = false, vector<TutorialConstraint *> *inConstraints = NULL, bool bShowMinimumTime = false, bool bAllowFade = true, bool bTaskReminders = true);
|
||||
virtual bool isCompleted();
|
||||
virtual void useItemOn(Level *level, std::shared_ptr<ItemInstance> item, int x, int y, int z, bool bTestUseOnly=false);
|
||||
virtual void useItemOn(Level *level, shared_ptr<ItemInstance> item, int x, int y, int z, bool bTestUseOnly=false);
|
||||
};
|
||||
|
|
@ -73,7 +73,7 @@ void IUIScene_AbstractContainerMenu::Initialize(int iPad, AbstractContainerMenu*
|
|||
m_iCurrSlotX = 0;
|
||||
m_iCurrSlotY = 0;
|
||||
#endif // TAP_DETECTION
|
||||
//
|
||||
//
|
||||
// for(int i=0;i<XUSER_MAX_COUNT;i++)
|
||||
// {
|
||||
// m_bFirstTouchStored[i]=false;
|
||||
|
|
@ -101,7 +101,7 @@ int IUIScene_AbstractContainerMenu::GetSectionDimensions( ESceneSection eSection
|
|||
*piNumRows = 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 )
|
||||
|
|
@ -205,7 +205,7 @@ void IUIScene_AbstractContainerMenu::SetToolTip( EToolTipButton eButton, EToolTi
|
|||
void IUIScene_AbstractContainerMenu::UpdateTooltips()
|
||||
{
|
||||
// Table gives us text id for tooltip.
|
||||
static const DWORD kaToolTipextIds[ eNumToolTips ] =
|
||||
static const DWORD kaToolTipextIds[ eNumToolTips ] =
|
||||
{
|
||||
IDS_TOOLTIPS_PICKUPPLACE, //eToolTipPickupPlace_OLD
|
||||
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 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)
|
||||
{
|
||||
|
|
@ -320,11 +320,11 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
|
|||
|
||||
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)
|
||||
{
|
||||
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.
|
||||
|
|
@ -334,7 +334,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
|
|||
else if ( vPointerPos.y > m_fPointerMaxY ) vPointerPos.y = m_fPointerMaxY;
|
||||
|
||||
bStickInput = true;
|
||||
m_eCurrTapState=eTapStateNoInput;
|
||||
m_eCurrTapState=eTapStateNoInput;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -408,7 +408,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
|
|||
fInputX *= fInputScale;
|
||||
fInputY *= fInputScale;
|
||||
|
||||
#ifdef USE_POINTER_ACCEL
|
||||
#ifdef USE_POINTER_ACCEL
|
||||
m_fPointerAccelX += fInputX / 50.0f;
|
||||
m_fPointerAccelY += fInputY / 50.0f;
|
||||
|
||||
|
|
@ -451,12 +451,12 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
|
|||
else
|
||||
{
|
||||
m_iConsectiveInputTicks = 0;
|
||||
#ifdef USE_POINTER_ACCEL
|
||||
#ifdef USE_POINTER_ACCEL
|
||||
m_fPointerVelX = 0.0f;
|
||||
m_fPointerVelY = 0.0f;
|
||||
m_fPointerAccelX = 0.0f;
|
||||
m_fPointerAccelY = 0.0f;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef __ORBIS__
|
||||
|
|
@ -501,7 +501,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
|
|||
( vPointerPos.y >= sectionPos.y ) && ( vPointerPos.y <= itemMax.y ) )
|
||||
{
|
||||
// Pointer is over this control!
|
||||
eSectionUnderPointer = eSection;
|
||||
eSectionUnderPointer = eSection;
|
||||
|
||||
vSnapPos.x = itemPos.x + ( itemSize.x / 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 ( eSectionUnderPointer == eSectionNone )
|
||||
if ( eSectionUnderPointer == eSectionNone )
|
||||
{
|
||||
setFocusToPointer( getPad() );
|
||||
#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.
|
||||
|
||||
// What are we carrying on pointer.
|
||||
std::shared_ptr<LocalPlayer> player = Minecraft::GetInstance()->localplayers[getPad()];
|
||||
std::shared_ptr<ItemInstance> carriedItem = nullptr;
|
||||
shared_ptr<LocalPlayer> player = Minecraft::GetInstance()->localplayers[getPad()];
|
||||
shared_ptr<ItemInstance> carriedItem = nullptr;
|
||||
if(player != NULL) carriedItem = player->inventory->getCarried();
|
||||
|
||||
std::shared_ptr<ItemInstance> slotItem = nullptr;
|
||||
shared_ptr<ItemInstance> slotItem = nullptr;
|
||||
Slot *slot = NULL;
|
||||
int slotIndex = 0;
|
||||
if(bPointerIsOverSlot)
|
||||
|
|
@ -790,7 +790,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
|
|||
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?
|
||||
if ( bCarriedIsSameAsSlot )
|
||||
if ( bCarriedIsSameAsSlot )
|
||||
{
|
||||
// Can we stack more into this slot?
|
||||
if ( iSlotStackSizeRemaining == 0 )
|
||||
|
|
@ -889,7 +889,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
|
|||
|
||||
if((eSectionUnderPointer==eSectionInventoryUsing)||(eSectionUnderPointer==eSectionInventoryInventory))
|
||||
{
|
||||
std::shared_ptr<ItemInstance> item = getSlotItem(eSectionUnderPointer, iNewSlotIndex);
|
||||
shared_ptr<ItemInstance> item = getSlotItem(eSectionUnderPointer, iNewSlotIndex);
|
||||
ArmorRecipes::_eArmorType eArmourType=ArmorRecipes::GetArmorType(item->id);
|
||||
|
||||
if(eArmourType==ArmorRecipes::eArmorType_None)
|
||||
|
|
@ -919,7 +919,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
|
|||
else
|
||||
{
|
||||
buttonY = eToolTipQuickMove;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ArmorRecipes::eArmorType_Leggings:
|
||||
if(isSlotEmpty(eSectionInventoryArmor,2))
|
||||
|
|
@ -952,7 +952,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
|
|||
else if((eSectionUnderPointer==eSectionFurnaceUsing)||(eSectionUnderPointer==eSectionFurnaceInventory))
|
||||
{
|
||||
// Get the info on this item.
|
||||
std::shared_ptr<ItemInstance> item = getSlotItem(eSectionUnderPointer, iNewSlotIndex);
|
||||
shared_ptr<ItemInstance> item = getSlotItem(eSectionUnderPointer, iNewSlotIndex);
|
||||
bool bValidFuel = FurnaceTileEntity::isFuel(item);
|
||||
bool bValidIngredient = FurnaceRecipes::getInstance()->getResult(item->getItem()->id) != NULL;
|
||||
|
||||
|
|
@ -962,7 +962,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
|
|||
if(!isSlotEmpty(eSectionFurnaceIngredient,0))
|
||||
{
|
||||
// is it the same as this item
|
||||
std::shared_ptr<ItemInstance> IngredientItem = getSlotItem(eSectionFurnaceIngredient,0);
|
||||
shared_ptr<ItemInstance> IngredientItem = getSlotItem(eSectionFurnaceIngredient,0);
|
||||
if(IngredientItem->id == item->id)
|
||||
{
|
||||
buttonY = eToolTipQuickMoveIngredient;
|
||||
|
|
@ -991,7 +991,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
|
|||
if(!isSlotEmpty(eSectionFurnaceFuel,0))
|
||||
{
|
||||
// is it the same as this item
|
||||
std::shared_ptr<ItemInstance> fuelItem = getSlotItem(eSectionFurnaceFuel,0);
|
||||
shared_ptr<ItemInstance> fuelItem = getSlotItem(eSectionFurnaceFuel,0);
|
||||
if(fuelItem->id == item->id)
|
||||
{
|
||||
buttonY = eToolTipQuickMoveFuel;
|
||||
|
|
@ -1002,7 +1002,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
|
|||
if(!isSlotEmpty(eSectionFurnaceIngredient,0))
|
||||
{
|
||||
// is it the same as this item
|
||||
std::shared_ptr<ItemInstance> IngredientItem = getSlotItem(eSectionFurnaceIngredient,0);
|
||||
shared_ptr<ItemInstance> IngredientItem = getSlotItem(eSectionFurnaceIngredient,0);
|
||||
if(IngredientItem->id == item->id)
|
||||
{
|
||||
buttonY = eToolTipQuickMoveIngredient;
|
||||
|
|
@ -1044,7 +1044,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
|
|||
else if((eSectionUnderPointer==eSectionBrewingUsing)||(eSectionUnderPointer==eSectionBrewingInventory))
|
||||
{
|
||||
// Get the info on this item.
|
||||
std::shared_ptr<ItemInstance> item = getSlotItem(eSectionUnderPointer, iNewSlotIndex);
|
||||
shared_ptr<ItemInstance> item = getSlotItem(eSectionUnderPointer, iNewSlotIndex);
|
||||
int iId=item->id;
|
||||
|
||||
// valid ingredient?
|
||||
|
|
@ -1062,7 +1062,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
|
|||
if(!isSlotEmpty(eSectionBrewingIngredient,0))
|
||||
{
|
||||
// is it the same as this item
|
||||
std::shared_ptr<ItemInstance> IngredientItem = getSlotItem(eSectionBrewingIngredient,0);
|
||||
shared_ptr<ItemInstance> IngredientItem = getSlotItem(eSectionBrewingIngredient,0);
|
||||
if(IngredientItem->id == item->id)
|
||||
{
|
||||
buttonY = eToolTipQuickMoveIngredient;
|
||||
|
|
@ -1077,15 +1077,15 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
|
|||
// ingredient slot empty
|
||||
buttonY = eToolTipQuickMoveIngredient;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// valid potion? Glass bottle with water in it is a 'potion' too.
|
||||
if(iId==Item::potion_Id)
|
||||
{
|
||||
// space available?
|
||||
if(isSlotEmpty(eSectionBrewingBottle1,0) ||
|
||||
isSlotEmpty(eSectionBrewingBottle2,0) ||
|
||||
if(isSlotEmpty(eSectionBrewingBottle1,0) ||
|
||||
isSlotEmpty(eSectionBrewingBottle2,0) ||
|
||||
isSlotEmpty(eSectionBrewingBottle3,0))
|
||||
{
|
||||
buttonY = eToolTipQuickMoveIngredient;
|
||||
|
|
@ -1104,7 +1104,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
|
|||
else if((eSectionUnderPointer==eSectionEnchantUsing)||(eSectionUnderPointer==eSectionEnchantInventory))
|
||||
{
|
||||
// Get the info on this item.
|
||||
std::shared_ptr<ItemInstance> item = getSlotItem(eSectionUnderPointer, iNewSlotIndex);
|
||||
shared_ptr<ItemInstance> item = getSlotItem(eSectionUnderPointer, iNewSlotIndex);
|
||||
int iId=item->id;
|
||||
|
||||
// valid enchantable tool?
|
||||
|
|
@ -1112,8 +1112,8 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
|
|||
{
|
||||
// is there already something in the ingredient slot?
|
||||
if(isSlotEmpty(eSectionEnchantSlot,0))
|
||||
{
|
||||
// tool slot empty
|
||||
{
|
||||
// tool slot empty
|
||||
switch(iId)
|
||||
{
|
||||
case Item::bow_Id:
|
||||
|
|
@ -1155,7 +1155,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
|
|||
buttonY = eToolTipQuickMove;
|
||||
break;
|
||||
default:
|
||||
buttonY=eToolTipQuickMoveTool;
|
||||
buttonY=eToolTipQuickMoveTool;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -1163,10 +1163,10 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
|
|||
{
|
||||
buttonY = eToolTipQuickMove;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
buttonY=eToolTipQuickMove;
|
||||
buttonY=eToolTipQuickMove;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -1199,7 +1199,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
|
|||
SetPointerOutsideMenu( false );
|
||||
}
|
||||
|
||||
std::shared_ptr<ItemInstance> item = nullptr;
|
||||
shared_ptr<ItemInstance> item = nullptr;
|
||||
if(bPointerIsOverSlot && bSlotHasItem) item = getSlotItem(eSectionUnderPointer, iNewSlotIndex);
|
||||
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
|
||||
{
|
||||
ui.CloseUIScenes(iPad);
|
||||
ui.CloseUIScenes(iPad);
|
||||
}
|
||||
|
||||
bHandled = true;
|
||||
|
|
@ -1410,7 +1410,7 @@ bool IUIScene_AbstractContainerMenu::handleKeyDown(int iPad, int iAction, bool b
|
|||
bool bSlotHasItem = !isSlotEmpty(m_eCurrSection, currentIndex);
|
||||
if ( bSlotHasItem )
|
||||
{
|
||||
std::shared_ptr<ItemInstance> item = getSlotItem(m_eCurrSection, currentIndex);
|
||||
shared_ptr<ItemInstance> item = getSlotItem(m_eCurrSection, currentIndex);
|
||||
if( Minecraft::GetInstance()->localgameModes[iPad] != NULL )
|
||||
{
|
||||
Tutorial::PopupMessageDetails *message = new Tutorial::PopupMessageDetails;
|
||||
|
|
@ -1456,7 +1456,7 @@ bool IUIScene_AbstractContainerMenu::handleKeyDown(int iPad, int iAction, bool b
|
|||
{
|
||||
handleOutsideClicked(iPad, buttonNum, quickKeyHeld);
|
||||
}
|
||||
else //
|
||||
else //
|
||||
{
|
||||
// over empty space or something else???
|
||||
handleOtherClicked(iPad,m_eCurrSection,buttonNum,quickKeyHeld?true:false);
|
||||
|
|
@ -1569,7 +1569,7 @@ int IUIScene_AbstractContainerMenu::getCurrentIndex(ESceneSection eSection)
|
|||
return currentIndex + getSectionStartOffset(eSection);
|
||||
}
|
||||
|
||||
bool IUIScene_AbstractContainerMenu::IsSameItemAs(std::shared_ptr<ItemInstance> itemA, std::shared_ptr<ItemInstance> itemB)
|
||||
bool IUIScene_AbstractContainerMenu::IsSameItemAs(shared_ptr<ItemInstance> itemA, shared_ptr<ItemInstance> itemB)
|
||||
{
|
||||
if(itemA == NULL || itemB == NULL) return false;
|
||||
|
||||
|
|
@ -1583,7 +1583,7 @@ int IUIScene_AbstractContainerMenu::GetEmptyStackSpace(Slot *slot)
|
|||
|
||||
if(slot != NULL && slot->hasItem())
|
||||
{
|
||||
std::shared_ptr<ItemInstance> item = slot->getItem();
|
||||
shared_ptr<ItemInstance> item = slot->getItem();
|
||||
if ( item->isStackable() )
|
||||
{
|
||||
int iCount = item->GetCount();
|
||||
|
|
@ -1614,7 +1614,7 @@ wstring IUIScene_AbstractContainerMenu::GetItemDescription(Slot *slot, vector<ws
|
|||
}
|
||||
else
|
||||
{
|
||||
firstLine = false;
|
||||
firstLine = false;
|
||||
wchar_t formatted[256];
|
||||
eMinecraftColour rarityColour = slot->getItem()->getRarity()->color;
|
||||
int colour = app.GetHTMLColour(rarityColour);
|
||||
|
|
@ -1624,7 +1624,7 @@ wstring IUIScene_AbstractContainerMenu::GetItemDescription(Slot *slot, vector<ws
|
|||
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;
|
||||
}
|
||||
desc.append( thisString );
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
// Uncomment to enable acceleration on pointer input.
|
||||
//#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_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,
|
||||
eSectionContainerChest,
|
||||
eSectionContainerMax,
|
||||
|
||||
|
||||
eSectionFurnaceUsing,
|
||||
eSectionFurnaceInventory,
|
||||
eSectionFurnaceIngredient,
|
||||
eSectionFurnaceFuel,
|
||||
eSectionFurnaceResult,
|
||||
eSectionFurnaceMax,
|
||||
|
||||
|
||||
eSectionInventoryUsing,
|
||||
eSectionInventoryInventory,
|
||||
eSectionInventoryArmor,
|
||||
eSectionInventoryMax,
|
||||
|
||||
|
||||
eSectionTrapUsing,
|
||||
eSectionTrapInventory,
|
||||
eSectionTrapTrap,
|
||||
|
|
@ -64,7 +64,7 @@ protected:
|
|||
eSectionInventoryCreativeSlider,
|
||||
#endif
|
||||
eSectionInventoryCreativeMax,
|
||||
|
||||
|
||||
eSectionEnchantUsing,
|
||||
eSectionEnchantInventory,
|
||||
eSectionEnchantSlot,
|
||||
|
|
@ -151,7 +151,7 @@ protected:
|
|||
// 4J - WESTY - Added for pointer prototype.
|
||||
// Current tooltip settings.
|
||||
EToolTipItem m_aeToolTipSettings[ eToolTipNumButtons ];
|
||||
|
||||
|
||||
// 4J - WESTY - Added for pointer prototype.
|
||||
// Indicates if pointer is outside UI window (used to drop items).
|
||||
bool m_bPointerOutsideMenu;
|
||||
|
|
@ -159,7 +159,7 @@ protected:
|
|||
|
||||
bool m_bSplitscreen;
|
||||
bool m_bNavigateBack; // should we exit the xuiscenes or just navigate back on exit?
|
||||
|
||||
|
||||
virtual bool IsSectionSlotList( ESceneSection eSection ) { return eSection != eSectionNone; }
|
||||
virtual bool CanHaveFocus( ESceneSection eSection ) { return true; }
|
||||
int GetSectionDimensions( ESceneSection eSection, int* piNumColumns, int* piNumRows );
|
||||
|
|
@ -180,7 +180,7 @@ protected:
|
|||
|
||||
// 4J - WESTY - Added for pointer prototype.
|
||||
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);
|
||||
virtual void PlatformInitialize(int iPad, int startIndex) = 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 setFocusToPointer(int iPad) = 0;
|
||||
virtual void SetPointerText(const wstring &description, vector<wstring> &unformattedStrings, bool newSlot) = 0;
|
||||
virtual std::shared_ptr<ItemInstance> getSlotItem(ESceneSection eSection, int iSlot) = 0;
|
||||
virtual shared_ptr<ItemInstance> getSlotItem(ESceneSection eSection, int iSlot) = 0;
|
||||
virtual bool isSlotEmpty(ESceneSection eSection, int iSlot) = 0;
|
||||
virtual void adjustPointerForSafeZone() = 0;
|
||||
|
||||
virtual bool overrideTooltips(ESceneSection sectionUnderPointer, std::shared_ptr<ItemInstance> itemUnderPointer, bool bIsItemCarried, bool bSlotHasItem, bool bCarriedIsSameAsSlot, int iSlotStackSizeRemaining,
|
||||
virtual bool overrideTooltips(ESceneSection sectionUnderPointer, shared_ptr<ItemInstance> itemUnderPointer, bool bIsItemCarried, bool bSlotHasItem, bool bCarriedIsSameAsSlot, int iSlotStackSizeRemaining,
|
||||
EToolTipItem &buttonA, EToolTipItem &buttonX, EToolTipItem &buttonY, EToolTipItem &buttonRT) { return false; }
|
||||
|
||||
private:
|
||||
bool IsSameItemAs(std::shared_ptr<ItemInstance> itemA, std::shared_ptr<ItemInstance> itemB);
|
||||
bool IsSameItemAs(shared_ptr<ItemInstance> itemA, shared_ptr<ItemInstance> itemB);
|
||||
int GetEmptyStackSpace(Slot *slot);
|
||||
wstring GetItemDescription(Slot *slot, vector<wstring> &unformattedStrings);
|
||||
|
||||
|
|
|
|||
|
|
@ -245,15 +245,15 @@ void IUIScene_AnvilMenu::updateItemName()
|
|||
ByteArrayOutputStream baos;
|
||||
DataOutputStream dos(&baos);
|
||||
dos.writeUTF(m_itemName);
|
||||
Minecraft::GetInstance()->localplayers[getPad()]->connection->send(std::shared_ptr<CustomPayloadPacket>(new CustomPayloadPacket(CustomPayloadPacket::SET_ITEM_NAME_PACKET, baos.toByteArray())));
|
||||
Minecraft::GetInstance()->localplayers[getPad()]->connection->send(shared_ptr<CustomPayloadPacket>(new CustomPayloadPacket(CustomPayloadPacket::SET_ITEM_NAME_PACKET, baos.toByteArray())));
|
||||
}
|
||||
|
||||
void IUIScene_AnvilMenu::refreshContainer(AbstractContainerMenu *container, vector<std::shared_ptr<ItemInstance> > *items)
|
||||
void IUIScene_AnvilMenu::refreshContainer(AbstractContainerMenu *container, vector<shared_ptr<ItemInstance> > *items)
|
||||
{
|
||||
slotChanged(container, RepairMenu::INPUT_SLOT, container->getSlot(0)->getItem());
|
||||
}
|
||||
|
||||
void IUIScene_AnvilMenu::slotChanged(AbstractContainerMenu *container, int slotIndex, std::shared_ptr<ItemInstance> item)
|
||||
void IUIScene_AnvilMenu::slotChanged(AbstractContainerMenu *container, int slotIndex, shared_ptr<ItemInstance> item)
|
||||
{
|
||||
if (slotIndex == RepairMenu::INPUT_SLOT)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ class RepairMenu;
|
|||
class IUIScene_AnvilMenu : public virtual IUIScene_AbstractContainerMenu, public net_minecraft_world_inventory::ContainerListener
|
||||
{
|
||||
protected:
|
||||
std::shared_ptr<Inventory> m_inventory;
|
||||
shared_ptr<Inventory> m_inventory;
|
||||
RepairMenu *m_repairMenu;
|
||||
wstring m_itemName;
|
||||
|
||||
|
|
@ -24,7 +24,7 @@ protected:
|
|||
IUIScene_AnvilMenu();
|
||||
|
||||
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);
|
||||
bool IsSectionSlotList( ESceneSection eSection );
|
||||
|
||||
|
|
@ -39,7 +39,7 @@ protected:
|
|||
void updateItemName();
|
||||
|
||||
// ContainerListenr
|
||||
void refreshContainer(AbstractContainerMenu *container, vector<std::shared_ptr<ItemInstance> > *items);
|
||||
void slotChanged(AbstractContainerMenu *container, int slotIndex, std::shared_ptr<ItemInstance> item);
|
||||
void refreshContainer(AbstractContainerMenu *container, vector<shared_ptr<ItemInstance> > *items);
|
||||
void slotChanged(AbstractContainerMenu *container, int slotIndex, shared_ptr<ItemInstance> item);
|
||||
void setContainerData(AbstractContainerMenu *container, int id, int value);
|
||||
};
|
||||
|
|
@ -91,7 +91,7 @@ IUIScene_CraftingMenu::_eGroupTab IUIScene_CraftingMenu::m_GroupTabBkgMapping3x3
|
|||
// eBaseItemType_bow,
|
||||
// eBaseItemType_pockettool,
|
||||
// eBaseItemType_utensil,
|
||||
//
|
||||
//
|
||||
// }
|
||||
// eBaseItemType;
|
||||
|
||||
|
|
@ -180,11 +180,11 @@ bool IUIScene_CraftingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat)
|
|||
UpdateTooltips();
|
||||
break;
|
||||
case ACTION_MENU_PAUSEMENU:
|
||||
case ACTION_MENU_B:
|
||||
case ACTION_MENU_B:
|
||||
ui.ShowTooltip( iPad, eToolTipButtonX, false );
|
||||
ui.ShowTooltip( iPad, eToolTipButtonB, false );
|
||||
ui.ShowTooltip( iPad, eToolTipButtonA, false );
|
||||
ui.ShowTooltip( iPad, eToolTipButtonRB, false );
|
||||
ui.ShowTooltip( iPad, eToolTipButtonA, false );
|
||||
ui.ShowTooltip( iPad, eToolTipButtonRB, false );
|
||||
// kill the crafting xui
|
||||
//ui.PlayUISFX(eSFX_Back);
|
||||
ui.CloseUIScenes(iPad);
|
||||
|
|
@ -197,18 +197,18 @@ bool IUIScene_CraftingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat)
|
|||
#endif
|
||||
// Do some crafting!
|
||||
if(m_pPlayer && m_pPlayer->inventory)
|
||||
{
|
||||
{
|
||||
//RecipyList *recipes = ((Recipes *)Recipes::getInstance())->getRecipies();
|
||||
Recipy::INGREDIENTS_REQUIRED *pRecipeIngredientsRequired=Recipes::getInstance()->getRecipeIngredientsArray();
|
||||
// Force a make if the debug is on
|
||||
if(app.DebugSettingsOn() && app.GetGameSettingsDebugMask(ProfileManager.GetPrimaryPad())&(1L<<eDebugSetting_CraftAnything))
|
||||
{
|
||||
if(CanBeMadeA[m_iCurrentSlotHIndex].iCount!=0)
|
||||
{
|
||||
{
|
||||
int iSlot=iVSlotIndexA[m_iCurrentSlotVIndex];
|
||||
|
||||
int iRecipe= CanBeMadeA[m_iCurrentSlotHIndex].iRecipeA[iSlot];
|
||||
std::shared_ptr<ItemInstance> pTempItemInst=pRecipeIngredientsRequired[iRecipe].pRecipy->assemble(nullptr);
|
||||
shared_ptr<ItemInstance> pTempItemInst=pRecipeIngredientsRequired[iRecipe].pRecipy->assemble(nullptr);
|
||||
//int iIcon=pTempItemInst->getItem()->getIcon(pTempItemInst->getAuxValue());
|
||||
|
||||
if( pMinecraft->localgameModes[iPad] != NULL)
|
||||
|
|
@ -244,7 +244,7 @@ bool IUIScene_CraftingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat)
|
|||
iSlot=0;
|
||||
}
|
||||
int iRecipe= CanBeMadeA[m_iCurrentSlotHIndex].iRecipeA[iSlot];
|
||||
std::shared_ptr<ItemInstance> pTempItemInst=pRecipeIngredientsRequired[iRecipe].pRecipy->assemble(nullptr);
|
||||
shared_ptr<ItemInstance> pTempItemInst=pRecipeIngredientsRequired[iRecipe].pRecipy->assemble(nullptr);
|
||||
//int iIcon=pTempItemInst->getItem()->getIcon(pTempItemInst->getAuxValue());
|
||||
|
||||
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 );
|
||||
// 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++)
|
||||
{
|
||||
std::shared_ptr<ItemInstance> ingItemInst = nullptr;
|
||||
shared_ptr<ItemInstance> ingItemInst = nullptr;
|
||||
// do we need to remove a specific 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())
|
||||
{
|
||||
// replace item with remaining result
|
||||
m_pPlayer->inventory->add( std::shared_ptr<ItemInstance>( new ItemInstance(ingItemInst->getItem()->getCraftingRemainingItem()) ) );
|
||||
m_pPlayer->inventory->add( shared_ptr<ItemInstance>( new ItemInstance(ingItemInst->getItem()->getCraftingRemainingItem()) ) );
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -337,7 +337,7 @@ bool IUIScene_CraftingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat)
|
|||
break;
|
||||
|
||||
case ACTION_MENU_LEFT_SCROLL:
|
||||
// turn off the old group tab
|
||||
// turn off the old group tab
|
||||
showTabHighlight(m_iGroupIndex,false);
|
||||
|
||||
if(m_iGroupIndex==0)
|
||||
|
|
@ -431,7 +431,7 @@ bool IUIScene_CraftingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat)
|
|||
// clear the indices
|
||||
iVSlotIndexA[0]=CanBeMadeA[m_iCurrentSlotHIndex].iCount-1;
|
||||
iVSlotIndexA[1]=0;
|
||||
iVSlotIndexA[2]=1;
|
||||
iVSlotIndexA[2]=1;
|
||||
|
||||
UpdateVerticalSlots();
|
||||
UpdateHighlight();
|
||||
|
|
@ -482,13 +482,13 @@ bool IUIScene_CraftingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat)
|
|||
else
|
||||
{
|
||||
iVSlotIndexA[1]--;
|
||||
}
|
||||
}
|
||||
ui.PlayUISFX(eSFX_Focus);
|
||||
}
|
||||
else
|
||||
if(CanBeMadeA[m_iCurrentSlotHIndex].iCount>2)
|
||||
{
|
||||
{
|
||||
{
|
||||
if(m_iCurrentSlotVIndex!=0)
|
||||
{
|
||||
// just move the highlight
|
||||
|
|
@ -496,11 +496,11 @@ bool IUIScene_CraftingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat)
|
|||
ui.PlayUISFX(eSFX_Focus);
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
//move the slots
|
||||
iVSlotIndexA[2]=iVSlotIndexA[1];
|
||||
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)
|
||||
{
|
||||
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(bNoScrollSlots)
|
||||
{
|
||||
{
|
||||
if(iVSlotIndexA[1]==(CanBeMadeA[m_iCurrentSlotHIndex].iCount-1))
|
||||
{
|
||||
iVSlotIndexA[1]=0;
|
||||
|
|
@ -574,7 +574,7 @@ bool IUIScene_CraftingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat)
|
|||
{
|
||||
m_iCurrentSlotVIndex++;
|
||||
ui.PlayUISFX(eSFX_Focus);
|
||||
}
|
||||
}
|
||||
}
|
||||
UpdateVerticalSlots();
|
||||
UpdateHighlight();
|
||||
|
|
@ -624,11 +624,11 @@ void IUIScene_CraftingMenu::CheckRecipesAvailable()
|
|||
|
||||
// for (int i = 0; i < iRecipeC; i++)
|
||||
// {
|
||||
// std::shared_ptr<ItemInstance> pTempItemInst=pRecipeIngredientsRequired[i].pRecipy->assemble(NULL);
|
||||
// shared_ptr<ItemInstance> pTempItemInst=pRecipeIngredientsRequired[i].pRecipy->assemble(NULL);
|
||||
// if (pTempItemInst != NULL)
|
||||
// {
|
||||
// wstring itemstring=pTempItemInst->toString();
|
||||
//
|
||||
//
|
||||
// printf("Recipe [%d] = ",i);
|
||||
// OutputDebugStringW(itemstring.c_str());
|
||||
// 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());
|
||||
// }
|
||||
//
|
||||
//
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
|
@ -683,9 +683,9 @@ void IUIScene_CraftingMenu::CheckRecipesAvailable()
|
|||
if (m_pPlayer->inventory->items[k] != NULL)
|
||||
{
|
||||
// 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
|
||||
((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)
|
||||
|
|
@ -721,18 +721,18 @@ void IUIScene_CraftingMenu::CheckRecipesAvailable()
|
|||
// 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
|
||||
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]==false)
|
||||
{
|
||||
{
|
||||
int iMissing = pRecipeIngredientsRequired[i].iIngValA[j]-iTotalCount;
|
||||
int iGridIndex=0;
|
||||
while(iMissing!=0)
|
||||
{
|
||||
// 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))) )
|
||||
{
|
||||
// this grid entry is the ingredient we don't have enough of
|
||||
|
|
@ -761,7 +761,7 @@ void IUIScene_CraftingMenu::CheckRecipesAvailable()
|
|||
if(iHSlotBrushControl<=m_iCraftablesMaxHSlotC)
|
||||
{
|
||||
bool bFound=false;
|
||||
std::shared_ptr<ItemInstance> pTempItemInst=pRecipeIngredientsRequired[i].pRecipy->assemble(nullptr);
|
||||
shared_ptr<ItemInstance> pTempItemInst=pRecipeIngredientsRequired[i].pRecipy->assemble(nullptr);
|
||||
//int iIcon=pTempItemInst->getItem()->getIcon(pTempItemInst->getAuxValue());
|
||||
int iID=pTempItemInst->getItem()->id;
|
||||
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
|
||||
if(iBaseType!=Item::eBaseItemType_undefined)
|
||||
{
|
||||
{
|
||||
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
|
||||
|
|
@ -801,7 +801,7 @@ void IUIScene_CraftingMenu::CheckRecipesAvailable()
|
|||
if(!bFound)
|
||||
{
|
||||
if(iHSlotBrushControl<m_iCraftablesMaxHSlotC)
|
||||
{
|
||||
{
|
||||
// add to the list
|
||||
CanBeMadeA[iHSlotBrushControl].iItemBaseType=iBaseType;
|
||||
CanBeMadeA[iHSlotBrushControl].iRecipeA[CanBeMadeA[iHSlotBrushControl].iCount++]=i;
|
||||
|
|
@ -824,7 +824,7 @@ void IUIScene_CraftingMenu::CheckRecipesAvailable()
|
|||
}
|
||||
|
||||
delete [] bFoundA;
|
||||
itRecipe++;
|
||||
itRecipe++;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -835,7 +835,7 @@ void IUIScene_CraftingMenu::CheckRecipesAvailable()
|
|||
|
||||
while((iIndex<m_iCraftablesMaxHSlotC) && CanBeMadeA[iIndex].iCount!=0)
|
||||
{
|
||||
std::shared_ptr<ItemInstance> pTempItemInst=pRecipeIngredientsRequired[CanBeMadeA[iIndex].iRecipeA[0]].pRecipy->assemble(nullptr);
|
||||
shared_ptr<ItemInstance> pTempItemInst=pRecipeIngredientsRequired[CanBeMadeA[iIndex].iRecipeA[0]].pRecipy->assemble(nullptr);
|
||||
assert(pTempItemInst->id!=0);
|
||||
unsigned int uiAlpha;
|
||||
|
||||
|
|
@ -844,7 +844,7 @@ void IUIScene_CraftingMenu::CheckRecipesAvailable()
|
|||
uiAlpha = 31;
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
if(pRecipeIngredientsRequired[CanBeMadeA[iIndex].iRecipeA[0]].bCanMake[getPad()])
|
||||
{
|
||||
uiAlpha = 31;
|
||||
|
|
@ -903,7 +903,7 @@ void IUIScene_CraftingMenu::UpdateHighlight()
|
|||
{
|
||||
iSlot=0;
|
||||
}
|
||||
std::shared_ptr<ItemInstance> pTempItemInstAdditional=pRecipeIngredientsRequired[CanBeMadeA[m_iCurrentSlotHIndex].iRecipeA[iSlot]].pRecipy->assemble(nullptr);
|
||||
shared_ptr<ItemInstance> pTempItemInstAdditional=pRecipeIngredientsRequired[CanBeMadeA[m_iCurrentSlotHIndex].iRecipeA[iSlot]].pRecipy->assemble(nullptr);
|
||||
|
||||
// special case for the torch coal/charcoal
|
||||
int id=pTempItemInstAdditional->getDescriptionId();
|
||||
|
|
@ -933,10 +933,10 @@ void IUIScene_CraftingMenu::UpdateHighlight()
|
|||
{
|
||||
itemstring=app.GetString( IDS_ITEM_FIREBALLCOAL );
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
itemstring=app.GetString(id );
|
||||
itemstring=app.GetString(id );
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -991,7 +991,7 @@ void IUIScene_CraftingMenu::UpdateVerticalSlots()
|
|||
{
|
||||
if(i!=1) continue;
|
||||
}
|
||||
std::shared_ptr<ItemInstance> pTempItemInstAdditional=pRecipeIngredientsRequired[CanBeMadeA[m_iCurrentSlotHIndex].iRecipeA[iVSlotIndexA[i]]].pRecipy->assemble(nullptr);
|
||||
shared_ptr<ItemInstance> pTempItemInstAdditional=pRecipeIngredientsRequired[CanBeMadeA[m_iCurrentSlotHIndex].iRecipeA[iVSlotIndexA[i]]].pRecipy->assemble(nullptr);
|
||||
|
||||
assert(pTempItemInstAdditional->id!=0);
|
||||
unsigned int uiAlpha;
|
||||
|
|
@ -1001,7 +1001,7 @@ void IUIScene_CraftingMenu::UpdateVerticalSlots()
|
|||
uiAlpha = 31;
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
if(pRecipeIngredientsRequired[CanBeMadeA[m_iCurrentSlotHIndex].iRecipeA[iVSlotIndexA[i]]].bCanMake[getPad()])
|
||||
{
|
||||
uiAlpha = 31;
|
||||
|
|
@ -1040,7 +1040,7 @@ void IUIScene_CraftingMenu::DisplayIngredients()
|
|||
hideAllIngredientsSlots();
|
||||
|
||||
if(CanBeMadeA[m_iCurrentSlotHIndex].iCount!=0)
|
||||
{
|
||||
{
|
||||
int iSlot,iRecipy;
|
||||
if(CanBeMadeA[m_iCurrentSlotHIndex].iCount>1)
|
||||
{
|
||||
|
|
@ -1057,7 +1057,7 @@ void IUIScene_CraftingMenu::DisplayIngredients()
|
|||
int iBoxWidth=(m_iContainerType==RECIPE_TYPE_2x2)?2:3;
|
||||
int iRecipe=CanBeMadeA[m_iCurrentSlotHIndex].iRecipeA[iSlot];
|
||||
bool bCanMakeRecipe = pRecipeIngredientsRequired[iRecipe].bCanMake[getPad()];
|
||||
std::shared_ptr<ItemInstance> pTempItemInst=pRecipeIngredientsRequired[iRecipe].pRecipy->assemble(nullptr);
|
||||
shared_ptr<ItemInstance> pTempItemInst=pRecipeIngredientsRequired[iRecipe].pRecipy->assemble(nullptr);
|
||||
|
||||
m_iIngredientsC=pRecipeIngredientsRequired[iRecipe].iIngC;
|
||||
|
||||
|
|
@ -1077,7 +1077,7 @@ void IUIScene_CraftingMenu::DisplayIngredients()
|
|||
iAuxVal = 0xFF;
|
||||
}
|
||||
|
||||
std::shared_ptr<ItemInstance> itemInst= std::shared_ptr<ItemInstance>(new ItemInstance(item,pRecipeIngredientsRequired[iRecipe].iIngValA[i],iAuxVal));
|
||||
shared_ptr<ItemInstance> itemInst= shared_ptr<ItemInstance>(new ItemInstance(item,pRecipeIngredientsRequired[iRecipe].iIngValA[i],iAuxVal));
|
||||
|
||||
setIngredientDescriptionItem(getPad(),i,itemInst);
|
||||
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;
|
||||
if(pRecipeIngredientsRequired[iRecipy].uiGridA[x+y*3]!=0)
|
||||
{
|
||||
{
|
||||
int id=pRecipeIngredientsRequired[iRecipy].uiGridA[x+y*3]&0x00FFFFFF;
|
||||
assert(id!=0);
|
||||
int iAuxVal=(pRecipeIngredientsRequired[iRecipy].uiGridA[x+y*3]&0xFF000000)>>24;
|
||||
|
|
@ -1141,7 +1141,7 @@ void IUIScene_CraftingMenu::DisplayIngredients()
|
|||
{
|
||||
iAuxVal = 0xFF;
|
||||
}
|
||||
std::shared_ptr<ItemInstance> itemInst= std::shared_ptr<ItemInstance>(new ItemInstance(id,1,iAuxVal));
|
||||
shared_ptr<ItemInstance> itemInst= shared_ptr<ItemInstance>(new ItemInstance(id,1,iAuxVal));
|
||||
setIngredientSlotItem(getPad(),index,itemInst);
|
||||
// show the ingredients we don't have if we can't make the recipe
|
||||
if(app.DebugSettingsOn() && app.GetGameSettingsDebugMask(ProfileManager.GetPrimaryPad())&(1L<<eDebugSetting_CraftAnything))
|
||||
|
|
@ -1149,7 +1149,7 @@ void IUIScene_CraftingMenu::DisplayIngredients()
|
|||
setIngredientSlotRedBox(index, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
if((pRecipeIngredientsRequired[iRecipy].usBitmaskMissingGridIngredients[getPad()]&(1<<(x+y*3)))!=0)
|
||||
{
|
||||
setIngredientSlotRedBox(index, true);
|
||||
|
|
@ -1164,7 +1164,7 @@ void IUIScene_CraftingMenu::DisplayIngredients()
|
|||
{
|
||||
setIngredientSlotRedBox(index, false);
|
||||
setIngredientSlotItem(getPad(),index,nullptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1188,7 +1188,7 @@ void IUIScene_CraftingMenu::DisplayIngredients()
|
|||
{
|
||||
setIngredientSlotRedBox(i, false);
|
||||
setIngredientSlotItem(getPad(),i,nullptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1205,7 +1205,7 @@ void IUIScene_CraftingMenu::UpdateDescriptionText(bool bCanBeMade)
|
|||
Recipy::INGREDIENTS_REQUIRED *pRecipeIngredientsRequired=Recipes::getInstance()->getRecipeIngredientsArray();
|
||||
|
||||
if(bCanBeMade)
|
||||
{
|
||||
{
|
||||
int iSlot;//,iRecipy;
|
||||
if(CanBeMadeA[m_iCurrentSlotHIndex].iCount>1)
|
||||
{
|
||||
|
|
@ -1218,7 +1218,7 @@ void IUIScene_CraftingMenu::UpdateDescriptionText(bool bCanBeMade)
|
|||
//iRecipy=CanBeMadeA[m_iCurrentSlotHIndex].iRecipeA[0];
|
||||
}
|
||||
|
||||
std::shared_ptr<ItemInstance> pTempItemInst=pRecipeIngredientsRequired[CanBeMadeA[m_iCurrentSlotHIndex].iRecipeA[iSlot]].pRecipy->assemble(nullptr);
|
||||
shared_ptr<ItemInstance> pTempItemInst=pRecipeIngredientsRequired[CanBeMadeA[m_iCurrentSlotHIndex].iRecipeA[iSlot]].pRecipy->assemble(nullptr);
|
||||
int iID=pTempItemInst->getItem()->id;
|
||||
int iAuxVal=pTempItemInst->getAuxValue();
|
||||
int iBaseType;
|
||||
|
|
@ -1278,13 +1278,13 @@ void IUIScene_CraftingMenu::UpdateDescriptionText(bool bCanBeMade)
|
|||
#ifdef _DEBUG
|
||||
setDescriptionText(L"This is some placeholder description text about the craftable item.");
|
||||
#else
|
||||
setDescriptionText(L"");
|
||||
setDescriptionText(L"");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
setDescriptionText(L"");
|
||||
setDescriptionText(L"");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1308,7 +1308,7 @@ void IUIScene_CraftingMenu::UpdateTooltips()
|
|||
{
|
||||
iSlot=iVSlotIndexA[m_iCurrentSlotVIndex];
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
iSlot=0;
|
||||
}
|
||||
|
|
@ -1348,7 +1348,7 @@ void IUIScene_CraftingMenu::UpdateTooltips()
|
|||
{
|
||||
iSlot=iVSlotIndexA[m_iCurrentSlotVIndex];
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
iSlot=0;
|
||||
}
|
||||
|
|
@ -1372,7 +1372,7 @@ bool IUIScene_CraftingMenu::isItemSelected(int itemId)
|
|||
{
|
||||
bool isSelected = false;
|
||||
if(m_pPlayer && m_pPlayer->inventory)
|
||||
{
|
||||
{
|
||||
//RecipyList *recipes = ((Recipes *)Recipes::getInstance())->getRecipies();
|
||||
Recipy::INGREDIENTS_REQUIRED *pRecipeIngredientsRequired=Recipes::getInstance()->getRecipeIngredientsArray();
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ protected:
|
|||
|
||||
static const int m_iMaxHSlotC = 12;
|
||||
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_iIngredients3x3SlotC = 9;
|
||||
static const int m_iIngredients2x2SlotC = 4;
|
||||
|
|
@ -35,7 +35,7 @@ protected:
|
|||
|
||||
static int m_iBaseTypeMapA[Item::eBaseItemType_MAXTYPES];
|
||||
|
||||
typedef struct
|
||||
typedef struct
|
||||
{
|
||||
int iCount;
|
||||
int iItemBaseType;
|
||||
|
|
@ -49,7 +49,7 @@ protected:
|
|||
int m_iCurrentSlotVIndex;
|
||||
int m_iRecipeC;
|
||||
int m_iContainerType; // 2x2 or 3x3
|
||||
std::shared_ptr<LocalPlayer> m_pPlayer;
|
||||
shared_ptr<LocalPlayer> m_pPlayer;
|
||||
int m_iGroupIndex;
|
||||
|
||||
int iVSlotIndexA[3]; // index of the v slots currently displayed
|
||||
|
|
@ -59,7 +59,7 @@ protected:
|
|||
static Recipy::_eGroupType m_GroupTypeMapping9GridA[m_iMaxGroup3x3];
|
||||
Recipy::_eGroupType *m_pGroupA;
|
||||
|
||||
static LPCWSTR m_GroupTabNameA[3];
|
||||
static LPCWSTR m_GroupTabNameA[3];
|
||||
static _eGroupTab m_GroupTabBkgMapping2x2A[m_iMaxGroup2x2];
|
||||
static _eGroupTab m_GroupTabBkgMapping3x3A[m_iMaxGroup3x3];
|
||||
_eGroupTab *m_pGroupTabA;
|
||||
|
|
@ -96,13 +96,13 @@ protected:
|
|||
virtual void hideAllHSlots() = 0;
|
||||
virtual void hideAllVSlots() = 0;
|
||||
virtual void hideAllIngredientsSlots() = 0;
|
||||
virtual void setCraftHSlotItem(int iPad, int iIndex, std::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, std::shared_ptr<ItemInstance> item) = 0;
|
||||
virtual void setCraftHSlotItem(int iPad, int iIndex, 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 setCraftingOutputSlotItem(int iPad, shared_ptr<ItemInstance> item) = 0;
|
||||
virtual void setCraftingOutputSlotRedBox(bool show) = 0;
|
||||
virtual void setIngredientSlotItem(int iPad, int index, std::shared_ptr<ItemInstance> item) = 0;
|
||||
virtual void setIngredientSlotItem(int iPad, int index, shared_ptr<ItemInstance> item) = 0;
|
||||
virtual void setIngredientSlotRedBox(int index, bool show) = 0;
|
||||
virtual void setIngredientDescriptionItem(int iPad, int index, std::shared_ptr<ItemInstance> item) = 0;
|
||||
virtual void setIngredientDescriptionItem(int iPad, int index, shared_ptr<ItemInstance> item) = 0;
|
||||
virtual void setIngredientDescriptionRedBox(int index, bool show) = 0;
|
||||
virtual void setIngredientDescriptionText(int index, LPCWSTR text) = 0;
|
||||
virtual void setShowCraftHSlot(int iIndex, bool show) = 0;
|
||||
|
|
|
|||
|
|
@ -12,16 +12,16 @@
|
|||
// 4J JEV - Images for each tab.
|
||||
IUIScene_CreativeMenu::TabSpec **IUIScene_CreativeMenu::specs = NULL;
|
||||
|
||||
vector< std::shared_ptr<ItemInstance> > IUIScene_CreativeMenu::categoryGroups[eCreativeInventoryGroupsCount];
|
||||
vector< shared_ptr<ItemInstance> > IUIScene_CreativeMenu::categoryGroups[eCreativeInventoryGroupsCount];
|
||||
|
||||
#define ITEM(id) list->push_back( std::shared_ptr<ItemInstance>(new ItemInstance(id, 1, 0)) );
|
||||
#define ITEM_AUX(id, aux) list->push_back( std::shared_ptr<ItemInstance>(new ItemInstance(id, 1, aux)) );
|
||||
#define ITEM(id) list->push_back( 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 DEF(index) list = &categoryGroups[index];
|
||||
|
||||
|
||||
void IUIScene_CreativeMenu::staticCtor()
|
||||
{
|
||||
vector< std::shared_ptr<ItemInstance> > *list;
|
||||
vector< shared_ptr<ItemInstance> > *list;
|
||||
|
||||
|
||||
// Building Blocks
|
||||
|
|
@ -56,7 +56,7 @@ void IUIScene_CreativeMenu::staticCtor()
|
|||
ITEM_AUX(Tile::treeTrunk_Id, 0)
|
||||
ITEM_AUX(Tile::treeTrunk_Id, TreeTile::DARK_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::redBrick_Id)
|
||||
ITEM(Tile::mossStone_Id)
|
||||
|
|
@ -118,7 +118,7 @@ void IUIScene_CreativeMenu::staticCtor()
|
|||
ITEM(Tile::sponge_Id)
|
||||
ITEM(Tile::melon_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_EVERGREEN)
|
||||
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(Item::bed_Id)
|
||||
ITEM(Item::bucket_empty_Id)
|
||||
ITEM(Item::bucket_lava_Id)
|
||||
ITEM(Item::bucket_lava_Id)
|
||||
ITEM(Item::bucket_water_Id)
|
||||
ITEM(Item::milk_Id)
|
||||
ITEM(Item::cauldron_Id)
|
||||
|
|
@ -292,7 +292,7 @@ void IUIScene_CreativeMenu::staticCtor()
|
|||
ITEM(Item::beef_cooked_Id)
|
||||
ITEM(Item::beef_raw_Id)
|
||||
ITEM(Item::chicken_raw_Id)
|
||||
ITEM(Item::chicken_cooked_Id)
|
||||
ITEM(Item::chicken_cooked_Id)
|
||||
ITEM(Item::rotten_flesh_Id)
|
||||
ITEM(Item::spiderEye_Id)
|
||||
ITEM(Item::potato_Id)
|
||||
|
|
@ -314,7 +314,7 @@ void IUIScene_CreativeMenu::staticCtor()
|
|||
ITEM(Item::pickAxe_wood_Id)
|
||||
ITEM(Item::hatchet_wood_Id)
|
||||
ITEM(Item::hoe_wood_Id)
|
||||
|
||||
|
||||
ITEM(Item::map_Id)
|
||||
ITEM(Item::helmet_chain_Id)
|
||||
ITEM(Item::chestplate_chain_Id)
|
||||
|
|
@ -325,7 +325,7 @@ void IUIScene_CreativeMenu::staticCtor()
|
|||
ITEM(Item::pickAxe_stone_Id)
|
||||
ITEM(Item::hatchet_stone_Id)
|
||||
ITEM(Item::hoe_stone_Id)
|
||||
|
||||
|
||||
ITEM(Item::bow_Id)
|
||||
ITEM(Item::helmet_iron_Id)
|
||||
ITEM(Item::chestplate_iron_Id)
|
||||
|
|
@ -336,7 +336,7 @@ void IUIScene_CreativeMenu::staticCtor()
|
|||
ITEM(Item::pickAxe_iron_Id)
|
||||
ITEM(Item::hatchet_iron_Id)
|
||||
ITEM(Item::hoe_iron_Id)
|
||||
|
||||
|
||||
ITEM(Item::arrow_Id)
|
||||
ITEM(Item::helmet_gold_Id)
|
||||
ITEM(Item::chestplate_gold_Id)
|
||||
|
|
@ -384,7 +384,7 @@ void IUIScene_CreativeMenu::staticCtor()
|
|||
ITEM(Item::brick_Id)
|
||||
ITEM(Item::netherbrick_Id)
|
||||
ITEM(Item::stick_Id)
|
||||
ITEM(Item::bowl_Id)
|
||||
ITEM(Item::bowl_Id)
|
||||
ITEM(Item::bone_Id)
|
||||
ITEM(Item::string_Id)
|
||||
ITEM(Item::feather_Id)
|
||||
|
|
@ -393,13 +393,13 @@ void IUIScene_CreativeMenu::staticCtor()
|
|||
ITEM(Item::sulphur_Id)
|
||||
ITEM(Item::clay_Id)
|
||||
ITEM(Item::yellowDust_Id)
|
||||
ITEM(Item::seeds_wheat_Id)
|
||||
ITEM(Item::seeds_wheat_Id)
|
||||
ITEM(Item::seeds_melon_Id)
|
||||
ITEM(Item::seeds_pumpkin_Id)
|
||||
ITEM(Item::wheat_Id)
|
||||
ITEM(Item::reeds_Id)
|
||||
ITEM(Item::egg_Id)
|
||||
ITEM(Item::sugar_Id)
|
||||
ITEM(Item::sugar_Id)
|
||||
ITEM(Item::slimeBall_Id)
|
||||
ITEM(Item::blazeRod_Id)
|
||||
ITEM(Item::goldNugget_Id)
|
||||
|
|
@ -432,7 +432,7 @@ void IUIScene_CreativeMenu::staticCtor()
|
|||
ITEM(Item::magmaCream_Id)
|
||||
ITEM(Item::speckledMelon_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
|
||||
|
||||
|
||||
|
|
@ -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_NIGHTVISION))
|
||||
//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, MASK_LEVEL2, MASK_STRENGTH))
|
||||
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;
|
||||
|
||||
// 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_tabPage[i] = 0;
|
||||
|
|
@ -594,7 +594,7 @@ void IUIScene_CreativeMenu::switchTab(ECreativeInventoryTabs tab)
|
|||
if(tab != m_curTab) updateTabHighlightAndText(tab);
|
||||
|
||||
m_curTab = tab;
|
||||
|
||||
|
||||
updateScrollCurrentPage(m_tabPage[m_curTab] + 1, specs[m_curTab]->getPageCount());
|
||||
|
||||
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)
|
||||
: m_icon(icon), m_descriptionId(descriptionId), m_staticGroupsCount(staticGroupsCount), m_dynamicGroupsCount(dynamicGroupsCount)
|
||||
{
|
||||
|
||||
|
||||
m_pages = 0;
|
||||
m_staticGroupsA = NULL;
|
||||
|
||||
|
|
@ -708,10 +708,10 @@ unsigned int IUIScene_CreativeMenu::TabSpec::getPageCount()
|
|||
|
||||
|
||||
// 4J JEV - Item Picker Menu
|
||||
IUIScene_CreativeMenu::ItemPickerMenu::ItemPickerMenu( std::shared_ptr<SimpleContainer> smp, std::shared_ptr<Inventory> inv ) : AbstractContainerMenu()
|
||||
IUIScene_CreativeMenu::ItemPickerMenu::ItemPickerMenu( shared_ptr<SimpleContainer> smp, shared_ptr<Inventory> inv ) : AbstractContainerMenu()
|
||||
{
|
||||
inventory = inv;
|
||||
creativeContainer = smp;
|
||||
creativeContainer = smp;
|
||||
|
||||
//int startLength = slots->size();
|
||||
|
||||
|
|
@ -734,7 +734,7 @@ IUIScene_CreativeMenu::ItemPickerMenu::ItemPickerMenu( std::shared_ptr<SimpleCon
|
|||
containerId = CONTAINER_ID_CREATIVE;
|
||||
}
|
||||
|
||||
bool IUIScene_CreativeMenu::ItemPickerMenu::stillValid(std::shared_ptr<Player> player)
|
||||
bool IUIScene_CreativeMenu::ItemPickerMenu::stillValid(shared_ptr<Player> player)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
@ -752,7 +752,7 @@ IUIScene_AbstractContainerMenu::ESceneSection IUIScene_CreativeMenu::GetSectionA
|
|||
switch( eSection )
|
||||
{
|
||||
case eSectionInventoryCreativeSelector:
|
||||
if (eTapDirection == eTapStateDown || eTapDirection == eTapStateUp)
|
||||
if (eTapDirection == eTapStateDown || eTapDirection == eTapStateUp)
|
||||
{
|
||||
newSection = eSectionInventoryCreativeUsing;
|
||||
}
|
||||
|
|
@ -794,7 +794,7 @@ bool IUIScene_CreativeMenu::handleValidKeyPress(int iPad, int buttonNum, BOOL qu
|
|||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||
for(unsigned int i = TabSpec::MAX_SIZE; i < TabSpec::MAX_SIZE + 9; ++i)
|
||||
{
|
||||
std::shared_ptr<ItemInstance> newItem = m_menu->getSlot(i)->getItem();
|
||||
shared_ptr<ItemInstance> newItem = m_menu->getSlot(i)->getItem();
|
||||
|
||||
if(newItem != NULL)
|
||||
{
|
||||
|
|
@ -813,7 +813,7 @@ void IUIScene_CreativeMenu::handleOutsideClicked(int iPad, int buttonNum, BOOL q
|
|||
// Drop items.
|
||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||
|
||||
std::shared_ptr<Inventory> playerInventory = pMinecraft->localplayers[iPad]->inventory;
|
||||
shared_ptr<Inventory> playerInventory = pMinecraft->localplayers[iPad]->inventory;
|
||||
if (playerInventory->getCarried() != NULL)
|
||||
{
|
||||
if (buttonNum == 0)
|
||||
|
|
@ -823,7 +823,7 @@ void IUIScene_CreativeMenu::handleOutsideClicked(int iPad, int buttonNum, BOOL q
|
|||
}
|
||||
if (buttonNum == 1)
|
||||
{
|
||||
std::shared_ptr<ItemInstance> removedItem = playerInventory->getCarried()->remove(1);
|
||||
shared_ptr<ItemInstance> removedItem = playerInventory->getCarried()->remove(1);
|
||||
pMinecraft->localgameModes[iPad]->handleCreativeModeItemDrop(removedItem);
|
||||
if (playerInventory->getCarried()->count == 0) playerInventory->setCarried(nullptr);
|
||||
}
|
||||
|
|
@ -841,7 +841,7 @@ void IUIScene_CreativeMenu::handleAdditionalKeyPress(int iAction)
|
|||
dir = -1;
|
||||
// Fall through intentional
|
||||
case ACTION_MENU_RIGHT_SCROLL:
|
||||
{
|
||||
{
|
||||
ECreativeInventoryTabs tab = (ECreativeInventoryTabs)(m_curTab + dir);
|
||||
if (tab < 0) tab = (ECreativeInventoryTabs)(eCreativeInventoryTab_COUNT - 1);
|
||||
if (tab >= eCreativeInventoryTab_COUNT) tab = eCreativeInventoryTab_BuildingBlocks;
|
||||
|
|
@ -894,9 +894,9 @@ void IUIScene_CreativeMenu::handleSlotListClicked(ESceneSection eSection, int bu
|
|||
if (buttonNum == 0)
|
||||
{
|
||||
|
||||
std::shared_ptr<Inventory> playerInventory = pMinecraft->localplayers[getPad()]->inventory;
|
||||
std::shared_ptr<ItemInstance> carried = playerInventory->getCarried();
|
||||
std::shared_ptr<ItemInstance> clicked = m_menu->getSlot(currentIndex)->getItem();
|
||||
shared_ptr<Inventory> playerInventory = pMinecraft->localplayers[getPad()]->inventory;
|
||||
shared_ptr<ItemInstance> carried = playerInventory->getCarried();
|
||||
shared_ptr<ItemInstance> clicked = m_menu->getSlot(currentIndex)->getItem();
|
||||
if (clicked != NULL)
|
||||
{
|
||||
playerInventory->setCarried(ItemInstance::clone(clicked));
|
||||
|
|
@ -928,7 +928,7 @@ void IUIScene_CreativeMenu::handleSlotListClicked(ESceneSection eSection, int bu
|
|||
quickKeyHeld = FALSE;
|
||||
}
|
||||
m_menu->clicked(currentIndex, buttonNum, quickKeyHeld?AbstractContainerMenu::CLICK_QUICK_MOVE:AbstractContainerMenu::CLICK_PICKUP, pMinecraft->localplayers[getPad()]);
|
||||
std::shared_ptr<ItemInstance> newItem = m_menu->getSlot(currentIndex)->getItem();
|
||||
shared_ptr<ItemInstance> newItem = m_menu->getSlot(currentIndex)->getItem();
|
||||
// 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);
|
||||
|
||||
|
|
@ -941,7 +941,7 @@ void IUIScene_CreativeMenu::handleSlotListClicked(ESceneSection eSection, int bu
|
|||
m_iCurrSlotX = m_creativeSlotX;
|
||||
m_iCurrSlotY = m_creativeSlotY;
|
||||
|
||||
std::shared_ptr<Inventory> playerInventory = pMinecraft->localplayers[getPad()]->inventory;
|
||||
shared_ptr<Inventory> playerInventory = pMinecraft->localplayers[getPad()]->inventory;
|
||||
playerInventory->setCarried(nullptr);
|
||||
m_bCarryingCreativeItem = false;
|
||||
}
|
||||
|
|
@ -970,14 +970,14 @@ bool IUIScene_CreativeMenu::CanHaveFocus( ESceneSection eSection )
|
|||
return false;
|
||||
}
|
||||
|
||||
bool IUIScene_CreativeMenu::getEmptyInventorySlot(std::shared_ptr<ItemInstance> item, int &slotX)
|
||||
bool IUIScene_CreativeMenu::getEmptyInventorySlot(shared_ptr<ItemInstance> item, int &slotX)
|
||||
{
|
||||
bool sameItemFound = false;
|
||||
bool emptySlotFound = false;
|
||||
// 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)
|
||||
{
|
||||
std::shared_ptr<ItemInstance> slotItem = m_menu->getSlot(i)->getItem();
|
||||
shared_ptr<ItemInstance> slotItem = m_menu->getSlot(i)->getItem();
|
||||
if( slotItem != NULL && slotItem->sameItem(item) && (slotItem->GetCount() + item->GetCount() <= item->getMaxStackSize() ))
|
||||
{
|
||||
sameItemFound = true;
|
||||
|
|
@ -1020,7 +1020,7 @@ int IUIScene_CreativeMenu::getSectionStartOffset(ESceneSection eSection)
|
|||
return offset;
|
||||
}
|
||||
|
||||
bool IUIScene_CreativeMenu::overrideTooltips(ESceneSection sectionUnderPointer, std::shared_ptr<ItemInstance> itemUnderPointer, bool bIsItemCarried, bool bSlotHasItem, bool bCarriedIsSameAsSlot, int iSlotStackSizeRemaining,
|
||||
bool IUIScene_CreativeMenu::overrideTooltips(ESceneSection sectionUnderPointer, shared_ptr<ItemInstance> itemUnderPointer, bool bIsItemCarried, bool bSlotHasItem, bool bCarriedIsSameAsSlot, int iSlotStackSizeRemaining,
|
||||
EToolTipItem &buttonA, EToolTipItem &buttonX, EToolTipItem &buttonY, EToolTipItem &buttonRT)
|
||||
{
|
||||
bool _override = false;
|
||||
|
|
|
|||
|
|
@ -74,21 +74,21 @@ public:
|
|||
class ItemPickerMenu : public AbstractContainerMenu
|
||||
{
|
||||
protected:
|
||||
std::shared_ptr<SimpleContainer> creativeContainer;
|
||||
std::shared_ptr<Inventory> inventory;
|
||||
shared_ptr<SimpleContainer> creativeContainer;
|
||||
shared_ptr<Inventory> inventory;
|
||||
|
||||
public:
|
||||
ItemPickerMenu( std::shared_ptr<SimpleContainer> creativeContainer, std::shared_ptr<Inventory> inventory );
|
||||
ItemPickerMenu( shared_ptr<SimpleContainer> creativeContainer, shared_ptr<Inventory> inventory );
|
||||
|
||||
virtual bool stillValid(std::shared_ptr<Player> player);
|
||||
virtual bool stillValid(shared_ptr<Player> player);
|
||||
bool isOverrideResultClick(int slotNum, int buttonNum);
|
||||
protected:
|
||||
// 4J Stu - Brought forward from 1.2 to fix infinite recursion bug in creative
|
||||
virtual void loopClick(int slotIndex, int buttonNum, bool quickKeyHeld, std::shared_ptr<Player> player) { } // do nothing
|
||||
virtual void loopClick(int slotIndex, int buttonNum, bool quickKeyHeld, shared_ptr<Player> player) { } // do nothing
|
||||
} *itemPickerMenu;
|
||||
|
||||
protected:
|
||||
static vector< std::shared_ptr<ItemInstance> > categoryGroups[eCreativeInventoryGroupsCount];
|
||||
static vector< shared_ptr<ItemInstance> > categoryGroups[eCreativeInventoryGroupsCount];
|
||||
// 4J JEV - Tabs
|
||||
static TabSpec **specs;
|
||||
|
||||
|
|
@ -112,11 +112,11 @@ protected:
|
|||
virtual void handleOutsideClicked(int iPad, int buttonNum, BOOL quickKeyHeld);
|
||||
virtual void handleAdditionalKeyPress(int iAction);
|
||||
virtual void handleSlotListClicked(ESceneSection eSection, int buttonNum, BOOL quickKeyHeld);
|
||||
bool getEmptyInventorySlot(std::shared_ptr<ItemInstance> item, int &slotX);
|
||||
bool getEmptyInventorySlot(shared_ptr<ItemInstance> item, int &slotX);
|
||||
int getSectionStartOffset(ESceneSection eSection);
|
||||
virtual bool IsSectionSlotList( ESceneSection eSection );
|
||||
virtual bool CanHaveFocus( ESceneSection eSection );
|
||||
|
||||
virtual bool overrideTooltips(ESceneSection sectionUnderPointer, std::shared_ptr<ItemInstance> itemUnderPointer, bool bIsItemCarried, bool bSlotHasItem, bool bCarriedIsSameAsSlot, int iSlotStackSizeRemaining,
|
||||
virtual bool overrideTooltips(ESceneSection sectionUnderPointer, shared_ptr<ItemInstance> itemUnderPointer, bool bIsItemCarried, bool bSlotHasItem, bool bCarriedIsSameAsSlot, int iSlotStackSizeRemaining,
|
||||
EToolTipItem &buttonA, EToolTipItem &buttonX, EToolTipItem &buttonY, EToolTipItem &buttonRT);
|
||||
};
|
||||
|
|
@ -16,7 +16,7 @@ IUIScene_TradingMenu::IUIScene_TradingMenu()
|
|||
m_bHasUpdatedOnce = false;
|
||||
}
|
||||
|
||||
std::shared_ptr<Merchant> IUIScene_TradingMenu::getMerchant()
|
||||
shared_ptr<Merchant> IUIScene_TradingMenu::getMerchant()
|
||||
{
|
||||
return m_merchant;
|
||||
}
|
||||
|
|
@ -46,11 +46,11 @@ bool IUIScene_TradingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat)
|
|||
|
||||
switch(iAction)
|
||||
{
|
||||
case ACTION_MENU_B:
|
||||
case ACTION_MENU_B:
|
||||
ui.ShowTooltip( iPad, eToolTipButtonX, false );
|
||||
ui.ShowTooltip( iPad, eToolTipButtonB, false );
|
||||
ui.ShowTooltip( iPad, eToolTipButtonA, false );
|
||||
ui.ShowTooltip( iPad, eToolTipButtonRB, false );
|
||||
ui.ShowTooltip( iPad, eToolTipButtonA, false );
|
||||
ui.ShowTooltip( iPad, eToolTipButtonRB, false );
|
||||
// kill the crafting xui
|
||||
//ui.PlayUISFX(eSFX_Back);
|
||||
ui.CloseUIScenes(iPad);
|
||||
|
|
@ -70,9 +70,9 @@ bool IUIScene_TradingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat)
|
|||
if(!activeRecipe->isDeprecated())
|
||||
{
|
||||
// Do we have the ingredients?
|
||||
std::shared_ptr<ItemInstance> buyAItem = activeRecipe->getBuyAItem();
|
||||
std::shared_ptr<ItemInstance> buyBItem = activeRecipe->getBuyBItem();
|
||||
std::shared_ptr<MultiplayerLocalPlayer> player = Minecraft::GetInstance()->localplayers[getPad()];
|
||||
shared_ptr<ItemInstance> buyAItem = activeRecipe->getBuyAItem();
|
||||
shared_ptr<ItemInstance> buyBItem = activeRecipe->getBuyBItem();
|
||||
shared_ptr<MultiplayerLocalPlayer> player = Minecraft::GetInstance()->localplayers[getPad()];
|
||||
int buyAMatches = player->inventory->countMatches(buyAItem);
|
||||
int buyBMatches = player->inventory->countMatches(buyBItem);
|
||||
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);
|
||||
|
||||
// Add the item we have purchased
|
||||
std::shared_ptr<ItemInstance> result = activeRecipe->getSellItem()->copy();
|
||||
shared_ptr<ItemInstance> result = activeRecipe->getSellItem()->copy();
|
||||
if(!player->inventory->add( result ) )
|
||||
{
|
||||
player->drop(result);
|
||||
|
|
@ -92,7 +92,7 @@ bool IUIScene_TradingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat)
|
|||
|
||||
// Send a packet to the server
|
||||
int actualShopItem = m_activeOffers.at(selectedShopItem).second;
|
||||
player->connection->send( std::shared_ptr<TradeItemPacket>( new TradeItemPacket(m_menu->containerId, actualShopItem) ) );
|
||||
player->connection->send( shared_ptr<TradeItemPacket>( new TradeItemPacket(m_menu->containerId, actualShopItem) ) );
|
||||
|
||||
updateDisplay();
|
||||
}
|
||||
|
|
@ -149,7 +149,7 @@ bool IUIScene_TradingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat)
|
|||
ByteArrayOutputStream rawOutput;
|
||||
DataOutputStream output(&rawOutput);
|
||||
output.writeInt(actualShopItem);
|
||||
Minecraft::GetInstance()->getConnection(getPad())->send(std::shared_ptr<CustomPayloadPacket>( new CustomPayloadPacket(CustomPayloadPacket::TRADER_SELECTION_PACKET, rawOutput.toByteArray())));
|
||||
Minecraft::GetInstance()->getConnection(getPad())->send(shared_ptr<CustomPayloadPacket>( new CustomPayloadPacket(CustomPayloadPacket::TRADER_SELECTION_PACKET, rawOutput.toByteArray())));
|
||||
}
|
||||
}
|
||||
return handled;
|
||||
|
|
@ -203,7 +203,7 @@ void IUIScene_TradingMenu::updateDisplay()
|
|||
ByteArrayOutputStream rawOutput;
|
||||
DataOutputStream output(&rawOutput);
|
||||
output.writeInt(firstValidTrade);
|
||||
Minecraft::GetInstance()->getConnection(getPad())->send(std::shared_ptr<CustomPayloadPacket>( new CustomPayloadPacket(CustomPayloadPacket::TRADER_SELECTION_PACKET, rawOutput.toByteArray())));
|
||||
Minecraft::GetInstance()->getConnection(getPad())->send(shared_ptr<CustomPayloadPacket>( new CustomPayloadPacket(CustomPayloadPacket::TRADER_SELECTION_PACKET, rawOutput.toByteArray())));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -247,9 +247,9 @@ void IUIScene_TradingMenu::updateDisplay()
|
|||
vector<wstring> unformattedStrings;
|
||||
wstring offerDescription = GetItemDescription(activeRecipe->getSellItem(), unformattedStrings);
|
||||
setOfferDescription(offerDescription, unformattedStrings);
|
||||
|
||||
std::shared_ptr<ItemInstance> buyAItem = activeRecipe->getBuyAItem();
|
||||
std::shared_ptr<ItemInstance> buyBItem = activeRecipe->getBuyBItem();
|
||||
|
||||
shared_ptr<ItemInstance> buyAItem = activeRecipe->getBuyAItem();
|
||||
shared_ptr<ItemInstance> buyBItem = activeRecipe->getBuyBItem();
|
||||
|
||||
setRequest1Item(buyAItem);
|
||||
setRequest2Item(buyBItem);
|
||||
|
|
@ -262,7 +262,7 @@ void IUIScene_TradingMenu::updateDisplay()
|
|||
|
||||
bool canMake = true;
|
||||
|
||||
std::shared_ptr<MultiplayerLocalPlayer> player = Minecraft::GetInstance()->localplayers[getPad()];
|
||||
shared_ptr<MultiplayerLocalPlayer> player = Minecraft::GetInstance()->localplayers[getPad()];
|
||||
int buyAMatches = player->inventory->countMatches(buyAItem);
|
||||
if(buyAMatches > 0)
|
||||
{
|
||||
|
|
@ -321,10 +321,10 @@ bool IUIScene_TradingMenu::canMake(MerchantRecipe *recipe)
|
|||
{
|
||||
if(recipe->isDeprecated()) return false;
|
||||
|
||||
std::shared_ptr<ItemInstance> buyAItem = recipe->getBuyAItem();
|
||||
std::shared_ptr<ItemInstance> buyBItem = recipe->getBuyBItem();
|
||||
shared_ptr<ItemInstance> buyAItem = recipe->getBuyAItem();
|
||||
shared_ptr<ItemInstance> buyBItem = recipe->getBuyBItem();
|
||||
|
||||
std::shared_ptr<MultiplayerLocalPlayer> player = Minecraft::GetInstance()->localplayers[getPad()];
|
||||
shared_ptr<MultiplayerLocalPlayer> player = Minecraft::GetInstance()->localplayers[getPad()];
|
||||
int buyAMatches = player->inventory->countMatches(buyAItem);
|
||||
if(buyAMatches > 0)
|
||||
{
|
||||
|
|
@ -349,19 +349,19 @@ bool IUIScene_TradingMenu::canMake(MerchantRecipe *recipe)
|
|||
}
|
||||
|
||||
|
||||
void IUIScene_TradingMenu::setRequest1Item(std::shared_ptr<ItemInstance> item)
|
||||
void IUIScene_TradingMenu::setRequest1Item(shared_ptr<ItemInstance> item)
|
||||
{
|
||||
}
|
||||
|
||||
void IUIScene_TradingMenu::setRequest2Item(std::shared_ptr<ItemInstance> item)
|
||||
void IUIScene_TradingMenu::setRequest2Item(shared_ptr<ItemInstance> item)
|
||||
{
|
||||
}
|
||||
|
||||
void IUIScene_TradingMenu::setTradeItem(int index, std::shared_ptr<ItemInstance> item)
|
||||
void IUIScene_TradingMenu::setTradeItem(int index, shared_ptr<ItemInstance> item)
|
||||
{
|
||||
}
|
||||
|
||||
wstring IUIScene_TradingMenu::GetItemDescription(std::shared_ptr<ItemInstance> item, vector<wstring> &unformattedStrings)
|
||||
wstring IUIScene_TradingMenu::GetItemDescription(shared_ptr<ItemInstance> item, vector<wstring> &unformattedStrings)
|
||||
{
|
||||
if(item == NULL) return L"";
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ class IUIScene_TradingMenu
|
|||
{
|
||||
protected:
|
||||
MerchantMenu *m_menu;
|
||||
std::shared_ptr<Merchant> m_merchant;
|
||||
shared_ptr<Merchant> m_merchant;
|
||||
vector< pair<MerchantRecipe *,int> > m_activeOffers;
|
||||
|
||||
int m_validOffersCount;
|
||||
|
|
@ -39,20 +39,20 @@ protected:
|
|||
virtual void setRequest1RedBox(bool show) = 0;
|
||||
virtual void setRequest2RedBox(bool show) = 0;
|
||||
virtual void setTradeRedBox(int index, bool show) = 0;
|
||||
|
||||
|
||||
virtual void setOfferDescription(const wstring &name, vector<wstring> &unformattedStrings) = 0;
|
||||
|
||||
virtual void setRequest1Item(std::shared_ptr<ItemInstance> item);
|
||||
virtual void setRequest2Item(std::shared_ptr<ItemInstance> item);
|
||||
virtual void setTradeItem(int index, std::shared_ptr<ItemInstance> item);
|
||||
virtual void setRequest1Item(shared_ptr<ItemInstance> item);
|
||||
virtual void setRequest2Item(shared_ptr<ItemInstance> item);
|
||||
virtual void setTradeItem(int index, shared_ptr<ItemInstance> item);
|
||||
|
||||
private:
|
||||
void updateDisplay();
|
||||
bool canMake(MerchantRecipe *recipe);
|
||||
wstring GetItemDescription(std::shared_ptr<ItemInstance> item, vector<wstring> &unformattedStrings);
|
||||
wstring GetItemDescription(shared_ptr<ItemInstance> item, vector<wstring> &unformattedStrings);
|
||||
|
||||
public:
|
||||
std::shared_ptr<Merchant> getMerchant();
|
||||
shared_ptr<Merchant> getMerchant();
|
||||
|
||||
virtual int getPad() = 0;
|
||||
};
|
||||
|
|
@ -47,7 +47,7 @@ void UIComponent_Panorama::tick()
|
|||
EnterCriticalSection(&pMinecraft->m_setLevelCS);
|
||||
if(pMinecraft->level!=NULL)
|
||||
{
|
||||
int64_t i64TimeOfDay =0;
|
||||
__int64 i64TimeOfDay =0;
|
||||
// are we in the Nether? - Leave the time as 0 if we are, so we show daylight
|
||||
if(pMinecraft->level->dimension->id==0)
|
||||
{
|
||||
|
|
@ -104,7 +104,7 @@ void UIComponent_Panorama::render(S32 width, S32 height, C4JRender::eViewportTyp
|
|||
IggyPlayerSetDisplaySize( getMovie(), m_movieWidth, m_movieHeight );
|
||||
|
||||
IggyPlayerDrawTilesStart ( getMovie() );
|
||||
|
||||
|
||||
m_renderWidth = tileWidth;
|
||||
m_renderHeight = tileHeight;
|
||||
IggyPlayerDrawTile ( getMovie() ,
|
||||
|
|
@ -112,7 +112,7 @@ void UIComponent_Panorama::render(S32 width, S32 height, C4JRender::eViewportTyp
|
|||
tileYStart ,
|
||||
tileXStart + tileWidth ,
|
||||
tileYStart + tileHeight ,
|
||||
0 );
|
||||
0 );
|
||||
IggyPlayerDrawTilesEnd ( getMovie() );
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
{
|
||||
m_interactScene = interactScene;
|
||||
app.DebugPrintf("Setting m_interactScene to %08x\n", m_interactScene);
|
||||
if( interactScene != m_lastInteractSceneMoved ) m_lastInteractSceneMoved = NULL;
|
||||
|
|
@ -204,12 +204,12 @@ wstring UIComponent_TutorialPopup::_SetIcon(int icon, int iAuxVal, bool isFoil,
|
|||
wstring temp(desc);
|
||||
|
||||
bool isFixedIcon = false;
|
||||
|
||||
|
||||
m_iconIsFoil = isFoil;
|
||||
if( icon != TUTORIAL_NO_ICON )
|
||||
{
|
||||
m_iconIsFoil = false;
|
||||
m_iconItem = std::shared_ptr<ItemInstance>(new ItemInstance(icon,1,iAuxVal));
|
||||
m_iconItem = shared_ptr<ItemInstance>(new ItemInstance(icon,1,iAuxVal));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -238,72 +238,72 @@ wstring UIComponent_TutorialPopup::_SetIcon(int icon, int iAuxVal, bool isFoil,
|
|||
{
|
||||
iAuxVal = 0;
|
||||
}
|
||||
m_iconItem = std::shared_ptr<ItemInstance>(new ItemInstance(iconId,1,iAuxVal));
|
||||
m_iconItem = shared_ptr<ItemInstance>(new ItemInstance(iconId,1,iAuxVal));
|
||||
|
||||
temp.replace(iconTagStartPos, iconEndPos - iconTagStartPos + closeTag.length(), L"");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// remove any icon text
|
||||
else if(temp.find(L"{*CraftingTableIcon*}")!=wstring::npos)
|
||||
{
|
||||
m_iconItem = std::shared_ptr<ItemInstance>(new ItemInstance(Tile::workBench_Id,1,0));
|
||||
m_iconItem = shared_ptr<ItemInstance>(new ItemInstance(Tile::workBench_Id,1,0));
|
||||
}
|
||||
else if(temp.find(L"{*SticksIcon*}")!=wstring::npos)
|
||||
{
|
||||
m_iconItem = std::shared_ptr<ItemInstance>(new ItemInstance(Item::stick_Id,1,0));
|
||||
m_iconItem = shared_ptr<ItemInstance>(new ItemInstance(Item::stick_Id,1,0));
|
||||
}
|
||||
else if(temp.find(L"{*PlanksIcon*}")!=wstring::npos)
|
||||
{
|
||||
m_iconItem = std::shared_ptr<ItemInstance>(new ItemInstance(Tile::wood_Id,1,0));
|
||||
m_iconItem = shared_ptr<ItemInstance>(new ItemInstance(Tile::wood_Id,1,0));
|
||||
}
|
||||
else if(temp.find(L"{*WoodenShovelIcon*}")!=wstring::npos)
|
||||
{
|
||||
m_iconItem = std::shared_ptr<ItemInstance>(new ItemInstance(Item::shovel_wood_Id,1,0));
|
||||
m_iconItem = shared_ptr<ItemInstance>(new ItemInstance(Item::shovel_wood_Id,1,0));
|
||||
}
|
||||
else if(temp.find(L"{*WoodenHatchetIcon*}")!=wstring::npos)
|
||||
{
|
||||
m_iconItem = std::shared_ptr<ItemInstance>(new ItemInstance(Item::hatchet_wood_Id,1,0));
|
||||
m_iconItem = shared_ptr<ItemInstance>(new ItemInstance(Item::hatchet_wood_Id,1,0));
|
||||
}
|
||||
else if(temp.find(L"{*WoodenPickaxeIcon*}")!=wstring::npos)
|
||||
{
|
||||
m_iconItem = std::shared_ptr<ItemInstance>(new ItemInstance(Item::pickAxe_wood_Id,1,0));
|
||||
m_iconItem = shared_ptr<ItemInstance>(new ItemInstance(Item::pickAxe_wood_Id,1,0));
|
||||
}
|
||||
else if(temp.find(L"{*FurnaceIcon*}")!=wstring::npos)
|
||||
{
|
||||
m_iconItem = std::shared_ptr<ItemInstance>(new ItemInstance(Tile::furnace_Id,1,0));
|
||||
m_iconItem = shared_ptr<ItemInstance>(new ItemInstance(Tile::furnace_Id,1,0));
|
||||
}
|
||||
else if(temp.find(L"{*WoodenDoorIcon*}")!=wstring::npos)
|
||||
{
|
||||
m_iconItem = std::shared_ptr<ItemInstance>(new ItemInstance(Item::door_wood,1,0));
|
||||
m_iconItem = shared_ptr<ItemInstance>(new ItemInstance(Item::door_wood,1,0));
|
||||
}
|
||||
else if(temp.find(L"{*TorchIcon*}")!=wstring::npos)
|
||||
{
|
||||
m_iconItem = std::shared_ptr<ItemInstance>(new ItemInstance(Tile::torch_Id,1,0));
|
||||
m_iconItem = shared_ptr<ItemInstance>(new ItemInstance(Tile::torch_Id,1,0));
|
||||
}
|
||||
else if(temp.find(L"{*BoatIcon*}")!=wstring::npos)
|
||||
{
|
||||
m_iconItem = std::shared_ptr<ItemInstance>(new ItemInstance(Item::boat_Id,1,0));
|
||||
m_iconItem = shared_ptr<ItemInstance>(new ItemInstance(Item::boat_Id,1,0));
|
||||
}
|
||||
else if(temp.find(L"{*FishingRodIcon*}")!=wstring::npos)
|
||||
{
|
||||
m_iconItem = std::shared_ptr<ItemInstance>(new ItemInstance(Item::fishingRod_Id,1,0));
|
||||
m_iconItem = shared_ptr<ItemInstance>(new ItemInstance(Item::fishingRod_Id,1,0));
|
||||
}
|
||||
else if(temp.find(L"{*FishIcon*}")!=wstring::npos)
|
||||
{
|
||||
m_iconItem = std::shared_ptr<ItemInstance>(new ItemInstance(Item::fish_raw_Id,1,0));
|
||||
m_iconItem = shared_ptr<ItemInstance>(new ItemInstance(Item::fish_raw_Id,1,0));
|
||||
}
|
||||
else if(temp.find(L"{*MinecartIcon*}")!=wstring::npos)
|
||||
{
|
||||
m_iconItem = std::shared_ptr<ItemInstance>(new ItemInstance(Item::minecart_Id,1,0));
|
||||
m_iconItem = shared_ptr<ItemInstance>(new ItemInstance(Item::minecart_Id,1,0));
|
||||
}
|
||||
else if(temp.find(L"{*RailIcon*}")!=wstring::npos)
|
||||
{
|
||||
m_iconItem = std::shared_ptr<ItemInstance>(new ItemInstance(Tile::rail_Id,1,0));
|
||||
m_iconItem = shared_ptr<ItemInstance>(new ItemInstance(Tile::rail_Id,1,0));
|
||||
}
|
||||
else if(temp.find(L"{*PoweredRailIcon*}")!=wstring::npos)
|
||||
{
|
||||
m_iconItem = std::shared_ptr<ItemInstance>(new ItemInstance(Tile::goldenRail_Id,1,0));
|
||||
m_iconItem = shared_ptr<ItemInstance>(new ItemInstance(Tile::goldenRail_Id,1,0));
|
||||
}
|
||||
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)
|
||||
{
|
||||
m_iconItem = std::shared_ptr<ItemInstance>(new ItemInstance(Tile::rock_Id,1,0));
|
||||
m_iconItem = shared_ptr<ItemInstance>(new ItemInstance(Tile::rock_Id,1,0));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -358,7 +358,7 @@ wstring UIComponent_TutorialPopup::_SetImage(wstring &desc)
|
|||
// hide the icon slot
|
||||
m_image.SetShow( FALSE );
|
||||
}
|
||||
|
||||
|
||||
BOOL imageShowAtEnd = m_image.IsShown();
|
||||
if(imageShowAtStart != imageShowAtEnd)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ private:
|
|||
bool m_lastSceneMovedLeft;
|
||||
bool m_bAllowFade;
|
||||
Tutorial *m_tutorial;
|
||||
std::shared_ptr<ItemInstance> m_iconItem;
|
||||
shared_ptr<ItemInstance> m_iconItem;
|
||||
bool m_iconIsFoil;
|
||||
//int m_iLocalPlayerC;
|
||||
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ void UIControl_EnchantmentBook::tickBook()
|
|||
{
|
||||
UIScene_EnchantingMenu *m_containerScene = (UIScene_EnchantingMenu *)m_parentScene;
|
||||
EnchantmentMenu *menu = m_containerScene->getMenu();
|
||||
std::shared_ptr<ItemInstance> current = menu->getSlot(0)->getItem();
|
||||
shared_ptr<ItemInstance> current = menu->getSlot(0)->getItem();
|
||||
if (!ItemInstance::matches(current, last))
|
||||
{
|
||||
last = current;
|
||||
|
|
@ -122,7 +122,7 @@ void UIControl_EnchantmentBook::tickBook()
|
|||
{
|
||||
shouldBeOpen = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (shouldBeOpen) open += 0.2f;
|
||||
else open -= 0.2f;
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ private:
|
|||
//BOOL m_bDirty;
|
||||
//float m_fScale,m_fAlpha;
|
||||
//int m_iPad;
|
||||
std::shared_ptr<ItemInstance> last;
|
||||
shared_ptr<ItemInstance> last;
|
||||
|
||||
//float m_fScreenWidth,m_fScreenHeight;
|
||||
//float m_fRawWidth,m_fRawHeight;
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ bool UIControl_SpaceIndicatorBar::setupControl(UIScene *scene, IggyValuePath *pa
|
|||
return success;
|
||||
}
|
||||
|
||||
void UIControl_SpaceIndicatorBar::init(const wstring &label, int id, int64_t min, int64_t max)
|
||||
void UIControl_SpaceIndicatorBar::init(const wstring &label, int id, __int64 min, __int64 max)
|
||||
{
|
||||
m_label = label;
|
||||
m_id = id;
|
||||
|
|
@ -61,11 +61,11 @@ void UIControl_SpaceIndicatorBar::reset()
|
|||
setSaveGameOffset(0.0f);
|
||||
}
|
||||
|
||||
void UIControl_SpaceIndicatorBar::addSave(int64_t size)
|
||||
void UIControl_SpaceIndicatorBar::addSave(__int64 size)
|
||||
{
|
||||
float startPercent = (float)((m_currentTotal-m_min))/(m_max-m_min);
|
||||
|
||||
m_sizeAndOffsets.push_back( pair<int64_t, float>(size, startPercent) );
|
||||
m_sizeAndOffsets.push_back( pair<__int64, float>(size, startPercent) );
|
||||
|
||||
m_currentTotal += size;
|
||||
setTotalSize(m_currentTotal);
|
||||
|
|
@ -75,7 +75,7 @@ void UIControl_SpaceIndicatorBar::selectSave(int index)
|
|||
{
|
||||
if(index >= 0 && index < m_sizeAndOffsets.size())
|
||||
{
|
||||
pair<int64_t,float> values = m_sizeAndOffsets[index];
|
||||
pair<__int64,float> values = m_sizeAndOffsets[index];
|
||||
setSaveSize(values.first);
|
||||
setSaveGameOffset(values.second);
|
||||
}
|
||||
|
|
@ -86,7 +86,7 @@ void UIControl_SpaceIndicatorBar::selectSave(int index)
|
|||
}
|
||||
}
|
||||
|
||||
void UIControl_SpaceIndicatorBar::setSaveSize(int64_t size)
|
||||
void UIControl_SpaceIndicatorBar::setSaveSize(__int64 size)
|
||||
{
|
||||
m_currentSave = size;
|
||||
|
||||
|
|
@ -99,7 +99,7 @@ void UIControl_SpaceIndicatorBar::setSaveSize(int64_t size)
|
|||
IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_setSaveSizeFunc , 1 , value );
|
||||
}
|
||||
|
||||
void UIControl_SpaceIndicatorBar::setTotalSize(int64_t size)
|
||||
void UIControl_SpaceIndicatorBar::setTotalSize(__int64 size)
|
||||
{
|
||||
float percent = (float)((m_currentTotal-m_min))/(m_max-m_min);
|
||||
|
||||
|
|
|
|||
|
|
@ -6,28 +6,28 @@ class UIControl_SpaceIndicatorBar : public UIControl_Base
|
|||
{
|
||||
private:
|
||||
IggyName m_setSaveSizeFunc, m_setTotalSizeFunc, m_setSaveGameOffsetFunc;
|
||||
int64_t m_min;
|
||||
int64_t m_max;
|
||||
int64_t m_currentSave, m_currentTotal;
|
||||
__int64 m_min;
|
||||
__int64 m_max;
|
||||
__int64 m_currentSave, m_currentTotal;
|
||||
float m_currentOffset;
|
||||
|
||||
vector<pair<int64_t,float> > m_sizeAndOffsets;
|
||||
vector<pair<__int64,float> > m_sizeAndOffsets;
|
||||
|
||||
public:
|
||||
UIControl_SpaceIndicatorBar();
|
||||
|
||||
virtual bool setupControl(UIScene *scene, IggyValuePath *parent, const string &controlName);
|
||||
|
||||
void init(const wstring &label, int id, int64_t min, int64_t max);
|
||||
void init(const wstring &label, int id, __int64 min, __int64 max);
|
||||
virtual void ReInit();
|
||||
void reset();
|
||||
|
||||
void addSave(int64_t size);
|
||||
void addSave(__int64 size);
|
||||
void selectSave(int index);
|
||||
|
||||
|
||||
private:
|
||||
void setSaveSize(int64_t size);
|
||||
void setTotalSize(int64_t totalSize);
|
||||
void setSaveSize(__int64 size);
|
||||
void setTotalSize(__int64 totalSize);
|
||||
void setSaveGameOffset(float offset);
|
||||
};
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue